@fuma-content/studio 1.0.3 → 1.0.4

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.
Files changed (109) hide show
  1. package/build/client/assets/{QueryClientProvider-Cys2v_1v.js → QueryClientProvider-BFSUF51X.js} +1 -1
  2. package/build/client/assets/actions-ByenKsIt.js +1 -0
  3. package/build/client/assets/actions-ClHPL1CP.js +1 -0
  4. package/build/client/assets/badge-BnhEE6iu.js +1 -0
  5. package/build/client/assets/{client-Cfd36Zz-.js → client-BEKU4RIg.js} +146 -146
  6. package/build/client/assets/client-DBU2dkUR.js +1 -0
  7. package/build/client/assets/client-DvwvjHta.js +1 -0
  8. package/build/client/assets/client-wd2sce2I.js +8 -0
  9. package/build/client/assets/dropdown-menu-By_XeFX4.js +1 -0
  10. package/build/client/assets/entry.rsc-J_U0YQEr.js +1 -0
  11. package/build/client/assets/{index-DL539Bhx.js → index-B5GacMxj.js} +1 -1
  12. package/build/client/assets/index-BTaHNKf7.js +1 -0
  13. package/build/client/assets/index-BgFxGtat.js +1 -0
  14. package/build/client/assets/index-CG_0cSZQ.js +1 -0
  15. package/build/client/assets/index-CfCSvolS.js +1 -0
  16. package/build/client/assets/{index-C37mbJ0i.js → index-D8KuzOxG.js} +1 -1
  17. package/build/client/assets/index-DrT4Adhh.js +41 -0
  18. package/build/client/assets/{index-DXHuzvfN.js → index-El_a1Yhs.js} +1 -1
  19. package/build/client/assets/index-QYLIz8qa.js +1 -0
  20. package/build/client/assets/layout-BPVd8vtW.js +1 -0
  21. package/build/client/assets/{mdx-CehodSrM.js → mdx-DBJIR6uw.js} +1 -1
  22. package/build/client/assets/page-BJL5nvn-.js +1 -0
  23. package/build/client/assets/page-eyuUZvVn.js +1 -0
  24. package/build/client/assets/popover-BowiFsDm.js +1 -0
  25. package/build/client/assets/{react-D58ornpH.js → react-CzFdRS7Y.js} +7 -7
  26. package/build/client/assets/root-7fvd-0uP.js +1 -0
  27. package/build/client/assets/root-B0B6-NU5.css +1 -0
  28. package/build/client/assets/{root-CNcQf1GA.js → root-jg-0qm8s.js} +1 -1
  29. package/build/client/assets/route-BLLsZ_zO.js +1 -0
  30. package/build/client/assets/{router-XCTsiXqQ.js → router-QEl8O8lm.js} +1 -1
  31. package/build/client/assets/select-BI356bZ1.js +1 -0
  32. package/build/client/assets/separator-0kwG7IIM.js +1 -0
  33. package/build/client/assets/sidebar-ByyQE2QS.js +12 -0
  34. package/build/client/assets/{site-header-1Aor7-g4.js → site-header-iBpA4Sim.js} +1 -1
  35. package/build/client/assets/spinner-D35u7i0p.js +1 -0
  36. package/build/client/assets/tooltip-v-_I4rCw.js +16 -0
  37. package/build/client/assets/use-sync-yCWvjE_m.js +2 -0
  38. package/build/client/assets/{yaml-DUnUkeX8.js → yaml-BnQf_2Zt.js} +1 -1
  39. package/build/server/__ssr_build/__vite_rsc_assets_manifest.js +213 -133
  40. package/build/server/__ssr_build/assets/{actions-DLZnfFzU.js → actions-C5Kv8XYU.js} +2 -2
  41. package/build/server/__ssr_build/assets/{actions-D6dLhck1.js → actions-DQIBBM15.js} +4 -4
  42. package/build/server/__ssr_build/assets/{badge-CH6ntch2.js → badge-B48L9yYO.js} +1 -1
  43. package/build/server/__ssr_build/assets/{client-C-WcMcGh.js → client-AuWNsacU.js} +3 -3
  44. package/build/server/__ssr_build/assets/client-BHaLyky8.js +1162 -0
  45. package/build/server/__ssr_build/assets/{client-DX-wDNer.js → client-BogEWrwz.js} +9 -5
  46. package/build/server/__ssr_build/assets/{client-JNaR8Jey.js → client-DXOHI3cC.js} +2808 -4397
  47. package/build/server/__ssr_build/assets/{dropdown-menu-gcIcDMHP.js → dropdown-menu-CnDgV_JY.js} +7 -9
  48. package/build/server/__ssr_build/assets/{entry.rsc-Cg_DxYkh.js → entry.rsc-aOU-YPkj.js} +1 -1
  49. package/build/server/__ssr_build/assets/{index-PpqpVA51.js → index-B6ajh-UP.js} +1 -1
  50. package/build/server/__ssr_build/assets/index-BPd5y8T-.js +76 -0
  51. package/build/server/__ssr_build/assets/{button-U-KvP9zg.js → index-By9m5mBe.js} +3272 -3175
  52. package/build/server/__ssr_build/assets/index-Ch7b9Ofo.js +37 -0
  53. package/build/server/__ssr_build/assets/{index-BJ-AF-IL.js → index-Cw6b1mnl.js} +8 -7
  54. package/build/server/__ssr_build/assets/{index-BloUStie.js → index-kCa2P0Xn.js} +4 -75
  55. package/build/server/__ssr_build/assets/{index-CWwW5yWZ.js → index-tFzyztyE.js} +2 -2
  56. package/build/server/__ssr_build/assets/{layout-B79fq6F-.js → layout-CC-HJHWR.js} +13 -11
  57. package/build/server/__ssr_build/assets/{mdx-bmeV1kyx.js → mdx-D9VFmsYC.js} +1 -1
  58. package/build/server/__ssr_build/assets/{page-CxhOzrct.js → page-BVUd9aDy.js} +10 -8
  59. package/build/server/__ssr_build/assets/{page-DxtKhA1K.js → page-C_wQzy3_.js} +13 -11
  60. package/build/server/__ssr_build/assets/popover-CzQgoguQ.js +321 -0
  61. package/build/server/__ssr_build/assets/{root-TWeSpY2W.js → root-BmMc6_zA.js} +1 -1
  62. package/build/server/__ssr_build/assets/route-CNYc37pV.js +860 -0
  63. package/build/server/__ssr_build/assets/{spinner-w3Q_wkh3.js → select-B8QQSB6X.js} +10 -25
  64. package/build/server/__ssr_build/assets/{separator-CKrKBtv4.js → separator-C601eKPH.js} +2 -2
  65. package/build/server/__ssr_build/assets/{sidebar-DoXmiwf0.js → sidebar-C6fHDjcx.js} +237 -65
  66. package/build/server/__ssr_build/assets/{site-header-pFjDV73T.js → site-header-Bmsr3a30.js} +2 -2
  67. package/build/server/__ssr_build/assets/spinner-D5zAJQcS.js +19 -0
  68. package/build/server/__ssr_build/assets/{tooltip-B2NV0tpS.js → tooltip-B3A57zPO.js} +1211 -1211
  69. package/build/server/__ssr_build/assets/{use-sync-p_-o0jkt.js → use-sync-DTZgOM1O.js} +29 -1185
  70. package/build/server/__ssr_build/assets/{yaml-BEdFfhvc.js → yaml-xJU1Ur4O.js} +1 -1
  71. package/build/server/__ssr_build/index.js +31 -15
  72. package/build/server/__vite_rsc_assets_manifest.js +213 -133
  73. package/build/server/assets/{actions-C92yn6jE.js → actions-BbMzIy5J.js} +2 -2
  74. package/build/server/assets/{actions-CWWFIcb1.js → actions-CjWBMAed.js} +2 -2
  75. package/build/server/assets/{actions-DZdN0IBq.js → actions-cRzXiMyR.js} +2 -2
  76. package/build/server/assets/{config-Cb909uq6.js → config-Dka4Bvz4.js} +10 -10
  77. package/build/server/assets/{layout-CRw_6FCt.js → layout-CIIfFN0v.js} +2 -2
  78. package/build/server/assets/{page-BfKoQQmw.js → page-pyqagPXb.js} +2 -2
  79. package/build/server/assets/root-B0B6-NU5.css +1 -0
  80. package/build/server/assets/{root-BqMNAwvK.js → root-D1ebFoST.js} +1 -1
  81. package/build/server/assets/{route-DiqCR5uw.js → route-C7QEArEP.js} +13911 -5699
  82. package/build/server/index.js +40 -15
  83. package/dist/bin.mjs +4 -4
  84. package/dist/package.mjs +1 -1
  85. package/package.json +32 -15
  86. package/build/client/assets/actions-BIaFztcg.js +0 -1
  87. package/build/client/assets/actions-Bws1O3FH.js +0 -1
  88. package/build/client/assets/badge-C70RdDmr.js +0 -1
  89. package/build/client/assets/button-B0G-joJA.js +0 -41
  90. package/build/client/assets/client-C814jsdE.js +0 -1
  91. package/build/client/assets/client-wwp8K9Xz.js +0 -1
  92. package/build/client/assets/dropdown-menu-Re3QusA0.js +0 -1
  93. package/build/client/assets/entry.rsc-CdTwhQ3_.js +0 -1
  94. package/build/client/assets/index-DZ8LIlZu.js +0 -1
  95. package/build/client/assets/index-DprkZK2S.js +0 -1
  96. package/build/client/assets/index-UnlOgAz7.js +0 -1
  97. package/build/client/assets/layout-C5TjiFIx.js +0 -1
  98. package/build/client/assets/page-CiRIEJz9.js +0 -1
  99. package/build/client/assets/page-DBIuN_hk.js +0 -1
  100. package/build/client/assets/root-CbriXo_i.css +0 -1
  101. package/build/client/assets/root-DJ8qMHCd.js +0 -1
  102. package/build/client/assets/separator-BDe8wWVP.js +0 -1
  103. package/build/client/assets/sidebar-DNKkYLTA.js +0 -12
  104. package/build/client/assets/spinner-O3ZbB6fn.js +0 -1
  105. package/build/client/assets/tooltip-B4fI3WTO.js +0 -16
  106. package/build/client/assets/use-sync-CfDyibsS.js +0 -9
  107. package/build/server/assets/root-CbriXo_i.css +0 -1
  108. /package/build/server/__ssr_build/assets/{root-BYlluTc0.js → root-S8l7oX7x.js} +0 -0
  109. /package/build/server/assets/{root-ByROcfN4.js → root-DRYtk85G.js} +0 -0
@@ -1,910 +1,133 @@
1
- import { r as reactExports, j as jsxRuntimeExports, f as requireReact, g as getDefaultExportFromCjs, h as React, i as reactDomExports } from "../index.js";
2
- import { a as createContextScope, u as useComposedRefs, P as Primitive, b as composeEventHandlers, h as useControllableState, k as useId$1, g as Presence, l as Portal$2, m as hideOthers, n as ReactRemoveScroll, o as createSlot, p as useFocusGuards, F as FocusScope, D as DismissableLayer, H as createContext2, j as createPopperScope, R as Root2, A as Anchor, q as Arrow, C as Content$1, d as createSlottable, I as Root$1, J as isHTMLElement, K as isShadowRoot, L as floor, M as getNodeName, N as isNode, O as getWindow, Q as getComputedStyle$1, t as isElement, T as isLastTraversableNode, U as getParentNode, W as getOverflowAncestors, Y as isWebKit$1, x as useFloating$1, Z as evaluate, _ as getPaddingObject, $ as getAlignmentAxis, a0 as getAlignment, a1 as clamp, a2 as getAxisLength, a3 as hide$1, E as flip, z as offset, a4 as size, a5 as getSide, a6 as getSideAxis, y as autoUpdate, a7 as shift, a8 as limitShift, a9 as isOverflowElement, s as cn, v as ChevronRight } from "./button-U-KvP9zg.js";
1
+ import { f as requireReact, g as getDefaultExportFromCjs, r as reactExports, j as jsxRuntimeExports, i as React, h as reactDomExports } from "../index.js";
2
+ import { m as useComposedRefs, P as Primitive, g as composeEventHandlers, f as useControllableState, u as useId$1, q as Presence, s as Portal$2, v as hideOthers, h as createContextScope, w as ReactRemoveScroll, y as useFocusGuards, F as FocusScope, D as DismissableLayer, x as createSlot, I as createContext2, J as isHTMLElement, K as isShadowRoot, L as floor, M as getNodeName, N as isNode, O as getWindow, Q as getComputedStyle$1, i as isElement, T as isLastTraversableNode, U as getParentNode, W as getOverflowAncestors, Y as isWebKit$1, k as useFloating$1, Z as evaluate, _ as getPaddingObject, $ as getAlignmentAxis, a0 as getAlignment, a1 as getAxisLength, a2 as clamp, a3 as hide$1, p as flip, a4 as size, a5 as getSide, a6 as getSideAxis, l as autoUpdate, o as offset, a7 as shift, a8 as limitShift, a9 as isOverflowElement, b as cn, C as ChevronRight, R as Root2, A as Anchor, E as Arrow, t as createPopperScope, z as Content$1, aa as Root$1, n as createSlottable } from "./index-By9m5mBe.js";
3
3
  import { cva } from "class-variance-authority";
4
- var DIALOG_NAME = "Dialog";
5
- var [createDialogContext, createDialogScope] = createContextScope(DIALOG_NAME);
6
- var [DialogProvider, useDialogContext] = createDialogContext(DIALOG_NAME);
7
- var Dialog = (props) => {
8
- const {
9
- __scopeDialog,
10
- children,
11
- open: openProp,
12
- defaultOpen,
13
- onOpenChange,
14
- modal = true
15
- } = props;
16
- const triggerRef = reactExports.useRef(null);
17
- const contentRef = reactExports.useRef(null);
18
- const [open, setOpen] = useControllableState({
19
- prop: openProp,
20
- defaultProp: defaultOpen ?? false,
21
- onChange: onOpenChange,
22
- caller: DIALOG_NAME
23
- });
24
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
25
- DialogProvider,
26
- {
27
- scope: __scopeDialog,
28
- triggerRef,
29
- contentRef,
30
- contentId: useId$1(),
31
- titleId: useId$1(),
32
- descriptionId: useId$1(),
33
- open,
34
- onOpenChange: setOpen,
35
- onOpenToggle: reactExports.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]),
36
- modal,
37
- children
38
- }
39
- );
40
- };
41
- Dialog.displayName = DIALOG_NAME;
42
- var TRIGGER_NAME$1 = "DialogTrigger";
43
- var DialogTrigger = reactExports.forwardRef(
44
- (props, forwardedRef) => {
45
- const { __scopeDialog, ...triggerProps } = props;
46
- const context = useDialogContext(TRIGGER_NAME$1, __scopeDialog);
47
- const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);
48
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
49
- Primitive.button,
50
- {
51
- type: "button",
52
- "aria-haspopup": "dialog",
53
- "aria-expanded": context.open,
54
- "aria-controls": context.contentId,
55
- "data-state": getState(context.open),
56
- ...triggerProps,
57
- ref: composedTriggerRef,
58
- onClick: composeEventHandlers(props.onClick, context.onOpenToggle)
59
- }
60
- );
61
- }
62
- );
63
- DialogTrigger.displayName = TRIGGER_NAME$1;
64
- var PORTAL_NAME$1 = "DialogPortal";
65
- var [PortalProvider$1, usePortalContext$2] = createDialogContext(PORTAL_NAME$1, {
66
- forceMount: void 0
67
- });
68
- var DialogPortal = (props) => {
69
- const { __scopeDialog, forceMount, children, container } = props;
70
- const context = useDialogContext(PORTAL_NAME$1, __scopeDialog);
71
- return /* @__PURE__ */ jsxRuntimeExports.jsx(PortalProvider$1, { scope: __scopeDialog, forceMount, children: reactExports.Children.map(children, (child) => /* @__PURE__ */ jsxRuntimeExports.jsx(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Portal$2, { asChild: true, container, children: child }) })) });
72
- };
73
- DialogPortal.displayName = PORTAL_NAME$1;
74
- var OVERLAY_NAME = "DialogOverlay";
75
- var DialogOverlay = reactExports.forwardRef(
76
- (props, forwardedRef) => {
77
- const portalContext = usePortalContext$2(OVERLAY_NAME, props.__scopeDialog);
78
- const { forceMount = portalContext.forceMount, ...overlayProps } = props;
79
- const context = useDialogContext(OVERLAY_NAME, props.__scopeDialog);
80
- return context.modal ? /* @__PURE__ */ jsxRuntimeExports.jsx(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsxRuntimeExports.jsx(DialogOverlayImpl, { ...overlayProps, ref: forwardedRef }) }) : null;
81
- }
82
- );
83
- DialogOverlay.displayName = OVERLAY_NAME;
84
- var Slot = createSlot("DialogOverlay.RemoveScroll");
85
- var DialogOverlayImpl = reactExports.forwardRef(
86
- (props, forwardedRef) => {
87
- const { __scopeDialog, ...overlayProps } = props;
88
- const context = useDialogContext(OVERLAY_NAME, __scopeDialog);
89
- return (
90
- // Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`
91
- // ie. when `Overlay` and `Content` are siblings
92
- /* @__PURE__ */ jsxRuntimeExports.jsx(ReactRemoveScroll, { as: Slot, allowPinchZoom: true, shards: [context.contentRef], children: /* @__PURE__ */ jsxRuntimeExports.jsx(
93
- Primitive.div,
94
- {
95
- "data-state": getState(context.open),
96
- ...overlayProps,
97
- ref: forwardedRef,
98
- style: { pointerEvents: "auto", ...overlayProps.style }
99
- }
100
- ) })
101
- );
102
- }
103
- );
104
- var CONTENT_NAME$1 = "DialogContent";
105
- var DialogContent = reactExports.forwardRef(
106
- (props, forwardedRef) => {
107
- const portalContext = usePortalContext$2(CONTENT_NAME$1, props.__scopeDialog);
108
- const { forceMount = portalContext.forceMount, ...contentProps } = props;
109
- const context = useDialogContext(CONTENT_NAME$1, props.__scopeDialog);
110
- return /* @__PURE__ */ jsxRuntimeExports.jsx(Presence, { present: forceMount || context.open, children: context.modal ? /* @__PURE__ */ jsxRuntimeExports.jsx(DialogContentModal, { ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ jsxRuntimeExports.jsx(DialogContentNonModal, { ...contentProps, ref: forwardedRef }) });
111
- }
112
- );
113
- DialogContent.displayName = CONTENT_NAME$1;
114
- var DialogContentModal = reactExports.forwardRef(
115
- (props, forwardedRef) => {
116
- const context = useDialogContext(CONTENT_NAME$1, props.__scopeDialog);
117
- const contentRef = reactExports.useRef(null);
118
- const composedRefs = useComposedRefs(forwardedRef, context.contentRef, contentRef);
119
- reactExports.useEffect(() => {
120
- const content = contentRef.current;
121
- if (content) return hideOthers(content);
122
- }, []);
123
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
124
- DialogContentImpl,
125
- {
126
- ...props,
127
- ref: composedRefs,
128
- trapFocus: context.open,
129
- disableOutsidePointerEvents: true,
130
- onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, (event) => {
131
- event.preventDefault();
132
- context.triggerRef.current?.focus();
133
- }),
134
- onPointerDownOutside: composeEventHandlers(props.onPointerDownOutside, (event) => {
135
- const originalEvent = event.detail.originalEvent;
136
- const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
137
- const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
138
- if (isRightClick) event.preventDefault();
139
- }),
140
- onFocusOutside: composeEventHandlers(
141
- props.onFocusOutside,
142
- (event) => event.preventDefault()
143
- )
144
- }
145
- );
146
- }
147
- );
148
- var DialogContentNonModal = reactExports.forwardRef(
149
- (props, forwardedRef) => {
150
- const context = useDialogContext(CONTENT_NAME$1, props.__scopeDialog);
151
- const hasInteractedOutsideRef = reactExports.useRef(false);
152
- const hasPointerDownOutsideRef = reactExports.useRef(false);
153
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
154
- DialogContentImpl,
155
- {
156
- ...props,
157
- ref: forwardedRef,
158
- trapFocus: false,
159
- disableOutsidePointerEvents: false,
160
- onCloseAutoFocus: (event) => {
161
- props.onCloseAutoFocus?.(event);
162
- if (!event.defaultPrevented) {
163
- if (!hasInteractedOutsideRef.current) context.triggerRef.current?.focus();
164
- event.preventDefault();
165
- }
166
- hasInteractedOutsideRef.current = false;
167
- hasPointerDownOutsideRef.current = false;
168
- },
169
- onInteractOutside: (event) => {
170
- props.onInteractOutside?.(event);
171
- if (!event.defaultPrevented) {
172
- hasInteractedOutsideRef.current = true;
173
- if (event.detail.originalEvent.type === "pointerdown") {
174
- hasPointerDownOutsideRef.current = true;
175
- }
176
- }
177
- const target = event.target;
178
- const targetIsTrigger = context.triggerRef.current?.contains(target);
179
- if (targetIsTrigger) event.preventDefault();
180
- if (event.detail.originalEvent.type === "focusin" && hasPointerDownOutsideRef.current) {
181
- event.preventDefault();
182
- }
183
- }
184
- }
185
- );
186
- }
187
- );
188
- var DialogContentImpl = reactExports.forwardRef(
189
- (props, forwardedRef) => {
190
- const { __scopeDialog, trapFocus, onOpenAutoFocus, onCloseAutoFocus, ...contentProps } = props;
191
- const context = useDialogContext(CONTENT_NAME$1, __scopeDialog);
192
- const contentRef = reactExports.useRef(null);
193
- const composedRefs = useComposedRefs(forwardedRef, contentRef);
194
- useFocusGuards();
195
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
196
- /* @__PURE__ */ jsxRuntimeExports.jsx(
197
- FocusScope,
198
- {
199
- asChild: true,
200
- loop: true,
201
- trapped: trapFocus,
202
- onMountAutoFocus: onOpenAutoFocus,
203
- onUnmountAutoFocus: onCloseAutoFocus,
204
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(
205
- DismissableLayer,
206
- {
207
- role: "dialog",
208
- id: context.contentId,
209
- "aria-describedby": context.descriptionId,
210
- "aria-labelledby": context.titleId,
211
- "data-state": getState(context.open),
212
- ...contentProps,
213
- ref: composedRefs,
214
- onDismiss: () => context.onOpenChange(false)
215
- }
216
- )
217
- }
218
- ),
219
- /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
220
- /* @__PURE__ */ jsxRuntimeExports.jsx(TitleWarning, { titleId: context.titleId }),
221
- /* @__PURE__ */ jsxRuntimeExports.jsx(DescriptionWarning, { contentRef, descriptionId: context.descriptionId })
222
- ] })
223
- ] });
224
- }
225
- );
226
- var TITLE_NAME = "DialogTitle";
227
- var DialogTitle = reactExports.forwardRef(
228
- (props, forwardedRef) => {
229
- const { __scopeDialog, ...titleProps } = props;
230
- const context = useDialogContext(TITLE_NAME, __scopeDialog);
231
- return /* @__PURE__ */ jsxRuntimeExports.jsx(Primitive.h2, { id: context.titleId, ...titleProps, ref: forwardedRef });
232
- }
233
- );
234
- DialogTitle.displayName = TITLE_NAME;
235
- var DESCRIPTION_NAME = "DialogDescription";
236
- var DialogDescription = reactExports.forwardRef(
237
- (props, forwardedRef) => {
238
- const { __scopeDialog, ...descriptionProps } = props;
239
- const context = useDialogContext(DESCRIPTION_NAME, __scopeDialog);
240
- return /* @__PURE__ */ jsxRuntimeExports.jsx(Primitive.p, { id: context.descriptionId, ...descriptionProps, ref: forwardedRef });
241
- }
242
- );
243
- DialogDescription.displayName = DESCRIPTION_NAME;
244
- var CLOSE_NAME = "DialogClose";
245
- var DialogClose = reactExports.forwardRef(
246
- (props, forwardedRef) => {
247
- const { __scopeDialog, ...closeProps } = props;
248
- const context = useDialogContext(CLOSE_NAME, __scopeDialog);
249
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
250
- Primitive.button,
251
- {
252
- type: "button",
253
- ...closeProps,
254
- ref: forwardedRef,
255
- onClick: composeEventHandlers(props.onClick, () => context.onOpenChange(false))
256
- }
257
- );
258
- }
259
- );
260
- DialogClose.displayName = CLOSE_NAME;
261
- function getState(open) {
262
- return open ? "open" : "closed";
263
- }
264
- var TITLE_WARNING_NAME = "DialogTitleWarning";
265
- var [WarningProvider, useWarningContext] = createContext2(TITLE_WARNING_NAME, {
266
- contentName: CONTENT_NAME$1,
267
- titleName: TITLE_NAME,
268
- docsSlug: "dialog"
269
- });
270
- var TitleWarning = ({ titleId }) => {
271
- const titleWarningContext = useWarningContext(TITLE_WARNING_NAME);
272
- const MESSAGE = `\`${titleWarningContext.contentName}\` requires a \`${titleWarningContext.titleName}\` for the component to be accessible for screen reader users.
273
-
274
- If you want to hide the \`${titleWarningContext.titleName}\`, you can wrap it with our VisuallyHidden component.
275
-
276
- For more information, see https://radix-ui.com/primitives/docs/components/${titleWarningContext.docsSlug}`;
277
- reactExports.useEffect(() => {
278
- if (titleId) {
279
- const hasTitle = document.getElementById(titleId);
280
- if (!hasTitle) console.error(MESSAGE);
281
- }
282
- }, [MESSAGE, titleId]);
283
- return null;
284
- };
285
- var DESCRIPTION_WARNING_NAME = "DialogDescriptionWarning";
286
- var DescriptionWarning = ({ contentRef, descriptionId }) => {
287
- const descriptionWarningContext = useWarningContext(DESCRIPTION_WARNING_NAME);
288
- const MESSAGE = `Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${descriptionWarningContext.contentName}}.`;
289
- reactExports.useEffect(() => {
290
- const describedById = contentRef.current?.getAttribute("aria-describedby");
291
- if (descriptionId && describedById) {
292
- const hasDescription = document.getElementById(descriptionId);
293
- if (!hasDescription) console.warn(MESSAGE);
294
- }
295
- }, [MESSAGE, contentRef, descriptionId]);
296
- return null;
297
- };
298
- var Root = Dialog;
299
- var Trigger$1 = DialogTrigger;
300
- var Portal$1 = DialogPortal;
301
- var Overlay = DialogOverlay;
302
- var Content = DialogContent;
303
- var Title = DialogTitle;
304
- var Description = DialogDescription;
305
- var Close = DialogClose;
306
- var shim = { exports: {} };
307
- var useSyncExternalStoreShim_production = {};
308
- var hasRequiredUseSyncExternalStoreShim_production;
309
- function requireUseSyncExternalStoreShim_production() {
310
- if (hasRequiredUseSyncExternalStoreShim_production) return useSyncExternalStoreShim_production;
311
- hasRequiredUseSyncExternalStoreShim_production = 1;
312
- var React2 = requireReact();
313
- function is(x, y) {
314
- return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y;
315
- }
316
- var objectIs = "function" === typeof Object.is ? Object.is : is, useState = React2.useState, useEffect = React2.useEffect, useLayoutEffect = React2.useLayoutEffect, useDebugValue = React2.useDebugValue;
317
- function useSyncExternalStore$2(subscribe, getSnapshot) {
318
- var value = getSnapshot(), _useState = useState({ inst: { value, getSnapshot } }), inst = _useState[0].inst, forceUpdate = _useState[1];
319
- useLayoutEffect(
320
- function() {
321
- inst.value = value;
322
- inst.getSnapshot = getSnapshot;
323
- checkIfSnapshotChanged(inst) && forceUpdate({ inst });
324
- },
325
- [subscribe, value, getSnapshot]
326
- );
327
- useEffect(
328
- function() {
329
- checkIfSnapshotChanged(inst) && forceUpdate({ inst });
330
- return subscribe(function() {
331
- checkIfSnapshotChanged(inst) && forceUpdate({ inst });
332
- });
333
- },
334
- [subscribe]
335
- );
336
- useDebugValue(value);
337
- return value;
338
- }
339
- function checkIfSnapshotChanged(inst) {
340
- var latestGetSnapshot = inst.getSnapshot;
341
- inst = inst.value;
342
- try {
343
- var nextValue = latestGetSnapshot();
344
- return !objectIs(inst, nextValue);
345
- } catch (error2) {
346
- return true;
347
- }
348
- }
349
- function useSyncExternalStore$1(subscribe, getSnapshot) {
350
- return getSnapshot();
351
- }
352
- var shim2 = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2;
353
- useSyncExternalStoreShim_production.useSyncExternalStore = void 0 !== React2.useSyncExternalStore ? React2.useSyncExternalStore : shim2;
354
- return useSyncExternalStoreShim_production;
355
- }
356
- var useSyncExternalStoreShim_development = {};
357
- var hasRequiredUseSyncExternalStoreShim_development;
358
- function requireUseSyncExternalStoreShim_development() {
359
- if (hasRequiredUseSyncExternalStoreShim_development) return useSyncExternalStoreShim_development;
360
- hasRequiredUseSyncExternalStoreShim_development = 1;
361
- "production" !== process.env.NODE_ENV && (function() {
362
- function is(x, y) {
363
- return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y;
364
- }
365
- function useSyncExternalStore$2(subscribe, getSnapshot) {
366
- didWarnOld18Alpha || void 0 === React2.startTransition || (didWarnOld18Alpha = true, console.error(
367
- "You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."
368
- ));
369
- var value = getSnapshot();
370
- if (!didWarnUncachedGetSnapshot) {
371
- var cachedValue = getSnapshot();
372
- objectIs(value, cachedValue) || (console.error(
373
- "The result of getSnapshot should be cached to avoid an infinite loop"
374
- ), didWarnUncachedGetSnapshot = true);
375
- }
376
- cachedValue = useState({
377
- inst: { value, getSnapshot }
378
- });
379
- var inst = cachedValue[0].inst, forceUpdate = cachedValue[1];
380
- useLayoutEffect(
381
- function() {
382
- inst.value = value;
383
- inst.getSnapshot = getSnapshot;
384
- checkIfSnapshotChanged(inst) && forceUpdate({ inst });
385
- },
386
- [subscribe, value, getSnapshot]
387
- );
388
- useEffect(
389
- function() {
390
- checkIfSnapshotChanged(inst) && forceUpdate({ inst });
391
- return subscribe(function() {
392
- checkIfSnapshotChanged(inst) && forceUpdate({ inst });
393
- });
394
- },
395
- [subscribe]
396
- );
397
- useDebugValue(value);
398
- return value;
399
- }
400
- function checkIfSnapshotChanged(inst) {
401
- var latestGetSnapshot = inst.getSnapshot;
402
- inst = inst.value;
403
- try {
404
- var nextValue = latestGetSnapshot();
405
- return !objectIs(inst, nextValue);
406
- } catch (error2) {
407
- return true;
408
- }
409
- }
410
- function useSyncExternalStore$1(subscribe, getSnapshot) {
411
- return getSnapshot();
412
- }
413
- "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
414
- var React2 = requireReact(), objectIs = "function" === typeof Object.is ? Object.is : is, useState = React2.useState, useEffect = React2.useEffect, useLayoutEffect = React2.useLayoutEffect, useDebugValue = React2.useDebugValue, didWarnOld18Alpha = false, didWarnUncachedGetSnapshot = false, shim2 = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2;
415
- useSyncExternalStoreShim_development.useSyncExternalStore = void 0 !== React2.useSyncExternalStore ? React2.useSyncExternalStore : shim2;
416
- "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
417
- })();
418
- return useSyncExternalStoreShim_development;
419
- }
420
- var hasRequiredShim;
421
- function requireShim() {
422
- if (hasRequiredShim) return shim.exports;
423
- hasRequiredShim = 1;
424
- if (process.env.NODE_ENV === "production") {
425
- shim.exports = requireUseSyncExternalStoreShim_production();
426
- } else {
427
- shim.exports = requireUseSyncExternalStoreShim_development();
428
- }
429
- return shim.exports;
430
- }
431
- var shimExports = requireShim();
432
- var [createTooltipContext] = createContextScope("Tooltip", [
433
- createPopperScope
434
- ]);
435
- var usePopperScope = createPopperScope();
436
- var PROVIDER_NAME = "TooltipProvider";
437
- var DEFAULT_DELAY_DURATION = 700;
438
- var TOOLTIP_OPEN = "tooltip.open";
439
- var [TooltipProviderContextProvider, useTooltipProviderContext] = createTooltipContext(PROVIDER_NAME);
440
- var TooltipProvider$1 = (props) => {
441
- const {
442
- __scopeTooltip,
443
- delayDuration = DEFAULT_DELAY_DURATION,
444
- skipDelayDuration = 300,
445
- disableHoverableContent = false,
446
- children
447
- } = props;
448
- const isOpenDelayedRef = reactExports.useRef(true);
449
- const isPointerInTransitRef = reactExports.useRef(false);
450
- const skipDelayTimerRef = reactExports.useRef(0);
451
- reactExports.useEffect(() => {
452
- const skipDelayTimer = skipDelayTimerRef.current;
453
- return () => window.clearTimeout(skipDelayTimer);
454
- }, []);
455
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
456
- TooltipProviderContextProvider,
457
- {
458
- scope: __scopeTooltip,
459
- isOpenDelayedRef,
460
- delayDuration,
461
- onOpen: reactExports.useCallback(() => {
462
- window.clearTimeout(skipDelayTimerRef.current);
463
- isOpenDelayedRef.current = false;
464
- }, []),
465
- onClose: reactExports.useCallback(() => {
466
- window.clearTimeout(skipDelayTimerRef.current);
467
- skipDelayTimerRef.current = window.setTimeout(
468
- () => isOpenDelayedRef.current = true,
469
- skipDelayDuration
470
- );
471
- }, [skipDelayDuration]),
472
- isPointerInTransitRef,
473
- onPointerInTransitChange: reactExports.useCallback((inTransit) => {
474
- isPointerInTransitRef.current = inTransit;
475
- }, []),
476
- disableHoverableContent,
477
- children
478
- }
479
- );
480
- };
481
- TooltipProvider$1.displayName = PROVIDER_NAME;
482
- var TOOLTIP_NAME = "Tooltip";
483
- var [TooltipContextProvider, useTooltipContext] = createTooltipContext(TOOLTIP_NAME);
484
- var Tooltip$1 = (props) => {
485
- const {
486
- __scopeTooltip,
487
- children,
488
- open: openProp,
489
- defaultOpen,
490
- onOpenChange,
491
- disableHoverableContent: disableHoverableContentProp,
492
- delayDuration: delayDurationProp
493
- } = props;
494
- const providerContext = useTooltipProviderContext(TOOLTIP_NAME, props.__scopeTooltip);
495
- const popperScope = usePopperScope(__scopeTooltip);
496
- const [trigger, setTrigger] = reactExports.useState(null);
497
- const contentId = useId$1();
498
- const openTimerRef = reactExports.useRef(0);
499
- const disableHoverableContent = disableHoverableContentProp ?? providerContext.disableHoverableContent;
500
- const delayDuration = delayDurationProp ?? providerContext.delayDuration;
501
- const wasOpenDelayedRef = reactExports.useRef(false);
502
- const [open, setOpen] = useControllableState({
503
- prop: openProp,
504
- defaultProp: defaultOpen ?? false,
505
- onChange: (open2) => {
506
- if (open2) {
507
- providerContext.onOpen();
508
- document.dispatchEvent(new CustomEvent(TOOLTIP_OPEN));
509
- } else {
510
- providerContext.onClose();
511
- }
512
- onOpenChange?.(open2);
513
- },
514
- caller: TOOLTIP_NAME
515
- });
516
- const stateAttribute = reactExports.useMemo(() => {
517
- return open ? wasOpenDelayedRef.current ? "delayed-open" : "instant-open" : "closed";
518
- }, [open]);
519
- const handleOpen = reactExports.useCallback(() => {
520
- window.clearTimeout(openTimerRef.current);
521
- openTimerRef.current = 0;
522
- wasOpenDelayedRef.current = false;
523
- setOpen(true);
524
- }, [setOpen]);
525
- const handleClose = reactExports.useCallback(() => {
526
- window.clearTimeout(openTimerRef.current);
527
- openTimerRef.current = 0;
528
- setOpen(false);
529
- }, [setOpen]);
530
- const handleDelayedOpen = reactExports.useCallback(() => {
531
- window.clearTimeout(openTimerRef.current);
532
- openTimerRef.current = window.setTimeout(() => {
533
- wasOpenDelayedRef.current = true;
534
- setOpen(true);
535
- openTimerRef.current = 0;
536
- }, delayDuration);
537
- }, [delayDuration, setOpen]);
538
- reactExports.useEffect(() => {
539
- return () => {
540
- if (openTimerRef.current) {
541
- window.clearTimeout(openTimerRef.current);
542
- openTimerRef.current = 0;
543
- }
544
- };
545
- }, []);
546
- return /* @__PURE__ */ jsxRuntimeExports.jsx(Root2, { ...popperScope, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
547
- TooltipContextProvider,
548
- {
549
- scope: __scopeTooltip,
550
- contentId,
551
- open,
552
- stateAttribute,
553
- trigger,
554
- onTriggerChange: setTrigger,
555
- onTriggerEnter: reactExports.useCallback(() => {
556
- if (providerContext.isOpenDelayedRef.current) handleDelayedOpen();
557
- else handleOpen();
558
- }, [providerContext.isOpenDelayedRef, handleDelayedOpen, handleOpen]),
559
- onTriggerLeave: reactExports.useCallback(() => {
560
- if (disableHoverableContent) {
561
- handleClose();
562
- } else {
563
- window.clearTimeout(openTimerRef.current);
564
- openTimerRef.current = 0;
565
- }
566
- }, [handleClose, disableHoverableContent]),
567
- onOpen: handleOpen,
568
- onClose: handleClose,
569
- disableHoverableContent,
570
- children
571
- }
572
- ) });
573
- };
574
- Tooltip$1.displayName = TOOLTIP_NAME;
575
- var TRIGGER_NAME = "TooltipTrigger";
576
- var TooltipTrigger$1 = reactExports.forwardRef(
577
- (props, forwardedRef) => {
578
- const { __scopeTooltip, ...triggerProps } = props;
579
- const context = useTooltipContext(TRIGGER_NAME, __scopeTooltip);
580
- const providerContext = useTooltipProviderContext(TRIGGER_NAME, __scopeTooltip);
581
- const popperScope = usePopperScope(__scopeTooltip);
582
- const ref = reactExports.useRef(null);
583
- const composedRefs = useComposedRefs(forwardedRef, ref, context.onTriggerChange);
584
- const isPointerDownRef = reactExports.useRef(false);
585
- const hasPointerMoveOpenedRef = reactExports.useRef(false);
586
- const handlePointerUp = reactExports.useCallback(() => isPointerDownRef.current = false, []);
587
- reactExports.useEffect(() => {
588
- return () => document.removeEventListener("pointerup", handlePointerUp);
589
- }, [handlePointerUp]);
590
- return /* @__PURE__ */ jsxRuntimeExports.jsx(Anchor, { asChild: true, ...popperScope, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
591
- Primitive.button,
592
- {
593
- "aria-describedby": context.open ? context.contentId : void 0,
594
- "data-state": context.stateAttribute,
595
- ...triggerProps,
596
- ref: composedRefs,
597
- onPointerMove: composeEventHandlers(props.onPointerMove, (event) => {
598
- if (event.pointerType === "touch") return;
599
- if (!hasPointerMoveOpenedRef.current && !providerContext.isPointerInTransitRef.current) {
600
- context.onTriggerEnter();
601
- hasPointerMoveOpenedRef.current = true;
602
- }
603
- }),
604
- onPointerLeave: composeEventHandlers(props.onPointerLeave, () => {
605
- context.onTriggerLeave();
606
- hasPointerMoveOpenedRef.current = false;
607
- }),
608
- onPointerDown: composeEventHandlers(props.onPointerDown, () => {
609
- if (context.open) {
610
- context.onClose();
611
- }
612
- isPointerDownRef.current = true;
613
- document.addEventListener("pointerup", handlePointerUp, { once: true });
614
- }),
615
- onFocus: composeEventHandlers(props.onFocus, () => {
616
- if (!isPointerDownRef.current) context.onOpen();
617
- }),
618
- onBlur: composeEventHandlers(props.onBlur, context.onClose),
619
- onClick: composeEventHandlers(props.onClick, context.onClose)
620
- }
621
- ) });
622
- }
623
- );
624
- TooltipTrigger$1.displayName = TRIGGER_NAME;
625
- var PORTAL_NAME = "TooltipPortal";
626
- var [PortalProvider, usePortalContext$1] = createTooltipContext(PORTAL_NAME, {
627
- forceMount: void 0
628
- });
629
- var TooltipPortal = (props) => {
630
- const { __scopeTooltip, forceMount, children, container } = props;
631
- const context = useTooltipContext(PORTAL_NAME, __scopeTooltip);
632
- return /* @__PURE__ */ jsxRuntimeExports.jsx(PortalProvider, { scope: __scopeTooltip, forceMount, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Portal$2, { asChild: true, container, children }) }) });
633
- };
634
- TooltipPortal.displayName = PORTAL_NAME;
635
- var CONTENT_NAME = "TooltipContent";
636
- var TooltipContent$1 = reactExports.forwardRef(
637
- (props, forwardedRef) => {
638
- const portalContext = usePortalContext$1(CONTENT_NAME, props.__scopeTooltip);
639
- const { forceMount = portalContext.forceMount, side = "top", ...contentProps } = props;
640
- const context = useTooltipContext(CONTENT_NAME, props.__scopeTooltip);
641
- return /* @__PURE__ */ jsxRuntimeExports.jsx(Presence, { present: forceMount || context.open, children: context.disableHoverableContent ? /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContentImpl, { side, ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContentHoverable, { side, ...contentProps, ref: forwardedRef }) });
642
- }
643
- );
644
- var TooltipContentHoverable = reactExports.forwardRef((props, forwardedRef) => {
645
- const context = useTooltipContext(CONTENT_NAME, props.__scopeTooltip);
646
- const providerContext = useTooltipProviderContext(CONTENT_NAME, props.__scopeTooltip);
647
- const ref = reactExports.useRef(null);
648
- const composedRefs = useComposedRefs(forwardedRef, ref);
649
- const [pointerGraceArea, setPointerGraceArea] = reactExports.useState(null);
650
- const { trigger, onClose } = context;
651
- const content = ref.current;
652
- const { onPointerInTransitChange } = providerContext;
653
- const handleRemoveGraceArea = reactExports.useCallback(() => {
654
- setPointerGraceArea(null);
655
- onPointerInTransitChange(false);
656
- }, [onPointerInTransitChange]);
657
- const handleCreateGraceArea = reactExports.useCallback(
658
- (event, hoverTarget) => {
659
- const currentTarget = event.currentTarget;
660
- const exitPoint = { x: event.clientX, y: event.clientY };
661
- const exitSide = getExitSideFromRect(exitPoint, currentTarget.getBoundingClientRect());
662
- const paddedExitPoints = getPaddedExitPoints(exitPoint, exitSide);
663
- const hoverTargetPoints = getPointsFromRect(hoverTarget.getBoundingClientRect());
664
- const graceArea = getHull([...paddedExitPoints, ...hoverTargetPoints]);
665
- setPointerGraceArea(graceArea);
666
- onPointerInTransitChange(true);
667
- },
668
- [onPointerInTransitChange]
669
- );
670
- reactExports.useEffect(() => {
671
- return () => handleRemoveGraceArea();
672
- }, [handleRemoveGraceArea]);
673
- reactExports.useEffect(() => {
674
- if (trigger && content) {
675
- const handleTriggerLeave = (event) => handleCreateGraceArea(event, content);
676
- const handleContentLeave = (event) => handleCreateGraceArea(event, trigger);
677
- trigger.addEventListener("pointerleave", handleTriggerLeave);
678
- content.addEventListener("pointerleave", handleContentLeave);
679
- return () => {
680
- trigger.removeEventListener("pointerleave", handleTriggerLeave);
681
- content.removeEventListener("pointerleave", handleContentLeave);
682
- };
683
- }
684
- }, [trigger, content, handleCreateGraceArea, handleRemoveGraceArea]);
685
- reactExports.useEffect(() => {
686
- if (pointerGraceArea) {
687
- const handleTrackPointerGrace = (event) => {
688
- const target = event.target;
689
- const pointerPosition = { x: event.clientX, y: event.clientY };
690
- const hasEnteredTarget = trigger?.contains(target) || content?.contains(target);
691
- const isPointerOutsideGraceArea = !isPointInPolygon$1(pointerPosition, pointerGraceArea);
692
- if (hasEnteredTarget) {
693
- handleRemoveGraceArea();
694
- } else if (isPointerOutsideGraceArea) {
695
- handleRemoveGraceArea();
696
- onClose();
697
- }
698
- };
699
- document.addEventListener("pointermove", handleTrackPointerGrace);
700
- return () => document.removeEventListener("pointermove", handleTrackPointerGrace);
701
- }
702
- }, [trigger, content, pointerGraceArea, onClose, handleRemoveGraceArea]);
703
- return /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContentImpl, { ...props, ref: composedRefs });
704
- });
705
- var [VisuallyHiddenContentContextProvider, useVisuallyHiddenContentContext] = createTooltipContext(TOOLTIP_NAME, { isInside: false });
706
- var Slottable = createSlottable("TooltipContent");
707
- var TooltipContentImpl = reactExports.forwardRef(
708
- (props, forwardedRef) => {
709
- const {
710
- __scopeTooltip,
711
- children,
712
- "aria-label": ariaLabel,
713
- onEscapeKeyDown,
714
- onPointerDownOutside,
715
- ...contentProps
716
- } = props;
717
- const context = useTooltipContext(CONTENT_NAME, __scopeTooltip);
718
- const popperScope = usePopperScope(__scopeTooltip);
719
- const { onClose } = context;
720
- reactExports.useEffect(() => {
721
- document.addEventListener(TOOLTIP_OPEN, onClose);
722
- return () => document.removeEventListener(TOOLTIP_OPEN, onClose);
723
- }, [onClose]);
724
- reactExports.useEffect(() => {
725
- if (context.trigger) {
726
- const handleScroll = (event) => {
727
- const target = event.target;
728
- if (target?.contains(context.trigger)) onClose();
729
- };
730
- window.addEventListener("scroll", handleScroll, { capture: true });
731
- return () => window.removeEventListener("scroll", handleScroll, { capture: true });
732
- }
733
- }, [context.trigger, onClose]);
734
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
735
- DismissableLayer,
736
- {
737
- asChild: true,
738
- disableOutsidePointerEvents: false,
739
- onEscapeKeyDown,
740
- onPointerDownOutside,
741
- onFocusOutside: (event) => event.preventDefault(),
742
- onDismiss: onClose,
743
- children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
744
- Content$1,
745
- {
746
- "data-state": context.stateAttribute,
747
- ...popperScope,
748
- ...contentProps,
749
- ref: forwardedRef,
750
- style: {
751
- ...contentProps.style,
752
- // re-namespace exposed content custom properties
753
- ...{
754
- "--radix-tooltip-content-transform-origin": "var(--radix-popper-transform-origin)",
755
- "--radix-tooltip-content-available-width": "var(--radix-popper-available-width)",
756
- "--radix-tooltip-content-available-height": "var(--radix-popper-available-height)",
757
- "--radix-tooltip-trigger-width": "var(--radix-popper-anchor-width)",
758
- "--radix-tooltip-trigger-height": "var(--radix-popper-anchor-height)"
759
- }
760
- },
761
- children: [
762
- /* @__PURE__ */ jsxRuntimeExports.jsx(Slottable, { children }),
763
- /* @__PURE__ */ jsxRuntimeExports.jsx(VisuallyHiddenContentContextProvider, { scope: __scopeTooltip, isInside: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Root$1, { id: context.contentId, role: "tooltip", children: ariaLabel || children }) })
764
- ]
765
- }
766
- )
767
- }
768
- );
4
+ var withSelector = { exports: {} };
5
+ var withSelector_production = {};
6
+ var shim = { exports: {} };
7
+ var useSyncExternalStoreShim_production = {};
8
+ var hasRequiredUseSyncExternalStoreShim_production;
9
+ function requireUseSyncExternalStoreShim_production() {
10
+ if (hasRequiredUseSyncExternalStoreShim_production) return useSyncExternalStoreShim_production;
11
+ hasRequiredUseSyncExternalStoreShim_production = 1;
12
+ var React2 = requireReact();
13
+ function is(x, y) {
14
+ return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y;
769
15
  }
770
- );
771
- TooltipContent$1.displayName = CONTENT_NAME;
772
- var ARROW_NAME = "TooltipArrow";
773
- var TooltipArrow = reactExports.forwardRef(
774
- (props, forwardedRef) => {
775
- const { __scopeTooltip, ...arrowProps } = props;
776
- const popperScope = usePopperScope(__scopeTooltip);
777
- const visuallyHiddenContentContext = useVisuallyHiddenContentContext(
778
- ARROW_NAME,
779
- __scopeTooltip
16
+ var objectIs = "function" === typeof Object.is ? Object.is : is, useState = React2.useState, useEffect = React2.useEffect, useLayoutEffect = React2.useLayoutEffect, useDebugValue = React2.useDebugValue;
17
+ function useSyncExternalStore$2(subscribe, getSnapshot) {
18
+ var value = getSnapshot(), _useState = useState({ inst: { value, getSnapshot } }), inst = _useState[0].inst, forceUpdate = _useState[1];
19
+ useLayoutEffect(
20
+ function() {
21
+ inst.value = value;
22
+ inst.getSnapshot = getSnapshot;
23
+ checkIfSnapshotChanged(inst) && forceUpdate({ inst });
24
+ },
25
+ [subscribe, value, getSnapshot]
780
26
  );
781
- return visuallyHiddenContentContext.isInside ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(Arrow, { ...popperScope, ...arrowProps, ref: forwardedRef });
27
+ useEffect(
28
+ function() {
29
+ checkIfSnapshotChanged(inst) && forceUpdate({ inst });
30
+ return subscribe(function() {
31
+ checkIfSnapshotChanged(inst) && forceUpdate({ inst });
32
+ });
33
+ },
34
+ [subscribe]
35
+ );
36
+ useDebugValue(value);
37
+ return value;
782
38
  }
783
- );
784
- TooltipArrow.displayName = ARROW_NAME;
785
- function getExitSideFromRect(point, rect) {
786
- const top = Math.abs(rect.top - point.y);
787
- const bottom = Math.abs(rect.bottom - point.y);
788
- const right = Math.abs(rect.right - point.x);
789
- const left = Math.abs(rect.left - point.x);
790
- switch (Math.min(top, bottom, right, left)) {
791
- case left:
792
- return "left";
793
- case right:
794
- return "right";
795
- case top:
796
- return "top";
797
- case bottom:
798
- return "bottom";
799
- default:
800
- throw new Error("unreachable");
39
+ function checkIfSnapshotChanged(inst) {
40
+ var latestGetSnapshot = inst.getSnapshot;
41
+ inst = inst.value;
42
+ try {
43
+ var nextValue = latestGetSnapshot();
44
+ return !objectIs(inst, nextValue);
45
+ } catch (error2) {
46
+ return true;
47
+ }
801
48
  }
49
+ function useSyncExternalStore$1(subscribe, getSnapshot) {
50
+ return getSnapshot();
51
+ }
52
+ var shim2 = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2;
53
+ useSyncExternalStoreShim_production.useSyncExternalStore = void 0 !== React2.useSyncExternalStore ? React2.useSyncExternalStore : shim2;
54
+ return useSyncExternalStoreShim_production;
802
55
  }
803
- function getPaddedExitPoints(exitPoint, exitSide, padding = 5) {
804
- const paddedExitPoints = [];
805
- switch (exitSide) {
806
- case "top":
807
- paddedExitPoints.push(
808
- { x: exitPoint.x - padding, y: exitPoint.y + padding },
809
- { x: exitPoint.x + padding, y: exitPoint.y + padding }
810
- );
811
- break;
812
- case "bottom":
813
- paddedExitPoints.push(
814
- { x: exitPoint.x - padding, y: exitPoint.y - padding },
815
- { x: exitPoint.x + padding, y: exitPoint.y - padding }
816
- );
817
- break;
818
- case "left":
819
- paddedExitPoints.push(
820
- { x: exitPoint.x + padding, y: exitPoint.y - padding },
821
- { x: exitPoint.x + padding, y: exitPoint.y + padding }
56
+ var useSyncExternalStoreShim_development = {};
57
+ var hasRequiredUseSyncExternalStoreShim_development;
58
+ function requireUseSyncExternalStoreShim_development() {
59
+ if (hasRequiredUseSyncExternalStoreShim_development) return useSyncExternalStoreShim_development;
60
+ hasRequiredUseSyncExternalStoreShim_development = 1;
61
+ "production" !== process.env.NODE_ENV && (function() {
62
+ function is(x, y) {
63
+ return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y;
64
+ }
65
+ function useSyncExternalStore$2(subscribe, getSnapshot) {
66
+ didWarnOld18Alpha || void 0 === React2.startTransition || (didWarnOld18Alpha = true, console.error(
67
+ "You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."
68
+ ));
69
+ var value = getSnapshot();
70
+ if (!didWarnUncachedGetSnapshot) {
71
+ var cachedValue = getSnapshot();
72
+ objectIs(value, cachedValue) || (console.error(
73
+ "The result of getSnapshot should be cached to avoid an infinite loop"
74
+ ), didWarnUncachedGetSnapshot = true);
75
+ }
76
+ cachedValue = useState({
77
+ inst: { value, getSnapshot }
78
+ });
79
+ var inst = cachedValue[0].inst, forceUpdate = cachedValue[1];
80
+ useLayoutEffect(
81
+ function() {
82
+ inst.value = value;
83
+ inst.getSnapshot = getSnapshot;
84
+ checkIfSnapshotChanged(inst) && forceUpdate({ inst });
85
+ },
86
+ [subscribe, value, getSnapshot]
822
87
  );
823
- break;
824
- case "right":
825
- paddedExitPoints.push(
826
- { x: exitPoint.x - padding, y: exitPoint.y - padding },
827
- { x: exitPoint.x - padding, y: exitPoint.y + padding }
88
+ useEffect(
89
+ function() {
90
+ checkIfSnapshotChanged(inst) && forceUpdate({ inst });
91
+ return subscribe(function() {
92
+ checkIfSnapshotChanged(inst) && forceUpdate({ inst });
93
+ });
94
+ },
95
+ [subscribe]
828
96
  );
829
- break;
830
- }
831
- return paddedExitPoints;
832
- }
833
- function getPointsFromRect(rect) {
834
- const { top, right, bottom, left } = rect;
835
- return [
836
- { x: left, y: top },
837
- { x: right, y: top },
838
- { x: right, y: bottom },
839
- { x: left, y: bottom }
840
- ];
841
- }
842
- function isPointInPolygon$1(point, polygon) {
843
- const { x, y } = point;
844
- let inside = false;
845
- for (let i = 0, j = polygon.length - 1; i < polygon.length; j = i++) {
846
- const ii = polygon[i];
847
- const jj = polygon[j];
848
- const xi = ii.x;
849
- const yi = ii.y;
850
- const xj = jj.x;
851
- const yj = jj.y;
852
- const intersect = yi > y !== yj > y && x < (xj - xi) * (y - yi) / (yj - yi) + xi;
853
- if (intersect) inside = !inside;
854
- }
855
- return inside;
856
- }
857
- function getHull(points) {
858
- const newPoints = points.slice();
859
- newPoints.sort((a, b) => {
860
- if (a.x < b.x) return -1;
861
- else if (a.x > b.x) return 1;
862
- else if (a.y < b.y) return -1;
863
- else if (a.y > b.y) return 1;
864
- else return 0;
865
- });
866
- return getHullPresorted(newPoints);
867
- }
868
- function getHullPresorted(points) {
869
- if (points.length <= 1) return points.slice();
870
- const upperHull = [];
871
- for (let i = 0; i < points.length; i++) {
872
- const p = points[i];
873
- while (upperHull.length >= 2) {
874
- const q = upperHull[upperHull.length - 1];
875
- const r = upperHull[upperHull.length - 2];
876
- if ((q.x - r.x) * (p.y - r.y) >= (q.y - r.y) * (p.x - r.x)) upperHull.pop();
877
- else break;
97
+ useDebugValue(value);
98
+ return value;
878
99
  }
879
- upperHull.push(p);
880
- }
881
- upperHull.pop();
882
- const lowerHull = [];
883
- for (let i = points.length - 1; i >= 0; i--) {
884
- const p = points[i];
885
- while (lowerHull.length >= 2) {
886
- const q = lowerHull[lowerHull.length - 1];
887
- const r = lowerHull[lowerHull.length - 2];
888
- if ((q.x - r.x) * (p.y - r.y) >= (q.y - r.y) * (p.x - r.x)) lowerHull.pop();
889
- else break;
100
+ function checkIfSnapshotChanged(inst) {
101
+ var latestGetSnapshot = inst.getSnapshot;
102
+ inst = inst.value;
103
+ try {
104
+ var nextValue = latestGetSnapshot();
105
+ return !objectIs(inst, nextValue);
106
+ } catch (error2) {
107
+ return true;
108
+ }
890
109
  }
891
- lowerHull.push(p);
892
- }
893
- lowerHull.pop();
894
- if (upperHull.length === 1 && lowerHull.length === 1 && upperHull[0].x === lowerHull[0].x && upperHull[0].y === lowerHull[0].y) {
895
- return upperHull;
110
+ function useSyncExternalStore$1(subscribe, getSnapshot) {
111
+ return getSnapshot();
112
+ }
113
+ "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
114
+ var React2 = requireReact(), objectIs = "function" === typeof Object.is ? Object.is : is, useState = React2.useState, useEffect = React2.useEffect, useLayoutEffect = React2.useLayoutEffect, useDebugValue = React2.useDebugValue, didWarnOld18Alpha = false, didWarnUncachedGetSnapshot = false, shim2 = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2;
115
+ useSyncExternalStoreShim_development.useSyncExternalStore = void 0 !== React2.useSyncExternalStore ? React2.useSyncExternalStore : shim2;
116
+ "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
117
+ })();
118
+ return useSyncExternalStoreShim_development;
119
+ }
120
+ var hasRequiredShim;
121
+ function requireShim() {
122
+ if (hasRequiredShim) return shim.exports;
123
+ hasRequiredShim = 1;
124
+ if (process.env.NODE_ENV === "production") {
125
+ shim.exports = requireUseSyncExternalStoreShim_production();
896
126
  } else {
897
- return upperHull.concat(lowerHull);
127
+ shim.exports = requireUseSyncExternalStoreShim_development();
898
128
  }
129
+ return shim.exports;
899
130
  }
900
- var Provider = TooltipProvider$1;
901
- var Root3 = Tooltip$1;
902
- var Trigger = TooltipTrigger$1;
903
- var Portal = TooltipPortal;
904
- var Content2 = TooltipContent$1;
905
- var Arrow2 = TooltipArrow;
906
- var withSelector = { exports: {} };
907
- var withSelector_production = {};
908
131
  var hasRequiredWithSelector_production;
909
132
  function requireWithSelector_production() {
910
133
  if (hasRequiredWithSelector_production) return withSelector_production;
@@ -1043,10 +266,313 @@ function requireWithSelector() {
1043
266
  } else {
1044
267
  withSelector.exports = requireWithSelector_development();
1045
268
  }
1046
- return withSelector.exports;
269
+ return withSelector.exports;
270
+ }
271
+ var withSelectorExports = requireWithSelector();
272
+ const useSyncExternalStoreExports = /* @__PURE__ */ getDefaultExportFromCjs(withSelectorExports);
273
+ var DIALOG_NAME = "Dialog";
274
+ var [createDialogContext, createDialogScope] = createContextScope(DIALOG_NAME);
275
+ var [DialogProvider, useDialogContext] = createDialogContext(DIALOG_NAME);
276
+ var Dialog = (props) => {
277
+ const {
278
+ __scopeDialog,
279
+ children,
280
+ open: openProp,
281
+ defaultOpen,
282
+ onOpenChange,
283
+ modal = true
284
+ } = props;
285
+ const triggerRef = reactExports.useRef(null);
286
+ const contentRef = reactExports.useRef(null);
287
+ const [open, setOpen] = useControllableState({
288
+ prop: openProp,
289
+ defaultProp: defaultOpen ?? false,
290
+ onChange: onOpenChange,
291
+ caller: DIALOG_NAME
292
+ });
293
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
294
+ DialogProvider,
295
+ {
296
+ scope: __scopeDialog,
297
+ triggerRef,
298
+ contentRef,
299
+ contentId: useId$1(),
300
+ titleId: useId$1(),
301
+ descriptionId: useId$1(),
302
+ open,
303
+ onOpenChange: setOpen,
304
+ onOpenToggle: reactExports.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]),
305
+ modal,
306
+ children
307
+ }
308
+ );
309
+ };
310
+ Dialog.displayName = DIALOG_NAME;
311
+ var TRIGGER_NAME$1 = "DialogTrigger";
312
+ var DialogTrigger = reactExports.forwardRef(
313
+ (props, forwardedRef) => {
314
+ const { __scopeDialog, ...triggerProps } = props;
315
+ const context = useDialogContext(TRIGGER_NAME$1, __scopeDialog);
316
+ const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);
317
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
318
+ Primitive.button,
319
+ {
320
+ type: "button",
321
+ "aria-haspopup": "dialog",
322
+ "aria-expanded": context.open,
323
+ "aria-controls": context.contentId,
324
+ "data-state": getState(context.open),
325
+ ...triggerProps,
326
+ ref: composedTriggerRef,
327
+ onClick: composeEventHandlers(props.onClick, context.onOpenToggle)
328
+ }
329
+ );
330
+ }
331
+ );
332
+ DialogTrigger.displayName = TRIGGER_NAME$1;
333
+ var PORTAL_NAME$1 = "DialogPortal";
334
+ var [PortalProvider$1, usePortalContext$2] = createDialogContext(PORTAL_NAME$1, {
335
+ forceMount: void 0
336
+ });
337
+ var DialogPortal = (props) => {
338
+ const { __scopeDialog, forceMount, children, container } = props;
339
+ const context = useDialogContext(PORTAL_NAME$1, __scopeDialog);
340
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(PortalProvider$1, { scope: __scopeDialog, forceMount, children: reactExports.Children.map(children, (child) => /* @__PURE__ */ jsxRuntimeExports.jsx(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Portal$2, { asChild: true, container, children: child }) })) });
341
+ };
342
+ DialogPortal.displayName = PORTAL_NAME$1;
343
+ var OVERLAY_NAME = "DialogOverlay";
344
+ var DialogOverlay = reactExports.forwardRef(
345
+ (props, forwardedRef) => {
346
+ const portalContext = usePortalContext$2(OVERLAY_NAME, props.__scopeDialog);
347
+ const { forceMount = portalContext.forceMount, ...overlayProps } = props;
348
+ const context = useDialogContext(OVERLAY_NAME, props.__scopeDialog);
349
+ return context.modal ? /* @__PURE__ */ jsxRuntimeExports.jsx(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsxRuntimeExports.jsx(DialogOverlayImpl, { ...overlayProps, ref: forwardedRef }) }) : null;
350
+ }
351
+ );
352
+ DialogOverlay.displayName = OVERLAY_NAME;
353
+ var Slot = createSlot("DialogOverlay.RemoveScroll");
354
+ var DialogOverlayImpl = reactExports.forwardRef(
355
+ (props, forwardedRef) => {
356
+ const { __scopeDialog, ...overlayProps } = props;
357
+ const context = useDialogContext(OVERLAY_NAME, __scopeDialog);
358
+ return (
359
+ // Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`
360
+ // ie. when `Overlay` and `Content` are siblings
361
+ /* @__PURE__ */ jsxRuntimeExports.jsx(ReactRemoveScroll, { as: Slot, allowPinchZoom: true, shards: [context.contentRef], children: /* @__PURE__ */ jsxRuntimeExports.jsx(
362
+ Primitive.div,
363
+ {
364
+ "data-state": getState(context.open),
365
+ ...overlayProps,
366
+ ref: forwardedRef,
367
+ style: { pointerEvents: "auto", ...overlayProps.style }
368
+ }
369
+ ) })
370
+ );
371
+ }
372
+ );
373
+ var CONTENT_NAME$1 = "DialogContent";
374
+ var DialogContent = reactExports.forwardRef(
375
+ (props, forwardedRef) => {
376
+ const portalContext = usePortalContext$2(CONTENT_NAME$1, props.__scopeDialog);
377
+ const { forceMount = portalContext.forceMount, ...contentProps } = props;
378
+ const context = useDialogContext(CONTENT_NAME$1, props.__scopeDialog);
379
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Presence, { present: forceMount || context.open, children: context.modal ? /* @__PURE__ */ jsxRuntimeExports.jsx(DialogContentModal, { ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ jsxRuntimeExports.jsx(DialogContentNonModal, { ...contentProps, ref: forwardedRef }) });
380
+ }
381
+ );
382
+ DialogContent.displayName = CONTENT_NAME$1;
383
+ var DialogContentModal = reactExports.forwardRef(
384
+ (props, forwardedRef) => {
385
+ const context = useDialogContext(CONTENT_NAME$1, props.__scopeDialog);
386
+ const contentRef = reactExports.useRef(null);
387
+ const composedRefs = useComposedRefs(forwardedRef, context.contentRef, contentRef);
388
+ reactExports.useEffect(() => {
389
+ const content = contentRef.current;
390
+ if (content) return hideOthers(content);
391
+ }, []);
392
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
393
+ DialogContentImpl,
394
+ {
395
+ ...props,
396
+ ref: composedRefs,
397
+ trapFocus: context.open,
398
+ disableOutsidePointerEvents: true,
399
+ onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, (event) => {
400
+ event.preventDefault();
401
+ context.triggerRef.current?.focus();
402
+ }),
403
+ onPointerDownOutside: composeEventHandlers(props.onPointerDownOutside, (event) => {
404
+ const originalEvent = event.detail.originalEvent;
405
+ const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
406
+ const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
407
+ if (isRightClick) event.preventDefault();
408
+ }),
409
+ onFocusOutside: composeEventHandlers(
410
+ props.onFocusOutside,
411
+ (event) => event.preventDefault()
412
+ )
413
+ }
414
+ );
415
+ }
416
+ );
417
+ var DialogContentNonModal = reactExports.forwardRef(
418
+ (props, forwardedRef) => {
419
+ const context = useDialogContext(CONTENT_NAME$1, props.__scopeDialog);
420
+ const hasInteractedOutsideRef = reactExports.useRef(false);
421
+ const hasPointerDownOutsideRef = reactExports.useRef(false);
422
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
423
+ DialogContentImpl,
424
+ {
425
+ ...props,
426
+ ref: forwardedRef,
427
+ trapFocus: false,
428
+ disableOutsidePointerEvents: false,
429
+ onCloseAutoFocus: (event) => {
430
+ props.onCloseAutoFocus?.(event);
431
+ if (!event.defaultPrevented) {
432
+ if (!hasInteractedOutsideRef.current) context.triggerRef.current?.focus();
433
+ event.preventDefault();
434
+ }
435
+ hasInteractedOutsideRef.current = false;
436
+ hasPointerDownOutsideRef.current = false;
437
+ },
438
+ onInteractOutside: (event) => {
439
+ props.onInteractOutside?.(event);
440
+ if (!event.defaultPrevented) {
441
+ hasInteractedOutsideRef.current = true;
442
+ if (event.detail.originalEvent.type === "pointerdown") {
443
+ hasPointerDownOutsideRef.current = true;
444
+ }
445
+ }
446
+ const target = event.target;
447
+ const targetIsTrigger = context.triggerRef.current?.contains(target);
448
+ if (targetIsTrigger) event.preventDefault();
449
+ if (event.detail.originalEvent.type === "focusin" && hasPointerDownOutsideRef.current) {
450
+ event.preventDefault();
451
+ }
452
+ }
453
+ }
454
+ );
455
+ }
456
+ );
457
+ var DialogContentImpl = reactExports.forwardRef(
458
+ (props, forwardedRef) => {
459
+ const { __scopeDialog, trapFocus, onOpenAutoFocus, onCloseAutoFocus, ...contentProps } = props;
460
+ const context = useDialogContext(CONTENT_NAME$1, __scopeDialog);
461
+ const contentRef = reactExports.useRef(null);
462
+ const composedRefs = useComposedRefs(forwardedRef, contentRef);
463
+ useFocusGuards();
464
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
465
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
466
+ FocusScope,
467
+ {
468
+ asChild: true,
469
+ loop: true,
470
+ trapped: trapFocus,
471
+ onMountAutoFocus: onOpenAutoFocus,
472
+ onUnmountAutoFocus: onCloseAutoFocus,
473
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(
474
+ DismissableLayer,
475
+ {
476
+ role: "dialog",
477
+ id: context.contentId,
478
+ "aria-describedby": context.descriptionId,
479
+ "aria-labelledby": context.titleId,
480
+ "data-state": getState(context.open),
481
+ ...contentProps,
482
+ ref: composedRefs,
483
+ onDismiss: () => context.onOpenChange(false)
484
+ }
485
+ )
486
+ }
487
+ ),
488
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
489
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TitleWarning, { titleId: context.titleId }),
490
+ /* @__PURE__ */ jsxRuntimeExports.jsx(DescriptionWarning, { contentRef, descriptionId: context.descriptionId })
491
+ ] })
492
+ ] });
493
+ }
494
+ );
495
+ var TITLE_NAME = "DialogTitle";
496
+ var DialogTitle = reactExports.forwardRef(
497
+ (props, forwardedRef) => {
498
+ const { __scopeDialog, ...titleProps } = props;
499
+ const context = useDialogContext(TITLE_NAME, __scopeDialog);
500
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Primitive.h2, { id: context.titleId, ...titleProps, ref: forwardedRef });
501
+ }
502
+ );
503
+ DialogTitle.displayName = TITLE_NAME;
504
+ var DESCRIPTION_NAME = "DialogDescription";
505
+ var DialogDescription = reactExports.forwardRef(
506
+ (props, forwardedRef) => {
507
+ const { __scopeDialog, ...descriptionProps } = props;
508
+ const context = useDialogContext(DESCRIPTION_NAME, __scopeDialog);
509
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Primitive.p, { id: context.descriptionId, ...descriptionProps, ref: forwardedRef });
510
+ }
511
+ );
512
+ DialogDescription.displayName = DESCRIPTION_NAME;
513
+ var CLOSE_NAME = "DialogClose";
514
+ var DialogClose = reactExports.forwardRef(
515
+ (props, forwardedRef) => {
516
+ const { __scopeDialog, ...closeProps } = props;
517
+ const context = useDialogContext(CLOSE_NAME, __scopeDialog);
518
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
519
+ Primitive.button,
520
+ {
521
+ type: "button",
522
+ ...closeProps,
523
+ ref: forwardedRef,
524
+ onClick: composeEventHandlers(props.onClick, () => context.onOpenChange(false))
525
+ }
526
+ );
527
+ }
528
+ );
529
+ DialogClose.displayName = CLOSE_NAME;
530
+ function getState(open) {
531
+ return open ? "open" : "closed";
1047
532
  }
1048
- var withSelectorExports = requireWithSelector();
1049
- const useSyncExternalStoreExports = /* @__PURE__ */ getDefaultExportFromCjs(withSelectorExports);
533
+ var TITLE_WARNING_NAME = "DialogTitleWarning";
534
+ var [WarningProvider, useWarningContext] = createContext2(TITLE_WARNING_NAME, {
535
+ contentName: CONTENT_NAME$1,
536
+ titleName: TITLE_NAME,
537
+ docsSlug: "dialog"
538
+ });
539
+ var TitleWarning = ({ titleId }) => {
540
+ const titleWarningContext = useWarningContext(TITLE_WARNING_NAME);
541
+ const MESSAGE = `\`${titleWarningContext.contentName}\` requires a \`${titleWarningContext.titleName}\` for the component to be accessible for screen reader users.
542
+
543
+ If you want to hide the \`${titleWarningContext.titleName}\`, you can wrap it with our VisuallyHidden component.
544
+
545
+ For more information, see https://radix-ui.com/primitives/docs/components/${titleWarningContext.docsSlug}`;
546
+ reactExports.useEffect(() => {
547
+ if (titleId) {
548
+ const hasTitle = document.getElementById(titleId);
549
+ if (!hasTitle) console.error(MESSAGE);
550
+ }
551
+ }, [MESSAGE, titleId]);
552
+ return null;
553
+ };
554
+ var DESCRIPTION_WARNING_NAME = "DialogDescriptionWarning";
555
+ var DescriptionWarning = ({ contentRef, descriptionId }) => {
556
+ const descriptionWarningContext = useWarningContext(DESCRIPTION_WARNING_NAME);
557
+ const MESSAGE = `Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${descriptionWarningContext.contentName}}.`;
558
+ reactExports.useEffect(() => {
559
+ const describedById = contentRef.current?.getAttribute("aria-describedby");
560
+ if (descriptionId && describedById) {
561
+ const hasDescription = document.getElementById(descriptionId);
562
+ if (!hasDescription) console.warn(MESSAGE);
563
+ }
564
+ }, [MESSAGE, contentRef, descriptionId]);
565
+ return null;
566
+ };
567
+ var Root = Dialog;
568
+ var Trigger$1 = DialogTrigger;
569
+ var Portal$1 = DialogPortal;
570
+ var Overlay = DialogOverlay;
571
+ var Content = DialogContent;
572
+ var Title = DialogTitle;
573
+ var Description = DialogDescription;
574
+ var Close = DialogClose;
575
+ var shimExports = requireShim();
1050
576
  const SafeReact = {
1051
577
  ...React
1052
578
  };
@@ -3512,7 +3038,7 @@ function markOthers(avoidElements, ariaHidden = false, inert = false) {
3512
3038
  }
3513
3039
  const PortalContext = /* @__PURE__ */ reactExports.createContext(null);
3514
3040
  if (process.env.NODE_ENV !== "production") PortalContext.displayName = "PortalContext";
3515
- const usePortalContext = () => reactExports.useContext(PortalContext);
3041
+ const usePortalContext$1 = () => reactExports.useContext(PortalContext);
3516
3042
  const attr = createAttribute("portal");
3517
3043
  function useFloatingPortalNode(props = {}) {
3518
3044
  const {
@@ -3523,7 +3049,7 @@ function useFloatingPortalNode(props = {}) {
3523
3049
  elementState
3524
3050
  } = props;
3525
3051
  const uniqueId = useId();
3526
- const portalContext = usePortalContext();
3052
+ const portalContext = usePortalContext$1();
3527
3053
  const parentPortalNode = portalContext?.portalNode;
3528
3054
  const [containerElement, setContainerElement] = reactExports.useState(null);
3529
3055
  const [portalNode, setPortalNode] = reactExports.useState(null);
@@ -3781,7 +3307,7 @@ function FloatingFocusManager(props) {
3781
3307
  const returnFocusRef = useValueAsRef(returnFocus);
3782
3308
  const openInteractionTypeRef = useValueAsRef(openInteractionType);
3783
3309
  const tree = useFloatingTree(externalTree);
3784
- const portalContext = usePortalContext();
3310
+ const portalContext = usePortalContext$1();
3785
3311
  const startDismissButtonRef = reactExports.useRef(null);
3786
3312
  const endDismissButtonRef = reactExports.useRef(null);
3787
3313
  const preventReturnFocusRef = reactExports.useRef(false);
@@ -7162,7 +6688,7 @@ function useTypeahead(context, props) {
7162
6688
  floating
7163
6689
  } : {}, [enabled, reference, floating]);
7164
6690
  }
7165
- function isPointInPolygon(point, polygon) {
6691
+ function isPointInPolygon$1(point, polygon) {
7166
6692
  const [x, y] = point;
7167
6693
  let isInsideValue = false;
7168
6694
  const length = polygon.length;
@@ -7316,7 +6842,7 @@ function safePolygon(options = {}) {
7316
6842
  return [];
7317
6843
  }
7318
6844
  }
7319
- if (isPointInPolygon([clientX, clientY], rectPoly)) {
6845
+ if (isPointInPolygon$1([clientX, clientY], rectPoly)) {
7320
6846
  return void 0;
7321
6847
  }
7322
6848
  if (hasLanded && !isOverReferenceRect) {
@@ -7329,7 +6855,7 @@ function safePolygon(options = {}) {
7329
6855
  return close();
7330
6856
  }
7331
6857
  }
7332
- if (!isPointInPolygon([clientX, clientY], getPolygon([x, y]))) {
6858
+ if (!isPointInPolygon$1([clientX, clientY], getPolygon([x, y]))) {
7333
6859
  close();
7334
6860
  } else if (!hasLanded && requireIntent) {
7335
6861
  timeout.start(40, close);
@@ -9165,265 +8691,739 @@ const MenuSubmenuTrigger = /* @__PURE__ */ reactExports.forwardRef(function Subm
9165
8691
  });
9166
8692
  return element;
9167
8693
  });
9168
- if (process.env.NODE_ENV !== "production") MenuSubmenuTrigger.displayName = "MenuSubmenuTrigger";
9169
- function ContextMenuRoot(props) {
9170
- const [anchor, setAnchor] = reactExports.useState({
9171
- getBoundingClientRect() {
9172
- return DOMRect.fromRect({
9173
- width: 0,
9174
- height: 0,
9175
- x: 0,
9176
- y: 0
9177
- });
8694
+ if (process.env.NODE_ENV !== "production") MenuSubmenuTrigger.displayName = "MenuSubmenuTrigger";
8695
+ function ContextMenuRoot(props) {
8696
+ const [anchor, setAnchor] = reactExports.useState({
8697
+ getBoundingClientRect() {
8698
+ return DOMRect.fromRect({
8699
+ width: 0,
8700
+ height: 0,
8701
+ x: 0,
8702
+ y: 0
8703
+ });
8704
+ }
8705
+ });
8706
+ const backdropRef = reactExports.useRef(null);
8707
+ const internalBackdropRef = reactExports.useRef(null);
8708
+ const actionsRef = reactExports.useRef(null);
8709
+ const positionerRef = reactExports.useRef(null);
8710
+ const allowMouseUpTriggerRef = reactExports.useRef(true);
8711
+ const initialCursorPointRef = reactExports.useRef(null);
8712
+ const id = useId();
8713
+ const contextValue = reactExports.useMemo(() => ({
8714
+ anchor,
8715
+ setAnchor,
8716
+ actionsRef,
8717
+ backdropRef,
8718
+ internalBackdropRef,
8719
+ positionerRef,
8720
+ allowMouseUpTriggerRef,
8721
+ initialCursorPointRef,
8722
+ rootId: id
8723
+ }), [anchor, id]);
8724
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(ContextMenuRootContext.Provider, {
8725
+ value: contextValue,
8726
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(MenuRootContext.Provider, {
8727
+ value: void 0,
8728
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(MenuRoot, {
8729
+ ...props
8730
+ })
8731
+ })
8732
+ });
8733
+ }
8734
+ const LONG_PRESS_DELAY = 500;
8735
+ const ContextMenuTrigger$1 = /* @__PURE__ */ reactExports.forwardRef(function ContextMenuTrigger(componentProps, forwardedRef) {
8736
+ const {
8737
+ render,
8738
+ className,
8739
+ ...elementProps
8740
+ } = componentProps;
8741
+ const {
8742
+ setAnchor,
8743
+ actionsRef,
8744
+ internalBackdropRef,
8745
+ backdropRef,
8746
+ positionerRef,
8747
+ allowMouseUpTriggerRef,
8748
+ initialCursorPointRef,
8749
+ rootId
8750
+ } = useContextMenuRootContext(false);
8751
+ const {
8752
+ store
8753
+ } = useMenuRootContext(false);
8754
+ const open = store.useState("open");
8755
+ const triggerRef = reactExports.useRef(null);
8756
+ const touchPositionRef = reactExports.useRef(null);
8757
+ const longPressTimeout = useTimeout();
8758
+ const allowMouseUpTimeout = useTimeout();
8759
+ const allowMouseUpRef = reactExports.useRef(false);
8760
+ function handleLongPress(x, y, event) {
8761
+ const isTouchEvent = event.type.startsWith("touch");
8762
+ initialCursorPointRef.current = {
8763
+ x,
8764
+ y
8765
+ };
8766
+ setAnchor({
8767
+ getBoundingClientRect() {
8768
+ return DOMRect.fromRect({
8769
+ width: isTouchEvent ? 10 : 0,
8770
+ height: isTouchEvent ? 10 : 0,
8771
+ x,
8772
+ y
8773
+ });
8774
+ }
8775
+ });
8776
+ allowMouseUpRef.current = false;
8777
+ actionsRef.current?.setOpen(true, createChangeEventDetails(triggerPress, event));
8778
+ allowMouseUpTimeout.start(LONG_PRESS_DELAY, () => {
8779
+ allowMouseUpRef.current = true;
8780
+ });
8781
+ }
8782
+ function handleContextMenu(event) {
8783
+ allowMouseUpTriggerRef.current = true;
8784
+ stopEvent(event);
8785
+ handleLongPress(event.clientX, event.clientY, event.nativeEvent);
8786
+ const doc = ownerDocument(triggerRef.current);
8787
+ doc.addEventListener("mouseup", (mouseEvent) => {
8788
+ allowMouseUpTriggerRef.current = false;
8789
+ if (!allowMouseUpRef.current) {
8790
+ return;
8791
+ }
8792
+ allowMouseUpTimeout.clear();
8793
+ allowMouseUpRef.current = false;
8794
+ const mouseUpTarget = getTarget(mouseEvent);
8795
+ if (contains(positionerRef.current, mouseUpTarget)) {
8796
+ return;
8797
+ }
8798
+ if (rootId && mouseUpTarget && findRootOwnerId(mouseUpTarget) === rootId) {
8799
+ return;
8800
+ }
8801
+ actionsRef.current?.setOpen(false, createChangeEventDetails(cancelOpen, mouseEvent));
8802
+ }, {
8803
+ once: true
8804
+ });
8805
+ }
8806
+ function handleTouchStart(event) {
8807
+ allowMouseUpTriggerRef.current = false;
8808
+ if (event.touches.length === 1) {
8809
+ event.stopPropagation();
8810
+ const touch = event.touches[0];
8811
+ touchPositionRef.current = {
8812
+ x: touch.clientX,
8813
+ y: touch.clientY
8814
+ };
8815
+ longPressTimeout.start(LONG_PRESS_DELAY, () => {
8816
+ if (touchPositionRef.current) {
8817
+ handleLongPress(touchPositionRef.current.x, touchPositionRef.current.y, event.nativeEvent);
8818
+ }
8819
+ });
8820
+ }
8821
+ }
8822
+ function handleTouchMove(event) {
8823
+ if (longPressTimeout.isStarted() && touchPositionRef.current && event.touches.length === 1) {
8824
+ const touch = event.touches[0];
8825
+ const moveThreshold = 10;
8826
+ const deltaX = Math.abs(touch.clientX - touchPositionRef.current.x);
8827
+ const deltaY = Math.abs(touch.clientY - touchPositionRef.current.y);
8828
+ if (deltaX > moveThreshold || deltaY > moveThreshold) {
8829
+ longPressTimeout.clear();
8830
+ }
8831
+ }
8832
+ }
8833
+ function handleTouchEnd() {
8834
+ longPressTimeout.clear();
8835
+ touchPositionRef.current = null;
8836
+ }
8837
+ reactExports.useEffect(() => {
8838
+ function handleDocumentContextMenu(event) {
8839
+ const target = getTarget(event);
8840
+ const targetElement = target;
8841
+ if (contains(triggerRef.current, targetElement) || contains(internalBackdropRef.current, targetElement) || contains(backdropRef.current, targetElement)) {
8842
+ event.preventDefault();
8843
+ }
8844
+ }
8845
+ const doc = ownerDocument(triggerRef.current);
8846
+ doc.addEventListener("contextmenu", handleDocumentContextMenu);
8847
+ return () => {
8848
+ doc.removeEventListener("contextmenu", handleDocumentContextMenu);
8849
+ };
8850
+ }, [backdropRef, internalBackdropRef]);
8851
+ const state = reactExports.useMemo(() => ({
8852
+ open
8853
+ }), [open]);
8854
+ const element = useRenderElement("div", componentProps, {
8855
+ state,
8856
+ ref: [triggerRef, forwardedRef],
8857
+ props: [{
8858
+ onContextMenu: handleContextMenu,
8859
+ onTouchStart: handleTouchStart,
8860
+ onTouchMove: handleTouchMove,
8861
+ onTouchEnd: handleTouchEnd,
8862
+ onTouchCancel: handleTouchEnd,
8863
+ style: {
8864
+ WebkitTouchCallout: "none"
8865
+ }
8866
+ }, elementProps],
8867
+ stateAttributesMapping: pressableTriggerOpenStateMapping
8868
+ });
8869
+ return element;
8870
+ });
8871
+ if (process.env.NODE_ENV !== "production") ContextMenuTrigger$1.displayName = "ContextMenuTrigger";
8872
+ function ContextMenu({ ...props }) {
8873
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(ContextMenuRoot, { ...props });
8874
+ }
8875
+ function ContextMenuTrigger2(props) {
8876
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(ContextMenuTrigger$1, { ...props });
8877
+ }
8878
+ const menuVariants = cva(
8879
+ "min-w-50 origin-(--transform-origin) rounded-md bg-popover p-1 text-popover-foreground shadow-lg border transition-opacity data-ending-style:opacity-0"
8880
+ );
8881
+ function ContextMenuContent({
8882
+ className,
8883
+ align = "start",
8884
+ alignOffset = 4,
8885
+ side = "right",
8886
+ sideOffset = 0,
8887
+ ...props
8888
+ }) {
8889
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(MenuPortal, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
8890
+ MenuPositioner,
8891
+ {
8892
+ className: "outline-none z-40",
8893
+ align,
8894
+ alignOffset,
8895
+ side,
8896
+ sideOffset,
8897
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(MenuPopup, { className: cn(menuVariants(), className), ...props })
9178
8898
  }
9179
- });
9180
- const backdropRef = reactExports.useRef(null);
9181
- const internalBackdropRef = reactExports.useRef(null);
9182
- const actionsRef = reactExports.useRef(null);
9183
- const positionerRef = reactExports.useRef(null);
9184
- const allowMouseUpTriggerRef = reactExports.useRef(true);
9185
- const initialCursorPointRef = reactExports.useRef(null);
9186
- const id = useId();
9187
- const contextValue = reactExports.useMemo(() => ({
9188
- anchor,
9189
- setAnchor,
9190
- actionsRef,
9191
- backdropRef,
9192
- internalBackdropRef,
9193
- positionerRef,
9194
- allowMouseUpTriggerRef,
9195
- initialCursorPointRef,
9196
- rootId: id
9197
- }), [anchor, id]);
9198
- return /* @__PURE__ */ jsxRuntimeExports.jsx(ContextMenuRootContext.Provider, {
9199
- value: contextValue,
9200
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(MenuRootContext.Provider, {
9201
- value: void 0,
9202
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(MenuRoot, {
9203
- ...props
9204
- })
9205
- })
9206
- });
8899
+ ) });
9207
8900
  }
9208
- const LONG_PRESS_DELAY = 500;
9209
- const ContextMenuTrigger$1 = /* @__PURE__ */ reactExports.forwardRef(function ContextMenuTrigger(componentProps, forwardedRef) {
9210
- const {
9211
- render,
9212
- className,
9213
- ...elementProps
9214
- } = componentProps;
8901
+ function ContextMenuGroup({ ...props }) {
8902
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(MenuGroup, { ...props });
8903
+ }
8904
+ const menuItemVariants = cva(
8905
+ "flex group/context-menu-item gap-2 items-center font-medium px-3 py-2 text-sm leading-4 rounded-lg outline-none select-none [&_svg]:shrink-0 [&_svg]:size-4",
8906
+ {
8907
+ variants: {
8908
+ variant: {
8909
+ destructive: "text-destructive data-highlighted:bg-destructive/20",
8910
+ default: "data-highlighted:bg-accent data-highlighted:text-accent-foreground"
8911
+ }
8912
+ },
8913
+ defaultVariants: {
8914
+ variant: "default"
8915
+ }
8916
+ }
8917
+ );
8918
+ function ContextMenuItem({
8919
+ className,
8920
+ inset,
8921
+ variant = "default",
8922
+ ...props
8923
+ }) {
8924
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
8925
+ MenuItem,
8926
+ {
8927
+ "data-inset": inset,
8928
+ "data-variant": variant,
8929
+ className: cn(menuItemVariants({ variant }), className),
8930
+ ...props
8931
+ }
8932
+ );
8933
+ }
8934
+ function ContextMenuSub({ ...props }) {
8935
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(MenuSubmenuRoot, { ...props });
8936
+ }
8937
+ function ContextMenuSubTrigger({
8938
+ className,
8939
+ children,
8940
+ ...props
8941
+ }) {
8942
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(MenuSubmenuTrigger, { className: cn(menuItemVariants(), className), ...props, children: [
8943
+ children,
8944
+ /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronRight, { className: "ms-auto text-muted-foreground" })
8945
+ ] });
8946
+ }
8947
+ function ContextMenuSubContent({
8948
+ className,
8949
+ ...props
8950
+ }) {
8951
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(ContextMenuContent, { className: cn(menuVariants(), className), ...props });
8952
+ }
8953
+ var [createTooltipContext] = createContextScope("Tooltip", [
8954
+ createPopperScope
8955
+ ]);
8956
+ var usePopperScope = createPopperScope();
8957
+ var PROVIDER_NAME = "TooltipProvider";
8958
+ var DEFAULT_DELAY_DURATION = 700;
8959
+ var TOOLTIP_OPEN = "tooltip.open";
8960
+ var [TooltipProviderContextProvider, useTooltipProviderContext] = createTooltipContext(PROVIDER_NAME);
8961
+ var TooltipProvider$1 = (props) => {
9215
8962
  const {
9216
- setAnchor,
9217
- actionsRef,
9218
- internalBackdropRef,
9219
- backdropRef,
9220
- positionerRef,
9221
- allowMouseUpTriggerRef,
9222
- initialCursorPointRef,
9223
- rootId
9224
- } = useContextMenuRootContext(false);
8963
+ __scopeTooltip,
8964
+ delayDuration = DEFAULT_DELAY_DURATION,
8965
+ skipDelayDuration = 300,
8966
+ disableHoverableContent = false,
8967
+ children
8968
+ } = props;
8969
+ const isOpenDelayedRef = reactExports.useRef(true);
8970
+ const isPointerInTransitRef = reactExports.useRef(false);
8971
+ const skipDelayTimerRef = reactExports.useRef(0);
8972
+ reactExports.useEffect(() => {
8973
+ const skipDelayTimer = skipDelayTimerRef.current;
8974
+ return () => window.clearTimeout(skipDelayTimer);
8975
+ }, []);
8976
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
8977
+ TooltipProviderContextProvider,
8978
+ {
8979
+ scope: __scopeTooltip,
8980
+ isOpenDelayedRef,
8981
+ delayDuration,
8982
+ onOpen: reactExports.useCallback(() => {
8983
+ window.clearTimeout(skipDelayTimerRef.current);
8984
+ isOpenDelayedRef.current = false;
8985
+ }, []),
8986
+ onClose: reactExports.useCallback(() => {
8987
+ window.clearTimeout(skipDelayTimerRef.current);
8988
+ skipDelayTimerRef.current = window.setTimeout(
8989
+ () => isOpenDelayedRef.current = true,
8990
+ skipDelayDuration
8991
+ );
8992
+ }, [skipDelayDuration]),
8993
+ isPointerInTransitRef,
8994
+ onPointerInTransitChange: reactExports.useCallback((inTransit) => {
8995
+ isPointerInTransitRef.current = inTransit;
8996
+ }, []),
8997
+ disableHoverableContent,
8998
+ children
8999
+ }
9000
+ );
9001
+ };
9002
+ TooltipProvider$1.displayName = PROVIDER_NAME;
9003
+ var TOOLTIP_NAME = "Tooltip";
9004
+ var [TooltipContextProvider, useTooltipContext] = createTooltipContext(TOOLTIP_NAME);
9005
+ var Tooltip$1 = (props) => {
9225
9006
  const {
9226
- store
9227
- } = useMenuRootContext(false);
9228
- const open = store.useState("open");
9229
- const triggerRef = reactExports.useRef(null);
9230
- const touchPositionRef = reactExports.useRef(null);
9231
- const longPressTimeout = useTimeout();
9232
- const allowMouseUpTimeout = useTimeout();
9233
- const allowMouseUpRef = reactExports.useRef(false);
9234
- function handleLongPress(x, y, event) {
9235
- const isTouchEvent = event.type.startsWith("touch");
9236
- initialCursorPointRef.current = {
9237
- x,
9238
- y
9007
+ __scopeTooltip,
9008
+ children,
9009
+ open: openProp,
9010
+ defaultOpen,
9011
+ onOpenChange,
9012
+ disableHoverableContent: disableHoverableContentProp,
9013
+ delayDuration: delayDurationProp
9014
+ } = props;
9015
+ const providerContext = useTooltipProviderContext(TOOLTIP_NAME, props.__scopeTooltip);
9016
+ const popperScope = usePopperScope(__scopeTooltip);
9017
+ const [trigger, setTrigger] = reactExports.useState(null);
9018
+ const contentId = useId$1();
9019
+ const openTimerRef = reactExports.useRef(0);
9020
+ const disableHoverableContent = disableHoverableContentProp ?? providerContext.disableHoverableContent;
9021
+ const delayDuration = delayDurationProp ?? providerContext.delayDuration;
9022
+ const wasOpenDelayedRef = reactExports.useRef(false);
9023
+ const [open, setOpen] = useControllableState({
9024
+ prop: openProp,
9025
+ defaultProp: defaultOpen ?? false,
9026
+ onChange: (open2) => {
9027
+ if (open2) {
9028
+ providerContext.onOpen();
9029
+ document.dispatchEvent(new CustomEvent(TOOLTIP_OPEN));
9030
+ } else {
9031
+ providerContext.onClose();
9032
+ }
9033
+ onOpenChange?.(open2);
9034
+ },
9035
+ caller: TOOLTIP_NAME
9036
+ });
9037
+ const stateAttribute = reactExports.useMemo(() => {
9038
+ return open ? wasOpenDelayedRef.current ? "delayed-open" : "instant-open" : "closed";
9039
+ }, [open]);
9040
+ const handleOpen = reactExports.useCallback(() => {
9041
+ window.clearTimeout(openTimerRef.current);
9042
+ openTimerRef.current = 0;
9043
+ wasOpenDelayedRef.current = false;
9044
+ setOpen(true);
9045
+ }, [setOpen]);
9046
+ const handleClose = reactExports.useCallback(() => {
9047
+ window.clearTimeout(openTimerRef.current);
9048
+ openTimerRef.current = 0;
9049
+ setOpen(false);
9050
+ }, [setOpen]);
9051
+ const handleDelayedOpen = reactExports.useCallback(() => {
9052
+ window.clearTimeout(openTimerRef.current);
9053
+ openTimerRef.current = window.setTimeout(() => {
9054
+ wasOpenDelayedRef.current = true;
9055
+ setOpen(true);
9056
+ openTimerRef.current = 0;
9057
+ }, delayDuration);
9058
+ }, [delayDuration, setOpen]);
9059
+ reactExports.useEffect(() => {
9060
+ return () => {
9061
+ if (openTimerRef.current) {
9062
+ window.clearTimeout(openTimerRef.current);
9063
+ openTimerRef.current = 0;
9064
+ }
9239
9065
  };
9240
- setAnchor({
9241
- getBoundingClientRect() {
9242
- return DOMRect.fromRect({
9243
- width: isTouchEvent ? 10 : 0,
9244
- height: isTouchEvent ? 10 : 0,
9245
- x,
9246
- y
9247
- });
9066
+ }, []);
9067
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Root2, { ...popperScope, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
9068
+ TooltipContextProvider,
9069
+ {
9070
+ scope: __scopeTooltip,
9071
+ contentId,
9072
+ open,
9073
+ stateAttribute,
9074
+ trigger,
9075
+ onTriggerChange: setTrigger,
9076
+ onTriggerEnter: reactExports.useCallback(() => {
9077
+ if (providerContext.isOpenDelayedRef.current) handleDelayedOpen();
9078
+ else handleOpen();
9079
+ }, [providerContext.isOpenDelayedRef, handleDelayedOpen, handleOpen]),
9080
+ onTriggerLeave: reactExports.useCallback(() => {
9081
+ if (disableHoverableContent) {
9082
+ handleClose();
9083
+ } else {
9084
+ window.clearTimeout(openTimerRef.current);
9085
+ openTimerRef.current = 0;
9086
+ }
9087
+ }, [handleClose, disableHoverableContent]),
9088
+ onOpen: handleOpen,
9089
+ onClose: handleClose,
9090
+ disableHoverableContent,
9091
+ children
9092
+ }
9093
+ ) });
9094
+ };
9095
+ Tooltip$1.displayName = TOOLTIP_NAME;
9096
+ var TRIGGER_NAME = "TooltipTrigger";
9097
+ var TooltipTrigger$1 = reactExports.forwardRef(
9098
+ (props, forwardedRef) => {
9099
+ const { __scopeTooltip, ...triggerProps } = props;
9100
+ const context = useTooltipContext(TRIGGER_NAME, __scopeTooltip);
9101
+ const providerContext = useTooltipProviderContext(TRIGGER_NAME, __scopeTooltip);
9102
+ const popperScope = usePopperScope(__scopeTooltip);
9103
+ const ref = reactExports.useRef(null);
9104
+ const composedRefs = useComposedRefs(forwardedRef, ref, context.onTriggerChange);
9105
+ const isPointerDownRef = reactExports.useRef(false);
9106
+ const hasPointerMoveOpenedRef = reactExports.useRef(false);
9107
+ const handlePointerUp = reactExports.useCallback(() => isPointerDownRef.current = false, []);
9108
+ reactExports.useEffect(() => {
9109
+ return () => document.removeEventListener("pointerup", handlePointerUp);
9110
+ }, [handlePointerUp]);
9111
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Anchor, { asChild: true, ...popperScope, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
9112
+ Primitive.button,
9113
+ {
9114
+ "aria-describedby": context.open ? context.contentId : void 0,
9115
+ "data-state": context.stateAttribute,
9116
+ ...triggerProps,
9117
+ ref: composedRefs,
9118
+ onPointerMove: composeEventHandlers(props.onPointerMove, (event) => {
9119
+ if (event.pointerType === "touch") return;
9120
+ if (!hasPointerMoveOpenedRef.current && !providerContext.isPointerInTransitRef.current) {
9121
+ context.onTriggerEnter();
9122
+ hasPointerMoveOpenedRef.current = true;
9123
+ }
9124
+ }),
9125
+ onPointerLeave: composeEventHandlers(props.onPointerLeave, () => {
9126
+ context.onTriggerLeave();
9127
+ hasPointerMoveOpenedRef.current = false;
9128
+ }),
9129
+ onPointerDown: composeEventHandlers(props.onPointerDown, () => {
9130
+ if (context.open) {
9131
+ context.onClose();
9132
+ }
9133
+ isPointerDownRef.current = true;
9134
+ document.addEventListener("pointerup", handlePointerUp, { once: true });
9135
+ }),
9136
+ onFocus: composeEventHandlers(props.onFocus, () => {
9137
+ if (!isPointerDownRef.current) context.onOpen();
9138
+ }),
9139
+ onBlur: composeEventHandlers(props.onBlur, context.onClose),
9140
+ onClick: composeEventHandlers(props.onClick, context.onClose)
9248
9141
  }
9249
- });
9250
- allowMouseUpRef.current = false;
9251
- actionsRef.current?.setOpen(true, createChangeEventDetails(triggerPress, event));
9252
- allowMouseUpTimeout.start(LONG_PRESS_DELAY, () => {
9253
- allowMouseUpRef.current = true;
9254
- });
9142
+ ) });
9255
9143
  }
9256
- function handleContextMenu(event) {
9257
- allowMouseUpTriggerRef.current = true;
9258
- stopEvent(event);
9259
- handleLongPress(event.clientX, event.clientY, event.nativeEvent);
9260
- const doc = ownerDocument(triggerRef.current);
9261
- doc.addEventListener("mouseup", (mouseEvent) => {
9262
- allowMouseUpTriggerRef.current = false;
9263
- if (!allowMouseUpRef.current) {
9264
- return;
9265
- }
9266
- allowMouseUpTimeout.clear();
9267
- allowMouseUpRef.current = false;
9268
- const mouseUpTarget = getTarget(mouseEvent);
9269
- if (contains(positionerRef.current, mouseUpTarget)) {
9270
- return;
9271
- }
9272
- if (rootId && mouseUpTarget && findRootOwnerId(mouseUpTarget) === rootId) {
9273
- return;
9274
- }
9275
- actionsRef.current?.setOpen(false, createChangeEventDetails(cancelOpen, mouseEvent));
9276
- }, {
9277
- once: true
9278
- });
9144
+ );
9145
+ TooltipTrigger$1.displayName = TRIGGER_NAME;
9146
+ var PORTAL_NAME = "TooltipPortal";
9147
+ var [PortalProvider, usePortalContext] = createTooltipContext(PORTAL_NAME, {
9148
+ forceMount: void 0
9149
+ });
9150
+ var TooltipPortal = (props) => {
9151
+ const { __scopeTooltip, forceMount, children, container } = props;
9152
+ const context = useTooltipContext(PORTAL_NAME, __scopeTooltip);
9153
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(PortalProvider, { scope: __scopeTooltip, forceMount, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Portal$2, { asChild: true, container, children }) }) });
9154
+ };
9155
+ TooltipPortal.displayName = PORTAL_NAME;
9156
+ var CONTENT_NAME = "TooltipContent";
9157
+ var TooltipContent$1 = reactExports.forwardRef(
9158
+ (props, forwardedRef) => {
9159
+ const portalContext = usePortalContext(CONTENT_NAME, props.__scopeTooltip);
9160
+ const { forceMount = portalContext.forceMount, side = "top", ...contentProps } = props;
9161
+ const context = useTooltipContext(CONTENT_NAME, props.__scopeTooltip);
9162
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Presence, { present: forceMount || context.open, children: context.disableHoverableContent ? /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContentImpl, { side, ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContentHoverable, { side, ...contentProps, ref: forwardedRef }) });
9279
9163
  }
9280
- function handleTouchStart(event) {
9281
- allowMouseUpTriggerRef.current = false;
9282
- if (event.touches.length === 1) {
9283
- event.stopPropagation();
9284
- const touch = event.touches[0];
9285
- touchPositionRef.current = {
9286
- x: touch.clientX,
9287
- y: touch.clientY
9164
+ );
9165
+ var TooltipContentHoverable = reactExports.forwardRef((props, forwardedRef) => {
9166
+ const context = useTooltipContext(CONTENT_NAME, props.__scopeTooltip);
9167
+ const providerContext = useTooltipProviderContext(CONTENT_NAME, props.__scopeTooltip);
9168
+ const ref = reactExports.useRef(null);
9169
+ const composedRefs = useComposedRefs(forwardedRef, ref);
9170
+ const [pointerGraceArea, setPointerGraceArea] = reactExports.useState(null);
9171
+ const { trigger, onClose } = context;
9172
+ const content = ref.current;
9173
+ const { onPointerInTransitChange } = providerContext;
9174
+ const handleRemoveGraceArea = reactExports.useCallback(() => {
9175
+ setPointerGraceArea(null);
9176
+ onPointerInTransitChange(false);
9177
+ }, [onPointerInTransitChange]);
9178
+ const handleCreateGraceArea = reactExports.useCallback(
9179
+ (event, hoverTarget) => {
9180
+ const currentTarget = event.currentTarget;
9181
+ const exitPoint = { x: event.clientX, y: event.clientY };
9182
+ const exitSide = getExitSideFromRect(exitPoint, currentTarget.getBoundingClientRect());
9183
+ const paddedExitPoints = getPaddedExitPoints(exitPoint, exitSide);
9184
+ const hoverTargetPoints = getPointsFromRect(hoverTarget.getBoundingClientRect());
9185
+ const graceArea = getHull([...paddedExitPoints, ...hoverTargetPoints]);
9186
+ setPointerGraceArea(graceArea);
9187
+ onPointerInTransitChange(true);
9188
+ },
9189
+ [onPointerInTransitChange]
9190
+ );
9191
+ reactExports.useEffect(() => {
9192
+ return () => handleRemoveGraceArea();
9193
+ }, [handleRemoveGraceArea]);
9194
+ reactExports.useEffect(() => {
9195
+ if (trigger && content) {
9196
+ const handleTriggerLeave = (event) => handleCreateGraceArea(event, content);
9197
+ const handleContentLeave = (event) => handleCreateGraceArea(event, trigger);
9198
+ trigger.addEventListener("pointerleave", handleTriggerLeave);
9199
+ content.addEventListener("pointerleave", handleContentLeave);
9200
+ return () => {
9201
+ trigger.removeEventListener("pointerleave", handleTriggerLeave);
9202
+ content.removeEventListener("pointerleave", handleContentLeave);
9288
9203
  };
9289
- longPressTimeout.start(LONG_PRESS_DELAY, () => {
9290
- if (touchPositionRef.current) {
9291
- handleLongPress(touchPositionRef.current.x, touchPositionRef.current.y, event.nativeEvent);
9204
+ }
9205
+ }, [trigger, content, handleCreateGraceArea, handleRemoveGraceArea]);
9206
+ reactExports.useEffect(() => {
9207
+ if (pointerGraceArea) {
9208
+ const handleTrackPointerGrace = (event) => {
9209
+ const target = event.target;
9210
+ const pointerPosition = { x: event.clientX, y: event.clientY };
9211
+ const hasEnteredTarget = trigger?.contains(target) || content?.contains(target);
9212
+ const isPointerOutsideGraceArea = !isPointInPolygon(pointerPosition, pointerGraceArea);
9213
+ if (hasEnteredTarget) {
9214
+ handleRemoveGraceArea();
9215
+ } else if (isPointerOutsideGraceArea) {
9216
+ handleRemoveGraceArea();
9217
+ onClose();
9292
9218
  }
9293
- });
9219
+ };
9220
+ document.addEventListener("pointermove", handleTrackPointerGrace);
9221
+ return () => document.removeEventListener("pointermove", handleTrackPointerGrace);
9294
9222
  }
9295
- }
9296
- function handleTouchMove(event) {
9297
- if (longPressTimeout.isStarted() && touchPositionRef.current && event.touches.length === 1) {
9298
- const touch = event.touches[0];
9299
- const moveThreshold = 10;
9300
- const deltaX = Math.abs(touch.clientX - touchPositionRef.current.x);
9301
- const deltaY = Math.abs(touch.clientY - touchPositionRef.current.y);
9302
- if (deltaX > moveThreshold || deltaY > moveThreshold) {
9303
- longPressTimeout.clear();
9223
+ }, [trigger, content, pointerGraceArea, onClose, handleRemoveGraceArea]);
9224
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContentImpl, { ...props, ref: composedRefs });
9225
+ });
9226
+ var [VisuallyHiddenContentContextProvider, useVisuallyHiddenContentContext] = createTooltipContext(TOOLTIP_NAME, { isInside: false });
9227
+ var Slottable = createSlottable("TooltipContent");
9228
+ var TooltipContentImpl = reactExports.forwardRef(
9229
+ (props, forwardedRef) => {
9230
+ const {
9231
+ __scopeTooltip,
9232
+ children,
9233
+ "aria-label": ariaLabel,
9234
+ onEscapeKeyDown,
9235
+ onPointerDownOutside,
9236
+ ...contentProps
9237
+ } = props;
9238
+ const context = useTooltipContext(CONTENT_NAME, __scopeTooltip);
9239
+ const popperScope = usePopperScope(__scopeTooltip);
9240
+ const { onClose } = context;
9241
+ reactExports.useEffect(() => {
9242
+ document.addEventListener(TOOLTIP_OPEN, onClose);
9243
+ return () => document.removeEventListener(TOOLTIP_OPEN, onClose);
9244
+ }, [onClose]);
9245
+ reactExports.useEffect(() => {
9246
+ if (context.trigger) {
9247
+ const handleScroll = (event) => {
9248
+ const target = event.target;
9249
+ if (target?.contains(context.trigger)) onClose();
9250
+ };
9251
+ window.addEventListener("scroll", handleScroll, { capture: true });
9252
+ return () => window.removeEventListener("scroll", handleScroll, { capture: true });
9253
+ }
9254
+ }, [context.trigger, onClose]);
9255
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
9256
+ DismissableLayer,
9257
+ {
9258
+ asChild: true,
9259
+ disableOutsidePointerEvents: false,
9260
+ onEscapeKeyDown,
9261
+ onPointerDownOutside,
9262
+ onFocusOutside: (event) => event.preventDefault(),
9263
+ onDismiss: onClose,
9264
+ children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
9265
+ Content$1,
9266
+ {
9267
+ "data-state": context.stateAttribute,
9268
+ ...popperScope,
9269
+ ...contentProps,
9270
+ ref: forwardedRef,
9271
+ style: {
9272
+ ...contentProps.style,
9273
+ // re-namespace exposed content custom properties
9274
+ ...{
9275
+ "--radix-tooltip-content-transform-origin": "var(--radix-popper-transform-origin)",
9276
+ "--radix-tooltip-content-available-width": "var(--radix-popper-available-width)",
9277
+ "--radix-tooltip-content-available-height": "var(--radix-popper-available-height)",
9278
+ "--radix-tooltip-trigger-width": "var(--radix-popper-anchor-width)",
9279
+ "--radix-tooltip-trigger-height": "var(--radix-popper-anchor-height)"
9280
+ }
9281
+ },
9282
+ children: [
9283
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Slottable, { children }),
9284
+ /* @__PURE__ */ jsxRuntimeExports.jsx(VisuallyHiddenContentContextProvider, { scope: __scopeTooltip, isInside: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Root$1, { id: context.contentId, role: "tooltip", children: ariaLabel || children }) })
9285
+ ]
9286
+ }
9287
+ )
9304
9288
  }
9305
- }
9289
+ );
9306
9290
  }
9307
- function handleTouchEnd() {
9308
- longPressTimeout.clear();
9309
- touchPositionRef.current = null;
9291
+ );
9292
+ TooltipContent$1.displayName = CONTENT_NAME;
9293
+ var ARROW_NAME = "TooltipArrow";
9294
+ var TooltipArrow = reactExports.forwardRef(
9295
+ (props, forwardedRef) => {
9296
+ const { __scopeTooltip, ...arrowProps } = props;
9297
+ const popperScope = usePopperScope(__scopeTooltip);
9298
+ const visuallyHiddenContentContext = useVisuallyHiddenContentContext(
9299
+ ARROW_NAME,
9300
+ __scopeTooltip
9301
+ );
9302
+ return visuallyHiddenContentContext.isInside ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(Arrow, { ...popperScope, ...arrowProps, ref: forwardedRef });
9303
+ }
9304
+ );
9305
+ TooltipArrow.displayName = ARROW_NAME;
9306
+ function getExitSideFromRect(point, rect) {
9307
+ const top = Math.abs(rect.top - point.y);
9308
+ const bottom = Math.abs(rect.bottom - point.y);
9309
+ const right = Math.abs(rect.right - point.x);
9310
+ const left = Math.abs(rect.left - point.x);
9311
+ switch (Math.min(top, bottom, right, left)) {
9312
+ case left:
9313
+ return "left";
9314
+ case right:
9315
+ return "right";
9316
+ case top:
9317
+ return "top";
9318
+ case bottom:
9319
+ return "bottom";
9320
+ default:
9321
+ throw new Error("unreachable");
9310
9322
  }
9311
- reactExports.useEffect(() => {
9312
- function handleDocumentContextMenu(event) {
9313
- const target = getTarget(event);
9314
- const targetElement = target;
9315
- if (contains(triggerRef.current, targetElement) || contains(internalBackdropRef.current, targetElement) || contains(backdropRef.current, targetElement)) {
9316
- event.preventDefault();
9317
- }
9318
- }
9319
- const doc = ownerDocument(triggerRef.current);
9320
- doc.addEventListener("contextmenu", handleDocumentContextMenu);
9321
- return () => {
9322
- doc.removeEventListener("contextmenu", handleDocumentContextMenu);
9323
- };
9324
- }, [backdropRef, internalBackdropRef]);
9325
- const state = reactExports.useMemo(() => ({
9326
- open
9327
- }), [open]);
9328
- const element = useRenderElement("div", componentProps, {
9329
- state,
9330
- ref: [triggerRef, forwardedRef],
9331
- props: [{
9332
- onContextMenu: handleContextMenu,
9333
- onTouchStart: handleTouchStart,
9334
- onTouchMove: handleTouchMove,
9335
- onTouchEnd: handleTouchEnd,
9336
- onTouchCancel: handleTouchEnd,
9337
- style: {
9338
- WebkitTouchCallout: "none"
9339
- }
9340
- }, elementProps],
9341
- stateAttributesMapping: pressableTriggerOpenStateMapping
9342
- });
9343
- return element;
9344
- });
9345
- if (process.env.NODE_ENV !== "production") ContextMenuTrigger$1.displayName = "ContextMenuTrigger";
9346
- function ContextMenu({ ...props }) {
9347
- return /* @__PURE__ */ jsxRuntimeExports.jsx(ContextMenuRoot, { ...props });
9348
9323
  }
9349
- function ContextMenuTrigger2(props) {
9350
- return /* @__PURE__ */ jsxRuntimeExports.jsx(ContextMenuTrigger$1, { ...props });
9324
+ function getPaddedExitPoints(exitPoint, exitSide, padding = 5) {
9325
+ const paddedExitPoints = [];
9326
+ switch (exitSide) {
9327
+ case "top":
9328
+ paddedExitPoints.push(
9329
+ { x: exitPoint.x - padding, y: exitPoint.y + padding },
9330
+ { x: exitPoint.x + padding, y: exitPoint.y + padding }
9331
+ );
9332
+ break;
9333
+ case "bottom":
9334
+ paddedExitPoints.push(
9335
+ { x: exitPoint.x - padding, y: exitPoint.y - padding },
9336
+ { x: exitPoint.x + padding, y: exitPoint.y - padding }
9337
+ );
9338
+ break;
9339
+ case "left":
9340
+ paddedExitPoints.push(
9341
+ { x: exitPoint.x + padding, y: exitPoint.y - padding },
9342
+ { x: exitPoint.x + padding, y: exitPoint.y + padding }
9343
+ );
9344
+ break;
9345
+ case "right":
9346
+ paddedExitPoints.push(
9347
+ { x: exitPoint.x - padding, y: exitPoint.y - padding },
9348
+ { x: exitPoint.x - padding, y: exitPoint.y + padding }
9349
+ );
9350
+ break;
9351
+ }
9352
+ return paddedExitPoints;
9351
9353
  }
9352
- const menuVariants = cva(
9353
- "min-w-50 origin-(--transform-origin) rounded-md bg-popover p-1 text-popover-foreground shadow-lg border transition-opacity data-ending-style:opacity-0"
9354
- );
9355
- function ContextMenuContent({
9356
- className,
9357
- align = "start",
9358
- alignOffset = 4,
9359
- side = "right",
9360
- sideOffset = 0,
9361
- ...props
9362
- }) {
9363
- return /* @__PURE__ */ jsxRuntimeExports.jsx(MenuPortal, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
9364
- MenuPositioner,
9365
- {
9366
- className: "outline-none z-40",
9367
- align,
9368
- alignOffset,
9369
- side,
9370
- sideOffset,
9371
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(MenuPopup, { className: cn(menuVariants(), className), ...props })
9372
- }
9373
- ) });
9354
+ function getPointsFromRect(rect) {
9355
+ const { top, right, bottom, left } = rect;
9356
+ return [
9357
+ { x: left, y: top },
9358
+ { x: right, y: top },
9359
+ { x: right, y: bottom },
9360
+ { x: left, y: bottom }
9361
+ ];
9374
9362
  }
9375
- function ContextMenuGroup({ ...props }) {
9376
- return /* @__PURE__ */ jsxRuntimeExports.jsx(MenuGroup, { ...props });
9363
+ function isPointInPolygon(point, polygon) {
9364
+ const { x, y } = point;
9365
+ let inside = false;
9366
+ for (let i = 0, j = polygon.length - 1; i < polygon.length; j = i++) {
9367
+ const ii = polygon[i];
9368
+ const jj = polygon[j];
9369
+ const xi = ii.x;
9370
+ const yi = ii.y;
9371
+ const xj = jj.x;
9372
+ const yj = jj.y;
9373
+ const intersect = yi > y !== yj > y && x < (xj - xi) * (y - yi) / (yj - yi) + xi;
9374
+ if (intersect) inside = !inside;
9375
+ }
9376
+ return inside;
9377
9377
  }
9378
- const menuItemVariants = cva(
9379
- "flex group/context-menu-item gap-2 items-center font-medium px-3 py-2 text-sm leading-4 rounded-lg outline-none select-none [&_svg]:shrink-0 [&_svg]:size-4",
9380
- {
9381
- variants: {
9382
- variant: {
9383
- destructive: "text-destructive data-highlighted:bg-destructive/20",
9384
- default: "data-highlighted:bg-accent data-highlighted:text-accent-foreground"
9385
- }
9386
- },
9387
- defaultVariants: {
9388
- variant: "default"
9378
+ function getHull(points) {
9379
+ const newPoints = points.slice();
9380
+ newPoints.sort((a, b) => {
9381
+ if (a.x < b.x) return -1;
9382
+ else if (a.x > b.x) return 1;
9383
+ else if (a.y < b.y) return -1;
9384
+ else if (a.y > b.y) return 1;
9385
+ else return 0;
9386
+ });
9387
+ return getHullPresorted(newPoints);
9388
+ }
9389
+ function getHullPresorted(points) {
9390
+ if (points.length <= 1) return points.slice();
9391
+ const upperHull = [];
9392
+ for (let i = 0; i < points.length; i++) {
9393
+ const p = points[i];
9394
+ while (upperHull.length >= 2) {
9395
+ const q = upperHull[upperHull.length - 1];
9396
+ const r = upperHull[upperHull.length - 2];
9397
+ if ((q.x - r.x) * (p.y - r.y) >= (q.y - r.y) * (p.x - r.x)) upperHull.pop();
9398
+ else break;
9389
9399
  }
9400
+ upperHull.push(p);
9390
9401
  }
9391
- );
9392
- function ContextMenuItem({
9393
- className,
9394
- inset,
9395
- variant = "default",
9396
- ...props
9397
- }) {
9398
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
9399
- MenuItem,
9400
- {
9401
- "data-inset": inset,
9402
- "data-variant": variant,
9403
- className: cn(menuItemVariants({ variant }), className),
9404
- ...props
9402
+ upperHull.pop();
9403
+ const lowerHull = [];
9404
+ for (let i = points.length - 1; i >= 0; i--) {
9405
+ const p = points[i];
9406
+ while (lowerHull.length >= 2) {
9407
+ const q = lowerHull[lowerHull.length - 1];
9408
+ const r = lowerHull[lowerHull.length - 2];
9409
+ if ((q.x - r.x) * (p.y - r.y) >= (q.y - r.y) * (p.x - r.x)) lowerHull.pop();
9410
+ else break;
9405
9411
  }
9406
- );
9407
- }
9408
- function ContextMenuSub({ ...props }) {
9409
- return /* @__PURE__ */ jsxRuntimeExports.jsx(MenuSubmenuRoot, { ...props });
9410
- }
9411
- function ContextMenuSubTrigger({
9412
- className,
9413
- children,
9414
- ...props
9415
- }) {
9416
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(MenuSubmenuTrigger, { className: cn(menuItemVariants(), className), ...props, children: [
9417
- children,
9418
- /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronRight, { className: "ms-auto text-muted-foreground" })
9419
- ] });
9420
- }
9421
- function ContextMenuSubContent({
9422
- className,
9423
- ...props
9424
- }) {
9425
- return /* @__PURE__ */ jsxRuntimeExports.jsx(ContextMenuContent, { className: cn(menuVariants(), className), ...props });
9412
+ lowerHull.push(p);
9413
+ }
9414
+ lowerHull.pop();
9415
+ if (upperHull.length === 1 && lowerHull.length === 1 && upperHull[0].x === lowerHull[0].x && upperHull[0].y === lowerHull[0].y) {
9416
+ return upperHull;
9417
+ } else {
9418
+ return upperHull.concat(lowerHull);
9419
+ }
9426
9420
  }
9421
+ var Provider = TooltipProvider$1;
9422
+ var Root3 = Tooltip$1;
9423
+ var Trigger = TooltipTrigger$1;
9424
+ var Portal = TooltipPortal;
9425
+ var Content2 = TooltipContent$1;
9426
+ var Arrow2 = TooltipArrow;
9427
9427
  function TooltipProvider({
9428
9428
  delayDuration = 0,
9429
9429
  ...props
@@ -9467,84 +9467,84 @@ function TooltipContent({
9467
9467
  ) });
9468
9468
  }
9469
9469
  export {
9470
- contains as $,
9471
- useStore as A,
9472
- useValueAsRef as B,
9470
+ pressableTriggerOpenStateMapping as $,
9471
+ createGenericEventDetails as A,
9472
+ inputClear as B,
9473
9473
  Content as C,
9474
- Description as D,
9474
+ inputChange as D,
9475
9475
  EMPTY_OBJECT as E,
9476
- useTransitionStatus as F,
9477
- useOpenInteractionType as G,
9478
- createGenericEventDetails as H,
9479
- inputClear as I,
9480
- inputChange as J,
9481
- createChangeEventDetails as K,
9482
- focusOut as L,
9483
- outsidePress as M,
9476
+ createChangeEventDetails as F,
9477
+ focusOut as G,
9478
+ outsidePress as H,
9479
+ getTarget as I,
9480
+ itemPress as J,
9481
+ none as K,
9482
+ useOpenChangeComplete as L,
9483
+ useFloatingRootContext as M,
9484
9484
  NOOP as N,
9485
9485
  Overlay as O,
9486
9486
  Portal$1 as P,
9487
- getTarget as Q,
9487
+ useClick as Q,
9488
9488
  Root as R,
9489
9489
  Store as S,
9490
- Title as T,
9491
- itemPress as U,
9492
- none as V,
9493
- WarningProvider as W,
9494
- useOpenChangeComplete as X,
9495
- useFloatingRootContext as Y,
9496
- useClick as Z,
9497
- useDismiss as _,
9498
- Close as a,
9499
- useListNavigation as a0,
9500
- useInteractions as a1,
9501
- useMergedRefs as a2,
9502
- visuallyHiddenInput as a3,
9503
- visuallyHidden as a4,
9504
- pressableTriggerOpenStateMapping as a5,
9505
- useDirection as a6,
9506
- useRenderElement as a7,
9507
- stopEvent as a8,
9508
- isFirefox as a9,
9509
- escapeKey as aa,
9510
- isAndroid as ab,
9511
- CompositeList as ac,
9512
- FloatingPortal as ad,
9513
- DROPDOWN_COLLISION_AVOIDANCE as ae,
9514
- useAnchorPositioning as af,
9515
- useScrollLock as ag,
9516
- InternalBackdrop as ah,
9517
- inertValue as ai,
9518
- popupStateMapping as aj,
9519
- FloatingFocusManager as ak,
9520
- transitionStatusMapping as al,
9521
- getDisabledMountTransitionStyles as am,
9522
- useCompositeListItem as an,
9523
- IndexGuessBehavior as ao,
9524
- useButton as ap,
9525
- Trigger$1 as b,
9526
- createDialogScope as c,
9527
- ContextMenu as d,
9528
- ContextMenuTrigger2 as e,
9529
- ContextMenuContent as f,
9530
- ContextMenuGroup as g,
9531
- ContextMenuItem as h,
9532
- ContextMenuSub as i,
9533
- ContextMenuSubTrigger as j,
9534
- ContextMenuSubContent as k,
9535
- Tooltip as l,
9536
- TooltipTrigger as m,
9537
- Portal as n,
9538
- Content2 as o,
9539
- TooltipProvider as p,
9540
- TooltipContent as q,
9541
- formatErrorMessage as r,
9490
+ Tooltip as T,
9491
+ useDismiss as U,
9492
+ contains as V,
9493
+ useListNavigation as W,
9494
+ useInteractions as X,
9495
+ useMergedRefs as Y,
9496
+ visuallyHiddenInput as Z,
9497
+ visuallyHidden as _,
9498
+ ContextMenu as a,
9499
+ useDirection as a0,
9500
+ useRenderElement as a1,
9501
+ stopEvent as a2,
9502
+ isFirefox as a3,
9503
+ escapeKey as a4,
9504
+ isAndroid as a5,
9505
+ CompositeList as a6,
9506
+ FloatingPortal as a7,
9507
+ DROPDOWN_COLLISION_AVOIDANCE as a8,
9508
+ useAnchorPositioning as a9,
9509
+ useScrollLock as aa,
9510
+ InternalBackdrop as ab,
9511
+ inertValue as ac,
9512
+ popupStateMapping as ad,
9513
+ FloatingFocusManager as ae,
9514
+ transitionStatusMapping as af,
9515
+ getDisabledMountTransitionStyles as ag,
9516
+ useCompositeListItem as ah,
9517
+ IndexGuessBehavior as ai,
9518
+ useButton as aj,
9519
+ WarningProvider as ak,
9520
+ createDialogScope as al,
9521
+ Title as am,
9522
+ Description as an,
9523
+ Close as ao,
9524
+ Trigger$1 as ap,
9525
+ ContextMenuTrigger2 as b,
9526
+ ContextMenuContent as c,
9527
+ ContextMenuGroup as d,
9528
+ ContextMenuItem as e,
9529
+ ContextMenuSub as f,
9530
+ ContextMenuSubTrigger as g,
9531
+ ContextMenuSubContent as h,
9532
+ TooltipTrigger as i,
9533
+ Portal as j,
9534
+ Content2 as k,
9535
+ TooltipProvider as l,
9536
+ TooltipContent as m,
9537
+ formatErrorMessage as n,
9538
+ createSelector as o,
9539
+ useStableCallback as p,
9540
+ useIsoLayoutEffect as q,
9541
+ useBaseUiId as r,
9542
9542
  shimExports as s,
9543
- createSelector as t,
9543
+ EMPTY_ARRAY as t,
9544
9544
  useSyncExternalStoreExports as u,
9545
- useStableCallback as v,
9546
- useIsoLayoutEffect as w,
9547
- useBaseUiId as x,
9548
- EMPTY_ARRAY as y,
9549
- useRefWithInit as z
9545
+ useRefWithInit as v,
9546
+ useStore as w,
9547
+ useValueAsRef as x,
9548
+ useTransitionStatus as y,
9549
+ useOpenInteractionType as z
9550
9550
  };