@justanarthur/modo-ui 1.0.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 +59 -20
- 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/index.tsx +3 -2
- package/blocks/sidebar-app/thread-page.tsx +2 -2
- package/components/{button → actions/button}/index.tsx +14 -22
- package/components/actions/button/variants.ts +138 -0
- package/components/{copy → actions/copy}/examples.mdx +40 -2
- package/components/{copy → actions/copy}/index.tsx +206 -36
- package/components/{accordion → containers/accordion}/accordion-content.tsx +14 -11
- package/components/{accordion → containers/accordion}/accordion-context.tsx +21 -12
- package/components/{accordion → containers/accordion}/accordion-group.tsx +11 -11
- package/components/{accordion → containers/accordion}/index.tsx +95 -47
- package/components/{card → containers/card}/card-group.tsx +7 -7
- package/components/{card → containers/card}/card-media.tsx +5 -5
- package/components/{card → containers/card}/card-parts.tsx +27 -17
- package/components/{card → containers/card}/examples.mdx +3 -2
- package/components/{card → containers/card}/index.tsx +12 -11
- package/components/{avatar → data-display/avatar}/examples.mdx +1 -1
- package/components/{avatar → data-display/avatar}/index.tsx +5 -5
- package/components/{badge → data-display/badge}/change-demo.tsx +1 -1
- package/components/{badge → data-display/badge}/index.tsx +8 -10
- package/components/{badge → data-display/badge}/variants.ts +7 -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/{table → data-display/table}/context.ts +12 -2
- package/components/{table → data-display/table}/head.tsx +5 -5
- package/components/{table → data-display/table}/index.tsx +40 -14
- package/components/{table → data-display/table}/parts.tsx +66 -52
- 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/{progress → feedback/progress}/examples.mdx +2 -2
- package/components/{progress → feedback/progress}/index.tsx +5 -5
- package/components/{progress → feedback/progress}/step-demo.tsx +1 -1
- package/components/feedback/status-dot/examples.mdx +75 -0
- package/components/feedback/status-dot/index.tsx +105 -0
- package/components/inputs/checkbox/index.tsx +15 -9
- package/components/inputs/choice-list/examples.mdx +101 -0
- package/components/inputs/choice-list/index.tsx +186 -0
- package/components/inputs/color-picker/examples.mdx +10 -0
- package/components/inputs/color-picker/format-menu.tsx +1 -1
- package/components/inputs/color-picker/index.tsx +26 -10
- package/components/inputs/color-picker/inputs-row.tsx +1 -1
- package/components/inputs/color-picker/popover.tsx +40 -8
- package/components/inputs/color-picker/saturation-square.tsx +1 -1
- package/components/inputs/color-picker/swatches.tsx +1 -1
- package/components/inputs/combobox/context.ts +25 -1
- package/components/inputs/combobox/examples.mdx +1 -1
- package/components/inputs/combobox/fields.tsx +100 -51
- package/components/inputs/combobox/index.tsx +218 -200
- package/components/inputs/combobox/list.tsx +1 -1
- package/components/inputs/combobox/remote-demo.tsx +1 -1
- package/components/inputs/date-time/calendar/index.tsx +6 -3
- package/components/inputs/date-time/date-picker/examples.mdx +36 -0
- package/components/inputs/date-time/date-picker/index.tsx +106 -20
- package/components/inputs/date-time/date-range-picker/examples.mdx +36 -0
- package/components/inputs/date-time/date-range-picker/index.tsx +331 -54
- package/components/inputs/date-time/day-rules.ts +6 -3
- package/components/inputs/date-time/duration-picker/examples.mdx +16 -0
- package/components/inputs/date-time/duration-picker/index.tsx +74 -22
- package/components/inputs/date-time/month-picker/examples.mdx +12 -0
- package/components/inputs/date-time/month-picker/index.tsx +76 -21
- package/components/inputs/date-time/picker-shell.tsx +142 -11
- package/components/inputs/date-time/time-columns.tsx +5 -2
- package/components/inputs/date-time/time-picker/examples.mdx +13 -0
- package/components/inputs/date-time/time-picker/index.tsx +63 -12
- package/components/inputs/editable-text/examples.mdx +33 -0
- package/components/inputs/editable-text/index.tsx +175 -0
- package/components/inputs/field/index.tsx +1 -1
- package/components/inputs/file-dropzone/file-row.tsx +2 -2
- package/components/inputs/file-dropzone/index.tsx +5 -0
- package/components/inputs/input/index.tsx +1 -1
- package/components/inputs/key-value/examples.mdx +58 -0
- package/components/inputs/key-value/index.tsx +232 -0
- package/components/inputs/label/examples.mdx +1 -1
- package/components/inputs/number-input/index.tsx +4 -4
- package/components/inputs/radio/examples.mdx +10 -0
- package/components/inputs/radio/index.tsx +15 -6
- package/components/inputs/search/examples.mdx +1 -1
- package/components/inputs/search/index.tsx +1 -1
- package/components/inputs/select/examples.mdx +28 -1
- package/components/inputs/select/index.tsx +248 -167
- package/components/inputs/switch/index.tsx +1 -1
- package/components/navigation/breadcrumb/examples.mdx +45 -0
- package/components/navigation/breadcrumb/index.tsx +284 -0
- package/components/navigation/navigation-menu/context.ts +5 -1
- package/components/navigation/navigation-menu/examples.mdx +23 -0
- package/components/navigation/navigation-menu/index.tsx +8 -1
- package/components/navigation/navigation-menu/indicator.tsx +38 -0
- package/components/navigation/navigation-menu/list.tsx +33 -22
- package/components/navigation/pagination/index.tsx +2 -2
- package/components/navigation/sidebar/index.tsx +1 -1
- package/components/navigation/sidebar/sidebar-menu-item.tsx +1 -1
- package/components/navigation/sidebar/sidebar-rail.tsx +1 -1
- package/components/navigation/tabs/examples.mdx +11 -0
- package/components/navigation/tabs/index.tsx +1 -1
- package/components/navigation/tabs/item.tsx +3 -3
- package/components/navigation/tree/examples.mdx +76 -0
- package/components/navigation/tree/index.tsx +431 -0
- package/components/overlays/alert-dialog/examples.mdx +1 -1
- package/components/overlays/alert-dialog/index.tsx +37 -26
- package/components/overlays/alert-dialog/pending-demo.tsx +1 -1
- package/components/overlays/command/examples.mdx +2 -2
- package/components/overlays/command/index.tsx +20 -17
- package/components/overlays/context-menu/index.tsx +38 -29
- package/components/overlays/dialog/examples.mdx +22 -2
- package/components/overlays/dialog/index.tsx +87 -32
- package/components/overlays/dropdown/examples.mdx +86 -2
- package/components/overlays/dropdown/index.tsx +136 -48
- package/components/overlays/dropdown/menu-item.tsx +165 -65
- package/components/overlays/dropdown/menu-parts.tsx +153 -0
- package/components/overlays/dropdown/menu-popup.tsx +52 -10
- package/components/overlays/dropdown/panel-state.ts +49 -16
- package/components/overlays/dropdown/submenu.tsx +26 -27
- package/components/overlays/lightbox/examples.mdx +29 -0
- package/components/overlays/lightbox/index.tsx +395 -0
- package/components/overlays/popover/anchored-demo.tsx +1 -1
- package/components/overlays/popover/examples.mdx +1 -1
- package/components/overlays/popover/index.tsx +27 -24
- package/components/overlays/preview-card/index.tsx +16 -13
- package/components/overlays/sheet/examples.mdx +14 -1
- package/components/overlays/sheet/index.tsx +122 -54
- package/components/overlays/toast/examples.mdx +17 -1
- package/components/overlays/toast/index.tsx +117 -45
- package/components/overlays/toast/manager.ts +45 -12
- package/components/overlays/tooltip/examples.mdx +7 -7
- package/components/overlays/tooltip/index.tsx +59 -50
- package/dist/base.css +62 -82
- 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 +24 -4
- package/dist/blocks/sidebar-app/index.js +43 -37
- package/dist/components/{button → actions/button}/index.d.ts +28 -12
- package/dist/components/actions/button/index.js +22 -0
- package/dist/components/actions/button/variants.d.ts +29 -0
- package/dist/components/{button → actions/button}/variants.js +1 -1
- package/dist/components/actions/copy/index.d.ts +79 -0
- package/dist/components/actions/copy/index.js +26 -0
- package/dist/components/{accordion → containers/accordion}/index.d.ts +51 -19
- package/dist/components/containers/accordion/index.js +40 -0
- package/dist/components/{card → containers/card}/index.d.ts +27 -23
- package/dist/components/containers/card/index.js +58 -0
- package/dist/components/data-display/avatar/index.js +20 -0
- package/dist/components/{badge → data-display/badge}/index.d.ts +6 -3
- package/dist/components/data-display/badge/index.js +21 -0
- package/dist/components/{badge → data-display/badge}/variants.d.ts +6 -1
- package/dist/components/{badge → data-display/badge}/variants.js +1 -1
- 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/{table → data-display/table}/index.d.ts +24 -7
- 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.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 +8 -5
- package/dist/components/inputs/checkbox/index.js +13 -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 +39 -23
- package/dist/components/inputs/color-picker/index.js +27 -25
- 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 +40 -9
- package/dist/components/inputs/combobox/index.js +21 -21
- package/dist/components/inputs/date-time/calendar/index.d.ts +6 -1
- package/dist/components/inputs/date-time/calendar/index.js +10 -10
- package/dist/components/inputs/date-time/date-picker/index.d.ts +48 -8
- package/dist/components/inputs/date-time/date-picker/index.js +31 -31
- package/dist/components/inputs/date-time/date-range-picker/index.d.ts +99 -18
- package/dist/components/inputs/date-time/date-range-picker/index.js +32 -30
- package/dist/components/inputs/date-time/duration-picker/index.d.ts +52 -9
- package/dist/components/inputs/date-time/duration-picker/index.js +29 -29
- package/dist/components/inputs/date-time/month-picker/index.d.ts +49 -8
- package/dist/components/inputs/date-time/month-picker/index.js +28 -28
- package/dist/components/inputs/date-time/time-picker/index.d.ts +47 -8
- package/dist/components/inputs/date-time/time-picker/index.js +29 -29
- 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.js +8 -8
- package/dist/components/inputs/file-dropzone/index.d.ts +3 -1
- package/dist/components/inputs/file-dropzone/index.js +10 -10
- package/dist/components/inputs/input/index.js +9 -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.js +2 -2
- package/dist/components/inputs/number-input/index.d.ts +3 -2
- package/dist/components/inputs/number-input/index.js +11 -11
- package/dist/components/inputs/radio/index.d.ts +2 -2
- package/dist/components/inputs/radio/index.js +11 -11
- package/dist/components/inputs/search/index.js +23 -23
- package/dist/components/inputs/select/index.d.ts +71 -47
- package/dist/components/inputs/select/index.js +23 -22
- package/dist/components/inputs/slider/index.js +4 -4
- package/dist/components/inputs/switch/index.js +9 -9
- package/dist/components/inputs/textarea/index.js +5 -5
- 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 +13 -2
- package/dist/components/navigation/navigation-menu/index.js +20 -18
- package/dist/components/navigation/pagination/index.js +19 -19
- package/dist/components/navigation/sidebar/index.d.ts +1 -9
- package/dist/components/navigation/sidebar/index.js +26 -26
- package/dist/components/navigation/tabs/index.d.ts +5 -5
- package/dist/components/navigation/tabs/index.js +12 -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 +35 -15
- package/dist/components/overlays/alert-dialog/index.js +15 -15
- package/dist/components/overlays/command/index.d.ts +6 -1
- package/dist/components/overlays/command/index.js +21 -21
- package/dist/components/overlays/context-menu/index.d.ts +138 -14
- package/dist/components/overlays/context-menu/index.js +29 -26
- package/dist/components/overlays/dialog/index.d.ts +43 -15
- package/dist/components/overlays/dialog/index.js +14 -14
- package/dist/components/overlays/dropdown/index.d.ts +163 -59
- package/dist/components/overlays/dropdown/index.js +37 -26
- 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 +7 -1
- package/dist/components/overlays/popover/index.js +11 -11
- package/dist/components/overlays/preview-card/index.d.ts +4 -1
- package/dist/components/overlays/preview-card/index.js +10 -10
- package/dist/components/overlays/sheet/index.d.ts +49 -8
- package/dist/components/overlays/sheet/index.js +15 -15
- package/dist/components/overlays/toast/index.d.ts +92 -39
- package/dist/components/overlays/toast/index.js +13 -11
- package/dist/components/overlays/tooltip/index.d.ts +16 -6
- package/dist/components/overlays/tooltip/index.js +8 -8
- 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 +3722 -2274
- package/dist/index.js +240 -115
- package/dist/lib/date-locale.d.ts +13 -1
- package/dist/lib/date-locale.js +11 -3
- package/dist/lib/field-box.js +3 -3
- package/dist/lib/fluid-hover-highlight.js +4 -4
- package/dist/lib/focus-ring.js +3 -3
- package/dist/lib/goo-indicator.js +3 -3
- package/dist/lib/icon-context.d.ts +7 -2
- package/dist/lib/icon-context.js +4 -2
- package/dist/lib/morph-layers.js +3 -3
- package/dist/lib/overlay.js +3 -3
- package/dist/lib/popup-rows.js +2 -2
- package/dist/lib/popup-surface.js +7 -7
- package/dist/lib/row-index.d.ts +6 -9
- package/dist/lib/row-index.js +1 -1
- package/dist/lib/row-order.d.ts +28 -0
- package/dist/lib/row-order.js +11 -0
- package/dist/lib/scroll-column.js +6 -6
- package/dist/lib/shape-context.d.ts +8 -1
- package/dist/lib/shape-context.js +4 -2
- package/dist/lib/slot.d.ts +9 -2
- package/dist/lib/slot.js +5 -3
- package/dist/lib/use-merge-split.js +4 -4
- package/dist/lib/use-morph.js +1 -1
- package/dist/lib/utils.js +1 -1
- package/dist/lib/weight-label.js +2 -2
- package/dist/preset.d.ts +9 -0
- package/dist/preset.js +11 -2
- package/dist/primitives/content/code/index.js +14 -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/layout/scroll-area/index.js +14 -0
- package/dist/primitives/{separator → layout/separator}/index.js +2 -2
- 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/systems/craft/index.js +16 -0
- package/dist/primitives/systems/fluid-hover/index.js +30 -0
- package/dist/primitives/{morph → systems/morph}/index.d.ts +3 -1
- package/dist/primitives/systems/morph/index.js +30 -0
- package/dist/primitives/systems/motion/index.js +25 -0
- package/dist/primitives/{sizes → systems/sizes}/index.d.ts +2 -2
- package/dist/primitives/{sizes → systems/sizes}/index.js +4 -4
- package/dist/primitives/{surface → systems/surface}/index.js +6 -6
- package/dist/shared/{components-7t3pz7v7.js → components-0cpte6s1.js} +76 -40
- package/dist/shared/{components-gc5zky2w.js → components-0h2mng6m.js} +7 -7
- package/dist/shared/{components-62mg6pab.js → components-14wzcym0.js} +16 -16
- package/dist/shared/components-1asw2ph0.js +237 -0
- package/dist/shared/{components-p0z99d5b.js → components-1bnf96sr.js} +17 -15
- package/dist/shared/components-1f3a7gmg.js +168 -0
- package/dist/shared/components-1hb27y2e.js +77 -0
- package/dist/shared/{components-1axxc3tk.js → components-1hga6pkn.js} +8 -8
- package/dist/shared/{components-wyfmhtw9.js → components-1ztgy933.js} +2 -2
- package/dist/shared/{components-0h3f5jae.js → components-22h8dvt1.js} +19 -16
- package/dist/shared/{components-07g2gbjy.js → components-280grw6q.js} +19 -12
- package/dist/shared/components-29ebea21.js +129 -0
- package/dist/shared/{components-zbzx62pg.js → components-2m2hg11x.js} +93 -378
- package/dist/shared/components-3rvrdsa9.js +208 -0
- package/dist/shared/components-464zs8v6.js +152 -0
- package/dist/shared/components-4t2cjav8.js +73 -0
- package/dist/shared/{components-9ybenn5v.js → components-5xs8pkkj.js} +5 -5
- package/dist/shared/{components-gbsdhmrv.js → components-62510420.js} +62 -27
- package/dist/shared/components-6h5qg9rs.js +188 -0
- package/dist/shared/{components-7fsy0jxg.js → components-6rtawx8y.js} +108 -75
- package/dist/shared/{components-n7e31ct4.js → components-77gxngmc.js} +8 -8
- package/dist/shared/components-7mj5wsv3.js +200 -0
- package/dist/shared/{components-amsc86fb.js → components-7xc2dne4.js} +68 -37
- package/dist/shared/{components-pedbt2dc.js → components-8pnvkrbw.js} +1 -1
- package/dist/shared/{components-be3wggg1.js → components-91mmbrw3.js} +5 -5
- package/dist/shared/components-92mvpt9h.js +243 -0
- package/dist/shared/{components-jtfptckj.js → components-9ca0c92a.js} +6 -6
- package/dist/shared/{components-ejn6tvbw.js → components-9h3g4mnq.js} +1 -1
- package/dist/shared/components-9rebr89j.js +249 -0
- package/dist/shared/{components-re8p99fj.js → components-9z7bq8gn.js} +147 -21
- package/dist/shared/{components-3js2vgds.js → components-a1ms36qq.js} +3 -3
- package/dist/shared/{components-q4wyd06h.js → components-a1mwqxsv.js} +88 -22
- package/dist/shared/{components-cy5z8zxy.js → components-azrjnfxn.js} +2 -2
- package/dist/shared/{components-85epgxwf.js → components-b2kjsn1s.js} +60 -37
- package/dist/shared/{components-vgzerqt0.js → components-b7p1pjcm.js} +8 -7
- package/dist/shared/{components-j4z3rtw2.js → components-b9bj65j3.js} +46 -21
- package/dist/shared/{components-0mrhj88d.js → components-c515d6xr.js} +2 -2
- package/dist/shared/{components-5f3tq4qb.js → components-chda6b23.js} +2 -2
- package/dist/shared/{components-az04rmng.js → components-cp5ym3g2.js} +2 -2
- package/dist/shared/components-czvraaw9.js +135 -0
- package/dist/shared/{components-kn5c7652.js → components-e7zxwja1.js} +7 -6
- package/dist/shared/components-ee09xmkh.js +359 -0
- package/dist/shared/{components-3m4rqrqm.js → components-esy5nsvc.js} +3 -3
- package/dist/shared/{components-34brwmgp.js → components-ev0ytbqb.js} +12 -10
- package/dist/shared/{components-zpatc9x3.js → components-fmyvz4r2.js} +9 -8
- package/dist/shared/{components-f9adtfq8.js → components-fpsfr52a.js} +1 -1
- package/dist/shared/{components-zf0nnvvg.js → components-fqsgd07c.js} +68 -24
- package/dist/shared/{components-5vyaexsj.js → components-g35n8tzm.js} +2 -2
- package/dist/shared/components-g8qgr7p8.js +28 -0
- package/dist/shared/{components-88r046aa.js → components-gd8gmr6w.js} +4 -4
- package/dist/shared/{components-f75y4gn8.js → components-gsstwhtv.js} +6 -6
- package/dist/shared/{components-1hc3xv0y.js → components-h0x2pj2y.js} +170 -118
- package/dist/shared/components-h8v9nh5r.js +142 -0
- package/dist/shared/{components-6xfhc5qm.js → components-hcftn5r8.js} +14 -12
- package/dist/shared/components-hh1g7r3t.js +57 -0
- package/dist/shared/{components-jm91mjm1.js → components-hz6armxa.js} +13 -9
- package/dist/shared/{components-k81x1aea.js → components-j3q9kaps.js} +2 -2
- package/dist/shared/{components-88ktjdg0.js → components-j79a6jqa.js} +13 -12
- package/dist/shared/{components-k785rge6.js → components-jeecysvd.js} +24 -168
- package/dist/shared/{components-1nv9q3s8.js → components-jnhpgpfk.js} +29 -2
- package/dist/shared/{components-wgd1nebp.js → components-jw45ck66.js} +4 -4
- package/dist/shared/{components-7fqnqbh0.js → components-kwxye0an.js} +10 -4
- package/dist/shared/{components-qrpdtvxa.js → components-kxpcj2ry.js} +7 -1
- package/dist/shared/components-m3vxpz2z.js +123 -0
- package/dist/shared/{components-86vvx0c8.js → components-me742146.js} +9 -9
- package/dist/shared/{components-jx9qb4z8.js → components-n0gbyp5a.js} +18 -16
- package/dist/shared/{components-8hfrd2fk.js → components-nhmgr5xc.js} +14 -14
- package/dist/shared/{components-nv5m3gcv.js → components-nxqrw789.js} +2 -2
- package/dist/shared/{components-1a7cr7vh.js → components-nz14rwtd.js} +1 -1
- package/dist/shared/{components-j8tcbm8y.js → components-p32aqk3q.js} +2 -2
- package/dist/shared/components-pa2t12j2.js +327 -0
- package/dist/shared/{components-r33dxr5j.js → components-q0hs5rqn.js} +1 -1
- package/dist/shared/{components-xzcgr3gy.js → components-q7zk70tx.js} +6 -6
- package/dist/shared/{components-8sazy704.js → components-r5q9gdh4.js} +13 -12
- package/dist/shared/{components-tjxy84s9.js → components-rgng034x.js} +1 -1
- package/dist/shared/{components-skn189mp.js → components-rzy6h7s4.js} +5 -5
- package/dist/shared/{components-wrbw67f6.js → components-s4x951hj.js} +3 -3
- package/dist/shared/{components-gw0wd7gd.js → components-s90v3jpr.js} +371 -187
- package/dist/shared/components-t0c1rw40.js +75 -0
- package/dist/shared/components-t84071ay.js +76 -0
- package/dist/shared/{components-0p2na0cp.js → components-ta4e10mx.js} +3 -3
- package/dist/shared/components-twyj2y8c.js +336 -0
- package/dist/shared/components-vfreweq3.js +210 -0
- package/dist/shared/{components-2xmke84n.js → components-w1ysefg1.js} +2 -2
- package/dist/shared/{components-5atrr490.js → components-w2at9ntm.js} +27 -13
- package/dist/shared/{components-346ged8v.js → components-wq9hrera.js} +2 -2
- package/dist/shared/{components-tnj6mkhg.js → components-wx1dcp2n.js} +17 -10
- package/dist/shared/components-xa9fvd5b.js +302 -0
- package/dist/shared/{components-1jxw899c.js → components-xnkc892z.js} +8 -6
- package/dist/shared/{components-ycx2kxeq.js → components-xnp09586.js} +1 -1
- package/dist/shared/{components-vp6vzsee.js → components-y09nr7fe.js} +1 -1
- package/dist/shared/{components-sesrjvcc.js → components-y4gsk1jt.js} +3 -3
- package/dist/shared/{components-099sdasz.js → components-y8m64zdw.js} +31 -22
- package/dist/shared/components-yf2gtq68.js +302 -0
- package/dist/shared/{components-xpw8dzb0.js → components-ymq8tbq9.js} +2 -2
- package/dist/shared/components-ywgqahmg.js +80 -0
- package/dist/shared/{components-5ynncdpn.js → components-z0kz9rxj.js} +2 -2
- package/dist/styles.css +212 -137
- package/dist/tailwind.css +14 -0
- package/dist/tokens.css +37 -4
- 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 +40 -21
- package/lib/date-locale.ts +152 -6
- package/lib/icon-context.tsx +45 -1
- package/lib/row-index.tsx +6 -16
- package/lib/row-order.tsx +111 -0
- package/lib/shape-context.tsx +9 -1
- package/lib/slot.tsx +17 -4
- package/lib/use-autosize-textarea.ts +1 -1
- package/lib/use-morph.ts +1 -1
- package/lib/utils.ts +1 -1
- package/package.json +200 -38
- package/primitives/{code → content/code}/index.tsx +4 -4
- package/primitives/{skeleton → content/skeleton}/examples.mdx +1 -1
- package/primitives/{skeleton → content/skeleton}/index.tsx +4 -4
- package/primitives/layout/resizable/examples.mdx +93 -0
- package/primitives/layout/resizable/index.tsx +332 -0
- package/primitives/{scroll-area → layout/scroll-area}/index.tsx +3 -3
- package/primitives/{separator → layout/separator}/examples.mdx +1 -1
- package/primitives/{separator → layout/separator}/index.tsx +1 -1
- 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/{craft → systems/craft}/demos.tsx +8 -8
- package/primitives/{craft → systems/craft}/examples.mdx +5 -5
- package/primitives/{craft → systems/craft}/index.tsx +3 -3
- package/primitives/{fluid-hover → systems/fluid-hover}/examples.mdx +1 -1
- package/primitives/{fluid-hover → systems/fluid-hover}/index.tsx +10 -10
- package/primitives/{morph → systems/morph}/examples.mdx +4 -4
- package/primitives/{morph → systems/morph}/index.tsx +71 -66
- package/primitives/{motion → systems/motion}/index.tsx +5 -5
- package/primitives/{sizes → systems/sizes}/examples.mdx +4 -4
- package/primitives/{sizes → systems/sizes}/index.tsx +8 -8
- package/primitives/{surface → systems/surface}/examples.mdx +2 -2
- package/primitives/{surface → systems/surface}/index.tsx +3 -3
- 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/components/AI/input-message/examples.mdx +0 -134
- package/components/AI/input-message/file-preview-tile.tsx +0 -59
- package/components/AI/input-message/file-thumbnail.tsx +0 -146
- package/components/AI/input-message/index.tsx +0 -625
- package/components/AI/input-message/input-message.css +0 -25
- package/components/AI/input-message/queued-row.tsx +0 -102
- package/components/AI/input-message/shared.ts +0 -38
- package/components/AI/input-message/suggestion-row.tsx +0 -64
- package/components/AI/input-message/use-composer-files.ts +0 -142
- package/components/AI/input-message/use-history-nav.ts +0 -60
- package/components/AI/input-message/use-message-queue.ts +0 -108
- package/components/AI/input-message/use-region-height.ts +0 -34
- package/components/AI/thinking-indicator/examples.mdx +0 -27
- package/components/AI/thinking-indicator/index.tsx +0 -188
- package/components/button/variants.ts +0 -63
- package/dist/components/AI/input-message/index.d.ts +0 -128
- package/dist/components/AI/input-message/index.js +0 -39
- package/dist/components/AI/thinking-indicator/index.d.ts +0 -34
- package/dist/components/AI/thinking-indicator/index.js +0 -17
- package/dist/components/accordion/index.js +0 -39
- package/dist/components/avatar/index.js +0 -20
- package/dist/components/badge/index.js +0 -21
- package/dist/components/button/index.js +0 -22
- package/dist/components/button/variants.d.ts +0 -8
- package/dist/components/card/index.js +0 -57
- package/dist/components/copy/index.d.ts +0 -46
- package/dist/components/copy/index.js +0 -25
- package/dist/components/progress/index.js +0 -16
- package/dist/components/table/index.js +0 -39
- package/dist/primitives/code/index.js +0 -14
- package/dist/primitives/craft/index.js +0 -16
- package/dist/primitives/fluid-hover/index.js +0 -30
- package/dist/primitives/morph/index.js +0 -29
- package/dist/primitives/motion/index.js +0 -25
- package/dist/primitives/scroll-area/index.js +0 -14
- package/dist/primitives/skeleton/index.js +0 -14
- package/dist/shared/components-1p3k62x2.js +0 -137
- package/dist/shared/components-38wa9nx5.js +0 -19
- package/dist/shared/components-50rh4ggz.js +0 -54
- package/dist/shared/components-bdkm2jzy.js +0 -34
- package/dist/shared/components-gkdx1787.js +0 -159
- package/dist/shared/components-nskr4hwg.js +0 -1008
- /package/components/{button → actions/button}/examples.mdx +0 -0
- /package/components/{button → actions/button}/loading-demo.tsx +0 -0
- /package/components/{accordion → containers/accordion}/examples.mdx +0 -0
- /package/components/{badge → data-display/badge}/examples.mdx +0 -0
- /package/components/{table → data-display/table}/examples.mdx +0 -0
- /package/components/{table → data-display/table}/sort-demo.tsx +0 -0
- /package/components/{progress → feedback/progress}/progress.css +0 -0
- /package/components/inputs/color-picker/{color-math.ts → variants.ts} +0 -0
- /package/dist/components/{avatar → data-display/avatar}/index.d.ts +0 -0
- /package/dist/components/{progress → feedback/progress}/index.d.ts +0 -0
- /package/dist/primitives/{code → content/code}/index.d.ts +0 -0
- /package/dist/primitives/{skeleton → content/skeleton}/index.d.ts +0 -0
- /package/dist/primitives/{scroll-area → layout/scroll-area}/index.d.ts +0 -0
- /package/dist/primitives/{separator → layout/separator}/index.d.ts +0 -0
- /package/dist/primitives/{craft → systems/craft}/index.d.ts +0 -0
- /package/dist/primitives/{fluid-hover → systems/fluid-hover}/index.d.ts +0 -0
- /package/dist/primitives/{motion → systems/motion}/index.d.ts +0 -0
- /package/dist/primitives/{surface → systems/surface}/index.d.ts +0 -0
- /package/primitives/{code → content/code}/examples.mdx +0 -0
- /package/primitives/{skeleton → content/skeleton}/skeleton.css +0 -0
- /package/primitives/{scroll-area → layout/scroll-area}/examples.mdx +0 -0
- /package/primitives/{motion → systems/motion}/examples.mdx +0 -0
- /package/primitives/{surface → systems/surface}/surface.css +0 -0
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
useShape2
|
|
5
|
-
} from "./components-
|
|
5
|
+
} from "./components-kxpcj2ry.js";
|
|
6
6
|
import {
|
|
7
7
|
surfaceClasses2
|
|
8
8
|
} from "./components-ceyn28cf.js";
|
|
@@ -15,13 +15,13 @@ import {
|
|
|
15
15
|
} from "./components-wwd093xg.js";
|
|
16
16
|
import {
|
|
17
17
|
cn2
|
|
18
|
-
} from "./components-
|
|
18
|
+
} from "./components-xnp09586.js";
|
|
19
19
|
import {
|
|
20
20
|
useSize2
|
|
21
21
|
} from "./components-znspksk0.js";
|
|
22
22
|
import {
|
|
23
23
|
SizeScope2
|
|
24
|
-
} from "./components-
|
|
24
|
+
} from "./components-nz14rwtd.js";
|
|
25
25
|
import {
|
|
26
26
|
mergeRefs2
|
|
27
27
|
} from "./components-bkwjvvkh.js";
|
|
@@ -30,19 +30,19 @@ import {
|
|
|
30
30
|
} from "./components-45r18egt.js";
|
|
31
31
|
import {
|
|
32
32
|
Slider2
|
|
33
|
-
} from "./components-
|
|
33
|
+
} from "./components-p32aqk3q.js";
|
|
34
34
|
import {
|
|
35
35
|
useMorph2
|
|
36
|
-
} from "./components-
|
|
36
|
+
} from "./components-8pnvkrbw.js";
|
|
37
37
|
import {
|
|
38
38
|
FluidHoverHighlight2
|
|
39
|
-
} from "./components-
|
|
39
|
+
} from "./components-g35n8tzm.js";
|
|
40
40
|
import {
|
|
41
41
|
FocusRing2
|
|
42
|
-
} from "./components-
|
|
42
|
+
} from "./components-c515d6xr.js";
|
|
43
43
|
import {
|
|
44
44
|
useIcon2
|
|
45
|
-
} from "./components-
|
|
45
|
+
} from "./components-jnhpgpfk.js";
|
|
46
46
|
import {
|
|
47
47
|
OverlayContext2,
|
|
48
48
|
useOverlayRoot2,
|
|
@@ -50,13 +50,13 @@ import {
|
|
|
50
50
|
positionerProps2,
|
|
51
51
|
PortalContainer2,
|
|
52
52
|
usePortalContainer2
|
|
53
|
-
} from "./components-
|
|
53
|
+
} from "./components-rgng034x.js";
|
|
54
54
|
import {
|
|
55
55
|
POPUP_SHAPE2
|
|
56
56
|
} from "./components-mse06t0x.js";
|
|
57
57
|
import {
|
|
58
58
|
PopupSurface2
|
|
59
|
-
} from "./components-
|
|
59
|
+
} from "./components-nxqrw789.js";
|
|
60
60
|
import {
|
|
61
61
|
useRowFocus2
|
|
62
62
|
} from "./components-vcte8p75.js";
|
|
@@ -66,13 +66,27 @@ import {
|
|
|
66
66
|
} from "./components-7c4a0egq.js";
|
|
67
67
|
import {
|
|
68
68
|
WeightLabel2
|
|
69
|
-
} from "./components-
|
|
69
|
+
} from "./components-y09nr7fe.js";
|
|
70
70
|
import {
|
|
71
71
|
Tooltip2
|
|
72
|
-
} from "./components-
|
|
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";
|
|
73
87
|
import {
|
|
74
88
|
useFieldBox2
|
|
75
|
-
} from "./components-
|
|
89
|
+
} from "./components-1ztgy933.js";
|
|
76
90
|
|
|
77
91
|
// components/inputs/color-picker/index.tsx
|
|
78
92
|
import {
|
|
@@ -138,332 +152,6 @@ function AlphaSlider({
|
|
|
138
152
|
});
|
|
139
153
|
}
|
|
140
154
|
|
|
141
|
-
// components/inputs/color-picker/color-math.ts
|
|
142
|
-
/*!
|
|
143
|
-
* Part of the ColorPicker port (Fluid Functionalism `registry/default/color-picker.tsx` @ b3587bdbd83fc66c2a6aae3817ffb856cb09260b,
|
|
144
|
-
* MIT License © 2026 Micka Touillaud). Local changes: see PORTING.md.
|
|
145
|
-
*/
|
|
146
|
-
function clamp01(n) {
|
|
147
|
-
return Math.max(0, Math.min(1, n));
|
|
148
|
-
}
|
|
149
|
-
function clamp255(n) {
|
|
150
|
-
return Math.max(0, Math.min(255, n));
|
|
151
|
-
}
|
|
152
|
-
function hsvToRgb(h, s, v) {
|
|
153
|
-
const c = v * s;
|
|
154
|
-
const hh = (h % 360 + 360) % 360 / 60;
|
|
155
|
-
const x = c * (1 - Math.abs(hh % 2 - 1));
|
|
156
|
-
let r = 0, g = 0, b = 0;
|
|
157
|
-
if (hh < 1) {
|
|
158
|
-
r = c;
|
|
159
|
-
g = x;
|
|
160
|
-
b = 0;
|
|
161
|
-
} else if (hh < 2) {
|
|
162
|
-
r = x;
|
|
163
|
-
g = c;
|
|
164
|
-
b = 0;
|
|
165
|
-
} else if (hh < 3) {
|
|
166
|
-
r = 0;
|
|
167
|
-
g = c;
|
|
168
|
-
b = x;
|
|
169
|
-
} else if (hh < 4) {
|
|
170
|
-
r = 0;
|
|
171
|
-
g = x;
|
|
172
|
-
b = c;
|
|
173
|
-
} else if (hh < 5) {
|
|
174
|
-
r = x;
|
|
175
|
-
g = 0;
|
|
176
|
-
b = c;
|
|
177
|
-
} else {
|
|
178
|
-
r = c;
|
|
179
|
-
g = 0;
|
|
180
|
-
b = x;
|
|
181
|
-
}
|
|
182
|
-
const m = v - c;
|
|
183
|
-
return { r: (r + m) * 255, g: (g + m) * 255, b: (b + m) * 255 };
|
|
184
|
-
}
|
|
185
|
-
function rgbToHsv(r, g, b) {
|
|
186
|
-
r /= 255;
|
|
187
|
-
g /= 255;
|
|
188
|
-
b /= 255;
|
|
189
|
-
const max = Math.max(r, g, b);
|
|
190
|
-
const min = Math.min(r, g, b);
|
|
191
|
-
const v = max;
|
|
192
|
-
const d = max - min;
|
|
193
|
-
const s = max === 0 ? 0 : d / max;
|
|
194
|
-
let h = 0;
|
|
195
|
-
if (d > 0) {
|
|
196
|
-
if (max === r)
|
|
197
|
-
h = (g - b) / d % 6;
|
|
198
|
-
else if (max === g)
|
|
199
|
-
h = (b - r) / d + 2;
|
|
200
|
-
else
|
|
201
|
-
h = (r - g) / d + 4;
|
|
202
|
-
h *= 60;
|
|
203
|
-
if (h < 0)
|
|
204
|
-
h += 360;
|
|
205
|
-
}
|
|
206
|
-
return { h, s, v };
|
|
207
|
-
}
|
|
208
|
-
function rgbToHsl(r, g, b) {
|
|
209
|
-
r /= 255;
|
|
210
|
-
g /= 255;
|
|
211
|
-
b /= 255;
|
|
212
|
-
const max = Math.max(r, g, b);
|
|
213
|
-
const min = Math.min(r, g, b);
|
|
214
|
-
const l = (max + min) / 2;
|
|
215
|
-
const d = max - min;
|
|
216
|
-
let h = 0, s = 0;
|
|
217
|
-
if (d > 0) {
|
|
218
|
-
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
|
|
219
|
-
if (max === r)
|
|
220
|
-
h = (g - b) / d % 6;
|
|
221
|
-
else if (max === g)
|
|
222
|
-
h = (b - r) / d + 2;
|
|
223
|
-
else
|
|
224
|
-
h = (r - g) / d + 4;
|
|
225
|
-
h *= 60;
|
|
226
|
-
if (h < 0)
|
|
227
|
-
h += 360;
|
|
228
|
-
}
|
|
229
|
-
return { h, s, l };
|
|
230
|
-
}
|
|
231
|
-
function hslToRgb(h, s, l) {
|
|
232
|
-
const c = (1 - Math.abs(2 * l - 1)) * s;
|
|
233
|
-
const hh = (h % 360 + 360) % 360 / 60;
|
|
234
|
-
const x = c * (1 - Math.abs(hh % 2 - 1));
|
|
235
|
-
let r = 0, g = 0, b = 0;
|
|
236
|
-
if (hh < 1) {
|
|
237
|
-
r = c;
|
|
238
|
-
g = x;
|
|
239
|
-
} else if (hh < 2) {
|
|
240
|
-
r = x;
|
|
241
|
-
g = c;
|
|
242
|
-
} else if (hh < 3) {
|
|
243
|
-
g = c;
|
|
244
|
-
b = x;
|
|
245
|
-
} else if (hh < 4) {
|
|
246
|
-
g = x;
|
|
247
|
-
b = c;
|
|
248
|
-
} else if (hh < 5) {
|
|
249
|
-
r = x;
|
|
250
|
-
b = c;
|
|
251
|
-
} else {
|
|
252
|
-
r = c;
|
|
253
|
-
b = x;
|
|
254
|
-
}
|
|
255
|
-
const m = l - c / 2;
|
|
256
|
-
return { r: (r + m) * 255, g: (g + m) * 255, b: (b + m) * 255 };
|
|
257
|
-
}
|
|
258
|
-
function srgbToLinear(c) {
|
|
259
|
-
c = c / 255;
|
|
260
|
-
return c <= 0.04045 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;
|
|
261
|
-
}
|
|
262
|
-
function linearToSrgb(c) {
|
|
263
|
-
const v = c <= 0.0031308 ? 12.92 * c : 1.055 * c ** (1 / 2.4) - 0.055;
|
|
264
|
-
return clamp01(v) * 255;
|
|
265
|
-
}
|
|
266
|
-
function linearRgbToOklab(r, g, b) {
|
|
267
|
-
const l = 0.4122214708 * r + 0.5363325363 * g + 0.0514459929 * b;
|
|
268
|
-
const m = 0.2119034982 * r + 0.6806995451 * g + 0.1073969566 * b;
|
|
269
|
-
const s = 0.0883024619 * r + 0.2817188376 * g + 0.6299787005 * b;
|
|
270
|
-
const l_ = Math.cbrt(l);
|
|
271
|
-
const m_ = Math.cbrt(m);
|
|
272
|
-
const s_ = Math.cbrt(s);
|
|
273
|
-
return {
|
|
274
|
-
L: 0.2104542553 * l_ + 0.793617785 * m_ - 0.0040720468 * s_,
|
|
275
|
-
a: 1.9779984951 * l_ - 2.428592205 * m_ + 0.4505937099 * s_,
|
|
276
|
-
b: 0.0259040371 * l_ + 0.7827717662 * m_ - 0.808675766 * s_
|
|
277
|
-
};
|
|
278
|
-
}
|
|
279
|
-
function oklabToLinearRgb(L, a, b) {
|
|
280
|
-
const l_ = L + 0.3963377774 * a + 0.2158037573 * b;
|
|
281
|
-
const m_ = L - 0.1055613458 * a - 0.0638541728 * b;
|
|
282
|
-
const s_ = L - 0.0894841775 * a - 1.291485548 * b;
|
|
283
|
-
const l = l_ * l_ * l_;
|
|
284
|
-
const m = m_ * m_ * m_;
|
|
285
|
-
const s = s_ * s_ * s_;
|
|
286
|
-
return {
|
|
287
|
-
r: 4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s,
|
|
288
|
-
g: -1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s,
|
|
289
|
-
b: -0.0041960863 * l - 0.7034186147 * m + 1.707614701 * s
|
|
290
|
-
};
|
|
291
|
-
}
|
|
292
|
-
function rgbToOklch(r, g, b) {
|
|
293
|
-
const lr = srgbToLinear(r);
|
|
294
|
-
const lg = srgbToLinear(g);
|
|
295
|
-
const lb = srgbToLinear(b);
|
|
296
|
-
const lab = linearRgbToOklab(lr, lg, lb);
|
|
297
|
-
const C = Math.sqrt(lab.a * lab.a + lab.b * lab.b);
|
|
298
|
-
let H = Math.atan2(lab.b, lab.a) * 180 / Math.PI;
|
|
299
|
-
if (H < 0)
|
|
300
|
-
H += 360;
|
|
301
|
-
return { L: lab.L, C, H };
|
|
302
|
-
}
|
|
303
|
-
function oklchToRgb(L, C, H) {
|
|
304
|
-
const a = C * Math.cos(H * Math.PI / 180);
|
|
305
|
-
const b = C * Math.sin(H * Math.PI / 180);
|
|
306
|
-
const lin = oklabToLinearRgb(L, a, b);
|
|
307
|
-
return {
|
|
308
|
-
r: clamp255(linearToSrgb(lin.r)),
|
|
309
|
-
g: clamp255(linearToSrgb(lin.g)),
|
|
310
|
-
b: clamp255(linearToSrgb(lin.b))
|
|
311
|
-
};
|
|
312
|
-
}
|
|
313
|
-
function to2hex(n) {
|
|
314
|
-
return Math.round(clamp255(n)).toString(16).padStart(2, "0");
|
|
315
|
-
}
|
|
316
|
-
function rgbToHexStr(r, g, b, a) {
|
|
317
|
-
if (a >= 1)
|
|
318
|
-
return `#${to2hex(r)}${to2hex(g)}${to2hex(b)}`;
|
|
319
|
-
return `#${to2hex(r)}${to2hex(g)}${to2hex(b)}${to2hex(a * 255)}`;
|
|
320
|
-
}
|
|
321
|
-
function expandShortHex(h) {
|
|
322
|
-
if (h.length === 3)
|
|
323
|
-
return h.split("").map((c) => c + c).join("");
|
|
324
|
-
if (h.length === 4)
|
|
325
|
-
return h.split("").map((c) => c + c).join("");
|
|
326
|
-
return h;
|
|
327
|
-
}
|
|
328
|
-
function parseHex(input) {
|
|
329
|
-
const m = input.trim().match(/^#?([0-9a-fA-F]{3,8})$/);
|
|
330
|
-
if (!m)
|
|
331
|
-
return null;
|
|
332
|
-
let h = m[1];
|
|
333
|
-
if (h.length === 3 || h.length === 4)
|
|
334
|
-
h = expandShortHex(h);
|
|
335
|
-
if (h.length === 6) {
|
|
336
|
-
return {
|
|
337
|
-
r: parseInt(h.slice(0, 2), 16),
|
|
338
|
-
g: parseInt(h.slice(2, 4), 16),
|
|
339
|
-
b: parseInt(h.slice(4, 6), 16),
|
|
340
|
-
a: 1
|
|
341
|
-
};
|
|
342
|
-
}
|
|
343
|
-
if (h.length === 8) {
|
|
344
|
-
return {
|
|
345
|
-
r: parseInt(h.slice(0, 2), 16),
|
|
346
|
-
g: parseInt(h.slice(2, 4), 16),
|
|
347
|
-
b: parseInt(h.slice(4, 6), 16),
|
|
348
|
-
a: parseInt(h.slice(6, 8), 16) / 255
|
|
349
|
-
};
|
|
350
|
-
}
|
|
351
|
-
return null;
|
|
352
|
-
}
|
|
353
|
-
function parseAlphaPart(part) {
|
|
354
|
-
if (part === undefined)
|
|
355
|
-
return 1;
|
|
356
|
-
return part.endsWith("%") ? parseFloat(part) / 100 : parseFloat(part);
|
|
357
|
-
}
|
|
358
|
-
function parseColor2(input) {
|
|
359
|
-
const s = input.trim();
|
|
360
|
-
if (!s)
|
|
361
|
-
return null;
|
|
362
|
-
if (s.startsWith("#") || /^[0-9a-fA-F]{3,8}$/.test(s)) {
|
|
363
|
-
return parseHex(s);
|
|
364
|
-
}
|
|
365
|
-
const rgbM = s.match(/^rgba?\(\s*([^)]+)\)$/i);
|
|
366
|
-
if (rgbM) {
|
|
367
|
-
const parts = rgbM[1].split(/[\s,/]+/).filter(Boolean);
|
|
368
|
-
if (parts.length < 3)
|
|
369
|
-
return null;
|
|
370
|
-
const r = parseFloat(parts[0]);
|
|
371
|
-
const g = parseFloat(parts[1]);
|
|
372
|
-
const b = parseFloat(parts[2]);
|
|
373
|
-
const a = parseAlphaPart(parts[3]);
|
|
374
|
-
if ([r, g, b, a].some(Number.isNaN))
|
|
375
|
-
return null;
|
|
376
|
-
return { r: clamp255(r), g: clamp255(g), b: clamp255(b), a: clamp01(a) };
|
|
377
|
-
}
|
|
378
|
-
const hslM = s.match(/^hsla?\(\s*([^)]+)\)$/i);
|
|
379
|
-
if (hslM) {
|
|
380
|
-
const parts = hslM[1].split(/[\s,/]+/).filter(Boolean);
|
|
381
|
-
if (parts.length < 3)
|
|
382
|
-
return null;
|
|
383
|
-
const h = parseFloat(parts[0]);
|
|
384
|
-
const sat = parts[1].endsWith("%") ? parseFloat(parts[1]) / 100 : parseFloat(parts[1]);
|
|
385
|
-
const l = parts[2].endsWith("%") ? parseFloat(parts[2]) / 100 : parseFloat(parts[2]);
|
|
386
|
-
const a = parseAlphaPart(parts[3]);
|
|
387
|
-
if ([h, sat, l, a].some(Number.isNaN))
|
|
388
|
-
return null;
|
|
389
|
-
const rgb = hslToRgb(h, clamp01(sat), clamp01(l));
|
|
390
|
-
return { r: clamp255(rgb.r), g: clamp255(rgb.g), b: clamp255(rgb.b), a: clamp01(a) };
|
|
391
|
-
}
|
|
392
|
-
const oklchM = s.match(/^oklch\(\s*([^)]+)\)$/i);
|
|
393
|
-
if (oklchM) {
|
|
394
|
-
const parts = oklchM[1].split(/[\s,/]+/).filter(Boolean);
|
|
395
|
-
if (parts.length < 3)
|
|
396
|
-
return null;
|
|
397
|
-
const L = parts[0].endsWith("%") ? parseFloat(parts[0]) / 100 : parseFloat(parts[0]);
|
|
398
|
-
const C = parseFloat(parts[1]);
|
|
399
|
-
const H = parseFloat(parts[2]);
|
|
400
|
-
const a = parseAlphaPart(parts[3]);
|
|
401
|
-
if ([L, C, H, a].some(Number.isNaN))
|
|
402
|
-
return null;
|
|
403
|
-
const rgb = oklchToRgb(clamp01(L), Math.max(0, C), H);
|
|
404
|
-
return { r: clamp255(rgb.r), g: clamp255(rgb.g), b: clamp255(rgb.b), a: clamp01(a) };
|
|
405
|
-
}
|
|
406
|
-
return null;
|
|
407
|
-
}
|
|
408
|
-
var cssColorCtx = null;
|
|
409
|
-
function resolveCssColor(input) {
|
|
410
|
-
const direct = parseColor2(input);
|
|
411
|
-
if (direct)
|
|
412
|
-
return direct;
|
|
413
|
-
const s = input.trim();
|
|
414
|
-
if (!s || typeof document === "undefined")
|
|
415
|
-
return null;
|
|
416
|
-
if (!cssColorCtx) {
|
|
417
|
-
cssColorCtx = document.createElement("canvas").getContext("2d");
|
|
418
|
-
if (!cssColorCtx)
|
|
419
|
-
return null;
|
|
420
|
-
}
|
|
421
|
-
const ctx = cssColorCtx;
|
|
422
|
-
ctx.fillStyle = "#000000";
|
|
423
|
-
ctx.fillStyle = s;
|
|
424
|
-
const first = String(ctx.fillStyle);
|
|
425
|
-
ctx.fillStyle = "#ffffff";
|
|
426
|
-
ctx.fillStyle = s;
|
|
427
|
-
const second = String(ctx.fillStyle);
|
|
428
|
-
if (first !== second)
|
|
429
|
-
return null;
|
|
430
|
-
return parseColor2(first);
|
|
431
|
-
}
|
|
432
|
-
function buildParsed2(h, s, v, a) {
|
|
433
|
-
const { r, g, b } = hsvToRgb(h, s, v);
|
|
434
|
-
const hsl = rgbToHsl(r, g, b);
|
|
435
|
-
const oklch = rgbToOklch(r, g, b);
|
|
436
|
-
const hex = rgbToHexStr(r, g, b, a);
|
|
437
|
-
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))})`;
|
|
438
|
-
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))})`;
|
|
439
|
-
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))})`;
|
|
440
|
-
return {
|
|
441
|
-
h,
|
|
442
|
-
s,
|
|
443
|
-
v,
|
|
444
|
-
a,
|
|
445
|
-
r: Math.round(r),
|
|
446
|
-
g: Math.round(g),
|
|
447
|
-
b: Math.round(b),
|
|
448
|
-
hex,
|
|
449
|
-
rgb: rgbStr,
|
|
450
|
-
hsl: hslStr,
|
|
451
|
-
oklch: oklchStr
|
|
452
|
-
};
|
|
453
|
-
}
|
|
454
|
-
function formatValueByFormat(parsed, fmt) {
|
|
455
|
-
switch (fmt) {
|
|
456
|
-
case "hex":
|
|
457
|
-
return parsed.hex;
|
|
458
|
-
case "rgb":
|
|
459
|
-
return parsed.rgb;
|
|
460
|
-
case "hsl":
|
|
461
|
-
return parsed.hsl;
|
|
462
|
-
case "oklch":
|
|
463
|
-
return parsed.oklch;
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
|
-
|
|
467
155
|
// components/inputs/color-picker/context.ts
|
|
468
156
|
import { createContext } from "react";
|
|
469
157
|
var PanelSurfaceContext = createContext(true);
|
|
@@ -1025,7 +713,7 @@ function ColorInputsRow({
|
|
|
1025
713
|
});
|
|
1026
714
|
}
|
|
1027
715
|
if (format === "hsl") {
|
|
1028
|
-
const hsl =
|
|
716
|
+
const hsl = rgbToHsl2(parsed.r, parsed.g, parsed.b);
|
|
1029
717
|
return /* @__PURE__ */ jsxs3("div", {
|
|
1030
718
|
className: "grid grid-cols-4 gap-1",
|
|
1031
719
|
children: [
|
|
@@ -1082,7 +770,7 @@ function ColorInputsRow({
|
|
|
1082
770
|
]
|
|
1083
771
|
});
|
|
1084
772
|
}
|
|
1085
|
-
const oklch =
|
|
773
|
+
const oklch = rgbToOklch2(parsed.r, parsed.g, parsed.b);
|
|
1086
774
|
const displayH = oklchHue ?? oklch.H;
|
|
1087
775
|
return /* @__PURE__ */ jsxs3("div", {
|
|
1088
776
|
className: "grid grid-cols-4 gap-1",
|
|
@@ -1239,16 +927,16 @@ function SwatchStrip({
|
|
|
1239
927
|
}) {
|
|
1240
928
|
const normalizedCurrent = useMemo3(() => {
|
|
1241
929
|
const p = parseColor2(current);
|
|
1242
|
-
return p ?
|
|
930
|
+
return p ? rgbToHexStr2(p.r, p.g, p.b, p.a).toLowerCase() : "";
|
|
1243
931
|
}, [current]);
|
|
1244
932
|
const [resolvedSwatches, setResolvedSwatches] = useState2({});
|
|
1245
933
|
useEffect3(() => {
|
|
1246
934
|
const next = {};
|
|
1247
935
|
for (const sw of swatches) {
|
|
1248
936
|
if (!parseColor2(sw)) {
|
|
1249
|
-
const p =
|
|
937
|
+
const p = resolveCssColor2(sw);
|
|
1250
938
|
if (p)
|
|
1251
|
-
next[sw] =
|
|
939
|
+
next[sw] = rgbToHexStr2(p.r, p.g, p.b, p.a).toLowerCase();
|
|
1252
940
|
}
|
|
1253
941
|
}
|
|
1254
942
|
setResolvedSwatches(next);
|
|
@@ -1257,7 +945,7 @@ function SwatchStrip({
|
|
|
1257
945
|
className: "flex flex-wrap gap-2",
|
|
1258
946
|
children: swatches.map((sw, i) => {
|
|
1259
947
|
const parsed = parseColor2(sw);
|
|
1260
|
-
const normalized = parsed ?
|
|
948
|
+
const normalized = parsed ? rgbToHexStr2(parsed.r, parsed.g, parsed.b, parsed.a).toLowerCase() : resolvedSwatches[sw] ?? sw.toLowerCase();
|
|
1261
949
|
const isSelected = normalized === normalizedCurrent;
|
|
1262
950
|
return /* @__PURE__ */ jsx5(ColorSwatch2, {
|
|
1263
951
|
color: sw,
|
|
@@ -1281,7 +969,15 @@ var ColorPickerPopover2 = forwardRef3(({
|
|
|
1281
969
|
triggerShowValue = true,
|
|
1282
970
|
triggerShowRemove = false,
|
|
1283
971
|
onTriggerRemove,
|
|
972
|
+
removeLabel = "Remove color",
|
|
973
|
+
disabled: disabledProp,
|
|
974
|
+
readOnly: readOnlyProp,
|
|
1284
975
|
triggerClassName,
|
|
976
|
+
id,
|
|
977
|
+
"aria-label": ariaLabel,
|
|
978
|
+
"aria-labelledby": ariaLabelledBy,
|
|
979
|
+
"aria-describedby": ariaDescribedBy,
|
|
980
|
+
"aria-invalid": ariaInvalid,
|
|
1285
981
|
open,
|
|
1286
982
|
defaultOpen,
|
|
1287
983
|
onOpenChange,
|
|
@@ -1302,14 +998,22 @@ var ColorPickerPopover2 = forwardRef3(({
|
|
|
1302
998
|
setValue(next);
|
|
1303
999
|
onValueChange?.(next, parsed);
|
|
1304
1000
|
}, [setValue, onValueChange]);
|
|
1305
|
-
const box = useFieldBox2({
|
|
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;
|
|
1306
1010
|
const sizeClasses = box.size;
|
|
1307
1011
|
const compact = sizeClasses.variant === "compact";
|
|
1308
1012
|
const frameRef = useRef3(null);
|
|
1309
1013
|
const XIcon = useIcon2("x");
|
|
1310
1014
|
const parsed = useMemo4(() => parseColor2(value), [value]);
|
|
1311
|
-
const swatchColor = parsed ?
|
|
1312
|
-
const valueLabel = parsed ?
|
|
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;
|
|
1313
1017
|
const label = /* @__PURE__ */ jsx6("span", {
|
|
1314
1018
|
className: cn2("text-muted-foreground px-1 select-none", sizeClasses.text),
|
|
1315
1019
|
children: triggerLabel
|
|
@@ -1319,17 +1023,28 @@ var ColorPickerPopover2 = forwardRef3(({
|
|
|
1319
1023
|
children: /* @__PURE__ */ jsx6(OverlayContext2.Provider, {
|
|
1320
1024
|
value: root.state,
|
|
1321
1025
|
children: /* @__PURE__ */ jsxs4(Popover.Root, {
|
|
1322
|
-
open: root.open,
|
|
1323
|
-
onOpenChange:
|
|
1026
|
+
open: root.open && !locked,
|
|
1027
|
+
onOpenChange: (next, details) => {
|
|
1028
|
+
if (next && locked)
|
|
1029
|
+
return;
|
|
1030
|
+
root.onOpenChange(next, details);
|
|
1031
|
+
},
|
|
1324
1032
|
modal: false,
|
|
1325
1033
|
children: [
|
|
1326
1034
|
/* @__PURE__ */ jsxs4("div", {
|
|
1327
1035
|
ref: mergeRefs2(frameRef, ref),
|
|
1328
1036
|
...box.props,
|
|
1329
|
-
className: cn2(box.props.className, "inline-flex items-center
|
|
1037
|
+
className: cn2(box.props.className, "inline-flex items-center [&:has(:focus-visible)]:!ring-focus-ring", locked ? "cursor-default" : "cursor-pointer", sizeClasses.control, triggerClassName),
|
|
1330
1038
|
children: [
|
|
1331
1039
|
/* @__PURE__ */ jsxs4(Popover.Trigger, {
|
|
1332
|
-
|
|
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),
|
|
1333
1048
|
children: [
|
|
1334
1049
|
triggerLabel && triggerLabelPosition === "left" && label,
|
|
1335
1050
|
/* @__PURE__ */ jsx6(ColorTile2, {
|
|
@@ -1343,9 +1058,9 @@ var ColorPickerPopover2 = forwardRef3(({
|
|
|
1343
1058
|
triggerLabel && triggerLabelPosition === "right" && label
|
|
1344
1059
|
]
|
|
1345
1060
|
}),
|
|
1346
|
-
triggerShowRemove && /* @__PURE__ */ jsx6("button", {
|
|
1061
|
+
triggerShowRemove && !locked && /* @__PURE__ */ jsx6("button", {
|
|
1347
1062
|
type: "button",
|
|
1348
|
-
"aria-label":
|
|
1063
|
+
"aria-label": removeLabel,
|
|
1349
1064
|
onClick: onTriggerRemove,
|
|
1350
1065
|
className: "ml-1 flex items-center bg-transparent text-muted-foreground hover:text-foreground outline-none cursor-pointer",
|
|
1351
1066
|
children: /* @__PURE__ */ jsx6(XIcon, {
|
|
@@ -1423,8 +1138,8 @@ function SaturationSquare({ h, s, v, onChange }) {
|
|
|
1423
1138
|
const rect = ref.current?.getBoundingClientRect();
|
|
1424
1139
|
if (!rect)
|
|
1425
1140
|
return;
|
|
1426
|
-
const x =
|
|
1427
|
-
const y =
|
|
1141
|
+
const x = clamp012((clientX - rect.left) / rect.width);
|
|
1142
|
+
const y = clamp012((clientY - rect.top) / rect.height);
|
|
1428
1143
|
onChange(x, 1 - y);
|
|
1429
1144
|
}, [onChange]);
|
|
1430
1145
|
const updateCursorPos = useCallback3((clientX, clientY) => {
|
|
@@ -1432,8 +1147,8 @@ function SaturationSquare({ h, s, v, onChange }) {
|
|
|
1432
1147
|
if (!rect)
|
|
1433
1148
|
return;
|
|
1434
1149
|
setCursorPos({
|
|
1435
|
-
x:
|
|
1436
|
-
y:
|
|
1150
|
+
x: clamp012((clientX - rect.left) / rect.width) * 100,
|
|
1151
|
+
y: clamp012((clientY - rect.top) / rect.height) * 100
|
|
1437
1152
|
});
|
|
1438
1153
|
}, []);
|
|
1439
1154
|
const onPointerDown = useCallback3((e) => {
|
|
@@ -1460,13 +1175,13 @@ function SaturationSquare({ h, s, v, onChange }) {
|
|
|
1460
1175
|
const step = e.shiftKey ? 0.1 : 0.01;
|
|
1461
1176
|
let nextS = s, nextV = v, handled = true;
|
|
1462
1177
|
if (e.key === "ArrowLeft")
|
|
1463
|
-
nextS =
|
|
1178
|
+
nextS = clamp012(s - step);
|
|
1464
1179
|
else if (e.key === "ArrowRight")
|
|
1465
|
-
nextS =
|
|
1180
|
+
nextS = clamp012(s + step);
|
|
1466
1181
|
else if (e.key === "ArrowUp")
|
|
1467
|
-
nextV =
|
|
1182
|
+
nextV = clamp012(v + step);
|
|
1468
1183
|
else if (e.key === "ArrowDown")
|
|
1469
|
-
nextV =
|
|
1184
|
+
nextV = clamp012(v - step);
|
|
1470
1185
|
else
|
|
1471
1186
|
handled = false;
|
|
1472
1187
|
if (handled) {
|
|
@@ -1474,7 +1189,7 @@ function SaturationSquare({ h, s, v, onChange }) {
|
|
|
1474
1189
|
onChange(nextS, nextV);
|
|
1475
1190
|
}
|
|
1476
1191
|
}, [onChange, s, v]);
|
|
1477
|
-
const { r, g, b } =
|
|
1192
|
+
const { r, g, b } = hsvToRgb2(h, s, v);
|
|
1478
1193
|
const thumbColor = `rgb(${Math.round(r)}, ${Math.round(g)}, ${Math.round(b)})`;
|
|
1479
1194
|
return /* @__PURE__ */ jsxs5("div", {
|
|
1480
1195
|
ref,
|
|
@@ -1567,7 +1282,7 @@ var ColorPicker2 = forwardRef4(({
|
|
|
1567
1282
|
const p = parseColor2(currentRawValue);
|
|
1568
1283
|
if (!p)
|
|
1569
1284
|
return { h: 0, s: 1, v: 1, a: 1 };
|
|
1570
|
-
const hsv =
|
|
1285
|
+
const hsv = rgbToHsv2(p.r, p.g, p.b);
|
|
1571
1286
|
return { h: hsv.s === 0 ? 0 : hsv.h, s: hsv.s, v: hsv.v, a: p.a };
|
|
1572
1287
|
}, []);
|
|
1573
1288
|
const [hsv, setHsv] = useState4(initialParsed);
|
|
@@ -1581,7 +1296,7 @@ var ColorPicker2 = forwardRef4(({
|
|
|
1581
1296
|
if (!p)
|
|
1582
1297
|
return;
|
|
1583
1298
|
oklchHueRef.current = null;
|
|
1584
|
-
const newHsv =
|
|
1299
|
+
const newHsv = rgbToHsv2(p.r, p.g, p.b);
|
|
1585
1300
|
setHsv((prev) => ({
|
|
1586
1301
|
h: newHsv.s === 0 ? prev.h : newHsv.h,
|
|
1587
1302
|
s: newHsv.s,
|
|
@@ -1591,7 +1306,7 @@ var ColorPicker2 = forwardRef4(({
|
|
|
1591
1306
|
}, [currentRawValue]);
|
|
1592
1307
|
const parsed = useMemo5(() => buildParsed2(hsv.h, hsv.s, hsv.v, hsv.a), [hsv]);
|
|
1593
1308
|
const emit = useCallback4((p, fmt) => {
|
|
1594
|
-
const formatted =
|
|
1309
|
+
const formatted = formatValueByFormat2(p, fmt);
|
|
1595
1310
|
lastEmittedRef.current = formatted;
|
|
1596
1311
|
setRawValue(formatted);
|
|
1597
1312
|
onValueChange?.(formatted, p);
|
|
@@ -1606,11 +1321,11 @@ var ColorPicker2 = forwardRef4(({
|
|
|
1606
1321
|
emit(parsed, f);
|
|
1607
1322
|
}, [setFormat, emit, parsed]);
|
|
1608
1323
|
const handleHexCommit = useCallback4((input) => {
|
|
1609
|
-
const p =
|
|
1324
|
+
const p = resolveCssColor2(input);
|
|
1610
1325
|
if (!p)
|
|
1611
1326
|
return;
|
|
1612
1327
|
oklchHueRef.current = null;
|
|
1613
|
-
const newHsv =
|
|
1328
|
+
const newHsv = rgbToHsv2(p.r, p.g, p.b);
|
|
1614
1329
|
const merged = {
|
|
1615
1330
|
h: newHsv.s === 0 ? hsv.h : newHsv.h,
|
|
1616
1331
|
s: newHsv.s,
|
|
@@ -1620,7 +1335,7 @@ var ColorPicker2 = forwardRef4(({
|
|
|
1620
1335
|
setHsv(merged);
|
|
1621
1336
|
emit(buildParsed2(merged.h, merged.s, merged.v, merged.a), currentFormat);
|
|
1622
1337
|
}, [hsv.h, currentFormat, emit]);
|
|
1623
|
-
const solidHueRgb = useMemo5(() =>
|
|
1338
|
+
const solidHueRgb = useMemo5(() => hsvToRgb2(hsv.h, hsv.s, hsv.v), [hsv.h, hsv.s, hsv.v]);
|
|
1624
1339
|
const solidR = Math.round(solidHueRgb.r);
|
|
1625
1340
|
const solidG = Math.round(solidHueRgb.g);
|
|
1626
1341
|
const solidB = Math.round(solidHueRgb.b);
|
|
@@ -1697,7 +1412,7 @@ var ColorPicker2 = forwardRef4(({
|
|
|
1697
1412
|
const r = channel === "r" ? Number(value) : p.r;
|
|
1698
1413
|
const g = channel === "g" ? Number(value) : p.g;
|
|
1699
1414
|
const b = channel === "b" ? Number(value) : p.b;
|
|
1700
|
-
const hsvVal =
|
|
1415
|
+
const hsvVal = rgbToHsv2(r, g, b);
|
|
1701
1416
|
updateHsv({
|
|
1702
1417
|
h: hsvVal.s === 0 ? hsv.h : hsvVal.h,
|
|
1703
1418
|
s: hsvVal.s,
|
|
@@ -1710,12 +1425,12 @@ var ColorPicker2 = forwardRef4(({
|
|
|
1710
1425
|
case "lSL": {
|
|
1711
1426
|
if (channel === "hSL")
|
|
1712
1427
|
oklchHueRef.current = null;
|
|
1713
|
-
const hsl =
|
|
1428
|
+
const hsl = rgbToHsl2(p.r, p.g, p.b);
|
|
1714
1429
|
const h2 = channel === "hSL" ? Number(value) : hsl.h;
|
|
1715
1430
|
const s2 = channel === "sSL" ? Number(value) / 100 : hsl.s;
|
|
1716
1431
|
const l2 = channel === "lSL" ? Number(value) / 100 : hsl.l;
|
|
1717
|
-
const rgb =
|
|
1718
|
-
const hsvVal =
|
|
1432
|
+
const rgb = hslToRgb2(h2, clamp012(s2), clamp012(l2));
|
|
1433
|
+
const hsvVal = rgbToHsv2(rgb.r, rgb.g, rgb.b);
|
|
1719
1434
|
updateHsv({
|
|
1720
1435
|
h: hsvVal.s === 0 ? h2 : hsvVal.h,
|
|
1721
1436
|
s: hsvVal.s,
|
|
@@ -1726,14 +1441,14 @@ var ColorPicker2 = forwardRef4(({
|
|
|
1726
1441
|
case "L":
|
|
1727
1442
|
case "C":
|
|
1728
1443
|
case "H": {
|
|
1729
|
-
const cur =
|
|
1444
|
+
const cur = rgbToOklch2(p.r, p.g, p.b);
|
|
1730
1445
|
const baseH = oklchHueRef.current ?? cur.H;
|
|
1731
1446
|
const L = channel === "L" ? Number(value) / 100 : cur.L;
|
|
1732
1447
|
const C = channel === "C" ? Number(value) : cur.C;
|
|
1733
1448
|
const H = channel === "H" ? Number(value) : baseH;
|
|
1734
1449
|
oklchHueRef.current = H;
|
|
1735
|
-
const rgb =
|
|
1736
|
-
const hsvVal =
|
|
1450
|
+
const rgb = oklchToRgb2(clamp012(L), Math.max(0, C), H);
|
|
1451
|
+
const hsvVal = rgbToHsv2(rgb.r, rgb.g, rgb.b);
|
|
1737
1452
|
updateHsv({
|
|
1738
1453
|
h: hsvVal.s === 0 ? hsv.h : hsvVal.h,
|
|
1739
1454
|
s: hsvVal.s,
|
|
@@ -1742,7 +1457,7 @@ var ColorPicker2 = forwardRef4(({
|
|
|
1742
1457
|
return;
|
|
1743
1458
|
}
|
|
1744
1459
|
case "alphaPercent": {
|
|
1745
|
-
const a =
|
|
1460
|
+
const a = clamp012(Number(value) / 100);
|
|
1746
1461
|
updateHsv({ a });
|
|
1747
1462
|
return;
|
|
1748
1463
|
}
|
|
@@ -1768,4 +1483,4 @@ ColorPicker2.displayName = "ColorPicker";
|
|
|
1768
1483
|
Object.assign(ColorPicker2, { Popover: ColorPickerPopover2 });
|
|
1769
1484
|
var color_picker_default = ColorPicker2;
|
|
1770
1485
|
|
|
1771
|
-
export {
|
|
1486
|
+
export { ColorTile2, ColorSwatch2, ColorPickerPopover2, ColorPicker2, color_picker_default };
|