neatkit 0.7.0 → 0.9.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 (179) hide show
  1. package/dist/Avatar-Belo7qAY.cjs +1 -0
  2. package/dist/Avatar-DjDCFqNG.js +55 -0
  3. package/dist/Avatar.cjs +1 -1
  4. package/dist/Avatar.js +2 -52
  5. package/dist/Boundary.cjs +1 -0
  6. package/dist/Boundary.js +176 -0
  7. package/dist/Button-BV5OUXpc.js +101 -0
  8. package/dist/Button-DU4j_IED.cjs +1 -0
  9. package/dist/Button.cjs +1 -1
  10. package/dist/Button.js +1 -1
  11. package/dist/Checkbox.cjs +1 -1
  12. package/dist/Checkbox.js +213 -2
  13. package/dist/Code-B7s_rN0G.cjs +4 -0
  14. package/dist/Code-Bp2X1k-g.js +224 -0
  15. package/dist/Code.cjs +1 -1
  16. package/dist/Code.js +1 -1
  17. package/dist/Divider-C7XGlr26.cjs +1 -0
  18. package/dist/{Divider-BE15WVDI.js → Divider-DZgpYpr-.js} +1 -1
  19. package/dist/Divider.cjs +1 -1
  20. package/dist/Divider.js +1 -1
  21. package/dist/Icon-BIBzgznI.cjs +1 -0
  22. package/dist/{Icon-uQmpr5P2.js → Icon-CxK1wlGk.js} +194 -181
  23. package/dist/Icon.cjs +1 -1
  24. package/dist/Icon.js +2 -35
  25. package/dist/Input.cjs +1 -1
  26. package/dist/Input.js +70 -79
  27. package/dist/Markdown.cjs +1 -31
  28. package/dist/Markdown.js +469 -18066
  29. package/dist/Modal.cjs +1 -1
  30. package/dist/Modal.js +100 -122
  31. package/dist/PinInput.cjs +1 -1
  32. package/dist/PinInput.js +1 -1
  33. package/dist/Popover.cjs +1 -1
  34. package/dist/Popover.js +171 -165
  35. package/dist/Radio.cjs +1 -1
  36. package/dist/Radio.js +86 -41
  37. package/dist/Select.cjs +1 -1
  38. package/dist/Select.js +326 -315
  39. package/dist/Sidebar.cjs +1 -0
  40. package/dist/Sidebar.js +490 -0
  41. package/dist/Skeleton.cjs +1 -1
  42. package/dist/Skeleton.js +20 -16
  43. package/dist/Switch.cjs +1 -1
  44. package/dist/Switch.js +1 -1
  45. package/dist/Table-CADupJEU.js +423 -0
  46. package/dist/Table-qetwZpTC.cjs +1 -0
  47. package/dist/Table.cjs +1 -1
  48. package/dist/Table.js +1 -1
  49. package/dist/TextArea.cjs +1 -1
  50. package/dist/TextArea.js +1 -1
  51. package/dist/Tooltip-B2d5ss7S.cjs +1 -0
  52. package/dist/Tooltip-BK64rkxV.js +231 -0
  53. package/dist/Tooltip.cjs +1 -1
  54. package/dist/Tooltip.js +2 -3
  55. package/dist/albert-sans-cb3e34c4.woff2 +0 -0
  56. package/dist/aria-Bntn6ad_.cjs +1 -0
  57. package/dist/aria-CeA9QfD1.js +15 -0
  58. package/dist/components/Boundary/Boundary.d.ts +65 -0
  59. package/dist/components/Boundary/contexts/BoundaryContext.d.ts +28 -0
  60. package/dist/components/Boundary/hooks/useBoundary.d.ts +19 -0
  61. package/dist/components/Boundary/hooks/useBoundaryWidth.d.ts +23 -0
  62. package/dist/components/Boundary/index.d.ts +2 -0
  63. package/dist/components/Boundary/utils/width.d.ts +11 -0
  64. package/dist/components/Checkbox/Checkbox.d.ts +9 -1
  65. package/dist/components/{CheckboxGroup → Checkbox/components}/CheckboxGroup.d.ts +2 -2
  66. package/dist/components/Checkbox/index.d.ts +1 -0
  67. package/dist/components/Checkbox/utils/checkbox-option.d.ts +17 -0
  68. package/dist/components/Icon/Icon.d.ts +1 -0
  69. package/dist/components/Icon/icons/GearIcon.d.ts +11 -0
  70. package/dist/components/Icon/icons/ImageIcon.d.ts +11 -0
  71. package/dist/components/Icon/index.d.ts +0 -33
  72. package/dist/components/Icon/utils/registry.d.ts +2 -0
  73. package/dist/components/Input/Input.d.ts +1 -9
  74. package/dist/components/Modal/Modal.d.ts +0 -4
  75. package/dist/components/PinInput/PinInput.d.ts +1 -1
  76. package/dist/components/Popover/Popover.d.ts +2 -6
  77. package/dist/components/Portal/Portal.d.ts +11 -8
  78. package/dist/components/Portal/hooks/useDismissableLayer.d.ts +2 -0
  79. package/dist/components/Portal/hooks/useFloatingPosition.d.ts +4 -3
  80. package/dist/components/Portal/hooks/useFocusTrap.d.ts +2 -0
  81. package/dist/components/Portal/hooks/useScrollLock.d.ts +9 -3
  82. package/dist/components/Portal/utils/boundary-focus.d.ts +23 -0
  83. package/dist/components/Portal/utils/floating-position.d.ts +43 -9
  84. package/dist/components/Portal/utils/overlay-stack.d.ts +22 -10
  85. package/dist/components/Portal/utils/scroll-container.d.ts +13 -0
  86. package/dist/components/Radio/Radio.d.ts +9 -1
  87. package/dist/components/{RadioGroup → Radio/components}/RadioGroup.d.ts +9 -2
  88. package/dist/components/Radio/index.d.ts +1 -0
  89. package/dist/components/Select/Select.d.ts +0 -2
  90. package/dist/components/Select/utils/listbox-position.d.ts +28 -0
  91. package/dist/components/Sidebar/Sidebar.d.ts +113 -0
  92. package/dist/components/Sidebar/components/SidebarFooter.d.ts +24 -0
  93. package/dist/components/Sidebar/components/SidebarGroup.d.ts +31 -0
  94. package/dist/components/Sidebar/components/SidebarHeader.d.ts +29 -0
  95. package/dist/components/Sidebar/components/SidebarItem.d.ts +46 -0
  96. package/dist/components/Sidebar/components/SidebarOverlay.d.ts +38 -0
  97. package/dist/components/Sidebar/components/SidebarPanel.d.ts +47 -0
  98. package/dist/components/Sidebar/components/SidebarTrigger.d.ts +47 -0
  99. package/dist/components/Sidebar/components/SidebarUser.d.ts +59 -0
  100. package/dist/components/Sidebar/hooks/usePresentation.d.ts +14 -0
  101. package/dist/components/Sidebar/hooks/useSidebar.d.ts +9 -0
  102. package/dist/components/Sidebar/index.d.ts +2 -0
  103. package/dist/components/Sidebar/utils/presentation.d.ts +12 -0
  104. package/dist/components/Sidebar/utils/state.d.ts +62 -0
  105. package/dist/components/Skeleton/Skeleton.d.ts +21 -5
  106. package/dist/components/Table/Table.d.ts +21 -249
  107. package/dist/components/Table/components/TableAction.d.ts +18 -0
  108. package/dist/components/Table/components/TableActionCell.d.ts +15 -0
  109. package/dist/components/Table/components/TableActionHeaderCell.d.ts +13 -0
  110. package/dist/components/Table/components/TableBody.d.ts +27 -0
  111. package/dist/components/Table/components/TableCell.d.ts +42 -0
  112. package/dist/components/Table/components/TableFoot.d.ts +19 -0
  113. package/dist/components/Table/components/TableHead.d.ts +19 -0
  114. package/dist/components/Table/components/TableHeaderCell.d.ts +23 -0
  115. package/dist/components/Table/components/TableRow.d.ts +67 -0
  116. package/dist/components/Table/contexts/TableContext.d.ts +4 -0
  117. package/dist/components/Table/hooks/useHorizontalOverflow.d.ts +25 -0
  118. package/dist/components/Table/index.d.ts +1 -1
  119. package/dist/components/Table/utils/cell.d.ts +25 -0
  120. package/dist/components/Table/utils/children.d.ts +18 -0
  121. package/dist/components/Table/utils/trigger.d.ts +54 -0
  122. package/dist/components/Tooltip/Tooltip.d.ts +10 -4
  123. package/dist/components/Tooltip/TooltipProvider.d.ts +1 -1
  124. package/dist/components/Tooltip/index.d.ts +0 -1
  125. package/dist/effects-D5CWf-Pl.js +8 -0
  126. package/dist/effects-D85L_7zM.cjs +1 -0
  127. package/dist/floating-position-DIjh2wnP.cjs +1 -0
  128. package/dist/floating-position-DvR6e334.js +50 -0
  129. package/dist/style.css +1 -1
  130. package/dist/tokens.d.ts +1 -0
  131. package/dist/useFloatingPosition-B3ZC-v3v.js +43 -0
  132. package/dist/useFloatingPosition-GzkP9dCc.cjs +1 -0
  133. package/dist/useFocusTrap-BrFZdMqQ.cjs +1 -0
  134. package/dist/useFocusTrap-DhVnlboe.js +136 -0
  135. package/dist/usePresence-B5RYv4e1.cjs +1 -0
  136. package/dist/usePresence-CqegYqy4.js +221 -0
  137. package/dist/useScrollLock-Drd7OZRC.js +62 -0
  138. package/dist/useScrollLock-Dy8MZaSn.cjs +1 -0
  139. package/dist/utils/aria.d.ts +9 -0
  140. package/dist/utils/effects.d.ts +12 -0
  141. package/package.json +12 -16
  142. package/dist/Button-BAsLfA0D.js +0 -99
  143. package/dist/Button-D7JUO6Fs.cjs +0 -1
  144. package/dist/Checkbox-BvXM9VyY.js +0 -68
  145. package/dist/Checkbox-VQifZrZZ.cjs +0 -1
  146. package/dist/CheckboxGroup.cjs +0 -1
  147. package/dist/CheckboxGroup.js +0 -144
  148. package/dist/Code-BP2ZCmUf.js +0 -7446
  149. package/dist/Code-eispVOW3.cjs +0 -6
  150. package/dist/Content.cjs +0 -1
  151. package/dist/Content.js +0 -144
  152. package/dist/Divider-CJYbFcSX.cjs +0 -1
  153. package/dist/Icon-D8IZceys.cjs +0 -1
  154. package/dist/RadioGroup.cjs +0 -1
  155. package/dist/RadioGroup.js +0 -51
  156. package/dist/RadioGroupContext-BX9KnDek.cjs +0 -1
  157. package/dist/RadioGroupContext-DbKM4zPZ.js +0 -5
  158. package/dist/Table-83unQQOi.cjs +0 -1
  159. package/dist/Table-Cw8u-pEW.js +0 -403
  160. package/dist/Tooltip-BB82wNOE.cjs +0 -1
  161. package/dist/Tooltip-CqWK_GRD.js +0 -236
  162. package/dist/aria-DHnOMyYp.js +0 -10
  163. package/dist/aria-DKxpE8cA.cjs +0 -1
  164. package/dist/components/CheckboxGroup/index.d.ts +0 -2
  165. package/dist/components/Content/Content.d.ts +0 -60
  166. package/dist/components/Content/hooks/useContentLayout.d.ts +0 -18
  167. package/dist/components/Content/index.d.ts +0 -2
  168. package/dist/components/Content/utils/layout.d.ts +0 -11
  169. package/dist/components/RadioGroup/index.d.ts +0 -2
  170. package/dist/useFloatingPosition-CxzhAvy8.js +0 -73
  171. package/dist/useFloatingPosition-D1FqYy0l.cjs +0 -1
  172. package/dist/useFocusTrap--cgjy78G.cjs +0 -1
  173. package/dist/useFocusTrap-Da4nEash.js +0 -134
  174. package/dist/usePresence-DSPt6aKi.js +0 -210
  175. package/dist/usePresence-qe92UTvK.cjs +0 -1
  176. /package/dist/components/{CheckboxGroup → Checkbox}/contexts/CheckboxGroupContext.d.ts +0 -0
  177. /package/dist/components/{CheckboxGroup → Checkbox}/hooks/useCheckboxGroup.d.ts +0 -0
  178. /package/dist/components/{RadioGroup → Radio}/contexts/RadioGroupContext.d.ts +0 -0
  179. /package/dist/components/{RadioGroup → Radio}/hooks/useRadioGroup.d.ts +0 -0
@@ -32,10 +32,8 @@ export type PopoverProps = Omit<HTMLAttributes<HTMLDivElement>, "children" | "de
32
32
  onPointerDownOutside?: (event: PointerEvent) => void;
33
33
  /** The controlled open state of the Popover. */
34
34
  open?: boolean;
35
- /** The preferred placement before viewport collision handling. */
35
+ /** The preferred placement before collision handling. */
36
36
  placement?: PopoverPlacement;
37
- /** The optional element receiving the Popover portal. */
38
- portalContainer?: Element | null;
39
37
  /** Whether focus returns to the trigger after non-outside closure. */
40
38
  restoreFocus?: boolean;
41
39
  /** Whether keyboard and programmatic focus remain inside the Popover. */
@@ -85,10 +83,8 @@ declare const Popover: import("react").ForwardRefExoticComponent<Omit<HTMLAttrib
85
83
  onPointerDownOutside?: (event: PointerEvent) => void;
86
84
  /** The controlled open state of the Popover. */
87
85
  open?: boolean;
88
- /** The preferred placement before viewport collision handling. */
86
+ /** The preferred placement before collision handling. */
89
87
  placement?: PopoverPlacement;
90
- /** The optional element receiving the Popover portal. */
91
- portalContainer?: Element | null;
92
88
  /** Whether focus returns to the trigger after non-outside closure. */
93
89
  restoreFocus?: boolean;
94
90
  /** Whether keyboard and programmatic focus remain inside the Popover. */
@@ -3,17 +3,20 @@ import { type ReactNode } from "react";
3
3
  type PortalProps = {
4
4
  /** The content rendered outside its React layout parent. */
5
5
  children: ReactNode;
6
- /** The optional element receiving the portal content. */
7
- container?: Element | null;
8
- /** The optional element whose inherited Neatkit variables are preserved. */
9
- inheritFrom?: HTMLElement | null;
10
6
  };
11
7
  /**
12
- * Renders content into a browser-owned container after hydration.
8
+ * Renders content into its boundary after hydration.
13
9
  *
14
- * @param props - The portal destination, design source, and content.
10
+ * Portalling inside the boundary keeps design tokens inheriting through the
11
+ * cascade, so the portalled subtree needs no copied design context. The
12
+ * destination is never configurable, and the boundary is required rather
13
+ * than preferred: overlay coordinates are measured as offsets from it, so a
14
+ * portal that quietly fell back to the document would position its content
15
+ * wrongly instead of reporting the mistake.
15
16
  *
16
- * @returns A server-safe source marker and the mounted browser portal.
17
+ * @param props - The portalled content.
18
+ *
19
+ * @returns The mounted browser portal.
17
20
  */
18
- export default function Portal(props: PortalProps): import("react").JSX.Element;
21
+ export default function Portal(props: PortalProps): import("react").ReactPortal | null;
19
22
  export {};
@@ -9,6 +9,8 @@ type DismissableLayerOptions = {
9
9
  dismissOnPointerDownOutside?: boolean;
10
10
  /** The boundaries considered part of the layer. */
11
11
  boundaries: readonly RefObject<HTMLElement | null>[];
12
+ /** The boundary owning the layer's overlay stack. */
13
+ boundary: Element | null;
12
14
  /** The stable overlay stack identifier for the layer. */
13
15
  layerId: symbol;
14
16
  /** The document owning the layer and its event listeners. */
@@ -1,12 +1,13 @@
1
1
  import { type FloatingPlacement, type FloatingPosition } from "../utils/floating-position";
2
2
  /**
3
- * Keeps anchored floating content aligned and inside its viewport.
3
+ * Keeps anchored floating content aligned and inside its boundary.
4
4
  *
5
5
  * @param active - Whether positioning observers should remain active.
6
6
  * @param placement - The preferred floating placement.
7
7
  * @param trigger - The element anchoring the floating panel.
8
8
  * @param panel - The mounted floating panel.
9
+ * @param boundary - The boundary the panel is positioned within.
9
10
  *
10
- * @returns The current fixed-position coordinates and resolved placement.
11
+ * @returns The boundary-relative coordinates and resolved placement.
11
12
  */
12
- export declare function useFloatingPosition(active: boolean, placement: FloatingPlacement, trigger: HTMLElement | null, panel: HTMLElement | null): FloatingPosition | null;
13
+ export declare function useFloatingPosition(active: boolean, placement: FloatingPlacement, trigger: HTMLElement | null, panel: HTMLElement | null, boundary: HTMLElement | null): FloatingPosition | null;
@@ -6,6 +6,8 @@ type FocusTrapOptions = {
6
6
  active: boolean;
7
7
  /** Whether focus moves inside the trap when it activates. */
8
8
  autoFocus?: boolean;
9
+ /** The boundary owning the trapped layer's overlay stack. */
10
+ boundary: Element | null;
9
11
  /** The element containing focus while the trap is active. */
10
12
  container: HTMLElement | null;
11
13
  /** The optional preferred element focused when the trap opens. */
@@ -1,7 +1,13 @@
1
1
  /**
2
- * Locks document scrolling while compensating for the removed scrollbar.
2
+ * Locks the scroller enclosing a boundary while compensating its scrollbar.
3
+ *
4
+ * The lock follows the boundary like every other overlay concern. A boundary
5
+ * occupying the page locks the page, and a boundary embedded in its own
6
+ * scroller locks only that scroller, so an overlay never freezes a host
7
+ * interface it does not own. `lockScroll` disables it entirely.
3
8
  *
4
9
  * @param active - Whether the lock should currently apply.
5
- * @param ownerDocument - The document whose body scrolling is controlled.
10
+ * @param ownerDocument - The document containing the boundary.
11
+ * @param boundary - The boundary owning the overlay requesting the lock.
6
12
  */
7
- export declare function useScrollLock(active: boolean, ownerDocument: Document | null): void;
13
+ export declare function useScrollLock(active: boolean, ownerDocument: Document | null, boundary: Element | null): void;
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Determines whether an overlay outside this layer's boundary owns focus.
3
+ *
4
+ * @param ownerDocument - The document owning the focused element.
5
+ * @param boundary - The boundary owning the inspected layer.
6
+ *
7
+ * @returns Whether a competing overlay currently owns focus.
8
+ */
9
+ export declare function isFocusInsideAnotherOverlay(ownerDocument: Document, boundary: Element): boolean;
10
+ /**
11
+ * Determines whether an overlay outside this layer's boundary owns a press.
12
+ *
13
+ * Pointer ownership cannot be resolved through the focused element, because a
14
+ * capture-phase pointer press runs before focus moves to the pressed target.
15
+ * A layer reading focus here would still see its own content and claim a
16
+ * press that belongs to a competing boundary, so the pressed node decides.
17
+ *
18
+ * @param target - The node receiving the pointer press.
19
+ * @param boundary - The boundary owning the inspected layer.
20
+ *
21
+ * @returns Whether a competing overlay currently owns the press.
22
+ */
23
+ export declare function isPointerInsideAnotherOverlay(target: Node | null, boundary: Element): boolean;
@@ -4,23 +4,57 @@ export type FloatingPlacement = "bottom" | "left" | "right" | "top";
4
4
  export type FloatingPosition = {
5
5
  /** The cross-axis offset at which the arrow points to the trigger. */
6
6
  arrowOffset: number;
7
- /** The resolved placement after viewport collision handling. */
7
+ /** The resolved placement after boundary collision handling. */
8
8
  placement: FloatingPlacement;
9
- /** The viewport-relative horizontal position. */
9
+ /** The boundary-relative horizontal position. */
10
10
  left: number;
11
- /** The viewport-relative vertical position. */
11
+ /** The boundary-relative vertical position. */
12
12
  top: number;
13
13
  };
14
14
  /**
15
- * Calculates collision-aware floating coordinates within a viewport.
15
+ * A type representing the edges a rectangle is fitted against.
16
+ *
17
+ * Only edges are ever read, and describing them structurally keeps the
18
+ * geometry independent of any realm: a `DOMRect` from any document
19
+ * satisfies it, and a fitted result needs no constructor to build.
20
+ */
21
+ export type EdgeBounds = {
22
+ /** The distance from the coordinate space's top to the lower edge. */
23
+ bottom: number;
24
+ /** The distance from the coordinate space's left to the leading edge. */
25
+ left: number;
26
+ /** The distance from the coordinate space's left to the trailing edge. */
27
+ right: number;
28
+ /** The distance from the coordinate space's top to the upper edge. */
29
+ top: number;
30
+ };
31
+ /**
32
+ * Narrows a boundary to the part of it the viewer can actually see.
33
+ *
34
+ * A boundary taller or wider than the viewport still reports its full size,
35
+ * so fitting against it alone can place a panel in boundary space that is
36
+ * scrolled out of view. Collision detection therefore runs against the
37
+ * visible intersection, while coordinates stay relative to the boundary.
38
+ *
39
+ * @param boundaryBounds - The boundary bounds in viewport coordinates.
40
+ * @param viewportWidth - The visible viewport width in CSS pixels.
41
+ * @param viewportHeight - The visible viewport height in CSS pixels.
42
+ *
43
+ * @returns The visible region, or the boundary when nothing intersects.
44
+ */
45
+ export declare function getVisibleBounds(boundaryBounds: EdgeBounds, viewportWidth: number, viewportHeight: number): EdgeBounds;
46
+ /**
47
+ * Calculates collision-aware floating coordinates within a boundary.
48
+ *
49
+ * Every rectangle is expressed in the same coordinate space, so the returned
50
+ * coordinates share that space and callers convert them once.
16
51
  *
17
52
  * @param placement - The preferred floating placement.
18
- * @param spacing - The minimum distance from triggers and viewport edges.
19
- * @param triggerBounds - The viewport bounds of the anchoring trigger.
53
+ * @param spacing - The minimum distance from triggers and boundary edges.
54
+ * @param triggerBounds - The bounds of the anchoring trigger.
20
55
  * @param panelBounds - The measured bounds of the floating panel.
21
- * @param viewportWidth - The available viewport width.
22
- * @param viewportHeight - The available viewport height.
56
+ * @param boundaryBounds - The bounds the panel must remain inside.
23
57
  *
24
58
  * @returns The fitted coordinates and resolved floating placement.
25
59
  */
26
- export declare function calculateFloatingPosition(placement: FloatingPlacement, spacing: number, triggerBounds: DOMRect, panelBounds: DOMRect, viewportWidth: number, viewportHeight: number): FloatingPosition;
60
+ export declare function calculateFloatingPosition(placement: FloatingPlacement, spacing: number, triggerBounds: DOMRect, panelBounds: DOMRect, boundaryBounds: EdgeBounds): FloatingPosition;
@@ -6,23 +6,35 @@ export type OverlayLayer = {
6
6
  zIndex: number;
7
7
  };
8
8
  /**
9
- * Registers an active layer in its owning document's overlay stack.
9
+ * Registers an active layer in its owning boundary's overlay stack.
10
10
  *
11
11
  * @param active - Whether the layer currently participates in the stack.
12
- * @param ownerDocument - The document owning the layer.
12
+ * @param boundaryElement - The boundary owning the layer.
13
13
  *
14
14
  * @returns The stable layer identifier and its current z-index.
15
15
  */
16
- export declare function useOverlayLayer(active: boolean, ownerDocument: Document | null): OverlayLayer;
16
+ export declare function useOverlayLayer(active: boolean, boundaryElement: Element | null): OverlayLayer;
17
17
  /**
18
- * Determines whether a layer is uppermost in its document.
18
+ * Determines whether a layer is uppermost in its boundary.
19
19
  *
20
- * @param ownerDocument - The document owning the overlay layer.
20
+ * @param boundaryElement - The boundary owning the overlay layer.
21
21
  * @param layerIdentifier - The layer identifier being inspected.
22
22
  *
23
23
  * @returns Whether the layer is the last active stack entry.
24
24
  */
25
- export declare function isTopmostOverlayLayer(ownerDocument: Document, layerIdentifier: symbol): boolean;
25
+ export declare function isTopmostOverlayLayer(boundaryElement: Element, layerIdentifier: symbol): boolean;
26
+ /**
27
+ * Determines whether a boundary currently owns any active overlay layer.
28
+ *
29
+ * The lookup deliberately avoids creating an entry, because this answers a
30
+ * question about boundaries the caller does not own, and creating one for
31
+ * every boundary inspected would populate the map with empty stacks.
32
+ *
33
+ * @param boundaryElement - The boundary whose overlay stack is inspected.
34
+ *
35
+ * @returns Whether the boundary holds at least one registered layer.
36
+ */
37
+ export declare function hasActiveOverlayLayer(boundaryElement: Element): boolean;
26
38
  /**
27
39
  * Registers whether an overlay layer currently owns focus containment.
28
40
  *
@@ -30,16 +42,16 @@ export declare function isTopmostOverlayLayer(ownerDocument: Document, layerIden
30
42
  * a non-trapping child layer cannot suspend its enclosing focus trap.
31
43
  *
32
44
  * @param active - Whether the layer currently contains focus.
33
- * @param ownerDocument - The document owning the layer.
45
+ * @param boundaryElement - The boundary owning the layer.
34
46
  * @param layerIdentifier - The layer identifier registered in the stack.
35
47
  */
36
- export declare function useOverlayFocusLayer(active: boolean, ownerDocument: Document | null, layerIdentifier: symbol): void;
48
+ export declare function useOverlayFocusLayer(active: boolean, boundaryElement: Element | null, layerIdentifier: symbol): void;
37
49
  /**
38
50
  * Determines whether a layer is the uppermost focus-containing overlay.
39
51
  *
40
- * @param ownerDocument - The document owning the overlay layer.
52
+ * @param boundaryElement - The boundary owning the overlay layer.
41
53
  * @param layerIdentifier - The layer identifier being inspected.
42
54
  *
43
55
  * @returns Whether no later visual layer also owns focus containment.
44
56
  */
45
- export declare function isTopmostFocusLayer(ownerDocument: Document, layerIdentifier: symbol): boolean;
57
+ export declare function isTopmostFocusLayer(boundaryElement: Element, layerIdentifier: symbol): boolean;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Resolves the nearest scroller an overlay should lock within its Boundary.
3
+ *
4
+ * An overlay is positioned within its boundary rather than the viewport, so
5
+ * it travels with the content behind it, and locking nothing is correct when
6
+ * no scroller lies in between.
7
+ *
8
+ * @param boundary - The boundary owning the overlay requesting the lock.
9
+ * @param ownerDocument - The document containing the boundary.
10
+ *
11
+ * @returns The enclosing scroller, or null when the overlay locks nothing.
12
+ */
13
+ export declare function resolveScrollContainer(boundary: Element | null, ownerDocument: Document): Element | Document | null;
@@ -1,4 +1,5 @@
1
1
  import { type CSSProperties, type InputHTMLAttributes, type ReactNode } from "react";
2
+ import RadioGroup from "./components/RadioGroup";
2
3
  import "./styles/radio.css";
3
4
  /** A type representing properties for the Radio component. */
4
5
  export type RadioProps = Omit<InputHTMLAttributes<HTMLInputElement>, "checked" | "children" | "className" | "defaultChecked" | "name" | "onChange" | "required" | "style" | "type" | "value"> & {
@@ -19,7 +20,7 @@ export type RadioProps = Omit<InputHTMLAttributes<HTMLInputElement>, "checked" |
19
20
  *
20
21
  * @returns The rendered Radio option.
21
22
  */
22
- declare const Radio: import("react").ForwardRefExoticComponent<Omit<InputHTMLAttributes<HTMLInputElement>, "defaultChecked" | "className" | "style" | "children" | "onChange" | "name" | "type" | "value" | "required" | "checked"> & {
23
+ declare const RadioRoot: import("react").ForwardRefExoticComponent<Omit<InputHTMLAttributes<HTMLInputElement>, "defaultChecked" | "className" | "style" | "children" | "onChange" | "name" | "type" | "value" | "required" | "checked"> & {
23
24
  /** The clickable and accessible label for the Radio option. */
24
25
  children: ReactNode;
25
26
  /** The additional class name applied to the Radio label root. */
@@ -29,4 +30,11 @@ declare const Radio: import("react").ForwardRefExoticComponent<Omit<InputHTMLAtt
29
30
  /** The string submitted when the Radio option is selected. */
30
31
  value: string;
31
32
  } & import("react").RefAttributes<HTMLInputElement>>;
33
+ /** A type representing the complete compound Radio component. */
34
+ type RadioComponent = typeof RadioRoot & {
35
+ /** A labelled set of mutually exclusive Radio options. */
36
+ Group: typeof RadioGroup;
37
+ };
38
+ /** The compound Radio component and its grouping form. */
39
+ declare const Radio: RadioComponent;
32
40
  export default Radio;
@@ -1,8 +1,8 @@
1
1
  import { type ChangeEventHandler, type HTMLAttributes, type ReactNode } from "react";
2
- import "./styles/radio-group.css";
2
+ import "../styles/radio-group.css";
3
3
  /** A type representing the visual direction of Radio options. */
4
4
  export type RadioGroupOrientation = "horizontal" | "vertical";
5
- /** A type representing properties for the RadioGroup component. */
5
+ /** A type representing properties for the Radio.Group component. */
6
6
  export type RadioGroupProps = Omit<HTMLAttributes<HTMLDivElement>, "children" | "defaultValue" | "onChange"> & {
7
7
  /** The Radio options belonging to the group. */
8
8
  children: ReactNode;
@@ -26,6 +26,13 @@ export type RadioGroupProps = Omit<HTMLAttributes<HTMLDivElement>, "children" |
26
26
  /**
27
27
  * Renders a native radio group with shared form and validation state.
28
28
  *
29
+ * @note Radio children are deliberately not validated, unlike Checkbox.Group.
30
+ * The browser groups radios by their shared `name` and enforces `required`
31
+ * across that group, so this component never reads its children and content
32
+ * may be wrapped or arranged freely. Checkbox.Group has no such native
33
+ * primitive and must inspect each option during render, which is why it
34
+ * rejects wrappers. The divergence follows the platform, not a preference.
35
+ *
29
36
  * @param props - The properties that configure the RadioGroup.
30
37
  * @param forwardedReference - The reference assigned to the group root.
31
38
  *
@@ -1,2 +1,3 @@
1
1
  export { default } from "./Radio";
2
2
  export type { RadioProps } from "./Radio";
3
+ export type { RadioGroupOrientation, RadioGroupProps, } from "./components/RadioGroup";
@@ -62,8 +62,6 @@ export type CustomSelectProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, "c
62
62
  options: readonly SelectOption[];
63
63
  /** The guidance displayed when no option is selected. */
64
64
  placeholder?: string;
65
- /** The optional element receiving the listbox portal. */
66
- portalContainer?: Element | null;
67
65
  /** The inline styles applied to the composite Select root. */
68
66
  style?: CSSProperties;
69
67
  /** Whether the custom Select communicates that a value is required. */
@@ -0,0 +1,28 @@
1
+ import type { EdgeBounds } from "../../Portal/utils/floating-position";
2
+ /** A type representing the fitted position of a Select listbox. */
3
+ export type ListboxPosition = {
4
+ /** The boundary-relative horizontal position. */
5
+ left: number;
6
+ /** The maximum height available in the selected vertical direction. */
7
+ maxHeight: number;
8
+ /** The minimum width inherited from the trigger. */
9
+ minWidth: number;
10
+ /** The boundary-relative vertical position. */
11
+ top: number;
12
+ };
13
+ /**
14
+ * Calculates the listbox position and height fitted inside a boundary.
15
+ *
16
+ * Every rectangle is expressed in the same coordinate space, so the returned
17
+ * coordinates share that space and callers convert them once.
18
+ *
19
+ * A boundary shorter than the readable minimum is deliberately exceeded,
20
+ * because a listbox collapsed to a few pixels shows nothing at all.
21
+ *
22
+ * @param triggerBounds - The bounds of the trigger anchoring the listbox.
23
+ * @param listboxBounds - The measured listbox bounds, when it is mounted.
24
+ * @param boundaryBounds - The bounds the listbox must remain inside.
25
+ *
26
+ * @returns The fitted listbox coordinates and size constraints.
27
+ */
28
+ export declare function calculateListboxPosition(triggerBounds: DOMRect, listboxBounds: DOMRect | undefined, boundaryBounds: EdgeBounds): ListboxPosition;
@@ -0,0 +1,113 @@
1
+ import { type HTMLAttributes, type ReactNode, type RefObject } from "react";
2
+ import SidebarFooter from "./components/SidebarFooter";
3
+ import SidebarGroup from "./components/SidebarGroup";
4
+ import SidebarHeader from "./components/SidebarHeader";
5
+ import SidebarItem from "./components/SidebarItem";
6
+ import { type SidebarSide, type SidebarStyle } from "./components/SidebarPanel";
7
+ import SidebarTrigger from "./components/SidebarTrigger";
8
+ import SidebarUser from "./components/SidebarUser";
9
+ import { type SidebarOpenChangeReason, type SidebarVariant } from "./utils/state";
10
+ import "./styles/sidebar.css";
11
+ export type { SidebarFooterProps } from "./components/SidebarFooter";
12
+ export type { SidebarGroupProps } from "./components/SidebarGroup";
13
+ export type { SidebarHeaderProps } from "./components/SidebarHeader";
14
+ export type { SidebarItemProps } from "./components/SidebarItem";
15
+ export type { SidebarSide } from "./components/SidebarPanel";
16
+ export type { SidebarTriggerProps } from "./components/SidebarTrigger";
17
+ export type { SidebarUserAction, SidebarUserProps, } from "./components/SidebarUser";
18
+ export type { SidebarPresentation } from "./utils/presentation";
19
+ export type { SidebarOpenChangeReason, SidebarVariant } from "./utils/state";
20
+ /** A type representing the complete compound Sidebar component. */
21
+ type SidebarComponent = typeof SidebarRoot & {
22
+ /** The region pinned to the bottom of the Sidebar. */
23
+ Footer: typeof SidebarFooter;
24
+ /** A related set of Sidebar items forming one navigation region. */
25
+ Group: typeof SidebarGroup;
26
+ /** The region rendered at the top of the Sidebar. */
27
+ Header: typeof SidebarHeader;
28
+ /** One navigation destination or action inside a group. */
29
+ Item: typeof SidebarItem;
30
+ /** The control disclosing an overlay Sidebar. */
31
+ Trigger: typeof SidebarTrigger;
32
+ /** A person's avatar, name, and optional trailing control. */
33
+ User: typeof SidebarUser;
34
+ };
35
+ /** A type representing properties for the Sidebar component. */
36
+ export type SidebarProps = Omit<HTMLAttributes<HTMLElement>, "children" | "id" | "role" | "style" | "tabIndex"> & {
37
+ /** The regions and groups composing the Sidebar. */
38
+ children?: ReactNode;
39
+ /** Whether an uncontrolled overlay Sidebar is initially open. */
40
+ defaultOpen?: boolean;
41
+ /** The preferred element focused when the overlay Sidebar opens. */
42
+ initialFocusReference?: RefObject<HTMLElement | null>;
43
+ /** The distance the inline Sidebar is pinned below its scroll container. */
44
+ top?: string;
45
+ /** Whether document scrolling is locked while the overlay is open. */
46
+ lockScroll?: boolean;
47
+ /** The controlled open state of the overlay Sidebar. */
48
+ open?: boolean;
49
+ /** Whether focus returns to the Trigger after the overlay closes. */
50
+ restoreFocus?: boolean;
51
+ /** The edge the overlay Sidebar occupies. */
52
+ side?: SidebarSide;
53
+ /** The styles applied to the Sidebar panel. */
54
+ style?: SidebarStyle;
55
+ /** The responsive behavior selecting the Sidebar presentation. */
56
+ variant?: SidebarVariant;
57
+ /** The width of the Sidebar as a valid CSS length. */
58
+ width?: string;
59
+ /** The callback invoked when an interaction requests a changed state. */
60
+ onOpenChange?: (open: boolean, reason: SidebarOpenChangeReason) => void;
61
+ };
62
+ /**
63
+ * Renders a navigation panel beside content or as a disclosed overlay.
64
+ *
65
+ * An overlay Sidebar is always dismissable through Escape and an outside
66
+ * press, because it traps focus behind a modal dialog that renders no close
67
+ * control of its own.
68
+ *
69
+ * The panel advertises its own state for styling, and those attributes are
70
+ * part of the public contract: `data-variant` reports the presentation as
71
+ * `inline` or `overlay`, `data-side` the edge it occupies, and `data-state`
72
+ * whether a disclosed panel is `open` or `closing`. Select them beside a
73
+ * consumer class to style one presentation without a prop for each.
74
+ *
75
+ * The Sidebar publishes its state to the surrounding boundary, so a
76
+ * Trigger placed anywhere inside that boundary can disclose it. The boundary
77
+ * is also what the responsive presentation measures, so a narrow Boundary
78
+ * presents an overlay even on a wide display.
79
+ *
80
+ * @param props - The properties that configure the Sidebar.
81
+ * @param forwardedReference - The reference assigned to the panel element.
82
+ *
83
+ * @returns The inline, disclosed, or unmounted Sidebar panel.
84
+ */
85
+ declare const SidebarRoot: import("react").ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLElement>, "id" | "style" | "tabIndex" | "role" | "children"> & {
86
+ /** The regions and groups composing the Sidebar. */
87
+ children?: ReactNode;
88
+ /** Whether an uncontrolled overlay Sidebar is initially open. */
89
+ defaultOpen?: boolean;
90
+ /** The preferred element focused when the overlay Sidebar opens. */
91
+ initialFocusReference?: RefObject<HTMLElement | null>;
92
+ /** The distance the inline Sidebar is pinned below its scroll container. */
93
+ top?: string;
94
+ /** Whether document scrolling is locked while the overlay is open. */
95
+ lockScroll?: boolean;
96
+ /** The controlled open state of the overlay Sidebar. */
97
+ open?: boolean;
98
+ /** Whether focus returns to the Trigger after the overlay closes. */
99
+ restoreFocus?: boolean;
100
+ /** The edge the overlay Sidebar occupies. */
101
+ side?: SidebarSide;
102
+ /** The styles applied to the Sidebar panel. */
103
+ style?: SidebarStyle;
104
+ /** The responsive behavior selecting the Sidebar presentation. */
105
+ variant?: SidebarVariant;
106
+ /** The width of the Sidebar as a valid CSS length. */
107
+ width?: string;
108
+ /** The callback invoked when an interaction requests a changed state. */
109
+ onOpenChange?: (open: boolean, reason: SidebarOpenChangeReason) => void;
110
+ } & import("react").RefAttributes<HTMLElement>>;
111
+ /** The compound Sidebar component and its composable regions. */
112
+ declare const Sidebar: SidebarComponent;
113
+ export default Sidebar;
@@ -0,0 +1,24 @@
1
+ import { type HTMLAttributes, type ReactNode } from "react";
2
+ import { type SidebarPresentation } from "../utils/presentation";
3
+ /** A type representing properties for the Sidebar.Footer component. */
4
+ export type SidebarFooterProps = HTMLAttributes<HTMLDivElement> & {
5
+ /** The content pinned to the bottom of the Sidebar. */
6
+ children?: ReactNode;
7
+ /** The presentations the footer is rendered in. */
8
+ presentation?: SidebarPresentation;
9
+ };
10
+ /**
11
+ * Renders the region pinned to the bottom of a Sidebar.
12
+ *
13
+ * @param props - The native properties that configure the footer.
14
+ * @param forwardedReference - The reference assigned to the footer element.
15
+ *
16
+ * @returns The rendered Sidebar footer.
17
+ */
18
+ declare const SidebarFooter: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
19
+ /** The content pinned to the bottom of the Sidebar. */
20
+ children?: ReactNode;
21
+ /** The presentations the footer is rendered in. */
22
+ presentation?: SidebarPresentation;
23
+ } & import("react").RefAttributes<HTMLDivElement>>;
24
+ export default SidebarFooter;
@@ -0,0 +1,31 @@
1
+ import { type HTMLAttributes, type ReactNode } from "react";
2
+ import { type SidebarPresentation } from "../utils/presentation";
3
+ /** A type representing properties for the Sidebar.Group component. */
4
+ export type SidebarGroupProps = Omit<HTMLAttributes<HTMLDivElement>, "children"> & {
5
+ /** The Sidebar items rendered inside the group. */
6
+ children?: ReactNode;
7
+ /** The visible heading naming the group's navigation region. */
8
+ label?: ReactNode;
9
+ /** The presentations the group is rendered in. */
10
+ presentation?: SidebarPresentation;
11
+ };
12
+ /**
13
+ * Renders a related set of Sidebar items as one navigation region.
14
+ *
15
+ * A group becomes a navigation landmark only when it carries an accessible
16
+ * name, because repeated unnamed landmarks cannot be told apart.
17
+ *
18
+ * @param props - The label and native properties that configure the group.
19
+ * @param forwardedReference - The reference assigned to the group element.
20
+ *
21
+ * @returns The rendered Sidebar group.
22
+ */
23
+ declare const SidebarGroup: import("react").ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLDivElement>, "children"> & {
24
+ /** The Sidebar items rendered inside the group. */
25
+ children?: ReactNode;
26
+ /** The visible heading naming the group's navigation region. */
27
+ label?: ReactNode;
28
+ /** The presentations the group is rendered in. */
29
+ presentation?: SidebarPresentation;
30
+ } & import("react").RefAttributes<HTMLElement>>;
31
+ export default SidebarGroup;
@@ -0,0 +1,29 @@
1
+ import { type HTMLAttributes, type ReactNode } from "react";
2
+ import { type SidebarPresentation } from "../utils/presentation";
3
+ /** A type representing properties for the Sidebar.Header component. */
4
+ export type SidebarHeaderProps = HTMLAttributes<HTMLDivElement> & {
5
+ /** The content rendered at the top of the Sidebar. */
6
+ children?: ReactNode;
7
+ /** The presentations the header is rendered in. */
8
+ presentation?: SidebarPresentation;
9
+ };
10
+ /**
11
+ * Renders the region at the top of a Sidebar.
12
+ *
13
+ * The region holds whatever identifies the interface, such as a logo or a
14
+ * workspace switcher, and scrolls away with the navigation rather than
15
+ * pinning like the footer. Giving it an `id` and passing that to the
16
+ * Sidebar's `aria-labelledby` names the panel after the content shown here.
17
+ *
18
+ * @param props - The native properties that configure the header.
19
+ * @param forwardedReference - The reference assigned to the header element.
20
+ *
21
+ * @returns The rendered Sidebar header.
22
+ */
23
+ declare const SidebarHeader: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
24
+ /** The content rendered at the top of the Sidebar. */
25
+ children?: ReactNode;
26
+ /** The presentations the header is rendered in. */
27
+ presentation?: SidebarPresentation;
28
+ } & import("react").RefAttributes<HTMLDivElement>>;
29
+ export default SidebarHeader;
@@ -0,0 +1,46 @@
1
+ import { type ComponentPropsWithRef, type ComponentPropsWithoutRef, type ElementType, type ReactElement, type ReactNode } from "react";
2
+ import { type IconType } from "../../Icon";
3
+ import { type SidebarPresentation } from "../utils/presentation";
4
+ /** A type representing properties owned by the Sidebar.Item component. */
5
+ type SidebarItemOwnProps = {
6
+ /** Whether the item represents the current page or view. */
7
+ active?: boolean;
8
+ /** The label displayed inside the item. */
9
+ children?: ReactNode;
10
+ /** Whether the item is present but unavailable. */
11
+ disabled?: boolean;
12
+ /** The icon displayed before the item label. */
13
+ icon?: IconType;
14
+ /** The presentations the item is rendered in. */
15
+ presentation?: SidebarPresentation;
16
+ };
17
+ /** A type representing the reference accepted by a polymorphic element. */
18
+ type SidebarItemReference<Component extends ElementType> = ComponentPropsWithRef<Component>["ref"];
19
+ /** A type representing properties for a polymorphic Sidebar item. */
20
+ export type SidebarItemProps<Component extends ElementType = "button"> = SidebarItemOwnProps & {
21
+ /**
22
+ * The intrinsic element or custom component used as the item control.
23
+ *
24
+ * Custom components own their native semantics and must forward the
25
+ * class name, reference, event handlers, and ARIA properties to their
26
+ * interactive root.
27
+ */
28
+ as?: Component;
29
+ } & Omit<ComponentPropsWithoutRef<Component>, keyof SidebarItemOwnProps | "as">;
30
+ /** A type representing the public polymorphic Sidebar item component. */
31
+ type SidebarItemComponent = <Component extends ElementType = "button">(props: SidebarItemProps<Component> & {
32
+ ref?: SidebarItemReference<Component>;
33
+ }) => ReactElement | null;
34
+ /**
35
+ * Renders one navigation destination or action inside a Sidebar group.
36
+ *
37
+ * Items carrying a navigation target report the current page, while action
38
+ * items report the current selection instead.
39
+ *
40
+ * @param props - The properties that configure the item and its element.
41
+ * @param forwardedReference - The reference assigned to the item control.
42
+ *
43
+ * @returns The rendered Sidebar item and its list container.
44
+ */
45
+ declare const SidebarItem: SidebarItemComponent;
46
+ export default SidebarItem;