@zyncat/ui 0.13.1 → 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 +46 -157
- package/dist/alert.css +27 -34
- package/dist/alert.js +26 -17
- package/dist/alert.js.map +1 -1
- package/dist/avatar-group.js +2 -2
- package/dist/avatar-group.js.map +1 -1
- package/dist/avatar.css +53 -51
- package/dist/avatar.js +29 -7
- package/dist/avatar.js.map +1 -1
- package/dist/badge.css +31 -37
- package/dist/badge.js +1 -1
- package/dist/bloom-HV23M4AW.js +81 -0
- package/dist/bloom-HV23M4AW.js.map +1 -0
- package/dist/button.css +99 -118
- package/dist/button.js +3 -1
- package/dist/checkbox.css +28 -33
- package/dist/checkbox.js +2 -2
- package/dist/chunk-2YGHPQ66.js +16 -0
- package/dist/chunk-2YGHPQ66.js.map +1 -0
- package/dist/chunk-3MLUH2QL.js +53 -0
- package/dist/chunk-3MLUH2QL.js.map +1 -0
- package/dist/{chunk-RJFGWJ4W.js → chunk-3XRVPCIM.js} +6 -6
- package/dist/chunk-3XRVPCIM.js.map +1 -0
- package/dist/{chunk-FONOS5RN.js → chunk-4PQDVK23.js} +11 -10
- package/dist/chunk-4PQDVK23.js.map +1 -0
- package/dist/{chunk-45R4Z5XN.js → chunk-5VC3TUZ2.js} +4 -4
- package/dist/{chunk-45R4Z5XN.js.map → chunk-5VC3TUZ2.js.map} +1 -1
- package/dist/{chunk-A5WTZACK.js → chunk-5W5TKANX.js} +3 -3
- package/dist/{chunk-A5WTZACK.js.map → chunk-5W5TKANX.js.map} +1 -1
- package/dist/{chunk-227ZW4V7.js → chunk-6IXLW7QA.js} +11 -11
- package/dist/chunk-6IXLW7QA.js.map +1 -0
- package/dist/chunk-7NHY2CRA.js +132 -0
- package/dist/chunk-7NHY2CRA.js.map +1 -0
- package/dist/{chunk-EF6RPXU7.js → chunk-7VTWJL72.js} +43 -35
- 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-TYHR4VNM.js → chunk-AREEMG47.js} +10 -8
- package/dist/chunk-AREEMG47.js.map +1 -0
- package/dist/{chunk-DDRSMHN4.js → chunk-DH7DT6EO.js} +3 -3
- package/dist/{chunk-DDRSMHN4.js.map → chunk-DH7DT6EO.js.map} +1 -1
- package/dist/chunk-EOWWVFBF.js +14 -0
- package/dist/chunk-EOWWVFBF.js.map +1 -0
- package/dist/{chunk-5PZ43DCG.js → chunk-FLDIRXFU.js} +12 -13
- package/dist/chunk-FLDIRXFU.js.map +1 -0
- package/dist/{chunk-I45AU6KH.js → chunk-GGDAMIBH.js} +13 -7
- package/dist/chunk-GGDAMIBH.js.map +1 -0
- package/dist/{chunk-M43IOM5C.js → chunk-GWCBTD63.js} +3 -3
- package/dist/{chunk-M43IOM5C.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-H3X2263Y.js +17 -0
- package/dist/chunk-H3X2263Y.js.map +1 -0
- package/dist/{chunk-IJS7TPGV.js → chunk-HWDIVGME.js} +14 -7
- 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-LH2UIEKN.js +42 -0
- package/dist/chunk-LH2UIEKN.js.map +1 -0
- package/dist/{chunk-JY6A2ZJZ.js → chunk-LNAV5E7S.js} +2 -2
- package/dist/{chunk-JY6A2ZJZ.js.map → chunk-LNAV5E7S.js.map} +1 -1
- package/dist/{chunk-CF4QHO4N.js → chunk-M2A6PZ7J.js} +10 -10
- package/dist/{chunk-CF4QHO4N.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-TVYH4AN7.js → chunk-ODRO3KS6.js} +13 -13
- package/dist/chunk-ODRO3KS6.js.map +1 -0
- package/dist/chunk-PU3QWBEL.js +39 -0
- package/dist/chunk-PU3QWBEL.js.map +1 -0
- package/dist/{chunk-4BSHB7R3.js → chunk-QDAN43B6.js} +9 -9
- package/dist/chunk-QDAN43B6.js.map +1 -0
- package/dist/{chunk-XNIYSAMJ.js → chunk-RW2A4M2Q.js} +14 -9
- package/dist/chunk-RW2A4M2Q.js.map +1 -0
- package/dist/{chunk-TUTXXC3W.js → chunk-RY35IU3G.js} +3 -3
- package/dist/{chunk-TUTXXC3W.js.map → chunk-RY35IU3G.js.map} +1 -1
- package/dist/{chunk-EAI4POPB.js → chunk-TBLPZQSI.js} +56 -50
- package/dist/chunk-TBLPZQSI.js.map +1 -0
- package/dist/{chunk-AADAJL7D.js → chunk-UKPX3RIP.js} +8 -9
- package/dist/chunk-UKPX3RIP.js.map +1 -0
- package/dist/chunk-VDOBLABP.js +38 -0
- package/dist/chunk-VDOBLABP.js.map +1 -0
- package/dist/chunk-VNVVG47J.js +12 -0
- package/dist/chunk-VNVVG47J.js.map +1 -0
- package/dist/{chunk-4C5RZXBT.js → chunk-VZXML7EH.js} +8 -8
- package/dist/chunk-VZXML7EH.js.map +1 -0
- package/dist/{chunk-43M6GQ4Q.js → chunk-WC45VSST.js} +51 -32
- package/dist/chunk-WC45VSST.js.map +1 -0
- package/dist/{chunk-3MPF7FZV.js → chunk-WCWV5IX6.js} +3 -3
- package/dist/{chunk-3MPF7FZV.js.map → chunk-WCWV5IX6.js.map} +1 -1
- package/dist/chunk-WQKWPI6V.js +196 -0
- package/dist/chunk-WQKWPI6V.js.map +1 -0
- package/dist/{chunk-VAXCXZ53.js → chunk-WZUTBJC4.js} +5 -4
- package/dist/chunk-WZUTBJC4.js.map +1 -0
- package/dist/chunk-ZHMOH62S.js +101 -0
- package/dist/chunk-ZHMOH62S.js.map +1 -0
- package/dist/cli.js +356 -28
- package/dist/collapse.css +21 -33
- package/dist/collapse.js +1 -1
- package/dist/confetti.css +20 -13
- package/dist/confetti.js +7 -6
- package/dist/confetti.js.map +1 -1
- package/dist/count-badge.js +2 -2
- package/dist/date-field.js +22 -19
- package/dist/date-field.js.map +1 -1
- package/dist/date-picker.css +287 -185
- package/dist/date-range-field.js +75 -59
- package/dist/date-range-field.js.map +1 -1
- package/dist/datetime-field.js +26 -23
- package/dist/datetime-field.js.map +1 -1
- package/dist/dialog.css +35 -44
- package/dist/dialog.js +23 -22
- package/dist/dialog.js.map +1 -1
- package/dist/digit-strip.css +17 -17
- package/dist/dropdown.css +37 -28
- package/dist/dropdown.js +77 -40
- package/dist/dropdown.js.map +1 -1
- package/dist/emoji-picker.js +44 -45
- package/dist/emoji-picker.js.map +1 -1
- package/dist/facebook-feed.css +146 -149
- package/dist/facebook-feed.js +106 -102
- package/dist/facebook-feed.js.map +1 -1
- package/dist/flow-field.css +9 -5
- package/dist/flow-field.js +8 -7
- package/dist/flow-field.js.map +1 -1
- package/dist/glide.js +4 -3
- package/dist/icon.css +8 -11
- package/dist/input.css +81 -86
- package/dist/instagram-feed.css +66 -67
- package/dist/instagram-feed.js +61 -44
- package/dist/instagram-feed.js.map +1 -1
- package/dist/lens.css +42 -39
- package/dist/lens.js +17 -16
- package/dist/lens.js.map +1 -1
- package/dist/mcp.js +4 -3
- package/dist/menu-surface.css +55 -35
- package/dist/modal.css +3 -5
- package/dist/modal.js +12 -11
- package/dist/modal.js.map +1 -1
- package/dist/morphing-text.css +27 -17
- package/dist/morphing-text.js +14 -13
- package/dist/morphing-text.js.map +1 -1
- package/dist/motion-devtools.css +118 -69
- package/dist/motion-devtools.js +230 -65
- package/dist/motion-devtools.js.map +1 -1
- package/dist/motion-tokens.js +1 -1
- package/dist/multi-select.js +21 -16
- package/dist/multi-select.js.map +1 -1
- package/dist/number-field.js +15 -15
- package/dist/number-field.js.map +1 -1
- package/dist/odometer.css +23 -17
- package/dist/odometer.js +12 -11
- package/dist/odometer.js.map +1 -1
- package/dist/otp-field.js +3 -3
- package/dist/otp-field.js.map +1 -1
- package/dist/overlay.css +5 -10
- package/dist/pagination.css +11 -16
- package/dist/pagination.js +13 -10
- 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 +14 -16
- package/dist/popover.js +10 -9
- package/dist/radio-group.css +65 -76
- package/dist/radio-group.js +30 -29
- package/dist/radio-group.js.map +1 -1
- package/dist/select.css +67 -76
- package/dist/select.js +19 -14
- package/dist/select.js.map +1 -1
- package/dist/sheet.css +13 -15
- package/dist/sheet.js +11 -10
- package/dist/spinner.css +115 -0
- package/dist/spinner.js +4 -0
- package/dist/spinner.js.map +1 -0
- package/dist/status-badge.js +9 -9
- package/dist/status-badge.js.map +1 -1
- package/dist/styles.css +35 -35
- package/dist/support-rail.css +110 -256
- package/dist/support-rail.js +116 -123
- package/dist/support-rail.js.map +1 -1
- package/dist/table.css +77 -85
- package/dist/table.js +44 -41
- package/dist/table.js.map +1 -1
- package/dist/tabs.css +81 -93
- package/dist/tabs.js +23 -20
- package/dist/tabs.js.map +1 -1
- package/dist/tag.css +49 -54
- package/dist/tag.js +13 -12
- package/dist/tag.js.map +1 -1
- package/dist/text-field.js +5 -5
- package/dist/textarea.css +47 -50
- package/dist/textarea.js +16 -16
- package/dist/textarea.js.map +1 -1
- 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 +74 -27
- 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 +114 -119
- package/dist/tiktok.js +53 -52
- package/dist/tiktok.js.map +1 -1
- package/dist/time-field.js +26 -20
- package/dist/time-field.js.map +1 -1
- package/dist/toast-store.js +2 -1
- package/dist/toast.css +51 -79
- package/dist/toast.js +34 -26
- package/dist/toast.js.map +1 -1
- package/dist/toggle-tag.js +23 -14
- package/dist/toggle-tag.js.map +1 -1
- package/dist/toggle.css +27 -32
- package/dist/toggle.js +7 -7
- package/dist/toggle.js.map +1 -1
- package/dist/tooltip.css +17 -24
- package/dist/tooltip.js +117 -95
- package/dist/tooltip.js.map +1 -1
- package/dist/trigger.css +4 -4
- package/dist/types/components/composites/alert/Alert.d.ts +1 -2
- package/dist/types/components/composites/date-picker/TimeField.d.ts +1 -2
- package/dist/types/components/composites/date-picker/field-shell.d.ts +1 -1
- package/dist/types/components/composites/date-picker/month-jump.d.ts +11 -0
- package/dist/types/components/composites/date-picker/time-core.d.ts +1 -2
- package/dist/types/components/composites/dropdown/Dropdown.d.ts +9 -1
- package/dist/types/components/composites/dropdown/types.d.ts +14 -0
- package/dist/types/components/composites/emoji-picker/EmojiPickerPanel.d.ts +1 -1
- package/dist/types/components/composites/emoji-picker/data.d.ts +2 -5
- package/dist/types/components/composites/emoji-picker/react/useEmojiPicker.d.ts +0 -11
- package/dist/types/components/composites/emoji-picker/types.d.ts +3 -8
- package/dist/types/components/composites/select/MultiSelect.d.ts +6 -1
- package/dist/types/components/composites/select/Select.d.ts +6 -1
- package/dist/types/components/composites/select/core/index.d.ts +1 -1
- package/dist/types/components/composites/select/core/menu.d.ts +3 -3
- package/dist/types/components/composites/select/core/panel.d.ts +3 -3
- package/dist/types/components/composites/tabs/Tabs.d.ts +7 -10
- 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/composites/toast/Toast.d.ts +1 -1
- package/dist/types/components/composites/tooltip/Tooltip.d.ts +9 -1
- package/dist/types/components/composites/tooltip/tooltip-store.d.ts +5 -6
- package/dist/types/components/compound/support-rail/SupportRail.d.ts +10 -8
- package/dist/types/components/dev/MotionDevtools.d.ts +12 -5
- package/dist/types/components/expressive/theme-transition/bloom.d.ts +2 -0
- package/dist/types/components/expressive/theme-transition/paint.d.ts +2 -0
- package/dist/types/components/expressive/theme-transition/scene.d.ts +24 -0
- package/dist/types/components/expressive/theme-transition/theme-transition.d.ts +19 -0
- package/dist/types/components/expressive/theme-transition/tide.d.ts +2 -0
- package/dist/types/components/internal/hooks/use-host-election.d.ts +8 -0
- package/dist/types/components/internal/icon/Icon.d.ts +2 -3
- package/dist/types/components/internal/menu/highlight.d.ts +7 -0
- package/dist/types/components/internal/utils/activation.d.ts +0 -4
- package/dist/types/components/primitives/avatar/Avatar.d.ts +1 -1
- package/dist/types/components/primitives/button/Button.d.ts +10 -13
- package/dist/types/components/primitives/button/button-style.d.ts +15 -0
- package/dist/types/components/primitives/input/TextField.d.ts +1 -2
- package/dist/types/components/primitives/spinner/Spinner.d.ts +27 -0
- package/dist/types/components/primitives/textarea/Textarea.d.ts +0 -1
- package/dist/types/engine/animate.d.ts +1 -0
- package/dist/types/shared-slot.d.ts +1 -0
- package/dist/types/tokens/component-styles.generated.d.ts +80 -155
- package/dist/types/tokens/motion-defaults.generated.d.ts +34 -0
- package/dist/types/tokens/motion-scale.d.ts +2 -2
- package/dist/types/tokens/motion-tokens.d.ts +7 -0
- package/dist/types/tokens/theme-store.d.ts +47 -0
- package/dist/types/tokens/theme-sync.d.ts +9 -0
- package/dist/types/tokens/theme-tokens.generated.d.ts +693 -1117
- package/dist/types/tokens/theme.d.ts +28 -5
- package/dist/typing-lines.css +18 -11
- package/dist/typing-lines.js +9 -8
- package/dist/typing-lines.js.map +1 -1
- package/dist/weight-field.css +32 -18
- package/dist/weight-field.js +4 -4
- package/dist/weight-field.js.map +1 -1
- package/dist/youtube.css +91 -97
- package/dist/youtube.js +87 -86
- package/dist/youtube.js.map +1 -1
- package/package.json +27 -31
- package/skills/zyncat-ui/SKILL.md +5 -3
- package/skills/zyncat-ui/references/components.md +7 -4
- package/skills/zyncat-ui/references/theming.md +105 -34
- package/src/components/composites/alert/Alert.tsx +15 -12
- package/src/components/composites/alert/alert.css +27 -34
- package/src/components/composites/date-picker/DateField.tsx +1 -1
- package/src/components/composites/date-picker/DateRangeField.tsx +1 -1
- package/src/components/composites/date-picker/DateTimeField.tsx +4 -4
- package/src/components/composites/date-picker/TimeField.tsx +8 -5
- package/src/components/composites/date-picker/calendar-panel.tsx +33 -22
- package/src/components/composites/date-picker/date-picker.css +287 -185
- package/src/components/composites/date-picker/field-shell.tsx +7 -7
- package/src/components/composites/date-picker/month-jump.tsx +192 -0
- package/src/components/composites/date-picker/range-panel.tsx +51 -36
- package/src/components/composites/date-picker/time-core.tsx +4 -6
- package/src/components/composites/date-picker/use-day-focus.ts +1 -1
- package/src/components/composites/dialog/Dialog.tsx +11 -11
- package/src/components/composites/dialog/dialog.css +35 -44
- package/src/components/composites/dropdown/Dropdown.tsx +15 -2
- package/src/components/composites/dropdown/Dropdown.usage.md +7 -4
- package/src/components/composites/dropdown/dropdown.css +37 -28
- package/src/components/composites/dropdown/menu-panel.tsx +56 -27
- package/src/components/composites/dropdown/types.ts +28 -6
- package/src/components/composites/emoji-picker/EmojiPickerPanel.tsx +5 -4
- package/src/components/composites/emoji-picker/EmojiPickerPanel.usage.md +4 -4
- package/src/components/composites/emoji-picker/data.ts +2 -5
- package/src/components/composites/emoji-picker/dom.ts +6 -6
- package/src/components/composites/emoji-picker/react/category-bar.tsx +6 -6
- package/src/components/composites/emoji-picker/react/useEmojiPicker.ts +0 -11
- package/src/components/composites/emoji-picker/scaffold.ts +7 -7
- package/src/components/composites/emoji-picker/search.ts +0 -7
- package/src/components/composites/emoji-picker/styles.css +35 -35
- package/src/components/composites/emoji-picker/types.ts +3 -8
- package/src/components/composites/modal/Modal.tsx +2 -2
- package/src/components/composites/modal/modal.css +3 -5
- package/src/components/composites/pagination/Pagination.tsx +7 -7
- package/src/components/composites/pagination/pagination.css +11 -16
- package/src/components/composites/popover/Popover.tsx +2 -2
- package/src/components/composites/popover/popover.css +14 -16
- package/src/components/composites/select/MultiSelect.tsx +11 -2
- package/src/components/composites/select/MultiSelect.usage.md +2 -1
- package/src/components/composites/select/Select.tsx +10 -1
- package/src/components/composites/select/Select.usage.md +2 -1
- package/src/components/composites/select/core/index.ts +1 -1
- package/src/components/composites/select/core/menu.tsx +19 -4
- package/src/components/composites/select/core/panel.tsx +19 -15
- package/src/components/composites/select/core/trigger.tsx +5 -5
- package/src/components/composites/select/select.css +67 -76
- package/src/components/composites/sheet/Sheet.tsx +2 -2
- package/src/components/composites/sheet/sheet.css +13 -15
- package/src/components/composites/sheet/use-sheet-drag.ts +1 -1
- package/src/components/composites/table/Table.tsx +35 -35
- package/src/components/composites/table/table.css +77 -85
- package/src/components/composites/tabs/Tabs.tsx +20 -21
- package/src/components/composites/tabs/Tabs.usage.md +3 -2
- package/src/components/composites/tabs/tabs.css +81 -93
- 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 +24 -18
- package/src/components/composites/toast/toast-store.ts +8 -6
- package/src/components/composites/toast/toast.css +51 -79
- package/src/components/composites/tooltip/Tooltip.tsx +40 -19
- package/src/components/composites/tooltip/Tooltip.usage.md +9 -1
- package/src/components/composites/tooltip/tooltip-host.tsx +55 -23
- package/src/components/composites/tooltip/tooltip-store.ts +36 -53
- package/src/components/composites/tooltip/tooltip.css +17 -24
- package/src/components/compound/support-rail/SupportRail.tsx +132 -144
- package/src/components/compound/support-rail/SupportRail.usage.md +7 -6
- package/src/components/compound/support-rail/support-rail.css +110 -256
- package/src/components/dev/MotionDevtools.tsx +272 -51
- package/src/components/dev/MotionDevtools.usage.md +12 -4
- package/src/components/dev/motion-devtools.css +118 -69
- package/src/components/dev/slowmo-engine.ts +16 -15
- package/src/components/expressive/confetti/Confetti.tsx +4 -4
- package/src/components/expressive/confetti/confetti.css +20 -13
- package/src/components/expressive/facebook-feed/chrome.tsx +2 -2
- package/src/components/expressive/facebook-feed/facebook-feed.css +146 -149
- package/src/components/expressive/facebook-feed/post.tsx +39 -39
- package/src/components/expressive/facebook-feed/reel.tsx +41 -37
- package/src/components/expressive/facebook-feed/story.tsx +27 -27
- package/src/components/expressive/flow-field/FlowField.tsx +5 -5
- package/src/components/expressive/flow-field/flow-field.css +9 -5
- package/src/components/expressive/instagram-feed/InstagramFeed.tsx +52 -44
- package/src/components/expressive/instagram-feed/instagram-feed.css +66 -67
- package/src/components/expressive/lens/Lens.tsx +14 -14
- package/src/components/expressive/lens/lens.css +42 -39
- package/src/components/expressive/morphing-text/MorphingText.tsx +12 -13
- package/src/components/expressive/morphing-text/morphing-text.css +27 -17
- package/src/components/expressive/odometer/Odometer.tsx +9 -9
- package/src/components/expressive/odometer/odometer.css +23 -17
- 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.tsx +54 -54
- package/src/components/expressive/tiktok/tiktok.css +114 -119
- package/src/components/expressive/typing-lines/TypingLines.tsx +0 -0
- package/src/components/expressive/typing-lines/typing-lines.css +18 -11
- package/src/components/expressive/weight-field/WeightField.tsx +4 -4
- package/src/components/expressive/weight-field/weight-field.css +32 -18
- package/src/components/expressive/youtube/YouTube.tsx +4 -4
- package/src/components/expressive/youtube/glyphs.tsx +16 -16
- package/src/components/expressive/youtube/media.tsx +3 -3
- package/src/components/expressive/youtube/post.tsx +28 -28
- package/src/components/expressive/youtube/short.tsx +25 -25
- package/src/components/expressive/youtube/video.tsx +13 -13
- package/src/components/expressive/youtube/youtube.css +91 -97
- package/src/components/internal/glass/glass.css +20 -23
- package/src/components/internal/glass/glint.ts +3 -3
- package/src/components/internal/hooks/use-host-election.ts +46 -0
- package/src/components/internal/icon/Icon.tsx +3 -5
- package/src/components/internal/icon/IconSlot.tsx +1 -1
- package/src/components/internal/icon/icon.css +8 -11
- package/src/components/internal/menu/highlight.ts +12 -0
- package/src/components/internal/menu/menu-row.tsx +5 -5
- package/src/components/internal/menu/menu-surface.css +55 -35
- package/src/components/internal/overlay/layer.tsx +2 -1
- package/src/components/internal/overlay/modal.tsx +5 -4
- package/src/components/internal/overlay/overlay.css +5 -10
- package/src/components/internal/overlay/trigger.css +4 -4
- package/src/components/internal/utils/activation.ts +0 -4
- package/src/components/primitives/avatar/Avatar.tsx +24 -8
- package/src/components/primitives/avatar/AvatarGroup.tsx +4 -4
- package/src/components/primitives/avatar/avatar.css +53 -51
- package/src/components/primitives/badge/Badge.tsx +9 -9
- package/src/components/primitives/badge/StatusBadge.tsx +7 -7
- package/src/components/primitives/badge/badge.css +31 -37
- package/src/components/primitives/badge/digit-strip.css +17 -17
- package/src/components/primitives/badge/digit-strip.tsx +4 -4
- package/src/components/primitives/button/Button.tsx +14 -28
- package/src/components/primitives/button/button-style.ts +28 -0
- package/src/components/primitives/button/button.css +99 -118
- package/src/components/primitives/checkbox/Checkbox.tsx +10 -4
- package/src/components/primitives/checkbox/check-glyph.tsx +5 -5
- package/src/components/primitives/checkbox/checkbox.css +28 -33
- package/src/components/primitives/collapse/Collapse.tsx +2 -2
- package/src/components/primitives/collapse/collapse.css +21 -33
- package/src/components/primitives/collapse/collapse.typecheck.tsx +1 -1
- package/src/components/primitives/input/NumberField.tsx +11 -11
- package/src/components/primitives/input/OtpField.tsx +3 -3
- package/src/components/primitives/input/TextField.tsx +9 -10
- package/src/components/primitives/input/field-chrome.tsx +6 -6
- package/src/components/primitives/input/input.css +81 -86
- package/src/components/primitives/radio-group/RadioGroup.tsx +23 -23
- package/src/components/primitives/radio-group/radio-group.css +65 -76
- 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.tsx +5 -5
- package/src/components/primitives/tag/ToggleTag.tsx +11 -6
- package/src/components/primitives/tag/tag.css +49 -54
- package/src/components/primitives/textarea/Textarea.tsx +13 -14
- package/src/components/primitives/textarea/textarea.css +47 -50
- package/src/components/primitives/toggle/Toggle.tsx +7 -7
- package/src/components/primitives/toggle/toggle.css +27 -32
- package/src/engine/animate.ts +12 -3
- package/src/engine/flip.ts +2 -1
- package/src/mcp/server.ts +5 -2
- package/src/motion/flip.ts +7 -8
- package/src/motion/glide.tsx +41 -26
- package/src/shared-slot.ts +10 -0
- package/src/styles.css +8 -16
- package/src/tokens/base.css +15 -0
- package/src/tokens/color.css +22 -63
- package/src/tokens/component-styles.generated.ts +81 -155
- package/src/tokens/dark.css +58 -0
- package/src/tokens/decisions.css +23 -0
- package/src/tokens/elevation.css +65 -23
- package/src/tokens/fonts.css +0 -2
- package/src/tokens/glass.css +17 -10
- package/src/tokens/motion-defaults.generated.ts +21 -0
- package/src/tokens/motion-scale.ts +2 -2
- package/src/tokens/motion-tokens.ts +65 -40
- package/src/tokens/motion-tokens.usage.md +5 -2
- package/src/tokens/motion.css +18 -28
- package/src/tokens/radius.css +12 -10
- package/src/tokens/reset.css +36 -0
- package/src/tokens/semantic.css +51 -39
- package/src/tokens/spacing.css +6 -7
- package/src/tokens/theme-store.ts +187 -0
- package/src/tokens/theme-sync.tsx +62 -0
- package/src/tokens/theme-tokens.generated.ts +708 -1121
- package/src/tokens/theme.tsx +116 -38
- package/src/tokens/theme.usage.md +26 -19
- package/src/tokens/typography.css +18 -20
- package/tailwind.css +187 -0
- package/dist/chunk-227ZW4V7.js.map +0 -1
- package/dist/chunk-43M6GQ4Q.js.map +0 -1
- package/dist/chunk-4BSHB7R3.js.map +0 -1
- package/dist/chunk-4C5RZXBT.js.map +0 -1
- package/dist/chunk-5PZ43DCG.js.map +0 -1
- package/dist/chunk-7IZJERGA.js +0 -80
- package/dist/chunk-7IZJERGA.js.map +0 -1
- package/dist/chunk-AADAJL7D.js.map +0 -1
- package/dist/chunk-CNWTIMIP.js +0 -39
- package/dist/chunk-CNWTIMIP.js.map +0 -1
- package/dist/chunk-EAI4POPB.js.map +0 -1
- package/dist/chunk-EF6RPXU7.js.map +0 -1
- package/dist/chunk-FONOS5RN.js.map +0 -1
- package/dist/chunk-FQEHSKEI.js +0 -38
- package/dist/chunk-FQEHSKEI.js.map +0 -1
- package/dist/chunk-HY5MPISE.js +0 -52
- package/dist/chunk-HY5MPISE.js.map +0 -1
- package/dist/chunk-I45AU6KH.js.map +0 -1
- package/dist/chunk-IJS7TPGV.js.map +0 -1
- package/dist/chunk-OWNMRMPN.js +0 -14
- package/dist/chunk-OWNMRMPN.js.map +0 -1
- package/dist/chunk-RJFGWJ4W.js.map +0 -1
- package/dist/chunk-TCUCYFT7.js +0 -25
- package/dist/chunk-TCUCYFT7.js.map +0 -1
- package/dist/chunk-TVYH4AN7.js.map +0 -1
- package/dist/chunk-TYHR4VNM.js.map +0 -1
- package/dist/chunk-VAXCXZ53.js.map +0 -1
- package/dist/chunk-XNIYSAMJ.js.map +0 -1
- package/dist/chunk-Y2YA7QRF.js +0 -17
- package/dist/chunk-Y2YA7QRF.js.map +0 -1
- package/src/tokens/avatar.css +0 -24
- package/src/tokens/icons.css +0 -11
- package/src/tokens/layers.css +0 -11
|
@@ -1,20 +1,16 @@
|
|
|
1
|
-
@layer zyncat.tokens, zyncat.components;
|
|
1
|
+
@layer zyncat.reset, zyncat.tokens, zyncat.components;
|
|
2
2
|
|
|
3
3
|
@layer zyncat.components {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
/* Modal placement - the shell layer centers the panel with breathing room. */
|
|
7
|
-
.overlay-layer--dialog {
|
|
4
|
+
.zc-overlay-layer--dialog {
|
|
8
5
|
place-items: center;
|
|
9
6
|
padding: var(--space-6);
|
|
10
7
|
}
|
|
11
|
-
.overlay-panel--dialog {
|
|
8
|
+
.zc-overlay-panel--dialog {
|
|
12
9
|
max-width: 100%;
|
|
13
10
|
max-height: 100%;
|
|
14
11
|
}
|
|
15
12
|
|
|
16
|
-
|
|
17
|
-
.dialog {
|
|
13
|
+
.zc-dialog {
|
|
18
14
|
--dialog-w: 32rem;
|
|
19
15
|
position: relative;
|
|
20
16
|
margin: 0;
|
|
@@ -31,35 +27,33 @@
|
|
|
31
27
|
border-radius: var(--radius-xl);
|
|
32
28
|
box-shadow: var(--shadow-xl);
|
|
33
29
|
color: var(--text-body);
|
|
34
|
-
font-family: var(--font-
|
|
30
|
+
font-family: var(--font-body);
|
|
35
31
|
}
|
|
36
32
|
|
|
37
|
-
.dialog[data-size='sm'] {
|
|
33
|
+
.zc-dialog[data-size='sm'] {
|
|
38
34
|
--dialog-w: 25rem;
|
|
39
35
|
}
|
|
40
|
-
.dialog[data-size='lg'] {
|
|
36
|
+
.zc-dialog[data-size='lg'] {
|
|
41
37
|
--dialog-w: 40rem;
|
|
42
38
|
}
|
|
43
39
|
|
|
44
|
-
|
|
45
|
-
.dialog__header {
|
|
40
|
+
.zc-dialog__header {
|
|
46
41
|
flex: 0 0 auto;
|
|
47
42
|
display: flex;
|
|
48
43
|
align-items: flex-start;
|
|
49
44
|
gap: var(--space-3);
|
|
50
|
-
padding: var(--space-5) var(--space-5) var(--space-4);
|
|
45
|
+
padding: var(--space-5) var(--space-5) calc(var(--space-4) - var(--ring-gutter));
|
|
51
46
|
transition:
|
|
52
47
|
border-color var(--duration-base) var(--ease-standard),
|
|
53
48
|
box-shadow var(--duration-base) var(--ease-standard);
|
|
54
49
|
border-bottom: var(--border-hairline) solid transparent;
|
|
55
50
|
}
|
|
56
|
-
|
|
57
|
-
.dialog:has(.dialog__body[data-scroll-top]) .dialog__header {
|
|
51
|
+
.zc-dialog:has(.zc-dialog__body[data-scroll-top]) .zc-dialog__header {
|
|
58
52
|
border-bottom-color: var(--border-subtle);
|
|
59
53
|
box-shadow: var(--shadow-xs);
|
|
60
54
|
}
|
|
61
55
|
|
|
62
|
-
.dialog__icon {
|
|
56
|
+
.zc-dialog__icon {
|
|
63
57
|
flex: 0 0 auto;
|
|
64
58
|
display: grid;
|
|
65
59
|
place-items: center;
|
|
@@ -70,36 +64,34 @@
|
|
|
70
64
|
color: var(--text-accent);
|
|
71
65
|
font-size: var(--icon-md);
|
|
72
66
|
}
|
|
73
|
-
.dialog[data-tone='danger'] .dialog__icon {
|
|
67
|
+
.zc-dialog[data-tone='danger'] .zc-dialog__icon {
|
|
74
68
|
background: var(--danger-subtle);
|
|
75
69
|
color: var(--danger-text);
|
|
76
70
|
}
|
|
77
71
|
|
|
78
|
-
.dialog__heading {
|
|
72
|
+
.zc-dialog__heading {
|
|
79
73
|
flex: 1 1 auto;
|
|
80
74
|
min-width: 0;
|
|
81
75
|
display: flex;
|
|
82
76
|
flex-direction: column;
|
|
83
77
|
gap: var(--space-1);
|
|
84
|
-
/* nudge text to optical-center against the 36px icon badge when present */
|
|
85
78
|
padding-top: var(--space-px);
|
|
86
79
|
}
|
|
87
|
-
.dialog__title {
|
|
80
|
+
.zc-dialog__title {
|
|
88
81
|
margin: 0;
|
|
89
82
|
color: var(--text-strong);
|
|
90
|
-
font: var(--weight-semibold) var(--size-heading)/var(--leading-heading) var(--font-
|
|
83
|
+
font: var(--weight-semibold) var(--size-heading)/var(--leading-heading) var(--font-body);
|
|
91
84
|
letter-spacing: var(--tracking-tight);
|
|
92
85
|
text-wrap: pretty;
|
|
93
86
|
}
|
|
94
|
-
.dialog__desc {
|
|
87
|
+
.zc-dialog__desc {
|
|
95
88
|
margin: 0;
|
|
96
89
|
color: var(--text-muted);
|
|
97
90
|
font: var(--type-body);
|
|
98
91
|
text-wrap: pretty;
|
|
99
92
|
}
|
|
100
93
|
|
|
101
|
-
|
|
102
|
-
.dialog__close {
|
|
94
|
+
.zc-dialog__close {
|
|
103
95
|
flex: 0 0 auto;
|
|
104
96
|
appearance: none;
|
|
105
97
|
margin: calc(var(--space-1) * -1) calc(var(--space-1) * -1) 0 0;
|
|
@@ -115,62 +107,61 @@
|
|
|
115
107
|
cursor: pointer;
|
|
116
108
|
font-size: var(--icon-sm);
|
|
117
109
|
transition: var(--transition-control);
|
|
110
|
+
outline: var(--ring-rest);
|
|
118
111
|
}
|
|
119
|
-
.dialog__close:hover {
|
|
112
|
+
.zc-dialog__close:hover {
|
|
120
113
|
background: var(--neutral-wash);
|
|
121
114
|
color: var(--text-strong);
|
|
122
115
|
}
|
|
123
|
-
.dialog__close:active {
|
|
116
|
+
.zc-dialog__close:active {
|
|
124
117
|
background: var(--bg-muted);
|
|
125
118
|
}
|
|
126
|
-
.dialog__close:focus-visible {
|
|
127
|
-
outline: none;
|
|
119
|
+
.zc-dialog__close:focus-visible {
|
|
128
120
|
color: var(--text-strong);
|
|
129
|
-
|
|
121
|
+
outline: var(--ring-accent);
|
|
130
122
|
}
|
|
131
123
|
|
|
132
|
-
|
|
133
|
-
.dialog__body {
|
|
124
|
+
.zc-dialog__body {
|
|
134
125
|
flex: 1 1 auto;
|
|
135
126
|
min-height: 0;
|
|
136
127
|
overflow-y: auto;
|
|
137
128
|
overscroll-behavior: contain;
|
|
138
|
-
padding:
|
|
129
|
+
scroll-padding: var(--ring-gutter);
|
|
130
|
+
padding: var(--ring-gutter) var(--space-5) var(--space-5);
|
|
139
131
|
color: var(--text-body);
|
|
140
132
|
font: var(--type-body);
|
|
141
133
|
}
|
|
142
|
-
.dialog__body:first-child {
|
|
134
|
+
.zc-dialog__body:first-child {
|
|
143
135
|
padding-top: var(--space-5);
|
|
144
136
|
}
|
|
145
|
-
.dialog:has(.dialog__icon) .dialog__body {
|
|
137
|
+
.zc-dialog:has(.zc-dialog__icon) .zc-dialog__body {
|
|
146
138
|
padding-left: calc(var(--space-5) + 2.25rem + var(--space-3));
|
|
147
139
|
}
|
|
148
|
-
.dialog:has(.dialog__footer) .dialog__body {
|
|
140
|
+
.zc-dialog:has(.zc-dialog__footer) .zc-dialog__body {
|
|
149
141
|
padding-bottom: var(--space-4);
|
|
150
142
|
}
|
|
151
|
-
.dialog__body > :first-child {
|
|
143
|
+
.zc-dialog__body > :first-child {
|
|
152
144
|
margin-top: 0;
|
|
153
145
|
}
|
|
154
|
-
.dialog__body > :last-child {
|
|
146
|
+
.zc-dialog__body > :last-child {
|
|
155
147
|
margin-bottom: 0;
|
|
156
148
|
}
|
|
157
149
|
|
|
158
|
-
.dialog__body {
|
|
150
|
+
.zc-dialog__body {
|
|
159
151
|
scrollbar-width: thin;
|
|
160
152
|
scrollbar-color: var(--border-strong) transparent;
|
|
161
153
|
}
|
|
162
|
-
.dialog__body::-webkit-scrollbar {
|
|
154
|
+
.zc-dialog__body::-webkit-scrollbar {
|
|
163
155
|
width: 10px;
|
|
164
156
|
}
|
|
165
|
-
.dialog__body::-webkit-scrollbar-thumb {
|
|
157
|
+
.zc-dialog__body::-webkit-scrollbar-thumb {
|
|
166
158
|
background: var(--border-strong);
|
|
167
159
|
border-radius: var(--radius-full);
|
|
168
160
|
border: 3px solid var(--bg-surface);
|
|
169
161
|
background-clip: padding-box;
|
|
170
162
|
}
|
|
171
163
|
|
|
172
|
-
|
|
173
|
-
.dialog__footer {
|
|
164
|
+
.zc-dialog__footer {
|
|
174
165
|
flex: 0 0 auto;
|
|
175
166
|
display: flex;
|
|
176
167
|
align-items: center;
|
|
@@ -181,7 +172,7 @@
|
|
|
181
172
|
border-top: var(--border-hairline) solid transparent;
|
|
182
173
|
transition: border-color var(--duration-base) var(--ease-standard);
|
|
183
174
|
}
|
|
184
|
-
.dialog:has(.dialog__body[data-scroll-bottom]) .dialog__footer {
|
|
175
|
+
.zc-dialog:has(.zc-dialog__body[data-scroll-bottom]) .zc-dialog__footer {
|
|
185
176
|
border-top-color: var(--border-subtle);
|
|
186
177
|
}
|
|
187
178
|
}
|
|
@@ -57,11 +57,19 @@ export interface DropdownProps {
|
|
|
57
57
|
onOpenChange?: (open: boolean) => void;
|
|
58
58
|
/** Fires when a row commits - gets its `id` and the full item. Committing closes every level. */
|
|
59
59
|
onSelect?: (id: string, item: DropdownItem) => void;
|
|
60
|
+
/** Move focus back to the trigger when a row commits or the keyboard dismisses the menu. Turn off when
|
|
61
|
+
* rows place focus themselves - an editor command that refocuses its document. @default true */
|
|
62
|
+
returnFocus?: boolean;
|
|
60
63
|
|
|
61
64
|
/** Preferred side of the trigger; flips to the opposite side when cramped. @default 'bottom' */
|
|
62
65
|
side?: 'top' | 'bottom' | 'left' | 'right';
|
|
63
66
|
/** Cross-axis alignment against the trigger. Submenus always align to their row. @default 'start' */
|
|
64
67
|
align?: 'start' | 'center' | 'end';
|
|
68
|
+
/** Hue of the highlight that travels between rows: the neutral wash, or the accent wash with accent
|
|
69
|
+
* ink on the active row. @default 'neutral' */
|
|
70
|
+
highlight?: 'neutral' | 'accent';
|
|
71
|
+
/** Short accent bar on the leading edge of the highlight, marking the active row. @default false */
|
|
72
|
+
rail?: boolean;
|
|
65
73
|
|
|
66
74
|
/** Base id for the menu and its rows; drives the trigger's `aria-controls`. Auto-generated when omitted. */
|
|
67
75
|
id?: string;
|
|
@@ -81,8 +89,11 @@ export function Dropdown({
|
|
|
81
89
|
defaultOpen = false,
|
|
82
90
|
onOpenChange,
|
|
83
91
|
onSelect,
|
|
92
|
+
returnFocus = true,
|
|
84
93
|
side = 'bottom',
|
|
85
94
|
align = 'start',
|
|
95
|
+
highlight = 'neutral',
|
|
96
|
+
rail = false,
|
|
86
97
|
id,
|
|
87
98
|
ariaLabel,
|
|
88
99
|
htmlProps,
|
|
@@ -105,11 +116,11 @@ export function Dropdown({
|
|
|
105
116
|
};
|
|
106
117
|
const triggerRef = refFor('trigger');
|
|
107
118
|
|
|
108
|
-
const dismiss = (
|
|
119
|
+
const dismiss = (refocus: boolean) => {
|
|
109
120
|
setPath([]);
|
|
110
121
|
hoverDepth.current = -1;
|
|
111
122
|
setOpen(false);
|
|
112
|
-
if (returnFocus && triggerRef.current) triggerRef.current.focus();
|
|
123
|
+
if (refocus && returnFocus && triggerRef.current) triggerRef.current.focus();
|
|
113
124
|
};
|
|
114
125
|
|
|
115
126
|
const show = (focus: SeedFocus) => {
|
|
@@ -124,6 +135,8 @@ export function Dropdown({
|
|
|
124
135
|
activateOn,
|
|
125
136
|
side,
|
|
126
137
|
align,
|
|
138
|
+
highlight,
|
|
139
|
+
rail,
|
|
127
140
|
ariaLabel,
|
|
128
141
|
htmlProps,
|
|
129
142
|
seed,
|
|
@@ -5,15 +5,18 @@ Docs: https://ui.zyncat.app/dropdown
|
|
|
5
5
|
|
|
6
6
|
Menu button - a list of ACTIONS the trigger commits, with submenus.
|
|
7
7
|
|
|
8
|
-
NOT a Select: it runs a command instead of holding a value
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
NOT a Select: it runs a command instead of holding a form value. items takes DropdownItem[] or
|
|
9
|
+
DropdownGroup[] (labelled sections); a row with its own items opens a submenu, nesting as deep as
|
|
10
|
+
you like. content on a row opens your own panel body in place of a submenu; selected marks the
|
|
11
|
+
current value of a single-choice group with a check. Keyboard is the APG menu button: arrows move,
|
|
11
12
|
Right/Left open and close a submenu, Enter/Space commit, typeahead, Esc one level, Tab the lot.
|
|
13
|
+
highlight neutral|accent picks the hue of the highlight travelling between rows; rail adds a short
|
|
14
|
+
accent bar on its leading edge. returnFocus false leaves focus where a committing row put it.
|
|
12
15
|
|
|
13
16
|
```tsx
|
|
14
17
|
<Dropdown trigger={<Button variant="secondary">Actions</Button>} onSelect={(id) => run(id)} items={[
|
|
15
18
|
{ id: 'rename', label: 'Rename', shortcut: 'R' },
|
|
16
|
-
{ id: 'move', label: 'Move to', items: [{ id: 'drafts', label: 'Drafts' }] },
|
|
19
|
+
{ id: 'move', label: 'Move to', items: [{ id: 'drafts', label: 'Drafts', selected: true }] },
|
|
17
20
|
{ id: 'delete', label: 'Delete', danger: true }]} />
|
|
18
21
|
<Dropdown open={o} onOpenChange={setO} side="top" align="end" ariaLabel="Row actions" trigger={<Button>...</Button>} items={groups} />
|
|
19
22
|
```
|
|
@@ -1,63 +1,72 @@
|
|
|
1
|
-
@layer zyncat.tokens, zyncat.components;
|
|
1
|
+
@layer zyncat.reset, zyncat.tokens, zyncat.components;
|
|
2
2
|
|
|
3
3
|
@layer zyncat.components {
|
|
4
|
-
|
|
5
|
-
group dividers and the row states a listbox has no use for. */
|
|
6
|
-
|
|
7
|
-
.dropdown__menu {
|
|
4
|
+
.zc-dropdown__menu {
|
|
8
5
|
--menu-max-width: min(20rem, 92vw);
|
|
9
6
|
--menu-max-height: min(26rem, 70vh);
|
|
10
7
|
min-width: 11rem;
|
|
11
8
|
}
|
|
12
9
|
|
|
13
|
-
.dropdown__menu[data-danger-active='true'] {
|
|
10
|
+
.zc-dropdown__menu[data-danger-active='true'] {
|
|
14
11
|
--menu-glide-fill: var(--danger-wash);
|
|
12
|
+
--menu-glide-rail: var(--danger);
|
|
15
13
|
}
|
|
16
14
|
|
|
17
|
-
.dropdown__group + .dropdown__group {
|
|
15
|
+
.zc-dropdown__group + .zc-dropdown__group {
|
|
18
16
|
border-top: var(--border-hairline) solid var(--border-subtle);
|
|
19
17
|
margin-top: var(--space-1);
|
|
20
18
|
padding-top: var(--space-1);
|
|
21
19
|
}
|
|
22
20
|
|
|
23
|
-
.dropdown__item {
|
|
21
|
+
.zc-dropdown__item {
|
|
24
22
|
transition: color var(--duration-fast) var(--ease-standard);
|
|
25
23
|
}
|
|
26
|
-
.dropdown__item[data-active='true'] {
|
|
27
|
-
color: var(--text-strong);
|
|
24
|
+
.zc-dropdown__item[data-active='true'] {
|
|
25
|
+
color: var(--menu-active-ink, var(--text-strong));
|
|
28
26
|
}
|
|
29
27
|
|
|
30
|
-
.dropdown__item[data-danger='true'],
|
|
31
|
-
.dropdown__item[data-danger='true'][data-active='true'] {
|
|
28
|
+
.zc-dropdown__item[data-danger='true'],
|
|
29
|
+
.zc-dropdown__item[data-danger='true'][data-active='true'] {
|
|
32
30
|
color: var(--danger-text);
|
|
33
31
|
}
|
|
34
|
-
.dropdown__item[data-danger='true'] .menu-row__icon {
|
|
32
|
+
.zc-dropdown__item[data-danger='true'] .zc-menu-row__icon {
|
|
35
33
|
color: var(--danger);
|
|
36
34
|
}
|
|
37
35
|
|
|
38
|
-
.dropdown__item
|
|
39
|
-
|
|
40
|
-
color: var(--text-
|
|
36
|
+
.zc-dropdown__item-caret {
|
|
37
|
+
flex: 0 0 auto;
|
|
38
|
+
color: var(--text-subtle);
|
|
41
39
|
}
|
|
42
|
-
.dropdown__item[data-
|
|
43
|
-
.dropdown__item[data-
|
|
44
|
-
|
|
45
|
-
.dropdown__item[data-disabled='true'] .dropdown__item-caret {
|
|
46
|
-
color: var(--text-disabled);
|
|
40
|
+
.zc-dropdown__item[data-active='true'] .zc-menu-row__icon,
|
|
41
|
+
.zc-dropdown__item[data-active='true'] .zc-dropdown__item-caret {
|
|
42
|
+
color: var(--menu-active-icon, var(--text-body));
|
|
47
43
|
}
|
|
48
44
|
|
|
49
|
-
.dropdown__item-
|
|
45
|
+
.zc-dropdown__item-check {
|
|
50
46
|
flex: 0 0 auto;
|
|
51
|
-
color: var(--
|
|
47
|
+
color: var(--accent);
|
|
52
48
|
}
|
|
53
|
-
.dropdown__item[data-
|
|
54
|
-
.dropdown__item[data-
|
|
55
|
-
color: var(--text-
|
|
49
|
+
.zc-dropdown__item[data-selected='true'] .zc-menu-row__label,
|
|
50
|
+
.zc-dropdown__item[data-selected='true'] .zc-menu-row__icon {
|
|
51
|
+
color: var(--text-accent);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.zc-dropdown__item[data-disabled='true'] {
|
|
55
|
+
cursor: not-allowed;
|
|
56
|
+
color: var(--text-disabled);
|
|
57
|
+
}
|
|
58
|
+
.zc-dropdown__item[data-disabled='true'] .zc-menu-row__icon,
|
|
59
|
+
.zc-dropdown__item[data-disabled='true'] .zc-menu-row__label,
|
|
60
|
+
.zc-dropdown__item[data-disabled='true'] .zc-dropdown__item-check,
|
|
61
|
+
.zc-dropdown__item[data-disabled='true'] .zc-dropdown__item-shortcut,
|
|
62
|
+
.zc-dropdown__item[data-disabled='true'] .zc-menu-row__desc,
|
|
63
|
+
.zc-dropdown__item[data-disabled='true'] .zc-dropdown__item-caret {
|
|
64
|
+
color: var(--text-disabled);
|
|
56
65
|
}
|
|
57
66
|
|
|
58
|
-
.dropdown__item-shortcut {
|
|
67
|
+
.zc-dropdown__item-shortcut {
|
|
59
68
|
flex: 0 0 auto;
|
|
60
|
-
font: var(--type-
|
|
69
|
+
font: var(--type-code);
|
|
61
70
|
font-variant-numeric: tabular-nums;
|
|
62
71
|
color: var(--text-subtle);
|
|
63
72
|
padding-left: var(--space-2);
|
|
@@ -9,22 +9,25 @@ import { useMotion, type MotionSpecs } from '../../../motion/use-motion';
|
|
|
9
9
|
import { edgeEnabled, matchPrefix, stepEnabled } from '../../internal/collection/collection';
|
|
10
10
|
import { useTypeahead } from '../../internal/hooks/use-typeahead';
|
|
11
11
|
import { Icon } from '../../internal/icon/Icon';
|
|
12
|
+
import { menuHighlightAttrs } from '../../internal/menu/highlight';
|
|
12
13
|
import { MenuRow } from '../../internal/menu/menu-row';
|
|
13
14
|
import { useReturnFocus } from '../../internal/overlay/focus';
|
|
14
15
|
import { useOutsidePress, useOverlayEntry } from '../../internal/overlay/layer';
|
|
15
16
|
import { useAnchorPosition } from '../../internal/overlay/position';
|
|
16
17
|
import { activationProps } from '../../internal/utils/activation';
|
|
17
18
|
import { cx } from '../../internal/utils/cx';
|
|
18
|
-
import { itemText, levelKey, normalize,
|
|
19
|
+
import { itemText, levelKey, normalize, opensLevel, popupOf, type DropdownItem, type MenuChain } from './types';
|
|
19
20
|
|
|
20
21
|
const SUBMENU_OPEN_DELAY = 90;
|
|
21
22
|
const SUBMENU_TRAVEL_GRACE = 500;
|
|
22
23
|
const MENU_KEYS = new Set('ArrowDown ArrowUp ArrowLeft ArrowRight Home End Enter Escape Tab'.split(' ').concat(' '));
|
|
24
|
+
const CONTENT_KEYS = new Set(['Escape', 'ArrowLeft', 'Tab']);
|
|
25
|
+
const TEXT_FIELD = 'input, textarea, [contenteditable]';
|
|
23
26
|
|
|
24
27
|
type Point = { x: number; y: number };
|
|
25
28
|
|
|
26
|
-
|
|
27
|
-
|
|
29
|
+
const inTextField = (target: EventTarget | null) => target instanceof Element && target.closest(TEXT_FIELD) != null;
|
|
30
|
+
|
|
28
31
|
function headingTo(point: Point, from: Point, panel: HTMLElement): boolean {
|
|
29
32
|
const box = panel.getBoundingClientRect();
|
|
30
33
|
const rightward = from.x <= box.left;
|
|
@@ -39,6 +42,7 @@ export function MenuPanel({ chain, depth, ...motion }: { chain: MenuChain; depth
|
|
|
39
42
|
const { levels, hoverDepth, refFor } = chain;
|
|
40
43
|
const [level, next, parent] = [levels[depth], levels[depth + 1], levels[depth - 1]];
|
|
41
44
|
const nested = Boolean(parent);
|
|
45
|
+
const contentLevel = level.content != null;
|
|
42
46
|
|
|
43
47
|
const panelId = (d: number) =>
|
|
44
48
|
d === 0 ? chain.menuId : chain.menuId + '-' + d + '-' + encodeURIComponent(levels[d].owner!.id);
|
|
@@ -80,7 +84,9 @@ export function MenuPanel({ chain, depth, ...motion }: { chain: MenuChain; depth
|
|
|
80
84
|
}, [activeIdx]);
|
|
81
85
|
|
|
82
86
|
useLayoutEffect(() => {
|
|
83
|
-
if (seed
|
|
87
|
+
if (seed === 'none') return;
|
|
88
|
+
if (contentLevel) panelRef.current?.focus();
|
|
89
|
+
else setActiveIdx(edgeEnabled(flat, seed === 'last'));
|
|
84
90
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
85
91
|
}, [seed]);
|
|
86
92
|
|
|
@@ -95,7 +101,7 @@ export function MenuPanel({ chain, depth, ...motion }: { chain: MenuChain; depth
|
|
|
95
101
|
function armOpen(i: number) {
|
|
96
102
|
clearTimeout(timers.current.open);
|
|
97
103
|
const item = flat[i];
|
|
98
|
-
if (!item || item.disabled || item.id === openSubId || !
|
|
104
|
+
if (!item || item.disabled || item.id === openSubId || !opensLevel(item)) return;
|
|
99
105
|
timers.current.open = setTimeout(() => chain.openSub(depth, item, 'none'), SUBMENU_OPEN_DELAY);
|
|
100
106
|
}
|
|
101
107
|
|
|
@@ -123,7 +129,7 @@ export function MenuPanel({ chain, depth, ...motion }: { chain: MenuChain; depth
|
|
|
123
129
|
|
|
124
130
|
function commit(item: DropdownItem | undefined) {
|
|
125
131
|
if (!item || item.disabled) return;
|
|
126
|
-
if (
|
|
132
|
+
if (opensLevel(item)) chain.openSub(depth, item, 'first');
|
|
127
133
|
else chain.select(item);
|
|
128
134
|
}
|
|
129
135
|
|
|
@@ -155,7 +161,7 @@ export function MenuPanel({ chain, depth, ...motion }: { chain: MenuChain; depth
|
|
|
155
161
|
}
|
|
156
162
|
e.preventDefault();
|
|
157
163
|
const back = () => (openSubId != null ? closeSub() : cancel());
|
|
158
|
-
const opens = activeItem && !activeItem.disabled &&
|
|
164
|
+
const opens = activeItem && !activeItem.disabled && opensLevel(activeItem);
|
|
159
165
|
switch (e.key) {
|
|
160
166
|
case 'ArrowDown':
|
|
161
167
|
return moveTo(stepEnabled(flat, activeIdx, 1));
|
|
@@ -178,24 +184,36 @@ export function MenuPanel({ chain, depth, ...motion }: { chain: MenuChain; depth
|
|
|
178
184
|
}
|
|
179
185
|
}
|
|
180
186
|
|
|
187
|
+
function onContentKeyDown(e: KeyboardEvent<HTMLDivElement>) {
|
|
188
|
+
if (!CONTENT_KEYS.has(e.key) || e.defaultPrevented) return;
|
|
189
|
+
if (e.key === 'ArrowLeft' && inTextField(e.target)) return;
|
|
190
|
+
e.preventDefault();
|
|
191
|
+
e.stopPropagation();
|
|
192
|
+
if (e.key === 'Tab') chain.dismiss(true);
|
|
193
|
+
else cancel();
|
|
194
|
+
}
|
|
195
|
+
|
|
181
196
|
function renderRow(item: DropdownItem) {
|
|
182
197
|
const i = indexOf.get(item.id) ?? -1;
|
|
183
|
-
const
|
|
184
|
-
const subOpen =
|
|
198
|
+
const popup = popupOf(item);
|
|
199
|
+
const subOpen = popup != null && openSubId === item.id;
|
|
200
|
+
const radio = typeof item.selected === 'boolean';
|
|
185
201
|
return (
|
|
186
202
|
<MenuRow
|
|
187
203
|
key={item.id}
|
|
188
204
|
ref={rowFor(i)}
|
|
189
205
|
id={menuId + '-item-' + i}
|
|
190
|
-
className="dropdown__item"
|
|
191
|
-
role=
|
|
206
|
+
className="zc-dropdown__item"
|
|
207
|
+
role={radio ? 'menuitemradio' : 'menuitem'}
|
|
192
208
|
tabIndex={i === activeIdx ? 0 : -1}
|
|
209
|
+
aria-checked={radio ? item.selected : undefined}
|
|
193
210
|
aria-disabled={item.disabled || undefined}
|
|
194
|
-
aria-haspopup={
|
|
195
|
-
aria-expanded={
|
|
211
|
+
aria-haspopup={popup ?? undefined}
|
|
212
|
+
aria-expanded={popup ? subOpen : undefined}
|
|
196
213
|
aria-controls={subOpen ? panelId(depth + 1) : undefined}
|
|
197
214
|
aria-keyshortcuts={item.shortcut}
|
|
198
215
|
data-active={i === activeIdx ? 'true' : undefined}
|
|
216
|
+
data-selected={item.selected ? 'true' : undefined}
|
|
199
217
|
data-disabled={item.disabled ? 'true' : undefined}
|
|
200
218
|
data-danger={item.danger ? 'true' : undefined}
|
|
201
219
|
onPointerEnter={(e) => onRowEnter({ x: e.clientX, y: e.clientY }, i)}
|
|
@@ -209,31 +227,50 @@ export function MenuPanel({ chain, depth, ...motion }: { chain: MenuChain; depth
|
|
|
209
227
|
description={item.description}
|
|
210
228
|
trailing={
|
|
211
229
|
<>
|
|
230
|
+
{item.selected && <Icon name="check" size="sm" weight="bold" className="zc-dropdown__item-check" />}
|
|
212
231
|
{item.shortcut && (
|
|
213
|
-
<span className="dropdown__item-shortcut" aria-hidden="true">
|
|
232
|
+
<span className="zc-dropdown__item-shortcut" aria-hidden="true">
|
|
214
233
|
{item.shortcut}
|
|
215
234
|
</span>
|
|
216
235
|
)}
|
|
217
|
-
{
|
|
236
|
+
{popup && <Icon name="caret-right" size="sm" className="zc-dropdown__item-caret" />}
|
|
218
237
|
</>
|
|
219
238
|
}
|
|
220
239
|
/>
|
|
221
240
|
);
|
|
222
241
|
}
|
|
223
242
|
|
|
243
|
+
function renderRows() {
|
|
244
|
+
return (
|
|
245
|
+
<>
|
|
246
|
+
<GlidePill className="zc-menu-glide" glide={glide} />
|
|
247
|
+
{groups.length > 1 || groups[0]?.label
|
|
248
|
+
? groups.map((group, gi) => (
|
|
249
|
+
<div className="zc-dropdown__group" role="group" aria-label={group.label || undefined} key={gi}>
|
|
250
|
+
{group.label && <div className="zc-menu-group-label">{group.label}</div>}
|
|
251
|
+
{group.items.map(renderRow)}
|
|
252
|
+
</div>
|
|
253
|
+
))
|
|
254
|
+
: flat.map(renderRow)}
|
|
255
|
+
</>
|
|
256
|
+
);
|
|
257
|
+
}
|
|
258
|
+
|
|
224
259
|
return (
|
|
225
260
|
<div
|
|
226
261
|
{...(nested ? undefined : chain.htmlProps)}
|
|
262
|
+
{...menuHighlightAttrs(chain)}
|
|
227
263
|
ref={panelRef as unknown as RefObject<HTMLDivElement>}
|
|
228
264
|
id={menuId}
|
|
229
|
-
className={cx('menu-surface menu-scroller dropdown__menu', !nested && chain.htmlProps?.className)}
|
|
230
|
-
role=
|
|
265
|
+
className={cx('zc-menu-surface zc-menu-scroller zc-dropdown__menu', !nested && chain.htmlProps?.className)}
|
|
266
|
+
role={contentLevel ? 'dialog' : 'menu'}
|
|
231
267
|
tabIndex={-1}
|
|
232
268
|
aria-label={nested ? undefined : chain.ariaLabel}
|
|
233
269
|
aria-labelledby={nested ? panelId(depth - 1) + '-item-' + level.ownerIdx : undefined}
|
|
234
270
|
data-nested={nested ? 'true' : undefined}
|
|
271
|
+
data-content={contentLevel ? 'true' : undefined}
|
|
235
272
|
data-danger-active={activeItem && activeItem.danger ? 'true' : undefined}
|
|
236
|
-
onKeyDown={onKeyDown}
|
|
273
|
+
onKeyDown={contentLevel ? onContentKeyDown : onKeyDown}
|
|
237
274
|
onPointerEnter={() => {
|
|
238
275
|
if (hoverDepth.current > depth) travel.current.from = null;
|
|
239
276
|
hoverDepth.current = depth;
|
|
@@ -241,15 +278,7 @@ export function MenuPanel({ chain, depth, ...motion }: { chain: MenuChain; depth
|
|
|
241
278
|
}}
|
|
242
279
|
onPointerMove={(e) => travel.current.active && !heading({ x: e.clientX, y: e.clientY }) && abortTravel()}
|
|
243
280
|
>
|
|
244
|
-
|
|
245
|
-
{groups.length > 1 || groups[0]?.label
|
|
246
|
-
? groups.map((group, gi) => (
|
|
247
|
-
<div className="dropdown__group" role="group" aria-label={group.label || undefined} key={gi}>
|
|
248
|
-
{group.label && <div className="menu-group-label">{group.label}</div>}
|
|
249
|
-
{group.items.map(renderRow)}
|
|
250
|
-
</div>
|
|
251
|
-
))
|
|
252
|
-
: flat.map(renderRow)}
|
|
281
|
+
{contentLevel ? level.content : renderRows()}
|
|
253
282
|
</div>
|
|
254
283
|
);
|
|
255
284
|
}
|
|
@@ -2,6 +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
6
|
import type { ActivateOn } from '../../internal/utils/activation';
|
|
6
7
|
|
|
7
8
|
export interface DropdownItem {
|
|
@@ -19,8 +20,14 @@ export interface DropdownItem {
|
|
|
19
20
|
danger?: boolean;
|
|
20
21
|
/** Not selectable - skipped by arrow keys and typeahead, and marked `aria-disabled`. @default false */
|
|
21
22
|
disabled?: boolean;
|
|
23
|
+
/** Marks the row as the current value of a single-choice group: accent ink with a check at rest, and
|
|
24
|
+
* `menuitemradio` semantics. Leave undefined for plain action rows. */
|
|
25
|
+
selected?: boolean;
|
|
22
26
|
/** Nested menu. The row opens it instead of committing, and can nest again without limit. */
|
|
23
27
|
items?: DropdownItem[] | DropdownGroup[];
|
|
28
|
+
/** Your own panel body, opened from this row in place of a submenu. Nothing inside it commits the menu -
|
|
29
|
+
* drive dismissal with `open`/`onOpenChange`. */
|
|
30
|
+
content?: ReactNode;
|
|
24
31
|
/** Text used for typeahead. Required when `label` is not a string. */
|
|
25
32
|
searchText?: string;
|
|
26
33
|
/** Fires when this row commits, before the menu's own `onSelect`. */
|
|
@@ -49,39 +56,54 @@ export const itemText = (item: DropdownItem): string =>
|
|
|
49
56
|
export const submenuOf = (item: DropdownItem): DropdownItems | null =>
|
|
50
57
|
item.items && item.items.length > 0 ? item.items : null;
|
|
51
58
|
|
|
59
|
+
export const hasContent = (item: DropdownItem): boolean => item.content != null;
|
|
60
|
+
|
|
61
|
+
export type LevelPopup = 'menu' | 'dialog';
|
|
62
|
+
|
|
63
|
+
export const popupOf = (item: DropdownItem): LevelPopup | null =>
|
|
64
|
+
hasContent(item) ? 'dialog' : submenuOf(item) ? 'menu' : null;
|
|
65
|
+
|
|
66
|
+
export const opensLevel = (item: DropdownItem): boolean => popupOf(item) != null;
|
|
67
|
+
|
|
52
68
|
export const ROOT_LEVEL = 'root';
|
|
53
69
|
export const levelKey = (depth: number, ownerId: string) => depth + ':' + ownerId;
|
|
54
70
|
|
|
71
|
+
const NO_ROWS: DropdownItem[] = [];
|
|
72
|
+
|
|
55
73
|
export interface Level {
|
|
56
74
|
key: string;
|
|
57
75
|
items: DropdownItems;
|
|
76
|
+
content?: ReactNode;
|
|
58
77
|
owner: DropdownItem | null;
|
|
59
78
|
ownerIdx: number;
|
|
60
79
|
}
|
|
61
80
|
|
|
62
|
-
/* The open chain, root first: path[d] names the row in level d whose submenu is level d + 1. */
|
|
63
81
|
export function resolveLevels(items: DropdownItems, path: string[]): Level[] {
|
|
64
82
|
const levels: Level[] = [{ key: ROOT_LEVEL, items, owner: null, ownerIdx: -1 }];
|
|
65
83
|
for (const id of path) {
|
|
66
84
|
const { flat } = normalize(levels[levels.length - 1].items);
|
|
67
85
|
const ownerIdx = flat.findIndex((item) => item.id === id);
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
86
|
+
if (ownerIdx < 0) break;
|
|
87
|
+
const owner = flat[ownerIdx];
|
|
88
|
+
const sub = submenuOf(owner);
|
|
89
|
+
const key = levelKey(levels.length, id);
|
|
90
|
+
if (hasContent(owner)) levels.push({ key, items: NO_ROWS, content: owner.content, owner, ownerIdx });
|
|
91
|
+
else if (sub) levels.push({ key, items: sub, owner, ownerIdx });
|
|
92
|
+
else break;
|
|
71
93
|
}
|
|
72
94
|
return levels;
|
|
73
95
|
}
|
|
74
96
|
|
|
75
97
|
export type SeedFocus = 'first' | 'last' | 'none';
|
|
76
98
|
|
|
77
|
-
/* Everything a level needs to render itself and act on the chain. One object, built once by
|
|
78
|
-
Dropdown, so a panel takes its place in the chain rather than twenty separate props. */
|
|
79
99
|
export interface MenuChain {
|
|
80
100
|
levels: Level[];
|
|
81
101
|
menuId: string;
|
|
82
102
|
activateOn?: ActivateOn;
|
|
83
103
|
side: 'top' | 'bottom' | 'left' | 'right';
|
|
84
104
|
align: 'start' | 'center' | 'end';
|
|
105
|
+
highlight: MenuHighlight;
|
|
106
|
+
rail: boolean;
|
|
85
107
|
ariaLabel?: string;
|
|
86
108
|
htmlProps?: HTMLAttributes<HTMLDivElement> & DataAttributes;
|
|
87
109
|
seed: { key: string; focus: SeedFocus };
|