@commercetools-uikit/search-select-input 0.0.0-canary-2021830134526

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020 commercetools GmbH
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,112 @@
1
+ <!-- THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. -->
2
+ <!-- This file is created by the `yarn generate-readme` script. -->
3
+
4
+ # SearchSelectInput
5
+
6
+ ## Description
7
+
8
+ A search select input component built on top of \`@commercetools-uikit/async-select-input\` to asynchronously load results (options) using the keyword that the user has entered.
9
+
10
+ ## Installation
11
+
12
+ ```
13
+ yarn add @commercetools-uikit/search-select-input
14
+ ```
15
+
16
+ ```
17
+ npm --save install @commercetools-uikit/search-select-input
18
+ ```
19
+
20
+ Additionally install the peer dependencies (if not present)
21
+
22
+ ```
23
+ yarn add react react-dom react-intl
24
+ ```
25
+
26
+ ```
27
+ npm --save install react react-dom react-intl
28
+ ```
29
+
30
+ ## Usage
31
+
32
+ ```jsx
33
+ import SearchSelectInput from '@commercetools-uikit/search-select-input';
34
+
35
+ const Example = () => {
36
+ return (
37
+ <SearchSelectInput
38
+ id="customers"
39
+ name="customers"
40
+ horizontalConstraint={7}
41
+ optionType="single-lined"
42
+ isAutofocussed={false}
43
+ backspaceRemovesValue={true}
44
+ isClearable={true}
45
+ isDisabled={false}
46
+ isReadOnly={false}
47
+ isMulti={true}
48
+ noOptionsMessage="No exact match found"
49
+ loadingMessage="loading exact matches"
50
+ placeholder="Select customers"
51
+ // eslint-disable-next-line no-undef
52
+ loadOptions={customLoadOptionsFunction}
53
+ cacheOptions={false}
54
+ />
55
+ );
56
+ };
57
+
58
+ export default Example;
59
+ ```
60
+
61
+ ## Properties
62
+
63
+ | Props | Type | Required | Default | Description |
64
+ | --------------------------------- | -------------------------------------------------------------------------------------------------- | :------: | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
65
+ | `horizontalConstraint` | `enum`<br/>Possible values:<br/>`3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 'scale', 'auto'` | | | Horizontal size limit of the input fields. |
66
+ | `aria-label` | `string` | | | Aria label (for assistive tech) |
67
+ | `aria-labelledby` | `string` | | | HTML ID of an element that should be used as the label (for assistive tech) |
68
+ | `id` | `string` | | | The id of the search input. This forwarded as react-select's "inputId" |
69
+ | `containerId` | `string` | | | The id to set on the SelectContainer component. This is forwarded as react-select's "id" |
70
+ | `name` | `string` | | | Name of the HTML Input (optional - without this, no input will be rendered) |
71
+ | `placeholder` | `string` | | | Placeholder text for the select value |
72
+ | `components` | `objectOf(func)` | | | Map of components to overwrite the default ones, see [what components you can override](https://react-select.com/components) |
73
+ | `tabIndex` | `string` | | | Sets the tabIndex attribute on the input |
74
+ | `value` | `custom` | | `null` | The value of the select; reflected by the selected option |
75
+ | `backspaceRemovesValue` | `bool` | | | Remove the currently focused option when the user presses backspace |
76
+ | `hasError` | `bool` | | | Indicates the input field has an error |
77
+ | `hasWarning` | `bool` | | | Indicates the input field has a warning |
78
+ | `isReadOnly` | `bool` | | | Is the select read-only |
79
+ | `isDisabled` | `bool` | | | Is the select disabled |
80
+ | `isClearable` | `bool` | | | Is the select value clearable |
81
+ | `isOptionDisabled` | `func` | | | Override the built-in logic to detect whether an option is disabled |
82
+ | `isMulti` | `bool` | | | Support multiple selected options |
83
+ | `isAutofocussed` | `bool` | | | Focus the control when it is mounted. Renamed autoFocus of react-select |
84
+ | `noOptionsMessage` | `func` | | | Can be used to render a custom value when there are no options (either because of no search results, or all options have been used, or there were none in the first place). Gets called with `{ inputValue: String }`. `inputValue` will be an empty string when no search text is present. |
85
+ | `maxMenuHeight` | `number` | | `220` | Maximum height of the menu before scrolling |
86
+ | `menuPortalTarget` | `SafeHTMLElement` | | | Dom element to portal the select menu to |
87
+ | `menuPortalZIndex` | `number` | | `1` | z-index value for the menu portal |
88
+ | `menuShouldBlockScroll` | `bool` | | | whether the menu should block scroll while open |
89
+ | `showOptionGroupDivider` | `bool` | | | Determines if option groups will be separated by a divider |
90
+ | `defaultOptions` | `<bool, arrayOf>` | | | The default set of options to show before the user starts searching. When set to `true`, the results for `loadOptions('')` will be autoloaded. |
91
+ | `defaultOptions<arrayOf>` | `array` | | | |
92
+ | `defaultOptions<arrayOf>[].value` | `string` | ✅ | | |
93
+ | `defaultOptions<arrayOf>[].label` | `string` | | | |
94
+ | `onBlur` | `func` | | | Handle blur events on the control |
95
+ | `onChange` | `func` | ✅ | | Called with a fake event when value changes.&#xA;<br />&#xA;The event's `target.name` will be the `name` supplied in props. The event's `target.value` will hold the value. The value will be the selected option, or an array of options in case `isMulti` is `true`.&#xA;<br />&#xA;Signature: `(event, action) => void` |
96
+ | `onFocus` | `func` | | | Handle focus events on the control |
97
+ | `onInputChange` | `func` | | | Handle change events on the input&#xA;<br />&#xA;Signature: `(inputValue, action) => void` |
98
+ | `tabSelectsValue` | `bool` | | | Select the currently focused option when the user presses tab |
99
+ | `loadOptions` | `func` | ✅ | | Function that returns a promise, which is the set of options to be used once the promise resolves. |
100
+ | `loadingMessage` | `<string, func>` | | | The text shown while the options are being loaded |
101
+ | `cacheOptions` | `any` | | | If cacheOptions is truthy, then the loaded data will be cached. The cache will remain until cacheOptions changes value. |
102
+ | `filterOption` | `func` | | | Custom method to filter whether an option should be displayed in the menu |
103
+ | `optionType` | `enum`<br/>Possible values:<br/>`'single-property', 'double-property', 'multiple-properties'` | | | The style of the an option in the dropdown menu. It could be single lined option or an option with more and custom info |
104
+
105
+ The underlying `@commercetools-uikit/async-select-input` is built on top of [`react-select`](https://github.com/JedWatson/react-select) v3. `@commercetools-uikit/async-select-input` supports mostly the same properties as `react-select` with some minor changes in the behaviour of some of the props. The `@commercetools-uikit/search-select-input` which is built on top `@commercetools-uikit/async-select-input` has predefined values for some the props. The props that have predefined values in `@commercetools-uikit/search-select-input` are as follows:
106
+
107
+ - `components.DropdownIndicator`: Default dropdown indicator is replaced with search icon indicator
108
+ - `components.Option`: The option shown in the dropdown menu can be one of `singled-lined`, `brief-detailed`, or `extended-detailed` types. However, if someone still wants to have a different option layout, they can still pass their own `components.Option` to `@commercetools-uikit/search-select-input`
109
+ - `isSearchable`: `true`
110
+ - `iconLeft`: `undefined`
111
+
112
+ See the [official documentation](https://react-select.com/components) for more information about the available props.
@@ -0,0 +1,322 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var _Object$keys = require('@babel/runtime-corejs3/core-js-stable/object/keys');
6
+ var _Object$getOwnPropertySymbols = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
7
+ var _filterInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/filter');
8
+ var _Object$getOwnPropertyDescriptor = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor');
9
+ var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/for-each');
10
+ var _Object$getOwnPropertyDescriptors = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors');
11
+ var _Object$defineProperties = require('@babel/runtime-corejs3/core-js-stable/object/define-properties');
12
+ var _Object$defineProperty = require('@babel/runtime-corejs3/core-js-stable/object/define-property');
13
+ var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
14
+ var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
15
+ var react = require('react');
16
+ var PropTypes = require('prop-types');
17
+ var reactIntl = require('react-intl');
18
+ var utils = require('@commercetools-uikit/utils');
19
+ var AsyncSelectInput = require('@commercetools-uikit/async-select-input');
20
+ var selectUtils = require('@commercetools-uikit/select-utils');
21
+ var _styled = require('@emotion/styled/base');
22
+ var designSystem = require('@commercetools-uikit/design-system');
23
+ var jsxRuntime = require('@emotion/react/jsx-runtime');
24
+
25
+ function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
26
+
27
+ var _Object$keys__default = /*#__PURE__*/_interopDefault(_Object$keys);
28
+ var _Object$getOwnPropertySymbols__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertySymbols);
29
+ var _filterInstanceProperty__default = /*#__PURE__*/_interopDefault(_filterInstanceProperty);
30
+ var _Object$getOwnPropertyDescriptor__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertyDescriptor);
31
+ var _forEachInstanceProperty__default = /*#__PURE__*/_interopDefault(_forEachInstanceProperty);
32
+ var _Object$getOwnPropertyDescriptors__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertyDescriptors);
33
+ var _Object$defineProperties__default = /*#__PURE__*/_interopDefault(_Object$defineProperties);
34
+ var _Object$defineProperty__default = /*#__PURE__*/_interopDefault(_Object$defineProperty);
35
+ var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
36
+ var PropTypes__default = /*#__PURE__*/_interopDefault(PropTypes);
37
+ var AsyncSelectInput__default = /*#__PURE__*/_interopDefault(AsyncSelectInput);
38
+ var _styled__default = /*#__PURE__*/_interopDefault(_styled);
39
+
40
+ var messages = reactIntl.defineMessages({
41
+ noOptionsMessage: {
42
+ id: 'UIKit.SearchSelectInput.noOptionsMessage',
43
+ description: 'Text of search select dropdown when no options match search text',
44
+ defaultMessage: 'No matches found for your search term'
45
+ },
46
+ loadingOptionsMessage: {
47
+ id: 'UIKit.SearchSelectInput.loadingOptionsMessage',
48
+ description: 'Text showed while the options are being loaded',
49
+ defaultMessage: 'Loading exact matches'
50
+ },
51
+ placeholderMessage: {
52
+ id: 'UIKit.SearchSelectInput.placeholderMessage',
53
+ description: 'Placeholder text for the input',
54
+ defaultMessage: 'Search by…'
55
+ }
56
+ });
57
+
58
+ var SearchSelectInputWrapper = _styled__default['default']("div", process.env.NODE_ENV === "production" ? {
59
+ target: "ec7yve10"
60
+ } : {
61
+ target: "ec7yve10",
62
+ label: "SearchSelectInputWrapper"
63
+ })(function (props) {
64
+ return !props.isDisabled && !props.isReadOnly ? "div[class$='control'] {\n &:hover {\n cursor: text;\n }\n div[class$='indicatorContainer' i] {\n cursor: pointer;\n svg * {\n fill: ".concat(designSystem.customProperties.colorSolid, ";\n }\n }\n }") : '';
65
+ }, ";" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNlYXJjaC1zZWxlY3QtaW5wdXQuc3R5bGVzLmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUkyQyIsImZpbGUiOiJzZWFyY2gtc2VsZWN0LWlucHV0LnN0eWxlcy5qcyIsInNvdXJjZXNDb250ZW50IjpbIi8qIGVzbGludC1kaXNhYmxlIGltcG9ydC9wcmVmZXItZGVmYXVsdC1leHBvcnQgKi9cbmltcG9ydCBzdHlsZWQgZnJvbSAnQGVtb3Rpb24vc3R5bGVkJztcbmltcG9ydCB7IGN1c3RvbVByb3BlcnRpZXMgYXMgdmFycyB9IGZyb20gJ0Bjb21tZXJjZXRvb2xzLXVpa2l0L2Rlc2lnbi1zeXN0ZW0nO1xuXG5jb25zdCBTZWFyY2hTZWxlY3RJbnB1dFdyYXBwZXIgPSBzdHlsZWQuZGl2YFxuICAkeyhwcm9wcykgPT5cbiAgICAhcHJvcHMuaXNEaXNhYmxlZCAmJiAhcHJvcHMuaXNSZWFkT25seVxuICAgICAgPyBgZGl2W2NsYXNzJD0nY29udHJvbCddIHtcbiAgICAgICAgJjpob3ZlciB7XG4gICAgICAgICAgY3Vyc29yOiB0ZXh0O1xuICAgICAgICB9XG4gICAgICAgIGRpdltjbGFzcyQ9J2luZGljYXRvckNvbnRhaW5lcicgaV0ge1xuICAgICAgICAgIGN1cnNvcjogcG9pbnRlcjtcbiAgICAgICAgICBzdmcgKiB7XG4gICAgICAgICAgICBmaWxsOiAke3ZhcnMuY29sb3JTb2xpZH07XG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICB9YFxuICAgICAgOiAnJ31cbmA7XG5cbmV4cG9ydCB7IFNlYXJjaFNlbGVjdElucHV0V3JhcHBlciB9O1xuIl19 */"));
66
+
67
+ function ownKeys(object, enumerableOnly) { var keys = _Object$keys__default['default'](object); if (_Object$getOwnPropertySymbols__default['default']) { var symbols = _Object$getOwnPropertySymbols__default['default'](object); if (enumerableOnly) { symbols = _filterInstanceProperty__default['default'](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default['default'](object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
68
+
69
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context3; _forEachInstanceProperty__default['default'](_context3 = ownKeys(Object(source), true)).call(_context3, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors__default['default']) { _Object$defineProperties__default['default'](target, _Object$getOwnPropertyDescriptors__default['default'](source)); } else { var _context4; _forEachInstanceProperty__default['default'](_context4 = ownKeys(Object(source))).call(_context4, function (key) { _Object$defineProperty__default['default'](target, key, _Object$getOwnPropertyDescriptor__default['default'](source, key)); }); } } return target; }
70
+
71
+ var SearchSelectInput = function SearchSelectInput(props) {
72
+ var intl = reactIntl.useIntl();
73
+
74
+ var noOptionsMessage = props.noOptionsMessage || function () {
75
+ return intl.formatMessage(messages.noOptionsMessage);
76
+ };
77
+
78
+ var loadingMessage = props.loadingMessage || intl.formatMessage(messages.loadingOptionsMessage);
79
+ var placeholder = props.placeholder || intl.formatMessage(messages.placeholderMessage);
80
+ var optionType = props.optionType;
81
+ var components = react.useMemo(function () {
82
+ return _objectSpread(_objectSpread({
83
+ // eslint-disable-next-line react/display-name
84
+ Option: function Option(optionInnerProps) {
85
+ return jsxRuntime.jsx(selectUtils.CustomSelectInputOption, {
86
+ optionType: optionType,
87
+ optionInnerProps: optionInnerProps
88
+ });
89
+ }
90
+ }, props.components), {}, {
91
+ DropdownIndicator: selectUtils.SearchIconDropdownIndicator
92
+ });
93
+ }, [props.components, optionType]);
94
+ return jsxRuntime.jsx(SearchSelectInputWrapper, {
95
+ isDisabled: props.isDisabled,
96
+ isReadOnly: props.isReadOnly,
97
+ children: jsxRuntime.jsx(AsyncSelectInput__default['default'], _objectSpread(_objectSpread({}, props), {}, {
98
+ components: components,
99
+ placeholder: placeholder,
100
+ iconLeft: undefined,
101
+ loadingMessage: loadingMessage,
102
+ noOptionsMessage: noOptionsMessage,
103
+ isSearchable: true
104
+ }))
105
+ });
106
+ };
107
+
108
+ SearchSelectInput.propTypes = process.env.NODE_ENV !== "production" ? {
109
+ /**
110
+ *Horizontal size limit of the input fields.
111
+ */
112
+ horizontalConstraint: PropTypes__default['default'].oneOf([3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 'scale', 'auto']),
113
+
114
+ /**
115
+ * Aria label (for assistive tech)
116
+ */
117
+ 'aria-label': PropTypes__default['default'].string,
118
+
119
+ /**
120
+ * HTML ID of an element that should be used as the label (for assistive tech)
121
+ */
122
+ 'aria-labelledby': PropTypes__default['default'].string,
123
+
124
+ /**
125
+ * The id of the search input. This forwarded as react-select's "inputId"
126
+ */
127
+ id: PropTypes__default['default'].string,
128
+
129
+ /**
130
+ * The id to set on the SelectContainer component. This is forwarded as react-select's "id"
131
+ */
132
+ containerId: PropTypes__default['default'].string,
133
+
134
+ /**
135
+ * Name of the HTML Input (optional - without this, no input will be rendered)
136
+ */
137
+ name: PropTypes__default['default'].string,
138
+
139
+ /**
140
+ * Placeholder text for the select value
141
+ */
142
+ placeholder: PropTypes__default['default'].string,
143
+
144
+ /**
145
+ * Map of components to overwrite the default ones, see [what components you can override](https://react-select.com/components)
146
+ */
147
+ components: PropTypes__default['default'].objectOf(PropTypes__default['default'].func),
148
+
149
+ /**
150
+ * Sets the tabIndex attribute on the input
151
+ */
152
+ tabIndex: PropTypes__default['default'].string,
153
+
154
+ /**
155
+ * The value of the select; reflected by the selected option
156
+ */
157
+ value: function value(props) {
158
+ var _context, _context2;
159
+
160
+ for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
161
+ rest[_key - 1] = arguments[_key];
162
+ }
163
+
164
+ return props.isMulti ? PropTypes__default['default'].arrayOf(PropTypes__default['default'].shape({
165
+ value: PropTypes__default['default'].string.isRequired
166
+ })).apply(void 0, _concatInstanceProperty__default['default'](_context = [props]).call(_context, rest)) : PropTypes__default['default'].shape({
167
+ value: PropTypes__default['default'].string.isRequired
168
+ }).apply(void 0, _concatInstanceProperty__default['default'](_context2 = [props]).call(_context2, rest));
169
+ },
170
+
171
+ /**
172
+ * Remove the currently focused option when the user presses backspace
173
+ */
174
+ backspaceRemovesValue: PropTypes__default['default'].bool,
175
+
176
+ /**
177
+ * Indicates the input field has an error
178
+ */
179
+ hasError: PropTypes__default['default'].bool,
180
+
181
+ /**
182
+ * Indicates the input field has a warning
183
+ */
184
+ hasWarning: PropTypes__default['default'].bool,
185
+
186
+ /**
187
+ * Is the select read-only
188
+ */
189
+ isReadOnly: PropTypes__default['default'].bool,
190
+
191
+ /**
192
+ * Is the select disabled
193
+ */
194
+ isDisabled: PropTypes__default['default'].bool,
195
+
196
+ /**
197
+ * Is the select value clearable
198
+ */
199
+ isClearable: PropTypes__default['default'].bool,
200
+
201
+ /**
202
+ * Override the built-in logic to detect whether an option is disabled
203
+ */
204
+ isOptionDisabled: PropTypes__default['default'].func,
205
+
206
+ /**
207
+ * Support multiple selected options
208
+ */
209
+ isMulti: PropTypes__default['default'].bool,
210
+
211
+ /**
212
+ * Focus the control when it is mounted. Renamed autoFocus of react-select
213
+ */
214
+ isAutofocussed: PropTypes__default['default'].bool,
215
+
216
+ /**
217
+ * Can be used to render a custom value when there are no options (either because of no search results, or all options have been used, or there were none in the first place). Gets called with `{ inputValue: String }`. `inputValue` will be an empty string when no search text is present.
218
+ */
219
+ noOptionsMessage: PropTypes__default['default'].func,
220
+
221
+ /**
222
+ * Maximum height of the menu before scrolling
223
+ */
224
+ maxMenuHeight: PropTypes__default['default'].number,
225
+
226
+ /**
227
+ * Dom element to portal the select menu to
228
+ */
229
+ menuPortalTarget: PropTypes__default['default'].instanceOf(utils.SafeHTMLElement),
230
+
231
+ /**
232
+ * z-index value for the menu portal
233
+ */
234
+ menuPortalZIndex: PropTypes__default['default'].number.isRequired,
235
+
236
+ /**
237
+ * whether the menu should block scroll while open
238
+ */
239
+ menuShouldBlockScroll: PropTypes__default['default'].bool,
240
+
241
+ /**
242
+ * Determines if option groups will be separated by a divider
243
+ */
244
+ showOptionGroupDivider: PropTypes__default['default'].bool,
245
+
246
+ /**
247
+ * The default set of options to show before the user starts searching. When set to `true`, the results for `loadOptions('')` will be autoloaded.
248
+ */
249
+ defaultOptions: PropTypes__default['default'].oneOfType([PropTypes__default['default'].bool, PropTypes__default['default'].arrayOf(PropTypes__default['default'].shape({
250
+ value: PropTypes__default['default'].string.isRequired,
251
+ label: PropTypes__default['default'].string
252
+ }))]),
253
+
254
+ /**
255
+ * Handle blur events on the control
256
+ */
257
+ onBlur: PropTypes__default['default'].func,
258
+
259
+ /**
260
+ * Called with a fake event when value changes.
261
+ * <br />
262
+ * The event's `target.name` will be the `name` supplied in props. The event's `target.value` will hold the value. The value will be the selected option, or an array of options in case `isMulti` is `true`.
263
+ * <br />
264
+ * Signature: `(event, action) => void`
265
+ */
266
+ onChange: PropTypes__default['default'].func.isRequired,
267
+
268
+ /**
269
+ * Handle focus events on the control
270
+ */
271
+ onFocus: PropTypes__default['default'].func,
272
+
273
+ /**
274
+ * Handle change events on the input
275
+ * <br />
276
+ * Signature: `(inputValue, action) => void`
277
+ */
278
+ onInputChange: PropTypes__default['default'].func,
279
+
280
+ /**
281
+ * Select the currently focused option when the user presses tab
282
+ */
283
+ tabSelectsValue: PropTypes__default['default'].bool,
284
+
285
+ /**
286
+ * Function that returns a promise, which is the set of options to be used once the promise resolves.
287
+ */
288
+ loadOptions: PropTypes__default['default'].func.isRequired,
289
+
290
+ /**
291
+ * The text shown while the options are being loaded
292
+ */
293
+ loadingMessage: PropTypes__default['default'].oneOfType([PropTypes__default['default'].string, PropTypes__default['default'].func]),
294
+
295
+ /**
296
+ * If cacheOptions is truthy, then the loaded data will be cached. The cache will remain until cacheOptions changes value.
297
+ */
298
+ cacheOptions: PropTypes__default['default'].any,
299
+
300
+ /**
301
+ * Custom method to filter whether an option should be displayed in the menu
302
+ */
303
+ filterOption: PropTypes__default['default'].func,
304
+
305
+ /**
306
+ * The style of the an option in the dropdown menu. It could be single lined option or an option with more and custom info
307
+ */
308
+ optionType: PropTypes__default['default'].oneOf(['single-property', 'double-property', 'multiple-properties'])
309
+ } : {};
310
+ SearchSelectInput.defaultProps = {
311
+ value: null,
312
+ menuPortalZIndex: 1,
313
+ maxMenuHeight: 220
314
+ };
315
+ SearchSelectInput.displayName = 'SearchSelectInput';
316
+ var SearchSelectInput$1 = SearchSelectInput;
317
+
318
+ // NOTE: This string will be replaced in the `prepare` script by the `scripts/version.js` file.
319
+ var version = '0.0.0-canary-2021830134526';
320
+
321
+ exports['default'] = SearchSelectInput$1;
322
+ exports.version = version;
@@ -0,0 +1,7 @@
1
+ 'use strict';
2
+
3
+ if (process.env.NODE_ENV === "production") {
4
+ module.exports = require("./commercetools-uikit-search-select-input.cjs.prod.js");
5
+ } else {
6
+ module.exports = require("./commercetools-uikit-search-select-input.cjs.dev.js");
7
+ }
@@ -0,0 +1,116 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var _Object$keys = require('@babel/runtime-corejs3/core-js-stable/object/keys');
6
+ var _Object$getOwnPropertySymbols = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
7
+ var _filterInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/filter');
8
+ var _Object$getOwnPropertyDescriptor = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor');
9
+ var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/for-each');
10
+ var _Object$getOwnPropertyDescriptors = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors');
11
+ var _Object$defineProperties = require('@babel/runtime-corejs3/core-js-stable/object/define-properties');
12
+ var _Object$defineProperty = require('@babel/runtime-corejs3/core-js-stable/object/define-property');
13
+ var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
14
+ require('@babel/runtime-corejs3/core-js-stable/instance/concat');
15
+ var react = require('react');
16
+ require('prop-types');
17
+ var reactIntl = require('react-intl');
18
+ require('@commercetools-uikit/utils');
19
+ var AsyncSelectInput = require('@commercetools-uikit/async-select-input');
20
+ var selectUtils = require('@commercetools-uikit/select-utils');
21
+ var _styled = require('@emotion/styled/base');
22
+ var designSystem = require('@commercetools-uikit/design-system');
23
+ var jsxRuntime = require('@emotion/react/jsx-runtime');
24
+
25
+ function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
26
+
27
+ var _Object$keys__default = /*#__PURE__*/_interopDefault(_Object$keys);
28
+ var _Object$getOwnPropertySymbols__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertySymbols);
29
+ var _filterInstanceProperty__default = /*#__PURE__*/_interopDefault(_filterInstanceProperty);
30
+ var _Object$getOwnPropertyDescriptor__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertyDescriptor);
31
+ var _forEachInstanceProperty__default = /*#__PURE__*/_interopDefault(_forEachInstanceProperty);
32
+ var _Object$getOwnPropertyDescriptors__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertyDescriptors);
33
+ var _Object$defineProperties__default = /*#__PURE__*/_interopDefault(_Object$defineProperties);
34
+ var _Object$defineProperty__default = /*#__PURE__*/_interopDefault(_Object$defineProperty);
35
+ var AsyncSelectInput__default = /*#__PURE__*/_interopDefault(AsyncSelectInput);
36
+ var _styled__default = /*#__PURE__*/_interopDefault(_styled);
37
+
38
+ var messages = reactIntl.defineMessages({
39
+ noOptionsMessage: {
40
+ id: 'UIKit.SearchSelectInput.noOptionsMessage',
41
+ description: 'Text of search select dropdown when no options match search text',
42
+ defaultMessage: 'No matches found for your search term'
43
+ },
44
+ loadingOptionsMessage: {
45
+ id: 'UIKit.SearchSelectInput.loadingOptionsMessage',
46
+ description: 'Text showed while the options are being loaded',
47
+ defaultMessage: 'Loading exact matches'
48
+ },
49
+ placeholderMessage: {
50
+ id: 'UIKit.SearchSelectInput.placeholderMessage',
51
+ description: 'Placeholder text for the input',
52
+ defaultMessage: 'Search by…'
53
+ }
54
+ });
55
+
56
+ var SearchSelectInputWrapper = _styled__default['default']("div", {
57
+ target: "ec7yve10"
58
+ } )(function (props) {
59
+ return !props.isDisabled && !props.isReadOnly ? "div[class$='control'] {\n &:hover {\n cursor: text;\n }\n div[class$='indicatorContainer' i] {\n cursor: pointer;\n svg * {\n fill: ".concat(designSystem.customProperties.colorSolid, ";\n }\n }\n }") : '';
60
+ }, ";" + ("" ));
61
+
62
+ function ownKeys(object, enumerableOnly) { var keys = _Object$keys__default['default'](object); if (_Object$getOwnPropertySymbols__default['default']) { var symbols = _Object$getOwnPropertySymbols__default['default'](object); if (enumerableOnly) { symbols = _filterInstanceProperty__default['default'](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default['default'](object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
63
+
64
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context3; _forEachInstanceProperty__default['default'](_context3 = ownKeys(Object(source), true)).call(_context3, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors__default['default']) { _Object$defineProperties__default['default'](target, _Object$getOwnPropertyDescriptors__default['default'](source)); } else { var _context4; _forEachInstanceProperty__default['default'](_context4 = ownKeys(Object(source))).call(_context4, function (key) { _Object$defineProperty__default['default'](target, key, _Object$getOwnPropertyDescriptor__default['default'](source, key)); }); } } return target; }
65
+
66
+ var SearchSelectInput = function SearchSelectInput(props) {
67
+ var intl = reactIntl.useIntl();
68
+
69
+ var noOptionsMessage = props.noOptionsMessage || function () {
70
+ return intl.formatMessage(messages.noOptionsMessage);
71
+ };
72
+
73
+ var loadingMessage = props.loadingMessage || intl.formatMessage(messages.loadingOptionsMessage);
74
+ var placeholder = props.placeholder || intl.formatMessage(messages.placeholderMessage);
75
+ var optionType = props.optionType;
76
+ var components = react.useMemo(function () {
77
+ return _objectSpread(_objectSpread({
78
+ // eslint-disable-next-line react/display-name
79
+ Option: function Option(optionInnerProps) {
80
+ return jsxRuntime.jsx(selectUtils.CustomSelectInputOption, {
81
+ optionType: optionType,
82
+ optionInnerProps: optionInnerProps
83
+ });
84
+ }
85
+ }, props.components), {}, {
86
+ DropdownIndicator: selectUtils.SearchIconDropdownIndicator
87
+ });
88
+ }, [props.components, optionType]);
89
+ return jsxRuntime.jsx(SearchSelectInputWrapper, {
90
+ isDisabled: props.isDisabled,
91
+ isReadOnly: props.isReadOnly,
92
+ children: jsxRuntime.jsx(AsyncSelectInput__default['default'], _objectSpread(_objectSpread({}, props), {}, {
93
+ components: components,
94
+ placeholder: placeholder,
95
+ iconLeft: undefined,
96
+ loadingMessage: loadingMessage,
97
+ noOptionsMessage: noOptionsMessage,
98
+ isSearchable: true
99
+ }))
100
+ });
101
+ };
102
+
103
+ SearchSelectInput.propTypes = {};
104
+ SearchSelectInput.defaultProps = {
105
+ value: null,
106
+ menuPortalZIndex: 1,
107
+ maxMenuHeight: 220
108
+ };
109
+ SearchSelectInput.displayName = 'SearchSelectInput';
110
+ var SearchSelectInput$1 = SearchSelectInput;
111
+
112
+ // NOTE: This string will be replaced in the `prepare` script by the `scripts/version.js` file.
113
+ var version = '0.0.0-canary-2021830134526';
114
+
115
+ exports['default'] = SearchSelectInput$1;
116
+ exports.version = version;
@@ -0,0 +1,302 @@
1
+ import _Object$keys from '@babel/runtime-corejs3/core-js-stable/object/keys';
2
+ import _Object$getOwnPropertySymbols from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols';
3
+ import _filterInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/filter';
4
+ import _Object$getOwnPropertyDescriptor from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor';
5
+ import _forEachInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/for-each';
6
+ import _Object$getOwnPropertyDescriptors from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors';
7
+ import _Object$defineProperties from '@babel/runtime-corejs3/core-js-stable/object/define-properties';
8
+ import _Object$defineProperty from '@babel/runtime-corejs3/core-js-stable/object/define-property';
9
+ import _defineProperty from '@babel/runtime-corejs3/helpers/esm/defineProperty';
10
+ import _concatInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/concat';
11
+ import { useMemo } from 'react';
12
+ import PropTypes from 'prop-types';
13
+ import { defineMessages, useIntl } from 'react-intl';
14
+ import { SafeHTMLElement } from '@commercetools-uikit/utils';
15
+ import AsyncSelectInput from '@commercetools-uikit/async-select-input';
16
+ import { CustomSelectInputOption, SearchIconDropdownIndicator } from '@commercetools-uikit/select-utils';
17
+ import _styled from '@emotion/styled/base';
18
+ import { customProperties } from '@commercetools-uikit/design-system';
19
+ import { jsx } from '@emotion/react/jsx-runtime';
20
+
21
+ var messages = defineMessages({
22
+ noOptionsMessage: {
23
+ id: 'UIKit.SearchSelectInput.noOptionsMessage',
24
+ description: 'Text of search select dropdown when no options match search text',
25
+ defaultMessage: 'No matches found for your search term'
26
+ },
27
+ loadingOptionsMessage: {
28
+ id: 'UIKit.SearchSelectInput.loadingOptionsMessage',
29
+ description: 'Text showed while the options are being loaded',
30
+ defaultMessage: 'Loading exact matches'
31
+ },
32
+ placeholderMessage: {
33
+ id: 'UIKit.SearchSelectInput.placeholderMessage',
34
+ description: 'Placeholder text for the input',
35
+ defaultMessage: 'Search by…'
36
+ }
37
+ });
38
+
39
+ var SearchSelectInputWrapper = _styled("div", process.env.NODE_ENV === "production" ? {
40
+ target: "ec7yve10"
41
+ } : {
42
+ target: "ec7yve10",
43
+ label: "SearchSelectInputWrapper"
44
+ })(function (props) {
45
+ return !props.isDisabled && !props.isReadOnly ? "div[class$='control'] {\n &:hover {\n cursor: text;\n }\n div[class$='indicatorContainer' i] {\n cursor: pointer;\n svg * {\n fill: ".concat(customProperties.colorSolid, ";\n }\n }\n }") : '';
46
+ }, ";" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNlYXJjaC1zZWxlY3QtaW5wdXQuc3R5bGVzLmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUkyQyIsImZpbGUiOiJzZWFyY2gtc2VsZWN0LWlucHV0LnN0eWxlcy5qcyIsInNvdXJjZXNDb250ZW50IjpbIi8qIGVzbGludC1kaXNhYmxlIGltcG9ydC9wcmVmZXItZGVmYXVsdC1leHBvcnQgKi9cbmltcG9ydCBzdHlsZWQgZnJvbSAnQGVtb3Rpb24vc3R5bGVkJztcbmltcG9ydCB7IGN1c3RvbVByb3BlcnRpZXMgYXMgdmFycyB9IGZyb20gJ0Bjb21tZXJjZXRvb2xzLXVpa2l0L2Rlc2lnbi1zeXN0ZW0nO1xuXG5jb25zdCBTZWFyY2hTZWxlY3RJbnB1dFdyYXBwZXIgPSBzdHlsZWQuZGl2YFxuICAkeyhwcm9wcykgPT5cbiAgICAhcHJvcHMuaXNEaXNhYmxlZCAmJiAhcHJvcHMuaXNSZWFkT25seVxuICAgICAgPyBgZGl2W2NsYXNzJD0nY29udHJvbCddIHtcbiAgICAgICAgJjpob3ZlciB7XG4gICAgICAgICAgY3Vyc29yOiB0ZXh0O1xuICAgICAgICB9XG4gICAgICAgIGRpdltjbGFzcyQ9J2luZGljYXRvckNvbnRhaW5lcicgaV0ge1xuICAgICAgICAgIGN1cnNvcjogcG9pbnRlcjtcbiAgICAgICAgICBzdmcgKiB7XG4gICAgICAgICAgICBmaWxsOiAke3ZhcnMuY29sb3JTb2xpZH07XG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICB9YFxuICAgICAgOiAnJ31cbmA7XG5cbmV4cG9ydCB7IFNlYXJjaFNlbGVjdElucHV0V3JhcHBlciB9O1xuIl19 */"));
47
+
48
+ function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); if (enumerableOnly) { symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
49
+
50
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context3; _forEachInstanceProperty(_context3 = ownKeys(Object(source), true)).call(_context3, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors) { _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)); } else { var _context4; _forEachInstanceProperty(_context4 = ownKeys(Object(source))).call(_context4, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } } return target; }
51
+
52
+ var SearchSelectInput = function SearchSelectInput(props) {
53
+ var intl = useIntl();
54
+
55
+ var noOptionsMessage = props.noOptionsMessage || function () {
56
+ return intl.formatMessage(messages.noOptionsMessage);
57
+ };
58
+
59
+ var loadingMessage = props.loadingMessage || intl.formatMessage(messages.loadingOptionsMessage);
60
+ var placeholder = props.placeholder || intl.formatMessage(messages.placeholderMessage);
61
+ var optionType = props.optionType;
62
+ var components = useMemo(function () {
63
+ return _objectSpread(_objectSpread({
64
+ // eslint-disable-next-line react/display-name
65
+ Option: function Option(optionInnerProps) {
66
+ return jsx(CustomSelectInputOption, {
67
+ optionType: optionType,
68
+ optionInnerProps: optionInnerProps
69
+ });
70
+ }
71
+ }, props.components), {}, {
72
+ DropdownIndicator: SearchIconDropdownIndicator
73
+ });
74
+ }, [props.components, optionType]);
75
+ return jsx(SearchSelectInputWrapper, {
76
+ isDisabled: props.isDisabled,
77
+ isReadOnly: props.isReadOnly,
78
+ children: jsx(AsyncSelectInput, _objectSpread(_objectSpread({}, props), {}, {
79
+ components: components,
80
+ placeholder: placeholder,
81
+ iconLeft: undefined,
82
+ loadingMessage: loadingMessage,
83
+ noOptionsMessage: noOptionsMessage,
84
+ isSearchable: true
85
+ }))
86
+ });
87
+ };
88
+
89
+ SearchSelectInput.propTypes = process.env.NODE_ENV !== "production" ? {
90
+ /**
91
+ *Horizontal size limit of the input fields.
92
+ */
93
+ horizontalConstraint: PropTypes.oneOf([3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 'scale', 'auto']),
94
+
95
+ /**
96
+ * Aria label (for assistive tech)
97
+ */
98
+ 'aria-label': PropTypes.string,
99
+
100
+ /**
101
+ * HTML ID of an element that should be used as the label (for assistive tech)
102
+ */
103
+ 'aria-labelledby': PropTypes.string,
104
+
105
+ /**
106
+ * The id of the search input. This forwarded as react-select's "inputId"
107
+ */
108
+ id: PropTypes.string,
109
+
110
+ /**
111
+ * The id to set on the SelectContainer component. This is forwarded as react-select's "id"
112
+ */
113
+ containerId: PropTypes.string,
114
+
115
+ /**
116
+ * Name of the HTML Input (optional - without this, no input will be rendered)
117
+ */
118
+ name: PropTypes.string,
119
+
120
+ /**
121
+ * Placeholder text for the select value
122
+ */
123
+ placeholder: PropTypes.string,
124
+
125
+ /**
126
+ * Map of components to overwrite the default ones, see [what components you can override](https://react-select.com/components)
127
+ */
128
+ components: PropTypes.objectOf(PropTypes.func),
129
+
130
+ /**
131
+ * Sets the tabIndex attribute on the input
132
+ */
133
+ tabIndex: PropTypes.string,
134
+
135
+ /**
136
+ * The value of the select; reflected by the selected option
137
+ */
138
+ value: function value(props) {
139
+ var _context, _context2;
140
+
141
+ for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
142
+ rest[_key - 1] = arguments[_key];
143
+ }
144
+
145
+ return props.isMulti ? PropTypes.arrayOf(PropTypes.shape({
146
+ value: PropTypes.string.isRequired
147
+ })).apply(void 0, _concatInstanceProperty(_context = [props]).call(_context, rest)) : PropTypes.shape({
148
+ value: PropTypes.string.isRequired
149
+ }).apply(void 0, _concatInstanceProperty(_context2 = [props]).call(_context2, rest));
150
+ },
151
+
152
+ /**
153
+ * Remove the currently focused option when the user presses backspace
154
+ */
155
+ backspaceRemovesValue: PropTypes.bool,
156
+
157
+ /**
158
+ * Indicates the input field has an error
159
+ */
160
+ hasError: PropTypes.bool,
161
+
162
+ /**
163
+ * Indicates the input field has a warning
164
+ */
165
+ hasWarning: PropTypes.bool,
166
+
167
+ /**
168
+ * Is the select read-only
169
+ */
170
+ isReadOnly: PropTypes.bool,
171
+
172
+ /**
173
+ * Is the select disabled
174
+ */
175
+ isDisabled: PropTypes.bool,
176
+
177
+ /**
178
+ * Is the select value clearable
179
+ */
180
+ isClearable: PropTypes.bool,
181
+
182
+ /**
183
+ * Override the built-in logic to detect whether an option is disabled
184
+ */
185
+ isOptionDisabled: PropTypes.func,
186
+
187
+ /**
188
+ * Support multiple selected options
189
+ */
190
+ isMulti: PropTypes.bool,
191
+
192
+ /**
193
+ * Focus the control when it is mounted. Renamed autoFocus of react-select
194
+ */
195
+ isAutofocussed: PropTypes.bool,
196
+
197
+ /**
198
+ * Can be used to render a custom value when there are no options (either because of no search results, or all options have been used, or there were none in the first place). Gets called with `{ inputValue: String }`. `inputValue` will be an empty string when no search text is present.
199
+ */
200
+ noOptionsMessage: PropTypes.func,
201
+
202
+ /**
203
+ * Maximum height of the menu before scrolling
204
+ */
205
+ maxMenuHeight: PropTypes.number,
206
+
207
+ /**
208
+ * Dom element to portal the select menu to
209
+ */
210
+ menuPortalTarget: PropTypes.instanceOf(SafeHTMLElement),
211
+
212
+ /**
213
+ * z-index value for the menu portal
214
+ */
215
+ menuPortalZIndex: PropTypes.number.isRequired,
216
+
217
+ /**
218
+ * whether the menu should block scroll while open
219
+ */
220
+ menuShouldBlockScroll: PropTypes.bool,
221
+
222
+ /**
223
+ * Determines if option groups will be separated by a divider
224
+ */
225
+ showOptionGroupDivider: PropTypes.bool,
226
+
227
+ /**
228
+ * The default set of options to show before the user starts searching. When set to `true`, the results for `loadOptions('')` will be autoloaded.
229
+ */
230
+ defaultOptions: PropTypes.oneOfType([PropTypes.bool, PropTypes.arrayOf(PropTypes.shape({
231
+ value: PropTypes.string.isRequired,
232
+ label: PropTypes.string
233
+ }))]),
234
+
235
+ /**
236
+ * Handle blur events on the control
237
+ */
238
+ onBlur: PropTypes.func,
239
+
240
+ /**
241
+ * Called with a fake event when value changes.
242
+ * <br />
243
+ * The event's `target.name` will be the `name` supplied in props. The event's `target.value` will hold the value. The value will be the selected option, or an array of options in case `isMulti` is `true`.
244
+ * <br />
245
+ * Signature: `(event, action) => void`
246
+ */
247
+ onChange: PropTypes.func.isRequired,
248
+
249
+ /**
250
+ * Handle focus events on the control
251
+ */
252
+ onFocus: PropTypes.func,
253
+
254
+ /**
255
+ * Handle change events on the input
256
+ * <br />
257
+ * Signature: `(inputValue, action) => void`
258
+ */
259
+ onInputChange: PropTypes.func,
260
+
261
+ /**
262
+ * Select the currently focused option when the user presses tab
263
+ */
264
+ tabSelectsValue: PropTypes.bool,
265
+
266
+ /**
267
+ * Function that returns a promise, which is the set of options to be used once the promise resolves.
268
+ */
269
+ loadOptions: PropTypes.func.isRequired,
270
+
271
+ /**
272
+ * The text shown while the options are being loaded
273
+ */
274
+ loadingMessage: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
275
+
276
+ /**
277
+ * If cacheOptions is truthy, then the loaded data will be cached. The cache will remain until cacheOptions changes value.
278
+ */
279
+ cacheOptions: PropTypes.any,
280
+
281
+ /**
282
+ * Custom method to filter whether an option should be displayed in the menu
283
+ */
284
+ filterOption: PropTypes.func,
285
+
286
+ /**
287
+ * The style of the an option in the dropdown menu. It could be single lined option or an option with more and custom info
288
+ */
289
+ optionType: PropTypes.oneOf(['single-property', 'double-property', 'multiple-properties'])
290
+ } : {};
291
+ SearchSelectInput.defaultProps = {
292
+ value: null,
293
+ menuPortalZIndex: 1,
294
+ maxMenuHeight: 220
295
+ };
296
+ SearchSelectInput.displayName = 'SearchSelectInput';
297
+ var SearchSelectInput$1 = SearchSelectInput;
298
+
299
+ // NOTE: This string will be replaced in the `prepare` script by the `scripts/version.js` file.
300
+ var version = '0.0.0-canary-2021830134526';
301
+
302
+ export { SearchSelectInput$1 as default, version };
package/package.json ADDED
@@ -0,0 +1,55 @@
1
+ {
2
+ "name": "@commercetools-uikit/search-select-input",
3
+ "description": "A search select input component built on top of `@commercetools-uikit/async-select-input` to asynchronously load results (options) using the keyword that the user has entered.",
4
+ "version": "0.0.0-canary-2021830134526",
5
+ "bugs": "https://github.com/commercetools/ui-kit/issues",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/commercetools/ui-kit.git",
9
+ "directory": "packages/components/inputs/search-select-input"
10
+ },
11
+ "homepage": "https://uikit.commercetools.com",
12
+ "keywords": [
13
+ "javascript",
14
+ "design system",
15
+ "react",
16
+ "uikit"
17
+ ],
18
+ "license": "MIT",
19
+ "private": false,
20
+ "publishConfig": {
21
+ "access": "public"
22
+ },
23
+ "sideEffects": false,
24
+ "main": "dist/commercetools-uikit-search-select-input.cjs.js",
25
+ "module": "dist/commercetools-uikit-search-select-input.esm.js",
26
+ "files": [
27
+ "dist"
28
+ ],
29
+ "scripts": {
30
+ "prepare": "../../../../scripts/version.js replace"
31
+ },
32
+ "dependencies": {
33
+ "@babel/runtime": "7.14.8",
34
+ "@babel/runtime-corejs3": "7.14.9",
35
+ "@commercetools-uikit/async-select-input": "0.0.0-canary-2021830134526",
36
+ "@commercetools-uikit/design-system": "0.0.0-canary-2021830134526",
37
+ "@commercetools-uikit/select-utils": "0.0.0-canary-2021830134526",
38
+ "@commercetools-uikit/spacings": "0.0.0-canary-2021830134526",
39
+ "@commercetools-uikit/text": "0.0.0-canary-2021830134526",
40
+ "@commercetools-uikit/utils": "12.2.0",
41
+ "@emotion/react": "^11.4.0",
42
+ "@emotion/styled": "^11.3.0",
43
+ "prop-types": "15.7.2"
44
+ },
45
+ "devDependencies": {
46
+ "react": "17.0.2",
47
+ "react-dom": "17.0.2",
48
+ "react-intl": "5.20.7"
49
+ },
50
+ "peerDependencies": {
51
+ "react": "17.x",
52
+ "react-dom": "17.x",
53
+ "react-intl": "5.x"
54
+ }
55
+ }