@webiny/admin-ui 6.6.0-alpha.1 → 6.6.0-alpha.10

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 (328) hide show
  1. package/Alert/Alert.d.ts +1 -20
  2. package/Alert/Alert.js.map +1 -1
  3. package/AutoComplete/primitives/AutoCompletePrimitive.d.ts +8 -2
  4. package/AutoComplete/primitives/AutoCompletePrimitive.js +1 -0
  5. package/AutoComplete/primitives/AutoCompletePrimitive.js.map +1 -1
  6. package/Breadcrumbs/Breadcrumbs.js +2 -2
  7. package/Breadcrumbs/Breadcrumbs.js.map +1 -1
  8. package/Button/Button.d.ts +1 -1
  9. package/Button/Button.js +14 -0
  10. package/Button/Button.js.map +1 -1
  11. package/Button/Button.mdx +13 -0
  12. package/Button/Button.stories.d.ts +1 -0
  13. package/Button/Button.stories.js +10 -2
  14. package/Button/Button.stories.js.map +1 -1
  15. package/Button/Button.test.d.ts +1 -0
  16. package/Button/Button.test.js +28 -0
  17. package/Button/Button.test.js.map +1 -0
  18. package/Checkbox/primitives/presenters/CheckboxPresenter.js +5 -2
  19. package/Checkbox/primitives/presenters/CheckboxPresenter.js.map +1 -1
  20. package/Checkbox/primitives/presenters/CheckboxPresenter.jsxLabel.test.d.ts +1 -0
  21. package/Checkbox/primitives/presenters/CheckboxPresenter.jsxLabel.test.js +61 -0
  22. package/Checkbox/primitives/presenters/CheckboxPresenter.jsxLabel.test.js.map +1 -0
  23. package/CheckboxGroup/CheckboxGroup.js +4 -1
  24. package/CheckboxGroup/CheckboxGroup.js.map +1 -1
  25. package/CheckboxGroup/primitives/CheckboxGroupPrimitive.d.ts +6 -1
  26. package/CheckboxGroup/primitives/CheckboxGroupPrimitive.js +5 -2
  27. package/CheckboxGroup/primitives/CheckboxGroupPrimitive.js.map +1 -1
  28. package/CheckboxGroup/primitives/presenters/CheckboxGroupPresenter.js +5 -2
  29. package/CheckboxGroup/primitives/presenters/CheckboxGroupPresenter.js.map +1 -1
  30. package/CheckboxGroup/primitives/presenters/CheckboxGroupPresenter.jsxLabel.test.d.ts +1 -0
  31. package/CheckboxGroup/primitives/presenters/CheckboxGroupPresenter.jsxLabel.test.js +108 -0
  32. package/CheckboxGroup/primitives/presenters/CheckboxGroupPresenter.jsxLabel.test.js.map +1 -0
  33. package/Code/Code.d.ts +29 -0
  34. package/Code/Code.js +23 -0
  35. package/Code/Code.js.map +1 -0
  36. package/Code/index.d.ts +1 -0
  37. package/Code/index.js +1 -0
  38. package/CodeEditor/CodeEditor.js +6 -0
  39. package/CodeEditor/CodeEditor.js.map +1 -1
  40. package/ColorPicker/ColorPicker.js +4 -1
  41. package/ColorPicker/ColorPicker.js.map +1 -1
  42. package/ColorPicker/primitives/ColorPickerPrimitive.d.ts +1 -1
  43. package/ColorPicker/primitives/ColorPickerPrimitive.js +3 -1
  44. package/ColorPicker/primitives/ColorPickerPrimitive.js.map +1 -1
  45. package/Command/components/List.d.ts +1 -1
  46. package/Command/components/List.js +9 -5
  47. package/Command/components/List.js.map +1 -1
  48. package/DataTable/DataTable.d.ts +28 -3
  49. package/DataTable/DataTable.js +105 -20
  50. package/DataTable/DataTable.js.map +1 -1
  51. package/DataTable/DataTable.mdx +64 -0
  52. package/DataTable/DataTable.stories.d.ts +4 -0
  53. package/DataTable/DataTable.stories.js +40 -1
  54. package/DataTable/DataTable.stories.js.map +1 -1
  55. package/DataTable/DataTable.subRows.test.d.ts +1 -0
  56. package/DataTable/DataTable.subRows.test.js +216 -0
  57. package/DataTable/DataTable.subRows.test.js.map +1 -0
  58. package/DatePicker/DatePicker.d.ts +5 -2
  59. package/DatePicker/DatePicker.js +14 -3
  60. package/DatePicker/DatePicker.js.map +1 -1
  61. package/DatePicker/DatePicker.stories.d.ts +10 -0
  62. package/DatePicker/DatePicker.stories.js +44 -1
  63. package/DatePicker/DatePicker.stories.js.map +1 -1
  64. package/DatePicker/primitives/BirthdayPicker.d.ts +13 -0
  65. package/DatePicker/primitives/BirthdayPicker.js +355 -0
  66. package/DatePicker/primitives/BirthdayPicker.js.map +1 -0
  67. package/DatePicker/primitives/BirthdayPickerCell.d.ts +14 -0
  68. package/DatePicker/primitives/BirthdayPickerCell.js +19 -0
  69. package/DatePicker/primitives/BirthdayPickerCell.js.map +1 -0
  70. package/DatePicker/primitives/BirthdayPickerSegments.d.ts +9 -0
  71. package/DatePicker/primitives/BirthdayPickerSegments.js +43 -0
  72. package/DatePicker/primitives/BirthdayPickerSegments.js.map +1 -0
  73. package/DatePicker/primitives/DateOnlyPicker.d.ts +1 -1
  74. package/DatePicker/primitives/DateOnlyPicker.js +13 -4
  75. package/DatePicker/primitives/DateOnlyPicker.js.map +1 -1
  76. package/DatePicker/primitives/DatePickerPrimitive.js +3 -0
  77. package/DatePicker/primitives/DatePickerPrimitive.js.map +1 -1
  78. package/DatePicker/primitives/DateRangePicker.d.ts +1 -1
  79. package/DatePicker/primitives/DateRangePicker.js +5 -4
  80. package/DatePicker/primitives/DateRangePicker.js.map +1 -1
  81. package/DatePicker/primitives/DateTimePicker.d.ts +1 -1
  82. package/DatePicker/primitives/DateTimePicker.js +14 -17
  83. package/DatePicker/primitives/DateTimePicker.js.map +1 -1
  84. package/DatePicker/primitives/MonthPicker.d.ts +1 -1
  85. package/DatePicker/primitives/MonthPicker.js +2 -1
  86. package/DatePicker/primitives/MonthPicker.js.map +1 -1
  87. package/DatePicker/primitives/MultipleDatesPicker.d.ts +1 -1
  88. package/DatePicker/primitives/MultipleDatesPicker.js +5 -4
  89. package/DatePicker/primitives/MultipleDatesPicker.js.map +1 -1
  90. package/DatePicker/primitives/MultipleMonthsPicker.d.ts +1 -1
  91. package/DatePicker/primitives/MultipleMonthsPicker.js +2 -1
  92. package/DatePicker/primitives/MultipleMonthsPicker.js.map +1 -1
  93. package/DatePicker/primitives/MultipleYearsPicker.d.ts +1 -1
  94. package/DatePicker/primitives/MultipleYearsPicker.js +2 -1
  95. package/DatePicker/primitives/MultipleYearsPicker.js.map +1 -1
  96. package/DatePicker/primitives/TimeOnlyPicker.d.ts +1 -1
  97. package/DatePicker/primitives/TimeOnlyPicker.js +2 -1
  98. package/DatePicker/primitives/TimeOnlyPicker.js.map +1 -1
  99. package/DatePicker/primitives/WeekPicker.d.ts +1 -1
  100. package/DatePicker/primitives/WeekPicker.js +2 -1
  101. package/DatePicker/primitives/WeekPicker.js.map +1 -1
  102. package/DatePicker/primitives/YearPicker.d.ts +1 -1
  103. package/DatePicker/primitives/YearPicker.js +2 -1
  104. package/DatePicker/primitives/YearPicker.js.map +1 -1
  105. package/DatePicker/primitives/components/TimePicker.d.ts +2 -1
  106. package/DatePicker/primitives/components/TimePicker.js +2 -1
  107. package/DatePicker/primitives/components/TimePicker.js.map +1 -1
  108. package/DatePicker/utils/birthdayHelpers.d.ts +77 -0
  109. package/DatePicker/utils/birthdayHelpers.js +145 -0
  110. package/DatePicker/utils/birthdayHelpers.js.map +1 -0
  111. package/DatePicker/utils/birthdayHelpers.test.d.ts +1 -0
  112. package/DatePicker/utils/birthdayHelpers.test.js +394 -0
  113. package/DatePicker/utils/birthdayHelpers.test.js.map +1 -0
  114. package/DatePicker/utils/dateHelpers.d.ts +6 -1
  115. package/DatePicker/utils/dateHelpers.js +13 -5
  116. package/DatePicker/utils/dateHelpers.js.map +1 -1
  117. package/DatePicker/utils/dateHelpers.test.d.ts +1 -0
  118. package/DatePicker/utils/dateHelpers.test.js +119 -0
  119. package/DatePicker/utils/dateHelpers.test.js.map +1 -0
  120. package/DatePicker/utils/index.d.ts +1 -0
  121. package/DatePicker/utils/index.js +1 -0
  122. package/DatePicker/utils/timezoneHelpers.d.ts +3 -0
  123. package/DatePicker/utils/timezoneHelpers.js +32 -0
  124. package/DatePicker/utils/timezoneHelpers.js.map +1 -0
  125. package/DatePicker/utils/types.d.ts +15 -2
  126. package/DelayedOnChange/DelayedOnChange.d.ts +9 -2
  127. package/DelayedOnChange/DelayedOnChange.js.map +1 -1
  128. package/Dialog/Dialog.d.ts +8 -7
  129. package/Dialog/Dialog.js.map +1 -1
  130. package/Drawer/Drawer.d.ts +10 -6
  131. package/Drawer/Drawer.js +2 -1
  132. package/Drawer/Drawer.js.map +1 -1
  133. package/Drawer/Drawer.stories.d.ts +1 -0
  134. package/Drawer/Drawer.stories.js +20 -2
  135. package/Drawer/Drawer.stories.js.map +1 -1
  136. package/Drawer/components/DrawerHeader.d.ts +2 -2
  137. package/Drawer/components/DrawerHeader.js +11 -8
  138. package/Drawer/components/DrawerHeader.js.map +1 -1
  139. package/Drawer/components/Icon.d.ts +1 -1
  140. package/Drawer/components/Icon.js +3 -4
  141. package/Drawer/components/Icon.js.map +1 -1
  142. package/EmptyState/EmptyState.d.ts +2 -1
  143. package/EmptyState/EmptyState.js +8 -2
  144. package/EmptyState/EmptyState.js.map +1 -1
  145. package/FilePicker/FilePicker.js +6 -1
  146. package/FilePicker/FilePicker.js.map +1 -1
  147. package/FilePicker/FilePicker.stories.d.ts +6 -0
  148. package/FilePicker/FilePicker.stories.js +24 -1
  149. package/FilePicker/FilePicker.stories.js.map +1 -1
  150. package/FilePicker/primitives/FilePickerPrimitive.d.ts +1 -1
  151. package/FilePicker/primitives/FilePickerPrimitive.js +3 -1
  152. package/FilePicker/primitives/FilePickerPrimitive.js.map +1 -1
  153. package/FilePicker/primitives/components/Label.d.ts +3 -1
  154. package/FilePicker/primitives/components/Label.js +2 -1
  155. package/FilePicker/primitives/components/Label.js.map +1 -1
  156. package/FilePicker/primitives/components/previews/ItemActions.js +1 -1
  157. package/FilePicker/primitives/components/previews/ItemActions.js.map +1 -1
  158. package/FilePicker/primitives/components/previews/ItemDescription.js +1 -1
  159. package/FilePicker/primitives/components/previews/ItemDescription.js.map +1 -1
  160. package/FilePicker/primitives/components/previews/RichItemPreview/FileType.d.ts +5 -0
  161. package/FilePicker/primitives/components/previews/RichItemPreview/FileType.js +45 -0
  162. package/FilePicker/primitives/components/previews/RichItemPreview/FileType.js.map +1 -0
  163. package/FilePicker/primitives/components/previews/RichItemPreview/Placeholder.d.ts +5 -0
  164. package/FilePicker/primitives/components/previews/RichItemPreview/Placeholder.js +14 -0
  165. package/FilePicker/primitives/components/previews/RichItemPreview/Placeholder.js.map +1 -0
  166. package/FilePicker/primitives/components/previews/RichItemPreview/RichItemPreview.js +52 -11
  167. package/FilePicker/primitives/components/previews/RichItemPreview/RichItemPreview.js.map +1 -1
  168. package/FilePicker/primitives/components/previews/RichItemPreview/RichItemThumbnail.d.ts +5 -4
  169. package/FilePicker/primitives/components/previews/RichItemPreview/RichItemThumbnail.js +9 -66
  170. package/FilePicker/primitives/components/previews/RichItemPreview/RichItemThumbnail.js.map +1 -1
  171. package/FilePicker/primitives/components/previews/RichItemPreview/Thumbnail.d.ts +11 -0
  172. package/FilePicker/primitives/components/previews/RichItemPreview/Thumbnail.js +24 -0
  173. package/FilePicker/primitives/components/previews/RichItemPreview/Thumbnail.js.map +1 -0
  174. package/FilePicker/primitives/components/previews/RichItemPreview/ThumbnailActions.d.ts +10 -0
  175. package/FilePicker/primitives/components/previews/RichItemPreview/ThumbnailActions.js +46 -0
  176. package/FilePicker/primitives/components/previews/RichItemPreview/ThumbnailActions.js.map +1 -0
  177. package/FilePicker/primitives/components/previews/TruncatedFileName.d.ts +7 -0
  178. package/FilePicker/primitives/components/previews/TruncatedFileName.js +20 -0
  179. package/FilePicker/primitives/components/previews/TruncatedFileName.js.map +1 -0
  180. package/FilePicker/primitives/components/previews/fileName.d.ts +4 -0
  181. package/FilePicker/primitives/components/previews/fileName.js +26 -0
  182. package/FilePicker/primitives/components/previews/fileName.js.map +1 -0
  183. package/FilePicker/primitives/components/previews/index.d.ts +1 -0
  184. package/FilePicker/primitives/components/previews/index.js +1 -0
  185. package/FormComponent/Label.d.ts +6 -1
  186. package/FormComponent/Label.js +5 -2
  187. package/FormComponent/Label.js.map +1 -1
  188. package/FormComponent/labels.test.d.ts +1 -0
  189. package/FormComponent/labels.test.js +276 -0
  190. package/FormComponent/labels.test.js.map +1 -0
  191. package/Icon/Icon.d.ts +6 -1
  192. package/Icon/Icon.js.map +1 -1
  193. package/IconPicker/IconPicker.js +6 -1
  194. package/IconPicker/IconPicker.js.map +1 -1
  195. package/IconPicker/domains/IconPickerIcon.js +1 -1
  196. package/IconPicker/domains/IconPickerIcon.js.map +1 -1
  197. package/IconPicker/primitives/IconPickerPrimitive.d.ts +2 -0
  198. package/IconPicker/primitives/IconPickerPrimitive.js +2 -2
  199. package/IconPicker/primitives/IconPickerPrimitive.js.map +1 -1
  200. package/IconPicker/primitives/components/IconPickerGrid.js.map +1 -1
  201. package/Input/InputPrimitive.d.ts +4 -4
  202. package/Input/InputPrimitive.js +0 -1
  203. package/Input/InputPrimitive.js.map +1 -1
  204. package/Kbd/Kbd.d.ts +35 -0
  205. package/Kbd/Kbd.js +34 -0
  206. package/Kbd/Kbd.js.map +1 -0
  207. package/Kbd/index.d.ts +1 -0
  208. package/Kbd/index.js +1 -0
  209. package/Link/Link.d.ts +1 -1
  210. package/Link/Link.js +1 -1
  211. package/Link/Link.js.map +1 -1
  212. package/MultiAutoComplete/primitives/MultiAutoCompletePrimitive.d.ts +8 -2
  213. package/MultiAutoComplete/primitives/MultiAutoCompletePrimitive.js +1 -0
  214. package/MultiAutoComplete/primitives/MultiAutoCompletePrimitive.js.map +1 -1
  215. package/MultiAutoComplete/primitives/presenters/MultiAutoCompletePresenter.test.js +1 -1
  216. package/MultiAutoComplete/primitives/presenters/MultiAutoCompletePresenter.test.js.map +1 -1
  217. package/MultiAutoComplete/primitives/useMultiAutoComplete.js +3 -2
  218. package/MultiAutoComplete/primitives/useMultiAutoComplete.js.map +1 -1
  219. package/MultiSelect/MultiSelect.js +6 -1
  220. package/MultiSelect/MultiSelect.js.map +1 -1
  221. package/MultiSelect/primitives/MultiSelectPrimitive.d.ts +3 -1
  222. package/MultiSelect/primitives/MultiSelectPrimitive.js +16 -7
  223. package/MultiSelect/primitives/MultiSelectPrimitive.js.map +1 -1
  224. package/Popover/Popover.stories.d.ts +7 -0
  225. package/Popover/Popover.stories.js +24 -1
  226. package/Popover/Popover.stories.js.map +1 -1
  227. package/Popover/primitives/components/PopoverContent.js +6 -1
  228. package/Popover/primitives/components/PopoverContent.js.map +1 -1
  229. package/RadioGroup/RadioGroup.js +4 -1
  230. package/RadioGroup/RadioGroup.js.map +1 -1
  231. package/RadioGroup/primitives/RadioGroupPrimitive.d.ts +1 -1
  232. package/RadioGroup/primitives/RadioGroupPrimitive.js +4 -2
  233. package/RadioGroup/primitives/RadioGroupPrimitive.js.map +1 -1
  234. package/RadioGroup/primitives/presenters/RadioGroupPresenter.js +4 -2
  235. package/RadioGroup/primitives/presenters/RadioGroupPresenter.js.map +1 -1
  236. package/RadioGroup/primitives/presenters/RadioGroupPresenter.jsxLabel.test.d.ts +1 -0
  237. package/RadioGroup/primitives/presenters/RadioGroupPresenter.jsxLabel.test.js +88 -0
  238. package/RadioGroup/primitives/presenters/RadioGroupPresenter.jsxLabel.test.js.map +1 -0
  239. package/RangeSlider/RangeSlider.js +4 -1
  240. package/RangeSlider/RangeSlider.js.map +1 -1
  241. package/RangeSlider/primitives/RangeSliderPrimitive.d.ts +1 -1
  242. package/RangeSlider/primitives/RangeSliderPrimitive.js +3 -1
  243. package/RangeSlider/primitives/RangeSliderPrimitive.js.map +1 -1
  244. package/ScrollArea/ScrollArea.d.ts +16 -2
  245. package/ScrollArea/ScrollArea.js +19 -5
  246. package/ScrollArea/ScrollArea.js.map +1 -1
  247. package/SegmentedControl/SegmentedControl.js +4 -1
  248. package/SegmentedControl/SegmentedControl.js.map +1 -1
  249. package/SegmentedControl/primitives/SegmentedControlPrimitive.d.ts +5 -1
  250. package/SegmentedControl/primitives/SegmentedControlPrimitive.js +2 -1
  251. package/SegmentedControl/primitives/SegmentedControlPrimitive.js.map +1 -1
  252. package/Select/Select.js +6 -1
  253. package/Select/Select.js.map +1 -1
  254. package/Select/primitives/SelectPrimitive.d.ts +4 -0
  255. package/Select/primitives/SelectPrimitive.js +4 -2
  256. package/Select/primitives/SelectPrimitive.js.map +1 -1
  257. package/Select/primitives/components/SelectContent.js +4 -6
  258. package/Select/primitives/components/SelectContent.js.map +1 -1
  259. package/SidePanel/SidePanel.d.ts +46 -0
  260. package/SidePanel/SidePanel.js +47 -0
  261. package/SidePanel/SidePanel.js.map +1 -0
  262. package/SidePanel/SidePanelBody.d.ts +37 -0
  263. package/SidePanel/SidePanelBody.js +14 -0
  264. package/SidePanel/SidePanelBody.js.map +1 -0
  265. package/SidePanel/SidePanelFooter.d.ts +27 -0
  266. package/SidePanel/SidePanelFooter.js +10 -0
  267. package/SidePanel/SidePanelFooter.js.map +1 -0
  268. package/SidePanel/index.d.ts +3 -0
  269. package/SidePanel/index.js +3 -0
  270. package/Sidebar/Sidebar.groups.test.d.ts +1 -0
  271. package/Sidebar/Sidebar.groups.test.js +113 -0
  272. package/Sidebar/Sidebar.groups.test.js.map +1 -0
  273. package/Sidebar/components/SidebarContent.js +1 -1
  274. package/Sidebar/components/SidebarContent.js.map +1 -1
  275. package/Sidebar/components/SidebarRoot.js +1 -1
  276. package/Sidebar/components/SidebarRoot.js.map +1 -1
  277. package/Sidebar/components/items/SidebarMenuRootButton.js +1 -0
  278. package/Sidebar/components/items/SidebarMenuRootButton.js.map +1 -1
  279. package/Sidebar/components/items/SidebarMenuSubButton.js +8 -5
  280. package/Sidebar/components/items/SidebarMenuSubButton.js.map +1 -1
  281. package/Sidebar/components/items/SidebarMenuSubItem.js +3 -3
  282. package/Sidebar/components/items/SidebarMenuSubItem.js.map +1 -1
  283. package/Slider/Slider.js +10 -2
  284. package/Slider/Slider.js.map +1 -1
  285. package/Slider/primitives/SliderPrimitive.d.ts +1 -1
  286. package/Slider/primitives/SliderPrimitive.js +2 -1
  287. package/Slider/primitives/SliderPrimitive.js.map +1 -1
  288. package/Slider/primitives/components/SliderThumb.d.ts +5 -2
  289. package/Slider/primitives/components/SliderThumb.js +2 -1
  290. package/Slider/primitives/components/SliderThumb.js.map +1 -1
  291. package/Switch/Switch.d.ts +4 -4
  292. package/Switch/Switch.js +21 -7
  293. package/Switch/Switch.js.map +1 -1
  294. package/Switch/domains/SwitchItemDto.d.ts +1 -1
  295. package/Switch/primitives/SwitchPrimitive.js +4 -3
  296. package/Switch/primitives/SwitchPrimitive.js.map +1 -1
  297. package/Tabs/Tabs.d.ts +7 -2
  298. package/Tabs/Tabs.js +29 -11
  299. package/Tabs/Tabs.js.map +1 -1
  300. package/Tabs/Tabs.mdx +27 -0
  301. package/Tabs/Tabs.stories.d.ts +1 -0
  302. package/Tabs/Tabs.stories.js +19 -1
  303. package/Tabs/Tabs.stories.js.map +1 -1
  304. package/Tag/Tag.d.ts +1 -1
  305. package/Tag/Tag.js +5 -0
  306. package/Tag/Tag.js.map +1 -1
  307. package/Tag/TagIcon.js +7 -1
  308. package/Tag/TagIcon.js.map +1 -1
  309. package/Tags/primitives/TagsPrimitive.d.ts +2 -2
  310. package/Tags/primitives/TagsPrimitive.js.map +1 -1
  311. package/ToggleGroup/ToggleGroup.js +4 -1
  312. package/ToggleGroup/ToggleGroup.js.map +1 -1
  313. package/ToggleGroup/primitives/ToggleGroupPrimitive.d.ts +2 -0
  314. package/ToggleGroup/primitives/ToggleGroupPrimitive.js +3 -2
  315. package/ToggleGroup/primitives/ToggleGroupPrimitive.js.map +1 -1
  316. package/Tree/useTree.js +6 -2
  317. package/Tree/useTree.js.map +1 -1
  318. package/exports/admin/ui.d.ts +1 -0
  319. package/exports/admin/ui.js +1 -0
  320. package/hooks/index.d.ts +1 -0
  321. package/hooks/index.js +1 -0
  322. package/hooks/useEscapeScrollLock.d.ts +13 -0
  323. package/hooks/useEscapeScrollLock.js +21 -0
  324. package/hooks/useEscapeScrollLock.js.map +1 -0
  325. package/index.d.ts +3 -0
  326. package/index.js +3 -0
  327. package/package.json +30 -28
  328. package/theme.css +34 -0
package/Alert/Alert.d.ts CHANGED
@@ -9,30 +9,11 @@ export interface AlertProps extends React.HTMLAttributes<HTMLDivElement>, Varian
9
9
  showCloseButton?: boolean;
10
10
  icon?: React.ReactElement | null;
11
11
  onClose?: () => void;
12
- actions?: React.ReactElement<typeof AlertAction>;
12
+ actions?: React.ReactElement;
13
13
  swatchColor?: string;
14
14
  swatchColorIcon?: boolean;
15
15
  }
16
16
  declare const AlertActionBase: (props: ButtonProps) => React.JSX.Element;
17
- declare const AlertAction: typeof AlertActionBase & {
18
- original: typeof AlertActionBase;
19
- originalName: string;
20
- displayName: string;
21
- } & {
22
- original: typeof AlertActionBase & {
23
- original: typeof AlertActionBase;
24
- originalName: string;
25
- displayName: string;
26
- };
27
- originalName: string;
28
- displayName: string;
29
- } & {
30
- createDecorator: (decorator: import("@webiny/react-composition/types.js").ComponentDecorator<typeof AlertActionBase & {
31
- original: typeof AlertActionBase;
32
- originalName: string;
33
- displayName: string;
34
- }>) => (props: unknown) => React.JSX.Element;
35
- };
36
17
  declare const AlertBase: (props: AlertProps) => React.JSX.Element;
37
18
  declare const Alert: typeof AlertBase & {
38
19
  original: typeof AlertBase;
@@ -1 +1 @@
1
- {"version":3,"file":"Alert/Alert.js","sources":["../../src/Alert/Alert.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { useMemo } from \"react\";\nimport { cn, cva, makeDecoratable, type VariantProps, withStaticProps } from \"~/utils.js\";\nimport { Button, type ButtonProps } from \"~/Button/index.js\";\nimport { AlertIcon } from \"./AlertIcon.js\";\nimport { AlertSwatchBox } from \"./AlertSwatchBox.js\";\nimport { AlertPropsProvider, useAlertProps } from \"./AlertPropsProvider.js\";\nimport { AlertCloseButton } from \"./AlertCloseButton.js\";\nimport { defaultVariants } from \"./constants.js\";\nimport { useAdminUi } from \"~/AdminUiProvider/index.js\";\n\nconst alertVariants = cva(\n \"flex gap-sm-plus items-start w-full rounded-lg text-md py-sm-extra pl-md pr-sm-plus [&_a]:font-semibold [&_a]:underline\",\n {\n variants: {\n type: { info: \"\", success: \"\", warning: \"\", danger: \"\" },\n variant: { strong: \"\", subtle: \"\" }\n },\n defaultVariants,\n compoundVariants: [\n {\n type: \"info\",\n variant: \"strong\",\n className: \"bg-neutral-dark text-neutral-light [&_a]:text-neutral-light!\"\n },\n {\n type: \"info\",\n variant: \"subtle\",\n className: \"bg-neutral-dimmed text-neutral-primary [&_a]:text-neutral-primary!\"\n },\n {\n type: \"success\",\n variant: \"strong\",\n className: \"bg-secondary text-neutral-light [&_a]:text-neutral-light!\"\n },\n {\n type: \"success\",\n variant: \"subtle\",\n className: \"bg-success-subtle text-neutral-primary [&_a]:text-neutral-primary!\"\n },\n {\n type: \"warning\",\n variant: \"strong\",\n className: \"bg-warning text-neutral-primary [&_a]:text-neutral-primary!\"\n },\n {\n type: \"warning\",\n variant: \"subtle\",\n className: \"bg-warning-subtle text-neutral-primary [&_a]:text-neutral-primary!\"\n },\n {\n type: \"danger\",\n variant: \"strong\",\n className: \"bg-destructive text-neutral-light [&_a]:text-neutral-light!\"\n },\n {\n type: \"danger\",\n variant: \"subtle\",\n className: \"bg-destructive-subtle text-neutral-primary [&_a]:text-neutral-primary!\"\n }\n ]\n }\n);\n\nexport interface AlertProps\n extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof alertVariants> {\n showCloseButton?: boolean;\n icon?: React.ReactElement | null;\n onClose?: () => void;\n actions?: React.ReactElement<typeof AlertAction>;\n swatchColor?: string;\n swatchColorIcon?: boolean;\n}\n\nconst AlertActionBase = (props: ButtonProps) => {\n const { variant: alertVariant } = useAlertProps();\n return (\n <Button\n text={\"Button\"}\n variant={alertVariant === \"strong\" ? \"secondary\" : \"tertiary\"}\n size={\"sm\"}\n {...props}\n />\n );\n};\n\nconst AlertAction = makeDecoratable(\"AlertAction\", AlertActionBase);\n\nconst AlertBase = (props: AlertProps) => {\n const { className, type, variant, swatchColor, actions, children, ...rootRestProps } = props;\n const { compileMarkdown } = useAdminUi();\n\n const backgroundColor = useMemo(() => {\n if (!swatchColor) {\n return;\n }\n\n return swatchColor + \"66\";\n }, [swatchColor]);\n\n return (\n <AlertPropsProvider props={props}>\n <div\n role=\"alert\"\n className={cn(alertVariants({ type, variant }), className)}\n style={{ backgroundColor }}\n {...rootRestProps}\n >\n <AlertSwatchBox />\n <AlertIcon />\n <div className={\"grow py-xxs\"}>{compileMarkdown(children)}</div>\n {actions && <div className={\"flex gap-sm\"}>{actions}</div>}\n <AlertCloseButton />\n </div>\n </AlertPropsProvider>\n );\n};\n\nconst Alert = withStaticProps(makeDecoratable(\"AlertBase\", AlertBase), {\n Action: AlertAction\n});\n\nexport { Alert };\n"],"names":["alertVariants","cva","defaultVariants","AlertActionBase","props","alertVariant","useAlertProps","Button","AlertAction","makeDecoratable","AlertBase","className","type","variant","swatchColor","actions","children","rootRestProps","compileMarkdown","useAdminUi","backgroundColor","useMemo","AlertPropsProvider","cn","AlertSwatchBox","AlertIcon","AlertCloseButton","Alert","withStaticProps"],"mappings":";;;;;;;;;AAWA,MAAMA,gBAAgBC,IAClB,2HACA;IACI,UAAU;QACN,MAAM;YAAE,MAAM;YAAI,SAAS;YAAI,SAAS;YAAI,QAAQ;QAAG;QACvD,SAAS;YAAE,QAAQ;YAAI,QAAQ;QAAG;IACtC;IACAC,iBAAeA;IACf,kBAAkB;QACd;YACI,MAAM;YACN,SAAS;YACT,WAAW;QACf;QACA;YACI,MAAM;YACN,SAAS;YACT,WAAW;QACf;QACA;YACI,MAAM;YACN,SAAS;YACT,WAAW;QACf;QACA;YACI,MAAM;YACN,SAAS;YACT,WAAW;QACf;QACA;YACI,MAAM;YACN,SAAS;YACT,WAAW;QACf;QACA;YACI,MAAM;YACN,SAAS;YACT,WAAW;QACf;QACA;YACI,MAAM;YACN,SAAS;YACT,WAAW;QACf;QACA;YACI,MAAM;YACN,SAAS;YACT,WAAW;QACf;KACH;AACL;AAaJ,MAAMC,kBAAkB,CAACC;IACrB,MAAM,EAAE,SAASC,YAAY,EAAE,GAAGC;IAClC,OAAO,WAAP,GACI,sCAACC,QAAMA;QACH,MAAM;QACN,SAASF,AAAiB,aAAjBA,eAA4B,cAAc;QACnD,MAAM;QACL,GAAGD,KAAK;;AAGrB;AAEA,MAAMI,cAAcC,gBAAgB,eAAeN;AAEnD,MAAMO,YAAY,CAACN;IACf,MAAM,EAAEO,SAAS,EAAEC,IAAI,EAAEC,OAAO,EAAEC,WAAW,EAAEC,OAAO,EAAEC,QAAQ,EAAE,GAAGC,eAAe,GAAGb;IACvF,MAAM,EAAEc,eAAe,EAAE,GAAGC;IAE5B,MAAMC,kBAAkBC,AAAAA,IAAAA,wBAAAA,OAAAA,AAAAA,EAAQ;QAC5B,IAAI,CAACP,aACD;QAGJ,OAAOA,cAAc;IACzB,GAAG;QAACA;KAAY;IAEhB,OAAO,WAAP,GACI,sCAACQ,oBAAkBA;QAAC,OAAOlB;qBACvB,sCAAC;QACG,MAAK;QACL,WAAWmB,GAAGvB,cAAc;YAAEY;YAAMC;QAAQ,IAAIF;QAChD,OAAO;YAAES;QAAgB;QACxB,GAAGH,aAAa;qBAEjB,sCAACO,gBAAcA,OAAAA,WAAAA,GACf,sCAACC,WAASA,OAAAA,WAAAA,GACV,sCAAC;QAAI,WAAW;OAAgBP,gBAAgBF,YAC/CD,WAAW,WAAXA,GAAW,sCAAC;QAAI,WAAW;OAAgBA,UAAAA,WAAAA,GAC5C,sCAACW,kBAAgBA;AAIjC;AAEA,MAAMC,QAAQC,gBAAgBnB,gBAAgB,aAAaC,YAAY;IACnE,QAAQF;AACZ"}
1
+ {"version":3,"file":"Alert/Alert.js","sources":["../../src/Alert/Alert.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { useMemo } from \"react\";\nimport { cn, cva, makeDecoratable, type VariantProps, withStaticProps } from \"~/utils.js\";\nimport { Button, type ButtonProps } from \"~/Button/index.js\";\nimport { AlertIcon } from \"./AlertIcon.js\";\nimport { AlertSwatchBox } from \"./AlertSwatchBox.js\";\nimport { AlertPropsProvider, useAlertProps } from \"./AlertPropsProvider.js\";\nimport { AlertCloseButton } from \"./AlertCloseButton.js\";\nimport { defaultVariants } from \"./constants.js\";\nimport { useAdminUi } from \"~/AdminUiProvider/index.js\";\n\nconst alertVariants = cva(\n \"flex gap-sm-plus items-start w-full rounded-lg text-md py-sm-extra pl-md pr-sm-plus [&_a]:font-semibold [&_a]:underline\",\n {\n variants: {\n type: { info: \"\", success: \"\", warning: \"\", danger: \"\" },\n variant: { strong: \"\", subtle: \"\" }\n },\n defaultVariants,\n compoundVariants: [\n {\n type: \"info\",\n variant: \"strong\",\n className: \"bg-neutral-dark text-neutral-light [&_a]:text-neutral-light!\"\n },\n {\n type: \"info\",\n variant: \"subtle\",\n className: \"bg-neutral-dimmed text-neutral-primary [&_a]:text-neutral-primary!\"\n },\n {\n type: \"success\",\n variant: \"strong\",\n className: \"bg-secondary text-neutral-light [&_a]:text-neutral-light!\"\n },\n {\n type: \"success\",\n variant: \"subtle\",\n className: \"bg-success-subtle text-neutral-primary [&_a]:text-neutral-primary!\"\n },\n {\n type: \"warning\",\n variant: \"strong\",\n className: \"bg-warning text-neutral-primary [&_a]:text-neutral-primary!\"\n },\n {\n type: \"warning\",\n variant: \"subtle\",\n className: \"bg-warning-subtle text-neutral-primary [&_a]:text-neutral-primary!\"\n },\n {\n type: \"danger\",\n variant: \"strong\",\n className: \"bg-destructive text-neutral-light [&_a]:text-neutral-light!\"\n },\n {\n type: \"danger\",\n variant: \"subtle\",\n className: \"bg-destructive-subtle text-neutral-primary [&_a]:text-neutral-primary!\"\n }\n ]\n }\n);\n\nexport interface AlertProps\n extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof alertVariants> {\n showCloseButton?: boolean;\n icon?: React.ReactElement | null;\n onClose?: () => void;\n actions?: React.ReactElement;\n swatchColor?: string;\n swatchColorIcon?: boolean;\n}\n\nconst AlertActionBase = (props: ButtonProps) => {\n const { variant: alertVariant } = useAlertProps();\n return (\n <Button\n text={\"Button\"}\n variant={alertVariant === \"strong\" ? \"secondary\" : \"tertiary\"}\n size={\"sm\"}\n {...props}\n />\n );\n};\n\nconst AlertAction = makeDecoratable(\"AlertAction\", AlertActionBase);\n\nconst AlertBase = (props: AlertProps) => {\n const { className, type, variant, swatchColor, actions, children, ...rootRestProps } = props;\n const { compileMarkdown } = useAdminUi();\n\n const backgroundColor = useMemo(() => {\n if (!swatchColor) {\n return;\n }\n\n return swatchColor + \"66\";\n }, [swatchColor]);\n\n return (\n <AlertPropsProvider props={props}>\n <div\n role=\"alert\"\n className={cn(alertVariants({ type, variant }), className)}\n style={{ backgroundColor }}\n {...rootRestProps}\n >\n <AlertSwatchBox />\n <AlertIcon />\n <div className={\"grow py-xxs\"}>{compileMarkdown(children)}</div>\n {actions && <div className={\"flex gap-sm\"}>{actions}</div>}\n <AlertCloseButton />\n </div>\n </AlertPropsProvider>\n );\n};\n\nconst Alert = withStaticProps(makeDecoratable(\"AlertBase\", AlertBase), {\n Action: AlertAction\n});\n\nexport { Alert };\n"],"names":["alertVariants","cva","defaultVariants","AlertActionBase","props","alertVariant","useAlertProps","Button","AlertAction","makeDecoratable","AlertBase","className","type","variant","swatchColor","actions","children","rootRestProps","compileMarkdown","useAdminUi","backgroundColor","useMemo","AlertPropsProvider","cn","AlertSwatchBox","AlertIcon","AlertCloseButton","Alert","withStaticProps"],"mappings":";;;;;;;;;AAWA,MAAMA,gBAAgBC,IAClB,2HACA;IACI,UAAU;QACN,MAAM;YAAE,MAAM;YAAI,SAAS;YAAI,SAAS;YAAI,QAAQ;QAAG;QACvD,SAAS;YAAE,QAAQ;YAAI,QAAQ;QAAG;IACtC;IACAC,iBAAeA;IACf,kBAAkB;QACd;YACI,MAAM;YACN,SAAS;YACT,WAAW;QACf;QACA;YACI,MAAM;YACN,SAAS;YACT,WAAW;QACf;QACA;YACI,MAAM;YACN,SAAS;YACT,WAAW;QACf;QACA;YACI,MAAM;YACN,SAAS;YACT,WAAW;QACf;QACA;YACI,MAAM;YACN,SAAS;YACT,WAAW;QACf;QACA;YACI,MAAM;YACN,SAAS;YACT,WAAW;QACf;QACA;YACI,MAAM;YACN,SAAS;YACT,WAAW;QACf;QACA;YACI,MAAM;YACN,SAAS;YACT,WAAW;QACf;KACH;AACL;AAaJ,MAAMC,kBAAkB,CAACC;IACrB,MAAM,EAAE,SAASC,YAAY,EAAE,GAAGC;IAClC,OAAO,WAAP,GACI,sCAACC,QAAMA;QACH,MAAM;QACN,SAASF,AAAiB,aAAjBA,eAA4B,cAAc;QACnD,MAAM;QACL,GAAGD,KAAK;;AAGrB;AAEA,MAAMI,cAAcC,gBAAgB,eAAeN;AAEnD,MAAMO,YAAY,CAACN;IACf,MAAM,EAAEO,SAAS,EAAEC,IAAI,EAAEC,OAAO,EAAEC,WAAW,EAAEC,OAAO,EAAEC,QAAQ,EAAE,GAAGC,eAAe,GAAGb;IACvF,MAAM,EAAEc,eAAe,EAAE,GAAGC;IAE5B,MAAMC,kBAAkBC,AAAAA,IAAAA,wBAAAA,OAAAA,AAAAA,EAAQ;QAC5B,IAAI,CAACP,aACD;QAGJ,OAAOA,cAAc;IACzB,GAAG;QAACA;KAAY;IAEhB,OAAO,WAAP,GACI,sCAACQ,oBAAkBA;QAAC,OAAOlB;qBACvB,sCAAC;QACG,MAAK;QACL,WAAWmB,GAAGvB,cAAc;YAAEY;YAAMC;QAAQ,IAAIF;QAChD,OAAO;YAAES;QAAgB;QACxB,GAAGH,aAAa;qBAEjB,sCAACO,gBAAcA,OAAAA,WAAAA,GACf,sCAACC,WAASA,OAAAA,WAAAA,GACV,sCAAC;QAAI,WAAW;OAAgBP,gBAAgBF,YAC/CD,WAAW,WAAXA,GAAW,sCAAC;QAAI,WAAW;OAAgBA,UAAAA,WAAAA,GAC5C,sCAACW,kBAAgBA;AAIjC;AAEA,MAAMC,QAAQC,gBAAgBnB,gBAAgB,aAAaC,YAAY;IACnE,QAAQF;AACZ"}
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import type { InputPrimitiveProps } from "../../Input/index.js";
3
3
  import type { AutoCompleteOption } from "../domains/index.js";
4
- import type { Icon } from "../../Icon/index.js";
4
+ import type { IconElement } from "../../Icon/index.js";
5
5
  interface AutoCompletePrimitiveProps {
6
6
  /**
7
7
  * Indicates if the reset action should be displayed.
@@ -74,10 +74,16 @@ interface AutoCompletePrimitiveProps {
74
74
  * Refer to `InputPrimitiveProps["size"]` for possible values.
75
75
  */
76
76
  size?: InputPrimitiveProps["size"];
77
+ /**
78
+ * Filter the options by the typed text on the client. Defaults to `true`.
79
+ * Set to `false` when `onValueSearch` already returns the matching options,
80
+ * so options matched on data other than their label are not dropped.
81
+ */
82
+ shouldFilter?: boolean;
77
83
  /**
78
84
  * Icon to be displayed at the start of the input field.
79
85
  */
80
- startIcon?: React.ReactElement<typeof Icon> | React.ReactElement;
86
+ startIcon?: IconElement;
81
87
  /**
82
88
  * Variant of the input field.
83
89
  * Refer to `InputPrimitiveProps["variant"]` for possible values.
@@ -31,6 +31,7 @@ const DecoratableAutoCompletePrimitive = (props)=>{
31
31
  onOpenChange: ()=>setListOpenState(true)
32
32
  }, /*#__PURE__*/ react.createElement(Command, {
33
33
  label: String(props.label),
34
+ shouldFilter: props.shouldFilter,
34
35
  onKeyDown: handleKeyDown
35
36
  }, /*#__PURE__*/ react.createElement(PopoverPrimitive.Trigger, {
36
37
  asChild: true
@@ -1 +1 @@
1
- {"version":3,"file":"AutoComplete/primitives/AutoCompletePrimitive.js","sources":["../../../src/AutoComplete/primitives/AutoCompletePrimitive.tsx"],"sourcesContent":["import type { KeyboardEvent } from \"react\";\nimport React from \"react\";\nimport { Command } from \"~/Command/index.js\";\nimport { PopoverPrimitive } from \"~/Popover/index.js\";\nimport type { InputPrimitiveProps } from \"~/Input/index.js\";\nimport { useAutoComplete } from \"./useAutoComplete.js\";\nimport { AutoCompleteInputIcons, AutoCompleteList } from \"./components/index.js\";\nimport type { AutoCompleteOption } from \"../domains/index.js\";\nimport { makeDecoratable } from \"~/utils.js\";\nimport type { Icon } from \"~/Icon/index.js\";\n\ninterface AutoCompletePrimitiveProps {\n /**\n * Indicates if the reset action should be displayed.\n */\n displayResetAction?: boolean;\n /**\n * Indicates if the field is disabled.\n */\n disabled?: boolean;\n /**\n * Message to display when there are no options.\n */\n emptyMessage?: React.ReactNode;\n /**\n * Message to display when there are no options loaded or selected.\n * Use it to invite the user to interact with the autocomplete by typing a value.\n */\n initialMessage?: React.ReactNode;\n /**\n * Reference to the input element.\n */\n inputRef?: React.Ref<HTMLInputElement>;\n /**\n * Indicates if the input field is invalid.\n * Refer to `InputPrimitiveProps[\"invalid\"]` for possible values.\n */\n invalid?: InputPrimitiveProps[\"invalid\"];\n /**\n * Accessible label for the command menu. Not shown visibly.\n */\n label?: string;\n /**\n * Indicates if the autocomplete is loading options.\n */\n loading?: boolean;\n /**\n * Message to display while loading options.\n */\n loadingMessage?: React.ReactNode;\n /**\n * Callback triggered when the open state changes.\n */\n onOpenChange?: (open: boolean) => void;\n /**\n * Callback triggered to reset the value.\n */\n onValueReset?: () => void;\n /**\n * Callback triggered when a value has been searched by the user.\n */\n onValueSearch?: (value: string) => void;\n /**\n * Callback triggered when the value changes.\n */\n onValueChange: (value: string) => void;\n /**\n * List of options for the autocomplete.\n */\n options?: AutoCompleteOption[];\n /**\n * Custom renderer for the options.\n */\n optionRenderer?: (item: any, index: number) => React.ReactNode;\n /**\n * Placeholder text for the input field.\n */\n placeholder?: string;\n /**\n * Size of the input field.\n * Refer to `InputPrimitiveProps[\"size\"]` for possible values.\n */\n size?: InputPrimitiveProps[\"size\"];\n /**\n * Icon to be displayed at the start of the input field.\n */\n startIcon?: React.ReactElement<typeof Icon> | React.ReactElement;\n /**\n * Variant of the input field.\n * Refer to `InputPrimitiveProps[\"variant\"]` for possible values.\n */\n variant?: InputPrimitiveProps[\"variant\"];\n /**\n * Optional selected item.\n */\n value?: string;\n}\n\nconst DecoratableAutoCompletePrimitive = (props: AutoCompletePrimitiveProps) => {\n const {\n vm,\n setListOpenState,\n setSelectedOption,\n searchOption,\n resetSelectedOption,\n showSelectedOption\n } = useAutoComplete(props);\n\n const handleKeyDown = React.useCallback(\n (event: KeyboardEvent<HTMLDivElement>) => {\n if (props.disabled) {\n return;\n }\n\n if (event.key.toLowerCase() === \"escape\") {\n setListOpenState(false);\n } else {\n setListOpenState(true);\n }\n },\n [props.disabled, setListOpenState]\n );\n\n const handleSelectOption = React.useCallback(\n (value: string) => {\n setSelectedOption(value);\n setListOpenState(false);\n },\n [setSelectedOption, setListOpenState]\n );\n\n const handleOnBlur = React.useCallback(() => {\n setListOpenState(false);\n showSelectedOption();\n }, [setListOpenState]);\n\n return (\n <PopoverPrimitive open={vm.optionsListVm.open} onOpenChange={() => setListOpenState(true)}>\n <Command label={String(props.label)} onKeyDown={handleKeyDown}>\n <PopoverPrimitive.Trigger asChild>\n <span>\n <Command.Input\n inputRef={props.inputRef}\n value={vm.inputVm.value}\n onValueChange={searchOption}\n placeholder={vm.inputVm.placeholder}\n size={props.size}\n variant={props.variant}\n disabled={props.disabled}\n invalid={props.invalid}\n startIcon={props.startIcon}\n endIcon={\n <AutoCompleteInputIcons\n inputSize={props.size}\n inputVariant={props.variant}\n displayResetAction={vm.inputVm.displayResetAction}\n disabled={props.disabled}\n loading={props.loading}\n onResetValue={resetSelectedOption}\n onOpenChange={() => setListOpenState(!vm.optionsListVm.open)}\n />\n }\n onBlur={handleOnBlur}\n onFocus={() => setListOpenState(true)}\n />\n </span>\n </PopoverPrimitive.Trigger>\n <PopoverPrimitive.Content\n style={{ minWidth: \"var(--radix-popover-trigger-width)\" }}\n onOpenAutoFocus={e => e.preventDefault()}\n >\n <AutoCompleteList\n options={vm.optionsListVm.options}\n onOptionSelect={handleSelectOption}\n empty={vm.optionsListVm.empty}\n loading={props.loading}\n loadingMessage={vm.optionsListVm.loadingMessage}\n emptyMessage={vm.optionsListVm.emptyMessage}\n optionRenderer={props.optionRenderer}\n />\n </PopoverPrimitive.Content>\n </Command>\n </PopoverPrimitive>\n );\n};\n\nconst AutoCompletePrimitive = makeDecoratable(\n \"AutoCompletePrimitive\",\n DecoratableAutoCompletePrimitive\n);\n\nexport { AutoCompletePrimitive, type AutoCompletePrimitiveProps };\n"],"names":["DecoratableAutoCompletePrimitive","props","vm","setListOpenState","setSelectedOption","searchOption","resetSelectedOption","showSelectedOption","useAutoComplete","handleKeyDown","React","event","handleSelectOption","value","handleOnBlur","PopoverPrimitive","Command","String","AutoCompleteInputIcons","e","AutoCompleteList","AutoCompletePrimitive","makeDecoratable"],"mappings":";;;;;;AAkGA,MAAMA,mCAAmC,CAACC;IACtC,MAAM,EACFC,EAAE,EACFC,gBAAgB,EAChBC,iBAAiB,EACjBC,YAAY,EACZC,mBAAmB,EACnBC,kBAAkB,EACrB,GAAGC,gBAAgBP;IAEpB,MAAMQ,gBAAgBC,MAAAA,WAAiB,CACnC,CAACC;QACG,IAAIV,MAAM,QAAQ,EACd;QAG4B,aAA5BU,MAAM,GAAG,CAAC,WAAW,KACrBR,iBAAiB,SAEjBA,iBAAiB;IAEzB,GACA;QAACF,MAAM,QAAQ;QAAEE;KAAiB;IAGtC,MAAMS,qBAAqBF,MAAAA,WAAiB,CACxC,CAACG;QACGT,kBAAkBS;QAClBV,iBAAiB;IACrB,GACA;QAACC;QAAmBD;KAAiB;IAGzC,MAAMW,eAAeJ,MAAAA,WAAiB,CAAC;QACnCP,iBAAiB;QACjBI;IACJ,GAAG;QAACJ;KAAiB;IAErB,OAAO,WAAP,GACI,oBAACY,kBAAgBA;QAAC,MAAMb,GAAG,aAAa,CAAC,IAAI;QAAE,cAAc,IAAMC,iBAAiB;qBAChF,oBAACa,SAAOA;QAAC,OAAOC,OAAOhB,MAAM,KAAK;QAAG,WAAWQ;qBAC5C,oBAACM,iBAAiB,OAAO;QAAC;qBACtB,oBAAC,4BACG,oBAACC,QAAQ,KAAK;QACV,UAAUf,MAAM,QAAQ;QACxB,OAAOC,GAAG,OAAO,CAAC,KAAK;QACvB,eAAeG;QACf,aAAaH,GAAG,OAAO,CAAC,WAAW;QACnC,MAAMD,MAAM,IAAI;QAChB,SAASA,MAAM,OAAO;QACtB,UAAUA,MAAM,QAAQ;QACxB,SAASA,MAAM,OAAO;QACtB,WAAWA,MAAM,SAAS;QAC1B,uBACI,oBAACiB,wBAAsBA;YACnB,WAAWjB,MAAM,IAAI;YACrB,cAAcA,MAAM,OAAO;YAC3B,oBAAoBC,GAAG,OAAO,CAAC,kBAAkB;YACjD,UAAUD,MAAM,QAAQ;YACxB,SAASA,MAAM,OAAO;YACtB,cAAcK;YACd,cAAc,IAAMH,iBAAiB,CAACD,GAAG,aAAa,CAAC,IAAI;;QAGnE,QAAQY;QACR,SAAS,IAAMX,iBAAiB;wBAI5C,oBAACY,iBAAiB,OAAO;QACrB,OAAO;YAAE,UAAU;QAAqC;QACxD,iBAAiBI,CAAAA,IAAKA,EAAE,cAAc;qBAEtC,oBAACC,kBAAgBA;QACb,SAASlB,GAAG,aAAa,CAAC,OAAO;QACjC,gBAAgBU;QAChB,OAAOV,GAAG,aAAa,CAAC,KAAK;QAC7B,SAASD,MAAM,OAAO;QACtB,gBAAgBC,GAAG,aAAa,CAAC,cAAc;QAC/C,cAAcA,GAAG,aAAa,CAAC,YAAY;QAC3C,gBAAgBD,MAAM,cAAc;;AAM5D;AAEA,MAAMoB,wBAAwBC,gBAC1B,yBACAtB"}
1
+ {"version":3,"file":"AutoComplete/primitives/AutoCompletePrimitive.js","sources":["../../../src/AutoComplete/primitives/AutoCompletePrimitive.tsx"],"sourcesContent":["import type { KeyboardEvent } from \"react\";\nimport React from \"react\";\nimport { Command } from \"~/Command/index.js\";\nimport { PopoverPrimitive } from \"~/Popover/index.js\";\nimport type { InputPrimitiveProps } from \"~/Input/index.js\";\nimport { useAutoComplete } from \"./useAutoComplete.js\";\nimport { AutoCompleteInputIcons, AutoCompleteList } from \"./components/index.js\";\nimport type { AutoCompleteOption } from \"../domains/index.js\";\nimport { makeDecoratable } from \"~/utils.js\";\nimport type { IconElement } from \"~/Icon/index.js\";\n\ninterface AutoCompletePrimitiveProps {\n /**\n * Indicates if the reset action should be displayed.\n */\n displayResetAction?: boolean;\n /**\n * Indicates if the field is disabled.\n */\n disabled?: boolean;\n /**\n * Message to display when there are no options.\n */\n emptyMessage?: React.ReactNode;\n /**\n * Message to display when there are no options loaded or selected.\n * Use it to invite the user to interact with the autocomplete by typing a value.\n */\n initialMessage?: React.ReactNode;\n /**\n * Reference to the input element.\n */\n inputRef?: React.Ref<HTMLInputElement>;\n /**\n * Indicates if the input field is invalid.\n * Refer to `InputPrimitiveProps[\"invalid\"]` for possible values.\n */\n invalid?: InputPrimitiveProps[\"invalid\"];\n /**\n * Accessible label for the command menu. Not shown visibly.\n */\n label?: string;\n /**\n * Indicates if the autocomplete is loading options.\n */\n loading?: boolean;\n /**\n * Message to display while loading options.\n */\n loadingMessage?: React.ReactNode;\n /**\n * Callback triggered when the open state changes.\n */\n onOpenChange?: (open: boolean) => void;\n /**\n * Callback triggered to reset the value.\n */\n onValueReset?: () => void;\n /**\n * Callback triggered when a value has been searched by the user.\n */\n onValueSearch?: (value: string) => void;\n /**\n * Callback triggered when the value changes.\n */\n onValueChange: (value: string) => void;\n /**\n * List of options for the autocomplete.\n */\n options?: AutoCompleteOption[];\n /**\n * Custom renderer for the options.\n */\n optionRenderer?: (item: any, index: number) => React.ReactNode;\n /**\n * Placeholder text for the input field.\n */\n placeholder?: string;\n /**\n * Size of the input field.\n * Refer to `InputPrimitiveProps[\"size\"]` for possible values.\n */\n size?: InputPrimitiveProps[\"size\"];\n /**\n * Filter the options by the typed text on the client. Defaults to `true`.\n * Set to `false` when `onValueSearch` already returns the matching options,\n * so options matched on data other than their label are not dropped.\n */\n shouldFilter?: boolean;\n /**\n * Icon to be displayed at the start of the input field.\n */\n startIcon?: IconElement;\n /**\n * Variant of the input field.\n * Refer to `InputPrimitiveProps[\"variant\"]` for possible values.\n */\n variant?: InputPrimitiveProps[\"variant\"];\n /**\n * Optional selected item.\n */\n value?: string;\n}\n\nconst DecoratableAutoCompletePrimitive = (props: AutoCompletePrimitiveProps) => {\n const {\n vm,\n setListOpenState,\n setSelectedOption,\n searchOption,\n resetSelectedOption,\n showSelectedOption\n } = useAutoComplete(props);\n\n const handleKeyDown = React.useCallback(\n (event: KeyboardEvent<HTMLDivElement>) => {\n if (props.disabled) {\n return;\n }\n\n if (event.key.toLowerCase() === \"escape\") {\n setListOpenState(false);\n } else {\n setListOpenState(true);\n }\n },\n [props.disabled, setListOpenState]\n );\n\n const handleSelectOption = React.useCallback(\n (value: string) => {\n setSelectedOption(value);\n setListOpenState(false);\n },\n [setSelectedOption, setListOpenState]\n );\n\n const handleOnBlur = React.useCallback(() => {\n setListOpenState(false);\n showSelectedOption();\n }, [setListOpenState]);\n\n return (\n <PopoverPrimitive open={vm.optionsListVm.open} onOpenChange={() => setListOpenState(true)}>\n <Command\n label={String(props.label)}\n shouldFilter={props.shouldFilter}\n onKeyDown={handleKeyDown}\n >\n <PopoverPrimitive.Trigger asChild>\n <span>\n <Command.Input\n inputRef={props.inputRef}\n value={vm.inputVm.value}\n onValueChange={searchOption}\n placeholder={vm.inputVm.placeholder}\n size={props.size}\n variant={props.variant}\n disabled={props.disabled}\n invalid={props.invalid}\n startIcon={props.startIcon}\n endIcon={\n <AutoCompleteInputIcons\n inputSize={props.size}\n inputVariant={props.variant}\n displayResetAction={vm.inputVm.displayResetAction}\n disabled={props.disabled}\n loading={props.loading}\n onResetValue={resetSelectedOption}\n onOpenChange={() => setListOpenState(!vm.optionsListVm.open)}\n />\n }\n onBlur={handleOnBlur}\n onFocus={() => setListOpenState(true)}\n />\n </span>\n </PopoverPrimitive.Trigger>\n <PopoverPrimitive.Content\n style={{ minWidth: \"var(--radix-popover-trigger-width)\" }}\n onOpenAutoFocus={e => e.preventDefault()}\n >\n <AutoCompleteList\n options={vm.optionsListVm.options}\n onOptionSelect={handleSelectOption}\n empty={vm.optionsListVm.empty}\n loading={props.loading}\n loadingMessage={vm.optionsListVm.loadingMessage}\n emptyMessage={vm.optionsListVm.emptyMessage}\n optionRenderer={props.optionRenderer}\n />\n </PopoverPrimitive.Content>\n </Command>\n </PopoverPrimitive>\n );\n};\n\nconst AutoCompletePrimitive = makeDecoratable(\n \"AutoCompletePrimitive\",\n DecoratableAutoCompletePrimitive\n);\n\nexport { AutoCompletePrimitive, type AutoCompletePrimitiveProps };\n"],"names":["DecoratableAutoCompletePrimitive","props","vm","setListOpenState","setSelectedOption","searchOption","resetSelectedOption","showSelectedOption","useAutoComplete","handleKeyDown","React","event","handleSelectOption","value","handleOnBlur","PopoverPrimitive","Command","String","AutoCompleteInputIcons","e","AutoCompleteList","AutoCompletePrimitive","makeDecoratable"],"mappings":";;;;;;AAwGA,MAAMA,mCAAmC,CAACC;IACtC,MAAM,EACFC,EAAE,EACFC,gBAAgB,EAChBC,iBAAiB,EACjBC,YAAY,EACZC,mBAAmB,EACnBC,kBAAkB,EACrB,GAAGC,gBAAgBP;IAEpB,MAAMQ,gBAAgBC,MAAAA,WAAiB,CACnC,CAACC;QACG,IAAIV,MAAM,QAAQ,EACd;QAG4B,aAA5BU,MAAM,GAAG,CAAC,WAAW,KACrBR,iBAAiB,SAEjBA,iBAAiB;IAEzB,GACA;QAACF,MAAM,QAAQ;QAAEE;KAAiB;IAGtC,MAAMS,qBAAqBF,MAAAA,WAAiB,CACxC,CAACG;QACGT,kBAAkBS;QAClBV,iBAAiB;IACrB,GACA;QAACC;QAAmBD;KAAiB;IAGzC,MAAMW,eAAeJ,MAAAA,WAAiB,CAAC;QACnCP,iBAAiB;QACjBI;IACJ,GAAG;QAACJ;KAAiB;IAErB,OAAO,WAAP,GACI,oBAACY,kBAAgBA;QAAC,MAAMb,GAAG,aAAa,CAAC,IAAI;QAAE,cAAc,IAAMC,iBAAiB;qBAChF,oBAACa,SAAOA;QACJ,OAAOC,OAAOhB,MAAM,KAAK;QACzB,cAAcA,MAAM,YAAY;QAChC,WAAWQ;qBAEX,oBAACM,iBAAiB,OAAO;QAAC;qBACtB,oBAAC,4BACG,oBAACC,QAAQ,KAAK;QACV,UAAUf,MAAM,QAAQ;QACxB,OAAOC,GAAG,OAAO,CAAC,KAAK;QACvB,eAAeG;QACf,aAAaH,GAAG,OAAO,CAAC,WAAW;QACnC,MAAMD,MAAM,IAAI;QAChB,SAASA,MAAM,OAAO;QACtB,UAAUA,MAAM,QAAQ;QACxB,SAASA,MAAM,OAAO;QACtB,WAAWA,MAAM,SAAS;QAC1B,uBACI,oBAACiB,wBAAsBA;YACnB,WAAWjB,MAAM,IAAI;YACrB,cAAcA,MAAM,OAAO;YAC3B,oBAAoBC,GAAG,OAAO,CAAC,kBAAkB;YACjD,UAAUD,MAAM,QAAQ;YACxB,SAASA,MAAM,OAAO;YACtB,cAAcK;YACd,cAAc,IAAMH,iBAAiB,CAACD,GAAG,aAAa,CAAC,IAAI;;QAGnE,QAAQY;QACR,SAAS,IAAMX,iBAAiB;wBAI5C,oBAACY,iBAAiB,OAAO;QACrB,OAAO;YAAE,UAAU;QAAqC;QACxD,iBAAiBI,CAAAA,IAAKA,EAAE,cAAc;qBAEtC,oBAACC,kBAAgBA;QACb,SAASlB,GAAG,aAAa,CAAC,OAAO;QACjC,gBAAgBU;QAChB,OAAOV,GAAG,aAAa,CAAC,KAAK;QAC7B,SAASD,MAAM,OAAO;QACtB,gBAAgBC,GAAG,aAAa,CAAC,cAAc;QAC/C,cAAcA,GAAG,aAAa,CAAC,YAAY;QAC3C,gBAAgBD,MAAM,cAAc;;AAM5D;AAEA,MAAMoB,wBAAwBC,gBAC1B,yBACAtB"}
@@ -2,7 +2,7 @@ import react from "react";
2
2
  import { ReactComponent } from "@webiny/icons/home.svg";
3
3
  import { ReactComponent as keyboard_arrow_right_svg_ReactComponent } from "@webiny/icons/keyboard_arrow_right.svg";
4
4
  import { cn, makeDecoratable } from "../utils.js";
5
- const itemTextClassName = "block max-w-[150px] truncate text-sm leading-none tracking-normal whitespace-nowrap";
5
+ const itemTextClassName = "block max-w-[150px] truncate text-sm tracking-normal whitespace-nowrap";
6
6
  const glyphClassName = "size-md shrink-0 fill-current";
7
7
  const renderGlyph = (icon)=>{
8
8
  if (!/*#__PURE__*/ react.isValidElement(icon)) return icon;
@@ -28,7 +28,7 @@ const BreadcrumbItem = ({ item })=>{
28
28
  type: "button",
29
29
  onClick: item.onClick,
30
30
  title: title,
31
- className: cn("flex items-center rounded-sm px-xs py-xxs", "text-neutral-muted transition-colors", "hover:bg-neutral-dimmed hover:text-neutral-primary", "focus-visible:outline-none focus-visible:ring-md focus-visible:ring-primary-dimmed")
31
+ className: cn("flex items-center rounded-sm px-xs py-xxs", "cursor-pointer text-neutral-muted transition-colors", "hover:bg-neutral-dimmed hover:text-neutral-primary", "focus-visible:outline-none focus-visible:ring-md focus-visible:ring-primary-dimmed")
32
32
  }, content);
33
33
  };
34
34
  const BreadcrumbSeparator = ()=>/*#__PURE__*/ react.createElement("span", {
@@ -1 +1 @@
1
- {"version":3,"file":"Breadcrumbs/Breadcrumbs.js","sources":["../../src/Breadcrumbs/Breadcrumbs.tsx"],"sourcesContent":["import React from \"react\";\nimport { ReactComponent as HomeIcon } from \"@webiny/icons/home.svg\";\nimport { ReactComponent as SeparatorIcon } from \"@webiny/icons/keyboard_arrow_right.svg\";\nimport { cn } from \"~/utils.js\";\nimport { makeDecoratable } from \"~/utils.js\";\n\nexport interface BreadcrumbsItem {\n /**\n * Text label of the breadcrumb. Omitted for the leading home item, which is icon-only.\n */\n label?: string;\n /**\n * Leading icon. Used by the home item; other items typically render text only. Sized and\n * colored by the breadcrumb — pass the raw icon component (e.g. `<HomeIcon />`).\n */\n icon?: React.ReactNode;\n /**\n * Full, untruncated text used as the item's `title` (native tooltip). Defaults to `label`.\n */\n title?: string;\n /**\n * Navigates when the item is activated. Omitted (or on the current item) renders a\n * non-interactive item.\n */\n onClick?: () => void;\n /**\n * Marks the current location — the last item in the trail. Rendered with stronger text\n * and never interactive, per the design system's breadcrumb guidelines.\n */\n current?: boolean;\n}\n\nexport interface BreadcrumbsProps extends React.HTMLAttributes<HTMLElement> {\n items: BreadcrumbsItem[];\n}\n\nconst itemTextClassName =\n \"block max-w-[150px] truncate text-sm leading-none tracking-normal whitespace-nowrap\";\n\n// The material glyphs default their `fill` to `currentColor`, so the surrounding text color\n// (muted / primary / hover) drives the icon color too.\nconst glyphClassName = \"size-md shrink-0 fill-current\";\n\nconst renderGlyph = (icon: React.ReactNode) => {\n if (!React.isValidElement(icon)) {\n return icon;\n }\n const element = icon as React.ReactElement<{ className?: string }>;\n return React.cloneElement(element, {\n className: cn(glyphClassName, element.props.className)\n });\n};\n\nconst BreadcrumbItem = ({ item }: { item: BreadcrumbsItem }) => {\n const interactive = Boolean(item.onClick) && !item.current;\n const title = item.title ?? item.label;\n\n const content = (\n <span className=\"flex items-center gap-xs\">\n {item.icon ? renderGlyph(item.icon) : null}\n {item.label ? <span className={itemTextClassName}>{item.label}</span> : null}\n </span>\n );\n\n // The current (active) item and any item without an action render as plain text.\n if (!interactive) {\n return (\n <span\n aria-current={item.current ? \"page\" : undefined}\n title={title}\n className={cn(\n \"flex items-center rounded-sm px-xs py-xxs\",\n item.current ? \"text-neutral-primary\" : \"text-neutral-muted\"\n )}\n >\n {content}\n </span>\n );\n }\n\n return (\n <button\n type=\"button\"\n onClick={item.onClick}\n title={title}\n className={cn(\n \"flex items-center rounded-sm px-xs py-xxs\",\n \"text-neutral-muted transition-colors\",\n \"hover:bg-neutral-dimmed hover:text-neutral-primary\",\n \"focus-visible:outline-none focus-visible:ring-md focus-visible:ring-primary-dimmed\"\n )}\n >\n {content}\n </button>\n );\n};\n\nconst BreadcrumbSeparator = () => {\n return (\n <span aria-hidden=\"true\" className=\"flex items-center text-neutral-muted\">\n <SeparatorIcon className={glyphClassName} />\n </span>\n );\n};\n\nconst BreadcrumbsBase = ({ items, className, ...props }: BreadcrumbsProps) => {\n if (items.length === 0) {\n return null;\n }\n\n return (\n <nav aria-label=\"Breadcrumb\" className={cn(\"flex items-center\", className)} {...props}>\n <ol className=\"flex items-center gap-none\">\n {items.map((item, index) => {\n // A stable-enough key: labels are unique within a trail; index breaks ties.\n const key = `${item.label ?? \"home\"}-${index}`;\n return (\n <li key={key} className=\"flex items-center\">\n {index > 0 ? <BreadcrumbSeparator /> : null}\n <BreadcrumbItem item={item} />\n </li>\n );\n })}\n </ol>\n </nav>\n );\n};\n\nconst Breadcrumbs = makeDecoratable(\"Breadcrumbs\", BreadcrumbsBase);\n\n/**\n * Convenience factory for the leading, icon-only home entry.\n */\nexport const createHomeBreadcrumbItem = (onClick?: () => void): BreadcrumbsItem => ({\n icon: <HomeIcon />,\n title: \"Home\",\n onClick\n});\n\nexport { Breadcrumbs };\n"],"names":["itemTextClassName","glyphClassName","renderGlyph","icon","React","element","cn","BreadcrumbItem","item","interactive","Boolean","title","content","undefined","BreadcrumbSeparator","SeparatorIcon","BreadcrumbsBase","items","className","props","index","key","Breadcrumbs","makeDecoratable","createHomeBreadcrumbItem","onClick","HomeIcon"],"mappings":";;;;AAoCA,MAAMA,oBACF;AAIJ,MAAMC,iBAAiB;AAEvB,MAAMC,cAAc,CAACC;IACjB,IAAI,CAAC,WAAD,GAACC,MAAAA,cAAoB,CAACD,OACtB,OAAOA;IAEX,MAAME,UAAUF;IAChB,OAAO,WAAP,GAAOC,MAAAA,YAAkB,CAACC,SAAS;QAC/B,WAAWC,GAAGL,gBAAgBI,QAAQ,KAAK,CAAC,SAAS;IACzD;AACJ;AAEA,MAAME,iBAAiB,CAAC,EAAEC,IAAI,EAA6B;IACvD,MAAMC,cAAcC,QAAQF,KAAK,OAAO,KAAK,CAACA,KAAK,OAAO;IAC1D,MAAMG,QAAQH,KAAK,KAAK,IAAIA,KAAK,KAAK;IAEtC,MAAMI,UAAU,WAAVA,GACF,oBAAC;QAAK,WAAU;OACXJ,KAAK,IAAI,GAAGN,YAAYM,KAAK,IAAI,IAAI,MACrCA,KAAK,KAAK,GAAG,WAAH,GAAG,oBAAC;QAAK,WAAWR;OAAoBQ,KAAK,KAAK,IAAW;IAKhF,IAAI,CAACC,aACD,OAAO,WAAP,GACI,oBAAC;QACG,gBAAcD,KAAK,OAAO,GAAG,SAASK;QACtC,OAAOF;QACP,WAAWL,GACP,6CACAE,KAAK,OAAO,GAAG,yBAAyB;OAG3CI;IAKb,OAAO,WAAP,GACI,oBAAC;QACG,MAAK;QACL,SAASJ,KAAK,OAAO;QACrB,OAAOG;QACP,WAAWL,GACP,6CACA,wCACA,sDACA;OAGHM;AAGb;AAEA,MAAME,sBAAsB,IACjB,WAAP,GACI,oBAAC;QAAK,eAAY;QAAO,WAAU;qBAC/B,oBAACC,yCAAaA;QAAC,WAAWd;;AAKtC,MAAMe,kBAAkB,CAAC,EAAEC,KAAK,EAAEC,SAAS,EAAE,GAAGC,OAAyB;IACrE,IAAIF,AAAiB,MAAjBA,MAAM,MAAM,EACZ,OAAO;IAGX,OAAO,WAAP,GACI,oBAAC;QAAI,cAAW;QAAa,WAAWX,GAAG,qBAAqBY;QAAa,GAAGC,KAAK;qBACjF,oBAAC;QAAG,WAAU;OACTF,MAAM,GAAG,CAAC,CAACT,MAAMY;QAEd,MAAMC,MAAM,GAAGb,KAAK,KAAK,IAAI,OAAO,CAAC,EAAEY,OAAO;QAC9C,OAAO,WAAP,GACI,oBAAC;YAAG,KAAKC;YAAK,WAAU;WACnBD,QAAQ,IAAI,WAAJ,GAAI,oBAACN,qBAAmBA,QAAM,oBACvC,oBAACP,gBAAcA;YAAC,MAAMC;;IAGlC;AAIhB;AAEA,MAAMc,cAAcC,gBAAgB,eAAeP;AAK5C,MAAMQ,2BAA2B,CAACC,UAA2C;QAChF,MAAM,WAAN,GAAM,oBAACC,gBAAQA;QACf,OAAO;QACPD;IACJ"}
1
+ {"version":3,"file":"Breadcrumbs/Breadcrumbs.js","sources":["../../src/Breadcrumbs/Breadcrumbs.tsx"],"sourcesContent":["import React from \"react\";\nimport { ReactComponent as HomeIcon } from \"@webiny/icons/home.svg\";\nimport { ReactComponent as SeparatorIcon } from \"@webiny/icons/keyboard_arrow_right.svg\";\nimport { cn } from \"~/utils.js\";\nimport { makeDecoratable } from \"~/utils.js\";\n\nexport interface BreadcrumbsItem {\n /**\n * Text label of the breadcrumb. Omitted for the leading home item, which is icon-only.\n */\n label?: string;\n /**\n * Leading icon. Used by the home item; other items typically render text only. Sized and\n * colored by the breadcrumb — pass the raw icon component (e.g. `<HomeIcon />`).\n */\n icon?: React.ReactNode;\n /**\n * Full, untruncated text used as the item's `title` (native tooltip). Defaults to `label`.\n */\n title?: string;\n /**\n * Navigates when the item is activated. Omitted (or on the current item) renders a\n * non-interactive item.\n */\n onClick?: () => void;\n /**\n * Marks the current location — the last item in the trail. Rendered with stronger text\n * and never interactive, per the design system's breadcrumb guidelines.\n */\n current?: boolean;\n}\n\nexport interface BreadcrumbsProps extends React.HTMLAttributes<HTMLElement> {\n items: BreadcrumbsItem[];\n}\n\nconst itemTextClassName = \"block max-w-[150px] truncate text-sm tracking-normal whitespace-nowrap\";\n\n// The material glyphs default their `fill` to `currentColor`, so the surrounding text color\n// (muted / primary / hover) drives the icon color too.\nconst glyphClassName = \"size-md shrink-0 fill-current\";\n\nconst renderGlyph = (icon: React.ReactNode) => {\n if (!React.isValidElement(icon)) {\n return icon;\n }\n const element = icon as React.ReactElement<{ className?: string }>;\n return React.cloneElement(element, {\n className: cn(glyphClassName, element.props.className)\n });\n};\n\nconst BreadcrumbItem = ({ item }: { item: BreadcrumbsItem }) => {\n const interactive = Boolean(item.onClick) && !item.current;\n const title = item.title ?? item.label;\n\n const content = (\n <span className=\"flex items-center gap-xs\">\n {item.icon ? renderGlyph(item.icon) : null}\n {item.label ? <span className={itemTextClassName}>{item.label}</span> : null}\n </span>\n );\n\n // The current (active) item and any item without an action render as plain text.\n if (!interactive) {\n return (\n <span\n aria-current={item.current ? \"page\" : undefined}\n title={title}\n className={cn(\n \"flex items-center rounded-sm px-xs py-xxs\",\n item.current ? \"text-neutral-primary\" : \"text-neutral-muted\"\n )}\n >\n {content}\n </span>\n );\n }\n\n return (\n <button\n type=\"button\"\n onClick={item.onClick}\n title={title}\n className={cn(\n \"flex items-center rounded-sm px-xs py-xxs\",\n \"cursor-pointer text-neutral-muted transition-colors\",\n \"hover:bg-neutral-dimmed hover:text-neutral-primary\",\n \"focus-visible:outline-none focus-visible:ring-md focus-visible:ring-primary-dimmed\"\n )}\n >\n {content}\n </button>\n );\n};\n\nconst BreadcrumbSeparator = () => {\n return (\n <span aria-hidden=\"true\" className=\"flex items-center text-neutral-muted\">\n <SeparatorIcon className={glyphClassName} />\n </span>\n );\n};\n\nconst BreadcrumbsBase = ({ items, className, ...props }: BreadcrumbsProps) => {\n if (items.length === 0) {\n return null;\n }\n\n return (\n <nav aria-label=\"Breadcrumb\" className={cn(\"flex items-center\", className)} {...props}>\n <ol className=\"flex items-center gap-none\">\n {items.map((item, index) => {\n // A stable-enough key: labels are unique within a trail; index breaks ties.\n const key = `${item.label ?? \"home\"}-${index}`;\n return (\n <li key={key} className=\"flex items-center\">\n {index > 0 ? <BreadcrumbSeparator /> : null}\n <BreadcrumbItem item={item} />\n </li>\n );\n })}\n </ol>\n </nav>\n );\n};\n\nconst Breadcrumbs = makeDecoratable(\"Breadcrumbs\", BreadcrumbsBase);\n\n/**\n * Convenience factory for the leading, icon-only home entry.\n */\nexport const createHomeBreadcrumbItem = (onClick?: () => void): BreadcrumbsItem => ({\n icon: <HomeIcon />,\n title: \"Home\",\n onClick\n});\n\nexport { Breadcrumbs };\n"],"names":["itemTextClassName","glyphClassName","renderGlyph","icon","React","element","cn","BreadcrumbItem","item","interactive","Boolean","title","content","undefined","BreadcrumbSeparator","SeparatorIcon","BreadcrumbsBase","items","className","props","index","key","Breadcrumbs","makeDecoratable","createHomeBreadcrumbItem","onClick","HomeIcon"],"mappings":";;;;AAoCA,MAAMA,oBAAoB;AAI1B,MAAMC,iBAAiB;AAEvB,MAAMC,cAAc,CAACC;IACjB,IAAI,CAAC,WAAD,GAACC,MAAAA,cAAoB,CAACD,OACtB,OAAOA;IAEX,MAAME,UAAUF;IAChB,OAAO,WAAP,GAAOC,MAAAA,YAAkB,CAACC,SAAS;QAC/B,WAAWC,GAAGL,gBAAgBI,QAAQ,KAAK,CAAC,SAAS;IACzD;AACJ;AAEA,MAAME,iBAAiB,CAAC,EAAEC,IAAI,EAA6B;IACvD,MAAMC,cAAcC,QAAQF,KAAK,OAAO,KAAK,CAACA,KAAK,OAAO;IAC1D,MAAMG,QAAQH,KAAK,KAAK,IAAIA,KAAK,KAAK;IAEtC,MAAMI,UAAU,WAAVA,GACF,oBAAC;QAAK,WAAU;OACXJ,KAAK,IAAI,GAAGN,YAAYM,KAAK,IAAI,IAAI,MACrCA,KAAK,KAAK,GAAG,WAAH,GAAG,oBAAC;QAAK,WAAWR;OAAoBQ,KAAK,KAAK,IAAW;IAKhF,IAAI,CAACC,aACD,OAAO,WAAP,GACI,oBAAC;QACG,gBAAcD,KAAK,OAAO,GAAG,SAASK;QACtC,OAAOF;QACP,WAAWL,GACP,6CACAE,KAAK,OAAO,GAAG,yBAAyB;OAG3CI;IAKb,OAAO,WAAP,GACI,oBAAC;QACG,MAAK;QACL,SAASJ,KAAK,OAAO;QACrB,OAAOG;QACP,WAAWL,GACP,6CACA,uDACA,sDACA;OAGHM;AAGb;AAEA,MAAME,sBAAsB,IACjB,WAAP,GACI,oBAAC;QAAK,eAAY;QAAO,WAAU;qBAC/B,oBAACC,yCAAaA;QAAC,WAAWd;;AAKtC,MAAMe,kBAAkB,CAAC,EAAEC,KAAK,EAAEC,SAAS,EAAE,GAAGC,OAAyB;IACrE,IAAIF,AAAiB,MAAjBA,MAAM,MAAM,EACZ,OAAO;IAGX,OAAO,WAAP,GACI,oBAAC;QAAI,cAAW;QAAa,WAAWX,GAAG,qBAAqBY;QAAa,GAAGC,KAAK;qBACjF,oBAAC;QAAG,WAAU;OACTF,MAAM,GAAG,CAAC,CAACT,MAAMY;QAEd,MAAMC,MAAM,GAAGb,KAAK,KAAK,IAAI,OAAO,CAAC,EAAEY,OAAO;QAC9C,OAAO,WAAP,GACI,oBAAC;YAAG,KAAKC;YAAK,WAAU;WACnBD,QAAQ,IAAI,WAAJ,GAAI,oBAACN,qBAAmBA,QAAM,oBACvC,oBAACP,gBAAcA;YAAC,MAAMC;;IAGlC;AAIhB;AAEA,MAAMc,cAAcC,gBAAgB,eAAeP;AAK5C,MAAMQ,2BAA2B,CAACC,UAA2C;QAChF,MAAM,WAAN,GAAM,oBAACC,gBAAQA;QACf,OAAO;QACPD;IACJ"}
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import { type VariantProps } from "../utils.js";
3
3
  declare const buttonVariants: (props?: ({
4
- variant?: "ghost" | "ghost-negative" | "primary" | "secondary" | "tertiary" | null | undefined;
4
+ variant?: "destructive" | "ghost" | "ghost-negative" | "link" | "primary" | "secondary" | "tertiary" | null | undefined;
5
5
  size?: "lg" | "md" | "sm" | "xl" | null | undefined;
6
6
  contentLayout?: "icon" | "text" | "text-icon-end" | "text-icon-start" | null | undefined;
7
7
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
package/Button/Button.js CHANGED
@@ -22,6 +22,13 @@ const buttonVariants = cva([
22
22
  "aria-disabled:bg-primary-disabled",
23
23
  "focus-visible:ring-lg focus-visible:ring-primary-dimmed"
24
24
  ],
25
+ destructive: [
26
+ "bg-destructive text-neutral-light fill-neutral-base",
27
+ "hover:bg-destructive-strong",
28
+ "active:bg-destructive-xstrong",
29
+ "aria-disabled:bg-destructive-disabled",
30
+ "focus-visible:ring-lg focus-visible:ring-destructive-subtle"
31
+ ],
25
32
  secondary: [
26
33
  "bg-neutral-dimmed text-neutral-strong fill-neutral-xstrong",
27
34
  "hover:bg-neutral-muted",
@@ -48,6 +55,13 @@ const buttonVariants = cva([
48
55
  "active:bg-neutral-base/30",
49
56
  "aria-disabled:text-neutral-disabled aria-disabled:fill-neutral-base/50",
50
57
  "focus-visible:border-neutral-base!"
58
+ ],
59
+ link: [
60
+ "bg-transparent text-accent-primary fill-accent-default",
61
+ "p-0! border-0! rounded-xs",
62
+ "hover:underline!",
63
+ "aria-disabled:text-neutral-disabled aria-disabled:fill-neutral-strong",
64
+ "focus-visible:ring-lg focus-visible:ring-primary-dimmed"
51
65
  ]
52
66
  },
53
67
  size: {
@@ -1 +1 @@
1
- {"version":3,"file":"Button/Button.js","sources":["../../src/Button/Button.tsx"],"sourcesContent":["import React, { useMemo } from \"react\";\nimport { Slot } from \"radix-ui\";\nimport { cn, cva, type VariantProps, makeDecoratable } from \"~/utils.js\";\n\nconst buttonWrapperVariants = cva(\"inline-block\", {\n variants: {\n disabled: {\n true: \"cursor-not-allowed\"\n }\n }\n});\n\nconst buttonVariants = cva(\n [\n \"border-transparent rounded font-sans inline-flex items-center justify-center whitespace-nowrap ring-offset-background transition-colors no-underline! cursor-pointer\",\n \"aria-disabled:pointer-events-none\",\n \"focus-visible:outline-none focus-visible:border-accent-default\"\n ],\n {\n variants: {\n variant: {\n primary: [\n \"bg-primary text-neutral-light fill-neutral-base\",\n \"hover:bg-primary-strong\",\n \"active:bg-primary-xstrong\",\n \"aria-disabled:bg-primary-disabled\",\n \"focus-visible:ring-lg focus-visible:ring-primary-dimmed\"\n ],\n secondary: [\n \"bg-neutral-dimmed text-neutral-strong fill-neutral-xstrong\",\n \"hover:bg-neutral-muted\",\n \"active:bg-neutral-strong\",\n \"aria-disabled:bg-neutral-disabled aria-disabled:text-neutral-disabled aria-disabled:fill-neutral-strong\",\n \"focus-visible:ring-lg focus-visible:ring-primary-dimmed\"\n ],\n tertiary: [\n \"bg-neutral-base text-neutral-strong border-neutral-muted fill-neutral-xstrong\",\n \"hover:bg-neutral-light\",\n \"active:bg-neutral-muted\",\n \"aria-disabled:bg-neutral-disabled aria-disabled:border-neutral-dimmed aria-disabled:text-neutral-disabled aria-disabled:fill-neutral-strong\",\n \"focus-visible:ring-lg focus-visible:ring-primary-dimmed\"\n ],\n ghost: [\n \"bg-transparent text-neutral-strong fill-neutral-xstrong\",\n \"hover:bg-neutral-dimmed\",\n \"active:bg-neutral-muted\",\n \"aria-disabled:text-neutral-disabled aria-disabled:fill-neutral-strong\"\n ],\n \"ghost-negative\": [\n \"bg-transparent text-neutral-light fill-neutral-base\",\n \"hover:bg-neutral-base/20\",\n \"active:bg-neutral-base/30\",\n \"aria-disabled:text-neutral-disabled aria-disabled:fill-neutral-base/50\",\n \"focus-visible:border-neutral-base!\"\n ]\n },\n size: {\n sm: [\n \"text-sm border-sm rounded-sm [&>svg]:size-md\",\n \"py-[calc(var(--padding-xs)-(var(--border-width-sm)))] px-[calc(var(--padding-sm)-(var(--border-width-sm)))]\"\n ],\n md: [\n \"text-md border-sm rounded-md [&>svg]:size-md\",\n \"py-[calc(var(--padding-xs-plus)-(var(--border-width-sm)))] px-[calc(var(--padding-sm-extra)-(var(--border-width-sm)))]\"\n ],\n lg: [\n \"text-md border-sm rounded-md [&>svg]:size-md-plus\",\n \"py-[calc(var(--padding-sm-plus)-(var(--border-width-sm)))] px-[calc(var(--padding-md)-(var(--border-width-sm)))]\"\n ],\n xl: [\n \"text-lg font-semibold border-lg rounded-md [&>svg]:size-lg\",\n \"py-[calc(theme(padding.md-plus)-(var(--border-width-md)))] px-[calc(var(--padding-md)-(var(--border-width-md)))]\"\n ]\n },\n contentLayout: {\n text: \"\",\n icon: \"\",\n \"text-icon-start\": \"\",\n \"text-icon-end\": \"\"\n }\n },\n compoundVariants: [\n {\n size: \"xl\",\n variant: \"ghost\",\n className: \"focus-visible:border-md\"\n },\n {\n size: \"sm\",\n contentLayout: \"icon\",\n className: \"p-[calc(var(--padding-xs)-(var(--border-width-sm)))]\"\n },\n {\n size: \"sm\",\n contentLayout: \"text-icon-start\",\n className: \"pl-[calc(var(--padding-xs)-(var(--border-width-sm)))] [&>svg]:mr-xs\"\n },\n {\n size: \"sm\",\n contentLayout: \"text-icon-end\",\n className: \"pr-[calc(var(--padding-xs)-(var(--border-width-sm)))] [&>svg]:ml-xs\"\n },\n {\n size: \"md\",\n contentLayout: \"icon\",\n className: \"p-[calc(var(--padding-sm)-(var(--border-width-sm)))]\"\n },\n {\n size: \"md\",\n contentLayout: \"text-icon-start\",\n className:\n \"pl-[calc(var(--padding-xs-plus)-(var(--border-width-sm)))] [&>svg]:mr-xs\"\n },\n {\n size: \"md\",\n contentLayout: \"text-icon-end\",\n className:\n \"pr-[calc(var(--padding-xs-plus)-(var(--border-width-sm)))] [&>svg]:ml-xs\"\n },\n {\n size: \"lg\",\n contentLayout: \"icon\",\n className: \"p-[calc(var(--padding-sm-plus)-(var(--border-width-sm)))]\"\n },\n {\n size: \"lg\",\n contentLayout: \"text-icon-start\",\n className:\n \"pl-[calc(var(--padding-sm-extra)-(var(--border-width-sm)))] [&>svg]:mr-xs-plus\"\n },\n {\n size: \"lg\",\n contentLayout: \"text-icon-end\",\n className:\n \"pr-[calc(var(--padding-sm-extra)-(var(--border-width-sm)))] [&>svg]:ml-xs-plus\"\n },\n {\n size: \"xl\",\n contentLayout: \"icon\",\n className: \"p-[calc(var(--padding-md)-(var(--border-width-md)))]\"\n },\n {\n size: \"xl\",\n contentLayout: \"text-icon-start\",\n className:\n \"pl-[calc(var(--padding-sm-extra)-(var(--border-width-md)))] [&>svg]:mr-sm\"\n },\n {\n size: \"xl\",\n contentLayout: \"text-icon-end\",\n className:\n \"pr-[calc(var(--padding-sm-extra)-(var(--border-width-md)))] [&>svg]:ml-sm\"\n }\n ],\n defaultVariants: {\n variant: \"primary\",\n size: \"md\"\n }\n }\n);\n\ninterface ButtonProps\n extends\n Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, \"children\">,\n VariantProps<typeof buttonVariants> {\n text?: React.ReactNode;\n children?: React.ReactNode;\n\n icon?: React.ReactNode;\n\n iconPosition?: \"start\" | \"end\";\n\n asChild?: boolean;\n\n containerClassName?: string;\n}\n\ntype ContentLayout = \"text\" | \"icon\" | \"text-icon-start\" | \"text-icon-end\";\n\nconst ButtonBase = ({\n className,\n variant,\n size,\n asChild = false,\n text,\n children,\n icon,\n iconPosition = \"start\",\n disabled,\n containerClassName,\n ...rest\n}: ButtonProps) => {\n const Comp = asChild ? Slot.Root : \"button\";\n\n const contentLayout = useMemo<ContentLayout>(() => {\n if (!text && !children) {\n return \"icon\";\n }\n\n if (!icon) {\n return \"text\";\n }\n\n return `text-icon-${iconPosition}` as ContentLayout;\n }, [text, children, icon, iconPosition]);\n\n const cssClasses = cn(\n buttonVariants({\n variant,\n size,\n contentLayout\n }),\n className\n );\n\n return (\n <span className={cn(buttonWrapperVariants({ disabled }), containerClassName)}>\n <Comp className={cssClasses} disabled={disabled} aria-disabled={disabled} {...rest}>\n {iconPosition !== \"end\" && icon}\n <Slot.Slottable>{text || children || null}</Slot.Slottable>\n {iconPosition === \"end\" && icon}\n </Comp>\n </span>\n );\n};\n\nconst Button = makeDecoratable(\"Button\", ButtonBase);\n\nexport { Button, type ButtonProps, buttonVariants };\n"],"names":["buttonWrapperVariants","cva","buttonVariants","ButtonBase","className","variant","size","asChild","text","children","icon","iconPosition","disabled","containerClassName","rest","Comp","Slot","contentLayout","useMemo","cssClasses","cn","Button","makeDecoratable"],"mappings":";;;AAIA,MAAMA,wBAAwBC,IAAI,gBAAgB;IAC9C,UAAU;QACN,UAAU;YACN,MAAM;QACV;IACJ;AACJ;AAEA,MAAMC,iBAAiBD,IACnB;IACI;IACA;IACA;CACH,EACD;IACI,UAAU;QACN,SAAS;YACL,SAAS;gBACL;gBACA;gBACA;gBACA;gBACA;aACH;YACD,WAAW;gBACP;gBACA;gBACA;gBACA;gBACA;aACH;YACD,UAAU;gBACN;gBACA;gBACA;gBACA;gBACA;aACH;YACD,OAAO;gBACH;gBACA;gBACA;gBACA;aACH;YACD,kBAAkB;gBACd;gBACA;gBACA;gBACA;gBACA;aACH;QACL;QACA,MAAM;YACF,IAAI;gBACA;gBACA;aACH;YACD,IAAI;gBACA;gBACA;aACH;YACD,IAAI;gBACA;gBACA;aACH;YACD,IAAI;gBACA;gBACA;aACH;QACL;QACA,eAAe;YACX,MAAM;YACN,MAAM;YACN,mBAAmB;YACnB,iBAAiB;QACrB;IACJ;IACA,kBAAkB;QACd;YACI,MAAM;YACN,SAAS;YACT,WAAW;QACf;QACA;YACI,MAAM;YACN,eAAe;YACf,WAAW;QACf;QACA;YACI,MAAM;YACN,eAAe;YACf,WAAW;QACf;QACA;YACI,MAAM;YACN,eAAe;YACf,WAAW;QACf;QACA;YACI,MAAM;YACN,eAAe;YACf,WAAW;QACf;QACA;YACI,MAAM;YACN,eAAe;YACf,WACI;QACR;QACA;YACI,MAAM;YACN,eAAe;YACf,WACI;QACR;QACA;YACI,MAAM;YACN,eAAe;YACf,WAAW;QACf;QACA;YACI,MAAM;YACN,eAAe;YACf,WACI;QACR;QACA;YACI,MAAM;YACN,eAAe;YACf,WACI;QACR;QACA;YACI,MAAM;YACN,eAAe;YACf,WAAW;QACf;QACA;YACI,MAAM;YACN,eAAe;YACf,WACI;QACR;QACA;YACI,MAAM;YACN,eAAe;YACf,WACI;QACR;KACH;IACD,iBAAiB;QACb,SAAS;QACT,MAAM;IACV;AACJ;AAqBJ,MAAME,aAAa,CAAC,EAChBC,SAAS,EACTC,OAAO,EACPC,IAAI,EACJC,UAAU,KAAK,EACfC,IAAI,EACJC,QAAQ,EACRC,IAAI,EACJC,eAAe,OAAO,EACtBC,QAAQ,EACRC,kBAAkB,EAClB,GAAGC,MACO;IACV,MAAMC,OAAOR,UAAUS,KAAK,IAAI,GAAG;IAEnC,MAAMC,gBAAgBC,QAAuB;QACzC,IAAI,CAACV,QAAQ,CAACC,UACV,OAAO;QAGX,IAAI,CAACC,MACD,OAAO;QAGX,OAAO,CAAC,UAAU,EAAEC,cAAc;IACtC,GAAG;QAACH;QAAMC;QAAUC;QAAMC;KAAa;IAEvC,MAAMQ,aAAaC,GACflB,eAAe;QACXG;QACAC;QACAW;IACJ,IACAb;IAGJ,OAAO,WAAP,GACI,oBAAC;QAAK,WAAWgB,GAAGpB,sBAAsB;YAAEY;QAAS,IAAIC;qBACrD,oBAACE,MAAAA;QAAK,WAAWI;QAAY,UAAUP;QAAU,iBAAeA;QAAW,GAAGE,IAAI;OAC7EH,AAAiB,UAAjBA,gBAA0BD,MAAAA,WAAAA,GAC3B,oBAACM,KAAK,SAAS,QAAER,QAAQC,YAAY,OACpCE,AAAiB,UAAjBA,gBAA0BD;AAI3C;AAEA,MAAMW,SAASC,gBAAgB,UAAUnB"}
1
+ {"version":3,"file":"Button/Button.js","sources":["../../src/Button/Button.tsx"],"sourcesContent":["import React, { useMemo } from \"react\";\nimport { Slot } from \"radix-ui\";\nimport { cn, cva, type VariantProps, makeDecoratable } from \"~/utils.js\";\n\nconst buttonWrapperVariants = cva(\"inline-block\", {\n variants: {\n disabled: {\n true: \"cursor-not-allowed\"\n }\n }\n});\n\nconst buttonVariants = cva(\n [\n \"border-transparent rounded font-sans inline-flex items-center justify-center whitespace-nowrap ring-offset-background transition-colors no-underline! cursor-pointer\",\n \"aria-disabled:pointer-events-none\",\n \"focus-visible:outline-none focus-visible:border-accent-default\"\n ],\n {\n variants: {\n variant: {\n primary: [\n \"bg-primary text-neutral-light fill-neutral-base\",\n \"hover:bg-primary-strong\",\n \"active:bg-primary-xstrong\",\n \"aria-disabled:bg-primary-disabled\",\n \"focus-visible:ring-lg focus-visible:ring-primary-dimmed\"\n ],\n destructive: [\n \"bg-destructive text-neutral-light fill-neutral-base\",\n \"hover:bg-destructive-strong\",\n \"active:bg-destructive-xstrong\",\n \"aria-disabled:bg-destructive-disabled\",\n \"focus-visible:ring-lg focus-visible:ring-destructive-subtle\"\n ],\n secondary: [\n \"bg-neutral-dimmed text-neutral-strong fill-neutral-xstrong\",\n \"hover:bg-neutral-muted\",\n \"active:bg-neutral-strong\",\n \"aria-disabled:bg-neutral-disabled aria-disabled:text-neutral-disabled aria-disabled:fill-neutral-strong\",\n \"focus-visible:ring-lg focus-visible:ring-primary-dimmed\"\n ],\n tertiary: [\n \"bg-neutral-base text-neutral-strong border-neutral-muted fill-neutral-xstrong\",\n \"hover:bg-neutral-light\",\n \"active:bg-neutral-muted\",\n \"aria-disabled:bg-neutral-disabled aria-disabled:border-neutral-dimmed aria-disabled:text-neutral-disabled aria-disabled:fill-neutral-strong\",\n \"focus-visible:ring-lg focus-visible:ring-primary-dimmed\"\n ],\n ghost: [\n \"bg-transparent text-neutral-strong fill-neutral-xstrong\",\n \"hover:bg-neutral-dimmed\",\n \"active:bg-neutral-muted\",\n \"aria-disabled:text-neutral-disabled aria-disabled:fill-neutral-strong\"\n ],\n \"ghost-negative\": [\n \"bg-transparent text-neutral-light fill-neutral-base\",\n \"hover:bg-neutral-base/20\",\n \"active:bg-neutral-base/30\",\n \"aria-disabled:text-neutral-disabled aria-disabled:fill-neutral-base/50\",\n \"focus-visible:border-neutral-base!\"\n ],\n /*\n * An action that reads as a link, e.g. a secondary step in a dialog footer. Styled\n * like the base `a` rule in theme.css. The `!` overrides undo the padding, border\n * and underline rules that every other variant shares.\n */\n link: [\n \"bg-transparent text-accent-primary fill-accent-default\",\n \"p-0! border-0! rounded-xs\",\n \"hover:underline!\",\n \"aria-disabled:text-neutral-disabled aria-disabled:fill-neutral-strong\",\n \"focus-visible:ring-lg focus-visible:ring-primary-dimmed\"\n ]\n },\n size: {\n sm: [\n \"text-sm border-sm rounded-sm [&>svg]:size-md\",\n \"py-[calc(var(--padding-xs)-(var(--border-width-sm)))] px-[calc(var(--padding-sm)-(var(--border-width-sm)))]\"\n ],\n md: [\n \"text-md border-sm rounded-md [&>svg]:size-md\",\n \"py-[calc(var(--padding-xs-plus)-(var(--border-width-sm)))] px-[calc(var(--padding-sm-extra)-(var(--border-width-sm)))]\"\n ],\n lg: [\n \"text-md border-sm rounded-md [&>svg]:size-md-plus\",\n \"py-[calc(var(--padding-sm-plus)-(var(--border-width-sm)))] px-[calc(var(--padding-md)-(var(--border-width-sm)))]\"\n ],\n xl: [\n \"text-lg font-semibold border-lg rounded-md [&>svg]:size-lg\",\n \"py-[calc(theme(padding.md-plus)-(var(--border-width-md)))] px-[calc(var(--padding-md)-(var(--border-width-md)))]\"\n ]\n },\n contentLayout: {\n text: \"\",\n icon: \"\",\n \"text-icon-start\": \"\",\n \"text-icon-end\": \"\"\n }\n },\n compoundVariants: [\n {\n size: \"xl\",\n variant: \"ghost\",\n className: \"focus-visible:border-md\"\n },\n {\n size: \"sm\",\n contentLayout: \"icon\",\n className: \"p-[calc(var(--padding-xs)-(var(--border-width-sm)))]\"\n },\n {\n size: \"sm\",\n contentLayout: \"text-icon-start\",\n className: \"pl-[calc(var(--padding-xs)-(var(--border-width-sm)))] [&>svg]:mr-xs\"\n },\n {\n size: \"sm\",\n contentLayout: \"text-icon-end\",\n className: \"pr-[calc(var(--padding-xs)-(var(--border-width-sm)))] [&>svg]:ml-xs\"\n },\n {\n size: \"md\",\n contentLayout: \"icon\",\n className: \"p-[calc(var(--padding-sm)-(var(--border-width-sm)))]\"\n },\n {\n size: \"md\",\n contentLayout: \"text-icon-start\",\n className:\n \"pl-[calc(var(--padding-xs-plus)-(var(--border-width-sm)))] [&>svg]:mr-xs\"\n },\n {\n size: \"md\",\n contentLayout: \"text-icon-end\",\n className:\n \"pr-[calc(var(--padding-xs-plus)-(var(--border-width-sm)))] [&>svg]:ml-xs\"\n },\n {\n size: \"lg\",\n contentLayout: \"icon\",\n className: \"p-[calc(var(--padding-sm-plus)-(var(--border-width-sm)))]\"\n },\n {\n size: \"lg\",\n contentLayout: \"text-icon-start\",\n className:\n \"pl-[calc(var(--padding-sm-extra)-(var(--border-width-sm)))] [&>svg]:mr-xs-plus\"\n },\n {\n size: \"lg\",\n contentLayout: \"text-icon-end\",\n className:\n \"pr-[calc(var(--padding-sm-extra)-(var(--border-width-sm)))] [&>svg]:ml-xs-plus\"\n },\n {\n size: \"xl\",\n contentLayout: \"icon\",\n className: \"p-[calc(var(--padding-md)-(var(--border-width-md)))]\"\n },\n {\n size: \"xl\",\n contentLayout: \"text-icon-start\",\n className:\n \"pl-[calc(var(--padding-sm-extra)-(var(--border-width-md)))] [&>svg]:mr-sm\"\n },\n {\n size: \"xl\",\n contentLayout: \"text-icon-end\",\n className:\n \"pr-[calc(var(--padding-sm-extra)-(var(--border-width-md)))] [&>svg]:ml-sm\"\n }\n ],\n defaultVariants: {\n variant: \"primary\",\n size: \"md\"\n }\n }\n);\n\ninterface ButtonProps\n extends\n Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, \"children\">,\n VariantProps<typeof buttonVariants> {\n text?: React.ReactNode;\n children?: React.ReactNode;\n\n icon?: React.ReactNode;\n\n iconPosition?: \"start\" | \"end\";\n\n asChild?: boolean;\n\n containerClassName?: string;\n}\n\ntype ContentLayout = \"text\" | \"icon\" | \"text-icon-start\" | \"text-icon-end\";\n\nconst ButtonBase = ({\n className,\n variant,\n size,\n asChild = false,\n text,\n children,\n icon,\n iconPosition = \"start\",\n disabled,\n containerClassName,\n ...rest\n}: ButtonProps) => {\n const Comp = asChild ? Slot.Root : \"button\";\n\n const contentLayout = useMemo<ContentLayout>(() => {\n if (!text && !children) {\n return \"icon\";\n }\n\n if (!icon) {\n return \"text\";\n }\n\n return `text-icon-${iconPosition}` as ContentLayout;\n }, [text, children, icon, iconPosition]);\n\n const cssClasses = cn(\n buttonVariants({\n variant,\n size,\n contentLayout\n }),\n className\n );\n\n return (\n <span className={cn(buttonWrapperVariants({ disabled }), containerClassName)}>\n <Comp className={cssClasses} disabled={disabled} aria-disabled={disabled} {...rest}>\n {iconPosition !== \"end\" && icon}\n <Slot.Slottable>{text || children || null}</Slot.Slottable>\n {iconPosition === \"end\" && icon}\n </Comp>\n </span>\n );\n};\n\nconst Button = makeDecoratable(\"Button\", ButtonBase);\n\nexport { Button, type ButtonProps, buttonVariants };\n"],"names":["buttonWrapperVariants","cva","buttonVariants","ButtonBase","className","variant","size","asChild","text","children","icon","iconPosition","disabled","containerClassName","rest","Comp","Slot","contentLayout","useMemo","cssClasses","cn","Button","makeDecoratable"],"mappings":";;;AAIA,MAAMA,wBAAwBC,IAAI,gBAAgB;IAC9C,UAAU;QACN,UAAU;YACN,MAAM;QACV;IACJ;AACJ;AAEA,MAAMC,iBAAiBD,IACnB;IACI;IACA;IACA;CACH,EACD;IACI,UAAU;QACN,SAAS;YACL,SAAS;gBACL;gBACA;gBACA;gBACA;gBACA;aACH;YACD,aAAa;gBACT;gBACA;gBACA;gBACA;gBACA;aACH;YACD,WAAW;gBACP;gBACA;gBACA;gBACA;gBACA;aACH;YACD,UAAU;gBACN;gBACA;gBACA;gBACA;gBACA;aACH;YACD,OAAO;gBACH;gBACA;gBACA;gBACA;aACH;YACD,kBAAkB;gBACd;gBACA;gBACA;gBACA;gBACA;aACH;YAMD,MAAM;gBACF;gBACA;gBACA;gBACA;gBACA;aACH;QACL;QACA,MAAM;YACF,IAAI;gBACA;gBACA;aACH;YACD,IAAI;gBACA;gBACA;aACH;YACD,IAAI;gBACA;gBACA;aACH;YACD,IAAI;gBACA;gBACA;aACH;QACL;QACA,eAAe;YACX,MAAM;YACN,MAAM;YACN,mBAAmB;YACnB,iBAAiB;QACrB;IACJ;IACA,kBAAkB;QACd;YACI,MAAM;YACN,SAAS;YACT,WAAW;QACf;QACA;YACI,MAAM;YACN,eAAe;YACf,WAAW;QACf;QACA;YACI,MAAM;YACN,eAAe;YACf,WAAW;QACf;QACA;YACI,MAAM;YACN,eAAe;YACf,WAAW;QACf;QACA;YACI,MAAM;YACN,eAAe;YACf,WAAW;QACf;QACA;YACI,MAAM;YACN,eAAe;YACf,WACI;QACR;QACA;YACI,MAAM;YACN,eAAe;YACf,WACI;QACR;QACA;YACI,MAAM;YACN,eAAe;YACf,WAAW;QACf;QACA;YACI,MAAM;YACN,eAAe;YACf,WACI;QACR;QACA;YACI,MAAM;YACN,eAAe;YACf,WACI;QACR;QACA;YACI,MAAM;YACN,eAAe;YACf,WAAW;QACf;QACA;YACI,MAAM;YACN,eAAe;YACf,WACI;QACR;QACA;YACI,MAAM;YACN,eAAe;YACf,WACI;QACR;KACH;IACD,iBAAiB;QACb,SAAS;QACT,MAAM;IACV;AACJ;AAqBJ,MAAME,aAAa,CAAC,EAChBC,SAAS,EACTC,OAAO,EACPC,IAAI,EACJC,UAAU,KAAK,EACfC,IAAI,EACJC,QAAQ,EACRC,IAAI,EACJC,eAAe,OAAO,EACtBC,QAAQ,EACRC,kBAAkB,EAClB,GAAGC,MACO;IACV,MAAMC,OAAOR,UAAUS,KAAK,IAAI,GAAG;IAEnC,MAAMC,gBAAgBC,QAAuB;QACzC,IAAI,CAACV,QAAQ,CAACC,UACV,OAAO;QAGX,IAAI,CAACC,MACD,OAAO;QAGX,OAAO,CAAC,UAAU,EAAEC,cAAc;IACtC,GAAG;QAACH;QAAMC;QAAUC;QAAMC;KAAa;IAEvC,MAAMQ,aAAaC,GACflB,eAAe;QACXG;QACAC;QACAW;IACJ,IACAb;IAGJ,OAAO,WAAP,GACI,oBAAC;QAAK,WAAWgB,GAAGpB,sBAAsB;YAAEY;QAAS,IAAIC;qBACrD,oBAACE,MAAAA;QAAK,WAAWI;QAAY,UAAUP;QAAU,iBAAeA;QAAW,GAAGE,IAAI;OAC7EH,AAAiB,UAAjBA,gBAA0BD,MAAAA,WAAAA,GAC3B,oBAACM,KAAK,SAAS,QAAER,QAAQC,YAAY,OACpCE,AAAiB,UAAjBA,gBAA0BD;AAI3C;AAEA,MAAMW,SAASC,gBAAgB,UAAUnB"}
package/Button/Button.mdx CHANGED
@@ -95,6 +95,19 @@ import { Button } from "@webiny/admin-ui";
95
95
  ` } }
96
96
  />
97
97
 
98
+ ### Link
99
+
100
+ For an action that should read as a link, without navigating anywhere. Use the `Link` component when it does navigate.
101
+
102
+ <Canvas of={ButtonStories.Link}
103
+ source={ { code:
104
+ `// Code for a Link button
105
+ \n import { Button } from '@webiny/admin-ui';
106
+ \n <Button variant="link" text={"Button"}></Button>
107
+
108
+ ` } }
109
+ />
110
+
98
111
  ### With Icon
99
112
 
100
113
  <Canvas of={ButtonStories.WithIcon} story={ {inline: false}}
@@ -8,6 +8,7 @@ export declare const Secondary: Story;
8
8
  export declare const Tertiary: Story;
9
9
  export declare const Ghost: Story;
10
10
  export declare const GhostNegative: Story;
11
+ export declare const Link: Story;
11
12
  export declare const Small: Story;
12
13
  export declare const Medium: Story;
13
14
  export declare const Large: Story;
@@ -10,10 +10,12 @@ const meta = {
10
10
  control: "select",
11
11
  options: [
12
12
  "primary",
13
+ "destructive",
13
14
  "secondary",
14
15
  "tertiary",
15
16
  "ghost",
16
- "ghost-negative"
17
+ "ghost-negative",
18
+ "link"
17
19
  ],
18
20
  defaultValue: "primary"
19
21
  },
@@ -93,6 +95,12 @@ const GhostNegative = {
93
95
  variant: "ghost-negative"
94
96
  }
95
97
  };
98
+ const Link = {
99
+ args: {
100
+ ...Primary.args,
101
+ variant: "link"
102
+ }
103
+ };
96
104
  const Small = {
97
105
  args: {
98
106
  ...Primary.args,
@@ -149,6 +157,6 @@ const Documentation = {
149
157
  }
150
158
  };
151
159
  export default Button_stories;
152
- export { Documentation, ExtraLarge, Ghost, GhostNegative, Large, Medium, Primary, Secondary, Small, Tertiary, WithAsChild, WithIcon, WithIconPositionEnd };
160
+ export { Documentation, ExtraLarge, Ghost, GhostNegative, Large, Link, Medium, Primary, Secondary, Small, Tertiary, WithAsChild, WithIcon, WithIconPositionEnd };
153
161
 
154
162
  //# sourceMappingURL=Button.stories.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Button/Button.stories.js","sources":["../../src/Button/Button.stories.tsx"],"sourcesContent":["import React from \"react\";\nimport type { Meta, StoryObj } from \"@storybook/react\";\nimport { ReactComponent as PencilIcon } from \"@webiny/icons/edit.svg\";\nimport { Button } from \"./Button.js\";\n\n// More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export\nconst meta: Meta<typeof Button> = {\n title: \"Components/Button\",\n component: Button,\n argTypes: {\n variant: {\n description: \"Type\",\n control: \"select\",\n options: [\"primary\", \"secondary\", \"tertiary\", \"ghost\", \"ghost-negative\"],\n defaultValue: \"primary\"\n },\n size: {\n description: \"Size\",\n control: \"select\",\n options: [\"sm\", \"md\", \"lg\", \"xl\"],\n defaultValue: \"md\"\n },\n text: {\n description: \"Label\",\n control: \"text\",\n defaultValue: \"Button\"\n },\n disabled: {\n control: \"boolean\",\n defaultValue: false\n },\n icon: {\n description: \"Please refer to the 'With Icon' button example below for details.\"\n },\n iconPosition: {\n description: \"Please refer to the 'With Icon' button example below for details.\",\n control: \"select\",\n defaultValue: \"start\",\n options: [\"start\", \"end\"]\n },\n asChild: {\n description: \"Please refer to the 'As Child' button example below for details.\"\n },\n // Note: after upgrading to Storybook 8.X, use `fn`from `@storybook/test` to spy on the onClick argument.\n onClick: { action: \"onClick\" }\n }\n};\n\nexport default meta;\ntype Story = StoryObj<typeof Button>;\n\nexport const Primary: Story = {\n args: {\n variant: \"primary\",\n text: \"Button\"\n }\n};\n\nexport const Secondary: Story = {\n args: {\n ...Primary.args,\n variant: \"secondary\"\n }\n};\n\nexport const Tertiary: Story = {\n args: {\n ...Primary.args,\n variant: \"tertiary\"\n }\n};\n\nexport const Ghost: Story = {\n args: {\n ...Primary.args,\n variant: \"ghost\"\n }\n};\n\nexport const GhostNegative: Story = {\n decorators: [\n (Story: any) => (\n <div className=\"bg-[#25292e] p-[50px] rounded-[5px]\">\n <Story />\n </div>\n )\n ],\n args: {\n ...Primary.args,\n variant: \"ghost-negative\"\n }\n};\n\nexport const Small: Story = {\n args: {\n ...Primary.args,\n size: \"sm\"\n }\n};\n\nexport const Medium: Story = {\n args: {\n ...Primary.args,\n size: \"md\"\n }\n};\n\nexport const Large: Story = {\n args: {\n ...Primary.args,\n size: \"lg\"\n }\n};\n\nexport const ExtraLarge: Story = {\n args: {\n ...Primary.args,\n size: \"xl\"\n }\n};\n\nexport const WithIcon: Story = {\n args: {\n ...Primary.args,\n icon: <PencilIcon />\n }\n};\n\nexport const WithIconPositionEnd: Story = {\n args: {\n ...Primary.args,\n icon: <PencilIcon />,\n iconPosition: \"end\"\n }\n};\n\nexport const WithAsChild: Story = {\n args: {\n ...Primary.args,\n asChild: true,\n text: <span>Button</span>\n }\n};\n\n/* The Documentation story is created for the Docs page.\n * The description column for the `iconPosition` and `icon` props displays\n * an extra dash (-), and the formatting breaks unless defined in the story.\n * Hence, this Documentation story was created.\n */\n\nexport const Documentation: Story = {\n args: {\n variant: \"primary\",\n text: \"Button\",\n size: \"md\",\n disabled: false,\n icon: \"\",\n iconPosition: \"start\",\n asChild: false\n }\n};\n"],"names":["meta","Button","Primary","Secondary","Tertiary","Ghost","GhostNegative","Story","Small","Medium","Large","ExtraLarge","WithIcon","PencilIcon","WithIconPositionEnd","WithAsChild","Documentation"],"mappings":";;;AAMA,MAAMA,OAA4B;IAC9B,OAAO;IACP,WAAWC;IACX,UAAU;QACN,SAAS;YACL,aAAa;YACb,SAAS;YACT,SAAS;gBAAC;gBAAW;gBAAa;gBAAY;gBAAS;aAAiB;YACxE,cAAc;QAClB;QACA,MAAM;YACF,aAAa;YACb,SAAS;YACT,SAAS;gBAAC;gBAAM;gBAAM;gBAAM;aAAK;YACjC,cAAc;QAClB;QACA,MAAM;YACF,aAAa;YACb,SAAS;YACT,cAAc;QAClB;QACA,UAAU;YACN,SAAS;YACT,cAAc;QAClB;QACA,MAAM;YACF,aAAa;QACjB;QACA,cAAc;YACV,aAAa;YACb,SAAS;YACT,cAAc;YACd,SAAS;gBAAC;gBAAS;aAAM;QAC7B;QACA,SAAS;YACL,aAAa;QACjB;QAEA,SAAS;YAAE,QAAQ;QAAU;IACjC;AACJ;AAEA,uBAAeD;AAGR,MAAME,UAAiB;IAC1B,MAAM;QACF,SAAS;QACT,MAAM;IACV;AACJ;AAEO,MAAMC,YAAmB;IAC5B,MAAM;QACF,GAAGD,QAAQ,IAAI;QACf,SAAS;IACb;AACJ;AAEO,MAAME,WAAkB;IAC3B,MAAM;QACF,GAAGF,QAAQ,IAAI;QACf,SAAS;IACb;AACJ;AAEO,MAAMG,QAAe;IACxB,MAAM;QACF,GAAGH,QAAQ,IAAI;QACf,SAAS;IACb;AACJ;AAEO,MAAMI,gBAAuB;IAChC,YAAY;QACR,CAACC,QAAAA,WAAAA,GACG,oBAAC;gBAAI,WAAU;6BACX,oBAACA,OAAAA;KAGZ;IACD,MAAM;QACF,GAAGL,QAAQ,IAAI;QACf,SAAS;IACb;AACJ;AAEO,MAAMM,QAAe;IACxB,MAAM;QACF,GAAGN,QAAQ,IAAI;QACf,MAAM;IACV;AACJ;AAEO,MAAMO,SAAgB;IACzB,MAAM;QACF,GAAGP,QAAQ,IAAI;QACf,MAAM;IACV;AACJ;AAEO,MAAMQ,QAAe;IACxB,MAAM;QACF,GAAGR,QAAQ,IAAI;QACf,MAAM;IACV;AACJ;AAEO,MAAMS,aAAoB;IAC7B,MAAM;QACF,GAAGT,QAAQ,IAAI;QACf,MAAM;IACV;AACJ;AAEO,MAAMU,WAAkB;IAC3B,MAAM;QACF,GAAGV,QAAQ,IAAI;QACf,MAAM,WAAN,GAAM,oBAACW,gBAAUA;IACrB;AACJ;AAEO,MAAMC,sBAA6B;IACtC,MAAM;QACF,GAAGZ,QAAQ,IAAI;QACf,MAAM,WAAN,GAAM,oBAACW,gBAAUA;QACjB,cAAc;IAClB;AACJ;AAEO,MAAME,cAAqB;IAC9B,MAAM;QACF,GAAGb,QAAQ,IAAI;QACf,SAAS;QACT,MAAM,WAAN,GAAM,oBAAC,cAAK;IAChB;AACJ;AAQO,MAAMc,gBAAuB;IAChC,MAAM;QACF,SAAS;QACT,MAAM;QACN,MAAM;QACN,UAAU;QACV,MAAM;QACN,cAAc;QACd,SAAS;IACb;AACJ"}
1
+ {"version":3,"file":"Button/Button.stories.js","sources":["../../src/Button/Button.stories.tsx"],"sourcesContent":["import React from \"react\";\nimport type { Meta, StoryObj } from \"@storybook/react\";\nimport { ReactComponent as PencilIcon } from \"@webiny/icons/edit.svg\";\nimport { Button } from \"./Button.js\";\n\n// More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export\nconst meta: Meta<typeof Button> = {\n title: \"Components/Button\",\n component: Button,\n argTypes: {\n variant: {\n description: \"Type\",\n control: \"select\",\n options: [\n \"primary\",\n \"destructive\",\n \"secondary\",\n \"tertiary\",\n \"ghost\",\n \"ghost-negative\",\n \"link\"\n ],\n defaultValue: \"primary\"\n },\n size: {\n description: \"Size\",\n control: \"select\",\n options: [\"sm\", \"md\", \"lg\", \"xl\"],\n defaultValue: \"md\"\n },\n text: {\n description: \"Label\",\n control: \"text\",\n defaultValue: \"Button\"\n },\n disabled: {\n control: \"boolean\",\n defaultValue: false\n },\n icon: {\n description: \"Please refer to the 'With Icon' button example below for details.\"\n },\n iconPosition: {\n description: \"Please refer to the 'With Icon' button example below for details.\",\n control: \"select\",\n defaultValue: \"start\",\n options: [\"start\", \"end\"]\n },\n asChild: {\n description: \"Please refer to the 'As Child' button example below for details.\"\n },\n // Note: after upgrading to Storybook 8.X, use `fn`from `@storybook/test` to spy on the onClick argument.\n onClick: { action: \"onClick\" }\n }\n};\n\nexport default meta;\ntype Story = StoryObj<typeof Button>;\n\nexport const Primary: Story = {\n args: {\n variant: \"primary\",\n text: \"Button\"\n }\n};\n\nexport const Secondary: Story = {\n args: {\n ...Primary.args,\n variant: \"secondary\"\n }\n};\n\nexport const Tertiary: Story = {\n args: {\n ...Primary.args,\n variant: \"tertiary\"\n }\n};\n\nexport const Ghost: Story = {\n args: {\n ...Primary.args,\n variant: \"ghost\"\n }\n};\n\nexport const GhostNegative: Story = {\n decorators: [\n (Story: any) => (\n <div className=\"bg-[#25292e] p-[50px] rounded-[5px]\">\n <Story />\n </div>\n )\n ],\n args: {\n ...Primary.args,\n variant: \"ghost-negative\"\n }\n};\n\nexport const Link: Story = {\n args: {\n ...Primary.args,\n variant: \"link\"\n }\n};\n\nexport const Small: Story = {\n args: {\n ...Primary.args,\n size: \"sm\"\n }\n};\n\nexport const Medium: Story = {\n args: {\n ...Primary.args,\n size: \"md\"\n }\n};\n\nexport const Large: Story = {\n args: {\n ...Primary.args,\n size: \"lg\"\n }\n};\n\nexport const ExtraLarge: Story = {\n args: {\n ...Primary.args,\n size: \"xl\"\n }\n};\n\nexport const WithIcon: Story = {\n args: {\n ...Primary.args,\n icon: <PencilIcon />\n }\n};\n\nexport const WithIconPositionEnd: Story = {\n args: {\n ...Primary.args,\n icon: <PencilIcon />,\n iconPosition: \"end\"\n }\n};\n\nexport const WithAsChild: Story = {\n args: {\n ...Primary.args,\n asChild: true,\n text: <span>Button</span>\n }\n};\n\n/* The Documentation story is created for the Docs page.\n * The description column for the `iconPosition` and `icon` props displays\n * an extra dash (-), and the formatting breaks unless defined in the story.\n * Hence, this Documentation story was created.\n */\n\nexport const Documentation: Story = {\n args: {\n variant: \"primary\",\n text: \"Button\",\n size: \"md\",\n disabled: false,\n icon: \"\",\n iconPosition: \"start\",\n asChild: false\n }\n};\n"],"names":["meta","Button","Primary","Secondary","Tertiary","Ghost","GhostNegative","Story","Link","Small","Medium","Large","ExtraLarge","WithIcon","PencilIcon","WithIconPositionEnd","WithAsChild","Documentation"],"mappings":";;;AAMA,MAAMA,OAA4B;IAC9B,OAAO;IACP,WAAWC;IACX,UAAU;QACN,SAAS;YACL,aAAa;YACb,SAAS;YACT,SAAS;gBACL;gBACA;gBACA;gBACA;gBACA;gBACA;gBACA;aACH;YACD,cAAc;QAClB;QACA,MAAM;YACF,aAAa;YACb,SAAS;YACT,SAAS;gBAAC;gBAAM;gBAAM;gBAAM;aAAK;YACjC,cAAc;QAClB;QACA,MAAM;YACF,aAAa;YACb,SAAS;YACT,cAAc;QAClB;QACA,UAAU;YACN,SAAS;YACT,cAAc;QAClB;QACA,MAAM;YACF,aAAa;QACjB;QACA,cAAc;YACV,aAAa;YACb,SAAS;YACT,cAAc;YACd,SAAS;gBAAC;gBAAS;aAAM;QAC7B;QACA,SAAS;YACL,aAAa;QACjB;QAEA,SAAS;YAAE,QAAQ;QAAU;IACjC;AACJ;AAEA,uBAAeD;AAGR,MAAME,UAAiB;IAC1B,MAAM;QACF,SAAS;QACT,MAAM;IACV;AACJ;AAEO,MAAMC,YAAmB;IAC5B,MAAM;QACF,GAAGD,QAAQ,IAAI;QACf,SAAS;IACb;AACJ;AAEO,MAAME,WAAkB;IAC3B,MAAM;QACF,GAAGF,QAAQ,IAAI;QACf,SAAS;IACb;AACJ;AAEO,MAAMG,QAAe;IACxB,MAAM;QACF,GAAGH,QAAQ,IAAI;QACf,SAAS;IACb;AACJ;AAEO,MAAMI,gBAAuB;IAChC,YAAY;QACR,CAACC,QAAAA,WAAAA,GACG,oBAAC;gBAAI,WAAU;6BACX,oBAACA,OAAAA;KAGZ;IACD,MAAM;QACF,GAAGL,QAAQ,IAAI;QACf,SAAS;IACb;AACJ;AAEO,MAAMM,OAAc;IACvB,MAAM;QACF,GAAGN,QAAQ,IAAI;QACf,SAAS;IACb;AACJ;AAEO,MAAMO,QAAe;IACxB,MAAM;QACF,GAAGP,QAAQ,IAAI;QACf,MAAM;IACV;AACJ;AAEO,MAAMQ,SAAgB;IACzB,MAAM;QACF,GAAGR,QAAQ,IAAI;QACf,MAAM;IACV;AACJ;AAEO,MAAMS,QAAe;IACxB,MAAM;QACF,GAAGT,QAAQ,IAAI;QACf,MAAM;IACV;AACJ;AAEO,MAAMU,aAAoB;IAC7B,MAAM;QACF,GAAGV,QAAQ,IAAI;QACf,MAAM;IACV;AACJ;AAEO,MAAMW,WAAkB;IAC3B,MAAM;QACF,GAAGX,QAAQ,IAAI;QACf,MAAM,WAAN,GAAM,oBAACY,gBAAUA;IACrB;AACJ;AAEO,MAAMC,sBAA6B;IACtC,MAAM;QACF,GAAGb,QAAQ,IAAI;QACf,MAAM,WAAN,GAAM,oBAACY,gBAAUA;QACjB,cAAc;IAClB;AACJ;AAEO,MAAME,cAAqB;IAC9B,MAAM;QACF,GAAGd,QAAQ,IAAI;QACf,SAAS;QACT,MAAM,WAAN,GAAM,oBAAC,cAAK;IAChB;AACJ;AAQO,MAAMe,gBAAuB;IAChC,MAAM;QACF,SAAS;QACT,MAAM;QACN,MAAM;QACN,UAAU;QACV,MAAM;QACN,cAAc;QACd,SAAS;IACb;AACJ"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,28 @@
1
+ import { describe, expect, it } from "vitest";
2
+ import { buttonVariants } from "./Button.js";
3
+ describe("buttonVariants destructive", ()=>{
4
+ it("uses the destructive colours for the normal, hover, active and disabled states", ()=>{
5
+ const tokens = buttonVariants({
6
+ variant: "destructive"
7
+ }).split(" ");
8
+ expect(tokens).toContain("bg-destructive");
9
+ expect(tokens).toContain("hover:bg-destructive-strong");
10
+ expect(tokens).toContain("active:bg-destructive-xstrong");
11
+ expect(tokens).toContain("aria-disabled:bg-destructive-disabled");
12
+ });
13
+ it("shows a destructive focus ring like the other variants", ()=>{
14
+ const tokens = buttonVariants({
15
+ variant: "destructive"
16
+ }).split(" ");
17
+ expect(tokens).toContain("focus-visible:ring-lg");
18
+ expect(tokens).toContain("focus-visible:ring-destructive-subtle");
19
+ });
20
+ it("keeps the primary variant free of destructive colours", ()=>{
21
+ const tokens = buttonVariants({
22
+ variant: "primary"
23
+ }).split(" ");
24
+ expect(tokens).not.toContain("bg-destructive");
25
+ });
26
+ });
27
+
28
+ //# sourceMappingURL=Button.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Button/Button.test.js","sources":["../../src/Button/Button.test.ts"],"sourcesContent":["import { describe } from \"vitest\";\nimport { expect } from \"vitest\";\nimport { it } from \"vitest\";\nimport { buttonVariants } from \"./Button.js\";\n\ndescribe(\"buttonVariants destructive\", () => {\n it(\"uses the destructive colours for the normal, hover, active and disabled states\", () => {\n const tokens = buttonVariants({ variant: \"destructive\" }).split(\" \");\n\n expect(tokens).toContain(\"bg-destructive\");\n expect(tokens).toContain(\"hover:bg-destructive-strong\");\n expect(tokens).toContain(\"active:bg-destructive-xstrong\");\n expect(tokens).toContain(\"aria-disabled:bg-destructive-disabled\");\n });\n\n it(\"shows a destructive focus ring like the other variants\", () => {\n const tokens = buttonVariants({ variant: \"destructive\" }).split(\" \");\n\n expect(tokens).toContain(\"focus-visible:ring-lg\");\n expect(tokens).toContain(\"focus-visible:ring-destructive-subtle\");\n });\n\n it(\"keeps the primary variant free of destructive colours\", () => {\n const tokens = buttonVariants({ variant: \"primary\" }).split(\" \");\n\n expect(tokens).not.toContain(\"bg-destructive\");\n });\n});\n"],"names":["describe","it","tokens","buttonVariants","expect"],"mappings":";;AAKAA,SAAS,8BAA8B;IACnCC,GAAG,kFAAkF;QACjF,MAAMC,SAASC,eAAe;YAAE,SAAS;QAAc,GAAG,KAAK,CAAC;QAEhEC,OAAOF,QAAQ,SAAS,CAAC;QACzBE,OAAOF,QAAQ,SAAS,CAAC;QACzBE,OAAOF,QAAQ,SAAS,CAAC;QACzBE,OAAOF,QAAQ,SAAS,CAAC;IAC7B;IAEAD,GAAG,0DAA0D;QACzD,MAAMC,SAASC,eAAe;YAAE,SAAS;QAAc,GAAG,KAAK,CAAC;QAEhEC,OAAOF,QAAQ,SAAS,CAAC;QACzBE,OAAOF,QAAQ,SAAS,CAAC;IAC7B;IAEAD,GAAG,yDAAyD;QACxD,MAAMC,SAASC,eAAe;YAAE,SAAS;QAAU,GAAG,KAAK,CAAC;QAE5DC,OAAOF,QAAQ,GAAG,CAAC,SAAS,CAAC;IACjC;AACJ"}
@@ -1,4 +1,4 @@
1
- import { makeAutoObservable } from "mobx";
1
+ import { makeAutoObservable, observableRef } from "mobx";
2
2
  import { CheckboxItem } from "../../domains/CheckboxItem.js";
3
3
  import { CheckboxItemMapper } from "../../domains/CheckboxItemMapper.js";
4
4
  class CheckboxPresenter {
@@ -19,7 +19,10 @@ class CheckboxPresenter {
19
19
  this.changeChecked = (checked)=>{
20
20
  this.params?.onCheckedChange(checked);
21
21
  };
22
- makeAutoObservable(this);
22
+ makeAutoObservable(this, {
23
+ params: observableRef,
24
+ item: observableRef
25
+ });
23
26
  }
24
27
  get vm() {
25
28
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"Checkbox/primitives/presenters/CheckboxPresenter.js","sources":["../../../../src/Checkbox/primitives/presenters/CheckboxPresenter.ts"],"sourcesContent":["import { makeAutoObservable } from \"mobx\";\nimport type { CheckboxPrimitiveVm } from \"../CheckboxPrimitive.js\";\nimport { CheckboxItem } from \"~/Checkbox/domains/CheckboxItem.js\";\nimport { type CheckboxItemDto } from \"~/Checkbox/domains/CheckboxItemDto.js\";\nimport { CheckboxItemMapper } from \"~/Checkbox/domains/CheckboxItemMapper.js\";\n\ntype CheckboxPresenterParams = CheckboxItemDto & {\n onCheckedChange: (checked: boolean) => void;\n};\n\ninterface ICheckboxPresenter<TParams extends CheckboxPresenterParams = CheckboxPresenterParams> {\n vm: CheckboxPrimitiveVm;\n init: (params: TParams) => void;\n changeChecked: (checked: boolean) => void;\n}\n\nclass CheckboxPresenter implements ICheckboxPresenter {\n private params?: CheckboxPresenterParams = undefined;\n private item?: CheckboxItem = undefined;\n\n constructor() {\n makeAutoObservable(this);\n }\n\n public init = (params: CheckboxPresenterParams) => {\n this.params = params;\n this.item = CheckboxItem.create({\n id: params.id,\n label: params.label,\n value: params.value,\n checked: params.checked,\n indeterminate: params.indeterminate,\n disabled: params.disabled\n });\n };\n\n get vm() {\n return {\n item: this.item ? CheckboxItemMapper.toFormatted(this.item) : undefined\n };\n }\n\n public changeChecked = (checked: boolean) => {\n this.params?.onCheckedChange(checked);\n };\n}\n\nexport { CheckboxPresenter, type CheckboxPresenterParams, type ICheckboxPresenter };\n"],"names":["CheckboxPresenter","undefined","params","CheckboxItem","checked","makeAutoObservable","CheckboxItemMapper"],"mappings":";;;AAgBA,MAAMA;IAIF,aAAc;aAHN,MAAM,GAA6BC;aACnC,IAAI,GAAkBA;aAMvB,IAAI,GAAG,CAACC;YACX,IAAI,CAAC,MAAM,GAAGA;YACd,IAAI,CAAC,IAAI,GAAGC,aAAa,MAAM,CAAC;gBAC5B,IAAID,OAAO,EAAE;gBACb,OAAOA,OAAO,KAAK;gBACnB,OAAOA,OAAO,KAAK;gBACnB,SAASA,OAAO,OAAO;gBACvB,eAAeA,OAAO,aAAa;gBACnC,UAAUA,OAAO,QAAQ;YAC7B;QACJ;aAQO,aAAa,GAAG,CAACE;YACpB,IAAI,CAAC,MAAM,EAAE,gBAAgBA;QACjC;QAvBIC,mBAAmB,IAAI;IAC3B;IAcA,IAAI,KAAK;QACL,OAAO;YACH,MAAM,IAAI,CAAC,IAAI,GAAGC,mBAAmB,WAAW,CAAC,IAAI,CAAC,IAAI,IAAIL;QAClE;IACJ;AAKJ"}
1
+ {"version":3,"file":"Checkbox/primitives/presenters/CheckboxPresenter.js","sources":["../../../../src/Checkbox/primitives/presenters/CheckboxPresenter.ts"],"sourcesContent":["import { makeAutoObservable } from \"mobx\";\nimport { observableRef } from \"mobx\";\nimport type { CheckboxPrimitiveVm } from \"../CheckboxPrimitive.js\";\nimport { CheckboxItem } from \"~/Checkbox/domains/CheckboxItem.js\";\nimport { type CheckboxItemDto } from \"~/Checkbox/domains/CheckboxItemDto.js\";\nimport { CheckboxItemMapper } from \"~/Checkbox/domains/CheckboxItemMapper.js\";\n\ntype CheckboxPresenterParams = CheckboxItemDto & {\n onCheckedChange: (checked: boolean) => void;\n};\n\ninterface ICheckboxPresenter<TParams extends CheckboxPresenterParams = CheckboxPresenterParams> {\n vm: CheckboxPrimitiveVm;\n init: (params: TParams) => void;\n changeChecked: (checked: boolean) => void;\n}\n\nclass CheckboxPresenter implements ICheckboxPresenter {\n private params?: CheckboxPresenterParams = undefined;\n private item?: CheckboxItem = undefined;\n\n constructor() {\n makeAutoObservable<CheckboxPresenter, \"params\" | \"item\">(this, {\n params: observableRef,\n item: observableRef\n });\n }\n\n public init = (params: CheckboxPresenterParams) => {\n this.params = params;\n this.item = CheckboxItem.create({\n id: params.id,\n label: params.label,\n value: params.value,\n checked: params.checked,\n indeterminate: params.indeterminate,\n disabled: params.disabled\n });\n };\n\n get vm() {\n return {\n item: this.item ? CheckboxItemMapper.toFormatted(this.item) : undefined\n };\n }\n\n public changeChecked = (checked: boolean) => {\n this.params?.onCheckedChange(checked);\n };\n}\n\nexport { CheckboxPresenter, type CheckboxPresenterParams, type ICheckboxPresenter };\n"],"names":["CheckboxPresenter","undefined","params","CheckboxItem","checked","makeAutoObservable","observableRef","CheckboxItemMapper"],"mappings":";;;AAiBA,MAAMA;IAIF,aAAc;aAHN,MAAM,GAA6BC;aACnC,IAAI,GAAkBA;aASvB,IAAI,GAAG,CAACC;YACX,IAAI,CAAC,MAAM,GAAGA;YACd,IAAI,CAAC,IAAI,GAAGC,aAAa,MAAM,CAAC;gBAC5B,IAAID,OAAO,EAAE;gBACb,OAAOA,OAAO,KAAK;gBACnB,OAAOA,OAAO,KAAK;gBACnB,SAASA,OAAO,OAAO;gBACvB,eAAeA,OAAO,aAAa;gBACnC,UAAUA,OAAO,QAAQ;YAC7B;QACJ;aAQO,aAAa,GAAG,CAACE;YACpB,IAAI,CAAC,MAAM,EAAE,gBAAgBA;QACjC;QA1BIC,mBAAyD,IAAI,EAAE;YAC3D,QAAQC;YACR,MAAMA;QACV;IACJ;IAcA,IAAI,KAAK;QACL,OAAO;YACH,MAAM,IAAI,CAAC,IAAI,GAAGC,mBAAmB,WAAW,CAAC,IAAI,CAAC,IAAI,IAAIN;QAClE;IACJ;AAKJ"}
@@ -0,0 +1,61 @@
1
+ import react from "react";
2
+ import { describe, expect, it, vi } from "vitest";
3
+ import { CheckboxPresenter } from "./CheckboxPresenter.js";
4
+ const createCyclicLabel = ()=>{
5
+ const fiber = {
6
+ tag: 0
7
+ };
8
+ fiber.return = fiber;
9
+ fiber.child = fiber;
10
+ const element = react.createElement("span", null, "Card");
11
+ return {
12
+ ...element,
13
+ _owner: fiber
14
+ };
15
+ };
16
+ describe("CheckboxPresenter with a React node label", ()=>{
17
+ it("keeps the label by reference and does not overflow the stack", ()=>{
18
+ const label = createCyclicLabel();
19
+ const presenter = new CheckboxPresenter();
20
+ const init = ()=>{
21
+ presenter.init({
22
+ onCheckedChange: vi.fn(),
23
+ id: "box",
24
+ label,
25
+ checked: true
26
+ });
27
+ };
28
+ expect(init).not.toThrow();
29
+ expect(presenter.vm.item?.label).toBe(label);
30
+ expect(presenter.vm.item?.hasLabel).toBe(true);
31
+ expect(presenter.vm.item?.checked).toBe(true);
32
+ });
33
+ it("still reports a change", ()=>{
34
+ const onCheckedChange = vi.fn();
35
+ const label = createCyclicLabel();
36
+ const presenter = new CheckboxPresenter();
37
+ presenter.init({
38
+ onCheckedChange,
39
+ label
40
+ });
41
+ presenter.changeChecked(true);
42
+ expect(onCheckedChange).toHaveBeenCalledWith(true);
43
+ });
44
+ it("recomputes the item when init is called again", ()=>{
45
+ const label = createCyclicLabel();
46
+ const presenter = new CheckboxPresenter();
47
+ presenter.init({
48
+ onCheckedChange: vi.fn(),
49
+ label,
50
+ checked: false
51
+ });
52
+ presenter.init({
53
+ onCheckedChange: vi.fn(),
54
+ label,
55
+ checked: true
56
+ });
57
+ expect(presenter.vm.item?.checked).toBe(true);
58
+ });
59
+ });
60
+
61
+ //# sourceMappingURL=CheckboxPresenter.jsxLabel.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Checkbox/primitives/presenters/CheckboxPresenter.jsxLabel.test.js","sources":["../../../../src/Checkbox/primitives/presenters/CheckboxPresenter.jsxLabel.test.ts"],"sourcesContent":["import React from \"react\";\nimport { describe } from \"vitest\";\nimport { expect } from \"vitest\";\nimport { it } from \"vitest\";\nimport { vi } from \"vitest\";\nimport { CheckboxPresenter } from \"./CheckboxPresenter.js\";\n\n/*\n * A React element created during a render points at its owner fiber, and a fiber points back at\n * its parent and children. A deep observable walks that whole cycle and overflows the stack.\n */\nconst createCyclicLabel = () => {\n const fiber: Record<string, unknown> = { tag: 0 };\n fiber.return = fiber;\n fiber.child = fiber;\n const element = React.createElement(\"span\", null, \"Card\");\n return { ...element, _owner: fiber };\n};\n\ndescribe(\"CheckboxPresenter with a React node label\", () => {\n it(\"keeps the label by reference and does not overflow the stack\", () => {\n const label = createCyclicLabel();\n const presenter = new CheckboxPresenter();\n\n const init = () => {\n presenter.init({ onCheckedChange: vi.fn(), id: \"box\", label, checked: true });\n };\n\n expect(init).not.toThrow();\n expect(presenter.vm.item?.label).toBe(label);\n expect(presenter.vm.item?.hasLabel).toBe(true);\n expect(presenter.vm.item?.checked).toBe(true);\n });\n\n it(\"still reports a change\", () => {\n const onCheckedChange = vi.fn();\n const label = createCyclicLabel();\n const presenter = new CheckboxPresenter();\n presenter.init({ onCheckedChange, label });\n\n presenter.changeChecked(true);\n\n expect(onCheckedChange).toHaveBeenCalledWith(true);\n });\n\n it(\"recomputes the item when init is called again\", () => {\n const label = createCyclicLabel();\n const presenter = new CheckboxPresenter();\n presenter.init({ onCheckedChange: vi.fn(), label, checked: false });\n presenter.init({ onCheckedChange: vi.fn(), label, checked: true });\n\n expect(presenter.vm.item?.checked).toBe(true);\n });\n});\n"],"names":["createCyclicLabel","fiber","element","React","describe","it","label","presenter","CheckboxPresenter","init","vi","expect","onCheckedChange"],"mappings":";;;AAWA,MAAMA,oBAAoB;IACtB,MAAMC,QAAiC;QAAE,KAAK;IAAE;IAChDA,MAAM,MAAM,GAAGA;IACfA,MAAM,KAAK,GAAGA;IACd,MAAMC,UAAUC,MAAAA,aAAmB,CAAC,QAAQ,MAAM;IAClD,OAAO;QAAE,GAAGD,OAAO;QAAE,QAAQD;IAAM;AACvC;AAEAG,SAAS,6CAA6C;IAClDC,GAAG,gEAAgE;QAC/D,MAAMC,QAAQN;QACd,MAAMO,YAAY,IAAIC;QAEtB,MAAMC,OAAO;YACTF,UAAU,IAAI,CAAC;gBAAE,iBAAiBG,GAAG,EAAE;gBAAI,IAAI;gBAAOJ;gBAAO,SAAS;YAAK;QAC/E;QAEAK,OAAOF,MAAM,GAAG,CAAC,OAAO;QACxBE,OAAOJ,UAAU,EAAE,CAAC,IAAI,EAAE,OAAO,IAAI,CAACD;QACtCK,OAAOJ,UAAU,EAAE,CAAC,IAAI,EAAE,UAAU,IAAI,CAAC;QACzCI,OAAOJ,UAAU,EAAE,CAAC,IAAI,EAAE,SAAS,IAAI,CAAC;IAC5C;IAEAF,GAAG,0BAA0B;QACzB,MAAMO,kBAAkBF,GAAG,EAAE;QAC7B,MAAMJ,QAAQN;QACd,MAAMO,YAAY,IAAIC;QACtBD,UAAU,IAAI,CAAC;YAAEK;YAAiBN;QAAM;QAExCC,UAAU,aAAa,CAAC;QAExBI,OAAOC,iBAAiB,oBAAoB,CAAC;IACjD;IAEAP,GAAG,iDAAiD;QAChD,MAAMC,QAAQN;QACd,MAAMO,YAAY,IAAIC;QACtBD,UAAU,IAAI,CAAC;YAAE,iBAAiBG,GAAG,EAAE;YAAIJ;YAAO,SAAS;QAAM;QACjEC,UAAU,IAAI,CAAC;YAAE,iBAAiBG,GAAG,EAAE;YAAIJ;YAAO,SAAS;QAAK;QAEhEK,OAAOJ,UAAU,EAAE,CAAC,IAAI,EAAE,SAAS,IAAI,CAAC;IAC5C;AACJ"}
@@ -1,5 +1,5 @@
1
1
  import react, { useMemo } from "react";
2
- import { makeDecoratable } from "../utils.js";
2
+ import { generateId, makeDecoratable } from "../utils.js";
3
3
  import { CheckboxGroupPrimitive } from "./primitives/CheckboxGroupPrimitive.js";
4
4
  import { FormComponentDescription, FormComponentErrorMessage, FormComponentLabel, FormComponentNote } from "../FormComponent/index.js";
5
5
  const DecoratableCheckboxGroup = ({ label, description, note, required, disabled, hint, validation, ...props })=>{
@@ -7,9 +7,11 @@ const DecoratableCheckboxGroup = ({ label, description, note, required, disabled
7
7
  const invalid = useMemo(()=>false === validationIsValid, [
8
8
  validationIsValid
9
9
  ]);
10
+ const labelId = useMemo(()=>`${generateId()}-label`, []);
10
11
  return /*#__PURE__*/ react.createElement("div", {
11
12
  className: "w-full"
12
13
  }, /*#__PURE__*/ react.createElement(FormComponentLabel, {
14
+ labelId: labelId,
13
15
  text: label,
14
16
  hint: hint,
15
17
  required: required,
@@ -25,6 +27,7 @@ const DecoratableCheckboxGroup = ({ label, description, note, required, disabled
25
27
  disabled: disabled,
26
28
  className: "mt-none mb-xs-plus"
27
29
  }), /*#__PURE__*/ react.createElement(CheckboxGroupPrimitive, {
30
+ "aria-labelledby": labelId,
28
31
  disabled: disabled,
29
32
  ...props
30
33
  }), /*#__PURE__*/ react.createElement(FormComponentNote, {
@@ -1 +1 @@
1
- {"version":3,"file":"CheckboxGroup/CheckboxGroup.js","sources":["../../src/CheckboxGroup/CheckboxGroup.tsx"],"sourcesContent":["import React, { useMemo } from \"react\";\nimport { makeDecoratable } from \"~/utils.js\";\nimport type { CheckboxGroupPrimitiveProps } from \"./primitives/CheckboxGroupPrimitive.js\";\nimport { CheckboxGroupPrimitive } from \"./primitives/CheckboxGroupPrimitive.js\";\nimport type { FormComponentProps } from \"~/FormComponent/index.js\";\nimport {\n FormComponentDescription,\n FormComponentErrorMessage,\n FormComponentLabel,\n FormComponentNote\n} from \"~/FormComponent/index.js\";\n\ntype CheckboxGroupProps = CheckboxGroupPrimitiveProps & FormComponentProps;\n\nconst DecoratableCheckboxGroup = ({\n label,\n description,\n note,\n required,\n disabled,\n hint,\n validation,\n ...props\n}: CheckboxGroupProps) => {\n const { isValid: validationIsValid, message: validationMessage } = validation || {};\n const invalid = useMemo(() => validationIsValid === false, [validationIsValid]);\n\n return (\n <div className={\"w-full\"}>\n <FormComponentLabel\n text={label}\n hint={hint}\n required={required}\n disabled={disabled}\n invalid={invalid}\n />\n <FormComponentDescription\n text={description}\n disabled={disabled}\n className={\"mb-xs-plus\"}\n />\n <FormComponentErrorMessage\n text={validationMessage}\n invalid={invalid}\n disabled={disabled}\n className={\"mt-none mb-xs-plus\"}\n />\n <CheckboxGroupPrimitive disabled={disabled} {...props} />\n <FormComponentNote text={note} disabled={disabled} />\n </div>\n );\n};\nconst CheckboxGroup = makeDecoratable(\"CheckboxGroup\", DecoratableCheckboxGroup);\n\nexport { CheckboxGroup };\n"],"names":["DecoratableCheckboxGroup","label","description","note","required","disabled","hint","validation","props","validationIsValid","validationMessage","invalid","useMemo","FormComponentLabel","FormComponentDescription","FormComponentErrorMessage","CheckboxGroupPrimitive","FormComponentNote","CheckboxGroup","makeDecoratable"],"mappings":";;;;AAcA,MAAMA,2BAA2B,CAAC,EAC9BC,KAAK,EACLC,WAAW,EACXC,IAAI,EACJC,QAAQ,EACRC,QAAQ,EACRC,IAAI,EACJC,UAAU,EACV,GAAGC,OACc;IACjB,MAAM,EAAE,SAASC,iBAAiB,EAAE,SAASC,iBAAiB,EAAE,GAAGH,cAAc,CAAC;IAClF,MAAMI,UAAUC,QAAQ,IAAMH,AAAsB,UAAtBA,mBAA6B;QAACA;KAAkB;IAE9E,OAAO,WAAP,GACI,oBAAC;QAAI,WAAW;qBACZ,oBAACI,oBAAkBA;QACf,MAAMZ;QACN,MAAMK;QACN,UAAUF;QACV,UAAUC;QACV,SAASM;sBAEb,oBAACG,0BAAwBA;QACrB,MAAMZ;QACN,UAAUG;QACV,WAAW;sBAEf,oBAACU,2BAAyBA;QACtB,MAAML;QACN,SAASC;QACT,UAAUN;QACV,WAAW;sBAEf,oBAACW,wBAAsBA;QAAC,UAAUX;QAAW,GAAGG,KAAK;sBACrD,oBAACS,mBAAiBA;QAAC,MAAMd;QAAM,UAAUE;;AAGrD;AACA,MAAMa,gBAAgBC,gBAAgB,iBAAiBnB"}
1
+ {"version":3,"file":"CheckboxGroup/CheckboxGroup.js","sources":["../../src/CheckboxGroup/CheckboxGroup.tsx"],"sourcesContent":["import React, { useMemo } from \"react\";\nimport { makeDecoratable, generateId } from \"~/utils.js\";\nimport type { CheckboxGroupPrimitiveProps } from \"./primitives/CheckboxGroupPrimitive.js\";\nimport { CheckboxGroupPrimitive } from \"./primitives/CheckboxGroupPrimitive.js\";\nimport type { FormComponentProps } from \"~/FormComponent/index.js\";\nimport {\n FormComponentDescription,\n FormComponentErrorMessage,\n FormComponentLabel,\n FormComponentNote\n} from \"~/FormComponent/index.js\";\n\ntype CheckboxGroupProps = CheckboxGroupPrimitiveProps & FormComponentProps;\n\nconst DecoratableCheckboxGroup = ({\n label,\n description,\n note,\n required,\n disabled,\n hint,\n validation,\n ...props\n}: CheckboxGroupProps) => {\n const { isValid: validationIsValid, message: validationMessage } = validation || {};\n const invalid = useMemo(() => validationIsValid === false, [validationIsValid]);\n /* The control can't be a `<label for>` target, so it names itself after the label. */\n const labelId = useMemo(() => `${generateId()}-label`, []);\n\n return (\n <div className={\"w-full\"}>\n <FormComponentLabel\n labelId={labelId}\n text={label}\n hint={hint}\n required={required}\n disabled={disabled}\n invalid={invalid}\n />\n <FormComponentDescription\n text={description}\n disabled={disabled}\n className={\"mb-xs-plus\"}\n />\n <FormComponentErrorMessage\n text={validationMessage}\n invalid={invalid}\n disabled={disabled}\n className={\"mt-none mb-xs-plus\"}\n />\n <CheckboxGroupPrimitive aria-labelledby={labelId} disabled={disabled} {...props} />\n <FormComponentNote text={note} disabled={disabled} />\n </div>\n );\n};\nconst CheckboxGroup = makeDecoratable(\"CheckboxGroup\", DecoratableCheckboxGroup);\n\nexport { CheckboxGroup };\n"],"names":["DecoratableCheckboxGroup","label","description","note","required","disabled","hint","validation","props","validationIsValid","validationMessage","invalid","useMemo","labelId","generateId","FormComponentLabel","FormComponentDescription","FormComponentErrorMessage","CheckboxGroupPrimitive","FormComponentNote","CheckboxGroup","makeDecoratable"],"mappings":";;;;AAcA,MAAMA,2BAA2B,CAAC,EAC9BC,KAAK,EACLC,WAAW,EACXC,IAAI,EACJC,QAAQ,EACRC,QAAQ,EACRC,IAAI,EACJC,UAAU,EACV,GAAGC,OACc;IACjB,MAAM,EAAE,SAASC,iBAAiB,EAAE,SAASC,iBAAiB,EAAE,GAAGH,cAAc,CAAC;IAClF,MAAMI,UAAUC,QAAQ,IAAMH,AAAsB,UAAtBA,mBAA6B;QAACA;KAAkB;IAE9E,MAAMI,UAAUD,QAAQ,IAAM,GAAGE,aAAa,MAAM,CAAC,EAAE,EAAE;IAEzD,OAAO,WAAP,GACI,oBAAC;QAAI,WAAW;qBACZ,oBAACC,oBAAkBA;QACf,SAASF;QACT,MAAMZ;QACN,MAAMK;QACN,UAAUF;QACV,UAAUC;QACV,SAASM;sBAEb,oBAACK,0BAAwBA;QACrB,MAAMd;QACN,UAAUG;QACV,WAAW;sBAEf,oBAACY,2BAAyBA;QACtB,MAAMP;QACN,SAASC;QACT,UAAUN;QACV,WAAW;sBAEf,oBAACa,wBAAsBA;QAAC,mBAAiBL;QAAS,UAAUR;QAAW,GAAGG,KAAK;sBAC/E,oBAACW,mBAAiBA;QAAC,MAAMhB;QAAM,UAAUE;;AAGrD;AACA,MAAMe,gBAAgBC,gBAAgB,iBAAiBrB"}