@midas-ds/components 1.0.2
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/Breadcrumbs.css +1 -0
- package/Button-CCevm2s3.js +183 -0
- package/Button.css +1 -0
- package/ButtonGroup.css +1 -0
- package/CHANGELOG.md +76 -0
- package/Card.css +1 -0
- package/Checkbox-CllWDBxF.js +405 -0
- package/Checkbox.css +1 -0
- package/Collection-B3xUVWPF.js +483 -0
- package/ComboBox.css +1 -0
- package/DatePicker.css +1 -0
- package/Dialog-CLTyYwkS.js +1889 -0
- package/DragAndDrop-OTN7La7U.js +42 -0
- package/Dropdown.css +1 -0
- package/FileUpload.css +1 -0
- package/Flex.css +1 -0
- package/Flex.module-CpoxBzQX.js +37 -0
- package/FocusScope-BR0SJ-cZ.js +512 -0
- package/Form-DXLoQL91.js +240 -0
- package/Grid.css +1 -0
- package/Grid.module-Ia0e9Dix.js +36 -0
- package/Group-DPMuN3h8.js +44 -0
- package/Hidden-BQWDvze4.js +37 -0
- package/InfoBanner.css +1 -0
- package/Label-C18A_4Z5.js +69 -0
- package/Layout.css +1 -0
- package/Link-BU1h3K2a.js +77 -0
- package/Link.css +1 -0
- package/LinkButton.css +1 -0
- package/ListBox-D21tdwTs.js +463 -0
- package/ListKeyboardDelegate-DxMjfMsI.js +172 -0
- package/Logo.css +1 -0
- package/Modal.css +1 -0
- package/MultiSelect.css +1 -0
- package/PressResponder-DP8ZDNGy.js +31 -0
- package/README.md +7 -0
- package/RSPContexts-EOiWkKOf.js +11 -0
- package/Radio.css +1 -0
- package/SearchField.css +1 -0
- package/Select.css +1 -0
- package/SelectionManager-D4WtKtey.js +988 -0
- package/Separator-DLUHK9vv.js +48 -0
- package/Spinner.css +1 -0
- package/Table.css +1 -0
- package/Tabs.css +1 -0
- package/Tag-CEd6WWSc.js +725 -0
- package/Tag.css +1 -0
- package/Text-DGLaY3HR.js +17 -0
- package/TextArea.css +1 -0
- package/TextField-C_hq9WeT.js +226 -0
- package/TextField.css +1 -0
- package/TextField.module-Cwq1FAm7.js +141 -0
- package/Toast.css +1 -0
- package/VisuallyHidden-B_XzVvlX.js +39 -0
- package/accordion/Accordion.d.ts +13 -0
- package/accordion/AccordionContent.d.ts +3 -0
- package/accordion/AccordionItem.d.ts +3 -0
- package/accordion/AccordionTagContext.d.ts +3 -0
- package/accordion/AccordionTrigger.d.ts +3 -0
- package/accordion/index.d.ts +5 -0
- package/breadcrumbs/Breadcrumbs.d.ts +9 -0
- package/breadcrumbs/index.d.ts +1 -0
- package/button/Button.d.ts +41 -0
- package/button/ButtonGroup.d.ts +12 -0
- package/button/index.d.ts +2 -0
- package/card/Card.d.ts +34 -0
- package/card/index.d.ts +1 -0
- package/checkbox/Checkbox.d.ts +2 -0
- package/checkbox/CheckboxGroup.d.ts +10 -0
- package/checkbox/index.d.ts +2 -0
- package/chevron-down-Cd1bkzXT.js +13 -0
- package/chevron-right-DBMc9VMi.js +23 -0
- package/clsx-OuTLNxxd.js +16 -0
- package/combobox/ComboBox.d.ts +12 -0
- package/combobox/index.d.ts +1 -0
- package/context-ScOIq_Gu.js +80 -0
- package/createLucideIcon-DeWljiyi.js +79 -0
- package/date-picker/DatePicker.d.ts +14 -0
- package/date-picker/index.d.ts +2 -0
- package/dropdown/Dropdown.d.ts +8 -0
- package/dropdown/index.d.ts +1 -0
- package/file-upload/FileUpload.d.ts +11 -0
- package/file-upload/index.d.ts +1 -0
- package/flex/Flex.d.ts +17 -0
- package/flex/FlexItem.d.ts +15 -0
- package/flex/index.d.ts +2 -0
- package/grid/Grid.d.ts +16 -0
- package/grid/GridItem.d.ts +7 -0
- package/grid/index.d.ts +2 -0
- package/index-CEg5vZQH.js +132 -0
- package/index-CgfokhRq.js +674 -0
- package/index-CorR1LBD.js +3122 -0
- package/index-Dl1Q-tbj.js +26984 -0
- package/index.css +1 -0
- package/index.d.ts +29 -0
- package/index.js +114 -0
- package/index10.js +4 -0
- package/index11.js +5 -0
- package/index12.js +4 -0
- package/index13.js +4 -0
- package/index14.js +4 -0
- package/index15.js +6 -0
- package/index16.js +6 -0
- package/index17.js +6 -0
- package/index18.js +4 -0
- package/index19.js +6 -0
- package/index2.js +8 -0
- package/index20.js +6 -0
- package/index21.js +4 -0
- package/index22.js +5 -0
- package/index23.js +5 -0
- package/index24.js +5 -0
- package/index25.js +6 -0
- package/index26.js +6 -0
- package/index27.js +6 -0
- package/index28.js +4 -0
- package/index29.js +12 -0
- package/index3.js +8 -0
- package/index30.js +20 -0
- package/index31.js +22 -0
- package/index32.js +14 -0
- package/index33.js +11 -0
- package/index34.js +31 -0
- package/index35.js +8 -0
- package/index36.js +9 -0
- package/index37.js +19 -0
- package/index38.js +9 -0
- package/index39.js +9 -0
- package/index4.js +4 -0
- package/index40.js +16 -0
- package/index41.js +16 -0
- package/index42.js +31 -0
- package/index43.js +16 -0
- package/index44.js +6 -0
- package/index45.js +53 -0
- package/index46.js +18 -0
- package/index47.js +27 -0
- package/index48.js +18 -0
- package/index49.js +21 -0
- package/index5.js +5 -0
- package/index50.js +49 -0
- package/index51.js +5 -0
- package/index52.js +25 -0
- package/index53.js +18 -0
- package/index54.js +9 -0
- package/index55.js +25 -0
- package/index56.js +18 -0
- package/index57.js +11 -0
- package/index58.js +12 -0
- package/index59.js +15 -0
- package/index6.js +4 -0
- package/index60.js +9 -0
- package/index61.js +9 -0
- package/index62.js +19 -0
- package/index63.js +22 -0
- package/index64.js +61 -0
- package/index65.js +15 -0
- package/index66.js +11 -0
- package/index67.js +63 -0
- package/index68.js +85 -0
- package/index69.js +74 -0
- package/index7.js +9 -0
- package/index70.js +24 -0
- package/index71.js +69 -0
- package/index72.js +80 -0
- package/index73.js +140 -0
- package/index74.js +70 -0
- package/index75.js +42 -0
- package/index76.js +82 -0
- package/index77.js +71 -0
- package/index78.js +104 -0
- package/index79.js +274 -0
- package/index8.js +4 -0
- package/index80.js +724 -0
- package/index81.js +491 -0
- package/index82.js +317 -0
- package/index83.js +391 -0
- package/index84.js +254 -0
- package/index85.js +1364 -0
- package/index86.js +1009 -0
- package/index87.js +388 -0
- package/index88.js +2105 -0
- package/index89.js +2371 -0
- package/index9.js +5 -0
- package/index90.js +6834 -0
- package/index91.js +17 -0
- package/index92.js +14 -0
- package/index93.js +6 -0
- package/index94.js +9 -0
- package/info-banner/InfoBanner.d.ts +21 -0
- package/info-banner/index.d.ts +1 -0
- package/intlStrings-Cd44R5hT.js +278 -0
- package/layout/Layout.d.ts +51 -0
- package/layout/index.d.ts +1 -0
- package/link/Link.d.ts +13 -0
- package/link/index.d.ts +1 -0
- package/link-button/LinkButton.d.ts +18 -0
- package/link-button/index.d.ts +1 -0
- package/logo/Logo.d.ts +16 -0
- package/logo/index.d.ts +1 -0
- package/modal/Modal.d.ts +13 -0
- package/modal/index.d.ts +1 -0
- package/multi-select/MultiSelect.d.ts +28 -0
- package/multi-select/index.d.ts +1 -0
- package/package.json +29 -0
- package/radio/Radio.d.ts +20 -0
- package/radio/index.d.ts +1 -0
- package/react.esm-D8HpDGKP.js +11060 -0
- package/search-field/SearchField.d.ts +13 -0
- package/search-field/index.d.ts +1 -0
- package/select/Select.d.ts +11 -0
- package/select/index.d.ts +1 -0
- package/spinner/Spinner.d.ts +11 -0
- package/spinner/index.d.ts +1 -0
- package/table/Table.d.ts +12 -0
- package/table/index.d.ts +1 -0
- package/tabs/Tabs.d.ts +12 -0
- package/tabs/index.d.ts +1 -0
- package/tag/Tag.d.ts +11 -0
- package/tag/index.d.ts +1 -0
- package/textarea/TextArea.d.ts +20 -0
- package/textarea/index.d.ts +1 -0
- package/textfield/TextField.d.ts +16 -0
- package/textfield/index.d.ts +3 -0
- package/theme/index.d.ts +138 -0
- package/theme/tokens.d.ts +135 -0
- package/toast/Toast.d.ts +25 -0
- package/toast/index.d.ts +1 -0
- package/tokens-CjXmpXTi.js +160 -0
- package/triangle-alert-1OYl9KWz.js +56 -0
- package/useControlledState-S_TYcV_c.js +45 -0
- package/useDescription-D4_zk_sA.js +32 -0
- package/useFilter-BnJDBCkt.js +35 -0
- package/useFocusRing-D97-G3fT.js +1324 -0
- package/useFocusable-C-N9wcwm.js +56 -0
- package/useGridSelectionCheckbox-i1rsjlC-.js +22 -0
- package/useHasTabbableChild-DeuCnGGv.js +34 -0
- package/useHighlightSelectionDescription-JVx2MW_e.js +552 -0
- package/useListState-DSOTbsL3.js +119 -0
- package/useLocalizedStringFormatter-DVCAZqcL.js +96 -0
- package/useSingleSelectListState-CmX9_L5H.js +34 -0
- package/useUpdateEffect-Dtz-i14F.js +12 -0
- package/x-JK7i-TQC.js +14 -0
package/index80.js
ADDED
|
@@ -0,0 +1,724 @@
|
|
|
1
|
+
import { jsx as y, jsxs as C } from "react/jsx-runtime";
|
|
2
|
+
import { a as de, $ as ne } from "./Button-CCevm2s3.js";
|
|
3
|
+
import { i as X, b as se, c as Y, d as N, e as Z, n as ee, x as z, A as L, a as ce } from "./useFocusRing-D97-G3fT.js";
|
|
4
|
+
import { d as fe, a as ue } from "./Dialog-CLTyYwkS.js";
|
|
5
|
+
import { d as pe } from "./Form-DXLoQL91.js";
|
|
6
|
+
import { $ as be } from "./RSPContexts-EOiWkKOf.js";
|
|
7
|
+
import { $ as me, a as V, b as $e, c as ge, d as ve } from "./Collection-B3xUVWPF.js";
|
|
8
|
+
import { $ as M, a as ye, b as xe, c as De } from "./DragAndDrop-OTN7La7U.js";
|
|
9
|
+
import { $ as _ } from "./ListBox-D21tdwTs.js";
|
|
10
|
+
import { $ as he } from "./Text-DGLaY3HR.js";
|
|
11
|
+
import * as H from "react";
|
|
12
|
+
import c, { useState as Se, useMemo as te, forwardRef as re, useContext as E, useRef as P, useEffect as F, createContext as Pe } from "react";
|
|
13
|
+
import { $ as we, b as ke, c as Ie, a as Ee, T as Ke } from "./Tag-CEd6WWSc.js";
|
|
14
|
+
import { $ as Te } from "./useGridSelectionCheckbox-i1rsjlC-.js";
|
|
15
|
+
import { a as He } from "./FocusScope-BR0SJ-cZ.js";
|
|
16
|
+
import { $ as G } from "./VisuallyHidden-B_XzVvlX.js";
|
|
17
|
+
import { $ as Ae } from "./useListState-DSOTbsL3.js";
|
|
18
|
+
import { $ as Be, a as J } from "./ListKeyboardDelegate-DxMjfMsI.js";
|
|
19
|
+
import { $ as Re } from "./context-ScOIq_Gu.js";
|
|
20
|
+
import { I as Ce } from "./TextField-C_hq9WeT.js";
|
|
21
|
+
import { C as Me } from "./Checkbox-CllWDBxF.js";
|
|
22
|
+
import { C as Le } from "./chevron-down-Cd1bkzXT.js";
|
|
23
|
+
import './MultiSelect.css';function Ve(l, i) {
|
|
24
|
+
let { key: d } = l;
|
|
25
|
+
const { checkboxProps: e } = Te(l, i);
|
|
26
|
+
return {
|
|
27
|
+
checkboxProps: {
|
|
28
|
+
...e,
|
|
29
|
+
"aria-labelledby": `${e.id} ${we(i, d)}`
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
function _e(l) {
|
|
34
|
+
let { initialItems: i = [], initialSelectedKeys: d, getKey: e = (f) => {
|
|
35
|
+
var n;
|
|
36
|
+
return (n = f.id) !== null && n !== void 0 ? n : f.key;
|
|
37
|
+
}, filter: o, initialFilterText: t = "" } = l, [r, a] = Se({
|
|
38
|
+
items: i,
|
|
39
|
+
selectedKeys: d === "all" ? "all" : new Set(d || []),
|
|
40
|
+
filterText: t
|
|
41
|
+
}), s = te(() => o ? r.items.filter((f) => o(f, r.filterText)) : r.items, [
|
|
42
|
+
r.items,
|
|
43
|
+
r.filterText,
|
|
44
|
+
o
|
|
45
|
+
]);
|
|
46
|
+
return {
|
|
47
|
+
...r,
|
|
48
|
+
items: s,
|
|
49
|
+
...Fe({
|
|
50
|
+
getKey: e
|
|
51
|
+
}, a),
|
|
52
|
+
getItem(f) {
|
|
53
|
+
return r.items.find((n) => e(n) === f);
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
function Fe(l, i) {
|
|
58
|
+
let { cursor: d, getKey: e } = l;
|
|
59
|
+
return {
|
|
60
|
+
setSelectedKeys(o) {
|
|
61
|
+
i((t) => ({
|
|
62
|
+
...t,
|
|
63
|
+
selectedKeys: o
|
|
64
|
+
}));
|
|
65
|
+
},
|
|
66
|
+
setFilterText(o) {
|
|
67
|
+
i((t) => ({
|
|
68
|
+
...t,
|
|
69
|
+
filterText: o
|
|
70
|
+
}));
|
|
71
|
+
},
|
|
72
|
+
insert(o, ...t) {
|
|
73
|
+
i((r) => A(r, o, ...t));
|
|
74
|
+
},
|
|
75
|
+
insertBefore(o, ...t) {
|
|
76
|
+
i((r) => {
|
|
77
|
+
let a = r.items.findIndex((s) => (e == null ? void 0 : e(s)) === o);
|
|
78
|
+
if (a === -1)
|
|
79
|
+
if (r.items.length === 0) a = 0;
|
|
80
|
+
else return r;
|
|
81
|
+
return A(r, a, ...t);
|
|
82
|
+
});
|
|
83
|
+
},
|
|
84
|
+
insertAfter(o, ...t) {
|
|
85
|
+
i((r) => {
|
|
86
|
+
let a = r.items.findIndex((s) => (e == null ? void 0 : e(s)) === o);
|
|
87
|
+
if (a === -1)
|
|
88
|
+
if (r.items.length === 0) a = 0;
|
|
89
|
+
else return r;
|
|
90
|
+
return A(r, a + 1, ...t);
|
|
91
|
+
});
|
|
92
|
+
},
|
|
93
|
+
prepend(...o) {
|
|
94
|
+
i((t) => A(t, 0, ...o));
|
|
95
|
+
},
|
|
96
|
+
append(...o) {
|
|
97
|
+
i((t) => A(t, t.items.length, ...o));
|
|
98
|
+
},
|
|
99
|
+
remove(...o) {
|
|
100
|
+
i((t) => {
|
|
101
|
+
let r = new Set(o), a = t.items.filter((f) => !r.has(e(f))), s = "all";
|
|
102
|
+
if (t.selectedKeys !== "all") {
|
|
103
|
+
s = new Set(t.selectedKeys);
|
|
104
|
+
for (let f of o) s.delete(f);
|
|
105
|
+
}
|
|
106
|
+
return d == null && a.length === 0 && (s = /* @__PURE__ */ new Set()), {
|
|
107
|
+
...t,
|
|
108
|
+
items: a,
|
|
109
|
+
selectedKeys: s
|
|
110
|
+
};
|
|
111
|
+
});
|
|
112
|
+
},
|
|
113
|
+
removeSelectedItems() {
|
|
114
|
+
i((o) => {
|
|
115
|
+
if (o.selectedKeys === "all") return {
|
|
116
|
+
...o,
|
|
117
|
+
items: [],
|
|
118
|
+
selectedKeys: /* @__PURE__ */ new Set()
|
|
119
|
+
};
|
|
120
|
+
let t = o.selectedKeys, r = o.items.filter((a) => !t.has(e(a)));
|
|
121
|
+
return {
|
|
122
|
+
...o,
|
|
123
|
+
items: r,
|
|
124
|
+
selectedKeys: /* @__PURE__ */ new Set()
|
|
125
|
+
};
|
|
126
|
+
});
|
|
127
|
+
},
|
|
128
|
+
move(o, t) {
|
|
129
|
+
i((r) => {
|
|
130
|
+
let a = r.items.findIndex((n) => e(n) === o);
|
|
131
|
+
if (a === -1) return r;
|
|
132
|
+
let s = r.items.slice(), [f] = s.splice(a, 1);
|
|
133
|
+
return s.splice(t, 0, f), {
|
|
134
|
+
...r,
|
|
135
|
+
items: s
|
|
136
|
+
};
|
|
137
|
+
});
|
|
138
|
+
},
|
|
139
|
+
moveBefore(o, t) {
|
|
140
|
+
i((r) => {
|
|
141
|
+
let a = r.items.findIndex((n) => e(n) === o);
|
|
142
|
+
if (a === -1) return r;
|
|
143
|
+
let f = (Array.isArray(t) ? t : [
|
|
144
|
+
...t
|
|
145
|
+
]).map((n) => r.items.findIndex((m) => e(m) === n)).sort((n, m) => n - m);
|
|
146
|
+
return Q(r, f, a);
|
|
147
|
+
});
|
|
148
|
+
},
|
|
149
|
+
moveAfter(o, t) {
|
|
150
|
+
i((r) => {
|
|
151
|
+
let a = r.items.findIndex((n) => e(n) === o);
|
|
152
|
+
if (a === -1) return r;
|
|
153
|
+
let f = (Array.isArray(t) ? t : [
|
|
154
|
+
...t
|
|
155
|
+
]).map((n) => r.items.findIndex((m) => e(m) === n)).sort((n, m) => n - m);
|
|
156
|
+
return Q(r, f, a + 1);
|
|
157
|
+
});
|
|
158
|
+
},
|
|
159
|
+
update(o, t) {
|
|
160
|
+
i((r) => {
|
|
161
|
+
let a = r.items.findIndex((s) => e(s) === o);
|
|
162
|
+
return a === -1 ? r : {
|
|
163
|
+
...r,
|
|
164
|
+
items: [
|
|
165
|
+
...r.items.slice(0, a),
|
|
166
|
+
t,
|
|
167
|
+
...r.items.slice(a + 1)
|
|
168
|
+
]
|
|
169
|
+
};
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
function A(l, i, ...d) {
|
|
175
|
+
return {
|
|
176
|
+
...l,
|
|
177
|
+
items: [
|
|
178
|
+
...l.items.slice(0, i),
|
|
179
|
+
...d,
|
|
180
|
+
...l.items.slice(i)
|
|
181
|
+
]
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
function Q(l, i, d) {
|
|
185
|
+
d -= i.filter((t) => t < d).length;
|
|
186
|
+
let e = i.map((t) => ({
|
|
187
|
+
from: t,
|
|
188
|
+
to: d++
|
|
189
|
+
}));
|
|
190
|
+
for (let t = 0; t < e.length; t++) {
|
|
191
|
+
let r = e[t].from;
|
|
192
|
+
for (let a = t; a < e.length; a++)
|
|
193
|
+
e[a].from > r && e[a].from--;
|
|
194
|
+
}
|
|
195
|
+
for (let t = 0; t < e.length; t++) {
|
|
196
|
+
let r = e[t];
|
|
197
|
+
for (let a = e.length - 1; a > t; a--) {
|
|
198
|
+
let s = e[a];
|
|
199
|
+
s.from < r.to ? r.to++ : s.from++;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
let o = l.items.slice();
|
|
203
|
+
for (let t of e) {
|
|
204
|
+
let [r] = o.splice(t.from, 1);
|
|
205
|
+
o.splice(t.to, 0, r);
|
|
206
|
+
}
|
|
207
|
+
return {
|
|
208
|
+
...l,
|
|
209
|
+
items: o
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
const Ne = /* @__PURE__ */ Pe(null);
|
|
213
|
+
function ze(l, i) {
|
|
214
|
+
return [l, i] = ce(l, i, Ne), /* @__PURE__ */ c.createElement(ge, {
|
|
215
|
+
content: /* @__PURE__ */ c.createElement(ve, l)
|
|
216
|
+
}, (d) => /* @__PURE__ */ c.createElement(Ge, {
|
|
217
|
+
props: l,
|
|
218
|
+
collection: d,
|
|
219
|
+
gridListRef: i
|
|
220
|
+
}));
|
|
221
|
+
}
|
|
222
|
+
function Ge({ props: l, collection: i, gridListRef: d }) {
|
|
223
|
+
let { dragAndDropHooks: e, keyboardNavigationBehavior: o = "arrow", layout: t = "stack" } = l, { CollectionRoot: r, isVirtualized: a, layoutDelegate: s, dropTargetDelegate: f } = E(V), n = Ae({
|
|
224
|
+
...l,
|
|
225
|
+
collection: i,
|
|
226
|
+
children: void 0,
|
|
227
|
+
layoutDelegate: s
|
|
228
|
+
}), m = Be({
|
|
229
|
+
usage: "search",
|
|
230
|
+
sensitivity: "base"
|
|
231
|
+
}), { disabledBehavior: b, disabledKeys: g } = n.selectionManager, { direction: u } = Re(), p = te(() => new J({
|
|
232
|
+
collection: i,
|
|
233
|
+
collator: m,
|
|
234
|
+
ref: d,
|
|
235
|
+
disabledKeys: g,
|
|
236
|
+
disabledBehavior: b,
|
|
237
|
+
layoutDelegate: s,
|
|
238
|
+
layout: t,
|
|
239
|
+
direction: u
|
|
240
|
+
}), [
|
|
241
|
+
i,
|
|
242
|
+
d,
|
|
243
|
+
t,
|
|
244
|
+
g,
|
|
245
|
+
b,
|
|
246
|
+
s,
|
|
247
|
+
m,
|
|
248
|
+
u
|
|
249
|
+
]), { gridProps: R } = Ie({
|
|
250
|
+
...l,
|
|
251
|
+
keyboardDelegate: p,
|
|
252
|
+
// Only tab navigation is supported in grid layout.
|
|
253
|
+
keyboardNavigationBehavior: t === "grid" ? "tab" : o,
|
|
254
|
+
isVirtualized: a
|
|
255
|
+
}, n, d), D = n.selectionManager, w = !!(e != null && e.useDraggableCollectionState), h = !!(e != null && e.useDroppableCollectionState), v = P(w), $ = P(h);
|
|
256
|
+
F(() => {
|
|
257
|
+
v.current !== w && console.warn("Drag hooks were provided during one render, but not another. This should be avoided as it may produce unexpected behavior."), $.current !== h && console.warn("Drop hooks were provided during one render, but not another. This should be avoided as it may produce unexpected behavior.");
|
|
258
|
+
}, [
|
|
259
|
+
w,
|
|
260
|
+
h
|
|
261
|
+
]);
|
|
262
|
+
let k, x, S, I = !1, K = null, W = P(null);
|
|
263
|
+
if (w && e) {
|
|
264
|
+
k = e.useDraggableCollectionState({
|
|
265
|
+
collection: i,
|
|
266
|
+
selectionManager: D,
|
|
267
|
+
preview: e.renderDragPreview ? W : void 0
|
|
268
|
+
}), e.useDraggableCollection({}, k, d);
|
|
269
|
+
let T = e.DragPreview;
|
|
270
|
+
K = e.renderDragPreview ? /* @__PURE__ */ c.createElement(T, {
|
|
271
|
+
ref: W
|
|
272
|
+
}, e.renderDragPreview) : null;
|
|
273
|
+
}
|
|
274
|
+
if (h && e) {
|
|
275
|
+
x = e.useDroppableCollectionState({
|
|
276
|
+
collection: i,
|
|
277
|
+
selectionManager: D
|
|
278
|
+
});
|
|
279
|
+
let T = new J({
|
|
280
|
+
collection: i,
|
|
281
|
+
disabledKeys: D.disabledKeys,
|
|
282
|
+
disabledBehavior: D.disabledBehavior,
|
|
283
|
+
ref: d
|
|
284
|
+
}), le = e.dropTargetDelegate || f || new e.ListDropTargetDelegate(i, d, {
|
|
285
|
+
layout: t,
|
|
286
|
+
direction: u
|
|
287
|
+
});
|
|
288
|
+
S = e.useDroppableCollection({
|
|
289
|
+
keyboardDelegate: T,
|
|
290
|
+
dropTargetDelegate: le
|
|
291
|
+
}, x, d), I = x.isDropTarget({
|
|
292
|
+
type: "root"
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
let { focusProps: oe, isFocused: j, isFocusVisible: O } = Y(), U = {
|
|
296
|
+
isDropTarget: I,
|
|
297
|
+
isEmpty: n.collection.size === 0,
|
|
298
|
+
isFocused: j,
|
|
299
|
+
isFocusVisible: O,
|
|
300
|
+
layout: t,
|
|
301
|
+
state: n
|
|
302
|
+
}, ae = N({
|
|
303
|
+
className: l.className,
|
|
304
|
+
style: l.style,
|
|
305
|
+
defaultClassName: "react-aria-GridList",
|
|
306
|
+
values: U
|
|
307
|
+
}), q = null, ie = null;
|
|
308
|
+
if (n.collection.size === 0 && l.renderEmptyState) {
|
|
309
|
+
let T = l.renderEmptyState(U);
|
|
310
|
+
q = /* @__PURE__ */ c.createElement("div", {
|
|
311
|
+
role: "row",
|
|
312
|
+
style: {
|
|
313
|
+
display: "contents"
|
|
314
|
+
}
|
|
315
|
+
}, /* @__PURE__ */ c.createElement("div", {
|
|
316
|
+
role: "gridcell",
|
|
317
|
+
style: {
|
|
318
|
+
display: "contents"
|
|
319
|
+
}
|
|
320
|
+
}, T));
|
|
321
|
+
}
|
|
322
|
+
return /* @__PURE__ */ c.createElement(He, null, /* @__PURE__ */ c.createElement("div", {
|
|
323
|
+
...ee(l),
|
|
324
|
+
...ae,
|
|
325
|
+
...Z(R, oe, S == null ? void 0 : S.collectionProps, ie),
|
|
326
|
+
ref: d,
|
|
327
|
+
slot: l.slot || void 0,
|
|
328
|
+
onScroll: l.onScroll,
|
|
329
|
+
"data-drop-target": I || void 0,
|
|
330
|
+
"data-empty": n.collection.size === 0 || void 0,
|
|
331
|
+
"data-focused": j || void 0,
|
|
332
|
+
"data-focus-visible": O || void 0,
|
|
333
|
+
"data-layout": t
|
|
334
|
+
}, /* @__PURE__ */ c.createElement(z, {
|
|
335
|
+
values: [
|
|
336
|
+
[
|
|
337
|
+
_,
|
|
338
|
+
n
|
|
339
|
+
],
|
|
340
|
+
[
|
|
341
|
+
M,
|
|
342
|
+
{
|
|
343
|
+
dragAndDropHooks: e,
|
|
344
|
+
dragState: k,
|
|
345
|
+
dropState: x
|
|
346
|
+
}
|
|
347
|
+
],
|
|
348
|
+
[
|
|
349
|
+
ye,
|
|
350
|
+
{
|
|
351
|
+
render: Oe
|
|
352
|
+
}
|
|
353
|
+
]
|
|
354
|
+
]
|
|
355
|
+
}, h && /* @__PURE__ */ c.createElement(Je, null), /* @__PURE__ */ c.createElement(r, {
|
|
356
|
+
collection: i,
|
|
357
|
+
scrollRef: d,
|
|
358
|
+
persistedKeys: xe(D, e, x),
|
|
359
|
+
renderDropIndicator: De(e, x)
|
|
360
|
+
})), q, K));
|
|
361
|
+
}
|
|
362
|
+
const We = /* @__PURE__ */ re(ze), je = /* @__PURE__ */ me("item", function(i, d, e) {
|
|
363
|
+
let o = E(_), { dragAndDropHooks: t, dragState: r, dropState: a } = E(M), s = X(d), { isVirtualized: f } = E(V), { rowProps: n, gridCellProps: m, descriptionProps: b, ...g } = ke({
|
|
364
|
+
node: e,
|
|
365
|
+
shouldSelectOnPressUp: !!r,
|
|
366
|
+
isVirtualized: f
|
|
367
|
+
}, o, s), { hoverProps: u, isHovered: p } = se({
|
|
368
|
+
isDisabled: !g.allowsSelection && !g.hasAction,
|
|
369
|
+
onHoverStart: e.props.onHoverStart,
|
|
370
|
+
onHoverChange: e.props.onHoverChange,
|
|
371
|
+
onHoverEnd: e.props.onHoverEnd
|
|
372
|
+
}), { isFocusVisible: R, focusProps: D } = Y(), { checkboxProps: w } = Ve({
|
|
373
|
+
key: e.key
|
|
374
|
+
}, o), h = o.selectionManager.disabledBehavior === "all" && g.isDisabled ? {
|
|
375
|
+
isDisabled: !0
|
|
376
|
+
} : {}, v = null;
|
|
377
|
+
r && t && (v = t.useDraggableItem({
|
|
378
|
+
key: e.key,
|
|
379
|
+
hasDragButton: !0
|
|
380
|
+
}, r));
|
|
381
|
+
let $ = null, k = P(null), { visuallyHiddenProps: x } = G();
|
|
382
|
+
a && t && ($ = t.useDropIndicator({
|
|
383
|
+
target: {
|
|
384
|
+
type: "item",
|
|
385
|
+
key: e.key,
|
|
386
|
+
dropPosition: "on"
|
|
387
|
+
}
|
|
388
|
+
}, a, k));
|
|
389
|
+
let S = r && r.isDragging(e.key), I = N({
|
|
390
|
+
...i,
|
|
391
|
+
id: void 0,
|
|
392
|
+
children: e.rendered,
|
|
393
|
+
defaultClassName: "react-aria-GridListItem",
|
|
394
|
+
values: {
|
|
395
|
+
...g,
|
|
396
|
+
isHovered: p,
|
|
397
|
+
isFocusVisible: R,
|
|
398
|
+
selectionMode: o.selectionManager.selectionMode,
|
|
399
|
+
selectionBehavior: o.selectionManager.selectionBehavior,
|
|
400
|
+
allowsDragging: !!r,
|
|
401
|
+
isDragging: S,
|
|
402
|
+
isDropTarget: $ == null ? void 0 : $.isDropTarget
|
|
403
|
+
}
|
|
404
|
+
}), K = P(null);
|
|
405
|
+
return F(() => {
|
|
406
|
+
r && !K.current && console.warn('Draggable items in a GridList must contain a <Button slot="drag"> element so that keyboard and screen reader users can drag them.');
|
|
407
|
+
}, []), F(() => {
|
|
408
|
+
e.textValue || console.warn("A `textValue` prop is required for <GridListItem> elements with non-plain text children in order to support accessibility features such as type to select.");
|
|
409
|
+
}, [
|
|
410
|
+
e.textValue
|
|
411
|
+
]), /* @__PURE__ */ c.createElement(c.Fragment, null, $ && !$.isHidden && /* @__PURE__ */ c.createElement("div", {
|
|
412
|
+
role: "row",
|
|
413
|
+
style: {
|
|
414
|
+
position: "absolute"
|
|
415
|
+
}
|
|
416
|
+
}, /* @__PURE__ */ c.createElement("div", {
|
|
417
|
+
role: "gridcell"
|
|
418
|
+
}, /* @__PURE__ */ c.createElement("div", {
|
|
419
|
+
role: "button",
|
|
420
|
+
...x,
|
|
421
|
+
...$ == null ? void 0 : $.dropIndicatorProps,
|
|
422
|
+
ref: k
|
|
423
|
+
}))), /* @__PURE__ */ c.createElement("div", {
|
|
424
|
+
...Z(ee(i), n, D, u, v == null ? void 0 : v.dragProps),
|
|
425
|
+
...I,
|
|
426
|
+
ref: s,
|
|
427
|
+
"data-selected": g.isSelected || void 0,
|
|
428
|
+
"data-disabled": g.isDisabled || void 0,
|
|
429
|
+
"data-hovered": p || void 0,
|
|
430
|
+
"data-focused": g.isFocused || void 0,
|
|
431
|
+
"data-focus-visible": R || void 0,
|
|
432
|
+
"data-pressed": g.isPressed || void 0,
|
|
433
|
+
"data-allows-dragging": !!r || void 0,
|
|
434
|
+
"data-dragging": S || void 0,
|
|
435
|
+
"data-drop-target": ($ == null ? void 0 : $.isDropTarget) || void 0,
|
|
436
|
+
"data-selection-mode": o.selectionManager.selectionMode === "none" ? void 0 : o.selectionManager.selectionMode
|
|
437
|
+
}, /* @__PURE__ */ c.createElement("div", {
|
|
438
|
+
...m,
|
|
439
|
+
style: {
|
|
440
|
+
display: "contents"
|
|
441
|
+
}
|
|
442
|
+
}, /* @__PURE__ */ c.createElement(z, {
|
|
443
|
+
values: [
|
|
444
|
+
[
|
|
445
|
+
be,
|
|
446
|
+
{
|
|
447
|
+
slots: {
|
|
448
|
+
[L]: {},
|
|
449
|
+
selection: w
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
],
|
|
453
|
+
[
|
|
454
|
+
de,
|
|
455
|
+
{
|
|
456
|
+
slots: {
|
|
457
|
+
[L]: h,
|
|
458
|
+
drag: {
|
|
459
|
+
...v == null ? void 0 : v.dragButtonProps,
|
|
460
|
+
ref: K,
|
|
461
|
+
style: {
|
|
462
|
+
pointerEvents: "none"
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
],
|
|
468
|
+
[
|
|
469
|
+
he,
|
|
470
|
+
{
|
|
471
|
+
slots: {
|
|
472
|
+
[L]: {},
|
|
473
|
+
description: b
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
],
|
|
477
|
+
[
|
|
478
|
+
V,
|
|
479
|
+
$e
|
|
480
|
+
],
|
|
481
|
+
[
|
|
482
|
+
_,
|
|
483
|
+
null
|
|
484
|
+
]
|
|
485
|
+
]
|
|
486
|
+
}, I.children))));
|
|
487
|
+
});
|
|
488
|
+
function Oe(l, i) {
|
|
489
|
+
i = X(i);
|
|
490
|
+
let { dragAndDropHooks: d, dropState: e } = E(M), o = P(null), { dropIndicatorProps: t, isHidden: r, isDropTarget: a } = d.useDropIndicator(l, e, o);
|
|
491
|
+
return r ? null : /* @__PURE__ */ c.createElement(qe, {
|
|
492
|
+
...l,
|
|
493
|
+
dropIndicatorProps: t,
|
|
494
|
+
isDropTarget: a,
|
|
495
|
+
buttonRef: o,
|
|
496
|
+
ref: i
|
|
497
|
+
});
|
|
498
|
+
}
|
|
499
|
+
function Ue(l, i) {
|
|
500
|
+
let { dropIndicatorProps: d, isDropTarget: e, buttonRef: o, ...t } = l, { visuallyHiddenProps: r } = G(), a = N({
|
|
501
|
+
...t,
|
|
502
|
+
defaultClassName: "react-aria-DropIndicator",
|
|
503
|
+
values: {
|
|
504
|
+
isDropTarget: e
|
|
505
|
+
}
|
|
506
|
+
});
|
|
507
|
+
return /* @__PURE__ */ c.createElement("div", {
|
|
508
|
+
...a,
|
|
509
|
+
role: "row",
|
|
510
|
+
ref: i,
|
|
511
|
+
"data-drop-target": e || void 0
|
|
512
|
+
}, /* @__PURE__ */ c.createElement("div", {
|
|
513
|
+
role: "gridcell"
|
|
514
|
+
}, /* @__PURE__ */ c.createElement("div", {
|
|
515
|
+
...r,
|
|
516
|
+
role: "button",
|
|
517
|
+
...d,
|
|
518
|
+
ref: o
|
|
519
|
+
}), a.children));
|
|
520
|
+
}
|
|
521
|
+
const qe = /* @__PURE__ */ re(Ue);
|
|
522
|
+
function Je() {
|
|
523
|
+
let { dragAndDropHooks: l, dropState: i } = E(M), d = P(null), { dropIndicatorProps: e } = l.useDropIndicator({
|
|
524
|
+
target: {
|
|
525
|
+
type: "root"
|
|
526
|
+
}
|
|
527
|
+
}, i, d), o = i.isDropTarget({
|
|
528
|
+
type: "root"
|
|
529
|
+
}), { visuallyHiddenProps: t } = G();
|
|
530
|
+
return !o && e["aria-hidden"] ? null : /* @__PURE__ */ c.createElement("div", {
|
|
531
|
+
role: "row",
|
|
532
|
+
"aria-hidden": e["aria-hidden"],
|
|
533
|
+
style: {
|
|
534
|
+
position: "absolute"
|
|
535
|
+
}
|
|
536
|
+
}, /* @__PURE__ */ c.createElement("div", {
|
|
537
|
+
role: "gridcell"
|
|
538
|
+
}, /* @__PURE__ */ c.createElement("div", {
|
|
539
|
+
role: "button",
|
|
540
|
+
...t,
|
|
541
|
+
...e,
|
|
542
|
+
ref: d
|
|
543
|
+
})));
|
|
544
|
+
}
|
|
545
|
+
const Qe = '"../theme/tokens.css"', Xe = '"Inter", sans-serif', Ye = "#000000", Ze = "#b31b1b", et = "(max-width: 767px)", tt = "#bfbfbf", rt = "#e6e6e6", ot = "#f2f2f2", at = "_button_1eb3v_4", it = "_icon_1eb3v_19", lt = "_multiSelect_1eb3v_44", dt = "_popover_1eb3v_60", nt = "_listBoxItem_1eb3v_73", B = {
|
|
546
|
+
tokens: Qe,
|
|
547
|
+
display: Xe,
|
|
548
|
+
black: Ye,
|
|
549
|
+
signalRed130: Ze,
|
|
550
|
+
smBreakpoint: et,
|
|
551
|
+
gray50: tt,
|
|
552
|
+
gray20: rt,
|
|
553
|
+
backgroundSecondary: ot,
|
|
554
|
+
button: at,
|
|
555
|
+
icon: it,
|
|
556
|
+
multiSelect: lt,
|
|
557
|
+
popover: dt,
|
|
558
|
+
listBoxItem: nt
|
|
559
|
+
}, Tt = ({
|
|
560
|
+
label: l,
|
|
561
|
+
description: i,
|
|
562
|
+
items: d,
|
|
563
|
+
onSelectionChange: e,
|
|
564
|
+
selectedKeys: o,
|
|
565
|
+
defaultSelectedKeys: t,
|
|
566
|
+
isDisabled: r,
|
|
567
|
+
isInvalid: a,
|
|
568
|
+
errorMessage: s
|
|
569
|
+
}) => {
|
|
570
|
+
const f = H.useRef(null), [n, m] = H.useState(
|
|
571
|
+
void 0
|
|
572
|
+
), b = _e({
|
|
573
|
+
initialItems: d,
|
|
574
|
+
initialSelectedKeys: t
|
|
575
|
+
});
|
|
576
|
+
H.useEffect(() => {
|
|
577
|
+
const u = () => {
|
|
578
|
+
f.current && m(f.current.offsetWidth - 2);
|
|
579
|
+
};
|
|
580
|
+
return u(), window.addEventListener("resize", u), () => {
|
|
581
|
+
window.removeEventListener("resize", u);
|
|
582
|
+
};
|
|
583
|
+
}, []), H.useEffect(() => {
|
|
584
|
+
e && e(new Set(b.selectedKeys));
|
|
585
|
+
}, [b.selectedKeys, e]), H.useEffect(() => {
|
|
586
|
+
o && b.setSelectedKeys(new Set(o));
|
|
587
|
+
}, [o]);
|
|
588
|
+
const g = b.selectedKeys === "all" ? new Set(
|
|
589
|
+
b.items.map((u) => u.id)
|
|
590
|
+
) : b.selectedKeys;
|
|
591
|
+
return /* @__PURE__ */ y(
|
|
592
|
+
"div",
|
|
593
|
+
{
|
|
594
|
+
className: B.multiSelect,
|
|
595
|
+
"data-disabled": r,
|
|
596
|
+
"data-invalid": a,
|
|
597
|
+
children: /* @__PURE__ */ C(
|
|
598
|
+
z,
|
|
599
|
+
{
|
|
600
|
+
values: [
|
|
601
|
+
[
|
|
602
|
+
// we should maybe add more here
|
|
603
|
+
// [LabelContext, {...labelProps, ref: labelRef}],
|
|
604
|
+
// [InputContext, {...inputProps, ref: inputOrTextAreaRef}],
|
|
605
|
+
// [TextAreaContext, {...inputProps, ref: inputOrTextAreaRef}],
|
|
606
|
+
// [TextContext, {
|
|
607
|
+
// slots: {
|
|
608
|
+
// description: descriptionProps,
|
|
609
|
+
// errorMessage: errorMessageProps
|
|
610
|
+
// }
|
|
611
|
+
// }],
|
|
612
|
+
pe,
|
|
613
|
+
{
|
|
614
|
+
isInvalid: a || !1,
|
|
615
|
+
validationErrors: [],
|
|
616
|
+
validationDetails: {
|
|
617
|
+
customError: a || !1,
|
|
618
|
+
badInput: !1,
|
|
619
|
+
patternMismatch: !1,
|
|
620
|
+
rangeOverflow: !1,
|
|
621
|
+
rangeUnderflow: !1,
|
|
622
|
+
stepMismatch: !1,
|
|
623
|
+
tooLong: !1,
|
|
624
|
+
tooShort: !1,
|
|
625
|
+
typeMismatch: !1,
|
|
626
|
+
valid: !1,
|
|
627
|
+
valueMissing: !1
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
]
|
|
631
|
+
],
|
|
632
|
+
children: [
|
|
633
|
+
/* @__PURE__ */ y(
|
|
634
|
+
Ce,
|
|
635
|
+
{
|
|
636
|
+
label: l,
|
|
637
|
+
description: i,
|
|
638
|
+
errorMessage: s,
|
|
639
|
+
children: /* @__PURE__ */ C(fe, { children: [
|
|
640
|
+
/* @__PURE__ */ C(
|
|
641
|
+
ne,
|
|
642
|
+
{
|
|
643
|
+
className: B.button,
|
|
644
|
+
ref: f,
|
|
645
|
+
isDisabled: r,
|
|
646
|
+
children: [
|
|
647
|
+
"Välj",
|
|
648
|
+
/* @__PURE__ */ y(
|
|
649
|
+
"div",
|
|
650
|
+
{
|
|
651
|
+
className: B.icon,
|
|
652
|
+
"aria-hidden": "true",
|
|
653
|
+
children: /* @__PURE__ */ y(Le, { size: 20 })
|
|
654
|
+
}
|
|
655
|
+
)
|
|
656
|
+
]
|
|
657
|
+
}
|
|
658
|
+
),
|
|
659
|
+
/* @__PURE__ */ y(
|
|
660
|
+
ue,
|
|
661
|
+
{
|
|
662
|
+
className: B.popover,
|
|
663
|
+
style: { width: n },
|
|
664
|
+
offset: 0,
|
|
665
|
+
UNSTABLE_portalContainer: f.current || void 0,
|
|
666
|
+
children: /* @__PURE__ */ y(
|
|
667
|
+
We,
|
|
668
|
+
{
|
|
669
|
+
"aria-label": l,
|
|
670
|
+
selectionMode: "multiple",
|
|
671
|
+
selectedKeys: b.selectedKeys,
|
|
672
|
+
onSelectionChange: b.setSelectedKeys,
|
|
673
|
+
children: b.items.map((u) => /* @__PURE__ */ C(
|
|
674
|
+
je,
|
|
675
|
+
{
|
|
676
|
+
id: u.id,
|
|
677
|
+
textValue: u.name,
|
|
678
|
+
className: B.listBoxItem,
|
|
679
|
+
children: [
|
|
680
|
+
/* @__PURE__ */ y(Me, { slot: "selection" }),
|
|
681
|
+
u.name
|
|
682
|
+
]
|
|
683
|
+
},
|
|
684
|
+
u.id
|
|
685
|
+
))
|
|
686
|
+
}
|
|
687
|
+
)
|
|
688
|
+
}
|
|
689
|
+
)
|
|
690
|
+
] })
|
|
691
|
+
}
|
|
692
|
+
),
|
|
693
|
+
/* @__PURE__ */ y(
|
|
694
|
+
Ee,
|
|
695
|
+
{
|
|
696
|
+
"aria-label": "Valda",
|
|
697
|
+
onRemove: (u) => {
|
|
698
|
+
b.setSelectedKeys(new Set(Array.from(b.selectedKeys).filter((p) => !u.has(p))));
|
|
699
|
+
},
|
|
700
|
+
children: Array.from(g).map((u) => {
|
|
701
|
+
const p = b.getItem(u);
|
|
702
|
+
return /* @__PURE__ */ y(
|
|
703
|
+
Ke,
|
|
704
|
+
{
|
|
705
|
+
id: p == null ? void 0 : p.id,
|
|
706
|
+
textValue: p == null ? void 0 : p.name,
|
|
707
|
+
isDisabled: r,
|
|
708
|
+
dismissable: !0,
|
|
709
|
+
children: p == null ? void 0 : p.name
|
|
710
|
+
},
|
|
711
|
+
p == null ? void 0 : p.id
|
|
712
|
+
);
|
|
713
|
+
})
|
|
714
|
+
}
|
|
715
|
+
)
|
|
716
|
+
]
|
|
717
|
+
}
|
|
718
|
+
)
|
|
719
|
+
}
|
|
720
|
+
);
|
|
721
|
+
};
|
|
722
|
+
export {
|
|
723
|
+
Tt as MultiSelect
|
|
724
|
+
};
|