@zyncat/ui 0.10.0 → 0.12.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 +135 -40
- package/dist/alert.css +126 -121
- package/dist/alert.js +12 -14
- package/dist/alert.js.map +1 -1
- package/dist/avatar-group.js.map +1 -1
- package/dist/avatar.css +179 -174
- package/dist/avatar.js.map +1 -1
- package/dist/badge.css +166 -160
- package/dist/badge.js +1 -1
- package/dist/button.css +272 -246
- package/dist/button.js +1 -1
- package/dist/checkbox.css +158 -153
- package/dist/checkbox.js +2 -2
- package/dist/{chunk-UXONUUPI.js → chunk-227ZW4V7.js} +40 -32
- package/dist/chunk-227ZW4V7.js.map +1 -0
- package/dist/{chunk-2ERBBFZS.js → chunk-3MPF7FZV.js} +2 -2
- package/dist/chunk-3MPF7FZV.js.map +1 -0
- package/dist/{chunk-OMHQ4U4J.js → chunk-43M6GQ4Q.js} +86 -79
- package/dist/chunk-43M6GQ4Q.js.map +1 -0
- package/dist/{chunk-7SZCJ7WI.js → chunk-45R4Z5XN.js} +3 -3
- package/dist/chunk-45R4Z5XN.js.map +1 -0
- package/dist/{chunk-I4XQ4PV2.js → chunk-4BSHB7R3.js} +9 -7
- package/dist/chunk-4BSHB7R3.js.map +1 -0
- package/dist/{chunk-YGGCQNNU.js → chunk-4C5RZXBT.js} +33 -34
- package/dist/chunk-4C5RZXBT.js.map +1 -0
- package/dist/{chunk-2QWJ6FAX.js → chunk-5PZ43DCG.js} +31 -15
- package/dist/chunk-5PZ43DCG.js.map +1 -0
- package/dist/{chunk-S5ZTZANS.js → chunk-7IZJERGA.js} +35 -12
- package/dist/chunk-7IZJERGA.js.map +1 -0
- package/dist/{chunk-ZCOUPPTI.js → chunk-A5WTZACK.js} +22 -12
- package/dist/chunk-A5WTZACK.js.map +1 -0
- package/dist/{chunk-64UU4LGU.js → chunk-AADAJL7D.js} +3 -3
- package/dist/{chunk-64UU4LGU.js.map → chunk-AADAJL7D.js.map} +1 -1
- package/dist/{chunk-FTOAUJL5.js → chunk-CF4QHO4N.js} +21 -11
- package/dist/chunk-CF4QHO4N.js.map +1 -0
- package/dist/{chunk-WM5J5TDI.js → chunk-CNWTIMIP.js} +13 -17
- package/dist/chunk-CNWTIMIP.js.map +1 -0
- package/dist/{chunk-356HZMT4.js → chunk-DDRSMHN4.js} +31 -22
- package/dist/chunk-DDRSMHN4.js.map +1 -0
- package/dist/{chunk-VTJTGVZZ.js → chunk-DMX2F6B4.js} +2 -2
- package/dist/chunk-DMX2F6B4.js.map +1 -0
- package/dist/{chunk-3SBCBYB7.js → chunk-EAI4POPB.js} +2 -2
- package/dist/{chunk-3SBCBYB7.js.map → chunk-EAI4POPB.js.map} +1 -1
- package/dist/{chunk-Y7AJQVWJ.js → chunk-EF6RPXU7.js} +17 -15
- package/dist/chunk-EF6RPXU7.js.map +1 -0
- package/dist/{chunk-K5X2GCXU.js → chunk-FONOS5RN.js} +14 -15
- package/dist/chunk-FONOS5RN.js.map +1 -0
- package/dist/{chunk-PMECHR3A.js → chunk-FQEHSKEI.js} +2 -2
- package/dist/chunk-FQEHSKEI.js.map +1 -0
- package/dist/chunk-HDSFWZ7L.js +12 -0
- package/dist/chunk-HDSFWZ7L.js.map +1 -0
- package/dist/{chunk-2F5PITAO.js → chunk-HY5MPISE.js} +2 -2
- package/dist/chunk-HY5MPISE.js.map +1 -0
- package/dist/{chunk-QDK66S4G.js → chunk-I45AU6KH.js} +3 -3
- package/dist/chunk-I45AU6KH.js.map +1 -0
- package/dist/{chunk-YGCVWGUG.js → chunk-IJS7TPGV.js} +153 -46
- package/dist/chunk-IJS7TPGV.js.map +1 -0
- package/dist/{chunk-62P3KD57.js → chunk-IUQAUBVM.js} +18 -11
- package/dist/chunk-IUQAUBVM.js.map +1 -0
- package/dist/chunk-JY6A2ZJZ.js +44 -0
- package/dist/chunk-JY6A2ZJZ.js.map +1 -0
- package/dist/{chunk-XWUWYSCT.js → chunk-M43IOM5C.js} +20 -10
- package/dist/chunk-M43IOM5C.js.map +1 -0
- package/dist/{chunk-S7B34VGN.js → chunk-OWNMRMPN.js} +3 -3
- package/dist/{chunk-S7B34VGN.js.map → chunk-OWNMRMPN.js.map} +1 -1
- package/dist/chunk-RFRE4WKX.js +22 -0
- package/dist/chunk-RFRE4WKX.js.map +1 -0
- package/dist/{chunk-NNXJCLTV.js → chunk-RJFGWJ4W.js} +2 -2
- package/dist/chunk-RJFGWJ4W.js.map +1 -0
- package/dist/{chunk-NEF5XAHG.js → chunk-TUTXXC3W.js} +4 -4
- package/dist/chunk-TUTXXC3W.js.map +1 -0
- package/dist/chunk-TVYH4AN7.js +70 -0
- package/dist/chunk-TVYH4AN7.js.map +1 -0
- package/dist/{chunk-RCONNA7I.js → chunk-VAXCXZ53.js} +34 -22
- package/dist/chunk-VAXCXZ53.js.map +1 -0
- package/dist/chunk-XNIYSAMJ.js +52 -0
- package/dist/chunk-XNIYSAMJ.js.map +1 -0
- package/dist/{chunk-CONSWNIV.js → chunk-Y2YA7QRF.js} +6 -6
- package/dist/chunk-Y2YA7QRF.js.map +1 -0
- package/dist/cli.js +1809 -0
- package/dist/collapse.css +70 -61
- package/dist/collapse.js +2 -2
- package/dist/confetti.css +45 -0
- package/dist/confetti.js +540 -0
- package/dist/confetti.js.map +1 -0
- package/dist/count-badge.js +3 -3
- package/dist/count-badge.js.map +1 -1
- package/dist/date-field.js +24 -19
- package/dist/date-field.js.map +1 -1
- package/dist/date-picker.css +563 -559
- package/dist/date-range-field.js +58 -41
- package/dist/date-range-field.js.map +1 -1
- package/dist/datetime-field.js +24 -19
- package/dist/datetime-field.js.map +1 -1
- package/dist/dialog.css +176 -172
- package/dist/dialog.js +30 -19
- package/dist/dialog.js.map +1 -1
- package/dist/digit-strip.css +65 -0
- package/dist/dropdown.css +65 -0
- package/dist/dropdown.js +350 -0
- package/dist/dropdown.js.map +1 -0
- package/dist/emoji-picker.js +713 -0
- package/dist/emoji-picker.js.map +1 -0
- package/dist/facebook-feed.css +880 -0
- package/dist/facebook-feed.js +697 -0
- package/dist/facebook-feed.js.map +1 -0
- package/dist/flow-field.css +49 -0
- package/dist/flow-field.js +269 -0
- package/dist/flow-field.js.map +1 -0
- package/dist/glide.js +3 -3
- package/dist/icon.css +34 -30
- package/dist/input.css +296 -318
- package/dist/instagram-feed.css +378 -0
- package/dist/instagram-feed.js +272 -0
- package/dist/instagram-feed.js.map +1 -0
- package/dist/lens.css +119 -0
- package/dist/lens.js +307 -0
- package/dist/lens.js.map +1 -0
- package/dist/mcp.js +379 -184
- package/dist/menu-surface.css +127 -0
- package/dist/modal.css +11 -7
- package/dist/modal.js +24 -17
- package/dist/modal.js.map +1 -1
- package/dist/morphing-text.css +84 -0
- package/dist/morphing-text.js +256 -0
- package/dist/morphing-text.js.map +1 -0
- package/dist/motion-devtools.css +237 -233
- package/dist/motion-devtools.js +7 -6
- package/dist/motion-devtools.js.map +1 -1
- package/dist/motion-tokens.js +1 -1
- package/dist/multi-select.js +20 -17
- package/dist/multi-select.js.map +1 -1
- package/dist/number-field.js +11 -7
- package/dist/number-field.js.map +1 -1
- package/dist/odometer.css +58 -59
- package/dist/odometer.js +109 -0
- package/dist/odometer.js.map +1 -0
- package/dist/otp-field.js.map +1 -1
- package/dist/overlay.css +24 -20
- package/dist/pagination.css +42 -38
- package/dist/pagination.js +6 -12
- package/dist/pagination.js.map +1 -1
- package/dist/popover.css +69 -65
- package/dist/popover.js +12 -10
- package/dist/radio-group.css +275 -276
- package/dist/radio-group.js +70 -95
- package/dist/radio-group.js.map +1 -1
- package/dist/select.css +291 -386
- package/dist/select.js +18 -15
- package/dist/select.js.map +1 -1
- package/dist/sheet.css +47 -23
- package/dist/sheet.js +11 -10
- package/dist/status-badge.js +3 -3
- package/dist/status-badge.js.map +1 -1
- package/dist/styles.css +221 -0
- package/dist/support-rail.css +421 -0
- package/dist/support-rail.js +243 -0
- package/dist/support-rail.js.map +1 -0
- package/dist/table.css +333 -323
- package/dist/table.js +32 -21
- package/dist/table.js.map +1 -1
- package/dist/tabs.css +163 -156
- package/dist/tabs.js +26 -20
- package/dist/tabs.js.map +1 -1
- package/dist/tag.css +209 -231
- package/dist/tag.js +11 -10
- package/dist/tag.js.map +1 -1
- package/dist/text-field.js +7 -67
- package/dist/text-field.js.map +1 -1
- package/dist/textarea.css +205 -211
- package/dist/textarea.js +12 -12
- package/dist/textarea.js.map +1 -1
- package/dist/theme.js +69 -0
- package/dist/theme.js.map +1 -0
- package/dist/tiktok.css +662 -0
- package/dist/tiktok.js +494 -0
- package/dist/tiktok.js.map +1 -0
- package/dist/time-field.js +6 -6
- package/dist/time-field.js.map +1 -1
- package/dist/toast.css +237 -233
- package/dist/toast.js +43 -47
- package/dist/toast.js.map +1 -1
- package/dist/toggle-tag.js +1 -1
- package/dist/toggle-tag.js.map +1 -1
- package/dist/toggle.css +139 -135
- package/dist/toggle.js.map +1 -1
- package/dist/tooltip.css +79 -78
- package/dist/tooltip.js +50 -60
- package/dist/tooltip.js.map +1 -1
- package/dist/trigger.css +13 -0
- package/dist/{alert.d.ts → types/components/composites/alert/Alert.d.ts} +13 -15
- package/dist/{date-field.d.ts → types/components/composites/date-picker/DateField.d.ts} +4 -10
- package/dist/types/components/composites/date-picker/DateRangeField.d.ts +21 -0
- package/dist/{datetime-field.d.ts → types/components/composites/date-picker/DateTimeField.d.ts} +4 -10
- package/dist/{time-field.d.ts → types/components/composites/date-picker/TimeField.d.ts} +5 -11
- package/dist/types/components/composites/date-picker/calendar-panel.d.ts +16 -0
- package/dist/types/components/composites/date-picker/date-utils.d.ts +12 -0
- package/dist/types/components/composites/date-picker/field-shell.d.ts +46 -0
- package/dist/types/components/composites/date-picker/range-panel.d.ts +24 -0
- package/dist/types/components/composites/date-picker/time-core.d.ts +14 -0
- package/dist/types/components/composites/date-picker/use-day-focus.d.ts +2 -0
- package/dist/{dialog.d.ts → types/components/composites/dialog/Dialog.d.ts} +10 -11
- package/dist/types/components/composites/dropdown/Dropdown.d.ts +37 -0
- package/dist/types/components/composites/dropdown/menu-panel.d.ts +7 -0
- package/dist/types/components/composites/dropdown/types.d.ts +71 -0
- package/dist/types/components/composites/emoji-picker/EmojiPickerPanel.d.ts +45 -0
- package/dist/types/components/composites/emoji-picker/category-icons.d.ts +9 -0
- package/dist/types/components/composites/emoji-picker/data.d.ts +33 -0
- package/dist/types/components/composites/emoji-picker/dom.d.ts +19 -0
- package/dist/types/components/composites/emoji-picker/getEmojiUrl.d.ts +2 -0
- package/dist/types/components/composites/emoji-picker/navigation.d.ts +7 -0
- package/dist/types/components/composites/emoji-picker/picker.d.ts +20 -0
- package/dist/types/components/composites/emoji-picker/react/category-bar.d.ts +6 -0
- package/dist/types/components/composites/emoji-picker/react/useEmojiPicker.d.ts +50 -0
- package/dist/types/components/composites/emoji-picker/scaffold.d.ts +8 -0
- package/dist/types/components/composites/emoji-picker/search.d.ts +1 -0
- package/dist/types/components/composites/emoji-picker/types.d.ts +13 -0
- package/dist/{modal.d.ts → types/components/composites/modal/Modal.d.ts} +10 -11
- package/dist/{pagination.d.ts → types/components/composites/pagination/Pagination.d.ts} +5 -8
- package/dist/{popover.d.ts → types/components/composites/popover/Popover.d.ts} +11 -14
- package/dist/{multi-select.d.ts → types/components/composites/select/MultiSelect.d.ts} +12 -11
- package/dist/{select.d.ts → types/components/composites/select/Select.d.ts} +16 -14
- package/dist/types/components/composites/select/core/index.d.ts +4 -0
- package/dist/types/components/composites/select/core/menu.d.ts +13 -0
- package/dist/types/components/composites/select/core/panel.d.ts +18 -0
- package/dist/types/components/composites/select/core/trigger.d.ts +16 -0
- package/dist/{types-SGMShK7R.d.ts → types/components/composites/select/core/types.d.ts} +13 -6
- package/dist/types/components/composites/select/core/use-listbox.d.ts +42 -0
- package/dist/{sheet.d.ts → types/components/composites/sheet/Sheet.d.ts} +10 -11
- package/dist/types/components/composites/sheet/use-sheet-drag.d.ts +13 -0
- package/dist/{table.d.ts → types/components/composites/table/Table.d.ts} +12 -12
- package/dist/{tabs.d.ts → types/components/composites/tabs/Tabs.d.ts} +13 -13
- package/dist/types/components/composites/toast/Toast.d.ts +10 -0
- package/dist/{toast-store.d.ts → types/components/composites/toast/toast-store.d.ts} +12 -14
- package/dist/{tooltip.d.ts → types/components/composites/tooltip/Tooltip.d.ts} +6 -10
- package/dist/types/components/composites/tooltip/tooltip-host.d.ts +1 -0
- package/dist/types/components/composites/tooltip/tooltip-store.d.ts +29 -0
- package/dist/types/components/compound/support-rail/SupportRail.d.ts +41 -0
- package/dist/types/components/dev/MotionDevtools.d.ts +24 -0
- package/dist/types/components/dev/slowmo-engine.d.ts +27 -0
- package/dist/types/components/expressive/confetti/Confetti.d.ts +43 -0
- package/dist/types/components/expressive/facebook-feed/FacebookFeed.d.ts +73 -0
- package/dist/types/components/expressive/facebook-feed/chrome.d.ts +30 -0
- package/dist/types/components/expressive/facebook-feed/icons.d.ts +21 -0
- package/dist/types/components/expressive/facebook-feed/post.d.ts +25 -0
- package/dist/types/components/expressive/facebook-feed/reel.d.ts +26 -0
- package/dist/types/components/expressive/facebook-feed/story.d.ts +20 -0
- package/dist/types/components/expressive/flow-field/FlowField.d.ts +23 -0
- package/dist/types/components/expressive/instagram-feed/InstagramFeed.d.ts +59 -0
- package/dist/types/components/expressive/lens/Lens.d.ts +23 -0
- package/dist/types/components/expressive/morphing-text/MorphingText.d.ts +21 -0
- package/dist/types/components/expressive/odometer/Odometer.d.ts +21 -0
- package/dist/types/components/expressive/tiktok/TikTok.d.ts +85 -0
- package/dist/types/components/expressive/tiktok/glyphs.d.ts +40 -0
- package/dist/types/components/expressive/typing-lines/TypingLines.d.ts +25 -0
- package/dist/types/components/expressive/weight-field/WeightField.d.ts +19 -0
- package/dist/types/components/expressive/youtube/YouTube.d.ts +73 -0
- package/dist/types/components/expressive/youtube/format.d.ts +2 -0
- package/dist/types/components/expressive/youtube/glyphs.d.ts +16 -0
- package/dist/types/components/expressive/youtube/media.d.ts +8 -0
- package/dist/types/components/expressive/youtube/post.d.ts +19 -0
- package/dist/types/components/expressive/youtube/short.d.ts +18 -0
- package/dist/types/components/expressive/youtube/video.d.ts +14 -0
- package/dist/types/components/internal/collection/collection.d.ts +19 -0
- package/dist/types/components/internal/glass/glint.d.ts +1 -0
- package/dist/types/components/internal/hooks/use-controllable.d.ts +1 -0
- package/dist/types/components/internal/hooks/use-media-query.d.ts +1 -0
- package/dist/types/components/internal/hooks/use-scroll-edges.d.ts +10 -0
- package/dist/types/components/internal/hooks/use-typeahead.d.ts +5 -0
- package/dist/types/components/internal/icon/Icon.d.ts +33 -0
- package/dist/types/components/internal/icon/IconSlot.d.ts +7 -0
- package/dist/types/components/internal/menu/menu-row.d.ts +11 -0
- package/dist/types/components/internal/overlay/focus.d.ts +8 -0
- package/dist/types/components/internal/overlay/layer.d.ts +38 -0
- package/dist/types/components/internal/overlay/modal.d.ts +18 -0
- package/dist/types/components/internal/overlay/position.d.ts +14 -0
- package/dist/types/components/internal/support/types.d.ts +15 -0
- package/dist/types/components/internal/utils/activation.d.ts +23 -0
- package/dist/types/components/internal/utils/cx.d.ts +1 -0
- package/dist/types/components/internal/utils/token-px.d.ts +1 -0
- package/dist/{avatar.d.ts → types/components/primitives/avatar/Avatar.d.ts} +10 -12
- package/dist/{avatar-group.d.ts → types/components/primitives/avatar/AvatarGroup.d.ts} +7 -9
- package/dist/{badge.d.ts → types/components/primitives/badge/Badge.d.ts} +8 -10
- package/dist/types/components/primitives/badge/CountBadge.d.ts +8 -0
- package/dist/types/components/primitives/badge/StatusBadge.d.ts +15 -0
- package/dist/types/components/primitives/badge/digit-strip.d.ts +5 -0
- package/dist/{button.d.ts → types/components/primitives/button/Button.d.ts} +6 -8
- package/dist/{checkbox.d.ts → types/components/primitives/checkbox/Checkbox.d.ts} +6 -8
- package/dist/types/components/primitives/checkbox/check-glyph.d.ts +6 -0
- package/dist/{collapse.d.ts → types/components/primitives/collapse/Collapse.d.ts} +12 -13
- package/dist/types/components/primitives/collapse/collapse.typecheck.d.ts +2 -0
- package/dist/{number-field.d.ts → types/components/primitives/input/NumberField.d.ts} +7 -9
- package/dist/{otp-field.d.ts → types/components/primitives/input/OtpField.d.ts} +6 -8
- package/dist/{text-field.d.ts → types/components/primitives/input/TextField.d.ts} +7 -9
- package/dist/types/components/primitives/input/field-chrome.d.ts +45 -0
- package/dist/{radio-group.d.ts → types/components/primitives/radio-group/RadioGroup.d.ts} +8 -10
- package/dist/{tag.d.ts → types/components/primitives/tag/Tag.d.ts} +9 -12
- package/dist/{toggle-tag.d.ts → types/components/primitives/tag/ToggleTag.d.ts} +7 -8
- package/dist/{textarea.d.ts → types/components/primitives/textarea/Textarea.d.ts} +7 -9
- package/dist/{toggle.d.ts → types/components/primitives/toggle/Toggle.d.ts} +6 -8
- package/dist/{dom-props-C0jrllBw.d.ts → types/dom-props.d.ts} +1 -3
- package/dist/types/engine/animate.d.ts +30 -0
- package/dist/types/engine/drag.d.ts +17 -0
- package/dist/types/engine/ease.d.ts +15 -0
- package/dist/types/engine/flip.d.ts +18 -0
- package/dist/types/engine/index.d.ts +4 -0
- package/dist/types/engine/loop.d.ts +9 -0
- package/dist/types/motion/element.d.ts +17 -0
- package/dist/types/motion/flip.d.ts +4 -0
- package/dist/types/motion/glide.d.ts +11 -0
- package/dist/types/motion/motion-timing.d.ts +16 -0
- package/dist/types/motion/presence-context.d.ts +11 -0
- package/dist/types/motion/presence.d.ts +12 -0
- package/dist/types/motion/presets.d.ts +6 -0
- package/dist/{timing-7JA_zQHP.d.ts → types/motion/timing.d.ts} +9 -9
- package/dist/types/motion/use-motion.d.ts +17 -0
- package/dist/types/tokens/component-styles.generated.d.ts +262 -0
- package/dist/{motion-scale-Canq4stZ.d.ts → types/tokens/motion-scale.d.ts} +4 -4
- package/dist/{motion-tokens.d.ts → types/tokens/motion-tokens.d.ts} +9 -9
- package/dist/types/tokens/theme-tokens.generated.d.ts +1249 -0
- package/dist/types/tokens/theme.d.ts +12 -0
- package/dist/typing-lines.css +92 -0
- package/dist/typing-lines.js +139 -0
- package/dist/typing-lines.js.map +1 -0
- package/dist/weight-field.css +84 -0
- package/dist/weight-field.js +17 -0
- package/dist/weight-field.js.map +1 -0
- package/dist/youtube.css +611 -0
- package/dist/youtube.js +814 -0
- package/dist/youtube.js.map +1 -0
- package/package.json +155 -49
- package/skills/zyncat-ui/SKILL.md +95 -0
- package/skills/zyncat-ui/references/components.md +85 -0
- package/skills/zyncat-ui/references/recipes.md +171 -0
- package/skills/zyncat-ui/references/theming.md +83 -0
- package/src/components/composites/alert/Alert.tsx +13 -11
- package/src/components/composites/alert/Alert.usage.md +15 -0
- package/src/components/composites/alert/alert.css +126 -121
- package/src/components/composites/date-picker/DateField.tsx +7 -2
- package/src/components/composites/date-picker/DateField.usage.md +10 -0
- package/src/components/composites/date-picker/DateRangeField.tsx +18 -16
- package/src/components/composites/date-picker/DateRangeField.usage.md +10 -0
- package/src/components/composites/date-picker/DateTimeField.tsx +10 -5
- package/src/components/composites/date-picker/DateTimeField.usage.md +12 -0
- package/src/components/composites/date-picker/TimeField.tsx +3 -1
- package/src/components/composites/date-picker/TimeField.usage.md +12 -0
- package/src/components/composites/date-picker/calendar-panel.tsx +15 -10
- package/src/components/composites/date-picker/date-picker.css +563 -559
- package/src/components/composites/date-picker/field-shell.tsx +9 -3
- package/src/components/composites/date-picker/range-panel.tsx +23 -8
- package/src/components/composites/date-picker/time-core.tsx +2 -0
- package/src/components/composites/dialog/Dialog.tsx +30 -15
- package/src/components/composites/dialog/Dialog.usage.md +17 -0
- package/src/components/composites/dialog/dialog.css +176 -172
- package/src/components/composites/dropdown/Dropdown.tsx +184 -0
- package/src/components/composites/dropdown/Dropdown.usage.md +19 -0
- package/src/components/composites/dropdown/dropdown.css +65 -0
- package/src/components/composites/dropdown/menu-panel.tsx +255 -0
- package/src/components/composites/dropdown/types.ts +95 -0
- package/src/components/composites/emoji-picker/EmojiPickerPanel.tsx +153 -0
- package/src/components/composites/emoji-picker/EmojiPickerPanel.usage.md +26 -0
- package/src/components/composites/emoji-picker/category-icons.ts +29 -0
- package/src/components/composites/emoji-picker/data.ts +83 -0
- package/src/components/composites/emoji-picker/dom.ts +79 -0
- package/src/components/composites/emoji-picker/getEmojiUrl.ts +17 -0
- package/src/components/composites/emoji-picker/navigation.ts +86 -0
- package/src/components/composites/emoji-picker/picker.ts +169 -0
- package/src/components/composites/emoji-picker/react/category-bar.tsx +77 -0
- package/src/components/composites/emoji-picker/react/useEmojiPicker.ts +139 -0
- package/src/components/composites/emoji-picker/scaffold.ts +74 -0
- package/src/components/composites/emoji-picker/search.ts +79 -0
- package/src/components/composites/emoji-picker/styles.css +221 -0
- package/src/components/composites/emoji-picker/types.ts +14 -0
- package/src/components/composites/modal/Modal.tsx +24 -13
- package/src/components/composites/modal/Modal.usage.md +24 -0
- package/src/components/composites/modal/modal.css +11 -7
- package/src/components/composites/pagination/Pagination.tsx +6 -11
- package/src/components/composites/pagination/Pagination.usage.md +12 -0
- package/src/components/composites/pagination/pagination.css +42 -38
- package/src/components/composites/popover/Popover.tsx +22 -7
- package/src/components/composites/popover/Popover.usage.md +15 -0
- package/src/components/composites/popover/popover.css +69 -65
- package/src/components/composites/select/MultiSelect.tsx +13 -5
- package/src/components/composites/select/MultiSelect.usage.md +12 -0
- package/src/components/composites/select/Select.tsx +23 -7
- package/src/components/composites/select/Select.usage.md +20 -0
- package/src/components/composites/select/core/index.ts +1 -1
- package/src/components/composites/select/core/menu.tsx +8 -6
- package/src/components/composites/select/core/panel.tsx +25 -26
- package/src/components/composites/select/core/trigger.tsx +36 -24
- package/src/components/composites/select/core/types.ts +17 -15
- package/src/components/composites/select/core/use-listbox.ts +22 -21
- package/src/components/composites/select/select.css +291 -386
- package/src/components/composites/sheet/Sheet.tsx +28 -18
- package/src/components/composites/sheet/Sheet.usage.md +15 -0
- package/src/components/composites/sheet/sheet.css +47 -23
- package/src/components/composites/sheet/use-sheet-drag.ts +19 -15
- package/src/components/composites/table/Table.tsx +17 -6
- package/src/components/composites/table/Table.usage.md +19 -0
- package/src/components/composites/table/table.css +333 -323
- package/src/components/composites/tabs/Tabs.tsx +31 -23
- package/src/components/composites/tabs/Tabs.usage.md +13 -0
- package/src/components/composites/tabs/tabs.css +163 -156
- package/src/components/composites/toast/Toast.tsx +48 -51
- package/src/components/composites/toast/Toast.usage.md +23 -0
- package/src/components/composites/toast/toast-store.usage.md +16 -0
- package/src/components/composites/toast/toast.css +237 -233
- package/src/components/composites/tooltip/Tooltip.tsx +13 -8
- package/src/components/composites/tooltip/Tooltip.usage.md +14 -0
- package/src/components/composites/tooltip/tooltip-host.tsx +29 -61
- package/src/components/composites/tooltip/tooltip-store.ts +10 -0
- package/src/components/composites/tooltip/tooltip.css +79 -78
- package/src/components/compound/support-rail/SupportRail.tsx +343 -0
- package/src/components/compound/support-rail/SupportRail.usage.md +18 -0
- package/src/components/compound/support-rail/support-rail.css +421 -0
- package/src/components/dev/MotionDevtools.tsx +3 -1
- package/src/components/dev/MotionDevtools.usage.md +16 -0
- package/src/components/dev/motion-devtools.css +237 -233
- package/src/components/expressive/confetti/Confetti.tsx +727 -0
- package/src/components/expressive/confetti/Confetti.usage.md +18 -0
- package/src/components/expressive/confetti/confetti.css +45 -0
- package/src/components/expressive/facebook-feed/FacebookFeed.tsx +200 -0
- package/src/components/expressive/facebook-feed/FacebookFeed.usage.md +18 -0
- package/src/components/expressive/facebook-feed/chrome.tsx +120 -0
- package/src/components/expressive/facebook-feed/facebook-feed.css +880 -0
- package/src/components/expressive/facebook-feed/icons.tsx +145 -0
- package/src/components/expressive/facebook-feed/post.tsx +213 -0
- package/src/components/expressive/facebook-feed/reel.tsx +199 -0
- package/src/components/expressive/facebook-feed/story.tsx +132 -0
- package/src/components/expressive/flow-field/FlowField.tsx +348 -0
- package/src/components/expressive/flow-field/FlowField.usage.md +19 -0
- package/src/components/expressive/flow-field/flow-field.css +49 -0
- package/src/components/expressive/instagram-feed/InstagramFeed.tsx +374 -0
- package/src/components/expressive/instagram-feed/InstagramFeed.usage.md +18 -0
- package/src/components/expressive/instagram-feed/instagram-feed.css +378 -0
- package/src/components/expressive/lens/Lens.tsx +415 -0
- package/src/components/expressive/lens/Lens.usage.md +20 -0
- package/src/components/expressive/lens/lens.css +119 -0
- package/src/components/expressive/morphing-text/MorphingText.tsx +328 -0
- package/src/components/expressive/morphing-text/MorphingText.usage.md +19 -0
- package/src/components/expressive/morphing-text/morphing-text.css +84 -0
- package/src/components/expressive/odometer/Odometer.tsx +158 -0
- package/src/components/expressive/odometer/Odometer.usage.md +17 -0
- package/src/components/expressive/odometer/odometer.css +61 -0
- package/src/components/expressive/tiktok/TikTok.tsx +542 -0
- package/src/components/expressive/tiktok/TikTok.usage.md +17 -0
- package/src/components/expressive/tiktok/glyphs.tsx +163 -0
- package/src/components/expressive/tiktok/tiktok.css +662 -0
- package/src/components/expressive/typing-lines/TypingLines.tsx +0 -0
- package/src/components/expressive/typing-lines/TypingLines.usage.md +17 -0
- package/src/components/expressive/typing-lines/typing-lines.css +92 -0
- package/src/components/expressive/weight-field/WeightField.tsx +41 -0
- package/src/components/expressive/weight-field/WeightField.usage.md +20 -0
- package/src/components/expressive/weight-field/weight-field.css +84 -0
- package/src/components/expressive/youtube/YouTube.tsx +192 -0
- package/src/components/expressive/youtube/YouTube.usage.md +18 -0
- package/src/components/expressive/youtube/format.ts +22 -0
- package/src/components/expressive/youtube/glyphs.tsx +235 -0
- package/src/components/expressive/youtube/media.tsx +18 -0
- package/src/components/expressive/youtube/post.tsx +282 -0
- package/src/components/expressive/youtube/short.tsx +212 -0
- package/src/components/expressive/youtube/video.tsx +75 -0
- package/src/components/expressive/youtube/youtube.css +611 -0
- package/src/components/internal/collection/collection.ts +44 -0
- package/src/components/internal/glass/glass.css +88 -84
- package/src/components/internal/hooks/use-media-query.ts +20 -0
- package/src/components/internal/hooks/use-typeahead.ts +28 -0
- package/src/components/internal/icon/Icon.tsx +2 -0
- package/src/components/internal/icon/IconSlot.tsx +2 -0
- package/src/components/internal/icon/icon.css +34 -30
- package/src/components/internal/menu/menu-row.tsx +34 -0
- package/src/components/internal/menu/menu-surface.css +127 -0
- package/src/components/internal/overlay/focus.ts +26 -10
- package/src/components/internal/overlay/layer.tsx +50 -19
- package/src/components/internal/overlay/modal.tsx +14 -12
- package/src/components/internal/overlay/overlay.css +24 -20
- package/src/components/internal/overlay/position.ts +19 -9
- package/src/components/internal/overlay/trigger.css +13 -0
- package/src/components/internal/support/types.ts +16 -0
- package/src/components/internal/utils/activation.ts +78 -0
- package/src/components/primitives/avatar/Avatar.tsx +2 -0
- package/src/components/primitives/avatar/Avatar.usage.md +12 -0
- package/src/components/primitives/avatar/AvatarGroup.tsx +3 -1
- package/src/components/primitives/avatar/AvatarGroup.usage.md +15 -0
- package/src/components/primitives/avatar/avatar.css +179 -174
- package/src/components/primitives/badge/Badge.tsx +3 -1
- package/src/components/primitives/badge/Badge.usage.md +14 -0
- package/src/components/primitives/badge/CountBadge.tsx +2 -2
- package/src/components/primitives/badge/CountBadge.usage.md +13 -0
- package/src/components/primitives/badge/StatusBadge.tsx +3 -1
- package/src/components/primitives/badge/StatusBadge.usage.md +14 -0
- package/src/components/primitives/badge/badge.css +166 -160
- package/src/components/primitives/badge/digit-strip.css +65 -0
- package/src/components/primitives/badge/{odometer.tsx → digit-strip.tsx} +3 -3
- package/src/components/primitives/button/Button.tsx +2 -0
- package/src/components/primitives/button/Button.usage.md +14 -0
- package/src/components/primitives/button/button.css +272 -246
- package/src/components/primitives/checkbox/Checkbox.tsx +3 -1
- package/src/components/primitives/checkbox/Checkbox.usage.md +12 -0
- package/src/components/primitives/checkbox/check-glyph.tsx +1 -0
- package/src/components/primitives/checkbox/checkbox.css +158 -153
- package/src/components/primitives/collapse/Collapse.tsx +3 -1
- package/src/components/primitives/collapse/Collapse.usage.md +17 -0
- package/src/components/primitives/collapse/collapse.css +70 -61
- package/src/components/primitives/collapse/collapse.typecheck.tsx +2 -0
- package/src/components/primitives/input/NumberField.tsx +18 -5
- package/src/components/primitives/input/NumberField.usage.md +12 -0
- package/src/components/primitives/input/OtpField.tsx +2 -0
- package/src/components/primitives/input/OtpField.usage.md +12 -0
- package/src/components/primitives/input/TextField.tsx +16 -4
- package/src/components/primitives/input/TextField.usage.md +13 -0
- package/src/components/primitives/input/field-chrome.tsx +11 -2
- package/src/components/primitives/input/input.css +296 -318
- package/src/components/primitives/radio-group/RadioGroup.tsx +20 -44
- package/src/components/primitives/radio-group/RadioGroup.usage.md +13 -0
- package/src/components/primitives/radio-group/radio-group.css +275 -276
- package/src/components/primitives/tag/Tag.tsx +10 -6
- package/src/components/primitives/tag/Tag.usage.md +14 -0
- package/src/components/primitives/tag/ToggleTag.tsx +4 -2
- package/src/components/primitives/tag/ToggleTag.usage.md +14 -0
- package/src/components/primitives/tag/tag.css +209 -231
- package/src/components/primitives/textarea/Textarea.tsx +17 -7
- package/src/components/primitives/textarea/Textarea.usage.md +12 -0
- package/src/components/primitives/textarea/textarea.css +205 -211
- package/src/components/primitives/toggle/Toggle.tsx +3 -1
- package/src/components/primitives/toggle/Toggle.usage.md +12 -0
- package/src/components/primitives/toggle/toggle.css +139 -135
- package/src/engine/animate.ts +40 -13
- package/src/engine/ease.ts +1 -0
- package/src/engine/flip.ts +32 -15
- package/src/engine/index.ts +2 -1
- package/src/engine/loop.ts +97 -0
- package/src/mcp/server.ts +315 -221
- package/src/motion/element.tsx +1 -0
- package/src/motion/flip.ts +29 -10
- package/src/motion/glide.tsx +11 -14
- package/src/motion/glide.usage.md +15 -0
- package/src/motion/motion-timing.ts +3 -3
- package/src/motion/presence.tsx +38 -21
- package/src/motion/presets.ts +13 -0
- package/src/motion/timing.ts +1 -0
- package/src/motion/use-motion.ts +16 -3
- package/src/styles.css +5 -0
- package/src/tokens/avatar.css +20 -16
- package/src/tokens/color.css +67 -56
- package/src/tokens/component-styles.generated.ts +270 -0
- package/src/tokens/elevation.css +28 -17
- package/src/tokens/fonts.css +1 -1
- package/src/tokens/glass.css +19 -15
- package/src/tokens/icons.css +8 -4
- package/src/tokens/layers.css +9 -4
- package/src/tokens/motion-scale.ts +4 -0
- package/src/tokens/motion-tokens.ts +42 -12
- package/src/tokens/motion-tokens.usage.md +16 -0
- package/src/tokens/motion.css +63 -45
- package/src/tokens/radius.css +12 -8
- package/src/tokens/semantic.css +62 -54
- package/src/tokens/spacing.css +25 -21
- package/src/tokens/theme-tokens.generated.ts +1278 -0
- package/src/tokens/theme.tsx +83 -0
- package/src/tokens/theme.usage.md +36 -0
- package/src/tokens/typography.css +53 -49
- package/dist/chunk-2ERBBFZS.js.map +0 -1
- package/dist/chunk-2F5PITAO.js.map +0 -1
- package/dist/chunk-2QWJ6FAX.js.map +0 -1
- package/dist/chunk-356HZMT4.js.map +0 -1
- package/dist/chunk-62P3KD57.js.map +0 -1
- package/dist/chunk-7SZCJ7WI.js.map +0 -1
- package/dist/chunk-CONSWNIV.js.map +0 -1
- package/dist/chunk-FTOAUJL5.js.map +0 -1
- package/dist/chunk-I4XQ4PV2.js.map +0 -1
- package/dist/chunk-K5X2GCXU.js.map +0 -1
- package/dist/chunk-NEF5XAHG.js.map +0 -1
- package/dist/chunk-NNXJCLTV.js.map +0 -1
- package/dist/chunk-OMHQ4U4J.js.map +0 -1
- package/dist/chunk-PMECHR3A.js.map +0 -1
- package/dist/chunk-QDK66S4G.js.map +0 -1
- package/dist/chunk-RCONNA7I.js.map +0 -1
- package/dist/chunk-S5ZTZANS.js.map +0 -1
- package/dist/chunk-UXONUUPI.js.map +0 -1
- package/dist/chunk-VTJTGVZZ.js.map +0 -1
- package/dist/chunk-WM5J5TDI.js.map +0 -1
- package/dist/chunk-XWUWYSCT.js.map +0 -1
- package/dist/chunk-Y7AJQVWJ.js.map +0 -1
- package/dist/chunk-YGCVWGUG.js.map +0 -1
- package/dist/chunk-YGGCQNNU.js.map +0 -1
- package/dist/chunk-ZCOUPPTI.js.map +0 -1
- package/dist/count-badge.d.ts +0 -13
- package/dist/date-range-field.d.ts +0 -33
- package/dist/field-chrome-CMPOQSLs.d.ts +0 -28
- package/dist/field-shell-Cuda-feL.d.ts +0 -24
- package/dist/glide.d.ts +0 -15
- package/dist/motion-devtools.d.ts +0 -51
- package/dist/status-badge.d.ts +0 -19
- package/dist/toast.d.ts +0 -12
- package/llms.txt +0 -220
- package/src/components/primitives/badge/odometer.css +0 -62
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useId, useRef } from 'react';
|
|
4
|
+
|
|
5
|
+
import { Motion } from '../../../../motion/element';
|
|
6
|
+
import { GlidePill, useGlide, type GlideApi } from '../../../../motion/glide';
|
|
7
|
+
import { UIMotion as SM } from '../../../../tokens/motion-tokens';
|
|
8
|
+
import { activationProps, type ActivateOn } from '../../../internal/utils/activation';
|
|
9
|
+
import { CATEGORY_ICON_ATTRS, CATEGORY_ICONS } from '../category-icons';
|
|
10
|
+
import { useCategories, useIsActiveCategory, type EmojiPickerStore } from './useEmojiPicker';
|
|
11
|
+
|
|
12
|
+
const RAIL_GLIDE = { timing: { duration: SM.dur.base, ease: SM.ease.standard } };
|
|
13
|
+
|
|
14
|
+
interface CategoryProps {
|
|
15
|
+
store: EmojiPickerStore;
|
|
16
|
+
categoryKey: string;
|
|
17
|
+
railId: string;
|
|
18
|
+
glide: GlideApi;
|
|
19
|
+
activateOn?: ActivateOn;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function Category({ store, categoryKey, railId, glide, activateOn }: CategoryProps) {
|
|
23
|
+
const isActive = useIsActiveCategory(store, categoryKey);
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<button
|
|
27
|
+
type="button"
|
|
28
|
+
className={isActive ? 'on-emoji-cat on-emoji-cat--active' : 'on-emoji-cat'}
|
|
29
|
+
aria-label={categoryKey.replace(/-/g, ' ')}
|
|
30
|
+
aria-current={isActive ? true : undefined}
|
|
31
|
+
onPointerEnter={(e) => glide.enter(e.currentTarget)}
|
|
32
|
+
{...activationProps<HTMLButtonElement>(() => store.scrollToCategory(categoryKey), {
|
|
33
|
+
on: activateOn,
|
|
34
|
+
holdFocus: true,
|
|
35
|
+
})}
|
|
36
|
+
>
|
|
37
|
+
<svg
|
|
38
|
+
{...CATEGORY_ICON_ATTRS}
|
|
39
|
+
dangerouslySetInnerHTML={{ __html: CATEGORY_ICONS[categoryKey] ?? CATEGORY_ICONS.symbols }}
|
|
40
|
+
/>
|
|
41
|
+
{isActive && (
|
|
42
|
+
<Motion
|
|
43
|
+
as="span"
|
|
44
|
+
layoutId={railId}
|
|
45
|
+
layoutTransition={RAIL_GLIDE}
|
|
46
|
+
className="on-emoji-cat-rail"
|
|
47
|
+
aria-hidden="true"
|
|
48
|
+
/>
|
|
49
|
+
)}
|
|
50
|
+
</button>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export function CategoryBar({ store, activateOn }: { store: EmojiPickerStore; activateOn?: ActivateOn }) {
|
|
55
|
+
const barRef = useRef<HTMLDivElement | null>(null);
|
|
56
|
+
const glide = useGlide(barRef);
|
|
57
|
+
const railId = useId();
|
|
58
|
+
const categories = useCategories(store);
|
|
59
|
+
|
|
60
|
+
if (!categories.length) return null;
|
|
61
|
+
|
|
62
|
+
return (
|
|
63
|
+
<div
|
|
64
|
+
ref={barRef}
|
|
65
|
+
className="on-emoji-bar"
|
|
66
|
+
onPointerLeave={glide.leave}
|
|
67
|
+
onMouseDown={(e) => e.preventDefault()}
|
|
68
|
+
role="group"
|
|
69
|
+
aria-label="Emoji categories"
|
|
70
|
+
>
|
|
71
|
+
<GlidePill className="on-emoji-bar-marker" glide={glide} />
|
|
72
|
+
{categories.map((key) => (
|
|
73
|
+
<Category key={key} store={store} categoryKey={key} railId={railId} glide={glide} activateOn={activateOn} />
|
|
74
|
+
))}
|
|
75
|
+
</div>
|
|
76
|
+
);
|
|
77
|
+
}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useEffect, useId, useMemo, useSyncExternalStore } from 'react';
|
|
4
|
+
|
|
5
|
+
import type { ActivateOn } from '../../../internal/utils/activation';
|
|
6
|
+
import { createEmojiPicker, type EmojiPickerApi } from '../picker';
|
|
7
|
+
import type { GetEmojiUrl } from '../types';
|
|
8
|
+
|
|
9
|
+
export interface UseEmojiPickerOptions {
|
|
10
|
+
onSelect: (shortcode: string, hexId: string) => void;
|
|
11
|
+
getEmojiUrl: GetEmojiUrl;
|
|
12
|
+
/** Drive the results from outside — a `:` chip in a document, your own input. */
|
|
13
|
+
query?: string;
|
|
14
|
+
/** Whether picking an emoji fires on `pointerdown` (snappier) or waits for `click`. @default 'click' */
|
|
15
|
+
activateOn?: ActivateOn;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export type EmojiPickerStore = ReturnType<typeof createEmojiPickerStore>;
|
|
19
|
+
|
|
20
|
+
type Handlers = Pick<UseEmojiPickerOptions, 'onSelect' | 'getEmojiUrl' | 'activateOn'>;
|
|
21
|
+
|
|
22
|
+
const FOCUSABLE = 'input, textarea, [tabindex]';
|
|
23
|
+
const NO_CATEGORIES: string[] = [];
|
|
24
|
+
const notActive = () => false;
|
|
25
|
+
|
|
26
|
+
export function createEmojiPickerStore(listboxId: string, handlers: Handlers) {
|
|
27
|
+
const listeners = new Set<() => void>();
|
|
28
|
+
const emit = () => listeners.forEach((listener) => listener());
|
|
29
|
+
|
|
30
|
+
let api: EmojiPickerApi | null = null;
|
|
31
|
+
let focusHost: HTMLElement | null = null;
|
|
32
|
+
let categories = NO_CATEGORIES;
|
|
33
|
+
let active: string | null = null;
|
|
34
|
+
let query = '';
|
|
35
|
+
let drawn = false;
|
|
36
|
+
|
|
37
|
+
const draw = () => {
|
|
38
|
+
if (!api) return;
|
|
39
|
+
drawn = true;
|
|
40
|
+
if (query) api.renderFiltered(query);
|
|
41
|
+
else api.renderAll();
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
return {
|
|
45
|
+
/** Spread onto the field that drives the picker: combobox roles, already pointing at the grid. */
|
|
46
|
+
searchProps: {
|
|
47
|
+
role: 'combobox',
|
|
48
|
+
'aria-expanded': true,
|
|
49
|
+
'aria-autocomplete': 'list',
|
|
50
|
+
'aria-controls': listboxId,
|
|
51
|
+
} 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
|
+
mount: (node: HTMLDivElement | null) => {
|
|
55
|
+
api?.destroy();
|
|
56
|
+
drawn = false;
|
|
57
|
+
api = node
|
|
58
|
+
? createEmojiPicker(node, {
|
|
59
|
+
listboxId,
|
|
60
|
+
getEmojiUrl: (...args) => handlers.getEmojiUrl(...args),
|
|
61
|
+
getFocusHost: () => focusHost,
|
|
62
|
+
getActivateOn: () => handlers.activateOn,
|
|
63
|
+
onSelect: (...args) => handlers.onSelect(...args),
|
|
64
|
+
onCategoriesChange: (keys) => {
|
|
65
|
+
categories = keys;
|
|
66
|
+
emit();
|
|
67
|
+
},
|
|
68
|
+
onActiveCategoryChange: (key) => {
|
|
69
|
+
active = key;
|
|
70
|
+
emit();
|
|
71
|
+
},
|
|
72
|
+
})
|
|
73
|
+
: null;
|
|
74
|
+
draw();
|
|
75
|
+
},
|
|
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
|
+
searchRef: (node: HTMLElement | null) => {
|
|
80
|
+
focusHost = node?.matches(FOCUSABLE) ? node : (node?.querySelector<HTMLElement>(FOCUSABLE) ?? null);
|
|
81
|
+
},
|
|
82
|
+
setHandlers: (next: Handlers) => {
|
|
83
|
+
handlers = next;
|
|
84
|
+
},
|
|
85
|
+
subscribe: (listener: () => void) => {
|
|
86
|
+
listeners.add(listener);
|
|
87
|
+
return () => {
|
|
88
|
+
listeners.delete(listener);
|
|
89
|
+
};
|
|
90
|
+
},
|
|
91
|
+
getCategories: () => categories,
|
|
92
|
+
isActive: (key: string) => active === key,
|
|
93
|
+
render: (next = '') => {
|
|
94
|
+
if (drawn && next === query) return;
|
|
95
|
+
query = next;
|
|
96
|
+
draw();
|
|
97
|
+
},
|
|
98
|
+
scrollToCategory: (key: string) => api?.scrollToCategory(key),
|
|
99
|
+
/** Redraw the full category grid, dropping whatever query was showing. */
|
|
100
|
+
renderAll: () => {
|
|
101
|
+
query = '';
|
|
102
|
+
draw();
|
|
103
|
+
},
|
|
104
|
+
/** Redraw the grid as the ranked results for `next`, with the first hit already marked. */
|
|
105
|
+
renderFiltered: (next: string) => {
|
|
106
|
+
query = next;
|
|
107
|
+
draw();
|
|
108
|
+
},
|
|
109
|
+
/** Feed a key event from your own field into the grid - arrows move, Enter picks.
|
|
110
|
+
* Returns true when the grid consumed the key, so you can leave the rest to your input. */
|
|
111
|
+
handleKey: (event: KeyboardEvent) => api?.handleKey(event) ?? false,
|
|
112
|
+
/** Commit the tile the marker is on, exactly as a click on it would. */
|
|
113
|
+
selectFocused: () => api?.selectFocused(),
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export function useEmojiPicker({ onSelect, getEmojiUrl, query, activateOn }: UseEmojiPickerOptions): EmojiPickerStore {
|
|
118
|
+
const listboxId = useId();
|
|
119
|
+
const store = useMemo(() => createEmojiPickerStore(listboxId, { onSelect, getEmojiUrl }), [listboxId]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
120
|
+
|
|
121
|
+
useEffect(() => {
|
|
122
|
+
store.setHandlers({ onSelect, getEmojiUrl, activateOn });
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
useEffect(() => {
|
|
126
|
+
store.render(query);
|
|
127
|
+
}, [store, query]);
|
|
128
|
+
|
|
129
|
+
return store;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/** Category keys the grid currently holds; empty while showing search results. */
|
|
133
|
+
export const useCategories = (store: EmojiPickerStore): string[] =>
|
|
134
|
+
useSyncExternalStore(store.subscribe, store.getCategories, store.getCategories);
|
|
135
|
+
|
|
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
|
+
export const useIsActiveCategory = (store: EmojiPickerStore, key: string): boolean =>
|
|
139
|
+
useSyncExternalStore(store.subscribe, () => store.isActive(key), notActive);
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { animate, flip, measure, set } from '../../../engine';
|
|
2
|
+
import { UIMotion as SM } from '../../../tokens/motion-tokens';
|
|
3
|
+
import type { EmojiData } from './data';
|
|
4
|
+
import { el } from './dom';
|
|
5
|
+
import type { GetEmojiUrl } from './types';
|
|
6
|
+
|
|
7
|
+
const IDLE_CAPTION = 'Pick an emoji…';
|
|
8
|
+
const MARKER_OPACITY = 0.6;
|
|
9
|
+
|
|
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');
|
|
14
|
+
|
|
15
|
+
scroll.id = listboxId;
|
|
16
|
+
scroll.setAttribute('role', 'listbox');
|
|
17
|
+
scroll.setAttribute('aria-label', 'Emoji');
|
|
18
|
+
|
|
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>';
|
|
22
|
+
const [captionImg, captionName, captionCode] = caption.children as unknown as [
|
|
23
|
+
HTMLImageElement,
|
|
24
|
+
HTMLElement,
|
|
25
|
+
HTMLElement,
|
|
26
|
+
];
|
|
27
|
+
|
|
28
|
+
root.className = 'on-emoji-body';
|
|
29
|
+
root.append(scroll, caption);
|
|
30
|
+
|
|
31
|
+
const setCaption = (btn: HTMLButtonElement | null) => {
|
|
32
|
+
const emoji = btn?.dataset.id ? emojiData.emojis[btn.dataset.id] : null;
|
|
33
|
+
caption.classList.toggle('is-idle', !emoji);
|
|
34
|
+
captionImg.hidden = !emoji;
|
|
35
|
+
captionName.textContent = emoji ? emoji.name : IDLE_CAPTION;
|
|
36
|
+
captionCode.textContent = emoji ? `:${emoji.shortcodes[0] ?? emoji.id}:` : '';
|
|
37
|
+
if (emoji) captionImg.src = getEmojiUrl(emoji.id, 'picker-grid');
|
|
38
|
+
};
|
|
39
|
+
setCaption(null);
|
|
40
|
+
|
|
41
|
+
const offsetWithinScroll = (node: HTMLElement) => {
|
|
42
|
+
let left = 0;
|
|
43
|
+
let top = 0;
|
|
44
|
+
for (let box: HTMLElement | null = node; box && box !== scroll; box = box.offsetParent as HTMLElement | null) {
|
|
45
|
+
left += box.offsetLeft;
|
|
46
|
+
top += box.offsetTop;
|
|
47
|
+
}
|
|
48
|
+
return { left, top };
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
let hadFocus = false;
|
|
52
|
+
const positionMarker = (btn: HTMLButtonElement | null) => {
|
|
53
|
+
if (!btn?.offsetHeight) {
|
|
54
|
+
animate(marker, { opacity: [0], timing: SM.t.exit });
|
|
55
|
+
hadFocus = false;
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
const from = hadFocus ? measure(marker) : null;
|
|
59
|
+
const tile = offsetWithinScroll(btn);
|
|
60
|
+
set(marker, { x: [tile.left], y: [tile.top], width: [btn.offsetWidth], height: [btn.offsetHeight] });
|
|
61
|
+
animate(marker, { opacity: [MARKER_OPACITY], timing: { duration: SM.dur.fast, ease: SM.ease.standard } });
|
|
62
|
+
hadFocus = true;
|
|
63
|
+
if (from && !SM.reduced)
|
|
64
|
+
flip(marker, from, { size: 'none', timing: { duration: SM.dur.base, ease: SM.ease.standard } });
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const mountMarker = () => {
|
|
68
|
+
hadFocus = false;
|
|
69
|
+
set(marker, { opacity: [0] });
|
|
70
|
+
scroll.appendChild(marker);
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
return { scroll, setCaption, positionMarker, mountMarker };
|
|
74
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { getEmojiData, type EmojiData } from './data';
|
|
2
|
+
|
|
3
|
+
const MAX_RESULTS = 90;
|
|
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
|
+
interface IndexedEmoji {
|
|
12
|
+
id: string;
|
|
13
|
+
shortcodes: string[];
|
|
14
|
+
words: string[];
|
|
15
|
+
tagWords: string[];
|
|
16
|
+
nameLen: number;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const splitWords = (s: string) =>
|
|
20
|
+
s
|
|
21
|
+
.toLowerCase()
|
|
22
|
+
.split(/[\s_-]+/)
|
|
23
|
+
.filter(Boolean);
|
|
24
|
+
|
|
25
|
+
let source: EmojiData | null = null;
|
|
26
|
+
let index: IndexedEmoji[] = [];
|
|
27
|
+
|
|
28
|
+
const buildIndex = (data: EmojiData) => {
|
|
29
|
+
source = data;
|
|
30
|
+
index = Object.values(data.emojis).map((e) => ({
|
|
31
|
+
id: e.id,
|
|
32
|
+
shortcodes: e.shortcodes.map((s) => s.toLowerCase()),
|
|
33
|
+
words: [...new Set([...splitWords(e.name), ...e.shortcodes.flatMap(splitWords)])],
|
|
34
|
+
tagWords: [...new Set(e.tags.flatMap(splitWords))],
|
|
35
|
+
nameLen: e.name.length,
|
|
36
|
+
}));
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const rank = (word: string, t: string, exact: number, prefix: number, mid = 0) => {
|
|
40
|
+
if (word === t) return exact;
|
|
41
|
+
if (word.startsWith(t)) return prefix;
|
|
42
|
+
return mid && t.length >= 3 && word.includes(t) ? mid : 0;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const scoreToken = (e: IndexedEmoji, t: string): number => {
|
|
46
|
+
let best = 0;
|
|
47
|
+
for (const s of e.shortcodes) best = Math.max(best, rank(s, t, 100, 60));
|
|
48
|
+
if (best === 100) return best;
|
|
49
|
+
for (const w of e.words) best = Math.max(best, rank(w, t, 70, 55, 15));
|
|
50
|
+
for (const w of e.tagWords) best = Math.max(best, rank(w, t, 30, 22));
|
|
51
|
+
return best;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export const getRankedEmojiIds = (query: string): string[] => {
|
|
55
|
+
const data = getEmojiData();
|
|
56
|
+
if (!data) return [];
|
|
57
|
+
if (source !== data) buildIndex(data);
|
|
58
|
+
|
|
59
|
+
const tokens = query.toLowerCase().trim().split(/\s+/).filter(Boolean);
|
|
60
|
+
if (!tokens.length) return [];
|
|
61
|
+
|
|
62
|
+
const scored: { id: string; score: number; nameLen: number }[] = [];
|
|
63
|
+
for (const e of index) {
|
|
64
|
+
let total = 0;
|
|
65
|
+
for (const t of tokens) {
|
|
66
|
+
const s = scoreToken(e, t);
|
|
67
|
+
if (!s) {
|
|
68
|
+
total = 0;
|
|
69
|
+
break;
|
|
70
|
+
}
|
|
71
|
+
total += s;
|
|
72
|
+
}
|
|
73
|
+
if (total) scored.push({ id: e.id, score: total, nameLen: e.nameLen });
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// Equal relevance → the shorter name is the more focal emoji.
|
|
77
|
+
scored.sort((a, b) => b.score - a.score || a.nameLen - b.nameLen);
|
|
78
|
+
return scored.slice(0, MAX_RESULTS).map((s) => s.id);
|
|
79
|
+
};
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
@layer zyncat.tokens, zyncat.components;
|
|
2
|
+
|
|
3
|
+
@layer zyncat.components {
|
|
4
|
+
.on-emoji,
|
|
5
|
+
.on-emoji *,
|
|
6
|
+
.on-emoji-body,
|
|
7
|
+
.on-emoji-body * {
|
|
8
|
+
box-sizing: border-box;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.on-emoji {
|
|
12
|
+
display: flex;
|
|
13
|
+
flex-direction: column;
|
|
14
|
+
width: var(--emoji-picker-width, 23.5rem);
|
|
15
|
+
height: var(--emoji-picker-height, 26.5rem);
|
|
16
|
+
background: var(--bg-surface-raised);
|
|
17
|
+
border: var(--border-hairline) solid var(--border-default);
|
|
18
|
+
border-radius: var(--radius-lg);
|
|
19
|
+
box-shadow: var(--shadow-lg);
|
|
20
|
+
color: var(--text-body);
|
|
21
|
+
font-family: var(--font-sans);
|
|
22
|
+
font-size: var(--size-body);
|
|
23
|
+
}
|
|
24
|
+
.on-emoji-body {
|
|
25
|
+
display: flex;
|
|
26
|
+
flex: 1;
|
|
27
|
+
flex-direction: column;
|
|
28
|
+
min-height: 0;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.on-emoji-search {
|
|
32
|
+
flex: none;
|
|
33
|
+
padding: var(--space-2) var(--space-2) var(--space-1);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.on-emoji-bar {
|
|
37
|
+
position: relative;
|
|
38
|
+
display: flex;
|
|
39
|
+
flex: none;
|
|
40
|
+
justify-content: space-between;
|
|
41
|
+
padding: var(--space-1) var(--space-2);
|
|
42
|
+
border-bottom: var(--border-hairline) solid var(--border-default);
|
|
43
|
+
}
|
|
44
|
+
.on-emoji-cat {
|
|
45
|
+
position: relative;
|
|
46
|
+
z-index: 1;
|
|
47
|
+
display: inline-flex;
|
|
48
|
+
align-items: center;
|
|
49
|
+
justify-content: center;
|
|
50
|
+
width: var(--space-6);
|
|
51
|
+
height: var(--space-6);
|
|
52
|
+
padding: 0;
|
|
53
|
+
border: 0;
|
|
54
|
+
background: transparent;
|
|
55
|
+
color: var(--text-muted);
|
|
56
|
+
cursor: pointer;
|
|
57
|
+
transition: var(--transition-colors);
|
|
58
|
+
}
|
|
59
|
+
.on-emoji-cat:hover {
|
|
60
|
+
color: var(--text-body);
|
|
61
|
+
}
|
|
62
|
+
.on-emoji-cat--active {
|
|
63
|
+
color: var(--text-accent);
|
|
64
|
+
}
|
|
65
|
+
.on-emoji-cat > svg {
|
|
66
|
+
width: var(--icon-sm);
|
|
67
|
+
height: var(--icon-sm);
|
|
68
|
+
}
|
|
69
|
+
.on-emoji-cat-rail {
|
|
70
|
+
position: absolute;
|
|
71
|
+
inset-inline: 0;
|
|
72
|
+
bottom: calc(2px - var(--space-1));
|
|
73
|
+
width: var(--space-4);
|
|
74
|
+
height: 2px;
|
|
75
|
+
margin-inline: auto;
|
|
76
|
+
border-radius: var(--radius-full);
|
|
77
|
+
background: var(--accent);
|
|
78
|
+
pointer-events: none;
|
|
79
|
+
}
|
|
80
|
+
.on-emoji-bar-marker,
|
|
81
|
+
.on-emoji-marker {
|
|
82
|
+
position: absolute;
|
|
83
|
+
top: 0;
|
|
84
|
+
left: 0;
|
|
85
|
+
z-index: 0;
|
|
86
|
+
opacity: 0;
|
|
87
|
+
pointer-events: none;
|
|
88
|
+
}
|
|
89
|
+
.on-emoji-bar-marker {
|
|
90
|
+
border-radius: var(--radius-sm);
|
|
91
|
+
background: var(--neutral-wash);
|
|
92
|
+
will-change: transform, opacity;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.on-emoji-scroll {
|
|
96
|
+
position: relative;
|
|
97
|
+
flex: 1;
|
|
98
|
+
min-height: 0;
|
|
99
|
+
overflow-y: auto;
|
|
100
|
+
scrollbar-width: none;
|
|
101
|
+
}
|
|
102
|
+
.on-emoji-scroll::-webkit-scrollbar {
|
|
103
|
+
display: none;
|
|
104
|
+
}
|
|
105
|
+
.on-emoji-marker {
|
|
106
|
+
width: 0;
|
|
107
|
+
height: 0;
|
|
108
|
+
border-radius: var(--radius-md);
|
|
109
|
+
background: var(--neutral-wash-press);
|
|
110
|
+
will-change: transform, width, height, opacity;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.on-emoji-header {
|
|
114
|
+
position: sticky;
|
|
115
|
+
top: 0;
|
|
116
|
+
z-index: 10;
|
|
117
|
+
padding: var(--space-2) var(--space-3) var(--space-1);
|
|
118
|
+
background: var(--bg-surface-raised);
|
|
119
|
+
font: var(--type-micro);
|
|
120
|
+
letter-spacing: var(--tracking-caps);
|
|
121
|
+
text-transform: uppercase;
|
|
122
|
+
color: var(--text-subtle);
|
|
123
|
+
}
|
|
124
|
+
.on-emoji-grid {
|
|
125
|
+
display: grid;
|
|
126
|
+
grid-template-columns: repeat(var(--cols, 8), 1fr);
|
|
127
|
+
gap: var(--space-1);
|
|
128
|
+
padding: 0 var(--space-2) var(--space-1);
|
|
129
|
+
content-visibility: auto;
|
|
130
|
+
contain-intrinsic-height: auto calc(var(--rows, 1) * (var(--control-height-lg) + var(--space-1)) - var(--space-1));
|
|
131
|
+
}
|
|
132
|
+
.on-emoji-btn {
|
|
133
|
+
position: relative;
|
|
134
|
+
z-index: 1;
|
|
135
|
+
display: flex;
|
|
136
|
+
align-items: center;
|
|
137
|
+
justify-content: center;
|
|
138
|
+
height: var(--control-height-lg);
|
|
139
|
+
padding: 0;
|
|
140
|
+
border: 0;
|
|
141
|
+
border-radius: var(--radius-md);
|
|
142
|
+
background: transparent;
|
|
143
|
+
cursor: pointer;
|
|
144
|
+
font-size: var(--size-title);
|
|
145
|
+
line-height: 1;
|
|
146
|
+
scroll-margin-top: var(--control-height);
|
|
147
|
+
scroll-margin-bottom: var(--space-2);
|
|
148
|
+
}
|
|
149
|
+
.on-emoji-btn-img {
|
|
150
|
+
display: block;
|
|
151
|
+
width: var(--icon-lg);
|
|
152
|
+
height: var(--icon-lg);
|
|
153
|
+
user-select: none;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
@keyframes on-emoji-tile-in {
|
|
157
|
+
from {
|
|
158
|
+
opacity: 0;
|
|
159
|
+
transform: translateY(var(--distance-sm)) scale(var(--scale-chip));
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
.on-emoji-scroll .on-emoji-btn {
|
|
163
|
+
--emoji-picker-stagger-step: 10ms;
|
|
164
|
+
animation: on-emoji-tile-in var(--duration-base) var(--ease-entrance) both;
|
|
165
|
+
animation-delay: min(calc(var(--i, 0) * var(--emoji-picker-stagger-step)), var(--duration-slower));
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.on-emoji-empty {
|
|
169
|
+
padding: var(--space-6) var(--space-4);
|
|
170
|
+
color: var(--text-muted);
|
|
171
|
+
font: var(--type-caption);
|
|
172
|
+
text-align: center;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.on-emoji-caption {
|
|
176
|
+
display: flex;
|
|
177
|
+
flex: none;
|
|
178
|
+
align-items: center;
|
|
179
|
+
gap: var(--space-2);
|
|
180
|
+
height: var(--control-height-lg);
|
|
181
|
+
padding: 0 var(--space-3);
|
|
182
|
+
border-top: var(--border-hairline) solid var(--border-default);
|
|
183
|
+
}
|
|
184
|
+
.on-emoji-caption-img {
|
|
185
|
+
flex: none;
|
|
186
|
+
width: var(--icon-md);
|
|
187
|
+
height: var(--icon-md);
|
|
188
|
+
user-select: none;
|
|
189
|
+
}
|
|
190
|
+
.on-emoji-caption-name {
|
|
191
|
+
overflow: hidden;
|
|
192
|
+
color: var(--text-body);
|
|
193
|
+
font: var(--type-caption);
|
|
194
|
+
font-weight: var(--weight-medium);
|
|
195
|
+
white-space: nowrap;
|
|
196
|
+
text-overflow: ellipsis;
|
|
197
|
+
}
|
|
198
|
+
.on-emoji-caption-name::first-letter {
|
|
199
|
+
text-transform: uppercase;
|
|
200
|
+
}
|
|
201
|
+
.on-emoji-caption-code {
|
|
202
|
+
flex: none;
|
|
203
|
+
margin-left: auto;
|
|
204
|
+
color: var(--text-muted);
|
|
205
|
+
font: var(--type-mono);
|
|
206
|
+
}
|
|
207
|
+
.on-emoji-caption.is-idle .on-emoji-caption-name {
|
|
208
|
+
color: var(--text-subtle);
|
|
209
|
+
font-weight: var(--weight-regular);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
.on-emoji--sheet {
|
|
213
|
+
width: 100%;
|
|
214
|
+
height: min(var(--emoji-picker-height, 26.5rem), 70svh);
|
|
215
|
+
border-right: 0;
|
|
216
|
+
border-bottom: 0;
|
|
217
|
+
border-left: 0;
|
|
218
|
+
border-radius: var(--radius-lg) var(--radius-lg) 0 0;
|
|
219
|
+
padding-bottom: env(safe-area-inset-bottom);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where the emoji is being rendered. It's metadata for
|
|
3
|
+
* {@link GetEmojiUrl} — consumers can vary provider, size, or format per
|
|
4
|
+
* context, or ignore it entirely.
|
|
5
|
+
*
|
|
6
|
+
* - `"inline"` — inline within editor text (small)
|
|
7
|
+
* - `"picker-grid"` — main grid in the picker panel (medium)
|
|
8
|
+
* - `"category-bar"` — category tab icons (small, often animated)
|
|
9
|
+
* - `"callout-icon"` — callout block leading icon (medium)
|
|
10
|
+
*/
|
|
11
|
+
export type EmojiUrlSource = 'inline' | 'picker-grid' | 'category-bar' | 'callout-icon';
|
|
12
|
+
|
|
13
|
+
/** Returns a URL for an emoji image. */
|
|
14
|
+
export type GetEmojiUrl = (hexId: string, source: EmojiUrlSource) => string;
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import './modal.css';
|
|
4
|
+
|
|
4
5
|
import { Fragment, useId, useRef, type HTMLAttributes, type ReactElement, type ReactNode } from 'react';
|
|
5
|
-
|
|
6
|
+
|
|
7
|
+
import type { DataAttributes } from '../../../dom-props';
|
|
6
8
|
import { resolveMotionTiming } from '../../../motion/motion-timing';
|
|
9
|
+
import { Presence } from '../../../motion/presence';
|
|
10
|
+
import { popIn, popOut } from '../../../motion/presets';
|
|
7
11
|
import type { DisableableAnimation } from '../../../motion/timing';
|
|
12
|
+
import { UIMotion } from '../../../tokens/motion-tokens';
|
|
8
13
|
import { useControllable } from '../../internal/hooks/use-controllable';
|
|
9
14
|
import { ovCloneTrigger, OverlayPortal } from '../../internal/overlay/layer';
|
|
10
|
-
import { ModalShell } from '../../internal/overlay/modal';
|
|
11
|
-
import type {
|
|
12
|
-
|
|
13
|
-
const MODAL_TIMING = {
|
|
14
|
-
open: { duration: 'slow', ease: 'entrance' },
|
|
15
|
-
close: { duration: 'base', ease: 'standard' },
|
|
16
|
-
} as const;
|
|
15
|
+
import { ModalShell, OV_TAKEOVER_TIMING } from '../../internal/overlay/modal';
|
|
16
|
+
import type { ActivateOn } from '../../internal/utils/activation';
|
|
17
17
|
|
|
18
18
|
export interface ModalProps {
|
|
19
19
|
/** Controlled open state. Omit to stay uncontrolled. */
|
|
@@ -23,8 +23,10 @@ export interface ModalProps {
|
|
|
23
23
|
/** Fires whenever the open state changes. Pair with `open` for controlled use. */
|
|
24
24
|
onOpenChange?: (open: boolean) => void;
|
|
25
25
|
|
|
26
|
-
/** Cloned to open the modal
|
|
26
|
+
/** Cloned to open the modal. */
|
|
27
27
|
trigger?: ReactElement | null;
|
|
28
|
+
/** Whether the trigger fires on `pointerdown` (snappier) or waits for `click`. @default 'click' */
|
|
29
|
+
activateOn?: ActivateOn;
|
|
28
30
|
|
|
29
31
|
/** Scrim/Esc dismissal. Default true. */
|
|
30
32
|
dismissible?: boolean;
|
|
@@ -51,6 +53,7 @@ export function Modal({
|
|
|
51
53
|
defaultOpen = false,
|
|
52
54
|
onOpenChange,
|
|
53
55
|
trigger = null,
|
|
56
|
+
activateOn,
|
|
54
57
|
dismissible = true,
|
|
55
58
|
container = null,
|
|
56
59
|
id,
|
|
@@ -64,18 +67,26 @@ export function Modal({
|
|
|
64
67
|
const autoId = useId();
|
|
65
68
|
const panelId = id || 'modal-' + autoId;
|
|
66
69
|
const close = () => setOpen(false);
|
|
67
|
-
const timings = resolveMotionTiming(animation,
|
|
70
|
+
const timings = resolveMotionTiming(animation, OV_TAKEOVER_TIMING);
|
|
68
71
|
|
|
69
72
|
return (
|
|
70
73
|
<Fragment>
|
|
71
|
-
{ovCloneTrigger(trigger, {
|
|
74
|
+
{ovCloneTrigger(trigger, {
|
|
75
|
+
open,
|
|
76
|
+
onPress: () => setOpen(true),
|
|
77
|
+
panelId,
|
|
78
|
+
haspopup: 'dialog',
|
|
79
|
+
triggerRef,
|
|
80
|
+
activateOn,
|
|
81
|
+
})}
|
|
72
82
|
<OverlayPortal container={container}>
|
|
73
83
|
<Presence>
|
|
74
84
|
{open && (
|
|
75
85
|
<ModalShell
|
|
76
86
|
key="modal"
|
|
77
|
-
|
|
78
|
-
|
|
87
|
+
timings={timings}
|
|
88
|
+
animate={popIn(UIMotion.scale.panel, timings.open)}
|
|
89
|
+
exit={popOut(UIMotion.scale.panel, timings.close)}
|
|
79
90
|
layerClass="overlay-layer--modal"
|
|
80
91
|
panelClass="overlay-panel--modal"
|
|
81
92
|
panelId={panelId}
|