@justanarthur/modo-ui 0.5.0 → 0.6.0-canary.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/DESIGN.md +608 -0
- package/README.md +61 -39
- package/blocks/sidebar-app/examples.mdx +33 -0
- package/blocks/sidebar-app/index.tsx +218 -0
- package/blocks/sidebar-app/inset-topbar.tsx +25 -0
- package/blocks/sidebar-app/menu-grid.ts +26 -0
- package/blocks/sidebar-app/nav-data.ts +36 -0
- package/blocks/sidebar-app/search-field.tsx +48 -0
- package/blocks/sidebar-app/user-footer.tsx +67 -0
- package/blocks/sidebar-app/workspace-header.tsx +129 -0
- package/components/AI/input-message/examples.mdx +124 -0
- package/components/AI/input-message/file-thumbnail.tsx +173 -0
- package/components/AI/input-message/index.tsx +1383 -0
- package/components/AI/thinking-indicator/examples.mdx +27 -0
- package/components/AI/thinking-indicator/index.tsx +210 -0
- package/components/accordion/examples.mdx +148 -0
- package/components/accordion/index.tsx +1034 -0
- package/components/avatar/examples.mdx +95 -0
- package/components/avatar/index.tsx +129 -0
- package/components/badge/change-demo.tsx +29 -0
- package/components/badge/examples.mdx +120 -0
- package/components/badge/index.tsx +225 -0
- package/components/badge/variants.ts +73 -0
- package/components/button/examples.mdx +164 -0
- package/components/button/index.tsx +416 -0
- package/components/button/loading-demo.tsx +25 -0
- package/components/button/variants.ts +166 -0
- package/components/card/examples.mdx +212 -0
- package/components/card/index.tsx +1037 -0
- package/components/copy/examples.mdx +87 -0
- package/components/copy/index.tsx +482 -0
- package/components/inputs/checkbox/examples.mdx +83 -0
- package/components/inputs/checkbox/index.tsx +611 -0
- package/components/inputs/checkbox/select-all-demo.tsx +48 -0
- package/components/inputs/color-picker/examples.mdx +72 -0
- package/components/inputs/color-picker/index.tsx +1955 -0
- package/components/inputs/color-picker/variants.ts +401 -0
- package/components/inputs/combobox/examples.mdx +273 -0
- package/components/inputs/combobox/index.tsx +1436 -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 +351 -0
- package/components/inputs/date-time/calendar/use-month-window.ts +163 -0
- package/components/inputs/date-time/date-picker/examples.mdx +166 -0
- package/components/inputs/date-time/date-picker/index.tsx +385 -0
- package/components/inputs/date-time/date-picker/masked-date-input.tsx +336 -0
- package/components/inputs/date-time/date-range-picker/examples.mdx +29 -0
- package/components/inputs/date-time/date-range-picker/index.tsx +217 -0
- package/components/inputs/date-time/duration-picker/examples.mdx +16 -0
- package/components/inputs/date-time/duration-picker/index.tsx +189 -0
- package/components/inputs/date-time/month-picker/examples.mdx +16 -0
- package/components/inputs/date-time/month-picker/index.tsx +190 -0
- package/components/inputs/date-time/picker-shell.tsx +395 -0
- package/components/inputs/date-time/time-columns.tsx +91 -0
- package/components/inputs/date-time/time-picker/examples.mdx +26 -0
- package/components/inputs/date-time/time-picker/index.tsx +166 -0
- package/components/inputs/field/examples.mdx +113 -0
- package/components/inputs/field/index.tsx +267 -0
- package/components/inputs/file-dropzone/examples.mdx +73 -0
- package/components/inputs/file-dropzone/file-row.tsx +201 -0
- package/components/inputs/file-dropzone/index.tsx +296 -0
- package/components/inputs/file-dropzone/upload-demo.tsx +67 -0
- package/components/inputs/file-dropzone/variants.ts +94 -0
- package/components/inputs/input/examples.mdx +135 -0
- package/components/inputs/input/index.tsx +494 -0
- package/components/inputs/input/password-demo.tsx +30 -0
- package/components/inputs/label/examples.mdx +67 -0
- package/components/inputs/label/index.tsx +85 -0
- package/components/inputs/number-input/examples.mdx +56 -0
- package/components/inputs/number-input/index.tsx +214 -0
- package/components/inputs/radio/examples.mdx +77 -0
- package/components/inputs/radio/index.tsx +636 -0
- package/components/inputs/search/examples.mdx +74 -0
- package/components/inputs/search/index.tsx +333 -0
- package/components/inputs/select/examples.mdx +218 -0
- package/components/inputs/select/index.tsx +862 -0
- package/components/inputs/select/variants.ts +32 -0
- package/components/inputs/slider/examples.mdx +127 -0
- package/components/inputs/slider/index.tsx +1725 -0
- package/components/inputs/switch/examples.mdx +94 -0
- package/components/inputs/switch/index.tsx +504 -0
- package/components/inputs/textarea/examples.mdx +88 -0
- package/components/inputs/textarea/index.tsx +161 -0
- package/components/navigation/navigation-menu/examples.mdx +109 -0
- package/components/navigation/navigation-menu/index.tsx +613 -0
- package/components/navigation/pagination/examples.mdx +64 -0
- package/components/navigation/pagination/index.tsx +395 -0
- package/components/navigation/sidebar/examples.mdx +319 -0
- package/components/navigation/sidebar/index.tsx +453 -0
- package/components/navigation/sidebar/sidebar-core.tsx +1408 -0
- package/components/navigation/sidebar/sidebar-menu.tsx +1495 -0
- package/components/navigation/sidebar/sidebar.css +74 -0
- package/components/navigation/sidebar/variants.ts +55 -0
- package/components/navigation/tabs/examples.mdx +89 -0
- package/components/navigation/tabs/index.tsx +494 -0
- package/components/navigation/tabs-subtle/examples.mdx +49 -0
- package/components/navigation/tabs-subtle/index.tsx +512 -0
- package/components/overlays/alert-dialog/examples.mdx +123 -0
- package/components/overlays/alert-dialog/index.tsx +258 -0
- package/components/overlays/alert-dialog/pending-demo.tsx +36 -0
- package/components/overlays/command/examples.mdx +113 -0
- package/components/overlays/command/index.tsx +416 -0
- package/components/overlays/context-menu/examples.mdx +56 -0
- package/components/overlays/context-menu/index.tsx +279 -0
- package/components/overlays/dialog/examples.mdx +144 -0
- package/components/overlays/dialog/index.tsx +366 -0
- package/components/overlays/dropdown/dropdown-search.tsx +395 -0
- package/components/overlays/dropdown/examples.mdx +294 -0
- package/components/overlays/dropdown/index.tsx +1168 -0
- package/components/overlays/dropdown/menu-item.tsx +464 -0
- package/components/overlays/dropdown/menu-parts.tsx +660 -0
- package/components/overlays/popover/anchored-demo.tsx +59 -0
- package/components/overlays/popover/examples.mdx +180 -0
- package/components/overlays/popover/index.tsx +315 -0
- package/components/overlays/preview-card/examples.mdx +61 -0
- package/components/overlays/preview-card/index.tsx +204 -0
- package/components/overlays/sheet/examples.mdx +89 -0
- package/components/overlays/sheet/index.tsx +247 -0
- package/components/overlays/toast/examples.mdx +68 -0
- package/components/overlays/toast/global-demo.tsx +72 -0
- package/components/overlays/toast/index.tsx +474 -0
- package/components/overlays/toast/manager.ts +193 -0
- package/components/overlays/tooltip/examples.mdx +106 -0
- package/components/overlays/tooltip/index.tsx +519 -0
- package/components/progress/examples.mdx +59 -0
- package/components/progress/index.tsx +174 -0
- package/components/progress/progress.css +49 -0
- package/components/progress/step-demo.tsx +27 -0
- package/components/table/examples.mdx +184 -0
- package/components/table/index.tsx +510 -0
- package/components/table/sort-demo.tsx +61 -0
- package/dist/base.css +100 -0
- package/dist/blocks/sidebar-app/index.js +39 -26
- package/dist/components/AI/input-message/index.js +22 -16
- package/dist/components/AI/thinking-indicator/index.js +9 -6
- package/dist/components/accordion/index.js +16 -13
- package/dist/components/avatar/index.d.ts +46 -0
- package/dist/components/avatar/index.js +18 -0
- package/dist/components/badge/index.d.ts +18 -11
- package/dist/components/badge/index.js +11 -7
- package/dist/components/badge/variants.d.ts +33 -0
- package/dist/components/badge/variants.js +10 -0
- package/dist/components/button/index.d.ts +53 -17
- package/dist/components/button/index.js +10 -6
- package/dist/components/button/variants.d.ts +39 -0
- package/dist/components/button/variants.js +8 -0
- package/dist/components/card/index.d.ts +16 -3
- package/dist/components/card/index.js +16 -11
- package/dist/components/copy/index.js +13 -9
- package/dist/components/inputs/checkbox/index.d.ts +28 -9
- package/dist/components/inputs/checkbox/index.js +17 -13
- package/dist/components/inputs/color-picker/index.d.ts +13 -13
- package/dist/components/inputs/color-picker/index.js +25 -18
- 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 +60 -17
- package/dist/components/inputs/combobox/index.js +26 -18
- package/dist/components/inputs/date-time/calendar/index.js +14 -11
- package/dist/components/inputs/date-time/date-picker/index.d.ts +53 -11
- package/dist/components/inputs/date-time/date-picker/index.js +33 -25
- package/dist/components/inputs/date-time/date-range-picker/index.d.ts +3 -3
- package/dist/components/inputs/date-time/date-range-picker/index.js +32 -24
- package/dist/components/inputs/date-time/duration-picker/index.d.ts +3 -3
- package/dist/components/inputs/date-time/duration-picker/index.js +32 -24
- package/dist/components/inputs/date-time/month-picker/index.d.ts +3 -3
- package/dist/components/inputs/date-time/month-picker/index.js +31 -23
- package/dist/components/inputs/date-time/time-picker/index.d.ts +3 -3
- package/dist/components/inputs/date-time/time-picker/index.js +32 -24
- package/dist/components/inputs/field/index.d.ts +116 -0
- package/dist/components/inputs/field/index.js +28 -0
- package/dist/components/inputs/file-dropzone/index.d.ts +165 -0
- package/dist/components/inputs/file-dropzone/index.js +32 -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 +95 -13
- package/dist/components/inputs/input/index.js +17 -9
- package/dist/components/inputs/label/index.d.ts +32 -0
- package/dist/components/inputs/label/index.js +11 -0
- package/dist/components/inputs/number-input/index.d.ts +84 -0
- package/dist/components/inputs/number-input/index.js +20 -0
- package/dist/components/inputs/radio/index.d.ts +20 -5
- package/dist/components/inputs/radio/index.js +15 -12
- package/dist/components/inputs/search/index.js +25 -18
- package/dist/components/inputs/select/index.d.ts +41 -11
- package/dist/components/inputs/select/index.js +27 -14
- package/dist/components/inputs/select/variants.d.ts +5 -0
- package/dist/components/inputs/select/variants.js +6 -0
- package/dist/components/inputs/slider/index.js +7 -5
- package/dist/components/inputs/switch/index.d.ts +8 -2
- package/dist/components/inputs/switch/index.js +14 -12
- package/dist/components/inputs/textarea/index.d.ts +4 -0
- package/dist/components/inputs/textarea/index.js +8 -6
- package/dist/components/navigation/navigation-menu/index.d.ts +114 -0
- package/dist/components/navigation/navigation-menu/index.js +40 -0
- package/dist/components/navigation/pagination/index.d.ts +73 -0
- package/dist/components/navigation/pagination/index.js +39 -0
- package/dist/components/navigation/sidebar/index.d.ts +44 -21
- package/dist/components/navigation/sidebar/index.js +41 -31
- package/dist/components/navigation/sidebar/variants.d.ts +25 -0
- package/dist/components/navigation/sidebar/variants.js +28 -0
- package/dist/components/navigation/tabs/index.d.ts +8 -2
- package/dist/components/navigation/tabs/index.js +14 -10
- package/dist/components/navigation/tabs-subtle/index.js +12 -10
- package/dist/components/overlays/alert-dialog/index.d.ts +121 -15
- package/dist/components/overlays/alert-dialog/index.js +22 -13
- package/dist/components/overlays/command/index.js +24 -17
- package/dist/components/overlays/context-menu/index.d.ts +33 -17
- package/dist/components/overlays/context-menu/index.js +27 -18
- package/dist/components/overlays/dialog/index.js +17 -12
- package/dist/components/overlays/dropdown/index.d.ts +257 -31
- package/dist/components/overlays/dropdown/index.js +42 -17
- package/dist/components/overlays/popover/index.d.ts +31 -9
- package/dist/components/overlays/popover/index.js +12 -9
- package/dist/components/overlays/preview-card/index.js +11 -8
- package/dist/components/overlays/sheet/index.js +18 -13
- package/dist/components/overlays/toast/index.d.ts +123 -47
- package/dist/components/overlays/toast/index.js +18 -10
- package/dist/components/overlays/tooltip/index.d.ts +113 -21
- package/dist/components/overlays/tooltip/index.js +15 -6
- package/dist/components/progress/index.d.ts +56 -0
- package/dist/components/progress/index.js +15 -0
- package/dist/components/table/index.d.ts +63 -8
- package/dist/components/table/index.js +19 -9
- package/dist/index.d.ts +2201 -736
- package/dist/index.js +223 -82
- package/dist/lib/date-locale.d.ts +14 -0
- package/dist/lib/date-locale.js +16 -0
- package/dist/lib/field-classes.d.ts +144 -0
- package/dist/lib/field-classes.js +40 -0
- package/dist/lib/field-variants.d.ts +47 -0
- package/dist/lib/field-variants.js +26 -0
- package/dist/lib/fluid-hover-highlight.d.ts +112 -0
- package/dist/lib/fluid-hover-highlight.js +17 -0
- package/dist/lib/focus-ring.d.ts +18 -0
- package/dist/lib/focus-ring.js +10 -0
- package/dist/lib/goo-indicator.d.ts +46 -0
- package/dist/lib/goo-indicator.js +14 -0
- package/dist/lib/icon-context.d.ts +30 -0
- package/dist/lib/icon-context.js +12 -0
- package/dist/lib/inert.d.ts +9 -0
- package/dist/lib/inert.js +8 -0
- package/dist/lib/morph-layers.d.ts +93 -0
- package/dist/lib/morph-layers.js +13 -0
- package/dist/lib/morph-part.d.ts +21 -0
- package/dist/lib/morph-part.js +12 -0
- package/dist/lib/popup.d.ts +20 -0
- package/dist/lib/popup.js +12 -0
- package/dist/lib/reduced-motion.d.ts +9 -0
- package/dist/lib/reduced-motion.js +6 -0
- package/dist/lib/row-index.d.ts +10 -0
- package/dist/lib/row-index.js +8 -0
- package/dist/lib/row-order.d.ts +28 -0
- package/dist/lib/row-order.js +10 -0
- package/dist/lib/scroll-column.d.ts +27 -0
- package/dist/lib/scroll-column.js +18 -0
- package/dist/lib/shape-context.d.ts +30 -0
- package/dist/lib/shape-context.js +12 -0
- package/dist/lib/size-context.d.ts +94 -0
- package/dist/lib/size-context.js +20 -0
- package/dist/lib/size-scale.d.ts +79 -0
- package/dist/lib/size-scale.js +8 -0
- package/dist/lib/slot.d.ts +12 -0
- package/dist/lib/slot.js +6 -0
- package/dist/lib/springs.d.ts +44 -0
- package/dist/lib/springs.js +8 -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 +9 -0
- package/dist/lib/surface-context.js +8 -0
- package/dist/lib/use-controllable-state.d.ts +2 -0
- package/dist/lib/use-controllable-state.js +6 -0
- package/dist/lib/use-fluid-hover.d.ts +138 -0
- package/dist/lib/use-fluid-hover.js +14 -0
- package/dist/lib/use-is-mobile.d.ts +2 -0
- package/dist/lib/use-is-mobile.js +6 -0
- package/dist/lib/use-keyboard-nav-gate.d.ts +20 -0
- package/dist/lib/use-keyboard-nav-gate.js +7 -0
- package/dist/lib/use-merge-split.d.ts +47 -0
- package/dist/lib/use-merge-split.js +15 -0
- package/dist/lib/use-morph.d.ts +101 -0
- package/dist/lib/use-morph.js +20 -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/preset.d.ts +17 -0
- package/dist/preset.js +22 -2
- package/dist/primitives/code/index.js +7 -5
- package/dist/primitives/craft/index.js +9 -6
- package/dist/primitives/fluid-hover/index.js +9 -8
- package/dist/primitives/morph/index.js +15 -10
- package/dist/primitives/motion/index.js +10 -8
- package/dist/primitives/scroll-area/index.js +4 -3
- package/dist/primitives/separator/index.d.ts +25 -0
- package/dist/primitives/separator/index.js +9 -0
- package/dist/primitives/sizes/index.js +6 -4
- package/dist/primitives/skeleton/index.d.ts +35 -0
- package/dist/primitives/skeleton/index.js +12 -0
- package/dist/primitives/surface/index.js +6 -4
- package/dist/shared/{components-3mkepka5.js → components-0jmqhx2k.js} +28 -25
- package/dist/shared/components-124epb7f.js +53 -0
- package/dist/shared/{components-gz8zf3ec.js → components-1k0wv53d.js} +15 -43
- package/dist/shared/components-26snnbs9.js +322 -0
- package/dist/shared/{components-2dxkv6zm.js → components-2c0qcfx4.js} +8 -7
- package/dist/shared/{components-473g814w.js → components-2mt9te6d.js} +243 -137
- package/dist/shared/{components-hawvy2qz.js → components-2z48g4fp.js} +9 -30
- package/dist/shared/components-34txk9rj.js +35 -0
- package/dist/shared/components-3h92d94m.js +23 -0
- package/dist/shared/{components-zfnmn5d4.js → components-3sp623ae.js} +36 -31
- package/dist/shared/{components-jwst3vtj.js → components-3wxkjgqn.js} +186 -76
- package/dist/shared/{components-s2bz1xpk.js → components-49bsynbw.js} +8 -5
- package/dist/shared/components-4bwsd46w.js +71 -0
- package/dist/shared/components-4n4f5m3e.js +297 -0
- package/dist/shared/{components-0q0sqfh4.js → components-4y816hwp.js} +27 -49
- package/dist/shared/components-52ngsgca.js +399 -0
- package/dist/shared/{components-y9y0g8er.js → components-52r5763g.js} +22 -19
- package/dist/shared/components-559tf7yb.js +28 -0
- package/dist/shared/components-5mkga9hj.js +440 -0
- package/dist/shared/{components-kwa6mrf9.js → components-5s0nfqvw.js} +14 -9
- package/dist/shared/{components-dk0gjr5a.js → components-60atskhp.js} +19 -18
- package/dist/shared/{components-rr7a6ja9.js → components-658b26nb.js} +21 -18
- package/dist/shared/{components-xxvdw7k1.js → components-65vwfjs6.js} +37 -34
- package/dist/shared/{components-frw34b65.js → components-6j2fh74k.js} +114 -123
- package/dist/shared/components-6zg1yft7.js +167 -0
- package/dist/shared/components-6zng858q.js +53 -0
- package/dist/shared/components-72w4ge68.js +64 -0
- package/dist/shared/{components-cv16mryv.js → components-78x40gee.js} +13 -7
- package/dist/shared/{components-b2wyq2cq.js → components-7d4r7hh1.js} +39 -57
- package/dist/shared/components-7ntvvegr.js +316 -0
- package/dist/shared/components-8nwsqjn8.js +34 -0
- package/dist/shared/{components-5xc2j8jz.js → components-8tt3xbb5.js} +19 -18
- package/dist/shared/{components-vc7vq5nz.js → components-9as3rf68.js} +6 -3
- package/dist/shared/components-9mys9jna.js +255 -0
- package/dist/shared/components-adkarj8n.js +35 -0
- package/dist/shared/{components-b3c5et5b.js → components-ae9fncz4.js} +32 -31
- package/dist/shared/{components-hqeq3w9q.js → components-awra5sff.js} +24 -16
- package/dist/shared/components-b1e239g3.js +28 -0
- package/dist/shared/{components-q5xj5c16.js → components-b1f2bjf1.js} +9 -8
- package/dist/shared/{components-qmmjx1qw.js → components-bn42vq6d.js} +71 -72
- package/dist/shared/components-c96g82th.js +1444 -0
- package/dist/shared/components-c9yr4ed1.js +44 -0
- package/dist/shared/components-d3shbwqq.js +95 -0
- package/dist/shared/{components-jjw69c4c.js → components-dcc02hs2.js} +7 -4
- package/dist/shared/{components-men63rwj.js → components-de99ykt7.js} +3 -2
- package/dist/shared/components-dhgk6mbt.js +16 -0
- package/dist/shared/components-drxrtnp2.js +25 -0
- package/dist/shared/{components-6p8tfcd6.js → components-ds9fqat9.js} +21 -18
- package/dist/shared/{components-mjthm1kf.js → components-egy4tyjt.js} +11 -8
- package/dist/shared/components-f0xfpkhh.js +82 -0
- package/dist/shared/components-f7h57m6t.js +59 -0
- package/dist/shared/{components-d6xtjht3.js → components-fjkpbg6n.js} +33 -30
- package/dist/shared/{components-gc5vtq2f.js → components-gh0qeey3.js} +63 -29
- package/dist/shared/{components-39jq9va1.js → components-gvbapfen.js} +29 -24
- package/dist/shared/{components-5vgpnxgy.js → components-gzesg7hy.js} +19 -16
- package/dist/shared/components-h6p86be3.js +19 -0
- package/dist/shared/components-h83az0bz.js +33 -0
- package/dist/shared/components-jjrj6ymn.js +104 -0
- package/dist/shared/{components-wvp1m52g.js → components-jp5v0m0f.js} +15 -14
- package/dist/shared/{components-zrkzcayz.js → components-jqpefjsn.js} +54 -6
- package/dist/shared/{components-1z6tdadk.js → components-k74j4hwh.js} +20 -17
- package/dist/shared/components-kswxnm3h.js +24 -0
- package/dist/shared/{components-jbbmdr74.js → components-mkkbbgb7.js} +36 -17
- package/dist/shared/{components-pbmqctfa.js → components-mpw667rb.js} +169 -65
- package/dist/shared/{components-s5ngg32c.js → components-paa08427.js} +121 -47
- package/dist/shared/{components-vfbhxf5r.js → components-pd42emw3.js} +6 -5
- package/dist/shared/{components-hw9yk32z.js → components-pmfszv7a.js} +35 -23
- package/dist/shared/{components-chacnk61.js → components-pw06rbxq.js} +19 -19
- package/dist/shared/components-q03cktx8.js +246 -0
- package/dist/shared/{components-kvr7f9hy.js → components-qdm3yh26.js} +19 -10
- package/dist/shared/{components-27nnvrwe.js → components-qs4rkqsj.js} +15 -14
- package/dist/shared/{components-s083f38z.js → components-r6gbmkew.js} +22 -21
- package/dist/shared/{components-ta7shw28.js → components-r8eqs7gz.js} +4 -4
- package/dist/shared/{components-sn1rxx1d.js → components-rm02h9nt.js} +12 -11
- package/dist/shared/{components-c6s6b43g.js → components-rrbpmfx4.js} +3 -2
- package/dist/shared/{components-n7mjr357.js → components-tz1fv35x.js} +3 -2
- package/dist/shared/components-tz4gaf1v.js +23 -0
- package/dist/shared/{components-zx6b6yby.js → components-vf45j12c.js} +4 -18
- package/dist/shared/{components-3ky44908.js → components-vfjc9jzz.js} +2 -3
- package/dist/shared/{components-39vmfq9s.js → components-vsa625vk.js} +21 -20
- package/dist/shared/components-wawnmkph.js +500 -0
- package/dist/shared/components-wktrrb4m.js +38 -0
- package/dist/shared/{components-8snj490h.js → components-wwd363me.js} +78 -32
- package/dist/shared/{components-5pnw8183.js → components-xcwvgcrd.js} +23 -22
- package/dist/shared/components-xdqmt6ed.js +20 -0
- package/dist/shared/{components-h2ajmhwn.js → components-y1w3a6wx.js} +107 -35
- package/dist/shared/{components-ar66gnt0.js → components-y6578b8h.js} +37 -34
- package/dist/shared/{components-59efxjd9.js → components-yhgq0qxx.js} +13 -12
- package/dist/shared/{components-jthe1pwb.js → components-yz84gpkq.js} +101 -404
- package/dist/shared/components-z3v0n0de.js +11 -0
- package/dist/shared/{components-7r3etddy.js → components-z9n19fyk.js} +19 -54
- package/dist/shared/components-zbvjzh1p.js +141 -0
- package/dist/styles.css +241 -16
- package/dist/tailwind.css +13 -0
- package/dist/tokens.css +34 -0
- package/index.ts +60 -0
- package/lib/date-locale.ts +50 -0
- package/lib/field-classes.ts +115 -0
- package/lib/field-variants.ts +117 -0
- package/lib/fluid-hover-highlight.tsx +139 -0
- package/lib/focus-ring.tsx +46 -0
- package/lib/goo-indicator.tsx +261 -0
- package/lib/icon-context.tsx +310 -0
- package/lib/inert.ts +22 -0
- package/lib/morph-layers.tsx +102 -0
- package/lib/morph-part.tsx +49 -0
- package/lib/popup.ts +52 -0
- package/lib/reduced-motion.ts +19 -0
- package/lib/row-index.tsx +29 -0
- package/lib/row-order.tsx +115 -0
- package/lib/scroll-column.tsx +244 -0
- package/lib/shape-context.tsx +124 -0
- package/lib/size-context.tsx +66 -0
- package/lib/size-scale.ts +115 -0
- package/lib/slot.ts +25 -0
- package/lib/springs.ts +62 -0
- package/lib/surface-classes.ts +58 -0
- package/lib/surface-context.tsx +21 -0
- package/lib/use-controllable-state.ts +44 -0
- package/lib/use-fluid-hover.ts +541 -0
- package/lib/use-is-mobile.ts +25 -0
- package/lib/use-keyboard-nav-gate.ts +45 -0
- package/lib/use-merge-split.tsx +209 -0
- package/lib/use-morph.ts +557 -0
- package/lib/use-touch-primary.tsx +43 -0
- package/lib/utils.ts +37 -0
- package/package.json +177 -4
- package/preset.ts +196 -0
- package/primitives/code/examples.mdx +27 -0
- package/primitives/code/index.tsx +80 -0
- package/primitives/craft/demos.tsx +173 -0
- package/primitives/craft/examples.mdx +138 -0
- package/primitives/craft/index.tsx +76 -0
- package/primitives/fluid-hover/examples.mdx +84 -0
- package/primitives/fluid-hover/index.tsx +316 -0
- package/primitives/morph/examples.mdx +135 -0
- package/primitives/morph/index.tsx +192 -0
- package/primitives/motion/examples.mdx +100 -0
- package/primitives/motion/index.tsx +160 -0
- package/primitives/scroll-area/examples.mdx +58 -0
- package/primitives/scroll-area/index.tsx +200 -0
- package/primitives/separator/examples.mdx +30 -0
- package/primitives/separator/index.tsx +53 -0
- package/primitives/sizes/examples.mdx +167 -0
- package/primitives/sizes/index.tsx +89 -0
- package/primitives/skeleton/examples.mdx +51 -0
- package/primitives/skeleton/index.tsx +72 -0
- package/primitives/skeleton/skeleton.css +15 -0
- package/primitives/surface/examples.mdx +173 -0
- package/primitives/surface/index.tsx +109 -0
- package/primitives/surface/surface.css +176 -0
- package/dist/shared/components-0sn7ypjw.js +0 -61
- package/dist/shared/components-1434p1mh.js +0 -123
- package/dist/shared/components-a86dytt0.js +0 -986
- package/dist/shared/components-gf5s6ap9.js +0 -42
- package/dist/shared/components-hyq23phv.js +0 -310
- package/dist/shared/components-ng72k97e.js +0 -128
- package/dist/shared/components-raknhppb.js +0 -64
- package/dist/shared/components-vynjtrk6.js +0 -19
- package/dist/shared/components-wy9jpqny.js +0 -146
- /package/dist/shared/{components-1v7rxytx.js → components-3ey0hzpb.js} +0 -0
- /package/dist/shared/{components-ezxhrmer.js → components-jcnjay5g.js} +0 -0
|
@@ -1,51 +1,68 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
spring2
|
|
4
|
+
} from "./components-3ey0hzpb.js";
|
|
5
|
+
import {
|
|
6
|
+
opensInPlace2,
|
|
7
|
+
inPlaceOffset2,
|
|
8
|
+
useMorphOrigin2,
|
|
9
|
+
useMorph2
|
|
10
|
+
} from "./components-awra5sff.js";
|
|
7
11
|
import {
|
|
8
12
|
cn2
|
|
9
|
-
} from "./components-
|
|
13
|
+
} from "./components-jcnjay5g.js";
|
|
10
14
|
import {
|
|
11
15
|
FluidHoverHighlight2
|
|
12
|
-
} from "./components-
|
|
16
|
+
} from "./components-qdm3yh26.js";
|
|
13
17
|
import {
|
|
14
|
-
|
|
15
|
-
} from "./components-
|
|
18
|
+
useIcon2
|
|
19
|
+
} from "./components-jqpefjsn.js";
|
|
16
20
|
import {
|
|
17
|
-
|
|
18
|
-
} from "./components-
|
|
21
|
+
MorphSurface2
|
|
22
|
+
} from "./components-4y816hwp.js";
|
|
19
23
|
import {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
} from "./components-
|
|
24
|
+
shapeMap2,
|
|
25
|
+
useShape2
|
|
26
|
+
} from "./components-78x40gee.js";
|
|
23
27
|
import {
|
|
24
28
|
useSize2
|
|
25
|
-
} from "./components-
|
|
29
|
+
} from "./components-h83az0bz.js";
|
|
30
|
+
import {
|
|
31
|
+
SURFACE_BG2,
|
|
32
|
+
SURFACE_SHADOW2,
|
|
33
|
+
surfaceClasses2
|
|
34
|
+
} from "./components-vf45j12c.js";
|
|
26
35
|
import {
|
|
27
|
-
SURFACE_BG,
|
|
28
|
-
SURFACE_SHADOW,
|
|
29
|
-
surfaceClasses2,
|
|
30
36
|
useSurface2,
|
|
31
37
|
SurfaceProvider2
|
|
32
|
-
} from "./components-
|
|
38
|
+
} from "./components-dhgk6mbt.js";
|
|
33
39
|
import {
|
|
34
40
|
useFluidHover2,
|
|
35
41
|
useRegisterFluidHoverItem2
|
|
36
|
-
} from "./components-
|
|
42
|
+
} from "./components-yhgq0qxx.js";
|
|
37
43
|
import {
|
|
38
44
|
SizeProvider2
|
|
39
|
-
} from "./components-
|
|
45
|
+
} from "./components-dcc02hs2.js";
|
|
40
46
|
import {
|
|
41
47
|
Tooltip2
|
|
42
|
-
} from "./components-
|
|
48
|
+
} from "./components-q03cktx8.js";
|
|
43
49
|
import {
|
|
44
50
|
Slider2
|
|
45
|
-
} from "./components-
|
|
51
|
+
} from "./components-jp5v0m0f.js";
|
|
46
52
|
import {
|
|
47
|
-
|
|
48
|
-
|
|
53
|
+
clamp012,
|
|
54
|
+
hsvToRgb2,
|
|
55
|
+
rgbToHsv2,
|
|
56
|
+
rgbToHsl2,
|
|
57
|
+
hslToRgb2,
|
|
58
|
+
rgbToOklch2,
|
|
59
|
+
oklchToRgb2,
|
|
60
|
+
rgbToHexStr2,
|
|
61
|
+
parseColor2,
|
|
62
|
+
resolveCssColor2,
|
|
63
|
+
buildParsed2,
|
|
64
|
+
formatValueByFormat2
|
|
65
|
+
} from "./components-26snnbs9.js";
|
|
49
66
|
|
|
50
67
|
// components/inputs/color-picker/index.tsx
|
|
51
68
|
import { Menu } from "@base-ui/react/menu";
|
|
@@ -71,326 +88,6 @@ function ColorPickerPortalContainer2({ value, children }) {
|
|
|
71
88
|
});
|
|
72
89
|
}
|
|
73
90
|
var PanelSurfaceContext = createContext(true);
|
|
74
|
-
function clamp01(n) {
|
|
75
|
-
return Math.max(0, Math.min(1, n));
|
|
76
|
-
}
|
|
77
|
-
function clamp255(n) {
|
|
78
|
-
return Math.max(0, Math.min(255, n));
|
|
79
|
-
}
|
|
80
|
-
function hsvToRgb(h, s, v) {
|
|
81
|
-
const c = v * s;
|
|
82
|
-
const hh = (h % 360 + 360) % 360 / 60;
|
|
83
|
-
const x = c * (1 - Math.abs(hh % 2 - 1));
|
|
84
|
-
let r = 0, g = 0, b = 0;
|
|
85
|
-
if (hh < 1) {
|
|
86
|
-
r = c;
|
|
87
|
-
g = x;
|
|
88
|
-
b = 0;
|
|
89
|
-
} else if (hh < 2) {
|
|
90
|
-
r = x;
|
|
91
|
-
g = c;
|
|
92
|
-
b = 0;
|
|
93
|
-
} else if (hh < 3) {
|
|
94
|
-
r = 0;
|
|
95
|
-
g = c;
|
|
96
|
-
b = x;
|
|
97
|
-
} else if (hh < 4) {
|
|
98
|
-
r = 0;
|
|
99
|
-
g = x;
|
|
100
|
-
b = c;
|
|
101
|
-
} else if (hh < 5) {
|
|
102
|
-
r = x;
|
|
103
|
-
g = 0;
|
|
104
|
-
b = c;
|
|
105
|
-
} else {
|
|
106
|
-
r = c;
|
|
107
|
-
g = 0;
|
|
108
|
-
b = x;
|
|
109
|
-
}
|
|
110
|
-
const m = v - c;
|
|
111
|
-
return { r: (r + m) * 255, g: (g + m) * 255, b: (b + m) * 255 };
|
|
112
|
-
}
|
|
113
|
-
function rgbToHsv(r, g, b) {
|
|
114
|
-
r /= 255;
|
|
115
|
-
g /= 255;
|
|
116
|
-
b /= 255;
|
|
117
|
-
const max = Math.max(r, g, b);
|
|
118
|
-
const min = Math.min(r, g, b);
|
|
119
|
-
const v = max;
|
|
120
|
-
const d = max - min;
|
|
121
|
-
const s = max === 0 ? 0 : d / max;
|
|
122
|
-
let h = 0;
|
|
123
|
-
if (d > 0) {
|
|
124
|
-
if (max === r)
|
|
125
|
-
h = (g - b) / d % 6;
|
|
126
|
-
else if (max === g)
|
|
127
|
-
h = (b - r) / d + 2;
|
|
128
|
-
else
|
|
129
|
-
h = (r - g) / d + 4;
|
|
130
|
-
h *= 60;
|
|
131
|
-
if (h < 0)
|
|
132
|
-
h += 360;
|
|
133
|
-
}
|
|
134
|
-
return { h, s, v };
|
|
135
|
-
}
|
|
136
|
-
function rgbToHsl(r, g, b) {
|
|
137
|
-
r /= 255;
|
|
138
|
-
g /= 255;
|
|
139
|
-
b /= 255;
|
|
140
|
-
const max = Math.max(r, g, b);
|
|
141
|
-
const min = Math.min(r, g, b);
|
|
142
|
-
const l = (max + min) / 2;
|
|
143
|
-
const d = max - min;
|
|
144
|
-
let h = 0, s = 0;
|
|
145
|
-
if (d > 0) {
|
|
146
|
-
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
|
|
147
|
-
if (max === r)
|
|
148
|
-
h = (g - b) / d % 6;
|
|
149
|
-
else if (max === g)
|
|
150
|
-
h = (b - r) / d + 2;
|
|
151
|
-
else
|
|
152
|
-
h = (r - g) / d + 4;
|
|
153
|
-
h *= 60;
|
|
154
|
-
if (h < 0)
|
|
155
|
-
h += 360;
|
|
156
|
-
}
|
|
157
|
-
return { h, s, l };
|
|
158
|
-
}
|
|
159
|
-
function hslToRgb(h, s, l) {
|
|
160
|
-
const c = (1 - Math.abs(2 * l - 1)) * s;
|
|
161
|
-
const hh = (h % 360 + 360) % 360 / 60;
|
|
162
|
-
const x = c * (1 - Math.abs(hh % 2 - 1));
|
|
163
|
-
let r = 0, g = 0, b = 0;
|
|
164
|
-
if (hh < 1) {
|
|
165
|
-
r = c;
|
|
166
|
-
g = x;
|
|
167
|
-
} else if (hh < 2) {
|
|
168
|
-
r = x;
|
|
169
|
-
g = c;
|
|
170
|
-
} else if (hh < 3) {
|
|
171
|
-
g = c;
|
|
172
|
-
b = x;
|
|
173
|
-
} else if (hh < 4) {
|
|
174
|
-
g = x;
|
|
175
|
-
b = c;
|
|
176
|
-
} else if (hh < 5) {
|
|
177
|
-
r = x;
|
|
178
|
-
b = c;
|
|
179
|
-
} else {
|
|
180
|
-
r = c;
|
|
181
|
-
b = x;
|
|
182
|
-
}
|
|
183
|
-
const m = l - c / 2;
|
|
184
|
-
return { r: (r + m) * 255, g: (g + m) * 255, b: (b + m) * 255 };
|
|
185
|
-
}
|
|
186
|
-
function srgbToLinear(c) {
|
|
187
|
-
c = c / 255;
|
|
188
|
-
return c <= 0.04045 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;
|
|
189
|
-
}
|
|
190
|
-
function linearToSrgb(c) {
|
|
191
|
-
const v = c <= 0.0031308 ? 12.92 * c : 1.055 * c ** (1 / 2.4) - 0.055;
|
|
192
|
-
return clamp01(v) * 255;
|
|
193
|
-
}
|
|
194
|
-
function linearRgbToOklab(r, g, b) {
|
|
195
|
-
const l = 0.4122214708 * r + 0.5363325363 * g + 0.0514459929 * b;
|
|
196
|
-
const m = 0.2119034982 * r + 0.6806995451 * g + 0.1073969566 * b;
|
|
197
|
-
const s = 0.0883024619 * r + 0.2817188376 * g + 0.6299787005 * b;
|
|
198
|
-
const l_ = Math.cbrt(l);
|
|
199
|
-
const m_ = Math.cbrt(m);
|
|
200
|
-
const s_ = Math.cbrt(s);
|
|
201
|
-
return {
|
|
202
|
-
L: 0.2104542553 * l_ + 0.793617785 * m_ - 0.0040720468 * s_,
|
|
203
|
-
a: 1.9779984951 * l_ - 2.428592205 * m_ + 0.4505937099 * s_,
|
|
204
|
-
b: 0.0259040371 * l_ + 0.7827717662 * m_ - 0.808675766 * s_
|
|
205
|
-
};
|
|
206
|
-
}
|
|
207
|
-
function oklabToLinearRgb(L, a, b) {
|
|
208
|
-
const l_ = L + 0.3963377774 * a + 0.2158037573 * b;
|
|
209
|
-
const m_ = L - 0.1055613458 * a - 0.0638541728 * b;
|
|
210
|
-
const s_ = L - 0.0894841775 * a - 1.291485548 * b;
|
|
211
|
-
const l = l_ * l_ * l_;
|
|
212
|
-
const m = m_ * m_ * m_;
|
|
213
|
-
const s = s_ * s_ * s_;
|
|
214
|
-
return {
|
|
215
|
-
r: 4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s,
|
|
216
|
-
g: -1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s,
|
|
217
|
-
b: -0.0041960863 * l - 0.7034186147 * m + 1.707614701 * s
|
|
218
|
-
};
|
|
219
|
-
}
|
|
220
|
-
function rgbToOklch(r, g, b) {
|
|
221
|
-
const lr = srgbToLinear(r);
|
|
222
|
-
const lg = srgbToLinear(g);
|
|
223
|
-
const lb = srgbToLinear(b);
|
|
224
|
-
const lab = linearRgbToOklab(lr, lg, lb);
|
|
225
|
-
const C = Math.sqrt(lab.a * lab.a + lab.b * lab.b);
|
|
226
|
-
let H = Math.atan2(lab.b, lab.a) * 180 / Math.PI;
|
|
227
|
-
if (H < 0)
|
|
228
|
-
H += 360;
|
|
229
|
-
return { L: lab.L, C, H };
|
|
230
|
-
}
|
|
231
|
-
function oklchToRgb(L, C, H) {
|
|
232
|
-
const a = C * Math.cos(H * Math.PI / 180);
|
|
233
|
-
const b = C * Math.sin(H * Math.PI / 180);
|
|
234
|
-
const lin = oklabToLinearRgb(L, a, b);
|
|
235
|
-
return {
|
|
236
|
-
r: clamp255(linearToSrgb(lin.r)),
|
|
237
|
-
g: clamp255(linearToSrgb(lin.g)),
|
|
238
|
-
b: clamp255(linearToSrgb(lin.b))
|
|
239
|
-
};
|
|
240
|
-
}
|
|
241
|
-
function to2hex(n) {
|
|
242
|
-
return Math.round(clamp255(n)).toString(16).padStart(2, "0");
|
|
243
|
-
}
|
|
244
|
-
function rgbToHexStr(r, g, b, a) {
|
|
245
|
-
if (a >= 1)
|
|
246
|
-
return `#${to2hex(r)}${to2hex(g)}${to2hex(b)}`;
|
|
247
|
-
return `#${to2hex(r)}${to2hex(g)}${to2hex(b)}${to2hex(a * 255)}`;
|
|
248
|
-
}
|
|
249
|
-
function expandShortHex(h) {
|
|
250
|
-
if (h.length === 3)
|
|
251
|
-
return h.split("").map((c) => c + c).join("");
|
|
252
|
-
if (h.length === 4)
|
|
253
|
-
return h.split("").map((c) => c + c).join("");
|
|
254
|
-
return h;
|
|
255
|
-
}
|
|
256
|
-
function parseHex(input) {
|
|
257
|
-
const m = input.trim().match(/^#?([0-9a-fA-F]{3,8})$/);
|
|
258
|
-
if (!m)
|
|
259
|
-
return null;
|
|
260
|
-
let h = m[1];
|
|
261
|
-
if (h.length === 3 || h.length === 4)
|
|
262
|
-
h = expandShortHex(h);
|
|
263
|
-
if (h.length === 6) {
|
|
264
|
-
return {
|
|
265
|
-
r: parseInt(h.slice(0, 2), 16),
|
|
266
|
-
g: parseInt(h.slice(2, 4), 16),
|
|
267
|
-
b: parseInt(h.slice(4, 6), 16),
|
|
268
|
-
a: 1
|
|
269
|
-
};
|
|
270
|
-
}
|
|
271
|
-
if (h.length === 8) {
|
|
272
|
-
return {
|
|
273
|
-
r: parseInt(h.slice(0, 2), 16),
|
|
274
|
-
g: parseInt(h.slice(2, 4), 16),
|
|
275
|
-
b: parseInt(h.slice(4, 6), 16),
|
|
276
|
-
a: parseInt(h.slice(6, 8), 16) / 255
|
|
277
|
-
};
|
|
278
|
-
}
|
|
279
|
-
return null;
|
|
280
|
-
}
|
|
281
|
-
function parseAlphaPart(part) {
|
|
282
|
-
if (part === undefined)
|
|
283
|
-
return 1;
|
|
284
|
-
return part.endsWith("%") ? parseFloat(part) / 100 : parseFloat(part);
|
|
285
|
-
}
|
|
286
|
-
function parseColor2(input) {
|
|
287
|
-
const s = input.trim();
|
|
288
|
-
if (!s)
|
|
289
|
-
return null;
|
|
290
|
-
if (s.startsWith("#") || /^[0-9a-fA-F]{3,8}$/.test(s)) {
|
|
291
|
-
return parseHex(s);
|
|
292
|
-
}
|
|
293
|
-
const rgbM = s.match(/^rgba?\(\s*([^)]+)\)$/i);
|
|
294
|
-
if (rgbM) {
|
|
295
|
-
const parts = rgbM[1].split(/[\s,/]+/).filter(Boolean);
|
|
296
|
-
if (parts.length < 3)
|
|
297
|
-
return null;
|
|
298
|
-
const r = parseFloat(parts[0]);
|
|
299
|
-
const g = parseFloat(parts[1]);
|
|
300
|
-
const b = parseFloat(parts[2]);
|
|
301
|
-
const a = parseAlphaPart(parts[3]);
|
|
302
|
-
if ([r, g, b, a].some(Number.isNaN))
|
|
303
|
-
return null;
|
|
304
|
-
return { r: clamp255(r), g: clamp255(g), b: clamp255(b), a: clamp01(a) };
|
|
305
|
-
}
|
|
306
|
-
const hslM = s.match(/^hsla?\(\s*([^)]+)\)$/i);
|
|
307
|
-
if (hslM) {
|
|
308
|
-
const parts = hslM[1].split(/[\s,/]+/).filter(Boolean);
|
|
309
|
-
if (parts.length < 3)
|
|
310
|
-
return null;
|
|
311
|
-
const h = parseFloat(parts[0]);
|
|
312
|
-
const sat = parts[1].endsWith("%") ? parseFloat(parts[1]) / 100 : parseFloat(parts[1]);
|
|
313
|
-
const l = parts[2].endsWith("%") ? parseFloat(parts[2]) / 100 : parseFloat(parts[2]);
|
|
314
|
-
const a = parseAlphaPart(parts[3]);
|
|
315
|
-
if ([h, sat, l, a].some(Number.isNaN))
|
|
316
|
-
return null;
|
|
317
|
-
const rgb = hslToRgb(h, clamp01(sat), clamp01(l));
|
|
318
|
-
return { r: clamp255(rgb.r), g: clamp255(rgb.g), b: clamp255(rgb.b), a: clamp01(a) };
|
|
319
|
-
}
|
|
320
|
-
const oklchM = s.match(/^oklch\(\s*([^)]+)\)$/i);
|
|
321
|
-
if (oklchM) {
|
|
322
|
-
const parts = oklchM[1].split(/[\s,/]+/).filter(Boolean);
|
|
323
|
-
if (parts.length < 3)
|
|
324
|
-
return null;
|
|
325
|
-
const L = parts[0].endsWith("%") ? parseFloat(parts[0]) / 100 : parseFloat(parts[0]);
|
|
326
|
-
const C = parseFloat(parts[1]);
|
|
327
|
-
const H = parseFloat(parts[2]);
|
|
328
|
-
const a = parseAlphaPart(parts[3]);
|
|
329
|
-
if ([L, C, H, a].some(Number.isNaN))
|
|
330
|
-
return null;
|
|
331
|
-
const rgb = oklchToRgb(clamp01(L), Math.max(0, C), H);
|
|
332
|
-
return { r: clamp255(rgb.r), g: clamp255(rgb.g), b: clamp255(rgb.b), a: clamp01(a) };
|
|
333
|
-
}
|
|
334
|
-
return null;
|
|
335
|
-
}
|
|
336
|
-
var cssColorCtx = null;
|
|
337
|
-
function resolveCssColor(input) {
|
|
338
|
-
const direct = parseColor2(input);
|
|
339
|
-
if (direct)
|
|
340
|
-
return direct;
|
|
341
|
-
const s = input.trim();
|
|
342
|
-
if (!s || typeof document === "undefined")
|
|
343
|
-
return null;
|
|
344
|
-
if (!cssColorCtx) {
|
|
345
|
-
cssColorCtx = document.createElement("canvas").getContext("2d");
|
|
346
|
-
if (!cssColorCtx)
|
|
347
|
-
return null;
|
|
348
|
-
}
|
|
349
|
-
const ctx = cssColorCtx;
|
|
350
|
-
ctx.fillStyle = "#000000";
|
|
351
|
-
ctx.fillStyle = s;
|
|
352
|
-
const first = String(ctx.fillStyle);
|
|
353
|
-
ctx.fillStyle = "#ffffff";
|
|
354
|
-
ctx.fillStyle = s;
|
|
355
|
-
const second = String(ctx.fillStyle);
|
|
356
|
-
if (first !== second)
|
|
357
|
-
return null;
|
|
358
|
-
return parseColor2(first);
|
|
359
|
-
}
|
|
360
|
-
function buildParsed2(h, s, v, a) {
|
|
361
|
-
const { r, g, b } = hsvToRgb(h, s, v);
|
|
362
|
-
const hsl = rgbToHsl(r, g, b);
|
|
363
|
-
const oklch = rgbToOklch(r, g, b);
|
|
364
|
-
const hex = rgbToHexStr(r, g, b, a);
|
|
365
|
-
const rgbStr = a >= 1 ? `rgb(${Math.round(r)}, ${Math.round(g)}, ${Math.round(b)})` : `rgba(${Math.round(r)}, ${Math.round(g)}, ${Math.round(b)}, ${Number(a.toFixed(3))})`;
|
|
366
|
-
const hslStr = a >= 1 ? `hsl(${Math.round(hsl.h)}, ${Math.round(hsl.s * 100)}%, ${Math.round(hsl.l * 100)}%)` : `hsla(${Math.round(hsl.h)}, ${Math.round(hsl.s * 100)}%, ${Math.round(hsl.l * 100)}%, ${Number(a.toFixed(3))})`;
|
|
367
|
-
const oklchStr = a >= 1 ? `oklch(${(oklch.L * 100).toFixed(1)}% ${oklch.C.toFixed(3)} ${oklch.H.toFixed(1)})` : `oklch(${(oklch.L * 100).toFixed(1)}% ${oklch.C.toFixed(3)} ${oklch.H.toFixed(1)} / ${Number(a.toFixed(3))})`;
|
|
368
|
-
return {
|
|
369
|
-
h,
|
|
370
|
-
s,
|
|
371
|
-
v,
|
|
372
|
-
a,
|
|
373
|
-
r: Math.round(r),
|
|
374
|
-
g: Math.round(g),
|
|
375
|
-
b: Math.round(b),
|
|
376
|
-
hex,
|
|
377
|
-
rgb: rgbStr,
|
|
378
|
-
hsl: hslStr,
|
|
379
|
-
oklch: oklchStr
|
|
380
|
-
};
|
|
381
|
-
}
|
|
382
|
-
function formatValueByFormat(parsed, fmt) {
|
|
383
|
-
switch (fmt) {
|
|
384
|
-
case "hex":
|
|
385
|
-
return parsed.hex;
|
|
386
|
-
case "rgb":
|
|
387
|
-
return parsed.rgb;
|
|
388
|
-
case "hsl":
|
|
389
|
-
return parsed.hsl;
|
|
390
|
-
case "oklch":
|
|
391
|
-
return parsed.oklch;
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
91
|
var PANEL_WIDTH = 280;
|
|
395
92
|
var SQUARE_HEIGHT = 156;
|
|
396
93
|
var CHECKER_BG = {
|
|
@@ -404,13 +101,13 @@ function SaturationSquare({ h, s, v, onChange }) {
|
|
|
404
101
|
const [focused, setFocused] = useState(false);
|
|
405
102
|
const [hovered, setHovered] = useState(false);
|
|
406
103
|
const [cursorPos, setCursorPos] = useState(null);
|
|
407
|
-
const shape =
|
|
104
|
+
const shape = useShape2();
|
|
408
105
|
const updateFromPointer = useCallback((clientX, clientY) => {
|
|
409
106
|
const rect = ref.current?.getBoundingClientRect();
|
|
410
107
|
if (!rect)
|
|
411
108
|
return;
|
|
412
|
-
const x =
|
|
413
|
-
const y =
|
|
109
|
+
const x = clamp012((clientX - rect.left) / rect.width);
|
|
110
|
+
const y = clamp012((clientY - rect.top) / rect.height);
|
|
414
111
|
onChange(x, 1 - y);
|
|
415
112
|
}, [onChange]);
|
|
416
113
|
const updateCursorPos = useCallback((clientX, clientY) => {
|
|
@@ -418,8 +115,8 @@ function SaturationSquare({ h, s, v, onChange }) {
|
|
|
418
115
|
if (!rect)
|
|
419
116
|
return;
|
|
420
117
|
setCursorPos({
|
|
421
|
-
x:
|
|
422
|
-
y:
|
|
118
|
+
x: clamp012((clientX - rect.left) / rect.width) * 100,
|
|
119
|
+
y: clamp012((clientY - rect.top) / rect.height) * 100
|
|
423
120
|
});
|
|
424
121
|
}, []);
|
|
425
122
|
const onPointerDown = useCallback((e) => {
|
|
@@ -446,13 +143,13 @@ function SaturationSquare({ h, s, v, onChange }) {
|
|
|
446
143
|
const step = e.shiftKey ? 0.1 : 0.01;
|
|
447
144
|
let nextS = s, nextV = v, handled = true;
|
|
448
145
|
if (e.key === "ArrowLeft")
|
|
449
|
-
nextS =
|
|
146
|
+
nextS = clamp012(s - step);
|
|
450
147
|
else if (e.key === "ArrowRight")
|
|
451
|
-
nextS =
|
|
148
|
+
nextS = clamp012(s + step);
|
|
452
149
|
else if (e.key === "ArrowUp")
|
|
453
|
-
nextV =
|
|
150
|
+
nextV = clamp012(v + step);
|
|
454
151
|
else if (e.key === "ArrowDown")
|
|
455
|
-
nextV =
|
|
152
|
+
nextV = clamp012(v - step);
|
|
456
153
|
else
|
|
457
154
|
handled = false;
|
|
458
155
|
if (handled) {
|
|
@@ -460,7 +157,7 @@ function SaturationSquare({ h, s, v, onChange }) {
|
|
|
460
157
|
onChange(nextS, nextV);
|
|
461
158
|
}
|
|
462
159
|
}, [onChange, s, v]);
|
|
463
|
-
const { r, g, b } =
|
|
160
|
+
const { r, g, b } = hsvToRgb2(h, s, v);
|
|
464
161
|
const thumbColor = `rgb(${Math.round(r)}, ${Math.round(g)}, ${Math.round(b)})`;
|
|
465
162
|
return /* @__PURE__ */ jsxs("div", {
|
|
466
163
|
ref,
|
|
@@ -573,7 +270,7 @@ var FORMAT_LABELS = {
|
|
|
573
270
|
oklch: "OKLCH"
|
|
574
271
|
};
|
|
575
272
|
var FORMATS = ["hex", "rgb", "hsl", "oklch"];
|
|
576
|
-
var menuShape =
|
|
273
|
+
var menuShape = shapeMap2.rounded;
|
|
577
274
|
var FormatMenuContext = createContext(null);
|
|
578
275
|
function FormatItem({
|
|
579
276
|
index,
|
|
@@ -583,7 +280,7 @@ function FormatItem({
|
|
|
583
280
|
}) {
|
|
584
281
|
const ref = useRef(null);
|
|
585
282
|
const menuCtx = useContext(FormatMenuContext);
|
|
586
|
-
const shape =
|
|
283
|
+
const shape = useShape2();
|
|
587
284
|
const sizeClasses = useSize2();
|
|
588
285
|
const compact = sizeClasses.variant === "compact";
|
|
589
286
|
useRegisterFluidHoverItem2(menuCtx?.registerItem, index, ref);
|
|
@@ -622,14 +319,14 @@ function FormatDropdown({
|
|
|
622
319
|
const [internalOpen, setInternalOpen] = useState(defaultOpen);
|
|
623
320
|
const isControlled = openProp !== undefined;
|
|
624
321
|
const open = isControlled ? openProp : internalOpen;
|
|
625
|
-
const { origin, capture } =
|
|
626
|
-
const morph =
|
|
322
|
+
const { origin, capture } = useMorphOrigin2();
|
|
323
|
+
const morph = useMorph2(open, origin, { tier: "moderate" });
|
|
627
324
|
const level = Math.min(useSurface2() + 2, 8);
|
|
628
|
-
const shape =
|
|
325
|
+
const shape = useShape2();
|
|
629
326
|
const sizeClasses = useSize2();
|
|
630
327
|
const portalContainer = useContext(ColorPickerPortalContainerContext);
|
|
631
328
|
const containerRef = useRef(null);
|
|
632
|
-
const ChevronDownIcon =
|
|
329
|
+
const ChevronDownIcon = useIcon2("chevron-down");
|
|
633
330
|
const hover = useFluidHover2(containerRef);
|
|
634
331
|
const { activeIndex, setActiveIndex, itemRects, handlers, registerItem, remeasure } = hover;
|
|
635
332
|
const [focusedIndex, setFocusedIndex] = useState(null);
|
|
@@ -700,10 +397,10 @@ function FormatDropdown({
|
|
|
700
397
|
className: "relative select-none outline-none",
|
|
701
398
|
children: /* @__PURE__ */ jsx(SurfaceProvider2, {
|
|
702
399
|
value: level,
|
|
703
|
-
children: /* @__PURE__ */ jsx(
|
|
400
|
+
children: /* @__PURE__ */ jsx(MorphSurface2, {
|
|
704
401
|
morph,
|
|
705
|
-
bg:
|
|
706
|
-
shadow:
|
|
402
|
+
bg: SURFACE_BG2[level],
|
|
403
|
+
shadow: SURFACE_SHADOW2[3],
|
|
707
404
|
radius: menuShape.container,
|
|
708
405
|
className: "min-w-[var(--anchor-width)]",
|
|
709
406
|
children: /* @__PURE__ */ jsxs("div", {
|
|
@@ -792,7 +489,7 @@ var TextColorInput = forwardRef(({
|
|
|
792
489
|
}, ref) => {
|
|
793
490
|
const [draft, setDraft] = useState(value);
|
|
794
491
|
const interactingRef = useRef(false);
|
|
795
|
-
const shape =
|
|
492
|
+
const shape = useShape2();
|
|
796
493
|
const sizeClasses = useSize2();
|
|
797
494
|
const compact = sizeClasses.variant === "compact";
|
|
798
495
|
useEffect(() => {
|
|
@@ -888,7 +585,7 @@ var ScrubColorInput = forwardRef(({
|
|
|
888
585
|
max,
|
|
889
586
|
wrap = false
|
|
890
587
|
}, ref) => {
|
|
891
|
-
const shape =
|
|
588
|
+
const shape = useShape2();
|
|
892
589
|
const sizeClasses = useSize2();
|
|
893
590
|
const compact = sizeClasses.variant === "compact";
|
|
894
591
|
const inputRef = useRef(null);
|
|
@@ -1037,9 +734,9 @@ var ColorInput = forwardRef(({ scrubbable = false, ...props }, ref) => scrubbabl
|
|
|
1037
734
|
ColorInput.displayName = "ColorInput";
|
|
1038
735
|
function EyeDropperButton({ onPick }) {
|
|
1039
736
|
const [supported, setSupported] = useState(false);
|
|
1040
|
-
const shape =
|
|
737
|
+
const shape = useShape2();
|
|
1041
738
|
const sizeClasses = useSize2();
|
|
1042
|
-
const PipetteIcon =
|
|
739
|
+
const PipetteIcon = useIcon2("pipette");
|
|
1043
740
|
useEffect(() => {
|
|
1044
741
|
setSupported(typeof window !== "undefined" && "EyeDropper" in window);
|
|
1045
742
|
}, []);
|
|
@@ -1065,7 +762,7 @@ function EyeDropperButton({ onPick }) {
|
|
|
1065
762
|
});
|
|
1066
763
|
}
|
|
1067
764
|
function ColorTile2({ color, size = 24, className, style }) {
|
|
1068
|
-
const shape =
|
|
765
|
+
const shape = useShape2();
|
|
1069
766
|
return /* @__PURE__ */ jsx("span", {
|
|
1070
767
|
className: cn2("inline-block relative shrink-0 overflow-hidden shadow-swatch", shape.bg, className),
|
|
1071
768
|
style: {
|
|
@@ -1081,7 +778,7 @@ function ColorTile2({ color, size = 24, className, style }) {
|
|
|
1081
778
|
});
|
|
1082
779
|
}
|
|
1083
780
|
var ColorSwatch2 = forwardRef(({ color, size = 28, selected, className, onMouseEnter, onMouseLeave, ...props }, ref) => {
|
|
1084
|
-
const shape =
|
|
781
|
+
const shape = useShape2();
|
|
1085
782
|
const [hovered, setHovered] = useState(false);
|
|
1086
783
|
const ring = selected ? "shadow-swatch-selected" : hovered ? "shadow-swatch-hover" : "shadow-swatch";
|
|
1087
784
|
return /* @__PURE__ */ jsx("button", {
|
|
@@ -1117,16 +814,16 @@ function SwatchStrip({
|
|
|
1117
814
|
}) {
|
|
1118
815
|
const normalizedCurrent = useMemo(() => {
|
|
1119
816
|
const p = parseColor2(current);
|
|
1120
|
-
return p ?
|
|
817
|
+
return p ? rgbToHexStr2(p.r, p.g, p.b, p.a).toLowerCase() : "";
|
|
1121
818
|
}, [current]);
|
|
1122
819
|
const [resolvedSwatches, setResolvedSwatches] = useState({});
|
|
1123
820
|
useEffect(() => {
|
|
1124
821
|
const next = {};
|
|
1125
822
|
for (const sw of swatches) {
|
|
1126
823
|
if (!parseColor2(sw)) {
|
|
1127
|
-
const p =
|
|
824
|
+
const p = resolveCssColor2(sw);
|
|
1128
825
|
if (p)
|
|
1129
|
-
next[sw] =
|
|
826
|
+
next[sw] = rgbToHexStr2(p.r, p.g, p.b, p.a).toLowerCase();
|
|
1130
827
|
}
|
|
1131
828
|
}
|
|
1132
829
|
setResolvedSwatches(next);
|
|
@@ -1135,7 +832,7 @@ function SwatchStrip({
|
|
|
1135
832
|
className: "flex flex-wrap gap-2",
|
|
1136
833
|
children: swatches.map((sw, i) => {
|
|
1137
834
|
const parsed = parseColor2(sw);
|
|
1138
|
-
const normalized = parsed ?
|
|
835
|
+
const normalized = parsed ? rgbToHexStr2(parsed.r, parsed.g, parsed.b, parsed.a).toLowerCase() : resolvedSwatches[sw] ?? sw.toLowerCase();
|
|
1139
836
|
const isSelected = normalized === normalizedCurrent;
|
|
1140
837
|
return /* @__PURE__ */ jsx(ColorSwatch2, {
|
|
1141
838
|
color: sw,
|
|
@@ -1171,7 +868,7 @@ var ColorPicker2 = forwardRef(({
|
|
|
1171
868
|
const p = parseColor2(currentRawValue);
|
|
1172
869
|
if (!p)
|
|
1173
870
|
return { h: 0, s: 1, v: 1, a: 1 };
|
|
1174
|
-
const hsv =
|
|
871
|
+
const hsv = rgbToHsv2(p.r, p.g, p.b);
|
|
1175
872
|
return { h: hsv.s === 0 ? 0 : hsv.h, s: hsv.s, v: hsv.v, a: p.a };
|
|
1176
873
|
}, []);
|
|
1177
874
|
const [hsv, setHsv] = useState(initialParsed);
|
|
@@ -1188,7 +885,7 @@ var ColorPicker2 = forwardRef(({
|
|
|
1188
885
|
if (!p)
|
|
1189
886
|
return;
|
|
1190
887
|
oklchHueRef.current = null;
|
|
1191
|
-
const newHsv =
|
|
888
|
+
const newHsv = rgbToHsv2(p.r, p.g, p.b);
|
|
1192
889
|
setHsv((prev) => ({
|
|
1193
890
|
h: newHsv.s === 0 ? prev.h : newHsv.h,
|
|
1194
891
|
s: newHsv.s,
|
|
@@ -1201,7 +898,7 @@ var ColorPicker2 = forwardRef(({
|
|
|
1201
898
|
const merged = { ...hsv, ...next };
|
|
1202
899
|
setHsv(merged);
|
|
1203
900
|
const p = buildParsed2(merged.h, merged.s, merged.v, merged.a);
|
|
1204
|
-
const formatted =
|
|
901
|
+
const formatted = formatValueByFormat2(p, currentFormat);
|
|
1205
902
|
lastEmittedRef.current = formatted;
|
|
1206
903
|
if (!isControlled)
|
|
1207
904
|
setInternalValue(formatted);
|
|
@@ -1211,18 +908,18 @@ var ColorPicker2 = forwardRef(({
|
|
|
1211
908
|
if (!isFormatControlled)
|
|
1212
909
|
setInternalFormat(f);
|
|
1213
910
|
onFormatChange?.(f);
|
|
1214
|
-
const formatted =
|
|
911
|
+
const formatted = formatValueByFormat2(parsed, f);
|
|
1215
912
|
lastEmittedRef.current = formatted;
|
|
1216
913
|
if (!isControlled)
|
|
1217
914
|
setInternalValue(formatted);
|
|
1218
915
|
onValueChange?.(formatted, parsed);
|
|
1219
916
|
}, [isFormatControlled, isControlled, onFormatChange, onValueChange, parsed]);
|
|
1220
917
|
const handleHexCommit = useCallback((input) => {
|
|
1221
|
-
const p =
|
|
918
|
+
const p = resolveCssColor2(input);
|
|
1222
919
|
if (!p)
|
|
1223
920
|
return;
|
|
1224
921
|
oklchHueRef.current = null;
|
|
1225
|
-
const newHsv =
|
|
922
|
+
const newHsv = rgbToHsv2(p.r, p.g, p.b);
|
|
1226
923
|
const merged = {
|
|
1227
924
|
h: newHsv.s === 0 ? hsv.h : newHsv.h,
|
|
1228
925
|
s: newHsv.s,
|
|
@@ -1231,7 +928,7 @@ var ColorPicker2 = forwardRef(({
|
|
|
1231
928
|
};
|
|
1232
929
|
setHsv(merged);
|
|
1233
930
|
const next = buildParsed2(merged.h, merged.s, merged.v, merged.a);
|
|
1234
|
-
const formatted =
|
|
931
|
+
const formatted = formatValueByFormat2(next, currentFormat);
|
|
1235
932
|
lastEmittedRef.current = formatted;
|
|
1236
933
|
if (!isControlled)
|
|
1237
934
|
setInternalValue(formatted);
|
|
@@ -1243,12 +940,12 @@ var ColorPicker2 = forwardRef(({
|
|
|
1243
940
|
const handleEyedrop = useCallback((hex) => {
|
|
1244
941
|
handleHexCommit(hex);
|
|
1245
942
|
}, [handleHexCommit]);
|
|
1246
|
-
const solidHueRgb = useMemo(() =>
|
|
943
|
+
const solidHueRgb = useMemo(() => hsvToRgb2(hsv.h, hsv.s, hsv.v), [hsv.h, hsv.s, hsv.v]);
|
|
1247
944
|
const solidR = Math.round(solidHueRgb.r);
|
|
1248
945
|
const solidG = Math.round(solidHueRgb.g);
|
|
1249
946
|
const solidB = Math.round(solidHueRgb.b);
|
|
1250
947
|
const solidColorString = `rgb(${solidR}, ${solidG}, ${solidB})`;
|
|
1251
|
-
const shape =
|
|
948
|
+
const shape = useShape2();
|
|
1252
949
|
const substrate = useSurface2();
|
|
1253
950
|
const pickerLevel = Math.max(substrate, 3);
|
|
1254
951
|
const paintsSurface = useContext(PanelSurfaceContext);
|
|
@@ -1317,7 +1014,7 @@ var ColorPicker2 = forwardRef(({
|
|
|
1317
1014
|
const r = channel === "r" ? Number(value) : p.r;
|
|
1318
1015
|
const g = channel === "g" ? Number(value) : p.g;
|
|
1319
1016
|
const b = channel === "b" ? Number(value) : p.b;
|
|
1320
|
-
const hsvVal =
|
|
1017
|
+
const hsvVal = rgbToHsv2(r, g, b);
|
|
1321
1018
|
updateHsv({
|
|
1322
1019
|
h: hsvVal.s === 0 ? hsv.h : hsvVal.h,
|
|
1323
1020
|
s: hsvVal.s,
|
|
@@ -1330,12 +1027,12 @@ var ColorPicker2 = forwardRef(({
|
|
|
1330
1027
|
case "lSL": {
|
|
1331
1028
|
if (channel === "hSL")
|
|
1332
1029
|
oklchHueRef.current = null;
|
|
1333
|
-
const hsl =
|
|
1030
|
+
const hsl = rgbToHsl2(p.r, p.g, p.b);
|
|
1334
1031
|
const h2 = channel === "hSL" ? Number(value) : hsl.h;
|
|
1335
1032
|
const s2 = channel === "sSL" ? Number(value) / 100 : hsl.s;
|
|
1336
1033
|
const l2 = channel === "lSL" ? Number(value) / 100 : hsl.l;
|
|
1337
|
-
const rgb =
|
|
1338
|
-
const hsvVal =
|
|
1034
|
+
const rgb = hslToRgb2(h2, clamp012(s2), clamp012(l2));
|
|
1035
|
+
const hsvVal = rgbToHsv2(rgb.r, rgb.g, rgb.b);
|
|
1339
1036
|
updateHsv({
|
|
1340
1037
|
h: hsvVal.s === 0 ? h2 : hsvVal.h,
|
|
1341
1038
|
s: hsvVal.s,
|
|
@@ -1346,14 +1043,14 @@ var ColorPicker2 = forwardRef(({
|
|
|
1346
1043
|
case "L":
|
|
1347
1044
|
case "C":
|
|
1348
1045
|
case "H": {
|
|
1349
|
-
const cur =
|
|
1046
|
+
const cur = rgbToOklch2(p.r, p.g, p.b);
|
|
1350
1047
|
const baseH = oklchHueRef.current ?? cur.H;
|
|
1351
1048
|
const L = channel === "L" ? Number(value) / 100 : cur.L;
|
|
1352
1049
|
const C = channel === "C" ? Number(value) : cur.C;
|
|
1353
1050
|
const H = channel === "H" ? Number(value) : baseH;
|
|
1354
1051
|
oklchHueRef.current = H;
|
|
1355
|
-
const rgb =
|
|
1356
|
-
const hsvVal =
|
|
1052
|
+
const rgb = oklchToRgb2(clamp012(L), Math.max(0, C), H);
|
|
1053
|
+
const hsvVal = rgbToHsv2(rgb.r, rgb.g, rgb.b);
|
|
1357
1054
|
updateHsv({
|
|
1358
1055
|
h: hsvVal.s === 0 ? hsv.h : hsvVal.h,
|
|
1359
1056
|
s: hsvVal.s,
|
|
@@ -1362,7 +1059,7 @@ var ColorPicker2 = forwardRef(({
|
|
|
1362
1059
|
return;
|
|
1363
1060
|
}
|
|
1364
1061
|
case "alphaPercent": {
|
|
1365
|
-
const a =
|
|
1062
|
+
const a = clamp012(Number(value) / 100);
|
|
1366
1063
|
updateHsv({ a });
|
|
1367
1064
|
return;
|
|
1368
1065
|
}
|
|
@@ -1468,7 +1165,7 @@ function ColorInputsRow({
|
|
|
1468
1165
|
});
|
|
1469
1166
|
}
|
|
1470
1167
|
if (format === "hsl") {
|
|
1471
|
-
const hsl =
|
|
1168
|
+
const hsl = rgbToHsl2(parsed.r, parsed.g, parsed.b);
|
|
1472
1169
|
return /* @__PURE__ */ jsxs("div", {
|
|
1473
1170
|
className: "grid grid-cols-4 gap-1",
|
|
1474
1171
|
children: [
|
|
@@ -1525,7 +1222,7 @@ function ColorInputsRow({
|
|
|
1525
1222
|
]
|
|
1526
1223
|
});
|
|
1527
1224
|
}
|
|
1528
|
-
const oklch =
|
|
1225
|
+
const oklch = rgbToOklch2(parsed.r, parsed.g, parsed.b);
|
|
1529
1226
|
const displayH = oklchHue ?? oklch.H;
|
|
1530
1227
|
return /* @__PURE__ */ jsxs("div", {
|
|
1531
1228
|
className: "grid grid-cols-4 gap-1",
|
|
@@ -1636,9 +1333,9 @@ var ColorPickerPopover2 = forwardRef(({
|
|
|
1636
1333
|
const isOpenControlled = openProp !== undefined;
|
|
1637
1334
|
const [internalOpen, setInternalOpen] = useState(defaultOpen);
|
|
1638
1335
|
const open = isOpenControlled ? openProp : internalOpen;
|
|
1639
|
-
const { origin, capture } =
|
|
1640
|
-
const morph =
|
|
1641
|
-
const shape =
|
|
1336
|
+
const { origin, capture } = useMorphOrigin2();
|
|
1337
|
+
const morph = useMorph2(open, origin, { from, effect, hideSource, tier });
|
|
1338
|
+
const shape = useShape2();
|
|
1642
1339
|
const sizeClasses = useSize2(size);
|
|
1643
1340
|
const compact = sizeClasses.variant === "compact";
|
|
1644
1341
|
const substrate = useSurface2();
|
|
@@ -1658,10 +1355,10 @@ var ColorPickerPopover2 = forwardRef(({
|
|
|
1658
1355
|
setInternalValue(v);
|
|
1659
1356
|
pickerProps.onValueChange?.(v, parsed);
|
|
1660
1357
|
}, [isControlled, pickerProps]);
|
|
1661
|
-
const XIcon =
|
|
1358
|
+
const XIcon = useIcon2("x");
|
|
1662
1359
|
const parsed = useMemo(() => parseColor2(currentValue), [currentValue]);
|
|
1663
|
-
const swatchColor = parsed ?
|
|
1664
|
-
const valueLabel = parsed ?
|
|
1360
|
+
const swatchColor = parsed ? rgbToHexStr2(parsed.r, parsed.g, parsed.b, parsed.a) : currentValue;
|
|
1361
|
+
const valueLabel = parsed ? rgbToHexStr2(parsed.r, parsed.g, parsed.b, 1).replace(/^#/, "").toUpperCase() : currentValue;
|
|
1665
1362
|
const root = /* @__PURE__ */ jsx(Popover.Root, {
|
|
1666
1363
|
open,
|
|
1667
1364
|
onOpenChange: handleOpenChange,
|
|
@@ -1716,7 +1413,7 @@ var ColorPickerPopover2 = forwardRef(({
|
|
|
1716
1413
|
children: /* @__PURE__ */ jsx(Popover.Positioner, {
|
|
1717
1414
|
side: "bottom",
|
|
1718
1415
|
align: "start",
|
|
1719
|
-
sideOffset:
|
|
1416
|
+
sideOffset: opensInPlace2({ effect, hideSource }) ? inPlaceOffset2 : 6,
|
|
1720
1417
|
className: "z-50 outline-none",
|
|
1721
1418
|
children: /* @__PURE__ */ jsx(Popover.Popup, {
|
|
1722
1419
|
ref: morph.popupRef,
|
|
@@ -1725,10 +1422,10 @@ var ColorPickerPopover2 = forwardRef(({
|
|
|
1725
1422
|
value: morph.popup,
|
|
1726
1423
|
children: /* @__PURE__ */ jsx(SurfaceProvider2, {
|
|
1727
1424
|
value: level,
|
|
1728
|
-
children: /* @__PURE__ */ jsx(
|
|
1425
|
+
children: /* @__PURE__ */ jsx(MorphSurface2, {
|
|
1729
1426
|
morph,
|
|
1730
|
-
bg:
|
|
1731
|
-
shadow:
|
|
1427
|
+
bg: SURFACE_BG2[level],
|
|
1428
|
+
shadow: SURFACE_SHADOW2[3],
|
|
1732
1429
|
radius: shape.container,
|
|
1733
1430
|
children: /* @__PURE__ */ jsx(PanelSurfaceContext.Provider, {
|
|
1734
1431
|
value: false,
|
|
@@ -1756,4 +1453,4 @@ ColorPickerPopover2.displayName = "ColorPickerPopover";
|
|
|
1756
1453
|
Object.assign(ColorPicker2, { Popover: ColorPickerPopover2 });
|
|
1757
1454
|
var color_picker_default = ColorPicker2;
|
|
1758
1455
|
|
|
1759
|
-
export { ColorPickerPortalContainer2,
|
|
1456
|
+
export { ColorPickerPortalContainer2, ColorTile2, ColorSwatch2, ColorPicker2, ColorPickerPopover2, color_picker_default };
|