@itcase/ui 1.8.177 → 1.8.178
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{DatePicker_cjs_Jt22mPR8.js → DatePicker_cjs_C4EKZl4o.js} +1 -1
- package/dist/{DatePicker_es_CbKQCO3U.js → DatePicker_es_B7Th76gy.js} +1 -1
- package/dist/{Input_cjs_CJOik_SP.js → Input_cjs_KgFCCi2U.js} +2 -2
- package/dist/{Input_es_Dboktsxf.js → Input_es_I8GPoibb.js} +2 -2
- package/dist/SelectContainer_cjs_BOMkYSVf.js +583 -0
- package/dist/SelectContainer_es_gcm20n4I.js +566 -0
- package/dist/cjs/components/Dadata.js +1 -1
- package/dist/cjs/components/DatePeriod.js +59 -37
- package/dist/cjs/components/DatePicker.js +2 -2
- package/dist/cjs/components/Input.js +1 -1
- package/dist/cjs/components/Select.js +40 -588
- package/dist/components/Dadata.js +1 -1
- package/dist/components/DatePeriod.js +60 -38
- package/dist/components/DatePicker.js +2 -2
- package/dist/components/Input.js +1 -1
- package/dist/components/Select.js +21 -573
- package/dist/css/components/DatePeriod/DatePeriod.css +54 -92
- package/dist/css/styles/bundles.css +54 -92
- package/dist/types/components/DatePeriod/DatePeriod.appearance.d.ts +21 -4
- package/dist/types/components/DatePeriod/DatePeriod.interface.d.ts +1 -2
- package/dist/types/components/DatePeriod/appearance/datePeriodShape.d.ts +10 -0
- package/dist/types/components/DatePeriod/appearance/datePeriodSize.d.ts +9 -0
- package/dist/types/components/DatePeriod/appearance/datePeriodSurface.d.ts +2 -4
- package/package.json +1 -1
|
@@ -0,0 +1,566 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import React, { useRef, useEffect, useMemo } from 'react';
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
import Select, { components } from 'react-select';
|
|
5
|
+
import CreatableSelect from 'react-select/creatable';
|
|
6
|
+
import { G as Group } from './Group_es_BwTj-yH-.js';
|
|
7
|
+
import { T as Text } from './Text_es_RDU9GLCV.js';
|
|
8
|
+
import { useAppearanceConfig } from './hooks/useAppearanceConfig/useAppearanceConfig.js';
|
|
9
|
+
import { useDevicePropsGenerator } from './hooks/useDevicePropsGenerator/useDevicePropsGenerator.js';
|
|
10
|
+
import { icons12, icons16, icons14, icons24 } from '@itcase/icons/default';
|
|
11
|
+
import { I as Icon, B as Badge } from './Icon_es_B02tKDTb.js';
|
|
12
|
+
import { L as Loader } from './Loader_es_Dq2-7sn2.js';
|
|
13
|
+
import { D as Divider } from './Divider_es_BiYozVBS.js';
|
|
14
|
+
|
|
15
|
+
// interface ClearIndicatorProps<Option, IsMulti extends boolean, Group extends GroupBase<Option>>
|
|
16
|
+
// extends DefaultClearIndicatorProps<Option, IsMulti, Group> {}
|
|
17
|
+
// For use memo need to check "ClearIndicator" props
|
|
18
|
+
// const SelectClearIndicator = React.memo(
|
|
19
|
+
const SelectClearIndicator = (props) => {
|
|
20
|
+
const { children } = props;
|
|
21
|
+
const { clearIcon, clearIconFill } = props.selectProps;
|
|
22
|
+
return (jsx(components.ClearIndicator, { ...props, children: clearIcon ? (jsx(Icon, { iconFill: clearIconFill, SvgImage: clearIcon })) : (children) }));
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const SelectLoadingMessage = (props) => {
|
|
26
|
+
const { loadingMessageText, loadingMessageTextColor, loadingMessageTextSize, } = props.selectProps;
|
|
27
|
+
return (jsx(Group, { textAlign: "center", children: jsx(Text, { size: loadingMessageTextSize, textColor: loadingMessageTextColor, children: loadingMessageText }) }));
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const selectAppearanceDefault = {
|
|
31
|
+
defaultPrimary: {
|
|
32
|
+
fill: 'surfaceSecondary',
|
|
33
|
+
fillHover: 'surfaceTertiary',
|
|
34
|
+
optionFillDisabled: 'surfaceSecondary',
|
|
35
|
+
optionTextColorDisabled: 'surfaceTextQuaternary',
|
|
36
|
+
borderColor: 'surfaceBorderTertiary',
|
|
37
|
+
borderColorHover: 'surfaceBorderQuaternary',
|
|
38
|
+
elevation: 8,
|
|
39
|
+
badgeAppearance: 'accent',
|
|
40
|
+
clearIconFill: 'surfaceItemQuaternary',
|
|
41
|
+
dropdownIconFill: 'surfaceItemQuaternary',
|
|
42
|
+
groupFill: 'surfaceSecondary',
|
|
43
|
+
groupTextColor: 'surfaceTextPrimary',
|
|
44
|
+
groupTextWeight: '600',
|
|
45
|
+
inputCaretColor: 'accentPrimary',
|
|
46
|
+
inputTextColor: 'surfaceTextPrimary',
|
|
47
|
+
loaderAppearance: 'accentPrimary sizeS ghost',
|
|
48
|
+
loadingMessageTextColor: 'surfaceTextPrimary',
|
|
49
|
+
menuFill: 'surfacePrimary',
|
|
50
|
+
multipleItemFill: 'accentPrimary',
|
|
51
|
+
multipleItemFillHover: 'accentSecondary',
|
|
52
|
+
multipleItemIconFill: 'accentItemPrimary',
|
|
53
|
+
multipleItemTextColor: 'accentTextPrimary',
|
|
54
|
+
multipleTextColor: 'accentTextPrimary',
|
|
55
|
+
noOptionsTextColor: 'surfaceTextPrimary',
|
|
56
|
+
optionBorder: 'none',
|
|
57
|
+
optionFill: 'surfacePrimary',
|
|
58
|
+
optionFillActive: 'accentPrimary',
|
|
59
|
+
optionFillActiveHover: 'accentSecondary',
|
|
60
|
+
optionFillHover: 'surfaceSecondary',
|
|
61
|
+
optionSelectedIconFillIcon: 'successItemPrimary',
|
|
62
|
+
optionTextColor: 'surfaceTextPrimary',
|
|
63
|
+
optionTextColorActive: 'accentTextPrimary',
|
|
64
|
+
placeholderTextColor: 'surfaceTextQuaternary',
|
|
65
|
+
requiredInputBorderColor: 'warningBorderPrimary',
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const selectAppearanceDisabled = {
|
|
70
|
+
disabledPrimary: {
|
|
71
|
+
elevation: 8,
|
|
72
|
+
badgeAppearance: 'accent',
|
|
73
|
+
clearIconFill: 'surfaceItemDisabled',
|
|
74
|
+
dropdownIconFill: 'surfaceItemDisabled',
|
|
75
|
+
headingFill: 'surfaceSecondary',
|
|
76
|
+
headingTextColor: 'surfaceTextPrimary',
|
|
77
|
+
inputBorderColor: 'surfaceBorderTertiary',
|
|
78
|
+
inputBorderColorHover: 'surfaceBorderQuaternary',
|
|
79
|
+
inputCaretColor: 'secondaryItemPrimary',
|
|
80
|
+
inputFill: 'surfaceDisabled',
|
|
81
|
+
inputShape: 'rounded',
|
|
82
|
+
inputTextColor: 'surfaceTextPrimary',
|
|
83
|
+
multipleItemFill: 'accentPrimary',
|
|
84
|
+
multipleItemFillHover: 'surfaceHover',
|
|
85
|
+
multipleItemIconFill: 'accentItemPrimary',
|
|
86
|
+
multipleItemTextColor: 'accentTextPrimary',
|
|
87
|
+
multipleTextColor: 'accentTextPrimary',
|
|
88
|
+
noOptionsTextColor: 'surfaceTextPrimary',
|
|
89
|
+
optionBorder: 'none',
|
|
90
|
+
optionFill: 'surfacePrimary',
|
|
91
|
+
optionFillHover: 'surfaceSecondary',
|
|
92
|
+
optionShape: 'rounded',
|
|
93
|
+
optionTextColor: 'surfaceTextPrimary',
|
|
94
|
+
placeholderTextColor: 'surfaceTextQuaternary',
|
|
95
|
+
requiredInputBorderColor: 'warningBorderPrimary',
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
const selectAppearanceError = {
|
|
100
|
+
errorPrimary: {
|
|
101
|
+
fill: 'errorTertiary',
|
|
102
|
+
fillHover: 'errorTertiary',
|
|
103
|
+
optionFillDisabled: 'surfaceSecondary',
|
|
104
|
+
optionTextColorDisabled: 'surfaceTextQuaternary',
|
|
105
|
+
borderColor: 'surfaceBorderTertiary',
|
|
106
|
+
borderColorHover: 'surfaceBorderQuaternary',
|
|
107
|
+
elevation: 8,
|
|
108
|
+
badgeAppearance: 'accent',
|
|
109
|
+
clearIconFill: 'surfaceItemQuaternary',
|
|
110
|
+
dropdownIconFill: 'surfaceItemQuaternary',
|
|
111
|
+
groupFill: 'surfaceSecondary',
|
|
112
|
+
groupTextColor: 'surfaceTextPrimary',
|
|
113
|
+
groupTextWeight: '600',
|
|
114
|
+
inputCaretColor: 'accentPrimary',
|
|
115
|
+
inputTextColor: 'surfaceTextPrimary',
|
|
116
|
+
loaderAppearance: 'accentPrimary sizeS ghost',
|
|
117
|
+
loadingMessageTextColor: 'surfaceTextPrimary',
|
|
118
|
+
menuFill: 'surfacePrimary',
|
|
119
|
+
multipleItemFill: 'accentPrimary',
|
|
120
|
+
multipleItemFillHover: 'accentSecondary',
|
|
121
|
+
multipleItemIconFill: 'accentItemPrimary',
|
|
122
|
+
multipleItemTextColor: 'accentTextPrimary',
|
|
123
|
+
multipleTextColor: 'accentTextPrimary',
|
|
124
|
+
noOptionsTextColor: 'surfaceTextPrimary',
|
|
125
|
+
optionBorder: 'none',
|
|
126
|
+
optionFill: 'surfacePrimary',
|
|
127
|
+
optionFillActive: 'accentPrimary',
|
|
128
|
+
optionFillActiveHover: 'accentSecondary',
|
|
129
|
+
optionFillHover: 'surfaceSecondary',
|
|
130
|
+
optionSelectedIconFillIcon: 'successItemPrimary',
|
|
131
|
+
optionTextColor: 'surfaceTextPrimary',
|
|
132
|
+
optionTextColorActive: 'accentTextPrimary',
|
|
133
|
+
placeholderTextColor: 'surfaceTextQuaternary',
|
|
134
|
+
requiredInputBorderColor: 'warningBorderPrimary',
|
|
135
|
+
},
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
const selectAppearanceRequire = {
|
|
139
|
+
requirePrimary: {
|
|
140
|
+
fill: 'warningTertiary',
|
|
141
|
+
fillHover: 'warningTertiary',
|
|
142
|
+
optionFillDisabled: 'surfaceSecondary',
|
|
143
|
+
optionTextColorDisabled: 'surfaceTextQuaternary',
|
|
144
|
+
borderColor: 'surfaceBorderTertiary',
|
|
145
|
+
borderColorHover: 'surfaceBorderQuaternary',
|
|
146
|
+
elevation: 8,
|
|
147
|
+
badgeAppearance: 'accent',
|
|
148
|
+
clearIconFill: 'surfaceItemQuaternary',
|
|
149
|
+
dropdownIconFill: 'surfaceItemQuaternary',
|
|
150
|
+
groupFill: 'surfaceSecondary',
|
|
151
|
+
groupTextColor: 'surfaceTextPrimary',
|
|
152
|
+
groupTextWeight: '600',
|
|
153
|
+
inputCaretColor: 'accentPrimary',
|
|
154
|
+
inputTextColor: 'surfaceTextPrimary',
|
|
155
|
+
loaderAppearance: 'accentPrimary sizeS ghost',
|
|
156
|
+
loadingMessageTextColor: 'surfaceTextPrimary',
|
|
157
|
+
menuFill: 'surfacePrimary',
|
|
158
|
+
multipleItemFill: 'accentPrimary',
|
|
159
|
+
multipleItemFillHover: 'accentSecondary',
|
|
160
|
+
multipleItemIconFill: 'accentItemPrimary',
|
|
161
|
+
multipleItemTextColor: 'accentTextPrimary',
|
|
162
|
+
multipleTextColor: 'accentTextPrimary',
|
|
163
|
+
noOptionsTextColor: 'surfaceTextPrimary',
|
|
164
|
+
optionBorder: 'none',
|
|
165
|
+
optionFill: 'surfacePrimary',
|
|
166
|
+
optionFillActive: 'accentPrimary',
|
|
167
|
+
optionFillActiveHover: 'accentSecondary',
|
|
168
|
+
optionFillHover: 'surfaceSecondary',
|
|
169
|
+
optionSelectedIconFillIcon: 'successItemPrimary',
|
|
170
|
+
optionTextColor: 'surfaceTextPrimary',
|
|
171
|
+
optionTextColorActive: 'accentTextPrimary',
|
|
172
|
+
placeholderTextColor: 'surfaceTextQuaternary',
|
|
173
|
+
requiredInputBorderColor: 'warningBorderPrimary',
|
|
174
|
+
},
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
const selectAppearanceShape = {
|
|
178
|
+
rounded: {
|
|
179
|
+
multipleItemShapeRadius: '1m',
|
|
180
|
+
shape: 'rounded',
|
|
181
|
+
},
|
|
182
|
+
roundedXL: {
|
|
183
|
+
multipleItemShapeRadius: '1m',
|
|
184
|
+
shape: 'rounded',
|
|
185
|
+
shapeStrength: '2m',
|
|
186
|
+
},
|
|
187
|
+
roundedL: {
|
|
188
|
+
multipleItemShapeRadius: '1m',
|
|
189
|
+
shape: 'rounded',
|
|
190
|
+
shapeStrength: '1_5m',
|
|
191
|
+
},
|
|
192
|
+
roundedM: {
|
|
193
|
+
multipleItemShapeRadius: '1m',
|
|
194
|
+
shape: 'rounded',
|
|
195
|
+
shapeStrength: '1m',
|
|
196
|
+
},
|
|
197
|
+
roundedS: {
|
|
198
|
+
multipleItemShapeRadius: '1m',
|
|
199
|
+
shape: 'rounded',
|
|
200
|
+
shapeStrength: '0_5m',
|
|
201
|
+
},
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
const selectAppearanceSize = {
|
|
205
|
+
sizeXL: {
|
|
206
|
+
size: 'xl',
|
|
207
|
+
textLoadingMessageAppearance: 'sizeM',
|
|
208
|
+
badgeSize: 'm',
|
|
209
|
+
badgeTextSize: 'm',
|
|
210
|
+
clearIcon: icons24.Action.Clear,
|
|
211
|
+
dividerSize: 'xxs',
|
|
212
|
+
dropdownIcon: icons24.Arrow.ChevronDownSmall,
|
|
213
|
+
groupTextSize: 'm',
|
|
214
|
+
headingTextWeight: '600',
|
|
215
|
+
inputTextSize: 'm',
|
|
216
|
+
menuItemSize: 'l',
|
|
217
|
+
multipleItemIcon: icons16.Action.Close,
|
|
218
|
+
multipleItemTextSize: 's',
|
|
219
|
+
noOptionsTextSize: 's',
|
|
220
|
+
optionSelectedIcon: icons16.Form.Check,
|
|
221
|
+
optionTextSize: 'm',
|
|
222
|
+
placeholderTextSize: 'm',
|
|
223
|
+
},
|
|
224
|
+
sizeL: {
|
|
225
|
+
size: 'l',
|
|
226
|
+
textLoadingMessageAppearance: 'sizeM',
|
|
227
|
+
badgeSize: 'm',
|
|
228
|
+
badgeTextSize: 'm',
|
|
229
|
+
clearIcon: icons24.Action.Clear,
|
|
230
|
+
dividerSize: 'xxs',
|
|
231
|
+
dropdownIcon: icons24.Arrow.ChevronDownSmall,
|
|
232
|
+
groupTextSize: 'm',
|
|
233
|
+
headingTextWeight: '600',
|
|
234
|
+
inputTextSize: 'm',
|
|
235
|
+
menuItemSize: 'l',
|
|
236
|
+
multipleItemIcon: icons16.Action.Close,
|
|
237
|
+
multipleItemTextSize: 's',
|
|
238
|
+
noOptionsTextSize: 'm',
|
|
239
|
+
optionSelectedIcon: icons16.Form.Check,
|
|
240
|
+
optionTextSize: 'm',
|
|
241
|
+
placeholderTextSize: 'm',
|
|
242
|
+
},
|
|
243
|
+
sizeM: {
|
|
244
|
+
size: 'm',
|
|
245
|
+
textLoadingMessageAppearance: 'sizeM',
|
|
246
|
+
badgeSize: 'm',
|
|
247
|
+
badgeTextSize: 'm',
|
|
248
|
+
clearIcon: icons24.Action.Clear,
|
|
249
|
+
dividerSize: 'xxs',
|
|
250
|
+
dropdownIcon: icons24.Arrow.ChevronDownSmall,
|
|
251
|
+
groupTextSize: 'm',
|
|
252
|
+
inputTextSize: 'm',
|
|
253
|
+
loadingMessageTextSize: 'm',
|
|
254
|
+
menuItemSize: 'l',
|
|
255
|
+
multipleItemIcon: icons14.Action.Close,
|
|
256
|
+
multipleItemTextSize: 'xs ',
|
|
257
|
+
noOptionsTextSize: 'm',
|
|
258
|
+
optionSelectedIcon: icons14.Form.Check,
|
|
259
|
+
optionTextSize: 'm',
|
|
260
|
+
placeholderTextSize: 'm',
|
|
261
|
+
},
|
|
262
|
+
sizeS: {
|
|
263
|
+
size: 's',
|
|
264
|
+
textLoadingMessageAppearance: 'sizeS',
|
|
265
|
+
badgeSize: 'm',
|
|
266
|
+
badgeTextSize: 'm',
|
|
267
|
+
clearIcon: icons24.Action.Clear,
|
|
268
|
+
dividerSize: 'xxs',
|
|
269
|
+
dropdownIcon: icons24.Arrow.ChevronDownSmall,
|
|
270
|
+
groupTextSize: 'm',
|
|
271
|
+
headingTextWeight: '600',
|
|
272
|
+
inputTextSize: 's',
|
|
273
|
+
menuItemSize: 'l',
|
|
274
|
+
multipleItemIcon: icons14.Action.Close,
|
|
275
|
+
multipleItemTextSize: 'xs ',
|
|
276
|
+
noOptionsTextSize: 's',
|
|
277
|
+
optionSelectedIcon: icons14.Form.Check,
|
|
278
|
+
optionTextSize: 's',
|
|
279
|
+
placeholderTextSize: 's',
|
|
280
|
+
},
|
|
281
|
+
sizeXS: {
|
|
282
|
+
size: 'xs',
|
|
283
|
+
textLoadingMessageAppearance: 'sizeXS',
|
|
284
|
+
badgeSize: 'm',
|
|
285
|
+
badgeTextSize: 'm',
|
|
286
|
+
clearIcon: icons16.Action.Clear,
|
|
287
|
+
dividerSize: 'xxs',
|
|
288
|
+
dropdownIcon: icons16.Arrow.ChevronDownSmall,
|
|
289
|
+
groupTextSize: 'm',
|
|
290
|
+
headingTextWeight: '600',
|
|
291
|
+
inputTextSize: 'xs ',
|
|
292
|
+
menuItemSize: 'l',
|
|
293
|
+
multipleItemIcon: icons12.Action.Close,
|
|
294
|
+
multipleItemTextSize: 'xxs',
|
|
295
|
+
noOptionsTextSize: 'xs',
|
|
296
|
+
// optionSelectedIcon: icons12.Form.Check,
|
|
297
|
+
optionTextSize: 'xs',
|
|
298
|
+
placeholderTextSize: 'xs',
|
|
299
|
+
},
|
|
300
|
+
sizeXXS: {
|
|
301
|
+
size: 'xxs',
|
|
302
|
+
textLoadingMessageAppearance: 'sizeXS',
|
|
303
|
+
badgeSize: 'm',
|
|
304
|
+
badgeTextSize: 'm',
|
|
305
|
+
clearIcon: icons16.Action.Clear,
|
|
306
|
+
dividerSize: 'xxs',
|
|
307
|
+
dropdownIcon: icons16.Arrow.ChevronDownSmall,
|
|
308
|
+
groupTextSize: 'm',
|
|
309
|
+
headingTextWeight: '600',
|
|
310
|
+
inputTextSize: 'xs',
|
|
311
|
+
menuItemSize: 'l',
|
|
312
|
+
multipleItemIcon: icons12.Action.Close,
|
|
313
|
+
// optionSelectedIcon: icons12.Form.Check,
|
|
314
|
+
multipleItemTextSize: 'xxs',
|
|
315
|
+
noOptionsTextSize: 'xs',
|
|
316
|
+
optionTextSize: 'xs',
|
|
317
|
+
placeholderTextSize: 'xs',
|
|
318
|
+
},
|
|
319
|
+
};
|
|
320
|
+
|
|
321
|
+
const selectAppearanceStyle = {
|
|
322
|
+
solid: {
|
|
323
|
+
borderColor: 'none',
|
|
324
|
+
borderColorHover: 'none',
|
|
325
|
+
},
|
|
326
|
+
outlined: {
|
|
327
|
+
fill: 'none',
|
|
328
|
+
fillHover: 'none',
|
|
329
|
+
},
|
|
330
|
+
full: {},
|
|
331
|
+
ghost: {
|
|
332
|
+
fill: 'none',
|
|
333
|
+
borderColor: 'none',
|
|
334
|
+
borderColorHover: 'none',
|
|
335
|
+
},
|
|
336
|
+
};
|
|
337
|
+
|
|
338
|
+
const selectAppearanceSuccess = {
|
|
339
|
+
successPrimary: {
|
|
340
|
+
fill: 'successTertiary',
|
|
341
|
+
fillHover: 'successTertiary',
|
|
342
|
+
optionFillDisabled: 'surfaceSecondary',
|
|
343
|
+
optionTextColorDisabled: 'surfaceTextQuaternary',
|
|
344
|
+
borderColor: 'surfaceBorderTertiary',
|
|
345
|
+
borderColorHover: 'surfaceBorderQuaternary',
|
|
346
|
+
elevation: 8,
|
|
347
|
+
badgeAppearance: 'accent',
|
|
348
|
+
clearIconFill: 'surfaceItemQuaternary',
|
|
349
|
+
dropdownIconFill: 'surfaceItemQuaternary',
|
|
350
|
+
groupFill: 'surfaceSecondary',
|
|
351
|
+
groupTextColor: 'surfaceTextPrimary',
|
|
352
|
+
groupTextWeight: '600',
|
|
353
|
+
inputCaretColor: 'accentPrimary',
|
|
354
|
+
inputTextColor: 'surfaceTextPrimary',
|
|
355
|
+
loaderAppearance: 'accentPrimary sizeS ghost',
|
|
356
|
+
loadingMessageTextColor: 'surfaceTextPrimary',
|
|
357
|
+
menuFill: 'surfacePrimary',
|
|
358
|
+
multipleItemFill: 'accentPrimary',
|
|
359
|
+
multipleItemFillHover: 'accentSecondary',
|
|
360
|
+
multipleItemIconFill: 'accentItemPrimary',
|
|
361
|
+
multipleItemTextColor: 'accentTextPrimary',
|
|
362
|
+
multipleTextColor: 'accentTextPrimary',
|
|
363
|
+
noOptionsTextColor: 'surfaceTextPrimary',
|
|
364
|
+
optionBorder: 'none',
|
|
365
|
+
optionFill: 'surfacePrimary',
|
|
366
|
+
optionFillActive: 'accentPrimary',
|
|
367
|
+
optionFillActiveHover: 'accentSecondary',
|
|
368
|
+
optionFillHover: 'surfaceSecondary',
|
|
369
|
+
optionSelectedIconFillIcon: 'successItemPrimary',
|
|
370
|
+
optionTextColor: 'surfaceTextPrimary',
|
|
371
|
+
optionTextColorActive: 'accentTextPrimary',
|
|
372
|
+
placeholderTextColor: 'surfaceTextQuaternary',
|
|
373
|
+
requiredInputBorderColor: 'warningBorderPrimary',
|
|
374
|
+
},
|
|
375
|
+
};
|
|
376
|
+
|
|
377
|
+
const selectAppearance = {
|
|
378
|
+
...selectAppearanceRequire,
|
|
379
|
+
...selectAppearanceDefault,
|
|
380
|
+
...selectAppearanceDisabled,
|
|
381
|
+
...selectAppearanceSuccess,
|
|
382
|
+
...selectAppearanceSize,
|
|
383
|
+
...selectAppearanceError,
|
|
384
|
+
...selectAppearanceShape,
|
|
385
|
+
...selectAppearanceStyle,
|
|
386
|
+
};
|
|
387
|
+
|
|
388
|
+
const SelectControl = (props) => {
|
|
389
|
+
const { before, after } = props.selectProps;
|
|
390
|
+
return (jsxs(React.Fragment, { children: [before, jsx(components.Control, { ...props, className: clsx('select__control') }), after] }));
|
|
391
|
+
};
|
|
392
|
+
|
|
393
|
+
// For use memo need to check "DropdownIndicator" props
|
|
394
|
+
// const SelectDropdownIndicator = React.memo(
|
|
395
|
+
const SelectDropdownIndicator = (props) => {
|
|
396
|
+
const { children } = props;
|
|
397
|
+
const { dropdownFillHover, dropdownIcon, dropdownIconFill, dropdownIconShape, } = props.selectProps;
|
|
398
|
+
return (jsx(components.DropdownIndicator, { ...props, children: dropdownIcon ? (jsx(Icon, { fillHover: dropdownFillHover, iconFill: dropdownIconFill, shape: dropdownIconShape, SvgImage: dropdownIcon })) : (children) }));
|
|
399
|
+
};
|
|
400
|
+
|
|
401
|
+
const SelectGroupHeading = (props) => {
|
|
402
|
+
const { groupFill, groupTextColor, groupTextSize, groupTextWeight } = props.selectProps;
|
|
403
|
+
return (jsx(components.GroupHeading, { ...props, className: clsx('select__menu-group-heading', groupFill && `fill_${groupFill}`), children: jsx(Text, { size: groupTextSize, textColor: groupTextColor, textWeight: groupTextWeight, children: props.data.label }) }));
|
|
404
|
+
};
|
|
405
|
+
|
|
406
|
+
const SelectIndicatorsContainer = (props) => {
|
|
407
|
+
const { badgeAppearance, badgeSize, badgeTextSize, showBadge, value } = props.selectProps;
|
|
408
|
+
return (jsxs(components.IndicatorsContainer, { ...props, children: [showBadge &&
|
|
409
|
+
value &&
|
|
410
|
+
// @ts-expect-error
|
|
411
|
+
value?.length > 0 ? (jsx(Badge, { appearance: badgeAppearance, size: badgeSize, textSize: badgeTextSize,
|
|
412
|
+
// @ts-expect-error
|
|
413
|
+
value: value.length.toString() })) : null, props.children] }));
|
|
414
|
+
};
|
|
415
|
+
|
|
416
|
+
const SelectInput = (props) => {
|
|
417
|
+
const { inputCaretColor, inputTextColor, inputTextSize } = props.selectProps;
|
|
418
|
+
return (jsx(components.Input, { ...props, className: clsx(inputTextSize && `text_size_${inputTextSize}`, inputTextColor && `text-color_${inputTextColor}`, inputCaretColor && `caret-color_${inputCaretColor}`) }));
|
|
419
|
+
};
|
|
420
|
+
|
|
421
|
+
const SelectLoadingIndicator = (props) => {
|
|
422
|
+
const { loaderAppearance, isLoading } = props.selectProps;
|
|
423
|
+
return isLoading && jsx(Loader, { appearance: loaderAppearance });
|
|
424
|
+
};
|
|
425
|
+
|
|
426
|
+
const SelectMenu = (props) => {
|
|
427
|
+
const { elevation, menuAfter, menuBefore, menuFill, menuShape, menuShapeStrength, } = props.selectProps;
|
|
428
|
+
return (jsxs(components.Menu, { ...props, className: clsx(menuFill && `fill_${menuFill}`, menuShape && `shape_${menuShape}`, menuShapeStrength && `shape-strength_${menuShapeStrength}`, elevation && `elevation_${elevation}`), children: [menuBefore, props.selectProps.fetchingData ? (jsx("span", { className: "fetching", children: "Fetching data..." })) : (jsx(React.Fragment, { children: props.children })), menuAfter] }));
|
|
429
|
+
};
|
|
430
|
+
|
|
431
|
+
const SelectMultiValueContainer = (props) => {
|
|
432
|
+
const { multipleItemFill, multipleItemFillHover, multipleItemShapeRadius } = props.selectProps;
|
|
433
|
+
return (jsx(components.MultiValueContainer, { ...props, children: jsx(Group, { className: clsx('select__multi-value-item'), direction: "horizontal", alignItems: "center", fill: multipleItemFill, fillHover: multipleItemFillHover, borderRadius: multipleItemShapeRadius, gap: "0.5m", children: props.children }) }));
|
|
434
|
+
};
|
|
435
|
+
|
|
436
|
+
const SelectMultiValueLabel = (props) => {
|
|
437
|
+
const { multipleItemTextColor, multipleItemTextSize } = props.selectProps;
|
|
438
|
+
return (jsx(components.MultiValueLabel, { ...props, children: props.data && (jsx(Text, { size: multipleItemTextSize, textColor: multipleItemTextColor, children: props.data.label })) }));
|
|
439
|
+
};
|
|
440
|
+
|
|
441
|
+
const SelectMultiValueRemove = (props) => {
|
|
442
|
+
const { multipleItemIcon, multipleItemIconFill } = props.selectProps;
|
|
443
|
+
return (jsx(components.MultiValueRemove, { ...props, children: jsx(Icon, { iconFill: multipleItemIconFill, SvgImage: multipleItemIcon }) }));
|
|
444
|
+
};
|
|
445
|
+
|
|
446
|
+
const SelectNoOptions = (props) => {
|
|
447
|
+
const { inputValue, noOptionsSearchText, noOptionsText, noOptionsTextColor, noOptionsTextSize, optionFill, } = props.selectProps;
|
|
448
|
+
return (jsx(components.NoOptionsMessage, { ...props, className: clsx(optionFill && `fill_${optionFill}`), children: jsx(Group, { textAlign: "center", children: jsx(Text, { size: noOptionsTextSize, textColor: noOptionsTextColor, children: inputValue && noOptionsSearchText
|
|
449
|
+
? noOptionsSearchText
|
|
450
|
+
: noOptionsText }) }) }));
|
|
451
|
+
};
|
|
452
|
+
|
|
453
|
+
const SelectOption = (props) => {
|
|
454
|
+
const { label, isSelected } = props;
|
|
455
|
+
const { optionFillActiveDisabled, optionFillDisabled, optionTextColorDisabled, dividerDirection, dividerFill, dividerSize, menuItemSize, optionAfter, optionBefore, optionBorder, optionBorderType, optionFill, optionFillActive, optionFillActiveHover, optionFillHover, optionSelectedIcon, optionSelectedIconFillIcon, optionSelectedIconSize, optionSelectedIconSrc, optionShape, optionShapeStrength, optionTextColor, optionTextColorActive, optionTextSize, showDivider, } = props.selectProps;
|
|
456
|
+
return (jsxs(components.Option, { ...props, className: clsx('select__menu-list-item', isSelected || props.isSelected
|
|
457
|
+
? !props.isDisabled
|
|
458
|
+
? optionFillActive && `fill_active_${optionFillActive}`
|
|
459
|
+
: optionFillActiveDisabled &&
|
|
460
|
+
`fill_active_disabled_${optionFillActiveDisabled}`
|
|
461
|
+
: !props.isDisabled
|
|
462
|
+
? optionFill && `fill_${optionFill}`
|
|
463
|
+
: optionFillDisabled && `fill_${optionFillDisabled}`, (isSelected || props.isSelected) &&
|
|
464
|
+
!props.isDisabled &&
|
|
465
|
+
optionFillActiveHover &&
|
|
466
|
+
`fill_active_hover_${optionFillActiveHover}`, !isSelected &&
|
|
467
|
+
!props.isSelected &&
|
|
468
|
+
!props.isDisabled &&
|
|
469
|
+
optionFillHover &&
|
|
470
|
+
`fill_hover_${optionFillHover}`, isSelected && 'select__menu-list-item_state_selected', menuItemSize && `select__menu-list-item_size_${menuItemSize}`, optionBorder && `border-color_${optionBorder}`, optionBorderType && `border_type_${optionBorderType}`, optionShape && `shape_${optionShape}`, optionShapeStrength && `shape-strength_${optionShapeStrength}`), children: [optionBefore, jsx(Text, { className: "select__menu-list-item_option", size: optionTextSize, textColor: optionTextColor, textColorActive: optionTextColorActive, textColorDisabled: optionTextColorDisabled, isDisabled: props.isDisabled, isActive: props.isSelected || isSelected, children: label }), (isSelected || props.isSelected) && (jsx("div", { className: "select__menu-list-item_selected", children: jsx(Icon, { iconFill: optionSelectedIconFillIcon, iconSize: optionSelectedIconSize, imageSrc: optionSelectedIconSrc, SvgImage: optionSelectedIcon }) })), optionAfter, showDivider && (jsx(Divider, { width: "fill", direction: dividerDirection, size: dividerSize, fill: dividerFill }))] }));
|
|
471
|
+
};
|
|
472
|
+
|
|
473
|
+
const SelectPlaceholder = (props) => {
|
|
474
|
+
const { placeholderTextColor, placeholderTextSize } = props.selectProps;
|
|
475
|
+
return (jsx(components.Placeholder, { ...props, children: jsx(Text, { size: placeholderTextSize, textColor: placeholderTextColor, children: props.children }) }));
|
|
476
|
+
};
|
|
477
|
+
|
|
478
|
+
const SelectSingleValue = (props) => {
|
|
479
|
+
const { data } = props;
|
|
480
|
+
const { inputTextColor, inputTextSize } = props.selectProps;
|
|
481
|
+
return (jsxs(components.SingleValue, { ...props, children: [data && data.optionBefore, jsx(Text, { size: inputTextSize, textColor: inputTextColor, children: props.children }), data && data.optionAfter] }));
|
|
482
|
+
};
|
|
483
|
+
|
|
484
|
+
const SelectValueContainer = (props) => {
|
|
485
|
+
const { inputAfter, inputBefore } = props.selectProps;
|
|
486
|
+
return (jsxs(components.ValueContainer, { ...props, children: [inputBefore, props.children, inputAfter] }));
|
|
487
|
+
};
|
|
488
|
+
|
|
489
|
+
const selectConfig = {
|
|
490
|
+
appearance: selectAppearance,
|
|
491
|
+
setAppearance: (appearanceConfig) => {
|
|
492
|
+
selectConfig.appearance = appearanceConfig;
|
|
493
|
+
},
|
|
494
|
+
};
|
|
495
|
+
const SelectContainer = React.forwardRef(function SelectContainer(props, ref) {
|
|
496
|
+
const { appearance = '', className, width, minWidth, initialValue, badgeAppearance, badgeSize, defaultValue, dividerDirection, filterOption, hideSelectedOptions, hideValueContainer, inputAfter, inputBefore, instanceId, loaderAppearance, loadingMessageText, menuAfter, menuBefore, menuIsOpen, menuItemSize, noOptionsSearchText, noOptionsText, optionAfter, optionBefore, options, placeholder, showBadge, showDivider, value, before, after, openMenuOnClick, closeMenuOnSelect, isDisabled, isClearable, isCreatable, isLoading, isMulti, isSearchable, set, onChange, onInputChange, } = props;
|
|
497
|
+
const defaultRef = useRef(null);
|
|
498
|
+
const selectRef = ref || defaultRef;
|
|
499
|
+
const SelectComponent = isCreatable
|
|
500
|
+
? CreatableSelect
|
|
501
|
+
: Select;
|
|
502
|
+
useEffect(() => {
|
|
503
|
+
// @ts-expect-error
|
|
504
|
+
const onClickOutside = (event) => {
|
|
505
|
+
const isTargetSelectContainer =
|
|
506
|
+
// maybe here ".contains()"?
|
|
507
|
+
event.target.hasClass &&
|
|
508
|
+
event.target.hasClass('select_state_hide-value-container');
|
|
509
|
+
if ('current' in selectRef &&
|
|
510
|
+
selectRef.current &&
|
|
511
|
+
selectRef.current.controlRef) {
|
|
512
|
+
const isTargetInsideController = selectRef.current.controlRef.contains(event.target);
|
|
513
|
+
if (!isTargetSelectContainer && !isTargetInsideController) {
|
|
514
|
+
// @ts-expect-error
|
|
515
|
+
selectRef.current?.onInputBlur();
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
};
|
|
519
|
+
if (hideValueContainer) {
|
|
520
|
+
document.addEventListener('click', onClickOutside);
|
|
521
|
+
}
|
|
522
|
+
return () => {
|
|
523
|
+
if (hideValueContainer) {
|
|
524
|
+
document.removeEventListener('click', onClickOutside);
|
|
525
|
+
}
|
|
526
|
+
};
|
|
527
|
+
}, [hideValueContainer, selectRef]);
|
|
528
|
+
const clearStyle = useMemo(() => new Proxy({
|
|
529
|
+
container: {
|
|
530
|
+
width: width,
|
|
531
|
+
minWidth: minWidth,
|
|
532
|
+
},
|
|
533
|
+
}, {
|
|
534
|
+
get: (target, prop) => {
|
|
535
|
+
if (prop in target) {
|
|
536
|
+
return () => target[prop];
|
|
537
|
+
}
|
|
538
|
+
return () => { };
|
|
539
|
+
},
|
|
540
|
+
}), [minWidth, width]);
|
|
541
|
+
const appearanceConfig = useAppearanceConfig(appearance, selectConfig, isDisabled);
|
|
542
|
+
const propsGenerator = useDevicePropsGenerator(props, appearanceConfig);
|
|
543
|
+
const { fillClass, fillHoverClass, borderColorClass, borderColorHoverClass, elevation, badgeTextSize, clearIcon, clearIconFill, dividerFill, dividerSize, dropdownFillHover, dropdownIcon, dropdownIconFill, dropdownIconShape, groupFillClass, groupTextColorClass, groupTextSizeClass, groupTextWeightClass, inputCaretColorClass, inputTextColorClass, inputTextSizeClass, loadingMessageTextColor, loadingMessageTextSize, menuFillClass, multipleItemFill, multipleItemFillHover, multipleItemIcon, multipleItemIconFill, multipleItemShapeRadius, multipleItemTextColorClass, multipleItemTextSizeClass, noOptionsTextColorClass, noOptionsTextSizeClass, optionBorderClass, optionBorderTypeClass, optionFillActiveClass, optionFillActiveDisabledClass, optionFillActiveHoverClass, optionFillClass, optionFillDisabledClass, optionFillHoverClass, optionSelectedIcon, optionSelectedIconFillIcon, optionSelectedIconSize, optionSelectedIconSrc, optionTextColorActiveClass, optionTextColorClass, optionTextColorDisabled, optionTextSizeClass, placeholderTextColor, placeholderTextSize, shapeClass, shapeStrengthClass, sizeClass, widthClass, } = propsGenerator;
|
|
544
|
+
return (jsx(SelectComponent, { className: clsx(className, 'select', shapeClass && `shape_${shapeClass}`, shapeStrengthClass && `shape-strength_${shapeStrengthClass}`, fillClass && `fill_${fillClass}`, fillHoverClass && `fill_hover_${fillHoverClass}`, borderColorClass && `border-color_${borderColorClass}`, borderColorHoverClass && `border-color_hover_${borderColorHoverClass}`, sizeClass && `select_size_${sizeClass}`, hideValueContainer && 'select_state_hide-value-container', set && `select_set_${set}`, widthClass && `select_width_${widthClass}`), ref: selectRef, elevation: elevation, badgeAppearance: badgeAppearance, badgeSize: badgeSize, badgeTextSize: badgeTextSize, classNamePrefix: "select", clearIcon: clearIcon, clearIconFill: clearIconFill, components: {
|
|
545
|
+
IndicatorSeparator: () => null,
|
|
546
|
+
ClearIndicator: SelectClearIndicator,
|
|
547
|
+
Control: SelectControl,
|
|
548
|
+
DropdownIndicator: SelectDropdownIndicator,
|
|
549
|
+
GroupHeading: SelectGroupHeading,
|
|
550
|
+
IndicatorsContainer: SelectIndicatorsContainer,
|
|
551
|
+
Input: SelectInput,
|
|
552
|
+
LoadingIndicator: SelectLoadingIndicator,
|
|
553
|
+
LoadingMessage: SelectLoadingMessage,
|
|
554
|
+
Menu: SelectMenu,
|
|
555
|
+
MultiValueContainer: SelectMultiValueContainer,
|
|
556
|
+
MultiValueLabel: SelectMultiValueLabel,
|
|
557
|
+
MultiValueRemove: SelectMultiValueRemove,
|
|
558
|
+
NoOptionsMessage: SelectNoOptions,
|
|
559
|
+
Option: SelectOption,
|
|
560
|
+
Placeholder: SelectPlaceholder,
|
|
561
|
+
SingleValue: SelectSingleValue,
|
|
562
|
+
ValueContainer: SelectValueContainer,
|
|
563
|
+
}, defaultValue: defaultValue || initialValue, dividerDirection: dividerDirection, dividerFill: dividerFill, dividerSize: dividerSize, dropdownFillHover: dropdownFillHover, dropdownIcon: dropdownIcon, dropdownIconFill: dropdownIconFill, dropdownIconShape: dropdownIconShape, filterOption: filterOption, groupFill: groupFillClass, groupTextColor: groupTextColorClass, groupTextSize: groupTextSizeClass, groupTextWeight: groupTextWeightClass, hideSelectedOptions: hideSelectedOptions ?? false, inputAfter: inputAfter, inputBefore: inputBefore, inputCaretColor: inputCaretColorClass, inputShape: shapeClass, inputShapeStrength: shapeStrengthClass, inputTextColor: inputTextColorClass, inputTextSize: inputTextSizeClass, instanceId: instanceId, loaderAppearance: loaderAppearance, loadingMessageText: loadingMessageText, loadingMessageTextColor: loadingMessageTextColor, loadingMessageTextSize: loadingMessageTextSize, menuAfter: menuAfter, menuBefore: menuBefore, menuFill: menuFillClass, menuIsOpen: menuIsOpen, menuItemSize: menuItemSize, menuShape: shapeClass, menuShapeStrength: shapeStrengthClass, multipleItemFill: multipleItemFill, multipleItemFillHover: multipleItemFillHover, multipleItemIcon: multipleItemIcon, multipleItemIconFill: multipleItemIconFill, multipleItemShapeRadius: multipleItemShapeRadius, multipleItemSize: sizeClass, multipleItemTextColor: multipleItemTextColorClass, multipleItemTextSize: multipleItemTextSizeClass, noOptionBorder: optionBorderClass && `border-color_${optionBorderClass}`, noOptionBorderType: optionBorderTypeClass && `border_type_${optionBorderTypeClass}`, noOptionsFill: optionFillClass && `fill_${optionFillClass}`, noOptionsSearchText: noOptionsSearchText, noOptionsText: noOptionsText, noOptionsTextColor: noOptionsTextColorClass, noOptionsTextSize: noOptionsTextSizeClass, optionAfter: optionAfter, optionBefore: optionBefore, optionBorder: optionBorderClass, optionBorderType: optionBorderTypeClass, optionFill: optionFillClass, optionFillActive: optionFillActiveClass, optionFillActiveDisabledClass: optionFillActiveDisabledClass, optionFillActiveHover: optionFillActiveHoverClass, optionFillDisabled: optionFillDisabledClass, optionFillHover: optionFillHoverClass, options: options, optionSelectedIcon: optionSelectedIcon, optionSelectedIconFillIcon: optionSelectedIconFillIcon, optionSelectedIconSize: optionSelectedIconSize, optionSelectedIconSrc: optionSelectedIconSrc, optionShape: shapeClass, optionShapeStrength: shapeStrengthClass, optionTextColor: optionTextColorClass, optionTextColorActive: optionTextColorActiveClass, optionTextColorDisabled: optionTextColorDisabled, optionTextSize: optionTextSizeClass, placeholder: placeholder, placeholderTextColor: placeholderTextColor, placeholderTextSize: placeholderTextSize, showBadge: showBadge, showDivider: showDivider, styles: clearStyle, value: value, before: before, after: after, openMenuOnClick: openMenuOnClick, closeMenuOnSelect: closeMenuOnSelect ?? true, isDisabled: isDisabled, isClearable: isClearable ?? false, isLoading: isLoading, isMulti: isMulti ?? false, isSearchable: isSearchable ?? false, set: set, onChange: onChange, onInputChange: onInputChange }));
|
|
564
|
+
});
|
|
565
|
+
|
|
566
|
+
export { SelectClearIndicator as S, SelectContainer as a, SelectControl as b, SelectDropdownIndicator as c, SelectGroupHeading as d, SelectIndicatorsContainer as e, SelectInput as f, SelectMenu as g, SelectMultiValueContainer as h, SelectMultiValueLabel as i, SelectMultiValueRemove as j, SelectOption as k, SelectPlaceholder as l, SelectSingleValue as m, SelectValueContainer as n, selectConfig as s };
|
|
@@ -4,7 +4,7 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
4
4
|
var React = require('react');
|
|
5
5
|
var clsx = require('clsx');
|
|
6
6
|
var reactDadata = require('react-dadata');
|
|
7
|
-
var Input = require('../../
|
|
7
|
+
var Input = require('../../Input_cjs_KgFCCi2U.js');
|
|
8
8
|
require('../hooks/useAppearanceConfig/useAppearanceConfig.js');
|
|
9
9
|
require('../hooks/useDevicePropsGenerator/useDevicePropsGenerator.js');
|
|
10
10
|
require('lodash/camelCase');
|