@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,71 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useEffect, useLayoutEffect, useRef, useState } from 'react';
|
|
4
|
+
|
|
5
|
+
import { UIMotion } from '../../../tokens/motion-tokens';
|
|
6
|
+
import { cx } from '../../internal/utils/cx';
|
|
7
|
+
|
|
8
|
+
const DROP_GRACE_MS = 80;
|
|
9
|
+
|
|
10
|
+
interface Word {
|
|
11
|
+
key: number;
|
|
12
|
+
label: string;
|
|
13
|
+
cls: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function MorphLabel({ label }: { label: string }) {
|
|
17
|
+
const prev = useRef(label);
|
|
18
|
+
const keyRef = useRef(1);
|
|
19
|
+
const ghostRef = useRef<HTMLSpanElement>(null);
|
|
20
|
+
const [words, setWords] = useState<Word[]>([{ key: 0, label, cls: '' }]);
|
|
21
|
+
const [boxW, setBoxW] = useState<number>();
|
|
22
|
+
|
|
23
|
+
useLayoutEffect(() => {
|
|
24
|
+
let live = true;
|
|
25
|
+
const measure = () => {
|
|
26
|
+
if (live && ghostRef.current) setBoxW(ghostRef.current.offsetWidth);
|
|
27
|
+
};
|
|
28
|
+
measure();
|
|
29
|
+
document.fonts?.ready.then(measure);
|
|
30
|
+
return () => {
|
|
31
|
+
live = false;
|
|
32
|
+
};
|
|
33
|
+
}, []);
|
|
34
|
+
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
if (prev.current === label) return;
|
|
37
|
+
prev.current = label;
|
|
38
|
+
const nk = keyRef.current++;
|
|
39
|
+
const nextW = ghostRef.current?.offsetWidth;
|
|
40
|
+
|
|
41
|
+
setWords((ws) => ws.concat({ key: nk, label, cls: 'zc-badge__word--in' }));
|
|
42
|
+
const raf = requestAnimationFrame(() =>
|
|
43
|
+
requestAnimationFrame(() => {
|
|
44
|
+
setWords((ws) => ws.map((w) => (w.key === nk ? { ...w, cls: '' } : { ...w, cls: 'zc-badge__word--out' })));
|
|
45
|
+
if (nextW) setBoxW(nextW);
|
|
46
|
+
}),
|
|
47
|
+
);
|
|
48
|
+
const drop = setTimeout(
|
|
49
|
+
() => setWords((ws) => ws.filter((w) => !w.cls.includes('--out'))),
|
|
50
|
+
UIMotion.dur.base * 1000 + DROP_GRACE_MS,
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
return () => {
|
|
54
|
+
cancelAnimationFrame(raf);
|
|
55
|
+
clearTimeout(drop);
|
|
56
|
+
};
|
|
57
|
+
}, [label]);
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<span className="zc-badge__morph" style={boxW ? { width: boxW } : undefined}>
|
|
61
|
+
<span className="zc-badge__ghost" ref={ghostRef} aria-hidden="true">
|
|
62
|
+
{label}
|
|
63
|
+
</span>
|
|
64
|
+
{words.map((w) => (
|
|
65
|
+
<span key={w.key} className={cx('zc-badge__word', w.cls)}>
|
|
66
|
+
{w.label}
|
|
67
|
+
</span>
|
|
68
|
+
))}
|
|
69
|
+
</span>
|
|
70
|
+
);
|
|
71
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useEffect, useRef, type RefObject } from 'react';
|
|
4
|
+
|
|
5
|
+
import { fireGlint } from '../../internal/glass/glint';
|
|
6
|
+
|
|
7
|
+
export function useGlintOnChange(ref: RefObject<HTMLElement | null>, value: string, enabled: boolean) {
|
|
8
|
+
const prev = useRef(value);
|
|
9
|
+
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
if (prev.current === value) return;
|
|
12
|
+
prev.current = value;
|
|
13
|
+
if (!enabled || !ref.current) return;
|
|
14
|
+
return fireGlint(ref.current);
|
|
15
|
+
}, [ref, value, enabled]);
|
|
16
|
+
}
|
|
@@ -6,18 +6,16 @@ import type { DataAttributes } from '../../../dom-props';
|
|
|
6
6
|
import { usePressFeedback } from '../../internal/hooks/use-press-feedback';
|
|
7
7
|
import { cx } from '../../internal/utils/cx';
|
|
8
8
|
import { Spinner } from '../spinner/Spinner';
|
|
9
|
-
import { buttonClass, type
|
|
9
|
+
import { buttonClass, type ButtonStyleProps, type ButtonVariant } from './button-style';
|
|
10
10
|
|
|
11
11
|
export { buttonClass } from './button-style';
|
|
12
12
|
export type { ButtonSize, ButtonStyleProps, ButtonVariant } from './button-style';
|
|
13
13
|
|
|
14
|
-
interface ButtonOwnProps {
|
|
14
|
+
interface ButtonOwnProps extends Pick<ButtonStyleProps, 'size' | 'iconOnly' | 'fullWidth'> {
|
|
15
15
|
/** Visual weight / intent. @default 'primary' */
|
|
16
16
|
variant?: ButtonVariant;
|
|
17
17
|
/** Forwarded to the underlying <button> (React 19 ref-as-prop). */
|
|
18
18
|
ref?: Ref<HTMLButtonElement>;
|
|
19
|
-
/** Control height. sm 28px - md 32px (default) - lg 37px. @default 'md' */
|
|
20
|
-
size?: ButtonSize;
|
|
21
19
|
/** `submit` / `reset` / `button`. @default 'button' */
|
|
22
20
|
type?: 'button' | 'submit' | 'reset';
|
|
23
21
|
/** Disable the control (also implied by `loading`). */
|
|
@@ -25,13 +23,11 @@ interface ButtonOwnProps {
|
|
|
25
23
|
/** Loading - swaps the label for a spinner and makes the button inert. The label stays
|
|
26
24
|
* mounted but invisible, so the button holds its width. */
|
|
27
25
|
loading?: boolean;
|
|
28
|
-
/** Stretch to fill the container width. */
|
|
29
|
-
fullWidth?: boolean;
|
|
30
26
|
/** Extra class(es) merged onto the button. */
|
|
31
27
|
className?: string;
|
|
32
28
|
/** Inline styles merged onto the button. */
|
|
33
29
|
style?: CSSProperties;
|
|
34
|
-
/** Button label. */
|
|
30
|
+
/** Button label. An svg child takes the size's glyph; a class or style of your own on it wins. */
|
|
35
31
|
children?: ReactNode;
|
|
36
32
|
}
|
|
37
33
|
|
|
@@ -53,6 +49,7 @@ export interface ButtonProps extends ButtonOwnProps, ButtonRestProps {
|
|
|
53
49
|
export function Button({
|
|
54
50
|
variant = 'primary',
|
|
55
51
|
size = 'md',
|
|
52
|
+
iconOnly = false,
|
|
56
53
|
type = 'button',
|
|
57
54
|
disabled = false,
|
|
58
55
|
loading = false,
|
|
@@ -66,7 +63,7 @@ export function Button({
|
|
|
66
63
|
}: ButtonProps) {
|
|
67
64
|
const inert = disabled || loading;
|
|
68
65
|
const press = usePressFeedback(inert);
|
|
69
|
-
const cls = cx(buttonClass({ variant, size, fullWidth, className }), loading && 'zc-is-loading');
|
|
66
|
+
const cls = cx(buttonClass({ variant, size, iconOnly, fullWidth, className }), loading && 'zc-is-loading');
|
|
70
67
|
const merged = { ...rest, ...htmlProps };
|
|
71
68
|
|
|
72
69
|
return (
|
|
@@ -5,10 +5,11 @@ Docs: https://ui.zyncat.app/button
|
|
|
5
5
|
|
|
6
6
|
One control for every click; exactly one primary per view.
|
|
7
7
|
|
|
8
|
-
variant primary|secondary|ghost|danger|link, size sm|md|lg|
|
|
9
|
-
children - Button lays them out in a centered row with gap
|
|
8
|
+
variant primary|secondary|ghost|danger|link, size xs|sm|md|lg|xl, iconOnly, loading, disabled. Icons
|
|
9
|
+
are plain children - Button lays them out in a centered row with gap and sizes an svg to the size's
|
|
10
|
+
glyph, no iconLeft/iconRight slots.
|
|
10
11
|
|
|
11
12
|
```tsx
|
|
12
|
-
<Button variant="primary"><
|
|
13
|
-
<Button size="
|
|
13
|
+
<Button variant="primary"><PlusIcon />Schedule post</Button>
|
|
14
|
+
<Button size="sm" iconOnly aria-label="Close"><XIcon /></Button>
|
|
14
15
|
```
|
|
@@ -3,25 +3,31 @@ import './button.css';
|
|
|
3
3
|
import { cx } from '../../internal/utils/cx';
|
|
4
4
|
|
|
5
5
|
export type ButtonVariant = 'primary' | 'secondary' | 'ghost' | 'danger' | 'link';
|
|
6
|
-
export type ButtonSize = 'sm' | 'md' | 'lg' | '
|
|
6
|
+
export type ButtonSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
7
7
|
|
|
8
8
|
export interface ButtonStyleProps {
|
|
9
9
|
/** Visual weight / intent. Omit for base chrome only - sizing, focus ring, layout -
|
|
10
10
|
* with no skin, for a local re-skin through `className`. */
|
|
11
11
|
variant?: ButtonVariant;
|
|
12
|
-
/** Control height
|
|
13
|
-
size
|
|
12
|
+
/** Control height: the `--control-height-*` step, so it lines up with a field of the same size.
|
|
13
|
+
* Type, padding and glyph step with it. `'icon'` is deprecated: it is `size="sm" iconOnly`.
|
|
14
|
+
* @default 'md' */
|
|
15
|
+
size?: ButtonSize | 'icon';
|
|
16
|
+
/** A square of the control height for one glyph. Name it with `aria-label`. @default false */
|
|
17
|
+
iconOnly?: boolean;
|
|
14
18
|
/** Stretch to fill the container width. */
|
|
15
19
|
fullWidth?: boolean;
|
|
16
20
|
/** Extra class(es) merged onto the result. */
|
|
17
21
|
className?: string;
|
|
18
22
|
}
|
|
19
23
|
|
|
20
|
-
export function buttonClass({ variant, size = 'md', fullWidth, className }: ButtonStyleProps = {}): string {
|
|
24
|
+
export function buttonClass({ variant, size = 'md', iconOnly, fullWidth, className }: ButtonStyleProps = {}): string {
|
|
25
|
+
const step = size === 'icon' ? 'sm' : size;
|
|
21
26
|
return cx(
|
|
22
27
|
'zc-btn',
|
|
23
28
|
variant && `zc-btn--${variant}`,
|
|
24
|
-
|
|
29
|
+
step !== 'md' && `zc-btn--${step}`,
|
|
30
|
+
(iconOnly || size === 'icon') && 'zc-btn--icon',
|
|
25
31
|
fullWidth && 'zc-btn--block',
|
|
26
32
|
className,
|
|
27
33
|
);
|
|
@@ -13,6 +13,8 @@
|
|
|
13
13
|
|
|
14
14
|
@layer zyncat.components {
|
|
15
15
|
.zc-btn {
|
|
16
|
+
--btn-h: var(--control-height);
|
|
17
|
+
--btn-glyph: calc((var(--btn-h) - var(--space-1)) / 2);
|
|
16
18
|
--btn-shadow: none;
|
|
17
19
|
--btn-ring: var(--ring-accent);
|
|
18
20
|
--btn-gap: var(--space-2);
|
|
@@ -26,7 +28,7 @@
|
|
|
26
28
|
justify-content: center;
|
|
27
29
|
gap: var(--btn-gap);
|
|
28
30
|
|
|
29
|
-
height: var(--
|
|
31
|
+
height: var(--btn-h);
|
|
30
32
|
padding: 0 var(--space-4);
|
|
31
33
|
border: var(--border-hairline) solid transparent;
|
|
32
34
|
border-radius: var(--radius-md);
|
|
@@ -43,7 +45,6 @@
|
|
|
43
45
|
cursor: pointer;
|
|
44
46
|
user-select: none;
|
|
45
47
|
-webkit-user-select: none;
|
|
46
|
-
-webkit-tap-highlight-color: transparent;
|
|
47
48
|
appearance: none;
|
|
48
49
|
box-shadow: var(--btn-shadow);
|
|
49
50
|
|
|
@@ -68,26 +69,35 @@
|
|
|
68
69
|
transform: scale(var(--btn-press-scale));
|
|
69
70
|
}
|
|
70
71
|
|
|
72
|
+
.zc-btn--xs,
|
|
71
73
|
.zc-btn--sm {
|
|
72
|
-
|
|
73
|
-
padding: 0 var(--space-3);
|
|
74
|
+
--btn-gap: var(--space-1);
|
|
74
75
|
font-size: var(--size-caption);
|
|
75
76
|
border-radius: var(--radius-sm);
|
|
76
|
-
|
|
77
|
+
}
|
|
78
|
+
.zc-btn--xs {
|
|
79
|
+
--btn-h: var(--control-height-xs);
|
|
80
|
+
padding: 0 var(--space-2);
|
|
81
|
+
}
|
|
82
|
+
.zc-btn--sm {
|
|
83
|
+
--btn-h: var(--control-height-sm);
|
|
84
|
+
padding: 0 var(--space-3);
|
|
77
85
|
}
|
|
78
86
|
.zc-btn--lg {
|
|
79
|
-
|
|
87
|
+
--btn-h: var(--control-height-lg);
|
|
80
88
|
padding: 0 var(--space-5);
|
|
81
|
-
|
|
89
|
+
}
|
|
90
|
+
.zc-btn--xl {
|
|
91
|
+
--btn-h: var(--control-height-xl);
|
|
92
|
+
padding: 0 var(--space-6);
|
|
93
|
+
font-size: var(--size-body-lg);
|
|
82
94
|
}
|
|
83
95
|
.zc-btn--block {
|
|
84
96
|
width: 100%;
|
|
85
97
|
}
|
|
86
98
|
.zc-btn--icon {
|
|
87
|
-
width: var(--
|
|
88
|
-
height: var(--control-height-sm);
|
|
99
|
+
width: var(--btn-h);
|
|
89
100
|
padding: 0;
|
|
90
|
-
border-radius: var(--radius-sm);
|
|
91
101
|
}
|
|
92
102
|
|
|
93
103
|
.zc-btn__label {
|
|
@@ -96,22 +106,10 @@
|
|
|
96
106
|
gap: var(--btn-gap);
|
|
97
107
|
}
|
|
98
108
|
|
|
99
|
-
.zc-
|
|
100
|
-
display: inline-flex;
|
|
109
|
+
.zc-btn__label > svg {
|
|
101
110
|
flex: none;
|
|
102
|
-
width:
|
|
103
|
-
height:
|
|
104
|
-
}
|
|
105
|
-
.zc-btn__icon svg {
|
|
106
|
-
display: block;
|
|
107
|
-
width: 100%;
|
|
108
|
-
height: 100%;
|
|
109
|
-
}
|
|
110
|
-
.zc-btn__icon:first-child {
|
|
111
|
-
margin-left: calc(var(--space-1) * -1);
|
|
112
|
-
}
|
|
113
|
-
.zc-btn__icon:last-child {
|
|
114
|
-
margin-right: calc(var(--space-1) * -1);
|
|
111
|
+
width: var(--btn-glyph);
|
|
112
|
+
height: var(--btn-glyph);
|
|
115
113
|
}
|
|
116
114
|
|
|
117
115
|
.zc-btn--primary {
|
|
@@ -273,8 +271,7 @@
|
|
|
273
271
|
text-decoration: none;
|
|
274
272
|
}
|
|
275
273
|
|
|
276
|
-
.zc-btn.zc-is-loading .zc-btn__label
|
|
277
|
-
.zc-btn.zc-is-loading .zc-btn__icon {
|
|
274
|
+
.zc-btn.zc-is-loading .zc-btn__label {
|
|
278
275
|
opacity: 0;
|
|
279
276
|
}
|
|
280
277
|
.zc-btn__spinner {
|
|
@@ -33,8 +33,9 @@ interface CollapseOwnProps extends TimingProps {
|
|
|
33
33
|
axis?: 'height' | 'width';
|
|
34
34
|
/** Also cross-fade contents while resizing; follows `duration` / `ease`. */
|
|
35
35
|
fade?: boolean;
|
|
36
|
-
/** Class applied to the inner
|
|
37
|
-
*
|
|
36
|
+
/** Class applied to the inner wrapper - the clipping element (`overflow: clip` on the animated
|
|
37
|
+
* axis). Its padding stays while closed, so content whose focus ring sits flush to the clipped
|
|
38
|
+
* edge gets its room as `var(--ring-gutter)` of padding on a child. */
|
|
38
39
|
innerClassName?: string;
|
|
39
40
|
/** Size (and fade) transition timing - motion tokens only, each field one token or
|
|
40
41
|
* `{ open, close }`, e.g. `{ duration: { close: 'fast' }, ease: { close: 'exit' } }`.
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
import './input.css';
|
|
4
4
|
|
|
5
|
-
import { useId
|
|
5
|
+
import { useId } from 'react';
|
|
6
6
|
import type { CSSProperties, InputHTMLAttributes } from 'react';
|
|
7
7
|
|
|
8
8
|
import type { DataAttributes } from '../../../dom-props';
|
|
9
|
-
import {
|
|
9
|
+
import { useHoldRepeat } from '../../internal/hooks/use-hold-repeat';
|
|
10
10
|
import { Icon } from '../../internal/icon/Icon';
|
|
11
11
|
import { cx } from '../../internal/utils/cx';
|
|
12
12
|
import {
|
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
type FieldCoreMessagingProps,
|
|
18
18
|
type FieldIdProps,
|
|
19
19
|
} from './field-chrome';
|
|
20
|
+
import { useNumberValue } from './use-number-value';
|
|
20
21
|
|
|
21
22
|
interface NumberFieldOwnProps extends FieldIdProps, FieldCoreMessagingProps {
|
|
22
23
|
/** Unit suffix shown inside the field (e.g. "days", "%"). */
|
|
@@ -25,7 +26,7 @@ interface NumberFieldOwnProps extends FieldIdProps, FieldCoreMessagingProps {
|
|
|
25
26
|
min?: number;
|
|
26
27
|
/** Maximum value - steps and committed typing clamp down to this; the increase stepper disables here. @default Infinity */
|
|
27
28
|
max?: number;
|
|
28
|
-
/** Amount added/removed per ArrowUp/ArrowDown press and per
|
|
29
|
+
/** Amount added/removed per ArrowUp/ArrowDown press and per minus/plus click; holding a button repeats it. Decimals work. @default 1 */
|
|
29
30
|
step?: number;
|
|
30
31
|
/** Controlled numeric value. Omit for uncontrolled (use `defaultValue`). */
|
|
31
32
|
value?: number | string;
|
|
@@ -52,6 +53,12 @@ export interface NumberFieldProps extends NumberFieldOwnProps {
|
|
|
52
53
|
DataAttributes;
|
|
53
54
|
}
|
|
54
55
|
|
|
56
|
+
const STEPPERS = [
|
|
57
|
+
{ direction: -1, label: 'Decrease', icon: 'minus' },
|
|
58
|
+
{ direction: 1, label: 'Increase', icon: 'plus' },
|
|
59
|
+
] as const;
|
|
60
|
+
const ARROW_STEP: Partial<Record<string, 1 | -1>> = { ArrowUp: 1, ArrowDown: -1 };
|
|
61
|
+
|
|
55
62
|
export function NumberField({
|
|
56
63
|
id,
|
|
57
64
|
label,
|
|
@@ -71,22 +78,14 @@ export function NumberField({
|
|
|
71
78
|
htmlProps,
|
|
72
79
|
}: NumberFieldProps) {
|
|
73
80
|
const autoId = useId();
|
|
81
|
+
const fieldId = id ?? autoId;
|
|
74
82
|
const message = error || helper;
|
|
75
|
-
const msgId = fieldMessageId(
|
|
76
|
-
const
|
|
77
|
-
const
|
|
78
|
-
const [draft, setDraft] = useState<string | null>(null);
|
|
79
|
-
const v = draft !== null ? parseFloat(draft) || 0 : num;
|
|
80
|
-
const snap = (n: number) => parseFloat(n.toFixed(10));
|
|
81
|
-
const clamp = (n: number) => Math.min(max, Math.max(min, snap(n)));
|
|
82
|
-
const commit = (n: number) => {
|
|
83
|
-
setDraft(null);
|
|
84
|
-
setNum(clamp(n));
|
|
85
|
-
};
|
|
83
|
+
const msgId = fieldMessageId(fieldId, message);
|
|
84
|
+
const { v, text, commit, stepBy, type } = useNumberValue({ value, defaultValue, onChange, min, max, step });
|
|
85
|
+
const holdStep = useHoldRepeat(stepBy);
|
|
86
86
|
const cls = cx(
|
|
87
87
|
'zc-fld',
|
|
88
88
|
'zc-numf',
|
|
89
|
-
unit && 'zc-numf--unit',
|
|
90
89
|
size === 'sm' ? 'zc-fld--sm' : size === 'lg' ? 'zc-fld--lg' : '',
|
|
91
90
|
error && 'zc-is-error',
|
|
92
91
|
className,
|
|
@@ -94,30 +93,30 @@ export function NumberField({
|
|
|
94
93
|
|
|
95
94
|
return (
|
|
96
95
|
<div className={cls} style={style}>
|
|
97
|
-
<FieldLabel id={
|
|
98
|
-
<div
|
|
96
|
+
<FieldLabel id={fieldId} label={label} />
|
|
97
|
+
<div
|
|
98
|
+
className="zc-fld__control"
|
|
99
|
+
style={{ '--numf-len': text.length, '--numf-unit-len': unit?.length } as CSSProperties}
|
|
100
|
+
>
|
|
99
101
|
<input
|
|
100
|
-
id={
|
|
102
|
+
id={fieldId}
|
|
101
103
|
className="zc-fld__input"
|
|
102
104
|
type="text"
|
|
103
105
|
inputMode="decimal"
|
|
106
|
+
role="spinbutton"
|
|
107
|
+
aria-valuenow={v}
|
|
108
|
+
aria-valuemin={min}
|
|
109
|
+
aria-valuemax={max === Infinity ? undefined : max}
|
|
104
110
|
disabled={disabled}
|
|
105
111
|
aria-invalid={error ? true : undefined}
|
|
106
|
-
value={
|
|
107
|
-
onChange={(e) =>
|
|
108
|
-
const text = e.target.value.replace(/[^\d.-]/g, '');
|
|
109
|
-
setDraft(text);
|
|
110
|
-
setNum(clamp(parseFloat(text) || 0));
|
|
111
|
-
}}
|
|
112
|
+
value={text}
|
|
113
|
+
onChange={(e) => type(e.target.value)}
|
|
112
114
|
onBlur={() => commit(v)}
|
|
113
115
|
onKeyDown={(e) => {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
commit(v + step);
|
|
117
|
-
}
|
|
118
|
-
if (e.key === 'ArrowDown') {
|
|
116
|
+
const direction = ARROW_STEP[e.key];
|
|
117
|
+
if (direction) {
|
|
119
118
|
e.preventDefault();
|
|
120
|
-
|
|
119
|
+
stepBy(direction);
|
|
121
120
|
}
|
|
122
121
|
if (e.key === 'Enter') commit(v);
|
|
123
122
|
}}
|
|
@@ -125,26 +124,19 @@ export function NumberField({
|
|
|
125
124
|
aria-describedby={joinIds(msgId, htmlProps?.['aria-describedby'])}
|
|
126
125
|
/>
|
|
127
126
|
{unit && <span className="zc-numf__unit">{unit}</span>}
|
|
128
|
-
|
|
129
|
-
<button
|
|
130
|
-
type="button"
|
|
131
|
-
className="zc-numf__step"
|
|
132
|
-
aria-label="Increase"
|
|
133
|
-
disabled={disabled || v >= max}
|
|
134
|
-
onClick={() => commit(v + step)}
|
|
135
|
-
>
|
|
136
|
-
<Icon name="caret-up" size="sm" />
|
|
137
|
-
</button>
|
|
127
|
+
{STEPPERS.map(({ direction, label, icon }) => (
|
|
138
128
|
<button
|
|
129
|
+
key={icon}
|
|
139
130
|
type="button"
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
131
|
+
tabIndex={-1}
|
|
132
|
+
className={`zc-numf__step zc-numf__step--${icon}`}
|
|
133
|
+
aria-label={label}
|
|
134
|
+
disabled={disabled || (direction > 0 ? v >= max : v <= min)}
|
|
135
|
+
{...holdStep(direction)}
|
|
144
136
|
>
|
|
145
|
-
<Icon name=
|
|
137
|
+
<Icon name={icon} size="sm" />
|
|
146
138
|
</button>
|
|
147
|
-
|
|
139
|
+
))}
|
|
148
140
|
</div>
|
|
149
141
|
<FieldMessage id={msgId} message={message} icon={error ? 'warning-circle' : null} />
|
|
150
142
|
</div>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import './input.css';
|
|
4
4
|
|
|
5
|
-
import { useRef } from 'react';
|
|
5
|
+
import { useLayoutEffect, useRef } from 'react';
|
|
6
6
|
import type {
|
|
7
7
|
ChangeEvent,
|
|
8
8
|
ClipboardEvent,
|
|
@@ -15,8 +15,13 @@ import type {
|
|
|
15
15
|
} from 'react';
|
|
16
16
|
|
|
17
17
|
import type { DataAttributes } from '../../../dom-props';
|
|
18
|
+
import { animate } from '../../../engine';
|
|
19
|
+
import { motionFor } from '../../../tokens/motion-tokens';
|
|
18
20
|
import { cx } from '../../internal/utils/cx';
|
|
19
21
|
|
|
22
|
+
const ACCEPT_LIFT = 1.08;
|
|
23
|
+
const ACCEPT_STAGGER = 0.03;
|
|
24
|
+
|
|
20
25
|
interface OtpFieldOwnProps {
|
|
21
26
|
/** Number of slots. @default 6 */
|
|
22
27
|
length?: number;
|
|
@@ -28,10 +33,14 @@ interface OtpFieldOwnProps {
|
|
|
28
33
|
group?: number;
|
|
29
34
|
/** Error state (red slots + ring). */
|
|
30
35
|
error?: boolean;
|
|
36
|
+
/** Accepted state: the slots take the accent, and a ripple runs across them as it turns on. */
|
|
37
|
+
success?: boolean;
|
|
38
|
+
/** Keep the digits on show but refuse edits - while the code is being checked. */
|
|
39
|
+
readOnly?: boolean;
|
|
31
40
|
/** Disable every slot. */
|
|
32
41
|
disabled?: boolean;
|
|
33
|
-
/**
|
|
34
|
-
size?: 'sm';
|
|
42
|
+
/** Slot width, height and digit type. @default 'md' */
|
|
43
|
+
size?: 'sm' | 'md';
|
|
35
44
|
/** Extra class(es) appended to the root wrapper. */
|
|
36
45
|
className?: string;
|
|
37
46
|
/** Inline styles merged onto the root wrapper. */
|
|
@@ -49,13 +58,29 @@ export function OtpField({
|
|
|
49
58
|
onChange,
|
|
50
59
|
group,
|
|
51
60
|
error,
|
|
61
|
+
success,
|
|
62
|
+
readOnly,
|
|
52
63
|
disabled,
|
|
53
|
-
size,
|
|
64
|
+
size = 'md',
|
|
54
65
|
className = '',
|
|
55
66
|
style,
|
|
56
67
|
htmlProps,
|
|
57
68
|
}: OtpFieldProps) {
|
|
58
69
|
const refs = useRef<(HTMLInputElement | null)[]>([]);
|
|
70
|
+
const accepted = useRef(Boolean(success));
|
|
71
|
+
useLayoutEffect(() => {
|
|
72
|
+
const was = accepted.current;
|
|
73
|
+
accepted.current = Boolean(success);
|
|
74
|
+
if (!success || was) return;
|
|
75
|
+
refs.current.forEach((slot, i) => {
|
|
76
|
+
if (!slot) return;
|
|
77
|
+
const motion = motionFor(slot);
|
|
78
|
+
animate(slot, {
|
|
79
|
+
scale: [1, ACCEPT_LIFT, 1],
|
|
80
|
+
timing: { duration: motion.dur.moderate, ease: motion.ease.entrance, delay: i * ACCEPT_STAGGER },
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
}, [success]);
|
|
59
84
|
const chars = String(value).slice(0, length).padEnd(length).split('');
|
|
60
85
|
const emit = (s: string) => onChange && onChange(s.replace(/ +$/, '').slice(0, length));
|
|
61
86
|
const setAt = (i: number, ch: string) => {
|
|
@@ -77,8 +102,22 @@ export function OtpField({
|
|
|
77
102
|
caretEnd(el);
|
|
78
103
|
}
|
|
79
104
|
};
|
|
105
|
+
const fill = (i: number, digits: string) => {
|
|
106
|
+
if (!digits) return;
|
|
107
|
+
const start = Math.max(0, Math.min(i, length - digits.length));
|
|
108
|
+
const a = chars.slice();
|
|
109
|
+
for (let k = 0; k < digits.length && start + k < length; k++) a[start + k] = digits[k];
|
|
110
|
+
emit(a.join(''));
|
|
111
|
+
go(Math.min(start + digits.length, length - 1));
|
|
112
|
+
};
|
|
80
113
|
|
|
81
|
-
const cls = cx(
|
|
114
|
+
const cls = cx(
|
|
115
|
+
'zc-otp',
|
|
116
|
+
size === 'sm' && 'zc-otp--sm',
|
|
117
|
+
error && 'zc-is-error',
|
|
118
|
+
success && 'zc-is-success',
|
|
119
|
+
className,
|
|
120
|
+
);
|
|
82
121
|
|
|
83
122
|
const cells: ReactNode[] = [];
|
|
84
123
|
for (let i = 0; i < length; i++) {
|
|
@@ -93,7 +132,9 @@ export function OtpField({
|
|
|
93
132
|
inputMode="numeric"
|
|
94
133
|
autoComplete="one-time-code"
|
|
95
134
|
disabled={disabled}
|
|
135
|
+
readOnly={readOnly}
|
|
96
136
|
aria-invalid={error || undefined}
|
|
137
|
+
style={{ '--_otp-delay': `${i * ACCEPT_STAGGER}s` } as CSSProperties}
|
|
97
138
|
value={chars[i].trim()}
|
|
98
139
|
data-filled={chars[i].trim() ? 'true' : 'false'}
|
|
99
140
|
onFocus={(e: FocusEvent<HTMLInputElement>) => caretEnd(e.target)}
|
|
@@ -102,9 +143,11 @@ export function OtpField({
|
|
|
102
143
|
go(i);
|
|
103
144
|
}}
|
|
104
145
|
onChange={(e: ChangeEvent<HTMLInputElement>) => {
|
|
105
|
-
const
|
|
106
|
-
setAt(i,
|
|
107
|
-
|
|
146
|
+
const digits = e.target.value.replace(/[^\d]/g, '');
|
|
147
|
+
if (!digits) return setAt(i, '');
|
|
148
|
+
const prev = chars[i].trim();
|
|
149
|
+
const added = prev && digits.startsWith(prev) ? digits.slice(prev.length) : digits;
|
|
150
|
+
fill(i, added || prev);
|
|
108
151
|
}}
|
|
109
152
|
onKeyDown={(e: KeyboardEvent<HTMLInputElement>) => {
|
|
110
153
|
if (e.key === 'Backspace' && !chars[i].trim() && i > 0) {
|
|
@@ -121,9 +164,7 @@ export function OtpField({
|
|
|
121
164
|
}}
|
|
122
165
|
onPaste={(e: ClipboardEvent<HTMLInputElement>) => {
|
|
123
166
|
e.preventDefault();
|
|
124
|
-
|
|
125
|
-
emit(chars.slice(0, i).join('') + d);
|
|
126
|
-
refs.current[Math.min(i + d.length, length - 1)]?.focus();
|
|
167
|
+
fill(i, (e.clipboardData.getData('text') || '').replace(/[^\d]/g, ''));
|
|
127
168
|
}}
|
|
128
169
|
/>,
|
|
129
170
|
);
|
|
@@ -5,7 +5,8 @@ Docs: https://ui.zyncat.app/otp-field
|
|
|
5
5
|
|
|
6
6
|
Segmented one-time code; auto-advance, paste-to-fill.
|
|
7
7
|
|
|
8
|
-
length, group, error, size.
|
|
8
|
+
length, group, error, success, readOnly, size. `success` tints the slots with the accent and
|
|
9
|
+
ripples across them as it turns on; `readOnly` holds the digits while the code is checked.
|
|
9
10
|
|
|
10
11
|
```tsx
|
|
11
12
|
<OtpField length={6} group={3} value={code} onChange={setCode} />
|
|
@@ -37,7 +37,7 @@ interface TextFieldOwnProps extends FieldMessagingProps, TextFieldNative {
|
|
|
37
37
|
leadingIcon?: ReactNode;
|
|
38
38
|
/** Show a clear button when there's a value. */
|
|
39
39
|
clearable?: boolean;
|
|
40
|
-
/** Control height:
|
|
40
|
+
/** Control height: the `--control-height-*` step of the same name, md by default. */
|
|
41
41
|
size?: 'sm' | 'md' | 'lg';
|
|
42
42
|
/** Extra class(es) merged onto the field root. */
|
|
43
43
|
className?: string;
|
|
@@ -71,7 +71,8 @@ export function TextField({
|
|
|
71
71
|
const { state, msg, msgIcon } = resolveFieldMessage(error, warning, success, helper);
|
|
72
72
|
const inputRef = useRef<HTMLInputElement>(null);
|
|
73
73
|
const autoId = useId();
|
|
74
|
-
const
|
|
74
|
+
const fieldId = rest.id ?? autoId;
|
|
75
|
+
const msgId = fieldMessageId(fieldId, msg);
|
|
75
76
|
const showClear = clearable && value && !rest.disabled && !rest.readOnly;
|
|
76
77
|
|
|
77
78
|
function clear() {
|
|
@@ -93,7 +94,7 @@ export function TextField({
|
|
|
93
94
|
|
|
94
95
|
return (
|
|
95
96
|
<div className={cls} style={style}>
|
|
96
|
-
<FieldLabel id={
|
|
97
|
+
<FieldLabel id={fieldId} label={label} required={rest.required} optional={optional} />
|
|
97
98
|
<div className="zc-fld__control">
|
|
98
99
|
{leadingIcon && (
|
|
99
100
|
<span className="zc-fld__icon zc-fld__icon--lead">
|
|
@@ -106,6 +107,7 @@ export function TextField({
|
|
|
106
107
|
value={value}
|
|
107
108
|
aria-invalid={error ? true : undefined}
|
|
108
109
|
{...rest}
|
|
110
|
+
id={fieldId}
|
|
109
111
|
{...htmlProps}
|
|
110
112
|
aria-describedby={joinIds(msgId, htmlProps?.['aria-describedby'])}
|
|
111
113
|
/>
|
|
@@ -38,12 +38,13 @@ export interface FieldMessagingProps extends FieldIdProps, FieldRequirementProps
|
|
|
38
38
|
export interface FieldLabelProps extends FieldIdProps, FieldRequirementProps {
|
|
39
39
|
/** Label text (sentence case). */
|
|
40
40
|
label?: ReactNode;
|
|
41
|
+
labelId?: string;
|
|
41
42
|
}
|
|
42
43
|
|
|
43
|
-
export function FieldLabel({ id, label, required, optional }: FieldLabelProps) {
|
|
44
|
+
export function FieldLabel({ id, labelId, label, required, optional }: FieldLabelProps) {
|
|
44
45
|
if (!label) return null;
|
|
45
46
|
return (
|
|
46
|
-
<label className="zc-fld__label" htmlFor={id}>
|
|
47
|
+
<label className="zc-fld__label" id={labelId} htmlFor={id}>
|
|
47
48
|
{label}
|
|
48
49
|
{required && (
|
|
49
50
|
<span className="zc-fld__req" aria-hidden="true">
|