@itcase/ui 1.2.4 → 1.2.5

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.
Files changed (29) hide show
  1. package/dist/cjs/components/FormField.js +4 -4
  2. package/dist/cjs/components/Pagination.js +26 -22
  3. package/dist/cjs/components/Select.js +252 -1220
  4. package/dist/cjs/context/Notifications.js +3 -2
  5. package/dist/components/FormField.js +4 -4
  6. package/dist/components/Pagination.js +27 -23
  7. package/dist/components/Select.js +252 -1220
  8. package/dist/context/Notifications.js +3 -2
  9. package/dist/types/components/Pagination/Pagination.d.ts +0 -10
  10. package/dist/types/components/Select/Select.interface.d.ts +91 -0
  11. package/dist/types/components/Select/SelectClearIndicator.d.ts +4 -11
  12. package/dist/types/components/Select/SelectContainer.d.ts +4 -1
  13. package/dist/types/components/Select/SelectControl.d.ts +4 -11
  14. package/dist/types/components/Select/SelectDropdownIndicator.d.ts +4 -13
  15. package/dist/types/components/Select/SelectGroupHeading.d.ts +4 -7
  16. package/dist/types/components/Select/SelectIndicatorsContainer.d.ts +4 -4
  17. package/dist/types/components/Select/SelectInput.d.ts +4 -12
  18. package/dist/types/components/Select/SelectLoadingIndicator.d.ts +5 -7
  19. package/dist/types/components/Select/SelectMenu.d.ts +4 -11
  20. package/dist/types/components/Select/SelectMultiValueContainer.d.ts +4 -1
  21. package/dist/types/components/Select/SelectMultiValueLabel.d.ts +4 -4
  22. package/dist/types/components/Select/SelectMultiValueRemove.d.ts +4 -4
  23. package/dist/types/components/Select/SelectNoOptions.d.ts +4 -12
  24. package/dist/types/components/Select/SelectOption.d.ts +4 -16
  25. package/dist/types/components/Select/SelectPlaceholder.d.ts +4 -11
  26. package/dist/types/components/Select/SelectSingleValue.d.ts +4 -12
  27. package/dist/types/components/Select/SelectValueContainer.d.ts +4 -11
  28. package/dist/types/components/Select/index.d.ts +3 -5
  29. package/package.json +3 -2
@@ -1,9 +1,10 @@
1
1
  'use strict';
2
2
 
3
- var React = require('react');
4
- var PropTypes = require('prop-types');
3
+ var tslib_es6 = require('../../tslib.es6-CKiUdo7p.js');
4
+ var jsxRuntime = require('react/jsx-runtime');
5
5
  var Select = require('react-select');
6
6
  var Icon = require('../../Icon-Cq4hPF2D.js');
7
+ var React = require('react');
7
8
  var clsx = require('clsx');
8
9
  var CreatableSelect = require('react-select/creatable');
9
10
  var useDeviceTargetClass = require('../hooks/useDeviceTargetClass.js');
@@ -11,7 +12,6 @@ var Text = require('../../Text-_YhyTsQ1.js');
11
12
  var Badge = require('../../Badge-2JkquAEb.js');
12
13
  var Group = require('../../Group-Buo_BxGT.js');
13
14
  var Divider = require('../../Divider-BjB5MD6u.js');
14
- require('react/jsx-runtime');
15
15
  require('react-inlinesvg');
16
16
  require('../hooks/useStyles.js');
17
17
  require('lodash/camelCase');
@@ -19,10 +19,10 @@ require('lodash/maxBy');
19
19
  require('lodash/upperFirst');
20
20
  require('../hooks/styleAttributes.js');
21
21
  require('../context/UIContext.js');
22
+ require('prop-types');
22
23
  require('../hooks/useMediaQueries.js');
23
24
  require('react-responsive');
24
25
  require('../../Link-DQxoFKhI.js');
25
- require('../../tslib.es6-CKiUdo7p.js');
26
26
  require('../../Tooltip-DkTKx9n-.js');
27
27
  require('../../Title-zwP6c2U2.js');
28
28
  require('lodash/castArray');
@@ -30,1260 +30,292 @@ require('lodash/castArray');
30
30
  // For use memo need to check "ClearIndicator" props
31
31
  // const SelectClearIndicator = React.memo(
32
32
  function SelectClearIndicator(props) {
33
- const {
34
- children
35
- } = props;
36
- const {
37
- clearIcon,
38
- clearIconFill
39
- } = props.selectProps;
40
- return /*#__PURE__*/React.createElement(Select.components.ClearIndicator, props, clearIcon ? /*#__PURE__*/React.createElement(Icon.Icon, {
41
- iconFill: clearIconFill,
42
- SvgImage: clearIcon
43
- }) : children);
33
+ var children = props.children;
34
+ var _a = props.selectProps, clearIcon = _a.clearIcon, clearIconFill = _a.clearIconFill;
35
+ return (jsxRuntime.jsx(Select.components.ClearIndicator, tslib_es6.__assign({}, props, { children: clearIcon ? jsxRuntime.jsx(Icon.Icon, { iconFill: clearIconFill, SvgImage: clearIcon }) : children })));
44
36
  }
45
- // ,
46
- // function arePropsEqual(oldProps, newProps) {
47
- // const oldClearIcon = oldProps.selectProps.clearIcon
48
- // const oldClearIconFill = oldProps.selectProps.clearIconFill
49
-
50
- // const newClearIcon = newProps.selectProps.clearIcon
51
- // const newClearIconFill = newProps.selectProps.clearIconFill
52
37
 
53
- // const isClearIconSame = oldClearIcon === newClearIcon
54
- // const isClearIconFillSame = oldClearIconFill === newClearIconFill
55
-
56
- // return isClearIconSame && isClearIconFillSame
57
- // },
58
- // )
59
-
60
- SelectClearIndicator.propTypes = {
61
- children: PropTypes.any,
62
- selectProps: PropTypes.shape({
63
- clearIcon: PropTypes.string,
64
- clearIconFill: PropTypes.string
65
- })
66
- };
67
- SelectClearIndicator.__docgenInfo = {
68
- "description": "",
69
- "methods": [],
70
- "displayName": "SelectClearIndicator",
71
- "props": {
72
- "children": {
73
- "description": "",
74
- "type": {
75
- "name": "any"
76
- },
77
- "required": false
78
- },
79
- "selectProps": {
80
- "description": "",
81
- "type": {
82
- "name": "shape",
83
- "value": {
84
- "clearIcon": {
85
- "name": "string",
86
- "required": false
87
- },
88
- "clearIconFill": {
89
- "name": "string",
90
- "required": false
91
- }
92
- }
93
- },
94
- "required": false
95
- }
96
- }
97
- };
98
-
99
- const SelectControl = props => {
100
- const {
101
- before,
102
- after,
103
- inputFill,
104
- inputShape,
105
- inputBorderColor,
106
- inputBorderColorHover
107
- } = props.selectProps;
108
- return /*#__PURE__*/React.createElement(React.Fragment, null, before, /*#__PURE__*/React.createElement(Select.components.Control, Object.assign({}, props, {
109
- className: clsx('select__control', inputFill, inputShape, inputBorderColor && `border-color_${inputBorderColor}`, inputBorderColorHover && `border-color_hover_${inputBorderColorHover}`)
110
- })), after);
111
- };
112
- SelectControl.propTypes = {
113
- selectProps: PropTypes.shape({
114
- inputFill: PropTypes.string,
115
- inputShape: PropTypes.string,
116
- set: PropTypes.string
117
- })
118
- };
119
- SelectControl.__docgenInfo = {
120
- "description": "",
121
- "methods": [],
122
- "displayName": "SelectControl",
123
- "props": {
124
- "selectProps": {
125
- "description": "",
126
- "type": {
127
- "name": "shape",
128
- "value": {
129
- "inputFill": {
130
- "name": "string",
131
- "required": false
132
- },
133
- "inputShape": {
134
- "name": "string",
135
- "required": false
136
- },
137
- "set": {
138
- "name": "string",
139
- "required": false
140
- }
141
- }
142
- },
143
- "required": false
144
- }
145
- }
38
+ var SelectControl = function (props) {
39
+ var _a = props.selectProps, after = _a.after, before = _a.before, inputBorderColor = _a.inputBorderColor, inputBorderColorHover = _a.inputBorderColorHover, inputFill = _a.inputFill, inputShape = _a.inputShape;
40
+ return (jsxRuntime.jsxs(React.Fragment, { children: [before, jsxRuntime.jsx(Select.components.Control, tslib_es6.__assign({}, props, { className: clsx('select__control', inputFill, inputShape, inputBorderColor && "border-color_".concat(inputBorderColor), inputBorderColorHover && "border-color_hover_".concat(inputBorderColorHover)) })), after] }));
146
41
  };
147
42
 
148
43
  // For use memo need to check "DropdownIndicator" props
149
44
  // const SelectDropdownIndicator = React.memo(
150
- function SelectDropdownIndicator(props) {
151
- const {
152
- children
153
- } = props;
154
- const {
155
- dropdownFillHover,
156
- dropdownIcon,
157
- dropdownIconFill,
158
- dropdownIconShape
159
- } = props.selectProps;
160
- return /*#__PURE__*/React.createElement(Select.components.DropdownIndicator, props, dropdownIcon ? /*#__PURE__*/React.createElement(Icon.Icon, {
161
- fillHover: dropdownFillHover,
162
- iconFill: dropdownIconFill,
163
- shape: dropdownIconShape,
164
- SvgImage: dropdownIcon
165
- }) : children);
166
- }
167
- // ,
168
- // function arePropsEqual(oldProps, newProps) {
169
- // const oldDropdownFillHover = oldProps.selectProps.dropdownFillHover
170
- // const oldDropdownIcon = oldProps.selectProps.dropdownIcon
171
- // const oldDropdownIconFill = oldProps.selectProps.dropdownIconFill
172
- // const oldDropdownIconShape = oldProps.selectProps.dropdownIconShape
173
-
174
- // const newDropdownFillHover = newProps.selectProps.dropdownFillHover
175
- // const newDropdownIcon = newProps.selectProps.dropdownIcon
176
- // const newDropdownIconFill = newProps.selectProps.dropdownIconFill
177
- // const newDropdownIconShape = newProps.selectProps.dropdownIconShape
178
-
179
- // const isDropdownFillHoverSame = oldDropdownFillHover === newDropdownFillHover
180
- // const isDropdownIconSame = oldDropdownIcon === newDropdownIcon
181
- // const isDropdownIconFillSame = oldDropdownIconFill === newDropdownIconFill
182
- // const isDropdownIconShapeSame = oldDropdownIconShape === newDropdownIconShape
183
-
184
- // return (
185
- // isDropdownFillHoverSame &&
186
- // isDropdownIconSame &&
187
- // isDropdownIconFillSame &&
188
- // isDropdownIconShapeSame
189
- // )
190
- // },
191
- // )
192
-
193
- SelectDropdownIndicator.propTypes = {
194
- children: PropTypes.any,
195
- selectProps: PropTypes.shape({
196
- // "dropdownIcon" is SvgImage(file.svg)
197
- dropdownFillHover: PropTypes.string,
198
- dropdownIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.element]),
199
- dropdownIconFill: PropTypes.string,
200
- dropdownIconShape: PropTypes.string
201
- })
202
- };
203
- SelectDropdownIndicator.__docgenInfo = {
204
- "description": "",
205
- "methods": [],
206
- "displayName": "SelectDropdownIndicator",
207
- "props": {
208
- "children": {
209
- "description": "",
210
- "type": {
211
- "name": "any"
212
- },
213
- "required": false
214
- },
215
- "selectProps": {
216
- "description": "",
217
- "type": {
218
- "name": "shape",
219
- "value": {
220
- "dropdownFillHover": {
221
- "name": "string",
222
- "required": false
223
- },
224
- "dropdownIcon": {
225
- "name": "union",
226
- "value": [{
227
- "name": "func"
228
- }, {
229
- "name": "element"
230
- }],
231
- "required": false
232
- },
233
- "dropdownIconFill": {
234
- "name": "string",
235
- "required": false
236
- },
237
- "dropdownIconShape": {
238
- "name": "string",
239
- "required": false
240
- }
241
- }
242
- },
243
- "required": false
244
- }
245
- }
45
+ var SelectDropdownIndicator = function (props) {
46
+ var children = props.children;
47
+ var _a = props.selectProps, dropdownFillHover = _a.dropdownFillHover, dropdownIcon = _a.dropdownIcon, dropdownIconFill = _a.dropdownIconFill, dropdownIconShape = _a.dropdownIconShape;
48
+ return (jsxRuntime.jsx(Select.components.DropdownIndicator, tslib_es6.__assign({}, props, { children: dropdownIcon ? (jsxRuntime.jsx(Icon.Icon, { fillHover: dropdownFillHover, iconFill: dropdownIconFill, shape: dropdownIconShape, SvgImage: dropdownIcon })) : (children) })));
246
49
  };
247
50
 
248
- const SelectGroupHeading = props => {
249
- const {
250
- headingFill,
251
- headingFillHover,
252
- headingTextWeight,
253
- headingTextSize,
254
- headingTextColor
255
- } = props.selectProps;
256
- return /*#__PURE__*/React.createElement(Select.components.GroupHeading, Object.assign({}, props, {
257
- className: clsx('select__menu-group-heading', headingFill, headingFillHover)
258
- }), /*#__PURE__*/React.createElement(Text.Text, {
259
- size: headingTextSize,
260
- textWeight: headingTextWeight,
261
- textColor: headingTextColor
262
- }, props.data.label));
263
- };
264
- SelectGroupHeading.propTypes = {
265
- selectProps: PropTypes.shape({})
266
- };
267
- SelectGroupHeading.__docgenInfo = {
268
- "description": "",
269
- "methods": [],
270
- "displayName": "SelectGroupHeading",
271
- "props": {
272
- "selectProps": {
273
- "description": "",
274
- "type": {
275
- "name": "shape",
276
- "value": {}
277
- },
278
- "required": false
279
- }
280
- }
51
+ var SelectGroupHeading = function (props) {
52
+ var _a = props.selectProps, headingFill = _a.headingFill, headingFillHover = _a.headingFillHover, headingTextColor = _a.headingTextColor, headingTextSize = _a.headingTextSize, headingTextWeight = _a.headingTextWeight;
53
+ return (jsxRuntime.jsx(Select.components.GroupHeading, tslib_es6.__assign({}, props, { className: clsx('select__menu-group-heading', headingFill, headingFillHover), children: jsxRuntime.jsx(Text.Text, { size: headingTextSize, textColor: headingTextColor, textWeight: headingTextWeight, children: props.data.label }) })));
281
54
  };
282
55
 
283
- const SelectIndicatorsContainer = props => {
284
- const {
285
- badgeAppearance,
286
- badgeSize,
287
- badgeTextSize,
288
- showBadge,
289
- value
290
- } = props.selectProps;
291
- return /*#__PURE__*/React.createElement(Select.components.IndicatorsContainer, props, showBadge && value?.length > 0 ? /*#__PURE__*/React.createElement(Badge.Badge, {
292
- appearance: badgeAppearance,
293
- size: badgeSize,
294
- textSize: badgeTextSize,
295
- value: value.length
296
- }) : null, props.children);
297
- };
298
- SelectIndicatorsContainer.propTypes = {};
299
- SelectIndicatorsContainer.__docgenInfo = {
300
- "description": "",
301
- "methods": [],
302
- "displayName": "SelectIndicatorsContainer"
56
+ var SelectIndicatorsContainer = function (props) {
57
+ var _a = props.selectProps, badgeAppearance = _a.badgeAppearance, badgeSize = _a.badgeSize, badgeTextSize = _a.badgeTextSize, showBadge = _a.showBadge, value = _a.value;
58
+ return (jsxRuntime.jsxs(Select.components.IndicatorsContainer, tslib_es6.__assign({}, props, { children: [showBadge &&
59
+ value &&
60
+ // @ts-expect-error
61
+ (value === null || value === void 0 ? void 0 : value.length) > 0 ? (jsxRuntime.jsx(Badge.Badge, { appearance: badgeAppearance, size: badgeSize, textSize: badgeTextSize,
62
+ // @ts-expect-error
63
+ value: value.length.toString() })) : null, props.children] })));
303
64
  };
304
65
 
305
- const SelectInput = props => {
306
- const {
307
- inputTextSize,
308
- inputTextColor,
309
- inputCaretColor
310
- } = props.selectProps;
311
- return /*#__PURE__*/React.createElement(Select.components.Input, Object.assign({}, props, {
312
- className: clsx(inputTextSize && `text_size_${inputTextSize}`, inputTextColor && `text-color_${inputTextColor}`, inputCaretColor && `caret-color_${inputCaretColor}`)
313
- }));
314
- };
315
- SelectInput.propTypes = {
316
- selectProps: PropTypes.shape({
317
- inputTextSize: PropTypes.string,
318
- inputTextColor: PropTypes.string,
319
- inputCaretColor: PropTypes.string
320
- }),
321
- children: PropTypes.any
322
- };
323
- SelectInput.__docgenInfo = {
324
- "description": "",
325
- "methods": [],
326
- "displayName": "SelectInput",
327
- "props": {
328
- "selectProps": {
329
- "description": "",
330
- "type": {
331
- "name": "shape",
332
- "value": {
333
- "inputTextSize": {
334
- "name": "string",
335
- "required": false
336
- },
337
- "inputTextColor": {
338
- "name": "string",
339
- "required": false
340
- },
341
- "inputCaretColor": {
342
- "name": "string",
343
- "required": false
344
- }
345
- }
346
- },
347
- "required": false
348
- },
349
- "children": {
350
- "description": "",
351
- "type": {
352
- "name": "any"
353
- },
354
- "required": false
355
- }
356
- }
66
+ var SelectInput = function (props) {
67
+ var _a = props.selectProps, inputCaretColor = _a.inputCaretColor, inputTextColor = _a.inputTextColor, inputTextSize = _a.inputTextSize;
68
+ return (jsxRuntime.jsx(Select.components.Input, tslib_es6.__assign({}, props, { className: clsx(inputTextSize && "text_size_".concat(inputTextSize), inputTextColor && "text-color_".concat(inputTextColor), inputCaretColor && "caret-color_".concat(inputCaretColor)) })));
357
69
  };
358
70
 
359
- const SelectLoadingIndicator = props => {
360
- const {
361
- loadingIndicator
362
- } = props.selectProps;
363
- // Original indicator
364
- // <components.LoadingIndicator {...props}>
365
- // </components.LoadingIndicator>
366
- return loadingIndicator;
367
- };
368
- SelectLoadingIndicator.propTypes = {
369
- selectProps: PropTypes.shape({})
71
+ var SelectLoadingIndicator = function (props) {
72
+ var loadingIndicator = props.selectProps.loadingIndicator;
73
+ // Original indicator
74
+ // <components.LoadingIndicator {...props}>
75
+ // </components.LoadingIndicator>
76
+ return loadingIndicator;
370
77
  };
371
78
 
372
- const SelectMenu = props => {
373
- const {
374
- elevation,
375
- menuAfter,
376
- menuBefore
377
- } = props.selectProps;
378
- return /*#__PURE__*/React.createElement(Select.components.Menu, Object.assign({}, props, {
379
- className: clsx(elevation && `elevation_${elevation}`)
380
- }), menuBefore, props.selectProps.fetchingData ? /*#__PURE__*/React.createElement("span", {
381
- className: "fetching"
382
- }, "Fetching data...") : /*#__PURE__*/React.createElement(React.Fragment, null, props.children), menuAfter);
383
- };
384
- SelectMenu.propTypes = {
385
- selectProps: PropTypes.shape({
386
- fetchingData: PropTypes.any,
387
- set: PropTypes.string
388
- }),
389
- children: PropTypes.any
390
- };
391
- SelectMenu.__docgenInfo = {
392
- "description": "",
393
- "methods": [],
394
- "displayName": "SelectMenu",
395
- "props": {
396
- "selectProps": {
397
- "description": "",
398
- "type": {
399
- "name": "shape",
400
- "value": {
401
- "fetchingData": {
402
- "name": "any",
403
- "required": false
404
- },
405
- "set": {
406
- "name": "string",
407
- "required": false
408
- }
409
- }
410
- },
411
- "required": false
412
- },
413
- "children": {
414
- "description": "",
415
- "type": {
416
- "name": "any"
417
- },
418
- "required": false
419
- }
420
- }
79
+ var SelectMenu = function (props) {
80
+ var _a = props.selectProps, elevation = _a.elevation, menuAfter = _a.menuAfter, menuBefore = _a.menuBefore;
81
+ return (jsxRuntime.jsxs(Select.components.Menu, tslib_es6.__assign({}, props, { className: clsx(elevation && "elevation_".concat(elevation)), children: [menuBefore, props.selectProps.fetchingData ? (jsxRuntime.jsx("span", { className: "fetching", children: "Fetching data..." })) : (jsxRuntime.jsx(React.Fragment, { children: props.children })), menuAfter] })));
421
82
  };
422
83
 
423
- const SelectMultiValueContainer = props => {
424
- const {
425
- multipleItemFill,
426
- multipleItemFillHover
427
- } = props.selectProps;
428
- return /*#__PURE__*/React.createElement(Select.components.MultiValueContainer, props, /*#__PURE__*/React.createElement(Group.Group, {
429
- className: "select__multi-value-wrapper",
430
- direction: "horizontal",
431
- alignItems: "center",
432
- gap: "4",
433
- fill: multipleItemFill,
434
- fillHover: multipleItemFillHover
435
- }, props.children));
436
- };
437
- SelectMultiValueContainer.__docgenInfo = {
438
- "description": "",
439
- "methods": [],
440
- "displayName": "SelectMultiValueContainer"
84
+ var SelectMultiValueContainer = function (props) {
85
+ var _a = props.selectProps, multipleItemFill = _a.multipleItemFill, multipleItemFillHover = _a.multipleItemFillHover;
86
+ return (jsxRuntime.jsx(Select.components.MultiValueContainer, tslib_es6.__assign({}, props, { children: jsxRuntime.jsx(Group.Group, { className: "select__multi-value-wrapper", fill: multipleItemFill, fillHover: multipleItemFillHover, alignItems: "center", direction: "horizontal", gap: "4", children: props.children }) })));
441
87
  };
442
88
 
443
- const SelectMultiValueLabel = props => {
444
- const {
445
- multipleItemTextSize,
446
- multipleItemTextColor
447
- } = props.selectProps;
448
- return /*#__PURE__*/React.createElement(Select.components.MultiValueLabel, props, /*#__PURE__*/React.createElement(Text.Text, {
449
- size: multipleItemTextSize,
450
- textColor: multipleItemTextColor
451
- }, props.data.label));
452
- };
453
- SelectMultiValueLabel.propTypes = {};
454
- SelectMultiValueLabel.__docgenInfo = {
455
- "description": "",
456
- "methods": [],
457
- "displayName": "SelectMultiValueLabel"
89
+ var SelectMultiValueLabel = function (props) {
90
+ var _a = props.selectProps, multipleItemTextColor = _a.multipleItemTextColor, multipleItemTextSize = _a.multipleItemTextSize;
91
+ return (jsxRuntime.jsx(Select.components.MultiValueLabel, tslib_es6.__assign({}, props, { children: props.data && (jsxRuntime.jsx(Text.Text, { size: multipleItemTextSize, textColor: multipleItemTextColor, children: props.data.label })) })));
458
92
  };
459
93
 
460
- const SelectMultiValueRemove = props => {
461
- const {
462
- multipleItemIcon,
463
- multipleItemIconFill
464
- } = props.selectProps;
465
- return /*#__PURE__*/React.createElement(Select.components.MultiValueRemove, props, /*#__PURE__*/React.createElement(Icon.Icon, {
466
- SvgImage: multipleItemIcon,
467
- iconFill: multipleItemIconFill
468
- }));
469
- };
470
- SelectMultiValueRemove.propTypes = {};
471
- SelectMultiValueRemove.__docgenInfo = {
472
- "description": "",
473
- "methods": [],
474
- "displayName": "SelectMultiValueRemove"
94
+ var SelectMultiValueRemove = function (props) {
95
+ var _a = props.selectProps, multipleItemIcon = _a.multipleItemIcon, multipleItemIconFill = _a.multipleItemIconFill;
96
+ return (jsxRuntime.jsxs(Select.components.MultiValueRemove, tslib_es6.__assign({}, props, { children: [jsxRuntime.jsx(Icon.Icon, { iconFill: multipleItemIconFill, SvgImage: multipleItemIcon }), jsxRuntime.jsx(Select, { defaultValue: [{}], options: [
97
+ {
98
+ label: 'vs',
99
+ options: [{ label: '' }],
100
+ },
101
+ {},
102
+ ] })] })));
475
103
  };
476
104
 
477
- const SelectNoOptions = props => {
478
- const {
479
- inputValue,
480
- optionFill,
481
- optionBorder,
482
- optionBorderType,
483
- noOptionsTextSize,
484
- noOptionsTextColor,
485
- noOptionsText,
486
- noOptionsSearchText
487
- } = props.selectProps;
488
- return /*#__PURE__*/React.createElement(Select.components.NoOptionsMessage, Object.assign({}, props, {
489
- className: clsx(optionFill, optionBorder, optionBorderType)
490
- }), /*#__PURE__*/React.createElement(Text.Text, {
491
- size: noOptionsTextSize,
492
- textColor: noOptionsTextColor
493
- }, inputValue && noOptionsSearchText ? noOptionsSearchText : noOptionsText));
494
- };
495
- SelectNoOptions.propTypes = {
496
- selectProps: PropTypes.shape({
497
- noOptionsTextSize: PropTypes.string,
498
- noOptionsTextColor: PropTypes.string,
499
- noOptionsText: PropTypes.string
500
- }),
501
- children: PropTypes.any
502
- };
503
- SelectNoOptions.__docgenInfo = {
504
- "description": "",
505
- "methods": [],
506
- "displayName": "SelectNoOptions",
507
- "props": {
508
- "selectProps": {
509
- "description": "",
510
- "type": {
511
- "name": "shape",
512
- "value": {
513
- "noOptionsTextSize": {
514
- "name": "string",
515
- "required": false
516
- },
517
- "noOptionsTextColor": {
518
- "name": "string",
519
- "required": false
520
- },
521
- "noOptionsText": {
522
- "name": "string",
523
- "required": false
524
- }
525
- }
526
- },
527
- "required": false
528
- },
529
- "children": {
530
- "description": "",
531
- "type": {
532
- "name": "any"
533
- },
534
- "required": false
535
- }
536
- }
105
+ var SelectNoOptions = function (props) {
106
+ var _a = props.selectProps, inputValue = _a.inputValue, noOptionsSearchText = _a.noOptionsSearchText, noOptionsText = _a.noOptionsText, noOptionsTextColor = _a.noOptionsTextColor, noOptionsTextSize = _a.noOptionsTextSize, optionBorder = _a.optionBorder, optionBorderType = _a.optionBorderType, optionFill = _a.optionFill;
107
+ return (jsxRuntime.jsx(Select.components.NoOptionsMessage, tslib_es6.__assign({}, props, { className: clsx(optionFill, optionBorder, optionBorderType), children: jsxRuntime.jsx(Text.Text, { size: noOptionsTextSize, textColor: noOptionsTextColor, children: inputValue && noOptionsSearchText ? noOptionsSearchText : noOptionsText }) })));
537
108
  };
538
109
 
539
- const SelectOption = props => {
540
- const {
541
- label,
542
- isSelected,
543
- data
544
- } = props;
545
- const {
546
- showDivider,
547
- dividerDirection,
548
- dividerFill,
549
- dividerSize,
550
- menuItemSize,
551
- optionFill,
552
- optionFillHover,
553
- optionBorder,
554
- optionBorderType,
555
- optionSelected,
556
- optionTextSize,
557
- optionShape,
558
- optionTextColor,
559
- optionBefore,
560
- optionAfter
561
- } = props.selectProps;
562
- return /*#__PURE__*/React.createElement(Select.components.Option, Object.assign({}, props, {
563
- className: clsx('select__menu-list-item', isSelected && 'select__menu-list-item_state_selected', menuItemSize && `select__menu-list-item_size_${menuItemSize}`, optionFill, optionBorder, optionBorderType, optionFillHover, optionShape)
564
- }), optionBefore, /*#__PURE__*/React.createElement(Text.Text, {
565
- className: "select__menu-list-item_option",
566
- size: optionTextSize,
567
- textColor: optionTextColor
568
- }, label), isSelected && /*#__PURE__*/React.createElement("div", {
569
- className: "select__menu-list-item_selected"
570
- }, optionSelected), optionAfter, showDivider && /*#__PURE__*/React.createElement(Divider.Divider, {
571
- direction: dividerDirection,
572
- fill: dividerFill,
573
- size: dividerSize,
574
- width: "fill"
575
- }));
576
- };
577
- SelectOption.propTypes = {
578
- selectProps: PropTypes.shape({
579
- optionFill: PropTypes.string,
580
- optionTextSize: PropTypes.string,
581
- optionTextColor: PropTypes.string,
582
- optionShape: PropTypes.string,
583
- optionBefore: PropTypes.any,
584
- optionAfter: PropTypes.any
585
- }),
586
- label: PropTypes.string,
587
- isSelected: PropTypes.any
588
- };
589
- SelectOption.__docgenInfo = {
590
- "description": "",
591
- "methods": [],
592
- "displayName": "SelectOption",
593
- "props": {
594
- "selectProps": {
595
- "description": "",
596
- "type": {
597
- "name": "shape",
598
- "value": {
599
- "optionFill": {
600
- "name": "string",
601
- "required": false
602
- },
603
- "optionTextSize": {
604
- "name": "string",
605
- "required": false
606
- },
607
- "optionTextColor": {
608
- "name": "string",
609
- "required": false
610
- },
611
- "optionShape": {
612
- "name": "string",
613
- "required": false
614
- },
615
- "optionBefore": {
616
- "name": "any",
617
- "required": false
618
- },
619
- "optionAfter": {
620
- "name": "any",
621
- "required": false
622
- }
623
- }
624
- },
625
- "required": false
626
- },
627
- "label": {
628
- "description": "",
629
- "type": {
630
- "name": "string"
631
- },
632
- "required": false
633
- },
634
- "isSelected": {
635
- "description": "",
636
- "type": {
637
- "name": "any"
638
- },
639
- "required": false
640
- }
641
- }
110
+ var SelectOption = function (props) {
111
+ var isSelected = props.isSelected, label = props.label;
112
+ var _a = props.selectProps, dividerDirection = _a.dividerDirection, dividerFill = _a.dividerFill, dividerSize = _a.dividerSize, menuItemSize = _a.menuItemSize, optionAfter = _a.optionAfter, optionBefore = _a.optionBefore, optionBorder = _a.optionBorder, optionBorderType = _a.optionBorderType, optionFill = _a.optionFill, optionFillHover = _a.optionFillHover, optionSelected = _a.optionSelected, optionShape = _a.optionShape, optionTextColor = _a.optionTextColor, optionTextSize = _a.optionTextSize, showDivider = _a.showDivider;
113
+ return (jsxRuntime.jsxs(Select.components.Option, tslib_es6.__assign({}, props, { className: clsx('select__menu-list-item', isSelected && 'select__menu-list-item_state_selected', menuItemSize && "select__menu-list-item_size_".concat(menuItemSize), optionFill, optionBorder, optionBorderType, optionFillHover, optionShape), children: [optionBefore, jsxRuntime.jsx(Text.Text, { className: "select__menu-list-item_option", size: optionTextSize, textColor: optionTextColor, children: label }), isSelected && jsxRuntime.jsx("div", { className: "select__menu-list-item_selected", children: optionSelected }), optionAfter, showDivider && (jsxRuntime.jsx(Divider.Divider, { width: "fill", fill: dividerFill, direction: dividerDirection, size: dividerSize }))] })));
642
114
  };
643
115
 
644
- const SelectPlaceholder = props => {
645
- const {
646
- placeholderTextSize,
647
- placeholderTextColor
648
- } = props.selectProps;
649
- return /*#__PURE__*/React.createElement(Select.components.Placeholder, props, /*#__PURE__*/React.createElement(Text.Text, {
650
- size: placeholderTextSize,
651
- textColor: placeholderTextColor
652
- }, props.children));
653
- };
654
- SelectPlaceholder.propTypes = {
655
- selectProps: PropTypes.shape({
656
- placeholderTextSize: PropTypes.string,
657
- placeholderTextColor: PropTypes.string
658
- }),
659
- children: PropTypes.any
660
- };
661
- SelectPlaceholder.__docgenInfo = {
662
- "description": "",
663
- "methods": [],
664
- "displayName": "SelectPlaceholder",
665
- "props": {
666
- "selectProps": {
667
- "description": "",
668
- "type": {
669
- "name": "shape",
670
- "value": {
671
- "placeholderTextSize": {
672
- "name": "string",
673
- "required": false
674
- },
675
- "placeholderTextColor": {
676
- "name": "string",
677
- "required": false
678
- }
679
- }
680
- },
681
- "required": false
682
- },
683
- "children": {
684
- "description": "",
685
- "type": {
686
- "name": "any"
687
- },
688
- "required": false
689
- }
690
- }
116
+ var SelectPlaceholder = function (props) {
117
+ var _a = props.selectProps, placeholderTextColor = _a.placeholderTextColor, placeholderTextSize = _a.placeholderTextSize;
118
+ return (jsxRuntime.jsx(Select.components.Placeholder, tslib_es6.__assign({}, props, { children: jsxRuntime.jsx(Text.Text, { size: placeholderTextSize, textColor: placeholderTextColor, children: props.children }) })));
691
119
  };
692
120
 
693
- const SelectSingleValue = props => {
694
- const {
695
- data
696
- } = props;
697
- const {
698
- inputTextSize,
699
- inputTextColor
700
- } = props.selectProps;
701
- return /*#__PURE__*/React.createElement(Select.components.SingleValue, props, data.optionBefore, /*#__PURE__*/React.createElement(Text.Text, {
702
- size: inputTextSize,
703
- textColor: inputTextColor
704
- }, props.children), data.optionAfter);
705
- };
706
- SelectSingleValue.propTypes = {
707
- selectProps: PropTypes.shape({
708
- inputTextSize: PropTypes.string,
709
- inputTextColor: PropTypes.string
710
- }),
711
- children: PropTypes.any,
712
- data: PropTypes.object
713
- };
714
- SelectSingleValue.__docgenInfo = {
715
- "description": "",
716
- "methods": [],
717
- "displayName": "SelectSingleValue",
718
- "props": {
719
- "selectProps": {
720
- "description": "",
721
- "type": {
722
- "name": "shape",
723
- "value": {
724
- "inputTextSize": {
725
- "name": "string",
726
- "required": false
727
- },
728
- "inputTextColor": {
729
- "name": "string",
730
- "required": false
731
- }
732
- }
733
- },
734
- "required": false
735
- },
736
- "children": {
737
- "description": "",
738
- "type": {
739
- "name": "any"
740
- },
741
- "required": false
742
- },
743
- "data": {
744
- "description": "",
745
- "type": {
746
- "name": "object"
747
- },
748
- "required": false
749
- }
750
- }
121
+ var SelectSingleValue = function (props) {
122
+ var data = props.data;
123
+ var _a = props.selectProps, inputTextColor = _a.inputTextColor, inputTextSize = _a.inputTextSize;
124
+ return (jsxRuntime.jsxs(Select.components.SingleValue, tslib_es6.__assign({}, props, { children: [data && data.optionBefore, jsxRuntime.jsx(Text.Text, { size: inputTextSize, textColor: inputTextColor, children: props.children }), data && data.optionAfter] })));
751
125
  };
752
126
 
753
- const SelectValueContainer = props => {
754
- const {
755
- inputBefore,
756
- inputAfter
757
- } = props.selectProps;
758
- return /*#__PURE__*/React.createElement(Select.components.ValueContainer, props, inputBefore, props.children, inputAfter);
127
+ var SelectValueContainer = function (props) {
128
+ var _a = props.selectProps, inputAfter = _a.inputAfter, inputBefore = _a.inputBefore;
129
+ return (jsxRuntime.jsxs(Select.components.ValueContainer, tslib_es6.__assign({}, props, { children: [inputBefore, props.children, inputAfter] })));
759
130
  };
760
- SelectValueContainer.propTypes = {
761
- children: PropTypes.any,
762
- selectProps: PropTypes.shape({
763
- inputBefore: PropTypes.any,
764
- inputAfter: PropTypes.any
765
- })
766
- };
767
- SelectValueContainer.__docgenInfo = {
768
- "description": "",
769
- "methods": [],
770
- "displayName": "SelectValueContainer",
771
- "props": {
772
- "children": {
773
- "description": "",
774
- "type": {
775
- "name": "any"
776
- },
777
- "required": false
778
- },
779
- "selectProps": {
780
- "description": "",
781
- "type": {
782
- "name": "shape",
783
- "value": {
784
- "inputBefore": {
785
- "name": "any",
786
- "required": false
787
- },
788
- "inputAfter": {
789
- "name": "any",
790
- "required": false
791
- }
792
- }
793
- },
794
- "required": false
795
- }
796
- }
797
- };
798
-
799
- const SelectContainer = /*#__PURE__*/React.forwardRef(function SelectContainer(props, ref) {
800
- const clearStyle = React.useMemo(() => new Proxy({}, {
801
- get: (target, propKey) => () => {}
802
- }), []);
803
- const {
804
- appearance,
805
- className,
806
- after,
807
- before,
808
- badgeAppearance,
809
- badgeSize,
810
- badgeTextSize,
811
- hideSelectedOptions,
812
- menuAfter,
813
- menuBefore,
814
- clearIcon,
815
- clearIconFill,
816
- closeMenuOnSelect,
817
- showDivider,
818
- dividerDirection,
819
- dividerFill,
820
- dividerSize,
821
- dropdownFillHover,
822
- dropdownIcon,
823
- dropdownIconFill,
824
- dropdownIconShape,
825
- multipleItemIcon,
826
- multipleItemIconFill,
827
- multipleItemFill,
828
- multipleItemFillHover,
829
- hideValueContainer,
830
- filterOption,
831
- initialValue,
832
- inputAfter,
833
- inputBefore,
834
- instanceId,
835
- isClearable,
836
- isCreatable,
837
- isDisabled,
838
- isLoading,
839
- isMulti,
840
- isSearchable,
841
- loadingMessage,
842
- menuItemSize,
843
- noOptionsText,
844
- noOptionsSearchText,
845
- openMenuOnClick,
846
- options,
847
- optionBefore,
848
- optionAfter,
849
- optionSelected,
850
- elevation,
851
- placeholder,
852
- placeholderTextSize,
853
- placeholderTextColor,
854
- set,
855
- showBadge,
856
- value,
857
- onChange,
858
- onInputChange
859
- } = props;
860
- const defaultRef = React.useRef(null);
861
- const selectRef = ref || defaultRef;
862
131
 
863
- // React-select wai function as "loadingMessage" property
864
- const getLoadingMessage = React.useCallback(params => {
865
- // const { inputValue } = params
866
- return loadingMessage;
867
- }, [loadingMessage]);
868
- const borderColorClass = useDeviceTargetClass.useDeviceTargetClass(props, {
869
- prefix: 'border-color_',
870
- propsKey: 'borderColor'
871
- });
872
- const fillClass = useDeviceTargetClass.useDeviceTargetClass(props, {
873
- prefix: 'fill_',
874
- propsKey: 'fill'
875
- });
876
- const fillHoverClass = useDeviceTargetClass.useDeviceTargetClass(props, {
877
- prefix: 'fill_hover_',
878
- propsKey: 'fillHover'
879
- });
880
- const shapeClass = useDeviceTargetClass.useDeviceTargetClass(props, {
881
- prefix: 'select_shape_',
882
- propsKey: 'shape'
883
- });
884
- const sizeClass = useDeviceTargetClass.useDeviceTargetClass(props, {
885
- prefix: 'select_size_',
886
- propsKey: 'size'
887
- });
888
- const optionFillClass = useDeviceTargetClass.useDeviceTargetClass(props, {
889
- prefix: 'fill_',
890
- propsKey: 'optionFill'
891
- });
892
- const optionFillHoverClass = useDeviceTargetClass.useDeviceTargetClass(props, {
893
- prefix: 'fill_hover_',
894
- propsKey: 'optionFillHover'
895
- });
896
- const optionBorderClass = useDeviceTargetClass.useDeviceTargetClass(props, {
897
- prefix: 'border-color_',
898
- propsKey: 'optionBorder'
899
- });
900
- const optionBorderTypeClass = useDeviceTargetClass.useDeviceTargetClass(props, {
901
- prefix: 'border_type_',
902
- propsKey: 'optionBorderType'
903
- });
904
- const optionTextSizeClass = useDeviceTargetClass.useDeviceTargetClass(props, {
905
- propsKey: 'optionTextSize'
906
- });
907
- const optionTextColorClass = useDeviceTargetClass.useDeviceTargetClass(props, {
908
- propsKey: 'optionTextColor'
909
- });
910
- const optionShapeClass = useDeviceTargetClass.useDeviceTargetClass(props, {
911
- propsKey: 'optionShape'
912
- });
913
- const inputFillClass = useDeviceTargetClass.useDeviceTargetClass(props, {
914
- prefix: 'select__control_fill_',
915
- propsKey: 'inputFill'
916
- });
917
- const inputShapeClass = useDeviceTargetClass.useDeviceTargetClass(props, {
918
- prefix: 'select__control_shape_',
919
- propsKey: 'inputShape'
920
- });
921
- const inputTextSizeClass = useDeviceTargetClass.useDeviceTargetClass(props, {
922
- propsKey: 'inputTextSize'
923
- });
924
- const inputTextColorClass = useDeviceTargetClass.useDeviceTargetClass(props, {
925
- propsKey: 'inputTextColor'
926
- });
927
- const multipleItemTextSizeClass = useDeviceTargetClass.useDeviceTargetClass(props, {
928
- propsKey: 'multipleItemTextSize'
929
- });
930
- const multipleItemTextColorClass = useDeviceTargetClass.useDeviceTargetClass(props, {
931
- propsKey: 'multipleItemTextColor'
932
- });
933
- const inputBorderColorClass = useDeviceTargetClass.useDeviceTargetClass(props, {
934
- propsKey: 'inputBorderColor'
935
- });
936
- const inputBorderColorHoverClass = useDeviceTargetClass.useDeviceTargetClass(props, {
937
- propsKey: 'inputBorderColorHover'
938
- });
939
- const noOptionsTextSizeClass = useDeviceTargetClass.useDeviceTargetClass(props, {
940
- propsKey: 'noOptionsTextSize'
941
- });
942
- const noOptionsTextColorClass = useDeviceTargetClass.useDeviceTargetClass(props, {
943
- propsKey: 'noOptionsTextColor'
944
- });
945
- const inputCaretColorClass = useDeviceTargetClass.useDeviceTargetClass(props, {
946
- propsKey: 'inputCaretColor'
947
- });
948
- const headingFillClass = useDeviceTargetClass.useDeviceTargetClass(props, {
949
- prefix: 'fill_',
950
- propsKey: 'headingFill'
951
- });
952
- const headingFillHoverClass = useDeviceTargetClass.useDeviceTargetClass(props, {
953
- prefix: 'fill_hover_',
954
- propsKey: 'headingFillHover'
955
- });
956
- const headingTextSizeClass = useDeviceTargetClass.useDeviceTargetClass(props, {
957
- propsKey: 'headingTextSize'
958
- });
959
- const headingTextWeightClass = useDeviceTargetClass.useDeviceTargetClass(props, {
960
- propsKey: 'headingTextWeight'
961
- });
962
- const headingTextColorClass = useDeviceTargetClass.useDeviceTargetClass(props, {
963
- propsKey: 'headingTextColor'
964
- });
965
- const SelectComponent = React.useMemo(() => isCreatable ? CreatableSelect : Select, [isCreatable]);
966
- React.useEffect(() => {
967
- const onClickOutside = event => {
968
- const isTargetSelectContainer = event.target.hasClass && event.target.hasClass('select_state_hide-value-container');
969
- const isTargetInsideController = selectRef.current.controlRef.contains(event.target);
970
- if (!isTargetSelectContainer && !isTargetInsideController) {
971
- selectRef.current?.onInputBlur();
972
- }
973
- };
974
- if (hideValueContainer) {
975
- document.addEventListener('click', onClickOutside);
976
- }
977
- return () => {
978
- if (hideValueContainer) {
979
- document.removeEventListener('click', onClickOutside);
980
- }
981
- };
982
- }, []);
983
- const selectAppearanceItem = selectConfig.appearance[appearance] || {};
984
- return /*#__PURE__*/React.createElement(SelectComponent, {
985
- after: after,
986
- badgeAppearance: badgeAppearance,
987
- badgeSize: badgeSize,
988
- badgeTextSize: badgeTextSize,
989
- before: before,
990
- className: clsx(className, 'select', fillClass, fillHoverClass, shapeClass, borderColorClass, sizeClass || selectAppearanceItem.size && `select_size_${selectAppearanceItem.size}`.replace(/([A-Z])/g, '-$1').toLowerCase(), hideValueContainer && 'select_state_hide-value-container', set && `select_set_${set}`),
991
- classNamePrefix: "select",
992
- clearIcon: clearIcon,
993
- clearIconFill: clearIconFill,
994
- closeMenuOnSelect: closeMenuOnSelect ?? false,
995
- components: {
996
- Control: SelectControl,
997
- IndicatorsContainer: SelectIndicatorsContainer,
998
- ClearIndicator: SelectClearIndicator,
999
- DropdownIndicator: SelectDropdownIndicator,
1000
- IndicatorSeparator: () => null,
1001
- Input: SelectInput,
1002
- Menu: SelectMenu,
1003
- MultiValueContainer: SelectMultiValueContainer,
1004
- MultiValueRemove: SelectMultiValueRemove,
1005
- MultiValueLabel: SelectMultiValueLabel,
1006
- Option: SelectOption,
1007
- SingleValue: SelectSingleValue,
1008
- Placeholder: SelectPlaceholder,
1009
- ValueContainer: SelectValueContainer,
1010
- NoOptionsMessage: SelectNoOptions,
1011
- GroupHeading: SelectGroupHeading,
1012
- LoadingIndicator: SelectLoadingIndicator
1013
- },
1014
- defaultValue: initialValue,
1015
- dividerDirection: dividerDirection,
1016
- dividerFill: dividerFill,
1017
- dividerSize: dividerSize,
1018
- dropdownFillHover: dropdownFillHover,
1019
- dropdownIcon: dropdownIcon,
1020
- dropdownIconFill: dropdownIconFill,
1021
- dropdownIconShape: dropdownIconShape,
1022
- elevation: elevation || selectAppearanceItem.elevation,
1023
- filterOption: filterOption,
1024
- headingFill: headingFillClass,
1025
- headingFillHover: headingFillHoverClass,
1026
- headingTextColor: headingTextColorClass,
1027
- headingTextSize: headingTextSizeClass,
1028
- headingTextWeight: headingTextWeightClass,
1029
- hideSelectedOptions: hideSelectedOptions,
1030
- inputAfter: inputAfter,
1031
- inputBefore: inputBefore,
1032
- instanceId: instanceId,
1033
- inputBorderColor: inputBorderColorClass || selectAppearanceItem.inputBorderColor && selectAppearanceItem.inputBorderColor.replace(/([A-Z])/g, '-$1').toLowerCase(),
1034
- inputBorderColorHover: inputBorderColorHoverClass || selectAppearanceItem.inputBorderColorHover && selectAppearanceItem.inputBorderColorHover.replace(/([A-Z])/g, '-$1').toLowerCase(),
1035
- inputCaretColor: inputCaretColorClass,
1036
- inputFill: inputFillClass || selectAppearanceItem.inputFill && `select__control_fill_${selectAppearanceItem.inputFill}`.replace(/([A-Z])/g, '-$1').toLowerCase(),
1037
- inputShape: inputShapeClass || selectAppearanceItem.inputShape && `select__control_shape_${selectAppearanceItem.inputShape}`.replace(/([A-Z])/g, '-$1').toLowerCase(),
1038
- inputTextColor: inputTextColorClass || selectAppearanceItem.inputTextColor,
1039
- inputTextSize: inputTextSizeClass || selectAppearanceItem.inputTextSize,
1040
- isClearable: isClearable,
1041
- isDisabled: isDisabled,
1042
- isLoading: isLoading,
1043
- isMulti: isMulti,
1044
- isSearchable: isSearchable,
1045
- loadingMessage: getLoadingMessage,
1046
- menuAfter: menuAfter,
1047
- menuBefore: menuBefore,
1048
- menuItemSize: menuItemSize,
1049
- multipleItemFill: multipleItemFill,
1050
- multipleItemFillHover: multipleItemFillHover,
1051
- multipleItemIcon: multipleItemIcon,
1052
- multipleItemIconFill: multipleItemIconFill,
1053
- multipleItemTextColor: multipleItemTextColorClass,
1054
- multipleItemTextSize: multipleItemTextSizeClass,
1055
- noOptionBorder: optionBorderClass,
1056
- noOptionBorderType: optionBorderTypeClass,
1057
- noOptionsFill: optionFillClass,
1058
- noOptionsSearchText: noOptionsSearchText,
1059
- noOptionsText: noOptionsText || selectAppearanceItem.noOptionsText,
1060
- noOptionsTextColor: noOptionsTextColorClass || selectAppearanceItem.noOptionsTextColor,
1061
- noOptionsTextSize: noOptionsTextSizeClass || selectAppearanceItem.noOptionsTextSize,
1062
- openMenuOnClick: openMenuOnClick,
1063
- optionAfter: optionAfter,
1064
- optionBefore: optionBefore,
1065
- optionBorder: optionBorderClass,
1066
- optionBorderType: optionBorderTypeClass,
1067
- optionFill: optionFillClass || selectAppearanceItem.optionFill && `fill_${selectAppearanceItem.optionFill}`.replace(/([A-Z])/g, '-$1').toLowerCase(),
1068
- optionFillHover: optionFillHoverClass || selectAppearanceItem.optionFillHover && `fill_hover_${selectAppearanceItem.optionFillHover}`.replace(/([A-Z])/g, '-$1').toLowerCase(),
1069
- options: options,
1070
- optionSelected: optionSelected,
1071
- optionShape: optionShapeClass,
1072
- optionTextColor: optionTextColorClass || selectAppearanceItem.optionTextColor,
1073
- optionTextSize: optionTextSizeClass || selectAppearanceItem.optionTextSize,
1074
- placeholder: placeholder || selectAppearanceItem.placeholder,
1075
- placeholderTextColor: placeholderTextColor || selectAppearanceItem.placeholderTextColor,
1076
- placeholderTextSize: placeholderTextSize || selectAppearanceItem.placeholderTextSize,
1077
- ref: selectRef,
1078
- set: set,
1079
- showBadge: showBadge,
1080
- showDivider: showDivider,
1081
- styles: clearStyle,
1082
- value: value,
1083
- onChange: onChange,
1084
- onInputChange: onInputChange
1085
- });
132
+ var SelectContainer = React.forwardRef(function SelectContainer(props, ref) {
133
+ // const clearStyle = useMemo(() => new Proxy({}, { get: (target, propKey) => () => {} }), [])
134
+ var clearStyle = React.useMemo(function () { return new Proxy({}, { get: function () { return function () { }; } }); }, []);
135
+ var elevation = props.elevation, isClearable = props.isClearable, isCreatable = props.isCreatable, isDisabled = props.isDisabled, isLoading = props.isLoading, isMulti = props.isMulti, isSearchable = props.isSearchable, after = props.after, appearance = props.appearance, badgeAppearance = props.badgeAppearance, badgeSize = props.badgeSize, badgeTextSize = props.badgeTextSize, before = props.before, className = props.className, clearIcon = props.clearIcon, clearIconFill = props.clearIconFill, closeMenuOnSelect = props.closeMenuOnSelect, defaultValue = props.defaultValue, dividerDirection = props.dividerDirection, dividerFill = props.dividerFill, dividerSize = props.dividerSize, dropdownFillHover = props.dropdownFillHover, dropdownIcon = props.dropdownIcon, dropdownIconFill = props.dropdownIconFill, dropdownIconShape = props.dropdownIconShape, filterOption = props.filterOption, hideSelectedOptions = props.hideSelectedOptions, hideValueContainer = props.hideValueContainer,
136
+ // @ts-expect-error // because there is a defaultValue
137
+ initialValue = props.initialValue, inputAfter = props.inputAfter, inputBefore = props.inputBefore, instanceId = props.instanceId, loadingMessage = props.loadingMessage, menuAfter = props.menuAfter, menuBefore = props.menuBefore, menuItemSize = props.menuItemSize, multipleItemFill = props.multipleItemFill, multipleItemFillHover = props.multipleItemFillHover, multipleItemIcon = props.multipleItemIcon, multipleItemIconFill = props.multipleItemIconFill, noOptionsSearchText = props.noOptionsSearchText, noOptionsText = props.noOptionsText, openMenuOnClick = props.openMenuOnClick, optionAfter = props.optionAfter, optionBefore = props.optionBefore, options = props.options, optionSelected = props.optionSelected, placeholder = props.placeholder, placeholderTextColor = props.placeholderTextColor, placeholderTextSize = props.placeholderTextSize, set = props.set, showBadge = props.showBadge, showDivider = props.showDivider, value = props.value, onChange = props.onChange, onInputChange = props.onInputChange;
138
+ var defaultRef = React.useRef(null);
139
+ var selectRef = ref || defaultRef;
140
+ // React-select wai function as "loadingMessage" property
141
+ // (params: { inputValue: string }) => {
142
+ var getLoadingMessage = React.useCallback(function () {
143
+ // const { inputValue } = params
144
+ return loadingMessage;
145
+ }, [loadingMessage]);
146
+ var borderColorClass = useDeviceTargetClass.useDeviceTargetClass(props, {
147
+ prefix: 'border-color_',
148
+ propsKey: 'borderColor',
149
+ });
150
+ var fillClass = useDeviceTargetClass.useDeviceTargetClass(props, {
151
+ prefix: 'fill_',
152
+ propsKey: 'fill',
153
+ });
154
+ var fillHoverClass = useDeviceTargetClass.useDeviceTargetClass(props, {
155
+ prefix: 'fill_hover_',
156
+ propsKey: 'fillHover',
157
+ });
158
+ var shapeClass = useDeviceTargetClass.useDeviceTargetClass(props, {
159
+ prefix: 'select_shape_',
160
+ propsKey: 'shape',
161
+ });
162
+ var sizeClass = useDeviceTargetClass.useDeviceTargetClass(props, {
163
+ prefix: 'select_size_',
164
+ propsKey: 'size',
165
+ });
166
+ var optionFillClass = useDeviceTargetClass.useDeviceTargetClass(props, {
167
+ prefix: 'fill_',
168
+ propsKey: 'optionFill',
169
+ });
170
+ var optionFillHoverClass = useDeviceTargetClass.useDeviceTargetClass(props, {
171
+ prefix: 'fill_hover_',
172
+ propsKey: 'optionFillHover',
173
+ });
174
+ var optionBorderClass = useDeviceTargetClass.useDeviceTargetClass(props, {
175
+ prefix: 'border-color_',
176
+ propsKey: 'optionBorder',
177
+ });
178
+ var optionBorderTypeClass = useDeviceTargetClass.useDeviceTargetClass(props, {
179
+ prefix: 'border_type_',
180
+ propsKey: 'optionBorderType',
181
+ });
182
+ var optionTextSizeClass = useDeviceTargetClass.useDeviceTargetClass(props, {
183
+ propsKey: 'optionTextSize',
184
+ });
185
+ var optionTextColorClass = useDeviceTargetClass.useDeviceTargetClass(props, {
186
+ propsKey: 'optionTextColor',
187
+ });
188
+ var optionShapeClass = useDeviceTargetClass.useDeviceTargetClass(props, {
189
+ propsKey: 'optionShape',
190
+ });
191
+ var inputFillClass = useDeviceTargetClass.useDeviceTargetClass(props, {
192
+ prefix: 'select__control_fill_',
193
+ propsKey: 'inputFill',
194
+ });
195
+ var inputShapeClass = useDeviceTargetClass.useDeviceTargetClass(props, {
196
+ prefix: 'select__control_shape_',
197
+ propsKey: 'inputShape',
198
+ });
199
+ var inputTextSizeClass = useDeviceTargetClass.useDeviceTargetClass(props, {
200
+ propsKey: 'inputTextSize',
201
+ });
202
+ var inputTextColorClass = useDeviceTargetClass.useDeviceTargetClass(props, {
203
+ propsKey: 'inputTextColor',
204
+ });
205
+ var multipleItemTextSizeClass = useDeviceTargetClass.useDeviceTargetClass(props, {
206
+ propsKey: 'multipleItemTextSize',
207
+ });
208
+ var multipleItemTextColorClass = useDeviceTargetClass.useDeviceTargetClass(props, {
209
+ propsKey: 'multipleItemTextColor',
210
+ });
211
+ var inputBorderColorClass = useDeviceTargetClass.useDeviceTargetClass(props, {
212
+ propsKey: 'inputBorderColor',
213
+ });
214
+ var inputBorderColorHoverClass = useDeviceTargetClass.useDeviceTargetClass(props, {
215
+ propsKey: 'inputBorderColorHover',
216
+ });
217
+ var noOptionsTextSizeClass = useDeviceTargetClass.useDeviceTargetClass(props, {
218
+ propsKey: 'noOptionsTextSize',
219
+ });
220
+ var noOptionsTextColorClass = useDeviceTargetClass.useDeviceTargetClass(props, {
221
+ propsKey: 'noOptionsTextColor',
222
+ });
223
+ var inputCaretColorClass = useDeviceTargetClass.useDeviceTargetClass(props, {
224
+ propsKey: 'inputCaretColor',
225
+ });
226
+ var headingFillClass = useDeviceTargetClass.useDeviceTargetClass(props, {
227
+ prefix: 'fill_',
228
+ propsKey: 'headingFill',
229
+ });
230
+ var headingFillHoverClass = useDeviceTargetClass.useDeviceTargetClass(props, {
231
+ prefix: 'fill_hover_',
232
+ propsKey: 'headingFillHover',
233
+ });
234
+ var headingTextSizeClass = useDeviceTargetClass.useDeviceTargetClass(props, {
235
+ propsKey: 'headingTextSize',
236
+ });
237
+ var headingTextWeightClass = useDeviceTargetClass.useDeviceTargetClass(props, {
238
+ propsKey: 'headingTextWeight',
239
+ });
240
+ var headingTextColorClass = useDeviceTargetClass.useDeviceTargetClass(props, {
241
+ propsKey: 'headingTextColor',
242
+ });
243
+ var SelectComponent = React.useMemo(function () { return (isCreatable ? CreatableSelect : Select); }, [isCreatable]);
244
+ React.useEffect(function () {
245
+ // @ts-expect-error
246
+ var onClickOutside = function (event) {
247
+ var _a;
248
+ var isTargetSelectContainer =
249
+ // maybe here ".contains()"?
250
+ event.target.hasClass && event.target.hasClass('select_state_hide-value-container');
251
+ var isTargetInsideController = selectRef.current.controlRef.contains(event.target);
252
+ if (!isTargetSelectContainer && !isTargetInsideController) {
253
+ (_a = selectRef.current) === null || _a === void 0 ? void 0 : _a.onInputBlur();
254
+ }
255
+ };
256
+ if (hideValueContainer) {
257
+ document.addEventListener('click', onClickOutside);
258
+ }
259
+ return function () {
260
+ if (hideValueContainer) {
261
+ document.removeEventListener('click', onClickOutside);
262
+ }
263
+ };
264
+ }, []);
265
+ var selectAppearanceItem = (appearance && selectConfig.appearance && selectConfig.appearance[appearance]) || {};
266
+ return (jsxRuntime.jsx(SelectComponent, { className: clsx(className, 'select', fillClass, fillHoverClass, shapeClass, borderColorClass, sizeClass ||
267
+ (selectAppearanceItem.size &&
268
+ "select_size_".concat(selectAppearanceItem.size).replace(/([A-Z])/g, '-$1').toLowerCase()), hideValueContainer && 'select_state_hide-value-container', set && "select_set_".concat(set)), ref: selectRef, after: after, badgeAppearance: badgeAppearance, badgeSize: badgeSize, badgeTextSize: badgeTextSize, before: before, classNamePrefix: "select", clearIcon: clearIcon, clearIconFill: clearIconFill, closeMenuOnSelect: closeMenuOnSelect !== null && closeMenuOnSelect !== void 0 ? closeMenuOnSelect : false, defaultValue: defaultValue || initialValue, dividerDirection: dividerDirection, dividerFill: dividerFill, dividerSize: dividerSize, dropdownFillHover: dropdownFillHover, dropdownIcon: dropdownIcon, dropdownIconFill: dropdownIconFill, dropdownIconShape: dropdownIconShape, elevation: elevation || selectAppearanceItem.elevation, filterOption: filterOption, headingFill: headingFillClass, headingFillHover: headingFillHoverClass, headingTextColor: headingTextColorClass, headingTextSize: headingTextSizeClass, headingTextWeight: headingTextWeightClass, hideSelectedOptions: hideSelectedOptions, inputAfter: inputAfter, inputBefore: inputBefore, inputCaretColor: inputCaretColorClass, inputTextColor: inputTextColorClass || selectAppearanceItem.inputTextColor, inputTextSize: inputTextSizeClass || selectAppearanceItem.inputTextSize, instanceId: instanceId,
269
+ // @ts-expect-error
270
+ loadingMessage: getLoadingMessage, menuAfter: menuAfter, menuBefore: menuBefore, menuItemSize: menuItemSize, multipleItemFill: multipleItemFill, multipleItemFillHover: multipleItemFillHover, multipleItemIcon: multipleItemIcon, multipleItemIconFill: multipleItemIconFill, multipleItemTextColor: multipleItemTextColorClass, multipleItemTextSize: multipleItemTextSizeClass, noOptionBorder: optionBorderClass, noOptionBorderType: optionBorderTypeClass, noOptionsFill: optionFillClass, noOptionsSearchText: noOptionsSearchText, noOptionsText: noOptionsText || selectAppearanceItem.noOptionsText, noOptionsTextColor: noOptionsTextColorClass || selectAppearanceItem.noOptionsTextColor, noOptionsTextSize: noOptionsTextSizeClass || selectAppearanceItem.noOptionsTextSize, openMenuOnClick: openMenuOnClick, optionAfter: optionAfter, optionBefore: optionBefore, optionBorder: optionBorderClass, optionBorderType: optionBorderTypeClass, options: options, optionSelected: optionSelected, optionShape: optionShapeClass, optionTextColor: optionTextColorClass || selectAppearanceItem.optionTextColor, optionTextSize: optionTextSizeClass || selectAppearanceItem.optionTextSize, placeholder: placeholder || selectAppearanceItem.placeholder, placeholderTextColor: placeholderTextColor || selectAppearanceItem.placeholderTextColor, placeholderTextSize: placeholderTextSize || selectAppearanceItem.placeholderTextSize, showBadge: showBadge, showDivider: showDivider, styles: clearStyle, value: value, components: {
271
+ ClearIndicator: SelectClearIndicator,
272
+ Control: SelectControl,
273
+ DropdownIndicator: SelectDropdownIndicator,
274
+ GroupHeading: SelectGroupHeading,
275
+ IndicatorsContainer: SelectIndicatorsContainer,
276
+ IndicatorSeparator: function () { return null; },
277
+ Input: SelectInput,
278
+ LoadingIndicator: SelectLoadingIndicator,
279
+ Menu: SelectMenu,
280
+ MultiValueContainer: SelectMultiValueContainer,
281
+ MultiValueLabel: SelectMultiValueLabel,
282
+ MultiValueRemove: SelectMultiValueRemove,
283
+ NoOptionsMessage: SelectNoOptions,
284
+ Option: SelectOption,
285
+ Placeholder: SelectPlaceholder,
286
+ SingleValue: SelectSingleValue,
287
+ ValueContainer: SelectValueContainer,
288
+ }, inputBorderColor: inputBorderColorClass ||
289
+ (selectAppearanceItem.inputBorderColor &&
290
+ selectAppearanceItem.inputBorderColor.replace(/([A-Z])/g, '-$1').toLowerCase()), inputBorderColorHover: inputBorderColorHoverClass ||
291
+ (selectAppearanceItem.inputBorderColorHover &&
292
+ selectAppearanceItem.inputBorderColorHover.replace(/([A-Z])/g, '-$1').toLowerCase()), inputFill: inputFillClass ||
293
+ (selectAppearanceItem.inputFill &&
294
+ "select__control_fill_".concat(selectAppearanceItem.inputFill)
295
+ .replace(/([A-Z])/g, '-$1')
296
+ .toLowerCase()), inputShape: inputShapeClass ||
297
+ (selectAppearanceItem.inputShape &&
298
+ "select__control_shape_".concat(selectAppearanceItem.inputShape)
299
+ .replace(/([A-Z])/g, '-$1')
300
+ .toLowerCase()), optionFill: optionFillClass ||
301
+ (selectAppearanceItem.optionFill &&
302
+ "fill_".concat(selectAppearanceItem.optionFill).replace(/([A-Z])/g, '-$1').toLowerCase()), optionFillHover: optionFillHoverClass ||
303
+ (selectAppearanceItem.optionFillHover &&
304
+ "fill_hover_".concat(selectAppearanceItem.optionFillHover)
305
+ .replace(/([A-Z])/g, '-$1')
306
+ .toLowerCase()), isClearable: isClearable, isDisabled: isDisabled, isLoading: isLoading, isMulti: isMulti, isSearchable: isSearchable, set: set, onChange: onChange, onInputChange: onInputChange }));
1086
307
  });
1087
- SelectContainer.propTypes = {
1088
- className: PropTypes.string,
1089
- // "clearIcon" is SvgImage(file.svg)
1090
- clearIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.element]),
1091
- clearIconFill: PropTypes.string,
1092
- closeMenuOnSelect: PropTypes.bool,
1093
- // "dropdownIcon" is SvgImage(file.svg)
1094
- dropdownFillHover: PropTypes.string,
1095
- dropdownIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.element]),
1096
- dropdownIconFill: PropTypes.string,
1097
- dropdownIconShape: PropTypes.string,
1098
- filterOption: PropTypes.func,
1099
- initialValue: PropTypes.any,
1100
- inputAfter: PropTypes.any,
1101
- inputBefore: PropTypes.any,
1102
- isClearable: PropTypes.bool,
1103
- isSearchable: PropTypes.bool,
1104
- noOptionsText: PropTypes.string,
1105
- openMenuOnClick: PropTypes.func,
1106
- options: PropTypes.arrayOf(PropTypes.object),
1107
- set: PropTypes.string,
1108
- onChange: PropTypes.func
1109
- };
1110
308
  SelectContainer.defaultProps = {
1111
- animationOpen: 'select_animation_open',
1112
- animationClose: 'select_animation_close'
1113
- };
1114
- SelectContainer.__docgenInfo = {
1115
- "description": "",
1116
- "methods": [],
1117
- "displayName": "SelectContainer",
1118
- "props": {
1119
- "animationOpen": {
1120
- "defaultValue": {
1121
- "value": "'select_animation_open'",
1122
- "computed": false
1123
- },
1124
- "required": false
1125
- },
1126
- "animationClose": {
1127
- "defaultValue": {
1128
- "value": "'select_animation_close'",
1129
- "computed": false
1130
- },
1131
- "required": false
1132
- },
1133
- "className": {
1134
- "description": "",
1135
- "type": {
1136
- "name": "string"
1137
- },
1138
- "required": false
1139
- },
1140
- "clearIcon": {
1141
- "description": "",
1142
- "type": {
1143
- "name": "union",
1144
- "value": [{
1145
- "name": "func"
1146
- }, {
1147
- "name": "element"
1148
- }]
1149
- },
1150
- "required": false
1151
- },
1152
- "clearIconFill": {
1153
- "description": "",
1154
- "type": {
1155
- "name": "string"
1156
- },
1157
- "required": false
1158
- },
1159
- "closeMenuOnSelect": {
1160
- "description": "",
1161
- "type": {
1162
- "name": "bool"
1163
- },
1164
- "required": false
1165
- },
1166
- "dropdownFillHover": {
1167
- "description": "",
1168
- "type": {
1169
- "name": "string"
1170
- },
1171
- "required": false
1172
- },
1173
- "dropdownIcon": {
1174
- "description": "",
1175
- "type": {
1176
- "name": "union",
1177
- "value": [{
1178
- "name": "func"
1179
- }, {
1180
- "name": "element"
1181
- }]
1182
- },
1183
- "required": false
1184
- },
1185
- "dropdownIconFill": {
1186
- "description": "",
1187
- "type": {
1188
- "name": "string"
1189
- },
1190
- "required": false
1191
- },
1192
- "dropdownIconShape": {
1193
- "description": "",
1194
- "type": {
1195
- "name": "string"
1196
- },
1197
- "required": false
1198
- },
1199
- "filterOption": {
1200
- "description": "",
1201
- "type": {
1202
- "name": "func"
1203
- },
1204
- "required": false
1205
- },
1206
- "initialValue": {
1207
- "description": "",
1208
- "type": {
1209
- "name": "any"
1210
- },
1211
- "required": false
1212
- },
1213
- "inputAfter": {
1214
- "description": "",
1215
- "type": {
1216
- "name": "any"
1217
- },
1218
- "required": false
1219
- },
1220
- "inputBefore": {
1221
- "description": "",
1222
- "type": {
1223
- "name": "any"
1224
- },
1225
- "required": false
1226
- },
1227
- "isClearable": {
1228
- "description": "",
1229
- "type": {
1230
- "name": "bool"
1231
- },
1232
- "required": false
1233
- },
1234
- "isSearchable": {
1235
- "description": "",
1236
- "type": {
1237
- "name": "bool"
1238
- },
1239
- "required": false
1240
- },
1241
- "noOptionsText": {
1242
- "description": "",
1243
- "type": {
1244
- "name": "string"
1245
- },
1246
- "required": false
1247
- },
1248
- "openMenuOnClick": {
1249
- "description": "",
1250
- "type": {
1251
- "name": "func"
1252
- },
1253
- "required": false
1254
- },
1255
- "options": {
1256
- "description": "",
1257
- "type": {
1258
- "name": "arrayOf",
1259
- "value": {
1260
- "name": "object"
1261
- }
1262
- },
1263
- "required": false
1264
- },
1265
- "set": {
1266
- "description": "",
1267
- "type": {
1268
- "name": "string"
1269
- },
1270
- "required": false
1271
- },
1272
- "onChange": {
1273
- "description": "",
1274
- "type": {
1275
- "name": "func"
1276
- },
1277
- "required": false
1278
- }
1279
- }
309
+ // @ts-expect-error
310
+ animationClose: 'select_animation_close',
311
+ animationOpen: 'select_animation_open',
1280
312
  };
1281
313
 
1282
- const selectConfig = {
1283
- appearance: {},
1284
- setAppearance: newComponent => {
1285
- selectConfig.appearance = newComponent;
1286
- }
314
+ var selectConfig = {
315
+ appearance: {},
316
+ setAppearance: function (newComponent) {
317
+ selectConfig.appearance = newComponent;
318
+ },
1287
319
  };
1288
320
 
1289
321
  exports.Select = SelectContainer;