@mortenbrudvik/waveui 0.15.0 → 0.16.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.
- package/README.md +274 -24
- package/dist/components/data-display/List.cjs +1 -1
- package/dist/components/data-display/List.cjs.map +1 -1
- package/dist/components/data-display/List.mjs +405 -219
- package/dist/components/data-display/List.mjs.map +1 -1
- package/dist/components/data-display/List.registry.cjs +1 -1
- package/dist/components/data-display/List.registry.cjs.map +1 -1
- package/dist/components/data-display/List.registry.mjs +12 -6
- package/dist/components/data-display/List.registry.mjs.map +1 -1
- package/dist/components/input/Combobox.cjs +1 -1
- package/dist/components/input/Combobox.cjs.map +1 -1
- package/dist/components/input/Combobox.mjs +163 -148
- package/dist/components/input/Combobox.mjs.map +1 -1
- package/dist/components/input/Dropdown.cjs +1 -1
- package/dist/components/input/Dropdown.cjs.map +1 -1
- package/dist/components/input/Dropdown.mjs +132 -117
- package/dist/components/input/Dropdown.mjs.map +1 -1
- package/dist/components/input/Listbox.cjs +1 -1
- package/dist/components/input/Listbox.cjs.map +1 -1
- package/dist/components/input/Listbox.mjs +90 -78
- package/dist/components/input/Listbox.mjs.map +1 -1
- package/dist/components/input/Option.cjs +1 -1
- package/dist/components/input/Option.cjs.map +1 -1
- package/dist/components/input/Option.data.cjs +2 -0
- package/dist/components/input/Option.data.cjs.map +1 -0
- package/dist/components/input/Option.data.mjs +114 -0
- package/dist/components/input/Option.data.mjs.map +1 -0
- package/dist/components/input/Option.mjs +21 -17
- package/dist/components/input/Option.mjs.map +1 -1
- package/dist/components/layout/FlatTree.cjs +2 -0
- package/dist/components/layout/FlatTree.cjs.map +1 -0
- package/dist/components/layout/FlatTree.context.cjs +2 -0
- package/dist/components/layout/FlatTree.context.cjs.map +1 -0
- package/dist/components/layout/FlatTree.context.mjs +20 -0
- package/dist/components/layout/FlatTree.context.mjs.map +1 -0
- package/dist/components/layout/FlatTree.item.cjs +2 -0
- package/dist/components/layout/FlatTree.item.cjs.map +1 -0
- package/dist/components/layout/FlatTree.item.mjs +90 -0
- package/dist/components/layout/FlatTree.item.mjs.map +1 -0
- package/dist/components/layout/FlatTree.mjs +276 -0
- package/dist/components/layout/FlatTree.mjs.map +1 -0
- package/dist/components/layout/Tree.core.cjs +1 -1
- package/dist/components/layout/Tree.core.cjs.map +1 -1
- package/dist/components/layout/Tree.core.mjs +166 -165
- package/dist/components/layout/Tree.core.mjs.map +1 -1
- package/dist/components/layout/Tree.selection.cjs +1 -1
- package/dist/components/layout/Tree.selection.cjs.map +1 -1
- package/dist/components/layout/Tree.selection.mjs +11 -57
- package/dist/components/layout/Tree.selection.mjs.map +1 -1
- package/dist/components/layout/useFlatTree.cjs +2 -0
- package/dist/components/layout/useFlatTree.cjs.map +1 -0
- package/dist/components/layout/useFlatTree.mjs +83 -0
- package/dist/components/layout/useFlatTree.mjs.map +1 -0
- package/dist/components/table/DataGrid.cjs +1 -1
- package/dist/components/table/DataGrid.cjs.map +1 -1
- package/dist/components/table/DataGrid.context.cjs +2 -0
- package/dist/components/table/DataGrid.context.cjs.map +1 -0
- package/dist/components/table/DataGrid.context.mjs +74 -0
- package/dist/components/table/DataGrid.context.mjs.map +1 -0
- package/dist/components/table/DataGrid.header.cjs +2 -0
- package/dist/components/table/DataGrid.header.cjs.map +1 -0
- package/dist/components/table/DataGrid.header.mjs +168 -0
- package/dist/components/table/DataGrid.header.mjs.map +1 -0
- package/dist/components/table/DataGrid.mjs +488 -591
- package/dist/components/table/DataGrid.mjs.map +1 -1
- package/dist/components/table/DataGrid.sizing.cjs +2 -0
- package/dist/components/table/DataGrid.sizing.cjs.map +1 -0
- package/dist/components/table/DataGrid.sizing.mjs +187 -0
- package/dist/components/table/DataGrid.sizing.mjs.map +1 -0
- package/dist/components/table/DataGrid.store.cjs +2 -0
- package/dist/components/table/DataGrid.store.cjs.map +1 -0
- package/dist/components/table/DataGrid.store.mjs +108 -0
- package/dist/components/table/DataGrid.store.mjs.map +1 -0
- package/dist/components/table/DataGrid.window.cjs +2 -0
- package/dist/components/table/DataGrid.window.cjs.map +1 -0
- package/dist/components/table/DataGrid.window.mjs +165 -0
- package/dist/components/table/DataGrid.window.mjs.map +1 -0
- package/dist/components/table/Table.cjs +1 -1
- package/dist/components/table/Table.cjs.map +1 -1
- package/dist/components/table/Table.mjs +74 -72
- package/dist/components/table/Table.mjs.map +1 -1
- package/dist/components/table/Table.resize.cjs +2 -0
- package/dist/components/table/Table.resize.cjs.map +1 -0
- package/dist/components/table/Table.resize.mjs +98 -0
- package/dist/components/table/Table.resize.mjs.map +1 -0
- package/dist/components/table/useGridNavigation.cjs +1 -1
- package/dist/components/table/useGridNavigation.cjs.map +1 -1
- package/dist/components/table/useGridNavigation.mjs +343 -140
- package/dist/components/table/useGridNavigation.mjs.map +1 -1
- package/dist/components/table/useTableColumnSizing.cjs +2 -0
- package/dist/components/table/useTableColumnSizing.cjs.map +1 -0
- package/dist/components/table/useTableColumnSizing.mjs +76 -0
- package/dist/components/table/useTableColumnSizing.mjs.map +1 -0
- package/dist/components/table/useTableFeatures.cjs +2 -0
- package/dist/components/table/useTableFeatures.cjs.map +1 -0
- package/dist/components/table/useTableFeatures.mjs +110 -0
- package/dist/components/table/useTableFeatures.mjs.map +1 -0
- package/dist/components/table/useTableSelection.cjs +2 -0
- package/dist/components/table/useTableSelection.cjs.map +1 -0
- package/dist/components/table/useTableSelection.mjs +39 -0
- package/dist/components/table/useTableSelection.mjs.map +1 -0
- package/dist/components/table/useTableSort.cjs +2 -0
- package/dist/components/table/useTableSort.cjs.map +1 -0
- package/dist/components/table/useTableSort.mjs +58 -0
- package/dist/components/table/useTableSort.mjs.map +1 -0
- package/dist/hooks/useActiveDescendant.cjs +1 -1
- package/dist/hooks/useActiveDescendant.cjs.map +1 -1
- package/dist/hooks/useActiveDescendant.mjs +33 -25
- package/dist/hooks/useActiveDescendant.mjs.map +1 -1
- package/dist/hooks/useListbox.cjs +1 -1
- package/dist/hooks/useListbox.cjs.map +1 -1
- package/dist/hooks/useListbox.mjs +140 -130
- package/dist/hooks/useListbox.mjs.map +1 -1
- package/dist/hooks/useRovingTabIndex.cjs +1 -1
- package/dist/hooks/useRovingTabIndex.cjs.map +1 -1
- package/dist/hooks/useRovingTabIndex.mjs +1 -1
- package/dist/hooks/useRovingTabIndex.mjs.map +1 -1
- package/dist/hooks/useSelection.cjs +2 -0
- package/dist/hooks/useSelection.cjs.map +1 -0
- package/dist/hooks/useSelection.mjs +57 -0
- package/dist/hooks/useSelection.mjs.map +1 -0
- package/dist/hooks/useVirtualWindow.cjs +2 -0
- package/dist/hooks/useVirtualWindow.cjs.map +1 -0
- package/dist/hooks/useVirtualWindow.mjs +102 -0
- package/dist/hooks/useVirtualWindow.mjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1542 -53
- package/dist/index.d.ts +1542 -53
- package/dist/index.mjs +147 -136
- package/dist/lib/classNames.cjs +1 -1
- package/dist/lib/classNames.cjs.map +1 -1
- package/dist/lib/classNames.mjs +68 -49
- package/dist/lib/classNames.mjs.map +1 -1
- package/dist/lib/columnSizing.cjs +2 -0
- package/dist/lib/columnSizing.cjs.map +1 -0
- package/dist/lib/columnSizing.mjs +27 -0
- package/dist/lib/columnSizing.mjs.map +1 -0
- package/dist/lib/flatTree.cjs +2 -0
- package/dist/lib/flatTree.cjs.map +1 -0
- package/dist/lib/flatTree.mjs +118 -0
- package/dist/lib/flatTree.mjs.map +1 -0
- package/dist/lib/selection.cjs +2 -0
- package/dist/lib/selection.cjs.map +1 -0
- package/dist/lib/selection.mjs +28 -0
- package/dist/lib/selection.mjs.map +1 -0
- package/dist/lib/treeCascade.cjs +2 -0
- package/dist/lib/treeCascade.cjs.map +1 -0
- package/dist/lib/treeCascade.mjs +52 -0
- package/dist/lib/treeCascade.mjs.map +1 -0
- package/dist/lib/virtual.cjs +2 -0
- package/dist/lib/virtual.cjs.map +1 -0
- package/dist/lib/virtual.mjs +54 -0
- package/dist/lib/virtual.mjs.map +1 -0
- package/dist/styles.css +1 -1
- package/package.json +1 -1
|
@@ -7,24 +7,26 @@ import { composeEventHandlers as l } from "../../lib/composeEventHandlers.mjs";
|
|
|
7
7
|
import { listClassNames as ee, listItemClassNames as u } from "../../lib/classNames.mjs";
|
|
8
8
|
import { useEventCallback as d } from "../../hooks/useEventCallback.mjs";
|
|
9
9
|
import { useControllable as te } from "../../hooks/useControllable.mjs";
|
|
10
|
-
import { useId as
|
|
11
|
-
import { getArrowIntent as
|
|
10
|
+
import { useId as f } from "../../hooks/useId.mjs";
|
|
11
|
+
import { getArrowIntent as ne, getDirection as p } from "../../lib/direction.mjs";
|
|
12
12
|
import { FOCUSABLE_SELECTOR as m, isFocusable as h } from "../../lib/focus.mjs";
|
|
13
|
-
import {
|
|
14
|
-
import { useMergedRefs as
|
|
15
|
-
import { focusableDisabledProps as
|
|
16
|
-
import { focusRingInset as
|
|
17
|
-
import { CheckIcon as
|
|
18
|
-
import { INTERACTIVE_SELECTOR as
|
|
19
|
-
import { ListRegistry as
|
|
20
|
-
import * as
|
|
21
|
-
import { jsx as
|
|
13
|
+
import { ownsArrowKeys as re, useRovingTabIndex as ie } from "../../hooks/useRovingTabIndex.mjs";
|
|
14
|
+
import { useMergedRefs as ae } from "../../hooks/useMergedRefs.mjs";
|
|
15
|
+
import { focusableDisabledProps as oe } from "../../lib/aria.mjs";
|
|
16
|
+
import { focusRingInset as se, forcedColors as ce } from "../../lib/styles.mjs";
|
|
17
|
+
import { CheckIcon as le } from "../../lib/icons.mjs";
|
|
18
|
+
import { INTERACTIVE_SELECTOR as g, isForeignEvent as _ } from "../../lib/events.mjs";
|
|
19
|
+
import { ListRegistry as v } from "./List.registry.mjs";
|
|
20
|
+
import * as y from "react";
|
|
21
|
+
import { jsx as b, jsxs as ue } from "react/jsx-runtime";
|
|
22
22
|
//#region src/components/data-display/List.tsx
|
|
23
|
-
var
|
|
24
|
-
|
|
25
|
-
var
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
var x = y.createContext(null);
|
|
24
|
+
x.displayName = "ListContext";
|
|
25
|
+
var de = y.createContext(null);
|
|
26
|
+
de.displayName = "ListItemIndexContext";
|
|
27
|
+
var S = null;
|
|
28
|
+
function fe() {
|
|
29
|
+
return S ??= {
|
|
28
30
|
mode: "list",
|
|
29
31
|
navigable: !1,
|
|
30
32
|
selection: !1,
|
|
@@ -32,14 +34,15 @@ function E() {
|
|
|
32
34
|
selectedValues: /* @__PURE__ */ new Set(),
|
|
33
35
|
toggleItem: () => {},
|
|
34
36
|
getTabIndex: () => -1,
|
|
35
|
-
registry: new
|
|
36
|
-
|
|
37
|
+
registry: new v(),
|
|
38
|
+
listWindow: null
|
|
39
|
+
}, S;
|
|
37
40
|
}
|
|
38
|
-
function
|
|
39
|
-
return
|
|
41
|
+
function C(e) {
|
|
42
|
+
return y.useContext(x) || (r(e, "a List"), fe());
|
|
40
43
|
}
|
|
41
|
-
var
|
|
42
|
-
function
|
|
44
|
+
var pe = [];
|
|
45
|
+
function w(e, t, n) {
|
|
43
46
|
return n === "composite" || e && t ? {
|
|
44
47
|
mode: "grid",
|
|
45
48
|
navigation: "composite"
|
|
@@ -51,26 +54,26 @@ function k(e, t, n) {
|
|
|
51
54
|
navigation: n === "items" ? "items" : "none"
|
|
52
55
|
};
|
|
53
56
|
}
|
|
54
|
-
function
|
|
57
|
+
function T(e) {
|
|
55
58
|
a(`List:duplicate:${e}`, `List: several items share the value "${e}". Item values must be unique within a List; items with the same value are selected (and tab stops) together.`);
|
|
56
59
|
}
|
|
57
|
-
function
|
|
58
|
-
return t(e).some(({ node: e }) => n(e,
|
|
60
|
+
function me(e) {
|
|
61
|
+
return t(e).some(({ node: e }) => n(e, J) && c(e.props.action));
|
|
59
62
|
}
|
|
60
|
-
var
|
|
61
|
-
function
|
|
62
|
-
return
|
|
63
|
+
var E = { interactive: `${g}, [data-list-action]` };
|
|
64
|
+
function D(e) {
|
|
65
|
+
return _(e, E);
|
|
63
66
|
}
|
|
64
|
-
function
|
|
67
|
+
function O(e) {
|
|
65
68
|
return e.ctrlKey || e.altKey || e.metaKey ? !1 : e.key === "Enter" || e.key === " ";
|
|
66
69
|
}
|
|
67
|
-
var
|
|
70
|
+
var k = /* @__PURE__ */ new Set([
|
|
68
71
|
"textbox",
|
|
69
72
|
"searchbox",
|
|
70
73
|
"combobox",
|
|
71
74
|
"spinbutton",
|
|
72
75
|
"slider"
|
|
73
|
-
]),
|
|
76
|
+
]), A = /* @__PURE__ */ new Set([
|
|
74
77
|
"button",
|
|
75
78
|
"checkbox",
|
|
76
79
|
"color",
|
|
@@ -81,279 +84,462 @@ var P = /* @__PURE__ */ new Set([
|
|
|
81
84
|
"reset",
|
|
82
85
|
"submit"
|
|
83
86
|
]);
|
|
84
|
-
function
|
|
87
|
+
function j(e) {
|
|
85
88
|
let t = e.getAttribute("role");
|
|
86
|
-
if (t !== null &&
|
|
89
|
+
if (t !== null && k.has(t)) return !0;
|
|
87
90
|
let n = e.localName;
|
|
88
|
-
return n === "textarea" || n === "select" ? !0 : n === "input" ? !
|
|
91
|
+
return n === "textarea" || n === "select" ? !0 : n === "input" ? !A.has(e.type) : e.matches("[contenteditable]:not([contenteditable=\"false\"])");
|
|
89
92
|
}
|
|
90
|
-
function
|
|
93
|
+
function M(e) {
|
|
91
94
|
return Array.from(e.querySelectorAll(m)).filter((e) => h(e));
|
|
92
95
|
}
|
|
93
|
-
function
|
|
96
|
+
function N(e) {
|
|
94
97
|
if (!e.parentElement) return -1;
|
|
95
98
|
let t = 0;
|
|
96
99
|
for (let n = e.previousElementSibling; n; n = n.previousElementSibling) t++;
|
|
97
100
|
return t;
|
|
98
101
|
}
|
|
102
|
+
function P(e) {
|
|
103
|
+
return e.hasAttribute("tabindex") ? e : M(e)[0] ?? null;
|
|
104
|
+
}
|
|
105
|
+
function F(e, t, n) {
|
|
106
|
+
let r = null, i = null, a = null, o = 0;
|
|
107
|
+
for (let s = e.firstElementChild; s; s = s.nextElementSibling, o++) {
|
|
108
|
+
let e = n ? R(s) : o;
|
|
109
|
+
if (e !== null) {
|
|
110
|
+
if (t.value !== void 0 && s.getAttribute("data-roving-value") === t.value) {
|
|
111
|
+
r = s;
|
|
112
|
+
break;
|
|
113
|
+
}
|
|
114
|
+
e === t.index && (i = s), a = s;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
let s = r ?? i ?? (t.index >= 0 ? a : null);
|
|
118
|
+
return s ? P(s) : null;
|
|
119
|
+
}
|
|
120
|
+
function I(e) {
|
|
121
|
+
return e !== void 0 && Number.isFinite(e) ? Math.max(0, Math.floor(e)) : 0;
|
|
122
|
+
}
|
|
123
|
+
function L(...e) {
|
|
124
|
+
return e.filter((e) => e !== null);
|
|
125
|
+
}
|
|
126
|
+
function R(e) {
|
|
127
|
+
let t = e.getAttribute("data-index");
|
|
128
|
+
return t !== null && /^\d+$/.test(t) ? Number(t) : null;
|
|
129
|
+
}
|
|
99
130
|
function z(e, t) {
|
|
100
|
-
let n =
|
|
101
|
-
for (
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
131
|
+
let n = t instanceof Element ? t : null;
|
|
132
|
+
for (; n && n.parentElement !== e;) n = n.parentElement;
|
|
133
|
+
return n ? R(n) : null;
|
|
134
|
+
}
|
|
135
|
+
function B(e, t) {
|
|
136
|
+
for (let n = e.firstElementChild; n; n = n.nextElementSibling) if (R(n) === t) return n;
|
|
137
|
+
return null;
|
|
138
|
+
}
|
|
139
|
+
var V = 10;
|
|
140
|
+
function he(e, t, n) {
|
|
141
|
+
let r = n - 1, i = t === null ? null : Math.min(t, r);
|
|
142
|
+
switch (e) {
|
|
143
|
+
case "ArrowDown": return i === null || i === r ? 0 : i + 1;
|
|
144
|
+
case "ArrowUp": return i === null || i === 0 ? r : i - 1;
|
|
145
|
+
case "PageDown": return i === null ? 0 : Math.min(i + V, r);
|
|
146
|
+
case "PageUp": return i === null ? r : Math.max(i - V, 0);
|
|
147
|
+
case "Home": return 0;
|
|
148
|
+
case "End": return r;
|
|
149
|
+
default: return;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
var H = {
|
|
153
|
+
focused: null,
|
|
154
|
+
pending: null
|
|
155
|
+
}, U = class {
|
|
156
|
+
state = H;
|
|
157
|
+
listeners = /* @__PURE__ */ new Set();
|
|
158
|
+
subscribe = (e) => (this.listeners.add(e), () => {
|
|
159
|
+
this.listeners.delete(e);
|
|
160
|
+
});
|
|
161
|
+
getSnapshot = () => this.state;
|
|
162
|
+
getServerSnapshot = () => H;
|
|
163
|
+
update(e) {
|
|
164
|
+
let t = {
|
|
165
|
+
...this.state,
|
|
166
|
+
...e
|
|
167
|
+
};
|
|
168
|
+
if (t.focused !== this.state.focused || t.pending !== this.state.pending) {
|
|
169
|
+
this.state = t;
|
|
170
|
+
for (let e of this.listeners) e();
|
|
105
171
|
}
|
|
106
|
-
a === t.index && (r = o), i = o;
|
|
107
172
|
}
|
|
108
|
-
|
|
109
|
-
|
|
173
|
+
};
|
|
174
|
+
function W({ grid: e, size: t }) {
|
|
175
|
+
return /* @__PURE__ */ b(e ? "div" : "li", {
|
|
176
|
+
"aria-hidden": "true",
|
|
177
|
+
role: "presentation",
|
|
178
|
+
"data-virtual-spacer": "",
|
|
179
|
+
className: ee.spacer,
|
|
180
|
+
style: { height: t }
|
|
181
|
+
});
|
|
110
182
|
}
|
|
111
|
-
|
|
183
|
+
W.displayName = "ListSpacer";
|
|
184
|
+
function ge(e) {
|
|
112
185
|
for (let t = e.firstElementChild; t; t = t.nextElementSibling) if (t.hasAttribute("data-list-action")) return t;
|
|
113
186
|
return null;
|
|
114
187
|
}
|
|
115
|
-
function
|
|
188
|
+
function _e(e) {
|
|
116
189
|
let t = [];
|
|
117
|
-
for (let n of
|
|
118
|
-
let r =
|
|
190
|
+
for (let n of M(e)) {
|
|
191
|
+
let r = j(n) ? e : n;
|
|
119
192
|
t.includes(r) || t.push(r);
|
|
120
193
|
}
|
|
121
194
|
return t;
|
|
122
195
|
}
|
|
123
|
-
var
|
|
124
|
-
let { selectable: n = !1, selectionMode: r, selectedItems: o, defaultSelectedItems: s, onSelectionChange: c, selectedItem: u, defaultSelectedItem:
|
|
196
|
+
var G = (t) => {
|
|
197
|
+
let { selectable: n = !1, selectionMode: r, selectedItems: o, defaultSelectedItems: s, onSelectionChange: c, selectedItem: u, defaultSelectedItem: f, onSelectedItemChange: ne, navigationMode: p, checkmark: m = !1, virtualWindow: h, count: oe, className: se, children: ce, ref: le, onKeyDown: g, onKeyDownCapture: _, onFocus: ue, onBlur: S, ...fe } = t, C = typeof ce == "function" ? ce : null, E = h !== void 0 && oe !== void 0 && C ? h : null, D = E !== null, O = !D && (h !== void 0 || oe !== void 0 || C !== null), k = D ? I(oe) : 0, A = E?.itemSize, j = y.useMemo(() => A === void 0 ? null : {
|
|
198
|
+
count: k,
|
|
199
|
+
itemSize: A
|
|
200
|
+
}, [k, A]);
|
|
125
201
|
r === "multi" && i("List", "selectionMode=\"multi\"", "selectionMode=\"multiple\"");
|
|
126
|
-
let
|
|
127
|
-
|
|
202
|
+
let N = r === "multiple" || r === "multi", R = y.useMemo(() => !N && u !== void 0 ? u === null ? pe : [u] : o, [
|
|
203
|
+
N,
|
|
128
204
|
u,
|
|
129
205
|
o
|
|
130
|
-
]),
|
|
131
|
-
|
|
132
|
-
|
|
206
|
+
]), V = y.useMemo(() => !N && f != null ? [f] : s ?? pe, [
|
|
207
|
+
N,
|
|
208
|
+
f,
|
|
133
209
|
s
|
|
134
|
-
]), [
|
|
210
|
+
]), [ge, _e] = te(R, V, (e) => {
|
|
135
211
|
let t = [...e];
|
|
136
|
-
c?.(t),
|
|
137
|
-
}), [
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
212
|
+
c?.(t), N || ne?.(t[0] ?? null);
|
|
213
|
+
}), [G] = y.useState(() => new v()), K = y.useSyncExternalStore(G.subscribe, G.getSnapshot, G.getServerSnapshot), q = y.useMemo(() => K && !D ? ge.filter((e) => K.valueSet.has(e)) : ge, [
|
|
214
|
+
K,
|
|
215
|
+
ge,
|
|
216
|
+
D
|
|
217
|
+
]), ve = y.useMemo(() => new Set(q), [q]), [J] = y.useState(() => new U()), { focused: Y, pending: ye } = y.useSyncExternalStore(J.subscribe, J.getSnapshot, J.getServerSnapshot), be = y.useMemo(() => L(Y, ye), [Y, ye]), X = E && C ? E.layout(k, { keep: be }).map((e) => e.kind === "item" ? {
|
|
218
|
+
...e,
|
|
219
|
+
node: C(e.index)
|
|
220
|
+
} : e) : null, xe = C ? null : ce, Se = n && p !== "composite" && (K ? K.hasActions : me(X ? X.map((e) => e.kind === "item" ? e.node : null) : xe)), Ce = Se && !D, we = Se && D, { mode: Z, navigation: Te } = w(n, Ce, p), Q = Te !== "none", Ee = n && m;
|
|
221
|
+
y.useLayoutEffect(() => {
|
|
222
|
+
G.setActive(Q);
|
|
223
|
+
}, [G, Q]);
|
|
224
|
+
let De = K ? K.values.find((e) => ve.has(e)) ?? null : q[0] ?? null, Oe = d((e, t) => {
|
|
225
|
+
let n = t.currentTarget, r = n.ownerDocument.activeElement, i = r ? z(n, r) : null;
|
|
226
|
+
i !== null && E?.scrollToIndex(i, { align: "auto" });
|
|
227
|
+
}), { containerProps: ke, getTabIndex: Ae } = ie({
|
|
228
|
+
activeValue: n ? De : null,
|
|
143
229
|
orientation: "vertical",
|
|
144
|
-
|
|
145
|
-
|
|
230
|
+
onFocusMove: D ? Oe : void 0,
|
|
231
|
+
typeahead: (D ? k : K?.count ?? 0) > 7,
|
|
232
|
+
tabStop: n && !(D && Y !== null) ? "active" : "last-focused",
|
|
146
233
|
itemSelector: ":scope > [data-roving-value]"
|
|
147
|
-
}), { ref:
|
|
148
|
-
|
|
149
|
-
let
|
|
234
|
+
}), { ref: je, onKeyDown: Me, onKeyDownCapture: Ne, onFocus: Pe } = ke, $ = y.useRef(null), Fe = ae(le, Q ? je : null, $, E?.scrollRef), Ie = y.useRef(!1), Le = d((e) => {
|
|
235
|
+
Q && Pe(e);
|
|
236
|
+
let t = e.currentTarget;
|
|
237
|
+
Ie.current = !t.contains(e.target);
|
|
238
|
+
let n = z(t, e.target);
|
|
239
|
+
n !== null && J.update({
|
|
240
|
+
focused: n,
|
|
241
|
+
pending: null
|
|
242
|
+
});
|
|
243
|
+
}), Re = D ? Le : Q ? Pe : void 0, ze = d((e) => {
|
|
244
|
+
let t = e.currentTarget, n = e.relatedTarget;
|
|
245
|
+
n && t.contains(n) || (Ie.current = !1, queueMicrotask(() => {
|
|
246
|
+
if (!t.isConnected || Ie.current) return;
|
|
247
|
+
let e = t.ownerDocument.activeElement;
|
|
248
|
+
e && t.contains(e) || J.update(H);
|
|
249
|
+
}));
|
|
250
|
+
}), Be = d((e) => {
|
|
251
|
+
if (!E || e.defaultPrevented || k === 0 || e.ctrlKey || e.altKey || e.metaKey) return;
|
|
252
|
+
let t = e.currentTarget;
|
|
253
|
+
if (!t.contains(e.target) || re(e.target)) return;
|
|
254
|
+
let n = z(t, e.target), r = he(e.key, J.getSnapshot().pending ?? n, k);
|
|
255
|
+
if (r === void 0) return;
|
|
256
|
+
if (e.preventDefault(), r === n) {
|
|
257
|
+
J.update({ pending: null }), E.scrollToIndex(r, { align: "auto" });
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
let i = B(t, r);
|
|
261
|
+
if (i) {
|
|
262
|
+
J.update({ pending: null }), i.scrollIntoView?.({ block: "nearest" }), P(i)?.focus();
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
let a = J.getSnapshot().pending;
|
|
266
|
+
J.update({ pending: r }), a !== r && E.scrollToIndex(r, { align: "auto" });
|
|
267
|
+
}), Ve = d((e) => {
|
|
268
|
+
D && Be(e), Me(e);
|
|
269
|
+
});
|
|
270
|
+
y.useLayoutEffect(() => {
|
|
271
|
+
let e = G.takeFocusLoss(), t = $.current;
|
|
150
272
|
if (!e || !t) return;
|
|
151
273
|
let n = t.ownerDocument, r = n.activeElement;
|
|
152
|
-
r && r !== n.body && r.isConnected ||
|
|
153
|
-
}, [
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
274
|
+
r && r !== n.body && r.isConnected || F(t, e, D)?.focus();
|
|
275
|
+
}, [
|
|
276
|
+
Z,
|
|
277
|
+
G,
|
|
278
|
+
D
|
|
279
|
+
]), y.useLayoutEffect(() => {
|
|
280
|
+
let e = $.current;
|
|
281
|
+
if (!D || !e) {
|
|
282
|
+
J.update(H);
|
|
283
|
+
return;
|
|
284
|
+
}
|
|
285
|
+
let t = e.ownerDocument, n = t.activeElement, r = !n || n === t.body || !n.isConnected || n === e, { pending: i } = J.getSnapshot();
|
|
286
|
+
if (i !== null) {
|
|
287
|
+
J.update({ pending: null });
|
|
288
|
+
let t = i < k ? B(e, i) : null;
|
|
289
|
+
t && (r || e.contains(n)) && P(t)?.focus();
|
|
290
|
+
}
|
|
291
|
+
let { focused: a } = J.getSnapshot();
|
|
292
|
+
if (!(a === null || a < k)) {
|
|
293
|
+
if (r && k > 0) {
|
|
294
|
+
let t = B(e, k - 1);
|
|
295
|
+
if (t) P(t)?.focus();
|
|
296
|
+
else {
|
|
297
|
+
J.update({
|
|
298
|
+
focused: null,
|
|
299
|
+
pending: k - 1
|
|
300
|
+
}), E?.scrollToIndex(k - 1, { align: "auto" });
|
|
301
|
+
return;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
J.getSnapshot().focused === a && J.update({ focused: null });
|
|
305
|
+
}
|
|
306
|
+
}), y.useLayoutEffect(() => {
|
|
307
|
+
if (Q) return;
|
|
308
|
+
let e = $.current, t = e?.ownerDocument.activeElement;
|
|
309
|
+
t && t.parentElement === e && !t.hasAttribute("tabindex") && M(t)[0]?.focus();
|
|
310
|
+
}, [Q]), y.useLayoutEffect(() => {
|
|
311
|
+
G.syncOrder($.current);
|
|
159
312
|
});
|
|
160
|
-
let
|
|
161
|
-
|
|
162
|
-
let n =
|
|
163
|
-
return
|
|
313
|
+
let He = y.useCallback((e) => {
|
|
314
|
+
_e((t) => {
|
|
315
|
+
let n = D ? t : G.prune(t), r = n.includes(e);
|
|
316
|
+
return N ? r ? n.filter((t) => t !== e) : [...n, e] : r ? [] : [e];
|
|
164
317
|
});
|
|
165
318
|
}, [
|
|
166
|
-
|
|
167
|
-
|
|
319
|
+
N,
|
|
320
|
+
G,
|
|
321
|
+
_e,
|
|
168
322
|
D
|
|
169
|
-
]),
|
|
170
|
-
|
|
171
|
-
for (let e of
|
|
172
|
-
}, [
|
|
173
|
-
let
|
|
174
|
-
|
|
175
|
-
n && !
|
|
323
|
+
]), Ue = K?.duplicates ?? pe;
|
|
324
|
+
y.useEffect(() => {
|
|
325
|
+
for (let e of Ue) T(e);
|
|
326
|
+
}, [Ue]);
|
|
327
|
+
let We = q.length;
|
|
328
|
+
y.useEffect(() => {
|
|
329
|
+
n && !N && We > 1 && a("List:single-several-selected", `List: a single-selection list (selectionMode "single") received ${We} selected items. Pass one value with \`selectedItem\`, or use selectionMode="multiple".`);
|
|
176
330
|
}, [
|
|
177
331
|
n,
|
|
178
|
-
|
|
179
|
-
|
|
332
|
+
N,
|
|
333
|
+
We
|
|
180
334
|
]);
|
|
181
|
-
let
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
}, [
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
335
|
+
let Ge = n && p === "items" && Ce, Ke = n && p === "none";
|
|
336
|
+
y.useEffect(() => {
|
|
337
|
+
Ge && a("List:items-with-actions", "List: a selectable list whose items have actions is a grid (an option cannot hold interactive content), so navigationMode=\"items\" acts as \"composite\". Set navigationMode=\"composite\"."), Ke && a("List:none-selectable", "List: navigationMode=\"none\" has no effect on a selectable list, whose items are always reached with the arrow keys. Remove it, or use \"items\" or \"composite\".");
|
|
338
|
+
}, [Ge, Ke]), y.useEffect(() => {
|
|
339
|
+
O && a("List:virtual-window-children", "List: a windowed list needs `virtualWindow`, `count` and a function child that returns the `List.Item` at an index; without one of them the window is ignored (a function child then renders nothing, and element children are all rendered).");
|
|
340
|
+
}, [O]), y.useEffect(() => {
|
|
341
|
+
we && a("List:virtual-window-actions", "List: a selectable windowed list keeps its listbox structure whatever items are rendered, so an item action sits inside an option, which cannot hold interactive content. Set navigationMode=\"composite\" to render a grid whose rows hold the actions.");
|
|
342
|
+
}, [we]);
|
|
343
|
+
let qe = y.useMemo(() => ({
|
|
344
|
+
mode: Z,
|
|
345
|
+
navigable: Q,
|
|
188
346
|
selection: n,
|
|
189
|
-
checkmark:
|
|
190
|
-
selectedValues:
|
|
191
|
-
toggleItem:
|
|
192
|
-
getTabIndex:
|
|
193
|
-
registry:
|
|
347
|
+
checkmark: Ee,
|
|
348
|
+
selectedValues: ve,
|
|
349
|
+
toggleItem: He,
|
|
350
|
+
getTabIndex: Ae,
|
|
351
|
+
registry: G,
|
|
352
|
+
listWindow: j
|
|
194
353
|
}), [
|
|
195
|
-
|
|
196
|
-
|
|
354
|
+
Z,
|
|
355
|
+
Q,
|
|
197
356
|
n,
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
357
|
+
Ee,
|
|
358
|
+
ve,
|
|
359
|
+
He,
|
|
360
|
+
Ae,
|
|
361
|
+
G,
|
|
202
362
|
j
|
|
203
|
-
]),
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
"
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
363
|
+
]), Je = Z === "grid" ? "div" : "ul", Ye = Z === "grid" ? "grid" : Z === "listbox" ? "listbox" : "list", Xe = X ? X.map((e) => e.kind === "item" ? /* @__PURE__ */ b(de.Provider, {
|
|
364
|
+
value: e.index,
|
|
365
|
+
children: e.node
|
|
366
|
+
}, e.index) : /* @__PURE__ */ b(W, {
|
|
367
|
+
grid: Z === "grid",
|
|
368
|
+
size: e.size
|
|
369
|
+
}, e.key)) : xe;
|
|
370
|
+
return /* @__PURE__ */ b(x.Provider, {
|
|
371
|
+
value: qe,
|
|
372
|
+
children: /* @__PURE__ */ b(Je, {
|
|
373
|
+
role: Ye,
|
|
374
|
+
"aria-multiselectable": n && N ? !0 : void 0,
|
|
375
|
+
"aria-rowcount": D && Z === "grid" ? k : void 0,
|
|
376
|
+
"data-navigation-mode": Te,
|
|
377
|
+
"data-checkmark": Ee ? "" : void 0,
|
|
378
|
+
tabIndex: D && Q ? -1 : void 0,
|
|
379
|
+
className: e(ee.root, "m-0 list-none p-0", D && "overflow-y-auto [overflow-anchor:none]", se),
|
|
380
|
+
...fe,
|
|
381
|
+
ref: Fe,
|
|
382
|
+
"data-roving-container": Q ? "" : void 0,
|
|
383
|
+
onKeyDown: Q ? l(g, Ve) : g,
|
|
384
|
+
onKeyDownCapture: Q ? l(_, Ne) : _,
|
|
385
|
+
onFocus: Re ? l(ue, Re, { checkDefaultPrevented: !1 }) : ue,
|
|
386
|
+
onBlur: D ? l(S, ze, { checkDefaultPrevented: !1 }) : S,
|
|
387
|
+
children: Xe
|
|
219
388
|
})
|
|
220
389
|
});
|
|
221
390
|
};
|
|
222
|
-
|
|
223
|
-
var
|
|
224
|
-
function
|
|
225
|
-
let i = e(u.checkmark, "order-first me-2 inline-flex shrink-0 items-center justify-center", r ? ["text-muted-foreground",
|
|
226
|
-
return t === void 0 ? /* @__PURE__ */
|
|
391
|
+
G.displayName = "List";
|
|
392
|
+
var K = "forced-colors:text-[Highlight] forced-colors:forced-color-adjust-none", q = "forced-colors:text-[GrayText] forced-colors:forced-color-adjust-none";
|
|
393
|
+
function ve(t, { selected: n, disabled: r }) {
|
|
394
|
+
let i = e(u.checkmark, "order-first me-2 inline-flex shrink-0 items-center justify-center", r ? ["text-muted-foreground", q] : ["text-primary", K], !n && "invisible");
|
|
395
|
+
return t === void 0 ? /* @__PURE__ */ b("span", {
|
|
227
396
|
"aria-hidden": "true",
|
|
228
397
|
className: i,
|
|
229
|
-
children: /* @__PURE__ */
|
|
398
|
+
children: /* @__PURE__ */ b(le, {})
|
|
230
399
|
}) : s(t, "span", i, { "aria-hidden": !0 });
|
|
231
400
|
}
|
|
232
|
-
var
|
|
233
|
-
let { mode:
|
|
234
|
-
|
|
235
|
-
|
|
401
|
+
var J = ({ value: t, action: n, onAction: r, disabledSelection: i = !1, checkmark: s, className: ee, style: te, children: m, onClick: h, onKeyDown: re, ref: ie, ...le }) => {
|
|
402
|
+
let { mode: g, navigable: _, selection: v, checkmark: x, selectedValues: S, toggleItem: fe, getTabIndex: pe, registry: w, listWindow: T } = C("ListItem"), me = y.useContext(de), E = T ? me : null, k = f("list-item"), A = t || void 0, P = A ?? k, F = c(n), [I] = y.useState(() => ({})), L = y.useRef(null), R = ae(ie, L);
|
|
403
|
+
y.useLayoutEffect(() => {
|
|
404
|
+
w.set(I, {
|
|
236
405
|
value: A,
|
|
237
|
-
hasAction:
|
|
238
|
-
element:
|
|
406
|
+
hasAction: F,
|
|
407
|
+
element: L,
|
|
408
|
+
index: E ?? void 0
|
|
239
409
|
});
|
|
240
410
|
}, [
|
|
241
|
-
|
|
242
|
-
|
|
411
|
+
w,
|
|
412
|
+
I,
|
|
243
413
|
A,
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
414
|
+
F,
|
|
415
|
+
E
|
|
416
|
+
]), y.useLayoutEffect(() => () => w.delete(I), [w, I]);
|
|
417
|
+
let z = d((e) => {
|
|
247
418
|
let t = e.parentElement;
|
|
248
|
-
|
|
419
|
+
w.recordFocusLoss({
|
|
249
420
|
value: A,
|
|
250
|
-
index: t ?
|
|
421
|
+
index: E ?? (t ? N(t) : -1)
|
|
251
422
|
});
|
|
252
423
|
});
|
|
253
|
-
|
|
254
|
-
let e =
|
|
424
|
+
y.useLayoutEffect(() => {
|
|
425
|
+
let e = L.current;
|
|
255
426
|
return () => {
|
|
256
427
|
if (!e) return;
|
|
257
428
|
let t = e.ownerDocument.activeElement;
|
|
258
|
-
t && e.contains(t) &&
|
|
429
|
+
t && e.contains(t) && w.recordFocusLoss({
|
|
259
430
|
value: A,
|
|
260
|
-
index:
|
|
431
|
+
index: E ?? N(e)
|
|
261
432
|
});
|
|
262
433
|
};
|
|
263
|
-
}, [
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
let
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
},
|
|
275
|
-
|
|
276
|
-
|
|
434
|
+
}, [
|
|
435
|
+
w,
|
|
436
|
+
A,
|
|
437
|
+
E
|
|
438
|
+
]);
|
|
439
|
+
let B = r !== void 0 && !_;
|
|
440
|
+
y.useEffect(() => {
|
|
441
|
+
B && a("List.Item:action-not-navigable", "List.Item: `onAction` runs only on clicks here: the List does not navigate its items, so keyboard users cannot reach them. Set navigationMode=\"items\" (or \"composite\") on the List, or make it selectable.");
|
|
442
|
+
}, [B]);
|
|
443
|
+
let V = v && A !== void 0 && S.has(A), he = v && A !== void 0, H = v && i, U = H && r === void 0, W = () => {
|
|
444
|
+
v && !i && A !== void 0 && fe(A);
|
|
445
|
+
}, G = (e) => {
|
|
446
|
+
r?.(e), e.isDefaultPrevented() || W();
|
|
447
|
+
}, K = (e) => {
|
|
448
|
+
D(e) || G(e);
|
|
449
|
+
}, q = (e) => {
|
|
450
|
+
if (e.key === " " && he) {
|
|
451
|
+
e.preventDefault(), W();
|
|
277
452
|
return;
|
|
278
453
|
}
|
|
279
|
-
(
|
|
280
|
-
},
|
|
281
|
-
|
|
282
|
-
},
|
|
283
|
-
let t = e.currentTarget, n = e.target, r =
|
|
454
|
+
(v || r !== void 0) && (G(e), e.preventDefault());
|
|
455
|
+
}, J = (e) => {
|
|
456
|
+
D(e) || O(e) && q(e);
|
|
457
|
+
}, Y = (e) => {
|
|
458
|
+
let t = e.currentTarget, n = e.target, r = ge(t);
|
|
284
459
|
if (!r || !r.contains(n)) {
|
|
285
460
|
if (n !== t) return;
|
|
286
|
-
if (
|
|
287
|
-
|
|
461
|
+
if (O(e)) {
|
|
462
|
+
q(e);
|
|
288
463
|
return;
|
|
289
464
|
}
|
|
290
|
-
let i =
|
|
465
|
+
let i = ne(e.key, {
|
|
291
466
|
orientation: "horizontal",
|
|
292
467
|
dir: p(t)
|
|
293
|
-
}) === "next" && r ?
|
|
468
|
+
}) === "next" && r ? _e(r)[0] : void 0;
|
|
294
469
|
i && (e.preventDefault(), i.focus());
|
|
295
470
|
return;
|
|
296
471
|
}
|
|
297
|
-
if (n !== r &&
|
|
472
|
+
if (n !== r && j(n)) {
|
|
298
473
|
e.key === "Escape" && (e.preventDefault(), r.focus());
|
|
299
474
|
return;
|
|
300
475
|
}
|
|
301
476
|
if (n === r && (e.key === "Enter" || e.key === "F2")) {
|
|
302
|
-
let t =
|
|
477
|
+
let t = M(r).find((e) => j(e));
|
|
303
478
|
t && (e.preventDefault(), t.focus());
|
|
304
479
|
return;
|
|
305
480
|
}
|
|
306
|
-
let i =
|
|
481
|
+
let i = ne(e.key, {
|
|
307
482
|
orientation: "horizontal",
|
|
308
483
|
dir: p(t)
|
|
309
484
|
});
|
|
310
485
|
if (!i) return;
|
|
311
486
|
e.preventDefault();
|
|
312
|
-
let a =
|
|
487
|
+
let a = _e(r), o = a.indexOf(n);
|
|
313
488
|
i === "next" ? a[o + 1]?.focus() : o > 0 ? a[o - 1].focus() : t.focus();
|
|
314
|
-
},
|
|
315
|
-
"aria-selected":
|
|
316
|
-
tabIndex:
|
|
317
|
-
"data-roving-value":
|
|
318
|
-
"data-selected":
|
|
319
|
-
...
|
|
320
|
-
onClick: l(
|
|
321
|
-
onKeyDown: l(
|
|
489
|
+
}, ye = g === "grid" ? "div" : "li", be = g === "grid" ? "div" : "span", xe = g === "grid" ? "row" : g === "listbox" ? "option" : "listitem", Se = _ ? {
|
|
490
|
+
"aria-selected": v ? V : void 0,
|
|
491
|
+
tabIndex: pe(P),
|
|
492
|
+
"data-roving-value": P,
|
|
493
|
+
"data-selected": V ? "" : void 0,
|
|
494
|
+
...oe(U, { reachable: !0 }),
|
|
495
|
+
onClick: l(h, K),
|
|
496
|
+
onKeyDown: l(re, g === "grid" ? Y : J)
|
|
322
497
|
} : {
|
|
323
|
-
onClick: r ? l(
|
|
324
|
-
onKeyDown:
|
|
325
|
-
},
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
498
|
+
onClick: r ? l(h, K) : h,
|
|
499
|
+
onKeyDown: re
|
|
500
|
+
}, Ce = v ? U ? "cursor-default" : "cursor-pointer" : r && "cursor-pointer", we = v ? !U : r !== void 0, Z = s != null && c(s), Te = v && (s == null ? x : Z), Q = T && E !== null ? {
|
|
501
|
+
"data-index": E,
|
|
502
|
+
...g === "grid" ? { "aria-rowindex": E + 1 } : {
|
|
503
|
+
"aria-setsize": T.count,
|
|
504
|
+
"aria-posinset": E + 1
|
|
505
|
+
}
|
|
506
|
+
} : {};
|
|
507
|
+
return /* @__PURE__ */ ue(ye, {
|
|
508
|
+
role: xe,
|
|
509
|
+
"data-disabled-selection": H ? "" : void 0,
|
|
510
|
+
className: e(u.root, "flex items-center border-b border-border px-4 py-2 text-body-1", E !== null && "box-border", _ ? [
|
|
330
511
|
"relative",
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
] :
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
512
|
+
Ce,
|
|
513
|
+
se
|
|
514
|
+
] : Ce, V ? ["bg-subtle-selected before:absolute before:inset-y-2 before:start-0 before:w-0.5 before:rounded-full before:bg-primary", ce.selectedContainer] : we && "hover:bg-subtle-hover", ee),
|
|
515
|
+
style: T && E !== null ? {
|
|
516
|
+
...te,
|
|
517
|
+
height: T.itemSize
|
|
518
|
+
} : te,
|
|
519
|
+
...le,
|
|
520
|
+
ref: R,
|
|
521
|
+
...Se,
|
|
522
|
+
...Q,
|
|
337
523
|
children: [
|
|
338
|
-
/* @__PURE__ */
|
|
339
|
-
role:
|
|
524
|
+
/* @__PURE__ */ b(be, {
|
|
525
|
+
role: g === "grid" ? "gridcell" : void 0,
|
|
340
526
|
className: e(u.content, "min-w-0 flex-1"),
|
|
341
|
-
children:
|
|
527
|
+
children: m
|
|
342
528
|
}),
|
|
343
|
-
|
|
344
|
-
grid:
|
|
345
|
-
onRemovedWithFocus:
|
|
529
|
+
F && /* @__PURE__ */ b(X, {
|
|
530
|
+
grid: g === "grid",
|
|
531
|
+
onRemovedWithFocus: z,
|
|
346
532
|
children: o(n)
|
|
347
533
|
}),
|
|
348
|
-
|
|
349
|
-
selected:
|
|
350
|
-
disabled:
|
|
534
|
+
Te && ve(Z ? s : void 0, {
|
|
535
|
+
selected: V,
|
|
536
|
+
disabled: H
|
|
351
537
|
})
|
|
352
538
|
]
|
|
353
539
|
});
|
|
354
540
|
};
|
|
355
|
-
|
|
356
|
-
var
|
|
541
|
+
J.displayName = "ListItem";
|
|
542
|
+
var Y = ["[data-roving-container]", ...[
|
|
357
543
|
"toolbar",
|
|
358
544
|
"radiogroup",
|
|
359
545
|
"listbox",
|
|
@@ -363,19 +549,19 @@ var K = ["[data-roving-container]", ...[
|
|
|
363
549
|
"menu",
|
|
364
550
|
"menubar",
|
|
365
551
|
"tree"
|
|
366
|
-
].map((e) => `[role="${e}"]`)].join(", "),
|
|
552
|
+
].map((e) => `[role="${e}"]`)].join(", "), ye = [
|
|
367
553
|
"tabindex",
|
|
368
554
|
"href",
|
|
369
555
|
"contenteditable",
|
|
370
556
|
"controls"
|
|
371
557
|
];
|
|
372
|
-
function
|
|
558
|
+
function be(e) {
|
|
373
559
|
let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new WeakSet(), r = () => {
|
|
374
560
|
for (let n of t.keys()) e.contains(n) || t.delete(n);
|
|
375
561
|
for (let r of e.querySelectorAll(m)) {
|
|
376
562
|
let i = r.getAttribute("tabindex");
|
|
377
563
|
if (i === "-1" || n.has(r)) continue;
|
|
378
|
-
let a = r.closest(
|
|
564
|
+
let a = r.closest(Y);
|
|
379
565
|
a && e.contains(a) || (t.set(r, i), r.setAttribute("tabindex", "-1"));
|
|
380
566
|
}
|
|
381
567
|
};
|
|
@@ -396,26 +582,26 @@ function J(e) {
|
|
|
396
582
|
subtree: !0,
|
|
397
583
|
childList: !0,
|
|
398
584
|
attributes: !0,
|
|
399
|
-
attributeFilter:
|
|
585
|
+
attributeFilter: ye
|
|
400
586
|
}), () => {
|
|
401
587
|
i.disconnect();
|
|
402
588
|
for (let [e, n] of t) n === null ? e.removeAttribute("tabindex") : e.setAttribute("tabindex", n);
|
|
403
589
|
t.clear();
|
|
404
590
|
};
|
|
405
591
|
}
|
|
406
|
-
function
|
|
407
|
-
let i =
|
|
408
|
-
return
|
|
592
|
+
function X({ grid: t, onRemovedWithFocus: n, children: r }) {
|
|
593
|
+
let i = y.useRef(null);
|
|
594
|
+
return y.useLayoutEffect(() => {
|
|
409
595
|
let e = i.current;
|
|
410
596
|
return () => {
|
|
411
597
|
if (!e) return;
|
|
412
598
|
let t = e.ownerDocument.activeElement;
|
|
413
599
|
t && e.contains(t) && n(e);
|
|
414
600
|
};
|
|
415
|
-
}, [n, t]),
|
|
601
|
+
}, [n, t]), y.useLayoutEffect(() => {
|
|
416
602
|
let e = i.current;
|
|
417
|
-
return t && e ?
|
|
418
|
-
}, [t]), /* @__PURE__ */
|
|
603
|
+
return t && e ? be(e) : void 0;
|
|
604
|
+
}, [t]), /* @__PURE__ */ b(t ? "div" : "span", {
|
|
419
605
|
ref: i,
|
|
420
606
|
role: t ? "gridcell" : void 0,
|
|
421
607
|
tabIndex: t ? -1 : void 0,
|
|
@@ -424,9 +610,9 @@ function le({ grid: t, onRemovedWithFocus: n, children: r }) {
|
|
|
424
610
|
children: r
|
|
425
611
|
});
|
|
426
612
|
}
|
|
427
|
-
|
|
428
|
-
var
|
|
613
|
+
X.displayName = "ListActionCell";
|
|
614
|
+
var xe = /* @__PURE__ */ Object.assign(G, { Item: J });
|
|
429
615
|
//#endregion
|
|
430
|
-
export {
|
|
616
|
+
export { xe as List, J as ListItem };
|
|
431
617
|
|
|
432
618
|
//# sourceMappingURL=List.mjs.map
|