@zyncat/ui 0.19.0 → 0.21.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.css +1 -2
- package/dist/alert.js +6 -6
- package/dist/avatar.css +1 -1
- package/dist/badge.css +21 -12
- package/dist/badge.js +100 -2
- package/dist/badge.js.map +1 -1
- package/dist/{bloom-HV23M4AW.js → bloom-5MZXLNKG.js} +23 -5
- package/dist/bloom-5MZXLNKG.js.map +1 -0
- package/dist/button.css +1 -2
- package/dist/button.js +2 -2
- package/dist/checkbox.css +1 -1
- package/dist/{chunk-JINATP4N.js → chunk-2W7FOMWE.js} +7 -8
- package/dist/chunk-2W7FOMWE.js.map +1 -0
- package/dist/{chunk-LNAV5E7S.js → chunk-3HE7N3UK.js} +7 -3
- package/dist/chunk-3HE7N3UK.js.map +1 -0
- package/dist/{chunk-UKPX3RIP.js → chunk-47OMFFIB.js} +3 -3
- package/dist/{chunk-UKPX3RIP.js.map → chunk-47OMFFIB.js.map} +1 -1
- package/dist/chunk-4M5FMCFJ.js +16 -0
- package/dist/chunk-4M5FMCFJ.js.map +1 -0
- package/dist/chunk-6BY5G7BI.js +122 -0
- package/dist/chunk-6BY5G7BI.js.map +1 -0
- package/dist/{chunk-RLNCRDAL.js → chunk-AOEO2LCZ.js} +4 -4
- package/dist/{chunk-RLNCRDAL.js.map → chunk-AOEO2LCZ.js.map} +1 -1
- package/dist/{chunk-BRKGYLEQ.js → chunk-AQMR7ZYO.js} +8 -3
- package/dist/chunk-AQMR7ZYO.js.map +1 -0
- package/dist/{chunk-N43NDSME.js → chunk-AXZBD7LY.js} +6 -3
- package/dist/chunk-AXZBD7LY.js.map +1 -0
- package/dist/{chunk-V6QAAOA5.js → chunk-BWGK3OD6.js} +9 -6
- package/dist/chunk-BWGK3OD6.js.map +1 -0
- package/dist/{chunk-VQFILXQN.js → chunk-CYZKPUCG.js} +70 -8
- package/dist/chunk-CYZKPUCG.js.map +1 -0
- package/dist/{chunk-AIAPXRCI.js → chunk-DEZIQTBW.js} +176 -103
- package/dist/chunk-DEZIQTBW.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-F64Z42PJ.js → chunk-GM7IPTTT.js} +5 -6
- package/dist/chunk-GM7IPTTT.js.map +1 -0
- package/dist/chunk-ITW5UCVU.js +24 -0
- package/dist/chunk-ITW5UCVU.js.map +1 -0
- package/dist/{chunk-TDHLZY6I.js → chunk-JQZ3FTHP.js} +77 -18
- package/dist/chunk-JQZ3FTHP.js.map +1 -0
- package/dist/{chunk-PXQBJMPJ.js → chunk-LC6NQQER.js} +3 -3
- package/dist/{chunk-PXQBJMPJ.js.map → chunk-LC6NQQER.js.map} +1 -1
- package/dist/{chunk-M2KGLH2G.js → chunk-LV442ZOR.js} +10 -10
- package/dist/{chunk-M2KGLH2G.js.map → chunk-LV442ZOR.js.map} +1 -1
- package/dist/{chunk-F2TB3TT6.js → chunk-PNFFK5HY.js} +4 -4
- package/dist/{chunk-F2TB3TT6.js.map → chunk-PNFFK5HY.js.map} +1 -1
- 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-XKDR22VE.js → chunk-SPFHWHJ6.js} +8 -4
- package/dist/chunk-SPFHWHJ6.js.map +1 -0
- package/dist/{chunk-TRPAKUIB.js → chunk-TBIY5YR5.js} +8 -8
- package/dist/{chunk-TRPAKUIB.js.map → chunk-TBIY5YR5.js.map} +1 -1
- package/dist/chunk-TXJQUN7C.js +108 -0
- package/dist/chunk-TXJQUN7C.js.map +1 -0
- package/dist/{chunk-VZXML7EH.js → chunk-V4ZN5RD4.js} +12 -3
- package/dist/chunk-V4ZN5RD4.js.map +1 -0
- package/dist/{chunk-VJXP256V.js → chunk-ZSP4ZTII.js} +7 -7
- package/dist/{chunk-VJXP256V.js.map → chunk-ZSP4ZTII.js.map} +1 -1
- package/dist/collapse.css +1 -1
- package/dist/confetti.css +1 -1
- package/dist/confetti.js +1 -1
- package/dist/crossfade-XFZLFLT7.js +91 -0
- package/dist/crossfade-XFZLFLT7.js.map +1 -0
- package/dist/date-field.js +20 -18
- package/dist/date-field.js.map +1 -1
- package/dist/date-picker.css +7 -8
- package/dist/date-range-field.js +22 -20
- 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 +1 -2
- package/dist/dialog.js +9 -9
- package/dist/digit-strip.css +1 -1
- package/dist/dropdown.css +13 -10
- package/dist/dropdown.js +37 -20
- package/dist/dropdown.js.map +1 -1
- package/dist/emoji-picker.js +14 -14
- package/dist/facebook-feed.css +1 -1
- package/dist/flow-field.css +1 -1
- package/dist/flow-field.js +1 -1
- package/dist/glide.js +2 -2
- package/dist/icon.css +1 -1
- package/dist/input.css +1 -4
- package/dist/instagram-feed.css +1 -1
- package/dist/instagram-feed.js +2 -2
- package/dist/lens.css +1 -1
- package/dist/lens.js +1 -1
- package/dist/menu-surface.css +82 -8
- package/dist/modal.css +1 -1
- package/dist/modal.js +8 -8
- package/dist/morphing-text.css +1 -1
- package/dist/morphing-text.js +1 -1
- package/dist/motion-devtools.css +1 -1
- package/dist/motion-devtools.js +3 -3
- package/dist/motion.js +9 -0
- package/dist/motion.js.map +1 -0
- package/dist/multi-select.js +34 -16
- package/dist/multi-select.js.map +1 -1
- package/dist/number-field.js +2 -2
- package/dist/odometer.css +17 -11
- package/dist/odometer.js +105 -72
- package/dist/odometer.js.map +1 -1
- package/dist/otp-field.js +17 -9
- package/dist/otp-field.js.map +1 -1
- package/dist/overlay.css +1 -1
- package/dist/pagination.css +1 -1
- package/dist/pagination.js +4 -4
- package/dist/{paint-CJQCM6ZO.js → paint-NLTI6TEF.js} +5 -3
- package/dist/paint-NLTI6TEF.js.map +1 -0
- package/dist/popover.css +1 -1
- package/dist/popover.js +9 -9
- package/dist/radio-group.css +11 -5
- package/dist/radio-group.js +5 -5
- package/dist/select.css +34 -8
- package/dist/select.js +25 -12
- package/dist/select.js.map +1 -1
- package/dist/sheet.css +1 -1
- package/dist/sheet.js +9 -9
- package/dist/spinner.css +1 -1
- package/dist/styles.css +1 -1
- package/dist/support-rail.css +7 -2
- package/dist/support-rail.js +11 -11
- package/dist/table.css +10 -5
- package/dist/table.js +7 -7
- package/dist/tabs.css +32 -7
- package/dist/tabs.js +55 -44
- package/dist/tabs.js.map +1 -1
- package/dist/tag.css +1 -1
- package/dist/tag.js +4 -4
- package/dist/textarea.css +14 -2
- package/dist/textarea.js +36 -23
- package/dist/textarea.js.map +1 -1
- package/dist/theme-grid.js +5 -5
- package/dist/theme-switcher.css +1 -2
- package/dist/theme-switcher.js +14 -14
- package/dist/{theme-transition-VGLPZDJI.js → theme-transition-FDF2REFD.js} +27 -7
- package/dist/theme-transition-FDF2REFD.js.map +1 -0
- package/dist/theme-transition.css +50 -1
- package/dist/theme.js +2 -2
- 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.css +1 -1
- package/dist/tiktok.js +2 -2
- package/dist/time-field.js +5 -3
- package/dist/time-field.js.map +1 -1
- package/dist/toast.css +1 -1
- package/dist/toast.js +7 -7
- package/dist/toggle-tag.js +2 -2
- package/dist/toggle.css +1 -1
- package/dist/toggle.js +4 -15
- package/dist/toggle.js.map +1 -1
- package/dist/tooltip.css +1 -1
- package/dist/tooltip.js +6 -7
- package/dist/tooltip.js.map +1 -1
- package/dist/trigger.css +1 -2
- package/dist/types/components/composites/date-picker/DateField.d.ts +1 -1
- package/dist/types/components/composites/date-picker/DateRangeField.d.ts +1 -1
- 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/field-shell.d.ts +5 -1
- package/dist/types/components/composites/dropdown/Dropdown.d.ts +13 -2
- package/dist/types/components/composites/dropdown/types.d.ts +5 -2
- package/dist/types/components/composites/select/MultiSelect.d.ts +23 -3
- 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 +8 -5
- package/dist/types/components/composites/select/core/panel.d.ts +6 -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 +5 -3
- package/dist/types/components/composites/tabs/Tabs.d.ts +6 -1
- package/dist/types/components/expressive/odometer/Odometer.d.ts +1 -1
- package/dist/types/components/expressive/odometer/roll.d.ts +20 -0
- package/dist/types/components/expressive/theme-transition/scene.d.ts +3 -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/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/input/OtpField.d.ts +2 -2
- package/dist/types/components/primitives/textarea/Textarea.d.ts +2 -2
- 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/motion/crossfade.d.ts +3 -0
- package/dist/types/motion/element.d.ts +6 -3
- package/dist/types/motion/flip.d.ts +8 -2
- package/dist/types/motion/motion.d.ts +7 -0
- package/dist/types/theme-scope.d.ts +5 -0
- package/dist/types/tokens/component-styles.generated.d.ts +0 -2
- package/dist/types/tokens/theme-tokens.generated.d.ts +38 -32
- package/dist/typing-lines.css +1 -1
- package/dist/typing-lines.js +1 -1
- package/dist/weight-field.css +1 -1
- package/dist/youtube.css +1 -1
- package/dist/youtube.js +2 -2
- package/package.json +6 -11
- package/skills/zyncat-ui/SKILL.md +2 -2
- package/skills/zyncat-ui/references/components.md +3 -4
- package/skills/zyncat-ui/references/theming.md +3 -3
- package/src/components/composites/alert/alert.css +1 -2
- package/src/components/composites/date-picker/DateField.tsx +2 -0
- package/src/components/composites/date-picker/DateRangeField.tsx +2 -0
- package/src/components/composites/date-picker/DateTimeField.tsx +2 -0
- package/src/components/composites/date-picker/TimeField.tsx +2 -0
- package/src/components/composites/date-picker/date-picker.css +7 -8
- package/src/components/composites/date-picker/field-shell.tsx +14 -1
- package/src/components/composites/dialog/dialog.css +1 -2
- package/src/components/composites/dropdown/Dropdown.tsx +20 -3
- package/src/components/composites/dropdown/Dropdown.usage.md +2 -0
- package/src/components/composites/dropdown/dropdown.css +13 -10
- package/src/components/composites/dropdown/menu-panel.tsx +28 -13
- package/src/components/composites/dropdown/types.ts +5 -2
- 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/MultiSelect.tsx +56 -5
- 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 +28 -15
- package/src/components/composites/select/core/panel.tsx +57 -52
- package/src/components/composites/select/core/trigger.tsx +44 -11
- package/src/components/composites/select/core/types.ts +10 -0
- package/src/components/composites/select/core/use-listbox.ts +77 -31
- package/src/components/composites/select/select.css +34 -8
- package/src/components/composites/sheet/sheet.css +1 -1
- package/src/components/composites/table/table.css +10 -5
- package/src/components/composites/tabs/Tabs.tsx +13 -1
- package/src/components/composites/tabs/tabs.css +32 -7
- package/src/components/composites/theme-switcher/theme-switcher.css +1 -2
- package/src/components/composites/toast/toast.css +1 -1
- package/src/components/composites/tooltip/tooltip-host.tsx +1 -1
- package/src/components/composites/tooltip/tooltip.css +1 -1
- package/src/components/compound/support-rail/support-rail.css +7 -2
- package/src/components/dev/motion-devtools.css +1 -1
- package/src/components/expressive/confetti/confetti.css +1 -1
- package/src/components/expressive/facebook-feed/facebook-feed.css +1 -1
- package/src/components/expressive/flow-field/flow-field.css +1 -1
- package/src/components/expressive/instagram-feed/instagram-feed.css +1 -1
- package/src/components/expressive/lens/lens.css +1 -1
- package/src/components/expressive/morphing-text/morphing-text.css +1 -1
- package/src/components/expressive/odometer/Odometer.tsx +45 -92
- package/src/components/expressive/odometer/Odometer.usage.md +2 -2
- package/src/components/expressive/odometer/odometer.css +17 -11
- package/src/components/expressive/odometer/roll.ts +94 -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 +50 -1
- package/src/components/expressive/theme-transition/theme-transition.ts +21 -1
- package/src/components/expressive/theme-transition/tide.ts +15 -10
- package/src/components/expressive/tiktok/tiktok.css +1 -1
- package/src/components/expressive/typing-lines/typing-lines.css +1 -1
- package/src/components/expressive/weight-field/weight-field.css +1 -1
- package/src/components/expressive/youtube/youtube.css +1 -1
- package/src/components/internal/glass/glass.css +1 -1
- package/src/components/internal/icon/icon.css +1 -1
- 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 +82 -8
- 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 -1
- 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 +1 -2
- package/src/components/internal/utils/activation.ts +5 -0
- 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 +21 -12
- package/src/components/primitives/badge/digit-strip.css +1 -1
- 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.css +1 -2
- package/src/components/primitives/checkbox/checkbox.css +1 -1
- package/src/components/primitives/collapse/collapse.css +1 -1
- package/src/components/primitives/input/OtpField.tsx +17 -9
- package/src/components/primitives/input/input.css +1 -4
- package/src/components/primitives/radio-group/radio-group.css +11 -5
- package/src/components/primitives/spinner/spinner.css +1 -1
- package/src/components/primitives/tag/tag.css +1 -1
- package/src/components/primitives/textarea/Textarea.tsx +20 -24
- package/src/components/primitives/textarea/char-meter.tsx +34 -0
- package/src/components/primitives/textarea/textarea.css +14 -2
- 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 +1 -1
- package/src/engine/flip.ts +5 -1
- package/src/motion/crossfade.ts +97 -0
- package/src/motion/element.tsx +10 -7
- package/src/motion/flip.ts +62 -23
- package/src/motion/glide.tsx +5 -0
- package/src/motion/motion.ts +7 -0
- package/src/motion/motion.usage.md +34 -0
- package/src/motion/presence.tsx +4 -0
- package/src/motion/use-motion.ts +8 -3
- package/src/styles.css +1 -1
- package/src/theme-scope.ts +19 -0
- package/src/tokens/base.css +62 -13
- package/src/tokens/color.css +18 -16
- package/src/tokens/component-styles.generated.ts +0 -2
- package/src/tokens/dark.css +4 -1
- package/src/tokens/decisions.css +6 -4
- package/src/tokens/elevation.css +1 -1
- package/src/tokens/glass.css +1 -1
- package/src/tokens/motion.css +4 -4
- package/src/tokens/radius.css +1 -1
- package/src/tokens/reset.css +17 -45
- package/src/tokens/semantic.css +13 -7
- package/src/tokens/spacing.css +4 -4
- package/src/tokens/theme-tokens.generated.ts +38 -32
- package/src/tokens/typography.css +1 -1
- package/tailwind.css +3 -1
- 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-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-LNAV5E7S.js.map +0 -1
- package/dist/chunk-N43NDSME.js.map +0 -1
- package/dist/chunk-RJENXXTI.js +0 -93
- package/dist/chunk-RJENXXTI.js.map +0 -1
- package/dist/chunk-RW2A4M2Q.js +0 -57
- package/dist/chunk-RW2A4M2Q.js.map +0 -1
- package/dist/chunk-TDHLZY6I.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-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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
@layer zyncat.reset, zyncat.tokens, zyncat.components;
|
|
1
|
+
@layer zyncat.reset, zyncat.tokens, zyncat.base, zyncat.components;
|
|
2
2
|
|
|
3
3
|
@layer zyncat.components {
|
|
4
4
|
.zc-badge {
|
|
@@ -7,19 +7,17 @@
|
|
|
7
7
|
--badge-sheen: rgb(255 255 255 / calc(0.5 * var(--sheen-strength)));
|
|
8
8
|
--badge-sheen-hover: rgb(255 255 255 / calc(0.6 * var(--sheen-strength)));
|
|
9
9
|
|
|
10
|
+
position: relative;
|
|
11
|
+
isolation: isolate;
|
|
10
12
|
display: inline-flex;
|
|
11
13
|
align-items: center;
|
|
12
14
|
gap: var(--space-1);
|
|
13
15
|
padding-block: var(--space-1);
|
|
14
16
|
padding-inline: var(--space-2);
|
|
15
|
-
border-radius: var(--radius-
|
|
17
|
+
border-radius: var(--radius-md);
|
|
16
18
|
|
|
17
|
-
font
|
|
18
|
-
|
|
19
|
-
line-height: var(--leading-micro);
|
|
20
|
-
font-weight: var(--weight-medium);
|
|
21
|
-
font-variant-numeric: tabular-nums;
|
|
22
|
-
letter-spacing: 0;
|
|
19
|
+
font: var(--type-micro);
|
|
20
|
+
letter-spacing: var(--tracking-normal);
|
|
23
21
|
white-space: nowrap;
|
|
24
22
|
vertical-align: middle;
|
|
25
23
|
color: var(--badge-fg);
|
|
@@ -27,9 +25,17 @@
|
|
|
27
25
|
-webkit-user-select: none;
|
|
28
26
|
}
|
|
29
27
|
|
|
28
|
+
.zc-badge--soft {
|
|
29
|
+
background: var(--badge-fill);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.zc-badge--num {
|
|
33
|
+
font-family: var(--font-code);
|
|
34
|
+
font-variant-numeric: tabular-nums;
|
|
35
|
+
}
|
|
36
|
+
|
|
30
37
|
.zc-badge--sm {
|
|
31
|
-
padding-block: var(--space-px);
|
|
32
|
-
gap: var(--space-px);
|
|
38
|
+
padding-block: calc(2 * var(--space-px));
|
|
33
39
|
}
|
|
34
40
|
|
|
35
41
|
.zc-badge--pill {
|
|
@@ -83,33 +89,36 @@
|
|
|
83
89
|
|
|
84
90
|
.zc-badge--neutral {
|
|
85
91
|
--badge-fg: var(--text-muted);
|
|
92
|
+
--badge-fill: var(--bg-muted);
|
|
86
93
|
--badge-tint: var(--glass-tint-neutral);
|
|
87
94
|
--badge-dot: var(--text-subtle);
|
|
88
95
|
}
|
|
89
96
|
.zc-badge--info {
|
|
90
97
|
--badge-fg: var(--info-text);
|
|
98
|
+
--badge-fill: var(--info-subtle);
|
|
91
99
|
--badge-tint: var(--glass-tint-info);
|
|
92
100
|
--badge-dot: var(--info);
|
|
93
101
|
}
|
|
94
102
|
.zc-badge--success {
|
|
95
103
|
--badge-fg: var(--success-text);
|
|
104
|
+
--badge-fill: var(--success-subtle);
|
|
96
105
|
--badge-tint: var(--glass-tint-success);
|
|
97
106
|
--badge-dot: var(--success);
|
|
98
107
|
}
|
|
99
108
|
.zc-badge--warning {
|
|
100
109
|
--badge-fg: var(--warning-text);
|
|
110
|
+
--badge-fill: var(--warning-subtle);
|
|
101
111
|
--badge-tint: var(--glass-tint-warning);
|
|
102
112
|
--badge-dot: var(--warning);
|
|
103
113
|
}
|
|
104
114
|
.zc-badge--danger {
|
|
105
115
|
--badge-fg: var(--danger-text);
|
|
116
|
+
--badge-fill: var(--danger-subtle);
|
|
106
117
|
--badge-tint: var(--glass-tint-danger);
|
|
107
118
|
--badge-dot: var(--danger);
|
|
108
119
|
}
|
|
109
120
|
|
|
110
121
|
.zc-badge--outline {
|
|
111
|
-
position: relative;
|
|
112
|
-
isolation: isolate;
|
|
113
122
|
background: color-mix(in oklab, var(--badge-fg) 6%, transparent);
|
|
114
123
|
box-shadow:
|
|
115
124
|
inset 0 0 0 var(--border-hairline) color-mix(in oklab, var(--badge-fg) 30%, transparent),
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useEffect, useLayoutEffect, useRef, useState } from 'react';
|
|
4
|
+
|
|
5
|
+
import { UIMotion } from '../../../tokens/motion-tokens';
|
|
6
|
+
import { cx } from '../../internal/utils/cx';
|
|
7
|
+
|
|
8
|
+
const DROP_GRACE_MS = 80;
|
|
9
|
+
|
|
10
|
+
interface Word {
|
|
11
|
+
key: number;
|
|
12
|
+
label: string;
|
|
13
|
+
cls: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function MorphLabel({ label }: { label: string }) {
|
|
17
|
+
const prev = useRef(label);
|
|
18
|
+
const keyRef = useRef(1);
|
|
19
|
+
const ghostRef = useRef<HTMLSpanElement>(null);
|
|
20
|
+
const [words, setWords] = useState<Word[]>([{ key: 0, label, cls: '' }]);
|
|
21
|
+
const [boxW, setBoxW] = useState<number>();
|
|
22
|
+
|
|
23
|
+
useLayoutEffect(() => {
|
|
24
|
+
let live = true;
|
|
25
|
+
const measure = () => {
|
|
26
|
+
if (live && ghostRef.current) setBoxW(ghostRef.current.offsetWidth);
|
|
27
|
+
};
|
|
28
|
+
measure();
|
|
29
|
+
document.fonts?.ready.then(measure);
|
|
30
|
+
return () => {
|
|
31
|
+
live = false;
|
|
32
|
+
};
|
|
33
|
+
}, []);
|
|
34
|
+
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
if (prev.current === label) return;
|
|
37
|
+
prev.current = label;
|
|
38
|
+
const nk = keyRef.current++;
|
|
39
|
+
const nextW = ghostRef.current?.offsetWidth;
|
|
40
|
+
|
|
41
|
+
setWords((ws) => ws.concat({ key: nk, label, cls: 'zc-badge__word--in' }));
|
|
42
|
+
const raf = requestAnimationFrame(() =>
|
|
43
|
+
requestAnimationFrame(() => {
|
|
44
|
+
setWords((ws) => ws.map((w) => (w.key === nk ? { ...w, cls: '' } : { ...w, cls: 'zc-badge__word--out' })));
|
|
45
|
+
if (nextW) setBoxW(nextW);
|
|
46
|
+
}),
|
|
47
|
+
);
|
|
48
|
+
const drop = setTimeout(
|
|
49
|
+
() => setWords((ws) => ws.filter((w) => !w.cls.includes('--out'))),
|
|
50
|
+
UIMotion.dur.base * 1000 + DROP_GRACE_MS,
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
return () => {
|
|
54
|
+
cancelAnimationFrame(raf);
|
|
55
|
+
clearTimeout(drop);
|
|
56
|
+
};
|
|
57
|
+
}, [label]);
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<span className="zc-badge__morph" style={boxW ? { width: boxW } : undefined}>
|
|
61
|
+
<span className="zc-badge__ghost" ref={ghostRef} aria-hidden="true">
|
|
62
|
+
{label}
|
|
63
|
+
</span>
|
|
64
|
+
{words.map((w) => (
|
|
65
|
+
<span key={w.key} className={cx('zc-badge__word', w.cls)}>
|
|
66
|
+
{w.label}
|
|
67
|
+
</span>
|
|
68
|
+
))}
|
|
69
|
+
</span>
|
|
70
|
+
);
|
|
71
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useEffect, useRef, type RefObject } from 'react';
|
|
4
|
+
|
|
5
|
+
import { fireGlint } from '../../internal/glass/glint';
|
|
6
|
+
|
|
7
|
+
export function useGlintOnChange(ref: RefObject<HTMLElement | null>, value: string, enabled: boolean) {
|
|
8
|
+
const prev = useRef(value);
|
|
9
|
+
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
if (prev.current === value) return;
|
|
12
|
+
prev.current = value;
|
|
13
|
+
if (!enabled || !ref.current) return;
|
|
14
|
+
return fireGlint(ref.current);
|
|
15
|
+
}, [ref, value, enabled]);
|
|
16
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
@layer zyncat.reset, zyncat.tokens, zyncat.components;
|
|
1
|
+
@layer zyncat.reset, zyncat.tokens, zyncat.base, zyncat.components;
|
|
2
2
|
|
|
3
3
|
@property --btn-grad-a {
|
|
4
4
|
syntax: '<color>';
|
|
@@ -56,7 +56,6 @@
|
|
|
56
56
|
box-shadow var(--duration-fast) var(--ease-standard),
|
|
57
57
|
outline-color var(--duration-fast) var(--ease-standard),
|
|
58
58
|
transform var(--btn-press-timing);
|
|
59
|
-
outline: var(--ring-rest);
|
|
60
59
|
}
|
|
61
60
|
|
|
62
61
|
.zc-btn:focus-visible {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
@layer zyncat.reset, zyncat.tokens, zyncat.components;
|
|
1
|
+
@layer zyncat.reset, zyncat.tokens, zyncat.base, zyncat.components;
|
|
2
2
|
|
|
3
3
|
/* Registered non-inheriting so a Collapse's inline timing never leaks into a Collapse nested
|
|
4
4
|
inside it; unset, they resolve invalid and the var() fallbacks supply the defaults. */
|
|
@@ -30,8 +30,8 @@ interface OtpFieldOwnProps {
|
|
|
30
30
|
error?: boolean;
|
|
31
31
|
/** Disable every slot. */
|
|
32
32
|
disabled?: boolean;
|
|
33
|
-
/**
|
|
34
|
-
size?: 'sm';
|
|
33
|
+
/** Slot width, height and digit type. @default 'md' */
|
|
34
|
+
size?: 'sm' | 'md';
|
|
35
35
|
/** Extra class(es) appended to the root wrapper. */
|
|
36
36
|
className?: string;
|
|
37
37
|
/** Inline styles merged onto the root wrapper. */
|
|
@@ -50,7 +50,7 @@ export function OtpField({
|
|
|
50
50
|
group,
|
|
51
51
|
error,
|
|
52
52
|
disabled,
|
|
53
|
-
size,
|
|
53
|
+
size = 'md',
|
|
54
54
|
className = '',
|
|
55
55
|
style,
|
|
56
56
|
htmlProps,
|
|
@@ -77,6 +77,14 @@ export function OtpField({
|
|
|
77
77
|
caretEnd(el);
|
|
78
78
|
}
|
|
79
79
|
};
|
|
80
|
+
const fill = (i: number, digits: string) => {
|
|
81
|
+
if (!digits) return;
|
|
82
|
+
const start = Math.max(0, Math.min(i, length - digits.length));
|
|
83
|
+
const a = chars.slice();
|
|
84
|
+
for (let k = 0; k < digits.length && start + k < length; k++) a[start + k] = digits[k];
|
|
85
|
+
emit(a.join(''));
|
|
86
|
+
go(Math.min(start + digits.length, length - 1));
|
|
87
|
+
};
|
|
80
88
|
|
|
81
89
|
const cls = cx('zc-otp', size === 'sm' && 'zc-otp--sm', error && 'zc-is-error', className);
|
|
82
90
|
|
|
@@ -102,9 +110,11 @@ export function OtpField({
|
|
|
102
110
|
go(i);
|
|
103
111
|
}}
|
|
104
112
|
onChange={(e: ChangeEvent<HTMLInputElement>) => {
|
|
105
|
-
const
|
|
106
|
-
setAt(i,
|
|
107
|
-
|
|
113
|
+
const digits = e.target.value.replace(/[^\d]/g, '');
|
|
114
|
+
if (!digits) return setAt(i, '');
|
|
115
|
+
const prev = chars[i].trim();
|
|
116
|
+
const added = prev && digits.startsWith(prev) ? digits.slice(prev.length) : digits;
|
|
117
|
+
fill(i, added || prev);
|
|
108
118
|
}}
|
|
109
119
|
onKeyDown={(e: KeyboardEvent<HTMLInputElement>) => {
|
|
110
120
|
if (e.key === 'Backspace' && !chars[i].trim() && i > 0) {
|
|
@@ -121,9 +131,7 @@ export function OtpField({
|
|
|
121
131
|
}}
|
|
122
132
|
onPaste={(e: ClipboardEvent<HTMLInputElement>) => {
|
|
123
133
|
e.preventDefault();
|
|
124
|
-
|
|
125
|
-
emit(chars.slice(0, i).join('') + d);
|
|
126
|
-
refs.current[Math.min(i + d.length, length - 1)]?.focus();
|
|
134
|
+
fill(i, (e.clipboardData.getData('text') || '').replace(/[^\d]/g, ''));
|
|
127
135
|
}}
|
|
128
136
|
/>,
|
|
129
137
|
);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
@layer zyncat.reset, zyncat.tokens, zyncat.components;
|
|
1
|
+
@layer zyncat.reset, zyncat.tokens, zyncat.base, zyncat.components;
|
|
2
2
|
|
|
3
3
|
@layer zyncat.components {
|
|
4
4
|
.zc-fld {
|
|
@@ -40,7 +40,6 @@
|
|
|
40
40
|
transition: var(--transition-control);
|
|
41
41
|
appearance: none;
|
|
42
42
|
-webkit-appearance: none;
|
|
43
|
-
outline: var(--ring-rest);
|
|
44
43
|
}
|
|
45
44
|
.zc-fld__input::placeholder {
|
|
46
45
|
color: var(--text-disabled);
|
|
@@ -126,7 +125,6 @@
|
|
|
126
125
|
border-radius: var(--radius-sm);
|
|
127
126
|
cursor: pointer;
|
|
128
127
|
transition: var(--transition-control);
|
|
129
|
-
outline: var(--ring-rest);
|
|
130
128
|
}
|
|
131
129
|
.zc-fld__action:hover {
|
|
132
130
|
color: var(--text-strong);
|
|
@@ -264,7 +262,6 @@
|
|
|
264
262
|
transition: var(--transition-control);
|
|
265
263
|
caret-color: var(--accent);
|
|
266
264
|
appearance: none;
|
|
267
|
-
outline: var(--ring-rest);
|
|
268
265
|
}
|
|
269
266
|
.zc-otp__slot:hover:not(:disabled):not(:focus) {
|
|
270
267
|
border-color: var(--border-strong);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
@layer zyncat.reset, zyncat.tokens, zyncat.components;
|
|
1
|
+
@layer zyncat.reset, zyncat.tokens, zyncat.base, zyncat.components;
|
|
2
2
|
|
|
3
3
|
@layer zyncat.components {
|
|
4
4
|
/* Bespoke px: the authored value is the ring gap and the marker falls out of it, so the two
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
--radio-group-dot: 18px;
|
|
8
8
|
--radio-group-dot-gap: 4px;
|
|
9
9
|
--radio-group-dot-inner: calc(var(--radio-group-dot) - 2 * (var(--border-hairline) + var(--radio-group-dot-gap)));
|
|
10
|
+
--radio-group-hover-wash: color-mix(in oklab, var(--neutral-wash) 60%, transparent);
|
|
10
11
|
|
|
11
12
|
display: grid;
|
|
12
13
|
border: 0;
|
|
@@ -89,7 +90,7 @@
|
|
|
89
90
|
left: 0;
|
|
90
91
|
z-index: 0;
|
|
91
92
|
border-radius: var(--radius-md);
|
|
92
|
-
background: var(--
|
|
93
|
+
background: var(--radio-group-hover-wash);
|
|
93
94
|
pointer-events: none;
|
|
94
95
|
}
|
|
95
96
|
.zc-rg-opt__control,
|
|
@@ -128,6 +129,7 @@
|
|
|
128
129
|
transition:
|
|
129
130
|
var(--transition-control),
|
|
130
131
|
transform var(--duration-fast) var(--ease-standard);
|
|
132
|
+
outline: var(--ring-rest);
|
|
131
133
|
}
|
|
132
134
|
.zc-rg__marker {
|
|
133
135
|
position: absolute;
|
|
@@ -208,6 +210,10 @@
|
|
|
208
210
|
transition:
|
|
209
211
|
var(--transition-control),
|
|
210
212
|
transform var(--duration-fast) var(--ease-standard);
|
|
213
|
+
outline: var(--ring-rest);
|
|
214
|
+
}
|
|
215
|
+
.zc-rg--cards .zc-rg-opt.zc-is-selected {
|
|
216
|
+
z-index: 1;
|
|
211
217
|
}
|
|
212
218
|
.zc-rg--cards .zc-rg-opt:active:not(.zc-is-disabled) {
|
|
213
219
|
transform: translateY(var(--space-px));
|
|
@@ -233,15 +239,15 @@
|
|
|
233
239
|
|
|
234
240
|
inset: calc(-1 * var(--border-hairline));
|
|
235
241
|
z-index: 1;
|
|
236
|
-
border: var(--border-hairline) solid var(--accent);
|
|
242
|
+
border: var(--border-hairline) solid var(--accent-border);
|
|
237
243
|
border-radius: var(--radius-lg);
|
|
238
|
-
background: var(--accent-
|
|
244
|
+
background: var(--accent-wash);
|
|
239
245
|
pointer-events: none;
|
|
240
246
|
}
|
|
241
247
|
|
|
242
248
|
.zc-rg--cards .zc-rg-opt:hover:not(.zc-is-disabled):not(.zc-is-selected) {
|
|
243
249
|
border-color: var(--border-strong);
|
|
244
|
-
background: var(--
|
|
250
|
+
background: var(--radio-group-hover-wash);
|
|
245
251
|
}
|
|
246
252
|
.zc-rg--cards .zc-rg-opt > .zc-rg-opt__icon,
|
|
247
253
|
.zc-rg--cards .zc-rg-opt > .zc-rg-opt__control,
|
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
|
|
17
17
|
import type { DataAttributes } from '../../../dom-props';
|
|
18
18
|
import { cx } from '../../internal/utils/cx';
|
|
19
|
+
import { Collapse } from '../collapse/Collapse';
|
|
19
20
|
import {
|
|
20
21
|
FieldLabel,
|
|
21
22
|
FieldMessage,
|
|
@@ -24,8 +25,7 @@ import {
|
|
|
24
25
|
resolveFieldMessage,
|
|
25
26
|
type FieldMessagingProps,
|
|
26
27
|
} from '../input/field-chrome';
|
|
27
|
-
|
|
28
|
-
const RING_C = (2 * Math.PI * 7).toFixed(2);
|
|
28
|
+
import { CharMeter } from './char-meter';
|
|
29
29
|
|
|
30
30
|
type TextareaNative = Pick<
|
|
31
31
|
TextareaHTMLAttributes<HTMLTextAreaElement>,
|
|
@@ -49,8 +49,8 @@ interface TextareaOwnProps extends FieldMessagingProps, TextareaNative {
|
|
|
49
49
|
warnAt?: number;
|
|
50
50
|
/** Footer hint, left of the meter - e.g. a ⌘↵ affordance. */
|
|
51
51
|
hint?: ReactNode;
|
|
52
|
-
/**
|
|
53
|
-
size?: 'md' | 'lg';
|
|
52
|
+
/** Field type and padding: `sm` for a dense form row, `lg` for a prominent composer. @default 'md' */
|
|
53
|
+
size?: 'sm' | 'md' | 'lg';
|
|
54
54
|
/** Extra class(es) merged onto the field root. */
|
|
55
55
|
className?: string;
|
|
56
56
|
/** Inline styles merged onto the field root. */
|
|
@@ -81,7 +81,7 @@ export function Textarea({
|
|
|
81
81
|
maxRows = 10,
|
|
82
82
|
warnAt = 20,
|
|
83
83
|
hint,
|
|
84
|
-
size,
|
|
84
|
+
size = 'md',
|
|
85
85
|
disabled,
|
|
86
86
|
readOnly,
|
|
87
87
|
className = '',
|
|
@@ -94,8 +94,9 @@ export function Textarea({
|
|
|
94
94
|
const text = value ?? '';
|
|
95
95
|
const count = text.length;
|
|
96
96
|
const over = max ? Math.max(count - max, 0) : 0;
|
|
97
|
-
const
|
|
98
|
-
|
|
97
|
+
const lastMax = useRef(max);
|
|
98
|
+
if (max) lastMax.current = max;
|
|
99
|
+
const meterMax = max ?? lastMax.current;
|
|
99
100
|
|
|
100
101
|
const { state, msg, msgIcon } = resolveFieldMessage(error, warning, success, helper);
|
|
101
102
|
const autoId = useId();
|
|
@@ -140,7 +141,13 @@ export function Textarea({
|
|
|
140
141
|
onKeyDown?.(e);
|
|
141
142
|
};
|
|
142
143
|
|
|
143
|
-
const cls = cx(
|
|
144
|
+
const cls = cx(
|
|
145
|
+
'zc-fld',
|
|
146
|
+
'zc-fld--txa',
|
|
147
|
+
size === 'sm' ? 'zc-fld--sm' : size === 'lg' ? 'zc-fld--lg' : '',
|
|
148
|
+
state,
|
|
149
|
+
className,
|
|
150
|
+
);
|
|
144
151
|
const boxCls = cx('zc-txa', disabled && 'zc-is-disabled', readOnly && 'zc-is-readonly');
|
|
145
152
|
|
|
146
153
|
return (
|
|
@@ -173,25 +180,14 @@ export function Textarea({
|
|
|
173
180
|
aria-describedby={joinIds(msgId, htmlProps?.['aria-describedby'])}
|
|
174
181
|
/>
|
|
175
182
|
</div>
|
|
176
|
-
{(max || hint)
|
|
183
|
+
<Collapse open={!!(max || hint)}>
|
|
177
184
|
<div className="zc-txa__bar">
|
|
178
185
|
{hint && <span className="zc-txa__hint">{hint}</span>}
|
|
179
|
-
{max
|
|
180
|
-
<
|
|
181
|
-
|
|
182
|
-
<svg
|
|
183
|
-
className="zc-txa__ring"
|
|
184
|
-
viewBox="0 0 16 16"
|
|
185
|
-
aria-hidden="true"
|
|
186
|
-
style={{ '--txa-ring-c': RING_C, '--txa-ring-p': Math.min(count / max, 1) } as CSSProperties}
|
|
187
|
-
>
|
|
188
|
-
<circle className="zc-txa__ring-trk" cx="8" cy="8" r="7" />
|
|
189
|
-
<circle className="zc-txa__ring-prg" cx="8" cy="8" r="7" />
|
|
190
|
-
</svg>
|
|
191
|
-
</span>
|
|
192
|
-
)}
|
|
186
|
+
<Collapse open={!!max} axis="width" fade className="zc-txa__meter-slot">
|
|
187
|
+
{meterMax ? <CharMeter count={count} max={meterMax} warnAt={warnAt} /> : null}
|
|
188
|
+
</Collapse>
|
|
193
189
|
</div>
|
|
194
|
-
|
|
190
|
+
</Collapse>
|
|
195
191
|
</div>
|
|
196
192
|
<FieldMessage id={msgId} message={msg} icon={msgIcon} />
|
|
197
193
|
</div>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import type { CSSProperties } from 'react';
|
|
4
|
+
|
|
5
|
+
import { cx } from '../../internal/utils/cx';
|
|
6
|
+
|
|
7
|
+
const RING_C = (2 * Math.PI * 7).toFixed(2);
|
|
8
|
+
|
|
9
|
+
export interface CharMeterProps {
|
|
10
|
+
count: number;
|
|
11
|
+
max: number;
|
|
12
|
+
warnAt: number;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function CharMeter({ count, max, warnAt }: CharMeterProps) {
|
|
16
|
+
const over = Math.max(count - max, 0);
|
|
17
|
+
const remaining = max - count;
|
|
18
|
+
const state = over ? 'zc-is-over' : remaining <= warnAt ? 'zc-is-near' : '';
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<span className={cx('zc-txa__meter', state)}>
|
|
22
|
+
<span className="zc-txa__count">{over || remaining <= warnAt ? remaining : `${count} / ${max}`}</span>
|
|
23
|
+
<svg
|
|
24
|
+
className="zc-txa__ring"
|
|
25
|
+
viewBox="0 0 16 16"
|
|
26
|
+
aria-hidden="true"
|
|
27
|
+
style={{ '--txa-ring-c': RING_C, '--txa-ring-p': Math.min(count / max, 1) } as CSSProperties}
|
|
28
|
+
>
|
|
29
|
+
<circle className="zc-txa__ring-trk" cx="8" cy="8" r="7" />
|
|
30
|
+
<circle className="zc-txa__ring-prg" cx="8" cy="8" r="7" />
|
|
31
|
+
</svg>
|
|
32
|
+
</span>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
@layer zyncat.reset, zyncat.tokens, zyncat.components;
|
|
1
|
+
@layer zyncat.reset, zyncat.tokens, zyncat.base, zyncat.components;
|
|
2
2
|
|
|
3
3
|
@layer zyncat.components {
|
|
4
4
|
.zc-txa {
|
|
@@ -119,9 +119,11 @@
|
|
|
119
119
|
white-space: nowrap;
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
-
.zc-txa__meter {
|
|
122
|
+
.zc-txa__meter-slot {
|
|
123
123
|
margin-left: auto;
|
|
124
124
|
flex: none;
|
|
125
|
+
}
|
|
126
|
+
.zc-txa__meter {
|
|
125
127
|
display: inline-flex;
|
|
126
128
|
align-items: center;
|
|
127
129
|
gap: var(--space-2);
|
|
@@ -199,6 +201,16 @@
|
|
|
199
201
|
outline: var(--ring-success);
|
|
200
202
|
}
|
|
201
203
|
|
|
204
|
+
.zc-fld--txa.zc-fld--sm .zc-txa {
|
|
205
|
+
--txa-pad-y: var(--space-2);
|
|
206
|
+
--txa-pad-x: var(--space-3);
|
|
207
|
+
--txa-lh: var(--leading-caption);
|
|
208
|
+
}
|
|
209
|
+
.zc-fld--txa.zc-fld--sm .zc-txa__input,
|
|
210
|
+
.zc-fld--txa.zc-fld--sm .zc-txa__mirror {
|
|
211
|
+
font: var(--type-caption);
|
|
212
|
+
}
|
|
213
|
+
|
|
202
214
|
.zc-fld--txa.zc-fld--lg .zc-txa {
|
|
203
215
|
--txa-pad-y: var(--space-4);
|
|
204
216
|
--txa-lh: var(--leading-body-lg);
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
import type { DataAttributes } from '../../../dom-props';
|
|
15
15
|
import { useControllable } from '../../internal/hooks/use-controllable';
|
|
16
16
|
import { cx } from '../../internal/utils/cx';
|
|
17
|
+
import { SwitchGlyph } from './switch-glyph';
|
|
17
18
|
|
|
18
19
|
interface ToggleOwnProps {
|
|
19
20
|
/** Controlled checked state. Omit for uncontrolled (use `defaultChecked`). */
|
|
@@ -78,24 +79,14 @@ export function Toggle({
|
|
|
78
79
|
onPointerLeave={press(false)}
|
|
79
80
|
onPointerCancel={press(false)}
|
|
80
81
|
>
|
|
81
|
-
<
|
|
82
|
-
|
|
83
|
-
role="switch"
|
|
84
|
-
className="zc-sw__input"
|
|
82
|
+
<SwitchGlyph
|
|
83
|
+
pressed={pressed}
|
|
85
84
|
disabled={disabled}
|
|
86
85
|
checked={isOn}
|
|
87
86
|
onChange={handleChange}
|
|
88
87
|
{...htmlProps}
|
|
89
88
|
defaultChecked={undefined}
|
|
90
89
|
/>
|
|
91
|
-
<span
|
|
92
|
-
className="zc-sw__track"
|
|
93
|
-
data-on={isOn ? 'true' : undefined}
|
|
94
|
-
data-pressed={pressed ? 'true' : undefined}
|
|
95
|
-
aria-hidden="true"
|
|
96
|
-
>
|
|
97
|
-
<span className="zc-sw__thumb"></span>
|
|
98
|
-
</span>
|
|
99
90
|
{label || description ? (
|
|
100
91
|
<span className="zc-sw__text">
|
|
101
92
|
{label ? <span className="zc-sw__label">{label}</span> : null}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import './toggle.css';
|
|
4
|
+
|
|
5
|
+
import { Fragment, type InputHTMLAttributes } from 'react';
|
|
6
|
+
|
|
7
|
+
export interface SwitchGlyphProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'type'> {
|
|
8
|
+
pressed?: boolean;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function SwitchGlyph({ pressed = false, ...inputProps }: SwitchGlyphProps) {
|
|
12
|
+
return (
|
|
13
|
+
<Fragment>
|
|
14
|
+
<input type="checkbox" role="switch" className="zc-sw__input" {...inputProps} />
|
|
15
|
+
<span
|
|
16
|
+
className="zc-sw__track"
|
|
17
|
+
data-on={inputProps.checked ? 'true' : undefined}
|
|
18
|
+
data-pressed={pressed ? 'true' : undefined}
|
|
19
|
+
aria-hidden="true"
|
|
20
|
+
>
|
|
21
|
+
<span className="zc-sw__thumb"></span>
|
|
22
|
+
</span>
|
|
23
|
+
</Fragment>
|
|
24
|
+
);
|
|
25
|
+
}
|
package/src/engine/flip.ts
CHANGED
|
@@ -60,7 +60,11 @@ export function flip(el: HTMLElement, from: Box, options: FlipOptions = {}): Pla
|
|
|
60
60
|
const dx = from.left - to.left + pivot.x * (sx - 1);
|
|
61
61
|
const dy = from.top - to.top + pivot.y * (sy - 1);
|
|
62
62
|
|
|
63
|
-
const
|
|
63
|
+
const holdsStartThroughDelay = (options.timing?.delay ?? 0) > 0;
|
|
64
|
+
const timing: Timing = {
|
|
65
|
+
...options.timing,
|
|
66
|
+
fill: options.timing?.fill ?? (holdsStartThroughDelay ? 'backwards' : 'none'),
|
|
67
|
+
};
|
|
64
68
|
const layers: Layer[] = [{ x: [dx, 0], y: [dy, 0], timing, composite: 'add' }];
|
|
65
69
|
if (scaling)
|
|
66
70
|
layers.push({
|