<commit_before>package doom.bs;

import Doom.*;
import doom.Node;
import js.html.MouseEvent;

class Button extends Component<ButtonApi, ButtonState> {
  var classes(default, null) : Array<String>;

  public static function create(style : ButtonStyle, ?options : ButtonOptions, onClick: Void -> Void, children : Nodes) : Node {
    if (options == null) options = {};
    return new Button({ click : onClick }, {
      active: options.active,
      disabled: options.disabled,
      outline: options.outline,
      block: options.block,
      size: options.size,
      style: style
    }, children);
  }

  override function render() : Node {
    return button([
      "type" => "button",
      "class" => getClass(state),
      "disabled" => state.disabled,
      "click" => api.click
    ], children);
  }

  public static function getClass(state : ButtonState) : String {
    var classes = ["btn"],
        styleClass = switch state.style {
          case Primary: "btn-primary";
          case Secondary: "btn-secondary";
          case Info: "btn-info";
          case Success: "btn-success";
          case Warning: "btn-warning";
          case Danger: "btn-danger";
        };

    if(state.outline == true)
      styleClass += "-outline";
    classes.push(styleClass);

    var sizeClass = switch state.size {
      case null, Default: "";
      case Large: "btn-lg";
      case Small: "btn-sm";
    };<commit_msg>more details for Button<commit_after>package doom.bs;

import Doom.*;
import doom.Node;
import js.html.MouseEvent;

class Button extends Component<ButtonApi, ButtonState> {
  var classes(default, null) : Array<String>;

  public static function create(style : ButtonStyle, ?options : ButtonOptions, onClick: Void -> Void, children : Nodes) : Node {
    if (options == null) options = {};
    return new Button({ click : onClick }, {
      active: options.active,
      disabled: options.disabled,
      outline: options.outline,
      block: options.block,
      size: options.size,
      dropdownToggle: options.dropdownToggle,
      style: style
    }, children);
  }

  override function render() : Node {
    return button([
      "type" => "button",
      "class" => getClass(state),
      "disabled" => state.disabled,
      "click" => api.click,
      "data-toggle" => (state.dropdownToggle == true ? "dropdown" : null),
      "aria-haspopup" => (state.dropdownToggle == true ? "true" : null),
    ], children);
  }

  public static function getClass(state : ButtonState) : String {
    var classes = ["btn"],
        styleClass = switch state.style {
          case Primary: "btn-primary";
          case Secondary: "btn-secondary";
          case Info: "btn-info";
          case Success: "btn-success";
          case Warning: "btn-warning";
          case Danger: "btn-danger";
        };

    if(state.outline == true)
      styleClass += "-outline";
    classes.push(styleClass);

    var sizeClass = switch state.size {
      case null, Default: "";
      case Large: "btn-lg";
      case Small: "btn-sm";
    };
{'fraction_non_alphanumeric': 0.13587134886773877, 'fraction_numerical': 0.0, 'mean_word_length': 2.632896305125149, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7422607', 'n_tokens_mistral': 885, 'n_tokens_neox': 861, 'n_words': 245}