@zyncat/ui 0.15.0 → 0.17.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 +21 -24
- package/dist/button.js +3 -1
- package/dist/checkbox.css +1 -1
- package/dist/chunk-2YGHPQ66.js +16 -0
- package/dist/chunk-2YGHPQ66.js.map +1 -0
- package/dist/{chunk-K45CWVHS.js → chunk-3MLUH2QL.js} +4 -4
- package/dist/{chunk-K45CWVHS.js.map → chunk-3MLUH2QL.js.map} +1 -1
- package/dist/{chunk-FVPNICF4.js → chunk-4PQDVK23.js} +4 -4
- package/dist/{chunk-FVPNICF4.js.map → chunk-4PQDVK23.js.map} +1 -1
- package/dist/{chunk-FLQVOSFC.js → chunk-6IXLW7QA.js} +7 -7
- package/dist/{chunk-FLQVOSFC.js.map → chunk-6IXLW7QA.js.map} +1 -1
- package/dist/chunk-7NHY2CRA.js +132 -0
- package/dist/chunk-7NHY2CRA.js.map +1 -0
- package/dist/{chunk-BH4JFWXQ.js → chunk-7VTWJL72.js} +19 -16
- package/dist/chunk-7VTWJL72.js.map +1 -0
- package/dist/chunk-7ZSIUUC3.js +50 -0
- package/dist/chunk-7ZSIUUC3.js.map +1 -0
- package/dist/{chunk-6X3G4GIM.js → chunk-DH7DT6EO.js} +3 -3
- package/dist/{chunk-6X3G4GIM.js.map → chunk-DH7DT6EO.js.map} +1 -1
- package/dist/{chunk-QGVFFT2B.js → chunk-EOWWVFBF.js} +3 -3
- package/dist/{chunk-QGVFFT2B.js.map → chunk-EOWWVFBF.js.map} +1 -1
- package/dist/{chunk-RBSHRRNO.js → chunk-FLDIRXFU.js} +5 -5
- package/dist/{chunk-RBSHRRNO.js.map → chunk-FLDIRXFU.js.map} +1 -1
- package/dist/{chunk-5GBV45YD.js → chunk-GWCBTD63.js} +3 -3
- package/dist/{chunk-5GBV45YD.js.map → chunk-GWCBTD63.js.map} +1 -1
- package/dist/chunk-GZ6UMHCK.js +103 -0
- package/dist/chunk-GZ6UMHCK.js.map +1 -0
- package/dist/{chunk-FEXUS4SV.js → chunk-HWDIVGME.js} +11 -5
- package/dist/chunk-HWDIVGME.js.map +1 -0
- package/dist/chunk-KSAJ6DED.js +16 -0
- package/dist/chunk-KSAJ6DED.js.map +1 -0
- package/dist/{chunk-UYSXJ7MH.js → chunk-LH2UIEKN.js} +7 -17
- package/dist/chunk-LH2UIEKN.js.map +1 -0
- package/dist/{chunk-CAXQJSIE.js → chunk-M2A6PZ7J.js} +6 -6
- package/dist/{chunk-CAXQJSIE.js.map → chunk-M2A6PZ7J.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-GJTHWB6O.js → chunk-QDAN43B6.js} +3 -3
- package/dist/{chunk-GJTHWB6O.js.map → chunk-QDAN43B6.js.map} +1 -1
- package/dist/{chunk-MDSRZ4QR.js → chunk-RY35IU3G.js} +3 -3
- package/dist/{chunk-MDSRZ4QR.js.map → chunk-RY35IU3G.js.map} +1 -1
- package/dist/{chunk-GOLSYGRA.js → chunk-TBLPZQSI.js} +84 -48
- package/dist/chunk-TBLPZQSI.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-CFRGQJ23.js → chunk-VZXML7EH.js} +4 -4
- package/dist/{chunk-CFRGQJ23.js.map → chunk-VZXML7EH.js.map} +1 -1
- package/dist/{chunk-PWQVSVXR.js → chunk-WC45VSST.js} +8 -8
- package/dist/{chunk-PWQVSVXR.js.map → chunk-WC45VSST.js.map} +1 -1
- package/dist/chunk-WQKWPI6V.js +196 -0
- package/dist/chunk-WQKWPI6V.js.map +1 -0
- package/dist/{chunk-N2GJEO5Z.js → chunk-ZHMOH62S.js} +4 -4
- package/dist/chunk-ZHMOH62S.js.map +1 -0
- package/dist/cli.js +259 -43
- package/dist/collapse.css +8 -5
- package/dist/confetti.css +3 -3
- package/dist/confetti.js +2 -2
- package/dist/date-field.js +16 -14
- package/dist/date-field.js.map +1 -1
- package/dist/date-picker.css +168 -43
- package/dist/date-range-field.js +38 -23
- package/dist/date-range-field.js.map +1 -1
- package/dist/datetime-field.js +17 -15
- package/dist/datetime-field.js.map +1 -1
- package/dist/dialog.css +4 -3
- package/dist/dialog.js +8 -8
- package/dist/digit-strip.css +1 -1
- package/dist/dropdown.css +1 -1
- package/dist/dropdown.js +8 -8
- package/dist/emoji-picker.js +14 -14
- 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 +6 -6
- 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 +9 -9
- 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 +6 -6
- package/dist/radio-group.css +6 -4
- package/dist/radio-group.js +6 -6
- package/dist/select.css +1 -1
- package/dist/select.js +9 -9
- package/dist/sheet.css +1 -1
- package/dist/sheet.js +7 -7
- 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 +97 -105
- 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 +6 -6
- 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-LLC644ZR.js +346 -0
- package/dist/theme-transition-LLC644ZR.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 +11 -9
- 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 +5 -5
- 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/icon/Icon.d.ts +1 -0
- 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/tokens/component-styles.generated.d.ts +35 -38
- package/dist/types/tokens/motion-tokens.d.ts +2 -2
- 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 +121 -109
- 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/weight-field.css +2 -2
- package/dist/youtube.css +1 -1
- package/dist/youtube.js +2 -2
- package/package.json +25 -31
- package/skills/zyncat-ui/references/components.md +5 -2
- 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.css +4 -3
- package/src/components/composites/dropdown/dropdown.css +1 -1
- package/src/components/composites/emoji-picker/styles.css +1 -1
- package/src/components/composites/modal/modal.css +1 -1
- package/src/components/composites/pagination/pagination.css +1 -1
- package/src/components/composites/popover/popover.css +1 -1
- package/src/components/composites/select/select.css +1 -1
- package/src/components/composites/sheet/sheet.css +1 -1
- package/src/components/composites/table/table.css +2 -2
- 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.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/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/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/overlay.css +1 -1
- package/src/components/internal/overlay/trigger.css +1 -1
- 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 +12 -26
- package/src/components/primitives/button/button-style.ts +28 -0
- package/src/components/primitives/button/button.css +21 -24
- 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/styles.css +3 -3
- 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 +5 -8
- 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 +3 -3
- 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 +10 -18
- 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 +124 -110
- 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 +7 -13
- 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-FEXUS4SV.js.map +0 -1
- package/dist/chunk-GOLSYGRA.js.map +0 -1
- package/dist/chunk-N2GJEO5Z.js.map +0 -1
- package/dist/chunk-UYSXJ7MH.js.map +0 -1
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
@layer zyncat.reset, zyncat.tokens, zyncat.components;
|
|
2
|
+
|
|
3
|
+
@layer zyncat.components {
|
|
4
|
+
.zc-theme-switcher.zc-btn {
|
|
5
|
+
padding-inline: var(--space-1);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.zc-theme-switcher__preview {
|
|
9
|
+
--_theme-switcher-unit: 4px;
|
|
10
|
+
--_theme-switcher-stroke: 2px;
|
|
11
|
+
position: relative;
|
|
12
|
+
display: grid;
|
|
13
|
+
width: calc(19 * var(--_theme-switcher-unit));
|
|
14
|
+
height: calc(12 * var(--_theme-switcher-unit));
|
|
15
|
+
border: var(--border-hairline) solid var(--border-default);
|
|
16
|
+
border-radius: var(--radius-sm);
|
|
17
|
+
background: var(--bg-app);
|
|
18
|
+
box-shadow: var(--shadow-xs);
|
|
19
|
+
transition:
|
|
20
|
+
transform var(--duration-fast) var(--ease-entrance),
|
|
21
|
+
box-shadow var(--duration-base) var(--ease-entrance),
|
|
22
|
+
border-color var(--duration-fast) var(--ease-standard);
|
|
23
|
+
}
|
|
24
|
+
.zc-theme-switcher__preview--chip {
|
|
25
|
+
--_theme-switcher-unit: 1.8px;
|
|
26
|
+
border-color: var(--border-strong);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.zc-theme-switcher__mini {
|
|
30
|
+
grid-area: 1 / 1;
|
|
31
|
+
border-radius: calc(var(--radius-sm) - var(--border-hairline));
|
|
32
|
+
background:
|
|
33
|
+
radial-gradient(circle closest-side, var(--accent) 92%, transparent) 8% 8% / 6.5% 10.5%,
|
|
34
|
+
linear-gradient(var(--text-strong), var(--text-strong)) 24% 11% / 24% var(--_theme-switcher-stroke),
|
|
35
|
+
linear-gradient(var(--text-secondary), var(--text-secondary)) 24% 41% / 57% var(--_theme-switcher-stroke),
|
|
36
|
+
linear-gradient(var(--accent-fill), var(--accent-fill)) 86% 83% / 26% 14.5%,
|
|
37
|
+
linear-gradient(var(--border-subtle), var(--border-subtle)) 0 25% / 100% var(--border-hairline),
|
|
38
|
+
linear-gradient(var(--bg-surface), var(--bg-surface)) 0 0 / 100% 25%,
|
|
39
|
+
var(--bg-app);
|
|
40
|
+
background-repeat: no-repeat;
|
|
41
|
+
}
|
|
42
|
+
.zc-theme-switcher__mini--half {
|
|
43
|
+
clip-path: polygon(58% 0, 100% 0, 100% 100%, 42% 100%);
|
|
44
|
+
}
|
|
45
|
+
.zc-theme-switcher__ring {
|
|
46
|
+
position: absolute;
|
|
47
|
+
inset: calc(-0.75 * var(--_theme-switcher-unit));
|
|
48
|
+
border: var(--border-emphasis) solid var(--accent);
|
|
49
|
+
border-radius: calc(var(--radius-sm) + 0.75 * var(--_theme-switcher-unit));
|
|
50
|
+
pointer-events: none;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.zc-theme-switcher__panel {
|
|
54
|
+
padding: var(--space-2);
|
|
55
|
+
background: var(--bg-surface-raised);
|
|
56
|
+
border: var(--border-hairline) solid var(--border-default);
|
|
57
|
+
border-radius: var(--radius-lg);
|
|
58
|
+
box-shadow: var(--shadow-lg);
|
|
59
|
+
color: var(--text-body);
|
|
60
|
+
}
|
|
61
|
+
.zc-theme-switcher__grid {
|
|
62
|
+
display: grid;
|
|
63
|
+
gap: var(--space-2);
|
|
64
|
+
}
|
|
65
|
+
.zc-theme-switcher__row {
|
|
66
|
+
display: grid;
|
|
67
|
+
grid-template-columns: repeat(3, auto);
|
|
68
|
+
gap: var(--space-px) var(--space-1);
|
|
69
|
+
}
|
|
70
|
+
.zc-theme-switcher__row-label {
|
|
71
|
+
grid-column: 1 / -1;
|
|
72
|
+
padding: var(--space-1) var(--space-1) 0;
|
|
73
|
+
font: var(--type-micro);
|
|
74
|
+
color: var(--text-subtle);
|
|
75
|
+
}
|
|
76
|
+
.zc-theme-switcher__card {
|
|
77
|
+
appearance: none;
|
|
78
|
+
display: grid;
|
|
79
|
+
justify-items: center;
|
|
80
|
+
gap: var(--space-1);
|
|
81
|
+
padding: var(--space-1);
|
|
82
|
+
border: 0;
|
|
83
|
+
border-radius: var(--radius-md);
|
|
84
|
+
background: transparent;
|
|
85
|
+
font: var(--type-micro);
|
|
86
|
+
color: var(--text-muted);
|
|
87
|
+
cursor: pointer;
|
|
88
|
+
transition: var(--transition-colors);
|
|
89
|
+
outline: var(--ring-rest);
|
|
90
|
+
}
|
|
91
|
+
.zc-theme-switcher__card:hover,
|
|
92
|
+
.zc-theme-switcher__card.zc-is-selected {
|
|
93
|
+
color: var(--text-strong);
|
|
94
|
+
}
|
|
95
|
+
.zc-theme-switcher__card:focus-visible {
|
|
96
|
+
outline: var(--ring-accent);
|
|
97
|
+
}
|
|
98
|
+
.zc-theme-switcher__card:hover .zc-theme-switcher__preview {
|
|
99
|
+
transform: translateY(calc(-2 * var(--space-px))) scale(1.06);
|
|
100
|
+
border-color: var(--border-strong);
|
|
101
|
+
box-shadow: var(--shadow-md);
|
|
102
|
+
}
|
|
103
|
+
.zc-theme-switcher__card:active .zc-theme-switcher__preview {
|
|
104
|
+
transform: none;
|
|
105
|
+
box-shadow: var(--shadow-xs);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
@@ -31,6 +31,7 @@ import { Icon, type IconName } from '../../internal/icon/Icon';
|
|
|
31
31
|
import { cx } from '../../internal/utils/cx';
|
|
32
32
|
import { tokenPx } from '../../internal/utils/token-px';
|
|
33
33
|
import { Button } from '../../primitives/button/Button';
|
|
34
|
+
import { Spinner } from '../../primitives/spinner/Spinner';
|
|
34
35
|
import { DEFAULT_TOASTER_CONFIG, UIToast, type ToasterConfig, type ToastRecord, type ToastTone } from './toast-store';
|
|
35
36
|
|
|
36
37
|
const SM = UIMotion;
|
|
@@ -187,7 +188,7 @@ function ToastBody({ t }: { t: ToastRecord }) {
|
|
|
187
188
|
{t.tone !== 'default' && (
|
|
188
189
|
<Motion as="span" className="zc-toast__icon-glyph" animate={GLYPH_POP} deps={[t.tone]}>
|
|
189
190
|
{t.tone === 'loading' ? (
|
|
190
|
-
<
|
|
191
|
+
<Spinner label={null} className="zc-toast__spinner" />
|
|
191
192
|
) : (
|
|
192
193
|
<Icon name={TONE_ICON[t.tone] || 'info'} weight="fill" />
|
|
193
194
|
)}
|
|
@@ -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-toast-viewport {
|
|
@@ -212,20 +212,8 @@
|
|
|
212
212
|
}
|
|
213
213
|
|
|
214
214
|
.zc-toast__spinner {
|
|
215
|
-
|
|
216
|
-
box-sizing: border-box;
|
|
217
|
-
width: var(--icon-sm);
|
|
218
|
-
height: var(--icon-sm);
|
|
219
|
-
border-radius: var(--radius-full);
|
|
220
|
-
border: var(--border-emphasis) solid currentColor;
|
|
221
|
-
border-right-color: transparent;
|
|
215
|
+
font-size: var(--icon-sm);
|
|
222
216
|
color: var(--text-muted);
|
|
223
|
-
animation: toast-spin var(--duration-spin) linear infinite;
|
|
224
|
-
}
|
|
225
|
-
@keyframes toast-spin {
|
|
226
|
-
to {
|
|
227
|
-
transform: rotate(1turn);
|
|
228
|
-
}
|
|
229
217
|
}
|
|
230
218
|
|
|
231
219
|
.zc-toast__custom {
|
|
@@ -9,39 +9,45 @@ import {
|
|
|
9
9
|
type CSSProperties,
|
|
10
10
|
type HTMLAttributes,
|
|
11
11
|
type ReactNode,
|
|
12
|
-
type PointerEvent as ReactPointerEvent,
|
|
13
12
|
type RefObject,
|
|
14
13
|
} from 'react';
|
|
15
14
|
|
|
16
15
|
import type { DataAttributes } from '../../../dom-props';
|
|
17
|
-
import {
|
|
16
|
+
import { animate, type Layer } from '../../../engine';
|
|
18
17
|
import { Motion } from '../../../motion/element';
|
|
18
|
+
import { resolveMotionTiming } from '../../../motion/motion-timing';
|
|
19
19
|
import { Presence } from '../../../motion/presence';
|
|
20
20
|
import { usePresence } from '../../../motion/presence-context';
|
|
21
|
+
import type { DisableableAnimation } from '../../../motion/timing';
|
|
21
22
|
import type { SupportRailStyle } from '../../../tokens/component-styles.generated';
|
|
22
|
-
import { UIMotion } from '../../../tokens/motion-tokens';
|
|
23
|
+
import { UIMotion, type MotionTransition } from '../../../tokens/motion-tokens';
|
|
23
24
|
import { useControllable } from '../../internal/hooks/use-controllable';
|
|
25
|
+
import { Icon } from '../../internal/icon/Icon';
|
|
24
26
|
import { useReturnFocus } from '../../internal/overlay/focus';
|
|
25
27
|
import { useOutsidePress, useOverlayEntry } from '../../internal/overlay/layer';
|
|
26
28
|
import type { SupportAction } from '../../internal/support/types';
|
|
27
29
|
import { cx } from '../../internal/utils/cx';
|
|
30
|
+
import { Button } from '../../primitives/button/Button';
|
|
31
|
+
import { buttonClass } from '../../primitives/button/button-style';
|
|
28
32
|
|
|
29
33
|
export type { SupportAction };
|
|
30
34
|
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
+
const RAIL_TIMING = {
|
|
36
|
+
open: { duration: 'slower', ease: 'spring' },
|
|
37
|
+
close: { duration: 'slow', ease: 'exit' },
|
|
38
|
+
} as const;
|
|
39
|
+
|
|
35
40
|
const CONTENT_FADE_IN_DELAY_RATIO = 0.55;
|
|
36
|
-
const NEUTRAL_RATIO = 1;
|
|
37
41
|
const STAGGER_STEPS_MAX = 8;
|
|
38
42
|
|
|
39
|
-
const DRAG_PROPERTY = '--_support-rail-drag';
|
|
40
|
-
const COLLAPSE_X_PROPERTY = '--_support-rail-collapse-x';
|
|
41
|
-
const COLLAPSE_Y_PROPERTY = '--_support-rail-collapse-y';
|
|
42
43
|
const INDEX_PROPERTY = '--_support-rail-index';
|
|
43
|
-
const
|
|
44
|
-
|
|
44
|
+
const MORPHING_ATTRIBUTE = 'data-morphing';
|
|
45
|
+
|
|
46
|
+
interface ShellBox {
|
|
47
|
+
width: number;
|
|
48
|
+
height: number;
|
|
49
|
+
radius: string;
|
|
50
|
+
}
|
|
45
51
|
|
|
46
52
|
const contentFadeIn = (): Layer => ({
|
|
47
53
|
opacity: [0, 1],
|
|
@@ -49,20 +55,28 @@ const contentFadeIn = (): Layer => ({
|
|
|
49
55
|
});
|
|
50
56
|
const contentFadeOut = (): Layer => ({ opacity: [0], timing: { duration: UIMotion.dur.fast, ease: 'linear' } });
|
|
51
57
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
function collapseRatio(needleSpan: number, panelSpan: number): number {
|
|
55
|
-
return panelSpan > 0 ? needleSpan / panelSpan : NEUTRAL_RATIO;
|
|
58
|
+
function measureShell(shell: HTMLElement): ShellBox {
|
|
59
|
+
return { width: shell.offsetWidth, height: shell.offsetHeight, radius: getComputedStyle(shell).borderRadius };
|
|
56
60
|
}
|
|
57
61
|
|
|
58
|
-
function
|
|
59
|
-
|
|
60
|
-
|
|
62
|
+
function morphShell(shell: HTMLElement, from: ShellBox, to: ShellBox, transition: MotionTransition) {
|
|
63
|
+
return animate(shell, {
|
|
64
|
+
width: [from.width, to.width],
|
|
65
|
+
height: [from.height, to.height],
|
|
66
|
+
radius: [from.radius, to.radius],
|
|
67
|
+
timing: { ...transition, fill: 'none' },
|
|
68
|
+
});
|
|
61
69
|
}
|
|
62
70
|
|
|
63
|
-
function
|
|
64
|
-
|
|
65
|
-
|
|
71
|
+
function fadeTab(tab: HTMLElement, open: boolean, transition: MotionTransition) {
|
|
72
|
+
const timing = open
|
|
73
|
+
? { duration: UIMotion.dur.fast, ease: 'linear' as const }
|
|
74
|
+
: {
|
|
75
|
+
duration: UIMotion.dur.fast,
|
|
76
|
+
ease: 'linear' as const,
|
|
77
|
+
delay: Math.max(0, transition.duration - UIMotion.dur.fast),
|
|
78
|
+
};
|
|
79
|
+
animate(tab, { opacity: open ? [1, 0] : [0, 1], timing });
|
|
66
80
|
}
|
|
67
81
|
|
|
68
82
|
function indexStyle(index: number): CSSProperties {
|
|
@@ -77,9 +91,7 @@ function SupportRailBody({
|
|
|
77
91
|
children,
|
|
78
92
|
panelId,
|
|
79
93
|
titleId,
|
|
80
|
-
|
|
81
|
-
needleRef,
|
|
82
|
-
onGrab,
|
|
94
|
+
shellRef,
|
|
83
95
|
requestClose,
|
|
84
96
|
onSelect,
|
|
85
97
|
}: {
|
|
@@ -90,18 +102,16 @@ function SupportRailBody({
|
|
|
90
102
|
children?: ReactNode;
|
|
91
103
|
panelId: string;
|
|
92
104
|
titleId: string;
|
|
93
|
-
|
|
94
|
-
needleRef: RefObject<HTMLElement>;
|
|
95
|
-
onGrab: GrabHandler;
|
|
105
|
+
shellRef: RefObject<HTMLElement>;
|
|
96
106
|
requestClose: () => void;
|
|
97
107
|
onSelect?: (id: string, action: SupportAction) => void;
|
|
98
108
|
}) {
|
|
99
109
|
const bodyRef = useRef<HTMLElement>(null);
|
|
100
110
|
const { isPresent } = usePresence();
|
|
101
|
-
const entry = useOverlayEntry({ nodeRef:
|
|
111
|
+
const entry = useOverlayEntry({ nodeRef: shellRef, dismissible: isPresent, requestClose });
|
|
102
112
|
|
|
103
|
-
useOutsidePress({ entry, refs: [
|
|
104
|
-
useReturnFocus(
|
|
113
|
+
useOutsidePress({ entry, refs: [shellRef], enabled: isPresent, onPress: requestClose });
|
|
114
|
+
useReturnFocus(shellRef);
|
|
105
115
|
|
|
106
116
|
useLayoutEffect(() => {
|
|
107
117
|
bodyRef.current?.focus({ preventScroll: true });
|
|
@@ -125,25 +135,25 @@ function SupportRailBody({
|
|
|
125
135
|
aria-labelledby={titleId}
|
|
126
136
|
tabIndex={-1}
|
|
127
137
|
>
|
|
128
|
-
<
|
|
129
|
-
<
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
<div className="zc-support-rail__stack">
|
|
133
|
-
<div className="zc-support-rail__header">
|
|
134
|
-
<div className="zc-support-rail__heading">
|
|
135
|
-
<div className="zc-support-rail__title" id={titleId}>
|
|
136
|
-
{title}
|
|
137
|
-
</div>
|
|
138
|
-
{status && <div className="zc-support-rail__status">{status}</div>}
|
|
138
|
+
<div className="zc-support-rail__header">
|
|
139
|
+
<div className="zc-support-rail__heading">
|
|
140
|
+
<div className="zc-support-rail__title" id={titleId}>
|
|
141
|
+
{title}
|
|
139
142
|
</div>
|
|
140
|
-
<
|
|
141
|
-
<svg width="9" height="9" viewBox="0 0 9 9" fill="none" stroke="currentColor" strokeWidth="1.3">
|
|
142
|
-
<path d="M1 1l7 7M8 1l-7 7" />
|
|
143
|
-
</svg>
|
|
144
|
-
</button>
|
|
143
|
+
{status && <div className="zc-support-rail__status">{status}</div>}
|
|
145
144
|
</div>
|
|
145
|
+
<Button
|
|
146
|
+
variant="ghost"
|
|
147
|
+
size="icon"
|
|
148
|
+
className="zc-support-rail__close"
|
|
149
|
+
aria-label="Close"
|
|
150
|
+
onClick={requestClose}
|
|
151
|
+
>
|
|
152
|
+
<Icon name="x" size="sm" />
|
|
153
|
+
</Button>
|
|
154
|
+
</div>
|
|
146
155
|
|
|
156
|
+
<div className="zc-support-rail__scroll">
|
|
147
157
|
<ul className="zc-support-rail__list">
|
|
148
158
|
{actions.map((action, index) => (
|
|
149
159
|
<li key={action.id}>
|
|
@@ -169,13 +179,13 @@ function SupportRailBody({
|
|
|
169
179
|
<div className="zc-support-rail__extra" style={indexStyle(actions.length)}>
|
|
170
180
|
{children}
|
|
171
181
|
</div>
|
|
172
|
-
|
|
173
|
-
{footer && (
|
|
174
|
-
<div className="zc-support-rail__footer" style={indexStyle(actions.length + 1)}>
|
|
175
|
-
{footer}
|
|
176
|
-
</div>
|
|
177
|
-
)}
|
|
178
182
|
</div>
|
|
183
|
+
|
|
184
|
+
{footer && (
|
|
185
|
+
<div className="zc-support-rail__footer" style={indexStyle(actions.length + 1)}>
|
|
186
|
+
{footer}
|
|
187
|
+
</div>
|
|
188
|
+
)}
|
|
179
189
|
</Motion>
|
|
180
190
|
);
|
|
181
191
|
}
|
|
@@ -185,9 +195,9 @@ export interface SupportRailOwnProps {
|
|
|
185
195
|
actions: SupportAction[];
|
|
186
196
|
/** Panel heading, and the panel's accessible name. @default 'Talk to us' */
|
|
187
197
|
title?: string;
|
|
188
|
-
/** Small
|
|
198
|
+
/** Small mono line under the heading - opening hours, queue depth, a shift note. */
|
|
189
199
|
status?: string;
|
|
190
|
-
/** Container edge the rail pins to. Flips the
|
|
200
|
+
/** Container edge the rail pins to. Flips the tab, the morph origin and the panel's border. @default 'right' */
|
|
191
201
|
side?: 'right' | 'left';
|
|
192
202
|
/** Controlled open state. Omit to stay uncontrolled. */
|
|
193
203
|
open?: boolean;
|
|
@@ -197,11 +207,12 @@ export interface SupportRailOwnProps {
|
|
|
197
207
|
onOpenChange?: (open: boolean) => void;
|
|
198
208
|
/** Fires when a row commits - gets its `id` and the full action. The rail stays open; render what happens next in `children`. */
|
|
199
209
|
onSelect?: (id: string, action: SupportAction) => void;
|
|
200
|
-
/**
|
|
201
|
-
|
|
202
|
-
/**
|
|
203
|
-
|
|
204
|
-
|
|
210
|
+
/** Retune the morph, per direction. `null` turns it off and the rail snaps. */
|
|
211
|
+
animation?: DisableableAnimation;
|
|
212
|
+
/** What sits inside the edge tab - an icon, a word, an avatar. The rail owns the tab itself: its
|
|
213
|
+
* edge, its ARIA and its morph. Defaults to a chat glyph; `title` names it either way. */
|
|
214
|
+
trigger?: ReactNode;
|
|
215
|
+
/** Arbitrary content under the rows, inside the same scroll region. */
|
|
205
216
|
children?: ReactNode;
|
|
206
217
|
/** Pinned bottom strip - on-shift avatars, an SLA line, a link out. */
|
|
207
218
|
footer?: ReactNode;
|
|
@@ -225,8 +236,8 @@ export function SupportRail({
|
|
|
225
236
|
defaultOpen = false,
|
|
226
237
|
onOpenChange,
|
|
227
238
|
onSelect,
|
|
228
|
-
|
|
229
|
-
|
|
239
|
+
animation,
|
|
240
|
+
trigger,
|
|
230
241
|
children,
|
|
231
242
|
footer,
|
|
232
243
|
className = '',
|
|
@@ -235,63 +246,43 @@ export function SupportRail({
|
|
|
235
246
|
}: SupportRailProps) {
|
|
236
247
|
const [open, setOpen] = useControllable(controlledOpen, defaultOpen, onOpenChange);
|
|
237
248
|
const rootRef = useRef<HTMLDivElement>(null);
|
|
238
|
-
const
|
|
239
|
-
const
|
|
240
|
-
const
|
|
249
|
+
const shellRef = useRef<HTMLElement>(null);
|
|
250
|
+
const tabRef = useRef<HTMLButtonElement>(null);
|
|
251
|
+
const fromBox = useRef<ShellBox | null>(null);
|
|
241
252
|
const autoId = useId();
|
|
242
253
|
const panelId = 'support-rail-' + autoId;
|
|
243
254
|
const titleId = panelId + '-title';
|
|
244
|
-
const
|
|
245
|
-
const requestClose = () => setOpen(false);
|
|
255
|
+
const timings = resolveMotionTiming(animation, RAIL_TIMING);
|
|
246
256
|
|
|
247
|
-
const
|
|
248
|
-
const
|
|
249
|
-
if (
|
|
250
|
-
|
|
251
|
-
root.setAttribute(DRAGGING_ATTRIBUTE, '');
|
|
252
|
-
detach.current = startDrag(event, {
|
|
253
|
-
onMove: (info: PanInfo) =>
|
|
254
|
-
root.style.setProperty(DRAG_PROPERTY, railTravel(info.offset.x, dismissSign) * dismissSign + 'px'),
|
|
255
|
-
onEnd: (info: PanInfo) => {
|
|
256
|
-
detach.current = null;
|
|
257
|
-
root.removeAttribute(DRAGGING_ATTRIBUTE);
|
|
258
|
-
const travel = railTravel(info.offset.x, dismissSign);
|
|
259
|
-
if (railDismisses(travel, info.velocity.x * dismissSign)) requestClose();
|
|
260
|
-
else root.style.setProperty(DRAG_PROPERTY, NO_DRAG);
|
|
261
|
-
},
|
|
262
|
-
});
|
|
257
|
+
const toggle = (next: boolean) => {
|
|
258
|
+
const shell = shellRef.current;
|
|
259
|
+
if (shell) fromBox.current = measureShell(shell);
|
|
260
|
+
setOpen(next);
|
|
263
261
|
};
|
|
264
262
|
|
|
265
263
|
useLayoutEffect(() => {
|
|
266
264
|
const root = rootRef.current;
|
|
267
|
-
const
|
|
268
|
-
const
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
root.style.setProperty(COLLAPSE_Y_PROPERTY, String(collapseRatio(needle.offsetHeight, panel.offsetHeight)));
|
|
273
|
-
};
|
|
274
|
-
remeasure();
|
|
275
|
-
const sizes = new ResizeObserver(remeasure);
|
|
276
|
-
sizes.observe(panel);
|
|
277
|
-
sizes.observe(needle);
|
|
278
|
-
return () => sizes.disconnect();
|
|
279
|
-
}, [side]);
|
|
265
|
+
const shell = shellRef.current;
|
|
266
|
+
const tab = tabRef.current;
|
|
267
|
+
const from = fromBox.current;
|
|
268
|
+
fromBox.current = null;
|
|
269
|
+
if (!root || !shell || !tab || !from) return undefined;
|
|
280
270
|
|
|
281
|
-
|
|
282
|
-
const
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
root.removeAttribute(DRAGGING_ATTRIBUTE);
|
|
286
|
-
}, [open]);
|
|
271
|
+
const transition = open ? timings.open : timings.close;
|
|
272
|
+
const morph = morphShell(shell, from, measureShell(shell), transition);
|
|
273
|
+
fadeTab(tab, open, transition);
|
|
274
|
+
if (!morph) return undefined;
|
|
287
275
|
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
|
|
276
|
+
root.setAttribute(MORPHING_ATTRIBUTE, '');
|
|
277
|
+
let live = true;
|
|
278
|
+
morph.finished.then(() => {
|
|
279
|
+
if (live) root.removeAttribute(MORPHING_ATTRIBUTE);
|
|
280
|
+
});
|
|
281
|
+
return () => {
|
|
282
|
+
live = false;
|
|
283
|
+
root.removeAttribute(MORPHING_ATTRIBUTE);
|
|
284
|
+
};
|
|
285
|
+
}, [open]);
|
|
295
286
|
|
|
296
287
|
return (
|
|
297
288
|
<div
|
|
@@ -302,21 +293,20 @@ export function SupportRail({
|
|
|
302
293
|
data-open={open}
|
|
303
294
|
{...htmlProps}
|
|
304
295
|
>
|
|
305
|
-
<
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
296
|
+
<div ref={shellRef as RefObject<HTMLDivElement>} className="zc-support-rail__shell">
|
|
297
|
+
<button
|
|
298
|
+
type="button"
|
|
299
|
+
ref={tabRef}
|
|
300
|
+
className={buttonClass({ className: 'zc-support-rail__tab' })}
|
|
301
|
+
aria-expanded={open}
|
|
302
|
+
aria-haspopup="dialog"
|
|
303
|
+
aria-controls={open ? panelId : undefined}
|
|
304
|
+
aria-label={title}
|
|
305
|
+
onClick={() => toggle(true)}
|
|
306
|
+
>
|
|
307
|
+
{trigger ?? <Icon name="chat" />}
|
|
308
|
+
</button>
|
|
318
309
|
|
|
319
|
-
<div ref={panelRef as RefObject<HTMLDivElement>} className="zc-support-rail__panel">
|
|
320
310
|
<Presence>
|
|
321
311
|
{open && (
|
|
322
312
|
<SupportRailBody
|
|
@@ -327,10 +317,8 @@ export function SupportRail({
|
|
|
327
317
|
footer={footer}
|
|
328
318
|
panelId={panelId}
|
|
329
319
|
titleId={titleId}
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
onGrab={onGrab}
|
|
333
|
-
requestClose={requestClose}
|
|
320
|
+
shellRef={shellRef}
|
|
321
|
+
requestClose={() => toggle(false)}
|
|
334
322
|
onSelect={onSelect}
|
|
335
323
|
>
|
|
336
324
|
{children}
|
|
@@ -7,12 +7,13 @@ An edge tab that grows a support panel out of its own measured box.
|
|
|
7
7
|
|
|
8
8
|
Pick it over Sheet when the affordance must stay visible and the panel must not take the screen
|
|
9
9
|
over. actions renders the rows; selecting one fires onSelect and leaves the rail open, so render
|
|
10
|
-
what happens next in children. title names the panel, status is the mono line under it,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
what happens next in children. title names the panel and the tab, status is the mono line under it,
|
|
11
|
+
footer pins a bottom strip. trigger is what sits inside the tab - an icon, a word, an avatar; the
|
|
12
|
+
rail keeps the tab's edge, ARIA and fold, and falls back to a chat glyph. side right|left flips the
|
|
13
|
+
tab, the collapse origin and the panel's border. Escape, the close button and a press outside all
|
|
14
|
+
dismiss. The rows and children share one scroll region between the pinned header and footer. Row
|
|
15
|
+
padding is --support-rail-row-pad-block/-inline, not a density prop.
|
|
15
16
|
|
|
16
17
|
```tsx
|
|
17
|
-
<SupportRail actions={actions} status="Open - closes 20:00"
|
|
18
|
+
<SupportRail actions={actions} status="Open - closes 20:00" onSelect={route} />
|
|
18
19
|
```
|