@ultraviolet/ui 1.0.0

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 (115) hide show
  1. package/LICENSE +189 -0
  2. package/README.md +64 -0
  3. package/dist/index.d.ts +2427 -0
  4. package/dist/react-datepicker/dist/react-datepicker.min.css.js +3 -0
  5. package/dist/react-toastify/dist/ReactToastify.min.css.js +3 -0
  6. package/dist/src/components/ActionBar/index.js +55 -0
  7. package/dist/src/components/Alert/index.js +144 -0
  8. package/dist/src/components/Avatar/index.js +90 -0
  9. package/dist/src/components/Badge/index.js +143 -0
  10. package/dist/src/components/Banner/index.js +117 -0
  11. package/dist/src/components/BarChart/Tooltip.js +63 -0
  12. package/dist/src/components/BarChart/index.js +94 -0
  13. package/dist/src/components/BarStack/index.js +223 -0
  14. package/dist/src/components/Breadcrumbs/index.js +89 -0
  15. package/dist/src/components/Bullet/index.js +137 -0
  16. package/dist/src/components/Button/index.js +303 -0
  17. package/dist/src/components/Card/index.js +81 -0
  18. package/dist/src/components/Carousel/index.js +162 -0
  19. package/dist/src/components/Checkbox/index.js +338 -0
  20. package/dist/src/components/CopyButton/index.js +92 -0
  21. package/dist/src/components/DateInput/index.js +250 -0
  22. package/dist/src/components/EmptyState/index.js +124 -0
  23. package/dist/src/components/Expandable/index.js +84 -0
  24. package/dist/src/components/Icon/index.js +350 -0
  25. package/dist/src/components/LineChart/CustomLegend.js +147 -0
  26. package/dist/src/components/LineChart/Tooltip.js +58 -0
  27. package/dist/src/components/LineChart/helpers.js +75 -0
  28. package/dist/src/components/LineChart/index.js +139 -0
  29. package/dist/src/components/Link/index.js +159 -0
  30. package/dist/src/components/List/Body.js +22 -0
  31. package/dist/src/components/List/Cell.js +38 -0
  32. package/dist/src/components/List/HeaderCell.js +118 -0
  33. package/dist/src/components/List/HeaderRow.js +47 -0
  34. package/dist/src/components/List/ListContext.js +120 -0
  35. package/dist/src/components/List/Row.js +211 -0
  36. package/dist/src/components/List/SelectBar.js +52 -0
  37. package/dist/src/components/List/SkeletonRows.js +54 -0
  38. package/dist/src/components/List/constants.js +3 -0
  39. package/dist/src/components/List/index.js +77 -0
  40. package/dist/src/components/Loader/index.js +87 -0
  41. package/dist/src/components/Menu/Item.js +122 -0
  42. package/dist/src/components/Menu/index.js +143 -0
  43. package/dist/src/components/Modal/index.js +279 -0
  44. package/dist/src/components/Notice/index.js +33 -0
  45. package/dist/src/components/NumberInput/helpers.js +6 -0
  46. package/dist/src/components/NumberInput/index.js +366 -0
  47. package/dist/src/components/Pagination/getPageNumbers.js +32 -0
  48. package/dist/src/components/Pagination/index.js +118 -0
  49. package/dist/src/components/PasswordCheck/index.js +42 -0
  50. package/dist/src/components/PasswordStrengthMeter/index.js +116 -0
  51. package/dist/src/components/PieChart/Legends.js +183 -0
  52. package/dist/src/components/PieChart/Tooltip.js +64 -0
  53. package/dist/src/components/PieChart/index.js +133 -0
  54. package/dist/src/components/PieChart/patterns.js +9 -0
  55. package/dist/src/components/Popover/index.js +131 -0
  56. package/dist/src/components/ProgressBar/index.js +72 -0
  57. package/dist/src/components/Radio/index.js +231 -0
  58. package/dist/src/components/Row/index.js +43 -0
  59. package/dist/src/components/SelectInput/index.js +662 -0
  60. package/dist/src/components/SelectableCard/index.js +154 -0
  61. package/dist/src/components/Separator/index.js +91 -0
  62. package/dist/src/components/Skeleton/Block.js +53 -0
  63. package/dist/src/components/Skeleton/Blocks.js +52 -0
  64. package/dist/src/components/Skeleton/BoxWithIcon.js +47 -0
  65. package/dist/src/components/Skeleton/Donut.js +58 -0
  66. package/dist/src/components/Skeleton/IconSkeleton.js +37 -0
  67. package/dist/src/components/Skeleton/Line.js +19 -0
  68. package/dist/src/components/Skeleton/List.js +60 -0
  69. package/dist/src/components/Skeleton/Slider.js +57 -0
  70. package/dist/src/components/Skeleton/index.js +85 -0
  71. package/dist/src/components/Snippet/index.js +250 -0
  72. package/dist/src/components/Stack/index.js +24 -0
  73. package/dist/src/components/Status/index.js +101 -0
  74. package/dist/src/components/StepList/index.js +81 -0
  75. package/dist/src/components/Stepper/index.js +217 -0
  76. package/dist/src/components/SwitchButton/FocusOverlay.js +47 -0
  77. package/dist/src/components/SwitchButton/index.js +131 -0
  78. package/dist/src/components/Table/Body.js +12 -0
  79. package/dist/src/components/Table/Cell.js +27 -0
  80. package/dist/src/components/Table/Header.js +21 -0
  81. package/dist/src/components/Table/HeaderCell.js +119 -0
  82. package/dist/src/components/Table/HeaderRow.js +35 -0
  83. package/dist/src/components/Table/Row.js +70 -0
  84. package/dist/src/components/Table/SelectBar.js +52 -0
  85. package/dist/src/components/Table/SkeletonRows.js +52 -0
  86. package/dist/src/components/Table/TableContext.js +91 -0
  87. package/dist/src/components/Table/index.js +84 -0
  88. package/dist/src/components/Tabs/Tab.js +165 -0
  89. package/dist/src/components/Tabs/TabMenu.js +46 -0
  90. package/dist/src/components/Tabs/TabMenuItem.js +40 -0
  91. package/dist/src/components/Tabs/TabsContext.js +6 -0
  92. package/dist/src/components/Tabs/index.js +117 -0
  93. package/dist/src/components/Tag/index.js +177 -0
  94. package/dist/src/components/TagInput/index.js +277 -0
  95. package/dist/src/components/TagList/index.js +110 -0
  96. package/dist/src/components/Text/index.js +106 -0
  97. package/dist/src/components/TextInput/index.js +529 -0
  98. package/dist/src/components/TimeInput/index.js +38 -0
  99. package/dist/src/components/Toaster/index.js +116 -0
  100. package/dist/src/components/Toggle/index.js +192 -0
  101. package/dist/src/components/Tooltip/helpers.js +131 -0
  102. package/dist/src/components/Tooltip/index.js +275 -0
  103. package/dist/src/components/VerificationCode/index.js +203 -0
  104. package/dist/src/helpers/isJSON.js +11 -0
  105. package/dist/src/helpers/legend.js +13 -0
  106. package/dist/src/helpers/recursivelyGetChildrenString.js +12 -0
  107. package/dist/src/index.js +63 -0
  108. package/dist/src/theme/index.js +25 -0
  109. package/dist/src/utils/animations.js +250 -0
  110. package/dist/src/utils/capitalize.js +4 -0
  111. package/dist/src/utils/ids.js +12 -0
  112. package/dist/src/utils/normalize.js +36 -0
  113. package/dist/src/utils/responsive/Breakpoint.js +12 -0
  114. package/dist/src/utils/responsive/utilities.js +12 -0
  115. package/package.json +70 -0
@@ -0,0 +1,662 @@
1
+ import _styled from '@emotion/styled/base';
2
+ import { useTheme, css } from '@emotion/react';
3
+ import { forwardRef, useState, useId, useMemo, useEffect } from 'react';
4
+ import flattenChildren from 'react-flatten-children';
5
+ import Select, { components } from 'react-select';
6
+ import isJSONString from '../../helpers/isJSON.js';
7
+ import * as animations from '../../utils/animations.js';
8
+ import { Expandable } from '../Expandable/index.js';
9
+ import { Icon } from '../Icon/index.js';
10
+ import { Separator } from '../Separator/index.js';
11
+ import { Stack } from '../Stack/index.js';
12
+ import { Text } from '../Text/index.js';
13
+ import { jsx, jsxs, Fragment } from '@emotion/react/jsx-runtime';
14
+
15
+ const StyledSeparator = /*#__PURE__*/_styled(Separator, {
16
+ target: "e11gt5pw5"
17
+ })("background-color:", _ref => {
18
+ let {
19
+ theme
20
+ } = _ref;
21
+ return theme.colors.neutral.borderWeak;
22
+ }, ";height:100%;");
23
+ const getControlColor = _ref2 => {
24
+ let {
25
+ state,
26
+ error,
27
+ theme
28
+ } = _ref2;
29
+ if (state.isDisabled) return theme.colors.neutral.textDisabled;
30
+ if (error) return theme.colors.danger.text;
31
+ return theme.colors.neutral.text;
32
+ };
33
+ const getPlaceholderColor = _ref3 => {
34
+ let {
35
+ state,
36
+ error,
37
+ theme
38
+ } = _ref3;
39
+ if (state.isDisabled) return theme.colors.neutral.textDisabled;
40
+ if (error) return theme.colors.danger.textWeak;
41
+ return theme.colors.neutral.textWeak;
42
+ };
43
+ const getOptionColor = _ref4 => {
44
+ let {
45
+ state,
46
+ theme
47
+ } = _ref4;
48
+ let color = theme.colors.neutral.text;
49
+ let backgroundColor = theme.colors.neutral.backgroundWeakElevated;
50
+ if (state.isDisabled) {
51
+ backgroundColor = theme.colors.neutral.backgroundDisabled;
52
+ color = theme.colors.neutral.textDisabled;
53
+ } else if (state.isSelected) {
54
+ backgroundColor = theme.colors.primary.backgroundStrong;
55
+ color = theme.colors.primary.textStrong;
56
+ } else if (state.isFocused) {
57
+ backgroundColor = theme.colors.primary.background;
58
+ }
59
+ return {
60
+ backgroundColor,
61
+ color
62
+ };
63
+ };
64
+ const getSelectStyles = _ref5 => {
65
+ let {
66
+ error,
67
+ customStyle,
68
+ animation,
69
+ animationDuration,
70
+ noTopLabel,
71
+ theme
72
+ } = _ref5;
73
+ return {
74
+ control: (provided, state) => ({
75
+ ...provided,
76
+ backgroundColor: state.isDisabled ? theme.colors.neutral.backgroundDisabled : theme.colors.neutral.backgroundWeak,
77
+ borderColor: error ? theme.colors.danger.border : theme.colors.neutral.borderWeak,
78
+ borderRadius: '4px',
79
+ borderStyle: 'solid',
80
+ borderWidth: '1px',
81
+ boxShadow: 'none',
82
+ color: getControlColor({
83
+ error,
84
+ state,
85
+ theme
86
+ }),
87
+ fontSize: '16px',
88
+ fontWeight: 500,
89
+ lineHeight: '24px',
90
+ minHeight: '48px',
91
+ transition: 'border-color 200ms ease, box-shadow 200ms ease',
92
+ cursor: state.isDisabled ? 'not-allowed' : 'pointer',
93
+ ...(!state.isDisabled && {
94
+ ':focus-within': {
95
+ borderColor: error ? theme.colors.danger.border : theme.colors.primary.border,
96
+ boxShadow: error ? theme.shadows.focusDanger : theme.shadows.focusPrimary,
97
+ svg: {
98
+ fill: error ? theme.colors.danger.text : theme.colors.primary.text
99
+ }
100
+ },
101
+ ':hover': {
102
+ borderColor: error ? theme.colors.danger.borderHover : theme.colors.primary.borderHover,
103
+ svg: {
104
+ fill: error ? theme.colors.danger.text : theme.colors.primary.text
105
+ }
106
+ }
107
+ }),
108
+ ...(customStyle(state)?.['control'] || {}),
109
+ animation: animation ? `${animationDuration}ms ${animations[animation]}` : 'none'
110
+ }),
111
+ indicatorsContainer: provided => ({
112
+ ...provided,
113
+ maxHeight: '48px'
114
+ }),
115
+ indicatorSeparator: (provided, state) => ({
116
+ ...provided,
117
+ backgroundColor: theme.colors.neutral.borderWeak,
118
+ display: 'none',
119
+ ...(customStyle(state)?.['indicatorSeparator'] || {})
120
+ }),
121
+ input: provided => ({
122
+ ...provided,
123
+ flexGrow: 1,
124
+ marginLeft: 0,
125
+ paddingTop: noTopLabel ? 0 : 11
126
+ }),
127
+ menu: (provided, state) => ({
128
+ ...provided,
129
+ ...(customStyle(state)?.['menu'] || {}),
130
+ boxShadow: theme.shadows.menu
131
+ }),
132
+ menuList: (provided, state) => ({
133
+ ...provided,
134
+ backgroundColor: theme.colors.neutral.backgroundWeak,
135
+ maxHeight: '225px',
136
+ ...(customStyle(state)?.['menuList'] || {})
137
+ }),
138
+ menuPortal: (provided, state) => ({
139
+ ...provided,
140
+ zIndex: 10000,
141
+ ...(customStyle(state)?.['menuPortal'] || {})
142
+ }),
143
+ multiValue: (provided, state) => ({
144
+ ...provided,
145
+ alignItems: 'center',
146
+ backgroundColor: theme.colors.neutral.backgroundDisabled,
147
+ borderRadius: '4px',
148
+ color: theme.colors.neutral.text,
149
+ fontSize: '14px',
150
+ fontWeight: 500,
151
+ height: '24px',
152
+ justifyContent: 'center',
153
+ marginTop: theme.space[noTopLabel ? '0.5' : '2'],
154
+ textOverflow: 'ellipsis',
155
+ ...(customStyle(state)?.['multiValue'] || {})
156
+ }),
157
+ multiValueLabel: (provided, state) => ({
158
+ ...provided,
159
+ color: state.isDisabled ? theme.colors.neutral.textDisabled : theme.colors.neutral.text,
160
+ fontSize: '14px',
161
+ fontWeight: 'normal',
162
+ lineHeight: '20px',
163
+ ...(customStyle(state)?.['multiValueLabel'] || {})
164
+ }),
165
+ multiValueRemove: (provided, state) => ({
166
+ ...provided,
167
+ ...(state.isDisabled ? {
168
+ color: theme.colors.neutral.textDisabled,
169
+ cursor: 'none',
170
+ pointerEvents: 'none'
171
+ } : {
172
+ color: theme.colors.primary.text
173
+ }),
174
+ ':hover': {
175
+ color: state.isDisabled ? theme.colors.neutral.textDisabled : theme.colors.primary.text,
176
+ cursor: state.isDisabled ? 'none' : 'pointer',
177
+ pointerEvents: state.isDisabled ? 'none' : 'fill'
178
+ },
179
+ ...(customStyle(state)?.['multiValueRemove'] || {})
180
+ }),
181
+ option: (provided, state) => ({
182
+ ...provided,
183
+ ...getOptionColor({
184
+ state,
185
+ theme
186
+ }),
187
+ cursor: state.isDisabled ? 'not-allowed' : 'pointer',
188
+ ':active': {
189
+ backgroundColor: state.isDisabled ? theme.colors.neutral.backgroundDisabled : theme.colors.primary.background,
190
+ color: state.isDisabled ? theme.colors.neutral.textDisabled : theme.colors.primary.text
191
+ },
192
+ ':hover': {
193
+ backgroundColor: state.isDisabled ? theme.colors.neutral.backgroundDisabled : theme.colors.primary.background,
194
+ color: state.isDisabled ? theme.colors.neutral.textDisabled : theme.colors.neutral.text
195
+ },
196
+ ...(customStyle(state)?.['option'] || {})
197
+ }),
198
+ placeholder: (provided, state) => ({
199
+ ...provided,
200
+ color: getPlaceholderColor({
201
+ error,
202
+ state,
203
+ theme
204
+ }),
205
+ ...(customStyle(state)?.['placeholder'] || {})
206
+ }),
207
+ singleValue: (provided, state) => ({
208
+ ...provided,
209
+ color: state.isDisabled ? theme.colors.neutral.textDisabled : theme.colors.neutral.text,
210
+ marginLeft: state.hasValue ? 0 : undefined,
211
+ marginRight: state.hasValue ? 0 : undefined,
212
+ marginTop: !state.hasValue || noTopLabel ? 0 : '5px',
213
+ paddingLeft: state.hasValue ? 0 : undefined,
214
+ ...(customStyle(state)?.['singleValue'] || {})
215
+ }),
216
+ valueContainer: (provided, state) => ({
217
+ ...provided,
218
+ ...(customStyle(state)?.['valueContainer'] || {}),
219
+ cursor: state.isDisabled ? 'not-allowed' : undefined,
220
+ height: '100%',
221
+ label: {
222
+ display: noTopLabel ? 'none' : 'initial'
223
+ },
224
+ paddingTop: 0
225
+ })
226
+ };
227
+ };
228
+ const StyledContainer = /*#__PURE__*/_styled('div', {
229
+ shouldForwardProp: prop => !['isDisabled', 'additionalStyles'].includes(prop),
230
+ target: "e11gt5pw4"
231
+ })("width:100%;", _ref6 => {
232
+ let {
233
+ isDisabled
234
+ } = _ref6;
235
+ return isDisabled && `pointer-events: initial;`;
236
+ }, ";", _ref7 => {
237
+ let {
238
+ additionalStyles
239
+ } = _ref7;
240
+ return /*#__PURE__*/css(additionalStyles);
241
+ }, ";");
242
+ const StyledError = /*#__PURE__*/_styled("div", {
243
+ target: "e11gt5pw3"
244
+ })("font-size:12px;color:", _ref8 => {
245
+ let {
246
+ theme
247
+ } = _ref8;
248
+ return theme.colors.danger.text;
249
+ }, ";padding-top:", _ref9 => {
250
+ let {
251
+ theme
252
+ } = _ref9;
253
+ return theme.space['0.25'];
254
+ }, ";");
255
+ const SelectContainer = props => {
256
+ const {
257
+ children,
258
+ getStyles,
259
+ innerProps: {
260
+ onKeyDown
261
+ } = {},
262
+ isDisabled = false,
263
+ className,
264
+ selectProps: {
265
+ name = '',
266
+ error,
267
+ className: selectPropsClassName
268
+ } = {}
269
+ } = props;
270
+ return jsxs(StyledContainer, {
271
+ "data-testid": `select-input-${name}`,
272
+ additionalStyles: getStyles?.('container', props),
273
+ isDisabled: isDisabled,
274
+ className: [className, selectPropsClassName].filter(Boolean).join(' '),
275
+ onKeyDown: onKeyDown,
276
+ children: [children, jsx(Expandable, {
277
+ opened: !!error,
278
+ children: jsx(StyledError, {
279
+ children: error
280
+ })
281
+ })]
282
+ });
283
+ };
284
+ const StyledPlaceholder = /*#__PURE__*/_styled('label', {
285
+ shouldForwardProp: prop => !['error', 'hasValue', 'isDisabled', 'isMulti'].includes(prop),
286
+ target: "e11gt5pw2"
287
+ })("position:absolute;left:0;font-weight:400;pointer-events:none;color:", _ref10 => {
288
+ let {
289
+ theme,
290
+ error
291
+ } = _ref10;
292
+ return error ? theme.colors.danger.text : theme.colors.neutral.text;
293
+ }, ";white-space:nowrap;width:100%;height:100%;font-size:16px;transition:transform 250ms ease;opacity:0;", _ref11 => {
294
+ let {
295
+ hasValue
296
+ } = _ref11;
297
+ return hasValue && `
298
+ transform: translate(0, -8px) scale(0.8);
299
+ transform-origin: left;
300
+ padding-left: 8px;
301
+ left: 0;
302
+ top: 2px;
303
+ opacity: 1;
304
+ `;
305
+ }, " ", _ref12 => {
306
+ let {
307
+ isDisabled,
308
+ hasValue
309
+ } = _ref12;
310
+ return hasValue && isDisabled && 'opacity: 0.5';
311
+ }, ";");
312
+ const StyledText = /*#__PURE__*/_styled(Text, {
313
+ target: "e11gt5pw1"
314
+ })("margin-left:", _ref13 => {
315
+ let {
316
+ theme
317
+ } = _ref13;
318
+ return theme.space['1'];
319
+ }, ";color:", _ref14 => {
320
+ let {
321
+ isSelectedAndNotFocused,
322
+ theme
323
+ } = _ref14;
324
+ return isSelectedAndNotFocused ? theme.colors.primary.textStrong : undefined;
325
+ }, ";");
326
+ const MaxLineStyledText = /*#__PURE__*/_styled(StyledText, {
327
+ target: "e11gt5pw0"
328
+ })("-webkit-line-clamp:3;margin-top:", _ref15 => {
329
+ let {
330
+ theme
331
+ } = _ref15;
332
+ return theme.space['2'];
333
+ }, ";");
334
+ const ValueContainer = _ref16 => {
335
+ let {
336
+ isDisabled,
337
+ children,
338
+ selectProps: {
339
+ error,
340
+ labelId,
341
+ inputId,
342
+ ...selectProps
343
+ },
344
+ isMulti,
345
+ hasValue,
346
+ clearValue,
347
+ getStyles,
348
+ getValue,
349
+ getClassNames,
350
+ isRtl,
351
+ cx,
352
+ options,
353
+ selectOption,
354
+ setValue,
355
+ theme,
356
+ className,
357
+ innerProps
358
+ } = _ref16;
359
+ return jsx(components.ValueContainer, {
360
+ clearValue: clearValue,
361
+ getStyles: getStyles,
362
+ getValue: getValue,
363
+ isRtl: isRtl,
364
+ cx: cx,
365
+ options: options,
366
+ selectOption: selectOption,
367
+ setValue: setValue,
368
+ theme: theme,
369
+ className: className,
370
+ innerProps: innerProps,
371
+ selectProps: selectProps,
372
+ isMulti: isMulti,
373
+ hasValue: hasValue,
374
+ isDisabled: isDisabled,
375
+ getClassNames: getClassNames,
376
+ children: jsxs(Fragment, {
377
+ children: [selectProps.placeholder ? jsx(StyledPlaceholder, {
378
+ as: "label",
379
+ id: labelId,
380
+ htmlFor: inputId,
381
+ "aria-live": "assertive",
382
+ error: error,
383
+ isMulti: isMulti,
384
+ isDisabled: isDisabled,
385
+ hasValue: hasValue,
386
+ children: selectProps.placeholder
387
+ }) : null, children]
388
+ })
389
+ });
390
+ };
391
+ const inputStyles = _ref17 => {
392
+ let {
393
+ isMulti
394
+ } = _ref17;
395
+ return /*#__PURE__*/css("margin-left:0px;", !isMulti && 'caret-color: transparent', ";");
396
+ };
397
+ const Input = _ref18 => {
398
+ let {
399
+ isMulti,
400
+ hasValue,
401
+ selectProps: {
402
+ inputId,
403
+ labelId,
404
+ placeholder,
405
+ ...selectProps
406
+ },
407
+ clearValue,
408
+ getStyles,
409
+ getValue,
410
+ isRtl,
411
+ cx,
412
+ options,
413
+ selectOption,
414
+ setValue,
415
+ theme,
416
+ className,
417
+ isHidden,
418
+ ...props
419
+ } = _ref18;
420
+ return jsx(components.Input, {
421
+ ...props,
422
+ css: inputStyles({
423
+ isMulti
424
+ }),
425
+ id: inputId,
426
+ "aria-controls": labelId,
427
+ hasValue: hasValue,
428
+ isMulti: isMulti,
429
+ clearValue: clearValue,
430
+ getStyles: getStyles,
431
+ getValue: getValue,
432
+ isRtl: isRtl,
433
+ cx: cx,
434
+ options: options,
435
+ selectOption: selectOption,
436
+ setValue: setValue,
437
+ theme: theme,
438
+ className: className,
439
+ isHidden: isHidden,
440
+ selectProps: {
441
+ ...selectProps,
442
+ placeholder
443
+ }
444
+ });
445
+ };
446
+ const Option = _ref19 => {
447
+ let {
448
+ selectProps,
449
+ value,
450
+ label,
451
+ children,
452
+ data: {
453
+ inlineDescription,
454
+ description
455
+ },
456
+ isSelected,
457
+ data,
458
+ ...props
459
+ } = _ref19;
460
+ const [isFocused, setIsFocused] = useState(false);
461
+ return jsx("div", {
462
+ "data-testid": `option-${selectProps.name || ''}-${isJSONString(value) ? label : value}`,
463
+ onMouseOver: () => setIsFocused(true),
464
+ onFocus: () => setIsFocused(true),
465
+ onMouseOut: () => setIsFocused(false),
466
+ onBlur: () => setIsFocused(false),
467
+ children: jsxs(components.Option, {
468
+ ...props,
469
+ selectProps: selectProps,
470
+ label: label,
471
+ data: data,
472
+ isSelected: isSelected,
473
+ children: [children, inlineDescription ? jsx(StyledText, {
474
+ as: "span",
475
+ variant: "bodySmall",
476
+ isSelectedAndNotFocused: isSelected && !isFocused,
477
+ children: inlineDescription
478
+ }) : null, description ? jsx(MaxLineStyledText, {
479
+ as: "p",
480
+ variant: "bodySmall",
481
+ isSelectedAndNotFocused: isSelected && !isFocused,
482
+ children: description
483
+ }) : null]
484
+ })
485
+ });
486
+ };
487
+ const DropdownIndicator = props => {
488
+ const {
489
+ selectProps: {
490
+ isDisabled,
491
+ time,
492
+ required
493
+ }
494
+ } = props;
495
+ return jsx(components.DropdownIndicator, {
496
+ ...props,
497
+ children: jsxs(Stack, {
498
+ gap: 1,
499
+ direction: "row",
500
+ alignItems: "center",
501
+ children: [required ? jsx(Icon, {
502
+ name: "asterisk",
503
+ size: 10,
504
+ color: "danger"
505
+ }) : null, time ? jsx(StyledSeparator, {
506
+ direction: "vertical"
507
+ }) : null, jsx(Icon, {
508
+ name: time ? 'clock-outline' : 'arrow-down',
509
+ size: time ? 24 : 16,
510
+ disabled: isDisabled
511
+ })]
512
+ })
513
+ });
514
+ };
515
+ const ClearIndicator = props => {
516
+ const {
517
+ selectProps: {
518
+ checked,
519
+ error
520
+ },
521
+ innerProps: {
522
+ ref,
523
+ ...restInnerProps
524
+ }
525
+ } = props;
526
+ return jsx(components.ClearIndicator, {
527
+ ...props,
528
+ children: jsx(Icon, {
529
+ ...restInnerProps,
530
+ name: "close",
531
+ size: 20,
532
+ cursor: "pointer",
533
+ color: checked && 'primary' || error && 'danger' || 'neutral'
534
+ })
535
+ });
536
+ };
537
+ const MultiValueContainer = props => jsx(components.MultiValueContainer, {
538
+ ...props
539
+ });
540
+ const MultiValueLabel = props => jsx(components.MultiValueLabel, {
541
+ ...props
542
+ });
543
+ const MultiValueRemove = props => jsx(components.MultiValueRemove, {
544
+ ...props,
545
+ children: jsx(Icon, {
546
+ name: "close",
547
+ size: 16
548
+ })
549
+ });
550
+ const defaultCustomStyle = () => ({});
551
+ const FwdSelectInput = _ref20 => {
552
+ let {
553
+ animation = 'pulse',
554
+ animationDuration = 1000,
555
+ animationOnChange = false,
556
+ children,
557
+ className,
558
+ customComponents,
559
+ customStyle = defaultCustomStyle,
560
+ disabled = false,
561
+ error,
562
+ innerRef,
563
+ inputId: inputIdProp,
564
+ isClearable = false,
565
+ isMulti = false,
566
+ isSearchable = true,
567
+ menuPortalTarget,
568
+ noTopLabel = false,
569
+ onChange,
570
+ options,
571
+ placeholder,
572
+ readOnly = false,
573
+ value,
574
+ name,
575
+ id: idProp,
576
+ time,
577
+ isLoading,
578
+ required,
579
+ emptyState,
580
+ 'data-testid': dataTestId
581
+ } = _ref20;
582
+ const id = useId();
583
+ const inputId = inputIdProp ?? id;
584
+ const theme = useTheme();
585
+ const [isAnimated, setIsAnimated] = useState(false);
586
+ const currentValue = value?.value;
587
+
588
+ // Options need to keep the same reference otherwise react-select doesn't focus the selected option
589
+ const selectOptions = useMemo(() => options || flattenChildren(children).map(_ref21 => {
590
+ let {
591
+ props: {
592
+ children: label,
593
+ ...subProps
594
+ }
595
+ } = _ref21;
596
+ return {
597
+ ...subProps,
598
+ label
599
+ };
600
+ }), [options, children]);
601
+ useEffect(() => {
602
+ if (animationOnChange) {
603
+ setIsAnimated(true);
604
+ setTimeout(() => setIsAnimated(false), animationDuration);
605
+ }
606
+ }, [setIsAnimated, animationOnChange, animationDuration, currentValue]);
607
+ return jsx(Select, {
608
+ components: {
609
+ ClearIndicator,
610
+ DropdownIndicator,
611
+ Input,
612
+ MultiValueContainer,
613
+ MultiValueLabel,
614
+ MultiValueRemove,
615
+ Option,
616
+ SelectContainer,
617
+ ValueContainer,
618
+ ...customComponents
619
+ },
620
+ placeholder: placeholder,
621
+ className: className,
622
+ isDisabled: disabled || readOnly,
623
+ isOptionDisabled: option => !!option.disabled,
624
+ styles: getSelectStyles({
625
+ animation: isAnimated ? animation : undefined,
626
+ animationDuration,
627
+ customStyle,
628
+ error,
629
+ noTopLabel,
630
+ theme
631
+ }),
632
+ options: selectOptions,
633
+ menuPortalTarget: menuPortalTarget || undefined,
634
+ isSearchable: isSearchable,
635
+ isClearable: isClearable,
636
+ isMulti: isMulti,
637
+ onChange: onChange,
638
+ value: value,
639
+ maxMenuHeight: 250,
640
+ inputId: inputId
641
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
642
+ ,
643
+ ref: innerRef,
644
+ name: name,
645
+ id: idProp
646
+ // @ts-expect-error time prop doesn't exist in react-select but is used
647
+ ,
648
+ time: time,
649
+ isLoading: isLoading,
650
+ required: required,
651
+ noOptionsMessage: emptyState,
652
+ "data-testid": dataTestId
653
+ });
654
+ };
655
+ const SelectInput = /*#__PURE__*/forwardRef((props, ref) => jsx(FwdSelectInput, {
656
+ innerRef: ref,
657
+ ...props
658
+ }));
659
+ SelectInput.displayName = 'SelectInput';
660
+ SelectInput.Option = Option;
661
+
662
+ export { SelectInput };