@midas-ds/components 1.0.2 → 1.0.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/Button-B4vMZbC6.js +182 -0
- package/CHANGELOG.md +10 -0
- package/Checkbox-DnKWanep.js +402 -0
- package/{Collection-B3xUVWPF.js → Collection-COLWgm24.js} +179 -152
- package/Dialog-Cb6toyXO.js +1951 -0
- package/DragAndDrop-B0T3WgjL.js +40 -0
- package/FocusScope-C8i7CH6y.js +513 -0
- package/Form-BQQs3jUk.js +238 -0
- package/Group-CdwXhx8Q.js +42 -0
- package/{Hidden-BQWDvze4.js → Hidden-DngIphiL.js} +1 -1
- package/Link-iAZLB3RI.js +75 -0
- package/ListBox-BKWkIIm6.js +474 -0
- package/ListKeyboardDelegate-BH-K5hyq.js +172 -0
- package/{PressResponder-DP8ZDNGy.js → PressResponder-Cz-TRBHO.js} +10 -10
- package/README.md +21 -3
- package/SelectionManager-8o40f7mx.js +1047 -0
- package/Separator-BlvmQjwz.js +49 -0
- package/Tag--W5TgxmK.js +728 -0
- package/Text-CQPW6xs7.js +15 -0
- package/TextField-DeK_yiK-.js +225 -0
- package/TextField.module-0-u4LVPp.js +143 -0
- package/{VisuallyHidden-B_XzVvlX.js → VisuallyHidden-CFx06Bae.js} +1 -1
- package/{context-ScOIq_Gu.js → context-Bnqknrce.js} +1 -1
- package/index-B-jHjTDC.js +120 -0
- package/{index-CorR1LBD.js → index-BPdc9gJ8.js} +3 -3
- package/index-DK9ZACEc.js +642 -0
- package/{index-Dl1Q-tbj.js → index-KSgQWWiy.js} +5315 -5315
- package/index.js +45 -47
- package/index15.js +1 -1
- package/index16.js +1 -1
- package/index25.js +1 -1
- package/index26.js +1 -1
- package/index3.js +2 -4
- package/index31.js +3 -3
- package/index32.js +2 -2
- package/index33.js +2 -2
- package/index34.js +1 -1
- package/index35.js +1 -1
- package/index36.js +1 -1
- package/index37.js +1 -1
- package/index38.js +1 -1
- package/index39.js +1 -1
- package/index40.js +1 -1
- package/index41.js +1 -1
- package/index42.js +1 -1
- package/index43.js +1 -1
- package/index45.js +3 -3
- package/index5.js +1 -1
- package/index50.js +1 -1
- package/index52.js +3 -3
- package/index53.js +3 -3
- package/index54.js +1 -1
- package/index55.js +4 -4
- package/index56.js +1 -1
- package/index57.js +1 -1
- package/index58.js +1 -1
- package/index59.js +3 -3
- package/index60.js +1 -1
- package/index61.js +1 -1
- package/index62.js +1 -1
- package/index63.js +4 -4
- package/index64.js +3 -3
- package/index65.js +3 -3
- package/index66.js +1 -1
- package/index67.js +3 -3
- package/index68.js +2 -2
- package/index69.js +1 -1
- package/index71.js +1 -1
- package/index76.js +5 -5
- package/index77.js +2 -2
- package/index78.js +2 -2
- package/index79.js +1 -1
- package/index80.js +226 -227
- package/index81.js +197 -199
- package/index82.js +192 -195
- package/index83.js +181 -183
- package/index84.js +52 -54
- package/index85.js +261 -262
- package/index86.js +262 -262
- package/index87.js +209 -211
- package/index88.js +436 -440
- package/index89.js +962 -964
- package/index90.js +2401 -2399
- package/index92.js +5 -5
- package/index93.js +1 -1
- package/index94.js +1 -1
- package/link/Link.d.ts +2 -2
- package/link-button/LinkButton.d.ts +1 -1
- package/package.json +7 -1
- package/{react.esm-D8HpDGKP.js → react.esm-sMU8Z7rL.js} +1872 -1872
- package/textfield/index.d.ts +0 -2
- package/{useControlledState-S_TYcV_c.js → useControlledState-DrAoodI6.js} +1 -1
- package/{useDescription-D4_zk_sA.js → useDescription-BPs7eRff.js} +1 -1
- package/useField-Dz62UHCP.js +67 -0
- package/{useFilter-BnJDBCkt.js → useFilter-ViwzkzZe.js} +1 -1
- package/useFocusRing-BKGhL91C.js +1297 -0
- package/{useFocusable-C-N9wcwm.js → useFocusable-CRSmYEQc.js} +11 -8
- package/{useGridSelectionCheckbox-i1rsjlC-.js → useGridSelectionCheckbox-CVEvUCJL.js} +3 -3
- package/useHasTabbableChild-C8y4fwiY.js +34 -0
- package/{useHighlightSelectionDescription-JVx2MW_e.js → useHighlightSelectionDescription-CD74uzLh.js} +19 -19
- package/useListState-DKnP5TB5.js +119 -0
- package/{useLocalizedStringFormatter-DVCAZqcL.js → useLocalizedStringFormatter-DsZ-ZWSk.js} +29 -29
- package/{useSingleSelectListState-CmX9_L5H.js → useSingleSelectListState-BHTLh8Ob.js} +5 -5
- package/Button-CCevm2s3.js +0 -183
- package/Checkbox-CllWDBxF.js +0 -405
- package/Dialog-CLTyYwkS.js +0 -1889
- package/DragAndDrop-OTN7La7U.js +0 -42
- package/FocusScope-BR0SJ-cZ.js +0 -512
- package/Form-DXLoQL91.js +0 -240
- package/Group-DPMuN3h8.js +0 -44
- package/Label-C18A_4Z5.js +0 -69
- package/Link-BU1h3K2a.js +0 -77
- package/ListBox-D21tdwTs.js +0 -463
- package/ListKeyboardDelegate-DxMjfMsI.js +0 -172
- package/SelectionManager-D4WtKtey.js +0 -988
- package/Separator-DLUHK9vv.js +0 -48
- package/Tag-CEd6WWSc.js +0 -725
- package/Text-DGLaY3HR.js +0 -17
- package/TextField-C_hq9WeT.js +0 -226
- package/TextField.module-Cwq1FAm7.js +0 -141
- package/index-CEg5vZQH.js +0 -132
- package/index-CgfokhRq.js +0 -674
- package/useFocusRing-D97-G3fT.js +0 -1324
- package/useHasTabbableChild-DeuCnGGv.js +0 -34
- package/useListState-DSOTbsL3.js +0 -119
|
@@ -0,0 +1,474 @@
|
|
|
1
|
+
import { $ as ne, a as re, b as W, e as le, c as de } from "./Collection-COLWgm24.js";
|
|
2
|
+
import { n as T, f as ie, l as J, e as E, B as G, E as se, F as ce, G as ue, b as Q, H as j, p as fe, a as pe, i as R, I as be, c as $e, d as C, A as X, y as ge } from "./useFocusRing-BKGhL91C.js";
|
|
3
|
+
import { $ as _, a as ve, b as he, c as Y } from "./DragAndDrop-B0T3WgjL.js";
|
|
4
|
+
import { $ as me, a as Pe, b as De, c as xe, d as ye } from "./Separator-BlvmQjwz.js";
|
|
5
|
+
import { $ as Se } from "./Text-CQPW6xs7.js";
|
|
6
|
+
import c, { forwardRef as Z, useContext as h, useMemo as K, useRef as N, useEffect as ee, createContext as oe } from "react";
|
|
7
|
+
import { $ as ke } from "./useListState-DKnP5TB5.js";
|
|
8
|
+
import { $ as Fe } from "./context-Bnqknrce.js";
|
|
9
|
+
import { $ as He, a as we } from "./ListKeyboardDelegate-BH-K5hyq.js";
|
|
10
|
+
import { c as Be } from "./useField-Dz62UHCP.js";
|
|
11
|
+
import { d as Ee } from "./SelectionManager-8o40f7mx.js";
|
|
12
|
+
import { a as Ie } from "./FocusScope-C8i7CH6y.js";
|
|
13
|
+
const q = /* @__PURE__ */ new WeakMap();
|
|
14
|
+
function Me(o) {
|
|
15
|
+
return typeof o == "string" ? o.replace(/\s*/g, "") : "" + o;
|
|
16
|
+
}
|
|
17
|
+
function Ve(o, e) {
|
|
18
|
+
let n = q.get(o);
|
|
19
|
+
if (!n) throw new Error("Unknown list");
|
|
20
|
+
return `${n.id}-option-${Me(e)}`;
|
|
21
|
+
}
|
|
22
|
+
function Ae(o, e, n) {
|
|
23
|
+
let a = T(o, {
|
|
24
|
+
labelable: !0
|
|
25
|
+
}), l = o.selectionBehavior || "toggle", r = o.linkBehavior || (l === "replace" ? "action" : "override");
|
|
26
|
+
l === "toggle" && r === "action" && (r = "override");
|
|
27
|
+
let { listProps: t } = me({
|
|
28
|
+
...o,
|
|
29
|
+
ref: n,
|
|
30
|
+
selectionManager: e.selectionManager,
|
|
31
|
+
collection: e.collection,
|
|
32
|
+
disabledKeys: e.disabledKeys,
|
|
33
|
+
linkBehavior: r
|
|
34
|
+
}), { focusWithinProps: d } = ie({
|
|
35
|
+
onFocusWithin: o.onFocus,
|
|
36
|
+
onBlurWithin: o.onBlur,
|
|
37
|
+
onFocusWithinChange: o.onFocusChange
|
|
38
|
+
}), i = J(o.id);
|
|
39
|
+
q.set(e, {
|
|
40
|
+
id: i,
|
|
41
|
+
shouldUseVirtualFocus: o.shouldUseVirtualFocus,
|
|
42
|
+
shouldSelectOnPressUp: o.shouldSelectOnPressUp,
|
|
43
|
+
shouldFocusOnHover: o.shouldFocusOnHover,
|
|
44
|
+
isVirtualized: o.isVirtualized,
|
|
45
|
+
onAction: o.onAction,
|
|
46
|
+
linkBehavior: r
|
|
47
|
+
});
|
|
48
|
+
let { labelProps: f, fieldProps: p } = Be({
|
|
49
|
+
...o,
|
|
50
|
+
id: i,
|
|
51
|
+
// listbox is not an HTML input element so it
|
|
52
|
+
// shouldn't be labeled by a <label> element.
|
|
53
|
+
labelElementType: "span"
|
|
54
|
+
});
|
|
55
|
+
return {
|
|
56
|
+
labelProps: f,
|
|
57
|
+
listBoxProps: E(a, d, e.selectionManager.selectionMode === "multiple" ? {
|
|
58
|
+
"aria-multiselectable": "true"
|
|
59
|
+
} : {}, {
|
|
60
|
+
role: "listbox",
|
|
61
|
+
...E(p, t)
|
|
62
|
+
})
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
function Te(o, e, n) {
|
|
66
|
+
var a, l;
|
|
67
|
+
let { key: r } = o, t = q.get(e);
|
|
68
|
+
var d;
|
|
69
|
+
let i = (d = o.isDisabled) !== null && d !== void 0 ? d : e.selectionManager.isDisabled(r);
|
|
70
|
+
var f;
|
|
71
|
+
let p = (f = o.isSelected) !== null && f !== void 0 ? f : e.selectionManager.isSelected(r);
|
|
72
|
+
var g;
|
|
73
|
+
let u = (g = o.shouldSelectOnPressUp) !== null && g !== void 0 ? g : t == null ? void 0 : t.shouldSelectOnPressUp;
|
|
74
|
+
var v;
|
|
75
|
+
let S = (v = o.shouldFocusOnHover) !== null && v !== void 0 ? v : t == null ? void 0 : t.shouldFocusOnHover;
|
|
76
|
+
var $;
|
|
77
|
+
let b = ($ = o.shouldUseVirtualFocus) !== null && $ !== void 0 ? $ : t == null ? void 0 : t.shouldUseVirtualFocus;
|
|
78
|
+
var D;
|
|
79
|
+
let x = (D = o.isVirtualized) !== null && D !== void 0 ? D : t == null ? void 0 : t.isVirtualized, F = G(), I = G(), y = {
|
|
80
|
+
role: "option",
|
|
81
|
+
"aria-disabled": i || void 0,
|
|
82
|
+
"aria-selected": e.selectionManager.selectionMode !== "none" ? p : void 0
|
|
83
|
+
};
|
|
84
|
+
se() && ce() || (y["aria-label"] = o["aria-label"], y["aria-labelledby"] = F, y["aria-describedby"] = I);
|
|
85
|
+
let s = e.collection.getItem(r);
|
|
86
|
+
if (x) {
|
|
87
|
+
let P = Number(s == null ? void 0 : s.index);
|
|
88
|
+
y["aria-posinset"] = Number.isNaN(P) ? void 0 : P + 1, y["aria-setsize"] = Pe(e.collection);
|
|
89
|
+
}
|
|
90
|
+
let m = t != null && t.onAction ? () => {
|
|
91
|
+
var P;
|
|
92
|
+
return t == null || (P = t.onAction) === null || P === void 0 ? void 0 : P.call(t, r);
|
|
93
|
+
} : void 0, k = Ve(e, r), { itemProps: H, isPressed: M, isFocused: w, hasAction: U, allowsSelection: V } = Ee({
|
|
94
|
+
selectionManager: e.selectionManager,
|
|
95
|
+
key: r,
|
|
96
|
+
ref: n,
|
|
97
|
+
shouldSelectOnPressUp: u,
|
|
98
|
+
allowsDifferentPressOrigin: u && S,
|
|
99
|
+
isVirtualized: x,
|
|
100
|
+
shouldUseVirtualFocus: b,
|
|
101
|
+
isDisabled: i,
|
|
102
|
+
onAction: m || !(s == null || (a = s.props) === null || a === void 0) && a.onAction ? ue(s == null || (l = s.props) === null || l === void 0 ? void 0 : l.onAction, m) : void 0,
|
|
103
|
+
linkBehavior: t == null ? void 0 : t.linkBehavior,
|
|
104
|
+
id: k
|
|
105
|
+
}), { hoverProps: A } = Q({
|
|
106
|
+
isDisabled: i || !S,
|
|
107
|
+
onHoverStart() {
|
|
108
|
+
j() || (e.selectionManager.setFocused(!0), e.selectionManager.setFocusedKey(r));
|
|
109
|
+
}
|
|
110
|
+
}), B = T(s == null ? void 0 : s.props);
|
|
111
|
+
delete B.id;
|
|
112
|
+
let O = fe(s == null ? void 0 : s.props);
|
|
113
|
+
return {
|
|
114
|
+
optionProps: {
|
|
115
|
+
...y,
|
|
116
|
+
...E(B, H, A, O),
|
|
117
|
+
id: k
|
|
118
|
+
},
|
|
119
|
+
labelProps: {
|
|
120
|
+
id: F
|
|
121
|
+
},
|
|
122
|
+
descriptionProps: {
|
|
123
|
+
id: I
|
|
124
|
+
},
|
|
125
|
+
isFocused: w,
|
|
126
|
+
isFocusVisible: w && j(),
|
|
127
|
+
isSelected: p,
|
|
128
|
+
isDisabled: i,
|
|
129
|
+
isPressed: M,
|
|
130
|
+
allowsSelection: V,
|
|
131
|
+
hasAction: U
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
function Ce(o) {
|
|
135
|
+
let { heading: e, "aria-label": n } = o, a = J();
|
|
136
|
+
return {
|
|
137
|
+
itemProps: {
|
|
138
|
+
role: "presentation"
|
|
139
|
+
},
|
|
140
|
+
headingProps: e ? {
|
|
141
|
+
// Techincally, listbox cannot contain headings according to ARIA.
|
|
142
|
+
// We hide the heading from assistive technology, using role="presentation",
|
|
143
|
+
// and only use it as a visual label for the nested group.
|
|
144
|
+
id: a,
|
|
145
|
+
role: "presentation"
|
|
146
|
+
} : {},
|
|
147
|
+
groupProps: {
|
|
148
|
+
role: "group",
|
|
149
|
+
"aria-label": n,
|
|
150
|
+
"aria-labelledby": e ? a : void 0
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
const ae = /* @__PURE__ */ oe(null), L = /* @__PURE__ */ oe(null), eo = /* @__PURE__ */ Z(function(e, n) {
|
|
155
|
+
[e, n] = pe(e, n, ae);
|
|
156
|
+
let a = h(L);
|
|
157
|
+
return a ? /* @__PURE__ */ c.createElement(te, {
|
|
158
|
+
state: a,
|
|
159
|
+
props: e,
|
|
160
|
+
listBoxRef: n
|
|
161
|
+
}) : /* @__PURE__ */ c.createElement(ne, {
|
|
162
|
+
content: /* @__PURE__ */ c.createElement(re, e)
|
|
163
|
+
}, (l) => /* @__PURE__ */ c.createElement(_e, {
|
|
164
|
+
props: e,
|
|
165
|
+
listBoxRef: n,
|
|
166
|
+
collection: l
|
|
167
|
+
}));
|
|
168
|
+
});
|
|
169
|
+
function _e({ props: o, listBoxRef: e, collection: n }) {
|
|
170
|
+
o = {
|
|
171
|
+
...o,
|
|
172
|
+
collection: n,
|
|
173
|
+
children: null,
|
|
174
|
+
items: null
|
|
175
|
+
};
|
|
176
|
+
let { layoutDelegate: a } = h(W), { filterFn: l, collectionProps: r, collectionRef: t } = h(De) || {};
|
|
177
|
+
e = R(K(() => be(e, t !== void 0 ? t : null), [
|
|
178
|
+
t,
|
|
179
|
+
e
|
|
180
|
+
]));
|
|
181
|
+
let d = K(() => l ? n.filter(l) : n, [
|
|
182
|
+
n,
|
|
183
|
+
l
|
|
184
|
+
]), i = ke({
|
|
185
|
+
...o,
|
|
186
|
+
collection: d,
|
|
187
|
+
layoutDelegate: a
|
|
188
|
+
});
|
|
189
|
+
return /* @__PURE__ */ c.createElement(te, {
|
|
190
|
+
state: i,
|
|
191
|
+
props: {
|
|
192
|
+
...o,
|
|
193
|
+
...r
|
|
194
|
+
},
|
|
195
|
+
listBoxRef: e
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
function te({ state: o, props: e, listBoxRef: n }) {
|
|
199
|
+
let { dragAndDropHooks: a, layout: l = "stack", orientation: r = "vertical" } = e, { collection: t, selectionManager: d } = o, i = !!(a != null && a.useDraggableCollectionState), f = !!(a != null && a.useDroppableCollectionState), { direction: p } = Fe(), { disabledBehavior: g, disabledKeys: u } = d, v = He({
|
|
200
|
+
usage: "search",
|
|
201
|
+
sensitivity: "base"
|
|
202
|
+
}), { isVirtualized: S, layoutDelegate: $, dropTargetDelegate: b, CollectionRoot: D } = h(W), x = K(() => e.keyboardDelegate || new we({
|
|
203
|
+
collection: t,
|
|
204
|
+
collator: v,
|
|
205
|
+
ref: n,
|
|
206
|
+
disabledKeys: u,
|
|
207
|
+
disabledBehavior: g,
|
|
208
|
+
layout: l,
|
|
209
|
+
orientation: r,
|
|
210
|
+
direction: p,
|
|
211
|
+
layoutDelegate: $
|
|
212
|
+
}), [
|
|
213
|
+
t,
|
|
214
|
+
v,
|
|
215
|
+
n,
|
|
216
|
+
g,
|
|
217
|
+
u,
|
|
218
|
+
r,
|
|
219
|
+
p,
|
|
220
|
+
e.keyboardDelegate,
|
|
221
|
+
l,
|
|
222
|
+
$
|
|
223
|
+
]), { listBoxProps: F } = Ae({
|
|
224
|
+
...e,
|
|
225
|
+
shouldSelectOnPressUp: i || e.shouldSelectOnPressUp,
|
|
226
|
+
keyboardDelegate: x,
|
|
227
|
+
isVirtualized: S
|
|
228
|
+
}, o, n), I = N(i), y = N(f);
|
|
229
|
+
ee(() => {
|
|
230
|
+
I.current !== i && console.warn("Drag hooks were provided during one render, but not another. This should be avoided as it may produce unexpected behavior."), y.current !== f && console.warn("Drop hooks were provided during one render, but not another. This should be avoided as it may produce unexpected behavior.");
|
|
231
|
+
}, [
|
|
232
|
+
i,
|
|
233
|
+
f
|
|
234
|
+
]);
|
|
235
|
+
let s, m, k, H = !1, M = null, w = N(null);
|
|
236
|
+
if (i && a) {
|
|
237
|
+
s = a.useDraggableCollectionState({
|
|
238
|
+
collection: t,
|
|
239
|
+
selectionManager: d,
|
|
240
|
+
preview: a.renderDragPreview ? w : void 0
|
|
241
|
+
}), a.useDraggableCollection({}, s, n);
|
|
242
|
+
let z = a.DragPreview;
|
|
243
|
+
M = a.renderDragPreview ? /* @__PURE__ */ c.createElement(z, {
|
|
244
|
+
ref: w
|
|
245
|
+
}, a.renderDragPreview) : null;
|
|
246
|
+
}
|
|
247
|
+
if (f && a) {
|
|
248
|
+
m = a.useDroppableCollectionState({
|
|
249
|
+
collection: t,
|
|
250
|
+
selectionManager: d
|
|
251
|
+
});
|
|
252
|
+
let z = a.dropTargetDelegate || b || new a.ListDropTargetDelegate(t, n, {
|
|
253
|
+
orientation: r,
|
|
254
|
+
layout: l,
|
|
255
|
+
direction: p
|
|
256
|
+
});
|
|
257
|
+
k = a.useDroppableCollection({
|
|
258
|
+
keyboardDelegate: x,
|
|
259
|
+
dropTargetDelegate: z
|
|
260
|
+
}, m, n), H = m.isDropTarget({
|
|
261
|
+
type: "root"
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
let { focusProps: U, isFocused: V, isFocusVisible: A } = $e(), B = {
|
|
265
|
+
isDropTarget: H,
|
|
266
|
+
isEmpty: o.collection.size === 0,
|
|
267
|
+
isFocused: V,
|
|
268
|
+
isFocusVisible: A,
|
|
269
|
+
layout: e.layout || "stack",
|
|
270
|
+
state: o
|
|
271
|
+
}, O = C({
|
|
272
|
+
className: e.className,
|
|
273
|
+
style: e.style,
|
|
274
|
+
defaultClassName: "react-aria-ListBox",
|
|
275
|
+
values: B
|
|
276
|
+
}), P = null;
|
|
277
|
+
return o.collection.size === 0 && e.renderEmptyState && (P = /* @__PURE__ */ c.createElement("div", {
|
|
278
|
+
// eslint-disable-next-line
|
|
279
|
+
role: "option",
|
|
280
|
+
style: {
|
|
281
|
+
display: "contents"
|
|
282
|
+
}
|
|
283
|
+
}, e.renderEmptyState(B))), /* @__PURE__ */ c.createElement(Ie, null, /* @__PURE__ */ c.createElement("div", {
|
|
284
|
+
...T(e),
|
|
285
|
+
...E(F, U, k == null ? void 0 : k.collectionProps),
|
|
286
|
+
...O,
|
|
287
|
+
ref: n,
|
|
288
|
+
slot: e.slot || void 0,
|
|
289
|
+
onScroll: e.onScroll,
|
|
290
|
+
"data-drop-target": H || void 0,
|
|
291
|
+
"data-empty": o.collection.size === 0 || void 0,
|
|
292
|
+
"data-focused": V || void 0,
|
|
293
|
+
"data-focus-visible": A || void 0,
|
|
294
|
+
"data-layout": e.layout || "stack",
|
|
295
|
+
"data-orientation": e.orientation || "vertical"
|
|
296
|
+
}, /* @__PURE__ */ c.createElement(X, {
|
|
297
|
+
values: [
|
|
298
|
+
[
|
|
299
|
+
ae,
|
|
300
|
+
e
|
|
301
|
+
],
|
|
302
|
+
[
|
|
303
|
+
L,
|
|
304
|
+
o
|
|
305
|
+
],
|
|
306
|
+
[
|
|
307
|
+
_,
|
|
308
|
+
{
|
|
309
|
+
dragAndDropHooks: a,
|
|
310
|
+
dragState: s,
|
|
311
|
+
dropState: m
|
|
312
|
+
}
|
|
313
|
+
],
|
|
314
|
+
[
|
|
315
|
+
xe,
|
|
316
|
+
{
|
|
317
|
+
elementType: "div"
|
|
318
|
+
}
|
|
319
|
+
],
|
|
320
|
+
[
|
|
321
|
+
ve,
|
|
322
|
+
{
|
|
323
|
+
render: Ue
|
|
324
|
+
}
|
|
325
|
+
],
|
|
326
|
+
[
|
|
327
|
+
le,
|
|
328
|
+
{
|
|
329
|
+
name: "ListBoxSection",
|
|
330
|
+
render: Le
|
|
331
|
+
}
|
|
332
|
+
]
|
|
333
|
+
]
|
|
334
|
+
}, /* @__PURE__ */ c.createElement(D, {
|
|
335
|
+
collection: t,
|
|
336
|
+
scrollRef: n,
|
|
337
|
+
persistedKeys: he(d, a, m),
|
|
338
|
+
renderDropIndicator: Y(a, m)
|
|
339
|
+
})), P, M));
|
|
340
|
+
}
|
|
341
|
+
function Le(o, e, n, a = "react-aria-ListBoxSection") {
|
|
342
|
+
let l = h(L), { dragAndDropHooks: r, dropState: t } = h(_), { CollectionBranch: d } = h(W), [i, f] = ge();
|
|
343
|
+
var p;
|
|
344
|
+
let { headingProps: g, groupProps: u } = Ce({
|
|
345
|
+
heading: f,
|
|
346
|
+
"aria-label": (p = o["aria-label"]) !== null && p !== void 0 ? p : void 0
|
|
347
|
+
}), v = C({
|
|
348
|
+
defaultClassName: a,
|
|
349
|
+
className: o.className,
|
|
350
|
+
style: o.style,
|
|
351
|
+
values: {}
|
|
352
|
+
});
|
|
353
|
+
return /* @__PURE__ */ c.createElement("section", {
|
|
354
|
+
...T(o),
|
|
355
|
+
...u,
|
|
356
|
+
...v,
|
|
357
|
+
ref: e
|
|
358
|
+
}, /* @__PURE__ */ c.createElement(ye.Provider, {
|
|
359
|
+
value: {
|
|
360
|
+
...g,
|
|
361
|
+
ref: i
|
|
362
|
+
}
|
|
363
|
+
}, /* @__PURE__ */ c.createElement(d, {
|
|
364
|
+
collection: l.collection,
|
|
365
|
+
parent: n,
|
|
366
|
+
renderDropIndicator: Y(r, t)
|
|
367
|
+
})));
|
|
368
|
+
}
|
|
369
|
+
const oo = /* @__PURE__ */ de("item", function(e, n, a) {
|
|
370
|
+
let l = R(n), r = h(L), { dragAndDropHooks: t, dragState: d, dropState: i } = h(_), { optionProps: f, labelProps: p, descriptionProps: g, ...u } = Te({
|
|
371
|
+
key: a.key,
|
|
372
|
+
"aria-label": e == null ? void 0 : e["aria-label"]
|
|
373
|
+
}, r, l), { hoverProps: v, isHovered: S } = Q({
|
|
374
|
+
isDisabled: !u.allowsSelection && !u.hasAction,
|
|
375
|
+
onHoverStart: a.props.onHoverStart,
|
|
376
|
+
onHoverChange: a.props.onHoverChange,
|
|
377
|
+
onHoverEnd: a.props.onHoverEnd
|
|
378
|
+
}), $ = null;
|
|
379
|
+
d && t && ($ = t.useDraggableItem({
|
|
380
|
+
key: a.key
|
|
381
|
+
}, d));
|
|
382
|
+
let b = null;
|
|
383
|
+
i && t && (b = t.useDroppableItem({
|
|
384
|
+
target: {
|
|
385
|
+
type: "item",
|
|
386
|
+
key: a.key,
|
|
387
|
+
dropPosition: "on"
|
|
388
|
+
}
|
|
389
|
+
}, i, l));
|
|
390
|
+
let D = d && d.isDragging(a.key), x = C({
|
|
391
|
+
...e,
|
|
392
|
+
id: void 0,
|
|
393
|
+
children: e.children,
|
|
394
|
+
defaultClassName: "react-aria-ListBoxItem",
|
|
395
|
+
values: {
|
|
396
|
+
...u,
|
|
397
|
+
isHovered: S,
|
|
398
|
+
selectionMode: r.selectionManager.selectionMode,
|
|
399
|
+
selectionBehavior: r.selectionManager.selectionBehavior,
|
|
400
|
+
allowsDragging: !!d,
|
|
401
|
+
isDragging: D,
|
|
402
|
+
isDropTarget: b == null ? void 0 : b.isDropTarget
|
|
403
|
+
}
|
|
404
|
+
});
|
|
405
|
+
ee(() => {
|
|
406
|
+
a.textValue || console.warn("A `textValue` prop is required for <ListBoxItem> elements with non-plain text children in order to support accessibility features such as type to select.");
|
|
407
|
+
}, [
|
|
408
|
+
a.textValue
|
|
409
|
+
]);
|
|
410
|
+
let F = e.href ? "a" : "div";
|
|
411
|
+
return /* @__PURE__ */ c.createElement(F, {
|
|
412
|
+
...E(f, v, $ == null ? void 0 : $.dragProps, b == null ? void 0 : b.dropProps),
|
|
413
|
+
...x,
|
|
414
|
+
ref: l,
|
|
415
|
+
"data-allows-dragging": !!d || void 0,
|
|
416
|
+
"data-selected": u.isSelected || void 0,
|
|
417
|
+
"data-disabled": u.isDisabled || void 0,
|
|
418
|
+
"data-hovered": S || void 0,
|
|
419
|
+
"data-focused": u.isFocused || void 0,
|
|
420
|
+
"data-focus-visible": u.isFocusVisible || void 0,
|
|
421
|
+
"data-pressed": u.isPressed || void 0,
|
|
422
|
+
"data-dragging": D || void 0,
|
|
423
|
+
"data-drop-target": (b == null ? void 0 : b.isDropTarget) || void 0,
|
|
424
|
+
"data-selection-mode": r.selectionManager.selectionMode === "none" ? void 0 : r.selectionManager.selectionMode
|
|
425
|
+
}, /* @__PURE__ */ c.createElement(X, {
|
|
426
|
+
values: [
|
|
427
|
+
[
|
|
428
|
+
Se,
|
|
429
|
+
{
|
|
430
|
+
slots: {
|
|
431
|
+
label: p,
|
|
432
|
+
description: g
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
]
|
|
436
|
+
]
|
|
437
|
+
}, x.children));
|
|
438
|
+
});
|
|
439
|
+
function Ue(o, e) {
|
|
440
|
+
e = R(e);
|
|
441
|
+
let { dragAndDropHooks: n, dropState: a } = h(_), { dropIndicatorProps: l, isHidden: r, isDropTarget: t } = n.useDropIndicator(o, a, e);
|
|
442
|
+
return r ? null : /* @__PURE__ */ c.createElement(ze, {
|
|
443
|
+
...o,
|
|
444
|
+
dropIndicatorProps: l,
|
|
445
|
+
isDropTarget: t,
|
|
446
|
+
ref: e
|
|
447
|
+
});
|
|
448
|
+
}
|
|
449
|
+
function Oe(o, e) {
|
|
450
|
+
let { dropIndicatorProps: n, isDropTarget: a, ...l } = o, r = C({
|
|
451
|
+
...l,
|
|
452
|
+
defaultClassName: "react-aria-DropIndicator",
|
|
453
|
+
values: {
|
|
454
|
+
isDropTarget: a
|
|
455
|
+
}
|
|
456
|
+
});
|
|
457
|
+
return /* @__PURE__ */ c.createElement("div", {
|
|
458
|
+
...n,
|
|
459
|
+
...r,
|
|
460
|
+
// eslint-disable-next-line
|
|
461
|
+
role: "option",
|
|
462
|
+
ref: e,
|
|
463
|
+
"data-drop-target": a || void 0
|
|
464
|
+
});
|
|
465
|
+
}
|
|
466
|
+
const ze = /* @__PURE__ */ Z(Oe);
|
|
467
|
+
export {
|
|
468
|
+
L as $,
|
|
469
|
+
ae as a,
|
|
470
|
+
eo as b,
|
|
471
|
+
oo as c,
|
|
472
|
+
q as d,
|
|
473
|
+
Ve as e
|
|
474
|
+
};
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { c as o } from "./SelectionManager-8o40f7mx.js";
|
|
2
|
+
import { $ as u } from "./context-Bnqknrce.js";
|
|
3
|
+
function f(r, e) {
|
|
4
|
+
let t = r;
|
|
5
|
+
for (o(t, e) && (t = t.parentElement); t && !o(t, e); ) t = t.parentElement;
|
|
6
|
+
return t || document.scrollingElement || document.documentElement;
|
|
7
|
+
}
|
|
8
|
+
let a = /* @__PURE__ */ new Map();
|
|
9
|
+
function g(r) {
|
|
10
|
+
let { locale: e } = u(), t = e + (r ? Object.entries(r).sort((l, n) => l[0] < n[0] ? -1 : 1).join() : "");
|
|
11
|
+
if (a.has(t)) return a.get(t);
|
|
12
|
+
let i = new Intl.Collator(e, r);
|
|
13
|
+
return a.set(t, i), i;
|
|
14
|
+
}
|
|
15
|
+
class h {
|
|
16
|
+
getItemRect(e) {
|
|
17
|
+
let t = this.ref.current;
|
|
18
|
+
if (!t) return null;
|
|
19
|
+
let i = e != null ? t.querySelector(`[data-key="${CSS.escape(e.toString())}"]`) : null;
|
|
20
|
+
if (!i) return null;
|
|
21
|
+
let l = t.getBoundingClientRect(), n = i.getBoundingClientRect();
|
|
22
|
+
return {
|
|
23
|
+
x: n.left - l.left + t.scrollLeft,
|
|
24
|
+
y: n.top - l.top + t.scrollTop,
|
|
25
|
+
width: n.width,
|
|
26
|
+
height: n.height
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
getContentSize() {
|
|
30
|
+
let e = this.ref.current;
|
|
31
|
+
var t, i;
|
|
32
|
+
return {
|
|
33
|
+
width: (t = e == null ? void 0 : e.scrollWidth) !== null && t !== void 0 ? t : 0,
|
|
34
|
+
height: (i = e == null ? void 0 : e.scrollHeight) !== null && i !== void 0 ? i : 0
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
getVisibleRect() {
|
|
38
|
+
let e = this.ref.current;
|
|
39
|
+
var t, i, l, n;
|
|
40
|
+
return {
|
|
41
|
+
x: (t = e == null ? void 0 : e.scrollLeft) !== null && t !== void 0 ? t : 0,
|
|
42
|
+
y: (i = e == null ? void 0 : e.scrollTop) !== null && i !== void 0 ? i : 0,
|
|
43
|
+
width: (l = e == null ? void 0 : e.offsetWidth) !== null && l !== void 0 ? l : 0,
|
|
44
|
+
height: (n = e == null ? void 0 : e.offsetHeight) !== null && n !== void 0 ? n : 0
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
constructor(e) {
|
|
48
|
+
this.ref = e;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
class y {
|
|
52
|
+
isDisabled(e) {
|
|
53
|
+
var t;
|
|
54
|
+
return this.disabledBehavior === "all" && (((t = e.props) === null || t === void 0 ? void 0 : t.isDisabled) || this.disabledKeys.has(e.key));
|
|
55
|
+
}
|
|
56
|
+
findNextNonDisabled(e, t) {
|
|
57
|
+
let i = e;
|
|
58
|
+
for (; i != null; ) {
|
|
59
|
+
let l = this.collection.getItem(i);
|
|
60
|
+
if ((l == null ? void 0 : l.type) === "item" && !this.isDisabled(l)) return i;
|
|
61
|
+
i = t(i);
|
|
62
|
+
}
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
getNextKey(e) {
|
|
66
|
+
let t = e;
|
|
67
|
+
return t = this.collection.getKeyAfter(t), this.findNextNonDisabled(t, (i) => this.collection.getKeyAfter(i));
|
|
68
|
+
}
|
|
69
|
+
getPreviousKey(e) {
|
|
70
|
+
let t = e;
|
|
71
|
+
return t = this.collection.getKeyBefore(t), this.findNextNonDisabled(t, (i) => this.collection.getKeyBefore(i));
|
|
72
|
+
}
|
|
73
|
+
findKey(e, t, i) {
|
|
74
|
+
let l = e, n = this.layoutDelegate.getItemRect(l);
|
|
75
|
+
if (!n || l == null) return null;
|
|
76
|
+
let s = n;
|
|
77
|
+
do {
|
|
78
|
+
if (l = t(l), l == null) break;
|
|
79
|
+
n = this.layoutDelegate.getItemRect(l);
|
|
80
|
+
} while (n && i(s, n) && l != null);
|
|
81
|
+
return l;
|
|
82
|
+
}
|
|
83
|
+
isSameRow(e, t) {
|
|
84
|
+
return e.y === t.y || e.x !== t.x;
|
|
85
|
+
}
|
|
86
|
+
isSameColumn(e, t) {
|
|
87
|
+
return e.x === t.x || e.y !== t.y;
|
|
88
|
+
}
|
|
89
|
+
getKeyBelow(e) {
|
|
90
|
+
return this.layout === "grid" && this.orientation === "vertical" ? this.findKey(e, (t) => this.getNextKey(t), this.isSameRow) : this.getNextKey(e);
|
|
91
|
+
}
|
|
92
|
+
getKeyAbove(e) {
|
|
93
|
+
return this.layout === "grid" && this.orientation === "vertical" ? this.findKey(e, (t) => this.getPreviousKey(t), this.isSameRow) : this.getPreviousKey(e);
|
|
94
|
+
}
|
|
95
|
+
getNextColumn(e, t) {
|
|
96
|
+
return t ? this.getPreviousKey(e) : this.getNextKey(e);
|
|
97
|
+
}
|
|
98
|
+
getKeyRightOf(e) {
|
|
99
|
+
let t = this.direction === "ltr" ? "getKeyRightOf" : "getKeyLeftOf";
|
|
100
|
+
return this.layoutDelegate[t] ? (e = this.layoutDelegate[t](e), this.findNextNonDisabled(e, (i) => this.layoutDelegate[t](i))) : this.layout === "grid" ? this.orientation === "vertical" ? this.getNextColumn(e, this.direction === "rtl") : this.findKey(e, (i) => this.getNextColumn(i, this.direction === "rtl"), this.isSameColumn) : this.orientation === "horizontal" ? this.getNextColumn(e, this.direction === "rtl") : null;
|
|
101
|
+
}
|
|
102
|
+
getKeyLeftOf(e) {
|
|
103
|
+
let t = this.direction === "ltr" ? "getKeyLeftOf" : "getKeyRightOf";
|
|
104
|
+
return this.layoutDelegate[t] ? (e = this.layoutDelegate[t](e), this.findNextNonDisabled(e, (i) => this.layoutDelegate[t](i))) : this.layout === "grid" ? this.orientation === "vertical" ? this.getNextColumn(e, this.direction === "ltr") : this.findKey(e, (i) => this.getNextColumn(i, this.direction === "ltr"), this.isSameColumn) : this.orientation === "horizontal" ? this.getNextColumn(e, this.direction === "ltr") : null;
|
|
105
|
+
}
|
|
106
|
+
getFirstKey() {
|
|
107
|
+
let e = this.collection.getFirstKey();
|
|
108
|
+
return this.findNextNonDisabled(e, (t) => this.collection.getKeyAfter(t));
|
|
109
|
+
}
|
|
110
|
+
getLastKey() {
|
|
111
|
+
let e = this.collection.getLastKey();
|
|
112
|
+
return this.findNextNonDisabled(e, (t) => this.collection.getKeyBefore(t));
|
|
113
|
+
}
|
|
114
|
+
getKeyPageAbove(e) {
|
|
115
|
+
let t = this.ref.current, i = this.layoutDelegate.getItemRect(e);
|
|
116
|
+
if (!i) return null;
|
|
117
|
+
if (t && !o(t)) return this.getFirstKey();
|
|
118
|
+
let l = e;
|
|
119
|
+
if (this.orientation === "horizontal") {
|
|
120
|
+
let n = Math.max(0, i.x + i.width - this.layoutDelegate.getVisibleRect().width);
|
|
121
|
+
for (; i && i.x > n && l != null; )
|
|
122
|
+
l = this.getKeyAbove(l), i = l == null ? null : this.layoutDelegate.getItemRect(l);
|
|
123
|
+
} else {
|
|
124
|
+
let n = Math.max(0, i.y + i.height - this.layoutDelegate.getVisibleRect().height);
|
|
125
|
+
for (; i && i.y > n && l != null; )
|
|
126
|
+
l = this.getKeyAbove(l), i = l == null ? null : this.layoutDelegate.getItemRect(l);
|
|
127
|
+
}
|
|
128
|
+
return l ?? this.getFirstKey();
|
|
129
|
+
}
|
|
130
|
+
getKeyPageBelow(e) {
|
|
131
|
+
let t = this.ref.current, i = this.layoutDelegate.getItemRect(e);
|
|
132
|
+
if (!i) return null;
|
|
133
|
+
if (t && !o(t)) return this.getLastKey();
|
|
134
|
+
let l = e;
|
|
135
|
+
if (this.orientation === "horizontal") {
|
|
136
|
+
let n = Math.min(this.layoutDelegate.getContentSize().width, i.y - i.width + this.layoutDelegate.getVisibleRect().width);
|
|
137
|
+
for (; i && i.x < n && l != null; )
|
|
138
|
+
l = this.getKeyBelow(l), i = l == null ? null : this.layoutDelegate.getItemRect(l);
|
|
139
|
+
} else {
|
|
140
|
+
let n = Math.min(this.layoutDelegate.getContentSize().height, i.y - i.height + this.layoutDelegate.getVisibleRect().height);
|
|
141
|
+
for (; i && i.y < n && l != null; )
|
|
142
|
+
l = this.getKeyBelow(l), i = l == null ? null : this.layoutDelegate.getItemRect(l);
|
|
143
|
+
}
|
|
144
|
+
return l ?? this.getLastKey();
|
|
145
|
+
}
|
|
146
|
+
getKeyForSearch(e, t) {
|
|
147
|
+
if (!this.collator) return null;
|
|
148
|
+
let i = this.collection, l = t || this.getFirstKey();
|
|
149
|
+
for (; l != null; ) {
|
|
150
|
+
let n = i.getItem(l);
|
|
151
|
+
if (!n) return null;
|
|
152
|
+
let s = n.textValue.slice(0, e.length);
|
|
153
|
+
if (n.textValue && this.collator.compare(s, e) === 0) return l;
|
|
154
|
+
l = this.getNextKey(l);
|
|
155
|
+
}
|
|
156
|
+
return null;
|
|
157
|
+
}
|
|
158
|
+
constructor(...e) {
|
|
159
|
+
if (e.length === 1) {
|
|
160
|
+
let t = e[0];
|
|
161
|
+
this.collection = t.collection, this.ref = t.ref, this.collator = t.collator, this.disabledKeys = t.disabledKeys || /* @__PURE__ */ new Set(), this.disabledBehavior = t.disabledBehavior || "all", this.orientation = t.orientation || "vertical", this.direction = t.direction, this.layout = t.layout || "stack", this.layoutDelegate = t.layoutDelegate || new h(t.ref);
|
|
162
|
+
} else
|
|
163
|
+
this.collection = e[0], this.disabledKeys = e[1], this.ref = e[2], this.collator = e[3], this.layout = "stack", this.orientation = "vertical", this.disabledBehavior = "all", this.layoutDelegate = new h(this.ref);
|
|
164
|
+
this.layout === "stack" && this.orientation === "vertical" && (this.getKeyLeftOf = void 0, this.getKeyRightOf = void 0);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
export {
|
|
168
|
+
g as $,
|
|
169
|
+
y as a,
|
|
170
|
+
f as b,
|
|
171
|
+
h as c
|
|
172
|
+
};
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { h as s, i as
|
|
2
|
-
import
|
|
3
|
-
const h = /* @__PURE__ */
|
|
4
|
-
let o =
|
|
5
|
-
r =
|
|
6
|
-
let
|
|
1
|
+
import { h as s, i as c, e as d, j as i } from "./useFocusRing-BKGhL91C.js";
|
|
2
|
+
import f, { useRef as u, useContext as b, useEffect as l, useMemo as $ } from "react";
|
|
3
|
+
const h = /* @__PURE__ */ f.forwardRef(({ children: t, ...a }, r) => {
|
|
4
|
+
let o = u(!1), e = b(s);
|
|
5
|
+
r = c(r || (e == null ? void 0 : e.ref));
|
|
6
|
+
let n = d(e || {}, {
|
|
7
7
|
...a,
|
|
8
8
|
ref: r,
|
|
9
9
|
register() {
|
|
10
10
|
o.current = !0, e && e.register();
|
|
11
11
|
}
|
|
12
12
|
});
|
|
13
|
-
return i(e, r),
|
|
13
|
+
return i(e, r), l(() => {
|
|
14
14
|
o.current || (console.warn("A PressResponder was rendered without a pressable child. Either call the usePress hook, or wrap your DOM node with <Pressable> component."), o.current = !0);
|
|
15
|
-
}, []), /* @__PURE__ */
|
|
16
|
-
value:
|
|
15
|
+
}, []), /* @__PURE__ */ f.createElement(s.Provider, {
|
|
16
|
+
value: n
|
|
17
17
|
}, t);
|
|
18
18
|
});
|
|
19
19
|
function m({ children: t }) {
|
|
@@ -21,7 +21,7 @@ function m({ children: t }) {
|
|
|
21
21
|
register: () => {
|
|
22
22
|
}
|
|
23
23
|
}), []);
|
|
24
|
-
return /* @__PURE__ */
|
|
24
|
+
return /* @__PURE__ */ f.createElement(s.Provider, {
|
|
25
25
|
value: a
|
|
26
26
|
}, t);
|
|
27
27
|
}
|