@webiny/admin-ui 6.4.12-beta.5 → 6.5.0-beta.0
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/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 +13 -22
- package/DataTable/DataTable.js +6 -14
- package/DataTable/DataTable.js.map +1 -1
- package/DataTable/components/ColumnsVisibility.d.ts +4 -5
- package/DataTable/components/ColumnsVisibility.js +3 -6
- package/DataTable/components/ColumnsVisibility.js.map +1 -1
- package/DatePicker/DatePicker.d.ts +11 -7
- package/DatePicker/DatePicker.js +10 -2
- package/DatePicker/DatePicker.js.map +1 -1
- package/DatePicker/primitives/DatePickerPrimitive.d.ts +7 -6
- package/DatePicker/primitives/DateTimePicker.d.ts +1 -1
- package/DatePicker/primitives/DateTimePicker.js +23 -16
- 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/dateHelpers.d.ts +1 -1
- package/DatePicker/utils/dateHelpers.js +2 -1
- package/DatePicker/utils/dateHelpers.js.map +1 -1
- package/DatePicker/utils/timezoneHelpers.d.ts +3 -0
- package/DatePicker/utils/timezoneHelpers.js +32 -0
- package/DatePicker/utils/timezoneHelpers.js.map +1 -0
- 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.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/FileType.d.ts +0 -4
- package/FilePicker/primitives/components/previews/RichItemPreview/FileType.js.map +1 -1
- package/FilePicker/primitives/components/previews/RichItemPreview/Placeholder.d.ts +0 -3
- package/FilePicker/primitives/components/previews/RichItemPreview/Placeholder.js.map +1 -1
- package/FilePicker/primitives/components/previews/RichItemPreview/RichItemPreview.d.ts +12 -6
- package/FilePicker/primitives/components/previews/RichItemPreview/RichItemPreview.js +6 -4
- package/FilePicker/primitives/components/previews/RichItemPreview/RichItemPreview.js.map +1 -1
- package/FilePicker/primitives/components/previews/RichItemPreview/RichItemThumbnail.d.ts +6 -1
- package/FilePicker/primitives/components/previews/RichItemPreview/RichItemThumbnail.js +3 -2
- package/FilePicker/primitives/components/previews/RichItemPreview/RichItemThumbnail.js.map +1 -1
- package/FilePicker/primitives/components/previews/RichItemPreview/Thumbnail.d.ts +5 -5
- package/FilePicker/primitives/components/previews/RichItemPreview/Thumbnail.js +7 -3
- package/FilePicker/primitives/components/previews/RichItemPreview/Thumbnail.js.map +1 -1
- package/FilePicker/primitives/components/previews/RichItemPreview/ThumbnailActions.d.ts +0 -5
- package/FilePicker/primitives/components/previews/RichItemPreview/ThumbnailActions.js.map +1 -1
- package/FilePicker/primitives/components/previews/TextOnlyPreview/TextOnlyPreview.d.ts +7 -6
- package/FilePicker/primitives/components/previews/TruncatedFileName.d.ts +0 -4
- package/FilePicker/primitives/components/previews/TruncatedFileName.js.map +1 -1
- package/FilePicker/primitives/components/previews/fileName.d.ts +0 -8
- package/FilePicker/primitives/components/previews/fileName.js.map +1 -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/domains/IconPickerIcon.js +1 -1
- package/IconPicker/domains/IconPickerIcon.js.map +1 -1
- 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 +2 -2
- 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/MultiAutoComplete/MultiAutoComplete.d.ts +7 -6
- package/MultiAutoComplete/primitives/MultiAutoCompletePrimitive.d.ts +7 -6
- package/MultiAutoComplete/primitives/presenters/MultiAutoCompletePresenter.test.js +1 -1
- package/MultiAutoComplete/primitives/presenters/MultiAutoCompletePresenter.test.js.map +1 -1
- package/MultiAutoComplete/primitives/presenters/MultiAutoCompletePresenterWithFreeInput.d.ts +3 -3
- package/MultiAutoComplete/primitives/useMultiAutoComplete.d.ts +3 -3
- package/MultiAutoComplete/primitives/useMultiAutoComplete.js +2 -3
- package/MultiAutoComplete/primitives/useMultiAutoComplete.js.map +1 -1
- 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/SidebarIcon.d.ts +7 -6
- package/Sidebar/components/SidebarProvider.d.ts +4 -4
- 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/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/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 +3 -0
- package/index.js +3 -0
- package/package.json +25 -25
- package/theme.css +13 -1
- package/utils.js +52 -34
- package/utils.js.map +1 -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"}
|
|
@@ -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 {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;OACpEF,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"}
|
|
@@ -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"}
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { FileItemFormatted } from "../../../../../FilePicker/index.js";
|
|
3
3
|
type FileTypeProps = Pick<FileItemFormatted, "mimeType" | "name">;
|
|
4
|
-
/**
|
|
5
|
-
* The stand-in for a file that cannot be shown as a picture: an icon of its format, falling back
|
|
6
|
-
* to a generic one for anything unrecognised.
|
|
7
|
-
*/
|
|
8
4
|
declare const FileType: ({ mimeType, name }: FileTypeProps) => React.JSX.Element;
|
|
9
5
|
export { FileType, type FileTypeProps };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilePicker/primitives/components/previews/RichItemPreview/FileType.js","sources":["../../../../../../src/FilePicker/primitives/components/previews/RichItemPreview/FileType.tsx"],"sourcesContent":["import React from \"react\";\nimport type { FileItemFormatted } from \"~/FilePicker/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 FileTypeProps = Pick<FileItemFormatted, \"mimeType\" | \"name\">;\n\
|
|
1
|
+
{"version":3,"file":"FilePicker/primitives/components/previews/RichItemPreview/FileType.js","sources":["../../../../../../src/FilePicker/primitives/components/previews/RichItemPreview/FileType.tsx"],"sourcesContent":["import React from \"react\";\nimport type { FileItemFormatted } from \"~/FilePicker/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 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 (\n <img\n src={getMimeTypeSrc(mimeType)}\n alt={name}\n className=\"size-full object-contain p-sm-extra\"\n />\n );\n};\n\nexport { FileType, type FileTypeProps };\n"],"names":["FileType","mimeType","name","getMimeTypeSrc","csvThumb","docThumb","docxThumb","pdfThumb","pptThumb","pptxThumb","txtThumb","xlsThumb","xlsxThumb","fileThumb"],"mappings":";;;;;;;;;;;AAgBA,MAAMA,WAAW,CAAC,EAAEC,WAAW,EAAE,EAAEC,IAAI,EAAiB;IACpD,MAAMC,iBAAiB,CAACF;QACpB,OAAQA;YACJ,KAAK;gBACD,OAAOG;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,GACI,oBAAC;QACG,KAAKV,eAAeF;QACpB,KAAKC;QACL,WAAU;;AAGtB"}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { FileItemFormatted } from "../../../../../FilePicker/index.js";
|
|
3
3
|
type PlaceholderProps = Pick<FileItemFormatted, "name">;
|
|
4
|
-
/**
|
|
5
|
-
* Shown when the caller asks for a placeholder rather than the file's own preview.
|
|
6
|
-
*/
|
|
7
4
|
declare const Placeholder: ({ name }: PlaceholderProps) => React.JSX.Element;
|
|
8
5
|
export { Placeholder, type PlaceholderProps };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilePicker/primitives/components/previews/RichItemPreview/Placeholder.js","sources":["../../../../../../src/FilePicker/primitives/components/previews/RichItemPreview/Placeholder.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\";\n\ntype PlaceholderProps = Pick<FileItemFormatted, \"name\">;\n\
|
|
1
|
+
{"version":3,"file":"FilePicker/primitives/components/previews/RichItemPreview/Placeholder.js","sources":["../../../../../../src/FilePicker/primitives/components/previews/RichItemPreview/Placeholder.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\";\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\nexport { Placeholder, type PlaceholderProps };\n"],"names":["Placeholder","name","Icon","PlaceholderIcon"],"mappings":";;;AAOA,MAAMA,cAAc,CAAC,EAAEC,IAAI,EAAoB,GACpC,WAAP,GACI,oBAAC;QAAI,WAAW;qBACZ,oBAACC,MAAIA;QAAC,oBAAM,oBAACC,gBAAeA;QAAK,OAAOF;QAAM,MAAM;QAAM,OAAO"}
|
|
@@ -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;
|
|
@@ -8,7 +8,7 @@ import { ItemDescription } from "../ItemDescription.js";
|
|
|
8
8
|
import { ItemActions } from "../ItemActions.js";
|
|
9
9
|
import { TruncatedFileName } from "../TruncatedFileName.js";
|
|
10
10
|
import { previewVariants } from "../variants.js";
|
|
11
|
-
const DecoratableRichItemPreview = ({ className, disabled, onRemoveItem, onReplaceItem, onEditItem, value, variant, preview, ...props })=>{
|
|
11
|
+
const DecoratableRichItemPreview = ({ className, disabled, onRemoveItem, onReplaceItem, onEditItem, value, variant, preview, renderImage, ...props })=>{
|
|
12
12
|
const actions = {
|
|
13
13
|
onRemoveItem,
|
|
14
14
|
onReplaceItem,
|
|
@@ -25,7 +25,7 @@ const DecoratableRichItemPreview = ({ className, disabled, onRemoveItem, onRepla
|
|
|
25
25
|
].filter(Boolean).join(" - ");
|
|
26
26
|
return /*#__PURE__*/ react.createElement("div", {
|
|
27
27
|
"data-testid": "image-preview",
|
|
28
|
-
className: cn("
|
|
28
|
+
className: cn("w-full rounded-md @container", previewVariants({
|
|
29
29
|
variant,
|
|
30
30
|
disabled
|
|
31
31
|
}), className),
|
|
@@ -42,7 +42,8 @@ const DecoratableRichItemPreview = ({ className, disabled, onRemoveItem, onRepla
|
|
|
42
42
|
...value,
|
|
43
43
|
variant: "banner",
|
|
44
44
|
disabled: disabled,
|
|
45
|
-
preview: preview
|
|
45
|
+
preview: preview,
|
|
46
|
+
renderImage: renderImage
|
|
46
47
|
}), /*#__PURE__*/ react.createElement(ThumbnailActions, actions)), /*#__PURE__*/ react.createElement("div", {
|
|
47
48
|
className: "flex flex-col gap-xxs min-w-0 px-xxs pb-xxs"
|
|
48
49
|
}, /*#__PURE__*/ react.createElement(TruncatedFileName, {
|
|
@@ -60,7 +61,8 @@ const DecoratableRichItemPreview = ({ className, disabled, onRemoveItem, onRepla
|
|
|
60
61
|
}, /*#__PURE__*/ react.createElement(RichItemThumbnail, {
|
|
61
62
|
...value,
|
|
62
63
|
disabled: disabled,
|
|
63
|
-
preview: preview
|
|
64
|
+
preview: preview,
|
|
65
|
+
renderImage: renderImage
|
|
64
66
|
})), /*#__PURE__*/ react.createElement(ItemDescription, {
|
|
65
67
|
item: value,
|
|
66
68
|
disabled: disabled,
|
|
@@ -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
|
|
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 /** 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 const actions = { onRemoveItem, onReplaceItem, onEditItem, disabled };\n\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 \"w-full rounded-md @container\",\n previewVariants({ variant, disabled }),\n className\n )}\n {...props}\n >\n {/* Stacked layout for narrow containers (below 280px). */}\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 renderImage={renderImage}\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 {/* Side-by-side layout for wider containers (280px+). */}\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\n {...value}\n disabled={disabled}\n preview={preview}\n renderImage={renderImage}\n />\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","renderImage","props","actions","formattedSize","bytes","details","Boolean","cn","previewVariants","RichItemThumbnail","ThumbnailActions","TruncatedFileName","Text","ItemDescription","ItemActions","RichItemPreview","makeDecoratable"],"mappings":";;;;;;;;;;AAkBA,MAAMA,6BAA6B,CAAC,EAChCC,SAAS,EACTC,QAAQ,EACRC,YAAY,EACZC,aAAa,EACbC,UAAU,EACVC,KAAK,EACLC,OAAO,EACPC,OAAO,EACPC,WAAW,EACX,GAAGC,OACgB;IACnB,MAAMC,UAAU;QAAER;QAAcC;QAAeC;QAAYH;IAAS;IAEpE,MAAMU,gBAAgBN,MAAM,IAAI,GAC1BO,MAAM,MAAM,CAACP,MAAM,IAAI,EAAE;QAAE,eAAe;QAAK,eAAe;IAAE,KAChE;IACN,MAAMQ,UAAU;QAACR,MAAM,QAAQ;QAAEM;KAAc,CAAC,MAAM,CAACG,SAAS,IAAI,CAAC;IAErE,OAAO,WAAP,GACI,oBAAC;QACG,eAAY;QACZ,WAAWC,GACP,gCACAC,gBAAgB;YAAEV;YAASL;QAAS,IACpCD;QAEH,GAAGS,KAAK;qBAGT,oBAAC;QAAI,aAAU;QAAe,WAAW;qBACrC,oBAAC;QAAI,WAAW;qBACZ,oBAAC;QAAI,WAAW;QAAiC,SAASN;qBACtD,oBAACc,mBAAiBA;QACb,GAAGZ,KAAK;QACT,SAAS;QACT,UAAUJ;QACV,SAASM;QACT,aAAaC;sBAEjB,oBAACU,kBAAqBR,WAAAA,WAAAA,GAG1B,oBAAC;QAAI,WAAW;qBACZ,oBAACS,mBAAiBA;QACd,MAAMd,MAAM,IAAI;QAChB,WAAWJ,WAAW,0BAA0B;QAEnDY,UAAU,WAAVA,GACG,oBAACO,MAAIA;QACD,MAAK;QACL,WAAWL,GACP,YACAd,WAAW,0BAA0B;OAGxCY,WAEL,uBAMhB,oBAAC;QACG,aAAU;QACV,WAAW;qBAEX,oBAAC;QAAI,WAAW;QAA2B,SAASV;qBAChD,oBAACc,mBAAiBA;QACb,GAAGZ,KAAK;QACT,UAAUJ;QACV,SAASM;QACT,aAAaC;uBAIrB,oBAACa,iBAAeA;QACZ,MAAMhB;QACN,UAAUJ;QACV,SAASE;QACT,WAAW;sBAGf,oBAACmB,aAAWA;QAAE,GAAGZ,OAAO;QAAE,WAAW;;AAIrD;AAEA,MAAMa,kBAAkBC,gBAAgB,mBAAmBzB"}
|
|
@@ -9,6 +9,11 @@ type RichItemThumbnailProps = Omit<React.HTMLAttributes<HTMLDivElement>, "childr
|
|
|
9
9
|
* width of a stacked layout, where the panel is too narrow to afford a column for it.
|
|
10
10
|
*/
|
|
11
11
|
variant?: "tile" | "banner";
|
|
12
|
+
/** Optional custom image renderer for the thumbnail (e.g. a cropped preview). */
|
|
13
|
+
renderImage?: (args: {
|
|
14
|
+
url: string;
|
|
15
|
+
name: string;
|
|
16
|
+
}) => React.ReactNode;
|
|
12
17
|
};
|
|
13
|
-
declare const RichItemThumbnail: ({ url, name, className, mimeType, preview, disabled, variant }: RichItemThumbnailProps) => React.JSX.Element;
|
|
18
|
+
declare const RichItemThumbnail: ({ url, name, className, mimeType, preview, disabled, variant, renderImage }: RichItemThumbnailProps) => React.JSX.Element;
|
|
14
19
|
export { RichItemThumbnail, type RichItemThumbnailProps };
|
|
@@ -3,14 +3,15 @@ import { cn } from "../../../../../utils.js";
|
|
|
3
3
|
import { FileType } from "./FileType.js";
|
|
4
4
|
import { Placeholder } from "./Placeholder.js";
|
|
5
5
|
import { Thumbnail } from "./Thumbnail.js";
|
|
6
|
-
const RichItemThumbnail = ({ url, name, className, mimeType, preview, disabled, variant = "tile" })=>{
|
|
6
|
+
const RichItemThumbnail = ({ url, name, className, mimeType, preview, disabled, variant = "tile", renderImage })=>{
|
|
7
7
|
const isImage = mimeType?.startsWith("image/");
|
|
8
8
|
return /*#__PURE__*/ react.createElement("div", {
|
|
9
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
10
|
}, "thumbnail" === preview || isImage ? /*#__PURE__*/ react.createElement(Thumbnail, {
|
|
11
11
|
url: url,
|
|
12
12
|
name: name,
|
|
13
|
-
fit: "banner" === variant ? "contain" : "cover"
|
|
13
|
+
fit: "banner" === variant ? "contain" : "cover",
|
|
14
|
+
renderImage: renderImage
|
|
14
15
|
}) : "placeholder" === preview ? /*#__PURE__*/ react.createElement(Placeholder, {
|
|
15
16
|
name: name
|
|
16
17
|
}) : /*#__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
|
|
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 /** Optional custom image renderer for the thumbnail (e.g. a cropped preview). */\n renderImage?: (args: { url: string; name: string }) => React.ReactNode;\n };\n\nconst RichItemThumbnail = ({\n url,\n name,\n className,\n mimeType,\n preview,\n disabled,\n variant = \"tile\",\n renderImage\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\n url={url}\n name={name}\n fit={variant === \"banner\" ? \"contain\" : \"cover\"}\n renderImage={renderImage}\n />\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","renderImage","isImage","cn","Thumbnail","Placeholder","FileType"],"mappings":";;;;;AAqBA,MAAMA,oBAAoB,CAAC,EACvBC,GAAG,EACHC,IAAI,EACJC,SAAS,EACTC,QAAQ,EACRC,OAAO,EACPC,QAAQ,EACRC,UAAU,MAAM,EAChBC,WAAW,EACU;IACrB,MAAMC,UAAUL,UAAU,WAAW;IAErC,OAAO,WAAP,GACI,oBAAC;QACG,WAAWM,GACP,uCACAH,AAAY,aAAZA,UAAuB,oBAAoB,oBAC3CD,YAAY,uDACZH;OAGHE,AAAY,gBAAZA,WAA2BI,UAAU,WAAVA,GACxB,oBAACE,WAASA;QACN,KAAKV;QACL,MAAMC;QACN,KAAKK,AAAY,aAAZA,UAAuB,YAAY;QACxC,aAAaC;SAEjBH,AAAY,kBAAZA,UAA4B,WAAhB,GACZ,oBAACO,aAAWA;QAAC,MAAMV;uBAEnB,oBAACW,UAAQA;QAAC,UAAUT;QAAU,MAAMF;;AAIpD"}
|
|
@@ -2,10 +2,10 @@ import React from "react";
|
|
|
2
2
|
import type { FileItemFormatted } from "../../../../../FilePicker/index.js";
|
|
3
3
|
type ThumbnailProps = Pick<FileItemFormatted, "url" | "name"> & {
|
|
4
4
|
fit: "cover" | "contain";
|
|
5
|
+
renderImage?: (args: {
|
|
6
|
+
url: string;
|
|
7
|
+
name: string;
|
|
8
|
+
}) => React.ReactNode;
|
|
5
9
|
};
|
|
6
|
-
|
|
7
|
-
* The file's own image. `cover` fills its box and crops what does not fit, which suits the small
|
|
8
|
-
* square tile; `contain` shows the whole picture, which suits the banner.
|
|
9
|
-
*/
|
|
10
|
-
declare const Thumbnail: ({ url, name, fit }: ThumbnailProps) => React.JSX.Element;
|
|
10
|
+
declare const Thumbnail: ({ url, name, fit, renderImage }: ThumbnailProps) => React.JSX.Element;
|
|
11
11
|
export { Thumbnail, type ThumbnailProps };
|
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import react from "react";
|
|
2
|
-
const Thumbnail = ({ url, name, fit })=>{
|
|
2
|
+
const Thumbnail = ({ url, name, fit, renderImage })=>{
|
|
3
|
+
const customImage = "function" == typeof renderImage ? renderImage({
|
|
4
|
+
url,
|
|
5
|
+
name
|
|
6
|
+
}) : false;
|
|
3
7
|
if ("contain" === fit) return /*#__PURE__*/ react.createElement("div", {
|
|
4
8
|
className: "size-full p-xs bg-neutral-muted flex items-center justify-center"
|
|
5
|
-
}, /*#__PURE__*/ react.createElement("img", {
|
|
9
|
+
}, customImage || /*#__PURE__*/ react.createElement("img", {
|
|
6
10
|
src: url,
|
|
7
11
|
alt: name,
|
|
8
12
|
className: "max-h-full max-w-full rounded-xs"
|
|
9
13
|
}));
|
|
10
14
|
return /*#__PURE__*/ react.createElement("div", {
|
|
11
15
|
className: "size-full bg-neutral-muted"
|
|
12
|
-
}, /*#__PURE__*/ react.createElement("img", {
|
|
16
|
+
}, customImage || /*#__PURE__*/ react.createElement("img", {
|
|
13
17
|
src: url,
|
|
14
18
|
alt: name,
|
|
15
19
|
className: "size-full object-cover"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilePicker/primitives/components/previews/RichItemPreview/Thumbnail.js","sources":["../../../../../../src/FilePicker/primitives/components/previews/RichItemPreview/Thumbnail.tsx"],"sourcesContent":["import React from \"react\";\nimport type { FileItemFormatted } from \"~/FilePicker/index.js\";\n\ntype ThumbnailProps = Pick<FileItemFormatted, \"url\" | \"name\"> & {\n fit: \"cover\" | \"contain\";\n
|
|
1
|
+
{"version":3,"file":"FilePicker/primitives/components/previews/RichItemPreview/Thumbnail.js","sources":["../../../../../../src/FilePicker/primitives/components/previews/RichItemPreview/Thumbnail.tsx"],"sourcesContent":["import React from \"react\";\nimport type { FileItemFormatted } from \"~/FilePicker/index.js\";\n\ntype ThumbnailProps = Pick<FileItemFormatted, \"url\" | \"name\"> & {\n fit: \"cover\" | \"contain\";\n renderImage?: (args: { url: string; name: string }) => React.ReactNode;\n};\n\nconst Thumbnail = ({ url, name, fit, renderImage }: ThumbnailProps) => {\n const customImage = typeof renderImage === \"function\" ? renderImage({ url, name }) : false;\n\n if (fit === \"contain\") {\n return (\n <div className={\"size-full p-xs bg-neutral-muted flex items-center justify-center\"}>\n {customImage || (\n <img src={url} alt={name} className={\"max-h-full max-w-full rounded-xs\"} />\n )}\n </div>\n );\n }\n\n return (\n <div className={\"size-full bg-neutral-muted\"}>\n {customImage || <img src={url} alt={name} className={\"size-full object-cover\"} />}\n </div>\n );\n};\n\nexport { Thumbnail, type ThumbnailProps };\n"],"names":["Thumbnail","url","name","fit","renderImage","customImage"],"mappings":";AAQA,MAAMA,YAAY,CAAC,EAAEC,GAAG,EAAEC,IAAI,EAAEC,GAAG,EAAEC,WAAW,EAAkB;IAC9D,MAAMC,cAAc,AAAuB,cAAvB,OAAOD,cAA6BA,YAAY;QAAEH;QAAKC;IAAK,KAAK;IAErF,IAAIC,AAAQ,cAARA,KACA,OAAO,WAAP,GACI,oBAAC;QAAI,WAAW;OACXE,eAAe,WAAfA,GACG,oBAAC;QAAI,KAAKJ;QAAK,KAAKC;QAAM,WAAW;;IAMrD,OAAO,WAAP,GACI,oBAAC;QAAI,WAAW;OACXG,eAAe,WAAfA,GAAe,oBAAC;QAAI,KAAKJ;QAAK,KAAKC;QAAM,WAAW;;AAGjE"}
|
|
@@ -6,10 +6,5 @@ interface ThumbnailActionsProps {
|
|
|
6
6
|
disabled?: boolean;
|
|
7
7
|
className?: string;
|
|
8
8
|
}
|
|
9
|
-
/**
|
|
10
|
-
* The file's actions laid over its thumbnail and revealed on hover, mirroring the File Manager's
|
|
11
|
-
* grid so a file offers the same affordances wherever it is shown. Requires `group` and
|
|
12
|
-
* `relative` on the element wrapping the thumbnail.
|
|
13
|
-
*/
|
|
14
9
|
declare const ThumbnailActions: ({ className, disabled, onEditItem, onRemoveItem, onReplaceItem }: ThumbnailActionsProps) => React.JSX.Element;
|
|
15
10
|
export { ThumbnailActions, type ThumbnailActionsProps };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilePicker/primitives/components/previews/RichItemPreview/ThumbnailActions.js","sources":["../../../../../../src/FilePicker/primitives/components/previews/RichItemPreview/ThumbnailActions.tsx"],"sourcesContent":["import React, { useCallback } 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 { Tooltip } from \"~/Tooltip/index.js\";\nimport { cn } from \"~/utils.js\";\n\ninterface ActionProps {\n icon: React.JSX.Element;\n label: string;\n onAction: () => void;\n disabled?: boolean;\n}\n\nconst Action = ({ icon, label, onAction, disabled }: ActionProps) => {\n const onClick = useCallback(\n (event: React.MouseEvent<HTMLButtonElement>) => {\n
|
|
1
|
+
{"version":3,"file":"FilePicker/primitives/components/previews/RichItemPreview/ThumbnailActions.js","sources":["../../../../../../src/FilePicker/primitives/components/previews/RichItemPreview/ThumbnailActions.tsx"],"sourcesContent":["import React, { useCallback } 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 { Tooltip } from \"~/Tooltip/index.js\";\nimport { cn } from \"~/utils.js\";\n\ninterface ActionProps {\n icon: React.JSX.Element;\n label: string;\n onAction: () => void;\n disabled?: boolean;\n}\n\nconst Action = ({ icon, label, onAction, disabled }: ActionProps) => {\n const onClick = useCallback(\n (event: React.MouseEvent<HTMLButtonElement>) => {\n event.stopPropagation();\n onAction();\n },\n [onAction]\n );\n\n return (\n <Tooltip\n content={label}\n trigger={\n <IconButton\n variant={\"tertiary\"}\n size={\"sm\"}\n icon={icon}\n onClick={onClick}\n disabled={disabled}\n />\n }\n />\n );\n};\n\ninterface ThumbnailActionsProps {\n onRemoveItem?: () => void;\n onEditItem?: () => void;\n onReplaceItem?: () => void;\n disabled?: boolean;\n className?: string;\n}\n\nconst ThumbnailActions = ({\n className,\n disabled,\n onEditItem,\n onRemoveItem,\n onReplaceItem\n}: ThumbnailActionsProps) => {\n return (\n <div\n className={cn(\n \"invisible group-hover:visible\",\n \"flex items-center gap-xxs\",\n \"absolute top-xs-plus right-xs-plus\",\n className\n )}\n >\n {onReplaceItem && (\n <Action\n icon={<ReplaceIcon />}\n label={\"Replace\"}\n onAction={onReplaceItem}\n disabled={disabled}\n />\n )}\n {onEditItem && (\n <Action\n icon={<EditIcon />}\n label={\"Edit\"}\n onAction={onEditItem}\n disabled={disabled}\n />\n )}\n {onRemoveItem && (\n <Action\n icon={<TrashIcon />}\n label={\"Remove\"}\n onAction={onRemoveItem}\n disabled={disabled}\n />\n )}\n </div>\n );\n};\n\nexport { ThumbnailActions, type ThumbnailActionsProps };\n"],"names":["Action","icon","label","onAction","disabled","onClick","useCallback","event","Tooltip","IconButton","ThumbnailActions","className","onEditItem","onRemoveItem","onReplaceItem","cn","ReplaceIcon","EditIcon","TrashIcon"],"mappings":";;;;;;;AAeA,MAAMA,SAAS,CAAC,EAAEC,IAAI,EAAEC,KAAK,EAAEC,QAAQ,EAAEC,QAAQ,EAAe;IAC5D,MAAMC,UAAUC,YACZ,CAACC;QACGA,MAAM,eAAe;QACrBJ;IACJ,GACA;QAACA;KAAS;IAGd,OAAO,WAAP,GACI,oBAACK,SAAOA;QACJ,SAASN;QACT,uBACI,oBAACO,YAAUA;YACP,SAAS;YACT,MAAM;YACN,MAAMR;YACN,SAASI;YACT,UAAUD;;;AAK9B;AAUA,MAAMM,mBAAmB,CAAC,EACtBC,SAAS,EACTP,QAAQ,EACRQ,UAAU,EACVC,YAAY,EACZC,aAAa,EACO,GACb,WAAP,GACI,oBAAC;QACG,WAAWC,GACP,iCACA,6BACA,sCACAJ;OAGHG,iBAAiB,WAAjBA,GACG,oBAACd,QAAMA;QACH,oBAAM,oBAACgB,gBAAWA;QAClB,OAAO;QACP,UAAUF;QACV,UAAUV;QAGjBQ,cAAc,WAAdA,GACG,oBAACZ,QAAMA;QACH,oBAAM,oBAACiB,yBAAQA;QACf,OAAO;QACP,UAAUL;QACV,UAAUR;QAGjBS,gBAAgB,WAAhBA,GACG,oBAACb,QAAMA;QACH,oBAAM,oBAACkB,2BAASA;QAChB,OAAO;QACP,UAAUL;QACV,UAAUT"}
|