@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-dtf__trigger {
|
|
@@ -27,7 +27,6 @@
|
|
|
27
27
|
.zc-dtf__trigger[aria-expanded='true']:not(:disabled) {
|
|
28
28
|
border-color: var(--accent);
|
|
29
29
|
background: var(--bg-surface);
|
|
30
|
-
outline: var(--ring-accent);
|
|
31
30
|
}
|
|
32
31
|
|
|
33
32
|
.zc-dtp,
|
|
@@ -72,7 +71,7 @@
|
|
|
72
71
|
border-radius: var(--radius-sm);
|
|
73
72
|
color: var(--text-muted);
|
|
74
73
|
cursor: pointer;
|
|
75
|
-
transition: var(--transition-
|
|
74
|
+
transition: var(--transition-control);
|
|
76
75
|
}
|
|
77
76
|
.zc-dtp__jump:hover,
|
|
78
77
|
.zc-dtp__jump[aria-expanded='true'] {
|
|
@@ -141,7 +140,7 @@
|
|
|
141
140
|
padding-inline: var(--space-2);
|
|
142
141
|
border-radius: var(--radius-md);
|
|
143
142
|
cursor: pointer;
|
|
144
|
-
transition: var(--transition-
|
|
143
|
+
transition: var(--transition-control);
|
|
145
144
|
}
|
|
146
145
|
.zc-dtp__jumpYear {
|
|
147
146
|
font-family: var(--font-code);
|
|
@@ -194,7 +193,7 @@
|
|
|
194
193
|
color: var(--text-muted);
|
|
195
194
|
border-radius: var(--radius-sm);
|
|
196
195
|
cursor: pointer;
|
|
197
|
-
transition: var(--transition-
|
|
196
|
+
transition: var(--transition-control);
|
|
198
197
|
}
|
|
199
198
|
.zc-dtp__nav:hover:not(:disabled) {
|
|
200
199
|
background: var(--neutral-wash);
|
|
@@ -252,7 +251,7 @@
|
|
|
252
251
|
font-variant-numeric: tabular-nums;
|
|
253
252
|
color: var(--text-body);
|
|
254
253
|
cursor: pointer;
|
|
255
|
-
transition: var(--transition-
|
|
254
|
+
transition: var(--transition-control);
|
|
256
255
|
}
|
|
257
256
|
.zc-dtp__day:hover:not(:disabled) {
|
|
258
257
|
color: var(--text-strong);
|
|
@@ -350,7 +349,6 @@
|
|
|
350
349
|
transform var(--duration-base) var(--ease-entrance);
|
|
351
350
|
}
|
|
352
351
|
.zc-dtp__timeHint kbd {
|
|
353
|
-
font-family: var(--font-code);
|
|
354
352
|
font-size: var(--size-micro);
|
|
355
353
|
line-height: 1;
|
|
356
354
|
color: var(--text-subtle);
|
|
@@ -419,7 +417,7 @@
|
|
|
419
417
|
padding: var(--space-1) var(--space-2);
|
|
420
418
|
border-radius: var(--radius-md);
|
|
421
419
|
cursor: pointer;
|
|
422
|
-
transition: var(--transition-
|
|
420
|
+
transition: var(--transition-control);
|
|
423
421
|
white-space: nowrap;
|
|
424
422
|
}
|
|
425
423
|
.zc-drp__preset:hover {
|
|
@@ -679,6 +677,7 @@
|
|
|
679
677
|
display: inline-flex;
|
|
680
678
|
align-items: center;
|
|
681
679
|
cursor: text;
|
|
680
|
+
outline: var(--ring-rest);
|
|
682
681
|
}
|
|
683
682
|
.zc-tfd .zc-tfd__box:focus-within {
|
|
684
683
|
border-color: var(--accent);
|
|
@@ -22,6 +22,9 @@ export interface DateFieldBaseProps {
|
|
|
22
22
|
message?: string;
|
|
23
23
|
/** Disable the field. @default false */
|
|
24
24
|
disabled?: boolean;
|
|
25
|
+
/** Control height, type and padding - the same scale as `TextField`, so a form row can hold one
|
|
26
|
+
* size throughout. @default 'md' */
|
|
27
|
+
size?: 'sm' | 'md' | 'lg';
|
|
25
28
|
/** Extra class on the field shell root. */
|
|
26
29
|
className?: string;
|
|
27
30
|
/** Standard <div> attributes (style, data-*, aria-*, ...) forwarded to the field shell root. */
|
|
@@ -35,6 +38,7 @@ export interface DateFieldBaseProps {
|
|
|
35
38
|
|
|
36
39
|
export interface FieldShellProps {
|
|
37
40
|
variant: string;
|
|
41
|
+
size?: 'sm' | 'md' | 'lg';
|
|
38
42
|
label?: string;
|
|
39
43
|
required?: boolean;
|
|
40
44
|
invalid?: boolean;
|
|
@@ -47,6 +51,7 @@ export interface FieldShellProps {
|
|
|
47
51
|
|
|
48
52
|
export function FieldShell({
|
|
49
53
|
variant,
|
|
54
|
+
size,
|
|
50
55
|
label,
|
|
51
56
|
required,
|
|
52
57
|
invalid,
|
|
@@ -56,7 +61,15 @@ export function FieldShell({
|
|
|
56
61
|
htmlProps,
|
|
57
62
|
children,
|
|
58
63
|
}: FieldShellProps) {
|
|
59
|
-
const cls = cx(
|
|
64
|
+
const cls = cx(
|
|
65
|
+
'zc-fld',
|
|
66
|
+
variant,
|
|
67
|
+
'zc-fld--has-lead',
|
|
68
|
+
size === 'sm' ? 'zc-fld--sm' : size === 'lg' ? 'zc-fld--lg' : '',
|
|
69
|
+
invalid && 'zc-is-error',
|
|
70
|
+
className,
|
|
71
|
+
htmlProps?.className,
|
|
72
|
+
);
|
|
60
73
|
return (
|
|
61
74
|
<div {...htmlProps} className={cls}>
|
|
62
75
|
<FieldLabel label={label} required={required} />
|
|
@@ -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-overlay-layer--dialog {
|
|
@@ -107,7 +107,6 @@
|
|
|
107
107
|
cursor: pointer;
|
|
108
108
|
font-size: var(--icon-sm);
|
|
109
109
|
transition: var(--transition-control);
|
|
110
|
-
outline: var(--ring-rest);
|
|
111
110
|
}
|
|
112
111
|
.zc-dialog__close:hover {
|
|
113
112
|
background: var(--neutral-wash);
|
|
@@ -20,8 +20,9 @@ import { popIn, popOut } from '../../../motion/presets';
|
|
|
20
20
|
import type { DisableableAnimation } from '../../../motion/timing';
|
|
21
21
|
import { motionFor } from '../../../tokens/motion-tokens';
|
|
22
22
|
import { useControllable } from '../../internal/hooks/use-controllable';
|
|
23
|
+
import type { MenuSize, MenuWeight, MenuWidth } from '../../internal/menu/highlight';
|
|
23
24
|
import { ovCloneTrigger, OverlayPortal } from '../../internal/overlay/layer';
|
|
24
|
-
import type
|
|
25
|
+
import { pressedByKeyboard, type ActivateOn } from '../../internal/utils/activation';
|
|
25
26
|
import { MenuPanel } from './menu-panel';
|
|
26
27
|
import {
|
|
27
28
|
levelKey,
|
|
@@ -68,6 +69,16 @@ export interface DropdownProps {
|
|
|
68
69
|
/** Hue of the highlight that travels between rows: the neutral wash, or the accent wash with accent
|
|
69
70
|
* ink on the active row. @default 'neutral' */
|
|
70
71
|
highlight?: 'neutral' | 'accent';
|
|
72
|
+
/** Menu density - row type and padding on every row, submenus included; a row carrying a
|
|
73
|
+
* description sits one step taller than a plain one. The trigger is your own node, so this
|
|
74
|
+
* never touches it. @default 'md' */
|
|
75
|
+
size?: MenuSize;
|
|
76
|
+
/** Weight of every row label. @default 'medium' */
|
|
77
|
+
weight?: MenuWeight;
|
|
78
|
+
/** Width of the top-level menu. `auto` fits the rows, `trigger` is never narrower than the trigger,
|
|
79
|
+
* and `sm` | `md` | `lg` are fixed steps with long labels ellipsizing. Submenus always fit their
|
|
80
|
+
* rows. @default 'auto' */
|
|
81
|
+
width?: MenuWidth;
|
|
71
82
|
/** Short accent bar on the leading edge of the highlight, marking the active row. @default false */
|
|
72
83
|
rail?: boolean;
|
|
73
84
|
|
|
@@ -94,6 +105,9 @@ export function Dropdown({
|
|
|
94
105
|
align = 'start',
|
|
95
106
|
highlight = 'neutral',
|
|
96
107
|
rail = false,
|
|
108
|
+
size = 'md',
|
|
109
|
+
weight = 'medium',
|
|
110
|
+
width = 'auto',
|
|
97
111
|
id,
|
|
98
112
|
ariaLabel,
|
|
99
113
|
htmlProps,
|
|
@@ -101,7 +115,7 @@ export function Dropdown({
|
|
|
101
115
|
}: DropdownProps) {
|
|
102
116
|
const [open, setOpen] = useControllable(controlledOpen, defaultOpen, onOpenChange);
|
|
103
117
|
const [path, setPath] = useState<string[]>([]);
|
|
104
|
-
const [seed, setSeed] = useState({ key: ROOT_LEVEL, focus: '
|
|
118
|
+
const [seed, setSeed] = useState({ key: ROOT_LEVEL, focus: 'selected' as SeedFocus });
|
|
105
119
|
|
|
106
120
|
const refs = useRef(new Map<string, RefObject<HTMLElement>>());
|
|
107
121
|
const hoverDepth = useRef(-1);
|
|
@@ -137,6 +151,9 @@ export function Dropdown({
|
|
|
137
151
|
align,
|
|
138
152
|
highlight,
|
|
139
153
|
rail,
|
|
154
|
+
size,
|
|
155
|
+
weight,
|
|
156
|
+
width,
|
|
140
157
|
ariaLabel,
|
|
141
158
|
htmlProps,
|
|
142
159
|
seed,
|
|
@@ -167,7 +184,7 @@ export function Dropdown({
|
|
|
167
184
|
<Fragment>
|
|
168
185
|
{ovCloneTrigger(trigger, {
|
|
169
186
|
open,
|
|
170
|
-
onPress: () => (open ? dismiss(false) : show('first')),
|
|
187
|
+
onPress: (e) => (open ? dismiss(false) : show(pressedByKeyboard(e) ? 'first' : 'selected')),
|
|
171
188
|
onKeyDown: (e) => {
|
|
172
189
|
if (open || (e.key !== 'ArrowDown' && e.key !== 'ArrowUp')) return;
|
|
173
190
|
e.preventDefault();
|
|
@@ -10,6 +10,8 @@ DropdownGroup[] (labelled sections); a row with its own items opens a submenu, n
|
|
|
10
10
|
you like. content on a row opens your own panel body in place of a submenu; selected marks the
|
|
11
11
|
current value of a single-choice group with a check. Keyboard is the APG menu button: arrows move,
|
|
12
12
|
Right/Left open and close a submenu, Enter/Space commit, typeahead, Esc one level, Tab the lot.
|
|
13
|
+
size sm|md|lg sets the vertical padding of every row, submenus included; weight sets the label
|
|
14
|
+
weight regular|medium|semibold.
|
|
13
15
|
highlight neutral|accent picks the hue of the highlight travelling between rows; rail adds a short
|
|
14
16
|
accent bar on its leading edge. returnFocus false leaves focus where a committing row put it.
|
|
15
17
|
|
|
@@ -1,10 +1,9 @@
|
|
|
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-dropdown__menu {
|
|
5
5
|
--menu-max-width: min(20rem, 92vw);
|
|
6
6
|
--menu-max-height: min(26rem, 70vh);
|
|
7
|
-
min-width: 11rem;
|
|
8
7
|
}
|
|
9
8
|
|
|
10
9
|
.zc-dropdown__menu[data-danger-active='true'] {
|
|
@@ -25,14 +24,6 @@
|
|
|
25
24
|
color: var(--menu-active-ink, var(--text-strong));
|
|
26
25
|
}
|
|
27
26
|
|
|
28
|
-
.zc-dropdown__item[data-danger='true'],
|
|
29
|
-
.zc-dropdown__item[data-danger='true'][data-active='true'] {
|
|
30
|
-
color: var(--danger-text);
|
|
31
|
-
}
|
|
32
|
-
.zc-dropdown__item[data-danger='true'] .zc-menu-row__icon {
|
|
33
|
-
color: var(--danger);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
27
|
.zc-dropdown__item-caret {
|
|
37
28
|
flex: 0 0 auto;
|
|
38
29
|
color: var(--text-subtle);
|
|
@@ -51,6 +42,18 @@
|
|
|
51
42
|
color: var(--text-accent);
|
|
52
43
|
}
|
|
53
44
|
|
|
45
|
+
.zc-dropdown__item[data-danger='true'] {
|
|
46
|
+
color: var(--danger-text);
|
|
47
|
+
}
|
|
48
|
+
.zc-dropdown__item[data-danger='true'] .zc-menu-row__label {
|
|
49
|
+
color: var(--danger-text);
|
|
50
|
+
}
|
|
51
|
+
.zc-dropdown__item[data-danger='true'] .zc-menu-row__icon,
|
|
52
|
+
.zc-dropdown__item[data-danger='true'] .zc-dropdown__item-check,
|
|
53
|
+
.zc-dropdown__item[data-danger='true'] .zc-dropdown__item-caret {
|
|
54
|
+
color: var(--danger);
|
|
55
|
+
}
|
|
56
|
+
|
|
54
57
|
.zc-dropdown__item[data-disabled='true'] {
|
|
55
58
|
cursor: not-allowed;
|
|
56
59
|
color: var(--text-disabled);
|
|
@@ -5,12 +5,14 @@ import '../../internal/menu/menu-surface.css';
|
|
|
5
5
|
import { useEffect, useLayoutEffect, useMemo, useRef, useState, type KeyboardEvent, type RefObject } from 'react';
|
|
6
6
|
|
|
7
7
|
import { GlidePill, useGlide } from '../../../motion/glide';
|
|
8
|
+
import { Presence } from '../../../motion/presence';
|
|
8
9
|
import { useMotion, type MotionSpecs } from '../../../motion/use-motion';
|
|
9
10
|
import { edgeEnabled, matchPrefix, stepEnabled } from '../../internal/collection/collection';
|
|
10
11
|
import { useTypeahead } from '../../internal/hooks/use-typeahead';
|
|
11
12
|
import { Icon } from '../../internal/icon/Icon';
|
|
12
|
-
import {
|
|
13
|
+
import { menuSurfaceAttrs } from '../../internal/menu/highlight';
|
|
13
14
|
import { MenuRow } from '../../internal/menu/menu-row';
|
|
15
|
+
import { useAnchorWidth } from '../../internal/menu/use-anchor-width';
|
|
14
16
|
import { useReturnFocus } from '../../internal/overlay/focus';
|
|
15
17
|
import { useOutsidePress, useOverlayEntry } from '../../internal/overlay/layer';
|
|
16
18
|
import { useAnchorPosition } from '../../internal/overlay/position';
|
|
@@ -52,7 +54,12 @@ export function MenuPanel({ chain, depth, ...motion }: { chain: MenuChain; depth
|
|
|
52
54
|
|
|
53
55
|
const { groups, flat } = useMemo(() => normalize(level.items), [level.items]);
|
|
54
56
|
const indexOf = useMemo(() => new Map(flat.map((item, i) => [item.id, i] as const)), [flat]);
|
|
55
|
-
const
|
|
57
|
+
const seedIndex = () => {
|
|
58
|
+
if (seed === 'none') return -1;
|
|
59
|
+
if (seed === 'selected') return flat.findIndex((item) => item.selected && !item.disabled);
|
|
60
|
+
return edgeEnabled(flat, seed === 'last');
|
|
61
|
+
};
|
|
62
|
+
const [activeIdx, setActiveIdx] = useState(seedIndex);
|
|
56
63
|
|
|
57
64
|
const panelRef = refFor('panel:' + level.key);
|
|
58
65
|
const rowFor = (i: number) => refFor('row:' + levelKey(depth, flat[i].id)) as unknown as RefObject<HTMLDivElement>;
|
|
@@ -72,6 +79,7 @@ export function MenuPanel({ chain, depth, ...motion }: { chain: MenuChain; depth
|
|
|
72
79
|
const place = { side: nested ? 'right' : chain.side, align: nested ? 'start' : chain.align } as const;
|
|
73
80
|
useMotion(panelRef, motion);
|
|
74
81
|
useReturnFocus(panelRef);
|
|
82
|
+
useAnchorWidth(anchorRef, panelRef, !nested && chain.width === 'trigger');
|
|
75
83
|
useAnchorPosition({ ...place, arrow: false, triggerRef: anchorRef, panelRef });
|
|
76
84
|
useOutsidePress({ entry, refs: [panelRef, anchorRef], enabled: !nested, onPress: () => chain.dismiss(false) });
|
|
77
85
|
|
|
@@ -85,8 +93,13 @@ export function MenuPanel({ chain, depth, ...motion }: { chain: MenuChain; depth
|
|
|
85
93
|
|
|
86
94
|
useLayoutEffect(() => {
|
|
87
95
|
if (seed === 'none') return;
|
|
88
|
-
if (contentLevel)
|
|
89
|
-
|
|
96
|
+
if (contentLevel) {
|
|
97
|
+
panelRef.current?.focus();
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
const i = seedIndex();
|
|
101
|
+
if (i < 0) panelRef.current?.focus();
|
|
102
|
+
setActiveIdx(i);
|
|
90
103
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
91
104
|
}, [seed]);
|
|
92
105
|
|
|
@@ -244,14 +257,16 @@ export function MenuPanel({ chain, depth, ...motion }: { chain: MenuChain; depth
|
|
|
244
257
|
return (
|
|
245
258
|
<>
|
|
246
259
|
<GlidePill className="zc-menu-glide" glide={glide} />
|
|
247
|
-
{
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
260
|
+
<Presence initial={false}>
|
|
261
|
+
{groups.length > 1 || groups[0]?.label
|
|
262
|
+
? groups.map((group, gi) => (
|
|
263
|
+
<div className="zc-dropdown__group" role="group" aria-label={group.label || undefined} key={gi}>
|
|
264
|
+
{group.label && <div className="zc-menu-group-label">{group.label}</div>}
|
|
265
|
+
{group.items.map(renderRow)}
|
|
266
|
+
</div>
|
|
267
|
+
))
|
|
268
|
+
: flat.map(renderRow)}
|
|
269
|
+
</Presence>
|
|
255
270
|
</>
|
|
256
271
|
);
|
|
257
272
|
}
|
|
@@ -259,7 +274,7 @@ export function MenuPanel({ chain, depth, ...motion }: { chain: MenuChain; depth
|
|
|
259
274
|
return (
|
|
260
275
|
<div
|
|
261
276
|
{...(nested ? undefined : chain.htmlProps)}
|
|
262
|
-
{...
|
|
277
|
+
{...menuSurfaceAttrs({ ...chain, width: nested ? 'auto' : chain.width })}
|
|
263
278
|
ref={panelRef as unknown as RefObject<HTMLDivElement>}
|
|
264
279
|
id={menuId}
|
|
265
280
|
className={cx('zc-menu-surface zc-menu-scroller zc-dropdown__menu', !nested && chain.htmlProps?.className)}
|
|
@@ -2,7 +2,7 @@ import type { HTMLAttributes, ReactNode, RefObject } from 'react';
|
|
|
2
2
|
|
|
3
3
|
import type { DataAttributes } from '../../../dom-props';
|
|
4
4
|
import { normalizeCollection, type NormalizedGroup } from '../../internal/collection/collection';
|
|
5
|
-
import type { MenuHighlight } from '../../internal/menu/highlight';
|
|
5
|
+
import type { MenuHighlight, MenuSize, MenuWeight, MenuWidth } from '../../internal/menu/highlight';
|
|
6
6
|
import type { ActivateOn } from '../../internal/utils/activation';
|
|
7
7
|
|
|
8
8
|
export interface DropdownItem {
|
|
@@ -94,7 +94,7 @@ export function resolveLevels(items: DropdownItems, path: string[]): Level[] {
|
|
|
94
94
|
return levels;
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
export type SeedFocus = 'first' | 'last' | 'none';
|
|
97
|
+
export type SeedFocus = 'first' | 'last' | 'selected' | 'none';
|
|
98
98
|
|
|
99
99
|
export interface MenuChain {
|
|
100
100
|
levels: Level[];
|
|
@@ -104,6 +104,9 @@ export interface MenuChain {
|
|
|
104
104
|
align: 'start' | 'center' | 'end';
|
|
105
105
|
highlight: MenuHighlight;
|
|
106
106
|
rail: boolean;
|
|
107
|
+
size: MenuSize;
|
|
108
|
+
weight: MenuWeight;
|
|
109
|
+
width: MenuWidth;
|
|
107
110
|
ariaLabel?: string;
|
|
108
111
|
htmlProps?: HTMLAttributes<HTMLDivElement> & DataAttributes;
|
|
109
112
|
seed: { key: string; focus: SeedFocus };
|
|
@@ -7,10 +7,20 @@ import type { HTMLAttributes, ReactNode } from 'react';
|
|
|
7
7
|
import type { DataAttributes } from '../../../dom-props';
|
|
8
8
|
import type { DisableableAnimation } from '../../../motion/timing';
|
|
9
9
|
import { useControllable } from '../../internal/hooks/use-controllable';
|
|
10
|
+
import type { MenuSize, MenuWeight, MenuWidth } from '../../internal/menu/highlight';
|
|
10
11
|
import type { ActivateOn } from '../../internal/utils/activation';
|
|
11
12
|
import { cx } from '../../internal/utils/cx';
|
|
12
13
|
import { CheckGlyph } from '../../primitives/checkbox/check-glyph';
|
|
13
|
-
import {
|
|
14
|
+
import { SwitchGlyph } from '../../primitives/toggle/switch-glyph';
|
|
15
|
+
import {
|
|
16
|
+
ListboxPanel,
|
|
17
|
+
SelectTrigger,
|
|
18
|
+
useListbox,
|
|
19
|
+
type CustomTrigger,
|
|
20
|
+
type SelectGroup,
|
|
21
|
+
type SelectMenuHtmlProps,
|
|
22
|
+
type SelectOption,
|
|
23
|
+
} from './core';
|
|
14
24
|
|
|
15
25
|
export type { SelectOption, SelectGroup } from './core';
|
|
16
26
|
|
|
@@ -25,8 +35,20 @@ export interface MultiSelectProps {
|
|
|
25
35
|
onChange?: (value: string[], toggled: SelectOption) => void;
|
|
26
36
|
/** Trigger text when nothing is selected. @default 'Select options' */
|
|
27
37
|
placeholder?: string;
|
|
28
|
-
/**
|
|
38
|
+
/** Trigger height, type and padding. The menu follows it unless `menuSize` overrides. @default 'md' */
|
|
29
39
|
size?: 'sm' | 'md' | 'lg';
|
|
40
|
+
/** Menu density on its own - row type, row padding, the filter field and the row checkbox. A row
|
|
41
|
+
* carrying a description sits one step taller than a plain one at every step. @default the `size` value */
|
|
42
|
+
menuSize?: MenuSize;
|
|
43
|
+
/** Weight of every option label in the menu. @default 'medium' */
|
|
44
|
+
weight?: MenuWeight;
|
|
45
|
+
/** Glyph mirroring each option's selected state at the trailing edge: a checkbox, or a switch for a
|
|
46
|
+
* settings-style menu where every option is an independent on/off. Decoration only - the option
|
|
47
|
+
* semantics are the same either way. @default 'checkbox' */
|
|
48
|
+
marker?: 'checkbox' | 'switch';
|
|
49
|
+
/** Menu width. `trigger` is never narrower than the trigger, `auto` fits the options, and
|
|
50
|
+
* `sm` | `md` | `lg` are fixed steps with long labels ellipsizing. @default 'trigger' */
|
|
51
|
+
width?: MenuWidth;
|
|
30
52
|
/** Disabled - trigger is inert and the menu cannot open. @default false */
|
|
31
53
|
disabled?: boolean;
|
|
32
54
|
/** Danger ring + border. @default false */
|
|
@@ -50,16 +72,32 @@ export interface MultiSelectProps {
|
|
|
50
72
|
ariaLabel?: string;
|
|
51
73
|
/** Standard <div> attributes (className, style, data-*, ...) forwarded to the select root. */
|
|
52
74
|
htmlProps?: HTMLAttributes<HTMLDivElement> & DataAttributes;
|
|
75
|
+
/** Standard attributes (className, style, data-*, ...) forwarded to the menu panel, which portals
|
|
76
|
+
* to <body> and inherits nothing from the root. */
|
|
77
|
+
menuProps?: SelectMenuHtmlProps;
|
|
53
78
|
/** Whether the trigger and the options fire on `pointerdown` (snappier) or wait for `click`.
|
|
54
79
|
* @default 'pointerdown' */
|
|
55
80
|
activateOn?: ActivateOn;
|
|
56
81
|
/** Menu open/close timing - motion tokens only, or `null` to disable. @default duration 'base' + ease 'entrance'/'exit' */
|
|
57
82
|
animation?: DisableableAnimation;
|
|
83
|
+
/** Your own element in place of the built-in trigger. It is cloned with the combobox wiring - role,
|
|
84
|
+
* aria, open/close, arrow keys, and the anchor the menu measures - so it must render one focusable
|
|
85
|
+
* element that forwards its props and ref. Pass a function to read `{ open, selected }`. */
|
|
86
|
+
trigger?: CustomTrigger<SelectOption[]>;
|
|
58
87
|
}
|
|
59
88
|
|
|
60
|
-
|
|
89
|
+
type MultiSelectMarker = NonNullable<MultiSelectProps['marker']>;
|
|
90
|
+
|
|
91
|
+
function OptionMarker({ marker, checked, size }: { marker: MultiSelectMarker; checked: boolean; size: MenuSize }) {
|
|
92
|
+
if (marker === 'switch') {
|
|
93
|
+
return (
|
|
94
|
+
<span className={cx('zc-sw', size === 'sm' && 'zc-sw--sm')} aria-hidden="true">
|
|
95
|
+
<SwitchGlyph checked={checked} readOnly tabIndex={-1} />
|
|
96
|
+
</span>
|
|
97
|
+
);
|
|
98
|
+
}
|
|
61
99
|
return (
|
|
62
|
-
<span className=
|
|
100
|
+
<span className={cx('zc-cbx', size === 'sm' && 'zc-cbx--sm')} aria-hidden="true">
|
|
63
101
|
<CheckGlyph checked={checked} readOnly tabIndex={-1} />
|
|
64
102
|
</span>
|
|
65
103
|
);
|
|
@@ -72,6 +110,7 @@ export function MultiSelect({
|
|
|
72
110
|
onChange,
|
|
73
111
|
placeholder = 'Select options',
|
|
74
112
|
size = 'md',
|
|
113
|
+
menuSize = size,
|
|
75
114
|
disabled = false,
|
|
76
115
|
invalid = false,
|
|
77
116
|
loading = false,
|
|
@@ -79,12 +118,17 @@ export function MultiSelect({
|
|
|
79
118
|
searchPlaceholder = 'Filter options',
|
|
80
119
|
highlight = 'neutral',
|
|
81
120
|
rail = false,
|
|
121
|
+
weight = 'medium',
|
|
122
|
+
marker = 'checkbox',
|
|
123
|
+
width = 'trigger',
|
|
82
124
|
leadingIcon = null,
|
|
83
125
|
id,
|
|
84
126
|
ariaLabel,
|
|
85
127
|
htmlProps,
|
|
128
|
+
menuProps,
|
|
86
129
|
activateOn = 'pointerdown',
|
|
87
130
|
animation,
|
|
131
|
+
trigger,
|
|
88
132
|
}: MultiSelectProps) {
|
|
89
133
|
const [value, setValue] = useControllable<string[], SelectOption>(
|
|
90
134
|
controlledValue,
|
|
@@ -109,6 +153,7 @@ export function MultiSelect({
|
|
|
109
153
|
|
|
110
154
|
const selectedOptions = lb.flat.filter((o) => isSelected(o.value));
|
|
111
155
|
const isPlaceholder = !loading && selectedOptions.length === 0;
|
|
156
|
+
const customTrigger = typeof trigger === 'function' ? trigger({ open: lb.open, selected: selectedOptions }) : trigger;
|
|
112
157
|
|
|
113
158
|
return (
|
|
114
159
|
<div
|
|
@@ -116,6 +161,7 @@ export function MultiSelect({
|
|
|
116
161
|
className={cx('zc-select', htmlProps?.className)}
|
|
117
162
|
data-multiple="true"
|
|
118
163
|
data-size={size}
|
|
164
|
+
data-custom-trigger={customTrigger ? 'true' : undefined}
|
|
119
165
|
data-open={lb.open ? 'true' : undefined}
|
|
120
166
|
data-disabled={disabled ? 'true' : undefined}
|
|
121
167
|
data-invalid={invalid ? 'true' : undefined}
|
|
@@ -123,6 +169,7 @@ export function MultiSelect({
|
|
|
123
169
|
>
|
|
124
170
|
<SelectTrigger
|
|
125
171
|
lb={lb}
|
|
172
|
+
node={customTrigger}
|
|
126
173
|
disabled={disabled}
|
|
127
174
|
invalid={invalid}
|
|
128
175
|
ariaLabel={ariaLabel}
|
|
@@ -141,9 +188,13 @@ export function MultiSelect({
|
|
|
141
188
|
multiple
|
|
142
189
|
highlight={highlight}
|
|
143
190
|
rail={rail}
|
|
191
|
+
size={menuSize}
|
|
192
|
+
weight={weight}
|
|
193
|
+
width={width}
|
|
144
194
|
activateOn={activateOn}
|
|
145
195
|
animation={animation}
|
|
146
|
-
|
|
196
|
+
menuProps={menuProps}
|
|
197
|
+
check={(sel) => <OptionMarker marker={marker} checked={sel} size={menuSize} />}
|
|
147
198
|
/>
|
|
148
199
|
</div>
|
|
149
200
|
);
|
|
@@ -7,7 +7,17 @@ Many-of listbox; stays open while toggling, trigger summarises as first +N.
|
|
|
7
7
|
|
|
8
8
|
value: string[], onChange(string[]); searchable. highlight neutral|accent picks the hue of the
|
|
9
9
|
highlight travelling between options; rail adds a short accent bar on its leading edge.
|
|
10
|
+
trigger replaces the built-in combobox with your own element - a node, or a function of
|
|
11
|
+
{ open, selected } where selected is the SelectOption[] in option order. It is cloned with the full
|
|
12
|
+
wiring - role, aria-expanded/controls/activedescendant, open/close, arrow keys - and becomes the
|
|
13
|
+
anchor the menu measures, so it must render ONE focusable element that forwards its props and its ref
|
|
14
|
+
(a Button does; a plain div is not focusable). placeholder and leadingIcon then stop applying and the
|
|
15
|
+
root drops its width: 100%, leaving the trigger its intrinsic width; size still drives the menu,
|
|
16
|
+
loading still blocks opening, disabled still makes it inert with aria-disabled.
|
|
10
17
|
|
|
11
18
|
```tsx
|
|
12
19
|
<MultiSelect options={PEOPLE} value={ids} onChange={setIds} placeholder="Choose members" ariaLabel="Members" />
|
|
20
|
+
<MultiSelect options={PEOPLE} value={ids} onChange={setIds} ariaLabel="Members" trigger={({ selected }) => (
|
|
21
|
+
<Button variant="secondary">{selected.length ? `${selected.length} members` : 'Members'}</Button>
|
|
22
|
+
)} />
|
|
13
23
|
```
|