@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
package/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sources":["../src/utils.tsx"],"sourcesContent":["import React from \"react\";\nimport { clsx, type ClassValue } from \"clsx\";\nimport { generateId as baseGenerateId } from \"@webiny/utils/generateId.js\";\nimport { extendTailwindMerge } from \"tailwind-merge\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nexport { makeDecoratable } from \"@webiny/react-composition\";\n\nconst
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../src/utils.tsx"],"sourcesContent":["import React from \"react\";\nimport { clsx, type ClassValue } from \"clsx\";\nimport { generateId as baseGenerateId } from \"@webiny/utils/generateId.js\";\nimport { extendTailwindMerge } from \"tailwind-merge\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nexport { makeDecoratable } from \"@webiny/react-composition\";\n\nconst BORDER_WIDTHS = [\"sm\", \"md\", \"none\"];\n\nconst twMerge = extendTailwindMerge({\n override: {\n classGroups: {\n \"border-color\": [\n \"border-transparent\",\n \"border-white\",\n \"border-accent\",\n \"border-accent-default\",\n \"border-accent-dimmed\",\n \"border-accent-subtle\",\n \"border-destructive\",\n \"border-destructive-default\",\n \"border-destructive-subtle\",\n \"border-neutral\",\n \"border-neutral-base\",\n \"border-neutral-black\",\n \"border-neutral-dark\",\n \"border-neutral-dimmed\",\n \"border-neutral-dimmed-darker\",\n \"border-neutral-muted\",\n \"border-neutral-strong\",\n \"border-neutral-subtle\",\n \"border-success\",\n \"border-success-default\",\n \"border-success-subtle\"\n ],\n \"border-style\": [\"border-solid\", \"border-dashed\", \"border-dotted\"],\n \"ring-color\": [\n \"ring-primary\",\n \"ring-primary-dimmed\",\n \"ring-primary-strong\",\n \"ring-primary-subtle\",\n \"ring-success\",\n \"ring-success-dimmed\",\n \"ring-success-strong\",\n \"ring-success-subtle\"\n ],\n \"ring-w\": [\"ring-sm\", \"ring-md\", \"ring-lg\"],\n \"font-size\": [\n \"text-h1\",\n \"text-h2\",\n \"text-h3\",\n \"text-h4\",\n \"text-h5\",\n \"text-h6\",\n \"text-sm\",\n \"text-md\",\n \"text-lg\",\n \"text-xl\",\n \"text-xxl\",\n \"text-3xl\",\n \"text-4xl\"\n ]\n }\n },\n extend: {\n classGroups: {\n \"border-w\": [{ border: BORDER_WIDTHS }],\n \"border-w-x\": [{ \"border-x\": BORDER_WIDTHS }],\n \"border-w-y\": [{ \"border-y\": BORDER_WIDTHS }],\n \"border-w-t\": [{ \"border-t\": BORDER_WIDTHS }],\n \"border-w-r\": [{ \"border-r\": BORDER_WIDTHS }],\n \"border-w-b\": [{ \"border-b\": BORDER_WIDTHS }],\n \"border-w-l\": [{ \"border-l\": BORDER_WIDTHS }],\n \"border-w-s\": [{ \"border-s\": BORDER_WIDTHS }],\n \"border-w-e\": [{ \"border-e\": BORDER_WIDTHS }]\n },\n theme: {\n spacing: [\n \"3xl\",\n \"lg\",\n \"md\",\n \"md-extra\",\n \"md-plus\",\n \"none\",\n \"sm\",\n \"sm-extra\",\n \"sm-plus\",\n \"xl\",\n \"xs\",\n \"xs-plus\",\n \"xxl\",\n \"xxs\",\n \"sidebar-collapsed\",\n \"sidebar-expanded\"\n ]\n }\n }\n});\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n\nexport const generateId = (initialId?: string) => {\n if (initialId) {\n return initialId;\n }\n return \"\" + baseGenerateId(4);\n};\n\nexport const withStaticProps = <TComponent extends React.ComponentType<any>, TProps>(\n component: TComponent,\n props: TProps\n) => {\n return Object.assign(component, props) as TComponent & TProps;\n};\n\nexport function createComponentPropsProvider<TProps extends Record<string, any>>() {\n const PropsContext = React.createContext<TProps>({} as TProps);\n\n type PropsProviderProps = {\n props: TProps;\n children: React.ReactNode;\n };\n\n const PropsProvider: React.ComponentType<PropsProviderProps> = ({\n props,\n children\n }: PropsProviderProps) => {\n return <PropsContext.Provider value={props}>{children}</PropsContext.Provider>;\n };\n\n const useProps = () => {\n return React.useContext(PropsContext);\n };\n\n return [PropsProvider, useProps] as const;\n}\n\nexport function omit<T extends object, K extends keyof T>(obj: T, keys: K[]): Omit<T, K> {\n const result = { ...obj };\n keys.forEach(key => delete result[key]);\n return result;\n}\n\nexport { cva, type VariantProps };\n"],"names":["BORDER_WIDTHS","twMerge","extendTailwindMerge","cn","inputs","clsx","generateId","initialId","baseGenerateId","withStaticProps","component","props","Object","createComponentPropsProvider","PropsContext","React","PropsProvider","children","useProps","omit","obj","keys","result","key"],"mappings":";;;;AAOA,MAAMA,gBAAgB;IAAC;IAAM;IAAM;CAAO;AAE1C,MAAMC,UAAUC,oBAAoB;IAChC,UAAU;QACN,aAAa;YACT,gBAAgB;gBACZ;gBACA;gBACA;gBACA;gBACA;gBACA;gBACA;gBACA;gBACA;gBACA;gBACA;gBACA;gBACA;gBACA;gBACA;gBACA;gBACA;gBACA;gBACA;gBACA;gBACA;aACH;YACD,gBAAgB;gBAAC;gBAAgB;gBAAiB;aAAgB;YAClE,cAAc;gBACV;gBACA;gBACA;gBACA;gBACA;gBACA;gBACA;gBACA;aACH;YACD,UAAU;gBAAC;gBAAW;gBAAW;aAAU;YAC3C,aAAa;gBACT;gBACA;gBACA;gBACA;gBACA;gBACA;gBACA;gBACA;gBACA;gBACA;gBACA;gBACA;gBACA;aACH;QACL;IACJ;IACA,QAAQ;QACJ,aAAa;YACT,YAAY;gBAAC;oBAAE,QAAQF;gBAAc;aAAE;YACvC,cAAc;gBAAC;oBAAE,YAAYA;gBAAc;aAAE;YAC7C,cAAc;gBAAC;oBAAE,YAAYA;gBAAc;aAAE;YAC7C,cAAc;gBAAC;oBAAE,YAAYA;gBAAc;aAAE;YAC7C,cAAc;gBAAC;oBAAE,YAAYA;gBAAc;aAAE;YAC7C,cAAc;gBAAC;oBAAE,YAAYA;gBAAc;aAAE;YAC7C,cAAc;gBAAC;oBAAE,YAAYA;gBAAc;aAAE;YAC7C,cAAc;gBAAC;oBAAE,YAAYA;gBAAc;aAAE;YAC7C,cAAc;gBAAC;oBAAE,YAAYA;gBAAc;aAAE;QACjD;QACA,OAAO;YACH,SAAS;gBACL;gBACA;gBACA;gBACA;gBACA;gBACA;gBACA;gBACA;gBACA;gBACA;gBACA;gBACA;gBACA;gBACA;gBACA;gBACA;aACH;QACL;IACJ;AACJ;AAEO,SAASG,GAAG,GAAGC,MAAoB;IACtC,OAAOH,QAAQI,KAAKD;AACxB;AAEO,MAAME,mBAAa,CAACC;IACvB,IAAIA,WACA,OAAOA;IAEX,OAAO,KAAKC,WAAe;AAC/B;AAEO,MAAMC,kBAAkB,CAC3BC,WACAC,QAEOC,OAAO,MAAM,CAACF,WAAWC;AAG7B,SAASE;IACZ,MAAMC,eAAe,WAAfA,GAAeC,MAAAA,aAAmB,CAAS,CAAC;IAOlD,MAAMC,gBAAyD,CAAC,EAC5DL,KAAK,EACLM,QAAQ,EACS,GACV,WAAP,GAAO,oBAACH,aAAa,QAAQ;YAAC,OAAOH;WAAQM;IAGjD,MAAMC,WAAW,IACNH,MAAAA,UAAgB,CAACD;IAG5B,OAAO;QAACE;QAAeE;KAAS;AACpC;AAEO,SAASC,KAA0CC,GAAM,EAAEC,IAAS;IACvE,MAAMC,SAAS;QAAE,GAAGF,GAAG;IAAC;IACxBC,KAAK,OAAO,CAACE,CAAAA,MAAO,OAAOD,MAAM,CAACC,IAAI;IACtC,OAAOD;AACX"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import type { FileItemFormatted } from "../../../../../FilePicker/index.js";
|
|
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
|
-
declare const FileType: ({ mimeType, name }: FileTypeProps) => React.JSX.Element;
|
|
9
|
-
export { FileType, type FileTypeProps };
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import react from "react";
|
|
2
|
-
import csv from "../assets/csv.js";
|
|
3
|
-
import doc from "../assets/doc.js";
|
|
4
|
-
import docx from "../assets/docx.js";
|
|
5
|
-
import file from "../assets/file.js";
|
|
6
|
-
import pdf from "../assets/pdf.js";
|
|
7
|
-
import ppt from "../assets/ppt.js";
|
|
8
|
-
import pptx from "../assets/pptx.js";
|
|
9
|
-
import txt from "../assets/txt.js";
|
|
10
|
-
import xls from "../assets/xls.js";
|
|
11
|
-
import xlsx from "../assets/xlsx.js";
|
|
12
|
-
const FileType = ({ mimeType = "", name })=>{
|
|
13
|
-
const getMimeTypeSrc = (mimeType)=>{
|
|
14
|
-
switch(mimeType){
|
|
15
|
-
case "text/csv":
|
|
16
|
-
return csv;
|
|
17
|
-
case "application/msword":
|
|
18
|
-
return doc;
|
|
19
|
-
case "application/vnd.openxmlformats-officedocument.wordprocessingml.document":
|
|
20
|
-
return docx;
|
|
21
|
-
case "application/pdf":
|
|
22
|
-
return pdf;
|
|
23
|
-
case "application/vnd.ms-powerpoint":
|
|
24
|
-
return ppt;
|
|
25
|
-
case "application/vnd.openxmlformats-officedocument.presentationml.presentation":
|
|
26
|
-
return pptx;
|
|
27
|
-
case "text/plain":
|
|
28
|
-
return txt;
|
|
29
|
-
case "application/vnd.ms-excel":
|
|
30
|
-
return xls;
|
|
31
|
-
case "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":
|
|
32
|
-
return xlsx;
|
|
33
|
-
default:
|
|
34
|
-
return file;
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
return /*#__PURE__*/ react.createElement("img", {
|
|
38
|
-
src: getMimeTypeSrc(mimeType),
|
|
39
|
-
alt: name,
|
|
40
|
-
className: "size-full object-contain p-sm-extra"
|
|
41
|
-
});
|
|
42
|
-
};
|
|
43
|
-
export { FileType };
|
|
44
|
-
|
|
45
|
-
//# sourceMappingURL=FileType.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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\n/**\n * The stand-in for a file that cannot be shown as a picture: an icon of its format, falling back\n * to a generic one for anything unrecognised.\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":";;;;;;;;;;;AAoBA,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 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import type { FileItemFormatted } from "../../../../../FilePicker/index.js";
|
|
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
|
-
declare const Placeholder: ({ name }: PlaceholderProps) => React.JSX.Element;
|
|
8
|
-
export { Placeholder, type PlaceholderProps };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import react from "react";
|
|
2
|
-
import { ReactComponent } from "@webiny/icons/image.svg";
|
|
3
|
-
import { Icon } from "../../../../../Icon/index.js";
|
|
4
|
-
const Placeholder = ({ name })=>/*#__PURE__*/ react.createElement("div", {
|
|
5
|
-
className: "size-full flex justify-center items-center bg-transparent"
|
|
6
|
-
}, /*#__PURE__*/ react.createElement(Icon, {
|
|
7
|
-
icon: /*#__PURE__*/ react.createElement(ReactComponent, null),
|
|
8
|
-
label: name,
|
|
9
|
-
size: "lg",
|
|
10
|
-
color: "neutral-light"
|
|
11
|
-
}));
|
|
12
|
-
export { Placeholder };
|
|
13
|
-
|
|
14
|
-
//# sourceMappingURL=Placeholder.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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\n/**\n * Shown when the caller asks for a placeholder rather than the file's own preview.\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":";;;AAUA,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"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import type { FileItemFormatted } from "../../../../../FilePicker/index.js";
|
|
3
|
-
type ThumbnailProps = Pick<FileItemFormatted, "url" | "name"> & {
|
|
4
|
-
fit: "cover" | "contain";
|
|
5
|
-
};
|
|
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;
|
|
11
|
-
export { Thumbnail, type ThumbnailProps };
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import react from "react";
|
|
2
|
-
const Thumbnail = ({ url, name, fit })=>{
|
|
3
|
-
if ("contain" === fit) return /*#__PURE__*/ react.createElement("div", {
|
|
4
|
-
className: "size-full p-xs bg-neutral-muted flex items-center justify-center"
|
|
5
|
-
}, /*#__PURE__*/ react.createElement("img", {
|
|
6
|
-
src: url,
|
|
7
|
-
alt: name,
|
|
8
|
-
className: "max-h-full max-w-full rounded-xs"
|
|
9
|
-
}));
|
|
10
|
-
return /*#__PURE__*/ react.createElement("div", {
|
|
11
|
-
className: "size-full bg-neutral-muted"
|
|
12
|
-
}, /*#__PURE__*/ react.createElement("img", {
|
|
13
|
-
src: url,
|
|
14
|
-
alt: name,
|
|
15
|
-
className: "size-full object-cover"
|
|
16
|
-
}));
|
|
17
|
-
};
|
|
18
|
-
export { Thumbnail };
|
|
19
|
-
|
|
20
|
-
//# sourceMappingURL=Thumbnail.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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};\n\n/**\n * The file's own image. `cover` fills its box and crops what does not fit, which suits the small\n * square tile; `contain` shows the whole picture, which suits the banner.\n */\nconst Thumbnail = ({ url, name, fit }: ThumbnailProps) => {\n if (fit === \"contain\") {\n return (\n <div className={\"size-full p-xs bg-neutral-muted flex items-center justify-center\"}>\n {/*\n Capping the element with max-width/max-height, rather than stretching it and\n letting `object-contain` letterbox the picture inside it, keeps the element box\n and the visible picture the same rectangle. That is what lets the corners round\n at all: `border-radius` clips the element, so on a letterboxed image it would\n trim empty space and leave the picture square.\n */}\n <img src={url} alt={name} className={\"max-h-full max-w-full rounded-xs\"} />\n </div>\n );\n }\n\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\nexport { Thumbnail, type ThumbnailProps };\n"],"names":["Thumbnail","url","name","fit"],"mappings":";AAWA,MAAMA,YAAY,CAAC,EAAEC,GAAG,EAAEC,IAAI,EAAEC,GAAG,EAAkB;IACjD,IAAIA,AAAQ,cAARA,KACA,OAAO,WAAP,GACI,oBAAC;QAAI,WAAW;qBAQZ,oBAAC;QAAI,KAAKF;QAAK,KAAKC;QAAM,WAAW;;IAKjD,OAAO,WAAP,GACI,oBAAC;QAAI,WAAW;qBACZ,oBAAC;QAAI,KAAKD;QAAK,KAAKC;QAAM,WAAW;;AAGjD"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
interface ThumbnailActionsProps {
|
|
3
|
-
onRemoveItem?: () => void;
|
|
4
|
-
onEditItem?: () => void;
|
|
5
|
-
onReplaceItem?: () => void;
|
|
6
|
-
disabled?: boolean;
|
|
7
|
-
className?: string;
|
|
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
|
-
declare const ThumbnailActions: ({ className, disabled, onEditItem, onRemoveItem, onReplaceItem }: ThumbnailActionsProps) => React.JSX.Element;
|
|
15
|
-
export { ThumbnailActions, type ThumbnailActionsProps };
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import react, { useCallback } from "react";
|
|
2
|
-
import { ReactComponent } from "@webiny/icons/file_upload.svg";
|
|
3
|
-
import { ReactComponent as edit_svg_ReactComponent } from "@webiny/icons/edit.svg";
|
|
4
|
-
import { ReactComponent as delete_svg_ReactComponent } from "@webiny/icons/delete.svg";
|
|
5
|
-
import { IconButton } from "../../../../../Button/index.js";
|
|
6
|
-
import { Tooltip } from "../../../../../Tooltip/index.js";
|
|
7
|
-
import { cn } from "../../../../../utils.js";
|
|
8
|
-
const Action = ({ icon, label, onAction, disabled })=>{
|
|
9
|
-
const onClick = useCallback((event)=>{
|
|
10
|
-
event.stopPropagation();
|
|
11
|
-
onAction();
|
|
12
|
-
}, [
|
|
13
|
-
onAction
|
|
14
|
-
]);
|
|
15
|
-
return /*#__PURE__*/ react.createElement(Tooltip, {
|
|
16
|
-
content: label,
|
|
17
|
-
trigger: /*#__PURE__*/ react.createElement(IconButton, {
|
|
18
|
-
variant: "tertiary",
|
|
19
|
-
size: "sm",
|
|
20
|
-
icon: icon,
|
|
21
|
-
onClick: onClick,
|
|
22
|
-
disabled: disabled
|
|
23
|
-
})
|
|
24
|
-
});
|
|
25
|
-
};
|
|
26
|
-
const ThumbnailActions = ({ className, disabled, onEditItem, onRemoveItem, onReplaceItem })=>/*#__PURE__*/ react.createElement("div", {
|
|
27
|
-
className: cn("invisible group-hover:visible", "flex items-center gap-xxs", "absolute top-xs-plus right-xs-plus", className)
|
|
28
|
-
}, onReplaceItem && /*#__PURE__*/ react.createElement(Action, {
|
|
29
|
-
icon: /*#__PURE__*/ react.createElement(ReactComponent, null),
|
|
30
|
-
label: "Replace",
|
|
31
|
-
onAction: onReplaceItem,
|
|
32
|
-
disabled: disabled
|
|
33
|
-
}), onEditItem && /*#__PURE__*/ react.createElement(Action, {
|
|
34
|
-
icon: /*#__PURE__*/ react.createElement(edit_svg_ReactComponent, null),
|
|
35
|
-
label: "Edit",
|
|
36
|
-
onAction: onEditItem,
|
|
37
|
-
disabled: disabled
|
|
38
|
-
}), onRemoveItem && /*#__PURE__*/ react.createElement(Action, {
|
|
39
|
-
icon: /*#__PURE__*/ react.createElement(delete_svg_ReactComponent, null),
|
|
40
|
-
label: "Remove",
|
|
41
|
-
onAction: onRemoveItem,
|
|
42
|
-
disabled: disabled
|
|
43
|
-
}));
|
|
44
|
-
export { ThumbnailActions };
|
|
45
|
-
|
|
46
|
-
//# sourceMappingURL=ThumbnailActions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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 // The thumbnail behind these opens the file manager when clicked, so without this a\n // click on Remove would replace the file as well as remove it.\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\n/**\n * The file's actions laid over its thumbnail and revealed on hover, mirroring the File Manager's\n * grid so a file offers the same affordances wherever it is shown. Requires `group` and\n * `relative` on the element wrapping the thumbnail.\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;QAGGA,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;AAeA,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"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
interface TruncatedFileNameProps {
|
|
3
|
-
name: string;
|
|
4
|
-
className?: string;
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* A file name that truncates in the middle, keeping the extension (and a little of the stem)
|
|
8
|
-
* visible: "tide-cc-statuses-v2.png" becomes "tide-cc-statu…-v2.png".
|
|
9
|
-
*/
|
|
10
|
-
declare const TruncatedFileName: ({ name, className }: TruncatedFileNameProps) => React.JSX.Element;
|
|
11
|
-
export { TruncatedFileName, type TruncatedFileNameProps };
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import react from "react";
|
|
2
|
-
import { Text } from "../../../../Text/index.js";
|
|
3
|
-
import { cn } from "../../../../utils.js";
|
|
4
|
-
import { splitFileName } from "./fileName.js";
|
|
5
|
-
const TruncatedFileName = ({ name, className })=>{
|
|
6
|
-
const { head, tail } = splitFileName(name);
|
|
7
|
-
return /*#__PURE__*/ react.createElement(Text, {
|
|
8
|
-
size: "sm",
|
|
9
|
-
as: "div",
|
|
10
|
-
className: cn("flex min-w-0", className),
|
|
11
|
-
title: name
|
|
12
|
-
}, /*#__PURE__*/ react.createElement("span", {
|
|
13
|
-
className: "truncate"
|
|
14
|
-
}, head), tail ? /*#__PURE__*/ react.createElement("span", {
|
|
15
|
-
className: "shrink-0 whitespace-pre"
|
|
16
|
-
}, tail) : null);
|
|
17
|
-
};
|
|
18
|
-
export { TruncatedFileName };
|
|
19
|
-
|
|
20
|
-
//# sourceMappingURL=TruncatedFileName.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FilePicker/primitives/components/previews/TruncatedFileName.js","sources":["../../../../../src/FilePicker/primitives/components/previews/TruncatedFileName.tsx"],"sourcesContent":["import React from \"react\";\nimport { Text } from \"~/Text/index.js\";\nimport { cn } from \"~/utils.js\";\nimport { splitFileName } from \"./fileName.js\";\n\ninterface TruncatedFileNameProps {\n name: string;\n className?: string;\n}\n\n/**\n * A file name that truncates in the middle, keeping the extension (and a little of the stem)\n * visible: \"tide-cc-statuses-v2.png\" becomes \"tide-cc-statu…-v2.png\".\n */\nconst TruncatedFileName = ({ name, className }: TruncatedFileNameProps) => {\n const { head, tail } = splitFileName(name);\n\n return (\n <Text size=\"sm\" as=\"div\" className={cn(\"flex min-w-0\", className)} title={name}>\n <span className={\"truncate\"}>{head}</span>\n {tail ? <span className={\"shrink-0 whitespace-pre\"}>{tail}</span> : null}\n </Text>\n );\n};\n\nexport { TruncatedFileName, type TruncatedFileNameProps };\n"],"names":["TruncatedFileName","name","className","head","tail","splitFileName","Text","cn"],"mappings":";;;;AAcA,MAAMA,oBAAoB,CAAC,EAAEC,IAAI,EAAEC,SAAS,EAA0B;IAClE,MAAM,EAAEC,IAAI,EAAEC,IAAI,EAAE,GAAGC,cAAcJ;IAErC,OAAO,WAAP,GACI,oBAACK,MAAIA;QAAC,MAAK;QAAK,IAAG;QAAM,WAAWC,GAAG,gBAAgBL;QAAY,OAAOD;qBACtE,oBAAC;QAAK,WAAW;OAAaE,OAC7BC,OAAO,WAAPA,GAAO,oBAAC;QAAK,WAAW;OAA4BA,QAAe;AAGhF"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Splits a file name into the part that may be truncated and the part that must stay visible.
|
|
3
|
-
*
|
|
4
|
-
* CSS can only cut the tail of a string, which is the least useful end of a file name - it hides
|
|
5
|
-
* the extension and any "-v2"/"-final" suffix, the two things that tell near-identical uploads
|
|
6
|
-
* apart. Rendering the head in a truncating element and pinning the tail after it moves the
|
|
7
|
-
* ellipsis into the middle without measuring anything.
|
|
8
|
-
*/
|
|
9
|
-
export declare const splitFileName: (name: string) => {
|
|
10
|
-
head: string;
|
|
11
|
-
tail: string;
|
|
12
|
-
};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
const TAIL_STEM_CHARS = 3;
|
|
2
|
-
const splitFileName = (name)=>{
|
|
3
|
-
const dot = name.lastIndexOf(".");
|
|
4
|
-
if (dot <= 0) return {
|
|
5
|
-
head: name,
|
|
6
|
-
tail: ""
|
|
7
|
-
};
|
|
8
|
-
const cut = dot - Math.min(TAIL_STEM_CHARS, dot);
|
|
9
|
-
if (cut <= 0) return {
|
|
10
|
-
head: name,
|
|
11
|
-
tail: ""
|
|
12
|
-
};
|
|
13
|
-
const head = name.slice(0, cut);
|
|
14
|
-
const tail = name.slice(cut);
|
|
15
|
-
if (head.length <= tail.length) return {
|
|
16
|
-
head: name,
|
|
17
|
-
tail: ""
|
|
18
|
-
};
|
|
19
|
-
return {
|
|
20
|
-
head,
|
|
21
|
-
tail
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
export { splitFileName };
|
|
25
|
-
|
|
26
|
-
//# sourceMappingURL=fileName.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FilePicker/primitives/components/previews/fileName.js","sources":["../../../../../src/FilePicker/primitives/components/previews/fileName.ts"],"sourcesContent":["/**\n * How many characters of the stem to keep alongside the extension when a file name is too long\n * to fit. Enough to preserve a version or ordinal suffix - \"…-v2.png\" rather than \"….png\".\n */\nconst TAIL_STEM_CHARS = 3;\n\n/**\n * Splits a file name into the part that may be truncated and the part that must stay visible.\n *\n * CSS can only cut the tail of a string, which is the least useful end of a file name - it hides\n * the extension and any \"-v2\"/\"-final\" suffix, the two things that tell near-identical uploads\n * apart. Rendering the head in a truncating element and pinning the tail after it moves the\n * ellipsis into the middle without measuring anything.\n */\nexport const splitFileName = (name: string) => {\n const dot = name.lastIndexOf(\".\");\n\n // No extension, or a dotfile like \".gitignore\" - there is no meaningful tail to pin.\n if (dot <= 0) {\n return { head: name, tail: \"\" };\n }\n\n const cut = dot - Math.min(TAIL_STEM_CHARS, dot);\n\n // The whole name is extension-and-a-bit; pinning all of it would defeat the truncation.\n if (cut <= 0) {\n return { head: name, tail: \"\" };\n }\n\n const head = name.slice(0, cut);\n const tail = name.slice(cut);\n\n // On a short name the pinned tail can end up longer than the part left to truncate\n // (\"photo.jpeg\" would pin \"oto.jpeg\"), which reads as nonsense. Such names rarely overflow\n // anyway, so fall back to ordinary end truncation.\n if (head.length <= tail.length) {\n return { head: name, tail: \"\" };\n }\n\n return { head, tail };\n};\n"],"names":["TAIL_STEM_CHARS","splitFileName","name","dot","cut","Math","head","tail"],"mappings":"AAIA,MAAMA,kBAAkB;AAUjB,MAAMC,gBAAgB,CAACC;IAC1B,MAAMC,MAAMD,KAAK,WAAW,CAAC;IAG7B,IAAIC,OAAO,GACP,OAAO;QAAE,MAAMD;QAAM,MAAM;IAAG;IAGlC,MAAME,MAAMD,MAAME,KAAK,GAAG,CAACL,iBAAiBG;IAG5C,IAAIC,OAAO,GACP,OAAO;QAAE,MAAMF;QAAM,MAAM;IAAG;IAGlC,MAAMI,OAAOJ,KAAK,KAAK,CAAC,GAAGE;IAC3B,MAAMG,OAAOL,KAAK,KAAK,CAACE;IAKxB,IAAIE,KAAK,MAAM,IAAIC,KAAK,MAAM,EAC1B,OAAO;QAAE,MAAML;QAAM,MAAM;IAAG;IAGlC,OAAO;QAAEI;QAAMC;IAAK;AACxB"}
|