<commit_before>/*
 * 0xor1  http://github.com/0xor1
 */


part of controls_and_panels;


const String TEXT_BOX = 'text-box';


class TextBox extends Control{


  InputElement _inputElement = new InputElement(type:'text');


  String get value => _inputElement.value;


  void set value (String str){

    _inputElement.value = str == null? '': str;

  }


  String get placeholder => _inputElement.placeholder;


  void set placeholder (String str){

    _inputElement.placeholder = str == null? '': str;

  }


  TextBox({String value: null, String placeholder: null}){

    _insertStyle(_textBoxStyle);

    html.classes.add(TEXT_BOX);

    controlContentElement.children.add(_inputElement);

    _inputElement
      ..onBlur.listen(blur)
      ..onFocus.listen(focus);

    this.placeholder = placeholder;

    this.value = value;

  }


}



final Style _textBoxStyle = new Style('''

  .$TEXT_BOX > .$CONTROL_CONTENT_ELEMENT > input
  {
    margin: 0;
    border: 1px solid #888;
    padding: 5px;
  }

''');<commit_msg>tweak textBox style to fill its div wrapper<commit_after>/*
 * 0xor1  http://github.com/0xor1
 */


part of controls_and_panels;


const String TEXT_BOX = 'text-box';


class TextBox extends Control{


  InputElement _inputElement = new InputElement(type:'text');


  String get value => _inputElement.value;


  void set value (String str){

    _inputElement.value = str == null? '': str;

  }


  String get placeholder => _inputElement.placeholder;


  void set placeholder (String str){

    _inputElement.placeholder = str == null? '': str;

  }


  TextBox({String value: null, String placeholder: null}){

    _insertStyle(_textBoxStyle);

    html.classes.add(TEXT_BOX);

    controlContentElement.children.add(_inputElement);

    _inputElement
      ..onBlur.listen(blur)
      ..onFocus.listen(focus);

    this.placeholder = placeholder;

    this.value = value;

  }


}



final Style _textBoxStyle = new Style('''

  .$TEXT_BOX > .$CONTROL_CONTENT_ELEMENT > input
  {
    width: 100%;
    margin: 0;
    border: 1px solid #888;
    padding: 5px;
  }

''');
{'fraction_non_alphanumeric': 0.12160228898426323, 'fraction_numerical': 0.010968049594659036, 'mean_word_length': 3.196, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '6312009', 'n_tokens_mistral': 733, 'n_tokens_neox': 647, 'n_words': 161}