@allxsmith/bestax-bulma 5.55.0 → 5.57.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 (369) hide show
  1. package/dist/bestax.css +1 -1
  2. package/dist/bestax.css.map +1 -1
  3. package/dist/esm/columns/Column.js +1 -0
  4. package/dist/esm/columns/Column.js.map +1 -1
  5. package/dist/esm/columns/Columns.js +1 -0
  6. package/dist/esm/columns/Columns.js.map +1 -1
  7. package/dist/esm/components/Avatar.js +1 -0
  8. package/dist/esm/components/Avatar.js.map +1 -1
  9. package/dist/esm/components/Avatars.js +1 -0
  10. package/dist/esm/components/Avatars.js.map +1 -1
  11. package/dist/esm/components/Badge.js +1 -0
  12. package/dist/esm/components/Badge.js.map +1 -1
  13. package/dist/esm/components/Breadcrumb.js +1 -0
  14. package/dist/esm/components/Breadcrumb.js.map +1 -1
  15. package/dist/esm/components/Card.js +1 -0
  16. package/dist/esm/components/Card.js.map +1 -1
  17. package/dist/esm/components/Carousel.js +1 -0
  18. package/dist/esm/components/Carousel.js.map +1 -1
  19. package/dist/esm/components/Collapse.js +1 -0
  20. package/dist/esm/components/Collapse.js.map +1 -1
  21. package/dist/esm/components/Collapses.js +1 -0
  22. package/dist/esm/components/Collapses.js.map +1 -1
  23. package/dist/esm/components/Command.js +1 -0
  24. package/dist/esm/components/Command.js.map +1 -1
  25. package/dist/esm/components/ContextMenu.js +1 -0
  26. package/dist/esm/components/ContextMenu.js.map +1 -1
  27. package/dist/esm/components/DataTable.js +1 -0
  28. package/dist/esm/components/DataTable.js.map +1 -1
  29. package/dist/esm/components/Dialog.js +1 -0
  30. package/dist/esm/components/Dialog.js.map +1 -1
  31. package/dist/esm/components/Dropdown.js +1 -0
  32. package/dist/esm/components/Dropdown.js.map +1 -1
  33. package/dist/esm/components/EmptyState.js +1 -0
  34. package/dist/esm/components/EmptyState.js.map +1 -1
  35. package/dist/esm/components/HoverCard.js +1 -0
  36. package/dist/esm/components/HoverCard.js.map +1 -1
  37. package/dist/esm/components/Loading.js +1 -0
  38. package/dist/esm/components/Loading.js.map +1 -1
  39. package/dist/esm/components/Menu.js +1 -0
  40. package/dist/esm/components/Menu.js.map +1 -1
  41. package/dist/esm/components/Message.js +1 -0
  42. package/dist/esm/components/Message.js.map +1 -1
  43. package/dist/esm/components/Modal.js +1 -0
  44. package/dist/esm/components/Modal.js.map +1 -1
  45. package/dist/esm/components/Navbar.js +1 -0
  46. package/dist/esm/components/Navbar.js.map +1 -1
  47. package/dist/esm/components/Pagination.js +1 -0
  48. package/dist/esm/components/Pagination.js.map +1 -1
  49. package/dist/esm/components/Panel.js +1 -0
  50. package/dist/esm/components/Panel.js.map +1 -1
  51. package/dist/esm/components/Popover.js +1 -0
  52. package/dist/esm/components/Popover.js.map +1 -1
  53. package/dist/esm/components/Reveal.js +1 -0
  54. package/dist/esm/components/Reveal.js.map +1 -1
  55. package/dist/esm/components/ScrollArea.js +1 -0
  56. package/dist/esm/components/ScrollArea.js.map +1 -1
  57. package/dist/esm/components/SegmentedControl.js +1 -0
  58. package/dist/esm/components/SegmentedControl.js.map +1 -1
  59. package/dist/esm/components/Sidebar.js +1 -0
  60. package/dist/esm/components/Sidebar.js.map +1 -1
  61. package/dist/esm/components/Steps.js +1 -0
  62. package/dist/esm/components/Steps.js.map +1 -1
  63. package/dist/esm/components/Tabs.js +1 -0
  64. package/dist/esm/components/Tabs.js.map +1 -1
  65. package/dist/esm/components/Timeline.js +1 -0
  66. package/dist/esm/components/Timeline.js.map +1 -1
  67. package/dist/esm/components/Toast.js +1 -0
  68. package/dist/esm/components/Toast.js.map +1 -1
  69. package/dist/esm/components/Tooltip.js +1 -0
  70. package/dist/esm/components/Tooltip.js.map +1 -1
  71. package/dist/esm/components/TreeView.js +1 -0
  72. package/dist/esm/components/TreeView.js.map +1 -1
  73. package/dist/esm/components/collapsesContext.js +1 -0
  74. package/dist/esm/components/collapsesContext.js.map +1 -1
  75. package/dist/esm/components/useDataTable.js +28 -0
  76. package/dist/esm/components/useDataTable.js.map +1 -1
  77. package/dist/esm/elements/Block.js +1 -0
  78. package/dist/esm/elements/Block.js.map +1 -1
  79. package/dist/esm/elements/Box.js +1 -0
  80. package/dist/esm/elements/Box.js.map +1 -1
  81. package/dist/esm/elements/Button.js +1 -0
  82. package/dist/esm/elements/Button.js.map +1 -1
  83. package/dist/esm/elements/Buttons.js +1 -0
  84. package/dist/esm/elements/Buttons.js.map +1 -1
  85. package/dist/esm/elements/Code.js +1 -0
  86. package/dist/esm/elements/Code.js.map +1 -1
  87. package/dist/esm/elements/ColorSwatch.js +1 -0
  88. package/dist/esm/elements/ColorSwatch.js.map +1 -1
  89. package/dist/esm/elements/Content.js +1 -0
  90. package/dist/esm/elements/Content.js.map +1 -1
  91. package/dist/esm/elements/Delete.js +1 -0
  92. package/dist/esm/elements/Delete.js.map +1 -1
  93. package/dist/esm/elements/DescriptionList.js +1 -0
  94. package/dist/esm/elements/DescriptionList.js.map +1 -1
  95. package/dist/esm/elements/Divider.js +1 -0
  96. package/dist/esm/elements/Divider.js.map +1 -1
  97. package/dist/esm/elements/Emphasis.js +1 -0
  98. package/dist/esm/elements/Emphasis.js.map +1 -1
  99. package/dist/esm/elements/Figure.js +1 -0
  100. package/dist/esm/elements/Figure.js.map +1 -1
  101. package/dist/esm/elements/Icon.js +1 -0
  102. package/dist/esm/elements/Icon.js.map +1 -1
  103. package/dist/esm/elements/IconText.js +1 -0
  104. package/dist/esm/elements/IconText.js.map +1 -1
  105. package/dist/esm/elements/Image.js +1 -0
  106. package/dist/esm/elements/Image.js.map +1 -1
  107. package/dist/esm/elements/Kbd.js +1 -0
  108. package/dist/esm/elements/Kbd.js.map +1 -1
  109. package/dist/esm/elements/Link.js +1 -0
  110. package/dist/esm/elements/Link.js.map +1 -1
  111. package/dist/esm/elements/LinkButton.js +1 -0
  112. package/dist/esm/elements/LinkButton.js.map +1 -1
  113. package/dist/esm/elements/ListItem.js +1 -0
  114. package/dist/esm/elements/ListItem.js.map +1 -1
  115. package/dist/esm/elements/Loader.js +1 -0
  116. package/dist/esm/elements/Loader.js.map +1 -1
  117. package/dist/esm/elements/Notification.js +1 -0
  118. package/dist/esm/elements/Notification.js.map +1 -1
  119. package/dist/esm/elements/OrderedList.js +1 -0
  120. package/dist/esm/elements/OrderedList.js.map +1 -1
  121. package/dist/esm/elements/Paragraph.js +1 -0
  122. package/dist/esm/elements/Paragraph.js.map +1 -1
  123. package/dist/esm/elements/Pre.js +1 -0
  124. package/dist/esm/elements/Pre.js.map +1 -1
  125. package/dist/esm/elements/Progress.js +1 -0
  126. package/dist/esm/elements/Progress.js.map +1 -1
  127. package/dist/esm/elements/RingProgress.js +1 -0
  128. package/dist/esm/elements/RingProgress.js.map +1 -1
  129. package/dist/esm/elements/Skeleton.js +1 -0
  130. package/dist/esm/elements/Skeleton.js.map +1 -1
  131. package/dist/esm/elements/Span.js +1 -0
  132. package/dist/esm/elements/Span.js.map +1 -1
  133. package/dist/esm/elements/Strong.js +1 -0
  134. package/dist/esm/elements/Strong.js.map +1 -1
  135. package/dist/esm/elements/SubTitle.js +1 -0
  136. package/dist/esm/elements/SubTitle.js.map +1 -1
  137. package/dist/esm/elements/Table.js +1 -0
  138. package/dist/esm/elements/Table.js.map +1 -1
  139. package/dist/esm/elements/Tag.js +1 -0
  140. package/dist/esm/elements/Tag.js.map +1 -1
  141. package/dist/esm/elements/Tags.js +1 -0
  142. package/dist/esm/elements/Tags.js.map +1 -1
  143. package/dist/esm/elements/Tbody.js +1 -0
  144. package/dist/esm/elements/Tbody.js.map +1 -1
  145. package/dist/esm/elements/Td.js +1 -0
  146. package/dist/esm/elements/Td.js.map +1 -1
  147. package/dist/esm/elements/Tfoot.js +1 -0
  148. package/dist/esm/elements/Tfoot.js.map +1 -1
  149. package/dist/esm/elements/Th.js +1 -0
  150. package/dist/esm/elements/Th.js.map +1 -1
  151. package/dist/esm/elements/Thead.js +1 -0
  152. package/dist/esm/elements/Thead.js.map +1 -1
  153. package/dist/esm/elements/Title.js +1 -0
  154. package/dist/esm/elements/Title.js.map +1 -1
  155. package/dist/esm/elements/ToggleButton.js +1 -0
  156. package/dist/esm/elements/ToggleButton.js.map +1 -1
  157. package/dist/esm/elements/Tr.js +1 -0
  158. package/dist/esm/elements/Tr.js.map +1 -1
  159. package/dist/esm/elements/UnorderedList.js +1 -0
  160. package/dist/esm/elements/UnorderedList.js.map +1 -1
  161. package/dist/esm/elements/iconProps.js +1 -0
  162. package/dist/esm/elements/iconProps.js.map +1 -1
  163. package/dist/esm/form/Autocomplete.js +1 -0
  164. package/dist/esm/form/Autocomplete.js.map +1 -1
  165. package/dist/esm/form/Checkbox.js +1 -0
  166. package/dist/esm/form/Checkbox.js.map +1 -1
  167. package/dist/esm/form/CheckboxCard.js +1 -0
  168. package/dist/esm/form/CheckboxCard.js.map +1 -1
  169. package/dist/esm/form/Checkboxes.js +1 -0
  170. package/dist/esm/form/Checkboxes.js.map +1 -1
  171. package/dist/esm/form/ColorInput.js +69 -0
  172. package/dist/esm/form/ColorInput.js.map +1 -0
  173. package/dist/esm/form/ColorInputBase.js +199 -0
  174. package/dist/esm/form/ColorInputBase.js.map +1 -0
  175. package/dist/esm/form/ColorPicker.js +5 -20
  176. package/dist/esm/form/ColorPicker.js.map +1 -1
  177. package/dist/esm/form/Combobox.js +1 -0
  178. package/dist/esm/form/Combobox.js.map +1 -1
  179. package/dist/esm/form/Control.js +1 -0
  180. package/dist/esm/form/Control.js.map +1 -1
  181. package/dist/esm/form/DateInput.js +1 -0
  182. package/dist/esm/form/DateInput.js.map +1 -1
  183. package/dist/esm/form/DateInputBase.js +1 -0
  184. package/dist/esm/form/DateInputBase.js.map +1 -1
  185. package/dist/esm/form/DateRangeInput.js +1 -0
  186. package/dist/esm/form/DateRangeInput.js.map +1 -1
  187. package/dist/esm/form/DateRangeInputBase.js +1 -0
  188. package/dist/esm/form/DateRangeInputBase.js.map +1 -1
  189. package/dist/esm/form/DateTimeInput.js +1 -0
  190. package/dist/esm/form/DateTimeInput.js.map +1 -1
  191. package/dist/esm/form/DateTimeInputBase.js +1 -0
  192. package/dist/esm/form/DateTimeInputBase.js.map +1 -1
  193. package/dist/esm/form/Dropzone.js +1 -0
  194. package/dist/esm/form/Dropzone.js.map +1 -1
  195. package/dist/esm/form/Field.js +1 -0
  196. package/dist/esm/form/Field.js.map +1 -1
  197. package/dist/esm/form/Fieldset.js +1 -0
  198. package/dist/esm/form/Fieldset.js.map +1 -1
  199. package/dist/esm/form/File.js +1 -0
  200. package/dist/esm/form/File.js.map +1 -1
  201. package/dist/esm/form/FormContext.js +1 -0
  202. package/dist/esm/form/FormContext.js.map +1 -1
  203. package/dist/esm/form/Input.js +1 -0
  204. package/dist/esm/form/Input.js.map +1 -1
  205. package/dist/esm/form/InputBase.js +1 -0
  206. package/dist/esm/form/InputBase.js.map +1 -1
  207. package/dist/esm/form/Numberinput.js +1 -0
  208. package/dist/esm/form/Numberinput.js.map +1 -1
  209. package/dist/esm/form/PinInput.js +1 -0
  210. package/dist/esm/form/PinInput.js.map +1 -1
  211. package/dist/esm/form/Radio.js +1 -0
  212. package/dist/esm/form/Radio.js.map +1 -1
  213. package/dist/esm/form/RadioCard.js +1 -0
  214. package/dist/esm/form/RadioCard.js.map +1 -1
  215. package/dist/esm/form/Radios.js +1 -0
  216. package/dist/esm/form/Radios.js.map +1 -1
  217. package/dist/esm/form/Rate.js +1 -0
  218. package/dist/esm/form/Rate.js.map +1 -1
  219. package/dist/esm/form/Select.js +1 -0
  220. package/dist/esm/form/Select.js.map +1 -1
  221. package/dist/esm/form/SelectBase.js +1 -0
  222. package/dist/esm/form/SelectBase.js.map +1 -1
  223. package/dist/esm/form/Slider.js +1 -0
  224. package/dist/esm/form/Slider.js.map +1 -1
  225. package/dist/esm/form/Switch.js +1 -0
  226. package/dist/esm/form/Switch.js.map +1 -1
  227. package/dist/esm/form/Taginput.js +1 -0
  228. package/dist/esm/form/Taginput.js.map +1 -1
  229. package/dist/esm/form/TextArea.js +1 -0
  230. package/dist/esm/form/TextArea.js.map +1 -1
  231. package/dist/esm/form/TextAreaBase.js +1 -0
  232. package/dist/esm/form/TextAreaBase.js.map +1 -1
  233. package/dist/esm/form/TimeInput.js +1 -0
  234. package/dist/esm/form/TimeInput.js.map +1 -1
  235. package/dist/esm/form/TimeInputBase.js +1 -0
  236. package/dist/esm/form/TimeInputBase.js.map +1 -1
  237. package/dist/esm/form/_colorInternals/EyeDropperButton.js +41 -0
  238. package/dist/esm/form/_colorInternals/EyeDropperButton.js.map +1 -0
  239. package/dist/esm/form/_colorInternals/pickerState.js +5 -4
  240. package/dist/esm/form/_colorInternals/pickerState.js.map +1 -1
  241. package/dist/esm/form/_pickerInternals/Calendar.js +1 -0
  242. package/dist/esm/form/_pickerInternals/Calendar.js.map +1 -1
  243. package/dist/esm/form/_pickerInternals/PickerPopover.js +1 -0
  244. package/dist/esm/form/_pickerInternals/PickerPopover.js.map +1 -1
  245. package/dist/esm/form/_pickerInternals/TimeWheels.js +1 -0
  246. package/dist/esm/form/_pickerInternals/TimeWheels.js.map +1 -1
  247. package/dist/esm/form/_pickerInternals/useLocaleDefaults.js +1 -0
  248. package/dist/esm/form/_pickerInternals/useLocaleDefaults.js.map +1 -1
  249. package/dist/esm/form/_pickerInternals/useNativeMobilePicker.js +1 -0
  250. package/dist/esm/form/_pickerInternals/useNativeMobilePicker.js.map +1 -1
  251. package/dist/esm/form/_pickerInternals/useSegmentedEntry.js +1 -0
  252. package/dist/esm/form/_pickerInternals/useSegmentedEntry.js.map +1 -1
  253. package/dist/esm/form/controlLoading.js +1 -0
  254. package/dist/esm/form/controlLoading.js.map +1 -1
  255. package/dist/esm/form/groupFieldset.js +1 -0
  256. package/dist/esm/form/groupFieldset.js.map +1 -1
  257. package/dist/esm/form/useAutoLabelId.js +1 -0
  258. package/dist/esm/form/useAutoLabelId.js.map +1 -1
  259. package/dist/esm/grid/Cell.js +1 -0
  260. package/dist/esm/grid/Cell.js.map +1 -1
  261. package/dist/esm/grid/Grid.js +1 -0
  262. package/dist/esm/grid/Grid.js.map +1 -1
  263. package/dist/esm/helpers/ClientOnly.js +1 -0
  264. package/dist/esm/helpers/ClientOnly.js.map +1 -1
  265. package/dist/esm/helpers/Config.js +1 -0
  266. package/dist/esm/helpers/Config.js.map +1 -1
  267. package/dist/esm/helpers/LocaleProvider.js +1 -0
  268. package/dist/esm/helpers/LocaleProvider.js.map +1 -1
  269. package/dist/esm/helpers/Theme.js +1 -0
  270. package/dist/esm/helpers/Theme.js.map +1 -1
  271. package/dist/esm/helpers/flattenChildren.js +1 -0
  272. package/dist/esm/helpers/flattenChildren.js.map +1 -1
  273. package/dist/esm/helpers/inertProps.js +1 -0
  274. package/dist/esm/helpers/inertProps.js.map +1 -1
  275. package/dist/esm/helpers/localeFormat.js +1 -0
  276. package/dist/esm/helpers/localeFormat.js.map +1 -1
  277. package/dist/esm/helpers/overlayStack.js +1 -0
  278. package/dist/esm/helpers/overlayStack.js.map +1 -1
  279. package/dist/esm/helpers/portal.js +1 -0
  280. package/dist/esm/helpers/portal.js.map +1 -1
  281. package/dist/esm/helpers/scrollLock.js +1 -0
  282. package/dist/esm/helpers/scrollLock.js.map +1 -1
  283. package/dist/esm/helpers/statusRegion.js +1 -0
  284. package/dist/esm/helpers/statusRegion.js.map +1 -1
  285. package/dist/esm/helpers/typeahead.js +1 -0
  286. package/dist/esm/helpers/typeahead.js.map +1 -1
  287. package/dist/esm/helpers/useAnchoredPosition.js +1 -0
  288. package/dist/esm/helpers/useAnchoredPosition.js.map +1 -1
  289. package/dist/esm/helpers/useBulmaClasses.js +1 -0
  290. package/dist/esm/helpers/useBulmaClasses.js.map +1 -1
  291. package/dist/esm/helpers/useClientLayoutEffect.js +1 -0
  292. package/dist/esm/helpers/useClientLayoutEffect.js.map +1 -1
  293. package/dist/esm/helpers/useColorClasses.js +1 -0
  294. package/dist/esm/helpers/useColorClasses.js.map +1 -1
  295. package/dist/esm/helpers/useComboboxEngine.js +1 -0
  296. package/dist/esm/helpers/useComboboxEngine.js.map +1 -1
  297. package/dist/esm/helpers/useContextMenuTrigger.js +1 -0
  298. package/dist/esm/helpers/useContextMenuTrigger.js.map +1 -1
  299. package/dist/esm/helpers/useFlexboxClasses.js +1 -0
  300. package/dist/esm/helpers/useFlexboxClasses.js.map +1 -1
  301. package/dist/esm/helpers/useFocusTrap.js +1 -0
  302. package/dist/esm/helpers/useFocusTrap.js.map +1 -1
  303. package/dist/esm/helpers/useHoverOpen.js +1 -0
  304. package/dist/esm/helpers/useHoverOpen.js.map +1 -1
  305. package/dist/esm/helpers/useInertSiblings.js +1 -0
  306. package/dist/esm/helpers/useInertSiblings.js.map +1 -1
  307. package/dist/esm/helpers/useIsHydrated.js +1 -0
  308. package/dist/esm/helpers/useIsHydrated.js.map +1 -1
  309. package/dist/esm/helpers/useLatestRef.js +1 -0
  310. package/dist/esm/helpers/useLatestRef.js.map +1 -1
  311. package/dist/esm/helpers/useMenuKeys.js +1 -0
  312. package/dist/esm/helpers/useMenuKeys.js.map +1 -1
  313. package/dist/esm/helpers/useOtherClasses.js +1 -0
  314. package/dist/esm/helpers/useOtherClasses.js.map +1 -1
  315. package/dist/esm/helpers/useSpacingClasses.js +1 -0
  316. package/dist/esm/helpers/useSpacingClasses.js.map +1 -1
  317. package/dist/esm/helpers/useTreeView.js +1 -0
  318. package/dist/esm/helpers/useTreeView.js.map +1 -1
  319. package/dist/esm/helpers/useTypographyClasses.js +1 -0
  320. package/dist/esm/helpers/useTypographyClasses.js.map +1 -1
  321. package/dist/esm/helpers/useVisibilityClasses.js +1 -0
  322. package/dist/esm/helpers/useVisibilityClasses.js.map +1 -1
  323. package/dist/esm/layout/Container.js +1 -0
  324. package/dist/esm/layout/Container.js.map +1 -1
  325. package/dist/esm/layout/Footer.js +1 -0
  326. package/dist/esm/layout/Footer.js.map +1 -1
  327. package/dist/esm/layout/Hero.js +1 -0
  328. package/dist/esm/layout/Hero.js.map +1 -1
  329. package/dist/esm/layout/Level.js +1 -0
  330. package/dist/esm/layout/Level.js.map +1 -1
  331. package/dist/esm/layout/Media.js +1 -0
  332. package/dist/esm/layout/Media.js.map +1 -1
  333. package/dist/esm/layout/Section.js +1 -0
  334. package/dist/esm/layout/Section.js.map +1 -1
  335. package/dist/esm/layout/Splitter.js +1 -0
  336. package/dist/esm/layout/Splitter.js.map +1 -1
  337. package/dist/extras.css +1 -1
  338. package/dist/extras.css.map +1 -1
  339. package/dist/index.cjs +300 -22
  340. package/dist/index.cjs.map +1 -1
  341. package/dist/index.esm.js +2 -0
  342. package/dist/index.esm.js.map +1 -1
  343. package/dist/types/components/DataTable.d.ts +1 -1
  344. package/dist/types/components/useDataTable.d.ts +36 -0
  345. package/dist/types/form/ColorInput.d.ts +76 -0
  346. package/dist/types/form/ColorInputBase.d.ts +108 -0
  347. package/dist/types/form/ColorPicker.d.ts +5 -0
  348. package/dist/types/form/_colorInternals/EyeDropperButton.d.ts +8 -0
  349. package/dist/types/form/_colorInternals/pickerState.d.ts +7 -1
  350. package/dist/types/index.d.ts +4 -0
  351. package/dist/types-cjs/components/DataTable.d.ts +1 -1
  352. package/dist/types-cjs/components/useDataTable.d.ts +36 -0
  353. package/dist/types-cjs/form/ColorInput.d.ts +76 -0
  354. package/dist/types-cjs/form/ColorInputBase.d.ts +108 -0
  355. package/dist/types-cjs/form/ColorPicker.d.ts +5 -0
  356. package/dist/types-cjs/form/_colorInternals/EyeDropperButton.d.ts +8 -0
  357. package/dist/types-cjs/form/_colorInternals/pickerState.d.ts +7 -1
  358. package/dist/types-cjs/index.d.ts +4 -0
  359. package/dist/versions/bestax-no-dark-mode.css +1 -1
  360. package/dist/versions/bestax-no-dark-mode.css.map +1 -1
  361. package/dist/versions/bestax-no-helpers-prefixed.css +1 -1
  362. package/dist/versions/bestax-no-helpers-prefixed.css.map +1 -1
  363. package/dist/versions/bestax-no-helpers.css +1 -1
  364. package/dist/versions/bestax-no-helpers.css.map +1 -1
  365. package/dist/versions/bestax-prefixed.css +1 -1
  366. package/dist/versions/bestax-prefixed.css.map +1 -1
  367. package/package.json +2 -1
  368. package/src/scss/form/_colorinput.scss +109 -0
  369. package/src/scss/form/_index.scss +1 -0
@@ -1 +1 @@
1
- {"version":3,"file":"Pagination.js","sources":["../../../src/components/Pagination.tsx"],"sourcesContent":["import React from 'react';\nimport { classNames, usePrefixedClassNames } from '../helpers/classNames';\nimport { withSubComponents } from '../helpers/withSubComponents';\nimport {\n useBulmaClasses,\n BulmaClassesProps,\n validColors,\n} from '../helpers/useBulmaClasses';\nimport { warnDeprecatedColorProp } from '../helpers/colorDeprecations';\nimport { useNumberFormat } from '../helpers/localeFormat';\n\n/**\n * Props for the Pagination component.\n */\nexport interface PaginationProps\n extends\n React.HTMLAttributes<HTMLElement>,\n Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {\n /**\n * Color modifier for the pagination (renders `is-<color>`).\n *\n * Bulma ships no pagination color CSS, so this prop has never had a visual\n * effect for any value. Passing it logs a console warning in development.\n * Use `textColor` / `bgColor` instead.\n * @deprecated No `.pagination.is-<color>` CSS exists; the prop renders\n * unstyled and will be removed in the next major version.\n */\n color?:\n | 'primary'\n | 'link'\n | 'info'\n | 'success'\n | 'warning'\n | 'danger'\n | 'black'\n | 'dark'\n | 'light'\n | 'white';\n /** Text color helper. */\n textColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Background color helper. */\n bgColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Size modifier for the pagination. */\n size?: 'small' | 'medium' | 'large';\n /** Alignment for the pagination. */\n align?: 'centered' | 'right';\n /** Renders pagination with rounded corners. */\n rounded?: boolean;\n /**\n * The number of pages. Given `total` and no children, `Pagination` renders\n * the whole control itself: Previous, Next and a link for each page it\n * shows, with an ellipsis where it skips some. Given children, it renders\n * those as they are, and `total` and the other page props do nothing.\n */\n total?: number;\n /**\n * The page shown as current, counting from 1, when rendering from `total`.\n * Leave it out and `Pagination` keeps the page itself, starting at 1.\n */\n current?: number;\n /**\n * Called with the page chosen, when rendering from `total`. Choosing the\n * page already current doesn't call it.\n */\n onPageChange?: (page: number) => void;\n /** How many pages to show on each side of the current one, when rendering from `total`. */\n siblingCount?: number;\n /** How many pages to always show at the start and at the end, when rendering from `total`. */\n boundaryCount?: number;\n /** The Previous link's content, when rendering from `total`. */\n previousLabel?: React.ReactNode;\n /** The Next link's content, when rendering from `total`. */\n nextLabel?: React.ReactNode;\n /** Disables every link, when rendering from `total`. */\n disabled?: boolean;\n /**\n * The `href` for a page's link, when rendering from `total`, making each\n * one a real link (`page => '?page=' + page`). A click then calls\n * `onPageChange` and the browser follows the link too. Without it the\n * links have no `href`, act as buttons, and Enter or Space chooses a page.\n */\n getPageHref?: (page: number) => string;\n /**\n * The accessible name of a page's link, when rendering from `total`, since\n * its content is only the number (`page => 'Page ' + page` by default).\n * Inside a `LocaleProvider` with a `locale`, the number on the link, and\n * in the default name, is written the way that locale writes numbers, so\n * the name still holds the text on screen.\n */\n getPageLabel?: (page: number) => string;\n /** Additional CSS classes. */\n className?: string;\n /** Custom pagination content (usually subcomponents). */\n children?: React.ReactNode;\n}\n\n/** A page's number, or a run of pages left out. */\ntype PageItem = number | 'start-gap' | 'end-gap';\n\n/** A count read as a whole number from zero, or `fallback` when it's no number. */\nfunction whole(count: number, fallback: number): number {\n return Number.isFinite(count) ? Math.max(Math.floor(count), 0) : fallback;\n}\n\nfunction range(from: number, to: number): number[] {\n return Array.from({ length: Math.max(to - from + 1, 0) }, (_, i) => from + i);\n}\n\n/**\n * The pages to show for `current` of `total`: the first and last\n * `boundaries`, `siblings` on each side of the current one, and a gap for\n * each run left out. A gap of a single page shows that page instead, and the\n * window around the current page slides inward near either end, so the row\n * keeps its length as the page moves.\n */\nfunction pageItems(\n total: number,\n current: number,\n siblings: number,\n boundaries: number\n): PageItem[] {\n const windowSize = siblings * 2 + 1;\n // Every page fits in the room the boundary pages, the window and two gaps take.\n if (total <= boundaries * 2 + windowSize + 2) return range(1, total);\n const lowest = boundaries + 2;\n const highest = total - boundaries - 1;\n const start = Math.min(\n Math.max(current - siblings, lowest),\n highest - windowSize + 1\n );\n const end = start + windowSize - 1;\n const gap = (from: number, to: number, name: PageItem): PageItem[] =>\n to === from ? [from] : [name];\n return [\n ...range(1, boundaries),\n ...gap(boundaries + 1, start - 1, 'start-gap'),\n ...range(start, end),\n ...gap(end + 1, total - boundaries, 'end-gap'),\n ...range(total - boundaries + 1, total),\n ];\n}\n\n/**\n * Props for PaginationPrevious and PaginationNext components.\n */\nexport interface PaginationPreviousNextProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {\n /** Additional CSS classes. */\n className?: string;\n /** Whether previous/next is disabled. */\n disabled?: boolean;\n /** Button content. */\n children?: React.ReactNode;\n}\n\n/**\n * \"Previous\" navigation button.\n *\n * @function\n * @param {PaginationPreviousNextProps} props - Props for the PaginationPrevious component.\n * @returns {JSX.Element} The rendered previous button.\n */\nexport const PaginationPrevious: React.FC<PaginationPreviousNextProps> = ({\n className,\n disabled,\n children,\n ...props\n}) => (\n <a\n className={classNames(\n usePrefixedClassNames('pagination-previous', {\n 'is-disabled': disabled,\n }),\n className\n )}\n aria-disabled={disabled}\n tabIndex={disabled ? -1 : 0}\n {...props}\n onClick={\n disabled\n ? e => {\n e.preventDefault();\n e.stopPropagation();\n }\n : props.onClick\n }\n >\n {children}\n </a>\n);\n\n/**\n * \"Next\" navigation button.\n *\n * @function\n * @param {PaginationPreviousNextProps} props - Props for the PaginationNext component.\n * @returns {JSX.Element} The rendered next button.\n */\nexport const PaginationNext: React.FC<PaginationPreviousNextProps> = ({\n className,\n disabled,\n children,\n ...props\n}) => (\n <a\n className={classNames(\n usePrefixedClassNames('pagination-next', { 'is-disabled': disabled }),\n className\n )}\n aria-disabled={disabled}\n tabIndex={disabled ? -1 : 0}\n {...props}\n onClick={\n disabled\n ? e => {\n e.preventDefault();\n e.stopPropagation();\n }\n : props.onClick\n }\n >\n {children}\n </a>\n);\n\n/**\n * The `Pagination` component provides a flexible, composable Bulma pagination navigation for your Bulma React UI.\n *\n * @function\n * @param {PaginationProps} props - Props for the Pagination component.\n * @returns {JSX.Element} The rendered pagination.\n * @see {@link https://bulma.io/documentation/components/pagination/ | Bulma Pagination documentation}\n */\nconst PaginationComponent: React.FC<PaginationProps> = ({\n color,\n textColor,\n bgColor,\n size,\n align,\n rounded,\n total,\n current,\n onPageChange,\n siblingCount = 1,\n boundaryCount = 1,\n previousLabel = 'Previous',\n nextLabel = 'Next',\n disabled,\n getPageHref,\n getPageLabel,\n className,\n children,\n ...props\n}) => {\n const [kept, setKept] = React.useState(1);\n warnDeprecatedColorProp(\n 'Pagination',\n color,\n 'Use the textColor / bgColor helper props instead.'\n );\n\n const { bulmaHelperClasses, rest } = useBulmaClasses({\n color: textColor,\n backgroundColor: bgColor,\n ...props,\n });\n const formatNumber = useNumberFormat();\n\n // Generate Bulma classes with prefix\n const bulmaClasses = usePrefixedClassNames('pagination', {\n [`is-${color}`]: color,\n [`is-${size}`]: size,\n [`is-${align}`]: align,\n 'is-rounded': rounded,\n });\n\n const paginationClasses = classNames(\n bulmaClasses,\n bulmaHelperClasses,\n className\n );\n\n // A child that renders nothing (`{show && …}` when false) is no children.\n const fromTotal =\n total !== undefined && React.Children.toArray(children).length === 0;\n let content: React.ReactNode = children;\n if (fromTotal) {\n const pages = Number.isFinite(total) ? Math.max(Math.floor(total), 0) : 0;\n // A current page that's no number reads as the first.\n const page = Math.min(\n Math.max(whole(current ?? kept, 1), 1),\n Math.max(pages, 1)\n );\n const choose = (next: number) => {\n if (next === page) return;\n if (current === undefined) setKept(next);\n onPageChange?.(next);\n };\n /**\n * What a link to `target` is given, beside what it renders. With no\n * `getPageHref` it's a button; a link that's `off` goes nowhere.\n */\n const linkTo = (target: number, off: boolean) => ({\n href: off || !getPageHref ? undefined : getPageHref(target),\n role: getPageHref ? undefined : 'button',\n // A link that's off is disabled too, and the parts drop its clicks.\n onClick: () => choose(target),\n onKeyDown: getPageHref\n ? undefined\n : (e: React.KeyboardEvent<HTMLAnchorElement>) => {\n if (off || (e.key !== 'Enter' && e.key !== ' ')) return;\n e.preventDefault();\n choose(target);\n },\n });\n const atStart = disabled || page <= 1;\n const atEnd = disabled || page >= pages;\n content = (\n <>\n <PaginationPrevious disabled={atStart} {...linkTo(page - 1, atStart)}>\n {previousLabel}\n </PaginationPrevious>\n <PaginationNext disabled={atEnd} {...linkTo(page + 1, atEnd)}>\n {nextLabel}\n </PaginationNext>\n <PaginationList>\n {pageItems(\n pages,\n page,\n whole(siblingCount, 1),\n whole(boundaryCount, 1)\n ).map(item => {\n if (typeof item !== 'number') {\n return <PaginationEllipsis key={item} />;\n }\n const shown = formatNumber ? formatNumber(item) : item;\n return (\n <PaginationLink\n key={item}\n aria-label={getPageLabel ? getPageLabel(item) : `Page ${shown}`}\n active={item === page}\n disabled={disabled}\n {...linkTo(item, Boolean(disabled))}\n >\n {shown}\n </PaginationLink>\n );\n })}\n </PaginationList>\n </>\n );\n }\n\n return (\n <nav\n className={paginationClasses}\n role=\"navigation\"\n aria-label=\"pagination\"\n {...rest}\n >\n {content}\n </nav>\n );\n};\n\n/**\n * Props for the PaginationList component.\n */\nexport interface PaginationListProps\n extends\n React.HTMLAttributes<HTMLUListElement>,\n Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {\n /** Additional CSS classes. */\n className?: string;\n /** Text color for the list. */\n textColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Bulma color modifier for the list. */\n color?: 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger';\n /** Background color for the list. */\n bgColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** List items. */\n children?: React.ReactNode;\n}\n\n/**\n * Container for page links and ellipsis.\n *\n * @function\n * @param {PaginationListProps} props - Props for the PaginationList component.\n * @returns {JSX.Element} The rendered pagination list.\n */\nexport const PaginationList: React.FC<PaginationListProps> = ({\n className,\n textColor,\n bgColor,\n children,\n ...props\n}) => {\n const { bulmaHelperClasses, rest } = useBulmaClasses({\n color: textColor,\n backgroundColor: bgColor,\n ...props,\n });\n return (\n <ul\n className={classNames(\n usePrefixedClassNames('pagination-list'),\n bulmaHelperClasses,\n className\n )}\n {...rest}\n >\n {children}\n </ul>\n );\n};\n\n/**\n * Props for the PaginationLink component.\n */\nexport interface PaginationLinkProps\n extends\n React.AnchorHTMLAttributes<HTMLAnchorElement>,\n Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {\n /** Additional CSS classes. */\n className?: string;\n /** Bulma color modifier. */\n color?: 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger';\n /** Text color. */\n textColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Background color. */\n bgColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Whether the link is for the current page. */\n active?: boolean;\n /** Whether the link is disabled. */\n disabled?: boolean;\n /** Link content. */\n children?: React.ReactNode;\n}\n\n/**\n * Page number or navigation link.\n *\n * @function\n * @param {PaginationLinkProps} props - Props for the PaginationLink component.\n * @returns {JSX.Element} The rendered pagination link.\n */\nexport const PaginationLink: React.FC<PaginationLinkProps> = ({\n className,\n textColor,\n bgColor,\n active,\n disabled,\n onClick,\n children,\n ...props\n}) => {\n const { bulmaHelperClasses, rest } = useBulmaClasses({\n color: textColor,\n backgroundColor: bgColor,\n ...props,\n });\n\n const handleClick = (e: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => {\n if (disabled) {\n e.preventDefault();\n e.stopPropagation();\n return;\n }\n if (onClick) {\n onClick(e);\n }\n };\n\n return (\n <li>\n <a\n className={classNames(\n usePrefixedClassNames('pagination-link', {\n 'is-current': active,\n 'is-disabled': disabled,\n }),\n bulmaHelperClasses,\n className\n )}\n aria-current={active ? 'page' : undefined}\n aria-disabled={disabled}\n tabIndex={disabled ? -1 : 0}\n onClick={handleClick}\n {...rest}\n >\n {children}\n </a>\n </li>\n );\n};\n\n/**\n * Ellipsis separator.\n *\n * @function\n * @param {React.LiHTMLAttributes<HTMLLIElement>} props - Standard li props.\n * @returns {JSX.Element} The rendered ellipsis.\n */\nexport const PaginationEllipsis: React.FC<\n React.LiHTMLAttributes<HTMLLIElement>\n> = props => (\n <li>\n <span className={usePrefixedClassNames('pagination-ellipsis')} {...props}>\n &hellip;\n </span>\n </li>\n);\n\nexport const Pagination = withSubComponents(\n PaginationComponent,\n {\n Link: PaginationLink,\n List: PaginationList,\n Ellipsis: PaginationEllipsis,\n Previous: PaginationPrevious,\n Next: PaginationNext,\n },\n 'Pagination'\n);\n\nexport default Pagination;\n"],"names":["_jsx","_jsxs","_Fragment"],"mappings":";;;;;;;;;AAmGA;AACA,SAAS,KAAK,CAAC,KAAa,EAAE,QAAgB,EAAA;IAC5C,OAAO,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,GAAG,QAAQ;AAC3E;AAEA,SAAS,KAAK,CAAC,IAAY,EAAE,EAAU,EAAA;AACrC,IAAA,OAAO,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,IAAI,GAAG,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,IAAI,GAAG,CAAC,CAAC;AAC/E;AAEA;;;;;;AAMG;AACH,SAAS,SAAS,CAChB,KAAa,EACb,OAAe,EACf,QAAgB,EAChB,UAAkB,EAAA;AAElB,IAAA,MAAM,UAAU,GAAG,QAAQ,GAAG,CAAC,GAAG,CAAC;;IAEnC,IAAI,KAAK,IAAI,UAAU,GAAG,CAAC,GAAG,UAAU,GAAG,CAAC;AAAE,QAAA,OAAO,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC;AACpE,IAAA,MAAM,MAAM,GAAG,UAAU,GAAG,CAAC;AAC7B,IAAA,MAAM,OAAO,GAAG,KAAK,GAAG,UAAU,GAAG,CAAC;IACtC,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CACpB,IAAI,CAAC,GAAG,CAAC,OA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,KAAK;AACT,KAAA,CAAC;AAEF,IAAA,MAAM,WAAW,GAAG,CAAC,CAAkD,KAAI;QACzE,IAAI,QAAQ,EAAE;YACZ,CAAC,CAAC,cAAc,EAAE;YAClB,CAAC,CAAC,eAAe,EAAE;YACnB;QACF;QACA,IAAI,OAAO,EAAE;YACX,OAAO,CAAC,CAAC,CAAC;QACZ;AACF,IAAA,CAAC;IAED,QACEA,GAAA,CAAA,IAAA,EAAA,EAAA,QAAA,EACEA,GAAA,CAAA,GAAA,EAAA,EACE,SAAS,EAAE,UAAU,CACnB,qBAAqB,CAAC,iBAAiB,EAAE;AACvC,gBAAA,YAAY,EAAE,MAAM;AACpB,gBAAA,aAAa,EAAE,QAAQ;AACxB,aAAA,CAAC,EACF,kBAAkB,EAClB,SAAS,CACV,EAAA,cAAA,EACa,MAAM,GAAG,MAAM,GAAG,SAAS,EAAA,eAAA,EAC1B,QAAQ,EACvB,QAAQ,EAAE,QAAQ,GAAG,EAAE,GAAG,CAAC,EAC3B,OAAO,EAAE,WAAW,KAChB,IAAI,EAAA,QAAA,EAEP,QAAQ,EAAA,CACP,EAAA,CACD;AAET;AAEA;;;;;;AAMG;MACU,kBAAkB,GAE3B,KAAK,KACPA,GAAA,CAAA,IAAA,EAAA,EAAA,QAAA,EACEA,GAAA,CAAA,MAAA,EAAA,EAAM,SAAS,EAAE,qBAAqB,CAAC,qBAAqB,CAAC,KAAM,KAAK,EAAA,QAAA,EAAA,QAAA,EAAA,CAEjE,EAAA,CACJ;AAGA,MAAM,UAAU,GAAG,iBAAiB,CACzC,mBAAmB,EACnB;AACE,IAAA,IAAI,EAAE,cAAc;AACpB,IAAA,IAAI,EAAE,cAAc;AACpB,IAAA,QAAQ,EAAE,kBAAkB;AAC5B,IAAA,QAAQ,EAAE,kBAAkB;AAC5B,IAAA,IAAI,EAAE,cAAc;CACrB,EACD,YAAY;;"}
1
+ {"version":3,"file":"Pagination.js","sources":["../../../src/components/Pagination.tsx"],"sourcesContent":["import React from 'react';\nimport { classNames, usePrefixedClassNames } from '../helpers/classNames';\nimport { withSubComponents } from '../helpers/withSubComponents';\nimport {\n useBulmaClasses,\n BulmaClassesProps,\n validColors,\n} from '../helpers/useBulmaClasses';\nimport { warnDeprecatedColorProp } from '../helpers/colorDeprecations';\nimport { useNumberFormat } from '../helpers/localeFormat';\n\n/**\n * Props for the Pagination component.\n */\nexport interface PaginationProps\n extends\n React.HTMLAttributes<HTMLElement>,\n Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {\n /**\n * Color modifier for the pagination (renders `is-<color>`).\n *\n * Bulma ships no pagination color CSS, so this prop has never had a visual\n * effect for any value. Passing it logs a console warning in development.\n * Use `textColor` / `bgColor` instead.\n * @deprecated No `.pagination.is-<color>` CSS exists; the prop renders\n * unstyled and will be removed in the next major version.\n */\n color?:\n | 'primary'\n | 'link'\n | 'info'\n | 'success'\n | 'warning'\n | 'danger'\n | 'black'\n | 'dark'\n | 'light'\n | 'white';\n /** Text color helper. */\n textColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Background color helper. */\n bgColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Size modifier for the pagination. */\n size?: 'small' | 'medium' | 'large';\n /** Alignment for the pagination. */\n align?: 'centered' | 'right';\n /** Renders pagination with rounded corners. */\n rounded?: boolean;\n /**\n * The number of pages. Given `total` and no children, `Pagination` renders\n * the whole control itself: Previous, Next and a link for each page it\n * shows, with an ellipsis where it skips some. Given children, it renders\n * those as they are, and `total` and the other page props do nothing.\n */\n total?: number;\n /**\n * The page shown as current, counting from 1, when rendering from `total`.\n * Leave it out and `Pagination` keeps the page itself, starting at 1.\n */\n current?: number;\n /**\n * Called with the page chosen, when rendering from `total`. Choosing the\n * page already current doesn't call it.\n */\n onPageChange?: (page: number) => void;\n /** How many pages to show on each side of the current one, when rendering from `total`. */\n siblingCount?: number;\n /** How many pages to always show at the start and at the end, when rendering from `total`. */\n boundaryCount?: number;\n /** The Previous link's content, when rendering from `total`. */\n previousLabel?: React.ReactNode;\n /** The Next link's content, when rendering from `total`. */\n nextLabel?: React.ReactNode;\n /** Disables every link, when rendering from `total`. */\n disabled?: boolean;\n /**\n * The `href` for a page's link, when rendering from `total`, making each\n * one a real link (`page => '?page=' + page`). A click then calls\n * `onPageChange` and the browser follows the link too. Without it the\n * links have no `href`, act as buttons, and Enter or Space chooses a page.\n */\n getPageHref?: (page: number) => string;\n /**\n * The accessible name of a page's link, when rendering from `total`, since\n * its content is only the number (`page => 'Page ' + page` by default).\n * Inside a `LocaleProvider` with a `locale`, the number on the link, and\n * in the default name, is written the way that locale writes numbers, so\n * the name still holds the text on screen.\n */\n getPageLabel?: (page: number) => string;\n /** Additional CSS classes. */\n className?: string;\n /** Custom pagination content (usually subcomponents). */\n children?: React.ReactNode;\n}\n\n/** A page's number, or a run of pages left out. */\ntype PageItem = number | 'start-gap' | 'end-gap';\n\n/** A count read as a whole number from zero, or `fallback` when it's no number. */\nfunction whole(count: number, fallback: number): number {\n return Number.isFinite(count) ? Math.max(Math.floor(count), 0) : fallback;\n}\n\nfunction range(from: number, to: number): number[] {\n return Array.from({ length: Math.max(to - from + 1, 0) }, (_, i) => from + i);\n}\n\n/**\n * The pages to show for `current` of `total`: the first and last\n * `boundaries`, `siblings` on each side of the current one, and a gap for\n * each run left out. A gap of a single page shows that page instead, and the\n * window around the current page slides inward near either end, so the row\n * keeps its length as the page moves.\n */\nfunction pageItems(\n total: number,\n current: number,\n siblings: number,\n boundaries: number\n): PageItem[] {\n const windowSize = siblings * 2 + 1;\n // Every page fits in the room the boundary pages, the window and two gaps take.\n if (total <= boundaries * 2 + windowSize + 2) return range(1, total);\n const lowest = boundaries + 2;\n const highest = total - boundaries - 1;\n const start = Math.min(\n Math.max(current - siblings, lowest),\n highest - windowSize + 1\n );\n const end = start + windowSize - 1;\n const gap = (from: number, to: number, name: PageItem): PageItem[] =>\n to === from ? [from] : [name];\n return [\n ...range(1, boundaries),\n ...gap(boundaries + 1, start - 1, 'start-gap'),\n ...range(start, end),\n ...gap(end + 1, total - boundaries, 'end-gap'),\n ...range(total - boundaries + 1, total),\n ];\n}\n\n/**\n * Props for PaginationPrevious and PaginationNext components.\n */\nexport interface PaginationPreviousNextProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {\n /** Additional CSS classes. */\n className?: string;\n /** Whether previous/next is disabled. */\n disabled?: boolean;\n /** Button content. */\n children?: React.ReactNode;\n}\n\n/**\n * \"Previous\" navigation button.\n *\n * @function\n * @param {PaginationPreviousNextProps} props - Props for the PaginationPrevious component.\n * @returns {JSX.Element} The rendered previous button.\n */\nexport const PaginationPrevious: React.FC<PaginationPreviousNextProps> = ({\n className,\n disabled,\n children,\n ...props\n}) => (\n <a\n className={classNames(\n usePrefixedClassNames('pagination-previous', {\n 'is-disabled': disabled,\n }),\n className\n )}\n aria-disabled={disabled}\n tabIndex={disabled ? -1 : 0}\n {...props}\n onClick={\n disabled\n ? e => {\n e.preventDefault();\n e.stopPropagation();\n }\n : props.onClick\n }\n >\n {children}\n </a>\n);\n\n/**\n * \"Next\" navigation button.\n *\n * @function\n * @param {PaginationPreviousNextProps} props - Props for the PaginationNext component.\n * @returns {JSX.Element} The rendered next button.\n */\nexport const PaginationNext: React.FC<PaginationPreviousNextProps> = ({\n className,\n disabled,\n children,\n ...props\n}) => (\n <a\n className={classNames(\n usePrefixedClassNames('pagination-next', { 'is-disabled': disabled }),\n className\n )}\n aria-disabled={disabled}\n tabIndex={disabled ? -1 : 0}\n {...props}\n onClick={\n disabled\n ? e => {\n e.preventDefault();\n e.stopPropagation();\n }\n : props.onClick\n }\n >\n {children}\n </a>\n);\n\n/**\n * The `Pagination` component provides a flexible, composable Bulma pagination navigation for your Bulma React UI.\n *\n * @function\n * @param {PaginationProps} props - Props for the Pagination component.\n * @returns {JSX.Element} The rendered pagination.\n * @see {@link https://bulma.io/documentation/components/pagination/ | Bulma Pagination documentation}\n */\nconst PaginationComponent: React.FC<PaginationProps> = ({\n color,\n textColor,\n bgColor,\n size,\n align,\n rounded,\n total,\n current,\n onPageChange,\n siblingCount = 1,\n boundaryCount = 1,\n previousLabel = 'Previous',\n nextLabel = 'Next',\n disabled,\n getPageHref,\n getPageLabel,\n className,\n children,\n ...props\n}) => {\n const [kept, setKept] = React.useState(1);\n warnDeprecatedColorProp(\n 'Pagination',\n color,\n 'Use the textColor / bgColor helper props instead.'\n );\n\n const { bulmaHelperClasses, rest } = useBulmaClasses({\n color: textColor,\n backgroundColor: bgColor,\n ...props,\n });\n const formatNumber = useNumberFormat();\n\n // Generate Bulma classes with prefix\n const bulmaClasses = usePrefixedClassNames('pagination', {\n [`is-${color}`]: color,\n [`is-${size}`]: size,\n [`is-${align}`]: align,\n 'is-rounded': rounded,\n });\n\n const paginationClasses = classNames(\n bulmaClasses,\n bulmaHelperClasses,\n className\n );\n\n // A child that renders nothing (`{show && …}` when false) is no children.\n const fromTotal =\n total !== undefined && React.Children.toArray(children).length === 0;\n let content: React.ReactNode = children;\n if (fromTotal) {\n const pages = Number.isFinite(total) ? Math.max(Math.floor(total), 0) : 0;\n // A current page that's no number reads as the first.\n const page = Math.min(\n Math.max(whole(current ?? kept, 1), 1),\n Math.max(pages, 1)\n );\n const choose = (next: number) => {\n if (next === page) return;\n if (current === undefined) setKept(next);\n onPageChange?.(next);\n };\n /**\n * What a link to `target` is given, beside what it renders. With no\n * `getPageHref` it's a button; a link that's `off` goes nowhere.\n */\n const linkTo = (target: number, off: boolean) => ({\n href: off || !getPageHref ? undefined : getPageHref(target),\n role: getPageHref ? undefined : 'button',\n // A link that's off is disabled too, and the parts drop its clicks.\n onClick: () => choose(target),\n onKeyDown: getPageHref\n ? undefined\n : (e: React.KeyboardEvent<HTMLAnchorElement>) => {\n if (off || (e.key !== 'Enter' && e.key !== ' ')) return;\n e.preventDefault();\n choose(target);\n },\n });\n const atStart = disabled || page <= 1;\n const atEnd = disabled || page >= pages;\n content = (\n <>\n <PaginationPrevious disabled={atStart} {...linkTo(page - 1, atStart)}>\n {previousLabel}\n </PaginationPrevious>\n <PaginationNext disabled={atEnd} {...linkTo(page + 1, atEnd)}>\n {nextLabel}\n </PaginationNext>\n <PaginationList>\n {pageItems(\n pages,\n page,\n whole(siblingCount, 1),\n whole(boundaryCount, 1)\n ).map(item => {\n if (typeof item !== 'number') {\n return <PaginationEllipsis key={item} />;\n }\n const shown = formatNumber ? formatNumber(item) : item;\n return (\n <PaginationLink\n key={item}\n aria-label={getPageLabel ? getPageLabel(item) : `Page ${shown}`}\n active={item === page}\n disabled={disabled}\n {...linkTo(item, Boolean(disabled))}\n >\n {shown}\n </PaginationLink>\n );\n })}\n </PaginationList>\n </>\n );\n }\n\n return (\n <nav\n className={paginationClasses}\n role=\"navigation\"\n aria-label=\"pagination\"\n {...rest}\n >\n {content}\n </nav>\n );\n};\n\n/**\n * Props for the PaginationList component.\n */\nexport interface PaginationListProps\n extends\n React.HTMLAttributes<HTMLUListElement>,\n Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {\n /** Additional CSS classes. */\n className?: string;\n /** Text color for the list. */\n textColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Bulma color modifier for the list. */\n color?: 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger';\n /** Background color for the list. */\n bgColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** List items. */\n children?: React.ReactNode;\n}\n\n/**\n * Container for page links and ellipsis.\n *\n * @function\n * @param {PaginationListProps} props - Props for the PaginationList component.\n * @returns {JSX.Element} The rendered pagination list.\n */\nexport const PaginationList: React.FC<PaginationListProps> = ({\n className,\n textColor,\n bgColor,\n children,\n ...props\n}) => {\n const { bulmaHelperClasses, rest } = useBulmaClasses({\n color: textColor,\n backgroundColor: bgColor,\n ...props,\n });\n return (\n <ul\n className={classNames(\n usePrefixedClassNames('pagination-list'),\n bulmaHelperClasses,\n className\n )}\n {...rest}\n >\n {children}\n </ul>\n );\n};\n\n/**\n * Props for the PaginationLink component.\n */\nexport interface PaginationLinkProps\n extends\n React.AnchorHTMLAttributes<HTMLAnchorElement>,\n Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {\n /** Additional CSS classes. */\n className?: string;\n /** Bulma color modifier. */\n color?: 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger';\n /** Text color. */\n textColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Background color. */\n bgColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Whether the link is for the current page. */\n active?: boolean;\n /** Whether the link is disabled. */\n disabled?: boolean;\n /** Link content. */\n children?: React.ReactNode;\n}\n\n/**\n * Page number or navigation link.\n *\n * @function\n * @param {PaginationLinkProps} props - Props for the PaginationLink component.\n * @returns {JSX.Element} The rendered pagination link.\n */\nexport const PaginationLink: React.FC<PaginationLinkProps> = ({\n className,\n textColor,\n bgColor,\n active,\n disabled,\n onClick,\n children,\n ...props\n}) => {\n const { bulmaHelperClasses, rest } = useBulmaClasses({\n color: textColor,\n backgroundColor: bgColor,\n ...props,\n });\n\n const handleClick = (e: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => {\n if (disabled) {\n e.preventDefault();\n e.stopPropagation();\n return;\n }\n if (onClick) {\n onClick(e);\n }\n };\n\n return (\n <li>\n <a\n className={classNames(\n usePrefixedClassNames('pagination-link', {\n 'is-current': active,\n 'is-disabled': disabled,\n }),\n bulmaHelperClasses,\n className\n )}\n aria-current={active ? 'page' : undefined}\n aria-disabled={disabled}\n tabIndex={disabled ? -1 : 0}\n onClick={handleClick}\n {...rest}\n >\n {children}\n </a>\n </li>\n );\n};\n\n/**\n * Ellipsis separator.\n *\n * @function\n * @param {React.LiHTMLAttributes<HTMLLIElement>} props - Standard li props.\n * @returns {JSX.Element} The rendered ellipsis.\n */\nexport const PaginationEllipsis: React.FC<\n React.LiHTMLAttributes<HTMLLIElement>\n> = props => (\n <li>\n <span className={usePrefixedClassNames('pagination-ellipsis')} {...props}>\n &hellip;\n </span>\n </li>\n);\n\nexport const Pagination = withSubComponents(\n PaginationComponent,\n {\n Link: PaginationLink,\n List: PaginationList,\n Ellipsis: PaginationEllipsis,\n Previous: PaginationPrevious,\n Next: PaginationNext,\n },\n 'Pagination'\n);\n\nexport default Pagination;\n"],"names":["_jsx","_jsxs","_Fragment"],"mappings":";;;;;;;;;;AAmGA;AACA,SAAS,KAAK,CAAC,KAAa,EAAE,QAAgB,EAAA;IAC5C,OAAO,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,GAAG,QAAQ;AAC3E;AAEA,SAAS,KAAK,CAAC,IAAY,EAAE,EAAU,EAAA;AACrC,IAAA,OAAO,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,IAAI,GAAG,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,IAAI,GAAG,CAAC,CAAC;AAC/E;AAEA;;;;;;AAMG;AACH,SAAS,SAAS,CAChB,KAAa,EACb,OAAe,EACf,QAAgB,EAChB,UAAkB,EAAA;AAElB,IAAA,MAAM,UAAU,GAAG,QAAQ,GAAG,CAAC,GAAG,CAAC;;IAEnC,IAAI,KAAK,IAAI,UAAU,GAAG,CAAC,GAAG,UAAU,GAAG,CAAC;AAAE,QAAA,OAAO,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC;AACpE,IAAA,MAAM,MAAM,GAAG,UAAU,GAAG,CAAC;AAC7B,IAAA,MAAM,OAAO,GAAG,KAAK,GAAG,UAAU,GAAG,CAAC;IACtC,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CACpB,IAAI,CAAC,GAAG,CAAC,OAAO,GAAG,QAAQ,EAAE,MAAM,CAAC,EACpC,OAAO,GAAG,UAAU,GAAG,CAAC,CACzB;AACD,IAAA,MAAM,GAAG,GAAG,KAAK,GAAG,UAAU,GAAG,CAAC;IAClC,MAAM,GAAG,GAAG,CAAC,IAAY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ACA,IAAI,OAAO,EAAE;YACX,OAAO,CAAC,CAAC,CAAC;QACZ;AACF,IAAA,CAAC;IAED,QACEA,GAAA,CAAA,IAAA,EAAA,EAAA,QAAA,EACEA,GAAA,CAAA,GAAA,EAAA,EACE,SAAS,EAAE,UAAU,CACnB,qBAAqB,CAAC,iBAAiB,EAAE;AACvC,gBAAA,YAAY,EAAE,MAAM;AACpB,gBAAA,aAAa,EAAE,QAAQ;AACxB,aAAA,CAAC,EACF,kBAAkB,EAClB,SAAS,CACV,EAAA,cAAA,EACa,MAAM,GAAG,MAAM,GAAG,SAAS,EAAA,eAAA,EAC1B,QAAQ,EACvB,QAAQ,EAAE,QAAQ,GAAG,EAAE,GAAG,CAAC,EAC3B,OAAO,EAAE,WAAW,KAChB,IAAI,EAAA,QAAA,EAEP,QAAQ,EAAA,CACP,EAAA,CACD;AAET;AAEA;;;;;;AAMG;MACU,kBAAkB,GAE3B,KAAK,KACPA,GAAA,CAAA,IAAA,EAAA,EAAA,QAAA,EACEA,GAAA,CAAA,MAAA,EAAA,EAAM,SAAS,EAAE,qBAAqB,CAAC,qBAAqB,CAAC,KAAM,KAAK,EAAA,QAAA,EAAA,QAAA,EAAA,CAEjE,EAAA,CACJ;AAGA,MAAM,UAAU,GAAG,iBAAiB,CACzC,mBAAmB,EACnB;AACE,IAAA,IAAI,EAAE,cAAc;AACpB,IAAA,IAAI,EAAE,cAAc;AACpB,IAAA,QAAQ,EAAE,kBAAkB;AAC5B,IAAA,QAAQ,EAAE,kBAAkB;AAC5B,IAAA,IAAI,EAAE,cAAc;CACrB,EACD,YAAY;;"}
@@ -1,4 +1,5 @@
1
1
  /* @allxsmith/bestax-bulma — AI agents: see AGENTS.md in the package root, or https://bestax.io/llms.txt */
2
+ 'use client';
2
3
  import { jsx, jsxs } from 'react/jsx-runtime';
3
4
  import { classNames, usePrefixedClassNames } from '../helpers/classNames.js';
4
5
  import { withSubComponents } from '../helpers/withSubComponents.js';
@@ -1 +1 @@
1
- {"version":3,"file":"Panel.js","sources":["../../../src/components/Panel.tsx"],"sourcesContent":["import React from 'react';\nimport { classNames, usePrefixedClassNames } from '../helpers/classNames';\nimport { withSubComponents } from '../helpers/withSubComponents';\nimport { useBulmaClasses, BulmaClassesProps } from '../helpers/useBulmaClasses';\nimport {\n ANCHOR_ONLY_ATTRS,\n type AnchorOnlyAttributes,\n omitAttrs,\n} from '../helpers/anchorAttrs';\nimport type { ConstrainedPolymorphicComponentWithoutRef } from '../helpers/polymorphic';\nimport {\n Icon,\n IconChildrenProps,\n IconDeprecatedProps,\n IconNameProps,\n} from '../elements/Icon';\n\n/**\n * Props for the Panel component.\n */\nexport interface PanelProps\n extends\n React.HTMLAttributes<HTMLElement>,\n Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {\n /**\n * HTML element to render (default: `nav`). A `nav` is a `navigation`\n * landmark, which suits a panel of links; a panel that is not navigation\n * takes another tag. Bulma's own colored panels use `article`. A `section`\n * is a `region` landmark only once it has an accessible name, such as\n * `aria-labelledby` pointing at the `id` of its `Panel.Heading`.\n */\n as?: 'nav' | 'article' | 'section' | 'aside' | 'div';\n /** Bulma color modifier for the panel. */\n color?:\n | 'primary'\n | 'link'\n | 'info'\n | 'success'\n | 'warning'\n | 'danger'\n | 'black'\n | 'dark'\n | 'light'\n | 'white';\n /** Additional CSS classes. */\n className?: string;\n /** Panel content (usually includes subcomponents). */\n children?: React.ReactNode;\n}\n\n/**\n * Props for the PanelHeading component.\n */\nexport interface PanelHeadingProps extends React.HTMLAttributes<HTMLParagraphElement> {\n /** Additional CSS classes. */\n className?: string;\n /** Heading content. */\n children?: React.ReactNode;\n}\n\n/**\n * Props for the PanelTabs component.\n */\nexport interface PanelTabsProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Additional CSS classes. */\n className?: string;\n /** Tabs content. */\n children?: React.ReactNode;\n}\n\n/**\n * What `<label>` adds over the attributes every element has (`htmlFor` and\n * `form`), subtracted from React's types the way `AnchorOnlyAttributes` is, so\n * it grows when React's does.\n */\ntype LabelOnlyAttributes = Omit<\n React.LabelHTMLAttributes<HTMLLabelElement>,\n keyof React.HTMLAttributes<HTMLLabelElement>\n>;\n\n/**\n * The set withheld from a non-label `Panel.Block`, keyed so it stops compiling\n * until a label attribute React adds is named here.\n */\nconst STRIP_FROM_NON_LABEL: Readonly<Record<keyof LabelOnlyAttributes, true>> =\n {\n form: true,\n htmlFor: true,\n };\n\n/**\n * The set withheld from a non-anchor `Panel.Block`: the derived anchor-only\n * attributes plus `rel`, which React declares on every element, withheld the\n * way `Level.Item` and `Card.FooterItem` withhold it.\n */\nconst STRIP_FROM_NON_ANCHOR: Readonly<\n Record<keyof AnchorOnlyAttributes | 'rel', true>\n> = { ...ANCHOR_ONLY_ATTRS, rel: true };\n\n/** A `<div>` block takes neither set. */\nconst STRIP_FROM_DIV: Readonly<\n Record<keyof AnchorOnlyAttributes | 'rel' | keyof LabelOnlyAttributes, true>\n> = { ...STRIP_FROM_NON_ANCHOR, ...STRIP_FROM_NON_LABEL };\n\n/**\n * The elements a panel block may render as: the tags Bulma's panel markup\n * puts `.panel-block` on.\n */\nexport type PanelBlockElement = 'a' | 'div' | 'label';\n\n/**\n * The PanelBlock component's own props.\n */\nexport interface PanelBlockOwnProps {\n /** Additional CSS classes. */\n className?: string;\n /** Whether the block is active. */\n active?: boolean;\n /** Block content. */\n children?: React.ReactNode;\n}\n\n/**\n * Props for the PanelBlock component. Everything the block does not own\n * follows `as`: the anchor's attributes and an `HTMLAnchorElement`\n * `currentTarget` under the default `'a'`, `htmlFor` under `'label'`, and the\n * shared HTML attributes under any of them.\n *\n * The type parameter defaults to `'a'`, the element a block renders with no\n * `as`, rather than to the whole union the way `DropdownItemProps` does. Before\n * `as` existed this type was the anchor's attributes, so bare\n * `PanelBlockProps` stays exactly that, `href` and anchor-typed handlers\n * included. Write `PanelBlockProps<'div'>` or `PanelBlockProps<'label'>` for\n * the others.\n */\nexport type PanelBlockProps<T extends PanelBlockElement = 'a'> =\n PanelBlockOwnProps &\n Omit<React.ComponentPropsWithoutRef<T>, keyof PanelBlockOwnProps | 'as'> & {\n /**\n * HTML element to render (default: `a`). Bulma styles a `label` block\n * as clickable, like an `a`, and a `div` block as static content, such\n * as a table. The props follow the tag, so the anchor attributes\n * (`href`, `target`, `download` and the rest) are typed only on an `a`\n * and `htmlFor` only on a `label`; at runtime the block also drops them,\n * and `rel`, on the other tags. `Panel.CheckboxBlock`,\n * `Panel.InputBlock` and `Panel.ButtonBlock` render the usual `label`\n * and `div` blocks with their contents.\n */\n as?: T;\n };\n\n/**\n * The shape the implementation destructures. The public contract is the\n * generic `PanelBlockProps<T>` above, which the body cannot see through.\n */\ntype PanelBlockImplProps = PanelBlockOwnProps & {\n as?: PanelBlockElement;\n};\n\n/**\n * Props for the PanelIcon component.\n * Extends IconProps but uses 'panel-icon' as the container class.\n */\nexport type PanelIconProps =\n | Omit<IconNameProps, 'containerClassName'>\n | Omit<IconChildrenProps, 'containerClassName'>\n // `PanelIcon` spreads straight into `<Icon>`, so every member of `IconProps`\n // reaches it. Enumerating them by hand is what left the deprecated `icon`\n // path compiling on `Icon` and failing here, with an error naming `children`.\n | Omit<IconDeprecatedProps, 'containerClassName'>;\n\n/**\n * Props for the PanelInputBlock component.\n */\nexport interface PanelInputBlockProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Input value. */\n value?: string;\n /** Input change handler. */\n onChange?: React.ChangeEventHandler<HTMLInputElement>;\n /** Input placeholder. */\n placeholder?: string;\n /** Icon class for left icon (default 'fas fa-search'). */\n iconClassName?: string;\n}\n\n/**\n * Props for the PanelCheckboxBlock component.\n */\nexport interface PanelCheckboxBlockProps extends Omit<\n React.LabelHTMLAttributes<HTMLLabelElement>,\n 'onChange'\n> {\n /** Whether the checkbox is checked. */\n checked?: boolean;\n /** Checkbox change handler. */\n onChange?: React.ChangeEventHandler<HTMLInputElement>;\n /** Label/content. */\n children?: React.ReactNode;\n}\n\n/**\n * Props for the PanelButtonBlock component.\n */\nexport interface PanelButtonBlockProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n /** Button content. */\n children?: React.ReactNode;\n}\n\n/**\n * The `Panel` component implements Bulma's versatile panel block for React.\n *\n * @function\n * @param {PanelProps} props - Props for the Panel component.\n * @returns {JSX.Element} The rendered panel.\n * @see {@link https://bulma.io/documentation/components/panel/ | Bulma Panel documentation}\n */\nconst PanelComponent: React.FC<PanelProps> = ({\n as: Tag = 'nav',\n color,\n className,\n children,\n ...props\n}) => {\n const { bulmaHelperClasses, rest } = useBulmaClasses({\n color,\n ...props,\n });\n\n // Generate Bulma classes with prefix\n const bulmaClasses = usePrefixedClassNames('panel', {\n [`is-${color}`]: color,\n });\n\n const panelClasses = classNames(bulmaClasses, bulmaHelperClasses, className);\n\n return (\n <Tag className={panelClasses} {...rest}>\n {children}\n </Tag>\n );\n};\n\n/**\n * Main heading (renders as `<p class=\"panel-heading\">`)\n *\n * @function\n * @param {PanelHeadingProps} props - Props for the PanelHeading component.\n * @returns {JSX.Element} The rendered panel heading.\n */\nexport const PanelHeading: React.FC<PanelHeadingProps> = ({\n className,\n children,\n ...props\n}) => (\n <p\n className={classNames(usePrefixedClassNames('panel-heading'), className)}\n {...props}\n >\n {children}\n </p>\n);\n\n/**\n * Panel tabs (renders as `<p class=\"panel-tabs\">`)\n *\n * @function\n * @param {PanelTabsProps} props - Props for the PanelTabs component.\n * @returns {JSX.Element} The rendered panel tabs.\n */\nexport const PanelTabs: React.FC<PanelTabsProps> = ({\n className,\n children,\n ...props\n}) => (\n <p\n className={classNames(usePrefixedClassNames('panel-tabs'), className)}\n {...props}\n >\n {children}\n </p>\n);\n\n/**\n * Individual panel block (renders as `<a class=\"panel-block\">` unless `as` says otherwise)\n *\n * @function\n * @param {PanelBlockProps} props - Props for the PanelBlock component.\n * @returns {JSX.Element} The rendered panel block.\n */\nexport const PanelBlock = ((blockProps: PanelBlockProps) => {\n const {\n as: Tag = 'a',\n className,\n active,\n children,\n ...props\n } = blockProps as PanelBlockImplProps;\n const blockClasses = classNames(\n usePrefixedClassNames('panel-block', { 'is-active': active }),\n className\n );\n // The anchor's own attributes reach an `<a>` and nothing else, and the\n // label's a `<label>`; the sets above say which those are. The type already\n // keeps them off the other tags, so this is for a plain-JS caller, a loose\n // `{...props}` spread, and the genericity a wrapping HOC erases.\n const forwarded =\n Tag === 'a'\n ? omitAttrs(props, STRIP_FROM_NON_LABEL)\n : Tag === 'label'\n ? omitAttrs(props, STRIP_FROM_NON_ANCHOR)\n : omitAttrs(props, STRIP_FROM_DIV);\n return (\n <Tag className={blockClasses} {...forwarded}>\n {children}\n </Tag>\n );\n}) as ConstrainedPolymorphicComponentWithoutRef<\n PanelBlockOwnProps,\n PanelBlockElement,\n 'a'\n>;\n\n/**\n * Icon wrapper with panel styling (renders as `<span class=\"panel-icon\">`, containing an\n * `<i/>` when a `name` is given, or the custom node passed as `children`).\n * Accepts all Icon props (`name`, `variant`, `features`, etc.), or `children` for a custom node.\n *\n * @function\n * @param {PanelIconProps} props - Props for the PanelIcon component.\n * @returns {JSX.Element} The rendered panel icon.\n */\nexport const PanelIcon: React.FC<PanelIconProps> = ({\n className,\n ...props\n}) => (\n <Icon\n containerClassName={classNames(\n usePrefixedClassNames('panel-icon'),\n className\n )}\n {...props}\n />\n);\n\n/**\n * Search input with icon (renders as `<div class=\"panel-block\">`)\n *\n * @function\n * @param {PanelInputBlockProps} props - Props for the PanelInputBlock component.\n * @returns {JSX.Element} The rendered panel input block.\n */\nexport const PanelInputBlock: React.FC<PanelInputBlockProps> = ({\n value,\n onChange,\n placeholder,\n iconClassName = 'fas fa-search',\n ...props\n}) => {\n const inputClass = usePrefixedClassNames('input');\n\n return (\n <div className={usePrefixedClassNames('panel-block')} {...props}>\n <p className={usePrefixedClassNames('control', 'has-icons-left')}>\n <input\n className={inputClass}\n type=\"text\"\n placeholder={placeholder}\n value={value}\n onChange={onChange}\n />\n <span className={usePrefixedClassNames('icon', 'is-left')}>\n <i className={iconClassName} aria-hidden=\"true\"></i>\n </span>\n </p>\n </div>\n );\n};\n\n/**\n * Checkbox block (renders as `<label class=\"panel-block\">`)\n *\n * @function\n * @param {PanelCheckboxBlockProps} props - Props for the PanelCheckboxBlock component.\n * @returns {JSX.Element} The rendered panel checkbox block.\n */\nexport const PanelCheckboxBlock: React.FC<PanelCheckboxBlockProps> = ({\n checked,\n onChange,\n children,\n ...props\n}) => (\n <label className={usePrefixedClassNames('panel-block')} {...props}>\n <input type=\"checkbox\" checked={checked} onChange={onChange} />\n {children}\n </label>\n);\n\n/**\n * Call-to-action button (renders as `<div class=\"panel-block\"><button /></div>`)\n *\n * @function\n * @param {PanelButtonBlockProps} props - Props for the PanelButtonBlock component.\n * @returns {JSX.Element} The rendered panel button block.\n */\nexport const PanelButtonBlock: React.FC<PanelButtonBlockProps> = ({\n children,\n className,\n ...props\n}) => (\n <div className={usePrefixedClassNames('panel-block')}>\n <button\n className={classNames(\n usePrefixedClassNames(\n 'button',\n 'is-link',\n 'is-outlined',\n 'is-fullwidth'\n ),\n className\n )}\n {...props}\n >\n {children}\n </button>\n </div>\n);\n\nexport const Panel = withSubComponents(\n PanelComponent,\n {\n Heading: PanelHeading,\n Tabs: PanelTabs,\n Block: PanelBlock,\n Icon: PanelIcon,\n InputBlock: PanelInputBlock,\n CheckboxBlock: PanelCheckboxBlock,\n ButtonBlock: PanelButtonBlock,\n },\n 'Panel'\n);\n\nexport default Panel;\n"],"names":["STRIP_FROM_NON_ANCHOR","_jsx","_jsxs"],"mappings":";;;;;;;;AAgFA;;;AAGG;AACH,MAAM,oBAAoB,GACxB;AACE,IAAA,IAAI,EAAE,IAAI;AACV,IAAA,OAAO,EAAE,IAAI;CACd;AAEH;;;;AAIG;AACH,MAAMA,uBAAqB,GAEvB,EAAE,GAAG,iBAAiB,EAAE,GAAG,EAAE,IAAI,EAAE;AAEvC;AACA,MAAM,cAAc,GAEhB,EAAE,GAAGA,uBAAqB,EAAE,GAAG,oBAAoB,EAAE;AA0GzD;;;;;;;AAOG;AACH,MAAM,cA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"version":3,"file":"Panel.js","sources":["../../../src/components/Panel.tsx"],"sourcesContent":["import React from 'react';\nimport { classNames, usePrefixedClassNames } from '../helpers/classNames';\nimport { withSubComponents } from '../helpers/withSubComponents';\nimport { useBulmaClasses, BulmaClassesProps } from '../helpers/useBulmaClasses';\nimport {\n ANCHOR_ONLY_ATTRS,\n type AnchorOnlyAttributes,\n omitAttrs,\n} from '../helpers/anchorAttrs';\nimport type { ConstrainedPolymorphicComponentWithoutRef } from '../helpers/polymorphic';\nimport {\n Icon,\n IconChildrenProps,\n IconDeprecatedProps,\n IconNameProps,\n} from '../elements/Icon';\n\n/**\n * Props for the Panel component.\n */\nexport interface PanelProps\n extends\n React.HTMLAttributes<HTMLElement>,\n Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {\n /**\n * HTML element to render (default: `nav`). A `nav` is a `navigation`\n * landmark, which suits a panel of links; a panel that is not navigation\n * takes another tag. Bulma's own colored panels use `article`. A `section`\n * is a `region` landmark only once it has an accessible name, such as\n * `aria-labelledby` pointing at the `id` of its `Panel.Heading`.\n */\n as?: 'nav' | 'article' | 'section' | 'aside' | 'div';\n /** Bulma color modifier for the panel. */\n color?:\n | 'primary'\n | 'link'\n | 'info'\n | 'success'\n | 'warning'\n | 'danger'\n | 'black'\n | 'dark'\n | 'light'\n | 'white';\n /** Additional CSS classes. */\n className?: string;\n /** Panel content (usually includes subcomponents). */\n children?: React.ReactNode;\n}\n\n/**\n * Props for the PanelHeading component.\n */\nexport interface PanelHeadingProps extends React.HTMLAttributes<HTMLParagraphElement> {\n /** Additional CSS classes. */\n className?: string;\n /** Heading content. */\n children?: React.ReactNode;\n}\n\n/**\n * Props for the PanelTabs component.\n */\nexport interface PanelTabsProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Additional CSS classes. */\n className?: string;\n /** Tabs content. */\n children?: React.ReactNode;\n}\n\n/**\n * What `<label>` adds over the attributes every element has (`htmlFor` and\n * `form`), subtracted from React's types the way `AnchorOnlyAttributes` is, so\n * it grows when React's does.\n */\ntype LabelOnlyAttributes = Omit<\n React.LabelHTMLAttributes<HTMLLabelElement>,\n keyof React.HTMLAttributes<HTMLLabelElement>\n>;\n\n/**\n * The set withheld from a non-label `Panel.Block`, keyed so it stops compiling\n * until a label attribute React adds is named here.\n */\nconst STRIP_FROM_NON_LABEL: Readonly<Record<keyof LabelOnlyAttributes, true>> =\n {\n form: true,\n htmlFor: true,\n };\n\n/**\n * The set withheld from a non-anchor `Panel.Block`: the derived anchor-only\n * attributes plus `rel`, which React declares on every element, withheld the\n * way `Level.Item` and `Card.FooterItem` withhold it.\n */\nconst STRIP_FROM_NON_ANCHOR: Readonly<\n Record<keyof AnchorOnlyAttributes | 'rel', true>\n> = { ...ANCHOR_ONLY_ATTRS, rel: true };\n\n/** A `<div>` block takes neither set. */\nconst STRIP_FROM_DIV: Readonly<\n Record<keyof AnchorOnlyAttributes | 'rel' | keyof LabelOnlyAttributes, true>\n> = { ...STRIP_FROM_NON_ANCHOR, ...STRIP_FROM_NON_LABEL };\n\n/**\n * The elements a panel block may render as: the tags Bulma's panel markup\n * puts `.panel-block` on.\n */\nexport type PanelBlockElement = 'a' | 'div' | 'label';\n\n/**\n * The PanelBlock component's own props.\n */\nexport interface PanelBlockOwnProps {\n /** Additional CSS classes. */\n className?: string;\n /** Whether the block is active. */\n active?: boolean;\n /** Block content. */\n children?: React.ReactNode;\n}\n\n/**\n * Props for the PanelBlock component. Everything the block does not own\n * follows `as`: the anchor's attributes and an `HTMLAnchorElement`\n * `currentTarget` under the default `'a'`, `htmlFor` under `'label'`, and the\n * shared HTML attributes under any of them.\n *\n * The type parameter defaults to `'a'`, the element a block renders with no\n * `as`, rather than to the whole union the way `DropdownItemProps` does. Before\n * `as` existed this type was the anchor's attributes, so bare\n * `PanelBlockProps` stays exactly that, `href` and anchor-typed handlers\n * included. Write `PanelBlockProps<'div'>` or `PanelBlockProps<'label'>` for\n * the others.\n */\nexport type PanelBlockProps<T extends PanelBlockElement = 'a'> =\n PanelBlockOwnProps &\n Omit<React.ComponentPropsWithoutRef<T>, keyof PanelBlockOwnProps | 'as'> & {\n /**\n * HTML element to render (default: `a`). Bulma styles a `label` block\n * as clickable, like an `a`, and a `div` block as static content, such\n * as a table. The props follow the tag, so the anchor attributes\n * (`href`, `target`, `download` and the rest) are typed only on an `a`\n * and `htmlFor` only on a `label`; at runtime the block also drops them,\n * and `rel`, on the other tags. `Panel.CheckboxBlock`,\n * `Panel.InputBlock` and `Panel.ButtonBlock` render the usual `label`\n * and `div` blocks with their contents.\n */\n as?: T;\n };\n\n/**\n * The shape the implementation destructures. The public contract is the\n * generic `PanelBlockProps<T>` above, which the body cannot see through.\n */\ntype PanelBlockImplProps = PanelBlockOwnProps & {\n as?: PanelBlockElement;\n};\n\n/**\n * Props for the PanelIcon component.\n * Extends IconProps but uses 'panel-icon' as the container class.\n */\nexport type PanelIconProps =\n | Omit<IconNameProps, 'containerClassName'>\n | Omit<IconChildrenProps, 'containerClassName'>\n // `PanelIcon` spreads straight into `<Icon>`, so every member of `IconProps`\n // reaches it. Enumerating them by hand is what left the deprecated `icon`\n // path compiling on `Icon` and failing here, with an error naming `children`.\n | Omit<IconDeprecatedProps, 'containerClassName'>;\n\n/**\n * Props for the PanelInputBlock component.\n */\nexport interface PanelInputBlockProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Input value. */\n value?: string;\n /** Input change handler. */\n onChange?: React.ChangeEventHandler<HTMLInputElement>;\n /** Input placeholder. */\n placeholder?: string;\n /** Icon class for left icon (default 'fas fa-search'). */\n iconClassName?: string;\n}\n\n/**\n * Props for the PanelCheckboxBlock component.\n */\nexport interface PanelCheckboxBlockProps extends Omit<\n React.LabelHTMLAttributes<HTMLLabelElement>,\n 'onChange'\n> {\n /** Whether the checkbox is checked. */\n checked?: boolean;\n /** Checkbox change handler. */\n onChange?: React.ChangeEventHandler<HTMLInputElement>;\n /** Label/content. */\n children?: React.ReactNode;\n}\n\n/**\n * Props for the PanelButtonBlock component.\n */\nexport interface PanelButtonBlockProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n /** Button content. */\n children?: React.ReactNode;\n}\n\n/**\n * The `Panel` component implements Bulma's versatile panel block for React.\n *\n * @function\n * @param {PanelProps} props - Props for the Panel component.\n * @returns {JSX.Element} The rendered panel.\n * @see {@link https://bulma.io/documentation/components/panel/ | Bulma Panel documentation}\n */\nconst PanelComponent: React.FC<PanelProps> = ({\n as: Tag = 'nav',\n color,\n className,\n children,\n ...props\n}) => {\n const { bulmaHelperClasses, rest } = useBulmaClasses({\n color,\n ...props,\n });\n\n // Generate Bulma classes with prefix\n const bulmaClasses = usePrefixedClassNames('panel', {\n [`is-${color}`]: color,\n });\n\n const panelClasses = classNames(bulmaClasses, bulmaHelperClasses, className);\n\n return (\n <Tag className={panelClasses} {...rest}>\n {children}\n </Tag>\n );\n};\n\n/**\n * Main heading (renders as `<p class=\"panel-heading\">`)\n *\n * @function\n * @param {PanelHeadingProps} props - Props for the PanelHeading component.\n * @returns {JSX.Element} The rendered panel heading.\n */\nexport const PanelHeading: React.FC<PanelHeadingProps> = ({\n className,\n children,\n ...props\n}) => (\n <p\n className={classNames(usePrefixedClassNames('panel-heading'), className)}\n {...props}\n >\n {children}\n </p>\n);\n\n/**\n * Panel tabs (renders as `<p class=\"panel-tabs\">`)\n *\n * @function\n * @param {PanelTabsProps} props - Props for the PanelTabs component.\n * @returns {JSX.Element} The rendered panel tabs.\n */\nexport const PanelTabs: React.FC<PanelTabsProps> = ({\n className,\n children,\n ...props\n}) => (\n <p\n className={classNames(usePrefixedClassNames('panel-tabs'), className)}\n {...props}\n >\n {children}\n </p>\n);\n\n/**\n * Individual panel block (renders as `<a class=\"panel-block\">` unless `as` says otherwise)\n *\n * @function\n * @param {PanelBlockProps} props - Props for the PanelBlock component.\n * @returns {JSX.Element} The rendered panel block.\n */\nexport const PanelBlock = ((blockProps: PanelBlockProps) => {\n const {\n as: Tag = 'a',\n className,\n active,\n children,\n ...props\n } = blockProps as PanelBlockImplProps;\n const blockClasses = classNames(\n usePrefixedClassNames('panel-block', { 'is-active': active }),\n className\n );\n // The anchor's own attributes reach an `<a>` and nothing else, and the\n // label's a `<label>`; the sets above say which those are. The type already\n // keeps them off the other tags, so this is for a plain-JS caller, a loose\n // `{...props}` spread, and the genericity a wrapping HOC erases.\n const forwarded =\n Tag === 'a'\n ? omitAttrs(props, STRIP_FROM_NON_LABEL)\n : Tag === 'label'\n ? omitAttrs(props, STRIP_FROM_NON_ANCHOR)\n : omitAttrs(props, STRIP_FROM_DIV);\n return (\n <Tag className={blockClasses} {...forwarded}>\n {children}\n </Tag>\n );\n}) as ConstrainedPolymorphicComponentWithoutRef<\n PanelBlockOwnProps,\n PanelBlockElement,\n 'a'\n>;\n\n/**\n * Icon wrapper with panel styling (renders as `<span class=\"panel-icon\">`, containing an\n * `<i/>` when a `name` is given, or the custom node passed as `children`).\n * Accepts all Icon props (`name`, `variant`, `features`, etc.), or `children` for a custom node.\n *\n * @function\n * @param {PanelIconProps} props - Props for the PanelIcon component.\n * @returns {JSX.Element} The rendered panel icon.\n */\nexport const PanelIcon: React.FC<PanelIconProps> = ({\n className,\n ...props\n}) => (\n <Icon\n containerClassName={classNames(\n usePrefixedClassNames('panel-icon'),\n className\n )}\n {...props}\n />\n);\n\n/**\n * Search input with icon (renders as `<div class=\"panel-block\">`)\n *\n * @function\n * @param {PanelInputBlockProps} props - Props for the PanelInputBlock component.\n * @returns {JSX.Element} The rendered panel input block.\n */\nexport const PanelInputBlock: React.FC<PanelInputBlockProps> = ({\n value,\n onChange,\n placeholder,\n iconClassName = 'fas fa-search',\n ...props\n}) => {\n const inputClass = usePrefixedClassNames('input');\n\n return (\n <div className={usePrefixedClassNames('panel-block')} {...props}>\n <p className={usePrefixedClassNames('control', 'has-icons-left')}>\n <input\n className={inputClass}\n type=\"text\"\n placeholder={placeholder}\n value={value}\n onChange={onChange}\n />\n <span className={usePrefixedClassNames('icon', 'is-left')}>\n <i className={iconClassName} aria-hidden=\"true\"></i>\n </span>\n </p>\n </div>\n );\n};\n\n/**\n * Checkbox block (renders as `<label class=\"panel-block\">`)\n *\n * @function\n * @param {PanelCheckboxBlockProps} props - Props for the PanelCheckboxBlock component.\n * @returns {JSX.Element} The rendered panel checkbox block.\n */\nexport const PanelCheckboxBlock: React.FC<PanelCheckboxBlockProps> = ({\n checked,\n onChange,\n children,\n ...props\n}) => (\n <label className={usePrefixedClassNames('panel-block')} {...props}>\n <input type=\"checkbox\" checked={checked} onChange={onChange} />\n {children}\n </label>\n);\n\n/**\n * Call-to-action button (renders as `<div class=\"panel-block\"><button /></div>`)\n *\n * @function\n * @param {PanelButtonBlockProps} props - Props for the PanelButtonBlock component.\n * @returns {JSX.Element} The rendered panel button block.\n */\nexport const PanelButtonBlock: React.FC<PanelButtonBlockProps> = ({\n children,\n className,\n ...props\n}) => (\n <div className={usePrefixedClassNames('panel-block')}>\n <button\n className={classNames(\n usePrefixedClassNames(\n 'button',\n 'is-link',\n 'is-outlined',\n 'is-fullwidth'\n ),\n className\n )}\n {...props}\n >\n {children}\n </button>\n </div>\n);\n\nexport const Panel = withSubComponents(\n PanelComponent,\n {\n Heading: PanelHeading,\n Tabs: PanelTabs,\n Block: PanelBlock,\n Icon: PanelIcon,\n InputBlock: PanelInputBlock,\n CheckboxBlock: PanelCheckboxBlock,\n ButtonBlock: PanelButtonBlock,\n },\n 'Panel'\n);\n\nexport default Panel;\n"],"names":["STRIP_FROM_NON_ANCHOR","_jsx","_jsxs"],"mappings":";;;;;;;;;AAgFA;;;AAGG;AACH,MAAM,oBAAoB,GACxB;AACE,IAAA,IAAI,EAAE,IAAI;AACV,IAAA,OAAO,EAAE,IAAI;CACd;AAEH;;;;AAIG;AACH,MAAMA,uBAAqB,GAEvB,EAAE,GAAG,iBAAiB,EAAE,GAAG,EAAE,IAAI,EAAE;AAEvC;AACA,MAAM,cAAc,GAEhB,EAAE,GAAGA,uBAAqB,EAAE,GAAG,oBAAoB,EAAE;AA0GzD;;;;;;;AAOG;AACH,M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
@@ -1,4 +1,5 @@
1
1
  /* @allxsmith/bestax-bulma — AI agents: see AGENTS.md in the package root, or https://bestax.io/llms.txt */
2
+ 'use client';
2
3
  import { jsx, jsxs } from 'react/jsx-runtime';
3
4
  import { createContext, useContext, useRef, useId, useState, useCallback, useMemo, useEffect, cloneElement } from 'react';
4
5
  import { classNames, usePrefixedClassNames } from '../helpers/classNames.js';
@@ -1 +1 @@
1
- {"version":3,"file":"Popover.js","sources":["../../../src/components/Popover.tsx"],"sourcesContent":["import React, {\n cloneElement,\n createContext,\n useCallback,\n useContext,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { classNames, usePrefixedClassNames } from '../helpers/classNames';\nimport { useBulmaClasses, BulmaClassesProps } from '../helpers/useBulmaClasses';\nimport { withSubComponents } from '../helpers/withSubComponents';\nimport { Portal } from '../helpers/portal';\nimport { useIsHydrated } from '../helpers/useIsHydrated';\nimport { focusTabStop, useFocusTrap } from '../helpers/useFocusTrap';\nimport { marginGap, useAnchoredPosition } from '../helpers/useAnchoredPosition';\nimport { useClientLayoutEffect } from '../helpers/useClientLayoutEffect';\nimport { useLatestRef } from '../helpers/useLatestRef';\nimport { getDeepestActiveElement, isEventInside } from '../helpers/shadowDom';\nimport { buttonType } from '../helpers/buttonType';\nimport { warnOnce } from '../helpers/devWarnings';\nimport { Button, ButtonOwnProps } from '../elements/Button';\nimport type { PickerPosition } from '../form/_pickerInternals/pickerTypes';\n\n/**\n * Where the panel opens against its trigger: below (`bottom-*`) or above\n * (`top-*`), lined up with the trigger's left or right edge. `auto` picks the\n * one that keeps the panel in the viewport, preferring below and lined up on\n * the left. The same union the date and time pickers take.\n */\nexport type PopoverPosition = PickerPosition;\n\n/**\n * Props for the Popover component. `className`, `id`, the other HTML\n * attributes and the helper props land on the wrapper around the trigger,\n * not on the panel; `contentClassName` reaches the panel.\n * @extraProp {string} [className] - Additional classes for the wrapper around the trigger. The panel takes `contentClassName`.\n */\nexport interface PopoverProps\n extends\n Omit<React.HTMLAttributes<HTMLDivElement>, 'color' | 'children'>,\n Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {\n /**\n * The element that opens and closes the popover, such as a `Button`.\n * Popover gives it `aria-haspopup=\"dialog\"`, `aria-expanded`,\n * `aria-controls` while the panel is open, and click and key handlers that\n * run after its own (call `preventDefault()` in yours to keep the popover\n * from toggling). It has to be a single element that passes `onClick` and\n * `onKeyDown` to its DOM node. Enter and Space toggle a trigger the browser\n * doesn't click on its own, and an intrinsic element that isn't already a\n * control (a `<span>`) also gets `role=\"button\"` and `tabIndex={0}` unless\n * it sets them; a component that renders one has to take those itself.\n */\n trigger: React.ReactElement;\n /** The panel's content, usually `Popover.Header`, `Popover.Body` and `Popover.Footer`. */\n children?: React.ReactNode;\n /**\n * Controlled open state. When set, the trigger and every dismissal only\n * report through `onOpenChange`.\n */\n open?: boolean;\n /**\n * Initial open state when uncontrolled. Opening moves focus into the\n * panel, so a popover that starts open takes focus once the page loads.\n * @defaultValue false\n */\n defaultOpen?: boolean;\n /**\n * Called with the state asked for: `true` from the trigger opening it,\n * `false` from the trigger, `Popover.Close`, Escape or an outside\n * `pointerdown`. Fires in both controlled and uncontrolled use.\n */\n onOpenChange?: (open: boolean) => void;\n /**\n * Where the panel opens against the trigger.\n * @defaultValue 'bottom-left'\n */\n position?: PopoverPosition;\n /**\n * Render the panel through `Portal`, into the `portalContainer` a\n * `ConfigProvider` sets, `document.body` by default, fixed to the viewport,\n * so an ancestor's `overflow`, `transform` or stacking context can't clip\n * it. The panel then shows from the commit after hydration, never in server\n * markup. It is measured against the trigger when it opens and on resize\n * and scroll, so it doesn't follow content that changes size while it is\n * open. Theming variables set on an ancestor of the trigger reach it only\n * when its container is inside that ancestor.\n * @defaultValue false\n */\n appendToBody?: boolean;\n /**\n * Keep Tab and Shift+Tab inside the panel while it is open, as the ARIA\n * dialog pattern does for a non-modal dialog. Pointer focus leaves freely\n * and the page stays usable. With `false`, Tab moves past the panel and\n * the popover stays open. Focus moves into the panel on open and back to\n * the trigger on close either way.\n * @defaultValue true\n */\n trapFocus?: boolean;\n /**\n * Close on a `pointerdown` outside the trigger and the panel. Content the\n * panel renders through a portal (a nested `Popover`, a portaled picker)\n * still counts as inside.\n * @defaultValue true\n */\n closeOnClickOutside?: boolean;\n /**\n * Close on Escape while focus is in the panel or on the trigger. A dialog\n * nested in the panel, such as a date picker's calendar, takes its own\n * Escape first, and so does content that calls `preventDefault()` on it.\n * @defaultValue true\n */\n closeOnEscape?: boolean;\n /**\n * The panel's accessible name. Without it the panel is named by its\n * `Popover.Header`, and a development build warns when it has neither.\n */\n ariaLabel?: string;\n /** Additional classes for the panel (`.popover-content`). */\n contentClassName?: string;\n}\n\ninterface PopoverContextValue {\n /** The id `Popover.Header` takes, which names the panel. */\n titleId: string;\n /** Records a mounted `Popover.Header`; the returned function forgets it. */\n registerTitle: () => () => void;\n /** Asks the popover to close. */\n close: () => void;\n}\n\nconst PopoverContext = createContext<PopoverContextValue | null>(null);\n\n/** The trigger props Popover reads before replacing them. */\ninterface TriggerProps {\n onClick?: (event: React.MouseEvent<HTMLElement>) => void;\n onKeyDown?: (event: React.KeyboardEvent<HTMLElement>) => void;\n role?: string;\n tabIndex?: number;\n href?: unknown;\n}\n\n/** Intrinsic elements that are controls already, and keep their own role. */\nconst NATIVE_CONTROLS = new Set([\n 'button',\n 'input',\n 'select',\n 'textarea',\n 'summary',\n]);\n\n/**\n * Whether the browser answers this key on `el` itself, by clicking it or by\n * using the key as input, so the trigger's click handler covers it.\n */\nfunction handlesKeyItself(el: Element, key: string): boolean {\n if (NATIVE_CONTROLS.has(el.localName)) return true;\n return el.localName === 'a' && key === 'Enter' && el.hasAttribute('href');\n}\n\n/** The innermost dialog the event passed through, which is the one its Escape belongs to. */\nfunction nearestDialog(event: Event): EventTarget | null {\n return (\n event.composedPath().find(node => {\n const role = (node as Element).getAttribute?.('role');\n return role === 'dialog' || role === 'alertdialog';\n }) ?? null\n );\n}\n\n/**\n * The `Popover` component opens a panel of interactive content, such as a filter form or a set of share options, anchored to the element that toggles it.\n *\n * The panel is a non-modal `role=\"dialog\"`: focus moves into it on open\n * and returns to the trigger on close, while the rest of the page stays\n * reachable by pointer and assistive technology. For hover-only hints use\n * `Tooltip`, and for a list of actions use `Dropdown`.\n *\n * @function\n * @param {PopoverProps} props - Props for the Popover component.\n * @returns {JSX.Element} The trigger in its wrapper, and the panel while open.\n *\n * @example\n * <Popover trigger={<Button>Filters</Button>}>\n * <Popover.Header>Filter rows</Popover.Header>\n * <Popover.Body>…</Popover.Body>\n * <Popover.Footer>\n * <Popover.Close>Done</Popover.Close>\n * </Popover.Footer>\n * </Popover>\n */\nconst PopoverComponent: React.FC<PopoverProps> = ({\n trigger,\n children,\n open: controlledOpen,\n defaultOpen = false,\n onOpenChange,\n position = 'bottom-left',\n appendToBody = false,\n trapFocus = true,\n closeOnClickOutside = true,\n closeOnEscape = true,\n ariaLabel,\n className,\n contentClassName,\n ...props\n}) => {\n const { bulmaHelperClasses, rest } = useBulmaClasses(props);\n const rootRef = useRef<HTMLDivElement>(null);\n const panelRef = useRef<HTMLDivElement>(null);\n // The last pointerdown React saw inside the panel. React's tree includes\n // content the panel portals elsewhere, which the DOM path doesn't.\n const insidePointerRef = useRef<Event | null>(null);\n const baseId = useId();\n const panelId = `${baseId}-panel`;\n const titleId = `${baseId}-title`;\n\n const isControlled = controlledOpen !== undefined;\n const [internalOpen, setInternalOpen] = useState(defaultOpen);\n const isOpen = controlledOpen ?? internalOpen;\n\n const requestOpen = useCallback(\n (next: boolean) => {\n onOpenChange?.(next);\n if (!isControlled) setInternalOpen(next);\n },\n [isControlled, onOpenChange]\n );\n const close = useCallback(() => requestOpen(false), [requestOpen]);\n\n // A portaled panel has no server markup, so it only exists from the commit\n // after hydration. Everything that measures or focuses it waits for that.\n const hydrated = useIsHydrated();\n const panelMounted = isOpen && (hydrated || !appendToBody);\n\n const resolved = useAnchoredPosition(rootRef, panelRef, {\n active: panelMounted,\n position,\n fixed: appendToBody,\n // The gap comes from `--bulma-popover-offset` in the stylesheet, so the\n // coordinates leave it out and `auto` reads it off the panel.\n offset: 0,\n styledGap: marginGap,\n });\n\n // The trigger renders first inside the wrapper. Read when needed rather\n // than held, so a trigger that remounted is still the one found.\n const triggerNode = useCallback((): HTMLElement | null => {\n const first = rootRef.current?.firstElementChild;\n return first && first !== panelRef.current ? (first as HTMLElement) : null;\n }, []);\n const restoreFocusRef = useMemo(\n () => ({\n get current() {\n return triggerNode();\n },\n }),\n [triggerNode]\n );\n\n useFocusTrap(panelRef, {\n active: panelMounted && trapFocus,\n restoreFocus: restoreFocusRef,\n });\n\n // Without the trap, focus still arrives in the panel and goes back to the\n // trigger, on the trap's terms: only while the panel still holds it.\n useEffect(() => {\n const panel = panelRef.current;\n if (!panelMounted || trapFocus || !panel) return undefined;\n focusTabStop(panel);\n return () => {\n const doc = panel.ownerDocument;\n const now = getDeepestActiveElement(doc);\n if (!now || now === doc.body || panel.contains(now)) {\n triggerNode()?.focus();\n }\n };\n }, [panelMounted, trapFocus, triggerNode]);\n\n // Read when a press lands outside, so the listener stays put while `close`\n // changes identity, which it does with `onOpenChange`, and an inline one\n // changes on every render of the parent.\n const closeRef = useLatestRef(close);\n\n useEffect(() => {\n if (!panelMounted || !closeOnClickOutside) return undefined;\n const handlePointerDown = (e: PointerEvent) => {\n if (e === insidePointerRef.current || isEventInside(e, rootRef.current)) {\n return;\n }\n closeRef.current();\n };\n // The wrapper is on the page whenever the panel is. Its document, an\n // iframe's when the tree renders into one, is where presses land.\n const doc = (rootRef.current as HTMLDivElement).ownerDocument;\n doc.addEventListener('pointerdown', handlePointerDown);\n return () => doc.removeEventListener('pointerdown', handlePointerDown);\n }, [panelMounted, closeOnClickOutside, closeRef]);\n\n const handlePanelKeyDown = (e: React.KeyboardEvent<HTMLDivElement>) => {\n if (e.key !== 'Escape' || !closeOnEscape || e.defaultPrevented) return;\n // React bubbles the key here from portaled content as well, so a dialog\n // of its own on the way (a nested popover, a picker's calendar) owns it.\n const owner = nearestDialog(e.nativeEvent);\n if (owner && owner !== panelRef.current) return;\n e.preventDefault();\n close();\n };\n\n const triggerProps = trigger.props as TriggerProps;\n\n const handleTriggerClick = (e: React.MouseEvent<HTMLElement>) => {\n triggerProps.onClick?.(e);\n if (!e.defaultPrevented) requestOpen(!isOpen);\n };\n\n const handleTriggerKeyDown = (e: React.KeyboardEvent<HTMLElement>) => {\n triggerProps.onKeyDown?.(e);\n // A key on something inside the trigger is that element's to answer.\n if (e.defaultPrevented || e.target !== e.currentTarget) return;\n if (e.key === 'Escape') {\n if (isOpen && closeOnEscape) {\n e.preventDefault();\n close();\n }\n return;\n }\n if (e.key !== 'Enter' && e.key !== ' ') return;\n if (handlesKeyItself(e.currentTarget, e.key)) return;\n // Space would scroll the page; a held key repeats.\n e.preventDefault();\n if (!e.repeat) requestOpen(!isOpen);\n };\n\n const needsButtonRole =\n typeof trigger.type === 'string' &&\n !NATIVE_CONTROLS.has(trigger.type) &&\n !(trigger.type === 'a' && triggerProps.href != null);\n\n const clonedTrigger = cloneElement(\n trigger as React.ReactElement<Record<string, unknown>>,\n {\n ...(needsButtonRole\n ? {\n role: triggerProps.role ?? 'button',\n tabIndex: triggerProps.tabIndex ?? 0,\n }\n : {}),\n 'aria-haspopup': 'dialog',\n 'aria-expanded': isOpen,\n 'aria-controls': panelMounted ? panelId : undefined,\n onClick: handleTriggerClick,\n onKeyDown: handleTriggerKeyDown,\n }\n );\n\n const rootClasses = classNames(\n usePrefixedClassNames('popover', { 'is-active': isOpen }),\n bulmaHelperClasses,\n className\n );\n const panelClasses = classNames(\n usePrefixedClassNames('popover-content', {\n [`is-${resolved.position}`]: true,\n 'is-portal': appendToBody,\n }),\n contentClassName\n );\n\n return (\n // The ref after the spread: React 19 hands a function component a `ref`\n // prop like any other, and the wrapper has to stay ours.\n <div className={rootClasses} {...rest} ref={rootRef}>\n {clonedTrigger}\n {isOpen && (\n <Portal disabled={!appendToBody}>\n <PopoverPanel\n panelRef={panelRef}\n titleId={titleId}\n ariaLabel={ariaLabel}\n close={close}\n id={panelId}\n className={panelClasses}\n style={\n appendToBody\n ? {\n position: 'fixed',\n top: resolved.top,\n left: resolved.left,\n }\n : undefined\n }\n onKeyDown={handlePanelKeyDown}\n onPointerDownCapture={e => {\n insidePointerRef.current = e.nativeEvent;\n }}\n >\n {children}\n </PopoverPanel>\n </Portal>\n )}\n </div>\n );\n};\n\ninterface PopoverPanelProps extends React.HTMLAttributes<HTMLDivElement> {\n panelRef: React.RefObject<HTMLDivElement | null>;\n titleId: string;\n ariaLabel?: string;\n close: () => void;\n}\n\n/**\n * The open panel. It mounts with each opening, so it counts the\n * `Popover.Header`s inside it afresh every time.\n */\nfunction PopoverPanel({\n panelRef,\n titleId,\n ariaLabel,\n close,\n children,\n ...attrs\n}: PopoverPanelProps) {\n // Headers register in a layout effect, after this first render, and this\n // panel's own layout effect runs after theirs. Until then the panel assumes\n // it has one, so a panel that does is named from its first commit, before\n // focus moves in, and one that doesn't drops the reference before it paints.\n const [titlesCounted, setTitlesCounted] = useState(false);\n const [titleCount, setTitleCount] = useState(0);\n const registerTitle = useCallback(() => {\n setTitleCount(n => n + 1);\n return () => setTitleCount(n => n - 1);\n }, []);\n useClientLayoutEffect(() => {\n setTitlesCounted(true);\n }, []);\n const named = Boolean(ariaLabel) || titleCount > 0;\n\n useEffect(() => {\n if (titlesCounted && !named) {\n warnOnce(\n 'Popover:unnamed',\n '[bestax-bulma] <Popover> opened a panel with no accessible name. ' +\n 'Pass ariaLabel, or render a Popover.Header inside it.'\n );\n }\n }, [titlesCounted, named]);\n\n const context = useMemo(\n () => ({ titleId, registerTitle, close }),\n [titleId, registerTitle, close]\n );\n\n return (\n <PopoverContext.Provider value={context}>\n <div\n {...attrs}\n ref={panelRef}\n role=\"dialog\"\n aria-label={ariaLabel}\n aria-labelledby={\n !ariaLabel && (!titlesCounted || titleCount > 0) ? titleId : undefined\n }\n tabIndex={-1}\n >\n {children}\n </div>\n </PopoverContext.Provider>\n );\n}\n\n/**\n * Props for the Popover.Header component. Its `id` is the one the panel's\n * `aria-labelledby` names, so it isn't yours to set.\n */\nexport interface PopoverHeaderProps\n extends\n Omit<React.HTMLAttributes<HTMLDivElement>, 'color' | 'id'>,\n BulmaClassesProps {\n /** Additional CSS classes. */\n className?: string;\n}\n\n/**\n * The popover's title, which names the panel for assistive technology.\n *\n * @function\n * @param {PopoverHeaderProps} props - Props for the Popover.Header component.\n * @returns {JSX.Element} The header element.\n */\nexport const PopoverHeader: React.FC<PopoverHeaderProps> = ({\n className,\n ...props\n}) => {\n const context = useContext(PopoverContext);\n const registerTitle = context?.registerTitle;\n // Before paint, so the panel is named by the time it shows.\n useClientLayoutEffect(() => registerTitle?.(), [registerTitle]);\n const { bulmaHelperClasses, rest } = useBulmaClasses(props);\n return (\n <div\n className={classNames(\n usePrefixedClassNames('popover-header'),\n bulmaHelperClasses,\n className\n )}\n {...rest}\n id={context?.titleId}\n />\n );\n};\n\n/**\n * Props for the Popover.Body component.\n */\nexport interface PopoverBodyProps\n extends\n Omit<React.HTMLAttributes<HTMLDivElement>, 'color'>,\n BulmaClassesProps {\n /** Additional CSS classes. */\n className?: string;\n}\n\n/**\n * The popover's main content area.\n *\n * @function\n * @param {PopoverBodyProps} props - Props for the Popover.Body component.\n * @returns {JSX.Element} The body element.\n */\nexport const PopoverBody: React.FC<PopoverBodyProps> = ({\n className,\n ...props\n}) => {\n const { bulmaHelperClasses, rest } = useBulmaClasses(props);\n return (\n <div\n className={classNames(\n usePrefixedClassNames('popover-body'),\n bulmaHelperClasses,\n className\n )}\n {...rest}\n />\n );\n};\n\n/**\n * Props for the Popover.Footer component.\n */\nexport interface PopoverFooterProps\n extends\n Omit<React.HTMLAttributes<HTMLDivElement>, 'color'>,\n BulmaClassesProps {\n /** Additional CSS classes. */\n className?: string;\n}\n\n/**\n * A row of actions along the bottom of the popover, aligned to the end.\n *\n * @function\n * @param {PopoverFooterProps} props - Props for the Popover.Footer component.\n * @returns {JSX.Element} The footer element.\n */\nexport const PopoverFooter: React.FC<PopoverFooterProps> = ({\n className,\n ...props\n}) => {\n const { bulmaHelperClasses, rest } = useBulmaClasses(props);\n return (\n <div\n className={classNames(\n usePrefixedClassNames('popover-footer'),\n bulmaHelperClasses,\n className\n )}\n {...rest}\n />\n );\n};\n\n/**\n * Props for the Popover.Close component: the props of a `Button` rendered as\n * a `<button>`.\n * @extraProp {'button' | 'submit' | 'reset'} [type='button'] - Button type. Defaults to `'button'`, so a close button inside a form doesn't submit it.\n * @extraProp {React.MouseEventHandler<HTMLButtonElement>} [onClick] - Runs before the popover closes. Call `preventDefault()` to keep it open.\n */\nexport interface PopoverCloseProps\n extends\n ButtonOwnProps,\n Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, keyof ButtonOwnProps> {}\n\n/**\n * A `Button` that closes the popover, handing focus back to the trigger.\n *\n * @function\n * @param {PopoverCloseProps} props - Props for the Popover.Close component.\n * @returns {JSX.Element} The close button.\n */\nexport const PopoverClose: React.FC<PopoverCloseProps> = ({\n onClick,\n ...props\n}) => {\n const context = useContext(PopoverContext);\n return (\n <Button\n {...props}\n type={buttonType(props.type)}\n onClick={(e: React.MouseEvent<HTMLButtonElement>) => {\n onClick?.(e);\n if (!e.defaultPrevented) context?.close();\n }}\n />\n );\n};\n\n/** Popover with Header, Body, Footer and Close sub-components. */\nexport const Popover = withSubComponents(\n PopoverComponent,\n {\n Header: PopoverHeader,\n Body: PopoverBody,\n Footer: PopoverFooter,\n Close: PopoverClose,\n },\n 'Popover'\n);\n\nexport default Popover;\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;;;;;;;;;;AAqIA,MAAM,cAAc,GAAG,aAAa,CAA6B,IAAI,CAAC;AAWtE;AACA,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC;IAC9B,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,UAAU;IACV,SAAS;AACV,CAAA,CAAC;AAEF;;;AAGG;AACH,SAAS,gBAAgB,CAAC,EAAW,EAAE,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AAa;AACrB,IAAA,KAAK,EAAE,YAAY;CACpB,EACD,SAAS;;"}
1
+ {"version":3,"file":"Popover.js","sources":["../../../src/components/Popover.tsx"],"sourcesContent":["import React, {\n cloneElement,\n createContext,\n useCallback,\n useContext,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { classNames, usePrefixedClassNames } from '../helpers/classNames';\nimport { useBulmaClasses, BulmaClassesProps } from '../helpers/useBulmaClasses';\nimport { withSubComponents } from '../helpers/withSubComponents';\nimport { Portal } from '../helpers/portal';\nimport { useIsHydrated } from '../helpers/useIsHydrated';\nimport { focusTabStop, useFocusTrap } from '../helpers/useFocusTrap';\nimport { marginGap, useAnchoredPosition } from '../helpers/useAnchoredPosition';\nimport { useClientLayoutEffect } from '../helpers/useClientLayoutEffect';\nimport { useLatestRef } from '../helpers/useLatestRef';\nimport { getDeepestActiveElement, isEventInside } from '../helpers/shadowDom';\nimport { buttonType } from '../helpers/buttonType';\nimport { warnOnce } from '../helpers/devWarnings';\nimport { Button, ButtonOwnProps } from '../elements/Button';\nimport type { PickerPosition } from '../form/_pickerInternals/pickerTypes';\n\n/**\n * Where the panel opens against its trigger: below (`bottom-*`) or above\n * (`top-*`), lined up with the trigger's left or right edge. `auto` picks the\n * one that keeps the panel in the viewport, preferring below and lined up on\n * the left. The same union the date and time pickers take.\n */\nexport type PopoverPosition = PickerPosition;\n\n/**\n * Props for the Popover component. `className`, `id`, the other HTML\n * attributes and the helper props land on the wrapper around the trigger,\n * not on the panel; `contentClassName` reaches the panel.\n * @extraProp {string} [className] - Additional classes for the wrapper around the trigger. The panel takes `contentClassName`.\n */\nexport interface PopoverProps\n extends\n Omit<React.HTMLAttributes<HTMLDivElement>, 'color' | 'children'>,\n Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {\n /**\n * The element that opens and closes the popover, such as a `Button`.\n * Popover gives it `aria-haspopup=\"dialog\"`, `aria-expanded`,\n * `aria-controls` while the panel is open, and click and key handlers that\n * run after its own (call `preventDefault()` in yours to keep the popover\n * from toggling). It has to be a single element that passes `onClick` and\n * `onKeyDown` to its DOM node. Enter and Space toggle a trigger the browser\n * doesn't click on its own, and an intrinsic element that isn't already a\n * control (a `<span>`) also gets `role=\"button\"` and `tabIndex={0}` unless\n * it sets them; a component that renders one has to take those itself.\n */\n trigger: React.ReactElement;\n /** The panel's content, usually `Popover.Header`, `Popover.Body` and `Popover.Footer`. */\n children?: React.ReactNode;\n /**\n * Controlled open state. When set, the trigger and every dismissal only\n * report through `onOpenChange`.\n */\n open?: boolean;\n /**\n * Initial open state when uncontrolled. Opening moves focus into the\n * panel, so a popover that starts open takes focus once the page loads.\n * @defaultValue false\n */\n defaultOpen?: boolean;\n /**\n * Called with the state asked for: `true` from the trigger opening it,\n * `false` from the trigger, `Popover.Close`, Escape or an outside\n * `pointerdown`. Fires in both controlled and uncontrolled use.\n */\n onOpenChange?: (open: boolean) => void;\n /**\n * Where the panel opens against the trigger.\n * @defaultValue 'bottom-left'\n */\n position?: PopoverPosition;\n /**\n * Render the panel through `Portal`, into the `portalContainer` a\n * `ConfigProvider` sets, `document.body` by default, fixed to the viewport,\n * so an ancestor's `overflow`, `transform` or stacking context can't clip\n * it. The panel then shows from the commit after hydration, never in server\n * markup. It is measured against the trigger when it opens and on resize\n * and scroll, so it doesn't follow content that changes size while it is\n * open. Theming variables set on an ancestor of the trigger reach it only\n * when its container is inside that ancestor.\n * @defaultValue false\n */\n appendToBody?: boolean;\n /**\n * Keep Tab and Shift+Tab inside the panel while it is open, as the ARIA\n * dialog pattern does for a non-modal dialog. Pointer focus leaves freely\n * and the page stays usable. With `false`, Tab moves past the panel and\n * the popover stays open. Focus moves into the panel on open and back to\n * the trigger on close either way.\n * @defaultValue true\n */\n trapFocus?: boolean;\n /**\n * Close on a `pointerdown` outside the trigger and the panel. Content the\n * panel renders through a portal (a nested `Popover`, a portaled picker)\n * still counts as inside.\n * @defaultValue true\n */\n closeOnClickOutside?: boolean;\n /**\n * Close on Escape while focus is in the panel or on the trigger. A dialog\n * nested in the panel, such as a date picker's calendar, takes its own\n * Escape first, and so does content that calls `preventDefault()` on it.\n * @defaultValue true\n */\n closeOnEscape?: boolean;\n /**\n * The panel's accessible name. Without it the panel is named by its\n * `Popover.Header`, and a development build warns when it has neither.\n */\n ariaLabel?: string;\n /** Additional classes for the panel (`.popover-content`). */\n contentClassName?: string;\n}\n\ninterface PopoverContextValue {\n /** The id `Popover.Header` takes, which names the panel. */\n titleId: string;\n /** Records a mounted `Popover.Header`; the returned function forgets it. */\n registerTitle: () => () => void;\n /** Asks the popover to close. */\n close: () => void;\n}\n\nconst PopoverContext = createContext<PopoverContextValue | null>(null);\n\n/** The trigger props Popover reads before replacing them. */\ninterface TriggerProps {\n onClick?: (event: React.MouseEvent<HTMLElement>) => void;\n onKeyDown?: (event: React.KeyboardEvent<HTMLElement>) => void;\n role?: string;\n tabIndex?: number;\n href?: unknown;\n}\n\n/** Intrinsic elements that are controls already, and keep their own role. */\nconst NATIVE_CONTROLS = new Set([\n 'button',\n 'input',\n 'select',\n 'textarea',\n 'summary',\n]);\n\n/**\n * Whether the browser answers this key on `el` itself, by clicking it or by\n * using the key as input, so the trigger's click handler covers it.\n */\nfunction handlesKeyItself(el: Element, key: string): boolean {\n if (NATIVE_CONTROLS.has(el.localName)) return true;\n return el.localName === 'a' && key === 'Enter' && el.hasAttribute('href');\n}\n\n/** The innermost dialog the event passed through, which is the one its Escape belongs to. */\nfunction nearestDialog(event: Event): EventTarget | null {\n return (\n event.composedPath().find(node => {\n const role = (node as Element).getAttribute?.('role');\n return role === 'dialog' || role === 'alertdialog';\n }) ?? null\n );\n}\n\n/**\n * The `Popover` component opens a panel of interactive content, such as a filter form or a set of share options, anchored to the element that toggles it.\n *\n * The panel is a non-modal `role=\"dialog\"`: focus moves into it on open\n * and returns to the trigger on close, while the rest of the page stays\n * reachable by pointer and assistive technology. For hover-only hints use\n * `Tooltip`, and for a list of actions use `Dropdown`.\n *\n * @function\n * @param {PopoverProps} props - Props for the Popover component.\n * @returns {JSX.Element} The trigger in its wrapper, and the panel while open.\n *\n * @example\n * <Popover trigger={<Button>Filters</Button>}>\n * <Popover.Header>Filter rows</Popover.Header>\n * <Popover.Body>…</Popover.Body>\n * <Popover.Footer>\n * <Popover.Close>Done</Popover.Close>\n * </Popover.Footer>\n * </Popover>\n */\nconst PopoverComponent: React.FC<PopoverProps> = ({\n trigger,\n children,\n open: controlledOpen,\n defaultOpen = false,\n onOpenChange,\n position = 'bottom-left',\n appendToBody = false,\n trapFocus = true,\n closeOnClickOutside = true,\n closeOnEscape = true,\n ariaLabel,\n className,\n contentClassName,\n ...props\n}) => {\n const { bulmaHelperClasses, rest } = useBulmaClasses(props);\n const rootRef = useRef<HTMLDivElement>(null);\n const panelRef = useRef<HTMLDivElement>(null);\n // The last pointerdown React saw inside the panel. React's tree includes\n // content the panel portals elsewhere, which the DOM path doesn't.\n const insidePointerRef = useRef<Event | null>(null);\n const baseId = useId();\n const panelId = `${baseId}-panel`;\n const titleId = `${baseId}-title`;\n\n const isControlled = controlledOpen !== undefined;\n const [internalOpen, setInternalOpen] = useState(defaultOpen);\n const isOpen = controlledOpen ?? internalOpen;\n\n const requestOpen = useCallback(\n (next: boolean) => {\n onOpenChange?.(next);\n if (!isControlled) setInternalOpen(next);\n },\n [isControlled, onOpenChange]\n );\n const close = useCallback(() => requestOpen(false), [requestOpen]);\n\n // A portaled panel has no server markup, so it only exists from the commit\n // after hydration. Everything that measures or focuses it waits for that.\n const hydrated = useIsHydrated();\n const panelMounted = isOpen && (hydrated || !appendToBody);\n\n const resolved = useAnchoredPosition(rootRef, panelRef, {\n active: panelMounted,\n position,\n fixed: appendToBody,\n // The gap comes from `--bulma-popover-offset` in the stylesheet, so the\n // coordinates leave it out and `auto` reads it off the panel.\n offset: 0,\n styledGap: marginGap,\n });\n\n // The trigger renders first inside the wrapper. Read when needed rather\n // than held, so a trigger that remounted is still the one found.\n const triggerNode = useCallback((): HTMLElement | null => {\n const first = rootRef.current?.firstElementChild;\n return first && first !== panelRef.current ? (first as HTMLElement) : null;\n }, []);\n const restoreFocusRef = useMemo(\n () => ({\n get current() {\n return triggerNode();\n },\n }),\n [triggerNode]\n );\n\n useFocusTrap(panelRef, {\n active: panelMounted && trapFocus,\n restoreFocus: restoreFocusRef,\n });\n\n // Without the trap, focus still arrives in the panel and goes back to the\n // trigger, on the trap's terms: only while the panel still holds it.\n useEffect(() => {\n const panel = panelRef.current;\n if (!panelMounted || trapFocus || !panel) return undefined;\n focusTabStop(panel);\n return () => {\n const doc = panel.ownerDocument;\n const now = getDeepestActiveElement(doc);\n if (!now || now === doc.body || panel.contains(now)) {\n triggerNode()?.focus();\n }\n };\n }, [panelMounted, trapFocus, triggerNode]);\n\n // Read when a press lands outside, so the listener stays put while `close`\n // changes identity, which it does with `onOpenChange`, and an inline one\n // changes on every render of the parent.\n const closeRef = useLatestRef(close);\n\n useEffect(() => {\n if (!panelMounted || !closeOnClickOutside) return undefined;\n const handlePointerDown = (e: PointerEvent) => {\n if (e === insidePointerRef.current || isEventInside(e, rootRef.current)) {\n return;\n }\n closeRef.current();\n };\n // The wrapper is on the page whenever the panel is. Its document, an\n // iframe's when the tree renders into one, is where presses land.\n const doc = (rootRef.current as HTMLDivElement).ownerDocument;\n doc.addEventListener('pointerdown', handlePointerDown);\n return () => doc.removeEventListener('pointerdown', handlePointerDown);\n }, [panelMounted, closeOnClickOutside, closeRef]);\n\n const handlePanelKeyDown = (e: React.KeyboardEvent<HTMLDivElement>) => {\n if (e.key !== 'Escape' || !closeOnEscape || e.defaultPrevented) return;\n // React bubbles the key here from portaled content as well, so a dialog\n // of its own on the way (a nested popover, a picker's calendar) owns it.\n const owner = nearestDialog(e.nativeEvent);\n if (owner && owner !== panelRef.current) return;\n e.preventDefault();\n close();\n };\n\n const triggerProps = trigger.props as TriggerProps;\n\n const handleTriggerClick = (e: React.MouseEvent<HTMLElement>) => {\n triggerProps.onClick?.(e);\n if (!e.defaultPrevented) requestOpen(!isOpen);\n };\n\n const handleTriggerKeyDown = (e: React.KeyboardEvent<HTMLElement>) => {\n triggerProps.onKeyDown?.(e);\n // A key on something inside the trigger is that element's to answer.\n if (e.defaultPrevented || e.target !== e.currentTarget) return;\n if (e.key === 'Escape') {\n if (isOpen && closeOnEscape) {\n e.preventDefault();\n close();\n }\n return;\n }\n if (e.key !== 'Enter' && e.key !== ' ') return;\n if (handlesKeyItself(e.currentTarget, e.key)) return;\n // Space would scroll the page; a held key repeats.\n e.preventDefault();\n if (!e.repeat) requestOpen(!isOpen);\n };\n\n const needsButtonRole =\n typeof trigger.type === 'string' &&\n !NATIVE_CONTROLS.has(trigger.type) &&\n !(trigger.type === 'a' && triggerProps.href != null);\n\n const clonedTrigger = cloneElement(\n trigger as React.ReactElement<Record<string, unknown>>,\n {\n ...(needsButtonRole\n ? {\n role: triggerProps.role ?? 'button',\n tabIndex: triggerProps.tabIndex ?? 0,\n }\n : {}),\n 'aria-haspopup': 'dialog',\n 'aria-expanded': isOpen,\n 'aria-controls': panelMounted ? panelId : undefined,\n onClick: handleTriggerClick,\n onKeyDown: handleTriggerKeyDown,\n }\n );\n\n const rootClasses = classNames(\n usePrefixedClassNames('popover', { 'is-active': isOpen }),\n bulmaHelperClasses,\n className\n );\n const panelClasses = classNames(\n usePrefixedClassNames('popover-content', {\n [`is-${resolved.position}`]: true,\n 'is-portal': appendToBody,\n }),\n contentClassName\n );\n\n return (\n // The ref after the spread: React 19 hands a function component a `ref`\n // prop like any other, and the wrapper has to stay ours.\n <div className={rootClasses} {...rest} ref={rootRef}>\n {clonedTrigger}\n {isOpen && (\n <Portal disabled={!appendToBody}>\n <PopoverPanel\n panelRef={panelRef}\n titleId={titleId}\n ariaLabel={ariaLabel}\n close={close}\n id={panelId}\n className={panelClasses}\n style={\n appendToBody\n ? {\n position: 'fixed',\n top: resolved.top,\n left: resolved.left,\n }\n : undefined\n }\n onKeyDown={handlePanelKeyDown}\n onPointerDownCapture={e => {\n insidePointerRef.current = e.nativeEvent;\n }}\n >\n {children}\n </PopoverPanel>\n </Portal>\n )}\n </div>\n );\n};\n\ninterface PopoverPanelProps extends React.HTMLAttributes<HTMLDivElement> {\n panelRef: React.RefObject<HTMLDivElement | null>;\n titleId: string;\n ariaLabel?: string;\n close: () => void;\n}\n\n/**\n * The open panel. It mounts with each opening, so it counts the\n * `Popover.Header`s inside it afresh every time.\n */\nfunction PopoverPanel({\n panelRef,\n titleId,\n ariaLabel,\n close,\n children,\n ...attrs\n}: PopoverPanelProps) {\n // Headers register in a layout effect, after this first render, and this\n // panel's own layout effect runs after theirs. Until then the panel assumes\n // it has one, so a panel that does is named from its first commit, before\n // focus moves in, and one that doesn't drops the reference before it paints.\n const [titlesCounted, setTitlesCounted] = useState(false);\n const [titleCount, setTitleCount] = useState(0);\n const registerTitle = useCallback(() => {\n setTitleCount(n => n + 1);\n return () => setTitleCount(n => n - 1);\n }, []);\n useClientLayoutEffect(() => {\n setTitlesCounted(true);\n }, []);\n const named = Boolean(ariaLabel) || titleCount > 0;\n\n useEffect(() => {\n if (titlesCounted && !named) {\n warnOnce(\n 'Popover:unnamed',\n '[bestax-bulma] <Popover> opened a panel with no accessible name. ' +\n 'Pass ariaLabel, or render a Popover.Header inside it.'\n );\n }\n }, [titlesCounted, named]);\n\n const context = useMemo(\n () => ({ titleId, registerTitle, close }),\n [titleId, registerTitle, close]\n );\n\n return (\n <PopoverContext.Provider value={context}>\n <div\n {...attrs}\n ref={panelRef}\n role=\"dialog\"\n aria-label={ariaLabel}\n aria-labelledby={\n !ariaLabel && (!titlesCounted || titleCount > 0) ? titleId : undefined\n }\n tabIndex={-1}\n >\n {children}\n </div>\n </PopoverContext.Provider>\n );\n}\n\n/**\n * Props for the Popover.Header component. Its `id` is the one the panel's\n * `aria-labelledby` names, so it isn't yours to set.\n */\nexport interface PopoverHeaderProps\n extends\n Omit<React.HTMLAttributes<HTMLDivElement>, 'color' | 'id'>,\n BulmaClassesProps {\n /** Additional CSS classes. */\n className?: string;\n}\n\n/**\n * The popover's title, which names the panel for assistive technology.\n *\n * @function\n * @param {PopoverHeaderProps} props - Props for the Popover.Header component.\n * @returns {JSX.Element} The header element.\n */\nexport const PopoverHeader: React.FC<PopoverHeaderProps> = ({\n className,\n ...props\n}) => {\n const context = useContext(PopoverContext);\n const registerTitle = context?.registerTitle;\n // Before paint, so the panel is named by the time it shows.\n useClientLayoutEffect(() => registerTitle?.(), [registerTitle]);\n const { bulmaHelperClasses, rest } = useBulmaClasses(props);\n return (\n <div\n className={classNames(\n usePrefixedClassNames('popover-header'),\n bulmaHelperClasses,\n className\n )}\n {...rest}\n id={context?.titleId}\n />\n );\n};\n\n/**\n * Props for the Popover.Body component.\n */\nexport interface PopoverBodyProps\n extends\n Omit<React.HTMLAttributes<HTMLDivElement>, 'color'>,\n BulmaClassesProps {\n /** Additional CSS classes. */\n className?: string;\n}\n\n/**\n * The popover's main content area.\n *\n * @function\n * @param {PopoverBodyProps} props - Props for the Popover.Body component.\n * @returns {JSX.Element} The body element.\n */\nexport const PopoverBody: React.FC<PopoverBodyProps> = ({\n className,\n ...props\n}) => {\n const { bulmaHelperClasses, rest } = useBulmaClasses(props);\n return (\n <div\n className={classNames(\n usePrefixedClassNames('popover-body'),\n bulmaHelperClasses,\n className\n )}\n {...rest}\n />\n );\n};\n\n/**\n * Props for the Popover.Footer component.\n */\nexport interface PopoverFooterProps\n extends\n Omit<React.HTMLAttributes<HTMLDivElement>, 'color'>,\n BulmaClassesProps {\n /** Additional CSS classes. */\n className?: string;\n}\n\n/**\n * A row of actions along the bottom of the popover, aligned to the end.\n *\n * @function\n * @param {PopoverFooterProps} props - Props for the Popover.Footer component.\n * @returns {JSX.Element} The footer element.\n */\nexport const PopoverFooter: React.FC<PopoverFooterProps> = ({\n className,\n ...props\n}) => {\n const { bulmaHelperClasses, rest } = useBulmaClasses(props);\n return (\n <div\n className={classNames(\n usePrefixedClassNames('popover-footer'),\n bulmaHelperClasses,\n className\n )}\n {...rest}\n />\n );\n};\n\n/**\n * Props for the Popover.Close component: the props of a `Button` rendered as\n * a `<button>`.\n * @extraProp {'button' | 'submit' | 'reset'} [type='button'] - Button type. Defaults to `'button'`, so a close button inside a form doesn't submit it.\n * @extraProp {React.MouseEventHandler<HTMLButtonElement>} [onClick] - Runs before the popover closes. Call `preventDefault()` to keep it open.\n */\nexport interface PopoverCloseProps\n extends\n ButtonOwnProps,\n Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, keyof ButtonOwnProps> {}\n\n/**\n * A `Button` that closes the popover, handing focus back to the trigger.\n *\n * @function\n * @param {PopoverCloseProps} props - Props for the Popover.Close component.\n * @returns {JSX.Element} The close button.\n */\nexport const PopoverClose: React.FC<PopoverCloseProps> = ({\n onClick,\n ...props\n}) => {\n const context = useContext(PopoverContext);\n return (\n <Button\n {...props}\n type={buttonType(props.type)}\n onClick={(e: React.MouseEvent<HTMLButtonElement>) => {\n onClick?.(e);\n if (!e.defaultPrevented) context?.close();\n }}\n />\n );\n};\n\n/** Popover with Header, Body, Footer and Close sub-components. */\nexport const Popover = withSubComponents(\n PopoverComponent,\n {\n Header: PopoverHeader,\n Body: PopoverBody,\n Footer: PopoverFooter,\n Close: PopoverClose,\n },\n 'Popover'\n);\n\nexport default Popover;\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;;;;;;;;;;;AAqIA,MAAM,cAAc,GAAG,aAAa,CAA6B,IAAI,CAAC;AAWtE;AACA,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC;IAC9B,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,UAAU;IACV,SAAS;AACV,CAAA,CAAC;AAEF;;;AAGG;AACH,SAAS,gBAAgB,CAAC,EAAW,EAAE,GAAW,EAAA;AAChD,IAAA,IAAI,eAAe,CAAC,GAAG,CAAC,EAAE,CAAC,SAAS,CAAC;AAAE,QAAA,OAAO,IAAI;AAClD,IAAA,OAAO,EAAE,CAAC,SAAS,KAAK,GAAG,IAAI,GAAG,KAAK,OAAO,IAAI,EAAE,CAAC,YAAY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3D,IAAA,QACEA,GAAA,CAAA,KAAA,EAAA,EACE,SAAS,EAAE,UAAU,CACnB,qBAAqB,CAAC,cAAc,CAAC,EACrC,kBAAkB,EAClB,SAAS,CACV,KACG,IAAI,EAAA,CACR;AAEN;AAaA;;;;;;AAMG;AACI,MAAM,aAAa,GAAiC,CAAC,EAC1D,SAAS,EACT,GAAG,KAAK,EACT,KAAI;IACH,MAAM,EAAE,kBAAkB,EAAE,IAAI,EAAE,GAAG,eAAe,CAAC,KAAK,CAAC;AAC3D,IAAA,QACEA,GAAA,CAAA,KAAA,EAAA,EACE,SAAS,EAAE,UAAU,CACnB,qBAAqB,CAAC,gBAAgB,CAAC,EACvC,kBAAkB,EAClB,SAAS,CACV,KACG,IAAI,EAAA,CACR;AAEN;AAaA;;;;;;AAMG;AACI,MAAM,YAAY,GAAgC,CAAC,EACxD,OAAO,EACP,GAAG,KAAK,EACT,KAAI;AACH,IAAA,MAAM,OAAO,GAAG,UAAU,CAAC,cAAc,CAAC;IAC1C,QACEA,IAAC,MAAM,EAAA,EAAA,GACD,KAAK,EACT,IAAI,EAAE,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,EAC5B,OAAO,EAAE,CAAC,CAAsC,KAAI;AAClD,YAAA,OAAO,GAAG,CAAC,CAAC;YACZ,IAAI,CAAC,CAAC,CAAC,gBAAgB;gBAAE,OAAO,EAAE,KAAK,EAAE;QAC3C,CAAC,EAAA,CACD;AAEN;AAEA;AACO,MAAM,OAAO,GAAG,iBAAiB,CACtC,gBAAgB,EAChB;AACE,IAAA,MAAM,EAAE,aAAa;AACrB,IAAA,IAAI,EAAE,WAAW;AACjB,IAAA,MAAM,EAAE,aAAa;AACrB,IAAA,KAAK,EAAE,YAAY;CACpB,EACD,SAAS;;"}
@@ -1,4 +1,5 @@
1
1
  /* @allxsmith/bestax-bulma — AI agents: see AGENTS.md in the package root, or https://bestax.io/llms.txt */
2
+ 'use client';
2
3
  import { jsx } from 'react/jsx-runtime';
3
4
  import React, { useState, useEffect, Children, isValidElement, cloneElement } from 'react';
4
5
  import { prefixedClassNames, classNames, usePrefixedClassNames } from '../helpers/classNames.js';
@@ -1 +1 @@
1
- {"version":3,"file":"Reveal.js","sources":["../../../src/components/Reveal.tsx"],"sourcesContent":["import React, {\n Children,\n cloneElement,\n isValidElement,\n useEffect,\n useState,\n} from 'react';\nimport {\n classNames,\n prefixedClassNames,\n usePrefixedClassNames,\n} from '../helpers/classNames';\nimport { useClassPrefix } from '../helpers/Config';\nimport type { PolymorphicComponentWithoutRef } from '../helpers/polymorphic';\nimport { useBulmaClasses, BulmaClassesProps } from '../helpers/useBulmaClasses';\n\n/**\n * Animation styles available for the Reveal component.\n */\nexport type RevealAnimation =\n | 'fade'\n | 'fade-up'\n | 'fade-down'\n | 'slide-left'\n | 'slide-right'\n | 'zoom'\n | 'flip';\n\n/**\n * The Reveal component's own props — everything it adds on top of the\n * attributes of whatever element `as` renders.\n */\nexport interface RevealOwnProps extends BulmaClassesProps {\n /** Animation style applied when the element enters the viewport. */\n animation?: RevealAnimation;\n /** Delay in milliseconds before the animation starts. Default: 0. */\n delay?: number;\n /** Animation duration in milliseconds. Default: 600. */\n duration?: number;\n /** Fraction (0-1) of the element that must be visible to trigger the reveal. Clamped to the 0-1 range; non-finite values fall back to `0.15`. */\n threshold?: number;\n /** Animate only the first time the element enters the viewport. If `false`, it re-animates on every entry/exit. */\n once?: boolean;\n /** Stagger direct children with an incrementing delay instead of animating this element as a single block. */\n cascade?: boolean;\n /** Milliseconds added to each successive child's delay when `cascade` is set. Default: 80. */\n cascadeInterval?: number;\n /** Content to reveal. */\n children?: React.ReactNode;\n /** Additional CSS classes. Applied to the observed element (the wrapper `div` when `as` is a component). */\n className?: string;\n /** Inline styles, merged after the animation's own. Applied to the observed element. */\n style?: React.CSSProperties;\n}\n\n/**\n * Props for the Reveal component. The DOM attributes follow `as`.\n *\n * Reveal forwards no `ref`: it owns the node it observes for scroll\n * intersection, and when `as` is a component that node is a wrapper `div`\n * rather than the element `as` names — so a ref derived from `as` would point\n * at the wrong thing.\n */\nexport type RevealProps<T extends React.ElementType = 'div'> = RevealOwnProps &\n Omit<React.ComponentPropsWithoutRef<T>, keyof RevealOwnProps | 'as'> & {\n /** Element or component to render as. Default: 'div'. When `as` is a plain intrinsic tag (e.g. `'section'`), your `className`, `style`, and Bulma helper classes plus everything in `...rest` all land on that single element. When `as` is a component (e.g. `Section`, `Card`), scroll detection needs a real DOM node with a ref, so `Reveal` wraps it in an observed `div`: `className`/`style`/helper classes go on that wrapper `div`, while `...rest` (`id`, `aria-*`, `data-*`, event handlers) is forwarded to the inner component. */\n as?: T;\n };\n\n/**\n * The shape the implementation destructures. The public contract is the generic\n * `RevealProps<T>` above — the body cannot see through `T`.\n */\ntype RevealImplProps = RevealOwnProps & { as?: React.ElementType };\n\n/**\n * Detects the user's `prefers-reduced-motion` preference. Always `false` on\n * the server and on the very first client render, so SSR output and the\n * initial hydration pass always agree.\n *\n * @function\n * @returns {boolean} Whether the user has requested reduced motion.\n */\nfunction usePrefersReducedMotion(): boolean {\n const [prefersReducedMotion, setPrefersReducedMotion] = useState(false);\n\n useEffect(() => {\n if (typeof window === 'undefined' || !window.matchMedia) return undefined;\n\n const mediaQuery = window.matchMedia('(prefers-reduced-motion: reduce)');\n // eslint-disable-next-line react-hooks/set-state-in-effect -- reads the live media query on mount\n setPrefersReducedMotion(mediaQuery.matches);\n\n const handleChange = (event: MediaQueryListEvent) => {\n setPrefersReducedMotion(event.matches);\n };\n\n mediaQuery.addEventListener('change', handleChange);\n return () => mediaQuery.removeEventListener('change', handleChange);\n }, []);\n\n return prefersReducedMotion;\n}\n\n/**\n * The `Reveal` component animates its content into view as it scrolls into the viewport, backed by `IntersectionObserver`.\n *\n * @function\n * @param {RevealProps} props - Props for the Reveal component.\n * @returns {JSX.Element} The rendered reveal wrapper.\n *\n * @example\n * // Fade a section up into view\n * <Reveal animation=\"fade-up\" as={Section}>\n * <Title>Why Grass Doctor</Title>\n * </Reveal>\n *\n * @example\n * // Stagger a set of cards as they enter the viewport\n * <Reveal animation=\"fade-up\" cascade cascadeInterval={80}>\n * {services.map(service => (\n * <Card key={service.name}>{service.name}</Card>\n * ))}\n * </Reveal>\n */\nfunction RevealImpl(revealProps: RevealProps) {\n const {\n animation = 'fade-up',\n delay = 0,\n duration = 600,\n threshold = 0.15,\n once = true,\n as: Component = 'div',\n cascade = false,\n cascadeInterval = 80,\n className,\n style,\n children,\n ...props\n } = revealProps as RevealImplProps;\n const { bulmaHelperClasses, rest } = useBulmaClasses(props);\n const classPrefix = useClassPrefix();\n const prefersReducedMotion = usePrefersReducedMotion();\n const [node, setNode] = useState<HTMLElement | null>(null);\n const [isMounted, setIsMounted] = useState(false);\n const [isRevealed, setIsRevealed] = useState(false);\n\n // IntersectionObserver throws a RangeError for NaN or thresholds outside\n // 0-1, so clamp valid numbers and fall back to the default for anything else.\n const observerThreshold = Number.isFinite(threshold)\n ? Math.min(Math.max(threshold, 0), 1)\n : 0.15;\n\n useEffect(() => {\n // eslint-disable-next-line react-hooks/set-state-in-effect -- flips to true once mounted on the client so SSR/first-paint markup matches the server\n setIsMounted(true);\n }, []);\n\n useEffect(() => {\n if (prefersReducedMotion) {\n // eslint-disable-next-line react-hooks/set-state-in-effect -- reduced motion skips straight to the revealed state\n setIsRevealed(true);\n return undefined;\n }\n\n if (typeof IntersectionObserver === 'undefined') {\n setIsRevealed(true);\n return undefined;\n }\n\n // The ref callback attaches after this effect's first pass; it re-runs\n // once `node` becomes available since it's a dependency.\n if (!node) return undefined;\n\n const observer = new IntersectionObserver(\n ([entry]) => {\n if (entry.isIntersecting) {\n setIsRevealed(true);\n if (once) observer.unobserve(node);\n } else if (!once) {\n setIsRevealed(false);\n }\n },\n { threshold: observerThreshold }\n );\n\n observer.observe(node);\n return () => observer.disconnect();\n }, [node, prefersReducedMotion, once, observerThreshold]);\n\n // Only apply the hidden/animating state once mounted on the client with\n // motion allowed; otherwise render the final, visible state (SSR-safe).\n const isAnimated = isMounted && !prefersReducedMotion;\n const revealed = !isAnimated || isRevealed;\n\n const itemAnimationClasses = prefixedClassNames(classPrefix, {\n [`reveal-${animation}`]: isAnimated,\n 'is-revealed': revealed,\n });\n\n const combinedClasses = classNames(\n usePrefixedClassNames('reveal', { 'is-cascade': cascade }),\n !cascade && itemAnimationClasses,\n bulmaHelperClasses,\n className\n );\n\n const wrapperStyle: React.CSSProperties = cascade\n ? { ...style }\n : {\n ...style,\n transitionDelay: `${delay}ms`,\n transitionDuration: `${duration}ms`,\n };\n\n const content = cascade\n ? Children.toArray(children).map((child, index) => {\n const itemStyle: React.CSSProperties = {\n transitionDelay: `${delay + index * cascadeInterval}ms`,\n transitionDuration: `${duration}ms`,\n };\n\n if (\n isValidElement<{ className?: string; style?: React.CSSProperties }>(\n child\n )\n ) {\n return cloneElement(child, {\n // Children.toArray always assigns a key, generating one from\n // the position when the element doesn't already have one.\n key: child.key,\n className: classNames(itemAnimationClasses, child.props.className),\n style: { ...itemStyle, ...child.props.style },\n });\n }\n\n return (\n <span key={index} className={itemAnimationClasses} style={itemStyle}>\n {child}\n </span>\n );\n })\n : children;\n\n // Scroll observation needs a DOM node this component OWNS — the observer and\n // the animation classes both key off it. An intrinsic tag is that node, so\n // the ref goes straight on it. A component passed via `as` is not: whatever\n // it renders is its own business, and it may render several elements or\n // none. So it gets wrapped in an observed `div`.\n //\n // Not a statement about ref forwarding. Several components in this library\n // forward refs (#641 added four more), and that changes nothing here — a\n // forwarded ref would still point at the target's node rather than at one\n // this component controls.\n if (typeof Component === 'string') {\n // A plain createElement call sidesteps the combinatorial JSX prop types\n // for `ref` across every possible intrinsic tag `as` could be.\n return React.createElement(\n Component,\n {\n ...rest,\n ref: setNode,\n className: combinedClasses,\n style: wrapperStyle,\n },\n content\n );\n }\n\n return (\n <div ref={setNode} className={combinedClasses} style={wrapperStyle}>\n <Component {...rest}>{content}</Component>\n </div>\n );\n}\n\nexport const Reveal = RevealImpl as PolymorphicComponentWithoutRef<\n RevealOwnProps,\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B,EAAE,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC;oBAClE,KAAK,EAAE,EAAE,GAAG,SAAS,EAAE,GAAG,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE;AAC9C,iBAAA,CAAC;YACJ;AAEA,YAAA,QACEA,GAAA,CAAA,MAAA,EAAA,EAAkB,SAAS,EAAE,oBAAoB,EAAE,KAAK,EAAE,SAAS,YAChE,KAAK,EAAA,EADG,KAAK,CAET;AAEX,QAAA,CAAC;UACD,QAAQ;;;;;;;;;;;AAYZ,IAAA,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE;;;AAGjC,QAAA,OAAO,KAAK,CAAC,aAAa,CACxB,SAAS,EACT;AACE,YAAA,GAAG,IAAI;AACP,YAAA,GAAG,EAAE,OAAO;AACZ,YAAA,SAAS,EAAE,eAAe;AAC1B,YAAA,KAAK,EAAE,YAAY;SACpB,EACD,OAAO,CACR;IACH;IAEA,QACEA,aAAK,GAAG,EAAE,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,KAAK,EAAE,YAAY,EAAA,QAAA,EAChEA,GAAA,CAAC,SAAS,EAAA,EAAA,GAAK,IAAI,YAAG,OAAO,EAAA,CAAa,EAAA,CACtC;AAEV;AAEO,MAAM,MAAM,GAAG;AAKtB,MAAM,CAAC,WAAW,GAAG,QAAQ;;"}
1
+ {"version":3,"file":"Reveal.js","sources":["../../../src/components/Reveal.tsx"],"sourcesContent":["import React, {\n Children,\n cloneElement,\n isValidElement,\n useEffect,\n useState,\n} from 'react';\nimport {\n classNames,\n prefixedClassNames,\n usePrefixedClassNames,\n} from '../helpers/classNames';\nimport { useClassPrefix } from '../helpers/Config';\nimport type { PolymorphicComponentWithoutRef } from '../helpers/polymorphic';\nimport { useBulmaClasses, BulmaClassesProps } from '../helpers/useBulmaClasses';\n\n/**\n * Animation styles available for the Reveal component.\n */\nexport type RevealAnimation =\n | 'fade'\n | 'fade-up'\n | 'fade-down'\n | 'slide-left'\n | 'slide-right'\n | 'zoom'\n | 'flip';\n\n/**\n * The Reveal component's own props — everything it adds on top of the\n * attributes of whatever element `as` renders.\n */\nexport interface RevealOwnProps extends BulmaClassesProps {\n /** Animation style applied when the element enters the viewport. */\n animation?: RevealAnimation;\n /** Delay in milliseconds before the animation starts. Default: 0. */\n delay?: number;\n /** Animation duration in milliseconds. Default: 600. */\n duration?: number;\n /** Fraction (0-1) of the element that must be visible to trigger the reveal. Clamped to the 0-1 range; non-finite values fall back to `0.15`. */\n threshold?: number;\n /** Animate only the first time the element enters the viewport. If `false`, it re-animates on every entry/exit. */\n once?: boolean;\n /** Stagger direct children with an incrementing delay instead of animating this element as a single block. */\n cascade?: boolean;\n /** Milliseconds added to each successive child's delay when `cascade` is set. Default: 80. */\n cascadeInterval?: number;\n /** Content to reveal. */\n children?: React.ReactNode;\n /** Additional CSS classes. Applied to the observed element (the wrapper `div` when `as` is a component). */\n className?: string;\n /** Inline styles, merged after the animation's own. Applied to the observed element. */\n style?: React.CSSProperties;\n}\n\n/**\n * Props for the Reveal component. The DOM attributes follow `as`.\n *\n * Reveal forwards no `ref`: it owns the node it observes for scroll\n * intersection, and when `as` is a component that node is a wrapper `div`\n * rather than the element `as` names — so a ref derived from `as` would point\n * at the wrong thing.\n */\nexport type RevealProps<T extends React.ElementType = 'div'> = RevealOwnProps &\n Omit<React.ComponentPropsWithoutRef<T>, keyof RevealOwnProps | 'as'> & {\n /** Element or component to render as. Default: 'div'. When `as` is a plain intrinsic tag (e.g. `'section'`), your `className`, `style`, and Bulma helper classes plus everything in `...rest` all land on that single element. When `as` is a component (e.g. `Section`, `Card`), scroll detection needs a real DOM node with a ref, so `Reveal` wraps it in an observed `div`: `className`/`style`/helper classes go on that wrapper `div`, while `...rest` (`id`, `aria-*`, `data-*`, event handlers) is forwarded to the inner component. */\n as?: T;\n };\n\n/**\n * The shape the implementation destructures. The public contract is the generic\n * `RevealProps<T>` above — the body cannot see through `T`.\n */\ntype RevealImplProps = RevealOwnProps & { as?: React.ElementType };\n\n/**\n * Detects the user's `prefers-reduced-motion` preference. Always `false` on\n * the server and on the very first client render, so SSR output and the\n * initial hydration pass always agree.\n *\n * @function\n * @returns {boolean} Whether the user has requested reduced motion.\n */\nfunction usePrefersReducedMotion(): boolean {\n const [prefersReducedMotion, setPrefersReducedMotion] = useState(false);\n\n useEffect(() => {\n if (typeof window === 'undefined' || !window.matchMedia) return undefined;\n\n const mediaQuery = window.matchMedia('(prefers-reduced-motion: reduce)');\n // eslint-disable-next-line react-hooks/set-state-in-effect -- reads the live media query on mount\n setPrefersReducedMotion(mediaQuery.matches);\n\n const handleChange = (event: MediaQueryListEvent) => {\n setPrefersReducedMotion(event.matches);\n };\n\n mediaQuery.addEventListener('change', handleChange);\n return () => mediaQuery.removeEventListener('change', handleChange);\n }, []);\n\n return prefersReducedMotion;\n}\n\n/**\n * The `Reveal` component animates its content into view as it scrolls into the viewport, backed by `IntersectionObserver`.\n *\n * @function\n * @param {RevealProps} props - Props for the Reveal component.\n * @returns {JSX.Element} The rendered reveal wrapper.\n *\n * @example\n * // Fade a section up into view\n * <Reveal animation=\"fade-up\" as={Section}>\n * <Title>Why Grass Doctor</Title>\n * </Reveal>\n *\n * @example\n * // Stagger a set of cards as they enter the viewport\n * <Reveal animation=\"fade-up\" cascade cascadeInterval={80}>\n * {services.map(service => (\n * <Card key={service.name}>{service.name}</Card>\n * ))}\n * </Reveal>\n */\nfunction RevealImpl(revealProps: RevealProps) {\n const {\n animation = 'fade-up',\n delay = 0,\n duration = 600,\n threshold = 0.15,\n once = true,\n as: Component = 'div',\n cascade = false,\n cascadeInterval = 80,\n className,\n style,\n children,\n ...props\n } = revealProps as RevealImplProps;\n const { bulmaHelperClasses, rest } = useBulmaClasses(props);\n const classPrefix = useClassPrefix();\n const prefersReducedMotion = usePrefersReducedMotion();\n const [node, setNode] = useState<HTMLElement | null>(null);\n const [isMounted, setIsMounted] = useState(false);\n const [isRevealed, setIsRevealed] = useState(false);\n\n // IntersectionObserver throws a RangeError for NaN or thresholds outside\n // 0-1, so clamp valid numbers and fall back to the default for anything else.\n const observerThreshold = Number.isFinite(threshold)\n ? Math.min(Math.max(threshold, 0), 1)\n : 0.15;\n\n useEffect(() => {\n // eslint-disable-next-line react-hooks/set-state-in-effect -- flips to true once mounted on the client so SSR/first-paint markup matches the server\n setIsMounted(true);\n }, []);\n\n useEffect(() => {\n if (prefersReducedMotion) {\n // eslint-disable-next-line react-hooks/set-state-in-effect -- reduced motion skips straight to the revealed state\n setIsRevealed(true);\n return undefined;\n }\n\n if (typeof IntersectionObserver === 'undefined') {\n setIsRevealed(true);\n return undefined;\n }\n\n // The ref callback attaches after this effect's first pass; it re-runs\n // once `node` becomes available since it's a dependency.\n if (!node) return undefined;\n\n const observer = new IntersectionObserver(\n ([entry]) => {\n if (entry.isIntersecting) {\n setIsRevealed(true);\n if (once) observer.unobserve(node);\n } else if (!once) {\n setIsRevealed(false);\n }\n },\n { threshold: observerThreshold }\n );\n\n observer.observe(node);\n return () => observer.disconnect();\n }, [node, prefersReducedMotion, once, observerThreshold]);\n\n // Only apply the hidden/animating state once mounted on the client with\n // motion allowed; otherwise render the final, visible state (SSR-safe).\n const isAnimated = isMounted && !prefersReducedMotion;\n const revealed = !isAnimated || isRevealed;\n\n const itemAnimationClasses = prefixedClassNames(classPrefix, {\n [`reveal-${animation}`]: isAnimated,\n 'is-revealed': revealed,\n });\n\n const combinedClasses = classNames(\n usePrefixedClassNames('reveal', { 'is-cascade': cascade }),\n !cascade && itemAnimationClasses,\n bulmaHelperClasses,\n className\n );\n\n const wrapperStyle: React.CSSProperties = cascade\n ? { ...style }\n : {\n ...style,\n transitionDelay: `${delay}ms`,\n transitionDuration: `${duration}ms`,\n };\n\n const content = cascade\n ? Children.toArray(children).map((child, index) => {\n const itemStyle: React.CSSProperties = {\n transitionDelay: `${delay + index * cascadeInterval}ms`,\n transitionDuration: `${duration}ms`,\n };\n\n if (\n isValidElement<{ className?: string; style?: React.CSSProperties }>(\n child\n )\n ) {\n return cloneElement(child, {\n // Children.toArray always assigns a key, generating one from\n // the position when the element doesn't already have one.\n key: child.key,\n className: classNames(itemAnimationClasses, child.props.className),\n style: { ...itemStyle, ...child.props.style },\n });\n }\n\n return (\n <span key={index} className={itemAnimationClasses} style={itemStyle}>\n {child}\n </span>\n );\n })\n : children;\n\n // Scroll observation needs a DOM node this component OWNS — the observer and\n // the animation classes both key off it. An intrinsic tag is that node, so\n // the ref goes straight on it. A component passed via `as` is not: whatever\n // it renders is its own business, and it may render several elements or\n // none. So it gets wrapped in an observed `div`.\n //\n // Not a statement about ref forwarding. Several components in this library\n // forward refs (#641 added four more), and that changes nothing here — a\n // forwarded ref would still point at the target's node rather than at one\n // this component controls.\n if (typeof Component === 'string') {\n // A plain createElement call sidesteps the combinatorial JSX prop types\n // for `ref` across every possible intrinsic tag `as` could be.\n return React.createElement(\n Component,\n {\n ...rest,\n ref: setNode,\n className: combinedClasses,\n style: wrapperStyle,\n },\n content\n );\n }\n\n return (\n <div ref={setNode} className={combinedClasses} style={wrapperStyle}>\n <Component {...rest}>{content}</Component>\n </div>\n );\n}\n\nexport const Reveal = RevealImpl as PolymorphicComponentWithoutRef<\n RevealOwnProps,\n 'div'\n>;\n\nReveal.displayName = 'Reveal';\n\nexport default Reveal;\n"],"names":["_jsx"],"mappings":";;;;;;;;AA2EA;;;;;;;AAOG;AACH,SAAS,uBAAuB,GAAA;IAC9B,MAAM,CAAC,oBAAoB,EAAE,uBAAuB,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC;IAEvE,SAAS,CAAC,MAAK;QACb,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,CAAC,MAAM,CAAC,UAAU;AAAE,YAAA,OAAO,SAAS;QAEzE,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC,kCAAkC,CAAC;;AAExE,QAAA,uBAAuB,CAAC,UAAU,CAAC,OAAO,CAAC;AAE3C,QAAA,MAAM,YAAY,GAAG,CAAC,KAA0B,KAAI;AAClD,YAAA,uBAAuB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AAE,eAAe;AAC1B,YAAA,KAAK,EAAE,YAAY;SACpB,EACD,OAAO,CACR;IACH;IAEA,QACEA,aAAK,GAAG,EAAE,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,KAAK,EAAE,YAAY,EAAA,QAAA,EAChEA,GAAA,CAAC,SAAS,EAAA,EAAA,GAAK,IAAI,YAAG,OAAO,EAAA,CAAa,EAAA,CACtC;AAEV;AAEO,MAAM,MAAM,GAAG;AAKtB,MAAM,CAAC,WAAW,GAAG,QAAQ;;"}
@@ -1,4 +1,5 @@
1
1
  /* @allxsmith/bestax-bulma — AI agents: see AGENTS.md in the package root, or https://bestax.io/llms.txt */
2
+ 'use client';
2
3
  import { jsx } from 'react/jsx-runtime';
3
4
  import { forwardRef, useEffect, useRef, useCallback, useState } from 'react';
4
5
  import { usePrefixedClassNames, classNames } from '../helpers/classNames.js';
@@ -1 +1 @@
1
- {"version":3,"file":"ScrollArea.js","sources":["../../../src/components/ScrollArea.tsx"],"sourcesContent":["import React, {\n forwardRef,\n useCallback,\n useEffect,\n useRef,\n useState,\n} from 'react';\nimport { classNames, usePrefixedClassNames } from '../helpers/classNames';\nimport {\n useBulmaClasses,\n BulmaClassesProps,\n validColors,\n} from '../helpers/useBulmaClasses';\nimport { useClientLayoutEffect } from '../helpers/useClientLayoutEffect';\nimport { useLatestRef } from '../helpers/useLatestRef';\nimport { warnOnce } from '../helpers/devWarnings';\n\n/** Which way the content scrolls. */\nexport type ScrollAreaOrientation = 'vertical' | 'horizontal' | 'both';\n\n/** When the scrollbars show. */\nexport type ScrollAreaScrollbars = 'auto' | 'hover' | 'always';\n\n/** An edge of the content: the block's top and bottom, the line's start and end. */\nexport type ScrollAreaEdge = 'top' | 'bottom' | 'start' | 'end';\n\nconst EDGES: readonly ScrollAreaEdge[] = ['top', 'bottom', 'start', 'end'];\n\n// Layout can land a fraction of a pixel short of an edge, so anything closer\n// than this counts as there.\nconst SLACK = 1;\n\n/**\n * Props for the ScrollArea component.\n *\n * @helperProps The helper props go on the outer `<div>`, the `.scroll-area`\n * frame, with `className` and `style`. The `ref`, the name, `onScroll` and\n * the other attributes go on the `<div>` inside it, the viewport that\n * scrolls.\n *\n * @extraProp {React.Ref<HTMLDivElement>} [ref] - Ref forwarded to the viewport, the element that scrolls, for `scrollTo` and the like.\n * @extraProp {string} [aria-label] - Names the region, such as \"Release notes\". It needs a name, so pass this or `aria-labelledby`, and a development build warns when it has neither. The name is rendered with the region's role, while the content overflows, since ARIA doesn't allow naming a plain `div`.\n * @extraProp {string} [aria-labelledby] - The id of a visible heading that names the region, in place of `aria-label`.\n * @extraProp {React.UIEventHandler<HTMLDivElement>} [onScroll] - Called as the viewport scrolls.\n */\nexport interface ScrollAreaProps\n extends\n Omit<React.HTMLAttributes<HTMLDivElement>, 'color' | 'role' | 'tabIndex'>,\n Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {\n /** Additional CSS classes for the outer frame. */\n className?: string;\n /** Inline styles for the outer frame. */\n style?: React.CSSProperties;\n /** What scrolls. */\n children?: React.ReactNode;\n /**\n * The area's height. A number is pixels, and a string is any CSS length\n * (`\"20rem\"`, `\"50vh\"`, `\"100%\"`).\n */\n height?: number | string;\n /**\n * The height it grows to with its content, then scrolls past. A number is\n * pixels. Use it in place of `height` for an area that's only as tall as\n * it needs to be.\n */\n maxHeight?: number | string;\n /**\n * Which way it scrolls. `vertical` and `horizontal` clip the other axis,\n * and `both` scrolls whichever overflows.\n */\n orientation?: ScrollAreaOrientation;\n /**\n * When the scrollbars show. `auto`: whenever the content overflows, the\n * way the system shows them. `hover`: colorless until the pointer is over\n * the area or focus is in it, which hides that the area scrolls until\n * then, so keep it for places where the layout makes that plain.\n * `always`: on every axis it scrolls, even when the content fits. Where the\n * system draws its bars over the content (macOS by default, phones and\n * tablets), they still show only while you scroll, and in forced colors\n * they always show.\n */\n showScrollbars?: ScrollAreaScrollbars;\n /**\n * Keeps room for the vertical scrollbar whether or not it shows, so the\n * content doesn't shift when it starts to overflow. It does nothing where\n * the system draws its bars over the content.\n */\n hasStableGutter?: boolean;\n /**\n * Fades the content out toward each edge that has more past it, without\n * fading the scrollbar. It's off in forced colors and when the user asks\n * for more contrast.\n */\n hasFade?: boolean;\n /**\n * Called with the edge when scrolling reaches it, once each time it\n * arrives, such as to load older messages at the top. It isn't called for\n * the edge the area starts at, or when the content changes size.\n */\n onEdgeReach?: (edge: ScrollAreaEdge) => void;\n /** Text color helper. */\n textColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Background color helper. */\n bgColor?: (typeof validColors)[number] | 'inherit' | 'current';\n}\n\n/** What a measurement of the viewport found. */\ninterface Measured {\n /** Overflows on an axis it scrolls. */\n overflowing: boolean;\n /** Each edge that has more content past it. */\n edges: Record<ScrollAreaEdge, boolean>;\n /** The vertical scrollbar's width, and the horizontal one's height. */\n barInline: number;\n barBlock: number;\n}\n\nconst sameMeasure = (a: Measured | null, b: Measured): boolean =>\n !!a &&\n a.overflowing === b.overflowing &&\n a.barInline === b.barInline &&\n a.barBlock === b.barBlock &&\n EDGES.every(edge => a.edges[edge] === b.edges[edge]);\n\n/**\n * The `ScrollArea` component renders a box whose content scrolls inside it, on the browser's own scrollbars in Bulma's colors.\n *\n * The bars are the system's, made thin and colored from Bulma's tokens, so\n * they follow dark mode and keep the system's own settings. While the\n * content overflows, the viewport is a region you can tab to and scroll by\n * keyboard, Safari included, named by `aria-label` or `aria-labelledby`.\n * While it fits, it's a plain box. Setting the bars' colors turns off any\n * `::-webkit-scrollbar` styles inside it.\n *\n * @function\n * @param {ScrollAreaProps} props - Props for the ScrollArea component.\n * @param {React.Ref<HTMLDivElement>} ref - Forwarded ref to the viewport.\n * @returns {JSX.Element} The rendered scroll area.\n *\n * @example\n * <ScrollArea height={240} aria-label=\"Release notes\">\n * <Content>…</Content>\n * </ScrollArea>\n *\n * @example\n * <ScrollArea maxHeight=\"20rem\" aria-label=\"Messages\" hasFade>\n * …\n * </ScrollArea>\n */\nexport const ScrollArea = forwardRef<HTMLDivElement, ScrollAreaProps>(\n (\n {\n className,\n style,\n textColor,\n bgColor,\n height,\n maxHeight,\n orientation = 'both',\n showScrollbars = 'auto',\n hasStableGutter,\n hasFade,\n onEdgeReach,\n onScroll,\n onFocus,\n onBlur,\n children,\n ...props\n },\n ref\n ) => {\n const { bulmaHelperClasses, rest } = useBulmaClasses({\n color: textColor,\n backgroundColor: bgColor,\n ...props,\n });\n\n const frameClass = usePrefixedClassNames('scroll-area', {\n 'is-vertical': orientation === 'vertical',\n 'is-horizontal': orientation === 'horizontal',\n 'has-hover-scrollbars': showScrollbars === 'hover',\n 'has-visible-scrollbars': showScrollbars === 'always',\n 'has-stable-gutter': !!hasStableGutter,\n 'has-fade': !!hasFade,\n });\n const viewportClass = usePrefixedClassNames('scroll-area-viewport');\n\n const named = Boolean(rest['aria-label'] || rest['aria-labelledby']);\n useEffect(() => {\n if (!named) {\n warnOnce(\n 'ScrollArea:unnamed',\n '[bestax-bulma] <ScrollArea> has no accessible name. Pass ' +\n 'aria-label or aria-labelledby, so a screen reader can say what ' +\n 'took focus when the area overflows.'\n );\n }\n }, [named]);\n\n const viewportRef = useRef<HTMLDivElement | null>(null);\n const setRefs = useCallback(\n (node: HTMLDivElement | null) => {\n viewportRef.current = node;\n if (typeof ref === 'function') return ref(node);\n if (ref) ref.current = node;\n },\n [ref]\n );\n\n // Nothing is known about the overflow until the client measures it, so\n // the server renders a plain scroller and hydrates as one.\n const [measured, setMeasured] = useState<Measured | null>(null);\n const [focused, setFocused] = useState(false);\n // The last measurement, read by the scroll handler to see which edges\n // it just reached, and the direction and bar sizes, which only change\n // with layout, so a scroll doesn't read computed styles.\n const lastRef = useRef<Measured | null>(null);\n const layoutRef = useRef({ rtl: false, barInline: 0, barBlock: 0 });\n const onEdgeReachRef = useLatestRef(onEdgeReach);\n\n const measure = useCallback(\n (fromScroll: boolean) => {\n const el = viewportRef.current;\n /* istanbul ignore next: measuring only runs while it's mounted */\n if (!el) return;\n const scrollsY = orientation !== 'horizontal';\n const scrollsX = orientation !== 'vertical';\n const maxTop = el.scrollHeight - el.clientHeight;\n const maxLeft = el.scrollWidth - el.clientWidth;\n const overflowY = scrollsY && maxTop > SLACK;\n const overflowX = scrollsX && maxLeft > SLACK;\n // Right to left, scrollLeft runs from 0 at the start to negative.\n const fromStart = layoutRef.current.rtl\n ? -el.scrollLeft\n : el.scrollLeft;\n const next: Measured = {\n overflowing: overflowY || overflowX,\n edges: {\n top: overflowY && el.scrollTop > SLACK,\n bottom: overflowY && maxTop - el.scrollTop > SLACK,\n start: overflowX && fromStart > SLACK,\n end: overflowX && maxLeft - fromStart > SLACK,\n },\n barInline: layoutRef.current.barInline,\n barBlock: layoutRef.current.barBlock,\n };\n const last = lastRef.current;\n lastRef.current = next;\n if (fromScroll && last) {\n for (const edge of EDGES) {\n if (last.edges[edge] && !next.edges[edge]) {\n onEdgeReachRef.current?.(edge);\n }\n }\n }\n setMeasured(prev => (sameMeasure(prev, next) ? prev : next));\n },\n [orientation, onEdgeReachRef]\n );\n\n // Layout: the direction and the bars' sizes, then the overflow. It runs\n // before paint, and again whenever the viewport or anything in it\n // changes size, or the children change.\n useClientLayoutEffect(() => {\n const el = viewportRef.current;\n /* istanbul ignore next: the effect only runs once it's mounted */\n if (!el) return;\n const relayout = () => {\n const cs = getComputedStyle(el);\n const px = (value: string) => parseFloat(value) || 0;\n layoutRef.current = {\n rtl: cs.direction === 'rtl',\n barInline: Math.max(\n 0,\n el.offsetWidth -\n el.clientWidth -\n px(cs.borderLeftWidth) -\n px(cs.borderRightWidth)\n ),\n barBlock: Math.max(\n 0,\n el.offsetHeight -\n el.clientHeight -\n px(cs.borderTopWidth) -\n px(cs.borderBottomWidth)\n ),\n };\n measure(false);\n };\n relayout();\n if (typeof ResizeObserver === 'undefined') return;\n const resizes = new ResizeObserver(relayout);\n const observeAll = () => {\n resizes.disconnect();\n resizes.observe(el);\n for (const child of Array.from(el.children)) resizes.observe(child);\n };\n observeAll();\n // Content that changes can overflow before any size is reported: a\n // child added or taken away, or text React rewrites in place, which\n // resizes no element when the area's height is fixed, and inline\n // children, which a ResizeObserver doesn't report at all.\n const mutations =\n typeof MutationObserver === 'undefined'\n ? null\n : new MutationObserver(records => {\n if (\n records.some(\n record => record.target === el && record.type === 'childList'\n )\n ) {\n observeAll();\n }\n relayout();\n });\n mutations?.observe(el, {\n childList: true,\n characterData: true,\n subtree: true,\n });\n return () => {\n resizes.disconnect();\n mutations?.disconnect();\n };\n }, [measure]);\n\n const handleScroll = (event: React.UIEvent<HTMLDivElement>) => {\n onScroll?.(event);\n measure(true);\n };\n const handleFocus = (event: React.FocusEvent<HTMLDivElement>) => {\n onFocus?.(event);\n if (event.target === event.currentTarget) setFocused(true);\n };\n const handleBlur = (event: React.FocusEvent<HTMLDivElement>) => {\n onBlur?.(event);\n if (event.target === event.currentTarget) setFocused(false);\n };\n\n // A tab stop while it overflows. Taking tabIndex off the focused element\n // would drop focus to the page, so a viewport that stops overflowing\n // keeps it until focus leaves.\n const isRegion = !!measured?.overflowing || focused;\n // The name goes with the role: ARIA prohibits naming a plain div.\n const {\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby,\n ...viewportRest\n } = rest;\n const edgeAttributes: Record<string, string> = {};\n if (measured) {\n for (const edge of EDGES) {\n if (measured.edges[edge]) edgeAttributes[`data-overflow-${edge}`] = '';\n }\n }\n const viewportStyle = measured\n ? ({\n '--scroll-area-bar-inline-size': `${measured.barInline}px`,\n '--scroll-area-bar-block-size': `${measured.barBlock}px`,\n } as React.CSSProperties)\n : undefined;\n\n return (\n <div\n className={classNames(frameClass, bulmaHelperClasses, className)}\n style={\n height !== undefined || maxHeight !== undefined\n ? {\n ...style,\n // Only what's given, so `maxHeight` alone keeps a height\n // the style sets.\n ...(height !== undefined && { height }),\n ...(maxHeight !== undefined && { maxHeight }),\n }\n : style\n }\n >\n <div\n ref={setRefs}\n className={viewportClass}\n style={viewportStyle}\n {...viewportRest}\n {...edgeAttributes}\n role={isRegion ? 'region' : undefined}\n aria-label={isRegion ? ariaLabel : undefined}\n aria-labelledby={isRegion ? ariaLabelledby : undefined}\n tabIndex={isRegion ? 0 : undefined}\n onScroll={handleScroll}\n onFocus={handleFocus}\n onBlur={handleBlur}\n >\n {children}\n </div>\n </div>\n );\n }\n);\n\nScrollArea.displayName = 'ScrollArea';\n\nexport default ScrollArea;\n"],"names":["_jsx"],"mappings":";;;;;;;;;AA0BA,MAAM,KAAK,GAA8B,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,CAAC;AAE1E;AACA;AACA,MAAM,KAAK,GAAG,CAAC;AAuFf,MAAM,WAAW,GAAG,CAAC,CAAkB,EAAE,CAAW,KAClD,CAAC,CAAC,CAAC;AACH,IAAA,CAAC,CAAC,WAAW,KAAK,CAAC,CAAC,WAAW;AAC/B,IAAA,CAAC,CAAC,SAAS,KAAK,CAAC,CAAC,SAAS;AAC3B,IAAA,CAAC,CAAC,QAAQ,KAAK,CAAC,CAAC,QAAQ;IACzB,KAAK,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AAEtD;;;;;;;;;;;;;;;;;;;;;;;;AAwBG;MACU,UAAU,GAAG,UAAU,CAClC,CACE,EACE,SAAS,EACT,KAAK,EACL,SAAS,EACT,OAAO,EACP,MAAM,EACN,SAAS,EACT,WAAW,GAAG,MAAM,EACpB,cAAc,GAAG,MAAM,EACvB,eAAe,EACf,OAAO,EACP,WAAW,EACX,QAAQ,EACR,OAAO,EACP,MAAM,EACN,QAAQ,EACR,GAAG,KAAK,EACT,EACD,GAAG,KACD;AACF,IAAA,MAAM,EAAE,kBAAkB,EAAE,IAAI,EAAE,GAAG,eAAe,CAAC;AACnD,QAAA,KAAK,EAAE,SAAS;AAChB,QAAA,eAAe,EAAE,OAAO;AACxB,QAAA,GAAG,KAAK;AACT,KAAA,CAAC;AAEF,IAAA,MAAM,UAAU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,cAAE;AACE,gBAAA,GAAG,KAAK;;;gBAGR,IAAI,MAAM,KAAK,SAAS,IAAI,EAAE,MAAM,EAAE,CAAC;gBACvC,IAAI,SAAS,KAAK,SAAS,IAAI,EAAE,SAAS,EAAE,CAAC;AAC9C;AACH,cAAE,KAAK,EAAA,QAAA,EAGXA,GAAA,CAAA,KAAA,EAAA,EACE,GAAG,EAAE,OAAO,EACZ,SAAS,EAAE,aAAa,EACxB,KAAK,EAAE,aAAa,EAAA,GAChB,YAAY,EAAA,GACZ,cAAc,EAClB,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,gBACzB,QAAQ,GAAG,SAAS,GAAG,SAAS,EAAA,iBAAA,EAC3B,QAAQ,GAAG,cAAc,GAAG,SAAS,EACtD,QAAQ,EAAE,QAAQ,GAAG,CAAC,GAAG,SAAS,EAClC,QAAQ,EAAE,YAAY,EACtB,OAAO,EAAE,WAAW,EACpB,MAAM,EAAE,UAAU,EAAA,QAAA,EAEjB,QAAQ,EAAA,CACL,EAAA,CACF;AAEV,CAAC;AAGH,UAAU,CAAC,WAAW,GAAG,YAAY;;"}
1
+ {"version":3,"file":"ScrollArea.js","sources":["../../../src/components/ScrollArea.tsx"],"sourcesContent":["import React, {\n forwardRef,\n useCallback,\n useEffect,\n useRef,\n useState,\n} from 'react';\nimport { classNames, usePrefixedClassNames } from '../helpers/classNames';\nimport {\n useBulmaClasses,\n BulmaClassesProps,\n validColors,\n} from '../helpers/useBulmaClasses';\nimport { useClientLayoutEffect } from '../helpers/useClientLayoutEffect';\nimport { useLatestRef } from '../helpers/useLatestRef';\nimport { warnOnce } from '../helpers/devWarnings';\n\n/** Which way the content scrolls. */\nexport type ScrollAreaOrientation = 'vertical' | 'horizontal' | 'both';\n\n/** When the scrollbars show. */\nexport type ScrollAreaScrollbars = 'auto' | 'hover' | 'always';\n\n/** An edge of the content: the block's top and bottom, the line's start and end. */\nexport type ScrollAreaEdge = 'top' | 'bottom' | 'start' | 'end';\n\nconst EDGES: readonly ScrollAreaEdge[] = ['top', 'bottom', 'start', 'end'];\n\n// Layout can land a fraction of a pixel short of an edge, so anything closer\n// than this counts as there.\nconst SLACK = 1;\n\n/**\n * Props for the ScrollArea component.\n *\n * @helperProps The helper props go on the outer `<div>`, the `.scroll-area`\n * frame, with `className` and `style`. The `ref`, the name, `onScroll` and\n * the other attributes go on the `<div>` inside it, the viewport that\n * scrolls.\n *\n * @extraProp {React.Ref<HTMLDivElement>} [ref] - Ref forwarded to the viewport, the element that scrolls, for `scrollTo` and the like.\n * @extraProp {string} [aria-label] - Names the region, such as \"Release notes\". It needs a name, so pass this or `aria-labelledby`, and a development build warns when it has neither. The name is rendered with the region's role, while the content overflows, since ARIA doesn't allow naming a plain `div`.\n * @extraProp {string} [aria-labelledby] - The id of a visible heading that names the region, in place of `aria-label`.\n * @extraProp {React.UIEventHandler<HTMLDivElement>} [onScroll] - Called as the viewport scrolls.\n */\nexport interface ScrollAreaProps\n extends\n Omit<React.HTMLAttributes<HTMLDivElement>, 'color' | 'role' | 'tabIndex'>,\n Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {\n /** Additional CSS classes for the outer frame. */\n className?: string;\n /** Inline styles for the outer frame. */\n style?: React.CSSProperties;\n /** What scrolls. */\n children?: React.ReactNode;\n /**\n * The area's height. A number is pixels, and a string is any CSS length\n * (`\"20rem\"`, `\"50vh\"`, `\"100%\"`).\n */\n height?: number | string;\n /**\n * The height it grows to with its content, then scrolls past. A number is\n * pixels. Use it in place of `height` for an area that's only as tall as\n * it needs to be.\n */\n maxHeight?: number | string;\n /**\n * Which way it scrolls. `vertical` and `horizontal` clip the other axis,\n * and `both` scrolls whichever overflows.\n */\n orientation?: ScrollAreaOrientation;\n /**\n * When the scrollbars show. `auto`: whenever the content overflows, the\n * way the system shows them. `hover`: colorless until the pointer is over\n * the area or focus is in it, which hides that the area scrolls until\n * then, so keep it for places where the layout makes that plain.\n * `always`: on every axis it scrolls, even when the content fits. Where the\n * system draws its bars over the content (macOS by default, phones and\n * tablets), they still show only while you scroll, and in forced colors\n * they always show.\n */\n showScrollbars?: ScrollAreaScrollbars;\n /**\n * Keeps room for the vertical scrollbar whether or not it shows, so the\n * content doesn't shift when it starts to overflow. It does nothing where\n * the system draws its bars over the content.\n */\n hasStableGutter?: boolean;\n /**\n * Fades the content out toward each edge that has more past it, without\n * fading the scrollbar. It's off in forced colors and when the user asks\n * for more contrast.\n */\n hasFade?: boolean;\n /**\n * Called with the edge when scrolling reaches it, once each time it\n * arrives, such as to load older messages at the top. It isn't called for\n * the edge the area starts at, or when the content changes size.\n */\n onEdgeReach?: (edge: ScrollAreaEdge) => void;\n /** Text color helper. */\n textColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Background color helper. */\n bgColor?: (typeof validColors)[number] | 'inherit' | 'current';\n}\n\n/** What a measurement of the viewport found. */\ninterface Measured {\n /** Overflows on an axis it scrolls. */\n overflowing: boolean;\n /** Each edge that has more content past it. */\n edges: Record<ScrollAreaEdge, boolean>;\n /** The vertical scrollbar's width, and the horizontal one's height. */\n barInline: number;\n barBlock: number;\n}\n\nconst sameMeasure = (a: Measured | null, b: Measured): boolean =>\n !!a &&\n a.overflowing === b.overflowing &&\n a.barInline === b.barInline &&\n a.barBlock === b.barBlock &&\n EDGES.every(edge => a.edges[edge] === b.edges[edge]);\n\n/**\n * The `ScrollArea` component renders a box whose content scrolls inside it, on the browser's own scrollbars in Bulma's colors.\n *\n * The bars are the system's, made thin and colored from Bulma's tokens, so\n * they follow dark mode and keep the system's own settings. While the\n * content overflows, the viewport is a region you can tab to and scroll by\n * keyboard, Safari included, named by `aria-label` or `aria-labelledby`.\n * While it fits, it's a plain box. Setting the bars' colors turns off any\n * `::-webkit-scrollbar` styles inside it.\n *\n * @function\n * @param {ScrollAreaProps} props - Props for the ScrollArea component.\n * @param {React.Ref<HTMLDivElement>} ref - Forwarded ref to the viewport.\n * @returns {JSX.Element} The rendered scroll area.\n *\n * @example\n * <ScrollArea height={240} aria-label=\"Release notes\">\n * <Content>…</Content>\n * </ScrollArea>\n *\n * @example\n * <ScrollArea maxHeight=\"20rem\" aria-label=\"Messages\" hasFade>\n * …\n * </ScrollArea>\n */\nexport const ScrollArea = forwardRef<HTMLDivElement, ScrollAreaProps>(\n (\n {\n className,\n style,\n textColor,\n bgColor,\n height,\n maxHeight,\n orientation = 'both',\n showScrollbars = 'auto',\n hasStableGutter,\n hasFade,\n onEdgeReach,\n onScroll,\n onFocus,\n onBlur,\n children,\n ...props\n },\n ref\n ) => {\n const { bulmaHelperClasses, rest } = useBulmaClasses({\n color: textColor,\n backgroundColor: bgColor,\n ...props,\n });\n\n const frameClass = usePrefixedClassNames('scroll-area', {\n 'is-vertical': orientation === 'vertical',\n 'is-horizontal': orientation === 'horizontal',\n 'has-hover-scrollbars': showScrollbars === 'hover',\n 'has-visible-scrollbars': showScrollbars === 'always',\n 'has-stable-gutter': !!hasStableGutter,\n 'has-fade': !!hasFade,\n });\n const viewportClass = usePrefixedClassNames('scroll-area-viewport');\n\n const named = Boolean(rest['aria-label'] || rest['aria-labelledby']);\n useEffect(() => {\n if (!named) {\n warnOnce(\n 'ScrollArea:unnamed',\n '[bestax-bulma] <ScrollArea> has no accessible name. Pass ' +\n 'aria-label or aria-labelledby, so a screen reader can say what ' +\n 'took focus when the area overflows.'\n );\n }\n }, [named]);\n\n const viewportRef = useRef<HTMLDivElement | null>(null);\n const setRefs = useCallback(\n (node: HTMLDivElement | null) => {\n viewportRef.current = node;\n if (typeof ref === 'function') return ref(node);\n if (ref) ref.current = node;\n },\n [ref]\n );\n\n // Nothing is known about the overflow until the client measures it, so\n // the server renders a plain scroller and hydrates as one.\n const [measured, setMeasured] = useState<Measured | null>(null);\n const [focused, setFocused] = useState(false);\n // The last measurement, read by the scroll handler to see which edges\n // it just reached, and the direction and bar sizes, which only change\n // with layout, so a scroll doesn't read computed styles.\n const lastRef = useRef<Measured | null>(null);\n const layoutRef = useRef({ rtl: false, barInline: 0, barBlock: 0 });\n const onEdgeReachRef = useLatestRef(onEdgeReach);\n\n const measure = useCallback(\n (fromScroll: boolean) => {\n const el = viewportRef.current;\n /* istanbul ignore next: measuring only runs while it's mounted */\n if (!el) return;\n const scrollsY = orientation !== 'horizontal';\n const scrollsX = orientation !== 'vertical';\n const maxTop = el.scrollHeight - el.clientHeight;\n const maxLeft = el.scrollWidth - el.clientWidth;\n const overflowY = scrollsY && maxTop > SLACK;\n const overflowX = scrollsX && maxLeft > SLACK;\n // Right to left, scrollLeft runs from 0 at the start to negative.\n const fromStart = layoutRef.current.rtl\n ? -el.scrollLeft\n : el.scrollLeft;\n const next: Measured = {\n overflowing: overflowY || overflowX,\n edges: {\n top: overflowY && el.scrollTop > SLACK,\n bottom: overflowY && maxTop - el.scrollTop > SLACK,\n start: overflowX && fromStart > SLACK,\n end: overflowX && maxLeft - fromStart > SLACK,\n },\n barInline: layoutRef.current.barInline,\n barBlock: layoutRef.current.barBlock,\n };\n const last = lastRef.current;\n lastRef.current = next;\n if (fromScroll && last) {\n for (const edge of EDGES) {\n if (last.edges[edge] && !next.edges[edge]) {\n onEdgeReachRef.current?.(edge);\n }\n }\n }\n setMeasured(prev => (sameMeasure(prev, next) ? prev : next));\n },\n [orientation, onEdgeReachRef]\n );\n\n // Layout: the direction and the bars' sizes, then the overflow. It runs\n // before paint, and again whenever the viewport or anything in it\n // changes size, or the children change.\n useClientLayoutEffect(() => {\n const el = viewportRef.current;\n /* istanbul ignore next: the effect only runs once it's mounted */\n if (!el) return;\n const relayout = () => {\n const cs = getComputedStyle(el);\n const px = (value: string) => parseFloat(value) || 0;\n layoutRef.current = {\n rtl: cs.direction === 'rtl',\n barInline: Math.max(\n 0,\n el.offsetWidth -\n el.clientWidth -\n px(cs.borderLeftWidth) -\n px(cs.borderRightWidth)\n ),\n barBlock: Math.max(\n 0,\n el.offsetHeight -\n el.clientHeight -\n px(cs.borderTopWidth) -\n px(cs.borderBottomWidth)\n ),\n };\n measure(false);\n };\n relayout();\n if (typeof ResizeObserver === 'undefined') return;\n const resizes = new ResizeObserver(relayout);\n const observeAll = () => {\n resizes.disconnect();\n resizes.observe(el);\n for (const child of Array.from(el.children)) resizes.observe(child);\n };\n observeAll();\n // Content that changes can overflow before any size is reported: a\n // child added or taken away, or text React rewrites in place, which\n // resizes no element when the area's height is fixed, and inline\n // children, which a ResizeObserver doesn't report at all.\n const mutations =\n typeof MutationObserver === 'undefined'\n ? null\n : new MutationObserver(records => {\n if (\n records.some(\n record => record.target === el && record.type === 'childList'\n )\n ) {\n observeAll();\n }\n relayout();\n });\n mutations?.observe(el, {\n childList: true,\n characterData: true,\n subtree: true,\n });\n return () => {\n resizes.disconnect();\n mutations?.disconnect();\n };\n }, [measure]);\n\n const handleScroll = (event: React.UIEvent<HTMLDivElement>) => {\n onScroll?.(event);\n measure(true);\n };\n const handleFocus = (event: React.FocusEvent<HTMLDivElement>) => {\n onFocus?.(event);\n if (event.target === event.currentTarget) setFocused(true);\n };\n const handleBlur = (event: React.FocusEvent<HTMLDivElement>) => {\n onBlur?.(event);\n if (event.target === event.currentTarget) setFocused(false);\n };\n\n // A tab stop while it overflows. Taking tabIndex off the focused element\n // would drop focus to the page, so a viewport that stops overflowing\n // keeps it until focus leaves.\n const isRegion = !!measured?.overflowing || focused;\n // The name goes with the role: ARIA prohibits naming a plain div.\n const {\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby,\n ...viewportRest\n } = rest;\n const edgeAttributes: Record<string, string> = {};\n if (measured) {\n for (const edge of EDGES) {\n if (measured.edges[edge]) edgeAttributes[`data-overflow-${edge}`] = '';\n }\n }\n const viewportStyle = measured\n ? ({\n '--scroll-area-bar-inline-size': `${measured.barInline}px`,\n '--scroll-area-bar-block-size': `${measured.barBlock}px`,\n } as React.CSSProperties)\n : undefined;\n\n return (\n <div\n className={classNames(frameClass, bulmaHelperClasses, className)}\n style={\n height !== undefined || maxHeight !== undefined\n ? {\n ...style,\n // Only what's given, so `maxHeight` alone keeps a height\n // the style sets.\n ...(height !== undefined && { height }),\n ...(maxHeight !== undefined && { maxHeight }),\n }\n : style\n }\n >\n <div\n ref={setRefs}\n className={viewportClass}\n style={viewportStyle}\n {...viewportRest}\n {...edgeAttributes}\n role={isRegion ? 'region' : undefined}\n aria-label={isRegion ? ariaLabel : undefined}\n aria-labelledby={isRegion ? ariaLabelledby : undefined}\n tabIndex={isRegion ? 0 : undefined}\n onScroll={handleScroll}\n onFocus={handleFocus}\n onBlur={handleBlur}\n >\n {children}\n </div>\n </div>\n );\n }\n);\n\nScrollArea.displayName = 'ScrollArea';\n\nexport default ScrollArea;\n"],"names":["_jsx"],"mappings":";;;;;;;;;;AA0BA,MAAM,KAAK,GAA8B,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,CAAC;AAE1E;AACA;AACA,MAAM,KAAK,GAAG,CAAC;AAuFf,MAAM,WAAW,GAAG,CAAC,CAAkB,EAAE,CAAW,KAClD,CAAC,CAAC,CAAC;AACH,IAAA,CAAC,CAAC,WAAW,KAAK,CAAC,CAAC,WAAW;AAC/B,IAAA,CAAC,CAAC,SAAS,KAAK,CAAC,CAAC,SAAS;AAC3B,IAAA,CAAC,CAAC,QAAQ,KAAK,CAAC,CAAC,QAAQ;IACzB,KAAK,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AAEtD;;;;;;;;;;;;;;;;;;;;;;;;AAwBG;MACU,UAAU,GAAG,UAAU,CAClC,CACE,EACE,SAAS,EACT,KAAK,EACL,SAAS,EACT,OAAO,EACP,MAAM,EACN,SAAS,EACT,WAAW,GAAG,MAAM,EACpB,cAAc,GAAG,MAAM,EACvB,eAAe,EACf,OAAO,EACP,WAAW,EACX,QAAQ,EACR,OAAO,EACP,MAAM,EACN,QAAQ,EACR,GAAG,KAAK,EACT,EACD,GAAG,KACD;AACF,IAAA,MAAM,EAAE,kBAAkB,EAAE,IAAI,EA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B,SAAS;IAEb,QACEA,aACE,SAAS,EAAE,UAAU,CAAC,UAAU,EAAE,kBAAkB,EAAE,SAAS,CAAC,EAChE,KAAK,EACH,MAAM,KAAK,SAAS,IAAI,SAAS,KAAK;AACpC,cAAE;AACE,gBAAA,GAAG,KAAK;;;gBAGR,IAAI,MAAM,KAAK,SAAS,IAAI,EAAE,MAAM,EAAE,CAAC;gBACvC,IAAI,SAAS,KAAK,SAAS,IAAI,EAAE,SAAS,EAAE,CAAC;AAC9C;AACH,cAAE,KAAK,EAAA,QAAA,EAGXA,GAAA,CAAA,KAAA,EAAA,EACE,GAAG,EAAE,OAAO,EACZ,SAAS,EAAE,aAAa,EACxB,KAAK,EAAE,aAAa,EAAA,GAChB,YAAY,EAAA,GACZ,cAAc,EAClB,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,gBACzB,QAAQ,GAAG,SAAS,GAAG,SAAS,EAAA,iBAAA,EAC3B,QAAQ,GAAG,cAAc,GAAG,SAAS,EACtD,QAAQ,EAAE,QAAQ,GAAG,CAAC,GAAG,SAAS,EAClC,QAAQ,EAAE,YAAY,EACtB,OAAO,EAAE,WAAW,EACpB,MAAM,EAAE,UAAU,EAAA,QAAA,EAEjB,QAAQ,EAAA,CACL,EAAA,CACF;AAEV,CAAC;AAGH,UAAU,CAAC,WAAW,GAAG,YAAY;;"}
@@ -1,4 +1,5 @@
1
1
  /* @allxsmith/bestax-bulma — AI agents: see AGENTS.md in the package root, or https://bestax.io/llms.txt */
2
+ 'use client';
2
3
  import { jsx } from 'react/jsx-runtime';
3
4
  import { createContext, forwardRef, useState, useCallback, useEffect, useContext, useRef } from 'react';
4
5
  import { Button } from '../elements/Button.js';