@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,28 @@
|
|
|
1
|
+
# ScrollArea - @zyncat/ui/scroll-area
|
|
2
|
+
|
|
3
|
+
Group: data-display
|
|
4
|
+
Docs: https://ui.zyncat.app/scroll-area
|
|
5
|
+
|
|
6
|
+
One-axis scroller with no scrollbar: an edge fades only while content hides past it, and an x rail pages from its edges - keep overflow: auto for a visible bar or two axes.
|
|
7
|
+
|
|
8
|
+
axis y|x, variant fade|depth, fill (x only), ariaLabel, activateOn pointerdown|click, and ref to the
|
|
9
|
+
element that scrolls. The fades follow resizes and added items on their own. A y scroller needs a
|
|
10
|
+
bounded height - height or max-height on style or className, or flex: 1 inside a bounded flex column,
|
|
11
|
+
since the root already carries min-height: 0.
|
|
12
|
+
An x rail shows a door on each faded edge while a fine pointer hovers it; each pages by the viewport
|
|
13
|
+
less both fades, so nothing under a fade is skipped, and scrolls smoothly unless reduced motion is
|
|
14
|
+
on. The doors are aria-hidden: touch and the keyboard scroll natively.
|
|
15
|
+
The scroller joins the Tab order only while it overflows, its focus ring drawn on the root, and a
|
|
16
|
+
child focused from the keyboard scrolls in clear of the fades. variant depth is a CSS scroll-driven
|
|
17
|
+
animation, skipped under reduced motion and where animation-timeline is unsupported.
|
|
18
|
+
Retune on the root: --scroll-area-fade (fade depth, default --space-7), --scroll-area-gap (between
|
|
19
|
+
rail items, --space-3), --scroll-area-depth (scale at the edge, 0.86).
|
|
20
|
+
|
|
21
|
+
```tsx
|
|
22
|
+
<ScrollArea ariaLabel="Recent activity" style={{ maxHeight: 320 }}>
|
|
23
|
+
{events.map((event) => <div key={event.id}>{event.title}</div>)}
|
|
24
|
+
</ScrollArea>
|
|
25
|
+
<ScrollArea axis="x" ariaLabel="Media library">
|
|
26
|
+
{media.map((item) => <img key={item.id} src={item.thumbUrl} alt={item.alt} width={160} />)}
|
|
27
|
+
</ScrollArea>
|
|
28
|
+
```
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
@layer zyncat.reset, zyncat.tokens, zyncat.base, zyncat.components;
|
|
2
|
+
|
|
3
|
+
@property --_scroll-area-from {
|
|
4
|
+
syntax: '<length>';
|
|
5
|
+
inherits: false;
|
|
6
|
+
initial-value: 0;
|
|
7
|
+
}
|
|
8
|
+
@property --_scroll-area-to {
|
|
9
|
+
syntax: '<length>';
|
|
10
|
+
inherits: false;
|
|
11
|
+
initial-value: 0;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
@layer zyncat.components {
|
|
15
|
+
.zc-scroll-area {
|
|
16
|
+
--scroll-area-fade: var(--space-7);
|
|
17
|
+
--scroll-area-gap: var(--space-3);
|
|
18
|
+
--scroll-area-depth: 0.86;
|
|
19
|
+
--_scroll-area-dir: to bottom;
|
|
20
|
+
position: relative;
|
|
21
|
+
display: flex;
|
|
22
|
+
min-width: 0;
|
|
23
|
+
min-height: 0;
|
|
24
|
+
border-radius: var(--radius-md);
|
|
25
|
+
}
|
|
26
|
+
.zc-scroll-area--x {
|
|
27
|
+
--_scroll-area-dir: to right;
|
|
28
|
+
}
|
|
29
|
+
.zc-scroll-area:has(> .zc-scroll-area__viewport:focus-visible) {
|
|
30
|
+
outline: var(--ring-accent);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.zc-scroll-area__viewport {
|
|
34
|
+
flex: 1;
|
|
35
|
+
overflow: hidden auto;
|
|
36
|
+
padding: var(--ring-gutter);
|
|
37
|
+
scroll-padding-block: var(--_scroll-area-from) var(--_scroll-area-to);
|
|
38
|
+
scroll-padding-inline: var(--_scroll-area-from) var(--_scroll-area-to);
|
|
39
|
+
scrollbar-width: none;
|
|
40
|
+
outline: none;
|
|
41
|
+
mask-image: linear-gradient(
|
|
42
|
+
var(--_scroll-area-dir),
|
|
43
|
+
transparent,
|
|
44
|
+
black var(--_scroll-area-from),
|
|
45
|
+
black calc(100% - var(--_scroll-area-to)),
|
|
46
|
+
transparent
|
|
47
|
+
);
|
|
48
|
+
transition:
|
|
49
|
+
--_scroll-area-from var(--duration-base) var(--ease-standard),
|
|
50
|
+
--_scroll-area-to var(--duration-base) var(--ease-standard);
|
|
51
|
+
}
|
|
52
|
+
.zc-scroll-area__viewport::-webkit-scrollbar {
|
|
53
|
+
display: none;
|
|
54
|
+
}
|
|
55
|
+
.zc-scroll-area__viewport[data-edges~='start'] {
|
|
56
|
+
--_scroll-area-from: var(--scroll-area-fade);
|
|
57
|
+
}
|
|
58
|
+
.zc-scroll-area__viewport[data-edges~='end'] {
|
|
59
|
+
--_scroll-area-to: var(--scroll-area-fade);
|
|
60
|
+
}
|
|
61
|
+
.zc-scroll-area--x > .zc-scroll-area__viewport {
|
|
62
|
+
overflow: auto hidden;
|
|
63
|
+
overscroll-behavior-x: contain;
|
|
64
|
+
}
|
|
65
|
+
.zc-scroll-area--x > .zc-scroll-area__viewport > .zc-scroll-area__content {
|
|
66
|
+
display: flex;
|
|
67
|
+
gap: var(--scroll-area-gap);
|
|
68
|
+
width: max-content;
|
|
69
|
+
}
|
|
70
|
+
.zc-scroll-area--fill > .zc-scroll-area__viewport {
|
|
71
|
+
display: flex;
|
|
72
|
+
gap: var(--scroll-area-gap);
|
|
73
|
+
}
|
|
74
|
+
.zc-scroll-area--fill > .zc-scroll-area__viewport > .zc-scroll-area__content {
|
|
75
|
+
display: contents;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.zc-scroll-area__door {
|
|
79
|
+
--_scroll-area-nudge: calc(var(--space-2) * -1);
|
|
80
|
+
position: absolute;
|
|
81
|
+
inset-block: 0;
|
|
82
|
+
left: 0;
|
|
83
|
+
display: flex;
|
|
84
|
+
align-items: center;
|
|
85
|
+
justify-content: center;
|
|
86
|
+
width: var(--scroll-area-fade);
|
|
87
|
+
opacity: 0;
|
|
88
|
+
pointer-events: none;
|
|
89
|
+
cursor: pointer;
|
|
90
|
+
transition: opacity var(--duration-fast) var(--ease-standard);
|
|
91
|
+
}
|
|
92
|
+
.zc-scroll-area__door[data-side='end'] {
|
|
93
|
+
--_scroll-area-nudge: var(--space-2);
|
|
94
|
+
left: auto;
|
|
95
|
+
right: 0;
|
|
96
|
+
}
|
|
97
|
+
.zc-scroll-area__chip {
|
|
98
|
+
display: grid;
|
|
99
|
+
place-items: center;
|
|
100
|
+
width: var(--control-height-xs);
|
|
101
|
+
height: var(--control-height-xs);
|
|
102
|
+
border: var(--border-hairline) solid var(--border-default);
|
|
103
|
+
border-radius: var(--radius-full);
|
|
104
|
+
background: var(--bg-surface);
|
|
105
|
+
box-shadow: var(--shadow-sm);
|
|
106
|
+
color: var(--text-body);
|
|
107
|
+
transform: translateX(var(--_scroll-area-nudge));
|
|
108
|
+
transition:
|
|
109
|
+
transform var(--duration-base) var(--ease-standard),
|
|
110
|
+
color var(--duration-fast) var(--ease-standard),
|
|
111
|
+
box-shadow var(--duration-fast) var(--ease-standard);
|
|
112
|
+
}
|
|
113
|
+
@media (hover: hover) and (pointer: fine) {
|
|
114
|
+
.zc-scroll-area:hover > .zc-scroll-area__viewport[data-edges~='start'] ~ .zc-scroll-area__door[data-side='start'],
|
|
115
|
+
.zc-scroll-area:hover > .zc-scroll-area__viewport[data-edges~='end'] ~ .zc-scroll-area__door[data-side='end'] {
|
|
116
|
+
--_scroll-area-nudge: 0;
|
|
117
|
+
opacity: 1;
|
|
118
|
+
pointer-events: auto;
|
|
119
|
+
}
|
|
120
|
+
.zc-scroll-area__door:hover > .zc-scroll-area__chip {
|
|
121
|
+
color: var(--text-strong);
|
|
122
|
+
box-shadow: var(--shadow-md);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
@supports (animation-timeline: view()) {
|
|
127
|
+
.zc-scroll-area--depth > .zc-scroll-area__viewport > .zc-scroll-area__content > * {
|
|
128
|
+
animation-name: zc-scroll-area-depth, zc-scroll-area-depth;
|
|
129
|
+
animation-duration: auto;
|
|
130
|
+
animation-timing-function: linear;
|
|
131
|
+
animation-direction: normal, reverse;
|
|
132
|
+
animation-fill-mode: backwards, forwards;
|
|
133
|
+
animation-timeline: view(y);
|
|
134
|
+
animation-range: entry, exit;
|
|
135
|
+
}
|
|
136
|
+
.zc-scroll-area--depth.zc-scroll-area--x > .zc-scroll-area__viewport > .zc-scroll-area__content > * {
|
|
137
|
+
animation-timeline: view(x);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
@keyframes zc-scroll-area-depth {
|
|
141
|
+
from {
|
|
142
|
+
transform: scale(var(--scroll-area-depth));
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
@media (prefers-reduced-motion: reduce) {
|
|
146
|
+
.zc-scroll-area--depth > .zc-scroll-area__viewport > .zc-scroll-area__content > * {
|
|
147
|
+
animation: none;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
@@ -7,12 +7,24 @@ import type { HTMLAttributes, ReactNode } from 'react';
|
|
|
7
7
|
import type { DataAttributes } from '../../../dom-props';
|
|
8
8
|
import type { DisableableAnimation } from '../../../motion/timing';
|
|
9
9
|
import { useControllable } from '../../internal/hooks/use-controllable';
|
|
10
|
+
import type { MenuSize, MenuWeight, MenuWidth } from '../../internal/menu/highlight';
|
|
10
11
|
import type { ActivateOn } from '../../internal/utils/activation';
|
|
11
12
|
import { cx } from '../../internal/utils/cx';
|
|
12
13
|
import { CheckGlyph } from '../../primitives/checkbox/check-glyph';
|
|
13
|
-
import {
|
|
14
|
+
import { SwitchGlyph } from '../../primitives/toggle/switch-glyph';
|
|
15
|
+
import {
|
|
16
|
+
ListboxPanel,
|
|
17
|
+
SelectTrigger,
|
|
18
|
+
useListbox,
|
|
19
|
+
type CustomTrigger,
|
|
20
|
+
type SelectGroup,
|
|
21
|
+
type SelectMenuHtmlProps,
|
|
22
|
+
type SelectOption,
|
|
23
|
+
} from './core';
|
|
24
|
+
import { PresetRow, type MultiSelectPreset } from './presets';
|
|
14
25
|
|
|
15
26
|
export type { SelectOption, SelectGroup } from './core';
|
|
27
|
+
export type { MultiSelectPreset } from './presets';
|
|
16
28
|
|
|
17
29
|
export interface MultiSelectProps {
|
|
18
30
|
/** The choices - a flat `SelectOption[]`, or `SelectGroup[]` to render labeled sections. @default [] */
|
|
@@ -21,12 +33,28 @@ export interface MultiSelectProps {
|
|
|
21
33
|
value?: string[];
|
|
22
34
|
/** Initial selection when uncontrolled. @default [] */
|
|
23
35
|
defaultValue?: string[];
|
|
24
|
-
/** Fires with the NEXT array and the option that was toggled
|
|
25
|
-
|
|
36
|
+
/** Fires with the NEXT array and the option that was toggled, or no option when a preset replaced
|
|
37
|
+
* the selection. Committing keeps the menu open. */
|
|
38
|
+
onChange?: (value: string[], toggled?: SelectOption) => void;
|
|
39
|
+
/** One-press selections, shown as chips between the filter field and the list. A press replaces
|
|
40
|
+
* the selection with the preset's `value` as given and keeps the menu open. @default [] */
|
|
41
|
+
presets?: MultiSelectPreset[];
|
|
26
42
|
/** Trigger text when nothing is selected. @default 'Select options' */
|
|
27
43
|
placeholder?: string;
|
|
28
|
-
/**
|
|
44
|
+
/** Trigger height, type and padding. The menu follows it unless `menuSize` overrides. @default 'md' */
|
|
29
45
|
size?: 'sm' | 'md' | 'lg';
|
|
46
|
+
/** Menu density on its own - row type, row padding, the filter field and the row checkbox. A row
|
|
47
|
+
* carrying a description sits one step taller than a plain one at every step. @default the `size` value */
|
|
48
|
+
menuSize?: MenuSize;
|
|
49
|
+
/** Weight of every option label in the menu. @default 'medium' */
|
|
50
|
+
weight?: MenuWeight;
|
|
51
|
+
/** Glyph mirroring each option's selected state at the trailing edge: a checkbox, or a switch for a
|
|
52
|
+
* settings-style menu where every option is an independent on/off. Decoration only - the option
|
|
53
|
+
* semantics are the same either way. @default 'checkbox' */
|
|
54
|
+
marker?: 'checkbox' | 'switch';
|
|
55
|
+
/** Menu width. `trigger` is never narrower than the trigger, `auto` fits the options, and
|
|
56
|
+
* `sm` | `md` | `lg` are fixed steps with long labels ellipsizing. @default 'trigger' */
|
|
57
|
+
width?: MenuWidth;
|
|
30
58
|
/** Disabled - trigger is inert and the menu cannot open. @default false */
|
|
31
59
|
disabled?: boolean;
|
|
32
60
|
/** Danger ring + border. @default false */
|
|
@@ -50,16 +78,32 @@ export interface MultiSelectProps {
|
|
|
50
78
|
ariaLabel?: string;
|
|
51
79
|
/** Standard <div> attributes (className, style, data-*, ...) forwarded to the select root. */
|
|
52
80
|
htmlProps?: HTMLAttributes<HTMLDivElement> & DataAttributes;
|
|
81
|
+
/** Standard attributes (className, style, data-*, ...) forwarded to the menu panel, which portals
|
|
82
|
+
* to <body> and inherits nothing from the root. */
|
|
83
|
+
menuProps?: SelectMenuHtmlProps;
|
|
53
84
|
/** Whether the trigger and the options fire on `pointerdown` (snappier) or wait for `click`.
|
|
54
85
|
* @default 'pointerdown' */
|
|
55
86
|
activateOn?: ActivateOn;
|
|
56
87
|
/** Menu open/close timing - motion tokens only, or `null` to disable. @default duration 'base' + ease 'entrance'/'exit' */
|
|
57
88
|
animation?: DisableableAnimation;
|
|
89
|
+
/** Your own element in place of the built-in trigger. It is cloned with the combobox wiring - role,
|
|
90
|
+
* aria, open/close, arrow keys, and the anchor the menu measures - so it must render one focusable
|
|
91
|
+
* element that forwards its props and ref. Pass a function to read `{ open, selected }`. */
|
|
92
|
+
trigger?: CustomTrigger<SelectOption[]>;
|
|
58
93
|
}
|
|
59
94
|
|
|
60
|
-
|
|
95
|
+
type MultiSelectMarker = NonNullable<MultiSelectProps['marker']>;
|
|
96
|
+
|
|
97
|
+
function OptionMarker({ marker, checked, size }: { marker: MultiSelectMarker; checked: boolean; size: MenuSize }) {
|
|
98
|
+
if (marker === 'switch') {
|
|
99
|
+
return (
|
|
100
|
+
<span className={cx('zc-sw', size === 'sm' && 'zc-sw--sm')} aria-hidden="true">
|
|
101
|
+
<SwitchGlyph checked={checked} readOnly tabIndex={-1} />
|
|
102
|
+
</span>
|
|
103
|
+
);
|
|
104
|
+
}
|
|
61
105
|
return (
|
|
62
|
-
<span className=
|
|
106
|
+
<span className={cx('zc-cbx', size === 'sm' && 'zc-cbx--sm')} aria-hidden="true">
|
|
63
107
|
<CheckGlyph checked={checked} readOnly tabIndex={-1} />
|
|
64
108
|
</span>
|
|
65
109
|
);
|
|
@@ -70,8 +114,10 @@ export function MultiSelect({
|
|
|
70
114
|
value: controlledValue,
|
|
71
115
|
defaultValue = [],
|
|
72
116
|
onChange,
|
|
117
|
+
presets = [],
|
|
73
118
|
placeholder = 'Select options',
|
|
74
119
|
size = 'md',
|
|
120
|
+
menuSize = size,
|
|
75
121
|
disabled = false,
|
|
76
122
|
invalid = false,
|
|
77
123
|
loading = false,
|
|
@@ -79,18 +125,19 @@ export function MultiSelect({
|
|
|
79
125
|
searchPlaceholder = 'Filter options',
|
|
80
126
|
highlight = 'neutral',
|
|
81
127
|
rail = false,
|
|
128
|
+
weight = 'medium',
|
|
129
|
+
marker = 'checkbox',
|
|
130
|
+
width = 'trigger',
|
|
82
131
|
leadingIcon = null,
|
|
83
132
|
id,
|
|
84
133
|
ariaLabel,
|
|
85
134
|
htmlProps,
|
|
135
|
+
menuProps,
|
|
86
136
|
activateOn = 'pointerdown',
|
|
87
137
|
animation,
|
|
138
|
+
trigger,
|
|
88
139
|
}: MultiSelectProps) {
|
|
89
|
-
const [value, setValue] = useControllable
|
|
90
|
-
controlledValue,
|
|
91
|
-
defaultValue,
|
|
92
|
-
onChange as ((next: string[], opt?: SelectOption) => void) | undefined,
|
|
93
|
-
);
|
|
140
|
+
const [value, setValue] = useControllable(controlledValue, defaultValue, onChange);
|
|
94
141
|
const values = Array.isArray(value) ? value : [];
|
|
95
142
|
const isSelected = (v: string) => values.indexOf(v) !== -1;
|
|
96
143
|
|
|
@@ -109,6 +156,7 @@ export function MultiSelect({
|
|
|
109
156
|
|
|
110
157
|
const selectedOptions = lb.flat.filter((o) => isSelected(o.value));
|
|
111
158
|
const isPlaceholder = !loading && selectedOptions.length === 0;
|
|
159
|
+
const customTrigger = typeof trigger === 'function' ? trigger({ open: lb.open, selected: selectedOptions }) : trigger;
|
|
112
160
|
|
|
113
161
|
return (
|
|
114
162
|
<div
|
|
@@ -116,6 +164,7 @@ export function MultiSelect({
|
|
|
116
164
|
className={cx('zc-select', htmlProps?.className)}
|
|
117
165
|
data-multiple="true"
|
|
118
166
|
data-size={size}
|
|
167
|
+
data-custom-trigger={customTrigger ? 'true' : undefined}
|
|
119
168
|
data-open={lb.open ? 'true' : undefined}
|
|
120
169
|
data-disabled={disabled ? 'true' : undefined}
|
|
121
170
|
data-invalid={invalid ? 'true' : undefined}
|
|
@@ -123,6 +172,7 @@ export function MultiSelect({
|
|
|
123
172
|
>
|
|
124
173
|
<SelectTrigger
|
|
125
174
|
lb={lb}
|
|
175
|
+
node={customTrigger}
|
|
126
176
|
disabled={disabled}
|
|
127
177
|
invalid={invalid}
|
|
128
178
|
ariaLabel={ariaLabel}
|
|
@@ -141,9 +191,18 @@ export function MultiSelect({
|
|
|
141
191
|
multiple
|
|
142
192
|
highlight={highlight}
|
|
143
193
|
rail={rail}
|
|
194
|
+
size={menuSize}
|
|
195
|
+
weight={weight}
|
|
196
|
+
width={width}
|
|
144
197
|
activateOn={activateOn}
|
|
145
198
|
animation={animation}
|
|
146
|
-
|
|
199
|
+
menuProps={menuProps}
|
|
200
|
+
check={(sel) => <OptionMarker marker={marker} checked={sel} size={menuSize} />}
|
|
201
|
+
presets={
|
|
202
|
+
presets.length > 0 && (
|
|
203
|
+
<PresetRow presets={presets} size={menuSize} apply={setValue} onMenuKeyDown={lb.onMenuKeyDown} />
|
|
204
|
+
)
|
|
205
|
+
}
|
|
147
206
|
/>
|
|
148
207
|
</div>
|
|
149
208
|
);
|
|
@@ -7,7 +7,17 @@ Many-of listbox; stays open while toggling, trigger summarises as first +N.
|
|
|
7
7
|
|
|
8
8
|
value: string[], onChange(string[]); searchable. highlight neutral|accent picks the hue of the
|
|
9
9
|
highlight travelling between options; rail adds a short accent bar on its leading edge.
|
|
10
|
+
trigger replaces the built-in combobox with your own element - a node, or a function of
|
|
11
|
+
{ open, selected } where selected is the SelectOption[] in option order. It is cloned with the full
|
|
12
|
+
wiring - role, aria-expanded/controls/activedescendant, open/close, arrow keys - and becomes the
|
|
13
|
+
anchor the menu measures, so it must render ONE focusable element that forwards its props and its ref
|
|
14
|
+
(a Button does; a plain div is not focusable). placeholder and leadingIcon then stop applying and the
|
|
15
|
+
root drops its width: 100%, leaving the trigger its intrinsic width; size still drives the menu,
|
|
16
|
+
loading still blocks opening, disabled still makes it inert with aria-disabled.
|
|
10
17
|
|
|
11
18
|
```tsx
|
|
12
19
|
<MultiSelect options={PEOPLE} value={ids} onChange={setIds} placeholder="Choose members" ariaLabel="Members" />
|
|
20
|
+
<MultiSelect options={PEOPLE} value={ids} onChange={setIds} ariaLabel="Members" trigger={({ selected }) => (
|
|
21
|
+
<Button variant="secondary">{selected.length ? `${selected.length} members` : 'Members'}</Button>
|
|
22
|
+
)} />
|
|
13
23
|
```
|
|
@@ -7,13 +7,16 @@ import type { HTMLAttributes, ReactNode } from 'react';
|
|
|
7
7
|
import type { DataAttributes } from '../../../dom-props';
|
|
8
8
|
import type { DisableableAnimation } from '../../../motion/timing';
|
|
9
9
|
import { useControllable } from '../../internal/hooks/use-controllable';
|
|
10
|
+
import type { MenuSize, MenuWeight, MenuWidth } from '../../internal/menu/highlight';
|
|
10
11
|
import type { ActivateOn } from '../../internal/utils/activation';
|
|
11
12
|
import { cx } from '../../internal/utils/cx';
|
|
12
13
|
import {
|
|
13
14
|
ListboxPanel,
|
|
14
15
|
SelectTrigger,
|
|
15
16
|
useListbox,
|
|
17
|
+
type CustomTrigger,
|
|
16
18
|
type SelectGroup,
|
|
19
|
+
type SelectMenuHtmlProps,
|
|
17
20
|
type SelectOption,
|
|
18
21
|
type SelectTriggerHtmlProps,
|
|
19
22
|
} from './core';
|
|
@@ -31,8 +34,16 @@ export interface SelectProps {
|
|
|
31
34
|
onChange?: (value: string, option: SelectOption) => void;
|
|
32
35
|
/** Trigger text when nothing is selected. @default 'Select an option' */
|
|
33
36
|
placeholder?: string;
|
|
34
|
-
/**
|
|
37
|
+
/** Trigger height, type and padding. The menu follows it unless `menuSize` overrides. @default 'md' */
|
|
35
38
|
size?: 'sm' | 'md' | 'lg';
|
|
39
|
+
/** Menu density on its own - row type, row padding and the filter field. A row carrying a
|
|
40
|
+
* description sits one step taller than a plain one at every step. @default the `size` value */
|
|
41
|
+
menuSize?: MenuSize;
|
|
42
|
+
/** Weight of every option label in the menu. @default 'medium' */
|
|
43
|
+
weight?: MenuWeight;
|
|
44
|
+
/** Menu width. `trigger` is never narrower than the trigger, `auto` fits the options, and
|
|
45
|
+
* `sm` | `md` | `lg` are fixed steps with long labels ellipsizing. @default 'trigger' */
|
|
46
|
+
width?: MenuWidth;
|
|
36
47
|
/** Disabled - trigger is inert and the menu cannot open. @default false */
|
|
37
48
|
disabled?: boolean;
|
|
38
49
|
/** Danger ring + border. @default false */
|
|
@@ -56,6 +67,9 @@ export interface SelectProps {
|
|
|
56
67
|
ariaLabel?: string;
|
|
57
68
|
/** Standard <div> attributes (className, style, data-*, ...) forwarded to the select root. */
|
|
58
69
|
htmlProps?: HTMLAttributes<HTMLDivElement> & DataAttributes;
|
|
70
|
+
/** Standard attributes (className, style, data-*, ...) forwarded to the menu panel, which portals
|
|
71
|
+
* to <body> and inherits nothing from the root. */
|
|
72
|
+
menuProps?: SelectMenuHtmlProps;
|
|
59
73
|
/** Whether the trigger and the options fire on `pointerdown` (snappier) or wait for `click`.
|
|
60
74
|
* @default 'pointerdown' */
|
|
61
75
|
activateOn?: ActivateOn;
|
|
@@ -63,8 +77,12 @@ export interface SelectProps {
|
|
|
63
77
|
animation?: DisableableAnimation;
|
|
64
78
|
/** Standard <button> attributes (className, style, aria-*, data-*, ...) merged onto the trigger.
|
|
65
79
|
* `onClick` and `onKeyDown` run before the built-in open/close and arrow-key handling, which
|
|
66
|
-
* cannot be replaced - the trigger is the combobox. */
|
|
80
|
+
* cannot be replaced - the trigger is the combobox. Ignored when `trigger` replaces it. */
|
|
67
81
|
triggerProps?: SelectTriggerHtmlProps;
|
|
82
|
+
/** Your own element in place of the built-in trigger. It is cloned with the combobox wiring - role,
|
|
83
|
+
* aria, open/close, arrow keys, and the anchor the menu measures - so it must render one focusable
|
|
84
|
+
* element that forwards its props and ref. Pass a function to read `{ open, selected }`. */
|
|
85
|
+
trigger?: CustomTrigger<SelectOption | null>;
|
|
68
86
|
/** Show check icon on selected value */
|
|
69
87
|
showCheck?: boolean;
|
|
70
88
|
}
|
|
@@ -76,6 +94,7 @@ export function Select({
|
|
|
76
94
|
onChange,
|
|
77
95
|
placeholder = 'Select an option',
|
|
78
96
|
size = 'md',
|
|
97
|
+
menuSize = size,
|
|
79
98
|
disabled = false,
|
|
80
99
|
invalid = false,
|
|
81
100
|
loading = false,
|
|
@@ -83,13 +102,17 @@ export function Select({
|
|
|
83
102
|
searchPlaceholder = 'Filter options',
|
|
84
103
|
highlight = 'neutral',
|
|
85
104
|
rail = false,
|
|
105
|
+
weight = 'medium',
|
|
106
|
+
width = 'trigger',
|
|
86
107
|
leadingIcon = null,
|
|
87
108
|
id,
|
|
88
109
|
ariaLabel,
|
|
89
110
|
htmlProps,
|
|
111
|
+
menuProps,
|
|
90
112
|
activateOn = 'pointerdown',
|
|
91
113
|
animation,
|
|
92
114
|
triggerProps,
|
|
115
|
+
trigger,
|
|
93
116
|
showCheck = true,
|
|
94
117
|
}: SelectProps) {
|
|
95
118
|
const [value, setValue] = useControllable<string | null, SelectOption>(controlledValue, defaultValue, onChange);
|
|
@@ -108,12 +131,14 @@ export function Select({
|
|
|
108
131
|
|
|
109
132
|
const selected = lb.flat.find((o) => o.value === value) || null;
|
|
110
133
|
const isPlaceholder = !loading && !selected;
|
|
134
|
+
const customTrigger = typeof trigger === 'function' ? trigger({ open: lb.open, selected }) : trigger;
|
|
111
135
|
|
|
112
136
|
return (
|
|
113
137
|
<div
|
|
114
138
|
{...htmlProps}
|
|
115
139
|
className={cx('zc-select', htmlProps?.className)}
|
|
116
140
|
data-size={size}
|
|
141
|
+
data-custom-trigger={customTrigger ? 'true' : undefined}
|
|
117
142
|
data-open={lb.open ? 'true' : undefined}
|
|
118
143
|
data-disabled={disabled ? 'true' : undefined}
|
|
119
144
|
data-invalid={invalid ? 'true' : undefined}
|
|
@@ -121,6 +146,7 @@ export function Select({
|
|
|
121
146
|
>
|
|
122
147
|
<SelectTrigger
|
|
123
148
|
lb={lb}
|
|
149
|
+
node={customTrigger}
|
|
124
150
|
disabled={disabled}
|
|
125
151
|
invalid={invalid}
|
|
126
152
|
ariaLabel={ariaLabel}
|
|
@@ -138,8 +164,12 @@ export function Select({
|
|
|
138
164
|
ariaLabel={ariaLabel}
|
|
139
165
|
highlight={highlight}
|
|
140
166
|
rail={rail}
|
|
167
|
+
size={menuSize}
|
|
168
|
+
weight={weight}
|
|
169
|
+
width={width}
|
|
141
170
|
activateOn={activateOn}
|
|
142
171
|
animation={animation}
|
|
172
|
+
menuProps={menuProps}
|
|
143
173
|
{...(!showCheck && { check: () => null })}
|
|
144
174
|
/>
|
|
145
175
|
</div>
|
|
@@ -6,8 +6,17 @@ Docs: https://ui.zyncat.app/select
|
|
|
6
6
|
Single-select listbox in a popover, searchable; holds value: string | null.
|
|
7
7
|
|
|
8
8
|
options: SelectOption[]; value: string|null, onChange(value); searchable, leadingIcon, placeholder,
|
|
9
|
-
invalid, loading, ariaLabel.
|
|
9
|
+
invalid, loading, ariaLabel. size sets the trigger height and the row padding in the menu together; weight sets the option
|
|
10
|
+
label weight regular|medium|semibold.
|
|
11
|
+
highlight neutral|accent picks the hue of the highlight travelling
|
|
10
12
|
between options; rail adds a short accent bar on its leading edge.
|
|
13
|
+
trigger replaces the built-in combobox with your own element - a node, or a function of
|
|
14
|
+
{ open, selected } where selected is the SelectOption or null. It is cloned with the full wiring -
|
|
15
|
+
role, aria-expanded/controls/activedescendant, open/close, arrow keys - and becomes the anchor the
|
|
16
|
+
menu measures, so it must render ONE focusable element that forwards its props and its ref (a Button
|
|
17
|
+
does; a plain div is not focusable). placeholder, leadingIcon and triggerProps then stop applying and
|
|
18
|
+
the root drops its width: 100%, leaving the trigger its intrinsic width; size still drives the menu,
|
|
19
|
+
loading still blocks opening, disabled still makes it inert with aria-disabled.
|
|
11
20
|
|
|
12
21
|
```tsx
|
|
13
22
|
<Select
|
|
@@ -18,4 +27,7 @@ between options; rail adds a short accent bar on its leading edge.
|
|
|
18
27
|
placeholder="Choose a time zone"
|
|
19
28
|
ariaLabel="Time zone"
|
|
20
29
|
/>
|
|
30
|
+
<Select options={TIMEZONES} value={tz} onChange={setTz} ariaLabel="Time zone" trigger={({ open, selected }) => (
|
|
31
|
+
<Button variant="secondary" data-open={open || undefined}>{selected?.label ?? 'Choose a time zone'}</Button>
|
|
32
|
+
)} />
|
|
21
33
|
```
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { useListbox } from './use-listbox';
|
|
2
|
-
export { SelectTrigger, type SelectTriggerHtmlProps } from './trigger';
|
|
2
|
+
export { SelectTrigger, type CustomTrigger, type SelectTriggerHtmlProps } from './trigger';
|
|
3
3
|
export { ListboxPanel } from './panel';
|
|
4
|
+
export type { SelectMenuHtmlProps } from './menu';
|
|
4
5
|
export type { SelectOption, SelectGroup } from './types';
|
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { useRef, type HTMLAttributes, type ReactNode, type RefObject } from 'react';
|
|
4
4
|
|
|
5
|
+
import type { DataAttributes } from '../../../../dom-props';
|
|
5
6
|
import type { Layer } from '../../../../engine';
|
|
6
7
|
import { resolveMotionTiming } from '../../../../motion/motion-timing';
|
|
7
8
|
import { Presence } from '../../../../motion/presence';
|
|
8
9
|
import type { DisableableAnimation } from '../../../../motion/timing';
|
|
9
10
|
import { useMotion, type MotionSpecs } from '../../../../motion/use-motion';
|
|
10
11
|
import { motionFor, type MotionTransition } from '../../../../tokens/motion-tokens';
|
|
11
|
-
import {
|
|
12
|
+
import { menuSurfaceAttrs, type MenuSurfaceProps } from '../../../internal/menu/highlight';
|
|
13
|
+
import { useAnchorWidth } from '../../../internal/menu/use-anchor-width';
|
|
14
|
+
import { useReturnFocus } from '../../../internal/overlay/focus';
|
|
12
15
|
import { OverlayPortal, useOutsidePress, useOverlayEntry } from '../../../internal/overlay/layer';
|
|
13
|
-
import { useAnchorPosition } from '../../../internal/overlay/position';
|
|
16
|
+
import { useAnchorPosition, type VirtualAnchor } from '../../../internal/overlay/position';
|
|
17
|
+
import { cx } from '../../../internal/utils/cx';
|
|
18
|
+
|
|
19
|
+
export type SelectMenuHtmlProps = HTMLAttributes<HTMLDivElement> & DataAttributes;
|
|
14
20
|
|
|
15
21
|
const SELECT_MENU_TIMING = {
|
|
16
22
|
open: { duration: 'base', ease: 'entrance' },
|
|
@@ -37,13 +43,15 @@ function selectMenuLayers(
|
|
|
37
43
|
];
|
|
38
44
|
}
|
|
39
45
|
|
|
40
|
-
export interface SelectMenuProps extends
|
|
46
|
+
export interface SelectMenuProps extends MenuSurfaceProps {
|
|
41
47
|
open: boolean;
|
|
42
48
|
menuId: string;
|
|
43
49
|
requestClose: () => void;
|
|
44
|
-
triggerRef: RefObject<
|
|
50
|
+
triggerRef: RefObject<HTMLElement | null>;
|
|
51
|
+
anchor?: VirtualAnchor | null;
|
|
45
52
|
multiple?: boolean;
|
|
46
53
|
animation?: DisableableAnimation;
|
|
54
|
+
menuProps?: SelectMenuHtmlProps;
|
|
47
55
|
children?: ReactNode;
|
|
48
56
|
}
|
|
49
57
|
|
|
@@ -51,9 +59,14 @@ function MenuSurface({
|
|
|
51
59
|
menuId,
|
|
52
60
|
requestClose,
|
|
53
61
|
triggerRef,
|
|
62
|
+
anchor,
|
|
54
63
|
multiple,
|
|
55
64
|
highlight,
|
|
56
65
|
rail,
|
|
66
|
+
size,
|
|
67
|
+
weight,
|
|
68
|
+
width = 'trigger',
|
|
69
|
+
menuProps,
|
|
57
70
|
animate,
|
|
58
71
|
exit,
|
|
59
72
|
children,
|
|
@@ -61,26 +74,20 @@ function MenuSurface({
|
|
|
61
74
|
const menuRef = useRef<HTMLDivElement>(null);
|
|
62
75
|
const entry = useOverlayEntry({ nodeRef: menuRef, dismissible: true, requestClose });
|
|
63
76
|
useMotion(menuRef, { animate, exit });
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
if (t && menuRef.current) menuRef.current.style.minWidth = t.getBoundingClientRect().width + 'px';
|
|
68
|
-
};
|
|
69
|
-
apply();
|
|
70
|
-
window.addEventListener('resize', apply);
|
|
71
|
-
return () => window.removeEventListener('resize', apply);
|
|
72
|
-
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
|
73
|
-
useAnchorPosition({ side: 'bottom', align: 'start', arrow: false, triggerRef, panelRef: menuRef });
|
|
77
|
+
useReturnFocus(menuRef);
|
|
78
|
+
useAnchorWidth(triggerRef, menuRef, width === 'trigger');
|
|
79
|
+
useAnchorPosition({ side: 'bottom', align: 'start', arrow: false, anchor, triggerRef, panelRef: menuRef });
|
|
74
80
|
useOutsidePress({ entry, refs: [menuRef, triggerRef], enabled: true, onPress: requestClose });
|
|
75
81
|
|
|
76
82
|
return (
|
|
77
83
|
<div
|
|
84
|
+
{...menuProps}
|
|
78
85
|
ref={menuRef}
|
|
79
|
-
className=
|
|
86
|
+
className={cx('zc-menu-surface zc-select__menu', menuProps?.className)}
|
|
80
87
|
id={menuId}
|
|
81
88
|
role="presentation"
|
|
82
89
|
data-multiple={multiple ? 'true' : undefined}
|
|
83
|
-
{...
|
|
90
|
+
{...menuSurfaceAttrs({ highlight, rail, size, weight, width })}
|
|
84
91
|
>
|
|
85
92
|
{children}
|
|
86
93
|
</div>
|
|
@@ -92,10 +99,15 @@ export function SelectMenu({
|
|
|
92
99
|
menuId,
|
|
93
100
|
requestClose,
|
|
94
101
|
triggerRef,
|
|
102
|
+
anchor,
|
|
95
103
|
multiple,
|
|
96
104
|
highlight,
|
|
97
105
|
rail,
|
|
106
|
+
size,
|
|
107
|
+
weight,
|
|
108
|
+
width,
|
|
98
109
|
animation,
|
|
110
|
+
menuProps,
|
|
99
111
|
children,
|
|
100
112
|
}: SelectMenuProps) {
|
|
101
113
|
return (
|
|
@@ -109,9 +121,14 @@ export function SelectMenu({
|
|
|
109
121
|
menuId={menuId}
|
|
110
122
|
requestClose={requestClose}
|
|
111
123
|
triggerRef={triggerRef}
|
|
124
|
+
anchor={anchor}
|
|
112
125
|
multiple={multiple}
|
|
113
126
|
highlight={highlight}
|
|
114
127
|
rail={rail}
|
|
128
|
+
size={size}
|
|
129
|
+
weight={weight}
|
|
130
|
+
width={width}
|
|
131
|
+
menuProps={menuProps}
|
|
115
132
|
>
|
|
116
133
|
{children}
|
|
117
134
|
</MenuSurface>
|