@midas-ds/components 15.4.0 → 15.4.1
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 +6 -0
- package/accordion/index.js +1 -1
- package/badge/index.js +1 -1
- package/breadcrumbs/index.js +1 -1
- package/button/index.js +2 -2
- package/calendar/index.js +1 -1
- package/card/index.js +1 -1
- package/character-counter/index.js +1 -1
- package/checkbox/index.js +2 -2
- package/chunks/{AccordionItem-BCoomT4-.js → AccordionItem-69q6FXXl.js} +37 -37
- package/chunks/{BadgeContainer-BJAC-kV0.js → BadgeContainer-CKVsfTlF.js} +1 -1
- package/chunks/Breadcrumbs-By2bMbQd.js +28 -0
- package/chunks/Button-BMf7mX0N.js +46 -0
- package/chunks/{ButtonGroup-B6mr4JGY.js → ButtonGroup-Dr6HOBo2.js} +1 -1
- package/chunks/Card-ia98VoKL.js +130 -0
- package/chunks/CharacterCounter-DeuE2det.js +21 -0
- package/chunks/Checkbox-ClhO-AzB.js +122 -0
- package/chunks/CheckboxGroup-C3FOm8N8.js +84 -0
- package/chunks/{ColorSchemeSwitch-Cd6VSXql.js → ColorSchemeSwitch-DugvPh6T.js} +17 -17
- package/chunks/ComboBox-BqRZMi8W.js +108 -0
- package/chunks/DateField-12KSJHls.js +46 -0
- package/chunks/DateInputDivider-CkTB5q5k.js +36 -0
- package/chunks/DateRangePicker-BLRFvUp0.js +117 -0
- package/chunks/Dialog-C-X_qUR6.js +66 -0
- package/chunks/Dropdown-D7HQo9eM.js +79 -0
- package/chunks/FieldError-C0HRIcAx.js +23 -0
- package/chunks/FileUpload-h1PxqQmb.js +16 -0
- package/chunks/{Grid-DeB7TdcZ.js → Grid-B-WgMwON.js} +2 -2
- package/chunks/{GridItem-B_3FFhPs.js → GridItem-5t1Z14sM.js} +1 -1
- package/chunks/Heading-D8tNNJkt.js +38 -0
- package/chunks/{InfoBanner-Bw3rjGtB.js → InfoBanner-Cc3GhryE.js} +3 -3
- package/chunks/Label-D6WuwdAj.js +73 -0
- package/chunks/{Layout-InD0Hl7F.js → Layout-DGCDkyf3.js} +70 -70
- package/chunks/Link-yTNUNv3C.js +54 -0
- package/chunks/LinkButton-3nAekUJ4.js +63 -0
- package/chunks/{ListBox-CKDglhFH.js → ListBox-D4tO_OrO.js} +18 -18
- package/chunks/ListBoxLoadMoreItem-Bo0eLhpt.js +41 -0
- package/chunks/ListBoxSection-DKHba2X0.js +49 -0
- package/chunks/{Logo-D80UDT1x.js → Logo-InDSslpO.js} +2 -2
- package/chunks/Popover-BAdqdN6C.js +38 -0
- package/chunks/ProgressBar-zeJLxHVL.js +53 -0
- package/chunks/Radio-kvQP7E9s.js +43 -0
- package/chunks/RangeCalendar-CnquULdq.js +99 -0
- package/chunks/{SearchField-Dr3DAs9W.js → SearchField-B6ygRRL4.js} +39 -39
- package/chunks/Select-Cm5VZRTx.js +576 -0
- package/chunks/{Select-fDRXxmLm.js → Select-qmCuJm2x.js} +48 -46
- package/chunks/Separator-BcnQEA9f.js +76 -0
- package/chunks/{Skeleton-Bcg_xgAx.js → Skeleton-DqIHQLQl.js} +1 -1
- package/chunks/Spinner-Pll5zpx8.js +48 -0
- package/chunks/TabList-D2XV5ixe.js +81 -0
- package/chunks/Table-B1rlSIhS.js +139 -0
- package/chunks/Tag-Ca8wKXOy.js +53 -0
- package/chunks/{Text-WP6RbnnK.js → Text-TWzJxnto.js} +9 -9
- package/chunks/TextArea-UU7gFMEb.js +124 -0
- package/chunks/Toast-Cm2Zqq-F.js +162 -0
- package/chunks/ToggleButtonGroup-CXKTrLbb.js +29 -0
- package/chunks/Tooltip-CtstfI8u.js +46 -0
- package/chunks/clsx-AexbMWKp.js +24 -0
- package/chunks/useLocalizedStringFormatter-ZgRJmvHC.js +25 -0
- package/color-scheme-switch/index.js +1 -1
- package/combobox/index.js +1 -1
- package/date-field/index.js +2 -2
- package/date-picker/index.js +1 -1
- package/dropdown/index.js +1 -1
- package/field-error/index.js +1 -1
- package/file-upload/index.js +1 -1
- package/grid/index.js +2 -2
- package/heading/index.js +1 -1
- package/index.js +68 -68
- package/info-banner/index.js +1 -1
- package/label/index.js +1 -1
- package/layout/index.js +1 -1
- package/legacy-select/index.js +1 -1
- package/link/index.js +3 -3
- package/link-button/index.js +3 -3
- package/list-box/index.js +3 -3
- package/logo/index.js +1 -1
- package/menu/index.js +5 -5
- package/modal/index.js +2 -2
- package/package.json +2 -3
- package/popover/index.js +1 -1
- package/progress-bar/index.js +1 -1
- package/radio/index.js +1 -1
- package/search-field/index.js +1 -1
- package/select/index.js +1 -1
- package/skeleton/index.js +1 -1
- package/spinner/index.js +1 -1
- package/table/index.js +1 -1
- package/tabs/index.js +1 -1
- package/tag/index.js +1 -1
- package/text/index.js +1 -1
- package/textfield/index.js +1 -1
- package/toast/index.js +1 -1
- package/toggle-button/index.js +1 -1
- package/tooltip/index.js +1 -1
- package/chunks/Breadcrumbs-CnuqEeOL.js +0 -28
- package/chunks/Button-CHs1wv7n.js +0 -46
- package/chunks/Card-D58EJCcV.js +0 -130
- package/chunks/CharacterCounter-CzCvDmNP.js +0 -21
- package/chunks/Checkbox-CogzFDe3.js +0 -119
- package/chunks/CheckboxGroup-BLx25gqn.js +0 -83
- package/chunks/ComboBox-8YAwADqL.js +0 -108
- package/chunks/DateField-CpbYROK1.js +0 -46
- package/chunks/DateInputDivider-C43xP4is.js +0 -36
- package/chunks/DateRangePicker-CICkmtXG.js +0 -116
- package/chunks/Dialog-DBn9L3SP.js +0 -66
- package/chunks/Dropdown-Cctv2Qpv.js +0 -79
- package/chunks/FieldError-CZKAYQ-n.js +0 -23
- package/chunks/FileUpload-DILt4rAn.js +0 -16
- package/chunks/Heading-DIw3iLMN.js +0 -38
- package/chunks/Label-CKe9pgXT.js +0 -73
- package/chunks/Link-C3w5O2wT.js +0 -54
- package/chunks/LinkButton-D6X0Dvoz.js +0 -63
- package/chunks/ListBoxLoadMoreItem-y9pCuqRe.js +0 -41
- package/chunks/ListBoxSection-CvtRigQb.js +0 -49
- package/chunks/Popover-DktRiuCr.js +0 -38
- package/chunks/ProgressBar-Bjxi5TgY.js +0 -53
- package/chunks/Radio-DqFFcFra.js +0 -43
- package/chunks/RangeCalendar-CIxwICEf.js +0 -99
- package/chunks/Select-BSqv5Qi-.js +0 -566
- package/chunks/Separator-Cw1vlSYO.js +0 -76
- package/chunks/Spinner-B2EAm49Z.js +0 -48
- package/chunks/TabList-BIBQcX2n.js +0 -81
- package/chunks/Table-Cy-R3Ma8.js +0 -139
- package/chunks/Tag-BZnq1_yZ.js +0 -53
- package/chunks/TextArea-3fPkKmNx.js +0 -124
- package/chunks/Toast-CP_V12b3.js +0 -161
- package/chunks/ToggleButtonGroup-CgNeypuW.js +0 -29
- package/chunks/Tooltip-C53p0sfk.js +0 -46
- package/chunks/clsx-CuNqTHjr.js +0 -11
- package/chunks/internationalized-C9snpc7V.js +0 -1955
- package/chunks/react-aria-components-mIKW9wOa.js +0 -22645
- package/chunks/react-stately-DRNKkAB0.js +0 -2586
- package/chunks/useLocalizedStringFormatter-CPwiI7nv.js +0 -25
- package/chunks/variables-BkqZ2WGF.js +0 -5
|
@@ -0,0 +1,576 @@
|
|
|
1
|
+
import { jsx as n, jsxs as h } from "react/jsx-runtime";
|
|
2
|
+
import * as _ from "react";
|
|
3
|
+
import { useMemo as z, useState as V, useCallback as I, useEffect as M, useRef as L } from "react";
|
|
4
|
+
import { c as B } from "./clsx-AexbMWKp.js";
|
|
5
|
+
import { filterDOMProps as D, mergeProps as P, useId as O, chain as N, useFormReset as R, useObjectRef as E } from "@react-aria/utils";
|
|
6
|
+
import { Section as j, Item as x } from "@react-stately/collections";
|
|
7
|
+
import { Collection as G, FieldErrorContext as H, TextField as $, TagList as W } from "react-aria-components";
|
|
8
|
+
import { L as U } from "./ListBox-D4tO_OrO.js";
|
|
9
|
+
import { b as q, L as X, a as J } from "./ListBoxSection-DKHba2X0.js";
|
|
10
|
+
import { useCollator as Q, useField as Y, useButton as Z } from "react-aria";
|
|
11
|
+
import { setInteractionModality as ee } from "@react-aria/interactions";
|
|
12
|
+
import { useMenuTrigger as te } from "@react-aria/menu";
|
|
13
|
+
import { ListKeyboardDelegate as le, useTypeSelect as oe } from "@react-aria/selection";
|
|
14
|
+
import { useMenuTriggerState as ne } from "@react-stately/menu";
|
|
15
|
+
import { useFormValidationState as ie } from "@react-stately/form";
|
|
16
|
+
import { useListState as re } from "@react-stately/list";
|
|
17
|
+
import { a as se, T as ae } from "./Tag-Ca8wKXOy.js";
|
|
18
|
+
import { useFormValidation as ce } from "@react-aria/form";
|
|
19
|
+
import { useVisuallyHidden as de } from "@react-aria/visually-hidden";
|
|
20
|
+
import { a as ue, L as me } from "./Label-D6WuwdAj.js";
|
|
21
|
+
import { T as ge } from "./Text-TWzJxnto.js";
|
|
22
|
+
import { C as fe } from "./Checkbox-ClhO-AzB.js";
|
|
23
|
+
import { X as pe } from "./x-BXShoIAM.js";
|
|
24
|
+
import { u as T } from "./useLocalizedStringFormatter-ZgRJmvHC.js";
|
|
25
|
+
import { C as ye } from "./chevron-down-DgT-uSF9.js";
|
|
26
|
+
import { F as he } from "./FieldError-C0HRIcAx.js";
|
|
27
|
+
import '../assets/Select2.css';const A = ({ item: e }) => /* @__PURE__ */ n(
|
|
28
|
+
X,
|
|
29
|
+
{
|
|
30
|
+
...e.value,
|
|
31
|
+
textValue: e.textValue,
|
|
32
|
+
"aria-label": e.textValue,
|
|
33
|
+
children: e.rendered
|
|
34
|
+
}
|
|
35
|
+
), be = ({ section: e, state: t }) => /* @__PURE__ */ n(q, { ...e.value, children: t.collection.getChildren ? /* @__PURE__ */ n(G, { items: t.collection.getChildren(e.key), children: (s) => /* @__PURE__ */ n(A, { item: s }) }) : null }), Se = ({
|
|
36
|
+
state: e,
|
|
37
|
+
...t
|
|
38
|
+
}) => /* @__PURE__ */ n(
|
|
39
|
+
U,
|
|
40
|
+
{
|
|
41
|
+
...t,
|
|
42
|
+
...e,
|
|
43
|
+
escapeKeyBehavior: "none",
|
|
44
|
+
onSelectionChange: e.setSelectedKeys,
|
|
45
|
+
items: e.collection,
|
|
46
|
+
children: (s) => s.type === "section" ? /* @__PURE__ */ n(
|
|
47
|
+
be,
|
|
48
|
+
{
|
|
49
|
+
state: e,
|
|
50
|
+
section: s
|
|
51
|
+
}
|
|
52
|
+
) : /* @__PURE__ */ n(A, { item: s })
|
|
53
|
+
}
|
|
54
|
+
);
|
|
55
|
+
function ve(e, t, s) {
|
|
56
|
+
const { disallowEmptySelection: r, isDisabled: l } = e, i = Q({ usage: "search", sensitivity: "base" }), o = z(
|
|
57
|
+
() => new le(
|
|
58
|
+
t.collection,
|
|
59
|
+
t.disabledKeys,
|
|
60
|
+
null,
|
|
61
|
+
i
|
|
62
|
+
),
|
|
63
|
+
[t.collection, t.disabledKeys, i]
|
|
64
|
+
), { menuTriggerProps: a, menuProps: d } = te(
|
|
65
|
+
{
|
|
66
|
+
isDisabled: l,
|
|
67
|
+
type: "listbox"
|
|
68
|
+
},
|
|
69
|
+
t,
|
|
70
|
+
s
|
|
71
|
+
), u = (g) => {
|
|
72
|
+
const { selectedKeys: v, selectionMode: k } = t, K = v.values().next().value;
|
|
73
|
+
if (k === "single")
|
|
74
|
+
switch (g.key) {
|
|
75
|
+
case "ArrowLeft": {
|
|
76
|
+
g.preventDefault();
|
|
77
|
+
const S = v.size > 0 ? o.getKeyAbove(K) : o.getFirstKey();
|
|
78
|
+
S && t.setSelectedKeys([S]);
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
case "ArrowRight": {
|
|
82
|
+
g.preventDefault();
|
|
83
|
+
const S = v.size > 0 ? o.getKeyBelow(K) : o.getFirstKey();
|
|
84
|
+
S && t.setSelectedKeys([S]);
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}, { typeSelectProps: c } = oe({
|
|
89
|
+
keyboardDelegate: o,
|
|
90
|
+
selectionManager: t.selectionManager,
|
|
91
|
+
onTypeSelect(g) {
|
|
92
|
+
t.setSelectedKeys([g]);
|
|
93
|
+
}
|
|
94
|
+
}), { labelProps: b, fieldProps: p } = Y({
|
|
95
|
+
...e,
|
|
96
|
+
labelElementType: "span"
|
|
97
|
+
});
|
|
98
|
+
c.onKeyDown = c.onKeyDownCapture, delete c.onKeyDownCapture;
|
|
99
|
+
const m = D(e, { labelable: !0 }), y = P(c, a, p), w = O();
|
|
100
|
+
return {
|
|
101
|
+
labelProps: {
|
|
102
|
+
...b,
|
|
103
|
+
onClick: () => {
|
|
104
|
+
e.isDisabled || (s.current?.focus(), ee("keyboard"));
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
triggerProps: P(m, {
|
|
108
|
+
...y,
|
|
109
|
+
onKeyDown: N(
|
|
110
|
+
y.onKeyDown,
|
|
111
|
+
u,
|
|
112
|
+
e.onKeyDown
|
|
113
|
+
),
|
|
114
|
+
onKeyUp: e.onKeyUp,
|
|
115
|
+
"aria-labelledby": [
|
|
116
|
+
y["aria-labelledby"],
|
|
117
|
+
y["aria-label"] && !y["aria-labelledby"] ? y.id : null,
|
|
118
|
+
w
|
|
119
|
+
].filter(Boolean).join(" "),
|
|
120
|
+
onFocus(g) {
|
|
121
|
+
t.isFocused || (e.onFocus && e.onFocus(g), t.setFocused(!0));
|
|
122
|
+
},
|
|
123
|
+
onBlur(g) {
|
|
124
|
+
t.isOpen || (e.onBlur && e.onBlur(g), t.setFocused(!1));
|
|
125
|
+
}
|
|
126
|
+
}),
|
|
127
|
+
valueProps: {
|
|
128
|
+
id: w
|
|
129
|
+
},
|
|
130
|
+
menuProps: {
|
|
131
|
+
...d,
|
|
132
|
+
disallowEmptySelection: r,
|
|
133
|
+
autoFocus: t.focusStrategy || !0,
|
|
134
|
+
shouldSelectOnPressUp: !0,
|
|
135
|
+
shouldFocusOnHover: !0,
|
|
136
|
+
onBlur: (g) => {
|
|
137
|
+
g.currentTarget.contains(g.relatedTarget) || (e.onBlur && e.onBlur(g), t.setFocused(!1));
|
|
138
|
+
},
|
|
139
|
+
"aria-labelledby": [
|
|
140
|
+
p["aria-labelledby"],
|
|
141
|
+
y["aria-label"] && !p["aria-labelledby"] ? y.id : null
|
|
142
|
+
].filter(Boolean).join(" ")
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
function we(e) {
|
|
147
|
+
const {
|
|
148
|
+
collection: t,
|
|
149
|
+
disabledKeys: s,
|
|
150
|
+
selectionManager: r,
|
|
151
|
+
selectionManager: { setSelectedKeys: l, selectedKeys: i, selectionMode: o }
|
|
152
|
+
} = re(e), a = [], d = i.size !== 0 ? Array.from(i).map((u) => {
|
|
153
|
+
const c = t.getItem(u);
|
|
154
|
+
return c || a.push(u), c;
|
|
155
|
+
}).filter(Boolean) : null;
|
|
156
|
+
return a.length && console.warn(
|
|
157
|
+
`Select: Keys "${a.join(
|
|
158
|
+
", "
|
|
159
|
+
)}" passed to "selectedKeys" are not present in the collection.`
|
|
160
|
+
), {
|
|
161
|
+
collection: t,
|
|
162
|
+
disabledKeys: s,
|
|
163
|
+
selectionManager: r,
|
|
164
|
+
selectionMode: o,
|
|
165
|
+
selectedKeys: i,
|
|
166
|
+
setSelectedKeys: l.bind(r),
|
|
167
|
+
selectedItems: d
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
function Ke(e) {
|
|
171
|
+
const [t, s] = V(!1), r = ne(e), l = e.selectionMode === "single", i = we({
|
|
172
|
+
...e,
|
|
173
|
+
onSelectionChange: (c) => {
|
|
174
|
+
e.onSelectionChange && e.onSelectionChange(c), l && r.close();
|
|
175
|
+
}
|
|
176
|
+
}), o = ie({
|
|
177
|
+
...e,
|
|
178
|
+
validationBehavior: "native",
|
|
179
|
+
value: i.selectedKeys
|
|
180
|
+
}), a = i.collection.size === 0, d = !!i.selectedKeys.size, u = I(() => {
|
|
181
|
+
o.resetValidation(), o.commitValidation();
|
|
182
|
+
}, [o]);
|
|
183
|
+
return M(() => {
|
|
184
|
+
l && d && u();
|
|
185
|
+
}, [d, l, u]), {
|
|
186
|
+
...i,
|
|
187
|
+
...r,
|
|
188
|
+
close() {
|
|
189
|
+
r.close(), d && u();
|
|
190
|
+
},
|
|
191
|
+
open() {
|
|
192
|
+
a || r.open();
|
|
193
|
+
},
|
|
194
|
+
toggle(c) {
|
|
195
|
+
a || r.toggle(c);
|
|
196
|
+
},
|
|
197
|
+
isFocused: t,
|
|
198
|
+
setFocused: s,
|
|
199
|
+
...o
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
function Pe(e, t = {}) {
|
|
203
|
+
const [s, r] = V({ width: 0, height: 0 }), l = t.delay === void 0 ? 500 : t.delay, i = !!t.includePadding;
|
|
204
|
+
return M(() => {
|
|
205
|
+
if (!e) return;
|
|
206
|
+
const o = new ResizeObserver(
|
|
207
|
+
xe(([a]) => {
|
|
208
|
+
const { inlineSize: d, blockSize: u } = i ? a.borderBoxSize[0] : a.contentBoxSize[0];
|
|
209
|
+
r({ width: d, height: u });
|
|
210
|
+
}, l)
|
|
211
|
+
);
|
|
212
|
+
return o.observe(e), () => {
|
|
213
|
+
o.disconnect();
|
|
214
|
+
};
|
|
215
|
+
}, [l, e, i]), s;
|
|
216
|
+
}
|
|
217
|
+
function xe(e, t) {
|
|
218
|
+
let s;
|
|
219
|
+
return (r, l) => {
|
|
220
|
+
clearTimeout(s), s = setTimeout(() => {
|
|
221
|
+
e(r, l);
|
|
222
|
+
}, t);
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
function Ce({
|
|
226
|
+
autoComplete: e,
|
|
227
|
+
name: t,
|
|
228
|
+
isDisabled: s,
|
|
229
|
+
isRequired: r,
|
|
230
|
+
selectRef: l
|
|
231
|
+
}, i, o) {
|
|
232
|
+
const { visuallyHiddenProps: a } = de();
|
|
233
|
+
return R(l, i.selectedKeys, i.setSelectedKeys), ce(
|
|
234
|
+
{
|
|
235
|
+
validationBehavior: "native",
|
|
236
|
+
focus: () => o.current?.focus()
|
|
237
|
+
},
|
|
238
|
+
i,
|
|
239
|
+
l
|
|
240
|
+
), {
|
|
241
|
+
containerProps: {
|
|
242
|
+
...a,
|
|
243
|
+
"aria-hidden": !0,
|
|
244
|
+
// @ts-expect-error - data-a11y-ignore is not a standard attribute
|
|
245
|
+
"data-react-aria-prevent-focus": !0,
|
|
246
|
+
"data-a11y-ignore": "aria-hidden-focus"
|
|
247
|
+
},
|
|
248
|
+
inputProps: {
|
|
249
|
+
style: { display: "none" }
|
|
250
|
+
},
|
|
251
|
+
selectProps: {
|
|
252
|
+
tabIndex: -1,
|
|
253
|
+
autoComplete: e,
|
|
254
|
+
disabled: s,
|
|
255
|
+
required: r,
|
|
256
|
+
name: t,
|
|
257
|
+
value: Array.from(i.selectedKeys).map((d) => d.toString()),
|
|
258
|
+
onChange: (d) => i.setSelectedKeys(d.target.value),
|
|
259
|
+
multiple: !0
|
|
260
|
+
}
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
function _e(e) {
|
|
264
|
+
const { state: t, triggerRef: s, name: r, isDisabled: l } = e, i = `${e.label}-hidden`, o = L(null), { containerProps: a, selectProps: d } = Ce(
|
|
265
|
+
{ ...e, selectRef: o },
|
|
266
|
+
t,
|
|
267
|
+
s
|
|
268
|
+
);
|
|
269
|
+
return t.collection.size <= 300 ? /* @__PURE__ */ n(
|
|
270
|
+
"div",
|
|
271
|
+
{
|
|
272
|
+
...a,
|
|
273
|
+
"data-testid": "hidden-select-container",
|
|
274
|
+
children: /* @__PURE__ */ h("label", { children: [
|
|
275
|
+
i,
|
|
276
|
+
/* @__PURE__ */ h(
|
|
277
|
+
"select",
|
|
278
|
+
{
|
|
279
|
+
...d,
|
|
280
|
+
ref: o,
|
|
281
|
+
children: [
|
|
282
|
+
/* @__PURE__ */ n("option", {}),
|
|
283
|
+
[...t.collection.getKeys()].map((u) => {
|
|
284
|
+
const c = t.collection.getItem(u);
|
|
285
|
+
return c && c.type === "item" ? /* @__PURE__ */ n(
|
|
286
|
+
"option",
|
|
287
|
+
{
|
|
288
|
+
value: c.key,
|
|
289
|
+
children: c.textValue
|
|
290
|
+
},
|
|
291
|
+
c.key
|
|
292
|
+
) : null;
|
|
293
|
+
})
|
|
294
|
+
]
|
|
295
|
+
}
|
|
296
|
+
)
|
|
297
|
+
] })
|
|
298
|
+
}
|
|
299
|
+
) : r ? /* @__PURE__ */ n(
|
|
300
|
+
"input",
|
|
301
|
+
{
|
|
302
|
+
type: "hidden",
|
|
303
|
+
autoComplete: d.autoComplete,
|
|
304
|
+
name: r,
|
|
305
|
+
disabled: l,
|
|
306
|
+
value: Array.from(t.selectedKeys).map((u) => u.toString()) ?? [""]
|
|
307
|
+
}
|
|
308
|
+
) : null;
|
|
309
|
+
}
|
|
310
|
+
const Ve = "_wrapper_1rw0v_7", Me = "_trigger_1rw0v_18", Be = "_medium_1rw0v_32", Te = "_icon_1rw0v_68", Ae = "_tagGroup_1rw0v_74", Fe = "_triggerContainer_1rw0v_95", ke = "_selectValueTag_1rw0v_101", ze = "_clearButton_1rw0v_117", Ie = "_truncate_1rw0v_129", Le = "_selectAll_1rw0v_172", f = {
|
|
311
|
+
wrapper: Ve,
|
|
312
|
+
trigger: Me,
|
|
313
|
+
medium: Be,
|
|
314
|
+
icon: Te,
|
|
315
|
+
tagGroup: Ae,
|
|
316
|
+
triggerContainer: Fe,
|
|
317
|
+
selectValueTag: ke,
|
|
318
|
+
clearButton: ze,
|
|
319
|
+
truncate: Ie,
|
|
320
|
+
selectAll: Le
|
|
321
|
+
}, De = { clearAll: "Clear all", selectAll: "Select all", selectedItems: "Selected items", chosen: "chosen" }, Oe = { clearAll: "Rensa alla", selectAll: "Välj alla", selectedItems: "Valda objekt", chosen: "valda" }, F = {
|
|
322
|
+
en: De,
|
|
323
|
+
sv: Oe
|
|
324
|
+
}, Ne = ({
|
|
325
|
+
state: { selectedItems: e },
|
|
326
|
+
isDisabled: t,
|
|
327
|
+
parentWidth: s,
|
|
328
|
+
onClear: r,
|
|
329
|
+
triggerRef: l,
|
|
330
|
+
isClearable: i
|
|
331
|
+
}) => {
|
|
332
|
+
const o = T(F);
|
|
333
|
+
return /* @__PURE__ */ h(
|
|
334
|
+
"div",
|
|
335
|
+
{
|
|
336
|
+
className: f.selectValueTag,
|
|
337
|
+
"data-disabled": t || void 0,
|
|
338
|
+
children: [
|
|
339
|
+
/* @__PURE__ */ n(
|
|
340
|
+
"span",
|
|
341
|
+
{
|
|
342
|
+
className: f.truncate,
|
|
343
|
+
style: { maxWidth: s - 92 },
|
|
344
|
+
children: e?.length && e.length > 1 ? `${e.length} ${o.format("chosen")}` : e?.[0].textValue
|
|
345
|
+
}
|
|
346
|
+
),
|
|
347
|
+
i && /* @__PURE__ */ n(
|
|
348
|
+
"button",
|
|
349
|
+
{
|
|
350
|
+
disabled: t,
|
|
351
|
+
"aria-label": o.format("clearAll"),
|
|
352
|
+
className: f.clearButton,
|
|
353
|
+
onClick: () => {
|
|
354
|
+
r(), l?.current?.focus();
|
|
355
|
+
},
|
|
356
|
+
children: /* @__PURE__ */ n(
|
|
357
|
+
pe,
|
|
358
|
+
{
|
|
359
|
+
width: 20,
|
|
360
|
+
height: 20
|
|
361
|
+
}
|
|
362
|
+
)
|
|
363
|
+
}
|
|
364
|
+
)
|
|
365
|
+
]
|
|
366
|
+
}
|
|
367
|
+
);
|
|
368
|
+
}, Re = ({
|
|
369
|
+
autoFocus: e,
|
|
370
|
+
excludeFromTabOrder: t,
|
|
371
|
+
isDisabled: s,
|
|
372
|
+
size: r = "large",
|
|
373
|
+
isOpen: l,
|
|
374
|
+
isInvalid: i,
|
|
375
|
+
selectionMode: o,
|
|
376
|
+
state: { selectedItems: a },
|
|
377
|
+
placeholder: d,
|
|
378
|
+
children: u,
|
|
379
|
+
triggerRef: c,
|
|
380
|
+
...b
|
|
381
|
+
}) => {
|
|
382
|
+
const { buttonProps: p } = Z(
|
|
383
|
+
{ autoFocus: e, excludeFromTabOrder: t, isDisabled: s, ...b },
|
|
384
|
+
c
|
|
385
|
+
), m = o === "multiple";
|
|
386
|
+
return /* @__PURE__ */ h(
|
|
387
|
+
"div",
|
|
388
|
+
{
|
|
389
|
+
className: f.triggerContainer,
|
|
390
|
+
"data-disabled": s || void 0,
|
|
391
|
+
children: [
|
|
392
|
+
/* @__PURE__ */ h(
|
|
393
|
+
"button",
|
|
394
|
+
{
|
|
395
|
+
...p,
|
|
396
|
+
autoFocus: e,
|
|
397
|
+
className: B(f.trigger, {
|
|
398
|
+
[f.medium]: r === "medium"
|
|
399
|
+
}),
|
|
400
|
+
"data-disabled": s || void 0,
|
|
401
|
+
"data-invalid": i || void 0,
|
|
402
|
+
"data-open": l || void 0,
|
|
403
|
+
ref: c,
|
|
404
|
+
type: "button",
|
|
405
|
+
children: [
|
|
406
|
+
m && !a ? /* @__PURE__ */ n("span", { children: d }) : null,
|
|
407
|
+
m ? null : /* @__PURE__ */ n("span", { children: a ? a[0].textValue : d }),
|
|
408
|
+
/* @__PURE__ */ n(
|
|
409
|
+
"div",
|
|
410
|
+
{
|
|
411
|
+
className: f.icon,
|
|
412
|
+
"aria-hidden": "true",
|
|
413
|
+
children: /* @__PURE__ */ n(ye, { size: 20 })
|
|
414
|
+
}
|
|
415
|
+
)
|
|
416
|
+
]
|
|
417
|
+
}
|
|
418
|
+
),
|
|
419
|
+
u
|
|
420
|
+
]
|
|
421
|
+
}
|
|
422
|
+
);
|
|
423
|
+
}, C = ({
|
|
424
|
+
state: e,
|
|
425
|
+
errorMessage: t
|
|
426
|
+
}) => /* @__PURE__ */ n(H.Provider, { value: { ...e.displayValidation }, children: /* @__PURE__ */ n(he, { children: t }) }), Ee = _.forwardRef(
|
|
427
|
+
({ isClearable: e = !0, popover: t, ...s }, r) => {
|
|
428
|
+
const l = {
|
|
429
|
+
selectionMode: "single",
|
|
430
|
+
errorPosition: "top",
|
|
431
|
+
disallowEmptySelection: !e,
|
|
432
|
+
isClearable: e,
|
|
433
|
+
size: "large",
|
|
434
|
+
popover: t,
|
|
435
|
+
...s
|
|
436
|
+
}, i = E(r), o = Ke(l), a = T(F), { labelProps: d, triggerProps: u, valueProps: c, menuProps: b } = ve(
|
|
437
|
+
l,
|
|
438
|
+
o,
|
|
439
|
+
i
|
|
440
|
+
), { width: p } = Pe(i.current, {
|
|
441
|
+
includePadding: !0
|
|
442
|
+
});
|
|
443
|
+
return /* @__PURE__ */ h(
|
|
444
|
+
$,
|
|
445
|
+
{
|
|
446
|
+
...l,
|
|
447
|
+
className: B(f.wrapper, l.className),
|
|
448
|
+
children: [
|
|
449
|
+
/* @__PURE__ */ n(
|
|
450
|
+
_e,
|
|
451
|
+
{
|
|
452
|
+
...l,
|
|
453
|
+
state: o,
|
|
454
|
+
triggerRef: i
|
|
455
|
+
}
|
|
456
|
+
),
|
|
457
|
+
/* @__PURE__ */ n(ue, { popover: t, children: l.label && /* @__PURE__ */ n(
|
|
458
|
+
me,
|
|
459
|
+
{
|
|
460
|
+
...d,
|
|
461
|
+
"data-disabled": l.isDisabled || void 0,
|
|
462
|
+
children: l.label
|
|
463
|
+
}
|
|
464
|
+
) }),
|
|
465
|
+
l.description && /* @__PURE__ */ n(ge, { slot: "description", children: l.description }),
|
|
466
|
+
l.errorPosition === "top" && /* @__PURE__ */ n(
|
|
467
|
+
C,
|
|
468
|
+
{
|
|
469
|
+
...l,
|
|
470
|
+
state: o
|
|
471
|
+
}
|
|
472
|
+
),
|
|
473
|
+
/* @__PURE__ */ n(
|
|
474
|
+
Re,
|
|
475
|
+
{
|
|
476
|
+
...l,
|
|
477
|
+
...u,
|
|
478
|
+
isInvalid: o.displayValidation.isInvalid,
|
|
479
|
+
triggerRef: i,
|
|
480
|
+
state: o,
|
|
481
|
+
children: l.selectionMode === "multiple" && o.selectedItems ? /* @__PURE__ */ n("span", { ...c, children: /* @__PURE__ */ n(
|
|
482
|
+
Ne,
|
|
483
|
+
{
|
|
484
|
+
...l,
|
|
485
|
+
state: o,
|
|
486
|
+
parentWidth: p,
|
|
487
|
+
onClear: () => o.selectionManager.clearSelection(),
|
|
488
|
+
triggerRef: i
|
|
489
|
+
}
|
|
490
|
+
) }) : null
|
|
491
|
+
}
|
|
492
|
+
),
|
|
493
|
+
l.errorPosition === "bottom" && /* @__PURE__ */ n(
|
|
494
|
+
C,
|
|
495
|
+
{
|
|
496
|
+
...l,
|
|
497
|
+
state: o
|
|
498
|
+
}
|
|
499
|
+
),
|
|
500
|
+
/* @__PURE__ */ h(
|
|
501
|
+
J,
|
|
502
|
+
{
|
|
503
|
+
isOpen: o.isOpen,
|
|
504
|
+
onOpenChange: (m) => {
|
|
505
|
+
m || o.close();
|
|
506
|
+
},
|
|
507
|
+
triggerRef: i,
|
|
508
|
+
style: { width: p },
|
|
509
|
+
children: [
|
|
510
|
+
l.isSelectableAll && /* @__PURE__ */ n(
|
|
511
|
+
fe,
|
|
512
|
+
{
|
|
513
|
+
isSelected: o.selectionManager.isSelectAll,
|
|
514
|
+
isIndeterminate: !o.selectionManager.isSelectAll && !o.selectionManager.isEmpty,
|
|
515
|
+
className: f.selectAll,
|
|
516
|
+
onChange: () => o.selectionManager.toggleSelectAll(),
|
|
517
|
+
children: a.format("selectAll")
|
|
518
|
+
}
|
|
519
|
+
),
|
|
520
|
+
/* @__PURE__ */ n(
|
|
521
|
+
Se,
|
|
522
|
+
{
|
|
523
|
+
...b,
|
|
524
|
+
state: o
|
|
525
|
+
}
|
|
526
|
+
)
|
|
527
|
+
]
|
|
528
|
+
}
|
|
529
|
+
),
|
|
530
|
+
l.showTags && !!o.selectedItems && /* @__PURE__ */ n(
|
|
531
|
+
se,
|
|
532
|
+
{
|
|
533
|
+
"aria-label": a.format("selectedItems"),
|
|
534
|
+
selectionBehavior: "toggle",
|
|
535
|
+
onRemove: (m) => o.selectionManager.toggleSelection(Array.from(m)[0]),
|
|
536
|
+
className: f.tagGroup,
|
|
537
|
+
children: /* @__PURE__ */ n(W, { items: o.selectedItems, children: (m) => /* @__PURE__ */ n(
|
|
538
|
+
ae,
|
|
539
|
+
{
|
|
540
|
+
textValue: m.textValue,
|
|
541
|
+
id: m.key,
|
|
542
|
+
dismissable: !0,
|
|
543
|
+
isDisabled: l.isDisabled,
|
|
544
|
+
children: m.textValue
|
|
545
|
+
},
|
|
546
|
+
m.key
|
|
547
|
+
) })
|
|
548
|
+
}
|
|
549
|
+
)
|
|
550
|
+
]
|
|
551
|
+
}
|
|
552
|
+
);
|
|
553
|
+
}
|
|
554
|
+
), je = _.forwardRef(
|
|
555
|
+
({ options: e, ...t }, s) => /* @__PURE__ */ n(
|
|
556
|
+
Ee,
|
|
557
|
+
{
|
|
558
|
+
...t,
|
|
559
|
+
items: e,
|
|
560
|
+
ref: s,
|
|
561
|
+
children: (r) => r.children ? /* @__PURE__ */ n(
|
|
562
|
+
j,
|
|
563
|
+
{
|
|
564
|
+
items: r.children,
|
|
565
|
+
title: r.name,
|
|
566
|
+
children: (l) => /* @__PURE__ */ n(x, { textValue: l.textValue, children: l.name })
|
|
567
|
+
},
|
|
568
|
+
r.name
|
|
569
|
+
) : /* @__PURE__ */ n(x, { textValue: r.textValue, children: r.name })
|
|
570
|
+
}
|
|
571
|
+
)
|
|
572
|
+
);
|
|
573
|
+
je.displayName = "Select";
|
|
574
|
+
export {
|
|
575
|
+
je as S
|
|
576
|
+
};
|