@zyncat/ui 0.13.1 → 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 +135 -23
- 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
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
Group: date-time
|
|
4
4
|
Docs: https://ui.zyncat.app/tabs
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
Underline tabs or a segmented pill; the ink reaches then releases; panels enter from the side you moved toward.
|
|
7
7
|
|
|
8
|
-
items: TabItem[]; value/onChange(value, dir).
|
|
8
|
+
items: TabItem[]; value/onChange(value, dir). variant underline|pill - the pill track hugs its tabs rather than
|
|
9
|
+
filling the row, and drops the hairline; the motion is identical in both. Pair with <TabPanel name tab dir>.
|
|
9
10
|
|
|
10
11
|
```tsx
|
|
11
12
|
<Tabs name="views" ariaLabel="Workspace views" value={view} onChange={(v, d) => { setView(v); setDir(d); }} items={items} />
|
|
@@ -1,31 +1,14 @@
|
|
|
1
1
|
@layer 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
|
+
/* The pill variant's segment radius. The track rounds one pad wider, staying concentric. */
|
|
8
|
+
--tabs-pill-radius: var(--radius-md);
|
|
26
9
|
position: relative;
|
|
27
10
|
}
|
|
28
|
-
.tabs::after {
|
|
11
|
+
.zc-tabs::after {
|
|
29
12
|
content: '';
|
|
30
13
|
position: absolute;
|
|
31
14
|
inset-inline: 0;
|
|
@@ -34,13 +17,7 @@
|
|
|
34
17
|
background: var(--border-default);
|
|
35
18
|
}
|
|
36
19
|
|
|
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 {
|
|
20
|
+
.zc-tabs__list {
|
|
44
21
|
position: relative;
|
|
45
22
|
z-index: 1;
|
|
46
23
|
display: flex;
|
|
@@ -49,6 +26,9 @@
|
|
|
49
26
|
scrollbar-width: none;
|
|
50
27
|
margin-inline: calc(var(--space-2) * -1);
|
|
51
28
|
padding-inline: var(--space-2);
|
|
29
|
+
margin-block: calc(var(--ring-width) * -1);
|
|
30
|
+
padding-block: var(--ring-width);
|
|
31
|
+
scroll-padding: var(--ring-width);
|
|
52
32
|
|
|
53
33
|
--tabs-fade-start: 0px;
|
|
54
34
|
--tabs-fade-end: 0px;
|
|
@@ -60,22 +40,17 @@
|
|
|
60
40
|
transparent
|
|
61
41
|
);
|
|
62
42
|
}
|
|
63
|
-
.tabs__list::-webkit-scrollbar {
|
|
43
|
+
.zc-tabs__list::-webkit-scrollbar {
|
|
64
44
|
display: none;
|
|
65
45
|
}
|
|
66
|
-
.tabs__list[data-fade~='start'] {
|
|
46
|
+
.zc-tabs__list[data-fade~='start'] {
|
|
67
47
|
--tabs-fade-start: var(--space-8);
|
|
68
48
|
}
|
|
69
|
-
.tabs__list[data-fade~='end'] {
|
|
49
|
+
.zc-tabs__list[data-fade~='end'] {
|
|
70
50
|
--tabs-fade-end: var(--space-8);
|
|
71
51
|
}
|
|
72
52
|
|
|
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 {
|
|
53
|
+
.zc-tab {
|
|
79
54
|
appearance: none;
|
|
80
55
|
border: 0;
|
|
81
56
|
background: none;
|
|
@@ -83,21 +58,20 @@
|
|
|
83
58
|
padding: 0 0 calc(var(--tabs-ink-h) + var(--space-px));
|
|
84
59
|
flex: none;
|
|
85
60
|
display: block;
|
|
86
|
-
font-family: var(--font-
|
|
61
|
+
font-family: var(--font-body);
|
|
87
62
|
cursor: pointer;
|
|
88
63
|
-webkit-tap-highlight-color: transparent;
|
|
89
64
|
}
|
|
90
|
-
.tab:focus-visible {
|
|
65
|
+
.zc-tab:focus-visible {
|
|
91
66
|
outline: none;
|
|
92
67
|
}
|
|
93
68
|
|
|
94
|
-
.tab__pad {
|
|
95
|
-
position: relative; /*
|
|
96
|
-
pill (z-index 0, first child of the list) */
|
|
69
|
+
.zc-tab__pad {
|
|
70
|
+
position: relative; /* paints above the glide pill, the list's absolute z-index 0 first child */
|
|
97
71
|
display: flex;
|
|
98
72
|
align-items: center;
|
|
99
73
|
gap: var(--space-2);
|
|
100
|
-
height: var(--control-height-sm);
|
|
74
|
+
height: var(--control-height-sm);
|
|
101
75
|
padding-inline: var(--space-2);
|
|
102
76
|
border-radius: var(--radius-md);
|
|
103
77
|
font: var(--type-micro);
|
|
@@ -107,38 +81,34 @@
|
|
|
107
81
|
transition:
|
|
108
82
|
var(--transition-control),
|
|
109
83
|
transform var(--duration-fast) var(--ease-standard);
|
|
84
|
+
outline: var(--ring-rest);
|
|
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:focus-visible .tab__pad {
|
|
130
|
-
|
|
100
|
+
.zc-tab:focus-visible .zc-tab__pad {
|
|
101
|
+
outline: var(--ring-accent);
|
|
131
102
|
}
|
|
132
|
-
.tab:disabled {
|
|
103
|
+
.zc-tab:disabled {
|
|
133
104
|
cursor: not-allowed;
|
|
134
105
|
}
|
|
135
|
-
.tab:disabled .tab__pad {
|
|
106
|
+
.zc-tab:disabled .zc-tab__pad {
|
|
136
107
|
color: var(--text-disabled);
|
|
137
108
|
}
|
|
138
109
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
font-family: var(--font-mono);
|
|
110
|
+
.zc-tab__count {
|
|
111
|
+
font-family: var(--font-code);
|
|
142
112
|
font-size: var(--size-micro);
|
|
143
113
|
line-height: 1;
|
|
144
114
|
font-variant-numeric: tabular-nums;
|
|
@@ -148,21 +118,16 @@
|
|
|
148
118
|
border-radius: var(--radius-sm);
|
|
149
119
|
transition: var(--transition-colors);
|
|
150
120
|
}
|
|
151
|
-
.tab.is-selected .tab__count {
|
|
121
|
+
.zc-tab.zc-is-selected .zc-tab__count {
|
|
152
122
|
color: var(--text-accent);
|
|
153
123
|
background: var(--accent-wash);
|
|
154
124
|
}
|
|
155
|
-
.tab:disabled .tab__count {
|
|
125
|
+
.zc-tab:disabled .zc-tab__count {
|
|
156
126
|
color: var(--text-disabled);
|
|
157
127
|
background: var(--bg-subtle);
|
|
158
128
|
}
|
|
159
129
|
|
|
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 {
|
|
130
|
+
.zc-tab__hover {
|
|
166
131
|
opacity: 0;
|
|
167
132
|
position: absolute;
|
|
168
133
|
top: 0;
|
|
@@ -174,18 +139,10 @@
|
|
|
174
139
|
will-change: transform, opacity;
|
|
175
140
|
}
|
|
176
141
|
|
|
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 {
|
|
142
|
+
.zc-tabs__ink {
|
|
186
143
|
position: absolute;
|
|
187
144
|
left: 0;
|
|
188
|
-
bottom:
|
|
145
|
+
bottom: var(--ring-width);
|
|
189
146
|
height: var(--tabs-ink-h);
|
|
190
147
|
border-radius: var(--radius-full);
|
|
191
148
|
background: var(--accent);
|
|
@@ -193,23 +150,58 @@
|
|
|
193
150
|
will-change: transform, width;
|
|
194
151
|
}
|
|
195
152
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
.
|
|
153
|
+
.zc-tabs--pill {
|
|
154
|
+
display: flex;
|
|
155
|
+
width: fit-content;
|
|
156
|
+
max-width: 100%;
|
|
157
|
+
padding: var(--space-1);
|
|
158
|
+
border-radius: calc(var(--tabs-pill-radius) + var(--space-1));
|
|
159
|
+
background: var(--bg-inset);
|
|
160
|
+
}
|
|
161
|
+
.zc-tabs--pill::after {
|
|
162
|
+
content: none;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.zc-tabs--pill .zc-tabs__list {
|
|
166
|
+
min-width: 0;
|
|
167
|
+
margin: calc(var(--space-1) * -1);
|
|
168
|
+
padding: var(--space-1);
|
|
169
|
+
border-radius: calc(var(--tabs-pill-radius) + var(--space-1));
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.zc-tabs--pill .zc-tab {
|
|
173
|
+
padding: 0;
|
|
174
|
+
}
|
|
175
|
+
.zc-tabs--pill .zc-tab__pad {
|
|
176
|
+
z-index: 1;
|
|
177
|
+
border-radius: var(--tabs-pill-radius);
|
|
178
|
+
}
|
|
179
|
+
.zc-tabs--pill .zc-tab:active:not(:disabled) .zc-tab__pad {
|
|
180
|
+
transform: none;
|
|
181
|
+
}
|
|
182
|
+
.zc-tabs--pill .zc-tab__count {
|
|
183
|
+
background: var(--bg-subtle);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.zc-tabs--pill .zc-tabs__ink {
|
|
187
|
+
top: var(--space-1);
|
|
188
|
+
bottom: auto;
|
|
189
|
+
height: var(--control-height-sm);
|
|
190
|
+
border-radius: var(--tabs-pill-radius);
|
|
191
|
+
background: var(--bg-surface);
|
|
192
|
+
box-shadow: var(--shadow-xs);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.zc-tab-panel {
|
|
205
196
|
outline: none;
|
|
206
197
|
overflow: hidden;
|
|
207
198
|
}
|
|
208
|
-
.tab-panel:focus-visible {
|
|
209
|
-
|
|
199
|
+
.zc-tab-panel:focus-visible {
|
|
200
|
+
outline: var(--ring-accent);
|
|
201
|
+
outline-offset: var(--ring-inset);
|
|
210
202
|
border-radius: var(--radius-md);
|
|
211
203
|
}
|
|
212
|
-
.tab-panel__inner {
|
|
204
|
+
.zc-tab-panel__inner {
|
|
213
205
|
will-change: transform, opacity;
|
|
214
206
|
}
|
|
215
207
|
}
|
|
@@ -26,6 +26,7 @@ import { Presence } from '../../../motion/presence';
|
|
|
26
26
|
import { popOut } from '../../../motion/presets';
|
|
27
27
|
import { UIMotion } from '../../../tokens/motion-tokens';
|
|
28
28
|
import { fireGlint } from '../../internal/glass/glint';
|
|
29
|
+
import { hostRegistry, useElectedHost } from '../../internal/hooks/use-host-election';
|
|
29
30
|
import { Icon, type IconName } from '../../internal/icon/Icon';
|
|
30
31
|
import { cx } from '../../internal/utils/cx';
|
|
31
32
|
import { tokenPx } from '../../internal/utils/token-px';
|
|
@@ -34,6 +35,7 @@ import { DEFAULT_TOASTER_CONFIG, UIToast, type ToasterConfig, type ToastRecord,
|
|
|
34
35
|
|
|
35
36
|
const SM = UIMotion;
|
|
36
37
|
const store = UIToast;
|
|
38
|
+
const toasterReg = hostRegistry('toast.host@1');
|
|
37
39
|
|
|
38
40
|
const COLLAPSE_GRACE = 140;
|
|
39
41
|
const SWIPE_X = 64;
|
|
@@ -162,7 +164,7 @@ function ToastItem({
|
|
|
162
164
|
as="li"
|
|
163
165
|
ref={ref}
|
|
164
166
|
exit={popOut(SM.scale.floating, SM.t.exit)}
|
|
165
|
-
className="toast glass"
|
|
167
|
+
className="zc-toast zc-glass"
|
|
166
168
|
data-tone={t.tone}
|
|
167
169
|
data-behind={behind ? '' : undefined}
|
|
168
170
|
role={t.tone === 'danger' ? 'alert' : 'status'}
|
|
@@ -172,30 +174,30 @@ function ToastItem({
|
|
|
172
174
|
if (e.key === 'Escape' && t.dismissible) store.dismiss(t.id);
|
|
173
175
|
}}
|
|
174
176
|
>
|
|
175
|
-
{t.node ? <div className="toast__custom">{t.node as ReactNode}</div> : <ToastBody t={t} />}
|
|
177
|
+
{t.node ? <div className="zc-toast__custom">{t.node as ReactNode}</div> : <ToastBody t={t} />}
|
|
176
178
|
</Motion>
|
|
177
179
|
);
|
|
178
180
|
}
|
|
179
181
|
|
|
180
182
|
function ToastBody({ t }: { t: ToastRecord }) {
|
|
181
183
|
return (
|
|
182
|
-
<div className="toast__inner">
|
|
184
|
+
<div className="zc-toast__inner">
|
|
183
185
|
{(t.tone !== 'default' || isFinite(t.duration)) && (
|
|
184
|
-
<span className="toast__icon">
|
|
186
|
+
<span className="zc-toast__icon">
|
|
185
187
|
{t.tone !== 'default' && (
|
|
186
|
-
<Motion as="span" className="toast__icon-glyph" animate={GLYPH_POP} deps={[t.tone]}>
|
|
188
|
+
<Motion as="span" className="zc-toast__icon-glyph" animate={GLYPH_POP} deps={[t.tone]}>
|
|
187
189
|
{t.tone === 'loading' ? (
|
|
188
|
-
<span className="toast__spinner" aria-hidden="true"></span>
|
|
190
|
+
<span className="zc-toast__spinner" aria-hidden="true"></span>
|
|
189
191
|
) : (
|
|
190
192
|
<Icon name={TONE_ICON[t.tone] || 'info'} weight="fill" />
|
|
191
193
|
)}
|
|
192
194
|
</Motion>
|
|
193
195
|
)}
|
|
194
196
|
{isFinite(t.duration) && (
|
|
195
|
-
<svg key={'ring-' + t.timerKey} className="toast__ring" viewBox="0 0 36 36" aria-hidden="true">
|
|
196
|
-
<circle className="toast__ring-track" cx="18" cy="18" r="16.5"></circle>
|
|
197
|
+
<svg key={'ring-' + t.timerKey} className="zc-toast__ring" viewBox="0 0 36 36" aria-hidden="true">
|
|
198
|
+
<circle className="zc-toast__ring-track" cx="18" cy="18" r="16.5"></circle>
|
|
197
199
|
<circle
|
|
198
|
-
className="toast__ring-arc"
|
|
200
|
+
className="zc-toast__ring-arc"
|
|
199
201
|
cx="18"
|
|
200
202
|
cy="18"
|
|
201
203
|
r="16.5"
|
|
@@ -206,12 +208,12 @@ function ToastBody({ t }: { t: ToastRecord }) {
|
|
|
206
208
|
)}
|
|
207
209
|
</span>
|
|
208
210
|
)}
|
|
209
|
-
<Motion className="toast__text" animate={TEXT_FADE} deps={[String(t.message) + '-' + String(t.description)]}>
|
|
210
|
-
<p className="toast__message">{t.message}</p>
|
|
211
|
-
{t.description != null && <p className="toast__desc">{t.description}</p>}
|
|
211
|
+
<Motion className="zc-toast__text" animate={TEXT_FADE} deps={[String(t.message) + '-' + String(t.description)]}>
|
|
212
|
+
<p className="zc-toast__message">{t.message}</p>
|
|
213
|
+
{t.description != null && <p className="zc-toast__desc">{t.description}</p>}
|
|
212
214
|
</Motion>
|
|
213
215
|
{t.count > 1 && (
|
|
214
|
-
<Motion as="span" className="toast__count" animate={COUNT_POP} deps={[t.count]}>
|
|
216
|
+
<Motion as="span" className="zc-toast__count" animate={COUNT_POP} deps={[t.count]}>
|
|
215
217
|
×{t.count}
|
|
216
218
|
</Motion>
|
|
217
219
|
)}
|
|
@@ -219,7 +221,7 @@ function ToastBody({ t }: { t: ToastRecord }) {
|
|
|
219
221
|
<Button
|
|
220
222
|
variant="secondary"
|
|
221
223
|
size="sm"
|
|
222
|
-
className="toast__action"
|
|
224
|
+
className="zc-toast__action"
|
|
223
225
|
onClick={() => {
|
|
224
226
|
if (t.action.onClick) t.action.onClick();
|
|
225
227
|
store.dismiss(t.id);
|
|
@@ -229,7 +231,7 @@ function ToastBody({ t }: { t: ToastRecord }) {
|
|
|
229
231
|
</Button>
|
|
230
232
|
)}
|
|
231
233
|
{t.dismissible && (
|
|
232
|
-
<button type="button" className="toast__close" aria-label="Dismiss" onClick={() => store.dismiss(t.id)}>
|
|
234
|
+
<button type="button" className="zc-toast__close" aria-label="Dismiss" onClick={() => store.dismiss(t.id)}>
|
|
233
235
|
<Icon name="close" size="sm" />
|
|
234
236
|
</button>
|
|
235
237
|
)}
|
|
@@ -299,7 +301,7 @@ function ToastHost({ config, htmlProps }: { config: ToasterConfig; htmlProps?: H
|
|
|
299
301
|
return createPortal(
|
|
300
302
|
<ol
|
|
301
303
|
{...htmlProps}
|
|
302
|
-
className={cx('toast-viewport', paused && 'is-paused', htmlProps?.className)}
|
|
304
|
+
className={cx('zc-toast-viewport', paused && 'zc-is-paused', htmlProps?.className)}
|
|
303
305
|
data-position={config.position}
|
|
304
306
|
style={
|
|
305
307
|
config.offset
|
|
@@ -359,18 +361,21 @@ export interface ToasterProps extends Partial<ToasterConfig> {
|
|
|
359
361
|
htmlProps?: HTMLAttributes<HTMLOListElement> & DataAttributes;
|
|
360
362
|
}
|
|
361
363
|
|
|
362
|
-
export function Toaster({ htmlProps, ...props }: ToasterProps): ReactElement {
|
|
364
|
+
export function Toaster({ htmlProps, ...props }: ToasterProps): ReactElement | null {
|
|
363
365
|
const config: ToasterConfig = { ...DEFAULT_TOASTER_CONFIG, ...stripUndefined(props) };
|
|
366
|
+
const isHost = useElectedHost(toasterReg, 'toaster');
|
|
364
367
|
|
|
365
368
|
useEffect(() => {
|
|
369
|
+
if (!isHost) return undefined;
|
|
366
370
|
store.config = config;
|
|
367
371
|
store.mounted = true;
|
|
368
372
|
if (config.expand) store.setExpanded(true);
|
|
369
373
|
return () => {
|
|
370
374
|
store.mounted = false;
|
|
371
375
|
};
|
|
372
|
-
}, [config.position, config.duration, config.visibleToasts, config.gap, config.offset, config.expand]);
|
|
376
|
+
}, [isHost, config.position, config.duration, config.visibleToasts, config.gap, config.offset, config.expand]);
|
|
373
377
|
|
|
378
|
+
if (!isHost) return null;
|
|
374
379
|
return <ToastHost config={config} htmlProps={htmlProps} />;
|
|
375
380
|
}
|
|
376
381
|
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { sharedSlot } from '../../../shared-slot';
|
|
2
|
+
|
|
1
3
|
export type ToastTone = 'default' | 'success' | 'danger' | 'warning' | 'info' | 'loading' | 'custom';
|
|
2
4
|
|
|
3
5
|
export interface ToastAction {
|
|
@@ -62,8 +64,8 @@ const DURATION: Record<string, number> = {
|
|
|
62
64
|
loading: Infinity,
|
|
63
65
|
};
|
|
64
66
|
|
|
65
|
-
|
|
66
|
-
const timers = new Map<string, ReturnType<typeof setTimeout>>();
|
|
67
|
+
const ids = sharedSlot('toast.ids@1', () => ({ n: 0 }));
|
|
68
|
+
const timers = sharedSlot('toast.timers@1', () => new Map<string, ReturnType<typeof setTimeout>>());
|
|
67
69
|
|
|
68
70
|
interface ToastStore {
|
|
69
71
|
toasts: ToastRecord[];
|
|
@@ -85,7 +87,7 @@ interface ToastStore {
|
|
|
85
87
|
setExpanded(v: boolean): void;
|
|
86
88
|
}
|
|
87
89
|
|
|
88
|
-
const store: ToastStore = {
|
|
90
|
+
const store: ToastStore = sharedSlot('toast.store@1', (): ToastStore => ({
|
|
89
91
|
toasts: [],
|
|
90
92
|
paused: false,
|
|
91
93
|
expanded: false,
|
|
@@ -174,7 +176,7 @@ const store: ToastStore = {
|
|
|
174
176
|
store.expanded = v;
|
|
175
177
|
store.emit();
|
|
176
178
|
},
|
|
177
|
-
};
|
|
179
|
+
}));
|
|
178
180
|
|
|
179
181
|
let warned = false;
|
|
180
182
|
let warnScheduled = false;
|
|
@@ -201,7 +203,7 @@ function resolveDuration(tone: ToastTone, opt?: number): number {
|
|
|
201
203
|
|
|
202
204
|
function make(tone: ToastTone, message: string | null, opts: ToastOptions = {}): string {
|
|
203
205
|
warnIfDetached();
|
|
204
|
-
const id = opts.id != null ? String(opts.id) : 'toast-' + ++
|
|
206
|
+
const id = opts.id != null ? String(opts.id) : 'toast-' + ++ids.n;
|
|
205
207
|
const duration = resolveDuration(tone, opts.duration);
|
|
206
208
|
if (store.toasts.some((t) => t.id === id)) {
|
|
207
209
|
return store.update(id, {
|
|
@@ -273,7 +275,7 @@ toast.promise = function <T>(promise: Promise<T>, msgs: ToastPromiseMsgs<T> = {}
|
|
|
273
275
|
|
|
274
276
|
toast.custom = (node, opts = {}) => {
|
|
275
277
|
warnIfDetached();
|
|
276
|
-
const id = opts.id != null ? String(opts.id) : 'toast-' + ++
|
|
278
|
+
const id = opts.id != null ? String(opts.id) : 'toast-' + ++ids.n;
|
|
277
279
|
const duration = opts.duration != null ? opts.duration : Infinity;
|
|
278
280
|
if (store.toasts.some((t) => t.id === id)) return store.update(id, { node });
|
|
279
281
|
return store.add({
|