@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.
- package/Accordion/Accordion.d.ts +7 -6
- package/Accordion/components/AccordionContent.js +4 -1
- package/Accordion/components/AccordionContent.js.map +1 -1
- package/Accordion/components/AccordionItem.d.ts +8 -6
- package/Accordion/components/AccordionItem.js.map +1 -1
- package/Accordion/components/AccordionItemAction.d.ts +7 -6
- package/Accordion/components/AccordionItemDragHandle.d.ts +2 -1
- package/Accordion/components/AccordionItemDragHandle.js +2 -1
- package/Accordion/components/AccordionItemDragHandle.js.map +1 -1
- package/Accordion/components/AccordionItemIcon.d.ts +7 -6
- package/Accordion/components/AccordionItemSeparator.d.ts +7 -6
- package/Accordion/components/AccordionTrigger.js +4 -2
- package/Accordion/components/AccordionTrigger.js.map +1 -1
- package/Alert/Alert.d.ts +21 -19
- package/AutoComplete/AutoComplete.d.ts +7 -6
- package/AutoComplete/primitives/AutoCompletePrimitive.d.ts +7 -6
- package/Avatar/Avatar.d.ts +9 -8
- package/Avatar/components/AvatarFallback.d.ts +7 -6
- package/Avatar/components/AvatarImage.d.ts +7 -6
- package/BetaBadge/BetaBadge.d.ts +6 -0
- package/BetaBadge/BetaBadge.js +7 -0
- package/BetaBadge/BetaBadge.js.map +1 -0
- package/Breadcrumbs/Breadcrumbs.d.ts +54 -0
- package/Breadcrumbs/Breadcrumbs.js +66 -0
- package/Breadcrumbs/Breadcrumbs.js.map +1 -0
- package/Breadcrumbs/Breadcrumbs.stories.d.ts +9 -0
- package/Breadcrumbs/Breadcrumbs.stories.js +71 -0
- package/Breadcrumbs/Breadcrumbs.stories.js.map +1 -0
- package/Breadcrumbs/index.d.ts +1 -0
- package/Breadcrumbs/index.js +1 -0
- package/Button/Button.d.ts +10 -9
- package/Button/CopyButton.d.ts +7 -6
- package/Button/IconButton.d.ts +10 -9
- package/Calendar/Calendar.d.ts +7 -6
- package/Calendar/calendarClassNames.js +1 -1
- package/Calendar/calendarClassNames.js.map +1 -1
- package/Card/Card.d.ts +8 -22
- package/Card/components/CancelAction.d.ts +8 -6
- package/Card/components/CardContent.d.ts +6 -6
- package/Card/components/CardTitle.d.ts +2 -2
- package/Card/components/ConfirmAction.d.ts +8 -6
- package/Card/components/Icon.d.ts +7 -6
- package/Checkbox/Checkbox.d.ts +7 -6
- package/Checkbox/primitives/CheckboxPrimitive.d.ts +17 -12
- package/CheckboxGroup/CheckboxGroup.d.ts +7 -6
- package/CheckboxGroup/primitives/CheckboxGroupPrimitive.d.ts +20 -12
- package/CodeEditor/CodeEditor.d.ts +7 -6
- package/CodeEditor/CodeEditorPrimitive.d.ts +7 -6
- package/CodeEditor/CodeEditorPrimitive.js +3 -1
- package/CodeEditor/CodeEditorPrimitive.js.map +1 -1
- package/ColorPicker/ColorPicker.d.ts +7 -6
- package/ColorPicker/primitives/ColorPickerPrimitive.d.ts +7 -6
- package/Command/Command.d.ts +10 -8
- package/DataList/DataListModal.d.ts +6 -3
- package/DataTable/DataTable.d.ts +23 -12
- package/DataTable/DataTable.js +12 -4
- package/DataTable/DataTable.js.map +1 -1
- package/DataTable/components/ColumnsVisibility.d.ts +5 -4
- package/DataTable/components/ColumnsVisibility.js +6 -3
- package/DataTable/components/ColumnsVisibility.js.map +1 -1
- package/DatePicker/DatePicker.d.ts +7 -6
- package/DatePicker/primitives/DatePickerPrimitive.d.ts +7 -6
- package/DatePicker/primitives/DateTimePicker.d.ts +1 -1
- package/DatePicker/primitives/DateTimePicker.js +15 -3
- package/DatePicker/primitives/DateTimePicker.js.map +1 -1
- package/DatePicker/primitives/components/DatePickerTrigger.js +1 -1
- package/DatePicker/primitives/components/DatePickerTrigger.js.map +1 -1
- package/DatePicker/utils/types.d.ts +2 -0
- package/Dialog/Dialog.d.ts +8 -22
- package/Dialog/components/CancelAction.d.ts +8 -6
- package/Dialog/components/ConfirmAction.d.ts +8 -6
- package/Dialog/components/DialogContent.d.ts +1 -1
- package/Dialog/components/DialogFooter.d.ts +1 -1
- package/Dialog/components/DialogTitle.d.ts +1 -1
- package/Dialog/components/Icon.d.ts +7 -6
- package/Drawer/Drawer.d.ts +8 -22
- package/Drawer/Drawer.stories.js +1 -0
- package/Drawer/Drawer.stories.js.map +1 -1
- package/Drawer/components/CancelButton.d.ts +8 -6
- package/Drawer/components/ConfirmButton.d.ts +8 -6
- package/Drawer/components/DrawerContent.d.ts +1 -1
- package/Drawer/components/Icon.d.ts +7 -6
- package/DropdownMenu/components/DropdownMenuItem.d.ts +3 -2
- package/DropdownMenu/components/DropdownMenuItem.js +9 -2
- package/DropdownMenu/components/DropdownMenuItem.js.map +1 -1
- package/DropdownMenu/components/DropdownMenuLink.d.ts +9 -8
- package/DropdownMenu/components/DropdownMenuSeparator.d.ts +7 -6
- package/EditableTitle/EditableTitle.d.ts +7 -6
- package/EmptyState/EmptyState.d.ts +43 -0
- package/EmptyState/EmptyState.js +93 -0
- package/EmptyState/EmptyState.js.map +1 -0
- package/EmptyState/EmptyState.stories.d.ts +13 -0
- package/EmptyState/EmptyState.stories.js +136 -0
- package/EmptyState/EmptyState.stories.js.map +1 -0
- package/EmptyState/illustrations/ContentIllustration.d.ts +2 -0
- package/EmptyState/illustrations/ContentIllustration.js +100 -0
- package/EmptyState/illustrations/ContentIllustration.js.map +1 -0
- package/EmptyState/illustrations/LayoutIllustration.d.ts +2 -0
- package/EmptyState/illustrations/LayoutIllustration.js +93 -0
- package/EmptyState/illustrations/LayoutIllustration.js.map +1 -0
- package/EmptyState/illustrations/ListingIllustration.d.ts +2 -0
- package/EmptyState/illustrations/ListingIllustration.js +92 -0
- package/EmptyState/illustrations/ListingIllustration.js.map +1 -0
- package/EmptyState/illustrations/SelectIllustration.d.ts +2 -0
- package/EmptyState/illustrations/SelectIllustration.js +100 -0
- package/EmptyState/illustrations/SelectIllustration.js.map +1 -0
- package/EmptyState/illustrations/TableIllustration.d.ts +2 -0
- package/EmptyState/illustrations/TableIllustration.js +233 -0
- package/EmptyState/illustrations/TableIllustration.js.map +1 -0
- package/EmptyState/illustrations/UploadIllustration.d.ts +2 -0
- package/EmptyState/illustrations/UploadIllustration.js +77 -0
- package/EmptyState/illustrations/UploadIllustration.js.map +1 -0
- package/EmptyState/illustrations/index.d.ts +6 -0
- package/EmptyState/illustrations/index.js +6 -0
- package/EmptyState/index.d.ts +1 -0
- package/EmptyState/index.js +1 -0
- package/FilePicker/FilePicker.d.ts +19 -18
- package/FilePicker/FilePicker.stories.d.ts +0 -6
- package/FilePicker/FilePicker.stories.js +1 -24
- package/FilePicker/FilePicker.stories.js.map +1 -1
- package/FilePicker/primitives/FilePickerPrimitive.d.ts +20 -19
- package/FilePicker/primitives/components/Trigger.d.ts +1 -1
- package/FilePicker/primitives/components/previews/ImagePreview/ImagePreview.d.ts +19 -7
- package/FilePicker/primitives/components/previews/ImagePreview/ImagePreview.js +15 -6
- package/FilePicker/primitives/components/previews/ImagePreview/ImagePreview.js.map +1 -1
- package/FilePicker/primitives/components/previews/ItemActions.js +1 -1
- package/FilePicker/primitives/components/previews/ItemActions.js.map +1 -1
- package/FilePicker/primitives/components/previews/ItemDescription.js +1 -1
- package/FilePicker/primitives/components/previews/ItemDescription.js.map +1 -1
- package/FilePicker/primitives/components/previews/RichItemPreview/RichItemPreview.d.ts +12 -6
- package/FilePicker/primitives/components/previews/RichItemPreview/RichItemPreview.js +13 -52
- package/FilePicker/primitives/components/previews/RichItemPreview/RichItemPreview.js.map +1 -1
- package/FilePicker/primitives/components/previews/RichItemPreview/RichItemThumbnail.d.ts +8 -4
- package/FilePicker/primitives/components/previews/RichItemPreview/RichItemThumbnail.js +66 -8
- package/FilePicker/primitives/components/previews/RichItemPreview/RichItemThumbnail.js.map +1 -1
- package/FilePicker/primitives/components/previews/TextOnlyPreview/TextOnlyPreview.d.ts +7 -6
- package/FilePicker/primitives/components/previews/index.d.ts +0 -1
- package/FilePicker/primitives/components/previews/index.js +0 -1
- package/FilePicker/primitives/components/previews/variants.d.ts +1 -1
- package/FillViewport/FillViewport.d.ts +21 -18
- package/FormComponent/Description.d.ts +7 -6
- package/FormComponent/ErrorMessage.d.ts +7 -6
- package/FormComponent/Label.d.ts +7 -6
- package/FormComponent/Note.d.ts +7 -6
- package/Grid/Grid.d.ts +24 -22
- package/HeaderBar/HeaderBar.d.ts +7 -6
- package/Heading/Heading.d.ts +8 -7
- package/Icon/Icon.d.ts +9 -8
- package/IconPicker/IconPicker.d.ts +7 -6
- package/IconPicker/primitives/IconPickerPrimitive.d.ts +1 -1
- package/IconPicker/primitives/components/IconPickerTrigger.d.ts +1 -1
- package/ImageEditor/AspectRatioPreview.d.ts +16 -0
- package/ImageEditor/AspectRatioPreview.js +26 -0
- package/ImageEditor/AspectRatioPreview.js.map +1 -0
- package/ImageEditor/CropHotspotEditor.d.ts +22 -0
- package/ImageEditor/CropHotspotEditor.js +402 -0
- package/ImageEditor/CropHotspotEditor.js.map +1 -0
- package/ImageEditor/ImageEditor.d.ts +18 -0
- package/ImageEditor/ImageEditor.js +151 -0
- package/ImageEditor/ImageEditor.js.map +1 -0
- package/ImageEditor/ImageEditor.stories.d.ts +6 -0
- package/ImageEditor/ImageEditor.stories.js +42 -0
- package/ImageEditor/ImageEditor.stories.js.map +1 -0
- package/ImageEditor/MetaFields.d.ts +12 -0
- package/ImageEditor/MetaFields.js +20 -0
- package/ImageEditor/MetaFields.js.map +1 -0
- package/ImageEditor/SectionLabel.d.ts +8 -0
- package/ImageEditor/SectionLabel.js +7 -0
- package/ImageEditor/SectionLabel.js.map +1 -0
- package/ImageEditor/geometry.d.ts +46 -0
- package/ImageEditor/geometry.js +126 -0
- package/ImageEditor/geometry.js.map +1 -0
- package/ImageEditor/index.d.ts +3 -0
- package/ImageEditor/index.js +3 -0
- package/ImageEditor/types.d.ts +52 -0
- package/ImageEditor/types.js +35 -0
- package/ImageEditor/types.js.map +1 -0
- package/Input/Input.d.ts +7 -6
- package/Input/InputPrimitive.d.ts +9 -8
- package/Label/Label.d.ts +8 -7
- package/Label/components/LabelValue.d.ts +1 -1
- package/Link/Link.d.ts +3 -3
- package/Link/Link.js +1 -1
- package/Link/Link.js.map +1 -1
- package/List/List.d.ts +8 -7
- package/List/components/ListItem.d.ts +7 -6
- package/List/components/ListItemAction.d.ts +7 -6
- package/List/components/ListItemHandle.d.ts +7 -6
- package/List/components/ListItemIcon.d.ts +7 -6
- package/List/components/ListItemSeparator.d.ts +7 -6
- package/Loader/Loader.d.ts +9 -8
- package/Loader/OverlayLoader.d.ts +7 -6
- package/Markdown/Markdown.d.ts +47 -0
- package/Markdown/Markdown.js +17 -0
- package/Markdown/Markdown.js.map +1 -0
- package/Markdown/index.d.ts +1 -0
- package/Markdown/index.js +1 -0
- package/MultiAutoComplete/MultiAutoComplete.d.ts +7 -6
- package/MultiAutoComplete/primitives/MultiAutoCompletePrimitive.d.ts +7 -6
- package/MultiAutoComplete/primitives/presenters/MultiAutoCompletePresenterWithFreeInput.d.ts +3 -3
- package/MultiAutoComplete/primitives/useMultiAutoComplete.d.ts +3 -3
- package/MultiFilePicker/MultiFilePicker.d.ts +19 -18
- package/MultiFilePicker/primitives/MultiFilePickerPrimitive.d.ts +19 -18
- package/MultiSelect/MultiSelect.d.ts +7 -6
- package/MultiSelect/primitives/MultiSelectPrimitive.d.ts +10 -6
- package/MultiSelect/primitives/MultiSelectPrimitive.js +1 -1
- package/MultiSelect/primitives/MultiSelectPrimitive.js.map +1 -1
- package/Popover/Popover.d.ts +7 -6
- package/Popover/primitives/PopoverPrimitive.d.ts +7 -7
- package/ProgressBar/ProgressBar.d.ts +7 -6
- package/RadioGroup/RadioGroup.d.ts +7 -6
- package/RadioGroup/primitives/Radio.d.ts +7 -6
- package/RadioGroup/primitives/RadioGroupPrimitive.d.ts +5 -1
- package/RangeSlider/RangeSlider.d.ts +7 -6
- package/SegmentedControl/SegmentedControl.d.ts +8 -7
- package/SegmentedControl/SegmentedControlTabs.d.ts +5 -2
- package/SegmentedControl/primitives/SegmentedControlPrimitive.d.ts +1 -1
- package/Select/Select.d.ts +7 -6
- package/Select/primitives/components/SelectContent.js +1 -1
- package/Select/primitives/components/SelectContent.js.map +1 -1
- package/Select/primitives/components/SelectTrigger.d.ts +2 -2
- package/Separator/Separator.d.ts +9 -8
- package/Sidebar/Sidebar.d.ts +7 -6
- package/Sidebar/components/SidebarContent.js +1 -1
- package/Sidebar/components/SidebarContent.js.map +1 -1
- package/Sidebar/components/SidebarIcon.d.ts +7 -6
- package/Sidebar/components/SidebarProvider.d.ts +4 -4
- package/Sidebar/components/SidebarRoot.js +1 -1
- package/Sidebar/components/SidebarRoot.js.map +1 -1
- package/Sidebar/components/items/SidebarMenuGroup.d.ts +9 -8
- package/Sidebar/components/items/SidebarMenuItem.d.ts +11 -10
- package/Sidebar/components/items/SidebarMenuItemIcon.d.ts +7 -6
- package/Sidebar/components/items/SidebarMenuLink.d.ts +11 -10
- package/Sidebar/components/items/SidebarMenuProvider.d.ts +4 -4
- package/Sidebar/components/items/SidebarMenuRootItem.d.ts +9 -7
- package/Sidebar/components/items/SidebarMenuSubButton.js +5 -8
- package/Sidebar/components/items/SidebarMenuSubButton.js.map +1 -1
- package/Sidebar/components/items/SidebarMenuSubItem.js +3 -3
- package/Sidebar/components/items/SidebarMenuSubItem.js.map +1 -1
- package/Skeleton/Skeleton.d.ts +9 -7
- package/Skeleton/Skeleton.js +10 -4
- package/Skeleton/Skeleton.js.map +1 -1
- package/Skeleton/Skeleton.stories.d.ts +2 -0
- package/Skeleton/Skeleton.stories.js +28 -2
- package/Skeleton/Skeleton.stories.js.map +1 -1
- package/Slider/Slider.d.ts +7 -6
- package/SteppedProgress/SteppedProgress.d.ts +7 -6
- package/SteppedProgress/SteppedProgressItem.d.ts +7 -6
- package/Switch/Switch.d.ts +7 -6
- package/Switch/primitives/SwitchPrimitive.d.ts +10 -6
- package/Table/Table.d.ts +12 -10
- package/Table/components/Direction.d.ts +1 -1
- package/Tabs/Tabs.d.ts +8 -6
- package/Tabs/Tabs.js +5 -2
- package/Tabs/Tabs.js.map +1 -1
- package/Tabs/components/Content.d.ts +1 -1
- package/Tabs/components/List.d.ts +2 -2
- package/Tabs/components/Tab.d.ts +7 -6
- package/Tabs/components/Trigger.d.ts +3 -2
- package/Tabs/components/Trigger.js +8 -3
- package/Tabs/components/Trigger.js.map +1 -1
- package/Tag/Tag.d.ts +8 -7
- package/Tags/Tags.d.ts +7 -6
- package/Tags/primitives/TagsPrimitive.d.ts +7 -6
- package/Text/Text.d.ts +8 -7
- package/Textarea/Textarea.d.ts +7 -6
- package/Textarea/TextareaPrimitive.d.ts +9 -8
- package/Toast/Toast.d.ts +7 -6
- package/Toast/components/ToastActions.d.ts +7 -6
- package/Toast/components/ToastDescription.d.ts +7 -6
- package/Toast/components/ToastTitle.d.ts +7 -6
- package/Toast/useToast.stories.js.map +1 -1
- package/Toggle/Toggle.d.ts +7 -6
- package/Toggle/primitives/TogglePrimitive.d.ts +13 -9
- package/ToggleGroup/ToggleGroup.d.ts +7 -6
- package/ToggleGroup/primitives/ToggleGroupPrimitive.d.ts +13 -9
- package/Tooltip/Tooltip.d.ts +7 -6
- package/Tree/Tree.d.ts +7 -6
- package/Tree/components/Item.d.ts +7 -6
- package/Tree/components/ItemCollapseTrigger.d.ts +7 -6
- package/Tree/components/ItemContent.d.ts +8 -6
- package/Tree/components/ItemDragHandle.d.ts +7 -6
- package/Tree/components/ItemIcon.d.ts +7 -6
- package/Tree/components/ItemPlaceholder.d.ts +7 -6
- package/Tree/components/ItemSubIndentation.d.ts +7 -6
- package/Tree/useTree.js +2 -6
- package/Tree/useTree.js.map +1 -1
- package/Widget/Widget.d.ts +8 -22
- package/Widget/components/Icon.d.ts +7 -6
- package/Widget/components/WidgetAction.d.ts +8 -6
- package/Widget/components/WidgetContent.d.ts +5 -5
- package/exports/admin/ui.d.ts +2 -0
- package/exports/admin/ui.js +2 -0
- package/index.d.ts +5 -0
- package/index.js +5 -0
- package/package.json +29 -29
- package/theme.css +22 -1
- package/utils.js +52 -34
- package/utils.js.map +1 -1
- package/FilePicker/primitives/components/previews/RichItemPreview/FileType.d.ts +0 -9
- package/FilePicker/primitives/components/previews/RichItemPreview/FileType.js +0 -45
- package/FilePicker/primitives/components/previews/RichItemPreview/FileType.js.map +0 -1
- package/FilePicker/primitives/components/previews/RichItemPreview/Placeholder.d.ts +0 -8
- package/FilePicker/primitives/components/previews/RichItemPreview/Placeholder.js +0 -14
- package/FilePicker/primitives/components/previews/RichItemPreview/Placeholder.js.map +0 -1
- package/FilePicker/primitives/components/previews/RichItemPreview/Thumbnail.d.ts +0 -11
- package/FilePicker/primitives/components/previews/RichItemPreview/Thumbnail.js +0 -20
- package/FilePicker/primitives/components/previews/RichItemPreview/Thumbnail.js.map +0 -1
- package/FilePicker/primitives/components/previews/RichItemPreview/ThumbnailActions.d.ts +0 -15
- package/FilePicker/primitives/components/previews/RichItemPreview/ThumbnailActions.js +0 -46
- package/FilePicker/primitives/components/previews/RichItemPreview/ThumbnailActions.js.map +0 -1
- package/FilePicker/primitives/components/previews/TruncatedFileName.d.ts +0 -11
- package/FilePicker/primitives/components/previews/TruncatedFileName.js +0 -20
- package/FilePicker/primitives/components/previews/TruncatedFileName.js.map +0 -1
- package/FilePicker/primitives/components/previews/fileName.d.ts +0 -12
- package/FilePicker/primitives/components/previews/fileName.js +0 -26
- 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?: "
|
|
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
|
|
67
|
-
|
|
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:
|
|
72
|
-
original:
|
|
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<
|
|
80
|
-
original:
|
|
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?: "
|
|
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
|
-
|
|
5
|
-
|
|
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:
|
|
10
|
-
original:
|
|
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<
|
|
18
|
-
original:
|
|
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
|
|
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("
|
|
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
|
|
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 {
|
|
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
|
|
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
|
|
7
|
-
|
|
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:
|
|
12
|
-
original:
|
|
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<
|
|
20
|
-
original:
|
|
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("
|
|
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: "
|
|
16
|
+
className: "flex items-center justify-between gap-sm-extra min-w-0"
|
|
36
17
|
}, /*#__PURE__*/ react.createElement("div", {
|
|
37
|
-
className: "flex flex-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
*
|
|
9
|
-
*
|
|
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
|
-
|
|
12
|
+
renderImage?: (args: {
|
|
13
|
+
url: string;
|
|
14
|
+
name: string;
|
|
15
|
+
}) => React.ReactNode;
|
|
12
16
|
};
|
|
13
|
-
declare const RichItemThumbnail: ({ url, name, className, mimeType, preview, disabled,
|
|
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
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
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",
|
|
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
|
|
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
|
|
10
|
-
|
|
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:
|
|
15
|
-
original:
|
|
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<
|
|
23
|
-
original:
|
|
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;
|