@zyncat/ui 0.15.0 → 0.18.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/README.md +32 -202
- package/dist/alert.css +1 -1
- package/dist/alert.js +18 -10
- package/dist/alert.js.map +1 -1
- package/dist/avatar.css +3 -2
- package/dist/badge.css +1 -1
- package/dist/bloom-HV23M4AW.js +81 -0
- package/dist/bloom-HV23M4AW.js.map +1 -0
- package/dist/button.css +38 -31
- package/dist/button.js +4 -1
- package/dist/checkbox.css +1 -1
- package/dist/{chunk-5W5TKANX.js → chunk-2DNKZ57E.js} +3 -3
- package/dist/{chunk-5W5TKANX.js.map → chunk-2DNKZ57E.js.map} +1 -1
- package/dist/chunk-2YGHPQ66.js +16 -0
- package/dist/chunk-2YGHPQ66.js.map +1 -0
- package/dist/{chunk-N2GJEO5Z.js → chunk-6H3IJ752.js} +24 -9
- package/dist/chunk-6H3IJ752.js.map +1 -0
- package/dist/chunk-7NHY2CRA.js +132 -0
- package/dist/chunk-7NHY2CRA.js.map +1 -0
- package/dist/{chunk-PWQVSVXR.js → chunk-AIAPXRCI.js} +20 -19
- package/dist/chunk-AIAPXRCI.js.map +1 -0
- package/dist/{chunk-K45CWVHS.js → chunk-BRKGYLEQ.js} +12 -9
- package/dist/chunk-BRKGYLEQ.js.map +1 -0
- package/dist/{chunk-MDSRZ4QR.js → chunk-C3D32LE3.js} +6 -5
- package/dist/chunk-C3D32LE3.js.map +1 -0
- package/dist/chunk-F2TB3TT6.js +103 -0
- package/dist/chunk-F2TB3TT6.js.map +1 -0
- package/dist/{chunk-FVPNICF4.js → chunk-F64Z42PJ.js} +6 -6
- package/dist/{chunk-FVPNICF4.js.map → chunk-F64Z42PJ.js.map} +1 -1
- package/dist/{chunk-QGVFFT2B.js → chunk-HBWRKEW4.js} +3 -3
- package/dist/{chunk-QGVFFT2B.js.map → chunk-HBWRKEW4.js.map} +1 -1
- package/dist/{chunk-CAXQJSIE.js → chunk-JINATP4N.js} +13 -13
- package/dist/chunk-JINATP4N.js.map +1 -0
- package/dist/chunk-KSAJ6DED.js +16 -0
- package/dist/chunk-KSAJ6DED.js.map +1 -0
- package/dist/{chunk-BH4JFWXQ.js → chunk-M2KGLH2G.js} +19 -16
- package/dist/chunk-M2KGLH2G.js.map +1 -0
- package/dist/{chunk-6X3G4GIM.js → chunk-N43NDSME.js} +3 -3
- package/dist/{chunk-6X3G4GIM.js.map → chunk-N43NDSME.js.map} +1 -1
- package/dist/chunk-NYQQH4R5.js +40 -0
- package/dist/chunk-NYQQH4R5.js.map +1 -0
- package/dist/{chunk-BTF6DAE3.js → chunk-ODRO3KS6.js} +4 -4
- package/dist/{chunk-BTF6DAE3.js.map → chunk-ODRO3KS6.js.map} +1 -1
- package/dist/chunk-PXQBJMPJ.js +50 -0
- package/dist/chunk-PXQBJMPJ.js.map +1 -0
- package/dist/{chunk-GJTHWB6O.js → chunk-QDAN43B6.js} +3 -3
- package/dist/{chunk-GJTHWB6O.js.map → chunk-QDAN43B6.js.map} +1 -1
- package/dist/{chunk-RBSHRRNO.js → chunk-RJENXXTI.js} +5 -5
- package/dist/{chunk-RBSHRRNO.js.map → chunk-RJENXXTI.js.map} +1 -1
- package/dist/chunk-RLNCRDAL.js +89 -0
- package/dist/chunk-RLNCRDAL.js.map +1 -0
- package/dist/{chunk-GOLSYGRA.js → chunk-TBLPZQSI.js} +84 -48
- package/dist/chunk-TBLPZQSI.js.map +1 -0
- package/dist/{chunk-WZUTBJC4.js → chunk-TDHLZY6I.js} +23 -5
- package/dist/chunk-TDHLZY6I.js.map +1 -0
- package/dist/chunk-TP2AC5MQ.js +13 -0
- package/dist/chunk-TP2AC5MQ.js.map +1 -0
- package/dist/chunk-TRPAKUIB.js +196 -0
- package/dist/chunk-TRPAKUIB.js.map +1 -0
- package/dist/{chunk-5X3MJRIM.js → chunk-UKPX3RIP.js} +3 -3
- package/dist/{chunk-5X3MJRIM.js.map → chunk-UKPX3RIP.js.map} +1 -1
- package/dist/{chunk-5GBV45YD.js → chunk-V6QAAOA5.js} +3 -3
- package/dist/{chunk-5GBV45YD.js.map → chunk-V6QAAOA5.js.map} +1 -1
- package/dist/{chunk-FLQVOSFC.js → chunk-VJXP256V.js} +10 -10
- package/dist/chunk-VJXP256V.js.map +1 -0
- package/dist/{chunk-IUQAUBVM.js → chunk-VQFILXQN.js} +5 -5
- package/dist/chunk-VQFILXQN.js.map +1 -0
- package/dist/{chunk-CFRGQJ23.js → chunk-VZXML7EH.js} +4 -4
- package/dist/{chunk-CFRGQJ23.js.map → chunk-VZXML7EH.js.map} +1 -1
- package/dist/{chunk-FEXUS4SV.js → chunk-XKDR22VE.js} +11 -5
- package/dist/chunk-XKDR22VE.js.map +1 -0
- package/dist/cli.js +262 -45
- package/dist/collapse.css +8 -5
- package/dist/confetti.css +3 -3
- package/dist/confetti.js +2 -2
- package/dist/date-field.js +20 -18
- package/dist/date-field.js.map +1 -1
- package/dist/date-picker.css +168 -43
- package/dist/date-range-field.js +42 -27
- package/dist/date-range-field.js.map +1 -1
- package/dist/datetime-field.js +21 -19
- package/dist/datetime-field.js.map +1 -1
- package/dist/dialog.css +4 -3
- package/dist/dialog.js +12 -12
- package/dist/dialog.js.map +1 -1
- package/dist/digit-strip.css +1 -1
- package/dist/dropdown.css +1 -1
- package/dist/dropdown.js +16 -16
- package/dist/dropdown.js.map +1 -1
- package/dist/emoji-picker.js +41 -26
- package/dist/emoji-picker.js.map +1 -1
- package/dist/facebook-feed.css +1 -1
- package/dist/flow-field.css +4 -4
- package/dist/flow-field.js +3 -3
- package/dist/flow-field.js.map +1 -1
- package/dist/glide.js +3 -3
- package/dist/icon.css +1 -1
- package/dist/input.css +7 -4
- package/dist/instagram-feed.css +1 -1
- package/dist/instagram-feed.js +2 -2
- package/dist/lens.css +1 -2
- package/dist/lens.js +2 -2
- package/dist/mcp.js +1 -1
- package/dist/menu-surface.css +1 -1
- package/dist/modal.css +1 -1
- package/dist/modal.js +10 -10
- package/dist/modal.js.map +1 -1
- package/dist/morphing-text.css +2 -2
- package/dist/morphing-text.js +2 -2
- package/dist/motion-devtools.css +77 -2
- package/dist/motion-devtools.js +194 -37
- package/dist/motion-devtools.js.map +1 -1
- package/dist/motion-tokens.js +1 -1
- package/dist/multi-select.js +12 -12
- package/dist/number-field.js +3 -3
- package/dist/odometer.css +1 -1
- package/dist/odometer.js +2 -2
- package/dist/overlay.css +1 -1
- package/dist/pagination.css +1 -1
- package/dist/pagination.js +6 -4
- package/dist/pagination.js.map +1 -1
- package/dist/paint-CJQCM6ZO.js +260 -0
- package/dist/paint-CJQCM6ZO.js.map +1 -0
- package/dist/popover.css +1 -1
- package/dist/popover.js +10 -10
- package/dist/radio-group.css +6 -4
- package/dist/radio-group.js +6 -6
- package/dist/select.css +1 -1
- package/dist/select.js +12 -12
- package/dist/sheet.css +1 -1
- package/dist/sheet.js +9 -9
- package/dist/spinner.css +115 -0
- package/dist/spinner.js +4 -0
- package/dist/spinner.js.map +1 -0
- package/dist/status-badge.js +2 -2
- package/dist/styles.css +1 -1
- package/dist/support-rail.css +76 -238
- package/dist/support-rail.js +99 -107
- package/dist/support-rail.js.map +1 -1
- package/dist/table.css +2 -2
- package/dist/table.js +8 -6
- package/dist/table.js.map +1 -1
- package/dist/tabs.css +10 -14
- package/dist/tabs.js +17 -11
- package/dist/tabs.js.map +1 -1
- package/dist/tag.css +1 -1
- package/dist/tag.js +6 -6
- package/dist/text-field.js +3 -3
- package/dist/textarea.css +1 -1
- package/dist/textarea.js +2 -2
- package/dist/theme-grid.js +11 -0
- package/dist/theme-grid.js.map +1 -0
- package/dist/theme-switcher.css +107 -0
- package/dist/theme-switcher.js +70 -0
- package/dist/theme-switcher.js.map +1 -0
- package/dist/theme-transition-VGLPZDJI.js +346 -0
- package/dist/theme-transition-VGLPZDJI.js.map +1 -0
- package/dist/theme-transition.css +48 -0
- package/dist/theme.js +57 -26
- package/dist/theme.js.map +1 -1
- package/dist/tide-DJZMDAFT.js +57 -0
- package/dist/tide-DJZMDAFT.js.map +1 -0
- package/dist/tiktok.css +2 -3
- package/dist/tiktok.js +2 -2
- package/dist/time-field.js +4 -4
- package/dist/toast.css +2 -14
- package/dist/toast.js +12 -10
- package/dist/toast.js.map +1 -1
- package/dist/toggle-tag.js +2 -2
- package/dist/toggle.css +1 -1
- package/dist/tooltip.css +1 -1
- package/dist/tooltip.js +25 -22
- package/dist/tooltip.js.map +1 -1
- package/dist/trigger.css +1 -1
- package/dist/types/components/composites/date-picker/month-jump.d.ts +11 -0
- package/dist/types/components/composites/theme-switcher/ThemeGrid.d.ts +20 -0
- package/dist/types/components/composites/theme-switcher/ThemeSwitcher.d.ts +24 -0
- package/dist/types/components/compound/support-rail/SupportRail.d.ts +10 -8
- package/dist/types/components/dev/MotionDevtools.d.ts +10 -5
- package/dist/types/components/expressive/theme-transition/bloom.d.ts +2 -0
- package/dist/types/components/expressive/theme-transition/paint.d.ts +2 -0
- package/dist/types/components/expressive/theme-transition/scene.d.ts +24 -0
- package/dist/types/components/expressive/theme-transition/theme-transition.d.ts +19 -0
- package/dist/types/components/expressive/theme-transition/tide.d.ts +2 -0
- package/dist/types/components/internal/hooks/use-press-feedback.d.ts +7 -0
- package/dist/types/components/internal/icon/Icon.d.ts +1 -0
- package/dist/types/components/internal/overlay/layer.d.ts +7 -1
- package/dist/types/components/internal/utils/token-px.d.ts +1 -1
- package/dist/types/components/primitives/button/Button.d.ts +9 -12
- package/dist/types/components/primitives/button/button-style.d.ts +15 -0
- package/dist/types/components/primitives/spinner/Spinner.d.ts +27 -0
- package/dist/types/engine/animate.d.ts +1 -0
- package/dist/types/motion/motion-timing.d.ts +1 -1
- package/dist/types/tokens/component-styles.generated.d.ts +35 -38
- package/dist/types/tokens/motion-tokens.d.ts +5 -3
- package/dist/types/tokens/theme-store.d.ts +47 -0
- package/dist/types/tokens/theme-sync.d.ts +7 -1
- package/dist/types/tokens/theme-tokens.generated.d.ts +125 -115
- package/dist/types/tokens/theme.d.ts +28 -5
- package/dist/typing-lines.css +1 -1
- package/dist/typing-lines.js +2 -2
- package/dist/typing-lines.js.map +1 -1
- package/dist/weight-field.css +2 -2
- package/dist/youtube.css +1 -1
- package/dist/youtube.js +2 -2
- package/package.json +20 -24
- package/skills/zyncat-ui/SKILL.md +1 -1
- package/skills/zyncat-ui/references/components.md +5 -2
- package/skills/zyncat-ui/references/theming.md +31 -23
- package/src/components/composites/alert/Alert.tsx +7 -3
- package/src/components/composites/alert/alert.css +1 -1
- package/src/components/composites/date-picker/calendar-panel.tsx +10 -4
- package/src/components/composites/date-picker/date-picker.css +168 -43
- package/src/components/composites/date-picker/month-jump.tsx +192 -0
- package/src/components/composites/date-picker/range-panel.tsx +20 -5
- package/src/components/composites/dialog/Dialog.tsx +2 -2
- package/src/components/composites/dialog/dialog.css +4 -3
- package/src/components/composites/dropdown/Dropdown.tsx +5 -5
- package/src/components/composites/dropdown/dropdown.css +1 -1
- package/src/components/composites/emoji-picker/react/category-bar.tsx +17 -5
- package/src/components/composites/emoji-picker/scaffold.ts +6 -5
- package/src/components/composites/emoji-picker/styles.css +1 -1
- package/src/components/composites/modal/Modal.tsx +2 -2
- package/src/components/composites/modal/modal.css +1 -1
- package/src/components/composites/pagination/pagination.css +1 -1
- package/src/components/composites/popover/Popover.tsx +5 -5
- package/src/components/composites/popover/popover.css +1 -1
- package/src/components/composites/select/core/menu.tsx +15 -10
- package/src/components/composites/select/select.css +1 -1
- package/src/components/composites/sheet/Sheet.tsx +2 -2
- package/src/components/composites/sheet/sheet.css +1 -1
- package/src/components/composites/table/table.css +2 -2
- package/src/components/composites/tabs/Tabs.tsx +13 -7
- package/src/components/composites/tabs/tabs.css +10 -14
- package/src/components/composites/theme-switcher/ThemeGrid.tsx +133 -0
- package/src/components/composites/theme-switcher/ThemeGrid.usage.md +20 -0
- package/src/components/composites/theme-switcher/ThemeSwitcher.tsx +75 -0
- package/src/components/composites/theme-switcher/ThemeSwitcher.usage.md +21 -0
- package/src/components/composites/theme-switcher/theme-switcher.css +107 -0
- package/src/components/composites/toast/Toast.tsx +2 -1
- package/src/components/composites/toast/toast.css +2 -14
- package/src/components/composites/tooltip/tooltip-host.tsx +19 -17
- package/src/components/composites/tooltip/tooltip.css +1 -1
- package/src/components/compound/support-rail/SupportRail.tsx +116 -128
- package/src/components/compound/support-rail/SupportRail.usage.md +7 -6
- package/src/components/compound/support-rail/support-rail.css +76 -238
- package/src/components/dev/MotionDevtools.tsx +252 -42
- package/src/components/dev/MotionDevtools.usage.md +12 -4
- package/src/components/dev/motion-devtools.css +77 -2
- package/src/components/dev/slowmo-engine.ts +1 -1
- package/src/components/expressive/confetti/confetti.css +3 -3
- package/src/components/expressive/facebook-feed/facebook-feed.css +1 -1
- package/src/components/expressive/flow-field/FlowField.tsx +1 -1
- package/src/components/expressive/flow-field/flow-field.css +4 -4
- package/src/components/expressive/instagram-feed/instagram-feed.css +1 -1
- package/src/components/expressive/lens/lens.css +1 -2
- package/src/components/expressive/morphing-text/morphing-text.css +2 -2
- package/src/components/expressive/odometer/odometer.css +1 -1
- package/src/components/expressive/theme-transition/bloom.ts +88 -0
- package/src/components/expressive/theme-transition/paint.ts +296 -0
- package/src/components/expressive/theme-transition/scene.ts +38 -0
- package/src/components/expressive/theme-transition/theme-transition.css +48 -0
- package/src/components/expressive/theme-transition/theme-transition.ts +423 -0
- package/src/components/expressive/theme-transition/tide.ts +65 -0
- package/src/components/expressive/tiktok/tiktok.css +2 -3
- package/src/components/expressive/typing-lines/TypingLines.tsx +0 -0
- package/src/components/expressive/typing-lines/typing-lines.css +1 -1
- package/src/components/expressive/weight-field/weight-field.css +2 -2
- package/src/components/expressive/youtube/youtube.css +1 -1
- package/src/components/internal/glass/glass.css +1 -1
- package/src/components/internal/hooks/use-press-feedback.ts +52 -0
- package/src/components/internal/icon/Icon.tsx +2 -0
- package/src/components/internal/icon/icon.css +1 -1
- package/src/components/internal/menu/menu-surface.css +1 -1
- package/src/components/internal/overlay/layer.tsx +35 -2
- package/src/components/internal/overlay/overlay.css +1 -1
- package/src/components/internal/overlay/position.ts +2 -2
- package/src/components/internal/overlay/trigger.css +1 -1
- package/src/components/internal/utils/token-px.ts +4 -4
- package/src/components/primitives/avatar/avatar.css +3 -2
- package/src/components/primitives/badge/badge.css +1 -1
- package/src/components/primitives/badge/digit-strip.css +1 -1
- package/src/components/primitives/button/Button.tsx +28 -27
- package/src/components/primitives/button/button-style.ts +28 -0
- package/src/components/primitives/button/button.css +38 -31
- package/src/components/primitives/checkbox/checkbox.css +1 -1
- package/src/components/primitives/collapse/collapse.css +8 -5
- package/src/components/primitives/input/input.css +7 -4
- package/src/components/primitives/radio-group/radio-group.css +6 -4
- package/src/components/primitives/spinner/Spinner.tsx +70 -0
- package/src/components/primitives/spinner/Spinner.usage.md +19 -0
- package/src/components/primitives/spinner/spinner.css +115 -0
- package/src/components/primitives/tag/tag.css +1 -1
- package/src/components/primitives/textarea/textarea.css +1 -1
- package/src/components/primitives/toggle/toggle.css +1 -1
- package/src/engine/animate.ts +10 -2
- package/src/mcp/server.ts +2 -1
- package/src/motion/glide.tsx +9 -6
- package/src/motion/motion-timing.ts +5 -2
- package/src/styles.css +3 -4
- package/src/tokens/base.css +5 -5
- package/src/tokens/color.css +8 -9
- package/src/tokens/component-styles.generated.ts +36 -38
- package/src/tokens/dark.css +8 -13
- package/src/tokens/decisions.css +9 -12
- package/src/tokens/elevation.css +18 -26
- package/src/tokens/glass.css +3 -2
- package/src/tokens/motion-defaults.generated.ts +1 -1
- package/src/tokens/motion-tokens.ts +27 -8
- package/src/tokens/motion.css +9 -9
- package/src/tokens/radius.css +3 -2
- package/src/tokens/reset.css +36 -0
- package/src/tokens/semantic.css +12 -22
- package/src/tokens/spacing.css +1 -1
- package/src/tokens/theme-store.ts +187 -0
- package/src/tokens/theme-sync.tsx +49 -2
- package/src/tokens/theme-tokens.generated.ts +128 -116
- package/src/tokens/theme.tsx +96 -24
- package/src/tokens/theme.usage.md +25 -24
- package/src/tokens/typography.css +4 -3
- package/tailwind.css +8 -14
- package/dist/chunk-6SUHSSOK.js +0 -25
- package/dist/chunk-6SUHSSOK.js.map +0 -1
- package/dist/chunk-BH4JFWXQ.js.map +0 -1
- package/dist/chunk-CAXQJSIE.js.map +0 -1
- package/dist/chunk-FEXUS4SV.js.map +0 -1
- package/dist/chunk-FLQVOSFC.js.map +0 -1
- package/dist/chunk-GOLSYGRA.js.map +0 -1
- package/dist/chunk-IUQAUBVM.js.map +0 -1
- package/dist/chunk-K45CWVHS.js.map +0 -1
- package/dist/chunk-MDSRZ4QR.js.map +0 -1
- package/dist/chunk-N2GJEO5Z.js.map +0 -1
- package/dist/chunk-PWQVSVXR.js.map +0 -1
- package/dist/chunk-UE63OOVG.js +0 -13
- package/dist/chunk-UE63OOVG.js.map +0 -1
- package/dist/chunk-UYSXJ7MH.js +0 -52
- package/dist/chunk-UYSXJ7MH.js.map +0 -1
- package/dist/chunk-WZUTBJC4.js.map +0 -1
- package/src/tokens/fonts.css +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
@layer zyncat.tokens, zyncat.components;
|
|
1
|
+
@layer zyncat.reset, zyncat.tokens, zyncat.components;
|
|
2
2
|
|
|
3
3
|
@layer zyncat.components {
|
|
4
4
|
.zc-dtf__trigger {
|
|
@@ -30,8 +30,15 @@
|
|
|
30
30
|
outline: var(--ring-accent);
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
.zc-dtp,
|
|
34
|
+
.zc-drp,
|
|
35
|
+
.zc-dtp__jumpPanel {
|
|
36
|
+
--dtp-range: color-mix(in oklab, var(--accent-subtle) 70%, var(--bg-surface-raised));
|
|
37
|
+
}
|
|
38
|
+
|
|
33
39
|
.zc-dtp {
|
|
34
40
|
--dtp-cell: var(--control-height);
|
|
41
|
+
--dtp-gap: var(--space-1);
|
|
35
42
|
background: var(--bg-surface-raised);
|
|
36
43
|
border: var(--border-hairline) solid var(--border-default);
|
|
37
44
|
border-radius: var(--radius-lg);
|
|
@@ -40,7 +47,7 @@
|
|
|
40
47
|
}
|
|
41
48
|
|
|
42
49
|
.zc-dtp__cal {
|
|
43
|
-
padding: var(--space-3) var(--space-
|
|
50
|
+
padding: var(--space-3) var(--space-4) var(--space-3);
|
|
44
51
|
}
|
|
45
52
|
|
|
46
53
|
.zc-dtp__head {
|
|
@@ -48,32 +55,131 @@
|
|
|
48
55
|
align-items: center;
|
|
49
56
|
justify-content: space-between;
|
|
50
57
|
gap: var(--space-2);
|
|
51
|
-
margin-inline: calc(-1 * var(--space-
|
|
52
|
-
padding-inline: var(--space-
|
|
58
|
+
margin-inline: calc(-1 * var(--space-4));
|
|
59
|
+
padding-inline: var(--space-4);
|
|
53
60
|
padding-bottom: var(--space-2);
|
|
54
61
|
border-bottom: var(--border-hairline) solid var(--border-subtle);
|
|
55
62
|
margin-bottom: var(--space-3);
|
|
56
63
|
}
|
|
57
|
-
.zc-
|
|
58
|
-
padding-inline-start: var(--space-2);
|
|
64
|
+
.zc-dtp__jump {
|
|
59
65
|
display: inline-flex;
|
|
60
66
|
align-items: center;
|
|
61
|
-
gap: var(--space-
|
|
67
|
+
gap: var(--space-1);
|
|
68
|
+
appearance: none;
|
|
69
|
+
border: 0;
|
|
70
|
+
background: transparent;
|
|
71
|
+
padding: var(--space-1) var(--space-2);
|
|
72
|
+
border-radius: var(--radius-sm);
|
|
73
|
+
color: var(--text-muted);
|
|
74
|
+
cursor: pointer;
|
|
75
|
+
transition: var(--transition-colors);
|
|
76
|
+
}
|
|
77
|
+
.zc-dtp__jump:hover,
|
|
78
|
+
.zc-dtp__jump[aria-expanded='true'] {
|
|
79
|
+
background: var(--neutral-wash);
|
|
80
|
+
}
|
|
81
|
+
.zc-dtp__jump:focus-visible {
|
|
82
|
+
outline: var(--focus-ring);
|
|
83
|
+
}
|
|
84
|
+
.zc-dtp__jumpCaret {
|
|
85
|
+
transition: transform var(--duration-fast) var(--ease-standard);
|
|
86
|
+
}
|
|
87
|
+
.zc-dtp__jump[aria-expanded='true'] .zc-dtp__jumpCaret {
|
|
88
|
+
transform: rotate(180deg);
|
|
89
|
+
}
|
|
90
|
+
.zc-dtp__month {
|
|
62
91
|
font: var(--type-caption);
|
|
63
92
|
font-weight: var(--weight-semibold);
|
|
64
93
|
color: var(--text-strong);
|
|
65
94
|
}
|
|
66
95
|
.zc-dtp__year {
|
|
67
|
-
font-family: var(--font-code);
|
|
68
|
-
font-size: var(--size-micro);
|
|
69
|
-
line-height: 1;
|
|
70
96
|
font-weight: var(--weight-regular);
|
|
71
97
|
font-variant-numeric: tabular-nums;
|
|
72
|
-
color: var(--text-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
98
|
+
color: var(--text-muted);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.zc-dtp__jumpPanel {
|
|
102
|
+
display: flex;
|
|
103
|
+
flex-direction: column;
|
|
104
|
+
gap: var(--space-2);
|
|
105
|
+
padding: var(--space-2);
|
|
106
|
+
block-size: 100%;
|
|
107
|
+
background: var(--bg-surface-raised);
|
|
108
|
+
border: var(--border-hairline) solid var(--border-default);
|
|
109
|
+
border-radius: var(--radius-lg);
|
|
110
|
+
box-shadow: var(--shadow-lg);
|
|
111
|
+
}
|
|
112
|
+
.zc-dtp__jumpYears {
|
|
113
|
+
display: flex;
|
|
114
|
+
align-items: center;
|
|
115
|
+
gap: var(--space-1);
|
|
116
|
+
}
|
|
117
|
+
.zc-dtp__jumpStrip {
|
|
118
|
+
position: relative;
|
|
119
|
+
isolation: isolate;
|
|
120
|
+
flex: 1 1 auto;
|
|
121
|
+
display: grid;
|
|
122
|
+
grid-auto-flow: column;
|
|
123
|
+
grid-auto-columns: minmax(0, 1fr);
|
|
124
|
+
gap: var(--space-1);
|
|
125
|
+
}
|
|
126
|
+
.zc-dtp__jumpMonths {
|
|
127
|
+
position: relative;
|
|
128
|
+
isolation: isolate;
|
|
129
|
+
display: grid;
|
|
130
|
+
grid-template-columns: repeat(3, 1fr);
|
|
131
|
+
gap: var(--space-1);
|
|
132
|
+
}
|
|
133
|
+
.zc-dtp__jumpOpt {
|
|
134
|
+
position: relative;
|
|
135
|
+
appearance: none;
|
|
136
|
+
border: 0;
|
|
137
|
+
background: transparent;
|
|
138
|
+
color: var(--text-body);
|
|
139
|
+
font: var(--type-caption);
|
|
140
|
+
min-height: var(--control-height);
|
|
141
|
+
padding-inline: var(--space-2);
|
|
142
|
+
border-radius: var(--radius-md);
|
|
143
|
+
cursor: pointer;
|
|
144
|
+
transition: var(--transition-colors);
|
|
145
|
+
}
|
|
146
|
+
.zc-dtp__jumpYear {
|
|
147
|
+
font-family: var(--font-code);
|
|
148
|
+
font-variant-numeric: tabular-nums;
|
|
149
|
+
}
|
|
150
|
+
.zc-dtp__jumpOpt:hover:not(:disabled):not(.zc-is-active) {
|
|
151
|
+
color: var(--text-strong);
|
|
152
|
+
}
|
|
153
|
+
.zc-dtp__jumpOpt:focus-visible {
|
|
154
|
+
outline: var(--focus-ring);
|
|
155
|
+
}
|
|
156
|
+
.zc-dtp__jumpOpt:disabled {
|
|
157
|
+
color: var(--text-disabled);
|
|
158
|
+
cursor: default;
|
|
159
|
+
}
|
|
160
|
+
.zc-dtp__jumpOpt.zc-is-active {
|
|
161
|
+
color: var(--text-accent);
|
|
162
|
+
font-weight: var(--weight-semibold);
|
|
163
|
+
}
|
|
164
|
+
.zc-dtp__jumpOpt.zc-is-active::before {
|
|
165
|
+
content: '';
|
|
166
|
+
position: absolute;
|
|
167
|
+
inset: 0;
|
|
168
|
+
z-index: -1;
|
|
169
|
+
border-radius: inherit;
|
|
170
|
+
background: var(--dtp-range);
|
|
76
171
|
}
|
|
172
|
+
.zc-dtp__jumpGlide {
|
|
173
|
+
opacity: 0;
|
|
174
|
+
position: absolute;
|
|
175
|
+
top: 0;
|
|
176
|
+
left: 0;
|
|
177
|
+
z-index: -1;
|
|
178
|
+
border-radius: var(--radius-md);
|
|
179
|
+
background: var(--neutral-wash);
|
|
180
|
+
will-change: transform, opacity;
|
|
181
|
+
}
|
|
182
|
+
|
|
77
183
|
.zc-dtp__navs {
|
|
78
184
|
display: flex;
|
|
79
185
|
gap: var(--space-1);
|
|
@@ -108,7 +214,7 @@
|
|
|
108
214
|
.zc-dtp__dow {
|
|
109
215
|
display: grid;
|
|
110
216
|
grid-template-columns: repeat(7, var(--dtp-cell));
|
|
111
|
-
gap: var(--
|
|
217
|
+
gap: var(--dtp-gap);
|
|
112
218
|
padding-bottom: var(--space-3);
|
|
113
219
|
}
|
|
114
220
|
.zc-dtp__dow span {
|
|
@@ -121,9 +227,12 @@
|
|
|
121
227
|
position: relative;
|
|
122
228
|
display: grid;
|
|
123
229
|
grid-template-columns: repeat(7, var(--dtp-cell));
|
|
124
|
-
gap: var(--
|
|
230
|
+
gap: var(--dtp-gap);
|
|
125
231
|
isolation: isolate;
|
|
126
232
|
}
|
|
233
|
+
.zc-drp .zc-dtp__days {
|
|
234
|
+
isolation: auto;
|
|
235
|
+
}
|
|
127
236
|
.zc-dtp__row {
|
|
128
237
|
display: contents;
|
|
129
238
|
}
|
|
@@ -164,7 +273,7 @@
|
|
|
164
273
|
position: absolute;
|
|
165
274
|
top: 0;
|
|
166
275
|
left: 0;
|
|
167
|
-
z-index:
|
|
276
|
+
z-index: 0;
|
|
168
277
|
border-radius: var(--radius-md);
|
|
169
278
|
background: var(--neutral-wash);
|
|
170
279
|
will-change: transform, opacity;
|
|
@@ -256,7 +365,6 @@
|
|
|
256
365
|
align-items: center;
|
|
257
366
|
gap: var(--space-3);
|
|
258
367
|
padding: var(--space-2) var(--space-3);
|
|
259
|
-
background: var(--bg-subtle);
|
|
260
368
|
border-top: var(--border-hairline) solid var(--border-subtle);
|
|
261
369
|
}
|
|
262
370
|
.zc-dtp__tz {
|
|
@@ -274,6 +382,7 @@
|
|
|
274
382
|
|
|
275
383
|
.zc-drp {
|
|
276
384
|
--dtp-cell: var(--control-height);
|
|
385
|
+
--dtp-gap: var(--space-1);
|
|
277
386
|
background: var(--bg-surface-raised);
|
|
278
387
|
border: var(--border-hairline) solid var(--border-default);
|
|
279
388
|
border-radius: var(--radius-lg);
|
|
@@ -286,14 +395,14 @@
|
|
|
286
395
|
}
|
|
287
396
|
|
|
288
397
|
.zc-drp__presets {
|
|
398
|
+
position: relative;
|
|
289
399
|
flex: none;
|
|
290
400
|
width: max-content;
|
|
291
401
|
display: flex;
|
|
292
402
|
flex-direction: column;
|
|
293
|
-
gap: var(--space-
|
|
403
|
+
gap: var(--space-1);
|
|
294
404
|
padding: var(--space-3) var(--space-2);
|
|
295
405
|
border-right: var(--border-hairline) solid var(--border-subtle);
|
|
296
|
-
background: var(--bg-subtle);
|
|
297
406
|
isolation: isolate;
|
|
298
407
|
}
|
|
299
408
|
.zc-drp__preset {
|
|
@@ -304,7 +413,10 @@
|
|
|
304
413
|
background: transparent;
|
|
305
414
|
color: var(--text-body);
|
|
306
415
|
font: var(--type-caption);
|
|
307
|
-
|
|
416
|
+
display: flex;
|
|
417
|
+
align-items: center;
|
|
418
|
+
min-height: var(--control-height-sm);
|
|
419
|
+
padding: var(--space-1) var(--space-2);
|
|
308
420
|
border-radius: var(--radius-md);
|
|
309
421
|
cursor: pointer;
|
|
310
422
|
transition: var(--transition-colors);
|
|
@@ -317,11 +429,12 @@
|
|
|
317
429
|
outline: var(--ring-accent);
|
|
318
430
|
}
|
|
319
431
|
.zc-drp__preset.zc-is-active {
|
|
320
|
-
background: var(--
|
|
432
|
+
background: var(--dtp-range);
|
|
321
433
|
color: var(--text-accent);
|
|
322
434
|
font-weight: var(--weight-medium);
|
|
323
435
|
}
|
|
324
436
|
.zc-drp__presetGlide {
|
|
437
|
+
opacity: 0;
|
|
325
438
|
position: absolute;
|
|
326
439
|
top: 0;
|
|
327
440
|
left: 0;
|
|
@@ -337,7 +450,7 @@
|
|
|
337
450
|
display: flex;
|
|
338
451
|
}
|
|
339
452
|
.zc-drp__months .zc-dtp__cal {
|
|
340
|
-
padding: var(--space-3);
|
|
453
|
+
padding: var(--space-3) var(--space-4);
|
|
341
454
|
}
|
|
342
455
|
.zc-drp__months .zc-dtp__cal + .zc-dtp__cal {
|
|
343
456
|
border-left: var(--border-hairline) solid var(--border-subtle);
|
|
@@ -375,37 +488,41 @@
|
|
|
375
488
|
}
|
|
376
489
|
|
|
377
490
|
.zc-drp__mhead {
|
|
378
|
-
display:
|
|
491
|
+
display: grid;
|
|
492
|
+
grid-template-columns: 1fr auto 1fr;
|
|
379
493
|
align-items: center;
|
|
380
494
|
gap: var(--space-2);
|
|
381
495
|
padding-bottom: var(--space-3);
|
|
382
496
|
margin-bottom: var(--space-3);
|
|
383
497
|
border-bottom: var(--border-hairline) solid var(--border-subtle);
|
|
384
|
-
margin-inline: calc(-1 * var(--space-
|
|
385
|
-
padding-inline: var(--space-
|
|
498
|
+
margin-inline: calc(-1 * var(--space-4));
|
|
499
|
+
padding-inline: var(--space-4);
|
|
386
500
|
}
|
|
387
|
-
.zc-drp__mhead .zc-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
padding-inline-start: 0;
|
|
501
|
+
.zc-drp__mhead .zc-dtp__jump {
|
|
502
|
+
grid-column: 2;
|
|
503
|
+
justify-self: center;
|
|
391
504
|
}
|
|
392
|
-
.zc-drp__mhead
|
|
393
|
-
|
|
505
|
+
.zc-drp__mhead .zc-dtp__nav {
|
|
506
|
+
grid-column: 1;
|
|
507
|
+
justify-self: start;
|
|
508
|
+
}
|
|
509
|
+
.zc-drp__mhead .zc-dtp__jump ~ .zc-dtp__nav {
|
|
510
|
+
grid-column: 3;
|
|
511
|
+
justify-self: end;
|
|
394
512
|
}
|
|
395
513
|
|
|
396
514
|
.zc-drp__band {
|
|
397
515
|
position: absolute;
|
|
398
516
|
inset: 0;
|
|
399
517
|
z-index: 0;
|
|
400
|
-
background: var(--
|
|
518
|
+
background: var(--dtp-range);
|
|
401
519
|
}
|
|
402
|
-
/* Overshoots the gap by 1px so neighbouring bands overlap instead of leaving a subpixel seam
|
|
403
|
-
opaque so the overlap does not darken. */
|
|
520
|
+
/* Overshoots the gap by 1px so neighbouring bands overlap instead of leaving a subpixel seam. */
|
|
404
521
|
.zc-drp__band--extL {
|
|
405
|
-
left: calc(-1 * var(--
|
|
522
|
+
left: calc(-1 * var(--dtp-gap) - 1px);
|
|
406
523
|
}
|
|
407
524
|
.zc-drp__band--extR {
|
|
408
|
-
right: calc(-1 * var(--
|
|
525
|
+
right: calc(-1 * var(--dtp-gap) - 1px);
|
|
409
526
|
}
|
|
410
527
|
.zc-drp__band--roundL {
|
|
411
528
|
border-top-left-radius: var(--radius-md);
|
|
@@ -421,7 +538,7 @@
|
|
|
421
538
|
inset: 0;
|
|
422
539
|
z-index: 1;
|
|
423
540
|
border-radius: var(--radius-md);
|
|
424
|
-
background: var(--accent
|
|
541
|
+
background: var(--accent);
|
|
425
542
|
}
|
|
426
543
|
.zc-drp__cap--ghost {
|
|
427
544
|
background: transparent;
|
|
@@ -436,11 +553,18 @@
|
|
|
436
553
|
}
|
|
437
554
|
.zc-drp .zc-dtp__day.zc-is-cap .zc-dtp__num,
|
|
438
555
|
.zc-drp .zc-dtp__day.zc-is-cap-ghost .zc-dtp__num {
|
|
439
|
-
color: var(--text-accent);
|
|
440
556
|
font-weight: var(--weight-semibold);
|
|
441
557
|
}
|
|
558
|
+
.zc-drp .zc-dtp__day.zc-is-cap .zc-dtp__num {
|
|
559
|
+
color: var(--text-on-accent);
|
|
560
|
+
}
|
|
561
|
+
.zc-drp .zc-dtp__day.zc-is-cap-ghost .zc-dtp__num {
|
|
562
|
+
color: var(--text-accent);
|
|
563
|
+
}
|
|
442
564
|
|
|
443
|
-
.zc-drp .zc-dtp__day.zc-is-cap .zc-dtp__dot
|
|
565
|
+
.zc-drp .zc-dtp__day.zc-is-cap .zc-dtp__dot {
|
|
566
|
+
background: var(--text-on-accent);
|
|
567
|
+
}
|
|
444
568
|
.zc-drp .zc-dtp__day.zc-is-cap-ghost .zc-dtp__dot {
|
|
445
569
|
background: var(--accent);
|
|
446
570
|
}
|
|
@@ -450,7 +574,6 @@
|
|
|
450
574
|
align-items: center;
|
|
451
575
|
gap: var(--space-3);
|
|
452
576
|
padding: var(--space-2) var(--space-3);
|
|
453
|
-
background: var(--bg-subtle);
|
|
454
577
|
border-top: var(--border-hairline) solid var(--border-subtle);
|
|
455
578
|
}
|
|
456
579
|
.zc-drp__readout {
|
|
@@ -492,6 +615,7 @@
|
|
|
492
615
|
width: auto;
|
|
493
616
|
flex-direction: row;
|
|
494
617
|
overflow-x: auto;
|
|
618
|
+
scroll-padding-inline: var(--ring-gutter);
|
|
495
619
|
gap: var(--space-1);
|
|
496
620
|
border-right: 0;
|
|
497
621
|
border-bottom: var(--border-hairline) solid var(--border-subtle);
|
|
@@ -502,6 +626,7 @@
|
|
|
502
626
|
}
|
|
503
627
|
.zc-drp--sheet .zc-drp__preset {
|
|
504
628
|
flex: none;
|
|
629
|
+
padding-block: var(--space-2);
|
|
505
630
|
}
|
|
506
631
|
.zc-drp--sheet .zc-drp__months {
|
|
507
632
|
justify-content: center;
|
|
@@ -548,8 +673,8 @@
|
|
|
548
673
|
cursor: not-allowed;
|
|
549
674
|
}
|
|
550
675
|
|
|
551
|
-
/* The box is a div in .zc-fld__input chrome, so the input focus rules never reach it; these
|
|
552
|
-
under .zc-tfd to outrank .zc-fld__input. */
|
|
676
|
+
/* The box is a div in .zc-fld__input chrome, so the input focus rules never reach it; these
|
|
677
|
+
restate them, scoped under .zc-tfd to outrank .zc-fld__input. */
|
|
553
678
|
.zc-tfd__box {
|
|
554
679
|
display: inline-flex;
|
|
555
680
|
align-items: center;
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useEffect, useRef, useState, type KeyboardEvent } from 'react';
|
|
4
|
+
|
|
5
|
+
import { animate } from '../../../engine';
|
|
6
|
+
import { GlidePill, useGlide } from '../../../motion/glide';
|
|
7
|
+
import { slideIn } from '../../../motion/presets';
|
|
8
|
+
import { UIMotion } from '../../../tokens/motion-tokens';
|
|
9
|
+
import { Icon } from '../../internal/icon/Icon';
|
|
10
|
+
import { activationProps, type ActivateOn } from '../../internal/utils/activation';
|
|
11
|
+
import { cx } from '../../internal/utils/cx';
|
|
12
|
+
import { Popover } from '../popover/Popover';
|
|
13
|
+
import { MONTHS, parse, toKey } from './date-utils';
|
|
14
|
+
|
|
15
|
+
const YEARS_PER_PAGE = 3;
|
|
16
|
+
const MONTH_COLUMNS = 3;
|
|
17
|
+
const UNBOUNDED_YEAR_REACH = 100;
|
|
18
|
+
const GRID_PARTS = '.zc-dtp__dow, .zc-dtp__days';
|
|
19
|
+
|
|
20
|
+
function gridBox(trigger: HTMLElement | null): DOMRect | null {
|
|
21
|
+
const cal = trigger && trigger.closest('.zc-dtp__cal');
|
|
22
|
+
const parts = cal && cal.querySelectorAll(GRID_PARTS);
|
|
23
|
+
if (!parts || parts.length === 0) return null;
|
|
24
|
+
const head = parts[0].getBoundingClientRect();
|
|
25
|
+
const tail = parts[parts.length - 1].getBoundingClientRect();
|
|
26
|
+
return new DOMRect(head.left, head.top, Math.max(head.width, tail.width), tail.bottom - head.top);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
interface MonthJumpProps {
|
|
30
|
+
y: number;
|
|
31
|
+
m: number;
|
|
32
|
+
min?: string;
|
|
33
|
+
max?: string;
|
|
34
|
+
onPick: (y: number, m: number) => void;
|
|
35
|
+
activateOn?: ActivateOn;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function MonthJump({ y, m, min, max, onPick, activateOn }: MonthJumpProps) {
|
|
39
|
+
const [open, setOpen] = useState(false);
|
|
40
|
+
const [page, setPage] = useState(y - 1);
|
|
41
|
+
const [year, setYear] = useState(y);
|
|
42
|
+
const [cursor, setCursor] = useState(m);
|
|
43
|
+
|
|
44
|
+
const [box, setBox] = useState<{ width: number; height: number } | null>(null);
|
|
45
|
+
|
|
46
|
+
const triggerRef = useRef<HTMLButtonElement>(null);
|
|
47
|
+
const monthsRef = useRef<HTMLDivElement>(null);
|
|
48
|
+
const stripRef = useRef<HTMLDivElement>(null);
|
|
49
|
+
|
|
50
|
+
const monthGlide = useGlide(monthsRef);
|
|
51
|
+
const yearGlide = useGlide(stripRef);
|
|
52
|
+
|
|
53
|
+
const minYear = min ? parse(min).getFullYear() : y - UNBOUNDED_YEAR_REACH;
|
|
54
|
+
const maxYear = max ? parse(max).getFullYear() : y + UNBOUNDED_YEAR_REACH;
|
|
55
|
+
|
|
56
|
+
const monthEnabled = (yy: number, mm: number): boolean => {
|
|
57
|
+
const first = toKey(new Date(yy, mm, 1));
|
|
58
|
+
const last = toKey(new Date(yy, mm + 1, 0));
|
|
59
|
+
return (!min || last >= min) && (!max || first <= max);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
function toggle(next: boolean) {
|
|
63
|
+
if (next) {
|
|
64
|
+
const grid = gridBox(triggerRef.current);
|
|
65
|
+
setBox(grid ? { width: grid.width, height: grid.height } : null);
|
|
66
|
+
setPage(y - 1);
|
|
67
|
+
setYear(y);
|
|
68
|
+
setCursor(m);
|
|
69
|
+
}
|
|
70
|
+
setOpen(next);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
useEffect(() => {
|
|
74
|
+
if (!open) return;
|
|
75
|
+
monthsRef.current?.querySelector<HTMLButtonElement>('[tabindex="0"]')?.focus();
|
|
76
|
+
}, [open, cursor]);
|
|
77
|
+
|
|
78
|
+
function turn(dir: number) {
|
|
79
|
+
const next = page + dir * YEARS_PER_PAGE;
|
|
80
|
+
if (next + YEARS_PER_PAGE - 1 < minYear || next > maxYear) return;
|
|
81
|
+
setPage(next);
|
|
82
|
+
yearGlide.leave();
|
|
83
|
+
const el = stripRef.current;
|
|
84
|
+
if (el) animate(el, slideIn(dir * UIMotion.dist.md, UIMotion.t.enter));
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function moveCursor(delta: number) {
|
|
88
|
+
const next = cursor + delta;
|
|
89
|
+
if (next < 0 || next > MONTHS.length - 1) return;
|
|
90
|
+
setCursor(next);
|
|
91
|
+
}
|
|
92
|
+
function onKeyDown(e: KeyboardEvent<HTMLDivElement>) {
|
|
93
|
+
const k = e.key;
|
|
94
|
+
if (k === 'ArrowLeft') moveCursor(-1);
|
|
95
|
+
else if (k === 'ArrowRight') moveCursor(1);
|
|
96
|
+
else if (k === 'ArrowUp') moveCursor(-MONTH_COLUMNS);
|
|
97
|
+
else if (k === 'ArrowDown') moveCursor(MONTH_COLUMNS);
|
|
98
|
+
else return;
|
|
99
|
+
e.preventDefault();
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function pick(mm: number) {
|
|
103
|
+
onPick(year, mm);
|
|
104
|
+
setOpen(false);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
const years: number[] = [];
|
|
108
|
+
for (let i = 0; i < YEARS_PER_PAGE; i++) years.push(page + i);
|
|
109
|
+
|
|
110
|
+
return (
|
|
111
|
+
<Popover
|
|
112
|
+
open={open}
|
|
113
|
+
onOpenChange={toggle}
|
|
114
|
+
side="bottom"
|
|
115
|
+
align="center"
|
|
116
|
+
arrow
|
|
117
|
+
activateOn={activateOn}
|
|
118
|
+
htmlProps={box ? { style: box } : undefined}
|
|
119
|
+
trigger={
|
|
120
|
+
<button
|
|
121
|
+
type="button"
|
|
122
|
+
ref={triggerRef}
|
|
123
|
+
className="zc-dtp__jump"
|
|
124
|
+
aria-label={'Change month - ' + MONTHS[m] + ' ' + y}
|
|
125
|
+
>
|
|
126
|
+
<span className="zc-dtp__month" aria-live="polite">
|
|
127
|
+
{MONTHS[m]} <span className="zc-dtp__year">{y}</span>
|
|
128
|
+
</span>
|
|
129
|
+
<Icon name="caret-down" size="sm" className="zc-dtp__jumpCaret" />
|
|
130
|
+
</button>
|
|
131
|
+
}
|
|
132
|
+
>
|
|
133
|
+
<div className="zc-dtp__jumpPanel" role="group" aria-label="Jump to month" onKeyDown={onKeyDown}>
|
|
134
|
+
<div className="zc-dtp__jumpYears">
|
|
135
|
+
<button
|
|
136
|
+
type="button"
|
|
137
|
+
className="zc-dtp__nav"
|
|
138
|
+
aria-label="Earlier years"
|
|
139
|
+
disabled={page <= minYear}
|
|
140
|
+
{...activationProps<HTMLButtonElement>(() => turn(-1), { on: activateOn })}
|
|
141
|
+
>
|
|
142
|
+
<Icon name="caret-left" size="sm" />
|
|
143
|
+
</button>
|
|
144
|
+
<div className="zc-dtp__jumpStrip" ref={stripRef} onPointerLeave={yearGlide.leave}>
|
|
145
|
+
{years.map((yy) => (
|
|
146
|
+
<button
|
|
147
|
+
key={yy}
|
|
148
|
+
type="button"
|
|
149
|
+
className={cx('zc-dtp__jumpOpt', 'zc-dtp__jumpYear', yy === year && 'zc-is-active')}
|
|
150
|
+
disabled={yy < minYear || yy > maxYear}
|
|
151
|
+
aria-pressed={yy === year}
|
|
152
|
+
onPointerEnter={(e) => yearGlide.enter(e.currentTarget)}
|
|
153
|
+
{...activationProps<HTMLButtonElement>(() => setYear(yy), { on: activateOn })}
|
|
154
|
+
>
|
|
155
|
+
{yy}
|
|
156
|
+
</button>
|
|
157
|
+
))}
|
|
158
|
+
<GlidePill className="zc-dtp__jumpGlide" glide={yearGlide} />
|
|
159
|
+
</div>
|
|
160
|
+
<button
|
|
161
|
+
type="button"
|
|
162
|
+
className="zc-dtp__nav"
|
|
163
|
+
aria-label="Later years"
|
|
164
|
+
disabled={page + YEARS_PER_PAGE - 1 >= maxYear}
|
|
165
|
+
{...activationProps<HTMLButtonElement>(() => turn(1), { on: activateOn })}
|
|
166
|
+
>
|
|
167
|
+
<Icon name="caret-right" size="sm" />
|
|
168
|
+
</button>
|
|
169
|
+
</div>
|
|
170
|
+
|
|
171
|
+
<div className="zc-dtp__jumpMonths" ref={monthsRef} onPointerLeave={monthGlide.leave}>
|
|
172
|
+
{MONTHS.map((name, mm) => (
|
|
173
|
+
<button
|
|
174
|
+
key={name}
|
|
175
|
+
type="button"
|
|
176
|
+
className={cx('zc-dtp__jumpOpt', year === y && mm === m && 'zc-is-active')}
|
|
177
|
+
disabled={!monthEnabled(year, mm)}
|
|
178
|
+
tabIndex={mm === cursor ? 0 : -1}
|
|
179
|
+
aria-pressed={year === y && mm === m}
|
|
180
|
+
aria-label={name + ' ' + year}
|
|
181
|
+
onPointerEnter={(e) => monthGlide.enter(e.currentTarget)}
|
|
182
|
+
{...activationProps<HTMLButtonElement>(() => pick(mm), { on: activateOn })}
|
|
183
|
+
>
|
|
184
|
+
{name.slice(0, 3)}
|
|
185
|
+
</button>
|
|
186
|
+
))}
|
|
187
|
+
<GlidePill className="zc-dtp__jumpGlide" glide={monthGlide} />
|
|
188
|
+
</div>
|
|
189
|
+
</div>
|
|
190
|
+
</Popover>
|
|
191
|
+
);
|
|
192
|
+
}
|
|
@@ -11,6 +11,7 @@ import { Icon } from '../../internal/icon/Icon';
|
|
|
11
11
|
import { activationProps, type ActivateOn } from '../../internal/utils/activation';
|
|
12
12
|
import { Button } from '../../primitives/button/Button';
|
|
13
13
|
import { add, col, DOW, grid, MONTHS, pad, parse, today, toKey, tzLabel, within } from './date-utils';
|
|
14
|
+
import { MonthJump } from './month-jump';
|
|
14
15
|
import { useDayFocus } from './use-day-focus';
|
|
15
16
|
|
|
16
17
|
const CAP_FLIP = { timing: UIMotion.t.settle };
|
|
@@ -153,11 +154,20 @@ export function DrpPanel({
|
|
|
153
154
|
}
|
|
154
155
|
|
|
155
156
|
const prevViewIdxRef = useRef(viewIdx);
|
|
156
|
-
const
|
|
157
|
+
const jumpedRef = useRef(false);
|
|
158
|
+
const navDir =
|
|
159
|
+
prevViewIdxRef.current === viewIdx || jumpedRef.current ? 0 : viewIdx > prevViewIdxRef.current ? 1 : -1;
|
|
157
160
|
useEffect(() => {
|
|
158
161
|
prevViewIdxRef.current = viewIdx;
|
|
162
|
+
jumpedRef.current = false;
|
|
159
163
|
}, [viewIdx]);
|
|
160
164
|
|
|
165
|
+
function jumpToMonth(y: number, m: number, offset: number) {
|
|
166
|
+
jumpedRef.current = true;
|
|
167
|
+
const base = new Date(y, m - offset, 1);
|
|
168
|
+
setView({ y: base.getFullYear(), m: base.getMonth() });
|
|
169
|
+
}
|
|
170
|
+
|
|
161
171
|
function moveFocus(deltaDays: number, deltaMonths = 0) {
|
|
162
172
|
const d = parse(focusKey);
|
|
163
173
|
if (deltaMonths) d.setMonth(d.getMonth() + deltaMonths);
|
|
@@ -276,7 +286,7 @@ export function DrpPanel({
|
|
|
276
286
|
const nextStart = toKey(new Date(y, m + 1, 1));
|
|
277
287
|
return (
|
|
278
288
|
<div className="zc-dtp__cal" key={offset}>
|
|
279
|
-
<div className=
|
|
289
|
+
<div className="zc-drp__mhead">
|
|
280
290
|
{withPrev ? (
|
|
281
291
|
<button
|
|
282
292
|
type="button"
|
|
@@ -288,9 +298,14 @@ export function DrpPanel({
|
|
|
288
298
|
<Icon name="caret-left" size="sm" />
|
|
289
299
|
</button>
|
|
290
300
|
) : null}
|
|
291
|
-
<
|
|
292
|
-
|
|
293
|
-
|
|
301
|
+
<MonthJump
|
|
302
|
+
y={y}
|
|
303
|
+
m={m}
|
|
304
|
+
min={min}
|
|
305
|
+
max={max}
|
|
306
|
+
activateOn={activateOn}
|
|
307
|
+
onPick={(py, pm) => jumpToMonth(py, pm, offset)}
|
|
308
|
+
/>
|
|
294
309
|
{withNext ? (
|
|
295
310
|
<button
|
|
296
311
|
type="button"
|
|
@@ -165,7 +165,7 @@ export function Dialog({
|
|
|
165
165
|
const triggerRef = useRef<HTMLElement>(null);
|
|
166
166
|
const close = () => setOpen(false);
|
|
167
167
|
|
|
168
|
-
const timings = resolveMotionTiming(animation, OV_TAKEOVER_TIMING);
|
|
168
|
+
const timings = resolveMotionTiming(animation, OV_TAKEOVER_TIMING, container ?? triggerRef.current);
|
|
169
169
|
|
|
170
170
|
return (
|
|
171
171
|
<Fragment>
|
|
@@ -177,7 +177,7 @@ export function Dialog({
|
|
|
177
177
|
triggerRef,
|
|
178
178
|
activateOn,
|
|
179
179
|
})}
|
|
180
|
-
<OverlayPortal container={container}>
|
|
180
|
+
<OverlayPortal container={container} scope={triggerRef.current}>
|
|
181
181
|
<Presence>
|
|
182
182
|
{open && (
|
|
183
183
|
<ModalShell
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
@layer zyncat.tokens, zyncat.components;
|
|
1
|
+
@layer zyncat.reset, zyncat.tokens, zyncat.components;
|
|
2
2
|
|
|
3
3
|
@layer zyncat.components {
|
|
4
4
|
.zc-overlay-layer--dialog {
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
display: flex;
|
|
43
43
|
align-items: flex-start;
|
|
44
44
|
gap: var(--space-3);
|
|
45
|
-
padding: var(--space-5) var(--space-5) var(--space-4);
|
|
45
|
+
padding: var(--space-5) var(--space-5) calc(var(--space-4) - var(--ring-gutter));
|
|
46
46
|
transition:
|
|
47
47
|
border-color var(--duration-base) var(--ease-standard),
|
|
48
48
|
box-shadow var(--duration-base) var(--ease-standard);
|
|
@@ -126,7 +126,8 @@
|
|
|
126
126
|
min-height: 0;
|
|
127
127
|
overflow-y: auto;
|
|
128
128
|
overscroll-behavior: contain;
|
|
129
|
-
padding:
|
|
129
|
+
scroll-padding: var(--ring-gutter);
|
|
130
|
+
padding: var(--ring-gutter) var(--space-5) var(--space-5);
|
|
130
131
|
color: var(--text-body);
|
|
131
132
|
font: var(--type-body);
|
|
132
133
|
}
|