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

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
@@ -17,6 +17,10 @@ interface CheckboxGroupPrimitiveProps<TValue = any> {
17
17
  * Is checkbox group disabled?
18
18
  */
19
19
  disabled?: boolean;
20
+ /**
21
+ * The id of the label that names the group.
22
+ */
23
+ "aria-labelledby"?: string;
20
24
  }
21
25
  interface CheckboxGroupPrimitiveVm {
22
26
  items: CheckboxItemFormatted[];
@@ -24,11 +28,12 @@ interface CheckboxGroupPrimitiveVm {
24
28
  type CheckboxGroupPrimitiveRendererProps<TValue = any> = CheckboxGroupPrimitiveVm & {
25
29
  changeChecked: (value: TValue) => void;
26
30
  disabled?: boolean;
31
+ "aria-labelledby"?: string;
27
32
  };
28
33
  /**
29
34
  * Checkbox Group Renderer
30
35
  */
31
- declare const DecoratableCheckboxGroupPrimitiveRenderer: ({ items, changeChecked, disabled }: CheckboxGroupPrimitiveRendererProps) => React.JSX.Element;
36
+ declare const DecoratableCheckboxGroupPrimitiveRenderer: ({ items, changeChecked, disabled, "aria-labelledby": labelledBy }: CheckboxGroupPrimitiveRendererProps) => React.JSX.Element;
32
37
  declare const CheckboxGroupPrimitiveRenderer: typeof DecoratableCheckboxGroupPrimitiveRenderer & {
33
38
  original: typeof DecoratableCheckboxGroupPrimitiveRenderer;
34
39
  originalName: string;
@@ -2,7 +2,9 @@ import react from "react";
2
2
  import { cn, makeDecoratable } from "../../utils.js";
3
3
  import { CheckboxPrimitiveRenderer } from "../../Checkbox/index.js";
4
4
  import { useCheckboxGroup } from "./useCheckboxGroup.js";
5
- const DecoratableCheckboxGroupPrimitiveRenderer = ({ items, changeChecked, disabled })=>/*#__PURE__*/ react.createElement("div", {
5
+ const DecoratableCheckboxGroupPrimitiveRenderer = ({ items, changeChecked, disabled, "aria-labelledby": labelledBy })=>/*#__PURE__*/ react.createElement("div", {
6
+ role: "group",
7
+ "aria-labelledby": labelledBy,
6
8
  className: cn("grid gap-sm-extra py-xs-plus")
7
9
  }, items.map((item)=>/*#__PURE__*/ react.createElement(CheckboxPrimitiveRenderer, {
8
10
  key: item.id,
@@ -16,7 +18,8 @@ const DecoratableCheckboxGroupPrimitive = (props)=>{
16
18
  return /*#__PURE__*/ react.createElement(CheckboxGroupPrimitiveRenderer, {
17
19
  ...vm,
18
20
  changeChecked: changeChecked,
19
- disabled: props.disabled
21
+ disabled: props.disabled,
22
+ "aria-labelledby": props["aria-labelledby"]
20
23
  });
21
24
  };
22
25
  const CheckboxGroupPrimitive = makeDecoratable("CheckboxGroupPrimitive", DecoratableCheckboxGroupPrimitive);
@@ -1 +1 @@
1
- {"version":3,"file":"CheckboxGroup/primitives/CheckboxGroupPrimitive.js","sources":["../../../src/CheckboxGroup/primitives/CheckboxGroupPrimitive.tsx"],"sourcesContent":["import React from \"react\";\nimport { cn, makeDecoratable } from \"~/utils.js\";\nimport type { CheckboxItemDto, CheckboxItemFormatted } from \"~/Checkbox/index.js\";\nimport { CheckboxPrimitiveRenderer } from \"~/Checkbox/index.js\";\nimport { useCheckboxGroup } from \"./useCheckboxGroup.js\";\n\ninterface CheckboxGroupPrimitiveProps<TValue = any> {\n /**\n * Array of checkbox items.\n */\n items: CheckboxItemDto[];\n /**\n * Callback function called when the checkbox values change.\n */\n onChange?: (values: TValue[]) => void;\n /**\n * Array of selected checkbox values.\n */\n value?: TValue[];\n /**\n * Is checkbox group disabled?\n */\n disabled?: boolean;\n}\n\ninterface CheckboxGroupPrimitiveVm {\n items: CheckboxItemFormatted[];\n}\n\ntype CheckboxGroupPrimitiveRendererProps<TValue = any> = CheckboxGroupPrimitiveVm & {\n changeChecked: (value: TValue) => void;\n disabled?: boolean;\n};\n\n/**\n * Checkbox Group Renderer\n */\nconst DecoratableCheckboxGroupPrimitiveRenderer = ({\n items,\n changeChecked,\n disabled\n}: CheckboxGroupPrimitiveRendererProps) => {\n return (\n <div className={cn(\"grid gap-sm-extra py-xs-plus\")}>\n {items.map(item => (\n <CheckboxPrimitiveRenderer\n key={item.id}\n {...item}\n disabled={disabled ?? item.disabled}\n changeChecked={() => changeChecked(item.value)}\n />\n ))}\n </div>\n );\n};\nconst CheckboxGroupPrimitiveRenderer = makeDecoratable(\n \"CheckboxGroupPrimitiveRenderer\",\n DecoratableCheckboxGroupPrimitiveRenderer\n);\n\n/**\n * Checkbox Group\n */\nconst DecoratableCheckboxGroupPrimitive = (props: CheckboxGroupPrimitiveProps) => {\n const { vm, changeChecked } = useCheckboxGroup(props);\n return (\n <CheckboxGroupPrimitiveRenderer\n {...vm}\n changeChecked={changeChecked}\n disabled={props.disabled}\n />\n );\n};\nconst CheckboxGroupPrimitive = makeDecoratable(\n \"CheckboxGroupPrimitive\",\n DecoratableCheckboxGroupPrimitive\n);\n\nexport {\n CheckboxGroupPrimitive,\n CheckboxGroupPrimitiveRenderer,\n type CheckboxGroupPrimitiveProps,\n type CheckboxGroupPrimitiveRendererProps,\n type CheckboxGroupPrimitiveVm\n};\n"],"names":["DecoratableCheckboxGroupPrimitiveRenderer","items","changeChecked","disabled","cn","item","CheckboxPrimitiveRenderer","CheckboxGroupPrimitiveRenderer","makeDecoratable","DecoratableCheckboxGroupPrimitive","props","vm","useCheckboxGroup","CheckboxGroupPrimitive"],"mappings":";;;;AAqCA,MAAMA,4CAA4C,CAAC,EAC/CC,KAAK,EACLC,aAAa,EACbC,QAAQ,EAC0B,GAC3B,WAAP,GACI,oBAAC;QAAI,WAAWC,GAAG;OACdH,MAAM,GAAG,CAACI,CAAAA,OAAAA,WAAAA,GACP,oBAACC,2BAAyBA;YACtB,KAAKD,KAAK,EAAE;YACX,GAAGA,IAAI;YACR,UAAUF,YAAYE,KAAK,QAAQ;YACnC,eAAe,IAAMH,cAAcG,KAAK,KAAK;;AAMjE,MAAME,iCAAiCC,gBACnC,kCACAR;AAMJ,MAAMS,oCAAoC,CAACC;IACvC,MAAM,EAAEC,EAAE,EAAET,aAAa,EAAE,GAAGU,iBAAiBF;IAC/C,OAAO,WAAP,GACI,oBAACH,gCAA8BA;QAC1B,GAAGI,EAAE;QACN,eAAeT;QACf,UAAUQ,MAAM,QAAQ;;AAGpC;AACA,MAAMG,yBAAyBL,gBAC3B,0BACAC"}
1
+ {"version":3,"file":"CheckboxGroup/primitives/CheckboxGroupPrimitive.js","sources":["../../../src/CheckboxGroup/primitives/CheckboxGroupPrimitive.tsx"],"sourcesContent":["import React from \"react\";\nimport { cn, makeDecoratable } from \"~/utils.js\";\nimport type { CheckboxItemDto, CheckboxItemFormatted } from \"~/Checkbox/index.js\";\nimport { CheckboxPrimitiveRenderer } from \"~/Checkbox/index.js\";\nimport { useCheckboxGroup } from \"./useCheckboxGroup.js\";\n\ninterface CheckboxGroupPrimitiveProps<TValue = any> {\n /**\n * Array of checkbox items.\n */\n items: CheckboxItemDto[];\n /**\n * Callback function called when the checkbox values change.\n */\n onChange?: (values: TValue[]) => void;\n /**\n * Array of selected checkbox values.\n */\n value?: TValue[];\n /**\n * Is checkbox group disabled?\n */\n disabled?: boolean;\n /**\n * The id of the label that names the group.\n */\n \"aria-labelledby\"?: string;\n}\n\ninterface CheckboxGroupPrimitiveVm {\n items: CheckboxItemFormatted[];\n}\n\ntype CheckboxGroupPrimitiveRendererProps<TValue = any> = CheckboxGroupPrimitiveVm & {\n changeChecked: (value: TValue) => void;\n disabled?: boolean;\n \"aria-labelledby\"?: string;\n};\n\n/**\n * Checkbox Group Renderer\n */\nconst DecoratableCheckboxGroupPrimitiveRenderer = ({\n items,\n changeChecked,\n disabled,\n \"aria-labelledby\": labelledBy\n}: CheckboxGroupPrimitiveRendererProps) => {\n return (\n <div\n role={\"group\"}\n aria-labelledby={labelledBy}\n className={cn(\"grid gap-sm-extra py-xs-plus\")}\n >\n {items.map(item => (\n <CheckboxPrimitiveRenderer\n key={item.id}\n {...item}\n disabled={disabled ?? item.disabled}\n changeChecked={() => changeChecked(item.value)}\n />\n ))}\n </div>\n );\n};\nconst CheckboxGroupPrimitiveRenderer = makeDecoratable(\n \"CheckboxGroupPrimitiveRenderer\",\n DecoratableCheckboxGroupPrimitiveRenderer\n);\n\n/**\n * Checkbox Group\n */\nconst DecoratableCheckboxGroupPrimitive = (props: CheckboxGroupPrimitiveProps) => {\n const { vm, changeChecked } = useCheckboxGroup(props);\n return (\n <CheckboxGroupPrimitiveRenderer\n {...vm}\n changeChecked={changeChecked}\n disabled={props.disabled}\n aria-labelledby={props[\"aria-labelledby\"]}\n />\n );\n};\nconst CheckboxGroupPrimitive = makeDecoratable(\n \"CheckboxGroupPrimitive\",\n DecoratableCheckboxGroupPrimitive\n);\n\nexport {\n CheckboxGroupPrimitive,\n CheckboxGroupPrimitiveRenderer,\n type CheckboxGroupPrimitiveProps,\n type CheckboxGroupPrimitiveRendererProps,\n type CheckboxGroupPrimitiveVm\n};\n"],"names":["DecoratableCheckboxGroupPrimitiveRenderer","items","changeChecked","disabled","labelledBy","cn","item","CheckboxPrimitiveRenderer","CheckboxGroupPrimitiveRenderer","makeDecoratable","DecoratableCheckboxGroupPrimitive","props","vm","useCheckboxGroup","CheckboxGroupPrimitive"],"mappings":";;;;AA0CA,MAAMA,4CAA4C,CAAC,EAC/CC,KAAK,EACLC,aAAa,EACbC,QAAQ,EACR,mBAAmBC,UAAU,EACK,GAC3B,WAAP,GACI,oBAAC;QACG,MAAM;QACN,mBAAiBA;QACjB,WAAWC,GAAG;OAEbJ,MAAM,GAAG,CAACK,CAAAA,OAAAA,WAAAA,GACP,oBAACC,2BAAyBA;YACtB,KAAKD,KAAK,EAAE;YACX,GAAGA,IAAI;YACR,UAAUH,YAAYG,KAAK,QAAQ;YACnC,eAAe,IAAMJ,cAAcI,KAAK,KAAK;;AAMjE,MAAME,iCAAiCC,gBACnC,kCACAT;AAMJ,MAAMU,oCAAoC,CAACC;IACvC,MAAM,EAAEC,EAAE,EAAEV,aAAa,EAAE,GAAGW,iBAAiBF;IAC/C,OAAO,WAAP,GACI,oBAACH,gCAA8BA;QAC1B,GAAGI,EAAE;QACN,eAAeV;QACf,UAAUS,MAAM,QAAQ;QACxB,mBAAiBA,KAAK,CAAC,kBAAkB;;AAGrD;AACA,MAAMG,yBAAyBL,gBAC3B,0BACAC"}
@@ -1,4 +1,4 @@
1
- import { makeAutoObservable } from "mobx";
1
+ import { makeAutoObservable, observableRef } from "mobx";
2
2
  import { CheckboxItem } from "../../../Checkbox/domains/CheckboxItem.js";
3
3
  import { CheckboxItemMapper } from "../../../Checkbox/domains/CheckboxItemMapper.js";
4
4
  class CheckboxGroupPresenter {
@@ -14,7 +14,10 @@ class CheckboxGroupPresenter {
14
14
  this.items = this.getItems(this.params.items, newValues);
15
15
  this.params.onCheckedChange?.(newValues);
16
16
  };
17
- makeAutoObservable(this);
17
+ makeAutoObservable(this, {
18
+ params: observableRef,
19
+ items: observableRef
20
+ });
18
21
  }
19
22
  init(params) {
20
23
  this.params = params;
@@ -1 +1 @@
1
- {"version":3,"file":"CheckboxGroup/primitives/presenters/CheckboxGroupPresenter.js","sources":["../../../../src/CheckboxGroup/primitives/presenters/CheckboxGroupPresenter.ts"],"sourcesContent":["import { makeAutoObservable } from \"mobx\";\nimport type { CheckboxGroupPrimitiveVm } from \"../CheckboxGroupPrimitive.js\";\nimport { CheckboxItem } from \"~/Checkbox/domains/CheckboxItem.js\";\nimport { CheckboxItemMapper } from \"~/Checkbox/domains/CheckboxItemMapper.js\";\nimport type { CheckboxItemDto } from \"~/Checkbox/domains/CheckboxItemDto.js\";\n\ninterface CheckboxGroupPresenterParams<TValue = string | number> {\n items: CheckboxItemDto[];\n values: TValue[];\n onCheckedChange?: (values: TValue[]) => void;\n}\n\ninterface ICheckboxGroupPresenter<TValue = string | number> {\n vm: CheckboxGroupPrimitiveVm;\n init: (params: CheckboxGroupPresenterParams<TValue>) => void;\n changeChecked: (value: TValue) => void;\n}\n\nclass CheckboxGroupPresenter<TValue = string | number> implements ICheckboxGroupPresenter<TValue> {\n private params?: CheckboxGroupPresenterParams<TValue> = undefined;\n private items: CheckboxItem[] = [];\n\n constructor() {\n makeAutoObservable(this);\n }\n\n public init(params: CheckboxGroupPresenterParams<TValue>): void {\n this.params = params;\n this.items = this.getItems(params.items, params.values);\n }\n\n get vm(): CheckboxGroupPrimitiveVm {\n return {\n items: this.items.map(item => CheckboxItemMapper.toFormatted(item))\n };\n }\n\n public changeChecked = (value: TValue) => {\n if (!this.params?.items) {\n return;\n }\n\n const currentValues = [...this.params.values];\n const newValues = this.getUpdatedValues(currentValues, value);\n this.items = this.getItems(this.params.items, newValues);\n this.params.onCheckedChange?.(newValues);\n };\n\n private getUpdatedValues(currentValues: TValue[], value: TValue): TValue[] {\n const index = currentValues.indexOf(value);\n\n if (index > -1) {\n return [...currentValues.slice(0, index), ...currentValues.slice(index + 1)];\n }\n\n return [...currentValues, value];\n }\n\n private getItems(items: CheckboxItemDto[], values: TValue[]): CheckboxItem[] {\n if (!items.length) {\n return [];\n }\n\n return items.map(item =>\n CheckboxItem.create({\n ...item,\n checked: values.some(value => value === item.value)\n })\n );\n }\n}\n\nexport { CheckboxGroupPresenter, type ICheckboxGroupPresenter, type CheckboxGroupPresenterParams };\n"],"names":["CheckboxGroupPresenter","undefined","value","currentValues","newValues","makeAutoObservable","params","item","CheckboxItemMapper","index","items","values","CheckboxItem"],"mappings":";;;AAkBA,MAAMA;IAIF,aAAc;aAHN,MAAM,GAA0CC;aAChD,KAAK,GAAmB,EAAE;aAiB3B,aAAa,GAAG,CAACC;YACpB,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,OACd;YAGJ,MAAMC,gBAAgB;mBAAI,IAAI,CAAC,MAAM,CAAC,MAAM;aAAC;YAC7C,MAAMC,YAAY,IAAI,CAAC,gBAAgB,CAACD,eAAeD;YACvD,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,EAAEE;YAC9C,IAAI,CAAC,MAAM,CAAC,eAAe,GAAGA;QAClC;QAvBIC,mBAAmB,IAAI;IAC3B;IAEO,KAAKC,MAA4C,EAAQ;QAC5D,IAAI,CAAC,MAAM,GAAGA;QACd,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,QAAQ,CAACA,OAAO,KAAK,EAAEA,OAAO,MAAM;IAC1D;IAEA,IAAI,KAA+B;QAC/B,OAAO;YACH,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAACC,CAAAA,OAAQC,mBAAmB,WAAW,CAACD;QACjE;IACJ;IAaQ,iBAAiBJ,aAAuB,EAAED,KAAa,EAAY;QACvE,MAAMO,QAAQN,cAAc,OAAO,CAACD;QAEpC,IAAIO,QAAQ,IACR,OAAO;eAAIN,cAAc,KAAK,CAAC,GAAGM;eAAWN,cAAc,KAAK,CAACM,QAAQ;SAAG;QAGhF,OAAO;eAAIN;YAAeD;SAAM;IACpC;IAEQ,SAASQ,KAAwB,EAAEC,MAAgB,EAAkB;QACzE,IAAI,CAACD,MAAM,MAAM,EACb,OAAO,EAAE;QAGb,OAAOA,MAAM,GAAG,CAACH,CAAAA,OACbK,aAAa,MAAM,CAAC;gBAChB,GAAGL,IAAI;gBACP,SAASI,OAAO,IAAI,CAACT,CAAAA,QAASA,UAAUK,KAAK,KAAK;YACtD;IAER;AACJ"}
1
+ {"version":3,"file":"CheckboxGroup/primitives/presenters/CheckboxGroupPresenter.js","sources":["../../../../src/CheckboxGroup/primitives/presenters/CheckboxGroupPresenter.ts"],"sourcesContent":["import { makeAutoObservable } from \"mobx\";\nimport { observableRef } from \"mobx\";\nimport type { CheckboxGroupPrimitiveVm } from \"../CheckboxGroupPrimitive.js\";\nimport { CheckboxItem } from \"~/Checkbox/domains/CheckboxItem.js\";\nimport { CheckboxItemMapper } from \"~/Checkbox/domains/CheckboxItemMapper.js\";\nimport type { CheckboxItemDto } from \"~/Checkbox/domains/CheckboxItemDto.js\";\n\ninterface CheckboxGroupPresenterParams<TValue = string | number> {\n items: CheckboxItemDto[];\n values: TValue[];\n onCheckedChange?: (values: TValue[]) => void;\n}\n\ninterface ICheckboxGroupPresenter<TValue = string | number> {\n vm: CheckboxGroupPrimitiveVm;\n init: (params: CheckboxGroupPresenterParams<TValue>) => void;\n changeChecked: (value: TValue) => void;\n}\n\nclass CheckboxGroupPresenter<TValue = string | number> implements ICheckboxGroupPresenter<TValue> {\n private params?: CheckboxGroupPresenterParams<TValue> = undefined;\n private items: CheckboxItem[] = [];\n\n constructor() {\n makeAutoObservable<CheckboxGroupPresenter<TValue>, \"params\" | \"items\">(this, {\n params: observableRef,\n items: observableRef\n });\n }\n\n public init(params: CheckboxGroupPresenterParams<TValue>): void {\n this.params = params;\n this.items = this.getItems(params.items, params.values);\n }\n\n get vm(): CheckboxGroupPrimitiveVm {\n return {\n items: this.items.map(item => CheckboxItemMapper.toFormatted(item))\n };\n }\n\n public changeChecked = (value: TValue) => {\n if (!this.params?.items) {\n return;\n }\n\n const currentValues = [...this.params.values];\n const newValues = this.getUpdatedValues(currentValues, value);\n this.items = this.getItems(this.params.items, newValues);\n this.params.onCheckedChange?.(newValues);\n };\n\n private getUpdatedValues(currentValues: TValue[], value: TValue): TValue[] {\n const index = currentValues.indexOf(value);\n\n if (index > -1) {\n return [...currentValues.slice(0, index), ...currentValues.slice(index + 1)];\n }\n\n return [...currentValues, value];\n }\n\n private getItems(items: CheckboxItemDto[], values: TValue[]): CheckboxItem[] {\n if (!items.length) {\n return [];\n }\n\n return items.map(item =>\n CheckboxItem.create({\n ...item,\n checked: values.some(value => value === item.value)\n })\n );\n }\n}\n\nexport { CheckboxGroupPresenter, type ICheckboxGroupPresenter, type CheckboxGroupPresenterParams };\n"],"names":["CheckboxGroupPresenter","undefined","value","currentValues","newValues","makeAutoObservable","observableRef","params","item","CheckboxItemMapper","index","items","values","CheckboxItem"],"mappings":";;;AAmBA,MAAMA;IAIF,aAAc;aAHN,MAAM,GAA0CC;aAChD,KAAK,GAAmB,EAAE;aAoB3B,aAAa,GAAG,CAACC;YACpB,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,OACd;YAGJ,MAAMC,gBAAgB;mBAAI,IAAI,CAAC,MAAM,CAAC,MAAM;aAAC;YAC7C,MAAMC,YAAY,IAAI,CAAC,gBAAgB,CAACD,eAAeD;YACvD,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,EAAEE;YAC9C,IAAI,CAAC,MAAM,CAAC,eAAe,GAAGA;QAClC;QA1BIC,mBAAuE,IAAI,EAAE;YACzE,QAAQC;YACR,OAAOA;QACX;IACJ;IAEO,KAAKC,MAA4C,EAAQ;QAC5D,IAAI,CAAC,MAAM,GAAGA;QACd,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,QAAQ,CAACA,OAAO,KAAK,EAAEA,OAAO,MAAM;IAC1D;IAEA,IAAI,KAA+B;QAC/B,OAAO;YACH,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAACC,CAAAA,OAAQC,mBAAmB,WAAW,CAACD;QACjE;IACJ;IAaQ,iBAAiBL,aAAuB,EAAED,KAAa,EAAY;QACvE,MAAMQ,QAAQP,cAAc,OAAO,CAACD;QAEpC,IAAIQ,QAAQ,IACR,OAAO;eAAIP,cAAc,KAAK,CAAC,GAAGO;eAAWP,cAAc,KAAK,CAACO,QAAQ;SAAG;QAGhF,OAAO;eAAIP;YAAeD;SAAM;IACpC;IAEQ,SAASS,KAAwB,EAAEC,MAAgB,EAAkB;QACzE,IAAI,CAACD,MAAM,MAAM,EACb,OAAO,EAAE;QAGb,OAAOA,MAAM,GAAG,CAACH,CAAAA,OACbK,aAAa,MAAM,CAAC;gBAChB,GAAGL,IAAI;gBACP,SAASI,OAAO,IAAI,CAACV,CAAAA,QAASA,UAAUM,KAAK,KAAK;YACtD;IAER;AACJ"}
@@ -0,0 +1,108 @@
1
+ import react from "react";
2
+ import { describe, expect, it, vi } from "vitest";
3
+ import { CheckboxGroupPresenter } from "./CheckboxGroupPresenter.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("CheckboxGroupPresenter 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 CheckboxGroupPresenter();
20
+ const init = ()=>{
21
+ presenter.init({
22
+ items: [
23
+ {
24
+ value: "a",
25
+ label
26
+ },
27
+ {
28
+ value: "b",
29
+ label: "Plain"
30
+ }
31
+ ],
32
+ values: [
33
+ "a"
34
+ ],
35
+ onCheckedChange: vi.fn()
36
+ });
37
+ };
38
+ const ticked = ()=>presenter.vm.items.map((item)=>item.checked);
39
+ expect(init).not.toThrow();
40
+ expect(ticked()).toEqual([
41
+ true,
42
+ false
43
+ ]);
44
+ expect(presenter.vm.items[0].label).toBe(label);
45
+ });
46
+ it("toggles a value on and reports the next values", ()=>{
47
+ const onCheckedChange = vi.fn();
48
+ const presenter = new CheckboxGroupPresenter();
49
+ presenter.init({
50
+ items: [
51
+ {
52
+ value: "a",
53
+ label: createCyclicLabel()
54
+ },
55
+ {
56
+ value: "b",
57
+ label: createCyclicLabel()
58
+ }
59
+ ],
60
+ values: [
61
+ "a"
62
+ ],
63
+ onCheckedChange
64
+ });
65
+ presenter.changeChecked("b");
66
+ const ticked = presenter.vm.items.map((item)=>item.checked);
67
+ expect(onCheckedChange).toHaveBeenCalledWith([
68
+ "a",
69
+ "b"
70
+ ]);
71
+ expect(ticked).toEqual([
72
+ true,
73
+ true
74
+ ]);
75
+ });
76
+ it("toggles a value off and reports the remaining values", ()=>{
77
+ const onCheckedChange = vi.fn();
78
+ const presenter = new CheckboxGroupPresenter();
79
+ presenter.init({
80
+ items: [
81
+ {
82
+ value: "a",
83
+ label: createCyclicLabel()
84
+ },
85
+ {
86
+ value: "b",
87
+ label: createCyclicLabel()
88
+ }
89
+ ],
90
+ values: [
91
+ "a",
92
+ "b"
93
+ ],
94
+ onCheckedChange
95
+ });
96
+ presenter.changeChecked("a");
97
+ const ticked = presenter.vm.items.map((item)=>item.checked);
98
+ expect(onCheckedChange).toHaveBeenCalledWith([
99
+ "b"
100
+ ]);
101
+ expect(ticked).toEqual([
102
+ false,
103
+ true
104
+ ]);
105
+ });
106
+ });
107
+
108
+ //# sourceMappingURL=CheckboxGroupPresenter.jsxLabel.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CheckboxGroup/primitives/presenters/CheckboxGroupPresenter.jsxLabel.test.js","sources":["../../../../src/CheckboxGroup/primitives/presenters/CheckboxGroupPresenter.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 { CheckboxGroupPresenter } from \"./CheckboxGroupPresenter.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(\"CheckboxGroupPresenter 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 CheckboxGroupPresenter();\n\n const init = () => {\n presenter.init({\n items: [\n { value: \"a\", label },\n { value: \"b\", label: \"Plain\" }\n ],\n values: [\"a\"],\n onCheckedChange: vi.fn()\n });\n };\n\n const ticked = () => presenter.vm.items.map(item => item.checked);\n\n expect(init).not.toThrow();\n expect(ticked()).toEqual([true, false]);\n expect(presenter.vm.items[0].label).toBe(label);\n });\n\n it(\"toggles a value on and reports the next values\", () => {\n const onCheckedChange = vi.fn();\n const presenter = new CheckboxGroupPresenter();\n presenter.init({\n items: [\n { value: \"a\", label: createCyclicLabel() },\n { value: \"b\", label: createCyclicLabel() }\n ],\n values: [\"a\"],\n onCheckedChange\n });\n\n presenter.changeChecked(\"b\");\n\n const ticked = presenter.vm.items.map(item => item.checked);\n expect(onCheckedChange).toHaveBeenCalledWith([\"a\", \"b\"]);\n expect(ticked).toEqual([true, true]);\n });\n\n it(\"toggles a value off and reports the remaining values\", () => {\n const onCheckedChange = vi.fn();\n const presenter = new CheckboxGroupPresenter();\n presenter.init({\n items: [\n { value: \"a\", label: createCyclicLabel() },\n { value: \"b\", label: createCyclicLabel() }\n ],\n values: [\"a\", \"b\"],\n onCheckedChange\n });\n\n presenter.changeChecked(\"a\");\n\n const ticked = presenter.vm.items.map(item => item.checked);\n expect(onCheckedChange).toHaveBeenCalledWith([\"b\"]);\n expect(ticked).toEqual([false, true]);\n });\n});\n"],"names":["createCyclicLabel","fiber","element","React","describe","it","label","presenter","CheckboxGroupPresenter","init","vi","ticked","item","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,kDAAkD;IACvDC,GAAG,gEAAgE;QAC/D,MAAMC,QAAQN;QACd,MAAMO,YAAY,IAAIC;QAEtB,MAAMC,OAAO;YACTF,UAAU,IAAI,CAAC;gBACX,OAAO;oBACH;wBAAE,OAAO;wBAAKD;oBAAM;oBACpB;wBAAE,OAAO;wBAAK,OAAO;oBAAQ;iBAChC;gBACD,QAAQ;oBAAC;iBAAI;gBACb,iBAAiBI,GAAG,EAAE;YAC1B;QACJ;QAEA,MAAMC,SAAS,IAAMJ,UAAU,EAAE,CAAC,KAAK,CAAC,GAAG,CAACK,CAAAA,OAAQA,KAAK,OAAO;QAEhEC,OAAOJ,MAAM,GAAG,CAAC,OAAO;QACxBI,OAAOF,UAAU,OAAO,CAAC;YAAC;YAAM;SAAM;QACtCE,OAAON,UAAU,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,IAAI,CAACD;IAC7C;IAEAD,GAAG,kDAAkD;QACjD,MAAMS,kBAAkBJ,GAAG,EAAE;QAC7B,MAAMH,YAAY,IAAIC;QACtBD,UAAU,IAAI,CAAC;YACX,OAAO;gBACH;oBAAE,OAAO;oBAAK,OAAOP;gBAAoB;gBACzC;oBAAE,OAAO;oBAAK,OAAOA;gBAAoB;aAC5C;YACD,QAAQ;gBAAC;aAAI;YACbc;QACJ;QAEAP,UAAU,aAAa,CAAC;QAExB,MAAMI,SAASJ,UAAU,EAAE,CAAC,KAAK,CAAC,GAAG,CAACK,CAAAA,OAAQA,KAAK,OAAO;QAC1DC,OAAOC,iBAAiB,oBAAoB,CAAC;YAAC;YAAK;SAAI;QACvDD,OAAOF,QAAQ,OAAO,CAAC;YAAC;YAAM;SAAK;IACvC;IAEAN,GAAG,wDAAwD;QACvD,MAAMS,kBAAkBJ,GAAG,EAAE;QAC7B,MAAMH,YAAY,IAAIC;QACtBD,UAAU,IAAI,CAAC;YACX,OAAO;gBACH;oBAAE,OAAO;oBAAK,OAAOP;gBAAoB;gBACzC;oBAAE,OAAO;oBAAK,OAAOA;gBAAoB;aAC5C;YACD,QAAQ;gBAAC;gBAAK;aAAI;YAClBc;QACJ;QAEAP,UAAU,aAAa,CAAC;QAExB,MAAMI,SAASJ,UAAU,EAAE,CAAC,KAAK,CAAC,GAAG,CAACK,CAAAA,OAAQA,KAAK,OAAO;QAC1DC,OAAOC,iBAAiB,oBAAoB,CAAC;YAAC;SAAI;QAClDD,OAAOF,QAAQ,OAAO,CAAC;YAAC;YAAO;SAAK;IACxC;AACJ"}
package/Code/Code.d.ts ADDED
@@ -0,0 +1,29 @@
1
+ import * as React from "react";
2
+ import type { VariantProps } from "../utils.js";
3
+ declare const codeVariants: (props?: ({
4
+ size?: "md" | "sm" | null | undefined;
5
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
6
+ interface CodeProps extends React.HTMLAttributes<HTMLElement>, VariantProps<typeof codeVariants> {
7
+ }
8
+ /** A short piece of code in running text: an API name, a field ID, a GraphQL type or a JSON key. */
9
+ declare const CodeBase: ({ size, className, ...props }: CodeProps) => React.JSX.Element;
10
+ declare const Code: typeof CodeBase & {
11
+ original: typeof CodeBase;
12
+ originalName: string;
13
+ displayName: string;
14
+ } & {
15
+ original: typeof CodeBase & {
16
+ original: typeof CodeBase;
17
+ originalName: string;
18
+ displayName: string;
19
+ };
20
+ originalName: string;
21
+ displayName: string;
22
+ } & {
23
+ createDecorator: (decorator: import("@webiny/react-composition/types").ComponentDecorator<typeof CodeBase & {
24
+ original: typeof CodeBase;
25
+ originalName: string;
26
+ displayName: string;
27
+ }>) => (props: unknown) => React.JSX.Element;
28
+ };
29
+ export { Code, type CodeProps };
package/Code/Code.js ADDED
@@ -0,0 +1,23 @@
1
+ import { cn, cva, makeDecoratable } from "../utils.js";
2
+ import * as __rspack_external_react from "react";
3
+ const codeVariants = cva("rounded-sm bg-neutral-light px-xs py-px font-mono font-normal text-neutral-primary", {
4
+ variants: {
5
+ size: {
6
+ md: "text-[13px] leading-5",
7
+ sm: "text-sm"
8
+ }
9
+ },
10
+ defaultVariants: {
11
+ size: "md"
12
+ }
13
+ });
14
+ const CodeBase = ({ size, className, ...props })=>/*#__PURE__*/ __rspack_external_react.createElement("code", {
15
+ className: cn(codeVariants({
16
+ size
17
+ }), className),
18
+ ...props
19
+ });
20
+ const Code = makeDecoratable("Code", CodeBase);
21
+ export { Code };
22
+
23
+ //# sourceMappingURL=Code.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Code/Code.js","sources":["../../src/Code/Code.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"~/utils.js\";\nimport { cva } from \"~/utils.js\";\nimport { makeDecoratable } from \"~/utils.js\";\nimport type { VariantProps } from \"~/utils.js\";\n\n/*\n * The mono face runs 1px smaller than the Inter text around it, so the two read at the same size:\n * 13px inside `text-md`, 12px inside `text-sm`.\n */\nconst codeVariants = cva(\n \"rounded-sm bg-neutral-light px-xs py-px font-mono font-normal text-neutral-primary\",\n {\n variants: {\n size: {\n md: \"text-[13px] leading-5\",\n sm: \"text-sm\"\n }\n },\n defaultVariants: {\n size: \"md\"\n }\n }\n);\n\ninterface CodeProps extends React.HTMLAttributes<HTMLElement>, VariantProps<typeof codeVariants> {}\n\n/** A short piece of code in running text: an API name, a field ID, a GraphQL type or a JSON key. */\nconst CodeBase = ({ size, className, ...props }: CodeProps) => (\n <code className={cn(codeVariants({ size }), className)} {...props} />\n);\n\nconst Code = makeDecoratable(\"Code\", CodeBase);\n\nexport { Code, type CodeProps };\n"],"names":["codeVariants","cva","CodeBase","size","className","props","cn","Code","makeDecoratable"],"mappings":";;AAUA,MAAMA,eAAeC,IACjB,sFACA;IACI,UAAU;QACN,MAAM;YACF,IAAI;YACJ,IAAI;QACR;IACJ;IACA,iBAAiB;QACb,MAAM;IACV;AACJ;AAMJ,MAAMC,WAAW,CAAC,EAAEC,IAAI,EAAEC,SAAS,EAAE,GAAGC,OAAkB,iBACtD,sCAAC;QAAK,WAAWC,GAAGN,aAAa;YAAEG;QAAK,IAAIC;QAAa,GAAGC,KAAK;;AAGrE,MAAME,OAAOC,gBAAgB,QAAQN"}
@@ -0,0 +1 @@
1
+ export * from "./Code.js";
package/Code/index.js ADDED
@@ -0,0 +1 @@
1
+ export * from "./Code.js";
@@ -20,6 +20,12 @@ const DecoratableCodeEditor = ({ label, description, note, hint, required, disab
20
20
  disabled: disabled
21
21
  }), /*#__PURE__*/ react.createElement(CodeEditorPrimitive, {
22
22
  ...props,
23
+ options: {
24
+ ..."string" == typeof label ? {
25
+ ariaLabel: label
26
+ } : {},
27
+ ...props.options
28
+ },
23
29
  disabled: disabled
24
30
  }), /*#__PURE__*/ react.createElement(FormComponentErrorMessage, {
25
31
  text: validationMessage,
@@ -1 +1 @@
1
- {"version":3,"file":"CodeEditor/CodeEditor.js","sources":["../../src/CodeEditor/CodeEditor.tsx"],"sourcesContent":["import React, { useMemo } from \"react\";\nimport { makeDecoratable } from \"~/utils.js\";\nimport type { CodeEditorPrimitiveProps } from \"./CodeEditorPrimitive.js\";\nimport { CodeEditorPrimitive } from \"./CodeEditorPrimitive.js\";\nimport type { FormComponentProps } from \"~/FormComponent/index.js\";\nimport {\n FormComponentDescription,\n FormComponentErrorMessage,\n FormComponentLabel,\n FormComponentNote\n} from \"~/FormComponent/index.js\";\n\ntype CodeEditorProps = CodeEditorPrimitiveProps & FormComponentProps;\n\nconst DecoratableCodeEditor = ({\n label,\n description,\n note,\n hint,\n required,\n disabled = false,\n validation,\n ...props\n}: CodeEditorProps) => {\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 text={description} disabled={disabled} />\n <CodeEditorPrimitive {...props} disabled={disabled} />\n <FormComponentErrorMessage\n text={validationMessage}\n invalid={invalid}\n disabled={disabled}\n />\n <FormComponentNote text={note} disabled={disabled} />\n </div>\n );\n};\nconst CodeEditor = makeDecoratable(\"CodeEditor\", DecoratableCodeEditor);\n\nexport { CodeEditor, type CodeEditorProps };\n"],"names":["DecoratableCodeEditor","label","description","note","hint","required","disabled","validation","props","validationIsValid","validationMessage","invalid","useMemo","FormComponentLabel","FormComponentDescription","CodeEditorPrimitive","FormComponentErrorMessage","FormComponentNote","CodeEditor","makeDecoratable"],"mappings":";;;;AAcA,MAAMA,wBAAwB,CAAC,EAC3BC,KAAK,EACLC,WAAW,EACXC,IAAI,EACJC,IAAI,EACJC,QAAQ,EACRC,WAAW,KAAK,EAChBC,UAAU,EACV,GAAGC,OACW;IACd,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,MAAMG;QACN,UAAUC;QACV,UAAUC;QACV,SAASK;sBAEb,oBAACG,0BAAwBA;QAAC,MAAMZ;QAAa,UAAUI;sBACvD,oBAACS,qBAAmBA;QAAE,GAAGP,KAAK;QAAE,UAAUF;sBAC1C,oBAACU,2BAAyBA;QACtB,MAAMN;QACN,SAASC;QACT,UAAUL;sBAEd,oBAACW,mBAAiBA;QAAC,MAAMd;QAAM,UAAUG;;AAGrD;AACA,MAAMY,aAAaC,gBAAgB,cAAcnB"}
1
+ {"version":3,"file":"CodeEditor/CodeEditor.js","sources":["../../src/CodeEditor/CodeEditor.tsx"],"sourcesContent":["import React, { useMemo } from \"react\";\nimport { makeDecoratable } from \"~/utils.js\";\nimport type { CodeEditorPrimitiveProps } from \"./CodeEditorPrimitive.js\";\nimport { CodeEditorPrimitive } from \"./CodeEditorPrimitive.js\";\nimport type { FormComponentProps } from \"~/FormComponent/index.js\";\nimport {\n FormComponentDescription,\n FormComponentErrorMessage,\n FormComponentLabel,\n FormComponentNote\n} from \"~/FormComponent/index.js\";\n\ntype CodeEditorProps = CodeEditorPrimitiveProps & FormComponentProps;\n\nconst DecoratableCodeEditor = ({\n label,\n description,\n note,\n hint,\n required,\n disabled = false,\n validation,\n ...props\n}: CodeEditorProps) => {\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 text={description} disabled={disabled} />\n <CodeEditorPrimitive\n {...props}\n /* Monaco names its own textarea (`ariaLabel`); it can't point at the label element. */\n options={{\n ...(typeof label === \"string\" ? { ariaLabel: label } : {}),\n ...props.options\n }}\n disabled={disabled}\n />\n <FormComponentErrorMessage\n text={validationMessage}\n invalid={invalid}\n disabled={disabled}\n />\n <FormComponentNote text={note} disabled={disabled} />\n </div>\n );\n};\nconst CodeEditor = makeDecoratable(\"CodeEditor\", DecoratableCodeEditor);\n\nexport { CodeEditor, type CodeEditorProps };\n"],"names":["DecoratableCodeEditor","label","description","note","hint","required","disabled","validation","props","validationIsValid","validationMessage","invalid","useMemo","FormComponentLabel","FormComponentDescription","CodeEditorPrimitive","FormComponentErrorMessage","FormComponentNote","CodeEditor","makeDecoratable"],"mappings":";;;;AAcA,MAAMA,wBAAwB,CAAC,EAC3BC,KAAK,EACLC,WAAW,EACXC,IAAI,EACJC,IAAI,EACJC,QAAQ,EACRC,WAAW,KAAK,EAChBC,UAAU,EACV,GAAGC,OACW;IACd,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,MAAMG;QACN,UAAUC;QACV,UAAUC;QACV,SAASK;sBAEb,oBAACG,0BAAwBA;QAAC,MAAMZ;QAAa,UAAUI;sBACvD,oBAACS,qBAAmBA;QACf,GAAGP,KAAK;QAET,SAAS;YACL,GAAI,AAAiB,YAAjB,OAAOP,QAAqB;gBAAE,WAAWA;YAAM,IAAI,CAAC,CAAC;YACzD,GAAGO,MAAM,OAAO;QACpB;QACA,UAAUF;sBAEd,oBAACU,2BAAyBA;QACtB,MAAMN;QACN,SAASC;QACT,UAAUL;sBAEd,oBAACW,mBAAiBA;QAAC,MAAMd;QAAM,UAAUG;;AAGrD;AACA,MAAMY,aAAaC,gBAAgB,cAAcnB"}
@@ -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 { ColorPickerPrimitive } from "./primitives/index.js";
4
4
  import { FormComponentDescription, FormComponentErrorMessage, FormComponentLabel, FormComponentNote } from "../FormComponent/index.js";
5
5
  const DecoratableIconPicker = ({ label, description, note, hint, required, disabled, validation, ...props })=>{
@@ -7,9 +7,11 @@ const DecoratableIconPicker = ({ label, description, note, hint, required, disab
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,
@@ -19,6 +21,7 @@ const DecoratableIconPicker = ({ label, description, note, hint, required, disab
19
21
  text: description,
20
22
  disabled: disabled
21
23
  }), /*#__PURE__*/ react.createElement(ColorPickerPrimitive, {
24
+ "aria-labelledby": labelId,
22
25
  ...props,
23
26
  disabled: disabled,
24
27
  invalid: invalid
@@ -1 +1 @@
1
- {"version":3,"file":"ColorPicker/ColorPicker.js","sources":["../../src/ColorPicker/ColorPicker.tsx"],"sourcesContent":["import React, { useMemo } from \"react\";\nimport { makeDecoratable } from \"~/utils.js\";\nimport type { ColorPickerPrimitiveProps } from \"./primitives/index.js\";\nimport { ColorPickerPrimitive } from \"./primitives/index.js\";\nimport type { FormComponentProps } from \"~/FormComponent/index.js\";\nimport {\n FormComponentDescription,\n FormComponentErrorMessage,\n FormComponentLabel,\n FormComponentNote\n} from \"~/FormComponent/index.js\";\n\ntype ColorPickerProps = ColorPickerPrimitiveProps & FormComponentProps;\n\nconst DecoratableIconPicker = ({\n label,\n description,\n note,\n hint,\n required,\n disabled,\n validation,\n ...props\n}: ColorPickerProps) => {\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 text={description} disabled={disabled} />\n <ColorPickerPrimitive {...props} disabled={disabled} invalid={invalid} />\n <FormComponentErrorMessage\n text={validationMessage}\n invalid={invalid}\n disabled={disabled}\n />\n <FormComponentNote text={note} disabled={disabled} />\n </div>\n );\n};\nconst ColorPicker = makeDecoratable(\"ColorPicker\", DecoratableIconPicker);\n\nexport { ColorPicker, type ColorPickerProps };\n"],"names":["DecoratableIconPicker","label","description","note","hint","required","disabled","validation","props","validationIsValid","validationMessage","invalid","useMemo","FormComponentLabel","FormComponentDescription","ColorPickerPrimitive","FormComponentErrorMessage","FormComponentNote","ColorPicker","makeDecoratable"],"mappings":";;;;AAcA,MAAMA,wBAAwB,CAAC,EAC3BC,KAAK,EACLC,WAAW,EACXC,IAAI,EACJC,IAAI,EACJC,QAAQ,EACRC,QAAQ,EACRC,UAAU,EACV,GAAGC,OACY;IACf,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,MAAMG;QACN,UAAUC;QACV,UAAUC;QACV,SAASK;sBAEb,oBAACG,0BAAwBA;QAAC,MAAMZ;QAAa,UAAUI;sBACvD,oBAACS,sBAAoBA;QAAE,GAAGP,KAAK;QAAE,UAAUF;QAAU,SAASK;sBAC9D,oBAACK,2BAAyBA;QACtB,MAAMN;QACN,SAASC;QACT,UAAUL;sBAEd,oBAACW,mBAAiBA;QAAC,MAAMd;QAAM,UAAUG;;AAGrD;AACA,MAAMY,cAAcC,gBAAgB,eAAenB"}
1
+ {"version":3,"file":"ColorPicker/ColorPicker.js","sources":["../../src/ColorPicker/ColorPicker.tsx"],"sourcesContent":["import React, { useMemo } from \"react\";\nimport { makeDecoratable, generateId } from \"~/utils.js\";\nimport type { ColorPickerPrimitiveProps } from \"./primitives/index.js\";\nimport { ColorPickerPrimitive } from \"./primitives/index.js\";\nimport type { FormComponentProps } from \"~/FormComponent/index.js\";\nimport {\n FormComponentDescription,\n FormComponentErrorMessage,\n FormComponentLabel,\n FormComponentNote\n} from \"~/FormComponent/index.js\";\n\ntype ColorPickerProps = ColorPickerPrimitiveProps & FormComponentProps;\n\nconst DecoratableIconPicker = ({\n label,\n description,\n note,\n hint,\n required,\n disabled,\n validation,\n ...props\n}: ColorPickerProps) => {\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 text={description} disabled={disabled} />\n <ColorPickerPrimitive\n aria-labelledby={labelId}\n {...props}\n disabled={disabled}\n invalid={invalid}\n />\n <FormComponentErrorMessage\n text={validationMessage}\n invalid={invalid}\n disabled={disabled}\n />\n <FormComponentNote text={note} disabled={disabled} />\n </div>\n );\n};\nconst ColorPicker = makeDecoratable(\"ColorPicker\", DecoratableIconPicker);\n\nexport { ColorPicker, type ColorPickerProps };\n"],"names":["DecoratableIconPicker","label","description","note","hint","required","disabled","validation","props","validationIsValid","validationMessage","invalid","useMemo","labelId","generateId","FormComponentLabel","FormComponentDescription","ColorPickerPrimitive","FormComponentErrorMessage","FormComponentNote","ColorPicker","makeDecoratable"],"mappings":";;;;AAcA,MAAMA,wBAAwB,CAAC,EAC3BC,KAAK,EACLC,WAAW,EACXC,IAAI,EACJC,IAAI,EACJC,QAAQ,EACRC,QAAQ,EACRC,UAAU,EACV,GAAGC,OACY;IACf,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,MAAMG;QACN,UAAUC;QACV,UAAUC;QACV,SAASK;sBAEb,oBAACK,0BAAwBA;QAAC,MAAMd;QAAa,UAAUI;sBACvD,oBAACW,sBAAoBA;QACjB,mBAAiBJ;QAChB,GAAGL,KAAK;QACT,UAAUF;QACV,SAASK;sBAEb,oBAACO,2BAAyBA;QACtB,MAAMR;QACN,SAASC;QACT,UAAUL;sBAEd,oBAACa,mBAAiBA;QAAC,MAAMhB;QAAM,UAAUG;;AAGrD;AACA,MAAMc,cAAcC,gBAAgB,eAAerB"}
@@ -43,7 +43,7 @@ interface ColorPickerPrimitiveProps extends Omit<React.HTMLAttributes<HTMLDivEle
43
43
  */
44
44
  invalid?: InputPrimitiveProps["invalid"];
45
45
  }
46
- declare const DecoratableColorPickerPrimitive: ({ align, disabled, invalid, size, variant, value, onOpenChange, onChange, onChangeComplete, ...props }: ColorPickerPrimitiveProps) => React.JSX.Element;
46
+ declare const DecoratableColorPickerPrimitive: ({ "aria-labelledby": labelledBy, align, disabled, invalid, size, variant, value, onOpenChange, onChange, onChangeComplete, ...props }: ColorPickerPrimitiveProps) => React.JSX.Element;
47
47
  declare const ColorPickerPrimitive: typeof DecoratableColorPickerPrimitive & {
48
48
  original: typeof DecoratableColorPickerPrimitive;
49
49
  originalName: string;
@@ -28,7 +28,7 @@ const colorPickerVariants = cva("cursor-pointer", {
28
28
  size: "lg"
29
29
  }
30
30
  });
31
- const DecoratableColorPickerPrimitive = ({ align, disabled, invalid, size, variant, value, onOpenChange, onChange, onChangeComplete, ...props })=>{
31
+ const DecoratableColorPickerPrimitive = ({ "aria-labelledby": labelledBy, align, disabled, invalid, size, variant, value, onOpenChange, onChange, onChangeComplete, ...props })=>{
32
32
  const { vm, setColor, commitColor, setOpen } = useColorPicker({
33
33
  value,
34
34
  onOpenChange,
@@ -41,6 +41,8 @@ const DecoratableColorPickerPrimitive = ({ align, disabled, invalid, size, varia
41
41
  }, /*#__PURE__*/ react.createElement(PopoverPrimitive.Trigger, {
42
42
  asChild: true
43
43
  }, /*#__PURE__*/ react.createElement("div", {
44
+ role: "button",
45
+ "aria-labelledby": labelledBy,
44
46
  "data-disabled": disabled,
45
47
  className: cn(inputVariants({
46
48
  size,
@@ -1 +1 @@
1
- {"version":3,"file":"ColorPicker/primitives/ColorPickerPrimitive.js","sources":["../../../src/ColorPicker/primitives/ColorPickerPrimitive.tsx"],"sourcesContent":["import React from \"react\";\nimport { SketchPicker } from \"react-color\";\nimport { useColorPicker } from \"./useColorPicker.js\";\nimport { type InputPrimitiveProps, inputVariants } from \"~/Input/index.js\";\nimport { PopoverPrimitive, type PopoverPrimitiveContentProps } from \"~/Popover/index.js\";\nimport { cn, cva, makeDecoratable } from \"~/utils.js\";\n\nconst colorPickerVariants = cva(\"cursor-pointer\", {\n variants: {\n size: {\n md: [\"size-8\", \"p-[calc(var(--padding-xs-plus)-(var(--border-width-sm)))] \"],\n lg: [\"size-10\", \"p-[calc(var(--padding-sm-plus)-(var(--border-width-sm)))]\"],\n xl: [\"size-14\", \"p-[calc(var(--padding-md)-(var(--border-width-sm)))]\"]\n },\n disabled: {\n true: \"pointer-events-none\"\n }\n },\n defaultVariants: {\n size: \"lg\"\n }\n});\n\ninterface ColorPickerPrimitiveProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"onChange\"> {\n /**\n * Callback triggered when the open state changes.\n */\n onOpenChange?: (open: boolean) => void;\n /**\n * Callback triggered when the value changes.\n */\n onChange?: (value: string) => void;\n /**\n * Callback triggered when the color selection is complete.\n * This is called after the user has finished selecting a color.\n */\n onChangeComplete?: (value: string) => void;\n /**\n * Optional selected value.\n */\n value?: string;\n /**\n * If true, the color picker will be disabled.\n */\n disabled?: boolean;\n /**\n * Popover alignment.\n */\n align?: PopoverPrimitiveContentProps[\"align\"];\n /**\n * Size of the input field.\n * Refer to `InputPrimitiveProps[\"size\"]` for possible values.\n */\n size?: InputPrimitiveProps[\"size\"];\n /**\n * Variant of the input field.\n * Refer to `InputPrimitiveProps[\"variant\"]` for possible values.\n */\n variant?: InputPrimitiveProps[\"variant\"];\n /**\n * Indicates if the input field is invalid.\n * Refer to `InputPrimitiveProps[\"invalid\"]` for possible values.\n */\n invalid?: InputPrimitiveProps[\"invalid\"];\n}\n\nconst DecoratableColorPickerPrimitive = ({\n align,\n disabled,\n invalid,\n size,\n variant,\n value,\n onOpenChange,\n onChange,\n onChangeComplete,\n ...props\n}: ColorPickerPrimitiveProps) => {\n const { vm, setColor, commitColor, setOpen } = useColorPicker({\n value,\n onOpenChange,\n onChange,\n onChangeComplete\n });\n\n return (\n <div {...props}>\n <PopoverPrimitive open={vm.open} onOpenChange={setOpen}>\n <PopoverPrimitive.Trigger asChild>\n <div\n data-disabled={disabled}\n className={cn(\n inputVariants({\n size,\n variant,\n invalid\n }),\n colorPickerVariants({ size, disabled })\n )}\n >\n <div\n className={\"rounded-xs size-full\"}\n style={{ backgroundColor: vm.value }}\n />\n </div>\n </PopoverPrimitive.Trigger>\n <PopoverPrimitive.Content align={align} onEscapeKeyDown={() => setOpen(false)}>\n <SketchPicker\n color={vm.value}\n onChange={setColor}\n onChangeComplete={commitColor}\n />\n </PopoverPrimitive.Content>\n </PopoverPrimitive>\n </div>\n );\n};\n\nconst ColorPickerPrimitive = makeDecoratable(\n \"ColorPickerPrimitive\",\n DecoratableColorPickerPrimitive\n);\n\nexport { ColorPickerPrimitive, type ColorPickerPrimitiveProps };\n"],"names":["colorPickerVariants","cva","DecoratableColorPickerPrimitive","align","disabled","invalid","size","variant","value","onOpenChange","onChange","onChangeComplete","props","vm","setColor","commitColor","setOpen","useColorPicker","PopoverPrimitive","cn","inputVariants","SketchPicker","ColorPickerPrimitive","makeDecoratable"],"mappings":";;;;;;AAOA,MAAMA,sBAAsBC,IAAI,kBAAkB;IAC9C,UAAU;QACN,MAAM;YACF,IAAI;gBAAC;gBAAU;aAA6D;YAC5E,IAAI;gBAAC;gBAAW;aAA4D;YAC5E,IAAI;gBAAC;gBAAW;aAAuD;QAC3E;QACA,UAAU;YACN,MAAM;QACV;IACJ;IACA,iBAAiB;QACb,MAAM;IACV;AACJ;AA6CA,MAAMC,kCAAkC,CAAC,EACrCC,KAAK,EACLC,QAAQ,EACRC,OAAO,EACPC,IAAI,EACJC,OAAO,EACPC,KAAK,EACLC,YAAY,EACZC,QAAQ,EACRC,gBAAgB,EAChB,GAAGC,OACqB;IACxB,MAAM,EAAEC,EAAE,EAAEC,QAAQ,EAAEC,WAAW,EAAEC,OAAO,EAAE,GAAGC,eAAe;QAC1DT;QACAC;QACAC;QACAC;IACJ;IAEA,OAAO,WAAP,GACI,oBAAC,OAAQC,OAAAA,WAAAA,GACL,oBAACM,kBAAgBA;QAAC,MAAML,GAAG,IAAI;QAAE,cAAcG;qBAC3C,oBAACE,iBAAiB,OAAO;QAAC;qBACtB,oBAAC;QACG,iBAAed;QACf,WAAWe,GACPC,cAAc;YACVd;YACAC;YACAF;QACJ,IACAL,oBAAoB;YAAEM;YAAMF;QAAS;qBAGzC,oBAAC;QACG,WAAW;QACX,OAAO;YAAE,iBAAiBS,GAAG,KAAK;QAAC;wBAI/C,oBAACK,iBAAiB,OAAO;QAAC,OAAOf;QAAO,iBAAiB,IAAMa,QAAQ;qBACnE,oBAACK,cAAYA;QACT,OAAOR,GAAG,KAAK;QACf,UAAUC;QACV,kBAAkBC;;AAM1C;AAEA,MAAMO,uBAAuBC,gBACzB,wBACArB"}
1
+ {"version":3,"file":"ColorPicker/primitives/ColorPickerPrimitive.js","sources":["../../../src/ColorPicker/primitives/ColorPickerPrimitive.tsx"],"sourcesContent":["import React from \"react\";\nimport { SketchPicker } from \"react-color\";\nimport { useColorPicker } from \"./useColorPicker.js\";\nimport { type InputPrimitiveProps, inputVariants } from \"~/Input/index.js\";\nimport { PopoverPrimitive, type PopoverPrimitiveContentProps } from \"~/Popover/index.js\";\nimport { cn, cva, makeDecoratable } from \"~/utils.js\";\n\nconst colorPickerVariants = cva(\"cursor-pointer\", {\n variants: {\n size: {\n md: [\"size-8\", \"p-[calc(var(--padding-xs-plus)-(var(--border-width-sm)))] \"],\n lg: [\"size-10\", \"p-[calc(var(--padding-sm-plus)-(var(--border-width-sm)))]\"],\n xl: [\"size-14\", \"p-[calc(var(--padding-md)-(var(--border-width-sm)))]\"]\n },\n disabled: {\n true: \"pointer-events-none\"\n }\n },\n defaultVariants: {\n size: \"lg\"\n }\n});\n\ninterface ColorPickerPrimitiveProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"onChange\"> {\n /**\n * Callback triggered when the open state changes.\n */\n onOpenChange?: (open: boolean) => void;\n /**\n * Callback triggered when the value changes.\n */\n onChange?: (value: string) => void;\n /**\n * Callback triggered when the color selection is complete.\n * This is called after the user has finished selecting a color.\n */\n onChangeComplete?: (value: string) => void;\n /**\n * Optional selected value.\n */\n value?: string;\n /**\n * If true, the color picker will be disabled.\n */\n disabled?: boolean;\n /**\n * Popover alignment.\n */\n align?: PopoverPrimitiveContentProps[\"align\"];\n /**\n * Size of the input field.\n * Refer to `InputPrimitiveProps[\"size\"]` for possible values.\n */\n size?: InputPrimitiveProps[\"size\"];\n /**\n * Variant of the input field.\n * Refer to `InputPrimitiveProps[\"variant\"]` for possible values.\n */\n variant?: InputPrimitiveProps[\"variant\"];\n /**\n * Indicates if the input field is invalid.\n * Refer to `InputPrimitiveProps[\"invalid\"]` for possible values.\n */\n invalid?: InputPrimitiveProps[\"invalid\"];\n}\n\nconst DecoratableColorPickerPrimitive = ({\n \"aria-labelledby\": labelledBy,\n align,\n disabled,\n invalid,\n size,\n variant,\n value,\n onOpenChange,\n onChange,\n onChangeComplete,\n ...props\n}: ColorPickerPrimitiveProps) => {\n const { vm, setColor, commitColor, setOpen } = useColorPicker({\n value,\n onOpenChange,\n onChange,\n onChangeComplete\n });\n\n return (\n <div {...props}>\n <PopoverPrimitive open={vm.open} onOpenChange={setOpen}>\n <PopoverPrimitive.Trigger asChild>\n {/* Named by the field's label — the swatch is the control, not the wrapper. */}\n <div\n role={\"button\"}\n aria-labelledby={labelledBy}\n data-disabled={disabled}\n className={cn(\n inputVariants({\n size,\n variant,\n invalid\n }),\n colorPickerVariants({ size, disabled })\n )}\n >\n <div\n className={\"rounded-xs size-full\"}\n style={{ backgroundColor: vm.value }}\n />\n </div>\n </PopoverPrimitive.Trigger>\n <PopoverPrimitive.Content align={align} onEscapeKeyDown={() => setOpen(false)}>\n <SketchPicker\n color={vm.value}\n onChange={setColor}\n onChangeComplete={commitColor}\n />\n </PopoverPrimitive.Content>\n </PopoverPrimitive>\n </div>\n );\n};\n\nconst ColorPickerPrimitive = makeDecoratable(\n \"ColorPickerPrimitive\",\n DecoratableColorPickerPrimitive\n);\n\nexport { ColorPickerPrimitive, type ColorPickerPrimitiveProps };\n"],"names":["colorPickerVariants","cva","DecoratableColorPickerPrimitive","labelledBy","align","disabled","invalid","size","variant","value","onOpenChange","onChange","onChangeComplete","props","vm","setColor","commitColor","setOpen","useColorPicker","PopoverPrimitive","cn","inputVariants","SketchPicker","ColorPickerPrimitive","makeDecoratable"],"mappings":";;;;;;AAOA,MAAMA,sBAAsBC,IAAI,kBAAkB;IAC9C,UAAU;QACN,MAAM;YACF,IAAI;gBAAC;gBAAU;aAA6D;YAC5E,IAAI;gBAAC;gBAAW;aAA4D;YAC5E,IAAI;gBAAC;gBAAW;aAAuD;QAC3E;QACA,UAAU;YACN,MAAM;QACV;IACJ;IACA,iBAAiB;QACb,MAAM;IACV;AACJ;AA6CA,MAAMC,kCAAkC,CAAC,EACrC,mBAAmBC,UAAU,EAC7BC,KAAK,EACLC,QAAQ,EACRC,OAAO,EACPC,IAAI,EACJC,OAAO,EACPC,KAAK,EACLC,YAAY,EACZC,QAAQ,EACRC,gBAAgB,EAChB,GAAGC,OACqB;IACxB,MAAM,EAAEC,EAAE,EAAEC,QAAQ,EAAEC,WAAW,EAAEC,OAAO,EAAE,GAAGC,eAAe;QAC1DT;QACAC;QACAC;QACAC;IACJ;IAEA,OAAO,WAAP,GACI,oBAAC,OAAQC,OAAAA,WAAAA,GACL,oBAACM,kBAAgBA;QAAC,MAAML,GAAG,IAAI;QAAE,cAAcG;qBAC3C,oBAACE,iBAAiB,OAAO;QAAC;qBAEtB,oBAAC;QACG,MAAM;QACN,mBAAiBhB;QACjB,iBAAeE;QACf,WAAWe,GACPC,cAAc;YACVd;YACAC;YACAF;QACJ,IACAN,oBAAoB;YAAEO;YAAMF;QAAS;qBAGzC,oBAAC;QACG,WAAW;QACX,OAAO;YAAE,iBAAiBS,GAAG,KAAK;QAAC;wBAI/C,oBAACK,iBAAiB,OAAO;QAAC,OAAOf;QAAO,iBAAiB,IAAMa,QAAQ;qBACnE,oBAACK,cAAYA;QACT,OAAOR,GAAG,KAAK;QACf,UAAUC;QACV,kBAAkBC;;AAM1C;AAEA,MAAMO,uBAAuBC,gBACzB,wBACAtB"}
@@ -1,5 +1,5 @@
1
1
  import * as React from "react";
2
2
  import { Command as CommandPrimitive } from "cmdk";
3
3
  type ListProps = React.ComponentPropsWithoutRef<typeof CommandPrimitive.List>;
4
- declare const List: ({ className, ...props }: ListProps) => React.JSX.Element;
4
+ declare const List: ({ className, style, onScroll, ...props }: ListProps) => React.JSX.Element;
5
5
  export { List, type ListProps };
@@ -1,12 +1,16 @@
1
1
  import { Command } from "cmdk";
2
2
  import { cn } from "../../utils.js";
3
+ import { ScrollArea } from "../../ScrollArea/index.js";
3
4
  import * as __rspack_external_react from "react";
4
- const List = ({ className, ...props })=>/*#__PURE__*/ __rspack_external_react.createElement(Command.List, {
5
- className: cn([
6
- "block max-h-96 w-full py-sm overflow-y-auto overflow-x-hidden bg-neutral-base text-neutral-strong"
7
- ], className),
5
+ const List = ({ className, style, onScroll, ...props })=>/*#__PURE__*/ __rspack_external_react.createElement(ScrollArea, {
6
+ className: cn("w-full bg-neutral-base", className),
7
+ style: style,
8
+ viewportClassName: "max-h-96 overflow-x-hidden",
9
+ onViewportScroll: onScroll
10
+ }, /*#__PURE__*/ __rspack_external_react.createElement(Command.List, {
11
+ className: "block w-full py-sm text-neutral-strong",
8
12
  ...props
9
- });
13
+ }));
10
14
  export { List };
11
15
 
12
16
  //# sourceMappingURL=List.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Command/components/List.js","sources":["../../../src/Command/components/List.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { Command as CommandPrimitive } from \"cmdk\";\nimport { cn } from \"~/utils.js\";\n\ntype ListProps = React.ComponentPropsWithoutRef<typeof CommandPrimitive.List>;\n\nconst List = ({ className, ...props }: ListProps) => {\n return (\n <CommandPrimitive.List\n className={cn(\n [\n \"block max-h-96 w-full py-sm overflow-y-auto overflow-x-hidden bg-neutral-base text-neutral-strong\"\n ],\n className\n )}\n {...props}\n />\n );\n};\n\nexport { List, type ListProps };\n"],"names":["List","className","props","CommandPrimitive","cn"],"mappings":";;;AAMA,MAAMA,OAAO,CAAC,EAAEC,SAAS,EAAE,GAAGC,OAAkB,GACrC,WAAP,GACI,sCAACC,QAAAA,IAAqB;QAClB,WAAWC,GACP;YACI;SACH,EACDH;QAEH,GAAGC,KAAK"}
1
+ {"version":3,"file":"Command/components/List.js","sources":["../../../src/Command/components/List.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { Command as CommandPrimitive } from \"cmdk\";\nimport { cn } from \"~/utils.js\";\nimport { ScrollArea } from \"~/ScrollArea/index.js\";\n\ntype ListProps = React.ComponentPropsWithoutRef<typeof CommandPrimitive.List>;\n\nconst List = ({ className, style, onScroll, ...props }: ListProps) => {\n /*\n * The list scrolls inside a `ScrollArea`, whose scrollbar is an element rather than the\n * operating system's own, so it can keep focus on the input while it is dragged. Layout and\n * scroll props go to the scroll area, since that is the element that scrolls now.\n */\n return (\n <ScrollArea\n className={cn(\"w-full bg-neutral-base\", className)}\n style={style}\n viewportClassName={\"max-h-96 overflow-x-hidden\"}\n onViewportScroll={onScroll}\n >\n <CommandPrimitive.List\n className={\"block w-full py-sm text-neutral-strong\"}\n {...props}\n />\n </ScrollArea>\n );\n};\n\nexport { List, type ListProps };\n"],"names":["List","className","style","onScroll","props","ScrollArea","cn","CommandPrimitive"],"mappings":";;;;AAOA,MAAMA,OAAO,CAAC,EAAEC,SAAS,EAAEC,KAAK,EAAEC,QAAQ,EAAE,GAAGC,OAAkB,GAMtD,WAAP,GACI,sCAACC,YAAUA;QACP,WAAWC,GAAG,0BAA0BL;QACxC,OAAOC;QACP,mBAAmB;QACnB,kBAAkBC;qBAElB,sCAACI,QAAAA,IAAqB;QAClB,WAAW;QACV,GAAGH,KAAK"}
@@ -1,11 +1,13 @@
1
1
  import React from "react";
2
- import type { ColumnSort, ColumnVisibilityState, OnChangeFn, Row, RowData, SortingState } from "@tanstack/react-table";
2
+ import type { ColumnSort, ColumnVisibilityState, ExpandedState, OnChangeFn, Row, RowData, SortingState } from "@tanstack/react-table";
3
3
  declare const features: {
4
4
  columnResizingFeature: import("@tanstack/table-core").TableFeature;
5
5
  columnSizingFeature: import("@tanstack/table-core").TableFeature;
6
6
  columnVisibilityFeature: import("@tanstack/table-core").TableFeature;
7
+ rowExpandingFeature: import("@tanstack/table-core").TableFeature;
7
8
  rowSelectionFeature: import("@tanstack/table-core").TableFeature;
8
9
  rowSortingFeature: import("@tanstack/table-core").TableFeature;
10
+ expandedRowModel: (table: import("@tanstack/table-core").Table<any, any>) => () => import("@tanstack/table-core").RowModel<any, any>;
9
11
  sortedRowModel: (table: import("@tanstack/table-core").Table<any, any>) => () => import("@tanstack/table-core").RowModel<any, any>;
10
12
  coreRowModel: (table: import("@tanstack/table-core").Table<any, any>) => () => import("@tanstack/table-core").RowModel<any, any>;
11
13
  };
@@ -34,6 +36,11 @@ type DataTableColumnSort = ColumnSort;
34
36
  type OnDataTableSortingChange = OnChangeFn<DataTableSorting>;
35
37
  type DataTableColumnVisibility = ColumnVisibilityState;
36
38
  type OnDataTableColumnVisibilityChange = OnChangeFn<DataTableColumnVisibility>;
39
+ /**
40
+ * Which rows show their sub-rows: `true` for every row, or a map of row ids (the `id` of each entry).
41
+ */
42
+ type DataTableExpanded = ExpandedState;
43
+ type OnDataTableExpandedChange = OnChangeFn<DataTableExpanded>;
37
44
  interface DataTableProps<TEntry extends RowData> {
38
45
  /**
39
46
  * Show or hide borders.
@@ -59,6 +66,24 @@ interface DataTableProps<TEntry extends RowData> {
59
66
  * Data to display into DataTable body.
60
67
  */
61
68
  data: TEntry[];
69
+ /**
70
+ * Returns the sub-rows listed under a row, e.g. the versions of an entry. A row with sub-rows
71
+ * gets a toggle in its first column that shows and hides them. Each entry, sub-rows included,
72
+ * must have a unique `id`.
73
+ */
74
+ getSubRows?: (row: TEntry) => TEntry[] | undefined;
75
+ /**
76
+ * Which rows show their sub-rows. Leave it out to let the DataTable keep track of it.
77
+ */
78
+ expanded?: DataTableExpanded;
79
+ /**
80
+ * Callback that receives the expanded state when a row's toggle is clicked.
81
+ */
82
+ onExpandedChange?: OnDataTableExpandedChange;
83
+ /**
84
+ * Which rows show their sub-rows at first, when `expanded` isn't passed. Defaults to none.
85
+ */
86
+ initialExpanded?: DataTableExpanded;
62
87
  /**
63
88
  * Callback that is called to determine if the row is selectable.
64
89
  */
@@ -96,7 +121,7 @@ interface DataTableProps<TEntry extends RowData> {
96
121
  */
97
122
  stickyHeader?: boolean;
98
123
  }
99
- declare const DecoratableDataTable: <T extends Record<string, any> & DataTableDefaultData>({ bordered, canSelectAllRows, columnVisibility, columns: initialColumns, data: initialData, initialSorting, isRowSelectable, loading, onColumnVisibilityChange, onSelectRow, onSortingChange, onToggleRow, selectedRows, sorting, stickyHeader }: DataTableProps<T>) => React.JSX.Element;
124
+ declare const DecoratableDataTable: <T extends Record<string, any> & DataTableDefaultData>({ bordered, canSelectAllRows, columnVisibility, columns: initialColumns, data: initialData, expanded, getSubRows: initialGetSubRows, initialExpanded, initialSorting, isRowSelectable, loading, onColumnVisibilityChange, onExpandedChange, onSelectRow, onSortingChange, onToggleRow, selectedRows, sorting, stickyHeader }: DataTableProps<T>) => React.JSX.Element;
100
125
  declare const DataTable: typeof DecoratableDataTable & {
101
126
  original: typeof DecoratableDataTable;
102
127
  originalName: string;
@@ -116,4 +141,4 @@ declare const DataTable: typeof DecoratableDataTable & {
116
141
  displayName: string;
117
142
  }>) => (props: unknown) => React.JSX.Element;
118
143
  };
119
- export { DataTable, type Features, type DataTableProps, type DataTableColumn, type DataTableColumns, type DataTableDefaultData, type DataTableRow, type DataTableSorting, type DataTableColumnSort, type OnDataTableSortingChange, type DataTableColumnVisibility, type OnDataTableColumnVisibilityChange };
144
+ export { DataTable, type Features, type DataTableProps, type DataTableColumn, type DataTableColumns, type DataTableDefaultData, type DataTableRow, type DataTableSorting, type DataTableColumnSort, type OnDataTableSortingChange, type DataTableColumnVisibility, type OnDataTableColumnVisibilityChange, type DataTableExpanded, type OnDataTableExpandedChange };