@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,31 +1,13 @@
|
|
|
1
|
-
@layer zyncat.tokens, zyncat.components;
|
|
1
|
+
@layer zyncat.reset, zyncat.tokens, zyncat.components;
|
|
2
2
|
|
|
3
3
|
@layer zyncat.components {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Anatomy: .tabs > .tabs__list[role=tablist] > .tab__hover? + .tab* + .tabs__ink
|
|
8
|
-
.tab > .tab__pad ( Icon? + .tab__label + .tab__count? )
|
|
9
|
-
States: :hover - :active - :focus-visible - :disabled - .is-selected
|
|
10
|
-
|
|
11
|
-
Two motions, both driven from Tabs.tsx - nothing here transitions them:
|
|
12
|
-
- the ink ("reaches, then releases"): one persistent node; the edge facing the
|
|
13
|
-
destination travels first, then the trailing edge settles. animate() keyframes on
|
|
14
|
-
x + measured width (destination width is unknowable to transforms; scaleX would
|
|
15
|
-
distort the radius).
|
|
16
|
-
- the gliding hover: one persistent pill (../motion/glide) that fades in under the
|
|
17
|
-
first tab touched, springs between pads, and fades out where it rests on leave.
|
|
18
|
-
Label color, icon weight and press dip remain trivial-tier CSS. */
|
|
19
|
-
|
|
20
|
-
/* -- Shell - owns the full-width baseline ----------------------------------
|
|
21
|
-
The hairline is a ::after on the shell (not a border on the scroller) so it
|
|
22
|
-
spans edge-to-edge while the scroller above it clips, masks and scrolls
|
|
23
|
-
freely. The scroller gets z-index:1 so the ink paints OVER the hairline. */
|
|
24
|
-
.tabs {
|
|
4
|
+
.zc-tabs {
|
|
5
|
+
/* 2px, not --border-emphasis: 1.5px renders as sub-pixel fuzz on 1x screens. */
|
|
25
6
|
--tabs-ink-h: 2px;
|
|
7
|
+
--tabs-pill-radius: var(--radius-md);
|
|
26
8
|
position: relative;
|
|
27
9
|
}
|
|
28
|
-
.tabs::after {
|
|
10
|
+
.zc-tabs::after {
|
|
29
11
|
content: '';
|
|
30
12
|
position: absolute;
|
|
31
13
|
inset-inline: 0;
|
|
@@ -34,13 +16,7 @@
|
|
|
34
16
|
background: var(--border-default);
|
|
35
17
|
}
|
|
36
18
|
|
|
37
|
-
|
|
38
|
-
Overflow is honest: the row scrolls (scrollbar hidden) and the clipped edge
|
|
39
|
-
fades out via a mask. The fade lengths are two custom props flipped by
|
|
40
|
-
data-fade (set from scroll geometry in Tabs.jsx) - at 0px the mask is fully
|
|
41
|
-
opaque, i.e. a no-op. Negative margin + matching padding align the first
|
|
42
|
-
label flush with the container edge while the hover pill still has room. */
|
|
43
|
-
.tabs__list {
|
|
19
|
+
.zc-tabs__list {
|
|
44
20
|
position: relative;
|
|
45
21
|
z-index: 1;
|
|
46
22
|
display: flex;
|
|
@@ -49,6 +25,8 @@
|
|
|
49
25
|
scrollbar-width: none;
|
|
50
26
|
margin-inline: calc(var(--space-2) * -1);
|
|
51
27
|
padding-inline: var(--space-2);
|
|
28
|
+
padding-block: max(var(--ring-gutter), calc(var(--tabs-ink-h) + var(--space-px)));
|
|
29
|
+
scroll-padding-inline: var(--space-2);
|
|
52
30
|
|
|
53
31
|
--tabs-fade-start: 0px;
|
|
54
32
|
--tabs-fade-end: 0px;
|
|
@@ -60,44 +38,41 @@
|
|
|
60
38
|
transparent
|
|
61
39
|
);
|
|
62
40
|
}
|
|
63
|
-
.tabs__list::-webkit-scrollbar {
|
|
41
|
+
.zc-tabs__list::-webkit-scrollbar {
|
|
64
42
|
display: none;
|
|
65
43
|
}
|
|
66
|
-
.tabs__list[data-fade~='start'] {
|
|
44
|
+
.zc-tabs__list[data-fade~='start'] {
|
|
67
45
|
--tabs-fade-start: var(--space-8);
|
|
68
46
|
}
|
|
69
|
-
.tabs__list[data-fade~='end'] {
|
|
47
|
+
.zc-tabs__list[data-fade~='end'] {
|
|
70
48
|
--tabs-fade-end: var(--space-8);
|
|
71
49
|
}
|
|
72
50
|
|
|
73
|
-
|
|
74
|
-
The button is pill + the ink's own band + a hairline of clearance, so the
|
|
75
|
-
ink underlines the pad instead of floating below it (total height 31px).
|
|
76
|
-
All visual feedback lives on the inner pill so hover/press/focus read as a
|
|
77
|
-
soft inset shape, while the ink below stays anchored to the baseline. */
|
|
78
|
-
.tab {
|
|
51
|
+
.zc-tab {
|
|
79
52
|
appearance: none;
|
|
80
53
|
border: 0;
|
|
81
54
|
background: none;
|
|
82
55
|
margin: 0;
|
|
83
|
-
padding: 0
|
|
56
|
+
padding: 0;
|
|
84
57
|
flex: none;
|
|
85
58
|
display: block;
|
|
86
|
-
font-family: var(--font-
|
|
59
|
+
font-family: var(--font-body);
|
|
87
60
|
cursor: pointer;
|
|
88
61
|
-webkit-tap-highlight-color: transparent;
|
|
62
|
+
border-radius: var(--radius-md);
|
|
63
|
+
outline: var(--ring-rest);
|
|
64
|
+
transition: var(--transition-control);
|
|
89
65
|
}
|
|
90
|
-
.tab:focus-visible {
|
|
91
|
-
outline:
|
|
66
|
+
.zc-tab:focus-visible {
|
|
67
|
+
outline: var(--ring-accent);
|
|
92
68
|
}
|
|
93
69
|
|
|
94
|
-
.tab__pad {
|
|
95
|
-
position: relative; /*
|
|
96
|
-
pill (z-index 0, first child of the list) */
|
|
70
|
+
.zc-tab__pad {
|
|
71
|
+
position: relative; /* paints above the glide pill, the list's absolute z-index 0 first child */
|
|
97
72
|
display: flex;
|
|
98
73
|
align-items: center;
|
|
99
74
|
gap: var(--space-2);
|
|
100
|
-
height: var(--control-height-sm);
|
|
75
|
+
height: var(--control-height-sm);
|
|
101
76
|
padding-inline: var(--space-2);
|
|
102
77
|
border-radius: var(--radius-md);
|
|
103
78
|
font: var(--type-micro);
|
|
@@ -108,37 +83,29 @@
|
|
|
108
83
|
var(--transition-control),
|
|
109
84
|
transform var(--duration-fast) var(--ease-standard);
|
|
110
85
|
}
|
|
111
|
-
.tab__pad .icon {
|
|
86
|
+
.zc-tab__pad .zc-icon {
|
|
112
87
|
display: inline-flex;
|
|
113
88
|
}
|
|
114
89
|
|
|
115
|
-
|
|
116
|
-
background), press dips 1px on a darker fill (tactile, like Button), focus
|
|
117
|
-
is the composed accent ring, selection is text-strong + the ink. */
|
|
118
|
-
.tab:hover:not(:disabled) .tab__pad {
|
|
90
|
+
.zc-tab:hover:not(:disabled) .zc-tab__pad {
|
|
119
91
|
color: var(--text-body);
|
|
120
92
|
}
|
|
121
|
-
.tab:active:not(:disabled) .tab__pad {
|
|
122
|
-
background: var(--neutral-wash-press);
|
|
93
|
+
.zc-tab:active:not(:disabled) .zc-tab__pad {
|
|
123
94
|
transform: translateY(var(--space-px));
|
|
124
95
|
}
|
|
125
|
-
.tab.is-selected .tab__pad,
|
|
126
|
-
.tab.is-selected:hover:not(:disabled) .tab__pad {
|
|
96
|
+
.zc-tab.zc-is-selected .zc-tab__pad,
|
|
97
|
+
.zc-tab.zc-is-selected:hover:not(:disabled) .zc-tab__pad {
|
|
127
98
|
color: var(--text-strong);
|
|
128
99
|
}
|
|
129
|
-
.tab:
|
|
130
|
-
box-shadow: var(--ring-accent);
|
|
131
|
-
}
|
|
132
|
-
.tab:disabled {
|
|
100
|
+
.zc-tab:disabled {
|
|
133
101
|
cursor: not-allowed;
|
|
134
102
|
}
|
|
135
|
-
.tab:disabled .tab__pad {
|
|
103
|
+
.zc-tab:disabled .zc-tab__pad {
|
|
136
104
|
color: var(--text-disabled);
|
|
137
105
|
}
|
|
138
106
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
font-family: var(--font-mono);
|
|
107
|
+
.zc-tab__count {
|
|
108
|
+
font-family: var(--font-code);
|
|
142
109
|
font-size: var(--size-micro);
|
|
143
110
|
line-height: 1;
|
|
144
111
|
font-variant-numeric: tabular-nums;
|
|
@@ -148,21 +115,16 @@
|
|
|
148
115
|
border-radius: var(--radius-sm);
|
|
149
116
|
transition: var(--transition-colors);
|
|
150
117
|
}
|
|
151
|
-
.tab.is-selected .tab__count {
|
|
118
|
+
.zc-tab.zc-is-selected .zc-tab__count {
|
|
152
119
|
color: var(--text-accent);
|
|
153
120
|
background: var(--accent-wash);
|
|
154
121
|
}
|
|
155
|
-
.tab:disabled .tab__count {
|
|
122
|
+
.zc-tab:disabled .zc-tab__count {
|
|
156
123
|
color: var(--text-disabled);
|
|
157
124
|
background: var(--bg-subtle);
|
|
158
125
|
}
|
|
159
126
|
|
|
160
|
-
|
|
161
|
-
One persistent pill, first child of the scroller (../motion/glide writes
|
|
162
|
-
x/y/width/height/opacity inline; coordinates include scrollLeft, so it
|
|
163
|
-
scrolls with its tab). z-index 0 + DOM order keep it under every tab's
|
|
164
|
-
positioned pad in both travel directions. Nothing transitions here. */
|
|
165
|
-
.tab__hover {
|
|
127
|
+
.zc-tab__hover {
|
|
166
128
|
opacity: 0;
|
|
167
129
|
position: absolute;
|
|
168
130
|
top: 0;
|
|
@@ -174,15 +136,7 @@
|
|
|
174
136
|
will-change: transform, opacity;
|
|
175
137
|
}
|
|
176
138
|
|
|
177
|
-
|
|
178
|
-
Positioned in the scroller's layout coordinates (offsetLeft space), so it
|
|
179
|
-
scrolls WITH its tab. Motion writes transform + width at runtime; resting
|
|
180
|
-
geometry is set the same way, so there is nothing to transition here.
|
|
181
|
-
EXCEPTION (intentional, mirrors RadioGroup's dot dims): 2px ink height is a
|
|
182
|
-
bespoke control dim - elevation.css reserves 2px for selected emphasis, but
|
|
183
|
-
ships no width token for it (--border-emphasis is 1.5px, which renders as
|
|
184
|
-
sub-pixel fuzz on 1x screens). Do not "fix" it to a token. */
|
|
185
|
-
.tabs__ink {
|
|
139
|
+
.zc-tabs__ink {
|
|
186
140
|
position: absolute;
|
|
187
141
|
left: 0;
|
|
188
142
|
bottom: 0;
|
|
@@ -193,23 +147,57 @@
|
|
|
193
147
|
will-change: transform, width;
|
|
194
148
|
}
|
|
195
149
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
.
|
|
150
|
+
.zc-tabs--pill {
|
|
151
|
+
display: flex;
|
|
152
|
+
width: fit-content;
|
|
153
|
+
max-width: 100%;
|
|
154
|
+
padding: var(--space-1);
|
|
155
|
+
border-radius: calc(var(--tabs-pill-radius) + var(--space-1));
|
|
156
|
+
background: var(--bg-inset);
|
|
157
|
+
}
|
|
158
|
+
.zc-tabs--pill::after {
|
|
159
|
+
content: none;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.zc-tabs--pill .zc-tabs__list {
|
|
163
|
+
min-width: 0;
|
|
164
|
+
margin: calc(var(--space-1) * -1);
|
|
165
|
+
padding: var(--space-1);
|
|
166
|
+
border-radius: calc(var(--tabs-pill-radius) + var(--space-1));
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.zc-tabs--pill .zc-tab {
|
|
170
|
+
border-radius: var(--tabs-pill-radius);
|
|
171
|
+
}
|
|
172
|
+
.zc-tabs--pill .zc-tab__pad {
|
|
173
|
+
z-index: 1;
|
|
174
|
+
border-radius: var(--tabs-pill-radius);
|
|
175
|
+
}
|
|
176
|
+
.zc-tabs--pill .zc-tab:active:not(:disabled) .zc-tab__pad {
|
|
177
|
+
transform: none;
|
|
178
|
+
}
|
|
179
|
+
.zc-tabs--pill .zc-tab__count {
|
|
180
|
+
background: var(--bg-subtle);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.zc-tabs--pill .zc-tabs__ink {
|
|
184
|
+
top: var(--space-1);
|
|
185
|
+
bottom: auto;
|
|
186
|
+
height: var(--control-height-sm);
|
|
187
|
+
border-radius: var(--tabs-pill-radius);
|
|
188
|
+
background: var(--bg-surface);
|
|
189
|
+
box-shadow: var(--shadow-xs);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.zc-tab-panel {
|
|
205
193
|
outline: none;
|
|
206
194
|
overflow: hidden;
|
|
207
195
|
}
|
|
208
|
-
.tab-panel:focus-visible {
|
|
209
|
-
|
|
196
|
+
.zc-tab-panel:focus-visible {
|
|
197
|
+
outline: var(--ring-accent);
|
|
210
198
|
border-radius: var(--radius-md);
|
|
211
199
|
}
|
|
212
|
-
.tab-panel__inner {
|
|
200
|
+
.zc-tab-panel__inner {
|
|
213
201
|
will-change: transform, opacity;
|
|
214
202
|
}
|
|
215
203
|
}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import './theme-switcher.css';
|
|
4
|
+
|
|
5
|
+
import { useId, type CSSProperties, type HTMLAttributes, type KeyboardEvent, type MouseEvent } from 'react';
|
|
6
|
+
|
|
7
|
+
import type { DataAttributes } from '../../../dom-props';
|
|
8
|
+
import { Motion } from '../../../motion/element';
|
|
9
|
+
import { setThemePreference, type Polarity, type PolarityPreference } from '../../../tokens/theme-store';
|
|
10
|
+
import { useTheme, useThemeTarget } from '../../../tokens/theme-sync';
|
|
11
|
+
import { cx } from '../../internal/utils/cx';
|
|
12
|
+
|
|
13
|
+
const POLARITIES: readonly PolarityPreference[] = ['system', 'light', 'dark'];
|
|
14
|
+
const CAPTIONS: Record<PolarityPreference, string> = { system: 'System', light: 'Light', dark: 'Dark' };
|
|
15
|
+
const STEPS: Record<string, number[]> = { ArrowUp: [-1, 0], ArrowDown: [1, 0], ArrowLeft: [0, -1], ArrowRight: [0, 1] };
|
|
16
|
+
|
|
17
|
+
const focusOnMount = (node: HTMLElement | null) => node?.focus({ preventScroll: true });
|
|
18
|
+
|
|
19
|
+
const centreOf = (element: Element): [number, number] => {
|
|
20
|
+
const box = element.getBoundingClientRect();
|
|
21
|
+
return [box.left + box.width / 2, box.top + box.height / 2];
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export interface ThemeGridProps {
|
|
25
|
+
/** Overrides the palette's own `name`, keyed like `themes`. For names that come from a translation. */
|
|
26
|
+
labels?: Record<string, string>;
|
|
27
|
+
/** Accessible name of the radio group. @default 'Theme' */
|
|
28
|
+
label?: string;
|
|
29
|
+
/** Focus the selected card on mount - for a grid that opens inside an overlay. @default false */
|
|
30
|
+
autoFocus?: boolean;
|
|
31
|
+
/** Enter or Tab on a card. `ThemeSwitcher` closes its panel with it; inline, leave it unset. */
|
|
32
|
+
onDismiss?: () => void;
|
|
33
|
+
/** Extra class(es) merged onto the grid. */
|
|
34
|
+
className?: string;
|
|
35
|
+
/** Inline styles merged onto the grid. */
|
|
36
|
+
style?: CSSProperties;
|
|
37
|
+
/** Standard <div> attributes (aria-*, data-*, ...) forwarded to the grid. */
|
|
38
|
+
htmlProps?: HTMLAttributes<HTMLDivElement> & DataAttributes;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function Mini({ palette, polarity, half }: { palette: string; polarity: Polarity; half?: boolean }) {
|
|
42
|
+
return (
|
|
43
|
+
<span
|
|
44
|
+
className={cx('zc-theme-switcher__mini', half && 'zc-theme-switcher__mini--half')}
|
|
45
|
+
data-theme={palette}
|
|
46
|
+
data-polarity={polarity}
|
|
47
|
+
/>
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function ThemeGrid({
|
|
52
|
+
labels,
|
|
53
|
+
label = 'Theme',
|
|
54
|
+
autoFocus = false,
|
|
55
|
+
onDismiss,
|
|
56
|
+
className,
|
|
57
|
+
style,
|
|
58
|
+
htmlProps,
|
|
59
|
+
}: ThemeGridProps) {
|
|
60
|
+
const { themes, themeNames } = useTheme();
|
|
61
|
+
const { theme, polarity } = useThemeTarget();
|
|
62
|
+
const ringId = useId();
|
|
63
|
+
const nameOf = (palette: string) => labels?.[palette] ?? themeNames[palette] ?? palette;
|
|
64
|
+
|
|
65
|
+
const onKeyDown = (event: KeyboardEvent, row: number, col: number) => {
|
|
66
|
+
if (event.key === 'Enter' || event.key === 'Tab') {
|
|
67
|
+
if (!onDismiss) return;
|
|
68
|
+
event.preventDefault();
|
|
69
|
+
onDismiss();
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
const step = STEPS[event.key];
|
|
73
|
+
if (!step) return;
|
|
74
|
+
event.preventDefault();
|
|
75
|
+
setThemePreference(
|
|
76
|
+
{
|
|
77
|
+
theme: themes[(row + step[0] + themes.length) % themes.length],
|
|
78
|
+
polarity: POLARITIES[(col + step[1] + POLARITIES.length) % POLARITIES.length],
|
|
79
|
+
},
|
|
80
|
+
{ origin: centreOf(event.currentTarget) },
|
|
81
|
+
);
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
const onPick = (event: MouseEvent<HTMLButtonElement>, palette: string, choice: PolarityPreference) =>
|
|
85
|
+
setThemePreference({ theme: palette, polarity: choice }, { origin: centreOf(event.currentTarget) });
|
|
86
|
+
|
|
87
|
+
return (
|
|
88
|
+
<div
|
|
89
|
+
{...htmlProps}
|
|
90
|
+
data-theme-lead=""
|
|
91
|
+
role="radiogroup"
|
|
92
|
+
aria-label={label}
|
|
93
|
+
style={style}
|
|
94
|
+
className={cx('zc-theme-switcher__grid', className)}
|
|
95
|
+
>
|
|
96
|
+
{themes.map((palette, row) => (
|
|
97
|
+
<div key={palette} className="zc-theme-switcher__row">
|
|
98
|
+
{themes.length > 1 && (
|
|
99
|
+
<span className="zc-theme-switcher__row-label" aria-hidden="true">
|
|
100
|
+
{nameOf(palette)}
|
|
101
|
+
</span>
|
|
102
|
+
)}
|
|
103
|
+
{POLARITIES.map((choice, col) => {
|
|
104
|
+
const checked = palette === theme && choice === polarity;
|
|
105
|
+
return (
|
|
106
|
+
<button
|
|
107
|
+
key={choice}
|
|
108
|
+
ref={checked && autoFocus ? focusOnMount : undefined}
|
|
109
|
+
type="button"
|
|
110
|
+
role="radio"
|
|
111
|
+
aria-checked={checked}
|
|
112
|
+
aria-label={`${nameOf(palette)}, ${CAPTIONS[choice]}`}
|
|
113
|
+
tabIndex={checked ? 0 : -1}
|
|
114
|
+
className={cx('zc-theme-switcher__card', checked && 'zc-is-selected')}
|
|
115
|
+
onClick={(event) => onPick(event, palette, choice)}
|
|
116
|
+
onKeyDown={(event) => onKeyDown(event, row, col)}
|
|
117
|
+
>
|
|
118
|
+
<span className="zc-theme-switcher__preview">
|
|
119
|
+
<Mini palette={palette} polarity={choice === 'dark' ? 'dark' : 'light'} />
|
|
120
|
+
{choice === 'system' && <Mini palette={palette} polarity="dark" half />}
|
|
121
|
+
{checked && (
|
|
122
|
+
<Motion as="span" layoutId={ringId} className="zc-theme-switcher__ring" aria-hidden="true" />
|
|
123
|
+
)}
|
|
124
|
+
</span>
|
|
125
|
+
{CAPTIONS[choice]}
|
|
126
|
+
</button>
|
|
127
|
+
);
|
|
128
|
+
})}
|
|
129
|
+
</div>
|
|
130
|
+
))}
|
|
131
|
+
</div>
|
|
132
|
+
);
|
|
133
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# ThemeGrid - @zyncat/ui/theme-grid
|
|
2
|
+
|
|
3
|
+
Group: overlays
|
|
4
|
+
Docs: https://ui.zyncat.app/theme-switcher
|
|
5
|
+
|
|
6
|
+
The theme picker without a surface: a radio grid of miniatures, one card per palette and side plus a split System card, each drawn from that theme's real tokens.
|
|
7
|
+
|
|
8
|
+
This is what `ThemeSwitcher` puts in its popover, exported on its own so it can sit in a settings page,
|
|
9
|
+
a `Sheet`, a `Dialog` or a preferences panel. It imports no overlay, paints no background, and needs no
|
|
10
|
+
props: mount `ZyncatTheme` once and the grid lists every palette it declared, `default` first. A click
|
|
11
|
+
applies the theme live. Arrow keys move as a radio group and select as they go - left and right change
|
|
12
|
+
the side, up and down the palette. Each palette shows its own `name`; `labels` overrides that per key,
|
|
13
|
+
for names that come from a translation. `label` is the accessible name of the group, and `autoFocus`
|
|
14
|
+
puts focus on the selected card at mount, for a grid
|
|
15
|
+
that opens inside an overlay; leave it off inline. `onDismiss` fires on Enter or Tab, for the surface
|
|
16
|
+
around it to close - without it both keys stay inert.
|
|
17
|
+
|
|
18
|
+
```tsx
|
|
19
|
+
<ThemeGrid />
|
|
20
|
+
```
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import './theme-switcher.css';
|
|
4
|
+
|
|
5
|
+
import { useState, type CSSProperties } from 'react';
|
|
6
|
+
|
|
7
|
+
import type { DisableableAnimation } from '../../../motion/timing';
|
|
8
|
+
import { useTheme, useThemeTarget } from '../../../tokens/theme-sync';
|
|
9
|
+
import { cx } from '../../internal/utils/cx';
|
|
10
|
+
import { Button, type ButtonProps } from '../../primitives/button/Button';
|
|
11
|
+
import { Popover } from '../popover/Popover';
|
|
12
|
+
import { ThemeGrid, type ThemeGridProps } from './ThemeGrid';
|
|
13
|
+
|
|
14
|
+
const CAPTIONS: Record<string, string> = { system: 'System', light: 'Light', dark: 'Dark' };
|
|
15
|
+
|
|
16
|
+
export interface ThemeSwitcherProps {
|
|
17
|
+
/** Overrides the palette's own `name`, keyed like `themes`. For names that come from a translation. */
|
|
18
|
+
labels?: ThemeGridProps['labels'];
|
|
19
|
+
/** Accessible name of the control and its grid. @default 'Theme' */
|
|
20
|
+
label?: string;
|
|
21
|
+
/** Preferred side of the panel; flips to the opposite side when cramped. @default 'bottom' */
|
|
22
|
+
side?: 'top' | 'bottom' | 'left' | 'right';
|
|
23
|
+
/** Cross-axis alignment of the panel against the chip. @default 'end' */
|
|
24
|
+
align?: 'start' | 'center' | 'end';
|
|
25
|
+
/** Open/close timing - motion tokens only, or `null` to disable. @default open 'base'/'entrance', close 'fast'/'exit' */
|
|
26
|
+
animation?: DisableableAnimation;
|
|
27
|
+
/** Extra class(es) merged onto the chip. */
|
|
28
|
+
className?: string;
|
|
29
|
+
/** Inline styles merged onto the chip. */
|
|
30
|
+
style?: CSSProperties;
|
|
31
|
+
/** Standard <button> attributes (aria-*, data-*, ...) forwarded to the chip. */
|
|
32
|
+
htmlProps?: ButtonProps['htmlProps'];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function ThemeSwitcher({
|
|
36
|
+
labels,
|
|
37
|
+
label = 'Theme',
|
|
38
|
+
side = 'bottom',
|
|
39
|
+
align = 'end',
|
|
40
|
+
animation,
|
|
41
|
+
className,
|
|
42
|
+
style,
|
|
43
|
+
htmlProps,
|
|
44
|
+
}: ThemeSwitcherProps) {
|
|
45
|
+
const [open, setOpen] = useState(false);
|
|
46
|
+
const { themeNames } = useTheme();
|
|
47
|
+
const { theme, polarity } = useThemeTarget();
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<Popover
|
|
51
|
+
open={open}
|
|
52
|
+
onOpenChange={setOpen}
|
|
53
|
+
side={side}
|
|
54
|
+
align={align}
|
|
55
|
+
animation={animation}
|
|
56
|
+
htmlProps={{ className: 'zc-theme-switcher__panel', 'data-theme-lead': '' }}
|
|
57
|
+
trigger={
|
|
58
|
+
<Button
|
|
59
|
+
variant="ghost"
|
|
60
|
+
size="sm"
|
|
61
|
+
className={cx('zc-theme-switcher', className)}
|
|
62
|
+
style={style}
|
|
63
|
+
aria-label={`${label}: ${labels?.[theme] ?? themeNames[theme] ?? theme}, ${CAPTIONS[polarity]}`}
|
|
64
|
+
htmlProps={{ 'data-theme-lead': '', ...htmlProps }}
|
|
65
|
+
>
|
|
66
|
+
<span className="zc-theme-switcher__preview zc-theme-switcher__preview--chip" aria-hidden="true">
|
|
67
|
+
<span className="zc-theme-switcher__mini" />
|
|
68
|
+
</span>
|
|
69
|
+
</Button>
|
|
70
|
+
}
|
|
71
|
+
>
|
|
72
|
+
<ThemeGrid labels={labels} label={label} autoFocus onDismiss={() => setOpen(false)} />
|
|
73
|
+
</Popover>
|
|
74
|
+
);
|
|
75
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# ThemeSwitcher - @zyncat/ui/theme-switcher
|
|
2
|
+
|
|
3
|
+
Group: overlays
|
|
4
|
+
Docs: https://ui.zyncat.app/theme-switcher
|
|
5
|
+
|
|
6
|
+
The theme control: a chip painted in the live palette opens a grid of miniatures, one card per palette and side plus a split System card, each drawn from that theme's real tokens.
|
|
7
|
+
|
|
8
|
+
Needs no props: mount `ZyncatTheme` once for the palettes and the flash-free boot, and the grid lists
|
|
9
|
+
every palette it declared, `default` first. A click applies the theme live and leaves the panel open to
|
|
10
|
+
compare; Escape, Enter, Tab or an outside press closes it and focus returns to the chip. Arrow keys
|
|
11
|
+
move through the grid as a radio group and select as they go - left and right change the side, up and
|
|
12
|
+
down the palette. Each palette shows its own `name`; `labels` overrides that per key, for names that
|
|
13
|
+
come from a translation. `label` is the accessible name, `side` and `align` place the panel,
|
|
14
|
+
`animation` retimes it. The chip is the miniature under the
|
|
15
|
+
page's current tokens, so it is right before hydration and after a change made elsewhere. For the grid
|
|
16
|
+
on its own surface - a settings page, a `Sheet` - reach for `@zyncat/ui/theme-grid`, which is the panel
|
|
17
|
+
body without the popover.
|
|
18
|
+
|
|
19
|
+
```tsx
|
|
20
|
+
<ThemeSwitcher align="end" />
|
|
21
|
+
```
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
@layer zyncat.reset, zyncat.tokens, zyncat.components;
|
|
2
|
+
|
|
3
|
+
@layer zyncat.components {
|
|
4
|
+
.zc-theme-switcher.zc-btn {
|
|
5
|
+
padding-inline: var(--space-1);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.zc-theme-switcher__preview {
|
|
9
|
+
--_theme-switcher-unit: 4px;
|
|
10
|
+
--_theme-switcher-stroke: 2px;
|
|
11
|
+
position: relative;
|
|
12
|
+
display: grid;
|
|
13
|
+
width: calc(19 * var(--_theme-switcher-unit));
|
|
14
|
+
height: calc(12 * var(--_theme-switcher-unit));
|
|
15
|
+
border: var(--border-hairline) solid var(--border-default);
|
|
16
|
+
border-radius: var(--radius-sm);
|
|
17
|
+
background: var(--bg-app);
|
|
18
|
+
box-shadow: var(--shadow-xs);
|
|
19
|
+
transition:
|
|
20
|
+
transform var(--duration-fast) var(--ease-entrance),
|
|
21
|
+
box-shadow var(--duration-base) var(--ease-entrance),
|
|
22
|
+
border-color var(--duration-fast) var(--ease-standard);
|
|
23
|
+
}
|
|
24
|
+
.zc-theme-switcher__preview--chip {
|
|
25
|
+
--_theme-switcher-unit: 1.8px;
|
|
26
|
+
border-color: var(--border-strong);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.zc-theme-switcher__mini {
|
|
30
|
+
grid-area: 1 / 1;
|
|
31
|
+
border-radius: calc(var(--radius-sm) - var(--border-hairline));
|
|
32
|
+
background:
|
|
33
|
+
radial-gradient(circle closest-side, var(--accent) 92%, transparent) 8% 8% / 6.5% 10.5%,
|
|
34
|
+
linear-gradient(var(--text-strong), var(--text-strong)) 24% 11% / 24% var(--_theme-switcher-stroke),
|
|
35
|
+
linear-gradient(var(--text-secondary), var(--text-secondary)) 24% 41% / 57% var(--_theme-switcher-stroke),
|
|
36
|
+
linear-gradient(var(--accent-fill), var(--accent-fill)) 86% 83% / 26% 14.5%,
|
|
37
|
+
linear-gradient(var(--border-subtle), var(--border-subtle)) 0 25% / 100% var(--border-hairline),
|
|
38
|
+
linear-gradient(var(--bg-surface), var(--bg-surface)) 0 0 / 100% 25%,
|
|
39
|
+
var(--bg-app);
|
|
40
|
+
background-repeat: no-repeat;
|
|
41
|
+
}
|
|
42
|
+
.zc-theme-switcher__mini--half {
|
|
43
|
+
clip-path: polygon(58% 0, 100% 0, 100% 100%, 42% 100%);
|
|
44
|
+
}
|
|
45
|
+
.zc-theme-switcher__ring {
|
|
46
|
+
position: absolute;
|
|
47
|
+
inset: calc(-0.75 * var(--_theme-switcher-unit));
|
|
48
|
+
border: var(--border-emphasis) solid var(--accent);
|
|
49
|
+
border-radius: calc(var(--radius-sm) + 0.75 * var(--_theme-switcher-unit));
|
|
50
|
+
pointer-events: none;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.zc-theme-switcher__panel {
|
|
54
|
+
padding: var(--space-2);
|
|
55
|
+
background: var(--bg-surface-raised);
|
|
56
|
+
border: var(--border-hairline) solid var(--border-default);
|
|
57
|
+
border-radius: var(--radius-lg);
|
|
58
|
+
box-shadow: var(--shadow-lg);
|
|
59
|
+
color: var(--text-body);
|
|
60
|
+
}
|
|
61
|
+
.zc-theme-switcher__grid {
|
|
62
|
+
display: grid;
|
|
63
|
+
gap: var(--space-2);
|
|
64
|
+
}
|
|
65
|
+
.zc-theme-switcher__row {
|
|
66
|
+
display: grid;
|
|
67
|
+
grid-template-columns: repeat(3, auto);
|
|
68
|
+
gap: var(--space-px) var(--space-1);
|
|
69
|
+
}
|
|
70
|
+
.zc-theme-switcher__row-label {
|
|
71
|
+
grid-column: 1 / -1;
|
|
72
|
+
padding: var(--space-1) var(--space-1) 0;
|
|
73
|
+
font: var(--type-micro);
|
|
74
|
+
color: var(--text-subtle);
|
|
75
|
+
}
|
|
76
|
+
.zc-theme-switcher__card {
|
|
77
|
+
appearance: none;
|
|
78
|
+
display: grid;
|
|
79
|
+
justify-items: center;
|
|
80
|
+
gap: var(--space-1);
|
|
81
|
+
padding: var(--space-1);
|
|
82
|
+
border: 0;
|
|
83
|
+
border-radius: var(--radius-md);
|
|
84
|
+
background: transparent;
|
|
85
|
+
font: var(--type-micro);
|
|
86
|
+
color: var(--text-muted);
|
|
87
|
+
cursor: pointer;
|
|
88
|
+
transition: var(--transition-colors);
|
|
89
|
+
outline: var(--ring-rest);
|
|
90
|
+
}
|
|
91
|
+
.zc-theme-switcher__card:hover,
|
|
92
|
+
.zc-theme-switcher__card.zc-is-selected {
|
|
93
|
+
color: var(--text-strong);
|
|
94
|
+
}
|
|
95
|
+
.zc-theme-switcher__card:focus-visible {
|
|
96
|
+
outline: var(--ring-accent);
|
|
97
|
+
}
|
|
98
|
+
.zc-theme-switcher__card:hover .zc-theme-switcher__preview {
|
|
99
|
+
transform: translateY(calc(-2 * var(--space-px))) scale(1.06);
|
|
100
|
+
border-color: var(--border-strong);
|
|
101
|
+
box-shadow: var(--shadow-md);
|
|
102
|
+
}
|
|
103
|
+
.zc-theme-switcher__card:active .zc-theme-switcher__preview {
|
|
104
|
+
transform: none;
|
|
105
|
+
box-shadow: var(--shadow-xs);
|
|
106
|
+
}
|
|
107
|
+
}
|