@webiny/admin-ui 6.6.0-alpha.0 → 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 (397) hide show
  1. package/Accordion/components/AccordionContent.js +4 -1
  2. package/Accordion/components/AccordionContent.js.map +1 -1
  3. package/Accordion/components/AccordionItem.d.ts +1 -0
  4. package/Accordion/components/AccordionItem.js.map +1 -1
  5. package/Accordion/components/AccordionItemDragHandle.d.ts +2 -1
  6. package/Accordion/components/AccordionItemDragHandle.js +2 -1
  7. package/Accordion/components/AccordionItemDragHandle.js.map +1 -1
  8. package/Accordion/components/AccordionTrigger.js +4 -2
  9. package/Accordion/components/AccordionTrigger.js.map +1 -1
  10. package/Alert/Alert.d.ts +1 -20
  11. package/Alert/Alert.js.map +1 -1
  12. package/AutoComplete/primitives/AutoCompletePrimitive.d.ts +8 -2
  13. package/AutoComplete/primitives/AutoCompletePrimitive.js +1 -0
  14. package/AutoComplete/primitives/AutoCompletePrimitive.js.map +1 -1
  15. package/BetaBadge/BetaBadge.d.ts +6 -0
  16. package/BetaBadge/BetaBadge.js +7 -0
  17. package/BetaBadge/BetaBadge.js.map +1 -0
  18. package/Breadcrumbs/Breadcrumbs.d.ts +54 -0
  19. package/Breadcrumbs/Breadcrumbs.js +66 -0
  20. package/Breadcrumbs/Breadcrumbs.js.map +1 -0
  21. package/Breadcrumbs/Breadcrumbs.stories.d.ts +9 -0
  22. package/Breadcrumbs/Breadcrumbs.stories.js +71 -0
  23. package/Breadcrumbs/Breadcrumbs.stories.js.map +1 -0
  24. package/Breadcrumbs/index.d.ts +1 -0
  25. package/Breadcrumbs/index.js +1 -0
  26. package/Button/Button.d.ts +1 -1
  27. package/Button/Button.js +14 -0
  28. package/Button/Button.js.map +1 -1
  29. package/Button/Button.mdx +13 -0
  30. package/Button/Button.stories.d.ts +1 -0
  31. package/Button/Button.stories.js +10 -2
  32. package/Button/Button.stories.js.map +1 -1
  33. package/Button/Button.test.d.ts +1 -0
  34. package/Button/Button.test.js +28 -0
  35. package/Button/Button.test.js.map +1 -0
  36. package/Calendar/calendarClassNames.js +1 -1
  37. package/Calendar/calendarClassNames.js.map +1 -1
  38. package/Checkbox/primitives/presenters/CheckboxPresenter.js +5 -2
  39. package/Checkbox/primitives/presenters/CheckboxPresenter.js.map +1 -1
  40. package/Checkbox/primitives/presenters/CheckboxPresenter.jsxLabel.test.d.ts +1 -0
  41. package/Checkbox/primitives/presenters/CheckboxPresenter.jsxLabel.test.js +61 -0
  42. package/Checkbox/primitives/presenters/CheckboxPresenter.jsxLabel.test.js.map +1 -0
  43. package/CheckboxGroup/CheckboxGroup.js +4 -1
  44. package/CheckboxGroup/CheckboxGroup.js.map +1 -1
  45. package/CheckboxGroup/primitives/CheckboxGroupPrimitive.d.ts +6 -1
  46. package/CheckboxGroup/primitives/CheckboxGroupPrimitive.js +5 -2
  47. package/CheckboxGroup/primitives/CheckboxGroupPrimitive.js.map +1 -1
  48. package/CheckboxGroup/primitives/presenters/CheckboxGroupPresenter.js +5 -2
  49. package/CheckboxGroup/primitives/presenters/CheckboxGroupPresenter.js.map +1 -1
  50. package/CheckboxGroup/primitives/presenters/CheckboxGroupPresenter.jsxLabel.test.d.ts +1 -0
  51. package/CheckboxGroup/primitives/presenters/CheckboxGroupPresenter.jsxLabel.test.js +108 -0
  52. package/CheckboxGroup/primitives/presenters/CheckboxGroupPresenter.jsxLabel.test.js.map +1 -0
  53. package/Code/Code.d.ts +29 -0
  54. package/Code/Code.js +23 -0
  55. package/Code/Code.js.map +1 -0
  56. package/Code/index.d.ts +1 -0
  57. package/Code/index.js +1 -0
  58. package/CodeEditor/CodeEditor.js +6 -0
  59. package/CodeEditor/CodeEditor.js.map +1 -1
  60. package/CodeEditor/CodeEditorPrimitive.js +3 -1
  61. package/CodeEditor/CodeEditorPrimitive.js.map +1 -1
  62. package/ColorPicker/ColorPicker.js +4 -1
  63. package/ColorPicker/ColorPicker.js.map +1 -1
  64. package/ColorPicker/primitives/ColorPickerPrimitive.d.ts +1 -1
  65. package/ColorPicker/primitives/ColorPickerPrimitive.js +3 -1
  66. package/ColorPicker/primitives/ColorPickerPrimitive.js.map +1 -1
  67. package/Command/components/List.d.ts +1 -1
  68. package/Command/components/List.js +9 -5
  69. package/Command/components/List.js.map +1 -1
  70. package/DataTable/DataTable.d.ts +42 -7
  71. package/DataTable/DataTable.js +122 -26
  72. package/DataTable/DataTable.js.map +1 -1
  73. package/DataTable/DataTable.mdx +64 -0
  74. package/DataTable/DataTable.stories.d.ts +4 -0
  75. package/DataTable/DataTable.stories.js +40 -1
  76. package/DataTable/DataTable.stories.js.map +1 -1
  77. package/DataTable/DataTable.subRows.test.d.ts +1 -0
  78. package/DataTable/DataTable.subRows.test.js +216 -0
  79. package/DataTable/DataTable.subRows.test.js.map +1 -0
  80. package/DataTable/components/ColumnsVisibility.d.ts +5 -4
  81. package/DataTable/components/ColumnsVisibility.js +7 -3
  82. package/DataTable/components/ColumnsVisibility.js.map +1 -1
  83. package/DatePicker/DatePicker.d.ts +5 -2
  84. package/DatePicker/DatePicker.js +14 -3
  85. package/DatePicker/DatePicker.js.map +1 -1
  86. package/DatePicker/DatePicker.stories.d.ts +10 -0
  87. package/DatePicker/DatePicker.stories.js +44 -1
  88. package/DatePicker/DatePicker.stories.js.map +1 -1
  89. package/DatePicker/primitives/BirthdayPicker.d.ts +13 -0
  90. package/DatePicker/primitives/BirthdayPicker.js +355 -0
  91. package/DatePicker/primitives/BirthdayPicker.js.map +1 -0
  92. package/DatePicker/primitives/BirthdayPickerCell.d.ts +14 -0
  93. package/DatePicker/primitives/BirthdayPickerCell.js +19 -0
  94. package/DatePicker/primitives/BirthdayPickerCell.js.map +1 -0
  95. package/DatePicker/primitives/BirthdayPickerSegments.d.ts +9 -0
  96. package/DatePicker/primitives/BirthdayPickerSegments.js +43 -0
  97. package/DatePicker/primitives/BirthdayPickerSegments.js.map +1 -0
  98. package/DatePicker/primitives/DateOnlyPicker.d.ts +1 -1
  99. package/DatePicker/primitives/DateOnlyPicker.js +13 -4
  100. package/DatePicker/primitives/DateOnlyPicker.js.map +1 -1
  101. package/DatePicker/primitives/DatePickerPrimitive.js +3 -0
  102. package/DatePicker/primitives/DatePickerPrimitive.js.map +1 -1
  103. package/DatePicker/primitives/DateRangePicker.d.ts +1 -1
  104. package/DatePicker/primitives/DateRangePicker.js +5 -4
  105. package/DatePicker/primitives/DateRangePicker.js.map +1 -1
  106. package/DatePicker/primitives/DateTimePicker.d.ts +1 -1
  107. package/DatePicker/primitives/DateTimePicker.js +27 -18
  108. package/DatePicker/primitives/DateTimePicker.js.map +1 -1
  109. package/DatePicker/primitives/MonthPicker.d.ts +1 -1
  110. package/DatePicker/primitives/MonthPicker.js +2 -1
  111. package/DatePicker/primitives/MonthPicker.js.map +1 -1
  112. package/DatePicker/primitives/MultipleDatesPicker.d.ts +1 -1
  113. package/DatePicker/primitives/MultipleDatesPicker.js +5 -4
  114. package/DatePicker/primitives/MultipleDatesPicker.js.map +1 -1
  115. package/DatePicker/primitives/MultipleMonthsPicker.d.ts +1 -1
  116. package/DatePicker/primitives/MultipleMonthsPicker.js +2 -1
  117. package/DatePicker/primitives/MultipleMonthsPicker.js.map +1 -1
  118. package/DatePicker/primitives/MultipleYearsPicker.d.ts +1 -1
  119. package/DatePicker/primitives/MultipleYearsPicker.js +2 -1
  120. package/DatePicker/primitives/MultipleYearsPicker.js.map +1 -1
  121. package/DatePicker/primitives/TimeOnlyPicker.d.ts +1 -1
  122. package/DatePicker/primitives/TimeOnlyPicker.js +2 -1
  123. package/DatePicker/primitives/TimeOnlyPicker.js.map +1 -1
  124. package/DatePicker/primitives/WeekPicker.d.ts +1 -1
  125. package/DatePicker/primitives/WeekPicker.js +2 -1
  126. package/DatePicker/primitives/WeekPicker.js.map +1 -1
  127. package/DatePicker/primitives/YearPicker.d.ts +1 -1
  128. package/DatePicker/primitives/YearPicker.js +2 -1
  129. package/DatePicker/primitives/YearPicker.js.map +1 -1
  130. package/DatePicker/primitives/components/DatePickerTrigger.js +1 -1
  131. package/DatePicker/primitives/components/DatePickerTrigger.js.map +1 -1
  132. package/DatePicker/primitives/components/TimePicker.d.ts +2 -1
  133. package/DatePicker/primitives/components/TimePicker.js +2 -1
  134. package/DatePicker/primitives/components/TimePicker.js.map +1 -1
  135. package/DatePicker/utils/birthdayHelpers.d.ts +77 -0
  136. package/DatePicker/utils/birthdayHelpers.js +145 -0
  137. package/DatePicker/utils/birthdayHelpers.js.map +1 -0
  138. package/DatePicker/utils/birthdayHelpers.test.d.ts +1 -0
  139. package/DatePicker/utils/birthdayHelpers.test.js +394 -0
  140. package/DatePicker/utils/birthdayHelpers.test.js.map +1 -0
  141. package/DatePicker/utils/dateHelpers.d.ts +6 -1
  142. package/DatePicker/utils/dateHelpers.js +13 -5
  143. package/DatePicker/utils/dateHelpers.js.map +1 -1
  144. package/DatePicker/utils/dateHelpers.test.d.ts +1 -0
  145. package/DatePicker/utils/dateHelpers.test.js +119 -0
  146. package/DatePicker/utils/dateHelpers.test.js.map +1 -0
  147. package/DatePicker/utils/index.d.ts +1 -0
  148. package/DatePicker/utils/index.js +1 -0
  149. package/DatePicker/utils/timezoneHelpers.d.ts +3 -0
  150. package/DatePicker/utils/timezoneHelpers.js +32 -0
  151. package/DatePicker/utils/timezoneHelpers.js.map +1 -0
  152. package/DatePicker/utils/types.d.ts +17 -2
  153. package/DelayedOnChange/DelayedOnChange.d.ts +9 -2
  154. package/DelayedOnChange/DelayedOnChange.js.map +1 -1
  155. package/Dialog/Dialog.d.ts +8 -7
  156. package/Dialog/Dialog.js.map +1 -1
  157. package/Drawer/Drawer.d.ts +10 -6
  158. package/Drawer/Drawer.js +2 -1
  159. package/Drawer/Drawer.js.map +1 -1
  160. package/Drawer/Drawer.stories.d.ts +1 -0
  161. package/Drawer/Drawer.stories.js +20 -2
  162. package/Drawer/Drawer.stories.js.map +1 -1
  163. package/Drawer/components/DrawerHeader.d.ts +2 -2
  164. package/Drawer/components/DrawerHeader.js +11 -8
  165. package/Drawer/components/DrawerHeader.js.map +1 -1
  166. package/Drawer/components/Icon.d.ts +1 -1
  167. package/Drawer/components/Icon.js +3 -4
  168. package/Drawer/components/Icon.js.map +1 -1
  169. package/DropdownMenu/components/DropdownMenuItem.d.ts +5 -0
  170. package/DropdownMenu/components/DropdownMenuItem.js +3 -2
  171. package/DropdownMenu/components/DropdownMenuItem.js.map +1 -1
  172. package/EmptyState/EmptyState.d.ts +2 -1
  173. package/EmptyState/EmptyState.js +8 -2
  174. package/EmptyState/EmptyState.js.map +1 -1
  175. package/FilePicker/FilePicker.d.ts +12 -12
  176. package/FilePicker/FilePicker.js +6 -1
  177. package/FilePicker/FilePicker.js.map +1 -1
  178. package/FilePicker/FilePicker.stories.d.ts +6 -0
  179. package/FilePicker/FilePicker.stories.js +24 -1
  180. package/FilePicker/FilePicker.stories.js.map +1 -1
  181. package/FilePicker/primitives/FilePickerPrimitive.d.ts +13 -13
  182. package/FilePicker/primitives/FilePickerPrimitive.js +3 -1
  183. package/FilePicker/primitives/FilePickerPrimitive.js.map +1 -1
  184. package/FilePicker/primitives/components/Label.d.ts +3 -1
  185. package/FilePicker/primitives/components/Label.js +2 -1
  186. package/FilePicker/primitives/components/Label.js.map +1 -1
  187. package/FilePicker/primitives/components/previews/ImagePreview/ImagePreview.d.ts +13 -2
  188. package/FilePicker/primitives/components/previews/ImagePreview/ImagePreview.js +15 -6
  189. package/FilePicker/primitives/components/previews/ImagePreview/ImagePreview.js.map +1 -1
  190. package/FilePicker/primitives/components/previews/ItemActions.js +1 -1
  191. package/FilePicker/primitives/components/previews/ItemActions.js.map +1 -1
  192. package/FilePicker/primitives/components/previews/ItemDescription.js +1 -1
  193. package/FilePicker/primitives/components/previews/ItemDescription.js.map +1 -1
  194. package/FilePicker/primitives/components/previews/RichItemPreview/FileType.d.ts +5 -0
  195. package/FilePicker/primitives/components/previews/RichItemPreview/FileType.js +45 -0
  196. package/FilePicker/primitives/components/previews/RichItemPreview/FileType.js.map +1 -0
  197. package/FilePicker/primitives/components/previews/RichItemPreview/Placeholder.d.ts +5 -0
  198. package/FilePicker/primitives/components/previews/RichItemPreview/Placeholder.js +14 -0
  199. package/FilePicker/primitives/components/previews/RichItemPreview/Placeholder.js.map +1 -0
  200. package/FilePicker/primitives/components/previews/RichItemPreview/RichItemPreview.d.ts +6 -1
  201. package/FilePicker/primitives/components/previews/RichItemPreview/RichItemPreview.js +54 -12
  202. package/FilePicker/primitives/components/previews/RichItemPreview/RichItemPreview.js.map +1 -1
  203. package/FilePicker/primitives/components/previews/RichItemPreview/RichItemThumbnail.d.ts +11 -1
  204. package/FilePicker/primitives/components/previews/RichItemPreview/RichItemThumbnail.js +8 -61
  205. package/FilePicker/primitives/components/previews/RichItemPreview/RichItemThumbnail.js.map +1 -1
  206. package/FilePicker/primitives/components/previews/RichItemPreview/Thumbnail.d.ts +11 -0
  207. package/FilePicker/primitives/components/previews/RichItemPreview/Thumbnail.js +24 -0
  208. package/FilePicker/primitives/components/previews/RichItemPreview/Thumbnail.js.map +1 -0
  209. package/FilePicker/primitives/components/previews/RichItemPreview/ThumbnailActions.d.ts +10 -0
  210. package/FilePicker/primitives/components/previews/RichItemPreview/ThumbnailActions.js +46 -0
  211. package/FilePicker/primitives/components/previews/RichItemPreview/ThumbnailActions.js.map +1 -0
  212. package/FilePicker/primitives/components/previews/TruncatedFileName.d.ts +7 -0
  213. package/FilePicker/primitives/components/previews/TruncatedFileName.js +20 -0
  214. package/FilePicker/primitives/components/previews/TruncatedFileName.js.map +1 -0
  215. package/FilePicker/primitives/components/previews/fileName.d.ts +4 -0
  216. package/FilePicker/primitives/components/previews/fileName.js +26 -0
  217. package/FilePicker/primitives/components/previews/fileName.js.map +1 -0
  218. package/FilePicker/primitives/components/previews/index.d.ts +1 -0
  219. package/FilePicker/primitives/components/previews/index.js +1 -0
  220. package/FormComponent/Label.d.ts +6 -1
  221. package/FormComponent/Label.js +5 -2
  222. package/FormComponent/Label.js.map +1 -1
  223. package/FormComponent/labels.test.d.ts +1 -0
  224. package/FormComponent/labels.test.js +276 -0
  225. package/FormComponent/labels.test.js.map +1 -0
  226. package/Icon/Icon.d.ts +6 -1
  227. package/Icon/Icon.js.map +1 -1
  228. package/IconPicker/IconPicker.js +6 -1
  229. package/IconPicker/IconPicker.js.map +1 -1
  230. package/IconPicker/domains/IconPickerIcon.js +1 -1
  231. package/IconPicker/domains/IconPickerIcon.js.map +1 -1
  232. package/IconPicker/primitives/IconPickerPrimitive.d.ts +2 -0
  233. package/IconPicker/primitives/IconPickerPrimitive.js +2 -2
  234. package/IconPicker/primitives/IconPickerPrimitive.js.map +1 -1
  235. package/IconPicker/primitives/components/IconPickerGrid.js.map +1 -1
  236. package/ImageEditor/AspectRatioPreview.d.ts +16 -0
  237. package/ImageEditor/AspectRatioPreview.js +26 -0
  238. package/ImageEditor/AspectRatioPreview.js.map +1 -0
  239. package/ImageEditor/CropHotspotEditor.d.ts +22 -0
  240. package/ImageEditor/CropHotspotEditor.js +402 -0
  241. package/ImageEditor/CropHotspotEditor.js.map +1 -0
  242. package/ImageEditor/ImageEditor.d.ts +18 -0
  243. package/ImageEditor/ImageEditor.js +151 -0
  244. package/ImageEditor/ImageEditor.js.map +1 -0
  245. package/ImageEditor/ImageEditor.stories.d.ts +6 -0
  246. package/ImageEditor/ImageEditor.stories.js +42 -0
  247. package/ImageEditor/ImageEditor.stories.js.map +1 -0
  248. package/ImageEditor/MetaFields.d.ts +12 -0
  249. package/ImageEditor/MetaFields.js +20 -0
  250. package/ImageEditor/MetaFields.js.map +1 -0
  251. package/ImageEditor/SectionLabel.d.ts +8 -0
  252. package/ImageEditor/SectionLabel.js +7 -0
  253. package/ImageEditor/SectionLabel.js.map +1 -0
  254. package/ImageEditor/geometry.d.ts +46 -0
  255. package/ImageEditor/geometry.js +126 -0
  256. package/ImageEditor/geometry.js.map +1 -0
  257. package/ImageEditor/index.d.ts +3 -0
  258. package/ImageEditor/index.js +3 -0
  259. package/ImageEditor/types.d.ts +52 -0
  260. package/ImageEditor/types.js +35 -0
  261. package/ImageEditor/types.js.map +1 -0
  262. package/Input/InputPrimitive.d.ts +4 -4
  263. package/Input/InputPrimitive.js +0 -1
  264. package/Input/InputPrimitive.js.map +1 -1
  265. package/Kbd/Kbd.d.ts +35 -0
  266. package/Kbd/Kbd.js +34 -0
  267. package/Kbd/Kbd.js.map +1 -0
  268. package/Kbd/index.d.ts +1 -0
  269. package/Kbd/index.js +1 -0
  270. package/Link/Link.d.ts +1 -1
  271. package/Link/Link.js +1 -1
  272. package/Link/Link.js.map +1 -1
  273. package/Markdown/Markdown.d.ts +47 -0
  274. package/Markdown/Markdown.js +17 -0
  275. package/Markdown/Markdown.js.map +1 -0
  276. package/Markdown/index.d.ts +1 -0
  277. package/Markdown/index.js +1 -0
  278. package/MultiAutoComplete/primitives/MultiAutoCompletePrimitive.d.ts +8 -2
  279. package/MultiAutoComplete/primitives/MultiAutoCompletePrimitive.js +1 -0
  280. package/MultiAutoComplete/primitives/MultiAutoCompletePrimitive.js.map +1 -1
  281. package/MultiAutoComplete/primitives/presenters/MultiAutoCompletePresenter.test.js +1 -1
  282. package/MultiAutoComplete/primitives/presenters/MultiAutoCompletePresenter.test.js.map +1 -1
  283. package/MultiAutoComplete/primitives/useMultiAutoComplete.js +3 -2
  284. package/MultiAutoComplete/primitives/useMultiAutoComplete.js.map +1 -1
  285. package/MultiFilePicker/MultiFilePicker.d.ts +12 -12
  286. package/MultiFilePicker/primitives/MultiFilePickerPrimitive.d.ts +12 -12
  287. package/MultiSelect/MultiSelect.js +6 -1
  288. package/MultiSelect/MultiSelect.js.map +1 -1
  289. package/MultiSelect/primitives/MultiSelectPrimitive.d.ts +3 -1
  290. package/MultiSelect/primitives/MultiSelectPrimitive.js +16 -7
  291. package/MultiSelect/primitives/MultiSelectPrimitive.js.map +1 -1
  292. package/Popover/Popover.stories.d.ts +7 -0
  293. package/Popover/Popover.stories.js +24 -1
  294. package/Popover/Popover.stories.js.map +1 -1
  295. package/Popover/primitives/components/PopoverContent.js +6 -1
  296. package/Popover/primitives/components/PopoverContent.js.map +1 -1
  297. package/RadioGroup/RadioGroup.js +4 -1
  298. package/RadioGroup/RadioGroup.js.map +1 -1
  299. package/RadioGroup/primitives/RadioGroupPrimitive.d.ts +1 -1
  300. package/RadioGroup/primitives/RadioGroupPrimitive.js +4 -2
  301. package/RadioGroup/primitives/RadioGroupPrimitive.js.map +1 -1
  302. package/RadioGroup/primitives/presenters/RadioGroupPresenter.js +4 -2
  303. package/RadioGroup/primitives/presenters/RadioGroupPresenter.js.map +1 -1
  304. package/RadioGroup/primitives/presenters/RadioGroupPresenter.jsxLabel.test.d.ts +1 -0
  305. package/RadioGroup/primitives/presenters/RadioGroupPresenter.jsxLabel.test.js +88 -0
  306. package/RadioGroup/primitives/presenters/RadioGroupPresenter.jsxLabel.test.js.map +1 -0
  307. package/RangeSlider/RangeSlider.js +4 -1
  308. package/RangeSlider/RangeSlider.js.map +1 -1
  309. package/RangeSlider/primitives/RangeSliderPrimitive.d.ts +1 -1
  310. package/RangeSlider/primitives/RangeSliderPrimitive.js +3 -1
  311. package/RangeSlider/primitives/RangeSliderPrimitive.js.map +1 -1
  312. package/ScrollArea/ScrollArea.d.ts +16 -2
  313. package/ScrollArea/ScrollArea.js +19 -5
  314. package/ScrollArea/ScrollArea.js.map +1 -1
  315. package/SegmentedControl/SegmentedControl.js +4 -1
  316. package/SegmentedControl/SegmentedControl.js.map +1 -1
  317. package/SegmentedControl/primitives/SegmentedControlPrimitive.d.ts +5 -1
  318. package/SegmentedControl/primitives/SegmentedControlPrimitive.js +2 -1
  319. package/SegmentedControl/primitives/SegmentedControlPrimitive.js.map +1 -1
  320. package/Select/Select.js +6 -1
  321. package/Select/Select.js.map +1 -1
  322. package/Select/primitives/SelectPrimitive.d.ts +4 -0
  323. package/Select/primitives/SelectPrimitive.js +4 -2
  324. package/Select/primitives/SelectPrimitive.js.map +1 -1
  325. package/Select/primitives/components/SelectContent.js +4 -6
  326. package/Select/primitives/components/SelectContent.js.map +1 -1
  327. package/SidePanel/SidePanel.d.ts +46 -0
  328. package/SidePanel/SidePanel.js +47 -0
  329. package/SidePanel/SidePanel.js.map +1 -0
  330. package/SidePanel/SidePanelBody.d.ts +37 -0
  331. package/SidePanel/SidePanelBody.js +14 -0
  332. package/SidePanel/SidePanelBody.js.map +1 -0
  333. package/SidePanel/SidePanelFooter.d.ts +27 -0
  334. package/SidePanel/SidePanelFooter.js +10 -0
  335. package/SidePanel/SidePanelFooter.js.map +1 -0
  336. package/SidePanel/index.d.ts +3 -0
  337. package/SidePanel/index.js +3 -0
  338. package/Sidebar/Sidebar.groups.test.d.ts +1 -0
  339. package/Sidebar/Sidebar.groups.test.js +113 -0
  340. package/Sidebar/Sidebar.groups.test.js.map +1 -0
  341. package/Sidebar/components/SidebarContent.js +1 -1
  342. package/Sidebar/components/SidebarContent.js.map +1 -1
  343. package/Sidebar/components/SidebarRoot.js +1 -1
  344. package/Sidebar/components/SidebarRoot.js.map +1 -1
  345. package/Sidebar/components/items/SidebarMenuRootButton.js +1 -0
  346. package/Sidebar/components/items/SidebarMenuRootButton.js.map +1 -1
  347. package/Sidebar/components/items/SidebarMenuSubButton.js +8 -5
  348. package/Sidebar/components/items/SidebarMenuSubButton.js.map +1 -1
  349. package/Sidebar/components/items/SidebarMenuSubItem.js +3 -3
  350. package/Sidebar/components/items/SidebarMenuSubItem.js.map +1 -1
  351. package/Slider/Slider.js +10 -2
  352. package/Slider/Slider.js.map +1 -1
  353. package/Slider/primitives/SliderPrimitive.d.ts +1 -1
  354. package/Slider/primitives/SliderPrimitive.js +2 -1
  355. package/Slider/primitives/SliderPrimitive.js.map +1 -1
  356. package/Slider/primitives/components/SliderThumb.d.ts +5 -2
  357. package/Slider/primitives/components/SliderThumb.js +2 -1
  358. package/Slider/primitives/components/SliderThumb.js.map +1 -1
  359. package/Switch/Switch.d.ts +4 -4
  360. package/Switch/Switch.js +21 -7
  361. package/Switch/Switch.js.map +1 -1
  362. package/Switch/domains/SwitchItemDto.d.ts +1 -1
  363. package/Switch/primitives/SwitchPrimitive.js +4 -3
  364. package/Switch/primitives/SwitchPrimitive.js.map +1 -1
  365. package/Tabs/Tabs.d.ts +7 -2
  366. package/Tabs/Tabs.js +29 -11
  367. package/Tabs/Tabs.js.map +1 -1
  368. package/Tabs/Tabs.mdx +27 -0
  369. package/Tabs/Tabs.stories.d.ts +1 -0
  370. package/Tabs/Tabs.stories.js +19 -1
  371. package/Tabs/Tabs.stories.js.map +1 -1
  372. package/Tag/Tag.d.ts +1 -1
  373. package/Tag/Tag.js +5 -0
  374. package/Tag/Tag.js.map +1 -1
  375. package/Tag/TagIcon.js +7 -1
  376. package/Tag/TagIcon.js.map +1 -1
  377. package/Tags/primitives/TagsPrimitive.d.ts +2 -2
  378. package/Tags/primitives/TagsPrimitive.js.map +1 -1
  379. package/Toast/useToast.stories.js.map +1 -1
  380. package/ToggleGroup/ToggleGroup.js +4 -1
  381. package/ToggleGroup/ToggleGroup.js.map +1 -1
  382. package/ToggleGroup/primitives/ToggleGroupPrimitive.d.ts +2 -0
  383. package/ToggleGroup/primitives/ToggleGroupPrimitive.js +3 -2
  384. package/ToggleGroup/primitives/ToggleGroupPrimitive.js.map +1 -1
  385. package/Tree/useTree.js +6 -2
  386. package/Tree/useTree.js.map +1 -1
  387. package/exports/admin/ui.d.ts +2 -0
  388. package/exports/admin/ui.js +2 -0
  389. package/hooks/index.d.ts +1 -0
  390. package/hooks/index.js +1 -0
  391. package/hooks/useEscapeScrollLock.d.ts +13 -0
  392. package/hooks/useEscapeScrollLock.js +21 -0
  393. package/hooks/useEscapeScrollLock.js.map +1 -0
  394. package/index.d.ts +7 -0
  395. package/index.js +7 -0
  396. package/package.json +31 -29
  397. package/theme.css +43 -0
package/Slider/Slider.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Label } from "../Label/index.js";
2
- import { makeDecoratable } from "../utils.js";
2
+ import { generateId, makeDecoratable } from "../utils.js";
3
3
  import { SliderPrimitiveRenderer, SliderValue, useSlider } from "./primitives/index.js";
4
4
  import { FormComponentDescription, FormComponentErrorMessage, FormComponentLabel, FormComponentNote } from "../FormComponent/index.js";
5
5
  import * as __rspack_external_react from "react";
@@ -8,6 +8,7 @@ const SliderRendererWithSideValue = (props)=>/*#__PURE__*/ __rspack_external_rea
8
8
  }, /*#__PURE__*/ __rspack_external_react.createElement("div", {
9
9
  className: "basis-2/12 pr-sm"
10
10
  }, /*#__PURE__*/ __rspack_external_react.createElement(Label, {
11
+ id: props.labelId,
11
12
  text: props.label,
12
13
  required: props.required,
13
14
  disabled: props.disabled,
@@ -15,7 +16,10 @@ const SliderRendererWithSideValue = (props)=>/*#__PURE__*/ __rspack_external_rea
15
16
  weight: "light"
16
17
  })), /*#__PURE__*/ __rspack_external_react.createElement("div", {
17
18
  className: "basis-9/12"
18
- }, /*#__PURE__*/ __rspack_external_react.createElement(SliderPrimitiveRenderer, props)), /*#__PURE__*/ __rspack_external_react.createElement("div", {
19
+ }, /*#__PURE__*/ __rspack_external_react.createElement(SliderPrimitiveRenderer, {
20
+ ...props,
21
+ "aria-labelledby": props.labelId
22
+ })), /*#__PURE__*/ __rspack_external_react.createElement("div", {
19
23
  className: "basis-1/12 pl-sm text-right"
20
24
  }, /*#__PURE__*/ __rspack_external_react.createElement(SliderValue, {
21
25
  value: props.textValue,
@@ -24,6 +28,7 @@ const SliderRendererWithSideValue = (props)=>/*#__PURE__*/ __rspack_external_rea
24
28
  const DecoratableSlider = ({ description, note, hint, validation, labelPosition, ...props })=>{
25
29
  const { isValid: validationIsValid, message: validationMessage } = validation || {};
26
30
  const invalid = false === validationIsValid;
31
+ const labelId = __rspack_external_react.useMemo(()=>`${generateId()}-label`, []);
27
32
  const { vm, changeValue, commitValue } = useSlider(props);
28
33
  if ("side" === labelPosition) return /*#__PURE__*/ __rspack_external_react.createElement("div", {
29
34
  className: "w-full"
@@ -32,6 +37,7 @@ const DecoratableSlider = ({ description, note, hint, validation, labelPosition,
32
37
  disabled: props.disabled
33
38
  }), /*#__PURE__*/ __rspack_external_react.createElement(SliderRendererWithSideValue, {
34
39
  ...props,
40
+ labelId: labelId,
35
41
  ...vm,
36
42
  invalid: invalid,
37
43
  onValueChange: changeValue,
@@ -47,6 +53,7 @@ const DecoratableSlider = ({ description, note, hint, validation, labelPosition,
47
53
  return /*#__PURE__*/ __rspack_external_react.createElement("div", {
48
54
  className: "w-full"
49
55
  }, /*#__PURE__*/ __rspack_external_react.createElement(FormComponentLabel, {
56
+ labelId: labelId,
50
57
  hint: hint,
51
58
  text: /*#__PURE__*/ __rspack_external_react.createElement(Label, {
52
59
  text: props.label,
@@ -61,6 +68,7 @@ const DecoratableSlider = ({ description, note, hint, validation, labelPosition,
61
68
  }), /*#__PURE__*/ __rspack_external_react.createElement(SliderPrimitiveRenderer, {
62
69
  ...props,
63
70
  ...vm,
71
+ "aria-labelledby": labelId,
64
72
  onValueChange: changeValue,
65
73
  onValueCommit: commitValue
66
74
  }), /*#__PURE__*/ __rspack_external_react.createElement(FormComponentErrorMessage, {
@@ -1 +1 @@
1
- {"version":3,"file":"Slider/Slider.js","sources":["../../src/Slider/Slider.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { Label } from \"~/Label/index.js\";\nimport { makeDecoratable } from \"~/utils.js\";\nimport type { SliderPrimitiveProps, SliderPrimitiveRendererProps } from \"./primitives/index.js\";\nimport { SliderPrimitiveRenderer, useSlider, SliderValue } 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\n/**\n * Slider Renderer with side label\n */\ninterface SliderRendererWithSideValueProps extends SliderPrimitiveRendererProps {\n label?: React.ReactNode;\n invalid?: boolean;\n required?: boolean;\n}\n\nconst SliderRendererWithSideValue = (props: SliderRendererWithSideValueProps) => {\n return (\n <div className={\"w-full flex flex-row items-center justify-between\"}>\n <div className={\"basis-2/12 pr-sm\"}>\n <Label\n text={props.label}\n required={props.required}\n disabled={props.disabled}\n invalid={props.invalid}\n weight={\"light\"}\n />\n </div>\n <div className={\"basis-9/12\"}>\n <SliderPrimitiveRenderer {...props} />\n </div>\n <div className={\"basis-1/12 pl-sm text-right\"}>\n <SliderValue value={props.textValue} disabled={props.disabled} />\n </div>\n </div>\n );\n};\n\n/**\n * Slider\n */\ntype SliderProps = FormComponentProps &\n SliderPrimitiveProps & {\n labelPosition?: \"top\" | \"side\";\n };\n\nconst DecoratableSlider = ({\n description,\n note,\n hint,\n validation,\n labelPosition,\n ...props\n}: SliderProps) => {\n const { isValid: validationIsValid, message: validationMessage } = validation || {};\n const invalid = validationIsValid === false;\n\n const { vm, changeValue, commitValue } = useSlider(props);\n\n if (labelPosition === \"side\") {\n return (\n <div className={\"w-full\"}>\n <FormComponentDescription text={description} disabled={props.disabled} />\n <SliderRendererWithSideValue\n {...props}\n {...vm}\n invalid={invalid}\n onValueChange={changeValue}\n onValueCommit={commitValue}\n />\n <FormComponentErrorMessage\n text={validationMessage}\n invalid={invalid}\n disabled={props.disabled}\n />\n <FormComponentNote text={note} disabled={props.disabled} />\n </div>\n );\n }\n\n return (\n <div className={\"w-full\"}>\n <FormComponentLabel\n hint={hint}\n text={<Label text={props.label} value={vm.textValue} />}\n disabled={props.disabled}\n required={props.required}\n invalid={invalid}\n />\n <FormComponentDescription text={description} disabled={props.disabled} />\n <SliderPrimitiveRenderer\n {...props}\n {...vm}\n onValueChange={changeValue}\n onValueCommit={commitValue}\n />\n <FormComponentErrorMessage\n text={validationMessage}\n invalid={invalid}\n disabled={props.disabled}\n />\n <FormComponentNote text={note} disabled={props.disabled} />\n </div>\n );\n};\nconst Slider = makeDecoratable(\"Slider\", DecoratableSlider);\n\nexport { Slider, type SliderProps };\n"],"names":["SliderRendererWithSideValue","props","Label","SliderPrimitiveRenderer","SliderValue","DecoratableSlider","description","note","hint","validation","labelPosition","validationIsValid","validationMessage","invalid","vm","changeValue","commitValue","useSlider","FormComponentDescription","FormComponentErrorMessage","FormComponentNote","FormComponentLabel","Slider","makeDecoratable"],"mappings":";;;;;AAsBA,MAAMA,8BAA8B,CAACC,QAC1B,WAAP,GACI,sCAAC;QAAI,WAAW;qBACZ,sCAAC;QAAI,WAAW;qBACZ,sCAACC,OAAKA;QACF,MAAMD,MAAM,KAAK;QACjB,UAAUA,MAAM,QAAQ;QACxB,UAAUA,MAAM,QAAQ;QACxB,SAASA,MAAM,OAAO;QACtB,QAAQ;uBAGhB,sCAAC;QAAI,WAAW;qBACZ,sCAACE,yBAA4BF,SAAAA,WAAAA,GAEjC,sCAAC;QAAI,WAAW;qBACZ,sCAACG,aAAWA;QAAC,OAAOH,MAAM,SAAS;QAAE,UAAUA,MAAM,QAAQ;;AAc7E,MAAMI,oBAAoB,CAAC,EACvBC,WAAW,EACXC,IAAI,EACJC,IAAI,EACJC,UAAU,EACVC,aAAa,EACb,GAAGT,OACO;IACV,MAAM,EAAE,SAASU,iBAAiB,EAAE,SAASC,iBAAiB,EAAE,GAAGH,cAAc,CAAC;IAClF,MAAMI,UAAUF,AAAsB,UAAtBA;IAEhB,MAAM,EAAEG,EAAE,EAAEC,WAAW,EAAEC,WAAW,EAAE,GAAGC,UAAUhB;IAEnD,IAAIS,AAAkB,WAAlBA,eACA,OAAO,WAAP,GACI,sCAAC;QAAI,WAAW;qBACZ,sCAACQ,0BAAwBA;QAAC,MAAMZ;QAAa,UAAUL,MAAM,QAAQ;sBACrE,sCAACD,6BAA2BA;QACvB,GAAGC,KAAK;QACR,GAAGa,EAAE;QACN,SAASD;QACT,eAAeE;QACf,eAAeC;sBAEnB,sCAACG,2BAAyBA;QACtB,MAAMP;QACN,SAASC;QACT,UAAUZ,MAAM,QAAQ;sBAE5B,sCAACmB,mBAAiBA;QAAC,MAAMb;QAAM,UAAUN,MAAM,QAAQ;;IAKnE,OAAO,WAAP,GACI,sCAAC;QAAI,WAAW;qBACZ,sCAACoB,oBAAkBA;QACf,MAAMb;QACN,oBAAM,sCAACN,OAAKA;YAAC,MAAMD,MAAM,KAAK;YAAE,OAAOa,GAAG,SAAS;;QACnD,UAAUb,MAAM,QAAQ;QACxB,UAAUA,MAAM,QAAQ;QACxB,SAASY;sBAEb,sCAACK,0BAAwBA;QAAC,MAAMZ;QAAa,UAAUL,MAAM,QAAQ;sBACrE,sCAACE,yBAAuBA;QACnB,GAAGF,KAAK;QACR,GAAGa,EAAE;QACN,eAAeC;QACf,eAAeC;sBAEnB,sCAACG,2BAAyBA;QACtB,MAAMP;QACN,SAASC;QACT,UAAUZ,MAAM,QAAQ;sBAE5B,sCAACmB,mBAAiBA;QAAC,MAAMb;QAAM,UAAUN,MAAM,QAAQ;;AAGnE;AACA,MAAMqB,SAASC,gBAAgB,UAAUlB"}
1
+ {"version":3,"file":"Slider/Slider.js","sources":["../../src/Slider/Slider.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { Label } from \"~/Label/index.js\";\nimport { makeDecoratable, generateId } from \"~/utils.js\";\nimport type { SliderPrimitiveProps, SliderPrimitiveRendererProps } from \"./primitives/index.js\";\nimport { SliderPrimitiveRenderer, useSlider, SliderValue } 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\n/**\n * Slider Renderer with side label\n */\ninterface SliderRendererWithSideValueProps extends SliderPrimitiveRendererProps {\n label?: React.ReactNode;\n /** The side label's id — the thumb names itself with it. */\n labelId?: string;\n invalid?: boolean;\n required?: boolean;\n}\n\nconst SliderRendererWithSideValue = (props: SliderRendererWithSideValueProps) => {\n return (\n <div className={\"w-full flex flex-row items-center justify-between\"}>\n <div className={\"basis-2/12 pr-sm\"}>\n <Label\n id={props.labelId}\n text={props.label}\n required={props.required}\n disabled={props.disabled}\n invalid={props.invalid}\n weight={\"light\"}\n />\n </div>\n <div className={\"basis-9/12\"}>\n <SliderPrimitiveRenderer {...props} aria-labelledby={props.labelId} />\n </div>\n <div className={\"basis-1/12 pl-sm text-right\"}>\n <SliderValue value={props.textValue} disabled={props.disabled} />\n </div>\n </div>\n );\n};\n\n/**\n * Slider\n */\ntype SliderProps = FormComponentProps &\n SliderPrimitiveProps & {\n labelPosition?: \"top\" | \"side\";\n };\n\nconst DecoratableSlider = ({\n description,\n note,\n hint,\n validation,\n labelPosition,\n ...props\n}: SliderProps) => {\n const { isValid: validationIsValid, message: validationMessage } = validation || {};\n const invalid = validationIsValid === false;\n /* The thumb (`role=slider`) can't be a `<label for>` target, so it names itself after the label. */\n const labelId = React.useMemo(() => `${generateId()}-label`, []);\n\n const { vm, changeValue, commitValue } = useSlider(props);\n\n if (labelPosition === \"side\") {\n return (\n <div className={\"w-full\"}>\n <FormComponentDescription text={description} disabled={props.disabled} />\n <SliderRendererWithSideValue\n {...props}\n labelId={labelId}\n {...vm}\n invalid={invalid}\n onValueChange={changeValue}\n onValueCommit={commitValue}\n />\n <FormComponentErrorMessage\n text={validationMessage}\n invalid={invalid}\n disabled={props.disabled}\n />\n <FormComponentNote text={note} disabled={props.disabled} />\n </div>\n );\n }\n\n return (\n <div className={\"w-full\"}>\n <FormComponentLabel\n labelId={labelId}\n hint={hint}\n text={<Label text={props.label} value={vm.textValue} />}\n disabled={props.disabled}\n required={props.required}\n invalid={invalid}\n />\n <FormComponentDescription text={description} disabled={props.disabled} />\n <SliderPrimitiveRenderer\n {...props}\n {...vm}\n aria-labelledby={labelId}\n onValueChange={changeValue}\n onValueCommit={commitValue}\n />\n <FormComponentErrorMessage\n text={validationMessage}\n invalid={invalid}\n disabled={props.disabled}\n />\n <FormComponentNote text={note} disabled={props.disabled} />\n </div>\n );\n};\nconst Slider = makeDecoratable(\"Slider\", DecoratableSlider);\n\nexport { Slider, type SliderProps };\n"],"names":["SliderRendererWithSideValue","props","Label","SliderPrimitiveRenderer","SliderValue","DecoratableSlider","description","note","hint","validation","labelPosition","validationIsValid","validationMessage","invalid","labelId","React","generateId","vm","changeValue","commitValue","useSlider","FormComponentDescription","FormComponentErrorMessage","FormComponentNote","FormComponentLabel","Slider","makeDecoratable"],"mappings":";;;;;AAwBA,MAAMA,8BAA8B,CAACC,QAC1B,WAAP,GACI,sCAAC;QAAI,WAAW;qBACZ,sCAAC;QAAI,WAAW;qBACZ,sCAACC,OAAKA;QACF,IAAID,MAAM,OAAO;QACjB,MAAMA,MAAM,KAAK;QACjB,UAAUA,MAAM,QAAQ;QACxB,UAAUA,MAAM,QAAQ;QACxB,SAASA,MAAM,OAAO;QACtB,QAAQ;uBAGhB,sCAAC;QAAI,WAAW;qBACZ,sCAACE,yBAAuBA;QAAE,GAAGF,KAAK;QAAE,mBAAiBA,MAAM,OAAO;uBAEtE,sCAAC;QAAI,WAAW;qBACZ,sCAACG,aAAWA;QAAC,OAAOH,MAAM,SAAS;QAAE,UAAUA,MAAM,QAAQ;;AAc7E,MAAMI,oBAAoB,CAAC,EACvBC,WAAW,EACXC,IAAI,EACJC,IAAI,EACJC,UAAU,EACVC,aAAa,EACb,GAAGT,OACO;IACV,MAAM,EAAE,SAASU,iBAAiB,EAAE,SAASC,iBAAiB,EAAE,GAAGH,cAAc,CAAC;IAClF,MAAMI,UAAUF,AAAsB,UAAtBA;IAEhB,MAAMG,UAAUC,wBAAAA,OAAa,CAAC,IAAM,GAAGC,aAAa,MAAM,CAAC,EAAE,EAAE;IAE/D,MAAM,EAAEC,EAAE,EAAEC,WAAW,EAAEC,WAAW,EAAE,GAAGC,UAAUnB;IAEnD,IAAIS,AAAkB,WAAlBA,eACA,OAAO,WAAP,GACI,sCAAC;QAAI,WAAW;qBACZ,sCAACW,0BAAwBA;QAAC,MAAMf;QAAa,UAAUL,MAAM,QAAQ;sBACrE,sCAACD,6BAA2BA;QACvB,GAAGC,KAAK;QACT,SAASa;QACR,GAAGG,EAAE;QACN,SAASJ;QACT,eAAeK;QACf,eAAeC;sBAEnB,sCAACG,2BAAyBA;QACtB,MAAMV;QACN,SAASC;QACT,UAAUZ,MAAM,QAAQ;sBAE5B,sCAACsB,mBAAiBA;QAAC,MAAMhB;QAAM,UAAUN,MAAM,QAAQ;;IAKnE,OAAO,WAAP,GACI,sCAAC;QAAI,WAAW;qBACZ,sCAACuB,oBAAkBA;QACf,SAASV;QACT,MAAMN;QACN,oBAAM,sCAACN,OAAKA;YAAC,MAAMD,MAAM,KAAK;YAAE,OAAOgB,GAAG,SAAS;;QACnD,UAAUhB,MAAM,QAAQ;QACxB,UAAUA,MAAM,QAAQ;QACxB,SAASY;sBAEb,sCAACQ,0BAAwBA;QAAC,MAAMf;QAAa,UAAUL,MAAM,QAAQ;sBACrE,sCAACE,yBAAuBA;QACnB,GAAGF,KAAK;QACR,GAAGgB,EAAE;QACN,mBAAiBH;QACjB,eAAeI;QACf,eAAeC;sBAEnB,sCAACG,2BAAyBA;QACtB,MAAMV;QACN,SAASC;QACT,UAAUZ,MAAM,QAAQ;sBAE5B,sCAACsB,mBAAiBA;QAAC,MAAMhB;QAAM,UAAUN,MAAM,QAAQ;;AAGnE;AACA,MAAMwB,SAASC,gBAAgB,UAAUrB"}
@@ -5,7 +5,7 @@ type SliderRootProps = Omit<SliderPrimitives.SliderProps, "min"> & {
5
5
  min: number;
6
6
  };
7
7
  type SliderPrimitiveRendererProps = SliderRootProps & SliderThumbProps;
8
- declare const SliderPrimitiveRenderer: ({ tooltipSide, textValue, showTooltip, ...sliderProps }: SliderPrimitiveVm) => React.JSX.Element;
8
+ declare const SliderPrimitiveRenderer: ({ tooltipSide, textValue, showTooltip, "aria-labelledby": labelledBy, ...sliderProps }: SliderPrimitiveVm) => React.JSX.Element;
9
9
  interface SliderPrimitiveProps extends Omit<SliderPrimitives.SliderProps, "defaultValue" | "value" | "onValueChange" | "onValueCommit"> {
10
10
  onValueChange: (value: number) => void;
11
11
  onValueCommit?: (value: number) => void;
@@ -1,9 +1,10 @@
1
1
  import { useSlider } from "./useSlider.js";
2
2
  import { SliderRoot, SliderThumb, SliderTrack } from "./components/index.js";
3
3
  import * as __rspack_external_react from "react";
4
- const SliderPrimitiveRenderer = ({ tooltipSide, textValue, showTooltip, ...sliderProps })=>/*#__PURE__*/ __rspack_external_react.createElement("div", {
4
+ const SliderPrimitiveRenderer = ({ tooltipSide, textValue, showTooltip, "aria-labelledby": labelledBy, ...sliderProps })=>/*#__PURE__*/ __rspack_external_react.createElement("div", {
5
5
  className: "flex h-md w-full"
6
6
  }, /*#__PURE__*/ __rspack_external_react.createElement(SliderRoot, sliderProps, /*#__PURE__*/ __rspack_external_react.createElement(SliderTrack, null), /*#__PURE__*/ __rspack_external_react.createElement(SliderThumb, {
7
+ "aria-labelledby": labelledBy,
7
8
  textValue: textValue,
8
9
  showTooltip: showTooltip,
9
10
  tooltipSide: tooltipSide
@@ -1 +1 @@
1
- {"version":3,"file":"Slider/primitives/SliderPrimitive.js","sources":["../../../src/Slider/primitives/SliderPrimitive.tsx"],"sourcesContent":["import * as React from \"react\";\nimport type { Slider as SliderPrimitives } from \"radix-ui\";\nimport { useSlider } from \"./useSlider.js\";\nimport { SliderRoot, SliderThumb, SliderTrack, type SliderThumbProps } from \"./components/index.js\";\n\ntype SliderRootProps = Omit<SliderPrimitives.SliderProps, \"min\"> & {\n min: number;\n};\n\ntype SliderPrimitiveRendererProps = SliderRootProps & SliderThumbProps;\n\nconst SliderPrimitiveRenderer = ({\n tooltipSide,\n textValue,\n showTooltip,\n ...sliderProps\n}: SliderPrimitiveVm) => {\n return (\n <div className={\"flex h-md w-full\"}>\n <SliderRoot {...sliderProps}>\n <SliderTrack />\n <SliderThumb\n textValue={textValue}\n showTooltip={showTooltip}\n tooltipSide={tooltipSide}\n />\n </SliderRoot>\n </div>\n );\n};\n\ninterface SliderPrimitiveProps extends Omit<\n SliderPrimitives.SliderProps,\n \"defaultValue\" | \"value\" | \"onValueChange\" | \"onValueCommit\"\n> {\n onValueChange: (value: number) => void;\n onValueCommit?: (value: number) => void;\n showTooltip?: boolean;\n tooltipSide?: \"top\" | \"bottom\";\n transformValue?: (value: number) => string;\n value?: number;\n}\n\ntype SliderPrimitiveVm = SliderRootProps & SliderThumbProps;\n\nconst SliderPrimitive = (props: SliderPrimitiveProps) => {\n const { transformValue, ...restProps } = props;\n const { vm, changeValue, commitValue } = useSlider({ ...restProps, transformValue });\n\n return (\n <SliderPrimitiveRenderer\n {...restProps}\n {...vm}\n onValueChange={changeValue}\n onValueCommit={commitValue}\n />\n );\n};\n\nexport {\n SliderPrimitive,\n SliderPrimitiveRenderer,\n type SliderPrimitiveVm,\n type SliderPrimitiveProps,\n type SliderPrimitiveRendererProps\n};\n"],"names":["SliderPrimitiveRenderer","tooltipSide","textValue","showTooltip","sliderProps","SliderRoot","SliderTrack","SliderThumb","SliderPrimitive","props","transformValue","restProps","vm","changeValue","commitValue","useSlider"],"mappings":";;;AAWA,MAAMA,0BAA0B,CAAC,EAC7BC,WAAW,EACXC,SAAS,EACTC,WAAW,EACX,GAAGC,aACa,GACT,WAAP,GACI,sCAAC;QAAI,WAAW;qBACZ,sCAACC,YAAeD,aAAAA,WAAAA,GACZ,sCAACE,aAAWA,OAAAA,WAAAA,GACZ,sCAACC,aAAWA;QACR,WAAWL;QACX,aAAaC;QACb,aAAaF;;AAqBjC,MAAMO,kBAAkB,CAACC;IACrB,MAAM,EAAEC,cAAc,EAAE,GAAGC,WAAW,GAAGF;IACzC,MAAM,EAAEG,EAAE,EAAEC,WAAW,EAAEC,WAAW,EAAE,GAAGC,UAAU;QAAE,GAAGJ,SAAS;QAAED;IAAe;IAElF,OAAO,WAAP,GACI,sCAACV,yBAAuBA;QACnB,GAAGW,SAAS;QACZ,GAAGC,EAAE;QACN,eAAeC;QACf,eAAeC;;AAG3B"}
1
+ {"version":3,"file":"Slider/primitives/SliderPrimitive.js","sources":["../../../src/Slider/primitives/SliderPrimitive.tsx"],"sourcesContent":["import * as React from \"react\";\nimport type { Slider as SliderPrimitives } from \"radix-ui\";\nimport { useSlider } from \"./useSlider.js\";\nimport { SliderRoot, SliderThumb, SliderTrack, type SliderThumbProps } from \"./components/index.js\";\n\ntype SliderRootProps = Omit<SliderPrimitives.SliderProps, \"min\"> & {\n min: number;\n};\n\ntype SliderPrimitiveRendererProps = SliderRootProps & SliderThumbProps;\n\nconst SliderPrimitiveRenderer = ({\n tooltipSide,\n textValue,\n showTooltip,\n \"aria-labelledby\": labelledBy,\n ...sliderProps\n}: SliderPrimitiveVm) => {\n return (\n <div className={\"flex h-md w-full\"}>\n <SliderRoot {...sliderProps}>\n <SliderTrack />\n <SliderThumb\n aria-labelledby={labelledBy}\n textValue={textValue}\n showTooltip={showTooltip}\n tooltipSide={tooltipSide}\n />\n </SliderRoot>\n </div>\n );\n};\n\ninterface SliderPrimitiveProps extends Omit<\n SliderPrimitives.SliderProps,\n \"defaultValue\" | \"value\" | \"onValueChange\" | \"onValueCommit\"\n> {\n onValueChange: (value: number) => void;\n onValueCommit?: (value: number) => void;\n showTooltip?: boolean;\n tooltipSide?: \"top\" | \"bottom\";\n transformValue?: (value: number) => string;\n value?: number;\n}\n\ntype SliderPrimitiveVm = SliderRootProps & SliderThumbProps;\n\nconst SliderPrimitive = (props: SliderPrimitiveProps) => {\n const { transformValue, ...restProps } = props;\n const { vm, changeValue, commitValue } = useSlider({\n ...restProps,\n transformValue\n });\n\n return (\n <SliderPrimitiveRenderer\n {...restProps}\n {...vm}\n onValueChange={changeValue}\n onValueCommit={commitValue}\n />\n );\n};\n\nexport {\n SliderPrimitive,\n SliderPrimitiveRenderer,\n type SliderPrimitiveVm,\n type SliderPrimitiveProps,\n type SliderPrimitiveRendererProps\n};\n"],"names":["SliderPrimitiveRenderer","tooltipSide","textValue","showTooltip","labelledBy","sliderProps","SliderRoot","SliderTrack","SliderThumb","SliderPrimitive","props","transformValue","restProps","vm","changeValue","commitValue","useSlider"],"mappings":";;;AAWA,MAAMA,0BAA0B,CAAC,EAC7BC,WAAW,EACXC,SAAS,EACTC,WAAW,EACX,mBAAmBC,UAAU,EAC7B,GAAGC,aACa,GACT,WAAP,GACI,sCAAC;QAAI,WAAW;qBACZ,sCAACC,YAAeD,aAAAA,WAAAA,GACZ,sCAACE,aAAWA,OAAAA,WAAAA,GACZ,sCAACC,aAAWA;QACR,mBAAiBJ;QACjB,WAAWF;QACX,aAAaC;QACb,aAAaF;;AAqBjC,MAAMQ,kBAAkB,CAACC;IACrB,MAAM,EAAEC,cAAc,EAAE,GAAGC,WAAW,GAAGF;IACzC,MAAM,EAAEG,EAAE,EAAEC,WAAW,EAAEC,WAAW,EAAE,GAAGC,UAAU;QAC/C,GAAGJ,SAAS;QACZD;IACJ;IAEA,OAAO,WAAP,GACI,sCAACX,yBAAuBA;QACnB,GAAGY,SAAS;QACZ,GAAGC,EAAE;QACN,eAAeC;QACf,eAAeC;;AAG3B"}
@@ -1,5 +1,8 @@
1
1
  import * as React from "react";
2
2
  import type { SliderTooltipProps } from "./SliderTooltip.js";
3
- type SliderThumbProps = SliderTooltipProps;
4
- declare const SliderThumb: ({ textValue, showTooltip, tooltipSide }: SliderThumbProps) => React.JSX.Element;
3
+ type SliderThumbProps = SliderTooltipProps & {
4
+ /** The thumb is the `role=slider` element, so it carries the label's id — not the root. */
5
+ "aria-labelledby"?: string;
6
+ };
7
+ declare const SliderThumb: ({ textValue, showTooltip, tooltipSide, "aria-labelledby": labelledBy }: SliderThumbProps) => React.JSX.Element;
5
8
  export { SliderThumb, type SliderThumbProps };
@@ -2,7 +2,8 @@ import { Slider } from "radix-ui";
2
2
  import { cn } from "../../../utils.js";
3
3
  import { SliderTooltip } from "./SliderTooltip.js";
4
4
  import * as __rspack_external_react from "react";
5
- const SliderThumb = ({ textValue, showTooltip, tooltipSide })=>/*#__PURE__*/ __rspack_external_react.createElement(Slider.Thumb, {
5
+ const SliderThumb = ({ textValue, showTooltip, tooltipSide, "aria-labelledby": labelledBy })=>/*#__PURE__*/ __rspack_external_react.createElement(Slider.Thumb, {
6
+ "aria-labelledby": labelledBy,
6
7
  className: cn("inline-block w-md h-md mt-xs-plus rounded-xxl border-md transition-colors outline-none", "bg-primary border-white", "hover:bg-primary-strong", "active:bg-primary", "data-disabled:pointer-events-none data-disabled:bg-primary-disabled")
7
8
  }, /*#__PURE__*/ __rspack_external_react.createElement(SliderTooltip, {
8
9
  showTooltip: showTooltip,
@@ -1 +1 @@
1
- {"version":3,"file":"Slider/primitives/components/SliderThumb.js","sources":["../../../../src/Slider/primitives/components/SliderThumb.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { Slider as SliderPrimitives } from \"radix-ui\";\nimport { cn } from \"~/utils.js\";\nimport type { SliderTooltipProps } from \"./SliderTooltip.js\";\nimport { SliderTooltip } from \"./SliderTooltip.js\";\n\ntype SliderThumbProps = SliderTooltipProps;\n\nconst SliderThumb = ({ textValue, showTooltip, tooltipSide }: SliderThumbProps) => (\n <SliderPrimitives.Thumb\n className={cn(\n \"inline-block w-md h-md mt-xs-plus rounded-xxl border-md transition-colors outline-none\",\n \"bg-primary border-white\",\n \"hover:bg-primary-strong\",\n \"active:bg-primary\",\n \"data-disabled:pointer-events-none data-disabled:bg-primary-disabled\"\n )}\n >\n <SliderTooltip showTooltip={showTooltip} textValue={textValue} tooltipSide={tooltipSide} />\n </SliderPrimitives.Thumb>\n);\n\nexport { SliderThumb, type SliderThumbProps };\n"],"names":["SliderThumb","textValue","showTooltip","tooltipSide","SliderPrimitives","cn","SliderTooltip"],"mappings":";;;;AAQA,MAAMA,cAAc,CAAC,EAAEC,SAAS,EAAEC,WAAW,EAAEC,WAAW,EAAoB,iBAC1E,sCAACC,OAAAA,KAAsB;QACnB,WAAWC,GACP,0FACA,2BACA,2BACA,qBACA;qBAGJ,sCAACC,eAAaA;QAAC,aAAaJ;QAAa,WAAWD;QAAW,aAAaE"}
1
+ {"version":3,"file":"Slider/primitives/components/SliderThumb.js","sources":["../../../../src/Slider/primitives/components/SliderThumb.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { Slider as SliderPrimitives } from \"radix-ui\";\nimport { cn } from \"~/utils.js\";\nimport type { SliderTooltipProps } from \"./SliderTooltip.js\";\nimport { SliderTooltip } from \"./SliderTooltip.js\";\n\ntype SliderThumbProps = SliderTooltipProps & {\n /** The thumb is the `role=slider` element, so it carries the label's id — not the root. */\n \"aria-labelledby\"?: string;\n};\n\nconst SliderThumb = ({\n textValue,\n showTooltip,\n tooltipSide,\n \"aria-labelledby\": labelledBy\n}: SliderThumbProps) => (\n <SliderPrimitives.Thumb\n aria-labelledby={labelledBy}\n className={cn(\n \"inline-block w-md h-md mt-xs-plus rounded-xxl border-md transition-colors outline-none\",\n \"bg-primary border-white\",\n \"hover:bg-primary-strong\",\n \"active:bg-primary\",\n \"data-disabled:pointer-events-none data-disabled:bg-primary-disabled\"\n )}\n >\n <SliderTooltip showTooltip={showTooltip} textValue={textValue} tooltipSide={tooltipSide} />\n </SliderPrimitives.Thumb>\n);\n\nexport { SliderThumb, type SliderThumbProps };\n"],"names":["SliderThumb","textValue","showTooltip","tooltipSide","labelledBy","SliderPrimitives","cn","SliderTooltip"],"mappings":";;;;AAWA,MAAMA,cAAc,CAAC,EACjBC,SAAS,EACTC,WAAW,EACXC,WAAW,EACX,mBAAmBC,UAAU,EACd,iBACf,sCAACC,OAAAA,KAAsB;QACnB,mBAAiBD;QACjB,WAAWE,GACP,0FACA,2BACA,2BACA,qBACA;qBAGJ,sCAACC,eAAaA;QAAC,aAAaL;QAAa,WAAWD;QAAW,aAAaE"}
@@ -1,8 +1,8 @@
1
1
  import React from "react";
2
2
  import type { SwitchPrimitiveProps } from "./primitives/index.js";
3
- import type { FormComponentProps } from "../FormComponent/index.js";
4
- type SwitchProps = SwitchPrimitiveProps & FormComponentProps;
5
- declare const DecoratableSwitch: ({ note, validation, ...props }: SwitchProps) => React.JSX.Element;
3
+ import { type FormComponentProps } from "../FormComponent/index.js";
4
+ type SwitchProps = Omit<SwitchPrimitiveProps, "label"> & FormComponentProps;
5
+ declare const DecoratableSwitch: ({ label, description, hint, note, required, disabled, validation, ...props }: SwitchProps) => React.JSX.Element;
6
6
  declare const Switch: typeof DecoratableSwitch & {
7
7
  original: typeof DecoratableSwitch;
8
8
  originalName: string;
@@ -22,4 +22,4 @@ declare const Switch: typeof DecoratableSwitch & {
22
22
  displayName: string;
23
23
  }>) => (props: unknown) => React.JSX.Element;
24
24
  };
25
- export { Switch };
25
+ export { Switch, type SwitchProps };
package/Switch/Switch.js CHANGED
@@ -1,24 +1,38 @@
1
1
  import react, { useMemo } from "react";
2
- import { makeDecoratable } from "../utils.js";
2
+ import { generateId, makeDecoratable } from "../utils.js";
3
3
  import { SwitchPrimitive } from "./primitives/index.js";
4
- import { FormComponentErrorMessage, FormComponentNote } from "../FormComponent/index.js";
5
- const DecoratableSwitch = ({ note, validation, ...props })=>{
4
+ import { FormComponentDescription, FormComponentErrorMessage, FormComponentLabel, FormComponentNote } from "../FormComponent/index.js";
5
+ const DecoratableSwitch = ({ label, description, hint, note, required, disabled, validation, ...props })=>{
6
6
  const { isValid: validationIsValid, message: validationMessage } = validation || {};
7
+ const id = useMemo(()=>generateId(props.id), [
8
+ props.id
9
+ ]);
7
10
  const invalid = useMemo(()=>false === validationIsValid, [
8
11
  validationIsValid
9
12
  ]);
10
13
  return /*#__PURE__*/ react.createElement("div", {
11
14
  className: "w-full"
12
- }, /*#__PURE__*/ react.createElement(SwitchPrimitive, {
15
+ }, /*#__PURE__*/ react.createElement(FormComponentLabel, {
16
+ htmlFor: id,
17
+ text: label,
18
+ required: required,
19
+ disabled: disabled,
20
+ invalid: invalid,
21
+ hint: hint
22
+ }), /*#__PURE__*/ react.createElement(FormComponentDescription, {
23
+ text: description,
24
+ disabled: disabled
25
+ }), /*#__PURE__*/ react.createElement(SwitchPrimitive, {
13
26
  ...props,
14
- disabled: props.disabled
27
+ id: id,
28
+ disabled: disabled
15
29
  }), /*#__PURE__*/ react.createElement(FormComponentErrorMessage, {
16
30
  text: validationMessage,
17
31
  invalid: invalid,
18
- disabled: props.disabled
32
+ disabled: disabled
19
33
  }), /*#__PURE__*/ react.createElement(FormComponentNote, {
20
34
  text: note,
21
- disabled: props.disabled
35
+ disabled: disabled
22
36
  }));
23
37
  };
24
38
  const Switch = makeDecoratable("Switch", DecoratableSwitch);
@@ -1 +1 @@
1
- {"version":3,"file":"Switch/Switch.js","sources":["../../src/Switch/Switch.tsx"],"sourcesContent":["import React, { useMemo } from \"react\";\nimport { makeDecoratable } from \"~/utils.js\";\nimport type { SwitchPrimitiveProps } from \"./primitives/index.js\";\nimport { SwitchPrimitive } from \"./primitives/index.js\";\nimport type { FormComponentProps } from \"~/FormComponent/index.js\";\nimport { FormComponentErrorMessage, FormComponentNote } from \"~/FormComponent/index.js\";\n\ntype SwitchProps = SwitchPrimitiveProps & FormComponentProps;\n\nconst DecoratableSwitch = ({ note, validation, ...props }: SwitchProps) => {\n const { isValid: validationIsValid, message: validationMessage } = validation || {};\n const invalid = useMemo(() => validationIsValid === false, [validationIsValid]);\n\n return (\n <div className={\"w-full\"}>\n <SwitchPrimitive {...props} disabled={props.disabled} />\n <FormComponentErrorMessage\n text={validationMessage}\n invalid={invalid}\n disabled={props.disabled}\n />\n <FormComponentNote text={note} disabled={props.disabled} />\n </div>\n );\n};\n\nconst Switch = makeDecoratable(\"Switch\", DecoratableSwitch);\n\nexport { Switch };\n"],"names":["DecoratableSwitch","note","validation","props","validationIsValid","validationMessage","invalid","useMemo","SwitchPrimitive","FormComponentErrorMessage","FormComponentNote","Switch","makeDecoratable"],"mappings":";;;;AASA,MAAMA,oBAAoB,CAAC,EAAEC,IAAI,EAAEC,UAAU,EAAE,GAAGC,OAAoB;IAClE,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,iBAAeA;QAAE,GAAGL,KAAK;QAAE,UAAUA,MAAM,QAAQ;sBACpD,oBAACM,2BAAyBA;QACtB,MAAMJ;QACN,SAASC;QACT,UAAUH,MAAM,QAAQ;sBAE5B,oBAACO,mBAAiBA;QAAC,MAAMT;QAAM,UAAUE,MAAM,QAAQ;;AAGnE;AAEA,MAAMQ,SAASC,gBAAgB,UAAUZ"}
1
+ {"version":3,"file":"Switch/Switch.js","sources":["../../src/Switch/Switch.tsx"],"sourcesContent":["import React, { useMemo } from \"react\";\nimport { generateId, makeDecoratable } from \"~/utils.js\";\nimport type { SwitchPrimitiveProps } from \"./primitives/index.js\";\nimport { SwitchPrimitive } from \"./primitives/index.js\";\nimport {\n FormComponentDescription,\n FormComponentErrorMessage,\n FormComponentLabel,\n FormComponentNote,\n type FormComponentProps\n} from \"~/FormComponent/index.js\";\n\ntype SwitchProps = Omit<SwitchPrimitiveProps, \"label\"> & FormComponentProps;\n\nconst DecoratableSwitch = ({\n label,\n description,\n hint,\n note,\n required,\n disabled,\n validation,\n ...props\n}: SwitchProps) => {\n const { isValid: validationIsValid, message: validationMessage } = validation || {};\n const id = useMemo(() => generateId(props.id), [props.id]);\n const invalid = useMemo(() => validationIsValid === false, [validationIsValid]);\n\n return (\n <div className={\"w-full\"}>\n <FormComponentLabel\n htmlFor={id}\n text={label}\n required={required}\n disabled={disabled}\n invalid={invalid}\n hint={hint}\n />\n <FormComponentDescription text={description} disabled={disabled} />\n <SwitchPrimitive {...props} id={id} disabled={disabled} />\n <FormComponentErrorMessage\n text={validationMessage}\n invalid={invalid}\n disabled={disabled}\n />\n <FormComponentNote text={note} disabled={disabled} />\n </div>\n );\n};\n\nconst Switch = makeDecoratable(\"Switch\", DecoratableSwitch);\n\nexport { Switch, type SwitchProps };\n"],"names":["DecoratableSwitch","label","description","hint","note","required","disabled","validation","props","validationIsValid","validationMessage","id","useMemo","generateId","invalid","FormComponentLabel","FormComponentDescription","SwitchPrimitive","FormComponentErrorMessage","FormComponentNote","Switch","makeDecoratable"],"mappings":";;;;AAcA,MAAMA,oBAAoB,CAAC,EACvBC,KAAK,EACLC,WAAW,EACXC,IAAI,EACJC,IAAI,EACJC,QAAQ,EACRC,QAAQ,EACRC,UAAU,EACV,GAAGC,OACO;IACV,MAAM,EAAE,SAASC,iBAAiB,EAAE,SAASC,iBAAiB,EAAE,GAAGH,cAAc,CAAC;IAClF,MAAMI,KAAKC,QAAQ,IAAMC,WAAWL,MAAM,EAAE,GAAG;QAACA,MAAM,EAAE;KAAC;IACzD,MAAMM,UAAUF,QAAQ,IAAMH,AAAsB,UAAtBA,mBAA6B;QAACA;KAAkB;IAE9E,OAAO,WAAP,GACI,oBAAC;QAAI,WAAW;qBACZ,oBAACM,oBAAkBA;QACf,SAASJ;QACT,MAAMV;QACN,UAAUI;QACV,UAAUC;QACV,SAASQ;QACT,MAAMX;sBAEV,oBAACa,0BAAwBA;QAAC,MAAMd;QAAa,UAAUI;sBACvD,oBAACW,iBAAeA;QAAE,GAAGT,KAAK;QAAE,IAAIG;QAAI,UAAUL;sBAC9C,oBAACY,2BAAyBA;QACtB,MAAMR;QACN,SAASI;QACT,UAAUR;sBAEd,oBAACa,mBAAiBA;QAAC,MAAMf;QAAM,UAAUE;;AAGrD;AAEA,MAAMc,SAASC,gBAAgB,UAAUrB"}
@@ -1,7 +1,7 @@
1
1
  import type React from "react";
2
2
  export interface SwitchItemDto {
3
3
  id?: string;
4
- label: React.ReactNode;
4
+ label?: React.ReactNode;
5
5
  value?: number | string | boolean;
6
6
  checked?: boolean;
7
7
  disabled?: boolean;
@@ -18,7 +18,7 @@ const SwitchRenderer = ({ id, label, changeChecked, description, className, labe
18
18
  className: cn(switchVariants({
19
19
  labelPosition
20
20
  }), className)
21
- }, /*#__PURE__*/ __rspack_external_react.createElement(Label, {
21
+ }, label && /*#__PURE__*/ __rspack_external_react.createElement(Label, {
22
22
  htmlFor: id,
23
23
  text: label,
24
24
  disabled: disabled,
@@ -30,10 +30,11 @@ const SwitchRenderer = ({ id, label, changeChecked, description, className, labe
30
30
  id: id,
31
31
  checked: checked,
32
32
  className: cn([
33
- "peer inline-flex h-md w-[26px] mt-xxs shrink-0 cursor-pointer items-center rounded-xxl border-sm transition-colors",
33
+ "peer inline-flex h-md w-[26px] shrink-0 cursor-pointer items-center rounded-xxl border-sm transition-colors",
34
34
  "border-transparent data-[state=checked]:bg-secondary data-[state=unchecked]:bg-neutral-strong",
35
35
  "focus-visible:outline-none focus-visible:border-success focus-visible:ring-lg focus-visible:ring-primary-dimmed",
36
- "disabled:cursor-not-allowed disabled:bg-neutral-muted disabled:data-[state=checked]:bg-neutral-muted"
36
+ "disabled:cursor-not-allowed disabled:bg-neutral-muted disabled:data-[state=checked]:bg-neutral-muted",
37
+ label && "mt-xxs"
37
38
  ]),
38
39
  disabled: disabled,
39
40
  onCheckedChange: changeChecked
@@ -1 +1 @@
1
- {"version":3,"file":"Switch/primitives/SwitchPrimitive.js","sources":["../../../src/Switch/primitives/SwitchPrimitive.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { Switch as SwitchPrimitives } from \"radix-ui\";\nimport { cn, cva, makeDecoratable, type VariantProps } from \"~/utils.js\";\nimport { Label } from \"~/Label/index.js\";\nimport { useSwitch } from \"./useSwitch.js\";\nimport type { SwitchItemDto, SwitchItemFormatted } from \"../domains/index.js\";\n\n/**\n * Switch Renderer\n */\n\nconst switchVariants = cva(\"inline-flex items-start space-x-sm\", {\n variants: {\n labelPosition: {\n start: \"\",\n end: \"flex-row-reverse space-x-sm-extra space-x-reverse\"\n }\n },\n defaultVariants: {\n labelPosition: \"start\"\n }\n});\n\ntype SwitchPrimitiveProps = Omit<\n SwitchPrimitives.SwitchProps,\n \"defaultChecked\" | \"onCheckedChange\" | \"onChange\"\n> &\n VariantProps<typeof switchVariants> &\n SwitchItemDto & {\n onChange?: (checked: boolean) => void;\n };\n\ntype SwitchPrimitivVm = {\n item?: SwitchItemFormatted;\n};\n\ntype SwitchRendererProps = Omit<SwitchPrimitiveProps, \"onCheckedChange\"> &\n NonNullable<SwitchPrimitivVm[\"item\"]> & {\n changeChecked: (checked: boolean) => void;\n description?: React.ReactNode;\n };\n\nconst SwitchRenderer = ({\n id,\n label,\n changeChecked,\n description,\n className,\n labelPosition,\n disabled,\n required,\n checked\n}: SwitchRendererProps) => {\n return (\n <div className={cn(switchVariants({ labelPosition }), className)}>\n <Label\n htmlFor={id}\n text={label}\n disabled={disabled}\n required={required}\n hint={description}\n weight={\"light\"}\n className={\"text-md\"}\n />\n <SwitchPrimitives.Root\n id={id}\n checked={checked}\n className={cn([\n \"peer inline-flex h-md w-[26px] mt-xxs shrink-0 cursor-pointer items-center rounded-xxl border-sm transition-colors\",\n \"border-transparent data-[state=checked]:bg-secondary data-[state=unchecked]:bg-neutral-strong\",\n \"focus-visible:outline-none focus-visible:border-success focus-visible:ring-lg focus-visible:ring-primary-dimmed\",\n \"disabled:cursor-not-allowed disabled:bg-neutral-muted disabled:data-[state=checked]:bg-neutral-muted\"\n ])}\n disabled={disabled}\n onCheckedChange={changeChecked}\n >\n <SwitchPrimitives.Thumb\n className={cn(\n \"pointer-events-none block h-sm-plus w-sm-plus rounded-xxl bg-neutral-base shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-sm-extra data-[state=unchecked]:translate-x-xxs\"\n )}\n />\n </SwitchPrimitives.Root>\n </div>\n );\n};\n\n/**\n * Switch\n */\nconst DecoratableSwitchPrimitive = (props: SwitchPrimitiveProps) => {\n const { vm, changeChecked } = useSwitch(props);\n\n if (!vm.item) {\n return null;\n }\n\n return <SwitchRenderer {...props} {...vm.item} changeChecked={changeChecked} />;\n};\nconst SwitchPrimitive = makeDecoratable(\"SwitchPrimitive\", DecoratableSwitchPrimitive);\n\nexport { SwitchPrimitive, type SwitchPrimitiveProps, type SwitchPrimitivVm };\n"],"names":["switchVariants","cva","SwitchRenderer","id","label","changeChecked","description","className","labelPosition","disabled","required","checked","cn","Label","SwitchPrimitives","DecoratableSwitchPrimitive","props","vm","useSwitch","SwitchPrimitive","makeDecoratable"],"mappings":";;;;;AAWA,MAAMA,iBAAiBC,IAAI,sCAAsC;IAC7D,UAAU;QACN,eAAe;YACX,OAAO;YACP,KAAK;QACT;IACJ;IACA,iBAAiB;QACb,eAAe;IACnB;AACJ;AAqBA,MAAMC,iBAAiB,CAAC,EACpBC,EAAE,EACFC,KAAK,EACLC,aAAa,EACbC,WAAW,EACXC,SAAS,EACTC,aAAa,EACbC,QAAQ,EACRC,QAAQ,EACRC,OAAO,EACW,GACX,WAAP,GACI,sCAAC;QAAI,WAAWC,GAAGZ,eAAe;YAAEQ;QAAc,IAAID;qBAClD,sCAACM,OAAKA;QACF,SAASV;QACT,MAAMC;QACN,UAAUK;QACV,UAAUC;QACV,MAAMJ;QACN,QAAQ;QACR,WAAW;sBAEf,sCAACQ,OAAAA,IAAqB;QAClB,IAAIX;QACJ,SAASQ;QACT,WAAWC,GAAG;YACV;YACA;YACA;YACA;SACH;QACD,UAAUH;QACV,iBAAiBJ;qBAEjB,sCAACS,OAAAA,KAAsB;QACnB,WAAWF,GACP;;AAWxB,MAAMG,6BAA6B,CAACC;IAChC,MAAM,EAAEC,EAAE,EAAEZ,aAAa,EAAE,GAAGa,UAAUF;IAExC,IAAI,CAACC,GAAG,IAAI,EACR,OAAO;IAGX,OAAO,WAAP,GAAO,sCAACf,gBAAcA;QAAE,GAAGc,KAAK;QAAG,GAAGC,GAAG,IAAI;QAAE,eAAeZ;;AAClE;AACA,MAAMc,kBAAkBC,gBAAgB,mBAAmBL"}
1
+ {"version":3,"file":"Switch/primitives/SwitchPrimitive.js","sources":["../../../src/Switch/primitives/SwitchPrimitive.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { Switch as SwitchPrimitives } from \"radix-ui\";\nimport { cn, cva, makeDecoratable, type VariantProps } from \"~/utils.js\";\nimport { Label } from \"~/Label/index.js\";\nimport { useSwitch } from \"./useSwitch.js\";\nimport type { SwitchItemDto, SwitchItemFormatted } from \"../domains/index.js\";\n\n/**\n * Switch Renderer\n */\n\nconst switchVariants = cva(\"inline-flex items-start space-x-sm\", {\n variants: {\n labelPosition: {\n start: \"\",\n end: \"flex-row-reverse space-x-sm-extra space-x-reverse\"\n }\n },\n defaultVariants: {\n labelPosition: \"start\"\n }\n});\n\ntype SwitchPrimitiveProps = Omit<\n SwitchPrimitives.SwitchProps,\n \"defaultChecked\" | \"onCheckedChange\" | \"onChange\"\n> &\n VariantProps<typeof switchVariants> &\n SwitchItemDto & {\n onChange?: (checked: boolean) => void;\n };\n\ntype SwitchPrimitivVm = {\n item?: SwitchItemFormatted;\n};\n\ntype SwitchRendererProps = Omit<SwitchPrimitiveProps, \"onCheckedChange\"> &\n NonNullable<SwitchPrimitivVm[\"item\"]> & {\n changeChecked: (checked: boolean) => void;\n description?: React.ReactNode;\n };\n\nconst SwitchRenderer = ({\n id,\n label,\n changeChecked,\n description,\n className,\n labelPosition,\n disabled,\n required,\n checked\n}: SwitchRendererProps) => {\n return (\n <div className={cn(switchVariants({ labelPosition }), className)}>\n {label && (\n <Label\n htmlFor={id}\n text={label}\n disabled={disabled}\n required={required}\n hint={description}\n weight={\"light\"}\n className={\"text-md\"}\n />\n )}\n <SwitchPrimitives.Root\n id={id}\n checked={checked}\n className={cn([\n \"peer inline-flex h-md w-[26px] shrink-0 cursor-pointer items-center rounded-xxl border-sm transition-colors\",\n \"border-transparent data-[state=checked]:bg-secondary data-[state=unchecked]:bg-neutral-strong\",\n \"focus-visible:outline-none focus-visible:border-success focus-visible:ring-lg focus-visible:ring-primary-dimmed\",\n \"disabled:cursor-not-allowed disabled:bg-neutral-muted disabled:data-[state=checked]:bg-neutral-muted\",\n // Nudges the switch down to line up with the inline label's text.\n label && \"mt-xxs\"\n ])}\n disabled={disabled}\n onCheckedChange={changeChecked}\n >\n <SwitchPrimitives.Thumb\n className={cn(\n \"pointer-events-none block h-sm-plus w-sm-plus rounded-xxl bg-neutral-base shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-sm-extra data-[state=unchecked]:translate-x-xxs\"\n )}\n />\n </SwitchPrimitives.Root>\n </div>\n );\n};\n\n/**\n * Switch\n */\nconst DecoratableSwitchPrimitive = (props: SwitchPrimitiveProps) => {\n const { vm, changeChecked } = useSwitch(props);\n\n if (!vm.item) {\n return null;\n }\n\n return <SwitchRenderer {...props} {...vm.item} changeChecked={changeChecked} />;\n};\nconst SwitchPrimitive = makeDecoratable(\"SwitchPrimitive\", DecoratableSwitchPrimitive);\n\nexport { SwitchPrimitive, type SwitchPrimitiveProps, type SwitchPrimitivVm };\n"],"names":["switchVariants","cva","SwitchRenderer","id","label","changeChecked","description","className","labelPosition","disabled","required","checked","cn","Label","SwitchPrimitives","DecoratableSwitchPrimitive","props","vm","useSwitch","SwitchPrimitive","makeDecoratable"],"mappings":";;;;;AAWA,MAAMA,iBAAiBC,IAAI,sCAAsC;IAC7D,UAAU;QACN,eAAe;YACX,OAAO;YACP,KAAK;QACT;IACJ;IACA,iBAAiB;QACb,eAAe;IACnB;AACJ;AAqBA,MAAMC,iBAAiB,CAAC,EACpBC,EAAE,EACFC,KAAK,EACLC,aAAa,EACbC,WAAW,EACXC,SAAS,EACTC,aAAa,EACbC,QAAQ,EACRC,QAAQ,EACRC,OAAO,EACW,GACX,WAAP,GACI,sCAAC;QAAI,WAAWC,GAAGZ,eAAe;YAAEQ;QAAc,IAAID;OACjDH,SAAS,WAATA,GACG,sCAACS,OAAKA;QACF,SAASV;QACT,MAAMC;QACN,UAAUK;QACV,UAAUC;QACV,MAAMJ;QACN,QAAQ;QACR,WAAW;sBAGnB,sCAACQ,OAAAA,IAAqB;QAClB,IAAIX;QACJ,SAASQ;QACT,WAAWC,GAAG;YACV;YACA;YACA;YACA;YAEAR,SAAS;SACZ;QACD,UAAUK;QACV,iBAAiBJ;qBAEjB,sCAACS,OAAAA,KAAsB;QACnB,WAAWF,GACP;;AAWxB,MAAMG,6BAA6B,CAACC;IAChC,MAAM,EAAEC,EAAE,EAAEZ,aAAa,EAAE,GAAGa,UAAUF;IAExC,IAAI,CAACC,GAAG,IAAI,EACR,OAAO;IAGX,OAAO,WAAP,GAAO,sCAACf,gBAAcA;QAAE,GAAGc,KAAK;QAAG,GAAGC,GAAG,IAAI;QAAE,eAAeZ;;AAClE;AACA,MAAMc,kBAAkBC,gBAAgB,mBAAmBL"}
package/Tabs/Tabs.d.ts CHANGED
@@ -1,15 +1,20 @@
1
1
  import React from "react";
2
2
  import { Tabs as TabsPrimitive } from "radix-ui";
3
3
  import { type VariantProps } from "../utils.js";
4
- import type { TabProps, tabListVariants } from "./components/index.js";
4
+ import type { TabProps } from "./components/index.js";
5
+ import { tabListVariants } from "./components/index.js";
5
6
  interface TabsProps extends Omit<TabsPrimitive.TabsProps, "children"> {
6
7
  tabs: React.ReactElement<TabProps>[];
7
8
  size?: VariantProps<typeof tabListVariants>["size"];
8
9
  spacing?: VariantProps<typeof tabListVariants>["spacing"];
9
10
  separator?: VariantProps<typeof tabListVariants>["separator"];
10
11
  loading?: boolean;
12
+ /**
13
+ * Controls rendered at the end of the tab row, e.g. a filter checkbox or a button.
14
+ */
15
+ actions?: React.ReactNode;
11
16
  }
12
- declare const DecoratableTabs: ({ defaultValue: initialValue, size, spacing, separator, loading, tabs: tabComponents, ...props }: TabsProps) => React.JSX.Element;
17
+ declare const DecoratableTabs: ({ defaultValue: initialValue, size, spacing, separator, loading, actions, tabs: tabComponents, ...props }: TabsProps) => React.JSX.Element;
13
18
  declare const Tabs: typeof DecoratableTabs & {
14
19
  original: typeof DecoratableTabs;
15
20
  originalName: string;
package/Tabs/Tabs.js CHANGED
@@ -1,20 +1,16 @@
1
1
  import react, { useMemo, useState } from "react";
2
2
  import { Tabs } from "radix-ui";
3
- import { makeDecoratable, withStaticProps } from "../utils.js";
4
- import { Content, List, Tab, TabsContext, Trigger } from "./components/index.js";
3
+ import { cn, makeDecoratable, withStaticProps } from "../utils.js";
4
+ import { Content, List, Tab, TabsContext, Trigger, tabListVariants } from "./components/index.js";
5
5
  const Root = Tabs.Root;
6
- const DecoratableTabs = ({ defaultValue: initialValue, size, spacing, separator, loading, tabs: tabComponents, ...props })=>{
6
+ const DecoratableTabs = ({ defaultValue: initialValue, size, spacing, separator, loading, actions, tabs: tabComponents, ...props })=>{
7
7
  const [tabs, setTabs] = useState([]);
8
8
  const defaultValue = useMemo(()=>initialValue || tabComponents.find((tab)=>!tab.props.disabled && false !== tab.props.visible)?.props.value, [
9
9
  initialValue,
10
10
  tabComponents
11
11
  ]);
12
- const triggers = useMemo(()=>/*#__PURE__*/ react.createElement(List, {
13
- key: tabs.map((tab)=>tab.id).join(";"),
14
- size: size,
15
- spacing: spacing,
16
- separator: separator
17
- }, tabs.map((tab)=>/*#__PURE__*/ react.createElement(Trigger, {
12
+ const triggers = useMemo(()=>{
13
+ const triggerList = tabs.map((tab)=>/*#__PURE__*/ react.createElement(Trigger, {
18
14
  "data-testid": tab["data-testid"],
19
15
  disabled: tab.disabled,
20
16
  icon: tab.icon,
@@ -24,12 +20,34 @@ const DecoratableTabs = ({ defaultValue: initialValue, size, spacing, separator,
24
20
  text: tab.trigger,
25
21
  value: tab.value,
26
22
  visible: tab.visible
27
- }))), [
23
+ }));
24
+ const listKey = tabs.map((tab)=>tab.id).join(";");
25
+ if (!actions) return /*#__PURE__*/ react.createElement(List, {
26
+ key: listKey,
27
+ size: size,
28
+ spacing: spacing,
29
+ separator: separator
30
+ }, triggerList);
31
+ return /*#__PURE__*/ react.createElement("div", {
32
+ className: cn(tabListVariants({
33
+ size,
34
+ spacing,
35
+ separator
36
+ }))
37
+ }, /*#__PURE__*/ react.createElement(List, {
38
+ key: listKey,
39
+ size: size,
40
+ className: "w-auto"
41
+ }, triggerList), /*#__PURE__*/ react.createElement("div", {
42
+ className: "ml-auto flex items-center gap-sm"
43
+ }, actions));
44
+ }, [
28
45
  tabs,
29
46
  size,
30
47
  spacing,
31
48
  separator,
32
- loading
49
+ loading,
50
+ actions
33
51
  ]);
34
52
  const contents = useMemo(()=>tabs.map((tab)=>/*#__PURE__*/ react.createElement(Content, {
35
53
  key: tab.id,
package/Tabs/Tabs.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Tabs/Tabs.js","sources":["../../src/Tabs/Tabs.tsx"],"sourcesContent":["import React, { useMemo, useState } from \"react\";\nimport { Tabs as TabsPrimitive } from \"radix-ui\";\nimport { makeDecoratable, type VariantProps, withStaticProps } from \"~/utils.js\";\nimport type { ITabsContext, TabItem, TabProps, tabListVariants } from \"./components/index.js\";\nimport { Content, List, Tab, TabsContext, Trigger } from \"./components/index.js\";\n\nconst Root = TabsPrimitive.Root;\n\ninterface TabsProps extends Omit<TabsPrimitive.TabsProps, \"children\"> {\n tabs: React.ReactElement<TabProps>[];\n size?: VariantProps<typeof tabListVariants>[\"size\"];\n spacing?: VariantProps<typeof tabListVariants>[\"spacing\"];\n separator?: VariantProps<typeof tabListVariants>[\"separator\"];\n loading?: boolean;\n}\n\nconst DecoratableTabs = ({\n defaultValue: initialValue,\n size,\n spacing,\n separator,\n loading,\n tabs: tabComponents,\n ...props\n}: TabsProps) => {\n const [tabs, setTabs] = useState<TabItem[]>([]);\n\n const defaultValue = useMemo(() => {\n return (\n initialValue ||\n tabComponents.find(tab => !tab.props.disabled && tab.props.visible !== false)?.props\n .value\n );\n }, [initialValue, tabComponents]);\n\n const triggers = useMemo(\n () => (\n <List\n key={tabs.map(tab => tab.id).join(\";\")}\n size={size}\n spacing={spacing}\n separator={separator}\n >\n {tabs.map(tab => (\n <Trigger\n data-testid={tab[\"data-testid\"]}\n disabled={tab.disabled}\n icon={tab.icon}\n key={tab.id}\n loading={loading}\n size={size}\n text={tab.trigger}\n value={tab.value}\n visible={tab.visible}\n />\n ))}\n </List>\n ),\n [tabs, size, spacing, separator, loading]\n );\n\n const contents = useMemo(\n () =>\n tabs.map(tab => (\n <Content\n key={tab.id}\n value={tab.value}\n content={tab.content}\n spacing={tab.spacing ?? spacing}\n className={tab.className}\n />\n )),\n [tabs, spacing]\n );\n\n const context: ITabsContext = useMemo(\n () => ({\n addTab(props) {\n setTabs(tabs => {\n const existingIndex = tabs.findIndex(tab => tab.value === props.value);\n if (existingIndex > -1) {\n return [\n ...tabs.slice(0, existingIndex),\n props,\n ...tabs.slice(existingIndex + 1)\n ];\n }\n return [...tabs, props];\n });\n },\n removeTab(id) {\n setTabs(tabs => tabs.filter(tab => tab.id !== id));\n }\n }),\n [setTabs]\n );\n\n return (\n <Root {...props} defaultValue={defaultValue}>\n {triggers}\n {contents}\n <TabsContext.Provider value={context}>{tabComponents}</TabsContext.Provider>\n </Root>\n );\n};\n\nconst BaseTabs = makeDecoratable(\"Tabs\", DecoratableTabs);\n\nconst Tabs = withStaticProps(BaseTabs, {\n Tab\n});\n\nexport { Tabs, type TabsProps };\n"],"names":["Root","TabsPrimitive","DecoratableTabs","initialValue","size","spacing","separator","loading","tabComponents","props","tabs","setTabs","useState","defaultValue","useMemo","tab","triggers","List","Trigger","contents","Content","context","existingIndex","id","TabsContext","BaseTabs","makeDecoratable","Tabs","withStaticProps","Tab"],"mappings":";;;;AAMA,MAAMA,OAAOC,KAAAA,IAAkB;AAU/B,MAAMC,kBAAkB,CAAC,EACrB,cAAcC,YAAY,EAC1BC,IAAI,EACJC,OAAO,EACPC,SAAS,EACTC,OAAO,EACP,MAAMC,aAAa,EACnB,GAAGC,OACK;IACR,MAAM,CAACC,MAAMC,QAAQ,GAAGC,SAAoB,EAAE;IAE9C,MAAMC,eAAeC,QAAQ,IAErBX,gBACAK,cAAc,IAAI,CAACO,CAAAA,MAAO,CAACA,IAAI,KAAK,CAAC,QAAQ,IAAIA,AAAsB,UAAtBA,IAAI,KAAK,CAAC,OAAO,GAAa,MAC1E,OAEV;QAACZ;QAAcK;KAAc;IAEhC,MAAMQ,WAAWF,QACb,kBACI,oBAACG,MAAIA;YACD,KAAKP,KAAK,GAAG,CAACK,CAAAA,MAAOA,IAAI,EAAE,EAAE,IAAI,CAAC;YAClC,MAAMX;YACN,SAASC;YACT,WAAWC;WAEVI,KAAK,GAAG,CAACK,CAAAA,MAAAA,WAAAA,GACN,oBAACG,SAAOA;gBACJ,eAAaH,GAAG,CAAC,cAAc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Tabs.js","sources":["../../src/Tabs/Tabs.tsx"],"sourcesContent":["import React, { useMemo, useState } from \"react\";\nimport { Tabs as TabsPrimitive } from \"radix-ui\";\nimport { cn, makeDecoratable, type VariantProps, withStaticProps } from \"~/utils.js\";\nimport type { ITabsContext, TabItem, TabProps } from \"./components/index.js\";\nimport { Content, List, Tab, TabsContext, Trigger, tabListVariants } from \"./components/index.js\";\n\nconst Root = TabsPrimitive.Root;\n\ninterface TabsProps extends Omit<TabsPrimitive.TabsProps, \"children\"> {\n tabs: React.ReactElement<TabProps>[];\n size?: VariantProps<typeof tabListVariants>[\"size\"];\n spacing?: VariantProps<typeof tabListVariants>[\"spacing\"];\n separator?: VariantProps<typeof tabListVariants>[\"separator\"];\n loading?: boolean;\n /**\n * Controls rendered at the end of the tab row, e.g. a filter checkbox or a button.\n */\n actions?: React.ReactNode;\n}\n\nconst DecoratableTabs = ({\n defaultValue: initialValue,\n size,\n spacing,\n separator,\n loading,\n actions,\n tabs: tabComponents,\n ...props\n}: TabsProps) => {\n const [tabs, setTabs] = useState<TabItem[]>([]);\n\n const defaultValue = useMemo(() => {\n return (\n initialValue ||\n tabComponents.find(tab => !tab.props.disabled && tab.props.visible !== false)?.props\n .value\n );\n }, [initialValue, tabComponents]);\n\n const triggers = useMemo(() => {\n const triggerList = tabs.map(tab => (\n <Trigger\n data-testid={tab[\"data-testid\"]}\n disabled={tab.disabled}\n icon={tab.icon}\n key={tab.id}\n loading={loading}\n size={size}\n text={tab.trigger}\n value={tab.value}\n visible={tab.visible}\n />\n ));\n const listKey = tabs.map(tab => tab.id).join(\";\");\n\n if (!actions) {\n return (\n <List key={listKey} size={size} spacing={spacing} separator={separator}>\n {triggerList}\n </List>\n );\n }\n\n // Actions sit outside the tablist, so arrow keys only move between tabs.\n return (\n <div className={cn(tabListVariants({ size, spacing, separator }))}>\n <List key={listKey} size={size} className={\"w-auto\"}>\n {triggerList}\n </List>\n <div className={\"ml-auto flex items-center gap-sm\"}>{actions}</div>\n </div>\n );\n }, [tabs, size, spacing, separator, loading, actions]);\n\n const contents = useMemo(\n () =>\n tabs.map(tab => (\n <Content\n key={tab.id}\n value={tab.value}\n content={tab.content}\n spacing={tab.spacing ?? spacing}\n className={tab.className}\n />\n )),\n [tabs, spacing]\n );\n\n const context: ITabsContext = useMemo(\n () => ({\n addTab(props) {\n setTabs(tabs => {\n const existingIndex = tabs.findIndex(tab => tab.value === props.value);\n if (existingIndex > -1) {\n return [\n ...tabs.slice(0, existingIndex),\n props,\n ...tabs.slice(existingIndex + 1)\n ];\n }\n return [...tabs, props];\n });\n },\n removeTab(id) {\n setTabs(tabs => tabs.filter(tab => tab.id !== id));\n }\n }),\n [setTabs]\n );\n\n return (\n <Root {...props} defaultValue={defaultValue}>\n {triggers}\n {contents}\n <TabsContext.Provider value={context}>{tabComponents}</TabsContext.Provider>\n </Root>\n );\n};\n\nconst BaseTabs = makeDecoratable(\"Tabs\", DecoratableTabs);\n\nconst Tabs = withStaticProps(BaseTabs, {\n Tab\n});\n\nexport { Tabs, type TabsProps };\n"],"names":["Root","TabsPrimitive","DecoratableTabs","initialValue","size","spacing","separator","loading","actions","tabComponents","props","tabs","setTabs","useState","defaultValue","useMemo","tab","triggers","triggerList","Trigger","listKey","List","cn","tabListVariants","contents","Content","context","existingIndex","id","TabsContext","BaseTabs","makeDecoratable","Tabs","withStaticProps","Tab"],"mappings":";;;;AAMA,MAAMA,OAAOC,KAAAA,IAAkB;AAc/B,MAAMC,kBAAkB,CAAC,EACrB,cAAcC,YAAY,EAC1BC,IAAI,EACJC,OAAO,EACPC,SAAS,EACTC,OAAO,EACPC,OAAO,EACP,MAAMC,aAAa,EACnB,GAAGC,OACK;IACR,MAAM,CAACC,MAAMC,QAAQ,GAAGC,SAAoB,EAAE;IAE9C,MAAMC,eAAeC,QAAQ,IAErBZ,gBACAM,cAAc,IAAI,CAACO,CAAAA,MAAO,CAACA,IAAI,KAAK,CAAC,QAAQ,IAAIA,AAAsB,UAAtBA,IAAI,KAAK,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MAAOA,IAAI,KAAK,KAAKN,MAAM,KAAK;oBACrE,IAAIiB,gBAAgB,IAChB,OAAO;2BACAhB,KAAK,KAAK,CAAC,GAAGgB;wBACjBjB;2BACGC,KAAK,KAAK,CAACgB,gBAAgB;qBACjC;oBAEL,OAAO;2BAAIhB;wBAAMD;qBAAM;gBAC3B;YACJ;YACA,WAAUkB,EAAE;gBACRhB,QAAQD,CAAAA,OAAQA,KAAK,MAAM,CAACK,CAAAA,MAAOA,IAAI,EAAE,KAAKY;YAClD;QACJ,IACA;QAAChB;KAAQ;IAGb,OAAO,WAAP,GACI,oBAACZ,MAAIA;QAAE,GAAGU,KAAK;QAAE,cAAcI;OAC1BG,UACAO,UAAAA,WAAAA,GACD,oBAACK,YAAY,QAAQ;QAAC,OAAOH;OAAUjB;AAGnD;AAEA,MAAMqB,WAAWC,gBAAgB,QAAQ7B;AAEzC,MAAM8B,YAAOC,gBAAgBH,UAAU;IACnCI,KAAGA;AACP"}
package/Tabs/Tabs.mdx CHANGED
@@ -385,6 +385,33 @@ const [value, setValue] = useState("password");
385
385
  export default WithControlledValueExample;
386
386
  ` } } />
387
387
 
388
+ ### With Actions
389
+
390
+ Use `actions` to put controls at the end of the tab row, such as a filter checkbox or a button. They render outside the tab list, so arrow keys still move only between tabs.
391
+
392
+ <Canvas of={Tabs.WithActions} source={ { code: `
393
+ import React, { useState } from "react";
394
+ import { Checkbox, Tabs } from "@webiny/admin-ui";
395
+
396
+ const WithActionsExample = () => {
397
+ const [unreadOnly, setUnreadOnly] = useState(false);
398
+
399
+ return (
400
+ <Tabs
401
+ separator={true}
402
+ actions={<Checkbox label="Unread only" checked={unreadOnly} onChange={setUnreadOnly} />}
403
+ tabs={[
404
+ <Tabs.Tab key="inbox" value="inbox" trigger="Inbox" content="Inbox content" />,
405
+ <Tabs.Tab key="archive" value="archive" trigger="Archive" content="Archive content" />
406
+ ]}
407
+ />
408
+ );
409
+
410
+ };
411
+
412
+ export default WithActionsExample;
413
+ ` } } />
414
+
388
415
  ### With Icons
389
416
 
390
417
  <Canvas of={Tabs.WithIcons} source={ { code: `
@@ -17,6 +17,7 @@ export declare const SpacingDoubleExtraLarge: Story;
17
17
  export declare const WithSeparator: Story;
18
18
  export declare const WithDefaultValue: Story;
19
19
  export declare const WithControlledValue: Story;
20
+ export declare const WithActions: Story;
20
21
  export declare const WithIcons: Story;
21
22
  export declare const WithDisabledTab: Story;
22
23
  export declare const WithHiddenTab: Story;
@@ -1,6 +1,7 @@
1
1
  import react, { useState } from "react";
2
2
  import { ReactComponent } from "@webiny/icons/person.svg";
3
3
  import { ReactComponent as lock_svg_ReactComponent } from "@webiny/icons/lock.svg";
4
+ import { Checkbox } from "../Checkbox/index.js";
4
5
  import { Tabs } from "./Tabs.js";
5
6
  const meta = {
6
7
  title: "Components/Tabs",
@@ -114,6 +115,23 @@ const WithControlledValue = {
114
115
  });
115
116
  }
116
117
  };
118
+ const WithActions = {
119
+ args: {
120
+ ...Default.args,
121
+ separator: true
122
+ },
123
+ render: (args)=>{
124
+ const [unreadOnly, setUnreadOnly] = useState(false);
125
+ return /*#__PURE__*/ react.createElement(Tabs, {
126
+ ...args,
127
+ actions: /*#__PURE__*/ react.createElement(Checkbox, {
128
+ label: "Unread only",
129
+ checked: unreadOnly,
130
+ onChange: setUnreadOnly
131
+ })
132
+ });
133
+ }
134
+ };
117
135
  const WithIcons = {
118
136
  args: {
119
137
  ...Default.args,
@@ -271,6 +289,6 @@ const Documentation = {
271
289
  }
272
290
  };
273
291
  export default Tabs_stories;
274
- export { Default, Documentation, SizeExtraLarge, SizeLarge, SizeMedium, SizeSmall, SpacingDoubleExtraLarge, SpacingExtraLarge, SpacingExtraSmall, SpacingLarge, SpacingMedium, SpacingSmall, WithControlledValue, WithCustomTabSpacing, WithDefaultValue, WithDisabledTab, WithHiddenTab, WithIcons, WithSeparator };
292
+ export { Default, Documentation, SizeExtraLarge, SizeLarge, SizeMedium, SizeSmall, SpacingDoubleExtraLarge, SpacingExtraLarge, SpacingExtraSmall, SpacingLarge, SpacingMedium, SpacingSmall, WithActions, WithControlledValue, WithCustomTabSpacing, WithDefaultValue, WithDisabledTab, WithHiddenTab, WithIcons, WithSeparator };
275
293
 
276
294
  //# sourceMappingURL=Tabs.stories.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Tabs/Tabs.stories.js","sources":["../../src/Tabs/Tabs.stories.tsx"],"sourcesContent":["import React, { useState } from \"react\";\nimport type { Meta, StoryObj } from \"@storybook/react\";\nimport { ReactComponent as PersonIcon } from \"@webiny/icons/person.svg\";\nimport { ReactComponent as LockIcon } from \"@webiny/icons/lock.svg\";\nimport { Tabs } from \"./Tabs.js\";\n\nconst meta: Meta<typeof Tabs> = {\n title: \"Components/Tabs\",\n component: Tabs,\n parameters: {\n layout: \"padded\"\n }\n};\n\nexport default meta;\ntype Story = StoryObj<typeof Tabs>;\n\nexport const Default: Story = {\n args: {\n tabs: [\n <Tabs.Tab\n key={\"account\"}\n value={\"account\"}\n trigger={\"Account\"}\n content={\n \"Account content - Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla vel libero nec libero lacinia fermentum. Nullam nec nunc nec libero lacinia fermentum. Nullam nec nunc nec libero lacinia fermentum. Nullam nec nunc nec libero lacinia fermentum.\"\n }\n />,\n <Tabs.Tab\n key={\"password\"}\n value={\"password\"}\n trigger={\"Password\"}\n content={\n \"Password content - Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla vel libero nec libero lacinia fermentum. Nullam nec nunc nec libero lacinia fermentum. \"\n }\n />\n ]\n }\n};\n\nexport const SizeSmall: Story = {\n args: {\n ...Default.args,\n size: \"sm\"\n }\n};\n\nexport const SizeMedium: Story = {\n args: {\n ...Default.args,\n size: \"md\"\n }\n};\n\nexport const SizeLarge: Story = {\n args: {\n ...Default.args,\n size: \"lg\"\n }\n};\n\nexport const SizeExtraLarge: Story = {\n args: {\n ...Default.args,\n size: \"xl\"\n }\n};\n\nexport const SpacingExtraSmall: Story = {\n args: {\n ...Default.args,\n spacing: \"xs\"\n }\n};\n\nexport const SpacingSmall: Story = {\n args: {\n ...Default.args,\n spacing: \"sm\"\n }\n};\n\nexport const SpacingMedium: Story = {\n args: {\n ...Default.args,\n spacing: \"md\"\n }\n};\n\nexport const SpacingLarge: Story = {\n args: {\n ...Default.args,\n spacing: \"lg\"\n }\n};\n\nexport const SpacingExtraLarge: Story = {\n args: {\n ...Default.args,\n spacing: \"xl\"\n }\n};\n\nexport const SpacingDoubleExtraLarge: Story = {\n args: {\n ...Default.args,\n spacing: \"xxl\"\n }\n};\n\nexport const WithSeparator: Story = {\n args: {\n ...Default.args,\n separator: true\n }\n};\n\nexport const WithDefaultValue: Story = {\n args: {\n ...Default.args,\n defaultValue: \"password\"\n }\n};\n\nexport const WithControlledValue: Story = {\n args: {\n ...Default.args,\n value: \"password\"\n },\n render: args => {\n const [value, setValue] = useState(args.value);\n return <Tabs {...args} value={value} onValueChange={setValue} />;\n }\n};\n\nexport const WithIcons: Story = {\n args: {\n ...Default.args,\n tabs: [\n <Tabs.Tab\n key={\"account\"}\n value={\"account\"}\n trigger={\"Account\"}\n content={\n \"Account content - Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla vel libero nec libero lacinia fermentum. Nullam nec nunc nec libero lacinia fermentum. Nullam nec nunc nec libero lacinia fermentum. Nullam nec nunc nec libero lacinia fermentum.\"\n }\n icon={<PersonIcon />}\n />,\n <Tabs.Tab\n key={\"password\"}\n value={\"password\"}\n trigger={\"Password\"}\n content={\n \"Password content - Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla vel libero nec libero lacinia fermentum. Nullam nec nunc nec libero lacinia fermentum. \"\n }\n icon={<LockIcon />}\n />\n ]\n }\n};\n\nexport const WithDisabledTab: Story = {\n args: {\n ...Default.args,\n tabs: [\n <Tabs.Tab\n key={\"account\"}\n value={\"account\"}\n trigger={\"Account\"}\n content={\n \"Account content - Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla vel libero nec libero lacinia fermentum. Nullam nec nunc nec libero lacinia fermentum. Nullam nec nunc nec libero lacinia fermentum. Nullam nec nunc nec libero lacinia fermentum.\"\n }\n disabled={true}\n />,\n <Tabs.Tab\n key={\"password\"}\n value={\"password\"}\n trigger={\"Password\"}\n content={\n \"Password content - Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla vel libero nec libero lacinia fermentum. Nullam nec nunc nec libero lacinia fermentum. \"\n }\n />\n ]\n }\n};\n\nexport const WithHiddenTab: Story = {\n args: {\n ...Default.args,\n tabs: [\n <Tabs.Tab\n key={\"account\"}\n value={\"account\"}\n trigger={\"Account\"}\n content={\n \"Account content - Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla vel libero nec libero lacinia fermentum. Nullam nec nunc nec libero lacinia fermentum. Nullam nec nunc nec libero lacinia fermentum. Nullam nec nunc nec libero lacinia fermentum.\"\n }\n visible={false}\n />,\n <Tabs.Tab\n key={\"password\"}\n value={\"password\"}\n trigger={\"Password\"}\n content={\n \"Password content - Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla vel libero nec libero lacinia fermentum. Nullam nec nunc nec libero lacinia fermentum. \"\n }\n />\n ]\n }\n};\n\nexport const WithCustomTabSpacing: Story = {\n args: {\n ...Default.args,\n spacing: \"sm\",\n tabs: [\n <Tabs.Tab\n key={\"account\"}\n value={\"account\"}\n trigger={\"Account\"}\n content={\n \"Tab with custom spacing XXL - Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla vel libero nec libero lacinia fermentum. Nullam nec nunc nec libero lacinia fermentum.\"\n }\n spacing={\"xxl\"}\n />,\n <Tabs.Tab\n key={\"password\"}\n value={\"password\"}\n trigger={\"Password\"}\n content={\n \"Tab with inherited spacing - Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla vel libero nec libero lacinia fermentum. Nullam nec nunc nec libero lacinia fermentum. \"\n }\n />\n ]\n }\n};\n\n// Update the Documentation story to properly handle control changes\nexport const Documentation: Story = {\n render: args => {\n // Force re-render when args change by using a key\n return <Tabs key={JSON.stringify(args)} {...args} />;\n },\n args: {\n size: \"md\",\n spacing: \"lg\",\n separator: true,\n defaultValue: \"account\",\n tabs: [\n <Tabs.Tab\n key={\"account\"}\n value={\"account\"}\n trigger={\"Account\"}\n content={\n \"Account content - This tab contains account settings and personal information. Users can update their profile details, change email address, and manage notification preferences.\"\n }\n />,\n <Tabs.Tab\n key={\"security\"}\n value={\"security\"}\n trigger={\"Security\"}\n content={\n \"Security content - This tab contains security settings. Users can change their password, enable two-factor authentication, and review recent account activity.\"\n }\n />,\n <Tabs.Tab\n key={\"preferences\"}\n value={\"preferences\"}\n trigger={\"Preferences\"}\n content={\n \"Preferences content - This tab contains user preferences. Users can customize the interface, set language preferences, and configure other application settings.\"\n }\n />\n ],\n value: undefined\n },\n argTypes: {\n size: {\n description: \"Size of the tabs\",\n control: \"select\",\n options: [\"sm\", \"md\", \"lg\", \"xl\"],\n defaultValue: \"md\"\n },\n spacing: {\n description: \"Spacing around the tabs and content\",\n control: \"select\",\n options: [\"xs\", \"sm\", \"md\", \"lg\", \"xl\", \"xxl\"],\n defaultValue: \"lg\"\n },\n separator: {\n description:\n \"Whether to show a separator line below the tabs, by default it's `false`.\",\n control: \"boolean\",\n defaultValue: false\n },\n defaultValue: {\n description: \"The value of the tab that should be active by default\",\n control: \"text\"\n },\n value: {\n description:\n \"The controlled value of the active tab, please refer to the example code for details.\"\n },\n tabs: {\n description: \"The tabs to render, please refer to the example code for details.\"\n }\n }\n};\n"],"names":["meta","Tabs","Default","SizeSmall","SizeMedium","SizeLarge","SizeExtraLarge","SpacingExtraSmall","SpacingSmall","SpacingMedium","SpacingLarge","SpacingExtraLarge","SpacingDoubleExtraLarge","WithSeparator","WithDefaultValue","WithControlledValue","args","value","setValue","useState","WithIcons","PersonIcon","LockIcon","WithDisabledTab","WithHiddenTab","WithCustomTabSpacing","Documentation","JSON","undefined"],"mappings":";;;;AAMA,MAAMA,OAA0B;IAC5B,OAAO;IACP,WAAWC;IACX,YAAY;QAC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;gBACL,KAAK;gBACL,OAAO;gBACP,SAAS;gBACT,SACI;;SAGX;IACL;AACJ;AAGO,MAAMyB,gBAAuB;IAChC,QAAQV,CAAAA,OAEG,WAAP,GAAO,oBAACf,MAAIA;YAAC,KAAK0B,KAAK,SAAS,CAACX;YAAQ,GAAGA,IAAI;;IAEpD,MAAM;QACF,MAAM;QACN,SAAS;QACT,WAAW;QACX,cAAc;QACd,MAAM;0BACF,oBAACf,KAAK,GAAG;gBACL,KAAK;gBACL,OAAO;gBACP,SAAS;gBACT,SACI;;0BAGR,oBAACA,KAAK,GAAG;gBACL,KAAK;gBACL,OAAO;gBACP,SAAS;gBACT,SACI;;0BAGR,oBAACA,KAAK,GAAG;gBACL,KAAK;gBACL,OAAO;gBACP,SAAS;gBACT,SACI;;SAGX;QACD,OAAO2B;IACX;IACA,UAAU;QACN,MAAM;YACF,aAAa;YACb,SAAS;YACT,SAAS;gBAAC;gBAAM;gBAAM;gBAAM;aAAK;YACjC,cAAc;QAClB;QACA,SAAS;YACL,aAAa;YACb,SAAS;YACT,SAAS;gBAAC;gBAAM;gBAAM;gBAAM;gBAAM;gBAAM;aAAM;YAC9C,cAAc;QAClB;QACA,WAAW;YACP,aACI;YACJ,SAAS;YACT,cAAc;QAClB;QACA,cAAc;YACV,aAAa;YACb,SAAS;QACb;QACA,OAAO;YACH,aACI;QACR;QACA,MAAM;YACF,aAAa;QACjB;IACJ;AACJ"}
1
+ {"version":3,"file":"Tabs/Tabs.stories.js","sources":["../../src/Tabs/Tabs.stories.tsx"],"sourcesContent":["import React, { useState } from \"react\";\nimport type { Meta, StoryObj } from \"@storybook/react\";\nimport { ReactComponent as PersonIcon } from \"@webiny/icons/person.svg\";\nimport { ReactComponent as LockIcon } from \"@webiny/icons/lock.svg\";\nimport { Checkbox } from \"~/Checkbox/index.js\";\nimport { Tabs } from \"./Tabs.js\";\n\nconst meta: Meta<typeof Tabs> = {\n title: \"Components/Tabs\",\n component: Tabs,\n parameters: {\n layout: \"padded\"\n }\n};\n\nexport default meta;\ntype Story = StoryObj<typeof Tabs>;\n\nexport const Default: Story = {\n args: {\n tabs: [\n <Tabs.Tab\n key={\"account\"}\n value={\"account\"}\n trigger={\"Account\"}\n content={\n \"Account content - Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla vel libero nec libero lacinia fermentum. Nullam nec nunc nec libero lacinia fermentum. Nullam nec nunc nec libero lacinia fermentum. Nullam nec nunc nec libero lacinia fermentum.\"\n }\n />,\n <Tabs.Tab\n key={\"password\"}\n value={\"password\"}\n trigger={\"Password\"}\n content={\n \"Password content - Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla vel libero nec libero lacinia fermentum. Nullam nec nunc nec libero lacinia fermentum. \"\n }\n />\n ]\n }\n};\n\nexport const SizeSmall: Story = {\n args: {\n ...Default.args,\n size: \"sm\"\n }\n};\n\nexport const SizeMedium: Story = {\n args: {\n ...Default.args,\n size: \"md\"\n }\n};\n\nexport const SizeLarge: Story = {\n args: {\n ...Default.args,\n size: \"lg\"\n }\n};\n\nexport const SizeExtraLarge: Story = {\n args: {\n ...Default.args,\n size: \"xl\"\n }\n};\n\nexport const SpacingExtraSmall: Story = {\n args: {\n ...Default.args,\n spacing: \"xs\"\n }\n};\n\nexport const SpacingSmall: Story = {\n args: {\n ...Default.args,\n spacing: \"sm\"\n }\n};\n\nexport const SpacingMedium: Story = {\n args: {\n ...Default.args,\n spacing: \"md\"\n }\n};\n\nexport const SpacingLarge: Story = {\n args: {\n ...Default.args,\n spacing: \"lg\"\n }\n};\n\nexport const SpacingExtraLarge: Story = {\n args: {\n ...Default.args,\n spacing: \"xl\"\n }\n};\n\nexport const SpacingDoubleExtraLarge: Story = {\n args: {\n ...Default.args,\n spacing: \"xxl\"\n }\n};\n\nexport const WithSeparator: Story = {\n args: {\n ...Default.args,\n separator: true\n }\n};\n\nexport const WithDefaultValue: Story = {\n args: {\n ...Default.args,\n defaultValue: \"password\"\n }\n};\n\nexport const WithControlledValue: Story = {\n args: {\n ...Default.args,\n value: \"password\"\n },\n render: args => {\n const [value, setValue] = useState(args.value);\n return <Tabs {...args} value={value} onValueChange={setValue} />;\n }\n};\n\nexport const WithActions: Story = {\n args: {\n ...Default.args,\n separator: true\n },\n render: args => {\n const [unreadOnly, setUnreadOnly] = useState(false);\n return (\n <Tabs\n {...args}\n actions={\n <Checkbox label=\"Unread only\" checked={unreadOnly} onChange={setUnreadOnly} />\n }\n />\n );\n }\n};\n\nexport const WithIcons: Story = {\n args: {\n ...Default.args,\n tabs: [\n <Tabs.Tab\n key={\"account\"}\n value={\"account\"}\n trigger={\"Account\"}\n content={\n \"Account content - Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla vel libero nec libero lacinia fermentum. Nullam nec nunc nec libero lacinia fermentum. Nullam nec nunc nec libero lacinia fermentum. Nullam nec nunc nec libero lacinia fermentum.\"\n }\n icon={<PersonIcon />}\n />,\n <Tabs.Tab\n key={\"password\"}\n value={\"password\"}\n trigger={\"Password\"}\n content={\n \"Password content - Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla vel libero nec libero lacinia fermentum. Nullam nec nunc nec libero lacinia fermentum. \"\n }\n icon={<LockIcon />}\n />\n ]\n }\n};\n\nexport const WithDisabledTab: Story = {\n args: {\n ...Default.args,\n tabs: [\n <Tabs.Tab\n key={\"account\"}\n value={\"account\"}\n trigger={\"Account\"}\n content={\n \"Account content - Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla vel libero nec libero lacinia fermentum. Nullam nec nunc nec libero lacinia fermentum. Nullam nec nunc nec libero lacinia fermentum. Nullam nec nunc nec libero lacinia fermentum.\"\n }\n disabled={true}\n />,\n <Tabs.Tab\n key={\"password\"}\n value={\"password\"}\n trigger={\"Password\"}\n content={\n \"Password content - Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla vel libero nec libero lacinia fermentum. Nullam nec nunc nec libero lacinia fermentum. \"\n }\n />\n ]\n }\n};\n\nexport const WithHiddenTab: Story = {\n args: {\n ...Default.args,\n tabs: [\n <Tabs.Tab\n key={\"account\"}\n value={\"account\"}\n trigger={\"Account\"}\n content={\n \"Account content - Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla vel libero nec libero lacinia fermentum. Nullam nec nunc nec libero lacinia fermentum. Nullam nec nunc nec libero lacinia fermentum. Nullam nec nunc nec libero lacinia fermentum.\"\n }\n visible={false}\n />,\n <Tabs.Tab\n key={\"password\"}\n value={\"password\"}\n trigger={\"Password\"}\n content={\n \"Password content - Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla vel libero nec libero lacinia fermentum. Nullam nec nunc nec libero lacinia fermentum. \"\n }\n />\n ]\n }\n};\n\nexport const WithCustomTabSpacing: Story = {\n args: {\n ...Default.args,\n spacing: \"sm\",\n tabs: [\n <Tabs.Tab\n key={\"account\"}\n value={\"account\"}\n trigger={\"Account\"}\n content={\n \"Tab with custom spacing XXL - Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla vel libero nec libero lacinia fermentum. Nullam nec nunc nec libero lacinia fermentum.\"\n }\n spacing={\"xxl\"}\n />,\n <Tabs.Tab\n key={\"password\"}\n value={\"password\"}\n trigger={\"Password\"}\n content={\n \"Tab with inherited spacing - Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla vel libero nec libero lacinia fermentum. Nullam nec nunc nec libero lacinia fermentum. \"\n }\n />\n ]\n }\n};\n\n// Update the Documentation story to properly handle control changes\nexport const Documentation: Story = {\n render: args => {\n // Force re-render when args change by using a key\n return <Tabs key={JSON.stringify(args)} {...args} />;\n },\n args: {\n size: \"md\",\n spacing: \"lg\",\n separator: true,\n defaultValue: \"account\",\n tabs: [\n <Tabs.Tab\n key={\"account\"}\n value={\"account\"}\n trigger={\"Account\"}\n content={\n \"Account content - This tab contains account settings and personal information. Users can update their profile details, change email address, and manage notification preferences.\"\n }\n />,\n <Tabs.Tab\n key={\"security\"}\n value={\"security\"}\n trigger={\"Security\"}\n content={\n \"Security content - This tab contains security settings. Users can change their password, enable two-factor authentication, and review recent account activity.\"\n }\n />,\n <Tabs.Tab\n key={\"preferences\"}\n value={\"preferences\"}\n trigger={\"Preferences\"}\n content={\n \"Preferences content - This tab contains user preferences. Users can customize the interface, set language preferences, and configure other application settings.\"\n }\n />\n ],\n value: undefined\n },\n argTypes: {\n size: {\n description: \"Size of the tabs\",\n control: \"select\",\n options: [\"sm\", \"md\", \"lg\", \"xl\"],\n defaultValue: \"md\"\n },\n spacing: {\n description: \"Spacing around the tabs and content\",\n control: \"select\",\n options: [\"xs\", \"sm\", \"md\", \"lg\", \"xl\", \"xxl\"],\n defaultValue: \"lg\"\n },\n separator: {\n description:\n \"Whether to show a separator line below the tabs, by default it's `false`.\",\n control: \"boolean\",\n defaultValue: false\n },\n defaultValue: {\n description: \"The value of the tab that should be active by default\",\n control: \"text\"\n },\n value: {\n description:\n \"The controlled value of the active tab, please refer to the example code for details.\"\n },\n tabs: {\n description: \"The tabs to render, please refer to the example code for details.\"\n }\n }\n};\n"],"names":["meta","Tabs","Default","SizeSmall","SizeMedium","SizeLarge","SizeExtraLarge","SpacingExtraSmall","SpacingSmall","SpacingMedium","SpacingLarge","SpacingExtraLarge","SpacingDoubleExtraLarge","WithSeparator","WithDefaultValue","WithControlledValue","args","value","setValue","useState","WithActions","unreadOnly","setUnreadOnly","Checkbox","WithIcons","PersonIcon","LockIcon","WithDisabledTab","WithHiddenTab","WithCustomTabSpacing","Documentation","JSON","undefined"],"mappings":";;;;;AAOA,MAAMA,OAA0B;IAC5B,OAAO;IACP,WAAWC;IACX,YAAY;QACR,QAAQ;IACZ;AACJ;AAEA,qBAAeD;AAGR,MAAME,UAAiB;IAC1B,MAAM;QACF,MAAM;0BACF,oBAACD,KAAK,GAAG;gBACL,KAAK;gBACL,OAAO;gBACP,SAAS;gBACT,SACI;;0BAGR,oBAACA,KAAK,GAAG;gBACL,KAAK;gBACL,OAAO;gBACP,SAAS;gBACT,SACI;;SAGX;IACL;AACJ;AAEO,MAAME,YAAmB;IAC5B,M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