@allxsmith/bestax-bulma 5.27.0 → 5.27.2

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 (348) hide show
  1. package/dist/bestax.css +1 -1
  2. package/dist/bestax.css.map +1 -1
  3. package/dist/esm/columns/Column.js +48 -0
  4. package/dist/esm/columns/Column.js.map +1 -0
  5. package/dist/esm/columns/Columns.js +53 -0
  6. package/dist/esm/columns/Columns.js.map +1 -0
  7. package/dist/esm/components/Avatar.js +299 -0
  8. package/dist/esm/components/Avatar.js.map +1 -0
  9. package/dist/esm/components/Avatars.js +81 -0
  10. package/dist/esm/components/Avatars.js.map +1 -0
  11. package/dist/esm/components/Badge.js +105 -0
  12. package/dist/esm/components/Badge.js.map +1 -0
  13. package/dist/esm/components/Breadcrumb.js +36 -0
  14. package/dist/esm/components/Breadcrumb.js.map +1 -0
  15. package/dist/esm/components/Card.js +252 -0
  16. package/dist/esm/components/Card.js.map +1 -0
  17. package/dist/esm/components/Carousel.js +351 -0
  18. package/dist/esm/components/Carousel.js.map +1 -0
  19. package/dist/esm/components/Collapse.js +193 -0
  20. package/dist/esm/components/Collapse.js.map +1 -0
  21. package/dist/esm/components/Collapses.js +99 -0
  22. package/dist/esm/components/Collapses.js.map +1 -0
  23. package/dist/esm/components/Dialog.js +230 -0
  24. package/dist/esm/components/Dialog.js.map +1 -0
  25. package/dist/esm/components/Dropdown.js +362 -0
  26. package/dist/esm/components/Dropdown.js.map +1 -0
  27. package/dist/esm/components/Loading.js +87 -0
  28. package/dist/esm/components/Loading.js.map +1 -0
  29. package/dist/esm/components/Menu.js +117 -0
  30. package/dist/esm/components/Menu.js.map +1 -0
  31. package/dist/esm/components/Message.js +56 -0
  32. package/dist/esm/components/Message.js.map +1 -0
  33. package/dist/esm/components/Modal.js +354 -0
  34. package/dist/esm/components/Modal.js.map +1 -0
  35. package/dist/esm/components/Navbar.js +287 -0
  36. package/dist/esm/components/Navbar.js.map +1 -0
  37. package/dist/esm/components/Pagination.js +191 -0
  38. package/dist/esm/components/Pagination.js.map +1 -0
  39. package/dist/esm/components/Panel.js +100 -0
  40. package/dist/esm/components/Panel.js.map +1 -0
  41. package/dist/esm/components/Popover.js +298 -0
  42. package/dist/esm/components/Popover.js.map +1 -0
  43. package/dist/esm/components/Reveal.js +157 -0
  44. package/dist/esm/components/Reveal.js.map +1 -0
  45. package/dist/esm/components/Sidebar.js +209 -0
  46. package/dist/esm/components/Sidebar.js.map +1 -0
  47. package/dist/esm/components/Steps.js +128 -0
  48. package/dist/esm/components/Steps.js.map +1 -0
  49. package/dist/esm/components/Tabs.js +335 -0
  50. package/dist/esm/components/Tabs.js.map +1 -0
  51. package/dist/esm/components/Toast.js +322 -0
  52. package/dist/esm/components/Toast.js.map +1 -0
  53. package/dist/esm/components/Tooltip.js +202 -0
  54. package/dist/esm/components/Tooltip.js.map +1 -0
  55. package/dist/esm/components/collapsesContext.js +12 -0
  56. package/dist/esm/components/collapsesContext.js.map +1 -0
  57. package/dist/esm/elements/Block.js +29 -0
  58. package/dist/esm/elements/Block.js.map +1 -0
  59. package/dist/esm/elements/Box.js +32 -0
  60. package/dist/esm/elements/Box.js.map +1 -0
  61. package/dist/esm/elements/Button.js +139 -0
  62. package/dist/esm/elements/Button.js.map +1 -0
  63. package/dist/esm/elements/Buttons.js +42 -0
  64. package/dist/esm/elements/Buttons.js.map +1 -0
  65. package/dist/esm/elements/Code.js +25 -0
  66. package/dist/esm/elements/Code.js.map +1 -0
  67. package/dist/esm/elements/Content.js +33 -0
  68. package/dist/esm/elements/Content.js.map +1 -0
  69. package/dist/esm/elements/Delete.js +35 -0
  70. package/dist/esm/elements/Delete.js.map +1 -0
  71. package/dist/esm/elements/Divider.js +27 -0
  72. package/dist/esm/elements/Divider.js.map +1 -0
  73. package/dist/esm/elements/Emphasis.js +25 -0
  74. package/dist/esm/elements/Emphasis.js.map +1 -0
  75. package/dist/esm/elements/Figure.js +58 -0
  76. package/dist/esm/elements/Figure.js.map +1 -0
  77. package/dist/esm/elements/Icon.js +256 -0
  78. package/dist/esm/elements/Icon.js.map +1 -0
  79. package/dist/esm/elements/IconText.js +36 -0
  80. package/dist/esm/elements/IconText.js.map +1 -0
  81. package/dist/esm/elements/Image.js +46 -0
  82. package/dist/esm/elements/Image.js.map +1 -0
  83. package/dist/esm/elements/Link.js +36 -0
  84. package/dist/esm/elements/Link.js.map +1 -0
  85. package/dist/esm/elements/LinkButton.js +37 -0
  86. package/dist/esm/elements/LinkButton.js.map +1 -0
  87. package/dist/esm/elements/ListItem.js +28 -0
  88. package/dist/esm/elements/ListItem.js.map +1 -0
  89. package/dist/esm/elements/Loader.js +37 -0
  90. package/dist/esm/elements/Loader.js.map +1 -0
  91. package/dist/esm/elements/Notification.js +316 -0
  92. package/dist/esm/elements/Notification.js.map +1 -0
  93. package/dist/esm/elements/OrderedList.js +31 -0
  94. package/dist/esm/elements/OrderedList.js.map +1 -0
  95. package/dist/esm/elements/Paragraph.js +28 -0
  96. package/dist/esm/elements/Paragraph.js.map +1 -0
  97. package/dist/esm/elements/Pre.js +25 -0
  98. package/dist/esm/elements/Pre.js.map +1 -0
  99. package/dist/esm/elements/Progress.js +33 -0
  100. package/dist/esm/elements/Progress.js.map +1 -0
  101. package/dist/esm/elements/Skeleton.js +30 -0
  102. package/dist/esm/elements/Skeleton.js.map +1 -0
  103. package/dist/esm/elements/Span.js +28 -0
  104. package/dist/esm/elements/Span.js.map +1 -0
  105. package/dist/esm/elements/Strong.js +25 -0
  106. package/dist/esm/elements/Strong.js.map +1 -0
  107. package/dist/esm/elements/SubTitle.js +51 -0
  108. package/dist/esm/elements/SubTitle.js.map +1 -0
  109. package/dist/esm/elements/Table.js +51 -0
  110. package/dist/esm/elements/Table.js.map +1 -0
  111. package/dist/esm/elements/Tag.js +49 -0
  112. package/dist/esm/elements/Tag.js.map +1 -0
  113. package/dist/esm/elements/Tags.js +34 -0
  114. package/dist/esm/elements/Tags.js.map +1 -0
  115. package/dist/esm/elements/Tbody.js +26 -0
  116. package/dist/esm/elements/Tbody.js.map +1 -0
  117. package/dist/esm/elements/Td.js +61 -0
  118. package/dist/esm/elements/Td.js.map +1 -0
  119. package/dist/esm/elements/Tfoot.js +26 -0
  120. package/dist/esm/elements/Tfoot.js.map +1 -0
  121. package/dist/esm/elements/Th.js +34 -0
  122. package/dist/esm/elements/Th.js.map +1 -0
  123. package/dist/esm/elements/Thead.js +26 -0
  124. package/dist/esm/elements/Thead.js.map +1 -0
  125. package/dist/esm/elements/Title.js +44 -0
  126. package/dist/esm/elements/Title.js.map +1 -0
  127. package/dist/esm/elements/Tr.js +31 -0
  128. package/dist/esm/elements/Tr.js.map +1 -0
  129. package/dist/esm/elements/UnorderedList.js +31 -0
  130. package/dist/esm/elements/UnorderedList.js.map +1 -0
  131. package/dist/esm/elements/iconProps.js +49 -0
  132. package/dist/esm/elements/iconProps.js.map +1 -0
  133. package/dist/esm/form/Autocomplete.js +279 -0
  134. package/dist/esm/form/Autocomplete.js.map +1 -0
  135. package/dist/esm/form/Checkbox.js +111 -0
  136. package/dist/esm/form/Checkbox.js.map +1 -0
  137. package/dist/esm/form/Checkboxes.js +90 -0
  138. package/dist/esm/form/Checkboxes.js.map +1 -0
  139. package/dist/esm/form/Control.js +79 -0
  140. package/dist/esm/form/Control.js.map +1 -0
  141. package/dist/esm/form/DateInput.js +88 -0
  142. package/dist/esm/form/DateInput.js.map +1 -0
  143. package/dist/esm/form/DateInputBase.js +263 -0
  144. package/dist/esm/form/DateInputBase.js.map +1 -0
  145. package/dist/esm/form/DateRangeInput.js +77 -0
  146. package/dist/esm/form/DateRangeInput.js.map +1 -0
  147. package/dist/esm/form/DateRangeInputBase.js +301 -0
  148. package/dist/esm/form/DateRangeInputBase.js.map +1 -0
  149. package/dist/esm/form/DateTimeInput.js +88 -0
  150. package/dist/esm/form/DateTimeInput.js.map +1 -0
  151. package/dist/esm/form/DateTimeInputBase.js +333 -0
  152. package/dist/esm/form/DateTimeInputBase.js.map +1 -0
  153. package/dist/esm/form/Field.js +167 -0
  154. package/dist/esm/form/Field.js.map +1 -0
  155. package/dist/esm/form/File.js +112 -0
  156. package/dist/esm/form/File.js.map +1 -0
  157. package/dist/esm/form/FormContext.js +194 -0
  158. package/dist/esm/form/FormContext.js.map +1 -0
  159. package/dist/esm/form/Input.js +88 -0
  160. package/dist/esm/form/Input.js.map +1 -0
  161. package/dist/esm/form/InputBase.js +40 -0
  162. package/dist/esm/form/InputBase.js.map +1 -0
  163. package/dist/esm/form/Numberinput.js +201 -0
  164. package/dist/esm/form/Numberinput.js.map +1 -0
  165. package/dist/esm/form/Radio.js +108 -0
  166. package/dist/esm/form/Radio.js.map +1 -0
  167. package/dist/esm/form/Radios.js +92 -0
  168. package/dist/esm/form/Radios.js.map +1 -0
  169. package/dist/esm/form/Rate.js +280 -0
  170. package/dist/esm/form/Rate.js.map +1 -0
  171. package/dist/esm/form/Select.js +81 -0
  172. package/dist/esm/form/Select.js.map +1 -0
  173. package/dist/esm/form/SelectBase.js +54 -0
  174. package/dist/esm/form/SelectBase.js.map +1 -0
  175. package/dist/esm/form/Slider.js +461 -0
  176. package/dist/esm/form/Slider.js.map +1 -0
  177. package/dist/esm/form/Switch.js +96 -0
  178. package/dist/esm/form/Switch.js.map +1 -0
  179. package/dist/esm/form/Taginput.js +351 -0
  180. package/dist/esm/form/Taginput.js.map +1 -0
  181. package/dist/esm/form/TextArea.js +77 -0
  182. package/dist/esm/form/TextArea.js.map +1 -0
  183. package/dist/esm/form/TextAreaBase.js +45 -0
  184. package/dist/esm/form/TextAreaBase.js.map +1 -0
  185. package/dist/esm/form/TimeInput.js +84 -0
  186. package/dist/esm/form/TimeInput.js.map +1 -0
  187. package/dist/esm/form/TimeInputBase.js +246 -0
  188. package/dist/esm/form/TimeInputBase.js.map +1 -0
  189. package/dist/esm/form/_pickerInternals/Calendar.js +760 -0
  190. package/dist/esm/form/_pickerInternals/Calendar.js.map +1 -0
  191. package/dist/esm/form/_pickerInternals/PickerPopover.js +95 -0
  192. package/dist/esm/form/_pickerInternals/PickerPopover.js.map +1 -0
  193. package/dist/esm/form/_pickerInternals/TimeWheels.js +721 -0
  194. package/dist/esm/form/_pickerInternals/TimeWheels.js.map +1 -0
  195. package/dist/esm/form/_pickerInternals/audioTick.js +109 -0
  196. package/dist/esm/form/_pickerInternals/audioTick.js.map +1 -0
  197. package/dist/esm/form/_pickerInternals/dateUtils.js +267 -0
  198. package/dist/esm/form/_pickerInternals/dateUtils.js.map +1 -0
  199. package/dist/esm/form/_pickerInternals/formatters.js +322 -0
  200. package/dist/esm/form/_pickerInternals/formatters.js.map +1 -0
  201. package/dist/esm/form/_pickerInternals/haptics.js +38 -0
  202. package/dist/esm/form/_pickerInternals/haptics.js.map +1 -0
  203. package/dist/esm/form/_pickerInternals/nativeInputSupport.js +25 -0
  204. package/dist/esm/form/_pickerInternals/nativeInputSupport.js.map +1 -0
  205. package/dist/esm/form/_pickerInternals/pickerTypes.js +50 -0
  206. package/dist/esm/form/_pickerInternals/pickerTypes.js.map +1 -0
  207. package/dist/esm/form/_pickerInternals/segmentMap.js +315 -0
  208. package/dist/esm/form/_pickerInternals/segmentMap.js.map +1 -0
  209. package/dist/esm/form/_pickerInternals/useNativeMobilePicker.js +49 -0
  210. package/dist/esm/form/_pickerInternals/useNativeMobilePicker.js.map +1 -0
  211. package/dist/esm/form/_pickerInternals/useSegmentedEntry.js +427 -0
  212. package/dist/esm/form/_pickerInternals/useSegmentedEntry.js.map +1 -0
  213. package/dist/esm/form/controlLoading.js +18 -0
  214. package/dist/esm/form/controlLoading.js.map +1 -0
  215. package/dist/esm/form/useAutoLabelId.js +88 -0
  216. package/dist/esm/form/useAutoLabelId.js.map +1 -0
  217. package/dist/esm/grid/Cell.js +35 -0
  218. package/dist/esm/grid/Cell.js.map +1 -0
  219. package/dist/esm/grid/Grid.js +51 -0
  220. package/dist/esm/grid/Grid.js.map +1 -0
  221. package/dist/esm/helpers/ClientOnly.js +33 -0
  222. package/dist/esm/helpers/ClientOnly.js.map +1 -0
  223. package/dist/esm/helpers/Config.js +60 -0
  224. package/dist/esm/helpers/Config.js.map +1 -0
  225. package/dist/esm/helpers/Theme.js +947 -0
  226. package/dist/esm/helpers/Theme.js.map +1 -0
  227. package/dist/esm/helpers/anchorAttrs.js +72 -0
  228. package/dist/esm/helpers/anchorAttrs.js.map +1 -0
  229. package/dist/esm/helpers/bulmaClassHelpers.js +415 -0
  230. package/dist/esm/helpers/bulmaClassHelpers.js.map +1 -0
  231. package/dist/esm/helpers/buttonType.js +24 -0
  232. package/dist/esm/helpers/buttonType.js.map +1 -0
  233. package/dist/esm/helpers/classNames.js +137 -0
  234. package/dist/esm/helpers/classNames.js.map +1 -0
  235. package/dist/esm/helpers/colorDeprecations.js +50 -0
  236. package/dist/esm/helpers/colorDeprecations.js.map +1 -0
  237. package/dist/esm/helpers/devWarnings.js +27 -0
  238. package/dist/esm/helpers/devWarnings.js.map +1 -0
  239. package/dist/esm/helpers/inertProps.js +27 -0
  240. package/dist/esm/helpers/inertProps.js.map +1 -0
  241. package/dist/esm/helpers/mergeBulmaStyles.js +20 -0
  242. package/dist/esm/helpers/mergeBulmaStyles.js.map +1 -0
  243. package/dist/esm/helpers/polymorphic.js +18 -0
  244. package/dist/esm/helpers/polymorphic.js.map +1 -0
  245. package/dist/esm/helpers/portal.js +76 -0
  246. package/dist/esm/helpers/portal.js.map +1 -0
  247. package/dist/esm/helpers/positionStacks.js +45 -0
  248. package/dist/esm/helpers/positionStacks.js.map +1 -0
  249. package/dist/esm/helpers/scrollLock.js +38 -0
  250. package/dist/esm/helpers/scrollLock.js.map +1 -0
  251. package/dist/esm/helpers/shadowDom.js +71 -0
  252. package/dist/esm/helpers/shadowDom.js.map +1 -0
  253. package/dist/esm/helpers/statusRegion.js +282 -0
  254. package/dist/esm/helpers/statusRegion.js.map +1 -0
  255. package/dist/esm/helpers/useAnchoredPosition.js +86 -0
  256. package/dist/esm/helpers/useAnchoredPosition.js.map +1 -0
  257. package/dist/esm/helpers/useBulmaClasses.js +158 -0
  258. package/dist/esm/helpers/useBulmaClasses.js.map +1 -0
  259. package/dist/esm/helpers/useClientLayoutEffect.js +13 -0
  260. package/dist/esm/helpers/useClientLayoutEffect.js.map +1 -0
  261. package/dist/esm/helpers/useColorClasses.js +84 -0
  262. package/dist/esm/helpers/useColorClasses.js.map +1 -0
  263. package/dist/esm/helpers/useFlexboxClasses.js +92 -0
  264. package/dist/esm/helpers/useFlexboxClasses.js.map +1 -0
  265. package/dist/esm/helpers/useFocusTrap.js +470 -0
  266. package/dist/esm/helpers/useFocusTrap.js.map +1 -0
  267. package/dist/esm/helpers/useIsHydrated.js +31 -0
  268. package/dist/esm/helpers/useIsHydrated.js.map +1 -0
  269. package/dist/esm/helpers/useOtherClasses.js +115 -0
  270. package/dist/esm/helpers/useOtherClasses.js.map +1 -0
  271. package/dist/esm/helpers/useSpacingClasses.js +82 -0
  272. package/dist/esm/helpers/useSpacingClasses.js.map +1 -0
  273. package/dist/esm/helpers/useTypographyClasses.js +93 -0
  274. package/dist/esm/helpers/useTypographyClasses.js.map +1 -0
  275. package/dist/esm/helpers/useVisibilityClasses.js +134 -0
  276. package/dist/esm/helpers/useVisibilityClasses.js.map +1 -0
  277. package/dist/esm/helpers/withSubComponents.js +24 -0
  278. package/dist/esm/helpers/withSubComponents.js.map +1 -0
  279. package/dist/esm/layout/Container.js +48 -0
  280. package/dist/esm/layout/Container.js.map +1 -0
  281. package/dist/esm/layout/Footer.js +33 -0
  282. package/dist/esm/layout/Footer.js.map +1 -0
  283. package/dist/esm/layout/Hero.js +90 -0
  284. package/dist/esm/layout/Hero.js.map +1 -0
  285. package/dist/esm/layout/Level.js +110 -0
  286. package/dist/esm/layout/Level.js.map +1 -0
  287. package/dist/esm/layout/Media.js +86 -0
  288. package/dist/esm/layout/Media.js.map +1 -0
  289. package/dist/esm/layout/Section.js +30 -0
  290. package/dist/esm/layout/Section.js.map +1 -0
  291. package/dist/extras.css +1 -1
  292. package/dist/extras.css.map +1 -1
  293. package/dist/index.cjs +187 -57
  294. package/dist/index.cjs.map +1 -1
  295. package/dist/index.esm.js +115 -17516
  296. package/dist/index.esm.js.map +1 -1
  297. package/dist/types/elements/Icon.d.ts +10 -7
  298. package/dist/types/form/Autocomplete.d.ts +1 -1
  299. package/dist/types/form/Checkboxes.d.ts +1 -1
  300. package/dist/types/form/DateInput.d.ts +1 -1
  301. package/dist/types/form/DateInputBase.d.ts +3 -4
  302. package/dist/types/form/DateRangeInput.d.ts +1 -1
  303. package/dist/types/form/DateTimeInput.d.ts +1 -1
  304. package/dist/types/form/DateTimeInputBase.d.ts +3 -4
  305. package/dist/types/form/Field.d.ts +2 -2
  306. package/dist/types/form/File.d.ts +4 -4
  307. package/dist/types/form/FormContext.d.ts +24 -2
  308. package/dist/types/form/Numberinput.d.ts +1 -1
  309. package/dist/types/form/Radios.d.ts +1 -1
  310. package/dist/types/form/Rate.d.ts +1 -1
  311. package/dist/types/form/Slider.d.ts +1 -1
  312. package/dist/types/form/Taginput.d.ts +1 -1
  313. package/dist/types/form/TimeInput.d.ts +1 -1
  314. package/dist/types/form/useAutoLabelId.d.ts +25 -4
  315. package/dist/types/helpers/Config.d.ts +3 -4
  316. package/dist/types/helpers/Theme.d.ts +44 -40
  317. package/dist/types-cjs/elements/Icon.d.ts +10 -7
  318. package/dist/types-cjs/form/Autocomplete.d.ts +1 -1
  319. package/dist/types-cjs/form/Checkboxes.d.ts +1 -1
  320. package/dist/types-cjs/form/DateInput.d.ts +1 -1
  321. package/dist/types-cjs/form/DateInputBase.d.ts +3 -4
  322. package/dist/types-cjs/form/DateRangeInput.d.ts +1 -1
  323. package/dist/types-cjs/form/DateTimeInput.d.ts +1 -1
  324. package/dist/types-cjs/form/DateTimeInputBase.d.ts +3 -4
  325. package/dist/types-cjs/form/Field.d.ts +2 -2
  326. package/dist/types-cjs/form/File.d.ts +4 -4
  327. package/dist/types-cjs/form/FormContext.d.ts +24 -2
  328. package/dist/types-cjs/form/Numberinput.d.ts +1 -1
  329. package/dist/types-cjs/form/Radios.d.ts +1 -1
  330. package/dist/types-cjs/form/Rate.d.ts +1 -1
  331. package/dist/types-cjs/form/Slider.d.ts +1 -1
  332. package/dist/types-cjs/form/Taginput.d.ts +1 -1
  333. package/dist/types-cjs/form/TimeInput.d.ts +1 -1
  334. package/dist/types-cjs/form/useAutoLabelId.d.ts +25 -4
  335. package/dist/types-cjs/helpers/Config.d.ts +3 -4
  336. package/dist/types-cjs/helpers/Theme.d.ts +44 -40
  337. package/dist/versions/bestax-no-dark-mode.css +1 -1
  338. package/dist/versions/bestax-no-dark-mode.css.map +1 -1
  339. package/dist/versions/bestax-no-helpers-prefixed.css +1 -1
  340. package/dist/versions/bestax-no-helpers-prefixed.css.map +1 -1
  341. package/dist/versions/bestax-no-helpers.css +1 -1
  342. package/dist/versions/bestax-no-helpers.css.map +1 -1
  343. package/dist/versions/bestax-prefixed.css +1 -1
  344. package/dist/versions/bestax-prefixed.css.map +1 -1
  345. package/package.json +1 -1
  346. package/src/scss/form/_dateinput.scss +37 -6
  347. package/src/scss/form/_datetimeinput.scss +7 -2
  348. package/src/scss/form/_picker-popover.scss +1 -4
@@ -0,0 +1,256 @@
1
+ /* @allxsmith/bestax-bulma — AI agents: see AGENTS.md in the package root, or https://bestax.io/llms.txt */
2
+ import { jsx } from 'react/jsx-runtime';
3
+ import { usePrefixedClassNames, classNames } from '../helpers/classNames.js';
4
+ import { useBulmaClasses } from '../helpers/useBulmaClasses.js';
5
+ import { useIconLibrary } from '../helpers/Config.js';
6
+
7
+ /**
8
+ * Strips a redundant leading library prefix from an icon name (e.g. `fa-check` -> `check`
9
+ * for the `fa` library, `mdi-account` -> `account` for `mdi`), so `name` behaves the same
10
+ * whether or not the caller includes the prefix. Font Awesome and Material Design Icons docs
11
+ * conventionally refer to icons with their class prefix (`fa-check`), which otherwise gets
12
+ * doubled by `getIconClasses` (producing `fa-fa-check`, matching no glyph).
13
+ *
14
+ * @param {string} name - The icon name, possibly including a redundant library prefix.
15
+ * @param {IconLibrary} library - The icon library the name will be rendered with.
16
+ * @returns {string} The icon name with any redundant leading library prefix removed.
17
+ */
18
+ function stripRedundantLibraryPrefix(name, library) {
19
+ if (!name) {
20
+ return name;
21
+ }
22
+ if (library === 'fa' && name.startsWith('fa-')) {
23
+ return name.substring(3);
24
+ }
25
+ if (library === 'mdi' && name.startsWith('mdi-')) {
26
+ return name.substring(4);
27
+ }
28
+ return name;
29
+ }
30
+ /**
31
+ * Gets the correct classes for the icon element based on the library and features.
32
+ *
33
+ * @param {IconLibrary} library - The icon library.
34
+ * @param {string} name - The icon name.
35
+ * @param {string} [variant] - Icon style variant (e.g., 'solid', 'outlined', 'rounded').
36
+ * @param {string | string[]} [features] - Additional library-specific modifiers.
37
+ * @returns {string} The combined class string for the icon.
38
+ */
39
+ function getIconClasses(library, name, variant, features) {
40
+ let baseClass;
41
+ let iconClass;
42
+ const featureList = Array.isArray(features)
43
+ ? features
44
+ : features
45
+ ? [features]
46
+ : [];
47
+ switch (library) {
48
+ case 'fa': {
49
+ // Font Awesome: use variant as style ('solid' -> 'fas', 'regular' -> 'far', etc.)
50
+ const styleMap = {
51
+ solid: 'fas',
52
+ regular: 'far',
53
+ brands: 'fab',
54
+ light: 'fal',
55
+ duotone: 'fad',
56
+ thin: 'fat',
57
+ };
58
+ const faStyle = variant ? styleMap[variant] || variant : 'fas';
59
+ baseClass = faStyle;
60
+ iconClass = `fa-${name}`;
61
+ return [baseClass, iconClass, ...featureList].join(' ');
62
+ }
63
+ case 'mdi':
64
+ // Material Design Icons: no variants, just features
65
+ baseClass = 'mdi';
66
+ iconClass = `mdi-${name}`;
67
+ return [baseClass, iconClass, ...featureList].join(' ');
68
+ case 'material-icons': {
69
+ // Google Material Icons: map variants to full class names
70
+ const styleVariants = {
71
+ filled: 'material-icons',
72
+ outlined: 'material-icons-outlined',
73
+ round: 'material-icons-round',
74
+ sharp: 'material-icons-sharp',
75
+ };
76
+ baseClass = variant
77
+ ? styleVariants[variant] || `material-icons-${variant}`
78
+ : 'material-icons';
79
+ return [baseClass, ...featureList].join(' ');
80
+ }
81
+ case 'material-symbols': {
82
+ // Google Material Symbols: map variants to full class names
83
+ const styleVariants = {
84
+ outlined: 'material-symbols-outlined',
85
+ rounded: 'material-symbols-rounded',
86
+ sharp: 'material-symbols-sharp',
87
+ };
88
+ baseClass = variant
89
+ ? styleVariants[variant] || `material-symbols-${variant}`
90
+ : 'material-symbols-outlined';
91
+ return [baseClass, ...featureList].join(' ');
92
+ }
93
+ default:
94
+ // fallback: just icon name and features
95
+ return [name, ...featureList].join(' ');
96
+ }
97
+ }
98
+ /**
99
+ * The `Icon` component is a Bulma-styled wrapper for displaying icons from various libraries (Font Awesome, Material Design Icons, Ionicons, Google Material Icons, Material Symbols, etc.).
100
+ *
101
+ * @function
102
+ * @param {IconProps} props - Props for the Icon component.
103
+ * @returns {JSX.Element} The rendered icon element.
104
+ * @see {@link https://bulma.io/documentation/elements/icon/ | Bulma Icon documentation}
105
+ */
106
+ const Icon = ({ className, textColor, bgColor, name, library, variant, features, libraryFeatures, // Deprecated but maintained for backward compatibility
107
+ size, ariaLabel, style, icon, // Capture and exclude the deprecated 'icon' prop from DOM
108
+ color: _color, // Exclude 'color' prop if passed directly
109
+ containerClassName, children, ...restProps }) => {
110
+ // Get the default icon library from context, fallback to 'fa' if not set
111
+ const defaultLibrary = useIconLibrary();
112
+ /**
113
+ * Generates Bulma helper classes and separates out remaining props.
114
+ * Note: variant, features, and libraryFeatures are excluded from props spread
115
+ */
116
+ const { bulmaHelperClasses, rest } = useBulmaClasses({
117
+ color: textColor,
118
+ backgroundColor: bgColor,
119
+ ...restProps,
120
+ });
121
+ // Hoisted unconditionally to respect rules-of-hooks; the branches below
122
+ // pick which result to consume.
123
+ const defaultIconClasses = usePrefixedClassNames('icon', {
124
+ [`is-${size}`]: size,
125
+ });
126
+ const sizeModifierClass = usePrefixedClassNames(size ? `is-${size}` : undefined);
127
+ const bulmaClasses = containerClassName
128
+ ? containerClassName
129
+ : defaultIconClasses;
130
+ const iconContainerClasses = classNames(bulmaClasses, containerClassName && size ? sizeModifierClass : undefined, bulmaHelperClasses, className);
131
+ // A named icon is an image, whose name is its label alone, so a ligature inside
132
+ // never leaks into it. An unnamed one is decorative and hidden outright. Spread
133
+ // before `rest`, so a caller's own `role` or `aria-hidden` still wins.
134
+ const named = !!ariaLabel || !!restProps['aria-label'] || !!restProps['aria-labelledby'];
135
+ // A caller's own `role` or `tabIndex` on an unnamed icon means it isn't decoration (an
136
+ // icon made a button, say), so it isn't hidden either: `aria-hidden` on something
137
+ // focusable is a failure of its own.
138
+ const a11yProps = named
139
+ ? { role: 'img', 'aria-label': ariaLabel || undefined }
140
+ : restProps.role !== undefined || restProps.tabIndex !== undefined
141
+ ? {}
142
+ : { 'aria-hidden': true };
143
+ if (children !== undefined) {
144
+ // `IconChildrenProps`: render the caller's node (an inline SVG, a `react-icons`
145
+ // component, …) in place of a class-based glyph. Library/variant/features don't apply.
146
+ return (jsx("span", { className: iconContainerClasses, ...a11yProps, style: style, ...rest, children: children }));
147
+ }
148
+ // `name` is guaranteed once `children` is absent UNLESS the caller is on the deprecated
149
+ // `icon` path, which `IconDeprecatedProps` declares with `name?: undefined`.
150
+ // (`IconChildrenProps['children']` excludes `undefined`, so `children={undefined}` can't
151
+ // slip past into this branch.) The cast covers that third member, and the `!name && icon`
152
+ // fallback below is what fills it in.
153
+ let finalName = name;
154
+ if (!name && icon) {
155
+ // If icon prop is provided instead of name, try to parse it
156
+ // e.g., "mdi mdi-rocket-launch" -> "rocket-launch"
157
+ if (typeof icon === 'string') {
158
+ const parts = icon.split(' ');
159
+ const lastPart = parts[parts.length - 1];
160
+ if (lastPart.startsWith('mdi-')) {
161
+ finalName = lastPart.substring(4); // Remove "mdi-" prefix
162
+ }
163
+ else if (lastPart.startsWith('fa-')) {
164
+ finalName = lastPart.substring(3); // Remove "fa-" prefix
165
+ }
166
+ else {
167
+ finalName = lastPart;
168
+ }
169
+ }
170
+ }
171
+ const finalLibrary = library || defaultLibrary || 'fa';
172
+ // Normalize a redundant leading library prefix (e.g. "fa-check" -> "check" when the
173
+ // library is 'fa'), so `name` behaves identically with or without the prefix.
174
+ finalName = stripRedundantLibraryPrefix(finalName, finalLibrary);
175
+ if (!finalName) {
176
+ // No glyph to name. Reachable through the public type only as `icon=""`, and otherwise
177
+ // by a plain-JS caller (or one that casts). Building a class off an absent name produced
178
+ // a bogus `fa-undefined` glyph; render the bare container instead, matching the
179
+ // `children` branch.
180
+ return (jsx("span", { className: iconContainerClasses, ...a11yProps, style: style, ...rest }));
181
+ }
182
+ // Backward compatibility: if libraryFeatures is provided, parse it for variant and features
183
+ let finalVariant = variant;
184
+ let finalFeatures = features;
185
+ if (libraryFeatures && !variant && !features) {
186
+ const legacyFeatures = Array.isArray(libraryFeatures)
187
+ ? libraryFeatures
188
+ : [libraryFeatures];
189
+ // For Font Awesome, extract style from features
190
+ if (finalLibrary === 'fa') {
191
+ const faStyle = legacyFeatures.find(f => [
192
+ 'fas',
193
+ 'far',
194
+ 'fab',
195
+ 'fal',
196
+ 'fad',
197
+ 'fat',
198
+ 'solid',
199
+ 'regular',
200
+ 'brands',
201
+ 'light',
202
+ 'duotone',
203
+ 'thin',
204
+ ].includes(f));
205
+ if (faStyle) {
206
+ finalVariant = faStyle;
207
+ finalFeatures = legacyFeatures.filter(f => f !== faStyle);
208
+ }
209
+ else {
210
+ finalFeatures = legacyFeatures;
211
+ }
212
+ }
213
+ // For Material Icons/Symbols, extract style variant
214
+ else if (finalLibrary === 'material-icons' ||
215
+ finalLibrary === 'material-symbols') {
216
+ const styleVariants = finalLibrary === 'material-icons'
217
+ ? ['filled', 'outlined', 'round', 'sharp']
218
+ : ['outlined', 'rounded', 'sharp'];
219
+ const styleVariant = legacyFeatures.find(f => styleVariants.includes(f));
220
+ if (styleVariant) {
221
+ finalVariant = styleVariant;
222
+ finalFeatures = legacyFeatures.filter(f => f !== styleVariant);
223
+ }
224
+ else {
225
+ finalFeatures = legacyFeatures;
226
+ }
227
+ }
228
+ // For others, all features go to finalFeatures
229
+ else {
230
+ finalFeatures = legacyFeatures;
231
+ }
232
+ }
233
+ // Handle web components vs CSS-based icons
234
+ if (finalLibrary === 'ion') {
235
+ // For Ionicons, handle variant in the name
236
+ let ionName = finalName;
237
+ if (finalVariant === 'outline') {
238
+ ionName = `${finalName}-outline`;
239
+ }
240
+ else if (finalVariant === 'sharp') {
241
+ ionName = `${finalName}-sharp`;
242
+ }
243
+ return (jsx("span", { className: iconContainerClasses, ...a11yProps, style: style, ...rest, children: jsx("ion-icon", { name: ionName }) }));
244
+ }
245
+ // Legacy CSS-based icons
246
+ const iClasses = getIconClasses(finalLibrary, finalName, finalVariant, finalFeatures);
247
+ // Material Icons and Material Symbols use text content, not CSS classes for the icon name
248
+ if (finalLibrary === 'material-icons' ||
249
+ finalLibrary === 'material-symbols') {
250
+ return (jsx("span", { className: iconContainerClasses, ...a11yProps, style: style, ...rest, children: jsx("i", { className: iClasses, children: finalName }) }));
251
+ }
252
+ return (jsx("span", { className: iconContainerClasses, ...a11yProps, style: style, ...rest, children: jsx("i", { className: iClasses }) }));
253
+ };
254
+
255
+ export { Icon };
256
+ //# sourceMappingURL=Icon.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Icon.js","sources":["../../../src/elements/Icon.tsx"],"sourcesContent":["import React from 'react';\nimport { classNames, usePrefixedClassNames } from '../helpers/classNames';\nimport {\n useBulmaClasses,\n BulmaClassesProps,\n validColors,\n} from '../helpers/useBulmaClasses';\nimport { useIconLibrary } from '../helpers/Config';\n\n// TypeScript declaration for Ionicons web component\ninterface IonIconProps extends React.HTMLAttributes<HTMLElement> {\n name?: string;\n src?: string;\n icon?: unknown;\n size?: string;\n lazy?: boolean;\n sanitize?: boolean;\n color?: string;\n flipRtl?: boolean;\n ariaLabel?: string;\n ariaHidden?: string;\n}\n\n// React 19 moved the global `JSX` namespace under the `react` module, so the\n// `<ion-icon>` web-component augmentation must target `React.JSX` to take effect.\ndeclare module 'react' {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace JSX {\n interface IntrinsicElements {\n 'ion-icon': IonIconProps;\n }\n }\n}\n\ntype IconLibrary = 'fa' | 'mdi' | 'ion' | 'material-icons' | 'material-symbols'; // 'fa' = Font Awesome, 'mdi' = Material Design Icons, 'ion' = Ionicons Web Components, 'material-icons' = Google Material Icons, 'material-symbols' = Google Material Symbols\n\n/**\n * Shared props for the Icon component, independent of whether a class-based `name` or a\n * custom `children` node supplies the glyph.\n */\ninterface IconBaseProps\n extends React.HTMLAttributes<HTMLSpanElement>, BulmaClassesProps {\n /** Additional CSS classes to apply. */\n className?: string;\n /** Text color helper. */\n textColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Bulma color modifier for the icon. */\n color?: 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger';\n /** Background color helper. */\n bgColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /**\n * Legacy icon class string (e.g. `'fas fa-star'`). Only its last segment is read, as the\n * glyph name; the library still comes from `library` or `ConfigProvider`, so\n * `'mdi mdi-rocket'` renders an `fa` class unless the effective library is already `mdi` —\n * set it here or on the provider.\n *\n * @deprecated Use `name` instead.\n */\n icon?: string;\n /**\n * The icon library to use ('fa' = Font Awesome, 'mdi' = Material Design Icons, 'ion' = Ionicons Web Components, 'material-icons' = Google Material Icons, 'material-symbols' = Google Material Symbols). Defaults to the value set in ConfigProvider or 'fa' if not configured. Ignored when `children` supplies the glyph instead of `name`.\n * @defaultValue 'fa'\n */\n library?: IconLibrary; // defaults to ConfigProvider iconLibrary or 'fa'\n /** Icon style variant (e.g. `'solid'`, `'outlined'`, `'rounded'`). Ignored when `children` supplies the glyph instead of `name`. */\n variant?: string; // e.g., 'solid', 'outlined', 'rounded', 'sharp'\n /** Additional modifiers (e.g. `'fa-lg'`, `'fa-spin'`, `'is-size-1'`). Ignored when `children` supplies the glyph instead of `name`. */\n features?: string | string[]; // e.g., 'fa-lg', 'fa-spin', 'is-size-1'\n /**\n * Additional modifiers in the older combined form, parsed into `variant` and `features`.\n *\n * @deprecated Use `variant` and `features` instead.\n */\n libraryFeatures?: string | string[];\n /** Size modifier for the icon container. */\n size?: 'small' | 'medium' | 'large';\n /**\n * Accessible name for an icon that means something on its own. Set it and the container\n * span gets `role=\"img\"` with this `aria-label`, so the name is exactly this text: a\n * Material ligature such as `rocket_launch` inside stays out of it. Leave it unset (or\n * empty) and the icon is decorative: the span renders `aria-hidden=\"true\"` and no name,\n * so it adds nothing to the accessible name of a `Button` or text around it. For an\n * icon-only control, put the name on the control (e.g. `Button`'s `aria-label`) and leave\n * this unset. A non-empty native `aria-label` or `aria-labelledby` passed instead also\n * counts as a name, and an explicit `role` or `aria-hidden` wins over both defaults. An\n * unnamed icon given a `role` or a `tabIndex` of its own isn't hidden, since hiding\n * something focusable is a failure of its own.\n */\n ariaLabel?: string;\n /** Inline style object. */\n style?: React.CSSProperties;\n /** Override the default `'icon'` container class (e.g., `'panel-icon'`). */\n containerClassName?: string; // Override the default 'icon' container class (e.g., 'panel-icon')\n}\n\n/**\n * Props for `Icon` rendering a class-based glyph from an icon library.\n */\nexport interface IconNameProps extends IconBaseProps {\n /** The icon name, with or without its library prefix (e.g. `'star'` or `'fa-star'`). Mutually exclusive with `children`. */\n name: string; // e.g., 'star', 'account', 'home-outline'\n /** A custom node (an inline SVG, a `react-icons` component, …) rendered inside the icon container in place of a class-based glyph. Mutually exclusive with `name`. */\n children?: never;\n}\n\n/**\n * Props for `Icon` rendering a custom node (an inline SVG, a `react-icons` component, a Font\n * Awesome React `<FontAwesomeIcon>`, …) in place of a class-based glyph.\n */\nexport interface IconChildrenProps extends IconBaseProps {\n /** The icon name, with or without its library prefix (e.g. `'star'` or `'fa-star'`). Mutually exclusive with `children`. */\n name?: undefined;\n /** A custom node (an inline SVG, a `react-icons` component, …) rendered inside the icon container in place of a class-based glyph. Mutually exclusive with `name`. */\n // `undefined` is excluded deliberately: the renderer discriminates on `children !== undefined`,\n // so `children={undefined}` would satisfy the type but fall through to the `name` path with no\n // name and render an `fa-undefined` glyph. Excluding it keeps the advertised\n // exactly-one-of-`name`-or-`children` constraint matching what actually renders.\n children: Exclude<React.ReactNode, undefined>;\n}\n\n/**\n * Props for `Icon` naming its glyph through the deprecated `icon` prop instead of `name`.\n *\n * The runtime has always accepted `icon` on its own — it strips a leading library prefix off\n * the class string and falls through to the `name` path — but the type offered no member without\n * a `name` or `children`, so every caller still on the deprecated prop got an error the\n * package could not see — until #663 nothing here type-checked a test or a story, so the\n * three `Icon.test.tsx` cases exercising this path proved the runtime and said nothing about\n * the type. Declaring the path is the honest resolution: it is deprecated, not removed, and a\n * deprecation that does not type-check is a removal announced only to whoever tries it.\n *\n * @deprecated Pass `name` instead. This member goes when `icon` does.\n */\nexport interface IconDeprecatedProps extends IconBaseProps {\n /**\n * Legacy icon class string (e.g. `'fas fa-star'`). Only its last segment is read, as the\n * glyph name; the library still comes from `library` or `ConfigProvider`, so\n * `'mdi mdi-rocket'` renders an `fa` class unless the effective library is already `mdi` —\n * set it here or on the provider.\n *\n * @deprecated Use `name` instead.\n */\n // Required here, optional on `IconBaseProps`: the other two members allow it\n // alongside `name`, and this one is the member where it IS the glyph. Same\n // prose in both places on purpose — the API-docs extractor reads whichever it\n // reaches first, and the two must not drift apart.\n icon: string;\n /** The icon name. Absent on this path — `icon` supplies the glyph. */\n name?: undefined;\n /** A custom node. Mutually exclusive with `icon`. */\n children?: never;\n}\n\n/**\n * Props for the Icon component — a discriminated union of a class-based `name`, a custom\n * `children` node, and the deprecated `icon` class string.\n */\nexport type IconProps = IconNameProps | IconChildrenProps | IconDeprecatedProps;\n\n/**\n * Strips a redundant leading library prefix from an icon name (e.g. `fa-check` -> `check`\n * for the `fa` library, `mdi-account` -> `account` for `mdi`), so `name` behaves the same\n * whether or not the caller includes the prefix. Font Awesome and Material Design Icons docs\n * conventionally refer to icons with their class prefix (`fa-check`), which otherwise gets\n * doubled by `getIconClasses` (producing `fa-fa-check`, matching no glyph).\n *\n * @param {string} name - The icon name, possibly including a redundant library prefix.\n * @param {IconLibrary} library - The icon library the name will be rendered with.\n * @returns {string} The icon name with any redundant leading library prefix removed.\n */\nfunction stripRedundantLibraryPrefix(\n name: string,\n library: IconLibrary\n): string {\n if (!name) {\n return name;\n }\n if (library === 'fa' && name.startsWith('fa-')) {\n return name.substring(3);\n }\n if (library === 'mdi' && name.startsWith('mdi-')) {\n return name.substring(4);\n }\n return name;\n}\n\n/**\n * Gets the correct classes for the icon element based on the library and features.\n *\n * @param {IconLibrary} library - The icon library.\n * @param {string} name - The icon name.\n * @param {string} [variant] - Icon style variant (e.g., 'solid', 'outlined', 'rounded').\n * @param {string | string[]} [features] - Additional library-specific modifiers.\n * @returns {string} The combined class string for the icon.\n */\nfunction getIconClasses(\n library: IconLibrary,\n name: string,\n variant?: string,\n features?: string | string[]\n): string {\n let baseClass: string;\n let iconClass: string;\n const featureList = Array.isArray(features)\n ? features\n : features\n ? [features]\n : [];\n\n switch (library) {\n case 'fa': {\n // Font Awesome: use variant as style ('solid' -> 'fas', 'regular' -> 'far', etc.)\n const styleMap: Record<string, string> = {\n solid: 'fas',\n regular: 'far',\n brands: 'fab',\n light: 'fal',\n duotone: 'fad',\n thin: 'fat',\n };\n const faStyle = variant ? styleMap[variant] || variant : 'fas';\n baseClass = faStyle;\n iconClass = `fa-${name}`;\n return [baseClass, iconClass, ...featureList].join(' ');\n }\n case 'mdi':\n // Material Design Icons: no variants, just features\n baseClass = 'mdi';\n iconClass = `mdi-${name}`;\n return [baseClass, iconClass, ...featureList].join(' ');\n case 'material-icons': {\n // Google Material Icons: map variants to full class names\n const styleVariants: Record<string, string> = {\n filled: 'material-icons',\n outlined: 'material-icons-outlined',\n round: 'material-icons-round',\n sharp: 'material-icons-sharp',\n };\n baseClass = variant\n ? styleVariants[variant] || `material-icons-${variant}`\n : 'material-icons';\n return [baseClass, ...featureList].join(' ');\n }\n case 'material-symbols': {\n // Google Material Symbols: map variants to full class names\n const styleVariants: Record<string, string> = {\n outlined: 'material-symbols-outlined',\n rounded: 'material-symbols-rounded',\n sharp: 'material-symbols-sharp',\n };\n baseClass = variant\n ? styleVariants[variant] || `material-symbols-${variant}`\n : 'material-symbols-outlined';\n return [baseClass, ...featureList].join(' ');\n }\n default:\n // fallback: just icon name and features\n return [name, ...featureList].join(' ');\n }\n}\n\n/**\n * The `Icon` component is a Bulma-styled wrapper for displaying icons from various libraries (Font Awesome, Material Design Icons, Ionicons, Google Material Icons, Material Symbols, etc.).\n *\n * @function\n * @param {IconProps} props - Props for the Icon component.\n * @returns {JSX.Element} The rendered icon element.\n * @see {@link https://bulma.io/documentation/elements/icon/ | Bulma Icon documentation}\n */\nexport const Icon: React.FC<IconProps> = ({\n className,\n textColor,\n bgColor,\n name,\n library,\n variant,\n features,\n libraryFeatures, // Deprecated but maintained for backward compatibility\n size,\n ariaLabel,\n style,\n icon, // Capture and exclude the deprecated 'icon' prop from DOM\n color: _color, // Exclude 'color' prop if passed directly\n containerClassName,\n children,\n ...restProps\n}) => {\n // Get the default icon library from context, fallback to 'fa' if not set\n const defaultLibrary = useIconLibrary();\n\n /**\n * Generates Bulma helper classes and separates out remaining props.\n * Note: variant, features, and libraryFeatures are excluded from props spread\n */\n const { bulmaHelperClasses, rest } = useBulmaClasses({\n color: textColor,\n backgroundColor: bgColor,\n ...restProps,\n });\n\n // Hoisted unconditionally to respect rules-of-hooks; the branches below\n // pick which result to consume.\n const defaultIconClasses = usePrefixedClassNames('icon', {\n [`is-${size}`]: size,\n });\n const sizeModifierClass = usePrefixedClassNames(\n size ? `is-${size}` : undefined\n );\n\n const bulmaClasses = containerClassName\n ? containerClassName\n : defaultIconClasses;\n\n const iconContainerClasses = classNames(\n bulmaClasses,\n containerClassName && size ? sizeModifierClass : undefined,\n bulmaHelperClasses,\n className\n );\n\n // A named icon is an image, whose name is its label alone, so a ligature inside\n // never leaks into it. An unnamed one is decorative and hidden outright. Spread\n // before `rest`, so a caller's own `role` or `aria-hidden` still wins.\n const named =\n !!ariaLabel || !!restProps['aria-label'] || !!restProps['aria-labelledby'];\n // A caller's own `role` or `tabIndex` on an unnamed icon means it isn't decoration (an\n // icon made a button, say), so it isn't hidden either: `aria-hidden` on something\n // focusable is a failure of its own.\n const a11yProps = named\n ? { role: 'img', 'aria-label': ariaLabel || undefined }\n : restProps.role !== undefined || restProps.tabIndex !== undefined\n ? {}\n : { 'aria-hidden': true };\n\n if (children !== undefined) {\n // `IconChildrenProps`: render the caller's node (an inline SVG, a `react-icons`\n // component, …) in place of a class-based glyph. Library/variant/features don't apply.\n return (\n <span\n className={iconContainerClasses}\n {...a11yProps}\n style={style}\n {...rest}\n >\n {children}\n </span>\n );\n }\n\n // `name` is guaranteed once `children` is absent UNLESS the caller is on the deprecated\n // `icon` path, which `IconDeprecatedProps` declares with `name?: undefined`.\n // (`IconChildrenProps['children']` excludes `undefined`, so `children={undefined}` can't\n // slip past into this branch.) The cast covers that third member, and the `!name && icon`\n // fallback below is what fills it in.\n let finalName = name as string;\n if (!name && icon) {\n // If icon prop is provided instead of name, try to parse it\n // e.g., \"mdi mdi-rocket-launch\" -> \"rocket-launch\"\n if (typeof icon === 'string') {\n const parts = icon.split(' ');\n const lastPart = parts[parts.length - 1];\n if (lastPart.startsWith('mdi-')) {\n finalName = lastPart.substring(4); // Remove \"mdi-\" prefix\n } else if (lastPart.startsWith('fa-')) {\n finalName = lastPart.substring(3); // Remove \"fa-\" prefix\n } else {\n finalName = lastPart;\n }\n }\n }\n\n const finalLibrary = library || defaultLibrary || 'fa';\n\n // Normalize a redundant leading library prefix (e.g. \"fa-check\" -> \"check\" when the\n // library is 'fa'), so `name` behaves identically with or without the prefix.\n finalName = stripRedundantLibraryPrefix(finalName, finalLibrary);\n\n if (!finalName) {\n // No glyph to name. Reachable through the public type only as `icon=\"\"`, and otherwise\n // by a plain-JS caller (or one that casts). Building a class off an absent name produced\n // a bogus `fa-undefined` glyph; render the bare container instead, matching the\n // `children` branch.\n return (\n <span\n className={iconContainerClasses}\n {...a11yProps}\n style={style}\n {...rest}\n />\n );\n }\n\n // Backward compatibility: if libraryFeatures is provided, parse it for variant and features\n let finalVariant = variant;\n let finalFeatures = features;\n\n if (libraryFeatures && !variant && !features) {\n const legacyFeatures = Array.isArray(libraryFeatures)\n ? libraryFeatures\n : [libraryFeatures];\n\n // For Font Awesome, extract style from features\n if (finalLibrary === 'fa') {\n const faStyle = legacyFeatures.find(f =>\n [\n 'fas',\n 'far',\n 'fab',\n 'fal',\n 'fad',\n 'fat',\n 'solid',\n 'regular',\n 'brands',\n 'light',\n 'duotone',\n 'thin',\n ].includes(f)\n );\n if (faStyle) {\n finalVariant = faStyle;\n finalFeatures = legacyFeatures.filter(f => f !== faStyle);\n } else {\n finalFeatures = legacyFeatures;\n }\n }\n // For Material Icons/Symbols, extract style variant\n else if (\n finalLibrary === 'material-icons' ||\n finalLibrary === 'material-symbols'\n ) {\n const styleVariants =\n finalLibrary === 'material-icons'\n ? ['filled', 'outlined', 'round', 'sharp']\n : ['outlined', 'rounded', 'sharp'];\n\n const styleVariant = legacyFeatures.find(f => styleVariants.includes(f));\n if (styleVariant) {\n finalVariant = styleVariant;\n finalFeatures = legacyFeatures.filter(f => f !== styleVariant);\n } else {\n finalFeatures = legacyFeatures;\n }\n }\n // For others, all features go to finalFeatures\n else {\n finalFeatures = legacyFeatures;\n }\n }\n\n // Handle web components vs CSS-based icons\n if (finalLibrary === 'ion') {\n // For Ionicons, handle variant in the name\n let ionName = finalName;\n if (finalVariant === 'outline') {\n ionName = `${finalName}-outline`;\n } else if (finalVariant === 'sharp') {\n ionName = `${finalName}-sharp`;\n }\n\n return (\n <span\n className={iconContainerClasses}\n {...a11yProps}\n style={style}\n {...rest}\n >\n <ion-icon name={ionName} />\n </span>\n );\n }\n\n // Legacy CSS-based icons\n const iClasses = getIconClasses(\n finalLibrary,\n finalName,\n finalVariant,\n finalFeatures\n );\n\n // Material Icons and Material Symbols use text content, not CSS classes for the icon name\n if (\n finalLibrary === 'material-icons' ||\n finalLibrary === 'material-symbols'\n ) {\n return (\n <span\n className={iconContainerClasses}\n {...a11yProps}\n style={style}\n {...rest}\n >\n <i className={iClasses}>{finalName}</i>\n </span>\n );\n }\n\n return (\n <span\n className={iconContainerClasses}\n {...a11yProps}\n style={style}\n {...rest}\n >\n <i className={iClasses} />\n </span>\n );\n};\n"],"names":["_jsx"],"mappings":"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"}
@@ -0,0 +1,36 @@
1
+ /* @allxsmith/bestax-bulma — AI agents: see AGENTS.md in the package root, or https://bestax.io/llms.txt */
2
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
3
+ import React from 'react';
4
+ import { usePrefixedClassNames, classNames } from '../helpers/classNames.js';
5
+ import { withSubComponents } from '../helpers/withSubComponents.js';
6
+ import { useBulmaClasses } from '../helpers/useBulmaClasses.js';
7
+ import { Icon } from './Icon.js';
8
+ import { isIconProps } from './iconProps.js';
9
+
10
+ /**
11
+ * The `IconText` component provides a Bulma-styled horizontal arrangement of one or more `Icon` components and optional text.
12
+ *
13
+ * @function
14
+ * @param {IconTextProps} props - Props for the IconText component.
15
+ * @returns {JSX.Element} The rendered icon text element.
16
+ * @see {@link https://bulma.io/documentation/elements/icon/#icon-text | Bulma IconText documentation}
17
+ */
18
+ const IconTextComponent = ({ className, textColor, color, bgColor, iconProps, children, items, ...props }) => {
19
+ /**
20
+ * Generates Bulma helper classes and separates out remaining props.
21
+ */
22
+ const { bulmaHelperClasses, rest } = useBulmaClasses({
23
+ color: textColor ?? color,
24
+ backgroundColor: bgColor,
25
+ ...props,
26
+ });
27
+ const bulmaClasses = usePrefixedClassNames('icon-text');
28
+ const iconTextClasses = classNames(bulmaClasses, bulmaHelperClasses, className);
29
+ return (jsx("span", { className: iconTextClasses, ...rest, children: items ? (items.map((item, index) => (jsxs(React.Fragment, { children: [item.iconProps &&
30
+ (isIconProps(item.iconProps) ? (jsx(Icon, { ...item.iconProps })) : (jsx(Icon, { children: item.iconProps }))), item.text && jsx("span", { children: item.text })] }, index)))) : (jsxs(Fragment, { children: [iconProps &&
31
+ (isIconProps(iconProps) ? (jsx(Icon, { ...iconProps })) : (jsx(Icon, { children: iconProps }))), children && jsx("span", { children: children })] })) }));
32
+ };
33
+ const IconText = withSubComponents(IconTextComponent, { Icon }, 'IconText');
34
+
35
+ export { IconText };
36
+ //# sourceMappingURL=IconText.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IconText.js","sources":["../../../src/elements/IconText.tsx"],"sourcesContent":["import React from 'react';\nimport { classNames, usePrefixedClassNames } from '../helpers/classNames';\nimport { withSubComponents } from '../helpers/withSubComponents';\nimport {\n useBulmaClasses,\n BulmaClassesProps,\n validColors,\n} from '../helpers/useBulmaClasses';\nimport { Icon, IconProps } from './Icon';\nimport { isIconProps } from './iconProps';\n\n/**\n * Represents an item for the IconText component, containing icon props and optional text.\n */\ninterface IconTextItem {\n /** Props for the Icon component, or a custom node (an inline SVG, a `react-icons` component, …) rendered in place of a class-based glyph. */\n iconProps: IconProps | React.ReactNode;\n /** Optional text to display next to the icon. */\n text?: string;\n}\n\n/**\n * Props for the IconText component.\n */\ninterface IconTextProps\n extends React.HTMLAttributes<HTMLSpanElement>, BulmaClassesProps {\n /** Additional CSS classes to apply. */\n className?: string;\n /** Text color helper. */\n textColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /**\n * Text color alias: renders `has-text-<color>`, exactly like `textColor`.\n * Not a filled variant (no `.icon-text.is-<color>` CSS exists). Prefer\n * `textColor`, which takes precedence when both are set; use `bgColor` for\n * a colored surface.\n */\n color?: 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger';\n /** Background color helper. */\n bgColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Props for a single Icon component, or a custom node, for single icon mode. */\n iconProps?: IconProps | React.ReactNode; // For single icon\n /** Text for a single icon (for single icon mode). */\n children?: React.ReactNode; // Text for single icon\n /** Array of icon/text pairs (for multiple icons mode). */\n items?: IconTextItem[]; // For multiple icons\n}\n\n/**\n * The `IconText` component provides a Bulma-styled horizontal arrangement of one or more `Icon` components and optional text.\n *\n * @function\n * @param {IconTextProps} props - Props for the IconText component.\n * @returns {JSX.Element} The rendered icon text element.\n * @see {@link https://bulma.io/documentation/elements/icon/#icon-text | Bulma IconText documentation}\n */\nconst IconTextComponent: React.FC<IconTextProps> = ({\n className,\n textColor,\n color,\n bgColor,\n iconProps,\n children,\n items,\n ...props\n}) => {\n /**\n * Generates Bulma helper classes and separates out remaining props.\n */\n const { bulmaHelperClasses, rest } = useBulmaClasses({\n color: textColor ?? color,\n backgroundColor: bgColor,\n ...props,\n });\n\n const bulmaClasses = usePrefixedClassNames('icon-text');\n const iconTextClasses = classNames(\n bulmaClasses,\n bulmaHelperClasses,\n className\n );\n\n return (\n <span className={iconTextClasses} {...rest}>\n {items ? (\n items.map((item, index) => (\n <React.Fragment key={index}>\n {item.iconProps &&\n (isIconProps(item.iconProps) ? (\n <Icon {...item.iconProps} />\n ) : (\n <Icon>{item.iconProps}</Icon>\n ))}\n {item.text && <span>{item.text}</span>}\n </React.Fragment>\n ))\n ) : (\n <>\n {iconProps &&\n (isIconProps(iconProps) ? (\n <Icon {...iconProps} />\n ) : (\n <Icon>{iconProps}</Icon>\n ))}\n {children && <span>{children}</span>}\n </>\n )}\n </span>\n );\n};\n\nexport const IconText = withSubComponents(\n IconTextComponent,\n { Icon },\n 'IconText'\n);\n"],"names":["_jsx","_jsxs","_Fragment"],"mappings":";;;;;;;;;AA+CA;;;;;;;AAOG;AACH,MAAM,iBAAiB,GAA4B,CAAC,EAClD,SAAS,EACT,SAAS,EACT,KAAK,EACL,OAAO,EACP,SAAS,EACT,QAAQ,EACR,KAAK,EACL,GAAG,KAAK,EACT,KAAI;AACH;;AAEG;AACH,IAAA,MAAM,EAAE,kBAAkB,EAAE,IAAI,EAAE,GAAG,eAAe,CAAC;QACnD,KAAK,EAAE,SAAS,IAAI,KAAK;AACzB,QAAA,eAAe,EAAE,OAAO;AACxB,QAAA,GAAG,KAAK;AACT,KAAA,CAAC;AAEF,IAAA,MAAM,YAAY,GAAG,qBAAqB,CAAC,WAAW,CAAC;IACvD,MAAM,eAAe,GAAG,UAAU,CAChC,YAAY,EACZ,kBAAkB,EAClB,SAAS,CACV;AAED,IAAA,QACEA,GAAA,CAAA,MAAA,EAAA,EAAM,SAAS,EAAE,eAAe,EAAA,GAAM,IAAI,EAAA,QAAA,EACvC,KAAK,IACJ,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,MACpBC,IAAA,CAAC,KAAK,CAAC,QAAQ,EAAA,EAAA,QAAA,EAAA,CACZ,IAAI,CAAC,SAAS;qBACZ,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,IAC1BD,GAAA,CAAC,IAAI,OAAK,IAAI,CAAC,SAAS,EAAA,CAAI,KAE5BA,GAAA,CAAC,IAAI,EAAA,EAAA,QAAA,EAAE,IAAI,CAAC,SAAS,EAAA,CAAQ,CAC9B,CAAC,EACH,IAAI,CAAC,IAAI,IAAIA,GAAA,CAAA,MAAA,EAAA,EAAA,QAAA,EAAO,IAAI,CAAC,IAAI,GAAQ,CAAA,EAAA,EAPnB,KAAK,CAQT,CAClB,CAAC,KAEFC,IAAA,CAAAC,QAAA,EAAA,EAAA,QAAA,EAAA,CACG,SAAS;AACR,qBAAC,WAAW,CAAC,SAAS,CAAC,IACrBF,GAAA,CAAC,IAAI,EAAA,EAAA,GAAK,SAAS,EAAA,CAAI,KAEvBA,GAAA,CAAC,IAAI,EAAA,EAAA,QAAA,EAAE,SAAS,EAAA,CAAQ,CACzB,CAAC,EACH,QAAQ,IAAIA,GAAA,CAAA,MAAA,EAAA,EAAA,QAAA,EAAO,QAAQ,EAAA,CAAQ,CAAA,EAAA,CACnC,CACJ,EAAA,CACI;AAEX,CAAC;AAEM,MAAM,QAAQ,GAAG,iBAAiB,CACvC,iBAAiB,EACjB,EAAE,IAAI,EAAE,EACR,UAAU;;"}
@@ -0,0 +1,46 @@
1
+ /* @allxsmith/bestax-bulma — AI agents: see AGENTS.md in the package root, or https://bestax.io/llms.txt */
2
+ import { jsx } from 'react/jsx-runtime';
3
+ import { usePrefixedClassNames, classNames } from '../helpers/classNames.js';
4
+ import { useBulmaClasses } from '../helpers/useBulmaClasses.js';
5
+
6
+ /**
7
+ * The `Image` component wraps images, iframes, or custom content in a Bulma-styled container, supporting fixed sizes, aspect ratios, rounded corners, retina images, and all Bulma helper props for color and spacing.
8
+ *
9
+ * @function
10
+ * @param {ImageProps} props - Props for the Image component.
11
+ * @returns {JSX.Element} The rendered image element.
12
+ * @see {@link https://bulma.io/documentation/elements/image/ | Bulma Image documentation}
13
+ */
14
+ const Image = ({ as, className, textColor, color, bgColor, size, isRounded, isRetina, src, alt, children, ...props }) => {
15
+ /**
16
+ * Generates Bulma helper classes and separates out remaining props.
17
+ */
18
+ const { bulmaHelperClasses, rest } = useBulmaClasses({
19
+ color: textColor ?? color,
20
+ backgroundColor: bgColor,
21
+ ...props,
22
+ });
23
+ const bulmaClasses = usePrefixedClassNames('image', {
24
+ [`is-${size}`]: size,
25
+ 'has-ratio': size && typeof size === 'string' && size.includes('by'),
26
+ });
27
+ const imageClasses = classNames(bulmaClasses, bulmaHelperClasses, className);
28
+ // Default tag logic: if "as" is provided, use it.
29
+ // If not, use <figure> for aspect ratios or children, <div> otherwise.
30
+ let Tag;
31
+ if (as) {
32
+ Tag = as;
33
+ }
34
+ else if (size && typeof size === 'string' && size.includes('by')) {
35
+ Tag = 'figure';
36
+ }
37
+ else {
38
+ Tag = 'div';
39
+ }
40
+ const roundedClass = usePrefixedClassNames('is-rounded');
41
+ const content = children ? (children) : (jsx("img", { className: classNames({ [roundedClass]: isRounded }) || undefined, src: src, alt: alt, ...(isRetina && src ? { srcSet: `${src} 2x` } : {}) }));
42
+ return (jsx(Tag, { className: imageClasses, ...rest, children: content }));
43
+ };
44
+
45
+ export { Image };
46
+ //# sourceMappingURL=Image.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Image.js","sources":["../../../src/elements/Image.tsx"],"sourcesContent":["import React from 'react';\nimport { classNames, usePrefixedClassNames } from '../helpers/classNames';\nimport {\n useBulmaClasses,\n BulmaClassesProps,\n validColors,\n} from '../helpers/useBulmaClasses';\n\n/**\n * Props for the Image component.\n */\nexport interface ImageProps\n extends\n React.HTMLAttributes<HTMLElement>,\n Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {\n /** Additional CSS classes to apply. */\n className?: string;\n /** Text color helper for the container. */\n textColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /**\n * Text color alias: renders `has-text-<color>`, exactly like `textColor`.\n * Not a filled variant (no `.image.is-<color>` CSS exists). Prefer\n * `textColor`, which takes precedence when both are set; use `bgColor` for\n * a colored surface.\n */\n color?: 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger';\n /** Background color helper for the container. */\n bgColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Fixed size or aspect ratio modifier for the image container. */\n size?:\n | '16x16'\n | '24x24'\n | '32x32'\n | '48x48'\n | '64x64'\n | '96x96'\n | '128x128'\n | 'square'\n | '1by1'\n | '5by4'\n | '4by3'\n | '3by2'\n | '5by3'\n | '16by9'\n | '2by1'\n | '3by1'\n | '4by5'\n | '3by4'\n | '2by3'\n | '3by5'\n | '9by16'\n | '1by2'\n | '1by3';\n /** Renders the image with rounded corners. */\n isRounded?: boolean;\n /** Uses retina (2x) image source. */\n isRetina?: boolean;\n /** Image source URL. */\n src?: string;\n /** Alternate text for the image. */\n alt?: string;\n /** Arbitrary content (e.g., iframe, custom HTML) inside the image container. */\n children?: React.ReactNode;\n /** Container element tag. Defaults to `'figure'` when using aspect-ratio sizes, `'div'` otherwise. */\n as?: 'figure' | 'div' | 'p';\n}\n\n/**\n * The `Image` component wraps images, iframes, or custom content in a Bulma-styled container, supporting fixed sizes, aspect ratios, rounded corners, retina images, and all Bulma helper props for color and spacing.\n *\n * @function\n * @param {ImageProps} props - Props for the Image component.\n * @returns {JSX.Element} The rendered image element.\n * @see {@link https://bulma.io/documentation/elements/image/ | Bulma Image documentation}\n */\nexport const Image: React.FC<ImageProps> = ({\n as,\n className,\n textColor,\n color,\n bgColor,\n size,\n isRounded,\n isRetina,\n src,\n alt,\n children,\n ...props\n}) => {\n /**\n * Generates Bulma helper classes and separates out remaining props.\n */\n const { bulmaHelperClasses, rest } = useBulmaClasses({\n color: textColor ?? color,\n backgroundColor: bgColor,\n ...props,\n });\n\n const bulmaClasses = usePrefixedClassNames('image', {\n [`is-${size}`]: size,\n 'has-ratio': size && typeof size === 'string' && size.includes('by'),\n });\n\n const imageClasses = classNames(bulmaClasses, bulmaHelperClasses, className);\n\n // Default tag logic: if \"as\" is provided, use it.\n // If not, use <figure> for aspect ratios or children, <div> otherwise.\n let Tag: 'figure' | 'div' | 'p';\n if (as) {\n Tag = as;\n } else if (size && typeof size === 'string' && size.includes('by')) {\n Tag = 'figure';\n } else {\n Tag = 'div';\n }\n\n const roundedClass = usePrefixedClassNames('is-rounded');\n\n const content = children ? (\n children\n ) : (\n <img\n className={classNames({ [roundedClass]: isRounded }) || undefined}\n src={src}\n alt={alt}\n {...(isRetina && src ? { srcSet: `${src} 2x` } : {})}\n />\n );\n\n return (\n <Tag className={imageClasses} {...rest}>\n {content}\n </Tag>\n );\n};\n\nexport default Image;\n"],"names":["_jsx"],"mappings":";;;;;AAmEA;;;;;;;AAOG;AACI,MAAM,KAAK,GAAyB,CAAC,EAC1C,EAAE,EACF,SAAS,EACT,SAAS,EACT,KAAK,EACL,OAAO,EACP,IAAI,EACJ,SAAS,EACT,QAAQ,EACR,GAAG,EACH,GAAG,EACH,QAAQ,EACR,GAAG,KAAK,EACT,KAAI;AACH;;AAEG;AACH,IAAA,MAAM,EAAE,kBAAkB,EAAE,IAAI,EAAE,GAAG,eAAe,CAAC;QACnD,KAAK,EAAE,SAAS,IAAI,KAAK;AACzB,QAAA,eAAe,EAAE,OAAO;AACxB,QAAA,GAAG,KAAK;AACT,KAAA,CAAC;AAEF,IAAA,MAAM,YAAY,GAAG,qBAAqB,CAAC,OAAO,EAAE;AAClD,QAAA,CAAC,CAAA,GAAA,EAAM,IAAI,CAAA,CAAE,GAAG,IAAI;AACpB,QAAA,WAAW,EAAE,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;AACrE,KAAA,CAAC;IAEF,MAAM,YAAY,GAAG,UAAU,CAAC,YAAY,EAAE,kBAAkB,EAAE,SAAS,CAAC;;;AAI5E,IAAA,IAAI,GAA2B;IAC/B,IAAI,EAAE,EAAE;QACN,GAAG,GAAG,EAAE;IACV;AAAO,SAAA,IAAI,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;QAClE,GAAG,GAAG,QAAQ;IAChB;SAAO;QACL,GAAG,GAAG,KAAK;IACb;AAEA,IAAA,MAAM,YAAY,GAAG,qBAAqB,CAAC,YAAY,CAAC;IAExD,MAAM,OAAO,GAAG,QAAQ,IACtB,QAAQ,KAERA,GAAA,CAAA,KAAA,EAAA,EACE,SAAS,EAAE,UAAU,CAAC,EAAE,CAAC,YAAY,GAAG,SAAS,EAAE,CAAC,IAAI,SAAS,EACjE,GAAG,EAAE,GAAG,EACR,GAAG,EAAE,GAAG,EAAA,IACH,QAAQ,IAAI,GAAG,GAAG,EAAE,MAAM,EAAE,CAAA,EAAG,GAAG,CAAA,GAAA,CAAK,EAAE,GAAG,EAAE,CAAC,EAAA,CACpD,CACH;AAED,IAAA,QACEA,GAAA,CAAC,GAAG,EAAA,EAAC,SAAS,EAAE,YAAY,EAAA,GAAM,IAAI,EAAA,QAAA,EACnC,OAAO,EAAA,CACJ;AAEV;;"}
@@ -0,0 +1,36 @@
1
+ /* @allxsmith/bestax-bulma — AI agents: see AGENTS.md in the package root, or https://bestax.io/llms.txt */
2
+ import { jsx } from 'react/jsx-runtime';
3
+ import { forwardRef } from 'react';
4
+ import { usePrefixedClassNames, classNames } from '../helpers/classNames.js';
5
+ import { buttonType } from '../helpers/buttonType.js';
6
+ import { useBulmaClasses } from '../helpers/useBulmaClasses.js';
7
+
8
+ /**
9
+ * The `Link` component renders a styled anchor (`<a>`) element with Bulma helper class integration.
10
+ *
11
+ * @function
12
+ * @param {LinkProps} props - Props for the Link component.
13
+ * @param {React.Ref} ref - Forwarded ref to the element `as` renders.
14
+ * @returns {JSX.Element} The rendered anchor, or whatever `as` names.
15
+ * @see {@link https://bulma.io/documentation/elements/content/ | Bulma Content documentation}
16
+ */
17
+ const Link = forwardRef(function Link(linkProps, ref) {
18
+ const { className, textColor, bgColor, isActive, as: Component = 'a', children, ...props } = linkProps;
19
+ /**
20
+ * Generates Bulma helper classes and separates out remaining props.
21
+ */
22
+ const { bulmaHelperClasses, rest } = useBulmaClasses({
23
+ color: textColor,
24
+ backgroundColor: bgColor,
25
+ ...props,
26
+ });
27
+ const bulmaClasses = usePrefixedClassNames({
28
+ 'is-active': isActive,
29
+ });
30
+ const linkClasses = classNames(bulmaClasses, bulmaHelperClasses, className);
31
+ return (jsx(Component, { ref: ref, className: linkClasses || undefined, ...rest, ...(Component === 'button' ? { type: buttonType(rest.type) } : {}), children: children }));
32
+ });
33
+ Link.displayName = 'Link';
34
+
35
+ export { Link };
36
+ //# sourceMappingURL=Link.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Link.js","sources":["../../../src/elements/Link.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\nimport { classNames, usePrefixedClassNames } from '../helpers/classNames';\nimport type { PolymorphicComponent } from '../helpers/polymorphic';\nimport { buttonType } from '../helpers/buttonType';\nimport {\n useBulmaClasses,\n BulmaClassesProps,\n validColors,\n} from '../helpers/useBulmaClasses';\n\n/**\n * The Link component's own props — everything it adds on top of the attributes\n * of whatever element `as` renders.\n */\nexport interface LinkOwnProps extends Omit<\n BulmaClassesProps,\n 'color' | 'backgroundColor'\n> {\n /**\n * Not accepted. `color` on this component would be the deprecated\n * presentational HTML attribute, and `useBulmaClasses` consumes any `color`\n * key as a Bulma helper before the target could see it — so it is declared\n * unavailable rather than silently eaten. Use `textColor` / `bgColor`.\n * @internal\n */\n color?: never;\n /**\n * Not accepted under this name. `useBulmaClasses` consumes any\n * `backgroundColor` key before `rest` is spread, so a custom `as` target\n * declaring one would never receive it. Use `bgColor`.\n * @internal\n */\n backgroundColor?: never;\n /** Additional CSS classes to apply. */\n className?: string;\n /** Text color helper. */\n textColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Background color helper. */\n bgColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Whether the link appears active. */\n isActive?: boolean;\n /** Content to render inside the link. */\n children?: React.ReactNode;\n}\n\n/**\n * Props for the Link component. The DOM attributes and the `ref` both follow\n * `as`: with the default `'a'` the anchor attributes (`href`, `target`, `rel`)\n * are accepted, with `as=\"span\"` they are not.\n *\n * @extraProp {PolymorphicRef<React.ElementType>} [ref] - Ref forwarded to the element `as` renders, typed from `as`: the DOM node for an intrinsic tag, or whatever handle a custom component exposes.\n */\nexport type LinkProps<T extends React.ElementType = 'a'> = LinkOwnProps &\n Omit<React.ComponentPropsWithoutRef<T>, keyof LinkOwnProps | 'as'> & {\n /**\n * Render as another intrinsic element (`'span'`, `'button'`) or a custom component (e.g. a router `Link`) instead of `<a>`. Defaults to `'a'`.\n *\n * `'button'` renders `type=\"button\"`, so a link inside a form does not submit it. Pass\n * `type=\"submit\"` or `type=\"reset\"` and yours is used; any other value, or a spread\n * carrying `type: undefined`, renders `type=\"button\"`.\n */\n as?: T;\n };\n\n/**\n * The shape the implementation destructures. The public contract is the generic\n * `LinkProps<T>` above — the body cannot see through `T`, so it reads the widest\n * form of the props it actually touches.\n */\ntype LinkImplProps = LinkOwnProps & {\n as?: React.ElementType;\n type?: React.ButtonHTMLAttributes<HTMLButtonElement>['type'];\n};\n\n/**\n * The `Link` component renders a styled anchor (`<a>`) element with Bulma helper class integration.\n *\n * @function\n * @param {LinkProps} props - Props for the Link component.\n * @param {React.Ref} ref - Forwarded ref to the element `as` renders.\n * @returns {JSX.Element} The rendered anchor, or whatever `as` names.\n * @see {@link https://bulma.io/documentation/elements/content/ | Bulma Content documentation}\n */\nexport const Link = forwardRef(function Link(\n linkProps: LinkProps,\n ref: React.Ref<HTMLElement>\n) {\n const {\n className,\n textColor,\n bgColor,\n isActive,\n as: Component = 'a',\n children,\n ...props\n } = linkProps as LinkImplProps;\n /**\n * Generates Bulma helper classes and separates out remaining props.\n */\n const { bulmaHelperClasses, rest } = useBulmaClasses({\n color: textColor,\n backgroundColor: bgColor,\n ...props,\n } as BulmaClassesProps & typeof props);\n\n const bulmaClasses = usePrefixedClassNames({\n 'is-active': isActive,\n });\n const linkClasses = classNames(bulmaClasses, bulmaHelperClasses, className);\n\n return (\n <Component\n ref={ref}\n className={linkClasses || undefined}\n {...rest}\n // A `<button>` defaults to type=\"submit\", and a link-styled button inside\n // a form must not submit it. After the spread, reading through it, so a\n // spread carrying `type: undefined` cannot erase the default. A caller's\n // `submit` or `reset` still wins; `buttonType` says more.\n {...(Component === 'button' ? { type: buttonType(rest.type) } : {})}\n >\n {children}\n </Component>\n );\n}) as PolymorphicComponent<LinkOwnProps, 'a'>;\n\nLink.displayName = 'Link';\n"],"names":["_jsx"],"mappings":";;;;;;;AA0EA;;;;;;;;AAQG;AACI,MAAM,IAAI,GAAG,UAAU,CAAC,SAAS,IAAI,CAC1C,SAAoB,EACpB,GAA2B,EAAA;IAE3B,MAAM,EACJ,SAAS,EACT,SAAS,EACT,OAAO,EACP,QAAQ,EACR,EAAE,EAAE,SAAS,GAAG,GAAG,EACnB,QAAQ,EACR,GAAG,KAAK,EACT,GAAG,SAA0B;AAC9B;;AAEG;AACH,IAAA,MAAM,EAAE,kBAAkB,EAAE,IAAI,EAAE,GAAG,eAAe,CAAC;AACnD,QAAA,KAAK,EAAE,SAAS;AAChB,QAAA,eAAe,EAAE,OAAO;AACxB,QAAA,GAAG,KAAK;AAC2B,KAAA,CAAC;IAEtC,MAAM,YAAY,GAAG,qBAAqB,CAAC;AACzC,QAAA,WAAW,EAAE,QAAQ;AACtB,KAAA,CAAC;IACF,MAAM,WAAW,GAAG,UAAU,CAAC,YAAY,EAAE,kBAAkB,EAAE,SAAS,CAAC;AAE3E,IAAA,QACEA,GAAA,CAAC,SAAS,IACR,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,WAAW,IAAI,SAAS,EAAA,GAC/B,IAAI,MAKH,SAAS,KAAK,QAAQ,GAAG,EAAE,IAAI,EAAE,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC,YAElE,QAAQ,EAAA,CACC;AAEhB,CAAC;AAED,IAAI,CAAC,WAAW,GAAG,MAAM;;"}
@@ -0,0 +1,37 @@
1
+ /* @allxsmith/bestax-bulma — AI agents: see AGENTS.md in the package root, or https://bestax.io/llms.txt */
2
+ import { jsx } from 'react/jsx-runtime';
3
+ import { forwardRef } from 'react';
4
+ import { Button } from './Button.js';
5
+ import { usePrefixedClassNames, classNames } from '../helpers/classNames.js';
6
+
7
+ /**
8
+ * The `LinkButton` component renders a `<button>` that visually looks like text or a link.
9
+ *
10
+ * @function
11
+ * @param {LinkButtonProps} props - Props for the LinkButton component.
12
+ * @param {React.Ref} ref - Forwarded ref to the element `as` renders.
13
+ * @returns {JSX.Element} The rendered link-styled button element.
14
+ *
15
+ * @example
16
+ * // Text variant (default)
17
+ * <LinkButton onClick={handleClick}>Click me</LinkButton>
18
+ *
19
+ * @example
20
+ * // Underline variant with color
21
+ * <LinkButton variant="underline" color="primary">Learn more</LinkButton>
22
+ */
23
+ const LinkButton = forwardRef(function LinkButton({ variant = 'text', color, className, ...props }, ref) {
24
+ const buttonColor = variant === 'underline' ? 'text' : variant;
25
+ const prefixedClasses = usePrefixedClassNames('link-button', color && `link-button-${color}`, variant === 'underline' && 'link-button-underline');
26
+ return (jsx(Button
27
+ // LinkButton is polymorphic through to Button, which resolves the element
28
+ // from `as`. TS cannot infer that through the spread below.
29
+ , {
30
+ // LinkButton is polymorphic through to Button, which resolves the element
31
+ // from `as`. TS cannot infer that through the spread below.
32
+ ref: ref, color: buttonColor, className: classNames(prefixedClasses, className), ...props }));
33
+ });
34
+ LinkButton.displayName = 'LinkButton';
35
+
36
+ export { LinkButton };
37
+ //# sourceMappingURL=LinkButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LinkButton.js","sources":["../../../src/elements/LinkButton.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\nimport { Button, ButtonOwnProps } from './Button';\nimport { classNames, usePrefixedClassNames } from '../helpers/classNames';\nimport type { PolymorphicComponent } from '../helpers/polymorphic';\n\n/**\n * The LinkButton component's own props — everything it adds on top of the\n * attributes of whatever element `as` renders.\n */\nexport interface LinkButtonOwnProps extends Omit<\n ButtonOwnProps,\n 'color' | 'isOutlined' | 'isInverted' | 'isLight'\n> {\n /** Display mode. `text` has no underline and highlights its background on hover; `ghost` uses the default text color and underlines on hover; `underline` drops the button chrome entirely (transparent background and border) and underlines on hover or focus. */\n variant?: 'text' | 'ghost' | 'underline';\n /** Text color override for the button. */\n color?:\n | 'primary'\n | 'link'\n | 'info'\n | 'success'\n | 'warning'\n | 'danger'\n | 'white'\n | 'light'\n | 'dark'\n | 'black';\n /**\n * Not available on `LinkButton`, and declared so that a custom `as` target\n * cannot reintroduce it. `Button` consumes these three for styling variants\n * `LinkButton` does not offer, and strips them before rendering the target —\n * so without this a component requiring one would type-check and silently\n * never receive it.\n * @internal\n */\n isOutlined?: never;\n /** @internal Not available on `LinkButton` — see `isOutlined`. */\n isInverted?: never;\n /** @internal Not available on `LinkButton` — see `isOutlined`. */\n isLight?: never;\n}\n\n/**\n * Props for the LinkButton component. The DOM attributes and the `ref` both\n * follow `as`, exactly as they do on `Button`.\n *\n * @extraProp {PolymorphicRef<React.ElementType>} [ref] - Ref forwarded to the element `as` renders, typed from `as`: the DOM node for an intrinsic tag, or whatever handle a custom component exposes.\n */\nexport type LinkButtonProps<T extends React.ElementType = 'button'> =\n LinkButtonOwnProps &\n Omit<React.ComponentPropsWithoutRef<T>, keyof LinkButtonOwnProps | 'as'> & {\n /**\n * Render as a `<button>`, `<a>`, or a custom component (e.g. a router `Link`).\n * @defaultValue 'button'\n */\n as?: T;\n };\n\n/**\n * The `LinkButton` component renders a `<button>` that visually looks like text or a link.\n *\n * @function\n * @param {LinkButtonProps} props - Props for the LinkButton component.\n * @param {React.Ref} ref - Forwarded ref to the element `as` renders.\n * @returns {JSX.Element} The rendered link-styled button element.\n *\n * @example\n * // Text variant (default)\n * <LinkButton onClick={handleClick}>Click me</LinkButton>\n *\n * @example\n * // Underline variant with color\n * <LinkButton variant=\"underline\" color=\"primary\">Learn more</LinkButton>\n */\nexport const LinkButton = forwardRef(function LinkButton(\n { variant = 'text', color, className, ...props }: LinkButtonProps,\n ref: React.Ref<HTMLElement>\n) {\n const buttonColor = variant === 'underline' ? 'text' : variant;\n\n const prefixedClasses = usePrefixedClassNames(\n 'link-button',\n color && `link-button-${color}`,\n variant === 'underline' && 'link-button-underline'\n );\n\n return (\n <Button\n // LinkButton is polymorphic through to Button, which resolves the element\n // from `as`. TS cannot infer that through the spread below.\n ref={ref as React.Ref<HTMLButtonElement>}\n color={buttonColor}\n className={classNames(prefixedClasses, className)}\n {...props}\n />\n );\n}) as PolymorphicComponent<LinkButtonOwnProps, 'button'>;\n\nLinkButton.displayName = 'LinkButton';\n\nexport default LinkButton;\n"],"names":["_jsx"],"mappings":";;;;;;AA0DA;;;;;;;;;;;;;;;AAeG;MACU,UAAU,GAAG,UAAU,CAAC,SAAS,UAAU,CACtD,EAAE,OAAO,GAAG,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,KAAK,EAAmB,EACjE,GAA2B,EAAA;AAE3B,IAAA,MAAM,WAAW,GAAG,OAAO,KAAK,WAAW,GAAG,MAAM,GAAG,OAAO;AAE9D,IAAA,MAAM,eAAe,GAAG,qBAAqB,CAC3C,aAAa,EACb,KAAK,IAAI,CAAA,YAAA,EAAe,KAAK,CAAA,CAAE,EAC/B,OAAO,KAAK,WAAW,IAAI,uBAAuB,CACnD;IAED,QACEA,IAAC;;;;;;AAGC,QAAA,GAAG,EAAE,GAAmC,EACxC,KAAK,EAAE,WAAW,EAClB,SAAS,EAAE,UAAU,CAAC,eAAe,EAAE,SAAS,CAAC,KAC7C,KAAK,EAAA,CACT;AAEN,CAAC;AAED,UAAU,CAAC,WAAW,GAAG,YAAY;;"}
@@ -0,0 +1,28 @@
1
+ /* @allxsmith/bestax-bulma — AI agents: see AGENTS.md in the package root, or https://bestax.io/llms.txt */
2
+ import { jsx } from 'react/jsx-runtime';
3
+ import { usePrefixedClassNames, classNames } from '../helpers/classNames.js';
4
+ import { useBulmaClasses } from '../helpers/useBulmaClasses.js';
5
+
6
+ /**
7
+ * The `ListItem` component renders a styled list item (`<li>`) element with Bulma helper class integration.
8
+ *
9
+ * @function
10
+ * @param {ListItemProps} props - Props for the ListItem component.
11
+ * @returns {JSX.Element} The rendered li element.
12
+ */
13
+ const ListItem = ({ className, textColor, bgColor, children, ...props }) => {
14
+ /**
15
+ * Generates Bulma helper classes and separates out remaining props.
16
+ */
17
+ const { bulmaHelperClasses, rest } = useBulmaClasses({
18
+ color: textColor,
19
+ backgroundColor: bgColor,
20
+ ...props,
21
+ });
22
+ const bulmaClasses = usePrefixedClassNames();
23
+ const itemClasses = classNames(bulmaClasses, bulmaHelperClasses, className);
24
+ return (jsx("li", { className: itemClasses || undefined, ...rest, children: children }));
25
+ };
26
+
27
+ export { ListItem };
28
+ //# sourceMappingURL=ListItem.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ListItem.js","sources":["../../../src/elements/ListItem.tsx"],"sourcesContent":["import React from 'react';\nimport { classNames, usePrefixedClassNames } from '../helpers/classNames';\nimport {\n useBulmaClasses,\n BulmaClassesProps,\n validColors,\n} from '../helpers/useBulmaClasses';\n\n/**\n * Props for the ListItem component.\n * @extraProp {number} [value] - Custom value for ordered list items.\n */\nexport interface ListItemProps\n extends\n React.LiHTMLAttributes<HTMLLIElement>,\n Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {\n /** Additional CSS classes to apply. */\n className?: string;\n /** Text color helper. */\n textColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Background color helper. */\n bgColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Content to render inside the list item. */\n children?: React.ReactNode;\n}\n\n/**\n * The `ListItem` component renders a styled list item (`<li>`) element with Bulma helper class integration.\n *\n * @function\n * @param {ListItemProps} props - Props for the ListItem component.\n * @returns {JSX.Element} The rendered li element.\n */\nexport const ListItem: React.FC<ListItemProps> = ({\n className,\n textColor,\n bgColor,\n children,\n ...props\n}) => {\n /**\n * Generates Bulma helper classes and separates out remaining props.\n */\n const { bulmaHelperClasses, rest } = useBulmaClasses({\n color: textColor,\n backgroundColor: bgColor,\n ...props,\n } as BulmaClassesProps & typeof props);\n\n const bulmaClasses = usePrefixedClassNames();\n const itemClasses = classNames(bulmaClasses, bulmaHelperClasses, className);\n\n return (\n <li className={itemClasses || undefined} {...rest}>\n {children}\n </li>\n );\n};\n"],"names":["_jsx"],"mappings":";;;;;AA0BA;;;;;;AAMG;AACI,MAAM,QAAQ,GAA4B,CAAC,EAChD,SAAS,EACT,SAAS,EACT,OAAO,EACP,QAAQ,EACR,GAAG,KAAK,EACT,KAAI;AACH;;AAEG;AACH,IAAA,MAAM,EAAE,kBAAkB,EAAE,IAAI,EAAE,GAAG,eAAe,CAAC;AACnD,QAAA,KAAK,EAAE,SAAS;AAChB,QAAA,eAAe,EAAE,OAAO;AACxB,QAAA,GAAG,KAAK;AAC2B,KAAA,CAAC;AAEtC,IAAA,MAAM,YAAY,GAAG,qBAAqB,EAAE;IAC5C,MAAM,WAAW,GAAG,UAAU,CAAC,YAAY,EAAE,kBAAkB,EAAE,SAAS,CAAC;AAE3E,IAAA,QACEA,GAAA,CAAA,IAAA,EAAA,EAAI,SAAS,EAAE,WAAW,IAAI,SAAS,EAAA,GAAM,IAAI,EAAA,QAAA,EAC9C,QAAQ,EAAA,CACN;AAET;;"}
@@ -0,0 +1,37 @@
1
+ /* @allxsmith/bestax-bulma — AI agents: see AGENTS.md in the package root, or https://bestax.io/llms.txt */
2
+ import { jsx } from 'react/jsx-runtime';
3
+ import { forwardRef } from 'react';
4
+ import { usePrefixedClassNames, classNames } from '../helpers/classNames.js';
5
+ import { useBulmaClasses } from '../helpers/useBulmaClasses.js';
6
+
7
+ /**
8
+ * The `Loader` component renders Bulma's `.loader`, a small spinning ring for inline loading states.
9
+ *
10
+ * The ring is `1em` square, so `textSize` scales it. It is exposed as an
11
+ * indeterminate `progressbar` named by `ariaLabel`, and it stops spinning
12
+ * under `prefers-reduced-motion: reduce` while staying drawn.
13
+ *
14
+ * @function
15
+ * @param {LoaderProps} props - Props for the Loader component.
16
+ * @param {React.Ref<HTMLSpanElement>} ref - Forwarded ref to the loader element.
17
+ * @returns {JSX.Element} The rendered loader element.
18
+ *
19
+ * @example
20
+ * <Loader />
21
+ *
22
+ * @example
23
+ * <Loader textSize="3" ariaLabel="Saving" />
24
+ */
25
+ const Loader = forwardRef(({ className, ariaLabel = 'Loading', ...props }, ref) => {
26
+ const { bulmaHelperClasses, rest } = useBulmaClasses(props);
27
+ const loaderClass = usePrefixedClassNames('loader');
28
+ // role="progressbar", not role="status": a status region mounted together
29
+ // with its text is not reliably announced, so the loader claims only what
30
+ // it can deliver, a named indicator found by reading the page. No
31
+ // aria-valuenow, because the progress is indeterminate.
32
+ return (jsx("span", { ref: ref, className: classNames(loaderClass, bulmaHelperClasses, className), role: "progressbar", "aria-label": ariaLabel, ...rest }));
33
+ });
34
+ Loader.displayName = 'Loader';
35
+
36
+ export { Loader };
37
+ //# sourceMappingURL=Loader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Loader.js","sources":["../../../src/elements/Loader.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\nimport { classNames, usePrefixedClassNames } from '../helpers/classNames';\nimport { useBulmaClasses, BulmaClassesProps } from '../helpers/useBulmaClasses';\n\n/**\n * Props for the Loader component.\n *\n * There is no color prop, and the text and background color helpers are left\n * out on purpose: Bulma draws the ring in `--bulma-border`, so a text color\n * never reaches it. For a colored spinner over a region, use `Loading`.\n *\n * @extraProp {React.Ref<HTMLSpanElement>} [ref] - Ref forwarded to the loader element.\n */\nexport interface LoaderProps\n extends\n Omit<React.HTMLAttributes<HTMLSpanElement>, 'color' | 'children'>,\n Omit<\n BulmaClassesProps,\n 'color' | 'colorShade' | 'backgroundColor' | 'backgroundColorShade'\n > {\n /** Additional CSS classes to apply. */\n className?: string;\n /**\n * Accessible name of the progress indicator. Name what is loading\n * (`\"Saving row\"`) when more than one loader can be on screen at once.\n */\n ariaLabel?: string;\n}\n\n/**\n * The `Loader` component renders Bulma's `.loader`, a small spinning ring for inline loading states.\n *\n * The ring is `1em` square, so `textSize` scales it. It is exposed as an\n * indeterminate `progressbar` named by `ariaLabel`, and it stops spinning\n * under `prefers-reduced-motion: reduce` while staying drawn.\n *\n * @function\n * @param {LoaderProps} props - Props for the Loader component.\n * @param {React.Ref<HTMLSpanElement>} ref - Forwarded ref to the loader element.\n * @returns {JSX.Element} The rendered loader element.\n *\n * @example\n * <Loader />\n *\n * @example\n * <Loader textSize=\"3\" ariaLabel=\"Saving\" />\n */\nexport const Loader = forwardRef<HTMLSpanElement, LoaderProps>(\n ({ className, ariaLabel = 'Loading', ...props }, ref) => {\n const { bulmaHelperClasses, rest } = useBulmaClasses(props);\n const loaderClass = usePrefixedClassNames('loader');\n\n // role=\"progressbar\", not role=\"status\": a status region mounted together\n // with its text is not reliably announced, so the loader claims only what\n // it can deliver, a named indicator found by reading the page. No\n // aria-valuenow, because the progress is indeterminate.\n return (\n <span\n ref={ref}\n className={classNames(loaderClass, bulmaHelperClasses, className)}\n role=\"progressbar\"\n aria-label={ariaLabel}\n {...rest}\n />\n );\n }\n);\n\nLoader.displayName = 'Loader';\n"],"names":["_jsx"],"mappings":";;;;;;AA6BA;;;;;;;;;;;;;;;;;AAiBG;MACU,MAAM,GAAG,UAAU,CAC9B,CAAC,EAAE,SAAS,EAAE,SAAS,GAAG,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,KAAI;IACtD,MAAM,EAAE,kBAAkB,EAAE,IAAI,EAAE,GAAG,eAAe,CAAC,KAAK,CAAC;AAC3D,IAAA,MAAM,WAAW,GAAG,qBAAqB,CAAC,QAAQ,CAAC;;;;;IAMnD,QACEA,GAAA,CAAA,MAAA,EAAA,EACE,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,UAAU,CAAC,WAAW,EAAE,kBAAkB,EAAE,SAAS,CAAC,EACjE,IAAI,EAAC,aAAa,EAAA,YAAA,EACN,SAAS,EAAA,GACjB,IAAI,EAAA,CACR;AAEN,CAAC;AAGH,MAAM,CAAC,WAAW,GAAG,QAAQ;;"}