<commit_before>// © <NAME> 2015

// - [github](https://github.com/alsoscotland/react-super-select)
// - [documentation](http://alsoscotland.github.io/react-super-select/)
// - freely distributed under the MIT license.

var _ = require('lodash'),
    classNames = require('classnames'),
    React = require('react');

// Dependencies
//  - [Lodash](https://lodash.com/)
//  - [classnames](https://www.npmjs.com/package/classnames)
//  - [React](https://facebook.github.io/react/index.html)

var ReactSuperSelect = React.createClass({

// Properties
// ------
  propTypes: {

    // BOOLEAN OPTIONS
    // ---------------

    // **multiple** (Boolean) *optional*  - Whether or not the control supports multi-selection. When using the **tags** display option, this option is redundant
    multiple: React.PropTypes.bool,
    // **searchable** (Boolean) *optional* - Whether or not to show a search bar in the dropdown area which offers text-based filtering of the **dataSource** options (by label key)
    searchable: React.PropTypes.bool,
    // **tags** (Boolean) *optional* - Whether or not to display your chosen multi-select values as tags.  (When set, there is no need to set the **multiple** option)
    tags: React.PropTypes.bool,

    // CSS CLASS / CUSTOM STYLING SUPPORT OPTIONS
    // -----------------------------------

    // **customClass** (String) *optional* - This value will be added as a css class to the control's main wrapping element.  You should be able to overide all styling by leading your rules with
    // ```css
    // .r-ss-wrap.{customClass}
    // ```
    customClass: React.PropTypes.string,

    // **customGroupHeadingClass** (String) *optional* - Used in conjunction with the **groupBy** option.  The string value will be added as a custom css class to the group headings which are rendered into the dropdown
    customGroupHeadingClass: React.PropTypes.string,

    // **customSearchIconClass** (String) *optional* - This value will be added as a css class to the icon element in the search-filtering bar (when **searchable** is true).  Allowing you to override the default search icon (default: a magnifying glass)
    customSearchIconClass: React.PropTypes.string,

    // **customLoaderClass** (String) *optional* - Used in conjunction with the **ajaxDataFetch** option.  This string value will be added as a css class to the loading icon (default: an animated gif spinner as base64 background image in css) allowing css overrides.
    customLoaderClass: React.PropTypes.string,

    // **customTagClass** (String) *optional* - Used in conjunction with the **tags** option.  This value will be added as a css class to the wrapper of a selection displayed as a tag. You should be able to overide all tag styling by leading your css rules with
    // ```css
    //  .r-ss-tag.{customTagClass}
    //  ```
    customTagClass: React.PropTypes.string,

    // MAIN CHANGE HANDLER
    // -------------------

    // **onChange** (Function) *required* - This is the main callback handler for the control.  When a user makes selection(s), this handler will be called, the selected option (or when **multiple** or **tags** an array of selected values) will be passed to the handler as an argument.  (The values passed are option objects from the dataSource collection)
    onChange: React.PropTypes.func.isRequired,

    // OPTION DATA-RELATED PROPS
    // -------------------------

    // **ajaxDataFetch** (Function) (*optional - but **dataSource** must be supplied if undefined*) - Your select dropdown's data may be fetched via ajax if you provide a function as the value for this option.
    // The function takes no arguments, but it must return a **promise** object. (i.e. an object with a then function).  The promise must resolve with a value meeting the description of the **dataSource** option documentation. The **dataSource** option should be left undefined when using this option.
    ajaxDataFetch: React.PropTypes.func,

    // **dataSource** (Array|Object|Collection Object) (*optional - but **ajaxDataFetch** must be supplied if undefined*) - The dataSource option provides the data for your options dropdown.
    // The value provided will go to an internal parser (_configureDataSource), which will return a collection (array of option objects) found based on argument type

    //  The parsing method supports dataSource values as:
    //  - an array of option objects (will be directly assigned to state.data)
    //  - an object with a collection property (object.collection will be assigned to state.data)
    //  - an object with a get function (the return value of object.get('collection') will be assigned to state.data)

    //  Each option in the resulting collection must have the following properties:
    //  - a unique value corresponding to the key set by the **optionValueKey** or the default optionValueKey of **id**
    //  - a defined value corresponsing to the key set by the **optionLabelKey** or the default optionLabelKey of **name**
    dataSource: React.PropTypes.oneOfType([
              React.PropTypes.arrayOf(React.PropTypes.object),
              React.PropTypes.object
            ]),

    // **optionLabelKey** (String) (*optional - defaults to using 'name' as the key if undefined*) - This value represents the key in each option object (from the **dataSource** collection), which represents the value you would like displayed for each option.
    optionLabelKey: React.PropTypes.string,

    // **optionValueKey** (String) (*optional - defaults to using 'id' as the key if undefined*) - This value represents the key in each option object (from the **dataSource** collection), which represents the value that **uniquely identifies** that option across the **dataSource** collection.  Think of it in terms of the value attribute of a traditional html `<select>` element
    optionValueKey: React.PropTypes.string, // value this maps to should be unique in data source

    // **pageDataFetch** (Function) *optional* (A *hasMorePages* function should be provided when using this option) - Additional pages of data can be fetched  via ajax if you provide a function as the value for this option.<commit_msg>fix docs typo<commit_after>// © <NAME> 2015

// - [github](https://github.com/alsoscotland/react-super-select)
// - [documentation](http://alsoscotland.github.io/react-super-select/)
// - freely distributed under the MIT license.

var _ = require('lodash'),
    classNames = require('classnames'),
    React = require('react');

// Dependencies
//  - [Lodash](https://lodash.com/)
//  - [classnames](https://www.npmjs.com/package/classnames)
//  - [React](https://facebook.github.io/react/index.html)

var ReactSuperSelect = React.createClass({

// Properties
// ------
  propTypes: {

    // BOOLEAN OPTIONS
    // ---------------

    // **multiple** (Boolean) *optional*  - Whether or not the control supports multi-selection. When using the **tags** display option, this option is redundant
    multiple: React.PropTypes.bool,
    // **searchable** (Boolean) *optional* - Whether or not to show a search bar in the dropdown area which offers text-based filtering of the **dataSource** options (by label key)
    searchable: React.PropTypes.bool,
    // **tags** (Boolean) *optional* - Whether or not to display your chosen multi-select values as tags.  (When set, there is no need to set the **multiple** option)
    tags: React.PropTypes.bool,

    // CSS CLASS / CUSTOM STYLING SUPPORT OPTIONS
    // -----------------------------------

    // **customClass** (String) *optional* - This value will be added as a css class to the control's main wrapping element.  You should be able to overide all styling by leading your rules with
    // ```css
    // .r-ss-wrap.{customClass}
    // ```
    customClass: React.PropTypes.string,

    // **customGroupHeadingClass** (String) *optional* - Used in conjunction with the **groupBy** option.  The string value will be added as a custom css class to the group headings which are rendered into the dropdown
    customGroupHeadingClass: React.PropTypes.string,

    // **customSearchIconClass** (String) *optional* - This value will be added as a css class to the icon element in the search-filtering bar (when **searchable** is true).  Allowing you to override the default search icon (default: a magnifying glass)
    customSearchIconClass: React.PropTypes.string,

    // **customLoaderClass** (String) *optional* - Used in conjunction with the **ajaxDataFetch** option.  This string value will be added as a css class to the loading icon (default: an animated gif spinner as base64 background image in css) allowing css overrides.
    customLoaderClass: React.PropTypes.string,

    // **customTagClass** (String) *optional* - Used in conjunction with the **tags** option.  This value will be added as a css class to the wrapper of a selection displayed as a tag. You should be able to overide all tag styling by leading your css rules with
    // ```css
    //  .r-ss-tag.{customTagClass}
    //  ```
    customTagClass: React.PropTypes.string,

    // MAIN CHANGE HANDLER
    // -------------------

    // **onChange** (Function) *required* - This is the main callback handler for the control.  When a user makes selection(s), this handler will be called, the selected option (or when **multiple** or **tags** an array of selected values) will be passed to the handler as an argument.  (The values passed are option objects from the dataSource collection)
    onChange: React.PropTypes.func.isRequired,

    // OPTION DATA-RELATED PROPS
    // -------------------------

    // **ajaxDataFetch** (Function) (*optional - but **dataSource** must be supplied if undefined*) - Your select dropdown's data may be fetched via ajax if you provide a function as the value for this option.
    // The function takes no arguments, but it must return a **promise** object. (i.e. an object with a then function).  The promise must resolve with a value meeting the description of the **dataSource** option documentation. The **dataSource** option should be left undefined when using this option.
    ajaxDataFetch: React.PropTypes.func,

    // **dataSource** (Array|Object|Collection Object) (*optional - but **ajaxDataFetch** must be supplied if undefined*) - The dataSource option provides the data for your options dropdown.
    // The value provided will go to an internal parser (_configureDataSource), which will return a collection (array of option objects) found based on argument type

    //  The parsing method supports dataSource values as:
    //  - an array of option objects (will be directly assigned to state.data)
    //  - an object with a collection property (object.collection will be assigned to state.data)
    //  - an object with a get function (the return value of object.get('collection') will be assigned to state.data)

    //  Each option in the resulting collection must have the following properties:
    //  - a unique value corresponding to the key set by the **optionValueKey** or the default optionValueKey of **id**
    //  - a defined value corresponding to the key set by the **optionLabelKey** or the default optionLabelKey of **name**
    dataSource: React.PropTypes.oneOfType([
              React.PropTypes.arrayOf(React.PropTypes.object),
              React.PropTypes.object
            ]),

    // **optionLabelKey** (String) (*optional - defaults to using 'name' as the key if undefined*) - This value represents the key in each option object (from the **dataSource** collection), which represents the value you would like displayed for each option.
    optionLabelKey: React.PropTypes.string,

    // **optionValueKey** (String) (*optional - defaults to using 'id' as the key if undefined*) - This value represents the key in each option object (from the **dataSource** collection), which represents the value that **uniquely identifies** that option across the **dataSource** collection.  Think of it in terms of the value attribute of a traditional html `<select>` element
    optionValueKey: React.PropTypes.string, // value this maps to should be unique in data source

    // **pageDataFetch** (Function) *optional* (A *hasMorePages* function should be provided when using this option) - Additional pages of data can be fetched  via ajax if you provide a function as the value for this option.
{'fraction_non_alphanumeric': 0.11437802907915993, 'fraction_numerical': 0.0009693053311793214, 'mean_word_length': 3.2915077989601387, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 8, 'lorem ipsum': 0, 'www.': 2, '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': '5687064', 'n_tokens_mistral': 3215, 'n_tokens_neox': 3116, 'n_words': 1443}