@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
package/dist/table.js
CHANGED
|
@@ -1,23 +1,249 @@
|
|
|
1
|
-
'use client';import { useScrollEdges } from './chunk-
|
|
2
|
-
import { activationProps } from './chunk-
|
|
3
|
-
import {
|
|
4
|
-
import './chunk-
|
|
5
|
-
import './chunk-
|
|
6
|
-
import './chunk-
|
|
7
|
-
import
|
|
1
|
+
'use client';import { useScrollEdges } from './chunk-O3RMSMBP.js';
|
|
2
|
+
import { activationProps } from './chunk-2GYZ3HP3.js';
|
|
3
|
+
import { GlidePill, useGlide } from './chunk-DOAR4PJ3.js';
|
|
4
|
+
import { Presence } from './chunk-CF6ZFXRV.js';
|
|
5
|
+
import { Motion } from './chunk-2EPNCOLN.js';
|
|
6
|
+
import './chunk-AK2AXGEC.js';
|
|
7
|
+
import './chunk-EUAXI6OF.js';
|
|
8
8
|
import { DigitStrip } from './chunk-H3X2263Y.js';
|
|
9
|
-
import { Button } from './chunk-
|
|
10
|
-
import './chunk-KSAJ6DED.js';
|
|
9
|
+
import { Button } from './chunk-G2TOUG2A.js';
|
|
11
10
|
import './chunk-NYQQH4R5.js';
|
|
12
|
-
import
|
|
11
|
+
import './chunk-XMJ343KF.js';
|
|
13
12
|
import { Checkbox } from './chunk-GGDAMIBH.js';
|
|
14
13
|
import './chunk-3XRVPCIM.js';
|
|
14
|
+
import { Icon } from './chunk-W7CHDHRV.js';
|
|
15
|
+
import { useControllable } from './chunk-MMRIQNEN.js';
|
|
16
|
+
import { Collapse } from './chunk-BA4ALXQW.js';
|
|
17
|
+
import './chunk-DMX2F6B4.js';
|
|
18
|
+
import './chunk-TFC5SCAB.js';
|
|
19
|
+
import './chunk-VNVVG47J.js';
|
|
20
|
+
import { UIMotion } from './chunk-WJEZWKEY.js';
|
|
15
21
|
import { cx } from './chunk-QGNC7LH5.js';
|
|
16
22
|
import './table.css';
|
|
17
|
-
import {
|
|
23
|
+
import { useRef, useState, useMemo, useEffect, useId, Fragment } from 'react';
|
|
24
|
+
import './table-detail.css';
|
|
18
25
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
19
26
|
|
|
20
|
-
var
|
|
27
|
+
var NONE_OPEN = [];
|
|
28
|
+
var DETAIL_MOTION = { duration: { close: "base" }, ease: { close: "exit" } };
|
|
29
|
+
var rowNameId = (id) => `${id}-n`;
|
|
30
|
+
function useExpanded(value, onChange, mode) {
|
|
31
|
+
const [open, setOpen] = useControllable(value, NONE_OPEN, onChange);
|
|
32
|
+
const toggle = (key) => setOpen(open.includes(key) ? open.filter((k) => k !== key) : mode === "single" ? [key] : [...open, key]);
|
|
33
|
+
return [open, toggle];
|
|
34
|
+
}
|
|
35
|
+
function DetailToggle({ id, open, size, onToggle }) {
|
|
36
|
+
return /* @__PURE__ */ jsx(
|
|
37
|
+
Button,
|
|
38
|
+
{
|
|
39
|
+
variant: "ghost",
|
|
40
|
+
size,
|
|
41
|
+
iconOnly: true,
|
|
42
|
+
className: "zc-tbl__toggle",
|
|
43
|
+
id: `${id}-t`,
|
|
44
|
+
"aria-label": "Details",
|
|
45
|
+
"aria-labelledby": `${id}-t ${rowNameId(id)}`,
|
|
46
|
+
"aria-expanded": open,
|
|
47
|
+
"aria-controls": `${id}-d`,
|
|
48
|
+
onClick: onToggle,
|
|
49
|
+
children: /* @__PURE__ */ jsx(Icon, { name: "caret-down" })
|
|
50
|
+
}
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
function DetailRow({ id, open, span, motion, onPointerEnter, children }) {
|
|
54
|
+
return /* @__PURE__ */ jsx(Motion, { as: "tr", ...motion, className: "zc-tbl__detail", onPointerEnter, children: /* @__PURE__ */ jsx("td", { colSpan: span, children: /* @__PURE__ */ jsx(Collapse, { open, animation: DETAIL_MOTION, htmlProps: { id: `${id}-d` }, children: /* @__PURE__ */ jsx("div", { className: "zc-tbl__detailBody", children }) }) }) });
|
|
55
|
+
}
|
|
56
|
+
var ROW_MOTION = {
|
|
57
|
+
layout: true,
|
|
58
|
+
layoutTransition: { timing: UIMotion.t.layout },
|
|
59
|
+
animate: { opacity: [0, 1], y: [UIMotion.dist.sm, 0], timing: UIMotion.t.enter },
|
|
60
|
+
exit: { opacity: [0], y: [UIMotion.dist.sm], timing: UIMotion.t.exit }
|
|
61
|
+
};
|
|
62
|
+
var PRESS_OWNERS = "a, button, input, select, textarea, label, tr";
|
|
63
|
+
function TableBody({
|
|
64
|
+
rows,
|
|
65
|
+
keyOf,
|
|
66
|
+
columns,
|
|
67
|
+
mods,
|
|
68
|
+
selectable,
|
|
69
|
+
selection,
|
|
70
|
+
selectionLabel,
|
|
71
|
+
checkCellCls,
|
|
72
|
+
checkSize,
|
|
73
|
+
toggleSize,
|
|
74
|
+
renderDetail,
|
|
75
|
+
expanded,
|
|
76
|
+
onExpandedChange,
|
|
77
|
+
expandMode,
|
|
78
|
+
loading,
|
|
79
|
+
empty,
|
|
80
|
+
onRowClick,
|
|
81
|
+
hoverRow,
|
|
82
|
+
leaveRows
|
|
83
|
+
}) {
|
|
84
|
+
const uid = useId();
|
|
85
|
+
const [openKeys, toggleDetail] = useExpanded(expanded, onExpandedChange, expandMode);
|
|
86
|
+
const colCount = columns.length + (selectable ? 1 : 0) + (renderDetail ? 1 : 0);
|
|
87
|
+
const showEmpty = !loading && rows.length === 0;
|
|
88
|
+
const enterRow = (e) => hoverRow(e.currentTarget);
|
|
89
|
+
const enterDetail = (e) => hoverRow(e.currentTarget.previousElementSibling);
|
|
90
|
+
function pressRow(e, row, detailKey) {
|
|
91
|
+
if (!(e.target instanceof Element) || e.target.closest(PRESS_OWNERS) !== e.currentTarget) return;
|
|
92
|
+
if (detailKey != null) toggleDetail(detailKey);
|
|
93
|
+
if (onRowClick) onRowClick(row);
|
|
94
|
+
}
|
|
95
|
+
return /* @__PURE__ */ jsx("tbody", { onPointerLeave: leaveRows, children: /* @__PURE__ */ jsxs(Presence, { initial: false, mode: showEmpty ? "wait" : "sync", children: [
|
|
96
|
+
showEmpty && /* @__PURE__ */ jsx(Motion, { as: "tr", ...ROW_MOTION, children: /* @__PURE__ */ jsx("td", { colSpan: colCount, className: "zc-tbl__emptyCell", children: empty != null ? empty : "Nothing to show" }) }, "empty"),
|
|
97
|
+
rows.map((row, idx) => {
|
|
98
|
+
const k = keyOf(row);
|
|
99
|
+
const isSel = selection.selected.has(k);
|
|
100
|
+
const detail = renderDetail ? renderDetail(row) : null;
|
|
101
|
+
const open = openKeys.includes(k);
|
|
102
|
+
const id = `${uid}${idx}`;
|
|
103
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
104
|
+
/* @__PURE__ */ jsxs(
|
|
105
|
+
Motion,
|
|
106
|
+
{
|
|
107
|
+
as: "tr",
|
|
108
|
+
...ROW_MOTION,
|
|
109
|
+
className: "zc-tbl__row",
|
|
110
|
+
"data-selected": isSel ? "" : void 0,
|
|
111
|
+
"data-expandable": detail ? "" : void 0,
|
|
112
|
+
onClick: onRowClick || detail ? (e) => pressRow(e, row, detail ? k : null) : void 0,
|
|
113
|
+
onPointerEnter: enterRow,
|
|
114
|
+
children: [
|
|
115
|
+
selectable ? /* @__PURE__ */ jsx("td", { className: checkCellCls, onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ jsx(
|
|
116
|
+
Checkbox,
|
|
117
|
+
{
|
|
118
|
+
className: "zc-tbl__cbx",
|
|
119
|
+
size: checkSize,
|
|
120
|
+
checked: isSel,
|
|
121
|
+
htmlProps: {
|
|
122
|
+
"aria-label": selectionLabel ? selectionLabel(row) : "Select row",
|
|
123
|
+
onClick: (e) => {
|
|
124
|
+
selection.shiftRef.current = e.shiftKey;
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
onChange: () => selection.toggleRow(idx)
|
|
128
|
+
}
|
|
129
|
+
) }) : null,
|
|
130
|
+
columns.map((c, i) => /* @__PURE__ */ jsx(
|
|
131
|
+
"td",
|
|
132
|
+
{
|
|
133
|
+
id: detail && i === 0 ? rowNameId(id) : void 0,
|
|
134
|
+
className: mods(c, i).concat(c.mono ? ["zc-tbl__cell--mono"] : []).concat(c.strong ? ["zc-tbl__cell--strong"] : []).join(" "),
|
|
135
|
+
children: c.render ? c.render(row) : row[c.key]
|
|
136
|
+
},
|
|
137
|
+
c.key
|
|
138
|
+
)),
|
|
139
|
+
renderDetail ? /* @__PURE__ */ jsx("td", { className: "zc-tbl__cell--toggle", children: detail ? /* @__PURE__ */ jsx(DetailToggle, { id, open, size: toggleSize, onToggle: () => toggleDetail(k) }) : null }) : null
|
|
140
|
+
]
|
|
141
|
+
}
|
|
142
|
+
),
|
|
143
|
+
detail ? /* @__PURE__ */ jsx(DetailRow, { id, open, span: colCount, motion: ROW_MOTION, onPointerEnter: enterDetail, children: detail }) : null
|
|
144
|
+
] }, k);
|
|
145
|
+
})
|
|
146
|
+
] }) });
|
|
147
|
+
}
|
|
148
|
+
function cellMods(col, i, pinFirst, selectable) {
|
|
149
|
+
const a = [];
|
|
150
|
+
if (col.align === "end") a.push("zc-tbl__cell--end");
|
|
151
|
+
if (col.align === "center") a.push("zc-tbl__cell--center");
|
|
152
|
+
if (col.grow) a.push("zc-tbl__cell--grow");
|
|
153
|
+
if (col.hideBelow) a.push("zc-tbl__cell--hide-" + col.hideBelow);
|
|
154
|
+
if (pinFirst && i === 0) {
|
|
155
|
+
a.push("zc-tbl__cell--pin", "zc-tbl__cell--pinEdge");
|
|
156
|
+
if (selectable) a.push("zc-tbl__cell--pinOff");
|
|
157
|
+
}
|
|
158
|
+
return a;
|
|
159
|
+
}
|
|
160
|
+
function TableHead({
|
|
161
|
+
columns,
|
|
162
|
+
sort,
|
|
163
|
+
onSort,
|
|
164
|
+
activateOn,
|
|
165
|
+
mods,
|
|
166
|
+
selectAll,
|
|
167
|
+
checkCellCls,
|
|
168
|
+
toggleColumn
|
|
169
|
+
}) {
|
|
170
|
+
return /* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { children: [
|
|
171
|
+
selectAll ? /* @__PURE__ */ jsx("th", { scope: "col", className: checkCellCls, children: selectAll }) : null,
|
|
172
|
+
columns.map((c, i) => {
|
|
173
|
+
const active = sort && sort.key === c.key;
|
|
174
|
+
const cls = (c.sortable ? ["zc-tbl__cell--sortable"] : []).concat(mods(c, i));
|
|
175
|
+
return /* @__PURE__ */ jsx(
|
|
176
|
+
"th",
|
|
177
|
+
{
|
|
178
|
+
scope: "col",
|
|
179
|
+
className: cls.join(" "),
|
|
180
|
+
style: c.width ? { width: c.width } : void 0,
|
|
181
|
+
"aria-sort": active ? sort.dir === "asc" ? "ascending" : "descending" : void 0,
|
|
182
|
+
children: c.sortable ? /* @__PURE__ */ jsxs(
|
|
183
|
+
"button",
|
|
184
|
+
{
|
|
185
|
+
type: "button",
|
|
186
|
+
className: "zc-tbl__sort",
|
|
187
|
+
...activationProps(() => onSort(c), { on: activateOn }),
|
|
188
|
+
children: [
|
|
189
|
+
/* @__PURE__ */ jsx("span", { className: "zc-tbl__sortLbl", children: c.label }),
|
|
190
|
+
/* @__PURE__ */ jsx(
|
|
191
|
+
"span",
|
|
192
|
+
{
|
|
193
|
+
className: "zc-tbl__sortIcon" + (active ? " zc-is-on" : "") + (active && sort.dir === "desc" ? " zc-is-desc" : ""),
|
|
194
|
+
"aria-hidden": "true",
|
|
195
|
+
children: /* @__PURE__ */ jsx(Icon, { name: "arrow-up", size: "sm" })
|
|
196
|
+
}
|
|
197
|
+
)
|
|
198
|
+
]
|
|
199
|
+
}
|
|
200
|
+
) : c.label != null ? /* @__PURE__ */ jsx("span", { className: "zc-tbl__hLbl", children: c.label }) : null
|
|
201
|
+
},
|
|
202
|
+
c.key
|
|
203
|
+
);
|
|
204
|
+
}),
|
|
205
|
+
toggleColumn ? /* @__PURE__ */ jsx("th", { scope: "col", className: "zc-tbl__cell--toggle" }) : null
|
|
206
|
+
] }) });
|
|
207
|
+
}
|
|
208
|
+
function useRowGlide(scrollRef) {
|
|
209
|
+
const tableRef = useRef(null);
|
|
210
|
+
const hoveredRef = useRef(null);
|
|
211
|
+
const glide = useGlide(scrollRef);
|
|
212
|
+
useEffect(() => {
|
|
213
|
+
const table = tableRef.current;
|
|
214
|
+
if (!table) return void 0;
|
|
215
|
+
const follow = new ResizeObserver(() => glide.enter(hoveredRef.current));
|
|
216
|
+
follow.observe(table);
|
|
217
|
+
return () => follow.disconnect();
|
|
218
|
+
}, [glide]);
|
|
219
|
+
function hoverRow(row) {
|
|
220
|
+
hoveredRef.current = row instanceof HTMLElement ? row : null;
|
|
221
|
+
glide.enter(hoveredRef.current);
|
|
222
|
+
}
|
|
223
|
+
function leaveRows() {
|
|
224
|
+
hoveredRef.current = null;
|
|
225
|
+
glide.leave();
|
|
226
|
+
}
|
|
227
|
+
return { tableRef, glide, hoverRow, leaveRows };
|
|
228
|
+
}
|
|
229
|
+
function useEdgeAttributes(scrollRef, wrapRef) {
|
|
230
|
+
useScrollEdges(
|
|
231
|
+
scrollRef,
|
|
232
|
+
(edges, el) => {
|
|
233
|
+
const w = wrapRef.current;
|
|
234
|
+
if (!w) return;
|
|
235
|
+
const set = (attr, on) => {
|
|
236
|
+
if (on) w.setAttribute(attr, "");
|
|
237
|
+
else w.removeAttribute(attr);
|
|
238
|
+
};
|
|
239
|
+
set("data-scrolled", el.scrollTop > 0);
|
|
240
|
+
set("data-y-scroll", el.scrollHeight > el.clientHeight);
|
|
241
|
+
set("data-x-back", edges.left);
|
|
242
|
+
set("data-x-more", edges.right);
|
|
243
|
+
},
|
|
244
|
+
{ content: true }
|
|
245
|
+
);
|
|
246
|
+
}
|
|
21
247
|
function tblCompare(a, b) {
|
|
22
248
|
if (a == null && b == null) return 0;
|
|
23
249
|
if (a == null) return 1;
|
|
@@ -25,35 +251,8 @@ function tblCompare(a, b) {
|
|
|
25
251
|
if (typeof a === "number" && typeof b === "number") return a - b;
|
|
26
252
|
return String(a).localeCompare(String(b), void 0, { numeric: true, sensitivity: "base" });
|
|
27
253
|
}
|
|
28
|
-
function
|
|
29
|
-
columns = [],
|
|
30
|
-
rows = [],
|
|
31
|
-
rowKey = "id",
|
|
32
|
-
ariaLabel,
|
|
33
|
-
selectable = false,
|
|
34
|
-
onSelectionChange,
|
|
35
|
-
bulkActions,
|
|
36
|
-
selectionLabel,
|
|
37
|
-
defaultSort = null,
|
|
38
|
-
onSortChange,
|
|
39
|
-
density = "cozy",
|
|
40
|
-
pinFirst = true,
|
|
41
|
-
loading = false,
|
|
42
|
-
empty,
|
|
43
|
-
footer,
|
|
44
|
-
onRowClick,
|
|
45
|
-
activateOn = "pointerdown",
|
|
46
|
-
className = "",
|
|
47
|
-
htmlProps
|
|
48
|
-
}) {
|
|
254
|
+
function useSort(rows, columns, defaultSort, onSortChange) {
|
|
49
255
|
const [sort, setSort] = useState(defaultSort);
|
|
50
|
-
const [selected, setSelected] = useState(() => /* @__PURE__ */ new Set());
|
|
51
|
-
const wrapRef = useRef(null);
|
|
52
|
-
const scrollRef = useRef(null);
|
|
53
|
-
const lastIdxRef = useRef(-1);
|
|
54
|
-
const shiftRef = useRef(false);
|
|
55
|
-
const lastCountRef = useRef(0);
|
|
56
|
-
const keyOf = (row) => row[rowKey];
|
|
57
256
|
const sortedRows = useMemo(() => {
|
|
58
257
|
if (!sort) return rows;
|
|
59
258
|
const col = columns.find((c) => c.key === sort.key);
|
|
@@ -67,7 +266,13 @@ function Table({
|
|
|
67
266
|
setSort(next);
|
|
68
267
|
if (onSortChange) onSortChange(next);
|
|
69
268
|
}
|
|
70
|
-
|
|
269
|
+
return { sort, sortedRows, cycleSort };
|
|
270
|
+
}
|
|
271
|
+
function useSelection(rows, keyOf, onSelectionChange) {
|
|
272
|
+
const [selected, setSelected] = useState(() => /* @__PURE__ */ new Set());
|
|
273
|
+
const lastIdxRef = useRef(-1);
|
|
274
|
+
const shiftRef = useRef(false);
|
|
275
|
+
const allSelected = rows.length > 0 && rows.every((r) => selected.has(keyOf(r)));
|
|
71
276
|
const someSelected = selected.size > 0 && !allSelected;
|
|
72
277
|
function commitSelection(next) {
|
|
73
278
|
setSelected(next);
|
|
@@ -79,61 +284,69 @@ function Table({
|
|
|
79
284
|
}
|
|
80
285
|
function toggleAll() {
|
|
81
286
|
const next = /* @__PURE__ */ new Set();
|
|
82
|
-
if (!allSelected)
|
|
287
|
+
if (!allSelected) rows.forEach((r) => next.add(keyOf(r)));
|
|
83
288
|
commitSelection(next);
|
|
84
289
|
}
|
|
85
290
|
function toggleRow(idx) {
|
|
86
291
|
const next = new Set(selected);
|
|
87
|
-
const on = !next.has(keyOf(
|
|
292
|
+
const on = !next.has(keyOf(rows[idx]));
|
|
88
293
|
if (shiftRef.current && lastIdxRef.current >= 0 && lastIdxRef.current !== idx) {
|
|
89
294
|
const lo = Math.min(lastIdxRef.current, idx);
|
|
90
295
|
const hi = Math.max(lastIdxRef.current, idx);
|
|
91
296
|
for (let i = lo; i <= hi; i++) {
|
|
92
|
-
const k = keyOf(
|
|
297
|
+
const k = keyOf(rows[i]);
|
|
93
298
|
if (on) next.add(k);
|
|
94
299
|
else next.delete(k);
|
|
95
300
|
}
|
|
96
301
|
} else if (on) {
|
|
97
|
-
next.add(keyOf(
|
|
302
|
+
next.add(keyOf(rows[idx]));
|
|
98
303
|
} else {
|
|
99
|
-
next.delete(keyOf(
|
|
304
|
+
next.delete(keyOf(rows[idx]));
|
|
100
305
|
}
|
|
101
306
|
lastIdxRef.current = idx;
|
|
102
307
|
shiftRef.current = false;
|
|
103
308
|
commitSelection(next);
|
|
104
309
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
}
|
|
133
|
-
const
|
|
134
|
-
const
|
|
310
|
+
return { selected, allSelected, someSelected, shiftRef, clearSelection, toggleAll, toggleRow };
|
|
311
|
+
}
|
|
312
|
+
function Table({
|
|
313
|
+
columns = [],
|
|
314
|
+
rows = [],
|
|
315
|
+
rowKey = "id",
|
|
316
|
+
ariaLabel,
|
|
317
|
+
selectable = false,
|
|
318
|
+
onSelectionChange,
|
|
319
|
+
bulkActions,
|
|
320
|
+
selectionLabel,
|
|
321
|
+
defaultSort = null,
|
|
322
|
+
onSortChange,
|
|
323
|
+
renderDetail,
|
|
324
|
+
expanded,
|
|
325
|
+
onExpandedChange,
|
|
326
|
+
expandMode = "multiple",
|
|
327
|
+
density = "cozy",
|
|
328
|
+
pinFirst = true,
|
|
329
|
+
loading = false,
|
|
330
|
+
empty,
|
|
331
|
+
footer,
|
|
332
|
+
onRowClick,
|
|
333
|
+
activateOn = "pointerdown",
|
|
334
|
+
className = "",
|
|
335
|
+
htmlProps
|
|
336
|
+
}) {
|
|
337
|
+
const { sort, sortedRows, cycleSort } = useSort(rows, columns, defaultSort, onSortChange);
|
|
338
|
+
const keyOf = (row) => row[rowKey];
|
|
339
|
+
const selection = useSelection(sortedRows, keyOf, onSelectionChange);
|
|
340
|
+
const { selected, allSelected, someSelected, toggleAll, clearSelection } = selection;
|
|
341
|
+
const wrapRef = useRef(null);
|
|
342
|
+
const scrollRef = useRef(null);
|
|
343
|
+
const lastCountRef = useRef(0);
|
|
344
|
+
const { tableRef, glide, hoverRow, leaveRows } = useRowGlide(scrollRef);
|
|
345
|
+
useEdgeAttributes(scrollRef, wrapRef);
|
|
346
|
+
const mods = (c, i) => cellMods(c, i, pinFirst, selectable);
|
|
135
347
|
const checkCellCls = "zc-tbl__cell--check" + (pinFirst ? " zc-tbl__cell--pin" : "");
|
|
136
348
|
const checkSize = density === "compact" ? "sm" : "md";
|
|
349
|
+
const toggleSize = density === "compact" ? "xs" : "sm";
|
|
137
350
|
const bulkOpen = selectable && selected.size > 0;
|
|
138
351
|
if (selected.size > 0) lastCountRef.current = selected.size;
|
|
139
352
|
const rootCls = cx(
|
|
@@ -142,8 +355,20 @@ function Table({
|
|
|
142
355
|
pinFirst && "zc-tbl--pin",
|
|
143
356
|
loading && "zc-tbl--loading",
|
|
144
357
|
onRowClick && "zc-tbl--clickable",
|
|
358
|
+
columns.some((c) => c.width) && columns.some((c) => c.grow) && "zc-tbl--shares",
|
|
145
359
|
className
|
|
146
360
|
);
|
|
361
|
+
const selectAll = selectable ? /* @__PURE__ */ jsx(
|
|
362
|
+
Checkbox,
|
|
363
|
+
{
|
|
364
|
+
className: "zc-tbl__cbx",
|
|
365
|
+
size: checkSize,
|
|
366
|
+
checked: allSelected,
|
|
367
|
+
indeterminate: someSelected,
|
|
368
|
+
htmlProps: { "aria-label": "Select all rows" },
|
|
369
|
+
onChange: toggleAll
|
|
370
|
+
}
|
|
371
|
+
) : null;
|
|
147
372
|
return /* @__PURE__ */ jsxs("div", { ref: wrapRef, className: rootCls, ...htmlProps, children: [
|
|
148
373
|
selectable ? /* @__PURE__ */ jsxs(
|
|
149
374
|
"div",
|
|
@@ -154,17 +379,7 @@ function Table({
|
|
|
154
379
|
role: "toolbar",
|
|
155
380
|
"aria-label": "Selection actions",
|
|
156
381
|
children: [
|
|
157
|
-
|
|
158
|
-
Checkbox,
|
|
159
|
-
{
|
|
160
|
-
className: "zc-tbl__cbx",
|
|
161
|
-
size: checkSize,
|
|
162
|
-
checked: allSelected,
|
|
163
|
-
indeterminate: someSelected,
|
|
164
|
-
htmlProps: { "aria-label": "Select all rows" },
|
|
165
|
-
onChange: toggleAll
|
|
166
|
-
}
|
|
167
|
-
),
|
|
382
|
+
selectAll,
|
|
168
383
|
/* @__PURE__ */ jsxs("span", { className: "zc-tbl__bulkCount", "aria-live": "polite", "aria-atomic": "true", children: [
|
|
169
384
|
/* @__PURE__ */ jsx(DigitStrip, { value: bulkOpen ? selected.size : lastCountRef.current }),
|
|
170
385
|
/* @__PURE__ */ jsx("span", { children: " selected" })
|
|
@@ -176,94 +391,48 @@ function Table({
|
|
|
176
391
|
}
|
|
177
392
|
) : null,
|
|
178
393
|
/* @__PURE__ */ jsxs("div", { className: "zc-tbl__viewport", children: [
|
|
179
|
-
/* @__PURE__ */
|
|
180
|
-
/* @__PURE__ */
|
|
181
|
-
|
|
182
|
-
|
|
394
|
+
/* @__PURE__ */ jsxs("div", { className: "zc-tbl__scroll", ref: scrollRef, children: [
|
|
395
|
+
/* @__PURE__ */ jsxs("table", { ref: tableRef, className: "zc-tbl__table", "aria-label": ariaLabel, "aria-busy": loading || void 0, children: [
|
|
396
|
+
/* @__PURE__ */ jsx(
|
|
397
|
+
TableHead,
|
|
183
398
|
{
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
399
|
+
columns,
|
|
400
|
+
sort,
|
|
401
|
+
onSort: cycleSort,
|
|
402
|
+
activateOn,
|
|
403
|
+
mods,
|
|
404
|
+
selectAll,
|
|
405
|
+
checkCellCls,
|
|
406
|
+
toggleColumn: !!renderDetail
|
|
190
407
|
}
|
|
191
|
-
)
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
const cls = (c.sortable ? ["zc-tbl__cell--sortable"] : []).concat(cellMods(c, i));
|
|
195
|
-
return /* @__PURE__ */ jsx(
|
|
196
|
-
"th",
|
|
197
|
-
{
|
|
198
|
-
scope: "col",
|
|
199
|
-
className: cls.join(" "),
|
|
200
|
-
"aria-sort": active ? sort.dir === "asc" ? "ascending" : "descending" : void 0,
|
|
201
|
-
children: c.sortable ? /* @__PURE__ */ jsxs(
|
|
202
|
-
"button",
|
|
203
|
-
{
|
|
204
|
-
type: "button",
|
|
205
|
-
className: "zc-tbl__sort",
|
|
206
|
-
...activationProps(() => cycleSort(c), { on: activateOn }),
|
|
207
|
-
children: [
|
|
208
|
-
/* @__PURE__ */ jsx("span", { className: "zc-tbl__sortLbl", children: c.label }),
|
|
209
|
-
/* @__PURE__ */ jsx(
|
|
210
|
-
"span",
|
|
211
|
-
{
|
|
212
|
-
className: "zc-tbl__sortIcon" + (active ? " zc-is-on" : "") + (active && sort.dir === "desc" ? " zc-is-desc" : ""),
|
|
213
|
-
"aria-hidden": "true",
|
|
214
|
-
children: /* @__PURE__ */ jsx(Icon, { name: "arrow-up", size: "sm" })
|
|
215
|
-
}
|
|
216
|
-
)
|
|
217
|
-
]
|
|
218
|
-
}
|
|
219
|
-
) : c.label != null ? /* @__PURE__ */ jsx("span", { className: "zc-tbl__hLbl", children: c.label }) : null
|
|
220
|
-
},
|
|
221
|
-
c.key
|
|
222
|
-
);
|
|
223
|
-
})
|
|
224
|
-
] }) }),
|
|
225
|
-
/* @__PURE__ */ jsx("tbody", { children: showEmpty ? /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", { colSpan: colCount, className: "zc-tbl__emptyCell", children: empty != null ? empty : "Nothing to show" }) }) : sortedRows.map((row, idx) => {
|
|
226
|
-
const k = keyOf(row);
|
|
227
|
-
const isSel = selected.has(k);
|
|
228
|
-
return /* @__PURE__ */ jsxs(
|
|
229
|
-
Motion,
|
|
408
|
+
),
|
|
409
|
+
/* @__PURE__ */ jsx(
|
|
410
|
+
TableBody,
|
|
230
411
|
{
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
{
|
|
256
|
-
className: cellMods(c, i).concat(c.mono ? ["zc-tbl__cell--mono"] : []).concat(c.strong ? ["zc-tbl__cell--strong"] : []).join(" "),
|
|
257
|
-
children: c.render ? c.render(row) : row[c.key]
|
|
258
|
-
},
|
|
259
|
-
c.key
|
|
260
|
-
))
|
|
261
|
-
]
|
|
262
|
-
},
|
|
263
|
-
k
|
|
264
|
-
);
|
|
265
|
-
}) })
|
|
266
|
-
] }) }),
|
|
412
|
+
rows: sortedRows,
|
|
413
|
+
keyOf,
|
|
414
|
+
columns,
|
|
415
|
+
mods,
|
|
416
|
+
selectable,
|
|
417
|
+
selection,
|
|
418
|
+
selectionLabel,
|
|
419
|
+
checkCellCls,
|
|
420
|
+
checkSize,
|
|
421
|
+
toggleSize,
|
|
422
|
+
renderDetail,
|
|
423
|
+
expanded,
|
|
424
|
+
onExpandedChange,
|
|
425
|
+
expandMode,
|
|
426
|
+
loading,
|
|
427
|
+
empty,
|
|
428
|
+
onRowClick,
|
|
429
|
+
hoverRow,
|
|
430
|
+
leaveRows
|
|
431
|
+
}
|
|
432
|
+
)
|
|
433
|
+
] }),
|
|
434
|
+
/* @__PURE__ */ jsx(GlidePill, { className: "zc-tbl__glide", glide })
|
|
435
|
+
] }),
|
|
267
436
|
/* @__PURE__ */ jsx("div", { className: "zc-tbl__edge zc-tbl__edge--l", "aria-hidden": "true" }),
|
|
268
437
|
/* @__PURE__ */ jsx("div", { className: "zc-tbl__edge zc-tbl__edge--r", "aria-hidden": "true" })
|
|
269
438
|
] }),
|