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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (397) hide show
  1. package/Accordion/components/AccordionContent.js +4 -1
  2. package/Accordion/components/AccordionContent.js.map +1 -1
  3. package/Accordion/components/AccordionItem.d.ts +1 -0
  4. package/Accordion/components/AccordionItem.js.map +1 -1
  5. package/Accordion/components/AccordionItemDragHandle.d.ts +2 -1
  6. package/Accordion/components/AccordionItemDragHandle.js +2 -1
  7. package/Accordion/components/AccordionItemDragHandle.js.map +1 -1
  8. package/Accordion/components/AccordionTrigger.js +4 -2
  9. package/Accordion/components/AccordionTrigger.js.map +1 -1
  10. package/Alert/Alert.d.ts +1 -20
  11. package/Alert/Alert.js.map +1 -1
  12. package/AutoComplete/primitives/AutoCompletePrimitive.d.ts +8 -2
  13. package/AutoComplete/primitives/AutoCompletePrimitive.js +1 -0
  14. package/AutoComplete/primitives/AutoCompletePrimitive.js.map +1 -1
  15. package/BetaBadge/BetaBadge.d.ts +6 -0
  16. package/BetaBadge/BetaBadge.js +7 -0
  17. package/BetaBadge/BetaBadge.js.map +1 -0
  18. package/Breadcrumbs/Breadcrumbs.d.ts +54 -0
  19. package/Breadcrumbs/Breadcrumbs.js +66 -0
  20. package/Breadcrumbs/Breadcrumbs.js.map +1 -0
  21. package/Breadcrumbs/Breadcrumbs.stories.d.ts +9 -0
  22. package/Breadcrumbs/Breadcrumbs.stories.js +71 -0
  23. package/Breadcrumbs/Breadcrumbs.stories.js.map +1 -0
  24. package/Breadcrumbs/index.d.ts +1 -0
  25. package/Breadcrumbs/index.js +1 -0
  26. package/Button/Button.d.ts +1 -1
  27. package/Button/Button.js +14 -0
  28. package/Button/Button.js.map +1 -1
  29. package/Button/Button.mdx +13 -0
  30. package/Button/Button.stories.d.ts +1 -0
  31. package/Button/Button.stories.js +10 -2
  32. package/Button/Button.stories.js.map +1 -1
  33. package/Button/Button.test.d.ts +1 -0
  34. package/Button/Button.test.js +28 -0
  35. package/Button/Button.test.js.map +1 -0
  36. package/Calendar/calendarClassNames.js +1 -1
  37. package/Calendar/calendarClassNames.js.map +1 -1
  38. package/Checkbox/primitives/presenters/CheckboxPresenter.js +5 -2
  39. package/Checkbox/primitives/presenters/CheckboxPresenter.js.map +1 -1
  40. package/Checkbox/primitives/presenters/CheckboxPresenter.jsxLabel.test.d.ts +1 -0
  41. package/Checkbox/primitives/presenters/CheckboxPresenter.jsxLabel.test.js +61 -0
  42. package/Checkbox/primitives/presenters/CheckboxPresenter.jsxLabel.test.js.map +1 -0
  43. package/CheckboxGroup/CheckboxGroup.js +4 -1
  44. package/CheckboxGroup/CheckboxGroup.js.map +1 -1
  45. package/CheckboxGroup/primitives/CheckboxGroupPrimitive.d.ts +6 -1
  46. package/CheckboxGroup/primitives/CheckboxGroupPrimitive.js +5 -2
  47. package/CheckboxGroup/primitives/CheckboxGroupPrimitive.js.map +1 -1
  48. package/CheckboxGroup/primitives/presenters/CheckboxGroupPresenter.js +5 -2
  49. package/CheckboxGroup/primitives/presenters/CheckboxGroupPresenter.js.map +1 -1
  50. package/CheckboxGroup/primitives/presenters/CheckboxGroupPresenter.jsxLabel.test.d.ts +1 -0
  51. package/CheckboxGroup/primitives/presenters/CheckboxGroupPresenter.jsxLabel.test.js +108 -0
  52. package/CheckboxGroup/primitives/presenters/CheckboxGroupPresenter.jsxLabel.test.js.map +1 -0
  53. package/Code/Code.d.ts +29 -0
  54. package/Code/Code.js +23 -0
  55. package/Code/Code.js.map +1 -0
  56. package/Code/index.d.ts +1 -0
  57. package/Code/index.js +1 -0
  58. package/CodeEditor/CodeEditor.js +6 -0
  59. package/CodeEditor/CodeEditor.js.map +1 -1
  60. package/CodeEditor/CodeEditorPrimitive.js +3 -1
  61. package/CodeEditor/CodeEditorPrimitive.js.map +1 -1
  62. package/ColorPicker/ColorPicker.js +4 -1
  63. package/ColorPicker/ColorPicker.js.map +1 -1
  64. package/ColorPicker/primitives/ColorPickerPrimitive.d.ts +1 -1
  65. package/ColorPicker/primitives/ColorPickerPrimitive.js +3 -1
  66. package/ColorPicker/primitives/ColorPickerPrimitive.js.map +1 -1
  67. package/Command/components/List.d.ts +1 -1
  68. package/Command/components/List.js +9 -5
  69. package/Command/components/List.js.map +1 -1
  70. package/DataTable/DataTable.d.ts +42 -7
  71. package/DataTable/DataTable.js +122 -26
  72. package/DataTable/DataTable.js.map +1 -1
  73. package/DataTable/DataTable.mdx +64 -0
  74. package/DataTable/DataTable.stories.d.ts +4 -0
  75. package/DataTable/DataTable.stories.js +40 -1
  76. package/DataTable/DataTable.stories.js.map +1 -1
  77. package/DataTable/DataTable.subRows.test.d.ts +1 -0
  78. package/DataTable/DataTable.subRows.test.js +216 -0
  79. package/DataTable/DataTable.subRows.test.js.map +1 -0
  80. package/DataTable/components/ColumnsVisibility.d.ts +5 -4
  81. package/DataTable/components/ColumnsVisibility.js +7 -3
  82. package/DataTable/components/ColumnsVisibility.js.map +1 -1
  83. package/DatePicker/DatePicker.d.ts +5 -2
  84. package/DatePicker/DatePicker.js +14 -3
  85. package/DatePicker/DatePicker.js.map +1 -1
  86. package/DatePicker/DatePicker.stories.d.ts +10 -0
  87. package/DatePicker/DatePicker.stories.js +44 -1
  88. package/DatePicker/DatePicker.stories.js.map +1 -1
  89. package/DatePicker/primitives/BirthdayPicker.d.ts +13 -0
  90. package/DatePicker/primitives/BirthdayPicker.js +355 -0
  91. package/DatePicker/primitives/BirthdayPicker.js.map +1 -0
  92. package/DatePicker/primitives/BirthdayPickerCell.d.ts +14 -0
  93. package/DatePicker/primitives/BirthdayPickerCell.js +19 -0
  94. package/DatePicker/primitives/BirthdayPickerCell.js.map +1 -0
  95. package/DatePicker/primitives/BirthdayPickerSegments.d.ts +9 -0
  96. package/DatePicker/primitives/BirthdayPickerSegments.js +43 -0
  97. package/DatePicker/primitives/BirthdayPickerSegments.js.map +1 -0
  98. package/DatePicker/primitives/DateOnlyPicker.d.ts +1 -1
  99. package/DatePicker/primitives/DateOnlyPicker.js +13 -4
  100. package/DatePicker/primitives/DateOnlyPicker.js.map +1 -1
  101. package/DatePicker/primitives/DatePickerPrimitive.js +3 -0
  102. package/DatePicker/primitives/DatePickerPrimitive.js.map +1 -1
  103. package/DatePicker/primitives/DateRangePicker.d.ts +1 -1
  104. package/DatePicker/primitives/DateRangePicker.js +5 -4
  105. package/DatePicker/primitives/DateRangePicker.js.map +1 -1
  106. package/DatePicker/primitives/DateTimePicker.d.ts +1 -1
  107. package/DatePicker/primitives/DateTimePicker.js +27 -18
  108. package/DatePicker/primitives/DateTimePicker.js.map +1 -1
  109. package/DatePicker/primitives/MonthPicker.d.ts +1 -1
  110. package/DatePicker/primitives/MonthPicker.js +2 -1
  111. package/DatePicker/primitives/MonthPicker.js.map +1 -1
  112. package/DatePicker/primitives/MultipleDatesPicker.d.ts +1 -1
  113. package/DatePicker/primitives/MultipleDatesPicker.js +5 -4
  114. package/DatePicker/primitives/MultipleDatesPicker.js.map +1 -1
  115. package/DatePicker/primitives/MultipleMonthsPicker.d.ts +1 -1
  116. package/DatePicker/primitives/MultipleMonthsPicker.js +2 -1
  117. package/DatePicker/primitives/MultipleMonthsPicker.js.map +1 -1
  118. package/DatePicker/primitives/MultipleYearsPicker.d.ts +1 -1
  119. package/DatePicker/primitives/MultipleYearsPicker.js +2 -1
  120. package/DatePicker/primitives/MultipleYearsPicker.js.map +1 -1
  121. package/DatePicker/primitives/TimeOnlyPicker.d.ts +1 -1
  122. package/DatePicker/primitives/TimeOnlyPicker.js +2 -1
  123. package/DatePicker/primitives/TimeOnlyPicker.js.map +1 -1
  124. package/DatePicker/primitives/WeekPicker.d.ts +1 -1
  125. package/DatePicker/primitives/WeekPicker.js +2 -1
  126. package/DatePicker/primitives/WeekPicker.js.map +1 -1
  127. package/DatePicker/primitives/YearPicker.d.ts +1 -1
  128. package/DatePicker/primitives/YearPicker.js +2 -1
  129. package/DatePicker/primitives/YearPicker.js.map +1 -1
  130. package/DatePicker/primitives/components/DatePickerTrigger.js +1 -1
  131. package/DatePicker/primitives/components/DatePickerTrigger.js.map +1 -1
  132. package/DatePicker/primitives/components/TimePicker.d.ts +2 -1
  133. package/DatePicker/primitives/components/TimePicker.js +2 -1
  134. package/DatePicker/primitives/components/TimePicker.js.map +1 -1
  135. package/DatePicker/utils/birthdayHelpers.d.ts +77 -0
  136. package/DatePicker/utils/birthdayHelpers.js +145 -0
  137. package/DatePicker/utils/birthdayHelpers.js.map +1 -0
  138. package/DatePicker/utils/birthdayHelpers.test.d.ts +1 -0
  139. package/DatePicker/utils/birthdayHelpers.test.js +394 -0
  140. package/DatePicker/utils/birthdayHelpers.test.js.map +1 -0
  141. package/DatePicker/utils/dateHelpers.d.ts +6 -1
  142. package/DatePicker/utils/dateHelpers.js +13 -5
  143. package/DatePicker/utils/dateHelpers.js.map +1 -1
  144. package/DatePicker/utils/dateHelpers.test.d.ts +1 -0
  145. package/DatePicker/utils/dateHelpers.test.js +119 -0
  146. package/DatePicker/utils/dateHelpers.test.js.map +1 -0
  147. package/DatePicker/utils/index.d.ts +1 -0
  148. package/DatePicker/utils/index.js +1 -0
  149. package/DatePicker/utils/timezoneHelpers.d.ts +3 -0
  150. package/DatePicker/utils/timezoneHelpers.js +32 -0
  151. package/DatePicker/utils/timezoneHelpers.js.map +1 -0
  152. package/DatePicker/utils/types.d.ts +17 -2
  153. package/DelayedOnChange/DelayedOnChange.d.ts +9 -2
  154. package/DelayedOnChange/DelayedOnChange.js.map +1 -1
  155. package/Dialog/Dialog.d.ts +8 -7
  156. package/Dialog/Dialog.js.map +1 -1
  157. package/Drawer/Drawer.d.ts +10 -6
  158. package/Drawer/Drawer.js +2 -1
  159. package/Drawer/Drawer.js.map +1 -1
  160. package/Drawer/Drawer.stories.d.ts +1 -0
  161. package/Drawer/Drawer.stories.js +20 -2
  162. package/Drawer/Drawer.stories.js.map +1 -1
  163. package/Drawer/components/DrawerHeader.d.ts +2 -2
  164. package/Drawer/components/DrawerHeader.js +11 -8
  165. package/Drawer/components/DrawerHeader.js.map +1 -1
  166. package/Drawer/components/Icon.d.ts +1 -1
  167. package/Drawer/components/Icon.js +3 -4
  168. package/Drawer/components/Icon.js.map +1 -1
  169. package/DropdownMenu/components/DropdownMenuItem.d.ts +5 -0
  170. package/DropdownMenu/components/DropdownMenuItem.js +3 -2
  171. package/DropdownMenu/components/DropdownMenuItem.js.map +1 -1
  172. package/EmptyState/EmptyState.d.ts +2 -1
  173. package/EmptyState/EmptyState.js +8 -2
  174. package/EmptyState/EmptyState.js.map +1 -1
  175. package/FilePicker/FilePicker.d.ts +12 -12
  176. package/FilePicker/FilePicker.js +6 -1
  177. package/FilePicker/FilePicker.js.map +1 -1
  178. package/FilePicker/FilePicker.stories.d.ts +6 -0
  179. package/FilePicker/FilePicker.stories.js +24 -1
  180. package/FilePicker/FilePicker.stories.js.map +1 -1
  181. package/FilePicker/primitives/FilePickerPrimitive.d.ts +13 -13
  182. package/FilePicker/primitives/FilePickerPrimitive.js +3 -1
  183. package/FilePicker/primitives/FilePickerPrimitive.js.map +1 -1
  184. package/FilePicker/primitives/components/Label.d.ts +3 -1
  185. package/FilePicker/primitives/components/Label.js +2 -1
  186. package/FilePicker/primitives/components/Label.js.map +1 -1
  187. package/FilePicker/primitives/components/previews/ImagePreview/ImagePreview.d.ts +13 -2
  188. package/FilePicker/primitives/components/previews/ImagePreview/ImagePreview.js +15 -6
  189. package/FilePicker/primitives/components/previews/ImagePreview/ImagePreview.js.map +1 -1
  190. package/FilePicker/primitives/components/previews/ItemActions.js +1 -1
  191. package/FilePicker/primitives/components/previews/ItemActions.js.map +1 -1
  192. package/FilePicker/primitives/components/previews/ItemDescription.js +1 -1
  193. package/FilePicker/primitives/components/previews/ItemDescription.js.map +1 -1
  194. package/FilePicker/primitives/components/previews/RichItemPreview/FileType.d.ts +5 -0
  195. package/FilePicker/primitives/components/previews/RichItemPreview/FileType.js +45 -0
  196. package/FilePicker/primitives/components/previews/RichItemPreview/FileType.js.map +1 -0
  197. package/FilePicker/primitives/components/previews/RichItemPreview/Placeholder.d.ts +5 -0
  198. package/FilePicker/primitives/components/previews/RichItemPreview/Placeholder.js +14 -0
  199. package/FilePicker/primitives/components/previews/RichItemPreview/Placeholder.js.map +1 -0
  200. package/FilePicker/primitives/components/previews/RichItemPreview/RichItemPreview.d.ts +6 -1
  201. package/FilePicker/primitives/components/previews/RichItemPreview/RichItemPreview.js +54 -12
  202. package/FilePicker/primitives/components/previews/RichItemPreview/RichItemPreview.js.map +1 -1
  203. package/FilePicker/primitives/components/previews/RichItemPreview/RichItemThumbnail.d.ts +11 -1
  204. package/FilePicker/primitives/components/previews/RichItemPreview/RichItemThumbnail.js +8 -61
  205. package/FilePicker/primitives/components/previews/RichItemPreview/RichItemThumbnail.js.map +1 -1
  206. package/FilePicker/primitives/components/previews/RichItemPreview/Thumbnail.d.ts +11 -0
  207. package/FilePicker/primitives/components/previews/RichItemPreview/Thumbnail.js +24 -0
  208. package/FilePicker/primitives/components/previews/RichItemPreview/Thumbnail.js.map +1 -0
  209. package/FilePicker/primitives/components/previews/RichItemPreview/ThumbnailActions.d.ts +10 -0
  210. package/FilePicker/primitives/components/previews/RichItemPreview/ThumbnailActions.js +46 -0
  211. package/FilePicker/primitives/components/previews/RichItemPreview/ThumbnailActions.js.map +1 -0
  212. package/FilePicker/primitives/components/previews/TruncatedFileName.d.ts +7 -0
  213. package/FilePicker/primitives/components/previews/TruncatedFileName.js +20 -0
  214. package/FilePicker/primitives/components/previews/TruncatedFileName.js.map +1 -0
  215. package/FilePicker/primitives/components/previews/fileName.d.ts +4 -0
  216. package/FilePicker/primitives/components/previews/fileName.js +26 -0
  217. package/FilePicker/primitives/components/previews/fileName.js.map +1 -0
  218. package/FilePicker/primitives/components/previews/index.d.ts +1 -0
  219. package/FilePicker/primitives/components/previews/index.js +1 -0
  220. package/FormComponent/Label.d.ts +6 -1
  221. package/FormComponent/Label.js +5 -2
  222. package/FormComponent/Label.js.map +1 -1
  223. package/FormComponent/labels.test.d.ts +1 -0
  224. package/FormComponent/labels.test.js +276 -0
  225. package/FormComponent/labels.test.js.map +1 -0
  226. package/Icon/Icon.d.ts +6 -1
  227. package/Icon/Icon.js.map +1 -1
  228. package/IconPicker/IconPicker.js +6 -1
  229. package/IconPicker/IconPicker.js.map +1 -1
  230. package/IconPicker/domains/IconPickerIcon.js +1 -1
  231. package/IconPicker/domains/IconPickerIcon.js.map +1 -1
  232. package/IconPicker/primitives/IconPickerPrimitive.d.ts +2 -0
  233. package/IconPicker/primitives/IconPickerPrimitive.js +2 -2
  234. package/IconPicker/primitives/IconPickerPrimitive.js.map +1 -1
  235. package/IconPicker/primitives/components/IconPickerGrid.js.map +1 -1
  236. package/ImageEditor/AspectRatioPreview.d.ts +16 -0
  237. package/ImageEditor/AspectRatioPreview.js +26 -0
  238. package/ImageEditor/AspectRatioPreview.js.map +1 -0
  239. package/ImageEditor/CropHotspotEditor.d.ts +22 -0
  240. package/ImageEditor/CropHotspotEditor.js +402 -0
  241. package/ImageEditor/CropHotspotEditor.js.map +1 -0
  242. package/ImageEditor/ImageEditor.d.ts +18 -0
  243. package/ImageEditor/ImageEditor.js +151 -0
  244. package/ImageEditor/ImageEditor.js.map +1 -0
  245. package/ImageEditor/ImageEditor.stories.d.ts +6 -0
  246. package/ImageEditor/ImageEditor.stories.js +42 -0
  247. package/ImageEditor/ImageEditor.stories.js.map +1 -0
  248. package/ImageEditor/MetaFields.d.ts +12 -0
  249. package/ImageEditor/MetaFields.js +20 -0
  250. package/ImageEditor/MetaFields.js.map +1 -0
  251. package/ImageEditor/SectionLabel.d.ts +8 -0
  252. package/ImageEditor/SectionLabel.js +7 -0
  253. package/ImageEditor/SectionLabel.js.map +1 -0
  254. package/ImageEditor/geometry.d.ts +46 -0
  255. package/ImageEditor/geometry.js +126 -0
  256. package/ImageEditor/geometry.js.map +1 -0
  257. package/ImageEditor/index.d.ts +3 -0
  258. package/ImageEditor/index.js +3 -0
  259. package/ImageEditor/types.d.ts +52 -0
  260. package/ImageEditor/types.js +35 -0
  261. package/ImageEditor/types.js.map +1 -0
  262. package/Input/InputPrimitive.d.ts +4 -4
  263. package/Input/InputPrimitive.js +0 -1
  264. package/Input/InputPrimitive.js.map +1 -1
  265. package/Kbd/Kbd.d.ts +35 -0
  266. package/Kbd/Kbd.js +34 -0
  267. package/Kbd/Kbd.js.map +1 -0
  268. package/Kbd/index.d.ts +1 -0
  269. package/Kbd/index.js +1 -0
  270. package/Link/Link.d.ts +1 -1
  271. package/Link/Link.js +1 -1
  272. package/Link/Link.js.map +1 -1
  273. package/Markdown/Markdown.d.ts +47 -0
  274. package/Markdown/Markdown.js +17 -0
  275. package/Markdown/Markdown.js.map +1 -0
  276. package/Markdown/index.d.ts +1 -0
  277. package/Markdown/index.js +1 -0
  278. package/MultiAutoComplete/primitives/MultiAutoCompletePrimitive.d.ts +8 -2
  279. package/MultiAutoComplete/primitives/MultiAutoCompletePrimitive.js +1 -0
  280. package/MultiAutoComplete/primitives/MultiAutoCompletePrimitive.js.map +1 -1
  281. package/MultiAutoComplete/primitives/presenters/MultiAutoCompletePresenter.test.js +1 -1
  282. package/MultiAutoComplete/primitives/presenters/MultiAutoCompletePresenter.test.js.map +1 -1
  283. package/MultiAutoComplete/primitives/useMultiAutoComplete.js +3 -2
  284. package/MultiAutoComplete/primitives/useMultiAutoComplete.js.map +1 -1
  285. package/MultiFilePicker/MultiFilePicker.d.ts +12 -12
  286. package/MultiFilePicker/primitives/MultiFilePickerPrimitive.d.ts +12 -12
  287. package/MultiSelect/MultiSelect.js +6 -1
  288. package/MultiSelect/MultiSelect.js.map +1 -1
  289. package/MultiSelect/primitives/MultiSelectPrimitive.d.ts +3 -1
  290. package/MultiSelect/primitives/MultiSelectPrimitive.js +16 -7
  291. package/MultiSelect/primitives/MultiSelectPrimitive.js.map +1 -1
  292. package/Popover/Popover.stories.d.ts +7 -0
  293. package/Popover/Popover.stories.js +24 -1
  294. package/Popover/Popover.stories.js.map +1 -1
  295. package/Popover/primitives/components/PopoverContent.js +6 -1
  296. package/Popover/primitives/components/PopoverContent.js.map +1 -1
  297. package/RadioGroup/RadioGroup.js +4 -1
  298. package/RadioGroup/RadioGroup.js.map +1 -1
  299. package/RadioGroup/primitives/RadioGroupPrimitive.d.ts +1 -1
  300. package/RadioGroup/primitives/RadioGroupPrimitive.js +4 -2
  301. package/RadioGroup/primitives/RadioGroupPrimitive.js.map +1 -1
  302. package/RadioGroup/primitives/presenters/RadioGroupPresenter.js +4 -2
  303. package/RadioGroup/primitives/presenters/RadioGroupPresenter.js.map +1 -1
  304. package/RadioGroup/primitives/presenters/RadioGroupPresenter.jsxLabel.test.d.ts +1 -0
  305. package/RadioGroup/primitives/presenters/RadioGroupPresenter.jsxLabel.test.js +88 -0
  306. package/RadioGroup/primitives/presenters/RadioGroupPresenter.jsxLabel.test.js.map +1 -0
  307. package/RangeSlider/RangeSlider.js +4 -1
  308. package/RangeSlider/RangeSlider.js.map +1 -1
  309. package/RangeSlider/primitives/RangeSliderPrimitive.d.ts +1 -1
  310. package/RangeSlider/primitives/RangeSliderPrimitive.js +3 -1
  311. package/RangeSlider/primitives/RangeSliderPrimitive.js.map +1 -1
  312. package/ScrollArea/ScrollArea.d.ts +16 -2
  313. package/ScrollArea/ScrollArea.js +19 -5
  314. package/ScrollArea/ScrollArea.js.map +1 -1
  315. package/SegmentedControl/SegmentedControl.js +4 -1
  316. package/SegmentedControl/SegmentedControl.js.map +1 -1
  317. package/SegmentedControl/primitives/SegmentedControlPrimitive.d.ts +5 -1
  318. package/SegmentedControl/primitives/SegmentedControlPrimitive.js +2 -1
  319. package/SegmentedControl/primitives/SegmentedControlPrimitive.js.map +1 -1
  320. package/Select/Select.js +6 -1
  321. package/Select/Select.js.map +1 -1
  322. package/Select/primitives/SelectPrimitive.d.ts +4 -0
  323. package/Select/primitives/SelectPrimitive.js +4 -2
  324. package/Select/primitives/SelectPrimitive.js.map +1 -1
  325. package/Select/primitives/components/SelectContent.js +4 -6
  326. package/Select/primitives/components/SelectContent.js.map +1 -1
  327. package/SidePanel/SidePanel.d.ts +46 -0
  328. package/SidePanel/SidePanel.js +47 -0
  329. package/SidePanel/SidePanel.js.map +1 -0
  330. package/SidePanel/SidePanelBody.d.ts +37 -0
  331. package/SidePanel/SidePanelBody.js +14 -0
  332. package/SidePanel/SidePanelBody.js.map +1 -0
  333. package/SidePanel/SidePanelFooter.d.ts +27 -0
  334. package/SidePanel/SidePanelFooter.js +10 -0
  335. package/SidePanel/SidePanelFooter.js.map +1 -0
  336. package/SidePanel/index.d.ts +3 -0
  337. package/SidePanel/index.js +3 -0
  338. package/Sidebar/Sidebar.groups.test.d.ts +1 -0
  339. package/Sidebar/Sidebar.groups.test.js +113 -0
  340. package/Sidebar/Sidebar.groups.test.js.map +1 -0
  341. package/Sidebar/components/SidebarContent.js +1 -1
  342. package/Sidebar/components/SidebarContent.js.map +1 -1
  343. package/Sidebar/components/SidebarRoot.js +1 -1
  344. package/Sidebar/components/SidebarRoot.js.map +1 -1
  345. package/Sidebar/components/items/SidebarMenuRootButton.js +1 -0
  346. package/Sidebar/components/items/SidebarMenuRootButton.js.map +1 -1
  347. package/Sidebar/components/items/SidebarMenuSubButton.js +8 -5
  348. package/Sidebar/components/items/SidebarMenuSubButton.js.map +1 -1
  349. package/Sidebar/components/items/SidebarMenuSubItem.js +3 -3
  350. package/Sidebar/components/items/SidebarMenuSubItem.js.map +1 -1
  351. package/Slider/Slider.js +10 -2
  352. package/Slider/Slider.js.map +1 -1
  353. package/Slider/primitives/SliderPrimitive.d.ts +1 -1
  354. package/Slider/primitives/SliderPrimitive.js +2 -1
  355. package/Slider/primitives/SliderPrimitive.js.map +1 -1
  356. package/Slider/primitives/components/SliderThumb.d.ts +5 -2
  357. package/Slider/primitives/components/SliderThumb.js +2 -1
  358. package/Slider/primitives/components/SliderThumb.js.map +1 -1
  359. package/Switch/Switch.d.ts +4 -4
  360. package/Switch/Switch.js +21 -7
  361. package/Switch/Switch.js.map +1 -1
  362. package/Switch/domains/SwitchItemDto.d.ts +1 -1
  363. package/Switch/primitives/SwitchPrimitive.js +4 -3
  364. package/Switch/primitives/SwitchPrimitive.js.map +1 -1
  365. package/Tabs/Tabs.d.ts +7 -2
  366. package/Tabs/Tabs.js +29 -11
  367. package/Tabs/Tabs.js.map +1 -1
  368. package/Tabs/Tabs.mdx +27 -0
  369. package/Tabs/Tabs.stories.d.ts +1 -0
  370. package/Tabs/Tabs.stories.js +19 -1
  371. package/Tabs/Tabs.stories.js.map +1 -1
  372. package/Tag/Tag.d.ts +1 -1
  373. package/Tag/Tag.js +5 -0
  374. package/Tag/Tag.js.map +1 -1
  375. package/Tag/TagIcon.js +7 -1
  376. package/Tag/TagIcon.js.map +1 -1
  377. package/Tags/primitives/TagsPrimitive.d.ts +2 -2
  378. package/Tags/primitives/TagsPrimitive.js.map +1 -1
  379. package/Toast/useToast.stories.js.map +1 -1
  380. package/ToggleGroup/ToggleGroup.js +4 -1
  381. package/ToggleGroup/ToggleGroup.js.map +1 -1
  382. package/ToggleGroup/primitives/ToggleGroupPrimitive.d.ts +2 -0
  383. package/ToggleGroup/primitives/ToggleGroupPrimitive.js +3 -2
  384. package/ToggleGroup/primitives/ToggleGroupPrimitive.js.map +1 -1
  385. package/Tree/useTree.js +6 -2
  386. package/Tree/useTree.js.map +1 -1
  387. package/exports/admin/ui.d.ts +2 -0
  388. package/exports/admin/ui.js +2 -0
  389. package/hooks/index.d.ts +1 -0
  390. package/hooks/index.js +1 -0
  391. package/hooks/useEscapeScrollLock.d.ts +13 -0
  392. package/hooks/useEscapeScrollLock.js +21 -0
  393. package/hooks/useEscapeScrollLock.js.map +1 -0
  394. package/index.d.ts +7 -0
  395. package/index.js +7 -0
  396. package/package.json +31 -29
  397. package/theme.css +43 -0
@@ -0,0 +1,276 @@
1
+ import react from "react";
2
+ import { afterEach, beforeAll, describe, expect, it, vi } from "vitest";
3
+ import { cleanup, render, screen } from "@testing-library/react";
4
+ import { AdminUiContext } from "../AdminUiProvider/AdminUiProvider.js";
5
+ import { Select } from "../Select/index.js";
6
+ import { MultiSelect } from "../MultiSelect/index.js";
7
+ import { RadioGroup } from "../RadioGroup/index.js";
8
+ import { CheckboxGroup } from "../CheckboxGroup/index.js";
9
+ import { Slider } from "../Slider/index.js";
10
+ import { RangeSlider } from "../RangeSlider/index.js";
11
+ import { DatePicker } from "../DatePicker/index.js";
12
+ import { ToggleGroup } from "../ToggleGroup/index.js";
13
+ import { SegmentedControl } from "../SegmentedControl/index.js";
14
+ import { IconPicker } from "../IconPicker/index.js";
15
+ import { ColorPicker } from "../ColorPicker/index.js";
16
+ import { FilePicker } from "../FilePicker/index.js";
17
+ vi.mock("@webiny/icons/add.svg", ()=>({
18
+ ReactComponent: ()=>null
19
+ }));
20
+ vi.mock("@webiny/icons/calendar_month.svg", ()=>({
21
+ ReactComponent: ()=>null
22
+ }));
23
+ vi.mock("@webiny/icons/check.svg", ()=>({
24
+ ReactComponent: ()=>null
25
+ }));
26
+ vi.mock("@webiny/icons/chevron_left.svg", ()=>({
27
+ ReactComponent: ()=>null
28
+ }));
29
+ vi.mock("@webiny/icons/chevron_right.svg", ()=>({
30
+ ReactComponent: ()=>null
31
+ }));
32
+ vi.mock("@webiny/icons/close.svg", ()=>({
33
+ ReactComponent: ()=>null
34
+ }));
35
+ vi.mock("@webiny/icons/content_copy.svg", ()=>({
36
+ ReactComponent: ()=>null
37
+ }));
38
+ vi.mock("@webiny/icons/delete.svg", ()=>({
39
+ ReactComponent: ()=>null
40
+ }));
41
+ vi.mock("@webiny/icons/edit.svg", ()=>({
42
+ ReactComponent: ()=>null
43
+ }));
44
+ vi.mock("@webiny/icons/file_upload.svg", ()=>({
45
+ ReactComponent: ()=>null
46
+ }));
47
+ vi.mock("@webiny/icons/format_align_center.svg", ()=>({
48
+ ReactComponent: ()=>null
49
+ }));
50
+ vi.mock("@webiny/icons/format_align_left.svg", ()=>({
51
+ ReactComponent: ()=>null
52
+ }));
53
+ vi.mock("@webiny/icons/format_align_right.svg", ()=>({
54
+ ReactComponent: ()=>null
55
+ }));
56
+ vi.mock("@webiny/icons/format_bold.svg", ()=>({
57
+ ReactComponent: ()=>null
58
+ }));
59
+ vi.mock("@webiny/icons/format_italic.svg", ()=>({
60
+ ReactComponent: ()=>null
61
+ }));
62
+ vi.mock("@webiny/icons/format_underlined.svg", ()=>({
63
+ ReactComponent: ()=>null
64
+ }));
65
+ vi.mock("@webiny/icons/image.svg", ()=>({
66
+ ReactComponent: ()=>null
67
+ }));
68
+ vi.mock("@webiny/icons/info.svg", ()=>({
69
+ ReactComponent: ()=>null
70
+ }));
71
+ vi.mock("@webiny/icons/keyboard_arrow_down.svg", ()=>({
72
+ ReactComponent: ()=>null
73
+ }));
74
+ vi.mock("@webiny/icons/keyboard_arrow_up.svg", ()=>({
75
+ ReactComponent: ()=>null
76
+ }));
77
+ vi.mock("@webiny/icons/notifications.svg", ()=>({
78
+ ReactComponent: ()=>null
79
+ }));
80
+ vi.mock("@webiny/icons/person.svg", ()=>({
81
+ ReactComponent: ()=>null
82
+ }));
83
+ vi.mock("@webiny/icons/schedule.svg", ()=>({
84
+ ReactComponent: ()=>null
85
+ }));
86
+ vi.mock("@webiny/icons/search.svg", ()=>({
87
+ ReactComponent: ()=>null
88
+ }));
89
+ vi.mock("@webiny/icons/settings.svg", ()=>({
90
+ ReactComponent: ()=>null
91
+ }));
92
+ const context = {
93
+ compileMarkdown: (markdown)=>markdown
94
+ };
95
+ const renderIn = (ui)=>render(/*#__PURE__*/ react.createElement(AdminUiContext.Provider, {
96
+ value: context
97
+ }, ui));
98
+ beforeAll(()=>{
99
+ globalThis.ResizeObserver ??= class {
100
+ observe() {}
101
+ unobserve() {}
102
+ disconnect() {}
103
+ };
104
+ });
105
+ afterEach(cleanup);
106
+ const options = [
107
+ {
108
+ label: "Main layout",
109
+ value: "main"
110
+ },
111
+ {
112
+ label: "Landing",
113
+ value: "landing"
114
+ }
115
+ ];
116
+ describe("form component labels name their controls", ()=>{
117
+ it("Select — the combobox trigger, whatever value it shows", ()=>{
118
+ renderIn(/*#__PURE__*/ react.createElement(Select, {
119
+ label: "Layout",
120
+ value: "main",
121
+ options: options
122
+ }));
123
+ const control = screen.getByLabelText("Layout");
124
+ expect(control.getAttribute("role")).toBe("combobox");
125
+ expect(screen.getByRole("combobox", {
126
+ name: "Layout"
127
+ })).toBe(control);
128
+ });
129
+ it("Select — a caller's id is kept", ()=>{
130
+ renderIn(/*#__PURE__*/ react.createElement(Select, {
131
+ id: "layout-select",
132
+ label: "Layout",
133
+ options: options
134
+ }));
135
+ expect(screen.getByLabelText("Layout").id).toBe("layout-select");
136
+ });
137
+ it("MultiSelect — the trigger button", ()=>{
138
+ renderIn(/*#__PURE__*/ react.createElement(MultiSelect, {
139
+ label: "Languages",
140
+ options: options,
141
+ value: [
142
+ "main"
143
+ ]
144
+ }));
145
+ expect(screen.getByLabelText("Languages").tagName).toBe("BUTTON");
146
+ });
147
+ it("RadioGroup — the radiogroup", ()=>{
148
+ renderIn(/*#__PURE__*/ react.createElement(RadioGroup, {
149
+ label: "Page type",
150
+ items: options,
151
+ value: "main"
152
+ }));
153
+ expect(screen.getByRole("radiogroup", {
154
+ name: "Page type"
155
+ })).toBeTruthy();
156
+ });
157
+ it("CheckboxGroup — the group", ()=>{
158
+ renderIn(/*#__PURE__*/ react.createElement(CheckboxGroup, {
159
+ label: "Channels",
160
+ items: options,
161
+ value: [
162
+ "main"
163
+ ]
164
+ }));
165
+ expect(screen.getByRole("group", {
166
+ name: "Channels"
167
+ })).toBeTruthy();
168
+ });
169
+ it("Slider — the thumb, with the label on top or at the side", ()=>{
170
+ renderIn(/*#__PURE__*/ react.createElement(Slider, {
171
+ label: "Opacity",
172
+ value: 20,
173
+ min: 0,
174
+ max: 100,
175
+ onValueChange: ()=>{}
176
+ }));
177
+ expect(screen.getByRole("slider", {
178
+ name: /^Opacity/
179
+ })).toBeTruthy();
180
+ cleanup();
181
+ renderIn(/*#__PURE__*/ react.createElement(Slider, {
182
+ label: "Opacity",
183
+ labelPosition: "side",
184
+ value: 20,
185
+ onValueChange: ()=>{},
186
+ min: 0,
187
+ max: 100
188
+ }));
189
+ expect(screen.getByRole("slider", {
190
+ name: "Opacity"
191
+ })).toBeTruthy();
192
+ });
193
+ it("RangeSlider — both thumbs", ()=>{
194
+ renderIn(/*#__PURE__*/ react.createElement(RangeSlider, {
195
+ label: "Price",
196
+ values: [
197
+ 10,
198
+ 90
199
+ ],
200
+ min: 0,
201
+ max: 100,
202
+ onValuesChange: ()=>{}
203
+ }));
204
+ expect(screen.getAllByRole("slider", {
205
+ name: "Price"
206
+ })).toHaveLength(2);
207
+ });
208
+ it("DatePicker — the trigger, for a date and for a time", ()=>{
209
+ renderIn(/*#__PURE__*/ react.createElement(DatePicker, {
210
+ label: "Publish on",
211
+ type: "date"
212
+ }));
213
+ expect(screen.getByRole("button", {
214
+ name: "Publish on"
215
+ })).toBeTruthy();
216
+ cleanup();
217
+ renderIn(/*#__PURE__*/ react.createElement(DatePicker, {
218
+ label: "Starts at",
219
+ type: "time"
220
+ }));
221
+ expect(screen.getByLabelText("Starts at").tagName).toBe("INPUT");
222
+ });
223
+ it("ToggleGroup and SegmentedControl — the group", ()=>{
224
+ renderIn(/*#__PURE__*/ react.createElement(ToggleGroup, {
225
+ label: "Format",
226
+ items: options,
227
+ type: "single",
228
+ value: "main"
229
+ }));
230
+ expect(screen.getByRole("radiogroup", {
231
+ name: "Format"
232
+ })).toBeTruthy();
233
+ cleanup();
234
+ renderIn(/*#__PURE__*/ react.createElement(ToggleGroup, {
235
+ label: "Styles",
236
+ items: options,
237
+ type: "multiple",
238
+ value: [
239
+ "main"
240
+ ]
241
+ }));
242
+ expect(screen.getByLabelText("Styles").querySelectorAll("button")).toHaveLength(2);
243
+ cleanup();
244
+ renderIn(/*#__PURE__*/ react.createElement(SegmentedControl, {
245
+ label: "View",
246
+ items: options,
247
+ value: "main"
248
+ }));
249
+ expect(screen.getByRole("radiogroup", {
250
+ name: "View"
251
+ })).toBeTruthy();
252
+ });
253
+ it("IconPicker, ColorPicker and FilePicker — their triggers", ()=>{
254
+ renderIn(/*#__PURE__*/ react.createElement(IconPicker, {
255
+ label: "Icon",
256
+ icons: []
257
+ }));
258
+ expect(screen.getByLabelText("Icon").tagName).toBe("BUTTON");
259
+ cleanup();
260
+ renderIn(/*#__PURE__*/ react.createElement(ColorPicker, {
261
+ label: "Colour"
262
+ }));
263
+ expect(screen.getByRole("button", {
264
+ name: "Colour"
265
+ })).toBeTruthy();
266
+ cleanup();
267
+ renderIn(/*#__PURE__*/ react.createElement(FilePicker, {
268
+ label: "Image",
269
+ type: "compact",
270
+ onSelectItem: ()=>{}
271
+ }));
272
+ expect(screen.getByLabelText("Image").tagName).toBe("BUTTON");
273
+ });
274
+ });
275
+
276
+ //# sourceMappingURL=labels.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FormComponent/labels.test.js","sources":["../../src/FormComponent/labels.test.tsx"],"sourcesContent":["// @vitest-environment jsdom\n/**\n * A form component's visible label names its control: `getByLabelText` (and any\n * label-based lookup — assistive tech, a scripted UI check) finds the element\n * that takes focus, not a wrapper and not the value it currently shows.\n */\nimport React from \"react\";\nimport { afterEach, beforeAll, describe, expect, it, vi } from \"vitest\";\nimport { cleanup, render, screen } from \"@testing-library/react\";\nimport { AdminUiContext, type AdminUiContextValue } from \"~/AdminUiProvider/AdminUiProvider.js\";\nimport { Select } from \"~/Select/index.js\";\nimport { MultiSelect } from \"~/MultiSelect/index.js\";\nimport { RadioGroup } from \"~/RadioGroup/index.js\";\nimport { CheckboxGroup } from \"~/CheckboxGroup/index.js\";\nimport { Slider } from \"~/Slider/index.js\";\nimport { RangeSlider } from \"~/RangeSlider/index.js\";\nimport { DatePicker } from \"~/DatePicker/index.js\";\nimport { ToggleGroup } from \"~/ToggleGroup/index.js\";\nimport { SegmentedControl } from \"~/SegmentedControl/index.js\";\nimport { IconPicker } from \"~/IconPicker/index.js\";\nimport { ColorPicker } from \"~/ColorPicker/index.js\";\nimport { FilePicker } from \"~/FilePicker/index.js\";\n\n/* No SVG transform in the test runner: the icons these controls render become empty components. */\nvi.mock(\"@webiny/icons/add.svg\", () => ({ ReactComponent: () => null }));\nvi.mock(\"@webiny/icons/calendar_month.svg\", () => ({\n ReactComponent: () => null\n}));\nvi.mock(\"@webiny/icons/check.svg\", () => ({ ReactComponent: () => null }));\nvi.mock(\"@webiny/icons/chevron_left.svg\", () => ({\n ReactComponent: () => null\n}));\nvi.mock(\"@webiny/icons/chevron_right.svg\", () => ({\n ReactComponent: () => null\n}));\nvi.mock(\"@webiny/icons/close.svg\", () => ({ ReactComponent: () => null }));\nvi.mock(\"@webiny/icons/content_copy.svg\", () => ({\n ReactComponent: () => null\n}));\nvi.mock(\"@webiny/icons/delete.svg\", () => ({ ReactComponent: () => null }));\nvi.mock(\"@webiny/icons/edit.svg\", () => ({ ReactComponent: () => null }));\nvi.mock(\"@webiny/icons/file_upload.svg\", () => ({\n ReactComponent: () => null\n}));\nvi.mock(\"@webiny/icons/format_align_center.svg\", () => ({\n ReactComponent: () => null\n}));\nvi.mock(\"@webiny/icons/format_align_left.svg\", () => ({\n ReactComponent: () => null\n}));\nvi.mock(\"@webiny/icons/format_align_right.svg\", () => ({\n ReactComponent: () => null\n}));\nvi.mock(\"@webiny/icons/format_bold.svg\", () => ({\n ReactComponent: () => null\n}));\nvi.mock(\"@webiny/icons/format_italic.svg\", () => ({\n ReactComponent: () => null\n}));\nvi.mock(\"@webiny/icons/format_underlined.svg\", () => ({\n ReactComponent: () => null\n}));\nvi.mock(\"@webiny/icons/image.svg\", () => ({ ReactComponent: () => null }));\nvi.mock(\"@webiny/icons/info.svg\", () => ({ ReactComponent: () => null }));\nvi.mock(\"@webiny/icons/keyboard_arrow_down.svg\", () => ({\n ReactComponent: () => null\n}));\nvi.mock(\"@webiny/icons/keyboard_arrow_up.svg\", () => ({\n ReactComponent: () => null\n}));\nvi.mock(\"@webiny/icons/notifications.svg\", () => ({\n ReactComponent: () => null\n}));\nvi.mock(\"@webiny/icons/person.svg\", () => ({ ReactComponent: () => null }));\nvi.mock(\"@webiny/icons/schedule.svg\", () => ({ ReactComponent: () => null }));\nvi.mock(\"@webiny/icons/search.svg\", () => ({ ReactComponent: () => null }));\nvi.mock(\"@webiny/icons/settings.svg\", () => ({ ReactComponent: () => null }));\n\nconst context = {\n compileMarkdown: (markdown: React.ReactNode) => markdown\n} as unknown as AdminUiContextValue;\n\nconst renderIn = (ui: React.ReactElement) =>\n render(<AdminUiContext.Provider value={context}>{ui}</AdminUiContext.Provider>);\n\nbeforeAll(() => {\n /* Radix measures its parts; jsdom has no ResizeObserver. */\n globalThis.ResizeObserver ??= class {\n observe() {}\n unobserve() {}\n disconnect() {}\n } as unknown as typeof ResizeObserver;\n});\n\nafterEach(cleanup);\n\nconst options = [\n { label: \"Main layout\", value: \"main\" },\n { label: \"Landing\", value: \"landing\" }\n];\n\ndescribe(\"form component labels name their controls\", () => {\n it(\"Select — the combobox trigger, whatever value it shows\", () => {\n renderIn(<Select label={\"Layout\"} value={\"main\"} options={options} />);\n const control = screen.getByLabelText(\"Layout\");\n expect(control.getAttribute(\"role\")).toBe(\"combobox\");\n expect(screen.getByRole(\"combobox\", { name: \"Layout\" })).toBe(control);\n });\n\n it(\"Select — a caller's id is kept\", () => {\n renderIn(<Select id={\"layout-select\"} label={\"Layout\"} options={options} />);\n expect(screen.getByLabelText(\"Layout\").id).toBe(\"layout-select\");\n });\n\n it(\"MultiSelect — the trigger button\", () => {\n renderIn(<MultiSelect label={\"Languages\"} options={options} value={[\"main\"]} />);\n expect(screen.getByLabelText(\"Languages\").tagName).toBe(\"BUTTON\");\n });\n\n it(\"RadioGroup — the radiogroup\", () => {\n renderIn(<RadioGroup label={\"Page type\"} items={options} value={\"main\"} />);\n expect(screen.getByRole(\"radiogroup\", { name: \"Page type\" })).toBeTruthy();\n });\n\n it(\"CheckboxGroup — the group\", () => {\n renderIn(<CheckboxGroup label={\"Channels\"} items={options} value={[\"main\"]} />);\n expect(screen.getByRole(\"group\", { name: \"Channels\" })).toBeTruthy();\n });\n\n it(\"Slider — the thumb, with the label on top or at the side\", () => {\n renderIn(\n <Slider label={\"Opacity\"} value={20} min={0} max={100} onValueChange={() => {}} />\n );\n /* On top, the label carries the current value too: `Opacity 20`. */\n expect(screen.getByRole(\"slider\", { name: /^Opacity/ })).toBeTruthy();\n cleanup();\n renderIn(\n <Slider\n label={\"Opacity\"}\n labelPosition={\"side\"}\n value={20}\n onValueChange={() => {}}\n min={0}\n max={100}\n />\n );\n expect(screen.getByRole(\"slider\", { name: \"Opacity\" })).toBeTruthy();\n });\n\n it(\"RangeSlider — both thumbs\", () => {\n renderIn(\n <RangeSlider\n label={\"Price\"}\n values={[10, 90]}\n min={0}\n max={100}\n onValuesChange={() => {}}\n />\n );\n expect(screen.getAllByRole(\"slider\", { name: \"Price\" })).toHaveLength(2);\n });\n\n it(\"DatePicker — the trigger, for a date and for a time\", () => {\n renderIn(<DatePicker label={\"Publish on\"} type={\"date\"} />);\n expect(screen.getByRole(\"button\", { name: \"Publish on\" })).toBeTruthy();\n cleanup();\n renderIn(<DatePicker label={\"Starts at\"} type={\"time\"} />);\n expect(screen.getByLabelText(\"Starts at\").tagName).toBe(\"INPUT\");\n });\n\n it(\"ToggleGroup and SegmentedControl — the group\", () => {\n /* Radix renders a single-choice toggle group as a radiogroup; a multiple one has no group role, but its root is still named. */\n renderIn(<ToggleGroup label={\"Format\"} items={options} type={\"single\"} value={\"main\"} />);\n expect(screen.getByRole(\"radiogroup\", { name: \"Format\" })).toBeTruthy();\n cleanup();\n renderIn(\n <ToggleGroup label={\"Styles\"} items={options} type={\"multiple\"} value={[\"main\"]} />\n );\n expect(screen.getByLabelText(\"Styles\").querySelectorAll(\"button\")).toHaveLength(2);\n cleanup();\n renderIn(<SegmentedControl label={\"View\"} items={options} value={\"main\"} />);\n expect(screen.getByRole(\"radiogroup\", { name: \"View\" })).toBeTruthy();\n });\n\n it(\"IconPicker, ColorPicker and FilePicker — their triggers\", () => {\n renderIn(<IconPicker label={\"Icon\"} icons={[]} />);\n expect(screen.getByLabelText(\"Icon\").tagName).toBe(\"BUTTON\");\n cleanup();\n renderIn(<ColorPicker label={\"Colour\"} />);\n expect(screen.getByRole(\"button\", { name: \"Colour\" })).toBeTruthy();\n cleanup();\n renderIn(<FilePicker label={\"Image\"} type={\"compact\"} onSelectItem={() => {}} />);\n expect(screen.getByLabelText(\"Image\").tagName).toBe(\"BUTTON\");\n });\n});\n"],"names":["vi","context","markdown","renderIn","ui","render","AdminUiContext","beforeAll","globalThis","afterEach","cleanup","options","describe","it","Select","control","screen","expect","MultiSelect","RadioGroup","CheckboxGroup","Slider","RangeSlider","DatePicker","ToggleGroup","SegmentedControl","IconPicker","ColorPicker","FilePicker"],"mappings":"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"}
package/Icon/Icon.d.ts CHANGED
@@ -28,4 +28,9 @@ declare const Icon: typeof IconBase & {
28
28
  displayName: string;
29
29
  }>) => (props: unknown) => React.JSX.Element;
30
30
  };
31
- export { Icon, type IconProps };
31
+ /**
32
+ * An icon element whose size a parent can set through `React.cloneElement`. React 19 types an
33
+ * element's props as `unknown` unless they are given, so components that resize an icon take this.
34
+ */
35
+ type IconElement = React.ReactElement<Partial<IconProps>>;
36
+ export { Icon, type IconProps, type IconElement };
package/Icon/Icon.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Icon/Icon.js","sources":["../../src/Icon/Icon.tsx"],"sourcesContent":["import React from \"react\";\nimport { AccessibleIcon } from \"radix-ui\";\nimport { cn, cva, makeDecoratable, type VariantProps } from \"~/utils.js\";\n\nconst iconVariants = cva(\"shrink-0\", {\n variants: {\n size: {\n xs: \"size-sm-extra\",\n sm: \"size-md\",\n md: \"size-md-plus\",\n lg: \"size-lg\"\n },\n color: {\n inherit: \"fill-inherit text-inherit\",\n accent: \"fill-accent-default text-accent-default\",\n \"neutral-light\": \"fill-neutral-strong text-neutral-strong\",\n \"neutral-strong\": \"fill-neutral-xstrong text-neutral-xstrong\",\n \"neutral-strong-transparent\": \"fill-neutral-xstrong/30 text-neutral-xstrong/30\",\n \"neutral-base\": \"fill-neutral-base text-neutral-base\",\n \"neutral-negative\": \"fill-neutral-base/50 text-neutral-base/50\"\n }\n },\n defaultVariants: {\n size: \"md\",\n color: \"inherit\"\n }\n});\n\ninterface IconProps\n extends\n Omit<React.HTMLAttributes<HTMLOrSVGElement>, \"color\">,\n VariantProps<typeof iconVariants> {\n label: string;\n icon: React.ReactNode;\n}\n\nconst IconBase = (props: IconProps) => {\n const { label, icon, color, size, className, ...rest } = props;\n return (\n <AccessibleIcon.Root label={label}>\n {/* @ts-expect-error */}\n {React.cloneElement(icon, {\n ...rest,\n className: cn(iconVariants({ color, size }), className)\n })}\n </AccessibleIcon.Root>\n );\n};\n\nconst Icon = makeDecoratable(\"Icon\", IconBase);\n\nexport { Icon, type IconProps };\n"],"names":["iconVariants","cva","IconBase","props","label","icon","color","size","className","rest","AccessibleIcon","React","cn","Icon","makeDecoratable"],"mappings":";;;AAIA,MAAMA,eAAeC,IAAI,YAAY;IACjC,UAAU;QACN,MAAM;YACF,IAAI;YACJ,IAAI;YACJ,IAAI;YACJ,IAAI;QACR;QACA,OAAO;YACH,SAAS;YACT,QAAQ;YACR,iBAAiB;YACjB,kBAAkB;YAClB,8BAA8B;YAC9B,gBAAgB;YAChB,oBAAoB;QACxB;IACJ;IACA,iBAAiB;QACb,MAAM;QACN,OAAO;IACX;AACJ;AAUA,MAAMC,WAAW,CAACC;IACd,MAAM,EAAEC,KAAK,EAAEC,IAAI,EAAEC,KAAK,EAAEC,IAAI,EAAEC,SAAS,EAAE,GAAGC,MAAM,GAAGN;IACzD,OAAO,WAAP,GACI,oBAACO,eAAe,IAAI;QAAC,OAAON;qBAEvBO,MAAAA,YAAkB,CAACN,MAAM;QACtB,GAAGI,IAAI;QACP,WAAWG,GAAGZ,aAAa;YAAEM;YAAOC;QAAK,IAAIC;IACjD;AAGZ;AAEA,MAAMK,OAAOC,gBAAgB,QAAQZ"}
1
+ {"version":3,"file":"Icon/Icon.js","sources":["../../src/Icon/Icon.tsx"],"sourcesContent":["import React from \"react\";\nimport { AccessibleIcon } from \"radix-ui\";\nimport { cn, cva, makeDecoratable, type VariantProps } from \"~/utils.js\";\n\nconst iconVariants = cva(\"shrink-0\", {\n variants: {\n size: {\n xs: \"size-sm-extra\",\n sm: \"size-md\",\n md: \"size-md-plus\",\n lg: \"size-lg\"\n },\n color: {\n inherit: \"fill-inherit text-inherit\",\n accent: \"fill-accent-default text-accent-default\",\n \"neutral-light\": \"fill-neutral-strong text-neutral-strong\",\n \"neutral-strong\": \"fill-neutral-xstrong text-neutral-xstrong\",\n \"neutral-strong-transparent\": \"fill-neutral-xstrong/30 text-neutral-xstrong/30\",\n \"neutral-base\": \"fill-neutral-base text-neutral-base\",\n \"neutral-negative\": \"fill-neutral-base/50 text-neutral-base/50\"\n }\n },\n defaultVariants: {\n size: \"md\",\n color: \"inherit\"\n }\n});\n\ninterface IconProps\n extends\n Omit<React.HTMLAttributes<HTMLOrSVGElement>, \"color\">,\n VariantProps<typeof iconVariants> {\n label: string;\n icon: React.ReactNode;\n}\n\nconst IconBase = (props: IconProps) => {\n const { label, icon, color, size, className, ...rest } = props;\n return (\n <AccessibleIcon.Root label={label}>\n {/* @ts-expect-error */}\n {React.cloneElement(icon, {\n ...rest,\n className: cn(iconVariants({ color, size }), className)\n })}\n </AccessibleIcon.Root>\n );\n};\n\nconst Icon = makeDecoratable(\"Icon\", IconBase);\n\n/**\n * An icon element whose size a parent can set through `React.cloneElement`. React 19 types an\n * element's props as `unknown` unless they are given, so components that resize an icon take this.\n */\ntype IconElement = React.ReactElement<Partial<IconProps>>;\n\nexport { Icon, type IconProps, type IconElement };\n"],"names":["iconVariants","cva","IconBase","props","label","icon","color","size","className","rest","AccessibleIcon","React","cn","Icon","makeDecoratable"],"mappings":";;;AAIA,MAAMA,eAAeC,IAAI,YAAY;IACjC,UAAU;QACN,MAAM;YACF,IAAI;YACJ,IAAI;YACJ,IAAI;YACJ,IAAI;QACR;QACA,OAAO;YACH,SAAS;YACT,QAAQ;YACR,iBAAiB;YACjB,kBAAkB;YAClB,8BAA8B;YAC9B,gBAAgB;YAChB,oBAAoB;QACxB;IACJ;IACA,iBAAiB;QACb,MAAM;QACN,OAAO;IACX;AACJ;AAUA,MAAMC,WAAW,CAACC;IACd,MAAM,EAAEC,KAAK,EAAEC,IAAI,EAAEC,KAAK,EAAEC,IAAI,EAAEC,SAAS,EAAE,GAAGC,MAAM,GAAGN;IACzD,OAAO,WAAP,GACI,oBAACO,eAAe,IAAI;QAAC,OAAON;qBAEvBO,MAAAA,YAAkB,CAACN,MAAM;QACtB,GAAGI,IAAI;QACP,WAAWG,GAAGZ,aAAa;YAAEM;YAAOC;QAAK,IAAIC;IACjD;AAGZ;AAEA,MAAMK,OAAOC,gBAAgB,QAAQZ"}
@@ -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 { IconPickerPrimitive } from "./primitives/index.js";
4
4
  import { FormComponentDescription, FormComponentErrorMessage, FormComponentLabel, FormComponentNote } from "../FormComponent/index.js";
5
5
  const DecoratableIconPicker = ({ label, description, note, hint, required, disabled, validation, ...props })=>{
@@ -7,9 +7,13 @@ const DecoratableIconPicker = ({ label, description, note, hint, required, disab
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,
@@ -19,6 +23,7 @@ const DecoratableIconPicker = ({ label, description, note, hint, required, disab
19
23
  text: description,
20
24
  disabled: disabled
21
25
  }), /*#__PURE__*/ react.createElement(IconPickerPrimitive, {
26
+ id: id,
22
27
  ...props,
23
28
  disabled: disabled,
24
29
  invalid: invalid
@@ -1 +1 @@
1
- {"version":3,"file":"IconPicker/IconPicker.js","sources":["../../src/IconPicker/IconPicker.tsx"],"sourcesContent":["import React, { useMemo } from \"react\";\nimport { makeDecoratable } from \"~/utils.js\";\nimport type { IconPickerPrimitiveProps } from \"./primitives/index.js\";\nimport { IconPickerPrimitive } 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 IconPickerProps = IconPickerPrimitiveProps & FormComponentProps;\n\nconst DecoratableIconPicker = ({\n label,\n description,\n note,\n hint,\n required,\n disabled,\n validation,\n ...props\n}: IconPickerProps) => {\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 <IconPickerPrimitive {...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 IconPicker = makeDecoratable(\"IconPicker\", DecoratableIconPicker);\n\nexport { IconPicker, type IconPickerProps };\n"],"names":["DecoratableIconPicker","label","description","note","hint","required","disabled","validation","props","validationIsValid","validationMessage","invalid","useMemo","FormComponentLabel","FormComponentDescription","IconPickerPrimitive","FormComponentErrorMessage","FormComponentNote","IconPicker","makeDecoratable"],"mappings":";;;;AAcA,MAAMA,wBAAwB,CAAC,EAC3BC,KAAK,EACLC,WAAW,EACXC,IAAI,EACJC,IAAI,EACJC,QAAQ,EACRC,QAAQ,EACRC,UAAU,EACV,GAAGC,OACW;IACd,MAAM,EAAE,SAASC,iBAAiB,EAAE,SAASC,iBAAiB,EAAE,GAAGH,cAAc,CAAC;IAClF,MAAMI,UAAUC,QAAQ,IAAMH,AAAsB,UAAtBA,mBAA6B;QAACA;KAAkB;IAE9E,OAAO,WAAP,GACI,oBAAC;QAAI,WAAW;qBACZ,oBAACI,oBAAkBA;QACf,MAAMZ;QACN,MAAMG;QACN,UAAUC;QACV,UAAUC;QACV,SAASK;sBAEb,oBAACG,0BAAwBA;QAAC,MAAMZ;QAAa,UAAUI;sBACvD,oBAACS,qBAAmBA;QAAE,GAAGP,KAAK;QAAE,UAAUF;QAAU,SAASK;sBAC7D,oBAACK,2BAAyBA;QACtB,MAAMN;QACN,SAASC;QACT,UAAUL;sBAEd,oBAACW,mBAAiBA;QAAC,MAAMd;QAAM,UAAUG;;AAGrD;AACA,MAAMY,aAAaC,gBAAgB,cAAcnB"}
1
+ {"version":3,"file":"IconPicker/IconPicker.js","sources":["../../src/IconPicker/IconPicker.tsx"],"sourcesContent":["import React, { useMemo } from \"react\";\nimport { makeDecoratable, generateId } from \"~/utils.js\";\nimport type { IconPickerPrimitiveProps } from \"./primitives/index.js\";\nimport { IconPickerPrimitive } 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 IconPickerProps = IconPickerPrimitiveProps & FormComponentProps;\n\nconst DecoratableIconPicker = ({\n label,\n description,\n note,\n hint,\n required,\n disabled,\n validation,\n ...props\n}: IconPickerProps) => {\n const { isValid: validationIsValid, message: validationMessage } = validation || {};\n const invalid = useMemo(() => validationIsValid === false, [validationIsValid]);\n /* The label names the control, so `getByLabelText` / `{ label }` find it. */\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 <IconPickerPrimitive id={id} {...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 IconPicker = makeDecoratable(\"IconPicker\", DecoratableIconPicker);\n\nexport { IconPicker, type IconPickerProps };\n"],"names":["DecoratableIconPicker","label","description","note","hint","required","disabled","validation","props","validationIsValid","validationMessage","invalid","useMemo","id","generateId","FormComponentLabel","FormComponentDescription","IconPickerPrimitive","FormComponentErrorMessage","FormComponentNote","IconPicker","makeDecoratable"],"mappings":";;;;AAcA,MAAMA,wBAAwB,CAAC,EAC3BC,KAAK,EACLC,WAAW,EACXC,IAAI,EACJC,IAAI,EACJC,QAAQ,EACRC,QAAQ,EACRC,UAAU,EACV,GAAGC,OACW;IACd,MAAM,EAAE,SAASC,iBAAiB,EAAE,SAASC,iBAAiB,EAAE,GAAGH,cAAc,CAAC;IAClF,MAAMI,UAAUC,QAAQ,IAAMH,AAAsB,UAAtBA,mBAA6B;QAACA;KAAkB;IAE9E,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,qBAAmBA;QAAC,IAAIJ;QAAK,GAAGL,KAAK;QAAE,UAAUF;QAAU,SAASK;sBACrE,oBAACO,2BAAyBA;QACtB,MAAMR;QACN,SAASC;QACT,UAAUL;sBAEd,oBAACa,mBAAiBA;QAAC,MAAMhB;QAAM,UAAUG;;AAGrD;AACA,MAAMc,aAAaC,gBAAgB,cAAcrB"}
@@ -14,7 +14,7 @@ class IconPickerIcon {
14
14
  prefix: "fas",
15
15
  name: "star"
16
16
  });
17
- {
17
+ else {
18
18
  const values = value.split("/");
19
19
  return new IconPickerIcon({
20
20
  prefix: values[0],
@@ -1 +1 @@
1
- {"version":3,"file":"IconPicker/domains/IconPickerIcon.js","sources":["../../../src/IconPicker/domains/IconPickerIcon.tsx"],"sourcesContent":["import type { IconPickerIconDto } from \"./IconPickerIconDto.js\";\n\nexport class IconPickerIcon {\n private readonly _prefix: string;\n private readonly _name: string;\n\n protected constructor(data: { prefix: string; name: string }) {\n this._prefix = data.prefix;\n this._name = data.name;\n }\n\n static create(data: IconPickerIconDto) {\n return new IconPickerIcon({\n prefix: data.prefix,\n name: data.name\n });\n }\n\n static createFromString(value?: string) {\n if (typeof value === \"string\" && value.includes(\"/\")) {\n const values = value.split(\"/\");\n return new IconPickerIcon({\n prefix: values[0],\n name: values[1]\n });\n } else {\n return new IconPickerIcon({\n prefix: \"fas\",\n name: \"star\"\n });\n }\n }\n\n get prefix() {\n return this._prefix;\n }\n\n get name() {\n return this._name;\n }\n}\n"],"names":["IconPickerIcon","data","value","values"],"mappings":"AAEO,MAAMA;IAIT,YAAsBC,IAAsC,CAAE;QAC1D,IAAI,CAAC,OAAO,GAAGA,KAAK,MAAM;QAC1B,IAAI,CAAC,KAAK,GAAGA,KAAK,IAAI;IAC1B;IAEA,OAAO,OAAOA,IAAuB,EAAE;QACnC,OAAO,IAAID,eAAe;YACtB,QAAQC,KAAK,MAAM;YACnB,MAAMA,KAAK,IAAI;QACnB;IACJ;IAEA,OAAO,iBAAiBC,KAAc,EAAE;QACpC,KAAI,CAAiB,YAAjB,OAAOA,SAAsBA,MAAM,QAAQ,CAAC,IAAG,GAO/C,OAAO,IAAIF,eAAe;YACtB,QAAQ;YACR,MAAM;QACV;QAVkD;YAClD,MAAMG,SAASD,MAAM,KAAK,CAAC;YAC3B,OAAO,IAAIF,eAAe;gBACtB,QAAQG,MAAM,CAAC,EAAE;gBACjB,MAAMA,MAAM,CAAC,EAAE;YACnB;QACJ;IAMJ;IAEA,IAAI,SAAS;QACT,OAAO,IAAI,CAAC,OAAO;IACvB;IAEA,IAAI,OAAO;QACP,OAAO,IAAI,CAAC,KAAK;IACrB;AACJ"}
1
+ {"version":3,"file":"IconPicker/domains/IconPickerIcon.js","sources":["../../../src/IconPicker/domains/IconPickerIcon.tsx"],"sourcesContent":["import type { IconPickerIconDto } from \"./IconPickerIconDto.js\";\n\nexport class IconPickerIcon {\n private readonly _prefix: string;\n private readonly _name: string;\n\n protected constructor(data: { prefix: string; name: string }) {\n this._prefix = data.prefix;\n this._name = data.name;\n }\n\n static create(data: IconPickerIconDto) {\n return new IconPickerIcon({\n prefix: data.prefix,\n name: data.name\n });\n }\n\n static createFromString(value?: string) {\n if (typeof value === \"string\" && value.includes(\"/\")) {\n const values = value.split(\"/\");\n return new IconPickerIcon({\n prefix: values[0],\n name: values[1]\n });\n } else {\n return new IconPickerIcon({\n prefix: \"fas\",\n name: \"star\"\n });\n }\n }\n\n get prefix() {\n return this._prefix;\n }\n\n get name() {\n return this._name;\n }\n}\n"],"names":["IconPickerIcon","data","value","values"],"mappings":"AAEO,MAAMA;IAIT,YAAsBC,IAAsC,CAAE;QAC1D,IAAI,CAAC,OAAO,GAAGA,KAAK,MAAM;QAC1B,IAAI,CAAC,KAAK,GAAGA,KAAK,IAAI;IAC1B;IAEA,OAAO,OAAOA,IAAuB,EAAE;QACnC,OAAO,IAAID,eAAe;YACtB,QAAQC,KAAK,MAAM;YACnB,MAAMA,KAAK,IAAI;QACnB;IACJ;IAEA,OAAO,iBAAiBC,KAAc,EAAE;QACpC,KAAI,CAAiB,YAAjB,OAAOA,SAAsBA,MAAM,QAAQ,CAAC,IAAG,GAO/C,OAAO,IAAIF,eAAe;YACtB,QAAQ;YACR,MAAM;QACV;aAVkD;YAClD,MAAMG,SAASD,MAAM,KAAK,CAAC;YAC3B,OAAO,IAAIF,eAAe;gBACtB,QAAQG,MAAM,CAAC,EAAE;gBACjB,MAAMA,MAAM,CAAC,EAAE;YACnB;QACJ;IAMJ;IAEA,IAAI,SAAS;QACT,OAAO,IAAI,CAAC,OAAO;IACvB;IAEA,IAAI,OAAO;QACP,OAAO,IAAI,CAAC,KAAK;IACrB;AACJ"}
@@ -7,6 +7,8 @@ declare const iconPickerVariants: (props?: ({
7
7
  disabled?: boolean | null | undefined;
8
8
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
9
9
  interface IconPickerPrimitiveProps extends VariantProps<typeof iconPickerVariants> {
10
+ /** The trigger's id — what a `<label htmlFor>` points at. */
11
+ id?: string;
10
12
  /**
11
13
  * Indicates if the field is disabled.
12
14
  */
@@ -35,6 +35,7 @@ const IconPickerPrimitive = (props)=>{
35
35
  }, /*#__PURE__*/ react.createElement(PopoverPrimitive.Trigger, {
36
36
  asChild: true
37
37
  }, /*#__PURE__*/ react.createElement("button", {
38
+ id: props.id,
38
39
  "data-disabled": props.disabled,
39
40
  className: cn(inputVariants({
40
41
  size: props.size,
@@ -49,8 +50,7 @@ const IconPickerPrimitive = (props)=>{
49
50
  size: props.size
50
51
  }))), /*#__PURE__*/ react.createElement(PopoverPrimitive.Content, {
51
52
  align: "start",
52
- className: "min-w-96",
53
- onWheel: (e)=>e.stopPropagation()
53
+ className: "min-w-96"
54
54
  }, /*#__PURE__*/ react.createElement(IconPickerInput, {
55
55
  value: vm.searchQuery,
56
56
  onChange: searchIcon,
@@ -1 +1 @@
1
- {"version":3,"file":"IconPicker/primitives/IconPickerPrimitive.js","sources":["../../../src/IconPicker/primitives/IconPickerPrimitive.tsx"],"sourcesContent":["import React, { useEffect, useRef } from \"react\";\nimport type { InputPrimitiveProps } from \"~/Input/index.js\";\nimport { inputVariants } from \"~/Input/index.js\";\nimport { PopoverPrimitive } from \"~/Popover/index.js\";\nimport { cn, cva, type VariantProps } from \"~/utils.js\";\nimport { IconPickerGrid, IconPickerInput, IconPickerTrigger } from \"./components/index.js\";\nimport type { IconPickerIconDto } from \"../domains/index.js\";\nimport { useIconPicker } from \"./useIconPicker.js\";\n\nconst iconPickerVariants = cva(\"cursor-pointer text-neutral-strong\", {\n variants: {\n size: {\n md: \"w-16\",\n lg: \"w-16\",\n xl: \"w-20\"\n },\n disabled: {\n true: \"pointer-events-none\"\n }\n },\n defaultVariants: {\n size: \"lg\"\n }\n});\n\ninterface IconPickerPrimitiveProps extends VariantProps<typeof iconPickerVariants> {\n /**\n * Indicates if the field is disabled.\n */\n disabled?: boolean;\n /**\n * Callback triggered when the value changes.\n */\n onChange?: (value: string) => void;\n /**\n * List of icons to be displayed in the icon picker.\n */\n icons: IconPickerIconDto[];\n /**\n * Indicates if the input field is invalid.\n * Refer to `InputPrimitiveProps[\"invalid\"]` for possible values.\n */\n invalid?: InputPrimitiveProps[\"invalid\"];\n /**\n * Optional selected icon.\n */\n value?: string;\n /**\n * Variant of the input field.\n * Refer to `InputPrimitiveProps[\"variant\"]` for possible values.\n */\n variant?: InputPrimitiveProps[\"variant\"];\n}\n\nconst IconPickerPrimitive = (props: IconPickerPrimitiveProps) => {\n const { vm, setListOpenState, searchIcon, setSelectedIcon } = useIconPicker(props);\n // TODO figure out a better way to type this ref, without using `as unknown as`\n const inputRef = useRef<HTMLInputElement>(null as unknown as HTMLInputElement);\n\n useEffect(() => {\n setTimeout(() => {\n if (vm.open && inputRef.current) {\n inputRef.current.focus();\n }\n }, 50);\n }, [vm.open]);\n\n return (\n <PopoverPrimitive open={vm.open} onOpenChange={setListOpenState}>\n <PopoverPrimitive.Trigger asChild>\n <button\n data-disabled={props.disabled}\n className={cn(\n inputVariants({\n size: props.size,\n variant: props.variant,\n invalid: props.invalid\n }),\n iconPickerVariants({ size: props.size, disabled: props.disabled })\n )}\n >\n <IconPickerTrigger value={props.value} size={props.size} />\n </button>\n </PopoverPrimitive.Trigger>\n <PopoverPrimitive.Content\n align={\"start\"}\n className={\"min-w-96\"}\n onWheel={e => e.stopPropagation()} // Wheel event should not propagate to the parent: this fixes scrolling issues when the IconPicker is placed inside a Dialog.\n >\n <IconPickerInput value={vm.searchQuery} onChange={searchIcon} inputRef={inputRef} />\n <IconPickerGrid\n icons={vm.icons}\n iconsLength={vm.iconsLength}\n onIconSelect={setSelectedIcon}\n />\n </PopoverPrimitive.Content>\n </PopoverPrimitive>\n );\n};\n\nexport { IconPickerPrimitive, type IconPickerPrimitiveProps };\n"],"names":["iconPickerVariants","cva","IconPickerPrimitive","props","vm","setListOpenState","searchIcon","setSelectedIcon","useIconPicker","inputRef","useRef","useEffect","setTimeout","PopoverPrimitive","cn","inputVariants","IconPickerTrigger","e","IconPickerInput","IconPickerGrid"],"mappings":";;;;;;AASA,MAAMA,qBAAqBC,IAAI,sCAAsC;IACjE,UAAU;QACN,MAAM;YACF,IAAI;YACJ,IAAI;YACJ,IAAI;QACR;QACA,UAAU;YACN,MAAM;QACV;IACJ;IACA,iBAAiB;QACb,MAAM;IACV;AACJ;AA+BA,MAAMC,sBAAsB,CAACC;IACzB,MAAM,EAAEC,EAAE,EAAEC,gBAAgB,EAAEC,UAAU,EAAEC,eAAe,EAAE,GAAGC,cAAcL;IAE5E,MAAMM,WAAWC,OAAyB;IAE1CC,UAAU;QACNC,WAAW;YACP,IAAIR,GAAG,IAAI,IAAIK,SAAS,OAAO,EAC3BA,SAAS,OAAO,CAAC,KAAK;QAE9B,GAAG;IACP,GAAG;QAACL,GAAG,IAAI;KAAC;IAEZ,OAAO,WAAP,GACI,oBAACS,kBAAgBA;QAAC,MAAMT,GAAG,IAAI;QAAE,cAAcC;qBAC3C,oBAACQ,iBAAiB,OAAO;QAAC;qBACtB,oBAAC;QACG,iBAAeV,MAAM,QAAQ;QAC7B,WAAWW,GACPC,cAAc;YACV,MAAMZ,MAAM,IAAI;YAChB,SAASA,MAAM,OAAO;YACtB,SAASA,MAAM,OAAO;QAC1B,IACAH,mBAAmB;YAAE,MAAMG,MAAM,IAAI;YAAE,UAAUA,MAAM,QAAQ;QAAC;qBAGpE,oBAACa,mBAAiBA;QAAC,OAAOb,MAAM,KAAK;QAAE,MAAMA,MAAM,IAAI;wBAG/D,oBAACU,iBAAiB,OAAO;QACrB,OAAO;QACP,WAAW;QACX,SAASI,CAAAA,IAAKA,EAAE,eAAe;qBAE/B,oBAACC,iBAAeA;QAAC,OAAOd,GAAG,WAAW;QAAE,UAAUE;QAAY,UAAUG;sBACxE,oBAACU,gBAAcA;QACX,OAAOf,GAAG,KAAK;QACf,aAAaA,GAAG,WAAW;QAC3B,cAAcG;;AAKlC"}
1
+ {"version":3,"file":"IconPicker/primitives/IconPickerPrimitive.js","sources":["../../../src/IconPicker/primitives/IconPickerPrimitive.tsx"],"sourcesContent":["import React, { useEffect, useRef } from \"react\";\nimport type { InputPrimitiveProps } from \"~/Input/index.js\";\nimport { inputVariants } from \"~/Input/index.js\";\nimport { PopoverPrimitive } from \"~/Popover/index.js\";\nimport { cn, cva, type VariantProps } from \"~/utils.js\";\nimport { IconPickerGrid, IconPickerInput, IconPickerTrigger } from \"./components/index.js\";\nimport type { IconPickerIconDto } from \"../domains/index.js\";\nimport { useIconPicker } from \"./useIconPicker.js\";\n\nconst iconPickerVariants = cva(\"cursor-pointer text-neutral-strong\", {\n variants: {\n size: {\n md: \"w-16\",\n lg: \"w-16\",\n xl: \"w-20\"\n },\n disabled: {\n true: \"pointer-events-none\"\n }\n },\n defaultVariants: {\n size: \"lg\"\n }\n});\n\ninterface IconPickerPrimitiveProps extends VariantProps<typeof iconPickerVariants> {\n /** The trigger's id — what a `<label htmlFor>` points at. */\n id?: string;\n /**\n * Indicates if the field is disabled.\n */\n disabled?: boolean;\n /**\n * Callback triggered when the value changes.\n */\n onChange?: (value: string) => void;\n /**\n * List of icons to be displayed in the icon picker.\n */\n icons: IconPickerIconDto[];\n /**\n * Indicates if the input field is invalid.\n * Refer to `InputPrimitiveProps[\"invalid\"]` for possible values.\n */\n invalid?: InputPrimitiveProps[\"invalid\"];\n /**\n * Optional selected icon.\n */\n value?: string;\n /**\n * Variant of the input field.\n * Refer to `InputPrimitiveProps[\"variant\"]` for possible values.\n */\n variant?: InputPrimitiveProps[\"variant\"];\n}\n\nconst IconPickerPrimitive = (props: IconPickerPrimitiveProps) => {\n const { vm, setListOpenState, searchIcon, setSelectedIcon } = useIconPicker(props);\n // TODO figure out a better way to type this ref, without using `as unknown as`\n const inputRef = useRef<HTMLInputElement>(null as unknown as HTMLInputElement);\n\n useEffect(() => {\n setTimeout(() => {\n if (vm.open && inputRef.current) {\n inputRef.current.focus();\n }\n }, 50);\n }, [vm.open]);\n\n return (\n <PopoverPrimitive open={vm.open} onOpenChange={setListOpenState}>\n <PopoverPrimitive.Trigger asChild>\n <button\n id={props.id}\n data-disabled={props.disabled}\n className={cn(\n inputVariants({\n size: props.size,\n variant: props.variant,\n invalid: props.invalid\n }),\n iconPickerVariants({ size: props.size, disabled: props.disabled })\n )}\n >\n <IconPickerTrigger value={props.value} size={props.size} />\n </button>\n </PopoverPrimitive.Trigger>\n <PopoverPrimitive.Content align={\"start\"} className={\"min-w-96\"}>\n <IconPickerInput value={vm.searchQuery} onChange={searchIcon} inputRef={inputRef} />\n <IconPickerGrid\n icons={vm.icons}\n iconsLength={vm.iconsLength}\n onIconSelect={setSelectedIcon}\n />\n </PopoverPrimitive.Content>\n </PopoverPrimitive>\n );\n};\n\nexport { IconPickerPrimitive, type IconPickerPrimitiveProps };\n"],"names":["iconPickerVariants","cva","IconPickerPrimitive","props","vm","setListOpenState","searchIcon","setSelectedIcon","useIconPicker","inputRef","useRef","useEffect","setTimeout","PopoverPrimitive","cn","inputVariants","IconPickerTrigger","IconPickerInput","IconPickerGrid"],"mappings":";;;;;;AASA,MAAMA,qBAAqBC,IAAI,sCAAsC;IACjE,UAAU;QACN,MAAM;YACF,IAAI;YACJ,IAAI;YACJ,IAAI;QACR;QACA,UAAU;YACN,MAAM;QACV;IACJ;IACA,iBAAiB;QACb,MAAM;IACV;AACJ;AAiCA,MAAMC,sBAAsB,CAACC;IACzB,MAAM,EAAEC,EAAE,EAAEC,gBAAgB,EAAEC,UAAU,EAAEC,eAAe,EAAE,GAAGC,cAAcL;IAE5E,MAAMM,WAAWC,OAAyB;IAE1CC,UAAU;QACNC,WAAW;YACP,IAAIR,GAAG,IAAI,IAAIK,SAAS,OAAO,EAC3BA,SAAS,OAAO,CAAC,KAAK;QAE9B,GAAG;IACP,GAAG;QAACL,GAAG,IAAI;KAAC;IAEZ,OAAO,WAAP,GACI,oBAACS,kBAAgBA;QAAC,MAAMT,GAAG,IAAI;QAAE,cAAcC;qBAC3C,oBAACQ,iBAAiB,OAAO;QAAC;qBACtB,oBAAC;QACG,IAAIV,MAAM,EAAE;QACZ,iBAAeA,MAAM,QAAQ;QAC7B,WAAWW,GACPC,cAAc;YACV,MAAMZ,MAAM,IAAI;YAChB,SAASA,MAAM,OAAO;YACtB,SAASA,MAAM,OAAO;QAC1B,IACAH,mBAAmB;YAAE,MAAMG,MAAM,IAAI;YAAE,UAAUA,MAAM,QAAQ;QAAC;qBAGpE,oBAACa,mBAAiBA;QAAC,OAAOb,MAAM,KAAK;QAAE,MAAMA,MAAM,IAAI;wBAG/D,oBAACU,iBAAiB,OAAO;QAAC,OAAO;QAAS,WAAW;qBACjD,oBAACI,iBAAeA;QAAC,OAAOb,GAAG,WAAW;QAAE,UAAUE;QAAY,UAAUG;sBACxE,oBAACS,gBAAcA;QACX,OAAOd,GAAG,KAAK;QACf,aAAaA,GAAG,WAAW;QAC3B,cAAcG;;AAKlC"}
@@ -1 +1 @@
1
- {"version":3,"file":"IconPicker/primitives/components/IconPickerGrid.js","sources":["../../../../src/IconPicker/primitives/components/IconPickerGrid.tsx"],"sourcesContent":["import React, { useCallback } from \"react\";\nimport type { GridCellProps } from \"react-virtualized\";\nimport { Grid } from \"react-virtualized\";\nimport { Text } from \"~/Text/index.js\";\nimport { cn } from \"~/utils.js\";\nimport type { IconPickerFontAwesome } from \"../../domains/index.js\";\nimport { IconPickerIconFormatter } from \"../../domains/index.js\";\nimport { IconPickerIcon } from \"./IconPickerIcon.js\";\n\nconst COLUMN_COUNT = 5;\nconst GRID_WIDTH = 424;\nconst GRID_HEIGHT = 270;\nconst COLUMN_WIDTH = 80;\nconst ROW_HEIGHT = 80;\n\ninterface IconPickerGridProps {\n icons: IconPickerFontAwesome[];\n iconsLength: number;\n onIconSelect: (value: string) => void;\n}\n\nconst IconPickerGrid = (props: IconPickerGridProps) => {\n const renderCell = useCallback(() => {\n return function renderCell({\n columnIndex,\n key,\n rowIndex,\n style\n }: GridCellProps): React.ReactNode {\n const item = props.icons[rowIndex * COLUMN_COUNT + columnIndex];\n if (!item) {\n return null;\n }\n\n return (\n <div\n key={key}\n style={style}\n className={cn([\n \"flex flex-col justify-center items-center gap-sm\",\n \"text-neutral-strong\",\n \"hover:bg-neutral-dimmed hover:text-neutral-strong\",\n \"px-xs-plus box-border rounded-xs cursor-pointer overflow-hidden\",\n \"transition-colors duration-400 ease-out\"\n ])}\n onClick={() => {\n if (props.onIconSelect) {\n props.onIconSelect(IconPickerIconFormatter.formatStringValue(item));\n }\n }}\n >\n <IconPickerIcon name={item.name} prefix={item.prefix} className={\"size-lg\"} />\n <Text\n as={\"div\"}\n size={\"sm\"}\n className={\"w-full truncate text-center text-neutral-muted\"}\n >\n {item.name}\n </Text>\n </div>\n );\n };\n }, [props.icons]);\n\n return (\n <div>\n {props.iconsLength === 0 ? (\n <div className={`px-sm-extra py-md text-neutral-strong`}>\n <Text>{\"No results found.\"}</Text>\n </div>\n ) : (\n <Grid\n className={\"px-sm-extra py-xs-plus outline-none\"}\n cellRenderer={renderCell()}\n columnCount={COLUMN_COUNT}\n columnWidth={COLUMN_WIDTH}\n rowHeight={ROW_HEIGHT}\n width={GRID_WIDTH}\n height={GRID_HEIGHT}\n rowCount={Math.ceil(props.iconsLength / COLUMN_COUNT)}\n />\n )}\n </div>\n );\n};\n\nexport { IconPickerGrid, type IconPickerGridProps };\n"],"names":["COLUMN_COUNT","GRID_WIDTH","GRID_HEIGHT","COLUMN_WIDTH","ROW_HEIGHT","IconPickerGrid","props","renderCell","useCallback","columnIndex","key","rowIndex","style","item","cn","IconPickerIconFormatter","IconPickerIcon","Text","Grid","Math"],"mappings":";;;;;;AASA,MAAMA,eAAe;AACrB,MAAMC,aAAa;AACnB,MAAMC,cAAc;AACpB,MAAMC,eAAe;AACrB,MAAMC,aAAa;AAQnB,MAAMC,iBAAiB,CAACC;IACpB,MAAMC,aAAaC,YAAY,IACpB,SAAoB,EACvBC,WAAW,EACXC,GAAG,EACHC,QAAQ,EACRC,KAAK,EACO;YACZ,MAAMC,OAAOP,MAAM,KAAK,CAACK,WAAWX,eAAeS,YAAY;YAC/D,IAAI,CAACI,MACD,OAAO;YAGX,OAAO,WAAP,GACI,oBAAC;gBACG,KAAKH;gBACL,OAAOE;gBACP,WAAWE,GAAG;oBACV;oBACA;oBACA;oBACA;oBACA;iBACH;gBACD,SAAS;oBACL,IAAIR,MAAM,YAAY,EAClBA,MAAM,YAAY,CAACS,wBAAwB,iBAAiB,CAACF;gBAErE;6BAEA,oBAACG,gBAAcA;gBAAC,MAAMH,KAAK,IAAI;gBAAE,QAAQA,KAAK,MAAM;gBAAE,WAAW;8BACjE,oBAACI,MAAIA;gBACD,IAAI;gBACJ,MAAM;gBACN,WAAW;eAEVJ,KAAK,IAAI;QAI1B,GACD;QAACP,MAAM,KAAK;KAAC;IAEhB,OAAO,WAAP,GACI,oBAAC,aACIA,AAAsB,MAAtBA,MAAM,WAAW,GAAS,WAAJ,GACnB,oBAAC;QAAI,WAAW;qBACZ,oBAACW,MAAIA,MAAE,sCAGX,oBAACC,MAAIA;QACD,WAAW;QACX,cAAcX;QACd,aAAaP;QACb,aAAaG;QACb,WAAWC;QACX,OAAOH;QACP,QAAQC;QACR,UAAUiB,KAAK,IAAI,CAACb,MAAM,WAAW,GAAGN;;AAK5D"}
1
+ {"version":3,"file":"IconPicker/primitives/components/IconPickerGrid.js","sources":["../../../../src/IconPicker/primitives/components/IconPickerGrid.tsx"],"sourcesContent":["import React, { useCallback } from \"react\";\nimport type { CellRendererParams } from \"react-virtualized\";\nimport { Grid } from \"react-virtualized\";\nimport { Text } from \"~/Text/index.js\";\nimport { cn } from \"~/utils.js\";\nimport type { IconPickerFontAwesome } from \"../../domains/index.js\";\nimport { IconPickerIconFormatter } from \"../../domains/index.js\";\nimport { IconPickerIcon } from \"./IconPickerIcon.js\";\n\nconst COLUMN_COUNT = 5;\nconst GRID_WIDTH = 424;\nconst GRID_HEIGHT = 270;\nconst COLUMN_WIDTH = 80;\nconst ROW_HEIGHT = 80;\n\ninterface IconPickerGridProps {\n icons: IconPickerFontAwesome[];\n iconsLength: number;\n onIconSelect: (value: string) => void;\n}\n\nconst IconPickerGrid = (props: IconPickerGridProps) => {\n const renderCell = useCallback(() => {\n return function renderCell({\n columnIndex,\n key,\n rowIndex,\n style\n }: CellRendererParams): React.ReactElement | null {\n const item = props.icons[rowIndex * COLUMN_COUNT + columnIndex];\n if (!item) {\n return null;\n }\n\n return (\n <div\n key={key}\n style={style}\n className={cn([\n \"flex flex-col justify-center items-center gap-sm\",\n \"text-neutral-strong\",\n \"hover:bg-neutral-dimmed hover:text-neutral-strong\",\n \"px-xs-plus box-border rounded-xs cursor-pointer overflow-hidden\",\n \"transition-colors duration-400 ease-out\"\n ])}\n onClick={() => {\n if (props.onIconSelect) {\n props.onIconSelect(IconPickerIconFormatter.formatStringValue(item));\n }\n }}\n >\n <IconPickerIcon name={item.name} prefix={item.prefix} className={\"size-lg\"} />\n <Text\n as={\"div\"}\n size={\"sm\"}\n className={\"w-full truncate text-center text-neutral-muted\"}\n >\n {item.name}\n </Text>\n </div>\n );\n };\n }, [props.icons]);\n\n return (\n <div>\n {props.iconsLength === 0 ? (\n <div className={`px-sm-extra py-md text-neutral-strong`}>\n <Text>{\"No results found.\"}</Text>\n </div>\n ) : (\n <Grid\n className={\"px-sm-extra py-xs-plus outline-none\"}\n cellRenderer={renderCell()}\n columnCount={COLUMN_COUNT}\n columnWidth={COLUMN_WIDTH}\n rowHeight={ROW_HEIGHT}\n width={GRID_WIDTH}\n height={GRID_HEIGHT}\n rowCount={Math.ceil(props.iconsLength / COLUMN_COUNT)}\n />\n )}\n </div>\n );\n};\n\nexport { IconPickerGrid, type IconPickerGridProps };\n"],"names":["COLUMN_COUNT","GRID_WIDTH","GRID_HEIGHT","COLUMN_WIDTH","ROW_HEIGHT","IconPickerGrid","props","renderCell","useCallback","columnIndex","key","rowIndex","style","item","cn","IconPickerIconFormatter","IconPickerIcon","Text","Grid","Math"],"mappings":";;;;;;AASA,MAAMA,eAAe;AACrB,MAAMC,aAAa;AACnB,MAAMC,cAAc;AACpB,MAAMC,eAAe;AACrB,MAAMC,aAAa;AAQnB,MAAMC,iBAAiB,CAACC;IACpB,MAAMC,aAAaC,YAAY,IACpB,SAAoB,EACvBC,WAAW,EACXC,GAAG,EACHC,QAAQ,EACRC,KAAK,EACY;YACjB,MAAMC,OAAOP,MAAM,KAAK,CAACK,WAAWX,eAAeS,YAAY;YAC/D,IAAI,CAACI,MACD,OAAO;YAGX,OAAO,WAAP,GACI,oBAAC;gBACG,KAAKH;gBACL,OAAOE;gBACP,WAAWE,GAAG;oBACV;oBACA;oBACA;oBACA;oBACA;iBACH;gBACD,SAAS;oBACL,IAAIR,MAAM,YAAY,EAClBA,MAAM,YAAY,CAACS,wBAAwB,iBAAiB,CAACF;gBAErE;6BAEA,oBAACG,gBAAcA;gBAAC,MAAMH,KAAK,IAAI;gBAAE,QAAQA,KAAK,MAAM;gBAAE,WAAW;8BACjE,oBAACI,MAAIA;gBACD,IAAI;gBACJ,MAAM;gBACN,WAAW;eAEVJ,KAAK,IAAI;QAI1B,GACD;QAACP,MAAM,KAAK;KAAC;IAEhB,OAAO,WAAP,GACI,oBAAC,aACIA,AAAsB,MAAtBA,MAAM,WAAW,GAAS,WAAJ,GACnB,oBAAC;QAAI,WAAW;qBACZ,oBAACW,MAAIA,MAAE,sCAGX,oBAACC,MAAIA;QACD,WAAW;QACX,cAAcX;QACd,aAAaP;QACb,aAAaG;QACb,WAAWC;QACX,OAAOH;QACP,QAAQC;QACR,UAAUiB,KAAK,IAAI,CAACb,MAAM,WAAW,GAAGN;;AAK5D"}
@@ -0,0 +1,16 @@
1
+ import React from "react";
2
+ import type { ImageEditorAspectRatio, ImageEditorCrop, ImageEditorHotspot } from "./types.js";
3
+ interface AspectRatioPreviewProps {
4
+ src: string;
5
+ imageWidth: number;
6
+ imageHeight: number;
7
+ crop: ImageEditorCrop | undefined;
8
+ hotspot: ImageEditorHotspot | undefined;
9
+ aspectRatio: ImageEditorAspectRatio;
10
+ }
11
+ /**
12
+ * A single live preview showing how the current crop + hotspot renders at one
13
+ * target aspect ratio. Uses the shared preview geometry so it matches the site.
14
+ */
15
+ export declare const AspectRatioPreview: ({ src, imageWidth, imageHeight, crop, hotspot, aspectRatio }: AspectRatioPreviewProps) => React.JSX.Element;
16
+ export {};
@@ -0,0 +1,26 @@
1
+ import react from "react";
2
+ import { getPreviewStyles } from "./geometry.js";
3
+ const PREVIEW_HEIGHT = 120;
4
+ const AspectRatioPreview = ({ src, imageWidth, imageHeight, crop, hotspot, aspectRatio })=>{
5
+ const styles = getPreviewStyles(imageWidth, imageHeight, crop, hotspot, aspectRatio.ratio);
6
+ const width = Math.round(PREVIEW_HEIGHT * aspectRatio.ratio);
7
+ return /*#__PURE__*/ react.createElement("div", {
8
+ className: "flex flex-col items-center gap-xs"
9
+ }, /*#__PURE__*/ react.createElement("div", {
10
+ className: "relative overflow-hidden rounded-sm border border-neutral-dimmed bg-neutral-light",
11
+ style: {
12
+ width: `${width}px`,
13
+ height: `${PREVIEW_HEIGHT}px`
14
+ }
15
+ }, /*#__PURE__*/ react.createElement("img", {
16
+ src: src,
17
+ alt: "",
18
+ style: styles.image,
19
+ draggable: false
20
+ })), /*#__PURE__*/ react.createElement("span", {
21
+ className: "text-sm text-neutral-strong"
22
+ }, aspectRatio.label));
23
+ };
24
+ export { AspectRatioPreview };
25
+
26
+ //# sourceMappingURL=AspectRatioPreview.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ImageEditor/AspectRatioPreview.js","sources":["../../src/ImageEditor/AspectRatioPreview.tsx"],"sourcesContent":["import React from \"react\";\nimport { getPreviewStyles } from \"./geometry.js\";\nimport type { ImageEditorAspectRatio, ImageEditorCrop, ImageEditorHotspot } from \"./types.js\";\n\ninterface AspectRatioPreviewProps {\n src: string;\n imageWidth: number;\n imageHeight: number;\n crop: ImageEditorCrop | undefined;\n hotspot: ImageEditorHotspot | undefined;\n aspectRatio: ImageEditorAspectRatio;\n}\n\n// Fixed preview height (px). Each thumbnail keeps this height regardless of how\n// many are shown; the width is derived from the aspect ratio.\nconst PREVIEW_HEIGHT = 120;\n\n/**\n * A single live preview showing how the current crop + hotspot renders at one\n * target aspect ratio. Uses the shared preview geometry so it matches the site.\n */\nexport const AspectRatioPreview = ({\n src,\n imageWidth,\n imageHeight,\n crop,\n hotspot,\n aspectRatio\n}: AspectRatioPreviewProps) => {\n const styles = getPreviewStyles(imageWidth, imageHeight, crop, hotspot, aspectRatio.ratio);\n const width = Math.round(PREVIEW_HEIGHT * aspectRatio.ratio);\n\n return (\n <div className={\"flex flex-col items-center gap-xs\"}>\n <div\n className={\n \"relative overflow-hidden rounded-sm border border-neutral-dimmed bg-neutral-light\"\n }\n style={{ width: `${width}px`, height: `${PREVIEW_HEIGHT}px` }}\n >\n <img src={src} alt={\"\"} style={styles.image} draggable={false} />\n </div>\n <span className={\"text-sm text-neutral-strong\"}>{aspectRatio.label}</span>\n </div>\n );\n};\n"],"names":["PREVIEW_HEIGHT","AspectRatioPreview","src","imageWidth","imageHeight","crop","hotspot","aspectRatio","styles","getPreviewStyles","width","Math"],"mappings":";;AAeA,MAAMA,iBAAiB;AAMhB,MAAMC,qBAAqB,CAAC,EAC/BC,GAAG,EACHC,UAAU,EACVC,WAAW,EACXC,IAAI,EACJC,OAAO,EACPC,WAAW,EACW;IACtB,MAAMC,SAASC,iBAAiBN,YAAYC,aAAaC,MAAMC,SAASC,YAAY,KAAK;IACzF,MAAMG,QAAQC,KAAK,KAAK,CAACX,iBAAiBO,YAAY,KAAK;IAE3D,OAAO,WAAP,GACI,oBAAC;QAAI,WAAW;qBACZ,oBAAC;QACG,WACI;QAEJ,OAAO;YAAE,OAAO,GAAGG,MAAM,EAAE,CAAC;YAAE,QAAQ,GAAGV,eAAe,EAAE,CAAC;QAAC;qBAE5D,oBAAC;QAAI,KAAKE;QAAK,KAAK;QAAI,OAAOM,OAAO,KAAK;QAAE,WAAW;uBAE5D,oBAAC;QAAK,WAAW;OAAgCD,YAAY,KAAK;AAG9E"}
@@ -0,0 +1,22 @@
1
+ import React from "react";
2
+ import type { ImageEditorCrop, ImageEditorHotspot, ImageEditorImage } from "./types.js";
3
+ interface CropHotspotEditorProps {
4
+ image: ImageEditorImage;
5
+ crop: ImageEditorCrop | undefined;
6
+ hotspot: ImageEditorHotspot | undefined;
7
+ /** Currently selected crop shape id ("free" or a preset id). Controlled by the parent. */
8
+ aspectId: string;
9
+ onChangeAspect: (id: string) => void;
10
+ onChangeCrop: (crop: ImageEditorCrop) => void;
11
+ onChangeHotspot: (hotspot: ImageEditorHotspot) => void;
12
+ }
13
+ export declare const FREE = "free";
14
+ /**
15
+ * Infer which crop-shape preset a saved crop corresponds to, by comparing the
16
+ * crop's on-screen (pixel) aspect ratio against the presets. The crop stores only
17
+ * edge insets — not the shape used to draw it — so on reopen we recover the shape
18
+ * here; a crop drawn with a preset matches it closely, while a free crop won't.
19
+ */
20
+ export declare const inferAspectId: (crop: ImageEditorCrop | undefined, width: number, height: number) => string;
21
+ export declare const CropHotspotEditor: ({ image, crop, hotspot, aspectId, onChangeAspect, onChangeCrop, onChangeHotspot }: CropHotspotEditorProps) => React.JSX.Element;
22
+ export {};