@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,31 @@
|
|
|
1
|
+
@layer zyncat.reset, zyncat.tokens, zyncat.base, zyncat.components;
|
|
2
|
+
|
|
3
|
+
@layer zyncat.components {
|
|
4
|
+
.zc-overlay-panel--sheet-bottom:has(> .zc-dialog) {
|
|
5
|
+
grid-template-rows: minmax(0, 1fr);
|
|
6
|
+
max-height: calc(100% - var(--space-7));
|
|
7
|
+
border-radius: var(--radius-xl) var(--radius-xl) 0 0;
|
|
8
|
+
}
|
|
9
|
+
.zc-overlay-panel--sheet-bottom:has(> .zc-dialog[data-size='lg']) {
|
|
10
|
+
height: 100%;
|
|
11
|
+
}
|
|
12
|
+
.zc-overlay-panel--sheet-bottom > .zc-dialog {
|
|
13
|
+
width: auto;
|
|
14
|
+
max-height: none;
|
|
15
|
+
padding-bottom: env(safe-area-inset-bottom);
|
|
16
|
+
border: none;
|
|
17
|
+
border-radius: inherit;
|
|
18
|
+
box-shadow: none;
|
|
19
|
+
}
|
|
20
|
+
.zc-overlay-panel--sheet-bottom[data-drag] > .zc-dialog::before {
|
|
21
|
+
content: '';
|
|
22
|
+
position: absolute;
|
|
23
|
+
top: var(--space-2);
|
|
24
|
+
inset-inline: 0;
|
|
25
|
+
width: var(--space-6);
|
|
26
|
+
height: var(--space-1);
|
|
27
|
+
margin-inline: auto;
|
|
28
|
+
border-radius: var(--radius-full);
|
|
29
|
+
background: var(--border-strong);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -133,6 +133,9 @@
|
|
|
133
133
|
.zc-dialog__body:first-child {
|
|
134
134
|
padding-top: var(--space-5);
|
|
135
135
|
}
|
|
136
|
+
.zc-dialog__body:empty {
|
|
137
|
+
display: none;
|
|
138
|
+
}
|
|
136
139
|
.zc-dialog:has(.zc-dialog__icon) .zc-dialog__body {
|
|
137
140
|
padding-left: calc(var(--space-5) + 2.25rem + var(--space-3));
|
|
138
141
|
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useRef, type HTMLAttributes, type ReactNode } from 'react';
|
|
4
|
+
|
|
5
|
+
import type { DataAttributes } from '../../../dom-props';
|
|
6
|
+
import { useScrollEdges } from '../../internal/hooks/use-scroll-edges';
|
|
7
|
+
import { Icon } from '../../internal/icon/Icon';
|
|
8
|
+
import { IconSlot } from '../../internal/icon/IconSlot';
|
|
9
|
+
import { cx } from '../../internal/utils/cx';
|
|
10
|
+
|
|
11
|
+
interface DialogSurfaceProps {
|
|
12
|
+
panelId: string;
|
|
13
|
+
size?: 'sm' | 'md' | 'lg';
|
|
14
|
+
tone?: 'default' | 'danger';
|
|
15
|
+
icon?: ReactNode;
|
|
16
|
+
title?: ReactNode;
|
|
17
|
+
description?: ReactNode;
|
|
18
|
+
dismissible: boolean;
|
|
19
|
+
footer?: ReactNode | ((close: () => void) => ReactNode);
|
|
20
|
+
requestClose: () => void;
|
|
21
|
+
htmlProps?: HTMLAttributes<HTMLElement> & DataAttributes;
|
|
22
|
+
children?: ReactNode;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function DialogSurface({
|
|
26
|
+
panelId,
|
|
27
|
+
size = 'md',
|
|
28
|
+
tone = 'default',
|
|
29
|
+
icon,
|
|
30
|
+
title,
|
|
31
|
+
description,
|
|
32
|
+
dismissible,
|
|
33
|
+
footer,
|
|
34
|
+
requestClose,
|
|
35
|
+
htmlProps,
|
|
36
|
+
children,
|
|
37
|
+
}: DialogSurfaceProps) {
|
|
38
|
+
const bodyRef = useRef<HTMLDivElement>(null);
|
|
39
|
+
const titleId = panelId + '-title';
|
|
40
|
+
const descId = panelId + '-desc';
|
|
41
|
+
const footerContent = typeof footer === 'function' ? footer(requestClose) : footer;
|
|
42
|
+
|
|
43
|
+
useScrollEdges(bodyRef, (edges, el) => {
|
|
44
|
+
el.toggleAttribute('data-scroll-top', edges.top);
|
|
45
|
+
el.toggleAttribute('data-scroll-bottom', edges.bottom);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<section
|
|
50
|
+
{...htmlProps}
|
|
51
|
+
className={cx('zc-dialog', htmlProps?.className)}
|
|
52
|
+
role="dialog"
|
|
53
|
+
aria-modal="true"
|
|
54
|
+
data-size={size === 'md' ? undefined : size}
|
|
55
|
+
data-tone={tone === 'default' ? undefined : tone}
|
|
56
|
+
aria-labelledby={title ? titleId : undefined}
|
|
57
|
+
aria-describedby={description ? descId : undefined}
|
|
58
|
+
>
|
|
59
|
+
{(icon || title || description || dismissible) && (
|
|
60
|
+
<header className="zc-dialog__header">
|
|
61
|
+
{icon && (
|
|
62
|
+
<span className="zc-dialog__icon">
|
|
63
|
+
<IconSlot size="md">{icon}</IconSlot>
|
|
64
|
+
</span>
|
|
65
|
+
)}
|
|
66
|
+
<div className="zc-dialog__heading">
|
|
67
|
+
{title && (
|
|
68
|
+
<h2 className="zc-dialog__title" id={titleId}>
|
|
69
|
+
{title}
|
|
70
|
+
</h2>
|
|
71
|
+
)}
|
|
72
|
+
{description && (
|
|
73
|
+
<p className="zc-dialog__desc" id={descId}>
|
|
74
|
+
{description}
|
|
75
|
+
</p>
|
|
76
|
+
)}
|
|
77
|
+
</div>
|
|
78
|
+
{dismissible && (
|
|
79
|
+
<button type="button" className="zc-dialog__close" aria-label="Close dialog" onClick={requestClose}>
|
|
80
|
+
<Icon name="x" size="sm" weight="bold" />
|
|
81
|
+
</button>
|
|
82
|
+
)}
|
|
83
|
+
</header>
|
|
84
|
+
)}
|
|
85
|
+
|
|
86
|
+
<div className="zc-dialog__body" ref={bodyRef}>
|
|
87
|
+
{children}
|
|
88
|
+
</div>
|
|
89
|
+
|
|
90
|
+
{footerContent && <footer className="zc-dialog__footer">{footerContent}</footer>}
|
|
91
|
+
</section>
|
|
92
|
+
);
|
|
93
|
+
}
|
|
@@ -4,6 +4,7 @@ import './dropdown.css';
|
|
|
4
4
|
|
|
5
5
|
import {
|
|
6
6
|
Fragment,
|
|
7
|
+
useEffect,
|
|
7
8
|
useId,
|
|
8
9
|
useMemo,
|
|
9
10
|
useRef,
|
|
@@ -20,8 +21,10 @@ import { popIn, popOut } from '../../../motion/presets';
|
|
|
20
21
|
import type { DisableableAnimation } from '../../../motion/timing';
|
|
21
22
|
import { motionFor } from '../../../tokens/motion-tokens';
|
|
22
23
|
import { useControllable } from '../../internal/hooks/use-controllable';
|
|
24
|
+
import type { MenuSize, MenuWeight, MenuWidth } from '../../internal/menu/highlight';
|
|
23
25
|
import { ovCloneTrigger, OverlayPortal } from '../../internal/overlay/layer';
|
|
24
|
-
import type {
|
|
26
|
+
import type { VirtualAnchor } from '../../internal/overlay/position';
|
|
27
|
+
import { pressedByKeyboard, type ActivateOn } from '../../internal/utils/activation';
|
|
25
28
|
import { MenuPanel } from './menu-panel';
|
|
26
29
|
import {
|
|
27
30
|
levelKey,
|
|
@@ -39,13 +42,20 @@ const DROPDOWN_TIMING = {
|
|
|
39
42
|
open: { duration: 'base', ease: 'entrance' },
|
|
40
43
|
close: { duration: 'fast', ease: 'exit' },
|
|
41
44
|
} as const;
|
|
45
|
+
const ROOT_SEED = { key: ROOT_LEVEL, focus: 'selected' as SeedFocus };
|
|
46
|
+
const NO_PATH: string[] = [];
|
|
42
47
|
|
|
43
48
|
export interface DropdownProps {
|
|
44
49
|
/** The rows - a flat `DropdownItem[]`, or `DropdownGroup[]` to render divided sections.
|
|
45
50
|
* A row with its own `items` opens a submenu instead of committing. @default [] */
|
|
46
51
|
items: DropdownItems;
|
|
47
|
-
/** Cloned to toggle the menu, and used as the anchor
|
|
48
|
-
|
|
52
|
+
/** Cloned to toggle the menu, and used as the anchor unless `anchor` is set. Gets the
|
|
53
|
+
* `aria-haspopup="menu"` wiring. */
|
|
54
|
+
trigger?: ReactElement | null;
|
|
55
|
+
/** Anchor to an arbitrary rect instead of the trigger - any `{ getBoundingClientRect() }`, which an element
|
|
56
|
+
* also satisfies. Drive `open` yourself, name the menu with `ariaLabel` when there is no trigger, and pass
|
|
57
|
+
* a new object to re-place a moving anchor. Submenus always anchor to their row. */
|
|
58
|
+
anchor?: VirtualAnchor | null;
|
|
49
59
|
/** Whether the trigger and the rows fire on `pointerdown` (snappier) or wait for `click`. @default 'pointerdown' */
|
|
50
60
|
activateOn?: ActivateOn;
|
|
51
61
|
|
|
@@ -68,6 +78,16 @@ export interface DropdownProps {
|
|
|
68
78
|
/** Hue of the highlight that travels between rows: the neutral wash, or the accent wash with accent
|
|
69
79
|
* ink on the active row. @default 'neutral' */
|
|
70
80
|
highlight?: 'neutral' | 'accent';
|
|
81
|
+
/** Menu density - row type and padding on every row, submenus included; a row carrying a
|
|
82
|
+
* description sits one step taller than a plain one. The trigger is your own node, so this
|
|
83
|
+
* never touches it. @default 'md' */
|
|
84
|
+
size?: MenuSize;
|
|
85
|
+
/** Weight of every row label. @default 'medium' */
|
|
86
|
+
weight?: MenuWeight;
|
|
87
|
+
/** Width of the top-level menu. `auto` fits the rows, `trigger` is never narrower than the trigger,
|
|
88
|
+
* and `sm` | `md` | `lg` are fixed steps with long labels ellipsizing. Submenus always fit their
|
|
89
|
+
* rows. @default 'auto' */
|
|
90
|
+
width?: MenuWidth;
|
|
71
91
|
/** Short accent bar on the leading edge of the highlight, marking the active row. @default false */
|
|
72
92
|
rail?: boolean;
|
|
73
93
|
|
|
@@ -83,7 +103,8 @@ export interface DropdownProps {
|
|
|
83
103
|
|
|
84
104
|
export function Dropdown({
|
|
85
105
|
items = [],
|
|
86
|
-
trigger,
|
|
106
|
+
trigger = null,
|
|
107
|
+
anchor,
|
|
87
108
|
activateOn = 'pointerdown',
|
|
88
109
|
open: controlledOpen,
|
|
89
110
|
defaultOpen = false,
|
|
@@ -94,19 +115,23 @@ export function Dropdown({
|
|
|
94
115
|
align = 'start',
|
|
95
116
|
highlight = 'neutral',
|
|
96
117
|
rail = false,
|
|
118
|
+
size = 'md',
|
|
119
|
+
weight = 'medium',
|
|
120
|
+
width = 'auto',
|
|
97
121
|
id,
|
|
98
122
|
ariaLabel,
|
|
99
123
|
htmlProps,
|
|
100
124
|
animation,
|
|
101
125
|
}: DropdownProps) {
|
|
102
126
|
const [open, setOpen] = useControllable(controlledOpen, defaultOpen, onOpenChange);
|
|
103
|
-
const [path, setPath] = useState
|
|
104
|
-
const [seed, setSeed] = useState(
|
|
127
|
+
const [path, setPath] = useState(NO_PATH);
|
|
128
|
+
const [seed, setSeed] = useState(ROOT_SEED);
|
|
105
129
|
|
|
106
130
|
const refs = useRef(new Map<string, RefObject<HTMLElement>>());
|
|
107
131
|
const hoverDepth = useRef(-1);
|
|
108
132
|
const autoId = useId();
|
|
109
133
|
const menuId = id || 'dropdown-' + autoId;
|
|
134
|
+
const triggerId = (trigger?.props as { id?: string } | undefined)?.id ?? menuId + '-trigger';
|
|
110
135
|
const levels = useMemo(() => resolveLevels(items, path), [items, path]);
|
|
111
136
|
|
|
112
137
|
const refFor = (key: string): RefObject<HTMLElement> => {
|
|
@@ -116,6 +141,12 @@ export function Dropdown({
|
|
|
116
141
|
const triggerRef = refFor('trigger');
|
|
117
142
|
const timings = resolveMotionTiming(animation, DROPDOWN_TIMING, triggerRef.current);
|
|
118
143
|
|
|
144
|
+
useEffect(() => {
|
|
145
|
+
if (open) return;
|
|
146
|
+
setSeed(ROOT_SEED);
|
|
147
|
+
setPath(NO_PATH);
|
|
148
|
+
}, [open]);
|
|
149
|
+
|
|
119
150
|
const dismiss = (refocus: boolean) => {
|
|
120
151
|
setPath([]);
|
|
121
152
|
hoverDepth.current = -1;
|
|
@@ -132,11 +163,16 @@ export function Dropdown({
|
|
|
132
163
|
const chain: MenuChain = {
|
|
133
164
|
levels,
|
|
134
165
|
menuId,
|
|
166
|
+
triggerId,
|
|
167
|
+
anchor,
|
|
135
168
|
activateOn,
|
|
136
169
|
side,
|
|
137
170
|
align,
|
|
138
171
|
highlight,
|
|
139
172
|
rail,
|
|
173
|
+
size,
|
|
174
|
+
weight,
|
|
175
|
+
width,
|
|
140
176
|
ariaLabel,
|
|
141
177
|
htmlProps,
|
|
142
178
|
seed,
|
|
@@ -167,7 +203,11 @@ export function Dropdown({
|
|
|
167
203
|
<Fragment>
|
|
168
204
|
{ovCloneTrigger(trigger, {
|
|
169
205
|
open,
|
|
170
|
-
onPress: () =>
|
|
206
|
+
onPress: (e) => {
|
|
207
|
+
triggerRef.current?.focus({ preventScroll: true });
|
|
208
|
+
if (open) dismiss(false);
|
|
209
|
+
else show(pressedByKeyboard(e) ? 'first' : 'selected');
|
|
210
|
+
},
|
|
171
211
|
onKeyDown: (e) => {
|
|
172
212
|
if (open || (e.key !== 'ArrowDown' && e.key !== 'ArrowUp')) return;
|
|
173
213
|
e.preventDefault();
|
|
@@ -177,6 +217,8 @@ export function Dropdown({
|
|
|
177
217
|
haspopup: 'menu',
|
|
178
218
|
triggerRef,
|
|
179
219
|
activateOn,
|
|
220
|
+
holdFocus: true,
|
|
221
|
+
attrs: { id: triggerId },
|
|
180
222
|
})}
|
|
181
223
|
<OverlayPortal scope={triggerRef.current}>
|
|
182
224
|
<Presence>
|
|
@@ -10,6 +10,8 @@ DropdownGroup[] (labelled sections); a row with its own items opens a submenu, n
|
|
|
10
10
|
you like. content on a row opens your own panel body in place of a submenu; selected marks the
|
|
11
11
|
current value of a single-choice group with a check. Keyboard is the APG menu button: arrows move,
|
|
12
12
|
Right/Left open and close a submenu, Enter/Space commit, typeahead, Esc one level, Tab the lot.
|
|
13
|
+
size sm|md|lg sets the vertical padding of every row, submenus included; weight sets the label
|
|
14
|
+
weight regular|medium|semibold.
|
|
13
15
|
highlight neutral|accent picks the hue of the highlight travelling between rows; rail adds a short
|
|
14
16
|
accent bar on its leading edge. returnFocus false leaves focus where a committing row put it.
|
|
15
17
|
|
|
@@ -4,10 +4,9 @@
|
|
|
4
4
|
.zc-dropdown__menu {
|
|
5
5
|
--menu-max-width: min(20rem, 92vw);
|
|
6
6
|
--menu-max-height: min(26rem, 70vh);
|
|
7
|
-
min-width: 11rem;
|
|
8
7
|
}
|
|
9
8
|
|
|
10
|
-
.zc-dropdown__menu[data-
|
|
9
|
+
.zc-dropdown__menu:has(.zc-dropdown__item[data-active='true'][data-danger='true']) {
|
|
11
10
|
--menu-glide-fill: var(--danger-wash);
|
|
12
11
|
--menu-glide-rail: var(--danger);
|
|
13
12
|
}
|
|
@@ -25,14 +24,6 @@
|
|
|
25
24
|
color: var(--menu-active-ink, var(--text-strong));
|
|
26
25
|
}
|
|
27
26
|
|
|
28
|
-
.zc-dropdown__item[data-danger='true'],
|
|
29
|
-
.zc-dropdown__item[data-danger='true'][data-active='true'] {
|
|
30
|
-
color: var(--danger-text);
|
|
31
|
-
}
|
|
32
|
-
.zc-dropdown__item[data-danger='true'] .zc-menu-row__icon {
|
|
33
|
-
color: var(--danger);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
27
|
.zc-dropdown__item-caret {
|
|
37
28
|
flex: 0 0 auto;
|
|
38
29
|
color: var(--text-subtle);
|
|
@@ -51,6 +42,18 @@
|
|
|
51
42
|
color: var(--text-accent);
|
|
52
43
|
}
|
|
53
44
|
|
|
45
|
+
.zc-dropdown__item[data-danger='true'] {
|
|
46
|
+
color: var(--danger-text);
|
|
47
|
+
}
|
|
48
|
+
.zc-dropdown__item[data-danger='true'] .zc-menu-row__label {
|
|
49
|
+
color: var(--danger-text);
|
|
50
|
+
}
|
|
51
|
+
.zc-dropdown__item[data-danger='true'] .zc-menu-row__icon,
|
|
52
|
+
.zc-dropdown__item[data-danger='true'] .zc-dropdown__item-check,
|
|
53
|
+
.zc-dropdown__item[data-danger='true'] .zc-dropdown__item-caret {
|
|
54
|
+
color: var(--danger);
|
|
55
|
+
}
|
|
56
|
+
|
|
54
57
|
.zc-dropdown__item[data-disabled='true'] {
|
|
55
58
|
cursor: not-allowed;
|
|
56
59
|
color: var(--text-disabled);
|
|
@@ -66,7 +69,7 @@
|
|
|
66
69
|
|
|
67
70
|
.zc-dropdown__item-shortcut {
|
|
68
71
|
flex: 0 0 auto;
|
|
69
|
-
font: var(--type-
|
|
72
|
+
font: var(--type-caption);
|
|
70
73
|
font-variant-numeric: tabular-nums;
|
|
71
74
|
color: var(--text-subtle);
|
|
72
75
|
padding-left: var(--space-2);
|
|
@@ -2,15 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
import '../../internal/menu/menu-surface.css';
|
|
4
4
|
|
|
5
|
-
import { useEffect, useLayoutEffect, useMemo, useRef,
|
|
5
|
+
import { useEffect, useLayoutEffect, useMemo, useRef, type KeyboardEvent, type RefObject } from 'react';
|
|
6
6
|
|
|
7
7
|
import { GlidePill, useGlide } from '../../../motion/glide';
|
|
8
|
+
import { Presence } from '../../../motion/presence';
|
|
8
9
|
import { useMotion, type MotionSpecs } from '../../../motion/use-motion';
|
|
9
10
|
import { edgeEnabled, matchPrefix, stepEnabled } from '../../internal/collection/collection';
|
|
10
11
|
import { useTypeahead } from '../../internal/hooks/use-typeahead';
|
|
11
12
|
import { Icon } from '../../internal/icon/Icon';
|
|
12
|
-
import {
|
|
13
|
+
import { menuSurfaceAttrs } from '../../internal/menu/highlight';
|
|
13
14
|
import { MenuRow } from '../../internal/menu/menu-row';
|
|
15
|
+
import { useAnchorWidth } from '../../internal/menu/use-anchor-width';
|
|
14
16
|
import { useReturnFocus } from '../../internal/overlay/focus';
|
|
15
17
|
import { useOutsidePress, useOverlayEntry } from '../../internal/overlay/layer';
|
|
16
18
|
import { useAnchorPosition } from '../../internal/overlay/position';
|
|
@@ -52,7 +54,13 @@ export function MenuPanel({ chain, depth, ...motion }: { chain: MenuChain; depth
|
|
|
52
54
|
|
|
53
55
|
const { groups, flat } = useMemo(() => normalize(level.items), [level.items]);
|
|
54
56
|
const indexOf = useMemo(() => new Map(flat.map((item, i) => [item.id, i] as const)), [flat]);
|
|
55
|
-
const
|
|
57
|
+
const seedIndex = () => {
|
|
58
|
+
if (seed === 'none') return -1;
|
|
59
|
+
if (seed === 'selected') return flat.findIndex((item) => item.selected && !item.disabled);
|
|
60
|
+
return edgeEnabled(flat, seed === 'last');
|
|
61
|
+
};
|
|
62
|
+
const activeIdx = useRef(-1);
|
|
63
|
+
const activeRow = useRef<HTMLElement | null>(null);
|
|
56
64
|
|
|
57
65
|
const panelRef = refFor('panel:' + level.key);
|
|
58
66
|
const rowFor = (i: number) => refFor('row:' + levelKey(depth, flat[i].id)) as unknown as RefObject<HTMLDivElement>;
|
|
@@ -64,7 +72,6 @@ export function MenuPanel({ chain, depth, ...motion }: { chain: MenuChain; depth
|
|
|
64
72
|
const travel = useRef({ from: null as Point | null, active: false, hovered: -1 });
|
|
65
73
|
|
|
66
74
|
const openIdx = openSubId != null ? (indexOf.get(openSubId) ?? -1) : -1;
|
|
67
|
-
const activeItem = activeIdx >= 0 ? flat[activeIdx] : undefined;
|
|
68
75
|
const cancel = () => chain.cancel(depth);
|
|
69
76
|
const closeSub = () => chain.closeSub(depth);
|
|
70
77
|
|
|
@@ -72,21 +79,34 @@ export function MenuPanel({ chain, depth, ...motion }: { chain: MenuChain; depth
|
|
|
72
79
|
const place = { side: nested ? 'right' : chain.side, align: nested ? 'start' : chain.align } as const;
|
|
73
80
|
useMotion(panelRef, motion);
|
|
74
81
|
useReturnFocus(panelRef);
|
|
75
|
-
|
|
82
|
+
useAnchorWidth(anchorRef, panelRef, !nested && chain.width === 'trigger');
|
|
83
|
+
useAnchorPosition({ ...place, arrow: false, anchor: nested ? null : chain.anchor, triggerRef: anchorRef, panelRef });
|
|
76
84
|
useOutsidePress({ entry, refs: [panelRef, anchorRef], enabled: !nested, onPress: () => chain.dismiss(false) });
|
|
77
85
|
|
|
78
|
-
|
|
79
|
-
const row =
|
|
86
|
+
function setActiveIdx(i: number) {
|
|
87
|
+
const row = i >= 0 && i < flat.length ? rowFor(i).current : null;
|
|
88
|
+
activeIdx.current = i;
|
|
89
|
+
if (activeRow.current) {
|
|
90
|
+
activeRow.current.tabIndex = -1;
|
|
91
|
+
activeRow.current.removeAttribute('data-active');
|
|
92
|
+
}
|
|
93
|
+
activeRow.current = row;
|
|
80
94
|
if (!row) return glide.leave();
|
|
95
|
+
row.tabIndex = 0;
|
|
96
|
+
row.setAttribute('data-active', 'true');
|
|
81
97
|
row.focus();
|
|
82
98
|
glide.enter(row);
|
|
83
|
-
|
|
84
|
-
}, [activeIdx]);
|
|
99
|
+
}
|
|
85
100
|
|
|
86
101
|
useLayoutEffect(() => {
|
|
87
102
|
if (seed === 'none') return;
|
|
88
|
-
if (contentLevel)
|
|
89
|
-
|
|
103
|
+
if (contentLevel) {
|
|
104
|
+
panelRef.current?.focus();
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
const i = seedIndex();
|
|
108
|
+
if (i < 0) panelRef.current?.focus();
|
|
109
|
+
setActiveIdx(i);
|
|
90
110
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
91
111
|
}, [seed]);
|
|
92
112
|
|
|
@@ -160,13 +180,14 @@ export function MenuPanel({ chain, depth, ...motion }: { chain: MenuChain; depth
|
|
|
160
180
|
return i >= 0 ? moveTo(i) : undefined;
|
|
161
181
|
}
|
|
162
182
|
e.preventDefault();
|
|
183
|
+
const activeItem = activeIdx.current >= 0 ? flat[activeIdx.current] : undefined;
|
|
163
184
|
const back = () => (openSubId != null ? closeSub() : cancel());
|
|
164
185
|
const opens = activeItem && !activeItem.disabled && opensLevel(activeItem);
|
|
165
186
|
switch (e.key) {
|
|
166
187
|
case 'ArrowDown':
|
|
167
|
-
return moveTo(stepEnabled(flat, activeIdx, 1));
|
|
188
|
+
return moveTo(stepEnabled(flat, activeIdx.current, 1));
|
|
168
189
|
case 'ArrowUp':
|
|
169
|
-
return moveTo(stepEnabled(flat, activeIdx, -1));
|
|
190
|
+
return moveTo(stepEnabled(flat, activeIdx.current, -1));
|
|
170
191
|
case 'Home':
|
|
171
192
|
return moveTo(edgeEnabled(flat, false));
|
|
172
193
|
case 'End':
|
|
@@ -205,14 +226,13 @@ export function MenuPanel({ chain, depth, ...motion }: { chain: MenuChain; depth
|
|
|
205
226
|
id={menuId + '-item-' + i}
|
|
206
227
|
className="zc-dropdown__item"
|
|
207
228
|
role={radio ? 'menuitemradio' : 'menuitem'}
|
|
208
|
-
tabIndex={
|
|
229
|
+
tabIndex={-1}
|
|
209
230
|
aria-checked={radio ? item.selected : undefined}
|
|
210
231
|
aria-disabled={item.disabled || undefined}
|
|
211
232
|
aria-haspopup={popup ?? undefined}
|
|
212
233
|
aria-expanded={popup ? subOpen : undefined}
|
|
213
234
|
aria-controls={subOpen ? panelId(depth + 1) : undefined}
|
|
214
235
|
aria-keyshortcuts={item.shortcut}
|
|
215
|
-
data-active={i === activeIdx ? 'true' : undefined}
|
|
216
236
|
data-selected={item.selected ? 'true' : undefined}
|
|
217
237
|
data-disabled={item.disabled ? 'true' : undefined}
|
|
218
238
|
data-danger={item.danger ? 'true' : undefined}
|
|
@@ -244,14 +264,16 @@ export function MenuPanel({ chain, depth, ...motion }: { chain: MenuChain; depth
|
|
|
244
264
|
return (
|
|
245
265
|
<>
|
|
246
266
|
<GlidePill className="zc-menu-glide" glide={glide} />
|
|
247
|
-
{
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
267
|
+
<Presence initial={false}>
|
|
268
|
+
{groups.length > 1 || groups[0]?.label
|
|
269
|
+
? groups.map((group, gi) => (
|
|
270
|
+
<div className="zc-dropdown__group" role="group" aria-label={group.label || undefined} key={gi}>
|
|
271
|
+
{group.label && <div className="zc-menu-group-label">{group.label}</div>}
|
|
272
|
+
{group.items.map(renderRow)}
|
|
273
|
+
</div>
|
|
274
|
+
))
|
|
275
|
+
: flat.map(renderRow)}
|
|
276
|
+
</Presence>
|
|
255
277
|
</>
|
|
256
278
|
);
|
|
257
279
|
}
|
|
@@ -259,17 +281,18 @@ export function MenuPanel({ chain, depth, ...motion }: { chain: MenuChain; depth
|
|
|
259
281
|
return (
|
|
260
282
|
<div
|
|
261
283
|
{...(nested ? undefined : chain.htmlProps)}
|
|
262
|
-
{...
|
|
284
|
+
{...menuSurfaceAttrs({ ...chain, width: nested ? 'auto' : chain.width })}
|
|
263
285
|
ref={panelRef as unknown as RefObject<HTMLDivElement>}
|
|
264
286
|
id={menuId}
|
|
265
287
|
className={cx('zc-menu-surface zc-menu-scroller zc-dropdown__menu', !nested && chain.htmlProps?.className)}
|
|
266
288
|
role={contentLevel ? 'dialog' : 'menu'}
|
|
267
289
|
tabIndex={-1}
|
|
268
290
|
aria-label={nested ? undefined : chain.ariaLabel}
|
|
269
|
-
aria-labelledby={
|
|
291
|
+
aria-labelledby={
|
|
292
|
+
nested ? panelId(depth - 1) + '-item-' + level.ownerIdx : chain.ariaLabel ? undefined : chain.triggerId
|
|
293
|
+
}
|
|
270
294
|
data-nested={nested ? 'true' : undefined}
|
|
271
295
|
data-content={contentLevel ? 'true' : undefined}
|
|
272
|
-
data-danger-active={activeItem && activeItem.danger ? 'true' : undefined}
|
|
273
296
|
onKeyDown={contentLevel ? onContentKeyDown : onKeyDown}
|
|
274
297
|
onPointerEnter={() => {
|
|
275
298
|
if (hoverDepth.current > depth) travel.current.from = null;
|
|
@@ -2,7 +2,8 @@ import type { HTMLAttributes, ReactNode, RefObject } from 'react';
|
|
|
2
2
|
|
|
3
3
|
import type { DataAttributes } from '../../../dom-props';
|
|
4
4
|
import { normalizeCollection, type NormalizedGroup } from '../../internal/collection/collection';
|
|
5
|
-
import type { MenuHighlight } from '../../internal/menu/highlight';
|
|
5
|
+
import type { MenuHighlight, MenuSize, MenuWeight, MenuWidth } from '../../internal/menu/highlight';
|
|
6
|
+
import type { VirtualAnchor } from '../../internal/overlay/position';
|
|
6
7
|
import type { ActivateOn } from '../../internal/utils/activation';
|
|
7
8
|
|
|
8
9
|
export interface DropdownItem {
|
|
@@ -14,7 +15,7 @@ export interface DropdownItem {
|
|
|
14
15
|
description?: string;
|
|
15
16
|
/** Your own icon node shown before the label. */
|
|
16
17
|
icon?: ReactNode;
|
|
17
|
-
/** Keyboard hint shown at the trailing edge
|
|
18
|
+
/** Keyboard hint shown at the trailing edge. Display only - you still bind the key. */
|
|
18
19
|
shortcut?: string;
|
|
19
20
|
/** Destructive action - the row reads in the danger hue. @default false */
|
|
20
21
|
danger?: boolean;
|
|
@@ -94,16 +95,21 @@ export function resolveLevels(items: DropdownItems, path: string[]): Level[] {
|
|
|
94
95
|
return levels;
|
|
95
96
|
}
|
|
96
97
|
|
|
97
|
-
export type SeedFocus = 'first' | 'last' | 'none';
|
|
98
|
+
export type SeedFocus = 'first' | 'last' | 'selected' | 'none';
|
|
98
99
|
|
|
99
100
|
export interface MenuChain {
|
|
100
101
|
levels: Level[];
|
|
101
102
|
menuId: string;
|
|
103
|
+
triggerId: string;
|
|
104
|
+
anchor?: VirtualAnchor | null;
|
|
102
105
|
activateOn?: ActivateOn;
|
|
103
106
|
side: 'top' | 'bottom' | 'left' | 'right';
|
|
104
107
|
align: 'start' | 'center' | 'end';
|
|
105
108
|
highlight: MenuHighlight;
|
|
106
109
|
rail: boolean;
|
|
110
|
+
size: MenuSize;
|
|
111
|
+
weight: MenuWeight;
|
|
112
|
+
width: MenuWidth;
|
|
107
113
|
ariaLabel?: string;
|
|
108
114
|
htmlProps?: HTMLAttributes<HTMLDivElement> & DataAttributes;
|
|
109
115
|
seed: { key: string; focus: SeedFocus };
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import './scroll-area.css';
|
|
4
|
+
|
|
5
|
+
import { useImperativeHandle, useRef, type CSSProperties, type ReactNode, type Ref } from 'react';
|
|
6
|
+
|
|
7
|
+
import { motionFor } from '../../../tokens/motion-tokens';
|
|
8
|
+
import { useScrollEdges } from '../../internal/hooks/use-scroll-edges';
|
|
9
|
+
import { Icon } from '../../internal/icon/Icon';
|
|
10
|
+
import { activationProps, type ActivateOn } from '../../internal/utils/activation';
|
|
11
|
+
import { cx } from '../../internal/utils/cx';
|
|
12
|
+
|
|
13
|
+
const SIDES = ['start', 'end'] as const;
|
|
14
|
+
|
|
15
|
+
const scrollBehavior = (el: Element): ScrollBehavior => (motionFor(el).reduced ? 'auto' : 'smooth');
|
|
16
|
+
|
|
17
|
+
export interface ScrollAreaProps {
|
|
18
|
+
/** Scroll direction. `'x'` lays the children out as a rail, one item each, with a paging door
|
|
19
|
+
* on each faded edge for a mouse. @default 'y' */
|
|
20
|
+
axis?: 'x' | 'y';
|
|
21
|
+
/** `'fade'` fades an edge while content hides past it. `'depth'` also shrinks each child as it
|
|
22
|
+
* crosses a faded edge; pass the items as direct children. @default 'fade' */
|
|
23
|
+
variant?: 'fade' | 'depth';
|
|
24
|
+
/** With `axis="x"`, sizes the row to the scroller instead of to its items: `flex: 1` children
|
|
25
|
+
* share its width down to their `min-width` and then scroll, and every child fills its height.
|
|
26
|
+
* For a board or a toolbar. @default false */
|
|
27
|
+
fill?: boolean;
|
|
28
|
+
/** Names the scroller as a region landmark. Omit for an unnamed scroller. */
|
|
29
|
+
ariaLabel?: string;
|
|
30
|
+
/** The element that scrolls: a virtualizer's `getScrollElement`, an IntersectionObserver's
|
|
31
|
+
* `root`, or `scrollTo` for a jump. */
|
|
32
|
+
ref?: Ref<HTMLDivElement>;
|
|
33
|
+
/** When a rail's edge door pages: on `pointerdown` (snappier) or on `click`. @default 'pointerdown' */
|
|
34
|
+
activateOn?: ActivateOn;
|
|
35
|
+
/** Extra class(es) merged onto the root. */
|
|
36
|
+
className?: string;
|
|
37
|
+
/** Inline styles merged onto the root. A `'y'` scroller takes its height or max-height here. */
|
|
38
|
+
style?: CSSProperties;
|
|
39
|
+
/** The scrolled content. */
|
|
40
|
+
children?: ReactNode;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function ScrollArea({
|
|
44
|
+
axis = 'y',
|
|
45
|
+
variant = 'fade',
|
|
46
|
+
fill = false,
|
|
47
|
+
ariaLabel,
|
|
48
|
+
ref,
|
|
49
|
+
activateOn = 'pointerdown',
|
|
50
|
+
className,
|
|
51
|
+
style,
|
|
52
|
+
children,
|
|
53
|
+
}: ScrollAreaProps) {
|
|
54
|
+
const viewportRef = useRef<HTMLDivElement>(null);
|
|
55
|
+
useImperativeHandle(ref, () => viewportRef.current!, []);
|
|
56
|
+
|
|
57
|
+
useScrollEdges(
|
|
58
|
+
viewportRef,
|
|
59
|
+
(edges, el) => {
|
|
60
|
+
const start = axis === 'x' ? edges.left : edges.top;
|
|
61
|
+
const end = axis === 'x' ? edges.right : edges.bottom;
|
|
62
|
+
el.dataset.edges = `${start ? 'start' : ''} ${end ? 'end' : ''}`.trim();
|
|
63
|
+
el.tabIndex = start || end ? 0 : -1;
|
|
64
|
+
},
|
|
65
|
+
{ content: true },
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
const page = (side: (typeof SIDES)[number], door: Element) => {
|
|
69
|
+
const el = viewportRef.current;
|
|
70
|
+
if (!el) return;
|
|
71
|
+
const step = el.clientWidth - 2 * door.clientWidth;
|
|
72
|
+
el.scrollBy({ left: side === 'end' ? step : -step, behavior: scrollBehavior(el) });
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
return (
|
|
76
|
+
<div
|
|
77
|
+
className={cx(
|
|
78
|
+
'zc-scroll-area',
|
|
79
|
+
`zc-scroll-area--${axis}`,
|
|
80
|
+
variant === 'depth' && 'zc-scroll-area--depth',
|
|
81
|
+
axis === 'x' && fill && 'zc-scroll-area--fill',
|
|
82
|
+
className,
|
|
83
|
+
)}
|
|
84
|
+
style={style}
|
|
85
|
+
>
|
|
86
|
+
<div
|
|
87
|
+
ref={viewportRef}
|
|
88
|
+
className="zc-scroll-area__viewport"
|
|
89
|
+
role={ariaLabel ? 'region' : undefined}
|
|
90
|
+
aria-label={ariaLabel}
|
|
91
|
+
onFocus={(e) => {
|
|
92
|
+
if (e.target === e.currentTarget || !e.target.matches(':focus-visible')) return;
|
|
93
|
+
e.target.scrollIntoView({ block: 'nearest', inline: 'nearest', behavior: scrollBehavior(e.currentTarget) });
|
|
94
|
+
}}
|
|
95
|
+
>
|
|
96
|
+
<div className="zc-scroll-area__content">{children}</div>
|
|
97
|
+
</div>
|
|
98
|
+
{axis === 'x' &&
|
|
99
|
+
SIDES.map((side) => (
|
|
100
|
+
<div
|
|
101
|
+
key={side}
|
|
102
|
+
className="zc-scroll-area__door"
|
|
103
|
+
data-side={side}
|
|
104
|
+
aria-hidden
|
|
105
|
+
{...activationProps((e) => page(side, e.currentTarget), { on: activateOn, holdFocus: true })}
|
|
106
|
+
>
|
|
107
|
+
<span className="zc-scroll-area__chip">
|
|
108
|
+
<Icon name={side === 'start' ? 'caret-left' : 'caret-right'} size="sm" />
|
|
109
|
+
</span>
|
|
110
|
+
</div>
|
|
111
|
+
))}
|
|
112
|
+
</div>
|
|
113
|
+
);
|
|
114
|
+
}
|