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

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 (317) hide show
  1. package/Accordion/Accordion.d.ts +7 -6
  2. package/Accordion/components/AccordionContent.js +4 -1
  3. package/Accordion/components/AccordionContent.js.map +1 -1
  4. package/Accordion/components/AccordionItem.d.ts +8 -6
  5. package/Accordion/components/AccordionItem.js.map +1 -1
  6. package/Accordion/components/AccordionItemAction.d.ts +7 -6
  7. package/Accordion/components/AccordionItemDragHandle.d.ts +2 -1
  8. package/Accordion/components/AccordionItemDragHandle.js +2 -1
  9. package/Accordion/components/AccordionItemDragHandle.js.map +1 -1
  10. package/Accordion/components/AccordionItemIcon.d.ts +7 -6
  11. package/Accordion/components/AccordionItemSeparator.d.ts +7 -6
  12. package/Accordion/components/AccordionTrigger.js +4 -2
  13. package/Accordion/components/AccordionTrigger.js.map +1 -1
  14. package/Alert/Alert.d.ts +21 -19
  15. package/AutoComplete/AutoComplete.d.ts +7 -6
  16. package/AutoComplete/primitives/AutoCompletePrimitive.d.ts +7 -6
  17. package/Avatar/Avatar.d.ts +9 -8
  18. package/Avatar/components/AvatarFallback.d.ts +7 -6
  19. package/Avatar/components/AvatarImage.d.ts +7 -6
  20. package/BetaBadge/BetaBadge.d.ts +6 -0
  21. package/BetaBadge/BetaBadge.js +7 -0
  22. package/BetaBadge/BetaBadge.js.map +1 -0
  23. package/Breadcrumbs/Breadcrumbs.d.ts +54 -0
  24. package/Breadcrumbs/Breadcrumbs.js +66 -0
  25. package/Breadcrumbs/Breadcrumbs.js.map +1 -0
  26. package/Breadcrumbs/Breadcrumbs.stories.d.ts +9 -0
  27. package/Breadcrumbs/Breadcrumbs.stories.js +71 -0
  28. package/Breadcrumbs/Breadcrumbs.stories.js.map +1 -0
  29. package/Breadcrumbs/index.d.ts +1 -0
  30. package/Breadcrumbs/index.js +1 -0
  31. package/Button/Button.d.ts +10 -9
  32. package/Button/CopyButton.d.ts +7 -6
  33. package/Button/IconButton.d.ts +10 -9
  34. package/Calendar/Calendar.d.ts +7 -6
  35. package/Calendar/calendarClassNames.js +1 -1
  36. package/Calendar/calendarClassNames.js.map +1 -1
  37. package/Card/Card.d.ts +8 -22
  38. package/Card/components/CancelAction.d.ts +8 -6
  39. package/Card/components/CardContent.d.ts +6 -6
  40. package/Card/components/CardTitle.d.ts +2 -2
  41. package/Card/components/ConfirmAction.d.ts +8 -6
  42. package/Card/components/Icon.d.ts +7 -6
  43. package/Checkbox/Checkbox.d.ts +7 -6
  44. package/Checkbox/primitives/CheckboxPrimitive.d.ts +17 -12
  45. package/CheckboxGroup/CheckboxGroup.d.ts +7 -6
  46. package/CheckboxGroup/primitives/CheckboxGroupPrimitive.d.ts +20 -12
  47. package/CodeEditor/CodeEditor.d.ts +7 -6
  48. package/CodeEditor/CodeEditorPrimitive.d.ts +7 -6
  49. package/CodeEditor/CodeEditorPrimitive.js +3 -1
  50. package/CodeEditor/CodeEditorPrimitive.js.map +1 -1
  51. package/ColorPicker/ColorPicker.d.ts +7 -6
  52. package/ColorPicker/primitives/ColorPickerPrimitive.d.ts +7 -6
  53. package/Command/Command.d.ts +10 -8
  54. package/DataList/DataListModal.d.ts +6 -3
  55. package/DataTable/DataTable.d.ts +23 -12
  56. package/DataTable/DataTable.js +12 -4
  57. package/DataTable/DataTable.js.map +1 -1
  58. package/DataTable/components/ColumnsVisibility.d.ts +5 -4
  59. package/DataTable/components/ColumnsVisibility.js +6 -3
  60. package/DataTable/components/ColumnsVisibility.js.map +1 -1
  61. package/DatePicker/DatePicker.d.ts +7 -6
  62. package/DatePicker/primitives/DatePickerPrimitive.d.ts +7 -6
  63. package/DatePicker/primitives/DateTimePicker.d.ts +1 -1
  64. package/DatePicker/primitives/DateTimePicker.js +15 -3
  65. package/DatePicker/primitives/DateTimePicker.js.map +1 -1
  66. package/DatePicker/primitives/components/DatePickerTrigger.js +1 -1
  67. package/DatePicker/primitives/components/DatePickerTrigger.js.map +1 -1
  68. package/DatePicker/utils/types.d.ts +2 -0
  69. package/Dialog/Dialog.d.ts +8 -22
  70. package/Dialog/components/CancelAction.d.ts +8 -6
  71. package/Dialog/components/ConfirmAction.d.ts +8 -6
  72. package/Dialog/components/DialogContent.d.ts +1 -1
  73. package/Dialog/components/DialogFooter.d.ts +1 -1
  74. package/Dialog/components/DialogTitle.d.ts +1 -1
  75. package/Dialog/components/Icon.d.ts +7 -6
  76. package/Drawer/Drawer.d.ts +8 -22
  77. package/Drawer/Drawer.stories.js +1 -0
  78. package/Drawer/Drawer.stories.js.map +1 -1
  79. package/Drawer/components/CancelButton.d.ts +8 -6
  80. package/Drawer/components/ConfirmButton.d.ts +8 -6
  81. package/Drawer/components/DrawerContent.d.ts +1 -1
  82. package/Drawer/components/Icon.d.ts +7 -6
  83. package/DropdownMenu/components/DropdownMenuItem.d.ts +3 -2
  84. package/DropdownMenu/components/DropdownMenuItem.js +9 -2
  85. package/DropdownMenu/components/DropdownMenuItem.js.map +1 -1
  86. package/DropdownMenu/components/DropdownMenuLink.d.ts +9 -8
  87. package/DropdownMenu/components/DropdownMenuSeparator.d.ts +7 -6
  88. package/EditableTitle/EditableTitle.d.ts +7 -6
  89. package/EmptyState/EmptyState.d.ts +43 -0
  90. package/EmptyState/EmptyState.js +93 -0
  91. package/EmptyState/EmptyState.js.map +1 -0
  92. package/EmptyState/EmptyState.stories.d.ts +13 -0
  93. package/EmptyState/EmptyState.stories.js +136 -0
  94. package/EmptyState/EmptyState.stories.js.map +1 -0
  95. package/EmptyState/illustrations/ContentIllustration.d.ts +2 -0
  96. package/EmptyState/illustrations/ContentIllustration.js +100 -0
  97. package/EmptyState/illustrations/ContentIllustration.js.map +1 -0
  98. package/EmptyState/illustrations/LayoutIllustration.d.ts +2 -0
  99. package/EmptyState/illustrations/LayoutIllustration.js +93 -0
  100. package/EmptyState/illustrations/LayoutIllustration.js.map +1 -0
  101. package/EmptyState/illustrations/ListingIllustration.d.ts +2 -0
  102. package/EmptyState/illustrations/ListingIllustration.js +92 -0
  103. package/EmptyState/illustrations/ListingIllustration.js.map +1 -0
  104. package/EmptyState/illustrations/SelectIllustration.d.ts +2 -0
  105. package/EmptyState/illustrations/SelectIllustration.js +100 -0
  106. package/EmptyState/illustrations/SelectIllustration.js.map +1 -0
  107. package/EmptyState/illustrations/TableIllustration.d.ts +2 -0
  108. package/EmptyState/illustrations/TableIllustration.js +233 -0
  109. package/EmptyState/illustrations/TableIllustration.js.map +1 -0
  110. package/EmptyState/illustrations/UploadIllustration.d.ts +2 -0
  111. package/EmptyState/illustrations/UploadIllustration.js +77 -0
  112. package/EmptyState/illustrations/UploadIllustration.js.map +1 -0
  113. package/EmptyState/illustrations/index.d.ts +6 -0
  114. package/EmptyState/illustrations/index.js +6 -0
  115. package/EmptyState/index.d.ts +1 -0
  116. package/EmptyState/index.js +1 -0
  117. package/FilePicker/FilePicker.d.ts +19 -18
  118. package/FilePicker/FilePicker.stories.d.ts +0 -6
  119. package/FilePicker/FilePicker.stories.js +1 -24
  120. package/FilePicker/FilePicker.stories.js.map +1 -1
  121. package/FilePicker/primitives/FilePickerPrimitive.d.ts +20 -19
  122. package/FilePicker/primitives/components/Trigger.d.ts +1 -1
  123. package/FilePicker/primitives/components/previews/ImagePreview/ImagePreview.d.ts +19 -7
  124. package/FilePicker/primitives/components/previews/ImagePreview/ImagePreview.js +15 -6
  125. package/FilePicker/primitives/components/previews/ImagePreview/ImagePreview.js.map +1 -1
  126. package/FilePicker/primitives/components/previews/ItemActions.js +1 -1
  127. package/FilePicker/primitives/components/previews/ItemActions.js.map +1 -1
  128. package/FilePicker/primitives/components/previews/ItemDescription.js +1 -1
  129. package/FilePicker/primitives/components/previews/ItemDescription.js.map +1 -1
  130. package/FilePicker/primitives/components/previews/RichItemPreview/RichItemPreview.d.ts +12 -6
  131. package/FilePicker/primitives/components/previews/RichItemPreview/RichItemPreview.js +13 -52
  132. package/FilePicker/primitives/components/previews/RichItemPreview/RichItemPreview.js.map +1 -1
  133. package/FilePicker/primitives/components/previews/RichItemPreview/RichItemThumbnail.d.ts +8 -4
  134. package/FilePicker/primitives/components/previews/RichItemPreview/RichItemThumbnail.js +66 -8
  135. package/FilePicker/primitives/components/previews/RichItemPreview/RichItemThumbnail.js.map +1 -1
  136. package/FilePicker/primitives/components/previews/TextOnlyPreview/TextOnlyPreview.d.ts +7 -6
  137. package/FilePicker/primitives/components/previews/index.d.ts +0 -1
  138. package/FilePicker/primitives/components/previews/index.js +0 -1
  139. package/FilePicker/primitives/components/previews/variants.d.ts +1 -1
  140. package/FillViewport/FillViewport.d.ts +21 -18
  141. package/FormComponent/Description.d.ts +7 -6
  142. package/FormComponent/ErrorMessage.d.ts +7 -6
  143. package/FormComponent/Label.d.ts +7 -6
  144. package/FormComponent/Note.d.ts +7 -6
  145. package/Grid/Grid.d.ts +24 -22
  146. package/HeaderBar/HeaderBar.d.ts +7 -6
  147. package/Heading/Heading.d.ts +8 -7
  148. package/Icon/Icon.d.ts +9 -8
  149. package/IconPicker/IconPicker.d.ts +7 -6
  150. package/IconPicker/primitives/IconPickerPrimitive.d.ts +1 -1
  151. package/IconPicker/primitives/components/IconPickerTrigger.d.ts +1 -1
  152. package/ImageEditor/AspectRatioPreview.d.ts +16 -0
  153. package/ImageEditor/AspectRatioPreview.js +26 -0
  154. package/ImageEditor/AspectRatioPreview.js.map +1 -0
  155. package/ImageEditor/CropHotspotEditor.d.ts +22 -0
  156. package/ImageEditor/CropHotspotEditor.js +402 -0
  157. package/ImageEditor/CropHotspotEditor.js.map +1 -0
  158. package/ImageEditor/ImageEditor.d.ts +18 -0
  159. package/ImageEditor/ImageEditor.js +151 -0
  160. package/ImageEditor/ImageEditor.js.map +1 -0
  161. package/ImageEditor/ImageEditor.stories.d.ts +6 -0
  162. package/ImageEditor/ImageEditor.stories.js +42 -0
  163. package/ImageEditor/ImageEditor.stories.js.map +1 -0
  164. package/ImageEditor/MetaFields.d.ts +12 -0
  165. package/ImageEditor/MetaFields.js +20 -0
  166. package/ImageEditor/MetaFields.js.map +1 -0
  167. package/ImageEditor/SectionLabel.d.ts +8 -0
  168. package/ImageEditor/SectionLabel.js +7 -0
  169. package/ImageEditor/SectionLabel.js.map +1 -0
  170. package/ImageEditor/geometry.d.ts +46 -0
  171. package/ImageEditor/geometry.js +126 -0
  172. package/ImageEditor/geometry.js.map +1 -0
  173. package/ImageEditor/index.d.ts +3 -0
  174. package/ImageEditor/index.js +3 -0
  175. package/ImageEditor/types.d.ts +52 -0
  176. package/ImageEditor/types.js +35 -0
  177. package/ImageEditor/types.js.map +1 -0
  178. package/Input/Input.d.ts +7 -6
  179. package/Input/InputPrimitive.d.ts +9 -8
  180. package/Label/Label.d.ts +8 -7
  181. package/Label/components/LabelValue.d.ts +1 -1
  182. package/Link/Link.d.ts +3 -3
  183. package/Link/Link.js +1 -1
  184. package/Link/Link.js.map +1 -1
  185. package/List/List.d.ts +8 -7
  186. package/List/components/ListItem.d.ts +7 -6
  187. package/List/components/ListItemAction.d.ts +7 -6
  188. package/List/components/ListItemHandle.d.ts +7 -6
  189. package/List/components/ListItemIcon.d.ts +7 -6
  190. package/List/components/ListItemSeparator.d.ts +7 -6
  191. package/Loader/Loader.d.ts +9 -8
  192. package/Loader/OverlayLoader.d.ts +7 -6
  193. package/Markdown/Markdown.d.ts +47 -0
  194. package/Markdown/Markdown.js +17 -0
  195. package/Markdown/Markdown.js.map +1 -0
  196. package/Markdown/index.d.ts +1 -0
  197. package/Markdown/index.js +1 -0
  198. package/MultiAutoComplete/MultiAutoComplete.d.ts +7 -6
  199. package/MultiAutoComplete/primitives/MultiAutoCompletePrimitive.d.ts +7 -6
  200. package/MultiAutoComplete/primitives/presenters/MultiAutoCompletePresenterWithFreeInput.d.ts +3 -3
  201. package/MultiAutoComplete/primitives/useMultiAutoComplete.d.ts +3 -3
  202. package/MultiFilePicker/MultiFilePicker.d.ts +19 -18
  203. package/MultiFilePicker/primitives/MultiFilePickerPrimitive.d.ts +19 -18
  204. package/MultiSelect/MultiSelect.d.ts +7 -6
  205. package/MultiSelect/primitives/MultiSelectPrimitive.d.ts +10 -6
  206. package/MultiSelect/primitives/MultiSelectPrimitive.js +1 -1
  207. package/MultiSelect/primitives/MultiSelectPrimitive.js.map +1 -1
  208. package/Popover/Popover.d.ts +7 -6
  209. package/Popover/primitives/PopoverPrimitive.d.ts +7 -7
  210. package/ProgressBar/ProgressBar.d.ts +7 -6
  211. package/RadioGroup/RadioGroup.d.ts +7 -6
  212. package/RadioGroup/primitives/Radio.d.ts +7 -6
  213. package/RadioGroup/primitives/RadioGroupPrimitive.d.ts +5 -1
  214. package/RangeSlider/RangeSlider.d.ts +7 -6
  215. package/SegmentedControl/SegmentedControl.d.ts +8 -7
  216. package/SegmentedControl/SegmentedControlTabs.d.ts +5 -2
  217. package/SegmentedControl/primitives/SegmentedControlPrimitive.d.ts +1 -1
  218. package/Select/Select.d.ts +7 -6
  219. package/Select/primitives/components/SelectContent.js +1 -1
  220. package/Select/primitives/components/SelectContent.js.map +1 -1
  221. package/Select/primitives/components/SelectTrigger.d.ts +2 -2
  222. package/Separator/Separator.d.ts +9 -8
  223. package/Sidebar/Sidebar.d.ts +7 -6
  224. package/Sidebar/components/SidebarContent.js +1 -1
  225. package/Sidebar/components/SidebarContent.js.map +1 -1
  226. package/Sidebar/components/SidebarIcon.d.ts +7 -6
  227. package/Sidebar/components/SidebarProvider.d.ts +4 -4
  228. package/Sidebar/components/SidebarRoot.js +1 -1
  229. package/Sidebar/components/SidebarRoot.js.map +1 -1
  230. package/Sidebar/components/items/SidebarMenuGroup.d.ts +9 -8
  231. package/Sidebar/components/items/SidebarMenuItem.d.ts +11 -10
  232. package/Sidebar/components/items/SidebarMenuItemIcon.d.ts +7 -6
  233. package/Sidebar/components/items/SidebarMenuLink.d.ts +11 -10
  234. package/Sidebar/components/items/SidebarMenuProvider.d.ts +4 -4
  235. package/Sidebar/components/items/SidebarMenuRootItem.d.ts +9 -7
  236. package/Sidebar/components/items/SidebarMenuSubButton.js +5 -8
  237. package/Sidebar/components/items/SidebarMenuSubButton.js.map +1 -1
  238. package/Sidebar/components/items/SidebarMenuSubItem.js +3 -3
  239. package/Sidebar/components/items/SidebarMenuSubItem.js.map +1 -1
  240. package/Skeleton/Skeleton.d.ts +9 -7
  241. package/Skeleton/Skeleton.js +10 -4
  242. package/Skeleton/Skeleton.js.map +1 -1
  243. package/Skeleton/Skeleton.stories.d.ts +2 -0
  244. package/Skeleton/Skeleton.stories.js +28 -2
  245. package/Skeleton/Skeleton.stories.js.map +1 -1
  246. package/Slider/Slider.d.ts +7 -6
  247. package/SteppedProgress/SteppedProgress.d.ts +7 -6
  248. package/SteppedProgress/SteppedProgressItem.d.ts +7 -6
  249. package/Switch/Switch.d.ts +7 -6
  250. package/Switch/primitives/SwitchPrimitive.d.ts +10 -6
  251. package/Table/Table.d.ts +12 -10
  252. package/Table/components/Direction.d.ts +1 -1
  253. package/Tabs/Tabs.d.ts +8 -6
  254. package/Tabs/Tabs.js +5 -2
  255. package/Tabs/Tabs.js.map +1 -1
  256. package/Tabs/components/Content.d.ts +1 -1
  257. package/Tabs/components/List.d.ts +2 -2
  258. package/Tabs/components/Tab.d.ts +7 -6
  259. package/Tabs/components/Trigger.d.ts +3 -2
  260. package/Tabs/components/Trigger.js +8 -3
  261. package/Tabs/components/Trigger.js.map +1 -1
  262. package/Tag/Tag.d.ts +8 -7
  263. package/Tags/Tags.d.ts +7 -6
  264. package/Tags/primitives/TagsPrimitive.d.ts +7 -6
  265. package/Text/Text.d.ts +8 -7
  266. package/Textarea/Textarea.d.ts +7 -6
  267. package/Textarea/TextareaPrimitive.d.ts +9 -8
  268. package/Toast/Toast.d.ts +7 -6
  269. package/Toast/components/ToastActions.d.ts +7 -6
  270. package/Toast/components/ToastDescription.d.ts +7 -6
  271. package/Toast/components/ToastTitle.d.ts +7 -6
  272. package/Toast/useToast.stories.js.map +1 -1
  273. package/Toggle/Toggle.d.ts +7 -6
  274. package/Toggle/primitives/TogglePrimitive.d.ts +13 -9
  275. package/ToggleGroup/ToggleGroup.d.ts +7 -6
  276. package/ToggleGroup/primitives/ToggleGroupPrimitive.d.ts +13 -9
  277. package/Tooltip/Tooltip.d.ts +7 -6
  278. package/Tree/Tree.d.ts +7 -6
  279. package/Tree/components/Item.d.ts +7 -6
  280. package/Tree/components/ItemCollapseTrigger.d.ts +7 -6
  281. package/Tree/components/ItemContent.d.ts +8 -6
  282. package/Tree/components/ItemDragHandle.d.ts +7 -6
  283. package/Tree/components/ItemIcon.d.ts +7 -6
  284. package/Tree/components/ItemPlaceholder.d.ts +7 -6
  285. package/Tree/components/ItemSubIndentation.d.ts +7 -6
  286. package/Tree/useTree.js +2 -6
  287. package/Tree/useTree.js.map +1 -1
  288. package/Widget/Widget.d.ts +8 -22
  289. package/Widget/components/Icon.d.ts +7 -6
  290. package/Widget/components/WidgetAction.d.ts +8 -6
  291. package/Widget/components/WidgetContent.d.ts +5 -5
  292. package/exports/admin/ui.d.ts +2 -0
  293. package/exports/admin/ui.js +2 -0
  294. package/index.d.ts +5 -0
  295. package/index.js +5 -0
  296. package/package.json +29 -29
  297. package/theme.css +22 -1
  298. package/utils.js +52 -34
  299. package/utils.js.map +1 -1
  300. package/FilePicker/primitives/components/previews/RichItemPreview/FileType.d.ts +0 -9
  301. package/FilePicker/primitives/components/previews/RichItemPreview/FileType.js +0 -45
  302. package/FilePicker/primitives/components/previews/RichItemPreview/FileType.js.map +0 -1
  303. package/FilePicker/primitives/components/previews/RichItemPreview/Placeholder.d.ts +0 -8
  304. package/FilePicker/primitives/components/previews/RichItemPreview/Placeholder.js +0 -14
  305. package/FilePicker/primitives/components/previews/RichItemPreview/Placeholder.js.map +0 -1
  306. package/FilePicker/primitives/components/previews/RichItemPreview/Thumbnail.d.ts +0 -11
  307. package/FilePicker/primitives/components/previews/RichItemPreview/Thumbnail.js +0 -20
  308. package/FilePicker/primitives/components/previews/RichItemPreview/Thumbnail.js.map +0 -1
  309. package/FilePicker/primitives/components/previews/RichItemPreview/ThumbnailActions.d.ts +0 -15
  310. package/FilePicker/primitives/components/previews/RichItemPreview/ThumbnailActions.js +0 -46
  311. package/FilePicker/primitives/components/previews/RichItemPreview/ThumbnailActions.js.map +0 -1
  312. package/FilePicker/primitives/components/previews/TruncatedFileName.d.ts +0 -11
  313. package/FilePicker/primitives/components/previews/TruncatedFileName.js +0 -20
  314. package/FilePicker/primitives/components/previews/TruncatedFileName.js.map +0 -1
  315. package/FilePicker/primitives/components/previews/fileName.d.ts +0 -12
  316. package/FilePicker/primitives/components/previews/fileName.js +0 -26
  317. package/FilePicker/primitives/components/previews/fileName.js.map +0 -1
@@ -6,7 +6,7 @@ import { FileItem, type FileItemDto, type FileItemFormatted } from "../domains/i
6
6
  import type { FilePreviewRendererProps, TriggerRendererProps } from "./components/types.js";
7
7
  declare const filePickerVariants: (props?: ({
8
8
  type?: "area" | "compact" | null | undefined;
9
- variant?: "primary" | "secondary" | "ghost" | null | undefined;
9
+ variant?: "ghost" | "primary" | "secondary" | null | undefined;
10
10
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
11
11
  interface FilePickerPrimitiveProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof filePickerVariants> {
12
12
  /**
@@ -63,60 +63,61 @@ interface FilePickerPrimitiveProps extends React.HTMLAttributes<HTMLDivElement>,
63
63
  */
64
64
  value?: FileItemDto | string | null;
65
65
  }
66
- declare const FilePickerPrimitive: (({ className, containerStyle, description, disabled, invalid, label, onEditItem, onRemoveItem, onSelectItem, placeholder, renderFilePreview, renderTrigger, type, value, variant }: FilePickerPrimitiveProps) => React.JSX.Element) & {
67
- original: ({ className, containerStyle, description, disabled, invalid, label, onEditItem, onRemoveItem, onSelectItem, placeholder, renderFilePreview, renderTrigger, type, value, variant }: FilePickerPrimitiveProps) => React.JSX.Element;
66
+ declare const BaseFilePickerPrimitive: ({ className, containerStyle, description, disabled, invalid, label, onEditItem, onRemoveItem, onSelectItem, placeholder, renderFilePreview, renderTrigger, type, value, variant }: FilePickerPrimitiveProps) => React.JSX.Element;
67
+ declare const FilePickerPrimitive: typeof BaseFilePickerPrimitive & {
68
+ original: typeof BaseFilePickerPrimitive;
68
69
  originalName: string;
69
70
  displayName: string;
70
71
  } & {
71
- original: (({ className, containerStyle, description, disabled, invalid, label, onEditItem, onRemoveItem, onSelectItem, placeholder, renderFilePreview, renderTrigger, type, value, variant }: FilePickerPrimitiveProps) => React.JSX.Element) & {
72
- original: ({ className, containerStyle, description, disabled, invalid, label, onEditItem, onRemoveItem, onSelectItem, placeholder, renderFilePreview, renderTrigger, type, value, variant }: FilePickerPrimitiveProps) => React.JSX.Element;
72
+ original: typeof BaseFilePickerPrimitive & {
73
+ original: typeof BaseFilePickerPrimitive;
73
74
  originalName: string;
74
75
  displayName: string;
75
76
  };
76
77
  originalName: string;
77
78
  displayName: string;
78
79
  } & {
79
- createDecorator: (decorator: import("@webiny/react-composition/types.js").ComponentDecorator<(({ className, containerStyle, description, disabled, invalid, label, onEditItem, onRemoveItem, onSelectItem, placeholder, renderFilePreview, renderTrigger, type, value, variant }: FilePickerPrimitiveProps) => React.JSX.Element) & {
80
- original: ({ className, containerStyle, description, disabled, invalid, label, onEditItem, onRemoveItem, onSelectItem, placeholder, renderFilePreview, renderTrigger, type, value, variant }: FilePickerPrimitiveProps) => React.JSX.Element;
80
+ createDecorator: (decorator: import("@webiny/react-composition/types.js").ComponentDecorator<typeof BaseFilePickerPrimitive & {
81
+ original: typeof BaseFilePickerPrimitive;
81
82
  originalName: string;
82
83
  displayName: string;
83
84
  }>) => (props: unknown) => React.JSX.Element;
84
85
  } & {
85
86
  Preview: {
86
- Image: (({ value, className, variant, disabled, onRemoveItem, onReplaceItem, onEditItem }: import("./index.js").ImagePreviewProps) => React.JSX.Element) & {
87
- original: ({ value, className, variant, disabled, onRemoveItem, onReplaceItem, onEditItem }: import("./index.js").ImagePreviewProps) => React.JSX.Element;
87
+ Image: (({ value, className, variant, disabled, onRemoveItem, onReplaceItem, onEditItem, renderImage }: import("./index.js").ImagePreviewProps) => React.JSX.Element) & {
88
+ original: ({ value, className, variant, disabled, onRemoveItem, onReplaceItem, onEditItem, renderImage }: import("./index.js").ImagePreviewProps) => React.JSX.Element;
88
89
  originalName: string;
89
90
  displayName: string;
90
91
  } & {
91
- original: (({ value, className, variant, disabled, onRemoveItem, onReplaceItem, onEditItem }: import("./index.js").ImagePreviewProps) => React.JSX.Element) & {
92
- original: ({ value, className, variant, disabled, onRemoveItem, onReplaceItem, onEditItem }: import("./index.js").ImagePreviewProps) => React.JSX.Element;
92
+ original: (({ value, className, variant, disabled, onRemoveItem, onReplaceItem, onEditItem, renderImage }: import("./index.js").ImagePreviewProps) => React.JSX.Element) & {
93
+ original: ({ value, className, variant, disabled, onRemoveItem, onReplaceItem, onEditItem, renderImage }: import("./index.js").ImagePreviewProps) => React.JSX.Element;
93
94
  originalName: string;
94
95
  displayName: string;
95
96
  };
96
97
  originalName: string;
97
98
  displayName: string;
98
99
  } & {
99
- createDecorator: (decorator: import("@webiny/react-composition/types.js").ComponentDecorator<(({ value, className, variant, disabled, onRemoveItem, onReplaceItem, onEditItem }: import("./index.js").ImagePreviewProps) => React.JSX.Element) & {
100
- original: ({ value, className, variant, disabled, onRemoveItem, onReplaceItem, onEditItem }: import("./index.js").ImagePreviewProps) => React.JSX.Element;
100
+ createDecorator: (decorator: import("@webiny/react-composition/types.js").ComponentDecorator<(({ value, className, variant, disabled, onRemoveItem, onReplaceItem, onEditItem, renderImage }: import("./index.js").ImagePreviewProps) => React.JSX.Element) & {
101
+ original: ({ value, className, variant, disabled, onRemoveItem, onReplaceItem, onEditItem, renderImage }: import("./index.js").ImagePreviewProps) => React.JSX.Element;
101
102
  originalName: string;
102
103
  displayName: string;
103
104
  }>) => (props: unknown) => React.JSX.Element;
104
105
  };
105
- RichItem: (({ className, disabled, onRemoveItem, onReplaceItem, onEditItem, value, variant, preview, ...props }: import("./index.js").RichItemPreviewProps) => React.JSX.Element) & {
106
- original: ({ className, disabled, onRemoveItem, onReplaceItem, onEditItem, value, variant, preview, ...props }: import("./index.js").RichItemPreviewProps) => React.JSX.Element;
106
+ RichItem: (({ className, disabled, onRemoveItem, onReplaceItem, onEditItem, value, variant, preview, renderImage, ...props }: import("./index.js").RichItemPreviewProps) => React.JSX.Element) & {
107
+ original: ({ className, disabled, onRemoveItem, onReplaceItem, onEditItem, value, variant, preview, renderImage, ...props }: import("./index.js").RichItemPreviewProps) => React.JSX.Element;
107
108
  originalName: string;
108
109
  displayName: string;
109
110
  } & {
110
- original: (({ className, disabled, onRemoveItem, onReplaceItem, onEditItem, value, variant, preview, ...props }: import("./index.js").RichItemPreviewProps) => React.JSX.Element) & {
111
- original: ({ className, disabled, onRemoveItem, onReplaceItem, onEditItem, value, variant, preview, ...props }: import("./index.js").RichItemPreviewProps) => React.JSX.Element;
111
+ original: (({ className, disabled, onRemoveItem, onReplaceItem, onEditItem, value, variant, preview, renderImage, ...props }: import("./index.js").RichItemPreviewProps) => React.JSX.Element) & {
112
+ original: ({ className, disabled, onRemoveItem, onReplaceItem, onEditItem, value, variant, preview, renderImage, ...props }: import("./index.js").RichItemPreviewProps) => React.JSX.Element;
112
113
  originalName: string;
113
114
  displayName: string;
114
115
  };
115
116
  originalName: string;
116
117
  displayName: string;
117
118
  } & {
118
- createDecorator: (decorator: import("@webiny/react-composition/types.js").ComponentDecorator<(({ className, disabled, onRemoveItem, onReplaceItem, onEditItem, value, variant, preview, ...props }: import("./index.js").RichItemPreviewProps) => React.JSX.Element) & {
119
- original: ({ className, disabled, onRemoveItem, onReplaceItem, onEditItem, value, variant, preview, ...props }: import("./index.js").RichItemPreviewProps) => React.JSX.Element;
119
+ createDecorator: (decorator: import("@webiny/react-composition/types.js").ComponentDecorator<(({ className, disabled, onRemoveItem, onReplaceItem, onEditItem, value, variant, preview, renderImage, ...props }: import("./index.js").RichItemPreviewProps) => React.JSX.Element) & {
120
+ original: ({ className, disabled, onRemoveItem, onReplaceItem, onEditItem, value, variant, preview, renderImage, ...props }: import("./index.js").RichItemPreviewProps) => React.JSX.Element;
120
121
  originalName: string;
121
122
  displayName: string;
122
123
  }>) => (props: unknown) => React.JSX.Element;
@@ -3,7 +3,7 @@ import { type VariantProps } from "../../../utils.js";
3
3
  import type { TriggerDefaultProps } from "../../../FilePicker/primitives/components/types.js";
4
4
  declare const triggerVariants: (props?: ({
5
5
  type?: "area" | "compact" | null | undefined;
6
- variant?: "primary" | "secondary" | "ghost" | null | undefined;
6
+ variant?: "ghost" | "primary" | "secondary" | null | undefined;
7
7
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
8
8
  interface TriggerProps extends TriggerDefaultProps, VariantProps<typeof triggerVariants> {
9
9
  renderTrigger?: (props: any) => React.ReactElement<any>;
@@ -1,21 +1,33 @@
1
1
  import React from "react";
2
2
  import type { FilePreviewDefaultProps } from "../../types.js";
3
- type ImagePreviewProps = FilePreviewDefaultProps;
4
- declare const ImagePreview: (({ value, className, variant, disabled, onRemoveItem, onReplaceItem, onEditItem }: ImagePreviewProps) => React.JSX.Element) & {
5
- original: ({ value, className, variant, disabled, onRemoveItem, onReplaceItem, onEditItem }: ImagePreviewProps) => React.JSX.Element;
3
+ type ImagePreviewProps = FilePreviewDefaultProps & {
4
+ /**
5
+ * Optional custom image renderer. Lets a consumer render, e.g., a cropped /
6
+ * focal-point-aware thumbnail while keeping all of the preview chrome. When
7
+ * omitted (or it returns a falsy value) a plain `<img>` is rendered.
8
+ */
9
+ renderImage?: (args: {
10
+ url: string;
11
+ name: string;
12
+ className: string;
13
+ }) => React.ReactNode;
14
+ };
15
+ declare const DecoratableImagePreview: ({ value, className, variant, disabled, onRemoveItem, onReplaceItem, onEditItem, renderImage }: ImagePreviewProps) => React.JSX.Element;
16
+ declare const ImagePreview: typeof DecoratableImagePreview & {
17
+ original: typeof DecoratableImagePreview;
6
18
  originalName: string;
7
19
  displayName: string;
8
20
  } & {
9
- original: (({ value, className, variant, disabled, onRemoveItem, onReplaceItem, onEditItem }: ImagePreviewProps) => React.JSX.Element) & {
10
- original: ({ value, className, variant, disabled, onRemoveItem, onReplaceItem, onEditItem }: ImagePreviewProps) => React.JSX.Element;
21
+ original: typeof DecoratableImagePreview & {
22
+ original: typeof DecoratableImagePreview;
11
23
  originalName: string;
12
24
  displayName: string;
13
25
  };
14
26
  originalName: string;
15
27
  displayName: string;
16
28
  } & {
17
- createDecorator: (decorator: import("@webiny/react-composition/types.js").ComponentDecorator<(({ value, className, variant, disabled, onRemoveItem, onReplaceItem, onEditItem }: ImagePreviewProps) => React.JSX.Element) & {
18
- original: ({ value, className, variant, disabled, onRemoveItem, onReplaceItem, onEditItem }: ImagePreviewProps) => React.JSX.Element;
29
+ createDecorator: (decorator: import("@webiny/react-composition/types.js").ComponentDecorator<typeof DecoratableImagePreview & {
30
+ original: typeof DecoratableImagePreview;
19
31
  originalName: string;
20
32
  displayName: string;
21
33
  }>) => (props: unknown) => React.JSX.Element;
@@ -2,7 +2,19 @@ import react from "react";
2
2
  import { cn, makeDecoratable } from "../../../../../utils.js";
3
3
  import { previewVariants } from "../variants.js";
4
4
  import { ItemActions } from "../ItemActions.js";
5
- const DecoratableImagePreview = ({ value, className, variant, disabled, onRemoveItem, onReplaceItem, onEditItem })=>/*#__PURE__*/ react.createElement("div", {
5
+ const IMAGE_CLASS = "object-contain size-full";
6
+ const DecoratableImagePreview = ({ value, className, variant, disabled, onRemoveItem, onReplaceItem, onEditItem, renderImage })=>{
7
+ let image = /*#__PURE__*/ react.createElement("img", {
8
+ src: value.url,
9
+ alt: value.name,
10
+ className: IMAGE_CLASS
11
+ });
12
+ if ("function" == typeof renderImage) image = renderImage({
13
+ url: value.url,
14
+ name: value.name,
15
+ className: IMAGE_CLASS
16
+ });
17
+ return /*#__PURE__*/ react.createElement("div", {
6
18
  className: cn("flex justify-center items-center py-sm rounded-md relative", previewVariants({
7
19
  variant
8
20
  }), className),
@@ -11,11 +23,7 @@ const DecoratableImagePreview = ({ value, className, variant, disabled, onRemove
11
23
  className: "cursor-pointer size-[128px] flex justify-center items-center",
12
24
  "data-role": "select-image",
13
25
  onClick: onReplaceItem
14
- }, /*#__PURE__*/ react.createElement("img", {
15
- src: value.url,
16
- alt: value.name,
17
- className: "object-contain size-full"
18
- })), /*#__PURE__*/ react.createElement("div", {
26
+ }, image), /*#__PURE__*/ react.createElement("div", {
19
27
  className: "absolute top-1 right-1.5"
20
28
  }, /*#__PURE__*/ react.createElement(ItemActions, {
21
29
  onRemoveItem: onRemoveItem,
@@ -23,6 +31,7 @@ const DecoratableImagePreview = ({ value, className, variant, disabled, onRemove
23
31
  disabled: disabled,
24
32
  className: "flex-col"
25
33
  })));
34
+ };
26
35
  const ImagePreview = makeDecoratable("FileImagePreview", DecoratableImagePreview);
27
36
  export { ImagePreview };
28
37
 
@@ -1 +1 @@
1
- {"version":3,"file":"FilePicker/primitives/components/previews/ImagePreview/ImagePreview.js","sources":["../../../../../../src/FilePicker/primitives/components/previews/ImagePreview/ImagePreview.tsx"],"sourcesContent":["import React from \"react\";\nimport { cn, makeDecoratable } from \"~/utils.js\";\nimport { previewVariants } from \"../variants.js\";\nimport type { FilePreviewDefaultProps } from \"../../types.js\";\nimport { ItemActions } from \"~/FilePicker/primitives/components/previews/ItemActions.js\";\n\ntype ImagePreviewProps = FilePreviewDefaultProps;\n\nconst DecoratableImagePreview = ({\n value,\n className,\n variant,\n disabled,\n onRemoveItem,\n onReplaceItem,\n onEditItem\n}: ImagePreviewProps) => {\n return (\n <div\n className={cn(\n \"flex justify-center items-center py-sm rounded-md relative\",\n previewVariants({ variant }),\n className\n )}\n data-testid={\"image-preview\"}\n >\n <div\n className={\"cursor-pointer size-[128px] flex justify-center items-center\"}\n data-role={\"select-image\"}\n onClick={onReplaceItem}\n >\n <img src={value.url} alt={value.name} className={\"object-contain size-full\"} />\n </div>\n <div className={\"absolute top-1 right-1.5\"}>\n <ItemActions\n onRemoveItem={onRemoveItem}\n onEditItem={onEditItem}\n disabled={disabled}\n className={\"flex-col\"}\n />\n </div>\n </div>\n );\n};\n\nconst ImagePreview = makeDecoratable(\"FileImagePreview\", DecoratableImagePreview);\n\nexport { ImagePreview, type ImagePreviewProps };\n"],"names":["DecoratableImagePreview","value","className","variant","disabled","onRemoveItem","onReplaceItem","onEditItem","cn","previewVariants","ItemActions","ImagePreview","makeDecoratable"],"mappings":";;;;AAQA,MAAMA,0BAA0B,CAAC,EAC7BC,KAAK,EACLC,SAAS,EACTC,OAAO,EACPC,QAAQ,EACRC,YAAY,EACZC,aAAa,EACbC,UAAU,EACM,GACT,WAAP,GACI,oBAAC;QACG,WAAWC,GACP,8DACAC,gBAAgB;YAAEN;QAAQ,IAC1BD;QAEJ,eAAa;qBAEb,oBAAC;QACG,WAAW;QACX,aAAW;QACX,SAASI;qBAET,oBAAC;QAAI,KAAKL,MAAM,GAAG;QAAE,KAAKA,MAAM,IAAI;QAAE,WAAW;uBAErD,oBAAC;QAAI,WAAW;qBACZ,oBAACS,aAAWA;QACR,cAAcL;QACd,YAAYE;QACZ,UAAUH;QACV,WAAW;;AAO/B,MAAMO,eAAeC,gBAAgB,oBAAoBZ"}
1
+ {"version":3,"file":"FilePicker/primitives/components/previews/ImagePreview/ImagePreview.js","sources":["../../../../../../src/FilePicker/primitives/components/previews/ImagePreview/ImagePreview.tsx"],"sourcesContent":["import React from \"react\";\nimport { cn, makeDecoratable } from \"~/utils.js\";\nimport { previewVariants } from \"../variants.js\";\nimport type { FilePreviewDefaultProps } from \"../../types.js\";\nimport { ItemActions } from \"~/FilePicker/primitives/components/previews/ItemActions.js\";\n\ntype ImagePreviewProps = FilePreviewDefaultProps & {\n /**\n * Optional custom image renderer. Lets a consumer render, e.g., a cropped /\n * focal-point-aware thumbnail while keeping all of the preview chrome. When\n * omitted (or it returns a falsy value) a plain `<img>` is rendered.\n */\n renderImage?: (args: { url: string; name: string; className: string }) => React.ReactNode;\n};\n\nconst IMAGE_CLASS = \"object-contain size-full\";\n\nconst DecoratableImagePreview = ({\n value,\n className,\n variant,\n disabled,\n onRemoveItem,\n onReplaceItem,\n onEditItem,\n renderImage\n}: ImagePreviewProps) => {\n let image: React.ReactElement | React.ReactNode = (\n <img src={value.url} alt={value.name} className={IMAGE_CLASS} />\n );\n\n if (typeof renderImage === \"function\") {\n image = renderImage({ url: value.url, name: value.name, className: IMAGE_CLASS });\n }\n\n return (\n <div\n className={cn(\n \"flex justify-center items-center py-sm rounded-md relative\",\n previewVariants({ variant }),\n className\n )}\n data-testid={\"image-preview\"}\n >\n <div\n className={\"cursor-pointer size-[128px] flex justify-center items-center\"}\n data-role={\"select-image\"}\n onClick={onReplaceItem}\n >\n {image}\n </div>\n <div className={\"absolute top-1 right-1.5\"}>\n <ItemActions\n onRemoveItem={onRemoveItem}\n onEditItem={onEditItem}\n disabled={disabled}\n className={\"flex-col\"}\n />\n </div>\n </div>\n );\n};\n\nconst ImagePreview = makeDecoratable(\"FileImagePreview\", DecoratableImagePreview);\n\nexport { ImagePreview, type ImagePreviewProps };\n"],"names":["IMAGE_CLASS","DecoratableImagePreview","value","className","variant","disabled","onRemoveItem","onReplaceItem","onEditItem","renderImage","image","cn","previewVariants","ItemActions","ImagePreview","makeDecoratable"],"mappings":";;;;AAeA,MAAMA,cAAc;AAEpB,MAAMC,0BAA0B,CAAC,EAC7BC,KAAK,EACLC,SAAS,EACTC,OAAO,EACPC,QAAQ,EACRC,YAAY,EACZC,aAAa,EACbC,UAAU,EACVC,WAAW,EACK;IAChB,IAAIC,QAAAA,WAAAA,GACA,oBAAC;QAAI,KAAKR,MAAM,GAAG;QAAE,KAAKA,MAAM,IAAI;QAAE,WAAWF;;IAGrD,IAAI,AAAuB,cAAvB,OAAOS,aACPC,QAAQD,YAAY;QAAE,KAAKP,MAAM,GAAG;QAAE,MAAMA,MAAM,IAAI;QAAE,WAAWF;IAAY;IAGnF,OAAO,WAAP,GACI,oBAAC;QACG,WAAWW,GACP,8DACAC,gBAAgB;YAAER;QAAQ,IAC1BD;QAEJ,eAAa;qBAEb,oBAAC;QACG,WAAW;QACX,aAAW;QACX,SAASI;OAERG,QAAAA,WAAAA,GAEL,oBAAC;QAAI,WAAW;qBACZ,oBAACG,aAAWA;QACR,cAAcP;QACd,YAAYE;QACZ,UAAUH;QACV,WAAW;;AAK/B;AAEA,MAAMS,eAAeC,gBAAgB,oBAAoBd"}
@@ -11,7 +11,7 @@ const ItemActions = ({ disabled, onRemoveItem, onEditItem, onReplaceItem, small,
11
11
  return /*#__PURE__*/ react.createElement("div", {
12
12
  ...props,
13
13
  className: cn("flex justify-center items-center gap-xs", className)
14
- }, onReplaceItem && /*#__PURE__*/ react.createElement(IconButton, {
14
+ }, small && onReplaceItem && /*#__PURE__*/ react.createElement(IconButton, {
15
15
  icon: /*#__PURE__*/ react.createElement(Icon, {
16
16
  icon: /*#__PURE__*/ react.createElement(ReactComponent, null),
17
17
  label: "Replace",
@@ -1 +1 @@
1
- {"version":3,"file":"FilePicker/primitives/components/previews/ItemActions.js","sources":["../../../../../src/FilePicker/primitives/components/previews/ItemActions.tsx"],"sourcesContent":["import React from \"react\";\nimport { ReactComponent as ReplaceIcon } from \"@webiny/icons/file_upload.svg\";\nimport { ReactComponent as EditIcon } from \"@webiny/icons/edit.svg\";\nimport { ReactComponent as TrashIcon } from \"@webiny/icons/delete.svg\";\nimport { IconButton } from \"~/Button/index.js\";\nimport { Icon } from \"~/Icon/index.js\";\nimport { cn } from \"~/utils.js\";\n\ninterface ItemActionsProps extends React.HTMLAttributes<HTMLDivElement> {\n onRemoveItem?: () => void;\n onEditItem?: () => void;\n onReplaceItem?: () => void;\n disabled?: boolean;\n small?: boolean;\n}\n\nconst ItemActions = ({\n disabled,\n onRemoveItem,\n onEditItem,\n onReplaceItem,\n small,\n className,\n ...props\n}: ItemActionsProps) => {\n const iconSize = small ? \"default\" : \"lg\";\n const buttonSize = small ? \"xs\" : \"sm\";\n\n return (\n <div {...props} className={cn(\"flex justify-center items-center gap-xs\", className)}>\n {/* Replace is the action a populated picker mainly exists for, and it was only ever\n shown in the `small` layout - elsewhere it hid behind clicking the thumbnail. */}\n {onReplaceItem && (\n <IconButton\n icon={\n <Icon\n icon={<ReplaceIcon />}\n label={\"Replace\"}\n size={\"md\"}\n color={\"neutral-light\"}\n />\n }\n variant={\"ghost\"}\n size={buttonSize}\n iconSize={iconSize}\n onClick={onReplaceItem}\n disabled={disabled}\n />\n )}\n\n {onEditItem && (\n <IconButton\n icon={\n <Icon\n icon={<EditIcon />}\n label={\"Edit\"}\n size={\"md\"}\n color={\"neutral-light\"}\n />\n }\n variant={\"ghost\"}\n size={buttonSize}\n iconSize={iconSize}\n onClick={onEditItem}\n disabled={disabled}\n />\n )}\n\n {onRemoveItem && (\n <IconButton\n icon={\n <Icon\n icon={<TrashIcon />}\n label={\"Remove\"}\n size={\"md\"}\n color={\"neutral-light\"}\n />\n }\n variant={\"ghost\"}\n size={buttonSize}\n iconSize={iconSize}\n onClick={onRemoveItem}\n disabled={disabled}\n />\n )}\n </div>\n );\n};\n\nexport { ItemActions, type ItemActionsProps };\n"],"names":["ItemActions","disabled","onRemoveItem","onEditItem","onReplaceItem","small","className","props","iconSize","buttonSize","cn","IconButton","Icon","ReplaceIcon","EditIcon","TrashIcon"],"mappings":";;;;;;;AAgBA,MAAMA,cAAc,CAAC,EACjBC,QAAQ,EACRC,YAAY,EACZC,UAAU,EACVC,aAAa,EACbC,KAAK,EACLC,SAAS,EACT,GAAGC,OACY;IACf,MAAMC,WAAWH,QAAQ,YAAY;IACrC,MAAMI,aAAaJ,QAAQ,OAAO;IAElC,OAAO,WAAP,GACI,oBAAC;QAAK,GAAGE,KAAK;QAAE,WAAWG,GAAG,2CAA2CJ;OAGpEF,iBAAiB,WAAjBA,GACG,oBAACO,YAAUA;QACP,oBACI,oBAACC,MAAIA;YACD,oBAAM,oBAACC,gBAAWA;YAClB,OAAO;YACP,MAAM;YACN,OAAO;;QAGf,SAAS;QACT,MAAMJ;QACN,UAAUD;QACV,SAASJ;QACT,UAAUH;QAIjBE,cAAc,WAAdA,GACG,oBAACQ,YAAUA;QACP,oBACI,oBAACC,MAAIA;YACD,oBAAM,oBAACE,yBAAQA;YACf,OAAO;YACP,MAAM;YACN,OAAO;;QAGf,SAAS;QACT,MAAML;QACN,UAAUD;QACV,SAASL;QACT,UAAUF;QAIjBC,gBAAgB,WAAhBA,GACG,oBAACS,YAAUA;QACP,oBACI,oBAACC,MAAIA;YACD,oBAAM,oBAACG,2BAASA;YAChB,OAAO;YACP,MAAM;YACN,OAAO;;QAGf,SAAS;QACT,MAAMN;QACN,UAAUD;QACV,SAASN;QACT,UAAUD;;AAK9B"}
1
+ {"version":3,"file":"FilePicker/primitives/components/previews/ItemActions.js","sources":["../../../../../src/FilePicker/primitives/components/previews/ItemActions.tsx"],"sourcesContent":["import React from \"react\";\nimport { ReactComponent as ReplaceIcon } from \"@webiny/icons/file_upload.svg\";\nimport { ReactComponent as EditIcon } from \"@webiny/icons/edit.svg\";\nimport { ReactComponent as TrashIcon } from \"@webiny/icons/delete.svg\";\nimport { IconButton } from \"~/Button/index.js\";\nimport { Icon } from \"~/Icon/index.js\";\nimport { cn } from \"~/utils.js\";\n\ninterface ItemActionsProps extends React.HTMLAttributes<HTMLDivElement> {\n onRemoveItem?: () => void;\n onEditItem?: () => void;\n onReplaceItem?: () => void;\n disabled?: boolean;\n small?: boolean;\n}\n\nconst ItemActions = ({\n disabled,\n onRemoveItem,\n onEditItem,\n onReplaceItem,\n small,\n className,\n ...props\n}: ItemActionsProps) => {\n const iconSize = small ? \"default\" : \"lg\";\n const buttonSize = small ? \"xs\" : \"sm\";\n\n return (\n <div {...props} className={cn(\"flex justify-center items-center gap-xs\", className)}>\n {small && onReplaceItem && (\n <IconButton\n icon={\n <Icon\n icon={<ReplaceIcon />}\n label={\"Replace\"}\n size={\"md\"}\n color={\"neutral-light\"}\n />\n }\n variant={\"ghost\"}\n size={buttonSize}\n iconSize={iconSize}\n onClick={onReplaceItem}\n disabled={disabled}\n />\n )}\n\n {onEditItem && (\n <IconButton\n icon={\n <Icon\n icon={<EditIcon />}\n label={\"Edit\"}\n size={\"md\"}\n color={\"neutral-light\"}\n />\n }\n variant={\"ghost\"}\n size={buttonSize}\n iconSize={iconSize}\n onClick={onEditItem}\n disabled={disabled}\n />\n )}\n\n {onRemoveItem && (\n <IconButton\n icon={\n <Icon\n icon={<TrashIcon />}\n label={\"Remove\"}\n size={\"md\"}\n color={\"neutral-light\"}\n />\n }\n variant={\"ghost\"}\n size={buttonSize}\n iconSize={iconSize}\n onClick={onRemoveItem}\n disabled={disabled}\n />\n )}\n </div>\n );\n};\n\nexport { ItemActions, type ItemActionsProps };\n"],"names":["ItemActions","disabled","onRemoveItem","onEditItem","onReplaceItem","small","className","props","iconSize","buttonSize","cn","IconButton","Icon","ReplaceIcon","EditIcon","TrashIcon"],"mappings":";;;;;;;AAgBA,MAAMA,cAAc,CAAC,EACjBC,QAAQ,EACRC,YAAY,EACZC,UAAU,EACVC,aAAa,EACbC,KAAK,EACLC,SAAS,EACT,GAAGC,OACY;IACf,MAAMC,WAAWH,QAAQ,YAAY;IACrC,MAAMI,aAAaJ,QAAQ,OAAO;IAElC,OAAO,WAAP,GACI,oBAAC;QAAK,GAAGE,KAAK;QAAE,WAAWG,GAAG,2CAA2CJ;OACpED,SAASD,iBAAiB,WAAjBA,GACN,oBAACO,YAAUA;QACP,oBACI,oBAACC,MAAIA;YACD,oBAAM,oBAACC,gBAAWA;YAClB,OAAO;YACP,MAAM;YACN,OAAO;;QAGf,SAAS;QACT,MAAMJ;QACN,UAAUD;QACV,SAASJ;QACT,UAAUH;QAIjBE,cAAc,WAAdA,GACG,oBAACQ,YAAUA;QACP,oBACI,oBAACC,MAAIA;YACD,oBAAM,oBAACE,yBAAQA;YACf,OAAO;YACP,MAAM;YACN,OAAO;;QAGf,SAAS;QACT,MAAML;QACN,UAAUD;QACV,SAASL;QACT,UAAUF;QAIjBC,gBAAgB,WAAhBA,GACG,oBAACS,YAAUA;QACP,oBACI,oBAACC,MAAIA;YACD,oBAAM,oBAACG,2BAASA;YAChB,OAAO;YACP,MAAM;YACN,OAAO;;QAGf,SAAS;QACT,MAAMN;QACN,UAAUD;QACV,SAASN;QACT,UAAUD;;AAK9B"}
@@ -7,7 +7,7 @@ const ItemDescription = ({ className, disabled, item, small, ...props })=>{
7
7
  unitSeparator: " "
8
8
  });
9
9
  return /*#__PURE__*/ react.createElement("div", {
10
- className: cn("flex flex-col gap-xxs overflow-hidden min-w-0", className),
10
+ className: cn("flex flex-col gap-xxs overflow-hidden flex-1 min-w-0", className),
11
11
  ...props
12
12
  }, /*#__PURE__*/ react.createElement(Text, {
13
13
  size: "sm",
@@ -1 +1 @@
1
- {"version":3,"file":"FilePicker/primitives/components/previews/ItemDescription.js","sources":["../../../../../src/FilePicker/primitives/components/previews/ItemDescription.tsx"],"sourcesContent":["import React from \"react\";\nimport bytes from \"bytes\";\nimport { Text } from \"~/Text/index.js\";\nimport { cn } from \"~/utils.js\";\nimport type { FileItemFormatted } from \"~/FilePicker/index.js\";\n\ninterface ItemDescriptionProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"children\"> {\n item: FileItemFormatted;\n disabled?: boolean;\n small?: boolean;\n}\n\nconst ItemDescription = ({ className, disabled, item, small, ...props }: ItemDescriptionProps) => {\n const formattedSize = item.size && bytes.format(item.size, { unitSeparator: \" \" });\n\n return (\n <div className={cn(\"flex flex-col gap-xxs overflow-hidden min-w-0\", className)} {...props}>\n <Text\n size=\"sm\"\n as=\"div\"\n className={cn(\n \"truncate overflow-hidden whitespace-nowrap w-full\",\n disabled ? \"text-neutral-disabled\" : \"text-neutral-primary\"\n )}\n >\n {item.name}\n </Text>\n {!small && (formattedSize || item.mimeType) && (\n <Text\n size=\"sm\"\n className={cn(\n \"truncate overflow-hidden whitespace-nowrap w-full\",\n disabled ? \"text-neutral-disabled\" : \"text-neutral-muted\"\n )}\n >\n {[formattedSize, item.mimeType].filter(Boolean).join(\" - \")}\n </Text>\n )}\n </div>\n );\n};\n\nexport { ItemDescription, type ItemDescriptionProps };\n"],"names":["ItemDescription","className","disabled","item","small","props","formattedSize","bytes","cn","Text","Boolean"],"mappings":";;;;AAYA,MAAMA,kBAAkB,CAAC,EAAEC,SAAS,EAAEC,QAAQ,EAAEC,IAAI,EAAEC,KAAK,EAAE,GAAGC,OAA6B;IACzF,MAAMC,gBAAgBH,KAAK,IAAI,IAAII,MAAM,MAAM,CAACJ,KAAK,IAAI,EAAE;QAAE,eAAe;IAAI;IAEhF,OAAO,WAAP,GACI,oBAAC;QAAI,WAAWK,GAAG,iDAAiDP;QAAa,GAAGI,KAAK;qBACrF,oBAACI,MAAIA;QACD,MAAK;QACL,IAAG;QACH,WAAWD,GACP,qDACAN,WAAW,0BAA0B;OAGxCC,KAAK,IAAI,GAEb,CAACC,SAAUE,CAAAA,iBAAiBH,KAAK,QAAO,mBACrC,oBAACM,MAAIA;QACD,MAAK;QACL,WAAWD,GACP,qDACAN,WAAW,0BAA0B;OAGxC;QAACI;QAAeH,KAAK,QAAQ;KAAC,CAAC,MAAM,CAACO,SAAS,IAAI,CAAC;AAKzE"}
1
+ {"version":3,"file":"FilePicker/primitives/components/previews/ItemDescription.js","sources":["../../../../../src/FilePicker/primitives/components/previews/ItemDescription.tsx"],"sourcesContent":["import React from \"react\";\nimport bytes from \"bytes\";\nimport { Text } from \"~/Text/index.js\";\nimport { cn } from \"~/utils.js\";\nimport type { FileItemFormatted } from \"~/FilePicker/index.js\";\n\ninterface ItemDescriptionProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"children\"> {\n item: FileItemFormatted;\n disabled?: boolean;\n small?: boolean;\n}\n\nconst ItemDescription = ({ className, disabled, item, small, ...props }: ItemDescriptionProps) => {\n const formattedSize = item.size && bytes.format(item.size, { unitSeparator: \" \" });\n\n return (\n <div\n className={cn(\"flex flex-col gap-xxs overflow-hidden flex-1 min-w-0\", className)}\n {...props}\n >\n <Text\n size=\"sm\"\n as=\"div\"\n className={cn(\n \"truncate overflow-hidden whitespace-nowrap w-full\",\n disabled ? \"text-neutral-disabled\" : \"text-neutral-primary\"\n )}\n >\n {item.name}\n </Text>\n {!small && (formattedSize || item.mimeType) && (\n <Text\n size=\"sm\"\n className={cn(\n \"truncate overflow-hidden whitespace-nowrap w-full\",\n disabled ? \"text-neutral-disabled\" : \"text-neutral-muted\"\n )}\n >\n {[formattedSize, item.mimeType].filter(Boolean).join(\" - \")}\n </Text>\n )}\n </div>\n );\n};\n\nexport { ItemDescription, type ItemDescriptionProps };\n"],"names":["ItemDescription","className","disabled","item","small","props","formattedSize","bytes","cn","Text","Boolean"],"mappings":";;;;AAYA,MAAMA,kBAAkB,CAAC,EAAEC,SAAS,EAAEC,QAAQ,EAAEC,IAAI,EAAEC,KAAK,EAAE,GAAGC,OAA6B;IACzF,MAAMC,gBAAgBH,KAAK,IAAI,IAAII,MAAM,MAAM,CAACJ,KAAK,IAAI,EAAE;QAAE,eAAe;IAAI;IAEhF,OAAO,WAAP,GACI,oBAAC;QACG,WAAWK,GAAG,wDAAwDP;QACrE,GAAGI,KAAK;qBAET,oBAACI,MAAIA;QACD,MAAK;QACL,IAAG;QACH,WAAWD,GACP,qDACAN,WAAW,0BAA0B;OAGxCC,KAAK,IAAI,GAEb,CAACC,SAAUE,CAAAA,iBAAiBH,KAAK,QAAO,mBACrC,oBAACM,MAAIA;QACD,MAAK;QACL,WAAWD,GACP,qDACAN,WAAW,0BAA0B;OAGxC;QAACI;QAAeH,KAAK,QAAQ;KAAC,CAAC,MAAM,CAACO,SAAS,IAAI,CAAC;AAKzE"}
@@ -2,22 +2,28 @@ import React from "react";
2
2
  import type { FilePreviewDefaultProps } from "../../types.js";
3
3
  type RichItemPreviewProps = FilePreviewDefaultProps & {
4
4
  preview?: "thumbnail" | "file-type" | "placeholder";
5
+ /** Optional custom image renderer for the thumbnail (e.g. a cropped preview). */
6
+ renderImage?: (args: {
7
+ url: string;
8
+ name: string;
9
+ }) => React.ReactNode;
5
10
  };
6
- declare const RichItemPreview: (({ className, disabled, onRemoveItem, onReplaceItem, onEditItem, value, variant, preview, ...props }: RichItemPreviewProps) => React.JSX.Element) & {
7
- original: ({ className, disabled, onRemoveItem, onReplaceItem, onEditItem, value, variant, preview, ...props }: RichItemPreviewProps) => React.JSX.Element;
11
+ declare const DecoratableRichItemPreview: ({ className, disabled, onRemoveItem, onReplaceItem, onEditItem, value, variant, preview, renderImage, ...props }: RichItemPreviewProps) => React.JSX.Element;
12
+ declare const RichItemPreview: typeof DecoratableRichItemPreview & {
13
+ original: typeof DecoratableRichItemPreview;
8
14
  originalName: string;
9
15
  displayName: string;
10
16
  } & {
11
- original: (({ className, disabled, onRemoveItem, onReplaceItem, onEditItem, value, variant, preview, ...props }: RichItemPreviewProps) => React.JSX.Element) & {
12
- original: ({ className, disabled, onRemoveItem, onReplaceItem, onEditItem, value, variant, preview, ...props }: RichItemPreviewProps) => React.JSX.Element;
17
+ original: typeof DecoratableRichItemPreview & {
18
+ original: typeof DecoratableRichItemPreview;
13
19
  originalName: string;
14
20
  displayName: string;
15
21
  };
16
22
  originalName: string;
17
23
  displayName: string;
18
24
  } & {
19
- createDecorator: (decorator: import("@webiny/react-composition/types.js").ComponentDecorator<(({ className, disabled, onRemoveItem, onReplaceItem, onEditItem, value, variant, preview, ...props }: RichItemPreviewProps) => React.JSX.Element) & {
20
- original: ({ className, disabled, onRemoveItem, onReplaceItem, onEditItem, value, variant, preview, ...props }: RichItemPreviewProps) => React.JSX.Element;
25
+ createDecorator: (decorator: import("@webiny/react-composition/types.js").ComponentDecorator<typeof DecoratableRichItemPreview & {
26
+ original: typeof DecoratableRichItemPreview;
21
27
  originalName: string;
22
28
  displayName: string;
23
29
  }>) => (props: unknown) => React.JSX.Element;
@@ -1,76 +1,37 @@
1
1
  import react from "react";
2
- import bytes from "bytes";
3
2
  import { cn, makeDecoratable } from "../../../../../utils.js";
4
- import { Text } from "../../../../../Text/index.js";
5
3
  import { RichItemThumbnail } from "./RichItemThumbnail.js";
6
- import { ThumbnailActions } from "./ThumbnailActions.js";
7
4
  import { ItemDescription } from "../ItemDescription.js";
8
5
  import { ItemActions } from "../ItemActions.js";
9
- import { TruncatedFileName } from "../TruncatedFileName.js";
10
6
  import { previewVariants } from "../variants.js";
11
- const DecoratableRichItemPreview = ({ className, disabled, onRemoveItem, onReplaceItem, onEditItem, value, variant, preview, ...props })=>{
12
- const actions = {
13
- onRemoveItem,
14
- onReplaceItem,
15
- onEditItem,
16
- disabled
17
- };
18
- const formattedSize = value.size ? bytes.format(value.size, {
19
- unitSeparator: " ",
20
- decimalPlaces: 0
21
- }) : "";
22
- const details = [
23
- value.mimeType,
24
- formattedSize
25
- ].filter(Boolean).join(" - ");
26
- return /*#__PURE__*/ react.createElement("div", {
7
+ const DecoratableRichItemPreview = ({ className, disabled, onRemoveItem, onReplaceItem, onEditItem, value, variant, preview, renderImage, ...props })=>/*#__PURE__*/ react.createElement("div", {
27
8
  "data-testid": "image-preview",
28
- className: cn("@container w-full rounded-md", previewVariants({
9
+ className: cn("w-full rounded-md", previewVariants({
29
10
  variant,
30
11
  disabled
31
12
  }), className),
32
13
  ...props
33
14
  }, /*#__PURE__*/ react.createElement("div", {
34
15
  "data-role": "select-image",
35
- className: "@min-[280px]:hidden"
16
+ className: "flex items-center justify-between gap-sm-extra min-w-0"
36
17
  }, /*#__PURE__*/ react.createElement("div", {
37
- className: "flex flex-col gap-xs p-xs"
38
- }, /*#__PURE__*/ react.createElement("div", {
39
- className: "group relative cursor-pointer",
40
- onClick: onReplaceItem
41
- }, /*#__PURE__*/ react.createElement(RichItemThumbnail, {
42
- ...value,
43
- variant: "banner",
44
- disabled: disabled,
45
- preview: preview
46
- }), /*#__PURE__*/ react.createElement(ThumbnailActions, actions)), /*#__PURE__*/ react.createElement("div", {
47
- className: "flex flex-col gap-xxs min-w-0 px-xxs pb-xxs"
48
- }, /*#__PURE__*/ react.createElement(TruncatedFileName, {
49
- name: value.name,
50
- className: disabled ? "text-neutral-disabled" : "text-neutral-primary"
51
- }), details ? /*#__PURE__*/ react.createElement(Text, {
52
- size: "sm",
53
- className: cn("truncate", disabled ? "text-neutral-disabled" : "text-neutral-muted")
54
- }, details) : null))), /*#__PURE__*/ react.createElement("div", {
55
- "data-role": "select-image",
56
- className: "hidden @min-[280px]:flex items-center gap-sm-extra min-w-0"
57
- }, /*#__PURE__*/ react.createElement("div", {
58
- className: "shrink-0 cursor-pointer",
18
+ className: "flex items-center justify-between flex-1 cursor-pointer gap-sm-extra self-stretch min-w-0",
59
19
  onClick: onReplaceItem
60
20
  }, /*#__PURE__*/ react.createElement(RichItemThumbnail, {
61
21
  ...value,
62
22
  disabled: disabled,
63
- preview: preview
64
- })), /*#__PURE__*/ react.createElement(ItemDescription, {
23
+ preview: preview,
24
+ renderImage: renderImage
25
+ }), /*#__PURE__*/ react.createElement(ItemDescription, {
65
26
  item: value,
27
+ disabled: disabled
28
+ })), /*#__PURE__*/ react.createElement(ItemActions, {
29
+ onRemoveItem: onRemoveItem,
30
+ onReplaceItem: onReplaceItem,
31
+ onEditItem: onEditItem,
66
32
  disabled: disabled,
67
- onClick: onReplaceItem,
68
- className: "grow basis-0 cursor-pointer"
69
- }), /*#__PURE__*/ react.createElement(ItemActions, {
70
- ...actions,
71
- className: "ml-auto pr-sm-extra"
33
+ className: "pr-sm-extra"
72
34
  })));
73
- };
74
35
  const RichItemPreview = makeDecoratable("RichItemPreview", DecoratableRichItemPreview);
75
36
  export { RichItemPreview };
76
37
 
@@ -1 +1 @@
1
- {"version":3,"file":"FilePicker/primitives/components/previews/RichItemPreview/RichItemPreview.js","sources":["../../../../../../src/FilePicker/primitives/components/previews/RichItemPreview/RichItemPreview.tsx"],"sourcesContent":["import React from \"react\";\nimport bytes from \"bytes\";\nimport { cn, makeDecoratable } from \"~/utils.js\";\nimport { Text } from \"~/Text/index.js\";\nimport { RichItemThumbnail } from \"./RichItemThumbnail.js\";\nimport { ThumbnailActions } from \"./ThumbnailActions.js\";\nimport { ItemDescription } from \"../ItemDescription.js\";\nimport { ItemActions } from \"~/FilePicker/primitives/components/previews/ItemActions.js\";\nimport { TruncatedFileName } from \"../TruncatedFileName.js\";\nimport { previewVariants } from \"../variants.js\";\nimport type { FilePreviewDefaultProps } from \"../../types.js\";\n\ntype RichItemPreviewProps = FilePreviewDefaultProps & {\n preview?: \"thumbnail\" | \"file-type\" | \"placeholder\";\n};\n\nconst DecoratableRichItemPreview = ({\n className,\n disabled,\n onRemoveItem,\n onReplaceItem,\n onEditItem,\n value,\n variant,\n preview,\n ...props\n}: RichItemPreviewProps) => {\n const actions = { onRemoveItem, onReplaceItem, onEditItem, disabled };\n\n // Type and size share a line of their own beneath the name, so the name gets the full width\n // and the two secondary facts read as one group rather than crowding it.\n const formattedSize = value.size\n ? bytes.format(value.size, { unitSeparator: \" \", decimalPlaces: 0 })\n : \"\";\n const details = [value.mimeType, formattedSize].filter(Boolean).join(\" - \");\n\n return (\n <div\n data-testid=\"image-preview\"\n className={cn(\n \"@container w-full rounded-md\",\n previewVariants({ variant, disabled }),\n className\n )}\n {...props}\n >\n {/* Two layouts, chosen by the preview's own width rather than the viewport's, because\n the same component renders in a ~200px sidebar and in a wide form field. Below\n 280px a side-by-side row cannot give the file name a readable share of the width,\n so the thumbnail goes full width with the name and details beneath it, and the\n actions move onto the thumbnail rather than costing a row of their own. */}\n <div data-role=\"select-image\" className={\"@min-[280px]:hidden\"}>\n <div className={\"flex flex-col gap-xs p-xs\"}>\n <div className={\"group relative cursor-pointer\"} onClick={onReplaceItem}>\n <RichItemThumbnail\n {...value}\n variant={\"banner\"}\n disabled={disabled}\n preview={preview}\n />\n <ThumbnailActions {...actions} />\n </div>\n\n <div className={\"flex flex-col gap-xxs min-w-0 px-xxs pb-xxs\"}>\n <TruncatedFileName\n name={value.name}\n className={disabled ? \"text-neutral-disabled\" : \"text-neutral-primary\"}\n />\n {details ? (\n <Text\n size=\"sm\"\n className={cn(\n \"truncate\",\n disabled ? \"text-neutral-disabled\" : \"text-neutral-muted\"\n )}\n >\n {details}\n </Text>\n ) : null}\n </div>\n </div>\n </div>\n\n <div\n data-role=\"select-image\"\n className={\"hidden @min-[280px]:flex items-center gap-sm-extra min-w-0\"}\n >\n <div className={\"shrink-0 cursor-pointer\"} onClick={onReplaceItem}>\n <RichItemThumbnail {...value} disabled={disabled} preview={preview} />\n </div>\n\n <ItemDescription\n item={value}\n disabled={disabled}\n onClick={onReplaceItem}\n className={\"grow basis-0 cursor-pointer\"}\n />\n\n <ItemActions {...actions} className={\"ml-auto pr-sm-extra\"} />\n </div>\n </div>\n );\n};\n\nconst RichItemPreview = makeDecoratable(\"RichItemPreview\", DecoratableRichItemPreview);\n\nexport { RichItemPreview, type RichItemPreviewProps };\n"],"names":["DecoratableRichItemPreview","className","disabled","onRemoveItem","onReplaceItem","onEditItem","value","variant","preview","props","actions","formattedSize","bytes","details","Boolean","cn","previewVariants","RichItemThumbnail","ThumbnailActions","TruncatedFileName","Text","ItemDescription","ItemActions","RichItemPreview","makeDecoratable"],"mappings":";;;;;;;;;;AAgBA,MAAMA,6BAA6B,CAAC,EAChCC,SAAS,EACTC,QAAQ,EACRC,YAAY,EACZC,aAAa,EACbC,UAAU,EACVC,KAAK,EACLC,OAAO,EACPC,OAAO,EACP,GAAGC,OACgB;IACnB,MAAMC,UAAU;QAAEP;QAAcC;QAAeC;QAAYH;IAAS;IAIpE,MAAMS,gBAAgBL,MAAM,IAAI,GAC1BM,MAAM,MAAM,CAACN,MAAM,IAAI,EAAE;QAAE,eAAe;QAAK,eAAe;IAAE,KAChE;IACN,MAAMO,UAAU;QAACP,MAAM,QAAQ;QAAEK;KAAc,CAAC,MAAM,CAACG,SAAS,IAAI,CAAC;IAErE,OAAO,WAAP,GACI,oBAAC;QACG,eAAY;QACZ,WAAWC,GACP,gCACAC,gBAAgB;YAAET;YAASL;QAAS,IACpCD;QAEH,GAAGQ,KAAK;qBAOT,oBAAC;QAAI,aAAU;QAAe,WAAW;qBACrC,oBAAC;QAAI,WAAW;qBACZ,oBAAC;QAAI,WAAW;QAAiC,SAASL;qBACtD,oBAACa,mBAAiBA;QACb,GAAGX,KAAK;QACT,SAAS;QACT,UAAUJ;QACV,SAASM;sBAEb,oBAACU,kBAAqBR,WAAAA,WAAAA,GAG1B,oBAAC;QAAI,WAAW;qBACZ,oBAACS,mBAAiBA;QACd,MAAMb,MAAM,IAAI;QAChB,WAAWJ,WAAW,0BAA0B;QAEnDW,UAAU,WAAVA,GACG,oBAACO,MAAIA;QACD,MAAK;QACL,WAAWL,GACP,YACAb,WAAW,0BAA0B;OAGxCW,WAEL,uBAKhB,oBAAC;QACG,aAAU;QACV,WAAW;qBAEX,oBAAC;QAAI,WAAW;QAA2B,SAAST;qBAChD,oBAACa,mBAAiBA;QAAE,GAAGX,KAAK;QAAE,UAAUJ;QAAU,SAASM;uBAG/D,oBAACa,iBAAeA;QACZ,MAAMf;QACN,UAAUJ;QACV,SAASE;QACT,WAAW;sBAGf,oBAACkB,aAAWA;QAAE,GAAGZ,OAAO;QAAE,WAAW;;AAIrD;AAEA,MAAMa,kBAAkBC,gBAAgB,mBAAmBxB"}
1
+ {"version":3,"file":"FilePicker/primitives/components/previews/RichItemPreview/RichItemPreview.js","sources":["../../../../../../src/FilePicker/primitives/components/previews/RichItemPreview/RichItemPreview.tsx"],"sourcesContent":["import React from \"react\";\nimport { cn, makeDecoratable } from \"~/utils.js\";\nimport { RichItemThumbnail } from \"./RichItemThumbnail.js\";\nimport { ItemDescription } from \"../ItemDescription.js\";\nimport { ItemActions } from \"~/FilePicker/primitives/components/previews/ItemActions.js\";\nimport { previewVariants } from \"../variants.js\";\nimport type { FilePreviewDefaultProps } from \"../../types.js\";\n\ntype RichItemPreviewProps = FilePreviewDefaultProps & {\n preview?: \"thumbnail\" | \"file-type\" | \"placeholder\";\n /** Optional custom image renderer for the thumbnail (e.g. a cropped preview). */\n renderImage?: (args: { url: string; name: string }) => React.ReactNode;\n};\n\nconst DecoratableRichItemPreview = ({\n className,\n disabled,\n onRemoveItem,\n onReplaceItem,\n onEditItem,\n value,\n variant,\n preview,\n renderImage,\n ...props\n}: RichItemPreviewProps) => {\n return (\n <div\n data-testid=\"image-preview\"\n className={cn(\"w-full rounded-md\", previewVariants({ variant, disabled }), className)}\n {...props}\n >\n <div\n data-role=\"select-image\"\n className=\"flex items-center justify-between gap-sm-extra min-w-0\"\n >\n <div\n className=\"flex items-center justify-between flex-1 cursor-pointer gap-sm-extra self-stretch min-w-0\"\n onClick={onReplaceItem}\n >\n <RichItemThumbnail\n {...value}\n disabled={disabled}\n preview={preview}\n renderImage={renderImage}\n />\n <ItemDescription item={value} disabled={disabled} />\n </div>\n\n <ItemActions\n onRemoveItem={onRemoveItem}\n onReplaceItem={onReplaceItem}\n onEditItem={onEditItem}\n disabled={disabled}\n className={\"pr-sm-extra\"}\n />\n </div>\n </div>\n );\n};\n\nconst RichItemPreview = makeDecoratable(\"RichItemPreview\", DecoratableRichItemPreview);\n\nexport { RichItemPreview, type RichItemPreviewProps };\n"],"names":["DecoratableRichItemPreview","className","disabled","onRemoveItem","onReplaceItem","onEditItem","value","variant","preview","renderImage","props","cn","previewVariants","RichItemThumbnail","ItemDescription","ItemActions","RichItemPreview","makeDecoratable"],"mappings":";;;;;;AAcA,MAAMA,6BAA6B,CAAC,EAChCC,SAAS,EACTC,QAAQ,EACRC,YAAY,EACZC,aAAa,EACbC,UAAU,EACVC,KAAK,EACLC,OAAO,EACPC,OAAO,EACPC,WAAW,EACX,GAAGC,OACgB,GACZ,WAAP,GACI,oBAAC;QACG,eAAY;QACZ,WAAWC,GAAG,qBAAqBC,gBAAgB;YAAEL;YAASL;QAAS,IAAID;QAC1E,GAAGS,KAAK;qBAET,oBAAC;QACG,aAAU;QACV,WAAU;qBAEV,oBAAC;QACG,WAAU;QACV,SAASN;qBAET,oBAACS,mBAAiBA;QACb,GAAGP,KAAK;QACT,UAAUJ;QACV,SAASM;QACT,aAAaC;sBAEjB,oBAACK,iBAAeA;QAAC,MAAMR;QAAO,UAAUJ;uBAG5C,oBAACa,aAAWA;QACR,cAAcZ;QACd,eAAeC;QACf,YAAYC;QACZ,UAAUH;QACV,WAAW;;AAO/B,MAAMc,kBAAkBC,gBAAgB,mBAAmBjB"}
@@ -5,10 +5,14 @@ type RichItemThumbnailProps = Omit<React.HTMLAttributes<HTMLDivElement>, "childr
5
5
  preview?: RichItemPreviewProps["preview"];
6
6
  disabled?: boolean;
7
7
  /**
8
- * `tile` is the fixed square that sits beside the file details; `banner` spans the full
9
- * width of a stacked layout, where the panel is too narrow to afford a column for it.
8
+ * Optional custom image renderer for image thumbnails (e.g. a cropped /
9
+ * focal-point-aware image). Falls back to the default `<img>` when omitted
10
+ * or when it returns a falsy value.
10
11
  */
11
- variant?: "tile" | "banner";
12
+ renderImage?: (args: {
13
+ url: string;
14
+ name: string;
15
+ }) => React.ReactNode;
12
16
  };
13
- declare const RichItemThumbnail: ({ url, name, className, mimeType, preview, disabled, variant }: RichItemThumbnailProps) => React.JSX.Element;
17
+ declare const RichItemThumbnail: ({ url, name, className, mimeType, preview, disabled, renderImage }: RichItemThumbnailProps) => React.JSX.Element;
14
18
  export { RichItemThumbnail, type RichItemThumbnailProps };
@@ -1,16 +1,74 @@
1
1
  import react from "react";
2
+ import { ReactComponent } from "@webiny/icons/image.svg";
3
+ import { Icon } from "../../../../../Icon/index.js";
2
4
  import { cn } from "../../../../../utils.js";
3
- import { FileType } from "./FileType.js";
4
- import { Placeholder } from "./Placeholder.js";
5
- import { Thumbnail } from "./Thumbnail.js";
6
- const RichItemThumbnail = ({ url, name, className, mimeType, preview, disabled, variant = "tile" })=>{
5
+ import csv from "../assets/csv.js";
6
+ import doc from "../assets/doc.js";
7
+ import docx from "../assets/docx.js";
8
+ import file from "../assets/file.js";
9
+ import pdf from "../assets/pdf.js";
10
+ import ppt from "../assets/ppt.js";
11
+ import pptx from "../assets/pptx.js";
12
+ import txt from "../assets/txt.js";
13
+ import xls from "../assets/xls.js";
14
+ import xlsx from "../assets/xlsx.js";
15
+ const Thumbnail = ({ url, name })=>/*#__PURE__*/ react.createElement("div", {
16
+ className: "size-full bg-neutral-muted"
17
+ }, /*#__PURE__*/ react.createElement("img", {
18
+ src: url,
19
+ alt: name,
20
+ className: "size-full object-cover"
21
+ }));
22
+ const FileType = ({ mimeType = "", name })=>{
23
+ const getMimeTypeSrc = (mimeType)=>{
24
+ switch(mimeType){
25
+ case "text/csv":
26
+ return csv;
27
+ case "application/msword":
28
+ return doc;
29
+ case "application/vnd.openxmlformats-officedocument.wordprocessingml.document":
30
+ return docx;
31
+ case "application/pdf":
32
+ return pdf;
33
+ case "application/vnd.ms-powerpoint":
34
+ return ppt;
35
+ case "application/vnd.openxmlformats-officedocument.presentationml.presentation":
36
+ return pptx;
37
+ case "text/plain":
38
+ return txt;
39
+ case "application/vnd.ms-excel":
40
+ return xls;
41
+ case "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":
42
+ return xlsx;
43
+ default:
44
+ return file;
45
+ }
46
+ };
47
+ return /*#__PURE__*/ react.createElement("img", {
48
+ src: getMimeTypeSrc(mimeType),
49
+ alt: name,
50
+ className: "size-full p-sm-extra"
51
+ });
52
+ };
53
+ const Placeholder = ({ name })=>/*#__PURE__*/ react.createElement("div", {
54
+ className: "size-full flex justify-center items-center bg-transparent"
55
+ }, /*#__PURE__*/ react.createElement(Icon, {
56
+ icon: /*#__PURE__*/ react.createElement(ReactComponent, null),
57
+ label: name,
58
+ size: "lg",
59
+ color: "neutral-light"
60
+ }));
61
+ const RichItemThumbnail = ({ url, name, className, mimeType, preview, disabled, renderImage })=>{
7
62
  const isImage = mimeType?.startsWith("image/");
63
+ const customImage = "function" == typeof renderImage ? renderImage({
64
+ url,
65
+ name
66
+ }) : false;
8
67
  return /*#__PURE__*/ react.createElement("div", {
9
- className: cn("rounded-sm overflow-hidden relative", "banner" === variant ? "w-full h-[96px]" : "size-[56px] m-xs", disabled && "[&_img]:filter [&_img]:grayscale [&_img]:opacity-50", className)
10
- }, "thumbnail" === preview || isImage ? /*#__PURE__*/ react.createElement(Thumbnail, {
68
+ className: cn("size-[56px] m-xs rounded-sm overflow-hidden relative", disabled && "[&_img]:filter [&_img]:grayscale [&_img]:opacity-50", className)
69
+ }, "thumbnail" === preview || isImage ? customImage || /*#__PURE__*/ react.createElement(Thumbnail, {
11
70
  url: url,
12
- name: name,
13
- fit: "banner" === variant ? "contain" : "cover"
71
+ name: name
14
72
  }) : "placeholder" === preview ? /*#__PURE__*/ react.createElement(Placeholder, {
15
73
  name: name
16
74
  }) : /*#__PURE__*/ react.createElement(FileType, {
@@ -1 +1 @@
1
- {"version":3,"file":"FilePicker/primitives/components/previews/RichItemPreview/RichItemThumbnail.js","sources":["../../../../../../src/FilePicker/primitives/components/previews/RichItemPreview/RichItemThumbnail.tsx"],"sourcesContent":["import React from \"react\";\nimport type { FileItemFormatted } from \"~/FilePicker/index.js\";\nimport { cn } from \"~/utils.js\";\nimport type { RichItemPreviewProps } from \"~/FilePicker/primitives/components/index.js\";\nimport { FileType } from \"./FileType.js\";\nimport { Placeholder } from \"./Placeholder.js\";\nimport { Thumbnail } from \"./Thumbnail.js\";\n\ntype RichItemThumbnailProps = Omit<React.HTMLAttributes<HTMLDivElement>, \"children\"> &\n FileItemFormatted & {\n preview?: RichItemPreviewProps[\"preview\"];\n disabled?: boolean;\n /**\n * `tile` is the fixed square that sits beside the file details; `banner` spans the full\n * width of a stacked layout, where the panel is too narrow to afford a column for it.\n */\n variant?: \"tile\" | \"banner\";\n };\n\nconst RichItemThumbnail = ({\n url,\n name,\n className,\n mimeType,\n preview,\n disabled,\n variant = \"tile\"\n}: RichItemThumbnailProps) => {\n const isImage = mimeType?.startsWith(\"image/\");\n\n return (\n <div\n className={cn(\n \"rounded-sm overflow-hidden relative\",\n variant === \"banner\" ? \"w-full h-[96px]\" : \"size-[56px] m-xs\",\n disabled && \"[&_img]:filter [&_img]:grayscale [&_img]:opacity-50\",\n className\n )}\n >\n {preview === \"thumbnail\" || isImage ? (\n <Thumbnail url={url} name={name} fit={variant === \"banner\" ? \"contain\" : \"cover\"} />\n ) : preview === \"placeholder\" ? (\n <Placeholder name={name} />\n ) : (\n <FileType mimeType={mimeType} name={name} />\n )}\n </div>\n );\n};\n\nexport { RichItemThumbnail, type RichItemThumbnailProps };\n"],"names":["RichItemThumbnail","url","name","className","mimeType","preview","disabled","variant","isImage","cn","Thumbnail","Placeholder","FileType"],"mappings":";;;;;AAmBA,MAAMA,oBAAoB,CAAC,EACvBC,GAAG,EACHC,IAAI,EACJC,SAAS,EACTC,QAAQ,EACRC,OAAO,EACPC,QAAQ,EACRC,UAAU,MAAM,EACK;IACrB,MAAMC,UAAUJ,UAAU,WAAW;IAErC,OAAO,WAAP,GACI,oBAAC;QACG,WAAWK,GACP,uCACAF,AAAY,aAAZA,UAAuB,oBAAoB,oBAC3CD,YAAY,uDACZH;OAGHE,AAAY,gBAAZA,WAA2BG,UAAU,WAAVA,GACxB,oBAACE,WAASA;QAAC,KAAKT;QAAK,MAAMC;QAAM,KAAKK,AAAY,aAAZA,UAAuB,YAAY;SACzEF,AAAY,kBAAZA,UAA4B,WAAhB,GACZ,oBAACM,aAAWA;QAAC,MAAMT;uBAEnB,oBAACU,UAAQA;QAAC,UAAUR;QAAU,MAAMF;;AAIpD"}
1
+ {"version":3,"file":"FilePicker/primitives/components/previews/RichItemPreview/RichItemThumbnail.js","sources":["../../../../../../src/FilePicker/primitives/components/previews/RichItemPreview/RichItemThumbnail.tsx"],"sourcesContent":["import React from \"react\";\nimport { ReactComponent as PlaceholderIcon } from \"@webiny/icons/image.svg\";\nimport type { FileItemFormatted } from \"~/FilePicker/index.js\";\nimport { Icon } from \"~/Icon/index.js\";\nimport { cn } from \"~/utils.js\";\nimport type { RichItemPreviewProps } from \"~/FilePicker/primitives/components/index.js\";\n\nimport csvThumb from \"../assets/csv.svg\";\nimport docThumb from \"../assets/doc.svg\";\nimport docxThumb from \"../assets/docx.svg\";\nimport fileThumb from \"../assets/file.svg\";\nimport pdfThumb from \"../assets/pdf.svg\";\nimport pptThumb from \"../assets/ppt.svg\";\nimport pptxThumb from \"../assets/pptx.svg\";\nimport txtThumb from \"../assets/txt.svg\";\nimport xlsThumb from \"../assets/xls.svg\";\nimport xlsxThumb from \"../assets/xlsx.svg\";\n\ntype RichItemThumbnailProps = Omit<React.HTMLAttributes<HTMLDivElement>, \"children\"> &\n FileItemFormatted & {\n preview?: RichItemPreviewProps[\"preview\"];\n disabled?: boolean;\n /**\n * Optional custom image renderer for image thumbnails (e.g. a cropped /\n * focal-point-aware image). Falls back to the default `<img>` when omitted\n * or when it returns a falsy value.\n */\n renderImage?: (args: { url: string; name: string }) => React.ReactNode;\n };\n\ntype ThumbnailProps = Pick<FileItemFormatted, \"url\" | \"name\">;\n\nconst Thumbnail = ({ url, name }: ThumbnailProps) => {\n return (\n <div className={\"size-full bg-neutral-muted\"}>\n <img src={url} alt={name} className=\"size-full object-cover\" />\n </div>\n );\n};\n\ntype FileTypeProps = Pick<FileItemFormatted, \"mimeType\" | \"name\">;\n\nconst FileType = ({ mimeType = \"\", name }: FileTypeProps) => {\n const getMimeTypeSrc = (mimeType: string) => {\n switch (mimeType) {\n case \"text/csv\": // .csv\n return csvThumb;\n case \"application/msword\": // .doc\n return docThumb;\n case \"application/vnd.openxmlformats-officedocument.wordprocessingml.document\": // .docx\n return docxThumb;\n case \"application/pdf\": // .pdf\n return pdfThumb;\n case \"application/vnd.ms-powerpoint\": // .ppt\n return pptThumb;\n case \"application/vnd.openxmlformats-officedocument.presentationml.presentation\": // .pptx\n return pptxThumb;\n case \"text/plain\": // .txt\n return txtThumb;\n case \"application/vnd.ms-excel\": // .xls\n return xlsThumb;\n case \"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\": // .xlsx\n return xlsxThumb;\n default:\n return fileThumb;\n }\n };\n\n return <img src={getMimeTypeSrc(mimeType)} alt={name} className=\"size-full p-sm-extra\" />;\n};\n\ntype PlaceholderProps = Pick<FileItemFormatted, \"name\">;\n\nconst Placeholder = ({ name }: PlaceholderProps) => {\n return (\n <div className={\"size-full flex justify-center items-center bg-transparent\"}>\n <Icon icon={<PlaceholderIcon />} label={name} size={\"lg\"} color={\"neutral-light\"} />\n </div>\n );\n};\n\nconst RichItemThumbnail = ({\n url,\n name,\n className,\n mimeType,\n preview,\n disabled,\n renderImage\n}: RichItemThumbnailProps) => {\n const isImage = mimeType?.startsWith(\"image/\");\n const customImage = typeof renderImage === \"function\" ? renderImage({ url, name }) : false;\n\n return (\n <div\n className={cn(\n \"size-[56px] m-xs rounded-sm overflow-hidden relative\",\n disabled && \"[&_img]:filter [&_img]:grayscale [&_img]:opacity-50\",\n className\n )}\n >\n {preview === \"thumbnail\" || isImage ? (\n customImage || <Thumbnail url={url} name={name} />\n ) : preview === \"placeholder\" ? (\n <Placeholder name={name} />\n ) : (\n <FileType mimeType={mimeType} name={name} />\n )}\n </div>\n );\n};\n\nexport { RichItemThumbnail, type RichItemThumbnailProps };\n"],"names":["Thumbnail","url","name","FileType","mimeType","getMimeTypeSrc","csvThumb","docThumb","docxThumb","pdfThumb","pptThumb","pptxThumb","txtThumb","xlsThumb","xlsxThumb","fileThumb","Placeholder","Icon","PlaceholderIcon","RichItemThumbnail","className","preview","disabled","renderImage","isImage","customImage","cn"],"mappings":";;;;;;;;;;;;;;AAgCA,MAAMA,YAAY,CAAC,EAAEC,GAAG,EAAEC,IAAI,EAAkB,GACrC,WAAP,GACI,oBAAC;QAAI,WAAW;qBACZ,oBAAC;QAAI,KAAKD;QAAK,KAAKC;QAAM,WAAU;;AAOhD,MAAMC,WAAW,CAAC,EAAEC,WAAW,EAAE,EAAEF,IAAI,EAAiB;IACpD,MAAMG,iBAAiB,CAACD;QACpB,OAAQA;YACJ,KAAK;gBACD,OAAOE;YACX,KAAK;gBACD,OAAOC;YACX,KAAK;gBACD,OAAOC;YACX,KAAK;gBACD,OAAOC;YACX,KAAK;gBACD,OAAOC;YACX,KAAK;gBACD,OAAOC;YACX,KAAK;gBACD,OAAOC;YACX,KAAK;gBACD,OAAOC;YACX,KAAK;gBACD,OAAOC;YACX;gBACI,OAAOC;QACf;IACJ;IAEA,OAAO,WAAP,GAAO,oBAAC;QAAI,KAAKV,eAAeD;QAAW,KAAKF;QAAM,WAAU;;AACpE;AAIA,MAAMc,cAAc,CAAC,EAAEd,IAAI,EAAoB,GACpC,WAAP,GACI,oBAAC;QAAI,WAAW;qBACZ,oBAACe,MAAIA;QAAC,oBAAM,oBAACC,gBAAeA;QAAK,OAAOhB;QAAM,MAAM;QAAM,OAAO;;AAK7E,MAAMiB,oBAAoB,CAAC,EACvBlB,GAAG,EACHC,IAAI,EACJkB,SAAS,EACThB,QAAQ,EACRiB,OAAO,EACPC,QAAQ,EACRC,WAAW,EACU;IACrB,MAAMC,UAAUpB,UAAU,WAAW;IACrC,MAAMqB,cAAc,AAAuB,cAAvB,OAAOF,cAA6BA,YAAY;QAAEtB;QAAKC;IAAK,KAAK;IAErF,OAAO,WAAP,GACI,oBAAC;QACG,WAAWwB,GACP,wDACAJ,YAAY,uDACZF;OAGHC,AAAY,gBAAZA,WAA2BG,UACxBC,eAAe,WAAfA,GAAe,oBAACzB,WAASA;QAAC,KAAKC;QAAK,MAAMC;SAC1CmB,AAAY,kBAAZA,UAA4B,WAAhB,GACZ,oBAACL,aAAWA;QAAC,MAAMd;uBAEnB,oBAACC,UAAQA;QAAC,UAAUC;QAAU,MAAMF;;AAIpD"}
@@ -6,21 +6,22 @@ declare const textOnlyPreviewVariants: (props?: ({
6
6
  small?: boolean | null | undefined;
7
7
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
8
8
  type TextOnlyPreviewProps = FilePreviewDefaultProps & React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof previewVariants> & VariantProps<typeof textOnlyPreviewVariants>;
9
- declare const TextOnlyPreview: (({ className, disabled, onRemoveItem, onReplaceItem, onEditItem, small, variant, value, ...props }: TextOnlyPreviewProps) => React.JSX.Element) & {
10
- original: ({ className, disabled, onRemoveItem, onReplaceItem, onEditItem, small, variant, value, ...props }: TextOnlyPreviewProps) => React.JSX.Element;
9
+ declare const DecoratableTextOnlyPreview: ({ className, disabled, onRemoveItem, onReplaceItem, onEditItem, small, variant, value, ...props }: TextOnlyPreviewProps) => React.JSX.Element;
10
+ declare const TextOnlyPreview: typeof DecoratableTextOnlyPreview & {
11
+ original: typeof DecoratableTextOnlyPreview;
11
12
  originalName: string;
12
13
  displayName: string;
13
14
  } & {
14
- original: (({ className, disabled, onRemoveItem, onReplaceItem, onEditItem, small, variant, value, ...props }: TextOnlyPreviewProps) => React.JSX.Element) & {
15
- original: ({ className, disabled, onRemoveItem, onReplaceItem, onEditItem, small, variant, value, ...props }: TextOnlyPreviewProps) => React.JSX.Element;
15
+ original: typeof DecoratableTextOnlyPreview & {
16
+ original: typeof DecoratableTextOnlyPreview;
16
17
  originalName: string;
17
18
  displayName: string;
18
19
  };
19
20
  originalName: string;
20
21
  displayName: string;
21
22
  } & {
22
- createDecorator: (decorator: import("@webiny/react-composition/types.js").ComponentDecorator<(({ className, disabled, onRemoveItem, onReplaceItem, onEditItem, small, variant, value, ...props }: TextOnlyPreviewProps) => React.JSX.Element) & {
23
- original: ({ className, disabled, onRemoveItem, onReplaceItem, onEditItem, small, variant, value, ...props }: TextOnlyPreviewProps) => React.JSX.Element;
23
+ createDecorator: (decorator: import("@webiny/react-composition/types.js").ComponentDecorator<typeof DecoratableTextOnlyPreview & {
24
+ original: typeof DecoratableTextOnlyPreview;
24
25
  originalName: string;
25
26
  displayName: string;
26
27
  }>) => (props: unknown) => React.JSX.Element;
@@ -2,4 +2,3 @@ export * from "./FilePreview.js";
2
2
  export * from "./ImagePreview/index.js";
3
3
  export * from "./RichItemPreview/index.js";
4
4
  export * from "./TextOnlyPreview/index.js";
5
- export * from "./TruncatedFileName.js";