@misael703/ui 1.0.1 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (178) hide show
  1. package/dist/chunk-2S6JJYN7.js +209 -0
  2. package/dist/chunk-2S6JJYN7.js.map +1 -0
  3. package/dist/{chunk-GDFYAUHT.mjs → chunk-3N4IBCLW.mjs} +11 -29
  4. package/dist/chunk-3N4IBCLW.mjs.map +1 -0
  5. package/dist/{chunk-TB6EHWRF.mjs → chunk-3OVWAAGP.mjs} +3 -3
  6. package/dist/{chunk-TB6EHWRF.mjs.map → chunk-3OVWAAGP.mjs.map} +1 -1
  7. package/dist/chunk-427NHGTX.js +4 -0
  8. package/dist/chunk-427NHGTX.js.map +1 -0
  9. package/dist/chunk-6P2TKRTL.mjs +45 -0
  10. package/dist/chunk-6P2TKRTL.mjs.map +1 -0
  11. package/dist/chunk-6RVCYULF.mjs +78 -0
  12. package/dist/chunk-6RVCYULF.mjs.map +1 -0
  13. package/dist/chunk-BVQRDAR7.mjs +3 -0
  14. package/dist/chunk-BVQRDAR7.mjs.map +1 -0
  15. package/dist/{chunk-TXKFCVCN.mjs → chunk-C35GKQJO.mjs} +3 -3
  16. package/dist/{chunk-TXKFCVCN.mjs.map → chunk-C35GKQJO.mjs.map} +1 -1
  17. package/dist/chunk-DPMUWQHL.js +95 -0
  18. package/dist/chunk-DPMUWQHL.js.map +1 -0
  19. package/dist/chunk-GIOMV3J7.js +48 -0
  20. package/dist/chunk-GIOMV3J7.js.map +1 -0
  21. package/dist/chunk-GLYGO7WX.js +13 -0
  22. package/dist/chunk-GLYGO7WX.js.map +1 -0
  23. package/dist/chunk-H3PRT76O.mjs +73 -0
  24. package/dist/chunk-H3PRT76O.mjs.map +1 -0
  25. package/dist/{chunk-Z4GRQHIG.mjs → chunk-IEJXZ67E.mjs} +3 -3
  26. package/dist/{chunk-Z4GRQHIG.mjs.map → chunk-IEJXZ67E.mjs.map} +1 -1
  27. package/dist/chunk-IMHLJKYR.mjs +176 -0
  28. package/dist/chunk-IMHLJKYR.mjs.map +1 -0
  29. package/dist/{chunk-EJJDJJEM.js → chunk-K5S3SV2U.js} +108 -106
  30. package/dist/chunk-K5S3SV2U.js.map +1 -0
  31. package/dist/{chunk-ADIKHOEG.js → chunk-KOIRRZRD.js} +72 -6
  32. package/dist/chunk-KOIRRZRD.js.map +1 -0
  33. package/dist/{chunk-ZXSSOEIM.js → chunk-LXNHGGAK.js} +4 -4
  34. package/dist/{chunk-ZXSSOEIM.js.map → chunk-LXNHGGAK.js.map} +1 -1
  35. package/dist/{chunk-HI3JT6SI.mjs → chunk-MM7VE7YN.mjs} +72 -6
  36. package/dist/chunk-MM7VE7YN.mjs.map +1 -0
  37. package/dist/chunk-MUL2FKYF.js +100 -0
  38. package/dist/chunk-MUL2FKYF.js.map +1 -0
  39. package/dist/chunk-N2Y2KWX5.mjs +216 -0
  40. package/dist/chunk-N2Y2KWX5.mjs.map +1 -0
  41. package/dist/{chunk-CVXS7IHA.js → chunk-N7LFCAAY.js} +112 -113
  42. package/dist/chunk-N7LFCAAY.js.map +1 -0
  43. package/dist/chunk-OCLBAGNF.mjs +184 -0
  44. package/dist/chunk-OCLBAGNF.mjs.map +1 -0
  45. package/dist/{chunk-QSCJ2CER.mjs → chunk-OHCS5CYV.mjs} +108 -106
  46. package/dist/chunk-OHCS5CYV.mjs.map +1 -0
  47. package/dist/{chunk-LUXTZOTJ.js → chunk-OHMFYAB2.js} +4 -4
  48. package/dist/{chunk-LUXTZOTJ.js.map → chunk-OHMFYAB2.js.map} +1 -1
  49. package/dist/{chunk-T4R2LSRL.js → chunk-PROKTOL7.js} +3 -2
  50. package/dist/chunk-PROKTOL7.js.map +1 -0
  51. package/dist/{chunk-3UHX7ITQ.mjs → chunk-QI4JT3V3.mjs} +29 -34
  52. package/dist/chunk-QI4JT3V3.mjs.map +1 -0
  53. package/dist/{chunk-Z3FAKG3E.mjs → chunk-QW2CSXPH.mjs} +3 -2
  54. package/dist/chunk-QW2CSXPH.mjs.map +1 -0
  55. package/dist/chunk-QX5GGPV5.mjs +11 -0
  56. package/dist/chunk-QX5GGPV5.mjs.map +1 -0
  57. package/dist/{chunk-2RVSLQEA.mjs → chunk-R76SJURE.mjs} +3 -3
  58. package/dist/{chunk-2RVSLQEA.mjs.map → chunk-R76SJURE.mjs.map} +1 -1
  59. package/dist/{chunk-E2XOUDAH.js → chunk-REL2RZTI.js} +14 -32
  60. package/dist/chunk-REL2RZTI.js.map +1 -0
  61. package/dist/{chunk-R76YER7O.js → chunk-TBAKKSAN.js} +4 -4
  62. package/dist/{chunk-R76YER7O.js.map → chunk-TBAKKSAN.js.map} +1 -1
  63. package/dist/chunk-V7MK42GX.js +238 -0
  64. package/dist/chunk-V7MK42GX.js.map +1 -0
  65. package/dist/chunk-VR4OXVKE.js +198 -0
  66. package/dist/chunk-VR4OXVKE.js.map +1 -0
  67. package/dist/chunk-WLDQP4KD.mjs +75 -0
  68. package/dist/chunk-WLDQP4KD.mjs.map +1 -0
  69. package/dist/{chunk-W6YOBPL5.js → chunk-WVN5JJVV.js} +27 -40
  70. package/dist/chunk-WVN5JJVV.js.map +1 -0
  71. package/dist/chunk-XMLBKK7X.js +67 -0
  72. package/dist/chunk-XMLBKK7X.js.map +1 -0
  73. package/dist/chunk-XXUSZD5I.mjs +26 -0
  74. package/dist/chunk-XXUSZD5I.mjs.map +1 -0
  75. package/dist/{chunk-IIYQO6BL.js → chunk-YAORRBMU.js} +29 -34
  76. package/dist/chunk-YAORRBMU.js.map +1 -0
  77. package/dist/{chunk-AAQ7KUZH.mjs → chunk-YFLVB62R.mjs} +112 -113
  78. package/dist/chunk-YFLVB62R.mjs.map +1 -0
  79. package/dist/{chunk-UIKCTWKG.js → chunk-YRACSKAT.js} +4 -4
  80. package/dist/{chunk-UIKCTWKG.js.map → chunk-YRACSKAT.js.map} +1 -1
  81. package/dist/components/AdvancedPickers.js +8 -5
  82. package/dist/components/AdvancedPickers.mjs +4 -1
  83. package/dist/components/AppShell.js +3 -3
  84. package/dist/components/AppShell.mjs +1 -1
  85. package/dist/components/Comments.js +8 -5
  86. package/dist/components/Comments.mjs +5 -2
  87. package/dist/components/Commerce.js +14 -13
  88. package/dist/components/Commerce.mjs +3 -2
  89. package/dist/components/ContextMenu.js +5 -2
  90. package/dist/components/ContextMenu.mjs +4 -1
  91. package/dist/components/Display2.js +8 -5
  92. package/dist/components/Display2.mjs +4 -1
  93. package/dist/components/Display3.js +11 -8
  94. package/dist/components/Display3.mjs +5 -2
  95. package/dist/components/Editing.js +8 -7
  96. package/dist/components/Editing.mjs +3 -2
  97. package/dist/components/HoverCard.js +4 -2
  98. package/dist/components/HoverCard.mjs +3 -1
  99. package/dist/components/Layout.js +20 -18
  100. package/dist/components/Layout.mjs +3 -1
  101. package/dist/components/Menubar.js +5 -2
  102. package/dist/components/Menubar.mjs +4 -1
  103. package/dist/components/NavigationMenu.js +5 -2
  104. package/dist/components/NavigationMenu.mjs +4 -1
  105. package/dist/components/Overlay.js +4 -3
  106. package/dist/components/Overlay.mjs +2 -1
  107. package/dist/components/Pickers.js +7 -4
  108. package/dist/components/Pickers.mjs +4 -1
  109. package/dist/components/Popover.js +5 -2
  110. package/dist/components/Popover.mjs +4 -1
  111. package/dist/components/Portal.d.mts +30 -0
  112. package/dist/components/Portal.d.ts +30 -0
  113. package/dist/components/Portal.js +12 -0
  114. package/dist/components/Portal.js.map +1 -0
  115. package/dist/components/Portal.mjs +3 -0
  116. package/dist/components/Portal.mjs.map +1 -0
  117. package/dist/hooks/index.d.mts +4 -0
  118. package/dist/hooks/index.d.ts +4 -0
  119. package/dist/hooks/index.js +23 -0
  120. package/dist/hooks/index.js.map +1 -0
  121. package/dist/hooks/index.mjs +6 -0
  122. package/dist/hooks/index.mjs.map +1 -0
  123. package/dist/hooks/useDelayedUnmount.d.mts +22 -0
  124. package/dist/hooks/useDelayedUnmount.d.ts +22 -0
  125. package/dist/hooks/useDelayedUnmount.js +12 -0
  126. package/dist/hooks/useDelayedUnmount.js.map +1 -0
  127. package/dist/hooks/useDelayedUnmount.mjs +3 -0
  128. package/dist/hooks/useDelayedUnmount.mjs.map +1 -0
  129. package/dist/hooks/useDismiss.d.mts +23 -0
  130. package/dist/hooks/useDismiss.d.ts +23 -0
  131. package/dist/hooks/useDismiss.js +12 -0
  132. package/dist/hooks/useDismiss.js.map +1 -0
  133. package/dist/hooks/useDismiss.mjs +3 -0
  134. package/dist/hooks/useDismiss.mjs.map +1 -0
  135. package/dist/hooks/usePopoverPosition.d.mts +50 -0
  136. package/dist/hooks/usePopoverPosition.d.ts +50 -0
  137. package/dist/hooks/usePopoverPosition.js +12 -0
  138. package/dist/hooks/usePopoverPosition.js.map +1 -0
  139. package/dist/hooks/usePopoverPosition.mjs +3 -0
  140. package/dist/hooks/usePopoverPosition.mjs.map +1 -0
  141. package/dist/index.d.mts +4 -1
  142. package/dist/index.d.ts +4 -1
  143. package/dist/index.js +95 -78
  144. package/dist/index.mjs +21 -16
  145. package/dist/styles.css +1 -1
  146. package/dist/tokens.css +1 -1
  147. package/package.json +1 -1
  148. package/dist/chunk-3UHX7ITQ.mjs.map +0 -1
  149. package/dist/chunk-5VMZMDJF.js +0 -145
  150. package/dist/chunk-5VMZMDJF.js.map +0 -1
  151. package/dist/chunk-7AKN7FDA.mjs +0 -103
  152. package/dist/chunk-7AKN7FDA.mjs.map +0 -1
  153. package/dist/chunk-AAQ7KUZH.mjs.map +0 -1
  154. package/dist/chunk-ADIKHOEG.js.map +0 -1
  155. package/dist/chunk-CVXS7IHA.js.map +0 -1
  156. package/dist/chunk-E2XOUDAH.js.map +0 -1
  157. package/dist/chunk-EJJDJJEM.js.map +0 -1
  158. package/dist/chunk-GDFYAUHT.mjs.map +0 -1
  159. package/dist/chunk-HI3JT6SI.mjs.map +0 -1
  160. package/dist/chunk-HPFJ2A24.js +0 -125
  161. package/dist/chunk-HPFJ2A24.js.map +0 -1
  162. package/dist/chunk-IIYQO6BL.js.map +0 -1
  163. package/dist/chunk-JDOXRLZW.js +0 -138
  164. package/dist/chunk-JDOXRLZW.js.map +0 -1
  165. package/dist/chunk-NLCKWF3Y.mjs +0 -88
  166. package/dist/chunk-NLCKWF3Y.mjs.map +0 -1
  167. package/dist/chunk-NUURPO3J.mjs +0 -120
  168. package/dist/chunk-NUURPO3J.mjs.map +0 -1
  169. package/dist/chunk-OCE4ODTM.mjs +0 -116
  170. package/dist/chunk-OCE4ODTM.mjs.map +0 -1
  171. package/dist/chunk-QI6TVWWF.js +0 -121
  172. package/dist/chunk-QI6TVWWF.js.map +0 -1
  173. package/dist/chunk-QSCJ2CER.mjs.map +0 -1
  174. package/dist/chunk-T4R2LSRL.js.map +0 -1
  175. package/dist/chunk-W6YOBPL5.js.map +0 -1
  176. package/dist/chunk-YBOTLQ3G.mjs +0 -99
  177. package/dist/chunk-YBOTLQ3G.mjs.map +0 -1
  178. package/dist/chunk-Z3FAKG3E.mjs.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"Portal.mjs"}
@@ -0,0 +1,4 @@
1
+ export { useDelayedUnmount } from './useDelayedUnmount.mjs';
2
+ export { PopoverAlign, PopoverPosition, PopoverSide, UsePopoverPositionOptions, VirtualElement, usePopoverPosition } from './usePopoverPosition.mjs';
3
+ export { UseDismissOptions, useDismiss } from './useDismiss.mjs';
4
+ import 'react';
@@ -0,0 +1,4 @@
1
+ export { useDelayedUnmount } from './useDelayedUnmount.js';
2
+ export { PopoverAlign, PopoverPosition, PopoverSide, UsePopoverPositionOptions, VirtualElement, usePopoverPosition } from './usePopoverPosition.js';
3
+ export { UseDismissOptions, useDismiss } from './useDismiss.js';
4
+ import 'react';
@@ -0,0 +1,23 @@
1
+ 'use strict';
2
+
3
+ require('../chunk-427NHGTX.js');
4
+ var chunkGIOMV3J7_js = require('../chunk-GIOMV3J7.js');
5
+ var chunkXMLBKK7X_js = require('../chunk-XMLBKK7X.js');
6
+ var chunkDPMUWQHL_js = require('../chunk-DPMUWQHL.js');
7
+
8
+
9
+
10
+ Object.defineProperty(exports, "useDelayedUnmount", {
11
+ enumerable: true,
12
+ get: function () { return chunkGIOMV3J7_js.useDelayedUnmount; }
13
+ });
14
+ Object.defineProperty(exports, "useDismiss", {
15
+ enumerable: true,
16
+ get: function () { return chunkXMLBKK7X_js.useDismiss; }
17
+ });
18
+ Object.defineProperty(exports, "usePopoverPosition", {
19
+ enumerable: true,
20
+ get: function () { return chunkDPMUWQHL_js.usePopoverPosition; }
21
+ });
22
+ //# sourceMappingURL=index.js.map
23
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
@@ -0,0 +1,6 @@
1
+ import '../chunk-BVQRDAR7.mjs';
2
+ export { useDelayedUnmount } from '../chunk-XXUSZD5I.mjs';
3
+ export { useDismiss } from '../chunk-6P2TKRTL.mjs';
4
+ export { usePopoverPosition } from '../chunk-H3PRT76O.mjs';
5
+ //# sourceMappingURL=index.mjs.map
6
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.mjs"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Delays unmounting of a component so an exit animation can play.
3
+ *
4
+ * When `open` flips to false, the hook keeps `mounted` true for `durationMs`
5
+ * (giving CSS time to play `is-closing` keyframes) and then flips it to
6
+ * false. The `closing` flag toggles during that window so the consumer can
7
+ * apply a class like `is-closing` for the CSS animation.
8
+ *
9
+ * Usage:
10
+ *
11
+ * ```tsx
12
+ * const { mounted, closing } = useDelayedUnmount(open, 200);
13
+ * if (!mounted) return null;
14
+ * return <div className={cx('modal', closing && 'is-closing')} />
15
+ * ```
16
+ */
17
+ declare function useDelayedUnmount(open: boolean, durationMs: number): {
18
+ mounted: boolean;
19
+ closing: boolean;
20
+ };
21
+
22
+ export { useDelayedUnmount };
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Delays unmounting of a component so an exit animation can play.
3
+ *
4
+ * When `open` flips to false, the hook keeps `mounted` true for `durationMs`
5
+ * (giving CSS time to play `is-closing` keyframes) and then flips it to
6
+ * false. The `closing` flag toggles during that window so the consumer can
7
+ * apply a class like `is-closing` for the CSS animation.
8
+ *
9
+ * Usage:
10
+ *
11
+ * ```tsx
12
+ * const { mounted, closing } = useDelayedUnmount(open, 200);
13
+ * if (!mounted) return null;
14
+ * return <div className={cx('modal', closing && 'is-closing')} />
15
+ * ```
16
+ */
17
+ declare function useDelayedUnmount(open: boolean, durationMs: number): {
18
+ mounted: boolean;
19
+ closing: boolean;
20
+ };
21
+
22
+ export { useDelayedUnmount };
@@ -0,0 +1,12 @@
1
+ 'use strict';
2
+
3
+ var chunkGIOMV3J7_js = require('../chunk-GIOMV3J7.js');
4
+
5
+
6
+
7
+ Object.defineProperty(exports, "useDelayedUnmount", {
8
+ enumerable: true,
9
+ get: function () { return chunkGIOMV3J7_js.useDelayedUnmount; }
10
+ });
11
+ //# sourceMappingURL=useDelayedUnmount.js.map
12
+ //# sourceMappingURL=useDelayedUnmount.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"useDelayedUnmount.js"}
@@ -0,0 +1,3 @@
1
+ export { useDelayedUnmount } from '../chunk-XXUSZD5I.mjs';
2
+ //# sourceMappingURL=useDelayedUnmount.mjs.map
3
+ //# sourceMappingURL=useDelayedUnmount.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"useDelayedUnmount.mjs"}
@@ -0,0 +1,23 @@
1
+ import * as React from 'react';
2
+
3
+ interface UseDismissOptions {
4
+ open: boolean;
5
+ onDismiss: () => void;
6
+ /** Refs whose subtree should NOT count as "outside" (trigger + panel). */
7
+ refs: Array<React.RefObject<HTMLElement | null>>;
8
+ closeOnEscape?: boolean;
9
+ closeOnOutsideClick?: boolean;
10
+ /** Focus returns here when the panel closes (usually the trigger). */
11
+ returnFocusRef?: React.RefObject<HTMLElement | null>;
12
+ }
13
+ /**
14
+ * Shared dismiss behaviour for floating panels: closes on outside
15
+ * pointer-down and on Escape, and restores focus to the trigger when the
16
+ * panel closes (focus hygiene for keyboard/AT users).
17
+ *
18
+ * `onDismiss` and `refs` are read through refs internally, so callers
19
+ * don't need to memoize them to avoid re-subscribing listeners.
20
+ */
21
+ declare function useDismiss({ open, onDismiss, refs, closeOnEscape, closeOnOutsideClick, returnFocusRef, }: UseDismissOptions): void;
22
+
23
+ export { type UseDismissOptions, useDismiss };
@@ -0,0 +1,23 @@
1
+ import * as React from 'react';
2
+
3
+ interface UseDismissOptions {
4
+ open: boolean;
5
+ onDismiss: () => void;
6
+ /** Refs whose subtree should NOT count as "outside" (trigger + panel). */
7
+ refs: Array<React.RefObject<HTMLElement | null>>;
8
+ closeOnEscape?: boolean;
9
+ closeOnOutsideClick?: boolean;
10
+ /** Focus returns here when the panel closes (usually the trigger). */
11
+ returnFocusRef?: React.RefObject<HTMLElement | null>;
12
+ }
13
+ /**
14
+ * Shared dismiss behaviour for floating panels: closes on outside
15
+ * pointer-down and on Escape, and restores focus to the trigger when the
16
+ * panel closes (focus hygiene for keyboard/AT users).
17
+ *
18
+ * `onDismiss` and `refs` are read through refs internally, so callers
19
+ * don't need to memoize them to avoid re-subscribing listeners.
20
+ */
21
+ declare function useDismiss({ open, onDismiss, refs, closeOnEscape, closeOnOutsideClick, returnFocusRef, }: UseDismissOptions): void;
22
+
23
+ export { type UseDismissOptions, useDismiss };
@@ -0,0 +1,12 @@
1
+ 'use strict';
2
+
3
+ var chunkXMLBKK7X_js = require('../chunk-XMLBKK7X.js');
4
+
5
+
6
+
7
+ Object.defineProperty(exports, "useDismiss", {
8
+ enumerable: true,
9
+ get: function () { return chunkXMLBKK7X_js.useDismiss; }
10
+ });
11
+ //# sourceMappingURL=useDismiss.js.map
12
+ //# sourceMappingURL=useDismiss.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"useDismiss.js"}
@@ -0,0 +1,3 @@
1
+ export { useDismiss } from '../chunk-6P2TKRTL.mjs';
2
+ //# sourceMappingURL=useDismiss.mjs.map
3
+ //# sourceMappingURL=useDismiss.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"useDismiss.mjs"}
@@ -0,0 +1,50 @@
1
+ import * as React from 'react';
2
+
3
+ type PopoverSide = 'top' | 'bottom' | 'left' | 'right';
4
+ type PopoverAlign = 'start' | 'center' | 'end';
5
+ /** Anything that can report its viewport rect: a DOM element or a virtual
6
+ * anchor (e.g. a point under the cursor for a context menu). */
7
+ interface VirtualElement {
8
+ getBoundingClientRect: () => DOMRect;
9
+ }
10
+ interface UsePopoverPositionOptions {
11
+ open: boolean;
12
+ side?: PopoverSide;
13
+ align?: PopoverAlign;
14
+ offset?: number;
15
+ /** Expose the anchor's width so the consumer can match it (comboboxes). */
16
+ matchAnchorWidth?: boolean;
17
+ }
18
+ interface PopoverPosition {
19
+ /** Document-relative coords (use with `position: absolute` in a body portal). */
20
+ top: number;
21
+ left: number;
22
+ /** Side actually used after flipping; useful for arrow/animation origin. */
23
+ side: PopoverSide;
24
+ /** False until the first measure. Keep content `visibility: hidden` until true. */
25
+ ready: boolean;
26
+ /** Anchor width, only when `matchAnchorWidth` is set. */
27
+ width?: number;
28
+ }
29
+ /**
30
+ * Positions a floating panel relative to an anchor, for panels portaled to
31
+ * `document.body`. Computes document-relative coords from
32
+ * `getBoundingClientRect()`, flips to the opposite side when the preferred
33
+ * side doesn't fit the viewport, clamps into the viewport, and recomputes
34
+ * on scroll of *any* ancestor (capture-phase) and on resize
35
+ * (rAF-coalesced). Listeners are torn down on close/unmount.
36
+ *
37
+ * The content must be mounted (it can be visually hidden) so its size can
38
+ * be measured — gate visibility on the returned `ready` flag.
39
+ *
40
+ * ```tsx
41
+ * const pos = usePopoverPosition(triggerRef, contentRef, { open, side: 'bottom' });
42
+ * <Portal><div ref={contentRef} style={{
43
+ * position: 'absolute', top: pos.top, left: pos.left,
44
+ * visibility: pos.ready ? 'visible' : 'hidden',
45
+ * }} /></Portal>
46
+ * ```
47
+ */
48
+ declare function usePopoverPosition(anchorRef: React.RefObject<HTMLElement | VirtualElement | null>, contentRef: React.RefObject<HTMLElement | null>, { open, side, align, offset, matchAnchorWidth }: UsePopoverPositionOptions): PopoverPosition;
49
+
50
+ export { type PopoverAlign, type PopoverPosition, type PopoverSide, type UsePopoverPositionOptions, type VirtualElement, usePopoverPosition };
@@ -0,0 +1,50 @@
1
+ import * as React from 'react';
2
+
3
+ type PopoverSide = 'top' | 'bottom' | 'left' | 'right';
4
+ type PopoverAlign = 'start' | 'center' | 'end';
5
+ /** Anything that can report its viewport rect: a DOM element or a virtual
6
+ * anchor (e.g. a point under the cursor for a context menu). */
7
+ interface VirtualElement {
8
+ getBoundingClientRect: () => DOMRect;
9
+ }
10
+ interface UsePopoverPositionOptions {
11
+ open: boolean;
12
+ side?: PopoverSide;
13
+ align?: PopoverAlign;
14
+ offset?: number;
15
+ /** Expose the anchor's width so the consumer can match it (comboboxes). */
16
+ matchAnchorWidth?: boolean;
17
+ }
18
+ interface PopoverPosition {
19
+ /** Document-relative coords (use with `position: absolute` in a body portal). */
20
+ top: number;
21
+ left: number;
22
+ /** Side actually used after flipping; useful for arrow/animation origin. */
23
+ side: PopoverSide;
24
+ /** False until the first measure. Keep content `visibility: hidden` until true. */
25
+ ready: boolean;
26
+ /** Anchor width, only when `matchAnchorWidth` is set. */
27
+ width?: number;
28
+ }
29
+ /**
30
+ * Positions a floating panel relative to an anchor, for panels portaled to
31
+ * `document.body`. Computes document-relative coords from
32
+ * `getBoundingClientRect()`, flips to the opposite side when the preferred
33
+ * side doesn't fit the viewport, clamps into the viewport, and recomputes
34
+ * on scroll of *any* ancestor (capture-phase) and on resize
35
+ * (rAF-coalesced). Listeners are torn down on close/unmount.
36
+ *
37
+ * The content must be mounted (it can be visually hidden) so its size can
38
+ * be measured — gate visibility on the returned `ready` flag.
39
+ *
40
+ * ```tsx
41
+ * const pos = usePopoverPosition(triggerRef, contentRef, { open, side: 'bottom' });
42
+ * <Portal><div ref={contentRef} style={{
43
+ * position: 'absolute', top: pos.top, left: pos.left,
44
+ * visibility: pos.ready ? 'visible' : 'hidden',
45
+ * }} /></Portal>
46
+ * ```
47
+ */
48
+ declare function usePopoverPosition(anchorRef: React.RefObject<HTMLElement | VirtualElement | null>, contentRef: React.RefObject<HTMLElement | null>, { open, side, align, offset, matchAnchorWidth }: UsePopoverPositionOptions): PopoverPosition;
49
+
50
+ export { type PopoverAlign, type PopoverPosition, type PopoverSide, type UsePopoverPositionOptions, type VirtualElement, usePopoverPosition };
@@ -0,0 +1,12 @@
1
+ 'use strict';
2
+
3
+ var chunkDPMUWQHL_js = require('../chunk-DPMUWQHL.js');
4
+
5
+
6
+
7
+ Object.defineProperty(exports, "usePopoverPosition", {
8
+ enumerable: true,
9
+ get: function () { return chunkDPMUWQHL_js.usePopoverPosition; }
10
+ });
11
+ //# sourceMappingURL=usePopoverPosition.js.map
12
+ //# sourceMappingURL=usePopoverPosition.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"usePopoverPosition.js"}
@@ -0,0 +1,3 @@
1
+ export { usePopoverPosition } from '../chunk-H3PRT76O.mjs';
2
+ //# sourceMappingURL=usePopoverPosition.mjs.map
3
+ //# sourceMappingURL=usePopoverPosition.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"usePopoverPosition.mjs"}
package/dist/index.d.mts CHANGED
@@ -28,7 +28,7 @@ export { PermissionAction, PermissionMatrix, PermissionMatrixProps, PermissionRo
28
28
  export { GalleryImage, ImageGallery, ImageGalleryProps, Lightbox, LightboxProps } from './components/Gallery.mjs';
29
29
  export { AddressField, AddressFieldOption, AddressForm, AddressFormProps, CartDrawer, CartDrawerProps, CartLineItem, CompareAttribute, CompareItem, CompareTable, CompareTableProps, FreeShippingProgress, FreeShippingProgressProps, OrderLineRow, OrderSummary, OrderSummaryProps, PriceDisplay, PriceDisplayProps, PromoCodeInput, PromoCodeInputProps, QuantitySelector, QuantitySelectorProps, Rating, RatingProps, VariantOption, VariantSelector, VariantSelectorProps, WishlistButton, WishlistButtonProps } from './components/Commerce.mjs';
30
30
  export { CategoryItem, CategoryNav, CategoryNavProps, Hero, HeroProps, Testimonial, TestimonialProps } from './components/Marketing.mjs';
31
- export { Popover, PopoverAlign, PopoverPlacement, PopoverProps } from './components/Popover.mjs';
31
+ export { Popover, PopoverPlacement, PopoverProps } from './components/Popover.mjs';
32
32
  export { HoverCard, HoverCardPlacement, HoverCardProps } from './components/HoverCard.mjs';
33
33
  export { ContextMenu, ContextMenuItem, ContextMenuProps } from './components/ContextMenu.mjs';
34
34
  export { Toggle, ToggleGroup, ToggleGroupItem, ToggleGroupItemProps, ToggleGroupMultipleProps, ToggleGroupProps, ToggleGroupSingleProps, ToggleProps, ToggleSize, ToggleVariant } from './components/Toggle.mjs';
@@ -39,5 +39,8 @@ export { ResizableDirection, ResizableGroup, ResizableGroupProps, ResizableHandl
39
39
  export { Menubar, MenubarItem, MenubarMenu, MenubarProps } from './components/Menubar.mjs';
40
40
  export { NavLink, NavMenuItem, NavigationMenu, NavigationMenuProps } from './components/NavigationMenu.mjs';
41
41
  export { Collapsible, CollapsibleContent, CollapsibleProps, CollapsibleTrigger } from './components/Collapsible.mjs';
42
+ export { Portal, PortalProps } from './components/Portal.mjs';
43
+ export { PopoverAlign, PopoverPosition, PopoverSide, UsePopoverPositionOptions, VirtualElement, usePopoverPosition } from './hooks/usePopoverPosition.mjs';
44
+ export { UseDismissOptions, useDismiss } from './hooks/useDismiss.mjs';
42
45
  import 'react/jsx-runtime';
43
46
  import 'react';
package/dist/index.d.ts CHANGED
@@ -28,7 +28,7 @@ export { PermissionAction, PermissionMatrix, PermissionMatrixProps, PermissionRo
28
28
  export { GalleryImage, ImageGallery, ImageGalleryProps, Lightbox, LightboxProps } from './components/Gallery.js';
29
29
  export { AddressField, AddressFieldOption, AddressForm, AddressFormProps, CartDrawer, CartDrawerProps, CartLineItem, CompareAttribute, CompareItem, CompareTable, CompareTableProps, FreeShippingProgress, FreeShippingProgressProps, OrderLineRow, OrderSummary, OrderSummaryProps, PriceDisplay, PriceDisplayProps, PromoCodeInput, PromoCodeInputProps, QuantitySelector, QuantitySelectorProps, Rating, RatingProps, VariantOption, VariantSelector, VariantSelectorProps, WishlistButton, WishlistButtonProps } from './components/Commerce.js';
30
30
  export { CategoryItem, CategoryNav, CategoryNavProps, Hero, HeroProps, Testimonial, TestimonialProps } from './components/Marketing.js';
31
- export { Popover, PopoverAlign, PopoverPlacement, PopoverProps } from './components/Popover.js';
31
+ export { Popover, PopoverPlacement, PopoverProps } from './components/Popover.js';
32
32
  export { HoverCard, HoverCardPlacement, HoverCardProps } from './components/HoverCard.js';
33
33
  export { ContextMenu, ContextMenuItem, ContextMenuProps } from './components/ContextMenu.js';
34
34
  export { Toggle, ToggleGroup, ToggleGroupItem, ToggleGroupItemProps, ToggleGroupMultipleProps, ToggleGroupProps, ToggleGroupSingleProps, ToggleProps, ToggleSize, ToggleVariant } from './components/Toggle.js';
@@ -39,5 +39,8 @@ export { ResizableDirection, ResizableGroup, ResizableGroupProps, ResizableHandl
39
39
  export { Menubar, MenubarItem, MenubarMenu, MenubarProps } from './components/Menubar.js';
40
40
  export { NavLink, NavMenuItem, NavigationMenu, NavigationMenuProps } from './components/NavigationMenu.js';
41
41
  export { Collapsible, CollapsibleContent, CollapsibleProps, CollapsibleTrigger } from './components/Collapsible.js';
42
+ export { Portal, PortalProps } from './components/Portal.js';
43
+ export { PopoverAlign, PopoverPosition, PopoverSide, UsePopoverPositionOptions, VirtualElement, usePopoverPosition } from './hooks/usePopoverPosition.js';
44
+ export { UseDismissOptions, useDismiss } from './hooks/useDismiss.js';
42
45
  import 'react/jsx-runtime';
43
46
  import 'react';