@react-pdf-kit/viewer 2.0.1-rc.4 → 2.0.1-rc.6
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/{Combination-136ff99c.js → Combination-17ab8af1.js} +2 -2
- package/dist/assets/style.css +1 -1
- package/dist/components/layout/RPDefaultLayout.js +6 -6
- package/dist/components/layout/RPLayout.js +6 -6
- package/dist/components/layout/sidebar/RPSidebar.js +4 -4
- package/dist/components/layout/toolbar/DarkModeTool.js +4 -4
- package/dist/components/layout/toolbar/DocumentDialog.js +3 -3
- package/dist/components/layout/toolbar/DocumentProperties.js +6 -6
- package/dist/components/layout/toolbar/FileDownloadTool.js +6 -6
- package/dist/components/layout/toolbar/FileUploadTool.js +6 -6
- package/dist/components/layout/toolbar/FullScreenTool.js +6 -6
- package/dist/components/layout/toolbar/MenuItem.js +6 -6
- package/dist/components/layout/toolbar/MenuSeparator.js +6 -6
- package/dist/components/layout/toolbar/MostPageTool.js +6 -6
- package/dist/components/layout/toolbar/OtherTool.js +6 -6
- package/dist/components/layout/toolbar/Paginate.js +4 -4
- package/dist/components/layout/toolbar/PrintTool.js +6 -6
- package/dist/components/layout/toolbar/RPMenuItem.js +6 -6
- package/dist/components/layout/toolbar/RPMoreOptions.js +6 -6
- package/dist/components/layout/toolbar/RPToolbar.js +6 -6
- package/dist/components/layout/toolbar/RPToolbarEnd.js +6 -6
- package/dist/components/layout/toolbar/RotateTool.js +6 -6
- package/dist/components/layout/toolbar/ScrollModeTool.js +6 -6
- package/dist/components/layout/toolbar/SearchCloseButton.js +4 -4
- package/dist/components/layout/toolbar/SearchResultNavigator.js +4 -4
- package/dist/components/layout/toolbar/SearchTool.js +6 -6
- package/dist/components/layout/toolbar/SelectionModeTool.js +6 -6
- package/dist/components/layout/toolbar/ThumbnailTool.js +4 -4
- package/dist/components/layout/toolbar/ToolbarDefault.js +6 -6
- package/dist/components/layout/toolbar/ToolbarLayout.js +6 -6
- package/dist/components/layout/toolbar/ViewModeTool.js +6 -6
- package/dist/components/layout/toolbar/ZoomTool.js +6 -6
- package/dist/components/layout/toolbar/tools/DocumentPropertiesTool.js +5 -5
- package/dist/components/layout/toolbar/tools/DualPageTool.js +4 -4
- package/dist/components/layout/toolbar/tools/DualPageWithCoverTool.js +6 -6
- package/dist/components/layout/toolbar/tools/FileDownloadTool.js +4 -4
- package/dist/components/layout/toolbar/tools/FileUploadTool.js +4 -4
- package/dist/components/layout/toolbar/tools/FirstPageTool.js +6 -6
- package/dist/components/layout/toolbar/tools/FullScreenTool.js +4 -4
- package/dist/components/layout/toolbar/tools/HorizontalScrollingTool.js +4 -4
- package/dist/components/layout/toolbar/tools/InputPageTool.js +4 -4
- package/dist/components/layout/toolbar/tools/LastPageTool.js +6 -6
- package/dist/components/layout/toolbar/tools/NextPageTool.js +4 -4
- package/dist/components/layout/toolbar/tools/PageScrollingTool.js +4 -4
- package/dist/components/layout/toolbar/tools/PreviousPageTool.js +4 -4
- package/dist/components/layout/toolbar/tools/PrintTool.js +4 -4
- package/dist/components/layout/toolbar/tools/RotateClockwiseTool.js +4 -4
- package/dist/components/layout/toolbar/tools/RotateCounterclockwiseTool.js +4 -4
- package/dist/components/layout/toolbar/tools/SelectionModeSwitcherTool.js +4 -4
- package/dist/components/layout/toolbar/tools/SinglePageTool.js +4 -4
- package/dist/components/layout/toolbar/tools/ThemeSwitcherTool.js +4 -4
- package/dist/components/layout/toolbar/tools/ThumbnailTool.js +4 -4
- package/dist/components/layout/toolbar/tools/VerticalScrollingTool.js +4 -4
- package/dist/components/layout/toolbar/tools/ZoomInTool.js +4 -4
- package/dist/components/layout/toolbar/tools/ZoomLevelTool.js +6 -6
- package/dist/components/layout/toolbar/tools/ZoomOutTool.js +4 -4
- package/dist/components/layout/toolbar/tools/defaults/RPHorizontalBar.js +6 -6
- package/dist/components/layout/toolbar/tools/defaults/RPVerticalBar.js +4 -4
- package/dist/components/layout/toolbar/tools/more-options/DocumentProperties.js +6 -6
- package/dist/components/layout/toolbar/tools/more-options/FileDownloadTool.js +6 -6
- package/dist/components/layout/toolbar/tools/more-options/FileUploadTool.js +6 -6
- package/dist/components/layout/toolbar/tools/more-options/FullScreenTool.js +6 -6
- package/dist/components/layout/toolbar/tools/more-options/MostPageTool.js +6 -6
- package/dist/components/layout/toolbar/tools/more-options/PrintTool.js +6 -6
- package/dist/components/layout/toolbar/tools/more-options/RotateTool.js +6 -6
- package/dist/components/layout/toolbar/tools/more-options/ScrollModeTool.js +6 -6
- package/dist/components/layout/toolbar/tools/more-options/SelectionModeTool.js +6 -6
- package/dist/components/layout/toolbar/tools/more-options/ViewModeTool.js +6 -6
- package/dist/components/ui/Checkbox.js +2 -2
- package/dist/components/ui/DropDown.js +6 -6
- package/dist/components/ui/RPTooltip.js +197 -411
- package/dist/{index-c0faa594.js → index-113053cf.js} +2 -2
- package/dist/index-11f3cd64.js +983 -0
- package/dist/{index-e3ee9457.js → index-23911b43.js} +6 -6
- package/dist/{index-655864a7.js → index-ada501c4.js} +1 -1
- package/dist/index-d0f0aa9a.js +1542 -0
- package/dist/main.js +6 -6
- package/dist/utils/hooks/useLicense.js +1 -1
- package/dist/utils/hooks/usePrint.js +21 -21
- package/dist/utils/injectPrintCSS.js +10 -9
- package/package.json +1 -1
- package/dist/floating-ui.react-dom-5ec29bd6.js +0 -1327
- package/dist/index-61f59539.js +0 -1198
|
@@ -0,0 +1,983 @@
|
|
|
1
|
+
import * as a from "react";
|
|
2
|
+
import K from "react";
|
|
3
|
+
import { c as re, a as k, g as pe, f as ye, P as L, b as g, d as ae, j as Te, i as _n } from "./index-113053cf.js";
|
|
4
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
5
|
+
import { a as ge, u as me, D as Rn } from "./index-23911b43.js";
|
|
6
|
+
import { h as In, u as En, F as Sn, R as bn, P as Pn } from "./Combination-17ab8af1.js";
|
|
7
|
+
import { c as xe, A as Dn, C as yn, a as Tn, R as xn } from "./index-d0f0aa9a.js";
|
|
8
|
+
function Ae(e) {
|
|
9
|
+
const o = e + "CollectionProvider", [n, t] = re(o), [r, c] = n(
|
|
10
|
+
o,
|
|
11
|
+
{ collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
|
|
12
|
+
), l = (R) => {
|
|
13
|
+
const { scope: M, children: _ } = R, E = K.useRef(null), h = K.useRef(/* @__PURE__ */ new Map()).current;
|
|
14
|
+
return /* @__PURE__ */ s(r, { scope: M, itemMap: h, collectionRef: E, children: _ });
|
|
15
|
+
};
|
|
16
|
+
l.displayName = o;
|
|
17
|
+
const d = e + "CollectionSlot", v = pe(d), m = K.forwardRef(
|
|
18
|
+
(R, M) => {
|
|
19
|
+
const { scope: _, children: E } = R, h = c(d, _), I = k(M, h.collectionRef);
|
|
20
|
+
return /* @__PURE__ */ s(v, { ref: I, children: E });
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
m.displayName = d;
|
|
24
|
+
const i = e + "CollectionItemSlot", u = "data-radix-collection-item", f = pe(i), C = K.forwardRef(
|
|
25
|
+
(R, M) => {
|
|
26
|
+
const { scope: _, children: E, ...h } = R, I = K.useRef(null), O = k(M, I), T = c(i, _);
|
|
27
|
+
return K.useEffect(() => (T.itemMap.set(I, { ref: I, ...h }), () => void T.itemMap.delete(I))), /* @__PURE__ */ s(f, { [u]: "", ref: O, children: E });
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
C.displayName = i;
|
|
31
|
+
function w(R) {
|
|
32
|
+
const M = c(e + "CollectionConsumer", R);
|
|
33
|
+
return K.useCallback(() => {
|
|
34
|
+
const E = M.collectionRef.current;
|
|
35
|
+
if (!E)
|
|
36
|
+
return [];
|
|
37
|
+
const h = Array.from(E.querySelectorAll(`[${u}]`));
|
|
38
|
+
return Array.from(M.itemMap.values()).sort(
|
|
39
|
+
(T, x) => h.indexOf(T.ref.current) - h.indexOf(x.ref.current)
|
|
40
|
+
);
|
|
41
|
+
}, [M.collectionRef, M.itemMap]);
|
|
42
|
+
}
|
|
43
|
+
return [
|
|
44
|
+
{ Provider: l, Slot: m, ItemSlot: C },
|
|
45
|
+
w,
|
|
46
|
+
t
|
|
47
|
+
];
|
|
48
|
+
}
|
|
49
|
+
var An = a.createContext(void 0);
|
|
50
|
+
function Ne(e) {
|
|
51
|
+
const o = a.useContext(An);
|
|
52
|
+
return e || o || "ltr";
|
|
53
|
+
}
|
|
54
|
+
var fe = "rovingFocusGroup.onEntryFocus", Nn = { bubbles: !1, cancelable: !0 }, Z = "RovingFocusGroup", [ve, Oe, On] = Ae(Z), [Fn, Fe] = re(
|
|
55
|
+
Z,
|
|
56
|
+
[On]
|
|
57
|
+
), [kn, Ln] = Fn(Z), ke = a.forwardRef(
|
|
58
|
+
(e, o) => /* @__PURE__ */ s(ve.Provider, { scope: e.__scopeRovingFocusGroup, children: /* @__PURE__ */ s(ve.Slot, { scope: e.__scopeRovingFocusGroup, children: /* @__PURE__ */ s(Gn, { ...e, ref: o }) }) })
|
|
59
|
+
);
|
|
60
|
+
ke.displayName = Z;
|
|
61
|
+
var Gn = a.forwardRef((e, o) => {
|
|
62
|
+
const {
|
|
63
|
+
__scopeRovingFocusGroup: n,
|
|
64
|
+
orientation: t,
|
|
65
|
+
loop: r = !1,
|
|
66
|
+
dir: c,
|
|
67
|
+
currentTabStopId: l,
|
|
68
|
+
defaultCurrentTabStopId: d,
|
|
69
|
+
onCurrentTabStopIdChange: v,
|
|
70
|
+
onEntryFocus: m,
|
|
71
|
+
preventScrollOnEntryFocus: i = !1,
|
|
72
|
+
...u
|
|
73
|
+
} = e, f = a.useRef(null), C = k(o, f), w = Ne(c), [R, M] = ye({
|
|
74
|
+
prop: l,
|
|
75
|
+
defaultProp: d ?? null,
|
|
76
|
+
onChange: v,
|
|
77
|
+
caller: Z
|
|
78
|
+
}), [_, E] = a.useState(!1), h = ge(m), I = Oe(n), O = a.useRef(!1), [T, x] = a.useState(0);
|
|
79
|
+
return a.useEffect(() => {
|
|
80
|
+
const S = f.current;
|
|
81
|
+
if (S)
|
|
82
|
+
return S.addEventListener(fe, h), () => S.removeEventListener(fe, h);
|
|
83
|
+
}, [h]), /* @__PURE__ */ s(
|
|
84
|
+
kn,
|
|
85
|
+
{
|
|
86
|
+
scope: n,
|
|
87
|
+
orientation: t,
|
|
88
|
+
dir: w,
|
|
89
|
+
loop: r,
|
|
90
|
+
currentTabStopId: R,
|
|
91
|
+
onItemFocus: a.useCallback(
|
|
92
|
+
(S) => M(S),
|
|
93
|
+
[M]
|
|
94
|
+
),
|
|
95
|
+
onItemShiftTab: a.useCallback(() => E(!0), []),
|
|
96
|
+
onFocusableItemAdd: a.useCallback(
|
|
97
|
+
() => x((S) => S + 1),
|
|
98
|
+
[]
|
|
99
|
+
),
|
|
100
|
+
onFocusableItemRemove: a.useCallback(
|
|
101
|
+
() => x((S) => S - 1),
|
|
102
|
+
[]
|
|
103
|
+
),
|
|
104
|
+
children: /* @__PURE__ */ s(
|
|
105
|
+
L.div,
|
|
106
|
+
{
|
|
107
|
+
tabIndex: _ || T === 0 ? -1 : 0,
|
|
108
|
+
"data-orientation": t,
|
|
109
|
+
...u,
|
|
110
|
+
ref: C,
|
|
111
|
+
style: { outline: "none", ...e.style },
|
|
112
|
+
onMouseDown: g(e.onMouseDown, () => {
|
|
113
|
+
O.current = !0;
|
|
114
|
+
}),
|
|
115
|
+
onFocus: g(e.onFocus, (S) => {
|
|
116
|
+
const B = !O.current;
|
|
117
|
+
if (S.target === S.currentTarget && B && !_) {
|
|
118
|
+
const G = new CustomEvent(fe, Nn);
|
|
119
|
+
if (S.currentTarget.dispatchEvent(G), !G.defaultPrevented) {
|
|
120
|
+
const X = I().filter((A) => A.focusable), j = X.find((A) => A.active), ee = X.find((A) => A.id === R), ie = [j, ee, ...X].filter(
|
|
121
|
+
Boolean
|
|
122
|
+
).map((A) => A.ref.current);
|
|
123
|
+
Ke(ie, i);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
O.current = !1;
|
|
127
|
+
}),
|
|
128
|
+
onBlur: g(e.onBlur, () => E(!1))
|
|
129
|
+
}
|
|
130
|
+
)
|
|
131
|
+
}
|
|
132
|
+
);
|
|
133
|
+
}), Le = "RovingFocusGroupItem", Ge = a.forwardRef(
|
|
134
|
+
(e, o) => {
|
|
135
|
+
const {
|
|
136
|
+
__scopeRovingFocusGroup: n,
|
|
137
|
+
focusable: t = !0,
|
|
138
|
+
active: r = !1,
|
|
139
|
+
tabStopId: c,
|
|
140
|
+
children: l,
|
|
141
|
+
...d
|
|
142
|
+
} = e, v = me(), m = c || v, i = Ln(Le, n), u = i.currentTabStopId === m, f = Oe(n), { onFocusableItemAdd: C, onFocusableItemRemove: w, currentTabStopId: R } = i;
|
|
143
|
+
return a.useEffect(() => {
|
|
144
|
+
if (t)
|
|
145
|
+
return C(), () => w();
|
|
146
|
+
}, [t, C, w]), /* @__PURE__ */ s(
|
|
147
|
+
ve.ItemSlot,
|
|
148
|
+
{
|
|
149
|
+
scope: n,
|
|
150
|
+
id: m,
|
|
151
|
+
focusable: t,
|
|
152
|
+
active: r,
|
|
153
|
+
children: /* @__PURE__ */ s(
|
|
154
|
+
L.span,
|
|
155
|
+
{
|
|
156
|
+
tabIndex: u ? 0 : -1,
|
|
157
|
+
"data-orientation": i.orientation,
|
|
158
|
+
...d,
|
|
159
|
+
ref: o,
|
|
160
|
+
onMouseDown: g(e.onMouseDown, (M) => {
|
|
161
|
+
t ? i.onItemFocus(m) : M.preventDefault();
|
|
162
|
+
}),
|
|
163
|
+
onFocus: g(e.onFocus, () => i.onItemFocus(m)),
|
|
164
|
+
onKeyDown: g(e.onKeyDown, (M) => {
|
|
165
|
+
if (M.key === "Tab" && M.shiftKey) {
|
|
166
|
+
i.onItemShiftTab();
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
if (M.target !== M.currentTarget)
|
|
170
|
+
return;
|
|
171
|
+
const _ = $n(M, i.orientation, i.dir);
|
|
172
|
+
if (_ !== void 0) {
|
|
173
|
+
if (M.metaKey || M.ctrlKey || M.altKey || M.shiftKey)
|
|
174
|
+
return;
|
|
175
|
+
M.preventDefault();
|
|
176
|
+
let h = f().filter((I) => I.focusable).map((I) => I.ref.current);
|
|
177
|
+
if (_ === "last")
|
|
178
|
+
h.reverse();
|
|
179
|
+
else if (_ === "prev" || _ === "next") {
|
|
180
|
+
_ === "prev" && h.reverse();
|
|
181
|
+
const I = h.indexOf(M.currentTarget);
|
|
182
|
+
h = i.loop ? Bn(h, I + 1) : h.slice(I + 1);
|
|
183
|
+
}
|
|
184
|
+
setTimeout(() => Ke(h));
|
|
185
|
+
}
|
|
186
|
+
}),
|
|
187
|
+
children: typeof l == "function" ? l({ isCurrentTabStop: u, hasTabStop: R != null }) : l
|
|
188
|
+
}
|
|
189
|
+
)
|
|
190
|
+
}
|
|
191
|
+
);
|
|
192
|
+
}
|
|
193
|
+
);
|
|
194
|
+
Ge.displayName = Le;
|
|
195
|
+
var Kn = {
|
|
196
|
+
ArrowLeft: "prev",
|
|
197
|
+
ArrowUp: "prev",
|
|
198
|
+
ArrowRight: "next",
|
|
199
|
+
ArrowDown: "next",
|
|
200
|
+
PageUp: "first",
|
|
201
|
+
Home: "first",
|
|
202
|
+
PageDown: "last",
|
|
203
|
+
End: "last"
|
|
204
|
+
};
|
|
205
|
+
function Un(e, o) {
|
|
206
|
+
return o !== "rtl" ? e : e === "ArrowLeft" ? "ArrowRight" : e === "ArrowRight" ? "ArrowLeft" : e;
|
|
207
|
+
}
|
|
208
|
+
function $n(e, o, n) {
|
|
209
|
+
const t = Un(e.key, n);
|
|
210
|
+
if (!(o === "vertical" && ["ArrowLeft", "ArrowRight"].includes(t)) && !(o === "horizontal" && ["ArrowUp", "ArrowDown"].includes(t)))
|
|
211
|
+
return Kn[t];
|
|
212
|
+
}
|
|
213
|
+
function Ke(e, o = !1) {
|
|
214
|
+
const n = document.activeElement;
|
|
215
|
+
for (const t of e)
|
|
216
|
+
if (t === n || (t.focus({ preventScroll: o }), document.activeElement !== n))
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
function Bn(e, o) {
|
|
220
|
+
return e.map((n, t) => e[(o + t) % e.length]);
|
|
221
|
+
}
|
|
222
|
+
var Vn = ke, Yn = Ge, Me = ["Enter", " "], Xn = ["ArrowDown", "PageUp", "Home"], Ue = ["ArrowUp", "PageDown", "End"], jn = [...Xn, ...Ue], Hn = {
|
|
223
|
+
ltr: [...Me, "ArrowRight"],
|
|
224
|
+
rtl: [...Me, "ArrowLeft"]
|
|
225
|
+
}, Wn = {
|
|
226
|
+
ltr: ["ArrowLeft"],
|
|
227
|
+
rtl: ["ArrowRight"]
|
|
228
|
+
}, J = "Menu", [z, zn, qn] = Ae(J), [U, $e] = re(J, [
|
|
229
|
+
qn,
|
|
230
|
+
xe,
|
|
231
|
+
Fe
|
|
232
|
+
]), ce = xe(), Be = Fe(), [Zn, $] = U(J), [Jn, Q] = U(J), Ve = (e) => {
|
|
233
|
+
const { __scopeMenu: o, open: n = !1, children: t, dir: r, onOpenChange: c, modal: l = !0 } = e, d = ce(o), [v, m] = a.useState(null), i = a.useRef(!1), u = ge(c), f = Ne(r);
|
|
234
|
+
return a.useEffect(() => {
|
|
235
|
+
const C = () => {
|
|
236
|
+
i.current = !0, document.addEventListener("pointerdown", w, { capture: !0, once: !0 }), document.addEventListener("pointermove", w, { capture: !0, once: !0 });
|
|
237
|
+
}, w = () => i.current = !1;
|
|
238
|
+
return document.addEventListener("keydown", C, { capture: !0 }), () => {
|
|
239
|
+
document.removeEventListener("keydown", C, { capture: !0 }), document.removeEventListener("pointerdown", w, { capture: !0 }), document.removeEventListener("pointermove", w, { capture: !0 });
|
|
240
|
+
};
|
|
241
|
+
}, []), /* @__PURE__ */ s(xn, { ...d, children: /* @__PURE__ */ s(
|
|
242
|
+
Zn,
|
|
243
|
+
{
|
|
244
|
+
scope: o,
|
|
245
|
+
open: n,
|
|
246
|
+
onOpenChange: u,
|
|
247
|
+
content: v,
|
|
248
|
+
onContentChange: m,
|
|
249
|
+
children: /* @__PURE__ */ s(
|
|
250
|
+
Jn,
|
|
251
|
+
{
|
|
252
|
+
scope: o,
|
|
253
|
+
onClose: a.useCallback(() => u(!1), [u]),
|
|
254
|
+
isUsingKeyboardRef: i,
|
|
255
|
+
dir: f,
|
|
256
|
+
modal: l,
|
|
257
|
+
children: t
|
|
258
|
+
}
|
|
259
|
+
)
|
|
260
|
+
}
|
|
261
|
+
) });
|
|
262
|
+
};
|
|
263
|
+
Ve.displayName = J;
|
|
264
|
+
var Qn = "MenuAnchor", we = a.forwardRef(
|
|
265
|
+
(e, o) => {
|
|
266
|
+
const { __scopeMenu: n, ...t } = e, r = ce(n);
|
|
267
|
+
return /* @__PURE__ */ s(Dn, { ...r, ...t, ref: o });
|
|
268
|
+
}
|
|
269
|
+
);
|
|
270
|
+
we.displayName = Qn;
|
|
271
|
+
var Ce = "MenuPortal", [eo, Ye] = U(Ce, {
|
|
272
|
+
forceMount: void 0
|
|
273
|
+
}), Xe = (e) => {
|
|
274
|
+
const { __scopeMenu: o, forceMount: n, children: t, container: r } = e, c = $(Ce, o);
|
|
275
|
+
return /* @__PURE__ */ s(eo, { scope: o, forceMount: n, children: /* @__PURE__ */ s(ae, { present: n || c.open, children: /* @__PURE__ */ s(Pn, { asChild: !0, container: r, children: t }) }) });
|
|
276
|
+
};
|
|
277
|
+
Xe.displayName = Ce;
|
|
278
|
+
var D = "MenuContent", [no, he] = U(D), je = a.forwardRef(
|
|
279
|
+
(e, o) => {
|
|
280
|
+
const n = Ye(D, e.__scopeMenu), { forceMount: t = n.forceMount, ...r } = e, c = $(D, e.__scopeMenu), l = Q(D, e.__scopeMenu);
|
|
281
|
+
return /* @__PURE__ */ s(z.Provider, { scope: e.__scopeMenu, children: /* @__PURE__ */ s(ae, { present: t || c.open, children: /* @__PURE__ */ s(z.Slot, { scope: e.__scopeMenu, children: l.modal ? /* @__PURE__ */ s(oo, { ...r, ref: o }) : /* @__PURE__ */ s(to, { ...r, ref: o }) }) }) });
|
|
282
|
+
}
|
|
283
|
+
), oo = a.forwardRef(
|
|
284
|
+
(e, o) => {
|
|
285
|
+
const n = $(D, e.__scopeMenu), t = a.useRef(null), r = k(o, t);
|
|
286
|
+
return a.useEffect(() => {
|
|
287
|
+
const c = t.current;
|
|
288
|
+
if (c)
|
|
289
|
+
return In(c);
|
|
290
|
+
}, []), /* @__PURE__ */ s(
|
|
291
|
+
_e,
|
|
292
|
+
{
|
|
293
|
+
...e,
|
|
294
|
+
ref: r,
|
|
295
|
+
trapFocus: n.open,
|
|
296
|
+
disableOutsidePointerEvents: n.open,
|
|
297
|
+
disableOutsideScroll: !0,
|
|
298
|
+
onFocusOutside: g(
|
|
299
|
+
e.onFocusOutside,
|
|
300
|
+
(c) => c.preventDefault(),
|
|
301
|
+
{ checkForDefaultPrevented: !1 }
|
|
302
|
+
),
|
|
303
|
+
onDismiss: () => n.onOpenChange(!1)
|
|
304
|
+
}
|
|
305
|
+
);
|
|
306
|
+
}
|
|
307
|
+
), to = a.forwardRef((e, o) => {
|
|
308
|
+
const n = $(D, e.__scopeMenu);
|
|
309
|
+
return /* @__PURE__ */ s(
|
|
310
|
+
_e,
|
|
311
|
+
{
|
|
312
|
+
...e,
|
|
313
|
+
ref: o,
|
|
314
|
+
trapFocus: !1,
|
|
315
|
+
disableOutsidePointerEvents: !1,
|
|
316
|
+
disableOutsideScroll: !1,
|
|
317
|
+
onDismiss: () => n.onOpenChange(!1)
|
|
318
|
+
}
|
|
319
|
+
);
|
|
320
|
+
}), ro = pe("MenuContent.ScrollLock"), _e = a.forwardRef(
|
|
321
|
+
(e, o) => {
|
|
322
|
+
const {
|
|
323
|
+
__scopeMenu: n,
|
|
324
|
+
loop: t = !1,
|
|
325
|
+
trapFocus: r,
|
|
326
|
+
onOpenAutoFocus: c,
|
|
327
|
+
onCloseAutoFocus: l,
|
|
328
|
+
disableOutsidePointerEvents: d,
|
|
329
|
+
onEntryFocus: v,
|
|
330
|
+
onEscapeKeyDown: m,
|
|
331
|
+
onPointerDownOutside: i,
|
|
332
|
+
onFocusOutside: u,
|
|
333
|
+
onInteractOutside: f,
|
|
334
|
+
onDismiss: C,
|
|
335
|
+
disableOutsideScroll: w,
|
|
336
|
+
...R
|
|
337
|
+
} = e, M = $(D, n), _ = Q(D, n), E = ce(n), h = Be(n), I = zn(n), [O, T] = a.useState(null), x = a.useRef(null), S = k(o, x, M.onContentChange), B = a.useRef(0), G = a.useRef(""), X = a.useRef(0), j = a.useRef(null), ee = a.useRef("right"), ne = a.useRef(0), ie = w ? bn : a.Fragment, A = w ? { as: ro, allowPinchZoom: !0 } : void 0, hn = (p) => {
|
|
338
|
+
var Y, be;
|
|
339
|
+
const P = G.current + p, y = I().filter((N) => !N.disabled), F = document.activeElement, le = (Y = y.find((N) => N.ref.current === F)) == null ? void 0 : Y.textValue, de = y.map((N) => N.textValue), Se = go(de, P, le), H = (be = y.find((N) => N.textValue === Se)) == null ? void 0 : be.ref.current;
|
|
340
|
+
(function N(Pe) {
|
|
341
|
+
G.current = Pe, window.clearTimeout(B.current), Pe !== "" && (B.current = window.setTimeout(() => N(""), 1e3));
|
|
342
|
+
})(P), H && setTimeout(() => H.focus());
|
|
343
|
+
};
|
|
344
|
+
a.useEffect(() => () => window.clearTimeout(B.current), []), En();
|
|
345
|
+
const V = a.useCallback((p) => {
|
|
346
|
+
var y, F;
|
|
347
|
+
return ee.current === ((y = j.current) == null ? void 0 : y.side) && Co(p, (F = j.current) == null ? void 0 : F.area);
|
|
348
|
+
}, []);
|
|
349
|
+
return /* @__PURE__ */ s(
|
|
350
|
+
no,
|
|
351
|
+
{
|
|
352
|
+
scope: n,
|
|
353
|
+
searchRef: G,
|
|
354
|
+
onItemEnter: a.useCallback(
|
|
355
|
+
(p) => {
|
|
356
|
+
V(p) && p.preventDefault();
|
|
357
|
+
},
|
|
358
|
+
[V]
|
|
359
|
+
),
|
|
360
|
+
onItemLeave: a.useCallback(
|
|
361
|
+
(p) => {
|
|
362
|
+
var P;
|
|
363
|
+
V(p) || ((P = x.current) == null || P.focus(), T(null));
|
|
364
|
+
},
|
|
365
|
+
[V]
|
|
366
|
+
),
|
|
367
|
+
onTriggerLeave: a.useCallback(
|
|
368
|
+
(p) => {
|
|
369
|
+
V(p) && p.preventDefault();
|
|
370
|
+
},
|
|
371
|
+
[V]
|
|
372
|
+
),
|
|
373
|
+
pointerGraceTimerRef: X,
|
|
374
|
+
onPointerGraceIntentChange: a.useCallback((p) => {
|
|
375
|
+
j.current = p;
|
|
376
|
+
}, []),
|
|
377
|
+
children: /* @__PURE__ */ s(ie, { ...A, children: /* @__PURE__ */ s(
|
|
378
|
+
Sn,
|
|
379
|
+
{
|
|
380
|
+
asChild: !0,
|
|
381
|
+
trapped: r,
|
|
382
|
+
onMountAutoFocus: g(c, (p) => {
|
|
383
|
+
var P;
|
|
384
|
+
p.preventDefault(), (P = x.current) == null || P.focus({ preventScroll: !0 });
|
|
385
|
+
}),
|
|
386
|
+
onUnmountAutoFocus: l,
|
|
387
|
+
children: /* @__PURE__ */ s(
|
|
388
|
+
Rn,
|
|
389
|
+
{
|
|
390
|
+
asChild: !0,
|
|
391
|
+
disableOutsidePointerEvents: d,
|
|
392
|
+
onEscapeKeyDown: m,
|
|
393
|
+
onPointerDownOutside: i,
|
|
394
|
+
onFocusOutside: u,
|
|
395
|
+
onInteractOutside: f,
|
|
396
|
+
onDismiss: C,
|
|
397
|
+
children: /* @__PURE__ */ s(
|
|
398
|
+
Vn,
|
|
399
|
+
{
|
|
400
|
+
asChild: !0,
|
|
401
|
+
...h,
|
|
402
|
+
dir: _.dir,
|
|
403
|
+
orientation: "vertical",
|
|
404
|
+
loop: t,
|
|
405
|
+
currentTabStopId: O,
|
|
406
|
+
onCurrentTabStopIdChange: T,
|
|
407
|
+
onEntryFocus: g(v, (p) => {
|
|
408
|
+
_.isUsingKeyboardRef.current || p.preventDefault();
|
|
409
|
+
}),
|
|
410
|
+
preventScrollOnEntryFocus: !0,
|
|
411
|
+
children: /* @__PURE__ */ s(
|
|
412
|
+
yn,
|
|
413
|
+
{
|
|
414
|
+
role: "menu",
|
|
415
|
+
"aria-orientation": "vertical",
|
|
416
|
+
"data-state": un(M.open),
|
|
417
|
+
"data-radix-menu-content": "",
|
|
418
|
+
dir: _.dir,
|
|
419
|
+
...E,
|
|
420
|
+
...R,
|
|
421
|
+
ref: S,
|
|
422
|
+
style: { outline: "none", ...R.style },
|
|
423
|
+
onKeyDown: g(R.onKeyDown, (p) => {
|
|
424
|
+
const y = p.target.closest("[data-radix-menu-content]") === p.currentTarget, F = p.ctrlKey || p.altKey || p.metaKey, le = p.key.length === 1;
|
|
425
|
+
y && (p.key === "Tab" && p.preventDefault(), !F && le && hn(p.key));
|
|
426
|
+
const de = x.current;
|
|
427
|
+
if (p.target !== de || !jn.includes(p.key))
|
|
428
|
+
return;
|
|
429
|
+
p.preventDefault();
|
|
430
|
+
const H = I().filter((Y) => !Y.disabled).map((Y) => Y.ref.current);
|
|
431
|
+
Ue.includes(p.key) && H.reverse(), vo(H);
|
|
432
|
+
}),
|
|
433
|
+
onBlur: g(e.onBlur, (p) => {
|
|
434
|
+
p.currentTarget.contains(p.target) || (window.clearTimeout(B.current), G.current = "");
|
|
435
|
+
}),
|
|
436
|
+
onPointerMove: g(
|
|
437
|
+
e.onPointerMove,
|
|
438
|
+
q((p) => {
|
|
439
|
+
const P = p.target, y = ne.current !== p.clientX;
|
|
440
|
+
if (p.currentTarget.contains(P) && y) {
|
|
441
|
+
const F = p.clientX > ne.current ? "right" : "left";
|
|
442
|
+
ee.current = F, ne.current = p.clientX;
|
|
443
|
+
}
|
|
444
|
+
})
|
|
445
|
+
)
|
|
446
|
+
}
|
|
447
|
+
)
|
|
448
|
+
}
|
|
449
|
+
)
|
|
450
|
+
}
|
|
451
|
+
)
|
|
452
|
+
}
|
|
453
|
+
) })
|
|
454
|
+
}
|
|
455
|
+
);
|
|
456
|
+
}
|
|
457
|
+
);
|
|
458
|
+
je.displayName = D;
|
|
459
|
+
var ao = "MenuGroup", Re = a.forwardRef(
|
|
460
|
+
(e, o) => {
|
|
461
|
+
const { __scopeMenu: n, ...t } = e;
|
|
462
|
+
return /* @__PURE__ */ s(L.div, { role: "group", ...t, ref: o });
|
|
463
|
+
}
|
|
464
|
+
);
|
|
465
|
+
Re.displayName = ao;
|
|
466
|
+
var co = "MenuLabel", He = a.forwardRef(
|
|
467
|
+
(e, o) => {
|
|
468
|
+
const { __scopeMenu: n, ...t } = e;
|
|
469
|
+
return /* @__PURE__ */ s(L.div, { ...t, ref: o });
|
|
470
|
+
}
|
|
471
|
+
);
|
|
472
|
+
He.displayName = co;
|
|
473
|
+
var oe = "MenuItem", De = "menu.itemSelect", se = a.forwardRef(
|
|
474
|
+
(e, o) => {
|
|
475
|
+
const { disabled: n = !1, onSelect: t, ...r } = e, c = a.useRef(null), l = Q(oe, e.__scopeMenu), d = he(oe, e.__scopeMenu), v = k(o, c), m = a.useRef(!1), i = () => {
|
|
476
|
+
const u = c.current;
|
|
477
|
+
if (!n && u) {
|
|
478
|
+
const f = new CustomEvent(De, { bubbles: !0, cancelable: !0 });
|
|
479
|
+
u.addEventListener(De, (C) => t == null ? void 0 : t(C), { once: !0 }), _n(u, f), f.defaultPrevented ? m.current = !1 : l.onClose();
|
|
480
|
+
}
|
|
481
|
+
};
|
|
482
|
+
return /* @__PURE__ */ s(
|
|
483
|
+
We,
|
|
484
|
+
{
|
|
485
|
+
...r,
|
|
486
|
+
ref: v,
|
|
487
|
+
disabled: n,
|
|
488
|
+
onClick: g(e.onClick, i),
|
|
489
|
+
onPointerDown: (u) => {
|
|
490
|
+
var f;
|
|
491
|
+
(f = e.onPointerDown) == null || f.call(e, u), m.current = !0;
|
|
492
|
+
},
|
|
493
|
+
onPointerUp: g(e.onPointerUp, (u) => {
|
|
494
|
+
var f;
|
|
495
|
+
m.current || (f = u.currentTarget) == null || f.click();
|
|
496
|
+
}),
|
|
497
|
+
onKeyDown: g(e.onKeyDown, (u) => {
|
|
498
|
+
const f = d.searchRef.current !== "";
|
|
499
|
+
n || f && u.key === " " || Me.includes(u.key) && (u.currentTarget.click(), u.preventDefault());
|
|
500
|
+
})
|
|
501
|
+
}
|
|
502
|
+
);
|
|
503
|
+
}
|
|
504
|
+
);
|
|
505
|
+
se.displayName = oe;
|
|
506
|
+
var We = a.forwardRef(
|
|
507
|
+
(e, o) => {
|
|
508
|
+
const { __scopeMenu: n, disabled: t = !1, textValue: r, ...c } = e, l = he(oe, n), d = Be(n), v = a.useRef(null), m = k(o, v), [i, u] = a.useState(!1), [f, C] = a.useState("");
|
|
509
|
+
return a.useEffect(() => {
|
|
510
|
+
const w = v.current;
|
|
511
|
+
w && C((w.textContent ?? "").trim());
|
|
512
|
+
}, [c.children]), /* @__PURE__ */ s(
|
|
513
|
+
z.ItemSlot,
|
|
514
|
+
{
|
|
515
|
+
scope: n,
|
|
516
|
+
disabled: t,
|
|
517
|
+
textValue: r ?? f,
|
|
518
|
+
children: /* @__PURE__ */ s(Yn, { asChild: !0, ...d, focusable: !t, children: /* @__PURE__ */ s(
|
|
519
|
+
L.div,
|
|
520
|
+
{
|
|
521
|
+
role: "menuitem",
|
|
522
|
+
"data-highlighted": i ? "" : void 0,
|
|
523
|
+
"aria-disabled": t || void 0,
|
|
524
|
+
"data-disabled": t ? "" : void 0,
|
|
525
|
+
...c,
|
|
526
|
+
ref: m,
|
|
527
|
+
onPointerMove: g(
|
|
528
|
+
e.onPointerMove,
|
|
529
|
+
q((w) => {
|
|
530
|
+
t ? l.onItemLeave(w) : (l.onItemEnter(w), w.defaultPrevented || w.currentTarget.focus({ preventScroll: !0 }));
|
|
531
|
+
})
|
|
532
|
+
),
|
|
533
|
+
onPointerLeave: g(
|
|
534
|
+
e.onPointerLeave,
|
|
535
|
+
q((w) => l.onItemLeave(w))
|
|
536
|
+
),
|
|
537
|
+
onFocus: g(e.onFocus, () => u(!0)),
|
|
538
|
+
onBlur: g(e.onBlur, () => u(!1))
|
|
539
|
+
}
|
|
540
|
+
) })
|
|
541
|
+
}
|
|
542
|
+
);
|
|
543
|
+
}
|
|
544
|
+
), so = "MenuCheckboxItem", ze = a.forwardRef(
|
|
545
|
+
(e, o) => {
|
|
546
|
+
const { checked: n = !1, onCheckedChange: t, ...r } = e;
|
|
547
|
+
return /* @__PURE__ */ s(en, { scope: e.__scopeMenu, checked: n, children: /* @__PURE__ */ s(
|
|
548
|
+
se,
|
|
549
|
+
{
|
|
550
|
+
role: "menuitemcheckbox",
|
|
551
|
+
"aria-checked": te(n) ? "mixed" : n,
|
|
552
|
+
...r,
|
|
553
|
+
ref: o,
|
|
554
|
+
"data-state": Ee(n),
|
|
555
|
+
onSelect: g(
|
|
556
|
+
r.onSelect,
|
|
557
|
+
() => t == null ? void 0 : t(te(n) ? !0 : !n),
|
|
558
|
+
{ checkForDefaultPrevented: !1 }
|
|
559
|
+
)
|
|
560
|
+
}
|
|
561
|
+
) });
|
|
562
|
+
}
|
|
563
|
+
);
|
|
564
|
+
ze.displayName = so;
|
|
565
|
+
var qe = "MenuRadioGroup", [uo, io] = U(
|
|
566
|
+
qe,
|
|
567
|
+
{ value: void 0, onValueChange: () => {
|
|
568
|
+
} }
|
|
569
|
+
), Ze = a.forwardRef(
|
|
570
|
+
(e, o) => {
|
|
571
|
+
const { value: n, onValueChange: t, ...r } = e, c = ge(t);
|
|
572
|
+
return /* @__PURE__ */ s(uo, { scope: e.__scopeMenu, value: n, onValueChange: c, children: /* @__PURE__ */ s(Re, { ...r, ref: o }) });
|
|
573
|
+
}
|
|
574
|
+
);
|
|
575
|
+
Ze.displayName = qe;
|
|
576
|
+
var Je = "MenuRadioItem", Qe = a.forwardRef(
|
|
577
|
+
(e, o) => {
|
|
578
|
+
const { value: n, ...t } = e, r = io(Je, e.__scopeMenu), c = n === r.value;
|
|
579
|
+
return /* @__PURE__ */ s(en, { scope: e.__scopeMenu, checked: c, children: /* @__PURE__ */ s(
|
|
580
|
+
se,
|
|
581
|
+
{
|
|
582
|
+
role: "menuitemradio",
|
|
583
|
+
"aria-checked": c,
|
|
584
|
+
...t,
|
|
585
|
+
ref: o,
|
|
586
|
+
"data-state": Ee(c),
|
|
587
|
+
onSelect: g(
|
|
588
|
+
t.onSelect,
|
|
589
|
+
() => {
|
|
590
|
+
var l;
|
|
591
|
+
return (l = r.onValueChange) == null ? void 0 : l.call(r, n);
|
|
592
|
+
},
|
|
593
|
+
{ checkForDefaultPrevented: !1 }
|
|
594
|
+
)
|
|
595
|
+
}
|
|
596
|
+
) });
|
|
597
|
+
}
|
|
598
|
+
);
|
|
599
|
+
Qe.displayName = Je;
|
|
600
|
+
var Ie = "MenuItemIndicator", [en, lo] = U(
|
|
601
|
+
Ie,
|
|
602
|
+
{ checked: !1 }
|
|
603
|
+
), nn = a.forwardRef(
|
|
604
|
+
(e, o) => {
|
|
605
|
+
const { __scopeMenu: n, forceMount: t, ...r } = e, c = lo(Ie, n);
|
|
606
|
+
return /* @__PURE__ */ s(
|
|
607
|
+
ae,
|
|
608
|
+
{
|
|
609
|
+
present: t || te(c.checked) || c.checked === !0,
|
|
610
|
+
children: /* @__PURE__ */ s(
|
|
611
|
+
L.span,
|
|
612
|
+
{
|
|
613
|
+
...r,
|
|
614
|
+
ref: o,
|
|
615
|
+
"data-state": Ee(c.checked)
|
|
616
|
+
}
|
|
617
|
+
)
|
|
618
|
+
}
|
|
619
|
+
);
|
|
620
|
+
}
|
|
621
|
+
);
|
|
622
|
+
nn.displayName = Ie;
|
|
623
|
+
var fo = "MenuSeparator", on = a.forwardRef(
|
|
624
|
+
(e, o) => {
|
|
625
|
+
const { __scopeMenu: n, ...t } = e;
|
|
626
|
+
return /* @__PURE__ */ s(
|
|
627
|
+
L.div,
|
|
628
|
+
{
|
|
629
|
+
role: "separator",
|
|
630
|
+
"aria-orientation": "horizontal",
|
|
631
|
+
...t,
|
|
632
|
+
ref: o
|
|
633
|
+
}
|
|
634
|
+
);
|
|
635
|
+
}
|
|
636
|
+
);
|
|
637
|
+
on.displayName = fo;
|
|
638
|
+
var po = "MenuArrow", tn = a.forwardRef(
|
|
639
|
+
(e, o) => {
|
|
640
|
+
const { __scopeMenu: n, ...t } = e, r = ce(n);
|
|
641
|
+
return /* @__PURE__ */ s(Tn, { ...r, ...t, ref: o });
|
|
642
|
+
}
|
|
643
|
+
);
|
|
644
|
+
tn.displayName = po;
|
|
645
|
+
var mo = "MenuSub", [it, rn] = U(mo), W = "MenuSubTrigger", an = a.forwardRef(
|
|
646
|
+
(e, o) => {
|
|
647
|
+
const n = $(W, e.__scopeMenu), t = Q(W, e.__scopeMenu), r = rn(W, e.__scopeMenu), c = he(W, e.__scopeMenu), l = a.useRef(null), { pointerGraceTimerRef: d, onPointerGraceIntentChange: v } = c, m = { __scopeMenu: e.__scopeMenu }, i = a.useCallback(() => {
|
|
648
|
+
l.current && window.clearTimeout(l.current), l.current = null;
|
|
649
|
+
}, []);
|
|
650
|
+
return a.useEffect(() => i, [i]), a.useEffect(() => {
|
|
651
|
+
const u = d.current;
|
|
652
|
+
return () => {
|
|
653
|
+
window.clearTimeout(u), v(null);
|
|
654
|
+
};
|
|
655
|
+
}, [d, v]), /* @__PURE__ */ s(we, { asChild: !0, ...m, children: /* @__PURE__ */ s(
|
|
656
|
+
We,
|
|
657
|
+
{
|
|
658
|
+
id: r.triggerId,
|
|
659
|
+
"aria-haspopup": "menu",
|
|
660
|
+
"aria-expanded": n.open,
|
|
661
|
+
"aria-controls": r.contentId,
|
|
662
|
+
"data-state": un(n.open),
|
|
663
|
+
...e,
|
|
664
|
+
ref: Te(o, r.onTriggerChange),
|
|
665
|
+
onClick: (u) => {
|
|
666
|
+
var f;
|
|
667
|
+
(f = e.onClick) == null || f.call(e, u), !(e.disabled || u.defaultPrevented) && (u.currentTarget.focus(), n.open || n.onOpenChange(!0));
|
|
668
|
+
},
|
|
669
|
+
onPointerMove: g(
|
|
670
|
+
e.onPointerMove,
|
|
671
|
+
q((u) => {
|
|
672
|
+
c.onItemEnter(u), !u.defaultPrevented && !e.disabled && !n.open && !l.current && (c.onPointerGraceIntentChange(null), l.current = window.setTimeout(() => {
|
|
673
|
+
n.onOpenChange(!0), i();
|
|
674
|
+
}, 100));
|
|
675
|
+
})
|
|
676
|
+
),
|
|
677
|
+
onPointerLeave: g(
|
|
678
|
+
e.onPointerLeave,
|
|
679
|
+
q((u) => {
|
|
680
|
+
var C, w;
|
|
681
|
+
i();
|
|
682
|
+
const f = (C = n.content) == null ? void 0 : C.getBoundingClientRect();
|
|
683
|
+
if (f) {
|
|
684
|
+
const R = (w = n.content) == null ? void 0 : w.dataset.side, M = R === "right", _ = M ? -5 : 5, E = f[M ? "left" : "right"], h = f[M ? "right" : "left"];
|
|
685
|
+
c.onPointerGraceIntentChange({
|
|
686
|
+
area: [
|
|
687
|
+
// Apply a bleed on clientX to ensure that our exit point is
|
|
688
|
+
// consistently within polygon bounds
|
|
689
|
+
{ x: u.clientX + _, y: u.clientY },
|
|
690
|
+
{ x: E, y: f.top },
|
|
691
|
+
{ x: h, y: f.top },
|
|
692
|
+
{ x: h, y: f.bottom },
|
|
693
|
+
{ x: E, y: f.bottom }
|
|
694
|
+
],
|
|
695
|
+
side: R
|
|
696
|
+
}), window.clearTimeout(d.current), d.current = window.setTimeout(
|
|
697
|
+
() => c.onPointerGraceIntentChange(null),
|
|
698
|
+
300
|
|
699
|
+
);
|
|
700
|
+
} else {
|
|
701
|
+
if (c.onTriggerLeave(u), u.defaultPrevented)
|
|
702
|
+
return;
|
|
703
|
+
c.onPointerGraceIntentChange(null);
|
|
704
|
+
}
|
|
705
|
+
})
|
|
706
|
+
),
|
|
707
|
+
onKeyDown: g(e.onKeyDown, (u) => {
|
|
708
|
+
var C;
|
|
709
|
+
const f = c.searchRef.current !== "";
|
|
710
|
+
e.disabled || f && u.key === " " || Hn[t.dir].includes(u.key) && (n.onOpenChange(!0), (C = n.content) == null || C.focus(), u.preventDefault());
|
|
711
|
+
})
|
|
712
|
+
}
|
|
713
|
+
) });
|
|
714
|
+
}
|
|
715
|
+
);
|
|
716
|
+
an.displayName = W;
|
|
717
|
+
var cn = "MenuSubContent", sn = a.forwardRef(
|
|
718
|
+
(e, o) => {
|
|
719
|
+
const n = Ye(D, e.__scopeMenu), { forceMount: t = n.forceMount, ...r } = e, c = $(D, e.__scopeMenu), l = Q(D, e.__scopeMenu), d = rn(cn, e.__scopeMenu), v = a.useRef(null), m = k(o, v);
|
|
720
|
+
return /* @__PURE__ */ s(z.Provider, { scope: e.__scopeMenu, children: /* @__PURE__ */ s(ae, { present: t || c.open, children: /* @__PURE__ */ s(z.Slot, { scope: e.__scopeMenu, children: /* @__PURE__ */ s(
|
|
721
|
+
_e,
|
|
722
|
+
{
|
|
723
|
+
id: d.contentId,
|
|
724
|
+
"aria-labelledby": d.triggerId,
|
|
725
|
+
...r,
|
|
726
|
+
ref: m,
|
|
727
|
+
align: "start",
|
|
728
|
+
side: l.dir === "rtl" ? "left" : "right",
|
|
729
|
+
disableOutsidePointerEvents: !1,
|
|
730
|
+
disableOutsideScroll: !1,
|
|
731
|
+
trapFocus: !1,
|
|
732
|
+
onOpenAutoFocus: (i) => {
|
|
733
|
+
var u;
|
|
734
|
+
l.isUsingKeyboardRef.current && ((u = v.current) == null || u.focus()), i.preventDefault();
|
|
735
|
+
},
|
|
736
|
+
onCloseAutoFocus: (i) => i.preventDefault(),
|
|
737
|
+
onFocusOutside: g(e.onFocusOutside, (i) => {
|
|
738
|
+
i.target !== d.trigger && c.onOpenChange(!1);
|
|
739
|
+
}),
|
|
740
|
+
onEscapeKeyDown: g(e.onEscapeKeyDown, (i) => {
|
|
741
|
+
l.onClose(), i.preventDefault();
|
|
742
|
+
}),
|
|
743
|
+
onKeyDown: g(e.onKeyDown, (i) => {
|
|
744
|
+
var C;
|
|
745
|
+
const u = i.currentTarget.contains(i.target), f = Wn[l.dir].includes(i.key);
|
|
746
|
+
u && f && (c.onOpenChange(!1), (C = d.trigger) == null || C.focus(), i.preventDefault());
|
|
747
|
+
})
|
|
748
|
+
}
|
|
749
|
+
) }) }) });
|
|
750
|
+
}
|
|
751
|
+
);
|
|
752
|
+
sn.displayName = cn;
|
|
753
|
+
function un(e) {
|
|
754
|
+
return e ? "open" : "closed";
|
|
755
|
+
}
|
|
756
|
+
function te(e) {
|
|
757
|
+
return e === "indeterminate";
|
|
758
|
+
}
|
|
759
|
+
function Ee(e) {
|
|
760
|
+
return te(e) ? "indeterminate" : e ? "checked" : "unchecked";
|
|
761
|
+
}
|
|
762
|
+
function vo(e) {
|
|
763
|
+
const o = document.activeElement;
|
|
764
|
+
for (const n of e)
|
|
765
|
+
if (n === o || (n.focus(), document.activeElement !== o))
|
|
766
|
+
return;
|
|
767
|
+
}
|
|
768
|
+
function Mo(e, o) {
|
|
769
|
+
return e.map((n, t) => e[(o + t) % e.length]);
|
|
770
|
+
}
|
|
771
|
+
function go(e, o, n) {
|
|
772
|
+
const r = o.length > 1 && Array.from(o).every((m) => m === o[0]) ? o[0] : o, c = n ? e.indexOf(n) : -1;
|
|
773
|
+
let l = Mo(e, Math.max(c, 0));
|
|
774
|
+
r.length === 1 && (l = l.filter((m) => m !== n));
|
|
775
|
+
const v = l.find(
|
|
776
|
+
(m) => m.toLowerCase().startsWith(r.toLowerCase())
|
|
777
|
+
);
|
|
778
|
+
return v !== n ? v : void 0;
|
|
779
|
+
}
|
|
780
|
+
function wo(e, o) {
|
|
781
|
+
const { x: n, y: t } = e;
|
|
782
|
+
let r = !1;
|
|
783
|
+
for (let c = 0, l = o.length - 1; c < o.length; l = c++) {
|
|
784
|
+
const d = o[c], v = o[l], m = d.x, i = d.y, u = v.x, f = v.y;
|
|
785
|
+
i > t != f > t && n < (u - m) * (t - i) / (f - i) + m && (r = !r);
|
|
786
|
+
}
|
|
787
|
+
return r;
|
|
788
|
+
}
|
|
789
|
+
function Co(e, o) {
|
|
790
|
+
if (!o)
|
|
791
|
+
return !1;
|
|
792
|
+
const n = { x: e.clientX, y: e.clientY };
|
|
793
|
+
return wo(n, o);
|
|
794
|
+
}
|
|
795
|
+
function q(e) {
|
|
796
|
+
return (o) => o.pointerType === "mouse" ? e(o) : void 0;
|
|
797
|
+
}
|
|
798
|
+
var ho = Ve, _o = we, Ro = Xe, Io = je, Eo = Re, So = He, bo = se, Po = ze, Do = Ze, yo = Qe, To = nn, xo = on, Ao = tn, No = an, Oo = sn, ue = "DropdownMenu", [Fo, lt] = re(
|
|
799
|
+
ue,
|
|
800
|
+
[$e]
|
|
801
|
+
), b = $e(), [ko, ln] = Fo(ue), dn = (e) => {
|
|
802
|
+
const {
|
|
803
|
+
__scopeDropdownMenu: o,
|
|
804
|
+
children: n,
|
|
805
|
+
dir: t,
|
|
806
|
+
open: r,
|
|
807
|
+
defaultOpen: c,
|
|
808
|
+
onOpenChange: l,
|
|
809
|
+
modal: d = !0
|
|
810
|
+
} = e, v = b(o), m = a.useRef(null), [i, u] = ye({
|
|
811
|
+
prop: r,
|
|
812
|
+
defaultProp: c ?? !1,
|
|
813
|
+
onChange: l,
|
|
814
|
+
caller: ue
|
|
815
|
+
});
|
|
816
|
+
return /* @__PURE__ */ s(
|
|
817
|
+
ko,
|
|
818
|
+
{
|
|
819
|
+
scope: o,
|
|
820
|
+
triggerId: me(),
|
|
821
|
+
triggerRef: m,
|
|
822
|
+
contentId: me(),
|
|
823
|
+
open: i,
|
|
824
|
+
onOpenChange: u,
|
|
825
|
+
onOpenToggle: a.useCallback(() => u((f) => !f), [u]),
|
|
826
|
+
modal: d,
|
|
827
|
+
children: /* @__PURE__ */ s(ho, { ...v, open: i, onOpenChange: u, dir: t, modal: d, children: n })
|
|
828
|
+
}
|
|
829
|
+
);
|
|
830
|
+
};
|
|
831
|
+
dn.displayName = ue;
|
|
832
|
+
var fn = "DropdownMenuTrigger", pn = a.forwardRef(
|
|
833
|
+
(e, o) => {
|
|
834
|
+
const { __scopeDropdownMenu: n, disabled: t = !1, ...r } = e, c = ln(fn, n), l = b(n);
|
|
835
|
+
return /* @__PURE__ */ s(_o, { asChild: !0, ...l, children: /* @__PURE__ */ s(
|
|
836
|
+
L.button,
|
|
837
|
+
{
|
|
838
|
+
type: "button",
|
|
839
|
+
id: c.triggerId,
|
|
840
|
+
"aria-haspopup": "menu",
|
|
841
|
+
"aria-expanded": c.open,
|
|
842
|
+
"aria-controls": c.open ? c.contentId : void 0,
|
|
843
|
+
"data-state": c.open ? "open" : "closed",
|
|
844
|
+
"data-disabled": t ? "" : void 0,
|
|
845
|
+
disabled: t,
|
|
846
|
+
...r,
|
|
847
|
+
ref: Te(o, c.triggerRef),
|
|
848
|
+
onPointerDown: g(e.onPointerDown, (d) => {
|
|
849
|
+
!t && d.button === 0 && d.ctrlKey === !1 && (c.onOpenToggle(), c.open || d.preventDefault());
|
|
850
|
+
}),
|
|
851
|
+
onKeyDown: g(e.onKeyDown, (d) => {
|
|
852
|
+
t || (["Enter", " "].includes(d.key) && c.onOpenToggle(), d.key === "ArrowDown" && c.onOpenChange(!0), ["Enter", " ", "ArrowDown"].includes(d.key) && d.preventDefault());
|
|
853
|
+
})
|
|
854
|
+
}
|
|
855
|
+
) });
|
|
856
|
+
}
|
|
857
|
+
);
|
|
858
|
+
pn.displayName = fn;
|
|
859
|
+
var Lo = "DropdownMenuPortal", mn = (e) => {
|
|
860
|
+
const { __scopeDropdownMenu: o, ...n } = e, t = b(o);
|
|
861
|
+
return /* @__PURE__ */ s(Ro, { ...t, ...n });
|
|
862
|
+
};
|
|
863
|
+
mn.displayName = Lo;
|
|
864
|
+
var vn = "DropdownMenuContent", Mn = a.forwardRef(
|
|
865
|
+
(e, o) => {
|
|
866
|
+
const { __scopeDropdownMenu: n, ...t } = e, r = ln(vn, n), c = b(n), l = a.useRef(!1);
|
|
867
|
+
return /* @__PURE__ */ s(
|
|
868
|
+
Io,
|
|
869
|
+
{
|
|
870
|
+
id: r.contentId,
|
|
871
|
+
"aria-labelledby": r.triggerId,
|
|
872
|
+
...c,
|
|
873
|
+
...t,
|
|
874
|
+
ref: o,
|
|
875
|
+
onCloseAutoFocus: g(e.onCloseAutoFocus, (d) => {
|
|
876
|
+
var v;
|
|
877
|
+
l.current || (v = r.triggerRef.current) == null || v.focus(), l.current = !1, d.preventDefault();
|
|
878
|
+
}),
|
|
879
|
+
onInteractOutside: g(e.onInteractOutside, (d) => {
|
|
880
|
+
const v = d.detail.originalEvent, m = v.button === 0 && v.ctrlKey === !0, i = v.button === 2 || m;
|
|
881
|
+
(!r.modal || i) && (l.current = !0);
|
|
882
|
+
}),
|
|
883
|
+
style: {
|
|
884
|
+
...e.style,
|
|
885
|
+
"--radix-dropdown-menu-content-transform-origin": "var(--radix-popper-transform-origin)",
|
|
886
|
+
"--radix-dropdown-menu-content-available-width": "var(--radix-popper-available-width)",
|
|
887
|
+
"--radix-dropdown-menu-content-available-height": "var(--radix-popper-available-height)",
|
|
888
|
+
"--radix-dropdown-menu-trigger-width": "var(--radix-popper-anchor-width)",
|
|
889
|
+
"--radix-dropdown-menu-trigger-height": "var(--radix-popper-anchor-height)"
|
|
890
|
+
}
|
|
891
|
+
}
|
|
892
|
+
);
|
|
893
|
+
}
|
|
894
|
+
);
|
|
895
|
+
Mn.displayName = vn;
|
|
896
|
+
var Go = "DropdownMenuGroup", gn = a.forwardRef(
|
|
897
|
+
(e, o) => {
|
|
898
|
+
const { __scopeDropdownMenu: n, ...t } = e, r = b(n);
|
|
899
|
+
return /* @__PURE__ */ s(Eo, { ...r, ...t, ref: o });
|
|
900
|
+
}
|
|
901
|
+
);
|
|
902
|
+
gn.displayName = Go;
|
|
903
|
+
var Ko = "DropdownMenuLabel", Uo = a.forwardRef(
|
|
904
|
+
(e, o) => {
|
|
905
|
+
const { __scopeDropdownMenu: n, ...t } = e, r = b(n);
|
|
906
|
+
return /* @__PURE__ */ s(So, { ...r, ...t, ref: o });
|
|
907
|
+
}
|
|
908
|
+
);
|
|
909
|
+
Uo.displayName = Ko;
|
|
910
|
+
var $o = "DropdownMenuItem", wn = a.forwardRef(
|
|
911
|
+
(e, o) => {
|
|
912
|
+
const { __scopeDropdownMenu: n, ...t } = e, r = b(n);
|
|
913
|
+
return /* @__PURE__ */ s(bo, { ...r, ...t, ref: o });
|
|
914
|
+
}
|
|
915
|
+
);
|
|
916
|
+
wn.displayName = $o;
|
|
917
|
+
var Bo = "DropdownMenuCheckboxItem", Vo = a.forwardRef((e, o) => {
|
|
918
|
+
const { __scopeDropdownMenu: n, ...t } = e, r = b(n);
|
|
919
|
+
return /* @__PURE__ */ s(Po, { ...r, ...t, ref: o });
|
|
920
|
+
});
|
|
921
|
+
Vo.displayName = Bo;
|
|
922
|
+
var Yo = "DropdownMenuRadioGroup", Xo = a.forwardRef((e, o) => {
|
|
923
|
+
const { __scopeDropdownMenu: n, ...t } = e, r = b(n);
|
|
924
|
+
return /* @__PURE__ */ s(Do, { ...r, ...t, ref: o });
|
|
925
|
+
});
|
|
926
|
+
Xo.displayName = Yo;
|
|
927
|
+
var jo = "DropdownMenuRadioItem", Ho = a.forwardRef((e, o) => {
|
|
928
|
+
const { __scopeDropdownMenu: n, ...t } = e, r = b(n);
|
|
929
|
+
return /* @__PURE__ */ s(yo, { ...r, ...t, ref: o });
|
|
930
|
+
});
|
|
931
|
+
Ho.displayName = jo;
|
|
932
|
+
var Wo = "DropdownMenuItemIndicator", zo = a.forwardRef((e, o) => {
|
|
933
|
+
const { __scopeDropdownMenu: n, ...t } = e, r = b(n);
|
|
934
|
+
return /* @__PURE__ */ s(To, { ...r, ...t, ref: o });
|
|
935
|
+
});
|
|
936
|
+
zo.displayName = Wo;
|
|
937
|
+
var qo = "DropdownMenuSeparator", Cn = a.forwardRef((e, o) => {
|
|
938
|
+
const { __scopeDropdownMenu: n, ...t } = e, r = b(n);
|
|
939
|
+
return /* @__PURE__ */ s(xo, { ...r, ...t, ref: o });
|
|
940
|
+
});
|
|
941
|
+
Cn.displayName = qo;
|
|
942
|
+
var Zo = "DropdownMenuArrow", Jo = a.forwardRef(
|
|
943
|
+
(e, o) => {
|
|
944
|
+
const { __scopeDropdownMenu: n, ...t } = e, r = b(n);
|
|
945
|
+
return /* @__PURE__ */ s(Ao, { ...r, ...t, ref: o });
|
|
946
|
+
}
|
|
947
|
+
);
|
|
948
|
+
Jo.displayName = Zo;
|
|
949
|
+
var Qo = "DropdownMenuSubTrigger", et = a.forwardRef((e, o) => {
|
|
950
|
+
const { __scopeDropdownMenu: n, ...t } = e, r = b(n);
|
|
951
|
+
return /* @__PURE__ */ s(No, { ...r, ...t, ref: o });
|
|
952
|
+
});
|
|
953
|
+
et.displayName = Qo;
|
|
954
|
+
var nt = "DropdownMenuSubContent", ot = a.forwardRef((e, o) => {
|
|
955
|
+
const { __scopeDropdownMenu: n, ...t } = e, r = b(n);
|
|
956
|
+
return /* @__PURE__ */ s(
|
|
957
|
+
Oo,
|
|
958
|
+
{
|
|
959
|
+
...r,
|
|
960
|
+
...t,
|
|
961
|
+
ref: o,
|
|
962
|
+
style: {
|
|
963
|
+
...e.style,
|
|
964
|
+
"--radix-dropdown-menu-content-transform-origin": "var(--radix-popper-transform-origin)",
|
|
965
|
+
"--radix-dropdown-menu-content-available-width": "var(--radix-popper-available-width)",
|
|
966
|
+
"--radix-dropdown-menu-content-available-height": "var(--radix-popper-available-height)",
|
|
967
|
+
"--radix-dropdown-menu-trigger-width": "var(--radix-popper-anchor-width)",
|
|
968
|
+
"--radix-dropdown-menu-trigger-height": "var(--radix-popper-anchor-height)"
|
|
969
|
+
}
|
|
970
|
+
}
|
|
971
|
+
);
|
|
972
|
+
});
|
|
973
|
+
ot.displayName = nt;
|
|
974
|
+
var dt = dn, ft = pn, pt = mn, mt = Mn, vt = gn, Mt = wn, gt = Cn;
|
|
975
|
+
export {
|
|
976
|
+
mt as C,
|
|
977
|
+
vt as G,
|
|
978
|
+
Mt as I,
|
|
979
|
+
pt as P,
|
|
980
|
+
dt as R,
|
|
981
|
+
gt as S,
|
|
982
|
+
ft as T
|
|
983
|
+
};
|