@commercetools-uikit/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.
@@ -2,6 +2,11 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
6
+ require('prop-types');
7
+ var _filterInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/filter');
8
+ var _mapInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/map');
9
+ var _findInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/find');
5
10
  var _Object$keys = require('@babel/runtime-corejs3/core-js-stable/object/keys');
6
11
  var _Object$getOwnPropertySymbols = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
7
12
  var _Object$getOwnPropertyDescriptor = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor');
@@ -9,13 +14,8 @@ var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/in
9
14
  var _Object$getOwnPropertyDescriptors = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors');
10
15
  var _Object$defineProperties = require('@babel/runtime-corejs3/core-js-stable/object/define-properties');
11
16
  var _Object$defineProperty = require('@babel/runtime-corejs3/core-js-stable/object/define-property');
12
- var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
13
- var _filterInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/filter');
14
- var _mapInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/map');
15
- var _findInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/find');
16
- require('@babel/runtime-corejs3/core-js-stable/instance/concat');
17
- require('prop-types');
18
17
  var reactIntl = require('react-intl');
18
+ var isEmpty = require('lodash/isEmpty');
19
19
  var react = require('@emotion/react');
20
20
  var has = require('lodash/has');
21
21
  var flatMap = require('lodash/flatMap');
@@ -27,6 +27,9 @@ var jsxRuntime = require('@emotion/react/jsx-runtime');
27
27
 
28
28
  function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
29
29
 
30
+ var _filterInstanceProperty__default = /*#__PURE__*/_interopDefault(_filterInstanceProperty);
31
+ var _mapInstanceProperty__default = /*#__PURE__*/_interopDefault(_mapInstanceProperty);
32
+ var _findInstanceProperty__default = /*#__PURE__*/_interopDefault(_findInstanceProperty);
30
33
  var _Object$keys__default = /*#__PURE__*/_interopDefault(_Object$keys);
31
34
  var _Object$getOwnPropertySymbols__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertySymbols);
32
35
  var _Object$getOwnPropertyDescriptor__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertyDescriptor);
@@ -34,22 +37,24 @@ var _forEachInstanceProperty__default = /*#__PURE__*/_interopDefault(_forEachIns
34
37
  var _Object$getOwnPropertyDescriptors__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertyDescriptors);
35
38
  var _Object$defineProperties__default = /*#__PURE__*/_interopDefault(_Object$defineProperties);
36
39
  var _Object$defineProperty__default = /*#__PURE__*/_interopDefault(_Object$defineProperty);
37
- var _filterInstanceProperty__default = /*#__PURE__*/_interopDefault(_filterInstanceProperty);
38
- var _mapInstanceProperty__default = /*#__PURE__*/_interopDefault(_mapInstanceProperty);
39
- var _findInstanceProperty__default = /*#__PURE__*/_interopDefault(_findInstanceProperty);
40
+ var isEmpty__default = /*#__PURE__*/_interopDefault(isEmpty);
40
41
  var has__default = /*#__PURE__*/_interopDefault(has);
41
42
  var flatMap__default = /*#__PURE__*/_interopDefault(flatMap);
42
43
  var Select__default = /*#__PURE__*/_interopDefault(Select);
43
44
  var Constraints__default = /*#__PURE__*/_interopDefault(Constraints);
44
45
 
45
- 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; }
46
+ 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; }
46
47
 
47
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context5; _forEachInstanceProperty__default["default"](_context5 = ownKeys(Object(source), true)).call(_context5, 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 _context6; _forEachInstanceProperty__default["default"](_context6 = ownKeys(Object(source))).call(_context6, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } } return target; }
48
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context4, _context5; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context4 = ownKeys(Object(source), !0)).call(_context4, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context5 = ownKeys(Object(source))).call(_context5, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
48
49
  var customizedComponents = {
49
50
  DropdownIndicator: selectUtils.DropdownIndicator,
50
51
  ClearIndicator: selectUtils.ClearIndicator,
51
52
  MultiValueRemove: selectUtils.TagRemove
52
53
  };
54
+ var defaultProps = {
55
+ maxMenuHeight: 220,
56
+ menuPortalZIndex: 1
57
+ };
53
58
 
54
59
  var SelectInput = function SelectInput(props) {
55
60
  var _context, _context2;
@@ -86,7 +91,6 @@ var SelectInput = function SelectInput(props) {
86
91
  autoFocus: props.isAutofocussed,
87
92
  backspaceRemovesValue: props.isReadOnly ? false : props.backspaceRemovesValue,
88
93
  components: _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, customizedComponents), props.iconLeft && !props.isMulti ? selectUtils.customComponentsWithIcons : {}), props.isReadOnly ? {
89
- // eslint-disable-next-line react/display-name
90
94
  Input: function Input(ownProps) {
91
95
  return jsxRuntime.jsx(Select.components.Input, _objectSpread(_objectSpread({}, ownProps), {}, {
92
96
  readOnly: true
@@ -100,7 +104,10 @@ var SelectInput = function SelectInput(props) {
100
104
  showOptionGroupDivider: props.showOptionGroupDivider,
101
105
  menuPortalZIndex: props.menuPortalZIndex,
102
106
  isDisabled: props.isDisabled,
103
- isReadOnly: props.isReadOnly
107
+ isReadOnly: props.isReadOnly,
108
+ iconLeft: props.iconLeft,
109
+ isMulti: props.isMulti,
110
+ hasValue: !isEmpty__default["default"](selectedOptions)
104
111
  }, theme),
105
112
  filterOption: props.filterOption // react-select uses "id" (for the container) and "inputId" (for the input),
106
113
  // but we use "id" (for the input) and "containerId" (for the container)
@@ -112,17 +119,19 @@ var SelectInput = function SelectInput(props) {
112
119
  inputValue: props.inputValue,
113
120
  isClearable: props.isReadOnly ? false : props.isClearable,
114
121
  isDisabled: props.isDisabled,
122
+ isOptionDisabled: props.isOptionDisabled // @ts-ignore
123
+ ,
115
124
  isReadOnly: props.isReadOnly,
116
- isOptionDisabled: props.isOptionDisabled,
117
125
  isMulti: props.isMulti,
118
126
  isSearchable: props.isSearchable,
119
127
  maxMenuHeight: props.maxMenuHeight,
120
128
  menuPortalTarget: props.menuPortalTarget,
121
129
  menuShouldBlockScroll: props.menuShouldBlockScroll,
130
+ closeMenuOnSelect: props.closeMenuOnSelect,
122
131
  name: props.name,
123
132
  noOptionsMessage: props.noOptionsMessage || function (_ref) {
124
133
  var inputValue = _ref.inputValue;
125
- return inputValue === '' ? intl.formatMessage(selectUtils.messages.noOptionsMessageWithoutInputValue) : intl.formatMessage(selectUtils.messages.noOptionsMessageWithInputValue, {
134
+ return !inputValue || inputValue === '' ? intl.formatMessage(selectUtils.messages.noOptionsMessageWithoutInputValue) : intl.formatMessage(selectUtils.messages.noOptionsMessageWithInputValue, {
126
135
  inputValue: inputValue
127
136
  });
128
137
  },
@@ -138,10 +147,9 @@ var SelectInput = function SelectInput(props) {
138
147
  return props.name ? "".concat(props.name, ".0") : undefined;
139
148
  }()
140
149
  },
141
- // eslint-disable-next-line @typescript-eslint/no-empty-function
142
150
  persist: function persist() {}
143
151
  };
144
- props.onBlur(event);
152
+ props.onBlur && props.onBlur(event);
145
153
  } : undefined,
146
154
  onChange: function onChange(nextSelectedOptions) {
147
155
  // nextSelectedOptions is either an array, or a single option, or null
@@ -150,7 +158,9 @@ var SelectInput = function SelectInput(props) {
150
158
 
151
159
  if (props.isMulti) {
152
160
  if (nextSelectedOptions) {
153
- value = _mapInstanceProperty__default["default"](nextSelectedOptions).call(nextSelectedOptions, function (option) {
161
+ var _context3;
162
+
163
+ value = _mapInstanceProperty__default["default"](_context3 = nextSelectedOptions).call(_context3, function (option) {
154
164
  return option.value;
155
165
  });
156
166
  } else {
@@ -160,12 +170,11 @@ var SelectInput = function SelectInput(props) {
160
170
  value = nextSelectedOptions.value;
161
171
  }
162
172
 
163
- props.onChange({
173
+ props.onChange && props.onChange({
164
174
  target: {
165
175
  name: props.name,
166
176
  value: value
167
177
  },
168
- // eslint-disable-next-line @typescript-eslint/no-empty-function
169
178
  persist: function persist() {}
170
179
  });
171
180
  },
@@ -175,13 +184,15 @@ var SelectInput = function SelectInput(props) {
175
184
  placeholder: placeholder,
176
185
  tabIndex: props.tabIndex,
177
186
  tabSelectsValue: props.tabSelectsValue,
178
- value: selectedOptions,
187
+ value: selectedOptions //@ts-ignore
188
+ ,
179
189
  iconLeft: props.iconLeft
180
190
  })
181
191
  }))
182
192
  });
183
193
  };
184
194
 
195
+ SelectInput.propTypes = {};
185
196
  SelectInput.displayName = 'SelectInput'; // Both "true" and an empty array [] represent a touched state. The Boolean
186
197
  // conveniently handles both cases
187
198
 
@@ -189,18 +200,14 @@ SelectInput.isTouched = function (touched) {
189
200
  return Boolean(touched);
190
201
  };
191
202
 
192
- SelectInput.defaultProps = {
193
- maxMenuHeight: 220,
194
- menuPortalZIndex: 1
195
- };
196
- SelectInput.propTypes = {};
203
+ SelectInput.defaultProps = defaultProps;
197
204
  utils.addStaticFields(SelectInput, _objectSpread(_objectSpread(_objectSpread({}, Select.components), customizedComponents), {}, {
198
205
  isTouched: SelectInput.isTouched
199
206
  }));
200
207
  var SelectInput$1 = SelectInput;
201
208
 
202
209
  // NOTE: This string will be replaced on build time with the package version.
203
- var version = "12.2.7";
210
+ var version = "13.0.2";
204
211
 
205
212
  exports["default"] = SelectInput$1;
206
213
  exports.version = version;
@@ -1,3 +1,8 @@
1
+ import _defineProperty from '@babel/runtime-corejs3/helpers/esm/defineProperty';
2
+ import _pt from 'prop-types';
3
+ import _filterInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/filter';
4
+ import _mapInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/map';
5
+ import _findInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/find';
1
6
  import _Object$keys from '@babel/runtime-corejs3/core-js-stable/object/keys';
2
7
  import _Object$getOwnPropertySymbols from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols';
3
8
  import _Object$getOwnPropertyDescriptor from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor';
@@ -5,30 +10,29 @@ import _forEachInstanceProperty from '@babel/runtime-corejs3/core-js-stable/inst
5
10
  import _Object$getOwnPropertyDescriptors from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors';
6
11
  import _Object$defineProperties from '@babel/runtime-corejs3/core-js-stable/object/define-properties';
7
12
  import _Object$defineProperty from '@babel/runtime-corejs3/core-js-stable/object/define-property';
8
- import _defineProperty from '@babel/runtime-corejs3/helpers/esm/defineProperty';
9
- import _filterInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/filter';
10
- import _mapInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/map';
11
- import _findInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/find';
12
- import _concatInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/concat';
13
- import PropTypes from 'prop-types';
14
13
  import { useIntl } from 'react-intl';
14
+ import isEmpty from 'lodash/isEmpty';
15
15
  import { useTheme } from '@emotion/react';
16
16
  import has from 'lodash/has';
17
17
  import flatMap from 'lodash/flatMap';
18
18
  import Select, { components } from 'react-select';
19
19
  import Constraints from '@commercetools-uikit/constraints';
20
20
  import { messages, customComponentsWithIcons, createSelectStyles, DropdownIndicator, ClearIndicator, TagRemove } from '@commercetools-uikit/select-utils';
21
- import { filterDataAttributes, SafeHTMLElement, addStaticFields } from '@commercetools-uikit/utils';
21
+ import { filterDataAttributes, addStaticFields } from '@commercetools-uikit/utils';
22
22
  import { jsx } from '@emotion/react/jsx-runtime';
23
23
 
24
- 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; }
24
+ 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; }
25
25
 
26
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context5; _forEachInstanceProperty(_context5 = ownKeys(Object(source), true)).call(_context5, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors) { _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)); } else { var _context6; _forEachInstanceProperty(_context6 = ownKeys(Object(source))).call(_context6, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } } return target; }
26
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context4, _context5; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context4 = ownKeys(Object(source), !0)).call(_context4, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context5 = ownKeys(Object(source))).call(_context5, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
27
27
  var customizedComponents = {
28
28
  DropdownIndicator: DropdownIndicator,
29
29
  ClearIndicator: ClearIndicator,
30
30
  MultiValueRemove: TagRemove
31
31
  };
32
+ var defaultProps = {
33
+ maxMenuHeight: 220,
34
+ menuPortalZIndex: 1
35
+ };
32
36
 
33
37
  var SelectInput = function SelectInput(props) {
34
38
  var _context, _context2;
@@ -65,7 +69,6 @@ var SelectInput = function SelectInput(props) {
65
69
  autoFocus: props.isAutofocussed,
66
70
  backspaceRemovesValue: props.isReadOnly ? false : props.backspaceRemovesValue,
67
71
  components: _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, customizedComponents), props.iconLeft && !props.isMulti ? customComponentsWithIcons : {}), props.isReadOnly ? {
68
- // eslint-disable-next-line react/display-name
69
72
  Input: function Input(ownProps) {
70
73
  return jsx(components.Input, _objectSpread(_objectSpread({}, ownProps), {}, {
71
74
  readOnly: true
@@ -79,7 +82,10 @@ var SelectInput = function SelectInput(props) {
79
82
  showOptionGroupDivider: props.showOptionGroupDivider,
80
83
  menuPortalZIndex: props.menuPortalZIndex,
81
84
  isDisabled: props.isDisabled,
82
- isReadOnly: props.isReadOnly
85
+ isReadOnly: props.isReadOnly,
86
+ iconLeft: props.iconLeft,
87
+ isMulti: props.isMulti,
88
+ hasValue: !isEmpty(selectedOptions)
83
89
  }, theme),
84
90
  filterOption: props.filterOption // react-select uses "id" (for the container) and "inputId" (for the input),
85
91
  // but we use "id" (for the input) and "containerId" (for the container)
@@ -91,17 +97,19 @@ var SelectInput = function SelectInput(props) {
91
97
  inputValue: props.inputValue,
92
98
  isClearable: props.isReadOnly ? false : props.isClearable,
93
99
  isDisabled: props.isDisabled,
100
+ isOptionDisabled: props.isOptionDisabled // @ts-ignore
101
+ ,
94
102
  isReadOnly: props.isReadOnly,
95
- isOptionDisabled: props.isOptionDisabled,
96
103
  isMulti: props.isMulti,
97
104
  isSearchable: props.isSearchable,
98
105
  maxMenuHeight: props.maxMenuHeight,
99
106
  menuPortalTarget: props.menuPortalTarget,
100
107
  menuShouldBlockScroll: props.menuShouldBlockScroll,
108
+ closeMenuOnSelect: props.closeMenuOnSelect,
101
109
  name: props.name,
102
110
  noOptionsMessage: props.noOptionsMessage || function (_ref) {
103
111
  var inputValue = _ref.inputValue;
104
- return inputValue === '' ? intl.formatMessage(messages.noOptionsMessageWithoutInputValue) : intl.formatMessage(messages.noOptionsMessageWithInputValue, {
112
+ return !inputValue || inputValue === '' ? intl.formatMessage(messages.noOptionsMessageWithoutInputValue) : intl.formatMessage(messages.noOptionsMessageWithInputValue, {
105
113
  inputValue: inputValue
106
114
  });
107
115
  },
@@ -117,10 +125,9 @@ var SelectInput = function SelectInput(props) {
117
125
  return props.name ? "".concat(props.name, ".0") : undefined;
118
126
  }()
119
127
  },
120
- // eslint-disable-next-line @typescript-eslint/no-empty-function
121
128
  persist: function persist() {}
122
129
  };
123
- props.onBlur(event);
130
+ props.onBlur && props.onBlur(event);
124
131
  } : undefined,
125
132
  onChange: function onChange(nextSelectedOptions) {
126
133
  // nextSelectedOptions is either an array, or a single option, or null
@@ -129,7 +136,9 @@ var SelectInput = function SelectInput(props) {
129
136
 
130
137
  if (props.isMulti) {
131
138
  if (nextSelectedOptions) {
132
- value = _mapInstanceProperty(nextSelectedOptions).call(nextSelectedOptions, function (option) {
139
+ var _context3;
140
+
141
+ value = _mapInstanceProperty(_context3 = nextSelectedOptions).call(_context3, function (option) {
133
142
  return option.value;
134
143
  });
135
144
  } else {
@@ -139,12 +148,11 @@ var SelectInput = function SelectInput(props) {
139
148
  value = nextSelectedOptions.value;
140
149
  }
141
150
 
142
- props.onChange({
151
+ props.onChange && props.onChange({
143
152
  target: {
144
153
  name: props.name,
145
154
  value: value
146
155
  },
147
- // eslint-disable-next-line @typescript-eslint/no-empty-function
148
156
  persist: function persist() {}
149
157
  });
150
158
  },
@@ -154,13 +162,33 @@ var SelectInput = function SelectInput(props) {
154
162
  placeholder: placeholder,
155
163
  tabIndex: props.tabIndex,
156
164
  tabSelectsValue: props.tabSelectsValue,
157
- value: selectedOptions,
165
+ value: selectedOptions //@ts-ignore
166
+ ,
158
167
  iconLeft: props.iconLeft
159
168
  })
160
169
  }))
161
170
  });
162
171
  };
163
172
 
173
+ SelectInput.propTypes = process.env.NODE_ENV !== "production" ? {
174
+ horizontalConstraint: _pt.oneOf([3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 'scale', 'auto']),
175
+ hasError: _pt.bool,
176
+ isReadOnly: _pt.bool,
177
+ hasWarning: _pt.bool,
178
+ iconLeft: _pt.node,
179
+ isAutofocussed: _pt.bool,
180
+ menuPortalZIndex: _pt.number,
181
+ onBlur: _pt.func,
182
+ onChange: _pt.func,
183
+ options: _pt.oneOfType([_pt.arrayOf(_pt.shape({
184
+ value: _pt.string.isRequired
185
+ })), _pt.arrayOf(_pt.shape({
186
+ options: _pt.arrayOf(_pt.shape({
187
+ value: _pt.string.isRequired
188
+ })).isRequired
189
+ }))]),
190
+ showOptionGroupDivider: _pt.bool
191
+ } : {};
164
192
  SelectInput.displayName = 'SelectInput'; // Both "true" and an empty array [] represent a touched state. The Boolean
165
193
  // conveniently handles both cases
166
194
 
@@ -168,256 +196,13 @@ SelectInput.isTouched = function (touched) {
168
196
  return Boolean(touched);
169
197
  };
170
198
 
171
- SelectInput.defaultProps = {
172
- maxMenuHeight: 220,
173
- menuPortalZIndex: 1
174
- };
175
- SelectInput.propTypes = process.env.NODE_ENV !== "production" ? {
176
- horizontalConstraint: PropTypes.oneOf([3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 'scale', 'auto']),
177
-
178
- /**
179
- * Indicates that input has errors
180
- */
181
- hasError: PropTypes.bool,
182
-
183
- /**
184
- * Is the select read-only
185
- */
186
- isReadOnly: PropTypes.bool,
187
-
188
- /**
189
- * Control to indicate on the input if there are selected values that are potentially invalid
190
- */
191
- hasWarning: PropTypes.bool,
192
-
193
- /**
194
- * Icon to display on the left of the placeholder text and selected value. Has no effect when isMulti is enabled.
195
- */
196
- iconLeft: PropTypes.node,
197
- // react-select base props
198
- //
199
- // Currently unsupported props are commented out. In case you need one of
200
- // these props when using UI Kit, you can submit a PR and enable the
201
- // prop. Don't forget to add it to the story, docs and other select input
202
- // components as well!
203
- //
204
- // See https://react-select.com/props#select-props
205
-
206
- /**
207
- * Aria label (for assistive tech)
208
- */
209
- 'aria-label': PropTypes.string,
210
-
211
- /**
212
- * HTML ID of an element that should be used as the label (for assistive tech)
213
- */
214
- 'aria-labelledby': PropTypes.string,
215
-
216
- /**
217
- * Focus the control when it is mounted
218
- */
219
- isAutofocussed: PropTypes.bool,
220
-
221
- /**
222
- * Remove the currently focused option when the user presses backspace
223
- */
224
- backspaceRemovesValue: PropTypes.bool,
225
- // blurInputOnSelect: PropTypes.bool,
226
- // captureMenuScroll: PropTypes.bool,
227
- // className: PropTypes.string,
228
- // classNamePrefix: PropTypes.string,
229
- // closeMenuOnSelect: PropTypes.bool,
230
- // closeMenuOnScroll: PropTypes.oneOfType([PropTypes.bool, PropTypes.func]),
231
-
232
- /**
233
- * Map of components to overwrite the default ones, see what components you can override
234
- */
235
- components: PropTypes.objectOf(PropTypes.func),
236
- // controlShouldRenderValue: PropTypes.bool,
237
- // delimiter: PropTypes.string,
238
- // escapeClearsValue: PropTypes.bool,
239
-
240
- /**
241
- * Custom method to filter whether an option should be displayed in the menu
242
- * <br />
243
- * Signature: `(option, rawInput) => boolean`
244
- */
245
- filterOption: PropTypes.func,
246
- // formatGroupLabel: PropTypes.func,
247
- // formatOptionLabel: PropTypes.func,
248
- // getOptionLabel: PropTypes.func,
249
- // getOptionValue: PropTypes.func,
250
- // hideSelectedOptions: PropTypes.bool,
251
-
252
- /**
253
- * Used as HTML id property. An id is generated automatically when not provided.
254
- *This forwarded as react-select's "inputId"
255
- */
256
- id: PropTypes.string,
257
- inputValue: PropTypes.string,
258
-
259
- /**
260
- * The id to set on the SelectContainer component
261
- * This is forwarded as react-select's "id"
262
- */
263
- containerId: PropTypes.string,
264
- // instanceId: PropTypes.string,
265
-
266
- /**
267
- * Is the select value clearable
268
- */
269
- isClearable: PropTypes.bool,
270
-
271
- /**
272
- * Is the select disabled
273
- */
274
- isDisabled: PropTypes.bool,
275
- // isLoading: PropTypes.bool,
276
-
277
- /**
278
- * Override the built-in logic to detect whether an option is disabled
279
- */
280
- isOptionDisabled: PropTypes.func,
281
- // isOptionSelected: PropTypes.func,
282
-
283
- /**
284
- * Support multiple selected options
285
- */
286
- isMulti: PropTypes.bool,
287
- // isRtl: PropTypes.bool,
288
-
289
- /**
290
- * Whether to enable search functionality
291
- */
292
- isSearchable: PropTypes.bool,
293
- // loadingMessage: PropTypes.func,
294
- // minMenuHeight: PropTypes.number,
295
-
296
- /**
297
- * Maximum height of the menu before scrolling
298
- */
299
- maxMenuHeight: PropTypes.number,
300
- // menuIsOpen: PropTypes.bool,
301
- // menuPlacement: PropTypes.oneOf(['auto', 'bottom', 'top']),
302
- // menuPosition: PropTypes.oneOf(['absolute', 'fixed']),
303
-
304
- /**
305
- * Dom element to portal the select menu to
306
- */
307
- menuPortalTarget: PropTypes.instanceOf(SafeHTMLElement),
308
-
309
- /**
310
- * z-index value for the menu portal
311
- */
312
- menuPortalZIndex: PropTypes.number,
313
-
314
- /**
315
- * whether the menu should block scroll while open
316
- */
317
- menuShouldBlockScroll: PropTypes.bool,
318
- // menuShouldScrollIntoView: PropTypes.bool,
319
-
320
- /**
321
- * Name of the HTML Input (optional - without this, no input will be rendered)
322
- */
323
- name: PropTypes.string,
324
-
325
- /**
326
- * 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 }.
327
- * <br />
328
- * `inputValue` will be an empty string when no search text is present.
329
- * <br />
330
- * Signature: `({ inputValue}) => string`
331
- */
332
- noOptionsMessage: PropTypes.func,
333
-
334
- /**
335
- * Handle blur events on the control
336
- * <br />
337
- * Signature: `(event) => void`
338
- */
339
- onBlur: PropTypes.func,
340
-
341
- /**
342
- * Called with a fake event when value changes. The event's target.name will be the name supplied in props. The event's target.value will hold the value.
343
- * <br/>
344
- * The value will be the selected option, or an array of options in case isMulti is true.
345
- * <br />
346
- * Signature: `(event) => void`
347
- */
348
- onChange: PropTypes.func,
349
-
350
- /**
351
- * Handle focus events on the control
352
- * <br />
353
- * Signature: `(event) => void`
354
- */
355
- onFocus: PropTypes.func,
356
-
357
- /**
358
- * Handle change events on the input
359
- * <br />
360
- * Signature: `(newValue, actionMeta) => void`
361
- */
362
- onInputChange: PropTypes.func,
363
- // onKeyDown: PropTypes.func,
364
- // onMenuOpen: PropTypes.func,
365
- // onMenuClose: PropTypes.func,
366
- // onMenuScrollToTop: PropTypes.func,
367
- // onMenuScrollToBottom: PropTypes.func,
368
- // openMenuOnFocus: PropTypes.bool,
369
- // openMenuOnClick: PropTypes.bool,
370
-
371
- /**
372
- * Array of options that populate the select menu
373
- */
374
- options: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.shape({
375
- value: PropTypes.string.isRequired
376
- }), PropTypes.shape({
377
- options: PropTypes.arrayOf(PropTypes.shape({
378
- value: PropTypes.string.isRequired
379
- }))
380
- })])),
381
- showOptionGroupDivider: PropTypes.bool,
382
- // pageSize: PropTypes.number,
383
-
384
- /**
385
- * Placeholder text for the select value
386
- */
387
- placeholder: PropTypes.string,
388
- // screenReaderStatus: PropTypes.func,
389
- // styles: PropTypes.objectOf(PropTypes.func),
390
- // theme: PropTypes.object,
391
-
392
- /**
393
- * Sets the tabIndex attribute on the input
394
- */
395
- tabIndex: PropTypes.string,
396
-
397
- /**
398
- * Select the currently focused option when the user presses tab
399
- */
400
- tabSelectsValue: PropTypes.bool,
401
-
402
- /**
403
- * The value of the select; reflected by the selected option
404
- */
405
- value: function value(props) {
406
- var _PropTypes$arrayOf, _context3, _context4;
407
-
408
- for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
409
- rest[_key - 1] = arguments[_key];
410
- }
411
-
412
- return props.isMulti ? (_PropTypes$arrayOf = PropTypes.arrayOf(PropTypes.string)).isRequired.apply(_PropTypes$arrayOf, _concatInstanceProperty(_context3 = [props]).call(_context3, rest)) : PropTypes.string.apply(PropTypes, _concatInstanceProperty(_context4 = [props]).call(_context4, rest));
413
- }
414
- } : {};
199
+ SelectInput.defaultProps = defaultProps;
415
200
  addStaticFields(SelectInput, _objectSpread(_objectSpread(_objectSpread({}, components), customizedComponents), {}, {
416
201
  isTouched: SelectInput.isTouched
417
202
  }));
418
203
  var SelectInput$1 = SelectInput;
419
204
 
420
205
  // NOTE: This string will be replaced on build time with the package version.
421
- var version = "12.2.7";
206
+ var version = "13.0.2";
422
207
 
423
208
  export { SelectInput$1 as default, version };
@@ -0,0 +1,2 @@
1
+ export { default } from './select-input';
2
+ export { default as version } from './version';
@@ -0,0 +1,61 @@
1
+ import type { ReactNode } from 'react';
2
+ import { type Props as ReactSelectProps } from 'react-select';
3
+ declare type TOption = {
4
+ value: string;
5
+ };
6
+ declare type TOptionObject = {
7
+ options: TOption[];
8
+ };
9
+ declare type TOptions = TOption[] | TOptionObject[];
10
+ declare type TEvent = {
11
+ target: {
12
+ name: ReactSelectProps['name'];
13
+ value?: string | string[] | null;
14
+ };
15
+ persist: () => void;
16
+ };
17
+ declare type TSelectInputProps = {
18
+ horizontalConstraint?: 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 'scale' | 'auto';
19
+ hasError?: boolean;
20
+ isReadOnly?: boolean;
21
+ hasWarning?: boolean;
22
+ iconLeft?: ReactNode;
23
+ 'aria-label'?: ReactSelectProps['aria-label'];
24
+ 'aria-labelledby'?: ReactSelectProps['aria-labelledby'];
25
+ isAutofocussed?: boolean;
26
+ backspaceRemovesValue?: ReactSelectProps['backspaceRemovesValue'];
27
+ components?: ReactSelectProps['components'];
28
+ filterOption?: ReactSelectProps['filterOption'];
29
+ id?: ReactSelectProps['inputId'];
30
+ inputValue?: ReactSelectProps['inputValue'];
31
+ containerId?: ReactSelectProps['id'];
32
+ isClearable?: ReactSelectProps['isClearable'];
33
+ isDisabled?: ReactSelectProps['isDisabled'];
34
+ isOptionDisabled?: ReactSelectProps['isOptionDisabled'];
35
+ isMulti?: ReactSelectProps['isMulti'];
36
+ isSearchable?: ReactSelectProps['isSearchable'];
37
+ maxMenuHeight?: ReactSelectProps['maxMenuHeight'];
38
+ menuPortalTarget?: ReactSelectProps['menuPortalTarget'];
39
+ menuPortalZIndex?: number;
40
+ menuShouldBlockScroll?: ReactSelectProps['menuShouldBlockScroll'];
41
+ closeMenuOnSelect?: ReactSelectProps['closeMenuOnSelect'];
42
+ name?: ReactSelectProps['name'];
43
+ noOptionsMessage?: ReactSelectProps['noOptionsMessage'];
44
+ onBlur?: (event: TEvent) => void;
45
+ onChange?: (event: TEvent) => void;
46
+ onFocus?: ReactSelectProps['onFocus'];
47
+ onInputChange?: ReactSelectProps['onInputChange'];
48
+ options?: TOptions;
49
+ showOptionGroupDivider?: boolean;
50
+ placeholder?: ReactSelectProps['placeholder'];
51
+ tabIndex?: ReactSelectProps['tabIndex'];
52
+ tabSelectsValue?: ReactSelectProps['tabSelectsValue'];
53
+ value: ReactSelectProps['value'];
54
+ };
55
+ declare const SelectInput: {
56
+ (props: TSelectInputProps): import("@emotion/react/jsx-runtime").JSX.Element;
57
+ displayName: string;
58
+ isTouched(touched: boolean | unknown[]): boolean;
59
+ defaultProps: Pick<TSelectInputProps, "maxMenuHeight" | "menuPortalZIndex">;
60
+ };
61
+ export default SelectInput;
@@ -0,0 +1,2 @@
1
+ declare const _default: "__@UI_KIT_PACKAGE/VERSION_OF_RELEASE__";
2
+ export default _default;