@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,72 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import './date-picker.css';
|
|
4
|
+
import './range-sheet.css';
|
|
5
|
+
import './range-sheet-days.css';
|
|
6
|
+
|
|
7
|
+
import { useLayoutEffect, useRef, type RefObject } from 'react';
|
|
8
|
+
|
|
9
|
+
import { animate, type Playback } from '../../../engine';
|
|
10
|
+
import { GlidePill } from '../../../motion/glide';
|
|
11
|
+
import { motionFor } from '../../../tokens/motion-tokens';
|
|
12
|
+
import type { ActivateOn } from '../../internal/utils/activation';
|
|
13
|
+
import { Button } from '../../primitives/button/Button';
|
|
14
|
+
import { monthSwipe } from './month-swipe';
|
|
15
|
+
import { RangeMonth } from './range-month';
|
|
16
|
+
import { RangePresets } from './range-presets';
|
|
17
|
+
import { RangeSummary } from './range-summary';
|
|
18
|
+
import { useRangePanel, type RangeOptions } from './use-range-panel';
|
|
19
|
+
|
|
20
|
+
interface DrpSheetProps extends Omit<RangeOptions, 'months'> {
|
|
21
|
+
title: string;
|
|
22
|
+
timezone?: string;
|
|
23
|
+
activateOn?: ActivateOn;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function useHeightGlide(ref: RefObject<HTMLElement | null>, viewIdx: number) {
|
|
27
|
+
const settled = useRef(0);
|
|
28
|
+
const flight = useRef<Playback | null>(null);
|
|
29
|
+
useLayoutEffect(() => {
|
|
30
|
+
const el = ref.current;
|
|
31
|
+
if (!el) return;
|
|
32
|
+
const from = flight.current ? el.offsetHeight : settled.current;
|
|
33
|
+
flight.current?.stop();
|
|
34
|
+
settled.current = el.offsetHeight;
|
|
35
|
+
if (!from || from === settled.current) return;
|
|
36
|
+
const glide = animate(el, { height: [from, 'auto'], timing: motionFor(el).t.settle });
|
|
37
|
+
flight.current = glide;
|
|
38
|
+
glide?.finished.then(() => {
|
|
39
|
+
if (flight.current === glide) flight.current = null;
|
|
40
|
+
});
|
|
41
|
+
}, [ref, viewIdx]);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function DrpSheet({ value, commit, close, min, max, maxDays, title, timezone, activateOn }: DrpSheetProps) {
|
|
45
|
+
const panel = useRangePanel({ value, commit, close, min, max, maxDays, months: 1 });
|
|
46
|
+
const { anchor, setHoverKey, daysRef, onGridKeyDown, gridGlide } = panel;
|
|
47
|
+
useHeightGlide(daysRef, panel.viewIdx);
|
|
48
|
+
return (
|
|
49
|
+
<div className="zc-drp zc-drp--sheet" role="dialog" aria-label={title}>
|
|
50
|
+
<RangeSummary panel={panel} title={title} timezone={timezone} />
|
|
51
|
+
<RangePresets draft={panel.draft} fits={panel.fits} onPick={panel.applyPreset} activateOn={activateOn} />
|
|
52
|
+
<div
|
|
53
|
+
className="zc-drp__months"
|
|
54
|
+
ref={daysRef}
|
|
55
|
+
onKeyDown={onGridKeyDown}
|
|
56
|
+
onPointerDown={monthSwipe(panel, min, max)}
|
|
57
|
+
onPointerLeave={() => {
|
|
58
|
+
if (anchor) setHoverKey(anchor);
|
|
59
|
+
gridGlide.leave();
|
|
60
|
+
}}
|
|
61
|
+
>
|
|
62
|
+
<RangeMonth panel={panel} offset={0} withPrev withNext min={min} max={max} months={1} activateOn={activateOn} />
|
|
63
|
+
<GlidePill className="zc-dtp__hover" glide={gridGlide} />
|
|
64
|
+
</div>
|
|
65
|
+
<div className="zc-drp__foot">
|
|
66
|
+
<Button variant="secondary" size="xl" fullWidth onClick={panel.done}>
|
|
67
|
+
Done
|
|
68
|
+
</Button>
|
|
69
|
+
</div>
|
|
70
|
+
</div>
|
|
71
|
+
);
|
|
72
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
@layer zyncat.reset, zyncat.tokens, zyncat.base, zyncat.components;
|
|
2
|
+
|
|
3
|
+
@layer zyncat.components {
|
|
4
|
+
.zc-drp__summary {
|
|
5
|
+
display: grid;
|
|
6
|
+
gap: var(--space-3);
|
|
7
|
+
padding: var(--space-5) var(--space-4) var(--space-4);
|
|
8
|
+
}
|
|
9
|
+
.zc-drp__head {
|
|
10
|
+
display: flex;
|
|
11
|
+
align-items: center;
|
|
12
|
+
justify-content: space-between;
|
|
13
|
+
gap: var(--space-3);
|
|
14
|
+
}
|
|
15
|
+
.zc-drp__heading {
|
|
16
|
+
display: grid;
|
|
17
|
+
min-width: 0;
|
|
18
|
+
}
|
|
19
|
+
.zc-drp__title {
|
|
20
|
+
font: var(--type-heading);
|
|
21
|
+
color: var(--text-strong);
|
|
22
|
+
white-space: nowrap;
|
|
23
|
+
overflow: hidden;
|
|
24
|
+
text-overflow: ellipsis;
|
|
25
|
+
}
|
|
26
|
+
.zc-drp__tiles {
|
|
27
|
+
display: grid;
|
|
28
|
+
grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
|
|
29
|
+
align-items: center;
|
|
30
|
+
gap: var(--space-2);
|
|
31
|
+
}
|
|
32
|
+
.zc-drp__tile {
|
|
33
|
+
display: grid;
|
|
34
|
+
gap: var(--space-px);
|
|
35
|
+
padding: var(--space-2) var(--space-3);
|
|
36
|
+
border: var(--border-hairline) solid var(--border-subtle);
|
|
37
|
+
border-radius: var(--radius-md);
|
|
38
|
+
background: var(--bg-subtle);
|
|
39
|
+
opacity: 0.6;
|
|
40
|
+
transition: var(--transition-colors), var(--transition-opacity);
|
|
41
|
+
}
|
|
42
|
+
.zc-drp__tile.zc-is-active {
|
|
43
|
+
border-color: var(--border-strong);
|
|
44
|
+
opacity: 1;
|
|
45
|
+
}
|
|
46
|
+
.zc-drp__tileRole {
|
|
47
|
+
font: var(--type-micro);
|
|
48
|
+
letter-spacing: var(--tracking-caps);
|
|
49
|
+
text-transform: uppercase;
|
|
50
|
+
color: var(--text-subtle);
|
|
51
|
+
}
|
|
52
|
+
.zc-drp__tileDate {
|
|
53
|
+
font: var(--type-title);
|
|
54
|
+
font-variant-numeric: tabular-nums;
|
|
55
|
+
color: var(--text-strong);
|
|
56
|
+
white-space: nowrap;
|
|
57
|
+
overflow: hidden;
|
|
58
|
+
text-overflow: ellipsis;
|
|
59
|
+
}
|
|
60
|
+
.zc-drp__tileDate.zc-is-empty {
|
|
61
|
+
font-weight: var(--weight-medium);
|
|
62
|
+
color: var(--text-subtle);
|
|
63
|
+
}
|
|
64
|
+
.zc-drp__arrow {
|
|
65
|
+
color: var(--text-subtle);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import './range-summary.css';
|
|
4
|
+
|
|
5
|
+
import { animate } from '../../../engine';
|
|
6
|
+
import { Motion } from '../../../motion/element';
|
|
7
|
+
import { motionFor } from '../../../tokens/motion-tokens';
|
|
8
|
+
import { Icon } from '../../internal/icon/Icon';
|
|
9
|
+
import { Badge } from '../../primitives/badge/Badge';
|
|
10
|
+
import { displayDay, tzLabel } from './date-utils';
|
|
11
|
+
import { drpDays } from './range-presets';
|
|
12
|
+
import type { RangePanel } from './use-range-panel';
|
|
13
|
+
|
|
14
|
+
function dateIn(el: HTMLElement) {
|
|
15
|
+
const motion = motionFor(el);
|
|
16
|
+
return animate(el, { y: [motion.dist.sm, 0], opacity: [0, 1], timing: motion.t.enter });
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
interface TileProps {
|
|
20
|
+
role: string;
|
|
21
|
+
day: string | null;
|
|
22
|
+
active: boolean;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function Tile({ role, day, active }: TileProps) {
|
|
26
|
+
return (
|
|
27
|
+
<span className={'zc-drp__tile' + (active ? ' zc-is-active' : '')}>
|
|
28
|
+
<span className="zc-drp__tileRole">{role}</span>
|
|
29
|
+
<Motion
|
|
30
|
+
as="span"
|
|
31
|
+
className={'zc-drp__tileDate' + (day ? '' : ' zc-is-empty')}
|
|
32
|
+
animate={dateIn}
|
|
33
|
+
deps={[day]}
|
|
34
|
+
initial={false}
|
|
35
|
+
>
|
|
36
|
+
{displayDay(day) || (active ? 'Pick a day' : 'Not set')}
|
|
37
|
+
</Motion>
|
|
38
|
+
</span>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
interface RangeSummaryProps {
|
|
43
|
+
panel: RangePanel;
|
|
44
|
+
title: string;
|
|
45
|
+
timezone?: string;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function RangeSummary({ panel, title, timezone }: RangeSummaryProps) {
|
|
49
|
+
const { lo, hi, anchor, provisional } = panel;
|
|
50
|
+
const end = provisional && lo === hi ? null : hi;
|
|
51
|
+
const total = lo && end ? drpDays(lo, end) : 0;
|
|
52
|
+
const endMoving = provisional && lo === anchor;
|
|
53
|
+
return (
|
|
54
|
+
<div className="zc-drp__summary">
|
|
55
|
+
<div className="zc-drp__head">
|
|
56
|
+
<span className="zc-drp__heading">
|
|
57
|
+
<span className="zc-drp__title">{title}</span>
|
|
58
|
+
{timezone ? <span className="zc-drp__tz">{tzLabel(timezone)}</span> : null}
|
|
59
|
+
</span>
|
|
60
|
+
{total ? <Badge value={total + (total === 1 ? ' day' : ' days')} pill /> : null}
|
|
61
|
+
</div>
|
|
62
|
+
<div className="zc-drp__tiles" aria-live="polite">
|
|
63
|
+
<Tile role="Start" day={lo} active={!endMoving} />
|
|
64
|
+
<Icon name="caret-right" size="sm" className="zc-drp__arrow" />
|
|
65
|
+
<Tile role="End" day={end} active={endMoving} />
|
|
66
|
+
</div>
|
|
67
|
+
</div>
|
|
68
|
+
);
|
|
69
|
+
}
|
|
@@ -6,6 +6,7 @@ import { useEffect, useRef, useState, type ClipboardEvent, type KeyboardEvent, t
|
|
|
6
6
|
|
|
7
7
|
import { cx } from '../../internal/utils/cx';
|
|
8
8
|
import { pad } from './date-utils';
|
|
9
|
+
import { typedKey, type KeyLike } from './typed-key';
|
|
9
10
|
|
|
10
11
|
type Meridiem = 'AM' | 'PM';
|
|
11
12
|
type Segment = 'h' | 'm';
|
|
@@ -70,8 +71,8 @@ export function TimeSegments({
|
|
|
70
71
|
setPendState(v);
|
|
71
72
|
};
|
|
72
73
|
|
|
73
|
-
const hRef = useRef<
|
|
74
|
-
const mRef = useRef<
|
|
74
|
+
const hRef = useRef<HTMLInputElement>(null);
|
|
75
|
+
const mRef = useRef<HTMLInputElement>(null);
|
|
75
76
|
const merRef = useRef<HTMLSpanElement>(null);
|
|
76
77
|
const lastRef = useRef<string | null>(value || null);
|
|
77
78
|
|
|
@@ -102,11 +103,11 @@ export function TimeSegments({
|
|
|
102
103
|
if (onCommit) onCommit(t);
|
|
103
104
|
}
|
|
104
105
|
|
|
105
|
-
const focusSeg = (r: RefObject<
|
|
106
|
+
const focusSeg = (r: RefObject<HTMLElement | null>) => {
|
|
106
107
|
if (r.current) r.current.focus();
|
|
107
108
|
};
|
|
108
109
|
|
|
109
|
-
function onHKey(e:
|
|
110
|
+
function onHKey(e: KeyLike) {
|
|
110
111
|
const k = e.key;
|
|
111
112
|
if (/^[0-9]$/.test(k)) {
|
|
112
113
|
const pd = pend && pend.seg === 'h' ? pend.d : null;
|
|
@@ -138,7 +139,7 @@ export function TimeSegments({
|
|
|
138
139
|
e.preventDefault();
|
|
139
140
|
}
|
|
140
141
|
|
|
141
|
-
function onMKey(e:
|
|
142
|
+
function onMKey(e: KeyLike) {
|
|
142
143
|
const k = e.key;
|
|
143
144
|
if (/^[0-9]$/.test(k)) {
|
|
144
145
|
const pd = pend && pend.seg === 'm' ? pend.d : null;
|
|
@@ -239,39 +240,41 @@ export function TimeSegments({
|
|
|
239
240
|
aria-disabled={disabled || undefined}
|
|
240
241
|
onPaste={onPaste}
|
|
241
242
|
>
|
|
242
|
-
<
|
|
243
|
+
<input
|
|
243
244
|
ref={hRef}
|
|
244
245
|
className={segCls(h == null && !(pend && pend.seg === 'h'))}
|
|
245
246
|
role="spinbutton"
|
|
246
|
-
|
|
247
|
+
inputMode="numeric"
|
|
248
|
+
disabled={disabled}
|
|
249
|
+
value={hText}
|
|
247
250
|
aria-label="Hours"
|
|
248
251
|
aria-valuemin={is12 ? 1 : 0}
|
|
249
252
|
aria-valuemax={is12 ? 12 : 23}
|
|
250
253
|
aria-valuenow={h == null ? undefined : is12 ? disp12(h) : h}
|
|
251
254
|
aria-valuetext={h == null ? 'Empty' : hText}
|
|
252
|
-
onKeyDown={
|
|
255
|
+
onKeyDown={onHKey}
|
|
256
|
+
onChange={(e) => onHKey(typedKey(e))}
|
|
253
257
|
onBlur={onSegBlur('h')}
|
|
254
|
-
|
|
255
|
-
{hText}
|
|
256
|
-
</span>
|
|
258
|
+
/>
|
|
257
259
|
<span className="zc-tsg__sep" aria-hidden="true">
|
|
258
260
|
:
|
|
259
261
|
</span>
|
|
260
|
-
<
|
|
262
|
+
<input
|
|
261
263
|
ref={mRef}
|
|
262
264
|
className={segCls(m == null && !(pend && pend.seg === 'm'))}
|
|
263
265
|
role="spinbutton"
|
|
264
|
-
|
|
266
|
+
inputMode="numeric"
|
|
267
|
+
disabled={disabled}
|
|
268
|
+
value={mText}
|
|
265
269
|
aria-label="Minutes"
|
|
266
270
|
aria-valuemin={0}
|
|
267
271
|
aria-valuemax={59}
|
|
268
272
|
aria-valuenow={m == null ? undefined : m}
|
|
269
273
|
aria-valuetext={m == null ? 'Empty' : mText}
|
|
270
|
-
onKeyDown={
|
|
274
|
+
onKeyDown={onMKey}
|
|
275
|
+
onChange={(e) => onMKey(typedKey(e))}
|
|
271
276
|
onBlur={onSegBlur('m')}
|
|
272
|
-
|
|
273
|
-
{mText}
|
|
274
|
-
</span>
|
|
277
|
+
/>
|
|
275
278
|
{is12 ? (
|
|
276
279
|
<span
|
|
277
280
|
ref={merRef}
|
|
@@ -281,6 +284,9 @@ export function TimeSegments({
|
|
|
281
284
|
aria-label="AM or PM"
|
|
282
285
|
aria-valuetext={mer}
|
|
283
286
|
onKeyDown={disabled ? undefined : onMerKey}
|
|
287
|
+
onPointerUp={(e) => {
|
|
288
|
+
if (!disabled && e.pointerType !== 'mouse') setMeridiem(mer === 'AM' ? 'PM' : 'AM');
|
|
289
|
+
}}
|
|
284
290
|
>
|
|
285
291
|
{mer}
|
|
286
292
|
</span>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ChangeEvent, KeyboardEvent } from 'react';
|
|
2
|
+
|
|
3
|
+
export type KeyLike = Pick<KeyboardEvent, 'key' | 'metaKey' | 'ctrlKey' | 'preventDefault'>;
|
|
4
|
+
|
|
5
|
+
export function typedKey(e: ChangeEvent<HTMLInputElement>): KeyLike {
|
|
6
|
+
const input = e.nativeEvent instanceof InputEvent ? e.nativeEvent : null;
|
|
7
|
+
const key = input?.inputType.startsWith('delete') ? 'Backspace' : (input?.data ?? '').slice(-1);
|
|
8
|
+
return { key, metaKey: false, ctrlKey: false, preventDefault: () => {} };
|
|
9
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useEffect, useRef, useState } from 'react';
|
|
4
|
+
|
|
5
|
+
export function useMonthView(seed: Date) {
|
|
6
|
+
const [view, setView] = useState<{ y: number; m: number }>({ y: seed.getFullYear(), m: seed.getMonth() });
|
|
7
|
+
const viewIdx = view.y * 12 + view.m;
|
|
8
|
+
|
|
9
|
+
function nav(dir: number) {
|
|
10
|
+
setView((v) => {
|
|
11
|
+
const d = new Date(v.y, v.m + dir, 1);
|
|
12
|
+
return { y: d.getFullYear(), m: d.getMonth() };
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const prevViewIdxRef = useRef(viewIdx);
|
|
17
|
+
const jumpedRef = useRef(false);
|
|
18
|
+
const navDir =
|
|
19
|
+
prevViewIdxRef.current === viewIdx || jumpedRef.current ? 0 : viewIdx > prevViewIdxRef.current ? 1 : -1;
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
prevViewIdxRef.current = viewIdx;
|
|
22
|
+
jumpedRef.current = false;
|
|
23
|
+
}, [viewIdx]);
|
|
24
|
+
|
|
25
|
+
function jumpToMonth(y: number, m: number, offset: number) {
|
|
26
|
+
jumpedRef.current = true;
|
|
27
|
+
const base = new Date(y, m - offset, 1);
|
|
28
|
+
setView({ y: base.getFullYear(), m: base.getMonth() });
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return { view, setView, viewIdx, nav, navDir, jumpToMonth };
|
|
32
|
+
}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useId, useRef, useState, type KeyboardEvent } from 'react';
|
|
4
|
+
|
|
5
|
+
import { useGlide } from '../../../motion/glide';
|
|
6
|
+
import { add, clampKey, parse, today, toKey, within } from './date-utils';
|
|
7
|
+
import { drpDays, type DateRange, type DrpPreset } from './range-presets';
|
|
8
|
+
import { useDayFocus } from './use-day-focus';
|
|
9
|
+
import { useMonthView } from './use-month-view';
|
|
10
|
+
|
|
11
|
+
export interface RangeOptions {
|
|
12
|
+
value: DateRange | null;
|
|
13
|
+
commit: (value: DateRange) => void;
|
|
14
|
+
close: () => void;
|
|
15
|
+
min?: string;
|
|
16
|
+
max?: string;
|
|
17
|
+
maxDays?: number;
|
|
18
|
+
months: number;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function useRangePanel({ value, commit, close, min, max, maxDays, months }: RangeOptions) {
|
|
22
|
+
const seedKey = (value && value.start) || today();
|
|
23
|
+
const seed = parse(seedKey);
|
|
24
|
+
const { view, setView, viewIdx, nav, navDir, jumpToMonth } = useMonthView(seed);
|
|
25
|
+
|
|
26
|
+
const [draft, setDraft] = useState(value);
|
|
27
|
+
const [anchor, setAnchor] = useState<string | null>(null);
|
|
28
|
+
const [hoverKey, setHoverKey] = useState<string | null>(null);
|
|
29
|
+
const [focusKey, setFocusKey] = useState<string>(seedKey);
|
|
30
|
+
|
|
31
|
+
const daysRef = useRef<HTMLDivElement>(null);
|
|
32
|
+
const armFocus = useDayFocus(daysRef, focusKey, viewIdx);
|
|
33
|
+
|
|
34
|
+
const uid = useId();
|
|
35
|
+
const gridGlide = useGlide(daysRef);
|
|
36
|
+
const capLoId = 'drp-cap-lo-' + uid;
|
|
37
|
+
const capHiId = 'drp-cap-hi-' + uid;
|
|
38
|
+
|
|
39
|
+
const floor = anchor && maxDays ? clampKey(add(anchor, 1 - maxDays), min, max) : min;
|
|
40
|
+
const ceil = anchor && maxDays ? clampKey(add(anchor, maxDays - 1), min, max) : max;
|
|
41
|
+
const inBounds = (key: string): boolean => within(key, floor, ceil);
|
|
42
|
+
const fits = (p: DrpPreset): boolean =>
|
|
43
|
+
within(p.start, min, max) && within(p.end, min, max) && !(maxDays && drpDays(p.start, p.end) > maxDays);
|
|
44
|
+
|
|
45
|
+
let lo: string | null = null,
|
|
46
|
+
hi: string | null = null,
|
|
47
|
+
provisional = false;
|
|
48
|
+
if (anchor) {
|
|
49
|
+
const other = clampKey(hoverKey || anchor, floor, ceil);
|
|
50
|
+
lo = anchor < other ? anchor : other;
|
|
51
|
+
hi = anchor < other ? other : anchor;
|
|
52
|
+
provisional = true;
|
|
53
|
+
} else if (draft && draft.start && draft.end) {
|
|
54
|
+
lo = draft.start;
|
|
55
|
+
hi = draft.end;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function pickDay(key: string) {
|
|
59
|
+
if (!inBounds(key)) return;
|
|
60
|
+
if (!anchor) {
|
|
61
|
+
setAnchor(key);
|
|
62
|
+
setHoverKey(key);
|
|
63
|
+
} else {
|
|
64
|
+
const start = anchor < key ? anchor : key;
|
|
65
|
+
const end = anchor < key ? key : anchor;
|
|
66
|
+
setAnchor(null);
|
|
67
|
+
setHoverKey(null);
|
|
68
|
+
setDraft({ start: start, end: end });
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function applyPreset(p: DrpPreset) {
|
|
73
|
+
setAnchor(null);
|
|
74
|
+
setHoverKey(null);
|
|
75
|
+
const d = parse(p.start);
|
|
76
|
+
setView({ y: d.getFullYear(), m: d.getMonth() });
|
|
77
|
+
setFocusKey(p.start);
|
|
78
|
+
setDraft({ start: p.start, end: p.end });
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function done() {
|
|
82
|
+
if (lo && hi && !(value && value.start === lo && value.end === hi)) commit({ start: lo, end: hi });
|
|
83
|
+
close();
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function moveFocus(deltaDays: number, deltaMonths = 0) {
|
|
87
|
+
const d = parse(focusKey);
|
|
88
|
+
if (deltaMonths) d.setMonth(d.getMonth() + deltaMonths);
|
|
89
|
+
if (deltaDays) d.setDate(d.getDate() + deltaDays);
|
|
90
|
+
const key = toKey(d);
|
|
91
|
+
armFocus();
|
|
92
|
+
setFocusKey(key);
|
|
93
|
+
if (anchor) setHoverKey(key);
|
|
94
|
+
const idx = d.getFullYear() * 12 + d.getMonth();
|
|
95
|
+
const last = viewIdx + (months - 1);
|
|
96
|
+
if (idx < viewIdx) setView({ y: d.getFullYear(), m: d.getMonth() });
|
|
97
|
+
else if (idx > last) {
|
|
98
|
+
const back = new Date(d.getFullYear(), d.getMonth() - (months - 1), 1);
|
|
99
|
+
setView({ y: back.getFullYear(), m: back.getMonth() });
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
function onGridKeyDown(e: KeyboardEvent<HTMLDivElement>) {
|
|
103
|
+
const k = e.key;
|
|
104
|
+
if (k === 'ArrowLeft') moveFocus(-1);
|
|
105
|
+
else if (k === 'ArrowRight') moveFocus(1);
|
|
106
|
+
else if (k === 'ArrowUp') moveFocus(-7);
|
|
107
|
+
else if (k === 'ArrowDown') moveFocus(7);
|
|
108
|
+
else if (k === 'PageUp') moveFocus(0, -1);
|
|
109
|
+
else if (k === 'PageDown') moveFocus(0, 1);
|
|
110
|
+
else if (k === 'Enter' || k === ' ') pickDay(focusKey);
|
|
111
|
+
else if (k === 'Escape' && anchor) {
|
|
112
|
+
setAnchor(null);
|
|
113
|
+
setHoverKey(null);
|
|
114
|
+
} else return;
|
|
115
|
+
e.preventDefault();
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return {
|
|
119
|
+
view,
|
|
120
|
+
viewIdx,
|
|
121
|
+
navDir,
|
|
122
|
+
nav,
|
|
123
|
+
jumpToMonth,
|
|
124
|
+
draft: anchor ? null : draft,
|
|
125
|
+
anchor,
|
|
126
|
+
focusKey,
|
|
127
|
+
setHoverKey,
|
|
128
|
+
daysRef,
|
|
129
|
+
gridGlide,
|
|
130
|
+
capLoId,
|
|
131
|
+
capHiId,
|
|
132
|
+
inBounds,
|
|
133
|
+
fits,
|
|
134
|
+
lo,
|
|
135
|
+
hi,
|
|
136
|
+
provisional,
|
|
137
|
+
pickDay,
|
|
138
|
+
applyPreset,
|
|
139
|
+
done,
|
|
140
|
+
onGridKeyDown,
|
|
141
|
+
todayKey: today(),
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export type RangePanel = ReturnType<typeof useRangePanel>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import './dialog.css';
|
|
4
|
+
import './dialog-sheet.css';
|
|
4
5
|
|
|
5
6
|
import { Fragment, useId, useRef, type HTMLAttributes, type ReactElement, type ReactNode } from 'react';
|
|
6
7
|
|
|
@@ -10,13 +11,14 @@ import { Presence } from '../../../motion/presence';
|
|
|
10
11
|
import type { DisableableAnimation } from '../../../motion/timing';
|
|
11
12
|
import { UIMotion } from '../../../tokens/motion-tokens';
|
|
12
13
|
import { useControllable } from '../../internal/hooks/use-controllable';
|
|
13
|
-
import {
|
|
14
|
-
import { Icon } from '../../internal/icon/Icon';
|
|
15
|
-
import { IconSlot } from '../../internal/icon/IconSlot';
|
|
14
|
+
import { useMediaQuery } from '../../internal/hooks/use-media-query';
|
|
16
15
|
import { ovCloneTrigger, OverlayPortal } from '../../internal/overlay/layer';
|
|
17
16
|
import { ModalShell, OV_TAKEOVER_TIMING } from '../../internal/overlay/modal';
|
|
18
17
|
import type { ActivateOn } from '../../internal/utils/activation';
|
|
19
|
-
import {
|
|
18
|
+
import { Sheet } from '../sheet/Sheet';
|
|
19
|
+
import { DialogSurface } from './surface';
|
|
20
|
+
|
|
21
|
+
const SHEET_VIEWPORT = '(max-width: 40rem)';
|
|
20
22
|
|
|
21
23
|
export interface DialogProps {
|
|
22
24
|
/** Controlled open state. Omit for uncontrolled (use defaultOpen + trigger). */
|
|
@@ -33,7 +35,7 @@ export interface DialogProps {
|
|
|
33
35
|
title?: ReactNode;
|
|
34
36
|
/** Subtext under the title - wired to `aria-describedby`. @default null */
|
|
35
37
|
description?: ReactNode;
|
|
36
|
-
/** Panel width. @default 'md' */
|
|
38
|
+
/** Panel width. Below 40rem the dialog opens as a bottom sheet, and 'lg' fills its height. @default 'md' */
|
|
37
39
|
size?: 'sm' | 'md' | 'lg';
|
|
38
40
|
/** 'danger' tints the header icon badge + is the convention for destructive confirms. */
|
|
39
41
|
tone?: 'default' | 'danger';
|
|
@@ -57,113 +59,42 @@ export interface DialogProps {
|
|
|
57
59
|
animation?: DisableableAnimation;
|
|
58
60
|
}
|
|
59
61
|
|
|
60
|
-
interface DialogSurfaceProps {
|
|
61
|
-
panelId: string;
|
|
62
|
-
size: 'sm' | 'md' | 'lg';
|
|
63
|
-
tone: 'default' | 'danger';
|
|
64
|
-
icon: ReactNode;
|
|
65
|
-
title: ReactNode;
|
|
66
|
-
description: ReactNode;
|
|
67
|
-
dismissible: boolean;
|
|
68
|
-
footerContent: ReactNode;
|
|
69
|
-
requestClose: () => void;
|
|
70
|
-
htmlProps?: HTMLAttributes<HTMLElement> & DataAttributes;
|
|
71
|
-
children?: ReactNode;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
function DialogSurface({
|
|
75
|
-
panelId,
|
|
76
|
-
size,
|
|
77
|
-
tone,
|
|
78
|
-
icon,
|
|
79
|
-
title,
|
|
80
|
-
description,
|
|
81
|
-
dismissible,
|
|
82
|
-
footerContent,
|
|
83
|
-
requestClose,
|
|
84
|
-
htmlProps,
|
|
85
|
-
children,
|
|
86
|
-
}: DialogSurfaceProps) {
|
|
87
|
-
const bodyRef = useRef<HTMLDivElement>(null);
|
|
88
|
-
const titleId = panelId + '-title';
|
|
89
|
-
const descId = panelId + '-desc';
|
|
90
|
-
|
|
91
|
-
useScrollEdges(bodyRef, (edges, el) => {
|
|
92
|
-
el.toggleAttribute('data-scroll-top', edges.top);
|
|
93
|
-
el.toggleAttribute('data-scroll-bottom', edges.bottom);
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
return (
|
|
97
|
-
<section
|
|
98
|
-
{...htmlProps}
|
|
99
|
-
className={cx('zc-dialog', htmlProps?.className)}
|
|
100
|
-
role="dialog"
|
|
101
|
-
aria-modal="true"
|
|
102
|
-
data-size={size === 'md' ? undefined : size}
|
|
103
|
-
data-tone={tone === 'default' ? undefined : tone}
|
|
104
|
-
aria-labelledby={title ? titleId : undefined}
|
|
105
|
-
aria-describedby={description ? descId : undefined}
|
|
106
|
-
>
|
|
107
|
-
{(icon || title || description || dismissible) && (
|
|
108
|
-
<header className="zc-dialog__header">
|
|
109
|
-
{icon && (
|
|
110
|
-
<span className="zc-dialog__icon">
|
|
111
|
-
<IconSlot size="md">{icon}</IconSlot>
|
|
112
|
-
</span>
|
|
113
|
-
)}
|
|
114
|
-
<div className="zc-dialog__heading">
|
|
115
|
-
{title && (
|
|
116
|
-
<h2 className="zc-dialog__title" id={titleId}>
|
|
117
|
-
{title}
|
|
118
|
-
</h2>
|
|
119
|
-
)}
|
|
120
|
-
{description && (
|
|
121
|
-
<p className="zc-dialog__desc" id={descId}>
|
|
122
|
-
{description}
|
|
123
|
-
</p>
|
|
124
|
-
)}
|
|
125
|
-
</div>
|
|
126
|
-
{dismissible && (
|
|
127
|
-
<button type="button" className="zc-dialog__close" aria-label="Close dialog" onClick={requestClose}>
|
|
128
|
-
<Icon name="x" size="sm" weight="bold" />
|
|
129
|
-
</button>
|
|
130
|
-
)}
|
|
131
|
-
</header>
|
|
132
|
-
)}
|
|
133
|
-
|
|
134
|
-
<div className="zc-dialog__body" ref={bodyRef}>
|
|
135
|
-
{children}
|
|
136
|
-
</div>
|
|
137
|
-
|
|
138
|
-
{footerContent && <footer className="zc-dialog__footer">{footerContent}</footer>}
|
|
139
|
-
</section>
|
|
140
|
-
);
|
|
141
|
-
}
|
|
142
|
-
|
|
143
62
|
export function Dialog({
|
|
144
63
|
open: controlledOpen,
|
|
145
64
|
defaultOpen = false,
|
|
146
65
|
onOpenChange,
|
|
147
66
|
trigger = null,
|
|
148
67
|
activateOn,
|
|
149
|
-
title,
|
|
150
|
-
description = null,
|
|
151
|
-
size = 'md',
|
|
152
|
-
tone = 'default',
|
|
153
|
-
icon = null,
|
|
154
68
|
dismissible = true,
|
|
155
69
|
container = null,
|
|
156
|
-
footer = null,
|
|
157
|
-
children,
|
|
158
70
|
id,
|
|
159
|
-
htmlProps,
|
|
160
71
|
animation,
|
|
72
|
+
...surfaceProps
|
|
161
73
|
}: DialogProps) {
|
|
162
74
|
const autoId = useId();
|
|
163
75
|
const panelId = id || 'dialog-' + autoId;
|
|
164
76
|
const [open, setOpen] = useControllable(controlledOpen, defaultOpen, onOpenChange);
|
|
165
77
|
const triggerRef = useRef<HTMLElement>(null);
|
|
78
|
+
const asSheet = useMediaQuery(SHEET_VIEWPORT);
|
|
166
79
|
const close = () => setOpen(false);
|
|
80
|
+
const surface = <DialogSurface {...surfaceProps} panelId={panelId} dismissible={dismissible} requestClose={close} />;
|
|
81
|
+
|
|
82
|
+
if (asSheet)
|
|
83
|
+
return (
|
|
84
|
+
<Sheet
|
|
85
|
+
side="bottom"
|
|
86
|
+
open={open}
|
|
87
|
+
onOpenChange={setOpen}
|
|
88
|
+
trigger={trigger}
|
|
89
|
+
activateOn={activateOn}
|
|
90
|
+
dismissible={dismissible}
|
|
91
|
+
container={container}
|
|
92
|
+
id={panelId}
|
|
93
|
+
animation={animation}
|
|
94
|
+
>
|
|
95
|
+
{surface}
|
|
96
|
+
</Sheet>
|
|
97
|
+
);
|
|
167
98
|
|
|
168
99
|
const timings = resolveMotionTiming(animation, OV_TAKEOVER_TIMING, container ?? triggerRef.current);
|
|
169
100
|
|
|
@@ -197,20 +128,7 @@ export function Dialog({
|
|
|
197
128
|
container={container}
|
|
198
129
|
requestClose={close}
|
|
199
130
|
>
|
|
200
|
-
|
|
201
|
-
panelId={panelId}
|
|
202
|
-
size={size}
|
|
203
|
-
tone={tone}
|
|
204
|
-
icon={icon}
|
|
205
|
-
title={title}
|
|
206
|
-
description={description}
|
|
207
|
-
dismissible={dismissible}
|
|
208
|
-
footerContent={typeof footer === 'function' ? footer(close) : footer}
|
|
209
|
-
requestClose={close}
|
|
210
|
-
htmlProps={htmlProps}
|
|
211
|
-
>
|
|
212
|
-
{children}
|
|
213
|
-
</DialogSurface>
|
|
131
|
+
{surface}
|
|
214
132
|
</ModalShell>
|
|
215
133
|
)}
|
|
216
134
|
</Presence>
|