@plexui/ui 0.28.1 → 0.30.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 (230) hide show
  1. package/dist/es/components/Alert/Alert.js +2 -2
  2. package/dist/es/components/Alert/Alert.js.map +1 -1
  3. package/dist/es/components/Avatar/Avatar.js +3 -1
  4. package/dist/es/components/Avatar/Avatar.js.map +1 -1
  5. package/dist/es/components/Badge/index.js +1 -1
  6. package/dist/es/components/Badge/index.js.map +1 -1
  7. package/dist/es/components/Button/Button.js +4 -3
  8. package/dist/es/components/Button/Button.js.map +1 -1
  9. package/dist/es/components/Button/NavigationButton.js +10 -0
  10. package/dist/es/components/Button/NavigationButton.js.map +1 -0
  11. package/dist/es/components/Button/NavigationGlyph.js +19 -0
  12. package/dist/es/components/Button/NavigationGlyph.js.map +1 -0
  13. package/dist/es/components/Button/index.js +1 -0
  14. package/dist/es/components/Button/index.js.map +1 -1
  15. package/dist/es/components/Checkbox/Checkbox.js +2 -1
  16. package/dist/es/components/Checkbox/Checkbox.js.map +1 -1
  17. package/dist/es/components/ColorPicker/ColorPicker.js +227 -0
  18. package/dist/es/components/ColorPicker/ColorPicker.js.map +1 -0
  19. package/dist/es/components/ColorPicker/ColorWell.js +58 -0
  20. package/dist/es/components/ColorPicker/ColorWell.js.map +1 -0
  21. package/dist/es/components/ColorPicker/index.js +3 -0
  22. package/dist/es/components/ColorPicker/index.js.map +1 -0
  23. package/dist/es/components/ColorPicker/shared.js +132 -0
  24. package/dist/es/components/ColorPicker/shared.js.map +1 -0
  25. package/dist/es/components/ContextMenu/ContextMenu.js +164 -0
  26. package/dist/es/components/ContextMenu/ContextMenu.js.map +1 -0
  27. package/dist/es/components/ContextMenu/index.js +2 -0
  28. package/dist/es/components/ContextMenu/index.js.map +1 -0
  29. package/dist/es/components/ContextMenu/shared.js +56 -0
  30. package/dist/es/components/ContextMenu/shared.js.map +1 -0
  31. package/dist/es/components/DateInput/DateInput.js +4 -2
  32. package/dist/es/components/DateInput/DateInput.js.map +1 -1
  33. package/dist/es/components/DatePicker/Calendar.js +89 -55
  34. package/dist/es/components/DatePicker/Calendar.js.map +1 -1
  35. package/dist/es/components/DatePicker/CalendarNavigationIcon.js +13 -0
  36. package/dist/es/components/DatePicker/CalendarNavigationIcon.js.map +1 -0
  37. package/dist/es/components/DatePicker/DatePicker.js +9 -2
  38. package/dist/es/components/DatePicker/DatePicker.js.map +1 -1
  39. package/dist/es/components/DatePicker/useCalendarGutter.js +8 -0
  40. package/dist/es/components/DatePicker/useCalendarGutter.js.map +1 -0
  41. package/dist/es/components/DateRangePicker/Calendar.js +66 -49
  42. package/dist/es/components/DateRangePicker/Calendar.js.map +1 -1
  43. package/dist/es/components/DateRangePicker/DateRangePicker.js +6 -1
  44. package/dist/es/components/DateRangePicker/DateRangePicker.js.map +1 -1
  45. package/dist/es/components/DateRangePicker/Trigger.js +1 -1
  46. package/dist/es/components/DateRangePicker/Trigger.js.map +1 -1
  47. package/dist/es/components/Dialog/Dialog.js +136 -20
  48. package/dist/es/components/Dialog/Dialog.js.map +1 -1
  49. package/dist/es/components/Dialog/index.js.map +1 -1
  50. package/dist/es/components/Dialog/sheetDrag.js +77 -24
  51. package/dist/es/components/Dialog/sheetDrag.js.map +1 -1
  52. package/dist/es/components/Field/Field.js +51 -4
  53. package/dist/es/components/Field/Field.js.map +1 -1
  54. package/dist/es/components/FieldGroup/FieldGroup.js +4 -2
  55. package/dist/es/components/FieldGroup/FieldGroup.js.map +1 -1
  56. package/dist/es/components/FileUpload/FileUpload.js +43 -3
  57. package/dist/es/components/FileUpload/FileUpload.js.map +1 -1
  58. package/dist/es/components/FloatingLabelInput/FloatingLabelInput.js +18 -16
  59. package/dist/es/components/FloatingLabelInput/FloatingLabelInput.js.map +1 -1
  60. package/dist/es/components/FloatingLabelSelect/FloatingLabelSelect.js +11 -6
  61. package/dist/es/components/FloatingLabelSelect/FloatingLabelSelect.js.map +1 -1
  62. package/dist/es/components/Icon/index.js +2 -0
  63. package/dist/es/components/Icon/index.js.map +1 -1
  64. package/dist/es/components/Icon/svg/Disclosure.js +5 -0
  65. package/dist/es/components/Icon/svg/Disclosure.js.map +1 -0
  66. package/dist/es/components/Icon/svg/Eyedropper.js +6 -0
  67. package/dist/es/components/Icon/svg/Eyedropper.js.map +1 -0
  68. package/dist/es/components/Indicator/LoadingIndicator.js +1 -1
  69. package/dist/es/components/Indicator/LoadingIndicator.js.map +1 -1
  70. package/dist/es/components/Input/Input.js +3 -3
  71. package/dist/es/components/Input/Input.js.map +1 -1
  72. package/dist/es/components/InputGroup/InputGroup.js +3 -1
  73. package/dist/es/components/InputGroup/InputGroup.js.map +1 -1
  74. package/dist/es/components/MarkdownEditor/MarkdownEditor.js +95 -93
  75. package/dist/es/components/MarkdownEditor/MarkdownEditor.js.map +1 -1
  76. package/dist/es/components/Menu/Menu.js +306 -34
  77. package/dist/es/components/Menu/Menu.js.map +1 -1
  78. package/dist/es/components/OTPInput/OTPInput.js +4 -1
  79. package/dist/es/components/OTPInput/OTPInput.js.map +1 -1
  80. package/dist/es/components/Page/Page.js +147 -19
  81. package/dist/es/components/Page/Page.js.map +1 -1
  82. package/dist/es/components/Page/index.js.map +1 -1
  83. package/dist/es/components/PageControl/PageControl.js +146 -0
  84. package/dist/es/components/PageControl/PageControl.js.map +1 -0
  85. package/dist/es/components/PageControl/index.js +2 -0
  86. package/dist/es/components/PageControl/index.js.map +1 -0
  87. package/dist/es/components/Popover/Popover.js +75 -33
  88. package/dist/es/components/Popover/Popover.js.map +1 -1
  89. package/dist/es/components/Popover/deferredOutsidePress.js +90 -0
  90. package/dist/es/components/Popover/deferredOutsidePress.js.map +1 -0
  91. package/dist/es/components/Popover/usePopoverContext.js.map +1 -1
  92. package/dist/es/components/RadioGroup/RadioGroup.js +1 -1
  93. package/dist/es/components/RadioGroup/RadioGroup.js.map +1 -1
  94. package/dist/es/components/Select/Select.js +98 -32
  95. package/dist/es/components/Select/Select.js.map +1 -1
  96. package/dist/es/components/SelectControl/SelectControl.js +48 -29
  97. package/dist/es/components/SelectControl/SelectControl.js.map +1 -1
  98. package/dist/es/components/SelectControl/index.js +1 -1
  99. package/dist/es/components/SelectControl/index.js.map +1 -1
  100. package/dist/es/components/ShimmerText/ShimmerText.js +17 -7
  101. package/dist/es/components/ShimmerText/ShimmerText.js.map +1 -1
  102. package/dist/es/components/Sidebar/Sidebar.js +21 -8
  103. package/dist/es/components/Sidebar/Sidebar.js.map +1 -1
  104. package/dist/es/components/Slider/Slider.js +61 -15
  105. package/dist/es/components/Slider/Slider.js.map +1 -1
  106. package/dist/es/components/Sortable/Sortable.js +16 -6
  107. package/dist/es/components/Sortable/Sortable.js.map +1 -1
  108. package/dist/es/components/Stepper/Stepper.js +114 -0
  109. package/dist/es/components/Stepper/Stepper.js.map +1 -0
  110. package/dist/es/components/Stepper/index.js +2 -0
  111. package/dist/es/components/Stepper/index.js.map +1 -0
  112. package/dist/es/components/Switch/Switch.js +2 -2
  113. package/dist/es/components/Switch/Switch.js.map +1 -1
  114. package/dist/es/components/TabBar/TabBar.js +128 -0
  115. package/dist/es/components/TabBar/TabBar.js.map +1 -0
  116. package/dist/es/components/TabBar/index.js +2 -0
  117. package/dist/es/components/TabBar/index.js.map +1 -0
  118. package/dist/es/components/Tabs/Tabs.js +27 -11
  119. package/dist/es/components/Tabs/Tabs.js.map +1 -1
  120. package/dist/es/components/TagInput/TagInput.js +40 -4
  121. package/dist/es/components/TagInput/TagInput.js.map +1 -1
  122. package/dist/es/components/Textarea/Textarea.js +7 -1
  123. package/dist/es/components/Textarea/Textarea.js.map +1 -1
  124. package/dist/es/components/Toast/ToastRenderer.js +86 -0
  125. package/dist/es/components/Toast/ToastRenderer.js.map +1 -0
  126. package/dist/es/components/Toast/Toaster.js +31 -16
  127. package/dist/es/components/Toast/Toaster.js.map +1 -1
  128. package/dist/es/components/Toast/toastLifecycle.js +283 -0
  129. package/dist/es/components/Toast/toastLifecycle.js.map +1 -0
  130. package/dist/es/components/Toolbar/Toolbar.js +92 -0
  131. package/dist/es/components/Toolbar/Toolbar.js.map +1 -0
  132. package/dist/es/components/Toolbar/index.js +2 -0
  133. package/dist/es/components/Toolbar/index.js.map +1 -0
  134. package/dist/es/components/Tooltip/CopyTooltip.js +37 -11
  135. package/dist/es/components/Tooltip/CopyTooltip.js.map +1 -1
  136. package/dist/es/components/Tooltip/Tooltip.js +61 -9
  137. package/dist/es/components/Tooltip/Tooltip.js.map +1 -1
  138. package/dist/es/hooks/useFloatingBoundary.js +35 -0
  139. package/dist/es/hooks/useFloatingBoundary.js.map +1 -0
  140. package/dist/es/hooks/usePhoneSubmenu.js +22 -0
  141. package/dist/es/hooks/usePhoneSubmenu.js.map +1 -0
  142. package/dist/es/lib/copyToClipboard.js +16 -7
  143. package/dist/es/lib/copyToClipboard.js.map +1 -1
  144. package/dist/es/lib/fieldRow.js +7 -1
  145. package/dist/es/lib/fieldRow.js.map +1 -1
  146. package/dist/es/lib/floatingBoundary.js +90 -0
  147. package/dist/es/lib/floatingBoundary.js.map +1 -0
  148. package/dist/es/lib/focusRestore.js +56 -0
  149. package/dist/es/lib/focusRestore.js.map +1 -0
  150. package/dist/es/lib/helpers.js +0 -18
  151. package/dist/es/lib/helpers.js.map +1 -1
  152. package/dist/es/lib/inputMode.js +9 -0
  153. package/dist/es/lib/inputMode.js.map +1 -0
  154. package/dist/es/lib/menuInitialFocus.js +100 -0
  155. package/dist/es/lib/menuInitialFocus.js.map +1 -0
  156. package/dist/es/lib/menuSubmenuPlacement.js +264 -0
  157. package/dist/es/lib/menuSubmenuPlacement.js.map +1 -0
  158. package/dist/es/lib/menuTriggerCover.js +70 -0
  159. package/dist/es/lib/menuTriggerCover.js.map +1 -0
  160. package/dist/es/lib/observeTextareaWidth.js +49 -0
  161. package/dist/es/lib/observeTextareaWidth.js.map +1 -0
  162. package/dist/es/lib/scrollEdges.js +34 -0
  163. package/dist/es/lib/scrollEdges.js.map +1 -0
  164. package/dist/es/lib/selectPress.js +34 -0
  165. package/dist/es/lib/selectPress.js.map +1 -0
  166. package/dist/es/lib/sortable.js +74 -20
  167. package/dist/es/lib/sortable.js.map +1 -1
  168. package/dist/es/styles/mobile-materials.css +1 -0
  169. package/dist/es/styles/mobile-surfaces.css +1 -0
  170. package/dist/types/components/Button/Button.d.ts +2 -0
  171. package/dist/types/components/Button/NavigationButton.d.ts +8 -0
  172. package/dist/types/components/Button/NavigationGlyph.d.ts +7 -0
  173. package/dist/types/components/Button/index.d.ts +1 -0
  174. package/dist/types/components/ColorPicker/ColorPicker.d.ts +34 -0
  175. package/dist/types/components/ColorPicker/ColorWell.d.ts +32 -0
  176. package/dist/types/components/ColorPicker/index.d.ts +3 -0
  177. package/dist/types/components/ColorPicker/shared.d.ts +69 -0
  178. package/dist/types/components/ContextMenu/ContextMenu.d.ts +78 -0
  179. package/dist/types/components/ContextMenu/index.d.ts +1 -0
  180. package/dist/types/components/ContextMenu/shared.d.ts +50 -0
  181. package/dist/types/components/DatePicker/CalendarNavigationIcon.d.ts +5 -0
  182. package/dist/types/components/DatePicker/DatePicker.d.ts +7 -1
  183. package/dist/types/components/DatePicker/useCalendarGutter.d.ts +1 -0
  184. package/dist/types/components/DateRangePicker/DateRangePicker.d.ts +2 -0
  185. package/dist/types/components/Dialog/Dialog.d.ts +17 -6
  186. package/dist/types/components/Dialog/index.d.ts +1 -1
  187. package/dist/types/components/Field/Field.d.ts +12 -2
  188. package/dist/types/components/FieldGroup/FieldGroup.d.ts +11 -2
  189. package/dist/types/components/Icon/index.d.ts +2 -0
  190. package/dist/types/components/Icon/svg/Disclosure.d.ts +6 -0
  191. package/dist/types/components/Icon/svg/Eyedropper.d.ts +6 -0
  192. package/dist/types/components/Indicator/LoadingIndicator.d.ts +1 -1
  193. package/dist/types/components/Menu/Menu.d.ts +74 -9
  194. package/dist/types/components/Page/Page.d.ts +24 -9
  195. package/dist/types/components/Page/index.d.ts +1 -1
  196. package/dist/types/components/PageControl/PageControl.d.ts +52 -0
  197. package/dist/types/components/PageControl/index.d.ts +1 -0
  198. package/dist/types/components/Popover/Popover.d.ts +11 -6
  199. package/dist/types/components/Popover/deferredOutsidePress.d.ts +14 -0
  200. package/dist/types/components/Popover/usePopoverContext.d.ts +1 -0
  201. package/dist/types/components/Select/Select.d.ts +3 -3
  202. package/dist/types/components/SelectControl/SelectControl.d.ts +2 -2
  203. package/dist/types/components/SelectControl/index.d.ts +1 -1
  204. package/dist/types/components/Sortable/Sortable.d.ts +1 -1
  205. package/dist/types/components/Stepper/Stepper.d.ts +56 -0
  206. package/dist/types/components/Stepper/index.d.ts +1 -0
  207. package/dist/types/components/Switch/Switch.d.ts +3 -1
  208. package/dist/types/components/TabBar/TabBar.d.ts +74 -0
  209. package/dist/types/components/TabBar/index.d.ts +1 -0
  210. package/dist/types/components/Toast/ToastRenderer.d.ts +3 -0
  211. package/dist/types/components/Toast/Toaster.d.ts +4 -2
  212. package/dist/types/components/Toast/toastLifecycle.d.ts +90 -0
  213. package/dist/types/components/Toolbar/Toolbar.d.ts +93 -0
  214. package/dist/types/components/Toolbar/index.d.ts +1 -0
  215. package/dist/types/components/Tooltip/Tooltip.d.ts +2 -2
  216. package/dist/types/hooks/useFloatingBoundary.d.ts +24 -0
  217. package/dist/types/hooks/usePhoneSubmenu.d.ts +3 -0
  218. package/dist/types/lib/fieldRow.d.ts +6 -0
  219. package/dist/types/lib/floatingBoundary.d.ts +9 -0
  220. package/dist/types/lib/focusRestore.d.ts +5 -0
  221. package/dist/types/lib/helpers.d.ts +1 -5
  222. package/dist/types/lib/inputMode.d.ts +7 -0
  223. package/dist/types/lib/menuInitialFocus.d.ts +9 -0
  224. package/dist/types/lib/menuSubmenuPlacement.d.ts +57 -0
  225. package/dist/types/lib/menuTriggerCover.d.ts +23 -0
  226. package/dist/types/lib/observeTextareaWidth.d.ts +2 -0
  227. package/dist/types/lib/scrollEdges.d.ts +16 -0
  228. package/dist/types/lib/selectPress.d.ts +23 -0
  229. package/dist/types/lib/sortable.d.ts +1 -1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AC;AACD,UAAU,CAAC,WAAW,GAAG,aAAa,CAAA;AAEtC,wEAAwE;AACxE,yEAAyE;AACzE,wEAAwE;AAExE,MAAM,CAAC,MAAM,IAAI,GAAG,QASnB,CAAA;AACD,IAAI,CAAC,MAAM,GAAG,UAAU,CAAA;AACxB,IAAI,CAAC,GAAG,GAAG,OAAO,CAAA;AAClB,IAAI,CAAC,OAAO,GAAG,WAAW,CAAA;AAC1B,IAAI,CAAC,KAAK,GAAG,SAAS,CAAA;AACtB,IAAI,CAAC,QAAQ,GAAG,YAAY,CAAA;AAC5B,IAAI,CAAC,OAAO,GAAG,WAAW,CAAA;AAC1B,IAAI,CAAC,OAAO,GAAG,WAAW,CAAA;AAC1B,IAAI,CAAC,MAAM,GAAG,UAAU,CAAA","sourcesContent":["\"use client\"\n\nimport clsx from \"clsx\"\nimport {\n createContext,\n useContext,\n useMemo,\n useState,\n type HTMLAttributes,\n type Ref,\n type UIEvent,\n} from \"react\"\nimport s from \"@plexui/styles/components/Page/Page.module.css\"\n\nexport type PageWidth = \"full\" | \"wide\" | \"column\"\n\n// A trackpad's small settle at the top must not flash the line.\nconst SCROLLED_AFTER = 4\n\ntype PageContextValue = {\n scrolled: boolean\n setScrolled: (scrolled: boolean) => void\n}\n\nconst PageContext = createContext<PageContextValue | null>(null)\n\nfunction usePageContext(part: string): PageContextValue {\n const context = useContext(PageContext)\n if (!context) {\n throw new Error(`Page.${part} must be used within Page`)\n }\n return context\n}\n\n/* ------------------------------------------------------------------ */\n/* Root */\n/* ------------------------------------------------------------------ */\n\nexport type PageProps = HTMLAttributes<HTMLDivElement> & {\n /**\n * Width of the column that header and content share.\n * - `\"full\"` — edge to edge, for tables (default)\n * - `\"wide\"` — 1280px, centred, for overviews\n * - `\"column\"` — 768px, centred, for settings and forms\n *\n * Set `--page-width` on the page for any other width.\n * @default \"full\"\n */\n width?: PageWidth\n ref?: Ref<HTMLDivElement>\n}\n\nfunction PageRoot({ width = \"full\", className, children, ...restProps }: PageProps) {\n const [scrolled, setScrolled] = useState(false)\n const context = useMemo(() => ({ scrolled, setScrolled }), [scrolled])\n\n return (\n <PageContext.Provider value={context}>\n <div className={clsx(s.Page, className)} data-width={width} {...restProps}>\n {children}\n </div>\n </PageContext.Provider>\n )\n}\nPageRoot.displayName = \"Page\"\n\n/* ------------------------------------------------------------------ */\n/* Header */\n/* ------------------------------------------------------------------ */\n\nexport type PageHeaderProps = HTMLAttributes<HTMLDivElement> & {\n /**\n * Shows the line, and the glass on a phone, once the content has scrolled under the header.\n * Turn it off when the content already draws a line of its own at that place.\n * @default true\n */\n divider?: boolean\n ref?: Ref<HTMLDivElement>\n}\n\nfunction PageHeader({ divider = true, className, children, ...restProps }: PageHeaderProps) {\n const { scrolled } = usePageContext(\"Header\")\n\n return (\n <div\n className={clsx(s.Header, className)}\n data-scrolled={divider && scrolled ? \"\" : undefined}\n {...restProps}\n >\n <div className={s.Head}>{children}</div>\n </div>\n )\n}\nPageHeader.displayName = \"Page.Header\"\n\n/* ------------------------------------------------------------------ */\n/* Slots */\n/* ------------------------------------------------------------------ */\n\nexport type PageSlotProps = HTMLAttributes<HTMLDivElement> & { ref?: Ref<HTMLDivElement> }\n\nfunction PageBar({ className, ...restProps }: PageSlotProps) {\n return <div className={clsx(s.Bar, className)} {...restProps} />\n}\nPageBar.displayName = \"Page.Bar\"\n\nfunction PageHeading({ className, ...restProps }: PageSlotProps) {\n return <div className={clsx(s.Heading, className)} {...restProps} />\n}\nPageHeading.displayName = \"Page.Heading\"\n\nfunction PageTitle({\n className,\n ...restProps\n}: HTMLAttributes<HTMLHeadingElement> & { ref?: Ref<HTMLHeadingElement> }) {\n return <h1 className={clsx(s.Title, className)} {...restProps} />\n}\nPageTitle.displayName = \"Page.Title\"\n\nfunction PageSubtitle({\n className,\n ...restProps\n}: HTMLAttributes<HTMLParagraphElement> & { ref?: Ref<HTMLParagraphElement> }) {\n return <p className={clsx(s.Subtitle, className)} {...restProps} />\n}\nPageSubtitle.displayName = \"Page.Subtitle\"\n\nfunction PageActions({ className, ...restProps }: PageSlotProps) {\n return <div className={clsx(s.Actions, className)} {...restProps} />\n}\nPageActions.displayName = \"Page.Actions\"\n\n/* ------------------------------------------------------------------ */\n/* Content */\n/* ------------------------------------------------------------------ */\n\nexport type PageContentProps = HTMLAttributes<HTMLDivElement> & {\n /**\n * The content fills the page and scrolls inside itself, as a table does: the page stops\n * scrolling from 768px up.\n * @default false\n */\n fill?: boolean\n ref?: Ref<HTMLDivElement>\n}\n\nfunction PageContent({ fill = false, className, children, onScroll, ...restProps }: PageContentProps) {\n const { setScrolled } = usePageContext(\"Content\")\n\n const handleScroll = (event: UIEvent<HTMLDivElement>) => {\n setScrolled(event.currentTarget.scrollTop > SCROLLED_AFTER)\n onScroll?.(event)\n }\n\n return (\n <div\n className={clsx(s.Content, className)}\n data-fill={fill ? \"\" : undefined}\n onScroll={handleScroll}\n {...restProps}\n >\n <div className={s.Column}>{children}</div>\n </div>\n )\n}\nPageContent.displayName = \"Page.Content\"\n\n/** Actions that remain below the scrolling content, inside the page's safe area. */\nfunction PageFooter({ className, children, ...restProps }: PageSlotProps) {\n return (\n <div className={clsx(s.Footer, className)} {...restProps}>\n <div className={s.FooterContent}>{children}</div>\n </div>\n )\n}\nPageFooter.displayName = \"Page.Footer\"\n\n/* ------------------------------------------------------------------ */\n/* Compound */\n/* ------------------------------------------------------------------ */\n\nexport const Page = PageRoot as typeof PageRoot & {\n Header: typeof PageHeader\n Bar: typeof PageBar\n Heading: typeof PageHeading\n Title: typeof PageTitle\n Subtitle: typeof PageSubtitle\n Actions: typeof PageActions\n Content: typeof PageContent\n Footer: typeof PageFooter\n}\nPage.Header = PageHeader\nPage.Bar = PageBar\nPage.Heading = PageHeading\nPage.Title = PageTitle\nPage.Subtitle = PageSubtitle\nPage.Actions = PageActions\nPage.Content = PageContent\nPage.Footer = PageFooter\n"]}
1
+ {"version":3,"file":"Page.js","sourceRoot":"","sources":["../../../../src/components/Page/Page.tsx"],"names":[],"mappings":"A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,SAAS,YAEb,cAAK,SAAS,EAAE,CAAC,CAAC,aAAa,YAAG,QAAQ,GAAO,GAC7C,CACP,CAAA;AACH,CAAC;AACD,UAAU,CAAC,WAAW,GAAG,aAAa,CAAA;AAEtC,wEAAwE;AACxE,yEAAyE;AACzE,wEAAwE;AAExE,MAAM,CAAC,MAAM,IAAI,GAAG,QAUnB,CAAA;AACD,IAAI,CAAC,MAAM,GAAG,UAAU,CAAA;AACxB,IAAI,CAAC,GAAG,GAAG,OAAO,CAAA;AAClB,IAAI,CAAC,OAAO,GAAG,WAAW,CAAA;AAC1B,IAAI,CAAC,OAAO,GAAG,WAAW,CAAA;AAC1B,IAAI,CAAC,KAAK,GAAG,SAAS,CAAA;AACtB,IAAI,CAAC,QAAQ,GAAG,YAAY,CAAA;AAC5B,IAAI,CAAC,OAAO,GAAG,WAAW,CAAA;AAC1B,IAAI,CAAC,OAAO,GAAG,WAAW,CAAA;AAC1B,IAAI,CAAC,MAAM,GAAG,UAAU,CAAA","sourcesContent":["\"use client\"\n\nimport clsx from \"clsx\"\nimport {\n createContext,\n useContext,\n useCallback,\n useMemo,\n useLayoutEffect,\n useRef,\n useState,\n type HTMLAttributes,\n type CSSProperties,\n type Ref,\n type UIEvent,\n} from \"react\"\nimport { FloatingBoundaryProvider, useFloatingBoundaryRegistration, useFloatingBoundaryScope } from \"../../hooks/useFloatingBoundary\"\nimport { ToolbarHostContext, type BarBackground, type ToolbarHost, type ToolbarPlacement } from \"../Toolbar/Toolbar\"\nimport { NO_SCROLL_EDGES, observeScrollEdges, sameScrollEdges, type ScrollEdges } from \"../../lib/scrollEdges\"\nimport s from \"@plexui/styles/components/Page/Page.module.css\"\n\n/** How a phone bar of the page meets the content scrolled under it; see `BarBackground`. */\nexport type PageBarBackground = BarBackground\n\nexport type PageWidth = \"full\" | \"wide\" | \"column\"\n\ntype PageContextValue = {\n /** Content under the header (scrolled) and under the footer (content below). */\n edges: ScrollEdges\n setEdges: (edges: ScrollEdges) => void\n setFooterHeight: (height: number) => void\n setHeaderHeight: (height: number | undefined) => void\n /** Writes the content's scroll offset to the page as `--page-scroll-y`, which a large Toolbar title follows. */\n setScrollY: (scrollY: number) => void\n /** Tells the bars that follow the scroll, such as a minimizing TabBar, the content's scroll offset. */\n notifyScroll: (scrollY: number) => void\n}\n\nconst PageContext = createContext<PageContextValue | null>(null)\n\nfunction usePageContext(part: string): PageContextValue {\n const context = useContext(PageContext)\n if (!context) {\n throw new Error(`Page.${part} must be used within Page`)\n }\n return context\n}\n\n/* ------------------------------------------------------------------ */\n/* Root */\n/* ------------------------------------------------------------------ */\n\nexport type PageProps = HTMLAttributes<HTMLDivElement> & {\n /**\n * Width of the column that header and content share.\n * - `\"full\"` — edge to edge, for tables (default)\n * - `\"wide\"` — 1280px, centred, for overviews\n * - `\"column\"` — 768px, centred, for settings and forms\n *\n * Set `--page-width` on the page for any other width.\n * @default \"full\"\n */\n width?: PageWidth\n /** Mobile canvas and grouped-field palette. @default \"plain\" */\n surface?: \"plain\" | \"grouped\"\n ref?: Ref<HTMLDivElement>\n}\n\nfunction PageRoot({ width = \"full\", surface = \"plain\", className, children, style, ref, ...restProps }: PageProps) {\n const boundary = useFloatingBoundaryScope()\n const setRoot = boundary.setRoot\n const root = useRef<HTMLDivElement | null>(null)\n const setRef = useCallback((node: HTMLDivElement | null) => {\n root.current = node\n setRoot(node)\n if (typeof ref === \"function\") {\n const cleanup = ref(node)\n if (typeof cleanup === \"function\") return () => { root.current = null; setRoot(null); cleanup() }\n return\n }\n if (ref) ref.current = node\n }, [ref, setRoot])\n const [edges, setEdgesState] = useState(NO_SCROLL_EDGES)\n const setEdges = useCallback((next: ScrollEdges) => setEdgesState((current) => sameScrollEdges(current, next) ? current : next), [])\n const [footerHeight, setFooterHeight] = useState(0)\n const [headerHeight, setHeaderHeight] = useState<number>()\n // Written straight to the element: a scroll frame must not render the page again.\n const setScrollY = useCallback((scrollY: number) => root.current?.style.setProperty(\"--page-scroll-y\", String(Math.max(0, scrollY))), [])\n const scrollListeners = useRef(new Set<(scrollTop: number) => void>())\n const notifyScroll = useCallback((scrollY: number) => scrollListeners.current.forEach((listener) => listener(scrollY)), [])\n const subscribeScroll = useCallback((listener: (scrollTop: number) => void) => {\n const listeners = scrollListeners.current\n listeners.add(listener)\n return () => { listeners.delete(listener) }\n }, [])\n const context = useMemo(() => ({ edges, setEdges, setFooterHeight, setHeaderHeight, setScrollY, notifyScroll }), [edges, setEdges, setScrollY, notifyScroll])\n // A phone Toolbar replaces the header and footer bars; it reports its own heights.\n const [toolbarTop, setToolbarTop] = useState<number>()\n const [toolbarBottom, setToolbarBottom] = useState<number>()\n const setToolbarHeight = useCallback((placement: ToolbarPlacement, height: number | undefined) => (placement === \"top\" ? setToolbarTop : setToolbarBottom)(height), [])\n const toolbarHost = useMemo<ToolbarHost>(() => ({ kind: \"page\", setHeight: setToolbarHeight, scrolled: edges.scrolled, contentBelow: edges.contentBelow, subscribeScroll }), [setToolbarHeight, edges, subscribeScroll])\n const pageStyle = {\n \"--page-footer-height\": `${footerHeight}px`,\n ...(headerHeight !== undefined ? { \"--page-header-height\": `${headerHeight}px` } : {}),\n ...(toolbarTop !== undefined ? { \"--page-toolbar-height\": `${toolbarTop}px` } : {}),\n ...(toolbarBottom !== undefined ? { \"--page-toolbar-bottom-height\": `${toolbarBottom}px` } : {}),\n ...style,\n } as CSSProperties\n\n return (\n <FloatingBoundaryProvider value={boundary}>\n <PageContext.Provider value={context}>\n <ToolbarHostContext.Provider value={toolbarHost}>\n <div ref={setRef} className={clsx(s.Page, className)} data-width={width} data-surface={surface} style={pageStyle} {...restProps}>\n {children}\n </div>\n </ToolbarHostContext.Provider>\n </PageContext.Provider>\n </FloatingBoundaryProvider>\n )\n}\nPageRoot.displayName = \"Page\"\n\n/* ------------------------------------------------------------------ */\n/* Header */\n/* ------------------------------------------------------------------ */\n\nexport type PageHeaderProps = HTMLAttributes<HTMLDivElement> & {\n /**\n * Shows a divider once the content has scrolled under the header: on a desktop layout, and on a phone\n * with a `\"hard\"` or `\"glass\"` background.\n * Turn it off when the content already draws a line of its own at that place.\n * @default true\n */\n divider?: boolean\n /** How the bar meets the content scrolled under it on a phone. @default \"soft\" */\n background?: PageBarBackground\n ref?: Ref<HTMLDivElement>\n}\n\nfunction PageHeader({ divider = true, background = \"soft\", className, children, ref, ...restProps }: PageHeaderProps) {\n const { edges: { scrolled }, setHeaderHeight } = usePageContext(\"Header\")\n const element = useRef<HTMLDivElement | null>(null)\n const setRef = useCallback((node: HTMLDivElement | null) => {\n element.current = node\n if (typeof ref === \"function\") return ref(node)\n if (ref) ref.current = node\n }, [ref])\n useLayoutEffect(() => {\n const header = element.current\n if (!header) return\n const update = () => setHeaderHeight(header.offsetHeight)\n update()\n const observer = typeof ResizeObserver !== \"undefined\" ? new ResizeObserver(update) : undefined\n observer?.observe(header, { box: \"border-box\" })\n return () => { observer?.disconnect(); setHeaderHeight(undefined) }\n }, [setHeaderHeight])\n\n return (\n <div\n ref={setRef}\n className={clsx(s.Header, className)}\n data-background={background}\n data-scrolled={scrolled ? \"\" : undefined}\n data-divider={divider ? \"\" : undefined}\n {...restProps}\n >\n <div className={s.Head}>{children}</div>\n </div>\n )\n}\nPageHeader.displayName = \"Page.Header\"\n\n/* ------------------------------------------------------------------ */\n/* Slots */\n/* ------------------------------------------------------------------ */\n\nexport type PageSlotProps = HTMLAttributes<HTMLDivElement> & { ref?: Ref<HTMLDivElement> }\n\nfunction PageBar({ className, ref, ...restProps }: PageSlotProps) {\n const element = useRef<HTMLDivElement | null>(null)\n const setRef = useCallback((node: HTMLDivElement | null) => {\n element.current = node\n if (typeof ref === \"function\") return ref(node)\n if (ref) ref.current = node\n }, [ref])\n useLayoutEffect(() => {\n const bar = element.current\n if (!bar) return\n const sides = () => bar.querySelectorAll<HTMLElement>(`:scope > .${s.Leading}, :scope > .${s.Actions}`)\n const update = () => {\n const width = Math.max(44, ...Array.from(sides(), (side) => side.offsetWidth))\n bar.style.setProperty(\"--page-bar-side-width\", `${width}px`)\n }\n const observer = typeof ResizeObserver !== \"undefined\" ? new ResizeObserver(update) : undefined\n const observeSides = () => { observer?.disconnect(); sides().forEach((side) => observer?.observe(side, { box: \"border-box\" })); update() }\n observeSides()\n const children = new MutationObserver(observeSides)\n children.observe(bar, { childList: true })\n return () => { observer?.disconnect(); children.disconnect() }\n }, [])\n return <div ref={setRef} className={clsx(s.Bar, className)} {...restProps} />\n}\nPageBar.displayName = \"Page.Bar\"\n\nfunction PageLeading({ className, ...restProps }: PageSlotProps) {\n return <div className={clsx(s.Leading, className)} {...restProps} />\n}\nPageLeading.displayName = \"Page.Leading\"\n\nfunction PageHeading({ className, ...restProps }: PageSlotProps) {\n return <div className={clsx(s.Heading, className)} {...restProps} />\n}\nPageHeading.displayName = \"Page.Heading\"\n\nfunction PageTitle({\n className,\n ...restProps\n}: HTMLAttributes<HTMLHeadingElement> & { ref?: Ref<HTMLHeadingElement> }) {\n return <h1 className={clsx(s.Title, className)} {...restProps} />\n}\nPageTitle.displayName = \"Page.Title\"\n\nfunction PageSubtitle({ className, ...restProps }: PageSlotProps) {\n return <div className={clsx(s.Subtitle, className)} {...restProps} />\n}\nPageSubtitle.displayName = \"Page.Subtitle\"\n\nfunction PageActions({ className, ...restProps }: PageSlotProps) {\n return <div className={clsx(s.Actions, className)} {...restProps} />\n}\nPageActions.displayName = \"Page.Actions\"\n\n/* ------------------------------------------------------------------ */\n/* Content */\n/* ------------------------------------------------------------------ */\n\nexport type PageContentProps = HTMLAttributes<HTMLDivElement> & {\n /**\n * The content fills the page and scrolls inside itself, as a table does: the page stops\n * scrolling from 768px up.\n * @default false\n */\n fill?: boolean\n ref?: Ref<HTMLDivElement>\n}\n\nfunction PageContent({ fill = false, className, children, onScroll, ref, ...restProps }: PageContentProps) {\n const { setEdges, setScrollY, notifyScroll } = usePageContext(\"Content\")\n const element = useRef<HTMLDivElement | null>(null)\n const setRef = useCallback((node: HTMLDivElement | null) => {\n element.current = node\n if (typeof ref === \"function\") return ref(node)\n if (ref) ref.current = node\n }, [ref])\n useLayoutEffect(() => {\n const content = element.current\n if (!content) return\n const stop = observeScrollEdges(content, setEdges)\n return () => { stop(); setEdges(NO_SCROLL_EDGES) }\n }, [setEdges])\n\n const handleScroll = (event: UIEvent<HTMLDivElement>) => {\n setScrollY(event.currentTarget.scrollTop)\n notifyScroll(event.currentTarget.scrollTop)\n onScroll?.(event)\n }\n\n return (\n <div\n ref={setRef}\n className={clsx(s.Content, className)}\n data-fill={fill ? \"\" : undefined}\n onScroll={handleScroll}\n {...restProps}\n >\n <div className={s.Column}>{children}</div>\n </div>\n )\n}\nPageContent.displayName = \"Page.Content\"\n\nexport type PageFooterProps = PageSlotProps & {\n /** How the bar meets the content scrolled under it on a phone. @default \"soft\" */\n background?: PageBarBackground\n}\n\n/** Actions that remain below the scrolling content, inside the page's safe area. */\nfunction PageFooter({ className, children, background = \"soft\", ref, ...restProps }: PageFooterProps) {\n const element = useRef<HTMLDivElement | null>(null)\n const { edges: { contentBelow }, setFooterHeight } = usePageContext(\"Footer\")\n const setFloatingFooter = useFloatingBoundaryRegistration()?.setFooter\n const setRef = useCallback((node: HTMLDivElement | null) => {\n element.current = node\n setFloatingFooter?.(node)\n if (typeof ref === \"function\") {\n const cleanup = ref(node)\n if (typeof cleanup === \"function\") return () => { element.current = null; setFloatingFooter?.(null); cleanup() }\n return\n }\n if (ref) ref.current = node\n }, [ref, setFloatingFooter])\n useLayoutEffect(() => {\n const footer = element.current\n if (!footer) return\n const update = () => setFooterHeight(footer.offsetHeight)\n update()\n const observer = typeof ResizeObserver !== \"undefined\" ? new ResizeObserver(update) : undefined\n observer?.observe(footer, { box: \"border-box\" })\n return () => { observer?.disconnect(); setFooterHeight(0) }\n }, [setFooterHeight])\n return (\n <div\n ref={setRef}\n className={clsx(s.Footer, className)}\n data-background={background}\n data-content-below={contentBelow ? \"\" : undefined}\n {...restProps}\n >\n <div className={s.FooterContent}>{children}</div>\n </div>\n )\n}\nPageFooter.displayName = \"Page.Footer\"\n\n/* ------------------------------------------------------------------ */\n/* Compound */\n/* ------------------------------------------------------------------ */\n\nexport const Page = PageRoot as typeof PageRoot & {\n Header: typeof PageHeader\n Bar: typeof PageBar\n Leading: typeof PageLeading\n Heading: typeof PageHeading\n Title: typeof PageTitle\n Subtitle: typeof PageSubtitle\n Actions: typeof PageActions\n Content: typeof PageContent\n Footer: typeof PageFooter\n}\nPage.Header = PageHeader\nPage.Bar = PageBar\nPage.Leading = PageLeading\nPage.Heading = PageHeading\nPage.Title = PageTitle\nPage.Subtitle = PageSubtitle\nPage.Actions = PageActions\nPage.Content = PageContent\nPage.Footer = PageFooter\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Page/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,GAML,MAAM,QAAQ,CAAA","sourcesContent":["export {\n Page,\n type PageContentProps,\n type PageHeaderProps,\n type PageProps,\n type PageSlotProps,\n type PageWidth,\n} from \"./Page\"\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Page/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,GAQL,MAAM,QAAQ,CAAA","sourcesContent":["export {\n Page,\n type PageBarBackground,\n type PageFooterProps,\n type PageContentProps,\n type PageHeaderProps,\n type PageProps,\n type PageSlotProps,\n type PageWidth,\n} from \"./Page\"\n"]}
@@ -0,0 +1,146 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import clsx from "clsx";
4
+ import { useRef, useState } from "react";
5
+ import s from "@plexui/styles/components/PageControl/PageControl.module.css";
6
+ import { useLatestValue } from "../../hooks/useLatestValue.js";
7
+ /**
8
+ * The size of each indicator, after the variants of the iOS 26 kit Page control (507:24679). Up to six pages
9
+ * show full size. Seven show six, and the one past them at 6px. From eight a window of full dots holds the current
10
+ * page: six at either end, otherwise five with the current one in the middle, and the two dots past each side of
11
+ * the window shrink to 6px and 4px; the rest hide.
12
+ */
13
+ export const pageControlDots = (count, current) => {
14
+ const sizes = Array.from({ length: Math.max(0, count) }, () => "hidden");
15
+ const show = (from, to, size) => {
16
+ for (let i = Math.max(0, from); i <= Math.min(sizes.length - 1, to); i++)
17
+ sizes[i] = size;
18
+ };
19
+ if (count <= 6) {
20
+ show(0, count - 1, "full");
21
+ return sizes;
22
+ }
23
+ if (count === 7) {
24
+ const start = current >= 6 ? 1 : 0;
25
+ show(0, 6, "small");
26
+ show(start, start + 5, "full");
27
+ return sizes;
28
+ }
29
+ const [from, to] = current <= 3 ? [0, 5] : current >= count - 4 ? [count - 6, count - 1] : [current - 2, current + 2];
30
+ show(from - 2, from - 2, "smaller");
31
+ show(from - 1, from - 1, "small");
32
+ show(to + 1, to + 1, "small");
33
+ show(to + 2, to + 2, "smaller");
34
+ show(from, to, "full");
35
+ return sizes;
36
+ };
37
+ const clampIndex = (index, count) => Math.min(Math.max(index, 0), Math.max(0, count - 1));
38
+ const defaultValueText = (index, count) => `Page ${index + 1} of ${count}`;
39
+ /** A drag shorter than this is a tap. */
40
+ const SCRUB_THRESHOLD = 8;
41
+ const isRtl = (element) => element.closest("[dir]")?.getAttribute("dir") === "rtl";
42
+ /** Distance between the centers of two full dots: the dot size plus the gap. */
43
+ const pitchOf = (element) => {
44
+ const styles = getComputedStyle(element);
45
+ const pitch = parseFloat(styles.getPropertyValue("--page-control-dot-size")) + parseFloat(styles.columnGap);
46
+ return Number.isFinite(pitch) && pitch > 0 ? pitch : 16;
47
+ };
48
+ /**
49
+ * A row of dots, one for each page, the current one solid, as the iOS 26 page control. Tapping the leading or
50
+ * trailing side of the current dot shows the previous or next page; a mouse or pen picks a dot. Dragging across
51
+ * scrubs page by page, and past either end goes to the first or last page. It is a slider for assistive
52
+ * technology: Left and Right (or Up and Down) move one page, Home and End go to the first and last.
53
+ */
54
+ export function PageControl({ id, count, value: valueProp, defaultValue = 0, onChange, background = "automatic", valueText = defaultValueText, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-controls": ariaControls, onFocus, onBlur, className, }) {
55
+ const [internalValue, setInternalValue] = useState(defaultValue);
56
+ const current = clampIndex(valueProp ?? internalValue, count);
57
+ const currentRef = useLatestValue(current);
58
+ const onChangeRef = useLatestValue(onChange);
59
+ const press = useRef(null);
60
+ const [interacting, setInteracting] = useState(false);
61
+ const commit = (next, scrubbing) => {
62
+ const index = clampIndex(next, count);
63
+ if (index === currentRef.current)
64
+ return;
65
+ if (valueProp === undefined) {
66
+ currentRef.current = index;
67
+ setInternalValue(index);
68
+ }
69
+ onChangeRef.current?.(index, { scrubbing });
70
+ };
71
+ const end = () => {
72
+ press.current = null;
73
+ setInteracting(false);
74
+ };
75
+ const handlePointerDown = (event) => {
76
+ if (event.button !== 0 || count < 1)
77
+ return;
78
+ event.currentTarget.setPointerCapture?.(event.pointerId);
79
+ press.current = { pointerId: event.pointerId, pointerType: event.pointerType, startX: event.clientX, startIndex: current, scrubbing: false };
80
+ setInteracting(true);
81
+ };
82
+ const handlePointerMove = (event) => {
83
+ const state = press.current;
84
+ if (!state || state.pointerId !== event.pointerId || background === "minimal")
85
+ return;
86
+ const element = event.currentTarget;
87
+ const direction = isRtl(element) ? -1 : 1;
88
+ const dx = (event.clientX - state.startX) * direction;
89
+ if (!state.scrubbing && Math.abs(dx) < SCRUB_THRESHOLD)
90
+ return;
91
+ state.scrubbing = true;
92
+ const rect = element.getBoundingClientRect();
93
+ const before = direction === 1 ? event.clientX < rect.left : event.clientX > rect.right;
94
+ const after = direction === 1 ? event.clientX > rect.right : event.clientX < rect.left;
95
+ if (before)
96
+ return commit(0, true);
97
+ if (after)
98
+ return commit(count - 1, true);
99
+ commit(state.startIndex + Math.round(dx / pitchOf(element)), true);
100
+ };
101
+ const handlePointerUp = (event) => {
102
+ const state = press.current;
103
+ if (!state || state.pointerId !== event.pointerId)
104
+ return;
105
+ end();
106
+ if (state.scrubbing)
107
+ return;
108
+ const element = event.currentTarget;
109
+ const dots = [...element.querySelectorAll("[data-index]")].filter((dot) => dot.dataset.size !== "hidden");
110
+ const centerOf = (dot) => {
111
+ const rect = dot.getBoundingClientRect();
112
+ return rect.left + rect.width / 2;
113
+ };
114
+ if (state.pointerType === "mouse" || state.pointerType === "pen") {
115
+ const nearest = dots.reduce((best, dot) => !best || Math.abs(centerOf(dot) - event.clientX) < Math.abs(centerOf(best) - event.clientX) ? dot : best, undefined);
116
+ if (nearest)
117
+ commit(Number(nearest.dataset.index), false);
118
+ return;
119
+ }
120
+ const currentDot = dots.find((dot) => Number(dot.dataset.index) === currentRef.current);
121
+ if (!currentDot)
122
+ return;
123
+ const later = isRtl(element) ? event.clientX < centerOf(currentDot) : event.clientX > centerOf(currentDot);
124
+ commit(currentRef.current + (later ? 1 : -1), false);
125
+ };
126
+ const handleKeyDown = (event) => {
127
+ if (event.altKey || event.ctrlKey || event.metaKey)
128
+ return;
129
+ const forward = isRtl(event.currentTarget) ? -1 : 1;
130
+ const keys = {
131
+ ArrowRight: current + forward,
132
+ ArrowLeft: current - forward,
133
+ ArrowUp: current + 1,
134
+ ArrowDown: current - 1,
135
+ Home: 0,
136
+ End: count - 1,
137
+ };
138
+ const next = keys[event.key];
139
+ if (next === undefined)
140
+ return;
141
+ event.preventDefault();
142
+ commit(next, false);
143
+ };
144
+ return (_jsx("div", { id: id, role: "slider", tabIndex: 0, "aria-orientation": "horizontal", "aria-valuemin": 1, "aria-valuemax": Math.max(1, count), "aria-valuenow": current + 1, "aria-valuetext": valueText(current, count), "aria-label": ariaLabel ?? (ariaLabelledBy ? undefined : "Pages"), "aria-labelledby": ariaLabelledBy, "aria-controls": ariaControls, className: clsx(s.PageControl, className), "data-background": background, "data-interacting": interacting ? "" : undefined, onPointerDown: handlePointerDown, onPointerMove: handlePointerMove, onPointerUp: handlePointerUp, onPointerCancel: end, onLostPointerCapture: end, onKeyDown: handleKeyDown, onFocus: onFocus, onBlur: onBlur, children: pageControlDots(count, current).map((size, index) => (_jsx("span", { className: s.Dot, "aria-hidden": "true", "data-index": index, "data-size": size, "data-current": index === current ? "" : undefined }, index))) }));
145
+ }
146
+ //# sourceMappingURL=PageControl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PageControl.js","sourceRoot":"","sources":["../../../../src/components/PageControl/PageControl.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EAAiE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AACvG,OAAO,CAAC,MAAM,8DAA8D,CAAA;AAC5E,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AA0C3D;;;;;GAKG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,KAAa,EAAE,OAAe,EAAwB,EAAE;IACtF,MAAM,KAAK,GAAyB,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,CAAA;IAC9F,MAAM,IAAI,GAAG,CAAC,IAAY,EAAE,EAAU,EAAE,IAAwB,EAAE,EAAE;QAClE,KAAK,IAAI,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE;YAAE,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,CAAA;IAC3F,CAAC,CAAA;IACD,IAAI,KAAK,IAAI,CAAC,EAAE,CAAC;QACf,IAAI,CAAC,CAAC,EAAE,KAAK,GAAG,CAAC,EAAE,MAAM,CAAC,CAAA;QAC1B,OAAO,KAAK,CAAA;IACd,CAAC;IACD,IAAI,KAAK,KAAK,CAAC,EAAE,CAAC;QAChB,MAAM,KAAK,GAAG,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,C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IAED,OAAO,CACL,cACE,EAAE,EAAE,EAAE,EACN,IAAI,EAAC,QAAQ,EACb,QAAQ,EAAE,CAAC,sBACM,YAAY,mBACd,CAAC,mBACD,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,mBAClB,OAAO,GAAG,CAAC,oBACV,SAAS,CAAC,OAAO,EAAE,KAAK,CAAC,gBAC7B,SAAS,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,qBAC9C,cAAc,mBAChB,YAAY,EAC3B,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC,WAAW,EAAE,SAAS,CAAC,qBACxB,UAAU,sBACT,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,EAC9C,aAAa,EAAE,iBAAiB,EAChC,aAAa,EAAE,iBAAiB,EAChC,WAAW,EAAE,eAAe,EAC5B,eAAe,EAAE,GAAG,EACpB,oBAAoB,EAAE,GAAG,EACzB,SAAS,EAAE,aAAa,EACxB,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,MAAM,YAEb,eAAe,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CACpD,eAEE,SAAS,EAAE,CAAC,CAAC,GAAG,iBACJ,MAAM,gBACN,KAAK,eACN,IAAI,kBACD,KAAK,KAAK,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,IAL3C,KAAK,CAMV,CACH,CAAC,GACE,CACP,CAAA;AACH,CAAC","sourcesContent":["\"use client\"\n\nimport clsx from \"clsx\"\nimport { type FocusEventHandler, type KeyboardEvent, type PointerEvent, useRef, useState } from \"react\"\nimport s from \"@plexui/styles/components/PageControl/PageControl.module.css\"\nimport { useLatestValue } from \"../../hooks/useLatestValue\"\n\n/** How an indicator shows: full size, one of the two shrinking sizes past the window, or hidden. */\nexport type PageControlDotSize = \"full\" | \"small\" | \"smaller\" | \"hidden\"\n\nexport type PageControlChangeDetails = {\n /** The change came from scrubbing: show the page without the scrolling animation, as the HIG asks. */\n scrubbing: boolean\n}\n\nexport type PageControlProps = {\n /** The `id` of the page control. */\n id?: string\n /** The number of pages. */\n count: number\n /** The controlled index of the current page, from 0. Use with `onChange`. */\n value?: number\n /** The index of the page when it is initially rendered. Use when you do not need to control the page. @default 0 */\n defaultValue?: number\n /** Called with the index of the next page. */\n onChange?: (index: number, details: PageControlChangeDetails) => void\n /**\n * The rounded background behind the indicators: `automatic` shows it while a pointer presses or scrubs,\n * `prominent` always, `minimal` never and turns off scrubbing, as in iOS. @default \"automatic\"\n */\n background?: \"automatic\" | \"prominent\" | \"minimal\"\n /** The text assistive technology reads for the current page. @default (index, count) => `Page ${index + 1} of ${count}` */\n valueText?: (index: number, count: number) => string\n /** Accessible name of the page control, when no visible label names it. @default \"Pages\" */\n \"aria-label\"?: string\n /** The `id` of the visible label of the page control. */\n \"aria-labelledby\"?: string\n /** The `id` of the element that shows the pages. */\n \"aria-controls\"?: string\n /** Event handler called when the page control gains focus. */\n onFocus?: FocusEventHandler<HTMLDivElement>\n /** Event handler called when the page control loses focus. */\n onBlur?: FocusEventHandler<HTMLDivElement>\n /** CSS classes applied to the page control */\n className?: string\n}\n\n/**\n * The size of each indicator, after the variants of the iOS 26 kit Page control (507:24679). Up to six pages\n * show full size. Seven show six, and the one past them at 6px. From eight a window of full dots holds the current\n * page: six at either end, otherwise five with the current one in the middle, and the two dots past each side of\n * the window shrink to 6px and 4px; the rest hide.\n */\nexport const pageControlDots = (count: number, current: number): PageControlDotSize[] => {\n const sizes: PageControlDotSize[] = Array.from({ length: Math.max(0, count) }, () => \"hidden\")\n const show = (from: number, to: number, size: PageControlDotSize) => {\n for (let i = Math.max(0, from); i <= Math.min(sizes.length - 1, to); i++) sizes[i] = size\n }\n if (count <= 6) {\n show(0, count - 1, \"full\")\n return sizes\n }\n if (count === 7) {\n const start = current >= 6 ? 1 : 0\n show(0, 6, \"small\")\n show(start, start + 5, \"full\")\n return sizes\n }\n const [from, to] = current <= 3 ? [0, 5] : current >= count - 4 ? [count - 6, count - 1] : [current - 2, current + 2]\n show(from - 2, from - 2, \"smaller\")\n show(from - 1, from - 1, \"small\")\n show(to + 1, to + 1, \"small\")\n show(to + 2, to + 2, \"smaller\")\n show(from, to, \"full\")\n return sizes\n}\n\nconst clampIndex = (index: number, count: number) => Math.min(Math.max(index, 0), Math.max(0, count - 1))\nconst defaultValueText = (index: number, count: number) => `Page ${index + 1} of ${count}`\n/** A drag shorter than this is a tap. */\nconst SCRUB_THRESHOLD = 8\n\ntype Press = { pointerId: number; pointerType: string; startX: number; startIndex: number; scrubbing: boolean }\n\nconst isRtl = (element: HTMLElement) => element.closest(\"[dir]\")?.getAttribute(\"dir\") === \"rtl\"\n\n/** Distance between the centers of two full dots: the dot size plus the gap. */\nconst pitchOf = (element: HTMLElement) => {\n const styles = getComputedStyle(element)\n const pitch = parseFloat(styles.getPropertyValue(\"--page-control-dot-size\")) + parseFloat(styles.columnGap)\n return Number.isFinite(pitch) && pitch > 0 ? pitch : 16\n}\n\n/**\n * A row of dots, one for each page, the current one solid, as the iOS 26 page control. Tapping the leading or\n * trailing side of the current dot shows the previous or next page; a mouse or pen picks a dot. Dragging across\n * scrubs page by page, and past either end goes to the first or last page. It is a slider for assistive\n * technology: Left and Right (or Up and Down) move one page, Home and End go to the first and last.\n */\nexport function PageControl({\n id,\n count,\n value: valueProp,\n defaultValue = 0,\n onChange,\n background = \"automatic\",\n valueText = defaultValueText,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-controls\": ariaControls,\n onFocus,\n onBlur,\n className,\n}: PageControlProps) {\n const [internalValue, setInternalValue] = useState(defaultValue)\n const current = clampIndex(valueProp ?? internalValue, count)\n const currentRef = useLatestValue(current)\n const onChangeRef = useLatestValue(onChange)\n const press = useRef<Press | null>(null)\n const [interacting, setInteracting] = useState(false)\n\n const commit = (next: number, scrubbing: boolean) => {\n const index = clampIndex(next, count)\n if (index === currentRef.current) return\n if (valueProp === undefined) {\n currentRef.current = index\n setInternalValue(index)\n }\n onChangeRef.current?.(index, { scrubbing })\n }\n\n const end = () => {\n press.current = null\n setInteracting(false)\n }\n\n const handlePointerDown = (event: PointerEvent<HTMLDivElement>) => {\n if (event.button !== 0 || count < 1) return\n event.currentTarget.setPointerCapture?.(event.pointerId)\n press.current = { pointerId: event.pointerId, pointerType: event.pointerType, startX: event.clientX, startIndex: current, scrubbing: false }\n setInteracting(true)\n }\n\n const handlePointerMove = (event: PointerEvent<HTMLDivElement>) => {\n const state = press.current\n if (!state || state.pointerId !== event.pointerId || background === \"minimal\") return\n const element = event.currentTarget\n const direction = isRtl(element) ? -1 : 1\n const dx = (event.clientX - state.startX) * direction\n if (!state.scrubbing && Math.abs(dx) < SCRUB_THRESHOLD) return\n state.scrubbing = true\n const rect = element.getBoundingClientRect()\n const before = direction === 1 ? event.clientX < rect.left : event.clientX > rect.right\n const after = direction === 1 ? event.clientX > rect.right : event.clientX < rect.left\n if (before) return commit(0, true)\n if (after) return commit(count - 1, true)\n commit(state.startIndex + Math.round(dx / pitchOf(element)), true)\n }\n\n const handlePointerUp = (event: PointerEvent<HTMLDivElement>) => {\n const state = press.current\n if (!state || state.pointerId !== event.pointerId) return\n end()\n if (state.scrubbing) return\n const element = event.currentTarget\n const dots = [...element.querySelectorAll<HTMLElement>(\"[data-index]\")].filter((dot) => dot.dataset.size !== \"hidden\")\n const centerOf = (dot: HTMLElement) => {\n const rect = dot.getBoundingClientRect()\n return rect.left + rect.width / 2\n }\n if (state.pointerType === \"mouse\" || state.pointerType === \"pen\") {\n const nearest = dots.reduce<HTMLElement | undefined>((best, dot) =>\n !best || Math.abs(centerOf(dot) - event.clientX) < Math.abs(centerOf(best) - event.clientX) ? dot : best, undefined)\n if (nearest) commit(Number(nearest.dataset.index), false)\n return\n }\n const currentDot = dots.find((dot) => Number(dot.dataset.index) === currentRef.current)\n if (!currentDot) return\n const later = isRtl(element) ? event.clientX < centerOf(currentDot) : event.clientX > centerOf(currentDot)\n commit(currentRef.current + (later ? 1 : -1), false)\n }\n\n const handleKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n if (event.altKey || event.ctrlKey || event.metaKey) return\n const forward = isRtl(event.currentTarget) ? -1 : 1\n const keys: Record<string, number> = {\n ArrowRight: current + forward,\n ArrowLeft: current - forward,\n ArrowUp: current + 1,\n ArrowDown: current - 1,\n Home: 0,\n End: count - 1,\n }\n const next = keys[event.key]\n if (next === undefined) return\n event.preventDefault()\n commit(next, false)\n }\n\n return (\n <div\n id={id}\n role=\"slider\"\n tabIndex={0}\n aria-orientation=\"horizontal\"\n aria-valuemin={1}\n aria-valuemax={Math.max(1, count)}\n aria-valuenow={current + 1}\n aria-valuetext={valueText(current, count)}\n aria-label={ariaLabel ?? (ariaLabelledBy ? undefined : \"Pages\")}\n aria-labelledby={ariaLabelledBy}\n aria-controls={ariaControls}\n className={clsx(s.PageControl, className)}\n data-background={background}\n data-interacting={interacting ? \"\" : undefined}\n onPointerDown={handlePointerDown}\n onPointerMove={handlePointerMove}\n onPointerUp={handlePointerUp}\n onPointerCancel={end}\n onLostPointerCapture={end}\n onKeyDown={handleKeyDown}\n onFocus={onFocus}\n onBlur={onBlur}\n >\n {pageControlDots(count, current).map((size, index) => (\n <span\n key={index}\n className={s.Dot}\n aria-hidden=\"true\"\n data-index={index}\n data-size={size}\n data-current={index === current ? \"\" : undefined}\n />\n ))}\n </div>\n )\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export { PageControl, pageControlDots } from "./PageControl.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/PageControl/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,eAAe,EAAiF,MAAM,eAAe,CAAA","sourcesContent":["export { PageControl, pageControlDots, type PageControlChangeDetails, type PageControlDotSize, type PageControlProps } from \"./PageControl\"\n"]}
@@ -1,8 +1,14 @@
1
1
  "use client";
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import clsx from "clsx";
4
- import { Popover as RadixPopover } from "radix-ui";
5
- import { useCallback, useEffect, useMemo, useRef, useState, } from "react";
4
+ import { Portal, Slot } from "radix-ui";
5
+ import * as Popper from "@radix-ui/react-popper";
6
+ import { DismissableLayer } from "@radix-ui/react-dismissable-layer";
7
+ import { FocusScope, useFocusScopeBranch } from "@radix-ui/react-focus-scope";
8
+ import { useFocusGuards } from "@radix-ui/react-focus-guards";
9
+ import { useCallback, useEffect, useId, useMemo, useRef, useState, } from "react";
10
+ import { mergeRefs } from "react-merge-refs";
11
+ import { FieldColumnsContext, FieldRowContext } from "../../lib/fieldRow.js";
6
12
  import { useTimeout } from "usehooks-ts";
7
13
  import { useEscCloseStack } from "../../hooks/useEscCloseStack.js";
8
14
  import { useLatestValue } from "../../hooks/useLatestValue.js";
@@ -10,6 +16,8 @@ import { dataAttributes, focusableElements, keepMovedFocus, preventDefaultHandle
10
16
  import { TransitionGroup } from "../Transition/index.js";
11
17
  import { overlayTiming } from "../Transition/shared.js";
12
18
  import { createPointerIntentArea, isPointInPolygon } from "./pointerIntent.js";
19
+ import { isHoverPointer } from "../../lib/inputMode.js";
20
+ import { useDeferredOutsidePress } from "./deferredOutsidePress.js";
13
21
  import s from "@plexui/styles/components/Popover/Popover.module.css";
14
22
  import { PopoverContext, usePopoverContext } from "./usePopoverContext.js";
15
23
  export const Popover = ({ open: controlledOpen, onOpenChange: controlledOnOpenChange, showOnHover = false, hoverOpenDelay = 150, children, }) => {
@@ -21,6 +29,7 @@ export const Popover = ({ open: controlledOpen, onOpenChange: controlledOnOpenCh
21
29
  const hoverOpenFocusedWithTab = useRef(false);
22
30
  const isPointerInTransitRef = useRef(false);
23
31
  const isOpen = controlledOpen ?? open;
32
+ const contentId = useId();
24
33
  const [temporarilyPreventClickToClose, setTemporarilyPreventClickToClose] = useState(false);
25
34
  useTimeout(() => setTemporarilyPreventClickToClose(false), temporarilyPreventClickToClose ? 500 : null);
26
35
  const latestOpenChange = useLatestValue(controlledOnOpenChange);
@@ -63,6 +72,7 @@ export const Popover = ({ open: controlledOpen, onOpenChange: controlledOnOpenCh
63
72
  }, []);
64
73
  const store = useMemo(() => ({
65
74
  open: isOpen,
75
+ contentId,
66
76
  setOpen: handleOpenChange,
67
77
  shake,
68
78
  setShake,
@@ -76,6 +86,7 @@ export const Popover = ({ open: controlledOpen, onOpenChange: controlledOnOpenCh
76
86
  hoverOpenFocusedWithTab,
77
87
  }), [
78
88
  isOpen,
89
+ contentId,
79
90
  handleOpenChange,
80
91
  shake,
81
92
  setShake,
@@ -86,10 +97,10 @@ export const Popover = ({ open: controlledOpen, onOpenChange: controlledOnOpenCh
86
97
  handleTriggerEnter,
87
98
  handleTriggerLeave,
88
99
  ]);
89
- return (_jsx(PopoverContext, { value: store, children: _jsx(RadixPopover.Root, { open: isOpen, onOpenChange: handleOpenChange, modal: false, children: children }) }));
100
+ return (_jsx(PopoverContext, { value: store, children: _jsx(Popper.Root, { children: children }) }));
90
101
  };
91
102
  const Trigger = ({ children, onPointerDown, onClick, }) => {
92
- const { setOpen, showOnHover, temporarilyPreventClickToClose, onTriggerEnter, onTriggerLeave, isPointerInTransitRef, triggerRef, contentRef, } = usePopoverContext();
103
+ const { open, contentId, setOpen, showOnHover, temporarilyPreventClickToClose, onTriggerEnter, onTriggerLeave, isPointerInTransitRef, triggerRef, contentRef, } = usePopoverContext();
93
104
  const hasPointerMoveOpenedRef = useRef(false);
94
105
  const maybePreventClickClose = (evt) => {
95
106
  // Don't prevent temporary close if the trigger is an anchor tag itself
@@ -101,7 +112,7 @@ const Trigger = ({ children, onPointerDown, onClick, }) => {
101
112
  }
102
113
  };
103
114
  const handlePointerMove = (evt) => {
104
- if (evt.pointerType === "touch") {
115
+ if (!isHoverPointer(evt)) {
105
116
  return;
106
117
  }
107
118
  if (!hasPointerMoveOpenedRef.current && !isPointerInTransitRef.current) {
@@ -116,26 +127,51 @@ const Trigger = ({ children, onPointerDown, onClick, }) => {
116
127
  onTriggerLeave();
117
128
  hasPointerMoveOpenedRef.current = false;
118
129
  };
119
- return (_jsx(RadixPopover.Trigger, { asChild: true, ref: triggerRef, onPointerDown: (evt) => {
120
- maybePreventClickClose(evt);
121
- onPointerDown?.(evt);
122
- }, onClick: (evt) => {
123
- maybePreventClickClose(evt);
124
- onClick?.(evt);
125
- }, onPointerMove: showOnHover ? handlePointerMove : undefined, onPointerLeave: showOnHover ? handlePointerLeave : undefined, onFocus: showOnHover ? () => setOpen(true) : undefined, onBlur: showOnHover
126
- ? () => {
127
- setTimeout(() => {
128
- // Ignore this handler if focus has moved into the popover
129
- if (contentRef.current?.contains(document.activeElement)) {
130
- return;
131
- }
132
- setOpen(false);
133
- }, 50);
134
- }
135
- : undefined, children: children }));
130
+ return (_jsx(Popper.Anchor, { asChild: true, children: _jsx(Slot.Root, { type: "button", "aria-haspopup": "dialog", "aria-expanded": open, "aria-controls": open ? contentId : undefined, "data-state": open ? "open" : "closed", ref: triggerRef, onPointerDown: (evt) => {
131
+ maybePreventClickClose(evt);
132
+ onPointerDown?.(evt);
133
+ }, onClick: (evt) => {
134
+ maybePreventClickClose(evt);
135
+ onClick?.(evt);
136
+ if (!evt.defaultPrevented)
137
+ setOpen(!open);
138
+ }, onPointerMove: showOnHover ? handlePointerMove : undefined, onPointerLeave: showOnHover ? handlePointerLeave : undefined, onFocus: showOnHover ? () => setOpen(true) : undefined, onBlur: showOnHover
139
+ ? () => {
140
+ setTimeout(() => {
141
+ // Ignore this handler if focus has moved into the popover
142
+ if (contentRef.current?.contains(document.activeElement)) {
143
+ return;
144
+ }
145
+ setOpen(false);
146
+ }, 50);
147
+ }
148
+ : undefined, children: children }) }));
136
149
  };
137
- const ContentImpl = ({ children, avoidCollisions, width, minWidth, maxWidth, side, sideOffset = 8, align, alignOffset, translucent, className, autoFocus = true, ...restProps }) => {
138
- const { showOnHover, shake, contentRef } = usePopoverContext();
150
+ const ContentImpl = ({ children, avoidCollisions, collisionPadding = 20, width, minWidth, maxWidth, side, sideOffset = 8, align, alignOffset, translucent, className, autoFocus = true, ...restProps }) => {
151
+ const { showOnHover, shake, contentRef, contentId, triggerRef, setOpen, open } = usePopoverContext();
152
+ const [contentNode, setContentNode] = useState(null);
153
+ const contentMergedRef = useMemo(() => mergeRefs([contentRef, setContentNode]), [contentRef]);
154
+ const interactedOutside = useRef(false);
155
+ useFocusScopeBranch(contentNode);
156
+ useFocusGuards();
157
+ const outsidePress = useDeferredOutsidePress(() => {
158
+ interactedOutside.current = true;
159
+ setOpen(false);
160
+ }, triggerRef);
161
+ const { reset: resetOutsidePress } = outsidePress;
162
+ useEffect(() => { if (!open)
163
+ resetOutsidePress(); }, [open, resetOutsidePress]);
164
+ const handleCloseAutoFocus = (event) => {
165
+ if (showOnHover)
166
+ event.preventDefault();
167
+ else
168
+ keepMovedFocus(event);
169
+ if (!event.defaultPrevented) {
170
+ if (!interactedOutside.current)
171
+ triggerRef.current?.focus({ preventScroll: true });
172
+ event.preventDefault();
173
+ }
174
+ };
139
175
  const handleKeyDown = (evt) => {
140
176
  const contentElement = contentRef.current;
141
177
  if (
@@ -176,14 +212,16 @@ const ContentImpl = ({ children, avoidCollisions, width, minWidth, maxWidth, sid
176
212
  queueMicrotask(() => contentElement.focus({ preventScroll: true }));
177
213
  }
178
214
  }, [contentRef, showOnHover, autoFocus]);
179
- return (_jsx(RadixPopover.Content, { ...dataAttributes(restProps), forceMount: true, ref: contentRef, className: clsx(s.Popover, className), style: toCssVariables({
180
- "popover-width": width,
181
- "popover-min-width": minWidth,
182
- "popover-max-width": maxWidth,
183
- }), onCloseAutoFocus: showOnHover ? preventDefaultHandler : keepMovedFocus, "data-animate": shake ? "shake" : undefined, "data-translucent": translucent ? "true" : undefined, side: side, sideOffset: sideOffset, align: align, alignOffset: alignOffset ?? (align === "center" ? 0 : -5), avoidCollisions: avoidCollisions ?? true, hideWhenDetached: true, collisionPadding: 20, onOpenAutoFocus: preventDefaultHandler,
184
- // Use custom esc listener because default Radix is bound to the document
185
- // and cannot have propagation stopped.
186
- onEscapeKeyDown: preventDefaultHandler, onKeyDown: handleKeyDown, children: children }));
215
+ return (_jsx(FocusScope, { asChild: true, loop: true, onMountAutoFocus: preventDefaultHandler, onUnmountAutoFocus: handleCloseAutoFocus, children: _jsx(DismissableLayer, { asChild: true, onPointerDownOutside: outsidePress.onPointerDownOutside, onFocusOutside: outsidePress.onFocusOutside, onDismiss: () => { interactedOutside.current = true; setOpen(false); }, onEscapeKeyDown: preventDefaultHandler, children: _jsx(Popper.Content, { id: contentId, role: "dialog", "data-state": open ? "open" : "closed", ...dataAttributes(restProps), ref: contentMergedRef, className: clsx(s.Popover, className), style: toCssVariables({
216
+ "popover-width": width,
217
+ "popover-min-width": minWidth,
218
+ "popover-max-width": maxWidth,
219
+ "radix-popover-content-transform-origin": "var(--radix-popper-transform-origin)",
220
+ "radix-popover-content-available-width": "var(--radix-popper-available-width)",
221
+ "radix-popover-content-available-height": "var(--radix-popper-available-height)",
222
+ "radix-popover-trigger-width": "var(--radix-popper-anchor-width)",
223
+ "radix-popover-trigger-height": "var(--radix-popper-anchor-height)",
224
+ }), "data-animate": shake ? "shake" : undefined, "data-translucent": translucent ? "true" : undefined, side: side, sideOffset: sideOffset, align: align, alignOffset: alignOffset ?? (align === "center" ? 0 : -5), avoidCollisions: avoidCollisions ?? true, hideWhenDetached: true, collisionPadding: collisionPadding, onKeyDown: handleKeyDown, children: _jsx(FieldRowContext.Provider, { value: false, children: _jsx(FieldColumnsContext.Provider, { value: false, children: children }) }) }) }) }));
187
225
  };
188
226
  const ContentHoverable = (props) => {
189
227
  const { open, setOpen, triggerRef, contentRef, isPointerInTransitRef, hoverOpenFocusedWithTab } = usePopoverContext();
@@ -193,6 +231,8 @@ const ContentHoverable = (props) => {
193
231
  isPointerInTransitRef.current = false;
194
232
  }, [isPointerInTransitRef]);
195
233
  const handleCreateGraceArea = useCallback((event, hoverTarget) => {
234
+ if (!isHoverPointer(event))
235
+ return;
196
236
  const graceArea = createPointerIntentArea(event, hoverTarget);
197
237
  setPointerGraceArea(graceArea);
198
238
  isPointerInTransitRef.current = true;
@@ -220,6 +260,8 @@ const ContentHoverable = (props) => {
220
260
  return;
221
261
  }
222
262
  const handleTrackPointerGrace = (event) => {
263
+ if (!isHoverPointer(event))
264
+ return;
223
265
  const trigger = triggerRef.current;
224
266
  const content = contentRef.current;
225
267
  const target = event.target;
@@ -274,7 +316,7 @@ const Content = (props) => {
274
316
  useEscCloseStack(open, () => {
275
317
  setOpen(false);
276
318
  });
277
- return (_jsx(RadixPopover.Portal, { forceMount: true, children: _jsx(TransitionGroup, { ...overlayTiming, className: s.Transition, overlay: true, children: open &&
319
+ return (_jsx(Portal.Root, { asChild: true, children: _jsx(TransitionGroup, { ...overlayTiming, className: s.Transition, overlay: true, children: open &&
278
320
  (showOnHover ? (_jsx(ContentHoverable, { ...props }, "popover-hover")) : (_jsx(ContentImpl, { ...props }, "popover"))) }) }));
279
321
  };
280
322
  Popover.Trigger = Trigger;