@justanarthur/modo-ui 0.6.0 → 2.0.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/README.md +240 -549
- package/blocks/desktop-shell/examples.mdx +153 -0
- package/blocks/desktop-shell/index.tsx +352 -0
- package/blocks/shell-card/examples.mdx +72 -0
- package/blocks/shell-card/index.tsx +127 -0
- package/blocks/sidebar-app/examples.mdx +33 -0
- package/blocks/sidebar-app/index.tsx +232 -0
- package/blocks/sidebar-app/inset-topbar.tsx +20 -0
- package/blocks/sidebar-app/menu-grid.ts +16 -0
- package/blocks/sidebar-app/nav-data.ts +36 -0
- package/blocks/sidebar-app/search-field.tsx +41 -0
- package/blocks/sidebar-app/thread-page.tsx +58 -0
- package/blocks/sidebar-app/user-footer.tsx +60 -0
- package/blocks/sidebar-app/workspace-header.tsx +110 -0
- package/components/actions/button/examples.mdx +153 -0
- package/components/actions/button/index.tsx +325 -0
- package/components/actions/button/loading-demo.tsx +27 -0
- package/components/actions/button/variants.ts +138 -0
- package/components/actions/copy/examples.mdx +125 -0
- package/components/actions/copy/index.tsx +605 -0
- package/components/containers/accordion/accordion-content.tsx +220 -0
- package/components/containers/accordion/accordion-context.tsx +127 -0
- package/components/containers/accordion/accordion-group.tsx +215 -0
- package/components/containers/accordion/examples.mdx +165 -0
- package/components/containers/accordion/index.tsx +355 -0
- package/components/containers/card/card-group.tsx +184 -0
- package/components/containers/card/card-media.tsx +207 -0
- package/components/containers/card/card-parts.tsx +189 -0
- package/components/containers/card/examples.mdx +200 -0
- package/components/containers/card/index.tsx +380 -0
- package/components/data-display/avatar/examples.mdx +95 -0
- package/components/data-display/avatar/index.tsx +135 -0
- package/components/data-display/badge/change-demo.tsx +31 -0
- package/components/data-display/badge/examples.mdx +106 -0
- package/components/data-display/badge/index.tsx +185 -0
- package/components/data-display/badge/variants.ts +55 -0
- package/components/data-display/diff/examples.mdx +72 -0
- package/components/data-display/diff/index.tsx +147 -0
- package/components/data-display/kbd/examples.mdx +55 -0
- package/components/data-display/kbd/index.tsx +65 -0
- package/components/data-display/list/examples.mdx +157 -0
- package/components/data-display/list/index.tsx +130 -0
- package/components/data-display/log-view/examples.mdx +69 -0
- package/components/data-display/log-view/index.tsx +290 -0
- package/components/data-display/log-view/stream-demo.tsx +46 -0
- package/components/data-display/markdown/examples.mdx +92 -0
- package/components/data-display/markdown/index.tsx +291 -0
- package/components/data-display/table/context.ts +59 -0
- package/components/data-display/table/examples.mdx +156 -0
- package/components/data-display/table/head.tsx +105 -0
- package/components/data-display/table/index.tsx +176 -0
- package/components/data-display/table/parts.tsx +202 -0
- package/components/data-display/table/sort-demo.tsx +52 -0
- package/components/feedback/empty-state/examples.mdx +38 -0
- package/components/feedback/empty-state/index.tsx +96 -0
- package/components/feedback/meter/examples.mdx +61 -0
- package/components/feedback/meter/index.tsx +182 -0
- package/components/feedback/progress/examples.mdx +59 -0
- package/components/feedback/progress/index.tsx +168 -0
- package/components/feedback/progress/progress.css +27 -0
- package/components/feedback/progress/step-demo.tsx +29 -0
- package/components/feedback/status-dot/examples.mdx +75 -0
- package/components/feedback/status-dot/index.tsx +105 -0
- package/components/inputs/checkbox/examples.mdx +70 -0
- package/components/inputs/checkbox/index.tsx +465 -0
- package/components/inputs/checkbox/select-all-demo.tsx +50 -0
- package/components/inputs/choice-list/examples.mdx +101 -0
- package/components/inputs/choice-list/index.tsx +186 -0
- package/components/inputs/color-picker/channel-sliders.tsx +70 -0
- package/components/inputs/color-picker/color-input.tsx +387 -0
- package/components/inputs/color-picker/context.ts +11 -0
- package/components/inputs/color-picker/examples.mdx +82 -0
- package/components/inputs/color-picker/format-menu.tsx +212 -0
- package/components/inputs/color-picker/index.tsx +411 -0
- package/components/inputs/color-picker/inputs-row.tsx +196 -0
- package/components/inputs/color-picker/popover.tsx +193 -0
- package/components/inputs/color-picker/saturation-square.tsx +167 -0
- package/components/inputs/color-picker/swatches.tsx +178 -0
- package/components/inputs/color-picker/variants.ts +366 -0
- package/components/inputs/combobox/context.ts +114 -0
- package/components/inputs/combobox/examples.mdx +263 -0
- package/components/inputs/combobox/fields.tsx +377 -0
- package/components/inputs/combobox/index.tsx +390 -0
- package/components/inputs/combobox/list.tsx +415 -0
- package/components/inputs/combobox/remote-demo.tsx +101 -0
- package/components/inputs/date-time/calendar/examples.mdx +34 -0
- package/components/inputs/date-time/calendar/index.tsx +346 -0
- package/components/inputs/date-time/calendar/use-month-window.ts +176 -0
- package/components/inputs/date-time/date-picker/examples.mdx +183 -0
- package/components/inputs/date-time/date-picker/index.tsx +378 -0
- package/components/inputs/date-time/date-picker/masked-date-input.tsx +206 -0
- package/components/inputs/date-time/date-range-picker/examples.mdx +73 -0
- package/components/inputs/date-time/date-range-picker/index.tsx +503 -0
- package/components/inputs/date-time/date-value.ts +37 -0
- package/components/inputs/date-time/day-rules.ts +25 -0
- package/components/inputs/date-time/duration-picker/examples.mdx +32 -0
- package/components/inputs/date-time/duration-picker/index.tsx +215 -0
- package/components/inputs/date-time/month-picker/examples.mdx +28 -0
- package/components/inputs/date-time/month-picker/index.tsx +225 -0
- package/components/inputs/date-time/picker-shell.tsx +591 -0
- package/components/inputs/date-time/time-columns.tsx +93 -0
- package/components/inputs/date-time/time-picker/examples.mdx +39 -0
- package/components/inputs/date-time/time-picker/index.tsx +197 -0
- package/components/inputs/editable-text/examples.mdx +33 -0
- package/components/inputs/editable-text/index.tsx +175 -0
- package/components/inputs/field/examples.mdx +159 -0
- package/components/inputs/field/index.tsx +278 -0
- package/components/inputs/file-dropzone/examples.mdx +82 -0
- package/components/inputs/file-dropzone/file-row.tsx +200 -0
- package/components/inputs/file-dropzone/index.tsx +322 -0
- package/components/inputs/file-dropzone/upload-demo.tsx +71 -0
- package/components/inputs/file-dropzone/variants.ts +96 -0
- package/components/inputs/input/examples.mdx +111 -0
- package/components/inputs/input/index.tsx +431 -0
- package/components/inputs/input/password-demo.tsx +30 -0
- package/components/inputs/key-value/examples.mdx +58 -0
- package/components/inputs/key-value/index.tsx +232 -0
- package/components/inputs/label/examples.mdx +60 -0
- package/components/inputs/label/index.tsx +72 -0
- package/components/inputs/number-input/examples.mdx +96 -0
- package/components/inputs/number-input/index.tsx +226 -0
- package/components/inputs/radio/examples.mdx +72 -0
- package/components/inputs/radio/index.tsx +442 -0
- package/components/inputs/search/examples.mdx +74 -0
- package/components/inputs/search/index.tsx +340 -0
- package/components/inputs/select/examples.mdx +232 -0
- package/components/inputs/select/index.tsx +601 -0
- package/components/inputs/slider/comfortable.tsx +524 -0
- package/components/inputs/slider/compact.tsx +690 -0
- package/components/inputs/slider/examples.mdx +127 -0
- package/components/inputs/slider/geometry.ts +88 -0
- package/components/inputs/slider/index.tsx +136 -0
- package/components/inputs/slider/value-display.tsx +184 -0
- package/components/inputs/switch/examples.mdx +94 -0
- package/components/inputs/switch/index.tsx +452 -0
- package/components/inputs/textarea/examples.mdx +88 -0
- package/components/inputs/textarea/index.tsx +129 -0
- package/components/navigation/breadcrumb/examples.mdx +45 -0
- package/components/navigation/breadcrumb/index.tsx +284 -0
- package/components/navigation/navigation-menu/content.tsx +76 -0
- package/components/navigation/navigation-menu/context.ts +38 -0
- package/components/navigation/navigation-menu/examples.mdx +96 -0
- package/components/navigation/navigation-menu/index.tsx +211 -0
- package/components/navigation/navigation-menu/indicator.tsx +38 -0
- package/components/navigation/navigation-menu/item.tsx +47 -0
- package/components/navigation/navigation-menu/link.tsx +104 -0
- package/components/navigation/navigation-menu/list.tsx +97 -0
- package/components/navigation/navigation-menu/trigger.tsx +78 -0
- package/components/navigation/navigation-menu/use-dom-rows.ts +56 -0
- package/components/navigation/pagination/examples.mdx +65 -0
- package/components/navigation/pagination/index.tsx +323 -0
- package/components/navigation/sidebar/examples.mdx +319 -0
- package/components/navigation/sidebar/index.tsx +393 -0
- package/components/navigation/sidebar/menu-scope.tsx +439 -0
- package/components/navigation/sidebar/row-label.tsx +61 -0
- package/components/navigation/sidebar/sidebar-context.tsx +71 -0
- package/components/navigation/sidebar/sidebar-group.tsx +299 -0
- package/components/navigation/sidebar/sidebar-menu-actions.tsx +209 -0
- package/components/navigation/sidebar/sidebar-menu-button.tsx +214 -0
- package/components/navigation/sidebar/sidebar-menu-item.tsx +207 -0
- package/components/navigation/sidebar/sidebar-menu-sub.tsx +180 -0
- package/components/navigation/sidebar/sidebar-parts.tsx +94 -0
- package/components/navigation/sidebar/sidebar-provider.tsx +248 -0
- package/components/navigation/sidebar/sidebar-rail.tsx +206 -0
- package/components/navigation/sidebar/sidebar-shell.tsx +180 -0
- package/components/navigation/sidebar/sidebar-shortcut.tsx +101 -0
- package/components/navigation/sidebar/sidebar.css +70 -0
- package/components/navigation/sidebar/use-measured-collapse.ts +62 -0
- package/components/navigation/tabs/context.ts +45 -0
- package/components/navigation/tabs/examples.mdx +146 -0
- package/components/navigation/tabs/index.tsx +142 -0
- package/components/navigation/tabs/item.tsx +161 -0
- package/components/navigation/tabs/list.tsx +143 -0
- package/components/navigation/tree/examples.mdx +76 -0
- package/components/navigation/tree/index.tsx +431 -0
- package/components/overlays/alert-dialog/examples.mdx +89 -0
- package/components/overlays/alert-dialog/index.tsx +273 -0
- package/components/overlays/alert-dialog/pending-demo.tsx +38 -0
- package/components/overlays/command/examples.mdx +113 -0
- package/components/overlays/command/index.tsx +397 -0
- package/components/overlays/context-menu/examples.mdx +110 -0
- package/components/overlays/context-menu/index.tsx +144 -0
- package/components/overlays/dialog/examples.mdx +162 -0
- package/components/overlays/dialog/index.tsx +326 -0
- package/components/overlays/dropdown/dropdown-search.tsx +330 -0
- package/components/overlays/dropdown/examples.mdx +242 -0
- package/components/overlays/dropdown/index.tsx +433 -0
- package/components/overlays/dropdown/menu-item.tsx +326 -0
- package/components/overlays/dropdown/menu-parts.tsx +153 -0
- package/components/overlays/dropdown/menu-popup.tsx +336 -0
- package/components/overlays/dropdown/panel-state.ts +209 -0
- package/components/overlays/dropdown/submenu.tsx +169 -0
- package/components/overlays/lightbox/examples.mdx +29 -0
- package/components/overlays/lightbox/index.tsx +395 -0
- package/components/overlays/popover/anchored-demo.tsx +68 -0
- package/components/overlays/popover/examples.mdx +154 -0
- package/components/overlays/popover/index.tsx +276 -0
- package/components/overlays/preview-card/examples.mdx +61 -0
- package/components/overlays/preview-card/index.tsx +152 -0
- package/components/overlays/sheet/examples.mdx +102 -0
- package/components/overlays/sheet/index.tsx +290 -0
- package/components/overlays/toast/examples.mdx +109 -0
- package/components/overlays/toast/index.tsx +469 -0
- package/components/overlays/toast/manager.ts +170 -0
- package/components/overlays/tooltip/examples.mdx +100 -0
- package/components/overlays/tooltip/index.tsx +408 -0
- package/dist/base.css +186 -50
- package/dist/blocks/desktop-shell/index.d.ts +84 -0
- package/dist/blocks/desktop-shell/index.js +45 -0
- package/dist/blocks/shell-card/index.d.ts +57 -0
- package/dist/blocks/shell-card/index.js +13 -0
- package/dist/blocks/sidebar-app/index.d.ts +31 -3
- package/dist/blocks/sidebar-app/index.js +55 -26
- package/dist/components/actions/button/index.d.ts +87 -0
- package/dist/components/actions/button/index.js +22 -0
- package/dist/components/actions/button/variants.d.ts +29 -0
- package/dist/components/actions/button/variants.js +6 -0
- package/dist/components/actions/copy/index.d.ts +79 -0
- package/dist/components/actions/copy/index.js +26 -0
- package/dist/components/containers/accordion/index.d.ts +144 -0
- package/dist/components/containers/accordion/index.js +40 -0
- package/dist/components/containers/card/index.d.ts +223 -0
- package/dist/components/containers/card/index.js +58 -0
- package/dist/components/data-display/avatar/index.d.ts +46 -0
- package/dist/components/data-display/avatar/index.js +20 -0
- package/dist/components/{badge → data-display/badge}/index.d.ts +18 -15
- package/dist/components/data-display/badge/index.js +21 -0
- package/dist/components/data-display/badge/variants.d.ts +31 -0
- package/dist/components/data-display/badge/variants.js +8 -0
- package/dist/components/data-display/diff/index.d.ts +42 -0
- package/dist/components/data-display/diff/index.js +17 -0
- package/dist/components/data-display/kbd/index.d.ts +28 -0
- package/dist/components/data-display/kbd/index.js +11 -0
- package/dist/components/data-display/list/index.d.ts +60 -0
- package/dist/components/data-display/list/index.js +21 -0
- package/dist/components/data-display/log-view/index.d.ts +47 -0
- package/dist/components/data-display/log-view/index.js +26 -0
- package/dist/components/data-display/markdown/index.d.ts +43 -0
- package/dist/components/data-display/markdown/index.js +34 -0
- package/dist/components/data-display/table/index.d.ts +117 -0
- package/dist/components/data-display/table/index.js +40 -0
- package/dist/components/feedback/empty-state/index.d.ts +38 -0
- package/dist/components/feedback/empty-state/index.js +15 -0
- package/dist/components/feedback/meter/index.d.ts +48 -0
- package/dist/components/feedback/meter/index.js +13 -0
- package/dist/components/feedback/progress/index.d.ts +55 -0
- package/dist/components/feedback/progress/index.js +16 -0
- package/dist/components/feedback/status-dot/index.d.ts +37 -0
- package/dist/components/feedback/status-dot/index.js +15 -0
- package/dist/components/inputs/checkbox/index.d.ts +31 -9
- package/dist/components/inputs/checkbox/index.js +22 -13
- package/dist/components/inputs/choice-list/index.d.ts +52 -0
- package/dist/components/inputs/choice-list/index.js +25 -0
- package/dist/components/inputs/color-picker/index.d.ts +89 -53
- package/dist/components/inputs/color-picker/index.js +37 -21
- package/dist/components/inputs/color-picker/variants.d.ts +61 -0
- package/dist/components/inputs/color-picker/variants.js +28 -0
- package/dist/components/inputs/combobox/index.d.ts +194 -103
- package/dist/components/inputs/combobox/index.js +31 -20
- package/dist/components/inputs/date-time/calendar/index.d.ts +6 -1
- package/dist/components/inputs/date-time/calendar/index.js +17 -11
- package/dist/components/inputs/date-time/date-picker/index.d.ts +105 -20
- package/dist/components/inputs/date-time/date-picker/index.js +42 -25
- package/dist/components/inputs/date-time/date-range-picker/index.d.ts +137 -22
- package/dist/components/inputs/date-time/date-range-picker/index.js +42 -24
- package/dist/components/inputs/date-time/duration-picker/index.d.ts +60 -10
- package/dist/components/inputs/date-time/duration-picker/index.js +39 -24
- package/dist/components/inputs/date-time/month-picker/index.d.ts +57 -9
- package/dist/components/inputs/date-time/month-picker/index.js +38 -23
- package/dist/components/inputs/date-time/time-picker/index.d.ts +55 -9
- package/dist/components/inputs/date-time/time-picker/index.js +39 -24
- package/dist/components/inputs/editable-text/index.d.ts +38 -0
- package/dist/components/inputs/editable-text/index.js +17 -0
- package/dist/components/inputs/field/index.d.ts +112 -0
- package/dist/components/inputs/field/index.js +28 -0
- package/dist/components/inputs/file-dropzone/index.d.ts +176 -0
- package/dist/components/inputs/file-dropzone/index.js +36 -0
- package/dist/components/inputs/file-dropzone/variants.d.ts +35 -0
- package/dist/components/inputs/file-dropzone/variants.js +12 -0
- package/dist/components/inputs/input/index.d.ts +100 -20
- package/dist/components/inputs/input/index.js +20 -9
- package/dist/components/inputs/key-value/index.d.ts +57 -0
- package/dist/components/inputs/key-value/index.js +29 -0
- package/dist/components/inputs/label/index.d.ts +34 -0
- package/dist/components/inputs/label/index.js +12 -0
- package/dist/components/inputs/number-input/index.d.ts +96 -0
- package/dist/components/inputs/number-input/index.js +23 -0
- package/dist/components/inputs/radio/index.d.ts +25 -6
- package/dist/components/inputs/radio/index.js +20 -12
- package/dist/components/inputs/search/index.d.ts +10 -3
- package/dist/components/inputs/search/index.js +33 -18
- package/dist/components/inputs/select/index.d.ts +141 -52
- package/dist/components/inputs/select/index.js +36 -17
- package/dist/components/inputs/slider/index.d.ts +26 -39
- package/dist/components/inputs/slider/index.js +9 -7
- package/dist/components/inputs/switch/index.d.ts +14 -2
- package/dist/components/inputs/switch/index.js +17 -12
- package/dist/components/inputs/textarea/index.d.ts +13 -4
- package/dist/components/inputs/textarea/index.js +12 -6
- package/dist/components/navigation/breadcrumb/index.d.ts +44 -0
- package/dist/components/navigation/breadcrumb/index.js +45 -0
- package/dist/components/navigation/navigation-menu/index.d.ts +166 -0
- package/dist/components/navigation/navigation-menu/index.js +47 -0
- package/dist/components/navigation/pagination/index.d.ts +62 -0
- package/dist/components/navigation/pagination/index.js +34 -0
- package/dist/components/navigation/sidebar/index.d.ts +228 -207
- package/dist/components/navigation/sidebar/index.js +51 -36
- package/dist/components/navigation/tabs/index.d.ts +63 -40
- package/dist/components/navigation/tabs/index.js +23 -12
- package/dist/components/navigation/tree/index.d.ts +65 -0
- package/dist/components/navigation/tree/index.js +25 -0
- package/dist/components/overlays/alert-dialog/index.d.ts +149 -45
- package/dist/components/overlays/alert-dialog/index.js +28 -13
- package/dist/components/overlays/command/index.d.ts +36 -17
- package/dist/components/overlays/command/index.js +31 -17
- package/dist/components/overlays/context-menu/index.d.ts +182 -50
- package/dist/components/overlays/context-menu/index.js +37 -19
- package/dist/components/overlays/dialog/index.d.ts +110 -72
- package/dist/components/overlays/dialog/index.js +23 -12
- package/dist/components/overlays/dropdown/index.d.ts +329 -121
- package/dist/components/overlays/dropdown/index.js +53 -21
- package/dist/components/overlays/lightbox/index.d.ts +59 -0
- package/dist/components/overlays/lightbox/index.js +30 -0
- package/dist/components/overlays/popover/index.d.ts +100 -39
- package/dist/components/overlays/popover/index.js +17 -9
- package/dist/components/overlays/preview-card/index.d.ts +55 -26
- package/dist/components/overlays/preview-card/index.js +16 -8
- package/dist/components/overlays/sheet/index.d.ts +82 -28
- package/dist/components/overlays/sheet/index.js +24 -13
- package/dist/components/overlays/toast/index.d.ts +155 -53
- package/dist/components/overlays/toast/index.js +24 -10
- package/dist/components/overlays/tooltip/index.d.ts +113 -39
- package/dist/components/overlays/tooltip/index.js +18 -6
- package/dist/docs/index.d.ts +54 -0
- package/dist/docs/index.js +327 -0
- package/dist/docs/vite.d.ts +50 -0
- package/dist/docs/vite.js +63 -0
- package/dist/index.d.ts +5036 -2211
- package/dist/index.js +413 -155
- package/dist/lib/date-locale.d.ts +31 -0
- package/dist/lib/date-locale.js +26 -0
- package/dist/lib/date-mask.d.ts +41 -0
- package/dist/lib/date-mask.js +20 -0
- package/dist/lib/field-box.d.ts +114 -0
- package/dist/lib/field-box.js +18 -0
- package/dist/lib/field-classes.d.ts +45 -0
- package/dist/lib/field-classes.js +24 -0
- package/dist/lib/fluid-hover-highlight.d.ts +90 -0
- package/dist/lib/fluid-hover-highlight.js +12 -0
- package/dist/lib/focus-ring.d.ts +24 -0
- package/dist/lib/focus-ring.js +11 -0
- package/dist/lib/goo-indicator.d.ts +46 -0
- package/dist/lib/goo-indicator.js +15 -0
- package/dist/lib/icon-context.d.ts +29 -0
- package/dist/lib/icon-context.js +10 -0
- package/dist/lib/merge-refs.d.ts +10 -0
- package/dist/lib/merge-refs.js +8 -0
- package/dist/lib/morph-layers.d.ts +99 -0
- package/dist/lib/morph-layers.js +14 -0
- package/dist/lib/morph-part.d.ts +21 -0
- package/dist/lib/morph-part.js +12 -0
- package/dist/lib/overlay.d.ts +113 -0
- package/dist/lib/overlay.js +21 -0
- package/dist/lib/popup-rows.d.ts +101 -0
- package/dist/lib/popup-rows.js +25 -0
- package/dist/lib/popup-surface.d.ts +92 -0
- package/dist/lib/popup-surface.js +17 -0
- package/dist/lib/popup.d.ts +36 -0
- package/dist/lib/popup.js +15 -0
- package/dist/lib/rect.d.ts +16 -0
- package/dist/lib/rect.js +12 -0
- package/dist/lib/reduced-motion.d.ts +9 -0
- package/dist/lib/reduced-motion.js +6 -0
- package/dist/lib/row-group.d.ts +100 -0
- package/dist/lib/row-group.js +12 -0
- package/dist/lib/row-index.d.ts +12 -0
- package/dist/lib/row-index.js +10 -0
- package/dist/lib/row-order.d.ts +28 -0
- package/dist/lib/row-order.js +11 -0
- package/dist/lib/scroll-column.d.ts +27 -0
- package/dist/lib/scroll-column.js +20 -0
- package/dist/lib/shape-classes.d.ts +16 -0
- package/dist/lib/shape-classes.js +6 -0
- package/dist/lib/shape-context.d.ts +30 -0
- package/dist/lib/shape-context.js +11 -0
- package/dist/lib/size-context.d.ts +93 -0
- package/dist/lib/size-context.js +15 -0
- package/dist/lib/size-scale.d.ts +79 -0
- package/dist/lib/size-scale.js +8 -0
- package/dist/lib/slot.d.ts +51 -0
- package/dist/lib/slot.js +16 -0
- package/dist/lib/spinner-glyph.d.ts +7 -0
- package/dist/lib/spinner-glyph.js +7 -0
- package/dist/lib/springs.d.ts +48 -0
- package/dist/lib/springs.js +10 -0
- package/dist/lib/surface-classes.d.ts +19 -0
- package/dist/lib/surface-classes.js +10 -0
- package/dist/lib/surface-context.d.ts +11 -0
- package/dist/lib/surface-context.js +10 -0
- package/dist/lib/use-autosize-textarea.d.ts +16 -0
- package/dist/lib/use-autosize-textarea.js +7 -0
- package/dist/lib/use-controllable-state.d.ts +16 -0
- package/dist/lib/use-controllable-state.js +6 -0
- package/dist/lib/use-fluid-hover.d.ts +90 -0
- package/dist/lib/use-fluid-hover.js +8 -0
- package/dist/lib/use-is-mobile.d.ts +2 -0
- package/dist/lib/use-is-mobile.js +6 -0
- package/dist/lib/use-iso-layout-effect.d.ts +7 -0
- package/dist/lib/use-iso-layout-effect.js +6 -0
- package/dist/lib/use-keyboard-nav-gate.d.ts +20 -0
- package/dist/lib/use-keyboard-nav-gate.js +8 -0
- package/dist/lib/use-merge-split.d.ts +47 -0
- package/dist/lib/use-merge-split.js +16 -0
- package/dist/lib/use-morph.d.ts +107 -0
- package/dist/lib/use-morph.js +21 -0
- package/dist/lib/use-touch-primary.d.ts +2 -0
- package/dist/lib/use-touch-primary.js +6 -0
- package/dist/lib/utils.d.ts +3 -0
- package/dist/lib/utils.js +6 -0
- package/dist/lib/weight-label.d.ts +26 -0
- package/dist/lib/weight-label.js +7 -0
- package/dist/preset.d.ts +27 -0
- package/dist/preset.js +35 -4
- package/dist/primitives/content/code/index.js +14 -0
- package/dist/primitives/content/skeleton/index.d.ts +35 -0
- package/dist/primitives/content/skeleton/index.js +14 -0
- package/dist/primitives/layout/resizable/index.d.ts +67 -0
- package/dist/primitives/layout/resizable/index.js +16 -0
- package/dist/primitives/{scroll-area → layout/scroll-area}/index.d.ts +5 -4
- package/dist/primitives/layout/scroll-area/index.js +14 -0
- package/dist/primitives/layout/separator/index.d.ts +26 -0
- package/dist/primitives/layout/separator/index.js +9 -0
- package/dist/primitives/layout/sortable/index.d.ts +79 -0
- package/dist/primitives/layout/sortable/index.js +23 -0
- package/dist/primitives/layout/virtual-list/index.d.ts +50 -0
- package/dist/primitives/layout/virtual-list/index.js +9 -0
- package/dist/primitives/{craft → systems/craft}/index.d.ts +1 -1
- package/dist/primitives/systems/craft/index.js +16 -0
- package/dist/primitives/{fluid-hover → systems/fluid-hover}/index.d.ts +13 -14
- package/dist/primitives/systems/fluid-hover/index.js +30 -0
- package/dist/primitives/{morph → systems/morph}/index.d.ts +4 -2
- package/dist/primitives/systems/morph/index.js +30 -0
- package/dist/primitives/{motion → systems/motion}/index.d.ts +2 -0
- package/dist/primitives/systems/motion/index.js +25 -0
- package/dist/primitives/{sizes → systems/sizes}/index.d.ts +19 -6
- package/dist/primitives/{sizes → systems/sizes}/index.js +10 -5
- package/dist/primitives/{surface → systems/surface}/index.d.ts +12 -25
- package/dist/primitives/systems/surface/index.js +21 -0
- package/dist/shared/components-0cpte6s1.js +868 -0
- package/dist/shared/{components-b2wyq2cq.js → components-0h2mng6m.js} +65 -88
- package/dist/shared/components-14wzcym0.js +585 -0
- package/dist/shared/components-1asw2ph0.js +237 -0
- package/dist/shared/components-1bnf96sr.js +231 -0
- package/dist/shared/components-1f3a7gmg.js +168 -0
- package/dist/shared/components-1hb27y2e.js +77 -0
- package/dist/shared/components-1hga6pkn.js +334 -0
- package/dist/shared/components-1ztgy933.js +61 -0
- package/dist/shared/components-22h8dvt1.js +180 -0
- package/dist/shared/{components-y9y0g8er.js → components-280grw6q.js} +41 -55
- package/dist/shared/components-29ebea21.js +129 -0
- package/dist/shared/components-2m2hg11x.js +1486 -0
- package/dist/shared/components-3hgk57s0.js +27 -0
- package/dist/shared/components-3rvrdsa9.js +208 -0
- package/dist/shared/{components-1v7rxytx.js → components-45r18egt.js} +11 -1
- package/dist/shared/components-464zs8v6.js +152 -0
- package/dist/shared/components-4t2cjav8.js +73 -0
- package/dist/shared/components-5xs8pkkj.js +64 -0
- package/dist/shared/components-62510420.js +192 -0
- package/dist/shared/components-6f5pyzb2.js +33 -0
- package/dist/shared/components-6h5qg9rs.js +188 -0
- package/dist/shared/components-6rtawx8y.js +476 -0
- package/dist/shared/{components-fzrq6tr3.js → components-77gxngmc.js} +87 -62
- package/dist/shared/{components-59efxjd9.js → components-7c4a0egq.js} +9 -0
- package/dist/shared/components-7mj5wsv3.js +200 -0
- package/dist/shared/components-7xc2dne4.js +324 -0
- package/dist/shared/{components-hqeq3w9q.js → components-8pnvkrbw.js} +51 -50
- package/dist/shared/{components-c6s6b43g.js → components-8wp8d8q1.js} +11 -2
- package/dist/shared/components-91mmbrw3.js +113 -0
- package/dist/shared/components-92mvpt9h.js +243 -0
- package/dist/shared/components-9ca0c92a.js +148 -0
- package/dist/shared/components-9h3g4mnq.js +46 -0
- package/dist/shared/components-9rebr89j.js +249 -0
- package/dist/shared/{components-s083f38z.js → components-9z7bq8gn.js} +192 -62
- package/dist/shared/{components-q5xj5c16.js → components-a1ms36qq.js} +17 -9
- package/dist/shared/components-a1mwqxsv.js +448 -0
- package/dist/shared/components-azrjnfxn.js +22 -0
- package/dist/shared/components-b2kjsn1s.js +643 -0
- package/dist/shared/{components-1z6tdadk.js → components-b7p1pjcm.js} +40 -36
- package/dist/shared/components-b9bj65j3.js +204 -0
- package/dist/shared/components-bkwjvvkh.js +18 -0
- package/dist/shared/components-c515d6xr.js +35 -0
- package/dist/shared/{components-zx6b6yby.js → components-ceyn28cf.js} +11 -18
- package/dist/shared/components-chda6b23.js +70 -0
- package/dist/shared/{components-vc7vq5nz.js → components-cp5ym3g2.js} +16 -7
- package/dist/shared/components-czvraaw9.js +135 -0
- package/dist/shared/components-dm86y7b3.js +105 -0
- package/dist/shared/{components-mjthm1kf.js → components-e7zxwja1.js} +18 -15
- package/dist/shared/components-ee09xmkh.js +359 -0
- package/dist/shared/{components-b0eac83j.js → components-esy5nsvc.js} +17 -31
- package/dist/shared/{components-39jq9va1.js → components-ev0ytbqb.js} +39 -31
- package/dist/shared/components-ew4wq7mj.js +42 -0
- package/dist/shared/components-fmyvz4r2.js +79 -0
- package/dist/shared/components-fpsfr52a.js +34 -0
- package/dist/shared/{components-jwst3vtj.js → components-fqsgd07c.js} +198 -86
- package/dist/shared/{components-kvr7f9hy.js → components-g35n8tzm.js} +20 -12
- package/dist/shared/components-g8qgr7p8.js +28 -0
- package/dist/shared/{components-vfbhxf5r.js → components-gd8gmr6w.js} +10 -9
- package/dist/shared/components-grxgqa75.js +49 -0
- package/dist/shared/{components-8snj490h.js → components-gsstwhtv.js} +101 -72
- package/dist/shared/components-h0x2pj2y.js +433 -0
- package/dist/shared/components-h8v9nh5r.js +142 -0
- package/dist/shared/components-hcftn5r8.js +336 -0
- package/dist/shared/components-hh1g7r3t.js +57 -0
- package/dist/shared/components-hz6armxa.js +301 -0
- package/dist/shared/{components-ta7shw28.js → components-j3q9kaps.js} +11 -7
- package/dist/shared/{components-4700p9kz.js → components-j79a6jqa.js} +44 -38
- package/dist/shared/components-jeecysvd.js +192 -0
- package/dist/shared/{components-zrkzcayz.js → components-jnhpgpfk.js} +59 -4
- package/dist/shared/{components-7r3etddy.js → components-jw45ck66.js} +30 -58
- package/dist/shared/components-kwxye0an.js +85 -0
- package/dist/shared/{components-cv16mryv.js → components-kxpcj2ry.js} +24 -32
- package/dist/shared/components-m3vxpz2z.js +123 -0
- package/dist/shared/components-me742146.js +252 -0
- package/dist/shared/components-mse06t0x.js +31 -0
- package/dist/shared/components-n0gbyp5a.js +65 -0
- package/dist/shared/{components-w90endve.js → components-nhmgr5xc.js} +1480 -1483
- package/dist/shared/components-nwa2a9tq.js +27 -0
- package/dist/shared/components-nxqrw789.js +37 -0
- package/dist/shared/components-nz14rwtd.js +40 -0
- package/dist/shared/components-p0x8ren6.js +61 -0
- package/dist/shared/{components-wvp1m52g.js → components-p32aqk3q.js} +919 -898
- package/dist/shared/components-pa2t12j2.js +327 -0
- package/dist/shared/components-pa43g2r2.js +39 -0
- package/dist/shared/components-pva1wj1r.js +27 -0
- package/dist/shared/components-q0hs5rqn.js +91 -0
- package/dist/shared/components-q7zk70tx.js +257 -0
- package/dist/shared/components-r5q9gdh4.js +147 -0
- package/dist/shared/components-rgng034x.js +53 -0
- package/dist/shared/{components-2dxkv6zm.js → components-rzy6h7s4.js} +34 -40
- package/dist/shared/components-s217vq1n.js +35 -0
- package/dist/shared/components-s4x951hj.js +45 -0
- package/dist/shared/components-s90v3jpr.js +1170 -0
- package/dist/shared/components-t0c1rw40.js +75 -0
- package/dist/shared/components-t84071ay.js +76 -0
- package/dist/shared/{components-gz8zf3ec.js → components-ta4e10mx.js} +16 -43
- package/dist/shared/components-tcyz2tdn.js +31 -0
- package/dist/shared/components-twyj2y8c.js +336 -0
- package/dist/shared/{components-men63rwj.js → components-tz0axc0f.js} +4 -2
- package/dist/shared/components-v2j3jx89.js +7 -0
- package/dist/shared/components-vcte8p75.js +71 -0
- package/dist/shared/components-vfreweq3.js +210 -0
- package/dist/shared/components-vpkh6j83.js +42 -0
- package/dist/shared/{components-5xc2j8jz.js → components-w1ysefg1.js} +27 -18
- package/dist/shared/components-w2at9ntm.js +113 -0
- package/dist/shared/{components-0q0sqfh4.js → components-wq9hrera.js} +48 -49
- package/dist/shared/{components-n7mjr357.js → components-wwd093xg.js} +4 -2
- package/dist/shared/{components-5vgpnxgy.js → components-wx1dcp2n.js} +36 -52
- package/dist/shared/components-xa9fvd5b.js +302 -0
- package/dist/shared/components-xnkc892z.js +340 -0
- package/dist/shared/{components-ezxhrmer.js → components-xnp09586.js} +9 -1
- package/dist/shared/components-y09nr7fe.js +30 -0
- package/dist/shared/{components-11da9ajg.js → components-y4gsk1jt.js} +12 -8
- package/dist/shared/components-y8m64zdw.js +561 -0
- package/dist/shared/components-yf2gtq68.js +302 -0
- package/dist/shared/components-ymq8tbq9.js +88 -0
- package/dist/shared/components-ywgqahmg.js +80 -0
- package/dist/shared/{components-chacnk61.js → components-z0kz9rxj.js} +20 -19
- package/dist/shared/components-znspksk0.js +41 -0
- package/dist/styles.css +493 -147
- package/dist/tailwind.css +42 -0
- package/dist/tokens.css +91 -6
- package/docs/chrome.css +175 -0
- package/docs/chrome.tsx +314 -0
- package/docs/index.ts +8 -0
- package/docs/vite.ts +123 -0
- package/index.ts +93 -0
- package/lib/date-locale.ts +204 -0
- package/lib/date-mask.ts +146 -0
- package/lib/field-box.ts +117 -0
- package/lib/field-classes.ts +106 -0
- package/lib/fluid-hover-highlight.tsx +94 -0
- package/lib/focus-ring.tsx +49 -0
- package/lib/goo-indicator.tsx +263 -0
- package/lib/icon-context.tsx +302 -0
- package/lib/merge-refs.ts +29 -0
- package/lib/morph-layers.tsx +104 -0
- package/lib/morph-part.tsx +51 -0
- package/lib/overlay.tsx +118 -0
- package/lib/popup-rows.tsx +149 -0
- package/lib/popup-surface.tsx +52 -0
- package/lib/popup.ts +53 -0
- package/lib/rect.ts +48 -0
- package/lib/reduced-motion.ts +21 -0
- package/lib/row-group.tsx +113 -0
- package/lib/row-index.tsx +36 -0
- package/lib/row-order.tsx +111 -0
- package/lib/scroll-column.tsx +246 -0
- package/lib/shape-classes.ts +56 -0
- package/lib/shape-context.tsx +77 -0
- package/lib/size-context.tsx +53 -0
- package/lib/size-scale.ts +109 -0
- package/lib/slot.tsx +137 -0
- package/lib/spinner-glyph.tsx +27 -0
- package/lib/springs.ts +61 -0
- package/lib/surface-classes.ts +53 -0
- package/lib/surface-context.tsx +26 -0
- package/lib/use-autosize-textarea.ts +64 -0
- package/lib/use-controllable-state.ts +59 -0
- package/lib/use-fluid-hover.ts +539 -0
- package/lib/use-is-mobile.ts +25 -0
- package/lib/use-iso-layout-effect.ts +14 -0
- package/lib/use-keyboard-nav-gate.ts +44 -0
- package/lib/use-merge-split.tsx +199 -0
- package/lib/use-morph.ts +533 -0
- package/lib/use-touch-primary.tsx +43 -0
- package/lib/utils.ts +30 -0
- package/lib/weight-label.tsx +69 -0
- package/package.json +255 -7
- package/primitives/content/code/examples.mdx +27 -0
- package/primitives/content/code/index.tsx +82 -0
- package/primitives/content/skeleton/examples.mdx +51 -0
- package/primitives/content/skeleton/index.tsx +86 -0
- package/primitives/content/skeleton/skeleton.css +20 -0
- package/primitives/layout/resizable/examples.mdx +93 -0
- package/primitives/layout/resizable/index.tsx +332 -0
- package/primitives/layout/scroll-area/examples.mdx +58 -0
- package/primitives/layout/scroll-area/index.tsx +179 -0
- package/primitives/layout/separator/examples.mdx +30 -0
- package/primitives/layout/separator/index.tsx +54 -0
- package/primitives/layout/sortable/examples.mdx +53 -0
- package/primitives/layout/sortable/index.tsx +351 -0
- package/primitives/layout/virtual-list/examples.mdx +45 -0
- package/primitives/layout/virtual-list/index.tsx +269 -0
- package/primitives/layout/virtual-list/jump-demo.tsx +53 -0
- package/primitives/systems/craft/demos.tsx +175 -0
- package/primitives/systems/craft/examples.mdx +140 -0
- package/primitives/systems/craft/index.tsx +79 -0
- package/primitives/systems/fluid-hover/examples.mdx +84 -0
- package/primitives/systems/fluid-hover/index.tsx +281 -0
- package/primitives/systems/morph/examples.mdx +136 -0
- package/primitives/systems/morph/index.tsx +199 -0
- package/primitives/systems/motion/examples.mdx +100 -0
- package/primitives/systems/motion/index.tsx +144 -0
- package/primitives/systems/sizes/examples.mdx +167 -0
- package/primitives/systems/sizes/index.tsx +75 -0
- package/primitives/systems/surface/examples.mdx +173 -0
- package/primitives/systems/surface/index.tsx +84 -0
- package/primitives/systems/surface/surface.css +176 -0
- package/tokens/colors.css +234 -0
- package/tokens/motion.css +40 -0
- package/tokens/radius.css +24 -0
- package/tokens/spacing.css +9 -0
- package/tokens/typography.css +119 -0
- package/dist/components/AI/input-message/index.d.ts +0 -125
- package/dist/components/AI/input-message/index.js +0 -25
- package/dist/components/AI/thinking-indicator/index.d.ts +0 -32
- package/dist/components/AI/thinking-indicator/index.js +0 -13
- package/dist/components/accordion/index.d.ts +0 -117
- package/dist/components/accordion/index.js +0 -28
- package/dist/components/badge/index.js +0 -16
- package/dist/components/button/index.d.ts +0 -59
- package/dist/components/button/index.js +0 -14
- package/dist/components/card/index.d.ts +0 -141
- package/dist/components/card/index.js +0 -42
- package/dist/components/copy/index.d.ts +0 -44
- package/dist/components/copy/index.js +0 -16
- package/dist/components/navigation/tabs-subtle/index.d.ts +0 -73
- package/dist/components/navigation/tabs-subtle/index.js +0 -21
- package/dist/components/table/index.d.ts +0 -44
- package/dist/components/table/index.js +0 -26
- package/dist/primitives/code/index.js +0 -11
- package/dist/primitives/craft/index.js +0 -11
- package/dist/primitives/fluid-hover/index.js +0 -25
- package/dist/primitives/morph/index.js +0 -19
- package/dist/primitives/motion/index.js +0 -19
- package/dist/primitives/scroll-area/index.js +0 -12
- package/dist/primitives/surface/index.js +0 -17
- package/dist/shared/components-0sn7ypjw.js +0 -61
- package/dist/shared/components-1434p1mh.js +0 -123
- package/dist/shared/components-27nnvrwe.js +0 -152
- package/dist/shared/components-2ecg8svx.js +0 -496
- package/dist/shared/components-2ph6t61s.js +0 -215
- package/dist/shared/components-3ky44908.js +0 -9
- package/dist/shared/components-3mkepka5.js +0 -111
- package/dist/shared/components-6p8tfcd6.js +0 -122
- package/dist/shared/components-b3c5et5b.js +0 -667
- package/dist/shared/components-d6xtjht3.js +0 -981
- package/dist/shared/components-dk0gjr5a.js +0 -304
- package/dist/shared/components-gc5vtq2f.js +0 -149
- package/dist/shared/components-gf5s6ap9.js +0 -42
- package/dist/shared/components-h2ajmhwn.js +0 -183
- package/dist/shared/components-hw9yk32z.js +0 -288
- package/dist/shared/components-hyq23phv.js +0 -310
- package/dist/shared/components-jbbmdr74.js +0 -484
- package/dist/shared/components-jjw69c4c.js +0 -28
- package/dist/shared/components-jthe1pwb.js +0 -1759
- package/dist/shared/components-kwa6mrf9.js +0 -89
- package/dist/shared/components-n42c79bz.js +0 -445
- package/dist/shared/components-ng72k97e.js +0 -128
- package/dist/shared/components-pbmqctfa.js +0 -300
- package/dist/shared/components-raknhppb.js +0 -64
- package/dist/shared/components-rr7a6ja9.js +0 -160
- package/dist/shared/components-s5ngg32c.js +0 -267
- package/dist/shared/components-sn1rxx1d.js +0 -143
- package/dist/shared/components-vynjtrk6.js +0 -19
- package/dist/shared/components-w1r67ag9.js +0 -717
- package/dist/shared/components-wy9jpqny.js +0 -146
- package/dist/shared/components-ypp01w3p.js +0 -986
- package/dist/shared/components-zfnmn5d4.js +0 -220
- /package/dist/primitives/{code → content/code}/index.d.ts +0 -0
|
@@ -0,0 +1,1486 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
useShape2
|
|
5
|
+
} from "./components-kxpcj2ry.js";
|
|
6
|
+
import {
|
|
7
|
+
surfaceClasses2
|
|
8
|
+
} from "./components-ceyn28cf.js";
|
|
9
|
+
import {
|
|
10
|
+
useSurface2,
|
|
11
|
+
SurfaceProvider2
|
|
12
|
+
} from "./components-nwa2a9tq.js";
|
|
13
|
+
import {
|
|
14
|
+
useControllableState2
|
|
15
|
+
} from "./components-wwd093xg.js";
|
|
16
|
+
import {
|
|
17
|
+
cn2
|
|
18
|
+
} from "./components-xnp09586.js";
|
|
19
|
+
import {
|
|
20
|
+
useSize2
|
|
21
|
+
} from "./components-znspksk0.js";
|
|
22
|
+
import {
|
|
23
|
+
SizeScope2
|
|
24
|
+
} from "./components-nz14rwtd.js";
|
|
25
|
+
import {
|
|
26
|
+
mergeRefs2
|
|
27
|
+
} from "./components-bkwjvvkh.js";
|
|
28
|
+
import {
|
|
29
|
+
spring2
|
|
30
|
+
} from "./components-45r18egt.js";
|
|
31
|
+
import {
|
|
32
|
+
Slider2
|
|
33
|
+
} from "./components-p32aqk3q.js";
|
|
34
|
+
import {
|
|
35
|
+
useMorph2
|
|
36
|
+
} from "./components-8pnvkrbw.js";
|
|
37
|
+
import {
|
|
38
|
+
FluidHoverHighlight2
|
|
39
|
+
} from "./components-g35n8tzm.js";
|
|
40
|
+
import {
|
|
41
|
+
FocusRing2
|
|
42
|
+
} from "./components-c515d6xr.js";
|
|
43
|
+
import {
|
|
44
|
+
useIcon2
|
|
45
|
+
} from "./components-jnhpgpfk.js";
|
|
46
|
+
import {
|
|
47
|
+
OverlayContext2,
|
|
48
|
+
useOverlayRoot2,
|
|
49
|
+
useOverlay2,
|
|
50
|
+
positionerProps2,
|
|
51
|
+
PortalContainer2,
|
|
52
|
+
usePortalContainer2
|
|
53
|
+
} from "./components-rgng034x.js";
|
|
54
|
+
import {
|
|
55
|
+
POPUP_SHAPE2
|
|
56
|
+
} from "./components-mse06t0x.js";
|
|
57
|
+
import {
|
|
58
|
+
PopupSurface2
|
|
59
|
+
} from "./components-nxqrw789.js";
|
|
60
|
+
import {
|
|
61
|
+
useRowFocus2
|
|
62
|
+
} from "./components-vcte8p75.js";
|
|
63
|
+
import {
|
|
64
|
+
useFluidHover2,
|
|
65
|
+
useRegisterFluidHoverItem2
|
|
66
|
+
} from "./components-7c4a0egq.js";
|
|
67
|
+
import {
|
|
68
|
+
WeightLabel2
|
|
69
|
+
} from "./components-y09nr7fe.js";
|
|
70
|
+
import {
|
|
71
|
+
Tooltip2
|
|
72
|
+
} from "./components-1bnf96sr.js";
|
|
73
|
+
import {
|
|
74
|
+
clamp012,
|
|
75
|
+
hsvToRgb2,
|
|
76
|
+
rgbToHsv2,
|
|
77
|
+
rgbToHsl2,
|
|
78
|
+
hslToRgb2,
|
|
79
|
+
rgbToOklch2,
|
|
80
|
+
oklchToRgb2,
|
|
81
|
+
rgbToHexStr2,
|
|
82
|
+
parseColor2,
|
|
83
|
+
resolveCssColor2,
|
|
84
|
+
buildParsed2,
|
|
85
|
+
formatValueByFormat2
|
|
86
|
+
} from "./components-pa2t12j2.js";
|
|
87
|
+
import {
|
|
88
|
+
useFieldBox2
|
|
89
|
+
} from "./components-1ztgy933.js";
|
|
90
|
+
|
|
91
|
+
// components/inputs/color-picker/index.tsx
|
|
92
|
+
import {
|
|
93
|
+
forwardRef as forwardRef4,
|
|
94
|
+
useCallback as useCallback4,
|
|
95
|
+
useContext as useContext2,
|
|
96
|
+
useEffect as useEffect4,
|
|
97
|
+
useMemo as useMemo5,
|
|
98
|
+
useRef as useRef5,
|
|
99
|
+
useState as useState4
|
|
100
|
+
} from "react";
|
|
101
|
+
|
|
102
|
+
// components/inputs/color-picker/channel-sliders.tsx
|
|
103
|
+
import { jsx } from "react/jsx-runtime";
|
|
104
|
+
/*!
|
|
105
|
+
* Part of the ColorPicker port (Fluid Functionalism `registry/default/color-picker.tsx` @ b3587bdbd83fc66c2a6aae3817ffb856cb09260b,
|
|
106
|
+
* MIT License © 2026 Micka Touillaud). Local changes: see PORTING.md.
|
|
107
|
+
*/
|
|
108
|
+
function HueSlider({ h, onChange }) {
|
|
109
|
+
const hueColor = `hsl(${h}, 100%, 50%)`;
|
|
110
|
+
return /* @__PURE__ */ jsx(Slider2, {
|
|
111
|
+
value: h,
|
|
112
|
+
onValueChange: (v) => onChange(typeof v === "number" ? v : v[0] ?? 0),
|
|
113
|
+
min: 0,
|
|
114
|
+
max: 360,
|
|
115
|
+
step: 1,
|
|
116
|
+
showValue: false,
|
|
117
|
+
hideFill: true,
|
|
118
|
+
thumbColor: hueColor,
|
|
119
|
+
thumbBorderColor: "var(--picker-thumb-border)",
|
|
120
|
+
trackStyle: {
|
|
121
|
+
background: "linear-gradient(to right, hsl(0,100%,50%), hsl(60,100%,50%), hsl(120,100%,50%), hsl(180,100%,50%), hsl(240,100%,50%), hsl(300,100%,50%), hsl(360,100%,50%))",
|
|
122
|
+
borderColor: "transparent"
|
|
123
|
+
},
|
|
124
|
+
"aria-label": "Hue"
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
function AlphaSlider({
|
|
128
|
+
a,
|
|
129
|
+
solidColor,
|
|
130
|
+
solidR,
|
|
131
|
+
solidG,
|
|
132
|
+
solidB,
|
|
133
|
+
onChange
|
|
134
|
+
}) {
|
|
135
|
+
const transparentColor = `rgba(${solidR}, ${solidG}, ${solidB}, 0)`;
|
|
136
|
+
return /* @__PURE__ */ jsx(Slider2, {
|
|
137
|
+
value: Math.round(a * 100),
|
|
138
|
+
onValueChange: (v) => onChange((typeof v === "number" ? v : v[0] ?? 0) / 100),
|
|
139
|
+
min: 0,
|
|
140
|
+
max: 100,
|
|
141
|
+
step: 1,
|
|
142
|
+
showValue: false,
|
|
143
|
+
hideFill: true,
|
|
144
|
+
thumbColor: solidColor,
|
|
145
|
+
thumbBorderColor: "var(--picker-thumb-border)",
|
|
146
|
+
trackStyle: {
|
|
147
|
+
backgroundImage: `linear-gradient(to right, ${transparentColor} 0%, ${solidColor} 98%), conic-gradient(var(--checker-a) 0 25%, var(--checker-b) 0 50%, var(--checker-a) 0 75%, var(--checker-b) 0)`,
|
|
148
|
+
backgroundSize: "100% 100%, 8px 8px",
|
|
149
|
+
borderWidth: 0
|
|
150
|
+
},
|
|
151
|
+
"aria-label": "Alpha"
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// components/inputs/color-picker/context.ts
|
|
156
|
+
import { createContext } from "react";
|
|
157
|
+
var PanelSurfaceContext = createContext(true);
|
|
158
|
+
|
|
159
|
+
// components/inputs/color-picker/format-menu.tsx
|
|
160
|
+
import { Menu } from "@base-ui/react/menu";
|
|
161
|
+
import { AnimatePresence, motion } from "motion/react";
|
|
162
|
+
import { createContext as createContext2, useContext, useEffect, useMemo, useRef } from "react";
|
|
163
|
+
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
164
|
+
/*!
|
|
165
|
+
* Part of the ColorPicker port (Fluid Functionalism `registry/default/color-picker.tsx` @ b3587bdbd83fc66c2a6aae3817ffb856cb09260b,
|
|
166
|
+
* MIT License © 2026 Micka Touillaud). Local changes: see PORTING.md.
|
|
167
|
+
*/
|
|
168
|
+
var FORMAT_LABELS = {
|
|
169
|
+
hex: "HEX",
|
|
170
|
+
rgb: "RGB",
|
|
171
|
+
hsl: "HSL",
|
|
172
|
+
oklch: "OKLCH"
|
|
173
|
+
};
|
|
174
|
+
var FORMATS = ["hex", "rgb", "hsl", "oklch"];
|
|
175
|
+
var FormatMenuContext = createContext2(null);
|
|
176
|
+
function FormatItem({
|
|
177
|
+
index,
|
|
178
|
+
value,
|
|
179
|
+
label,
|
|
180
|
+
checked
|
|
181
|
+
}) {
|
|
182
|
+
const ref = useRef(null);
|
|
183
|
+
const menuCtx = useContext(FormatMenuContext);
|
|
184
|
+
const shape = useShape2();
|
|
185
|
+
const sizeClasses = useSize2();
|
|
186
|
+
const compact = sizeClasses.variant === "compact";
|
|
187
|
+
useRegisterFluidHoverItem2(menuCtx?.registerItem, index, ref);
|
|
188
|
+
const isActive = menuCtx?.activeIndex === index;
|
|
189
|
+
return /* @__PURE__ */ jsx2(Menu.RadioItem, {
|
|
190
|
+
value,
|
|
191
|
+
label,
|
|
192
|
+
closeOnClick: true,
|
|
193
|
+
render: /* @__PURE__ */ jsx2("div", {
|
|
194
|
+
ref,
|
|
195
|
+
"data-fluid-hover-index": index,
|
|
196
|
+
className: cn2("relative z-10 flex items-center cursor-pointer outline-none", compact ? "px-2.5 py-1.5" : "px-3 py-2", sizeClasses.text, shape.item)
|
|
197
|
+
}),
|
|
198
|
+
children: /* @__PURE__ */ jsx2(WeightLabel2, {
|
|
199
|
+
emphasized: checked,
|
|
200
|
+
lit: isActive || checked,
|
|
201
|
+
children: label
|
|
202
|
+
})
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
function FormatMenu({ value, onValueChange, open, defaultOpen, onOpenChange }) {
|
|
206
|
+
const root = useOverlayRoot2({ open, defaultOpen, onOpenChange });
|
|
207
|
+
const shape = useShape2();
|
|
208
|
+
const sizeClasses = useSize2();
|
|
209
|
+
const ChevronDownIcon = useIcon2("chevron-down");
|
|
210
|
+
return /* @__PURE__ */ jsx2(OverlayContext2.Provider, {
|
|
211
|
+
value: root.state,
|
|
212
|
+
children: /* @__PURE__ */ jsxs(Menu.Root, {
|
|
213
|
+
open: root.open,
|
|
214
|
+
onOpenChange: root.onOpenChange,
|
|
215
|
+
modal: false,
|
|
216
|
+
children: [
|
|
217
|
+
/* @__PURE__ */ jsxs(Menu.Trigger, {
|
|
218
|
+
className: cn2("flex items-center justify-between bg-transparent hover:bg-hover hover:text-foreground transition-colors duration-fast outline-none focus-visible:ring-1 focus-visible:ring-focus-ring cursor-pointer", sizeClasses.gap, sizeClasses.control, sizeClasses.px, sizeClasses.text, root.open ? "bg-active text-foreground" : "text-muted-foreground active:bg-active", shape.input, "weight-medium"),
|
|
219
|
+
children: [
|
|
220
|
+
/* @__PURE__ */ jsx2("span", {
|
|
221
|
+
children: FORMAT_LABELS[value]
|
|
222
|
+
}),
|
|
223
|
+
/* @__PURE__ */ jsx2(ChevronDownIcon, {
|
|
224
|
+
size: 14,
|
|
225
|
+
strokeWidth: 1.5,
|
|
226
|
+
className: cn2("text-muted-foreground transition-transform duration-150", root.open && "rotate-180")
|
|
227
|
+
})
|
|
228
|
+
]
|
|
229
|
+
}),
|
|
230
|
+
/* @__PURE__ */ jsx2(FormatPopup, {
|
|
231
|
+
value,
|
|
232
|
+
onValueChange
|
|
233
|
+
})
|
|
234
|
+
]
|
|
235
|
+
})
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
function FormatPopup({ value, onValueChange }) {
|
|
239
|
+
const { open, origin } = useOverlay2("FormatMenu");
|
|
240
|
+
const morph = useMorph2(open, origin, { tier: "moderate" });
|
|
241
|
+
const containerRef = useRef(null);
|
|
242
|
+
const hover = useFluidHover2(containerRef);
|
|
243
|
+
const { activeIndex, itemRects, handlers, registerItem, remeasure } = hover;
|
|
244
|
+
const rowFocus = useRowFocus2(hover);
|
|
245
|
+
useEffect(() => {
|
|
246
|
+
if (!open)
|
|
247
|
+
return;
|
|
248
|
+
remeasure();
|
|
249
|
+
}, [open, remeasure]);
|
|
250
|
+
const checkedIndex = FORMATS.indexOf(value);
|
|
251
|
+
const checkedRect = checkedIndex !== -1 ? itemRects[checkedIndex] ?? null : null;
|
|
252
|
+
const menuCtx = useMemo(() => ({ registerItem, activeIndex }), [registerItem, activeIndex]);
|
|
253
|
+
return /* @__PURE__ */ jsx2(Menu.Portal, {
|
|
254
|
+
container: usePortalContainer2(),
|
|
255
|
+
children: /* @__PURE__ */ jsx2(Menu.Positioner, {
|
|
256
|
+
side: "bottom",
|
|
257
|
+
align: "start",
|
|
258
|
+
sideOffset: 6,
|
|
259
|
+
className: "z-[60] outline-none",
|
|
260
|
+
children: /* @__PURE__ */ jsx2(FormatMenuContext.Provider, {
|
|
261
|
+
value: menuCtx,
|
|
262
|
+
children: /* @__PURE__ */ jsx2(Menu.Popup, {
|
|
263
|
+
ref: morph.popupRef,
|
|
264
|
+
onMouseEnter: () => {
|
|
265
|
+
handlers.onMouseEnter();
|
|
266
|
+
rowFocus.setFocusedIndex(null);
|
|
267
|
+
},
|
|
268
|
+
onMouseMove: handlers.onMouseMove,
|
|
269
|
+
onMouseLeave: handlers.onMouseLeave,
|
|
270
|
+
onClick: handlers.onClick,
|
|
271
|
+
...rowFocus.handlers,
|
|
272
|
+
className: "relative select-none outline-none",
|
|
273
|
+
children: /* @__PURE__ */ jsx2(PopupSurface2, {
|
|
274
|
+
morph,
|
|
275
|
+
radius: POPUP_SHAPE2.container,
|
|
276
|
+
className: "min-w-[var(--anchor-width)]",
|
|
277
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
278
|
+
ref: containerRef,
|
|
279
|
+
className: "relative flex flex-col p-1",
|
|
280
|
+
children: [
|
|
281
|
+
/* @__PURE__ */ jsx2(AnimatePresence, {
|
|
282
|
+
children: checkedRect && /* @__PURE__ */ jsx2(motion.div, {
|
|
283
|
+
className: `absolute ${POPUP_SHAPE2.bg} bg-active pointer-events-none`,
|
|
284
|
+
initial: false,
|
|
285
|
+
animate: {
|
|
286
|
+
top: checkedRect.top,
|
|
287
|
+
left: checkedRect.left,
|
|
288
|
+
width: checkedRect.width,
|
|
289
|
+
height: checkedRect.height,
|
|
290
|
+
opacity: 1
|
|
291
|
+
},
|
|
292
|
+
exit: { opacity: 0, transition: spring2.moderate.exit },
|
|
293
|
+
transition: {
|
|
294
|
+
...spring2.moderate,
|
|
295
|
+
opacity: { duration: spring2.fast.duration }
|
|
296
|
+
}
|
|
297
|
+
})
|
|
298
|
+
}),
|
|
299
|
+
/* @__PURE__ */ jsx2(FluidHoverHighlight2, {
|
|
300
|
+
hover,
|
|
301
|
+
from: checkedRect,
|
|
302
|
+
className: POPUP_SHAPE2.bg
|
|
303
|
+
}),
|
|
304
|
+
/* @__PURE__ */ jsx2(FocusRing2, {
|
|
305
|
+
rect: rowFocus.focusRect,
|
|
306
|
+
className: POPUP_SHAPE2.focusRing
|
|
307
|
+
}),
|
|
308
|
+
/* @__PURE__ */ jsx2(Menu.RadioGroup, {
|
|
309
|
+
value,
|
|
310
|
+
onValueChange: (next) => onValueChange(next),
|
|
311
|
+
className: "contents",
|
|
312
|
+
children: FORMATS.map((fmt, i) => /* @__PURE__ */ jsx2(FormatItem, {
|
|
313
|
+
index: i,
|
|
314
|
+
value: fmt,
|
|
315
|
+
label: FORMAT_LABELS[fmt],
|
|
316
|
+
checked: value === fmt
|
|
317
|
+
}, fmt))
|
|
318
|
+
})
|
|
319
|
+
]
|
|
320
|
+
})
|
|
321
|
+
})
|
|
322
|
+
})
|
|
323
|
+
})
|
|
324
|
+
})
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
// components/inputs/color-picker/color-input.tsx
|
|
329
|
+
import { NumberField } from "@base-ui/react/number-field";
|
|
330
|
+
import { forwardRef, useCallback, useEffect as useEffect2, useMemo as useMemo2, useRef as useRef2, useState } from "react";
|
|
331
|
+
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
332
|
+
/*!
|
|
333
|
+
* Part of the ColorPicker port (Fluid Functionalism `registry/default/color-picker.tsx` @ b3587bdbd83fc66c2a6aae3817ffb856cb09260b,
|
|
334
|
+
* MIT License © 2026 Micka Touillaud). Local changes: see PORTING.md.
|
|
335
|
+
*/
|
|
336
|
+
var TextColorInput = forwardRef(({
|
|
337
|
+
value,
|
|
338
|
+
onCommit,
|
|
339
|
+
ariaLabel,
|
|
340
|
+
width,
|
|
341
|
+
className,
|
|
342
|
+
inputClassName,
|
|
343
|
+
align = "left",
|
|
344
|
+
prefix,
|
|
345
|
+
inputMode = "text",
|
|
346
|
+
nudgeStep,
|
|
347
|
+
nudgeShiftStep,
|
|
348
|
+
hasPercent = false,
|
|
349
|
+
decimals,
|
|
350
|
+
min,
|
|
351
|
+
max,
|
|
352
|
+
wrap = false
|
|
353
|
+
}, ref) => {
|
|
354
|
+
const [draft, setDraft] = useState(value);
|
|
355
|
+
const interactingRef = useRef2(false);
|
|
356
|
+
const shape = useShape2();
|
|
357
|
+
const sizeClasses = useSize2();
|
|
358
|
+
const compact = sizeClasses.variant === "compact";
|
|
359
|
+
useEffect2(() => {
|
|
360
|
+
if (!interactingRef.current)
|
|
361
|
+
setDraft(value);
|
|
362
|
+
}, [value]);
|
|
363
|
+
const formatNumber = (n) => decimals != null ? n.toFixed(decimals) : String(Math.round(n));
|
|
364
|
+
const commitNumber = (n) => {
|
|
365
|
+
let bounded = n;
|
|
366
|
+
if (wrap && min != null && max != null) {
|
|
367
|
+
const range = max - min;
|
|
368
|
+
bounded = ((bounded - min) % range + range) % range + min;
|
|
369
|
+
} else {
|
|
370
|
+
if (min != null)
|
|
371
|
+
bounded = Math.max(min, bounded);
|
|
372
|
+
if (max != null)
|
|
373
|
+
bounded = Math.min(max, bounded);
|
|
374
|
+
}
|
|
375
|
+
const formatted = formatNumber(bounded);
|
|
376
|
+
const withSuffix = hasPercent ? `${formatted}%` : formatted;
|
|
377
|
+
setDraft(withSuffix);
|
|
378
|
+
onCommit(withSuffix);
|
|
379
|
+
};
|
|
380
|
+
const nudge = (direction, shift) => {
|
|
381
|
+
const baseStep = shift ? nudgeShiftStep ?? 10 : nudgeStep ?? 1;
|
|
382
|
+
const cur = parseFloat(draft.replace("%", ""));
|
|
383
|
+
if (Number.isNaN(cur))
|
|
384
|
+
return;
|
|
385
|
+
commitNumber(cur + direction * baseStep);
|
|
386
|
+
};
|
|
387
|
+
return /* @__PURE__ */ jsxs2("div", {
|
|
388
|
+
className: cn2("flex items-center px-2 bg-transparent hover:bg-hover active:bg-active transition-colors duration-fast focus-within:ring-1 focus-within:ring-focus-ring select-none", sizeClasses.control, shape.input, className),
|
|
389
|
+
style: { width },
|
|
390
|
+
children: [
|
|
391
|
+
prefix && /* @__PURE__ */ jsx3("span", {
|
|
392
|
+
className: cn2("text-muted-foreground mr-1 select-none", compact ? "text-caption-compact" : "text-caption"),
|
|
393
|
+
children: prefix
|
|
394
|
+
}),
|
|
395
|
+
/* @__PURE__ */ jsx3("input", {
|
|
396
|
+
ref,
|
|
397
|
+
value: draft,
|
|
398
|
+
onChange: (e) => setDraft(e.target.value),
|
|
399
|
+
onFocus: (e) => {
|
|
400
|
+
interactingRef.current = true;
|
|
401
|
+
e.currentTarget.select();
|
|
402
|
+
},
|
|
403
|
+
onBlur: () => {
|
|
404
|
+
interactingRef.current = false;
|
|
405
|
+
if (draft !== value) {
|
|
406
|
+
const numeric = parseFloat(draft.replace("%", ""));
|
|
407
|
+
if (!Number.isNaN(numeric) && (min != null || max != null)) {
|
|
408
|
+
commitNumber(numeric);
|
|
409
|
+
} else {
|
|
410
|
+
onCommit(draft);
|
|
411
|
+
}
|
|
412
|
+
} else
|
|
413
|
+
setDraft(value);
|
|
414
|
+
},
|
|
415
|
+
onKeyDown: (e) => {
|
|
416
|
+
if (e.key === "Enter") {
|
|
417
|
+
e.currentTarget.blur();
|
|
418
|
+
} else if (e.key === "Escape") {
|
|
419
|
+
setDraft(value);
|
|
420
|
+
e.currentTarget.blur();
|
|
421
|
+
} else if ((nudgeStep != null || nudgeShiftStep != null) && (e.key === "ArrowUp" || e.key === "ArrowDown")) {
|
|
422
|
+
e.preventDefault();
|
|
423
|
+
nudge(e.key === "ArrowUp" ? 1 : -1, e.shiftKey);
|
|
424
|
+
}
|
|
425
|
+
},
|
|
426
|
+
inputMode,
|
|
427
|
+
"aria-label": ariaLabel,
|
|
428
|
+
className: cn2("flex-1 min-w-0 bg-transparent text-foreground outline-none tabular-nums", sizeClasses.text, align === "center" && "text-center", align === "right" && "text-right", "weight-medium", inputClassName)
|
|
429
|
+
})
|
|
430
|
+
]
|
|
431
|
+
});
|
|
432
|
+
});
|
|
433
|
+
TextColorInput.displayName = "TextColorInput";
|
|
434
|
+
var ScrubColorInput = forwardRef(({
|
|
435
|
+
value,
|
|
436
|
+
onCommit,
|
|
437
|
+
ariaLabel,
|
|
438
|
+
width,
|
|
439
|
+
className,
|
|
440
|
+
inputClassName,
|
|
441
|
+
align = "left",
|
|
442
|
+
prefix,
|
|
443
|
+
inputMode = "numeric",
|
|
444
|
+
nudgeStep,
|
|
445
|
+
nudgeShiftStep,
|
|
446
|
+
hasPercent = false,
|
|
447
|
+
decimals,
|
|
448
|
+
min,
|
|
449
|
+
max,
|
|
450
|
+
wrap = false
|
|
451
|
+
}, ref) => {
|
|
452
|
+
const shape = useShape2();
|
|
453
|
+
const sizeClasses = useSize2();
|
|
454
|
+
const compact = sizeClasses.variant === "compact";
|
|
455
|
+
const inputRef = useRef2(null);
|
|
456
|
+
const [editing, setEditing] = useState(false);
|
|
457
|
+
const pointerDownRef = useRef2(false);
|
|
458
|
+
const numeric = parseFloat(String(value).replace("%", ""));
|
|
459
|
+
const fieldValue = Number.isNaN(numeric) ? null : numeric;
|
|
460
|
+
const format = useMemo2(() => {
|
|
461
|
+
const f = { useGrouping: false };
|
|
462
|
+
if (decimals != null) {
|
|
463
|
+
f.minimumFractionDigits = decimals;
|
|
464
|
+
f.maximumFractionDigits = decimals;
|
|
465
|
+
} else {
|
|
466
|
+
f.maximumFractionDigits = 0;
|
|
467
|
+
}
|
|
468
|
+
if (hasPercent) {
|
|
469
|
+
f.style = "unit";
|
|
470
|
+
f.unit = "percent";
|
|
471
|
+
}
|
|
472
|
+
return f;
|
|
473
|
+
}, [decimals, hasPercent]);
|
|
474
|
+
const commit = useCallback((n) => {
|
|
475
|
+
let bounded = n;
|
|
476
|
+
if (wrap && min != null && max != null) {
|
|
477
|
+
if (bounded < min || bounded > max) {
|
|
478
|
+
const range = max - min;
|
|
479
|
+
bounded = ((bounded - min) % range + range) % range + min;
|
|
480
|
+
}
|
|
481
|
+
} else {
|
|
482
|
+
if (min != null)
|
|
483
|
+
bounded = Math.max(min, bounded);
|
|
484
|
+
if (max != null)
|
|
485
|
+
bounded = Math.min(max, bounded);
|
|
486
|
+
}
|
|
487
|
+
const formatted = decimals != null ? bounded.toFixed(decimals) : String(Math.round(bounded));
|
|
488
|
+
onCommit(hasPercent ? `${formatted}%` : formatted);
|
|
489
|
+
}, [wrap, min, max, decimals, hasPercent, onCommit]);
|
|
490
|
+
return /* @__PURE__ */ jsx3(NumberField.Root, {
|
|
491
|
+
value: fieldValue,
|
|
492
|
+
onValueChange: (next, eventDetails) => {
|
|
493
|
+
if (next == null)
|
|
494
|
+
return;
|
|
495
|
+
const reason = eventDetails.reason;
|
|
496
|
+
if (reason === "input-change" || reason === "input-paste" || reason === "input-clear") {
|
|
497
|
+
return;
|
|
498
|
+
}
|
|
499
|
+
commit(next);
|
|
500
|
+
},
|
|
501
|
+
onValueCommitted: (_, eventDetails) => {
|
|
502
|
+
if (eventDetails.reason === "scrub") {
|
|
503
|
+
pointerDownRef.current = false;
|
|
504
|
+
inputRef.current?.blur();
|
|
505
|
+
}
|
|
506
|
+
},
|
|
507
|
+
min: wrap ? undefined : min,
|
|
508
|
+
max: wrap ? undefined : max,
|
|
509
|
+
step: nudgeStep ?? 1,
|
|
510
|
+
largeStep: nudgeShiftStep ?? 10,
|
|
511
|
+
format,
|
|
512
|
+
className: cn2("flex items-center bg-transparent hover:bg-hover active:bg-active transition-colors duration-fast focus-within:ring-1 focus-within:ring-focus-ring select-none", sizeClasses.control, shape.input, className),
|
|
513
|
+
style: { width },
|
|
514
|
+
children: /* @__PURE__ */ jsxs2(NumberField.ScrubArea, {
|
|
515
|
+
direction: "horizontal",
|
|
516
|
+
pixelSensitivity: 1,
|
|
517
|
+
onPointerDownCapture: () => {
|
|
518
|
+
pointerDownRef.current = true;
|
|
519
|
+
},
|
|
520
|
+
onClick: () => {
|
|
521
|
+
pointerDownRef.current = false;
|
|
522
|
+
setEditing(true);
|
|
523
|
+
inputRef.current?.focus();
|
|
524
|
+
inputRef.current?.select();
|
|
525
|
+
},
|
|
526
|
+
className: cn2("flex flex-1 min-w-0 items-center self-stretch px-2", !editing && "cursor-ew-resize"),
|
|
527
|
+
children: [
|
|
528
|
+
/* @__PURE__ */ jsx3(NumberField.ScrubAreaCursor, {
|
|
529
|
+
className: "drop-shadow-picker-cursor",
|
|
530
|
+
children: /* @__PURE__ */ jsx3("svg", {
|
|
531
|
+
width: 24,
|
|
532
|
+
height: 14,
|
|
533
|
+
viewBox: "0 0 24 14",
|
|
534
|
+
className: "fill-picker-edge stroke-thumb",
|
|
535
|
+
strokeWidth: 1,
|
|
536
|
+
"aria-hidden": "true",
|
|
537
|
+
children: /* @__PURE__ */ jsx3("path", {
|
|
538
|
+
d: "M0.5 7l5-5v3.5h13V2l5 5-5 5V8.5h-13V12l-5-5z"
|
|
539
|
+
})
|
|
540
|
+
})
|
|
541
|
+
}),
|
|
542
|
+
prefix && /* @__PURE__ */ jsx3("span", {
|
|
543
|
+
className: cn2("text-muted-foreground mr-1 select-none", compact ? "text-caption-compact" : "text-caption"),
|
|
544
|
+
children: prefix
|
|
545
|
+
}),
|
|
546
|
+
/* @__PURE__ */ jsx3(NumberField.Input, {
|
|
547
|
+
ref: mergeRefs2(inputRef, ref),
|
|
548
|
+
"aria-label": ariaLabel,
|
|
549
|
+
inputMode,
|
|
550
|
+
onPointerDown: (e) => {
|
|
551
|
+
if (editing)
|
|
552
|
+
e.stopPropagation();
|
|
553
|
+
},
|
|
554
|
+
onFocus: (e) => {
|
|
555
|
+
if (pointerDownRef.current)
|
|
556
|
+
return;
|
|
557
|
+
setEditing(true);
|
|
558
|
+
e.currentTarget.select();
|
|
559
|
+
},
|
|
560
|
+
onBlur: () => {
|
|
561
|
+
setEditing(false);
|
|
562
|
+
},
|
|
563
|
+
onKeyDown: (e) => {
|
|
564
|
+
if (e.key === "Enter") {
|
|
565
|
+
e.currentTarget.blur();
|
|
566
|
+
} else if (e.key === "Escape") {
|
|
567
|
+
const input = e.currentTarget;
|
|
568
|
+
const setter = Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, "value")?.set;
|
|
569
|
+
if (setter && fieldValue != null) {
|
|
570
|
+
const restored = decimals != null ? fieldValue.toFixed(decimals) : String(Math.round(fieldValue));
|
|
571
|
+
setter.call(input, hasPercent ? `${restored}%` : restored);
|
|
572
|
+
input.dispatchEvent(new Event("input", { bubbles: true }));
|
|
573
|
+
}
|
|
574
|
+
input.blur();
|
|
575
|
+
}
|
|
576
|
+
},
|
|
577
|
+
className: cn2("flex-1 min-w-0 bg-transparent text-foreground outline-none tabular-nums", sizeClasses.text, align === "center" && "text-center", align === "right" && "text-right", !editing && "pointer-events-none", "weight-medium", inputClassName)
|
|
578
|
+
})
|
|
579
|
+
]
|
|
580
|
+
})
|
|
581
|
+
});
|
|
582
|
+
});
|
|
583
|
+
ScrubColorInput.displayName = "ScrubColorInput";
|
|
584
|
+
var ColorInput = forwardRef(({ scrubbable = false, ...props }, ref) => scrubbable ? /* @__PURE__ */ jsx3(ScrubColorInput, {
|
|
585
|
+
ref,
|
|
586
|
+
...props
|
|
587
|
+
}) : /* @__PURE__ */ jsx3(TextColorInput, {
|
|
588
|
+
ref,
|
|
589
|
+
...props
|
|
590
|
+
}));
|
|
591
|
+
ColorInput.displayName = "ColorInput";
|
|
592
|
+
function ChannelTooltip({ label, children }) {
|
|
593
|
+
return /* @__PURE__ */ jsx3(Tooltip2, {
|
|
594
|
+
content: label,
|
|
595
|
+
delayDuration: 300,
|
|
596
|
+
children: /* @__PURE__ */ jsx3("div", {
|
|
597
|
+
children
|
|
598
|
+
})
|
|
599
|
+
});
|
|
600
|
+
}
|
|
601
|
+
function AlphaInput({ value, onCommit }) {
|
|
602
|
+
return /* @__PURE__ */ jsx3(ChannelTooltip, {
|
|
603
|
+
label: "Alpha",
|
|
604
|
+
children: /* @__PURE__ */ jsx3(ColorInput, {
|
|
605
|
+
value: `${value}%`,
|
|
606
|
+
onCommit: (input) => {
|
|
607
|
+
const n = parseFloat(input.replace("%", ""));
|
|
608
|
+
if (Number.isNaN(n))
|
|
609
|
+
return;
|
|
610
|
+
onCommit(Math.max(0, Math.min(100, Math.round(n))));
|
|
611
|
+
},
|
|
612
|
+
ariaLabel: "Alpha",
|
|
613
|
+
align: "center",
|
|
614
|
+
inputMode: "numeric",
|
|
615
|
+
nudgeStep: 1,
|
|
616
|
+
nudgeShiftStep: 10,
|
|
617
|
+
hasPercent: true,
|
|
618
|
+
scrubbable: true,
|
|
619
|
+
min: 0,
|
|
620
|
+
max: 100
|
|
621
|
+
})
|
|
622
|
+
});
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
// components/inputs/color-picker/inputs-row.tsx
|
|
626
|
+
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
627
|
+
/*!
|
|
628
|
+
* Part of the ColorPicker port (Fluid Functionalism `registry/default/color-picker.tsx` @ b3587bdbd83fc66c2a6aae3817ffb856cb09260b,
|
|
629
|
+
* MIT License © 2026 Micka Touillaud). Local changes: see PORTING.md.
|
|
630
|
+
*/
|
|
631
|
+
function ColorInputsRow({
|
|
632
|
+
parsed,
|
|
633
|
+
format,
|
|
634
|
+
oklchHue,
|
|
635
|
+
onChannelChange
|
|
636
|
+
}) {
|
|
637
|
+
const alphaPct = Math.round(parsed.a * 100);
|
|
638
|
+
if (format === "hex") {
|
|
639
|
+
const hexNoHash = parsed.hex.replace(/^#/, "").toUpperCase();
|
|
640
|
+
return /* @__PURE__ */ jsxs3("div", {
|
|
641
|
+
className: "grid grid-cols-2 gap-2",
|
|
642
|
+
children: [
|
|
643
|
+
/* @__PURE__ */ jsx4(ChannelTooltip, {
|
|
644
|
+
label: "Hex",
|
|
645
|
+
children: /* @__PURE__ */ jsx4(ColorInput, {
|
|
646
|
+
value: hexNoHash,
|
|
647
|
+
onCommit: (next) => onChannelChange("hex", next.startsWith("#") ? next : `#${next}`),
|
|
648
|
+
ariaLabel: "Hex value",
|
|
649
|
+
prefix: "#"
|
|
650
|
+
})
|
|
651
|
+
}),
|
|
652
|
+
/* @__PURE__ */ jsx4(AlphaInput, {
|
|
653
|
+
value: alphaPct,
|
|
654
|
+
onCommit: (n) => onChannelChange("alphaPercent", String(n))
|
|
655
|
+
})
|
|
656
|
+
]
|
|
657
|
+
});
|
|
658
|
+
}
|
|
659
|
+
if (format === "rgb") {
|
|
660
|
+
return /* @__PURE__ */ jsxs3("div", {
|
|
661
|
+
className: "grid grid-cols-4 gap-1",
|
|
662
|
+
children: [
|
|
663
|
+
/* @__PURE__ */ jsx4(ChannelTooltip, {
|
|
664
|
+
label: "Red",
|
|
665
|
+
children: /* @__PURE__ */ jsx4(ColorInput, {
|
|
666
|
+
value: String(parsed.r),
|
|
667
|
+
onCommit: (n) => onChannelChange("r", n),
|
|
668
|
+
ariaLabel: "Red",
|
|
669
|
+
align: "center",
|
|
670
|
+
inputMode: "numeric",
|
|
671
|
+
nudgeStep: 1,
|
|
672
|
+
nudgeShiftStep: 10,
|
|
673
|
+
scrubbable: true,
|
|
674
|
+
min: 0,
|
|
675
|
+
max: 255
|
|
676
|
+
})
|
|
677
|
+
}),
|
|
678
|
+
/* @__PURE__ */ jsx4(ChannelTooltip, {
|
|
679
|
+
label: "Green",
|
|
680
|
+
children: /* @__PURE__ */ jsx4(ColorInput, {
|
|
681
|
+
value: String(parsed.g),
|
|
682
|
+
onCommit: (n) => onChannelChange("g", n),
|
|
683
|
+
ariaLabel: "Green",
|
|
684
|
+
align: "center",
|
|
685
|
+
inputMode: "numeric",
|
|
686
|
+
nudgeStep: 1,
|
|
687
|
+
nudgeShiftStep: 10,
|
|
688
|
+
scrubbable: true,
|
|
689
|
+
min: 0,
|
|
690
|
+
max: 255
|
|
691
|
+
})
|
|
692
|
+
}),
|
|
693
|
+
/* @__PURE__ */ jsx4(ChannelTooltip, {
|
|
694
|
+
label: "Blue",
|
|
695
|
+
children: /* @__PURE__ */ jsx4(ColorInput, {
|
|
696
|
+
value: String(parsed.b),
|
|
697
|
+
onCommit: (n) => onChannelChange("b", n),
|
|
698
|
+
ariaLabel: "Blue",
|
|
699
|
+
align: "center",
|
|
700
|
+
inputMode: "numeric",
|
|
701
|
+
nudgeStep: 1,
|
|
702
|
+
nudgeShiftStep: 10,
|
|
703
|
+
scrubbable: true,
|
|
704
|
+
min: 0,
|
|
705
|
+
max: 255
|
|
706
|
+
})
|
|
707
|
+
}),
|
|
708
|
+
/* @__PURE__ */ jsx4(AlphaInput, {
|
|
709
|
+
value: alphaPct,
|
|
710
|
+
onCommit: (n) => onChannelChange("alphaPercent", String(n))
|
|
711
|
+
})
|
|
712
|
+
]
|
|
713
|
+
});
|
|
714
|
+
}
|
|
715
|
+
if (format === "hsl") {
|
|
716
|
+
const hsl = rgbToHsl2(parsed.r, parsed.g, parsed.b);
|
|
717
|
+
return /* @__PURE__ */ jsxs3("div", {
|
|
718
|
+
className: "grid grid-cols-4 gap-1",
|
|
719
|
+
children: [
|
|
720
|
+
/* @__PURE__ */ jsx4(ChannelTooltip, {
|
|
721
|
+
label: "Hue",
|
|
722
|
+
children: /* @__PURE__ */ jsx4(ColorInput, {
|
|
723
|
+
value: String(Math.round(hsl.h)),
|
|
724
|
+
onCommit: (n) => onChannelChange("hSL", n),
|
|
725
|
+
ariaLabel: "Hue",
|
|
726
|
+
align: "center",
|
|
727
|
+
inputMode: "numeric",
|
|
728
|
+
nudgeStep: 1,
|
|
729
|
+
nudgeShiftStep: 10,
|
|
730
|
+
scrubbable: true,
|
|
731
|
+
min: 0,
|
|
732
|
+
max: 360,
|
|
733
|
+
wrap: true
|
|
734
|
+
})
|
|
735
|
+
}),
|
|
736
|
+
/* @__PURE__ */ jsx4(ChannelTooltip, {
|
|
737
|
+
label: "Saturation",
|
|
738
|
+
children: /* @__PURE__ */ jsx4(ColorInput, {
|
|
739
|
+
value: String(Math.round(hsl.s * 100)),
|
|
740
|
+
onCommit: (n) => onChannelChange("sSL", n),
|
|
741
|
+
ariaLabel: "Saturation",
|
|
742
|
+
align: "center",
|
|
743
|
+
inputMode: "numeric",
|
|
744
|
+
nudgeStep: 1,
|
|
745
|
+
nudgeShiftStep: 10,
|
|
746
|
+
scrubbable: true,
|
|
747
|
+
min: 0,
|
|
748
|
+
max: 100
|
|
749
|
+
})
|
|
750
|
+
}),
|
|
751
|
+
/* @__PURE__ */ jsx4(ChannelTooltip, {
|
|
752
|
+
label: "Lightness",
|
|
753
|
+
children: /* @__PURE__ */ jsx4(ColorInput, {
|
|
754
|
+
value: String(Math.round(hsl.l * 100)),
|
|
755
|
+
onCommit: (n) => onChannelChange("lSL", n),
|
|
756
|
+
ariaLabel: "Lightness",
|
|
757
|
+
align: "center",
|
|
758
|
+
inputMode: "numeric",
|
|
759
|
+
nudgeStep: 1,
|
|
760
|
+
nudgeShiftStep: 10,
|
|
761
|
+
scrubbable: true,
|
|
762
|
+
min: 0,
|
|
763
|
+
max: 100
|
|
764
|
+
})
|
|
765
|
+
}),
|
|
766
|
+
/* @__PURE__ */ jsx4(AlphaInput, {
|
|
767
|
+
value: alphaPct,
|
|
768
|
+
onCommit: (n) => onChannelChange("alphaPercent", String(n))
|
|
769
|
+
})
|
|
770
|
+
]
|
|
771
|
+
});
|
|
772
|
+
}
|
|
773
|
+
const oklch = rgbToOklch2(parsed.r, parsed.g, parsed.b);
|
|
774
|
+
const displayH = oklchHue ?? oklch.H;
|
|
775
|
+
return /* @__PURE__ */ jsxs3("div", {
|
|
776
|
+
className: "grid grid-cols-4 gap-1",
|
|
777
|
+
children: [
|
|
778
|
+
/* @__PURE__ */ jsx4(ChannelTooltip, {
|
|
779
|
+
label: "Lightness",
|
|
780
|
+
children: /* @__PURE__ */ jsx4(ColorInput, {
|
|
781
|
+
value: (oklch.L * 100).toFixed(0),
|
|
782
|
+
onCommit: (n) => onChannelChange("L", n),
|
|
783
|
+
ariaLabel: "Lightness",
|
|
784
|
+
align: "center",
|
|
785
|
+
inputMode: "decimal",
|
|
786
|
+
nudgeStep: 1,
|
|
787
|
+
nudgeShiftStep: 10,
|
|
788
|
+
scrubbable: true,
|
|
789
|
+
min: 0,
|
|
790
|
+
max: 100
|
|
791
|
+
})
|
|
792
|
+
}),
|
|
793
|
+
/* @__PURE__ */ jsx4(ChannelTooltip, {
|
|
794
|
+
label: "Chroma",
|
|
795
|
+
children: /* @__PURE__ */ jsx4(ColorInput, {
|
|
796
|
+
value: oklch.C.toFixed(2),
|
|
797
|
+
onCommit: (n) => onChannelChange("C", n),
|
|
798
|
+
ariaLabel: "Chroma",
|
|
799
|
+
align: "center",
|
|
800
|
+
inputMode: "decimal",
|
|
801
|
+
nudgeStep: 0.01,
|
|
802
|
+
nudgeShiftStep: 0.1,
|
|
803
|
+
decimals: 2,
|
|
804
|
+
scrubbable: true,
|
|
805
|
+
min: 0,
|
|
806
|
+
max: 0.4
|
|
807
|
+
})
|
|
808
|
+
}),
|
|
809
|
+
/* @__PURE__ */ jsx4(ChannelTooltip, {
|
|
810
|
+
label: "Hue",
|
|
811
|
+
children: /* @__PURE__ */ jsx4(ColorInput, {
|
|
812
|
+
value: displayH.toFixed(0),
|
|
813
|
+
onCommit: (n) => onChannelChange("H", n),
|
|
814
|
+
ariaLabel: "Hue",
|
|
815
|
+
align: "center",
|
|
816
|
+
inputMode: "numeric",
|
|
817
|
+
nudgeStep: 1,
|
|
818
|
+
nudgeShiftStep: 10,
|
|
819
|
+
scrubbable: true,
|
|
820
|
+
min: 0,
|
|
821
|
+
max: 360,
|
|
822
|
+
wrap: true
|
|
823
|
+
})
|
|
824
|
+
}),
|
|
825
|
+
/* @__PURE__ */ jsx4(AlphaInput, {
|
|
826
|
+
value: alphaPct,
|
|
827
|
+
onCommit: (n) => onChannelChange("alphaPercent", String(n))
|
|
828
|
+
})
|
|
829
|
+
]
|
|
830
|
+
});
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
// components/inputs/color-picker/popover.tsx
|
|
834
|
+
import { Popover } from "@base-ui/react/popover";
|
|
835
|
+
import { forwardRef as forwardRef3, useCallback as useCallback2, useMemo as useMemo4, useRef as useRef3 } from "react";
|
|
836
|
+
|
|
837
|
+
// components/inputs/color-picker/swatches.tsx
|
|
838
|
+
import { forwardRef as forwardRef2, useEffect as useEffect3, useMemo as useMemo3, useState as useState2 } from "react";
|
|
839
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
840
|
+
/*!
|
|
841
|
+
* Part of the ColorPicker port (Fluid Functionalism `registry/default/color-picker.tsx` @ b3587bdbd83fc66c2a6aae3817ffb856cb09260b,
|
|
842
|
+
* MIT License © 2026 Micka Touillaud). Local changes: see PORTING.md.
|
|
843
|
+
*/
|
|
844
|
+
var CHECKER_BG = {
|
|
845
|
+
backgroundImage: "conic-gradient(var(--checker-a) 0 25%, var(--checker-b) 0 50%, var(--checker-a) 0 75%, var(--checker-b) 0)",
|
|
846
|
+
backgroundSize: "8px 8px"
|
|
847
|
+
};
|
|
848
|
+
function EyeDropperButton({ onPick }) {
|
|
849
|
+
const [supported, setSupported] = useState2(false);
|
|
850
|
+
const shape = useShape2();
|
|
851
|
+
const sizeClasses = useSize2();
|
|
852
|
+
const PipetteIcon = useIcon2("pipette");
|
|
853
|
+
useEffect3(() => {
|
|
854
|
+
setSupported(typeof window !== "undefined" && "EyeDropper" in window);
|
|
855
|
+
}, []);
|
|
856
|
+
if (!supported)
|
|
857
|
+
return null;
|
|
858
|
+
const handleClick = async () => {
|
|
859
|
+
try {
|
|
860
|
+
const Ctor = window.EyeDropper;
|
|
861
|
+
const eye = new Ctor;
|
|
862
|
+
const result = await eye.open();
|
|
863
|
+
onPick(result.sRGBHex);
|
|
864
|
+
} catch {}
|
|
865
|
+
};
|
|
866
|
+
return /* @__PURE__ */ jsx5("button", {
|
|
867
|
+
type: "button",
|
|
868
|
+
onClick: handleClick,
|
|
869
|
+
"aria-label": "Pick color from screen",
|
|
870
|
+
className: cn2("flex items-center justify-center text-muted-foreground bg-transparent hover:bg-hover hover:text-foreground active:bg-active transition-colors duration-fast outline-none focus-visible:ring-1 focus-visible:ring-focus-ring cursor-pointer", sizeClasses.control, sizeClasses.px, shape.input),
|
|
871
|
+
children: /* @__PURE__ */ jsx5(PipetteIcon, {
|
|
872
|
+
size: sizeClasses.icon,
|
|
873
|
+
strokeWidth: 1.5
|
|
874
|
+
})
|
|
875
|
+
});
|
|
876
|
+
}
|
|
877
|
+
function ColorTile2({ color, size = 24, className, style }) {
|
|
878
|
+
const shape = useShape2();
|
|
879
|
+
return /* @__PURE__ */ jsx5("span", {
|
|
880
|
+
className: cn2("inline-block relative shrink-0 overflow-hidden shadow-swatch", shape.bg, className),
|
|
881
|
+
style: {
|
|
882
|
+
width: size,
|
|
883
|
+
height: size,
|
|
884
|
+
...CHECKER_BG,
|
|
885
|
+
...style
|
|
886
|
+
},
|
|
887
|
+
children: /* @__PURE__ */ jsx5("span", {
|
|
888
|
+
className: "absolute inset-0",
|
|
889
|
+
style: { backgroundColor: color }
|
|
890
|
+
})
|
|
891
|
+
});
|
|
892
|
+
}
|
|
893
|
+
var ColorSwatch2 = forwardRef2(({ color, size = 28, selected, className, onMouseEnter, onMouseLeave, ...props }, ref) => {
|
|
894
|
+
const shape = useShape2();
|
|
895
|
+
const [hovered, setHovered] = useState2(false);
|
|
896
|
+
const ring = selected ? "shadow-swatch-selected" : hovered ? "shadow-swatch-hover" : "shadow-swatch";
|
|
897
|
+
return /* @__PURE__ */ jsx5("button", {
|
|
898
|
+
ref,
|
|
899
|
+
type: "button",
|
|
900
|
+
"aria-label": `Select color ${color}`,
|
|
901
|
+
className: cn2("relative shrink-0 overflow-hidden cursor-pointer outline-none transition-shadow duration-100", shape.bg, ring, className),
|
|
902
|
+
style: {
|
|
903
|
+
width: size,
|
|
904
|
+
height: size,
|
|
905
|
+
...CHECKER_BG
|
|
906
|
+
},
|
|
907
|
+
onMouseEnter: (e) => {
|
|
908
|
+
setHovered(true);
|
|
909
|
+
onMouseEnter?.(e);
|
|
910
|
+
},
|
|
911
|
+
onMouseLeave: (e) => {
|
|
912
|
+
setHovered(false);
|
|
913
|
+
onMouseLeave?.(e);
|
|
914
|
+
},
|
|
915
|
+
...props,
|
|
916
|
+
children: /* @__PURE__ */ jsx5("span", {
|
|
917
|
+
className: "absolute inset-0",
|
|
918
|
+
style: { backgroundColor: color }
|
|
919
|
+
})
|
|
920
|
+
});
|
|
921
|
+
});
|
|
922
|
+
ColorSwatch2.displayName = "ColorSwatch";
|
|
923
|
+
function SwatchStrip({
|
|
924
|
+
swatches,
|
|
925
|
+
current,
|
|
926
|
+
onPick
|
|
927
|
+
}) {
|
|
928
|
+
const normalizedCurrent = useMemo3(() => {
|
|
929
|
+
const p = parseColor2(current);
|
|
930
|
+
return p ? rgbToHexStr2(p.r, p.g, p.b, p.a).toLowerCase() : "";
|
|
931
|
+
}, [current]);
|
|
932
|
+
const [resolvedSwatches, setResolvedSwatches] = useState2({});
|
|
933
|
+
useEffect3(() => {
|
|
934
|
+
const next = {};
|
|
935
|
+
for (const sw of swatches) {
|
|
936
|
+
if (!parseColor2(sw)) {
|
|
937
|
+
const p = resolveCssColor2(sw);
|
|
938
|
+
if (p)
|
|
939
|
+
next[sw] = rgbToHexStr2(p.r, p.g, p.b, p.a).toLowerCase();
|
|
940
|
+
}
|
|
941
|
+
}
|
|
942
|
+
setResolvedSwatches(next);
|
|
943
|
+
}, [swatches]);
|
|
944
|
+
return /* @__PURE__ */ jsx5("div", {
|
|
945
|
+
className: "flex flex-wrap gap-2",
|
|
946
|
+
children: swatches.map((sw, i) => {
|
|
947
|
+
const parsed = parseColor2(sw);
|
|
948
|
+
const normalized = parsed ? rgbToHexStr2(parsed.r, parsed.g, parsed.b, parsed.a).toLowerCase() : resolvedSwatches[sw] ?? sw.toLowerCase();
|
|
949
|
+
const isSelected = normalized === normalizedCurrent;
|
|
950
|
+
return /* @__PURE__ */ jsx5(ColorSwatch2, {
|
|
951
|
+
color: sw,
|
|
952
|
+
size: 28,
|
|
953
|
+
selected: isSelected,
|
|
954
|
+
onClick: () => onPick(sw)
|
|
955
|
+
}, `${sw}-${i}`);
|
|
956
|
+
})
|
|
957
|
+
});
|
|
958
|
+
}
|
|
959
|
+
|
|
960
|
+
// components/inputs/color-picker/popover.tsx
|
|
961
|
+
import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
962
|
+
/*!
|
|
963
|
+
* Part of the ColorPicker port (Fluid Functionalism `registry/default/color-picker.tsx` @ b3587bdbd83fc66c2a6aae3817ffb856cb09260b,
|
|
964
|
+
* MIT License © 2026 Micka Touillaud). Local changes: see PORTING.md.
|
|
965
|
+
*/
|
|
966
|
+
var ColorPickerPopover2 = forwardRef3(({
|
|
967
|
+
triggerLabel,
|
|
968
|
+
triggerLabelPosition = "left",
|
|
969
|
+
triggerShowValue = true,
|
|
970
|
+
triggerShowRemove = false,
|
|
971
|
+
onTriggerRemove,
|
|
972
|
+
removeLabel = "Remove color",
|
|
973
|
+
disabled: disabledProp,
|
|
974
|
+
readOnly: readOnlyProp,
|
|
975
|
+
triggerClassName,
|
|
976
|
+
id,
|
|
977
|
+
"aria-label": ariaLabel,
|
|
978
|
+
"aria-labelledby": ariaLabelledBy,
|
|
979
|
+
"aria-describedby": ariaDescribedBy,
|
|
980
|
+
"aria-invalid": ariaInvalid,
|
|
981
|
+
open,
|
|
982
|
+
defaultOpen,
|
|
983
|
+
onOpenChange,
|
|
984
|
+
size,
|
|
985
|
+
from,
|
|
986
|
+
effect,
|
|
987
|
+
hideSource,
|
|
988
|
+
tier,
|
|
989
|
+
value: valueProp,
|
|
990
|
+
defaultValue = "#6B97FF",
|
|
991
|
+
onValueChange,
|
|
992
|
+
name,
|
|
993
|
+
...pickerProps
|
|
994
|
+
}, ref) => {
|
|
995
|
+
const root = useOverlayRoot2({ open, defaultOpen, onOpenChange });
|
|
996
|
+
const [value, setValue] = useControllableState2(valueProp, defaultValue);
|
|
997
|
+
const handleValueChange = useCallback2((next, parsed) => {
|
|
998
|
+
setValue(next);
|
|
999
|
+
onValueChange?.(next, parsed);
|
|
1000
|
+
}, [setValue, onValueChange]);
|
|
1001
|
+
const box = useFieldBox2({
|
|
1002
|
+
variant: "bordered",
|
|
1003
|
+
invalid: ariaInvalid,
|
|
1004
|
+
disabled: disabledProp,
|
|
1005
|
+
readOnly: readOnlyProp,
|
|
1006
|
+
size
|
|
1007
|
+
});
|
|
1008
|
+
const { disabled, readOnly } = box;
|
|
1009
|
+
const locked = disabled || readOnly;
|
|
1010
|
+
const sizeClasses = box.size;
|
|
1011
|
+
const compact = sizeClasses.variant === "compact";
|
|
1012
|
+
const frameRef = useRef3(null);
|
|
1013
|
+
const XIcon = useIcon2("x");
|
|
1014
|
+
const parsed = useMemo4(() => parseColor2(value), [value]);
|
|
1015
|
+
const swatchColor = parsed ? rgbToHexStr2(parsed.r, parsed.g, parsed.b, parsed.a) : value;
|
|
1016
|
+
const valueLabel = parsed ? rgbToHexStr2(parsed.r, parsed.g, parsed.b, 1).replace(/^#/, "").toUpperCase() : value;
|
|
1017
|
+
const label = /* @__PURE__ */ jsx6("span", {
|
|
1018
|
+
className: cn2("text-muted-foreground px-1 select-none", sizeClasses.text),
|
|
1019
|
+
children: triggerLabel
|
|
1020
|
+
});
|
|
1021
|
+
return /* @__PURE__ */ jsx6(SizeScope2, {
|
|
1022
|
+
size,
|
|
1023
|
+
children: /* @__PURE__ */ jsx6(OverlayContext2.Provider, {
|
|
1024
|
+
value: root.state,
|
|
1025
|
+
children: /* @__PURE__ */ jsxs4(Popover.Root, {
|
|
1026
|
+
open: root.open && !locked,
|
|
1027
|
+
onOpenChange: (next, details) => {
|
|
1028
|
+
if (next && locked)
|
|
1029
|
+
return;
|
|
1030
|
+
root.onOpenChange(next, details);
|
|
1031
|
+
},
|
|
1032
|
+
modal: false,
|
|
1033
|
+
children: [
|
|
1034
|
+
/* @__PURE__ */ jsxs4("div", {
|
|
1035
|
+
ref: mergeRefs2(frameRef, ref),
|
|
1036
|
+
...box.props,
|
|
1037
|
+
className: cn2(box.props.className, "inline-flex items-center [&:has(:focus-visible)]:!ring-focus-ring", locked ? "cursor-default" : "cursor-pointer", sizeClasses.control, triggerClassName),
|
|
1038
|
+
children: [
|
|
1039
|
+
/* @__PURE__ */ jsxs4(Popover.Trigger, {
|
|
1040
|
+
id,
|
|
1041
|
+
"aria-label": ariaLabel,
|
|
1042
|
+
"aria-labelledby": ariaLabelledBy,
|
|
1043
|
+
"aria-describedby": ariaDescribedBy,
|
|
1044
|
+
"aria-invalid": ariaInvalid,
|
|
1045
|
+
disabled,
|
|
1046
|
+
tabIndex: readOnly ? -1 : undefined,
|
|
1047
|
+
className: cn2("flex items-center self-stretch bg-transparent outline-none weight-medium", !locked && "cursor-pointer", sizeClasses.gap),
|
|
1048
|
+
children: [
|
|
1049
|
+
triggerLabel && triggerLabelPosition === "left" && label,
|
|
1050
|
+
/* @__PURE__ */ jsx6(ColorTile2, {
|
|
1051
|
+
color: swatchColor,
|
|
1052
|
+
size: compact ? 16 : 20
|
|
1053
|
+
}),
|
|
1054
|
+
triggerShowValue && /* @__PURE__ */ jsx6("span", {
|
|
1055
|
+
className: cn2("text-foreground tabular-nums", sizeClasses.text),
|
|
1056
|
+
children: valueLabel
|
|
1057
|
+
}),
|
|
1058
|
+
triggerLabel && triggerLabelPosition === "right" && label
|
|
1059
|
+
]
|
|
1060
|
+
}),
|
|
1061
|
+
triggerShowRemove && !locked && /* @__PURE__ */ jsx6("button", {
|
|
1062
|
+
type: "button",
|
|
1063
|
+
"aria-label": removeLabel,
|
|
1064
|
+
onClick: onTriggerRemove,
|
|
1065
|
+
className: "ml-1 flex items-center bg-transparent text-muted-foreground hover:text-foreground outline-none cursor-pointer",
|
|
1066
|
+
children: /* @__PURE__ */ jsx6(XIcon, {
|
|
1067
|
+
size: 14,
|
|
1068
|
+
strokeWidth: 1.5
|
|
1069
|
+
})
|
|
1070
|
+
}),
|
|
1071
|
+
name && /* @__PURE__ */ jsx6("input", {
|
|
1072
|
+
type: "hidden",
|
|
1073
|
+
name,
|
|
1074
|
+
value
|
|
1075
|
+
})
|
|
1076
|
+
]
|
|
1077
|
+
}),
|
|
1078
|
+
/* @__PURE__ */ jsx6(ColorPickerPanel, {
|
|
1079
|
+
anchor: frameRef,
|
|
1080
|
+
morphProps: { from, effect, hideSource, tier },
|
|
1081
|
+
pickerProps: { ...pickerProps, value, onValueChange: handleValueChange }
|
|
1082
|
+
})
|
|
1083
|
+
]
|
|
1084
|
+
})
|
|
1085
|
+
})
|
|
1086
|
+
});
|
|
1087
|
+
});
|
|
1088
|
+
ColorPickerPopover2.displayName = "ColorPickerPopover";
|
|
1089
|
+
function ColorPickerPanel({
|
|
1090
|
+
anchor,
|
|
1091
|
+
morphProps,
|
|
1092
|
+
pickerProps
|
|
1093
|
+
}) {
|
|
1094
|
+
const { open, origin } = useOverlay2("ColorPicker.Popover");
|
|
1095
|
+
const morph = useMorph2(open, origin, morphProps);
|
|
1096
|
+
return /* @__PURE__ */ jsx6(Popover.Portal, {
|
|
1097
|
+
children: /* @__PURE__ */ jsx6(Popover.Positioner, {
|
|
1098
|
+
anchor,
|
|
1099
|
+
...positionerProps2(morphProps, { side: "bottom", align: "start", sideOffset: 6 }),
|
|
1100
|
+
children: /* @__PURE__ */ jsx6(Popover.Popup, {
|
|
1101
|
+
ref: morph.popupRef,
|
|
1102
|
+
className: "relative outline-none",
|
|
1103
|
+
children: /* @__PURE__ */ jsx6(PortalContainer2, {
|
|
1104
|
+
value: morph.popup,
|
|
1105
|
+
children: /* @__PURE__ */ jsx6(PopupSurface2, {
|
|
1106
|
+
morph,
|
|
1107
|
+
children: /* @__PURE__ */ jsx6(PanelSurfaceContext.Provider, {
|
|
1108
|
+
value: false,
|
|
1109
|
+
children: /* @__PURE__ */ jsx6(ColorPicker2, {
|
|
1110
|
+
...pickerProps
|
|
1111
|
+
})
|
|
1112
|
+
})
|
|
1113
|
+
})
|
|
1114
|
+
})
|
|
1115
|
+
})
|
|
1116
|
+
})
|
|
1117
|
+
});
|
|
1118
|
+
}
|
|
1119
|
+
|
|
1120
|
+
// components/inputs/color-picker/saturation-square.tsx
|
|
1121
|
+
import { motion as motion2 } from "motion/react";
|
|
1122
|
+
import { useCallback as useCallback3, useRef as useRef4, useState as useState3 } from "react";
|
|
1123
|
+
import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1124
|
+
/*!
|
|
1125
|
+
* Part of the ColorPicker port (Fluid Functionalism `registry/default/color-picker.tsx` @ b3587bdbd83fc66c2a6aae3817ffb856cb09260b,
|
|
1126
|
+
* MIT License © 2026 Micka Touillaud). Local changes: see PORTING.md.
|
|
1127
|
+
*/
|
|
1128
|
+
var SQUARE_HEIGHT = 156;
|
|
1129
|
+
function SaturationSquare({ h, s, v, onChange }) {
|
|
1130
|
+
const ref = useRef4(null);
|
|
1131
|
+
const [dragging, setDragging] = useState3(false);
|
|
1132
|
+
const hasMoved = useRef4(false);
|
|
1133
|
+
const [focused, setFocused] = useState3(false);
|
|
1134
|
+
const [hovered, setHovered] = useState3(false);
|
|
1135
|
+
const [cursorPos, setCursorPos] = useState3(null);
|
|
1136
|
+
const shape = useShape2();
|
|
1137
|
+
const updateFromPointer = useCallback3((clientX, clientY) => {
|
|
1138
|
+
const rect = ref.current?.getBoundingClientRect();
|
|
1139
|
+
if (!rect)
|
|
1140
|
+
return;
|
|
1141
|
+
const x = clamp012((clientX - rect.left) / rect.width);
|
|
1142
|
+
const y = clamp012((clientY - rect.top) / rect.height);
|
|
1143
|
+
onChange(x, 1 - y);
|
|
1144
|
+
}, [onChange]);
|
|
1145
|
+
const updateCursorPos = useCallback3((clientX, clientY) => {
|
|
1146
|
+
const rect = ref.current?.getBoundingClientRect();
|
|
1147
|
+
if (!rect)
|
|
1148
|
+
return;
|
|
1149
|
+
setCursorPos({
|
|
1150
|
+
x: clamp012((clientX - rect.left) / rect.width) * 100,
|
|
1151
|
+
y: clamp012((clientY - rect.top) / rect.height) * 100
|
|
1152
|
+
});
|
|
1153
|
+
}, []);
|
|
1154
|
+
const onPointerDown = useCallback3((e) => {
|
|
1155
|
+
if (e.pointerType === "mouse" && e.button !== 0)
|
|
1156
|
+
return;
|
|
1157
|
+
e.preventDefault();
|
|
1158
|
+
setDragging(true);
|
|
1159
|
+
hasMoved.current = false;
|
|
1160
|
+
e.currentTarget.setPointerCapture(e.pointerId);
|
|
1161
|
+
updateFromPointer(e.clientX, e.clientY);
|
|
1162
|
+
}, [updateFromPointer]);
|
|
1163
|
+
const onPointerMove = useCallback3((e) => {
|
|
1164
|
+
updateCursorPos(e.clientX, e.clientY);
|
|
1165
|
+
if (!dragging)
|
|
1166
|
+
return;
|
|
1167
|
+
hasMoved.current = true;
|
|
1168
|
+
updateFromPointer(e.clientX, e.clientY);
|
|
1169
|
+
}, [dragging, updateFromPointer, updateCursorPos]);
|
|
1170
|
+
const onPointerUp = useCallback3(() => {
|
|
1171
|
+
setDragging(false);
|
|
1172
|
+
hasMoved.current = false;
|
|
1173
|
+
}, []);
|
|
1174
|
+
const onKeyDown = useCallback3((e) => {
|
|
1175
|
+
const step = e.shiftKey ? 0.1 : 0.01;
|
|
1176
|
+
let nextS = s, nextV = v, handled = true;
|
|
1177
|
+
if (e.key === "ArrowLeft")
|
|
1178
|
+
nextS = clamp012(s - step);
|
|
1179
|
+
else if (e.key === "ArrowRight")
|
|
1180
|
+
nextS = clamp012(s + step);
|
|
1181
|
+
else if (e.key === "ArrowUp")
|
|
1182
|
+
nextV = clamp012(v + step);
|
|
1183
|
+
else if (e.key === "ArrowDown")
|
|
1184
|
+
nextV = clamp012(v - step);
|
|
1185
|
+
else
|
|
1186
|
+
handled = false;
|
|
1187
|
+
if (handled) {
|
|
1188
|
+
e.preventDefault();
|
|
1189
|
+
onChange(nextS, nextV);
|
|
1190
|
+
}
|
|
1191
|
+
}, [onChange, s, v]);
|
|
1192
|
+
const { r, g, b } = hsvToRgb2(h, s, v);
|
|
1193
|
+
const thumbColor = `rgb(${Math.round(r)}, ${Math.round(g)}, ${Math.round(b)})`;
|
|
1194
|
+
return /* @__PURE__ */ jsxs5("div", {
|
|
1195
|
+
ref,
|
|
1196
|
+
role: "application",
|
|
1197
|
+
"aria-label": "Saturation and brightness",
|
|
1198
|
+
tabIndex: 0,
|
|
1199
|
+
onFocus: (e) => {
|
|
1200
|
+
if (e.currentTarget.matches(":focus-visible"))
|
|
1201
|
+
setFocused(true);
|
|
1202
|
+
},
|
|
1203
|
+
onBlur: () => setFocused(false),
|
|
1204
|
+
onPointerEnter: () => setHovered(true),
|
|
1205
|
+
onPointerLeave: () => {
|
|
1206
|
+
setHovered(false);
|
|
1207
|
+
setCursorPos(null);
|
|
1208
|
+
},
|
|
1209
|
+
onPointerDown,
|
|
1210
|
+
onPointerMove,
|
|
1211
|
+
onPointerUp,
|
|
1212
|
+
onKeyDown,
|
|
1213
|
+
className: cn2("relative w-full select-none touch-none cursor-none outline-none", focused && "ring-2 ring-focus-ring", shape.bg),
|
|
1214
|
+
style: {
|
|
1215
|
+
height: SQUARE_HEIGHT
|
|
1216
|
+
},
|
|
1217
|
+
children: [
|
|
1218
|
+
/* @__PURE__ */ jsx7("div", {
|
|
1219
|
+
className: cn2("absolute inset-0 overflow-hidden", shape.bg === "rounded-[20px]" ? "rounded-2xl" : shape.bg),
|
|
1220
|
+
style: {
|
|
1221
|
+
background: `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${h}, 100%, 50%))`
|
|
1222
|
+
}
|
|
1223
|
+
}),
|
|
1224
|
+
/* @__PURE__ */ jsx7(motion2.div, {
|
|
1225
|
+
className: "absolute pointer-events-none rounded-full border border-thumb shadow-picker-thumb",
|
|
1226
|
+
initial: false,
|
|
1227
|
+
animate: {
|
|
1228
|
+
left: `${s * 100}%`,
|
|
1229
|
+
top: `${(1 - v) * 100}%`,
|
|
1230
|
+
width: 18,
|
|
1231
|
+
height: 18
|
|
1232
|
+
},
|
|
1233
|
+
transition: { duration: 0 },
|
|
1234
|
+
style: {
|
|
1235
|
+
transform: "translate(-50%, -50%)",
|
|
1236
|
+
backgroundColor: thumbColor
|
|
1237
|
+
}
|
|
1238
|
+
}),
|
|
1239
|
+
hovered && !dragging && cursorPos && /* @__PURE__ */ jsx7("div", {
|
|
1240
|
+
className: "absolute pointer-events-none rounded-full border-2 border-picker-ring shadow-picker-cursor",
|
|
1241
|
+
style: {
|
|
1242
|
+
left: `${cursorPos.x}%`,
|
|
1243
|
+
top: `${cursorPos.y}%`,
|
|
1244
|
+
width: 18,
|
|
1245
|
+
height: 18,
|
|
1246
|
+
transform: "translate(-50%, -50%)"
|
|
1247
|
+
}
|
|
1248
|
+
})
|
|
1249
|
+
]
|
|
1250
|
+
});
|
|
1251
|
+
}
|
|
1252
|
+
|
|
1253
|
+
// components/inputs/color-picker/index.tsx
|
|
1254
|
+
import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1255
|
+
/*!
|
|
1256
|
+
* Ported from Fluid Functionalism — github.com/mickadesign/fluid-functionalism
|
|
1257
|
+
* `registry/default/color-picker.tsx` @ b3587bdbd83fc66c2a6aae3817ffb856cb09260b
|
|
1258
|
+
* MIT License © 2026 Micka Touillaud — fluidfunctionalism.com (notice: LICENSE.fluid-functionalism)
|
|
1259
|
+
* Local changes: see PORTING.md.
|
|
1260
|
+
*/
|
|
1261
|
+
var PANEL_WIDTH = 280;
|
|
1262
|
+
var ColorPicker2 = forwardRef4(({
|
|
1263
|
+
value,
|
|
1264
|
+
defaultValue = "#6B97FF",
|
|
1265
|
+
onValueChange,
|
|
1266
|
+
format,
|
|
1267
|
+
defaultFormat = "hex",
|
|
1268
|
+
onFormatChange,
|
|
1269
|
+
swatches,
|
|
1270
|
+
hideEyedropper,
|
|
1271
|
+
formatOpen,
|
|
1272
|
+
defaultFormatOpen,
|
|
1273
|
+
onFormatOpenChange,
|
|
1274
|
+
size,
|
|
1275
|
+
name,
|
|
1276
|
+
className,
|
|
1277
|
+
...props
|
|
1278
|
+
}, ref) => {
|
|
1279
|
+
const [currentRawValue, setRawValue] = useControllableState2(value, defaultValue);
|
|
1280
|
+
const [currentFormat, setFormat] = useControllableState2(format, defaultFormat, onFormatChange);
|
|
1281
|
+
const initialParsed = useMemo5(() => {
|
|
1282
|
+
const p = parseColor2(currentRawValue);
|
|
1283
|
+
if (!p)
|
|
1284
|
+
return { h: 0, s: 1, v: 1, a: 1 };
|
|
1285
|
+
const hsv = rgbToHsv2(p.r, p.g, p.b);
|
|
1286
|
+
return { h: hsv.s === 0 ? 0 : hsv.h, s: hsv.s, v: hsv.v, a: p.a };
|
|
1287
|
+
}, []);
|
|
1288
|
+
const [hsv, setHsv] = useState4(initialParsed);
|
|
1289
|
+
const oklchHueRef = useRef5(null);
|
|
1290
|
+
const lastEmittedRef = useRef5(currentRawValue);
|
|
1291
|
+
useEffect4(() => {
|
|
1292
|
+
if (currentRawValue === lastEmittedRef.current)
|
|
1293
|
+
return;
|
|
1294
|
+
lastEmittedRef.current = currentRawValue;
|
|
1295
|
+
const p = parseColor2(currentRawValue);
|
|
1296
|
+
if (!p)
|
|
1297
|
+
return;
|
|
1298
|
+
oklchHueRef.current = null;
|
|
1299
|
+
const newHsv = rgbToHsv2(p.r, p.g, p.b);
|
|
1300
|
+
setHsv((prev) => ({
|
|
1301
|
+
h: newHsv.s === 0 ? prev.h : newHsv.h,
|
|
1302
|
+
s: newHsv.s,
|
|
1303
|
+
v: newHsv.v,
|
|
1304
|
+
a: p.a
|
|
1305
|
+
}));
|
|
1306
|
+
}, [currentRawValue]);
|
|
1307
|
+
const parsed = useMemo5(() => buildParsed2(hsv.h, hsv.s, hsv.v, hsv.a), [hsv]);
|
|
1308
|
+
const emit = useCallback4((p, fmt) => {
|
|
1309
|
+
const formatted = formatValueByFormat2(p, fmt);
|
|
1310
|
+
lastEmittedRef.current = formatted;
|
|
1311
|
+
setRawValue(formatted);
|
|
1312
|
+
onValueChange?.(formatted, p);
|
|
1313
|
+
}, [setRawValue, onValueChange]);
|
|
1314
|
+
const updateHsv = useCallback4((next) => {
|
|
1315
|
+
const merged = { ...hsv, ...next };
|
|
1316
|
+
setHsv(merged);
|
|
1317
|
+
emit(buildParsed2(merged.h, merged.s, merged.v, merged.a), currentFormat);
|
|
1318
|
+
}, [hsv, currentFormat, emit]);
|
|
1319
|
+
const handleFormatChange = useCallback4((f) => {
|
|
1320
|
+
setFormat(f);
|
|
1321
|
+
emit(parsed, f);
|
|
1322
|
+
}, [setFormat, emit, parsed]);
|
|
1323
|
+
const handleHexCommit = useCallback4((input) => {
|
|
1324
|
+
const p = resolveCssColor2(input);
|
|
1325
|
+
if (!p)
|
|
1326
|
+
return;
|
|
1327
|
+
oklchHueRef.current = null;
|
|
1328
|
+
const newHsv = rgbToHsv2(p.r, p.g, p.b);
|
|
1329
|
+
const merged = {
|
|
1330
|
+
h: newHsv.s === 0 ? hsv.h : newHsv.h,
|
|
1331
|
+
s: newHsv.s,
|
|
1332
|
+
v: newHsv.v,
|
|
1333
|
+
a: p.a
|
|
1334
|
+
};
|
|
1335
|
+
setHsv(merged);
|
|
1336
|
+
emit(buildParsed2(merged.h, merged.s, merged.v, merged.a), currentFormat);
|
|
1337
|
+
}, [hsv.h, currentFormat, emit]);
|
|
1338
|
+
const solidHueRgb = useMemo5(() => hsvToRgb2(hsv.h, hsv.s, hsv.v), [hsv.h, hsv.s, hsv.v]);
|
|
1339
|
+
const solidR = Math.round(solidHueRgb.r);
|
|
1340
|
+
const solidG = Math.round(solidHueRgb.g);
|
|
1341
|
+
const solidB = Math.round(solidHueRgb.b);
|
|
1342
|
+
const solidColorString = `rgb(${solidR}, ${solidG}, ${solidB})`;
|
|
1343
|
+
const shape = useShape2();
|
|
1344
|
+
const substrate = useSurface2();
|
|
1345
|
+
const pickerLevel = Math.max(substrate, 3);
|
|
1346
|
+
const paintsSurface = useContext2(PanelSurfaceContext);
|
|
1347
|
+
return /* @__PURE__ */ jsx8(SizeScope2, {
|
|
1348
|
+
size,
|
|
1349
|
+
children: /* @__PURE__ */ jsx8(SurfaceProvider2, {
|
|
1350
|
+
value: pickerLevel,
|
|
1351
|
+
children: /* @__PURE__ */ jsxs6("div", {
|
|
1352
|
+
ref,
|
|
1353
|
+
className: cn2("flex flex-col gap-2 p-3", paintsSurface && surfaceClasses2(pickerLevel, 1), shape.container, className),
|
|
1354
|
+
style: { width: PANEL_WIDTH },
|
|
1355
|
+
...props,
|
|
1356
|
+
children: [
|
|
1357
|
+
/* @__PURE__ */ jsx8(SaturationSquare, {
|
|
1358
|
+
h: hsv.h,
|
|
1359
|
+
s: hsv.s,
|
|
1360
|
+
v: hsv.v,
|
|
1361
|
+
onChange: (s, v) => updateHsv({ s, v })
|
|
1362
|
+
}),
|
|
1363
|
+
/* @__PURE__ */ jsxs6("div", {
|
|
1364
|
+
className: "flex flex-col [&>*]:mb-0 [&>*+*]:-mt-px",
|
|
1365
|
+
children: [
|
|
1366
|
+
/* @__PURE__ */ jsx8(HueSlider, {
|
|
1367
|
+
h: hsv.h,
|
|
1368
|
+
onChange: (h) => {
|
|
1369
|
+
oklchHueRef.current = null;
|
|
1370
|
+
updateHsv({ h });
|
|
1371
|
+
}
|
|
1372
|
+
}),
|
|
1373
|
+
/* @__PURE__ */ jsx8(AlphaSlider, {
|
|
1374
|
+
a: hsv.a,
|
|
1375
|
+
solidColor: solidColorString,
|
|
1376
|
+
solidR,
|
|
1377
|
+
solidG,
|
|
1378
|
+
solidB,
|
|
1379
|
+
onChange: (a) => updateHsv({ a })
|
|
1380
|
+
})
|
|
1381
|
+
]
|
|
1382
|
+
}),
|
|
1383
|
+
/* @__PURE__ */ jsxs6("div", {
|
|
1384
|
+
className: "grid grid-cols-2 gap-2",
|
|
1385
|
+
children: [
|
|
1386
|
+
/* @__PURE__ */ jsx8(FormatMenu, {
|
|
1387
|
+
value: currentFormat,
|
|
1388
|
+
onValueChange: handleFormatChange,
|
|
1389
|
+
open: formatOpen,
|
|
1390
|
+
defaultOpen: defaultFormatOpen,
|
|
1391
|
+
onOpenChange: onFormatOpenChange
|
|
1392
|
+
}),
|
|
1393
|
+
!hideEyedropper && /* @__PURE__ */ jsx8(EyeDropperButton, {
|
|
1394
|
+
onPick: handleHexCommit
|
|
1395
|
+
})
|
|
1396
|
+
]
|
|
1397
|
+
}),
|
|
1398
|
+
/* @__PURE__ */ jsx8(ColorInputsRow, {
|
|
1399
|
+
parsed,
|
|
1400
|
+
format: currentFormat,
|
|
1401
|
+
oklchHue: oklchHueRef.current,
|
|
1402
|
+
onChannelChange: (channel, value) => {
|
|
1403
|
+
const p = { ...parsed };
|
|
1404
|
+
switch (channel) {
|
|
1405
|
+
case "hex":
|
|
1406
|
+
handleHexCommit(value);
|
|
1407
|
+
return;
|
|
1408
|
+
case "r":
|
|
1409
|
+
case "g":
|
|
1410
|
+
case "b": {
|
|
1411
|
+
oklchHueRef.current = null;
|
|
1412
|
+
const r = channel === "r" ? Number(value) : p.r;
|
|
1413
|
+
const g = channel === "g" ? Number(value) : p.g;
|
|
1414
|
+
const b = channel === "b" ? Number(value) : p.b;
|
|
1415
|
+
const hsvVal = rgbToHsv2(r, g, b);
|
|
1416
|
+
updateHsv({
|
|
1417
|
+
h: hsvVal.s === 0 ? hsv.h : hsvVal.h,
|
|
1418
|
+
s: hsvVal.s,
|
|
1419
|
+
v: hsvVal.v
|
|
1420
|
+
});
|
|
1421
|
+
return;
|
|
1422
|
+
}
|
|
1423
|
+
case "hSL":
|
|
1424
|
+
case "sSL":
|
|
1425
|
+
case "lSL": {
|
|
1426
|
+
if (channel === "hSL")
|
|
1427
|
+
oklchHueRef.current = null;
|
|
1428
|
+
const hsl = rgbToHsl2(p.r, p.g, p.b);
|
|
1429
|
+
const h2 = channel === "hSL" ? Number(value) : hsl.h;
|
|
1430
|
+
const s2 = channel === "sSL" ? Number(value) / 100 : hsl.s;
|
|
1431
|
+
const l2 = channel === "lSL" ? Number(value) / 100 : hsl.l;
|
|
1432
|
+
const rgb = hslToRgb2(h2, clamp012(s2), clamp012(l2));
|
|
1433
|
+
const hsvVal = rgbToHsv2(rgb.r, rgb.g, rgb.b);
|
|
1434
|
+
updateHsv({
|
|
1435
|
+
h: hsvVal.s === 0 ? h2 : hsvVal.h,
|
|
1436
|
+
s: hsvVal.s,
|
|
1437
|
+
v: hsvVal.v
|
|
1438
|
+
});
|
|
1439
|
+
return;
|
|
1440
|
+
}
|
|
1441
|
+
case "L":
|
|
1442
|
+
case "C":
|
|
1443
|
+
case "H": {
|
|
1444
|
+
const cur = rgbToOklch2(p.r, p.g, p.b);
|
|
1445
|
+
const baseH = oklchHueRef.current ?? cur.H;
|
|
1446
|
+
const L = channel === "L" ? Number(value) / 100 : cur.L;
|
|
1447
|
+
const C = channel === "C" ? Number(value) : cur.C;
|
|
1448
|
+
const H = channel === "H" ? Number(value) : baseH;
|
|
1449
|
+
oklchHueRef.current = H;
|
|
1450
|
+
const rgb = oklchToRgb2(clamp012(L), Math.max(0, C), H);
|
|
1451
|
+
const hsvVal = rgbToHsv2(rgb.r, rgb.g, rgb.b);
|
|
1452
|
+
updateHsv({
|
|
1453
|
+
h: hsvVal.s === 0 ? hsv.h : hsvVal.h,
|
|
1454
|
+
s: hsvVal.s,
|
|
1455
|
+
v: hsvVal.v
|
|
1456
|
+
});
|
|
1457
|
+
return;
|
|
1458
|
+
}
|
|
1459
|
+
case "alphaPercent": {
|
|
1460
|
+
const a = clamp012(Number(value) / 100);
|
|
1461
|
+
updateHsv({ a });
|
|
1462
|
+
return;
|
|
1463
|
+
}
|
|
1464
|
+
}
|
|
1465
|
+
}
|
|
1466
|
+
}),
|
|
1467
|
+
swatches && swatches.length > 0 && /* @__PURE__ */ jsx8(SwatchStrip, {
|
|
1468
|
+
swatches,
|
|
1469
|
+
current: parsed.hex,
|
|
1470
|
+
onPick: handleHexCommit
|
|
1471
|
+
}),
|
|
1472
|
+
name && /* @__PURE__ */ jsx8("input", {
|
|
1473
|
+
type: "hidden",
|
|
1474
|
+
name,
|
|
1475
|
+
value: currentRawValue
|
|
1476
|
+
})
|
|
1477
|
+
]
|
|
1478
|
+
})
|
|
1479
|
+
})
|
|
1480
|
+
});
|
|
1481
|
+
});
|
|
1482
|
+
ColorPicker2.displayName = "ColorPicker";
|
|
1483
|
+
Object.assign(ColorPicker2, { Popover: ColorPickerPopover2 });
|
|
1484
|
+
var color_picker_default = ColorPicker2;
|
|
1485
|
+
|
|
1486
|
+
export { ColorTile2, ColorSwatch2, ColorPickerPopover2, ColorPicker2, color_picker_default };
|