@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
package/dist/tailwind.css
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
@source "./shared";
|
|
6
6
|
|
|
7
|
+
@source "./lib";
|
|
8
|
+
|
|
7
9
|
@source "./primitives";
|
|
8
10
|
|
|
9
11
|
@source "./components";
|
|
@@ -43,6 +45,17 @@
|
|
|
43
45
|
--color-input: var(--input);
|
|
44
46
|
--color-destructive: var(--destructive);
|
|
45
47
|
--color-destructive-light: var(--destructive-light);
|
|
48
|
+
--color-destructive-strong: var(--destructive-strong);
|
|
49
|
+
--color-destructive-wash: var(--destructive-wash);
|
|
50
|
+
--color-destructive-wash-hover: var(--destructive-wash-hover);
|
|
51
|
+
--color-destructive-wash-active: var(--destructive-wash-active);
|
|
52
|
+
--color-success-strong: var(--success-strong);
|
|
53
|
+
--color-success-wash: var(--success-wash);
|
|
54
|
+
--color-success-wash-hover: var(--success-wash-hover);
|
|
55
|
+
--color-success-wash-active: var(--success-wash-active);
|
|
56
|
+
--color-skeleton: var(--skeleton);
|
|
57
|
+
--color-image-edge: var(--image-edge);
|
|
58
|
+
--color-progress-track: var(--progress-track);
|
|
46
59
|
--color-hover: var(--hover);
|
|
47
60
|
--color-active: var(--active);
|
|
48
61
|
--color-syntax-keyword: var(--syntax-keyword);
|
package/dist/tokens.css
CHANGED
|
@@ -65,6 +65,35 @@
|
|
|
65
65
|
--destructive: light-dark(oklch(0.6368 0.2078 25.33), oklch(0.7106 0.1661 22.22));
|
|
66
66
|
--destructive-light: light-dark(oklch(0.971 0.013 17.38), oklch(0.2575 0.0886 26.04));
|
|
67
67
|
|
|
68
|
+
/* ── Tinted actions (local) ──
|
|
69
|
+
Button's destructive and success variants: the hue as text on a wash of
|
|
70
|
+
itself, never a solid fill behind text (DESIGN.md › Status). The washes
|
|
71
|
+
mix toward transparent like --hover, so they read on any surface level;
|
|
72
|
+
hover and press deepen them (16 → 20 → 24%). The -strong text steps are
|
|
73
|
+
the hue darkened in light and lightened in dark, so a 13px label holds
|
|
74
|
+
WCAG AA (≥ 4.5:1) on its wash at rest, hover and press, over surfaces
|
|
75
|
+
1–5 in both schemes (worst case 4.69:1, the dark destructive press on
|
|
76
|
+
surface 5). */
|
|
77
|
+
--destructive-strong: light-dark(oklch(0.47 0.175 27), oklch(0.81 0.105 22));
|
|
78
|
+
--destructive-wash: color-mix(in oklab, var(--destructive) 16%, transparent);
|
|
79
|
+
--destructive-wash-hover: color-mix(in oklab, var(--destructive) 20%, transparent);
|
|
80
|
+
--destructive-wash-active: color-mix(in oklab, var(--destructive) 24%, transparent);
|
|
81
|
+
--success-strong: light-dark(oklch(0.46 0.12 151), oklch(0.83 0.15 152));
|
|
82
|
+
--success-wash: color-mix(in oklab, var(--status-success) 16%, transparent);
|
|
83
|
+
--success-wash-hover: color-mix(in oklab, var(--status-success) 20%, transparent);
|
|
84
|
+
--success-wash-active: color-mix(in oklab, var(--status-success) 24%, transparent);
|
|
85
|
+
|
|
86
|
+
/* ── Placeholders and media edges (local) ──
|
|
87
|
+
--skeleton: the loading placeholder's fill, a foreground mix like
|
|
88
|
+
--border so it tracks the scheme and reads on any surface level.
|
|
89
|
+
--image-edge: the 1px inset outline over avatars and other images, so a
|
|
90
|
+
pale picture keeps its shape against the surface (upstream FF's media
|
|
91
|
+
outline: black 10% in light, white 10% in dark). */
|
|
92
|
+
--skeleton: color-mix(in oklab, var(--foreground) 8%, transparent);
|
|
93
|
+
--image-edge: light-dark(rgb(0 0 0 / 0.1), rgb(255 255 255 / 0.1));
|
|
94
|
+
/* The progress track: a recessed line any fill reads against. */
|
|
95
|
+
--progress-track: color-mix(in oklab, var(--foreground) 10%, transparent);
|
|
96
|
+
|
|
68
97
|
/* ── Brand blue ──
|
|
69
98
|
FF's one chromatic accent: the switch's on-track, the copy field's hover
|
|
70
99
|
highlight, drop-target and selected-swatch rings. */
|
|
@@ -190,6 +219,10 @@
|
|
|
190
219
|
*
|
|
191
220
|
* Local addition: `goo`, the morph engine's tier for the goo effect — 250ms
|
|
192
221
|
* to land (bounce 0.15), a 200ms spring back — so the liquid neck reads.
|
|
222
|
+
*
|
|
223
|
+
* Local addition: `loop`, the period of the ambient animations that run while
|
|
224
|
+
* something is pending (the skeleton's pulse, the spinner's travel, the
|
|
225
|
+
* indeterminate bar's sweep). They never land, so they are not a spring tier.
|
|
193
226
|
*/
|
|
194
227
|
|
|
195
228
|
:root {
|
|
@@ -201,6 +234,7 @@
|
|
|
201
234
|
--duration-slow-exit: 160ms;
|
|
202
235
|
--duration-goo: 250ms;
|
|
203
236
|
--duration-goo-exit: 200ms;
|
|
237
|
+
--duration-loop: 2s;
|
|
204
238
|
}
|
|
205
239
|
|
|
206
240
|
:root {
|
package/index.ts
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
export * from './blocks/sidebar-app'
|
|
2
|
+
export { default as SidebarApp } from './blocks/sidebar-app'
|
|
3
|
+
export * from './components/AI/input-message'
|
|
4
|
+
export * from './components/AI/thinking-indicator'
|
|
5
|
+
export * from './components/accordion'
|
|
6
|
+
export * from './components/avatar'
|
|
7
|
+
export * from './components/badge'
|
|
8
|
+
export * from './components/button'
|
|
9
|
+
export * from './components/card'
|
|
10
|
+
export * from './components/copy'
|
|
11
|
+
export * from './components/inputs/checkbox'
|
|
12
|
+
export * from './components/inputs/color-picker'
|
|
13
|
+
export * from './components/inputs/combobox'
|
|
14
|
+
export * from './components/inputs/date-time/calendar'
|
|
15
|
+
export * from './components/inputs/date-time/date-picker'
|
|
16
|
+
export * from './components/inputs/date-time/date-range-picker'
|
|
17
|
+
export * from './components/inputs/date-time/duration-picker'
|
|
18
|
+
export * from './components/inputs/date-time/month-picker'
|
|
19
|
+
export * from './components/inputs/date-time/time-picker'
|
|
20
|
+
export * from './components/inputs/field'
|
|
21
|
+
export * from './components/inputs/file-dropzone'
|
|
22
|
+
export * from './components/inputs/input'
|
|
23
|
+
export * from './components/inputs/label'
|
|
24
|
+
export * from './components/inputs/number-input'
|
|
25
|
+
export * from './components/inputs/radio'
|
|
26
|
+
export * from './components/inputs/search'
|
|
27
|
+
export * from './components/inputs/select'
|
|
28
|
+
export * from './components/inputs/slider'
|
|
29
|
+
export * from './components/inputs/switch'
|
|
30
|
+
export * from './components/inputs/textarea'
|
|
31
|
+
export * from './components/navigation/navigation-menu'
|
|
32
|
+
export * from './components/navigation/pagination'
|
|
33
|
+
export * from './components/navigation/sidebar'
|
|
34
|
+
export * from './components/navigation/tabs'
|
|
35
|
+
export * from './components/navigation/tabs-subtle'
|
|
36
|
+
export * from './components/overlays/alert-dialog'
|
|
37
|
+
export * from './components/overlays/command'
|
|
38
|
+
export * from './components/overlays/context-menu'
|
|
39
|
+
export * from './components/overlays/dialog'
|
|
40
|
+
export * from './components/overlays/dropdown'
|
|
41
|
+
export * from './components/overlays/popover'
|
|
42
|
+
export * from './components/overlays/preview-card'
|
|
43
|
+
export * from './components/overlays/sheet'
|
|
44
|
+
export * from './components/overlays/toast'
|
|
45
|
+
export * from './components/overlays/tooltip'
|
|
46
|
+
export * from './components/progress'
|
|
47
|
+
export * from './components/table'
|
|
48
|
+
export { IconProvider } from './lib/icon-context'
|
|
49
|
+
export { ShapeProvider } from './lib/shape-context'
|
|
50
|
+
export { cn } from './lib/utils'
|
|
51
|
+
export * from './primitives/code'
|
|
52
|
+
export * from './primitives/craft'
|
|
53
|
+
export * from './primitives/fluid-hover'
|
|
54
|
+
export * from './primitives/morph'
|
|
55
|
+
export * from './primitives/motion'
|
|
56
|
+
export * from './primitives/scroll-area'
|
|
57
|
+
export * from './primitives/separator'
|
|
58
|
+
export * from './primitives/sizes'
|
|
59
|
+
export * from './primitives/skeleton'
|
|
60
|
+
export * from './primitives/surface'
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Local addition (not part of Fluid Functionalism): what the date and time
|
|
3
|
+
* pickers read off a locale. The locale is react-day-picker's (a date-fns
|
|
4
|
+
* `Locale`, `import { de } from 'react-day-picker/locale'`); Intl fills in
|
|
5
|
+
* what date-fns doesn't carry (the hour cycle, field names).
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { isValid, type Locale, parse } from 'date-fns'
|
|
9
|
+
import { enUS } from 'react-day-picker/locale'
|
|
10
|
+
|
|
11
|
+
type HourCycle = 'h11' | 'h12' | 'h23' | 'h24'
|
|
12
|
+
|
|
13
|
+
const defaultLocale: Locale = enUS
|
|
14
|
+
|
|
15
|
+
/** The clock the locale writes times on: `h12` / `h11` read with AM/PM. */
|
|
16
|
+
function hourCycleOf(locale: Locale): HourCycle {
|
|
17
|
+
return new Intl.DateTimeFormat(locale.code, { hour: 'numeric' }).resolvedOptions().hourCycle ?? 'h23'
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function parseWith(text: string, patterns: string[], locale: Locale, reference: Date): Date | null {
|
|
21
|
+
for (const pattern of patterns) {
|
|
22
|
+
const date = parse(text.trim(), pattern, reference, { locale })
|
|
23
|
+
// A year under four digits is one still being typed ("9.10.20").
|
|
24
|
+
if (isValid(date) && date.getFullYear() >= 1000) return date
|
|
25
|
+
}
|
|
26
|
+
return null
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** A typed date in any of the locale's own formats, short to full: "09.10.2026", "9 Oct 2026", "October 9, 2026". */
|
|
30
|
+
function parseDateText(text: string, locale: Locale, reference = new Date()) {
|
|
31
|
+
return parseWith(text, ['P', 'PP', 'PPP', 'PPPP'], locale, reference)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** A typed time, in the locale's format ("3:33 PM") or on a 24-hour clock ("15:33"), on `reference`'s day. */
|
|
35
|
+
function parseTimeText(text: string, locale: Locale, reference = new Date()) {
|
|
36
|
+
return parseWith(text, ['p', 'HH:mm', 'H:mm'], locale, reference)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** A typed month and year: "October 2026", "Oct 2026", "10/2026". */
|
|
40
|
+
function parseMonthText(text: string, locale: Locale, reference = new Date()) {
|
|
41
|
+
return parseWith(text, ['LLLL y', 'LLL y', 'MM/y', 'M/y', 'MM.y'], locale, reference)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** The locale's name for a date field, for a column's accessible label. */
|
|
45
|
+
function fieldLabel(locale: Locale, field: 'month' | 'year' | 'hour' | 'minute' | 'dayPeriod') {
|
|
46
|
+
return new Intl.DisplayNames(locale.code, { type: 'dateTimeField' }).of(field) ?? field
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export type { HourCycle }
|
|
50
|
+
export { defaultLocale, fieldLabel, hourCycleOf, parseDateText, parseMonthText, parseTimeText }
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Local addition (not part of Fluid Functionalism): the field ladder FF
|
|
3
|
+
* repeats across InputGroup, Combobox and Sidebar's input, as one recipe,
|
|
4
|
+
* and `useFieldBox`, the box every text field (Input, Textarea, Combobox,
|
|
5
|
+
* the date and time pickers) builds on.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { createContext, type MouseEvent, type RefObject, useContext } from 'react'
|
|
9
|
+
import { FIELD_PX, type FieldVariant, fieldVariants } from './field-variants'
|
|
10
|
+
import { useShape } from './shape-context'
|
|
11
|
+
import { type SizeVariant, useSize } from './size-context'
|
|
12
|
+
import { cn } from './utils'
|
|
13
|
+
|
|
14
|
+
// The pure tables live in `field-variants.ts` (callable from a server
|
|
15
|
+
// component); every name stays importable from here.
|
|
16
|
+
export {
|
|
17
|
+
FIELD_ACTION,
|
|
18
|
+
FIELD_ACTION_BOX,
|
|
19
|
+
FIELD_ACTION_END,
|
|
20
|
+
FIELD_ACTION_RADIUS,
|
|
21
|
+
FIELD_ADORNMENT_ICON,
|
|
22
|
+
FIELD_PX,
|
|
23
|
+
FIELD_TEXT_INSET,
|
|
24
|
+
type FieldVariant,
|
|
25
|
+
fieldActionClasses,
|
|
26
|
+
fieldAdornmentClasses,
|
|
27
|
+
fieldIconClasses,
|
|
28
|
+
fieldVariants,
|
|
29
|
+
} from './field-variants'
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* What every text field's box takes. Items re-declare these members in their
|
|
33
|
+
* own props interface (the docs read only same-file members), with this prose.
|
|
34
|
+
*/
|
|
35
|
+
export interface FieldBoxOptions {
|
|
36
|
+
/** Framed at rest, or invisible until hovered or focused. */
|
|
37
|
+
variant: FieldVariant
|
|
38
|
+
/** Turns the field destructive. */
|
|
39
|
+
invalid?: boolean
|
|
40
|
+
/** Frames and dims the field. */
|
|
41
|
+
disabled?: boolean
|
|
42
|
+
/** Lit from outside, e.g. a group's fluid hover. */
|
|
43
|
+
active?: boolean
|
|
44
|
+
/** Shows the value without letting it change: the ring answers, the fill never lifts. */
|
|
45
|
+
readOnly?: boolean
|
|
46
|
+
/** Marks the control required (`required` on the control). */
|
|
47
|
+
required?: boolean
|
|
48
|
+
/** Pins the field to one step of the size ladder. Defaults to the surrounding SizeProvider. */
|
|
49
|
+
size?: SizeVariant
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** What a field wrapper hands to the control it holds. */
|
|
53
|
+
export interface FieldState {
|
|
54
|
+
/** Lit by a group's fluid hover. */
|
|
55
|
+
active: boolean
|
|
56
|
+
invalid: boolean
|
|
57
|
+
disabled: boolean
|
|
58
|
+
readOnly?: boolean
|
|
59
|
+
required?: boolean
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* State a field wrapper (Field, InputGroup.Field) hands to whatever control
|
|
64
|
+
* it holds: lit by the group's fluid hover, its error, its disabled,
|
|
65
|
+
* read-only and required state. `useFieldBox` reads it, so any field built on
|
|
66
|
+
* the box joins in; the control's own props win.
|
|
67
|
+
*/
|
|
68
|
+
export const FieldStateContext = createContext<FieldState | null>(null)
|
|
69
|
+
|
|
70
|
+
/** The surrounding field's state, or `null` outside one. */
|
|
71
|
+
export function useFieldState() {
|
|
72
|
+
return useContext(FieldStateContext)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* The box around a text field's control: the field ladder in the chosen
|
|
77
|
+
* variant, the state attributes it reads, the shape's input radius and the
|
|
78
|
+
* horizontal inset. Spread `props` on the element around the control (or the
|
|
79
|
+
* control itself, for a button field); the height stays with the item, from
|
|
80
|
+
* the returned `size`. Inside a Field or InputGroup.Field, unset `active` / `invalid` /
|
|
81
|
+
* `disabled` / `readOnly` / `required` come from the field (`FieldStateContext`).
|
|
82
|
+
*/
|
|
83
|
+
export function useFieldBox({ variant, invalid, disabled, active, readOnly, required, size }: FieldBoxOptions) {
|
|
84
|
+
const field = useContext(FieldStateContext)
|
|
85
|
+
const shape = useShape()
|
|
86
|
+
const sizeClasses = useSize(size)
|
|
87
|
+
const isInvalid = invalid ?? field?.invalid ?? false
|
|
88
|
+
const isDisabled = disabled ?? field?.disabled ?? false
|
|
89
|
+
const isReadOnly = readOnly ?? field?.readOnly ?? false
|
|
90
|
+
|
|
91
|
+
return {
|
|
92
|
+
size: sizeClasses,
|
|
93
|
+
/** Resolved with the field's state, for the control's `aria-invalid` / `disabled` / `readOnly` / `required`. */
|
|
94
|
+
invalid: isInvalid,
|
|
95
|
+
disabled: isDisabled,
|
|
96
|
+
readOnly: isReadOnly,
|
|
97
|
+
required: required ?? field?.required,
|
|
98
|
+
props: {
|
|
99
|
+
'data-active': (active ?? field?.active) || undefined,
|
|
100
|
+
'data-invalid': isInvalid || undefined,
|
|
101
|
+
'data-disabled': isDisabled || undefined,
|
|
102
|
+
'data-readonly': isReadOnly || undefined,
|
|
103
|
+
className: cn(fieldVariants({ variant }), shape.input, FIELD_PX[sizeClasses.variant]),
|
|
104
|
+
},
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/** A press anywhere in the box (icon, padding) focuses the control, without disturbing the control's own caret placement. */
|
|
109
|
+
export function focusControlOnPress(control: RefObject<HTMLElement | null>) {
|
|
110
|
+
return (e: MouseEvent) => {
|
|
111
|
+
if (e.target === control.current) return
|
|
112
|
+
e.preventDefault()
|
|
113
|
+
control.current?.focus()
|
|
114
|
+
}
|
|
115
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Local addition (not part of Fluid Functionalism): the field ladder's pure
|
|
3
|
+
* class tables, split from `field-classes.ts` so they carry no hooks, JSX or
|
|
4
|
+
* contexts. A React Server Component can call them; `field-classes.ts`
|
|
5
|
+
* re-exports every name, so its imports keep working.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { cva } from 'class-variance-authority'
|
|
9
|
+
import type { ShapeVariant } from './shape-context'
|
|
10
|
+
import type { SizeVariant } from './size-context'
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* The ringed box of a text field. It steps from rest to a muted fill when lit
|
|
14
|
+
* (hovered, or `data-active` from a group's fluid hover) to the card fill
|
|
15
|
+
* when focused. `data-invalid` keeps a destructive ring in every state and
|
|
16
|
+
* tints the lit fill; `data-disabled` frames and dims it; `data-readonly`
|
|
17
|
+
* shows the ring when lit or focused but never lifts the fill. Put it on the
|
|
18
|
+
* element around the control and stamp the data attributes; Base UI parts
|
|
19
|
+
* stamp `data-invalid` / `data-disabled` themselves.
|
|
20
|
+
*/
|
|
21
|
+
export const fieldVariants = cva(
|
|
22
|
+
[
|
|
23
|
+
'group/field ring-1 cursor-text transition-[background-color,box-shadow,opacity] duration-fast',
|
|
24
|
+
'hover:bg-muted/50 hover:ring-border data-[active]:bg-muted/50 data-[active]:ring-border',
|
|
25
|
+
// `!`: Uno doesn't emit the state variants in a fixed order, so the
|
|
26
|
+
// states that must win (focus fill, invalid ring) win on importance.
|
|
27
|
+
'focus-within:!bg-card focus-within:ring-border',
|
|
28
|
+
'data-[invalid]:!ring-destructive/50 data-[invalid]:hover:bg-destructive-light/60 data-[invalid]:data-[active]:bg-destructive-light/60',
|
|
29
|
+
'data-[disabled]:ring-border data-[disabled]:opacity-50 data-[disabled]:pointer-events-none',
|
|
30
|
+
// A read-only value can be selected and copied but not changed: the ring
|
|
31
|
+
// still answers the pointer and the keyboard, the fill never lifts. The
|
|
32
|
+
// attribute selector outranks the focus fill's at equal importance.
|
|
33
|
+
'data-[readonly]:cursor-default data-[readonly]:hover:!bg-transparent data-[readonly]:data-[active]:!bg-transparent data-[readonly]:focus-within:!bg-transparent',
|
|
34
|
+
],
|
|
35
|
+
{
|
|
36
|
+
variants: {
|
|
37
|
+
variant: {
|
|
38
|
+
// Invisible until lit or focused.
|
|
39
|
+
borderless: 'bg-transparent ring-transparent',
|
|
40
|
+
// Framed at rest.
|
|
41
|
+
bordered: 'bg-transparent ring-border',
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
defaultVariants: {
|
|
45
|
+
variant: 'borderless',
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
/** A leading icon inside a `fieldVariants` box: muted at rest, it darkens and thickens with the field. Pass `strokeWidth={1.5}`. */
|
|
51
|
+
export const fieldIconClasses =
|
|
52
|
+
'shrink-0 text-muted-foreground transition-[color,stroke-width] duration-fast group-hover/field:text-foreground group-hover/field:stroke-[2] group-data-[active]/field:text-foreground group-data-[active]/field:stroke-[2] group-focus-within/field:text-foreground group-focus-within/field:stroke-[2]'
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Content beside a field's text (an adornment): muted, held to the ladder's
|
|
56
|
+
* glyph size, and lit with the field like a leading icon. Strings read as a
|
|
57
|
+
* prefix or a unit.
|
|
58
|
+
*/
|
|
59
|
+
export const fieldAdornmentClasses =
|
|
60
|
+
'flex shrink-0 items-center whitespace-nowrap text-muted-foreground transition-[color] duration-fast group-hover/field:text-foreground group-data-[active]/field:text-foreground group-focus-within/field:text-foreground'
|
|
61
|
+
|
|
62
|
+
/** Glyph size for an adornment's icons, per ladder step (16px default, 14px compact). */
|
|
63
|
+
export const FIELD_ADORNMENT_ICON: Record<SizeVariant, string> = {
|
|
64
|
+
default: '[&_svg]:size-4',
|
|
65
|
+
compact: '[&_svg]:size-3.5',
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* A small icon button inside a field box (a password reveal, a clear, a
|
|
70
|
+
* stepper): 4px inside the ring on every side (28px in a 36px field, 20px in
|
|
71
|
+
* a 28px one), its negative margin taking back the box's inset so the gap to
|
|
72
|
+
* the edge matches the gap above and below.
|
|
73
|
+
*/
|
|
74
|
+
export const FIELD_ACTION: Record<SizeVariant, string> = {
|
|
75
|
+
default: 'size-7 -mx-1.5 [&_svg]:size-4',
|
|
76
|
+
compact: 'size-5 -mx-1 [&_svg]:size-3.5',
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/** A field action's box alone, without `FIELD_ACTION`'s margins, for actions set side by side (a stepper pair). */
|
|
80
|
+
export const FIELD_ACTION_BOX: Record<SizeVariant, string> = {
|
|
81
|
+
default: 'size-7 [&_svg]:size-4',
|
|
82
|
+
compact: 'size-5 [&_svg]:size-3.5',
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/** The margin that pulls the last of several side-by-side actions to 4px inside the ring. */
|
|
86
|
+
export const FIELD_ACTION_END: Record<SizeVariant, string> = {
|
|
87
|
+
default: '-mr-1.5',
|
|
88
|
+
compact: '-mr-1',
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/** A field action's corners, concentric with the box's (8px box, 4px gap) or round in pill mode. */
|
|
92
|
+
export const FIELD_ACTION_RADIUS: Record<ShapeVariant, string> = {
|
|
93
|
+
rounded: 'rounded-sm',
|
|
94
|
+
pill: 'rounded-full',
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/** The classes every field action shares, beside its `FIELD_ACTION` size and radius. */
|
|
98
|
+
export const fieldActionClasses =
|
|
99
|
+
'relative inline-flex shrink-0 cursor-pointer items-center justify-center text-muted-foreground outline-none transition-[color,background-color,opacity] duration-fast hover:bg-hover hover:text-foreground active:bg-active focus-visible:ring-1 focus-visible:ring-focus-ring disabled:pointer-events-none disabled:opacity-50 data-[disabled]:pointer-events-none data-[disabled]:opacity-50'
|
|
100
|
+
|
|
101
|
+
// Literal tables: one notch tighter than the ladder's `px`, since the ring is
|
|
102
|
+
// invisible at rest and the roomier inset would read as a gap.
|
|
103
|
+
|
|
104
|
+
/** Horizontal inset of a field box. */
|
|
105
|
+
export const FIELD_PX: Record<SizeVariant, string> = {
|
|
106
|
+
default: 'px-2.5',
|
|
107
|
+
compact: 'px-2',
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/** Left inset of the text around a field (label, description, error), so it lines up with the text inside the box. */
|
|
111
|
+
export const FIELD_TEXT_INSET: Record<SizeVariant, string> = {
|
|
112
|
+
default: 'pl-2.5',
|
|
113
|
+
compact: 'pl-2',
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/** Framed at rest (`bordered`), or invisible until hovered or focused (`borderless`). */
|
|
117
|
+
export type FieldVariant = 'bordered' | 'borderless'
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Vendored from Fluid Functionalism — `registry/default/fluid-hover-highlight.tsx` at
|
|
3
|
+
* github.com/mickadesign/fluid-functionalism@b3587bdbd83fc66c2a6aae3817ffb856cb09260b
|
|
4
|
+
* (fluidfunctionalism.com). MIT License © 2026 Micka Touillaud — see
|
|
5
|
+
* LICENSE.fluid-functionalism in this package.
|
|
6
|
+
*
|
|
7
|
+
* Local modifications:
|
|
8
|
+
* - `"use client"` directive dropped (no RSC here).
|
|
9
|
+
* - `framer-motion` → `motion/react` (the package's current name).
|
|
10
|
+
* - `@/lib/*` and `@/hooks/*` imports rewritten to sibling `./*` paths.
|
|
11
|
+
* - The fill is a `GooIndicator` (`./goo-indicator`, local): it melts from row
|
|
12
|
+
* to row with a liquid neck instead of sliding as one box. The keyed fade,
|
|
13
|
+
* `from`, `hidden` and `transition` behave as before; a square highlight
|
|
14
|
+
* (no radius) has nothing to melt and slides as before.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { AnimatePresence, motion, type Transition, useReducedMotion } from 'motion/react'
|
|
18
|
+
import { GooIndicator } from './goo-indicator'
|
|
19
|
+
import { spring } from './springs'
|
|
20
|
+
import type { ItemRect, UseFluidHoverReturn } from './use-fluid-hover'
|
|
21
|
+
import { cn } from './utils'
|
|
22
|
+
|
|
23
|
+
// ---------------------------------------------------------------------------
|
|
24
|
+
// The one hover highlight every fluid hover list renders: an absolutely
|
|
25
|
+
// positioned fill that springs between the rects `useFluidHover` measures.
|
|
26
|
+
// Consumers used to hand-roll this motion.div; this is that block, once.
|
|
27
|
+
//
|
|
28
|
+
// const hover = useFluidHover(ref);
|
|
29
|
+
// <FluidHoverHighlight hover={hover} className={shape.bg} />
|
|
30
|
+
//
|
|
31
|
+
// It owns no layout opinion beyond `absolute`: radius, z-index, and the
|
|
32
|
+
// offsetParent (the container must be `relative`) are the consumer's.
|
|
33
|
+
// ---------------------------------------------------------------------------
|
|
34
|
+
|
|
35
|
+
/** What the highlight reads off the hook: the highlighted index, the
|
|
36
|
+
* measured rects, whether they are current, and the pointer session. */
|
|
37
|
+
export type FluidHoverSource = Pick<UseFluidHoverReturn, 'activeIndex' | 'itemRects' | 'isMeasured' | 'sessionRef'>
|
|
38
|
+
|
|
39
|
+
interface HighlightFromHook {
|
|
40
|
+
/** The hook's return value. The highlight sits on
|
|
41
|
+
* `itemRects[activeIndex]` once `isMeasured`, and re-keys on the session. */
|
|
42
|
+
hover: FluidHoverSource
|
|
43
|
+
/** Keep the list's state but show nothing (a closed popup, hover switched
|
|
44
|
+
* off). Runs the exit fade. */
|
|
45
|
+
hidden?: boolean
|
|
46
|
+
rect?: never
|
|
47
|
+
session?: never
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
interface HighlightFromRect {
|
|
51
|
+
/** For lists that resolve their own rect (the sidebar's unified scope):
|
|
52
|
+
* the rect to sit on, in the container's coordinate space. `null` hides
|
|
53
|
+
* the highlight (it fades out on `spring.fast.exit`). */
|
|
54
|
+
rect: ItemRect | null
|
|
55
|
+
/** `sessionRef.current` from `useFluidHover`. It increments when the
|
|
56
|
+
* cursor enters the container, which re-keys the highlight so it fades in
|
|
57
|
+
* at `from ?? rect` instead of sliding over from wherever it was last. */
|
|
58
|
+
session: number
|
|
59
|
+
hover?: never
|
|
60
|
+
hidden?: never
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export type FluidHoverHighlightProps = (HighlightFromHook | HighlightFromRect) & {
|
|
64
|
+
/** Where a fresh session fades in from. A dropdown passes its checked row,
|
|
65
|
+
* a nav menu its active route. Defaults to the rect itself. */
|
|
66
|
+
from?: ItemRect | null
|
|
67
|
+
/** Radius, z-index, anything else. Merged onto
|
|
68
|
+
* `absolute bg-hover pointer-events-none`. */
|
|
69
|
+
className?: string
|
|
70
|
+
/** The positional spring. Defaults to `spring.fast`. Pass `false` to snap
|
|
71
|
+
* to the new rect with no travel (a layout reflow that moved the rows
|
|
72
|
+
* underneath, not a hover change). The opacity fade is always 0.08s. */
|
|
73
|
+
transition?: Transition | false
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const fade: Transition = { duration: 0.08 }
|
|
77
|
+
const snap: Transition = { duration: 0 }
|
|
78
|
+
|
|
79
|
+
/** A measured rect as animation targets: position as a transform, size as
|
|
80
|
+
* layout. Exported for the unit test. */
|
|
81
|
+
export function toTarget(rect: ItemRect) {
|
|
82
|
+
return { x: rect.left, y: rect.top, width: rect.width, height: rect.height }
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Resolves the positional transition. Reduced motion keeps the opacity fade
|
|
87
|
+
* and drops the travel, per the motion guidelines: fewer and gentler, not
|
|
88
|
+
* none. Exported for the unit test.
|
|
89
|
+
*/
|
|
90
|
+
export function resolveHighlightTransition(
|
|
91
|
+
transition: Transition | false | undefined,
|
|
92
|
+
reduceMotion: boolean,
|
|
93
|
+
): Transition {
|
|
94
|
+
const positional = transition === false || reduceMotion ? snap : (transition ?? spring.fast)
|
|
95
|
+
return { ...positional, opacity: fade }
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/** The rect and session a set of props resolves to. Exported for the test. */
|
|
99
|
+
export function resolveHighlightSource(props: FluidHoverHighlightProps): {
|
|
100
|
+
rect: ItemRect | null
|
|
101
|
+
session: number
|
|
102
|
+
} {
|
|
103
|
+
if (props.hover) {
|
|
104
|
+
const { activeIndex, itemRects, isMeasured, sessionRef } = props.hover
|
|
105
|
+
const rect = !props.hidden && isMeasured && activeIndex !== null ? (itemRects[activeIndex] ?? null) : null
|
|
106
|
+
return { rect, session: sessionRef.current }
|
|
107
|
+
}
|
|
108
|
+
return { rect: props.rect, session: props.session }
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export function FluidHoverHighlight(props: FluidHoverHighlightProps) {
|
|
112
|
+
const { from, className, transition } = props
|
|
113
|
+
const { rect, session } = resolveHighlightSource(props)
|
|
114
|
+
// Reads the OS media query directly, so an installed copy honours reduced
|
|
115
|
+
// motion without the app wrapping its tree in MotionConfig.
|
|
116
|
+
const reduceMotion = useReducedMotion() ?? false
|
|
117
|
+
return (
|
|
118
|
+
<AnimatePresence>
|
|
119
|
+
{rect && (
|
|
120
|
+
<motion.div
|
|
121
|
+
key={session}
|
|
122
|
+
data-slot="fluid-hover-highlight"
|
|
123
|
+
className="pointer-events-none absolute top-0 left-0"
|
|
124
|
+
initial={{ opacity: 0 }}
|
|
125
|
+
animate={{ opacity: 1 }}
|
|
126
|
+
exit={{ opacity: 0, transition: spring.fast.exit }}
|
|
127
|
+
transition={fade}
|
|
128
|
+
>
|
|
129
|
+
<GooIndicator
|
|
130
|
+
rect={rect}
|
|
131
|
+
from={from}
|
|
132
|
+
className={cn('bg-hover', className)}
|
|
133
|
+
transition={transition === false || reduceMotion ? false : (transition ?? spring.fast)}
|
|
134
|
+
/>
|
|
135
|
+
</motion.div>
|
|
136
|
+
)}
|
|
137
|
+
</AnimatePresence>
|
|
138
|
+
)
|
|
139
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Local addition (not part of Fluid Functionalism): the one keyboard ring a
|
|
3
|
+
* list panel draws (Dropdown and its submenus, NavigationMenu's panels,
|
|
4
|
+
* Select): 2px outside the focused row, springing between rows on
|
|
5
|
+
* `spring.fast` (a snap under reduced motion) and fading out on its exit.
|
|
6
|
+
* Its corners follow the surrounding shape's `focusRing` radius, concentric
|
|
7
|
+
* with the row; a popup that pins its own shape passes it.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { AnimatePresence, motion } from 'motion/react'
|
|
11
|
+
import { useReduceMotion } from './reduced-motion'
|
|
12
|
+
import { type ShapeVariant, shapeMap, useShape } from './shape-context'
|
|
13
|
+
import { spring } from './springs'
|
|
14
|
+
import type { ItemRect } from './use-fluid-hover'
|
|
15
|
+
import { cn } from './utils'
|
|
16
|
+
|
|
17
|
+
interface FocusRingProps {
|
|
18
|
+
/** The focused row's rect in the panel's coordinates; nothing while none has keyboard focus. */
|
|
19
|
+
rect: ItemRect | null | undefined
|
|
20
|
+
/** Pins the radius to one shape (popups stay `rounded`); defaults to the surrounding ShapeProvider. */
|
|
21
|
+
shape?: ShapeVariant
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** The keyboard ring: 2px outside the focused row, springing between rows. */
|
|
25
|
+
function FocusRing({ rect, shape }: FocusRingProps) {
|
|
26
|
+
const surrounding = useShape()
|
|
27
|
+
const radius = (shape ? shapeMap[shape] : surrounding).focusRing
|
|
28
|
+
const reduced = useReduceMotion()
|
|
29
|
+
return (
|
|
30
|
+
<AnimatePresence>
|
|
31
|
+
{rect && (
|
|
32
|
+
<motion.div
|
|
33
|
+
aria-hidden="true"
|
|
34
|
+
className={cn('pointer-events-none absolute z-20 border border-focus-ring', radius)}
|
|
35
|
+
initial={false}
|
|
36
|
+
animate={{ left: rect.left - 2, top: rect.top - 2, width: rect.width + 4, height: rect.height + 4 }}
|
|
37
|
+
exit={{ opacity: 0, transition: spring.fast.exit }}
|
|
38
|
+
transition={reduced ? { duration: 0 } : { ...spring.fast, opacity: { duration: spring.fast.duration } }}
|
|
39
|
+
/>
|
|
40
|
+
)}
|
|
41
|
+
</AnimatePresence>
|
|
42
|
+
)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export type { FocusRingProps }
|
|
46
|
+
export { FocusRing }
|