1 | const _excluded = ["disabled", "readOnly"];
|
2 |
|
3 | function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
4 |
|
5 | function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
6 |
|
7 | import PropTypes from 'prop-types';
|
8 | import React from 'react';
|
9 | import * as CustomPropTypes from './PropTypes';
|
10 | const propTypes = {
|
11 | value: PropTypes.string,
|
12 | placeholder: PropTypes.string,
|
13 | maxLength: PropTypes.number,
|
14 | onChange: PropTypes.func.isRequired,
|
15 | disabled: CustomPropTypes.disabled,
|
16 | readOnly: CustomPropTypes.disabled
|
17 | };
|
18 | const MultiselectInput = React.forwardRef((_ref, ref) => {
|
19 | let {
|
20 | disabled,
|
21 | readOnly
|
22 | } = _ref,
|
23 | props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
24 |
|
25 | let size = Math.max(String(props.value || props.placeholder || '').length, 1) + 1;
|
26 | return React.createElement("input", _extends({
|
27 | spellCheck: "false",
|
28 | autoCapitalize: "off"
|
29 | }, props, {
|
30 | size: size,
|
31 | ref: ref,
|
32 | autoComplete: "off",
|
33 | className: "rw-multiselect-input",
|
34 | "aria-disabled": disabled,
|
35 | "aria-readonly": readOnly,
|
36 | disabled: disabled,
|
37 | readOnly: readOnly
|
38 | }));
|
39 | });
|
40 | MultiselectInput.displayName = 'MultiselectInput';
|
41 | MultiselectInput.propTypes = propTypes;
|
42 | export default MultiselectInput; |
\ | No newline at end of file |