@zyncat/ui 0.20.0 → 0.22.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/dist/alert.js +11 -10
- package/dist/alert.js.map +1 -1
- package/dist/avatar.css +1 -1
- package/dist/badge.css +20 -11
- package/dist/badge.js +4 -1
- package/dist/{bloom-HV23M4AW.js → bloom-5MZXLNKG.js} +23 -5
- package/dist/bloom-5MZXLNKG.js.map +1 -0
- package/dist/button.css +24 -27
- package/dist/button.js +3 -3
- package/dist/checkbox.css +0 -1
- package/dist/chunk-2EPNCOLN.js +177 -0
- package/dist/chunk-2EPNCOLN.js.map +1 -0
- package/dist/{chunk-LNAV5E7S.js → chunk-2GYZ3HP3.js} +8 -4
- package/dist/chunk-2GYZ3HP3.js.map +1 -0
- package/dist/chunk-4M5FMCFJ.js +16 -0
- package/dist/chunk-4M5FMCFJ.js.map +1 -0
- package/dist/{chunk-ODRO3KS6.js → chunk-7GTACTZD.js} +8 -6
- package/dist/chunk-7GTACTZD.js.map +1 -0
- package/dist/{chunk-V6QAAOA5.js → chunk-AK2AXGEC.js} +38 -8
- package/dist/chunk-AK2AXGEC.js.map +1 -0
- package/dist/{chunk-5VC3TUZ2.js → chunk-BA4ALXQW.js} +2 -2
- package/dist/{chunk-5VC3TUZ2.js.map → chunk-BA4ALXQW.js.map} +1 -1
- package/dist/{chunk-N43NDSME.js → chunk-CF6ZFXRV.js} +19 -11
- package/dist/chunk-CF6ZFXRV.js.map +1 -0
- package/dist/{chunk-BRKGYLEQ.js → chunk-DOAR4PJ3.js} +9 -4
- package/dist/chunk-DOAR4PJ3.js.map +1 -0
- package/dist/{tide-DJZMDAFT.js → chunk-DVLKB3CZ.js} +15 -12
- package/dist/chunk-DVLKB3CZ.js.map +1 -0
- package/dist/chunk-EUAXI6OF.js +16 -0
- package/dist/chunk-EUAXI6OF.js.map +1 -0
- package/dist/{chunk-RLNCRDAL.js → chunk-G2TOUG2A.js} +7 -6
- package/dist/chunk-G2TOUG2A.js.map +1 -0
- package/dist/{chunk-VQFILXQN.js → chunk-HRP4UFWN.js} +70 -8
- package/dist/chunk-HRP4UFWN.js.map +1 -0
- package/dist/chunk-INK2GJTA.js +102 -0
- package/dist/chunk-INK2GJTA.js.map +1 -0
- package/dist/chunk-ITW5UCVU.js +24 -0
- package/dist/chunk-ITW5UCVU.js.map +1 -0
- package/dist/{chunk-F64Z42PJ.js → chunk-JJHEVW4M.js} +5 -6
- package/dist/chunk-JJHEVW4M.js.map +1 -0
- package/dist/{chunk-7NHY2CRA.js → chunk-JUC35N3C.js} +2 -2
- package/dist/chunk-JUC35N3C.js.map +1 -0
- package/dist/{chunk-PXQBJMPJ.js → chunk-LFJ4C7ZP.js} +7 -7
- package/dist/chunk-LFJ4C7ZP.js.map +1 -0
- package/dist/{chunk-TDHLZY6I.js → chunk-MCOIR3CK.js} +77 -18
- package/dist/chunk-MCOIR3CK.js.map +1 -0
- package/dist/chunk-NATK4DDW.js +108 -0
- package/dist/chunk-NATK4DDW.js.map +1 -0
- package/dist/{chunk-BIDVNLJO.js → chunk-O3RMSMBP.js} +8 -3
- package/dist/{chunk-BIDVNLJO.js.map → chunk-O3RMSMBP.js.map} +1 -1
- package/dist/{chunk-UKPX3RIP.js → chunk-ODO2TCTS.js} +27 -13
- package/dist/chunk-ODO2TCTS.js.map +1 -0
- package/dist/{chunk-M2KGLH2G.js → chunk-P3QSWNED.js} +11 -11
- package/dist/{chunk-M2KGLH2G.js.map → chunk-P3QSWNED.js.map} +1 -1
- package/dist/{chunk-QDAN43B6.js → chunk-Q4K337QY.js} +6 -6
- package/dist/chunk-Q4K337QY.js.map +1 -0
- package/dist/{chunk-2YGHPQ66.js → chunk-Q5N24VII.js} +2 -2
- package/dist/{chunk-2YGHPQ66.js.map → chunk-Q5N24VII.js.map} +1 -1
- package/dist/{chunk-VJXP256V.js → chunk-RLRZJAF7.js} +20 -8
- package/dist/chunk-RLRZJAF7.js.map +1 -0
- package/dist/{chunk-VZXML7EH.js → chunk-SY5UA6WS.js} +39 -10
- package/dist/chunk-SY5UA6WS.js.map +1 -0
- package/dist/{chunk-XKDR22VE.js → chunk-TFC5SCAB.js} +37 -14
- package/dist/chunk-TFC5SCAB.js.map +1 -0
- package/dist/{chunk-HBWRKEW4.js → chunk-VBALIMST.js} +3 -3
- package/dist/{chunk-HBWRKEW4.js.map → chunk-VBALIMST.js.map} +1 -1
- package/dist/{chunk-JINATP4N.js → chunk-VXQ7A6ZI.js} +8 -9
- package/dist/chunk-VXQ7A6ZI.js.map +1 -0
- package/dist/{chunk-TBLPZQSI.js → chunk-W7CHDHRV.js} +114 -42
- package/dist/chunk-W7CHDHRV.js.map +1 -0
- package/dist/{chunk-AIAPXRCI.js → chunk-WBWVOOKM.js} +201 -123
- package/dist/chunk-WBWVOOKM.js.map +1 -0
- package/dist/{chunk-6H3IJ752.js → chunk-WJEZWKEY.js} +20 -10
- package/dist/chunk-WJEZWKEY.js.map +1 -0
- package/dist/{chunk-TRPAKUIB.js → chunk-WMTOAYGP.js} +9 -9
- package/dist/{chunk-TRPAKUIB.js.map → chunk-WMTOAYGP.js.map} +1 -1
- package/dist/{chunk-C3D32LE3.js → chunk-WTHIUPVJ.js} +3 -3
- package/dist/{chunk-C3D32LE3.js.map → chunk-WTHIUPVJ.js.map} +1 -1
- package/dist/{chunk-F2TB3TT6.js → chunk-XCTMTOGT.js} +5 -5
- package/dist/{chunk-F2TB3TT6.js.map → chunk-XCTMTOGT.js.map} +1 -1
- package/dist/chunk-XMJ343KF.js +18 -0
- package/dist/chunk-XMJ343KF.js.map +1 -0
- package/dist/collapse.js +1 -1
- package/dist/combobox.css +7 -0
- package/dist/combobox.js +183 -0
- package/dist/combobox.js.map +1 -0
- package/dist/confetti.js +2 -2
- package/dist/crossfade-UHUQBUVG.js +133 -0
- package/dist/crossfade-UHUQBUVG.js.map +1 -0
- package/dist/date-field.js +27 -22
- package/dist/date-field.js.map +1 -1
- package/dist/date-picker.css +25 -41
- package/dist/date-range-field.js +463 -279
- package/dist/date-range-field.js.map +1 -1
- package/dist/datetime-field.js +28 -23
- package/dist/datetime-field.js.map +1 -1
- package/dist/dialog-sheet.css +31 -0
- package/dist/dialog.css +3 -0
- package/dist/dialog.js +44 -42
- package/dist/dialog.js.map +1 -1
- package/dist/dropdown.css +14 -11
- package/dist/dropdown.js +79 -37
- package/dist/dropdown.js.map +1 -1
- package/dist/emoji-picker.js +22 -21
- package/dist/emoji-picker.js.map +1 -1
- package/dist/flow-field.js +2 -2
- package/dist/glide.js +3 -3
- package/dist/input.css +54 -34
- package/dist/instagram-feed.js +3 -3
- package/dist/lens.js +184 -160
- package/dist/lens.js.map +1 -1
- package/dist/mcp.js +29 -22
- package/dist/menu-surface.css +81 -7
- package/dist/modal.js +11 -10
- package/dist/modal.js.map +1 -1
- package/dist/morphing-text.js +2 -2
- package/dist/motion-devtools.css +6 -5
- package/dist/motion-devtools.js +6 -6
- package/dist/motion-tokens.js +1 -1
- package/dist/motion.js +10 -0
- package/dist/motion.js.map +1 -0
- package/dist/multi-select.js +63 -24
- package/dist/multi-select.js.map +1 -1
- package/dist/number-field.js +122 -75
- package/dist/number-field.js.map +1 -1
- package/dist/odometer.css +27 -16
- package/dist/odometer.js +225 -73
- package/dist/odometer.js.map +1 -1
- package/dist/otp-field.js +49 -12
- package/dist/otp-field.js.map +1 -1
- package/dist/overlay.css +1 -0
- package/dist/pagination.css +1 -1
- package/dist/pagination.js +6 -6
- package/dist/{paint-CJQCM6ZO.js → paint-NLTI6TEF.js} +5 -3
- package/dist/paint-NLTI6TEF.js.map +1 -0
- package/dist/popover.js +12 -11
- package/dist/radio-group.css +9 -6
- package/dist/radio-group.js +9 -8
- package/dist/radio-group.js.map +1 -1
- package/dist/range-sheet-days.css +35 -0
- package/dist/range-sheet.css +80 -0
- package/dist/range-summary.css +67 -0
- package/dist/scroll-area.css +150 -0
- package/dist/scroll-area.js +85 -0
- package/dist/scroll-area.js.map +1 -0
- package/dist/select.css +55 -7
- package/dist/select.js +29 -15
- package/dist/select.js.map +1 -1
- package/dist/sheet.js +12 -11
- package/dist/support-rail.css +2 -2
- package/dist/support-rail.js +17 -15
- package/dist/support-rail.js.map +1 -1
- package/dist/table-detail.css +27 -0
- package/dist/table.css +41 -14
- package/dist/table.js +341 -172
- package/dist/table.js.map +1 -1
- package/dist/tabs.css +32 -13
- package/dist/tabs.js +69 -55
- package/dist/tabs.js.map +1 -1
- package/dist/tag.css +2 -4
- package/dist/tag.js +8 -7
- package/dist/tag.js.map +1 -1
- package/dist/text-field.js +4 -4
- package/dist/textarea.css +26 -41
- package/dist/textarea.js +43 -32
- package/dist/textarea.js.map +1 -1
- package/dist/theme-grid.js +8 -7
- package/dist/theme-switcher.js +19 -18
- package/dist/theme-switcher.js.map +1 -1
- package/dist/{theme-transition-VGLPZDJI.js → theme-transition-F3CBENM5.js} +29 -9
- package/dist/theme-transition-F3CBENM5.js.map +1 -0
- package/dist/theme-transition.css +49 -0
- package/dist/theme.js +5 -4
- package/dist/theme.js.map +1 -1
- package/dist/tide-AGGMQEJV.js +4 -0
- package/dist/tide-AGGMQEJV.js.map +1 -0
- package/dist/tiktok.js +3 -3
- package/dist/time-field.js +15 -8
- package/dist/time-field.js.map +1 -1
- package/dist/toast.css +1 -1
- package/dist/toast.js +11 -10
- package/dist/toast.js.map +1 -1
- package/dist/toggle-tag.js +2 -2
- package/dist/toggle-tag.js.map +1 -1
- package/dist/toggle.css +0 -1
- package/dist/toggle.js +4 -15
- package/dist/toggle.js.map +1 -1
- package/dist/tooltip.css +1 -1
- package/dist/tooltip.js +22 -17
- package/dist/tooltip.js.map +1 -1
- package/dist/trigger.css +0 -1
- package/dist/types/components/composites/combobox/Combobox.d.ts +51 -0
- package/dist/types/components/composites/combobox/caret.d.ts +8 -0
- package/dist/types/components/composites/combobox/use-combobox.d.ts +52 -0
- package/dist/types/components/composites/date-picker/DateField.d.ts +1 -1
- package/dist/types/components/composites/date-picker/DateRangeField.d.ts +6 -3
- package/dist/types/components/composites/date-picker/DateTimeField.d.ts +1 -1
- package/dist/types/components/composites/date-picker/TimeField.d.ts +1 -1
- package/dist/types/components/composites/date-picker/date-utils.d.ts +2 -0
- package/dist/types/components/composites/date-picker/field-shell.d.ts +8 -1
- package/dist/types/components/composites/date-picker/month-swipe.d.ts +3 -0
- package/dist/types/components/composites/date-picker/range-day.d.ts +11 -0
- package/dist/types/components/composites/date-picker/range-month.d.ts +14 -0
- package/dist/types/components/composites/date-picker/range-panel.d.ts +4 -18
- package/dist/types/components/composites/date-picker/range-presets.d.ts +24 -0
- package/dist/types/components/composites/date-picker/range-sheet.d.ts +12 -0
- package/dist/types/components/composites/date-picker/range-summary.d.ts +9 -0
- package/dist/types/components/composites/date-picker/typed-key.d.ts +3 -0
- package/dist/types/components/composites/date-picker/use-month-view.d.ts +14 -0
- package/dist/types/components/composites/date-picker/use-range-panel.d.ts +44 -0
- package/dist/types/components/composites/dialog/Dialog.d.ts +3 -2
- package/dist/types/components/composites/dialog/surface.d.ts +17 -0
- package/dist/types/components/composites/dropdown/Dropdown.d.ts +21 -4
- package/dist/types/components/composites/dropdown/types.d.ts +9 -3
- package/dist/types/components/composites/scroll-area/ScrollArea.d.ts +29 -0
- package/dist/types/components/composites/select/MultiSelect.d.ts +31 -5
- package/dist/types/components/composites/select/Select.d.ts +20 -4
- package/dist/types/components/composites/select/core/index.d.ts +2 -1
- package/dist/types/components/composites/select/core/menu.d.ts +10 -5
- package/dist/types/components/composites/select/core/panel.d.ts +7 -4
- package/dist/types/components/composites/select/core/trigger.d.ts +7 -2
- package/dist/types/components/composites/select/core/types.d.ts +9 -0
- package/dist/types/components/composites/select/core/use-listbox.d.ts +8 -6
- package/dist/types/components/composites/select/presets.d.ts +17 -0
- package/dist/types/components/composites/table/Table.d.ts +3 -74
- package/dist/types/components/composites/table/body.d.ts +15 -0
- package/dist/types/components/composites/table/detail.d.ts +24 -0
- package/dist/types/components/composites/table/head.d.ts +16 -0
- package/dist/types/components/composites/table/types.d.ts +86 -0
- package/dist/types/components/composites/table/use-scroller.d.ts +12 -0
- package/dist/types/components/composites/table/use-table-state.d.ts +16 -0
- package/dist/types/components/composites/tabs/Tabs.d.ts +4 -69
- package/dist/types/components/composites/tabs/tab-panel.d.ts +26 -0
- package/dist/types/components/composites/tabs/types.d.ts +48 -0
- package/dist/types/components/composites/tabs/use-ink.d.ts +5 -0
- package/dist/types/components/composites/tooltip/Tooltip.d.ts +1 -1
- package/dist/types/components/compound/support-rail/SupportRail.d.ts +1 -1
- package/dist/types/components/expressive/lens/Lens.d.ts +1 -1
- package/dist/types/components/expressive/lens/input.d.ts +2 -0
- package/dist/types/components/expressive/lens/optics.d.ts +37 -0
- package/dist/types/components/expressive/lens/paint.d.ts +2 -0
- package/dist/types/components/expressive/lens/use-lens.d.ts +10 -0
- package/dist/types/components/expressive/odometer/Odometer.d.ts +1 -1
- package/dist/types/components/expressive/odometer/roll.d.ts +18 -0
- package/dist/types/components/expressive/odometer/spring.d.ts +11 -0
- package/dist/types/components/expressive/theme-transition/scene.d.ts +3 -0
- package/dist/types/components/internal/hooks/use-hold-repeat.d.ts +8 -0
- package/dist/types/components/internal/icon/Icon.d.ts +2 -0
- package/dist/types/components/internal/menu/highlight.d.ts +9 -1
- package/dist/types/components/internal/menu/menu-row.d.ts +4 -0
- package/dist/types/components/internal/menu/use-anchor-width.d.ts +2 -0
- package/dist/types/components/internal/overlay/layer.d.ts +5 -8
- package/dist/types/components/internal/overlay/track-anchor.d.ts +5 -0
- package/dist/types/components/internal/support/types.d.ts +1 -1
- package/dist/types/components/internal/utils/activation.d.ts +1 -0
- package/dist/types/components/primitives/badge/Badge.d.ts +17 -8
- package/dist/types/components/primitives/badge/morph-label.d.ts +3 -0
- package/dist/types/components/primitives/badge/use-glint-on-change.d.ts +2 -0
- package/dist/types/components/primitives/button/Button.d.ts +4 -8
- package/dist/types/components/primitives/button/button-style.d.ts +8 -4
- package/dist/types/components/primitives/collapse/Collapse.d.ts +3 -2
- package/dist/types/components/primitives/input/NumberField.d.ts +1 -1
- package/dist/types/components/primitives/input/OtpField.d.ts +7 -3
- package/dist/types/components/primitives/input/TextField.d.ts +1 -1
- package/dist/types/components/primitives/input/field-chrome.d.ts +2 -1
- package/dist/types/components/primitives/input/use-number-value.d.ts +16 -0
- package/dist/types/components/primitives/tag/Tag.d.ts +1 -1
- package/dist/types/components/primitives/tag/ToggleTag.d.ts +2 -2
- package/dist/types/components/primitives/textarea/Textarea.d.ts +5 -3
- package/dist/types/components/primitives/textarea/char-meter.d.ts +6 -0
- package/dist/types/components/primitives/toggle/switch-glyph.d.ts +6 -0
- package/dist/types/engine/flip.d.ts +3 -1
- package/dist/types/engine/index.d.ts +2 -2
- package/dist/types/engine/loop.d.ts +5 -2
- package/dist/types/motion/before-paint.d.ts +4 -0
- package/dist/types/motion/crossfade.d.ts +4 -0
- package/dist/types/motion/element.d.ts +16 -4
- package/dist/types/motion/flip.d.ts +12 -3
- package/dist/types/motion/holders.d.ts +4 -0
- package/dist/types/motion/motion.d.ts +7 -0
- package/dist/types/motion/use-motion.d.ts +3 -1
- package/dist/types/theme-scope.d.ts +5 -0
- package/dist/types/tokens/component-styles.generated.d.ts +0 -2
- package/dist/types/tokens/motion-defaults.generated.d.ts +2 -0
- package/dist/types/tokens/motion-scale.d.ts +18 -15
- package/dist/types/tokens/motion-tokens.d.ts +1 -1
- package/dist/types/tokens/theme-store.d.ts +4 -4
- package/dist/types/tokens/theme-tokens.generated.d.ts +77 -59
- package/dist/types/tokens/theme.d.ts +1 -1
- package/dist/typing-lines.js +2 -2
- package/dist/youtube.js +3 -3
- package/package.json +16 -11
- package/skills/zyncat-ui/SKILL.md +8 -8
- package/skills/zyncat-ui/references/components.md +6 -5
- package/skills/zyncat-ui/references/recipes.md +1 -1
- package/skills/zyncat-ui/references/theming.md +3 -3
- package/src/components/composites/combobox/Combobox.tsx +100 -0
- package/src/components/composites/combobox/Combobox.usage.md +32 -0
- package/src/components/composites/combobox/caret.ts +41 -0
- package/src/components/composites/combobox/combobox.css +7 -0
- package/src/components/composites/combobox/use-combobox.ts +112 -0
- package/src/components/composites/date-picker/DateField.tsx +4 -0
- package/src/components/composites/date-picker/DateRangeField.tsx +15 -18
- package/src/components/composites/date-picker/DateTimeField.tsx +4 -0
- package/src/components/composites/date-picker/TimeField.tsx +12 -4
- package/src/components/composites/date-picker/date-picker.css +25 -41
- package/src/components/composites/date-picker/date-utils.ts +4 -0
- package/src/components/composites/date-picker/field-shell.tsx +45 -8
- package/src/components/composites/date-picker/month-swipe.ts +41 -0
- package/src/components/composites/date-picker/range-day.tsx +112 -0
- package/src/components/composites/date-picker/range-month.tsx +79 -0
- package/src/components/composites/date-picker/range-panel.tsx +30 -356
- package/src/components/composites/date-picker/range-presets.tsx +104 -0
- package/src/components/composites/date-picker/range-sheet-days.css +35 -0
- package/src/components/composites/date-picker/range-sheet.css +80 -0
- package/src/components/composites/date-picker/range-sheet.tsx +72 -0
- package/src/components/composites/date-picker/range-summary.css +67 -0
- package/src/components/composites/date-picker/range-summary.tsx +69 -0
- package/src/components/composites/date-picker/time-core.tsx +23 -17
- package/src/components/composites/date-picker/typed-key.ts +9 -0
- package/src/components/composites/date-picker/use-month-view.ts +32 -0
- package/src/components/composites/date-picker/use-range-panel.ts +145 -0
- package/src/components/composites/dialog/Dialog.tsx +28 -110
- package/src/components/composites/dialog/dialog-sheet.css +31 -0
- package/src/components/composites/dialog/dialog.css +3 -0
- package/src/components/composites/dialog/surface.tsx +93 -0
- package/src/components/composites/dropdown/Dropdown.tsx +49 -7
- package/src/components/composites/dropdown/Dropdown.usage.md +2 -0
- package/src/components/composites/dropdown/dropdown.css +14 -11
- package/src/components/composites/dropdown/menu-panel.tsx +49 -26
- package/src/components/composites/dropdown/types.ts +9 -3
- package/src/components/composites/pagination/pagination.css +1 -1
- package/src/components/composites/scroll-area/ScrollArea.tsx +114 -0
- package/src/components/composites/scroll-area/ScrollArea.usage.md +28 -0
- package/src/components/composites/scroll-area/scroll-area.css +150 -0
- package/src/components/composites/select/MultiSelect.tsx +71 -12
- package/src/components/composites/select/MultiSelect.usage.md +10 -0
- package/src/components/composites/select/Select.tsx +32 -2
- package/src/components/composites/select/Select.usage.md +13 -1
- package/src/components/composites/select/core/index.ts +2 -1
- package/src/components/composites/select/core/menu.tsx +34 -17
- package/src/components/composites/select/core/panel.tsx +62 -55
- package/src/components/composites/select/core/trigger.tsx +44 -13
- package/src/components/composites/select/core/types.ts +10 -0
- package/src/components/composites/select/core/use-listbox.ts +91 -38
- package/src/components/composites/select/presets.tsx +47 -0
- package/src/components/composites/select/select.css +55 -7
- package/src/components/composites/sheet/use-sheet-drag.ts +13 -0
- package/src/components/composites/table/Table.tsx +65 -305
- package/src/components/composites/table/Table.usage.md +19 -2
- package/src/components/composites/table/body.tsx +147 -0
- package/src/components/composites/table/detail.tsx +76 -0
- package/src/components/composites/table/head.tsx +90 -0
- package/src/components/composites/table/table-detail.css +27 -0
- package/src/components/composites/table/table.css +41 -14
- package/src/components/composites/table/types.ts +97 -0
- package/src/components/composites/table/use-scroller.ts +53 -0
- package/src/components/composites/table/use-table-state.ts +98 -0
- package/src/components/composites/tabs/Tabs.tsx +23 -188
- package/src/components/composites/tabs/tab-panel.tsx +63 -0
- package/src/components/composites/tabs/tabs.css +32 -13
- package/src/components/composites/tabs/types.ts +51 -0
- package/src/components/composites/tabs/use-ink.ts +87 -0
- package/src/components/composites/toast/toast.css +1 -1
- package/src/components/composites/tooltip/Tooltip.tsx +6 -5
- package/src/components/composites/tooltip/tooltip-host.tsx +10 -6
- package/src/components/composites/tooltip/tooltip.css +1 -1
- package/src/components/compound/support-rail/SupportRail.tsx +3 -2
- package/src/components/compound/support-rail/support-rail.css +2 -2
- package/src/components/dev/motion-devtools.css +6 -5
- package/src/components/expressive/lens/Lens.tsx +11 -368
- package/src/components/expressive/lens/input.ts +91 -0
- package/src/components/expressive/lens/optics.ts +119 -0
- package/src/components/expressive/lens/paint.ts +60 -0
- package/src/components/expressive/lens/use-lens.ts +121 -0
- package/src/components/expressive/odometer/Odometer.tsx +78 -99
- package/src/components/expressive/odometer/Odometer.usage.md +2 -2
- package/src/components/expressive/odometer/odometer.css +27 -16
- package/src/components/expressive/odometer/roll.ts +139 -0
- package/src/components/expressive/odometer/spring.ts +86 -0
- package/src/components/expressive/theme-transition/bloom.ts +22 -2
- package/src/components/expressive/theme-transition/paint.ts +2 -0
- package/src/components/expressive/theme-transition/scene.ts +3 -0
- package/src/components/expressive/theme-transition/theme-transition.css +49 -0
- package/src/components/expressive/theme-transition/theme-transition.ts +21 -1
- package/src/components/expressive/theme-transition/tide.ts +15 -10
- package/src/components/internal/hooks/use-hold-repeat.ts +43 -0
- package/src/components/internal/hooks/use-scroll-edges.ts +6 -1
- package/src/components/internal/icon/Icon.tsx +4 -0
- package/src/components/internal/menu/highlight.ts +20 -2
- package/src/components/internal/menu/menu-row.tsx +36 -8
- package/src/components/internal/menu/menu-surface.css +81 -7
- package/src/components/internal/menu/use-anchor-width.ts +26 -0
- package/src/components/internal/overlay/layer.tsx +11 -23
- package/src/components/internal/overlay/overlay.css +1 -0
- package/src/components/internal/overlay/position.ts +17 -6
- package/src/components/internal/overlay/track-anchor.ts +69 -0
- package/src/components/internal/overlay/trigger.css +0 -1
- package/src/components/internal/support/types.ts +1 -1
- package/src/components/internal/utils/activation.ts +7 -2
- package/src/components/primitives/avatar/avatar.css +1 -1
- package/src/components/primitives/badge/Badge.tsx +38 -15
- package/src/components/primitives/badge/Badge.usage.md +12 -5
- package/src/components/primitives/badge/badge.css +20 -11
- package/src/components/primitives/badge/morph-label.tsx +71 -0
- package/src/components/primitives/badge/use-glint-on-change.ts +16 -0
- package/src/components/primitives/button/Button.tsx +5 -8
- package/src/components/primitives/button/Button.usage.md +5 -4
- package/src/components/primitives/button/button-style.ts +11 -5
- package/src/components/primitives/button/button.css +24 -27
- package/src/components/primitives/checkbox/checkbox.css +0 -1
- package/src/components/primitives/collapse/Collapse.tsx +3 -2
- package/src/components/primitives/input/NumberField.tsx +38 -46
- package/src/components/primitives/input/OtpField.tsx +52 -11
- package/src/components/primitives/input/OtpField.usage.md +2 -1
- package/src/components/primitives/input/TextField.tsx +5 -3
- package/src/components/primitives/input/field-chrome.tsx +3 -2
- package/src/components/primitives/input/input.css +54 -34
- package/src/components/primitives/input/use-number-value.ts +38 -0
- package/src/components/primitives/radio-group/radio-group.css +9 -6
- package/src/components/primitives/tag/Tag.tsx +1 -1
- package/src/components/primitives/tag/ToggleTag.tsx +2 -2
- package/src/components/primitives/tag/tag.css +2 -4
- package/src/components/primitives/textarea/Textarea.tsx +44 -30
- package/src/components/primitives/textarea/char-meter.tsx +19 -0
- package/src/components/primitives/textarea/textarea.css +26 -41
- package/src/components/primitives/toggle/Toggle.tsx +3 -12
- package/src/components/primitives/toggle/switch-glyph.tsx +25 -0
- package/src/components/primitives/toggle/toggle.css +0 -1
- package/src/engine/animate.ts +5 -3
- package/src/engine/flip.ts +28 -4
- package/src/engine/index.ts +2 -2
- package/src/engine/loop.ts +17 -6
- package/src/mcp/server.ts +30 -20
- package/src/motion/before-paint.ts +15 -0
- package/src/motion/crossfade.ts +143 -0
- package/src/motion/element.tsx +29 -8
- package/src/motion/flip.ts +102 -31
- package/src/motion/glide.tsx +5 -0
- package/src/motion/holders.ts +10 -0
- package/src/motion/motion.ts +7 -0
- package/src/motion/motion.usage.md +34 -0
- package/src/motion/presence.tsx +22 -9
- package/src/motion/use-motion.ts +45 -6
- package/src/theme-scope.ts +19 -0
- package/src/tokens/base.css +7 -5
- package/src/tokens/color.css +17 -15
- package/src/tokens/component-styles.generated.ts +0 -2
- package/src/tokens/dark.css +8 -5
- package/src/tokens/decisions.css +5 -3
- package/src/tokens/motion-defaults.generated.ts +15 -8
- package/src/tokens/motion-scale.ts +18 -15
- package/src/tokens/motion-tokens.ts +4 -4
- package/src/tokens/motion.css +19 -11
- package/src/tokens/reset.css +1 -0
- package/src/tokens/semantic.css +20 -14
- package/src/tokens/spacing.css +5 -3
- package/src/tokens/theme-store.ts +4 -4
- package/src/tokens/theme-sync.tsx +4 -2
- package/src/tokens/theme-tokens.generated.ts +78 -59
- package/src/tokens/theme.tsx +1 -1
- package/tailwind.css +6 -0
- package/dist/bloom-HV23M4AW.js.map +0 -1
- package/dist/chunk-2DNKZ57E.js +0 -72
- package/dist/chunk-2DNKZ57E.js.map +0 -1
- package/dist/chunk-6H3IJ752.js.map +0 -1
- package/dist/chunk-7NHY2CRA.js.map +0 -1
- package/dist/chunk-AIAPXRCI.js.map +0 -1
- package/dist/chunk-BRKGYLEQ.js.map +0 -1
- package/dist/chunk-F64Z42PJ.js.map +0 -1
- package/dist/chunk-JINATP4N.js.map +0 -1
- package/dist/chunk-KSAJ6DED.js +0 -16
- package/dist/chunk-KSAJ6DED.js.map +0 -1
- package/dist/chunk-LNAV5E7S.js.map +0 -1
- package/dist/chunk-N43NDSME.js.map +0 -1
- package/dist/chunk-ODRO3KS6.js.map +0 -1
- package/dist/chunk-PXQBJMPJ.js.map +0 -1
- package/dist/chunk-QDAN43B6.js.map +0 -1
- package/dist/chunk-RJENXXTI.js +0 -93
- package/dist/chunk-RJENXXTI.js.map +0 -1
- package/dist/chunk-RLNCRDAL.js.map +0 -1
- package/dist/chunk-RW2A4M2Q.js +0 -57
- package/dist/chunk-RW2A4M2Q.js.map +0 -1
- package/dist/chunk-TBLPZQSI.js.map +0 -1
- package/dist/chunk-TDHLZY6I.js.map +0 -1
- package/dist/chunk-UKPX3RIP.js.map +0 -1
- package/dist/chunk-V6QAAOA5.js.map +0 -1
- package/dist/chunk-VDOBLABP.js +0 -38
- package/dist/chunk-VDOBLABP.js.map +0 -1
- package/dist/chunk-VJXP256V.js.map +0 -1
- package/dist/chunk-VQFILXQN.js.map +0 -1
- package/dist/chunk-VZXML7EH.js.map +0 -1
- package/dist/chunk-XKDR22VE.js.map +0 -1
- package/dist/count-badge.js +0 -13
- package/dist/count-badge.js.map +0 -1
- package/dist/paint-CJQCM6ZO.js.map +0 -1
- package/dist/status-badge.js +0 -72
- package/dist/status-badge.js.map +0 -1
- package/dist/theme-transition-VGLPZDJI.js.map +0 -1
- package/dist/tide-DJZMDAFT.js.map +0 -1
- package/dist/types/components/primitives/badge/CountBadge.d.ts +0 -8
- package/dist/types/components/primitives/badge/StatusBadge.d.ts +0 -15
- package/src/components/primitives/badge/CountBadge.tsx +0 -20
- package/src/components/primitives/badge/CountBadge.usage.md +0 -13
- package/src/components/primitives/badge/StatusBadge.tsx +0 -113
- package/src/components/primitives/badge/StatusBadge.usage.md +0 -14
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { Fragment, useId, type MouseEvent, type PointerEventHandler, type ReactNode } from 'react';
|
|
4
|
+
|
|
5
|
+
import { Motion } from '../../../motion/element';
|
|
6
|
+
import { Presence } from '../../../motion/presence';
|
|
7
|
+
import { UIMotion } from '../../../tokens/motion-tokens';
|
|
8
|
+
import { Checkbox } from '../../primitives/checkbox/Checkbox';
|
|
9
|
+
import { DetailRow, DetailToggle, rowNameId, useExpanded } from './detail';
|
|
10
|
+
import type { TableColumn, TableProps } from './types';
|
|
11
|
+
import type { Selection } from './use-table-state';
|
|
12
|
+
|
|
13
|
+
const ROW_MOTION = {
|
|
14
|
+
layout: true,
|
|
15
|
+
layoutTransition: { timing: UIMotion.t.layout },
|
|
16
|
+
animate: { opacity: [0, 1], y: [UIMotion.dist.sm, 0], timing: UIMotion.t.enter },
|
|
17
|
+
exit: { opacity: [0], y: [UIMotion.dist.sm], timing: UIMotion.t.exit },
|
|
18
|
+
};
|
|
19
|
+
const PRESS_OWNERS = 'a, button, input, select, textarea, label, tr';
|
|
20
|
+
|
|
21
|
+
type TableBodyProps<Row> = Pick<
|
|
22
|
+
TableProps<Row>,
|
|
23
|
+
'columns' | 'selectionLabel' | 'renderDetail' | 'expanded' | 'onExpandedChange' | 'empty' | 'onRowClick'
|
|
24
|
+
> &
|
|
25
|
+
Required<Pick<TableProps<Row>, 'selectable' | 'expandMode' | 'loading'>> & {
|
|
26
|
+
rows: Row[];
|
|
27
|
+
keyOf: (row: Row) => string | number;
|
|
28
|
+
mods: (col: TableColumn<Row>, i: number) => string[];
|
|
29
|
+
selection: Selection;
|
|
30
|
+
checkCellCls: string;
|
|
31
|
+
checkSize: 'sm' | 'md';
|
|
32
|
+
toggleSize: 'xs' | 'sm';
|
|
33
|
+
hoverRow: (row: Element | null) => void;
|
|
34
|
+
leaveRows: () => void;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export function TableBody<Row>({
|
|
38
|
+
rows,
|
|
39
|
+
keyOf,
|
|
40
|
+
columns,
|
|
41
|
+
mods,
|
|
42
|
+
selectable,
|
|
43
|
+
selection,
|
|
44
|
+
selectionLabel,
|
|
45
|
+
checkCellCls,
|
|
46
|
+
checkSize,
|
|
47
|
+
toggleSize,
|
|
48
|
+
renderDetail,
|
|
49
|
+
expanded,
|
|
50
|
+
onExpandedChange,
|
|
51
|
+
expandMode,
|
|
52
|
+
loading,
|
|
53
|
+
empty,
|
|
54
|
+
onRowClick,
|
|
55
|
+
hoverRow,
|
|
56
|
+
leaveRows,
|
|
57
|
+
}: TableBodyProps<Row>) {
|
|
58
|
+
const uid = useId();
|
|
59
|
+
const [openKeys, toggleDetail] = useExpanded(expanded, onExpandedChange, expandMode);
|
|
60
|
+
const colCount = columns.length + (selectable ? 1 : 0) + (renderDetail ? 1 : 0);
|
|
61
|
+
const showEmpty = !loading && rows.length === 0;
|
|
62
|
+
const enterRow: PointerEventHandler<HTMLElement> = (e) => hoverRow(e.currentTarget);
|
|
63
|
+
const enterDetail: PointerEventHandler<HTMLElement> = (e) => hoverRow(e.currentTarget.previousElementSibling);
|
|
64
|
+
|
|
65
|
+
function pressRow(e: MouseEvent<HTMLElement>, row: Row, detailKey: string | number | null) {
|
|
66
|
+
if (!(e.target instanceof Element) || e.target.closest(PRESS_OWNERS) !== e.currentTarget) return;
|
|
67
|
+
if (detailKey != null) toggleDetail(detailKey);
|
|
68
|
+
if (onRowClick) onRowClick(row);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return (
|
|
72
|
+
<tbody onPointerLeave={leaveRows}>
|
|
73
|
+
<Presence initial={false} mode={showEmpty ? 'wait' : 'sync'}>
|
|
74
|
+
{showEmpty && (
|
|
75
|
+
<Motion as="tr" key="empty" {...ROW_MOTION}>
|
|
76
|
+
<td colSpan={colCount} className="zc-tbl__emptyCell">
|
|
77
|
+
{empty != null ? empty : 'Nothing to show'}
|
|
78
|
+
</td>
|
|
79
|
+
</Motion>
|
|
80
|
+
)}
|
|
81
|
+
{rows.map((row, idx) => {
|
|
82
|
+
const k = keyOf(row);
|
|
83
|
+
const isSel = selection.selected.has(k);
|
|
84
|
+
const detail = renderDetail ? renderDetail(row) : null;
|
|
85
|
+
const open = openKeys.includes(k);
|
|
86
|
+
const id = `${uid}${idx}`;
|
|
87
|
+
return (
|
|
88
|
+
<Fragment key={k}>
|
|
89
|
+
<Motion
|
|
90
|
+
as="tr"
|
|
91
|
+
{...ROW_MOTION}
|
|
92
|
+
className="zc-tbl__row"
|
|
93
|
+
data-selected={isSel ? '' : undefined}
|
|
94
|
+
data-expandable={detail ? '' : undefined}
|
|
95
|
+
onClick={
|
|
96
|
+
onRowClick || detail ? (e: MouseEvent<HTMLElement>) => pressRow(e, row, detail ? k : null) : undefined
|
|
97
|
+
}
|
|
98
|
+
onPointerEnter={enterRow}
|
|
99
|
+
>
|
|
100
|
+
{selectable ? (
|
|
101
|
+
<td className={checkCellCls} onClick={(e) => e.stopPropagation()}>
|
|
102
|
+
<Checkbox
|
|
103
|
+
className="zc-tbl__cbx"
|
|
104
|
+
size={checkSize}
|
|
105
|
+
checked={isSel}
|
|
106
|
+
htmlProps={{
|
|
107
|
+
'aria-label': selectionLabel ? selectionLabel(row) : 'Select row',
|
|
108
|
+
onClick: (e) => {
|
|
109
|
+
selection.shiftRef.current = e.shiftKey;
|
|
110
|
+
},
|
|
111
|
+
}}
|
|
112
|
+
onChange={() => selection.toggleRow(idx)}
|
|
113
|
+
/>
|
|
114
|
+
</td>
|
|
115
|
+
) : null}
|
|
116
|
+
{columns.map((c, i) => (
|
|
117
|
+
<td
|
|
118
|
+
key={c.key}
|
|
119
|
+
id={detail && i === 0 ? rowNameId(id) : undefined}
|
|
120
|
+
className={mods(c, i)
|
|
121
|
+
.concat(c.mono ? ['zc-tbl__cell--mono'] : [])
|
|
122
|
+
.concat(c.strong ? ['zc-tbl__cell--strong'] : [])
|
|
123
|
+
.join(' ')}
|
|
124
|
+
>
|
|
125
|
+
{c.render ? c.render(row) : (row as Record<string, ReactNode>)[c.key]}
|
|
126
|
+
</td>
|
|
127
|
+
))}
|
|
128
|
+
{renderDetail ? (
|
|
129
|
+
<td className="zc-tbl__cell--toggle">
|
|
130
|
+
{detail ? (
|
|
131
|
+
<DetailToggle id={id} open={open} size={toggleSize} onToggle={() => toggleDetail(k)} />
|
|
132
|
+
) : null}
|
|
133
|
+
</td>
|
|
134
|
+
) : null}
|
|
135
|
+
</Motion>
|
|
136
|
+
{detail ? (
|
|
137
|
+
<DetailRow id={id} open={open} span={colCount} motion={ROW_MOTION} onPointerEnter={enterDetail}>
|
|
138
|
+
{detail}
|
|
139
|
+
</DetailRow>
|
|
140
|
+
) : null}
|
|
141
|
+
</Fragment>
|
|
142
|
+
);
|
|
143
|
+
})}
|
|
144
|
+
</Presence>
|
|
145
|
+
</tbody>
|
|
146
|
+
);
|
|
147
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import './table-detail.css';
|
|
4
|
+
|
|
5
|
+
import type { PointerEventHandler, ReactNode } from 'react';
|
|
6
|
+
|
|
7
|
+
import { Motion, type MotionProps } from '../../../motion/element';
|
|
8
|
+
import { useControllable } from '../../internal/hooks/use-controllable';
|
|
9
|
+
import { Icon } from '../../internal/icon/Icon';
|
|
10
|
+
import { Button, type ButtonSize } from '../../primitives/button/Button';
|
|
11
|
+
import { Collapse, type CollapseAnimation } from '../../primitives/collapse/Collapse';
|
|
12
|
+
|
|
13
|
+
type RowKey = string | number;
|
|
14
|
+
|
|
15
|
+
const NONE_OPEN: RowKey[] = [];
|
|
16
|
+
const DETAIL_MOTION: CollapseAnimation = { duration: { close: 'base' }, ease: { close: 'exit' } };
|
|
17
|
+
|
|
18
|
+
export const rowNameId = (id: string) => `${id}-n`;
|
|
19
|
+
|
|
20
|
+
export function useExpanded(
|
|
21
|
+
value: RowKey[] | undefined,
|
|
22
|
+
onChange: ((keys: RowKey[]) => void) | undefined,
|
|
23
|
+
mode: 'single' | 'multiple',
|
|
24
|
+
) {
|
|
25
|
+
const [open, setOpen] = useControllable(value, NONE_OPEN, onChange);
|
|
26
|
+
const toggle = (key: RowKey) =>
|
|
27
|
+
setOpen(open.includes(key) ? open.filter((k) => k !== key) : mode === 'single' ? [key] : [...open, key]);
|
|
28
|
+
return [open, toggle] as const;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
interface DetailToggleProps {
|
|
32
|
+
id: string;
|
|
33
|
+
open: boolean;
|
|
34
|
+
size: ButtonSize;
|
|
35
|
+
onToggle: () => void;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function DetailToggle({ id, open, size, onToggle }: DetailToggleProps) {
|
|
39
|
+
return (
|
|
40
|
+
<Button
|
|
41
|
+
variant="ghost"
|
|
42
|
+
size={size}
|
|
43
|
+
iconOnly
|
|
44
|
+
className="zc-tbl__toggle"
|
|
45
|
+
id={`${id}-t`}
|
|
46
|
+
aria-label="Details"
|
|
47
|
+
aria-labelledby={`${id}-t ${rowNameId(id)}`}
|
|
48
|
+
aria-expanded={open}
|
|
49
|
+
aria-controls={`${id}-d`}
|
|
50
|
+
onClick={onToggle}
|
|
51
|
+
>
|
|
52
|
+
<Icon name="caret-down" />
|
|
53
|
+
</Button>
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
interface DetailRowProps {
|
|
58
|
+
id: string;
|
|
59
|
+
open: boolean;
|
|
60
|
+
span: number;
|
|
61
|
+
motion: Pick<MotionProps, 'layout' | 'layoutTransition' | 'animate' | 'exit'>;
|
|
62
|
+
onPointerEnter: PointerEventHandler<HTMLElement>;
|
|
63
|
+
children: ReactNode;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export function DetailRow({ id, open, span, motion, onPointerEnter, children }: DetailRowProps) {
|
|
67
|
+
return (
|
|
68
|
+
<Motion as="tr" {...motion} className="zc-tbl__detail" onPointerEnter={onPointerEnter}>
|
|
69
|
+
<td colSpan={span}>
|
|
70
|
+
<Collapse open={open} animation={DETAIL_MOTION} htmlProps={{ id: `${id}-d` }}>
|
|
71
|
+
<div className="zc-tbl__detailBody">{children}</div>
|
|
72
|
+
</Collapse>
|
|
73
|
+
</td>
|
|
74
|
+
</Motion>
|
|
75
|
+
);
|
|
76
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import type { ReactNode } from 'react';
|
|
4
|
+
|
|
5
|
+
import { Icon } from '../../internal/icon/Icon';
|
|
6
|
+
import { activationProps, type ActivateOn } from '../../internal/utils/activation';
|
|
7
|
+
import type { TableColumn, TableSort } from './types';
|
|
8
|
+
|
|
9
|
+
export function cellMods(col: TableColumn, i: number, pinFirst: boolean, selectable: boolean) {
|
|
10
|
+
const a: string[] = [];
|
|
11
|
+
if (col.align === 'end') a.push('zc-tbl__cell--end');
|
|
12
|
+
if (col.align === 'center') a.push('zc-tbl__cell--center');
|
|
13
|
+
if (col.grow) a.push('zc-tbl__cell--grow');
|
|
14
|
+
if (col.hideBelow) a.push('zc-tbl__cell--hide-' + col.hideBelow);
|
|
15
|
+
if (pinFirst && i === 0) {
|
|
16
|
+
a.push('zc-tbl__cell--pin', 'zc-tbl__cell--pinEdge');
|
|
17
|
+
if (selectable) a.push('zc-tbl__cell--pinOff');
|
|
18
|
+
}
|
|
19
|
+
return a;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
interface TableHeadProps<Row> {
|
|
23
|
+
columns: TableColumn<Row>[];
|
|
24
|
+
sort: TableSort | null;
|
|
25
|
+
onSort: (col: TableColumn<Row>) => void;
|
|
26
|
+
activateOn: ActivateOn;
|
|
27
|
+
mods: (col: TableColumn<Row>, i: number) => string[];
|
|
28
|
+
selectAll: ReactNode;
|
|
29
|
+
checkCellCls: string;
|
|
30
|
+
toggleColumn: boolean;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function TableHead<Row>({
|
|
34
|
+
columns,
|
|
35
|
+
sort,
|
|
36
|
+
onSort,
|
|
37
|
+
activateOn,
|
|
38
|
+
mods,
|
|
39
|
+
selectAll,
|
|
40
|
+
checkCellCls,
|
|
41
|
+
toggleColumn,
|
|
42
|
+
}: TableHeadProps<Row>) {
|
|
43
|
+
return (
|
|
44
|
+
<thead>
|
|
45
|
+
<tr>
|
|
46
|
+
{selectAll ? (
|
|
47
|
+
<th scope="col" className={checkCellCls}>
|
|
48
|
+
{selectAll}
|
|
49
|
+
</th>
|
|
50
|
+
) : null}
|
|
51
|
+
{columns.map((c, i) => {
|
|
52
|
+
const active = sort && sort.key === c.key;
|
|
53
|
+
const cls = (c.sortable ? ['zc-tbl__cell--sortable'] : []).concat(mods(c, i));
|
|
54
|
+
return (
|
|
55
|
+
<th
|
|
56
|
+
key={c.key}
|
|
57
|
+
scope="col"
|
|
58
|
+
className={cls.join(' ')}
|
|
59
|
+
style={c.width ? { width: c.width } : undefined}
|
|
60
|
+
aria-sort={active ? (sort.dir === 'asc' ? 'ascending' : 'descending') : undefined}
|
|
61
|
+
>
|
|
62
|
+
{c.sortable ? (
|
|
63
|
+
<button
|
|
64
|
+
type="button"
|
|
65
|
+
className="zc-tbl__sort"
|
|
66
|
+
{...activationProps<HTMLButtonElement>(() => onSort(c), { on: activateOn })}
|
|
67
|
+
>
|
|
68
|
+
<span className="zc-tbl__sortLbl">{c.label}</span>
|
|
69
|
+
<span
|
|
70
|
+
className={
|
|
71
|
+
'zc-tbl__sortIcon' +
|
|
72
|
+
(active ? ' zc-is-on' : '') +
|
|
73
|
+
(active && sort.dir === 'desc' ? ' zc-is-desc' : '')
|
|
74
|
+
}
|
|
75
|
+
aria-hidden="true"
|
|
76
|
+
>
|
|
77
|
+
<Icon name="arrow-up" size="sm" />
|
|
78
|
+
</span>
|
|
79
|
+
</button>
|
|
80
|
+
) : c.label != null ? (
|
|
81
|
+
<span className="zc-tbl__hLbl">{c.label}</span>
|
|
82
|
+
) : null}
|
|
83
|
+
</th>
|
|
84
|
+
);
|
|
85
|
+
})}
|
|
86
|
+
{toggleColumn ? <th scope="col" className="zc-tbl__cell--toggle" /> : null}
|
|
87
|
+
</tr>
|
|
88
|
+
</thead>
|
|
89
|
+
);
|
|
90
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
@layer zyncat.reset, zyncat.tokens, zyncat.base, zyncat.components;
|
|
2
|
+
|
|
3
|
+
@layer zyncat.components {
|
|
4
|
+
.zc-tbl__row[data-expandable] > td {
|
|
5
|
+
border-bottom-width: 0;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.zc-tbl__table .zc-tbl__detail > td {
|
|
9
|
+
padding-block: 0;
|
|
10
|
+
white-space: normal;
|
|
11
|
+
}
|
|
12
|
+
.zc-tbl__detailBody {
|
|
13
|
+
padding: var(--ring-gutter) 0 var(--tbl-pad-y);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.zc-tbl__table .zc-tbl__cell--toggle {
|
|
17
|
+
width: 0;
|
|
18
|
+
padding: 0 var(--space-2);
|
|
19
|
+
text-align: right;
|
|
20
|
+
}
|
|
21
|
+
.zc-tbl__toggle .zc-icon {
|
|
22
|
+
transition: transform var(--duration-slow) var(--ease-standard);
|
|
23
|
+
}
|
|
24
|
+
.zc-tbl__toggle[aria-expanded='true'] .zc-icon {
|
|
25
|
+
transform: rotate(180deg);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
.zc-tbl {
|
|
10
|
+
--_tbl-row-hover: color-mix(in oklab, var(--bg-subtle) 55%, var(--bg-surface));
|
|
10
11
|
--tbl-pad-y: var(--space-3);
|
|
11
12
|
--tbl-head-py: var(--space-3);
|
|
12
13
|
--tbl-head-h: calc(var(--leading-caption) + 2 * var(--tbl-head-py));
|
|
@@ -37,6 +38,7 @@
|
|
|
37
38
|
min-height: 0;
|
|
38
39
|
}
|
|
39
40
|
.zc-tbl__scroll {
|
|
41
|
+
position: relative;
|
|
40
42
|
flex: 1 1 auto;
|
|
41
43
|
min-height: 0;
|
|
42
44
|
overflow: auto;
|
|
@@ -48,6 +50,8 @@
|
|
|
48
50
|
}
|
|
49
51
|
|
|
50
52
|
.zc-tbl__table {
|
|
53
|
+
position: relative;
|
|
54
|
+
z-index: 1;
|
|
51
55
|
width: 100%;
|
|
52
56
|
border-collapse: separate; /* collapse breaks sticky borders */
|
|
53
57
|
border-spacing: 0;
|
|
@@ -76,7 +80,7 @@
|
|
|
76
80
|
.zc-tbl__table td {
|
|
77
81
|
padding: var(--tbl-pad-y) var(--space-3);
|
|
78
82
|
border-bottom: var(--border-hairline) solid var(--border-subtle);
|
|
79
|
-
background: var(--row-bg,
|
|
83
|
+
background: var(--row-bg, transparent);
|
|
80
84
|
font: var(--type-body);
|
|
81
85
|
color: var(--text-body);
|
|
82
86
|
vertical-align: middle;
|
|
@@ -92,26 +96,40 @@
|
|
|
92
96
|
padding-inline-start: var(--space-4);
|
|
93
97
|
}
|
|
94
98
|
.zc-tbl__table th:last-child:not(.zc-tbl__cell--sortable),
|
|
95
|
-
.zc-tbl__table td:last-child {
|
|
99
|
+
.zc-tbl__table td:last-child:not(.zc-tbl__cell--toggle) {
|
|
96
100
|
padding-inline-end: var(--space-4);
|
|
97
101
|
}
|
|
98
102
|
|
|
99
|
-
.zc-
|
|
100
|
-
--row-
|
|
101
|
-
}
|
|
102
|
-
.zc-tbl__row:hover {
|
|
103
|
-
--row-bg: var(--bg-subtle);
|
|
103
|
+
[data-polarity='dark'] .zc-tbl {
|
|
104
|
+
--_tbl-row-hover: var(--bg-subtle);
|
|
104
105
|
}
|
|
106
|
+
|
|
105
107
|
.zc-tbl__row[data-selected] {
|
|
106
|
-
--row-bg: color-mix(in oklab, var(--accent) 5%,
|
|
107
|
-
}
|
|
108
|
-
.zc-tbl__row[data-selected]:hover {
|
|
109
|
-
--row-bg: color-mix(in oklab, var(--accent) 5%, var(--bg-subtle));
|
|
108
|
+
--row-bg: color-mix(in oklab, var(--accent) 5%, transparent);
|
|
110
109
|
}
|
|
111
|
-
.zc-tbl--clickable tbody .zc-tbl__row
|
|
110
|
+
.zc-tbl--clickable tbody .zc-tbl__row,
|
|
111
|
+
.zc-tbl__row[data-expandable] {
|
|
112
112
|
cursor: pointer;
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
+
.zc-tbl__glide {
|
|
116
|
+
position: absolute;
|
|
117
|
+
top: 0;
|
|
118
|
+
left: 0;
|
|
119
|
+
opacity: 0;
|
|
120
|
+
pointer-events: none;
|
|
121
|
+
}
|
|
122
|
+
.zc-tbl__glide::before {
|
|
123
|
+
content: '';
|
|
124
|
+
position: absolute;
|
|
125
|
+
inset: var(--space-1) var(--space-2);
|
|
126
|
+
border-radius: var(--radius-md);
|
|
127
|
+
background: var(--_tbl-row-hover);
|
|
128
|
+
}
|
|
129
|
+
.zc-tbl--loading .zc-tbl__glide {
|
|
130
|
+
visibility: hidden;
|
|
131
|
+
}
|
|
132
|
+
|
|
115
133
|
.zc-tbl__table td.zc-tbl__cell--mono {
|
|
116
134
|
font: var(--type-code);
|
|
117
135
|
font-variant-numeric: tabular-nums;
|
|
@@ -129,6 +147,12 @@
|
|
|
129
147
|
.zc-tbl__cell--grow {
|
|
130
148
|
width: 100%;
|
|
131
149
|
}
|
|
150
|
+
.zc-tbl--shares .zc-tbl__table .zc-tbl__cell--grow {
|
|
151
|
+
width: auto;
|
|
152
|
+
}
|
|
153
|
+
.zc-tbl--shares .zc-tbl__table th:not(.zc-tbl__cell--grow, .zc-tbl__cell--check) {
|
|
154
|
+
width: 0;
|
|
155
|
+
}
|
|
132
156
|
|
|
133
157
|
.zc-tbl__table th.zc-tbl__cell--sortable {
|
|
134
158
|
padding: 0;
|
|
@@ -159,7 +183,7 @@
|
|
|
159
183
|
padding-inline-end: var(--space-3);
|
|
160
184
|
}
|
|
161
185
|
.zc-tbl__cell--end .zc-tbl__sort {
|
|
162
|
-
|
|
186
|
+
flex-direction: row-reverse;
|
|
163
187
|
}
|
|
164
188
|
.zc-tbl__cell--center .zc-tbl__sort {
|
|
165
189
|
justify-content: center;
|
|
@@ -243,7 +267,7 @@
|
|
|
243
267
|
.zc-tbl__bulkCount {
|
|
244
268
|
display: inline-flex;
|
|
245
269
|
align-items: baseline;
|
|
246
|
-
font-family: var(--font-
|
|
270
|
+
font-family: var(--font-body);
|
|
247
271
|
font-size: var(--size-caption);
|
|
248
272
|
line-height: var(--leading-caption);
|
|
249
273
|
font-weight: var(--weight-medium);
|
|
@@ -263,6 +287,9 @@
|
|
|
263
287
|
.zc-tbl--pin thead .zc-tbl__cell--pin {
|
|
264
288
|
z-index: 3;
|
|
265
289
|
}
|
|
290
|
+
.zc-tbl[data-x-back] td.zc-tbl__cell--pin {
|
|
291
|
+
background: linear-gradient(var(--row-bg, transparent) 0 0), linear-gradient(var(--bg-surface) 0 0);
|
|
292
|
+
}
|
|
266
293
|
.zc-tbl--pin .zc-tbl__cell--pinOff {
|
|
267
294
|
left: var(--tbl-check-w);
|
|
268
295
|
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
import type { DataAttributes } from '../../../dom-props';
|
|
4
|
+
import type { ActivateOn } from '../../internal/utils/activation';
|
|
5
|
+
|
|
6
|
+
export type TableAlign = 'start' | 'end' | 'center';
|
|
7
|
+
export type TableHideBelow = 'sm' | 'md';
|
|
8
|
+
|
|
9
|
+
export interface TableColumn<Row = any> {
|
|
10
|
+
/** Unique column id; also the default data accessor (row[key]). */
|
|
11
|
+
key: string;
|
|
12
|
+
/** Header cell content; omit for a header-less column (e.g. an actions column). */
|
|
13
|
+
label?: ReactNode;
|
|
14
|
+
/** Cell + header alignment. Default 'start'. */
|
|
15
|
+
align?: TableAlign;
|
|
16
|
+
/** Mono + tabular numerals (timestamps, counts, IDs - section E). */
|
|
17
|
+
mono?: boolean;
|
|
18
|
+
/** Identity emphasis: strong text, medium weight. */
|
|
19
|
+
strong?: boolean;
|
|
20
|
+
/** The one greedy column - absorbs slack width. Others size to content. */
|
|
21
|
+
grow?: boolean;
|
|
22
|
+
/** Share of the table's width this column takes, e.g. '30%'. A grow column takes what the shares leave;
|
|
23
|
+
* when the table is too narrow, the cells' content widths win. */
|
|
24
|
+
width?: `${number}%`;
|
|
25
|
+
/** Header becomes a sort control. Sort is local; asc - desc, no third state. */
|
|
26
|
+
sortable?: boolean;
|
|
27
|
+
/** Sort accessor: a row property name, or a function. Defaults to row[key]. */
|
|
28
|
+
sortBy?: string | ((row: Row) => unknown);
|
|
29
|
+
/** Collapse this column below a container breakpoint (30rem / 42rem). */
|
|
30
|
+
hideBelow?: TableHideBelow;
|
|
31
|
+
/** Custom cell renderer. Defaults to row[key]. */
|
|
32
|
+
render?: (row: Row) => ReactNode;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface TableSort {
|
|
36
|
+
/** `key` of the column being sorted by. */
|
|
37
|
+
key: string;
|
|
38
|
+
/** Sort direction - `asc` or `desc`. */
|
|
39
|
+
dir: 'asc' | 'desc';
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface TableProps<Row = any> {
|
|
43
|
+
/** Column defs, rendered left to right. */
|
|
44
|
+
columns: TableColumn<Row>[];
|
|
45
|
+
/** The row data; sorted locally per the active sort before render. */
|
|
46
|
+
rows: Row[];
|
|
47
|
+
/** Row identity property. Default 'id'. Must be unique and stable. */
|
|
48
|
+
rowKey?: string;
|
|
49
|
+
/** Accessible name for the <table>. */
|
|
50
|
+
ariaLabel?: string;
|
|
51
|
+
|
|
52
|
+
/** Checkbox column + bulk bar. Selection is a Set of row keys, owned here. */
|
|
53
|
+
selectable?: boolean;
|
|
54
|
+
/** Fires with the selected row keys after every selection change. */
|
|
55
|
+
onSelectionChange?: (keys: Array<string | number>) => void;
|
|
56
|
+
/** Rendered in the bulk bar between the count and the built-in Clear. */
|
|
57
|
+
bulkActions?: (keys: Array<string | number>, clear: () => void) => ReactNode;
|
|
58
|
+
/** Per-row checkbox aria-label. Default 'Select row'. */
|
|
59
|
+
selectionLabel?: (row: Row) => string;
|
|
60
|
+
|
|
61
|
+
/** Initial sort; sorting stays local and uncontrolled after that. */
|
|
62
|
+
defaultSort?: TableSort | null;
|
|
63
|
+
/** Notification only - fires after the local sort updates. */
|
|
64
|
+
onSortChange?: (sort: TableSort) => void;
|
|
65
|
+
|
|
66
|
+
/** A row's details, unfolding full width under it from its disclosure button or a click on the
|
|
67
|
+
* row. A falsy return leaves that row without details. */
|
|
68
|
+
renderDetail?: (row: Row) => ReactNode;
|
|
69
|
+
/** Keys of the rows whose details are open. Omit to let the table own it. */
|
|
70
|
+
expanded?: Array<string | number>;
|
|
71
|
+
/** Fires with the open row keys after every toggle. */
|
|
72
|
+
onExpandedChange?: (keys: Array<string | number>) => void;
|
|
73
|
+
/** `single` closes the open row as another opens. Default 'multiple'. */
|
|
74
|
+
expandMode?: 'single' | 'multiple';
|
|
75
|
+
|
|
76
|
+
/** Row rhythm. Default 'cozy' (46px rows); 'compact' is 38px. */
|
|
77
|
+
density?: 'cozy' | 'compact';
|
|
78
|
+
/** Pin checkbox + first column under horizontal overflow. Default true. */
|
|
79
|
+
pinFirst?: boolean;
|
|
80
|
+
|
|
81
|
+
/** Rows recede and go inert (list-fetch convention). */
|
|
82
|
+
loading?: boolean;
|
|
83
|
+
/** Shown when rows is empty and not loading. Default 'Nothing to show'. */
|
|
84
|
+
empty?: ReactNode;
|
|
85
|
+
/** Footer strip - pagination, summaries. */
|
|
86
|
+
footer?: ReactNode;
|
|
87
|
+
|
|
88
|
+
/** Makes rows clickable. A click on the checkbox cell, or on a link, button, field or label in a
|
|
89
|
+
* cell, stays with it. */
|
|
90
|
+
onRowClick?: (row: Row) => void;
|
|
91
|
+
/** Whether a sortable header fires on `pointerdown` (snappier) or waits for `click`. @default 'pointerdown' */
|
|
92
|
+
activateOn?: ActivateOn;
|
|
93
|
+
/** Size the table here - the internal scroller absorbs the constraint. */
|
|
94
|
+
className?: string;
|
|
95
|
+
/** Standard <div> attributes (style, data-*, aria-*, ...) forwarded to the table wrapper. */
|
|
96
|
+
htmlProps?: Omit<HTMLAttributes<HTMLDivElement>, 'className'> & DataAttributes;
|
|
97
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useEffect, useRef, type RefObject } from 'react';
|
|
4
|
+
|
|
5
|
+
import { useGlide } from '../../../motion/glide';
|
|
6
|
+
import { useScrollEdges } from '../../internal/hooks/use-scroll-edges';
|
|
7
|
+
|
|
8
|
+
export function useRowGlide(scrollRef: RefObject<HTMLDivElement | null>) {
|
|
9
|
+
const tableRef = useRef<HTMLTableElement>(null);
|
|
10
|
+
const hoveredRef = useRef<HTMLElement | null>(null);
|
|
11
|
+
const glide = useGlide(scrollRef);
|
|
12
|
+
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
const table = tableRef.current;
|
|
15
|
+
if (!table) return undefined;
|
|
16
|
+
const follow = new ResizeObserver(() => glide.enter(hoveredRef.current));
|
|
17
|
+
follow.observe(table);
|
|
18
|
+
return () => follow.disconnect();
|
|
19
|
+
}, [glide]);
|
|
20
|
+
|
|
21
|
+
function hoverRow(row: Element | null) {
|
|
22
|
+
hoveredRef.current = row instanceof HTMLElement ? row : null;
|
|
23
|
+
glide.enter(hoveredRef.current);
|
|
24
|
+
}
|
|
25
|
+
function leaveRows() {
|
|
26
|
+
hoveredRef.current = null;
|
|
27
|
+
glide.leave();
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return { tableRef, glide, hoverRow, leaveRows };
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function useEdgeAttributes(
|
|
34
|
+
scrollRef: RefObject<HTMLDivElement | null>,
|
|
35
|
+
wrapRef: RefObject<HTMLDivElement | null>,
|
|
36
|
+
) {
|
|
37
|
+
useScrollEdges(
|
|
38
|
+
scrollRef,
|
|
39
|
+
(edges, el) => {
|
|
40
|
+
const w = wrapRef.current;
|
|
41
|
+
if (!w) return;
|
|
42
|
+
const set = (attr: string, on: boolean) => {
|
|
43
|
+
if (on) w.setAttribute(attr, '');
|
|
44
|
+
else w.removeAttribute(attr);
|
|
45
|
+
};
|
|
46
|
+
set('data-scrolled', el.scrollTop > 0);
|
|
47
|
+
set('data-y-scroll', el.scrollHeight > el.clientHeight);
|
|
48
|
+
set('data-x-back', edges.left);
|
|
49
|
+
set('data-x-more', edges.right);
|
|
50
|
+
},
|
|
51
|
+
{ content: true },
|
|
52
|
+
);
|
|
53
|
+
}
|