@slotted/react 0.1.0-beta.24 → 0.1.0-beta.25
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/dist/{action-bar-D-V2uWjA.js → action-bar-DckD0Sug.js} +1 -1
- package/dist/action-bar.js +1 -1
- package/dist/{cascader-DO1HiJT6.js → cascader-47GYpojH.js} +1 -1
- package/dist/cascader.js +1 -1
- package/dist/{checkbox-Hq1PXk04.js → checkbox-Dw9R1CGR.js} +3 -3
- package/dist/{checkbox-group-Ckoh-2GJ.js → checkbox-group-DDlz-UF4.js} +2 -2
- package/dist/checkbox-group.js +1 -1
- package/dist/checkbox.js +1 -1
- package/dist/{color-picker-BsDplfdK.js → color-picker-BbyW5ALf.js} +3 -3
- package/dist/color-picker.js +1 -1
- package/dist/{column-manager-Dm5ZLz6p.js → column-manager-Bz0bb4mq.js} +3 -3
- package/dist/column-manager.js +1 -1
- package/dist/{combobox-vE8dmv4K.js → combobox-BA2nvbnA.js} +1 -1
- package/dist/combobox.js +1 -1
- package/dist/{context-menu-BxbGq4bu.js → context-menu-CfEEqDKr.js} +1 -1
- package/dist/context-menu.js +1 -1
- package/dist/{currency-field-ZvfrfM0z.js → currency-field-CTzBMH8g.js} +1 -1
- package/dist/currency-field.js +1 -1
- package/dist/{dashboard-grid-Bx4J-aC7.js → dashboard-grid-WinSY-q3.js} +1 -1
- package/dist/dashboard-grid.js +1 -1
- package/dist/{data-grid-Dez5RojO.js → data-grid-Dh-oaGY7.js} +16 -16
- package/dist/data-grid.js +1 -1
- package/dist/{data-list-B18kLC9Q.js → data-list-iw9K_oiz.js} +2 -2
- package/dist/data-list.js +1 -1
- package/dist/{date-field-EBPrQL6A.js → date-field-B2WG_m4C.js} +1 -1
- package/dist/date-field.js +1 -1
- package/dist/{date-picker-B5V8NZCT.js → date-picker-B2wqU3Mw.js} +2 -2
- package/dist/date-picker.js +1 -1
- package/dist/{date-range-picker-B89Q973N.js → date-range-picker-BhQwOKkE.js} +2 -2
- package/dist/date-range-picker.js +1 -1
- package/dist/{datetime-field-DavJbR0H.js → datetime-field-CvKPkvaE.js} +1 -1
- package/dist/datetime-field.js +1 -1
- package/dist/{datetime-picker-Cx6Z52Ka.js → datetime-picker-C-PwlBW5.js} +2 -2
- package/dist/datetime-picker.js +1 -1
- package/dist/{datetime-range-picker-DYshAlgq.js → datetime-range-picker-0xs12Cf1.js} +2 -2
- package/dist/datetime-range-picker.js +1 -1
- package/dist/docs/field.json +16 -1
- package/dist/docs/field.md +3 -1
- package/dist/docs/form.json +14 -3
- package/dist/docs/form.md +3 -2
- package/dist/docs/guidelines/forms.md +89 -1
- package/dist/docs/guidelines/index.md +7 -0
- package/dist/docs/menu.json +2 -2
- package/dist/docs/menu.md +1 -1
- package/dist/{entity-picker-DB1HeuvJ.js → entity-picker-BFoKN50H.js} +2 -2
- package/dist/entity-picker.js +1 -1
- package/dist/{event-calendar-CEIyV-fW.js → event-calendar-BaPllnNk.js} +3 -3
- package/dist/event-calendar.js +1 -1
- package/dist/{field-CnSMUZw6.js → field-CSSHwGq_.js} +106 -105
- package/dist/{field-group-RACkEXPp.js → field-group-DeBTueJW.js} +1 -1
- package/dist/field-group.js +1 -1
- package/dist/field.js +1 -1
- package/dist/{filter-bar-CzuAJsSf.js → filter-bar-CPBr_n2c.js} +9 -9
- package/dist/filter-bar.js +1 -1
- package/dist/{form-DEcJ7tHf.js → form-Im9lGi45.js} +13 -3
- package/dist/form.js +2 -2
- package/dist/{import-export-center-tbHmRTGb.js → import-export-center-CzyIlQB_.js} +1 -1
- package/dist/import-export-center.js +1 -1
- package/dist/index.js +82 -82
- package/dist/{listbox-DvwUa0yH.js → listbox-B9cBuitS.js} +1 -1
- package/dist/listbox.js +1 -1
- package/dist/{markdown-Bw6L0Ifo.js → markdown-DX-mBYVT.js} +1 -1
- package/dist/markdown.js +1 -1
- package/dist/menu-parts-7F8syoFE.js +815 -0
- package/dist/menu.js +1 -1
- package/dist/{menubar-hazvXRYd.js → menubar-DzVGFn_I.js} +1 -1
- package/dist/menubar.js +1 -1
- package/dist/{multi-select-C1GNk4e0.js → multi-select-DnOAXeuF.js} +1 -1
- package/dist/multi-select.js +1 -1
- package/dist/{number-field-BPYe9kLB.js → number-field-C20-8yda.js} +1 -1
- package/dist/number-field.js +1 -1
- package/dist/{otp-input-CYtF30Q-.js → otp-input-YI-Emc5k.js} +1 -1
- package/dist/otp-input.js +1 -1
- package/dist/{prompt-composer-C57BzYrn.js → prompt-composer-DsnPcKa4.js} +1 -1
- package/dist/prompt-composer.js +1 -1
- package/dist/{radio-group-CLX8D2Ew.js → radio-group-DA8_LbEz.js} +2 -2
- package/dist/radio-group.js +1 -1
- package/dist/{rating-BB2k-Fay.js → rating-DSSqi85N.js} +1 -1
- package/dist/rating.js +1 -1
- package/dist/{saved-views-B54F_Bk4.js → saved-views-CsVRZTwK.js} +3 -3
- package/dist/saved-views.js +1 -1
- package/dist/{segmented-control-B1U-s58C.js → segmented-control-Dae5wU9X.js} +2 -2
- package/dist/segmented-control.js +1 -1
- package/dist/{select-OUGNxyS5.js → select-BTncjDuM.js} +38 -38
- package/dist/select.js +1 -1
- package/dist/{slider-Bp1QjJKu.js → slider-DNRphJot.js} +1 -1
- package/dist/slider.js +1 -1
- package/dist/{split-button-Dg67gBMP.js → split-button-DA1wcDJB.js} +1 -1
- package/dist/split-button.js +1 -1
- package/dist/styles/cascader.css +1 -1
- package/dist/styles/checkbox-group.css +1 -1
- package/dist/styles/checkbox.css +1 -1
- package/dist/styles/color-picker.css +1 -1
- package/dist/styles/column-manager.css +1 -1
- package/dist/styles/combobox.css +1 -1
- package/dist/styles/currency-field.css +1 -1
- package/dist/styles/data-grid.css +1 -1
- package/dist/styles/data-list.css +1 -1
- package/dist/styles/date-field.css +1 -1
- package/dist/styles/date-picker.css +1 -1
- package/dist/styles/date-range-picker.css +1 -1
- package/dist/styles/datetime-field.css +1 -1
- package/dist/styles/datetime-picker.css +1 -1
- package/dist/styles/datetime-range-picker.css +1 -1
- package/dist/styles/entity-picker.css +1 -1
- package/dist/styles/event-calendar.css +1 -1
- package/dist/styles/field-group.css +1 -1
- package/dist/styles/field.css +1 -1
- package/dist/styles/filter-bar.css +1 -1
- package/dist/styles/form.css +1 -1
- package/dist/styles/import-export-center.css +1 -1
- package/dist/styles/index.css +2 -2
- package/dist/styles/listbox.css +1 -1
- package/dist/styles/markdown.css +1 -1
- package/dist/styles/multi-select.css +1 -1
- package/dist/styles/number-field.css +1 -1
- package/dist/styles/otp-input.css +1 -1
- package/dist/styles/prompt-composer.css +1 -1
- package/dist/styles/radio-group.css +1 -1
- package/dist/styles/rating.css +1 -1
- package/dist/styles/saved-views.css +1 -1
- package/dist/styles/segmented-control.css +1 -1
- package/dist/styles/select.css +1 -1
- package/dist/styles/slider.css +1 -1
- package/dist/styles/switch.css +1 -1
- package/dist/styles/table.css +1 -1
- package/dist/styles/tags-input.css +1 -1
- package/dist/styles/text-field.css +1 -1
- package/dist/styles/textarea.css +1 -1
- package/dist/styles/time-field.css +1 -1
- package/dist/styles/time-picker.css +1 -1
- package/dist/styles/time-range-picker.css +1 -1
- package/dist/styles/toggle-group.css +1 -1
- package/dist/styles/transfer.css +1 -1
- package/dist/styles/upload.css +1 -1
- package/dist/styles/wizard.css +2 -2
- package/dist/styles.css +1 -1
- package/dist/{switch-DmLzDbTb.js → switch-gR_OvGG8.js} +1 -1
- package/dist/switch.js +1 -1
- package/dist/{table-Cz9YpgLT.js → table-Boy-0cjy.js} +12 -12
- package/dist/table.js +1 -1
- package/dist/{tags-input-CAmXKSeZ.js → tags-input-DEhtpizX.js} +1 -1
- package/dist/tags-input.js +1 -1
- package/dist/{text-field-CHYoral_.js → text-field-RGXN7zNu.js} +1 -1
- package/dist/text-field.js +1 -1
- package/dist/{textarea-47JGOZKv.js → textarea-AhpUmnMk.js} +1 -1
- package/dist/textarea.js +1 -1
- package/dist/{time-field-D1-rNBsB.js → time-field-xkxX8JF6.js} +1 -1
- package/dist/time-field.js +1 -1
- package/dist/{time-picker-mwCULYh7.js → time-picker-Da_UhP9X.js} +2 -2
- package/dist/time-picker.js +1 -1
- package/dist/{time-range-picker-BKgsEHmd.js → time-range-picker-CfVzD53N.js} +2 -2
- package/dist/time-range-picker.js +1 -1
- package/dist/{toggle-group-Bnig_MWl.js → toggle-group-DoxPLYJ3.js} +1 -1
- package/dist/toggle-group.js +1 -1
- package/dist/{toolbar-EdmEn_ph.js → toolbar-CtSZ88HI.js} +1 -1
- package/dist/toolbar.js +1 -1
- package/dist/{transfer-CEHIa2XD.js → transfer-BMRyopEw.js} +5 -5
- package/dist/transfer.js +1 -1
- package/dist/types/field/field.d.ts +1 -1
- package/dist/types/field/field.d.ts.map +1 -1
- package/dist/types/field/field.types.d.ts +10 -0
- package/dist/types/field/field.types.d.ts.map +1 -1
- package/dist/types/field/index.d.ts +1 -1
- package/dist/types/field/index.d.ts.map +1 -1
- package/dist/types/form/form-parts.d.ts +7 -1
- package/dist/types/form/form-parts.d.ts.map +1 -1
- package/dist/types/form/form.types.d.ts +3 -0
- package/dist/types/form/form.types.d.ts.map +1 -1
- package/dist/types/form/index.d.ts +2 -2
- package/dist/types/form/index.d.ts.map +1 -1
- package/dist/types/menu/menu-items.d.ts.map +1 -1
- package/dist/{upload-S3d3tUt-.js → upload-BqVBpYaZ.js} +1 -1
- package/dist/upload.js +1 -1
- package/dist/{wizard-gZyH8HIo.js → wizard-CpYwQGQ-.js} +1 -1
- package/dist/wizard.js +1 -1
- package/package.json +6 -6
- package/dist/menu-parts-BDdCTmko.js +0 -805
|
@@ -1,805 +0,0 @@
|
|
|
1
|
-
import { r as e } from "./i18n-D7xXDd8-.js";
|
|
2
|
-
import { n as t, t as n } from "./icon-D04-_QFA.js";
|
|
3
|
-
/* empty css */
|
|
4
|
-
import { a as r } from "./kbd-defaults-CDgRhiep.js";
|
|
5
|
-
import { keyedProps as i, selectorKeyProps as a, withSelectorKey as o } from "@slotted/core/selector-key";
|
|
6
|
-
import { createArrowNavigation as s, tabbables as c } from "@slotted/core/focus";
|
|
7
|
-
import { createControllable as l } from "@slotted/core/state";
|
|
8
|
-
import { createContext as u, useCallback as d, useContext as f, useEffect as p, useId as m, useImperativeHandle as h, useLayoutEffect as g, useRef as _, useState as v } from "react";
|
|
9
|
-
import { Fragment as y, jsx as b, jsxs as x } from "react/jsx-runtime";
|
|
10
|
-
import { createPresence as S } from "@slotted/core/presence";
|
|
11
|
-
import { keysMessages as C } from "@slotted/core/i18n";
|
|
12
|
-
import { createPortalRoot as w, setPortalContainer as T } from "@slotted/core/portal";
|
|
13
|
-
import { createDismissableLayer as E } from "@slotted/core/dismissable-layer";
|
|
14
|
-
import { createPointerIntent as D } from "@slotted/core/pointer-intent";
|
|
15
|
-
import { createPositioner as ee, submenuOffsets as O } from "@slotted/core/positioner";
|
|
16
|
-
import { createTypeahead as te, isPrintable as ne } from "@slotted/core/typeahead";
|
|
17
|
-
import { createPortal as k } from "react-dom";
|
|
18
|
-
import { canonicalKey as A, parseShortcut as j, resolveShortcut as re } from "@slotted/core/keys";
|
|
19
|
-
//#region src/menu/menu-defaults.tsx
|
|
20
|
-
var ie = {
|
|
21
|
-
align: "start",
|
|
22
|
-
alignOffset: 0,
|
|
23
|
-
closeOnEscape: !0,
|
|
24
|
-
closeOnOutsidePress: !0,
|
|
25
|
-
closeOnSelect: !0,
|
|
26
|
-
collisionPadding: 8,
|
|
27
|
-
disabled: !1,
|
|
28
|
-
flip: !0,
|
|
29
|
-
hideWhenDetached: !0,
|
|
30
|
-
loop: !0,
|
|
31
|
-
mount: "active",
|
|
32
|
-
openOnHover: !0,
|
|
33
|
-
portal: !0,
|
|
34
|
-
shift: !0,
|
|
35
|
-
side: "bottom",
|
|
36
|
-
sideOffset: 0,
|
|
37
|
-
size: "md",
|
|
38
|
-
strategy: "absolute",
|
|
39
|
-
submenuCloseDelay: 300,
|
|
40
|
-
submenuOpenDelay: 150,
|
|
41
|
-
typeahead: !0,
|
|
42
|
-
typeaheadTimeout: 500,
|
|
43
|
-
width: "content"
|
|
44
|
-
}, ae = u(ie);
|
|
45
|
-
function M() {
|
|
46
|
-
return f(ae);
|
|
47
|
-
}
|
|
48
|
-
function N({ children: e, container: t, ...n }) {
|
|
49
|
-
let r = M(), i = _(null);
|
|
50
|
-
p(() => {
|
|
51
|
-
if (t !== void 0) return i.current = t, T(t), () => T(null);
|
|
52
|
-
}, [t]);
|
|
53
|
-
let a = {
|
|
54
|
-
align: n.align ?? r.align,
|
|
55
|
-
alignOffset: n.alignOffset ?? r.alignOffset,
|
|
56
|
-
closeOnEscape: n.closeOnEscape ?? r.closeOnEscape,
|
|
57
|
-
closeOnOutsidePress: n.closeOnOutsidePress ?? r.closeOnOutsidePress,
|
|
58
|
-
closeOnSelect: n.closeOnSelect ?? r.closeOnSelect,
|
|
59
|
-
collisionPadding: n.collisionPadding ?? r.collisionPadding,
|
|
60
|
-
disabled: n.disabled ?? r.disabled,
|
|
61
|
-
flip: n.flip ?? r.flip,
|
|
62
|
-
hideWhenDetached: n.hideWhenDetached ?? r.hideWhenDetached,
|
|
63
|
-
loop: n.loop ?? r.loop,
|
|
64
|
-
mount: n.mount ?? r.mount,
|
|
65
|
-
openOnHover: n.openOnHover ?? r.openOnHover,
|
|
66
|
-
portal: n.portal ?? r.portal,
|
|
67
|
-
shift: n.shift ?? r.shift,
|
|
68
|
-
side: n.side ?? r.side,
|
|
69
|
-
sideOffset: n.sideOffset ?? r.sideOffset,
|
|
70
|
-
size: n.size ?? r.size,
|
|
71
|
-
strategy: n.strategy ?? r.strategy,
|
|
72
|
-
submenuCloseDelay: n.submenuCloseDelay ?? r.submenuCloseDelay,
|
|
73
|
-
submenuOpenDelay: n.submenuOpenDelay ?? r.submenuOpenDelay,
|
|
74
|
-
typeahead: n.typeahead ?? r.typeahead,
|
|
75
|
-
typeaheadTimeout: n.typeaheadTimeout ?? r.typeaheadTimeout,
|
|
76
|
-
width: n.width ?? r.width
|
|
77
|
-
};
|
|
78
|
-
return /* @__PURE__ */ b(ae.Provider, {
|
|
79
|
-
value: a,
|
|
80
|
-
children: e
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
//#endregion
|
|
84
|
-
//#region src/menu/menu.tsx
|
|
85
|
-
var P = u(void 0), F = u(null), I = u(null), L = F.Provider, R = I.Provider;
|
|
86
|
-
function z() {
|
|
87
|
-
return f(F);
|
|
88
|
-
}
|
|
89
|
-
function oe() {
|
|
90
|
-
return f(I);
|
|
91
|
-
}
|
|
92
|
-
function B() {
|
|
93
|
-
let e = f(P);
|
|
94
|
-
if (e === void 0) throw Error("MenuTrigger, MenuContent and every item have to be inside a Menu.");
|
|
95
|
-
return e;
|
|
96
|
-
}
|
|
97
|
-
function se(e, t) {
|
|
98
|
-
return e === void 0 ? null : typeof e == "string" ? t?.querySelector(e) ?? null : e instanceof Element ? e : e.current ?? null;
|
|
99
|
-
}
|
|
100
|
-
function ce({ align: e, alignOffset: t, anchor: n, children: r, closeOnEscape: i, closeOnOutsidePress: a, closeOnSelect: o, collisionPadding: s, defaultOpen: c, disabled: u, finalFocus: f, flip: p, hideWhenDetached: g, loop: y, mount: x, onOpenChange: S, open: C, openOnHover: w, portal: T, ref: E, shift: D, side: ee, sideOffset: O, size: te, strategy: ne, submenuCloseDelay: k, submenuOpenDelay: A, typeahead: j, typeaheadTimeout: re, value: ie, width: ae }) {
|
|
101
|
-
let N = M(), F = z(), I = oe(), L = F === null && I !== null, R = m(), B = ie ?? R, ce = `${R}menu`, V = `${R}trigger`, [H, le] = v(c ?? !1), [U, W] = v(null), [G, K] = v(null), q = u ?? N.disabled, J = (L ? I?.value === B : C ?? H) && !q, Y = _(J);
|
|
102
|
-
J && (Y.current = !0);
|
|
103
|
-
let ue = _("first"), X = _({
|
|
104
|
-
contentNode: G,
|
|
105
|
-
current: J,
|
|
106
|
-
finalFocus: f,
|
|
107
|
-
identity: B,
|
|
108
|
-
menubar: I,
|
|
109
|
-
onBar: L,
|
|
110
|
-
onOpenChange: S,
|
|
111
|
-
open: C,
|
|
112
|
-
parent: F,
|
|
113
|
-
triggerNode: U
|
|
114
|
-
});
|
|
115
|
-
X.current = {
|
|
116
|
-
contentNode: G,
|
|
117
|
-
current: J,
|
|
118
|
-
finalFocus: f,
|
|
119
|
-
identity: B,
|
|
120
|
-
menubar: I,
|
|
121
|
-
onBar: L,
|
|
122
|
-
onOpenChange: S,
|
|
123
|
-
open: C,
|
|
124
|
-
parent: F,
|
|
125
|
-
triggerNode: U
|
|
126
|
-
};
|
|
127
|
-
let Z = d((e, t, n) => {
|
|
128
|
-
let r = X.current;
|
|
129
|
-
if (e === r.current) return;
|
|
130
|
-
let i = !1, a = l({
|
|
131
|
-
controlled: r.onBar ? void 0 : r.open,
|
|
132
|
-
initial: r.current,
|
|
133
|
-
onRequest: (e) => {
|
|
134
|
-
i = e.cancelled, r.onOpenChange?.(e.value, e);
|
|
135
|
-
}
|
|
136
|
-
}).request(e, t, n);
|
|
137
|
-
i || (r.onBar && r.menubar !== null ? e ? r.menubar.open(r.identity, t, n) : r.menubar.close(t, n) : a && le(e), !e && t !== "outsidePress" && t !== "programmatic" && (se(r.finalFocus, r.contentNode) ?? r.triggerNode)?.focus({ preventScroll: !0 }));
|
|
138
|
-
}, []);
|
|
139
|
-
h(E, () => ({
|
|
140
|
-
close: () => Z(!1, "programmatic"),
|
|
141
|
-
open: () => Z(!0, "programmatic"),
|
|
142
|
-
focus: () => X.current.triggerNode?.focus({ preventScroll: !0 })
|
|
143
|
-
}), [Z]);
|
|
144
|
-
let Q = F === null ? L && I?.orientation === "vertical" ? "inline-end" : void 0 : "inline-end", de = {
|
|
145
|
-
align: e ?? (F === null ? N.align : "start"),
|
|
146
|
-
alignOffset: t ?? N.alignOffset,
|
|
147
|
-
anchor: n ?? null,
|
|
148
|
-
closeOnEscape: i ?? N.closeOnEscape,
|
|
149
|
-
closeOnOutsidePress: a ?? N.closeOnOutsidePress,
|
|
150
|
-
closeOnSelect: o ?? N.closeOnSelect,
|
|
151
|
-
collisionPadding: s ?? N.collisionPadding,
|
|
152
|
-
contentId: ce,
|
|
153
|
-
contentNode: G,
|
|
154
|
-
disabled: q || L && (I?.disabled ?? !1),
|
|
155
|
-
entry: ue,
|
|
156
|
-
flip: p ?? N.flip,
|
|
157
|
-
hideWhenDetached: g ?? N.hideWhenDetached,
|
|
158
|
-
identity: B,
|
|
159
|
-
loop: y ?? N.loop,
|
|
160
|
-
menubar: I,
|
|
161
|
-
mount: x ?? N.mount,
|
|
162
|
-
open: J,
|
|
163
|
-
openOnHover: w ?? N.openOnHover,
|
|
164
|
-
parent: F,
|
|
165
|
-
portal: T ?? N.portal,
|
|
166
|
-
seen: Y.current,
|
|
167
|
-
setContentNode: K,
|
|
168
|
-
setTriggerNode: W,
|
|
169
|
-
shift: D ?? N.shift,
|
|
170
|
-
side: ee ?? Q ?? N.side,
|
|
171
|
-
sideOffset: O ?? N.sideOffset,
|
|
172
|
-
onBar: L,
|
|
173
|
-
size: te ?? (L ? I?.size : void 0) ?? N.size,
|
|
174
|
-
strategy: ne ?? N.strategy,
|
|
175
|
-
submenuCloseDelay: k ?? N.submenuCloseDelay,
|
|
176
|
-
submenuOpenDelay: A ?? N.submenuOpenDelay,
|
|
177
|
-
toggle: Z,
|
|
178
|
-
triggerId: V,
|
|
179
|
-
triggerNode: U,
|
|
180
|
-
typeahead: j ?? N.typeahead,
|
|
181
|
-
typeaheadTimeout: re ?? N.typeaheadTimeout,
|
|
182
|
-
width: F === null ? ae ?? N.width : "content"
|
|
183
|
-
};
|
|
184
|
-
return /* @__PURE__ */ b(P.Provider, {
|
|
185
|
-
value: de,
|
|
186
|
-
children: r
|
|
187
|
-
});
|
|
188
|
-
}
|
|
189
|
-
//#endregion
|
|
190
|
-
//#region src/menu/menu-items.tsx
|
|
191
|
-
function V(e, t) {
|
|
192
|
-
return (n) => {
|
|
193
|
-
e?.(n), n.defaultPrevented || t(n);
|
|
194
|
-
};
|
|
195
|
-
}
|
|
196
|
-
var H = {
|
|
197
|
-
alt: "Alt",
|
|
198
|
-
ctrl: "Control",
|
|
199
|
-
meta: "Meta",
|
|
200
|
-
shift: "Shift"
|
|
201
|
-
};
|
|
202
|
-
function le(e, t) {
|
|
203
|
-
let n = j(e);
|
|
204
|
-
if (n.length === 1) return n[0]?.map((e) => {
|
|
205
|
-
let n = A(e);
|
|
206
|
-
if (n === "mod") return t === "mac" ? "Meta" : "Control";
|
|
207
|
-
if (n !== void 0 && n in H) return H[n];
|
|
208
|
-
let r = n ?? e;
|
|
209
|
-
return r.length === 1 ? r.toUpperCase() : `${r[0]?.toUpperCase()}${r.slice(1)}`;
|
|
210
|
-
}).join("+");
|
|
211
|
-
}
|
|
212
|
-
function U(e, t, n) {
|
|
213
|
-
let r = re(e, {
|
|
214
|
-
platform: t,
|
|
215
|
-
t: n
|
|
216
|
-
});
|
|
217
|
-
return r.steps.map((e) => e.map((e) => e.legend).join(r.separator)).join(` ${r.thenLabel} `);
|
|
218
|
-
}
|
|
219
|
-
function W({ children: e, ...t }) {
|
|
220
|
-
return /* @__PURE__ */ b("span", {
|
|
221
|
-
...o(t, "part", "icon"),
|
|
222
|
-
children: e
|
|
223
|
-
});
|
|
224
|
-
}
|
|
225
|
-
function G({ children: e, ...t }) {
|
|
226
|
-
return /* @__PURE__ */ b("span", {
|
|
227
|
-
...o(t, "part", "label"),
|
|
228
|
-
children: e
|
|
229
|
-
});
|
|
230
|
-
}
|
|
231
|
-
function K({ children: e, ...t }) {
|
|
232
|
-
return /* @__PURE__ */ b("span", {
|
|
233
|
-
...o(t, "part", "description"),
|
|
234
|
-
children: e
|
|
235
|
-
});
|
|
236
|
-
}
|
|
237
|
-
function q({ children: e, ...t }) {
|
|
238
|
-
return /* @__PURE__ */ b("span", {
|
|
239
|
-
...o(t, "part", "meta"),
|
|
240
|
-
children: e
|
|
241
|
-
});
|
|
242
|
-
}
|
|
243
|
-
function J({ children: t, keys: n, ...i }) {
|
|
244
|
-
let a = r(void 0), s = e(C);
|
|
245
|
-
return /* @__PURE__ */ b("span", {
|
|
246
|
-
...i,
|
|
247
|
-
...o(n === void 0 ? {} : { "aria-hidden": !0 }, "part", "shortcut"),
|
|
248
|
-
children: n === void 0 ? t : U(n, a, s)
|
|
249
|
-
});
|
|
250
|
-
}
|
|
251
|
-
function Y({ checked: e, children: t, closeOnSelect: n, closesByDefault: a, commit: o, description: s, disabled: c, icon: l, indicator: u, meta: d, onSelect: f, ref: p, render: h, role: g = "menuitem", shortcut: _, textValue: v, tone: S, ...C }) {
|
|
252
|
-
let w = B(), T = z(), E = r(void 0), D = `${m()}description`, ee = (e, t) => {
|
|
253
|
-
if (c === !0) return;
|
|
254
|
-
o?.(e, t);
|
|
255
|
-
let r = !1;
|
|
256
|
-
f?.({
|
|
257
|
-
reason: e,
|
|
258
|
-
source: t,
|
|
259
|
-
get defaultPrevented() {
|
|
260
|
-
return r;
|
|
261
|
-
},
|
|
262
|
-
preventDefault: () => {
|
|
263
|
-
r = !0;
|
|
264
|
-
}
|
|
265
|
-
}), !r && (n ?? a ?? w.closeOnSelect) && T?.closeAll("select", t);
|
|
266
|
-
}, O = (e) => {
|
|
267
|
-
ee(e.detail === 0 ? "keyboard" : "pointer", e.nativeEvent);
|
|
268
|
-
}, te = (e) => {
|
|
269
|
-
if (e.key === " " && g !== "menuitem") {
|
|
270
|
-
if (e.preventDefault(), c === !0) return;
|
|
271
|
-
o?.("keyboard", e.nativeEvent), f?.({
|
|
272
|
-
reason: "keyboard",
|
|
273
|
-
source: e.nativeEvent,
|
|
274
|
-
defaultPrevented: !0,
|
|
275
|
-
preventDefault: () => void 0
|
|
276
|
-
});
|
|
277
|
-
}
|
|
278
|
-
}, ne = (e) => {
|
|
279
|
-
let t = e.currentTarget;
|
|
280
|
-
t.ownerDocument.activeElement !== t && t.focus({ preventScroll: !0 });
|
|
281
|
-
}, k = (e) => {
|
|
282
|
-
let t = e.currentTarget;
|
|
283
|
-
t.ownerDocument.activeElement === t && T?.openItem !== t && T?.node?.focus({ preventScroll: !0 });
|
|
284
|
-
}, A = i({
|
|
285
|
-
...C,
|
|
286
|
-
children: /* @__PURE__ */ x(y, { children: [
|
|
287
|
-
u,
|
|
288
|
-
l === void 0 ? null : /* @__PURE__ */ b(W, { children: l }),
|
|
289
|
-
/* @__PURE__ */ b(G, { children: t }),
|
|
290
|
-
s === void 0 ? null : /* @__PURE__ */ b(K, {
|
|
291
|
-
id: D,
|
|
292
|
-
children: s
|
|
293
|
-
}),
|
|
294
|
-
d === void 0 ? null : /* @__PURE__ */ b(q, { children: d }),
|
|
295
|
-
_ === void 0 ? null : /* @__PURE__ */ b(J, { keys: _ })
|
|
296
|
-
] }),
|
|
297
|
-
...e === void 0 ? {} : { "aria-checked": e },
|
|
298
|
-
...s === void 0 ? {} : { "aria-describedby": D },
|
|
299
|
-
...e ? { "data-checked": "" } : {},
|
|
300
|
-
...c === !0 ? {
|
|
301
|
-
"aria-disabled": !0,
|
|
302
|
-
"data-disabled": ""
|
|
303
|
-
} : {},
|
|
304
|
-
..._ === void 0 ? {} : { "aria-keyshortcuts": le(_, E) },
|
|
305
|
-
...v === void 0 ? {} : { "data-text-value": v },
|
|
306
|
-
...S === void 0 ? {} : { "data-tone": S },
|
|
307
|
-
"data-part": "item",
|
|
308
|
-
onClick: V(C.onClick, O),
|
|
309
|
-
onKeyDown: V(C.onKeyDown, te),
|
|
310
|
-
onPointerLeave: V(C.onPointerLeave, k),
|
|
311
|
-
onPointerMove: V(C.onPointerMove, ne),
|
|
312
|
-
role: g,
|
|
313
|
-
tabIndex: -1
|
|
314
|
-
}), j = (e) => {
|
|
315
|
-
typeof p == "function" ? p(e) : p != null && (p.current = e);
|
|
316
|
-
};
|
|
317
|
-
return h === void 0 ? /* @__PURE__ */ b("button", {
|
|
318
|
-
type: "button",
|
|
319
|
-
...A,
|
|
320
|
-
ref: p
|
|
321
|
-
}) : h({
|
|
322
|
-
...A,
|
|
323
|
-
ref: j
|
|
324
|
-
});
|
|
325
|
-
}
|
|
326
|
-
function ue(e) {
|
|
327
|
-
return /* @__PURE__ */ b(Y, { ...e });
|
|
328
|
-
}
|
|
329
|
-
function X({ checked: e, defaultChecked: t, onCheckedChange: n, ...r }) {
|
|
330
|
-
let [i, a] = v(t ?? !1), o = e ?? i, s = (t, r) => {
|
|
331
|
-
l({
|
|
332
|
-
controlled: e,
|
|
333
|
-
initial: o,
|
|
334
|
-
onRequest: (e) => n?.(e.value, e)
|
|
335
|
-
}).request(!o, t, r) && a(!o);
|
|
336
|
-
};
|
|
337
|
-
return /* @__PURE__ */ b(Y, {
|
|
338
|
-
...r,
|
|
339
|
-
checked: o,
|
|
340
|
-
closesByDefault: !1,
|
|
341
|
-
commit: s,
|
|
342
|
-
indicator: /* @__PURE__ */ b(Z, { glyph: "check" }),
|
|
343
|
-
role: "menuitemcheckbox"
|
|
344
|
-
});
|
|
345
|
-
}
|
|
346
|
-
function Z({ glyph: e }) {
|
|
347
|
-
return /* @__PURE__ */ b("span", {
|
|
348
|
-
"data-part": "indicator",
|
|
349
|
-
"data-part-indicator": "",
|
|
350
|
-
children: /* @__PURE__ */ b(n, { children: /* @__PURE__ */ b(t, { name: e }) })
|
|
351
|
-
});
|
|
352
|
-
}
|
|
353
|
-
var Q = u(null);
|
|
354
|
-
function de({ children: e, defaultValue: t, onValueChange: n, value: r, ...i }) {
|
|
355
|
-
let [a, s] = v(t), c = r ?? a, u = d((e, t, i) => {
|
|
356
|
-
l({
|
|
357
|
-
controlled: r,
|
|
358
|
-
initial: c ?? "",
|
|
359
|
-
onRequest: (e) => n?.(e.value, e)
|
|
360
|
-
}).request(e, t, i) && s(e);
|
|
361
|
-
}, [
|
|
362
|
-
c,
|
|
363
|
-
n,
|
|
364
|
-
r
|
|
365
|
-
]);
|
|
366
|
-
return /* @__PURE__ */ b("div", {
|
|
367
|
-
...o(i, "part", "group"),
|
|
368
|
-
role: "group",
|
|
369
|
-
children: /* @__PURE__ */ b(Q.Provider, {
|
|
370
|
-
value: {
|
|
371
|
-
select: u,
|
|
372
|
-
value: c
|
|
373
|
-
},
|
|
374
|
-
children: e
|
|
375
|
-
})
|
|
376
|
-
});
|
|
377
|
-
}
|
|
378
|
-
function fe({ value: e, ...t }) {
|
|
379
|
-
let n = f(Q);
|
|
380
|
-
if (n === null) throw Error("MenuRadioItem has to be inside a MenuRadioGroup.");
|
|
381
|
-
return /* @__PURE__ */ b(Y, {
|
|
382
|
-
...t,
|
|
383
|
-
checked: n.value === e,
|
|
384
|
-
closesByDefault: !1,
|
|
385
|
-
commit: (t, r) => n.select(e, t, r),
|
|
386
|
-
indicator: /* @__PURE__ */ b(Z, { glyph: "dot" }),
|
|
387
|
-
role: "menuitemradio"
|
|
388
|
-
});
|
|
389
|
-
}
|
|
390
|
-
function pe({ children: e, label: t, ...n }) {
|
|
391
|
-
let r = `${m()}group`;
|
|
392
|
-
return /* @__PURE__ */ x("div", {
|
|
393
|
-
...n,
|
|
394
|
-
...o(t === void 0 ? {} : { "aria-labelledby": r }, "part", "group"),
|
|
395
|
-
role: "group",
|
|
396
|
-
children: [t === void 0 ? null : /* @__PURE__ */ b(me, {
|
|
397
|
-
id: r,
|
|
398
|
-
children: t
|
|
399
|
-
}), e]
|
|
400
|
-
});
|
|
401
|
-
}
|
|
402
|
-
function me({ children: e, ...t }) {
|
|
403
|
-
return /* @__PURE__ */ b("div", {
|
|
404
|
-
...o(t, "part", "group-label"),
|
|
405
|
-
children: e
|
|
406
|
-
});
|
|
407
|
-
}
|
|
408
|
-
function he({ children: e, id: t, ...n }) {
|
|
409
|
-
let r = z(), i = `${m()}header`, a = t ?? i, s = r?.setHeaderId;
|
|
410
|
-
return p(() => (s?.(a), () => s?.(null)), [a, s]), /* @__PURE__ */ b("div", {
|
|
411
|
-
...o(n, "part", "header"),
|
|
412
|
-
id: a,
|
|
413
|
-
children: e
|
|
414
|
-
});
|
|
415
|
-
}
|
|
416
|
-
function ge(e) {
|
|
417
|
-
return /* @__PURE__ */ b("hr", {
|
|
418
|
-
...o(e, "part", "separator"),
|
|
419
|
-
"aria-orientation": "horizontal",
|
|
420
|
-
role: "separator"
|
|
421
|
-
});
|
|
422
|
-
}
|
|
423
|
-
function _e({ children: e, ...t }) {
|
|
424
|
-
return /* @__PURE__ */ b("div", {
|
|
425
|
-
...o(t, "part", "empty"),
|
|
426
|
-
children: e
|
|
427
|
-
});
|
|
428
|
-
}
|
|
429
|
-
//#endregion
|
|
430
|
-
//#region src/menu/menu-parts.tsx
|
|
431
|
-
function $(e, t) {
|
|
432
|
-
return (n) => {
|
|
433
|
-
e?.(n), n.defaultPrevented || t(n);
|
|
434
|
-
};
|
|
435
|
-
}
|
|
436
|
-
function ve(e, ...t) {
|
|
437
|
-
for (let n of t) typeof n == "function" ? n(e) : n != null && (n.current = e);
|
|
438
|
-
}
|
|
439
|
-
var ye = "[data-part='item']", be = (e) => e === null ? [] : [...e.querySelectorAll(ye)], xe = (e) => e.dataset.textValue ?? e.querySelector("[data-part='label']")?.textContent?.trim() ?? e.textContent?.trim() ?? "", Se = (e) => e.dataset.disabled === void 0;
|
|
440
|
-
function Ce(e) {
|
|
441
|
-
e.focus({ preventScroll: !0 });
|
|
442
|
-
let t = e.closest("[data-part='content']");
|
|
443
|
-
if (t === null) return;
|
|
444
|
-
let n = t.getBoundingClientRect(), r = e.getBoundingClientRect();
|
|
445
|
-
r.top < n.top ? t.scrollTop -= n.top - r.top : r.bottom > n.bottom && (t.scrollTop += r.bottom - n.bottom);
|
|
446
|
-
}
|
|
447
|
-
function we(e, t) {
|
|
448
|
-
let n = be(e), r = n[t < 0 ? n.length + t : t];
|
|
449
|
-
r !== void 0 && Ce(r);
|
|
450
|
-
}
|
|
451
|
-
function Te(e, t) {
|
|
452
|
-
let n = be(e), r = t === "first" ? n : [...n].reverse(), i = r.find(Se) ?? r[0];
|
|
453
|
-
i !== void 0 && Ce(i);
|
|
454
|
-
}
|
|
455
|
-
var Ee = (e) => e !== null && getComputedStyle(e).direction === "rtl" ? "rtl" : "ltr";
|
|
456
|
-
function De(e, t) {
|
|
457
|
-
if (e === null) return;
|
|
458
|
-
let n = c(e.ownerDocument.body), r = n.indexOf(e);
|
|
459
|
-
if (r === -1) return void e.focus({ preventScroll: !0 });
|
|
460
|
-
(n[r + t] ?? e).focus({ preventScroll: !0 });
|
|
461
|
-
}
|
|
462
|
-
function Oe({ children: e, icon: r, meta: i, ref: o, render: s, ...c }) {
|
|
463
|
-
let l = B(), u = l.parent, f = l.onBar, m = l.menubar, [h, g] = v(null), S = _(void 0), C = _(null), w = _({
|
|
464
|
-
menu: l,
|
|
465
|
-
node: h
|
|
466
|
-
});
|
|
467
|
-
w.current = {
|
|
468
|
-
menu: l,
|
|
469
|
-
node: h
|
|
470
|
-
};
|
|
471
|
-
let T = d(() => {
|
|
472
|
-
S.current !== void 0 && clearTimeout(S.current), S.current = void 0, C.current?.destroy(), C.current = null;
|
|
473
|
-
}, []);
|
|
474
|
-
p(() => T, [T]), p(() => {
|
|
475
|
-
l.setTriggerNode(h);
|
|
476
|
-
}, [l, h]), p(() => {
|
|
477
|
-
if (f && m !== null) return m.register(l.identity, h), () => m.register(l.identity, null);
|
|
478
|
-
}, [
|
|
479
|
-
m,
|
|
480
|
-
l.identity,
|
|
481
|
-
h,
|
|
482
|
-
f
|
|
483
|
-
]);
|
|
484
|
-
let E = (e, t, n) => {
|
|
485
|
-
l.entry.current = t, l.toggle(!0, e, n);
|
|
486
|
-
}, ee = (e) => {
|
|
487
|
-
l.disabled || l.open && u !== null || (l.entry.current = "first", l.toggle(!l.open, "pointer", e.nativeEvent));
|
|
488
|
-
}, O = (e) => {
|
|
489
|
-
if (l.disabled) return;
|
|
490
|
-
let t = Ee(h) === "rtl" ? "ArrowLeft" : "ArrowRight", n = m?.orientation === "vertical", r = u === null && (!f || !n) && e.key === "ArrowDown", i = u === null && (!f || !n) && e.key === "ArrowUp", a = e.key === t && (u !== null || f && n);
|
|
491
|
-
if (r || a) {
|
|
492
|
-
e.preventDefault(), e.stopPropagation(), E("keyboard", "first", e.nativeEvent);
|
|
493
|
-
return;
|
|
494
|
-
}
|
|
495
|
-
if (i) {
|
|
496
|
-
e.preventDefault(), E("keyboard", "last", e.nativeEvent);
|
|
497
|
-
return;
|
|
498
|
-
}
|
|
499
|
-
u !== null && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.stopPropagation(), E("keyboard", "first", e.nativeEvent));
|
|
500
|
-
}, te = (e) => {
|
|
501
|
-
if (!l.disabled) {
|
|
502
|
-
if (T(), u !== null) {
|
|
503
|
-
if (u.setOpenItem(h), !l.openOnHover || l.open) return;
|
|
504
|
-
S.current = setTimeout(() => E("pointer", "first", e.nativeEvent), l.submenuOpenDelay);
|
|
505
|
-
return;
|
|
506
|
-
}
|
|
507
|
-
f && m !== null && m.value !== void 0 && m.value !== l.contentId && (h?.focus({ preventScroll: !0 }), E("pointer", "first", e.nativeEvent));
|
|
508
|
-
}
|
|
509
|
-
}, ne = (e) => {
|
|
510
|
-
if (S.current !== void 0 && (clearTimeout(S.current), S.current = void 0), u === null || !l.open) return;
|
|
511
|
-
let t = l.contentNode;
|
|
512
|
-
t !== null && (C.current?.destroy(), C.current = D({
|
|
513
|
-
target: () => t.getBoundingClientRect(),
|
|
514
|
-
origin: () => h?.getBoundingClientRect() ?? null,
|
|
515
|
-
timeout: l.submenuCloseDelay,
|
|
516
|
-
onSettled: () => {
|
|
517
|
-
let n = w.current;
|
|
518
|
-
n.node?.matches(":hover") || t.matches(":hover") || n.menu.toggle(!1, "pointer", e.nativeEvent);
|
|
519
|
-
}
|
|
520
|
-
}));
|
|
521
|
-
}, k = d((e) => {
|
|
522
|
-
g(e), ve(e, o);
|
|
523
|
-
}, [o]), A = u === null ? e : /* @__PURE__ */ x(y, { children: [
|
|
524
|
-
r === void 0 ? null : /* @__PURE__ */ b(W, { children: r }),
|
|
525
|
-
/* @__PURE__ */ b(G, { children: e }),
|
|
526
|
-
i === void 0 ? null : /* @__PURE__ */ b(q, { children: i }),
|
|
527
|
-
/* @__PURE__ */ b(n, {
|
|
528
|
-
directional: !0,
|
|
529
|
-
children: /* @__PURE__ */ b(t, { name: "chevron-right" })
|
|
530
|
-
})
|
|
531
|
-
] }), j = {
|
|
532
|
-
type: "button",
|
|
533
|
-
...c,
|
|
534
|
-
children: A,
|
|
535
|
-
"aria-controls": l.open ? l.contentId : void 0,
|
|
536
|
-
"aria-expanded": l.open,
|
|
537
|
-
"aria-haspopup": "menu",
|
|
538
|
-
id: l.triggerId,
|
|
539
|
-
...l.disabled ? {
|
|
540
|
-
"aria-disabled": !0,
|
|
541
|
-
"data-disabled": ""
|
|
542
|
-
} : {},
|
|
543
|
-
...l.open ? { "data-open": "" } : {},
|
|
544
|
-
...u === null ? f ? {
|
|
545
|
-
role: "menuitem",
|
|
546
|
-
"data-part": "trigger",
|
|
547
|
-
...a("part", "trigger")
|
|
548
|
-
} : {} : {
|
|
549
|
-
role: "menuitem",
|
|
550
|
-
"data-part": "item",
|
|
551
|
-
...a("part", "item"),
|
|
552
|
-
tabIndex: -1
|
|
553
|
-
},
|
|
554
|
-
onClick: $(c.onClick, ee),
|
|
555
|
-
onKeyDown: $(c.onKeyDown, O),
|
|
556
|
-
onPointerEnter: $(c.onPointerEnter, te),
|
|
557
|
-
onPointerLeave: $(c.onPointerLeave, ne)
|
|
558
|
-
};
|
|
559
|
-
return s === void 0 ? /* @__PURE__ */ b("button", {
|
|
560
|
-
...j,
|
|
561
|
-
ref: k
|
|
562
|
-
}) : s({
|
|
563
|
-
...j,
|
|
564
|
-
ref: k
|
|
565
|
-
});
|
|
566
|
-
}
|
|
567
|
-
function ke({ children: e, loading: t, ref: n, render: r, ...a }) {
|
|
568
|
-
let c = B(), l = c.parent, [u, f] = v(null), [m, h] = v(null), [y, x] = v(null), [C, T] = v("unmounted"), [D, A] = v(!1), [j, re] = v(null), [ie, ae] = v(null), M = _(null), N = _(null), P = _({
|
|
569
|
-
menu: c,
|
|
570
|
-
surfaceNode: m
|
|
571
|
-
});
|
|
572
|
-
P.current = {
|
|
573
|
-
menu: c,
|
|
574
|
-
surfaceNode: m
|
|
575
|
-
}, p(() => {
|
|
576
|
-
let e = S({
|
|
577
|
-
present: P.current.menu.open,
|
|
578
|
-
onStatusChange: T
|
|
579
|
-
});
|
|
580
|
-
return M.current = e, T(e.status), () => {
|
|
581
|
-
e.destroy(), M.current = null;
|
|
582
|
-
};
|
|
583
|
-
}, []), p(() => {
|
|
584
|
-
M.current?.sync(c.open);
|
|
585
|
-
}, [c.open]), p(() => {
|
|
586
|
-
M.current?.setNode(u);
|
|
587
|
-
}, [u]), p(() => {
|
|
588
|
-
c.setContentNode(m);
|
|
589
|
-
}, [c, m]);
|
|
590
|
-
let F = c.mount === "eager" || c.mount === "lazy" && c.seen || c.open || C !== "unmounted";
|
|
591
|
-
p(() => {
|
|
592
|
-
let e = c.triggerNode;
|
|
593
|
-
if (e === null || D) return;
|
|
594
|
-
let t = () => A(!0);
|
|
595
|
-
return e.addEventListener("focusin", t), e.addEventListener("pointerdown", t), () => {
|
|
596
|
-
e.removeEventListener("focusin", t), e.removeEventListener("pointerdown", t);
|
|
597
|
-
};
|
|
598
|
-
}, [c.triggerNode, D]);
|
|
599
|
-
let I = F || D;
|
|
600
|
-
g(() => {
|
|
601
|
-
if (!I) {
|
|
602
|
-
x(null);
|
|
603
|
-
return;
|
|
604
|
-
}
|
|
605
|
-
let e = w({
|
|
606
|
-
origin: c.triggerNode,
|
|
607
|
-
disabled: !c.portal
|
|
608
|
-
});
|
|
609
|
-
return x(e.container), () => e.release();
|
|
610
|
-
}, [
|
|
611
|
-
I,
|
|
612
|
-
c.portal,
|
|
613
|
-
c.triggerNode
|
|
614
|
-
]);
|
|
615
|
-
let { align: R, alignOffset: z, collisionPadding: oe, flip: se, hideWhenDetached: ce, shift: V, side: H, sideOffset: le, strategy: U } = c, W = c.anchor ?? c.triggerNode, G = _(null), K = _(0), q = d((e, t) => {
|
|
616
|
-
e.update().then(() => {
|
|
617
|
-
if (G.current !== e || !P.current.menu.open) return;
|
|
618
|
-
let n = t.hasAttribute("data-open");
|
|
619
|
-
t.setAttribute("data-open", "");
|
|
620
|
-
let r = t.ownerDocument.defaultView;
|
|
621
|
-
n || r === null || K.current !== 0 || (K.current = r.requestAnimationFrame(() => {
|
|
622
|
-
K.current = 0;
|
|
623
|
-
let { menu: e, surfaceNode: t } = P.current;
|
|
624
|
-
if (!e.open || t === null) return;
|
|
625
|
-
let n = e.onBar ? e.menubar : null, r = n === null ? e.entry.current : n.entry.current;
|
|
626
|
-
e.entry.current = "first", n !== null && (n.entry.current = "first"), r !== "trigger" && Te(t, r);
|
|
627
|
-
}));
|
|
628
|
-
});
|
|
629
|
-
}, []);
|
|
630
|
-
g(() => {
|
|
631
|
-
if (u === null || W === null) return;
|
|
632
|
-
let e = c.parent !== null && m !== null && c.triggerNode !== null ? O({
|
|
633
|
-
parentSurface: c.parent.node,
|
|
634
|
-
item: c.triggerNode,
|
|
635
|
-
surface: m
|
|
636
|
-
}) : {
|
|
637
|
-
sideOffset: 0,
|
|
638
|
-
alignOffset: 0
|
|
639
|
-
}, t = ee(W, u, {
|
|
640
|
-
align: R,
|
|
641
|
-
alignOffset: z + e.alignOffset,
|
|
642
|
-
boundaryPadding: oe,
|
|
643
|
-
flip: se,
|
|
644
|
-
hideWhenDetached: ce,
|
|
645
|
-
shift: V,
|
|
646
|
-
side: H,
|
|
647
|
-
sideOffset: le + e.sideOffset,
|
|
648
|
-
strategy: U
|
|
649
|
-
});
|
|
650
|
-
return G.current = t, P.current.menu.open && q(t, u), () => {
|
|
651
|
-
t.destroy(), G.current = null, u.removeAttribute("data-open");
|
|
652
|
-
};
|
|
653
|
-
}, [
|
|
654
|
-
R,
|
|
655
|
-
z,
|
|
656
|
-
W,
|
|
657
|
-
oe,
|
|
658
|
-
se,
|
|
659
|
-
ce,
|
|
660
|
-
u,
|
|
661
|
-
c.parent,
|
|
662
|
-
c.triggerNode,
|
|
663
|
-
V,
|
|
664
|
-
H,
|
|
665
|
-
le,
|
|
666
|
-
U,
|
|
667
|
-
m,
|
|
668
|
-
q
|
|
669
|
-
]), g(() => {
|
|
670
|
-
let e = G.current;
|
|
671
|
-
if (e !== null && u !== null) {
|
|
672
|
-
if (c.open) {
|
|
673
|
-
q(e, u);
|
|
674
|
-
return;
|
|
675
|
-
}
|
|
676
|
-
u.removeAttribute("data-open"), K.current !== 0 && (u.ownerDocument.defaultView?.cancelAnimationFrame(K.current), K.current = 0);
|
|
677
|
-
}
|
|
678
|
-
}, [
|
|
679
|
-
u,
|
|
680
|
-
c.open,
|
|
681
|
-
q
|
|
682
|
-
]), p(() => {
|
|
683
|
-
if (u === null || !c.open) return;
|
|
684
|
-
let e = [c.triggerNode, l?.node ?? null].filter((e) => e !== null), t = E(u, {
|
|
685
|
-
branches: e,
|
|
686
|
-
escape: c.closeOnEscape,
|
|
687
|
-
focusOutside: !1,
|
|
688
|
-
modal: !1,
|
|
689
|
-
outsidePress: c.closeOnOutsidePress,
|
|
690
|
-
scrollLock: !1,
|
|
691
|
-
onDismiss: (e) => {
|
|
692
|
-
let t = e.reason === "escape" ? "escape" : "outsidePress";
|
|
693
|
-
P.current.menu.toggle(!1, t, e.source), t === "outsidePress" && l?.closeAll("outsidePress", e.source);
|
|
694
|
-
}
|
|
695
|
-
});
|
|
696
|
-
return () => t.destroy();
|
|
697
|
-
}, [
|
|
698
|
-
u,
|
|
699
|
-
c.closeOnEscape,
|
|
700
|
-
c.closeOnOutsidePress,
|
|
701
|
-
c.open,
|
|
702
|
-
c.triggerNode,
|
|
703
|
-
l
|
|
704
|
-
]), p(() => {
|
|
705
|
-
if (m === null) return;
|
|
706
|
-
let e = s(m, {
|
|
707
|
-
focus: Ce,
|
|
708
|
-
includeAriaDisabled: !0,
|
|
709
|
-
itemSelector: ye,
|
|
710
|
-
loop: () => P.current.menu.loop,
|
|
711
|
-
orientation: () => "vertical"
|
|
712
|
-
});
|
|
713
|
-
return () => e.destroy();
|
|
714
|
-
}, [m]), p(() => {
|
|
715
|
-
if (!c.typeahead) return;
|
|
716
|
-
let e = te({ timeout: c.typeaheadTimeout });
|
|
717
|
-
return N.current = e, () => {
|
|
718
|
-
e.destroy(), N.current = null;
|
|
719
|
-
};
|
|
720
|
-
}, [c.typeahead, c.typeaheadTimeout]), p(() => {
|
|
721
|
-
c.open || (re(null), N.current?.reset());
|
|
722
|
-
}, [c.open]);
|
|
723
|
-
let J = d((e, t) => {
|
|
724
|
-
P.current.menu.toggle(!1, e, t), l?.closeAll(e, t);
|
|
725
|
-
}, [l]), Y = {
|
|
726
|
-
close: (e, t) => c.toggle(!1, e, t),
|
|
727
|
-
closeAll: J,
|
|
728
|
-
depth: (l?.depth ?? -1) + 1,
|
|
729
|
-
focusItem: (e) => we(m, e),
|
|
730
|
-
node: m,
|
|
731
|
-
openItem: j,
|
|
732
|
-
rootTrigger: l?.rootTrigger ?? c.triggerNode,
|
|
733
|
-
setHeaderId: ae,
|
|
734
|
-
setOpenItem: re
|
|
735
|
-
}, ue = [a["aria-describedby"], ie].filter(Boolean).join(" ") || void 0, X = (e) => {
|
|
736
|
-
let t = Ee(m), n = t === "rtl" ? "ArrowRight" : "ArrowLeft", r = t === "rtl" ? "ArrowLeft" : "ArrowRight", i = c.menubar;
|
|
737
|
-
if (e.key === "Tab") {
|
|
738
|
-
e.preventDefault();
|
|
739
|
-
let t = Y.rootTrigger;
|
|
740
|
-
J("dismiss", e.nativeEvent), i?.close("dismiss", e.nativeEvent), De(t, e.shiftKey ? -1 : 1);
|
|
741
|
-
return;
|
|
742
|
-
}
|
|
743
|
-
if (e.key === n) {
|
|
744
|
-
if (l !== null) {
|
|
745
|
-
e.preventDefault(), c.toggle(!1, "keyboard", e.nativeEvent);
|
|
746
|
-
return;
|
|
747
|
-
}
|
|
748
|
-
if (i !== null) {
|
|
749
|
-
e.preventDefault(), i.step(-1, {
|
|
750
|
-
open: !0,
|
|
751
|
-
focus: !0
|
|
752
|
-
});
|
|
753
|
-
return;
|
|
754
|
-
}
|
|
755
|
-
}
|
|
756
|
-
if (e.key === r && i !== null) {
|
|
757
|
-
e.preventDefault(), J("keyboard", e.nativeEvent), i.step(1, {
|
|
758
|
-
open: !0,
|
|
759
|
-
focus: !0
|
|
760
|
-
});
|
|
761
|
-
return;
|
|
762
|
-
}
|
|
763
|
-
if (!c.typeahead || N.current === null || e.ctrlKey || e.metaKey || e.altKey || !ne(e.key, N.current.query.length > 0)) return;
|
|
764
|
-
e.preventDefault();
|
|
765
|
-
let a = be(m), o = a.findIndex((t) => t === e.target), s = N.current.match(e.key, a.map(xe), o);
|
|
766
|
-
s !== -1 && we(m, s);
|
|
767
|
-
}, Z = d((e) => {
|
|
768
|
-
f(e), ve(e, n);
|
|
769
|
-
}, [n]);
|
|
770
|
-
if (!F) return null;
|
|
771
|
-
let Q = i({
|
|
772
|
-
"data-align": R,
|
|
773
|
-
...c.open ? {} : { inert: !0 },
|
|
774
|
-
"data-part": "root",
|
|
775
|
-
"data-size": c.size,
|
|
776
|
-
"data-ui": "menu",
|
|
777
|
-
"data-width": c.width
|
|
778
|
-
}), de = /* @__PURE__ */ b("div", {
|
|
779
|
-
...Q,
|
|
780
|
-
ref: Z,
|
|
781
|
-
children: /* @__PURE__ */ b("div", {
|
|
782
|
-
...o(a, "part", "content"),
|
|
783
|
-
"aria-busy": t === !0 || void 0,
|
|
784
|
-
"aria-describedby": ue,
|
|
785
|
-
"aria-labelledby": a["aria-label"] === void 0 ? c.triggerId : void 0,
|
|
786
|
-
"data-loading": t === !0 ? "" : void 0,
|
|
787
|
-
id: c.contentId,
|
|
788
|
-
onKeyDown: $(a.onKeyDown, X),
|
|
789
|
-
ref: h,
|
|
790
|
-
role: "menu",
|
|
791
|
-
tabIndex: -1,
|
|
792
|
-
children: /* @__PURE__ */ b(L, {
|
|
793
|
-
value: Y,
|
|
794
|
-
children: e
|
|
795
|
-
})
|
|
796
|
-
})
|
|
797
|
-
}), fe = r === void 0 ? de : r({
|
|
798
|
-
...Q,
|
|
799
|
-
children: e,
|
|
800
|
-
ref: Z
|
|
801
|
-
});
|
|
802
|
-
return y === null ? fe : k(fe, y);
|
|
803
|
-
}
|
|
804
|
-
//#endregion
|
|
805
|
-
export { ie as C, oe as S, M as T, ce as _, pe as a, B as b, ue as c, G as d, q as f, ge as g, fe as h, _e as i, K as l, de as m, Oe as n, me as o, J as p, X as r, he as s, ke as t, W as u, L as v, N as w, z as x, R as y };
|