@devalok/shilp-sutra 0.34.1 → 0.36.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/dist/_chunks/badge-group.js +95 -95
- package/dist/_chunks/badge-group.js.map +1 -0
- package/dist/_chunks/chat.js +7 -2
- package/dist/_chunks/chat.js.map +1 -0
- package/dist/_chunks/date-picker.js.map +1 -0
- package/dist/_chunks/document-preview.js.map +1 -0
- package/dist/_chunks/file-preview.js.map +1 -0
- package/dist/_chunks/framer.js +62 -62
- package/dist/_chunks/framer.js.map +1 -0
- package/dist/_chunks/image-preview.js +1 -1
- package/dist/_chunks/image-preview.js.map +1 -0
- package/dist/_chunks/keybinding.js.map +1 -0
- package/dist/_chunks/link-context.js.map +1 -0
- package/dist/_chunks/mention-suggestion.js.map +1 -0
- package/dist/_chunks/motion-provider.js.map +1 -0
- package/dist/_chunks/popover.js +32 -36
- package/dist/_chunks/popover.js.map +1 -0
- package/dist/_chunks/primitives.js +686 -686
- package/dist/_chunks/primitives.js.map +1 -0
- package/dist/_chunks/rich-chat-input.js +650 -649
- package/dist/_chunks/rich-chat-input.js.map +1 -0
- package/dist/_chunks/shared.js.map +1 -0
- package/dist/_chunks/sonner.js.map +1 -0
- package/dist/_chunks/stat-row.js +158 -158
- package/dist/_chunks/stat-row.js.map +1 -0
- package/dist/_chunks/tiptap.js +11 -11
- package/dist/_chunks/tiptap.js.map +1 -0
- package/dist/_chunks/tree-view.js +1 -1
- package/dist/_chunks/tree-view.js.map +1 -0
- package/dist/_chunks/use-calendar.js.map +1 -0
- package/dist/_chunks/vendor-client.js +1 -1
- package/dist/_chunks/vendor-client.js.map +1 -0
- package/dist/_chunks/vendor-utils.js.map +1 -0
- package/dist/ai/ai-command-provider.js.map +1 -0
- package/dist/ai/block-renderer.js.map +1 -0
- package/dist/ai/blocks/loading.d.ts.map +1 -1
- package/dist/ai/command-bar.js.map +1 -0
- package/dist/ai/conversation.js +76 -76
- package/dist/ai/conversation.js.map +1 -0
- package/dist/ai/devadoot-icon.d.ts.map +1 -1
- package/dist/ai/index.js.map +1 -0
- package/dist/composed/activity-feed.js.map +1 -0
- package/dist/composed/avatar-group.js +1 -1
- package/dist/composed/avatar-group.js.map +1 -0
- package/dist/composed/bulk-action-bar.js +13 -21
- package/dist/composed/bulk-action-bar.js.map +1 -0
- package/dist/composed/command-palette.js.map +1 -0
- package/dist/composed/confirm-dialog.js.map +1 -0
- package/dist/composed/content-card.js.map +1 -0
- package/dist/composed/deadline-indicator.js.map +1 -0
- package/dist/composed/emoji-picker.js.map +1 -0
- package/dist/composed/empty-state.d.ts.map +1 -1
- package/dist/composed/empty-state.js +30 -30
- package/dist/composed/empty-state.js.map +1 -0
- package/dist/composed/error-boundary.js.map +1 -0
- package/dist/composed/filter-bar.js.map +1 -0
- package/dist/composed/form-section.js.map +1 -0
- package/dist/composed/global-loading.js.map +1 -0
- package/dist/composed/inline-edit.js.map +1 -0
- package/dist/composed/lib/string-utils.js.map +1 -0
- package/dist/composed/loading-skeleton.js.map +1 -0
- package/dist/composed/markdown-viewer.js.map +1 -0
- package/dist/composed/master-detail.js.map +1 -0
- package/dist/composed/member-picker.js.map +1 -0
- package/dist/composed/multi-select-popover.d.ts.map +1 -1
- package/dist/composed/multi-select-popover.js +4 -0
- package/dist/composed/multi-select-popover.js.map +1 -0
- package/dist/composed/page-header.js.map +1 -0
- package/dist/composed/page-skeletons.js.map +1 -0
- package/dist/composed/priority-indicator.js.map +1 -0
- package/dist/composed/responsive-overlay.js.map +1 -0
- package/dist/composed/rich-chat-input/attachment-strip.d.ts.map +1 -1
- package/dist/composed/rich-chat-input/reply-banner.d.ts.map +1 -1
- package/dist/composed/rich-chat-input/schedule-send.d.ts.map +1 -1
- package/dist/composed/rich-chat-input.d.ts.map +1 -1
- package/dist/composed/rich-text-editor.js.map +1 -0
- package/dist/composed/schedule-view.js.map +1 -0
- package/dist/composed/simple-tooltip.js.map +1 -0
- package/dist/composed/status-badge.d.ts.map +1 -1
- package/dist/composed/status-badge.js.map +1 -0
- package/dist/hooks/use-color-mode.js.map +1 -0
- package/dist/hooks/use-mobile.js.map +1 -0
- package/dist/hooks/use-touch-device.js.map +1 -0
- package/dist/hooks/use-viewport-height.js.map +1 -0
- package/dist/motion/check-motion-provider.d.ts +3 -0
- package/dist/motion/check-motion-provider.d.ts.map +1 -0
- package/dist/motion/index.js +14 -0
- package/dist/motion/index.js.map +1 -0
- package/dist/motion/primitives-index.js.map +1 -0
- package/dist/primitives/react-accordion.d.ts +114 -114
- package/dist/primitives/react-alert-dialog.d.ts +51 -51
- package/dist/primitives/react-aspect-ratio.d.ts +11 -11
- package/dist/primitives/react-avatar.d.ts +24 -24
- package/dist/primitives/react-checkbox.d.ts +50 -50
- package/dist/primitives/react-collapsible.d.ts +33 -33
- package/dist/primitives/react-context-menu.d.ts +96 -96
- package/dist/primitives/react-dialog.d.ts +103 -103
- package/dist/primitives/react-dropdown-menu.d.ts +97 -97
- package/dist/primitives/react-hover-card.d.ts +79 -79
- package/dist/primitives/react-label.d.ts +10 -10
- package/dist/primitives/react-menu.d.ts +169 -169
- package/dist/primitives/react-menubar.d.ts +115 -115
- package/dist/primitives/react-navigation-menu.d.ts +126 -126
- package/dist/primitives/react-popover.d.ts +85 -85
- package/dist/primitives/react-progress.d.ts +19 -19
- package/dist/primitives/react-radio-group.d.ts +58 -58
- package/dist/primitives/react-roving-focus.d.ts +49 -49
- package/dist/primitives/react-select.d.ts +137 -137
- package/dist/primitives/react-separator.d.ts +21 -21
- package/dist/primitives/react-slider.d.ts +75 -75
- package/dist/primitives/react-switch.d.ts +21 -21
- package/dist/primitives/react-tabs.d.ts +56 -56
- package/dist/primitives/react-toast.d.ts +120 -120
- package/dist/primitives/react-toggle-group.d.ts +75 -75
- package/dist/primitives/react-toggle.d.ts +24 -24
- package/dist/primitives/react-tooltip.d.ts +101 -101
- package/dist/primitives/react-visually-hidden.d.ts +22 -22
- package/dist/shell/app-command-palette.d.ts +2 -0
- package/dist/shell/app-command-palette.d.ts.map +1 -1
- package/dist/shell/app-command-palette.js +42 -155
- package/dist/shell/app-command-palette.js.map +1 -0
- package/dist/shell/bottom-navbar.js +1 -1
- package/dist/shell/bottom-navbar.js.map +1 -0
- package/dist/shell/command-registry.js.map +1 -0
- package/dist/shell/notification-center.d.ts.map +1 -1
- package/dist/shell/notification-center.js +194 -169
- package/dist/shell/notification-center.js.map +1 -0
- package/dist/shell/notification-preferences.js.map +1 -0
- package/dist/shell/sidebar.js.map +1 -0
- package/dist/shell/top-bar.js +1 -1
- package/dist/shell/top-bar.js.map +1 -0
- package/dist/tailwind/index.cjs +48 -1
- package/dist/tailwind/preset.d.ts.map +1 -1
- package/dist/tailwind/preset.js +48 -1
- package/dist/tailwind/preset.js.map +1 -0
- package/dist/tokens/index.css +4 -4
- package/dist/tokens/primitives.css +442 -442
- package/dist/tokens/semantic.css +742 -547
- package/dist/tokens/typography-semantic.css +123 -100
- package/dist/tokens/typography.css +422 -422
- package/dist/ui/accordion.js +13 -13
- package/dist/ui/accordion.js.map +1 -0
- package/dist/ui/alert-dialog.d.ts +6 -2
- package/dist/ui/alert-dialog.d.ts.map +1 -1
- package/dist/ui/alert-dialog.js +43 -42
- package/dist/ui/alert-dialog.js.map +1 -0
- package/dist/ui/alert.d.ts +3 -2
- package/dist/ui/alert.d.ts.map +1 -1
- package/dist/ui/alert.js +31 -5
- package/dist/ui/alert.js.map +1 -0
- package/dist/ui/aspect-ratio.js +1 -1
- package/dist/ui/aspect-ratio.js.map +1 -0
- package/dist/ui/autocomplete.d.ts.map +1 -1
- package/dist/ui/autocomplete.js +92 -67
- package/dist/ui/autocomplete.js.map +1 -0
- package/dist/ui/avatar.js +9 -9
- package/dist/ui/avatar.js.map +1 -0
- package/dist/ui/badge-indicator.js.map +1 -0
- package/dist/ui/banner.js.map +1 -0
- package/dist/ui/breadcrumb.js +1 -1
- package/dist/ui/breadcrumb.js.map +1 -0
- package/dist/ui/button-group.js.map +1 -0
- package/dist/ui/button-processing.d.ts.map +1 -1
- package/dist/ui/button-processing.js +61 -40
- package/dist/ui/button-processing.js.map +1 -0
- package/dist/ui/button.js +8 -8
- package/dist/ui/button.js.map +1 -0
- package/dist/ui/card.js.map +1 -0
- package/dist/ui/charts/bar-chart.d.ts.map +1 -1
- package/dist/ui/charts/chart-container.d.ts +2 -0
- package/dist/ui/charts/chart-container.d.ts.map +1 -1
- package/dist/ui/charts/index.js +88 -65
- package/dist/ui/charts/index.js.map +1 -0
- package/dist/ui/charts/line-chart.d.ts.map +1 -1
- package/dist/ui/chat/message-input.d.ts.map +1 -1
- package/dist/ui/chat/message-list.d.ts +1 -1
- package/dist/ui/chat/message-list.d.ts.map +1 -1
- package/dist/ui/chat/message.d.ts.map +1 -1
- package/dist/ui/chat/system-message.d.ts.map +1 -1
- package/dist/ui/checkbox.d.ts.map +1 -1
- package/dist/ui/checkbox.js +33 -28
- package/dist/ui/checkbox.js.map +1 -0
- package/dist/ui/code.js.map +1 -0
- package/dist/ui/collapsible.js +1 -1
- package/dist/ui/collapsible.js.map +1 -0
- package/dist/ui/color-input.d.ts.map +1 -1
- package/dist/ui/color-input.js +165 -163
- package/dist/ui/color-input.js.map +1 -0
- package/dist/ui/color-swatch.js.map +1 -0
- package/dist/ui/combobox.d.ts +7 -0
- package/dist/ui/combobox.d.ts.map +1 -1
- package/dist/ui/combobox.js +147 -113
- package/dist/ui/combobox.js.map +1 -0
- package/dist/ui/container.js +1 -1
- package/dist/ui/container.js.map +1 -0
- package/dist/ui/context-menu.js.map +1 -0
- package/dist/ui/data-table-body.js.map +1 -0
- package/dist/ui/data-table-bulk-actions.js +1 -1
- package/dist/ui/data-table-bulk-actions.js.map +1 -0
- package/dist/ui/data-table-card.js.map +1 -0
- package/dist/ui/data-table-context.js.map +1 -0
- package/dist/ui/data-table-header.js.map +1 -0
- package/dist/ui/data-table-pagination.js.map +1 -0
- package/dist/ui/data-table-toolbar.js.map +1 -0
- package/dist/ui/data-table.js +34 -31
- package/dist/ui/data-table.js.map +1 -0
- package/dist/ui/devalok-grain.js.map +1 -0
- package/dist/ui/dialog.js +31 -35
- package/dist/ui/dialog.js.map +1 -0
- package/dist/ui/dropdown-menu.js.map +1 -0
- package/dist/ui/file-upload.js +120 -120
- package/dist/ui/file-upload.js.map +1 -0
- package/dist/ui/form.d.ts +8 -0
- package/dist/ui/form.d.ts.map +1 -1
- package/dist/ui/form.js +14 -12
- package/dist/ui/form.js.map +1 -0
- package/dist/ui/hover-card.js.map +1 -0
- package/dist/ui/icon-button.js.map +1 -0
- package/dist/ui/icon-context.js.map +1 -0
- package/dist/ui/icon-group.js.map +1 -0
- package/dist/ui/icon.js.map +1 -0
- package/dist/ui/index.d.ts +4 -4
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui/index.js +82 -66
- package/dist/ui/index.js.map +1 -0
- package/dist/ui/input-otp.d.ts +12 -3
- package/dist/ui/input-otp.d.ts.map +1 -1
- package/dist/ui/input-otp.js +41 -27
- package/dist/ui/input-otp.js.map +1 -0
- package/dist/ui/input.d.ts.map +1 -1
- package/dist/ui/input.js +16 -15
- package/dist/ui/input.js.map +1 -0
- package/dist/ui/label.d.ts.map +1 -1
- package/dist/ui/label.js +19 -14
- package/dist/ui/label.js.map +1 -0
- package/dist/ui/lib/check-tokens.d.ts +3 -0
- package/dist/ui/lib/check-tokens.d.ts.map +1 -0
- package/dist/ui/lib/date-utils.js.map +1 -0
- package/dist/ui/lib/motion.d.ts +15 -4
- package/dist/ui/lib/motion.d.ts.map +1 -1
- package/dist/ui/lib/motion.js +18 -9
- package/dist/ui/lib/motion.js.map +1 -0
- package/dist/ui/lib/utils.js.map +1 -0
- package/dist/ui/link.js +2 -2
- package/dist/ui/link.js.map +1 -0
- package/dist/ui/menubar.js.map +1 -0
- package/dist/ui/navigation-menu.js.map +1 -0
- package/dist/ui/number-input.d.ts +16 -1
- package/dist/ui/number-input.d.ts.map +1 -1
- package/dist/ui/number-input.js +79 -49
- package/dist/ui/number-input.js.map +1 -0
- package/dist/ui/pagination.js +1 -1
- package/dist/ui/pagination.js.map +1 -0
- package/dist/ui/progress-ring.d.ts.map +1 -1
- package/dist/ui/progress-ring.js.map +1 -0
- package/dist/ui/progress.js.map +1 -0
- package/dist/ui/radio.d.ts.map +1 -1
- package/dist/ui/radio.js +27 -20
- package/dist/ui/radio.js.map +1 -0
- package/dist/ui/search-input.js.map +1 -0
- package/dist/ui/segmented-control.d.ts +1 -1
- package/dist/ui/segmented-control.d.ts.map +1 -1
- package/dist/ui/segmented-control.js +2 -0
- package/dist/ui/segmented-control.js.map +1 -0
- package/dist/ui/select.d.ts.map +1 -1
- package/dist/ui/select.js +54 -48
- package/dist/ui/select.js.map +1 -0
- package/dist/ui/separator.d.ts.map +1 -1
- package/dist/ui/separator.js +10 -7
- package/dist/ui/separator.js.map +1 -0
- package/dist/ui/sheet.js +29 -29
- package/dist/ui/sheet.js.map +1 -0
- package/dist/ui/sidebar.js +7 -7
- package/dist/ui/sidebar.js.map +1 -0
- package/dist/ui/skeleton.js.map +1 -0
- package/dist/ui/slider.d.ts +22 -3
- package/dist/ui/slider.d.ts.map +1 -1
- package/dist/ui/slider.js +57 -19
- package/dist/ui/slider.js.map +1 -0
- package/dist/ui/spinner.js.map +1 -0
- package/dist/ui/split-button.d.ts.map +1 -1
- package/dist/ui/split-button.js +77 -76
- package/dist/ui/split-button.js.map +1 -0
- package/dist/ui/stack.js.map +1 -0
- package/dist/ui/stat-card.js.map +1 -0
- package/dist/ui/status-dot.js.map +1 -0
- package/dist/ui/stepper.d.ts +10 -0
- package/dist/ui/stepper.d.ts.map +1 -1
- package/dist/ui/stepper.js +80 -75
- package/dist/ui/stepper.js.map +1 -0
- package/dist/ui/switch.d.ts.map +1 -1
- package/dist/ui/switch.js +26 -22
- package/dist/ui/switch.js.map +1 -0
- package/dist/ui/table.js.map +1 -0
- package/dist/ui/tabs.d.ts +3 -1
- package/dist/ui/tabs.d.ts.map +1 -1
- package/dist/ui/tabs.js +68 -48
- package/dist/ui/tabs.js.map +1 -0
- package/dist/ui/text.d.ts +1 -1
- package/dist/ui/text.d.ts.map +1 -1
- package/dist/ui/text.js +10 -2
- package/dist/ui/text.js.map +1 -0
- package/dist/ui/textarea.js +1 -1
- package/dist/ui/textarea.js.map +1 -0
- package/dist/ui/toast-registry.d.ts +8 -0
- package/dist/ui/toast-registry.d.ts.map +1 -0
- package/dist/ui/toast-registry.js +13 -0
- package/dist/ui/toast-registry.js.map +1 -0
- package/dist/ui/toast.d.ts.map +1 -1
- package/dist/ui/toast.js +141 -136
- package/dist/ui/toast.js.map +1 -0
- package/dist/ui/toaster.d.ts.map +1 -1
- package/dist/ui/toaster.js +15 -14
- package/dist/ui/toaster.js.map +1 -0
- package/dist/ui/toggle-group.d.ts +2 -0
- package/dist/ui/toggle-group.d.ts.map +1 -1
- package/dist/ui/toggle-group.js +23 -16
- package/dist/ui/toggle-group.js.map +1 -0
- package/dist/ui/toggle.d.ts +2 -0
- package/dist/ui/toggle.d.ts.map +1 -1
- package/dist/ui/toggle.js +14 -6
- package/dist/ui/toggle.js.map +1 -0
- package/dist/ui/tooltip.js.map +1 -0
- package/dist/ui/visually-hidden.js.map +1 -0
- package/docs/components/_header.md +85 -85
- package/docs/components/composed/activity-feed.md +62 -62
- package/docs/components/composed/avatar-group.md +65 -65
- package/docs/components/composed/bulk-action-bar.md +40 -40
- package/docs/components/composed/command-palette.md +40 -40
- package/docs/components/composed/confirm-dialog.md +46 -46
- package/docs/components/composed/content-card.md +36 -36
- package/docs/components/composed/date-picker.md +130 -130
- package/docs/components/composed/deadline-indicator.md +27 -27
- package/docs/components/composed/emoji-picker.md +52 -52
- package/docs/components/composed/empty-state.md +53 -53
- package/docs/components/composed/error-boundary.md +29 -29
- package/docs/components/composed/file-preview.md +40 -40
- package/docs/components/composed/filter-bar.md +57 -57
- package/docs/components/composed/form-section.md +31 -31
- package/docs/components/composed/global-loading.md +27 -27
- package/docs/components/composed/inline-edit.md +35 -35
- package/docs/components/composed/loading-skeleton.md +51 -51
- package/docs/components/composed/markdown-viewer.md +27 -27
- package/docs/components/composed/master-detail.md +48 -48
- package/docs/components/composed/member-picker.md +35 -35
- package/docs/components/composed/multi-select-popover.md +62 -62
- package/docs/components/composed/page-header.md +41 -41
- package/docs/components/composed/page-skeletons.md +32 -32
- package/docs/components/composed/priority-indicator.md +32 -32
- package/docs/components/composed/responsive-overlay.md +34 -34
- package/docs/components/composed/rich-text-editor.md +82 -82
- package/docs/components/composed/schedule-view.md +39 -39
- package/docs/components/composed/simple-tooltip.md +33 -33
- package/docs/components/composed/status-badge.md +55 -55
- package/docs/components/shell/app-command-palette.md +44 -44
- package/docs/components/shell/bottom-navbar.md +52 -52
- package/docs/components/shell/command-registry.md +48 -48
- package/docs/components/shell/link-context.md +41 -41
- package/docs/components/shell/notification-center.md +63 -63
- package/docs/components/shell/notification-preferences.md +42 -42
- package/docs/components/shell/sidebar.md +92 -92
- package/docs/components/shell/top-bar.md +143 -143
- package/docs/components/ui/accordion.md +51 -51
- package/docs/components/ui/alert-dialog.md +61 -61
- package/docs/components/ui/alert.md +46 -46
- package/docs/components/ui/aspect-ratio.md +25 -25
- package/docs/components/ui/autocomplete.md +48 -48
- package/docs/components/ui/avatar.md +56 -56
- package/docs/components/ui/badge.md +83 -82
- package/docs/components/ui/banner.md +42 -42
- package/docs/components/ui/breadcrumb.md +37 -37
- package/docs/components/ui/button-group.md +41 -41
- package/docs/components/ui/button.md +94 -93
- package/docs/components/ui/card.md +52 -52
- package/docs/components/ui/charts.md +43 -43
- package/docs/components/ui/checkbox.md +36 -36
- package/docs/components/ui/chip.md +47 -47
- package/docs/components/ui/code.md +28 -28
- package/docs/components/ui/collapsible.md +40 -40
- package/docs/components/ui/color-input.md +91 -91
- package/docs/components/ui/color-swatch.md +25 -25
- package/docs/components/ui/combobox.md +54 -54
- package/docs/components/ui/container.md +26 -26
- package/docs/components/ui/context-menu.md +43 -43
- package/docs/components/ui/data-table-body.md +1 -1
- package/docs/components/ui/data-table-bulk-actions.md +1 -1
- package/docs/components/ui/data-table-card.md +1 -1
- package/docs/components/ui/data-table-context.md +1 -1
- package/docs/components/ui/data-table-header.md +1 -1
- package/docs/components/ui/data-table-pagination.md +1 -1
- package/docs/components/ui/data-table-toolbar.md +44 -44
- package/docs/components/ui/data-table.md +94 -94
- package/docs/components/ui/dialog.md +54 -54
- package/docs/components/ui/dropdown-menu.md +48 -48
- package/docs/components/ui/file-upload.md +41 -41
- package/docs/components/ui/form.md +51 -51
- package/docs/components/ui/hover-card.md +32 -32
- package/docs/components/ui/icon-button.md +40 -40
- package/docs/components/ui/input-otp.md +44 -44
- package/docs/components/ui/input.md +74 -74
- package/docs/components/ui/label.md +25 -25
- package/docs/components/ui/link.md +29 -29
- package/docs/components/ui/menubar.md +44 -44
- package/docs/components/ui/navigation-menu.md +46 -46
- package/docs/components/ui/number-input.md +44 -44
- package/docs/components/ui/pagination.md +48 -48
- package/docs/components/ui/popover.md +30 -30
- package/docs/components/ui/progress-ring.md +41 -41
- package/docs/components/ui/progress.md +34 -34
- package/docs/components/ui/radio.md +34 -34
- package/docs/components/ui/search-input.md +43 -43
- package/docs/components/ui/segmented-control.md +50 -50
- package/docs/components/ui/select.md +53 -53
- package/docs/components/ui/separator.md +32 -32
- package/docs/components/ui/sheet.md +47 -47
- package/docs/components/ui/sidebar.md +72 -72
- package/docs/components/ui/skeleton.md +77 -77
- package/docs/components/ui/slider.md +29 -29
- package/docs/components/ui/spinner.md +54 -54
- package/docs/components/ui/stack.md +39 -39
- package/docs/components/ui/stat-card.md +61 -61
- package/docs/components/ui/status-dot.md +26 -26
- package/docs/components/ui/stepper.md +49 -49
- package/docs/components/ui/switch.md +47 -47
- package/docs/components/ui/table.md +47 -47
- package/docs/components/ui/tabs.md +60 -60
- package/docs/components/ui/text.md +37 -37
- package/docs/components/ui/textarea.md +39 -39
- package/docs/components/ui/toast.md +65 -65
- package/docs/components/ui/toaster.md +47 -47
- package/docs/components/ui/toggle-group.md +43 -43
- package/docs/components/ui/toggle.md +37 -37
- package/docs/components/ui/tooltip.md +38 -38
- package/docs/components/ui/tree-view.md +65 -65
- package/docs/components/ui/visually-hidden.md +21 -21
- package/llms-full.txt +5266 -5264
- package/llms.txt +624 -580
- package/package.json +7 -8
package/dist/ui/color-input.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { a as e, c as t } from "../_chunks/framer.js";
|
|
3
|
-
import {
|
|
4
|
-
import { cn as
|
|
5
|
-
import { t as
|
|
6
|
-
import { i as
|
|
7
|
-
import * as
|
|
8
|
-
import { jsx as
|
|
3
|
+
import { durations as n, springs as r } from "./lib/motion.js";
|
|
4
|
+
import { cn as i } from "./lib/utils.js";
|
|
5
|
+
import { t as a } from "../_chunks/vendor-client.js";
|
|
6
|
+
import { i as o, r as s, t as c } from "../_chunks/popover.js";
|
|
7
|
+
import * as l from "react";
|
|
8
|
+
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
9
9
|
//#region src/ui/color-input.tsx
|
|
10
|
-
function
|
|
10
|
+
function f(e) {
|
|
11
11
|
let t = /^#?([0-9a-f]{6})$/i.exec(e);
|
|
12
12
|
if (!t) return null;
|
|
13
13
|
let n = parseInt(t[1], 16);
|
|
@@ -17,15 +17,15 @@ function d(e) {
|
|
|
17
17
|
b: n & 255
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
|
-
function
|
|
20
|
+
function p(e, t, n) {
|
|
21
21
|
return "#" + [
|
|
22
22
|
e,
|
|
23
23
|
t,
|
|
24
24
|
n
|
|
25
25
|
].map((e) => Math.max(0, Math.min(255, Math.round(e))).toString(16).padStart(2, "0")).join("");
|
|
26
26
|
}
|
|
27
|
-
function
|
|
28
|
-
let t =
|
|
27
|
+
function m(e) {
|
|
28
|
+
let t = f(e);
|
|
29
29
|
if (!t) return null;
|
|
30
30
|
let n = t.r / 255, r = t.g / 255, i = t.b / 255, a = Math.max(n, r, i), o = Math.min(n, r, i), s = (a + o) / 2;
|
|
31
31
|
if (a === o) return {
|
|
@@ -40,14 +40,14 @@ function p(e) {
|
|
|
40
40
|
l: Math.round(s * 100)
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
|
-
function
|
|
43
|
+
function h(e, t, n) {
|
|
44
44
|
let r = t / 100, i = n / 100, a = r * Math.min(i, 1 - i), o = (t) => {
|
|
45
45
|
let n = (t + e / 30) % 12, r = i - a * Math.max(Math.min(n - 3, 9 - n, 1), -1);
|
|
46
46
|
return Math.round(255 * r);
|
|
47
47
|
};
|
|
48
|
-
return
|
|
48
|
+
return p(o(0), o(8), o(4));
|
|
49
49
|
}
|
|
50
|
-
var
|
|
50
|
+
var g = [
|
|
51
51
|
{
|
|
52
52
|
hex: "#EF4444",
|
|
53
53
|
label: "Red"
|
|
@@ -89,8 +89,8 @@ var h = [
|
|
|
89
89
|
label: "Indigo"
|
|
90
90
|
}
|
|
91
91
|
];
|
|
92
|
-
function
|
|
93
|
-
let t =
|
|
92
|
+
function _(e) {
|
|
93
|
+
let t = f(e);
|
|
94
94
|
if (!t) return !1;
|
|
95
95
|
let [n, r, i] = [
|
|
96
96
|
t.r,
|
|
@@ -102,165 +102,167 @@ function g(e) {
|
|
|
102
102
|
});
|
|
103
103
|
return .2126 * n + .7152 * r + .0722 * i > .4;
|
|
104
104
|
}
|
|
105
|
-
function
|
|
106
|
-
return /* @__PURE__ */
|
|
107
|
-
className:
|
|
108
|
-
children: [/* @__PURE__ */
|
|
109
|
-
htmlFor:
|
|
105
|
+
function v({ label: e, value: t, onChange: n, onBlur: r, disabled: a, maxLength: o = 3, prefix: s, className: c, id: l }) {
|
|
106
|
+
return /* @__PURE__ */ d("div", {
|
|
107
|
+
className: i("flex flex-col gap-ds-01", c),
|
|
108
|
+
children: [/* @__PURE__ */ u("label", {
|
|
109
|
+
htmlFor: l,
|
|
110
110
|
className: "text-ds-xs font-medium uppercase tracking-wider text-surface-fg-muted",
|
|
111
111
|
children: e
|
|
112
|
-
}), /* @__PURE__ */
|
|
112
|
+
}), /* @__PURE__ */ d("div", {
|
|
113
113
|
className: "flex items-center",
|
|
114
|
-
children: [s && /* @__PURE__ */
|
|
114
|
+
children: [s && /* @__PURE__ */ u("span", {
|
|
115
115
|
className: "text-ds-sm text-surface-fg-muted",
|
|
116
116
|
children: s
|
|
117
|
-
}), /* @__PURE__ */
|
|
118
|
-
id:
|
|
117
|
+
}), /* @__PURE__ */ u("input", {
|
|
118
|
+
id: l,
|
|
119
119
|
type: "text",
|
|
120
120
|
value: t,
|
|
121
121
|
disabled: a,
|
|
122
122
|
onChange: (e) => n(e.target.value),
|
|
123
|
-
onBlur:
|
|
123
|
+
onBlur: r,
|
|
124
124
|
maxLength: o,
|
|
125
|
-
className:
|
|
125
|
+
className: i("h-ds-xs-plus w-full rounded-ds-sm border border-surface-border bg-surface-overlay px-ds-02 font-mono text-ds-sm text-surface-fg transition-colors", "focus:border-accent-7 focus:outline-hidden focus:ring-1 focus:ring-accent-9", a && "cursor-not-allowed opacity-50")
|
|
126
126
|
})]
|
|
127
127
|
})]
|
|
128
128
|
});
|
|
129
129
|
}
|
|
130
|
-
var
|
|
131
|
-
let [
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
}, [
|
|
135
|
-
let [
|
|
136
|
-
|
|
137
|
-
}, H = (e) => {
|
|
138
|
-
if (x) return;
|
|
139
|
-
let t = (e.startsWith("#") ? e : `#${e}`).toLowerCase();
|
|
140
|
-
z((e) => e[e.length - 1] === P ? e : [...e.slice(-19), P]), F(t), y?.(t);
|
|
130
|
+
var y = l.forwardRef(({ value: y = "#000000", onChange: b, presets: x, disabled: S = !1, showPicker: C = !0, defaultFormat: w = "hex", align: T = "start", variant: E = "default", className: D, ...O }, k) => {
|
|
131
|
+
let [A, j] = l.useState(w), [M, N] = l.useState(!1), P = l.useId(), [F, I] = l.useState(y);
|
|
132
|
+
l.useEffect(() => {
|
|
133
|
+
I(y);
|
|
134
|
+
}, [y]);
|
|
135
|
+
let [L, R] = l.useState(y), [z, B] = l.useState([]), V = l.useRef(!1), H = (e) => {
|
|
136
|
+
S || (e && (R(F), B([])), N(e));
|
|
141
137
|
}, U = (e) => {
|
|
142
|
-
if (
|
|
138
|
+
if (S) return;
|
|
143
139
|
let t = (e.startsWith("#") ? e : `#${e}`).toLowerCase();
|
|
144
|
-
B
|
|
145
|
-
}, W = () => {
|
|
146
|
-
|
|
140
|
+
B((e) => e[e.length - 1] === F ? e : [...e.slice(-19), F]), I(t), b?.(t);
|
|
141
|
+
}, W = (e) => {
|
|
142
|
+
if (S) return;
|
|
143
|
+
let t = (e.startsWith("#") ? e : `#${e}`).toLowerCase();
|
|
144
|
+
V.current || (V.current = !0, B((e) => e[e.length - 1] === F ? e : [...e.slice(-19), F])), I(t), b?.(t);
|
|
147
145
|
}, G = () => {
|
|
148
|
-
|
|
149
|
-
let e = R[R.length - 1];
|
|
150
|
-
z((e) => e.slice(0, -1)), F(e), y?.(e);
|
|
146
|
+
V.current = !1;
|
|
151
147
|
}, K = () => {
|
|
152
|
-
|
|
153
|
-
|
|
148
|
+
if (z.length === 0) return;
|
|
149
|
+
let e = z[z.length - 1];
|
|
150
|
+
B((e) => e.slice(0, -1)), I(e), b?.(e);
|
|
151
|
+
}, q = () => {
|
|
152
|
+
I(L), b?.(L), B([]);
|
|
153
|
+
}, J = x === !1 ? [] : x ? x.map((e) => typeof e == "string" ? {
|
|
154
154
|
hex: e,
|
|
155
155
|
label: e
|
|
156
|
-
} : e) :
|
|
157
|
-
if (!
|
|
156
|
+
} : e) : g, Y = f(F), X = m(F), Z = (e, t) => {
|
|
157
|
+
if (!Y) return;
|
|
158
158
|
let n = parseInt(t, 10);
|
|
159
159
|
if (isNaN(n)) return;
|
|
160
160
|
let r = Math.max(0, Math.min(255, n));
|
|
161
|
-
|
|
162
|
-
},
|
|
163
|
-
if (!
|
|
161
|
+
U(p(e === "r" ? r : Y.r, e === "g" ? r : Y.g, e === "b" ? r : Y.b));
|
|
162
|
+
}, Q = (e, t) => {
|
|
163
|
+
if (!X) return;
|
|
164
164
|
let n = parseInt(t, 10);
|
|
165
165
|
if (isNaN(n)) return;
|
|
166
166
|
let r = Math.max(0, Math.min(e === "h" ? 360 : 100, n));
|
|
167
|
-
|
|
168
|
-
},
|
|
167
|
+
U(h(e === "h" ? r : X.h, e === "s" ? r : X.s, e === "l" ? r : X.l));
|
|
168
|
+
}, $ = [
|
|
169
169
|
"hex",
|
|
170
170
|
"rgb",
|
|
171
171
|
"hsl"
|
|
172
172
|
];
|
|
173
|
-
return /* @__PURE__ */
|
|
174
|
-
ref:
|
|
175
|
-
className:
|
|
176
|
-
...
|
|
177
|
-
children: /* @__PURE__ */
|
|
178
|
-
open:
|
|
179
|
-
onOpenChange:
|
|
180
|
-
children: [/* @__PURE__ */
|
|
173
|
+
return /* @__PURE__ */ u("div", {
|
|
174
|
+
ref: k,
|
|
175
|
+
className: i("inline-flex flex-col", D),
|
|
176
|
+
...O,
|
|
177
|
+
children: /* @__PURE__ */ d(c, {
|
|
178
|
+
open: M,
|
|
179
|
+
onOpenChange: H,
|
|
180
|
+
children: [/* @__PURE__ */ u(o, {
|
|
181
181
|
asChild: !0,
|
|
182
|
-
children:
|
|
182
|
+
children: E === "inline" ? /* @__PURE__ */ u(e.button, {
|
|
183
183
|
type: "button",
|
|
184
|
-
disabled:
|
|
185
|
-
className:
|
|
184
|
+
disabled: S,
|
|
185
|
+
className: i("group flex items-center justify-center rounded-ds-md px-ds-04 py-ds-02 font-mono text-ds-sm font-medium", "focus:outline-hidden focus:ring-2 focus:ring-accent-9 focus:ring-offset-2 focus:ring-offset-surface-base", S && "cursor-not-allowed opacity-50"),
|
|
186
186
|
animate: {
|
|
187
|
-
backgroundColor:
|
|
188
|
-
color:
|
|
187
|
+
backgroundColor: F,
|
|
188
|
+
color: _(F) ? "rgba(0,0,0,0.8)" : "rgba(255,255,255,0.95)"
|
|
189
189
|
},
|
|
190
190
|
whileHover: {
|
|
191
191
|
y: -1,
|
|
192
192
|
boxShadow: "0 4px 12px rgba(0,0,0,0.12)"
|
|
193
193
|
},
|
|
194
194
|
whileTap: { scale: .97 },
|
|
195
|
-
transition:
|
|
196
|
-
"aria-label": `Color picker: ${
|
|
197
|
-
children:
|
|
198
|
-
}) : /* @__PURE__ */
|
|
195
|
+
transition: r.smooth,
|
|
196
|
+
"aria-label": `Color picker: ${F}`,
|
|
197
|
+
children: F.toUpperCase()
|
|
198
|
+
}) : /* @__PURE__ */ d(e.button, {
|
|
199
199
|
type: "button",
|
|
200
|
-
disabled:
|
|
201
|
-
className:
|
|
200
|
+
disabled: S,
|
|
201
|
+
className: i("group relative flex items-center overflow-hidden rounded-ds-md border border-surface-border-strong", "hover:border-accent-7 focus:border-accent-7 focus:outline-hidden focus:ring-1 focus:ring-accent-9", S && "cursor-not-allowed opacity-50"),
|
|
202
202
|
whileHover: { scale: 1.02 },
|
|
203
203
|
whileTap: { scale: .98 },
|
|
204
|
-
transition:
|
|
205
|
-
"aria-label": `Color picker: ${
|
|
204
|
+
transition: r.snappy,
|
|
205
|
+
"aria-label": `Color picker: ${F}`,
|
|
206
206
|
children: [
|
|
207
|
-
/* @__PURE__ */
|
|
207
|
+
/* @__PURE__ */ u(e.span, {
|
|
208
208
|
className: "absolute inset-0",
|
|
209
|
-
animate: { background: `linear-gradient(to right, ${
|
|
209
|
+
animate: { background: `linear-gradient(to right, ${F} 0%, ${F} 35%, transparent 70%)` },
|
|
210
210
|
transition: { duration: .3 }
|
|
211
211
|
}),
|
|
212
|
-
/* @__PURE__ */
|
|
212
|
+
/* @__PURE__ */ u("span", {
|
|
213
213
|
className: "absolute inset-0 bg-surface-overlay/60",
|
|
214
214
|
style: {
|
|
215
215
|
maskImage: "linear-gradient(to right, transparent 0%, black 40%)",
|
|
216
216
|
WebkitMaskImage: "linear-gradient(to right, transparent 0%, black 40%)"
|
|
217
217
|
}
|
|
218
218
|
}),
|
|
219
|
-
/* @__PURE__ */
|
|
219
|
+
/* @__PURE__ */ u("span", {
|
|
220
220
|
className: "relative z-10 py-ds-02 pl-6 pr-ds-03 font-mono text-ds-sm text-surface-fg",
|
|
221
|
-
children:
|
|
221
|
+
children: F.toUpperCase()
|
|
222
222
|
})
|
|
223
223
|
]
|
|
224
224
|
})
|
|
225
|
-
}), /* @__PURE__ */
|
|
226
|
-
|
|
225
|
+
}), /* @__PURE__ */ u(s, {
|
|
226
|
+
role: "dialog",
|
|
227
|
+
"aria-label": "Color picker",
|
|
228
|
+
align: T,
|
|
227
229
|
sideOffset: 8,
|
|
228
230
|
className: "w-[272px] rounded-ds-xl border border-surface-border-strong bg-surface-overlay p-0 shadow-floating",
|
|
229
|
-
children: /* @__PURE__ */
|
|
231
|
+
children: /* @__PURE__ */ d("div", {
|
|
230
232
|
className: "flex flex-col",
|
|
231
233
|
children: [
|
|
232
|
-
|
|
234
|
+
C && /* @__PURE__ */ u("div", {
|
|
233
235
|
className: "p-ds-04 pb-ds-03",
|
|
234
|
-
onPointerUp:
|
|
235
|
-
onPointerLeave:
|
|
236
|
-
children: /* @__PURE__ */
|
|
237
|
-
color:
|
|
238
|
-
onChange:
|
|
236
|
+
onPointerUp: G,
|
|
237
|
+
onPointerLeave: G,
|
|
238
|
+
children: /* @__PURE__ */ u(a, {
|
|
239
|
+
color: F,
|
|
240
|
+
onChange: W,
|
|
239
241
|
className: "w-full!",
|
|
240
242
|
style: { height: 160 }
|
|
241
243
|
})
|
|
242
244
|
}),
|
|
243
|
-
/* @__PURE__ */
|
|
245
|
+
/* @__PURE__ */ d("div", {
|
|
244
246
|
className: "border-t border-surface-border px-ds-04 py-ds-03",
|
|
245
|
-
children: [/* @__PURE__ */
|
|
247
|
+
children: [/* @__PURE__ */ u("div", {
|
|
246
248
|
className: "mb-ds-03 flex items-center gap-ds-01",
|
|
247
|
-
children:
|
|
249
|
+
children: $.map((t) => /* @__PURE__ */ d("button", {
|
|
248
250
|
type: "button",
|
|
249
|
-
onClick: () =>
|
|
250
|
-
className:
|
|
251
|
-
children: [
|
|
252
|
-
layoutId: `color-input-format-pill-${
|
|
251
|
+
onClick: () => j(t),
|
|
252
|
+
className: i("relative min-h-6 rounded-ds-sm px-ds-02 py-px text-ds-xs font-semibold uppercase tracking-wider transition-colors", A === t ? "text-accent-11" : "text-surface-fg-muted hover:text-surface-fg"),
|
|
253
|
+
children: [A === t && /* @__PURE__ */ u(e.span, {
|
|
254
|
+
layoutId: `color-input-format-pill-${P}`,
|
|
253
255
|
className: "absolute inset-0 rounded-ds-sm bg-accent-3",
|
|
254
|
-
transition:
|
|
255
|
-
}), /* @__PURE__ */
|
|
256
|
+
transition: r.snappy
|
|
257
|
+
}), /* @__PURE__ */ u("span", {
|
|
256
258
|
className: "relative z-10",
|
|
257
259
|
children: t
|
|
258
260
|
})]
|
|
259
261
|
}, t))
|
|
260
|
-
}), /* @__PURE__ */
|
|
262
|
+
}), /* @__PURE__ */ d(t, {
|
|
261
263
|
mode: "wait",
|
|
262
264
|
children: [
|
|
263
|
-
|
|
265
|
+
A === "hex" && /* @__PURE__ */ u(e.div, {
|
|
264
266
|
initial: {
|
|
265
267
|
opacity: 0,
|
|
266
268
|
y: 4
|
|
@@ -273,26 +275,26 @@ var v = c.forwardRef(({ value: v = "#000000", onChange: y, presets: b, disabled:
|
|
|
273
275
|
opacity: 0,
|
|
274
276
|
y: -4
|
|
275
277
|
},
|
|
276
|
-
transition: { duration: .
|
|
278
|
+
transition: { duration: n.moderate01 },
|
|
277
279
|
className: "flex gap-ds-02",
|
|
278
|
-
children: /* @__PURE__ */
|
|
279
|
-
id: `${
|
|
280
|
+
children: /* @__PURE__ */ u(v, {
|
|
281
|
+
id: `${P}-hex`,
|
|
280
282
|
label: "Hex",
|
|
281
|
-
value:
|
|
283
|
+
value: F.replace("#", "").toUpperCase(),
|
|
282
284
|
onChange: (e) => {
|
|
283
285
|
let t = e.replace(/[^0-9a-fA-F]/g, "").slice(0, 6);
|
|
284
|
-
t.length === 6 &&
|
|
286
|
+
t.length === 6 && U(`#${t}`);
|
|
285
287
|
},
|
|
286
288
|
onBlur: () => {
|
|
287
|
-
|
|
289
|
+
F.replace("#", "").toUpperCase().length !== 6 && I(F);
|
|
288
290
|
},
|
|
289
|
-
disabled:
|
|
291
|
+
disabled: S,
|
|
290
292
|
maxLength: 6,
|
|
291
293
|
prefix: "#",
|
|
292
294
|
className: "flex-1"
|
|
293
295
|
})
|
|
294
296
|
}, "hex"),
|
|
295
|
-
|
|
297
|
+
A === "rgb" && Y && /* @__PURE__ */ d(e.div, {
|
|
296
298
|
initial: {
|
|
297
299
|
opacity: 0,
|
|
298
300
|
y: 4
|
|
@@ -305,36 +307,36 @@ var v = c.forwardRef(({ value: v = "#000000", onChange: y, presets: b, disabled:
|
|
|
305
307
|
opacity: 0,
|
|
306
308
|
y: -4
|
|
307
309
|
},
|
|
308
|
-
transition: { duration: .
|
|
310
|
+
transition: { duration: n.moderate01 },
|
|
309
311
|
className: "flex gap-ds-02",
|
|
310
312
|
children: [
|
|
311
|
-
/* @__PURE__ */
|
|
312
|
-
id: `${
|
|
313
|
+
/* @__PURE__ */ u(v, {
|
|
314
|
+
id: `${P}-r`,
|
|
313
315
|
label: "R",
|
|
314
|
-
value: String(
|
|
315
|
-
onChange: (e) =>
|
|
316
|
-
disabled:
|
|
316
|
+
value: String(Y.r),
|
|
317
|
+
onChange: (e) => Z("r", e),
|
|
318
|
+
disabled: S,
|
|
317
319
|
className: "flex-1"
|
|
318
320
|
}),
|
|
319
|
-
/* @__PURE__ */
|
|
320
|
-
id: `${
|
|
321
|
+
/* @__PURE__ */ u(v, {
|
|
322
|
+
id: `${P}-g`,
|
|
321
323
|
label: "G",
|
|
322
|
-
value: String(
|
|
323
|
-
onChange: (e) =>
|
|
324
|
-
disabled:
|
|
324
|
+
value: String(Y.g),
|
|
325
|
+
onChange: (e) => Z("g", e),
|
|
326
|
+
disabled: S,
|
|
325
327
|
className: "flex-1"
|
|
326
328
|
}),
|
|
327
|
-
/* @__PURE__ */
|
|
328
|
-
id: `${
|
|
329
|
+
/* @__PURE__ */ u(v, {
|
|
330
|
+
id: `${P}-b`,
|
|
329
331
|
label: "B",
|
|
330
|
-
value: String(
|
|
331
|
-
onChange: (e) =>
|
|
332
|
-
disabled:
|
|
332
|
+
value: String(Y.b),
|
|
333
|
+
onChange: (e) => Z("b", e),
|
|
334
|
+
disabled: S,
|
|
333
335
|
className: "flex-1"
|
|
334
336
|
})
|
|
335
337
|
]
|
|
336
338
|
}, "rgb"),
|
|
337
|
-
|
|
339
|
+
A === "hsl" && X && /* @__PURE__ */ d(e.div, {
|
|
338
340
|
initial: {
|
|
339
341
|
opacity: 0,
|
|
340
342
|
y: 4
|
|
@@ -347,31 +349,31 @@ var v = c.forwardRef(({ value: v = "#000000", onChange: y, presets: b, disabled:
|
|
|
347
349
|
opacity: 0,
|
|
348
350
|
y: -4
|
|
349
351
|
},
|
|
350
|
-
transition: { duration: .
|
|
352
|
+
transition: { duration: n.moderate01 },
|
|
351
353
|
className: "flex gap-ds-02",
|
|
352
354
|
children: [
|
|
353
|
-
/* @__PURE__ */
|
|
354
|
-
id: `${
|
|
355
|
+
/* @__PURE__ */ u(v, {
|
|
356
|
+
id: `${P}-h`,
|
|
355
357
|
label: "H",
|
|
356
|
-
value: String(
|
|
357
|
-
onChange: (e) =>
|
|
358
|
-
disabled:
|
|
358
|
+
value: String(X.h),
|
|
359
|
+
onChange: (e) => Q("h", e),
|
|
360
|
+
disabled: S,
|
|
359
361
|
className: "flex-1"
|
|
360
362
|
}),
|
|
361
|
-
/* @__PURE__ */
|
|
362
|
-
id: `${
|
|
363
|
+
/* @__PURE__ */ u(v, {
|
|
364
|
+
id: `${P}-s`,
|
|
363
365
|
label: "S",
|
|
364
|
-
value: String(
|
|
365
|
-
onChange: (e) =>
|
|
366
|
-
disabled:
|
|
366
|
+
value: String(X.s),
|
|
367
|
+
onChange: (e) => Q("s", e),
|
|
368
|
+
disabled: S,
|
|
367
369
|
className: "flex-1"
|
|
368
370
|
}),
|
|
369
|
-
/* @__PURE__ */
|
|
370
|
-
id: `${
|
|
371
|
+
/* @__PURE__ */ u(v, {
|
|
372
|
+
id: `${P}-l`,
|
|
371
373
|
label: "L",
|
|
372
|
-
value: String(
|
|
373
|
-
onChange: (e) =>
|
|
374
|
-
disabled:
|
|
374
|
+
value: String(X.l),
|
|
375
|
+
onChange: (e) => Q("l", e),
|
|
376
|
+
disabled: S,
|
|
375
377
|
className: "flex-1"
|
|
376
378
|
})
|
|
377
379
|
]
|
|
@@ -379,16 +381,16 @@ var v = c.forwardRef(({ value: v = "#000000", onChange: y, presets: b, disabled:
|
|
|
379
381
|
]
|
|
380
382
|
})]
|
|
381
383
|
}),
|
|
382
|
-
|
|
384
|
+
J.length > 0 && /* @__PURE__ */ u("div", {
|
|
383
385
|
className: "border-t border-surface-border px-ds-04 py-ds-03",
|
|
384
|
-
children: /* @__PURE__ */
|
|
386
|
+
children: /* @__PURE__ */ u("div", {
|
|
385
387
|
className: "flex flex-wrap gap-ds-02",
|
|
386
|
-
children:
|
|
387
|
-
let a =
|
|
388
|
-
return /* @__PURE__ */
|
|
388
|
+
children: J.map((t, n) => {
|
|
389
|
+
let a = F.toLowerCase() === t.hex.toLowerCase();
|
|
390
|
+
return /* @__PURE__ */ u(e.button, {
|
|
389
391
|
type: "button",
|
|
390
|
-
disabled:
|
|
391
|
-
onClick: () =>
|
|
392
|
+
disabled: S,
|
|
393
|
+
onClick: () => U(t.hex),
|
|
392
394
|
initial: {
|
|
393
395
|
opacity: 0,
|
|
394
396
|
scale: .8
|
|
@@ -400,10 +402,10 @@ var v = c.forwardRef(({ value: v = "#000000", onChange: y, presets: b, disabled:
|
|
|
400
402
|
whileHover: { scale: a ? 1.15 : 1.1 },
|
|
401
403
|
whileTap: { scale: .9 },
|
|
402
404
|
transition: {
|
|
403
|
-
...
|
|
404
|
-
delay:
|
|
405
|
+
...r.bouncy,
|
|
406
|
+
delay: n * .02
|
|
405
407
|
},
|
|
406
|
-
className:
|
|
408
|
+
className: i("h-6 w-6 rounded-ds-sm border", a ? "border-accent-7 ring-2 ring-accent-9/30" : "border-surface-border hover:border-surface-border-strong", S && "cursor-not-allowed opacity-50"),
|
|
407
409
|
style: { backgroundColor: t.hex },
|
|
408
410
|
title: t.label,
|
|
409
411
|
"aria-label": `${t.label}: ${t.hex}`
|
|
@@ -411,7 +413,7 @@ var v = c.forwardRef(({ value: v = "#000000", onChange: y, presets: b, disabled:
|
|
|
411
413
|
})
|
|
412
414
|
})
|
|
413
415
|
}),
|
|
414
|
-
(
|
|
416
|
+
(z.length > 0 || F !== L) && /* @__PURE__ */ d(e.div, {
|
|
415
417
|
initial: {
|
|
416
418
|
opacity: 0,
|
|
417
419
|
height: 0
|
|
@@ -426,25 +428,25 @@ var v = c.forwardRef(({ value: v = "#000000", onChange: y, presets: b, disabled:
|
|
|
426
428
|
},
|
|
427
429
|
className: "flex items-center gap-ds-02 border-t border-surface-border px-ds-04 py-ds-02",
|
|
428
430
|
children: [
|
|
429
|
-
/* @__PURE__ */
|
|
431
|
+
/* @__PURE__ */ u("span", {
|
|
430
432
|
className: "h-4 w-4 shrink-0 rounded-full border border-surface-border",
|
|
431
|
-
style: { backgroundColor:
|
|
432
|
-
title: `Original: ${
|
|
433
|
+
style: { backgroundColor: L },
|
|
434
|
+
title: `Original: ${L}`
|
|
433
435
|
}),
|
|
434
|
-
/* @__PURE__ */
|
|
436
|
+
/* @__PURE__ */ u("span", {
|
|
435
437
|
className: "text-ds-xs text-surface-fg-muted",
|
|
436
|
-
children:
|
|
438
|
+
children: L.toUpperCase()
|
|
437
439
|
}),
|
|
438
|
-
/* @__PURE__ */
|
|
439
|
-
|
|
440
|
+
/* @__PURE__ */ u("span", { className: "flex-1" }),
|
|
441
|
+
z.length > 0 && /* @__PURE__ */ u("button", {
|
|
440
442
|
type: "button",
|
|
441
|
-
onClick:
|
|
443
|
+
onClick: K,
|
|
442
444
|
className: "min-h-6 rounded-ds-sm px-ds-02 py-px text-ds-xs font-medium text-surface-fg-muted transition-colors hover:text-surface-fg",
|
|
443
445
|
children: "Undo"
|
|
444
446
|
}),
|
|
445
|
-
|
|
447
|
+
F !== L && /* @__PURE__ */ u("button", {
|
|
446
448
|
type: "button",
|
|
447
|
-
onClick:
|
|
449
|
+
onClick: q,
|
|
448
450
|
className: "min-h-6 rounded-ds-sm px-ds-02 py-px text-ds-xs font-medium text-surface-fg-muted transition-colors hover:text-error-11",
|
|
449
451
|
children: "Reset"
|
|
450
452
|
})
|
|
@@ -456,6 +458,6 @@ var v = c.forwardRef(({ value: v = "#000000", onChange: y, presets: b, disabled:
|
|
|
456
458
|
})
|
|
457
459
|
});
|
|
458
460
|
});
|
|
459
|
-
|
|
461
|
+
y.displayName = "ColorInput";
|
|
460
462
|
//#endregion
|
|
461
|
-
export {
|
|
463
|
+
export { y as ColorInput };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"color-input.js","names":[],"sources":["../../src/ui/color-input.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport { motion, AnimatePresence } from 'framer-motion'\nimport { HexColorPicker } from 'react-colorful'\nimport { cn } from './lib/utils'\nimport { springs, durations } from './lib/motion'\nimport {\n Popover,\n PopoverContent,\n PopoverTrigger,\n} from './popover'\n\n// ── Color conversion helpers ──\n\nfunction hexToRgb(hex: string): { r: number; g: number; b: number } | null {\n const m = /^#?([0-9a-f]{6})$/i.exec(hex)\n if (!m) return null\n const n = parseInt(m[1], 16)\n return { r: (n >> 16) & 255, g: (n >> 8) & 255, b: n & 255 }\n}\n\nfunction rgbToHex(r: number, g: number, b: number): string {\n return '#' + [r, g, b].map((v) => Math.max(0, Math.min(255, Math.round(v))).toString(16).padStart(2, '0')).join('')\n}\n\nfunction hexToHsl(hex: string): { h: number; s: number; l: number } | null {\n const rgb = hexToRgb(hex)\n if (!rgb) return null\n const r = rgb.r / 255, g = rgb.g / 255, b = rgb.b / 255\n const max = Math.max(r, g, b), min = Math.min(r, g, b)\n const l = (max + min) / 2\n if (max === min) return { h: 0, s: 0, l: Math.round(l * 100) }\n const d = max - min\n const s = l > 0.5 ? d / (2 - max - min) : d / (max - min)\n let h = 0\n if (max === r) h = ((g - b) / d + (g < b ? 6 : 0)) / 6\n else if (max === g) h = ((b - r) / d + 2) / 6\n else h = ((r - g) / d + 4) / 6\n return { h: Math.round(h * 360), s: Math.round(s * 100), l: Math.round(l * 100) }\n}\n\nfunction hslToHex(h: number, s: number, l: number): string {\n const sn = s / 100, ln = l / 100\n const a = sn * Math.min(ln, 1 - ln)\n const f = (n: number) => {\n const k = (n + h / 30) % 12\n const c = ln - a * Math.max(Math.min(k - 3, 9 - k, 1), -1)\n return Math.round(255 * c)\n }\n return rgbToHex(f(0), f(8), f(4))\n}\n\n// ── Named color presets (color-blind accessible) ──\n\nconst NAMED_PRESETS: { hex: string; label: string }[] = [\n { hex: '#EF4444', label: 'Red' },\n { hex: '#F59E0B', label: 'Amber' },\n { hex: '#10B981', label: 'Emerald' },\n { hex: '#3B82F6', label: 'Blue' },\n { hex: '#8B5CF6', label: 'Violet' },\n { hex: '#EC4899', label: 'Pink' },\n { hex: '#06B6D4', label: 'Cyan' },\n { hex: '#F97316', label: 'Orange' },\n { hex: '#84CC16', label: 'Lime' },\n { hex: '#6366F1', label: 'Indigo' },\n]\n\n// ── Contrast helper ──\n\nfunction isLightColor(hex: string): boolean {\n const rgb = hexToRgb(hex)\n if (!rgb) return false\n // Relative luminance (sRGB)\n const [r, g, b] = [rgb.r, rgb.g, rgb.b].map((c) => {\n const s = c / 255\n return s <= 0.03928 ? s / 12.92 : Math.pow((s + 0.055) / 1.055, 2.4)\n })\n return 0.2126 * r + 0.7152 * g + 0.0722 * b > 0.4\n}\n\n// ── Format mode type ──\n\ntype ColorFormat = 'hex' | 'rgb' | 'hsl'\n\n// ── Props ──\n\nexport interface ColorInputProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange'> {\n /** Current color value (hex string, e.g. \"#d33163\") */\n value?: string\n /** Called when the color changes */\n onChange?: (value: string) => void\n /** Preset color swatches. Defaults to 10 named colors. Pass `false` to hide. */\n presets?: { hex: string; label: string }[] | string[] | false\n /** Whether the input is disabled */\n disabled?: boolean\n /** Show the interactive color picker. Default: true. */\n showPicker?: boolean\n /** Default format for the input fields. Default: 'hex'. */\n defaultFormat?: ColorFormat\n /** Popover alignment. Default: 'start'. */\n align?: 'start' | 'center' | 'end'\n /**\n * Trigger style variant.\n * - `default`: Swatch bleeds to left edge + hex text\n * - `inline`: Entire trigger is the selected color with hex text overlaid\n */\n variant?: 'default' | 'inline'\n}\n\n// ── Small format input ──\n\nfunction FormatInput({\n label,\n value,\n onChange,\n onBlur,\n disabled,\n maxLength = 3,\n prefix,\n className,\n id,\n}: {\n label: string\n value: string\n onChange: (v: string) => void\n onBlur?: () => void\n disabled?: boolean\n maxLength?: number\n prefix?: string\n className?: string\n id: string\n}) {\n return (\n <div className={cn('flex flex-col gap-ds-01', className)}>\n <label htmlFor={id} className=\"text-ds-xs font-medium uppercase tracking-wider text-surface-fg-muted\">\n {label}\n </label>\n <div className=\"flex items-center\">\n {prefix && (\n <span className=\"text-ds-sm text-surface-fg-muted\">{prefix}</span>\n )}\n <input\n id={id}\n type=\"text\"\n value={value}\n disabled={disabled}\n onChange={(e) => onChange(e.target.value)}\n onBlur={onBlur}\n maxLength={maxLength}\n className={cn(\n 'h-ds-xs-plus w-full rounded-ds-sm border border-surface-border bg-surface-overlay px-ds-02 font-mono text-ds-sm text-surface-fg transition-colors',\n 'focus:border-accent-7 focus:outline-hidden focus:ring-1 focus:ring-accent-9',\n disabled && 'cursor-not-allowed opacity-50',\n )}\n />\n </div>\n </div>\n )\n}\n\n// ── Main component ──\n\nconst ColorInput = React.forwardRef<HTMLDivElement, ColorInputProps>(\n ({\n value = '#000000',\n onChange,\n presets,\n disabled = false,\n showPicker = true,\n defaultFormat = 'hex',\n align = 'start',\n variant = 'default',\n className,\n ...props\n }, ref) => {\n const [format, setFormat] = React.useState<ColorFormat>(defaultFormat)\n const [open, setOpen] = React.useState(false)\n const instanceId = React.useId()\n\n // Internal color state — syncs with prop, allows uncontrolled use\n const [internalColor, setInternalColor] = React.useState(value)\n React.useEffect(() => { setInternalColor(value) }, [value])\n\n // Track color when popover opened (for reset) + undo history\n const [openColor, setOpenColor] = React.useState(value)\n const [undoStack, setUndoStack] = React.useState<string[]>([])\n // Track whether current change is from continuous drag (skip undo push)\n const isDragging = React.useRef(false)\n\n const handleOpenChange = (isOpen: boolean) => {\n if (disabled) return\n if (isOpen) {\n setOpenColor(internalColor)\n setUndoStack([])\n }\n setOpen(isOpen)\n }\n\n // Discrete change (preset click, field commit) — pushes to undo\n const handleDiscreteChange = (newValue: string) => {\n if (disabled) return\n const normalized = newValue.startsWith('#') ? newValue : `#${newValue}`\n const hex = normalized.toLowerCase()\n setUndoStack((prev) => {\n if (prev[prev.length - 1] === internalColor) return prev\n return [...prev.slice(-19), internalColor]\n })\n setInternalColor(hex)\n onChange?.(hex)\n }\n\n // Continuous change (picker drag) — updates color but only pushes undo on drag start\n const handleChange = (newValue: string) => {\n if (disabled) return\n const normalized = newValue.startsWith('#') ? newValue : `#${newValue}`\n const hex = normalized.toLowerCase()\n if (!isDragging.current) {\n // First change in a drag sequence — push current color to undo\n isDragging.current = true\n setUndoStack((prev) => {\n if (prev[prev.length - 1] === internalColor) return prev\n return [...prev.slice(-19), internalColor]\n })\n }\n setInternalColor(hex)\n onChange?.(hex)\n }\n\n // Called when picker drag ends\n const handlePickerChangeComplete = () => {\n isDragging.current = false\n }\n\n const handleUndo = () => {\n if (undoStack.length === 0) return\n const prev = undoStack[undoStack.length - 1]\n setUndoStack((s) => s.slice(0, -1))\n setInternalColor(prev)\n onChange?.(prev)\n }\n\n const handleReset = () => {\n setInternalColor(openColor)\n onChange?.(openColor)\n setUndoStack([])\n }\n\n // Resolve presets\n const resolvedPresets = presets === false\n ? []\n : presets\n ? presets.map((p) =>\n typeof p === 'string' ? { hex: p, label: p } : p\n )\n : NAMED_PRESETS\n\n // Parsed color values — use internal state\n const rgb = hexToRgb(internalColor)\n const hsl = hexToHsl(internalColor)\n\n // RGB field handlers (clamped 0-255)\n const handleRgbChange = (channel: 'r' | 'g' | 'b', v: string) => {\n if (!rgb) return\n const num = parseInt(v, 10)\n if (isNaN(num)) return\n const clamped = Math.max(0, Math.min(255, num))\n handleDiscreteChange(rgbToHex(\n channel === 'r' ? clamped : rgb.r,\n channel === 'g' ? clamped : rgb.g,\n channel === 'b' ? clamped : rgb.b,\n ))\n }\n\n // HSL field handlers (H: 0-360, S/L: 0-100)\n const handleHslChange = (channel: 'h' | 's' | 'l', v: string) => {\n if (!hsl) return\n const num = parseInt(v, 10)\n if (isNaN(num)) return\n const max = channel === 'h' ? 360 : 100\n const clamped = Math.max(0, Math.min(max, num))\n handleDiscreteChange(hslToHex(\n channel === 'h' ? clamped : hsl.h,\n channel === 's' ? clamped : hsl.s,\n channel === 'l' ? clamped : hsl.l,\n ))\n }\n\n const formats: ColorFormat[] = ['hex', 'rgb', 'hsl']\n\n return (\n <div ref={ref} className={cn('inline-flex flex-col', className)} {...props}>\n <Popover open={open} onOpenChange={handleOpenChange}>\n <PopoverTrigger asChild>\n {variant === 'inline' ? (\n <motion.button\n type=\"button\"\n disabled={disabled}\n className={cn(\n 'group flex items-center justify-center rounded-ds-md px-ds-04 py-ds-02 font-mono text-ds-sm font-medium',\n 'focus:outline-hidden focus:ring-2 focus:ring-accent-9 focus:ring-offset-2 focus:ring-offset-surface-base',\n disabled && 'cursor-not-allowed opacity-50',\n )}\n animate={{\n backgroundColor: internalColor,\n color: isLightColor(internalColor) ? 'rgba(0,0,0,0.8)' : 'rgba(255,255,255,0.95)',\n }}\n whileHover={{ y: -1, boxShadow: '0 4px 12px rgba(0,0,0,0.12)' }}\n whileTap={{ scale: 0.97 }}\n transition={springs.smooth}\n aria-label={`Color picker: ${internalColor}`}\n >\n {internalColor.toUpperCase()}\n </motion.button>\n ) : (\n <motion.button\n type=\"button\"\n disabled={disabled}\n className={cn(\n 'group relative flex items-center overflow-hidden rounded-ds-md border border-surface-border-strong',\n 'hover:border-accent-7 focus:border-accent-7 focus:outline-hidden focus:ring-1 focus:ring-accent-9',\n disabled && 'cursor-not-allowed opacity-50',\n )}\n whileHover={{ scale: 1.02 }}\n whileTap={{ scale: 0.98 }}\n transition={springs.snappy}\n aria-label={`Color picker: ${internalColor}`}\n >\n {/* Gradient background: color → surface */}\n <motion.span\n className=\"absolute inset-0\"\n animate={{\n background: `linear-gradient(to right, ${internalColor} 0%, ${internalColor} 35%, transparent 70%)`,\n }}\n /* Between durations.moderate02 (0.24) and durations.slow01 (0.4) — gradient lerp feel */\n transition={{ duration: 0.3 }}\n />\n <span className=\"absolute inset-0 bg-surface-overlay/60\" style={{\n maskImage: 'linear-gradient(to right, transparent 0%, black 40%)',\n WebkitMaskImage: 'linear-gradient(to right, transparent 0%, black 40%)',\n }} />\n {/* Hex value */}\n <span className=\"relative z-10 py-ds-02 pl-6 pr-ds-03 font-mono text-ds-sm text-surface-fg\">\n {internalColor.toUpperCase()}\n </span>\n </motion.button>\n )}\n </PopoverTrigger>\n\n <PopoverContent\n role=\"dialog\"\n aria-label=\"Color picker\"\n align={align}\n sideOffset={8}\n className=\"w-[272px] rounded-ds-xl border border-surface-border-strong bg-surface-overlay p-0 shadow-floating\"\n >\n <div className=\"flex flex-col\">\n {/* Interactive picker */}\n {showPicker && (\n <div className=\"p-ds-04 pb-ds-03\" onPointerUp={handlePickerChangeComplete} onPointerLeave={handlePickerChangeComplete}>\n <HexColorPicker\n color={internalColor}\n onChange={handleChange}\n className=\"w-full!\"\n style={{ height: 160 }}\n />\n </div>\n )}\n\n {/* Format inputs */}\n <div className=\"border-t border-surface-border px-ds-04 py-ds-03\">\n {/* Format switcher */}\n <div className=\"mb-ds-03 flex items-center gap-ds-01\">\n {formats.map((f) => (\n <button\n key={f}\n type=\"button\"\n onClick={() => setFormat(f)}\n className={cn(\n 'relative min-h-6 rounded-ds-sm px-ds-02 py-px text-ds-xs font-semibold uppercase tracking-wider transition-colors',\n format === f\n ? 'text-accent-11'\n : 'text-surface-fg-muted hover:text-surface-fg',\n )}\n >\n {format === f && (\n <motion.span\n layoutId={`color-input-format-pill-${instanceId}`}\n className=\"absolute inset-0 rounded-ds-sm bg-accent-3\"\n transition={springs.snappy}\n />\n )}\n <span className=\"relative z-10\">{f}</span>\n </button>\n ))}\n </div>\n\n {/* Format fields — animated swap */}\n <AnimatePresence mode=\"wait\">\n {format === 'hex' && (\n <motion.div\n key=\"hex\"\n initial={{ opacity: 0, y: 4 }}\n animate={{ opacity: 1, y: 0 }}\n exit={{ opacity: 0, y: -4 }}\n transition={{ duration: durations.moderate01 }}\n className=\"flex gap-ds-02\"\n >\n <FormatInput\n id={`${instanceId}-hex`}\n label=\"Hex\"\n value={internalColor.replace('#', '').toUpperCase()}\n onChange={(v) => {\n const clean = v.replace(/[^0-9a-fA-F]/g, '').slice(0, 6)\n if (clean.length === 6) handleDiscreteChange(`#${clean}`)\n }}\n onBlur={() => {\n // Revert display to current color if input is incomplete\n const display = internalColor.replace('#', '').toUpperCase()\n if (display.length !== 6) setInternalColor(internalColor)\n }}\n disabled={disabled}\n maxLength={6}\n prefix=\"#\"\n className=\"flex-1\"\n />\n </motion.div>\n )}\n\n {format === 'rgb' && rgb && (\n <motion.div\n key=\"rgb\"\n initial={{ opacity: 0, y: 4 }}\n animate={{ opacity: 1, y: 0 }}\n exit={{ opacity: 0, y: -4 }}\n transition={{ duration: durations.moderate01 }}\n className=\"flex gap-ds-02\"\n >\n <FormatInput id={`${instanceId}-r`} label=\"R\" value={String(rgb.r)} onChange={(v) => handleRgbChange('r', v)} disabled={disabled} className=\"flex-1\" />\n <FormatInput id={`${instanceId}-g`} label=\"G\" value={String(rgb.g)} onChange={(v) => handleRgbChange('g', v)} disabled={disabled} className=\"flex-1\" />\n <FormatInput id={`${instanceId}-b`} label=\"B\" value={String(rgb.b)} onChange={(v) => handleRgbChange('b', v)} disabled={disabled} className=\"flex-1\" />\n </motion.div>\n )}\n\n {format === 'hsl' && hsl && (\n <motion.div\n key=\"hsl\"\n initial={{ opacity: 0, y: 4 }}\n animate={{ opacity: 1, y: 0 }}\n exit={{ opacity: 0, y: -4 }}\n transition={{ duration: durations.moderate01 }}\n className=\"flex gap-ds-02\"\n >\n <FormatInput id={`${instanceId}-h`} label=\"H\" value={String(hsl.h)} onChange={(v) => handleHslChange('h', v)} disabled={disabled} className=\"flex-1\" />\n <FormatInput id={`${instanceId}-s`} label=\"S\" value={String(hsl.s)} onChange={(v) => handleHslChange('s', v)} disabled={disabled} className=\"flex-1\" />\n <FormatInput id={`${instanceId}-l`} label=\"L\" value={String(hsl.l)} onChange={(v) => handleHslChange('l', v)} disabled={disabled} className=\"flex-1\" />\n </motion.div>\n )}\n </AnimatePresence>\n </div>\n\n {/* Preset swatches */}\n {resolvedPresets.length > 0 && (\n <div className=\"border-t border-surface-border px-ds-04 py-ds-03\">\n <div className=\"flex flex-wrap gap-ds-02\">\n {resolvedPresets.map((preset, i) => {\n const isSelected = internalColor.toLowerCase() === preset.hex.toLowerCase()\n return (\n <motion.button\n key={preset.hex}\n type=\"button\"\n disabled={disabled}\n onClick={() => handleDiscreteChange(preset.hex)}\n initial={{ opacity: 0, scale: 0.8 }}\n animate={{ opacity: 1, scale: isSelected ? 1.15 : 1 }}\n whileHover={{ scale: isSelected ? 1.15 : 1.1 }}\n whileTap={{ scale: 0.9 }}\n transition={{ ...springs.bouncy, delay: i * 0.02 }}\n className={cn(\n 'h-6 w-6 rounded-ds-sm border',\n isSelected\n ? 'border-accent-7 ring-2 ring-accent-9/30'\n : 'border-surface-border hover:border-surface-border-strong',\n disabled && 'cursor-not-allowed opacity-50',\n )}\n style={{ backgroundColor: preset.hex }}\n title={preset.label}\n aria-label={`${preset.label}: ${preset.hex}`}\n />\n )\n })}\n </div>\n </div>\n )}\n\n {/* Reset / Undo footer */}\n {(undoStack.length > 0 || internalColor !== openColor) && (\n <motion.div\n initial={{ opacity: 0, height: 0 }}\n animate={{ opacity: 1, height: 'auto' }}\n exit={{ opacity: 0, height: 0 }}\n className=\"flex items-center gap-ds-02 border-t border-surface-border px-ds-04 py-ds-02\"\n >\n {/* Original color preview */}\n <span\n className=\"h-4 w-4 shrink-0 rounded-full border border-surface-border\"\n style={{ backgroundColor: openColor }}\n title={`Original: ${openColor}`}\n />\n <span className=\"text-ds-xs text-surface-fg-muted\">\n {openColor.toUpperCase()}\n </span>\n <span className=\"flex-1\" />\n {undoStack.length > 0 && (\n <button\n type=\"button\"\n onClick={handleUndo}\n className=\"min-h-6 rounded-ds-sm px-ds-02 py-px text-ds-xs font-medium text-surface-fg-muted transition-colors hover:text-surface-fg\"\n >\n Undo\n </button>\n )}\n {internalColor !== openColor && (\n <button\n type=\"button\"\n onClick={handleReset}\n className=\"min-h-6 rounded-ds-sm px-ds-02 py-px text-ds-xs font-medium text-surface-fg-muted transition-colors hover:text-error-11\"\n >\n Reset\n </button>\n )}\n </motion.div>\n )}\n </div>\n </PopoverContent>\n </Popover>\n </div>\n )\n },\n)\nColorInput.displayName = 'ColorInput'\n\nexport { ColorInput }\n"],"mappings":";;;;;;;;;AAeA,SAAS,EAAS,GAAyD;CACzE,IAAM,IAAI,qBAAqB,KAAK,EAAI;AACxC,KAAI,CAAC,EAAG,QAAO;CACf,IAAM,IAAI,SAAS,EAAE,IAAI,GAAG;AAC5B,QAAO;EAAE,GAAI,KAAK,KAAM;EAAK,GAAI,KAAK,IAAK;EAAK,GAAG,IAAI;EAAK;;AAG9D,SAAS,EAAS,GAAW,GAAW,GAAmB;AACzD,QAAO,MAAM;EAAC;EAAG;EAAG;EAAE,CAAC,KAAK,MAAM,KAAK,IAAI,GAAG,KAAK,IAAI,KAAK,KAAK,MAAM,EAAE,CAAC,CAAC,CAAC,SAAS,GAAG,CAAC,SAAS,GAAG,IAAI,CAAC,CAAC,KAAK,GAAG;;AAGrH,SAAS,EAAS,GAAyD;CACzE,IAAM,IAAM,EAAS,EAAI;AACzB,KAAI,CAAC,EAAK,QAAO;CACjB,IAAM,IAAI,EAAI,IAA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IACI,4CACA,4DACJ,KAAY,gCACb;UACD,OAAO,EAAE,iBAAiB,EAAO,KAAK;UACtC,OAAO,EAAO;UACd,cAAY,GAAG,EAAO,MAAM,IAAI,EAAO;UACvC,EAnBK,EAAO,IAmBZ;UAEJ;QACE,CAAA;OACF,CAAA;OAIN,EAAU,SAAS,KAAK,MAAkB,MAC1C,kBAAC,EAAO,KAAR;OACE,SAAS;QAAE,SAAS;QAAG,QAAQ;QAAG;OAClC,SAAS;QAAE,SAAS;QAAG,QAAQ;QAAQ;OACvC,MAAM;QAAE,SAAS;QAAG,QAAQ;QAAG;OAC/B,WAAU;iBAJZ;QAOE,kBAAC,QAAD;SACE,WAAU;SACV,OAAO,EAAE,iBAAiB,GAAW;SACrC,OAAO,aAAa;SACpB,CAAA;QACF,kBAAC,QAAD;SAAM,WAAU;mBACb,EAAU,aAAa;SACnB,CAAA;QACP,kBAAC,QAAD,EAAM,WAAU,UAAW,CAAA;QAC1B,EAAU,SAAS,KAClB,kBAAC,UAAD;SACE,MAAK;SACL,SAAS;SACT,WAAU;mBACX;SAEQ,CAAA;QAEV,MAAkB,KACjB,kBAAC,UAAD;SACE,MAAK;SACL,SAAS;SACT,WAAU;mBACX;SAEQ,CAAA;QAEA;;MAEX;;IACS,CAAA,CACT;;EACN,CAAA;EAGX;AACD,EAAW,cAAc"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"color-swatch.js","names":[],"sources":["../../src/ui/color-swatch.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport { cn } from './lib/utils'\n\nconst sizeMap = {\n sm: 'h-3 w-3',\n md: 'h-4 w-4',\n lg: 'h-6 w-6',\n} as const\n\nconst shapeMap = {\n circle: 'rounded-full',\n square: 'rounded-none',\n rounded: 'rounded-ds-sm',\n} as const\n\n/**\n * A tiny color swatch for displaying dynamic runtime colors (e.g. brand colors from a database).\n *\n * @example\n * <ColorSwatch color=\"#FF5733\" />\n * <ColorSwatch color={org.brandColor} size=\"lg\" ring />\n * <ColorSwatch color=\"rgba(0,0,0,0.5)\" checkerboard copyable />\n */\nexport interface ColorSwatchProps extends React.HTMLAttributes<HTMLSpanElement> {\n /** Any valid CSS color string (hex, rgb, oklch, etc.) */\n color: string\n /** @default 'md' */\n size?: 'sm' | 'md' | 'lg'\n /** @default 'circle' */\n shape?: 'circle' | 'square' | 'rounded'\n /** Show subtle ring border — useful for light colors that blend into the background */\n ring?: boolean\n /** Render as a button that copies the color string to clipboard on click */\n copyable?: boolean\n /** Show a checkerboard pattern behind the color — useful for transparent colors */\n checkerboard?: boolean\n}\n\nconst ColorSwatch = React.forwardRef<HTMLSpanElement, ColorSwatchProps>(\n ({ color, size = 'md', shape = 'circle', ring = false, copyable = false, checkerboard = false, className, style, ...props }, ref) => {\n const [copied, setCopied] = React.useState(false)\n const timerRef = React.useRef<ReturnType<typeof setTimeout> | undefined>(undefined)\n React.useEffect(() => () => clearTimeout(timerRef.current), [])\n\n const sharedClasses = cn(\n 'inline-block shrink-0 relative',\n sizeMap[size],\n shapeMap[shape],\n ring && 'shadow-ring-sm',\n copyable && 'cursor-pointer',\n className,\n )\n\n const checkerboardStyle: React.CSSProperties = checkerboard\n ? {\n backgroundImage: `repeating-conic-gradient(var(--color-neutral-5) 0% 25%, transparent 0% 50%)`,\n backgroundSize: '8px 8px',\n }\n : {}\n\n const colorOverlayStyle: React.CSSProperties = {\n backgroundColor: color,\n ...style,\n }\n\n function handleCopy() {\n navigator.clipboard.writeText(color).then(() => {\n setCopied(true)\n timerRef.current = setTimeout(() => setCopied(false), 1500)\n })\n }\n\n const inner = checkerboard ? (\n <>\n <span\n className={cn('absolute inset-0', shapeMap[shape])}\n style={checkerboardStyle}\n aria-hidden=\"true\"\n />\n <span\n className={cn('absolute inset-0', shapeMap[shape])}\n style={colorOverlayStyle}\n />\n </>\n ) : null\n\n if (copyable) {\n return (\n <button\n type=\"button\"\n ref={ref as React.Ref<HTMLButtonElement>}\n className={sharedClasses}\n style={checkerboard ? {} : colorOverlayStyle}\n onClick={handleCopy}\n aria-label={`Copy color ${color}`}\n {...(props as React.ButtonHTMLAttributes<HTMLButtonElement>)}\n >\n {inner}\n {copied && (\n <span\n role=\"status\"\n className=\"absolute -top-7 left-1/2 -translate-x-1/2 whitespace-nowrap rounded-ds-sm bg-surface-overlay px-1.5 py-0.5 text-[10px] font-sans text-surface-fg shadow-floating\"\n >\n Copied!\n </span>\n )}\n </button>\n )\n }\n\n return (\n <span\n ref={ref}\n className={sharedClasses}\n style={checkerboard ? {} : colorOverlayStyle}\n role=\"presentation\"\n {...props}\n >\n {inner}\n </span>\n )\n },\n)\nColorSwatch.displayName = 'ColorSwatch'\n\nexport { ColorSwatch }\n"],"mappings":";;;;;AAKA,IAAM,IAAU;CACd,IAAI;CACJ,IAAI;CACJ,IAAI;CACL,EAEK,IAAW;CACf,QAAQ;CACR,QAAQ;CACR,SAAS;CACV,EAyBK,IAAc,EAAM,YACvB,EAAE,UAAO,UAAO,MAAM,WAAQ,UAAU,UAAO,IAAO,cAAW,IAAO,kBAAe,IAAO,cAAW,UAAO,GAAG,KAAS,MAAQ;CACnI,IAAM,CAAC,GAAQ,KAAa,EAAM,SAAS,GAAM,EAC3C,IAAW,EAAM,OAAkD,KAAA,EAAU;AACnF,GAAM,sBAAsB,aAAa,EAAS,QAAQ,EAAE,EAAE,CAAC;CAE/D,IAAM,IAAgB,EACpB,kCACA,EAAQ,IACR,EAAS,IACT,KAAQ,kBACR,KAAY,kBACZ,EACD,EAEK,IAAyC,IAC3C;EACE,iBAAiB;EACjB,gBAAgB;EACjB,GACD,EAAE,EAEA,IAAyC;EAC7C,iBAAiB;EACjB,GAAG;EACJ;CAED,SAAS,IAAa;AACpB,YAAU,UAAU,UAAU,EAAM,CAAC,WAAW;AAE9C,GADA,EAAU,GAAK,EACf,EAAS,UAAU,iBAAiB,EAAU,GAAM,EAAE,KAAK;IAC3D;;CAGJ,IAAM,IAAQ,IACZ,kBAAA,GAAA,EAAA,UAAA,CACE,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