@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/README.md
CHANGED
|
@@ -24,14 +24,21 @@ import Dialog from '@justanarthur/modo-ui/components/overlays/dialog'
|
|
|
24
24
|
```
|
|
25
25
|
|
|
26
26
|
Subpaths follow the docs' tiers and groups: `primitives/*`, `components/*`
|
|
27
|
-
(`components/button`, `components/inputs/select`, …) and `blocks/*`
|
|
28
|
-
(`blocks/sidebar-app`).
|
|
29
|
-
your own: `lib/utils`, `lib/springs`, `lib/size-scale`,
|
|
30
|
-
`lib/
|
|
31
|
-
`lib/
|
|
32
|
-
`lib/
|
|
33
|
-
`
|
|
34
|
-
`
|
|
27
|
+
(`components/actions/button`, `components/inputs/select`, …) and `blocks/*`
|
|
28
|
+
(`blocks/sidebar-app`). Every shared system in `lib/` is a subpath too, for
|
|
29
|
+
components of your own: `lib/utils`, `lib/springs`, `lib/size-scale`,
|
|
30
|
+
`lib/shape-classes`, `lib/field-classes`, `lib/field-box`, `lib/size-context`,
|
|
31
|
+
`lib/shape-context` (`useShape`, `useShapeContext`), `lib/surface-classes`,
|
|
32
|
+
`lib/surface-context`, `lib/icon-context` (`useIcon`, `useIcons`,
|
|
33
|
+
`IconProvider`), `lib/use-controllable-state`, `lib/use-morph`,
|
|
34
|
+
`lib/goo-indicator`, `lib/use-fluid-hover`, `lib/fluid-hover-highlight`,
|
|
35
|
+
`lib/reduced-motion`, `lib/scroll-column`, `lib/slot` (`cloneSlot`),
|
|
36
|
+
`lib/row-order` and the rest of the folder. Button's, Badge's, ColorPicker's and
|
|
37
|
+
FileDropzone's pure tables are `components/actions/button/variants`,
|
|
38
|
+
`components/data-display/badge/variants`,
|
|
39
|
+
`components/inputs/color-picker/variants` and
|
|
40
|
+
`components/inputs/file-dropzone/variants`. `tokens/<group>.css` serves each
|
|
41
|
+
token group's source (`colors`, `typography`, `motion`, `radius`, `spacing`).
|
|
35
42
|
|
|
36
43
|
## Styles
|
|
37
44
|
|
|
@@ -116,6 +123,11 @@ color both sides with `light-dark()`:
|
|
|
116
123
|
}
|
|
117
124
|
```
|
|
118
125
|
|
|
126
|
+
The primary Button paints with its own hooks, so a brand fill needs no fork:
|
|
127
|
+
`--primary`, `--primary-hover`, `--primary-active`, `--primary-foreground` and
|
|
128
|
+
`--shadow-button-primary` (an extra shadow list on the fill). They default to
|
|
129
|
+
the ink; re-point `--primary-hover` and `--primary-active` with `--primary`.
|
|
130
|
+
|
|
119
131
|
The tokens live in five groups: colors (`--background`, `--foreground`,
|
|
120
132
|
`--muted-foreground`, `--accent`, `--brand`, `--destructive`, `--status-*`,
|
|
121
133
|
`--syntax-*`, …), typography (`--font-sans`, `--text-<role>`,
|
|
@@ -138,7 +150,7 @@ The same conventions run through every component:
|
|
|
138
150
|
`SizeProvider`, so one `<SizeProvider size="compact">` makes a whole
|
|
139
151
|
region dense, menus included.
|
|
140
152
|
- **Forms.** Checkbox, `Radio.Group`, Switch, Select, Combobox, Slider,
|
|
141
|
-
NumberInput, ColorPicker and the date and time pickers take `name` and
|
|
153
|
+
NumberInput, ColorPicker, ChoiceList and the date and time pickers take `name` and
|
|
142
154
|
submit their value with the surrounding form; Input and Textarea are native
|
|
143
155
|
fields. Text fields, Select and Combobox take `readOnly` and `required`.
|
|
144
156
|
- **Fields.** Wrap a control in `Field` for a label, a description and an
|
|
@@ -179,22 +191,16 @@ The same conventions run through every component:
|
|
|
179
191
|
- Every module with state, effects, handlers or browser APIs opens with
|
|
180
192
|
`'use client'`, kept at the top of each built chunk, so the components work
|
|
181
193
|
from Server Components (Next.js App Router) as client components.
|
|
182
|
-
- `@justanarthur/modo-ui/lib/{utils,springs,size-scale,shape-classes,field-classes}`
|
|
183
|
-
and `components/{button,badge,inputs/file-dropzone}/variants` carry no
|
|
194
|
+
- `@justanarthur/modo-ui/lib/{utils,springs,size-scale,shape-classes,field-classes,surface-classes}`
|
|
195
|
+
and `components/{actions/button,data-display/badge,inputs/color-picker,inputs/file-dropzone}/variants` carry no
|
|
184
196
|
`'use client'`, so a Server Component can call `cn`, read the class tables,
|
|
185
|
-
build a link with `buttonVariants
|
|
197
|
+
build a link with `buttonVariants({ surface: true })`, parse a color or check a file with `acceptsFile`. The
|
|
186
198
|
components and the context and hook subpaths are client modules; each
|
|
187
199
|
context is one instance, shared by the barrel, the items and the subpaths.
|
|
188
200
|
- In a Server Component, use the named parts (`CardHeader`, `DialogContent`,
|
|
189
201
|
`TabsList`, `SidebarMenuButton`, …) rather than the dotted form
|
|
190
202
|
(`Card.Header`): React can't read a property off a client module from the
|
|
191
203
|
server. Both are exported; the dotted form works in client components.
|
|
192
|
-
- `pdfjs-dist` is an optional peer, used only for PDF thumbnails in
|
|
193
|
-
`InputMessage` (`npm install pdfjs-dist`). It loads lazily on the first PDF
|
|
194
|
-
attachment, and fetches its worker from `cdn.jsdelivr.net`. Without it, a
|
|
195
|
-
PDF attachment shows the file icon and a console warning. Webpack-based
|
|
196
|
-
builds (Next.js) resolve the dynamic import at build time, so there install
|
|
197
|
-
`pdfjs-dist` or alias it to `false`.
|
|
198
204
|
|
|
199
205
|
## Hooks for your own components
|
|
200
206
|
|
|
@@ -206,6 +212,7 @@ show them):
|
|
|
206
212
|
|---|---|
|
|
207
213
|
| `useMorph(open, origin, options)` | The morph engine: grows an overlay's surface from its source (the trigger, the press point, an edge) to its own box on a spring tier, with a liquid goo neck by default, and holds it through the exit. |
|
|
208
214
|
| `MorphSurface` | Renders a `useMorph` state: the goo-filtered shape, the surface's background and shadow, the content clipped by it. |
|
|
215
|
+
| `GooFilter` | The SVG goo filter behind the morph and the indicators, for shapes of your own that melt together (`filter: url(#id)` on their parent). |
|
|
209
216
|
| `GooIndicator` | An indicator (a selection, a thumb) that travels between items' rects and melts like a drop of liquid on the way. |
|
|
210
217
|
| `useReduceMotion()` | The one reduced-motion read: the OS setting, or a `<MotionConfig reducedMotion>` asking for it. |
|
|
211
218
|
| `useControllableState(value, defaultValue, onChange)` | Controlled and uncontrolled state in one, Base UI style: controlled while `value` isn't `undefined`, reporting every change either way. |
|
|
@@ -216,6 +223,9 @@ show them):
|
|
|
216
223
|
| `IconProvider`, `ShapeProvider` | Swap the icon set, or switch every radius between rounded and pill. |
|
|
217
224
|
| `useFieldBox`, `useFieldState` (`lib/field-box`) | The field ladder's box around a control of your own, and an enclosing `Field`'s state resolved against a control's own props. |
|
|
218
225
|
| `useToast()`, `toast` | Show toasts: `useToast()` inside a `Toast`, or the global `toast` anywhere once `<Toast manager={toast} />` is mounted (one per app). Both have `show`, `success`, `error`, `warning`, `info`, `loading`, `promise`, `update` and `close`. |
|
|
226
|
+
| `Sortable`, `useSortableHandle`, `VirtualList`, `Resizable` | Building blocks for lists and layouts: reorder by pointer or keyboard (the handle props for a button of your own), render only the rows in view (a ref's `scrollToIndex`), and split a region into panes that resize. |
|
|
227
|
+
| `Diff`, `Markdown`, `LogView`, `parsePatch`, `parseAnsi` | Text on the page: a unified patch, a markdown string (on `marked`, raw HTML stays text, `streaming` for text that is still arriving) and terminal output with ANSI colors that follows its tail; the parsers for your own rendering. |
|
|
228
|
+
| `useAutosizeTextarea(ref, { minRows, maxRows }, deps)`, `useTouchPrimary()` | A textarea that grows with its text and then scrolls; whether the primary pointer is touch, to skip pointer-only machinery. |
|
|
219
229
|
| `cn` | Class merging that knows the token utilities (`cn('text-body', 'text-muted-foreground')` keeps both). |
|
|
220
230
|
|
|
221
231
|
## Documenting ui items in your own modo site
|
|
@@ -224,8 +234,8 @@ A [modo](https://github.com/justAnArthur/modo/tree/main/lib) site can list ui
|
|
|
224
234
|
items next to its own. Re-export one as an item:
|
|
225
235
|
|
|
226
236
|
```tsx
|
|
227
|
-
// components/button/index.tsx
|
|
228
|
-
export { default } from '@justanarthur/modo-ui/components/button'
|
|
237
|
+
// components/actions/button/index.tsx
|
|
238
|
+
export { default } from '@justanarthur/modo-ui/components/actions/button'
|
|
229
239
|
```
|
|
230
240
|
|
|
231
241
|
The package ships its TypeScript sources and each item's `examples.mdx` under
|
|
@@ -237,6 +247,35 @@ the prebuilt sheet holds the components' utilities, so for the layout
|
|
|
237
247
|
utilities the examples add, point your Tailwind `@source` or UnoCSS `content`
|
|
238
248
|
at `node_modules/@justanarthur/modo-ui/{primitives,components,blocks}`.
|
|
239
249
|
|
|
250
|
+
To wear ui's docs look as well, pin the chrome's slots to `@justanarthur/modo-ui/docs`,
|
|
251
|
+
load its look after the package styles and add the theme script:
|
|
252
|
+
|
|
253
|
+
```ts
|
|
254
|
+
// modo.config.ts
|
|
255
|
+
shell: {
|
|
256
|
+
Button: '@justanarthur/modo-ui/docs#Button',
|
|
257
|
+
Link: '@justanarthur/modo-ui/docs#Link',
|
|
258
|
+
Select: '@justanarthur/modo-ui/docs#Select',
|
|
259
|
+
Icon: '@justanarthur/modo-ui/docs#Icon',
|
|
260
|
+
Sidebar: '@justanarthur/modo-ui/docs#DocsNav',
|
|
261
|
+
},
|
|
262
|
+
panel: { items: [{ label: 'Theme', component: '@justanarthur/modo-ui/docs#ThemeSwitcher' }] },
|
|
263
|
+
vite: './vite.ts',
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
```css
|
|
267
|
+
/* the site's css */
|
|
268
|
+
@import "@justanarthur/modo-ui/docs/chrome.css";
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
`@justanarthur/modo-ui/docs/vite` exports `docsTheme({ storageKey })`, a Vite
|
|
272
|
+
plugin that applies the stored light / dark / system preference before first
|
|
273
|
+
paint (add it to `config.plugins` in your `vite` extension), and
|
|
274
|
+
`withUno(configFile)`, the whole extension for a UnoCSS host (UnoCSS over your
|
|
275
|
+
uno config, plus `docsTheme`; needs `unocss`). The chrome's own elements are
|
|
276
|
+
styled by `chrome.css` through `data-modo-ui` attributes, so nothing needs
|
|
277
|
+
scanning.
|
|
278
|
+
|
|
240
279
|
## Credits
|
|
241
280
|
|
|
242
281
|
modo-ui is a port of [Fluid Functionalism](https://github.com/mickadesign/fluid-functionalism)
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import DesktopShell from './index'
|
|
2
|
+
import Sidebar from '../../components/navigation/sidebar'
|
|
3
|
+
import Button from '../../components/actions/button'
|
|
4
|
+
import { FileText, Folder, Inbox, Search, Star } from 'lucide-react'
|
|
5
|
+
|
|
6
|
+
# macOS window
|
|
7
|
+
|
|
8
|
+
The title bar starts after the traffic lights (drawn here with `showControls`; a native window draws its own). Fold the sidebar with its toggle or `[`, the side pane with `]`. Drag the sidebar's rail, or the gutter between the card and the pane, to resize; double-click the gutter to reset it. The window is 960px wide: scroll it sideways in a narrow column.
|
|
9
|
+
|
|
10
|
+
<div className="w-full overflow-x-auto">
|
|
11
|
+
<div className="h-[560px] w-[960px] overflow-hidden rounded-xl border border-border">
|
|
12
|
+
<DesktopShell
|
|
13
|
+
showControls
|
|
14
|
+
title={<span className="truncate text-body weight-medium text-foreground">Quarterly notes</span>}
|
|
15
|
+
trailing={
|
|
16
|
+
<Button variant="ghost" size="icon-compact" aria-label="Search">
|
|
17
|
+
<Search />
|
|
18
|
+
</Button>
|
|
19
|
+
}
|
|
20
|
+
left={
|
|
21
|
+
<Sidebar variant="inset" defaultValue="inbox">
|
|
22
|
+
<Sidebar.Content>
|
|
23
|
+
<Sidebar.Group>
|
|
24
|
+
<Sidebar.GroupLabel>Library</Sidebar.GroupLabel>
|
|
25
|
+
<Sidebar.Menu>
|
|
26
|
+
<Sidebar.MenuItem><Sidebar.MenuButton icon={Inbox} value="inbox">Inbox</Sidebar.MenuButton></Sidebar.MenuItem>
|
|
27
|
+
<Sidebar.MenuItem><Sidebar.MenuButton icon={Star} value="starred">Starred</Sidebar.MenuButton></Sidebar.MenuItem>
|
|
28
|
+
<Sidebar.MenuItem><Sidebar.MenuButton icon={Folder} value="projects">Projects</Sidebar.MenuButton></Sidebar.MenuItem>
|
|
29
|
+
</Sidebar.Menu>
|
|
30
|
+
</Sidebar.Group>
|
|
31
|
+
</Sidebar.Content>
|
|
32
|
+
</Sidebar>
|
|
33
|
+
}
|
|
34
|
+
right={
|
|
35
|
+
<div className="flex flex-col gap-2 p-4">
|
|
36
|
+
<span className="text-subtitle text-foreground">Details</span>
|
|
37
|
+
<span className="text-body text-muted-foreground">The side pane: anything about what the main card shows.</span>
|
|
38
|
+
</div>
|
|
39
|
+
}
|
|
40
|
+
main={
|
|
41
|
+
<div className="flex flex-1 flex-col gap-2 p-6">
|
|
42
|
+
<span className="text-title text-foreground">Quarterly notes</span>
|
|
43
|
+
<span className="text-body text-muted-foreground">The main card keeps an even gutter to whichever sidebar is open.</span>
|
|
44
|
+
</div>
|
|
45
|
+
}
|
|
46
|
+
/>
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
|
|
50
|
+
# No title bar
|
|
51
|
+
|
|
52
|
+
With `titleBar="card"` nothing runs across the window: the traffic lights and the sidebar toggle sit in the sidebar's corner, and the title, your controls and the side pane toggle head the main card. Fold the sidebar and the card's header makes room for the corner.
|
|
53
|
+
|
|
54
|
+
<div className="w-full overflow-x-auto">
|
|
55
|
+
<div className="h-[560px] w-[960px] overflow-hidden rounded-xl border border-border">
|
|
56
|
+
<DesktopShell
|
|
57
|
+
showControls
|
|
58
|
+
titleBar="card"
|
|
59
|
+
title={<span className="truncate text-body weight-medium text-foreground">Quarterly notes</span>}
|
|
60
|
+
trailing={
|
|
61
|
+
<Button variant="ghost" size="icon-compact" aria-label="Search">
|
|
62
|
+
<Search />
|
|
63
|
+
</Button>
|
|
64
|
+
}
|
|
65
|
+
left={
|
|
66
|
+
<Sidebar variant="inset" defaultValue="inbox">
|
|
67
|
+
<Sidebar.Content>
|
|
68
|
+
<Sidebar.Group>
|
|
69
|
+
<Sidebar.GroupLabel>Library</Sidebar.GroupLabel>
|
|
70
|
+
<Sidebar.Menu>
|
|
71
|
+
<Sidebar.MenuItem><Sidebar.MenuButton icon={Inbox} value="inbox">Inbox</Sidebar.MenuButton></Sidebar.MenuItem>
|
|
72
|
+
<Sidebar.MenuItem><Sidebar.MenuButton icon={Star} value="starred">Starred</Sidebar.MenuButton></Sidebar.MenuItem>
|
|
73
|
+
<Sidebar.MenuItem><Sidebar.MenuButton icon={Folder} value="projects">Projects</Sidebar.MenuButton></Sidebar.MenuItem>
|
|
74
|
+
</Sidebar.Menu>
|
|
75
|
+
</Sidebar.Group>
|
|
76
|
+
</Sidebar.Content>
|
|
77
|
+
</Sidebar>
|
|
78
|
+
}
|
|
79
|
+
right={
|
|
80
|
+
<div className="flex flex-col gap-2 p-4">
|
|
81
|
+
<span className="text-subtitle text-foreground">Details</span>
|
|
82
|
+
<span className="text-body text-muted-foreground">The side pane: anything about what the main card shows.</span>
|
|
83
|
+
</div>
|
|
84
|
+
}
|
|
85
|
+
main={
|
|
86
|
+
<div className="flex flex-1 flex-col gap-2 p-6">
|
|
87
|
+
<span className="text-title text-foreground">Quarterly notes</span>
|
|
88
|
+
<span className="text-body text-muted-foreground">The main card keeps an even gutter to whichever sidebar is open.</span>
|
|
89
|
+
</div>
|
|
90
|
+
}
|
|
91
|
+
/>
|
|
92
|
+
</div>
|
|
93
|
+
</div>
|
|
94
|
+
|
|
95
|
+
# Windows and Linux
|
|
96
|
+
|
|
97
|
+
Off macOS the title bar starts at the edge; the stand-in window controls sit at its end. Here the side pane starts folded and there is no left sidebar.
|
|
98
|
+
|
|
99
|
+
<div className="w-full overflow-x-auto">
|
|
100
|
+
<div className="h-[420px] w-[960px] overflow-hidden rounded-xl border border-border">
|
|
101
|
+
<DesktopShell
|
|
102
|
+
platform="windows"
|
|
103
|
+
showControls
|
|
104
|
+
defaultRightOpen={false}
|
|
105
|
+
title={
|
|
106
|
+
<span className="flex min-w-0 items-center gap-2 text-body text-foreground">
|
|
107
|
+
<FileText size={14} strokeWidth={1.5} className="shrink-0" />
|
|
108
|
+
<span className="truncate">report.md</span>
|
|
109
|
+
</span>
|
|
110
|
+
}
|
|
111
|
+
right={<div className="p-4 text-body text-muted-foreground">Outline</div>}
|
|
112
|
+
main={<div className="p-6 text-body text-muted-foreground">The document.</div>}
|
|
113
|
+
/>
|
|
114
|
+
</div>
|
|
115
|
+
</div>
|
|
116
|
+
|
|
117
|
+
# Compact
|
|
118
|
+
|
|
119
|
+
`size="compact"` steps the title bar down the ladder to 28px.
|
|
120
|
+
|
|
121
|
+
<div className="w-full overflow-x-auto">
|
|
122
|
+
<div className="h-[320px] w-[960px] overflow-hidden rounded-xl border border-border">
|
|
123
|
+
<DesktopShell
|
|
124
|
+
size="compact"
|
|
125
|
+
showControls
|
|
126
|
+
title={<span className="truncate text-body-compact text-foreground">Compact window</span>}
|
|
127
|
+
main={<div className="p-6 text-body text-muted-foreground">Only the main card.</div>}
|
|
128
|
+
/>
|
|
129
|
+
</div>
|
|
130
|
+
</div>
|
|
131
|
+
|
|
132
|
+
# Narrow window
|
|
133
|
+
|
|
134
|
+
Below 768px the open side pane takes the main card's place; fold it with `]` or its toggle to get the card back.
|
|
135
|
+
|
|
136
|
+
<div className="h-[480px] w-[420px] max-w-full overflow-hidden rounded-xl border border-border">
|
|
137
|
+
<DesktopShell
|
|
138
|
+
showControls
|
|
139
|
+
defaultLeftOpen={false}
|
|
140
|
+
title={<span className="truncate text-body weight-medium text-foreground">Narrow</span>}
|
|
141
|
+
left={
|
|
142
|
+
<Sidebar variant="inset">
|
|
143
|
+
<Sidebar.Content>
|
|
144
|
+
<Sidebar.Menu>
|
|
145
|
+
<Sidebar.MenuItem><Sidebar.MenuButton icon={Inbox} value="inbox">Inbox</Sidebar.MenuButton></Sidebar.MenuItem>
|
|
146
|
+
</Sidebar.Menu>
|
|
147
|
+
</Sidebar.Content>
|
|
148
|
+
</Sidebar>
|
|
149
|
+
}
|
|
150
|
+
right={<div className="p-4 text-body text-muted-foreground">The side pane, in the card's place.</div>}
|
|
151
|
+
main={<div className="p-6 text-body text-muted-foreground">The main card.</div>}
|
|
152
|
+
/>
|
|
153
|
+
</div>
|
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Local addition (not part of Fluid Functionalism): the frame of a desktop
|
|
3
|
+
* app's window (Tauri, Electron): a title bar that drags the window, then a
|
|
4
|
+
* Sidebar, the main card and a side pane split off it on Resizable.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
'use client'
|
|
8
|
+
|
|
9
|
+
import { type ReactNode, useCallback, useLayoutEffect, useRef, useState } from 'react'
|
|
10
|
+
import Button from '../../components/actions/button'
|
|
11
|
+
import Sidebar from '../../components/navigation/sidebar'
|
|
12
|
+
import { useSidebarShortcut } from '../../components/navigation/sidebar/sidebar-shortcut'
|
|
13
|
+
import Tooltip from '../../components/overlays/tooltip'
|
|
14
|
+
import { useIcon } from '../../lib/icon-context'
|
|
15
|
+
import { useShape } from '../../lib/shape-context'
|
|
16
|
+
import { type SizeVariant, useSize } from '../../lib/size-context'
|
|
17
|
+
import { SURFACE_BG, SURFACE_SHADOW } from '../../lib/surface-classes'
|
|
18
|
+
import { SurfaceProvider, useLift } from '../../lib/surface-context'
|
|
19
|
+
import { useControllableState } from '../../lib/use-controllable-state'
|
|
20
|
+
import { cn } from '../../lib/utils'
|
|
21
|
+
import Resizable from '../../primitives/layout/resizable'
|
|
22
|
+
import { SizeProvider } from '../../primitives/systems/sizes'
|
|
23
|
+
|
|
24
|
+
type DesktopPlatform = 'mac' | 'windows' | 'linux'
|
|
25
|
+
|
|
26
|
+
/** Where the title and controls live: one bar across the window, or the main card's own header. */
|
|
27
|
+
type DesktopTitleBar = 'window' | 'card'
|
|
28
|
+
|
|
29
|
+
// Literal tables: UnoCSS only generates the classes it can read whole.
|
|
30
|
+
// The sidebar's content clears the corner controls by one control height.
|
|
31
|
+
const CORNER_CLEARANCE: Record<SizeVariant, string> = {
|
|
32
|
+
default: '[&>[data-slot=sidebar]_[data-sidebar=sidebar]]:pt-9',
|
|
33
|
+
compact: '[&>[data-slot=sidebar]_[data-sidebar=sidebar]]:pt-7',
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// The corner's width past the card's 8px inset: the traffic lights' 72px (on mac) and the 28px toggle.
|
|
37
|
+
const CORNER_ROOM: Record<DesktopPlatform, string> = {
|
|
38
|
+
mac: 'w-23 shrink-0',
|
|
39
|
+
windows: 'w-6 shrink-0',
|
|
40
|
+
linux: 'w-6 shrink-0',
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Below this window width the side pane takes the main card's place.
|
|
44
|
+
const NARROW = 768
|
|
45
|
+
|
|
46
|
+
interface DesktopShellProps {
|
|
47
|
+
/** The OS the window runs on: on `mac` the title bar starts after the traffic lights. Defaults to `'mac'`. */
|
|
48
|
+
platform?: DesktopPlatform
|
|
49
|
+
/** Draws stand-ins for the window controls, for a preview in the browser; a native window draws its own. Defaults to `false`. */
|
|
50
|
+
showControls?: boolean
|
|
51
|
+
/** `'window'` draws one bar across the window. `'card'` drops it: the window controls and the sidebar toggle sit in the sidebar's top corner, and the title, your controls and the side pane toggle head the main card. Defaults to `'window'`. */
|
|
52
|
+
titleBar?: DesktopTitleBar
|
|
53
|
+
/** Pins the title bar to one step of the size ladder (36px default, 28px compact). Defaults to the surrounding SizeProvider. */
|
|
54
|
+
size?: SizeVariant
|
|
55
|
+
/** The title bar's middle: the window's title, truncated to fit. */
|
|
56
|
+
title?: ReactNode
|
|
57
|
+
/** Controls after the sidebar toggle, at the title bar's start. */
|
|
58
|
+
leading?: ReactNode
|
|
59
|
+
/** Controls before the side pane toggle, at the title bar's end. */
|
|
60
|
+
trailing?: ReactNode
|
|
61
|
+
/** The left sidebar: a `Sidebar` (variant `inset`), with its header, content and footer. */
|
|
62
|
+
left?: ReactNode
|
|
63
|
+
/** The side pane's content, split off the main card's right. */
|
|
64
|
+
right?: ReactNode
|
|
65
|
+
/** The main card's content. */
|
|
66
|
+
main?: ReactNode
|
|
67
|
+
/** Controlled open state of the left sidebar. */
|
|
68
|
+
leftOpen?: boolean
|
|
69
|
+
/** The left sidebar's open state at first. Defaults to `true`. */
|
|
70
|
+
defaultLeftOpen?: boolean
|
|
71
|
+
/** Called when the left sidebar opens or folds. */
|
|
72
|
+
onLeftOpenChange?: (open: boolean) => void
|
|
73
|
+
/** Controlled open state of the side pane. */
|
|
74
|
+
rightOpen?: boolean
|
|
75
|
+
/** The side pane's open state at first. Defaults to `true`. */
|
|
76
|
+
defaultRightOpen?: boolean
|
|
77
|
+
/** Called when the side pane opens or folds, from its toggle, `]` or a drag past its minimum. */
|
|
78
|
+
onRightOpenChange?: (open: boolean) => void
|
|
79
|
+
/** The side pane's share of the space beside the left sidebar, in percent; a double-click on its handle comes back to it. Defaults to `35`. */
|
|
80
|
+
defaultPaneSize?: number
|
|
81
|
+
/** The side pane's smallest share, in percent; dragged below half of it, the pane folds. Defaults to `20`. */
|
|
82
|
+
minPaneSize?: number
|
|
83
|
+
/** The side pane's largest share, in percent. Defaults to `60`. */
|
|
84
|
+
maxPaneSize?: number
|
|
85
|
+
/** The left sidebar toggle's label. Defaults to `'Sidebar'`. */
|
|
86
|
+
leftLabel?: string
|
|
87
|
+
/** The side pane toggle's and its handle's label. Defaults to `'Side pane'`. */
|
|
88
|
+
rightLabel?: string
|
|
89
|
+
/** Classes for the window. */
|
|
90
|
+
className?: string
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function Toggle({
|
|
94
|
+
label,
|
|
95
|
+
open,
|
|
96
|
+
onClick,
|
|
97
|
+
side,
|
|
98
|
+
}: {
|
|
99
|
+
label: string
|
|
100
|
+
open: boolean
|
|
101
|
+
onClick: () => void
|
|
102
|
+
side: 'left' | 'right'
|
|
103
|
+
}) {
|
|
104
|
+
const Icon = useIcon(side === 'left' ? 'panel-left' : 'panel-right')
|
|
105
|
+
return (
|
|
106
|
+
<Tooltip content={label} side="bottom">
|
|
107
|
+
<Button
|
|
108
|
+
variant="ghost"
|
|
109
|
+
size="icon-compact"
|
|
110
|
+
aria-label={label}
|
|
111
|
+
aria-pressed={open}
|
|
112
|
+
active={open}
|
|
113
|
+
onClick={onClick}
|
|
114
|
+
>
|
|
115
|
+
<Icon />
|
|
116
|
+
</Button>
|
|
117
|
+
</Tooltip>
|
|
118
|
+
)
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function TrafficLights() {
|
|
122
|
+
return (
|
|
123
|
+
<span aria-hidden="true" className="flex items-center gap-2 pl-3">
|
|
124
|
+
<span className="size-3 rounded-full bg-status-error" />
|
|
125
|
+
<span className="size-3 rounded-full bg-status-warning" />
|
|
126
|
+
<span className="size-3 rounded-full bg-status-success" />
|
|
127
|
+
</span>
|
|
128
|
+
)
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
function WindowControls() {
|
|
132
|
+
const Minimize = useIcon('minus')
|
|
133
|
+
const Maximize = useIcon('square')
|
|
134
|
+
const Close = useIcon('x')
|
|
135
|
+
return (
|
|
136
|
+
<span className="flex shrink-0 items-center gap-0.5">
|
|
137
|
+
<Button variant="ghost" size="icon-compact" aria-label="Minimize">
|
|
138
|
+
<Minimize />
|
|
139
|
+
</Button>
|
|
140
|
+
<Button variant="ghost" size="icon-compact" aria-label="Maximize">
|
|
141
|
+
<Maximize />
|
|
142
|
+
</Button>
|
|
143
|
+
<Button variant="ghost" size="icon-compact" aria-label="Close">
|
|
144
|
+
<Close />
|
|
145
|
+
</Button>
|
|
146
|
+
</span>
|
|
147
|
+
)
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/** The main region: an inset card two surface levels up, like Sidebar.Inset. */
|
|
151
|
+
function MainCard({ children }: { children: ReactNode }) {
|
|
152
|
+
const level = useLift(2)
|
|
153
|
+
const shape = useShape()
|
|
154
|
+
return (
|
|
155
|
+
<SurfaceProvider value={level}>
|
|
156
|
+
<main
|
|
157
|
+
className={cn(
|
|
158
|
+
'relative flex h-full min-h-0 min-w-0 flex-1 flex-col overflow-hidden',
|
|
159
|
+
SURFACE_BG[level],
|
|
160
|
+
SURFACE_SHADOW[2],
|
|
161
|
+
shape.bgRadius >= 20 ? 'rounded-3xl' : 'rounded-xl',
|
|
162
|
+
)}
|
|
163
|
+
>
|
|
164
|
+
{children}
|
|
165
|
+
</main>
|
|
166
|
+
</SurfaceProvider>
|
|
167
|
+
)
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* The frame of a desktop app's window: a title bar over a sidebar, the
|
|
172
|
+
* main card and a side pane.
|
|
173
|
+
*
|
|
174
|
+
* The title bar drags the window (it carries `data-tauri-drag-region`; its
|
|
175
|
+
* buttons don't) and sits on one step of the size ladder. On macOS it starts
|
|
176
|
+
* after the traffic lights; Windows and Linux start at the edge. It holds the
|
|
177
|
+
* sidebar toggle, your `leading` controls, the `title`, your `trailing`
|
|
178
|
+
* controls and the side pane toggle.
|
|
179
|
+
*
|
|
180
|
+
* With `titleBar="card"` there is no bar across the window: the window
|
|
181
|
+
* controls and the sidebar toggle sit in the sidebar's top corner (the
|
|
182
|
+
* sidebar's content starts below them), and the title, `trailing` and the
|
|
183
|
+
* side pane toggle head the main card, which drags the window too. With the
|
|
184
|
+
* sidebar folded, the corner controls stay put and the card's header makes
|
|
185
|
+
* room for them.
|
|
186
|
+
*
|
|
187
|
+
* Under it, the main content is an inset card. The left Sidebar is yours
|
|
188
|
+
* (`left`): it resizes from its rail and folds from its toggle, its rail or
|
|
189
|
+
* `[`. The side pane (`right`) splits off the card on Resizable: drag the
|
|
190
|
+
* gutter between them, or focus it and use the arrows; a double-click puts
|
|
191
|
+
* it back to `defaultPaneSize`, and a drag below half its minimum folds it,
|
|
192
|
+
* as do its toggle and `]`. The card keeps an even 8px gutter to the window
|
|
193
|
+
* edge and to whatever is folded. On a window narrower than 768px the side
|
|
194
|
+
* pane takes the card's place instead of squeezing it. Both open states are
|
|
195
|
+
* controllable (`leftOpen`, `rightOpen`) or start from `default*`.
|
|
196
|
+
*
|
|
197
|
+
* @example {@include ./examples.mdx}
|
|
198
|
+
*/
|
|
199
|
+
export default function DesktopShell({
|
|
200
|
+
platform = 'mac',
|
|
201
|
+
showControls = false,
|
|
202
|
+
titleBar = 'window',
|
|
203
|
+
size: sizeProp,
|
|
204
|
+
title,
|
|
205
|
+
leading,
|
|
206
|
+
trailing,
|
|
207
|
+
left,
|
|
208
|
+
right,
|
|
209
|
+
main,
|
|
210
|
+
leftOpen: leftOpenProp,
|
|
211
|
+
defaultLeftOpen = true,
|
|
212
|
+
onLeftOpenChange,
|
|
213
|
+
rightOpen: rightOpenProp,
|
|
214
|
+
defaultRightOpen = true,
|
|
215
|
+
onRightOpenChange,
|
|
216
|
+
defaultPaneSize = 35,
|
|
217
|
+
minPaneSize = 20,
|
|
218
|
+
maxPaneSize = 60,
|
|
219
|
+
leftLabel = 'Sidebar',
|
|
220
|
+
rightLabel = 'Side pane',
|
|
221
|
+
className,
|
|
222
|
+
}: DesktopShellProps) {
|
|
223
|
+
const size = useSize(sizeProp)
|
|
224
|
+
const [leftOpen, setLeftOpen] = useControllableState(leftOpenProp, defaultLeftOpen, onLeftOpenChange)
|
|
225
|
+
const [rightOpen, setRightOpen] = useControllableState(rightOpenProp, defaultRightOpen, onRightOpenChange)
|
|
226
|
+
const [paneSize, setPaneSize] = useState(defaultPaneSize)
|
|
227
|
+
const hasLeft = left !== undefined
|
|
228
|
+
const hasRight = right !== undefined
|
|
229
|
+
const paneOpen = hasRight && rightOpen
|
|
230
|
+
const inCard = titleBar === 'card'
|
|
231
|
+
|
|
232
|
+
// The window's own width, not the viewport's: a framed or resized window doesn't follow the viewport.
|
|
233
|
+
const root = useRef<HTMLDivElement | null>(null)
|
|
234
|
+
const [narrow, setNarrow] = useState(false)
|
|
235
|
+
useLayoutEffect(() => {
|
|
236
|
+
const el = root.current
|
|
237
|
+
if (!el) return
|
|
238
|
+
const observer = new ResizeObserver(([entry]) => setNarrow((entry?.contentRect.width ?? 0) < NARROW))
|
|
239
|
+
observer.observe(el)
|
|
240
|
+
return () => observer.disconnect()
|
|
241
|
+
}, [])
|
|
242
|
+
|
|
243
|
+
const toggleRight = useCallback(() => setRightOpen(open => !open), [setRightOpen])
|
|
244
|
+
useSidebarShortcut(root, hasRight ? ']' : null, 'nearest', toggleRight)
|
|
245
|
+
|
|
246
|
+
const onSizesChange = (sizes: number[]) => {
|
|
247
|
+
const pane = sizes[1] ?? 0
|
|
248
|
+
if (pane === 0) return setRightOpen(false)
|
|
249
|
+
setPaneSize(pane)
|
|
250
|
+
setRightOpen(true)
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
const corner = (
|
|
254
|
+
<>
|
|
255
|
+
{platform === 'mac' && (
|
|
256
|
+
<div data-tauri-drag-region className="flex h-full w-18 shrink-0 items-center">
|
|
257
|
+
{showControls && <TrafficLights />}
|
|
258
|
+
</div>
|
|
259
|
+
)}
|
|
260
|
+
{hasLeft && <Toggle side="left" label={leftLabel} open={leftOpen} onClick={() => setLeftOpen(!leftOpen)} />}
|
|
261
|
+
{leading}
|
|
262
|
+
</>
|
|
263
|
+
)
|
|
264
|
+
const rest = (
|
|
265
|
+
<>
|
|
266
|
+
<div data-tauri-drag-region className="flex h-full min-w-0 flex-1 items-center gap-2 px-1">
|
|
267
|
+
{title}
|
|
268
|
+
</div>
|
|
269
|
+
{trailing}
|
|
270
|
+
{hasRight && <Toggle side="right" label={rightLabel} open={rightOpen} onClick={toggleRight} />}
|
|
271
|
+
{showControls && platform !== 'mac' && <WindowControls />}
|
|
272
|
+
</>
|
|
273
|
+
)
|
|
274
|
+
const bar = cn('flex shrink-0 select-none items-center gap-1 pr-1.5', size.control, platform !== 'mac' && 'pl-1.5')
|
|
275
|
+
|
|
276
|
+
const card = (content: ReactNode) => (
|
|
277
|
+
<MainCard>
|
|
278
|
+
{inCard && (
|
|
279
|
+
<SizeProvider size={size.variant}>
|
|
280
|
+
<header data-tauri-drag-region className={cn(bar, 'pl-1.5')}>
|
|
281
|
+
{/* Room for the corner controls, which stay put when the sidebar folds. */}
|
|
282
|
+
{!(hasLeft && leftOpen) && <div data-tauri-drag-region className={CORNER_ROOM[platform]} />}
|
|
283
|
+
{rest}
|
|
284
|
+
</header>
|
|
285
|
+
</SizeProvider>
|
|
286
|
+
)}
|
|
287
|
+
<div className="flex min-h-0 flex-1 flex-col">{content}</div>
|
|
288
|
+
</MainCard>
|
|
289
|
+
)
|
|
290
|
+
|
|
291
|
+
return (
|
|
292
|
+
<div ref={root} className={cn('relative flex h-full w-full flex-col bg-background', className)}>
|
|
293
|
+
<SizeProvider size={size.variant}>
|
|
294
|
+
{inCard ? (
|
|
295
|
+
<div data-tauri-drag-region className={cn(bar, 'absolute top-0 left-0 z-20')}>
|
|
296
|
+
{corner}
|
|
297
|
+
</div>
|
|
298
|
+
) : (
|
|
299
|
+
<header data-tauri-drag-region className={bar}>
|
|
300
|
+
{corner}
|
|
301
|
+
{rest}
|
|
302
|
+
</header>
|
|
303
|
+
)}
|
|
304
|
+
</SizeProvider>
|
|
305
|
+
{/* Sidebar defaults to the viewport's height; under the title bar it takes the body's. */}
|
|
306
|
+
<Sidebar.Provider
|
|
307
|
+
className={cn('min-h-0 flex-1 [&>[data-slot=sidebar]]:h-full', inCard && CORNER_CLEARANCE[size.variant])}
|
|
308
|
+
persist={false}
|
|
309
|
+
mobileBreakpoint={0}
|
|
310
|
+
shortcut={hasLeft ? undefined : null}
|
|
311
|
+
open={leftOpen}
|
|
312
|
+
onOpenChange={setLeftOpen}
|
|
313
|
+
>
|
|
314
|
+
{left}
|
|
315
|
+
{/* Flush with an open sidebar (its rows bring their own gutter), 8px from the window edge once it folds. */}
|
|
316
|
+
<div
|
|
317
|
+
className={cn(
|
|
318
|
+
'flex min-h-0 min-w-0 flex-1 py-2 pl-2 transition-[padding] duration-fast',
|
|
319
|
+
hasLeft && leftOpen && 'pl-0',
|
|
320
|
+
(!hasRight || narrow) && 'pr-2',
|
|
321
|
+
)}
|
|
322
|
+
>
|
|
323
|
+
{!hasRight || narrow ? (
|
|
324
|
+
card(narrow && paneOpen ? right : main)
|
|
325
|
+
) : (
|
|
326
|
+
<Resizable sizes={paneOpen ? [100 - paneSize, paneSize] : [100, 0]} onSizesChange={onSizesChange}>
|
|
327
|
+
<Resizable.Panel defaultSize={100 - defaultPaneSize} minSize={100 - maxPaneSize}>
|
|
328
|
+
{card(main)}
|
|
329
|
+
</Resizable.Panel>
|
|
330
|
+
{/* The handle is the 8px gutter between the card and the pane, and the card's right edge once it folds. */}
|
|
331
|
+
<Resizable.Handle
|
|
332
|
+
label={rightLabel}
|
|
333
|
+
className={cn(
|
|
334
|
+
'w-2 transition-opacity duration-fast',
|
|
335
|
+
!paneOpen && 'opacity-0 hover:opacity-100 focus-visible:opacity-100',
|
|
336
|
+
)}
|
|
337
|
+
/>
|
|
338
|
+
<Resizable.Panel defaultSize={defaultPaneSize} minSize={minPaneSize} maxSize={maxPaneSize} collapsible>
|
|
339
|
+
<div {...(paneOpen ? {} : { inert: '' })} className="flex h-full min-w-0 flex-col">
|
|
340
|
+
{right}
|
|
341
|
+
</div>
|
|
342
|
+
</Resizable.Panel>
|
|
343
|
+
</Resizable>
|
|
344
|
+
)}
|
|
345
|
+
</div>
|
|
346
|
+
</Sidebar.Provider>
|
|
347
|
+
</div>
|
|
348
|
+
)
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
export type { DesktopPlatform, DesktopShellProps, DesktopTitleBar }
|
|
352
|
+
export { DesktopShell }
|