@zyncat/ui 0.20.0 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/alert.js +11 -10
- package/dist/alert.js.map +1 -1
- package/dist/avatar.css +1 -1
- package/dist/badge.css +20 -11
- package/dist/badge.js +4 -1
- package/dist/{bloom-HV23M4AW.js → bloom-5MZXLNKG.js} +23 -5
- package/dist/bloom-5MZXLNKG.js.map +1 -0
- package/dist/button.css +24 -27
- package/dist/button.js +3 -3
- package/dist/checkbox.css +0 -1
- package/dist/chunk-2EPNCOLN.js +177 -0
- package/dist/chunk-2EPNCOLN.js.map +1 -0
- package/dist/{chunk-LNAV5E7S.js → chunk-2GYZ3HP3.js} +8 -4
- package/dist/chunk-2GYZ3HP3.js.map +1 -0
- package/dist/chunk-4M5FMCFJ.js +16 -0
- package/dist/chunk-4M5FMCFJ.js.map +1 -0
- package/dist/{chunk-ODRO3KS6.js → chunk-7GTACTZD.js} +8 -6
- package/dist/chunk-7GTACTZD.js.map +1 -0
- package/dist/{chunk-V6QAAOA5.js → chunk-AK2AXGEC.js} +38 -8
- package/dist/chunk-AK2AXGEC.js.map +1 -0
- package/dist/{chunk-5VC3TUZ2.js → chunk-BA4ALXQW.js} +2 -2
- package/dist/{chunk-5VC3TUZ2.js.map → chunk-BA4ALXQW.js.map} +1 -1
- package/dist/{chunk-N43NDSME.js → chunk-CF6ZFXRV.js} +19 -11
- package/dist/chunk-CF6ZFXRV.js.map +1 -0
- package/dist/{chunk-BRKGYLEQ.js → chunk-DOAR4PJ3.js} +9 -4
- package/dist/chunk-DOAR4PJ3.js.map +1 -0
- package/dist/{tide-DJZMDAFT.js → chunk-DVLKB3CZ.js} +15 -12
- package/dist/chunk-DVLKB3CZ.js.map +1 -0
- package/dist/chunk-EUAXI6OF.js +16 -0
- package/dist/chunk-EUAXI6OF.js.map +1 -0
- package/dist/{chunk-RLNCRDAL.js → chunk-G2TOUG2A.js} +7 -6
- package/dist/chunk-G2TOUG2A.js.map +1 -0
- package/dist/{chunk-VQFILXQN.js → chunk-HRP4UFWN.js} +70 -8
- package/dist/chunk-HRP4UFWN.js.map +1 -0
- package/dist/chunk-INK2GJTA.js +102 -0
- package/dist/chunk-INK2GJTA.js.map +1 -0
- package/dist/chunk-ITW5UCVU.js +24 -0
- package/dist/chunk-ITW5UCVU.js.map +1 -0
- package/dist/{chunk-F64Z42PJ.js → chunk-JJHEVW4M.js} +5 -6
- package/dist/chunk-JJHEVW4M.js.map +1 -0
- package/dist/{chunk-7NHY2CRA.js → chunk-JUC35N3C.js} +2 -2
- package/dist/chunk-JUC35N3C.js.map +1 -0
- package/dist/{chunk-PXQBJMPJ.js → chunk-LFJ4C7ZP.js} +7 -7
- package/dist/chunk-LFJ4C7ZP.js.map +1 -0
- package/dist/{chunk-TDHLZY6I.js → chunk-MCOIR3CK.js} +77 -18
- package/dist/chunk-MCOIR3CK.js.map +1 -0
- package/dist/chunk-NATK4DDW.js +108 -0
- package/dist/chunk-NATK4DDW.js.map +1 -0
- package/dist/{chunk-BIDVNLJO.js → chunk-O3RMSMBP.js} +8 -3
- package/dist/{chunk-BIDVNLJO.js.map → chunk-O3RMSMBP.js.map} +1 -1
- package/dist/{chunk-UKPX3RIP.js → chunk-ODO2TCTS.js} +27 -13
- package/dist/chunk-ODO2TCTS.js.map +1 -0
- package/dist/{chunk-M2KGLH2G.js → chunk-P3QSWNED.js} +11 -11
- package/dist/{chunk-M2KGLH2G.js.map → chunk-P3QSWNED.js.map} +1 -1
- package/dist/{chunk-QDAN43B6.js → chunk-Q4K337QY.js} +6 -6
- package/dist/chunk-Q4K337QY.js.map +1 -0
- package/dist/{chunk-2YGHPQ66.js → chunk-Q5N24VII.js} +2 -2
- package/dist/{chunk-2YGHPQ66.js.map → chunk-Q5N24VII.js.map} +1 -1
- package/dist/{chunk-VJXP256V.js → chunk-RLRZJAF7.js} +20 -8
- package/dist/chunk-RLRZJAF7.js.map +1 -0
- package/dist/{chunk-VZXML7EH.js → chunk-SY5UA6WS.js} +39 -10
- package/dist/chunk-SY5UA6WS.js.map +1 -0
- package/dist/{chunk-XKDR22VE.js → chunk-TFC5SCAB.js} +37 -14
- package/dist/chunk-TFC5SCAB.js.map +1 -0
- package/dist/{chunk-HBWRKEW4.js → chunk-VBALIMST.js} +3 -3
- package/dist/{chunk-HBWRKEW4.js.map → chunk-VBALIMST.js.map} +1 -1
- package/dist/{chunk-JINATP4N.js → chunk-VXQ7A6ZI.js} +8 -9
- package/dist/chunk-VXQ7A6ZI.js.map +1 -0
- package/dist/{chunk-TBLPZQSI.js → chunk-W7CHDHRV.js} +114 -42
- package/dist/chunk-W7CHDHRV.js.map +1 -0
- package/dist/{chunk-AIAPXRCI.js → chunk-WBWVOOKM.js} +201 -123
- package/dist/chunk-WBWVOOKM.js.map +1 -0
- package/dist/{chunk-6H3IJ752.js → chunk-WJEZWKEY.js} +20 -10
- package/dist/chunk-WJEZWKEY.js.map +1 -0
- package/dist/{chunk-TRPAKUIB.js → chunk-WMTOAYGP.js} +9 -9
- package/dist/{chunk-TRPAKUIB.js.map → chunk-WMTOAYGP.js.map} +1 -1
- package/dist/{chunk-C3D32LE3.js → chunk-WTHIUPVJ.js} +3 -3
- package/dist/{chunk-C3D32LE3.js.map → chunk-WTHIUPVJ.js.map} +1 -1
- package/dist/{chunk-F2TB3TT6.js → chunk-XCTMTOGT.js} +5 -5
- package/dist/{chunk-F2TB3TT6.js.map → chunk-XCTMTOGT.js.map} +1 -1
- package/dist/chunk-XMJ343KF.js +18 -0
- package/dist/chunk-XMJ343KF.js.map +1 -0
- package/dist/collapse.js +1 -1
- package/dist/combobox.css +7 -0
- package/dist/combobox.js +183 -0
- package/dist/combobox.js.map +1 -0
- package/dist/confetti.js +2 -2
- package/dist/crossfade-UHUQBUVG.js +133 -0
- package/dist/crossfade-UHUQBUVG.js.map +1 -0
- package/dist/date-field.js +27 -22
- package/dist/date-field.js.map +1 -1
- package/dist/date-picker.css +25 -41
- package/dist/date-range-field.js +463 -279
- package/dist/date-range-field.js.map +1 -1
- package/dist/datetime-field.js +28 -23
- package/dist/datetime-field.js.map +1 -1
- package/dist/dialog-sheet.css +31 -0
- package/dist/dialog.css +3 -0
- package/dist/dialog.js +44 -42
- package/dist/dialog.js.map +1 -1
- package/dist/dropdown.css +14 -11
- package/dist/dropdown.js +79 -37
- package/dist/dropdown.js.map +1 -1
- package/dist/emoji-picker.js +22 -21
- package/dist/emoji-picker.js.map +1 -1
- package/dist/flow-field.js +2 -2
- package/dist/glide.js +3 -3
- package/dist/input.css +54 -34
- package/dist/instagram-feed.js +3 -3
- package/dist/lens.js +184 -160
- package/dist/lens.js.map +1 -1
- package/dist/mcp.js +29 -22
- package/dist/menu-surface.css +81 -7
- package/dist/modal.js +11 -10
- package/dist/modal.js.map +1 -1
- package/dist/morphing-text.js +2 -2
- package/dist/motion-devtools.css +6 -5
- package/dist/motion-devtools.js +6 -6
- package/dist/motion-tokens.js +1 -1
- package/dist/motion.js +10 -0
- package/dist/motion.js.map +1 -0
- package/dist/multi-select.js +63 -24
- package/dist/multi-select.js.map +1 -1
- package/dist/number-field.js +122 -75
- package/dist/number-field.js.map +1 -1
- package/dist/odometer.css +27 -16
- package/dist/odometer.js +225 -73
- package/dist/odometer.js.map +1 -1
- package/dist/otp-field.js +49 -12
- package/dist/otp-field.js.map +1 -1
- package/dist/overlay.css +1 -0
- package/dist/pagination.css +1 -1
- package/dist/pagination.js +6 -6
- package/dist/{paint-CJQCM6ZO.js → paint-NLTI6TEF.js} +5 -3
- package/dist/paint-NLTI6TEF.js.map +1 -0
- package/dist/popover.js +12 -11
- package/dist/radio-group.css +9 -6
- package/dist/radio-group.js +9 -8
- package/dist/radio-group.js.map +1 -1
- package/dist/range-sheet-days.css +35 -0
- package/dist/range-sheet.css +80 -0
- package/dist/range-summary.css +67 -0
- package/dist/scroll-area.css +150 -0
- package/dist/scroll-area.js +85 -0
- package/dist/scroll-area.js.map +1 -0
- package/dist/select.css +55 -7
- package/dist/select.js +29 -15
- package/dist/select.js.map +1 -1
- package/dist/sheet.js +12 -11
- package/dist/support-rail.css +2 -2
- package/dist/support-rail.js +17 -15
- package/dist/support-rail.js.map +1 -1
- package/dist/table-detail.css +27 -0
- package/dist/table.css +41 -14
- package/dist/table.js +341 -172
- package/dist/table.js.map +1 -1
- package/dist/tabs.css +32 -13
- package/dist/tabs.js +69 -55
- package/dist/tabs.js.map +1 -1
- package/dist/tag.css +2 -4
- package/dist/tag.js +8 -7
- package/dist/tag.js.map +1 -1
- package/dist/text-field.js +4 -4
- package/dist/textarea.css +26 -41
- package/dist/textarea.js +43 -32
- package/dist/textarea.js.map +1 -1
- package/dist/theme-grid.js +8 -7
- package/dist/theme-switcher.js +19 -18
- package/dist/theme-switcher.js.map +1 -1
- package/dist/{theme-transition-VGLPZDJI.js → theme-transition-F3CBENM5.js} +29 -9
- package/dist/theme-transition-F3CBENM5.js.map +1 -0
- package/dist/theme-transition.css +49 -0
- package/dist/theme.js +5 -4
- package/dist/theme.js.map +1 -1
- package/dist/tide-AGGMQEJV.js +4 -0
- package/dist/tide-AGGMQEJV.js.map +1 -0
- package/dist/tiktok.js +3 -3
- package/dist/time-field.js +15 -8
- package/dist/time-field.js.map +1 -1
- package/dist/toast.css +1 -1
- package/dist/toast.js +11 -10
- package/dist/toast.js.map +1 -1
- package/dist/toggle-tag.js +2 -2
- package/dist/toggle-tag.js.map +1 -1
- package/dist/toggle.css +0 -1
- package/dist/toggle.js +4 -15
- package/dist/toggle.js.map +1 -1
- package/dist/tooltip.css +1 -1
- package/dist/tooltip.js +22 -17
- package/dist/tooltip.js.map +1 -1
- package/dist/trigger.css +0 -1
- package/dist/types/components/composites/combobox/Combobox.d.ts +51 -0
- package/dist/types/components/composites/combobox/caret.d.ts +8 -0
- package/dist/types/components/composites/combobox/use-combobox.d.ts +52 -0
- package/dist/types/components/composites/date-picker/DateField.d.ts +1 -1
- package/dist/types/components/composites/date-picker/DateRangeField.d.ts +6 -3
- package/dist/types/components/composites/date-picker/DateTimeField.d.ts +1 -1
- package/dist/types/components/composites/date-picker/TimeField.d.ts +1 -1
- package/dist/types/components/composites/date-picker/date-utils.d.ts +2 -0
- package/dist/types/components/composites/date-picker/field-shell.d.ts +8 -1
- package/dist/types/components/composites/date-picker/month-swipe.d.ts +3 -0
- package/dist/types/components/composites/date-picker/range-day.d.ts +11 -0
- package/dist/types/components/composites/date-picker/range-month.d.ts +14 -0
- package/dist/types/components/composites/date-picker/range-panel.d.ts +4 -18
- package/dist/types/components/composites/date-picker/range-presets.d.ts +24 -0
- package/dist/types/components/composites/date-picker/range-sheet.d.ts +12 -0
- package/dist/types/components/composites/date-picker/range-summary.d.ts +9 -0
- package/dist/types/components/composites/date-picker/typed-key.d.ts +3 -0
- package/dist/types/components/composites/date-picker/use-month-view.d.ts +14 -0
- package/dist/types/components/composites/date-picker/use-range-panel.d.ts +44 -0
- package/dist/types/components/composites/dialog/Dialog.d.ts +3 -2
- package/dist/types/components/composites/dialog/surface.d.ts +17 -0
- package/dist/types/components/composites/dropdown/Dropdown.d.ts +21 -4
- package/dist/types/components/composites/dropdown/types.d.ts +9 -3
- package/dist/types/components/composites/scroll-area/ScrollArea.d.ts +29 -0
- package/dist/types/components/composites/select/MultiSelect.d.ts +31 -5
- package/dist/types/components/composites/select/Select.d.ts +20 -4
- package/dist/types/components/composites/select/core/index.d.ts +2 -1
- package/dist/types/components/composites/select/core/menu.d.ts +10 -5
- package/dist/types/components/composites/select/core/panel.d.ts +7 -4
- package/dist/types/components/composites/select/core/trigger.d.ts +7 -2
- package/dist/types/components/composites/select/core/types.d.ts +9 -0
- package/dist/types/components/composites/select/core/use-listbox.d.ts +8 -6
- package/dist/types/components/composites/select/presets.d.ts +17 -0
- package/dist/types/components/composites/table/Table.d.ts +3 -74
- package/dist/types/components/composites/table/body.d.ts +15 -0
- package/dist/types/components/composites/table/detail.d.ts +24 -0
- package/dist/types/components/composites/table/head.d.ts +16 -0
- package/dist/types/components/composites/table/types.d.ts +86 -0
- package/dist/types/components/composites/table/use-scroller.d.ts +12 -0
- package/dist/types/components/composites/table/use-table-state.d.ts +16 -0
- package/dist/types/components/composites/tabs/Tabs.d.ts +4 -69
- package/dist/types/components/composites/tabs/tab-panel.d.ts +26 -0
- package/dist/types/components/composites/tabs/types.d.ts +48 -0
- package/dist/types/components/composites/tabs/use-ink.d.ts +5 -0
- package/dist/types/components/composites/tooltip/Tooltip.d.ts +1 -1
- package/dist/types/components/compound/support-rail/SupportRail.d.ts +1 -1
- package/dist/types/components/expressive/lens/Lens.d.ts +1 -1
- package/dist/types/components/expressive/lens/input.d.ts +2 -0
- package/dist/types/components/expressive/lens/optics.d.ts +37 -0
- package/dist/types/components/expressive/lens/paint.d.ts +2 -0
- package/dist/types/components/expressive/lens/use-lens.d.ts +10 -0
- package/dist/types/components/expressive/odometer/Odometer.d.ts +1 -1
- package/dist/types/components/expressive/odometer/roll.d.ts +18 -0
- package/dist/types/components/expressive/odometer/spring.d.ts +11 -0
- package/dist/types/components/expressive/theme-transition/scene.d.ts +3 -0
- package/dist/types/components/internal/hooks/use-hold-repeat.d.ts +8 -0
- package/dist/types/components/internal/icon/Icon.d.ts +2 -0
- package/dist/types/components/internal/menu/highlight.d.ts +9 -1
- package/dist/types/components/internal/menu/menu-row.d.ts +4 -0
- package/dist/types/components/internal/menu/use-anchor-width.d.ts +2 -0
- package/dist/types/components/internal/overlay/layer.d.ts +5 -8
- package/dist/types/components/internal/overlay/track-anchor.d.ts +5 -0
- package/dist/types/components/internal/support/types.d.ts +1 -1
- package/dist/types/components/internal/utils/activation.d.ts +1 -0
- package/dist/types/components/primitives/badge/Badge.d.ts +17 -8
- package/dist/types/components/primitives/badge/morph-label.d.ts +3 -0
- package/dist/types/components/primitives/badge/use-glint-on-change.d.ts +2 -0
- package/dist/types/components/primitives/button/Button.d.ts +4 -8
- package/dist/types/components/primitives/button/button-style.d.ts +8 -4
- package/dist/types/components/primitives/collapse/Collapse.d.ts +3 -2
- package/dist/types/components/primitives/input/NumberField.d.ts +1 -1
- package/dist/types/components/primitives/input/OtpField.d.ts +7 -3
- package/dist/types/components/primitives/input/TextField.d.ts +1 -1
- package/dist/types/components/primitives/input/field-chrome.d.ts +2 -1
- package/dist/types/components/primitives/input/use-number-value.d.ts +16 -0
- package/dist/types/components/primitives/tag/Tag.d.ts +1 -1
- package/dist/types/components/primitives/tag/ToggleTag.d.ts +2 -2
- package/dist/types/components/primitives/textarea/Textarea.d.ts +5 -3
- package/dist/types/components/primitives/textarea/char-meter.d.ts +6 -0
- package/dist/types/components/primitives/toggle/switch-glyph.d.ts +6 -0
- package/dist/types/engine/flip.d.ts +3 -1
- package/dist/types/engine/index.d.ts +2 -2
- package/dist/types/engine/loop.d.ts +5 -2
- package/dist/types/motion/before-paint.d.ts +4 -0
- package/dist/types/motion/crossfade.d.ts +4 -0
- package/dist/types/motion/element.d.ts +16 -4
- package/dist/types/motion/flip.d.ts +12 -3
- package/dist/types/motion/holders.d.ts +4 -0
- package/dist/types/motion/motion.d.ts +7 -0
- package/dist/types/motion/use-motion.d.ts +3 -1
- package/dist/types/theme-scope.d.ts +5 -0
- package/dist/types/tokens/component-styles.generated.d.ts +0 -2
- package/dist/types/tokens/motion-defaults.generated.d.ts +2 -0
- package/dist/types/tokens/motion-scale.d.ts +18 -15
- package/dist/types/tokens/motion-tokens.d.ts +1 -1
- package/dist/types/tokens/theme-store.d.ts +4 -4
- package/dist/types/tokens/theme-tokens.generated.d.ts +77 -59
- package/dist/types/tokens/theme.d.ts +1 -1
- package/dist/typing-lines.js +2 -2
- package/dist/youtube.js +3 -3
- package/package.json +16 -11
- package/skills/zyncat-ui/SKILL.md +8 -8
- package/skills/zyncat-ui/references/components.md +6 -5
- package/skills/zyncat-ui/references/recipes.md +1 -1
- package/skills/zyncat-ui/references/theming.md +3 -3
- package/src/components/composites/combobox/Combobox.tsx +100 -0
- package/src/components/composites/combobox/Combobox.usage.md +32 -0
- package/src/components/composites/combobox/caret.ts +41 -0
- package/src/components/composites/combobox/combobox.css +7 -0
- package/src/components/composites/combobox/use-combobox.ts +112 -0
- package/src/components/composites/date-picker/DateField.tsx +4 -0
- package/src/components/composites/date-picker/DateRangeField.tsx +15 -18
- package/src/components/composites/date-picker/DateTimeField.tsx +4 -0
- package/src/components/composites/date-picker/TimeField.tsx +12 -4
- package/src/components/composites/date-picker/date-picker.css +25 -41
- package/src/components/composites/date-picker/date-utils.ts +4 -0
- package/src/components/composites/date-picker/field-shell.tsx +45 -8
- package/src/components/composites/date-picker/month-swipe.ts +41 -0
- package/src/components/composites/date-picker/range-day.tsx +112 -0
- package/src/components/composites/date-picker/range-month.tsx +79 -0
- package/src/components/composites/date-picker/range-panel.tsx +30 -356
- package/src/components/composites/date-picker/range-presets.tsx +104 -0
- package/src/components/composites/date-picker/range-sheet-days.css +35 -0
- package/src/components/composites/date-picker/range-sheet.css +80 -0
- package/src/components/composites/date-picker/range-sheet.tsx +72 -0
- package/src/components/composites/date-picker/range-summary.css +67 -0
- package/src/components/composites/date-picker/range-summary.tsx +69 -0
- package/src/components/composites/date-picker/time-core.tsx +23 -17
- package/src/components/composites/date-picker/typed-key.ts +9 -0
- package/src/components/composites/date-picker/use-month-view.ts +32 -0
- package/src/components/composites/date-picker/use-range-panel.ts +145 -0
- package/src/components/composites/dialog/Dialog.tsx +28 -110
- package/src/components/composites/dialog/dialog-sheet.css +31 -0
- package/src/components/composites/dialog/dialog.css +3 -0
- package/src/components/composites/dialog/surface.tsx +93 -0
- package/src/components/composites/dropdown/Dropdown.tsx +49 -7
- package/src/components/composites/dropdown/Dropdown.usage.md +2 -0
- package/src/components/composites/dropdown/dropdown.css +14 -11
- package/src/components/composites/dropdown/menu-panel.tsx +49 -26
- package/src/components/composites/dropdown/types.ts +9 -3
- package/src/components/composites/pagination/pagination.css +1 -1
- package/src/components/composites/scroll-area/ScrollArea.tsx +114 -0
- package/src/components/composites/scroll-area/ScrollArea.usage.md +28 -0
- package/src/components/composites/scroll-area/scroll-area.css +150 -0
- package/src/components/composites/select/MultiSelect.tsx +71 -12
- package/src/components/composites/select/MultiSelect.usage.md +10 -0
- package/src/components/composites/select/Select.tsx +32 -2
- package/src/components/composites/select/Select.usage.md +13 -1
- package/src/components/composites/select/core/index.ts +2 -1
- package/src/components/composites/select/core/menu.tsx +34 -17
- package/src/components/composites/select/core/panel.tsx +62 -55
- package/src/components/composites/select/core/trigger.tsx +44 -13
- package/src/components/composites/select/core/types.ts +10 -0
- package/src/components/composites/select/core/use-listbox.ts +91 -38
- package/src/components/composites/select/presets.tsx +47 -0
- package/src/components/composites/select/select.css +55 -7
- package/src/components/composites/sheet/use-sheet-drag.ts +13 -0
- package/src/components/composites/table/Table.tsx +65 -305
- package/src/components/composites/table/Table.usage.md +19 -2
- package/src/components/composites/table/body.tsx +147 -0
- package/src/components/composites/table/detail.tsx +76 -0
- package/src/components/composites/table/head.tsx +90 -0
- package/src/components/composites/table/table-detail.css +27 -0
- package/src/components/composites/table/table.css +41 -14
- package/src/components/composites/table/types.ts +97 -0
- package/src/components/composites/table/use-scroller.ts +53 -0
- package/src/components/composites/table/use-table-state.ts +98 -0
- package/src/components/composites/tabs/Tabs.tsx +23 -188
- package/src/components/composites/tabs/tab-panel.tsx +63 -0
- package/src/components/composites/tabs/tabs.css +32 -13
- package/src/components/composites/tabs/types.ts +51 -0
- package/src/components/composites/tabs/use-ink.ts +87 -0
- package/src/components/composites/toast/toast.css +1 -1
- package/src/components/composites/tooltip/Tooltip.tsx +6 -5
- package/src/components/composites/tooltip/tooltip-host.tsx +10 -6
- package/src/components/composites/tooltip/tooltip.css +1 -1
- package/src/components/compound/support-rail/SupportRail.tsx +3 -2
- package/src/components/compound/support-rail/support-rail.css +2 -2
- package/src/components/dev/motion-devtools.css +6 -5
- package/src/components/expressive/lens/Lens.tsx +11 -368
- package/src/components/expressive/lens/input.ts +91 -0
- package/src/components/expressive/lens/optics.ts +119 -0
- package/src/components/expressive/lens/paint.ts +60 -0
- package/src/components/expressive/lens/use-lens.ts +121 -0
- package/src/components/expressive/odometer/Odometer.tsx +78 -99
- package/src/components/expressive/odometer/Odometer.usage.md +2 -2
- package/src/components/expressive/odometer/odometer.css +27 -16
- package/src/components/expressive/odometer/roll.ts +139 -0
- package/src/components/expressive/odometer/spring.ts +86 -0
- package/src/components/expressive/theme-transition/bloom.ts +22 -2
- package/src/components/expressive/theme-transition/paint.ts +2 -0
- package/src/components/expressive/theme-transition/scene.ts +3 -0
- package/src/components/expressive/theme-transition/theme-transition.css +49 -0
- package/src/components/expressive/theme-transition/theme-transition.ts +21 -1
- package/src/components/expressive/theme-transition/tide.ts +15 -10
- package/src/components/internal/hooks/use-hold-repeat.ts +43 -0
- package/src/components/internal/hooks/use-scroll-edges.ts +6 -1
- package/src/components/internal/icon/Icon.tsx +4 -0
- package/src/components/internal/menu/highlight.ts +20 -2
- package/src/components/internal/menu/menu-row.tsx +36 -8
- package/src/components/internal/menu/menu-surface.css +81 -7
- package/src/components/internal/menu/use-anchor-width.ts +26 -0
- package/src/components/internal/overlay/layer.tsx +11 -23
- package/src/components/internal/overlay/overlay.css +1 -0
- package/src/components/internal/overlay/position.ts +17 -6
- package/src/components/internal/overlay/track-anchor.ts +69 -0
- package/src/components/internal/overlay/trigger.css +0 -1
- package/src/components/internal/support/types.ts +1 -1
- package/src/components/internal/utils/activation.ts +7 -2
- package/src/components/primitives/avatar/avatar.css +1 -1
- package/src/components/primitives/badge/Badge.tsx +38 -15
- package/src/components/primitives/badge/Badge.usage.md +12 -5
- package/src/components/primitives/badge/badge.css +20 -11
- package/src/components/primitives/badge/morph-label.tsx +71 -0
- package/src/components/primitives/badge/use-glint-on-change.ts +16 -0
- package/src/components/primitives/button/Button.tsx +5 -8
- package/src/components/primitives/button/Button.usage.md +5 -4
- package/src/components/primitives/button/button-style.ts +11 -5
- package/src/components/primitives/button/button.css +24 -27
- package/src/components/primitives/checkbox/checkbox.css +0 -1
- package/src/components/primitives/collapse/Collapse.tsx +3 -2
- package/src/components/primitives/input/NumberField.tsx +38 -46
- package/src/components/primitives/input/OtpField.tsx +52 -11
- package/src/components/primitives/input/OtpField.usage.md +2 -1
- package/src/components/primitives/input/TextField.tsx +5 -3
- package/src/components/primitives/input/field-chrome.tsx +3 -2
- package/src/components/primitives/input/input.css +54 -34
- package/src/components/primitives/input/use-number-value.ts +38 -0
- package/src/components/primitives/radio-group/radio-group.css +9 -6
- package/src/components/primitives/tag/Tag.tsx +1 -1
- package/src/components/primitives/tag/ToggleTag.tsx +2 -2
- package/src/components/primitives/tag/tag.css +2 -4
- package/src/components/primitives/textarea/Textarea.tsx +44 -30
- package/src/components/primitives/textarea/char-meter.tsx +19 -0
- package/src/components/primitives/textarea/textarea.css +26 -41
- package/src/components/primitives/toggle/Toggle.tsx +3 -12
- package/src/components/primitives/toggle/switch-glyph.tsx +25 -0
- package/src/components/primitives/toggle/toggle.css +0 -1
- package/src/engine/animate.ts +5 -3
- package/src/engine/flip.ts +28 -4
- package/src/engine/index.ts +2 -2
- package/src/engine/loop.ts +17 -6
- package/src/mcp/server.ts +30 -20
- package/src/motion/before-paint.ts +15 -0
- package/src/motion/crossfade.ts +143 -0
- package/src/motion/element.tsx +29 -8
- package/src/motion/flip.ts +102 -31
- package/src/motion/glide.tsx +5 -0
- package/src/motion/holders.ts +10 -0
- package/src/motion/motion.ts +7 -0
- package/src/motion/motion.usage.md +34 -0
- package/src/motion/presence.tsx +22 -9
- package/src/motion/use-motion.ts +45 -6
- package/src/theme-scope.ts +19 -0
- package/src/tokens/base.css +7 -5
- package/src/tokens/color.css +17 -15
- package/src/tokens/component-styles.generated.ts +0 -2
- package/src/tokens/dark.css +8 -5
- package/src/tokens/decisions.css +5 -3
- package/src/tokens/motion-defaults.generated.ts +15 -8
- package/src/tokens/motion-scale.ts +18 -15
- package/src/tokens/motion-tokens.ts +4 -4
- package/src/tokens/motion.css +19 -11
- package/src/tokens/reset.css +1 -0
- package/src/tokens/semantic.css +20 -14
- package/src/tokens/spacing.css +5 -3
- package/src/tokens/theme-store.ts +4 -4
- package/src/tokens/theme-sync.tsx +4 -2
- package/src/tokens/theme-tokens.generated.ts +78 -59
- package/src/tokens/theme.tsx +1 -1
- package/tailwind.css +6 -0
- package/dist/bloom-HV23M4AW.js.map +0 -1
- package/dist/chunk-2DNKZ57E.js +0 -72
- package/dist/chunk-2DNKZ57E.js.map +0 -1
- package/dist/chunk-6H3IJ752.js.map +0 -1
- package/dist/chunk-7NHY2CRA.js.map +0 -1
- package/dist/chunk-AIAPXRCI.js.map +0 -1
- package/dist/chunk-BRKGYLEQ.js.map +0 -1
- package/dist/chunk-F64Z42PJ.js.map +0 -1
- package/dist/chunk-JINATP4N.js.map +0 -1
- package/dist/chunk-KSAJ6DED.js +0 -16
- package/dist/chunk-KSAJ6DED.js.map +0 -1
- package/dist/chunk-LNAV5E7S.js.map +0 -1
- package/dist/chunk-N43NDSME.js.map +0 -1
- package/dist/chunk-ODRO3KS6.js.map +0 -1
- package/dist/chunk-PXQBJMPJ.js.map +0 -1
- package/dist/chunk-QDAN43B6.js.map +0 -1
- package/dist/chunk-RJENXXTI.js +0 -93
- package/dist/chunk-RJENXXTI.js.map +0 -1
- package/dist/chunk-RLNCRDAL.js.map +0 -1
- package/dist/chunk-RW2A4M2Q.js +0 -57
- package/dist/chunk-RW2A4M2Q.js.map +0 -1
- package/dist/chunk-TBLPZQSI.js.map +0 -1
- package/dist/chunk-TDHLZY6I.js.map +0 -1
- package/dist/chunk-UKPX3RIP.js.map +0 -1
- package/dist/chunk-V6QAAOA5.js.map +0 -1
- package/dist/chunk-VDOBLABP.js +0 -38
- package/dist/chunk-VDOBLABP.js.map +0 -1
- package/dist/chunk-VJXP256V.js.map +0 -1
- package/dist/chunk-VQFILXQN.js.map +0 -1
- package/dist/chunk-VZXML7EH.js.map +0 -1
- package/dist/chunk-XKDR22VE.js.map +0 -1
- package/dist/count-badge.js +0 -13
- package/dist/count-badge.js.map +0 -1
- package/dist/paint-CJQCM6ZO.js.map +0 -1
- package/dist/status-badge.js +0 -72
- package/dist/status-badge.js.map +0 -1
- package/dist/theme-transition-VGLPZDJI.js.map +0 -1
- package/dist/tide-DJZMDAFT.js.map +0 -1
- package/dist/types/components/primitives/badge/CountBadge.d.ts +0 -8
- package/dist/types/components/primitives/badge/StatusBadge.d.ts +0 -15
- package/src/components/primitives/badge/CountBadge.tsx +0 -20
- package/src/components/primitives/badge/CountBadge.usage.md +0 -13
- package/src/components/primitives/badge/StatusBadge.tsx +0 -113
- package/src/components/primitives/badge/StatusBadge.usage.md +0 -14
package/dist/date-range-field.js
CHANGED
|
@@ -1,37 +1,191 @@
|
|
|
1
|
-
'use client';import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { Popover } from './chunk-
|
|
5
|
-
import {
|
|
6
|
-
import './chunk-
|
|
7
|
-
import './chunk-
|
|
1
|
+
'use client';import { useDayFocus, MonthJump } from './chunk-WMTOAYGP.js';
|
|
2
|
+
import { FieldShell, FieldTrigger, parse, tzLabel, MONTHS, pad, today, clampKey, add, grid, canTurn, DOW, toKey, within, displayDay, col } from './chunk-SY5UA6WS.js';
|
|
3
|
+
import { useScrollEdges } from './chunk-O3RMSMBP.js';
|
|
4
|
+
import { Popover } from './chunk-VXQ7A6ZI.js';
|
|
5
|
+
import { useMediaQuery } from './chunk-RFRE4WKX.js';
|
|
6
|
+
import { Sheet } from './chunk-RLRZJAF7.js';
|
|
7
|
+
import './chunk-JJHEVW4M.js';
|
|
8
|
+
import './chunk-HRP4UFWN.js';
|
|
8
9
|
import './chunk-TP2AC5MQ.js';
|
|
9
|
-
import './chunk-
|
|
10
|
-
import './chunk-
|
|
11
|
-
import { activationProps } from './chunk-
|
|
12
|
-
import {
|
|
10
|
+
import './chunk-MCOIR3CK.js';
|
|
11
|
+
import './chunk-4M5FMCFJ.js';
|
|
12
|
+
import { activationProps } from './chunk-2GYZ3HP3.js';
|
|
13
|
+
import { GlidePill, useGlide } from './chunk-DOAR4PJ3.js';
|
|
13
14
|
import './chunk-HDSFWZ7L.js';
|
|
14
|
-
import './chunk-
|
|
15
|
-
import './chunk-
|
|
16
|
-
import { Motion } from './chunk-
|
|
17
|
-
import './chunk-
|
|
18
|
-
import './chunk-
|
|
19
|
-
import './chunk-
|
|
20
|
-
import
|
|
21
|
-
import './chunk-
|
|
22
|
-
import {
|
|
23
|
-
import { Button } from './chunk-RLNCRDAL.js';
|
|
24
|
-
import './chunk-KSAJ6DED.js';
|
|
15
|
+
import './chunk-WTHIUPVJ.js';
|
|
16
|
+
import './chunk-CF6ZFXRV.js';
|
|
17
|
+
import { Motion } from './chunk-2EPNCOLN.js';
|
|
18
|
+
import './chunk-AK2AXGEC.js';
|
|
19
|
+
import './chunk-EUAXI6OF.js';
|
|
20
|
+
import { Badge } from './chunk-INK2GJTA.js';
|
|
21
|
+
import './chunk-VBALIMST.js';
|
|
22
|
+
import './chunk-H3X2263Y.js';
|
|
23
|
+
import { Button } from './chunk-G2TOUG2A.js';
|
|
25
24
|
import './chunk-NYQQH4R5.js';
|
|
26
|
-
import
|
|
27
|
-
import './chunk-
|
|
25
|
+
import './chunk-XMJ343KF.js';
|
|
26
|
+
import './chunk-Q4K337QY.js';
|
|
27
|
+
import { Icon } from './chunk-W7CHDHRV.js';
|
|
28
|
+
import { useControllable } from './chunk-MMRIQNEN.js';
|
|
29
|
+
import './chunk-BA4ALXQW.js';
|
|
28
30
|
import './chunk-DMX2F6B4.js';
|
|
31
|
+
import { animate, startDrag, set } from './chunk-TFC5SCAB.js';
|
|
32
|
+
import './chunk-VNVVG47J.js';
|
|
33
|
+
import { UIMotion, motionFor } from './chunk-WJEZWKEY.js';
|
|
29
34
|
import './chunk-QGNC7LH5.js';
|
|
30
35
|
import './date-picker.css';
|
|
31
|
-
import { useState, useRef, useId,
|
|
36
|
+
import { useState, Fragment, useRef, useId, useLayoutEffect, useEffect } from 'react';
|
|
32
37
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
38
|
+
import './range-sheet.css';
|
|
39
|
+
import './range-sheet-days.css';
|
|
40
|
+
import './range-summary.css';
|
|
33
41
|
|
|
34
42
|
var CAP_FLIP = { timing: UIMotion.t.settle };
|
|
43
|
+
function RangeDay({ panel, d, viewMonth, months, activateOn }) {
|
|
44
|
+
const {
|
|
45
|
+
lo,
|
|
46
|
+
hi,
|
|
47
|
+
provisional,
|
|
48
|
+
anchor,
|
|
49
|
+
focusKey,
|
|
50
|
+
inBounds,
|
|
51
|
+
pickDay,
|
|
52
|
+
setHoverKey,
|
|
53
|
+
gridGlide,
|
|
54
|
+
capLoId,
|
|
55
|
+
capHiId,
|
|
56
|
+
todayKey
|
|
57
|
+
} = panel;
|
|
58
|
+
const key = toKey(d);
|
|
59
|
+
const out = d.getMonth() !== viewMonth;
|
|
60
|
+
if (out && months === 1) return /* @__PURE__ */ jsx("span", { "aria-hidden": "true" });
|
|
61
|
+
const disabled = !inBounds(key);
|
|
62
|
+
const dayCol = col(d);
|
|
63
|
+
const isLo = lo && key === lo;
|
|
64
|
+
const isHi = hi && key === hi;
|
|
65
|
+
const single = lo && hi && lo === hi;
|
|
66
|
+
const inRange = lo && hi && key >= lo && key <= hi;
|
|
67
|
+
const loGhost = provisional && isLo && lo !== anchor;
|
|
68
|
+
const hiGhost = provisional && isHi && !single && hi !== anchor;
|
|
69
|
+
const band = inRange && !single;
|
|
70
|
+
const fadeL = band && months === 1 && !isLo && d.getDate() === 1;
|
|
71
|
+
const fadeR = band && months === 1 && !isHi && new Date(d.getFullYear(), d.getMonth() + 1, 0).getDate() === d.getDate();
|
|
72
|
+
const extL = band && !isLo && dayCol !== 0 && !fadeL;
|
|
73
|
+
const extR = band && !isHi && dayCol !== 6 && !fadeR;
|
|
74
|
+
const capHere = months === 1 || !out;
|
|
75
|
+
const loCap = isLo && capHere;
|
|
76
|
+
const hiCap = isHi && !single && capHere;
|
|
77
|
+
const cls = ["zc-dtp__day"];
|
|
78
|
+
if (out) cls.push("zc-is-out");
|
|
79
|
+
if (inRange) cls.push("zc-is-in-range");
|
|
80
|
+
if ((loGhost || hiGhost) && capHere) cls.push("zc-is-cap-ghost");
|
|
81
|
+
else if (loCap || hiCap) cls.push("zc-is-cap");
|
|
82
|
+
const bandCls = ["zc-drp__band"];
|
|
83
|
+
if (extL) bandCls.push("zc-drp__band--extL");
|
|
84
|
+
if (extR) bandCls.push("zc-drp__band--extR");
|
|
85
|
+
if (fadeL) bandCls.push("zc-drp__band--fadeL");
|
|
86
|
+
else if (!extL) bandCls.push("zc-drp__band--roundL");
|
|
87
|
+
if (fadeR) bandCls.push("zc-drp__band--fadeR");
|
|
88
|
+
else if (!extR) bandCls.push("zc-drp__band--roundR");
|
|
89
|
+
return /* @__PURE__ */ jsxs(
|
|
90
|
+
"button",
|
|
91
|
+
{
|
|
92
|
+
type: "button",
|
|
93
|
+
role: "gridcell",
|
|
94
|
+
"data-key": key,
|
|
95
|
+
className: cls.join(" "),
|
|
96
|
+
disabled,
|
|
97
|
+
tabIndex: key === focusKey ? 0 : -1,
|
|
98
|
+
"aria-label": MONTHS[d.getMonth()] + " " + d.getDate() + ", " + d.getFullYear(),
|
|
99
|
+
"aria-selected": isLo || isHi || void 0,
|
|
100
|
+
...activationProps(() => pickDay(key), { on: activateOn }),
|
|
101
|
+
onPointerEnter: (e) => {
|
|
102
|
+
setHoverKey(key);
|
|
103
|
+
if (!anchor && !disabled) gridGlide.enter(e.currentTarget);
|
|
104
|
+
else gridGlide.leave();
|
|
105
|
+
},
|
|
106
|
+
children: [
|
|
107
|
+
band ? /* @__PURE__ */ jsx("span", { className: bandCls.join(" "), "aria-hidden": "true" }) : null,
|
|
108
|
+
loCap ? /* @__PURE__ */ jsx(
|
|
109
|
+
Motion,
|
|
110
|
+
{
|
|
111
|
+
as: "span",
|
|
112
|
+
layoutId: capLoId,
|
|
113
|
+
layoutTransition: CAP_FLIP,
|
|
114
|
+
className: "zc-drp__cap" + (loGhost ? " zc-drp__cap--ghost" : ""),
|
|
115
|
+
"aria-hidden": "true"
|
|
116
|
+
}
|
|
117
|
+
) : null,
|
|
118
|
+
hiCap ? /* @__PURE__ */ jsx(
|
|
119
|
+
Motion,
|
|
120
|
+
{
|
|
121
|
+
as: "span",
|
|
122
|
+
layoutId: capHiId,
|
|
123
|
+
layoutTransition: CAP_FLIP,
|
|
124
|
+
className: "zc-drp__cap" + (hiGhost ? " zc-drp__cap--ghost" : ""),
|
|
125
|
+
"aria-hidden": "true"
|
|
126
|
+
}
|
|
127
|
+
) : null,
|
|
128
|
+
/* @__PURE__ */ jsx("span", { className: "zc-dtp__num", children: d.getDate() }),
|
|
129
|
+
key === todayKey ? /* @__PURE__ */ jsx("span", { className: "zc-dtp__dot", "aria-hidden": "true" }) : null
|
|
130
|
+
]
|
|
131
|
+
}
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
function RangeMonth({ panel, offset, withPrev, withNext, min, max, months, activateOn }) {
|
|
135
|
+
const { view, viewIdx, navDir, nav, jumpToMonth } = panel;
|
|
136
|
+
const base = new Date(view.y, view.m + offset, 1);
|
|
137
|
+
const y = base.getFullYear(), m = base.getMonth();
|
|
138
|
+
const cells = grid(y, m);
|
|
139
|
+
return /* @__PURE__ */ jsxs("div", { className: "zc-dtp__cal", children: [
|
|
140
|
+
/* @__PURE__ */ jsxs("div", { className: "zc-drp__mhead", children: [
|
|
141
|
+
withPrev ? /* @__PURE__ */ jsx(
|
|
142
|
+
"button",
|
|
143
|
+
{
|
|
144
|
+
type: "button",
|
|
145
|
+
className: "zc-dtp__nav",
|
|
146
|
+
"aria-label": "Previous month",
|
|
147
|
+
disabled: !canTurn(y, m, -1, min, max),
|
|
148
|
+
...activationProps(() => nav(-1), { on: activateOn }),
|
|
149
|
+
children: /* @__PURE__ */ jsx(Icon, { name: "caret-left", size: "sm" })
|
|
150
|
+
}
|
|
151
|
+
) : null,
|
|
152
|
+
/* @__PURE__ */ jsx(
|
|
153
|
+
MonthJump,
|
|
154
|
+
{
|
|
155
|
+
y,
|
|
156
|
+
m,
|
|
157
|
+
min,
|
|
158
|
+
max,
|
|
159
|
+
activateOn,
|
|
160
|
+
onPick: (py, pm) => jumpToMonth(py, pm, offset)
|
|
161
|
+
}
|
|
162
|
+
),
|
|
163
|
+
withNext ? /* @__PURE__ */ jsx(
|
|
164
|
+
"button",
|
|
165
|
+
{
|
|
166
|
+
type: "button",
|
|
167
|
+
className: "zc-dtp__nav",
|
|
168
|
+
"aria-label": "Next month",
|
|
169
|
+
disabled: !canTurn(y, m, 1, min, max),
|
|
170
|
+
...activationProps(() => nav(1), { on: activateOn }),
|
|
171
|
+
children: /* @__PURE__ */ jsx(Icon, { name: "caret-right", size: "sm" })
|
|
172
|
+
}
|
|
173
|
+
) : null
|
|
174
|
+
] }),
|
|
175
|
+
/* @__PURE__ */ jsx("div", { className: "zc-dtp__dow", "aria-hidden": "true", children: DOW.map((d) => /* @__PURE__ */ jsx("span", { children: d }, d)) }),
|
|
176
|
+
/* @__PURE__ */ jsx(
|
|
177
|
+
"div",
|
|
178
|
+
{
|
|
179
|
+
className: "zc-dtp__days",
|
|
180
|
+
role: "grid",
|
|
181
|
+
"aria-label": MONTHS[m] + " " + y,
|
|
182
|
+
"data-enter": navDir || void 0,
|
|
183
|
+
children: cells.map((d) => /* @__PURE__ */ jsx(RangeDay, { panel, d, viewMonth: m, months, activateOn }, toKey(d)))
|
|
184
|
+
},
|
|
185
|
+
"days-" + viewIdx + "-" + offset
|
|
186
|
+
)
|
|
187
|
+
] });
|
|
188
|
+
}
|
|
35
189
|
function drpDisplay(key, withYear) {
|
|
36
190
|
const d = parse(key);
|
|
37
191
|
const mon = MONTHS[d.getMonth()].slice(0, 3);
|
|
@@ -63,43 +217,99 @@ function drpPresets() {
|
|
|
63
217
|
{ id: "ytd", label: "Year to date", start: jan1, end: t }
|
|
64
218
|
];
|
|
65
219
|
}
|
|
66
|
-
function
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
})
|
|
220
|
+
function RangePresets({ draft, fits, onPick, activateOn }) {
|
|
221
|
+
const presetsRef = useRef(null);
|
|
222
|
+
const presetGlide = useGlide(presetsRef);
|
|
223
|
+
const presets = drpPresets();
|
|
224
|
+
useLayoutEffect(() => {
|
|
225
|
+
const strip = presetsRef.current;
|
|
226
|
+
const chip = strip && strip.querySelector(".zc-is-active");
|
|
227
|
+
if (strip && chip) strip.scrollLeft = chip.offsetLeft - (strip.clientWidth - chip.offsetWidth) / 2;
|
|
228
|
+
}, []);
|
|
229
|
+
useScrollEdges(presetsRef, (edges, el) => {
|
|
230
|
+
el.dataset.fade = ((edges.left ? "start " : "") + (edges.right ? "end" : "")).trim();
|
|
231
|
+
});
|
|
232
|
+
function presetActive(p) {
|
|
233
|
+
return draft && draft.start === p.start && draft.end === p.end;
|
|
234
|
+
}
|
|
235
|
+
return /* @__PURE__ */ jsxs(
|
|
236
|
+
"div",
|
|
237
|
+
{
|
|
238
|
+
className: "zc-drp__presets",
|
|
239
|
+
role: "group",
|
|
240
|
+
"aria-label": "Quick ranges",
|
|
241
|
+
ref: presetsRef,
|
|
242
|
+
onPointerLeave: presetGlide.leave,
|
|
243
|
+
children: [
|
|
244
|
+
presets.map((p) => /* @__PURE__ */ jsx(
|
|
245
|
+
"button",
|
|
246
|
+
{
|
|
247
|
+
type: "button",
|
|
248
|
+
className: "zc-drp__preset" + (presetActive(p) ? " zc-is-active" : ""),
|
|
249
|
+
disabled: !fits(p),
|
|
250
|
+
onPointerEnter: (e) => e.currentTarget.disabled ? presetGlide.leave() : presetGlide.enter(e.currentTarget),
|
|
251
|
+
...activationProps(() => onPick(p), { on: activateOn }),
|
|
252
|
+
children: p.label
|
|
253
|
+
},
|
|
254
|
+
p.id
|
|
255
|
+
)),
|
|
256
|
+
/* @__PURE__ */ jsx(GlidePill, { className: "zc-drp__presetGlide", glide: presetGlide })
|
|
257
|
+
]
|
|
258
|
+
}
|
|
259
|
+
);
|
|
260
|
+
}
|
|
261
|
+
function useMonthView(seed) {
|
|
262
|
+
const [view, setView] = useState({ y: seed.getFullYear(), m: seed.getMonth() });
|
|
263
|
+
const viewIdx = view.y * 12 + view.m;
|
|
264
|
+
function nav(dir) {
|
|
265
|
+
setView((v) => {
|
|
266
|
+
const d = new Date(v.y, v.m + dir, 1);
|
|
267
|
+
return { y: d.getFullYear(), m: d.getMonth() };
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
const prevViewIdxRef = useRef(viewIdx);
|
|
271
|
+
const jumpedRef = useRef(false);
|
|
272
|
+
const navDir = prevViewIdxRef.current === viewIdx || jumpedRef.current ? 0 : viewIdx > prevViewIdxRef.current ? 1 : -1;
|
|
273
|
+
useEffect(() => {
|
|
274
|
+
prevViewIdxRef.current = viewIdx;
|
|
275
|
+
jumpedRef.current = false;
|
|
276
|
+
}, [viewIdx]);
|
|
277
|
+
function jumpToMonth(y, m, offset) {
|
|
278
|
+
jumpedRef.current = true;
|
|
279
|
+
const base = new Date(y, m - offset, 1);
|
|
280
|
+
setView({ y: base.getFullYear(), m: base.getMonth() });
|
|
281
|
+
}
|
|
282
|
+
return { view, setView, viewIdx, nav, navDir, jumpToMonth };
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
// src/components/composites/date-picker/use-range-panel.ts
|
|
286
|
+
function useRangePanel({ value, commit, close, min, max, maxDays, months }) {
|
|
78
287
|
const seedKey = value && value.start || today();
|
|
79
288
|
const seed = parse(seedKey);
|
|
80
|
-
const
|
|
289
|
+
const { view, setView, viewIdx, nav, navDir, jumpToMonth } = useMonthView(seed);
|
|
290
|
+
const [draft, setDraft] = useState(value);
|
|
81
291
|
const [anchor, setAnchor] = useState(null);
|
|
82
292
|
const [hoverKey, setHoverKey] = useState(null);
|
|
83
293
|
const [focusKey, setFocusKey] = useState(seedKey);
|
|
84
294
|
const daysRef = useRef(null);
|
|
85
|
-
const presetsRef = useRef(null);
|
|
86
|
-
const viewIdx = view.y * 12 + view.m;
|
|
87
295
|
const armFocus = useDayFocus(daysRef, focusKey, viewIdx);
|
|
88
296
|
const uid = useId();
|
|
89
297
|
const gridGlide = useGlide(daysRef);
|
|
90
|
-
const presetGlide = useGlide(presetsRef);
|
|
91
298
|
const capLoId = "drp-cap-lo-" + uid;
|
|
92
299
|
const capHiId = "drp-cap-hi-" + uid;
|
|
93
|
-
const
|
|
300
|
+
const floor = anchor && maxDays ? clampKey(add(anchor, 1 - maxDays), min, max) : min;
|
|
301
|
+
const ceil = anchor && maxDays ? clampKey(add(anchor, maxDays - 1), min, max) : max;
|
|
302
|
+
const inBounds = (key) => within(key, floor, ceil);
|
|
303
|
+
const fits = (p) => within(p.start, min, max) && within(p.end, min, max) && !(maxDays && drpDays(p.start, p.end) > maxDays);
|
|
94
304
|
let lo = null, hi = null, provisional = false;
|
|
95
305
|
if (anchor) {
|
|
96
|
-
const other = hoverKey || anchor;
|
|
306
|
+
const other = clampKey(hoverKey || anchor, floor, ceil);
|
|
97
307
|
lo = anchor < other ? anchor : other;
|
|
98
308
|
hi = anchor < other ? other : anchor;
|
|
99
309
|
provisional = true;
|
|
100
|
-
} else if (
|
|
101
|
-
lo =
|
|
102
|
-
hi =
|
|
310
|
+
} else if (draft && draft.start && draft.end) {
|
|
311
|
+
lo = draft.start;
|
|
312
|
+
hi = draft.end;
|
|
103
313
|
}
|
|
104
314
|
function pickDay(key) {
|
|
105
315
|
if (!inBounds(key)) return;
|
|
@@ -111,7 +321,7 @@ function DrpPanel({
|
|
|
111
321
|
const end = anchor < key ? key : anchor;
|
|
112
322
|
setAnchor(null);
|
|
113
323
|
setHoverKey(null);
|
|
114
|
-
|
|
324
|
+
setDraft({ start, end });
|
|
115
325
|
}
|
|
116
326
|
}
|
|
117
327
|
function applyPreset(p) {
|
|
@@ -120,25 +330,11 @@ function DrpPanel({
|
|
|
120
330
|
const d = parse(p.start);
|
|
121
331
|
setView({ y: d.getFullYear(), m: d.getMonth() });
|
|
122
332
|
setFocusKey(p.start);
|
|
123
|
-
|
|
333
|
+
setDraft({ start: p.start, end: p.end });
|
|
124
334
|
}
|
|
125
|
-
function
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
return { y: d.getFullYear(), m: d.getMonth() };
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
const prevViewIdxRef = useRef(viewIdx);
|
|
132
|
-
const jumpedRef = useRef(false);
|
|
133
|
-
const navDir = prevViewIdxRef.current === viewIdx || jumpedRef.current ? 0 : viewIdx > prevViewIdxRef.current ? 1 : -1;
|
|
134
|
-
useEffect(() => {
|
|
135
|
-
prevViewIdxRef.current = viewIdx;
|
|
136
|
-
jumpedRef.current = false;
|
|
137
|
-
}, [viewIdx]);
|
|
138
|
-
function jumpToMonth(y, m, offset) {
|
|
139
|
-
jumpedRef.current = true;
|
|
140
|
-
const base = new Date(y, m - offset, 1);
|
|
141
|
-
setView({ y: base.getFullYear(), m: base.getMonth() });
|
|
335
|
+
function done() {
|
|
336
|
+
if (lo && hi && !(value && value.start === lo && value.end === hi)) commit({ start: lo, end: hi });
|
|
337
|
+
close();
|
|
142
338
|
}
|
|
143
339
|
function moveFocus(deltaDays, deltaMonths = 0) {
|
|
144
340
|
const d = parse(focusKey);
|
|
@@ -171,207 +367,204 @@ function DrpPanel({
|
|
|
171
367
|
} else return;
|
|
172
368
|
e.preventDefault();
|
|
173
369
|
}
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
Motion,
|
|
223
|
-
{
|
|
224
|
-
as: "span",
|
|
225
|
-
layoutId: capLoId,
|
|
226
|
-
layoutTransition: CAP_FLIP,
|
|
227
|
-
className: "zc-drp__cap" + (loGhost ? " zc-drp__cap--ghost" : ""),
|
|
228
|
-
"aria-hidden": "true"
|
|
229
|
-
}
|
|
230
|
-
) : null,
|
|
231
|
-
hiCap ? /* @__PURE__ */ jsx(
|
|
232
|
-
Motion,
|
|
233
|
-
{
|
|
234
|
-
as: "span",
|
|
235
|
-
layoutId: capHiId,
|
|
236
|
-
layoutTransition: CAP_FLIP,
|
|
237
|
-
className: "zc-drp__cap" + (hiGhost ? " zc-drp__cap--ghost" : ""),
|
|
238
|
-
"aria-hidden": "true"
|
|
239
|
-
}
|
|
240
|
-
) : null,
|
|
241
|
-
/* @__PURE__ */ jsx("span", { className: "zc-dtp__num", children: d.getDate() }),
|
|
242
|
-
key === todayKey ? /* @__PURE__ */ jsx("span", { className: "zc-dtp__dot", "aria-hidden": "true" }) : null
|
|
243
|
-
]
|
|
244
|
-
},
|
|
245
|
-
key
|
|
246
|
-
);
|
|
247
|
-
}
|
|
248
|
-
function renderMonth(offset, withPrev, withNext) {
|
|
249
|
-
const base = new Date(view.y, view.m + offset, 1);
|
|
250
|
-
const y = base.getFullYear(), m = base.getMonth();
|
|
251
|
-
const cells = grid(y, m);
|
|
252
|
-
const prevEnd = toKey(new Date(y, m, 0));
|
|
253
|
-
const nextStart = toKey(new Date(y, m + 1, 1));
|
|
254
|
-
return /* @__PURE__ */ jsxs("div", { className: "zc-dtp__cal", children: [
|
|
255
|
-
/* @__PURE__ */ jsxs("div", { className: "zc-drp__mhead", children: [
|
|
256
|
-
withPrev ? /* @__PURE__ */ jsx(
|
|
257
|
-
"button",
|
|
258
|
-
{
|
|
259
|
-
type: "button",
|
|
260
|
-
className: "zc-dtp__nav",
|
|
261
|
-
"aria-label": "Previous month",
|
|
262
|
-
disabled: min && prevEnd < min,
|
|
263
|
-
...activationProps(() => nav(-1), { on: activateOn }),
|
|
264
|
-
children: /* @__PURE__ */ jsx(Icon, { name: "caret-left", size: "sm" })
|
|
265
|
-
}
|
|
266
|
-
) : null,
|
|
267
|
-
/* @__PURE__ */ jsx(
|
|
268
|
-
MonthJump,
|
|
269
|
-
{
|
|
270
|
-
y,
|
|
271
|
-
m,
|
|
272
|
-
min,
|
|
273
|
-
max,
|
|
274
|
-
activateOn,
|
|
275
|
-
onPick: (py, pm) => jumpToMonth(py, pm, offset)
|
|
276
|
-
}
|
|
277
|
-
),
|
|
278
|
-
withNext ? /* @__PURE__ */ jsx(
|
|
279
|
-
"button",
|
|
280
|
-
{
|
|
281
|
-
type: "button",
|
|
282
|
-
className: "zc-dtp__nav",
|
|
283
|
-
"aria-label": "Next month",
|
|
284
|
-
disabled: max && nextStart > max,
|
|
285
|
-
...activationProps(() => nav(1), { on: activateOn }),
|
|
286
|
-
children: /* @__PURE__ */ jsx(Icon, { name: "caret-right", size: "sm" })
|
|
287
|
-
}
|
|
288
|
-
) : null
|
|
289
|
-
] }),
|
|
290
|
-
/* @__PURE__ */ jsx("div", { className: "zc-dtp__dow", "aria-hidden": "true", children: DOW.map((d) => /* @__PURE__ */ jsx("span", { children: d }, d)) }),
|
|
291
|
-
/* @__PURE__ */ jsx(
|
|
370
|
+
return {
|
|
371
|
+
view,
|
|
372
|
+
viewIdx,
|
|
373
|
+
navDir,
|
|
374
|
+
nav,
|
|
375
|
+
jumpToMonth,
|
|
376
|
+
draft: anchor ? null : draft,
|
|
377
|
+
anchor,
|
|
378
|
+
focusKey,
|
|
379
|
+
setHoverKey,
|
|
380
|
+
daysRef,
|
|
381
|
+
gridGlide,
|
|
382
|
+
capLoId,
|
|
383
|
+
capHiId,
|
|
384
|
+
inBounds,
|
|
385
|
+
fits,
|
|
386
|
+
lo,
|
|
387
|
+
hi,
|
|
388
|
+
provisional,
|
|
389
|
+
pickDay,
|
|
390
|
+
applyPreset,
|
|
391
|
+
done,
|
|
392
|
+
onGridKeyDown,
|
|
393
|
+
todayKey: today()
|
|
394
|
+
};
|
|
395
|
+
}
|
|
396
|
+
var MONTHS_SHOWN = 2;
|
|
397
|
+
function DrpPanel({ value, commit, close, min, max, maxDays, timezone, label, activateOn }) {
|
|
398
|
+
const panel = useRangePanel({ value, commit, close, min, max, maxDays, months: MONTHS_SHOWN });
|
|
399
|
+
const { anchor, setHoverKey, daysRef, onGridKeyDown, gridGlide, lo, hi, done } = panel;
|
|
400
|
+
const renderMonth = (offset, withPrev, withNext) => /* @__PURE__ */ jsx(
|
|
401
|
+
RangeMonth,
|
|
402
|
+
{
|
|
403
|
+
panel,
|
|
404
|
+
offset,
|
|
405
|
+
withPrev,
|
|
406
|
+
withNext,
|
|
407
|
+
min,
|
|
408
|
+
max,
|
|
409
|
+
months: MONTHS_SHOWN,
|
|
410
|
+
activateOn
|
|
411
|
+
},
|
|
412
|
+
offset
|
|
413
|
+
);
|
|
414
|
+
return /* @__PURE__ */ jsxs("div", { className: "zc-drp", role: "dialog", "aria-label": label || "Pick a date range", children: [
|
|
415
|
+
/* @__PURE__ */ jsxs("div", { className: "zc-drp__body", children: [
|
|
416
|
+
/* @__PURE__ */ jsx(RangePresets, { draft: panel.draft, fits: panel.fits, onPick: panel.applyPreset, activateOn }),
|
|
417
|
+
/* @__PURE__ */ jsxs(
|
|
292
418
|
"div",
|
|
293
419
|
{
|
|
294
|
-
className: "zc-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
420
|
+
className: "zc-drp__months",
|
|
421
|
+
ref: daysRef,
|
|
422
|
+
onKeyDown: onGridKeyDown,
|
|
423
|
+
onPointerLeave: () => {
|
|
424
|
+
if (anchor) setHoverKey(anchor);
|
|
425
|
+
gridGlide.leave();
|
|
426
|
+
},
|
|
427
|
+
children: [
|
|
428
|
+
renderMonth(0, true, false),
|
|
429
|
+
renderMonth(1, false, true),
|
|
430
|
+
/* @__PURE__ */ jsx(GlidePill, { className: "zc-dtp__hover", glide: gridGlide })
|
|
431
|
+
]
|
|
432
|
+
}
|
|
301
433
|
)
|
|
302
|
-
] },
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
role: "dialog",
|
|
313
|
-
"aria-label": label || "Pick a date range",
|
|
314
|
-
children: [
|
|
315
|
-
/* @__PURE__ */ jsxs("div", { className: "zc-drp__body", children: [
|
|
316
|
-
/* @__PURE__ */ jsxs(
|
|
317
|
-
"div",
|
|
318
|
-
{
|
|
319
|
-
className: "zc-drp__presets",
|
|
320
|
-
role: "group",
|
|
321
|
-
"aria-label": "Quick ranges",
|
|
322
|
-
ref: presetsRef,
|
|
323
|
-
onPointerLeave: presetGlide.leave,
|
|
324
|
-
children: [
|
|
325
|
-
presets.map((p) => /* @__PURE__ */ jsx(
|
|
326
|
-
"button",
|
|
327
|
-
{
|
|
328
|
-
type: "button",
|
|
329
|
-
className: "zc-drp__preset" + (presetActive(p) ? " zc-is-active" : ""),
|
|
330
|
-
onPointerEnter: (e) => presetGlide.enter(e.currentTarget),
|
|
331
|
-
...activationProps(() => applyPreset(p), { on: activateOn }),
|
|
332
|
-
children: p.label
|
|
333
|
-
},
|
|
334
|
-
p.id
|
|
335
|
-
)),
|
|
336
|
-
/* @__PURE__ */ jsx(GlidePill, { className: "zc-drp__presetGlide", glide: presetGlide })
|
|
337
|
-
]
|
|
338
|
-
}
|
|
339
|
-
),
|
|
340
|
-
/* @__PURE__ */ jsxs(
|
|
341
|
-
"div",
|
|
342
|
-
{
|
|
343
|
-
className: "zc-drp__months",
|
|
344
|
-
ref: daysRef,
|
|
345
|
-
onKeyDown: onGridKeyDown,
|
|
346
|
-
onPointerLeave: () => {
|
|
347
|
-
if (anchor) setHoverKey(anchor);
|
|
348
|
-
gridGlide.leave();
|
|
349
|
-
},
|
|
350
|
-
children: [
|
|
351
|
-
months === 2 ? [renderMonth(0, true, false), renderMonth(1, false, true)] : renderMonth(0, true, true),
|
|
352
|
-
/* @__PURE__ */ jsx(GlidePill, { className: "zc-dtp__hover", glide: gridGlide })
|
|
353
|
-
]
|
|
354
|
-
}
|
|
355
|
-
)
|
|
356
|
-
] }),
|
|
357
|
-
/* @__PURE__ */ jsxs("div", { className: "zc-drp__foot", children: [
|
|
358
|
-
/* @__PURE__ */ jsx("span", { className: "zc-drp__readout" + (lo && hi ? "" : " zc-is-empty"), children: lo && hi ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
359
|
-
drpRangeText(lo, hi),
|
|
360
|
-
" ",
|
|
361
|
-
/* @__PURE__ */ jsxs("span", { className: "zc-drp__count", children: [
|
|
362
|
-
"- ",
|
|
363
|
-
drpDays(lo, hi),
|
|
364
|
-
" ",
|
|
365
|
-
drpDays(lo, hi) === 1 ? "day" : "days"
|
|
366
|
-
] })
|
|
367
|
-
] }) : anchor ? "Pick the end date" : "Pick a start date" }),
|
|
368
|
-
timezone ? /* @__PURE__ */ jsx("span", { className: "zc-drp__tz", children: tzLabel(timezone) }) : null,
|
|
369
|
-
/* @__PURE__ */ jsx("span", { className: "zc-drp__footSpacer" }),
|
|
370
|
-
/* @__PURE__ */ jsx(Button, { variant: "primary", size: "sm", onClick: close, children: "Done" })
|
|
434
|
+
] }),
|
|
435
|
+
/* @__PURE__ */ jsxs("div", { className: "zc-drp__foot", children: [
|
|
436
|
+
/* @__PURE__ */ jsx("span", { className: "zc-drp__readout" + (lo && hi ? "" : " zc-is-empty"), children: lo && hi ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
437
|
+
drpRangeText(lo, hi),
|
|
438
|
+
" ",
|
|
439
|
+
/* @__PURE__ */ jsxs("span", { className: "zc-drp__count", children: [
|
|
440
|
+
"- ",
|
|
441
|
+
drpDays(lo, hi),
|
|
442
|
+
" ",
|
|
443
|
+
drpDays(lo, hi) === 1 ? "day" : "days"
|
|
371
444
|
] })
|
|
372
|
-
]
|
|
373
|
-
|
|
374
|
-
|
|
445
|
+
] }) : anchor ? "Pick the end date" : "Pick a start date" }),
|
|
446
|
+
timezone ? /* @__PURE__ */ jsx("span", { className: "zc-drp__tz", children: tzLabel(timezone) }) : null,
|
|
447
|
+
/* @__PURE__ */ jsx("span", { className: "zc-drp__footSpacer" }),
|
|
448
|
+
/* @__PURE__ */ jsx(Button, { variant: "secondary", size: "sm", onClick: done, children: "Done" })
|
|
449
|
+
] })
|
|
450
|
+
] });
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
// src/components/composites/date-picker/month-swipe.ts
|
|
454
|
+
var INTENT_PX = 8;
|
|
455
|
+
var TURN_PX = 56;
|
|
456
|
+
var TURN_VELOCITY = 400;
|
|
457
|
+
var RESIST = 0.4;
|
|
458
|
+
var EDGE_RESIST = 0.15;
|
|
459
|
+
function monthSwipe({ view, nav, gridGlide }, min, max) {
|
|
460
|
+
return function onPointerDown(e) {
|
|
461
|
+
const grid2 = e.currentTarget.querySelector(".zc-dtp__days");
|
|
462
|
+
if (e.pointerType !== "touch" || !e.isPrimary || !grid2) return;
|
|
463
|
+
const dirOf = (dx) => dx < 0 ? 1 : -1;
|
|
464
|
+
const turnable = (dx) => canTurn(view.y, view.m, dirOf(dx), min, max);
|
|
465
|
+
let along = false;
|
|
466
|
+
const stop = startDrag(e, {
|
|
467
|
+
onMove({ offset }) {
|
|
468
|
+
if (!along) {
|
|
469
|
+
if (Math.max(Math.abs(offset.x), Math.abs(offset.y)) < INTENT_PX) return;
|
|
470
|
+
if (Math.abs(offset.x) <= Math.abs(offset.y)) return stop();
|
|
471
|
+
along = true;
|
|
472
|
+
gridGlide.leave();
|
|
473
|
+
}
|
|
474
|
+
set(grid2, { x: [offset.x * (turnable(offset.x) ? RESIST : EDGE_RESIST)] });
|
|
475
|
+
},
|
|
476
|
+
onEnd({ offset, velocity }) {
|
|
477
|
+
if (!along) return;
|
|
478
|
+
const flung = Math.abs(velocity.x) > TURN_VELOCITY && Math.sign(velocity.x) === Math.sign(offset.x);
|
|
479
|
+
if ((flung || Math.abs(offset.x) > TURN_PX) && turnable(offset.x)) nav(dirOf(offset.x));
|
|
480
|
+
else animate(grid2, { x: [0], timing: { ...motionFor(grid2).t.settle, release: true } });
|
|
481
|
+
}
|
|
482
|
+
});
|
|
483
|
+
};
|
|
484
|
+
}
|
|
485
|
+
function dateIn(el) {
|
|
486
|
+
const motion = motionFor(el);
|
|
487
|
+
return animate(el, { y: [motion.dist.sm, 0], opacity: [0, 1], timing: motion.t.enter });
|
|
488
|
+
}
|
|
489
|
+
function Tile({ role, day, active }) {
|
|
490
|
+
return /* @__PURE__ */ jsxs("span", { className: "zc-drp__tile" + (active ? " zc-is-active" : ""), children: [
|
|
491
|
+
/* @__PURE__ */ jsx("span", { className: "zc-drp__tileRole", children: role }),
|
|
492
|
+
/* @__PURE__ */ jsx(
|
|
493
|
+
Motion,
|
|
494
|
+
{
|
|
495
|
+
as: "span",
|
|
496
|
+
className: "zc-drp__tileDate" + (day ? "" : " zc-is-empty"),
|
|
497
|
+
animate: dateIn,
|
|
498
|
+
deps: [day],
|
|
499
|
+
initial: false,
|
|
500
|
+
children: displayDay(day) || (active ? "Pick a day" : "Not set")
|
|
501
|
+
}
|
|
502
|
+
)
|
|
503
|
+
] });
|
|
504
|
+
}
|
|
505
|
+
function RangeSummary({ panel, title, timezone }) {
|
|
506
|
+
const { lo, hi, anchor, provisional } = panel;
|
|
507
|
+
const end = provisional && lo === hi ? null : hi;
|
|
508
|
+
const total = lo && end ? drpDays(lo, end) : 0;
|
|
509
|
+
const endMoving = provisional && lo === anchor;
|
|
510
|
+
return /* @__PURE__ */ jsxs("div", { className: "zc-drp__summary", children: [
|
|
511
|
+
/* @__PURE__ */ jsxs("div", { className: "zc-drp__head", children: [
|
|
512
|
+
/* @__PURE__ */ jsxs("span", { className: "zc-drp__heading", children: [
|
|
513
|
+
/* @__PURE__ */ jsx("span", { className: "zc-drp__title", children: title }),
|
|
514
|
+
timezone ? /* @__PURE__ */ jsx("span", { className: "zc-drp__tz", children: tzLabel(timezone) }) : null
|
|
515
|
+
] }),
|
|
516
|
+
total ? /* @__PURE__ */ jsx(Badge, { value: total + (total === 1 ? " day" : " days"), pill: true }) : null
|
|
517
|
+
] }),
|
|
518
|
+
/* @__PURE__ */ jsxs("div", { className: "zc-drp__tiles", "aria-live": "polite", children: [
|
|
519
|
+
/* @__PURE__ */ jsx(Tile, { role: "Start", day: lo, active: !endMoving }),
|
|
520
|
+
/* @__PURE__ */ jsx(Icon, { name: "caret-right", size: "sm", className: "zc-drp__arrow" }),
|
|
521
|
+
/* @__PURE__ */ jsx(Tile, { role: "End", day: end, active: endMoving })
|
|
522
|
+
] })
|
|
523
|
+
] });
|
|
524
|
+
}
|
|
525
|
+
function useHeightGlide(ref, viewIdx) {
|
|
526
|
+
const settled = useRef(0);
|
|
527
|
+
const flight = useRef(null);
|
|
528
|
+
useLayoutEffect(() => {
|
|
529
|
+
const el = ref.current;
|
|
530
|
+
if (!el) return;
|
|
531
|
+
const from = flight.current ? el.offsetHeight : settled.current;
|
|
532
|
+
flight.current?.stop();
|
|
533
|
+
settled.current = el.offsetHeight;
|
|
534
|
+
if (!from || from === settled.current) return;
|
|
535
|
+
const glide = animate(el, { height: [from, "auto"], timing: motionFor(el).t.settle });
|
|
536
|
+
flight.current = glide;
|
|
537
|
+
glide?.finished.then(() => {
|
|
538
|
+
if (flight.current === glide) flight.current = null;
|
|
539
|
+
});
|
|
540
|
+
}, [ref, viewIdx]);
|
|
541
|
+
}
|
|
542
|
+
function DrpSheet({ value, commit, close, min, max, maxDays, title, timezone, activateOn }) {
|
|
543
|
+
const panel = useRangePanel({ value, commit, close, min, max, maxDays, months: 1 });
|
|
544
|
+
const { anchor, setHoverKey, daysRef, onGridKeyDown, gridGlide } = panel;
|
|
545
|
+
useHeightGlide(daysRef, panel.viewIdx);
|
|
546
|
+
return /* @__PURE__ */ jsxs("div", { className: "zc-drp zc-drp--sheet", role: "dialog", "aria-label": title, children: [
|
|
547
|
+
/* @__PURE__ */ jsx(RangeSummary, { panel, title, timezone }),
|
|
548
|
+
/* @__PURE__ */ jsx(RangePresets, { draft: panel.draft, fits: panel.fits, onPick: panel.applyPreset, activateOn }),
|
|
549
|
+
/* @__PURE__ */ jsxs(
|
|
550
|
+
"div",
|
|
551
|
+
{
|
|
552
|
+
className: "zc-drp__months",
|
|
553
|
+
ref: daysRef,
|
|
554
|
+
onKeyDown: onGridKeyDown,
|
|
555
|
+
onPointerDown: monthSwipe(panel, min, max),
|
|
556
|
+
onPointerLeave: () => {
|
|
557
|
+
if (anchor) setHoverKey(anchor);
|
|
558
|
+
gridGlide.leave();
|
|
559
|
+
},
|
|
560
|
+
children: [
|
|
561
|
+
/* @__PURE__ */ jsx(RangeMonth, { panel, offset: 0, withPrev: true, withNext: true, min, max, months: 1, activateOn }),
|
|
562
|
+
/* @__PURE__ */ jsx(GlidePill, { className: "zc-dtp__hover", glide: gridGlide })
|
|
563
|
+
]
|
|
564
|
+
}
|
|
565
|
+
),
|
|
566
|
+
/* @__PURE__ */ jsx("div", { className: "zc-drp__foot", children: /* @__PURE__ */ jsx(Button, { variant: "secondary", size: "xl", fullWidth: true, onClick: panel.done, children: "Done" }) })
|
|
567
|
+
] });
|
|
375
568
|
}
|
|
376
569
|
var NARROW_VIEWPORT = "(max-width: 640px)";
|
|
377
570
|
function DateRangeField({
|
|
@@ -379,14 +572,17 @@ function DateRangeField({
|
|
|
379
572
|
defaultValue = null,
|
|
380
573
|
onChange,
|
|
381
574
|
label,
|
|
575
|
+
ariaLabel,
|
|
382
576
|
placeholder = "Pick a date range",
|
|
383
577
|
timezone,
|
|
384
578
|
min,
|
|
385
579
|
max,
|
|
580
|
+
maxDays,
|
|
386
581
|
required = false,
|
|
387
582
|
invalid = false,
|
|
388
583
|
message,
|
|
389
584
|
disabled = false,
|
|
585
|
+
size = "md",
|
|
390
586
|
className = "",
|
|
391
587
|
htmlProps,
|
|
392
588
|
activateOn = "pointerdown",
|
|
@@ -397,30 +593,18 @@ function DateRangeField({
|
|
|
397
593
|
const [pickerOpen, setPickerOpen] = useState(false);
|
|
398
594
|
const display = val && val.start && val.end ? drpRangeText(val.start, val.end) : null;
|
|
399
595
|
const trigger = /* @__PURE__ */ jsx(FieldTrigger, { display, placeholder, disabled });
|
|
400
|
-
const
|
|
401
|
-
DrpPanel,
|
|
402
|
-
{
|
|
403
|
-
value: val,
|
|
404
|
-
commit,
|
|
405
|
-
close: () => setPickerOpen(false),
|
|
406
|
-
min,
|
|
407
|
-
max,
|
|
408
|
-
timezone,
|
|
409
|
-
label,
|
|
410
|
-
months: narrow ? 1 : 2,
|
|
411
|
-
layout: narrow ? "sheet" : "popover",
|
|
412
|
-
activateOn
|
|
413
|
-
}
|
|
414
|
-
);
|
|
596
|
+
const range = { value: val, commit, close: () => setPickerOpen(false), min, max, maxDays, timezone, activateOn };
|
|
415
597
|
return /* @__PURE__ */ jsx(
|
|
416
598
|
FieldShell,
|
|
417
599
|
{
|
|
418
600
|
variant: "zc-dtf",
|
|
419
601
|
label,
|
|
602
|
+
ariaLabel,
|
|
420
603
|
required,
|
|
421
604
|
invalid,
|
|
422
605
|
message,
|
|
423
606
|
icon: "calendar",
|
|
607
|
+
size,
|
|
424
608
|
className,
|
|
425
609
|
htmlProps,
|
|
426
610
|
children: narrow ? /* @__PURE__ */ jsx(
|
|
@@ -432,7 +616,7 @@ function DateRangeField({
|
|
|
432
616
|
onOpenChange: setPickerOpen,
|
|
433
617
|
activateOn,
|
|
434
618
|
animation,
|
|
435
|
-
children:
|
|
619
|
+
children: /* @__PURE__ */ jsx(DrpSheet, { ...range, title: label || ariaLabel || "Date range" })
|
|
436
620
|
}
|
|
437
621
|
) : /* @__PURE__ */ jsx(
|
|
438
622
|
Popover,
|
|
@@ -444,7 +628,7 @@ function DateRangeField({
|
|
|
444
628
|
onOpenChange: setPickerOpen,
|
|
445
629
|
activateOn,
|
|
446
630
|
animation,
|
|
447
|
-
children:
|
|
631
|
+
children: /* @__PURE__ */ jsx(DrpPanel, { ...range, label })
|
|
448
632
|
}
|
|
449
633
|
)
|
|
450
634
|
}
|