@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
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Local addition (not part of Fluid Functionalism): a markdown string as
|
|
3
|
+
* React. marked's lexer reads the source and every token maps to an element
|
|
4
|
+
* (the lib's `runtime/markdown.tsx` approach), so raw HTML shows as text;
|
|
5
|
+
* fences render through Code and tables through Table. A streaming source is
|
|
6
|
+
* settled first, so a half-typed marker never flashes.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
'use client'
|
|
10
|
+
|
|
11
|
+
import { Lexer, type MarkedToken, type Token, type Tokens } from 'marked'
|
|
12
|
+
import { Fragment, type ReactNode, useMemo } from 'react'
|
|
13
|
+
import { useIcon } from '../../../lib/icon-context'
|
|
14
|
+
import { cn } from '../../../lib/utils'
|
|
15
|
+
import Code from '../../../primitives/content/code'
|
|
16
|
+
import Table from '../table'
|
|
17
|
+
|
|
18
|
+
// Literal tables: UnoCSS only generates the classes it can read whole.
|
|
19
|
+
const HEADING = {
|
|
20
|
+
1: 'text-title weight-semibold',
|
|
21
|
+
2: 'text-subtitle weight-semibold',
|
|
22
|
+
3: 'text-subtitle weight-semibold',
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const ALIGN = { left: 'text-left', center: 'text-center', right: 'text-right' }
|
|
26
|
+
|
|
27
|
+
// Rhythm and type for the tags markdown produces; code blocks bring their own frame.
|
|
28
|
+
const PROSE =
|
|
29
|
+
'flex min-w-0 flex-col gap-3 text-body text-foreground [&_ol]:list-decimal [&_ol]:pl-5 [&_ul]:list-disc [&_ul]:pl-5 [&_li]:mt-1 [&_strong]:weight-semibold [&_:not(pre)>code]:rounded-glyph [&_:not(pre)>code]:bg-active [&_:not(pre)>code]:px-1 [&_:not(pre)>code]:font-mono [&_:not(pre)>code]:text-caption [&_a]:underline [&_a]:decoration-border [&_a]:underline-offset-2'
|
|
30
|
+
|
|
31
|
+
const FENCE = /^ {0,3}(`{3,}|~{3,})/
|
|
32
|
+
const MARKER_ONLY = /^\s*([-*+]|\d+[.)]|#{1,6}|>|`{1,2}|~{1,2})?\s*$/
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* A partial source made safe to show: an open fence stays code so far, a
|
|
36
|
+
* last line holding only a marker waits for its text, and an open inline
|
|
37
|
+
* code span or bold run is closed for now.
|
|
38
|
+
*/
|
|
39
|
+
function settle(source: string): string {
|
|
40
|
+
const lines = source.split('\n')
|
|
41
|
+
if (lines.filter(line => FENCE.test(line)).length % 2 === 1) return source
|
|
42
|
+
|
|
43
|
+
const last = lines.pop() ?? ''
|
|
44
|
+
if (MARKER_ONLY.test(last)) return lines.join('\n')
|
|
45
|
+
|
|
46
|
+
let closed = last
|
|
47
|
+
if ((closed.match(/`/g)?.length ?? 0) % 2 === 1) closed += '`'
|
|
48
|
+
if ((closed.match(/\*\*/g)?.length ?? 0) % 2 === 1) closed += '**'
|
|
49
|
+
return [...lines, closed].join('\n')
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function TaskBox({ checked }: { checked: boolean }) {
|
|
53
|
+
const Check = useIcon('check')
|
|
54
|
+
return (
|
|
55
|
+
<>
|
|
56
|
+
<span
|
|
57
|
+
aria-hidden="true"
|
|
58
|
+
className={cn(
|
|
59
|
+
'mr-1.5 inline-flex size-3.5 translate-y-0.5 items-center justify-center rounded-glyph border',
|
|
60
|
+
checked ? 'border-foreground bg-foreground text-background' : 'border-control',
|
|
61
|
+
)}
|
|
62
|
+
>
|
|
63
|
+
{checked && <Check size={10} strokeWidth={3} />}
|
|
64
|
+
</span>
|
|
65
|
+
<span className="sr-only">{checked ? 'Done: ' : 'To do: '}</span>
|
|
66
|
+
</>
|
|
67
|
+
)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function Blocks({ tokens }: { tokens: Token[] }) {
|
|
71
|
+
return <>{tokens.map((t, i) => block(t as MarkedToken, i))}</>
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function Inlines({ tokens }: { tokens: Token[] }) {
|
|
75
|
+
return <>{tokens.map((t, i) => inline(t as MarkedToken, i))}</>
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function table(t: Tokens.Table, key: number) {
|
|
79
|
+
return (
|
|
80
|
+
<div key={key} className="min-w-0 overflow-x-auto">
|
|
81
|
+
<Table>
|
|
82
|
+
<Table.Header>
|
|
83
|
+
<Table.Row>
|
|
84
|
+
{t.header.map((cell, i) => (
|
|
85
|
+
<Table.Head key={i} className={cell.align ? ALIGN[cell.align] : undefined}>
|
|
86
|
+
<Inlines tokens={cell.tokens} />
|
|
87
|
+
</Table.Head>
|
|
88
|
+
))}
|
|
89
|
+
</Table.Row>
|
|
90
|
+
</Table.Header>
|
|
91
|
+
<Table.Body>
|
|
92
|
+
{t.rows.map((row, r) => (
|
|
93
|
+
<Table.Row key={r} index={r}>
|
|
94
|
+
{row.map((cell, i) => (
|
|
95
|
+
<Table.Cell key={i} className={cell.align ? ALIGN[cell.align] : undefined}>
|
|
96
|
+
<Inlines tokens={cell.tokens} />
|
|
97
|
+
</Table.Cell>
|
|
98
|
+
))}
|
|
99
|
+
</Table.Row>
|
|
100
|
+
))}
|
|
101
|
+
</Table.Body>
|
|
102
|
+
</Table>
|
|
103
|
+
</div>
|
|
104
|
+
)
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function block(t: MarkedToken, key: number): ReactNode {
|
|
108
|
+
switch (t.type) {
|
|
109
|
+
case 'space':
|
|
110
|
+
return null
|
|
111
|
+
|
|
112
|
+
case 'paragraph':
|
|
113
|
+
return (
|
|
114
|
+
<p key={key}>
|
|
115
|
+
<Inlines tokens={t.tokens} />
|
|
116
|
+
</p>
|
|
117
|
+
)
|
|
118
|
+
|
|
119
|
+
case 'heading': {
|
|
120
|
+
const level = Math.min(t.depth, 3) as 1 | 2 | 3
|
|
121
|
+
const Tag = `h${level}` as const
|
|
122
|
+
return (
|
|
123
|
+
<Tag key={key} className={HEADING[level]}>
|
|
124
|
+
<Inlines tokens={t.tokens} />
|
|
125
|
+
</Tag>
|
|
126
|
+
)
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
case 'code':
|
|
130
|
+
return (
|
|
131
|
+
<Code key={key} language={t.lang || 'plaintext'}>
|
|
132
|
+
{t.text}
|
|
133
|
+
</Code>
|
|
134
|
+
)
|
|
135
|
+
|
|
136
|
+
case 'blockquote':
|
|
137
|
+
return (
|
|
138
|
+
<blockquote key={key} className="flex flex-col gap-2 border-l-2 border-border pl-3 text-muted-foreground">
|
|
139
|
+
<Blocks tokens={t.tokens} />
|
|
140
|
+
</blockquote>
|
|
141
|
+
)
|
|
142
|
+
|
|
143
|
+
case 'list': {
|
|
144
|
+
const items = t.items.map((item, i) => (
|
|
145
|
+
<li key={i} className={cn(item.task && 'list-none')}>
|
|
146
|
+
<Blocks tokens={item.tokens} />
|
|
147
|
+
</li>
|
|
148
|
+
))
|
|
149
|
+
if (!t.ordered) return <ul key={key}>{items}</ul>
|
|
150
|
+
return (
|
|
151
|
+
<ol key={key} start={t.start === '' ? undefined : t.start}>
|
|
152
|
+
{items}
|
|
153
|
+
</ol>
|
|
154
|
+
)
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
case 'table':
|
|
158
|
+
return table(t, key)
|
|
159
|
+
|
|
160
|
+
case 'hr':
|
|
161
|
+
return <hr key={key} className="h-px w-full border-0 bg-border" />
|
|
162
|
+
|
|
163
|
+
case 'html':
|
|
164
|
+
return <p key={key}>{t.text}</p>
|
|
165
|
+
|
|
166
|
+
// A tight list item holds phrasing directly (text, a task checkbox).
|
|
167
|
+
default:
|
|
168
|
+
return inline(t, key)
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
function inline(t: MarkedToken, key: number): ReactNode {
|
|
173
|
+
switch (t.type) {
|
|
174
|
+
case 'text':
|
|
175
|
+
return t.tokens ? <Inlines key={key} tokens={t.tokens} /> : <Fragment key={key}>{t.text}</Fragment>
|
|
176
|
+
|
|
177
|
+
case 'escape':
|
|
178
|
+
case 'html':
|
|
179
|
+
return <Fragment key={key}>{t.text}</Fragment>
|
|
180
|
+
|
|
181
|
+
case 'codespan':
|
|
182
|
+
return <code key={key}>{t.text}</code>
|
|
183
|
+
|
|
184
|
+
case 'strong':
|
|
185
|
+
return (
|
|
186
|
+
<strong key={key}>
|
|
187
|
+
<Inlines tokens={t.tokens} />
|
|
188
|
+
</strong>
|
|
189
|
+
)
|
|
190
|
+
|
|
191
|
+
case 'em':
|
|
192
|
+
return (
|
|
193
|
+
<em key={key}>
|
|
194
|
+
<Inlines tokens={t.tokens} />
|
|
195
|
+
</em>
|
|
196
|
+
)
|
|
197
|
+
|
|
198
|
+
case 'del':
|
|
199
|
+
return (
|
|
200
|
+
<del key={key} className="text-muted-foreground">
|
|
201
|
+
<Inlines tokens={t.tokens} />
|
|
202
|
+
</del>
|
|
203
|
+
)
|
|
204
|
+
|
|
205
|
+
case 'br':
|
|
206
|
+
return <br key={key} />
|
|
207
|
+
|
|
208
|
+
case 'link': {
|
|
209
|
+
const external = /^https?:\/\//.test(t.href)
|
|
210
|
+
return (
|
|
211
|
+
<a
|
|
212
|
+
key={key}
|
|
213
|
+
href={t.href}
|
|
214
|
+
title={t.title ?? undefined}
|
|
215
|
+
rel="noreferrer"
|
|
216
|
+
target={external ? '_blank' : undefined}
|
|
217
|
+
>
|
|
218
|
+
<Inlines tokens={t.tokens} />
|
|
219
|
+
</a>
|
|
220
|
+
)
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
case 'image':
|
|
224
|
+
return <img key={key} src={t.href} alt={t.text} title={t.title ?? undefined} className="max-w-full" />
|
|
225
|
+
|
|
226
|
+
case 'checkbox':
|
|
227
|
+
return <TaskBox key={key} checked={t.checked} />
|
|
228
|
+
|
|
229
|
+
default:
|
|
230
|
+
return null
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
interface MarkdownProseProps {
|
|
235
|
+
/** Rich text you built yourself: paragraphs, lists, headings, Code blocks. */
|
|
236
|
+
children?: ReactNode
|
|
237
|
+
/** Classes for the column. */
|
|
238
|
+
className?: string
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/** Markdown's column without the parser: its type and rhythm for rich text you render yourself. */
|
|
242
|
+
function MarkdownProse({ children, className }: MarkdownProseProps) {
|
|
243
|
+
return <div className={cn(PROSE, className)}>{children}</div>
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
interface MarkdownProps {
|
|
247
|
+
/** The markdown source. */
|
|
248
|
+
children: string
|
|
249
|
+
/** The source is still arriving: a half-typed marker waits for its text and an open fence shows as code so far. Defaults to `false`. */
|
|
250
|
+
streaming?: boolean
|
|
251
|
+
/** Classes for the column. */
|
|
252
|
+
className?: string
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* A markdown string rendered as text on the page: a reply, a plan, a
|
|
257
|
+
* changelog, a README.
|
|
258
|
+
*
|
|
259
|
+
* A column in body type, with inline code on a soft wash and links
|
|
260
|
+
* underlined in the hairline color. Paragraphs, headings, ordered, nested and task lists, quotes, rules,
|
|
261
|
+
* tables (on Table) and fenced code (on Code, highlighted by its fence
|
|
262
|
+
* language) become real elements; inline it reads bold, italic, struck-out
|
|
263
|
+
* text, inline code, links and images. Raw HTML shows as the text it is,
|
|
264
|
+
* never as markup. Links that leave the site open in a new tab.
|
|
265
|
+
*
|
|
266
|
+
* Set `streaming` while the text arrives: a fence that hasn't closed shows
|
|
267
|
+
* as code so far, and a list marker or an open bold run waits for its text
|
|
268
|
+
* instead of flashing.
|
|
269
|
+
*
|
|
270
|
+
* Statics:
|
|
271
|
+
* - `Markdown.Prose` — the column alone, for rich text you render yourself.
|
|
272
|
+
*
|
|
273
|
+
* @example {@include ./examples.mdx}
|
|
274
|
+
*/
|
|
275
|
+
const Markdown = Object.assign(
|
|
276
|
+
function Markdown({ children, streaming = false, className }: MarkdownProps) {
|
|
277
|
+
const tokens = useMemo(() => Lexer.lex(streaming ? settle(children) : children), [children, streaming])
|
|
278
|
+
|
|
279
|
+
return (
|
|
280
|
+
<MarkdownProse className={className}>
|
|
281
|
+
<Blocks tokens={tokens} />
|
|
282
|
+
</MarkdownProse>
|
|
283
|
+
)
|
|
284
|
+
},
|
|
285
|
+
{ Prose: MarkdownProse },
|
|
286
|
+
)
|
|
287
|
+
|
|
288
|
+
export type { MarkdownProps, MarkdownProseProps }
|
|
289
|
+
export { Markdown, MarkdownProse }
|
|
290
|
+
|
|
291
|
+
export default Markdown
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
'use client'
|
|
7
7
|
|
|
8
8
|
import { createContext, useContext } from 'react'
|
|
9
|
-
import { useSize } from '
|
|
9
|
+
import { useSize } from '../../../lib/size-context'
|
|
10
10
|
|
|
11
11
|
type SortDirection = 'asc' | 'desc'
|
|
12
12
|
|
|
@@ -30,10 +30,20 @@ type TableSection = 'header' | 'body' | 'footer'
|
|
|
30
30
|
|
|
31
31
|
const TableSectionContext = createContext<TableSection>('body')
|
|
32
32
|
|
|
33
|
+
/** A `Table.Header` or `Table.Row`'s own `stacked`, for the rows and cells below it. */
|
|
34
|
+
const StackedContext = createContext<boolean | null>(null)
|
|
35
|
+
|
|
33
36
|
function useTable() {
|
|
34
37
|
return useContext(TableContext)
|
|
35
38
|
}
|
|
36
39
|
|
|
40
|
+
/** Whether this part lays out as a card: the table stacks and no part above opted out (`stacked={false}`). */
|
|
41
|
+
function useStacked(own?: boolean) {
|
|
42
|
+
const table = useContext(TableContext)?.stacked ?? false
|
|
43
|
+
const part = useContext(StackedContext)
|
|
44
|
+
return table && (own ?? part ?? true)
|
|
45
|
+
}
|
|
46
|
+
|
|
37
47
|
/** Unsorted → ascending → descending → unsorted; another column starts at ascending. */
|
|
38
48
|
function nextSort(sort: TableSort | null, value: string): TableSort | null {
|
|
39
49
|
if (sort?.value !== value) return { value, direction: 'asc' }
|
|
@@ -46,4 +56,4 @@ function useCellPadding() {
|
|
|
46
56
|
}
|
|
47
57
|
|
|
48
58
|
export type { SortDirection, TableContextValue, TableSection, TableSort }
|
|
49
|
-
export { nextSort, TableContext, TableSectionContext, useCellPadding, useTable }
|
|
59
|
+
export { nextSort, StackedContext, TableContext, TableSectionContext, useCellPadding, useStacked, useTable }
|
|
@@ -9,11 +9,11 @@
|
|
|
9
9
|
|
|
10
10
|
import { motion } from 'motion/react'
|
|
11
11
|
import { forwardRef, type ThHTMLAttributes } from 'react'
|
|
12
|
-
import { type IconName, useIcon } from '
|
|
13
|
-
import { useReduceMotion } from '
|
|
14
|
-
import { useSize } from '
|
|
15
|
-
import { spring } from '
|
|
16
|
-
import { cn } from '
|
|
12
|
+
import { type IconName, useIcon } from '../../../lib/icon-context'
|
|
13
|
+
import { useReduceMotion } from '../../../lib/reduced-motion'
|
|
14
|
+
import { useSize } from '../../../lib/size-context'
|
|
15
|
+
import { spring } from '../../../lib/springs'
|
|
16
|
+
import { cn } from '../../../lib/utils'
|
|
17
17
|
import { type SortDirection, useCellPadding, useTable } from './context'
|
|
18
18
|
|
|
19
19
|
type GlyphState = SortDirection | 'none'
|
|
@@ -16,12 +16,13 @@ import {
|
|
|
16
16
|
useMemo,
|
|
17
17
|
useRef,
|
|
18
18
|
} from 'react'
|
|
19
|
-
import { FluidHoverHighlight } from '
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
19
|
+
import { FluidHoverHighlight } from '../../../lib/fluid-hover-highlight'
|
|
20
|
+
import { RowOrderContext, useRowOrder } from '../../../lib/row-order'
|
|
21
|
+
import { type SizeVariant, useSize } from '../../../lib/size-context'
|
|
22
|
+
import { useControllableState } from '../../../lib/use-controllable-state'
|
|
23
|
+
import { useFluidHover } from '../../../lib/use-fluid-hover'
|
|
24
|
+
import { cn } from '../../../lib/utils'
|
|
25
|
+
import { SizeScope } from '../../../primitives/systems/sizes'
|
|
25
26
|
import { nextSort, TableContext, type TableSort } from './context'
|
|
26
27
|
import { TableHead } from './head'
|
|
27
28
|
import { TableBody, TableCaption, TableCell, TableEmpty, TableFooter, TableHeader, TableRow } from './parts'
|
|
@@ -39,6 +40,8 @@ interface TableProps extends HTMLAttributes<HTMLTableElement> {
|
|
|
39
40
|
defaultSort?: TableSort | null
|
|
40
41
|
/** Called with the next sort when a sortable head is pressed: ascending, then descending, then `null`. */
|
|
41
42
|
onSortChange?: (sort: TableSort | null) => void
|
|
43
|
+
/** Classes for the hover container around the `<table>`, e.g. `overflow-x-auto` for a wide table. */
|
|
44
|
+
containerClassName?: string
|
|
42
45
|
}
|
|
43
46
|
|
|
44
47
|
type TableComponent = ForwardRefExoticComponent<TableProps & RefAttributes<HTMLTableElement>> & {
|
|
@@ -68,13 +71,22 @@ type TableComponent = ForwardRefExoticComponent<TableProps & RefAttributes<HTMLT
|
|
|
68
71
|
* `defaultSort` / `onSortChange`, and its arrow crossfades into the new
|
|
69
72
|
* direction (`aria-sort` follows). The table reports the sort; ordering the
|
|
70
73
|
* rows is yours. `stacked` turns body rows into two-column cards while the
|
|
71
|
-
* table's container is narrow, each cell led by its `label
|
|
74
|
+
* table's container is narrow, each cell led by its `label`;
|
|
75
|
+
* `stacked={false}` on a `Table.Header` or `Table.Row` keeps that part
|
|
76
|
+
* tabular. `containerClassName` styles the hover container around the
|
|
77
|
+
* `<table>` (`overflow-x-auto` for a wide one).
|
|
78
|
+
*
|
|
79
|
+
* Body rows number themselves in document order across the table's bodies,
|
|
80
|
+
* inside fragments and conditions too; an explicit `index` still wins.
|
|
81
|
+
* Header and footer rows stay out, and so does any row under a
|
|
82
|
+
* `RowOrderContext.Provider value={null}` (`lib/row-order`), e.g. a detail
|
|
83
|
+
* row that belongs to the row above.
|
|
72
84
|
*
|
|
73
85
|
* Statics:
|
|
74
|
-
* - `Table.Header` — `<thead>`; hidden while stacked
|
|
75
|
-
* - `Table.Body` — `<tbody
|
|
86
|
+
* - `Table.Header` — `<thead>`; hidden while stacked, unless `stacked={false}`.
|
|
87
|
+
* - `Table.Body` — `<tbody>`.
|
|
76
88
|
* - `Table.Footer` — `<tfoot>`, for totals: its rows render semibold in the foreground and stay out of the hover.
|
|
77
|
-
* - `Table.Row` — `<tr
|
|
89
|
+
* - `Table.Row` — `<tr>`: `index`, `stacked` (`false` keeps the row tabular); rows outside `Table.Body` stay out of the hover.
|
|
78
90
|
* - `Table.Head` — `<th>`; `value` makes it a sort button.
|
|
79
91
|
* - `Table.Cell` — `<td>`; `label` leads the value while stacked.
|
|
80
92
|
* - `Table.Caption` — `<caption>`, a muted line below the table.
|
|
@@ -87,8 +99,22 @@ type TableComponent = ForwardRefExoticComponent<TableProps & RefAttributes<HTMLT
|
|
|
87
99
|
* @license MIT © 2026 Micka Touillaud
|
|
88
100
|
*/
|
|
89
101
|
const Table = forwardRef<HTMLTableElement, TableProps>(
|
|
90
|
-
(
|
|
102
|
+
(
|
|
103
|
+
{
|
|
104
|
+
children,
|
|
105
|
+
size,
|
|
106
|
+
stacked = false,
|
|
107
|
+
sort: sortProp,
|
|
108
|
+
defaultSort = null,
|
|
109
|
+
onSortChange,
|
|
110
|
+
containerClassName,
|
|
111
|
+
className,
|
|
112
|
+
...props
|
|
113
|
+
},
|
|
114
|
+
ref,
|
|
115
|
+
) => {
|
|
91
116
|
const containerRef = useRef<HTMLDivElement>(null)
|
|
117
|
+
const rowOrder = useRowOrder()
|
|
92
118
|
const sizeClasses = useSize(size)
|
|
93
119
|
const hover = useFluidHover(containerRef)
|
|
94
120
|
const { activeIndex, handlers, registerItem } = hover
|
|
@@ -107,7 +133,7 @@ const Table = forwardRef<HTMLTableElement, TableProps>(
|
|
|
107
133
|
return (
|
|
108
134
|
<SizeScope size={size}>
|
|
109
135
|
<TableContext.Provider value={contextValue}>
|
|
110
|
-
<div ref={containerRef} className={cn('relative', stacked && '@container')} {...handlers}>
|
|
136
|
+
<div ref={containerRef} className={cn('relative', stacked && '@container', containerClassName)} {...handlers}>
|
|
111
137
|
<FluidHoverHighlight hover={hover} />
|
|
112
138
|
<table
|
|
113
139
|
ref={ref}
|
|
@@ -119,7 +145,7 @@ const Table = forwardRef<HTMLTableElement, TableProps>(
|
|
|
119
145
|
)}
|
|
120
146
|
{...props}
|
|
121
147
|
>
|
|
122
|
-
{children}
|
|
148
|
+
<RowOrderContext.Provider value={rowOrder}>{children}</RowOrderContext.Provider>
|
|
123
149
|
</table>
|
|
124
150
|
</div>
|
|
125
151
|
</TableContext.Provider>
|
|
@@ -143,7 +169,7 @@ Object.assign(Table, {
|
|
|
143
169
|
|
|
144
170
|
export type { SortDirection, TableSort } from './context'
|
|
145
171
|
export type { TableHeadProps } from './head'
|
|
146
|
-
export type { TableCellProps, TableEmptyProps, TableRowProps } from './parts'
|
|
172
|
+
export type { TableCellProps, TableEmptyProps, TableHeaderProps, TableRowProps } from './parts'
|
|
147
173
|
export type { TableProps }
|
|
148
174
|
export { Table, TableBody, TableCaption, TableCell, TableEmpty, TableFooter, TableHead, TableHeader, TableRow }
|
|
149
175
|
|
|
@@ -8,19 +8,28 @@
|
|
|
8
8
|
'use client'
|
|
9
9
|
|
|
10
10
|
import { forwardRef, type HTMLAttributes, type ReactNode, type TdHTMLAttributes, useContext, useRef } from 'react'
|
|
11
|
-
import { mergeRefs } from '
|
|
12
|
-
import {
|
|
13
|
-
import { useSize } from '
|
|
14
|
-
import { useRegisterFluidHoverItem } from '
|
|
15
|
-
import { cn } from '
|
|
16
|
-
import { TableSectionContext, useCellPadding, useTable } from './context'
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
11
|
+
import { mergeRefs } from '../../../lib/merge-refs'
|
|
12
|
+
import { RowOrderContext, useRowSlot } from '../../../lib/row-order'
|
|
13
|
+
import { useSize } from '../../../lib/size-context'
|
|
14
|
+
import { useRegisterFluidHoverItem } from '../../../lib/use-fluid-hover'
|
|
15
|
+
import { cn } from '../../../lib/utils'
|
|
16
|
+
import { StackedContext, TableSectionContext, useCellPadding, useStacked, useTable } from './context'
|
|
17
|
+
|
|
18
|
+
interface TableHeaderProps extends HTMLAttributes<HTMLTableSectionElement> {
|
|
19
|
+
/** `false` keeps the header showing while a `stacked` table lays its rows out as cards. Defaults to the table's `stacked`. */
|
|
20
|
+
stacked?: boolean
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const TableHeader = forwardRef<HTMLTableSectionElement, TableHeaderProps>(
|
|
24
|
+
({ stacked: own, className, ...props }, ref) => {
|
|
25
|
+
const stacked = useStacked(own)
|
|
21
26
|
return (
|
|
22
27
|
<TableSectionContext.Provider value="header">
|
|
23
|
-
<
|
|
28
|
+
<RowOrderContext.Provider value={null}>
|
|
29
|
+
<StackedContext.Provider value={own ?? null}>
|
|
30
|
+
<thead ref={ref} className={cn(stacked && 'hidden @lg:table-header-group', className)} {...props} />
|
|
31
|
+
</StackedContext.Provider>
|
|
32
|
+
</RowOrderContext.Provider>
|
|
24
33
|
</TableSectionContext.Provider>
|
|
25
34
|
)
|
|
26
35
|
},
|
|
@@ -29,13 +38,9 @@ const TableHeader = forwardRef<HTMLTableSectionElement, HTMLAttributes<HTMLTable
|
|
|
29
38
|
TableHeader.displayName = 'TableHeader'
|
|
30
39
|
|
|
31
40
|
const TableBody = forwardRef<HTMLTableSectionElement, HTMLAttributes<HTMLTableSectionElement>>(
|
|
32
|
-
({
|
|
41
|
+
({ className, ...props }, ref) => {
|
|
33
42
|
const stacked = useTable()?.stacked
|
|
34
|
-
return (
|
|
35
|
-
<tbody ref={ref} className={cn(stacked && 'block @lg:table-row-group', className)} {...props}>
|
|
36
|
-
<IndexedRows>{children}</IndexedRows>
|
|
37
|
-
</tbody>
|
|
38
|
-
)
|
|
43
|
+
return <tbody ref={ref} className={cn(stacked && 'block @lg:table-row-group', className)} {...props} />
|
|
39
44
|
},
|
|
40
45
|
)
|
|
41
46
|
|
|
@@ -46,7 +51,9 @@ const TableFooter = forwardRef<HTMLTableSectionElement, HTMLAttributes<HTMLTable
|
|
|
46
51
|
const stacked = useTable()?.stacked
|
|
47
52
|
return (
|
|
48
53
|
<TableSectionContext.Provider value="footer">
|
|
49
|
-
<
|
|
54
|
+
<RowOrderContext.Provider value={null}>
|
|
55
|
+
<tfoot ref={ref} className={cn(stacked && 'block @lg:table-footer-group', className)} {...props} />
|
|
56
|
+
</RowOrderContext.Provider>
|
|
50
57
|
</TableSectionContext.Provider>
|
|
51
58
|
)
|
|
52
59
|
},
|
|
@@ -77,42 +84,49 @@ const TableCaption = forwardRef<HTMLTableCaptionElement, HTMLAttributes<HTMLTabl
|
|
|
77
84
|
TableCaption.displayName = 'TableCaption'
|
|
78
85
|
|
|
79
86
|
interface TableRowProps extends HTMLAttributes<HTMLTableRowElement> {
|
|
80
|
-
/** The row's place in the hover order. Defaults to its
|
|
87
|
+
/** The row's place in the hover order, from 0. Defaults to its place among the body rows in document order; header and footer rows have none. */
|
|
81
88
|
index?: number
|
|
89
|
+
/** `false` keeps this row tabular while a `stacked` table lays its rows out as cards. Defaults to the table's `stacked`. */
|
|
90
|
+
stacked?: boolean
|
|
82
91
|
}
|
|
83
92
|
|
|
84
|
-
const TableRow = forwardRef<HTMLTableRowElement, TableRowProps>(
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
93
|
+
const TableRow = forwardRef<HTMLTableRowElement, TableRowProps>(
|
|
94
|
+
({ index: indexProp, stacked: own, className, ...props }, ref) => {
|
|
95
|
+
const internalRef = useRef<HTMLTableRowElement>(null)
|
|
96
|
+
const ctx = useTable()
|
|
97
|
+
const section = useContext(TableSectionContext)
|
|
98
|
+
const stacked = useStacked(own)
|
|
99
|
+
const { index } = useRowSlot(internalRef, indexProp)
|
|
100
|
+
|
|
101
|
+
useRegisterFluidHoverItem(ctx?.registerItem, index, internalRef)
|
|
102
|
+
|
|
103
|
+
const isBodyRow = index !== undefined
|
|
104
|
+
const activeIdx = ctx?.activeIndex ?? null
|
|
105
|
+
// The header's border runs along row 0, so it melts into the lit band; a footer row keeps its own.
|
|
106
|
+
const hideBorder =
|
|
107
|
+
activeIdx !== null &&
|
|
108
|
+
((isBodyRow && (index === activeIdx || index === activeIdx - 1)) || (section === 'header' && activeIdx === 0))
|
|
109
|
+
|
|
110
|
+
const row = (
|
|
111
|
+
<tr
|
|
112
|
+
ref={mergeRefs(internalRef, ref)}
|
|
113
|
+
data-fluid-hover-index={index}
|
|
114
|
+
className={cn(
|
|
115
|
+
'group/row relative z-10 border-b transition-[border-color] duration-fast',
|
|
116
|
+
hideBorder ? 'border-transparent' : 'border-accent/40',
|
|
117
|
+
isBodyRow && activeIdx === index && 'is-active',
|
|
118
|
+
section === 'body' ? 'weight-normal' : 'weight-semibold',
|
|
119
|
+
stacked && 'grid grid-cols-2 py-1 @lg:table-row @lg:py-0',
|
|
120
|
+
className,
|
|
121
|
+
)}
|
|
122
|
+
{...props}
|
|
123
|
+
/>
|
|
124
|
+
)
|
|
99
125
|
|
|
100
|
-
|
|
101
|
-
<
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
className={cn(
|
|
105
|
-
'group/row relative z-10 border-b transition-[border-color] duration-fast',
|
|
106
|
-
hideBorder ? 'border-transparent' : 'border-accent/40',
|
|
107
|
-
isBodyRow && activeIdx === index && 'is-active',
|
|
108
|
-
section === 'body' ? 'weight-normal' : 'weight-semibold',
|
|
109
|
-
ctx?.stacked && 'grid grid-cols-2 py-1 @lg:table-row @lg:py-0',
|
|
110
|
-
className,
|
|
111
|
-
)}
|
|
112
|
-
{...props}
|
|
113
|
-
/>
|
|
114
|
-
)
|
|
115
|
-
})
|
|
126
|
+
// A row's own `stacked` reaches its cells.
|
|
127
|
+
return own === undefined ? row : <StackedContext.Provider value={own}>{row}</StackedContext.Provider>
|
|
128
|
+
},
|
|
129
|
+
)
|
|
116
130
|
|
|
117
131
|
TableRow.displayName = 'TableRow'
|
|
118
132
|
|
|
@@ -123,7 +137,7 @@ interface TableCellProps extends TdHTMLAttributes<HTMLTableCellElement> {
|
|
|
123
137
|
|
|
124
138
|
const TableCell = forwardRef<HTMLTableCellElement, TableCellProps>(({ label, className, children, ...props }, ref) => {
|
|
125
139
|
const compact = useSize().variant === 'compact'
|
|
126
|
-
const stacked =
|
|
140
|
+
const stacked = useStacked()
|
|
127
141
|
const footer = useContext(TableSectionContext) === 'footer'
|
|
128
142
|
return (
|
|
129
143
|
<td
|
|
@@ -184,5 +198,5 @@ const TableEmpty = forwardRef<HTMLTableRowElement, TableEmptyProps>(
|
|
|
184
198
|
|
|
185
199
|
TableEmpty.displayName = 'TableEmpty'
|
|
186
200
|
|
|
187
|
-
export type { TableCellProps, TableEmptyProps, TableRowProps }
|
|
201
|
+
export type { TableCellProps, TableEmptyProps, TableHeaderProps, TableRowProps }
|
|
188
202
|
export { TableBody, TableCaption, TableCell, TableEmpty, TableFooter, TableHeader, TableRow }
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import EmptyState from './index'
|
|
2
|
+
import Button from '../../actions/button'
|
|
3
|
+
import { GitBranch, MessageCircle, Plus, Search } from 'lucide-react'
|
|
4
|
+
|
|
5
|
+
# No sessions
|
|
6
|
+
|
|
7
|
+
A page with nothing in it yet: say so, and offer the action that fills it.
|
|
8
|
+
|
|
9
|
+
<EmptyState
|
|
10
|
+
icon={MessageCircle}
|
|
11
|
+
title="No sessions yet"
|
|
12
|
+
description="Start a session to ask a question, review a change or run a task."
|
|
13
|
+
actions={<><Button leadingIcon={Plus}>New session</Button><Button variant="ghost">Import</Button></>}
|
|
14
|
+
/>
|
|
15
|
+
|
|
16
|
+
# No changes
|
|
17
|
+
|
|
18
|
+
`size="compact"` fits a pane: tighter spacing, smaller text and buttons.
|
|
19
|
+
|
|
20
|
+
<div className="w-72 rounded-xl ring-1 ring-border">
|
|
21
|
+
<EmptyState
|
|
22
|
+
size="compact"
|
|
23
|
+
icon={GitBranch}
|
|
24
|
+
title="No changes"
|
|
25
|
+
description="Edits to the working tree show up here."
|
|
26
|
+
/>
|
|
27
|
+
</div>
|
|
28
|
+
|
|
29
|
+
# No results
|
|
30
|
+
|
|
31
|
+
A search that finds nothing names what it looked for and offers a way back.
|
|
32
|
+
|
|
33
|
+
<EmptyState
|
|
34
|
+
icon={Search}
|
|
35
|
+
title="No results for “tree view”"
|
|
36
|
+
description="Check the spelling or try a shorter query."
|
|
37
|
+
actions={<Button variant="secondary">Clear search</Button>}
|
|
38
|
+
/>
|