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