@midas-ds/components 1.0.3 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (145) hide show
  1. package/{Button-B4vMZbC6.js → Button-DL6nqUco.js} +22 -22
  2. package/CHANGELOG.md +6 -1
  3. package/{Checkbox-DnKWanep.js → Checkbox-q0dugR2t.js} +8 -8
  4. package/{Collection-COLWgm24.js → Collection-KMFfVuzU.js} +2 -2
  5. package/{Dialog-Cb6toyXO.js → Dialog-D6Bqrpn-.js} +170 -169
  6. package/Disclosure-dAZYXyTH.js +225 -0
  7. package/Disclosure.css +1 -0
  8. package/{FocusScope-C8i7CH6y.js → FocusScope-B7CkxXNC.js} +1 -1
  9. package/{Form-BQQs3jUk.js → Form-BWBjJC6v.js} +42 -42
  10. package/{Group-CdwXhx8Q.js → Group-D7_8007y.js} +10 -10
  11. package/Heading-RCRHv6hd.js +15 -0
  12. package/{Hidden-DngIphiL.js → Hidden-CVlUgUJM.js} +1 -1
  13. package/{Link-iAZLB3RI.js → Link-BnQvB-hH.js} +8 -8
  14. package/{ListBox-BKWkIIm6.js → ListBox-DBBiqvcR.js} +72 -72
  15. package/{ListKeyboardDelegate-BH-K5hyq.js → ListKeyboardDelegate-gCXy-Xnn.js} +2 -2
  16. package/{PressResponder-Cz-TRBHO.js → PressResponder-B4g56kDz.js} +5 -5
  17. package/{RSPContexts-EOiWkKOf.js → RSPContexts-BW2SEIqe.js} +2 -2
  18. package/{SelectionManager-8o40f7mx.js → SelectionManager-BfXUE1qg.js} +113 -129
  19. package/{Separator-BlvmQjwz.js → Separator-BBX9m2O2.js} +2 -2
  20. package/{Tag--W5TgxmK.js → Tag-DWt0koFj.js} +74 -74
  21. package/Text-BCF0xvqL.js +15 -0
  22. package/{TextField-DeK_yiK-.js → TextField-CX4eOQf6.js} +33 -33
  23. package/{TextField.module-0-u4LVPp.js → TextField.module-DdICj682.js} +7 -7
  24. package/{VisuallyHidden-CFx06Bae.js → VisuallyHidden-Dhr5caPC.js} +1 -1
  25. package/accordion/Accordion.d.ts +8 -8
  26. package/accordion/AccordionItem.d.ts +11 -3
  27. package/accordion/index.d.ts +0 -3
  28. package/{context-Bnqknrce.js → context-BpJLnOuu.js} +11 -11
  29. package/global.css +1 -0
  30. package/index.d.ts +1 -0
  31. package/index.js +105 -110
  32. package/index10.js +1 -1
  33. package/index11.js +1 -1
  34. package/index12.js +1 -1
  35. package/index13.js +1 -1
  36. package/index14.js +1 -1
  37. package/index15.js +2 -2
  38. package/index16.js +2 -2
  39. package/index17.js +1 -1
  40. package/index18.js +1 -1
  41. package/index19.js +2 -2
  42. package/index2.js +1 -1
  43. package/index20.js +2 -2
  44. package/index21.js +1 -1
  45. package/index22.js +1 -1
  46. package/index23.js +1 -1
  47. package/index24.js +1 -1
  48. package/index25.js +2 -2
  49. package/index26.js +2 -2
  50. package/index27.js +2 -2
  51. package/index28.js +1 -1
  52. package/index29.js +2 -8
  53. package/index3.js +1 -1
  54. package/index30.js +17 -16
  55. package/index31.js +1 -1
  56. package/index32.js +1 -1
  57. package/index33.js +1 -1
  58. package/index34.js +2 -2
  59. package/index36.js +1 -1
  60. package/index37.js +1 -1
  61. package/index38.js +1 -1
  62. package/index39.js +1 -1
  63. package/index4.js +1 -1
  64. package/index40.js +19 -12
  65. package/index41.js +61 -14
  66. package/index42.js +44 -22
  67. package/index43.js +13 -11
  68. package/index44.js +25 -4
  69. package/index45.js +16 -51
  70. package/index46.js +19 -16
  71. package/index47.js +49 -27
  72. package/index48.js +5 -18
  73. package/index49.js +25 -21
  74. package/index5.js +1 -1
  75. package/index50.js +16 -47
  76. package/index51.js +7 -3
  77. package/index52.js +18 -18
  78. package/index53.js +16 -16
  79. package/index54.js +5 -3
  80. package/index55.js +7 -20
  81. package/index56.js +13 -16
  82. package/index57.js +6 -8
  83. package/index58.js +5 -8
  84. package/index59.js +17 -13
  85. package/index6.js +1 -1
  86. package/index60.js +20 -7
  87. package/index61.js +59 -7
  88. package/index62.js +13 -17
  89. package/index63.js +9 -20
  90. package/index64.js +38 -46
  91. package/index65.js +85 -15
  92. package/index66.js +74 -11
  93. package/index67.js +23 -62
  94. package/index68.js +64 -80
  95. package/index69.js +68 -62
  96. package/index7.js +1 -1
  97. package/index70.js +138 -22
  98. package/index71.js +66 -65
  99. package/index72.js +40 -78
  100. package/index73.js +75 -133
  101. package/index74.js +69 -68
  102. package/index75.js +96 -34
  103. package/index76.js +258 -65
  104. package/index77.js +715 -63
  105. package/index78.js +478 -93
  106. package/index79.js +303 -263
  107. package/index8.js +1 -1
  108. package/index80.js +343 -677
  109. package/index81.js +242 -479
  110. package/index82.js +1332 -282
  111. package/index83.js +966 -346
  112. package/index84.js +344 -210
  113. package/index85.js +2024 -1286
  114. package/index86.js +2314 -955
  115. package/index87.js +6785 -340
  116. package/index88.js +15 -2099
  117. package/index89.js +12 -2367
  118. package/index9.js +1 -1
  119. package/index90.js +4 -6834
  120. package/index91.js +7 -15
  121. package/package.json +1 -1
  122. package/useControlledState-Kv9K2AYu.js +30 -0
  123. package/{useDescription-BPs7eRff.js → useDescription-B7stiK3j.js} +1 -1
  124. package/useEvent-Xk5kn5Ns.js +21 -0
  125. package/{useField-Dz62UHCP.js → useField-DMzJIIN4.js} +5 -5
  126. package/{useFilter-ViwzkzZe.js → useFilter-Bt9dbV1U.js} +1 -1
  127. package/{useFocusRing-BKGhL91C.js → useFocusRing-9PXyKy2A.js} +26 -26
  128. package/{useFocusable-CRSmYEQc.js → useFocusable-CcEBZe40.js} +1 -1
  129. package/{useGridSelectionCheckbox-CVEvUCJL.js → useGridSelectionCheckbox-DYgEnElE.js} +3 -3
  130. package/{useHasTabbableChild-C8y4fwiY.js → useHasTabbableChild-D6DwR81L.js} +5 -5
  131. package/{useHighlightSelectionDescription-CD74uzLh.js → useHighlightSelectionDescription-WYAbP4No.js} +4 -4
  132. package/useLabels-9zaZ9oa0.js +17 -0
  133. package/{useListState-DKnP5TB5.js → useListState-BfTeKTk5.js} +1 -1
  134. package/{useLocalizedStringFormatter-DsZ-ZWSk.js → useLocalizedStringFormatter-BlCbn-hX.js} +1 -1
  135. package/{useSingleSelectListState-BHTLh8Ob.js → useSingleSelectListState-DPkaL0la.js} +2 -2
  136. package/Text-CQPW6xs7.js +0 -15
  137. package/accordion/AccordionContent.d.ts +0 -3
  138. package/accordion/AccordionTagContext.d.ts +0 -3
  139. package/accordion/AccordionTrigger.d.ts +0 -3
  140. package/index-DK9ZACEc.js +0 -642
  141. package/index.css +0 -1
  142. package/index92.js +0 -14
  143. package/index93.js +0 -6
  144. package/index94.js +0 -9
  145. package/useControlledState-DrAoodI6.js +0 -45
package/index77.js CHANGED
@@ -1,71 +1,723 @@
1
- import { jsx as e, jsxs as l, Fragment as f } from "react/jsx-runtime";
2
- import { $ as d } from "./Link-iAZLB3RI.js";
3
- import { c as m } from "./clsx-OuTLNxxd.js";
4
- import { c as k } from "./createLucideIcon-DeWljiyi.js";
5
- import { $ as P } from "./useFocusRing-BKGhL91C.js";
6
- import './Link.css';/**
7
- * @license lucide-react v0.453.0 - ISC
8
- *
9
- * This source code is licensed under the ISC license.
10
- * See the LICENSE file in the root directory of this source tree.
11
- */
12
- const p = k("ArrowRight", [
13
- ["path", { d: "M5 12h14", key: "1ays0h" }],
14
- ["path", { d: "m12 5 7 7-7 7", key: "xquz4c" }]
15
- ]), h = '"../theme/tokens.css"', u = '"Inter", sans-serif', g = "#25607f", _ = "#143c50", y = "#1f1f1f", b = "#bfbfbf", x = "500", q = "0 0 0 2px #ffffff, 0 0 0 4px #000000", $ = "400", W = "#663366", z = "#000000", N = "_link_p1sqk_4", R = "_icon_p1sqk_40", j = "_standalone_p1sqk_44", w = "_stretched_p1sqk_59", s = {
16
- tokens: h,
17
- display: u,
18
- blue130: g,
19
- blue150: _,
20
- gray150: y,
21
- gray50: b,
22
- mediumWeight: x,
23
- focus: q,
24
- regularWeight: $,
25
- linkVisited: W,
26
- black: z,
27
- link: N,
28
- icon: R,
29
- standalone: j,
30
- stretched: w
31
- }, F = ({
32
- children: c,
33
- standalone: t,
34
- stretched: n,
35
- icon: o,
36
- className: r,
37
- as: i,
38
- ...a
39
- }) => /* @__PURE__ */ e(
40
- i || d,
41
- {
42
- className: m(
43
- s.link,
44
- t && s.standalone,
45
- n && s.stretched,
46
- r
47
- ),
1
+ import { jsx as v, jsxs as C } from "react/jsx-runtime";
2
+ import { a as ne, $ as de } from "./Button-DL6nqUco.js";
3
+ import { a as se, c as X, d as N, o as Y, e as Z, B as z, i as ee, b as ce, E as L } from "./useFocusRing-9PXyKy2A.js";
4
+ import { d as fe, a as ue } from "./Dialog-D6Bqrpn-.js";
5
+ import { a as pe } from "./Form-BWBjJC6v.js";
6
+ import { a as be } from "./RSPContexts-BW2SEIqe.js";
7
+ import { $ as me, a as $e, b as V, c as ge, d as ye } from "./Collection-KMFfVuzU.js";
8
+ import { $ as M, a as ve, b as xe, c as De } from "./DragAndDrop-B0T3WgjL.js";
9
+ import { $ as _ } from "./ListBox-DBBiqvcR.js";
10
+ import { $ as he } from "./Text-BCF0xvqL.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 } from "./useListState-BfTeKTk5.js";
14
+ import { $ as ke, a as J } from "./ListKeyboardDelegate-gCXy-Xnn.js";
15
+ import { $ as Ie } from "./context-BpJLnOuu.js";
16
+ import { $ as Ee, b as Ke, c as Te, a as He, T as Be } from "./Tag-DWt0koFj.js";
17
+ import { $ as Ae } from "./useGridSelectionCheckbox-DYgEnElE.js";
18
+ import { a as Re } from "./FocusScope-B7CkxXNC.js";
19
+ import { $ as G } from "./VisuallyHidden-Dhr5caPC.js";
20
+ import { I as Ce } from "./TextField-CX4eOQf6.js";
21
+ import { C as Me } from "./Checkbox-q0dugR2t.js";
22
+ import { C as Le } from "./chevron-down-Cd1bkzXT.js";
23
+ import './MultiSelect.css';function Ve(n, a) {
24
+ let { key: l } = n;
25
+ const { checkboxProps: e } = Ae(n, a);
26
+ return {
27
+ checkboxProps: {
28
+ ...e,
29
+ "aria-labelledby": `${e.id} ${Ee(a, l)}`
30
+ }
31
+ };
32
+ }
33
+ function _e(n) {
34
+ let { initialItems: a = [], initialSelectedKeys: l, getKey: e = (f) => {
35
+ var d;
36
+ return (d = f.id) !== null && d !== void 0 ? d : f.key;
37
+ }, filter: o, initialFilterText: t = "" } = n, [r, i] = Se({
38
+ items: a,
39
+ selectedKeys: l === "all" ? "all" : new Set(l || []),
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
+ }, i),
52
+ getItem(f) {
53
+ return r.items.find((d) => e(d) === f);
54
+ }
55
+ };
56
+ }
57
+ function Fe(n, a) {
58
+ let { cursor: l, getKey: e } = n;
59
+ return {
60
+ setSelectedKeys(o) {
61
+ a((t) => ({
62
+ ...t,
63
+ selectedKeys: o
64
+ }));
65
+ },
66
+ setFilterText(o) {
67
+ a((t) => ({
68
+ ...t,
69
+ filterText: o
70
+ }));
71
+ },
72
+ insert(o, ...t) {
73
+ a((r) => B(r, o, ...t));
74
+ },
75
+ insertBefore(o, ...t) {
76
+ a((r) => {
77
+ let i = r.items.findIndex((s) => (e == null ? void 0 : e(s)) === o);
78
+ if (i === -1)
79
+ if (r.items.length === 0) i = 0;
80
+ else return r;
81
+ return B(r, i, ...t);
82
+ });
83
+ },
84
+ insertAfter(o, ...t) {
85
+ a((r) => {
86
+ let i = r.items.findIndex((s) => (e == null ? void 0 : e(s)) === o);
87
+ if (i === -1)
88
+ if (r.items.length === 0) i = 0;
89
+ else return r;
90
+ return B(r, i + 1, ...t);
91
+ });
92
+ },
93
+ prepend(...o) {
94
+ a((t) => B(t, 0, ...o));
95
+ },
96
+ append(...o) {
97
+ a((t) => B(t, t.items.length, ...o));
98
+ },
99
+ remove(...o) {
100
+ a((t) => {
101
+ let r = new Set(o), i = 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 l == null && i.length === 0 && (s = /* @__PURE__ */ new Set()), {
107
+ ...t,
108
+ items: i,
109
+ selectedKeys: s
110
+ };
111
+ });
112
+ },
113
+ removeSelectedItems() {
114
+ a((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((i) => !t.has(e(i)));
121
+ return {
122
+ ...o,
123
+ items: r,
124
+ selectedKeys: /* @__PURE__ */ new Set()
125
+ };
126
+ });
127
+ },
128
+ move(o, t) {
129
+ a((r) => {
130
+ let i = r.items.findIndex((d) => e(d) === o);
131
+ if (i === -1) return r;
132
+ let s = r.items.slice(), [f] = s.splice(i, 1);
133
+ return s.splice(t, 0, f), {
134
+ ...r,
135
+ items: s
136
+ };
137
+ });
138
+ },
139
+ moveBefore(o, t) {
140
+ a((r) => {
141
+ let i = r.items.findIndex((d) => e(d) === o);
142
+ if (i === -1) return r;
143
+ let f = (Array.isArray(t) ? t : [
144
+ ...t
145
+ ]).map((d) => r.items.findIndex((m) => e(m) === d)).sort((d, m) => d - m);
146
+ return Q(r, f, i);
147
+ });
148
+ },
149
+ moveAfter(o, t) {
150
+ a((r) => {
151
+ let i = r.items.findIndex((d) => e(d) === o);
152
+ if (i === -1) return r;
153
+ let f = (Array.isArray(t) ? t : [
154
+ ...t
155
+ ]).map((d) => r.items.findIndex((m) => e(m) === d)).sort((d, m) => d - m);
156
+ return Q(r, f, i + 1);
157
+ });
158
+ },
159
+ update(o, t) {
160
+ a((r) => {
161
+ let i = r.items.findIndex((s) => e(s) === o);
162
+ return i === -1 ? r : {
163
+ ...r,
164
+ items: [
165
+ ...r.items.slice(0, i),
166
+ t,
167
+ ...r.items.slice(i + 1)
168
+ ]
169
+ };
170
+ });
171
+ }
172
+ };
173
+ }
174
+ function B(n, a, ...l) {
175
+ return {
176
+ ...n,
177
+ items: [
178
+ ...n.items.slice(0, a),
179
+ ...l,
180
+ ...n.items.slice(a)
181
+ ]
182
+ };
183
+ }
184
+ function Q(n, a, l) {
185
+ l -= a.filter((t) => t < l).length;
186
+ let e = a.map((t) => ({
187
+ from: t,
188
+ to: l++
189
+ }));
190
+ for (let t = 0; t < e.length; t++) {
191
+ let r = e[t].from;
192
+ for (let i = t; i < e.length; i++)
193
+ e[i].from > r && e[i].from--;
194
+ }
195
+ for (let t = 0; t < e.length; t++) {
196
+ let r = e[t];
197
+ for (let i = e.length - 1; i > t; i--) {
198
+ let s = e[i];
199
+ s.from < r.to ? r.to++ : s.from++;
200
+ }
201
+ }
202
+ let o = n.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
+ ...n,
209
+ items: o
210
+ };
211
+ }
212
+ const Ne = /* @__PURE__ */ Pe(null), ze = /* @__PURE__ */ re(function(a, l) {
213
+ return [a, l] = se(a, l, Ne), /* @__PURE__ */ c.createElement(me, {
214
+ content: /* @__PURE__ */ c.createElement($e, a)
215
+ }, (e) => /* @__PURE__ */ c.createElement(Ge, {
216
+ props: a,
217
+ collection: e,
218
+ gridListRef: l
219
+ }));
220
+ });
221
+ function Ge({ props: n, collection: a, gridListRef: l }) {
222
+ let { dragAndDropHooks: e, keyboardNavigationBehavior: o = "arrow", layout: t = "stack" } = n, { CollectionRoot: r, isVirtualized: i, layoutDelegate: s, dropTargetDelegate: f } = E(V), d = we({
223
+ ...n,
224
+ collection: a,
225
+ children: void 0,
226
+ layoutDelegate: s
227
+ }), m = ke({
228
+ usage: "search",
229
+ sensitivity: "base"
230
+ }), { disabledBehavior: b, disabledKeys: g } = d.selectionManager, { direction: u } = Ie(), p = te(() => new J({
231
+ collection: a,
232
+ collator: m,
233
+ ref: l,
234
+ disabledKeys: g,
235
+ disabledBehavior: b,
236
+ layoutDelegate: s,
237
+ layout: t,
238
+ direction: u
239
+ }), [
240
+ a,
241
+ l,
242
+ t,
243
+ g,
244
+ b,
245
+ s,
246
+ m,
247
+ u
248
+ ]), { gridProps: R } = Ke({
249
+ ...n,
250
+ keyboardDelegate: p,
251
+ // Only tab navigation is supported in grid layout.
252
+ keyboardNavigationBehavior: t === "grid" ? "tab" : o,
253
+ isVirtualized: i
254
+ }, d, l), D = d.selectionManager, w = !!(e != null && e.useDraggableCollectionState), h = !!(e != null && e.useDroppableCollectionState), y = P(w), $ = P(h);
255
+ F(() => {
256
+ y.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.");
257
+ }, [
258
+ w,
259
+ h
260
+ ]);
261
+ let k, x, S, I = !1, K = null, W = P(null);
262
+ if (w && e) {
263
+ k = e.useDraggableCollectionState({
264
+ collection: a,
265
+ selectionManager: D,
266
+ preview: e.renderDragPreview ? W : void 0
267
+ }), e.useDraggableCollection({}, k, l);
268
+ let T = e.DragPreview;
269
+ K = e.renderDragPreview ? /* @__PURE__ */ c.createElement(T, {
270
+ ref: W
271
+ }, e.renderDragPreview) : null;
272
+ }
273
+ if (h && e) {
274
+ x = e.useDroppableCollectionState({
275
+ collection: a,
276
+ selectionManager: D
277
+ });
278
+ let T = new J({
279
+ collection: a,
280
+ disabledKeys: D.disabledKeys,
281
+ disabledBehavior: D.disabledBehavior,
282
+ ref: l
283
+ }), le = e.dropTargetDelegate || f || new e.ListDropTargetDelegate(a, l, {
284
+ layout: t,
285
+ direction: u
286
+ });
287
+ S = e.useDroppableCollection({
288
+ keyboardDelegate: T,
289
+ dropTargetDelegate: le
290
+ }, x, l), I = x.isDropTarget({
291
+ type: "root"
292
+ });
293
+ }
294
+ let { focusProps: oe, isFocused: j, isFocusVisible: O } = X(), U = {
295
+ isDropTarget: I,
296
+ isEmpty: d.collection.size === 0,
297
+ isFocused: j,
298
+ isFocusVisible: O,
299
+ layout: t,
300
+ state: d
301
+ }, ae = N({
302
+ className: n.className,
303
+ style: n.style,
304
+ defaultClassName: "react-aria-GridList",
305
+ values: U
306
+ }), q = null, ie = null;
307
+ if (d.collection.size === 0 && n.renderEmptyState) {
308
+ let T = n.renderEmptyState(U);
309
+ q = /* @__PURE__ */ c.createElement("div", {
310
+ role: "row",
311
+ style: {
312
+ display: "contents"
313
+ }
314
+ }, /* @__PURE__ */ c.createElement("div", {
315
+ role: "gridcell",
316
+ style: {
317
+ display: "contents"
318
+ }
319
+ }, T));
320
+ }
321
+ return /* @__PURE__ */ c.createElement(Re, null, /* @__PURE__ */ c.createElement("div", {
322
+ ...Y(n),
323
+ ...ae,
324
+ ...Z(R, oe, S == null ? void 0 : S.collectionProps, ie),
325
+ ref: l,
326
+ slot: n.slot || void 0,
327
+ onScroll: n.onScroll,
328
+ "data-drop-target": I || void 0,
329
+ "data-empty": d.collection.size === 0 || void 0,
330
+ "data-focused": j || void 0,
331
+ "data-focus-visible": O || void 0,
332
+ "data-layout": t
333
+ }, /* @__PURE__ */ c.createElement(z, {
334
+ values: [
335
+ [
336
+ _,
337
+ d
338
+ ],
339
+ [
340
+ M,
341
+ {
342
+ dragAndDropHooks: e,
343
+ dragState: k,
344
+ dropState: x
345
+ }
346
+ ],
347
+ [
348
+ ve,
349
+ {
350
+ render: je
351
+ }
352
+ ]
353
+ ]
354
+ }, h && /* @__PURE__ */ c.createElement(qe, null), /* @__PURE__ */ c.createElement(r, {
355
+ collection: a,
356
+ scrollRef: l,
357
+ persistedKeys: xe(D, e, x),
358
+ renderDropIndicator: De(e, x)
359
+ })), q, K));
360
+ }
361
+ const We = /* @__PURE__ */ ge("item", function(a, l, e) {
362
+ let o = E(_), { dragAndDropHooks: t, dragState: r, dropState: i } = E(M), s = ee(l), { isVirtualized: f } = E(V), { rowProps: d, gridCellProps: m, descriptionProps: b, ...g } = Te({
363
+ node: e,
364
+ shouldSelectOnPressUp: !!r,
365
+ isVirtualized: f
366
+ }, o, s), { hoverProps: u, isHovered: p } = ce({
367
+ isDisabled: !g.allowsSelection && !g.hasAction,
368
+ onHoverStart: e.props.onHoverStart,
369
+ onHoverChange: e.props.onHoverChange,
370
+ onHoverEnd: e.props.onHoverEnd
371
+ }), { isFocusVisible: R, focusProps: D } = X(), { checkboxProps: w } = Ve({
372
+ key: e.key
373
+ }, o), h = o.selectionManager.disabledBehavior === "all" && g.isDisabled ? {
374
+ isDisabled: !0
375
+ } : {}, y = null;
376
+ r && t && (y = t.useDraggableItem({
377
+ key: e.key,
378
+ hasDragButton: !0
379
+ }, r));
380
+ let $ = null, k = P(null), { visuallyHiddenProps: x } = G();
381
+ i && t && ($ = t.useDropIndicator({
382
+ target: {
383
+ type: "item",
384
+ key: e.key,
385
+ dropPosition: "on"
386
+ }
387
+ }, i, k));
388
+ let S = r && r.isDragging(e.key), I = N({
48
389
  ...a,
49
- children: /* @__PURE__ */ l(f, { children: [
50
- c,
51
- !t && o && /* @__PURE__ */ e(
52
- o,
390
+ id: void 0,
391
+ children: e.rendered,
392
+ defaultClassName: "react-aria-GridListItem",
393
+ values: {
394
+ ...g,
395
+ isHovered: p,
396
+ isFocusVisible: R,
397
+ selectionMode: o.selectionManager.selectionMode,
398
+ selectionBehavior: o.selectionManager.selectionBehavior,
399
+ allowsDragging: !!r,
400
+ isDragging: S,
401
+ isDropTarget: $ == null ? void 0 : $.isDropTarget
402
+ }
403
+ }), K = P(null);
404
+ return F(() => {
405
+ 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.');
406
+ }, []), F(() => {
407
+ 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.");
408
+ }, [
409
+ e.textValue
410
+ ]), /* @__PURE__ */ c.createElement(c.Fragment, null, $ && !$.isHidden && /* @__PURE__ */ c.createElement("div", {
411
+ role: "row",
412
+ style: {
413
+ position: "absolute"
414
+ }
415
+ }, /* @__PURE__ */ c.createElement("div", {
416
+ role: "gridcell"
417
+ }, /* @__PURE__ */ c.createElement("div", {
418
+ role: "button",
419
+ ...x,
420
+ ...$ == null ? void 0 : $.dropIndicatorProps,
421
+ ref: k
422
+ }))), /* @__PURE__ */ c.createElement("div", {
423
+ ...Z(Y(a), d, D, u, y == null ? void 0 : y.dragProps),
424
+ ...I,
425
+ ref: s,
426
+ "data-selected": g.isSelected || void 0,
427
+ "data-disabled": g.isDisabled || void 0,
428
+ "data-hovered": p || void 0,
429
+ "data-focused": g.isFocused || void 0,
430
+ "data-focus-visible": R || void 0,
431
+ "data-pressed": g.isPressed || void 0,
432
+ "data-allows-dragging": !!r || void 0,
433
+ "data-dragging": S || void 0,
434
+ "data-drop-target": ($ == null ? void 0 : $.isDropTarget) || void 0,
435
+ "data-selection-mode": o.selectionManager.selectionMode === "none" ? void 0 : o.selectionManager.selectionMode
436
+ }, /* @__PURE__ */ c.createElement("div", {
437
+ ...m,
438
+ style: {
439
+ display: "contents"
440
+ }
441
+ }, /* @__PURE__ */ c.createElement(z, {
442
+ values: [
443
+ [
444
+ be,
445
+ {
446
+ slots: {
447
+ [L]: {},
448
+ selection: w
449
+ }
450
+ }
451
+ ],
452
+ [
453
+ ne,
53
454
  {
54
- size: 20,
55
- className: s.icon
455
+ slots: {
456
+ [L]: h,
457
+ drag: {
458
+ ...y == null ? void 0 : y.dragButtonProps,
459
+ ref: K,
460
+ style: {
461
+ pointerEvents: "none"
462
+ }
463
+ }
464
+ }
56
465
  }
57
- ),
58
- t && /* @__PURE__ */ e(
59
- p,
466
+ ],
467
+ [
468
+ he,
60
469
  {
61
- size: 20,
62
- className: s.icon
470
+ slots: {
471
+ [L]: {},
472
+ description: b
473
+ }
474
+ }
475
+ ],
476
+ [
477
+ V,
478
+ ye
479
+ ],
480
+ [
481
+ _,
482
+ null
483
+ ]
484
+ ]
485
+ }, I.children))));
486
+ });
487
+ function je(n, a) {
488
+ a = ee(a);
489
+ let { dragAndDropHooks: l, dropState: e } = E(M), o = P(null), { dropIndicatorProps: t, isHidden: r, isDropTarget: i } = l.useDropIndicator(n, e, o);
490
+ return r ? null : /* @__PURE__ */ c.createElement(Ue, {
491
+ ...n,
492
+ dropIndicatorProps: t,
493
+ isDropTarget: i,
494
+ buttonRef: o,
495
+ ref: a
496
+ });
497
+ }
498
+ function Oe(n, a) {
499
+ let { dropIndicatorProps: l, isDropTarget: e, buttonRef: o, ...t } = n, { visuallyHiddenProps: r } = G(), i = N({
500
+ ...t,
501
+ defaultClassName: "react-aria-DropIndicator",
502
+ values: {
503
+ isDropTarget: e
504
+ }
505
+ });
506
+ return /* @__PURE__ */ c.createElement("div", {
507
+ ...i,
508
+ role: "row",
509
+ ref: a,
510
+ "data-drop-target": e || void 0
511
+ }, /* @__PURE__ */ c.createElement("div", {
512
+ role: "gridcell"
513
+ }, /* @__PURE__ */ c.createElement("div", {
514
+ ...r,
515
+ role: "button",
516
+ ...l,
517
+ ref: o
518
+ }), i.children));
519
+ }
520
+ const Ue = /* @__PURE__ */ re(Oe);
521
+ function qe() {
522
+ let { dragAndDropHooks: n, dropState: a } = E(M), l = P(null), { dropIndicatorProps: e } = n.useDropIndicator({
523
+ target: {
524
+ type: "root"
525
+ }
526
+ }, a, l), o = a.isDropTarget({
527
+ type: "root"
528
+ }), { visuallyHiddenProps: t } = G();
529
+ return !o && e["aria-hidden"] ? null : /* @__PURE__ */ c.createElement("div", {
530
+ role: "row",
531
+ "aria-hidden": e["aria-hidden"],
532
+ style: {
533
+ position: "absolute"
534
+ }
535
+ }, /* @__PURE__ */ c.createElement("div", {
536
+ role: "gridcell"
537
+ }, /* @__PURE__ */ c.createElement("div", {
538
+ role: "button",
539
+ ...t,
540
+ ...e,
541
+ ref: l
542
+ })));
543
+ }
544
+ const Je = '"../theme/tokens.css"', Qe = '"Inter", sans-serif', Xe = "#000000", Ye = "#b31b1b", Ze = "(max-width: 767px)", et = "#bfbfbf", tt = "#e6e6e6", rt = "#f2f2f2", ot = "_button_1eb3v_4", at = "_icon_1eb3v_19", it = "_multiSelect_1eb3v_44", lt = "_popover_1eb3v_60", nt = "_listBoxItem_1eb3v_73", A = {
545
+ tokens: Je,
546
+ display: Qe,
547
+ black: Xe,
548
+ signalRed130: Ye,
549
+ smBreakpoint: Ze,
550
+ gray50: et,
551
+ gray20: tt,
552
+ backgroundSecondary: rt,
553
+ button: ot,
554
+ icon: at,
555
+ multiSelect: it,
556
+ popover: lt,
557
+ listBoxItem: nt
558
+ }, Kt = ({
559
+ label: n,
560
+ description: a,
561
+ items: l,
562
+ onSelectionChange: e,
563
+ selectedKeys: o,
564
+ defaultSelectedKeys: t,
565
+ isDisabled: r,
566
+ isInvalid: i,
567
+ errorMessage: s
568
+ }) => {
569
+ const f = H.useRef(null), [d, m] = H.useState(
570
+ void 0
571
+ ), b = _e({
572
+ initialItems: l,
573
+ initialSelectedKeys: t
574
+ });
575
+ H.useEffect(() => {
576
+ const u = () => {
577
+ f.current && m(f.current.offsetWidth - 2);
578
+ };
579
+ return u(), window.addEventListener("resize", u), () => {
580
+ window.removeEventListener("resize", u);
581
+ };
582
+ }, []), H.useEffect(() => {
583
+ e && e(new Set(b.selectedKeys));
584
+ }, [b.selectedKeys, e]), H.useEffect(() => {
585
+ o && b.setSelectedKeys(new Set(o));
586
+ }, [o]);
587
+ const g = b.selectedKeys === "all" ? new Set(
588
+ b.items.map((u) => u.id)
589
+ ) : b.selectedKeys;
590
+ return /* @__PURE__ */ v(
591
+ "div",
592
+ {
593
+ className: A.multiSelect,
594
+ "data-disabled": r,
595
+ "data-invalid": i,
596
+ children: /* @__PURE__ */ C(
597
+ z,
598
+ {
599
+ values: [
600
+ [
601
+ // we should maybe add more here
602
+ // [LabelContext, {...labelProps, ref: labelRef}],
603
+ // [InputContext, {...inputProps, ref: inputOrTextAreaRef}],
604
+ // [TextAreaContext, {...inputProps, ref: inputOrTextAreaRef}],
605
+ // [TextContext, {
606
+ // slots: {
607
+ // description: descriptionProps,
608
+ // errorMessage: errorMessageProps
609
+ // }
610
+ // }],
611
+ pe,
612
+ {
613
+ isInvalid: i || !1,
614
+ validationErrors: [],
615
+ validationDetails: {
616
+ customError: i || !1,
617
+ badInput: !1,
618
+ patternMismatch: !1,
619
+ rangeOverflow: !1,
620
+ rangeUnderflow: !1,
621
+ stepMismatch: !1,
622
+ tooLong: !1,
623
+ tooShort: !1,
624
+ typeMismatch: !1,
625
+ valid: !1,
626
+ valueMissing: !1
627
+ }
628
+ }
629
+ ]
630
+ ],
631
+ children: [
632
+ /* @__PURE__ */ v(
633
+ Ce,
634
+ {
635
+ label: n,
636
+ description: a,
637
+ errorMessage: s,
638
+ children: /* @__PURE__ */ C(fe, { children: [
639
+ /* @__PURE__ */ C(
640
+ de,
641
+ {
642
+ className: A.button,
643
+ ref: f,
644
+ isDisabled: r,
645
+ children: [
646
+ "Välj",
647
+ /* @__PURE__ */ v(
648
+ "div",
649
+ {
650
+ className: A.icon,
651
+ "aria-hidden": "true",
652
+ children: /* @__PURE__ */ v(Le, { size: 20 })
653
+ }
654
+ )
655
+ ]
656
+ }
657
+ ),
658
+ /* @__PURE__ */ v(
659
+ ue,
660
+ {
661
+ className: A.popover,
662
+ style: { width: d },
663
+ offset: 0,
664
+ UNSTABLE_portalContainer: f.current || void 0,
665
+ children: /* @__PURE__ */ v(
666
+ ze,
667
+ {
668
+ "aria-label": n,
669
+ selectionMode: "multiple",
670
+ selectedKeys: b.selectedKeys,
671
+ onSelectionChange: b.setSelectedKeys,
672
+ children: b.items.map((u) => /* @__PURE__ */ C(
673
+ We,
674
+ {
675
+ id: u.id,
676
+ textValue: u.name,
677
+ className: A.listBoxItem,
678
+ children: [
679
+ /* @__PURE__ */ v(Me, { slot: "selection" }),
680
+ u.name
681
+ ]
682
+ },
683
+ u.id
684
+ ))
685
+ }
686
+ )
687
+ }
688
+ )
689
+ ] })
690
+ }
691
+ ),
692
+ /* @__PURE__ */ v(
693
+ He,
694
+ {
695
+ "aria-label": "Valda",
696
+ onRemove: (u) => {
697
+ b.setSelectedKeys(new Set(Array.from(b.selectedKeys).filter((p) => !u.has(p))));
698
+ },
699
+ children: Array.from(g).map((u) => {
700
+ const p = b.getItem(u);
701
+ return /* @__PURE__ */ v(
702
+ Be,
703
+ {
704
+ id: p == null ? void 0 : p.id,
705
+ textValue: p == null ? void 0 : p.name,
706
+ isDisabled: r,
707
+ dismissable: !0,
708
+ children: p == null ? void 0 : p.name
709
+ },
710
+ p == null ? void 0 : p.id
711
+ );
712
+ })
713
+ }
714
+ )
715
+ ]
63
716
  }
64
717
  )
65
- ] })
66
- }
67
- );
718
+ }
719
+ );
720
+ };
68
721
  export {
69
- F as Link,
70
- P as RouterProvider
722
+ Kt as MultiSelect
71
723
  };