@commercetools-uikit/search-select-input 12.2.7 → 13.0.2

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/README.md CHANGED
@@ -60,47 +60,59 @@ export default Example;
60
60
 
61
61
  ## Properties
62
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 |
63
+ | Props | Type | Required | Default | Description |
64
+ | ------------------------ | ----------------------------------------------------------------------------------------------------- | :------: | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
65
+ | `horizontalConstraint` | `union`<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` | `AsyncProps['aria-label']` | | | Aria label (for assistive tech)&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
67
+ | `aria-labelledby` | `AsyncProps['aria-labelledby']` | | | HTML ID of an element that should be used as the label (for assistive tech)&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
68
+ | `id` | `AsyncProps['inputId']` | | | The id of the search input. This forwarded as react-select's "inputId"&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
69
+ | `containerId` | `AsyncProps['id']` | | | The id to set on the SelectContainer component. This is forwarded as react-select's "id"&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
70
+ | `name` | `AsyncProps['name']` | | | Name of the HTML Input (optional - without this, no input will be rendered)&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
71
+ | `placeholder` | `AsyncProps['placeholder']` | | | Placeholder text for the select value&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
72
+ | `components` | `AsyncProps['components']` | | | Map of components to overwrite the default ones, see [what components you can override](https://react-select.com/components)&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
73
+ | `tabIndex` | `AsyncProps['tabIndex']` | | | Sets the tabIndex attribute on the input&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
74
+ | `value` | `AsyncProps['value']` | | `null` | The value of the select; reflected by the selected option&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
75
+ | `backspaceRemovesValue` | `AsyncProps['backspaceRemovesValue']` | | | Remove the currently focused option when the user presses backspace&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
76
+ | `hasError` | `boolean` | | | Indicates the input field has an error |
77
+ | `hasWarning` | `boolean` | | | Indicates the input field has a warning |
78
+ | `isReadOnly` | `boolean` | | | Is the select read-only |
79
+ | `isDisabled` | `boolean` | | | Is the select disabled |
80
+ | `isClearable` | `boolean` | | | Is the select value clearable |
81
+ | `isOptionDisabled` | `AsyncProps['isOptionDisabled']` | | | Override the built-in logic to detect whether an option is disabled&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
82
+ | `isMulti` | `AsyncProps['isMulti']` | | | Support multiple selected options&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
83
+ | `isAutofocussed` | `boolean` | | | Focus the control when it is mounted. Renamed autoFocus of react-select |
84
+ | `noOptionsMessage` | `AsyncProps['noOptionsMessage']` | | | 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.&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
85
+ | `maxMenuHeight` | `AsyncProps['maxMenuHeight']` | | `220` | Maximum height of the menu before scrolling&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
86
+ | `menuPortalTarget` | `AsyncProps['menuPortalTarget']` | | | Dom element to portal the select menu to&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
87
+ | `menuPortalZIndex` | `number` | | `1` | z-index value for the menu portal |
88
+ | `menuShouldBlockScroll` | `AsyncProps['menuShouldBlockScroll']` | | | whether the menu should block scroll while open&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
89
+ | `closeMenuOnSelect` | `AsyncProps['closeMenuOnSelect']` | | | Whether the menu should close after a value is selected. Defaults to `true`.&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
90
+ | `showOptionGroupDivider` | `boolean` | | | Determines if option groups will be separated by a divider |
91
+ | `defaultOptions` | `AsyncProps['defaultOptions']` | | | The default set of options to show before the user starts searching. When set to `true`, the results for `loadOptions('')` will be autoloaded.&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
92
+ | `onBlur` | `Function`<br/>[See signature.](#signature-onBlur) | | | Handle blur events on the control |
93
+ | `onChange` | `Function`<br/>[See signature.](#signature-onChange) | ✅ | | 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` |
94
+ | `onFocus` | `AsyncProps['onFocus']` | | | Handle focus events on the control&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
95
+ | `onInputChange` | `AsyncProps['onInputChange']` | | | Handle change events on the input&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
96
+ | `tabSelectsValue` | `AsyncProps['tabSelectsValue']` | | | Select the currently focused option when the user presses tab&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
97
+ | `loadOptions` | `AsyncProps['loadOptions']` || | Function that returns a promise, which is the set of options to be used once the promise resolves.&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
98
+ | `loadingMessage` | `union`<br/>Possible values:<br/>`string , (() => string)` | | | The text shown while the options are being loaded |
99
+ | `cacheOptions` | `AsyncProps['cacheOptions']` | | | If cacheOptions is truthy, then the loaded data will be cached. The cache will remain until cacheOptions changes value.&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
100
+ | `filterOption` | `AsyncProps['filterOption']` | | | Custom method to filter whether an option should be displayed in the menu&#xA;<br>&#xA;[Props from React select was used](https://react-select.com/props) |
101
+ | `optionType` | `union`<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 |
102
+
103
+ ## Signatures
104
+
105
+ ### Signature `onBlur`
106
+
107
+ ```ts
108
+ (event: TEvent) => void
109
+ ```
110
+
111
+ ### Signature `onChange`
112
+
113
+ ```ts
114
+ (event: TEvent, info: ActionMeta<unknown>) => void
115
+ ```
104
116
 
105
117
  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
118
 
@@ -0,0 +1,2 @@
1
+ export * from "./declarations/src/index";
2
+ export { default } from "./declarations/src/index";
@@ -11,11 +11,9 @@ var _Object$getOwnPropertyDescriptors = require('@babel/runtime-corejs3/core-js-
11
11
  var _Object$defineProperties = require('@babel/runtime-corejs3/core-js-stable/object/define-properties');
12
12
  var _Object$defineProperty = require('@babel/runtime-corejs3/core-js-stable/object/define-property');
13
13
  var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
14
- var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
14
+ var _pt = require('prop-types');
15
15
  var react = require('react');
16
- var PropTypes = require('prop-types');
17
16
  var reactIntl = require('react-intl');
18
- var utils = require('@commercetools-uikit/utils');
19
17
  var AsyncSelectInput = require('@commercetools-uikit/async-select-input');
20
18
  var selectUtils = require('@commercetools-uikit/select-utils');
21
19
  var _styled = require('@emotion/styled/base');
@@ -32,8 +30,7 @@ var _forEachInstanceProperty__default = /*#__PURE__*/_interopDefault(_forEachIns
32
30
  var _Object$getOwnPropertyDescriptors__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertyDescriptors);
33
31
  var _Object$defineProperties__default = /*#__PURE__*/_interopDefault(_Object$defineProperties);
34
32
  var _Object$defineProperty__default = /*#__PURE__*/_interopDefault(_Object$defineProperty);
35
- var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
36
- var PropTypes__default = /*#__PURE__*/_interopDefault(PropTypes);
33
+ var _pt__default = /*#__PURE__*/_interopDefault(_pt);
37
34
  var AsyncSelectInput__default = /*#__PURE__*/_interopDefault(AsyncSelectInput);
38
35
  var _styled__default = /*#__PURE__*/_interopDefault(_styled);
39
36
 
@@ -56,17 +53,22 @@ var messages = reactIntl.defineMessages({
56
53
  });
57
54
 
58
55
  var SearchSelectInputWrapper = _styled__default["default"]("div", process.env.NODE_ENV === "production" ? {
59
- target: "ec7yve10"
56
+ target: "e6cl9390"
60
57
  } : {
61
- target: "ec7yve10",
58
+ target: "e6cl9390",
62
59
  label: "SearchSelectInputWrapper"
63
60
  })(function (props) {
64
61
  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 */"));
62
+ }, ";" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNlYXJjaC1zZWxlY3QtaW5wdXQuc3R5bGVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQU9DIiwiZmlsZSI6InNlYXJjaC1zZWxlY3QtaW5wdXQuc3R5bGVzLnRzIiwic291cmNlc0NvbnRlbnQiOlsiLyogZXNsaW50LWRpc2FibGUgaW1wb3J0L3ByZWZlci1kZWZhdWx0LWV4cG9ydCAqL1xuaW1wb3J0IHN0eWxlZCBmcm9tICdAZW1vdGlvbi9zdHlsZWQnO1xuaW1wb3J0IHsgY3VzdG9tUHJvcGVydGllcyBhcyB2YXJzIH0gZnJvbSAnQGNvbW1lcmNldG9vbHMtdWlraXQvZGVzaWduLXN5c3RlbSc7XG5pbXBvcnQgdHlwZSB7IFRTZWFyY2hTZWxlY3RJbnB1dFByb3BzIH0gZnJvbSAnLi9zZWFyY2gtc2VsZWN0LWlucHV0JztcblxuY29uc3QgU2VhcmNoU2VsZWN0SW5wdXRXcmFwcGVyID0gc3R5bGVkLmRpdjxcbiAgUGljazxUU2VhcmNoU2VsZWN0SW5wdXRQcm9wcywgJ2lzRGlzYWJsZWQnIHwgJ2lzUmVhZE9ubHknPlxuPmBcbiAgJHsocHJvcHMpID0+XG4gICAgIXByb3BzLmlzRGlzYWJsZWQgJiYgIXByb3BzLmlzUmVhZE9ubHlcbiAgICAgID8gYGRpdltjbGFzcyQ9J2NvbnRyb2wnXSB7XG4gICAgICAgICY6aG92ZXIge1xuICAgICAgICAgIGN1cnNvcjogdGV4dDtcbiAgICAgICAgfVxuICAgICAgICBkaXZbY2xhc3MkPSdpbmRpY2F0b3JDb250YWluZXInIGldIHtcbiAgICAgICAgICBjdXJzb3I6IHBvaW50ZXI7XG4gICAgICAgICAgc3ZnICoge1xuICAgICAgICAgICAgZmlsbDogJHt2YXJzLmNvbG9yU29saWR9O1xuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgfWBcbiAgICAgIDogJyd9XG5gO1xuXG5leHBvcnQgeyBTZWFyY2hTZWxlY3RJbnB1dFdyYXBwZXIgfTtcbiJdfQ== */"));
66
63
 
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; }
64
+ function ownKeys(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); 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
65
 
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; }
66
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
67
+ var defaultProps = {
68
+ value: null,
69
+ menuPortalZIndex: 1,
70
+ maxMenuHeight: 220
71
+ };
70
72
 
71
73
  var SearchSelectInput = function SearchSelectInput(props) {
72
74
  var intl = reactIntl.useIntl();
@@ -80,12 +82,11 @@ var SearchSelectInput = function SearchSelectInput(props) {
80
82
  var optionType = props.optionType;
81
83
  var components = react.useMemo(function () {
82
84
  return _objectSpread(_objectSpread({
83
- // eslint-disable-next-line react/display-name
84
85
  Option: function Option(optionInnerProps) {
85
- return jsxRuntime.jsx(selectUtils.CustomSelectInputOption, {
86
+ return jsxRuntime.jsx(selectUtils.CustomSelectInputOption, _objectSpread(_objectSpread({}, optionInnerProps), {}, {
86
87
  optionType: optionType,
87
88
  optionInnerProps: optionInnerProps
88
- });
89
+ }));
89
90
  }
90
91
  }, props.components), {}, {
91
92
  DropdownIndicator: selectUtils.SearchIconDropdownIndicator
@@ -100,223 +101,33 @@ var SearchSelectInput = function SearchSelectInput(props) {
100
101
  iconLeft: undefined,
101
102
  loadingMessage: loadingMessage,
102
103
  noOptionsMessage: noOptionsMessage,
103
- isSearchable: true
104
+ isSearchable: true,
105
+ closeMenuOnSelect: props.closeMenuOnSelect
104
106
  }))
105
107
  });
106
108
  };
107
109
 
108
110
  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'])
111
+ horizontalConstraint: _pt__default["default"].oneOf([3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 'scale', 'auto']),
112
+ hasError: _pt__default["default"].bool,
113
+ hasWarning: _pt__default["default"].bool,
114
+ isReadOnly: _pt__default["default"].bool,
115
+ isDisabled: _pt__default["default"].bool,
116
+ isClearable: _pt__default["default"].bool,
117
+ isAutofocussed: _pt__default["default"].bool,
118
+ menuPortalZIndex: _pt__default["default"].number.isRequired,
119
+ showOptionGroupDivider: _pt__default["default"].bool,
120
+ onBlur: _pt__default["default"].func,
121
+ onChange: _pt__default["default"].func.isRequired,
122
+ loadingMessage: _pt__default["default"].oneOfType([_pt__default["default"].string, _pt__default["default"].func]),
123
+ optionType: _pt__default["default"].oneOf(['single-property', 'double-property', 'multiple-properties'])
309
124
  } : {};
310
- SearchSelectInput.defaultProps = {
311
- value: null,
312
- menuPortalZIndex: 1,
313
- maxMenuHeight: 220
314
- };
125
+ SearchSelectInput.defaultProps = defaultProps;
315
126
  SearchSelectInput.displayName = 'SearchSelectInput';
316
127
  var SearchSelectInput$1 = SearchSelectInput;
317
128
 
318
129
  // NOTE: This string will be replaced on build time with the package version.
319
- var version = "12.2.7";
130
+ var version = "13.0.2";
320
131
 
321
132
  exports["default"] = SearchSelectInput$1;
322
133
  exports.version = version;
@@ -11,11 +11,9 @@ var _Object$getOwnPropertyDescriptors = require('@babel/runtime-corejs3/core-js-
11
11
  var _Object$defineProperties = require('@babel/runtime-corejs3/core-js-stable/object/define-properties');
12
12
  var _Object$defineProperty = require('@babel/runtime-corejs3/core-js-stable/object/define-property');
13
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
14
  require('prop-types');
15
+ var react = require('react');
17
16
  var reactIntl = require('react-intl');
18
- require('@commercetools-uikit/utils');
19
17
  var AsyncSelectInput = require('@commercetools-uikit/async-select-input');
20
18
  var selectUtils = require('@commercetools-uikit/select-utils');
21
19
  var _styled = require('@emotion/styled/base');
@@ -54,14 +52,19 @@ var messages = reactIntl.defineMessages({
54
52
  });
55
53
 
56
54
  var SearchSelectInputWrapper = _styled__default["default"]("div", {
57
- target: "ec7yve10"
55
+ target: "e6cl9390"
58
56
  } )(function (props) {
59
57
  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
58
  }, ";" + ("" ));
61
59
 
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; }
60
+ function ownKeys(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); 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
61
 
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; }
62
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
63
+ var defaultProps = {
64
+ value: null,
65
+ menuPortalZIndex: 1,
66
+ maxMenuHeight: 220
67
+ };
65
68
 
66
69
  var SearchSelectInput = function SearchSelectInput(props) {
67
70
  var intl = reactIntl.useIntl();
@@ -75,12 +78,11 @@ var SearchSelectInput = function SearchSelectInput(props) {
75
78
  var optionType = props.optionType;
76
79
  var components = react.useMemo(function () {
77
80
  return _objectSpread(_objectSpread({
78
- // eslint-disable-next-line react/display-name
79
81
  Option: function Option(optionInnerProps) {
80
- return jsxRuntime.jsx(selectUtils.CustomSelectInputOption, {
82
+ return jsxRuntime.jsx(selectUtils.CustomSelectInputOption, _objectSpread(_objectSpread({}, optionInnerProps), {}, {
81
83
  optionType: optionType,
82
84
  optionInnerProps: optionInnerProps
83
- });
85
+ }));
84
86
  }
85
87
  }, props.components), {}, {
86
88
  DropdownIndicator: selectUtils.SearchIconDropdownIndicator
@@ -95,22 +97,19 @@ var SearchSelectInput = function SearchSelectInput(props) {
95
97
  iconLeft: undefined,
96
98
  loadingMessage: loadingMessage,
97
99
  noOptionsMessage: noOptionsMessage,
98
- isSearchable: true
100
+ isSearchable: true,
101
+ closeMenuOnSelect: props.closeMenuOnSelect
99
102
  }))
100
103
  });
101
104
  };
102
105
 
103
106
  SearchSelectInput.propTypes = {};
104
- SearchSelectInput.defaultProps = {
105
- value: null,
106
- menuPortalZIndex: 1,
107
- maxMenuHeight: 220
108
- };
107
+ SearchSelectInput.defaultProps = defaultProps;
109
108
  SearchSelectInput.displayName = 'SearchSelectInput';
110
109
  var SearchSelectInput$1 = SearchSelectInput;
111
110
 
112
111
  // NOTE: This string will be replaced on build time with the package version.
113
- var version = "12.2.7";
112
+ var version = "13.0.2";
114
113
 
115
114
  exports["default"] = SearchSelectInput$1;
116
115
  exports.version = version;
@@ -7,11 +7,9 @@ import _Object$getOwnPropertyDescriptors from '@babel/runtime-corejs3/core-js-st
7
7
  import _Object$defineProperties from '@babel/runtime-corejs3/core-js-stable/object/define-properties';
8
8
  import _Object$defineProperty from '@babel/runtime-corejs3/core-js-stable/object/define-property';
9
9
  import _defineProperty from '@babel/runtime-corejs3/helpers/esm/defineProperty';
10
- import _concatInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/concat';
10
+ import _pt from 'prop-types';
11
11
  import { useMemo } from 'react';
12
- import PropTypes from 'prop-types';
13
12
  import { defineMessages, useIntl } from 'react-intl';
14
- import { SafeHTMLElement } from '@commercetools-uikit/utils';
15
13
  import AsyncSelectInput from '@commercetools-uikit/async-select-input';
16
14
  import { CustomSelectInputOption, SearchIconDropdownIndicator } from '@commercetools-uikit/select-utils';
17
15
  import _styled from '@emotion/styled/base';
@@ -37,17 +35,22 @@ var messages = defineMessages({
37
35
  });
38
36
 
39
37
  var SearchSelectInputWrapper = _styled("div", process.env.NODE_ENV === "production" ? {
40
- target: "ec7yve10"
38
+ target: "e6cl9390"
41
39
  } : {
42
- target: "ec7yve10",
40
+ target: "e6cl9390",
43
41
  label: "SearchSelectInputWrapper"
44
42
  })(function (props) {
45
43
  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 */"));
44
+ }, ";" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNlYXJjaC1zZWxlY3QtaW5wdXQuc3R5bGVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQU9DIiwiZmlsZSI6InNlYXJjaC1zZWxlY3QtaW5wdXQuc3R5bGVzLnRzIiwic291cmNlc0NvbnRlbnQiOlsiLyogZXNsaW50LWRpc2FibGUgaW1wb3J0L3ByZWZlci1kZWZhdWx0LWV4cG9ydCAqL1xuaW1wb3J0IHN0eWxlZCBmcm9tICdAZW1vdGlvbi9zdHlsZWQnO1xuaW1wb3J0IHsgY3VzdG9tUHJvcGVydGllcyBhcyB2YXJzIH0gZnJvbSAnQGNvbW1lcmNldG9vbHMtdWlraXQvZGVzaWduLXN5c3RlbSc7XG5pbXBvcnQgdHlwZSB7IFRTZWFyY2hTZWxlY3RJbnB1dFByb3BzIH0gZnJvbSAnLi9zZWFyY2gtc2VsZWN0LWlucHV0JztcblxuY29uc3QgU2VhcmNoU2VsZWN0SW5wdXRXcmFwcGVyID0gc3R5bGVkLmRpdjxcbiAgUGljazxUU2VhcmNoU2VsZWN0SW5wdXRQcm9wcywgJ2lzRGlzYWJsZWQnIHwgJ2lzUmVhZE9ubHknPlxuPmBcbiAgJHsocHJvcHMpID0+XG4gICAgIXByb3BzLmlzRGlzYWJsZWQgJiYgIXByb3BzLmlzUmVhZE9ubHlcbiAgICAgID8gYGRpdltjbGFzcyQ9J2NvbnRyb2wnXSB7XG4gICAgICAgICY6aG92ZXIge1xuICAgICAgICAgIGN1cnNvcjogdGV4dDtcbiAgICAgICAgfVxuICAgICAgICBkaXZbY2xhc3MkPSdpbmRpY2F0b3JDb250YWluZXInIGldIHtcbiAgICAgICAgICBjdXJzb3I6IHBvaW50ZXI7XG4gICAgICAgICAgc3ZnICoge1xuICAgICAgICAgICAgZmlsbDogJHt2YXJzLmNvbG9yU29saWR9O1xuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgfWBcbiAgICAgIDogJyd9XG5gO1xuXG5leHBvcnQgeyBTZWFyY2hTZWxlY3RJbnB1dFdyYXBwZXIgfTtcbiJdfQ== */"));
47
45
 
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; }
46
+ function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
49
47
 
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; }
48
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
49
+ var defaultProps = {
50
+ value: null,
51
+ menuPortalZIndex: 1,
52
+ maxMenuHeight: 220
53
+ };
51
54
 
52
55
  var SearchSelectInput = function SearchSelectInput(props) {
53
56
  var intl = useIntl();
@@ -61,12 +64,11 @@ var SearchSelectInput = function SearchSelectInput(props) {
61
64
  var optionType = props.optionType;
62
65
  var components = useMemo(function () {
63
66
  return _objectSpread(_objectSpread({
64
- // eslint-disable-next-line react/display-name
65
67
  Option: function Option(optionInnerProps) {
66
- return jsx(CustomSelectInputOption, {
68
+ return jsx(CustomSelectInputOption, _objectSpread(_objectSpread({}, optionInnerProps), {}, {
67
69
  optionType: optionType,
68
70
  optionInnerProps: optionInnerProps
69
- });
71
+ }));
70
72
  }
71
73
  }, props.components), {}, {
72
74
  DropdownIndicator: SearchIconDropdownIndicator
@@ -81,222 +83,32 @@ var SearchSelectInput = function SearchSelectInput(props) {
81
83
  iconLeft: undefined,
82
84
  loadingMessage: loadingMessage,
83
85
  noOptionsMessage: noOptionsMessage,
84
- isSearchable: true
86
+ isSearchable: true,
87
+ closeMenuOnSelect: props.closeMenuOnSelect
85
88
  }))
86
89
  });
87
90
  };
88
91
 
89
92
  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'])
93
+ horizontalConstraint: _pt.oneOf([3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 'scale', 'auto']),
94
+ hasError: _pt.bool,
95
+ hasWarning: _pt.bool,
96
+ isReadOnly: _pt.bool,
97
+ isDisabled: _pt.bool,
98
+ isClearable: _pt.bool,
99
+ isAutofocussed: _pt.bool,
100
+ menuPortalZIndex: _pt.number.isRequired,
101
+ showOptionGroupDivider: _pt.bool,
102
+ onBlur: _pt.func,
103
+ onChange: _pt.func.isRequired,
104
+ loadingMessage: _pt.oneOfType([_pt.string, _pt.func]),
105
+ optionType: _pt.oneOf(['single-property', 'double-property', 'multiple-properties'])
290
106
  } : {};
291
- SearchSelectInput.defaultProps = {
292
- value: null,
293
- menuPortalZIndex: 1,
294
- maxMenuHeight: 220
295
- };
107
+ SearchSelectInput.defaultProps = defaultProps;
296
108
  SearchSelectInput.displayName = 'SearchSelectInput';
297
109
  var SearchSelectInput$1 = SearchSelectInput;
298
110
 
299
111
  // NOTE: This string will be replaced on build time with the package version.
300
- var version = "12.2.7";
112
+ var version = "13.0.2";
301
113
 
302
114
  export { SearchSelectInput$1 as default, version };
@@ -0,0 +1,2 @@
1
+ export { default } from './search-select-input';
2
+ export { default as version } from './version';
@@ -0,0 +1,18 @@
1
+ declare const _default: {
2
+ noOptionsMessage: {
3
+ id: string;
4
+ description: string;
5
+ defaultMessage: string;
6
+ };
7
+ loadingOptionsMessage: {
8
+ id: string;
9
+ description: string;
10
+ defaultMessage: string;
11
+ };
12
+ placeholderMessage: {
13
+ id: string;
14
+ description: string;
15
+ defaultMessage: string;
16
+ };
17
+ };
18
+ export default _default;
@@ -0,0 +1,55 @@
1
+ import type { ActionMeta, GroupBase } from 'react-select';
2
+ import type { AsyncProps } from 'react-select/async';
3
+ declare type ReactSelectAsyncProps = AsyncProps<unknown, boolean, GroupBase<unknown>>;
4
+ declare type TEvent = {
5
+ target: {
6
+ name?: string;
7
+ value?: unknown;
8
+ };
9
+ persist: () => void;
10
+ };
11
+ export declare type TSearchSelectInputProps = {
12
+ horizontalConstraint?: 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 'scale' | 'auto';
13
+ 'aria-label'?: ReactSelectAsyncProps['aria-label'];
14
+ 'aria-labelledby'?: ReactSelectAsyncProps['aria-labelledby'];
15
+ id?: ReactSelectAsyncProps['inputId'];
16
+ containerId?: ReactSelectAsyncProps['id'];
17
+ name?: ReactSelectAsyncProps['name'];
18
+ placeholder?: ReactSelectAsyncProps['placeholder'];
19
+ components?: ReactSelectAsyncProps['components'];
20
+ tabIndex?: ReactSelectAsyncProps['tabIndex'];
21
+ value?: ReactSelectAsyncProps['value'];
22
+ backspaceRemovesValue?: ReactSelectAsyncProps['backspaceRemovesValue'];
23
+ hasError?: boolean;
24
+ hasWarning?: boolean;
25
+ isReadOnly?: boolean;
26
+ isDisabled?: boolean;
27
+ isClearable?: boolean;
28
+ isOptionDisabled?: ReactSelectAsyncProps['isOptionDisabled'];
29
+ isMulti?: ReactSelectAsyncProps['isMulti'];
30
+ isAutofocussed?: boolean;
31
+ noOptionsMessage?: ReactSelectAsyncProps['noOptionsMessage'];
32
+ maxMenuHeight?: ReactSelectAsyncProps['maxMenuHeight'];
33
+ menuPortalTarget?: ReactSelectAsyncProps['menuPortalTarget'];
34
+ menuPortalZIndex: number;
35
+ menuShouldBlockScroll?: ReactSelectAsyncProps['menuShouldBlockScroll'];
36
+ closeMenuOnSelect?: ReactSelectAsyncProps['closeMenuOnSelect'];
37
+ showOptionGroupDivider?: boolean;
38
+ defaultOptions?: ReactSelectAsyncProps['defaultOptions'];
39
+ onBlur?: (event: TEvent) => void;
40
+ onChange: (event: TEvent, info: ActionMeta<unknown>) => void;
41
+ onFocus?: ReactSelectAsyncProps['onFocus'];
42
+ onInputChange?: ReactSelectAsyncProps['onInputChange'];
43
+ tabSelectsValue?: ReactSelectAsyncProps['tabSelectsValue'];
44
+ loadOptions: ReactSelectAsyncProps['loadOptions'];
45
+ loadingMessage?: string | (() => string);
46
+ cacheOptions?: ReactSelectAsyncProps['cacheOptions'];
47
+ filterOption?: ReactSelectAsyncProps['filterOption'];
48
+ optionType?: 'single-property' | 'double-property' | 'multiple-properties';
49
+ };
50
+ declare const SearchSelectInput: {
51
+ (props: TSearchSelectInputProps): import("@emotion/react/jsx-runtime").JSX.Element;
52
+ defaultProps: Pick<TSearchSelectInputProps, "value" | "maxMenuHeight" | "menuPortalZIndex">;
53
+ displayName: string;
54
+ };
55
+ export default SearchSelectInput;
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ import type { TSearchSelectInputProps } from './search-select-input';
3
+ declare const SearchSelectInputWrapper: import("@emotion/styled").StyledComponent<{
4
+ theme?: import("@emotion/react").Theme | undefined;
5
+ as?: import("react").ElementType<any> | undefined;
6
+ } & Pick<TSearchSelectInputProps, "isDisabled" | "isReadOnly">, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
7
+ export { SearchSelectInputWrapper };
@@ -0,0 +1,2 @@
1
+ declare const _default: "__@UI_KIT_PACKAGE/VERSION_OF_RELEASE__";
2
+ export default _default;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@commercetools-uikit/search-select-input",
3
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": "12.2.7",
4
+ "version": "13.0.2",
5
5
  "bugs": "https://github.com/commercetools/ui-kit/issues",
6
6
  "repository": {
7
7
  "type": "git",
@@ -19,22 +19,22 @@
19
19
  "module": "dist/commercetools-uikit-search-select-input.esm.js",
20
20
  "files": ["dist"],
21
21
  "dependencies": {
22
- "@babel/runtime": "7.16.3",
23
- "@babel/runtime-corejs3": "7.16.3",
24
- "@commercetools-uikit/async-select-input": "12.2.7",
25
- "@commercetools-uikit/design-system": "12.2.5",
26
- "@commercetools-uikit/select-utils": "12.2.7",
27
- "@commercetools-uikit/spacings": "12.2.5",
28
- "@commercetools-uikit/text": "12.2.5",
29
- "@commercetools-uikit/utils": "12.2.5",
22
+ "@babel/runtime": "7.17.2",
23
+ "@babel/runtime-corejs3": "7.17.2",
24
+ "@commercetools-uikit/async-select-input": "13.0.2",
25
+ "@commercetools-uikit/design-system": "13.0.0",
26
+ "@commercetools-uikit/select-utils": "13.0.2",
27
+ "@commercetools-uikit/spacings": "13.0.2",
28
+ "@commercetools-uikit/text": "13.0.2",
29
+ "@commercetools-uikit/utils": "13.0.2",
30
30
  "@emotion/react": "^11.4.0",
31
31
  "@emotion/styled": "^11.3.0",
32
- "prop-types": "15.7.2"
32
+ "prop-types": "15.8.1"
33
33
  },
34
34
  "devDependencies": {
35
35
  "react": "17.0.2",
36
36
  "react-dom": "17.0.2",
37
- "react-intl": "5.21.2"
37
+ "react-intl": "5.24.6"
38
38
  },
39
39
  "peerDependencies": {
40
40
  "react": "17.x",