@rinzai/zen 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/CHANGELOG.md +15 -0
- package/dist/animated-number/index.js +14 -14
- package/dist/breadcrumbs/index.js +14 -14
- package/dist/calendar/index.js +29 -29
- package/dist/calendar-heatmap/index.js +12 -12
- package/dist/canvas/index.js +19 -19
- package/dist/carousel/index.js +24 -24
- package/dist/chart/index.js +7 -7
- package/dist/code-block/index.js +5 -5
- package/dist/collapse/index.js +6 -6
- package/dist/color-picker/index.js +10 -10
- package/dist/combobox/index.js +61 -61
- package/dist/command-palette/index.js +5 -5
- package/dist/confirm-dialog/index.js +4 -4
- package/dist/date-picker/index.js +15 -15
- package/dist/dialog/index.d.ts.map +1 -1
- package/dist/dialog/index.js +45 -65
- package/dist/docs/README.md +4 -4
- package/dist/docs/locale-provider.md +1 -1
- package/dist/docs/menu.md +54 -1
- package/dist/docs/seek-bar.md +30 -1
- package/dist/docs/sortable.md +63 -1
- package/dist/docs/tooltip.md +45 -3
- package/dist/filter-bar/index.js +6 -6
- package/dist/header/index.js +6 -6
- package/dist/icon-picker/index.js +5 -5
- package/dist/keypad/index.js +5 -5
- package/dist/lib.js +7 -7
- package/dist/load-more/index.js +5 -5
- package/dist/menu/index.d.ts +7 -1
- package/dist/menu/index.d.ts.map +1 -1
- package/dist/menu/index.js +217 -174
- package/dist/money-input/index.js +54 -54
- package/dist/month-picker/index.js +11 -11
- package/dist/number-field/index.js +5 -5
- package/dist/pagination/index.js +12 -12
- package/dist/range-slider/index.js +11 -11
- package/dist/repeat-picker/index.js +5 -5
- package/dist/resizable/index.js +22 -22
- package/dist/seek-bar/index.d.ts +3 -1
- package/dist/seek-bar/index.d.ts.map +1 -1
- package/dist/seek-bar/index.js +41 -40
- package/dist/select/index.js +21 -21
- package/dist/sortable/index.d.ts +13 -1
- package/dist/sortable/index.d.ts.map +1 -1
- package/dist/sortable/index.js +74 -55
- package/dist/sortable/shared.js +14 -14
- package/dist/sortable/tree.js +17 -17
- package/dist/sparkline/index.js +4 -4
- package/dist/stepper/index.js +13 -13
- package/dist/table/index.js +26 -26
- package/dist/table/selection.js +9 -9
- package/dist/table-of-contents/index.js +11 -11
- package/dist/tag-input/index.js +5 -5
- package/dist/theme-toggle/index.js +4 -4
- package/dist/theme.css +103 -0
- package/dist/time-field/index.js +21 -21
- package/dist/toast/index.d.ts.map +1 -1
- package/dist/toast/index.js +41 -41
- package/dist/tooltip/index.d.ts +9 -3
- package/dist/tooltip/index.d.ts.map +1 -1
- package/dist/tooltip/index.js +19 -16
- package/dist/tree/index.js +34 -34
- package/dist/trend/index.js +5 -5
- package/dist/utils/messages.d.ts +1 -0
- package/dist/utils/messages.d.ts.map +1 -1
- package/dist/utils/messages.js +1 -0
- package/dist/utils/swipe.d.ts +7 -0
- package/dist/utils/swipe.d.ts.map +1 -1
- package/dist/utils/swipe.js +45 -25
- package/dist/utils/useAnchoredPopup.d.ts +2 -1
- package/dist/utils/useAnchoredPopup.d.ts.map +1 -1
- package/dist/utils/useAnchoredPopup.js +9 -5
- package/dist/utils/useVirtualList.d.ts +6 -1
- package/dist/utils/useVirtualList.d.ts.map +1 -1
- package/dist/utils/useVirtualList.js +12 -12
- package/dist/zen.css +1 -1
- package/package.json +1 -1
package/dist/menu/index.js
CHANGED
|
@@ -1,33 +1,40 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import e from "../
|
|
3
|
-
import t from "../icons/micro/
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
2
|
+
import { useMessages as e } from "../locale-provider/index.js";
|
|
3
|
+
import t from "../icons/micro/check.js";
|
|
4
|
+
import n from "../icons/micro/chevron-right.js";
|
|
5
|
+
import { cx as r } from "../utils/cx.js";
|
|
6
|
+
import { readingKey as i } from "../utils/direction.js";
|
|
7
|
+
import { useTypeahead as a } from "../utils/typeahead.js";
|
|
8
|
+
import { useGraphicsMode as o } from "../utils/graphics.js";
|
|
9
|
+
import { useMergedRefs as s } from "../utils/refs.js";
|
|
10
|
+
import { moveFocus as c, rovingItems as l, useRovingTabIndex as u } from "../utils/roving.js";
|
|
11
|
+
import { Slot as d } from "../utils/slot.js";
|
|
12
|
+
import { useSheetSwipe as f } from "../utils/swipe.js";
|
|
13
|
+
import { useControllable as p } from "../utils/useControllable.js";
|
|
14
|
+
import { anchorFor as m, anchoredStyle as h, useAnchoredPopup as g } from "../utils/useAnchoredPopup.js";
|
|
15
|
+
import { createContext as _, useContext as v, useEffect as y, useId as b, useLayoutEffect as x, useRef as S, useState as C } from "react";
|
|
16
|
+
import { Fragment as w, jsx as T, jsxs as E } from "react/jsx-runtime";
|
|
17
|
+
import { createPortal as D } from "react-dom";
|
|
16
18
|
//#region packages/menu/index.tsx
|
|
17
|
-
var
|
|
18
|
-
function
|
|
19
|
-
let
|
|
19
|
+
var O = typeof window > "u" ? y : x, k = _(null), A = "[data-zen-menubar-trigger]", j = _(() => {}), M = _(!1), N = (e) => !!e?.hasAttribute("data-zen-sheet") && getComputedStyle(e).getPropertyValue("--zen-sheet").trim() === "1";
|
|
20
|
+
function P(e, t) {
|
|
21
|
+
let n = v(j), [r, i] = C(!1);
|
|
22
|
+
O(() => i(t && N(e.current)), [t, e]), f(e, r ? "bottom" : void 0, n);
|
|
23
|
+
}
|
|
24
|
+
var F = _(null);
|
|
25
|
+
function I(e) {
|
|
26
|
+
let t = v(F);
|
|
20
27
|
if (!t) throw Error(`<${e}> must be inside <Menu>`);
|
|
21
28
|
return t;
|
|
22
29
|
}
|
|
23
|
-
function
|
|
24
|
-
|
|
25
|
-
let n =
|
|
30
|
+
function L({ onOpenChange: e, children: t }) {
|
|
31
|
+
o();
|
|
32
|
+
let n = b(), [r, i] = C(null), a = S(null), s = S(!1), c = S(null), l = g({ onOpenChange: (t) => {
|
|
26
33
|
s.current = t;
|
|
27
|
-
let n = l.popupRef.current, r = n ?
|
|
28
|
-
if (c.current = null, t ? (i ? r[i === "first" ? 0 : r.length - 1] : n)?.focus() : u(), !t &&
|
|
34
|
+
let n = l.popupRef.current, r = n ? W(n) : [], i = c.current;
|
|
35
|
+
if (c.current = null, t ? (i ? r[i === "first" ? 0 : r.length - 1] : n)?.focus() : u(), !t && a.current) {
|
|
29
36
|
let e = document.activeElement;
|
|
30
|
-
(!e || e === document.body || l.popupRef.current?.contains(e)) &&
|
|
37
|
+
(!e || e === document.body || l.popupRef.current?.contains(e)) && a.current.focus(), a.current = null;
|
|
31
38
|
}
|
|
32
39
|
e?.(t);
|
|
33
40
|
} }), u = () => {
|
|
@@ -36,22 +43,22 @@ function M({ onOpenChange: e, children: t }) {
|
|
|
36
43
|
s.current || i(null);
|
|
37
44
|
});
|
|
38
45
|
};
|
|
39
|
-
|
|
46
|
+
O(() => {
|
|
40
47
|
if (r && (l.setOpen(!0), r.pointerId !== void 0)) try {
|
|
41
48
|
l.popupRef.current?.setPointerCapture(r.pointerId);
|
|
42
49
|
} catch {}
|
|
43
50
|
}, [r]);
|
|
44
51
|
let d = (e) => {
|
|
45
|
-
|
|
52
|
+
a.current = document.activeElement instanceof HTMLElement ? document.activeElement : null, i({ ...e });
|
|
46
53
|
}, f = (e) => {
|
|
47
54
|
let t = l.popupRef.current;
|
|
48
55
|
if (l.open && t) {
|
|
49
|
-
|
|
56
|
+
W(t).at(e === "first" ? 0 : -1)?.focus();
|
|
50
57
|
return;
|
|
51
58
|
}
|
|
52
|
-
c.current = e,
|
|
53
|
-
}, p =
|
|
54
|
-
return
|
|
59
|
+
c.current = e, a.current = document.getElementById(n), l.setOpen(!0);
|
|
60
|
+
}, p = v(k);
|
|
61
|
+
return y(() => (p?.set(n, f), () => void p?.delete(n))), /* @__PURE__ */ T(F.Provider, {
|
|
55
62
|
value: {
|
|
56
63
|
popup: l,
|
|
57
64
|
triggerId: n,
|
|
@@ -59,14 +66,14 @@ function M({ onOpenChange: e, children: t }) {
|
|
|
59
66
|
openAt: d,
|
|
60
67
|
openFrom: f
|
|
61
68
|
},
|
|
62
|
-
children: /* @__PURE__ */
|
|
69
|
+
children: /* @__PURE__ */ T(j.Provider, {
|
|
63
70
|
value: () => l.setOpen(!1),
|
|
64
71
|
children: t
|
|
65
72
|
})
|
|
66
73
|
});
|
|
67
74
|
}
|
|
68
|
-
function
|
|
69
|
-
let { popup: s, triggerId: c, point: l, openFrom:
|
|
75
|
+
function R({ asChild: e, style: t, onKeyDown: n, onPointerEnter: i, children: a, ...o }) {
|
|
76
|
+
let { popup: s, triggerId: c, point: l, openFrom: u } = I("MenuTrigger"), f = !!v(k), p = {
|
|
70
77
|
id: c,
|
|
71
78
|
"aria-haspopup": "menu",
|
|
72
79
|
...s.triggerProps,
|
|
@@ -79,13 +86,13 @@ function N({ asChild: e, style: t, onKeyDown: r, onPointerEnter: i, children: a,
|
|
|
79
86
|
"data-zen-menubar-trigger": ""
|
|
80
87
|
},
|
|
81
88
|
...o,
|
|
82
|
-
className:
|
|
89
|
+
className: r(f && le, o.className),
|
|
83
90
|
style: {
|
|
84
91
|
...s.triggerProps.style,
|
|
85
92
|
...t
|
|
86
93
|
},
|
|
87
94
|
onKeyDown: (e) => {
|
|
88
|
-
|
|
95
|
+
n?.(e), !(e.defaultPrevented || e.key !== "ArrowDown" && e.key !== "ArrowUp") && (e.preventDefault(), u(e.key === "ArrowDown" ? "first" : "last"));
|
|
89
96
|
},
|
|
90
97
|
onPointerEnter: (e) => {
|
|
91
98
|
i?.(e);
|
|
@@ -93,125 +100,138 @@ function N({ asChild: e, style: t, onKeyDown: r, onPointerEnter: i, children: a,
|
|
|
93
100
|
t && !s.open && e.pointerType !== "touch" && t.querySelector("[data-zen-menubar-trigger][data-popup-open]") && (s.setOpen(!0), e.currentTarget.focus());
|
|
94
101
|
}
|
|
95
102
|
};
|
|
96
|
-
return e ? /* @__PURE__ */
|
|
103
|
+
return e ? /* @__PURE__ */ T(d, {
|
|
97
104
|
...p,
|
|
98
105
|
children: a
|
|
99
|
-
}) : /* @__PURE__ */
|
|
106
|
+
}) : /* @__PURE__ */ T("button", {
|
|
100
107
|
type: "button",
|
|
101
108
|
...p,
|
|
102
|
-
className:
|
|
109
|
+
className: r("cursor-pointer", p.className),
|
|
103
110
|
children: a
|
|
104
111
|
});
|
|
105
112
|
}
|
|
106
|
-
function
|
|
107
|
-
let { popup:
|
|
113
|
+
function z({ align: e, offset: t, sheet: n, ref: a, className: o, style: c, children: u, ...d }) {
|
|
114
|
+
let { popup: f, triggerId: p, point: m } = I("MenuContent"), g = s(f.popupRef, a);
|
|
115
|
+
P(f.popupRef, !!n && f.open);
|
|
116
|
+
let _ = v(k);
|
|
108
117
|
e ??= m || _ ? "start" : "end", t ??= m ? 2 : 6;
|
|
109
|
-
let
|
|
118
|
+
let y = G(), b = (e) => {
|
|
110
119
|
if (e.defaultPrevented || e.target.closest("[role=\"menu\"]") !== e.currentTarget) return;
|
|
111
|
-
let t =
|
|
120
|
+
let t = i(e.key, e.currentTarget);
|
|
112
121
|
if (t !== "ArrowLeft" && t !== "ArrowRight") return;
|
|
113
|
-
let n = document.getElementById(
|
|
114
|
-
if (!n || !
|
|
115
|
-
let a =
|
|
122
|
+
let n = document.getElementById(p), r = n?.closest("[role=\"menubar\"]");
|
|
123
|
+
if (!n || !r) return;
|
|
124
|
+
let a = l(r, A), o = a[(a.indexOf(n) + (t === "ArrowRight" ? 1 : -1) + a.length) % a.length];
|
|
116
125
|
o && o !== n && (e.preventDefault(), o.focus(), _?.get(o.id)?.("first"));
|
|
117
126
|
};
|
|
118
|
-
return /* @__PURE__ */
|
|
119
|
-
"aria-labelledby": m ? void 0 :
|
|
120
|
-
...
|
|
121
|
-
...
|
|
122
|
-
ref:
|
|
127
|
+
return /* @__PURE__ */ E("div", {
|
|
128
|
+
"aria-labelledby": m ? void 0 : p,
|
|
129
|
+
...d,
|
|
130
|
+
...f.popupProps,
|
|
131
|
+
ref: g,
|
|
123
132
|
role: "menu",
|
|
124
133
|
tabIndex: -1,
|
|
134
|
+
"data-zen-sheet": n || void 0,
|
|
125
135
|
onKeyDown: (e) => {
|
|
126
|
-
|
|
136
|
+
d.onKeyDown?.(e), y(e), _ && b(e);
|
|
127
137
|
},
|
|
128
138
|
style: {
|
|
129
|
-
...
|
|
139
|
+
...h(f.id, {
|
|
130
140
|
align: e,
|
|
131
141
|
offset: t
|
|
132
142
|
}),
|
|
133
|
-
...
|
|
143
|
+
...c
|
|
134
144
|
},
|
|
135
|
-
className:
|
|
136
|
-
children:
|
|
145
|
+
className: r("zen__popover glass glass-blur text-foreground min-w-44 rounded-xl p-1.5 outline-hidden", o),
|
|
146
|
+
children: [n && /* @__PURE__ */ T(B, {}), /* @__PURE__ */ T(M.Provider, {
|
|
147
|
+
value: !!n,
|
|
148
|
+
children: u
|
|
149
|
+
})]
|
|
137
150
|
});
|
|
138
151
|
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
152
|
+
function B() {
|
|
153
|
+
return /* @__PURE__ */ T("div", {
|
|
154
|
+
"aria-hidden": !0,
|
|
155
|
+
className: "zen__sheet-only bg-tint/20 mx-auto mt-0.5 mb-2 h-1 w-10 rounded-full"
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
var V = 500, H = 8;
|
|
159
|
+
function U({ asChild: e, disabled: t, className: n, onContextMenu: i, onPointerDown: a, onClickCapture: o, children: s, ...c }) {
|
|
160
|
+
let { popup: l, point: u, openAt: f } = I("MenuContextTrigger"), p = b(), h = u?.from === p, g = S(null), _ = S(!1), v = () => {
|
|
142
161
|
g.current && clearTimeout(g.current.timer), g.current = null;
|
|
143
162
|
};
|
|
144
|
-
|
|
145
|
-
let
|
|
163
|
+
y(() => v, []);
|
|
164
|
+
let x = {
|
|
146
165
|
...c,
|
|
147
|
-
className:
|
|
166
|
+
className: r("[-webkit-touch-callout:none]", n),
|
|
148
167
|
"data-popup-open": h && l.open || void 0,
|
|
149
168
|
onContextMenu: (e) => {
|
|
150
|
-
if (i?.(e), !(t || e.defaultPrevented) && (e.preventDefault(),
|
|
169
|
+
if (i?.(e), !(t || e.defaultPrevented) && (e.preventDefault(), v(), !l.open)) {
|
|
151
170
|
if (e.clientX === 0 && e.clientY === 0) {
|
|
152
171
|
let t = e.target.getBoundingClientRect();
|
|
153
|
-
|
|
172
|
+
f({
|
|
154
173
|
x: t.left,
|
|
155
174
|
y: t.bottom,
|
|
156
|
-
from:
|
|
175
|
+
from: p
|
|
157
176
|
});
|
|
158
177
|
} else {
|
|
159
178
|
let t = e.nativeEvent, n = "pointerId" in t && e.buttons ? t.pointerId : void 0;
|
|
160
|
-
|
|
179
|
+
f({
|
|
161
180
|
x: e.clientX,
|
|
162
181
|
y: e.clientY,
|
|
163
|
-
from:
|
|
182
|
+
from: p,
|
|
164
183
|
pointerId: n
|
|
165
184
|
});
|
|
166
185
|
}
|
|
167
186
|
}
|
|
168
187
|
},
|
|
169
188
|
onPointerDown: (e) => {
|
|
170
|
-
if (a?.(e),
|
|
189
|
+
if (a?.(e), _.current = !1, t || e.pointerType !== "touch" || !e.isPrimary) return;
|
|
171
190
|
let n = {
|
|
172
191
|
x: e.clientX,
|
|
173
192
|
y: e.clientY,
|
|
174
|
-
from:
|
|
193
|
+
from: p,
|
|
175
194
|
pointerId: e.pointerId
|
|
176
195
|
}, r = e.currentTarget, i = (e) => {
|
|
177
|
-
Math.hypot(e.clientX - n.x, e.clientY - n.y) >
|
|
196
|
+
Math.hypot(e.clientX - n.x, e.clientY - n.y) > H && o();
|
|
178
197
|
}, o = () => {
|
|
179
|
-
|
|
198
|
+
v(), r.removeEventListener("pointermove", i), r.removeEventListener("pointerup", o), r.removeEventListener("pointercancel", o);
|
|
180
199
|
};
|
|
181
200
|
r.addEventListener("pointermove", i), r.addEventListener("pointerup", o), r.addEventListener("pointercancel", o), g.current = {
|
|
182
201
|
...n,
|
|
183
202
|
timer: window.setTimeout(() => {
|
|
184
|
-
o(),
|
|
185
|
-
},
|
|
203
|
+
o(), _.current = !0, l.open || f(n);
|
|
204
|
+
}, V)
|
|
186
205
|
};
|
|
187
206
|
},
|
|
188
207
|
onClickCapture: (e) => {
|
|
189
|
-
o?.(e),
|
|
208
|
+
o?.(e), _.current && (_.current = !1, e.preventDefault(), e.stopPropagation());
|
|
190
209
|
}
|
|
191
|
-
},
|
|
210
|
+
}, C = u && h && D(/* @__PURE__ */ T("span", {
|
|
192
211
|
"aria-hidden": !0,
|
|
193
|
-
...
|
|
212
|
+
...m(l.id),
|
|
194
213
|
style: {
|
|
195
|
-
...
|
|
214
|
+
...m(l.id).style,
|
|
196
215
|
position: "fixed",
|
|
197
|
-
left:
|
|
198
|
-
top:
|
|
216
|
+
left: u.x,
|
|
217
|
+
top: u.y
|
|
199
218
|
}
|
|
200
219
|
}), document.body);
|
|
201
|
-
return /* @__PURE__ */ w
|
|
202
|
-
...
|
|
220
|
+
return /* @__PURE__ */ E(w, { children: [T(e ? d : "div", {
|
|
221
|
+
...x,
|
|
203
222
|
children: s
|
|
204
|
-
}),
|
|
223
|
+
}), C] });
|
|
205
224
|
}
|
|
206
|
-
function
|
|
207
|
-
|
|
225
|
+
function W(e) {
|
|
226
|
+
let t = N(e);
|
|
227
|
+
return Array.from(e.querySelectorAll("[role^=\"menuitem\"]")).filter((n) => n.closest("[role=\"menu\"]") === e && !n.matches(":disabled, [aria-disabled=\"true\"]") && (t || !n.classList.contains("zen__sheet-only")));
|
|
208
228
|
}
|
|
209
|
-
function
|
|
210
|
-
let e =
|
|
229
|
+
function G() {
|
|
230
|
+
let e = a();
|
|
211
231
|
return (t) => {
|
|
212
232
|
let n = t.currentTarget;
|
|
213
233
|
if (t.target.closest("[role=\"menu\"]") !== n) return;
|
|
214
|
-
let r =
|
|
234
|
+
let r = W(n), i = r.indexOf(document.activeElement), a = r.length - 1, o = e(t);
|
|
215
235
|
if (o) {
|
|
216
236
|
r.find((e) => e.textContent?.trim().toLowerCase().startsWith(o))?.focus();
|
|
217
237
|
return;
|
|
@@ -225,127 +245,128 @@ function z() {
|
|
|
225
245
|
s !== void 0 && (t.preventDefault(), r[(s + r.length) % r.length]?.focus());
|
|
226
246
|
};
|
|
227
247
|
}
|
|
228
|
-
var
|
|
229
|
-
function
|
|
230
|
-
let l =
|
|
248
|
+
var K = "flex w-full cursor-pointer items-center gap-3 rounded-lg px-3 py-2 text-start text-sm outline-hidden select-none hover:bg-tint/[0.07] focus:bg-tint/[0.07] disabled:cursor-not-allowed disabled:opacity-50";
|
|
249
|
+
function q({ icon: e, tone: t = "default", onSelect: n, asChild: i, className: a, children: o, onClick: s, ...c }) {
|
|
250
|
+
let l = v(j), u = {
|
|
231
251
|
...c,
|
|
232
252
|
role: "menuitem",
|
|
233
253
|
tabIndex: -1,
|
|
234
|
-
className:
|
|
254
|
+
className: r(K, t === "negative" && "text-destructive", a),
|
|
235
255
|
onClick: (e) => {
|
|
236
|
-
s?.(e), l(),
|
|
256
|
+
s?.(e), l(), n?.();
|
|
237
257
|
}
|
|
238
|
-
}, f = e && /* @__PURE__ */
|
|
258
|
+
}, f = e && /* @__PURE__ */ T("span", {
|
|
239
259
|
"aria-hidden": !0,
|
|
240
|
-
className:
|
|
260
|
+
className: r("flex shrink-0", t !== "negative" && "text-muted-foreground"),
|
|
241
261
|
children: e
|
|
242
262
|
});
|
|
243
|
-
return i ? /* @__PURE__ */
|
|
244
|
-
...
|
|
263
|
+
return i ? /* @__PURE__ */ T(d, {
|
|
264
|
+
...u,
|
|
245
265
|
before: f,
|
|
246
266
|
children: o
|
|
247
|
-
}) : /* @__PURE__ */
|
|
267
|
+
}) : /* @__PURE__ */ E("button", {
|
|
248
268
|
type: "button",
|
|
249
|
-
...
|
|
269
|
+
...u,
|
|
250
270
|
children: [f, o]
|
|
251
271
|
});
|
|
252
272
|
}
|
|
253
|
-
var
|
|
254
|
-
function
|
|
255
|
-
let [l, u] =
|
|
256
|
-
return /* @__PURE__ */
|
|
273
|
+
var J = "flex size-4 shrink-0 items-center justify-center";
|
|
274
|
+
function ee({ checked: e, defaultChecked: n = !1, onCheckedChange: i, className: a, children: o, onClick: s, ...c }) {
|
|
275
|
+
let [l, u] = p(e, n, i);
|
|
276
|
+
return /* @__PURE__ */ E("button", {
|
|
257
277
|
type: "button",
|
|
258
278
|
...c,
|
|
259
279
|
role: "menuitemcheckbox",
|
|
260
280
|
"aria-checked": l,
|
|
261
281
|
tabIndex: -1,
|
|
262
|
-
className:
|
|
282
|
+
className: r(K, a),
|
|
263
283
|
onClick: (e) => {
|
|
264
284
|
s?.(e), e.defaultPrevented || u(!l);
|
|
265
285
|
},
|
|
266
|
-
children: [/* @__PURE__ */
|
|
286
|
+
children: [/* @__PURE__ */ T("span", {
|
|
267
287
|
"aria-hidden": !0,
|
|
268
|
-
className:
|
|
269
|
-
children: l && /* @__PURE__ */
|
|
288
|
+
className: J,
|
|
289
|
+
children: l && /* @__PURE__ */ T(t, { className: "size-3.5" })
|
|
270
290
|
}), o]
|
|
271
291
|
});
|
|
272
292
|
}
|
|
273
|
-
var
|
|
274
|
-
function
|
|
275
|
-
let [i, a] =
|
|
276
|
-
return /* @__PURE__ */
|
|
293
|
+
var Y = _(null);
|
|
294
|
+
function te({ value: e, defaultValue: t = null, onValueChange: n, ...r }) {
|
|
295
|
+
let [i, a] = p(e, t, n);
|
|
296
|
+
return /* @__PURE__ */ T(Y.Provider, {
|
|
277
297
|
value: {
|
|
278
298
|
value: i,
|
|
279
299
|
select: a
|
|
280
300
|
},
|
|
281
|
-
children: /* @__PURE__ */
|
|
301
|
+
children: /* @__PURE__ */ T("div", {
|
|
282
302
|
role: "group",
|
|
283
303
|
...r
|
|
284
304
|
})
|
|
285
305
|
});
|
|
286
306
|
}
|
|
287
|
-
function
|
|
288
|
-
let o =
|
|
307
|
+
function ne({ value: e, className: t, children: n, onClick: i, ...a }) {
|
|
308
|
+
let o = v(Y);
|
|
289
309
|
if (!o) throw Error("<MenuRadioItem> must be inside <MenuRadioGroup>");
|
|
290
310
|
let s = o.value === e;
|
|
291
|
-
return /* @__PURE__ */
|
|
311
|
+
return /* @__PURE__ */ E("button", {
|
|
292
312
|
type: "button",
|
|
293
313
|
...a,
|
|
294
314
|
role: "menuitemradio",
|
|
295
315
|
"aria-checked": s,
|
|
296
316
|
tabIndex: -1,
|
|
297
|
-
className:
|
|
317
|
+
className: r(K, t),
|
|
298
318
|
onClick: (t) => {
|
|
299
319
|
i?.(t), t.defaultPrevented || o.select(e);
|
|
300
320
|
},
|
|
301
|
-
children: [/* @__PURE__ */
|
|
321
|
+
children: [/* @__PURE__ */ T("span", {
|
|
302
322
|
"aria-hidden": !0,
|
|
303
|
-
className:
|
|
304
|
-
children: s && /* @__PURE__ */
|
|
305
|
-
}),
|
|
323
|
+
className: J,
|
|
324
|
+
children: s && /* @__PURE__ */ T("span", { className: "size-1.5 rounded-full bg-current" })
|
|
325
|
+
}), n]
|
|
306
326
|
});
|
|
307
327
|
}
|
|
308
|
-
var
|
|
309
|
-
function
|
|
310
|
-
let t =
|
|
328
|
+
var X = _(null);
|
|
329
|
+
function Z(e) {
|
|
330
|
+
let t = v(X);
|
|
311
331
|
if (!t) throw Error(`<${e}> must be inside <MenuSub>`);
|
|
312
332
|
return t;
|
|
313
333
|
}
|
|
314
|
-
var
|
|
334
|
+
var re = 250, ie = (e) => {
|
|
315
335
|
try {
|
|
316
336
|
return !!e?.matches(":popover-open");
|
|
317
337
|
} catch {
|
|
318
338
|
return !0;
|
|
319
339
|
}
|
|
320
340
|
};
|
|
321
|
-
function
|
|
322
|
-
let n =
|
|
341
|
+
function ae({ onOpenChange: e, children: t }) {
|
|
342
|
+
let n = S(null), r = b(), i = S(0), a = S(!1), o = g({ onOpenChange: (t) => {
|
|
323
343
|
let r = o.popupRef.current, i = n.current;
|
|
324
|
-
if (t && a.current && r &&
|
|
344
|
+
if (t && a.current && r && W(r)[0]?.focus(), a.current = !1, !t && i && ie(i.closest("[role=\"menu\"]"))) {
|
|
325
345
|
let e = document.activeElement;
|
|
326
346
|
(!e || e === document.body || r?.contains(e)) && i.focus();
|
|
327
347
|
}
|
|
328
348
|
e?.(t);
|
|
329
|
-
} }), s = () => clearTimeout(i.current);
|
|
330
|
-
|
|
331
|
-
let
|
|
349
|
+
} }), [s, c] = C(""), l = () => clearTimeout(i.current);
|
|
350
|
+
y(() => l, []);
|
|
351
|
+
let u = {
|
|
332
352
|
popup: o,
|
|
353
|
+
label: s,
|
|
333
354
|
triggerRef: n,
|
|
334
355
|
triggerId: r,
|
|
335
356
|
show: (e) => {
|
|
336
|
-
if (
|
|
337
|
-
e && o.popupRef.current &&
|
|
357
|
+
if (l(), o.open) {
|
|
358
|
+
e && o.popupRef.current && W(o.popupRef.current)[0]?.focus();
|
|
338
359
|
return;
|
|
339
360
|
}
|
|
340
|
-
a.current = e, o.setOpen(!0);
|
|
361
|
+
a.current = e, c(n.current?.textContent?.trim() ?? ""), o.setOpen(!0);
|
|
341
362
|
},
|
|
342
363
|
hideSoon: () => {
|
|
343
|
-
|
|
364
|
+
l(), i.current = window.setTimeout(() => o.setOpen(!1), re);
|
|
344
365
|
},
|
|
345
|
-
stay:
|
|
366
|
+
stay: l
|
|
346
367
|
};
|
|
347
|
-
return /* @__PURE__ */
|
|
348
|
-
value:
|
|
368
|
+
return /* @__PURE__ */ T(X.Provider, {
|
|
369
|
+
value: u,
|
|
349
370
|
children: t
|
|
350
371
|
});
|
|
351
372
|
}
|
|
@@ -353,9 +374,9 @@ function Q(e, t) {
|
|
|
353
374
|
let n = e.relatedTarget;
|
|
354
375
|
return n instanceof Node && !!t?.contains(n);
|
|
355
376
|
}
|
|
356
|
-
function
|
|
357
|
-
let m =
|
|
358
|
-
return /* @__PURE__ */
|
|
377
|
+
function oe({ icon: e, ref: t, className: a, children: o, onClick: c, onKeyDown: l, onPointerEnter: u, onPointerLeave: d, style: f, ...p }) {
|
|
378
|
+
let m = Z("MenuSubTrigger"), h = s(m.triggerRef, t), { popoverTarget: g, ..._ } = m.popup.triggerProps;
|
|
379
|
+
return /* @__PURE__ */ E("button", {
|
|
359
380
|
type: "button",
|
|
360
381
|
id: m.triggerId,
|
|
361
382
|
...p,
|
|
@@ -368,93 +389,115 @@ function $({ icon: e, ref: i, className: a, children: s, onClick: c, onKeyDown:
|
|
|
368
389
|
..._.style,
|
|
369
390
|
...f
|
|
370
391
|
},
|
|
371
|
-
className:
|
|
392
|
+
className: r(K, "data-popup-open:bg-tint/[0.07]", a),
|
|
372
393
|
onClick: (e) => {
|
|
373
394
|
c?.(e), e.defaultPrevented || m.show(e.detail === 0);
|
|
374
395
|
},
|
|
375
396
|
onKeyDown: (e) => {
|
|
376
|
-
l?.(e), !(e.defaultPrevented ||
|
|
397
|
+
l?.(e), !(e.defaultPrevented || i(e.key, e.currentTarget) !== "ArrowRight") && (e.preventDefault(), m.show(!0));
|
|
377
398
|
},
|
|
378
399
|
onPointerEnter: (e) => {
|
|
379
|
-
u?.(e), e.pointerType !== "touch" && m.show(!1);
|
|
400
|
+
u?.(e), e.pointerType !== "touch" && !N(e.currentTarget.closest("[role=\"menu\"]")) && m.show(!1);
|
|
380
401
|
},
|
|
381
402
|
onPointerLeave: (e) => {
|
|
382
|
-
d?.(e)
|
|
403
|
+
d?.(e);
|
|
404
|
+
let t = e.currentTarget.closest("[role=\"menu\"]");
|
|
405
|
+
Q(e, t) && !N(t) && m.hideSoon();
|
|
383
406
|
},
|
|
384
407
|
children: [
|
|
385
|
-
e && /* @__PURE__ */
|
|
408
|
+
e && /* @__PURE__ */ T("span", {
|
|
386
409
|
"aria-hidden": !0,
|
|
387
410
|
className: "text-muted-foreground flex shrink-0",
|
|
388
411
|
children: e
|
|
389
412
|
}),
|
|
390
|
-
|
|
391
|
-
/* @__PURE__ */
|
|
413
|
+
o,
|
|
414
|
+
/* @__PURE__ */ T(n, {
|
|
392
415
|
"aria-hidden": !0,
|
|
393
416
|
className: "text-muted-foreground ms-auto size-4 shrink-0 rtl:-scale-x-100"
|
|
394
417
|
})
|
|
395
418
|
]
|
|
396
419
|
});
|
|
397
420
|
}
|
|
398
|
-
function
|
|
399
|
-
let
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
421
|
+
function se({ offset: t = 8, ref: a, className: o, style: c, onKeyDown: l, onPointerEnter: u, onPointerLeave: d, children: f, ...p }) {
|
|
422
|
+
let m = Z("MenuSubContent"), g = s(m.popup.popupRef, a), _ = G(), y = v(M), b = e();
|
|
423
|
+
P(m.popup.popupRef, y && m.popup.open);
|
|
424
|
+
let x = () => {
|
|
425
|
+
m.popup.setOpen(!1), m.triggerRef.current?.focus();
|
|
426
|
+
};
|
|
427
|
+
return /* @__PURE__ */ E("div", {
|
|
428
|
+
"aria-labelledby": m.triggerId,
|
|
429
|
+
...p,
|
|
430
|
+
...m.popup.popupProps,
|
|
431
|
+
ref: g,
|
|
405
432
|
role: "menu",
|
|
406
433
|
tabIndex: -1,
|
|
407
434
|
"data-zen-beside": "",
|
|
435
|
+
"data-zen-sheet": y || void 0,
|
|
408
436
|
onKeyDown: (e) => {
|
|
409
|
-
|
|
437
|
+
l?.(e), !e.defaultPrevented && (_(e), e.target.closest("[role=\"menu\"]") === e.currentTarget && i(e.key, e.currentTarget) === "ArrowLeft" && (e.preventDefault(), e.stopPropagation(), x()));
|
|
410
438
|
},
|
|
411
439
|
onPointerEnter: (e) => {
|
|
412
|
-
|
|
440
|
+
u?.(e), m.stay();
|
|
413
441
|
},
|
|
414
442
|
onPointerLeave: (e) => {
|
|
415
|
-
|
|
443
|
+
d?.(e), Q(e, m.triggerRef.current?.closest("[role=\"menu\"]") ?? null) && !m.triggerRef.current?.contains(e.relatedTarget) && !N(e.currentTarget) && m.hideSoon();
|
|
416
444
|
},
|
|
417
445
|
style: {
|
|
418
|
-
...
|
|
446
|
+
...h(m.popup.id, {
|
|
419
447
|
side: "beside",
|
|
420
|
-
offset:
|
|
448
|
+
offset: t
|
|
421
449
|
}),
|
|
422
450
|
marginBlock: -6,
|
|
423
|
-
...
|
|
451
|
+
...c
|
|
424
452
|
},
|
|
425
|
-
className:
|
|
426
|
-
children:
|
|
453
|
+
className: r("zen__popover glass glass-blur text-foreground min-w-44 rounded-xl p-1.5 outline-hidden", o),
|
|
454
|
+
children: [y && /* @__PURE__ */ E(w, { children: [
|
|
455
|
+
/* @__PURE__ */ T(B, {}),
|
|
456
|
+
/* @__PURE__ */ E("button", {
|
|
457
|
+
type: "button",
|
|
458
|
+
role: "menuitem",
|
|
459
|
+
tabIndex: -1,
|
|
460
|
+
"aria-label": b.back,
|
|
461
|
+
onClick: x,
|
|
462
|
+
className: r(K, "zen__sheet-only text-muted-foreground font-medium"),
|
|
463
|
+
children: [/* @__PURE__ */ T(n, {
|
|
464
|
+
"aria-hidden": !0,
|
|
465
|
+
className: "size-4 shrink-0 -scale-x-100 rtl:scale-x-100"
|
|
466
|
+
}), m.label]
|
|
467
|
+
}),
|
|
468
|
+
/* @__PURE__ */ T($, { className: "zen__sheet-only" })
|
|
469
|
+
] }), f]
|
|
427
470
|
});
|
|
428
471
|
}
|
|
429
|
-
function
|
|
430
|
-
let
|
|
431
|
-
return
|
|
472
|
+
function ce({ ref: e, className: t, onKeyDown: n, children: i, ...a }) {
|
|
473
|
+
let o = S(null), l = s(o, e), [d] = C(() => /* @__PURE__ */ new Map());
|
|
474
|
+
return u(o, A), /* @__PURE__ */ T(k.Provider, {
|
|
432
475
|
value: d,
|
|
433
|
-
children: /* @__PURE__ */
|
|
476
|
+
children: /* @__PURE__ */ T("div", {
|
|
434
477
|
role: "menubar",
|
|
435
478
|
...a,
|
|
436
|
-
ref:
|
|
479
|
+
ref: l,
|
|
437
480
|
"data-zen-roving": "",
|
|
438
481
|
onKeyDown: (e) => {
|
|
439
|
-
|
|
482
|
+
n?.(e), c(e, A);
|
|
440
483
|
},
|
|
441
|
-
className:
|
|
484
|
+
className: r("zen__menubar glow-edge border-tint/10 bg-tint/[0.03] relative flex w-fit items-center gap-0.5 rounded-xl border p-1", t),
|
|
442
485
|
children: i
|
|
443
486
|
})
|
|
444
487
|
});
|
|
445
488
|
}
|
|
446
|
-
var
|
|
447
|
-
function
|
|
448
|
-
return /* @__PURE__ */
|
|
489
|
+
var le = "text-muted-foreground hover:text-foreground focus-ring h-8 rounded-lg px-3 text-sm transition-colors outline-hidden data-popup-open:bg-tint/[0.07] data-popup-open:text-foreground";
|
|
490
|
+
function $({ className: e }) {
|
|
491
|
+
return /* @__PURE__ */ T("div", {
|
|
449
492
|
role: "separator",
|
|
450
|
-
className:
|
|
493
|
+
className: r("bg-tint/[0.07] mx-2 my-1 h-px", e)
|
|
451
494
|
});
|
|
452
495
|
}
|
|
453
|
-
function
|
|
454
|
-
return /* @__PURE__ */
|
|
455
|
-
className:
|
|
496
|
+
function ue({ className: e, ...t }) {
|
|
497
|
+
return /* @__PURE__ */ T("div", {
|
|
498
|
+
className: r("flex items-center gap-3 px-3 py-2.5", e),
|
|
456
499
|
...t
|
|
457
500
|
});
|
|
458
501
|
}
|
|
459
502
|
//#endregion
|
|
460
|
-
export {
|
|
503
|
+
export { ee as MenuCheckboxItem, z as MenuContent, U as MenuContextTrigger, ue as MenuHeader, q as MenuItem, te as MenuRadioGroup, ne as MenuRadioItem, $ as MenuSeparator, ae as MenuSub, se as MenuSubContent, oe as MenuSubTrigger, R as MenuTrigger, ce as Menubar, L as default };
|