@xdev-asia/ui 0.0.0-stage → 4.15.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/AGENTS.md +66 -0
- package/LICENSE +202 -0
- package/README.md +149 -2
- package/assets/brand/mobile/android-background-1024.png +0 -0
- package/assets/brand/mobile/android-background.svg +13 -0
- package/assets/brand/mobile/android-foreground-1024.png +0 -0
- package/assets/brand/mobile/android-foreground.svg +13 -0
- package/assets/brand/mobile/android-monochrome-1024.png +0 -0
- package/assets/brand/mobile/android-monochrome.svg +3 -0
- package/assets/brand/mobile/ios-icon-1024.png +0 -0
- package/assets/brand/mobile/ios-icon-dark-1024.png +0 -0
- package/assets/brand/mobile/ios-icon-dark.svg +22 -0
- package/assets/brand/mobile/ios-icon.svg +22 -0
- package/assets/brand/systems/xdev-ui-icon.svg +23 -0
- package/assets/brand/systems/xdev-ui-lockup-dark.svg +24 -0
- package/assets/brand/systems/xdev-ui-lockup-light.svg +24 -0
- package/assets/brand/systems/xdev-ui-mark-lit.svg +13 -0
- package/assets/brand/systems/xdev-ui-mark.svg +3 -0
- package/assets/brand/xdev-icon-512.png +0 -0
- package/assets/brand/xdev-icon-blue.svg +23 -0
- package/assets/brand/xdev-icon.svg +23 -0
- package/assets/brand/xdev-lockup-dark.svg +24 -0
- package/assets/brand/xdev-lockup-light.svg +24 -0
- package/assets/brand/xdev-mark-lit.svg +13 -0
- package/assets/brand/xdev-mark-tile.svg +3 -0
- package/assets/brand/xdev-mark.svg +3 -0
- package/bin/xdev-ui-skills.mjs +142 -0
- package/dist/Workspace.stories.d.ts +15 -0
- package/dist/ai-manifest.json +3727 -0
- package/dist/chunks/FileDrop-C-ygn8kF.js +891 -0
- package/dist/chunks/FileDrop-C-ygn8kF.js.map +1 -0
- package/dist/chunks/Popover-Ds4RBtZv.js +121 -0
- package/dist/chunks/Popover-Ds4RBtZv.js.map +1 -0
- package/dist/chunks/crop-CahE3q01.js +55 -0
- package/dist/chunks/crop-CahE3q01.js.map +1 -0
- package/dist/chunks/modal-BYFY08ti.js +54 -0
- package/dist/chunks/modal-BYFY08ti.js.map +1 -0
- package/dist/components/ActionTile/ActionTile.d.ts +14 -0
- package/dist/components/ActionTile/ActionTile.stories.d.ts +18 -0
- package/dist/components/ActivityBar/ActivityBar.d.ts +36 -0
- package/dist/components/ActivityBar/ActivityBar.stories.d.ts +27 -0
- package/dist/components/AgentChip/AgentChip.d.ts +10 -0
- package/dist/components/AgentChip/AgentChip.stories.d.ts +21 -0
- package/dist/components/AgentRow/AgentRow.d.ts +24 -0
- package/dist/components/AgentRow/AgentRow.stories.d.ts +19 -0
- package/dist/components/AppShell/AppShell.d.ts +58 -0
- package/dist/components/AppShell/AppShell.stories.d.ts +17 -0
- package/dist/components/ApprovalBar/ApprovalBar.d.ts +23 -0
- package/dist/components/ApprovalBar/ApprovalBar.stories.d.ts +18 -0
- package/dist/components/AttentionInbox/AttentionInbox.d.ts +43 -0
- package/dist/components/AttentionInbox/AttentionInbox.stories.d.ts +16 -0
- package/dist/components/AudioPreview/AudioPreview.d.ts +33 -0
- package/dist/components/AudioPreview/AudioPreview.stories.d.ts +23 -0
- package/dist/components/AudioPreview/audio-preview-store.d.ts +14 -0
- package/dist/components/AuthShell/AuthShell.d.ts +24 -0
- package/dist/components/AuthShell/AuthShell.stories.d.ts +20 -0
- package/dist/components/Avatar/Avatar.d.ts +13 -0
- package/dist/components/Avatar/Avatar.stories.d.ts +21 -0
- package/dist/components/Badge/Badge.d.ts +14 -0
- package/dist/components/Badge/Badge.stories.d.ts +26 -0
- package/dist/components/Banner/Banner.d.ts +11 -0
- package/dist/components/Banner/Banner.stories.d.ts +23 -0
- package/dist/components/BarChart/BarChart.d.ts +20 -0
- package/dist/components/BarChart/BarChart.stories.d.ts +24 -0
- package/dist/components/Board/Board.d.ts +9 -0
- package/dist/components/Board/Board.stories.d.ts +18 -0
- package/dist/components/BoardCard/BoardCard.d.ts +32 -0
- package/dist/components/BoardColumn/BoardColumn.d.ts +24 -0
- package/dist/components/BottomNav/BottomNav.d.ts +40 -0
- package/dist/components/BottomNav/BottomNav.stories.d.ts +40 -0
- package/dist/components/BrandMark/BrandMark.d.ts +20 -0
- package/dist/components/BrandMark/BrandMark.stories.d.ts +28 -0
- package/dist/components/Breadcrumb/Breadcrumb.d.ts +22 -0
- package/dist/components/Breadcrumb/Breadcrumb.stories.d.ts +27 -0
- package/dist/components/BulkBar/BulkBar.d.ts +21 -0
- package/dist/components/BulkBar/BulkBar.stories.d.ts +16 -0
- package/dist/components/Button/Button.d.ts +42 -0
- package/dist/components/Button/Button.stories.d.ts +41 -0
- package/dist/components/Card/Card.d.ts +22 -0
- package/dist/components/Card/Card.stories.d.ts +307 -0
- package/dist/components/Checkbox/Checkbox.d.ts +10 -0
- package/dist/components/Checkbox/Checkbox.stories.d.ts +18 -0
- package/dist/components/Coachmark/Coachmark.d.ts +31 -0
- package/dist/components/Coachmark/Coachmark.stories.d.ts +27 -0
- package/dist/components/Coachmark/placeCoachmark.d.ts +31 -0
- package/dist/components/CodeBlock/CodeBlock.d.ts +19 -0
- package/dist/components/CodeBlock/CodeBlock.stories.d.ts +22 -0
- package/dist/components/CodeInput/CodeInput.d.ts +25 -0
- package/dist/components/CodeInput/CodeInput.stories.d.ts +32 -0
- package/dist/components/CodeInput/normalizeCode.d.ts +10 -0
- package/dist/components/ColorField/ColorField.d.ts +29 -0
- package/dist/components/Combobox/Combobox.d.ts +105 -0
- package/dist/components/Combobox/Combobox.stories.d.ts +42 -0
- package/dist/components/CommandPalette/CommandPalette.d.ts +94 -0
- package/dist/components/CommandPalette/CommandPalette.stories.d.ts +39 -0
- package/dist/components/Comment/Comment.d.ts +25 -0
- package/dist/components/Comment/Comment.stories.d.ts +24 -0
- package/dist/components/CommitGraph/CommitGraph.d.ts +15 -0
- package/dist/components/CommitGraph/CommitGraph.stories.d.ts +15 -0
- package/dist/components/CommitGraph/graphLanes.d.ts +56 -0
- package/dist/components/Composer/Composer.d.ts +31 -0
- package/dist/components/Composer/Composer.stories.d.ts +17 -0
- package/dist/components/Container/Container.d.ts +11 -0
- package/dist/components/Container/Container.stories.d.ts +14 -0
- package/dist/components/DataTable/DataTable.d.ts +79 -0
- package/dist/components/DataTable/DataTable.stories.d.ts +26 -0
- package/dist/components/DataTable/table-helpers.d.ts +16 -0
- package/dist/components/DataTable/table-reorder.d.ts +40 -0
- package/dist/components/DatePicker/Calendar.d.ts +51 -0
- package/dist/components/DatePicker/DatePicker.d.ts +51 -0
- package/dist/components/DatePicker/DatePicker.stories.d.ts +42 -0
- package/dist/components/DateRangePicker/DateRangePicker.d.ts +59 -0
- package/dist/components/DateRangePicker/DateRangePicker.stories.d.ts +42 -0
- package/dist/components/DescriptionList/DescriptionList.d.ts +14 -0
- package/dist/components/DescriptionList/DescriptionList.stories.d.ts +21 -0
- package/dist/components/Dialog/Dialog.d.ts +43 -0
- package/dist/components/Dialog/Dialog.stories.d.ts +22 -0
- package/dist/components/DiffStat/DiffStat.d.ts +12 -0
- package/dist/components/DiffStat/DiffStat.stories.d.ts +15 -0
- package/dist/components/Disclosure/Disclosure.d.ts +18 -0
- package/dist/components/Disclosure/Disclosure.stories.d.ts +27 -0
- package/dist/components/DonutChart/DonutChart.d.ts +30 -0
- package/dist/components/DonutChart/DonutChart.stories.d.ts +26 -0
- package/dist/components/Drawer/Drawer.d.ts +27 -0
- package/dist/components/Drawer/Drawer.stories.d.ts +18 -0
- package/dist/components/Emblem/Emblem.d.ts +19 -0
- package/dist/components/Emblem/Emblem.stories.d.ts +19 -0
- package/dist/components/EmptyState/EmptyState.d.ts +43 -0
- package/dist/components/EmptyState/EmptyState.stories.d.ts +17 -0
- package/dist/components/EndpointPanel/EndpointPanel.d.ts +29 -0
- package/dist/components/FacetFilter/FacetFilter.d.ts +39 -0
- package/dist/components/FacetFilter/FacetFilter.stories.d.ts +23 -0
- package/dist/components/FacetFilter/facet-helpers.d.ts +5 -0
- package/dist/components/Field/Field.d.ts +27 -0
- package/dist/components/Field/Field.stories.d.ts +25 -0
- package/dist/components/FieldMessage/FieldMessage.d.ts +10 -0
- package/dist/components/FieldMessage/FieldMessage.stories.d.ts +14 -0
- package/dist/components/FileDrop/FileDrop.d.ts +72 -0
- package/dist/components/FileDrop/FileDrop.stories.d.ts +18 -0
- package/dist/components/FileIcon/FileIcon.d.ts +25 -0
- package/dist/components/FileIcon/FileIcon.stories.d.ts +14 -0
- package/dist/components/FilterChip/FilterChip.d.ts +9 -0
- package/dist/components/FilterChip/FilterChip.stories.d.ts +19 -0
- package/dist/components/FlowMap/FlowMap.d.ts +74 -0
- package/dist/components/FlowMap/FlowMap.stories.d.ts +24 -0
- package/dist/components/FontField/FontField.d.ts +15 -0
- package/dist/components/FontField/FontField.stories.d.ts +17 -0
- package/dist/components/FormDialog/FormDialog.d.ts +40 -0
- package/dist/components/FormDialog/FormDialog.stories.d.ts +22 -0
- package/dist/components/FormSection/FormSection.d.ts +19 -0
- package/dist/components/FormSection/FormSection.stories.d.ts +16 -0
- package/dist/components/Grid/Grid.d.ts +23 -0
- package/dist/components/Grid/Grid.stories.d.ts +19 -0
- package/dist/components/Grid/breakpoints.d.ts +25 -0
- package/dist/components/Heatmap/Heatmap.d.ts +22 -0
- package/dist/components/Heatmap/Heatmap.stories.d.ts +24 -0
- package/dist/components/Icon/Icon.d.ts +14 -0
- package/dist/components/Icon/Icon.stories.d.ts +20 -0
- package/dist/components/IconButton/IconButton.d.ts +16 -0
- package/dist/components/IconButton/IconButton.stories.d.ts +27 -0
- package/dist/components/Identity/Identity.d.ts +14 -0
- package/dist/components/Identity/Identity.stories.d.ts +14 -0
- package/dist/components/Kbd/Kbd.d.ts +5 -0
- package/dist/components/Kbd/Kbd.stories.d.ts +13 -0
- package/dist/components/Label/Label.d.ts +15 -0
- package/dist/components/Label/Label.stories.d.ts +16 -0
- package/dist/components/LaunchCard/LaunchCard.d.ts +36 -0
- package/dist/components/LaunchCard/LaunchCard.stories.d.ts +32 -0
- package/dist/components/List/List.d.ts +11 -0
- package/dist/components/List/List.stories.d.ts +13 -0
- package/dist/components/ListRow/ListRow.d.ts +20 -0
- package/dist/components/ListRow/ListRow.stories.d.ts +27 -0
- package/dist/components/Menu/Menu.d.ts +53 -0
- package/dist/components/Menu/Menu.stories.d.ts +85 -0
- package/dist/components/Menu/MenuButton.d.ts +23 -0
- package/dist/components/Menu/MenuButton.stories.d.ts +46 -0
- package/dist/components/Menu/menu-keys.d.ts +26 -0
- package/dist/components/Meter/Meter.d.ts +18 -0
- package/dist/components/Meter/Meter.stories.d.ts +34 -0
- package/dist/components/ModelChip/ModelChip.d.ts +26 -0
- package/dist/components/ModelChip/ModelChip.stories.d.ts +18 -0
- package/dist/components/NavList/NavList.d.ts +56 -0
- package/dist/components/NavList/NavList.stories.d.ts +25 -0
- package/dist/components/PageHeader/PageHeader.d.ts +14 -0
- package/dist/components/PageHeader/PageHeader.stories.d.ts +14 -0
- package/dist/components/Pagination/Pagination.d.ts +28 -0
- package/dist/components/Pagination/Pagination.stories.d.ts +16 -0
- package/dist/components/PairingCode/PairingCode.d.ts +17 -0
- package/dist/components/PairingCode/PairingCode.stories.d.ts +24 -0
- package/dist/components/PaletteTrigger/PaletteTrigger.d.ts +16 -0
- package/dist/components/PanZoom/PanZoom.d.ts +24 -0
- package/dist/components/PanZoom/PanZoom.stories.d.ts +11 -0
- package/dist/components/Popover/Popover.d.ts +24 -0
- package/dist/components/Popover/Popover.stories.d.ts +25 -0
- package/dist/components/Prose/Prose.d.ts +8 -0
- package/dist/components/Prose/Prose.stories.d.ts +12 -0
- package/dist/components/RadioGroup/RadioGroup.d.ts +27 -0
- package/dist/components/RadioGroup/RadioGroup.stories.d.ts +22 -0
- package/dist/components/ReactionBar/ReactionBar.d.ts +21 -0
- package/dist/components/ReactionBar/ReactionBar.stories.d.ts +26 -0
- package/dist/components/ResourceCard/ResourceCard.d.ts +30 -0
- package/dist/components/ResourceCard/ResourceCard.stories.d.ts +19 -0
- package/dist/components/ReviewComment/ReviewComment.d.ts +41 -0
- package/dist/components/ReviewComment/ReviewComment.stories.d.ts +19 -0
- package/dist/components/RouteDiagram/RouteDiagram.d.ts +27 -0
- package/dist/components/RunTimeline/RunTimeline.d.ts +28 -0
- package/dist/components/RunTimeline/RunTimeline.stories.d.ts +31 -0
- package/dist/components/SaveBar/SaveBar.d.ts +56 -0
- package/dist/components/SaveBar/SaveBar.stories.d.ts +16 -0
- package/dist/components/SearchInput/SearchInput.d.ts +22 -0
- package/dist/components/SearchInput/SearchInput.stories.d.ts +18 -0
- package/dist/components/SearchPicker/SearchPicker.d.ts +49 -0
- package/dist/components/SearchPicker/SearchPicker.stories.d.ts +33 -0
- package/dist/components/Segmented/Segmented.d.ts +18 -0
- package/dist/components/Segmented/Segmented.stories.d.ts +18 -0
- package/dist/components/Select/Select.d.ts +26 -0
- package/dist/components/Select/Select.stories.d.ts +22 -0
- package/dist/components/ServiceStatus/ServiceStatus.d.ts +13 -0
- package/dist/components/SessionBar/SessionBar.d.ts +33 -0
- package/dist/components/SessionBar/SessionBar.stories.d.ts +27 -0
- package/dist/components/SettingRow/SettingRow.d.ts +17 -0
- package/dist/components/SettingRow/SettingRow.stories.d.ts +26 -0
- package/dist/components/SettingsShell/SettingsShell.d.ts +52 -0
- package/dist/components/SettingsShell/SettingsShell.stories.d.ts +9 -0
- package/dist/components/ShellTitle/ShellTitle.d.ts +25 -0
- package/dist/components/SiteShell/SiteShell.d.ts +24 -0
- package/dist/components/SiteShell/SiteShell.stories.d.ts +18 -0
- package/dist/components/Skeleton/Skeleton.d.ts +20 -0
- package/dist/components/Skeleton/Skeleton.stories.d.ts +15 -0
- package/dist/components/SortableList/SortableList.d.ts +30 -0
- package/dist/components/SortableList/SortableList.stories.d.ts +16 -0
- package/dist/components/Spinner/Spinner.d.ts +15 -0
- package/dist/components/Spinner/Spinner.stories.d.ts +14 -0
- package/dist/components/SplitHandle/SplitHandle.d.ts +25 -0
- package/dist/components/SplitHandle/SplitHandle.stories.d.ts +18 -0
- package/dist/components/Stack/Stack.d.ts +18 -0
- package/dist/components/Stack/Stack.stories.d.ts +12 -0
- package/dist/components/StatTile/StatTile.d.ts +30 -0
- package/dist/components/StatTile/StatTile.stories.d.ts +32 -0
- package/dist/components/StatusBar/StatusBar.d.ts +8 -0
- package/dist/components/StatusBar/StatusBar.stories.d.ts +15 -0
- package/dist/components/StatusDot/StatusDot.d.ts +18 -0
- package/dist/components/StatusDot/StatusDot.stories.d.ts +24 -0
- package/dist/components/StepDots/StepDots.d.ts +15 -0
- package/dist/components/StepDots/StepDots.stories.d.ts +15 -0
- package/dist/components/SwatchGroup/SwatchGroup.d.ts +20 -0
- package/dist/components/SwatchGroup/SwatchGroup.stories.d.ts +33 -0
- package/dist/components/Switch/Switch.d.ts +10 -0
- package/dist/components/Switch/Switch.stories.d.ts +17 -0
- package/dist/components/TabStrip/TabStrip.d.ts +44 -0
- package/dist/components/TabStrip/TabStrip.stories.d.ts +66 -0
- package/dist/components/Tabs/Tabs.d.ts +28 -0
- package/dist/components/Tabs/Tabs.stories.d.ts +34 -0
- package/dist/components/Tag/Tag.d.ts +12 -0
- package/dist/components/Tag/Tag.stories.d.ts +21 -0
- package/dist/components/Textarea/Textarea.d.ts +15 -0
- package/dist/components/Textarea/Textarea.stories.d.ts +19 -0
- package/dist/components/ThemeEditor/ThemeEditor.d.ts +56 -0
- package/dist/components/ThemePreview/ThemePreview.d.ts +15 -0
- package/dist/components/ThemeSwitch/ThemeSwitch.d.ts +30 -0
- package/dist/components/ThemeSwitch/ThemeSwitch.stories.d.ts +15 -0
- package/dist/components/TimeField/TimeField.d.ts +32 -0
- package/dist/components/TimeField/TimeField.stories.d.ts +36 -0
- package/dist/components/TimeField/time-text.d.ts +26 -0
- package/dist/components/TimeSeriesChart/TimeSeriesChart.d.ts +30 -0
- package/dist/components/TimeSeriesChart/TimeSeriesChart.stories.d.ts +29 -0
- package/dist/components/Toast/Toast.d.ts +18 -0
- package/dist/components/Toast/Toast.stories.d.ts +15 -0
- package/dist/components/Toast/Toaster.d.ts +18 -0
- package/dist/components/Toast/Toaster.stories.d.ts +16 -0
- package/dist/components/Toast/toast-region.d.ts +17 -0
- package/dist/components/Toast/toast-store.d.ts +46 -0
- package/dist/components/ToggleButton/ToggleButton.d.ts +16 -0
- package/dist/components/ToggleButton/ToggleButton.stories.d.ts +20 -0
- package/dist/components/Toolbar/Toolbar.d.ts +21 -0
- package/dist/components/Toolbar/Toolbar.stories.d.ts +25 -0
- package/dist/components/Tooltip/Tooltip.d.ts +13 -0
- package/dist/components/Tooltip/Tooltip.stories.d.ts +23 -0
- package/dist/components/TreeView/TreeView.d.ts +42 -0
- package/dist/components/TreeView/TreeView.stories.d.ts +26 -0
- package/dist/components/TreeView/pathRows.d.ts +16 -0
- package/dist/components/TreeView/treeKeys.d.ts +16 -0
- package/dist/components/UsageMeterRow/UsageMeterRow.d.ts +28 -0
- package/dist/components/UsageMeterRow/UsageMeterRow.stories.d.ts +26 -0
- package/dist/components/WorktreeRow/WorktreeRow.d.ts +32 -0
- package/dist/components/WorktreeRow/WorktreeRow.stories.d.ts +32 -0
- package/dist/components/ZoomBar/ZoomBar.d.ts +22 -0
- package/dist/components/ZoomBar/ZoomBar.stories.d.ts +17 -0
- package/dist/editor/RichTextEditor/EditorToolbar.d.ts +35 -0
- package/dist/editor/RichTextEditor/ImageBar.d.ts +17 -0
- package/dist/editor/RichTextEditor/LinkForm.d.ts +16 -0
- package/dist/editor/RichTextEditor/RichTextEditor.d.ts +45 -0
- package/dist/editor/RichTextEditor/RichTextEditor.stories.d.ts +43 -0
- package/dist/editor/RichTextEditor/extensions.d.ts +23 -0
- package/dist/editor/RichTextEditor/icons.d.ts +23 -0
- package/dist/editor/RichTextEditor/insertImage.d.ts +28 -0
- package/dist/editor/RichTextEditor/labels.d.ts +32 -0
- package/dist/editor/index.d.ts +4 -0
- package/dist/editor.js +629 -0
- package/dist/editor.js.map +1 -0
- package/dist/fonts.css +2 -0
- package/dist/icons.d.ts +891 -0
- package/dist/image/ImageCropper/ImageCropper.d.ts +39 -0
- package/dist/image/ImageCropper/ImageCropper.stories.d.ts +18 -0
- package/dist/image/ImageField/ImageField.d.ts +86 -0
- package/dist/image/ImageField/ImageField.stories.d.ts +29 -0
- package/dist/image/crop.d.ts +39 -0
- package/dist/image/index.d.ts +3 -0
- package/dist/image.js +377 -0
- package/dist/image.js.map +1 -0
- package/dist/index.d.ts +138 -0
- package/dist/index.js +8253 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/cx.d.ts +2 -0
- package/dist/internal/date.d.ts +96 -0
- package/dist/internal/duration.d.ts +4 -0
- package/dist/internal/focus.d.ts +34 -0
- package/dist/internal/keys.d.ts +21 -0
- package/dist/internal/modal.d.ts +8 -0
- package/dist/internal/portal.d.ts +9 -0
- package/dist/internal/position.d.ts +37 -0
- package/dist/internal/reveal.d.ts +6 -0
- package/dist/internal/roving.d.ts +25 -0
- package/dist/internal/scroll-fade.d.ts +16 -0
- package/dist/internal/session-labels.d.ts +3 -0
- package/dist/internal/text.d.ts +2 -0
- package/dist/llms-full.txt +9786 -0
- package/dist/llms.txt +162 -0
- package/dist/mcp.js +24706 -0
- package/dist/panZoom.d.ts +40 -0
- package/dist/styles.css +2 -0
- package/dist/styles.layered.css +4 -0
- package/dist/tailwind.css +38 -0
- package/dist/test-utils.d.ts +5 -0
- package/dist/theme/font.d.ts +20 -0
- package/dist/theme/index.d.ts +2 -0
- package/dist/theme/theme.d.ts +62 -0
- package/dist/tokens.css +304 -0
- package/dist/tokens.json +267 -0
- package/dist/types.d.ts +6 -0
- package/package.json +177 -4
- package/skills/xdev-ui-admin/SKILL.md +106 -0
- package/skills/xdev-ui-admin/references/audit-log.md +18 -0
- package/skills/xdev-ui-admin/references/console-chrome.md +119 -0
- package/skills/xdev-ui-admin/references/dashboard.md +24 -0
- package/skills/xdev-ui-admin/references/detail-and-forms.md +22 -0
- package/skills/xdev-ui-admin/references/dialogs.md +33 -0
- package/skills/xdev-ui-admin/references/forms.md +60 -0
- package/skills/xdev-ui-admin/references/from-other-kits.md +75 -0
- package/skills/xdev-ui-admin/references/layout.md +58 -0
- package/skills/xdev-ui-admin/references/navigation.md +10 -0
- package/skills/xdev-ui-admin/references/permissions.md +26 -0
- package/skills/xdev-ui-admin/references/resource-list.md +64 -0
- package/skills/xdev-ui-admin/references/responsive.md +68 -0
- package/skills/xdev-ui-admin/references/rich-content.md +37 -0
- package/skills/xdev-ui-admin/references/settings.md +20 -0
- package/skills/xdev-ui-admin/references/sign-in.md +47 -0
- package/skills/xdev-ui-admin/references/states-feedback.md +26 -0
- package/skills/xdev-ui-admin/references/tree-list.md +50 -0
- package/skills/xdev-ui-admin/references/users-roles.md +32 -0
- package/skills/xdev-ui-admin/references/ux-principles.md +43 -0
- package/skills/xdev-ui-admin/references/visual-identity.md +62 -0
- package/skills/xdev-ui-admin/templates/admin/_gitignore +3 -0
- package/skills/xdev-ui-admin/templates/admin/_mcp.json +5 -0
- package/skills/xdev-ui-admin/templates/admin/_npmrc +2 -0
- package/skills/xdev-ui-admin/templates/admin/index.html +14 -0
- package/skills/xdev-ui-admin/templates/admin/package.json +24 -0
- package/skills/xdev-ui-admin/templates/admin/src/App.tsx +66 -0
- package/skills/xdev-ui-admin/templates/admin/src/app.css +26 -0
- package/skills/xdev-ui-admin/templates/admin/src/auth/permissions.ts +7 -0
- package/skills/xdev-ui-admin/templates/admin/src/auth/session.ts +42 -0
- package/skills/xdev-ui-admin/templates/admin/src/data/context.ts +11 -0
- package/skills/xdev-ui-admin/templates/admin/src/data/store.ts +84 -0
- package/skills/xdev-ui-admin/templates/admin/src/data/useLoad.ts +25 -0
- package/skills/xdev-ui-admin/templates/admin/src/i18n/en.ts +98 -0
- package/skills/xdev-ui-admin/templates/admin/src/i18n/index.tsx +63 -0
- package/skills/xdev-ui-admin/templates/admin/src/i18n/vi.ts +98 -0
- package/skills/xdev-ui-admin/templates/admin/src/i18n/xdev-ui-labels.ts +47 -0
- package/skills/xdev-ui-admin/templates/admin/src/main.tsx +12 -0
- package/skills/xdev-ui-admin/templates/admin/src/notify.tsx +36 -0
- package/skills/xdev-ui-admin/templates/admin/src/pages/Dashboard.tsx +55 -0
- package/skills/xdev-ui-admin/templates/admin/src/pages/ItemDetail.tsx +83 -0
- package/skills/xdev-ui-admin/templates/admin/src/pages/ItemsList.tsx +140 -0
- package/skills/xdev-ui-admin/templates/admin/src/pages/NotFound.tsx +17 -0
- package/skills/xdev-ui-admin/templates/admin/src/pages/Settings.tsx +37 -0
- package/skills/xdev-ui-admin/templates/admin/src/pages/SignIn.tsx +105 -0
- package/skills/xdev-ui-admin/templates/admin/src/router.ts +49 -0
- package/skills/xdev-ui-admin/templates/admin/src/shell/AccountMenu.tsx +36 -0
- package/skills/xdev-ui-admin/templates/admin/src/shell/Shell.tsx +53 -0
- package/skills/xdev-ui-admin/templates/admin/src/theme.ts +34 -0
- package/skills/xdev-ui-admin/templates/admin/tsconfig.json +16 -0
- package/skills/xdev-ui-admin/templates/admin/vite.config.ts +4 -0
- package/skills/xdev-ui-build-app/SKILL.md +85 -0
- package/skills/xdev-ui-build-app/references/app-shell.md +20 -0
- package/skills/xdev-ui-build-app/references/i18n.md +9 -0
- package/skills/xdev-ui-build-app/references/responsive-a11y.md +10 -0
- package/skills/xdev-ui-build-app/references/routing.md +14 -0
- package/skills/xdev-ui-build-app/references/setup.md +25 -0
- package/skills/xdev-ui-build-app/references/states.md +25 -0
- package/skills/xdev-ui-build-app/references/theme.md +11 -0
- package/skills/xdev-ui-build-app/templates/app/_gitignore +3 -0
- package/skills/xdev-ui-build-app/templates/app/_mcp.json +5 -0
- package/skills/xdev-ui-build-app/templates/app/_npmrc +2 -0
- package/skills/xdev-ui-build-app/templates/app/index.html +14 -0
- package/skills/xdev-ui-build-app/templates/app/package.json +24 -0
- package/skills/xdev-ui-build-app/templates/app/src/App.tsx +77 -0
- package/skills/xdev-ui-build-app/templates/app/src/app.css +3 -0
- package/skills/xdev-ui-build-app/templates/app/src/i18n/en.ts +35 -0
- package/skills/xdev-ui-build-app/templates/app/src/i18n/index.tsx +63 -0
- package/skills/xdev-ui-build-app/templates/app/src/i18n/vi.ts +35 -0
- package/skills/xdev-ui-build-app/templates/app/src/i18n/xdev-ui-labels.ts +19 -0
- package/skills/xdev-ui-build-app/templates/app/src/main.tsx +12 -0
- package/skills/xdev-ui-build-app/templates/app/src/notify.tsx +36 -0
- package/skills/xdev-ui-build-app/templates/app/src/pages/Home.tsx +22 -0
- package/skills/xdev-ui-build-app/templates/app/src/pages/NotFound.tsx +17 -0
- package/skills/xdev-ui-build-app/templates/app/src/pages/Settings.tsx +35 -0
- package/skills/xdev-ui-build-app/templates/app/src/router.ts +26 -0
- package/skills/xdev-ui-build-app/templates/app/src/theme.ts +34 -0
- package/skills/xdev-ui-build-app/templates/app/tsconfig.json +16 -0
- package/skills/xdev-ui-build-app/templates/app/vite.config.ts +4 -0
- package/skills/xdev-ui-design/SKILL.md +111 -0
- package/skills/xdev-ui-design/references/brand.md +58 -0
- package/skills/xdev-ui-design/references/checklist.md +55 -0
- package/skills/xdev-ui-design/references/owner-notes.md +54 -0
- package/skills/xdev-ui-design/references/porting.md +56 -0
- package/skills/xdev-ui-design/references/rules.md +135 -0
- package/skills/xdev-ui-design/references/screens.md +61 -0
- package/skills/xdev-ui-design/references/tokens.md +97 -0
- package/skills/xdev-ui-improve/SKILL.md +96 -0
- package/skills/xdev-ui-improve/references/plan-template.md +59 -0
- package/skills/xdev-ui-motion/SKILL.md +87 -0
- package/skills/xdev-ui-motion/references/recipes.md +117 -0
- package/skills/xdev-ui-review/SKILL.md +141 -0
- package/skills/xdev-ui-review/references/checklist.md +92 -0
- package/skills/xdev-ui-review/references/grep-recipes.md +37 -0
- package/skills/xdev-ui-review/references/pages/dashboard.md +21 -0
- package/skills/xdev-ui-review/references/pages/dialogs-forms.md +23 -0
- package/skills/xdev-ui-review/references/pages/list.md +22 -0
- package/skills/xdev-ui-review/references/pages/provider-grid.md +19 -0
- package/skills/xdev-ui-review/references/pages/settings.md +18 -0
- package/skills/xdev-ui-review/references/pages/sign-in.md +21 -0
- package/skills/xdev-ui-review/references/web-interface.md +73 -0
- package/skills/xdev-ui-review/scripts/audit.mjs +775 -0
- package/skills/xdev-ui-ux-standards/SKILL.md +88 -0
- package/skills/xdev-ui-ux-standards/references/heuristics-checklist.md +129 -0
- package/skills/xdev-ui-ux-standards/references/patterns.md +120 -0
- package/skills/xdev-ui-ux-standards/references/platforms.md +104 -0
- package/skills/xdev-ui-ux-standards/references/standards-map.md +144 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { type JSX, type ReactNode } from "react";
|
|
2
|
+
import type { CropArea } from "../crop";
|
|
3
|
+
export declare const MIN_ZOOM = 1;
|
|
4
|
+
export declare const MAX_ZOOM = 3;
|
|
5
|
+
export interface ImageCropperLabels {
|
|
6
|
+
/** Dialog title; the `title` prop wins. */
|
|
7
|
+
title: string;
|
|
8
|
+
/** One line under the title on how to move and zoom. */
|
|
9
|
+
description: string;
|
|
10
|
+
/** Names the crop frame for screen readers (it takes focus and moves with the arrow keys). */
|
|
11
|
+
area: string;
|
|
12
|
+
zoom: string;
|
|
13
|
+
rotate: string;
|
|
14
|
+
reset: string;
|
|
15
|
+
cancel: string;
|
|
16
|
+
confirm: string;
|
|
17
|
+
}
|
|
18
|
+
export interface ImageCropperProps {
|
|
19
|
+
/** The image to crop: an object URL or a same-origin (or CORS-enabled) URL. */
|
|
20
|
+
src: string;
|
|
21
|
+
/** Width / height of the crop frame, e.g. 16 / 9. */
|
|
22
|
+
aspect: number;
|
|
23
|
+
/** Cancel and Esc (a click on the backdrop does not close it, so a drag that ends outside keeps the crop). Not called while `busy`. */
|
|
24
|
+
onCancel: () => void;
|
|
25
|
+
/** The chosen area in pixels of the rotated image, and the rotation in degrees (0, 90, 180, 270). */
|
|
26
|
+
onConfirm: (area: CropArea, rotation: number) => void;
|
|
27
|
+
/** Overrides `labels.title`. */
|
|
28
|
+
title?: ReactNode;
|
|
29
|
+
/** The caller is processing the crop: both buttons are disabled and every close request is ignored. */
|
|
30
|
+
busy?: boolean;
|
|
31
|
+
/** false renders the markup only (previews). Default true. */
|
|
32
|
+
modal?: boolean;
|
|
33
|
+
labels?: Partial<ImageCropperLabels>;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Modal crop dialog with a fixed frame ratio. Mount it only while open, with a `key` per image, so zoom, rotation
|
|
37
|
+
* and position start fresh.
|
|
38
|
+
*/
|
|
39
|
+
export declare function ImageCropper({ src, aspect, onCancel, onConfirm, title, busy, modal, labels }: ImageCropperProps): JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { StoryObj } from "@storybook/react-vite";
|
|
2
|
+
import { ImageCropper } from "./ImageCropper";
|
|
3
|
+
declare const meta: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: typeof ImageCropper;
|
|
6
|
+
args: {
|
|
7
|
+
src: string;
|
|
8
|
+
aspect: number;
|
|
9
|
+
modal: false;
|
|
10
|
+
onCancel: import("storybook/test").Mock<(...args: any[]) => any>;
|
|
11
|
+
onConfirm: import("storybook/test").Mock<(...args: any[]) => any>;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export default meta;
|
|
15
|
+
type Story = StoryObj<typeof meta>;
|
|
16
|
+
export declare const Wide: Story;
|
|
17
|
+
export declare const Square: Story;
|
|
18
|
+
export declare const Busy: Story;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { type JSX, type ReactNode } from "react";
|
|
2
|
+
import { type FileRejectReason } from "../../components/FileDrop/FileDrop";
|
|
3
|
+
import { type EncodeOptions, type ImageAspect } from "../crop";
|
|
4
|
+
import { type ImageCropperLabels } from "../ImageCropper/ImageCropper";
|
|
5
|
+
export declare const IMAGE_ACCEPT = "image/jpeg,image/png,image/webp";
|
|
6
|
+
export declare const IMAGE_MAX_SIZE: number;
|
|
7
|
+
/** The image the user picked, kept so "Crop again" starts from it, tied to the value its upload produced. */
|
|
8
|
+
export type KeptOriginal = {
|
|
9
|
+
url: string;
|
|
10
|
+
value: string;
|
|
11
|
+
};
|
|
12
|
+
/** The image "Crop again" opens: the kept original when the field still shows what it produced, else the value. */
|
|
13
|
+
export declare function recropSource(kept: KeptOriginal | null, value: string | null | undefined): string | null;
|
|
14
|
+
/**
|
|
15
|
+
* After a successful upload: which original to keep and which object URLs to revoke. `result` is what `onUpload`
|
|
16
|
+
* resolved to; only a string ties the original to the new value.
|
|
17
|
+
*/
|
|
18
|
+
export declare function afterUpload(kept: KeptOriginal | null, source: {
|
|
19
|
+
url: string;
|
|
20
|
+
fresh: boolean;
|
|
21
|
+
}, result: unknown): {
|
|
22
|
+
kept: KeptOriginal | null;
|
|
23
|
+
revoke: string[];
|
|
24
|
+
};
|
|
25
|
+
/** Object URLs the field created; `revoke` touches only those, `revokeAll` runs on unmount. */
|
|
26
|
+
export declare function urlTracker(create?: (blob: Blob) => string, release?: (url: string) => void): {
|
|
27
|
+
create: (blob: Blob) => string;
|
|
28
|
+
revoke: (url: string | null | undefined) => void;
|
|
29
|
+
revokeAll: () => void;
|
|
30
|
+
};
|
|
31
|
+
/** "JPEG, PNG, WEBP" from "image/jpeg,image/png,.webp". */
|
|
32
|
+
export declare function describeAccept(accept: string): string;
|
|
33
|
+
/** File name for the upload: the picked name with the extension of the encoded type. */
|
|
34
|
+
export declare function outputName(name: string, type?: string): string;
|
|
35
|
+
export interface ImageFieldLabels {
|
|
36
|
+
/** The empty zone's main line. */
|
|
37
|
+
drop: string;
|
|
38
|
+
/** The link-styled part of it. */
|
|
39
|
+
browse: string;
|
|
40
|
+
/** Hint in the empty zone, from the formats and the size limit. */
|
|
41
|
+
limits: (formats: string, maxSize: string | undefined) => string;
|
|
42
|
+
rejected: (name: string, reason: FileRejectReason, maxSize: string | undefined) => string;
|
|
43
|
+
/** Shown when `onUpload` rejects with something that is not an `Error` with a message. */
|
|
44
|
+
failed: string;
|
|
45
|
+
uploading: string;
|
|
46
|
+
recrop: string;
|
|
47
|
+
replace: string;
|
|
48
|
+
remove: string;
|
|
49
|
+
/** Passed to the crop dialog. */
|
|
50
|
+
cropper: Partial<ImageCropperLabels>;
|
|
51
|
+
}
|
|
52
|
+
export interface ImageFieldProps {
|
|
53
|
+
label: ReactNode;
|
|
54
|
+
/** Crop ratio and the exported size in pixels. */
|
|
55
|
+
aspect: ImageAspect;
|
|
56
|
+
/** URL of the current image (shown as the preview), or null. */
|
|
57
|
+
value: string | null | undefined;
|
|
58
|
+
/** Called with the URL `onUpload` resolved to, and with null on Remove. */
|
|
59
|
+
onChange: (value: string | null) => void;
|
|
60
|
+
/**
|
|
61
|
+
* Uploads the cropped image. Resolve to the new URL to have it passed to `onChange` (and "Crop again" start from the
|
|
62
|
+
* picked original); resolve to nothing to update `value` yourself. Reject to show the error under the field.
|
|
63
|
+
*/
|
|
64
|
+
onUpload: (blob: Blob, name: string) => Promise<string | void>;
|
|
65
|
+
/** True from the crop until the upload settles; lock the form's submit while true. */
|
|
66
|
+
onBusyChange?: (busy: boolean) => void;
|
|
67
|
+
accept?: string;
|
|
68
|
+
/** Bytes. Default 10 MB. */
|
|
69
|
+
maxSize?: number;
|
|
70
|
+
/** Output type and quality; WebP 0.85 by default. */
|
|
71
|
+
encode?: EncodeOptions;
|
|
72
|
+
required?: boolean;
|
|
73
|
+
disabled?: boolean;
|
|
74
|
+
hint?: ReactNode;
|
|
75
|
+
/** A validation message from the form; the field's own errors (wrong file, failed upload) take its place. */
|
|
76
|
+
error?: ReactNode;
|
|
77
|
+
/** Extra buttons next to the field's own ("Choose from library"). */
|
|
78
|
+
actions?: ReactNode;
|
|
79
|
+
labels?: Partial<ImageFieldLabels>;
|
|
80
|
+
className?: string;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* One image with a fixed ratio: pick or drop a file, crop it in `ImageCropper`, upload the result through `onUpload`
|
|
84
|
+
* and show it. It stores nothing itself.
|
|
85
|
+
*/
|
|
86
|
+
export declare function ImageField({ label, aspect, value, onChange, onUpload, onBusyChange, accept, maxSize, encode, required, disabled, hint, error, actions, labels, className, }: ImageFieldProps): JSX.Element;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { StoryObj } from "@storybook/react-vite";
|
|
2
|
+
import { ImageField, type ImageFieldProps } from "./ImageField";
|
|
3
|
+
/** Stands in for a server: waits a moment and serves the cropped image from an object URL. */
|
|
4
|
+
declare const fakeUpload: (blob: Blob) => Promise<string>;
|
|
5
|
+
declare const meta: {
|
|
6
|
+
title: string;
|
|
7
|
+
component: typeof ImageField;
|
|
8
|
+
render: (args: ImageFieldProps) => import("react").JSX.Element;
|
|
9
|
+
args: {
|
|
10
|
+
label: string;
|
|
11
|
+
aspect: {
|
|
12
|
+
ratio: number;
|
|
13
|
+
width: number;
|
|
14
|
+
height: number;
|
|
15
|
+
};
|
|
16
|
+
value: null;
|
|
17
|
+
onChange: import("storybook/test").Mock<(...args: any[]) => any>;
|
|
18
|
+
onUpload: typeof fakeUpload;
|
|
19
|
+
onBusyChange: import("storybook/test").Mock<(...args: any[]) => any>;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
export default meta;
|
|
23
|
+
type Story = StoryObj<typeof meta>;
|
|
24
|
+
export declare const Empty: Story;
|
|
25
|
+
export declare const WithImage: Story;
|
|
26
|
+
export declare const WithLibrary: Story;
|
|
27
|
+
export declare const Invalid: Story;
|
|
28
|
+
export declare const UploadFails: Story;
|
|
29
|
+
export declare const Disabled: Story;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export type Size = {
|
|
2
|
+
width: number;
|
|
3
|
+
height: number;
|
|
4
|
+
};
|
|
5
|
+
export type CropArea = {
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
8
|
+
width: number;
|
|
9
|
+
height: number;
|
|
10
|
+
};
|
|
11
|
+
/** Fixed output of an image field: the ratio of the crop frame and the exported size in pixels. */
|
|
12
|
+
export type ImageAspect = {
|
|
13
|
+
ratio: number;
|
|
14
|
+
width: number;
|
|
15
|
+
height: number;
|
|
16
|
+
};
|
|
17
|
+
/** Size of the image after a rotation by `degrees` (multiples of 90). */
|
|
18
|
+
export declare function rotatedSize(width: number, height: number, degrees: number): Size;
|
|
19
|
+
/** Scales down to `max` wide, keeping the ratio; never scales up. */
|
|
20
|
+
export declare function fitWidth(width: number, height: number, max?: number): Size;
|
|
21
|
+
/** True when `width / height` is within `tolerance` (relative) of `ratio`. */
|
|
22
|
+
export declare function sameAspect(width: number, height: number, ratio: number, tolerance?: number): boolean;
|
|
23
|
+
/** Replaces the file extension, or appends one when there is none. */
|
|
24
|
+
export declare function renameExtension(name: string, ext: string): string;
|
|
25
|
+
export declare function loadImage(src: string): Promise<HTMLImageElement>;
|
|
26
|
+
export type EncodeOptions = {
|
|
27
|
+
type?: string;
|
|
28
|
+
quality?: number;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Draws the cropped, rotated area straight onto a canvas of the output size (never a canvas of the
|
|
32
|
+
* full photo, which iOS Safari refuses for large images) and encodes it (WebP by default).
|
|
33
|
+
*/
|
|
34
|
+
export declare function cropToBlob(image: CanvasImageSource & {
|
|
35
|
+
naturalWidth: number;
|
|
36
|
+
naturalHeight: number;
|
|
37
|
+
}, area: CropArea, rotation: number, out: Size, { type, quality }?: EncodeOptions): Promise<Blob>;
|
|
38
|
+
/** Re-encodes the whole image at most `max` wide (for images pasted into rich text). */
|
|
39
|
+
export declare function resizeToBlob(image: HTMLImageElement, max?: number, options?: EncodeOptions): Promise<Blob>;
|
package/dist/image.js
ADDED
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { a as e, i as t, n, o as r, r as i, s as a, t as o } from "./chunks/crop-CahE3q01.js";
|
|
3
|
+
import { c as s, d as c, n as l, o as u, r as d, s as f } from "./chunks/FileDrop-C-ygn8kF.js";
|
|
4
|
+
import { t as p } from "./chunks/modal-BYFY08ti.js";
|
|
5
|
+
import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
6
|
+
import { useEffect as _, useId as ee, useRef as v, useState as y } from "react";
|
|
7
|
+
import b from "react-easy-crop";
|
|
8
|
+
// src/image/ImageCropper/ImageCropper.tsx
|
|
9
|
+
var x = 1, S = 3, C = {
|
|
10
|
+
title: "Crop image",
|
|
11
|
+
description: "Drag the image or use the arrow keys to move it. Scroll or use Zoom to zoom in.",
|
|
12
|
+
area: "Crop frame",
|
|
13
|
+
zoom: "Zoom",
|
|
14
|
+
rotate: "Rotate 90°",
|
|
15
|
+
reset: "Reset",
|
|
16
|
+
cancel: "Cancel",
|
|
17
|
+
confirm: "Use this image"
|
|
18
|
+
};
|
|
19
|
+
function w({ src: e, aspect: t, onCancel: n, onConfirm: r, title: i, busy: a, modal: o = !0, labels: s }) {
|
|
20
|
+
let c = {
|
|
21
|
+
...C,
|
|
22
|
+
...s
|
|
23
|
+
}, l = ee(), d = `x-cropper-${l}`, f = `x-cropper-d-${l}`, [m, _] = y({
|
|
24
|
+
x: 0,
|
|
25
|
+
y: 0
|
|
26
|
+
}), [x, S] = y(1), [w, T] = y(0), [E, D] = y(null), O = v(null), k = v(null), A = v(null), j = () => {
|
|
27
|
+
a || n();
|
|
28
|
+
}, M = p(o, O, k, j);
|
|
29
|
+
return /* @__PURE__ */ h("div", {
|
|
30
|
+
className: "dialog-backdrop",
|
|
31
|
+
ref: O,
|
|
32
|
+
"data-modal": o ? "true" : void 0,
|
|
33
|
+
onKeyDown: M ? (e) => {
|
|
34
|
+
M(e), (e.key === "Tab" || e.key === "Escape") && e.stopPropagation();
|
|
35
|
+
} : void 0,
|
|
36
|
+
children: /* @__PURE__ */ g("div", {
|
|
37
|
+
ref: k,
|
|
38
|
+
className: "dialog x-image-cropper",
|
|
39
|
+
role: "dialog",
|
|
40
|
+
"aria-modal": o ? "true" : void 0,
|
|
41
|
+
"aria-labelledby": d,
|
|
42
|
+
"aria-describedby": f,
|
|
43
|
+
"aria-busy": a ? "true" : void 0,
|
|
44
|
+
tabIndex: o ? -1 : void 0,
|
|
45
|
+
children: [
|
|
46
|
+
/* @__PURE__ */ h("h2", {
|
|
47
|
+
className: "dialog-title",
|
|
48
|
+
id: d,
|
|
49
|
+
children: i ?? c.title
|
|
50
|
+
}),
|
|
51
|
+
/* @__PURE__ */ h("p", {
|
|
52
|
+
className: "x-image-cropper-desc",
|
|
53
|
+
id: f,
|
|
54
|
+
children: c.description
|
|
55
|
+
}),
|
|
56
|
+
/* @__PURE__ */ h("div", {
|
|
57
|
+
className: "x-image-cropper-stage",
|
|
58
|
+
ref: A,
|
|
59
|
+
children: /* @__PURE__ */ h(b, {
|
|
60
|
+
image: e,
|
|
61
|
+
crop: m,
|
|
62
|
+
zoom: x,
|
|
63
|
+
rotation: w,
|
|
64
|
+
aspect: t,
|
|
65
|
+
minZoom: 1,
|
|
66
|
+
maxZoom: 3,
|
|
67
|
+
keyboardStep: 10,
|
|
68
|
+
cropperProps: { "aria-label": c.area },
|
|
69
|
+
onCropChange: _,
|
|
70
|
+
onZoomChange: S,
|
|
71
|
+
onRotationChange: T,
|
|
72
|
+
onCropComplete: (e, t) => D(t),
|
|
73
|
+
onMediaLoaded: () => {
|
|
74
|
+
o && requestAnimationFrame(() => A.current?.querySelector(".reactEasyCrop_CropArea")?.focus());
|
|
75
|
+
}
|
|
76
|
+
})
|
|
77
|
+
}),
|
|
78
|
+
/* @__PURE__ */ g("div", {
|
|
79
|
+
className: "x-image-cropper-tools",
|
|
80
|
+
children: [
|
|
81
|
+
/* @__PURE__ */ g("label", {
|
|
82
|
+
className: "x-image-cropper-zoom",
|
|
83
|
+
children: [
|
|
84
|
+
/* @__PURE__ */ h("span", { children: c.zoom }),
|
|
85
|
+
/* @__PURE__ */ h("input", {
|
|
86
|
+
type: "range",
|
|
87
|
+
min: 1,
|
|
88
|
+
max: 3,
|
|
89
|
+
step: .05,
|
|
90
|
+
value: x,
|
|
91
|
+
disabled: a,
|
|
92
|
+
onChange: (e) => S(Number(e.currentTarget.value))
|
|
93
|
+
}),
|
|
94
|
+
/* @__PURE__ */ g("output", {
|
|
95
|
+
"aria-hidden": "true",
|
|
96
|
+
children: [x.toFixed(1), "×"]
|
|
97
|
+
})
|
|
98
|
+
]
|
|
99
|
+
}),
|
|
100
|
+
/* @__PURE__ */ h(u, {
|
|
101
|
+
variant: "secondary",
|
|
102
|
+
icon: "refresh",
|
|
103
|
+
disabled: a,
|
|
104
|
+
onClick: () => T((e) => (e + 90) % 360),
|
|
105
|
+
children: c.rotate
|
|
106
|
+
}),
|
|
107
|
+
/* @__PURE__ */ h(u, {
|
|
108
|
+
variant: "secondary",
|
|
109
|
+
icon: "undo",
|
|
110
|
+
disabled: a,
|
|
111
|
+
onClick: () => {
|
|
112
|
+
_({
|
|
113
|
+
x: 0,
|
|
114
|
+
y: 0
|
|
115
|
+
}), S(1), T(0);
|
|
116
|
+
},
|
|
117
|
+
children: c.reset
|
|
118
|
+
})
|
|
119
|
+
]
|
|
120
|
+
}),
|
|
121
|
+
/* @__PURE__ */ g("div", {
|
|
122
|
+
className: "dialog-actions",
|
|
123
|
+
children: [/* @__PURE__ */ h(u, {
|
|
124
|
+
variant: "secondary",
|
|
125
|
+
onClick: j,
|
|
126
|
+
disabled: a,
|
|
127
|
+
children: c.cancel
|
|
128
|
+
}), /* @__PURE__ */ g(u, {
|
|
129
|
+
variant: "primary",
|
|
130
|
+
onClick: () => {
|
|
131
|
+
E && !a && r(E, w);
|
|
132
|
+
},
|
|
133
|
+
disabled: !E || a,
|
|
134
|
+
children: [a ? /* @__PURE__ */ h("span", {
|
|
135
|
+
className: "x-spinner",
|
|
136
|
+
"data-size": "sm",
|
|
137
|
+
"aria-hidden": "true",
|
|
138
|
+
children: /* @__PURE__ */ h("span", { className: "x-spinner-ring" })
|
|
139
|
+
}) : null, c.confirm]
|
|
140
|
+
})]
|
|
141
|
+
})
|
|
142
|
+
]
|
|
143
|
+
})
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
// src/image/ImageField/ImageField.tsx
|
|
147
|
+
var T = "image/jpeg,image/png,image/webp", E = 10485760;
|
|
148
|
+
function D(e, t) {
|
|
149
|
+
return t ? e && e.value === t ? e.url : t : null;
|
|
150
|
+
}
|
|
151
|
+
function O(e, t, n) {
|
|
152
|
+
let r = typeof n == "string" && n ? {
|
|
153
|
+
url: t.url,
|
|
154
|
+
value: n
|
|
155
|
+
} : null, i = [];
|
|
156
|
+
return e && e.url !== r?.url && i.push(e.url), t.fresh && !r && !i.includes(t.url) && i.push(t.url), {
|
|
157
|
+
kept: r,
|
|
158
|
+
revoke: i
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
function k(e = (e) => URL.createObjectURL(e), t = (e) => URL.revokeObjectURL(e)) {
|
|
162
|
+
let n = /* @__PURE__ */ new Set();
|
|
163
|
+
return {
|
|
164
|
+
create(t) {
|
|
165
|
+
let r = e(t);
|
|
166
|
+
return n.add(r), r;
|
|
167
|
+
},
|
|
168
|
+
revoke(e) {
|
|
169
|
+
e && n.delete(e) && t(e);
|
|
170
|
+
},
|
|
171
|
+
revokeAll() {
|
|
172
|
+
for (let e of n) t(e);
|
|
173
|
+
n.clear();
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
function A(e) {
|
|
178
|
+
return e.split(",").map((e) => e.trim().replace(/^image\//, "").replace(/^\./, "").toUpperCase()).filter(Boolean).join(", ");
|
|
179
|
+
}
|
|
180
|
+
function j(e, n = "image/webp") {
|
|
181
|
+
let r = n.split("/")[1] ?? "webp";
|
|
182
|
+
return t(e, r === "jpeg" ? "jpg" : r);
|
|
183
|
+
}
|
|
184
|
+
var M = {
|
|
185
|
+
drop: "Drop an image here or",
|
|
186
|
+
browse: "browse",
|
|
187
|
+
limits: (e, t) => [e, t ? `up to ${t}` : ""].filter(Boolean).join(", "),
|
|
188
|
+
rejected: (e, t, n) => t === "type" ? `${e}: this file type is not accepted` : t === "size" ? `${e} is larger than ${n ?? "the limit"}` : `${e}: drop one image`,
|
|
189
|
+
failed: "The image could not be uploaded",
|
|
190
|
+
uploading: "Uploading image",
|
|
191
|
+
recrop: "Crop again",
|
|
192
|
+
replace: "Replace",
|
|
193
|
+
remove: "Remove",
|
|
194
|
+
cropper: {}
|
|
195
|
+
};
|
|
196
|
+
function N({ label: e, aspect: t, value: n, onChange: r, onUpload: a, onBusyChange: p, accept: b = T, maxSize: x = E, encode: S, required: C, disabled: N, hint: te, error: ne, actions: P, labels: re, className: ie }) {
|
|
197
|
+
let F = {
|
|
198
|
+
...M,
|
|
199
|
+
...re
|
|
200
|
+
}, I = `x-image-field-${ee()}`, L = `${I}-label`, R = `${I}-note`, [ae, z] = y(!1), [B, V] = y(null), [oe, H] = y(null), [U, W] = y(null), G = v(null), K = v(null);
|
|
201
|
+
K.current ??= k();
|
|
202
|
+
let q = v(null), J = v(!0), se = v(!1), Y = v(p);
|
|
203
|
+
_(() => {
|
|
204
|
+
Y.current = p;
|
|
205
|
+
}), _(() => {
|
|
206
|
+
J.current = !0;
|
|
207
|
+
let e = K.current;
|
|
208
|
+
return () => {
|
|
209
|
+
J.current = !1, e?.revokeAll(), se.current && Y.current?.(!1);
|
|
210
|
+
};
|
|
211
|
+
}, []);
|
|
212
|
+
let X = U !== null, Z = N || X, ce = d(x), le = (e) => {
|
|
213
|
+
se.current = e, Y.current?.(e);
|
|
214
|
+
}, ue = (e) => {
|
|
215
|
+
let t = e?.[0];
|
|
216
|
+
if (!t || Z) return;
|
|
217
|
+
let { rejected: n } = l([t], {
|
|
218
|
+
accept: b,
|
|
219
|
+
maxSize: x
|
|
220
|
+
}), [r] = n;
|
|
221
|
+
r ? H(F.rejected(t.name, r.reason, ce)) : (H(null), V({
|
|
222
|
+
url: K.current.create(t),
|
|
223
|
+
name: t.name,
|
|
224
|
+
fresh: !0
|
|
225
|
+
}));
|
|
226
|
+
}, de = () => {
|
|
227
|
+
B?.fresh && K.current.revoke(B.url), V(null);
|
|
228
|
+
}, fe = async (e, n) => {
|
|
229
|
+
let s = B;
|
|
230
|
+
if (!s) return;
|
|
231
|
+
V(null), H(null), le(!0);
|
|
232
|
+
let c = null;
|
|
233
|
+
try {
|
|
234
|
+
let l = await i(s.url), u = await o(l, e, n, t, S);
|
|
235
|
+
if (!J.current) return;
|
|
236
|
+
c = K.current.create(u), W(c);
|
|
237
|
+
let d = await a(u, j(s.name, S?.type));
|
|
238
|
+
if (!J.current) return;
|
|
239
|
+
let f = O(q.current, s, d);
|
|
240
|
+
q.current = f.kept, f.revoke.forEach((e) => K.current.revoke(e)), typeof d == "string" && d && r(d);
|
|
241
|
+
} catch (e) {
|
|
242
|
+
s.fresh && K.current.revoke(s.url), J.current && H(e instanceof Error && e.message ? e.message : F.failed);
|
|
243
|
+
} finally {
|
|
244
|
+
K.current.revoke(c), J.current && (W(null), le(!1));
|
|
245
|
+
}
|
|
246
|
+
}, pe = () => {
|
|
247
|
+
let e = D(q.current, n);
|
|
248
|
+
e && V({
|
|
249
|
+
url: e,
|
|
250
|
+
name: "image",
|
|
251
|
+
fresh: !1
|
|
252
|
+
});
|
|
253
|
+
}, me = () => {
|
|
254
|
+
H(null), K.current.revoke(q.current?.url), q.current = null, r(null);
|
|
255
|
+
}, he = (e) => {
|
|
256
|
+
e.preventDefault(), Z || z(!0);
|
|
257
|
+
}, ge = (e) => {
|
|
258
|
+
e.preventDefault(), z(!1), ue(e.dataTransfer.files);
|
|
259
|
+
}, Q = U ?? n ?? null, $ = oe ?? ne, _e = F.limits(A(b), ce);
|
|
260
|
+
return /* @__PURE__ */ g("div", {
|
|
261
|
+
className: c("x-image-field", ie),
|
|
262
|
+
"data-over": ae ? "true" : void 0,
|
|
263
|
+
"data-disabled": N ? "true" : void 0,
|
|
264
|
+
"data-invalid": $ ? "true" : void 0,
|
|
265
|
+
onDragOver: he,
|
|
266
|
+
onDragLeave: () => z(!1),
|
|
267
|
+
onDrop: ge,
|
|
268
|
+
children: [
|
|
269
|
+
/* @__PURE__ */ g("span", {
|
|
270
|
+
className: "x-image-field-label",
|
|
271
|
+
id: L,
|
|
272
|
+
children: [e, C ? /* @__PURE__ */ h("span", {
|
|
273
|
+
className: "x-image-field-required",
|
|
274
|
+
"aria-hidden": "true",
|
|
275
|
+
children: "*"
|
|
276
|
+
}) : null]
|
|
277
|
+
}),
|
|
278
|
+
te ? /* @__PURE__ */ h("small", {
|
|
279
|
+
className: "x-image-field-hint",
|
|
280
|
+
children: te
|
|
281
|
+
}) : null,
|
|
282
|
+
/* @__PURE__ */ h("input", {
|
|
283
|
+
ref: G,
|
|
284
|
+
id: I,
|
|
285
|
+
className: "x-sr-only",
|
|
286
|
+
type: "file",
|
|
287
|
+
accept: b,
|
|
288
|
+
disabled: Z,
|
|
289
|
+
"aria-required": C ? !0 : void 0,
|
|
290
|
+
"aria-labelledby": L,
|
|
291
|
+
"aria-describedby": $ ? R : void 0,
|
|
292
|
+
"aria-invalid": $ ? !0 : void 0,
|
|
293
|
+
tabIndex: Q ? -1 : void 0,
|
|
294
|
+
onChange: (e) => {
|
|
295
|
+
ue(e.currentTarget.files), e.currentTarget.value = "";
|
|
296
|
+
}
|
|
297
|
+
}),
|
|
298
|
+
Q ? /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ g("div", {
|
|
299
|
+
className: "x-image-field-preview",
|
|
300
|
+
style: { aspectRatio: t.ratio },
|
|
301
|
+
"data-busy": X ? "true" : void 0,
|
|
302
|
+
children: [/* @__PURE__ */ h("img", {
|
|
303
|
+
src: Q,
|
|
304
|
+
alt: ""
|
|
305
|
+
}), X ? /* @__PURE__ */ h(f, {
|
|
306
|
+
size: "md",
|
|
307
|
+
label: F.uploading,
|
|
308
|
+
className: "x-image-field-spinner"
|
|
309
|
+
}) : null]
|
|
310
|
+
}), /* @__PURE__ */ g("div", {
|
|
311
|
+
className: "x-image-field-actions",
|
|
312
|
+
children: [
|
|
313
|
+
/* @__PURE__ */ h(u, {
|
|
314
|
+
variant: "secondary",
|
|
315
|
+
icon: "edit",
|
|
316
|
+
disabled: Z,
|
|
317
|
+
onClick: pe,
|
|
318
|
+
children: F.recrop
|
|
319
|
+
}),
|
|
320
|
+
/* @__PURE__ */ h(u, {
|
|
321
|
+
variant: "secondary",
|
|
322
|
+
icon: "upload",
|
|
323
|
+
disabled: Z,
|
|
324
|
+
onClick: () => G.current?.click(),
|
|
325
|
+
children: F.replace
|
|
326
|
+
}),
|
|
327
|
+
P,
|
|
328
|
+
/* @__PURE__ */ h(u, {
|
|
329
|
+
variant: "secondary",
|
|
330
|
+
icon: "trash",
|
|
331
|
+
disabled: Z,
|
|
332
|
+
onClick: me,
|
|
333
|
+
children: F.remove
|
|
334
|
+
})
|
|
335
|
+
]
|
|
336
|
+
})] }) : /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ g("label", {
|
|
337
|
+
className: "x-image-field-zone",
|
|
338
|
+
htmlFor: I,
|
|
339
|
+
style: { aspectRatio: t.ratio },
|
|
340
|
+
children: [
|
|
341
|
+
/* @__PURE__ */ h(s, {
|
|
342
|
+
name: "image",
|
|
343
|
+
size: 20
|
|
344
|
+
}),
|
|
345
|
+
/* @__PURE__ */ g("span", { children: [
|
|
346
|
+
F.drop,
|
|
347
|
+
" ",
|
|
348
|
+
/* @__PURE__ */ h("span", {
|
|
349
|
+
className: "x-image-field-browse",
|
|
350
|
+
children: F.browse
|
|
351
|
+
})
|
|
352
|
+
] }),
|
|
353
|
+
_e ? /* @__PURE__ */ h("small", { children: _e }) : null
|
|
354
|
+
]
|
|
355
|
+
}), P ? /* @__PURE__ */ h("div", {
|
|
356
|
+
className: "x-image-field-actions",
|
|
357
|
+
children: P
|
|
358
|
+
}) : null] }),
|
|
359
|
+
$ ? /* @__PURE__ */ h("p", {
|
|
360
|
+
className: "x-image-field-error",
|
|
361
|
+
id: R,
|
|
362
|
+
role: "alert",
|
|
363
|
+
children: $
|
|
364
|
+
}) : null,
|
|
365
|
+
B ? /* @__PURE__ */ h(w, {
|
|
366
|
+
src: B.url,
|
|
367
|
+
aspect: t.ratio,
|
|
368
|
+
labels: F.cropper,
|
|
369
|
+
onCancel: de,
|
|
370
|
+
onConfirm: (e, t) => void fe(e, t)
|
|
371
|
+
}, B.url) : null
|
|
372
|
+
]
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
export { T as IMAGE_ACCEPT, E as IMAGE_MAX_SIZE, w as ImageCropper, N as ImageField, S as MAX_ZOOM, x as MIN_ZOOM, O as afterUpload, o as cropToBlob, A as describeAccept, n as fitWidth, i as loadImage, j as outputName, D as recropSource, t as renameExtension, e as resizeToBlob, r as rotatedSize, a as sameAspect, k as urlTracker };
|
|
376
|
+
|
|
377
|
+
//# sourceMappingURL=image.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image.js","names":["DEFAULT_LABELS","_Fragment","resizeToBlob","renameExtension","rotatedSize","loadImage","sameAspect","cropToBlob","Icon","cx","checkFiles","Button","formatBytes","Spinner","useModal","Cropper","MIN_ZOOM","MAX_ZOOM","DEFAULT_LABELS$1","ImageCropper","l","labels","id","useId","titleId","descId","crop","setCrop","useState","zoom","setZoom","rotation","setRotation","area","setArea","root","useRef","panel","stage","cancel","busy","onCancel","trap","modal","title","src","pixels","r","onConfirm","IMAGE_ACCEPT","IMAGE_MAX_SIZE","recropSource","value","kept","afterUpload","next","result","source","revoke","urlTracker","b","u","urls","url","create","blob","release","describeAccept","accept","outputName","sub","type","name","DEFAULT_LABELS","formats","max","reason","ImageField","inputId","labelId","noteId","over","setOver","setSource","problem","setProblem","uploadPreview","setUploadPreview","input","mounted","busyCallback","onBusyChange","useEffect","tracked","uploading","locked","disabled","maxLabel","maxSize","setBusy","take","file","files","firstRejected","rejected","confirm","current","preview","image","aspect","encode","onUpload","onChange","recrop","remove","onDragOver","onDrop","note","error","hintText","className","label","required","hint","Fragment","actions","a","fitWidth"],"sources":["../src/image/ImageCropper/ImageCropper.tsx","../src/image/ImageField/ImageField.tsx"],"sourcesContent":["import { useId, useRef, useState, type JSX, type KeyboardEvent, type ReactNode } from \"react\";\nimport Cropper from \"react-easy-crop\";\nimport { Button } from \"../../components/Button/Button\";\nimport { useModal } from \"../../internal/modal\";\nimport type { CropArea } from \"../crop\";\n\nexport const MIN_ZOOM = 1;\nexport const MAX_ZOOM = 3;\n\nexport interface ImageCropperLabels {\n /** Dialog title; the `title` prop wins. */\n title: string;\n /** One line under the title on how to move and zoom. */\n description: string;\n /** Names the crop frame for screen readers (it takes focus and moves with the arrow keys). */\n area: string;\n zoom: string;\n rotate: string;\n reset: string;\n cancel: string;\n confirm: string;\n}\n\nconst DEFAULT_LABELS: ImageCropperLabels = {\n title: \"Crop image\",\n description: \"Drag the image or use the arrow keys to move it. Scroll or use Zoom to zoom in.\",\n area: \"Crop frame\",\n zoom: \"Zoom\",\n rotate: \"Rotate 90°\",\n reset: \"Reset\",\n cancel: \"Cancel\",\n confirm: \"Use this image\",\n};\n\nexport interface ImageCropperProps {\n /** The image to crop: an object URL or a same-origin (or CORS-enabled) URL. */\n src: string;\n /** Width / height of the crop frame, e.g. 16 / 9. */\n aspect: number;\n /** Cancel and Esc (a click on the backdrop does not close it, so a drag that ends outside keeps the crop). Not called while `busy`. */\n onCancel: () => void;\n /** The chosen area in pixels of the rotated image, and the rotation in degrees (0, 90, 180, 270). */\n onConfirm: (area: CropArea, rotation: number) => void;\n /** Overrides `labels.title`. */\n title?: ReactNode;\n /** The caller is processing the crop: both buttons are disabled and every close request is ignored. */\n busy?: boolean;\n /** false renders the markup only (previews). Default true. */\n modal?: boolean;\n labels?: Partial<ImageCropperLabels>;\n}\n\n/**\n * Modal crop dialog with a fixed frame ratio. Mount it only while open, with a `key` per image, so zoom, rotation\n * and position start fresh.\n */\nexport function ImageCropper({ src, aspect, onCancel, onConfirm, title, busy, modal = true, labels }: ImageCropperProps): JSX.Element {\n const l = { ...DEFAULT_LABELS, ...labels };\n const id = useId();\n const titleId = `x-cropper-${id}`;\n const descId = `x-cropper-d-${id}`;\n const [crop, setCrop] = useState({ x: 0, y: 0 });\n const [zoom, setZoom] = useState(MIN_ZOOM);\n const [rotation, setRotation] = useState(0);\n const [area, setArea] = useState<CropArea | null>(null);\n const root = useRef<HTMLDivElement | null>(null);\n const panel = useRef<HTMLDivElement | null>(null);\n const stage = useRef<HTMLDivElement | null>(null);\n const cancel = (): void => {\n if (!busy) onCancel();\n };\n const trap = useModal(modal, root, panel, cancel);\n // Nested in another modal (an ImageField in a FormDialog): keep the outer trap from handling the same key.\n const onKeyDown = trap\n ? (e: KeyboardEvent<HTMLDivElement>): void => {\n trap(e);\n if (e.key === \"Tab\" || e.key === \"Escape\") e.stopPropagation();\n }\n : undefined;\n // The crop frame exists only once the image has loaded; then it takes focus so the arrow keys pan.\n const focusFrame = (): void => {\n if (!modal) return;\n requestAnimationFrame(() => stage.current?.querySelector<HTMLElement>(\".reactEasyCrop_CropArea\")?.focus());\n };\n const reset = (): void => {\n setCrop({ x: 0, y: 0 });\n setZoom(MIN_ZOOM);\n setRotation(0);\n };\n const confirm = (): void => {\n if (area && !busy) onConfirm(area, rotation);\n };\n return (\n <div className=\"dialog-backdrop\" ref={root} data-modal={modal ? \"true\" : undefined} onKeyDown={onKeyDown}>\n <div\n ref={panel}\n className=\"dialog x-image-cropper\"\n role=\"dialog\"\n aria-modal={modal ? \"true\" : undefined}\n aria-labelledby={titleId}\n aria-describedby={descId}\n aria-busy={busy ? \"true\" : undefined}\n tabIndex={modal ? -1 : undefined}\n >\n <h2 className=\"dialog-title\" id={titleId}>\n {title ?? l.title}\n </h2>\n <p className=\"x-image-cropper-desc\" id={descId}>\n {l.description}\n </p>\n <div className=\"x-image-cropper-stage\" ref={stage}>\n <Cropper\n image={src}\n crop={crop}\n zoom={zoom}\n rotation={rotation}\n aspect={aspect}\n minZoom={MIN_ZOOM}\n maxZoom={MAX_ZOOM}\n keyboardStep={10}\n cropperProps={{ \"aria-label\": l.area }}\n onCropChange={setCrop}\n onZoomChange={setZoom}\n onRotationChange={setRotation}\n onCropComplete={(_, pixels) => setArea(pixels)}\n onMediaLoaded={focusFrame}\n />\n </div>\n <div className=\"x-image-cropper-tools\">\n <label className=\"x-image-cropper-zoom\">\n <span>{l.zoom}</span>\n <input\n type=\"range\"\n min={MIN_ZOOM}\n max={MAX_ZOOM}\n step={0.05}\n value={zoom}\n disabled={busy}\n onChange={(e) => setZoom(Number(e.currentTarget.value))}\n />\n <output aria-hidden=\"true\">{zoom.toFixed(1)}×</output>\n </label>\n <Button variant=\"secondary\" icon=\"refresh\" disabled={busy} onClick={() => setRotation((r) => (r + 90) % 360)}>\n {l.rotate}\n </Button>\n <Button variant=\"secondary\" icon=\"undo\" disabled={busy} onClick={reset}>\n {l.reset}\n </Button>\n </div>\n <div className=\"dialog-actions\">\n <Button variant=\"secondary\" onClick={cancel} disabled={busy}>\n {l.cancel}\n </Button>\n <Button variant=\"primary\" onClick={confirm} disabled={!area || busy}>\n {busy ? (\n <span className=\"x-spinner\" data-size=\"sm\" aria-hidden=\"true\">\n <span className=\"x-spinner-ring\" />\n </span>\n ) : null}\n {l.confirm}\n </Button>\n </div>\n </div>\n </div>\n );\n}\n","import { useEffect, useId, useRef, useState, type ChangeEvent, type DragEvent, type JSX, type ReactNode } from \"react\";\nimport { cx } from \"../../internal/cx\";\nimport { Button } from \"../../components/Button/Button\";\nimport { Icon } from \"../../components/Icon/Icon\";\nimport { Spinner } from \"../../components/Spinner/Spinner\";\nimport { checkFiles, formatBytes, type FileRejectReason } from \"../../components/FileDrop/FileDrop\";\nimport { cropToBlob, loadImage, renameExtension, type CropArea, type EncodeOptions, type ImageAspect } from \"../crop\";\nimport { ImageCropper, type ImageCropperLabels } from \"../ImageCropper/ImageCropper\";\n\nexport const IMAGE_ACCEPT = \"image/jpeg,image/png,image/webp\";\nexport const IMAGE_MAX_SIZE = 10 * 1024 * 1024;\n\n/** The image the user picked, kept so \"Crop again\" starts from it, tied to the value its upload produced. */\nexport type KeptOriginal = { url: string; value: string };\n\n/** The image \"Crop again\" opens: the kept original when the field still shows what it produced, else the value. */\nexport function recropSource(kept: KeptOriginal | null, value: string | null | undefined): string | null {\n if (!value) return null;\n return kept && kept.value === value ? kept.url : value;\n}\n\n/**\n * After a successful upload: which original to keep and which object URLs to revoke. `result` is what `onUpload`\n * resolved to; only a string ties the original to the new value.\n */\nexport function afterUpload(\n kept: KeptOriginal | null,\n source: { url: string; fresh: boolean },\n result: unknown,\n): { kept: KeptOriginal | null; revoke: string[] } {\n const next = typeof result === \"string\" && result ? { url: source.url, value: result } : null;\n const revoke: string[] = [];\n if (kept && kept.url !== next?.url) revoke.push(kept.url);\n if (source.fresh && !next && !revoke.includes(source.url)) revoke.push(source.url);\n return { kept: next, revoke };\n}\n\n/** Object URLs the field created; `revoke` touches only those, `revokeAll` runs on unmount. */\nexport function urlTracker(\n create: (blob: Blob) => string = (b) => URL.createObjectURL(b),\n release: (url: string) => void = (u) => URL.revokeObjectURL(u),\n): { create: (blob: Blob) => string; revoke: (url: string | null | undefined) => void; revokeAll: () => void } {\n const urls = new Set<string>();\n return {\n create(blob) {\n const url = create(blob);\n urls.add(url);\n return url;\n },\n revoke(url) {\n if (url && urls.delete(url)) release(url);\n },\n revokeAll() {\n for (const url of urls) release(url);\n urls.clear();\n },\n };\n}\n\n/** \"JPEG, PNG, WEBP\" from \"image/jpeg,image/png,.webp\". */\nexport function describeAccept(accept: string): string {\n return accept\n .split(\",\")\n .map((r) => r.trim().replace(/^image\\//, \"\").replace(/^\\./, \"\").toUpperCase())\n .filter(Boolean)\n .join(\", \");\n}\n\n/** File name for the upload: the picked name with the extension of the encoded type. */\nexport function outputName(name: string, type = \"image/webp\"): string {\n const sub = type.split(\"/\")[1] ?? \"webp\";\n return renameExtension(name, sub === \"jpeg\" ? \"jpg\" : sub);\n}\n\nexport interface ImageFieldLabels {\n /** The empty zone's main line. */\n drop: string;\n /** The link-styled part of it. */\n browse: string;\n /** Hint in the empty zone, from the formats and the size limit. */\n limits: (formats: string, maxSize: string | undefined) => string;\n rejected: (name: string, reason: FileRejectReason, maxSize: string | undefined) => string;\n /** Shown when `onUpload` rejects with something that is not an `Error` with a message. */\n failed: string;\n uploading: string;\n recrop: string;\n replace: string;\n remove: string;\n /** Passed to the crop dialog. */\n cropper: Partial<ImageCropperLabels>;\n}\n\nconst DEFAULT_LABELS: ImageFieldLabels = {\n drop: \"Drop an image here or\",\n browse: \"browse\",\n limits: (formats, max) => [formats, max ? `up to ${max}` : \"\"].filter(Boolean).join(\", \"),\n rejected: (name, reason, max) =>\n reason === \"type\" ? `${name}: this file type is not accepted` : reason === \"size\" ? `${name} is larger than ${max ?? \"the limit\"}` : `${name}: drop one image`,\n failed: \"The image could not be uploaded\",\n uploading: \"Uploading image\",\n recrop: \"Crop again\",\n replace: \"Replace\",\n remove: \"Remove\",\n cropper: {},\n};\n\nexport interface ImageFieldProps {\n label: ReactNode;\n /** Crop ratio and the exported size in pixels. */\n aspect: ImageAspect;\n /** URL of the current image (shown as the preview), or null. */\n value: string | null | undefined;\n /** Called with the URL `onUpload` resolved to, and with null on Remove. */\n onChange: (value: string | null) => void;\n /**\n * Uploads the cropped image. Resolve to the new URL to have it passed to `onChange` (and \"Crop again\" start from the\n * picked original); resolve to nothing to update `value` yourself. Reject to show the error under the field.\n */\n onUpload: (blob: Blob, name: string) => Promise<string | void>;\n /** True from the crop until the upload settles; lock the form's submit while true. */\n onBusyChange?: (busy: boolean) => void;\n accept?: string;\n /** Bytes. Default 10 MB. */\n maxSize?: number;\n /** Output type and quality; WebP 0.85 by default. */\n encode?: EncodeOptions;\n required?: boolean;\n disabled?: boolean;\n hint?: ReactNode;\n /** A validation message from the form; the field's own errors (wrong file, failed upload) take its place. */\n error?: ReactNode;\n /** Extra buttons next to the field's own (\"Choose from library\"). */\n actions?: ReactNode;\n labels?: Partial<ImageFieldLabels>;\n className?: string;\n}\n\ntype Source = { url: string; name: string; fresh: boolean };\n\n/**\n * One image with a fixed ratio: pick or drop a file, crop it in `ImageCropper`, upload the result through `onUpload`\n * and show it. It stores nothing itself.\n */\nexport function ImageField({\n label,\n aspect,\n value,\n onChange,\n onUpload,\n onBusyChange,\n accept = IMAGE_ACCEPT,\n maxSize = IMAGE_MAX_SIZE,\n encode,\n required,\n disabled,\n hint,\n error,\n actions,\n labels,\n className,\n}: ImageFieldProps): JSX.Element {\n const l = { ...DEFAULT_LABELS, ...labels };\n const id = useId();\n const inputId = `x-image-field-${id}`;\n const labelId = `${inputId}-label`;\n const noteId = `${inputId}-note`;\n const [over, setOver] = useState(false);\n const [source, setSource] = useState<Source | null>(null);\n const [problem, setProblem] = useState<string | null>(null);\n const [uploadPreview, setUploadPreview] = useState<string | null>(null);\n const input = useRef<HTMLInputElement | null>(null);\n const urls = useRef<ReturnType<typeof urlTracker> | null>(null);\n urls.current ??= urlTracker();\n const kept = useRef<KeptOriginal | null>(null);\n const mounted = useRef(true);\n const busy = useRef(false);\n const busyCallback = useRef(onBusyChange);\n useEffect(() => {\n busyCallback.current = onBusyChange;\n });\n useEffect(() => {\n mounted.current = true;\n const tracked = urls.current;\n return () => {\n mounted.current = false;\n tracked?.revokeAll();\n // Unmounted mid-upload: release the caller's lock, the upload no longer reports it.\n if (busy.current) busyCallback.current?.(false);\n };\n }, []);\n\n const uploading = uploadPreview !== null;\n const locked = disabled || uploading;\n const maxLabel = formatBytes(maxSize);\n const setBusy = (next: boolean): void => {\n busy.current = next;\n busyCallback.current?.(next);\n };\n\n const take = (files: FileList | readonly File[] | null | undefined): void => {\n const file = files?.[0];\n if (!file || locked) return;\n const { rejected } = checkFiles([file], { accept, maxSize });\n const [firstRejected] = rejected;\n if (firstRejected) {\n setProblem(l.rejected(file.name, firstRejected.reason, maxLabel));\n return;\n }\n setProblem(null);\n setSource({ url: urls.current!.create(file), name: file.name, fresh: true });\n };\n\n const cancel = (): void => {\n if (source?.fresh) urls.current!.revoke(source.url);\n setSource(null);\n };\n\n const confirm = async (area: CropArea, rotation: number): Promise<void> => {\n const current = source;\n if (!current) return;\n setSource(null);\n setProblem(null);\n setBusy(true);\n let preview: string | null = null;\n try {\n const image = await loadImage(current.url);\n const blob = await cropToBlob(image, area, rotation, aspect, encode);\n if (!mounted.current) return;\n preview = urls.current!.create(blob);\n setUploadPreview(preview);\n const result = await onUpload(blob, outputName(current.name, encode?.type));\n if (!mounted.current) return;\n const next = afterUpload(kept.current, current, result);\n kept.current = next.kept;\n next.revoke.forEach((u) => urls.current!.revoke(u));\n if (typeof result === \"string\" && result) onChange(result);\n } catch (e) {\n if (current.fresh) urls.current!.revoke(current.url);\n if (mounted.current) setProblem(e instanceof Error && e.message ? e.message : l.failed);\n } finally {\n urls.current!.revoke(preview);\n if (mounted.current) {\n setUploadPreview(null);\n setBusy(false);\n }\n }\n };\n\n const recrop = (): void => {\n const url = recropSource(kept.current, value);\n if (url) setSource({ url, name: \"image\", fresh: false });\n };\n\n const remove = (): void => {\n setProblem(null);\n urls.current!.revoke(kept.current?.url);\n kept.current = null;\n onChange(null);\n };\n\n const onDragOver = (e: DragEvent<HTMLDivElement>): void => {\n e.preventDefault();\n if (!locked) setOver(true);\n };\n const onDrop = (e: DragEvent<HTMLDivElement>): void => {\n e.preventDefault();\n setOver(false);\n take(e.dataTransfer.files);\n };\n\n const preview = uploadPreview ?? value ?? null;\n const note = problem ?? error;\n const hintText = l.limits(describeAccept(accept), maxLabel);\n return (\n <div\n className={cx(\"x-image-field\", className)}\n data-over={over ? \"true\" : undefined}\n data-disabled={disabled ? \"true\" : undefined}\n data-invalid={note ? \"true\" : undefined}\n onDragOver={onDragOver}\n onDragLeave={() => setOver(false)}\n onDrop={onDrop}\n >\n <span className=\"x-image-field-label\" id={labelId}>\n {label}\n {required ? (\n <span className=\"x-image-field-required\" aria-hidden=\"true\">\n *\n </span>\n ) : null}\n </span>\n {hint ? <small className=\"x-image-field-hint\">{hint}</small> : null}\n <input\n ref={input}\n id={inputId}\n className=\"x-sr-only\"\n type=\"file\"\n accept={accept}\n disabled={locked}\n aria-required={required ? true : undefined}\n aria-labelledby={labelId}\n aria-describedby={note ? noteId : undefined}\n aria-invalid={note ? true : undefined}\n tabIndex={preview ? -1 : undefined}\n onChange={(e: ChangeEvent<HTMLInputElement>) => {\n take(e.currentTarget.files);\n e.currentTarget.value = \"\";\n }}\n />\n {preview ? (\n <>\n <div className=\"x-image-field-preview\" style={{ aspectRatio: aspect.ratio }} data-busy={uploading ? \"true\" : undefined}>\n <img src={preview} alt=\"\" />\n {uploading ? <Spinner size=\"md\" label={l.uploading} className=\"x-image-field-spinner\" /> : null}\n </div>\n <div className=\"x-image-field-actions\">\n <Button variant=\"secondary\" icon=\"edit\" disabled={locked} onClick={recrop}>\n {l.recrop}\n </Button>\n <Button variant=\"secondary\" icon=\"upload\" disabled={locked} onClick={() => input.current?.click()}>\n {l.replace}\n </Button>\n {actions}\n <Button variant=\"secondary\" icon=\"trash\" disabled={locked} onClick={remove}>\n {l.remove}\n </Button>\n </div>\n </>\n ) : (\n <>\n <label className=\"x-image-field-zone\" htmlFor={inputId} style={{ aspectRatio: aspect.ratio }}>\n <Icon name=\"image\" size={20} />\n <span>\n {l.drop} <span className=\"x-image-field-browse\">{l.browse}</span>\n </span>\n {hintText ? <small>{hintText}</small> : null}\n </label>\n {actions ? <div className=\"x-image-field-actions\">{actions}</div> : null}\n </>\n )}\n {note ? (\n <p className=\"x-image-field-error\" id={noteId} role=\"alert\">\n {note}\n </p>\n ) : null}\n {source ? (\n <ImageCropper key={source.url} src={source.url} aspect={aspect.ratio} labels={l.cropper} onCancel={cancel} onConfirm={(a, r) => void confirm(a, r)} />\n ) : null}\n </div>\n );\n}\n"],"mappings":";;;;;;;;AAMA,IAAagB,IAAW,GACXC,IAAW,GAgBlBjB,IAAqC;CACzC,OAAO;CACP,aAAa;CACb,MAAM;CACN,MAAM;CACN,QAAQ;CACR,OAAO;CACP,QAAQ;CACR,SAAS;AACX;AAwBA,SAAgBmB,EAAa,EAAE,QAAK,WAAQ,aAAU,cAAW,UAAO,SAAM,WAAQ,IAAM,aAA0C;CACpI,IAAMC,IAAI;EAAE,GAAGpB;EAAgB,GAAGqB;CAAO,GACnCC,IAAKC,GAAM,GACXC,IAAU,aAAaF,KACvBG,I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