@react-pdf-kit/viewer 2.0.0-beta.8 → 2.0.0-rc.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/dist/Combination-136ff99c.js +698 -0
- package/dist/MostPageTool.module-13578ad6.js +6 -0
- package/dist/OtherTool.module-a4be5f1f.js +6 -0
- package/dist/Paginate.module-4eef00aa.js +8 -0
- package/dist/PaginationContext-9217cab4.js +201 -0
- package/dist/RPLayout.module-b4b23e29.js +14 -0
- package/dist/RPSplitter-f6acf13b.js +71 -0
- package/dist/RPToolbar.module-27d7fe77.js +10 -0
- package/dist/SearchTool.module-99f60dc7.js +16 -0
- package/dist/ToolbarLayout.module-6e339802.js +12 -0
- package/dist/ZoomTool.module-7082af8c.js +12 -0
- package/dist/assets/style.css +1 -1
- package/dist/assets/style.js +32 -30
- package/dist/components/RPController.js +81 -152
- package/dist/components/RPDropFileZone.js +1 -1
- package/dist/components/RPPages.js +1028 -122
- package/dist/components/RPProvider.js +57 -113
- package/dist/components/icons/DualPageWithCoverIcon.js +22 -0
- package/dist/components/layout/LayoutContainer.js +31 -136
- package/dist/components/layout/LayoutWrapper.js +8 -4
- package/dist/components/layout/RPDefaultLayout.js +184 -86
- package/dist/components/layout/RPLayout.js +123 -105
- package/dist/components/layout/SkipLink.js +29 -0
- package/dist/components/layout/WrapperLayout.js +1 -1
- package/dist/components/layout/sidebar/RPSidebar.js +79 -112
- package/dist/components/layout/sidebar/RPSplitter.js +6 -59
- package/dist/components/layout/sidebar/Thumbnail.js +130 -125
- package/dist/components/layout/sidebar/Thumbnails.js +56 -119
- package/dist/components/layout/toolbar/DarkModeTool.js +7 -5
- package/dist/components/layout/toolbar/DocumentDialog.js +305 -131
- package/dist/components/layout/toolbar/DocumentProperties.js +13 -10
- package/dist/components/layout/toolbar/FileDownloadTool.js +34 -124
- package/dist/components/layout/toolbar/FileUploadTool.js +9 -6
- package/dist/components/layout/toolbar/FullScreenTool.js +17 -14
- package/dist/components/layout/toolbar/MenuItem.js +11 -8
- package/dist/components/layout/toolbar/MenuSeparator.js +8 -5
- package/dist/components/layout/toolbar/MostPageTool.js +66 -125
- package/dist/components/layout/toolbar/OtherTool.js +171 -112
- package/dist/components/layout/toolbar/Paginate.js +121 -116
- package/dist/components/layout/toolbar/PrintTool.js +55 -123
- package/dist/components/layout/toolbar/RPMenuItem.js +14 -11
- package/dist/components/layout/toolbar/RPMoreOptions.js +102 -154
- package/dist/components/layout/toolbar/RPToolbar.js +90 -79
- package/dist/components/layout/toolbar/RPToolbarEnd.js +69 -88
- package/dist/components/layout/toolbar/RotateTool.js +13 -10
- package/dist/components/layout/toolbar/ScrollModeTool.js +42 -39
- package/dist/components/layout/toolbar/SearchCloseButton.js +24 -10
- package/dist/components/layout/toolbar/SearchResultNavigator.js +74 -105
- package/dist/components/layout/toolbar/SearchTool.js +245 -121
- package/dist/components/layout/toolbar/SelectionModeTool.js +9 -6
- package/dist/components/layout/toolbar/ThumbnailTool.js +15 -122
- package/dist/components/layout/toolbar/ToolbarCustom.js +75 -143
- package/dist/components/layout/toolbar/ToolbarDefault.js +135 -122
- package/dist/components/layout/toolbar/ToolbarLayout.js +86 -81
- package/dist/components/layout/toolbar/ViewModeTool.js +47 -35
- package/dist/components/layout/toolbar/ZoomTool.js +129 -119
- package/dist/components/layout/toolbar/tools/DocumentPropertiesTool.js +18 -122
- package/dist/components/layout/toolbar/tools/DualPageTool.js +11 -129
- package/dist/components/layout/toolbar/tools/DualPageWithCoverTool.js +202 -0
- package/dist/components/layout/toolbar/tools/FileDownloadTool.js +14 -123
- package/dist/components/layout/toolbar/tools/FileUploadTool.js +10 -8
- package/dist/components/layout/toolbar/tools/FirstPageTool.js +197 -0
- package/dist/components/layout/toolbar/tools/FullScreenTool.js +21 -18
- package/dist/components/layout/toolbar/tools/HorizontalScrollingTool.js +37 -0
- package/dist/components/layout/toolbar/tools/InputPageTool.js +52 -136
- package/dist/components/layout/toolbar/tools/LastPageTool.js +197 -0
- package/dist/components/layout/toolbar/tools/NextPageTool.js +39 -129
- package/dist/components/layout/toolbar/tools/PageScrollingTool.js +37 -0
- package/dist/components/layout/toolbar/tools/PreviousPageTool.js +28 -118
- package/dist/components/layout/toolbar/tools/PrintTool.js +14 -123
- package/dist/components/layout/toolbar/tools/RotateClockwiseTool.js +18 -9
- package/dist/components/layout/toolbar/tools/RotateCounterclockwiseTool.js +15 -13
- package/dist/components/layout/toolbar/tools/SelectionModeSwitcherTool.js +24 -14
- package/dist/components/layout/toolbar/tools/SinglePageTool.js +11 -129
- package/dist/components/layout/toolbar/tools/ThemeSwitcherTool.js +16 -6
- package/dist/components/layout/toolbar/tools/ThumbnailTool.js +23 -131
- package/dist/components/layout/toolbar/tools/VerticalScrollingTool.js +37 -0
- package/dist/components/layout/toolbar/tools/ZoomInTool.js +21 -18
- package/dist/components/layout/toolbar/tools/ZoomLevelDisplay.js +23 -136
- package/dist/components/layout/toolbar/tools/ZoomLevelTool.js +80 -141
- package/dist/components/layout/toolbar/tools/ZoomOutTool.js +18 -15
- package/dist/components/layout/toolbar/tools/defaults/RPHorizontalBar.js +98 -105
- package/dist/components/layout/toolbar/tools/defaults/RPVerticalBar.js +16 -123
- package/dist/components/layout/toolbar/tools/more-options/DocumentProperties.js +17 -14
- package/dist/components/layout/toolbar/tools/more-options/FileDownloadTool.js +29 -127
- package/dist/components/layout/toolbar/tools/more-options/FileUploadTool.js +31 -130
- package/dist/components/layout/toolbar/tools/more-options/FullScreenTool.js +28 -17
- package/dist/components/layout/toolbar/tools/more-options/MostPageTool.js +63 -134
- package/dist/components/layout/toolbar/tools/more-options/PrintTool.js +33 -131
- package/dist/components/layout/toolbar/tools/more-options/RotateTool.js +41 -24
- package/dist/components/layout/toolbar/tools/more-options/ScrollModeTool.js +58 -37
- package/dist/components/layout/toolbar/tools/more-options/SelectionModeTool.js +44 -25
- package/dist/components/layout/toolbar/tools/more-options/ViewModeTool.js +56 -30
- package/dist/components/page/AnnotationLayer.js +130 -125
- package/dist/components/page/CanvasLayer.js +57 -126
- package/dist/components/page/CustomElement.js +1 -1
- package/dist/components/page/DualPage.js +69 -110
- package/dist/components/page/DualPageWithCover.js +131 -0
- package/dist/components/page/RPPage.js +126 -123
- package/dist/components/page/SinglePage.js +59 -110
- package/dist/components/page/TextHighlightLayer.js +187 -129
- package/dist/components/page/TextLayer.js +186 -125
- package/dist/components/ui/Button.js +14 -12
- package/dist/components/ui/Checkbox.js +78 -70
- package/dist/components/ui/DropDown.js +11 -8
- package/dist/components/ui/Input.js +12 -11
- package/dist/components/ui/LoadingIndicator.js +34 -127
- package/dist/components/ui/PasswordModal.js +44 -30
- package/dist/components/ui/RPTooltip.js +121 -135
- package/dist/contexts/DimensionPagesContext.js +1 -1
- package/dist/contexts/DropFileZoneContext.js +1 -1
- package/dist/contexts/ElementPageContext.js +1 -1
- package/dist/contexts/EventCallbackContext.js +12 -8
- package/dist/contexts/FileInputContext.js +1 -1
- package/dist/contexts/FullScreenContext.js +17 -10
- package/dist/contexts/HighlightContext.js +1 -1
- package/dist/contexts/LocalizationContext.js +25 -30
- package/dist/contexts/PagesRotateContext.js +1 -1
- package/dist/contexts/PaginationContext.js +15 -118
- package/dist/contexts/PrintContext.js +67 -131
- package/dist/contexts/RPDocumentContext.js +8 -8
- package/dist/contexts/RenderQueueProvider.js +48 -118
- package/dist/contexts/RotationContext.js +1 -1
- package/dist/contexts/ScrollModeContext.js +1 -1
- package/dist/contexts/SearchContext.js +66 -112
- package/dist/contexts/SelectionModeContext.js +1 -1
- package/dist/contexts/ThumbnailsContext.js +32 -131
- package/dist/contexts/ViewModeContext.js +19 -15
- package/dist/contexts/ZoomContext.js +23 -23
- package/dist/de_DE-a553b162.js +489 -0
- package/dist/floating-ui.react-dom-5ec29bd6.js +1327 -0
- package/dist/index-61f59539.js +1198 -0
- package/dist/index-655864a7.js +27 -0
- package/dist/{index-c9a2990a.js → index-c0faa594.js} +64 -87
- package/dist/index-e3ee9457.js +150 -0
- package/dist/main.js +193 -130
- package/dist/types/components/icons/DualPageWithCoverIcon.d.ts +2 -0
- package/dist/types/components/layout/LayoutContainer.d.ts +1 -5
- package/dist/types/components/layout/LayoutWrapper.d.ts +1 -5
- package/dist/types/components/layout/SkipLink.d.ts +7 -0
- package/dist/types/components/layout/sidebar/Thumbnails.d.ts +1 -3
- package/dist/types/components/layout/toolbar/RPToolbar.d.ts +1 -3
- package/dist/types/components/layout/toolbar/tools/DualPageWithCoverTool.d.ts +3 -0
- package/dist/types/components/layout/toolbar/tools/FirstPageTool.d.ts +3 -0
- package/dist/types/components/layout/toolbar/tools/HorizontalScrollingTool.d.ts +3 -0
- package/dist/types/components/layout/toolbar/tools/LastPageTool.d.ts +3 -0
- package/dist/types/components/layout/toolbar/tools/PageScrollingTool.d.ts +3 -0
- package/dist/types/components/layout/toolbar/tools/VerticalScrollingTool.d.ts +3 -0
- package/dist/types/components/page/DualPageWithCover.d.ts +5 -0
- package/dist/types/components/page/RPPage.d.ts +1 -3
- package/dist/types/components/ui/Button.d.ts +1 -3
- package/dist/types/components/ui/Checkbox.d.ts +1 -0
- package/dist/types/components/ui/Input.d.ts +1 -3
- package/dist/types/components/ui/RPTooltip.d.ts +1 -3
- package/dist/types/locales/de_DE.json.d.ts +83 -0
- package/dist/types/locales/en_US.json.d.ts +2 -0
- package/dist/types/locales/it_IT.json.d.ts +2 -0
- package/dist/types/locales/pt_PT.json.d.ts +2 -0
- package/dist/types/locales/th_TH.json.d.ts +2 -0
- package/dist/types/locales/zh_CN.json.d.ts +2 -0
- package/dist/types/main.d.ts +8 -2
- package/dist/types/utils/annotations.d.ts +10 -1
- package/dist/types/utils/calculatePage.d.ts +3 -3
- package/dist/types/utils/hooks/usePresentPage.d.ts +2 -1
- package/dist/types/utils/hooks/useTextSelection.d.ts +7 -0
- package/dist/types/utils/types.d.ts +34 -3
- package/dist/types/utils/withRef.d.ts +5 -4
- package/dist/utils/annotations.js +145 -150
- package/dist/utils/calculatePage.js +17 -11
- package/dist/utils/getZoomLevel.js +9 -9
- package/dist/utils/highlight.js +139 -139
- package/dist/utils/hooks/useFileDownload.js +23 -130
- package/dist/utils/hooks/useHighlight.js +28 -28
- package/dist/utils/hooks/useLicense.js +1 -1
- package/dist/utils/hooks/useLoadPdf.js +1 -1
- package/dist/utils/hooks/useLocalization.js +17 -16
- package/dist/utils/hooks/usePageRotateContext.js +1 -1
- package/dist/utils/hooks/usePaginate.js +23 -126
- package/dist/utils/hooks/usePinch.js +1 -1
- package/dist/utils/hooks/usePresentPage.js +79 -129
- package/dist/utils/hooks/usePrint.js +175 -130
- package/dist/utils/hooks/useRotate.js +1 -1
- package/dist/utils/hooks/useScrollToPage.js +18 -121
- package/dist/utils/hooks/useSearch.js +149 -127
- package/dist/utils/hooks/useTextSelection.js +76 -0
- package/dist/utils/hooks/useThumbnail.js +50 -131
- package/dist/utils/hooks/useVirtualReactWindow.js +84 -128
- package/dist/utils/types.js +14 -13
- package/dist/utils/withRef.js +5 -5
- package/package.json +5 -4
- package/dist/LayoutWrapper-6224491f.js +0 -19
- package/dist/SearchCloseButton-08d57275.js +0 -33
- package/dist/ToolbarLayout.module-0aa7a2aa.js +0 -3557
- package/dist/floating-ui.react-dom-d22a10b4.js +0 -1474
- package/dist/index-3bf64864.js +0 -1886
- package/dist/th_TH-d627cd51.js +0 -398
|
@@ -0,0 +1,1198 @@
|
|
|
1
|
+
import * as a from "react";
|
|
2
|
+
import X from "react";
|
|
3
|
+
import { c as ce, a as G, g as Ce, P as F, u as ke, f as Ge, b as M, d as me, j as Ke, h as Bt } from "./index-c0faa594.js";
|
|
4
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
5
|
+
import { a as ve, u as _e, D as Yt } from "./index-e3ee9457.js";
|
|
6
|
+
import { h as Ht, u as Vt, F as Xt, R as Wt, P as jt } from "./Combination-136ff99c.js";
|
|
7
|
+
import { u as zt, a as Zt, o as qt, s as Jt, l as Qt, f as eo, b as to, c as oo, h as no } from "./floating-ui.react-dom-5ec29bd6.js";
|
|
8
|
+
import { u as ro } from "./index-655864a7.js";
|
|
9
|
+
function $e(e) {
|
|
10
|
+
const o = e + "CollectionProvider", [t, n] = ce(o), [r, c] = t(
|
|
11
|
+
o,
|
|
12
|
+
{ collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
|
|
13
|
+
), u = (C) => {
|
|
14
|
+
const { scope: h, children: _ } = C, P = X.useRef(null), R = X.useRef(/* @__PURE__ */ new Map()).current;
|
|
15
|
+
return /* @__PURE__ */ s(r, { scope: h, itemMap: R, collectionRef: P, children: _ });
|
|
16
|
+
};
|
|
17
|
+
u.displayName = o;
|
|
18
|
+
const d = e + "CollectionSlot", p = Ce(d), m = X.forwardRef(
|
|
19
|
+
(C, h) => {
|
|
20
|
+
const { scope: _, children: P } = C, R = c(d, _), I = G(h, R.collectionRef);
|
|
21
|
+
return /* @__PURE__ */ s(p, { ref: I, children: P });
|
|
22
|
+
}
|
|
23
|
+
);
|
|
24
|
+
m.displayName = d;
|
|
25
|
+
const l = e + "CollectionItemSlot", i = "data-radix-collection-item", f = Ce(l), w = X.forwardRef(
|
|
26
|
+
(C, h) => {
|
|
27
|
+
const { scope: _, children: P, ...R } = C, I = X.useRef(null), k = G(h, I), S = c(l, _);
|
|
28
|
+
return X.useEffect(() => (S.itemMap.set(I, { ref: I, ...R }), () => void S.itemMap.delete(I))), /* @__PURE__ */ s(f, { [i]: "", ref: k, children: P });
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
w.displayName = l;
|
|
32
|
+
function g(C) {
|
|
33
|
+
const h = c(e + "CollectionConsumer", C);
|
|
34
|
+
return X.useCallback(() => {
|
|
35
|
+
const P = h.collectionRef.current;
|
|
36
|
+
if (!P)
|
|
37
|
+
return [];
|
|
38
|
+
const R = Array.from(P.querySelectorAll(`[${i}]`));
|
|
39
|
+
return Array.from(h.itemMap.values()).sort(
|
|
40
|
+
(S, N) => R.indexOf(S.ref.current) - R.indexOf(N.ref.current)
|
|
41
|
+
);
|
|
42
|
+
}, [h.collectionRef, h.itemMap]);
|
|
43
|
+
}
|
|
44
|
+
return [
|
|
45
|
+
{ Provider: u, Slot: m, ItemSlot: w },
|
|
46
|
+
g,
|
|
47
|
+
n
|
|
48
|
+
];
|
|
49
|
+
}
|
|
50
|
+
var ao = a.createContext(void 0);
|
|
51
|
+
function Ue(e) {
|
|
52
|
+
const o = a.useContext(ao);
|
|
53
|
+
return e || o || "ltr";
|
|
54
|
+
}
|
|
55
|
+
var co = "Arrow", Be = a.forwardRef((e, o) => {
|
|
56
|
+
const { children: t, width: n = 10, height: r = 5, ...c } = e;
|
|
57
|
+
return /* @__PURE__ */ s(
|
|
58
|
+
F.svg,
|
|
59
|
+
{
|
|
60
|
+
...c,
|
|
61
|
+
ref: o,
|
|
62
|
+
width: n,
|
|
63
|
+
height: r,
|
|
64
|
+
viewBox: "0 0 30 10",
|
|
65
|
+
preserveAspectRatio: "none",
|
|
66
|
+
children: e.asChild ? t : /* @__PURE__ */ s("polygon", { points: "0,0 30,0 15,10" })
|
|
67
|
+
}
|
|
68
|
+
);
|
|
69
|
+
});
|
|
70
|
+
Be.displayName = co;
|
|
71
|
+
var so = Be, Pe = "Popper", [Ye, He] = ce(Pe), [io, Ve] = Ye(Pe), Xe = (e) => {
|
|
72
|
+
const { __scopePopper: o, children: t } = e, [n, r] = a.useState(null);
|
|
73
|
+
return /* @__PURE__ */ s(io, { scope: o, anchor: n, onAnchorChange: r, children: t });
|
|
74
|
+
};
|
|
75
|
+
Xe.displayName = Pe;
|
|
76
|
+
var We = "PopperAnchor", je = a.forwardRef(
|
|
77
|
+
(e, o) => {
|
|
78
|
+
const { __scopePopper: t, virtualRef: n, ...r } = e, c = Ve(We, t), u = a.useRef(null), d = G(o, u), p = a.useRef(null);
|
|
79
|
+
return a.useEffect(() => {
|
|
80
|
+
const m = p.current;
|
|
81
|
+
p.current = (n == null ? void 0 : n.current) || u.current, m !== p.current && c.onAnchorChange(p.current);
|
|
82
|
+
}), n ? null : /* @__PURE__ */ s(F.div, { ...r, ref: d });
|
|
83
|
+
}
|
|
84
|
+
);
|
|
85
|
+
je.displayName = We;
|
|
86
|
+
var ye = "PopperContent", [uo, lo] = Ye(ye), ze = a.forwardRef(
|
|
87
|
+
(e, o) => {
|
|
88
|
+
var U, ee, D, te, Ne, Oe;
|
|
89
|
+
const {
|
|
90
|
+
__scopePopper: t,
|
|
91
|
+
side: n = "bottom",
|
|
92
|
+
sideOffset: r = 0,
|
|
93
|
+
align: c = "center",
|
|
94
|
+
alignOffset: u = 0,
|
|
95
|
+
arrowPadding: d = 0,
|
|
96
|
+
avoidCollisions: p = !0,
|
|
97
|
+
collisionBoundary: m = [],
|
|
98
|
+
collisionPadding: l = 0,
|
|
99
|
+
sticky: i = "partial",
|
|
100
|
+
hideWhenDetached: f = !1,
|
|
101
|
+
updatePositionStrategy: w = "optimized",
|
|
102
|
+
onPlaced: g,
|
|
103
|
+
...C
|
|
104
|
+
} = e, h = Ve(ye, t), [_, P] = a.useState(null), R = G(o, (oe) => P(oe)), [I, k] = a.useState(null), S = ro(I), N = (S == null ? void 0 : S.width) ?? 0, y = (S == null ? void 0 : S.height) ?? 0, B = n + (c !== "center" ? "-" + c : ""), K = typeof l == "number" ? l : { top: 0, right: 0, bottom: 0, left: 0, ...l }, Y = Array.isArray(m) ? m : [m], H = Y.length > 0, $ = {
|
|
105
|
+
padding: K,
|
|
106
|
+
boundary: Y.filter(fo),
|
|
107
|
+
// with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
|
|
108
|
+
altBoundary: H
|
|
109
|
+
}, { refs: z, floatingStyles: Z, placement: O, isPositioned: q, middlewareData: A } = zt({
|
|
110
|
+
// default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
|
|
111
|
+
strategy: "fixed",
|
|
112
|
+
placement: B,
|
|
113
|
+
whileElementsMounted: (...oe) => Zt(...oe, {
|
|
114
|
+
animationFrame: w === "always"
|
|
115
|
+
}),
|
|
116
|
+
elements: {
|
|
117
|
+
reference: h.anchor
|
|
118
|
+
},
|
|
119
|
+
middleware: [
|
|
120
|
+
qt({ mainAxis: r + y, alignmentAxis: u }),
|
|
121
|
+
p && Jt({
|
|
122
|
+
mainAxis: !0,
|
|
123
|
+
crossAxis: !1,
|
|
124
|
+
limiter: i === "partial" ? Qt() : void 0,
|
|
125
|
+
...$
|
|
126
|
+
}),
|
|
127
|
+
p && eo({ ...$ }),
|
|
128
|
+
to({
|
|
129
|
+
...$,
|
|
130
|
+
apply: ({ elements: oe, rects: Fe, availableWidth: Gt, availableHeight: Kt }) => {
|
|
131
|
+
const { width: $t, height: Ut } = Fe.reference, de = oe.floating.style;
|
|
132
|
+
de.setProperty("--radix-popper-available-width", `${Gt}px`), de.setProperty("--radix-popper-available-height", `${Kt}px`), de.setProperty("--radix-popper-anchor-width", `${$t}px`), de.setProperty("--radix-popper-anchor-height", `${Ut}px`);
|
|
133
|
+
}
|
|
134
|
+
}),
|
|
135
|
+
I && oo({ element: I, padding: d }),
|
|
136
|
+
mo({ arrowWidth: N, arrowHeight: y }),
|
|
137
|
+
f && no({ strategy: "referenceHidden", ...$ })
|
|
138
|
+
]
|
|
139
|
+
}), [v, b] = Je(O), E = ve(g);
|
|
140
|
+
ke(() => {
|
|
141
|
+
q && (E == null || E());
|
|
142
|
+
}, [q, E]);
|
|
143
|
+
const L = (U = A.arrow) == null ? void 0 : U.x, J = (ee = A.arrow) == null ? void 0 : ee.y, Q = ((D = A.arrow) == null ? void 0 : D.centerOffset) !== 0, [le, V] = a.useState();
|
|
144
|
+
return ke(() => {
|
|
145
|
+
_ && V(window.getComputedStyle(_).zIndex);
|
|
146
|
+
}, [_]), /* @__PURE__ */ s(
|
|
147
|
+
"div",
|
|
148
|
+
{
|
|
149
|
+
ref: z.setFloating,
|
|
150
|
+
"data-radix-popper-content-wrapper": "",
|
|
151
|
+
style: {
|
|
152
|
+
...Z,
|
|
153
|
+
transform: q ? Z.transform : "translate(0, -200%)",
|
|
154
|
+
// keep off the page when measuring
|
|
155
|
+
minWidth: "max-content",
|
|
156
|
+
zIndex: le,
|
|
157
|
+
"--radix-popper-transform-origin": [
|
|
158
|
+
(te = A.transformOrigin) == null ? void 0 : te.x,
|
|
159
|
+
(Ne = A.transformOrigin) == null ? void 0 : Ne.y
|
|
160
|
+
].join(" "),
|
|
161
|
+
// hide the content if using the hide middleware and should be hidden
|
|
162
|
+
// set visibility to hidden and disable pointer events so the UI behaves
|
|
163
|
+
// as if the PopperContent isn't there at all
|
|
164
|
+
...((Oe = A.hide) == null ? void 0 : Oe.referenceHidden) && {
|
|
165
|
+
visibility: "hidden",
|
|
166
|
+
pointerEvents: "none"
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
dir: e.dir,
|
|
170
|
+
children: /* @__PURE__ */ s(
|
|
171
|
+
uo,
|
|
172
|
+
{
|
|
173
|
+
scope: t,
|
|
174
|
+
placedSide: v,
|
|
175
|
+
onArrowChange: k,
|
|
176
|
+
arrowX: L,
|
|
177
|
+
arrowY: J,
|
|
178
|
+
shouldHideArrow: Q,
|
|
179
|
+
children: /* @__PURE__ */ s(
|
|
180
|
+
F.div,
|
|
181
|
+
{
|
|
182
|
+
"data-side": v,
|
|
183
|
+
"data-align": b,
|
|
184
|
+
...C,
|
|
185
|
+
ref: R,
|
|
186
|
+
style: {
|
|
187
|
+
...C.style,
|
|
188
|
+
// if the PopperContent hasn't been placed yet (not all measurements done)
|
|
189
|
+
// we prevent animations so that users's animation don't kick in too early referring wrong sides
|
|
190
|
+
animation: q ? void 0 : "none"
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
)
|
|
194
|
+
}
|
|
195
|
+
)
|
|
196
|
+
}
|
|
197
|
+
);
|
|
198
|
+
}
|
|
199
|
+
);
|
|
200
|
+
ze.displayName = ye;
|
|
201
|
+
var Ze = "PopperArrow", po = {
|
|
202
|
+
top: "bottom",
|
|
203
|
+
right: "left",
|
|
204
|
+
bottom: "top",
|
|
205
|
+
left: "right"
|
|
206
|
+
}, qe = a.forwardRef(function(o, t) {
|
|
207
|
+
const { __scopePopper: n, ...r } = o, c = lo(Ze, n), u = po[c.placedSide];
|
|
208
|
+
return (
|
|
209
|
+
// we have to use an extra wrapper because `ResizeObserver` (used by `useSize`)
|
|
210
|
+
// doesn't report size as we'd expect on SVG elements.
|
|
211
|
+
// it reports their bounding box which is effectively the largest path inside the SVG.
|
|
212
|
+
/* @__PURE__ */ s(
|
|
213
|
+
"span",
|
|
214
|
+
{
|
|
215
|
+
ref: c.onArrowChange,
|
|
216
|
+
style: {
|
|
217
|
+
position: "absolute",
|
|
218
|
+
left: c.arrowX,
|
|
219
|
+
top: c.arrowY,
|
|
220
|
+
[u]: 0,
|
|
221
|
+
transformOrigin: {
|
|
222
|
+
top: "",
|
|
223
|
+
right: "0 0",
|
|
224
|
+
bottom: "center 0",
|
|
225
|
+
left: "100% 0"
|
|
226
|
+
}[c.placedSide],
|
|
227
|
+
transform: {
|
|
228
|
+
top: "translateY(100%)",
|
|
229
|
+
right: "translateY(50%) rotate(90deg) translateX(-50%)",
|
|
230
|
+
bottom: "rotate(180deg)",
|
|
231
|
+
left: "translateY(50%) rotate(-90deg) translateX(50%)"
|
|
232
|
+
}[c.placedSide],
|
|
233
|
+
visibility: c.shouldHideArrow ? "hidden" : void 0
|
|
234
|
+
},
|
|
235
|
+
children: /* @__PURE__ */ s(
|
|
236
|
+
so,
|
|
237
|
+
{
|
|
238
|
+
...r,
|
|
239
|
+
ref: t,
|
|
240
|
+
style: {
|
|
241
|
+
...r.style,
|
|
242
|
+
// ensures the element can be measured correctly (mostly for if SVG)
|
|
243
|
+
display: "block"
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
)
|
|
247
|
+
}
|
|
248
|
+
)
|
|
249
|
+
);
|
|
250
|
+
});
|
|
251
|
+
qe.displayName = Ze;
|
|
252
|
+
function fo(e) {
|
|
253
|
+
return e !== null;
|
|
254
|
+
}
|
|
255
|
+
var mo = (e) => ({
|
|
256
|
+
name: "transformOrigin",
|
|
257
|
+
options: e,
|
|
258
|
+
fn(o) {
|
|
259
|
+
var h, _, P;
|
|
260
|
+
const { placement: t, rects: n, middlewareData: r } = o, u = ((h = r.arrow) == null ? void 0 : h.centerOffset) !== 0, d = u ? 0 : e.arrowWidth, p = u ? 0 : e.arrowHeight, [m, l] = Je(t), i = { start: "0%", center: "50%", end: "100%" }[l], f = (((_ = r.arrow) == null ? void 0 : _.x) ?? 0) + d / 2, w = (((P = r.arrow) == null ? void 0 : P.y) ?? 0) + p / 2;
|
|
261
|
+
let g = "", C = "";
|
|
262
|
+
return m === "bottom" ? (g = u ? i : `${f}px`, C = `${-p}px`) : m === "top" ? (g = u ? i : `${f}px`, C = `${n.floating.height + p}px`) : m === "right" ? (g = `${-p}px`, C = u ? i : `${w}px`) : m === "left" && (g = `${n.floating.width + p}px`, C = u ? i : `${w}px`), { data: { x: g, y: C } };
|
|
263
|
+
}
|
|
264
|
+
});
|
|
265
|
+
function Je(e) {
|
|
266
|
+
const [o, t = "center"] = e.split("-");
|
|
267
|
+
return [o, t];
|
|
268
|
+
}
|
|
269
|
+
var vo = Xe, ho = je, go = ze, wo = qe, Me = "rovingFocusGroup.onEntryFocus", Mo = { bubbles: !1, cancelable: !0 }, se = "RovingFocusGroup", [Re, Qe, Co] = $e(se), [_o, et] = ce(
|
|
270
|
+
se,
|
|
271
|
+
[Co]
|
|
272
|
+
), [Ro, Io] = _o(se), tt = a.forwardRef(
|
|
273
|
+
(e, o) => /* @__PURE__ */ s(Re.Provider, { scope: e.__scopeRovingFocusGroup, children: /* @__PURE__ */ s(Re.Slot, { scope: e.__scopeRovingFocusGroup, children: /* @__PURE__ */ s(Po, { ...e, ref: o }) }) })
|
|
274
|
+
);
|
|
275
|
+
tt.displayName = se;
|
|
276
|
+
var Po = a.forwardRef((e, o) => {
|
|
277
|
+
const {
|
|
278
|
+
__scopeRovingFocusGroup: t,
|
|
279
|
+
orientation: n,
|
|
280
|
+
loop: r = !1,
|
|
281
|
+
dir: c,
|
|
282
|
+
currentTabStopId: u,
|
|
283
|
+
defaultCurrentTabStopId: d,
|
|
284
|
+
onCurrentTabStopIdChange: p,
|
|
285
|
+
onEntryFocus: m,
|
|
286
|
+
preventScrollOnEntryFocus: l = !1,
|
|
287
|
+
...i
|
|
288
|
+
} = e, f = a.useRef(null), w = G(o, f), g = Ue(c), [C, h] = Ge({
|
|
289
|
+
prop: u,
|
|
290
|
+
defaultProp: d ?? null,
|
|
291
|
+
onChange: p,
|
|
292
|
+
caller: se
|
|
293
|
+
}), [_, P] = a.useState(!1), R = ve(m), I = Qe(t), k = a.useRef(!1), [S, N] = a.useState(0);
|
|
294
|
+
return a.useEffect(() => {
|
|
295
|
+
const y = f.current;
|
|
296
|
+
if (y)
|
|
297
|
+
return y.addEventListener(Me, R), () => y.removeEventListener(Me, R);
|
|
298
|
+
}, [R]), /* @__PURE__ */ s(
|
|
299
|
+
Ro,
|
|
300
|
+
{
|
|
301
|
+
scope: t,
|
|
302
|
+
orientation: n,
|
|
303
|
+
dir: g,
|
|
304
|
+
loop: r,
|
|
305
|
+
currentTabStopId: C,
|
|
306
|
+
onItemFocus: a.useCallback(
|
|
307
|
+
(y) => h(y),
|
|
308
|
+
[h]
|
|
309
|
+
),
|
|
310
|
+
onItemShiftTab: a.useCallback(() => P(!0), []),
|
|
311
|
+
onFocusableItemAdd: a.useCallback(
|
|
312
|
+
() => N((y) => y + 1),
|
|
313
|
+
[]
|
|
314
|
+
),
|
|
315
|
+
onFocusableItemRemove: a.useCallback(
|
|
316
|
+
() => N((y) => y - 1),
|
|
317
|
+
[]
|
|
318
|
+
),
|
|
319
|
+
children: /* @__PURE__ */ s(
|
|
320
|
+
F.div,
|
|
321
|
+
{
|
|
322
|
+
tabIndex: _ || S === 0 ? -1 : 0,
|
|
323
|
+
"data-orientation": n,
|
|
324
|
+
...i,
|
|
325
|
+
ref: w,
|
|
326
|
+
style: { outline: "none", ...e.style },
|
|
327
|
+
onMouseDown: M(e.onMouseDown, () => {
|
|
328
|
+
k.current = !0;
|
|
329
|
+
}),
|
|
330
|
+
onFocus: M(e.onFocus, (y) => {
|
|
331
|
+
const B = !k.current;
|
|
332
|
+
if (y.target === y.currentTarget && B && !_) {
|
|
333
|
+
const K = new CustomEvent(Me, Mo);
|
|
334
|
+
if (y.currentTarget.dispatchEvent(K), !K.defaultPrevented) {
|
|
335
|
+
const Y = I().filter((O) => O.focusable), H = Y.find((O) => O.active), $ = Y.find((O) => O.id === C), Z = [H, $, ...Y].filter(
|
|
336
|
+
Boolean
|
|
337
|
+
).map((O) => O.ref.current);
|
|
338
|
+
rt(Z, l);
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
k.current = !1;
|
|
342
|
+
}),
|
|
343
|
+
onBlur: M(e.onBlur, () => P(!1))
|
|
344
|
+
}
|
|
345
|
+
)
|
|
346
|
+
}
|
|
347
|
+
);
|
|
348
|
+
}), ot = "RovingFocusGroupItem", nt = a.forwardRef(
|
|
349
|
+
(e, o) => {
|
|
350
|
+
const {
|
|
351
|
+
__scopeRovingFocusGroup: t,
|
|
352
|
+
focusable: n = !0,
|
|
353
|
+
active: r = !1,
|
|
354
|
+
tabStopId: c,
|
|
355
|
+
children: u,
|
|
356
|
+
...d
|
|
357
|
+
} = e, p = _e(), m = c || p, l = Io(ot, t), i = l.currentTabStopId === m, f = Qe(t), { onFocusableItemAdd: w, onFocusableItemRemove: g, currentTabStopId: C } = l;
|
|
358
|
+
return a.useEffect(() => {
|
|
359
|
+
if (n)
|
|
360
|
+
return w(), () => g();
|
|
361
|
+
}, [n, w, g]), /* @__PURE__ */ s(
|
|
362
|
+
Re.ItemSlot,
|
|
363
|
+
{
|
|
364
|
+
scope: t,
|
|
365
|
+
id: m,
|
|
366
|
+
focusable: n,
|
|
367
|
+
active: r,
|
|
368
|
+
children: /* @__PURE__ */ s(
|
|
369
|
+
F.span,
|
|
370
|
+
{
|
|
371
|
+
tabIndex: i ? 0 : -1,
|
|
372
|
+
"data-orientation": l.orientation,
|
|
373
|
+
...d,
|
|
374
|
+
ref: o,
|
|
375
|
+
onMouseDown: M(e.onMouseDown, (h) => {
|
|
376
|
+
n ? l.onItemFocus(m) : h.preventDefault();
|
|
377
|
+
}),
|
|
378
|
+
onFocus: M(e.onFocus, () => l.onItemFocus(m)),
|
|
379
|
+
onKeyDown: M(e.onKeyDown, (h) => {
|
|
380
|
+
if (h.key === "Tab" && h.shiftKey) {
|
|
381
|
+
l.onItemShiftTab();
|
|
382
|
+
return;
|
|
383
|
+
}
|
|
384
|
+
if (h.target !== h.currentTarget)
|
|
385
|
+
return;
|
|
386
|
+
const _ = Eo(h, l.orientation, l.dir);
|
|
387
|
+
if (_ !== void 0) {
|
|
388
|
+
if (h.metaKey || h.ctrlKey || h.altKey || h.shiftKey)
|
|
389
|
+
return;
|
|
390
|
+
h.preventDefault();
|
|
391
|
+
let R = f().filter((I) => I.focusable).map((I) => I.ref.current);
|
|
392
|
+
if (_ === "last")
|
|
393
|
+
R.reverse();
|
|
394
|
+
else if (_ === "prev" || _ === "next") {
|
|
395
|
+
_ === "prev" && R.reverse();
|
|
396
|
+
const I = R.indexOf(h.currentTarget);
|
|
397
|
+
R = l.loop ? xo(R, I + 1) : R.slice(I + 1);
|
|
398
|
+
}
|
|
399
|
+
setTimeout(() => rt(R));
|
|
400
|
+
}
|
|
401
|
+
}),
|
|
402
|
+
children: typeof u == "function" ? u({ isCurrentTabStop: i, hasTabStop: C != null }) : u
|
|
403
|
+
}
|
|
404
|
+
)
|
|
405
|
+
}
|
|
406
|
+
);
|
|
407
|
+
}
|
|
408
|
+
);
|
|
409
|
+
nt.displayName = ot;
|
|
410
|
+
var yo = {
|
|
411
|
+
ArrowLeft: "prev",
|
|
412
|
+
ArrowUp: "prev",
|
|
413
|
+
ArrowRight: "next",
|
|
414
|
+
ArrowDown: "next",
|
|
415
|
+
PageUp: "first",
|
|
416
|
+
Home: "first",
|
|
417
|
+
PageDown: "last",
|
|
418
|
+
End: "last"
|
|
419
|
+
};
|
|
420
|
+
function So(e, o) {
|
|
421
|
+
return o !== "rtl" ? e : e === "ArrowLeft" ? "ArrowRight" : e === "ArrowRight" ? "ArrowLeft" : e;
|
|
422
|
+
}
|
|
423
|
+
function Eo(e, o, t) {
|
|
424
|
+
const n = So(e.key, t);
|
|
425
|
+
if (!(o === "vertical" && ["ArrowLeft", "ArrowRight"].includes(n)) && !(o === "horizontal" && ["ArrowUp", "ArrowDown"].includes(n)))
|
|
426
|
+
return yo[n];
|
|
427
|
+
}
|
|
428
|
+
function rt(e, o = !1) {
|
|
429
|
+
const t = document.activeElement;
|
|
430
|
+
for (const n of e)
|
|
431
|
+
if (n === t || (n.focus({ preventScroll: o }), document.activeElement !== t))
|
|
432
|
+
return;
|
|
433
|
+
}
|
|
434
|
+
function xo(e, o) {
|
|
435
|
+
return e.map((t, n) => e[(o + n) % e.length]);
|
|
436
|
+
}
|
|
437
|
+
var bo = tt, Ao = nt, Ie = ["Enter", " "], Do = ["ArrowDown", "PageUp", "Home"], at = ["ArrowUp", "PageDown", "End"], To = [...Do, ...at], No = {
|
|
438
|
+
ltr: [...Ie, "ArrowRight"],
|
|
439
|
+
rtl: [...Ie, "ArrowLeft"]
|
|
440
|
+
}, Oo = {
|
|
441
|
+
ltr: ["ArrowLeft"],
|
|
442
|
+
rtl: ["ArrowRight"]
|
|
443
|
+
}, ie = "Menu", [re, Fo, ko] = $e(ie), [W, ct] = ce(ie, [
|
|
444
|
+
ko,
|
|
445
|
+
He,
|
|
446
|
+
et
|
|
447
|
+
]), he = He(), st = et(), [Lo, j] = W(ie), [Go, ue] = W(ie), it = (e) => {
|
|
448
|
+
const { __scopeMenu: o, open: t = !1, children: n, dir: r, onOpenChange: c, modal: u = !0 } = e, d = he(o), [p, m] = a.useState(null), l = a.useRef(!1), i = ve(c), f = Ue(r);
|
|
449
|
+
return a.useEffect(() => {
|
|
450
|
+
const w = () => {
|
|
451
|
+
l.current = !0, document.addEventListener("pointerdown", g, { capture: !0, once: !0 }), document.addEventListener("pointermove", g, { capture: !0, once: !0 });
|
|
452
|
+
}, g = () => l.current = !1;
|
|
453
|
+
return document.addEventListener("keydown", w, { capture: !0 }), () => {
|
|
454
|
+
document.removeEventListener("keydown", w, { capture: !0 }), document.removeEventListener("pointerdown", g, { capture: !0 }), document.removeEventListener("pointermove", g, { capture: !0 });
|
|
455
|
+
};
|
|
456
|
+
}, []), /* @__PURE__ */ s(vo, { ...d, children: /* @__PURE__ */ s(
|
|
457
|
+
Lo,
|
|
458
|
+
{
|
|
459
|
+
scope: o,
|
|
460
|
+
open: t,
|
|
461
|
+
onOpenChange: i,
|
|
462
|
+
content: p,
|
|
463
|
+
onContentChange: m,
|
|
464
|
+
children: /* @__PURE__ */ s(
|
|
465
|
+
Go,
|
|
466
|
+
{
|
|
467
|
+
scope: o,
|
|
468
|
+
onClose: a.useCallback(() => i(!1), [i]),
|
|
469
|
+
isUsingKeyboardRef: l,
|
|
470
|
+
dir: f,
|
|
471
|
+
modal: u,
|
|
472
|
+
children: n
|
|
473
|
+
}
|
|
474
|
+
)
|
|
475
|
+
}
|
|
476
|
+
) });
|
|
477
|
+
};
|
|
478
|
+
it.displayName = ie;
|
|
479
|
+
var Ko = "MenuAnchor", Se = a.forwardRef(
|
|
480
|
+
(e, o) => {
|
|
481
|
+
const { __scopeMenu: t, ...n } = e, r = he(t);
|
|
482
|
+
return /* @__PURE__ */ s(ho, { ...r, ...n, ref: o });
|
|
483
|
+
}
|
|
484
|
+
);
|
|
485
|
+
Se.displayName = Ko;
|
|
486
|
+
var Ee = "MenuPortal", [$o, ut] = W(Ee, {
|
|
487
|
+
forceMount: void 0
|
|
488
|
+
}), lt = (e) => {
|
|
489
|
+
const { __scopeMenu: o, forceMount: t, children: n, container: r } = e, c = j(Ee, o);
|
|
490
|
+
return /* @__PURE__ */ s($o, { scope: o, forceMount: t, children: /* @__PURE__ */ s(me, { present: t || c.open, children: /* @__PURE__ */ s(jt, { asChild: !0, container: r, children: n }) }) });
|
|
491
|
+
};
|
|
492
|
+
lt.displayName = Ee;
|
|
493
|
+
var T = "MenuContent", [Uo, xe] = W(T), dt = a.forwardRef(
|
|
494
|
+
(e, o) => {
|
|
495
|
+
const t = ut(T, e.__scopeMenu), { forceMount: n = t.forceMount, ...r } = e, c = j(T, e.__scopeMenu), u = ue(T, e.__scopeMenu);
|
|
496
|
+
return /* @__PURE__ */ s(re.Provider, { scope: e.__scopeMenu, children: /* @__PURE__ */ s(me, { present: n || c.open, children: /* @__PURE__ */ s(re.Slot, { scope: e.__scopeMenu, children: u.modal ? /* @__PURE__ */ s(Bo, { ...r, ref: o }) : /* @__PURE__ */ s(Yo, { ...r, ref: o }) }) }) });
|
|
497
|
+
}
|
|
498
|
+
), Bo = a.forwardRef(
|
|
499
|
+
(e, o) => {
|
|
500
|
+
const t = j(T, e.__scopeMenu), n = a.useRef(null), r = G(o, n);
|
|
501
|
+
return a.useEffect(() => {
|
|
502
|
+
const c = n.current;
|
|
503
|
+
if (c)
|
|
504
|
+
return Ht(c);
|
|
505
|
+
}, []), /* @__PURE__ */ s(
|
|
506
|
+
be,
|
|
507
|
+
{
|
|
508
|
+
...e,
|
|
509
|
+
ref: r,
|
|
510
|
+
trapFocus: t.open,
|
|
511
|
+
disableOutsidePointerEvents: t.open,
|
|
512
|
+
disableOutsideScroll: !0,
|
|
513
|
+
onFocusOutside: M(
|
|
514
|
+
e.onFocusOutside,
|
|
515
|
+
(c) => c.preventDefault(),
|
|
516
|
+
{ checkForDefaultPrevented: !1 }
|
|
517
|
+
),
|
|
518
|
+
onDismiss: () => t.onOpenChange(!1)
|
|
519
|
+
}
|
|
520
|
+
);
|
|
521
|
+
}
|
|
522
|
+
), Yo = a.forwardRef((e, o) => {
|
|
523
|
+
const t = j(T, e.__scopeMenu);
|
|
524
|
+
return /* @__PURE__ */ s(
|
|
525
|
+
be,
|
|
526
|
+
{
|
|
527
|
+
...e,
|
|
528
|
+
ref: o,
|
|
529
|
+
trapFocus: !1,
|
|
530
|
+
disableOutsidePointerEvents: !1,
|
|
531
|
+
disableOutsideScroll: !1,
|
|
532
|
+
onDismiss: () => t.onOpenChange(!1)
|
|
533
|
+
}
|
|
534
|
+
);
|
|
535
|
+
}), Ho = Ce("MenuContent.ScrollLock"), be = a.forwardRef(
|
|
536
|
+
(e, o) => {
|
|
537
|
+
const {
|
|
538
|
+
__scopeMenu: t,
|
|
539
|
+
loop: n = !1,
|
|
540
|
+
trapFocus: r,
|
|
541
|
+
onOpenAutoFocus: c,
|
|
542
|
+
onCloseAutoFocus: u,
|
|
543
|
+
disableOutsidePointerEvents: d,
|
|
544
|
+
onEntryFocus: p,
|
|
545
|
+
onEscapeKeyDown: m,
|
|
546
|
+
onPointerDownOutside: l,
|
|
547
|
+
onFocusOutside: i,
|
|
548
|
+
onInteractOutside: f,
|
|
549
|
+
onDismiss: w,
|
|
550
|
+
disableOutsideScroll: g,
|
|
551
|
+
...C
|
|
552
|
+
} = e, h = j(T, t), _ = ue(T, t), P = he(t), R = st(t), I = Fo(t), [k, S] = a.useState(null), N = a.useRef(null), y = G(o, N, h.onContentChange), B = a.useRef(0), K = a.useRef(""), Y = a.useRef(0), H = a.useRef(null), $ = a.useRef("right"), z = a.useRef(0), Z = g ? Wt : a.Fragment, O = g ? { as: Ho, allowPinchZoom: !0 } : void 0, q = (v) => {
|
|
553
|
+
var U, ee;
|
|
554
|
+
const b = K.current + v, E = I().filter((D) => !D.disabled), L = document.activeElement, J = (U = E.find((D) => D.ref.current === L)) == null ? void 0 : U.textValue, Q = E.map((D) => D.textValue), le = on(Q, b, J), V = (ee = E.find((D) => D.textValue === le)) == null ? void 0 : ee.ref.current;
|
|
555
|
+
(function D(te) {
|
|
556
|
+
K.current = te, window.clearTimeout(B.current), te !== "" && (B.current = window.setTimeout(() => D(""), 1e3));
|
|
557
|
+
})(b), V && setTimeout(() => V.focus());
|
|
558
|
+
};
|
|
559
|
+
a.useEffect(() => () => window.clearTimeout(B.current), []), Vt();
|
|
560
|
+
const A = a.useCallback((v) => {
|
|
561
|
+
var E, L;
|
|
562
|
+
return $.current === ((E = H.current) == null ? void 0 : E.side) && rn(v, (L = H.current) == null ? void 0 : L.area);
|
|
563
|
+
}, []);
|
|
564
|
+
return /* @__PURE__ */ s(
|
|
565
|
+
Uo,
|
|
566
|
+
{
|
|
567
|
+
scope: t,
|
|
568
|
+
searchRef: K,
|
|
569
|
+
onItemEnter: a.useCallback(
|
|
570
|
+
(v) => {
|
|
571
|
+
A(v) && v.preventDefault();
|
|
572
|
+
},
|
|
573
|
+
[A]
|
|
574
|
+
),
|
|
575
|
+
onItemLeave: a.useCallback(
|
|
576
|
+
(v) => {
|
|
577
|
+
var b;
|
|
578
|
+
A(v) || ((b = N.current) == null || b.focus(), S(null));
|
|
579
|
+
},
|
|
580
|
+
[A]
|
|
581
|
+
),
|
|
582
|
+
onTriggerLeave: a.useCallback(
|
|
583
|
+
(v) => {
|
|
584
|
+
A(v) && v.preventDefault();
|
|
585
|
+
},
|
|
586
|
+
[A]
|
|
587
|
+
),
|
|
588
|
+
pointerGraceTimerRef: Y,
|
|
589
|
+
onPointerGraceIntentChange: a.useCallback((v) => {
|
|
590
|
+
H.current = v;
|
|
591
|
+
}, []),
|
|
592
|
+
children: /* @__PURE__ */ s(Z, { ...O, children: /* @__PURE__ */ s(
|
|
593
|
+
Xt,
|
|
594
|
+
{
|
|
595
|
+
asChild: !0,
|
|
596
|
+
trapped: r,
|
|
597
|
+
onMountAutoFocus: M(c, (v) => {
|
|
598
|
+
var b;
|
|
599
|
+
v.preventDefault(), (b = N.current) == null || b.focus({ preventScroll: !0 });
|
|
600
|
+
}),
|
|
601
|
+
onUnmountAutoFocus: u,
|
|
602
|
+
children: /* @__PURE__ */ s(
|
|
603
|
+
Yt,
|
|
604
|
+
{
|
|
605
|
+
asChild: !0,
|
|
606
|
+
disableOutsidePointerEvents: d,
|
|
607
|
+
onEscapeKeyDown: m,
|
|
608
|
+
onPointerDownOutside: l,
|
|
609
|
+
onFocusOutside: i,
|
|
610
|
+
onInteractOutside: f,
|
|
611
|
+
onDismiss: w,
|
|
612
|
+
children: /* @__PURE__ */ s(
|
|
613
|
+
bo,
|
|
614
|
+
{
|
|
615
|
+
asChild: !0,
|
|
616
|
+
...R,
|
|
617
|
+
dir: _.dir,
|
|
618
|
+
orientation: "vertical",
|
|
619
|
+
loop: n,
|
|
620
|
+
currentTabStopId: k,
|
|
621
|
+
onCurrentTabStopIdChange: S,
|
|
622
|
+
onEntryFocus: M(p, (v) => {
|
|
623
|
+
_.isUsingKeyboardRef.current || v.preventDefault();
|
|
624
|
+
}),
|
|
625
|
+
preventScrollOnEntryFocus: !0,
|
|
626
|
+
children: /* @__PURE__ */ s(
|
|
627
|
+
go,
|
|
628
|
+
{
|
|
629
|
+
role: "menu",
|
|
630
|
+
"aria-orientation": "vertical",
|
|
631
|
+
"data-state": Et(h.open),
|
|
632
|
+
"data-radix-menu-content": "",
|
|
633
|
+
dir: _.dir,
|
|
634
|
+
...P,
|
|
635
|
+
...C,
|
|
636
|
+
ref: y,
|
|
637
|
+
style: { outline: "none", ...C.style },
|
|
638
|
+
onKeyDown: M(C.onKeyDown, (v) => {
|
|
639
|
+
const E = v.target.closest("[data-radix-menu-content]") === v.currentTarget, L = v.ctrlKey || v.altKey || v.metaKey, J = v.key.length === 1;
|
|
640
|
+
E && (v.key === "Tab" && v.preventDefault(), !L && J && q(v.key));
|
|
641
|
+
const Q = N.current;
|
|
642
|
+
if (v.target !== Q || !To.includes(v.key))
|
|
643
|
+
return;
|
|
644
|
+
v.preventDefault();
|
|
645
|
+
const V = I().filter((U) => !U.disabled).map((U) => U.ref.current);
|
|
646
|
+
at.includes(v.key) && V.reverse(), en(V);
|
|
647
|
+
}),
|
|
648
|
+
onBlur: M(e.onBlur, (v) => {
|
|
649
|
+
v.currentTarget.contains(v.target) || (window.clearTimeout(B.current), K.current = "");
|
|
650
|
+
}),
|
|
651
|
+
onPointerMove: M(
|
|
652
|
+
e.onPointerMove,
|
|
653
|
+
ae((v) => {
|
|
654
|
+
const b = v.target, E = z.current !== v.clientX;
|
|
655
|
+
if (v.currentTarget.contains(b) && E) {
|
|
656
|
+
const L = v.clientX > z.current ? "right" : "left";
|
|
657
|
+
$.current = L, z.current = v.clientX;
|
|
658
|
+
}
|
|
659
|
+
})
|
|
660
|
+
)
|
|
661
|
+
}
|
|
662
|
+
)
|
|
663
|
+
}
|
|
664
|
+
)
|
|
665
|
+
}
|
|
666
|
+
)
|
|
667
|
+
}
|
|
668
|
+
) })
|
|
669
|
+
}
|
|
670
|
+
);
|
|
671
|
+
}
|
|
672
|
+
);
|
|
673
|
+
dt.displayName = T;
|
|
674
|
+
var Vo = "MenuGroup", Ae = a.forwardRef(
|
|
675
|
+
(e, o) => {
|
|
676
|
+
const { __scopeMenu: t, ...n } = e;
|
|
677
|
+
return /* @__PURE__ */ s(F.div, { role: "group", ...n, ref: o });
|
|
678
|
+
}
|
|
679
|
+
);
|
|
680
|
+
Ae.displayName = Vo;
|
|
681
|
+
var Xo = "MenuLabel", pt = a.forwardRef(
|
|
682
|
+
(e, o) => {
|
|
683
|
+
const { __scopeMenu: t, ...n } = e;
|
|
684
|
+
return /* @__PURE__ */ s(F.div, { ...n, ref: o });
|
|
685
|
+
}
|
|
686
|
+
);
|
|
687
|
+
pt.displayName = Xo;
|
|
688
|
+
var pe = "MenuItem", Le = "menu.itemSelect", ge = a.forwardRef(
|
|
689
|
+
(e, o) => {
|
|
690
|
+
const { disabled: t = !1, onSelect: n, ...r } = e, c = a.useRef(null), u = ue(pe, e.__scopeMenu), d = xe(pe, e.__scopeMenu), p = G(o, c), m = a.useRef(!1), l = () => {
|
|
691
|
+
const i = c.current;
|
|
692
|
+
if (!t && i) {
|
|
693
|
+
const f = new CustomEvent(Le, { bubbles: !0, cancelable: !0 });
|
|
694
|
+
i.addEventListener(Le, (w) => n == null ? void 0 : n(w), { once: !0 }), Bt(i, f), f.defaultPrevented ? m.current = !1 : u.onClose();
|
|
695
|
+
}
|
|
696
|
+
};
|
|
697
|
+
return /* @__PURE__ */ s(
|
|
698
|
+
ft,
|
|
699
|
+
{
|
|
700
|
+
...r,
|
|
701
|
+
ref: p,
|
|
702
|
+
disabled: t,
|
|
703
|
+
onClick: M(e.onClick, l),
|
|
704
|
+
onPointerDown: (i) => {
|
|
705
|
+
var f;
|
|
706
|
+
(f = e.onPointerDown) == null || f.call(e, i), m.current = !0;
|
|
707
|
+
},
|
|
708
|
+
onPointerUp: M(e.onPointerUp, (i) => {
|
|
709
|
+
var f;
|
|
710
|
+
m.current || (f = i.currentTarget) == null || f.click();
|
|
711
|
+
}),
|
|
712
|
+
onKeyDown: M(e.onKeyDown, (i) => {
|
|
713
|
+
const f = d.searchRef.current !== "";
|
|
714
|
+
t || f && i.key === " " || Ie.includes(i.key) && (i.currentTarget.click(), i.preventDefault());
|
|
715
|
+
})
|
|
716
|
+
}
|
|
717
|
+
);
|
|
718
|
+
}
|
|
719
|
+
);
|
|
720
|
+
ge.displayName = pe;
|
|
721
|
+
var ft = a.forwardRef(
|
|
722
|
+
(e, o) => {
|
|
723
|
+
const { __scopeMenu: t, disabled: n = !1, textValue: r, ...c } = e, u = xe(pe, t), d = st(t), p = a.useRef(null), m = G(o, p), [l, i] = a.useState(!1), [f, w] = a.useState("");
|
|
724
|
+
return a.useEffect(() => {
|
|
725
|
+
const g = p.current;
|
|
726
|
+
g && w((g.textContent ?? "").trim());
|
|
727
|
+
}, [c.children]), /* @__PURE__ */ s(
|
|
728
|
+
re.ItemSlot,
|
|
729
|
+
{
|
|
730
|
+
scope: t,
|
|
731
|
+
disabled: n,
|
|
732
|
+
textValue: r ?? f,
|
|
733
|
+
children: /* @__PURE__ */ s(Ao, { asChild: !0, ...d, focusable: !n, children: /* @__PURE__ */ s(
|
|
734
|
+
F.div,
|
|
735
|
+
{
|
|
736
|
+
role: "menuitem",
|
|
737
|
+
"data-highlighted": l ? "" : void 0,
|
|
738
|
+
"aria-disabled": n || void 0,
|
|
739
|
+
"data-disabled": n ? "" : void 0,
|
|
740
|
+
...c,
|
|
741
|
+
ref: m,
|
|
742
|
+
onPointerMove: M(
|
|
743
|
+
e.onPointerMove,
|
|
744
|
+
ae((g) => {
|
|
745
|
+
n ? u.onItemLeave(g) : (u.onItemEnter(g), g.defaultPrevented || g.currentTarget.focus({ preventScroll: !0 }));
|
|
746
|
+
})
|
|
747
|
+
),
|
|
748
|
+
onPointerLeave: M(
|
|
749
|
+
e.onPointerLeave,
|
|
750
|
+
ae((g) => u.onItemLeave(g))
|
|
751
|
+
),
|
|
752
|
+
onFocus: M(e.onFocus, () => i(!0)),
|
|
753
|
+
onBlur: M(e.onBlur, () => i(!1))
|
|
754
|
+
}
|
|
755
|
+
) })
|
|
756
|
+
}
|
|
757
|
+
);
|
|
758
|
+
}
|
|
759
|
+
), Wo = "MenuCheckboxItem", mt = a.forwardRef(
|
|
760
|
+
(e, o) => {
|
|
761
|
+
const { checked: t = !1, onCheckedChange: n, ...r } = e;
|
|
762
|
+
return /* @__PURE__ */ s(Mt, { scope: e.__scopeMenu, checked: t, children: /* @__PURE__ */ s(
|
|
763
|
+
ge,
|
|
764
|
+
{
|
|
765
|
+
role: "menuitemcheckbox",
|
|
766
|
+
"aria-checked": fe(t) ? "mixed" : t,
|
|
767
|
+
...r,
|
|
768
|
+
ref: o,
|
|
769
|
+
"data-state": Te(t),
|
|
770
|
+
onSelect: M(
|
|
771
|
+
r.onSelect,
|
|
772
|
+
() => n == null ? void 0 : n(fe(t) ? !0 : !t),
|
|
773
|
+
{ checkForDefaultPrevented: !1 }
|
|
774
|
+
)
|
|
775
|
+
}
|
|
776
|
+
) });
|
|
777
|
+
}
|
|
778
|
+
);
|
|
779
|
+
mt.displayName = Wo;
|
|
780
|
+
var vt = "MenuRadioGroup", [jo, zo] = W(
|
|
781
|
+
vt,
|
|
782
|
+
{ value: void 0, onValueChange: () => {
|
|
783
|
+
} }
|
|
784
|
+
), ht = a.forwardRef(
|
|
785
|
+
(e, o) => {
|
|
786
|
+
const { value: t, onValueChange: n, ...r } = e, c = ve(n);
|
|
787
|
+
return /* @__PURE__ */ s(jo, { scope: e.__scopeMenu, value: t, onValueChange: c, children: /* @__PURE__ */ s(Ae, { ...r, ref: o }) });
|
|
788
|
+
}
|
|
789
|
+
);
|
|
790
|
+
ht.displayName = vt;
|
|
791
|
+
var gt = "MenuRadioItem", wt = a.forwardRef(
|
|
792
|
+
(e, o) => {
|
|
793
|
+
const { value: t, ...n } = e, r = zo(gt, e.__scopeMenu), c = t === r.value;
|
|
794
|
+
return /* @__PURE__ */ s(Mt, { scope: e.__scopeMenu, checked: c, children: /* @__PURE__ */ s(
|
|
795
|
+
ge,
|
|
796
|
+
{
|
|
797
|
+
role: "menuitemradio",
|
|
798
|
+
"aria-checked": c,
|
|
799
|
+
...n,
|
|
800
|
+
ref: o,
|
|
801
|
+
"data-state": Te(c),
|
|
802
|
+
onSelect: M(
|
|
803
|
+
n.onSelect,
|
|
804
|
+
() => {
|
|
805
|
+
var u;
|
|
806
|
+
return (u = r.onValueChange) == null ? void 0 : u.call(r, t);
|
|
807
|
+
},
|
|
808
|
+
{ checkForDefaultPrevented: !1 }
|
|
809
|
+
)
|
|
810
|
+
}
|
|
811
|
+
) });
|
|
812
|
+
}
|
|
813
|
+
);
|
|
814
|
+
wt.displayName = gt;
|
|
815
|
+
var De = "MenuItemIndicator", [Mt, Zo] = W(
|
|
816
|
+
De,
|
|
817
|
+
{ checked: !1 }
|
|
818
|
+
), Ct = a.forwardRef(
|
|
819
|
+
(e, o) => {
|
|
820
|
+
const { __scopeMenu: t, forceMount: n, ...r } = e, c = Zo(De, t);
|
|
821
|
+
return /* @__PURE__ */ s(
|
|
822
|
+
me,
|
|
823
|
+
{
|
|
824
|
+
present: n || fe(c.checked) || c.checked === !0,
|
|
825
|
+
children: /* @__PURE__ */ s(
|
|
826
|
+
F.span,
|
|
827
|
+
{
|
|
828
|
+
...r,
|
|
829
|
+
ref: o,
|
|
830
|
+
"data-state": Te(c.checked)
|
|
831
|
+
}
|
|
832
|
+
)
|
|
833
|
+
}
|
|
834
|
+
);
|
|
835
|
+
}
|
|
836
|
+
);
|
|
837
|
+
Ct.displayName = De;
|
|
838
|
+
var qo = "MenuSeparator", _t = a.forwardRef(
|
|
839
|
+
(e, o) => {
|
|
840
|
+
const { __scopeMenu: t, ...n } = e;
|
|
841
|
+
return /* @__PURE__ */ s(
|
|
842
|
+
F.div,
|
|
843
|
+
{
|
|
844
|
+
role: "separator",
|
|
845
|
+
"aria-orientation": "horizontal",
|
|
846
|
+
...n,
|
|
847
|
+
ref: o
|
|
848
|
+
}
|
|
849
|
+
);
|
|
850
|
+
}
|
|
851
|
+
);
|
|
852
|
+
_t.displayName = qo;
|
|
853
|
+
var Jo = "MenuArrow", Rt = a.forwardRef(
|
|
854
|
+
(e, o) => {
|
|
855
|
+
const { __scopeMenu: t, ...n } = e, r = he(t);
|
|
856
|
+
return /* @__PURE__ */ s(wo, { ...r, ...n, ref: o });
|
|
857
|
+
}
|
|
858
|
+
);
|
|
859
|
+
Rt.displayName = Jo;
|
|
860
|
+
var Qo = "MenuSub", [Zn, It] = W(Qo), ne = "MenuSubTrigger", Pt = a.forwardRef(
|
|
861
|
+
(e, o) => {
|
|
862
|
+
const t = j(ne, e.__scopeMenu), n = ue(ne, e.__scopeMenu), r = It(ne, e.__scopeMenu), c = xe(ne, e.__scopeMenu), u = a.useRef(null), { pointerGraceTimerRef: d, onPointerGraceIntentChange: p } = c, m = { __scopeMenu: e.__scopeMenu }, l = a.useCallback(() => {
|
|
863
|
+
u.current && window.clearTimeout(u.current), u.current = null;
|
|
864
|
+
}, []);
|
|
865
|
+
return a.useEffect(() => l, [l]), a.useEffect(() => {
|
|
866
|
+
const i = d.current;
|
|
867
|
+
return () => {
|
|
868
|
+
window.clearTimeout(i), p(null);
|
|
869
|
+
};
|
|
870
|
+
}, [d, p]), /* @__PURE__ */ s(Se, { asChild: !0, ...m, children: /* @__PURE__ */ s(
|
|
871
|
+
ft,
|
|
872
|
+
{
|
|
873
|
+
id: r.triggerId,
|
|
874
|
+
"aria-haspopup": "menu",
|
|
875
|
+
"aria-expanded": t.open,
|
|
876
|
+
"aria-controls": r.contentId,
|
|
877
|
+
"data-state": Et(t.open),
|
|
878
|
+
...e,
|
|
879
|
+
ref: Ke(o, r.onTriggerChange),
|
|
880
|
+
onClick: (i) => {
|
|
881
|
+
var f;
|
|
882
|
+
(f = e.onClick) == null || f.call(e, i), !(e.disabled || i.defaultPrevented) && (i.currentTarget.focus(), t.open || t.onOpenChange(!0));
|
|
883
|
+
},
|
|
884
|
+
onPointerMove: M(
|
|
885
|
+
e.onPointerMove,
|
|
886
|
+
ae((i) => {
|
|
887
|
+
c.onItemEnter(i), !i.defaultPrevented && !e.disabled && !t.open && !u.current && (c.onPointerGraceIntentChange(null), u.current = window.setTimeout(() => {
|
|
888
|
+
t.onOpenChange(!0), l();
|
|
889
|
+
}, 100));
|
|
890
|
+
})
|
|
891
|
+
),
|
|
892
|
+
onPointerLeave: M(
|
|
893
|
+
e.onPointerLeave,
|
|
894
|
+
ae((i) => {
|
|
895
|
+
var w, g;
|
|
896
|
+
l();
|
|
897
|
+
const f = (w = t.content) == null ? void 0 : w.getBoundingClientRect();
|
|
898
|
+
if (f) {
|
|
899
|
+
const C = (g = t.content) == null ? void 0 : g.dataset.side, h = C === "right", _ = h ? -5 : 5, P = f[h ? "left" : "right"], R = f[h ? "right" : "left"];
|
|
900
|
+
c.onPointerGraceIntentChange({
|
|
901
|
+
area: [
|
|
902
|
+
// Apply a bleed on clientX to ensure that our exit point is
|
|
903
|
+
// consistently within polygon bounds
|
|
904
|
+
{ x: i.clientX + _, y: i.clientY },
|
|
905
|
+
{ x: P, y: f.top },
|
|
906
|
+
{ x: R, y: f.top },
|
|
907
|
+
{ x: R, y: f.bottom },
|
|
908
|
+
{ x: P, y: f.bottom }
|
|
909
|
+
],
|
|
910
|
+
side: C
|
|
911
|
+
}), window.clearTimeout(d.current), d.current = window.setTimeout(
|
|
912
|
+
() => c.onPointerGraceIntentChange(null),
|
|
913
|
+
300
|
|
914
|
+
);
|
|
915
|
+
} else {
|
|
916
|
+
if (c.onTriggerLeave(i), i.defaultPrevented)
|
|
917
|
+
return;
|
|
918
|
+
c.onPointerGraceIntentChange(null);
|
|
919
|
+
}
|
|
920
|
+
})
|
|
921
|
+
),
|
|
922
|
+
onKeyDown: M(e.onKeyDown, (i) => {
|
|
923
|
+
var w;
|
|
924
|
+
const f = c.searchRef.current !== "";
|
|
925
|
+
e.disabled || f && i.key === " " || No[n.dir].includes(i.key) && (t.onOpenChange(!0), (w = t.content) == null || w.focus(), i.preventDefault());
|
|
926
|
+
})
|
|
927
|
+
}
|
|
928
|
+
) });
|
|
929
|
+
}
|
|
930
|
+
);
|
|
931
|
+
Pt.displayName = ne;
|
|
932
|
+
var yt = "MenuSubContent", St = a.forwardRef(
|
|
933
|
+
(e, o) => {
|
|
934
|
+
const t = ut(T, e.__scopeMenu), { forceMount: n = t.forceMount, ...r } = e, c = j(T, e.__scopeMenu), u = ue(T, e.__scopeMenu), d = It(yt, e.__scopeMenu), p = a.useRef(null), m = G(o, p);
|
|
935
|
+
return /* @__PURE__ */ s(re.Provider, { scope: e.__scopeMenu, children: /* @__PURE__ */ s(me, { present: n || c.open, children: /* @__PURE__ */ s(re.Slot, { scope: e.__scopeMenu, children: /* @__PURE__ */ s(
|
|
936
|
+
be,
|
|
937
|
+
{
|
|
938
|
+
id: d.contentId,
|
|
939
|
+
"aria-labelledby": d.triggerId,
|
|
940
|
+
...r,
|
|
941
|
+
ref: m,
|
|
942
|
+
align: "start",
|
|
943
|
+
side: u.dir === "rtl" ? "left" : "right",
|
|
944
|
+
disableOutsidePointerEvents: !1,
|
|
945
|
+
disableOutsideScroll: !1,
|
|
946
|
+
trapFocus: !1,
|
|
947
|
+
onOpenAutoFocus: (l) => {
|
|
948
|
+
var i;
|
|
949
|
+
u.isUsingKeyboardRef.current && ((i = p.current) == null || i.focus()), l.preventDefault();
|
|
950
|
+
},
|
|
951
|
+
onCloseAutoFocus: (l) => l.preventDefault(),
|
|
952
|
+
onFocusOutside: M(e.onFocusOutside, (l) => {
|
|
953
|
+
l.target !== d.trigger && c.onOpenChange(!1);
|
|
954
|
+
}),
|
|
955
|
+
onEscapeKeyDown: M(e.onEscapeKeyDown, (l) => {
|
|
956
|
+
u.onClose(), l.preventDefault();
|
|
957
|
+
}),
|
|
958
|
+
onKeyDown: M(e.onKeyDown, (l) => {
|
|
959
|
+
var w;
|
|
960
|
+
const i = l.currentTarget.contains(l.target), f = Oo[u.dir].includes(l.key);
|
|
961
|
+
i && f && (c.onOpenChange(!1), (w = d.trigger) == null || w.focus(), l.preventDefault());
|
|
962
|
+
})
|
|
963
|
+
}
|
|
964
|
+
) }) }) });
|
|
965
|
+
}
|
|
966
|
+
);
|
|
967
|
+
St.displayName = yt;
|
|
968
|
+
function Et(e) {
|
|
969
|
+
return e ? "open" : "closed";
|
|
970
|
+
}
|
|
971
|
+
function fe(e) {
|
|
972
|
+
return e === "indeterminate";
|
|
973
|
+
}
|
|
974
|
+
function Te(e) {
|
|
975
|
+
return fe(e) ? "indeterminate" : e ? "checked" : "unchecked";
|
|
976
|
+
}
|
|
977
|
+
function en(e) {
|
|
978
|
+
const o = document.activeElement;
|
|
979
|
+
for (const t of e)
|
|
980
|
+
if (t === o || (t.focus(), document.activeElement !== o))
|
|
981
|
+
return;
|
|
982
|
+
}
|
|
983
|
+
function tn(e, o) {
|
|
984
|
+
return e.map((t, n) => e[(o + n) % e.length]);
|
|
985
|
+
}
|
|
986
|
+
function on(e, o, t) {
|
|
987
|
+
const r = o.length > 1 && Array.from(o).every((m) => m === o[0]) ? o[0] : o, c = t ? e.indexOf(t) : -1;
|
|
988
|
+
let u = tn(e, Math.max(c, 0));
|
|
989
|
+
r.length === 1 && (u = u.filter((m) => m !== t));
|
|
990
|
+
const p = u.find(
|
|
991
|
+
(m) => m.toLowerCase().startsWith(r.toLowerCase())
|
|
992
|
+
);
|
|
993
|
+
return p !== t ? p : void 0;
|
|
994
|
+
}
|
|
995
|
+
function nn(e, o) {
|
|
996
|
+
const { x: t, y: n } = e;
|
|
997
|
+
let r = !1;
|
|
998
|
+
for (let c = 0, u = o.length - 1; c < o.length; u = c++) {
|
|
999
|
+
const d = o[c], p = o[u], m = d.x, l = d.y, i = p.x, f = p.y;
|
|
1000
|
+
l > n != f > n && t < (i - m) * (n - l) / (f - l) + m && (r = !r);
|
|
1001
|
+
}
|
|
1002
|
+
return r;
|
|
1003
|
+
}
|
|
1004
|
+
function rn(e, o) {
|
|
1005
|
+
if (!o)
|
|
1006
|
+
return !1;
|
|
1007
|
+
const t = { x: e.clientX, y: e.clientY };
|
|
1008
|
+
return nn(t, o);
|
|
1009
|
+
}
|
|
1010
|
+
function ae(e) {
|
|
1011
|
+
return (o) => o.pointerType === "mouse" ? e(o) : void 0;
|
|
1012
|
+
}
|
|
1013
|
+
var an = it, cn = Se, sn = lt, un = dt, ln = Ae, dn = pt, pn = ge, fn = mt, mn = ht, vn = wt, hn = Ct, gn = _t, wn = Rt, Mn = Pt, Cn = St, we = "DropdownMenu", [_n, qn] = ce(
|
|
1014
|
+
we,
|
|
1015
|
+
[ct]
|
|
1016
|
+
), x = ct(), [Rn, xt] = _n(we), bt = (e) => {
|
|
1017
|
+
const {
|
|
1018
|
+
__scopeDropdownMenu: o,
|
|
1019
|
+
children: t,
|
|
1020
|
+
dir: n,
|
|
1021
|
+
open: r,
|
|
1022
|
+
defaultOpen: c,
|
|
1023
|
+
onOpenChange: u,
|
|
1024
|
+
modal: d = !0
|
|
1025
|
+
} = e, p = x(o), m = a.useRef(null), [l, i] = Ge({
|
|
1026
|
+
prop: r,
|
|
1027
|
+
defaultProp: c ?? !1,
|
|
1028
|
+
onChange: u,
|
|
1029
|
+
caller: we
|
|
1030
|
+
});
|
|
1031
|
+
return /* @__PURE__ */ s(
|
|
1032
|
+
Rn,
|
|
1033
|
+
{
|
|
1034
|
+
scope: o,
|
|
1035
|
+
triggerId: _e(),
|
|
1036
|
+
triggerRef: m,
|
|
1037
|
+
contentId: _e(),
|
|
1038
|
+
open: l,
|
|
1039
|
+
onOpenChange: i,
|
|
1040
|
+
onOpenToggle: a.useCallback(() => i((f) => !f), [i]),
|
|
1041
|
+
modal: d,
|
|
1042
|
+
children: /* @__PURE__ */ s(an, { ...p, open: l, onOpenChange: i, dir: n, modal: d, children: t })
|
|
1043
|
+
}
|
|
1044
|
+
);
|
|
1045
|
+
};
|
|
1046
|
+
bt.displayName = we;
|
|
1047
|
+
var At = "DropdownMenuTrigger", Dt = a.forwardRef(
|
|
1048
|
+
(e, o) => {
|
|
1049
|
+
const { __scopeDropdownMenu: t, disabled: n = !1, ...r } = e, c = xt(At, t), u = x(t);
|
|
1050
|
+
return /* @__PURE__ */ s(cn, { asChild: !0, ...u, children: /* @__PURE__ */ s(
|
|
1051
|
+
F.button,
|
|
1052
|
+
{
|
|
1053
|
+
type: "button",
|
|
1054
|
+
id: c.triggerId,
|
|
1055
|
+
"aria-haspopup": "menu",
|
|
1056
|
+
"aria-expanded": c.open,
|
|
1057
|
+
"aria-controls": c.open ? c.contentId : void 0,
|
|
1058
|
+
"data-state": c.open ? "open" : "closed",
|
|
1059
|
+
"data-disabled": n ? "" : void 0,
|
|
1060
|
+
disabled: n,
|
|
1061
|
+
...r,
|
|
1062
|
+
ref: Ke(o, c.triggerRef),
|
|
1063
|
+
onPointerDown: M(e.onPointerDown, (d) => {
|
|
1064
|
+
!n && d.button === 0 && d.ctrlKey === !1 && (c.onOpenToggle(), c.open || d.preventDefault());
|
|
1065
|
+
}),
|
|
1066
|
+
onKeyDown: M(e.onKeyDown, (d) => {
|
|
1067
|
+
n || (["Enter", " "].includes(d.key) && c.onOpenToggle(), d.key === "ArrowDown" && c.onOpenChange(!0), ["Enter", " ", "ArrowDown"].includes(d.key) && d.preventDefault());
|
|
1068
|
+
})
|
|
1069
|
+
}
|
|
1070
|
+
) });
|
|
1071
|
+
}
|
|
1072
|
+
);
|
|
1073
|
+
Dt.displayName = At;
|
|
1074
|
+
var In = "DropdownMenuPortal", Tt = (e) => {
|
|
1075
|
+
const { __scopeDropdownMenu: o, ...t } = e, n = x(o);
|
|
1076
|
+
return /* @__PURE__ */ s(sn, { ...n, ...t });
|
|
1077
|
+
};
|
|
1078
|
+
Tt.displayName = In;
|
|
1079
|
+
var Nt = "DropdownMenuContent", Ot = a.forwardRef(
|
|
1080
|
+
(e, o) => {
|
|
1081
|
+
const { __scopeDropdownMenu: t, ...n } = e, r = xt(Nt, t), c = x(t), u = a.useRef(!1);
|
|
1082
|
+
return /* @__PURE__ */ s(
|
|
1083
|
+
un,
|
|
1084
|
+
{
|
|
1085
|
+
id: r.contentId,
|
|
1086
|
+
"aria-labelledby": r.triggerId,
|
|
1087
|
+
...c,
|
|
1088
|
+
...n,
|
|
1089
|
+
ref: o,
|
|
1090
|
+
onCloseAutoFocus: M(e.onCloseAutoFocus, (d) => {
|
|
1091
|
+
var p;
|
|
1092
|
+
u.current || (p = r.triggerRef.current) == null || p.focus(), u.current = !1, d.preventDefault();
|
|
1093
|
+
}),
|
|
1094
|
+
onInteractOutside: M(e.onInteractOutside, (d) => {
|
|
1095
|
+
const p = d.detail.originalEvent, m = p.button === 0 && p.ctrlKey === !0, l = p.button === 2 || m;
|
|
1096
|
+
(!r.modal || l) && (u.current = !0);
|
|
1097
|
+
}),
|
|
1098
|
+
style: {
|
|
1099
|
+
...e.style,
|
|
1100
|
+
"--radix-dropdown-menu-content-transform-origin": "var(--radix-popper-transform-origin)",
|
|
1101
|
+
"--radix-dropdown-menu-content-available-width": "var(--radix-popper-available-width)",
|
|
1102
|
+
"--radix-dropdown-menu-content-available-height": "var(--radix-popper-available-height)",
|
|
1103
|
+
"--radix-dropdown-menu-trigger-width": "var(--radix-popper-anchor-width)",
|
|
1104
|
+
"--radix-dropdown-menu-trigger-height": "var(--radix-popper-anchor-height)"
|
|
1105
|
+
}
|
|
1106
|
+
}
|
|
1107
|
+
);
|
|
1108
|
+
}
|
|
1109
|
+
);
|
|
1110
|
+
Ot.displayName = Nt;
|
|
1111
|
+
var Pn = "DropdownMenuGroup", Ft = a.forwardRef(
|
|
1112
|
+
(e, o) => {
|
|
1113
|
+
const { __scopeDropdownMenu: t, ...n } = e, r = x(t);
|
|
1114
|
+
return /* @__PURE__ */ s(ln, { ...r, ...n, ref: o });
|
|
1115
|
+
}
|
|
1116
|
+
);
|
|
1117
|
+
Ft.displayName = Pn;
|
|
1118
|
+
var yn = "DropdownMenuLabel", Sn = a.forwardRef(
|
|
1119
|
+
(e, o) => {
|
|
1120
|
+
const { __scopeDropdownMenu: t, ...n } = e, r = x(t);
|
|
1121
|
+
return /* @__PURE__ */ s(dn, { ...r, ...n, ref: o });
|
|
1122
|
+
}
|
|
1123
|
+
);
|
|
1124
|
+
Sn.displayName = yn;
|
|
1125
|
+
var En = "DropdownMenuItem", kt = a.forwardRef(
|
|
1126
|
+
(e, o) => {
|
|
1127
|
+
const { __scopeDropdownMenu: t, ...n } = e, r = x(t);
|
|
1128
|
+
return /* @__PURE__ */ s(pn, { ...r, ...n, ref: o });
|
|
1129
|
+
}
|
|
1130
|
+
);
|
|
1131
|
+
kt.displayName = En;
|
|
1132
|
+
var xn = "DropdownMenuCheckboxItem", bn = a.forwardRef((e, o) => {
|
|
1133
|
+
const { __scopeDropdownMenu: t, ...n } = e, r = x(t);
|
|
1134
|
+
return /* @__PURE__ */ s(fn, { ...r, ...n, ref: o });
|
|
1135
|
+
});
|
|
1136
|
+
bn.displayName = xn;
|
|
1137
|
+
var An = "DropdownMenuRadioGroup", Dn = a.forwardRef((e, o) => {
|
|
1138
|
+
const { __scopeDropdownMenu: t, ...n } = e, r = x(t);
|
|
1139
|
+
return /* @__PURE__ */ s(mn, { ...r, ...n, ref: o });
|
|
1140
|
+
});
|
|
1141
|
+
Dn.displayName = An;
|
|
1142
|
+
var Tn = "DropdownMenuRadioItem", Nn = a.forwardRef((e, o) => {
|
|
1143
|
+
const { __scopeDropdownMenu: t, ...n } = e, r = x(t);
|
|
1144
|
+
return /* @__PURE__ */ s(vn, { ...r, ...n, ref: o });
|
|
1145
|
+
});
|
|
1146
|
+
Nn.displayName = Tn;
|
|
1147
|
+
var On = "DropdownMenuItemIndicator", Fn = a.forwardRef((e, o) => {
|
|
1148
|
+
const { __scopeDropdownMenu: t, ...n } = e, r = x(t);
|
|
1149
|
+
return /* @__PURE__ */ s(hn, { ...r, ...n, ref: o });
|
|
1150
|
+
});
|
|
1151
|
+
Fn.displayName = On;
|
|
1152
|
+
var kn = "DropdownMenuSeparator", Lt = a.forwardRef((e, o) => {
|
|
1153
|
+
const { __scopeDropdownMenu: t, ...n } = e, r = x(t);
|
|
1154
|
+
return /* @__PURE__ */ s(gn, { ...r, ...n, ref: o });
|
|
1155
|
+
});
|
|
1156
|
+
Lt.displayName = kn;
|
|
1157
|
+
var Ln = "DropdownMenuArrow", Gn = a.forwardRef(
|
|
1158
|
+
(e, o) => {
|
|
1159
|
+
const { __scopeDropdownMenu: t, ...n } = e, r = x(t);
|
|
1160
|
+
return /* @__PURE__ */ s(wn, { ...r, ...n, ref: o });
|
|
1161
|
+
}
|
|
1162
|
+
);
|
|
1163
|
+
Gn.displayName = Ln;
|
|
1164
|
+
var Kn = "DropdownMenuSubTrigger", $n = a.forwardRef((e, o) => {
|
|
1165
|
+
const { __scopeDropdownMenu: t, ...n } = e, r = x(t);
|
|
1166
|
+
return /* @__PURE__ */ s(Mn, { ...r, ...n, ref: o });
|
|
1167
|
+
});
|
|
1168
|
+
$n.displayName = Kn;
|
|
1169
|
+
var Un = "DropdownMenuSubContent", Bn = a.forwardRef((e, o) => {
|
|
1170
|
+
const { __scopeDropdownMenu: t, ...n } = e, r = x(t);
|
|
1171
|
+
return /* @__PURE__ */ s(
|
|
1172
|
+
Cn,
|
|
1173
|
+
{
|
|
1174
|
+
...r,
|
|
1175
|
+
...n,
|
|
1176
|
+
ref: o,
|
|
1177
|
+
style: {
|
|
1178
|
+
...e.style,
|
|
1179
|
+
"--radix-dropdown-menu-content-transform-origin": "var(--radix-popper-transform-origin)",
|
|
1180
|
+
"--radix-dropdown-menu-content-available-width": "var(--radix-popper-available-width)",
|
|
1181
|
+
"--radix-dropdown-menu-content-available-height": "var(--radix-popper-available-height)",
|
|
1182
|
+
"--radix-dropdown-menu-trigger-width": "var(--radix-popper-anchor-width)",
|
|
1183
|
+
"--radix-dropdown-menu-trigger-height": "var(--radix-popper-anchor-height)"
|
|
1184
|
+
}
|
|
1185
|
+
}
|
|
1186
|
+
);
|
|
1187
|
+
});
|
|
1188
|
+
Bn.displayName = Un;
|
|
1189
|
+
var Jn = bt, Qn = Dt, er = Tt, tr = Ot, or = Ft, nr = kt, rr = Lt;
|
|
1190
|
+
export {
|
|
1191
|
+
tr as C,
|
|
1192
|
+
or as G,
|
|
1193
|
+
nr as I,
|
|
1194
|
+
er as P,
|
|
1195
|
+
Jn as R,
|
|
1196
|
+
rr as S,
|
|
1197
|
+
Qn as T
|
|
1198
|
+
};
|