@mortenbrudvik/waveui 0.9.0 → 0.11.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 +758 -152
- package/dist/components/button/Toolbar.cjs +1 -1
- package/dist/components/button/Toolbar.cjs.map +1 -1
- package/dist/components/button/Toolbar.mjs +25 -30
- package/dist/components/button/Toolbar.mjs.map +1 -1
- package/dist/components/button/Toolbar.navigation.cjs +2 -0
- package/dist/components/button/Toolbar.navigation.cjs.map +1 -0
- package/dist/components/button/Toolbar.navigation.mjs +17 -0
- package/dist/components/button/Toolbar.navigation.mjs.map +1 -0
- package/dist/components/data-display/Avatar.cjs +1 -1
- package/dist/components/data-display/Avatar.cjs.map +1 -1
- package/dist/components/data-display/Avatar.context.cjs +2 -0
- package/dist/components/data-display/Avatar.context.cjs.map +1 -0
- package/dist/components/data-display/Avatar.context.mjs +9 -0
- package/dist/components/data-display/Avatar.context.mjs.map +1 -0
- package/dist/components/data-display/Avatar.mjs +66 -61
- package/dist/components/data-display/Avatar.mjs.map +1 -1
- package/dist/components/data-display/InteractionTag.cjs +2 -0
- package/dist/components/data-display/InteractionTag.cjs.map +1 -0
- package/dist/components/data-display/InteractionTag.mjs +234 -0
- package/dist/components/data-display/InteractionTag.mjs.map +1 -0
- package/dist/components/data-display/Tag.cjs +1 -1
- package/dist/components/data-display/Tag.cjs.map +1 -1
- package/dist/components/data-display/Tag.mjs +222 -90
- package/dist/components/data-display/Tag.mjs.map +1 -1
- package/dist/components/data-display/TagGroup.cjs +2 -0
- package/dist/components/data-display/TagGroup.cjs.map +1 -0
- package/dist/components/data-display/TagGroup.context.cjs +2 -0
- package/dist/components/data-display/TagGroup.context.cjs.map +1 -0
- package/dist/components/data-display/TagGroup.context.mjs +113 -0
- package/dist/components/data-display/TagGroup.context.mjs.map +1 -0
- package/dist/components/data-display/TagGroup.mjs +149 -0
- package/dist/components/data-display/TagGroup.mjs.map +1 -0
- package/dist/components/data-display/tagStyles.cjs +2 -0
- package/dist/components/data-display/tagStyles.cjs.map +1 -0
- package/dist/components/data-display/tagStyles.mjs +108 -0
- package/dist/components/data-display/tagStyles.mjs.map +1 -0
- package/dist/components/feedback/Toaster.cjs +1 -1
- package/dist/components/feedback/Toaster.cjs.map +1 -1
- package/dist/components/feedback/Toaster.mjs +213 -181
- package/dist/components/feedback/Toaster.mjs.map +1 -1
- package/dist/components/input/Calendar.cjs +2 -0
- package/dist/components/input/Calendar.cjs.map +1 -0
- package/dist/components/input/Calendar.mjs +352 -0
- package/dist/components/input/Calendar.mjs.map +1 -0
- package/dist/components/input/Calendar.views.cjs +2 -0
- package/dist/components/input/Calendar.views.cjs.map +1 -0
- package/dist/components/input/Calendar.views.mjs +194 -0
- package/dist/components/input/Calendar.views.mjs.map +1 -0
- package/dist/components/input/ColorArea.cjs +1 -1
- package/dist/components/input/ColorArea.cjs.map +1 -1
- package/dist/components/input/ColorArea.mjs +18 -18
- package/dist/components/input/ColorArea.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.expand.cjs +1 -1
- package/dist/components/input/Combobox.expand.cjs.map +1 -1
- package/dist/components/input/Combobox.expand.mjs +7 -7
- package/dist/components/input/Combobox.expand.mjs.map +1 -1
- package/dist/components/input/Combobox.mjs +232 -156
- package/dist/components/input/Combobox.mjs.map +1 -1
- package/dist/components/input/Combobox.text.cjs +2 -0
- package/dist/components/input/Combobox.text.cjs.map +1 -0
- package/dist/components/input/Combobox.text.mjs +24 -0
- package/dist/components/input/Combobox.text.mjs.map +1 -0
- package/dist/components/input/DatePicker.cjs +1 -1
- package/dist/components/input/DatePicker.cjs.map +1 -1
- package/dist/components/input/DatePicker.mjs +203 -288
- package/dist/components/input/DatePicker.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 +135 -109
- package/dist/components/input/Dropdown.mjs.map +1 -1
- package/dist/components/input/Listbox.cjs +2 -0
- package/dist/components/input/Listbox.cjs.map +1 -0
- package/dist/components/input/Listbox.mjs +134 -0
- package/dist/components/input/Listbox.mjs.map +1 -0
- package/dist/components/input/Option.cjs +1 -1
- package/dist/components/input/Option.cjs.map +1 -1
- package/dist/components/input/Option.mjs +163 -97
- package/dist/components/input/Option.mjs.map +1 -1
- package/dist/components/input/SwatchPicker.cjs +1 -1
- package/dist/components/input/SwatchPicker.cjs.map +1 -1
- package/dist/components/input/SwatchPicker.context.cjs +2 -0
- package/dist/components/input/SwatchPicker.context.cjs.map +1 -0
- package/dist/components/input/SwatchPicker.context.mjs +35 -0
- package/dist/components/input/SwatchPicker.context.mjs.map +1 -0
- package/dist/components/input/SwatchPicker.mjs +131 -103
- package/dist/components/input/SwatchPicker.mjs.map +1 -1
- package/dist/components/input/SwatchPicker.swatches.cjs +2 -0
- package/dist/components/input/SwatchPicker.swatches.cjs.map +1 -0
- package/dist/components/input/SwatchPicker.swatches.mjs +207 -0
- package/dist/components/input/SwatchPicker.swatches.mjs.map +1 -0
- package/dist/components/input/TagPicker.cjs +1 -1
- package/dist/components/input/TagPicker.cjs.map +1 -1
- package/dist/components/input/TagPicker.context.cjs +2 -0
- package/dist/components/input/TagPicker.context.cjs.map +1 -0
- package/dist/components/input/TagPicker.context.mjs +20 -0
- package/dist/components/input/TagPicker.context.mjs.map +1 -0
- package/dist/components/input/TagPicker.create.cjs +2 -0
- package/dist/components/input/TagPicker.create.cjs.map +1 -0
- package/dist/components/input/TagPicker.create.mjs +24 -0
- package/dist/components/input/TagPicker.create.mjs.map +1 -0
- package/dist/components/input/TagPicker.mjs +13 -274
- package/dist/components/input/TagPicker.mjs.map +1 -1
- package/dist/components/input/TagPicker.option.cjs +2 -0
- package/dist/components/input/TagPicker.option.cjs.map +1 -0
- package/dist/components/input/TagPicker.option.mjs +45 -0
- package/dist/components/input/TagPicker.option.mjs.map +1 -0
- package/dist/components/input/TagPicker.overflow.cjs +2 -0
- package/dist/components/input/TagPicker.overflow.cjs.map +1 -0
- package/dist/components/input/TagPicker.overflow.mjs +153 -0
- package/dist/components/input/TagPicker.overflow.mjs.map +1 -0
- package/dist/components/input/TagPicker.parts.cjs +2 -0
- package/dist/components/input/TagPicker.parts.cjs.map +1 -0
- package/dist/components/input/TagPicker.parts.mjs +425 -0
- package/dist/components/input/TagPicker.parts.mjs.map +1 -0
- package/dist/components/input/TagPicker.root.cjs +2 -0
- package/dist/components/input/TagPicker.root.cjs.map +1 -0
- package/dist/components/input/TagPicker.root.mjs +416 -0
- package/dist/components/input/TagPicker.root.mjs.map +1 -0
- package/dist/components/input/TimePicker.cjs +1 -1
- package/dist/components/input/TimePicker.cjs.map +1 -1
- package/dist/components/input/TimePicker.mjs +77 -77
- package/dist/components/input/TimePicker.mjs.map +1 -1
- package/dist/components/input/dateUtils.cjs +1 -1
- package/dist/components/input/dateUtils.cjs.map +1 -1
- package/dist/components/input/dateUtils.mjs +114 -96
- package/dist/components/input/dateUtils.mjs.map +1 -1
- package/dist/components/input/pickerLabels.cjs +2 -0
- package/dist/components/input/pickerLabels.cjs.map +1 -0
- package/dist/components/input/pickerLabels.mjs +16 -0
- package/dist/components/input/pickerLabels.mjs.map +1 -0
- package/dist/components/input/pickerValues.cjs +2 -0
- package/dist/components/input/pickerValues.cjs.map +1 -0
- package/dist/components/input/pickerValues.mjs +24 -0
- package/dist/components/input/pickerValues.mjs.map +1 -0
- package/dist/components/layout/Accordion.cjs.map +1 -1
- package/dist/components/layout/Accordion.mjs.map +1 -1
- package/dist/components/navigation/Hamburger.cjs +2 -0
- package/dist/components/navigation/Hamburger.cjs.map +1 -0
- package/dist/components/navigation/Hamburger.mjs +54 -0
- package/dist/components/navigation/Hamburger.mjs.map +1 -0
- package/dist/components/navigation/Nav.cjs +1 -1
- package/dist/components/navigation/Nav.cjs.map +1 -1
- package/dist/components/navigation/Nav.context.cjs +2 -0
- package/dist/components/navigation/Nav.context.cjs.map +1 -0
- package/dist/components/navigation/Nav.context.mjs +137 -0
- package/dist/components/navigation/Nav.context.mjs.map +1 -0
- package/dist/components/navigation/Nav.mjs +151 -258
- package/dist/components/navigation/Nav.mjs.map +1 -1
- package/dist/components/navigation/Nav.parts.cjs +2 -0
- package/dist/components/navigation/Nav.parts.cjs.map +1 -0
- package/dist/components/navigation/Nav.parts.mjs +77 -0
- package/dist/components/navigation/Nav.parts.mjs.map +1 -0
- package/dist/components/navigation/Nav.root.cjs +2 -0
- package/dist/components/navigation/Nav.root.cjs.map +1 -0
- package/dist/components/navigation/Nav.root.mjs +78 -0
- package/dist/components/navigation/Nav.root.mjs.map +1 -0
- package/dist/components/navigation/NavDrawer.cjs +2 -0
- package/dist/components/navigation/NavDrawer.cjs.map +1 -0
- package/dist/components/navigation/NavDrawer.context.cjs +2 -0
- package/dist/components/navigation/NavDrawer.context.cjs.map +1 -0
- package/dist/components/navigation/NavDrawer.context.mjs +11 -0
- package/dist/components/navigation/NavDrawer.context.mjs.map +1 -0
- package/dist/components/navigation/NavDrawer.mjs +179 -0
- package/dist/components/navigation/NavDrawer.mjs.map +1 -0
- package/dist/components/overlays/Dialog.cjs +1 -1
- package/dist/components/overlays/Dialog.cjs.map +1 -1
- package/dist/components/overlays/Dialog.mjs +190 -125
- package/dist/components/overlays/Dialog.mjs.map +1 -1
- package/dist/components/overlays/Dialog.shared.cjs +1 -1
- package/dist/components/overlays/Dialog.shared.cjs.map +1 -1
- package/dist/components/overlays/Dialog.shared.mjs +157 -81
- package/dist/components/overlays/Dialog.shared.mjs.map +1 -1
- package/dist/components/overlays/Dialog.slots.cjs +2 -0
- package/dist/components/overlays/Dialog.slots.cjs.map +1 -0
- package/dist/components/overlays/Dialog.slots.mjs +129 -0
- package/dist/components/overlays/Dialog.slots.mjs.map +1 -0
- package/dist/components/overlays/Drawer.cjs +1 -1
- package/dist/components/overlays/Drawer.cjs.map +1 -1
- package/dist/components/overlays/Drawer.context.cjs +2 -0
- package/dist/components/overlays/Drawer.context.cjs.map +1 -0
- package/dist/components/overlays/Drawer.context.mjs +29 -0
- package/dist/components/overlays/Drawer.context.mjs.map +1 -0
- package/dist/components/overlays/Drawer.mjs +12 -187
- package/dist/components/overlays/Drawer.mjs.map +1 -1
- package/dist/components/overlays/Drawer.panel.cjs +2 -0
- package/dist/components/overlays/Drawer.panel.cjs.map +1 -0
- package/dist/components/overlays/Drawer.panel.mjs +159 -0
- package/dist/components/overlays/Drawer.panel.mjs.map +1 -0
- package/dist/components/overlays/Drawer.parts.cjs +2 -0
- package/dist/components/overlays/Drawer.parts.cjs.map +1 -0
- package/dist/components/overlays/Drawer.parts.mjs +152 -0
- package/dist/components/overlays/Drawer.parts.mjs.map +1 -0
- package/dist/components/overlays/Drawer.root.cjs +2 -0
- package/dist/components/overlays/Drawer.root.cjs.map +1 -0
- package/dist/components/overlays/Drawer.root.mjs +207 -0
- package/dist/components/overlays/Drawer.root.mjs.map +1 -0
- package/dist/components/overlays/Drawer.scroll.cjs +2 -0
- package/dist/components/overlays/Drawer.scroll.cjs.map +1 -0
- package/dist/components/overlays/Drawer.scroll.mjs +42 -0
- package/dist/components/overlays/Drawer.scroll.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 +67 -70
- package/dist/components/table/useGridNavigation.mjs.map +1 -1
- package/dist/hooks/useActiveDescendant.cjs +2 -0
- package/dist/hooks/useActiveDescendant.cjs.map +1 -0
- package/dist/hooks/useActiveDescendant.mjs +56 -0
- package/dist/hooks/useActiveDescendant.mjs.map +1 -0
- package/dist/hooks/useDismiss.cjs.map +1 -1
- package/dist/hooks/useDismiss.mjs.map +1 -1
- package/dist/hooks/useFocusTrap.cjs +1 -1
- package/dist/hooks/useFocusTrap.cjs.map +1 -1
- package/dist/hooks/useFocusTrap.mjs +115 -98
- package/dist/hooks/useFocusTrap.mjs.map +1 -1
- package/dist/hooks/useListbox.cjs +1 -1
- package/dist/hooks/useListbox.cjs.map +1 -1
- package/dist/hooks/useListbox.mjs +250 -210
- package/dist/hooks/useListbox.mjs.map +1 -1
- package/dist/hooks/useModalLayer.cjs +1 -1
- package/dist/hooks/useModalLayer.cjs.map +1 -1
- package/dist/hooks/useModalLayer.mjs +35 -22
- package/dist/hooks/useModalLayer.mjs.map +1 -1
- package/dist/hooks/useRestoreFocus.cjs +1 -1
- package/dist/hooks/useRestoreFocus.cjs.map +1 -1
- package/dist/hooks/useRestoreFocus.mjs +91 -78
- package/dist/hooks/useRestoreFocus.mjs.map +1 -1
- package/dist/hooks/useRovingGrid.cjs +2 -0
- package/dist/hooks/useRovingGrid.cjs.map +1 -0
- package/dist/hooks/useRovingGrid.mjs +69 -0
- package/dist/hooks/useRovingGrid.mjs.map +1 -0
- package/dist/hooks/useRovingTabIndex.cjs +1 -1
- package/dist/hooks/useRovingTabIndex.cjs.map +1 -1
- package/dist/hooks/useRovingTabIndex.mjs +102 -78
- package/dist/hooks/useRovingTabIndex.mjs.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +4391 -394
- package/dist/index.d.ts +4391 -394
- package/dist/index.mjs +115 -101
- package/dist/lib/classNames.cjs +1 -1
- package/dist/lib/classNames.cjs.map +1 -1
- package/dist/lib/classNames.mjs +170 -74
- package/dist/lib/classNames.mjs.map +1 -1
- package/dist/lib/date.cjs +2 -0
- package/dist/lib/date.cjs.map +1 -0
- package/dist/lib/date.mjs +44 -0
- package/dist/lib/date.mjs.map +1 -0
- package/dist/lib/focus.cjs +1 -1
- package/dist/lib/focus.cjs.map +1 -1
- package/dist/lib/focus.mjs +5 -2
- package/dist/lib/focus.mjs.map +1 -1
- package/dist/lib/icons.cjs +1 -1
- package/dist/lib/icons.cjs.map +1 -1
- package/dist/lib/icons.mjs +13 -6
- package/dist/lib/icons.mjs.map +1 -1
- package/dist/lib/layers.cjs +1 -1
- package/dist/lib/layers.cjs.map +1 -1
- package/dist/lib/layers.mjs +53 -47
- package/dist/lib/layers.mjs.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/src/styles/tokens.css +25 -0
|
@@ -57,22 +57,37 @@ function _(e, t, n) {
|
|
|
57
57
|
for (let r = e; r && r !== t; r = r.parentElement) if (g(r, n)) return !0;
|
|
58
58
|
return !1;
|
|
59
59
|
}
|
|
60
|
-
|
|
60
|
+
var v = "[tabindex], [data-roving-value]";
|
|
61
|
+
function y(e, t) {
|
|
62
|
+
try {
|
|
63
|
+
return e.matches(t);
|
|
64
|
+
} catch {
|
|
65
|
+
return !1;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
function b(e) {
|
|
69
|
+
let t = /* @__PURE__ */ new Map();
|
|
70
|
+
for (let n of e) n.type === "attributes" && n.attributeName === "tabindex" && t.set(n.target, n);
|
|
71
|
+
let n = /* @__PURE__ */ new Set();
|
|
72
|
+
for (let [e, r] of t) r.oldValue === e.getAttribute("tabindex") && n.add(e);
|
|
73
|
+
return n;
|
|
74
|
+
}
|
|
75
|
+
function x(e) {
|
|
61
76
|
return e.tabIndex >= 0 && !e.hasAttribute("disabled");
|
|
62
77
|
}
|
|
63
|
-
function
|
|
78
|
+
function S(e) {
|
|
64
79
|
let { element: t } = e;
|
|
65
|
-
if (!e.nested ||
|
|
80
|
+
if (!e.nested || x(t)) return t;
|
|
66
81
|
let n = t.querySelector("[tabindex=\"0\"]");
|
|
67
82
|
if (n) return n;
|
|
68
83
|
let r = o(t);
|
|
69
84
|
return r instanceof HTMLElement ? r : null;
|
|
70
85
|
}
|
|
71
|
-
function
|
|
86
|
+
function C(e) {
|
|
72
87
|
let t = e.getAttribute("data-roving-disabled");
|
|
73
|
-
return t !== null && t !== "false" ||
|
|
88
|
+
return t !== null && t !== "false" || w(e) ? !0 : !e.hasAttribute("data-disabled-focusable") && e.getAttribute("aria-disabled") === "true";
|
|
74
89
|
}
|
|
75
|
-
function
|
|
90
|
+
function w(e) {
|
|
76
91
|
if (e.disabled === !0) return !0;
|
|
77
92
|
try {
|
|
78
93
|
return e.matches(":disabled");
|
|
@@ -80,7 +95,7 @@ function x(e) {
|
|
|
80
95
|
return !1;
|
|
81
96
|
}
|
|
82
97
|
}
|
|
83
|
-
function
|
|
98
|
+
function T(e) {
|
|
84
99
|
if (!e || e.nodeType !== 1) return !1;
|
|
85
100
|
let t = e, n = t.getAttribute("role");
|
|
86
101
|
if (n !== null && p.has(n)) return !0;
|
|
@@ -90,10 +105,10 @@ function S(e) {
|
|
|
90
105
|
let i = t.closest("[contenteditable]");
|
|
91
106
|
return i !== null && i.getAttribute("contenteditable") !== "false";
|
|
92
107
|
}
|
|
93
|
-
function
|
|
94
|
-
return !e.nested && !
|
|
108
|
+
function E(e) {
|
|
109
|
+
return !e.nested && !T(e.element);
|
|
95
110
|
}
|
|
96
|
-
function
|
|
111
|
+
function D(e, t, n) {
|
|
97
112
|
let r = e.ownerDocument.defaultView;
|
|
98
113
|
if (!r) return !1;
|
|
99
114
|
for (let i = e; i && i !== t; i = i.parentElement) {
|
|
@@ -118,14 +133,14 @@ function te(e) {
|
|
|
118
133
|
return !1;
|
|
119
134
|
}
|
|
120
135
|
}
|
|
121
|
-
function
|
|
122
|
-
return [e.value, e.disabled ? 0 :
|
|
136
|
+
function O(e) {
|
|
137
|
+
return [e.value, e.disabled ? 0 : E(e) ? 1 : 2];
|
|
123
138
|
}
|
|
124
|
-
function
|
|
139
|
+
function k(e, t, n, r) {
|
|
125
140
|
let i = e.some(([, e]) => e === 1) ? 1 : 2, a = e.filter(([, e]) => e === i).map(([e]) => e);
|
|
126
141
|
return n === "last-focused" && r !== null && a.includes(r) ? r : t !== null && t !== "" && a.includes(t) ? t : a[0] ?? null;
|
|
127
142
|
}
|
|
128
|
-
function
|
|
143
|
+
function A(e, t) {
|
|
129
144
|
if (!t) return e;
|
|
130
145
|
let n = new Map(e.map((e) => [e.value, e])), r = [];
|
|
131
146
|
for (let e of t) {
|
|
@@ -134,7 +149,7 @@ function D(e, t) {
|
|
|
134
149
|
}
|
|
135
150
|
return r;
|
|
136
151
|
}
|
|
137
|
-
var
|
|
152
|
+
var j = class {
|
|
138
153
|
container = null;
|
|
139
154
|
lastFocused = null;
|
|
140
155
|
options = {
|
|
@@ -155,20 +170,22 @@ var O = class {
|
|
|
155
170
|
subscribe = (e) => (this.notify = e, this.observe(), () => {
|
|
156
171
|
this.notify = null, this.disconnect();
|
|
157
172
|
});
|
|
158
|
-
getSnapshot = () => this.container ? (this.dirty && (this.dirty = !1, this.snapshot = JSON.stringify(this.resolveOwn().map(
|
|
173
|
+
getSnapshot = () => this.container ? (this.dirty && (this.dirty = !1, this.snapshot = JSON.stringify(this.resolveOwn().map(O))), this.snapshot) : "";
|
|
159
174
|
getServerSnapshot = () => "";
|
|
160
175
|
setContainer(e) {
|
|
161
|
-
|
|
176
|
+
if (e === this.container) return;
|
|
177
|
+
let t = this.takeRecords();
|
|
178
|
+
this.disconnect(), this.container && this.options.manageTabIndex && this.release(this.container, "all", t), this.container = e, this.dirty = !0, this.notify && (this.observe(), this.notify());
|
|
162
179
|
}
|
|
163
180
|
recordFocus(e) {
|
|
164
|
-
|
|
181
|
+
E(e) && (this.lastFocused = e.value);
|
|
165
182
|
}
|
|
166
183
|
setOptions(e) {
|
|
167
184
|
let t = this.options;
|
|
168
|
-
this.options = e, (t.itemSelector !== e.itemSelector || t.manageTabIndex !== e.manageTabIndex || t.roleComposites !== e.roleComposites) && (this.dirty = !0, this.notify?.());
|
|
185
|
+
this.options = e, t.manageTabIndex && !e.manageTabIndex && this.container && this.release(this.container, "all", this.takeRecords()), (t.itemSelector !== e.itemSelector || t.manageTabIndex !== e.manageTabIndex || t.roleComposites !== e.roleComposites) && (this.dirty = !0, this.notify?.());
|
|
169
186
|
}
|
|
170
187
|
resolve(e = this.container) {
|
|
171
|
-
return
|
|
188
|
+
return A(this.resolveOwn(e), this.options.items);
|
|
172
189
|
}
|
|
173
190
|
resolveOwn(e = this.container) {
|
|
174
191
|
if (!e) return [];
|
|
@@ -192,39 +209,45 @@ var O = class {
|
|
|
192
209
|
value: this.valueOf(u, d),
|
|
193
210
|
element: u,
|
|
194
211
|
nested: d,
|
|
195
|
-
disabled:
|
|
212
|
+
disabled: C(u)
|
|
196
213
|
};
|
|
197
|
-
d && !f.disabled && !
|
|
214
|
+
d && !f.disabled && !S(f) && (f.disabled = !0), n && !f.disabled && D(u, e, c) && (f.disabled = !0), a.push(f);
|
|
198
215
|
}
|
|
199
216
|
return a;
|
|
200
217
|
}
|
|
201
218
|
stamp() {
|
|
202
219
|
if (!this.options.manageTabIndex || !this.container) return;
|
|
203
|
-
this.release(this.container);
|
|
204
|
-
let e = this.resolve(), t = this.options.tabStop === "none" ? null :
|
|
220
|
+
this.release(this.container, "stale");
|
|
221
|
+
let e = this.resolve(), t = this.options.tabStop === "none" ? null : k(e.map(O), this.options.activeValue, this.options.tabStop, this.lastFocused);
|
|
205
222
|
for (let n of e) {
|
|
206
223
|
if (n.nested) continue;
|
|
207
|
-
let { element: e } = n, r = this.stamped.get(e);
|
|
208
|
-
|
|
209
|
-
tabIndex:
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
e.getAttribute("tabindex") !== i && e.setAttribute("tabindex", i), e.hasAttribute("data-roving-value") || e.setAttribute("data-roving-value", n.value);
|
|
224
|
+
let { element: e } = n, r = n.value === t ? "0" : "-1", i = e.getAttribute("tabindex"), a = this.stamped.get(e);
|
|
225
|
+
a ? (i !== a.stamped && (a.tabIndex = i), a.stamped = r) : (a = {
|
|
226
|
+
tabIndex: i,
|
|
227
|
+
stamped: r,
|
|
228
|
+
addedValue: null
|
|
229
|
+
}, this.stamped.set(e, a)), i !== r && e.setAttribute("tabindex", r), e.hasAttribute("data-roving-value") || (e.setAttribute("data-roving-value", n.value), a.addedValue = n.value);
|
|
214
230
|
}
|
|
215
231
|
}
|
|
216
|
-
release(e) {
|
|
217
|
-
let
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
232
|
+
release(e, t, n = []) {
|
|
233
|
+
let r = b(n), { itemSelector: i, roleComposites: a } = this.options;
|
|
234
|
+
for (let n of Array.from(e.querySelectorAll(v))) {
|
|
235
|
+
let o = this.stamped.get(n);
|
|
236
|
+
if (!o || t === "stale" && y(n, i) && !_(n, e, a)) continue;
|
|
237
|
+
this.stamped.delete(n);
|
|
238
|
+
let s = n.getAttribute("tabindex");
|
|
239
|
+
!(s !== o.stamped || r.has(n)) && s !== o.tabIndex && (o.tabIndex === null ? n.removeAttribute("tabindex") : n.setAttribute("tabindex", o.tabIndex)), o.addedValue !== null && n.getAttribute("data-roving-value") === o.addedValue && n.removeAttribute("data-roving-value");
|
|
222
240
|
}
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
241
|
+
}
|
|
242
|
+
adopt(e) {
|
|
243
|
+
for (let t of b(e)) {
|
|
244
|
+
let e = this.stamped.get(t);
|
|
245
|
+
e && (e.tabIndex = t.getAttribute("tabindex"));
|
|
226
246
|
}
|
|
227
247
|
}
|
|
248
|
+
takeRecords() {
|
|
249
|
+
return this.observer?.takeRecords() ?? [];
|
|
250
|
+
}
|
|
228
251
|
valueOf(e, t) {
|
|
229
252
|
let n = t ? null : e.getAttribute("data-roving-value");
|
|
230
253
|
if (n !== null) return n;
|
|
@@ -232,12 +255,13 @@ var O = class {
|
|
|
232
255
|
return r === void 0 && (this.autoCounter += 1, r = `auto-${this.autoCounter}`, this.autoValues.set(e, r)), r;
|
|
233
256
|
}
|
|
234
257
|
observe() {
|
|
235
|
-
this.container && !this.observer && typeof MutationObserver < "u" && (this.observer = new MutationObserver(() => {
|
|
236
|
-
this.stamp(), this.dirty = !0, this.notify?.();
|
|
258
|
+
this.container && !this.observer && typeof MutationObserver < "u" && (this.observer = new MutationObserver((e) => {
|
|
259
|
+
this.adopt(e), this.stamp(), this.dirty = !0, this.notify?.();
|
|
237
260
|
}), this.observer.observe(this.container, {
|
|
238
261
|
subtree: !0,
|
|
239
262
|
childList: !0,
|
|
240
263
|
attributes: !0,
|
|
264
|
+
attributeOldValue: !0,
|
|
241
265
|
attributeFilter: h
|
|
242
266
|
}), this.dirty = !0);
|
|
243
267
|
}
|
|
@@ -245,7 +269,7 @@ var O = class {
|
|
|
245
269
|
this.observer?.disconnect(), this.observer = null;
|
|
246
270
|
}
|
|
247
271
|
};
|
|
248
|
-
function
|
|
272
|
+
function M(e) {
|
|
249
273
|
if (e === "") return null;
|
|
250
274
|
try {
|
|
251
275
|
return JSON.parse(e);
|
|
@@ -253,13 +277,13 @@ function k(e) {
|
|
|
253
277
|
return null;
|
|
254
278
|
}
|
|
255
279
|
}
|
|
256
|
-
function
|
|
280
|
+
function N(e) {
|
|
257
281
|
return e.getAttribute("data-roving-text") ?? e.textContent ?? "";
|
|
258
282
|
}
|
|
259
|
-
function
|
|
283
|
+
function P(e, t) {
|
|
260
284
|
return !t || typeof t.nodeType != "number" ? !1 : t === e || e.contains(t);
|
|
261
285
|
}
|
|
262
|
-
function
|
|
286
|
+
function F(e, t, n) {
|
|
263
287
|
if (e.length === 0 || !t || typeof t.nodeType != "number") return null;
|
|
264
288
|
let r = new Map(e.map((e) => [e.element, e]));
|
|
265
289
|
for (let e = t; e && e !== n; e = e.parentNode) {
|
|
@@ -268,24 +292,24 @@ function M(e, t, n) {
|
|
|
268
292
|
}
|
|
269
293
|
return null;
|
|
270
294
|
}
|
|
271
|
-
function
|
|
272
|
-
return e ? t ===
|
|
295
|
+
function I(e, t, n) {
|
|
296
|
+
return e ? t === S(e) : t === n;
|
|
273
297
|
}
|
|
274
|
-
function
|
|
275
|
-
let f = s === void 0 ? void 0 : o, { activeValue: p = null, items: m, orientation: h = "horizontal", loop: g = !0, dir: _, itemSelector: v = d, typeahead:
|
|
298
|
+
function L(o, s) {
|
|
299
|
+
let f = s === void 0 ? void 0 : o, { activeValue: p = null, items: m, orientation: h = "horizontal", loop: g = !0, dir: _, itemSelector: v = d, typeahead: y = !1, homeEndKeys: b = !0, tabStop: x = "active", manageTabIndex: C = !1, onFocusMove: w } = s ?? o, [D] = u.useState(() => new j()), O = u.useSyncExternalStore(D.subscribe, D.getSnapshot, D.getServerSnapshot), [A, L] = u.useState(null), [R, z] = u.useState(null), B = f === void 0 && m === void 0;
|
|
276
300
|
u.useLayoutEffect(() => {
|
|
277
|
-
|
|
301
|
+
D.setOptions({
|
|
278
302
|
itemSelector: v,
|
|
279
|
-
manageTabIndex:
|
|
303
|
+
manageTabIndex: C,
|
|
280
304
|
items: m,
|
|
281
305
|
activeValue: p,
|
|
282
|
-
tabStop:
|
|
306
|
+
tabStop: x,
|
|
283
307
|
roleComposites: B
|
|
284
|
-
}), f &&
|
|
308
|
+
}), f && D.setContainer(f.current), D.stamp();
|
|
285
309
|
}), u.useEffect(() => {
|
|
286
310
|
e && !te(v) && t(`useRovingTabIndex:itemSelector:${v}`, `useRovingTabIndex: itemSelector "${v}" is not a valid CSS selector in this browser; no item is navigable or tabbable.`);
|
|
287
311
|
}, [v]);
|
|
288
|
-
let V = u.useMemo(() =>
|
|
312
|
+
let V = u.useMemo(() => M(O), [O]), H = u.useMemo(() => {
|
|
289
313
|
if (!m) return V;
|
|
290
314
|
if (V) {
|
|
291
315
|
let e = new Map(V), t = m.flatMap((t) => {
|
|
@@ -295,27 +319,27 @@ function P(o, s) {
|
|
|
295
319
|
if (t.length > 0) return t;
|
|
296
320
|
}
|
|
297
321
|
return m.map((e) => [e, 1]);
|
|
298
|
-
}, [m, V]), U =
|
|
299
|
-
|
|
300
|
-
}, [
|
|
322
|
+
}, [m, V]), U = x === "none" ? null : H ? k(H, p, x, R) : p || null, W = u.useCallback((e) => e === U ? 0 : -1, [U]), G = u.useCallback((e) => {
|
|
323
|
+
D.setContainer(e), f && n(f, e);
|
|
324
|
+
}, [D, f]), K = u.useRef([]), q = u.useRef([]), { onTypeahead: ne, isSearching: re } = l({
|
|
301
325
|
getItems: () => K.current,
|
|
302
326
|
onMatch: (e, t) => {
|
|
303
327
|
q.current = t;
|
|
304
328
|
}
|
|
305
329
|
}), J = (e) => {
|
|
306
330
|
if (!e || e.disabled) return !1;
|
|
307
|
-
let t =
|
|
308
|
-
return !t || (t.focus(), !ee(t)) ? !1 : (
|
|
331
|
+
let t = S(e);
|
|
332
|
+
return !t || (t.focus(), !ee(t)) ? !1 : (D.recordFocus(e), !0);
|
|
309
333
|
}, Y = (e) => {
|
|
310
334
|
for (let t of e) if (J(t)) return;
|
|
311
335
|
}, X = r((e, t) => {
|
|
312
336
|
let n = e.metaKey || (e.altKey || e.ctrlKey) && !c(e);
|
|
313
|
-
if (e.defaultPrevented || n ||
|
|
314
|
-
let r =
|
|
315
|
-
if (!
|
|
316
|
-
let o =
|
|
337
|
+
if (e.defaultPrevented || n || T(e.target)) return;
|
|
338
|
+
let r = D.container ?? e.currentTarget;
|
|
339
|
+
if (!P(r, e.target)) return;
|
|
340
|
+
let o = D.resolve(r), s = o.filter((e) => !e.disabled);
|
|
317
341
|
if (s.length === 0) return;
|
|
318
|
-
let l =
|
|
342
|
+
let l = F(o, e.target, r), u = !1, d = [], f = t ? null : i(e.key, {
|
|
319
343
|
orientation: h,
|
|
320
344
|
dir: _ ?? a(e.currentTarget)
|
|
321
345
|
});
|
|
@@ -331,9 +355,9 @@ function P(o, s) {
|
|
|
331
355
|
o[n].disabled || d.push(o[n]);
|
|
332
356
|
}
|
|
333
357
|
}
|
|
334
|
-
} else !t &&
|
|
358
|
+
} else !t && b && (e.key === "Home" || e.key === "End") ? (u = !0, d = e.key === "Home" ? s : [...s].reverse()) : y && I(l, e.target, r) && (K.current = o.map((e) => ({
|
|
335
359
|
value: e.value,
|
|
336
|
-
text:
|
|
360
|
+
text: N(e.element),
|
|
337
361
|
disabled: e.disabled
|
|
338
362
|
})), q.current = [], ne(e, l?.value ?? null) && (u = !0, d = q.current.flatMap((e) => s.filter((t) => t.value === e))));
|
|
339
363
|
if (u) {
|
|
@@ -341,24 +365,24 @@ function P(o, s) {
|
|
|
341
365
|
for (let t of d) {
|
|
342
366
|
if (t === l) return;
|
|
343
367
|
if (J(t)) {
|
|
344
|
-
|
|
368
|
+
w?.(t.value, e);
|
|
345
369
|
return;
|
|
346
370
|
}
|
|
347
371
|
}
|
|
348
372
|
}
|
|
349
373
|
}), Z = r((e) => X(e, !1)), Q = r((e) => {
|
|
350
|
-
|
|
374
|
+
y && e.key === " " && re() && X(e, !0);
|
|
351
375
|
}), $ = r((e) => {
|
|
352
|
-
let t =
|
|
353
|
-
if (!
|
|
354
|
-
let n =
|
|
355
|
-
n && (
|
|
376
|
+
let t = D.container ?? e.currentTarget;
|
|
377
|
+
if (!P(t, e.target)) return;
|
|
378
|
+
let n = F(D.resolve(t), e.target, t);
|
|
379
|
+
n && (D.recordFocus(n), L(n.value), E(n) && z(n.value), D.stamp());
|
|
356
380
|
}), ie = r((e) => {
|
|
357
|
-
J(
|
|
381
|
+
J(D.resolve().find((t) => t.value === e));
|
|
358
382
|
}), ae = r(() => {
|
|
359
|
-
Y(
|
|
383
|
+
Y(D.resolve().filter((e) => !e.disabled));
|
|
360
384
|
}), oe = r(() => {
|
|
361
|
-
Y(
|
|
385
|
+
Y(D.resolve().filter((e) => !e.disabled).reverse());
|
|
362
386
|
});
|
|
363
387
|
return {
|
|
364
388
|
containerProps: u.useMemo(() => ({
|
|
@@ -377,13 +401,13 @@ function P(o, s) {
|
|
|
377
401
|
handleKeyDownCapture: Q,
|
|
378
402
|
handleFocus: $,
|
|
379
403
|
getTabIndex: W,
|
|
380
|
-
focusedValue:
|
|
404
|
+
focusedValue: A,
|
|
381
405
|
focusValue: ie,
|
|
382
406
|
focusFirst: ae,
|
|
383
407
|
focusLast: oe
|
|
384
408
|
};
|
|
385
409
|
}
|
|
386
410
|
//#endregion
|
|
387
|
-
export {
|
|
411
|
+
export { D as isHiddenByCss, L as useRovingTabIndex };
|
|
388
412
|
|
|
389
413
|
//# sourceMappingURL=useRovingTabIndex.mjs.map
|