@zyncat/ui 0.13.0 → 0.15.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 +72 -13
- package/dist/alert.css +26 -33
- package/dist/alert.js +18 -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 +51 -50
- package/dist/avatar.js +29 -7
- package/dist/avatar.js.map +1 -1
- package/dist/badge.css +30 -36
- package/dist/badge.js +1 -1
- package/dist/button.css +80 -96
- package/dist/button.js +1 -1
- package/dist/checkbox.css +27 -32
- package/dist/checkbox.js +2 -2
- package/dist/{chunk-RJFGWJ4W.js → chunk-3XRVPCIM.js} +6 -6
- package/dist/chunk-3XRVPCIM.js.map +1 -0
- package/dist/{chunk-M43IOM5C.js → chunk-5GBV45YD.js} +3 -3
- package/dist/{chunk-M43IOM5C.js.map → chunk-5GBV45YD.js.map} +1 -1
- 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-AADAJL7D.js → chunk-5X3MJRIM.js} +8 -9
- package/dist/chunk-5X3MJRIM.js.map +1 -0
- package/dist/{chunk-TCUCYFT7.js → chunk-6SUHSSOK.js} +3 -3
- package/dist/{chunk-TCUCYFT7.js.map → chunk-6SUHSSOK.js.map} +1 -1
- package/dist/{chunk-DDRSMHN4.js → chunk-6X3G4GIM.js} +3 -3
- package/dist/{chunk-DDRSMHN4.js.map → chunk-6X3G4GIM.js.map} +1 -1
- package/dist/{chunk-TYHR4VNM.js → chunk-AREEMG47.js} +10 -8
- package/dist/chunk-AREEMG47.js.map +1 -0
- package/dist/{chunk-EF6RPXU7.js → chunk-BH4JFWXQ.js} +36 -31
- package/dist/chunk-BH4JFWXQ.js.map +1 -0
- package/dist/{chunk-TVYH4AN7.js → chunk-BTF6DAE3.js} +13 -13
- package/dist/chunk-BTF6DAE3.js.map +1 -0
- package/dist/{chunk-CF4QHO4N.js → chunk-CAXQJSIE.js} +10 -10
- package/dist/{chunk-CF4QHO4N.js.map → chunk-CAXQJSIE.js.map} +1 -1
- package/dist/{chunk-4C5RZXBT.js → chunk-CFRGQJ23.js} +8 -8
- package/dist/chunk-CFRGQJ23.js.map +1 -0
- package/dist/{chunk-IJS7TPGV.js → chunk-FEXUS4SV.js} +6 -5
- package/dist/chunk-FEXUS4SV.js.map +1 -0
- package/dist/{chunk-227ZW4V7.js → chunk-FLQVOSFC.js} +11 -11
- package/dist/chunk-FLQVOSFC.js.map +1 -0
- package/dist/{chunk-FONOS5RN.js → chunk-FVPNICF4.js} +11 -10
- package/dist/chunk-FVPNICF4.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-4BSHB7R3.js → chunk-GJTHWB6O.js} +9 -9
- package/dist/chunk-GJTHWB6O.js.map +1 -0
- package/dist/{chunk-EAI4POPB.js → chunk-GOLSYGRA.js} +45 -75
- package/dist/chunk-GOLSYGRA.js.map +1 -0
- package/dist/chunk-H3X2263Y.js +17 -0
- package/dist/chunk-H3X2263Y.js.map +1 -0
- package/dist/chunk-K45CWVHS.js +53 -0
- package/dist/chunk-K45CWVHS.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-TUTXXC3W.js → chunk-MDSRZ4QR.js} +3 -3
- package/dist/{chunk-TUTXXC3W.js.map → chunk-MDSRZ4QR.js.map} +1 -1
- package/dist/chunk-N2GJEO5Z.js +101 -0
- package/dist/chunk-N2GJEO5Z.js.map +1 -0
- package/dist/chunk-PU3QWBEL.js +39 -0
- package/dist/chunk-PU3QWBEL.js.map +1 -0
- package/dist/{chunk-43M6GQ4Q.js → chunk-PWQVSVXR.js} +51 -32
- package/dist/chunk-PWQVSVXR.js.map +1 -0
- package/dist/chunk-QGVFFT2B.js +14 -0
- package/dist/chunk-QGVFFT2B.js.map +1 -0
- package/dist/{chunk-5PZ43DCG.js → chunk-RBSHRRNO.js} +12 -13
- package/dist/chunk-RBSHRRNO.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-HY5MPISE.js → chunk-UYSXJ7MH.js} +9 -9
- package/dist/chunk-UYSXJ7MH.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-3MPF7FZV.js → chunk-WCWV5IX6.js} +3 -3
- package/dist/{chunk-3MPF7FZV.js.map → chunk-WCWV5IX6.js.map} +1 -1
- package/dist/{chunk-VAXCXZ53.js → chunk-WZUTBJC4.js} +5 -4
- package/dist/chunk-WZUTBJC4.js.map +1 -0
- package/dist/cli.js +137 -25
- package/dist/collapse.css +15 -30
- package/dist/collapse.js +1 -1
- package/dist/confetti.css +19 -12
- 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 +20 -19
- package/dist/date-field.js.map +1 -1
- package/dist/date-picker.css +131 -154
- package/dist/date-range-field.js +55 -54
- package/dist/date-range-field.js.map +1 -1
- package/dist/datetime-field.js +24 -23
- package/dist/datetime-field.js.map +1 -1
- package/dist/dialog.css +31 -41
- package/dist/dialog.js +23 -22
- package/dist/dialog.js.map +1 -1
- package/dist/digit-strip.css +16 -16
- package/dist/dropdown.css +36 -27
- 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 +145 -148
- package/dist/facebook-feed.js +106 -102
- package/dist/facebook-feed.js.map +1 -1
- package/dist/flow-field.css +8 -4
- package/dist/flow-field.js +7 -6
- package/dist/flow-field.js.map +1 -1
- package/dist/glide.js +4 -3
- package/dist/icon.css +7 -10
- package/dist/input.css +76 -84
- package/dist/instagram-feed.css +65 -66
- package/dist/instagram-feed.js +61 -44
- package/dist/instagram-feed.js.map +1 -1
- package/dist/lens.css +42 -38
- package/dist/lens.js +17 -16
- package/dist/lens.js.map +1 -1
- package/dist/mcp.js +3 -2
- package/dist/menu-surface.css +54 -34
- package/dist/modal.css +2 -4
- package/dist/modal.js +12 -11
- package/dist/modal.js.map +1 -1
- package/dist/morphing-text.css +26 -16
- package/dist/morphing-text.js +14 -13
- package/dist/morphing-text.js.map +1 -1
- package/dist/motion-devtools.css +42 -68
- package/dist/motion-devtools.js +47 -39
- 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 +14 -14
- package/dist/number-field.js.map +1 -1
- package/dist/odometer.css +22 -16
- 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 +4 -9
- package/dist/pagination.css +10 -15
- package/dist/pagination.js +11 -10
- package/dist/pagination.js.map +1 -1
- package/dist/popover.css +13 -15
- package/dist/popover.js +10 -9
- package/dist/radio-group.css +60 -73
- package/dist/radio-group.js +30 -29
- package/dist/radio-group.js.map +1 -1
- package/dist/select.css +66 -75
- package/dist/select.js +19 -14
- package/dist/select.js.map +1 -1
- package/dist/sheet.css +12 -14
- package/dist/sheet.js +11 -10
- package/dist/status-badge.js +9 -9
- package/dist/status-badge.js.map +1 -1
- package/dist/styles.css +34 -34
- package/dist/support-rail.css +116 -100
- package/dist/support-rail.js +41 -40
- package/dist/support-rail.js.map +1 -1
- package/dist/table.css +76 -84
- package/dist/table.js +42 -41
- package/dist/table.js.map +1 -1
- package/dist/tabs.css +82 -90
- package/dist/tabs.js +23 -20
- package/dist/tabs.js.map +1 -1
- package/dist/tag.css +48 -53
- package/dist/tag.js +13 -12
- package/dist/tag.js.map +1 -1
- package/dist/text-field.js +5 -5
- package/dist/textarea.css +46 -49
- package/dist/textarea.js +16 -16
- package/dist/textarea.js.map +1 -1
- package/dist/theme.js +31 -15
- package/dist/theme.js.map +1 -1
- package/dist/tiktok.css +113 -117
- 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 +49 -65
- package/dist/toast.js +32 -26
- package/dist/toast.js.map +1 -1
- package/dist/toggle-tag.js +22 -13
- package/dist/toggle-tag.js.map +1 -1
- package/dist/toggle.css +26 -31
- package/dist/toggle.js +7 -7
- package/dist/toggle.js.map +1 -1
- package/dist/tooltip.css +16 -23
- package/dist/tooltip.js +117 -95
- package/dist/tooltip.js.map +1 -1
- package/dist/trigger.css +3 -3
- 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/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/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/dev/MotionDevtools.d.ts +3 -1
- package/dist/types/components/internal/hooks/use-host-election.d.ts +8 -0
- package/dist/types/components/internal/icon/Icon.d.ts +1 -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 +1 -1
- package/dist/types/components/primitives/input/TextField.d.ts +1 -2
- package/dist/types/components/primitives/textarea/Textarea.d.ts +0 -1
- package/dist/types/shared-slot.d.ts +1 -0
- package/dist/types/tokens/component-styles.generated.d.ts +79 -151
- 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-sync.d.ts +3 -0
- package/dist/types/tokens/theme-tokens.generated.d.ts +669 -1105
- package/dist/typing-lines.css +17 -10
- package/dist/typing-lines.js +9 -8
- package/dist/typing-lines.js.map +1 -1
- package/dist/weight-field.css +31 -17
- package/dist/weight-field.js +4 -4
- package/dist/weight-field.js.map +1 -1
- package/dist/youtube.css +90 -96
- package/dist/youtube.js +87 -86
- package/dist/youtube.js.map +1 -1
- package/package.json +3 -1
- package/skills/zyncat-ui/SKILL.md +5 -3
- package/skills/zyncat-ui/references/components.md +4 -4
- package/skills/zyncat-ui/references/theming.md +105 -34
- package/src/components/composites/alert/Alert.tsx +9 -10
- package/src/components/composites/alert/alert.css +26 -33
- 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 +25 -20
- package/src/components/composites/date-picker/date-picker.css +131 -154
- package/src/components/composites/date-picker/field-shell.tsx +7 -7
- package/src/components/composites/date-picker/range-panel.tsx +34 -34
- 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 +31 -41
- 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 +36 -27
- 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 +34 -34
- 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 +2 -4
- package/src/components/composites/pagination/Pagination.tsx +7 -7
- package/src/components/composites/pagination/pagination.css +10 -15
- package/src/components/composites/popover/Popover.tsx +2 -2
- package/src/components/composites/popover/popover.css +13 -15
- 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 +66 -75
- package/src/components/composites/sheet/Sheet.tsx +2 -2
- package/src/components/composites/sheet/sheet.css +12 -14
- 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 +76 -84
- 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 +82 -90
- package/src/components/composites/toast/Toast.tsx +23 -18
- package/src/components/composites/toast/toast-store.ts +8 -6
- package/src/components/composites/toast/toast.css +49 -65
- 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 +16 -23
- package/src/components/compound/support-rail/SupportRail.tsx +33 -33
- package/src/components/compound/support-rail/support-rail.css +116 -100
- package/src/components/dev/MotionDevtools.tsx +28 -17
- package/src/components/dev/MotionDevtools.usage.md +2 -2
- package/src/components/dev/motion-devtools.css +42 -68
- 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 +19 -12
- package/src/components/expressive/facebook-feed/chrome.tsx +2 -2
- package/src/components/expressive/facebook-feed/facebook-feed.css +145 -148
- 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 +4 -4
- package/src/components/expressive/flow-field/flow-field.css +8 -4
- package/src/components/expressive/instagram-feed/InstagramFeed.tsx +52 -44
- package/src/components/expressive/instagram-feed/instagram-feed.css +65 -66
- package/src/components/expressive/lens/Lens.tsx +14 -14
- package/src/components/expressive/lens/lens.css +42 -38
- package/src/components/expressive/morphing-text/MorphingText.tsx +12 -13
- package/src/components/expressive/morphing-text/morphing-text.css +26 -16
- package/src/components/expressive/odometer/Odometer.tsx +9 -9
- package/src/components/expressive/odometer/odometer.css +22 -16
- package/src/components/expressive/tiktok/TikTok.tsx +54 -54
- package/src/components/expressive/tiktok/tiktok.css +113 -117
- package/src/components/expressive/typing-lines/TypingLines.tsx +0 -0
- package/src/components/expressive/typing-lines/typing-lines.css +17 -10
- package/src/components/expressive/weight-field/WeightField.tsx +4 -4
- package/src/components/expressive/weight-field/weight-field.css +31 -17
- 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 +90 -96
- package/src/components/internal/glass/glass.css +19 -22
- 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 +1 -5
- package/src/components/internal/icon/IconSlot.tsx +1 -1
- package/src/components/internal/icon/icon.css +7 -10
- 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 +54 -34
- 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 +4 -9
- package/src/components/internal/overlay/trigger.css +3 -3
- 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 +51 -50
- 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 +30 -36
- package/src/components/primitives/badge/digit-strip.css +16 -16
- package/src/components/primitives/badge/digit-strip.tsx +4 -4
- package/src/components/primitives/button/Button.tsx +8 -8
- package/src/components/primitives/button/button.css +80 -96
- 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 +27 -32
- package/src/components/primitives/collapse/Collapse.tsx +2 -2
- package/src/components/primitives/collapse/collapse.css +15 -30
- 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 +76 -84
- package/src/components/primitives/radio-group/RadioGroup.tsx +23 -23
- package/src/components/primitives/radio-group/radio-group.css +60 -73
- 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 +48 -53
- package/src/components/primitives/textarea/Textarea.tsx +13 -14
- package/src/components/primitives/textarea/textarea.css +46 -49
- package/src/components/primitives/toggle/Toggle.tsx +7 -7
- package/src/components/primitives/toggle/toggle.css +26 -31
- package/src/engine/animate.ts +2 -1
- package/src/engine/flip.ts +2 -1
- package/src/mcp/server.ts +3 -1
- 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 +7 -15
- package/src/tokens/base.css +15 -0
- package/src/tokens/color.css +19 -59
- package/src/tokens/component-styles.generated.ts +79 -151
- package/src/tokens/dark.css +63 -0
- package/src/tokens/decisions.css +26 -0
- package/src/tokens/elevation.css +71 -21
- package/src/tokens/fonts.css +0 -2
- package/src/tokens/glass.css +15 -9
- 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 +12 -22
- package/src/tokens/radius.css +10 -9
- package/src/tokens/semantic.css +57 -37
- package/src/tokens/spacing.css +5 -6
- package/src/tokens/theme-sync.tsx +15 -0
- package/src/tokens/theme-tokens.generated.ts +682 -1109
- package/src/tokens/theme.tsx +22 -16
- package/src/tokens/theme.usage.md +19 -13
- package/src/tokens/typography.css +16 -19
- package/tailwind.css +193 -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.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-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
package/dist/toggle.css
CHANGED
|
@@ -1,21 +1,16 @@
|
|
|
1
1
|
@layer zyncat.tokens, zyncat.components;
|
|
2
2
|
|
|
3
3
|
@layer zyncat.components {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
.sw {
|
|
7
|
-
--sw-on-fill: linear-gradient(180deg, var(--accent), var(--accent-hover));
|
|
4
|
+
.zc-sw {
|
|
5
|
+
--sw-on-fill: linear-gradient(180deg, var(--accent-fill), var(--accent-hover));
|
|
8
6
|
--sw-off-fill: var(--bg-muted);
|
|
9
|
-
--sw-on-border: var(--accent);
|
|
7
|
+
--sw-on-border: var(--accent-fill);
|
|
10
8
|
--sw-off-border: var(--border-strong);
|
|
11
9
|
--sw-ring: var(--ring-accent);
|
|
12
|
-
/* track size is the only input; thumb + travel derive from it */
|
|
13
10
|
--sw-w: var(--control-height);
|
|
14
11
|
--sw-h: var(--control-switch);
|
|
15
12
|
--sw-inset: calc(2 * var(--space-px));
|
|
16
|
-
/* inner track height minus both borders and the gap each side, so the inset is uniform on all edges */
|
|
17
13
|
--sw-thumb: calc(var(--sw-h) - 2 * var(--border-hairline) - 2 * var(--sw-inset));
|
|
18
|
-
/* colors read this flag; the thumb is moved by transform, not by it */
|
|
19
14
|
--sw-checked: 0;
|
|
20
15
|
|
|
21
16
|
display: inline-flex;
|
|
@@ -31,18 +26,18 @@
|
|
|
31
26
|
--sw-checked: 1;
|
|
32
27
|
}
|
|
33
28
|
|
|
34
|
-
&:not(.sw--disabled):hover {
|
|
29
|
+
&:not(.zc-sw--disabled):hover {
|
|
35
30
|
background: var(--bg-muted);
|
|
36
31
|
}
|
|
37
|
-
&:not(.sw--disabled):hover:not(:has(:checked)) {
|
|
32
|
+
&:not(.zc-sw--disabled):hover:not(:has(:checked)) {
|
|
38
33
|
--sw-off-border: var(--text-subtle);
|
|
39
34
|
}
|
|
40
|
-
&:has(:focus-visible) .sw__track {
|
|
41
|
-
|
|
35
|
+
&:has(:focus-visible) .zc-sw__track {
|
|
36
|
+
outline: var(--sw-ring);
|
|
42
37
|
}
|
|
43
38
|
}
|
|
44
39
|
|
|
45
|
-
.sw__input {
|
|
40
|
+
.zc-sw__input {
|
|
46
41
|
position: absolute;
|
|
47
42
|
width: 1px;
|
|
48
43
|
height: 1px;
|
|
@@ -55,7 +50,7 @@
|
|
|
55
50
|
overflow: hidden;
|
|
56
51
|
}
|
|
57
52
|
|
|
58
|
-
.sw__track {
|
|
53
|
+
.zc-sw__track {
|
|
59
54
|
position: relative;
|
|
60
55
|
flex: none;
|
|
61
56
|
display: flex;
|
|
@@ -74,6 +69,7 @@
|
|
|
74
69
|
border-color var(--duration-base) var(--ease-standard),
|
|
75
70
|
background-color var(--duration-base) var(--ease-standard),
|
|
76
71
|
box-shadow var(--duration-fast) var(--ease-standard),
|
|
72
|
+
outline-color var(--duration-fast) var(--ease-standard),
|
|
77
73
|
transform var(--duration-fast) var(--ease-spring);
|
|
78
74
|
|
|
79
75
|
&::before {
|
|
@@ -85,9 +81,9 @@
|
|
|
85
81
|
opacity: var(--sw-checked);
|
|
86
82
|
transition: opacity var(--duration-base) var(--ease-standard);
|
|
87
83
|
}
|
|
84
|
+
outline: var(--ring-rest);
|
|
88
85
|
}
|
|
89
|
-
|
|
90
|
-
.sw__thumb {
|
|
86
|
+
.zc-sw__thumb {
|
|
91
87
|
--sw-tx: 0px;
|
|
92
88
|
--sw-sx: 1;
|
|
93
89
|
position: relative;
|
|
@@ -101,55 +97,54 @@
|
|
|
101
97
|
transform: translateX(var(--sw-tx)) scaleX(var(--sw-sx));
|
|
102
98
|
transition: transform var(--duration-base) var(--ease-spring);
|
|
103
99
|
}
|
|
104
|
-
/* React-set
|
|
105
|
-
.sw__track[data-on='true'] .sw__thumb {
|
|
100
|
+
/* React-set, not :has(:checked): a :has() twin would move the thumb out from under the spring and snap it. */
|
|
101
|
+
.zc-sw__track[data-on='true'] .zc-sw__thumb {
|
|
106
102
|
--sw-tx: calc(var(--sw-w) - var(--sw-h));
|
|
107
103
|
}
|
|
108
|
-
.sw__track[data-pressed='true'] {
|
|
104
|
+
.zc-sw__track[data-pressed='true'] {
|
|
109
105
|
transform: scale(0.96);
|
|
110
106
|
}
|
|
111
|
-
.sw__track[data-pressed='true'] .sw__thumb {
|
|
107
|
+
.zc-sw__track[data-pressed='true'] .zc-sw__thumb {
|
|
112
108
|
--sw-sx: 1.16;
|
|
113
109
|
}
|
|
114
110
|
|
|
115
|
-
.sw__text {
|
|
111
|
+
.zc-sw__text {
|
|
116
112
|
display: grid;
|
|
117
113
|
gap: var(--space-1);
|
|
118
114
|
}
|
|
119
|
-
.sw__label {
|
|
115
|
+
.zc-sw__label {
|
|
120
116
|
font: var(--type-label);
|
|
121
117
|
color: var(--text-strong);
|
|
122
118
|
}
|
|
123
|
-
.sw__desc {
|
|
119
|
+
.zc-sw__desc {
|
|
124
120
|
font: var(--type-caption);
|
|
125
121
|
color: var(--text-muted);
|
|
126
122
|
}
|
|
127
123
|
|
|
128
|
-
.sw--sm {
|
|
124
|
+
.zc-sw--sm {
|
|
129
125
|
--sw-w: var(--control-height-sm);
|
|
130
126
|
--sw-h: var(--space-4);
|
|
131
|
-
& .sw__label {
|
|
127
|
+
& .zc-sw__label {
|
|
132
128
|
font: var(--type-caption);
|
|
133
129
|
font-weight: var(--weight-medium);
|
|
134
130
|
color: var(--text-strong);
|
|
135
131
|
}
|
|
136
|
-
& .sw__track {
|
|
132
|
+
& .zc-sw__track {
|
|
137
133
|
margin-top: calc((var(--leading-caption) - var(--sw-h)) / 2);
|
|
138
134
|
}
|
|
139
135
|
}
|
|
140
136
|
|
|
141
|
-
|
|
142
|
-
.sw--disabled {
|
|
137
|
+
.zc-sw--disabled {
|
|
143
138
|
cursor: not-allowed;
|
|
144
139
|
--sw-on-fill: var(--accent-disabled);
|
|
145
140
|
--sw-off-fill: var(--bg-muted);
|
|
146
141
|
--sw-on-border: var(--accent-disabled);
|
|
147
142
|
--sw-off-border: var(--border-default);
|
|
148
|
-
& .sw__thumb {
|
|
143
|
+
& .zc-sw__thumb {
|
|
149
144
|
box-shadow: var(--shadow-xs);
|
|
150
145
|
}
|
|
151
|
-
& .sw__label,
|
|
152
|
-
& .sw__desc {
|
|
146
|
+
& .zc-sw__label,
|
|
147
|
+
& .zc-sw__desc {
|
|
153
148
|
color: var(--text-disabled);
|
|
154
149
|
}
|
|
155
150
|
}
|
package/dist/toggle.js
CHANGED
|
@@ -17,7 +17,7 @@ function Toggle({
|
|
|
17
17
|
htmlProps
|
|
18
18
|
}) {
|
|
19
19
|
const [isOn, setOn] = useControllable(checked, !!defaultChecked);
|
|
20
|
-
const cls = cx("sw", size === "sm" && "sw--sm", disabled && "sw--disabled", className);
|
|
20
|
+
const cls = cx("zc-sw", size === "sm" && "zc-sw--sm", disabled && "zc-sw--disabled", className);
|
|
21
21
|
const [pressed, setPressed] = useState(false);
|
|
22
22
|
function press(on) {
|
|
23
23
|
return () => {
|
|
@@ -43,7 +43,7 @@ function Toggle({
|
|
|
43
43
|
{
|
|
44
44
|
type: "checkbox",
|
|
45
45
|
role: "switch",
|
|
46
|
-
className: "sw__input",
|
|
46
|
+
className: "zc-sw__input",
|
|
47
47
|
disabled,
|
|
48
48
|
checked: isOn,
|
|
49
49
|
onChange: handleChange,
|
|
@@ -54,16 +54,16 @@ function Toggle({
|
|
|
54
54
|
/* @__PURE__ */ jsx(
|
|
55
55
|
"span",
|
|
56
56
|
{
|
|
57
|
-
className: "sw__track",
|
|
57
|
+
className: "zc-sw__track",
|
|
58
58
|
"data-on": isOn ? "true" : void 0,
|
|
59
59
|
"data-pressed": pressed ? "true" : void 0,
|
|
60
60
|
"aria-hidden": "true",
|
|
61
|
-
children: /* @__PURE__ */ jsx("span", { className: "sw__thumb" })
|
|
61
|
+
children: /* @__PURE__ */ jsx("span", { className: "zc-sw__thumb" })
|
|
62
62
|
}
|
|
63
63
|
),
|
|
64
|
-
label || description ? /* @__PURE__ */ jsxs("span", { className: "sw__text", children: [
|
|
65
|
-
label ? /* @__PURE__ */ jsx("span", { className: "sw__label", children: label }) : null,
|
|
66
|
-
description ? /* @__PURE__ */ jsx("span", { className: "sw__desc", children: description }) : null
|
|
64
|
+
label || description ? /* @__PURE__ */ jsxs("span", { className: "zc-sw__text", children: [
|
|
65
|
+
label ? /* @__PURE__ */ jsx("span", { className: "zc-sw__label", children: label }) : null,
|
|
66
|
+
description ? /* @__PURE__ */ jsx("span", { className: "zc-sw__desc", children: description }) : null
|
|
67
67
|
] }) : null
|
|
68
68
|
]
|
|
69
69
|
}
|
package/dist/toggle.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/primitives/toggle/Toggle.tsx"],"names":[],"mappings":";;;;;;AA2CO,SAAS,MAAA,CAAO;AAAA,EACrB,OAAA;AAAA,EACA,cAAA,GAAiB,KAAA;AAAA,EACjB,QAAA,GAAW,KAAA;AAAA,EACX,IAAA,GAAO,IAAA;AAAA,EACP,KAAA;AAAA,EACA,WAAA;AAAA,EACA,SAAA,GAAY,EAAA;AAAA,EACZ,KAAA;AAAA,EACA,QAAA;AAAA,EACA;AACF,CAAA,EAAgB;AACd,EAAA,MAAM,CAAC,MAAM,KAAK,CAAA,GAAI,gBAAgB,OAAA,EAAS,CAAC,CAAC,cAAc,CAAA;AAE/D,EAAA,MAAM,GAAA,GAAM,GAAG,
|
|
1
|
+
{"version":3,"sources":["../src/components/primitives/toggle/Toggle.tsx"],"names":[],"mappings":";;;;;;AA2CO,SAAS,MAAA,CAAO;AAAA,EACrB,OAAA;AAAA,EACA,cAAA,GAAiB,KAAA;AAAA,EACjB,QAAA,GAAW,KAAA;AAAA,EACX,IAAA,GAAO,IAAA;AAAA,EACP,KAAA;AAAA,EACA,WAAA;AAAA,EACA,SAAA,GAAY,EAAA;AAAA,EACZ,KAAA;AAAA,EACA,QAAA;AAAA,EACA;AACF,CAAA,EAAgB;AACd,EAAA,MAAM,CAAC,MAAM,KAAK,CAAA,GAAI,gBAAgB,OAAA,EAAS,CAAC,CAAC,cAAc,CAAA;AAE/D,EAAA,MAAM,GAAA,GAAM,GAAG,OAAA,EAAS,IAAA,KAAS,QAAQ,WAAA,EAAa,QAAA,IAAY,mBAAmB,SAAS,CAAA;AAE9F,EAAA,MAAM,CAAC,OAAA,EAAS,UAAU,CAAA,GAAI,SAAS,KAAK,CAAA;AAC5C,EAAA,SAAS,MAAM,EAAA,EAAa;AAC1B,IAAA,OAAO,MAAM;AACX,MAAA,IAAI,CAAC,QAAA,EAAU,UAAA,CAAW,EAAE,CAAA;AAAA,IAC9B,CAAA;AAAA,EACF;AAEA,EAAA,SAAS,aAAa,CAAA,EAAkC;AACtD,IAAA,KAAA,CAAM,CAAA,CAAE,OAAO,OAAO,CAAA;AACtB,IAAA,IAAI,QAAA,WAAmB,CAAC,CAAA;AAAA,EAC1B;AAEA,EAAA,uBACE,IAAA;AAAA,IAAC,OAAA;AAAA,IAAA;AAAA,MACC,SAAA,EAAW,GAAA;AAAA,MACX,KAAA;AAAA,MACA,aAAA,EAAe,MAAM,IAAI,CAAA;AAAA,MACzB,WAAA,EAAa,MAAM,KAAK,CAAA;AAAA,MACxB,cAAA,EAAgB,MAAM,KAAK,CAAA;AAAA,MAC3B,eAAA,EAAiB,MAAM,KAAK,CAAA;AAAA,MAE5B,QAAA,EAAA;AAAA,wBAAA,GAAA;AAAA,UAAC,OAAA;AAAA,UAAA;AAAA,YACC,IAAA,EAAK,UAAA;AAAA,YACL,IAAA,EAAK,QAAA;AAAA,YACL,SAAA,EAAU,cAAA;AAAA,YACV,QAAA;AAAA,YACA,OAAA,EAAS,IAAA;AAAA,YACT,QAAA,EAAU,YAAA;AAAA,YACT,GAAG,SAAA;AAAA,YACJ,cAAA,EAAgB;AAAA;AAAA,SAClB;AAAA,wBACA,GAAA;AAAA,UAAC,MAAA;AAAA,UAAA;AAAA,YACC,SAAA,EAAU,cAAA;AAAA,YACV,SAAA,EAAS,OAAO,MAAA,GAAS,MAAA;AAAA,YACzB,cAAA,EAAc,UAAU,MAAA,GAAS,MAAA;AAAA,YACjC,aAAA,EAAY,MAAA;AAAA,YAEZ,QAAA,kBAAA,GAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,cAAA,EAAe;AAAA;AAAA,SACjC;AAAA,QACC,KAAA,IAAS,WAAA,mBACR,IAAA,CAAC,MAAA,EAAA,EAAK,WAAU,aAAA,EACb,QAAA,EAAA;AAAA,UAAA,KAAA,mBAAQ,GAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,cAAA,EAAgB,iBAAM,CAAA,GAAU,IAAA;AAAA,UACxD,8BAAc,GAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,aAAA,EAAe,uBAAY,CAAA,GAAU;AAAA,SAAA,EACtE,CAAA,GACE;AAAA;AAAA;AAAA,GACN;AAEJ","file":"toggle.js","sourcesContent":["'use client';\n\nimport './toggle.css';\n\nimport {\n useState,\n type ChangeEvent,\n type ChangeEventHandler,\n type CSSProperties,\n type InputHTMLAttributes,\n type ReactNode,\n} from 'react';\n\nimport type { DataAttributes } from '../../../dom-props';\nimport { useControllable } from '../../internal/hooks/use-controllable';\nimport { cx } from '../../internal/utils/cx';\n\ninterface ToggleOwnProps {\n /** Controlled checked state. Omit for uncontrolled (use `defaultChecked`). */\n checked?: boolean;\n /** Uncontrolled initial state. */\n defaultChecked?: boolean;\n /** Disabled - inert and de-emphasized (faded track, retains its position). */\n disabled?: boolean;\n /** Track size: `md` 36x20 - `sm` 28x16 for dense settings/table rows. @default 'md' */\n size?: 'sm' | 'md';\n /** Label text beside the track. */\n label?: ReactNode;\n /** Optional secondary line under the label (settings rows). */\n description?: ReactNode;\n /** Fires on flip - read `e.target.checked`. */\n onChange?: ChangeEventHandler<HTMLInputElement>;\n /** Extra class(es) merged onto the root label. */\n className?: string;\n /** Inline styles merged onto the root label. */\n style?: CSSProperties;\n}\n\nexport interface ToggleProps extends ToggleOwnProps {\n /** Standard <input> attributes (name, value, required, aria-*, ...) forwarded to the switch input. */\n htmlProps?: Omit<InputHTMLAttributes<HTMLInputElement>, keyof ToggleOwnProps | 'type'> & DataAttributes;\n}\n\nexport function Toggle({\n checked,\n defaultChecked = false,\n disabled = false,\n size = 'md',\n label,\n description,\n className = '',\n style,\n onChange,\n htmlProps,\n}: ToggleProps) {\n const [isOn, setOn] = useControllable(checked, !!defaultChecked);\n\n const cls = cx('zc-sw', size === 'sm' && 'zc-sw--sm', disabled && 'zc-sw--disabled', className);\n\n const [pressed, setPressed] = useState(false);\n function press(on: boolean) {\n return () => {\n if (!disabled) setPressed(on);\n };\n }\n\n function handleChange(e: ChangeEvent<HTMLInputElement>) {\n setOn(e.target.checked);\n if (onChange) onChange(e);\n }\n\n return (\n <label\n className={cls}\n style={style}\n onPointerDown={press(true)}\n onPointerUp={press(false)}\n onPointerLeave={press(false)}\n onPointerCancel={press(false)}\n >\n <input\n type=\"checkbox\"\n role=\"switch\"\n className=\"zc-sw__input\"\n disabled={disabled}\n checked={isOn}\n onChange={handleChange}\n {...htmlProps}\n defaultChecked={undefined}\n />\n <span\n className=\"zc-sw__track\"\n data-on={isOn ? 'true' : undefined}\n data-pressed={pressed ? 'true' : undefined}\n aria-hidden=\"true\"\n >\n <span className=\"zc-sw__thumb\"></span>\n </span>\n {label || description ? (\n <span className=\"zc-sw__text\">\n {label ? <span className=\"zc-sw__label\">{label}</span> : null}\n {description ? <span className=\"zc-sw__desc\">{description}</span> : null}\n </span>\n ) : null}\n </label>\n );\n}\n"]}
|
package/dist/tooltip.css
CHANGED
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
@layer zyncat.tokens, zyncat.components;
|
|
2
2
|
|
|
3
3
|
@layer zyncat.components {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
.tooltip {
|
|
4
|
+
.zc-tooltip {
|
|
7
5
|
position: fixed;
|
|
8
6
|
left: 0;
|
|
9
7
|
top: 0;
|
|
10
8
|
box-sizing: border-box;
|
|
11
|
-
overflow: hidden;
|
|
9
|
+
overflow: hidden;
|
|
12
10
|
z-index: var(--layer-tooltip);
|
|
13
11
|
pointer-events: none;
|
|
14
|
-
width: max-content;
|
|
12
|
+
width: max-content;
|
|
15
13
|
padding: var(--space-2) var(--space-3);
|
|
16
14
|
background: var(--bg-surface-raised);
|
|
17
15
|
color: var(--text-body);
|
|
@@ -22,48 +20,44 @@
|
|
|
22
20
|
letter-spacing: var(--tracking-normal);
|
|
23
21
|
}
|
|
24
22
|
|
|
25
|
-
|
|
26
|
-
.tooltip--measure {
|
|
23
|
+
.zc-tooltip--measure {
|
|
27
24
|
visibility: hidden;
|
|
28
25
|
left: -9999px;
|
|
29
26
|
top: 0;
|
|
30
27
|
}
|
|
31
28
|
|
|
32
|
-
|
|
33
|
-
.tooltip-anchor {
|
|
29
|
+
.zc-tooltip-anchor {
|
|
34
30
|
display: contents;
|
|
35
31
|
}
|
|
36
32
|
|
|
37
|
-
|
|
38
|
-
.tooltip__body {
|
|
33
|
+
.zc-tooltip__body {
|
|
39
34
|
display: block;
|
|
40
35
|
width: max-content;
|
|
41
36
|
max-inline-size: var(--measure-floating);
|
|
42
37
|
text-wrap: pretty;
|
|
43
38
|
}
|
|
44
39
|
|
|
45
|
-
|
|
46
|
-
.tooltip[data-placement='top'] {
|
|
40
|
+
.zc-tooltip[data-placement='top'] {
|
|
47
41
|
transform-origin: center bottom;
|
|
48
42
|
}
|
|
49
|
-
.tooltip[data-placement='bottom'] {
|
|
43
|
+
.zc-tooltip[data-placement='bottom'] {
|
|
50
44
|
transform-origin: center top;
|
|
51
45
|
}
|
|
52
|
-
.tooltip[data-placement='left'] {
|
|
46
|
+
.zc-tooltip[data-placement='left'] {
|
|
53
47
|
transform-origin: right center;
|
|
54
48
|
}
|
|
55
|
-
.tooltip[data-placement='right'] {
|
|
49
|
+
.zc-tooltip[data-placement='right'] {
|
|
56
50
|
transform-origin: left center;
|
|
57
51
|
}
|
|
58
52
|
|
|
59
|
-
.tooltip__row {
|
|
53
|
+
.zc-tooltip__row {
|
|
60
54
|
display: flex;
|
|
61
55
|
align-items: baseline;
|
|
62
56
|
gap: var(--space-3);
|
|
63
57
|
}
|
|
64
|
-
.tooltip__shortcut {
|
|
58
|
+
.zc-tooltip__shortcut {
|
|
65
59
|
flex: 0 0 auto;
|
|
66
|
-
font-family: var(--font-
|
|
60
|
+
font-family: var(--font-code);
|
|
67
61
|
font-size: var(--size-micro);
|
|
68
62
|
font-variant-numeric: tabular-nums;
|
|
69
63
|
color: var(--text-subtle);
|
|
@@ -73,15 +67,14 @@
|
|
|
73
67
|
white-space: nowrap;
|
|
74
68
|
}
|
|
75
69
|
|
|
76
|
-
|
|
77
|
-
.tooltip strong {
|
|
70
|
+
.zc-tooltip strong {
|
|
78
71
|
font-weight: var(--weight-medium);
|
|
79
72
|
color: var(--text-strong);
|
|
80
73
|
}
|
|
81
|
-
.tooltip p {
|
|
74
|
+
.zc-tooltip p {
|
|
82
75
|
margin: 0;
|
|
83
76
|
}
|
|
84
|
-
.tooltip p + p {
|
|
77
|
+
.zc-tooltip p + p {
|
|
85
78
|
margin-top: var(--space-1);
|
|
86
79
|
}
|
|
87
80
|
}
|
package/dist/tooltip.js
CHANGED
|
@@ -1,88 +1,72 @@
|
|
|
1
|
-
'use client';import {
|
|
1
|
+
'use client';import { hostRegistry, useElectedHost } from './chunk-PU3QWBEL.js';
|
|
2
|
+
import { tokenPx } from './chunk-UE63OOVG.js';
|
|
2
3
|
import { popOut, popIn } from './chunk-HDSFWZ7L.js';
|
|
3
|
-
import { Presence } from './chunk-
|
|
4
|
-
import { Motion } from './chunk-
|
|
5
|
-
import './chunk-
|
|
6
|
-
import './chunk-
|
|
7
|
-
import {
|
|
4
|
+
import { Presence } from './chunk-6X3G4GIM.js';
|
|
5
|
+
import { Motion } from './chunk-RBSHRRNO.js';
|
|
6
|
+
import { usePresence } from './chunk-5GBV45YD.js';
|
|
7
|
+
import './chunk-FEXUS4SV.js';
|
|
8
|
+
import { sharedSlot } from './chunk-VNVVG47J.js';
|
|
9
|
+
import { useControllable } from './chunk-MMRIQNEN.js';
|
|
10
|
+
import { UIMotion } from './chunk-N2GJEO5Z.js';
|
|
8
11
|
import { cx } from './chunk-QGNC7LH5.js';
|
|
9
12
|
import './tooltip.css';
|
|
10
13
|
import { useRef, useId, useEffect, Fragment, useSyncExternalStore, useState, useLayoutEffect } from 'react';
|
|
11
14
|
import { createPortal } from 'react-dom';
|
|
12
15
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
13
16
|
|
|
17
|
+
// src/components/composites/tooltip/tooltip-store.ts
|
|
14
18
|
var OPEN_DELAY = 350;
|
|
15
19
|
var CLOSE_GRACE = 140;
|
|
16
20
|
var TOOLTIP_DOM_ID = "pds-tooltip";
|
|
17
21
|
var WARM_WINDOW = 300;
|
|
18
|
-
var store = {
|
|
19
|
-
|
|
22
|
+
var store = sharedSlot("tooltip.store@1", () => ({
|
|
23
|
+
stack: [],
|
|
20
24
|
described: null,
|
|
21
|
-
|
|
25
|
+
timers: /* @__PURE__ */ new Map(),
|
|
22
26
|
warmUntil: 0,
|
|
23
27
|
listeners: /* @__PURE__ */ new Set(),
|
|
24
|
-
get: () => store.
|
|
28
|
+
get: () => store.stack[store.stack.length - 1] ?? null,
|
|
25
29
|
subscribe(l) {
|
|
26
30
|
store.listeners.add(l);
|
|
27
31
|
return () => store.listeners.delete(l);
|
|
28
32
|
},
|
|
29
33
|
emit() {
|
|
34
|
+
const el = store.get()?.anchor() ?? null;
|
|
35
|
+
if (el !== store.described) {
|
|
36
|
+
store.described?.removeAttribute("aria-describedby");
|
|
37
|
+
store.described = el;
|
|
38
|
+
el?.setAttribute("aria-describedby", TOOLTIP_DOM_ID);
|
|
39
|
+
}
|
|
30
40
|
store.listeners.forEach((l) => l());
|
|
31
41
|
},
|
|
32
|
-
isWarm: () => store.
|
|
33
|
-
describe(el) {
|
|
34
|
-
if (store.described === el) return;
|
|
35
|
-
store.described?.removeAttribute("aria-describedby");
|
|
36
|
-
store.described = el;
|
|
37
|
-
el?.setAttribute("aria-describedby", TOOLTIP_DOM_ID);
|
|
38
|
-
},
|
|
42
|
+
isWarm: () => store.stack.length > 0 || performance.now() < store.warmUntil,
|
|
39
43
|
open(payload) {
|
|
40
|
-
clearTimeout(store.
|
|
41
|
-
store.
|
|
42
|
-
store.
|
|
44
|
+
clearTimeout(store.timers.get(payload.id));
|
|
45
|
+
const at = store.stack.findIndex((entry) => entry.id === payload.id);
|
|
46
|
+
if (at < 0) store.stack.push(payload);
|
|
47
|
+
else store.stack[at] = payload;
|
|
43
48
|
store.emit();
|
|
44
49
|
},
|
|
45
50
|
close(id, grace = CLOSE_GRACE) {
|
|
46
|
-
clearTimeout(store.
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
if (!store.active) return;
|
|
55
|
-
store.warmUntil = performance.now() + WARM_WINDOW;
|
|
56
|
-
store.active = null;
|
|
57
|
-
store.emit();
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
var hostReg = {
|
|
61
|
-
keys: [],
|
|
62
|
-
listeners: /* @__PURE__ */ new Set(),
|
|
63
|
-
subscribe(l) {
|
|
64
|
-
hostReg.listeners.add(l);
|
|
65
|
-
return () => hostReg.listeners.delete(l);
|
|
66
|
-
},
|
|
67
|
-
register(k) {
|
|
68
|
-
hostReg.keys.push(k);
|
|
69
|
-
hostReg.listeners.forEach((l) => l());
|
|
70
|
-
return () => {
|
|
71
|
-
const i = hostReg.keys.indexOf(k);
|
|
72
|
-
if (i >= 0) hostReg.keys.splice(i, 1);
|
|
73
|
-
hostReg.listeners.forEach((l) => l());
|
|
51
|
+
clearTimeout(store.timers.get(id));
|
|
52
|
+
const drop = () => {
|
|
53
|
+
store.timers.delete(id);
|
|
54
|
+
const at = store.stack.findIndex((entry) => entry.id === id);
|
|
55
|
+
if (at < 0) return;
|
|
56
|
+
store.stack.splice(at, 1);
|
|
57
|
+
if (!store.stack.length) store.warmUntil = performance.now() + WARM_WINDOW;
|
|
58
|
+
store.emit();
|
|
74
59
|
};
|
|
60
|
+
if (grace > 0) store.timers.set(id, setTimeout(drop, grace));
|
|
61
|
+
else drop();
|
|
62
|
+
},
|
|
63
|
+
dismiss() {
|
|
64
|
+
for (const entry of store.stack.slice()) entry.dismiss();
|
|
75
65
|
}
|
|
76
|
-
};
|
|
66
|
+
}));
|
|
67
|
+
var hostReg = hostRegistry("tooltip.host@1");
|
|
77
68
|
function useHostElection() {
|
|
78
|
-
|
|
79
|
-
if (!keyRef.current) keyRef.current = /* @__PURE__ */ Symbol("tip-host");
|
|
80
|
-
useEffect(() => hostReg.register(keyRef.current), []);
|
|
81
|
-
return useSyncExternalStore(
|
|
82
|
-
hostReg.subscribe,
|
|
83
|
-
() => hostReg.keys[0] === keyRef.current,
|
|
84
|
-
() => false
|
|
85
|
-
);
|
|
69
|
+
return useElectedHost(hostReg, "tip-host");
|
|
86
70
|
}
|
|
87
71
|
var SM = UIMotion;
|
|
88
72
|
var TIP_LAYOUT = { size: "morph", timing: UIMotion.t.layout };
|
|
@@ -115,14 +99,15 @@ function targetBox(size, t, want) {
|
|
|
115
99
|
placement: p
|
|
116
100
|
};
|
|
117
101
|
}
|
|
102
|
+
var surface = () => document.getElementById(TOOLTIP_DOM_ID);
|
|
118
103
|
var fromEdge = (p) => ({
|
|
119
104
|
x: p === "left" ? SM.dist.sm : p === "right" ? -SM.dist.sm : 0,
|
|
120
105
|
y: p === "top" ? SM.dist.sm : p === "bottom" ? -SM.dist.sm : 0
|
|
121
106
|
});
|
|
122
107
|
function Body({ a, width }) {
|
|
123
|
-
return /* @__PURE__ */ jsx("span", { className: "tooltip__body", style: width ? { width } : void 0, children: a.shortcut ? /* @__PURE__ */ jsxs("span", { className: "tooltip__row", children: [
|
|
108
|
+
return /* @__PURE__ */ jsx("span", { className: "zc-tooltip__body", style: width ? { width } : void 0, children: a.shortcut ? /* @__PURE__ */ jsxs("span", { className: "zc-tooltip__row", children: [
|
|
124
109
|
/* @__PURE__ */ jsx("span", { children: a.content }),
|
|
125
|
-
/* @__PURE__ */ jsx("kbd", { className: "tooltip__shortcut", children: a.shortcut })
|
|
110
|
+
/* @__PURE__ */ jsx("kbd", { className: "zc-tooltip__shortcut", children: a.shortcut })
|
|
126
111
|
] }) : a.content });
|
|
127
112
|
}
|
|
128
113
|
function TipSurface({ a, box }) {
|
|
@@ -132,7 +117,7 @@ function TipSurface({ a, box }) {
|
|
|
132
117
|
{
|
|
133
118
|
layout: true,
|
|
134
119
|
layoutTransition: TIP_LAYOUT,
|
|
135
|
-
className: "tooltip",
|
|
120
|
+
className: "zc-tooltip",
|
|
136
121
|
id: TOOLTIP_DOM_ID,
|
|
137
122
|
role: "tooltip",
|
|
138
123
|
"data-placement": box.placement,
|
|
@@ -152,36 +137,62 @@ function TipSurface({ a, box }) {
|
|
|
152
137
|
function TooltipHost() {
|
|
153
138
|
const active = useSyncExternalStore(store.subscribe, store.get);
|
|
154
139
|
const measureRef = useRef(null);
|
|
155
|
-
const
|
|
140
|
+
const drift = useRef({ x: 0, y: 0 });
|
|
141
|
+
const anchored = useRef({ x: 0, y: 0 });
|
|
142
|
+
const [shown, setShown] = useState(null);
|
|
156
143
|
useLayoutEffect(() => {
|
|
157
144
|
if (!active) {
|
|
158
|
-
|
|
159
|
-
return;
|
|
145
|
+
setShown(null);
|
|
146
|
+
return void 0;
|
|
160
147
|
}
|
|
161
|
-
const
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
148
|
+
const place = () => {
|
|
149
|
+
const anchor = active.anchor();
|
|
150
|
+
const measure = measureRef.current;
|
|
151
|
+
if (!anchor || !measure) return;
|
|
152
|
+
const bubble = measure.getBoundingClientRect();
|
|
153
|
+
const body = measure.firstChild.getBoundingClientRect();
|
|
154
|
+
const from = anchor.getBoundingClientRect();
|
|
155
|
+
if (!from.width && !from.height) return;
|
|
156
|
+
if (!surface()) drift.current = { x: 0, y: 0 };
|
|
157
|
+
anchored.current = { x: from.left, y: from.top };
|
|
158
|
+
const to = targetBox({ w: Math.ceil(bubble.width), h: Math.ceil(bubble.height) }, from, active.placement);
|
|
159
|
+
setShown({
|
|
160
|
+
a: active,
|
|
161
|
+
box: { ...to, x: to.x - drift.current.x, y: to.y - drift.current.y, bodyW: Math.ceil(body.width) }
|
|
162
|
+
});
|
|
163
|
+
};
|
|
164
|
+
const track = () => {
|
|
165
|
+
const el = surface();
|
|
166
|
+
const anchor = active.anchor();
|
|
167
|
+
if (!el || !anchor) return;
|
|
168
|
+
const now = anchor.getBoundingClientRect();
|
|
169
|
+
if (!now.width && !now.height) return;
|
|
170
|
+
const at = {
|
|
171
|
+
x: drift.current.x + now.left - anchored.current.x,
|
|
172
|
+
y: drift.current.y + now.top - anchored.current.y
|
|
173
|
+
};
|
|
174
|
+
drift.current = at;
|
|
175
|
+
anchored.current = { x: now.left, y: now.top };
|
|
176
|
+
el.style.transform = at.x || at.y ? `translate(${at.x}px, ${at.y}px)` : "";
|
|
177
|
+
};
|
|
170
178
|
const onKey = (e) => {
|
|
171
|
-
if (e.key === "Escape") store.
|
|
179
|
+
if (e.key === "Escape") store.dismiss();
|
|
172
180
|
};
|
|
173
|
-
|
|
181
|
+
place();
|
|
174
182
|
document.addEventListener("keydown", onKey);
|
|
175
|
-
window.addEventListener("scroll",
|
|
183
|
+
window.addEventListener("scroll", track, true);
|
|
184
|
+
window.addEventListener("resize", place);
|
|
176
185
|
return () => {
|
|
177
186
|
document.removeEventListener("keydown", onKey);
|
|
178
|
-
window.removeEventListener("scroll",
|
|
187
|
+
window.removeEventListener("scroll", track, true);
|
|
188
|
+
window.removeEventListener("resize", place);
|
|
179
189
|
};
|
|
180
190
|
}, [active]);
|
|
191
|
+
const orphaned = !!shown && !shown.a.anchor();
|
|
181
192
|
return createPortal(
|
|
182
193
|
/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
183
|
-
active && /* @__PURE__ */ jsx("div", { className: "tooltip tooltip--measure", ref: measureRef, "aria-hidden": "true", children: /* @__PURE__ */ jsx(Body, { a: active }) }),
|
|
184
|
-
/* @__PURE__ */ jsx(Presence, { children: active &&
|
|
194
|
+
active && /* @__PURE__ */ jsx("div", { className: "zc-tooltip zc-tooltip--measure", ref: measureRef, "aria-hidden": "true", children: /* @__PURE__ */ jsx(Body, { a: active }) }),
|
|
195
|
+
/* @__PURE__ */ jsx(Presence, { children: active && shown && !orphaned && /* @__PURE__ */ jsx(TipSurface, { a: shown.a, box: shown.box }, "tip") })
|
|
185
196
|
] }),
|
|
186
197
|
document.body
|
|
187
198
|
);
|
|
@@ -190,6 +201,9 @@ function Tooltip({
|
|
|
190
201
|
content,
|
|
191
202
|
shortcut = null,
|
|
192
203
|
placement = "top",
|
|
204
|
+
open: controlledOpen,
|
|
205
|
+
defaultOpen = false,
|
|
206
|
+
onOpenChange,
|
|
193
207
|
disabled = false,
|
|
194
208
|
openDelay = OPEN_DELAY,
|
|
195
209
|
closeDelay = CLOSE_GRACE,
|
|
@@ -199,34 +213,42 @@ function Tooltip({
|
|
|
199
213
|
}) {
|
|
200
214
|
const wrapRef = useRef(null);
|
|
201
215
|
const openTimer = useRef(0);
|
|
202
|
-
const
|
|
216
|
+
const autoId = useId();
|
|
217
|
+
const myId = id || "tip-" + autoId;
|
|
203
218
|
const isHost = useHostElection();
|
|
204
|
-
const
|
|
219
|
+
const { isPresent } = usePresence();
|
|
220
|
+
const [open, setOpen] = useControllable(controlledOpen, defaultOpen, onOpenChange);
|
|
221
|
+
useEffect(() => {
|
|
222
|
+
if (!open || disabled || !isPresent) return void 0;
|
|
223
|
+
store.open({
|
|
224
|
+
id: myId,
|
|
225
|
+
content,
|
|
226
|
+
shortcut,
|
|
227
|
+
placement,
|
|
228
|
+
anchor: () => wrapRef.current?.firstElementChild ?? null,
|
|
229
|
+
dismiss: () => setOpen(false)
|
|
230
|
+
});
|
|
231
|
+
return () => store.close(myId, closeDelay);
|
|
232
|
+
}, [open, disabled, isPresent, content, shortcut, placement, closeDelay, myId, setOpen]);
|
|
233
|
+
useEffect(() => {
|
|
234
|
+
if (!isPresent) store.close(myId, 0);
|
|
235
|
+
}, [isPresent, myId]);
|
|
205
236
|
useEffect(
|
|
206
237
|
() => () => {
|
|
207
238
|
clearTimeout(openTimer.current);
|
|
208
239
|
store.close(myId, 0);
|
|
209
240
|
},
|
|
210
|
-
[]
|
|
241
|
+
[myId]
|
|
211
242
|
);
|
|
212
243
|
function show(immediate) {
|
|
213
|
-
if (disabled) return;
|
|
214
244
|
clearTimeout(openTimer.current);
|
|
215
|
-
if (!
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
content,
|
|
219
|
-
shortcut,
|
|
220
|
-
placement,
|
|
221
|
-
anchor: anchorEl,
|
|
222
|
-
rect: () => anchorEl().getBoundingClientRect()
|
|
223
|
-
});
|
|
224
|
-
if (immediate || store.isWarm()) open();
|
|
225
|
-
else openTimer.current = setTimeout(open, openDelay);
|
|
245
|
+
if (disabled || !wrapRef.current?.firstElementChild) return;
|
|
246
|
+
if (immediate || store.isWarm()) setOpen(true);
|
|
247
|
+
else openTimer.current = setTimeout(() => setOpen(true), openDelay);
|
|
226
248
|
}
|
|
227
249
|
function hide() {
|
|
228
250
|
clearTimeout(openTimer.current);
|
|
229
|
-
|
|
251
|
+
setOpen(false);
|
|
230
252
|
}
|
|
231
253
|
const onEnter = (e) => {
|
|
232
254
|
if (e.pointerType !== "touch") show(false);
|
|
@@ -240,7 +262,7 @@ function Tooltip({
|
|
|
240
262
|
{
|
|
241
263
|
...htmlProps,
|
|
242
264
|
ref: wrapRef,
|
|
243
|
-
className: cx("tooltip-anchor", htmlProps?.className),
|
|
265
|
+
className: cx("zc-tooltip-anchor", htmlProps?.className),
|
|
244
266
|
onPointerEnter: onEnter,
|
|
245
267
|
onPointerLeave: hide,
|
|
246
268
|
onPointerDown: hide,
|