@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
|
@@ -1,63 +1,72 @@
|
|
|
1
1
|
@layer zyncat.tokens, zyncat.components;
|
|
2
2
|
|
|
3
3
|
@layer zyncat.components {
|
|
4
|
-
|
|
5
|
-
group dividers and the row states a listbox has no use for. */
|
|
6
|
-
|
|
7
|
-
.dropdown__menu {
|
|
4
|
+
.zc-dropdown__menu {
|
|
8
5
|
--menu-max-width: min(20rem, 92vw);
|
|
9
6
|
--menu-max-height: min(26rem, 70vh);
|
|
10
7
|
min-width: 11rem;
|
|
11
8
|
}
|
|
12
9
|
|
|
13
|
-
.dropdown__menu[data-danger-active='true'] {
|
|
10
|
+
.zc-dropdown__menu[data-danger-active='true'] {
|
|
14
11
|
--menu-glide-fill: var(--danger-wash);
|
|
12
|
+
--menu-glide-rail: var(--danger);
|
|
15
13
|
}
|
|
16
14
|
|
|
17
|
-
.dropdown__group + .dropdown__group {
|
|
15
|
+
.zc-dropdown__group + .zc-dropdown__group {
|
|
18
16
|
border-top: var(--border-hairline) solid var(--border-subtle);
|
|
19
17
|
margin-top: var(--space-1);
|
|
20
18
|
padding-top: var(--space-1);
|
|
21
19
|
}
|
|
22
20
|
|
|
23
|
-
.dropdown__item {
|
|
21
|
+
.zc-dropdown__item {
|
|
24
22
|
transition: color var(--duration-fast) var(--ease-standard);
|
|
25
23
|
}
|
|
26
|
-
.dropdown__item[data-active='true'] {
|
|
27
|
-
color: var(--text-strong);
|
|
24
|
+
.zc-dropdown__item[data-active='true'] {
|
|
25
|
+
color: var(--menu-active-ink, var(--text-strong));
|
|
28
26
|
}
|
|
29
27
|
|
|
30
|
-
.dropdown__item[data-danger='true'],
|
|
31
|
-
.dropdown__item[data-danger='true'][data-active='true'] {
|
|
28
|
+
.zc-dropdown__item[data-danger='true'],
|
|
29
|
+
.zc-dropdown__item[data-danger='true'][data-active='true'] {
|
|
32
30
|
color: var(--danger-text);
|
|
33
31
|
}
|
|
34
|
-
.dropdown__item[data-danger='true'] .menu-row__icon {
|
|
32
|
+
.zc-dropdown__item[data-danger='true'] .zc-menu-row__icon {
|
|
35
33
|
color: var(--danger);
|
|
36
34
|
}
|
|
37
35
|
|
|
38
|
-
.dropdown__item
|
|
39
|
-
|
|
40
|
-
color: var(--text-
|
|
36
|
+
.zc-dropdown__item-caret {
|
|
37
|
+
flex: 0 0 auto;
|
|
38
|
+
color: var(--text-subtle);
|
|
41
39
|
}
|
|
42
|
-
.dropdown__item[data-
|
|
43
|
-
.dropdown__item[data-
|
|
44
|
-
|
|
45
|
-
.dropdown__item[data-disabled='true'] .dropdown__item-caret {
|
|
46
|
-
color: var(--text-disabled);
|
|
40
|
+
.zc-dropdown__item[data-active='true'] .zc-menu-row__icon,
|
|
41
|
+
.zc-dropdown__item[data-active='true'] .zc-dropdown__item-caret {
|
|
42
|
+
color: var(--menu-active-icon, var(--text-body));
|
|
47
43
|
}
|
|
48
44
|
|
|
49
|
-
.dropdown__item-
|
|
45
|
+
.zc-dropdown__item-check {
|
|
50
46
|
flex: 0 0 auto;
|
|
51
|
-
color: var(--
|
|
47
|
+
color: var(--accent);
|
|
52
48
|
}
|
|
53
|
-
.dropdown__item[data-
|
|
54
|
-
.dropdown__item[data-
|
|
55
|
-
color: var(--text-
|
|
49
|
+
.zc-dropdown__item[data-selected='true'] .zc-menu-row__label,
|
|
50
|
+
.zc-dropdown__item[data-selected='true'] .zc-menu-row__icon {
|
|
51
|
+
color: var(--text-accent);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.zc-dropdown__item[data-disabled='true'] {
|
|
55
|
+
cursor: not-allowed;
|
|
56
|
+
color: var(--text-disabled);
|
|
57
|
+
}
|
|
58
|
+
.zc-dropdown__item[data-disabled='true'] .zc-menu-row__icon,
|
|
59
|
+
.zc-dropdown__item[data-disabled='true'] .zc-menu-row__label,
|
|
60
|
+
.zc-dropdown__item[data-disabled='true'] .zc-dropdown__item-check,
|
|
61
|
+
.zc-dropdown__item[data-disabled='true'] .zc-dropdown__item-shortcut,
|
|
62
|
+
.zc-dropdown__item[data-disabled='true'] .zc-menu-row__desc,
|
|
63
|
+
.zc-dropdown__item[data-disabled='true'] .zc-dropdown__item-caret {
|
|
64
|
+
color: var(--text-disabled);
|
|
56
65
|
}
|
|
57
66
|
|
|
58
|
-
.dropdown__item-shortcut {
|
|
67
|
+
.zc-dropdown__item-shortcut {
|
|
59
68
|
flex: 0 0 auto;
|
|
60
|
-
font: var(--type-
|
|
69
|
+
font: var(--type-code);
|
|
61
70
|
font-variant-numeric: tabular-nums;
|
|
62
71
|
color: var(--text-subtle);
|
|
63
72
|
padding-left: var(--space-2);
|
|
@@ -9,22 +9,25 @@ import { useMotion, type MotionSpecs } from '../../../motion/use-motion';
|
|
|
9
9
|
import { edgeEnabled, matchPrefix, stepEnabled } from '../../internal/collection/collection';
|
|
10
10
|
import { useTypeahead } from '../../internal/hooks/use-typeahead';
|
|
11
11
|
import { Icon } from '../../internal/icon/Icon';
|
|
12
|
+
import { menuHighlightAttrs } from '../../internal/menu/highlight';
|
|
12
13
|
import { MenuRow } from '../../internal/menu/menu-row';
|
|
13
14
|
import { useReturnFocus } from '../../internal/overlay/focus';
|
|
14
15
|
import { useOutsidePress, useOverlayEntry } from '../../internal/overlay/layer';
|
|
15
16
|
import { useAnchorPosition } from '../../internal/overlay/position';
|
|
16
17
|
import { activationProps } from '../../internal/utils/activation';
|
|
17
18
|
import { cx } from '../../internal/utils/cx';
|
|
18
|
-
import { itemText, levelKey, normalize,
|
|
19
|
+
import { itemText, levelKey, normalize, opensLevel, popupOf, type DropdownItem, type MenuChain } from './types';
|
|
19
20
|
|
|
20
21
|
const SUBMENU_OPEN_DELAY = 90;
|
|
21
22
|
const SUBMENU_TRAVEL_GRACE = 500;
|
|
22
23
|
const MENU_KEYS = new Set('ArrowDown ArrowUp ArrowLeft ArrowRight Home End Enter Escape Tab'.split(' ').concat(' '));
|
|
24
|
+
const CONTENT_KEYS = new Set(['Escape', 'ArrowLeft', 'Tab']);
|
|
25
|
+
const TEXT_FIELD = 'input, textarea, [contenteditable]';
|
|
23
26
|
|
|
24
27
|
type Point = { x: number; y: number };
|
|
25
28
|
|
|
26
|
-
|
|
27
|
-
|
|
29
|
+
const inTextField = (target: EventTarget | null) => target instanceof Element && target.closest(TEXT_FIELD) != null;
|
|
30
|
+
|
|
28
31
|
function headingTo(point: Point, from: Point, panel: HTMLElement): boolean {
|
|
29
32
|
const box = panel.getBoundingClientRect();
|
|
30
33
|
const rightward = from.x <= box.left;
|
|
@@ -39,6 +42,7 @@ export function MenuPanel({ chain, depth, ...motion }: { chain: MenuChain; depth
|
|
|
39
42
|
const { levels, hoverDepth, refFor } = chain;
|
|
40
43
|
const [level, next, parent] = [levels[depth], levels[depth + 1], levels[depth - 1]];
|
|
41
44
|
const nested = Boolean(parent);
|
|
45
|
+
const contentLevel = level.content != null;
|
|
42
46
|
|
|
43
47
|
const panelId = (d: number) =>
|
|
44
48
|
d === 0 ? chain.menuId : chain.menuId + '-' + d + '-' + encodeURIComponent(levels[d].owner!.id);
|
|
@@ -80,7 +84,9 @@ export function MenuPanel({ chain, depth, ...motion }: { chain: MenuChain; depth
|
|
|
80
84
|
}, [activeIdx]);
|
|
81
85
|
|
|
82
86
|
useLayoutEffect(() => {
|
|
83
|
-
if (seed
|
|
87
|
+
if (seed === 'none') return;
|
|
88
|
+
if (contentLevel) panelRef.current?.focus();
|
|
89
|
+
else setActiveIdx(edgeEnabled(flat, seed === 'last'));
|
|
84
90
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
85
91
|
}, [seed]);
|
|
86
92
|
|
|
@@ -95,7 +101,7 @@ export function MenuPanel({ chain, depth, ...motion }: { chain: MenuChain; depth
|
|
|
95
101
|
function armOpen(i: number) {
|
|
96
102
|
clearTimeout(timers.current.open);
|
|
97
103
|
const item = flat[i];
|
|
98
|
-
if (!item || item.disabled || item.id === openSubId || !
|
|
104
|
+
if (!item || item.disabled || item.id === openSubId || !opensLevel(item)) return;
|
|
99
105
|
timers.current.open = setTimeout(() => chain.openSub(depth, item, 'none'), SUBMENU_OPEN_DELAY);
|
|
100
106
|
}
|
|
101
107
|
|
|
@@ -123,7 +129,7 @@ export function MenuPanel({ chain, depth, ...motion }: { chain: MenuChain; depth
|
|
|
123
129
|
|
|
124
130
|
function commit(item: DropdownItem | undefined) {
|
|
125
131
|
if (!item || item.disabled) return;
|
|
126
|
-
if (
|
|
132
|
+
if (opensLevel(item)) chain.openSub(depth, item, 'first');
|
|
127
133
|
else chain.select(item);
|
|
128
134
|
}
|
|
129
135
|
|
|
@@ -155,7 +161,7 @@ export function MenuPanel({ chain, depth, ...motion }: { chain: MenuChain; depth
|
|
|
155
161
|
}
|
|
156
162
|
e.preventDefault();
|
|
157
163
|
const back = () => (openSubId != null ? closeSub() : cancel());
|
|
158
|
-
const opens = activeItem && !activeItem.disabled &&
|
|
164
|
+
const opens = activeItem && !activeItem.disabled && opensLevel(activeItem);
|
|
159
165
|
switch (e.key) {
|
|
160
166
|
case 'ArrowDown':
|
|
161
167
|
return moveTo(stepEnabled(flat, activeIdx, 1));
|
|
@@ -178,24 +184,36 @@ export function MenuPanel({ chain, depth, ...motion }: { chain: MenuChain; depth
|
|
|
178
184
|
}
|
|
179
185
|
}
|
|
180
186
|
|
|
187
|
+
function onContentKeyDown(e: KeyboardEvent<HTMLDivElement>) {
|
|
188
|
+
if (!CONTENT_KEYS.has(e.key) || e.defaultPrevented) return;
|
|
189
|
+
if (e.key === 'ArrowLeft' && inTextField(e.target)) return;
|
|
190
|
+
e.preventDefault();
|
|
191
|
+
e.stopPropagation();
|
|
192
|
+
if (e.key === 'Tab') chain.dismiss(true);
|
|
193
|
+
else cancel();
|
|
194
|
+
}
|
|
195
|
+
|
|
181
196
|
function renderRow(item: DropdownItem) {
|
|
182
197
|
const i = indexOf.get(item.id) ?? -1;
|
|
183
|
-
const
|
|
184
|
-
const subOpen =
|
|
198
|
+
const popup = popupOf(item);
|
|
199
|
+
const subOpen = popup != null && openSubId === item.id;
|
|
200
|
+
const radio = typeof item.selected === 'boolean';
|
|
185
201
|
return (
|
|
186
202
|
<MenuRow
|
|
187
203
|
key={item.id}
|
|
188
204
|
ref={rowFor(i)}
|
|
189
205
|
id={menuId + '-item-' + i}
|
|
190
|
-
className="dropdown__item"
|
|
191
|
-
role=
|
|
206
|
+
className="zc-dropdown__item"
|
|
207
|
+
role={radio ? 'menuitemradio' : 'menuitem'}
|
|
192
208
|
tabIndex={i === activeIdx ? 0 : -1}
|
|
209
|
+
aria-checked={radio ? item.selected : undefined}
|
|
193
210
|
aria-disabled={item.disabled || undefined}
|
|
194
|
-
aria-haspopup={
|
|
195
|
-
aria-expanded={
|
|
211
|
+
aria-haspopup={popup ?? undefined}
|
|
212
|
+
aria-expanded={popup ? subOpen : undefined}
|
|
196
213
|
aria-controls={subOpen ? panelId(depth + 1) : undefined}
|
|
197
214
|
aria-keyshortcuts={item.shortcut}
|
|
198
215
|
data-active={i === activeIdx ? 'true' : undefined}
|
|
216
|
+
data-selected={item.selected ? 'true' : undefined}
|
|
199
217
|
data-disabled={item.disabled ? 'true' : undefined}
|
|
200
218
|
data-danger={item.danger ? 'true' : undefined}
|
|
201
219
|
onPointerEnter={(e) => onRowEnter({ x: e.clientX, y: e.clientY }, i)}
|
|
@@ -209,31 +227,50 @@ export function MenuPanel({ chain, depth, ...motion }: { chain: MenuChain; depth
|
|
|
209
227
|
description={item.description}
|
|
210
228
|
trailing={
|
|
211
229
|
<>
|
|
230
|
+
{item.selected && <Icon name="check" size="sm" weight="bold" className="zc-dropdown__item-check" />}
|
|
212
231
|
{item.shortcut && (
|
|
213
|
-
<span className="dropdown__item-shortcut" aria-hidden="true">
|
|
232
|
+
<span className="zc-dropdown__item-shortcut" aria-hidden="true">
|
|
214
233
|
{item.shortcut}
|
|
215
234
|
</span>
|
|
216
235
|
)}
|
|
217
|
-
{
|
|
236
|
+
{popup && <Icon name="caret-right" size="sm" className="zc-dropdown__item-caret" />}
|
|
218
237
|
</>
|
|
219
238
|
}
|
|
220
239
|
/>
|
|
221
240
|
);
|
|
222
241
|
}
|
|
223
242
|
|
|
243
|
+
function renderRows() {
|
|
244
|
+
return (
|
|
245
|
+
<>
|
|
246
|
+
<GlidePill className="zc-menu-glide" glide={glide} />
|
|
247
|
+
{groups.length > 1 || groups[0]?.label
|
|
248
|
+
? groups.map((group, gi) => (
|
|
249
|
+
<div className="zc-dropdown__group" role="group" aria-label={group.label || undefined} key={gi}>
|
|
250
|
+
{group.label && <div className="zc-menu-group-label">{group.label}</div>}
|
|
251
|
+
{group.items.map(renderRow)}
|
|
252
|
+
</div>
|
|
253
|
+
))
|
|
254
|
+
: flat.map(renderRow)}
|
|
255
|
+
</>
|
|
256
|
+
);
|
|
257
|
+
}
|
|
258
|
+
|
|
224
259
|
return (
|
|
225
260
|
<div
|
|
226
261
|
{...(nested ? undefined : chain.htmlProps)}
|
|
262
|
+
{...menuHighlightAttrs(chain)}
|
|
227
263
|
ref={panelRef as unknown as RefObject<HTMLDivElement>}
|
|
228
264
|
id={menuId}
|
|
229
|
-
className={cx('menu-surface menu-scroller dropdown__menu', !nested && chain.htmlProps?.className)}
|
|
230
|
-
role=
|
|
265
|
+
className={cx('zc-menu-surface zc-menu-scroller zc-dropdown__menu', !nested && chain.htmlProps?.className)}
|
|
266
|
+
role={contentLevel ? 'dialog' : 'menu'}
|
|
231
267
|
tabIndex={-1}
|
|
232
268
|
aria-label={nested ? undefined : chain.ariaLabel}
|
|
233
269
|
aria-labelledby={nested ? panelId(depth - 1) + '-item-' + level.ownerIdx : undefined}
|
|
234
270
|
data-nested={nested ? 'true' : undefined}
|
|
271
|
+
data-content={contentLevel ? 'true' : undefined}
|
|
235
272
|
data-danger-active={activeItem && activeItem.danger ? 'true' : undefined}
|
|
236
|
-
onKeyDown={onKeyDown}
|
|
273
|
+
onKeyDown={contentLevel ? onContentKeyDown : onKeyDown}
|
|
237
274
|
onPointerEnter={() => {
|
|
238
275
|
if (hoverDepth.current > depth) travel.current.from = null;
|
|
239
276
|
hoverDepth.current = depth;
|
|
@@ -241,15 +278,7 @@ export function MenuPanel({ chain, depth, ...motion }: { chain: MenuChain; depth
|
|
|
241
278
|
}}
|
|
242
279
|
onPointerMove={(e) => travel.current.active && !heading({ x: e.clientX, y: e.clientY }) && abortTravel()}
|
|
243
280
|
>
|
|
244
|
-
|
|
245
|
-
{groups.length > 1 || groups[0]?.label
|
|
246
|
-
? groups.map((group, gi) => (
|
|
247
|
-
<div className="dropdown__group" role="group" aria-label={group.label || undefined} key={gi}>
|
|
248
|
-
{group.label && <div className="menu-group-label">{group.label}</div>}
|
|
249
|
-
{group.items.map(renderRow)}
|
|
250
|
-
</div>
|
|
251
|
-
))
|
|
252
|
-
: flat.map(renderRow)}
|
|
281
|
+
{contentLevel ? level.content : renderRows()}
|
|
253
282
|
</div>
|
|
254
283
|
);
|
|
255
284
|
}
|
|
@@ -2,6 +2,7 @@ import type { HTMLAttributes, ReactNode, RefObject } from 'react';
|
|
|
2
2
|
|
|
3
3
|
import type { DataAttributes } from '../../../dom-props';
|
|
4
4
|
import { normalizeCollection, type NormalizedGroup } from '../../internal/collection/collection';
|
|
5
|
+
import type { MenuHighlight } from '../../internal/menu/highlight';
|
|
5
6
|
import type { ActivateOn } from '../../internal/utils/activation';
|
|
6
7
|
|
|
7
8
|
export interface DropdownItem {
|
|
@@ -19,8 +20,14 @@ export interface DropdownItem {
|
|
|
19
20
|
danger?: boolean;
|
|
20
21
|
/** Not selectable - skipped by arrow keys and typeahead, and marked `aria-disabled`. @default false */
|
|
21
22
|
disabled?: boolean;
|
|
23
|
+
/** Marks the row as the current value of a single-choice group: accent ink with a check at rest, and
|
|
24
|
+
* `menuitemradio` semantics. Leave undefined for plain action rows. */
|
|
25
|
+
selected?: boolean;
|
|
22
26
|
/** Nested menu. The row opens it instead of committing, and can nest again without limit. */
|
|
23
27
|
items?: DropdownItem[] | DropdownGroup[];
|
|
28
|
+
/** Your own panel body, opened from this row in place of a submenu. Nothing inside it commits the menu -
|
|
29
|
+
* drive dismissal with `open`/`onOpenChange`. */
|
|
30
|
+
content?: ReactNode;
|
|
24
31
|
/** Text used for typeahead. Required when `label` is not a string. */
|
|
25
32
|
searchText?: string;
|
|
26
33
|
/** Fires when this row commits, before the menu's own `onSelect`. */
|
|
@@ -49,39 +56,54 @@ export const itemText = (item: DropdownItem): string =>
|
|
|
49
56
|
export const submenuOf = (item: DropdownItem): DropdownItems | null =>
|
|
50
57
|
item.items && item.items.length > 0 ? item.items : null;
|
|
51
58
|
|
|
59
|
+
export const hasContent = (item: DropdownItem): boolean => item.content != null;
|
|
60
|
+
|
|
61
|
+
export type LevelPopup = 'menu' | 'dialog';
|
|
62
|
+
|
|
63
|
+
export const popupOf = (item: DropdownItem): LevelPopup | null =>
|
|
64
|
+
hasContent(item) ? 'dialog' : submenuOf(item) ? 'menu' : null;
|
|
65
|
+
|
|
66
|
+
export const opensLevel = (item: DropdownItem): boolean => popupOf(item) != null;
|
|
67
|
+
|
|
52
68
|
export const ROOT_LEVEL = 'root';
|
|
53
69
|
export const levelKey = (depth: number, ownerId: string) => depth + ':' + ownerId;
|
|
54
70
|
|
|
71
|
+
const NO_ROWS: DropdownItem[] = [];
|
|
72
|
+
|
|
55
73
|
export interface Level {
|
|
56
74
|
key: string;
|
|
57
75
|
items: DropdownItems;
|
|
76
|
+
content?: ReactNode;
|
|
58
77
|
owner: DropdownItem | null;
|
|
59
78
|
ownerIdx: number;
|
|
60
79
|
}
|
|
61
80
|
|
|
62
|
-
/* The open chain, root first: path[d] names the row in level d whose submenu is level d + 1. */
|
|
63
81
|
export function resolveLevels(items: DropdownItems, path: string[]): Level[] {
|
|
64
82
|
const levels: Level[] = [{ key: ROOT_LEVEL, items, owner: null, ownerIdx: -1 }];
|
|
65
83
|
for (const id of path) {
|
|
66
84
|
const { flat } = normalize(levels[levels.length - 1].items);
|
|
67
85
|
const ownerIdx = flat.findIndex((item) => item.id === id);
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
86
|
+
if (ownerIdx < 0) break;
|
|
87
|
+
const owner = flat[ownerIdx];
|
|
88
|
+
const sub = submenuOf(owner);
|
|
89
|
+
const key = levelKey(levels.length, id);
|
|
90
|
+
if (hasContent(owner)) levels.push({ key, items: NO_ROWS, content: owner.content, owner, ownerIdx });
|
|
91
|
+
else if (sub) levels.push({ key, items: sub, owner, ownerIdx });
|
|
92
|
+
else break;
|
|
71
93
|
}
|
|
72
94
|
return levels;
|
|
73
95
|
}
|
|
74
96
|
|
|
75
97
|
export type SeedFocus = 'first' | 'last' | 'none';
|
|
76
98
|
|
|
77
|
-
/* Everything a level needs to render itself and act on the chain. One object, built once by
|
|
78
|
-
Dropdown, so a panel takes its place in the chain rather than twenty separate props. */
|
|
79
99
|
export interface MenuChain {
|
|
80
100
|
levels: Level[];
|
|
81
101
|
menuId: string;
|
|
82
102
|
activateOn?: ActivateOn;
|
|
83
103
|
side: 'top' | 'bottom' | 'left' | 'right';
|
|
84
104
|
align: 'start' | 'center' | 'end';
|
|
105
|
+
highlight: MenuHighlight;
|
|
106
|
+
rail: boolean;
|
|
85
107
|
ariaLabel?: string;
|
|
86
108
|
htmlProps?: HTMLAttributes<HTMLDivElement> & DataAttributes;
|
|
87
109
|
seed: { key: string; focus: SeedFocus };
|
|
@@ -14,7 +14,7 @@ import { CategoryBar } from './react/category-bar';
|
|
|
14
14
|
import { useEmojiPicker, type EmojiPickerStore } from './react/useEmojiPicker';
|
|
15
15
|
import type { GetEmojiUrl } from './types';
|
|
16
16
|
|
|
17
|
-
export { loadEmojiData, onEmojiDataLoaded, type EmojiData, type Emoji } from './data';
|
|
17
|
+
export { getEmojiArray, getEmojiData, loadEmojiData, onEmojiDataLoaded, type EmojiData, type Emoji } from './data';
|
|
18
18
|
export { getEmojiUrl } from './getEmojiUrl';
|
|
19
19
|
export type { GetEmojiUrl, EmojiUrlSource } from './types';
|
|
20
20
|
|
|
@@ -94,9 +94,9 @@ export function EmojiPickerPanel({
|
|
|
94
94
|
const positioned = useMemo(() => inflate(anchor, offset), [anchor, offset]);
|
|
95
95
|
|
|
96
96
|
const frame = (
|
|
97
|
-
<div className={['on-emoji', asSheet && 'on-emoji--sheet', className].filter(Boolean).join(' ')}>
|
|
97
|
+
<div className={['zc-on-emoji', asSheet && 'zc-on-emoji--sheet', className].filter(Boolean).join(' ')}>
|
|
98
98
|
{asSheet || search ? (
|
|
99
|
-
<div className="on-emoji-search" ref={searchRef}>
|
|
99
|
+
<div className="zc-on-emoji-search" ref={searchRef}>
|
|
100
100
|
<TextField
|
|
101
101
|
size="sm"
|
|
102
102
|
type="search"
|
|
@@ -143,7 +143,8 @@ export function EmojiPickerPanel({
|
|
|
143
143
|
onOpenChange={onOpenChange}
|
|
144
144
|
trigger={trigger}
|
|
145
145
|
activateOn={activateOn}
|
|
146
|
-
//
|
|
146
|
+
// The exit curve on open: building the grid drops the first frames, and on the entrance curve nothing of
|
|
147
|
+
// the animation survives them.
|
|
147
148
|
animation={{ ease: { open: 'exit' } }}
|
|
148
149
|
htmlProps={{ className: 'on-emoji-pop', 'aria-label': 'Emoji picker' }}
|
|
149
150
|
>
|
|
@@ -6,10 +6,10 @@ Docs: https://ui.zyncat.app/emoji-picker
|
|
|
6
6
|
Searchable emoji panel - grid, scrollspy category rail, recents in localStorage - living in a Popover, becoming a bottom Sheet on narrow viewports.
|
|
7
7
|
|
|
8
8
|
Matching is word-based, not fuzzy. The dataset is NOT bundled: call loadEmojiData(url | EmojiData)
|
|
9
|
-
once before the panel first opens or it throws; onEmojiDataLoaded(cb) fires when it lands
|
|
10
|
-
getEmojiUrl is REQUIRED. Two shapes. search renders the panel's
|
|
11
|
-
query drives the grid from an input YOU own - point
|
|
12
|
-
forward keys through the ref.
|
|
9
|
+
once before the panel first opens or it throws; onEmojiDataLoaded(cb) fires when it lands and
|
|
10
|
+
getEmojiArray() then reads it back. getEmojiUrl is REQUIRED. Two shapes. search renders the panel's
|
|
11
|
+
own field, opened from trigger. query drives the grid from an input YOU own - point
|
|
12
|
+
popoverProps.anchor at the caret rect and forward keys through the ref.
|
|
13
13
|
|
|
14
14
|
```tsx
|
|
15
15
|
import { EmojiPickerPanel, getEmojiUrl, loadEmojiData } from '@zyncat/ui/emoji-picker';
|
|
@@ -50,10 +50,7 @@ export function onEmojiDataLoaded(cb: () => void): () => void {
|
|
|
50
50
|
};
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
/**
|
|
54
|
-
* Load the emoji dataset. Pass a URL to fetch it, or an already-parsed
|
|
55
|
-
* `EmojiData` object to install it directly. Idempotent — the first call wins.
|
|
56
|
-
*/
|
|
53
|
+
/** Load the emoji dataset from a URL, or install an already-parsed `EmojiData` object. The first call wins. */
|
|
57
54
|
export async function loadEmojiData(loader: string | EmojiData) {
|
|
58
55
|
if (!_inflight) {
|
|
59
56
|
if (typeof loader !== 'string') {
|
|
@@ -73,7 +70,7 @@ export async function loadEmojiData(loader: string | EmojiData) {
|
|
|
73
70
|
return _inflight;
|
|
74
71
|
}
|
|
75
72
|
|
|
76
|
-
/**
|
|
73
|
+
/** The loaded dataset, or null until `loadEmojiData` has resolved. */
|
|
77
74
|
export function getEmojiData(): EmojiData | null {
|
|
78
75
|
return _cache;
|
|
79
76
|
}
|
|
@@ -25,26 +25,26 @@ export function createEmojiGrid(scroll: HTMLDivElement, getEmojiUrl: GetEmojiUrl
|
|
|
25
25
|
|
|
26
26
|
const swapInNativeGlyph = (e: Event) => {
|
|
27
27
|
const img = e.target as HTMLImageElement;
|
|
28
|
-
if (img.matches?.('.on-emoji-btn-img')) img.parentElement!.textContent = img.alt;
|
|
28
|
+
if (img.matches?.('.zc-on-emoji-btn-img')) img.parentElement!.textContent = img.alt;
|
|
29
29
|
};
|
|
30
30
|
scroll.addEventListener('error', swapInNativeGlyph, true);
|
|
31
31
|
|
|
32
32
|
const tile = (emoji: Emoji, idx: number, order: number) =>
|
|
33
|
-
`<button type="button" role="option" tabindex="-1" class="on-emoji-btn" id="${attr(tileIdPrefix + idx)}" aria-label="${attr(emoji.name)}" data-id="${emoji.id}" data-idx="${idx}" style="--i:${order}">` +
|
|
34
|
-
`<img class="on-emoji-btn-img" src="${attr(getEmojiUrl(emoji.id, 'picker-grid'))}" loading="lazy" draggable="false" alt="${attr(emoji.unicode)}"></button>`;
|
|
33
|
+
`<button type="button" role="option" tabindex="-1" class="zc-on-emoji-btn" id="${attr(tileIdPrefix + idx)}" aria-label="${attr(emoji.name)}" data-id="${emoji.id}" data-idx="${idx}" style="--i:${order}">` +
|
|
34
|
+
`<img class="zc-on-emoji-btn-img" src="${attr(getEmojiUrl(emoji.id, 'picker-grid'))}" loading="lazy" draggable="false" alt="${attr(emoji.unicode)}"></button>`;
|
|
35
35
|
|
|
36
36
|
const addCategory = (title: string, key: string, ids: string[]) => {
|
|
37
37
|
const data = getEmojiData();
|
|
38
38
|
if (!data) return;
|
|
39
39
|
|
|
40
|
-
const header = el('div', 'on-emoji-header');
|
|
40
|
+
const header = el('div', 'zc-on-emoji-header');
|
|
41
41
|
header.textContent = title;
|
|
42
42
|
header.setAttribute('aria-hidden', 'true');
|
|
43
43
|
scroll.appendChild(header);
|
|
44
44
|
|
|
45
45
|
const start = buttons.length;
|
|
46
46
|
const emojis = ids.map((id) => data.emojis[id]).filter(Boolean);
|
|
47
|
-
const grid = el('div', 'on-emoji-grid');
|
|
47
|
+
const grid = el('div', 'zc-on-emoji-grid');
|
|
48
48
|
grid.setAttribute('role', 'group');
|
|
49
49
|
grid.setAttribute('aria-label', title);
|
|
50
50
|
grid.style.setProperty('--cols', String(COLUMN_COUNT));
|
|
@@ -59,7 +59,7 @@ export function createEmojiGrid(scroll: HTMLDivElement, getEmojiUrl: GetEmojiUrl
|
|
|
59
59
|
const indexOfKey = (key: string) => sections.findIndex((s) => s.key === key);
|
|
60
60
|
|
|
61
61
|
const showEmpty = (message: string) => {
|
|
62
|
-
scroll.insertAdjacentHTML('beforeend', `<div class="on-emoji-empty">${attr(message)}</div>`);
|
|
62
|
+
scroll.insertAdjacentHTML('beforeend', `<div class="zc-on-emoji-empty">${attr(message)}</div>`);
|
|
63
63
|
};
|
|
64
64
|
|
|
65
65
|
const clear = () => {
|
|
@@ -9,7 +9,7 @@ import { activationProps, type ActivateOn } from '../../../internal/utils/activa
|
|
|
9
9
|
import { CATEGORY_ICON_ATTRS, CATEGORY_ICONS } from '../category-icons';
|
|
10
10
|
import { useCategories, useIsActiveCategory, type EmojiPickerStore } from './useEmojiPicker';
|
|
11
11
|
|
|
12
|
-
const
|
|
12
|
+
const railGlide = () => ({ timing: { duration: SM.dur.base, ease: SM.ease.standard } });
|
|
13
13
|
|
|
14
14
|
interface CategoryProps {
|
|
15
15
|
store: EmojiPickerStore;
|
|
@@ -25,7 +25,7 @@ function Category({ store, categoryKey, railId, glide, activateOn }: CategoryPro
|
|
|
25
25
|
return (
|
|
26
26
|
<button
|
|
27
27
|
type="button"
|
|
28
|
-
className={isActive ? 'on-emoji-cat on-emoji-cat--active' : 'on-emoji-cat'}
|
|
28
|
+
className={isActive ? 'zc-on-emoji-cat zc-on-emoji-cat--active' : 'zc-on-emoji-cat'}
|
|
29
29
|
aria-label={categoryKey.replace(/-/g, ' ')}
|
|
30
30
|
aria-current={isActive ? true : undefined}
|
|
31
31
|
onPointerEnter={(e) => glide.enter(e.currentTarget)}
|
|
@@ -42,8 +42,8 @@ function Category({ store, categoryKey, railId, glide, activateOn }: CategoryPro
|
|
|
42
42
|
<Motion
|
|
43
43
|
as="span"
|
|
44
44
|
layoutId={railId}
|
|
45
|
-
layoutTransition={
|
|
46
|
-
className="on-emoji-cat-rail"
|
|
45
|
+
layoutTransition={railGlide()}
|
|
46
|
+
className="zc-on-emoji-cat-rail"
|
|
47
47
|
aria-hidden="true"
|
|
48
48
|
/>
|
|
49
49
|
)}
|
|
@@ -62,13 +62,13 @@ export function CategoryBar({ store, activateOn }: { store: EmojiPickerStore; ac
|
|
|
62
62
|
return (
|
|
63
63
|
<div
|
|
64
64
|
ref={barRef}
|
|
65
|
-
className="on-emoji-bar"
|
|
65
|
+
className="zc-on-emoji-bar"
|
|
66
66
|
onPointerLeave={glide.leave}
|
|
67
67
|
onMouseDown={(e) => e.preventDefault()}
|
|
68
68
|
role="group"
|
|
69
69
|
aria-label="Emoji categories"
|
|
70
70
|
>
|
|
71
|
-
<GlidePill className="on-emoji-bar-marker" glide={glide} />
|
|
71
|
+
<GlidePill className="zc-on-emoji-bar-marker" glide={glide} />
|
|
72
72
|
{categories.map((key) => (
|
|
73
73
|
<Category key={key} store={store} categoryKey={key} railId={railId} glide={glide} activateOn={activateOn} />
|
|
74
74
|
))}
|
|
@@ -9,9 +9,7 @@ import type { GetEmojiUrl } from '../types';
|
|
|
9
9
|
export interface UseEmojiPickerOptions {
|
|
10
10
|
onSelect: (shortcode: string, hexId: string) => void;
|
|
11
11
|
getEmojiUrl: GetEmojiUrl;
|
|
12
|
-
/** Drive the results from outside — a `:` chip in a document, your own input. */
|
|
13
12
|
query?: string;
|
|
14
|
-
/** Whether picking an emoji fires on `pointerdown` (snappier) or waits for `click`. @default 'click' */
|
|
15
13
|
activateOn?: ActivateOn;
|
|
16
14
|
}
|
|
17
15
|
|
|
@@ -42,15 +40,12 @@ export function createEmojiPickerStore(listboxId: string, handlers: Handlers) {
|
|
|
42
40
|
};
|
|
43
41
|
|
|
44
42
|
return {
|
|
45
|
-
/** Spread onto the field that drives the picker: combobox roles, already pointing at the grid. */
|
|
46
43
|
searchProps: {
|
|
47
44
|
role: 'combobox',
|
|
48
45
|
'aria-expanded': true,
|
|
49
46
|
'aria-autocomplete': 'list',
|
|
50
47
|
'aria-controls': listboxId,
|
|
51
48
|
} as const,
|
|
52
|
-
/** Callback ref for the element the picker takes over. The grid is built the moment the node
|
|
53
|
-
* arrives, which for a popover is a commit or two after the hook first ran. */
|
|
54
49
|
mount: (node: HTMLDivElement | null) => {
|
|
55
50
|
api?.destroy();
|
|
56
51
|
drawn = false;
|
|
@@ -73,9 +68,6 @@ export function createEmojiPickerStore(listboxId: string, handlers: Handlers) {
|
|
|
73
68
|
: null;
|
|
74
69
|
draw();
|
|
75
70
|
},
|
|
76
|
-
/** Callback ref for the field that keeps focus while the grid is navigated, or anything wrapping it.
|
|
77
|
-
* The picker moves `aria-activedescendant` on it directly, so running the marker down 1900 tiles
|
|
78
|
-
* never costs a render. */
|
|
79
71
|
searchRef: (node: HTMLElement | null) => {
|
|
80
72
|
focusHost = node?.matches(FOCUSABLE) ? node : (node?.querySelector<HTMLElement>(FOCUSABLE) ?? null);
|
|
81
73
|
},
|
|
@@ -129,11 +121,8 @@ export function useEmojiPicker({ onSelect, getEmojiUrl, query, activateOn }: Use
|
|
|
129
121
|
return store;
|
|
130
122
|
}
|
|
131
123
|
|
|
132
|
-
/** Category keys the grid currently holds; empty while showing search results. */
|
|
133
124
|
export const useCategories = (store: EmojiPickerStore): string[] =>
|
|
134
125
|
useSyncExternalStore(store.subscribe, store.getCategories, store.getCategories);
|
|
135
126
|
|
|
136
|
-
/** Whether the scroll position is inside this category. Subscribing per key means a scrollspy
|
|
137
|
-
* tick re-renders the two rows whose state flipped, not the panel. */
|
|
138
127
|
export const useIsActiveCategory = (store: EmojiPickerStore, key: string): boolean =>
|
|
139
128
|
useSyncExternalStore(store.subscribe, () => store.isActive(key), notActive);
|
|
@@ -8,29 +8,29 @@ const IDLE_CAPTION = 'Pick an emoji…';
|
|
|
8
8
|
const MARKER_OPACITY = 0.6;
|
|
9
9
|
|
|
10
10
|
export function createScaffold(root: HTMLElement, emojiData: EmojiData, getEmojiUrl: GetEmojiUrl, listboxId: string) {
|
|
11
|
-
const scroll = el('div', 'on-emoji-scroll');
|
|
12
|
-
const marker = el('span', 'on-emoji-marker');
|
|
13
|
-
const caption = el('div', 'on-emoji-caption');
|
|
11
|
+
const scroll = el('div', 'zc-on-emoji-scroll');
|
|
12
|
+
const marker = el('span', 'zc-on-emoji-marker');
|
|
13
|
+
const caption = el('div', 'zc-on-emoji-caption');
|
|
14
14
|
|
|
15
15
|
scroll.id = listboxId;
|
|
16
16
|
scroll.setAttribute('role', 'listbox');
|
|
17
17
|
scroll.setAttribute('aria-label', 'Emoji');
|
|
18
18
|
|
|
19
19
|
caption.innerHTML =
|
|
20
|
-
'<img class="on-emoji-caption-img" alt="" draggable="false" hidden>' +
|
|
21
|
-
'<span class="on-emoji-caption-name"></span><span class="on-emoji-caption-code"></span>';
|
|
20
|
+
'<img class="zc-on-emoji-caption-img" alt="" draggable="false" hidden>' +
|
|
21
|
+
'<span class="zc-on-emoji-caption-name"></span><span class="zc-on-emoji-caption-code"></span>';
|
|
22
22
|
const [captionImg, captionName, captionCode] = caption.children as unknown as [
|
|
23
23
|
HTMLImageElement,
|
|
24
24
|
HTMLElement,
|
|
25
25
|
HTMLElement,
|
|
26
26
|
];
|
|
27
27
|
|
|
28
|
-
root.className = 'on-emoji-body';
|
|
28
|
+
root.className = 'zc-on-emoji-body';
|
|
29
29
|
root.append(scroll, caption);
|
|
30
30
|
|
|
31
31
|
const setCaption = (btn: HTMLButtonElement | null) => {
|
|
32
32
|
const emoji = btn?.dataset.id ? emojiData.emojis[btn.dataset.id] : null;
|
|
33
|
-
caption.classList.toggle('is-idle', !emoji);
|
|
33
|
+
caption.classList.toggle('zc-is-idle', !emoji);
|
|
34
34
|
captionImg.hidden = !emoji;
|
|
35
35
|
captionName.textContent = emoji ? emoji.name : IDLE_CAPTION;
|
|
36
36
|
captionCode.textContent = emoji ? `:${emoji.shortcodes[0] ?? emoji.id}:` : '';
|
|
@@ -2,12 +2,6 @@ import { getEmojiData, type EmojiData } from './data';
|
|
|
2
2
|
|
|
3
3
|
const MAX_RESULTS = 90;
|
|
4
4
|
|
|
5
|
-
/* Emoji search is word search, not fuzzy search: at ~1800 items a
|
|
6
|
-
* subsequence tier drowns the tail in junk ("cat" ⊂ "certification"), so
|
|
7
|
-
* matching is strictly word-based — every query token must hit a word
|
|
8
|
-
* (exact / prefix / mid-word for longer tokens), and tags count for less
|
|
9
|
-
* than names or shortcodes. */
|
|
10
|
-
|
|
11
5
|
interface IndexedEmoji {
|
|
12
6
|
id: string;
|
|
13
7
|
shortcodes: string[];
|
|
@@ -73,7 +67,6 @@ export const getRankedEmojiIds = (query: string): string[] => {
|
|
|
73
67
|
if (total) scored.push({ id: e.id, score: total, nameLen: e.nameLen });
|
|
74
68
|
}
|
|
75
69
|
|
|
76
|
-
// Equal relevance → the shorter name is the more focal emoji.
|
|
77
70
|
scored.sort((a, b) => b.score - a.score || a.nameLen - b.nameLen);
|
|
78
71
|
return scored.slice(0, MAX_RESULTS).map((s) => s.id);
|
|
79
72
|
};
|