@allxsmith/bestax-bulma 5.56.0 → 5.57.1

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 (338) hide show
  1. package/README.md +2 -2
  2. package/dist/esm/columns/Column.js +1 -0
  3. package/dist/esm/columns/Column.js.map +1 -1
  4. package/dist/esm/columns/Columns.js +1 -0
  5. package/dist/esm/columns/Columns.js.map +1 -1
  6. package/dist/esm/components/Avatar.js +1 -0
  7. package/dist/esm/components/Avatar.js.map +1 -1
  8. package/dist/esm/components/Avatars.js +1 -0
  9. package/dist/esm/components/Avatars.js.map +1 -1
  10. package/dist/esm/components/Badge.js +1 -0
  11. package/dist/esm/components/Badge.js.map +1 -1
  12. package/dist/esm/components/Breadcrumb.js +1 -0
  13. package/dist/esm/components/Breadcrumb.js.map +1 -1
  14. package/dist/esm/components/Card.js +1 -0
  15. package/dist/esm/components/Card.js.map +1 -1
  16. package/dist/esm/components/Carousel.js +1 -0
  17. package/dist/esm/components/Carousel.js.map +1 -1
  18. package/dist/esm/components/Collapse.js +1 -0
  19. package/dist/esm/components/Collapse.js.map +1 -1
  20. package/dist/esm/components/Collapses.js +1 -0
  21. package/dist/esm/components/Collapses.js.map +1 -1
  22. package/dist/esm/components/Command.js +1 -0
  23. package/dist/esm/components/Command.js.map +1 -1
  24. package/dist/esm/components/ContextMenu.js +1 -0
  25. package/dist/esm/components/ContextMenu.js.map +1 -1
  26. package/dist/esm/components/DataTable.js +1 -0
  27. package/dist/esm/components/DataTable.js.map +1 -1
  28. package/dist/esm/components/Dialog.js +1 -0
  29. package/dist/esm/components/Dialog.js.map +1 -1
  30. package/dist/esm/components/Dropdown.js +5 -1
  31. package/dist/esm/components/Dropdown.js.map +1 -1
  32. package/dist/esm/components/EmptyState.js +1 -0
  33. package/dist/esm/components/EmptyState.js.map +1 -1
  34. package/dist/esm/components/HoverCard.js +1 -0
  35. package/dist/esm/components/HoverCard.js.map +1 -1
  36. package/dist/esm/components/Loading.js +1 -0
  37. package/dist/esm/components/Loading.js.map +1 -1
  38. package/dist/esm/components/Menu.js +1 -0
  39. package/dist/esm/components/Menu.js.map +1 -1
  40. package/dist/esm/components/Message.js +1 -0
  41. package/dist/esm/components/Message.js.map +1 -1
  42. package/dist/esm/components/Modal.js +1 -0
  43. package/dist/esm/components/Modal.js.map +1 -1
  44. package/dist/esm/components/Navbar.js +1 -0
  45. package/dist/esm/components/Navbar.js.map +1 -1
  46. package/dist/esm/components/Pagination.js +1 -0
  47. package/dist/esm/components/Pagination.js.map +1 -1
  48. package/dist/esm/components/Panel.js +1 -0
  49. package/dist/esm/components/Panel.js.map +1 -1
  50. package/dist/esm/components/Popover.js +1 -0
  51. package/dist/esm/components/Popover.js.map +1 -1
  52. package/dist/esm/components/Reveal.js +1 -0
  53. package/dist/esm/components/Reveal.js.map +1 -1
  54. package/dist/esm/components/ScrollArea.js +1 -0
  55. package/dist/esm/components/ScrollArea.js.map +1 -1
  56. package/dist/esm/components/SegmentedControl.js +1 -0
  57. package/dist/esm/components/SegmentedControl.js.map +1 -1
  58. package/dist/esm/components/Sidebar.js +1 -0
  59. package/dist/esm/components/Sidebar.js.map +1 -1
  60. package/dist/esm/components/Steps.js +1 -0
  61. package/dist/esm/components/Steps.js.map +1 -1
  62. package/dist/esm/components/Tabs.js +1 -0
  63. package/dist/esm/components/Tabs.js.map +1 -1
  64. package/dist/esm/components/Timeline.js +1 -0
  65. package/dist/esm/components/Timeline.js.map +1 -1
  66. package/dist/esm/components/Toast.js +1 -0
  67. package/dist/esm/components/Toast.js.map +1 -1
  68. package/dist/esm/components/Tooltip.js +1 -0
  69. package/dist/esm/components/Tooltip.js.map +1 -1
  70. package/dist/esm/components/TreeView.js +1 -0
  71. package/dist/esm/components/TreeView.js.map +1 -1
  72. package/dist/esm/components/collapsesContext.js +1 -0
  73. package/dist/esm/components/collapsesContext.js.map +1 -1
  74. package/dist/esm/components/useDataTable.js +1 -0
  75. package/dist/esm/components/useDataTable.js.map +1 -1
  76. package/dist/esm/elements/Block.js +1 -0
  77. package/dist/esm/elements/Block.js.map +1 -1
  78. package/dist/esm/elements/Box.js +1 -0
  79. package/dist/esm/elements/Box.js.map +1 -1
  80. package/dist/esm/elements/Button.js +1 -0
  81. package/dist/esm/elements/Button.js.map +1 -1
  82. package/dist/esm/elements/Buttons.js +1 -0
  83. package/dist/esm/elements/Buttons.js.map +1 -1
  84. package/dist/esm/elements/Code.js +1 -0
  85. package/dist/esm/elements/Code.js.map +1 -1
  86. package/dist/esm/elements/ColorSwatch.js +1 -0
  87. package/dist/esm/elements/ColorSwatch.js.map +1 -1
  88. package/dist/esm/elements/Content.js +1 -0
  89. package/dist/esm/elements/Content.js.map +1 -1
  90. package/dist/esm/elements/Delete.js +1 -0
  91. package/dist/esm/elements/Delete.js.map +1 -1
  92. package/dist/esm/elements/DescriptionList.js +1 -0
  93. package/dist/esm/elements/DescriptionList.js.map +1 -1
  94. package/dist/esm/elements/Divider.js +1 -0
  95. package/dist/esm/elements/Divider.js.map +1 -1
  96. package/dist/esm/elements/Emphasis.js +1 -0
  97. package/dist/esm/elements/Emphasis.js.map +1 -1
  98. package/dist/esm/elements/Figure.js +1 -0
  99. package/dist/esm/elements/Figure.js.map +1 -1
  100. package/dist/esm/elements/Icon.js +1 -0
  101. package/dist/esm/elements/Icon.js.map +1 -1
  102. package/dist/esm/elements/IconText.js +1 -0
  103. package/dist/esm/elements/IconText.js.map +1 -1
  104. package/dist/esm/elements/Image.js +1 -0
  105. package/dist/esm/elements/Image.js.map +1 -1
  106. package/dist/esm/elements/Kbd.js +1 -0
  107. package/dist/esm/elements/Kbd.js.map +1 -1
  108. package/dist/esm/elements/Link.js +1 -0
  109. package/dist/esm/elements/Link.js.map +1 -1
  110. package/dist/esm/elements/LinkButton.js +1 -0
  111. package/dist/esm/elements/LinkButton.js.map +1 -1
  112. package/dist/esm/elements/ListItem.js +1 -0
  113. package/dist/esm/elements/ListItem.js.map +1 -1
  114. package/dist/esm/elements/Loader.js +1 -0
  115. package/dist/esm/elements/Loader.js.map +1 -1
  116. package/dist/esm/elements/Notification.js +1 -0
  117. package/dist/esm/elements/Notification.js.map +1 -1
  118. package/dist/esm/elements/OrderedList.js +1 -0
  119. package/dist/esm/elements/OrderedList.js.map +1 -1
  120. package/dist/esm/elements/Paragraph.js +1 -0
  121. package/dist/esm/elements/Paragraph.js.map +1 -1
  122. package/dist/esm/elements/Pre.js +1 -0
  123. package/dist/esm/elements/Pre.js.map +1 -1
  124. package/dist/esm/elements/Progress.js +1 -0
  125. package/dist/esm/elements/Progress.js.map +1 -1
  126. package/dist/esm/elements/RingProgress.js +1 -0
  127. package/dist/esm/elements/RingProgress.js.map +1 -1
  128. package/dist/esm/elements/Skeleton.js +1 -0
  129. package/dist/esm/elements/Skeleton.js.map +1 -1
  130. package/dist/esm/elements/Span.js +1 -0
  131. package/dist/esm/elements/Span.js.map +1 -1
  132. package/dist/esm/elements/Strong.js +1 -0
  133. package/dist/esm/elements/Strong.js.map +1 -1
  134. package/dist/esm/elements/SubTitle.js +1 -0
  135. package/dist/esm/elements/SubTitle.js.map +1 -1
  136. package/dist/esm/elements/Table.js +1 -0
  137. package/dist/esm/elements/Table.js.map +1 -1
  138. package/dist/esm/elements/Tag.js +1 -0
  139. package/dist/esm/elements/Tag.js.map +1 -1
  140. package/dist/esm/elements/Tags.js +1 -0
  141. package/dist/esm/elements/Tags.js.map +1 -1
  142. package/dist/esm/elements/Tbody.js +1 -0
  143. package/dist/esm/elements/Tbody.js.map +1 -1
  144. package/dist/esm/elements/Td.js +1 -0
  145. package/dist/esm/elements/Td.js.map +1 -1
  146. package/dist/esm/elements/Tfoot.js +1 -0
  147. package/dist/esm/elements/Tfoot.js.map +1 -1
  148. package/dist/esm/elements/Th.js +1 -0
  149. package/dist/esm/elements/Th.js.map +1 -1
  150. package/dist/esm/elements/Thead.js +1 -0
  151. package/dist/esm/elements/Thead.js.map +1 -1
  152. package/dist/esm/elements/Title.js +1 -0
  153. package/dist/esm/elements/Title.js.map +1 -1
  154. package/dist/esm/elements/ToggleButton.js +1 -0
  155. package/dist/esm/elements/ToggleButton.js.map +1 -1
  156. package/dist/esm/elements/Tr.js +1 -0
  157. package/dist/esm/elements/Tr.js.map +1 -1
  158. package/dist/esm/elements/UnorderedList.js +1 -0
  159. package/dist/esm/elements/UnorderedList.js.map +1 -1
  160. package/dist/esm/elements/iconProps.js +1 -0
  161. package/dist/esm/elements/iconProps.js.map +1 -1
  162. package/dist/esm/form/Autocomplete.js +1 -0
  163. package/dist/esm/form/Autocomplete.js.map +1 -1
  164. package/dist/esm/form/Checkbox.js +1 -0
  165. package/dist/esm/form/Checkbox.js.map +1 -1
  166. package/dist/esm/form/CheckboxCard.js +1 -0
  167. package/dist/esm/form/CheckboxCard.js.map +1 -1
  168. package/dist/esm/form/Checkboxes.js +1 -0
  169. package/dist/esm/form/Checkboxes.js.map +1 -1
  170. package/dist/esm/form/ColorInput.js +1 -0
  171. package/dist/esm/form/ColorInput.js.map +1 -1
  172. package/dist/esm/form/ColorInputBase.js +1 -0
  173. package/dist/esm/form/ColorInputBase.js.map +1 -1
  174. package/dist/esm/form/ColorPicker.js +1 -0
  175. package/dist/esm/form/ColorPicker.js.map +1 -1
  176. package/dist/esm/form/Combobox.js +1 -0
  177. package/dist/esm/form/Combobox.js.map +1 -1
  178. package/dist/esm/form/Control.js +1 -0
  179. package/dist/esm/form/Control.js.map +1 -1
  180. package/dist/esm/form/DateInput.js +1 -0
  181. package/dist/esm/form/DateInput.js.map +1 -1
  182. package/dist/esm/form/DateInputBase.js +1 -0
  183. package/dist/esm/form/DateInputBase.js.map +1 -1
  184. package/dist/esm/form/DateRangeInput.js +1 -0
  185. package/dist/esm/form/DateRangeInput.js.map +1 -1
  186. package/dist/esm/form/DateRangeInputBase.js +1 -0
  187. package/dist/esm/form/DateRangeInputBase.js.map +1 -1
  188. package/dist/esm/form/DateTimeInput.js +1 -0
  189. package/dist/esm/form/DateTimeInput.js.map +1 -1
  190. package/dist/esm/form/DateTimeInputBase.js +1 -0
  191. package/dist/esm/form/DateTimeInputBase.js.map +1 -1
  192. package/dist/esm/form/Dropzone.js +1 -0
  193. package/dist/esm/form/Dropzone.js.map +1 -1
  194. package/dist/esm/form/Field.js +1 -0
  195. package/dist/esm/form/Field.js.map +1 -1
  196. package/dist/esm/form/Fieldset.js +1 -0
  197. package/dist/esm/form/Fieldset.js.map +1 -1
  198. package/dist/esm/form/File.js +1 -0
  199. package/dist/esm/form/File.js.map +1 -1
  200. package/dist/esm/form/FormContext.js +1 -0
  201. package/dist/esm/form/FormContext.js.map +1 -1
  202. package/dist/esm/form/Input.js +1 -0
  203. package/dist/esm/form/Input.js.map +1 -1
  204. package/dist/esm/form/InputBase.js +1 -0
  205. package/dist/esm/form/InputBase.js.map +1 -1
  206. package/dist/esm/form/Numberinput.js +1 -0
  207. package/dist/esm/form/Numberinput.js.map +1 -1
  208. package/dist/esm/form/PinInput.js +1 -0
  209. package/dist/esm/form/PinInput.js.map +1 -1
  210. package/dist/esm/form/Radio.js +1 -0
  211. package/dist/esm/form/Radio.js.map +1 -1
  212. package/dist/esm/form/RadioCard.js +1 -0
  213. package/dist/esm/form/RadioCard.js.map +1 -1
  214. package/dist/esm/form/Radios.js +1 -0
  215. package/dist/esm/form/Radios.js.map +1 -1
  216. package/dist/esm/form/Rate.js +1 -0
  217. package/dist/esm/form/Rate.js.map +1 -1
  218. package/dist/esm/form/Select.js +1 -0
  219. package/dist/esm/form/Select.js.map +1 -1
  220. package/dist/esm/form/SelectBase.js +1 -0
  221. package/dist/esm/form/SelectBase.js.map +1 -1
  222. package/dist/esm/form/Slider.js +1 -0
  223. package/dist/esm/form/Slider.js.map +1 -1
  224. package/dist/esm/form/Switch.js +1 -0
  225. package/dist/esm/form/Switch.js.map +1 -1
  226. package/dist/esm/form/Taginput.js +1 -0
  227. package/dist/esm/form/Taginput.js.map +1 -1
  228. package/dist/esm/form/TextArea.js +1 -0
  229. package/dist/esm/form/TextArea.js.map +1 -1
  230. package/dist/esm/form/TextAreaBase.js +1 -0
  231. package/dist/esm/form/TextAreaBase.js.map +1 -1
  232. package/dist/esm/form/TimeInput.js +1 -0
  233. package/dist/esm/form/TimeInput.js.map +1 -1
  234. package/dist/esm/form/TimeInputBase.js +1 -0
  235. package/dist/esm/form/TimeInputBase.js.map +1 -1
  236. package/dist/esm/form/_colorInternals/EyeDropperButton.js +1 -0
  237. package/dist/esm/form/_colorInternals/EyeDropperButton.js.map +1 -1
  238. package/dist/esm/form/_colorInternals/pickerState.js +1 -0
  239. package/dist/esm/form/_colorInternals/pickerState.js.map +1 -1
  240. package/dist/esm/form/_pickerInternals/Calendar.js +1 -0
  241. package/dist/esm/form/_pickerInternals/Calendar.js.map +1 -1
  242. package/dist/esm/form/_pickerInternals/PickerPopover.js +1 -0
  243. package/dist/esm/form/_pickerInternals/PickerPopover.js.map +1 -1
  244. package/dist/esm/form/_pickerInternals/TimeWheels.js +1 -0
  245. package/dist/esm/form/_pickerInternals/TimeWheels.js.map +1 -1
  246. package/dist/esm/form/_pickerInternals/useLocaleDefaults.js +1 -0
  247. package/dist/esm/form/_pickerInternals/useLocaleDefaults.js.map +1 -1
  248. package/dist/esm/form/_pickerInternals/useNativeMobilePicker.js +1 -0
  249. package/dist/esm/form/_pickerInternals/useNativeMobilePicker.js.map +1 -1
  250. package/dist/esm/form/_pickerInternals/useSegmentedEntry.js +1 -0
  251. package/dist/esm/form/_pickerInternals/useSegmentedEntry.js.map +1 -1
  252. package/dist/esm/form/controlLoading.js +1 -0
  253. package/dist/esm/form/controlLoading.js.map +1 -1
  254. package/dist/esm/form/groupFieldset.js +1 -0
  255. package/dist/esm/form/groupFieldset.js.map +1 -1
  256. package/dist/esm/form/useAutoLabelId.js +1 -0
  257. package/dist/esm/form/useAutoLabelId.js.map +1 -1
  258. package/dist/esm/grid/Cell.js +1 -0
  259. package/dist/esm/grid/Cell.js.map +1 -1
  260. package/dist/esm/grid/Grid.js +1 -0
  261. package/dist/esm/grid/Grid.js.map +1 -1
  262. package/dist/esm/helpers/ClientOnly.js +1 -0
  263. package/dist/esm/helpers/ClientOnly.js.map +1 -1
  264. package/dist/esm/helpers/Config.js +1 -0
  265. package/dist/esm/helpers/Config.js.map +1 -1
  266. package/dist/esm/helpers/LocaleProvider.js +1 -0
  267. package/dist/esm/helpers/LocaleProvider.js.map +1 -1
  268. package/dist/esm/helpers/Theme.js +1 -0
  269. package/dist/esm/helpers/Theme.js.map +1 -1
  270. package/dist/esm/helpers/flattenChildren.js +1 -0
  271. package/dist/esm/helpers/flattenChildren.js.map +1 -1
  272. package/dist/esm/helpers/inertProps.js +1 -0
  273. package/dist/esm/helpers/inertProps.js.map +1 -1
  274. package/dist/esm/helpers/localeFormat.js +1 -0
  275. package/dist/esm/helpers/localeFormat.js.map +1 -1
  276. package/dist/esm/helpers/overlayStack.js +1 -0
  277. package/dist/esm/helpers/overlayStack.js.map +1 -1
  278. package/dist/esm/helpers/portal.js +1 -0
  279. package/dist/esm/helpers/portal.js.map +1 -1
  280. package/dist/esm/helpers/scrollLock.js +1 -0
  281. package/dist/esm/helpers/scrollLock.js.map +1 -1
  282. package/dist/esm/helpers/statusRegion.js +1 -0
  283. package/dist/esm/helpers/statusRegion.js.map +1 -1
  284. package/dist/esm/helpers/typeahead.js +1 -0
  285. package/dist/esm/helpers/typeahead.js.map +1 -1
  286. package/dist/esm/helpers/useAnchoredPosition.js +1 -0
  287. package/dist/esm/helpers/useAnchoredPosition.js.map +1 -1
  288. package/dist/esm/helpers/useBulmaClasses.js +1 -0
  289. package/dist/esm/helpers/useBulmaClasses.js.map +1 -1
  290. package/dist/esm/helpers/useClientLayoutEffect.js +1 -0
  291. package/dist/esm/helpers/useClientLayoutEffect.js.map +1 -1
  292. package/dist/esm/helpers/useColorClasses.js +1 -0
  293. package/dist/esm/helpers/useColorClasses.js.map +1 -1
  294. package/dist/esm/helpers/useComboboxEngine.js +1 -0
  295. package/dist/esm/helpers/useComboboxEngine.js.map +1 -1
  296. package/dist/esm/helpers/useContextMenuTrigger.js +1 -0
  297. package/dist/esm/helpers/useContextMenuTrigger.js.map +1 -1
  298. package/dist/esm/helpers/useFlexboxClasses.js +1 -0
  299. package/dist/esm/helpers/useFlexboxClasses.js.map +1 -1
  300. package/dist/esm/helpers/useFocusTrap.js +1 -0
  301. package/dist/esm/helpers/useFocusTrap.js.map +1 -1
  302. package/dist/esm/helpers/useHoverOpen.js +1 -0
  303. package/dist/esm/helpers/useHoverOpen.js.map +1 -1
  304. package/dist/esm/helpers/useInertSiblings.js +1 -0
  305. package/dist/esm/helpers/useInertSiblings.js.map +1 -1
  306. package/dist/esm/helpers/useIsHydrated.js +1 -0
  307. package/dist/esm/helpers/useIsHydrated.js.map +1 -1
  308. package/dist/esm/helpers/useLatestRef.js +1 -0
  309. package/dist/esm/helpers/useLatestRef.js.map +1 -1
  310. package/dist/esm/helpers/useMenuKeys.js +1 -0
  311. package/dist/esm/helpers/useMenuKeys.js.map +1 -1
  312. package/dist/esm/helpers/useOtherClasses.js +1 -0
  313. package/dist/esm/helpers/useOtherClasses.js.map +1 -1
  314. package/dist/esm/helpers/useSpacingClasses.js +1 -0
  315. package/dist/esm/helpers/useSpacingClasses.js.map +1 -1
  316. package/dist/esm/helpers/useTreeView.js +1 -0
  317. package/dist/esm/helpers/useTreeView.js.map +1 -1
  318. package/dist/esm/helpers/useTypographyClasses.js +1 -0
  319. package/dist/esm/helpers/useTypographyClasses.js.map +1 -1
  320. package/dist/esm/helpers/useVisibilityClasses.js +1 -0
  321. package/dist/esm/helpers/useVisibilityClasses.js.map +1 -1
  322. package/dist/esm/layout/Container.js +1 -0
  323. package/dist/esm/layout/Container.js.map +1 -1
  324. package/dist/esm/layout/Footer.js +1 -0
  325. package/dist/esm/layout/Footer.js.map +1 -1
  326. package/dist/esm/layout/Hero.js +1 -0
  327. package/dist/esm/layout/Hero.js.map +1 -1
  328. package/dist/esm/layout/Level.js +1 -0
  329. package/dist/esm/layout/Level.js.map +1 -1
  330. package/dist/esm/layout/Media.js +1 -0
  331. package/dist/esm/layout/Media.js.map +1 -1
  332. package/dist/esm/layout/Section.js +1 -0
  333. package/dist/esm/layout/Section.js.map +1 -1
  334. package/dist/esm/layout/Splitter.js +1 -0
  335. package/dist/esm/layout/Splitter.js.map +1 -1
  336. package/dist/index.cjs +4 -1
  337. package/dist/index.cjs.map +1 -1
  338. package/package.json +28 -27
@@ -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 { jsxs, jsx, Fragment } from 'react/jsx-runtime';
3
4
  import { createContext, forwardRef, useState, useRef, useCallback, useEffect, useContext, useId } from 'react';
4
5
  import { usePrefixedClassNames, classNames } from '../helpers/classNames.js';
@@ -1 +1 @@
1
- {"version":3,"file":"Command.js","sources":["../../../src/components/Command.tsx"],"sourcesContent":["import React, {\n createContext,\n forwardRef,\n useCallback,\n useContext,\n useEffect,\n useId,\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 { useClientLayoutEffect } from '../helpers/useClientLayoutEffect';\nimport { useLatestRef } from '../helpers/useLatestRef';\nimport { flattenChildren } from '../helpers/flattenChildren';\nimport { warnOnce } from '../helpers/devWarnings';\nimport { useLocaleMatcher, type TextMatcher } from '../helpers/localeFormat';\nimport { isModalOverlayOpen } from '../helpers/overlayStack';\nimport { StatusRegion, spokenText } from '../helpers/statusRegion';\nimport {\n ComboboxEngine,\n useComboboxEngine,\n} from '../helpers/useComboboxEngine';\nimport { Input, InputProps } from '../form/Input';\nimport { Modal } from './Modal';\n\n/** What names a Command that's given no `label`. */\nconst defaultLabel = 'Commands';\n\n/** What a Command given `actions` shows when nothing matches, unless it's given `empty`. */\nconst defaultEmpty = 'No results';\n\n// What the status region announces: the `Command.Empty` content, as the one\n// item it's handed while that content is on screen because of the user's\n// typing.\nconst typedNoMatches = [{ id: 'empty' }];\nconst nothingToAnnounce: Array<{ id: string }> = [];\n\n/** Whether a slot was given something to show. */\nconst isShown = (node: React.ReactNode): boolean =>\n node !== undefined && node !== null && node !== false && node !== '';\n\n/** One action in a Command's `actions`. */\nexport interface CommandAction {\n /** Unique within the Command. It's the item's `value`, so `onSelect` hands it back. */\n id: string;\n /** What the item shows, and what typing matches first. */\n label: string;\n /**\n * A line under the label, such as what the action does or where it goes.\n * Typing matches it too, after the labels. A screen reader hears it after\n * the label, as the item's description.\n */\n description?: string;\n /**\n * More words typing matches, after the labels, such as `['theme']` for\n * \"Dark mode\". They aren't shown.\n */\n keywords?: string[];\n /**\n * The heading the action goes under. Groups show in the order the matches\n * first name them, so the best match is always on top, and the actions with\n * no group show together where the first of them is.\n */\n group?: string;\n /** Shown before the label, and hidden from assistive tech. */\n icon?: React.ReactNode;\n /**\n * Shown at the end of the row, such as the action's own keyboard shortcut in\n * a `Kbd.Group`, or a `Tag`. It only shows: nothing listens for a shortcut\n * written here. A screen reader hears it after the label, with the\n * description.\n */\n hint?: React.ReactNode;\n /** Shown, and reached with the arrows so a screen reader user finds it, but never run. */\n disabled?: boolean;\n /** Runs the action, when it's picked with Enter or a click, before the Command's `onSelect`. */\n onSelect?: () => void;\n}\n\n/** What a Command takes whether it's given `actions` or built from parts. */\ninterface CommandBaseProps\n extends\n Omit<React.HTMLAttributes<HTMLDivElement>, 'color' | 'onSelect'>,\n Omit<BulmaClassesProps, 'color'> {\n /**\n * What the Command is for, such as \"Commands\" or \"Settings\". It's never\n * shown: it names the search field and the list for assistive tech, and in\n * `Command.Dialog` the dialog too. An empty string counts as none.\n * @defaultValue 'Commands'\n */\n label?: string;\n /**\n * The search, controlled: the text in the field. Pair it with\n * `onQueryChange`.\n */\n query?: string;\n /**\n * The search to start with when uncontrolled.\n * @defaultValue ''\n */\n defaultQuery?: string;\n /**\n * Called with the search as the user types it. Built from parts, this is\n * where the app filters its items.\n */\n onQueryChange?: (query: string) => void;\n /**\n * Called with the picked item's `value`, an action's `id`, when it's run\n * with Enter or a click, after the item's own `onSelect`. A disabled item\n * is never run.\n */\n onSelect?: (value: string) => void;\n}\n\n/** Props for a Command given `actions`. */\nexport interface CommandActionsProps extends CommandBaseProps {\n /**\n * The actions, for a Command that renders the field, the list, the groups\n * and the empty message itself. Typing filters them by label, keywords and\n * description, ignoring case, with label matches first. Inside a\n * `LocaleProvider` with a `locale`, it ignores accents too where that\n * language does, so \"cafe\" finds \"Café\". Leave it out to build the\n * Command from parts.\n */\n actions: CommandAction[];\n /**\n * Takes over the filtering, with `actions`: it's handed the search as typed\n * and every action, and returns the ones to show, in the order to show\n * them, which is how to plug in fuzzy matching or cut the list short. It's\n * called with an empty search too.\n */\n filter?: (query: string, actions: CommandAction[]) => CommandAction[];\n /** The field's placeholder, with `actions`. */\n placeholder?: string;\n /**\n * What shows in place of the list, with `actions`, when nothing matches.\n * It's announced the way `Command.Empty` is. `null` shows nothing.\n * @defaultValue 'No results'\n */\n empty?: React.ReactNode;\n /** @internal With `actions`, the Command renders its own parts. */\n children?: never;\n}\n\n/** Props for a Command built from parts. */\nexport interface CommandPartsProps extends CommandBaseProps {\n /**\n * The parts, in order: `Command.Input`, then `Command.List` while there are\n * items and `Command.Empty` while there aren't. Nothing filters them, so\n * render the items that match the search `onQueryChange` reports. With\n * `actions` there are none to give: children given with it are ignored,\n * with a warning in development.\n */\n children?: React.ReactNode;\n /** @internal Built from parts, the app renders the items. */\n actions?: never;\n /** @internal Built from parts, the app filters. */\n filter?: never;\n /** @internal Built from parts, `Command.Input` takes the placeholder. */\n placeholder?: never;\n /** @internal Built from parts, `Command.Empty` is the empty message. */\n empty?: never;\n}\n\n/**\n * Props for the Command component: given `actions`, it renders, filters and\n * groups them itself, and without them it's built from parts. The helper\n * props, the other attributes and the `ref` land on the `div.command` around\n * the field and the list.\n *\n * @extraProp {React.Ref<HTMLDivElement>} [ref] - Ref forwarded to the `div.command` around the field and the list.\n */\nexport type CommandProps = CommandActionsProps | CommandPartsProps;\n\n/** What Command.Dialog takes on top of a Command's props. */\ninterface CommandDialogOwnProps {\n /** Controlled open state. When set, opening and closing only report through `onOpenChange`. */\n open?: boolean;\n /**\n * Initial open state when uncontrolled.\n * @defaultValue false\n */\n defaultOpen?: boolean;\n /**\n * Called with the open state asked for: `true` from the `shortcut`, and\n * `false` from Escape, a click on the background, or a pick while\n * `closeOnSelect` is on. Fires in controlled and uncontrolled use.\n */\n onOpenChange?: (open: boolean) => void;\n /**\n * A key combination that opens the dialog from anywhere on the page, such\n * as `\"mod+k\"`: modifiers and a key joined by `+`, where `mod` is Ctrl or\n * ⌘ (either one, on every platform), and the others are `ctrl`, `meta`,\n * `alt` and `shift`. It's ignored while the user is typing in a text field,\n * a select or editable content, while an IME is composing, while a modal\n * overlay is open (a `Modal`, a `Dialog`, a `Sidebar` with its overlay or a\n * full-page `Loading`), and when something else has already used the key.\n * It only opens the dialog. Off unless given.\n */\n shortcut?: string;\n /**\n * Closes the dialog once an item has run. Turn it off for an item that\n * opens another page of the palette, and close it yourself with `open`.\n * @defaultValue true\n */\n closeOnSelect?: boolean;\n /**\n * Clears the search when the dialog closes: an uncontrolled one itself,\n * and a controlled one through `onQueryChange('')`.\n * @defaultValue true\n */\n clearOnClose?: boolean;\n /**\n * Renders the dialog into a portal target instead of inline. Forwarded to\n * the underlying `Modal`; see its `portal` prop for the accepted values.\n * @defaultValue false\n */\n portal?: boolean | string | HTMLElement;\n}\n\n/** Props for a Command.Dialog given `actions`. */\nexport interface CommandDialogActionsProps\n extends CommandActionsProps, CommandDialogOwnProps {}\n\n/** Props for a Command.Dialog built from parts. */\nexport interface CommandDialogPartsProps\n extends CommandPartsProps, CommandDialogOwnProps {}\n\n/**\n * Props for Command.Dialog, the Command in a modal: a Command's props, given\n * `actions` or built from parts, and the dialog's own. The helper props, the\n * other attributes and the `ref` land on the `div.command` that is the\n * dialog.\n *\n * @extraProp {React.Ref<HTMLDivElement>} [ref] - Ref forwarded to the `div.command` that is the dialog.\n */\nexport type CommandDialogProps =\n CommandDialogActionsProps | CommandDialogPartsProps;\n\n/**\n * Props for Command.Input, the search field. It renders `Input`, so its\n * icons, `isLoading` and `color` work as they do there. Its text is the\n * Command's `query`, and it's `autoComplete=\"off\"`, so the browser's own\n * suggestions don't open over the list: neither is yours to set.\n */\nexport type CommandInputProps = Omit<\n InputProps,\n // By name, since the docs read only names out of an Omit. The Field props:\n | 'label'\n | 'labelSize'\n | 'labelProps'\n | 'horizontal'\n | 'message'\n | 'messageColor'\n | 'fieldClassName'\n // And what the Command sets on the field itself:\n | 'role'\n | 'autoComplete'\n | 'value'\n | 'defaultValue'\n>;\n\n/**\n * Props for Command.List, the list. Its `id` is the one the field's\n * `aria-controls` names, so it isn't yours to set.\n */\nexport interface CommandListProps extends Omit<\n React.HTMLAttributes<HTMLDivElement>,\n 'role' | 'id'\n> {\n /** `Command.Item`s and `Command.Group`s, in the order they're shown. */\n children?: React.ReactNode;\n}\n\n/** Props for Command.Group, items under a heading. */\nexport interface CommandGroupProps extends Omit<\n React.HTMLAttributes<HTMLDivElement>,\n 'role'\n> {\n /**\n * The heading, which also names the group for assistive tech, unless you\n * give the group an `aria-label` or `aria-labelledby` of its own.\n */\n label: React.ReactNode;\n /** The group's `Command.Item`s. */\n children?: React.ReactNode;\n}\n\n/**\n * Props for Command.Item, one thing to do in the list. Its `id` follows from\n * its `value`, since the field's `aria-activedescendant` names it, so it\n * isn't yours to set.\n */\nexport interface CommandItemProps extends Omit<\n React.HTMLAttributes<HTMLDivElement>,\n 'role' | 'onSelect' | 'id'\n> {\n /** What the Command's `onSelect` hands back. Unique within the Command. */\n value: string;\n /**\n * Can't be run. The arrows still reach it, so a screen reader user finds\n * it, and it's never `aria-selected`.\n * @defaultValue false\n */\n disabled?: boolean;\n /** Runs the item, when it's picked with Enter or a click, before the Command's `onSelect`. */\n onSelect?: () => void;\n /** Shown before the label, and hidden from assistive tech. */\n icon?: React.ReactNode;\n /**\n * A line under the label. A screen reader hears it after the label, as the\n * item's description.\n */\n description?: React.ReactNode;\n /**\n * Shown at the end of the row, such as a keyboard shortcut in a\n * `Kbd.Group`, or a `Tag`. It only shows. A screen reader hears it after\n * the label, with the description.\n */\n hint?: React.ReactNode;\n /** The label, which names the item. */\n children?: React.ReactNode;\n}\n\n/** Props for Command.Empty, the message shown in place of the list. */\nexport interface CommandEmptyProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * The message, such as \"No commands match\". Its text is announced when\n * typing brings it on screen and isn't read again while it stays, so a\n * message that names the search is heard for the first search only.\n */\n children?: React.ReactNode;\n}\n\n/** A handler an item registers, read when it's run. */\ntype ItemHandler = { readonly current: (() => void) | undefined };\n\n/** What the Command hands its parts. */\ninterface CommandContextValue {\n engine: ComboboxEngine;\n /** What names the field and the list. */\n label: string;\n /** The search. */\n query: string;\n /** A change to the field's value, which is the user typing. */\n onFieldChange: (value: string) => void;\n /** Tells the Command the field's `isLoading`, which holds the empty message's announcement. */\n reportLoading: (loading: boolean) => void;\n /** Records the empty message while it's on screen. Returns the function that forgets it. */\n reportEmpty: (element: HTMLElement) => () => void;\n /** Records an item's `onSelect`. Returns the function that forgets it. */\n registerHandler: (value: string, handler: ItemHandler) => () => void;\n}\n\nconst noop = () => {};\nconst registerNothing = () => noop;\n\n// What a part rendered outside a Command reads: nothing to report to, so it\n// renders its markup and does nothing.\nconst standalone: CommandContextValue = {\n engine: {\n open: false,\n expanded: false,\n highlighted: null,\n typed: false,\n listboxId: '',\n itemId: () => '',\n rootRef: { current: null },\n inputRef: { current: null },\n listboxRef: { current: null },\n registerPopup: registerNothing,\n registerItem: registerNothing,\n onKeyDown: noop,\n onChange: noop,\n onClick: noop,\n onBlur: noop,\n hover: noop,\n pick: noop,\n keepFocus: noop,\n markInside: noop,\n },\n label: defaultLabel,\n query: '',\n onFieldChange: noop,\n reportLoading: noop,\n reportEmpty: registerNothing,\n registerHandler: registerNothing,\n};\n\nconst CommandContext = createContext<CommandContextValue | null>(null);\n\nconst useCommand = () => useContext(CommandContext) ?? standalone;\n\n/** Hands a node to a forwarded ref and to one of the component's own. */\nfunction setRefs<T>(\n node: T | null,\n own: React.MutableRefObject<T | null>,\n forwarded: React.ForwardedRef<T>\n) {\n own.current = node;\n if (typeof forwarded === 'function') forwarded(node);\n else if (forwarded) forwarded.current = node;\n}\n\n/**\n * The default filter: the actions whose label, keywords or description hold\n * the search, ignoring case and the spaces around it, label matches first and\n * the order otherwise kept. An empty search keeps them all. `matchText`, a\n * `LocaleProvider`'s locale-aware matcher, replaces the lowercased\n * comparison when there is one.\n */\nconst filterActions = (\n query: string,\n actions: CommandAction[],\n matchText?: TextMatcher | null\n): CommandAction[] => {\n const search = query.trim();\n if (search === '') return actions;\n const term = search.toLowerCase();\n const holds = matchText\n ? (text: string) => matchText(text, search)\n : (text: string) => text.toLowerCase().includes(term);\n const byLabel: CommandAction[] = [];\n const byOther: CommandAction[] = [];\n for (const action of actions) {\n if (holds(action.label)) {\n byLabel.push(action);\n } else if (\n (action.description !== undefined && holds(action.description)) ||\n action.keywords?.some(holds)\n ) {\n byOther.push(action);\n }\n }\n return [...byLabel, ...byOther];\n};\n\n/** The search icon at the start of the field. */\nconst SearchIcon = () => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"1.75\"\n strokeLinecap=\"round\"\n width=\"1em\"\n height=\"1em\"\n focusable=\"false\"\n >\n <circle cx=\"7\" cy=\"7\" r=\"4.75\" />\n <path d=\"M10.5 10.5L14 14\" />\n </svg>\n);\n\n/**\n * The Command built from parts: the field, the list, the keys and the run,\n * with the items and their filtering left to the app.\n */\nconst CommandParts = forwardRef<HTMLDivElement, CommandPartsProps>(\n (\n {\n children,\n label,\n query: controlledQuery,\n defaultQuery = '',\n onQueryChange,\n onSelect,\n className,\n ...props\n },\n ref\n ) => {\n const [ownQuery, setOwnQuery] = useState(defaultQuery);\n const query = controlledQuery ?? ownQuery;\n\n // Each item's `onSelect`, by value, read when it runs.\n const handlersRef = useRef(new Map<string, ItemHandler>());\n const registerHandler = useCallback(\n (value: string, handler: ItemHandler) => {\n const handlers = handlersRef.current;\n handlers.set(value, handler);\n return () => {\n if (handlers.get(value) === handler) handlers.delete(value);\n };\n },\n []\n );\n const run = (value: string) => {\n handlersRef.current.get(value)?.current?.();\n onSelect?.(value);\n };\n\n // Inline: the list is always on screen, nothing opens or closes it, and\n // Escape goes on to what's around it. `keepFirst` keeps the highlight on\n // the top match, so Enter runs it.\n const engine = useComboboxEngine({\n defaultOpen: true,\n onSelect: run,\n keepFirst: true,\n multiple: false,\n inline: true,\n deferred: false,\n });\n const { bulmaHelperClasses, rest } = useBulmaClasses(props);\n const rootClass = usePrefixedClassNames('command');\n\n // A polite status region, in the page from the start so it's there\n // before anything is written into it, announces `Command.Empty` when the\n // user's typing leaves it on screen: once each time that happens, not\n // again on each keystroke while it stays. An empty search isn't a search,\n // so it stays quiet then, and while the field's `isLoading` says results\n // are on their way, it waits.\n const [inputLoading, setInputLoading] = useState(false);\n const emptyRef = useRef<HTMLElement | null>(null);\n const [emptyShown, setEmptyShown] = useState(false);\n const announced =\n engine.typed && query !== '' && emptyShown && !inputLoading\n ? typedNoMatches\n : nothingToAnnounce;\n // The region reads the text on screen, whatever the message renders.\n const describeEmpty = useCallback(() => {\n const node = emptyRef.current;\n /* istanbul ignore if: it's only announced while it's on screen */\n if (!node) return null;\n return spokenText(node);\n }, []);\n const reportEmpty = useCallback((element: HTMLElement) => {\n emptyRef.current = element;\n setEmptyShown(true);\n return () => {\n emptyRef.current = null;\n setEmptyShown(false);\n };\n }, []);\n\n const onFieldChange = (value: string) => {\n if (controlledQuery === undefined) setOwnQuery(value);\n onQueryChange?.(value);\n engine.onChange();\n };\n\n // A new value each render: the engine's state and handlers are, and the\n // parts read the highlight from it.\n const context: CommandContextValue = {\n engine,\n label: label || defaultLabel,\n query,\n onFieldChange,\n reportLoading: setInputLoading,\n reportEmpty,\n registerHandler,\n };\n\n const { rootRef } = engine;\n const rootRefs = useCallback(\n (node: HTMLDivElement | null) => setRefs(node, rootRef, ref),\n [rootRef, ref]\n );\n\n return (\n // The ref after the spread, so the element stays the Command's.\n <div\n className={classNames(rootClass, bulmaHelperClasses, className)}\n {...rest}\n ref={rootRefs}\n >\n <CommandContext.Provider value={context}>\n {children}\n </CommandContext.Provider>\n <StatusRegion items={announced} describe={describeEmpty} />\n </div>\n );\n }\n);\nCommandParts.displayName = 'CommandParts';\n\n/**\n * The search field, with the combobox role and the keys, rendered as an `Input` with a search icon.\n *\n * @function\n * @param {CommandInputProps} props - Props for the Command.Input component.\n * @param {React.Ref<HTMLInputElement>} ref - Forwarded ref to the `<input>`.\n * @returns {JSX.Element} The field in its Control.\n */\nexport const CommandInput = forwardRef<HTMLInputElement, CommandInputProps>(\n (\n {\n isLoading,\n iconLeft,\n iconLeftName,\n onKeyDown,\n onChange,\n onClick,\n onBlur,\n 'aria-autocomplete': ariaAutocomplete,\n ...props\n },\n ref\n ) => {\n const context = useCommand();\n const { engine, reportLoading } = context;\n useClientLayoutEffect(() => {\n reportLoading(!!isLoading);\n return () => reportLoading(false);\n }, [reportLoading, isLoading]);\n const { inputRef } = engine;\n const inputRefs = useCallback(\n (node: HTMLInputElement | null) => setRefs(node, inputRef, ref),\n [inputRef, ref]\n );\n const { expanded, highlighted } = engine;\n // A name the caller gave the field wins over the Command's `label`.\n const callerNamed = !!props['aria-label'] || 'aria-labelledby' in props;\n\n return (\n // The attributes the Command owns after the caller's, so a stray\n // `aria-expanded` never wins. A search isn't prose, so the browser's\n // spelling and autocorrect stay out of it unless the caller asks.\n <Input\n autoCorrect=\"off\"\n spellCheck={false}\n {...props}\n ref={inputRefs}\n value={context.query}\n iconLeft={\n iconLeft === undefined && !iconLeftName ? <SearchIcon /> : iconLeft\n }\n iconLeftName={iconLeftName}\n isLoading={isLoading}\n aria-label={callerNamed ? props['aria-label'] : context.label}\n role=\"combobox\"\n aria-autocomplete={ariaAutocomplete ?? 'list'}\n aria-haspopup=\"listbox\"\n aria-expanded={expanded}\n aria-controls={expanded ? engine.listboxId : undefined}\n aria-activedescendant={\n expanded && highlighted !== null\n ? engine.itemId(highlighted)\n : undefined\n }\n autoComplete=\"off\"\n onKeyDown={event => {\n onKeyDown?.(event);\n engine.onKeyDown(event);\n }}\n onChange={event => {\n onChange?.(event);\n context.onFieldChange(event.target.value);\n }}\n onClick={event => {\n onClick?.(event);\n if (!event.defaultPrevented) engine.onClick();\n }}\n onBlur={event => {\n onBlur?.(event);\n engine.onBlur(event);\n }}\n />\n );\n }\n);\nCommandInput.displayName = 'CommandInput';\n\n/**\n * The list of items, a `listbox` named by the Command's `label`.\n *\n * @function\n * @param {CommandListProps} props - Props for the Command.List component.\n * @returns {JSX.Element} The listbox.\n */\nexport const CommandList: React.FC<CommandListProps> = ({\n children,\n className,\n onMouseDown,\n ...props\n}) => {\n const { engine, label } = useCommand();\n const { listboxRef, listboxId, keepFocus } = engine;\n const listClass = usePrefixedClassNames('command-list');\n // A name the caller gave the list wins over the Command's.\n const callerNamed = !!props['aria-label'] || 'aria-labelledby' in props;\n return (\n <div\n className={classNames(listClass, className)}\n {...props}\n ref={listboxRef}\n id={listboxId || undefined}\n role=\"listbox\"\n aria-label={callerNamed ? props['aria-label'] : label}\n onMouseDown={event => {\n onMouseDown?.(event);\n keepFocus(event);\n }}\n >\n {children}\n </div>\n );\n};\nCommandList.displayName = 'CommandList';\n\n/**\n * Items under a heading, a `group` named by it.\n *\n * @function\n * @param {CommandGroupProps} props - Props for the Command.Group component.\n * @returns {JSX.Element} The group and its heading.\n */\nexport const CommandGroup: React.FC<CommandGroupProps> = ({\n label,\n children,\n className,\n ...props\n}) => {\n const labelId = useId();\n const groupClass = usePrefixedClassNames('command-group');\n const labelClass = usePrefixedClassNames('command-group-label');\n // A name the caller gave the group wins over its heading's, as on the list.\n const callerNamed = !!props['aria-label'] || 'aria-labelledby' in props;\n return (\n <div\n className={classNames(groupClass, className)}\n {...props}\n role=\"group\"\n aria-labelledby={callerNamed ? props['aria-labelledby'] : labelId}\n >\n <div className={labelClass} id={labelId}>\n {label}\n </div>\n {children}\n </div>\n );\n};\nCommandGroup.displayName = 'CommandGroup';\n\n/**\n * One thing to do in the list, named by its label and described by its description and hint.\n *\n * @function\n * @param {CommandItemProps} props - Props for the Command.Item component.\n * @returns {JSX.Element} The item.\n */\nexport const CommandItem: React.FC<CommandItemProps> = ({\n value,\n disabled = false,\n onSelect,\n icon,\n description,\n hint,\n children,\n className,\n onClick,\n onPointerMove,\n ...props\n}) => {\n const { engine, registerHandler } = useCommand();\n const itemRef = useRef<HTMLDivElement>(null);\n const { registerItem } = engine;\n useClientLayoutEffect(\n () =>\n registerItem(itemRef.current as HTMLDivElement, {\n value,\n disabled,\n checked: false,\n }),\n [registerItem, value, disabled]\n );\n const onSelectRef = useLatestRef(onSelect);\n useClientLayoutEffect(\n () => registerHandler(value, onSelectRef),\n [registerHandler, value, onSelectRef]\n );\n const highlighted = engine.highlighted === value;\n const itemClass = usePrefixedClassNames('command-item', {\n 'is-active': highlighted,\n 'is-disabled': disabled,\n });\n const iconClass = usePrefixedClassNames('command-item-icon');\n const bodyClass = usePrefixedClassNames('command-item-body');\n const labelClass = usePrefixedClassNames('command-item-label');\n const descriptionClass = usePrefixedClassNames('command-item-description');\n const hintClass = usePrefixedClassNames('command-item-hint');\n\n // Named by its label alone, so a screen reader says what it does before\n // the rest, and described by the description and the hint.\n const baseId = useId();\n const labelId = `${baseId}label`;\n const descriptionId = isShown(description)\n ? `${baseId}description`\n : undefined;\n const hintId = isShown(hint) ? `${baseId}hint` : undefined;\n const describedBy =\n [descriptionId, hintId].filter(Boolean).join(' ') || undefined;\n const callerNamed = !!props['aria-label'] || 'aria-labelledby' in props;\n\n return (\n <div\n className={classNames(itemClass, className)}\n aria-describedby={describedBy}\n {...props}\n ref={itemRef}\n id={engine.itemId(value) || undefined}\n role=\"option\"\n // The highlighted option, as the ARIA Authoring Practices' combobox\n // has it, and no attribute on the rest. Never a disabled option.\n aria-selected={disabled ? undefined : highlighted || undefined}\n aria-disabled={disabled || undefined}\n aria-labelledby={callerNamed ? props['aria-labelledby'] : labelId}\n onClick={event => {\n onClick?.(event);\n if (!disabled && !event.defaultPrevented) engine.pick(value);\n }}\n onPointerMove={event => {\n onPointerMove?.(event);\n if (!disabled && !highlighted) engine.hover(value);\n }}\n >\n {isShown(icon) && (\n <span className={iconClass} aria-hidden=\"true\">\n {icon}\n </span>\n )}\n <span className={bodyClass}>\n <span className={labelClass} id={labelId}>\n {children}\n </span>\n {descriptionId && (\n <span className={descriptionClass} id={descriptionId}>\n {description}\n </span>\n )}\n </span>\n {hintId && (\n <span className={hintClass} id={hintId}>\n {hint}\n </span>\n )}\n </div>\n );\n};\nCommandItem.displayName = 'CommandItem';\n\n/**\n * The message shown in place of the list when nothing matches, announced when typing brings it on screen.\n *\n * @function\n * @param {CommandEmptyProps} props - Props for the Command.Empty component.\n * @returns {JSX.Element} The message.\n */\nexport const CommandEmpty: React.FC<CommandEmptyProps> = ({\n children,\n className,\n onMouseDown,\n ...props\n}) => {\n const { engine, reportEmpty } = useCommand();\n const emptyRef = useRef<HTMLDivElement>(null);\n useClientLayoutEffect(\n () => reportEmpty(emptyRef.current as HTMLDivElement),\n [reportEmpty]\n );\n const emptyClass = usePrefixedClassNames('command-empty');\n return (\n <div\n className={classNames(emptyClass, className)}\n {...props}\n ref={emptyRef}\n onMouseDown={event => {\n onMouseDown?.(event);\n engine.keepFocus(event);\n }}\n >\n {children}\n </div>\n );\n};\nCommandEmpty.displayName = 'CommandEmpty';\n\n/** What a Command given `actions` renders inside its parts root. */\ninterface CommandActionsContentProps {\n actions: CommandAction[];\n filter: CommandActionsProps['filter'];\n placeholder: string | undefined;\n empty: React.ReactNode;\n}\n\n/**\n * The field, and the actions that match the search, grouped, or the empty\n * message. The search is the parts root's, read from its context.\n */\nconst CommandActionsContent = ({\n actions,\n filter,\n placeholder,\n empty,\n}: CommandActionsContentProps) => {\n const { query } = useCommand();\n const matchText = useLocaleMatcher();\n const shown = filter\n ? filter(query, actions)\n : filterActions(query, actions, matchText);\n\n // Each group where the matches first name it, and the actions with none\n // together where the first of them is, so the best match stays on top.\n const sections = new Map<string, CommandAction[]>();\n for (const action of shown) {\n const group = action.group ?? '';\n sections.set(group, [...(sections.get(group) ?? []), action]);\n }\n const renderItem = (action: CommandAction) => (\n <CommandItem\n key={action.id}\n value={action.id}\n disabled={action.disabled}\n icon={action.icon}\n description={action.description}\n hint={action.hint}\n onSelect={action.onSelect}\n >\n {action.label}\n </CommandItem>\n );\n\n return (\n <>\n <CommandInput placeholder={placeholder} />\n {shown.length > 0 ? (\n <CommandList>\n {Array.from(sections, ([group, members]) =>\n group ? (\n <CommandGroup key={group} label={group}>\n {members.map(renderItem)}\n </CommandGroup>\n ) : (\n members.map(renderItem)\n )\n )}\n </CommandList>\n ) : isShown(empty) ? (\n <CommandEmpty>{empty}</CommandEmpty>\n ) : null}\n </>\n );\n};\n\n/**\n * The Command given `actions`. It renders the parts itself and filters the\n * actions as the user types, so a run goes through the same parts, keys and\n * ARIA as one built by hand.\n */\nconst CommandFromActions = forwardRef<HTMLDivElement, CommandActionsProps>(\n (\n { actions, filter, placeholder, empty = defaultEmpty, children, ...rest },\n ref\n ) => {\n if (flattenChildren(children).length > 0) {\n warnOnce(\n 'Command:actions-children',\n '[bestax-bulma] <Command actions> renders its own field and items, ' +\n 'so its children are ignored. Give it actions or build it from ' +\n 'parts, not both.'\n );\n }\n return (\n <CommandParts {...rest} ref={ref}>\n <CommandActionsContent\n actions={actions}\n filter={filter}\n placeholder={placeholder}\n empty={empty}\n />\n </CommandParts>\n );\n }\n);\nCommandFromActions.displayName = 'CommandFromActions';\n\n/**\n * The `Command` component is a search field over a list of things to do, which narrows as you type and runs the top match on Enter: inline by default, and a command palette in a modal as `Command.Dialog`.\n *\n * Given `actions`, it's one element. It renders the field, the list, the\n * groups and the empty message, and filters the actions by label, keywords\n * and description as the user types, with label matches first. `filter`\n * takes over the matching, for fuzzy search.\n *\n * Built from parts, the app owns the items: what's in the list and how it's\n * filtered, from the search `onQueryChange` reports. Nothing filters them,\n * so a server's answer shows as it came.\n *\n * Either way, focus stays in the field, and the highlighted item is its\n * `aria-activedescendant`. The first enabled item is highlighted whenever\n * the items change, so Enter runs the top match. Running an item calls its\n * own `onSelect`, then the Command's.\n *\n * When typing leaves the empty message on screen, its text is announced\n * through a polite status region, once, after any loading ends. Result\n * counts aren't announced: a screen reader reads the list's size from the\n * markup, and a count on every keystroke talks over the typing.\n *\n * @function\n * @param {CommandProps} props - Props for the Command component.\n * @param {React.Ref<HTMLDivElement>} ref - Forwarded ref to the `div.command`.\n * @returns {JSX.Element} The field and its list.\n *\n * @example\n * <Command\n * label=\"Settings\"\n * placeholder=\"Search settings\"\n * actions={[\n * { id: 'profile', label: 'Edit profile', onSelect: openProfile },\n * { id: 'theme', label: 'Dark mode', keywords: ['theme'], onSelect: toggleTheme },\n * ]}\n * />\n *\n * @example\n * <Command label=\"People\" onQueryChange={setQuery} onSelect={openProfile}>\n * <Command.Input placeholder=\"Find a person\" />\n * {matches.length > 0 ? (\n * <Command.List>\n * {matches.map(person => (\n * <Command.Item key={person.id} value={person.id}>\n * {person.name}\n * </Command.Item>\n * ))}\n * </Command.List>\n * ) : (\n * <Command.Empty>No one matches</Command.Empty>\n * )}\n * </Command>\n */\nconst CommandRoot = forwardRef<HTMLDivElement, CommandProps>((props, ref) =>\n props.actions === undefined ? (\n <CommandParts {...props} ref={ref} />\n ) : (\n <CommandFromActions {...props} ref={ref} />\n )\n);\n\n/** A key combination, read from a `shortcut` string. */\ninterface ParsedShortcut {\n /** The key, lowercased, as `KeyboardEvent.key` names it. */\n key: string;\n mod: boolean;\n ctrl: boolean;\n meta: boolean;\n alt: boolean;\n shift: boolean;\n}\n\n/** Other names a key goes by in a `shortcut`, for the ones `key` spells otherwise. */\nconst keyAliases: Record<string, string> = {\n space: ' ',\n esc: 'escape',\n};\n\n/**\n * Reads a `shortcut` such as `\"mod+k\"` or `\"ctrl + shift + p\"`.\n *\n * @param shortcut - Modifiers and a key, joined by `+`.\n * @returns The combination, or `null` when it doesn't read as one.\n */\nconst parseShortcut = (shortcut: string): ParsedShortcut | null => {\n const parts = shortcut\n .toLowerCase()\n .split('+')\n .map(part => part.trim());\n const key = parts.pop() as string;\n if (key === '') return null;\n const parsed: ParsedShortcut = {\n key: keyAliases[key] ?? key,\n mod: false,\n ctrl: false,\n meta: false,\n alt: false,\n shift: false,\n };\n for (const part of parts) {\n if (part === 'mod') parsed.mod = true;\n else if (part === 'ctrl' || part === 'control') parsed.ctrl = true;\n else if (part === 'meta' || part === 'cmd' || part === 'command')\n parsed.meta = true;\n else if (part === 'alt' || part === 'option') parsed.alt = true;\n else if (part === 'shift') parsed.shift = true;\n else return null;\n }\n return parsed;\n};\n\n/**\n * Whether a keydown is the combination. `mod` takes Ctrl or ⌘, and any other\n * modifier has to be as the combination says, so `mod+k` isn't\n * `mod+shift+k`. A letter or digit is matched by its key, and by where it\n * sits on the keyboard only when the key isn't a Latin letter or digit at\n * all, as on a Cyrillic layout or with Option held on a Mac, so another\n * Latin layout's own letters keep their own shortcuts.\n */\nconst matchesShortcut = (\n event: KeyboardEvent,\n shortcut: ParsedShortcut\n): boolean => {\n if (event.altKey !== shortcut.alt) return false;\n // A symbol such as `?` already says whether Shift was down, and which key\n // takes Shift to type it depends on the layout, so Shift is only checked\n // for a letter, a digit or a named key, unless the combination names it.\n const shiftMatters =\n shortcut.shift ||\n shortcut.key.length > 1 ||\n /^[a-z0-9]$/.test(shortcut.key);\n if (shiftMatters && event.shiftKey !== shortcut.shift) return false;\n if (shortcut.mod) {\n if (!event.ctrlKey && !event.metaKey) return false;\n } else if (\n event.ctrlKey !== shortcut.ctrl ||\n event.metaKey !== shortcut.meta\n ) {\n return false;\n }\n const key = (event.key ?? '').toLowerCase();\n if (key === shortcut.key) return true;\n if (/^[a-z0-9]$/.test(key)) return false;\n if (/^[a-z]$/.test(shortcut.key)) {\n return event.code === `Key${shortcut.key.toUpperCase()}`;\n }\n if (/^[0-9]$/.test(shortcut.key)) {\n return event.code === `Digit${shortcut.key}`;\n }\n return false;\n};\n\n/** Input types that take no typing, so a shortcut pressed in one still counts. */\nconst untypedInputs = new Set([\n 'button',\n 'checkbox',\n 'color',\n 'file',\n 'hidden',\n 'image',\n 'radio',\n 'range',\n 'reset',\n 'submit',\n]);\n\n/**\n * Whether a keydown happened while the user was typing: in a text field, a\n * text area, a select, or editable content. The composed path's first entry\n * is the element itself, even inside a shadow root.\n */\nconst isTyping = (event: KeyboardEvent): boolean => {\n const target = event.composedPath()[0] as Partial<Element> | undefined;\n if (typeof target?.closest !== 'function') return false;\n const element = target as Element;\n const editable = element.closest('[contenteditable]');\n if (editable && editable.getAttribute('contenteditable') !== 'false') {\n return true;\n }\n const tag = element.tagName;\n if (tag === 'TEXTAREA' || tag === 'SELECT') return true;\n return (\n tag === 'INPUT' &&\n !untypedInputs.has((element as HTMLInputElement).type.toLowerCase())\n );\n};\n\n/**\n * The Command in a modal, a command palette, opened by its `shortcut` or by `open`, that closes once an item has run.\n *\n * It renders nothing while it's closed. Open, it's a `Modal` with a\n * background and the Command's box as the `dialog`, named by `label`:\n * focus goes to the search field, Tab stays inside, Escape and a click on\n * the background close it, the page behind it doesn't scroll, and focus goes\n * back to where it was when it closes.\n *\n * @function\n * @param {CommandDialogProps} props - Props for the Command.Dialog component.\n * @param {React.Ref<HTMLDivElement>} ref - Forwarded ref to the `div.command` that is the dialog.\n * @returns {JSX.Element | null} The dialog, or nothing while it's closed.\n */\nexport const CommandDialog = forwardRef<HTMLDivElement, CommandDialogProps>(\n (\n {\n open: controlledOpen,\n defaultOpen = false,\n onOpenChange,\n shortcut,\n closeOnSelect = true,\n clearOnClose = true,\n portal,\n label,\n query: controlledQuery,\n defaultQuery = '',\n onQueryChange,\n onSelect,\n className,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n ...props\n },\n ref\n ) => {\n const [ownOpen, setOwnOpen] = useState(defaultOpen);\n const open = controlledOpen ?? ownOpen;\n // Only ever asked for the other state: the shortcut listens while it's\n // closed, and everything that closes it is there while it's open.\n const setOpen = (next: boolean) => {\n if (controlledOpen === undefined) setOwnOpen(next);\n onOpenChange?.(next);\n };\n\n // The search is held here rather than in the Command, which is only\n // mounted while the dialog is open, so it can outlive a close when\n // `clearOnClose` is off.\n const [ownQuery, setOwnQuery] = useState(defaultQuery);\n const query = controlledQuery ?? ownQuery;\n const setQuery = (next: string) => {\n if (controlledQuery === undefined) setOwnQuery(next);\n onQueryChange?.(next);\n };\n // Closing clears the search, however the dialog closed. Our own is\n // cleared during render, React's pattern for adjusting state when other\n // state changes, and a controlled one is asked for after the commit.\n const [shownOpen, setShownOpen] = useState(open);\n if (shownOpen !== open) {\n setShownOpen(open);\n if (!open && clearOnClose && controlledQuery === undefined) {\n setOwnQuery('');\n }\n }\n const wasOpenRef = useRef(open);\n const clearRef = useLatestRef(() => {\n if (clearOnClose && controlledQuery !== undefined && query !== '') {\n onQueryChange?.('');\n }\n });\n useEffect(() => {\n const wasOpen = wasOpenRef.current;\n wasOpenRef.current = open;\n if (wasOpen && !open) clearRef.current();\n }, [open, clearRef]);\n\n if (controlledOpen === undefined && !defaultOpen && !shortcut) {\n warnOnce(\n 'Command.Dialog:no-opener',\n '[bestax-bulma] <Command.Dialog> has no way to open. Give it a ' +\n 'shortcut, or open and onOpenChange.'\n );\n }\n if (shortcut && !parseShortcut(shortcut)) {\n warnOnce(\n `Command.Dialog:shortcut:${shortcut}`,\n `[bestax-bulma] <Command.Dialog> can't read the shortcut ` +\n `\"${shortcut}\". Write modifiers and a key joined by +, such as ` +\n `\"mod+k\", where the modifiers are mod, ctrl, meta, alt and shift.`\n );\n }\n\n const openFromShortcut = useLatestRef(() => setOpen(true));\n useEffect(() => {\n const combination = shortcut ? parseShortcut(shortcut) : null;\n if (!combination || open) return undefined;\n const onKeyDown = (event: KeyboardEvent) => {\n if (\n event.defaultPrevented ||\n event.isComposing ||\n event.keyCode === 229 ||\n !matchesShortcut(event, combination) ||\n isTyping(event) ||\n // A Modal, a Dialog, a Sidebar with its overlay or a full-page\n // Loading has the page shut off, so the key isn't the page's. A\n // Sidebar without one leaves the page in use, so it still opens.\n isModalOverlayOpen()\n ) {\n return;\n }\n // The browser's own use of the combination, such as Ctrl+K's search\n // in the address bar, doesn't happen as well.\n event.preventDefault();\n openFromShortcut.current();\n };\n // On `window`, where a keydown arrives last, so anything on the page\n // that used the key first has said so with `preventDefault()`.\n window.addEventListener('keydown', onKeyDown);\n return () => window.removeEventListener('keydown', onKeyDown);\n }, [shortcut, open, openFromShortcut]);\n\n const dialogClass = usePrefixedClassNames('command-dialog');\n\n if (!open) return null;\n\n const close = () => setOpen(false);\n const run = (value: string) => {\n onSelect?.(value);\n if (closeOnSelect) close();\n };\n\n return (\n <Modal isActive onClose={close} role=\"presentation\" portal={portal}>\n <Modal.Background onClick={close} />\n <CommandRoot\n {...(props as CommandProps)}\n ref={ref}\n className={classNames(dialogClass, className)}\n label={label}\n query={query}\n onQueryChange={setQuery}\n onSelect={run}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label={\n ariaLabelledBy === undefined\n ? ariaLabel || label || defaultLabel\n : ariaLabel\n }\n aria-labelledby={ariaLabelledBy}\n />\n </Modal>\n );\n }\n);\nCommandDialog.displayName = 'CommandDialog';\n\n/** Command with Input, List, Group, Item, Empty and Dialog sub-components. */\nexport const Command = withSubComponents(\n CommandRoot,\n {\n Input: CommandInput,\n List: CommandList,\n Group: CommandGroup,\n Item: CommandItem,\n Empty: CommandEmpty,\n Dialog: CommandDialog,\n },\n 'Command'\n);\n\nexport default Command;\n"],"names":["typedNoMatches","nothingToAnnounce","isShown","noop","registerNothing","standalone","setRefs","_jsxs","_jsx"],"mappings":";;;;;;;;;;;;;;;;;AA2BA;AACA,MAAM,YAAY,GAAG,UAAU;AAE/B;AACA,MAAM,YAAY,GA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EE,cAAc,EAAA,CAC/B,CAAA,EAAA,CACI;AAEZ,CAAC;AAEH,aAAa,CAAC,WAAW,GAAG,eAAe;AAE3C;AACO,MAAM,OAAO,GAAG,iBAAiB,CACtC,WAAW,EACX;AACE,IAAA,KAAK,EAAE,YAAY;AACnB,IAAA,IAAI,EAAE,WAAW;AACjB,IAAA,KAAK,EAAE,YAAY;AACnB,IAAA,IAAI,EAAE,WAAW;AACjB,IAAA,KAAK,EAAE,YAAY;AACnB,IAAA,MAAM,EAAE,aAAa;CACtB,EACD,SAAS;;"}
1
+ {"version":3,"file":"Command.js","sources":["../../../src/components/Command.tsx"],"sourcesContent":["import React, {\n createContext,\n forwardRef,\n useCallback,\n useContext,\n useEffect,\n useId,\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 { useClientLayoutEffect } from '../helpers/useClientLayoutEffect';\nimport { useLatestRef } from '../helpers/useLatestRef';\nimport { flattenChildren } from '../helpers/flattenChildren';\nimport { warnOnce } from '../helpers/devWarnings';\nimport { useLocaleMatcher, type TextMatcher } from '../helpers/localeFormat';\nimport { isModalOverlayOpen } from '../helpers/overlayStack';\nimport { StatusRegion, spokenText } from '../helpers/statusRegion';\nimport {\n ComboboxEngine,\n useComboboxEngine,\n} from '../helpers/useComboboxEngine';\nimport { Input, InputProps } from '../form/Input';\nimport { Modal } from './Modal';\n\n/** What names a Command that's given no `label`. */\nconst defaultLabel = 'Commands';\n\n/** What a Command given `actions` shows when nothing matches, unless it's given `empty`. */\nconst defaultEmpty = 'No results';\n\n// What the status region announces: the `Command.Empty` content, as the one\n// item it's handed while that content is on screen because of the user's\n// typing.\nconst typedNoMatches = [{ id: 'empty' }];\nconst nothingToAnnounce: Array<{ id: string }> = [];\n\n/** Whether a slot was given something to show. */\nconst isShown = (node: React.ReactNode): boolean =>\n node !== undefined && node !== null && node !== false && node !== '';\n\n/** One action in a Command's `actions`. */\nexport interface CommandAction {\n /** Unique within the Command. It's the item's `value`, so `onSelect` hands it back. */\n id: string;\n /** What the item shows, and what typing matches first. */\n label: string;\n /**\n * A line under the label, such as what the action does or where it goes.\n * Typing matches it too, after the labels. A screen reader hears it after\n * the label, as the item's description.\n */\n description?: string;\n /**\n * More words typing matches, after the labels, such as `['theme']` for\n * \"Dark mode\". They aren't shown.\n */\n keywords?: string[];\n /**\n * The heading the action goes under. Groups show in the order the matches\n * first name them, so the best match is always on top, and the actions with\n * no group show together where the first of them is.\n */\n group?: string;\n /** Shown before the label, and hidden from assistive tech. */\n icon?: React.ReactNode;\n /**\n * Shown at the end of the row, such as the action's own keyboard shortcut in\n * a `Kbd.Group`, or a `Tag`. It only shows: nothing listens for a shortcut\n * written here. A screen reader hears it after the label, with the\n * description.\n */\n hint?: React.ReactNode;\n /** Shown, and reached with the arrows so a screen reader user finds it, but never run. */\n disabled?: boolean;\n /** Runs the action, when it's picked with Enter or a click, before the Command's `onSelect`. */\n onSelect?: () => void;\n}\n\n/** What a Command takes whether it's given `actions` or built from parts. */\ninterface CommandBaseProps\n extends\n Omit<React.HTMLAttributes<HTMLDivElement>, 'color' | 'onSelect'>,\n Omit<BulmaClassesProps, 'color'> {\n /**\n * What the Command is for, such as \"Commands\" or \"Settings\". It's never\n * shown: it names the search field and the list for assistive tech, and in\n * `Command.Dialog` the dialog too. An empty string counts as none.\n * @defaultValue 'Commands'\n */\n label?: string;\n /**\n * The search, controlled: the text in the field. Pair it with\n * `onQueryChange`.\n */\n query?: string;\n /**\n * The search to start with when uncontrolled.\n * @defaultValue ''\n */\n defaultQuery?: string;\n /**\n * Called with the search as the user types it. Built from parts, this is\n * where the app filters its items.\n */\n onQueryChange?: (query: string) => void;\n /**\n * Called with the picked item's `value`, an action's `id`, when it's run\n * with Enter or a click, after the item's own `onSelect`. A disabled item\n * is never run.\n */\n onSelect?: (value: string) => void;\n}\n\n/** Props for a Command given `actions`. */\nexport interface CommandActionsProps extends CommandBaseProps {\n /**\n * The actions, for a Command that renders the field, the list, the groups\n * and the empty message itself. Typing filters them by label, keywords and\n * description, ignoring case, with label matches first. Inside a\n * `LocaleProvider` with a `locale`, it ignores accents too where that\n * language does, so \"cafe\" finds \"Café\". Leave it out to build the\n * Command from parts.\n */\n actions: CommandAction[];\n /**\n * Takes over the filtering, with `actions`: it's handed the search as typed\n * and every action, and returns the ones to show, in the order to show\n * them, which is how to plug in fuzzy matching or cut the list short. It's\n * called with an empty search too.\n */\n filter?: (query: string, actions: CommandAction[]) => CommandAction[];\n /** The field's placeholder, with `actions`. */\n placeholder?: string;\n /**\n * What shows in place of the list, with `actions`, when nothing matches.\n * It's announced the way `Command.Empty` is. `null` shows nothing.\n * @defaultValue 'No results'\n */\n empty?: React.ReactNode;\n /** @internal With `actions`, the Command renders its own parts. */\n children?: never;\n}\n\n/** Props for a Command built from parts. */\nexport interface CommandPartsProps extends CommandBaseProps {\n /**\n * The parts, in order: `Command.Input`, then `Command.List` while there are\n * items and `Command.Empty` while there aren't. Nothing filters them, so\n * render the items that match the search `onQueryChange` reports. With\n * `actions` there are none to give: children given with it are ignored,\n * with a warning in development.\n */\n children?: React.ReactNode;\n /** @internal Built from parts, the app renders the items. */\n actions?: never;\n /** @internal Built from parts, the app filters. */\n filter?: never;\n /** @internal Built from parts, `Command.Input` takes the placeholder. */\n placeholder?: never;\n /** @internal Built from parts, `Command.Empty` is the empty message. */\n empty?: never;\n}\n\n/**\n * Props for the Command component: given `actions`, it renders, filters and\n * groups them itself, and without them it's built from parts. The helper\n * props, the other attributes and the `ref` land on the `div.command` around\n * the field and the list.\n *\n * @extraProp {React.Ref<HTMLDivElement>} [ref] - Ref forwarded to the `div.command` around the field and the list.\n */\nexport type CommandProps = CommandActionsProps | CommandPartsProps;\n\n/** What Command.Dialog takes on top of a Command's props. */\ninterface CommandDialogOwnProps {\n /** Controlled open state. When set, opening and closing only report through `onOpenChange`. */\n open?: boolean;\n /**\n * Initial open state when uncontrolled.\n * @defaultValue false\n */\n defaultOpen?: boolean;\n /**\n * Called with the open state asked for: `true` from the `shortcut`, and\n * `false` from Escape, a click on the background, or a pick while\n * `closeOnSelect` is on. Fires in controlled and uncontrolled use.\n */\n onOpenChange?: (open: boolean) => void;\n /**\n * A key combination that opens the dialog from anywhere on the page, such\n * as `\"mod+k\"`: modifiers and a key joined by `+`, where `mod` is Ctrl or\n * ⌘ (either one, on every platform), and the others are `ctrl`, `meta`,\n * `alt` and `shift`. It's ignored while the user is typing in a text field,\n * a select or editable content, while an IME is composing, while a modal\n * overlay is open (a `Modal`, a `Dialog`, a `Sidebar` with its overlay or a\n * full-page `Loading`), and when something else has already used the key.\n * It only opens the dialog. Off unless given.\n */\n shortcut?: string;\n /**\n * Closes the dialog once an item has run. Turn it off for an item that\n * opens another page of the palette, and close it yourself with `open`.\n * @defaultValue true\n */\n closeOnSelect?: boolean;\n /**\n * Clears the search when the dialog closes: an uncontrolled one itself,\n * and a controlled one through `onQueryChange('')`.\n * @defaultValue true\n */\n clearOnClose?: boolean;\n /**\n * Renders the dialog into a portal target instead of inline. Forwarded to\n * the underlying `Modal`; see its `portal` prop for the accepted values.\n * @defaultValue false\n */\n portal?: boolean | string | HTMLElement;\n}\n\n/** Props for a Command.Dialog given `actions`. */\nexport interface CommandDialogActionsProps\n extends CommandActionsProps, CommandDialogOwnProps {}\n\n/** Props for a Command.Dialog built from parts. */\nexport interface CommandDialogPartsProps\n extends CommandPartsProps, CommandDialogOwnProps {}\n\n/**\n * Props for Command.Dialog, the Command in a modal: a Command's props, given\n * `actions` or built from parts, and the dialog's own. The helper props, the\n * other attributes and the `ref` land on the `div.command` that is the\n * dialog.\n *\n * @extraProp {React.Ref<HTMLDivElement>} [ref] - Ref forwarded to the `div.command` that is the dialog.\n */\nexport type CommandDialogProps =\n CommandDialogActionsProps | CommandDialogPartsProps;\n\n/**\n * Props for Command.Input, the search field. It renders `Input`, so its\n * icons, `isLoading` and `color` work as they do there. Its text is the\n * Command's `query`, and it's `autoComplete=\"off\"`, so the browser's own\n * suggestions don't open over the list: neither is yours to set.\n */\nexport type CommandInputProps = Omit<\n InputProps,\n // By name, since the docs read only names out of an Omit. The Field props:\n | 'label'\n | 'labelSize'\n | 'labelProps'\n | 'horizontal'\n | 'message'\n | 'messageColor'\n | 'fieldClassName'\n // And what the Command sets on the field itself:\n | 'role'\n | 'autoComplete'\n | 'value'\n | 'defaultValue'\n>;\n\n/**\n * Props for Command.List, the list. Its `id` is the one the field's\n * `aria-controls` names, so it isn't yours to set.\n */\nexport interface CommandListProps extends Omit<\n React.HTMLAttributes<HTMLDivElement>,\n 'role' | 'id'\n> {\n /** `Command.Item`s and `Command.Group`s, in the order they're shown. */\n children?: React.ReactNode;\n}\n\n/** Props for Command.Group, items under a heading. */\nexport interface CommandGroupProps extends Omit<\n React.HTMLAttributes<HTMLDivElement>,\n 'role'\n> {\n /**\n * The heading, which also names the group for assistive tech, unless you\n * give the group an `aria-label` or `aria-labelledby` of its own.\n */\n label: React.ReactNode;\n /** The group's `Command.Item`s. */\n children?: React.ReactNode;\n}\n\n/**\n * Props for Command.Item, one thing to do in the list. Its `id` follows from\n * its `value`, since the field's `aria-activedescendant` names it, so it\n * isn't yours to set.\n */\nexport interface CommandItemProps extends Omit<\n React.HTMLAttributes<HTMLDivElement>,\n 'role' | 'onSelect' | 'id'\n> {\n /** What the Command's `onSelect` hands back. Unique within the Command. */\n value: string;\n /**\n * Can't be run. The arrows still reach it, so a screen reader user finds\n * it, and it's never `aria-selected`.\n * @defaultValue false\n */\n disabled?: boolean;\n /** Runs the item, when it's picked with Enter or a click, before the Command's `onSelect`. */\n onSelect?: () => void;\n /** Shown before the label, and hidden from assistive tech. */\n icon?: React.ReactNode;\n /**\n * A line under the label. A screen reader hears it after the label, as the\n * item's description.\n */\n description?: React.ReactNode;\n /**\n * Shown at the end of the row, such as a keyboard shortcut in a\n * `Kbd.Group`, or a `Tag`. It only shows. A screen reader hears it after\n * the label, with the description.\n */\n hint?: React.ReactNode;\n /** The label, which names the item. */\n children?: React.ReactNode;\n}\n\n/** Props for Command.Empty, the message shown in place of the list. */\nexport interface CommandEmptyProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * The message, such as \"No commands match\". Its text is announced when\n * typing brings it on screen and isn't read again while it stays, so a\n * message that names the search is heard for the first search only.\n */\n children?: React.ReactNode;\n}\n\n/** A handler an item registers, read when it's run. */\ntype ItemHandler = { readonly current: (() => void) | undefined };\n\n/** What the Command hands its parts. */\ninterface CommandContextValue {\n engine: ComboboxEngine;\n /** What names the field and the list. */\n label: string;\n /** The search. */\n query: string;\n /** A change to the field's value, which is the user typing. */\n onFieldChange: (value: string) => void;\n /** Tells the Command the field's `isLoading`, which holds the empty message's announcement. */\n reportLoading: (loading: boolean) => void;\n /** Records the empty message while it's on screen. Returns the function that forgets it. */\n reportEmpty: (element: HTMLElement) => () => void;\n /** Records an item's `onSelect`. Returns the function that forgets it. */\n registerHandler: (value: string, handler: ItemHandler) => () => void;\n}\n\nconst noop = () => {};\nconst registerNothing = () => noop;\n\n// What a part rendered outside a Command reads: nothing to report to, so it\n// renders its markup and does nothing.\nconst standalone: CommandContextValue = {\n engine: {\n open: false,\n expanded: false,\n highlighted: null,\n typed: false,\n listboxId: '',\n itemId: () => '',\n rootRef: { current: null },\n inputRef: { current: null },\n listboxRef: { current: null },\n registerPopup: registerNothing,\n registerItem: registerNothing,\n onKeyDown: noop,\n onChange: noop,\n onClick: noop,\n onBlur: noop,\n hover: noop,\n pick: noop,\n keepFocus: noop,\n markInside: noop,\n },\n label: defaultLabel,\n query: '',\n onFieldChange: noop,\n reportLoading: noop,\n reportEmpty: registerNothing,\n registerHandler: registerNothing,\n};\n\nconst CommandContext = createContext<CommandContextValue | null>(null);\n\nconst useCommand = () => useContext(CommandContext) ?? standalone;\n\n/** Hands a node to a forwarded ref and to one of the component's own. */\nfunction setRefs<T>(\n node: T | null,\n own: React.MutableRefObject<T | null>,\n forwarded: React.ForwardedRef<T>\n) {\n own.current = node;\n if (typeof forwarded === 'function') forwarded(node);\n else if (forwarded) forwarded.current = node;\n}\n\n/**\n * The default filter: the actions whose label, keywords or description hold\n * the search, ignoring case and the spaces around it, label matches first and\n * the order otherwise kept. An empty search keeps them all. `matchText`, a\n * `LocaleProvider`'s locale-aware matcher, replaces the lowercased\n * comparison when there is one.\n */\nconst filterActions = (\n query: string,\n actions: CommandAction[],\n matchText?: TextMatcher | null\n): CommandAction[] => {\n const search = query.trim();\n if (search === '') return actions;\n const term = search.toLowerCase();\n const holds = matchText\n ? (text: string) => matchText(text, search)\n : (text: string) => text.toLowerCase().includes(term);\n const byLabel: CommandAction[] = [];\n const byOther: CommandAction[] = [];\n for (const action of actions) {\n if (holds(action.label)) {\n byLabel.push(action);\n } else if (\n (action.description !== undefined && holds(action.description)) ||\n action.keywords?.some(holds)\n ) {\n byOther.push(action);\n }\n }\n return [...byLabel, ...byOther];\n};\n\n/** The search icon at the start of the field. */\nconst SearchIcon = () => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"1.75\"\n strokeLinecap=\"round\"\n width=\"1em\"\n height=\"1em\"\n focusable=\"false\"\n >\n <circle cx=\"7\" cy=\"7\" r=\"4.75\" />\n <path d=\"M10.5 10.5L14 14\" />\n </svg>\n);\n\n/**\n * The Command built from parts: the field, the list, the keys and the run,\n * with the items and their filtering left to the app.\n */\nconst CommandParts = forwardRef<HTMLDivElement, CommandPartsProps>(\n (\n {\n children,\n label,\n query: controlledQuery,\n defaultQuery = '',\n onQueryChange,\n onSelect,\n className,\n ...props\n },\n ref\n ) => {\n const [ownQuery, setOwnQuery] = useState(defaultQuery);\n const query = controlledQuery ?? ownQuery;\n\n // Each item's `onSelect`, by value, read when it runs.\n const handlersRef = useRef(new Map<string, ItemHandler>());\n const registerHandler = useCallback(\n (value: string, handler: ItemHandler) => {\n const handlers = handlersRef.current;\n handlers.set(value, handler);\n return () => {\n if (handlers.get(value) === handler) handlers.delete(value);\n };\n },\n []\n );\n const run = (value: string) => {\n handlersRef.current.get(value)?.current?.();\n onSelect?.(value);\n };\n\n // Inline: the list is always on screen, nothing opens or closes it, and\n // Escape goes on to what's around it. `keepFirst` keeps the highlight on\n // the top match, so Enter runs it.\n const engine = useComboboxEngine({\n defaultOpen: true,\n onSelect: run,\n keepFirst: true,\n multiple: false,\n inline: true,\n deferred: false,\n });\n const { bulmaHelperClasses, rest } = useBulmaClasses(props);\n const rootClass = usePrefixedClassNames('command');\n\n // A polite status region, in the page from the start so it's there\n // before anything is written into it, announces `Command.Empty` when the\n // user's typing leaves it on screen: once each time that happens, not\n // again on each keystroke while it stays. An empty search isn't a search,\n // so it stays quiet then, and while the field's `isLoading` says results\n // are on their way, it waits.\n const [inputLoading, setInputLoading] = useState(false);\n const emptyRef = useRef<HTMLElement | null>(null);\n const [emptyShown, setEmptyShown] = useState(false);\n const announced =\n engine.typed && query !== '' && emptyShown && !inputLoading\n ? typedNoMatches\n : nothingToAnnounce;\n // The region reads the text on screen, whatever the message renders.\n const describeEmpty = useCallback(() => {\n const node = emptyRef.current;\n /* istanbul ignore if: it's only announced while it's on screen */\n if (!node) return null;\n return spokenText(node);\n }, []);\n const reportEmpty = useCallback((element: HTMLElement) => {\n emptyRef.current = element;\n setEmptyShown(true);\n return () => {\n emptyRef.current = null;\n setEmptyShown(false);\n };\n }, []);\n\n const onFieldChange = (value: string) => {\n if (controlledQuery === undefined) setOwnQuery(value);\n onQueryChange?.(value);\n engine.onChange();\n };\n\n // A new value each render: the engine's state and handlers are, and the\n // parts read the highlight from it.\n const context: CommandContextValue = {\n engine,\n label: label || defaultLabel,\n query,\n onFieldChange,\n reportLoading: setInputLoading,\n reportEmpty,\n registerHandler,\n };\n\n const { rootRef } = engine;\n const rootRefs = useCallback(\n (node: HTMLDivElement | null) => setRefs(node, rootRef, ref),\n [rootRef, ref]\n );\n\n return (\n // The ref after the spread, so the element stays the Command's.\n <div\n className={classNames(rootClass, bulmaHelperClasses, className)}\n {...rest}\n ref={rootRefs}\n >\n <CommandContext.Provider value={context}>\n {children}\n </CommandContext.Provider>\n <StatusRegion items={announced} describe={describeEmpty} />\n </div>\n );\n }\n);\nCommandParts.displayName = 'CommandParts';\n\n/**\n * The search field, with the combobox role and the keys, rendered as an `Input` with a search icon.\n *\n * @function\n * @param {CommandInputProps} props - Props for the Command.Input component.\n * @param {React.Ref<HTMLInputElement>} ref - Forwarded ref to the `<input>`.\n * @returns {JSX.Element} The field in its Control.\n */\nexport const CommandInput = forwardRef<HTMLInputElement, CommandInputProps>(\n (\n {\n isLoading,\n iconLeft,\n iconLeftName,\n onKeyDown,\n onChange,\n onClick,\n onBlur,\n 'aria-autocomplete': ariaAutocomplete,\n ...props\n },\n ref\n ) => {\n const context = useCommand();\n const { engine, reportLoading } = context;\n useClientLayoutEffect(() => {\n reportLoading(!!isLoading);\n return () => reportLoading(false);\n }, [reportLoading, isLoading]);\n const { inputRef } = engine;\n const inputRefs = useCallback(\n (node: HTMLInputElement | null) => setRefs(node, inputRef, ref),\n [inputRef, ref]\n );\n const { expanded, highlighted } = engine;\n // A name the caller gave the field wins over the Command's `label`.\n const callerNamed = !!props['aria-label'] || 'aria-labelledby' in props;\n\n return (\n // The attributes the Command owns after the caller's, so a stray\n // `aria-expanded` never wins. A search isn't prose, so the browser's\n // spelling and autocorrect stay out of it unless the caller asks.\n <Input\n autoCorrect=\"off\"\n spellCheck={false}\n {...props}\n ref={inputRefs}\n value={context.query}\n iconLeft={\n iconLeft === undefined && !iconLeftName ? <SearchIcon /> : iconLeft\n }\n iconLeftName={iconLeftName}\n isLoading={isLoading}\n aria-label={callerNamed ? props['aria-label'] : context.label}\n role=\"combobox\"\n aria-autocomplete={ariaAutocomplete ?? 'list'}\n aria-haspopup=\"listbox\"\n aria-expanded={expanded}\n aria-controls={expanded ? engine.listboxId : undefined}\n aria-activedescendant={\n expanded && highlighted !== null\n ? engine.itemId(highlighted)\n : undefined\n }\n autoComplete=\"off\"\n onKeyDown={event => {\n onKeyDown?.(event);\n engine.onKeyDown(event);\n }}\n onChange={event => {\n onChange?.(event);\n context.onFieldChange(event.target.value);\n }}\n onClick={event => {\n onClick?.(event);\n if (!event.defaultPrevented) engine.onClick();\n }}\n onBlur={event => {\n onBlur?.(event);\n engine.onBlur(event);\n }}\n />\n );\n }\n);\nCommandInput.displayName = 'CommandInput';\n\n/**\n * The list of items, a `listbox` named by the Command's `label`.\n *\n * @function\n * @param {CommandListProps} props - Props for the Command.List component.\n * @returns {JSX.Element} The listbox.\n */\nexport const CommandList: React.FC<CommandListProps> = ({\n children,\n className,\n onMouseDown,\n ...props\n}) => {\n const { engine, label } = useCommand();\n const { listboxRef, listboxId, keepFocus } = engine;\n const listClass = usePrefixedClassNames('command-list');\n // A name the caller gave the list wins over the Command's.\n const callerNamed = !!props['aria-label'] || 'aria-labelledby' in props;\n return (\n <div\n className={classNames(listClass, className)}\n {...props}\n ref={listboxRef}\n id={listboxId || undefined}\n role=\"listbox\"\n aria-label={callerNamed ? props['aria-label'] : label}\n onMouseDown={event => {\n onMouseDown?.(event);\n keepFocus(event);\n }}\n >\n {children}\n </div>\n );\n};\nCommandList.displayName = 'CommandList';\n\n/**\n * Items under a heading, a `group` named by it.\n *\n * @function\n * @param {CommandGroupProps} props - Props for the Command.Group component.\n * @returns {JSX.Element} The group and its heading.\n */\nexport const CommandGroup: React.FC<CommandGroupProps> = ({\n label,\n children,\n className,\n ...props\n}) => {\n const labelId = useId();\n const groupClass = usePrefixedClassNames('command-group');\n const labelClass = usePrefixedClassNames('command-group-label');\n // A name the caller gave the group wins over its heading's, as on the list.\n const callerNamed = !!props['aria-label'] || 'aria-labelledby' in props;\n return (\n <div\n className={classNames(groupClass, className)}\n {...props}\n role=\"group\"\n aria-labelledby={callerNamed ? props['aria-labelledby'] : labelId}\n >\n <div className={labelClass} id={labelId}>\n {label}\n </div>\n {children}\n </div>\n );\n};\nCommandGroup.displayName = 'CommandGroup';\n\n/**\n * One thing to do in the list, named by its label and described by its description and hint.\n *\n * @function\n * @param {CommandItemProps} props - Props for the Command.Item component.\n * @returns {JSX.Element} The item.\n */\nexport const CommandItem: React.FC<CommandItemProps> = ({\n value,\n disabled = false,\n onSelect,\n icon,\n description,\n hint,\n children,\n className,\n onClick,\n onPointerMove,\n ...props\n}) => {\n const { engine, registerHandler } = useCommand();\n const itemRef = useRef<HTMLDivElement>(null);\n const { registerItem } = engine;\n useClientLayoutEffect(\n () =>\n registerItem(itemRef.current as HTMLDivElement, {\n value,\n disabled,\n checked: false,\n }),\n [registerItem, value, disabled]\n );\n const onSelectRef = useLatestRef(onSelect);\n useClientLayoutEffect(\n () => registerHandler(value, onSelectRef),\n [registerHandler, value, onSelectRef]\n );\n const highlighted = engine.highlighted === value;\n const itemClass = usePrefixedClassNames('command-item', {\n 'is-active': highlighted,\n 'is-disabled': disabled,\n });\n const iconClass = usePrefixedClassNames('command-item-icon');\n const bodyClass = usePrefixedClassNames('command-item-body');\n const labelClass = usePrefixedClassNames('command-item-label');\n const descriptionClass = usePrefixedClassNames('command-item-description');\n const hintClass = usePrefixedClassNames('command-item-hint');\n\n // Named by its label alone, so a screen reader says what it does before\n // the rest, and described by the description and the hint.\n const baseId = useId();\n const labelId = `${baseId}label`;\n const descriptionId = isShown(description)\n ? `${baseId}description`\n : undefined;\n const hintId = isShown(hint) ? `${baseId}hint` : undefined;\n const describedBy =\n [descriptionId, hintId].filter(Boolean).join(' ') || undefined;\n const callerNamed = !!props['aria-label'] || 'aria-labelledby' in props;\n\n return (\n <div\n className={classNames(itemClass, className)}\n aria-describedby={describedBy}\n {...props}\n ref={itemRef}\n id={engine.itemId(value) || undefined}\n role=\"option\"\n // The highlighted option, as the ARIA Authoring Practices' combobox\n // has it, and no attribute on the rest. Never a disabled option.\n aria-selected={disabled ? undefined : highlighted || undefined}\n aria-disabled={disabled || undefined}\n aria-labelledby={callerNamed ? props['aria-labelledby'] : labelId}\n onClick={event => {\n onClick?.(event);\n if (!disabled && !event.defaultPrevented) engine.pick(value);\n }}\n onPointerMove={event => {\n onPointerMove?.(event);\n if (!disabled && !highlighted) engine.hover(value);\n }}\n >\n {isShown(icon) && (\n <span className={iconClass} aria-hidden=\"true\">\n {icon}\n </span>\n )}\n <span className={bodyClass}>\n <span className={labelClass} id={labelId}>\n {children}\n </span>\n {descriptionId && (\n <span className={descriptionClass} id={descriptionId}>\n {description}\n </span>\n )}\n </span>\n {hintId && (\n <span className={hintClass} id={hintId}>\n {hint}\n </span>\n )}\n </div>\n );\n};\nCommandItem.displayName = 'CommandItem';\n\n/**\n * The message shown in place of the list when nothing matches, announced when typing brings it on screen.\n *\n * @function\n * @param {CommandEmptyProps} props - Props for the Command.Empty component.\n * @returns {JSX.Element} The message.\n */\nexport const CommandEmpty: React.FC<CommandEmptyProps> = ({\n children,\n className,\n onMouseDown,\n ...props\n}) => {\n const { engine, reportEmpty } = useCommand();\n const emptyRef = useRef<HTMLDivElement>(null);\n useClientLayoutEffect(\n () => reportEmpty(emptyRef.current as HTMLDivElement),\n [reportEmpty]\n );\n const emptyClass = usePrefixedClassNames('command-empty');\n return (\n <div\n className={classNames(emptyClass, className)}\n {...props}\n ref={emptyRef}\n onMouseDown={event => {\n onMouseDown?.(event);\n engine.keepFocus(event);\n }}\n >\n {children}\n </div>\n );\n};\nCommandEmpty.displayName = 'CommandEmpty';\n\n/** What a Command given `actions` renders inside its parts root. */\ninterface CommandActionsContentProps {\n actions: CommandAction[];\n filter: CommandActionsProps['filter'];\n placeholder: string | undefined;\n empty: React.ReactNode;\n}\n\n/**\n * The field, and the actions that match the search, grouped, or the empty\n * message. The search is the parts root's, read from its context.\n */\nconst CommandActionsContent = ({\n actions,\n filter,\n placeholder,\n empty,\n}: CommandActionsContentProps) => {\n const { query } = useCommand();\n const matchText = useLocaleMatcher();\n const shown = filter\n ? filter(query, actions)\n : filterActions(query, actions, matchText);\n\n // Each group where the matches first name it, and the actions with none\n // together where the first of them is, so the best match stays on top.\n const sections = new Map<string, CommandAction[]>();\n for (const action of shown) {\n const group = action.group ?? '';\n sections.set(group, [...(sections.get(group) ?? []), action]);\n }\n const renderItem = (action: CommandAction) => (\n <CommandItem\n key={action.id}\n value={action.id}\n disabled={action.disabled}\n icon={action.icon}\n description={action.description}\n hint={action.hint}\n onSelect={action.onSelect}\n >\n {action.label}\n </CommandItem>\n );\n\n return (\n <>\n <CommandInput placeholder={placeholder} />\n {shown.length > 0 ? (\n <CommandList>\n {Array.from(sections, ([group, members]) =>\n group ? (\n <CommandGroup key={group} label={group}>\n {members.map(renderItem)}\n </CommandGroup>\n ) : (\n members.map(renderItem)\n )\n )}\n </CommandList>\n ) : isShown(empty) ? (\n <CommandEmpty>{empty}</CommandEmpty>\n ) : null}\n </>\n );\n};\n\n/**\n * The Command given `actions`. It renders the parts itself and filters the\n * actions as the user types, so a run goes through the same parts, keys and\n * ARIA as one built by hand.\n */\nconst CommandFromActions = forwardRef<HTMLDivElement, CommandActionsProps>(\n (\n { actions, filter, placeholder, empty = defaultEmpty, children, ...rest },\n ref\n ) => {\n if (flattenChildren(children).length > 0) {\n warnOnce(\n 'Command:actions-children',\n '[bestax-bulma] <Command actions> renders its own field and items, ' +\n 'so its children are ignored. Give it actions or build it from ' +\n 'parts, not both.'\n );\n }\n return (\n <CommandParts {...rest} ref={ref}>\n <CommandActionsContent\n actions={actions}\n filter={filter}\n placeholder={placeholder}\n empty={empty}\n />\n </CommandParts>\n );\n }\n);\nCommandFromActions.displayName = 'CommandFromActions';\n\n/**\n * The `Command` component is a search field over a list of things to do, which narrows as you type and runs the top match on Enter: inline by default, and a command palette in a modal as `Command.Dialog`.\n *\n * Given `actions`, it's one element. It renders the field, the list, the\n * groups and the empty message, and filters the actions by label, keywords\n * and description as the user types, with label matches first. `filter`\n * takes over the matching, for fuzzy search.\n *\n * Built from parts, the app owns the items: what's in the list and how it's\n * filtered, from the search `onQueryChange` reports. Nothing filters them,\n * so a server's answer shows as it came.\n *\n * Either way, focus stays in the field, and the highlighted item is its\n * `aria-activedescendant`. The first enabled item is highlighted whenever\n * the items change, so Enter runs the top match. Running an item calls its\n * own `onSelect`, then the Command's.\n *\n * When typing leaves the empty message on screen, its text is announced\n * through a polite status region, once, after any loading ends. Result\n * counts aren't announced: a screen reader reads the list's size from the\n * markup, and a count on every keystroke talks over the typing.\n *\n * @function\n * @param {CommandProps} props - Props for the Command component.\n * @param {React.Ref<HTMLDivElement>} ref - Forwarded ref to the `div.command`.\n * @returns {JSX.Element} The field and its list.\n *\n * @example\n * <Command\n * label=\"Settings\"\n * placeholder=\"Search settings\"\n * actions={[\n * { id: 'profile', label: 'Edit profile', onSelect: openProfile },\n * { id: 'theme', label: 'Dark mode', keywords: ['theme'], onSelect: toggleTheme },\n * ]}\n * />\n *\n * @example\n * <Command label=\"People\" onQueryChange={setQuery} onSelect={openProfile}>\n * <Command.Input placeholder=\"Find a person\" />\n * {matches.length > 0 ? (\n * <Command.List>\n * {matches.map(person => (\n * <Command.Item key={person.id} value={person.id}>\n * {person.name}\n * </Command.Item>\n * ))}\n * </Command.List>\n * ) : (\n * <Command.Empty>No one matches</Command.Empty>\n * )}\n * </Command>\n */\nconst CommandRoot = forwardRef<HTMLDivElement, CommandProps>((props, ref) =>\n props.actions === undefined ? (\n <CommandParts {...props} ref={ref} />\n ) : (\n <CommandFromActions {...props} ref={ref} />\n )\n);\n\n/** A key combination, read from a `shortcut` string. */\ninterface ParsedShortcut {\n /** The key, lowercased, as `KeyboardEvent.key` names it. */\n key: string;\n mod: boolean;\n ctrl: boolean;\n meta: boolean;\n alt: boolean;\n shift: boolean;\n}\n\n/** Other names a key goes by in a `shortcut`, for the ones `key` spells otherwise. */\nconst keyAliases: Record<string, string> = {\n space: ' ',\n esc: 'escape',\n};\n\n/**\n * Reads a `shortcut` such as `\"mod+k\"` or `\"ctrl + shift + p\"`.\n *\n * @param shortcut - Modifiers and a key, joined by `+`.\n * @returns The combination, or `null` when it doesn't read as one.\n */\nconst parseShortcut = (shortcut: string): ParsedShortcut | null => {\n const parts = shortcut\n .toLowerCase()\n .split('+')\n .map(part => part.trim());\n const key = parts.pop() as string;\n if (key === '') return null;\n const parsed: ParsedShortcut = {\n key: keyAliases[key] ?? key,\n mod: false,\n ctrl: false,\n meta: false,\n alt: false,\n shift: false,\n };\n for (const part of parts) {\n if (part === 'mod') parsed.mod = true;\n else if (part === 'ctrl' || part === 'control') parsed.ctrl = true;\n else if (part === 'meta' || part === 'cmd' || part === 'command')\n parsed.meta = true;\n else if (part === 'alt' || part === 'option') parsed.alt = true;\n else if (part === 'shift') parsed.shift = true;\n else return null;\n }\n return parsed;\n};\n\n/**\n * Whether a keydown is the combination. `mod` takes Ctrl or ⌘, and any other\n * modifier has to be as the combination says, so `mod+k` isn't\n * `mod+shift+k`. A letter or digit is matched by its key, and by where it\n * sits on the keyboard only when the key isn't a Latin letter or digit at\n * all, as on a Cyrillic layout or with Option held on a Mac, so another\n * Latin layout's own letters keep their own shortcuts.\n */\nconst matchesShortcut = (\n event: KeyboardEvent,\n shortcut: ParsedShortcut\n): boolean => {\n if (event.altKey !== shortcut.alt) return false;\n // A symbol such as `?` already says whether Shift was down, and which key\n // takes Shift to type it depends on the layout, so Shift is only checked\n // for a letter, a digit or a named key, unless the combination names it.\n const shiftMatters =\n shortcut.shift ||\n shortcut.key.length > 1 ||\n /^[a-z0-9]$/.test(shortcut.key);\n if (shiftMatters && event.shiftKey !== shortcut.shift) return false;\n if (shortcut.mod) {\n if (!event.ctrlKey && !event.metaKey) return false;\n } else if (\n event.ctrlKey !== shortcut.ctrl ||\n event.metaKey !== shortcut.meta\n ) {\n return false;\n }\n const key = (event.key ?? '').toLowerCase();\n if (key === shortcut.key) return true;\n if (/^[a-z0-9]$/.test(key)) return false;\n if (/^[a-z]$/.test(shortcut.key)) {\n return event.code === `Key${shortcut.key.toUpperCase()}`;\n }\n if (/^[0-9]$/.test(shortcut.key)) {\n return event.code === `Digit${shortcut.key}`;\n }\n return false;\n};\n\n/** Input types that take no typing, so a shortcut pressed in one still counts. */\nconst untypedInputs = new Set([\n 'button',\n 'checkbox',\n 'color',\n 'file',\n 'hidden',\n 'image',\n 'radio',\n 'range',\n 'reset',\n 'submit',\n]);\n\n/**\n * Whether a keydown happened while the user was typing: in a text field, a\n * text area, a select, or editable content. The composed path's first entry\n * is the element itself, even inside a shadow root.\n */\nconst isTyping = (event: KeyboardEvent): boolean => {\n const target = event.composedPath()[0] as Partial<Element> | undefined;\n if (typeof target?.closest !== 'function') return false;\n const element = target as Element;\n const editable = element.closest('[contenteditable]');\n if (editable && editable.getAttribute('contenteditable') !== 'false') {\n return true;\n }\n const tag = element.tagName;\n if (tag === 'TEXTAREA' || tag === 'SELECT') return true;\n return (\n tag === 'INPUT' &&\n !untypedInputs.has((element as HTMLInputElement).type.toLowerCase())\n );\n};\n\n/**\n * The Command in a modal, a command palette, opened by its `shortcut` or by `open`, that closes once an item has run.\n *\n * It renders nothing while it's closed. Open, it's a `Modal` with a\n * background and the Command's box as the `dialog`, named by `label`:\n * focus goes to the search field, Tab stays inside, Escape and a click on\n * the background close it, the page behind it doesn't scroll, and focus goes\n * back to where it was when it closes.\n *\n * @function\n * @param {CommandDialogProps} props - Props for the Command.Dialog component.\n * @param {React.Ref<HTMLDivElement>} ref - Forwarded ref to the `div.command` that is the dialog.\n * @returns {JSX.Element | null} The dialog, or nothing while it's closed.\n */\nexport const CommandDialog = forwardRef<HTMLDivElement, CommandDialogProps>(\n (\n {\n open: controlledOpen,\n defaultOpen = false,\n onOpenChange,\n shortcut,\n closeOnSelect = true,\n clearOnClose = true,\n portal,\n label,\n query: controlledQuery,\n defaultQuery = '',\n onQueryChange,\n onSelect,\n className,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n ...props\n },\n ref\n ) => {\n const [ownOpen, setOwnOpen] = useState(defaultOpen);\n const open = controlledOpen ?? ownOpen;\n // Only ever asked for the other state: the shortcut listens while it's\n // closed, and everything that closes it is there while it's open.\n const setOpen = (next: boolean) => {\n if (controlledOpen === undefined) setOwnOpen(next);\n onOpenChange?.(next);\n };\n\n // The search is held here rather than in the Command, which is only\n // mounted while the dialog is open, so it can outlive a close when\n // `clearOnClose` is off.\n const [ownQuery, setOwnQuery] = useState(defaultQuery);\n const query = controlledQuery ?? ownQuery;\n const setQuery = (next: string) => {\n if (controlledQuery === undefined) setOwnQuery(next);\n onQueryChange?.(next);\n };\n // Closing clears the search, however the dialog closed. Our own is\n // cleared during render, React's pattern for adjusting state when other\n // state changes, and a controlled one is asked for after the commit.\n const [shownOpen, setShownOpen] = useState(open);\n if (shownOpen !== open) {\n setShownOpen(open);\n if (!open && clearOnClose && controlledQuery === undefined) {\n setOwnQuery('');\n }\n }\n const wasOpenRef = useRef(open);\n const clearRef = useLatestRef(() => {\n if (clearOnClose && controlledQuery !== undefined && query !== '') {\n onQueryChange?.('');\n }\n });\n useEffect(() => {\n const wasOpen = wasOpenRef.current;\n wasOpenRef.current = open;\n if (wasOpen && !open) clearRef.current();\n }, [open, clearRef]);\n\n if (controlledOpen === undefined && !defaultOpen && !shortcut) {\n warnOnce(\n 'Command.Dialog:no-opener',\n '[bestax-bulma] <Command.Dialog> has no way to open. Give it a ' +\n 'shortcut, or open and onOpenChange.'\n );\n }\n if (shortcut && !parseShortcut(shortcut)) {\n warnOnce(\n `Command.Dialog:shortcut:${shortcut}`,\n `[bestax-bulma] <Command.Dialog> can't read the shortcut ` +\n `\"${shortcut}\". Write modifiers and a key joined by +, such as ` +\n `\"mod+k\", where the modifiers are mod, ctrl, meta, alt and shift.`\n );\n }\n\n const openFromShortcut = useLatestRef(() => setOpen(true));\n useEffect(() => {\n const combination = shortcut ? parseShortcut(shortcut) : null;\n if (!combination || open) return undefined;\n const onKeyDown = (event: KeyboardEvent) => {\n if (\n event.defaultPrevented ||\n event.isComposing ||\n event.keyCode === 229 ||\n !matchesShortcut(event, combination) ||\n isTyping(event) ||\n // A Modal, a Dialog, a Sidebar with its overlay or a full-page\n // Loading has the page shut off, so the key isn't the page's. A\n // Sidebar without one leaves the page in use, so it still opens.\n isModalOverlayOpen()\n ) {\n return;\n }\n // The browser's own use of the combination, such as Ctrl+K's search\n // in the address bar, doesn't happen as well.\n event.preventDefault();\n openFromShortcut.current();\n };\n // On `window`, where a keydown arrives last, so anything on the page\n // that used the key first has said so with `preventDefault()`.\n window.addEventListener('keydown', onKeyDown);\n return () => window.removeEventListener('keydown', onKeyDown);\n }, [shortcut, open, openFromShortcut]);\n\n const dialogClass = usePrefixedClassNames('command-dialog');\n\n if (!open) return null;\n\n const close = () => setOpen(false);\n const run = (value: string) => {\n onSelect?.(value);\n if (closeOnSelect) close();\n };\n\n return (\n <Modal isActive onClose={close} role=\"presentation\" portal={portal}>\n <Modal.Background onClick={close} />\n <CommandRoot\n {...(props as CommandProps)}\n ref={ref}\n className={classNames(dialogClass, className)}\n label={label}\n query={query}\n onQueryChange={setQuery}\n onSelect={run}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label={\n ariaLabelledBy === undefined\n ? ariaLabel || label || defaultLabel\n : ariaLabel\n }\n aria-labelledby={ariaLabelledBy}\n />\n </Modal>\n );\n }\n);\nCommandDialog.displayName = 'CommandDialog';\n\n/** Command with Input, List, Group, Item, Empty and Dialog sub-components. */\nexport const Command = withSubComponents(\n CommandRoot,\n {\n Input: CommandInput,\n List: CommandList,\n Group: CommandGroup,\n Item: CommandItem,\n Empty: CommandEmpty,\n Dialog: CommandDialog,\n },\n 'Command'\n);\n\nexport default Command;\n"],"names":["typedNoMatches","nothingToAnnounce","isShown","noop","registerNothing","standalone","setRefs","_jsxs","_jsx"],"mappings":";;;;;;;;;;;;;;;;;;AA2BA;AACA,MAAM,YAAY,GAAG,UAAU;AAE/B;AACA,MAAM,YAAY,GAAG,YAAY;AAEjC;AACA;AACA;AACA,MAAMA,gBAAc,GAAG,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC;AACxC,MAAMC,mBAAiB,GAA0B,EAAE;AAEnD;AACA,M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X;AACE,IAAA,KAAK,EAAE,YAAY;AACnB,IAAA,IAAI,EAAE,WAAW;AACjB,IAAA,KAAK,EAAE,YAAY;AACnB,IAAA,IAAI,EAAE,WAAW;AACjB,IAAA,KAAK,EAAE,YAAY;AACnB,IAAA,MAAM,EAAE,aAAa;CACtB,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 { jsxs, Fragment, jsx } from 'react/jsx-runtime';
3
4
  import { useState, useRef, useEffect, cloneElement } from 'react';
4
5
  import { usePrefixedClassNames, classNames } from '../helpers/classNames.js';
@@ -1 +1 @@
1
- {"version":3,"file":"ContextMenu.js","sources":["../../../src/components/ContextMenu.tsx"],"sourcesContent":["import React, { cloneElement, useEffect, useRef, useState } 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 { useConfig } from '../helpers/Config';\nimport { useClientLayoutEffect } from '../helpers/useClientLayoutEffect';\nimport { getDeepestActiveElement, isEventInside } from '../helpers/shadowDom';\nimport { warnOnce } from '../helpers/devWarnings';\nimport {\n useContextMenuTrigger,\n type ContextMenuPoint,\n type ContextMenuTriggerHandlers,\n} from '../helpers/useContextMenuTrigger';\nimport {\n enabledMenuItems,\n isEnabledMenuItem,\n MENU_ITEM_SELECTOR,\n useMenuKeys,\n} from '../helpers/useMenuKeys';\nimport { DropdownDivider, DropdownItem } from './Dropdown';\n\n/**\n * Props for the ContextMenu component. `className`, `id`, `aria-label`, the\n * other HTML attributes and the helper props land on the menu\n * (`role=\"menu\"`). The trigger keeps its own.\n * @extraProp {string} [aria-label] - The menu's accessible name, such as \"Actions for report.pdf\". There's no button to borrow a name from, so pass this or `aria-labelledby`, and a development build warns when the menu opens with neither.\n * @extraProp {string} [className] - Additional classes for the menu (`role=\"menu\"`). The trigger keeps its own.\n */\nexport interface ContextMenuProps\n extends\n Omit<React.HTMLAttributes<HTMLDivElement>, 'color' | 'children'>,\n Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {\n /**\n * The element a right-click, Shift+F10, the context menu key or a long\n * press opens the menu from: a table row, a card, an image. It's cloned,\n * not wrapped, so a row stays a row, which means it has to be a single\n * element that passes `className` and the `onContextMenu`,\n * `onPointerDown`, `onPointerMove`, `onPointerUp`, `onPointerCancel` and\n * `onTouchEnd` handlers to its DOM node. Its own handlers for those run\n * first, and one that calls `preventDefault()` on `contextmenu` keeps the\n * menu closed. A `ContextMenu` inside it opens instead of this one.\n *\n * It gets no ARIA and no tab stop, since it can be any element and a\n * right-click isn't an activation. Keyboard users reach it through\n * something focusable inside it, such as the row's own `Dropdown` button,\n * or a `tabIndex={0}` you give it, and press Shift+F10 or the context menu\n * key there. It gets `-webkit-touch-callout: none`, so iOS doesn't put its\n * own callout for a link or an image over the menu. A long press still\n * selects text the way it does anywhere, so give a region where it\n * shouldn't `interaction=\"unselectable\"`.\n */\n trigger: React.ReactElement;\n /**\n * The menu's items: `ContextMenu.Item` and `ContextMenu.Divider`, the same\n * components as `Dropdown.Item` and `Dropdown.Divider`. Every action in it\n * needs a visible way in as well, such as a `Dropdown` on the same row:\n * nothing tells a screen reader user the menu is there, and on macOS only\n * VoiceOver opens it from the keyboard.\n */\n children: React.ReactNode;\n /**\n * Called with `true` when the menu opens and `false` when it closes,\n * whatever closed it, such as for highlighting the row whose menu is open.\n * Nothing fires after ContextMenu unmounts. There's no `open` prop to go\n * with it: a menu opened from code has no point to open at.\n */\n onOpenChange?: (open: boolean) => void;\n /**\n * Close the menu when an item is clicked, or activated with Enter or\n * Space. A click on a divider or between items leaves it open either way.\n */\n closeOnClick?: boolean;\n /**\n * Leave the trigger to the browser: a right-click shows the browser's own\n * menu, a long press does what it does anywhere, and an open menu closes.\n */\n disabled?: boolean;\n}\n\n/** Where the menu goes once it's measured. */\ninterface Placement {\n /** The box's corner in the viewport, which the menu hangs from. */\n top: number;\n left: number;\n /** The menu sits above the box rather than below it. */\n up: boolean;\n /** The menu sits to the left of the box rather than to its right. */\n right: boolean;\n}\n\n/** An open menu. */\ninterface OpenMenu {\n point: ContextMenuPoint;\n /** The trigger's document, where presses and scrolling are watched. */\n doc: Document;\n /** Unset until the menu is measured, which happens before it paints. */\n placed?: Placement;\n}\n\n/**\n * Where the menu goes along one axis, from the point at `at`: after it when\n * there's room, before it when there's room there instead, and otherwise\n * moved in until it fits in `room`.\n */\nfunction placeAlong(\n at: number,\n size: number,\n room: number\n): { start: number; flip: boolean } {\n if (at + size <= room) return { start: at, flip: false };\n if (at - size >= 0) return { start: at, flip: true };\n return { start: Math.max(0, room - size), flip: false };\n}\n\n/** Runs the trigger's own handler, then the context menu's. */\nfunction chain<E>(\n own: ((event: E) => void) | undefined,\n ours: (event: E) => void\n): (event: E) => void {\n return event => {\n own?.(event);\n ours(event);\n };\n}\n\n/**\n * The `ContextMenu` component opens a menu of actions where you right-click an element, such as a table row or a card, or long press it on a touch screen.\n *\n * Shift+F10 and the context menu key open it too, where the browser fires\n * `contextmenu` for them, which Windows and Linux do. The menu is Dropdown's\n * markup, portaled into the `portalContainer` a `ConfigProvider` sets, or\n * the end of the trigger's own document's `<body>`, so it never has server\n * markup. It opens below and to the right of the point, flips above or to\n * the left where there's no room, moves in where it fits neither way, and\n * scrolls inside when it's taller than the viewport. It doesn't follow the\n * trigger, since scrolling closes it. Inside a `Modal` or a shadow root,\n * point `portalContainer` inside it, so screen readers that honor\n * `aria-modal` reach the menu and the shadow root's styles apply.\n *\n * Opening moves focus to the first enabled item. The arrow keys, Home, End\n * and typing move between items, and Enter and Space activate one. Escape,\n * Tab, an item, a press outside, scrolling, resizing and the window losing\n * focus close it, handing focus back to what had it unless an item moved it\n * somewhere else. For a menu opened from a button use `Dropdown`.\n *\n * @function\n * @param {ContextMenuProps} props - Props for the ContextMenu component.\n * @returns {JSX.Element} The trigger, and the menu while open.\n *\n * @example\n * <ContextMenu\n * aria-label=\"Actions for report.pdf\"\n * trigger={<Box>report.pdf</Box>}\n * >\n * <ContextMenu.Item as=\"button\">Rename</ContextMenu.Item>\n * <ContextMenu.Divider />\n * <ContextMenu.Item as=\"button\">Delete</ContextMenu.Item>\n * </ContextMenu>\n */\nconst ContextMenuComponent: React.FC<ContextMenuProps> = ({\n trigger,\n children,\n onOpenChange,\n closeOnClick = true,\n disabled = false,\n className,\n onKeyDown,\n onClick,\n onContextMenu,\n ...props\n}) => {\n const { bulmaHelperClasses, rest } = useBulmaClasses(props);\n const { portalContainer } = useConfig();\n const [menu, setMenu] = useState<OpenMenu | null>(null);\n // Turning `disabled` on closes it.\n if (disabled && menu) setMenu(null);\n const open = menu !== null;\n const doc = menu?.doc;\n const placed = menu?.placed;\n\n const boxRef = useRef<HTMLDivElement>(null);\n const menuRef = useRef<HTMLDivElement>(null);\n const openerRef = useRef<Element | null>(null);\n const reportedRef = useRef(false);\n const menuKeys = useMenuKeys();\n const named = Boolean(props['aria-label'] || props['aria-labelledby']);\n\n const handlers = useContextMenuTrigger({\n disabled,\n onOpen: (point, triggerNode) => {\n const ownerDoc = triggerNode.ownerDocument;\n openerRef.current = getDeepestActiveElement(ownerDoc);\n setMenu({ point, doc: ownerDoc });\n },\n });\n\n // Measured once per opening, before it paints, against what a fixed box\n // resolves against: the root element's client area, which leaves out a\n // classic scrollbar. `useAnchoredPosition` and Tooltip read innerWidth and\n // innerHeight, which count it. A menu pinned to the viewport's edge would\n // sit under the scrollbar by that much, so this reads the narrower box.\n useClientLayoutEffect(() => {\n const menuNode = menuRef.current;\n if (!menu || menu.placed || !menuNode) return;\n const root = menuNode.ownerDocument.documentElement;\n const { width, height } = menuNode.getBoundingClientRect();\n const x = placeAlong(menu.point.x, width, root.clientWidth);\n const y = placeAlong(menu.point.y, height, root.clientHeight);\n setMenu({\n ...menu,\n placed: { left: x.start, top: y.start, right: x.flip, up: y.flip },\n });\n }, [menu]);\n const isPlaced = Boolean(placed);\n\n // What closes it while it's open, and focus back on closing. Nothing\n // listens while it's closed.\n useEffect(() => {\n const box = boxRef.current;\n const menuNode = menuRef.current;\n if (!doc || !box || !menuNode) return undefined;\n const view = doc.defaultView as Window;\n // What had focus when it opened. This runs once per opening, so opening\n // again at a new point while it's open keeps it.\n const opener = openerRef.current as HTMLElement | null;\n const close = () => setMenu(null);\n const closeOutside = (event: Event) => {\n if (!isEventInside(event, box)) close();\n };\n doc.addEventListener('pointerdown', closeOutside, true);\n view.addEventListener('resize', close);\n view.addEventListener('blur', close);\n return () => {\n doc.removeEventListener('pointerdown', closeOutside, true);\n view.removeEventListener('resize', close);\n view.removeEventListener('blur', close);\n // Back to what had focus while the menu still has it, or it dropped to\n // <body> when the menu left. An item that put it somewhere else, such\n // as a Modal or a rename field, keeps it there.\n const now = getDeepestActiveElement(doc);\n if (!now || now === doc.body || menuNode.contains(now)) opener?.focus();\n };\n }, [doc]);\n\n // Focus in, and closing on scroll, once it's placed. Placed, it's inside\n // the viewport, so its first item has nothing to scroll into view, and\n // `preventScroll` makes sure: a scroll the focus caused would close it as\n // it opened. Opening again at a new point places it again, and leaves\n // focus where it is in the menu.\n useEffect(() => {\n const box = boxRef.current;\n const menuNode = menuRef.current;\n if (!doc || !isPlaced || !box || !menuNode) return undefined;\n if (!menuNode.contains(getDeepestActiveElement(doc))) {\n menuKeys.reset();\n (enabledMenuItems(menuNode)[0] ?? menuNode).focus({\n preventScroll: true,\n });\n }\n const closeOutside = (event: Event) => {\n if (!isEventInside(event, box)) setMenu(null);\n };\n doc.addEventListener('scroll', closeOutside, true);\n return () => doc.removeEventListener('scroll', closeOutside, true);\n }, [doc, isPlaced, menuKeys]);\n\n // Before paint, so what the caller does with it, such as highlighting the\n // row, shows with the menu rather than a frame behind it.\n useClientLayoutEffect(() => {\n if (open === reportedRef.current) return;\n reportedRef.current = open;\n onOpenChange?.(open);\n });\n\n useEffect(() => {\n if (open && !named) {\n warnOnce(\n 'ContextMenu:unnamed',\n '[bestax-bulma] <ContextMenu> opened a menu with no accessible ' +\n 'name. Pass aria-label or aria-labelledby.'\n );\n }\n }, [open, named]);\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n onKeyDown?.(event);\n // The menu has the keyboard while focus is in it. React brings its keys\n // up the tree to wherever the ContextMenu sits, where a table that moves\n // between rows on the arrow keys, or a Popover or a Modal waiting for\n // Escape, would take them too.\n event.stopPropagation();\n if (event.key === 'Escape' || event.key === 'Tab') {\n // Tab would go on from the end of <body>, past the rest of the page.\n event.preventDefault();\n setMenu(null);\n return;\n }\n menuKeys.onKeyDown(event);\n };\n\n const handleClick = (event: React.MouseEvent<HTMLDivElement>) => {\n onClick?.(event);\n if (!closeOnClick) return;\n const item = (event.target as Element).closest(MENU_ITEM_SELECTOR);\n if (item && isEnabledMenuItem(item)) setMenu(null);\n };\n\n const handleContextMenu = (event: React.MouseEvent<HTMLDivElement>) => {\n onContextMenu?.(event);\n // No other menu over this one: not the browser's, and not a trigger's\n // that React brings the event up to.\n event.preventDefault();\n event.stopPropagation();\n };\n\n const own = trigger.props as Partial<ContextMenuTriggerHandlers> & {\n className?: string;\n };\n const triggerClass = usePrefixedClassNames('context-menu');\n const clonedTrigger = cloneElement(\n trigger as React.ReactElement<Record<string, unknown>>,\n {\n className:\n classNames(own.className, !disabled && triggerClass) || undefined,\n onContextMenu: chain(own.onContextMenu, handlers.onContextMenu),\n onPointerDown: chain(own.onPointerDown, handlers.onPointerDown),\n onPointerMove: chain(own.onPointerMove, handlers.onPointerMove),\n onPointerUp: chain(own.onPointerUp, handlers.onPointerUp),\n onPointerCancel: chain(own.onPointerCancel, handlers.onPointerCancel),\n onTouchEnd: chain(own.onTouchEnd, handlers.onTouchEnd),\n }\n );\n\n const boxClasses = usePrefixedClassNames('context-menu-content', 'dropdown', {\n 'is-active': true,\n 'is-up': placed?.up,\n 'is-right': placed?.right,\n });\n const menuClasses = classNames(\n usePrefixedClassNames('dropdown-menu'),\n bulmaHelperClasses,\n className\n );\n const contentClasses = usePrefixedClassNames('dropdown-content');\n\n return (\n <>\n {clonedTrigger}\n {menu && (\n <Portal container={portalContainer || menu.doc.body}>\n <div\n ref={boxRef}\n className={boxClasses}\n style={{\n top: placed?.top ?? menu.point.y,\n left: placed?.left ?? menu.point.x,\n }}\n >\n <div\n {...rest}\n ref={menuRef}\n role=\"menu\"\n tabIndex={-1}\n className={menuClasses}\n onKeyDown={handleKeyDown}\n onClick={handleClick}\n onContextMenu={handleContextMenu}\n >\n <div className={contentClasses}>{children}</div>\n </div>\n </div>\n </Portal>\n )}\n </>\n );\n};\n\n/**\n * ContextMenu with Item and Divider sub-components, which are `Dropdown.Item`\n * and `Dropdown.Divider`, so items written for a Dropdown work here\n * unchanged.\n */\nexport const ContextMenu = withSubComponents(\n ContextMenuComponent,\n {\n Item: DropdownItem,\n Divider: DropdownDivider,\n },\n 'ContextMenu'\n);\n\nexport default ContextMenu;\n"],"names":["_jsxs","_Fragment","_jsx"],"mappings":";;;;;;;;;;;;;;;AAoGA;;;;AAIG;AACH,SAAS,UAAU,CACjB,EAAU,EACV,IAAY,EACZ,IAAY,EAAA;AAEZ,IAAA,IAAI,EAAE,GAAG,IAAI,IAAI,IAAI;QAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE;AACxD,IAAA,IAAI,EAAE,GAAG,IAAI,IAAI,CAAC;QAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE;AACpD,IAAA,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE;AACzD;AAEA;AACA,SAAS,KAAK,CACZ,GAAqC,EACrC,IAAwB,EAAA;IAExB,OAAO,KAAK,IAAG;AACb,QAAA,GAAG,GAAG,KAAK,CAAC;QACZ,IAAI,CAAC,KAA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,EAAA,CAAO,EAAA,CAC5C,GACF,EAAA,CACC,CACV,CAAA,EAAA,CACA;AAEP,CAAC;AAED;;;;AAIG;AACI,MAAM,WAAW,GAAG,iBAAiB,CAC1C,oBAAoB,EACpB;AACE,IAAA,IAAI,EAAE,YAAY;AAClB,IAAA,OAAO,EAAE,eAAe;CACzB,EACD,aAAa;;"}
1
+ {"version":3,"file":"ContextMenu.js","sources":["../../../src/components/ContextMenu.tsx"],"sourcesContent":["import React, { cloneElement, useEffect, useRef, useState } 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 { useConfig } from '../helpers/Config';\nimport { useClientLayoutEffect } from '../helpers/useClientLayoutEffect';\nimport { getDeepestActiveElement, isEventInside } from '../helpers/shadowDom';\nimport { warnOnce } from '../helpers/devWarnings';\nimport {\n useContextMenuTrigger,\n type ContextMenuPoint,\n type ContextMenuTriggerHandlers,\n} from '../helpers/useContextMenuTrigger';\nimport {\n enabledMenuItems,\n isEnabledMenuItem,\n MENU_ITEM_SELECTOR,\n useMenuKeys,\n} from '../helpers/useMenuKeys';\nimport { DropdownDivider, DropdownItem } from './Dropdown';\n\n/**\n * Props for the ContextMenu component. `className`, `id`, `aria-label`, the\n * other HTML attributes and the helper props land on the menu\n * (`role=\"menu\"`). The trigger keeps its own.\n * @extraProp {string} [aria-label] - The menu's accessible name, such as \"Actions for report.pdf\". There's no button to borrow a name from, so pass this or `aria-labelledby`, and a development build warns when the menu opens with neither.\n * @extraProp {string} [className] - Additional classes for the menu (`role=\"menu\"`). The trigger keeps its own.\n */\nexport interface ContextMenuProps\n extends\n Omit<React.HTMLAttributes<HTMLDivElement>, 'color' | 'children'>,\n Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {\n /**\n * The element a right-click, Shift+F10, the context menu key or a long\n * press opens the menu from: a table row, a card, an image. It's cloned,\n * not wrapped, so a row stays a row, which means it has to be a single\n * element that passes `className` and the `onContextMenu`,\n * `onPointerDown`, `onPointerMove`, `onPointerUp`, `onPointerCancel` and\n * `onTouchEnd` handlers to its DOM node. Its own handlers for those run\n * first, and one that calls `preventDefault()` on `contextmenu` keeps the\n * menu closed. A `ContextMenu` inside it opens instead of this one.\n *\n * It gets no ARIA and no tab stop, since it can be any element and a\n * right-click isn't an activation. Keyboard users reach it through\n * something focusable inside it, such as the row's own `Dropdown` button,\n * or a `tabIndex={0}` you give it, and press Shift+F10 or the context menu\n * key there. It gets `-webkit-touch-callout: none`, so iOS doesn't put its\n * own callout for a link or an image over the menu. A long press still\n * selects text the way it does anywhere, so give a region where it\n * shouldn't `interaction=\"unselectable\"`.\n */\n trigger: React.ReactElement;\n /**\n * The menu's items: `ContextMenu.Item` and `ContextMenu.Divider`, the same\n * components as `Dropdown.Item` and `Dropdown.Divider`. Every action in it\n * needs a visible way in as well, such as a `Dropdown` on the same row:\n * nothing tells a screen reader user the menu is there, and on macOS only\n * VoiceOver opens it from the keyboard.\n */\n children: React.ReactNode;\n /**\n * Called with `true` when the menu opens and `false` when it closes,\n * whatever closed it, such as for highlighting the row whose menu is open.\n * Nothing fires after ContextMenu unmounts. There's no `open` prop to go\n * with it: a menu opened from code has no point to open at.\n */\n onOpenChange?: (open: boolean) => void;\n /**\n * Close the menu when an item is clicked, or activated with Enter or\n * Space. A click on a divider or between items leaves it open either way.\n */\n closeOnClick?: boolean;\n /**\n * Leave the trigger to the browser: a right-click shows the browser's own\n * menu, a long press does what it does anywhere, and an open menu closes.\n */\n disabled?: boolean;\n}\n\n/** Where the menu goes once it's measured. */\ninterface Placement {\n /** The box's corner in the viewport, which the menu hangs from. */\n top: number;\n left: number;\n /** The menu sits above the box rather than below it. */\n up: boolean;\n /** The menu sits to the left of the box rather than to its right. */\n right: boolean;\n}\n\n/** An open menu. */\ninterface OpenMenu {\n point: ContextMenuPoint;\n /** The trigger's document, where presses and scrolling are watched. */\n doc: Document;\n /** Unset until the menu is measured, which happens before it paints. */\n placed?: Placement;\n}\n\n/**\n * Where the menu goes along one axis, from the point at `at`: after it when\n * there's room, before it when there's room there instead, and otherwise\n * moved in until it fits in `room`.\n */\nfunction placeAlong(\n at: number,\n size: number,\n room: number\n): { start: number; flip: boolean } {\n if (at + size <= room) return { start: at, flip: false };\n if (at - size >= 0) return { start: at, flip: true };\n return { start: Math.max(0, room - size), flip: false };\n}\n\n/** Runs the trigger's own handler, then the context menu's. */\nfunction chain<E>(\n own: ((event: E) => void) | undefined,\n ours: (event: E) => void\n): (event: E) => void {\n return event => {\n own?.(event);\n ours(event);\n };\n}\n\n/**\n * The `ContextMenu` component opens a menu of actions where you right-click an element, such as a table row or a card, or long press it on a touch screen.\n *\n * Shift+F10 and the context menu key open it too, where the browser fires\n * `contextmenu` for them, which Windows and Linux do. The menu is Dropdown's\n * markup, portaled into the `portalContainer` a `ConfigProvider` sets, or\n * the end of the trigger's own document's `<body>`, so it never has server\n * markup. It opens below and to the right of the point, flips above or to\n * the left where there's no room, moves in where it fits neither way, and\n * scrolls inside when it's taller than the viewport. It doesn't follow the\n * trigger, since scrolling closes it. Inside a `Modal` or a shadow root,\n * point `portalContainer` inside it, so screen readers that honor\n * `aria-modal` reach the menu and the shadow root's styles apply.\n *\n * Opening moves focus to the first enabled item. The arrow keys, Home, End\n * and typing move between items, and Enter and Space activate one. Escape,\n * Tab, an item, a press outside, scrolling, resizing and the window losing\n * focus close it, handing focus back to what had it unless an item moved it\n * somewhere else. For a menu opened from a button use `Dropdown`.\n *\n * @function\n * @param {ContextMenuProps} props - Props for the ContextMenu component.\n * @returns {JSX.Element} The trigger, and the menu while open.\n *\n * @example\n * <ContextMenu\n * aria-label=\"Actions for report.pdf\"\n * trigger={<Box>report.pdf</Box>}\n * >\n * <ContextMenu.Item as=\"button\">Rename</ContextMenu.Item>\n * <ContextMenu.Divider />\n * <ContextMenu.Item as=\"button\">Delete</ContextMenu.Item>\n * </ContextMenu>\n */\nconst ContextMenuComponent: React.FC<ContextMenuProps> = ({\n trigger,\n children,\n onOpenChange,\n closeOnClick = true,\n disabled = false,\n className,\n onKeyDown,\n onClick,\n onContextMenu,\n ...props\n}) => {\n const { bulmaHelperClasses, rest } = useBulmaClasses(props);\n const { portalContainer } = useConfig();\n const [menu, setMenu] = useState<OpenMenu | null>(null);\n // Turning `disabled` on closes it.\n if (disabled && menu) setMenu(null);\n const open = menu !== null;\n const doc = menu?.doc;\n const placed = menu?.placed;\n\n const boxRef = useRef<HTMLDivElement>(null);\n const menuRef = useRef<HTMLDivElement>(null);\n const openerRef = useRef<Element | null>(null);\n const reportedRef = useRef(false);\n const menuKeys = useMenuKeys();\n const named = Boolean(props['aria-label'] || props['aria-labelledby']);\n\n const handlers = useContextMenuTrigger({\n disabled,\n onOpen: (point, triggerNode) => {\n const ownerDoc = triggerNode.ownerDocument;\n openerRef.current = getDeepestActiveElement(ownerDoc);\n setMenu({ point, doc: ownerDoc });\n },\n });\n\n // Measured once per opening, before it paints, against what a fixed box\n // resolves against: the root element's client area, which leaves out a\n // classic scrollbar. `useAnchoredPosition` and Tooltip read innerWidth and\n // innerHeight, which count it. A menu pinned to the viewport's edge would\n // sit under the scrollbar by that much, so this reads the narrower box.\n useClientLayoutEffect(() => {\n const menuNode = menuRef.current;\n if (!menu || menu.placed || !menuNode) return;\n const root = menuNode.ownerDocument.documentElement;\n const { width, height } = menuNode.getBoundingClientRect();\n const x = placeAlong(menu.point.x, width, root.clientWidth);\n const y = placeAlong(menu.point.y, height, root.clientHeight);\n setMenu({\n ...menu,\n placed: { left: x.start, top: y.start, right: x.flip, up: y.flip },\n });\n }, [menu]);\n const isPlaced = Boolean(placed);\n\n // What closes it while it's open, and focus back on closing. Nothing\n // listens while it's closed.\n useEffect(() => {\n const box = boxRef.current;\n const menuNode = menuRef.current;\n if (!doc || !box || !menuNode) return undefined;\n const view = doc.defaultView as Window;\n // What had focus when it opened. This runs once per opening, so opening\n // again at a new point while it's open keeps it.\n const opener = openerRef.current as HTMLElement | null;\n const close = () => setMenu(null);\n const closeOutside = (event: Event) => {\n if (!isEventInside(event, box)) close();\n };\n doc.addEventListener('pointerdown', closeOutside, true);\n view.addEventListener('resize', close);\n view.addEventListener('blur', close);\n return () => {\n doc.removeEventListener('pointerdown', closeOutside, true);\n view.removeEventListener('resize', close);\n view.removeEventListener('blur', close);\n // Back to what had focus while the menu still has it, or it dropped to\n // <body> when the menu left. An item that put it somewhere else, such\n // as a Modal or a rename field, keeps it there.\n const now = getDeepestActiveElement(doc);\n if (!now || now === doc.body || menuNode.contains(now)) opener?.focus();\n };\n }, [doc]);\n\n // Focus in, and closing on scroll, once it's placed. Placed, it's inside\n // the viewport, so its first item has nothing to scroll into view, and\n // `preventScroll` makes sure: a scroll the focus caused would close it as\n // it opened. Opening again at a new point places it again, and leaves\n // focus where it is in the menu.\n useEffect(() => {\n const box = boxRef.current;\n const menuNode = menuRef.current;\n if (!doc || !isPlaced || !box || !menuNode) return undefined;\n if (!menuNode.contains(getDeepestActiveElement(doc))) {\n menuKeys.reset();\n (enabledMenuItems(menuNode)[0] ?? menuNode).focus({\n preventScroll: true,\n });\n }\n const closeOutside = (event: Event) => {\n if (!isEventInside(event, box)) setMenu(null);\n };\n doc.addEventListener('scroll', closeOutside, true);\n return () => doc.removeEventListener('scroll', closeOutside, true);\n }, [doc, isPlaced, menuKeys]);\n\n // Before paint, so what the caller does with it, such as highlighting the\n // row, shows with the menu rather than a frame behind it.\n useClientLayoutEffect(() => {\n if (open === reportedRef.current) return;\n reportedRef.current = open;\n onOpenChange?.(open);\n });\n\n useEffect(() => {\n if (open && !named) {\n warnOnce(\n 'ContextMenu:unnamed',\n '[bestax-bulma] <ContextMenu> opened a menu with no accessible ' +\n 'name. Pass aria-label or aria-labelledby.'\n );\n }\n }, [open, named]);\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n onKeyDown?.(event);\n // The menu has the keyboard while focus is in it. React brings its keys\n // up the tree to wherever the ContextMenu sits, where a table that moves\n // between rows on the arrow keys, or a Popover or a Modal waiting for\n // Escape, would take them too.\n event.stopPropagation();\n if (event.key === 'Escape' || event.key === 'Tab') {\n // Tab would go on from the end of <body>, past the rest of the page.\n event.preventDefault();\n setMenu(null);\n return;\n }\n menuKeys.onKeyDown(event);\n };\n\n const handleClick = (event: React.MouseEvent<HTMLDivElement>) => {\n onClick?.(event);\n if (!closeOnClick) return;\n const item = (event.target as Element).closest(MENU_ITEM_SELECTOR);\n if (item && isEnabledMenuItem(item)) setMenu(null);\n };\n\n const handleContextMenu = (event: React.MouseEvent<HTMLDivElement>) => {\n onContextMenu?.(event);\n // No other menu over this one: not the browser's, and not a trigger's\n // that React brings the event up to.\n event.preventDefault();\n event.stopPropagation();\n };\n\n const own = trigger.props as Partial<ContextMenuTriggerHandlers> & {\n className?: string;\n };\n const triggerClass = usePrefixedClassNames('context-menu');\n const clonedTrigger = cloneElement(\n trigger as React.ReactElement<Record<string, unknown>>,\n {\n className:\n classNames(own.className, !disabled && triggerClass) || undefined,\n onContextMenu: chain(own.onContextMenu, handlers.onContextMenu),\n onPointerDown: chain(own.onPointerDown, handlers.onPointerDown),\n onPointerMove: chain(own.onPointerMove, handlers.onPointerMove),\n onPointerUp: chain(own.onPointerUp, handlers.onPointerUp),\n onPointerCancel: chain(own.onPointerCancel, handlers.onPointerCancel),\n onTouchEnd: chain(own.onTouchEnd, handlers.onTouchEnd),\n }\n );\n\n const boxClasses = usePrefixedClassNames('context-menu-content', 'dropdown', {\n 'is-active': true,\n 'is-up': placed?.up,\n 'is-right': placed?.right,\n });\n const menuClasses = classNames(\n usePrefixedClassNames('dropdown-menu'),\n bulmaHelperClasses,\n className\n );\n const contentClasses = usePrefixedClassNames('dropdown-content');\n\n return (\n <>\n {clonedTrigger}\n {menu && (\n <Portal container={portalContainer || menu.doc.body}>\n <div\n ref={boxRef}\n className={boxClasses}\n style={{\n top: placed?.top ?? menu.point.y,\n left: placed?.left ?? menu.point.x,\n }}\n >\n <div\n {...rest}\n ref={menuRef}\n role=\"menu\"\n tabIndex={-1}\n className={menuClasses}\n onKeyDown={handleKeyDown}\n onClick={handleClick}\n onContextMenu={handleContextMenu}\n >\n <div className={contentClasses}>{children}</div>\n </div>\n </div>\n </Portal>\n )}\n </>\n );\n};\n\n/**\n * ContextMenu with Item and Divider sub-components, which are `Dropdown.Item`\n * and `Dropdown.Divider`, so items written for a Dropdown work here\n * unchanged.\n */\nexport const ContextMenu = withSubComponents(\n ContextMenuComponent,\n {\n Item: DropdownItem,\n Divider: DropdownDivider,\n },\n 'ContextMenu'\n);\n\nexport default ContextMenu;\n"],"names":["_jsxs","_Fragment","_jsx"],"mappings":";;;;;;;;;;;;;;;;AAoGA;;;;AAIG;AACH,SAAS,UAAU,CACjB,EAAU,EACV,IAAY,EACZ,IAAY,EAAA;AAEZ,IAAA,IAAI,EAAE,GAAG,IAAI,IAAI,IAAI;QAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE;AACxD,IAAA,IAAI,EAAE,GAAG,IAAI,IAAI,CAAC;QAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE;AACpD,IAAA,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE;AACzD;AAEA;AACA,SAAS,KAAK,CACZ,GAAqC,EACrC,IAAwB,EAAA;IAExB,OAAO,KAAK,IAAG;AACb,QAAA,GAAG,GAAG,KAAK,CAAC;QACZ,IAAI,CAAC,KAAK,CAAC;AACb,IAAA,CAAC;AACH;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCG;AACH,MAAM,oBAAoB,GAA+B,CAAC,EACxD,OAAO,EACP,QAAQ,EACR,YAAY,EACZ,YAAY,GAAG,IAAI,EACnB,QAAQ,GAAG,KAAK,EAChB,SAAS,E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D,aAAa;;"}
@@ -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 { jsxs, jsx } from 'react/jsx-runtime';
3
4
  import { forwardRef, useId, useEffect, useState } from 'react';
4
5
  import { classNames, usePrefixedClassNames } from '../helpers/classNames.js';