@stenajs-webui/select 17.13.2 → 17.13.3
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/CHANGELOG.md +12 -0
- package/dist/components/ui/AsyncMultiSelect.d.ts +1 -1
- package/dist/components/ui/AsyncSelect.d.ts +1 -1
- package/dist/components/ui/GroupedMultiSelect.d.ts +1 -1
- package/dist/components/ui/MultiSelect.d.ts +1 -1
- package/dist/components/ui/Select.d.ts +1 -1
- package/dist/index.es.js +423 -460
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.es.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
(function(){ try
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
1
|
+
(function(){"use strict";try{var e=document.createElement("style");e.appendChild(document.createTextNode("")),document.head.appendChild(e)}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
|
|
2
|
+
import * as T from "react";
|
|
3
|
+
import { useMemo as p } from "react";
|
|
4
|
+
import F, { mergeStyles as g, components as B } from "react-select";
|
|
5
|
+
import M from "react-select/async";
|
|
6
|
+
import { jsx as a, jsxs as m } from "react/jsx-runtime";
|
|
7
|
+
import { Row as C, Space as S, Text as j, Column as E, Spacing as k } from "@stenajs-webui/core";
|
|
8
|
+
import { Icon as N, stenaCheck as P, Chip as I, FlatButton as q } from "@stenajs-webui/elements";
|
|
9
|
+
import { uniqWith as V, isEqual as w, intersectionWith as R, differenceWith as _ } from "lodash";
|
|
10
|
+
const H = {
|
|
10
11
|
arrowColor: {
|
|
11
12
|
focused: {
|
|
12
13
|
hover: "var(--lhds-color-ui-500)",
|
|
@@ -23,7 +24,7 @@ const defaultSelectTheme = {
|
|
|
23
24
|
},
|
|
24
25
|
input: {
|
|
25
26
|
backgroundColor: "var(--swui-field-bg-enabled)",
|
|
26
|
-
border:
|
|
27
|
+
border: "1px solid var(--swui-select-border-color)",
|
|
27
28
|
borderColor: "var(--swui-field-border-color)",
|
|
28
29
|
borderColorFocused: "var(--swui-field-border-color-hover)",
|
|
29
30
|
disabledBackgroundColor: "var(--swui-field-bg-disabled)",
|
|
@@ -85,195 +86,158 @@ const defaultSelectTheme = {
|
|
|
85
86
|
removeButtonHoverBackgroundColor: "var(--swui-primary-action-color-hover)",
|
|
86
87
|
removeButtonHoverTextColor: "var(--swui-white)"
|
|
87
88
|
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
} else {
|
|
112
|
-
return void 0;
|
|
113
|
-
}
|
|
114
|
-
};
|
|
115
|
-
const resolveInputBackgroundColor = (colors, isDisabled, isFocused, variant) => {
|
|
116
|
-
if (isDisabled) {
|
|
117
|
-
return colors.disabledBackgroundColor;
|
|
118
|
-
} else if (isFocused) {
|
|
119
|
-
return colors.backgroundColor;
|
|
120
|
-
} else if (variant === "warning") {
|
|
121
|
-
return colors.warningBackgroundColor;
|
|
122
|
-
} else if (variant === "success") {
|
|
123
|
-
return colors.successBackgroundColor;
|
|
124
|
-
} else if (variant === "error") {
|
|
125
|
-
return colors.errorBackgroundColor;
|
|
126
|
-
} else {
|
|
127
|
-
return colors.backgroundColor;
|
|
128
|
-
}
|
|
129
|
-
};
|
|
130
|
-
const resolveInputBorderColor = (colors, isDisabled, isFocused, isHovered, variant) => {
|
|
131
|
-
if (isDisabled) {
|
|
132
|
-
return colors.borderColor;
|
|
133
|
-
} else if (isFocused) {
|
|
134
|
-
return colors.borderColorFocused;
|
|
135
|
-
} else if (variant === "warning") {
|
|
136
|
-
return colors.warningBorderColor;
|
|
137
|
-
} else if (variant === "success") {
|
|
138
|
-
return colors.successBorderColor;
|
|
139
|
-
} else if (variant === "error") {
|
|
140
|
-
return colors.errorBorderColor;
|
|
141
|
-
} else if (isHovered) {
|
|
142
|
-
return colors.borderColorFocused;
|
|
143
|
-
} else {
|
|
144
|
-
return colors.borderColor;
|
|
145
|
-
}
|
|
146
|
-
};
|
|
147
|
-
const createStylesFromTheme = ({
|
|
148
|
-
menu,
|
|
149
|
-
menuPortal,
|
|
150
|
-
input,
|
|
151
|
-
multiSelect,
|
|
152
|
-
clearButtonColor,
|
|
153
|
-
arrowColor,
|
|
154
|
-
groupHeading,
|
|
155
|
-
loadingIndicator
|
|
156
|
-
}, variant) => ({
|
|
157
|
-
option: (base, { isDisabled, isFocused, isSelected }) => ({
|
|
158
|
-
...base,
|
|
159
|
-
fontFamily: input.fontFamily,
|
|
160
|
-
fontSize: input.fontSize,
|
|
161
|
-
backgroundColor: resolveOptionBackgroundColor(menu, isDisabled, isSelected, isFocused),
|
|
162
|
-
color: resolveOptionColor(menu, isDisabled, isSelected, isFocused),
|
|
163
|
-
cursor: isDisabled ? "not-allowed" : "default",
|
|
164
|
-
whiteSpace: menu.whiteSpace || base.whiteSpace,
|
|
89
|
+
}, J = (o, r, e, t) => r ? o.disabledBackgroundColor : e && t ? o.selectedItemHoverBackgroundColor : e ? o.selectedItemBackgroundColor : t ? o.hoverBackgroundColor : void 0, K = (o, r, e, t) => r ? o.disabledTextColor : e && t ? o.selectedItemHoverTextColor : e ? o.selectedItemTextColor : t ? o.hoverTextColor : void 0, Q = (o, r, e, t) => r ? o.disabledBackgroundColor : e ? o.backgroundColor : t === "warning" ? o.warningBackgroundColor : t === "success" ? o.successBackgroundColor : t === "error" ? o.errorBackgroundColor : o.backgroundColor, O = (o, r, e, t, n) => r ? o.borderColor : e ? o.borderColorFocused : n === "warning" ? o.warningBorderColor : n === "success" ? o.successBorderColor : n === "error" ? o.errorBorderColor : t ? o.borderColorFocused : o.borderColor, U = ({
|
|
90
|
+
menu: o,
|
|
91
|
+
menuPortal: r,
|
|
92
|
+
input: e,
|
|
93
|
+
multiSelect: t,
|
|
94
|
+
clearButtonColor: n,
|
|
95
|
+
arrowColor: i,
|
|
96
|
+
groupHeading: c,
|
|
97
|
+
loadingIndicator: v
|
|
98
|
+
}, u) => ({
|
|
99
|
+
option: (l, { isDisabled: d, isFocused: s, isSelected: f }) => ({
|
|
100
|
+
...l,
|
|
101
|
+
fontFamily: e.fontFamily,
|
|
102
|
+
fontSize: e.fontSize,
|
|
103
|
+
backgroundColor: J(
|
|
104
|
+
o,
|
|
105
|
+
d,
|
|
106
|
+
f,
|
|
107
|
+
s
|
|
108
|
+
),
|
|
109
|
+
color: K(o, d, f, s),
|
|
110
|
+
cursor: d ? "not-allowed" : "default",
|
|
111
|
+
whiteSpace: o.whiteSpace || l.whiteSpace,
|
|
165
112
|
":active": {
|
|
166
|
-
backgroundColor:
|
|
167
|
-
color:
|
|
113
|
+
backgroundColor: d ? void 0 : f ? o.selectedItemActiveBackgroundColor : o.activeBackgroundColor,
|
|
114
|
+
color: d ? void 0 : f ? o.selectedItemActiveTextColor : o.activeTextColor
|
|
168
115
|
}
|
|
169
116
|
}),
|
|
170
|
-
control: (
|
|
171
|
-
...
|
|
172
|
-
fontFamily:
|
|
173
|
-
fontSize:
|
|
174
|
-
minHeight:
|
|
175
|
-
backgroundColor:
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
117
|
+
control: (l, { isFocused: d, isDisabled: s, menuIsOpen: f }) => ({
|
|
118
|
+
...l,
|
|
119
|
+
fontFamily: e.fontFamily,
|
|
120
|
+
fontSize: e.fontSize,
|
|
121
|
+
minHeight: e.minHeight,
|
|
122
|
+
backgroundColor: Q(
|
|
123
|
+
e,
|
|
124
|
+
s,
|
|
125
|
+
d,
|
|
126
|
+
u
|
|
127
|
+
),
|
|
128
|
+
borderRadius: e.borderRadius,
|
|
129
|
+
border: e.border,
|
|
130
|
+
"--swui-select-border-color": O(
|
|
131
|
+
e,
|
|
132
|
+
s,
|
|
133
|
+
d || f,
|
|
134
|
+
!1,
|
|
135
|
+
u
|
|
136
|
+
),
|
|
137
|
+
boxShadow: d ? e.boxShadowFocused : void 0,
|
|
180
138
|
"&:hover": {
|
|
181
|
-
"--swui-select-border-color":
|
|
139
|
+
"--swui-select-border-color": O(
|
|
140
|
+
e,
|
|
141
|
+
!1,
|
|
142
|
+
d || f,
|
|
143
|
+
!0,
|
|
144
|
+
u
|
|
145
|
+
)
|
|
182
146
|
}
|
|
183
147
|
}),
|
|
184
|
-
singleValue: (
|
|
185
|
-
...
|
|
186
|
-
fontFamily:
|
|
187
|
-
fontSize:
|
|
188
|
-
color:
|
|
148
|
+
singleValue: (l) => ({
|
|
149
|
+
...l,
|
|
150
|
+
fontFamily: e.fontFamily,
|
|
151
|
+
fontSize: e.fontSize,
|
|
152
|
+
color: e.textColor
|
|
189
153
|
}),
|
|
190
|
-
noOptionsMessage: (
|
|
191
|
-
...
|
|
192
|
-
fontFamily:
|
|
193
|
-
fontSize:
|
|
154
|
+
noOptionsMessage: (l) => ({
|
|
155
|
+
...l,
|
|
156
|
+
fontFamily: e.fontFamily,
|
|
157
|
+
fontSize: e.fontSize
|
|
194
158
|
}),
|
|
195
|
-
input: (
|
|
196
|
-
...
|
|
197
|
-
fontFamily:
|
|
198
|
-
fontSize:
|
|
199
|
-
color:
|
|
159
|
+
input: (l) => ({
|
|
160
|
+
...l,
|
|
161
|
+
fontFamily: e.fontFamily,
|
|
162
|
+
fontSize: e.fontSize,
|
|
163
|
+
color: e.textColor
|
|
200
164
|
}),
|
|
201
|
-
groupHeading: (
|
|
202
|
-
...
|
|
203
|
-
fontFamily:
|
|
204
|
-
fontSize:
|
|
205
|
-
lineHeight:
|
|
206
|
-
fontWeight:
|
|
207
|
-
color:
|
|
208
|
-
letterSpacing:
|
|
165
|
+
groupHeading: (l) => ({
|
|
166
|
+
...l,
|
|
167
|
+
fontFamily: e.fontFamily,
|
|
168
|
+
fontSize: c.fontSize,
|
|
169
|
+
lineHeight: c.lineHeight,
|
|
170
|
+
fontWeight: c.fontWeight,
|
|
171
|
+
color: c.color,
|
|
172
|
+
letterSpacing: c.letterSpacing
|
|
209
173
|
}),
|
|
210
|
-
multiValueLabel: (
|
|
211
|
-
...
|
|
212
|
-
backgroundColor:
|
|
213
|
-
color:
|
|
214
|
-
fontFamily:
|
|
215
|
-
fontSize:
|
|
174
|
+
multiValueLabel: (l) => ({
|
|
175
|
+
...l,
|
|
176
|
+
backgroundColor: t.backgroundColor,
|
|
177
|
+
color: t.textColor,
|
|
178
|
+
fontFamily: e.fontFamily,
|
|
179
|
+
fontSize: c.fontSize
|
|
216
180
|
}),
|
|
217
|
-
indicatorSeparator: (
|
|
218
|
-
...
|
|
181
|
+
indicatorSeparator: (l) => ({
|
|
182
|
+
...l,
|
|
219
183
|
display: "none"
|
|
220
184
|
}),
|
|
221
|
-
clearIndicator: (
|
|
222
|
-
...
|
|
185
|
+
clearIndicator: (l) => ({
|
|
186
|
+
...l,
|
|
223
187
|
padding: "5px",
|
|
224
|
-
color:
|
|
188
|
+
color: n.standard,
|
|
225
189
|
"&:hover": {
|
|
226
|
-
color:
|
|
190
|
+
color: n.hover
|
|
227
191
|
},
|
|
228
192
|
cursor: "pointer"
|
|
229
193
|
}),
|
|
230
|
-
placeholder: (
|
|
231
|
-
...
|
|
232
|
-
fontFamily:
|
|
233
|
-
fontSize:
|
|
234
|
-
color:
|
|
194
|
+
placeholder: (l) => ({
|
|
195
|
+
...l,
|
|
196
|
+
fontFamily: e.fontFamily,
|
|
197
|
+
fontSize: e.fontSize,
|
|
198
|
+
color: e.placeholderColor
|
|
235
199
|
}),
|
|
236
|
-
container: (
|
|
237
|
-
...
|
|
200
|
+
container: (l) => ({
|
|
201
|
+
...l
|
|
238
202
|
}),
|
|
239
|
-
valueContainer: (
|
|
240
|
-
...
|
|
203
|
+
valueContainer: (l) => ({
|
|
204
|
+
...l,
|
|
241
205
|
padding: "0 8px"
|
|
242
206
|
}),
|
|
243
|
-
dropdownIndicator: (
|
|
244
|
-
...
|
|
207
|
+
dropdownIndicator: (l, { isFocused: d }) => ({
|
|
208
|
+
...l,
|
|
245
209
|
padding: "5px",
|
|
246
|
-
color:
|
|
210
|
+
color: d ? i.focused.standard : i.closed.standard,
|
|
247
211
|
"&:hover": {
|
|
248
|
-
color:
|
|
212
|
+
color: d ? i.focused.hover : i.closed.hover
|
|
249
213
|
},
|
|
250
214
|
svg: {
|
|
251
215
|
width: 14,
|
|
252
216
|
height: 14
|
|
253
217
|
}
|
|
254
218
|
}),
|
|
255
|
-
menu: (
|
|
256
|
-
...
|
|
257
|
-
backgroundColor:
|
|
258
|
-
color:
|
|
259
|
-
minWidth:
|
|
260
|
-
zIndex:
|
|
261
|
-
width:
|
|
262
|
-
border:
|
|
263
|
-
borderColor:
|
|
219
|
+
menu: (l) => ({
|
|
220
|
+
...l,
|
|
221
|
+
backgroundColor: o.backgroundColor,
|
|
222
|
+
color: o.textColor,
|
|
223
|
+
minWidth: o.minWidth || l.minWidth,
|
|
224
|
+
zIndex: o.zIndex,
|
|
225
|
+
width: o.width || l.width,
|
|
226
|
+
border: e.border,
|
|
227
|
+
borderColor: e.borderColorFocused
|
|
264
228
|
}),
|
|
265
|
-
menuPortal: (
|
|
266
|
-
...
|
|
267
|
-
zIndex:
|
|
229
|
+
menuPortal: (l) => ({
|
|
230
|
+
...l,
|
|
231
|
+
zIndex: r.zIndex
|
|
268
232
|
}),
|
|
269
|
-
multiValueRemove: (
|
|
270
|
-
...
|
|
271
|
-
backgroundColor:
|
|
233
|
+
multiValueRemove: (l) => ({
|
|
234
|
+
...l,
|
|
235
|
+
backgroundColor: t.removeButtonBackgroundColor,
|
|
272
236
|
":hover": {
|
|
273
|
-
color:
|
|
274
|
-
backgroundColor:
|
|
237
|
+
color: t.removeButtonHoverTextColor,
|
|
238
|
+
backgroundColor: t.removeButtonHoverBackgroundColor
|
|
275
239
|
},
|
|
276
|
-
color:
|
|
240
|
+
color: t.removeButtonTextColor,
|
|
277
241
|
borderRadius: "50%",
|
|
278
242
|
width: 16,
|
|
279
243
|
height: 16,
|
|
@@ -285,364 +249,363 @@ const createStylesFromTheme = ({
|
|
|
285
249
|
alignItems: "center",
|
|
286
250
|
cursor: "pointer"
|
|
287
251
|
}),
|
|
288
|
-
multiValue: (
|
|
289
|
-
...
|
|
290
|
-
backgroundColor:
|
|
291
|
-
color:
|
|
292
|
-
fontFamily:
|
|
293
|
-
fontSize:
|
|
252
|
+
multiValue: (l) => ({
|
|
253
|
+
...l,
|
|
254
|
+
backgroundColor: t.backgroundColor,
|
|
255
|
+
color: t.textColor,
|
|
256
|
+
fontFamily: e.fontFamily,
|
|
257
|
+
fontSize: c.fontSize,
|
|
294
258
|
alignItems: "center",
|
|
295
259
|
margin: 0,
|
|
296
260
|
marginRight: 2
|
|
297
261
|
}),
|
|
298
|
-
loadingMessage: (
|
|
299
|
-
...
|
|
300
|
-
color:
|
|
301
|
-
fontFamily:
|
|
302
|
-
fontSize:
|
|
262
|
+
loadingMessage: (l) => ({
|
|
263
|
+
...l,
|
|
264
|
+
color: v.textColor,
|
|
265
|
+
fontFamily: e.fontFamily,
|
|
266
|
+
fontSize: e.fontSize
|
|
303
267
|
})
|
|
304
|
-
});
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
isMulti: true
|
|
268
|
+
}), x = (o) => U(H, o);
|
|
269
|
+
function ho({
|
|
270
|
+
variant: o = "standard",
|
|
271
|
+
styles: r,
|
|
272
|
+
isMulti: e,
|
|
273
|
+
...t
|
|
274
|
+
}) {
|
|
275
|
+
const n = p(() => {
|
|
276
|
+
const i = x(o);
|
|
277
|
+
return r ? g(i, r) : i;
|
|
278
|
+
}, [o, r]);
|
|
279
|
+
return /* @__PURE__ */ a(M, {
|
|
280
|
+
styles: n,
|
|
281
|
+
...t,
|
|
282
|
+
isMulti: !0
|
|
320
283
|
});
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
variant = "standard",
|
|
324
|
-
styles,
|
|
325
|
-
isMulti,
|
|
326
|
-
...
|
|
327
|
-
})
|
|
328
|
-
const
|
|
329
|
-
const
|
|
330
|
-
return
|
|
331
|
-
}, [
|
|
332
|
-
return /* @__PURE__ */
|
|
333
|
-
styles:
|
|
334
|
-
...
|
|
335
|
-
isMulti:
|
|
284
|
+
}
|
|
285
|
+
function mo({
|
|
286
|
+
variant: o = "standard",
|
|
287
|
+
styles: r,
|
|
288
|
+
isMulti: e,
|
|
289
|
+
...t
|
|
290
|
+
}) {
|
|
291
|
+
const n = p(() => {
|
|
292
|
+
const i = x(o);
|
|
293
|
+
return r ? g(i, r) : i;
|
|
294
|
+
}, [o, r]);
|
|
295
|
+
return /* @__PURE__ */ a(M, {
|
|
296
|
+
styles: n,
|
|
297
|
+
...t,
|
|
298
|
+
isMulti: !1
|
|
336
299
|
});
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
variant = "standard",
|
|
340
|
-
styles,
|
|
341
|
-
isMulti,
|
|
342
|
-
...
|
|
343
|
-
})
|
|
344
|
-
const
|
|
345
|
-
const
|
|
346
|
-
return
|
|
347
|
-
}, [
|
|
348
|
-
return /* @__PURE__ */
|
|
349
|
-
styles:
|
|
350
|
-
...
|
|
351
|
-
isMulti:
|
|
300
|
+
}
|
|
301
|
+
function W({
|
|
302
|
+
variant: o = "standard",
|
|
303
|
+
styles: r,
|
|
304
|
+
isMulti: e,
|
|
305
|
+
...t
|
|
306
|
+
}) {
|
|
307
|
+
const n = p(() => {
|
|
308
|
+
const i = x(o);
|
|
309
|
+
return r ? g(i, r) : i;
|
|
310
|
+
}, [o, r]);
|
|
311
|
+
return /* @__PURE__ */ a(F, {
|
|
312
|
+
styles: n,
|
|
313
|
+
...t,
|
|
314
|
+
isMulti: !0
|
|
352
315
|
});
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
variant = "standard",
|
|
356
|
-
styles,
|
|
357
|
-
isMulti,
|
|
358
|
-
...
|
|
359
|
-
})
|
|
360
|
-
const
|
|
361
|
-
const
|
|
362
|
-
return
|
|
363
|
-
}, [
|
|
364
|
-
return /* @__PURE__ */
|
|
365
|
-
styles:
|
|
366
|
-
...
|
|
367
|
-
isMulti:
|
|
316
|
+
}
|
|
317
|
+
function bo({
|
|
318
|
+
variant: o = "standard",
|
|
319
|
+
styles: r,
|
|
320
|
+
isMulti: e,
|
|
321
|
+
...t
|
|
322
|
+
}) {
|
|
323
|
+
const n = p(() => {
|
|
324
|
+
const i = x(o);
|
|
325
|
+
return r ? g(i, r) : i;
|
|
326
|
+
}, [o, r]);
|
|
327
|
+
return /* @__PURE__ */ a(F, {
|
|
328
|
+
styles: n,
|
|
329
|
+
...t,
|
|
330
|
+
isMulti: !1
|
|
368
331
|
});
|
|
369
|
-
}
|
|
370
|
-
const
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
332
|
+
}
|
|
333
|
+
const z = (o, r) => _(
|
|
334
|
+
r,
|
|
335
|
+
[...o.internalOptions, o],
|
|
336
|
+
w
|
|
337
|
+
).map(b), X = (o) => !("internalOptions" in o), h = (o) => o.filter(X).map(b), Y = (o) => (r, e) => {
|
|
338
|
+
const t = r != null ? r : [];
|
|
339
|
+
switch (e.action) {
|
|
376
340
|
case "select-option":
|
|
377
|
-
if (
|
|
378
|
-
const
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
} else
|
|
390
|
-
|
|
391
|
-
}
|
|
341
|
+
if (e.option && "internalOptions" in e.option) {
|
|
342
|
+
const n = V(
|
|
343
|
+
t.reduce(
|
|
344
|
+
(i, c) => "internalOptions" in c ? [...i, ...c.internalOptions] : [
|
|
345
|
+
...i,
|
|
346
|
+
b(c)
|
|
347
|
+
],
|
|
348
|
+
[]
|
|
349
|
+
),
|
|
350
|
+
w
|
|
351
|
+
);
|
|
352
|
+
o(n, e);
|
|
353
|
+
} else
|
|
354
|
+
o(h(t), e);
|
|
392
355
|
break;
|
|
393
356
|
case "deselect-option":
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
357
|
+
e.option && "internalOptions" in e.option ? o(
|
|
358
|
+
z(
|
|
359
|
+
e.option,
|
|
360
|
+
h(t)
|
|
361
|
+
),
|
|
362
|
+
e
|
|
363
|
+
) : o(h(t), e);
|
|
399
364
|
break;
|
|
400
365
|
case "remove-value":
|
|
401
366
|
case "pop-value":
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
367
|
+
e.removedValue && "internalOptions" in e.removedValue ? o(
|
|
368
|
+
z(
|
|
369
|
+
e.removedValue,
|
|
370
|
+
h(t)
|
|
371
|
+
),
|
|
372
|
+
e
|
|
373
|
+
) : o(h(t), e);
|
|
407
374
|
break;
|
|
408
375
|
case "clear":
|
|
409
|
-
|
|
376
|
+
o(
|
|
377
|
+
t.map(b),
|
|
378
|
+
e
|
|
379
|
+
);
|
|
410
380
|
break;
|
|
411
381
|
case "create-option":
|
|
412
|
-
|
|
382
|
+
o(
|
|
383
|
+
t.map(b),
|
|
384
|
+
e
|
|
385
|
+
);
|
|
413
386
|
break;
|
|
414
387
|
}
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
};
|
|
425
|
-
const convertValueToInternalValue = (options, values) => {
|
|
426
|
-
if (!values) {
|
|
388
|
+
}, Z = (o) => o.reduce(
|
|
389
|
+
(r, e) => [
|
|
390
|
+
...r,
|
|
391
|
+
L(e),
|
|
392
|
+
...e.options.map(G)
|
|
393
|
+
],
|
|
394
|
+
[]
|
|
395
|
+
), $ = (o, r) => {
|
|
396
|
+
if (!r)
|
|
427
397
|
return [];
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
};
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
});
|
|
455
|
-
const convertInternalOptionToDropdownOption = (option) => ({
|
|
456
|
-
data: option.data,
|
|
457
|
-
label: option.label,
|
|
458
|
-
value: option.value
|
|
459
|
-
});
|
|
460
|
-
const resolveIconColor = (theme, isFocused) => isFocused ? theme.menu.selectedItemHoverIconColor : theme.menu.selectedItemIconColor;
|
|
461
|
-
function formatInnerOptionLabel(props) {
|
|
462
|
-
var _a;
|
|
398
|
+
const e = [];
|
|
399
|
+
return o.forEach((t) => {
|
|
400
|
+
D(t.options, r) && e.push(
|
|
401
|
+
L(t)
|
|
402
|
+
), e.push(
|
|
403
|
+
...R(t.options, r, w).map(
|
|
404
|
+
(n) => G(n)
|
|
405
|
+
)
|
|
406
|
+
);
|
|
407
|
+
}), e;
|
|
408
|
+
}, D = (o, r) => r ? R(o, r, w).length === o.length : !1, G = (o) => ({
|
|
409
|
+
data: o.data,
|
|
410
|
+
label: o.label,
|
|
411
|
+
value: o.value
|
|
412
|
+
}), L = (o) => ({
|
|
413
|
+
data: o.label,
|
|
414
|
+
label: o.label,
|
|
415
|
+
value: o.label,
|
|
416
|
+
internalOptions: o.options
|
|
417
|
+
}), b = (o) => ({
|
|
418
|
+
data: o.data,
|
|
419
|
+
label: o.label,
|
|
420
|
+
value: o.value
|
|
421
|
+
}), oo = (o, r) => r ? o.menu.selectedItemHoverIconColor : o.menu.selectedItemIconColor;
|
|
422
|
+
function eo(o) {
|
|
423
|
+
var t;
|
|
463
424
|
const {
|
|
464
|
-
formatGroupLabel,
|
|
465
|
-
formatOptionLabel
|
|
466
|
-
} =
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
}) : props.label;
|
|
472
|
-
}
|
|
473
|
-
return formatOptionLabel ? formatOptionLabel(props.data, {
|
|
425
|
+
formatGroupLabel: r,
|
|
426
|
+
formatOptionLabel: e
|
|
427
|
+
} = o.selectProps;
|
|
428
|
+
return "internalOptions" in o.data ? r ? r({
|
|
429
|
+
label: o.data.label,
|
|
430
|
+
options: o.data.internalOptions
|
|
431
|
+
}) : o.label : e ? e(o.data, {
|
|
474
432
|
context: "menu",
|
|
475
|
-
inputValue: (
|
|
476
|
-
selectValue:
|
|
477
|
-
}) :
|
|
433
|
+
inputValue: (t = o.selectProps.inputValue) != null ? t : "",
|
|
434
|
+
selectValue: o.getValue()
|
|
435
|
+
}) : o.label;
|
|
478
436
|
}
|
|
479
|
-
|
|
480
|
-
onChange,
|
|
481
|
-
options,
|
|
482
|
-
value,
|
|
483
|
-
variant = "standard",
|
|
484
|
-
formatGroupLabel,
|
|
485
|
-
formatOptionLabel,
|
|
486
|
-
...
|
|
487
|
-
})
|
|
488
|
-
const
|
|
489
|
-
const
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
focused: props.isFocused
|
|
437
|
+
function ro({
|
|
438
|
+
onChange: o,
|
|
439
|
+
options: r,
|
|
440
|
+
value: e,
|
|
441
|
+
variant: t = "standard",
|
|
442
|
+
formatGroupLabel: n,
|
|
443
|
+
formatOptionLabel: i,
|
|
444
|
+
...c
|
|
445
|
+
}) {
|
|
446
|
+
const v = (s) => {
|
|
447
|
+
const f = eo(s), y = "internalOptions" in s.data;
|
|
448
|
+
return /* @__PURE__ */ a(B.Option, {
|
|
449
|
+
...s,
|
|
450
|
+
children: /* @__PURE__ */ m(C, {
|
|
451
|
+
children: [!y && /* @__PURE__ */ a(S, {}), /* @__PURE__ */ a(to, {
|
|
452
|
+
theme: H,
|
|
453
|
+
size: y ? void 0 : "small",
|
|
454
|
+
label: f,
|
|
455
|
+
selected: s.isSelected,
|
|
456
|
+
focused: s.isFocused
|
|
500
457
|
})]
|
|
501
458
|
})
|
|
502
459
|
});
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
const internalOptions = options ? convertGroupedDropdownOptionsToInternalOptions(options) : void 0;
|
|
511
|
-
return /* @__PURE__ */ jsx(MultiSelect, {
|
|
512
|
-
...selectProps,
|
|
513
|
-
onChange: onChange ? createOnChange(onChange) : void 0,
|
|
514
|
-
hideSelectedOptions: false,
|
|
460
|
+
}, u = (s) => "internalOptions" in s.data ? null : /* @__PURE__ */ a(B.MultiValue, {
|
|
461
|
+
...s
|
|
462
|
+
}), l = r ? $(r, e) : void 0, d = r ? Z(r) : void 0;
|
|
463
|
+
return /* @__PURE__ */ a(W, {
|
|
464
|
+
...c,
|
|
465
|
+
onChange: o ? Y(o) : void 0,
|
|
466
|
+
hideSelectedOptions: !1,
|
|
515
467
|
components: {
|
|
516
|
-
...
|
|
517
|
-
MultiValue,
|
|
518
|
-
Option
|
|
468
|
+
...c.components,
|
|
469
|
+
MultiValue: u,
|
|
470
|
+
Option: v
|
|
519
471
|
},
|
|
520
|
-
isMulti:
|
|
521
|
-
options:
|
|
522
|
-
value:
|
|
523
|
-
variant
|
|
472
|
+
isMulti: !0,
|
|
473
|
+
options: d,
|
|
474
|
+
value: l,
|
|
475
|
+
variant: t
|
|
524
476
|
});
|
|
525
|
-
}
|
|
526
|
-
const
|
|
527
|
-
focused,
|
|
528
|
-
label,
|
|
529
|
-
selected,
|
|
530
|
-
size,
|
|
531
|
-
theme
|
|
532
|
-
}) => /* @__PURE__ */
|
|
477
|
+
}
|
|
478
|
+
const to = ({
|
|
479
|
+
focused: o,
|
|
480
|
+
label: r,
|
|
481
|
+
selected: e,
|
|
482
|
+
size: t,
|
|
483
|
+
theme: n
|
|
484
|
+
}) => /* @__PURE__ */ m(C, {
|
|
533
485
|
alignItems: "center",
|
|
534
486
|
justifyContent: "space-between",
|
|
535
487
|
flexGrow: 1,
|
|
536
|
-
children: [/* @__PURE__ */
|
|
488
|
+
children: [/* @__PURE__ */ a(j, {
|
|
537
489
|
tabIndex: -1,
|
|
538
|
-
size,
|
|
490
|
+
size: t,
|
|
539
491
|
color: "currentColor",
|
|
540
|
-
children:
|
|
541
|
-
}),
|
|
542
|
-
color:
|
|
543
|
-
icon:
|
|
492
|
+
children: r
|
|
493
|
+
}), e && /* @__PURE__ */ a(N, {
|
|
494
|
+
color: oo(n, o),
|
|
495
|
+
icon: P,
|
|
544
496
|
size: 12
|
|
545
497
|
})]
|
|
546
498
|
});
|
|
547
|
-
function
|
|
548
|
-
value,
|
|
549
|
-
onValueChange,
|
|
550
|
-
noneSelectedLabel = "None",
|
|
551
|
-
children
|
|
499
|
+
function A({
|
|
500
|
+
value: o,
|
|
501
|
+
onValueChange: r,
|
|
502
|
+
noneSelectedLabel: e = "None",
|
|
503
|
+
children: t
|
|
552
504
|
}) {
|
|
553
|
-
return /* @__PURE__ */
|
|
505
|
+
return /* @__PURE__ */ m(E, {
|
|
554
506
|
flex: 1,
|
|
555
|
-
children: [/* @__PURE__ */
|
|
507
|
+
children: [/* @__PURE__ */ m(C, {
|
|
556
508
|
flexWrap: "wrap",
|
|
557
|
-
children: [
|
|
558
|
-
children: [/* @__PURE__ */
|
|
509
|
+
children: [o == null ? void 0 : o.map((n) => /* @__PURE__ */ m(C, {
|
|
510
|
+
children: [/* @__PURE__ */ a(k, {
|
|
559
511
|
num: 0.5,
|
|
560
|
-
children: /* @__PURE__ */
|
|
561
|
-
label:
|
|
512
|
+
children: /* @__PURE__ */ a(I, {
|
|
513
|
+
label: n.label,
|
|
562
514
|
onClickRemove: () => {
|
|
563
|
-
var
|
|
564
|
-
return
|
|
515
|
+
var i;
|
|
516
|
+
return r == null ? void 0 : r((i = o == null ? void 0 : o.filter((c) => c.value !== n.value)) != null ? i : []);
|
|
565
517
|
}
|
|
566
518
|
})
|
|
567
|
-
}), /* @__PURE__ */
|
|
568
|
-
},
|
|
519
|
+
}), /* @__PURE__ */ a(S, {})]
|
|
520
|
+
}, n.value)), o != null && o.length ? /* @__PURE__ */ a(k, {
|
|
569
521
|
num: 0.5,
|
|
570
|
-
children: /* @__PURE__ */
|
|
522
|
+
children: /* @__PURE__ */ a(q, {
|
|
571
523
|
size: "small",
|
|
572
524
|
label: "Clear",
|
|
573
|
-
onClick: () =>
|
|
525
|
+
onClick: () => r == null ? void 0 : r([])
|
|
574
526
|
})
|
|
575
|
-
}) : /* @__PURE__ */
|
|
527
|
+
}) : /* @__PURE__ */ a(k, {
|
|
576
528
|
num: 0.5,
|
|
577
|
-
children: /* @__PURE__ */
|
|
529
|
+
children: /* @__PURE__ */ a(I, {
|
|
578
530
|
variant: "secondary",
|
|
579
|
-
label:
|
|
531
|
+
label: e
|
|
580
532
|
})
|
|
581
533
|
})]
|
|
582
|
-
}), /* @__PURE__ */
|
|
534
|
+
}), /* @__PURE__ */ a(S, {
|
|
583
535
|
num: 0.5
|
|
584
|
-
}),
|
|
536
|
+
}), t]
|
|
585
537
|
});
|
|
586
538
|
}
|
|
587
|
-
function
|
|
588
|
-
value,
|
|
589
|
-
onValueChange,
|
|
590
|
-
placeholder = "Type to search",
|
|
591
|
-
loading,
|
|
592
|
-
inputValue,
|
|
593
|
-
onInputChange,
|
|
594
|
-
noneSelectedLabel = "None",
|
|
595
|
-
...
|
|
539
|
+
function lo({
|
|
540
|
+
value: o,
|
|
541
|
+
onValueChange: r,
|
|
542
|
+
placeholder: e = "Type to search",
|
|
543
|
+
loading: t,
|
|
544
|
+
inputValue: n,
|
|
545
|
+
onInputChange: i,
|
|
546
|
+
noneSelectedLabel: c = "None",
|
|
547
|
+
...v
|
|
596
548
|
}) {
|
|
597
|
-
return /* @__PURE__ */
|
|
598
|
-
noneSelectedLabel,
|
|
599
|
-
onValueChange,
|
|
600
|
-
value,
|
|
601
|
-
children: /* @__PURE__ */
|
|
602
|
-
...
|
|
603
|
-
isClearable:
|
|
604
|
-
value,
|
|
605
|
-
onChange:
|
|
606
|
-
backspaceRemovesValue:
|
|
607
|
-
hideSelectedOptions:
|
|
608
|
-
controlShouldRenderValue:
|
|
609
|
-
placeholder,
|
|
610
|
-
isLoading:
|
|
611
|
-
inputValue,
|
|
612
|
-
onInputChange
|
|
549
|
+
return /* @__PURE__ */ a(A, {
|
|
550
|
+
noneSelectedLabel: c,
|
|
551
|
+
onValueChange: r,
|
|
552
|
+
value: o,
|
|
553
|
+
children: /* @__PURE__ */ a(W, {
|
|
554
|
+
...v,
|
|
555
|
+
isClearable: !1,
|
|
556
|
+
value: o,
|
|
557
|
+
onChange: r ? (u) => r([...u]) : void 0,
|
|
558
|
+
backspaceRemovesValue: !1,
|
|
559
|
+
hideSelectedOptions: !0,
|
|
560
|
+
controlShouldRenderValue: !1,
|
|
561
|
+
placeholder: e,
|
|
562
|
+
isLoading: t,
|
|
563
|
+
inputValue: n,
|
|
564
|
+
onInputChange: i
|
|
613
565
|
})
|
|
614
566
|
});
|
|
615
567
|
}
|
|
616
|
-
const
|
|
617
|
-
function
|
|
618
|
-
value,
|
|
619
|
-
onValueChange,
|
|
620
|
-
placeholder = "Type to search",
|
|
621
|
-
loading,
|
|
622
|
-
inputValue,
|
|
623
|
-
onInputChange,
|
|
624
|
-
noneSelectedLabel = "None",
|
|
625
|
-
...
|
|
568
|
+
const Co = T.memo(lo);
|
|
569
|
+
function no({
|
|
570
|
+
value: o,
|
|
571
|
+
onValueChange: r,
|
|
572
|
+
placeholder: e = "Type to search",
|
|
573
|
+
loading: t,
|
|
574
|
+
inputValue: n,
|
|
575
|
+
onInputChange: i,
|
|
576
|
+
noneSelectedLabel: c = "None",
|
|
577
|
+
...v
|
|
626
578
|
}) {
|
|
627
|
-
return /* @__PURE__ */
|
|
628
|
-
noneSelectedLabel,
|
|
629
|
-
onValueChange,
|
|
630
|
-
value,
|
|
631
|
-
children: /* @__PURE__ */
|
|
632
|
-
...
|
|
633
|
-
isClearable:
|
|
634
|
-
value,
|
|
635
|
-
onChange:
|
|
636
|
-
backspaceRemovesValue:
|
|
637
|
-
hideSelectedOptions:
|
|
638
|
-
controlShouldRenderValue:
|
|
639
|
-
placeholder,
|
|
640
|
-
isLoading:
|
|
641
|
-
inputValue,
|
|
642
|
-
onInputChange
|
|
579
|
+
return /* @__PURE__ */ a(A, {
|
|
580
|
+
noneSelectedLabel: c,
|
|
581
|
+
onValueChange: r,
|
|
582
|
+
value: o,
|
|
583
|
+
children: /* @__PURE__ */ a(ro, {
|
|
584
|
+
...v,
|
|
585
|
+
isClearable: !1,
|
|
586
|
+
value: o,
|
|
587
|
+
onChange: r ? (u) => r([...u]) : void 0,
|
|
588
|
+
backspaceRemovesValue: !1,
|
|
589
|
+
hideSelectedOptions: !0,
|
|
590
|
+
controlShouldRenderValue: !1,
|
|
591
|
+
placeholder: e,
|
|
592
|
+
isLoading: t,
|
|
593
|
+
inputValue: n,
|
|
594
|
+
onInputChange: i
|
|
643
595
|
})
|
|
644
596
|
});
|
|
645
597
|
}
|
|
646
|
-
const
|
|
647
|
-
export {
|
|
598
|
+
const po = T.memo(no);
|
|
599
|
+
export {
|
|
600
|
+
ho as AsyncMultiSelect,
|
|
601
|
+
mo as AsyncSelect,
|
|
602
|
+
Co as ChipMultiSelect,
|
|
603
|
+
po as GroupedChipMultiSelect,
|
|
604
|
+
ro as GroupedMultiSelect,
|
|
605
|
+
W as MultiSelect,
|
|
606
|
+
bo as Select,
|
|
607
|
+
U as createStylesFromTheme,
|
|
608
|
+
x as createStylesFromVariant,
|
|
609
|
+
H as defaultSelectTheme
|
|
610
|
+
};
|
|
648
611
|
//# sourceMappingURL=index.es.js.map
|