@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
package/dist/tailwind.css
CHANGED
|
@@ -24,9 +24,14 @@
|
|
|
24
24
|
--color-accent-hover: var(--accent-hover);
|
|
25
25
|
--color-brand: var(--brand);
|
|
26
26
|
--color-brand-hover: var(--brand-hover);
|
|
27
|
+
--color-primary: var(--primary);
|
|
28
|
+
--color-primary-hover: var(--primary-hover);
|
|
29
|
+
--color-primary-active: var(--primary-active);
|
|
30
|
+
--color-primary-foreground: var(--primary-foreground);
|
|
27
31
|
--color-focus-ring: var(--focus-ring);
|
|
28
32
|
--color-overlay: rgb(var(--overlay));
|
|
29
33
|
--color-selected: var(--selected);
|
|
34
|
+
--color-sunken: var(--sunken);
|
|
30
35
|
--color-thumb: var(--thumb);
|
|
31
36
|
--color-picker-edge: var(--picker-edge);
|
|
32
37
|
--color-picker-ring: var(--picker-ring);
|
|
@@ -81,6 +86,7 @@
|
|
|
81
86
|
--shadow-surface-8: var(--shadow-8);
|
|
82
87
|
--shadow-thumb: var(--shadow-thumb);
|
|
83
88
|
--shadow-button-ghost: var(--shadow-button-ghost);
|
|
89
|
+
--shadow-button-primary: var(--shadow-button-primary);
|
|
84
90
|
--shadow-button-outline: var(--shadow-button-outline);
|
|
85
91
|
--shadow-button-outline-pressed: var(--shadow-button-outline-pressed);
|
|
86
92
|
--shadow-picker-thumb: var(--shadow-picker-thumb);
|
|
@@ -241,6 +247,14 @@
|
|
|
241
247
|
border-radius: var(--radius-pill-focus-ring);
|
|
242
248
|
}
|
|
243
249
|
|
|
250
|
+
@utility rounded-shell {
|
|
251
|
+
border-radius: var(--radius-shell);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
@utility rounded-pill-shell {
|
|
255
|
+
border-radius: var(--radius-pill-shell);
|
|
256
|
+
}
|
|
257
|
+
|
|
244
258
|
@utility text-trim {
|
|
245
259
|
text-box: trim-both cap alphabetic;
|
|
246
260
|
}
|
package/dist/tokens.css
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
* resolution point.
|
|
20
20
|
*
|
|
21
21
|
* The surface ladder and its shadow recipes live with their primitive in
|
|
22
|
-
* primitives/surface/surface.css. The one token that cannot ride
|
|
22
|
+
* primitives/systems/surface/surface.css. The one token that cannot ride
|
|
23
23
|
* light-dark() here — the --overlay RGB triplet (consumed as
|
|
24
24
|
* rgb(var(--overlay) / α), an alpha contract) — is re-pointed per scheme in
|
|
25
25
|
* base.css.
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
.light,
|
|
30
30
|
.dark {
|
|
31
31
|
/* The surface ladder (--surface-1..8) and the shadow recipes pair with it
|
|
32
|
-
in primitives/surface/surface.css. */
|
|
32
|
+
in primitives/systems/surface/surface.css. */
|
|
33
33
|
|
|
34
34
|
/* ── Semantic tokens ── */
|
|
35
35
|
/* Same color as --surface-1, inlined so the global token set never
|
|
@@ -45,6 +45,9 @@
|
|
|
45
45
|
semantic presence. Dark keeps the ladder value (= surface-2). */
|
|
46
46
|
--muted: light-dark(oklch(0.967 0.001 286.375), oklch(0.235 0 0));
|
|
47
47
|
--muted-foreground: light-dark(oklch(0.556 0 0), oklch(0.7155 0 0));
|
|
48
|
+
/* A tray set into the page, below surface 1 in both schemes (greyer in
|
|
49
|
+
light, darker in dark), so a card resting in it lifts out: ShellCard. */
|
|
50
|
+
--sunken: light-dark(oklch(0.955 0 0), oklch(0.17 0 0));
|
|
48
51
|
|
|
49
52
|
/* ── Interactive states ── */
|
|
50
53
|
--accent: light-dark(oklch(0.922 0 0), oklch(0.439 0 0));
|
|
@@ -103,7 +106,7 @@
|
|
|
103
106
|
--shadow-picker-cursor: 0 0 0 1px oklch(0 0 0 / 0.2);
|
|
104
107
|
--drop-shadow-picker-cursor: 0 1px 1px oklch(0 0 0 / 0.4);
|
|
105
108
|
|
|
106
|
-
/* ── Composer (
|
|
109
|
+
/* ── Composer (the ai kit's Composer.Draft) ──
|
|
107
110
|
The focused edge recolors surface-2's 1px ring; the drop keeps the
|
|
108
111
|
composer's lift under every edge state. */
|
|
109
112
|
--composer-edge-focus: color-mix(in oklab, var(--foreground) 20%, transparent);
|
|
@@ -157,7 +160,7 @@
|
|
|
157
160
|
--hover: light-dark(rgb(0 0 0 / 0.04), rgb(255 255 255 / 0.06));
|
|
158
161
|
--active: light-dark(rgb(0 0 0 / 0.07), rgb(255 255 255 / 0.1));
|
|
159
162
|
|
|
160
|
-
/* ── Syntax (primitives/code) ──
|
|
163
|
+
/* ── Syntax (primitives/content/code) ──
|
|
161
164
|
Low-chroma hues so code reads as text first; identifiers, JSX text and
|
|
162
165
|
punctuation ride the existing foreground pair. */
|
|
163
166
|
--syntax-keyword: light-dark(oklch(0.52 0.16 300), oklch(0.76 0.12 300));
|
|
@@ -171,6 +174,30 @@
|
|
|
171
174
|
--syntax-sign: var(--muted-foreground);
|
|
172
175
|
}
|
|
173
176
|
|
|
177
|
+
/* ── Primary action (theme hooks) ──
|
|
178
|
+
What the primary Button paints, as hooks a host re-points to recolour it
|
|
179
|
+
(a brand fill with a lit edge) without forking the component:
|
|
180
|
+
--primary the fill. Defaults to the ink.
|
|
181
|
+
--primary-hover its hover fill, 10% toward --background.
|
|
182
|
+
--primary-active its pressed fill, 20% toward --background.
|
|
183
|
+
--primary-foreground the label on the fill. Defaults to --background.
|
|
184
|
+
--shadow-button-primary an extra shadow list for the fill layer, drawn
|
|
185
|
+
over the layer's own press ring (a highlight,
|
|
186
|
+
an outline, a drop). The default is an
|
|
187
|
+
invisible no-op that stays valid in a list.
|
|
188
|
+
All five default to what the primary Button always drew. Override
|
|
189
|
+
--primary-hover and --primary-active with --primary, since their defaults
|
|
190
|
+
mix from the value --primary has where they are declared. `bg-primary`,
|
|
191
|
+
`text-primary-foreground` and `shadow-button-primary` read them. Zero
|
|
192
|
+
specificity (:where), so a host's override wins in any stylesheet order. */
|
|
193
|
+
:where(:root, .light, .dark) {
|
|
194
|
+
--primary: var(--foreground);
|
|
195
|
+
--primary-hover: color-mix(in oklab, var(--primary) 90%, var(--background));
|
|
196
|
+
--primary-active: color-mix(in oklab, var(--primary) 80%, var(--background));
|
|
197
|
+
--primary-foreground: var(--background);
|
|
198
|
+
--shadow-button-primary: 0 0 #0000;
|
|
199
|
+
}
|
|
200
|
+
|
|
174
201
|
/* ── Badge palette ──
|
|
175
202
|
Badge's `color` hues (upstream hex, as exact oklch). Constant across
|
|
176
203
|
schemes; the solid variant mixes each 15% into --background. */
|
|
@@ -264,6 +291,12 @@
|
|
|
264
291
|
--radius-pill: 20px;
|
|
265
292
|
--radius-focus-ring: 10px;
|
|
266
293
|
--radius-pill-focus-ring: 22px;
|
|
294
|
+
|
|
295
|
+
/* A shell one spacing step around a container, concentric with it: the
|
|
296
|
+
container's corner (12px rounded, 24px pill) plus the inset, read by
|
|
297
|
+
`rounded-shell|pill-shell` (ShellCard). */
|
|
298
|
+
--radius-shell: calc(12px + var(--space-2));
|
|
299
|
+
--radius-pill-shell: calc(24px + var(--space-2));
|
|
267
300
|
}
|
|
268
301
|
|
|
269
302
|
:root {
|
package/docs/chrome.css
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Local addition (not part of Fluid Functionalism): the docs chrome's look and
|
|
3
|
+
* layout, for modo-ui's own docs and any design system documented with modo
|
|
4
|
+
* (`@justanarthur/modo-ui/docs/chrome.css`). The lib ships structure only;
|
|
5
|
+
* these give its hooks the design system's look, tokens only. Both asides are
|
|
6
|
+
* inset Sidebars (`DocsNav` in ./chrome.tsx), which bring their own look; the
|
|
7
|
+
* rules for ./chrome.tsx's own elements key on `data-modo-ui`, so no utility
|
|
8
|
+
* generator has to scan it. Load it after the package stylesheet (base.css,
|
|
9
|
+
* styles.css or tailwind.css).
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/* modo's structural chrome CSS (shell/css) draws an unlayered `*:focus-visible` outline,
|
|
13
|
+
which would outrank the layered fallback above and every component's own
|
|
14
|
+
ring (a second ring on every control). Reverting both properties to the
|
|
15
|
+
layered cascade hands focus styling back to @layer base and the utilities. */
|
|
16
|
+
*:focus-visible {
|
|
17
|
+
outline: revert-layer;
|
|
18
|
+
outline-offset: revert-layer;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
:root {
|
|
22
|
+
/* A fixed length: the lib's 72ch resolves per element, so the lead,
|
|
23
|
+
captions and paragraphs each ended at a different width. */
|
|
24
|
+
--modo-measure: 45rem;
|
|
25
|
+
/* The inset topbar's band, where the corner triggers sit (`nav-trigger` below). */
|
|
26
|
+
--docs-band: calc(3rem + var(--space-2));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/* One reading column on every page: the article (example cards and prop
|
|
30
|
+
tables included), and an overview's header and grid, keep to the measure,
|
|
31
|
+
centered in the content area. */
|
|
32
|
+
[data-modo="content"] > * {
|
|
33
|
+
max-width: var(--modo-measure);
|
|
34
|
+
margin-inline: auto;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/* The canvas is the whole card, less the margin around it. */
|
|
38
|
+
[data-modo="content"] > [data-modo="canvas"] {
|
|
39
|
+
max-width: none;
|
|
40
|
+
margin-inline: 0;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
[data-modo="content"]:has(> [data-modo="canvas"]) {
|
|
44
|
+
height: calc(100dvh - 2 * var(--space-2));
|
|
45
|
+
overflow: hidden;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/* The inset layout, as Sidebar.Inset draws it: both asides are inset
|
|
49
|
+
Sidebars (DocsNav) and the content is the card between them. Each aside's
|
|
50
|
+
column follows its sidebar's width spring, so hiding one reflows the card.
|
|
51
|
+
Below md the lib's stacked layout stands: the header on top, the nav
|
|
52
|
+
folded under its menu toggle, the card at full width, the panel below. */
|
|
53
|
+
[data-modo="content"] {
|
|
54
|
+
margin: var(--space-2);
|
|
55
|
+
border-radius: var(--radius-xl);
|
|
56
|
+
background-color: var(--surface-2);
|
|
57
|
+
box-shadow: var(--shadow-2);
|
|
58
|
+
transition: margin var(--duration-fast);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
@media (min-width: 768px) {
|
|
62
|
+
[data-modo="app"] {
|
|
63
|
+
grid-template-columns: auto minmax(0, 1fr) auto;
|
|
64
|
+
grid-template-rows: none;
|
|
65
|
+
grid-template-areas: "sidebar content panel";
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
[data-modo="sidebar"],
|
|
69
|
+
[data-modo="panel"] {
|
|
70
|
+
position: sticky;
|
|
71
|
+
top: 0;
|
|
72
|
+
/* Over the card: the corner triggers overlap it. */
|
|
73
|
+
z-index: 1;
|
|
74
|
+
height: 100dvh;
|
|
75
|
+
max-height: none;
|
|
76
|
+
/* The Sidebar scrolls its own rows. */
|
|
77
|
+
overflow: visible;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/* modo's column scrolls what sits under the header; ui's Sidebar scrolls
|
|
81
|
+
its own rows and slides out by itself, so that layer stays open. */
|
|
82
|
+
[data-modo="sidebar"] > :not([data-modo="header"]),
|
|
83
|
+
[data-modo="panel"] > * {
|
|
84
|
+
overflow: visible;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/* The trigger belongs in the card's top corner, level with the panel's, so it
|
|
88
|
+
positions against the column (sticky, so a containing block), not the
|
|
89
|
+
Sidebar wrapper that starts under the brand. */
|
|
90
|
+
[data-modo="sidebar"] > [data-slot="sidebar-wrapper"] {
|
|
91
|
+
position: static;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/* The brand rides along with the Sidebar: it never sets the column's width
|
|
95
|
+
(inline-size containment), so the column follows the Sidebar's own slide
|
|
96
|
+
and clips the brand as it closes. It keeps its height, so the Sidebar and
|
|
97
|
+
its trigger never jump. */
|
|
98
|
+
[data-modo="sidebar"] > [data-modo="header"] {
|
|
99
|
+
contain: inline-size;
|
|
100
|
+
flex-wrap: nowrap;
|
|
101
|
+
overflow: hidden;
|
|
102
|
+
white-space: nowrap;
|
|
103
|
+
/* Its own padding would still widen the column; the children carry it. */
|
|
104
|
+
padding-inline: 0;
|
|
105
|
+
/* The brand centres on the corner toggle. */
|
|
106
|
+
box-sizing: border-box;
|
|
107
|
+
height: var(--docs-band);
|
|
108
|
+
padding-top: var(--space-2);
|
|
109
|
+
padding-bottom: 0;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
[data-modo="sidebar"] > [data-modo="header"] > :first-child {
|
|
113
|
+
padding-left: var(--space-4);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
[data-modo="sidebar"] > [data-modo="header"] > :last-child {
|
|
117
|
+
padding-right: var(--space-4);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
[data-modo="content"] {
|
|
121
|
+
padding-top: var(--docs-band);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/* Flush with an open sidebar: its rows keep their own gutter. */
|
|
125
|
+
[data-modo="app"]:has(> [data-modo="sidebar"] [data-slot="sidebar"][data-state="expanded"]) > [data-modo="content"] {
|
|
126
|
+
margin-left: 0;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
[data-modo="app"]:has(> [data-modo="panel"] [data-slot="sidebar"][data-state="expanded"]) > [data-modo="content"] {
|
|
130
|
+
margin-right: 0;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/* The lib drops the TOC below xl; here the panel is a sidebar at any width. */
|
|
135
|
+
[data-modo="toc"] {
|
|
136
|
+
display: block;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/* The code panel under an example is flush with the frame, not a card in a card. */
|
|
140
|
+
[data-modo="example-code"] > * {
|
|
141
|
+
border-radius: 0;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/* The trigger in the card's top corner (DocsNav): level with the topbar band,
|
|
145
|
+
just outside the aside's edge, a gutter further out while that aside is hidden. */
|
|
146
|
+
[data-modo-ui="nav-trigger"] {
|
|
147
|
+
position: absolute;
|
|
148
|
+
top: var(--space-2);
|
|
149
|
+
display: flex;
|
|
150
|
+
height: calc(var(--docs-band) - var(--space-2));
|
|
151
|
+
align-items: center;
|
|
152
|
+
padding-inline: calc(var(--space-1) * 1.5);
|
|
153
|
+
transition: margin var(--duration-fast);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
[data-modo-ui="nav-trigger"][data-side="left"] {
|
|
157
|
+
left: 100%;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
[data-modo-ui="nav-trigger"][data-side="right"] {
|
|
161
|
+
right: 100%;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
[data-modo-ui="nav-trigger"][data-side="left"][data-gutter] {
|
|
165
|
+
margin-left: var(--space-2);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
[data-modo-ui="nav-trigger"][data-side="right"][data-gutter] {
|
|
169
|
+
margin-right: var(--space-2);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/* A panel section's control (the Theme select) under its group label. */
|
|
173
|
+
[data-modo-ui="nav-controls"] {
|
|
174
|
+
padding-inline: var(--space-2);
|
|
175
|
+
}
|
package/docs/chrome.tsx
ADDED
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Local addition (not part of Fluid Functionalism): the docs chrome, every slot
|
|
3
|
+
* adapter modo's viewer needs to draw a design system's docs the way modo-ui's
|
|
4
|
+
* own site is drawn. A modo.config.ts picks each one by export name:
|
|
5
|
+
* `./docs/chrome.tsx#DocsNav` here, `@justanarthur/modo-ui/docs#DocsNav` from
|
|
6
|
+
* another package. Its look is chrome.css (`@justanarthur/modo-ui/docs/chrome.css`),
|
|
7
|
+
* keyed on `data-modo-ui`, so no utility generator has to scan this module; the
|
|
8
|
+
* pre-paint theme controller is `docsTheme` (`@justanarthur/modo-ui/docs/vite`).
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
'use client'
|
|
12
|
+
|
|
13
|
+
import type {
|
|
14
|
+
IconSlotProps,
|
|
15
|
+
LinkSlotProps,
|
|
16
|
+
SelectOption,
|
|
17
|
+
SelectSlotProps,
|
|
18
|
+
SidebarItemProps,
|
|
19
|
+
SidebarSectionProps,
|
|
20
|
+
SidebarSlotProps,
|
|
21
|
+
} from '@justanarthur/modo'
|
|
22
|
+
import {
|
|
23
|
+
Check,
|
|
24
|
+
CodeXml,
|
|
25
|
+
Copy,
|
|
26
|
+
Link2,
|
|
27
|
+
type LucideIcon,
|
|
28
|
+
Maximize2,
|
|
29
|
+
Menu,
|
|
30
|
+
Monitor,
|
|
31
|
+
Moon,
|
|
32
|
+
Package,
|
|
33
|
+
Sun,
|
|
34
|
+
X,
|
|
35
|
+
} from 'lucide-react'
|
|
36
|
+
import { Children, createContext, isValidElement, type ReactNode, useContext, useEffect, useState } from 'react'
|
|
37
|
+
import ModoButton from '../components/actions/button'
|
|
38
|
+
import FluidSelect from '../components/inputs/select'
|
|
39
|
+
import Sidebar, { type SidebarSide, useSidebar } from '../components/navigation/sidebar'
|
|
40
|
+
import { useIsMobile } from '../lib/use-is-mobile'
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Button slot: the chrome's icon buttons (Show code, Copy, the anchor toggles), as the design
|
|
44
|
+
* system's Button. Pinned so a host with an item named `Button` of another shape is not matched by name.
|
|
45
|
+
*/
|
|
46
|
+
export const Button = ModoButton
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Link slot: every chrome and Markdown link, a plain anchor so the chrome's own link styling applies.
|
|
50
|
+
* Pinned so a host with an item named `Link` of another shape is not matched by name.
|
|
51
|
+
*/
|
|
52
|
+
export function Link({ href, children, ...rest }: LinkSlotProps) {
|
|
53
|
+
return (
|
|
54
|
+
<a href={href} {...rest}>
|
|
55
|
+
{children}
|
|
56
|
+
</a>
|
|
57
|
+
)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const icons: Record<string, LucideIcon> = {
|
|
61
|
+
code: CodeXml,
|
|
62
|
+
copy: Copy,
|
|
63
|
+
check: Check,
|
|
64
|
+
link: Link2,
|
|
65
|
+
maximize: Maximize2,
|
|
66
|
+
menu: Menu,
|
|
67
|
+
close: X,
|
|
68
|
+
sun: Sun,
|
|
69
|
+
moon: Moon,
|
|
70
|
+
npm: Package,
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** Icon slot: the chrome asks for icons by name; lucide draws them. */
|
|
74
|
+
export function Icon({ name, label }: IconSlotProps) {
|
|
75
|
+
if (name === 'github') return <GithubMark />
|
|
76
|
+
const Glyph = icons[name]
|
|
77
|
+
return Glyph ? <Glyph size={16} strokeWidth={1.5} aria-hidden /> : label
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/** lucide ships no brand marks; this is GitHub's (Simple Icons, CC0). */
|
|
81
|
+
function GithubMark() {
|
|
82
|
+
return (
|
|
83
|
+
<svg viewBox="0 0 24 24" width={16} height={16} fill="currentColor" aria-hidden>
|
|
84
|
+
<path d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12" />
|
|
85
|
+
</svg>
|
|
86
|
+
)
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Select slot: the chrome passes a flat `value` / `onValueChange` / `options`
|
|
91
|
+
* contract; FF's Select is compositional, so this maps one onto the other,
|
|
92
|
+
* an option's `group` onto a `Select.Group` under its `Select.Label`.
|
|
93
|
+
*/
|
|
94
|
+
export function Select({ value, onValueChange, options }: SelectSlotProps) {
|
|
95
|
+
const item = (option: SelectOption) => (
|
|
96
|
+
<FluidSelect.Item key={option.value} value={option.value}>
|
|
97
|
+
{option.label}
|
|
98
|
+
</FluidSelect.Item>
|
|
99
|
+
)
|
|
100
|
+
const groups = [...new Set(options.flatMap(option => option.group ?? []))]
|
|
101
|
+
return (
|
|
102
|
+
<FluidSelect value={value} onValueChange={onValueChange}>
|
|
103
|
+
<FluidSelect.Trigger />
|
|
104
|
+
<FluidSelect.Content>
|
|
105
|
+
{options.filter(option => option.group === undefined).map(item)}
|
|
106
|
+
{groups.map(group => (
|
|
107
|
+
<FluidSelect.Group key={group}>
|
|
108
|
+
<FluidSelect.Label>{group}</FluidSelect.Label>
|
|
109
|
+
{options.filter(option => option.group === group).map(item)}
|
|
110
|
+
</FluidSelect.Group>
|
|
111
|
+
))}
|
|
112
|
+
</FluidSelect.Content>
|
|
113
|
+
</FluidSelect>
|
|
114
|
+
)
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
type ThemePreference = 'light' | 'dark' | 'system'
|
|
118
|
+
|
|
119
|
+
declare global {
|
|
120
|
+
interface Window {
|
|
121
|
+
__uiTheme?: { get: () => ThemePreference; set: (next: ThemePreference) => void }
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Sidebar slot: both asides of the chrome, each an inset `Sidebar` with its
|
|
127
|
+
* own `openOnHover` provider, so the content between them is the inset card
|
|
128
|
+
* (chrome.css). The trigger in the card's corner (or `[` for the nav, `]` for
|
|
129
|
+
* the panel, page-scoped so a demo's own sidebar keeps its key only while
|
|
130
|
+
* focus is inside it) switches a side between open and on hover. Below md both sit in
|
|
131
|
+
* flow, as the chrome stacks them: the nav under the header's menu toggle,
|
|
132
|
+
* the panel below the content. The panel starts on hover below xl.
|
|
133
|
+
*
|
|
134
|
+
* A section of links is a collapsible `Sidebar.Group` whose rows share one
|
|
135
|
+
* `Sidebar.Menu`, so the current page and the hover highlight melt from link
|
|
136
|
+
* to link (the TOC's current heading too, as the page scrolls); a panel
|
|
137
|
+
* section (the Theme select) keeps its control under the group label. Pinned
|
|
138
|
+
* in modo.config.ts, since by name alone modo would adopt the documented
|
|
139
|
+
* `Sidebar`, an app shell that needs its provider.
|
|
140
|
+
*/
|
|
141
|
+
export const DocsNav = Object.assign(
|
|
142
|
+
function DocsNav({ children }: SidebarSlotProps) {
|
|
143
|
+
const [side, setSide] = useState<SidebarSide>()
|
|
144
|
+
// The slot gets no side: which aside it landed in tells, before first paint.
|
|
145
|
+
if (!side) return <div ref={node => node && setSide(node.closest('[data-modo="panel"]') ? 'right' : 'left')} />
|
|
146
|
+
return <DocsSidebar side={side}>{children}</DocsSidebar>
|
|
147
|
+
},
|
|
148
|
+
{ Item: DocsNavItem, Section: DocsNavSection },
|
|
149
|
+
)
|
|
150
|
+
|
|
151
|
+
function DocsSidebar({ side, children }: { side: SidebarSide; children?: ReactNode }) {
|
|
152
|
+
const isMobile = useIsMobile(768)
|
|
153
|
+
const nav = (
|
|
154
|
+
<Sidebar.Content>
|
|
155
|
+
<nav aria-label={side === 'left' ? 'Docs' : 'Page'}>{children}</nav>
|
|
156
|
+
</Sidebar.Content>
|
|
157
|
+
)
|
|
158
|
+
// Below md the chrome stacks: the nav folds under the header's menu toggle
|
|
159
|
+
// and the panel sits below the content, so both render in flow, not as drawers.
|
|
160
|
+
if (isMobile) {
|
|
161
|
+
return (
|
|
162
|
+
<Sidebar.Provider persist={false} shortcut={null} style={{ minHeight: 0 }}>
|
|
163
|
+
<Sidebar
|
|
164
|
+
variant="inset"
|
|
165
|
+
side={side}
|
|
166
|
+
collapsible="none"
|
|
167
|
+
style={{ position: 'static', height: 'auto', width: '100%' }}
|
|
168
|
+
>
|
|
169
|
+
{nav}
|
|
170
|
+
</Sidebar>
|
|
171
|
+
</Sidebar.Provider>
|
|
172
|
+
)
|
|
173
|
+
}
|
|
174
|
+
return (
|
|
175
|
+
// The chrome's column holds the header above the nav, so the sidebar fills
|
|
176
|
+
// what is left of it rather than the whole viewport.
|
|
177
|
+
<Sidebar.Provider
|
|
178
|
+
defaultOpen={side === 'left' || window.matchMedia('(min-width: 1280px)').matches}
|
|
179
|
+
openOnHover
|
|
180
|
+
persist={false}
|
|
181
|
+
shortcutScope="page"
|
|
182
|
+
style={{ height: '100%', minHeight: 0 }}
|
|
183
|
+
>
|
|
184
|
+
<Sidebar variant="inset" side={side} style={{ height: '100%' }}>
|
|
185
|
+
{nav}
|
|
186
|
+
</Sidebar>
|
|
187
|
+
<DocsNavTrigger side={side} />
|
|
188
|
+
</Sidebar.Provider>
|
|
189
|
+
)
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* The trigger, in the card's top corner where the inset topbar keeps it. The
|
|
194
|
+
* card sits flush with an open sidebar and a gutter away from a hidden one,
|
|
195
|
+
* so the trigger follows (chrome.css, `nav-trigger`), in the band `--docs-band` sets.
|
|
196
|
+
*/
|
|
197
|
+
function DocsNavTrigger({ side }: { side: SidebarSide }) {
|
|
198
|
+
const { state, isMobile } = useSidebar()
|
|
199
|
+
return (
|
|
200
|
+
<div data-modo-ui="nav-trigger" data-side={side} data-gutter={state === 'collapsed' || isMobile ? '' : undefined}>
|
|
201
|
+
<Sidebar.Trigger />
|
|
202
|
+
</div>
|
|
203
|
+
)
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/** How deep a nav element sits: a tier is a section, a group folder a section inside it, a nested group deeper still. */
|
|
207
|
+
const NavDepth = createContext(0)
|
|
208
|
+
|
|
209
|
+
function DocsNavItem({ href, active, children }: SidebarItemProps) {
|
|
210
|
+
const { setOpenMobile } = useSidebar()
|
|
211
|
+
if (useContext(NavDepth) >= 2) {
|
|
212
|
+
return (
|
|
213
|
+
<Sidebar.MenuSubItem>
|
|
214
|
+
<Sidebar.MenuSubButton href={href} isActive={active} onClick={() => setOpenMobile(false)}>
|
|
215
|
+
{children}
|
|
216
|
+
</Sidebar.MenuSubButton>
|
|
217
|
+
</Sidebar.MenuSubItem>
|
|
218
|
+
)
|
|
219
|
+
}
|
|
220
|
+
return (
|
|
221
|
+
<Sidebar.MenuItem>
|
|
222
|
+
<Sidebar.MenuButton isActive={active} render={<a href={href} />} onClick={() => setOpenMobile(false)}>
|
|
223
|
+
{children}
|
|
224
|
+
</Sidebar.MenuButton>
|
|
225
|
+
</Sidebar.MenuItem>
|
|
226
|
+
)
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
function DocsNavSection({ title, children }: SidebarSectionProps) {
|
|
230
|
+
const depth = useContext(NavDepth)
|
|
231
|
+
if (depth >= 1) return <DocsNavGroup title={title}>{children}</DocsNavGroup>
|
|
232
|
+
const onlyLinks = Children.toArray(children).every(
|
|
233
|
+
child => isValidElement(child) && (child.type === DocsNavItem || child.type === DocsNavSection),
|
|
234
|
+
)
|
|
235
|
+
if (onlyLinks) {
|
|
236
|
+
return (
|
|
237
|
+
<Sidebar.Group collapsible>
|
|
238
|
+
<Sidebar.GroupLabel>{title}</Sidebar.GroupLabel>
|
|
239
|
+
<NavDepth.Provider value={1}>
|
|
240
|
+
<Sidebar.Menu>{children}</Sidebar.Menu>
|
|
241
|
+
</NavDepth.Provider>
|
|
242
|
+
</Sidebar.Group>
|
|
243
|
+
)
|
|
244
|
+
}
|
|
245
|
+
return (
|
|
246
|
+
<Sidebar.Group>
|
|
247
|
+
<Sidebar.GroupLabel>{title}</Sidebar.GroupLabel>
|
|
248
|
+
<div data-modo-ui="nav-controls">{children}</div>
|
|
249
|
+
</Sidebar.Group>
|
|
250
|
+
)
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/** Whether a nav subtree holds the current page, nested groups included. */
|
|
254
|
+
const holdsActive = (children: ReactNode): boolean =>
|
|
255
|
+
Children.toArray(children).some(
|
|
256
|
+
child =>
|
|
257
|
+
isValidElement<{ active?: boolean; children?: ReactNode }>(child) &&
|
|
258
|
+
(child.props.active || holdsActive(child.props.children)),
|
|
259
|
+
)
|
|
260
|
+
|
|
261
|
+
/** A group folder inside a tier (or inside another group): a collapsible row, opened while it holds the current page. */
|
|
262
|
+
function DocsNavGroup({ title, children }: SidebarSectionProps) {
|
|
263
|
+
const depth = useContext(NavDepth)
|
|
264
|
+
const current = holdsActive(children)
|
|
265
|
+
const [open, setOpen] = useState(current)
|
|
266
|
+
useEffect(() => {
|
|
267
|
+
if (current) setOpen(true)
|
|
268
|
+
}, [current])
|
|
269
|
+
return (
|
|
270
|
+
<Sidebar.MenuItem collapsible open={open} onOpenChange={setOpen}>
|
|
271
|
+
<Sidebar.MenuButton>{title}</Sidebar.MenuButton>
|
|
272
|
+
<NavDepth.Provider value={depth + 1}>
|
|
273
|
+
<Sidebar.MenuSub>{children}</Sidebar.MenuSub>
|
|
274
|
+
</NavDepth.Provider>
|
|
275
|
+
</Sidebar.MenuItem>
|
|
276
|
+
)
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
const THEMES = [
|
|
280
|
+
{ value: 'light' as const, label: 'Light', icon: Sun },
|
|
281
|
+
{ value: 'dark' as const, label: 'Dark', icon: Moon },
|
|
282
|
+
{ value: 'system' as const, label: 'System', icon: Monitor },
|
|
283
|
+
]
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* Theme panel item. The switching itself is the pre-paint script `docsTheme`
|
|
287
|
+
* injects (`window.__uiTheme`), so a stored preference applies before first
|
|
288
|
+
* paint; this only reflects and sets it. `ui:themechange` also fires when the
|
|
289
|
+
* OS flips underneath 'system'.
|
|
290
|
+
*/
|
|
291
|
+
export function ThemeSwitcher() {
|
|
292
|
+
const [preference, setPreference] = useState<ThemePreference>(() => window.__uiTheme?.get() ?? 'system')
|
|
293
|
+
|
|
294
|
+
useEffect(() => {
|
|
295
|
+
const sync = () => setPreference(window.__uiTheme?.get() ?? 'system')
|
|
296
|
+
window.addEventListener('ui:themechange', sync)
|
|
297
|
+
return () => window.removeEventListener('ui:themechange', sync)
|
|
298
|
+
}, [])
|
|
299
|
+
|
|
300
|
+
const active = THEMES.find(theme => theme.value === preference) ?? THEMES[2]!
|
|
301
|
+
|
|
302
|
+
return (
|
|
303
|
+
<FluidSelect value={preference} onValueChange={next => window.__uiTheme?.set(next as ThemePreference)}>
|
|
304
|
+
<FluidSelect.Trigger aria-label="Color theme" icon={active.icon} />
|
|
305
|
+
<FluidSelect.Content>
|
|
306
|
+
{THEMES.map((theme, index) => (
|
|
307
|
+
<FluidSelect.Item key={theme.value} index={index} value={theme.value} icon={theme.icon}>
|
|
308
|
+
{theme.label}
|
|
309
|
+
</FluidSelect.Item>
|
|
310
|
+
))}
|
|
311
|
+
</FluidSelect.Content>
|
|
312
|
+
</FluidSelect>
|
|
313
|
+
)
|
|
314
|
+
}
|
package/docs/index.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The docs chrome as one module, for a design system documented with modo:
|
|
3
|
+
* `shell: { Sidebar: '@justanarthur/modo-ui/docs#DocsNav', … }` and
|
|
4
|
+
* `panel: { items: [{ label: 'Theme', component: '@justanarthur/modo-ui/docs#ThemeSwitcher' }] }`.
|
|
5
|
+
* Its look is `@justanarthur/modo-ui/docs/chrome.css`; the pre-paint theme controller is
|
|
6
|
+
* `docsTheme` in `@justanarthur/modo-ui/docs/vite`. The package's main entry never imports it.
|
|
7
|
+
*/
|
|
8
|
+
export * from './chrome'
|