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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (328) hide show
  1. package/Alert/Alert.d.ts +1 -20
  2. package/Alert/Alert.js.map +1 -1
  3. package/AutoComplete/primitives/AutoCompletePrimitive.d.ts +8 -2
  4. package/AutoComplete/primitives/AutoCompletePrimitive.js +1 -0
  5. package/AutoComplete/primitives/AutoCompletePrimitive.js.map +1 -1
  6. package/Breadcrumbs/Breadcrumbs.js +2 -2
  7. package/Breadcrumbs/Breadcrumbs.js.map +1 -1
  8. package/Button/Button.d.ts +1 -1
  9. package/Button/Button.js +14 -0
  10. package/Button/Button.js.map +1 -1
  11. package/Button/Button.mdx +13 -0
  12. package/Button/Button.stories.d.ts +1 -0
  13. package/Button/Button.stories.js +10 -2
  14. package/Button/Button.stories.js.map +1 -1
  15. package/Button/Button.test.d.ts +1 -0
  16. package/Button/Button.test.js +28 -0
  17. package/Button/Button.test.js.map +1 -0
  18. package/Checkbox/primitives/presenters/CheckboxPresenter.js +5 -2
  19. package/Checkbox/primitives/presenters/CheckboxPresenter.js.map +1 -1
  20. package/Checkbox/primitives/presenters/CheckboxPresenter.jsxLabel.test.d.ts +1 -0
  21. package/Checkbox/primitives/presenters/CheckboxPresenter.jsxLabel.test.js +61 -0
  22. package/Checkbox/primitives/presenters/CheckboxPresenter.jsxLabel.test.js.map +1 -0
  23. package/CheckboxGroup/CheckboxGroup.js +4 -1
  24. package/CheckboxGroup/CheckboxGroup.js.map +1 -1
  25. package/CheckboxGroup/primitives/CheckboxGroupPrimitive.d.ts +6 -1
  26. package/CheckboxGroup/primitives/CheckboxGroupPrimitive.js +5 -2
  27. package/CheckboxGroup/primitives/CheckboxGroupPrimitive.js.map +1 -1
  28. package/CheckboxGroup/primitives/presenters/CheckboxGroupPresenter.js +5 -2
  29. package/CheckboxGroup/primitives/presenters/CheckboxGroupPresenter.js.map +1 -1
  30. package/CheckboxGroup/primitives/presenters/CheckboxGroupPresenter.jsxLabel.test.d.ts +1 -0
  31. package/CheckboxGroup/primitives/presenters/CheckboxGroupPresenter.jsxLabel.test.js +108 -0
  32. package/CheckboxGroup/primitives/presenters/CheckboxGroupPresenter.jsxLabel.test.js.map +1 -0
  33. package/Code/Code.d.ts +29 -0
  34. package/Code/Code.js +23 -0
  35. package/Code/Code.js.map +1 -0
  36. package/Code/index.d.ts +1 -0
  37. package/Code/index.js +1 -0
  38. package/CodeEditor/CodeEditor.js +6 -0
  39. package/CodeEditor/CodeEditor.js.map +1 -1
  40. package/ColorPicker/ColorPicker.js +4 -1
  41. package/ColorPicker/ColorPicker.js.map +1 -1
  42. package/ColorPicker/primitives/ColorPickerPrimitive.d.ts +1 -1
  43. package/ColorPicker/primitives/ColorPickerPrimitive.js +3 -1
  44. package/ColorPicker/primitives/ColorPickerPrimitive.js.map +1 -1
  45. package/Command/components/List.d.ts +1 -1
  46. package/Command/components/List.js +9 -5
  47. package/Command/components/List.js.map +1 -1
  48. package/DataTable/DataTable.d.ts +28 -3
  49. package/DataTable/DataTable.js +105 -20
  50. package/DataTable/DataTable.js.map +1 -1
  51. package/DataTable/DataTable.mdx +64 -0
  52. package/DataTable/DataTable.stories.d.ts +4 -0
  53. package/DataTable/DataTable.stories.js +40 -1
  54. package/DataTable/DataTable.stories.js.map +1 -1
  55. package/DataTable/DataTable.subRows.test.d.ts +1 -0
  56. package/DataTable/DataTable.subRows.test.js +216 -0
  57. package/DataTable/DataTable.subRows.test.js.map +1 -0
  58. package/DatePicker/DatePicker.d.ts +5 -2
  59. package/DatePicker/DatePicker.js +14 -3
  60. package/DatePicker/DatePicker.js.map +1 -1
  61. package/DatePicker/DatePicker.stories.d.ts +10 -0
  62. package/DatePicker/DatePicker.stories.js +44 -1
  63. package/DatePicker/DatePicker.stories.js.map +1 -1
  64. package/DatePicker/primitives/BirthdayPicker.d.ts +13 -0
  65. package/DatePicker/primitives/BirthdayPicker.js +355 -0
  66. package/DatePicker/primitives/BirthdayPicker.js.map +1 -0
  67. package/DatePicker/primitives/BirthdayPickerCell.d.ts +14 -0
  68. package/DatePicker/primitives/BirthdayPickerCell.js +19 -0
  69. package/DatePicker/primitives/BirthdayPickerCell.js.map +1 -0
  70. package/DatePicker/primitives/BirthdayPickerSegments.d.ts +9 -0
  71. package/DatePicker/primitives/BirthdayPickerSegments.js +43 -0
  72. package/DatePicker/primitives/BirthdayPickerSegments.js.map +1 -0
  73. package/DatePicker/primitives/DateOnlyPicker.d.ts +1 -1
  74. package/DatePicker/primitives/DateOnlyPicker.js +13 -4
  75. package/DatePicker/primitives/DateOnlyPicker.js.map +1 -1
  76. package/DatePicker/primitives/DatePickerPrimitive.js +3 -0
  77. package/DatePicker/primitives/DatePickerPrimitive.js.map +1 -1
  78. package/DatePicker/primitives/DateRangePicker.d.ts +1 -1
  79. package/DatePicker/primitives/DateRangePicker.js +5 -4
  80. package/DatePicker/primitives/DateRangePicker.js.map +1 -1
  81. package/DatePicker/primitives/DateTimePicker.d.ts +1 -1
  82. package/DatePicker/primitives/DateTimePicker.js +14 -17
  83. package/DatePicker/primitives/DateTimePicker.js.map +1 -1
  84. package/DatePicker/primitives/MonthPicker.d.ts +1 -1
  85. package/DatePicker/primitives/MonthPicker.js +2 -1
  86. package/DatePicker/primitives/MonthPicker.js.map +1 -1
  87. package/DatePicker/primitives/MultipleDatesPicker.d.ts +1 -1
  88. package/DatePicker/primitives/MultipleDatesPicker.js +5 -4
  89. package/DatePicker/primitives/MultipleDatesPicker.js.map +1 -1
  90. package/DatePicker/primitives/MultipleMonthsPicker.d.ts +1 -1
  91. package/DatePicker/primitives/MultipleMonthsPicker.js +2 -1
  92. package/DatePicker/primitives/MultipleMonthsPicker.js.map +1 -1
  93. package/DatePicker/primitives/MultipleYearsPicker.d.ts +1 -1
  94. package/DatePicker/primitives/MultipleYearsPicker.js +2 -1
  95. package/DatePicker/primitives/MultipleYearsPicker.js.map +1 -1
  96. package/DatePicker/primitives/TimeOnlyPicker.d.ts +1 -1
  97. package/DatePicker/primitives/TimeOnlyPicker.js +2 -1
  98. package/DatePicker/primitives/TimeOnlyPicker.js.map +1 -1
  99. package/DatePicker/primitives/WeekPicker.d.ts +1 -1
  100. package/DatePicker/primitives/WeekPicker.js +2 -1
  101. package/DatePicker/primitives/WeekPicker.js.map +1 -1
  102. package/DatePicker/primitives/YearPicker.d.ts +1 -1
  103. package/DatePicker/primitives/YearPicker.js +2 -1
  104. package/DatePicker/primitives/YearPicker.js.map +1 -1
  105. package/DatePicker/primitives/components/TimePicker.d.ts +2 -1
  106. package/DatePicker/primitives/components/TimePicker.js +2 -1
  107. package/DatePicker/primitives/components/TimePicker.js.map +1 -1
  108. package/DatePicker/utils/birthdayHelpers.d.ts +77 -0
  109. package/DatePicker/utils/birthdayHelpers.js +145 -0
  110. package/DatePicker/utils/birthdayHelpers.js.map +1 -0
  111. package/DatePicker/utils/birthdayHelpers.test.d.ts +1 -0
  112. package/DatePicker/utils/birthdayHelpers.test.js +394 -0
  113. package/DatePicker/utils/birthdayHelpers.test.js.map +1 -0
  114. package/DatePicker/utils/dateHelpers.d.ts +6 -1
  115. package/DatePicker/utils/dateHelpers.js +13 -5
  116. package/DatePicker/utils/dateHelpers.js.map +1 -1
  117. package/DatePicker/utils/dateHelpers.test.d.ts +1 -0
  118. package/DatePicker/utils/dateHelpers.test.js +119 -0
  119. package/DatePicker/utils/dateHelpers.test.js.map +1 -0
  120. package/DatePicker/utils/index.d.ts +1 -0
  121. package/DatePicker/utils/index.js +1 -0
  122. package/DatePicker/utils/timezoneHelpers.d.ts +3 -0
  123. package/DatePicker/utils/timezoneHelpers.js +32 -0
  124. package/DatePicker/utils/timezoneHelpers.js.map +1 -0
  125. package/DatePicker/utils/types.d.ts +15 -2
  126. package/DelayedOnChange/DelayedOnChange.d.ts +9 -2
  127. package/DelayedOnChange/DelayedOnChange.js.map +1 -1
  128. package/Dialog/Dialog.d.ts +8 -7
  129. package/Dialog/Dialog.js.map +1 -1
  130. package/Drawer/Drawer.d.ts +10 -6
  131. package/Drawer/Drawer.js +2 -1
  132. package/Drawer/Drawer.js.map +1 -1
  133. package/Drawer/Drawer.stories.d.ts +1 -0
  134. package/Drawer/Drawer.stories.js +20 -2
  135. package/Drawer/Drawer.stories.js.map +1 -1
  136. package/Drawer/components/DrawerHeader.d.ts +2 -2
  137. package/Drawer/components/DrawerHeader.js +11 -8
  138. package/Drawer/components/DrawerHeader.js.map +1 -1
  139. package/Drawer/components/Icon.d.ts +1 -1
  140. package/Drawer/components/Icon.js +3 -4
  141. package/Drawer/components/Icon.js.map +1 -1
  142. package/EmptyState/EmptyState.d.ts +2 -1
  143. package/EmptyState/EmptyState.js +8 -2
  144. package/EmptyState/EmptyState.js.map +1 -1
  145. package/FilePicker/FilePicker.js +6 -1
  146. package/FilePicker/FilePicker.js.map +1 -1
  147. package/FilePicker/FilePicker.stories.d.ts +6 -0
  148. package/FilePicker/FilePicker.stories.js +24 -1
  149. package/FilePicker/FilePicker.stories.js.map +1 -1
  150. package/FilePicker/primitives/FilePickerPrimitive.d.ts +1 -1
  151. package/FilePicker/primitives/FilePickerPrimitive.js +3 -1
  152. package/FilePicker/primitives/FilePickerPrimitive.js.map +1 -1
  153. package/FilePicker/primitives/components/Label.d.ts +3 -1
  154. package/FilePicker/primitives/components/Label.js +2 -1
  155. package/FilePicker/primitives/components/Label.js.map +1 -1
  156. package/FilePicker/primitives/components/previews/ItemActions.js +1 -1
  157. package/FilePicker/primitives/components/previews/ItemActions.js.map +1 -1
  158. package/FilePicker/primitives/components/previews/ItemDescription.js +1 -1
  159. package/FilePicker/primitives/components/previews/ItemDescription.js.map +1 -1
  160. package/FilePicker/primitives/components/previews/RichItemPreview/FileType.d.ts +5 -0
  161. package/FilePicker/primitives/components/previews/RichItemPreview/FileType.js +45 -0
  162. package/FilePicker/primitives/components/previews/RichItemPreview/FileType.js.map +1 -0
  163. package/FilePicker/primitives/components/previews/RichItemPreview/Placeholder.d.ts +5 -0
  164. package/FilePicker/primitives/components/previews/RichItemPreview/Placeholder.js +14 -0
  165. package/FilePicker/primitives/components/previews/RichItemPreview/Placeholder.js.map +1 -0
  166. package/FilePicker/primitives/components/previews/RichItemPreview/RichItemPreview.js +52 -11
  167. package/FilePicker/primitives/components/previews/RichItemPreview/RichItemPreview.js.map +1 -1
  168. package/FilePicker/primitives/components/previews/RichItemPreview/RichItemThumbnail.d.ts +5 -4
  169. package/FilePicker/primitives/components/previews/RichItemPreview/RichItemThumbnail.js +9 -66
  170. package/FilePicker/primitives/components/previews/RichItemPreview/RichItemThumbnail.js.map +1 -1
  171. package/FilePicker/primitives/components/previews/RichItemPreview/Thumbnail.d.ts +11 -0
  172. package/FilePicker/primitives/components/previews/RichItemPreview/Thumbnail.js +24 -0
  173. package/FilePicker/primitives/components/previews/RichItemPreview/Thumbnail.js.map +1 -0
  174. package/FilePicker/primitives/components/previews/RichItemPreview/ThumbnailActions.d.ts +10 -0
  175. package/FilePicker/primitives/components/previews/RichItemPreview/ThumbnailActions.js +46 -0
  176. package/FilePicker/primitives/components/previews/RichItemPreview/ThumbnailActions.js.map +1 -0
  177. package/FilePicker/primitives/components/previews/TruncatedFileName.d.ts +7 -0
  178. package/FilePicker/primitives/components/previews/TruncatedFileName.js +20 -0
  179. package/FilePicker/primitives/components/previews/TruncatedFileName.js.map +1 -0
  180. package/FilePicker/primitives/components/previews/fileName.d.ts +4 -0
  181. package/FilePicker/primitives/components/previews/fileName.js +26 -0
  182. package/FilePicker/primitives/components/previews/fileName.js.map +1 -0
  183. package/FilePicker/primitives/components/previews/index.d.ts +1 -0
  184. package/FilePicker/primitives/components/previews/index.js +1 -0
  185. package/FormComponent/Label.d.ts +6 -1
  186. package/FormComponent/Label.js +5 -2
  187. package/FormComponent/Label.js.map +1 -1
  188. package/FormComponent/labels.test.d.ts +1 -0
  189. package/FormComponent/labels.test.js +276 -0
  190. package/FormComponent/labels.test.js.map +1 -0
  191. package/Icon/Icon.d.ts +6 -1
  192. package/Icon/Icon.js.map +1 -1
  193. package/IconPicker/IconPicker.js +6 -1
  194. package/IconPicker/IconPicker.js.map +1 -1
  195. package/IconPicker/domains/IconPickerIcon.js +1 -1
  196. package/IconPicker/domains/IconPickerIcon.js.map +1 -1
  197. package/IconPicker/primitives/IconPickerPrimitive.d.ts +2 -0
  198. package/IconPicker/primitives/IconPickerPrimitive.js +2 -2
  199. package/IconPicker/primitives/IconPickerPrimitive.js.map +1 -1
  200. package/IconPicker/primitives/components/IconPickerGrid.js.map +1 -1
  201. package/Input/InputPrimitive.d.ts +4 -4
  202. package/Input/InputPrimitive.js +0 -1
  203. package/Input/InputPrimitive.js.map +1 -1
  204. package/Kbd/Kbd.d.ts +35 -0
  205. package/Kbd/Kbd.js +34 -0
  206. package/Kbd/Kbd.js.map +1 -0
  207. package/Kbd/index.d.ts +1 -0
  208. package/Kbd/index.js +1 -0
  209. package/Link/Link.d.ts +1 -1
  210. package/Link/Link.js +1 -1
  211. package/Link/Link.js.map +1 -1
  212. package/MultiAutoComplete/primitives/MultiAutoCompletePrimitive.d.ts +8 -2
  213. package/MultiAutoComplete/primitives/MultiAutoCompletePrimitive.js +1 -0
  214. package/MultiAutoComplete/primitives/MultiAutoCompletePrimitive.js.map +1 -1
  215. package/MultiAutoComplete/primitives/presenters/MultiAutoCompletePresenter.test.js +1 -1
  216. package/MultiAutoComplete/primitives/presenters/MultiAutoCompletePresenter.test.js.map +1 -1
  217. package/MultiAutoComplete/primitives/useMultiAutoComplete.js +3 -2
  218. package/MultiAutoComplete/primitives/useMultiAutoComplete.js.map +1 -1
  219. package/MultiSelect/MultiSelect.js +6 -1
  220. package/MultiSelect/MultiSelect.js.map +1 -1
  221. package/MultiSelect/primitives/MultiSelectPrimitive.d.ts +3 -1
  222. package/MultiSelect/primitives/MultiSelectPrimitive.js +16 -7
  223. package/MultiSelect/primitives/MultiSelectPrimitive.js.map +1 -1
  224. package/Popover/Popover.stories.d.ts +7 -0
  225. package/Popover/Popover.stories.js +24 -1
  226. package/Popover/Popover.stories.js.map +1 -1
  227. package/Popover/primitives/components/PopoverContent.js +6 -1
  228. package/Popover/primitives/components/PopoverContent.js.map +1 -1
  229. package/RadioGroup/RadioGroup.js +4 -1
  230. package/RadioGroup/RadioGroup.js.map +1 -1
  231. package/RadioGroup/primitives/RadioGroupPrimitive.d.ts +1 -1
  232. package/RadioGroup/primitives/RadioGroupPrimitive.js +4 -2
  233. package/RadioGroup/primitives/RadioGroupPrimitive.js.map +1 -1
  234. package/RadioGroup/primitives/presenters/RadioGroupPresenter.js +4 -2
  235. package/RadioGroup/primitives/presenters/RadioGroupPresenter.js.map +1 -1
  236. package/RadioGroup/primitives/presenters/RadioGroupPresenter.jsxLabel.test.d.ts +1 -0
  237. package/RadioGroup/primitives/presenters/RadioGroupPresenter.jsxLabel.test.js +88 -0
  238. package/RadioGroup/primitives/presenters/RadioGroupPresenter.jsxLabel.test.js.map +1 -0
  239. package/RangeSlider/RangeSlider.js +4 -1
  240. package/RangeSlider/RangeSlider.js.map +1 -1
  241. package/RangeSlider/primitives/RangeSliderPrimitive.d.ts +1 -1
  242. package/RangeSlider/primitives/RangeSliderPrimitive.js +3 -1
  243. package/RangeSlider/primitives/RangeSliderPrimitive.js.map +1 -1
  244. package/ScrollArea/ScrollArea.d.ts +16 -2
  245. package/ScrollArea/ScrollArea.js +19 -5
  246. package/ScrollArea/ScrollArea.js.map +1 -1
  247. package/SegmentedControl/SegmentedControl.js +4 -1
  248. package/SegmentedControl/SegmentedControl.js.map +1 -1
  249. package/SegmentedControl/primitives/SegmentedControlPrimitive.d.ts +5 -1
  250. package/SegmentedControl/primitives/SegmentedControlPrimitive.js +2 -1
  251. package/SegmentedControl/primitives/SegmentedControlPrimitive.js.map +1 -1
  252. package/Select/Select.js +6 -1
  253. package/Select/Select.js.map +1 -1
  254. package/Select/primitives/SelectPrimitive.d.ts +4 -0
  255. package/Select/primitives/SelectPrimitive.js +4 -2
  256. package/Select/primitives/SelectPrimitive.js.map +1 -1
  257. package/Select/primitives/components/SelectContent.js +4 -6
  258. package/Select/primitives/components/SelectContent.js.map +1 -1
  259. package/SidePanel/SidePanel.d.ts +46 -0
  260. package/SidePanel/SidePanel.js +47 -0
  261. package/SidePanel/SidePanel.js.map +1 -0
  262. package/SidePanel/SidePanelBody.d.ts +37 -0
  263. package/SidePanel/SidePanelBody.js +14 -0
  264. package/SidePanel/SidePanelBody.js.map +1 -0
  265. package/SidePanel/SidePanelFooter.d.ts +27 -0
  266. package/SidePanel/SidePanelFooter.js +10 -0
  267. package/SidePanel/SidePanelFooter.js.map +1 -0
  268. package/SidePanel/index.d.ts +3 -0
  269. package/SidePanel/index.js +3 -0
  270. package/Sidebar/Sidebar.groups.test.d.ts +1 -0
  271. package/Sidebar/Sidebar.groups.test.js +113 -0
  272. package/Sidebar/Sidebar.groups.test.js.map +1 -0
  273. package/Sidebar/components/SidebarContent.js +1 -1
  274. package/Sidebar/components/SidebarContent.js.map +1 -1
  275. package/Sidebar/components/SidebarRoot.js +1 -1
  276. package/Sidebar/components/SidebarRoot.js.map +1 -1
  277. package/Sidebar/components/items/SidebarMenuRootButton.js +1 -0
  278. package/Sidebar/components/items/SidebarMenuRootButton.js.map +1 -1
  279. package/Sidebar/components/items/SidebarMenuSubButton.js +8 -5
  280. package/Sidebar/components/items/SidebarMenuSubButton.js.map +1 -1
  281. package/Sidebar/components/items/SidebarMenuSubItem.js +3 -3
  282. package/Sidebar/components/items/SidebarMenuSubItem.js.map +1 -1
  283. package/Slider/Slider.js +10 -2
  284. package/Slider/Slider.js.map +1 -1
  285. package/Slider/primitives/SliderPrimitive.d.ts +1 -1
  286. package/Slider/primitives/SliderPrimitive.js +2 -1
  287. package/Slider/primitives/SliderPrimitive.js.map +1 -1
  288. package/Slider/primitives/components/SliderThumb.d.ts +5 -2
  289. package/Slider/primitives/components/SliderThumb.js +2 -1
  290. package/Slider/primitives/components/SliderThumb.js.map +1 -1
  291. package/Switch/Switch.d.ts +4 -4
  292. package/Switch/Switch.js +21 -7
  293. package/Switch/Switch.js.map +1 -1
  294. package/Switch/domains/SwitchItemDto.d.ts +1 -1
  295. package/Switch/primitives/SwitchPrimitive.js +4 -3
  296. package/Switch/primitives/SwitchPrimitive.js.map +1 -1
  297. package/Tabs/Tabs.d.ts +7 -2
  298. package/Tabs/Tabs.js +29 -11
  299. package/Tabs/Tabs.js.map +1 -1
  300. package/Tabs/Tabs.mdx +27 -0
  301. package/Tabs/Tabs.stories.d.ts +1 -0
  302. package/Tabs/Tabs.stories.js +19 -1
  303. package/Tabs/Tabs.stories.js.map +1 -1
  304. package/Tag/Tag.d.ts +1 -1
  305. package/Tag/Tag.js +5 -0
  306. package/Tag/Tag.js.map +1 -1
  307. package/Tag/TagIcon.js +7 -1
  308. package/Tag/TagIcon.js.map +1 -1
  309. package/Tags/primitives/TagsPrimitive.d.ts +2 -2
  310. package/Tags/primitives/TagsPrimitive.js.map +1 -1
  311. package/ToggleGroup/ToggleGroup.js +4 -1
  312. package/ToggleGroup/ToggleGroup.js.map +1 -1
  313. package/ToggleGroup/primitives/ToggleGroupPrimitive.d.ts +2 -0
  314. package/ToggleGroup/primitives/ToggleGroupPrimitive.js +3 -2
  315. package/ToggleGroup/primitives/ToggleGroupPrimitive.js.map +1 -1
  316. package/Tree/useTree.js +6 -2
  317. package/Tree/useTree.js.map +1 -1
  318. package/exports/admin/ui.d.ts +1 -0
  319. package/exports/admin/ui.js +1 -0
  320. package/hooks/index.d.ts +1 -0
  321. package/hooks/index.js +1 -0
  322. package/hooks/useEscapeScrollLock.d.ts +13 -0
  323. package/hooks/useEscapeScrollLock.js +21 -0
  324. package/hooks/useEscapeScrollLock.js.map +1 -0
  325. package/index.d.ts +3 -0
  326. package/index.js +3 -0
  327. package/package.json +30 -28
  328. package/theme.css +34 -0
@@ -13,7 +13,21 @@ export interface ScrollPosition {
13
13
  interface ScrollAreaProps extends Omit<React.ComponentProps<typeof ScrollAreaPrimitive.Root>, "onScroll"> {
14
14
  onScrollPositionChange?: (position: ScrollPosition) => void;
15
15
  onScroll?: (position: ScrollPosition) => void;
16
+ /**
17
+ * Classes for the scrolling element itself. Put the height limit here when the area has to grow
18
+ * with its content up to a maximum, instead of filling a parent of a known height.
19
+ */
20
+ viewportClassName?: string;
21
+ /**
22
+ * Native scroll handler for the scrolling element, for callers that need the event itself.
23
+ * `onScroll` reports positions instead.
24
+ */
25
+ onViewportScroll?: React.UIEventHandler<HTMLDivElement>;
26
+ /**
27
+ * Ref to the scrolling element, for callers that scroll it themselves.
28
+ */
29
+ viewportRef?: React.Ref<HTMLDivElement>;
16
30
  }
17
- declare function ScrollArea({ className, children, onScrollPositionChange, onScroll, ...props }: ScrollAreaProps): React.JSX.Element;
18
- declare function ScrollBar({ className, orientation, ...props }: React.ComponentProps<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>): React.JSX.Element;
31
+ declare function ScrollArea({ className, children, onScrollPositionChange, onScroll, viewportClassName, onViewportScroll, viewportRef: externalViewportRef, type, ...props }: ScrollAreaProps): React.JSX.Element;
32
+ declare function ScrollBar({ className, orientation, onMouseDown, ...props }: React.ComponentProps<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>): React.JSX.Element;
19
33
  export { ScrollArea, ScrollBar };
@@ -1,8 +1,15 @@
1
1
  import { cn } from "../utils.js";
2
2
  import * as __rspack_external_react from "react";
3
3
  import * as __rspack_external__radix_ui_react_scroll_area_bdec1136 from "@radix-ui/react-scroll-area";
4
- function ScrollArea({ className, children, onScrollPositionChange, onScroll, ...props }) {
4
+ function ScrollArea({ className, children, onScrollPositionChange, onScroll, viewportClassName, onViewportScroll, viewportRef: externalViewportRef, type = "auto", ...props }) {
5
5
  const viewportRef = __rspack_external_react.useRef(null);
6
+ const setViewportRef = __rspack_external_react.useCallback((element)=>{
7
+ viewportRef.current = element;
8
+ if ("function" == typeof externalViewportRef) externalViewportRef(element);
9
+ else if (externalViewportRef) externalViewportRef.current = element;
10
+ }, [
11
+ externalViewportRef
12
+ ]);
6
13
  __rspack_external_react.useEffect(()=>{
7
14
  const viewport = viewportRef.current;
8
15
  if (!viewport || !onScrollPositionChange && !onScroll) return;
@@ -30,19 +37,26 @@ function ScrollArea({ className, children, onScrollPositionChange, onScroll, ...
30
37
  ]);
31
38
  return /*#__PURE__*/ __rspack_external_react.createElement(__rspack_external__radix_ui_react_scroll_area_bdec1136.Root, {
32
39
  "data-slot": "scroll-area",
40
+ type: type,
33
41
  className: cn("relative", className),
34
42
  ...props
35
43
  }, /*#__PURE__*/ __rspack_external_react.createElement(__rspack_external__radix_ui_react_scroll_area_bdec1136.Viewport, {
36
- ref: viewportRef,
44
+ ref: setViewportRef,
37
45
  "data-slot": "scroll-area-viewport",
38
- className: "focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1"
46
+ onScroll: onViewportScroll,
47
+ className: cn("relative focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1", viewportClassName)
39
48
  }, children), /*#__PURE__*/ __rspack_external_react.createElement(ScrollBar, null), /*#__PURE__*/ __rspack_external_react.createElement(__rspack_external__radix_ui_react_scroll_area_bdec1136.Corner, null));
40
49
  }
41
- function ScrollBar({ className, orientation = "vertical", ...props }) {
50
+ function ScrollBar({ className, orientation = "vertical", onMouseDown, ...props }) {
51
+ const handleMouseDown = (event)=>{
52
+ onMouseDown?.(event);
53
+ event.preventDefault();
54
+ };
42
55
  return /*#__PURE__*/ __rspack_external_react.createElement(__rspack_external__radix_ui_react_scroll_area_bdec1136.ScrollAreaScrollbar, {
43
56
  "data-slot": "scroll-area-scrollbar",
44
57
  orientation: orientation,
45
- className: cn("flex touch-none transition-colors select-none", "vertical" === orientation && "h-full w-[8px] border-l border-l-transparent", "horizontal" === orientation && "h-[8px] flex-col border-t border-t-transparent", className),
58
+ onMouseDown: handleMouseDown,
59
+ className: cn("flex touch-none transition-colors select-none", "vertical" === orientation && "h-full w-[10px] p-[2px]", "horizontal" === orientation && "h-[10px] flex-col p-[2px]", className),
46
60
  ...props
47
61
  }, /*#__PURE__*/ __rspack_external_react.createElement(__rspack_external__radix_ui_react_scroll_area_bdec1136.ScrollAreaThumb, {
48
62
  "data-slot": "scroll-area-thumb",
@@ -1 +1 @@
1
- {"version":3,"file":"ScrollArea/ScrollArea.js","sources":["../../src/ScrollArea/ScrollArea.tsx"],"sourcesContent":["import * as React from \"react\";\nimport * as ScrollAreaPrimitive from \"@radix-ui/react-scroll-area\";\nimport { cn } from \"~/utils.js\";\n\nexport interface ScrollPosition {\n top: number;\n left: number;\n scrollTop: number;\n scrollLeft: number;\n scrollHeight: number;\n scrollWidth: number;\n clientHeight: number;\n clientWidth: number;\n}\n\ninterface ScrollAreaProps extends Omit<\n React.ComponentProps<typeof ScrollAreaPrimitive.Root>,\n \"onScroll\"\n> {\n onScrollPositionChange?: (position: ScrollPosition) => void;\n onScroll?: (position: ScrollPosition) => void;\n}\n\nfunction ScrollArea({\n className,\n children,\n onScrollPositionChange,\n onScroll,\n ...props\n}: ScrollAreaProps) {\n const viewportRef = React.useRef<HTMLDivElement>(null);\n\n React.useEffect(() => {\n const viewport = viewportRef.current;\n if (!viewport || (!onScrollPositionChange && !onScroll)) {\n return;\n }\n\n // The Viewport component itself is the scrollable element.\n const handleScroll = () => {\n const { scrollTop, scrollLeft, scrollHeight, scrollWidth, clientHeight, clientWidth } =\n viewport;\n\n const position: ScrollPosition = {\n top: scrollHeight > clientHeight ? scrollTop / (scrollHeight - clientHeight) : 0,\n left: scrollWidth > clientWidth ? scrollLeft / (scrollWidth - clientWidth) : 0,\n scrollTop,\n scrollLeft,\n scrollHeight,\n scrollWidth,\n clientHeight,\n clientWidth\n };\n\n onScrollPositionChange?.(position);\n onScroll?.(position);\n };\n\n // Call handleScroll initially to provide initial position.\n handleScroll();\n\n viewport.addEventListener(\"scroll\", handleScroll);\n return () => viewport.removeEventListener(\"scroll\", handleScroll);\n }, [onScrollPositionChange, onScroll]);\n\n return (\n <ScrollAreaPrimitive.Root\n data-slot=\"scroll-area\"\n className={cn(\"relative\", className)}\n {...props}\n >\n <ScrollAreaPrimitive.Viewport\n ref={viewportRef}\n data-slot=\"scroll-area-viewport\"\n className=\"focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1\"\n >\n {children}\n </ScrollAreaPrimitive.Viewport>\n <ScrollBar />\n <ScrollAreaPrimitive.Corner />\n </ScrollAreaPrimitive.Root>\n );\n}\n\nfunction ScrollBar({\n className,\n orientation = \"vertical\",\n ...props\n}: React.ComponentProps<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>) {\n return (\n <ScrollAreaPrimitive.ScrollAreaScrollbar\n data-slot=\"scroll-area-scrollbar\"\n orientation={orientation}\n className={cn(\n \"flex touch-none transition-colors select-none\",\n orientation === \"vertical\" && \"h-full w-[8px] border-l border-l-transparent\",\n orientation === \"horizontal\" && \"h-[8px] flex-col border-t border-t-transparent\",\n className\n )}\n {...props}\n >\n <ScrollAreaPrimitive.ScrollAreaThumb\n data-slot=\"scroll-area-thumb\"\n className=\"bg-neutral-strong/70 relative flex-1 rounded-full\"\n />\n </ScrollAreaPrimitive.ScrollAreaScrollbar>\n );\n}\n\nexport { ScrollArea, ScrollBar };\n"],"names":["ScrollArea","className","children","onScrollPositionChange","onScroll","props","viewportRef","React","viewport","handleScroll","scrollTop","scrollLeft","scrollHeight","scrollWidth","clientHeight","clientWidth","position","ScrollAreaPrimitive","cn","ScrollBar","orientation"],"mappings":";;;AAuBA,SAASA,WAAW,EAChBC,SAAS,EACTC,QAAQ,EACRC,sBAAsB,EACtBC,QAAQ,EACR,GAAGC,OACW;IACd,MAAMC,cAAcC,wBAAAA,MAAY,CAAiB;IAEjDA,wBAAAA,SAAe,CAAC;QACZ,MAAMC,WAAWF,YAAY,OAAO;QACpC,IAAI,CAACE,YAAa,CAACL,0BAA0B,CAACC,UAC1C;QAIJ,MAAMK,eAAe;YACjB,MAAM,EAAEC,SAAS,EAAEC,UAAU,EAAEC,YAAY,EAAEC,WAAW,EAAEC,YAAY,EAAEC,WAAW,EAAE,GACjFP;YAEJ,MAAMQ,WAA2B;gBAC7B,KAAKJ,eAAeE,eAAeJ,YAAaE,CAAAA,eAAeE,YAAW,IAAK;gBAC/E,MAAMD,cAAcE,cAAcJ,aAAcE,CAAAA,cAAcE,WAAU,IAAK;gBAC7EL;gBACAC;gBACAC;gBACAC;gBACAC;gBACAC;YACJ;YAEAZ,yBAAyBa;YACzBZ,WAAWY;QACf;QAGAP;QAEAD,SAAS,gBAAgB,CAAC,UAAUC;QACpC,OAAO,IAAMD,SAAS,mBAAmB,CAAC,UAAUC;IACxD,GAAG;QAACN;QAAwBC;KAAS;IAErC,OAAO,WAAP,GACI,sCAACa,uDAAAA,IAAwB;QACrB,aAAU;QACV,WAAWC,GAAG,YAAYjB;QACzB,GAAGI,KAAK;qBAET,sCAACY,uDAAAA,QAA4B;QACzB,KAAKX;QACL,aAAU;QACV,WAAU;OAETJ,WAAAA,WAAAA,GAEL,sCAACiB,WAASA,OAAAA,WAAAA,GACV,sCAACF,uDAAAA,MAA0B;AAGvC;AAEA,SAASE,UAAU,EACflB,SAAS,EACTmB,cAAc,UAAU,EACxB,GAAGf,OACgE;IACnE,OAAO,WAAP,GACI,sCAACY,uDAAAA,mBAAuC;QACpC,aAAU;QACV,aAAaG;QACb,WAAWF,GACP,iDACAE,AAAgB,eAAhBA,eAA8B,gDAC9BA,AAAgB,iBAAhBA,eAAgC,kDAChCnB;QAEH,GAAGI,KAAK;qBAET,sCAACY,uDAAAA,eAAmC;QAChC,aAAU;QACV,WAAU;;AAI1B"}
1
+ {"version":3,"file":"ScrollArea/ScrollArea.js","sources":["../../src/ScrollArea/ScrollArea.tsx"],"sourcesContent":["import * as React from \"react\";\nimport * as ScrollAreaPrimitive from \"@radix-ui/react-scroll-area\";\nimport { cn } from \"~/utils.js\";\n\nexport interface ScrollPosition {\n top: number;\n left: number;\n scrollTop: number;\n scrollLeft: number;\n scrollHeight: number;\n scrollWidth: number;\n clientHeight: number;\n clientWidth: number;\n}\n\ninterface ScrollAreaProps extends Omit<\n React.ComponentProps<typeof ScrollAreaPrimitive.Root>,\n \"onScroll\"\n> {\n onScrollPositionChange?: (position: ScrollPosition) => void;\n onScroll?: (position: ScrollPosition) => void;\n /**\n * Classes for the scrolling element itself. Put the height limit here when the area has to grow\n * with its content up to a maximum, instead of filling a parent of a known height.\n */\n viewportClassName?: string;\n /**\n * Native scroll handler for the scrolling element, for callers that need the event itself.\n * `onScroll` reports positions instead.\n */\n onViewportScroll?: React.UIEventHandler<HTMLDivElement>;\n /**\n * Ref to the scrolling element, for callers that scroll it themselves.\n */\n viewportRef?: React.Ref<HTMLDivElement>;\n}\n\nfunction ScrollArea({\n className,\n children,\n onScrollPositionChange,\n onScroll,\n viewportClassName,\n onViewportScroll,\n viewportRef: externalViewportRef,\n /*\n * Radix would only show the scrollbar once the pointer is inside. Showing it whenever there is\n * more content is the same rule the rest of the admin follows, a Select included.\n */\n type = \"auto\",\n ...props\n}: ScrollAreaProps) {\n const viewportRef = React.useRef<HTMLDivElement | null>(null);\n\n // The internal ref drives the scroll listener below; a caller's ref gets the same element.\n const setViewportRef = React.useCallback(\n (element: HTMLDivElement | null) => {\n viewportRef.current = element;\n if (typeof externalViewportRef === \"function\") {\n externalViewportRef(element);\n } else if (externalViewportRef) {\n (externalViewportRef as React.MutableRefObject<HTMLDivElement | null>).current =\n element;\n }\n },\n [externalViewportRef]\n );\n\n React.useEffect(() => {\n const viewport = viewportRef.current;\n if (!viewport || (!onScrollPositionChange && !onScroll)) {\n return;\n }\n\n // The Viewport component itself is the scrollable element.\n const handleScroll = () => {\n const { scrollTop, scrollLeft, scrollHeight, scrollWidth, clientHeight, clientWidth } =\n viewport;\n\n const position: ScrollPosition = {\n top: scrollHeight > clientHeight ? scrollTop / (scrollHeight - clientHeight) : 0,\n left: scrollWidth > clientWidth ? scrollLeft / (scrollWidth - clientWidth) : 0,\n scrollTop,\n scrollLeft,\n scrollHeight,\n scrollWidth,\n clientHeight,\n clientWidth\n };\n\n onScrollPositionChange?.(position);\n onScroll?.(position);\n };\n\n // Call handleScroll initially to provide initial position.\n handleScroll();\n\n viewport.addEventListener(\"scroll\", handleScroll);\n return () => viewport.removeEventListener(\"scroll\", handleScroll);\n }, [onScrollPositionChange, onScroll]);\n\n return (\n <ScrollAreaPrimitive.Root\n data-slot=\"scroll-area\"\n type={type}\n className={cn(\"relative\", className)}\n {...props}\n >\n <ScrollAreaPrimitive.Viewport\n ref={setViewportRef}\n data-slot=\"scroll-area-viewport\"\n onScroll={onViewportScroll}\n /*\n * `relative` makes the viewport the containing block of absolutely positioned content,\n * such as an Icon's hidden label. Without it, that content anchored to the root, was\n * not clipped by the viewport, and stretched whatever held the scroll area: a drawer\n * body could then be scrolled past its end into empty space.\n */\n className={cn(\n \"relative focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1\",\n viewportClassName\n )}\n >\n {children}\n </ScrollAreaPrimitive.Viewport>\n <ScrollBar />\n <ScrollAreaPrimitive.Corner />\n </ScrollAreaPrimitive.Root>\n );\n}\n\nfunction ScrollBar({\n className,\n orientation = \"vertical\",\n onMouseDown,\n ...props\n}: React.ComponentProps<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>) {\n const handleMouseDown = (event: React.MouseEvent<HTMLDivElement>) => {\n onMouseDown?.(event);\n\n /*\n * Grabbing a scrollbar must not move focus. An autocomplete closes its list the moment its\n * input blurs, so without this, dragging the thumb dismisses the list under the pointer.\n */\n event.preventDefault();\n };\n\n return (\n <ScrollAreaPrimitive.ScrollAreaScrollbar\n data-slot=\"scroll-area-scrollbar\"\n orientation={orientation}\n onMouseDown={handleMouseDown}\n className={cn(\n \"flex touch-none transition-colors select-none\",\n orientation === \"vertical\" && \"h-full w-[10px] p-[2px]\",\n orientation === \"horizontal\" && \"h-[10px] flex-col p-[2px]\",\n className\n )}\n {...props}\n >\n <ScrollAreaPrimitive.ScrollAreaThumb\n data-slot=\"scroll-area-thumb\"\n className=\"bg-neutral-strong/70 relative flex-1 rounded-full\"\n />\n </ScrollAreaPrimitive.ScrollAreaScrollbar>\n );\n}\n\nexport { ScrollArea, ScrollBar };\n"],"names":["ScrollArea","className","children","onScrollPositionChange","onScroll","viewportClassName","onViewportScroll","externalViewportRef","type","props","viewportRef","React","setViewportRef","element","viewport","handleScroll","scrollTop","scrollLeft","scrollHeight","scrollWidth","clientHeight","clientWidth","position","ScrollAreaPrimitive","cn","ScrollBar","orientation","onMouseDown","handleMouseDown","event"],"mappings":";;;AAqCA,SAASA,WAAW,EAChBC,SAAS,EACTC,QAAQ,EACRC,sBAAsB,EACtBC,QAAQ,EACRC,iBAAiB,EACjBC,gBAAgB,EAChB,aAAaC,mBAAmB,EAKhCC,OAAO,MAAM,EACb,GAAGC,OACW;IACd,MAAMC,cAAcC,wBAAAA,MAAY,CAAwB;IAGxD,MAAMC,iBAAiBD,wBAAAA,WAAiB,CACpC,CAACE;QACGH,YAAY,OAAO,GAAGG;QACtB,IAAI,AAA+B,cAA/B,OAAON,qBACPA,oBAAoBM;aACjB,IAAIN,qBACNA,oBAAsE,OAAO,GAC1EM;IAEZ,GACA;QAACN;KAAoB;IAGzBI,wBAAAA,SAAe,CAAC;QACZ,MAAMG,WAAWJ,YAAY,OAAO;QACpC,IAAI,CAACI,YAAa,CAACX,0BAA0B,CAACC,UAC1C;QAIJ,MAAMW,eAAe;YACjB,MAAM,EAAEC,SAAS,EAAEC,UAAU,EAAEC,YAAY,EAAEC,WAAW,EAAEC,YAAY,EAAEC,WAAW,EAAE,GACjFP;YAEJ,MAAMQ,WAA2B;gBAC7B,KAAKJ,eAAeE,eAAeJ,YAAaE,CAAAA,eAAeE,YAAW,IAAK;gBAC/E,MAAMD,cAAcE,cAAcJ,aAAcE,CAAAA,cAAcE,WAAU,IAAK;gBAC7EL;gBACAC;gBACAC;gBACAC;gBACAC;gBACAC;YACJ;YAEAlB,yBAAyBmB;YACzBlB,WAAWkB;QACf;QAGAP;QAEAD,SAAS,gBAAgB,CAAC,UAAUC;QACpC,OAAO,IAAMD,SAAS,mBAAmB,CAAC,UAAUC;IACxD,GAAG;QAACZ;QAAwBC;KAAS;IAErC,OAAO,WAAP,GACI,sCAACmB,uDAAAA,IAAwB;QACrB,aAAU;QACV,MAAMf;QACN,WAAWgB,GAAG,YAAYvB;QACzB,GAAGQ,KAAK;qBAET,sCAACc,uDAAAA,QAA4B;QACzB,KAAKX;QACL,aAAU;QACV,UAAUN;QAOV,WAAWkB,GACP,+JACAnB;OAGHH,WAAAA,WAAAA,GAEL,sCAACuB,WAASA,OAAAA,WAAAA,GACV,sCAACF,uDAAAA,MAA0B;AAGvC;AAEA,SAASE,UAAU,EACfxB,SAAS,EACTyB,cAAc,UAAU,EACxBC,WAAW,EACX,GAAGlB,OACgE;IACnE,MAAMmB,kBAAkB,CAACC;QACrBF,cAAcE;QAMdA,MAAM,cAAc;IACxB;IAEA,OAAO,WAAP,GACI,sCAACN,uDAAAA,mBAAuC;QACpC,aAAU;QACV,aAAaG;QACb,aAAaE;QACb,WAAWJ,GACP,iDACAE,AAAgB,eAAhBA,eAA8B,2BAC9BA,AAAgB,iBAAhBA,eAAgC,6BAChCzB;QAEH,GAAGQ,KAAK;qBAET,sCAACc,uDAAAA,eAAmC;QAChC,aAAU;QACV,WAAU;;AAI1B"}
@@ -1,5 +1,5 @@
1
1
  import react, { useMemo } from "react";
2
- import { makeDecoratable, withStaticProps } from "../utils.js";
2
+ import { generateId, makeDecoratable, withStaticProps } from "../utils.js";
3
3
  import { SegmentedControlTabs } from "./SegmentedControlTabs.js";
4
4
  import { SegmentedControlPrimitive } from "./primitives/index.js";
5
5
  import { FormComponentDescription, FormComponentErrorMessage, FormComponentLabel, FormComponentNote } from "../FormComponent/index.js";
@@ -8,9 +8,11 @@ const DecoratableSegmentedControl = ({ label, description, note, hint, required,
8
8
  const invalid = useMemo(()=>false === validationIsValid, [
9
9
  validationIsValid
10
10
  ]);
11
+ const labelId = useMemo(()=>`${generateId()}-label`, []);
11
12
  return /*#__PURE__*/ react.createElement("div", {
12
13
  className: "w-full"
13
14
  }, /*#__PURE__*/ react.createElement(FormComponentLabel, {
15
+ labelId: labelId,
14
16
  text: label,
15
17
  hint: hint,
16
18
  required: required,
@@ -26,6 +28,7 @@ const DecoratableSegmentedControl = ({ label, description, note, hint, required,
26
28
  disabled: disabled,
27
29
  className: "mt-none mb-xs-plus"
28
30
  }), /*#__PURE__*/ react.createElement(SegmentedControlPrimitive, {
31
+ "aria-labelledby": labelId,
29
32
  ...props,
30
33
  disabled: disabled
31
34
  }), /*#__PURE__*/ react.createElement(FormComponentNote, {
@@ -1 +1 @@
1
- {"version":3,"file":"SegmentedControl/SegmentedControl.js","sources":["../../src/SegmentedControl/SegmentedControl.tsx"],"sourcesContent":["import React, { useMemo } from \"react\";\nimport { makeDecoratable, withStaticProps } from \"~/utils.js\";\nimport { SegmentedControlTabs } from \"./SegmentedControlTabs.js\";\nimport type { SegmentedControlPrimitiveProps } from \"./primitives/index.js\";\nimport { SegmentedControlPrimitive } from \"./primitives/index.js\";\nimport type { FormComponentProps } from \"~/FormComponent/index.js\";\nimport {\n FormComponentDescription,\n FormComponentErrorMessage,\n FormComponentLabel,\n FormComponentNote\n} from \"~/FormComponent/index.js\";\n\ntype SegmentedControlProps = SegmentedControlPrimitiveProps & FormComponentProps;\n\nconst DecoratableSegmentedControl = ({\n label,\n description,\n note,\n hint,\n required,\n disabled,\n validation,\n ...props\n}: SegmentedControlProps) => {\n const { isValid: validationIsValid, message: validationMessage } = validation || {};\n const invalid = useMemo(() => validationIsValid === false, [validationIsValid]);\n\n return (\n <div className=\"w-full\">\n <FormComponentLabel\n text={label}\n hint={hint}\n required={required}\n disabled={disabled}\n invalid={invalid}\n />\n <FormComponentDescription\n text={description}\n disabled={disabled}\n className=\"mb-xs-plus\"\n />\n <FormComponentErrorMessage\n text={validationMessage}\n invalid={invalid}\n disabled={disabled}\n className=\"mt-none mb-xs-plus\"\n />\n <SegmentedControlPrimitive {...props} disabled={disabled} />\n <FormComponentNote text={note} disabled={disabled} />\n </div>\n );\n};\n\nconst BaseSegmentedControl = makeDecoratable(\"SegmentedControl\", DecoratableSegmentedControl);\n\nconst SegmentedControl = withStaticProps(BaseSegmentedControl, {\n Tabs: SegmentedControlTabs\n});\n\nexport { SegmentedControl, type SegmentedControlProps };\n"],"names":["DecoratableSegmentedControl","label","description","note","hint","required","disabled","validation","props","validationIsValid","validationMessage","invalid","useMemo","FormComponentLabel","FormComponentDescription","FormComponentErrorMessage","SegmentedControlPrimitive","FormComponentNote","BaseSegmentedControl","makeDecoratable","SegmentedControl","withStaticProps","SegmentedControlTabs"],"mappings":";;;;;AAeA,MAAMA,8BAA8B,CAAC,EACjCC,KAAK,EACLC,WAAW,EACXC,IAAI,EACJC,IAAI,EACJC,QAAQ,EACRC,QAAQ,EACRC,UAAU,EACV,GAAGC,OACiB;IACpB,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,WAAU;qBACX,oBAACI,oBAAkBA;QACf,MAAMZ;QACN,MAAMG;QACN,UAAUC;QACV,UAAUC;QACV,SAASK;sBAEb,oBAACG,0BAAwBA;QACrB,MAAMZ;QACN,UAAUI;QACV,WAAU;sBAEd,oBAACS,2BAAyBA;QACtB,MAAML;QACN,SAASC;QACT,UAAUL;QACV,WAAU;sBAEd,oBAACU,2BAAyBA;QAAE,GAAGR,KAAK;QAAE,UAAUF;sBAChD,oBAACW,mBAAiBA;QAAC,MAAMd;QAAM,UAAUG;;AAGrD;AAEA,MAAMY,uBAAuBC,gBAAgB,oBAAoBnB;AAEjE,MAAMoB,mBAAmBC,gBAAgBH,sBAAsB;IAC3D,MAAMI;AACV"}
1
+ {"version":3,"file":"SegmentedControl/SegmentedControl.js","sources":["../../src/SegmentedControl/SegmentedControl.tsx"],"sourcesContent":["import React, { useMemo } from \"react\";\nimport { makeDecoratable, withStaticProps, generateId } from \"~/utils.js\";\nimport { SegmentedControlTabs } from \"./SegmentedControlTabs.js\";\nimport type { SegmentedControlPrimitiveProps } from \"./primitives/index.js\";\nimport { SegmentedControlPrimitive } from \"./primitives/index.js\";\nimport type { FormComponentProps } from \"~/FormComponent/index.js\";\nimport {\n FormComponentDescription,\n FormComponentErrorMessage,\n FormComponentLabel,\n FormComponentNote\n} from \"~/FormComponent/index.js\";\n\ntype SegmentedControlProps = SegmentedControlPrimitiveProps & FormComponentProps;\n\nconst DecoratableSegmentedControl = ({\n label,\n description,\n note,\n hint,\n required,\n disabled,\n validation,\n ...props\n}: SegmentedControlProps) => {\n const { isValid: validationIsValid, message: validationMessage } = validation || {};\n const invalid = useMemo(() => validationIsValid === false, [validationIsValid]);\n /* The control can't be a `<label for>` target, so it names itself after the label. */\n const labelId = useMemo(() => `${generateId()}-label`, []);\n\n return (\n <div className=\"w-full\">\n <FormComponentLabel\n labelId={labelId}\n text={label}\n hint={hint}\n required={required}\n disabled={disabled}\n invalid={invalid}\n />\n <FormComponentDescription\n text={description}\n disabled={disabled}\n className=\"mb-xs-plus\"\n />\n <FormComponentErrorMessage\n text={validationMessage}\n invalid={invalid}\n disabled={disabled}\n className=\"mt-none mb-xs-plus\"\n />\n <SegmentedControlPrimitive aria-labelledby={labelId} {...props} disabled={disabled} />\n <FormComponentNote text={note} disabled={disabled} />\n </div>\n );\n};\n\nconst BaseSegmentedControl = makeDecoratable(\"SegmentedControl\", DecoratableSegmentedControl);\n\nconst SegmentedControl = withStaticProps(BaseSegmentedControl, {\n Tabs: SegmentedControlTabs\n});\n\nexport { SegmentedControl, type SegmentedControlProps };\n"],"names":["DecoratableSegmentedControl","label","description","note","hint","required","disabled","validation","props","validationIsValid","validationMessage","invalid","useMemo","labelId","generateId","FormComponentLabel","FormComponentDescription","FormComponentErrorMessage","SegmentedControlPrimitive","FormComponentNote","BaseSegmentedControl","makeDecoratable","SegmentedControl","withStaticProps","SegmentedControlTabs"],"mappings":";;;;;AAeA,MAAMA,8BAA8B,CAAC,EACjCC,KAAK,EACLC,WAAW,EACXC,IAAI,EACJC,IAAI,EACJC,QAAQ,EACRC,QAAQ,EACRC,UAAU,EACV,GAAGC,OACiB;IACpB,MAAM,EAAE,SAASC,iBAAiB,EAAE,SAASC,iBAAiB,EAAE,GAAGH,cAAc,CAAC;IAClF,MAAMI,UAAUC,QAAQ,IAAMH,AAAsB,UAAtBA,mBAA6B;QAACA;KAAkB;IAE9E,MAAMI,UAAUD,QAAQ,IAAM,GAAGE,aAAa,MAAM,CAAC,EAAE,EAAE;IAEzD,OAAO,WAAP,GACI,oBAAC;QAAI,WAAU;qBACX,oBAACC,oBAAkBA;QACf,SAASF;QACT,MAAMZ;QACN,MAAMG;QACN,UAAUC;QACV,UAAUC;QACV,SAASK;sBAEb,oBAACK,0BAAwBA;QACrB,MAAMd;QACN,UAAUI;QACV,WAAU;sBAEd,oBAACW,2BAAyBA;QACtB,MAAMP;QACN,SAASC;QACT,UAAUL;QACV,WAAU;sBAEd,oBAACY,2BAAyBA;QAAC,mBAAiBL;QAAU,GAAGL,KAAK;QAAE,UAAUF;sBAC1E,oBAACa,mBAAiBA;QAAC,MAAMhB;QAAM,UAAUG;;AAGrD;AAEA,MAAMc,uBAAuBC,gBAAgB,oBAAoBrB;AAEjE,MAAMsB,mBAAmBC,gBAAgBH,sBAAsB;IAC3D,MAAMI;AACV"}
@@ -36,6 +36,10 @@ interface SegmentedControlPrimitiveProps {
36
36
  * Stretch the control to fill its container width, with buttons sharing space equally.
37
37
  */
38
38
  fullWidth?: boolean;
39
+ /**
40
+ * The id of the label that names the group.
41
+ */
42
+ "aria-labelledby"?: string;
39
43
  }
40
44
  interface SegmentedControlVm {
41
45
  items: SegmentedControlItemFormatted[];
@@ -44,7 +48,7 @@ interface SegmentedControlRendererProps extends SegmentedControlPrimitiveProps {
44
48
  items: SegmentedControlItemFormatted[];
45
49
  changeValue: (value: string) => void;
46
50
  }
47
- declare const SegmentedControlRenderer: ({ items, changeValue, value, variant, className, disabled, fullWidth }: SegmentedControlRendererProps) => React.JSX.Element;
51
+ declare const SegmentedControlRenderer: ({ items, changeValue, value, variant, className, disabled, fullWidth, "aria-labelledby": labelledBy }: SegmentedControlRendererProps) => React.JSX.Element;
48
52
  /**
49
53
  * Segmented Control Primitive Component
50
54
  */
@@ -65,8 +65,9 @@ const SegmentedControlItemButton = ({ item, isActive, onValueChange, variant, cl
65
65
  label: String(item.label),
66
66
  color: "neutral-strong"
67
67
  }), item.label);
68
- const SegmentedControlRenderer = ({ items, changeValue, value, variant = "light", className, disabled, fullWidth })=>/*#__PURE__*/ __rspack_external_react.createElement("div", {
68
+ const SegmentedControlRenderer = ({ items, changeValue, value, variant = "light", className, disabled, fullWidth, "aria-labelledby": labelledBy })=>/*#__PURE__*/ __rspack_external_react.createElement("div", {
69
69
  role: "radiogroup",
70
+ "aria-labelledby": labelledBy,
70
71
  className: cn(segmentedControlRootVariants({
71
72
  variant
72
73
  }), fullWidth && "flex w-full", className)
@@ -1 +1 @@
1
- {"version":3,"file":"SegmentedControl/primitives/SegmentedControlPrimitive.js","sources":["../../../src/SegmentedControl/primitives/SegmentedControlPrimitive.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn, cva, type VariantProps } from \"~/utils.js\";\nimport type {\n SegmentedControlItemParams,\n SegmentedControlItemFormatted\n} from \"../domains/index.js\";\nimport { useSegmentedControl } from \"./useSegmentedControl.js\";\nimport { Icon } from \"~/Icon/index.js\";\n\n/**\n * Segmented Control Item Button\n */\nconst segmentedControlItemVariants = cva(\n [\n \"inline-flex items-center justify-center whitespace-nowrap transition-colors cursor-pointer relative rounded-md\",\n \"text-md px-sm-extra py-xs [&>svg]:size-md gap-xs\",\n \"focus-visible:outline-none focus-visible:ring-md focus-visible:ring-primary-dimmed focus-visible:ring-offset-0\",\n \"disabled:opacity-50 disabled:pointer-events-none disabled:cursor-not-allowed\"\n ],\n {\n variants: {\n variant: {\n light: [\n \"text-neutral-strong fill-neutral-xstrong\",\n \"data-[state=active]:text-neutral-primary data-[state=active]:fill-neutral-xstrong data-[state=active]:bg-neutral-base/80\",\n \"hover:data-[state=inactive]:text-neutral-primary\",\n \"hover:data-[state=inactive]:bg-neutral-base/80\",\n \"active:data-[state=inactive]:bg-neutral-base/80\"\n ],\n dimmed: [\n \"text-neutral-strong fill-neutral-xstrong\",\n \"data-[state=active]:text-neutral-primary data-[state=active]:fill-neutral-xstrong data-[state=active]:bg-neutral-base/80\",\n \"hover:data-[state=inactive]:text-neutral-primary\",\n \"hover:data-[state=inactive]:bg-neutral-base/80\",\n \"active:data-[state=inactive]:bg-neutral-base/80\"\n ],\n ghost: [\n \"text-neutral-strong fill-neutral-xstrong\",\n \"data-[state=active]:bg-neutral-dark/5\",\n \"hover:data-[state=inactive]:bg-neutral-dark/5\",\n \"active:data-[state=inactive]:bg-neutral-dark/5\"\n ]\n }\n },\n defaultVariants: {\n variant: \"light\"\n }\n }\n);\n\nconst segmentedControlRootVariants = cva(\"inline-flex rounded-md p-xxs gap-xs\", {\n variants: {\n variant: {\n light: \"bg-neutral-light\",\n dimmed: \"bg-neutral-dimmed\",\n ghost: \"\"\n }\n },\n defaultVariants: {\n variant: \"light\"\n }\n});\n\ninterface SegmentedControlItemProps extends Omit<\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n \"value\"\n> {\n item: SegmentedControlItemFormatted;\n isActive: boolean;\n onValueChange: (value: string) => void;\n variant?: VariantProps<typeof segmentedControlItemVariants>[\"variant\"];\n}\n\nconst SegmentedControlItemButton = ({\n item,\n isActive,\n onValueChange,\n variant,\n className,\n ...props\n}: SegmentedControlItemProps) => {\n return (\n <button\n type=\"button\"\n role=\"radio\"\n aria-checked={isActive}\n data-state={isActive ? \"active\" : \"inactive\"}\n disabled={item.disabled}\n onClick={() => onValueChange(item.value)}\n className={cn(segmentedControlItemVariants({ variant }), className)}\n {...props}\n >\n {item.icon && (\n <Icon\n icon={item.icon}\n size={\"sm\"}\n label={String(item.label)}\n color={\"neutral-strong\"}\n />\n )}\n {item.label}\n </button>\n );\n};\n\n/**\n * Segmented Control Primitive\n */\ninterface SegmentedControlPrimitiveProps {\n items: SegmentedControlItemParams[];\n /**\n * Callback triggered when the selected value changes.\n */\n onChange?: (value: string) => void;\n /**\n * The selected value.\n */\n value?: string;\n /**\n * Visual style variant.\n */\n variant?: VariantProps<typeof segmentedControlItemVariants>[\"variant\"];\n /**\n * Additional class name.\n */\n className?: string;\n /**\n * Disabled state for all items.\n */\n disabled?: boolean;\n /**\n * Stretch the control to fill its container width, with buttons sharing space equally.\n */\n fullWidth?: boolean;\n}\n\ninterface SegmentedControlVm {\n items: SegmentedControlItemFormatted[];\n}\n\ninterface SegmentedControlRendererProps extends SegmentedControlPrimitiveProps {\n items: SegmentedControlItemFormatted[];\n changeValue: (value: string) => void;\n}\n\nconst SegmentedControlRenderer = ({\n items,\n changeValue,\n value,\n variant = \"light\",\n className,\n disabled,\n fullWidth\n}: SegmentedControlRendererProps) => {\n return (\n <div\n role=\"radiogroup\"\n className={cn(\n segmentedControlRootVariants({ variant }),\n fullWidth && \"flex w-full\",\n className\n )}\n >\n {items.map(item => (\n <SegmentedControlItemButton\n key={item.id}\n item={{ ...item, disabled: disabled || item.disabled }}\n isActive={value === item.value}\n onValueChange={changeValue}\n variant={variant}\n className={fullWidth ? \"flex-1\" : undefined}\n />\n ))}\n </div>\n );\n};\n\n/**\n * Segmented Control Primitive Component\n */\nconst SegmentedControlPrimitive = (props: SegmentedControlPrimitiveProps) => {\n const { vm, changeValue } = useSegmentedControl(props);\n return <SegmentedControlRenderer {...props} items={vm.items} changeValue={changeValue} />;\n};\n\nexport {\n SegmentedControlPrimitive,\n SegmentedControlRenderer,\n type SegmentedControlPrimitiveProps,\n type SegmentedControlVm\n};\n"],"names":["segmentedControlItemVariants","cva","segmentedControlRootVariants","SegmentedControlItemButton","item","isActive","onValueChange","variant","className","props","cn","Icon","String","SegmentedControlRenderer","items","changeValue","value","disabled","fullWidth","undefined","SegmentedControlPrimitive","vm","useSegmentedControl"],"mappings":";;;;AAYA,MAAMA,+BAA+BC,IACjC;IACI;IACA;IACA;IACA;CACH,EACD;IACI,UAAU;QACN,SAAS;YACL,OAAO;gBACH;gBACA;gBACA;gBACA;gBACA;aACH;YACD,QAAQ;gBACJ;gBACA;gBACA;gBACA;gBACA;aACH;YACD,OAAO;gBACH;gBACA;gBACA;gBACA;aACH;QACL;IACJ;IACA,iBAAiB;QACb,SAAS;IACb;AACJ;AAGJ,MAAMC,+BAA+BD,IAAI,uCAAuC;IAC5E,UAAU;QACN,SAAS;YACL,OAAO;YACP,QAAQ;YACR,OAAO;QACX;IACJ;IACA,iBAAiB;QACb,SAAS;IACb;AACJ;AAYA,MAAME,6BAA6B,CAAC,EAChCC,IAAI,EACJC,QAAQ,EACRC,aAAa,EACbC,OAAO,EACPC,SAAS,EACT,GAAGC,OACqB,GACjB,WAAP,GACI,sCAAC;QACG,MAAK;QACL,MAAK;QACL,gBAAcJ;QACd,cAAYA,WAAW,WAAW;QAClC,UAAUD,KAAK,QAAQ;QACvB,SAAS,IAAME,cAAcF,KAAK,KAAK;QACvC,WAAWM,GAAGV,6BAA6B;YAAEO;QAAQ,IAAIC;QACxD,GAAGC,KAAK;OAERL,KAAK,IAAI,IAAI,WAAJ,GACN,sCAACO,MAAIA;QACD,MAAMP,KAAK,IAAI;QACf,MAAM;QACN,OAAOQ,OAAOR,KAAK,KAAK;QACxB,OAAO;QAGdA,KAAK,KAAK;AA6CvB,MAAMS,2BAA2B,CAAC,EAC9BC,KAAK,EACLC,WAAW,EACXC,KAAK,EACLT,UAAU,OAAO,EACjBC,SAAS,EACTS,QAAQ,EACRC,SAAS,EACmB,GACrB,WAAP,GACI,sCAAC;QACG,MAAK;QACL,WAAWR,GACPR,6BAA6B;YAAEK;QAAQ,IACvCW,aAAa,eACbV;OAGHM,MAAM,GAAG,CAACV,CAAAA,OAAAA,WAAAA,GACP,sCAACD,4BAA0BA;YACvB,KAAKC,KAAK,EAAE;YACZ,MAAM;gBAAE,GAAGA,IAAI;gBAAE,UAAUa,YAAYb,KAAK,QAAQ;YAAC;YACrD,UAAUY,UAAUZ,KAAK,KAAK;YAC9B,eAAeW;YACf,SAASR;YACT,WAAWW,YAAY,WAAWC;;AAUtD,MAAMC,4BAA4B,CAACX;IAC/B,MAAM,EAAEY,EAAE,EAAEN,WAAW,EAAE,GAAGO,oBAAoBb;IAChD,OAAO,WAAP,GAAO,sCAACI,0BAAwBA;QAAE,GAAGJ,KAAK;QAAE,OAAOY,GAAG,KAAK;QAAE,aAAaN;;AAC9E"}
1
+ {"version":3,"file":"SegmentedControl/primitives/SegmentedControlPrimitive.js","sources":["../../../src/SegmentedControl/primitives/SegmentedControlPrimitive.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn, cva, type VariantProps } from \"~/utils.js\";\nimport type {\n SegmentedControlItemParams,\n SegmentedControlItemFormatted\n} from \"../domains/index.js\";\nimport { useSegmentedControl } from \"./useSegmentedControl.js\";\nimport { Icon } from \"~/Icon/index.js\";\n\n/**\n * Segmented Control Item Button\n */\nconst segmentedControlItemVariants = cva(\n [\n \"inline-flex items-center justify-center whitespace-nowrap transition-colors cursor-pointer relative rounded-md\",\n \"text-md px-sm-extra py-xs [&>svg]:size-md gap-xs\",\n \"focus-visible:outline-none focus-visible:ring-md focus-visible:ring-primary-dimmed focus-visible:ring-offset-0\",\n \"disabled:opacity-50 disabled:pointer-events-none disabled:cursor-not-allowed\"\n ],\n {\n variants: {\n variant: {\n light: [\n \"text-neutral-strong fill-neutral-xstrong\",\n \"data-[state=active]:text-neutral-primary data-[state=active]:fill-neutral-xstrong data-[state=active]:bg-neutral-base/80\",\n \"hover:data-[state=inactive]:text-neutral-primary\",\n \"hover:data-[state=inactive]:bg-neutral-base/80\",\n \"active:data-[state=inactive]:bg-neutral-base/80\"\n ],\n dimmed: [\n \"text-neutral-strong fill-neutral-xstrong\",\n \"data-[state=active]:text-neutral-primary data-[state=active]:fill-neutral-xstrong data-[state=active]:bg-neutral-base/80\",\n \"hover:data-[state=inactive]:text-neutral-primary\",\n \"hover:data-[state=inactive]:bg-neutral-base/80\",\n \"active:data-[state=inactive]:bg-neutral-base/80\"\n ],\n ghost: [\n \"text-neutral-strong fill-neutral-xstrong\",\n \"data-[state=active]:bg-neutral-dark/5\",\n \"hover:data-[state=inactive]:bg-neutral-dark/5\",\n \"active:data-[state=inactive]:bg-neutral-dark/5\"\n ]\n }\n },\n defaultVariants: {\n variant: \"light\"\n }\n }\n);\n\nconst segmentedControlRootVariants = cva(\"inline-flex rounded-md p-xxs gap-xs\", {\n variants: {\n variant: {\n light: \"bg-neutral-light\",\n dimmed: \"bg-neutral-dimmed\",\n ghost: \"\"\n }\n },\n defaultVariants: {\n variant: \"light\"\n }\n});\n\ninterface SegmentedControlItemProps extends Omit<\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n \"value\"\n> {\n item: SegmentedControlItemFormatted;\n isActive: boolean;\n onValueChange: (value: string) => void;\n variant?: VariantProps<typeof segmentedControlItemVariants>[\"variant\"];\n}\n\nconst SegmentedControlItemButton = ({\n item,\n isActive,\n onValueChange,\n variant,\n className,\n ...props\n}: SegmentedControlItemProps) => {\n return (\n <button\n type=\"button\"\n role=\"radio\"\n aria-checked={isActive}\n data-state={isActive ? \"active\" : \"inactive\"}\n disabled={item.disabled}\n onClick={() => onValueChange(item.value)}\n className={cn(segmentedControlItemVariants({ variant }), className)}\n {...props}\n >\n {item.icon && (\n <Icon\n icon={item.icon}\n size={\"sm\"}\n label={String(item.label)}\n color={\"neutral-strong\"}\n />\n )}\n {item.label}\n </button>\n );\n};\n\n/**\n * Segmented Control Primitive\n */\ninterface SegmentedControlPrimitiveProps {\n items: SegmentedControlItemParams[];\n /**\n * Callback triggered when the selected value changes.\n */\n onChange?: (value: string) => void;\n /**\n * The selected value.\n */\n value?: string;\n /**\n * Visual style variant.\n */\n variant?: VariantProps<typeof segmentedControlItemVariants>[\"variant\"];\n /**\n * Additional class name.\n */\n className?: string;\n /**\n * Disabled state for all items.\n */\n disabled?: boolean;\n /**\n * Stretch the control to fill its container width, with buttons sharing space equally.\n */\n fullWidth?: boolean;\n /**\n * The id of the label that names the group.\n */\n \"aria-labelledby\"?: string;\n}\n\ninterface SegmentedControlVm {\n items: SegmentedControlItemFormatted[];\n}\n\ninterface SegmentedControlRendererProps extends SegmentedControlPrimitiveProps {\n items: SegmentedControlItemFormatted[];\n changeValue: (value: string) => void;\n}\n\nconst SegmentedControlRenderer = ({\n items,\n changeValue,\n value,\n variant = \"light\",\n className,\n disabled,\n fullWidth,\n \"aria-labelledby\": labelledBy\n}: SegmentedControlRendererProps) => {\n return (\n <div\n role=\"radiogroup\"\n aria-labelledby={labelledBy}\n className={cn(\n segmentedControlRootVariants({ variant }),\n fullWidth && \"flex w-full\",\n className\n )}\n >\n {items.map(item => (\n <SegmentedControlItemButton\n key={item.id}\n item={{ ...item, disabled: disabled || item.disabled }}\n isActive={value === item.value}\n onValueChange={changeValue}\n variant={variant}\n className={fullWidth ? \"flex-1\" : undefined}\n />\n ))}\n </div>\n );\n};\n\n/**\n * Segmented Control Primitive Component\n */\nconst SegmentedControlPrimitive = (props: SegmentedControlPrimitiveProps) => {\n const { vm, changeValue } = useSegmentedControl(props);\n return <SegmentedControlRenderer {...props} items={vm.items} changeValue={changeValue} />;\n};\n\nexport {\n SegmentedControlPrimitive,\n SegmentedControlRenderer,\n type SegmentedControlPrimitiveProps,\n type SegmentedControlVm\n};\n"],"names":["segmentedControlItemVariants","cva","segmentedControlRootVariants","SegmentedControlItemButton","item","isActive","onValueChange","variant","className","props","cn","Icon","String","SegmentedControlRenderer","items","changeValue","value","disabled","fullWidth","labelledBy","undefined","SegmentedControlPrimitive","vm","useSegmentedControl"],"mappings":";;;;AAYA,MAAMA,+BAA+BC,IACjC;IACI;IACA;IACA;IACA;CACH,EACD;IACI,UAAU;QACN,SAAS;YACL,OAAO;gBACH;gBACA;gBACA;gBACA;gBACA;aACH;YACD,QAAQ;gBACJ;gBACA;gBACA;gBACA;gBACA;aACH;YACD,OAAO;gBACH;gBACA;gBACA;gBACA;aACH;QACL;IACJ;IACA,iBAAiB;QACb,SAAS;IACb;AACJ;AAGJ,MAAMC,+BAA+BD,IAAI,uCAAuC;IAC5E,UAAU;QACN,SAAS;YACL,OAAO;YACP,QAAQ;YACR,OAAO;QACX;IACJ;IACA,iBAAiB;QACb,SAAS;IACb;AACJ;AAYA,MAAME,6BAA6B,CAAC,EAChCC,IAAI,EACJC,QAAQ,EACRC,aAAa,EACbC,OAAO,EACPC,SAAS,EACT,GAAGC,OACqB,GACjB,WAAP,GACI,sCAAC;QACG,MAAK;QACL,MAAK;QACL,gBAAcJ;QACd,cAAYA,WAAW,WAAW;QAClC,UAAUD,KAAK,QAAQ;QACvB,SAAS,IAAME,cAAcF,KAAK,KAAK;QACvC,WAAWM,GAAGV,6BAA6B;YAAEO;QAAQ,IAAIC;QACxD,GAAGC,KAAK;OAERL,KAAK,IAAI,IAAI,WAAJ,GACN,sCAACO,MAAIA;QACD,MAAMP,KAAK,IAAI;QACf,MAAM;QACN,OAAOQ,OAAOR,KAAK,KAAK;QACxB,OAAO;QAGdA,KAAK,KAAK;AAiDvB,MAAMS,2BAA2B,CAAC,EAC9BC,KAAK,EACLC,WAAW,EACXC,KAAK,EACLT,UAAU,OAAO,EACjBC,SAAS,EACTS,QAAQ,EACRC,SAAS,EACT,mBAAmBC,UAAU,EACD,GACrB,WAAP,GACI,sCAAC;QACG,MAAK;QACL,mBAAiBA;QACjB,WAAWT,GACPR,6BAA6B;YAAEK;QAAQ,IACvCW,aAAa,eACbV;OAGHM,MAAM,GAAG,CAACV,CAAAA,OAAAA,WAAAA,GACP,sCAACD,4BAA0BA;YACvB,KAAKC,KAAK,EAAE;YACZ,MAAM;gBAAE,GAAGA,IAAI;gBAAE,UAAUa,YAAYb,KAAK,QAAQ;YAAC;YACrD,UAAUY,UAAUZ,KAAK,KAAK;YAC9B,eAAeW;YACf,SAASR;YACT,WAAWW,YAAY,WAAWE;;AAUtD,MAAMC,4BAA4B,CAACZ;IAC/B,MAAM,EAAEa,EAAE,EAAEP,WAAW,EAAE,GAAGQ,oBAAoBd;IAChD,OAAO,WAAP,GAAO,sCAACI,0BAAwBA;QAAE,GAAGJ,KAAK;QAAE,OAAOa,GAAG,KAAK;QAAE,aAAaP;;AAC9E"}
package/Select/Select.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import react, { useMemo } from "react";
2
- import { makeDecoratable } from "../utils.js";
2
+ import { generateId, makeDecoratable } from "../utils.js";
3
3
  import { SelectPrimitive } from "./primitives/index.js";
4
4
  import { FormComponentDescription, FormComponentErrorMessage, FormComponentLabel, FormComponentNote } from "../FormComponent/index.js";
5
5
  const DecoratableSelect = ({ label, description, note, hint, required, disabled, validation, ...props })=>{
@@ -7,9 +7,13 @@ const DecoratableSelect = ({ label, description, note, hint, required, disabled,
7
7
  const invalid = useMemo(()=>false === validationIsValid, [
8
8
  validationIsValid
9
9
  ]);
10
+ const id = useMemo(()=>generateId(props.id), [
11
+ props.id
12
+ ]);
10
13
  return /*#__PURE__*/ react.createElement("div", {
11
14
  className: "w-full"
12
15
  }, /*#__PURE__*/ react.createElement(FormComponentLabel, {
16
+ htmlFor: id,
13
17
  text: label,
14
18
  hint: hint,
15
19
  required: required,
@@ -20,6 +24,7 @@ const DecoratableSelect = ({ label, description, note, hint, required, disabled,
20
24
  disabled: disabled
21
25
  }), /*#__PURE__*/ react.createElement(SelectPrimitive, {
22
26
  ...props,
27
+ id: id,
23
28
  disabled: disabled,
24
29
  invalid: invalid
25
30
  }), /*#__PURE__*/ react.createElement(FormComponentErrorMessage, {
@@ -1 +1 @@
1
- {"version":3,"file":"Select/Select.js","sources":["../../src/Select/Select.tsx"],"sourcesContent":["import React, { useMemo } from \"react\";\nimport { makeDecoratable } from \"~/utils.js\";\nimport type { SelectPrimitiveProps } from \"./primitives/index.js\";\nimport { SelectPrimitive } from \"./primitives/index.js\";\nimport type { FormComponentProps } from \"~/FormComponent/index.js\";\nimport {\n FormComponentDescription,\n FormComponentErrorMessage,\n FormComponentLabel,\n FormComponentNote\n} from \"~/FormComponent/index.js\";\n\ntype SelectProps = SelectPrimitiveProps & FormComponentProps;\n\nconst DecoratableSelect = ({\n label,\n description,\n note,\n hint,\n required,\n disabled,\n validation,\n ...props\n}: SelectProps) => {\n const { isValid: validationIsValid, message: validationMessage } = validation || {};\n const invalid = useMemo(() => validationIsValid === false, [validationIsValid]);\n\n return (\n <div className={\"w-full\"}>\n <FormComponentLabel\n text={label}\n hint={hint}\n required={required}\n disabled={disabled}\n invalid={invalid}\n />\n <FormComponentDescription text={description} disabled={disabled} />\n <SelectPrimitive {...props} disabled={disabled} invalid={invalid} />\n <FormComponentErrorMessage\n text={validationMessage}\n invalid={invalid}\n disabled={disabled}\n />\n <FormComponentNote text={note} disabled={disabled} />\n </div>\n );\n};\nconst Select = makeDecoratable(\"Select\", DecoratableSelect);\n\nexport { Select, type SelectProps };\n"],"names":["DecoratableSelect","label","description","note","hint","required","disabled","validation","props","validationIsValid","validationMessage","invalid","useMemo","FormComponentLabel","FormComponentDescription","SelectPrimitive","FormComponentErrorMessage","FormComponentNote","Select","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,UAAUC,QAAQ,IAAMH,AAAsB,UAAtBA,mBAA6B;QAACA;KAAkB;IAE9E,OAAO,WAAP,GACI,oBAAC;QAAI,WAAW;qBACZ,oBAACI,oBAAkBA;QACf,MAAMZ;QACN,MAAMG;QACN,UAAUC;QACV,UAAUC;QACV,SAASK;sBAEb,oBAACG,0BAAwBA;QAAC,MAAMZ;QAAa,UAAUI;sBACvD,oBAACS,iBAAeA;QAAE,GAAGP,KAAK;QAAE,UAAUF;QAAU,SAASK;sBACzD,oBAACK,2BAAyBA;QACtB,MAAMN;QACN,SAASC;QACT,UAAUL;sBAEd,oBAACW,mBAAiBA;QAAC,MAAMd;QAAM,UAAUG;;AAGrD;AACA,MAAMY,SAASC,gBAAgB,UAAUnB"}
1
+ {"version":3,"file":"Select/Select.js","sources":["../../src/Select/Select.tsx"],"sourcesContent":["import React, { useMemo } from \"react\";\nimport { makeDecoratable, generateId } from \"~/utils.js\";\nimport type { SelectPrimitiveProps } from \"./primitives/index.js\";\nimport { SelectPrimitive } from \"./primitives/index.js\";\nimport type { FormComponentProps } from \"~/FormComponent/index.js\";\nimport {\n FormComponentDescription,\n FormComponentErrorMessage,\n FormComponentLabel,\n FormComponentNote\n} from \"~/FormComponent/index.js\";\n\ntype SelectProps = SelectPrimitiveProps & FormComponentProps;\n\nconst DecoratableSelect = ({\n label,\n description,\n note,\n hint,\n required,\n disabled,\n validation,\n ...props\n}: SelectProps) => {\n const { isValid: validationIsValid, message: validationMessage } = validation || {};\n const invalid = useMemo(() => validationIsValid === false, [validationIsValid]);\n /* The label names the trigger, so `getByLabelText` / `{ label }` find the select. */\n const id = useMemo(() => generateId(props.id), [props.id]);\n\n return (\n <div className={\"w-full\"}>\n <FormComponentLabel\n htmlFor={id}\n text={label}\n hint={hint}\n required={required}\n disabled={disabled}\n invalid={invalid}\n />\n <FormComponentDescription text={description} disabled={disabled} />\n <SelectPrimitive {...props} id={id} disabled={disabled} invalid={invalid} />\n <FormComponentErrorMessage\n text={validationMessage}\n invalid={invalid}\n disabled={disabled}\n />\n <FormComponentNote text={note} disabled={disabled} />\n </div>\n );\n};\nconst Select = makeDecoratable(\"Select\", DecoratableSelect);\n\nexport { Select, type SelectProps };\n"],"names":["DecoratableSelect","label","description","note","hint","required","disabled","validation","props","validationIsValid","validationMessage","invalid","useMemo","id","generateId","FormComponentLabel","FormComponentDescription","SelectPrimitive","FormComponentErrorMessage","FormComponentNote","Select","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,UAAUC,QAAQ,IAAMH,AAAsB,UAAtBA,mBAA6B;QAACA;KAAkB;IAE9E,MAAMI,KAAKD,QAAQ,IAAME,WAAWN,MAAM,EAAE,GAAG;QAACA,MAAM,EAAE;KAAC;IAEzD,OAAO,WAAP,GACI,oBAAC;QAAI,WAAW;qBACZ,oBAACO,oBAAkBA;QACf,SAASF;QACT,MAAMZ;QACN,MAAMG;QACN,UAAUC;QACV,UAAUC;QACV,SAASK;sBAEb,oBAACK,0BAAwBA;QAAC,MAAMd;QAAa,UAAUI;sBACvD,oBAACW,iBAAeA;QAAE,GAAGT,KAAK;QAAE,IAAIK;QAAI,UAAUP;QAAU,SAASK;sBACjE,oBAACO,2BAAyBA;QACtB,MAAMR;QACN,SAASC;QACT,UAAUL;sBAEd,oBAACa,mBAAiBA;QAAC,MAAMhB;QAAM,UAAUG;;AAGrD;AACA,MAAMc,SAASC,gBAAgB,UAAUrB"}
@@ -31,6 +31,10 @@ interface SelectPrimitiveProps {
31
31
  * Whether to display the reset action button.
32
32
  */
33
33
  displayResetAction?: boolean;
34
+ /**
35
+ * The trigger's id — what a `<label htmlFor>` points at.
36
+ */
37
+ id?: string;
34
38
  /**
35
39
  * Indicates if the field is disabled.
36
40
  */
@@ -8,7 +8,7 @@ import * as __rspack_external_react from "react";
8
8
  const SelectRoot = Select.Root;
9
9
  const SelectGroup = Select.Group;
10
10
  const SelectValue = Select.Value;
11
- const Trigger = ({ hasValue, size, variant, startIcon, endIcon, invalid, onValueReset, disabled, displayResetAction, ...props })=>{
11
+ const Trigger = ({ id, hasValue, size, variant, startIcon, endIcon, invalid, onValueReset, disabled, displayResetAction, ...props })=>{
12
12
  const resetButton = __rspack_external_react.useMemo(()=>{
13
13
  if (!hasValue || !displayResetAction) return;
14
14
  return /*#__PURE__*/ __rspack_external_react.createElement(IconButton, {
@@ -34,6 +34,7 @@ const Trigger = ({ hasValue, size, variant, startIcon, endIcon, invalid, onValue
34
34
  variant
35
35
  ]);
36
36
  return /*#__PURE__*/ __rspack_external_react.createElement(SelectTrigger, {
37
+ id: id,
37
38
  size: size,
38
39
  variant: variant,
39
40
  invalid: invalid,
@@ -71,7 +72,7 @@ const SelectPrimitiveRenderer = ({ selectRootProps, selectTriggerProps, selectOp
71
72
  }), /*#__PURE__*/ __rspack_external_react.createElement(SelectOptions, selectOptionsProps));
72
73
  const SelectPrimitive = (props)=>{
73
74
  const { vm, changeValue, resetValue } = useSelect(props);
74
- const { size, variant, startIcon, endIcon, invalid, disabled, ...selectRootProps } = props;
75
+ const { id, size, variant, startIcon, endIcon, invalid, disabled, ...selectRootProps } = props;
75
76
  return /*#__PURE__*/ __rspack_external_react.createElement(SelectPrimitiveRenderer, {
76
77
  selectRootProps: {
77
78
  ...selectRootProps,
@@ -80,6 +81,7 @@ const SelectPrimitive = (props)=>{
80
81
  },
81
82
  selectTriggerProps: {
82
83
  ...vm.selectTrigger,
84
+ id,
83
85
  size,
84
86
  variant,
85
87
  startIcon,
@@ -1 +1 @@
1
- {"version":3,"file":"Select/primitives/SelectPrimitive.js","sources":["../../../src/Select/primitives/SelectPrimitive.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { ReactComponent as Close } from \"@webiny/icons/close.svg\";\nimport { Select as SelectPrimitives } from \"radix-ui\";\nimport { type VariantProps } from \"~/utils.js\";\nimport { useSelect } from \"./useSelect.js\";\nimport type { SelectOptionDto, SelectOptionFormatted } from \"../domains/index.js\";\nimport { IconButton } from \"~/Button/index.js\";\nimport { Icon } from \"~/Icon/index.js\";\nimport type { selectTriggerVariants } from \"./components/index.js\";\nimport {\n SelectContent,\n SelectItem,\n SelectLabel,\n SelectSeparator,\n SelectTrigger\n} from \"./components/index.js\";\n\nconst SelectRoot = SelectPrimitives.Root;\n\nconst SelectGroup = SelectPrimitives.Group;\n\nconst SelectValue = SelectPrimitives.Value;\n\n/**\n * Trigger\n */\ntype SelectTriggerVm = {\n placeholder: string;\n hasValue: boolean;\n displayResetAction: boolean;\n};\n\ntype SelectTriggerProps = SelectPrimitives.SelectValueProps &\n SelectTriggerVm & {\n size: VariantProps<typeof selectTriggerVariants>[\"size\"];\n variant: VariantProps<typeof selectTriggerVariants>[\"variant\"];\n invalid: VariantProps<typeof selectTriggerVariants>[\"invalid\"];\n startIcon?: React.ReactElement;\n endIcon?: React.ReactElement;\n onValueReset: () => void;\n disabled?: boolean;\n };\n\nconst Trigger = ({\n hasValue,\n size,\n variant,\n startIcon,\n endIcon,\n invalid,\n onValueReset,\n disabled,\n displayResetAction,\n ...props\n}: SelectTriggerProps) => {\n const resetButton = React.useMemo(() => {\n if (!hasValue || !displayResetAction) {\n return undefined;\n }\n\n return (\n <IconButton\n onPointerDown={event => {\n event.stopPropagation();\n onValueReset();\n }}\n icon={\n <span>\n <Icon\n icon={<Close />}\n label={\"Reset\"}\n color={variant === \"ghost-negative\" ? \"neutral-negative\" : \"inherit\"}\n />\n </span>\n }\n size={\"xs\"}\n variant={variant === \"ghost-negative\" ? \"ghost-negative\" : \"secondary\"}\n disabled={disabled}\n asChild\n />\n );\n }, [hasValue, onValueReset, disabled, displayResetAction, variant]);\n\n return (\n <SelectTrigger\n size={size}\n variant={variant}\n invalid={invalid}\n startIcon={startIcon}\n endIcon={endIcon}\n resetButton={resetButton}\n >\n <div className={\"flex-1 text-left truncate\"}>\n <SelectValue {...props} />\n </div>\n </SelectTrigger>\n );\n};\n\n/**\n * SelectOptions\n */\ntype SelectOptionsVm = {\n options: SelectOptionFormatted[];\n};\n\ntype SelectOptionsProps = SelectOptionsVm;\n\nconst SelectOptions = (props: SelectOptionsProps) => {\n const renderOptions = React.useCallback((items: SelectOptionFormatted[]) => {\n return items.map((item, index) => {\n const elements = [];\n\n if (item.options.length > 0) {\n // Render as a group if there are nested options\n elements.push(\n <SelectGroup key={`group-${index}`}>\n <SelectLabel>{item.label}</SelectLabel>\n {renderOptions(item.options)}\n </SelectGroup>\n );\n }\n\n if (item.value) {\n // Render as a select item if there are no nested options\n elements.push(\n <SelectItem\n key={`item-${item.value}`}\n value={item.value}\n disabled={item.disabled}\n >\n {item.label}\n </SelectItem>\n );\n }\n\n // Conditionally render the separator if hasSeparator is true\n if (item.separator) {\n elements.push(<SelectSeparator key={`separator-${item.value ?? index}`} />);\n }\n\n return elements;\n });\n }, []);\n\n return <SelectContent>{renderOptions(props.options)}</SelectContent>;\n};\n\n/**\n * SelectRenderer\n */\nexport type SelectRootVm = {\n value: string;\n};\n\ntype SelectRootProps = Omit<SelectPrimitives.SelectProps, \"onValueChange\">;\n\ntype SelectRendererProps = {\n selectRootProps: SelectRootProps;\n selectTriggerProps: Omit<SelectTriggerProps, \"onValueReset\">;\n selectOptionsProps: SelectOptionsProps;\n onValueChange: (value: string) => void;\n onValueReset: () => void;\n};\n\nconst SelectPrimitiveRenderer = ({\n selectRootProps,\n selectTriggerProps,\n selectOptionsProps,\n onValueChange,\n onValueReset\n}: SelectRendererProps) => {\n return (\n <SelectRoot {...selectRootProps} onValueChange={onValueChange}>\n <Trigger {...selectTriggerProps} onValueReset={onValueReset} />\n <SelectOptions {...selectOptionsProps} />\n </SelectRoot>\n );\n};\n\n/**\n * Select\n */\ntype SelectOption = SelectOptionDto | string;\n\ninterface SelectPrimitiveProps {\n /**\n * Whether to display the reset action button.\n */\n displayResetAction?: boolean;\n /**\n * Indicates if the field is disabled.\n */\n disabled?: boolean;\n /**\n * Icon to display at the end of the select trigger.\n */\n endIcon?: React.ReactElement;\n /**\n * Whether the select input is invalid.\n */\n invalid?: VariantProps<typeof selectTriggerVariants>[\"invalid\"];\n /**\n * Callback function called when the value changes.\n */\n onChange?: (value: string) => void;\n /**\n * Callback function called when the open state changes.\n */\n onOpenChange?: (open: boolean) => void;\n /**\n * Callback function called when the value is reset.\n */\n onValueReset?: () => void;\n /**\n * Array of options to display in the select dropdown.\n */\n options?: SelectOption[];\n /**\n * Placeholder text to display when no value is selected.\n */\n placeholder?: string;\n /**\n * Size variant of the select trigger.\n */\n size?: VariantProps<typeof selectTriggerVariants>[\"size\"];\n /**\n * Icon to display at the start of the select trigger.\n */\n startIcon?: React.ReactElement;\n /**\n * The value of the select input.\n */\n value?: string;\n /**\n * Style variant of the select trigger.\n */\n variant?: VariantProps<typeof selectTriggerVariants>[\"variant\"];\n}\n\nconst SelectPrimitive = (props: SelectPrimitiveProps) => {\n const { vm, changeValue, resetValue } = useSelect(props);\n const { size, variant, startIcon, endIcon, invalid, disabled, ...selectRootProps } = props;\n\n return (\n <SelectPrimitiveRenderer\n selectRootProps={{ ...selectRootProps, ...vm.selectRoot, disabled }}\n selectTriggerProps={{\n ...vm.selectTrigger,\n size,\n variant,\n startIcon,\n endIcon,\n invalid,\n disabled\n }}\n selectOptionsProps={vm.selectOptions}\n onValueChange={changeValue}\n onValueReset={resetValue}\n />\n );\n};\n\nexport {\n SelectPrimitive,\n type SelectPrimitiveProps,\n type SelectOptionsVm,\n type SelectTriggerVm,\n type SelectOption\n};\n"],"names":["SelectRoot","SelectPrimitives","SelectGroup","SelectValue","Trigger","hasValue","size","variant","startIcon","endIcon","invalid","onValueReset","disabled","displayResetAction","props","resetButton","React","IconButton","event","Icon","Close","SelectTrigger","SelectOptions","renderOptions","items","item","index","elements","SelectLabel","SelectItem","SelectSeparator","SelectContent","SelectPrimitiveRenderer","selectRootProps","selectTriggerProps","selectOptionsProps","onValueChange","SelectPrimitive","vm","changeValue","resetValue","useSelect"],"mappings":";;;;;;;AAiBA,MAAMA,aAAaC,OAAAA,IAAqB;AAExC,MAAMC,cAAcD,OAAAA,KAAsB;AAE1C,MAAME,cAAcF,OAAAA,KAAsB;AAsB1C,MAAMG,UAAU,CAAC,EACbC,QAAQ,EACRC,IAAI,EACJC,OAAO,EACPC,SAAS,EACTC,OAAO,EACPC,OAAO,EACPC,YAAY,EACZC,QAAQ,EACRC,kBAAkB,EAClB,GAAGC,OACc;IACjB,MAAMC,cAAcC,wBAAAA,OAAa,CAAC;QAC9B,IAAI,CAACX,YAAY,CAACQ,oBACd;QAGJ,OAAO,WAAP,GACI,sCAACI,YAAUA;YACP,eAAeC,CAAAA;gBACXA,MAAM,eAAe;gBACrBP;YACJ;YACA,oBACI,sCAAC,4BACG,sCAACQ,MAAIA;gBACD,oBAAM,sCAACC,gBAAKA;gBACZ,OAAO;gBACP,OAAOb,AAAY,qBAAZA,UAA+B,qBAAqB;;YAIvE,MAAM;YACN,SAASA,AAAY,qBAAZA,UAA+B,mBAAmB;YAC3D,UAAUK;YACV;;IAGZ,GAAG;QAACP;QAAUM;QAAcC;QAAUC;QAAoBN;KAAQ;IAElE,OAAO,WAAP,GACI,sCAACc,eAAaA;QACV,MAAMf;QACN,SAASC;QACT,SAASG;QACT,WAAWF;QACX,SAASC;QACT,aAAaM;qBAEb,sCAAC;QAAI,WAAW;qBACZ,sCAACZ,aAAgBW;AAIjC;AAWA,MAAMQ,gBAAgB,CAACR;IACnB,MAAMS,gBAAgBP,wBAAAA,WAAiB,CAAC,CAACQ,QAC9BA,MAAM,GAAG,CAAC,CAACC,MAAMC;YACpB,MAAMC,WAAW,EAAE;YAEnB,IAAIF,KAAK,OAAO,CAAC,MAAM,GAAG,GAEtBE,SAAS,IAAI,CAAC,WAAD,GACT,sCAACzB,aAAWA;gBAAC,KAAK,CAAC,MAAM,EAAEwB,OAAO;6BAC9B,sCAACE,aAAWA,MAAEH,KAAK,KAAK,GACvBF,cAAcE,KAAK,OAAO;YAKvC,IAAIA,KAAK,KAAK,EAEVE,SAAS,IAAI,CAAC,WAAD,GACT,sCAACE,YAAUA;gBACP,KAAK,CAAC,KAAK,EAAEJ,KAAK,KAAK,EAAE;gBACzB,OAAOA,KAAK,KAAK;gBACjB,UAAUA,KAAK,QAAQ;eAEtBA,KAAK,KAAK;YAMvB,IAAIA,KAAK,SAAS,EACdE,SAAS,IAAI,CAAC,WAAD,GAAC,sCAACG,iBAAeA;gBAAC,KAAK,CAAC,UAAU,EAAEL,KAAK,KAAK,IAAIC,OAAO;;YAG1E,OAAOC;QACX,IACD,EAAE;IAEL,OAAO,WAAP,GAAO,sCAACI,eAAaA,MAAER,cAAcT,MAAM,OAAO;AACtD;AAmBA,MAAMkB,0BAA0B,CAAC,EAC7BC,eAAe,EACfC,kBAAkB,EAClBC,kBAAkB,EAClBC,aAAa,EACbzB,YAAY,EACM,GACX,WAAP,GACI,sCAACX,YAAUA;QAAE,GAAGiC,eAAe;QAAE,eAAeG;qBAC5C,sCAAChC,SAAOA;QAAE,GAAG8B,kBAAkB;QAAE,cAAcvB;sBAC/C,sCAACW,eAAkBa;AAiE/B,MAAME,kBAAkB,CAACvB;IACrB,MAAM,EAAEwB,EAAE,EAAEC,WAAW,EAAEC,UAAU,EAAE,GAAGC,UAAU3B;IAClD,MAAM,EAAER,IAAI,EAAEC,OAAO,EAAEC,SAAS,EAAEC,OAAO,EAAEC,OAAO,EAAEE,QAAQ,EAAE,GAAGqB,iBAAiB,GAAGnB;IAErF,OAAO,WAAP,GACI,sCAACkB,yBAAuBA;QACpB,iBAAiB;YAAE,GAAGC,eAAe;YAAE,GAAGK,GAAG,UAAU;YAAE1B;QAAS;QAClE,oBAAoB;YAChB,GAAG0B,GAAG,aAAa;YACnBhC;YACAC;YACAC;YACAC;YACAC;YACAE;QACJ;QACA,oBAAoB0B,GAAG,aAAa;QACpC,eAAeC;QACf,cAAcC;;AAG1B"}
1
+ {"version":3,"file":"Select/primitives/SelectPrimitive.js","sources":["../../../src/Select/primitives/SelectPrimitive.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { ReactComponent as Close } from \"@webiny/icons/close.svg\";\nimport { Select as SelectPrimitives } from \"radix-ui\";\nimport { type VariantProps } from \"~/utils.js\";\nimport { useSelect } from \"./useSelect.js\";\nimport type { SelectOptionDto, SelectOptionFormatted } from \"../domains/index.js\";\nimport { IconButton } from \"~/Button/index.js\";\nimport { Icon } from \"~/Icon/index.js\";\nimport type { selectTriggerVariants } from \"./components/index.js\";\nimport {\n SelectContent,\n SelectItem,\n SelectLabel,\n SelectSeparator,\n SelectTrigger\n} from \"./components/index.js\";\n\nconst SelectRoot = SelectPrimitives.Root;\n\nconst SelectGroup = SelectPrimitives.Group;\n\nconst SelectValue = SelectPrimitives.Value;\n\n/**\n * Trigger\n */\ntype SelectTriggerVm = {\n placeholder: string;\n hasValue: boolean;\n displayResetAction: boolean;\n};\n\ntype SelectTriggerProps = SelectPrimitives.SelectValueProps &\n SelectTriggerVm & {\n size: VariantProps<typeof selectTriggerVariants>[\"size\"];\n variant: VariantProps<typeof selectTriggerVariants>[\"variant\"];\n invalid: VariantProps<typeof selectTriggerVariants>[\"invalid\"];\n startIcon?: React.ReactElement;\n endIcon?: React.ReactElement;\n onValueReset: () => void;\n disabled?: boolean;\n /** Lands on the trigger — the `combobox` a label names — not on the value inside it. */\n id?: string;\n };\n\nconst Trigger = ({\n id,\n hasValue,\n size,\n variant,\n startIcon,\n endIcon,\n invalid,\n onValueReset,\n disabled,\n displayResetAction,\n ...props\n}: SelectTriggerProps) => {\n const resetButton = React.useMemo(() => {\n if (!hasValue || !displayResetAction) {\n return undefined;\n }\n\n return (\n <IconButton\n onPointerDown={event => {\n event.stopPropagation();\n onValueReset();\n }}\n icon={\n <span>\n <Icon\n icon={<Close />}\n label={\"Reset\"}\n color={variant === \"ghost-negative\" ? \"neutral-negative\" : \"inherit\"}\n />\n </span>\n }\n size={\"xs\"}\n variant={variant === \"ghost-negative\" ? \"ghost-negative\" : \"secondary\"}\n disabled={disabled}\n asChild\n />\n );\n }, [hasValue, onValueReset, disabled, displayResetAction, variant]);\n\n return (\n <SelectTrigger\n id={id}\n size={size}\n variant={variant}\n invalid={invalid}\n startIcon={startIcon}\n endIcon={endIcon}\n resetButton={resetButton}\n >\n <div className={\"flex-1 text-left truncate\"}>\n <SelectValue {...props} />\n </div>\n </SelectTrigger>\n );\n};\n\n/**\n * SelectOptions\n */\ntype SelectOptionsVm = {\n options: SelectOptionFormatted[];\n};\n\ntype SelectOptionsProps = SelectOptionsVm;\n\nconst SelectOptions = (props: SelectOptionsProps) => {\n const renderOptions = React.useCallback((items: SelectOptionFormatted[]) => {\n return items.map((item, index) => {\n const elements = [];\n\n if (item.options.length > 0) {\n // Render as a group if there are nested options\n elements.push(\n <SelectGroup key={`group-${index}`}>\n <SelectLabel>{item.label}</SelectLabel>\n {renderOptions(item.options)}\n </SelectGroup>\n );\n }\n\n if (item.value) {\n // Render as a select item if there are no nested options\n elements.push(\n <SelectItem\n key={`item-${item.value}`}\n value={item.value}\n disabled={item.disabled}\n >\n {item.label}\n </SelectItem>\n );\n }\n\n // Conditionally render the separator if hasSeparator is true\n if (item.separator) {\n elements.push(<SelectSeparator key={`separator-${item.value ?? index}`} />);\n }\n\n return elements;\n });\n }, []);\n\n return <SelectContent>{renderOptions(props.options)}</SelectContent>;\n};\n\n/**\n * SelectRenderer\n */\nexport type SelectRootVm = {\n value: string;\n};\n\ntype SelectRootProps = Omit<SelectPrimitives.SelectProps, \"onValueChange\">;\n\ntype SelectRendererProps = {\n selectRootProps: SelectRootProps;\n selectTriggerProps: Omit<SelectTriggerProps, \"onValueReset\">;\n selectOptionsProps: SelectOptionsProps;\n onValueChange: (value: string) => void;\n onValueReset: () => void;\n};\n\nconst SelectPrimitiveRenderer = ({\n selectRootProps,\n selectTriggerProps,\n selectOptionsProps,\n onValueChange,\n onValueReset\n}: SelectRendererProps) => {\n return (\n <SelectRoot {...selectRootProps} onValueChange={onValueChange}>\n <Trigger {...selectTriggerProps} onValueReset={onValueReset} />\n <SelectOptions {...selectOptionsProps} />\n </SelectRoot>\n );\n};\n\n/**\n * Select\n */\ntype SelectOption = SelectOptionDto | string;\n\ninterface SelectPrimitiveProps {\n /**\n * Whether to display the reset action button.\n */\n displayResetAction?: boolean;\n /**\n * The trigger's id — what a `<label htmlFor>` points at.\n */\n id?: string;\n /**\n * Indicates if the field is disabled.\n */\n disabled?: boolean;\n /**\n * Icon to display at the end of the select trigger.\n */\n endIcon?: React.ReactElement;\n /**\n * Whether the select input is invalid.\n */\n invalid?: VariantProps<typeof selectTriggerVariants>[\"invalid\"];\n /**\n * Callback function called when the value changes.\n */\n onChange?: (value: string) => void;\n /**\n * Callback function called when the open state changes.\n */\n onOpenChange?: (open: boolean) => void;\n /**\n * Callback function called when the value is reset.\n */\n onValueReset?: () => void;\n /**\n * Array of options to display in the select dropdown.\n */\n options?: SelectOption[];\n /**\n * Placeholder text to display when no value is selected.\n */\n placeholder?: string;\n /**\n * Size variant of the select trigger.\n */\n size?: VariantProps<typeof selectTriggerVariants>[\"size\"];\n /**\n * Icon to display at the start of the select trigger.\n */\n startIcon?: React.ReactElement;\n /**\n * The value of the select input.\n */\n value?: string;\n /**\n * Style variant of the select trigger.\n */\n variant?: VariantProps<typeof selectTriggerVariants>[\"variant\"];\n}\n\nconst SelectPrimitive = (props: SelectPrimitiveProps) => {\n const { vm, changeValue, resetValue } = useSelect(props);\n const { id, size, variant, startIcon, endIcon, invalid, disabled, ...selectRootProps } = props;\n\n return (\n <SelectPrimitiveRenderer\n selectRootProps={{ ...selectRootProps, ...vm.selectRoot, disabled }}\n selectTriggerProps={{\n ...vm.selectTrigger,\n id,\n size,\n variant,\n startIcon,\n endIcon,\n invalid,\n disabled\n }}\n selectOptionsProps={vm.selectOptions}\n onValueChange={changeValue}\n onValueReset={resetValue}\n />\n );\n};\n\nexport {\n SelectPrimitive,\n type SelectPrimitiveProps,\n type SelectOptionsVm,\n type SelectTriggerVm,\n type SelectOption\n};\n"],"names":["SelectRoot","SelectPrimitives","SelectGroup","SelectValue","Trigger","id","hasValue","size","variant","startIcon","endIcon","invalid","onValueReset","disabled","displayResetAction","props","resetButton","React","IconButton","event","Icon","Close","SelectTrigger","SelectOptions","renderOptions","items","item","index","elements","SelectLabel","SelectItem","SelectSeparator","SelectContent","SelectPrimitiveRenderer","selectRootProps","selectTriggerProps","selectOptionsProps","onValueChange","SelectPrimitive","vm","changeValue","resetValue","useSelect"],"mappings":";;;;;;;AAiBA,MAAMA,aAAaC,OAAAA,IAAqB;AAExC,MAAMC,cAAcD,OAAAA,KAAsB;AAE1C,MAAME,cAAcF,OAAAA,KAAsB;AAwB1C,MAAMG,UAAU,CAAC,EACbC,EAAE,EACFC,QAAQ,EACRC,IAAI,EACJC,OAAO,EACPC,SAAS,EACTC,OAAO,EACPC,OAAO,EACPC,YAAY,EACZC,QAAQ,EACRC,kBAAkB,EAClB,GAAGC,OACc;IACjB,MAAMC,cAAcC,wBAAAA,OAAa,CAAC;QAC9B,IAAI,CAACX,YAAY,CAACQ,oBACd;QAGJ,OAAO,WAAP,GACI,sCAACI,YAAUA;YACP,eAAeC,CAAAA;gBACXA,MAAM,eAAe;gBACrBP;YACJ;YACA,oBACI,sCAAC,4BACG,sCAACQ,MAAIA;gBACD,oBAAM,sCAACC,gBAAKA;gBACZ,OAAO;gBACP,OAAOb,AAAY,qBAAZA,UAA+B,qBAAqB;;YAIvE,MAAM;YACN,SAASA,AAAY,qBAAZA,UAA+B,mBAAmB;YAC3D,UAAUK;YACV;;IAGZ,GAAG;QAACP;QAAUM;QAAcC;QAAUC;QAAoBN;KAAQ;IAElE,OAAO,WAAP,GACI,sCAACc,eAAaA;QACV,IAAIjB;QACJ,MAAME;QACN,SAASC;QACT,SAASG;QACT,WAAWF;QACX,SAASC;QACT,aAAaM;qBAEb,sCAAC;QAAI,WAAW;qBACZ,sCAACb,aAAgBY;AAIjC;AAWA,MAAMQ,gBAAgB,CAACR;IACnB,MAAMS,gBAAgBP,wBAAAA,WAAiB,CAAC,CAACQ,QAC9BA,MAAM,GAAG,CAAC,CAACC,MAAMC;YACpB,MAAMC,WAAW,EAAE;YAEnB,IAAIF,KAAK,OAAO,CAAC,MAAM,GAAG,GAEtBE,SAAS,IAAI,CAAC,WAAD,GACT,sCAAC1B,aAAWA;gBAAC,KAAK,CAAC,MAAM,EAAEyB,OAAO;6BAC9B,sCAACE,aAAWA,MAAEH,KAAK,KAAK,GACvBF,cAAcE,KAAK,OAAO;YAKvC,IAAIA,KAAK,KAAK,EAEVE,SAAS,IAAI,CAAC,WAAD,GACT,sCAACE,YAAUA;gBACP,KAAK,CAAC,KAAK,EAAEJ,KAAK,KAAK,EAAE;gBACzB,OAAOA,KAAK,KAAK;gBACjB,UAAUA,KAAK,QAAQ;eAEtBA,KAAK,KAAK;YAMvB,IAAIA,KAAK,SAAS,EACdE,SAAS,IAAI,CAAC,WAAD,GAAC,sCAACG,iBAAeA;gBAAC,KAAK,CAAC,UAAU,EAAEL,KAAK,KAAK,IAAIC,OAAO;;YAG1E,OAAOC;QACX,IACD,EAAE;IAEL,OAAO,WAAP,GAAO,sCAACI,eAAaA,MAAER,cAAcT,MAAM,OAAO;AACtD;AAmBA,MAAMkB,0BAA0B,CAAC,EAC7BC,eAAe,EACfC,kBAAkB,EAClBC,kBAAkB,EAClBC,aAAa,EACbzB,YAAY,EACM,GACX,WAAP,GACI,sCAACZ,YAAUA;QAAE,GAAGkC,eAAe;QAAE,eAAeG;qBAC5C,sCAACjC,SAAOA;QAAE,GAAG+B,kBAAkB;QAAE,cAAcvB;sBAC/C,sCAACW,eAAkBa;AAqE/B,MAAME,kBAAkB,CAACvB;IACrB,MAAM,EAAEwB,EAAE,EAAEC,WAAW,EAAEC,UAAU,EAAE,GAAGC,UAAU3B;IAClD,MAAM,EAAEV,EAAE,EAAEE,IAAI,EAAEC,OAAO,EAAEC,SAAS,EAAEC,OAAO,EAAEC,OAAO,EAAEE,QAAQ,EAAE,GAAGqB,iBAAiB,GAAGnB;IAEzF,OAAO,WAAP,GACI,sCAACkB,yBAAuBA;QACpB,iBAAiB;YAAE,GAAGC,eAAe;YAAE,GAAGK,GAAG,UAAU;YAAE1B;QAAS;QAClE,oBAAoB;YAChB,GAAG0B,GAAG,aAAa;YACnBlC;YACAE;YACAC;YACAC;YACAC;YACAC;YACAE;QACJ;QACA,oBAAoB0B,GAAG,aAAa;QACpC,eAAeC;QACf,cAAcC;;AAG1B"}
@@ -1,22 +1,20 @@
1
1
  import { Select } from "radix-ui";
2
2
  import { cn } from "../../../utils.js";
3
- import { SelectScrollUpButton } from "./SelectScrollUpButton.js";
4
- import { SelectScrollDownButton } from "./SelectScrollDownButton.js";
5
3
  import * as __rspack_external_react from "react";
6
4
  const SelectContent = ({ className, children, ...props })=>/*#__PURE__*/ __rspack_external_react.createElement(Select.Portal, null, /*#__PURE__*/ __rspack_external_react.createElement(Select.Content, {
7
5
  className: cn([
8
- "relative z-popover max-h-[250px] min-w-56 shadow-lg py-sm overflow-hidden rounded-sm border-sm border-neutral-muted bg-neutral-base text-neutral-strong",
6
+ "relative z-popover max-h-[250px] min-w-56 shadow-lg overflow-hidden rounded-sm border-sm border-neutral-muted bg-neutral-base text-neutral-strong",
9
7
  "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
10
8
  "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1"
11
9
  ], className),
12
10
  position: "popper",
13
11
  ...props
14
- }, /*#__PURE__*/ __rspack_external_react.createElement(SelectScrollUpButton, null), /*#__PURE__*/ __rspack_external_react.createElement(Select.Viewport, {
12
+ }, /*#__PURE__*/ __rspack_external_react.createElement(Select.Viewport, {
15
13
  className: cn([
16
- "py-xs",
14
+ "py-sm",
17
15
  "h-(--radix-select-trigger-height) w-full min-w-(--radix-select-trigger-width)"
18
16
  ])
19
- }, children), /*#__PURE__*/ __rspack_external_react.createElement(SelectScrollDownButton, null)));
17
+ }, children)));
20
18
  export { SelectContent };
21
19
 
22
20
  //# sourceMappingURL=SelectContent.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Select/primitives/components/SelectContent.js","sources":["../../../../src/Select/primitives/components/SelectContent.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { Select as SelectPrimitives } from \"radix-ui\";\nimport { cn } from \"~/utils.js\";\nimport { SelectScrollUpButton } from \"./SelectScrollUpButton.js\";\nimport { SelectScrollDownButton } from \"./SelectScrollDownButton.js\";\n\ntype SelectContentProps = SelectPrimitives.SelectContentProps;\n\nconst SelectContent = ({ className, children, ...props }: SelectContentProps) => (\n <SelectPrimitives.Portal>\n <SelectPrimitives.Content\n className={cn(\n [\n \"relative z-popover max-h-[250px] min-w-56 shadow-lg py-sm overflow-hidden rounded-sm border-sm border-neutral-muted bg-neutral-base text-neutral-strong\",\n \"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2\",\n \"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1\"\n ],\n className\n )}\n position={\"popper\"}\n {...props}\n >\n <SelectScrollUpButton />\n <SelectPrimitives.Viewport\n className={cn([\n \"py-xs\",\n \"h-(--radix-select-trigger-height) w-full min-w-(--radix-select-trigger-width)\"\n ])}\n >\n {children}\n </SelectPrimitives.Viewport>\n <SelectScrollDownButton />\n </SelectPrimitives.Content>\n </SelectPrimitives.Portal>\n);\n\nexport { SelectContent, type SelectContentProps };\n"],"names":["SelectContent","className","children","props","SelectPrimitives","cn","SelectScrollUpButton","SelectScrollDownButton"],"mappings":";;;;;AAQA,MAAMA,gBAAgB,CAAC,EAAEC,SAAS,EAAEC,QAAQ,EAAE,GAAGC,OAA2B,iBACxE,sCAACC,OAAAA,MAAuB,sBACpB,sCAACA,OAAAA,OAAwB;QACrB,WAAWC,GACP;YACI;YACA;YACA;SACH,EACDJ;QAEJ,UAAU;QACT,GAAGE,KAAK;qBAET,sCAACG,sBAAoBA,OAAAA,WAAAA,GACrB,sCAACF,OAAAA,QAAyB;QACtB,WAAWC,GAAG;YACV;YACA;SACH;OAEAH,WAAAA,WAAAA,GAEL,sCAACK,wBAAsBA"}
1
+ {"version":3,"file":"Select/primitives/components/SelectContent.js","sources":["../../../../src/Select/primitives/components/SelectContent.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { Select as SelectPrimitives } from \"radix-ui\";\nimport { cn } from \"~/utils.js\";\n\ntype SelectContentProps = SelectPrimitives.SelectContentProps;\n\nconst SelectContent = ({ className, children, ...props }: SelectContentProps) => (\n <SelectPrimitives.Portal>\n <SelectPrimitives.Content\n className={cn(\n [\n \"relative z-popover max-h-[250px] min-w-56 shadow-lg overflow-hidden rounded-sm border-sm border-neutral-muted bg-neutral-base text-neutral-strong\",\n \"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2\",\n \"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1\"\n ],\n className\n )}\n position={\"popper\"}\n {...props}\n >\n {/* Two things keep this scrollbar in line with the one in the autocomplete popovers.\n No scroll buttons, because they come and go with the scroll position, taking the\n viewport height and the size of the thumb with them. And the padding on the\n viewport rather than around it, so the scrollbar runs the full height of the list. */}\n <SelectPrimitives.Viewport\n className={cn([\n \"py-sm\",\n \"h-(--radix-select-trigger-height) w-full min-w-(--radix-select-trigger-width)\"\n ])}\n >\n {children}\n </SelectPrimitives.Viewport>\n </SelectPrimitives.Content>\n </SelectPrimitives.Portal>\n);\n\nexport { SelectContent, type SelectContentProps };\n"],"names":["SelectContent","className","children","props","SelectPrimitives","cn"],"mappings":";;;AAMA,MAAMA,gBAAgB,CAAC,EAAEC,SAAS,EAAEC,QAAQ,EAAE,GAAGC,OAA2B,iBACxE,sCAACC,OAAAA,MAAuB,sBACpB,sCAACA,OAAAA,OAAwB;QACrB,WAAWC,GACP;YACI;YACA;YACA;SACH,EACDJ;QAEJ,UAAU;QACT,GAAGE,KAAK;qBAMT,sCAACC,OAAAA,QAAyB;QACtB,WAAWC,GAAG;YACV;YACA;SACH;OAEAH"}
@@ -0,0 +1,46 @@
1
+ import * as React from "react";
2
+ interface SidePanelProps extends Omit<React.HTMLAttributes<HTMLElement>, "title"> {
3
+ title: React.ReactNode;
4
+ /** A 20px icon ahead of the title. */
5
+ icon?: React.ReactElement;
6
+ /** Shows a back button, for a panel that has drilled into one item. */
7
+ onBack?: () => void;
8
+ backLabel?: string;
9
+ /** After the title: a small tertiary button and the few ghost icon buttons that matter. */
10
+ headerEnd?: React.ReactNode;
11
+ onClose?: () => void;
12
+ closeLabel?: string;
13
+ /** A fixed row under the header that does not scroll, such as a search field. */
14
+ headerExtra?: React.ReactNode;
15
+ width?: React.CSSProperties["width"];
16
+ /** `SidePanelBody`, then an optional `SidePanelFooter`. */
17
+ children: React.ReactNode;
18
+ }
19
+ /**
20
+ * A panel docked beside the page that stays open while people keep working. Unlike a Drawer it has no
21
+ * backdrop and does not trap focus: the page narrows to make room. Below 1024px it covers the page
22
+ * instead, so the host has to be the positioned element the panel sits in.
23
+ *
24
+ * Esc closes it only while focus is inside it, since the page beside it is still in use.
25
+ */
26
+ declare const SidePanelBase: ({ title, icon, onBack, backLabel, headerEnd, onClose, closeLabel, headerExtra, width, className, style, children, ...props }: SidePanelProps) => React.JSX.Element;
27
+ declare const SidePanel: typeof SidePanelBase & {
28
+ original: typeof SidePanelBase;
29
+ originalName: string;
30
+ displayName: string;
31
+ } & {
32
+ original: typeof SidePanelBase & {
33
+ original: typeof SidePanelBase;
34
+ originalName: string;
35
+ displayName: string;
36
+ };
37
+ originalName: string;
38
+ displayName: string;
39
+ } & {
40
+ createDecorator: (decorator: import("@webiny/react-composition/types").ComponentDecorator<typeof SidePanelBase & {
41
+ original: typeof SidePanelBase;
42
+ originalName: string;
43
+ displayName: string;
44
+ }>) => (props: unknown) => React.JSX.Element;
45
+ };
46
+ export { SidePanel, type SidePanelProps };
@@ -0,0 +1,47 @@
1
+ import { ReactComponent } from "@webiny/icons/chevron_left.svg";
2
+ import { ReactComponent as close_svg_ReactComponent } from "@webiny/icons/close.svg";
3
+ import { cn, makeDecoratable } from "../utils.js";
4
+ import { IconButton } from "../Button/index.js";
5
+ import * as __rspack_external_react from "react";
6
+ const SidePanelBase = ({ title, icon, onBack, backLabel = "Back", headerEnd, onClose, closeLabel = "Close panel", headerExtra, width = 464, className, style, children, ...props })=>{
7
+ const onKeyDown = (event)=>{
8
+ if ("Escape" === event.key && onClose && !event.defaultPrevented) {
9
+ event.preventDefault();
10
+ onClose();
11
+ }
12
+ };
13
+ return /*#__PURE__*/ __rspack_external_react.createElement("aside", {
14
+ "aria-label": "string" == typeof title ? title : void 0,
15
+ onKeyDown: onKeyDown,
16
+ className: cn("flex h-full min-h-0 flex-none flex-col border-l-sm border-neutral-dimmed bg-neutral-base text-neutral-strong", "max-lg:absolute max-lg:inset-y-0 max-lg:right-0 max-lg:z-overlay max-lg:shadow-lg", className),
17
+ style: {
18
+ width,
19
+ ...style
20
+ },
21
+ ...props
22
+ }, /*#__PURE__*/ __rspack_external_react.createElement("div", {
23
+ className: cn("flex h-[56px] flex-none items-center gap-xs border-b-sm border-neutral-dimmed pr-sm", onBack ? "pl-sm" : "pl-md")
24
+ }, onBack ? /*#__PURE__*/ __rspack_external_react.createElement(IconButton, {
25
+ variant: "ghost",
26
+ size: "md",
27
+ icon: /*#__PURE__*/ __rspack_external_react.createElement(ReactComponent, null),
28
+ "aria-label": backLabel,
29
+ onClick: onBack
30
+ }) : null, icon ? /*#__PURE__*/ __rspack_external_react.createElement("span", {
31
+ className: "mr-xxs inline-flex"
32
+ }, icon) : null, /*#__PURE__*/ __rspack_external_react.createElement("h2", {
33
+ className: "m-0 min-w-0 flex-1 truncate text-h5 text-neutral-primary"
34
+ }, title), headerEnd, onClose ? /*#__PURE__*/ __rspack_external_react.createElement(IconButton, {
35
+ variant: "ghost",
36
+ size: "md",
37
+ icon: /*#__PURE__*/ __rspack_external_react.createElement(close_svg_ReactComponent, null),
38
+ "aria-label": closeLabel,
39
+ onClick: onClose
40
+ }) : null), headerExtra ? /*#__PURE__*/ __rspack_external_react.createElement("div", {
41
+ className: "flex-none px-md pb-sm pt-md"
42
+ }, headerExtra) : null, children);
43
+ };
44
+ const SidePanel = makeDecoratable("SidePanel", SidePanelBase);
45
+ export { SidePanel };
46
+
47
+ //# sourceMappingURL=SidePanel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SidePanel/SidePanel.js","sources":["../../src/SidePanel/SidePanel.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { ReactComponent as BackIcon } from \"@webiny/icons/chevron_left.svg\";\nimport { ReactComponent as CloseIcon } from \"@webiny/icons/close.svg\";\nimport { cn } from \"~/utils.js\";\nimport { makeDecoratable } from \"~/utils.js\";\nimport { IconButton } from \"~/Button/index.js\";\n\ninterface SidePanelProps extends Omit<React.HTMLAttributes<HTMLElement>, \"title\"> {\n title: React.ReactNode;\n /** A 20px icon ahead of the title. */\n icon?: React.ReactElement;\n /** Shows a back button, for a panel that has drilled into one item. */\n onBack?: () => void;\n backLabel?: string;\n /** After the title: a small tertiary button and the few ghost icon buttons that matter. */\n headerEnd?: React.ReactNode;\n onClose?: () => void;\n closeLabel?: string;\n /** A fixed row under the header that does not scroll, such as a search field. */\n headerExtra?: React.ReactNode;\n width?: React.CSSProperties[\"width\"];\n /** `SidePanelBody`, then an optional `SidePanelFooter`. */\n children: React.ReactNode;\n}\n\n/**\n * A panel docked beside the page that stays open while people keep working. Unlike a Drawer it has no\n * backdrop and does not trap focus: the page narrows to make room. Below 1024px it covers the page\n * instead, so the host has to be the positioned element the panel sits in.\n *\n * Esc closes it only while focus is inside it, since the page beside it is still in use.\n */\nconst SidePanelBase = ({\n title,\n icon,\n onBack,\n backLabel = \"Back\",\n headerEnd,\n onClose,\n closeLabel = \"Close panel\",\n headerExtra,\n width = 464,\n className,\n style,\n children,\n ...props\n}: SidePanelProps) => {\n const onKeyDown = (event: React.KeyboardEvent<HTMLElement>) => {\n if (event.key === \"Escape\" && onClose && !event.defaultPrevented) {\n event.preventDefault();\n onClose();\n }\n };\n\n return (\n <aside\n aria-label={typeof title === \"string\" ? title : undefined}\n onKeyDown={onKeyDown}\n className={cn(\n \"flex h-full min-h-0 flex-none flex-col border-l-sm border-neutral-dimmed bg-neutral-base text-neutral-strong\",\n \"max-lg:absolute max-lg:inset-y-0 max-lg:right-0 max-lg:z-overlay max-lg:shadow-lg\",\n className\n )}\n style={{ width, ...style }}\n {...props}\n >\n <div\n className={cn(\n \"flex h-[56px] flex-none items-center gap-xs border-b-sm border-neutral-dimmed pr-sm\",\n onBack ? \"pl-sm\" : \"pl-md\"\n )}\n >\n {onBack ? (\n <IconButton\n variant={\"ghost\"}\n size={\"md\"}\n icon={<BackIcon />}\n aria-label={backLabel}\n onClick={onBack}\n />\n ) : null}\n {icon ? <span className={\"mr-xxs inline-flex\"}>{icon}</span> : null}\n <h2 className={\"m-0 min-w-0 flex-1 truncate text-h5 text-neutral-primary\"}>\n {title}\n </h2>\n {headerEnd}\n {onClose ? (\n <IconButton\n variant={\"ghost\"}\n size={\"md\"}\n icon={<CloseIcon />}\n aria-label={closeLabel}\n onClick={onClose}\n />\n ) : null}\n </div>\n {headerExtra ? (\n <div className={\"flex-none px-md pb-sm pt-md\"}>{headerExtra}</div>\n ) : null}\n {children}\n </aside>\n );\n};\n\nconst SidePanel = makeDecoratable(\"SidePanel\", SidePanelBase);\n\nexport { SidePanel, type SidePanelProps };\n"],"names":["SidePanelBase","title","icon","onBack","backLabel","headerEnd","onClose","closeLabel","headerExtra","width","className","style","children","props","onKeyDown","event","undefined","cn","IconButton","BackIcon","CloseIcon","SidePanel","makeDecoratable"],"mappings":";;;;;AAgCA,MAAMA,gBAAgB,CAAC,EACnBC,KAAK,EACLC,IAAI,EACJC,MAAM,EACNC,YAAY,MAAM,EAClBC,SAAS,EACTC,OAAO,EACPC,aAAa,aAAa,EAC1BC,WAAW,EACXC,QAAQ,GAAG,EACXC,SAAS,EACTC,KAAK,EACLC,QAAQ,EACR,GAAGC,OACU;IACb,MAAMC,YAAY,CAACC;QACf,IAAIA,AAAc,aAAdA,MAAM,GAAG,IAAiBT,WAAW,CAACS,MAAM,gBAAgB,EAAE;YAC9DA,MAAM,cAAc;YACpBT;QACJ;IACJ;IAEA,OAAO,WAAP,GACI,sCAAC;QACG,cAAY,AAAiB,YAAjB,OAAOL,QAAqBA,QAAQe;QAChD,WAAWF;QACX,WAAWG,GACP,gHACA,qFACAP;QAEJ,OAAO;YAAED;YAAO,GAAGE,KAAK;QAAC;QACxB,GAAGE,KAAK;qBAET,sCAAC;QACG,WAAWI,GACP,uFACAd,SAAS,UAAU;OAGtBA,SAAS,WAATA,GACG,sCAACe,YAAUA;QACP,SAAS;QACT,MAAM;QACN,oBAAM,sCAACC,gBAAQA;QACf,cAAYf;QACZ,SAASD;SAEb,MACHD,OAAO,WAAPA,GAAO,sCAAC;QAAK,WAAW;OAAuBA,QAAe,oBAC/D,sCAAC;QAAG,WAAW;OACVD,QAEJI,WACAC,UAAU,WAAVA,GACG,sCAACY,YAAUA;QACP,SAAS;QACT,MAAM;QACN,oBAAM,sCAACE,0BAASA;QAChB,cAAYb;QACZ,SAASD;SAEb,OAEPE,cAAc,WAAdA,GACG,sCAAC;QAAI,WAAW;OAAgCA,eAChD,MACHI;AAGb;AAEA,MAAMS,YAAYC,gBAAgB,aAAatB"}
@@ -0,0 +1,37 @@
1
+ import * as React from "react";
2
+ interface SidePanelBodyProps {
3
+ /** `none` for a full-bleed list. */
4
+ padding?: "md" | "none";
5
+ /** Classes for the content inside the scroll area. */
6
+ className?: string;
7
+ /** The scrolling element, for a body that keeps its newest content in view. */
8
+ viewportRef?: React.Ref<HTMLDivElement>;
9
+ children: React.ReactNode;
10
+ }
11
+ /**
12
+ * The part of a `SidePanel` that scrolls.
13
+ *
14
+ * `[&>div]:!block` overrides Radix's `display: table` content wrapper, which grows to fit its widest
15
+ * child, so a wide table or a long title would otherwise widen the body past the panel.
16
+ */
17
+ declare const SidePanelBodyBase: ({ padding, className, viewportRef, children }: SidePanelBodyProps) => React.JSX.Element;
18
+ declare const SidePanelBody: typeof SidePanelBodyBase & {
19
+ original: typeof SidePanelBodyBase;
20
+ originalName: string;
21
+ displayName: string;
22
+ } & {
23
+ original: typeof SidePanelBodyBase & {
24
+ original: typeof SidePanelBodyBase;
25
+ originalName: string;
26
+ displayName: string;
27
+ };
28
+ originalName: string;
29
+ displayName: string;
30
+ } & {
31
+ createDecorator: (decorator: import("@webiny/react-composition/types").ComponentDecorator<typeof SidePanelBodyBase & {
32
+ original: typeof SidePanelBodyBase;
33
+ originalName: string;
34
+ displayName: string;
35
+ }>) => (props: unknown) => React.JSX.Element;
36
+ };
37
+ export { SidePanelBody, type SidePanelBodyProps };
@@ -0,0 +1,14 @@
1
+ import { cn, makeDecoratable } from "../utils.js";
2
+ import { ScrollArea } from "../ScrollArea/index.js";
3
+ import * as __rspack_external_react from "react";
4
+ const SidePanelBodyBase = ({ padding = "md", className, viewportRef, children })=>/*#__PURE__*/ __rspack_external_react.createElement(ScrollArea, {
5
+ className: "min-h-0 flex-1",
6
+ viewportClassName: "[&>div]:!block",
7
+ viewportRef: viewportRef
8
+ }, /*#__PURE__*/ __rspack_external_react.createElement("div", {
9
+ className: cn("flex flex-col", "md" === padding && "gap-md p-md", className)
10
+ }, children));
11
+ const SidePanelBody = makeDecoratable("SidePanelBody", SidePanelBodyBase);
12
+ export { SidePanelBody };
13
+
14
+ //# sourceMappingURL=SidePanelBody.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SidePanel/SidePanelBody.js","sources":["../../src/SidePanel/SidePanelBody.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"~/utils.js\";\nimport { makeDecoratable } from \"~/utils.js\";\nimport { ScrollArea } from \"~/ScrollArea/index.js\";\n\ninterface SidePanelBodyProps {\n /** `none` for a full-bleed list. */\n padding?: \"md\" | \"none\";\n /** Classes for the content inside the scroll area. */\n className?: string;\n /** The scrolling element, for a body that keeps its newest content in view. */\n viewportRef?: React.Ref<HTMLDivElement>;\n children: React.ReactNode;\n}\n\n/**\n * The part of a `SidePanel` that scrolls.\n *\n * `[&>div]:!block` overrides Radix's `display: table` content wrapper, which grows to fit its widest\n * child, so a wide table or a long title would otherwise widen the body past the panel.\n */\nconst SidePanelBodyBase = ({\n padding = \"md\",\n className,\n viewportRef,\n children\n}: SidePanelBodyProps) => (\n <ScrollArea\n className={\"min-h-0 flex-1\"}\n viewportClassName={\"[&>div]:!block\"}\n viewportRef={viewportRef}\n >\n <div className={cn(\"flex flex-col\", padding === \"md\" && \"gap-md p-md\", className)}>\n {children}\n </div>\n </ScrollArea>\n);\n\nconst SidePanelBody = makeDecoratable(\"SidePanelBody\", SidePanelBodyBase);\n\nexport { SidePanelBody, type SidePanelBodyProps };\n"],"names":["SidePanelBodyBase","padding","className","viewportRef","children","ScrollArea","cn","SidePanelBody","makeDecoratable"],"mappings":";;;AAqBA,MAAMA,oBAAoB,CAAC,EACvBC,UAAU,IAAI,EACdC,SAAS,EACTC,WAAW,EACXC,QAAQ,EACS,iBACjB,sCAACC,YAAUA;QACP,WAAW;QACX,mBAAmB;QACnB,aAAaF;qBAEb,sCAAC;QAAI,WAAWG,GAAG,iBAAiBL,AAAY,SAAZA,WAAoB,eAAeC;OAClEE;AAKb,MAAMG,gBAAgBC,gBAAgB,iBAAiBR"}