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