{"_id":"@atis/react-select","_rev":"3-08096eb9efe582aeabf4667e26bead04","name":"@atis/react-select","description":"A Select control built with and for ReactJS","dist-tags":{"latest":"0.9.1"},"versions":{"0.9.1":{"name":"@atis/react-select","version":"0.9.1","description":"A Select control built with and for ReactJS","main":"lib/Select.js","style":"dist/default.css","author":{"name":"Jed Watson"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/JedWatson/react-select.git"},"dependencies":{"classnames":"^2.2.0","react-input-autosize":"^0.6.2"},"devDependencies":{"babel":"^5.8.23","babel-eslint":"^4.1.3","chai":"^3.4.0","coveralls":"^2.11.4","eslint":"^1.8.0","eslint-plugin-react":"^3.6.3","gulp":"^3.9.0","istanbul":"^0.4.0","jsdom":"^7.0.2","mocha":"^2.3.3","react":"^0.14.1","react-addons-test-utils":"^0.14.1","react-dom":"^0.14.1","react-gravatar":"^2.2.2","react-component-gulp-tasks":"^0.7.7","sinon":"^1.17.2","unexpected":"^10.0.2","unexpected-dom":"^3.0.2","unexpected-sinon":"^8.0.0"},"peerDependencies":{"react":"^0.14.1 || ^15","react-dom":"^0.14.1 || ^15"},"browserify-shim":{"classnames":"global:classNames","react":"global:React","react-input-autosize":"global:AutosizeInput"},"scripts":{"build":"gulp clean && NODE_ENV=production gulp build","bump":"gulp bump","bump:major":"gulp bump:major","bump:minor":"gulp bump:minor","cover":"istanbul cover _mocha -- -u exports --compilers js:babel/register -R spec","coveralls":"NODE_ENV=test istanbul cover _mocha --report lcovonly -- -u exports --compilers js:babel/register -R spec && cat coverage/lcov.info | coveralls","examples":"gulp dev:server","lint":"eslint .","publish:examples":"NODE_ENV=production gulp publish:examples","release":"NODE_ENV=production gulp release","start":"gulp dev","test":"mocha --compilers js:babel/register","watch":"gulp watch:lib"},"keywords":["combobox","form","input","multiselect","react","react-component","select","ui"],"gitHead":"3da91f7a2bc6f7bc077d4ab78bc99dd41a12432b","bugs":{"url":"https://github.com/JedWatson/react-select/issues"},"homepage":"https://github.com/JedWatson/react-select#readme","_id":"@atis/react-select@0.9.1","_shasum":"3dd3bfd49fab3a43173699bcf13cd88c70fd5bd2","_from":".","_npmVersion":"3.3.12","_nodeVersion":"5.3.0","_npmUser":{"name":"atis","email":"atis@aol.es"},"dist":{"shasum":"3dd3bfd49fab3a43173699bcf13cd88c70fd5bd2","tarball":"https://registry.npmjs.org/@atis/react-select/-/react-select-0.9.1.tgz","integrity":"sha512-VfrI5c/seJPZaaZGSLTRBivwkHfIDjU4Q52fuCCParaDsUh375r3AxX8UQzJpXvemdo7XbBS24jEY3Sx4MhC3w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIH3NquzhkGpOzSVqCIKYf5oQWR+oY6Io6327+in5lOwDAiBctuKtLghMiv7mAN+EPgW6piJYYDpuoTz0XfkLyyuxqw=="}]},"maintainers":[{"name":"atis","email":"atis@aol.es"}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/react-select-0.9.1.tgz_1462804897551_0.6508729492779821"}}},"readme":"[![Build Status](https://travis-ci.org/JedWatson/react-select.svg?branch=master)](https://travis-ci.org/JedWatson/react-select)\n[![Coverage Status](https://coveralls.io/repos/JedWatson/react-select/badge.svg?branch=master&service=github)](https://coveralls.io/github/JedWatson/react-select?branch=master)\n\nReact-Select\n============\n\nA Select control built with and for [React](http://facebook.github.io/react/index.html). Initially built for use in [KeystoneJS](http://www.keystonejs.com).\n\n\n## Demo & Examples\n\nLive demo: [jedwatson.github.io/react-select](http://jedwatson.github.io/react-select/)\n\nTo build the examples locally, run:\n\n```javascript\nnpm install\nnpm start\n```\n\nThen open [`localhost:8000`](http://localhost:8000) in a browser.\n\n\n## Project Status\n\nThis project is quite stable and ready for production use, however there are plans to improve it including:\n\n- CSS Styles and theme support (working, could be improved)\n- Documentation website (currently just examples)\n- Custom options rendering (in progress)\n\nIt's loosely based on [Selectize](http://brianreavis.github.io/selectize.js/) (in terms of behaviour and user experience) and [React-Autocomplete](https://github.com/rackt/react-autocomplete) (as a native React Combobox implementation), as well as other select controls including [Chosen](http://harvesthq.github.io/chosen/) and [Select2](http://ivaynberg.github.io/select2/).\n\n\n## Installation\n\nThe easiest way to use React-Select is to install it from NPM and include it in your own React build process (using [Browserify](http://browserify.org), etc).\n\n```javascript\nnpm install react-select --save\n```\n\nYou can also use the standalone build by including `dist/select.js` and `dist/default.css` in your page. If you use this, make sure you have already included the following dependencies:\n\n* [React](http://facebook.github.io/react/)\n* [classNames](http://jedwatson.github.io/classnames/)\n* [react-input-autosize](https://github.com/JedWatson/react-input-autosize)\n\n\n## Usage\n\nReact-Select generates a hidden text field containing the selected value, so you can submit it as part of a standard form. You can also listen for changes with the `onChange` event property.\n\nOptions should be provided as an `Array` of `Object`s, each with a `value` and `label` property for rendering and searching. You can use a `disabled` property to indicate whether the option is disabled or not.\n\nThe `value` property of each option should be set to either a string or a number.\n\nWhen the value is changed, `onChange(newValue, [selectedOptions])` will fire.\n\n```javascript\nvar Select = require('react-select');\n\nvar options = [\n\t{ value: 'one', label: 'One' },\n\t{ value: 'two', label: 'Two' }\n];\n\nfunction logChange(val) {\n\tconsole.log(\"Selected: \" + val);\n}\n\n<Select\n\tname=\"form-field-name\"\n\tvalue=\"one\"\n\toptions={options}\n\tonChange={logChange}\n/>\n```\n\n### Multiselect options\n\nYou can enable multi-value selection by setting `multi={true}`. In this mode:\n\n* Selected options will be removed from the dropdown menu\n* The values of the selected items are joined using the `delimiter` property to create the input value\n* A simple value, if provided, will be split using the `delimiter` property\n* The `onChange` event provides an array of the selected options as the second argument\n* The first argument to `onChange` is always a string, regardless of whether the values of the selected options are numbers or strings\n* By default, only options in the `options` array can be selected. Setting `allowCreate` to true allows new options to be created if they do not already exist.\n\n### Async options\n\nIf you want to load options asynchronously, instead of providing an `options` Array, provide a `asyncOptions` Function.\n\nThe function takes two arguments `String input, Function callback`and will be called when the input text is changed.\n\nWhen your async process finishes getting the options, pass them to `callback(err, data)` in a Object `{ options: [] }`.\n\nThe select control will intelligently cache options for input strings that have already been fetched. The cached result set will be filtered as more specific searches are input, so if your async process would only return a smaller set of results for a more specific query, also pass `complete: true` in the callback object. Caching can be disabled by setting `cacheAsyncResults` to `false` (Note that `complete: true` will then have no effect).\n\nUnless you specify the property `autoload={false}` the control will automatically load the default set of options (i.e. for `input: ''`) when it is mounted.\n\n```javascript\nvar Select = require('react-select');\n\nvar getOptions = function(input, callback) {\n\tsetTimeout(function() {\n\t\tcallback(null, {\n\t\t\toptions: [\n\t\t\t\t{ value: 'one', label: 'One' },\n\t\t\t\t{ value: 'two', label: 'Two' }\n\t\t\t],\n\t\t\t// CAREFUL! Only set this to true when there are no more options,\n\t\t\t// or more specific queries will not be sent to the server.\n\t\t\tcomplete: true\n\t\t});\n\t}, 500);\n};\n\n<Select\n\tname=\"form-field-name\"\n\tvalue=\"one\"\n\tasyncOptions={getOptions}\n/>\n```\n\n### Async options with Promises\n\n`asyncOptions` now supports Promises, which can be used in very much the same way as callbacks.\n\nEverything that applies to `asyncOptions` with callbacks still applies to the Promises approach (e.g. caching, autoload, ...)\n\nAn example using the `fetch` API and ES6 syntax, with an API that returns an object like:\n\n```javascript\nimport Select from 'react-select';\n\n/*\n * assuming the API returns something like this:\n *   const json = [ \n * \t   { value: 'one', label: 'One' },\n * \t   { value: 'two', label: 'Two' }\n *   ]\n */\n\nconst getOptions = (input) => {\n  return fetch(`/users/${input}.json`)\n    .then((response) => {\n      return response.json();\n    }).then((json) => {\n      return { options: json };\n    });\n}\n\n<Select\n\tname=\"form-field-name\"\n\tvalue=\"one\"\n\tasyncOptions={getOptions}\n/>\n```\n\n### Async options loaded externally\n\nIf you want to load options asynchronously externally from the `Select` component, you can have the `Select` component show a loading spinner by passing in the `isLoading` prop set to `true`.\n\n```javascript\nvar Select = require('react-select');\n\nvar isLoadingExternally = true;\n\n<Select\n  name=\"form-field-name\"\n\tisLoading={isLoadingExternally}\n\t...\n/>\n```\n\n### Filtering options\n\nYou can control how options are filtered with the following properties:\n\n* `matchPos`: `\"start\"` or `\"any\"`: whether to match the text entered at the start or any position in the option value\n* `matchProp`: `\"label\"`, `\"value\"` or `\"any\"`: whether to match the value, label or both values of each option when filtering\n* `ignoreCase`: `Boolean`: whether to ignore case or match the text exactly when filtering\n\n`matchProp` and `matchPos` both default to `\"any\"`.\n`ignoreCase` defaults to `true`.\n\n#### Advanced filters\n\nYou can also completely replace the method used to filter either a single option, or the entire options array (allowing custom sort mechanisms, etc.)\n\n* `filterOption`: `function(Object option, String filter)` returns `Boolean`. Will override `matchPos`, `matchProp` and `ignoreCase` options.\n* `filterOptions`: `function(Array options, String filter, Array currentValues)` returns `Array filteredOptions`. Will override `filterOption`, `matchPos`, `matchProp` and `ignoreCase` options.\n\nFor multi-select inputs, when providing a custom `filterOptions` method, remember to exclude current values from the returned array of options.\n\n### Further options\n\n\n\tProperty\t\t\t|\tType\t\t|\tDescription\n:-----------------------|:--------------|:--------------------------------\n\taddLabelText\t\t|\tstring\t\t|\ttext to display when `allowCreate` is true\n\tallowCreate\t\t\t|\tbool\t\t|\tallow new options to be created in multi mode (displays an \"Add \\<option> ?\" item when a value not already in the `options` array is entered)\n\tasyncOptions \t\t|\tfunc\t\t|\tfunction to call to get options\n\tautoload \t\t\t|\tbool\t\t|\twhether to auto-load the default async options set\n\tbackspaceRemoves \t|\tbool\t\t|\twhether pressing backspace removes the last item when there is no input value\n\tcacheAsyncResults\t|\tbool\t\t|\tenables the options cache for `asyncOptions` (default: `true`)\n\tclassName \t\t\t|\tstring\t\t|\tclassName for the outer element\n\tclearable \t\t\t|\tbool\t\t|\tshould it be possible to reset value\n\tclearAllText \t\t|\tstring\t\t|\ttitle for the \"clear\" control when `multi` is true\n\tclearValueText \t\t|\tstring\t\t|\ttitle for the \"clear\" control\n\tdelimiter \t\t\t|\tstring\t\t|\tdelimiter to use to join multiple values\n\tdisabled \t\t\t|\tbool\t\t|\twhether the Select is disabled or not\n\tfilterOption \t\t|\tfunc\t\t|\tmethod to filter a single option: `function(option, filterString)`\n\tfilterOptions \t\t|\tfunc\t\t|\tmethod to filter the options array: `function([options], filterString, [values])`\n\tignoreCase \t\t\t|\tbool\t\t|\twhether to perform case-insensitive filtering\n\tinputProps \t\t\t|\tobject\t\t|\tcustom attributes for the Input (in the Select-control) e.g: `{'data-foo': 'bar'}`\n\tisLoading\t\t\t|\tbool\t\t|\twhether the Select is loading externally or not (such as options being loaded)\n\tlabelKey\t\t\t|\tstring\t\t|\tthe option property to use for the label\n\tmatchPos \t\t\t|\tstring\t\t|\t(any, start) match the start or entire string when filtering\n\tmatchProp \t\t\t|\tstring\t\t|\t(any, label, value) which option property to filter on\n\tmulti \t\t\t\t|\tbool\t\t|\tmulti-value input\n\tname \t\t\t\t|\tstring\t\t|\tfield name, for hidden `<input />` tag\n\tnewOptionCreator\t|\tfunc\t\t|\tfactory to create new options when `allowCreate` is true\n\tnoResultsText \t\t|\tstring\t\t|\tplaceholder displayed when there are no matching search results\n\tonBlur \t\t\t\t|\tfunc\t\t|\tonBlur handler: `function(event) {}`\n\tonChange \t\t\t|\tfunc\t\t|\tonChange handler: `function(newValue) {}`\n\tonFocus \t\t\t|\tfunc\t\t|\tonFocus handler: `function(event) {}`\n\tonInputChange\t\t|\tfunc\t\t|\tonInputChange handler: `function(inputValue) {}`\n\tonOptionLabelClick\t|\tfunc\t\t|\tonClick handler for value labels: `function (value, event) {}`\n\toptionRenderer\t\t|\tfunc\t\t|\tfunction which returns a custom way to render the options in the menu\n\toptions \t\t\t|\tarray\t\t|\tarray of options\n\tplaceholder \t\t|\tstring\t\t|\tfield placeholder, displayed when there's no value\n\tsearchable \t\t\t|\tbool\t\t|\twhether to enable searching feature or not\n\tsearchingText\t\t|\tstring\t\t|\tmessage to display whilst options are loading via asyncOptions, or when `isLoading` is true\n\tsearchPromptText \t|\tstring\t\t|\tlabel to prompt for search input\n\tvalue \t\t\t\t|\tany\t\t\t|\tinitial field value\n\tvalueKey\t\t\t|\tstring\t\t|\tthe option property to use for the value\n\tvalueRenderer\t\t|\tfunc\t\t|\tfunction which returns a custom way to render the value selected\n\n### Methods\n\nRight now there's simply a `focus()` method that gives the control focus. All other methods on `<Select>` elements should be considered private and prone to change.\n\n```javascript\n// focuses the input element\n<instance>.focus();\n```\n\n# Contributing\n\nSee our [CONTRIBUTING.md](https://github.com/JedWatson/react-select/blob/master/CONTRIBUTING.md) for information on how to contribute.\n\n\n# License\n\nMIT Licensed. Copyright (c) Jed Watson 2015.\n","maintainers":[{"name":"atis","email":"atis@aol.es"}],"time":{"modified":"2022-06-12T14:49:59.075Z","created":"2016-05-09T14:41:38.748Z","0.9.1":"2016-05-09T14:41:38.748Z"},"homepage":"https://github.com/JedWatson/react-select#readme","keywords":["combobox","form","input","multiselect","react","react-component","select","ui"],"repository":{"type":"git","url":"git+https://github.com/JedWatson/react-select.git"},"author":{"name":"Jed Watson"},"bugs":{"url":"https://github.com/JedWatson/react-select/issues"},"license":"MIT","readmeFilename":"README.md"}