@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,713 @@
|
|
|
1
|
+
'use client';import { useMediaQuery } from './chunk-RFRE4WKX.js';
|
|
2
|
+
import { Sheet } from './chunk-227ZW4V7.js';
|
|
3
|
+
import { Popover } from './chunk-CF4QHO4N.js';
|
|
4
|
+
import './chunk-FONOS5RN.js';
|
|
5
|
+
import './chunk-IUQAUBVM.js';
|
|
6
|
+
import './chunk-UE63OOVG.js';
|
|
7
|
+
import './chunk-A5WTZACK.js';
|
|
8
|
+
import './chunk-VAXCXZ53.js';
|
|
9
|
+
import { activationProps, declinePointerDown, pointerDownActivates, clickActivates } from './chunk-JY6A2ZJZ.js';
|
|
10
|
+
import { TextField } from './chunk-TVYH4AN7.js';
|
|
11
|
+
import { useGlide, GlidePill } from './chunk-CNWTIMIP.js';
|
|
12
|
+
import './chunk-HDSFWZ7L.js';
|
|
13
|
+
import './chunk-DDRSMHN4.js';
|
|
14
|
+
import './chunk-TUTXXC3W.js';
|
|
15
|
+
import { Motion } from './chunk-5PZ43DCG.js';
|
|
16
|
+
import './chunk-M43IOM5C.js';
|
|
17
|
+
import { set, animate, measure, flip } from './chunk-IJS7TPGV.js';
|
|
18
|
+
import './chunk-3MPF7FZV.js';
|
|
19
|
+
import './chunk-4BSHB7R3.js';
|
|
20
|
+
import { Icon } from './chunk-EAI4POPB.js';
|
|
21
|
+
import './chunk-MMRIQNEN.js';
|
|
22
|
+
import { UIMotion } from './chunk-7IZJERGA.js';
|
|
23
|
+
import './chunk-45R4Z5XN.js';
|
|
24
|
+
import './chunk-DMX2F6B4.js';
|
|
25
|
+
import './chunk-QGNC7LH5.js';
|
|
26
|
+
import './styles.css';
|
|
27
|
+
import { useState, useImperativeHandle, useMemo, useId, useEffect, useRef, useSyncExternalStore } from 'react';
|
|
28
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
29
|
+
|
|
30
|
+
// src/components/composites/emoji-picker/category-icons.ts
|
|
31
|
+
var CATEGORY_ICONS = {
|
|
32
|
+
recent: '<circle cx="12" cy="12" r="10"/><polyline points="12 6 12 12 16 14"/>',
|
|
33
|
+
"smileys-emotion": '<circle cx="12" cy="12" r="10"/><path d="M8 14s1.5 2 4 2 4-2 4-2"/><line x1="9" x2="9.01" y1="9" y2="9"/><line x1="15" x2="15.01" y1="9" y2="9"/>',
|
|
34
|
+
"people-body": '<path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"/><circle cx="9" cy="7" r="4"/><path d="M22 21v-2a4 4 0 0 0-3-3.87"/><path d="M16 3.13a4 4 0 0 1 0 7.75"/>',
|
|
35
|
+
"animals-nature": '<path d="M11 20A7 7 0 0 1 9.8 6.1C15.5 5 17 4.48 19 2c1 2 2 4.18 2 8 0 5.5-4.78 10-10 10Z"/><path d="M2 21c0-3 1.85-5.36 5.08-6C9.5 14.52 12 13 13 12"/>',
|
|
36
|
+
"food-drink": '<path d="M3 2v7c0 1.1.9 2 2 2h4a2 2 0 0 0 2-2V2"/><path d="M7 2v20"/><path d="M21 15V2a5 5 0 0 0-5 5v6c0 1.1.9 2 2 2h3Zm0 0v7"/>',
|
|
37
|
+
"travel-places": '<path d="M17.8 19.2 16 11l3.5-3.5C21 6 21.5 4 21 3c-1-.5-3 0-4.5 1.5L13 8 4.8 6.2c-.5-.1-.9.1-1.1.5l-.3.5c-.2.5-.1 1 .3 1.3L9 12l-2 3H4l-1 1 3 2 2 3 1-1v-3l3-2 3.5 5.3c.3.4.8.5 1.3.3l.5-.2c.4-.3.6-.7.5-1.2z"/>',
|
|
38
|
+
activities: '<path d="M6 9H4.5a2.5 2.5 0 0 1 0-5H6"/><path d="M18 9h1.5a2.5 2.5 0 0 0 0-5H18"/><path d="M4 22h16"/><path d="M10 14.66V17c0 .55-.47.98-.97 1.21C7.85 18.75 7 20.24 7 22"/><path d="M14 14.66V17c0 .55.47.98.97 1.21C16.15 18.75 17 20.24 17 22"/><path d="M18 2H6v7a6 6 0 0 0 12 0V2Z"/>',
|
|
39
|
+
objects: '<path d="M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5"/><path d="M9 18h6"/><path d="M10 22h4"/>',
|
|
40
|
+
symbols: '<line x1="4" x2="20" y1="9" y2="9"/><line x1="4" x2="20" y1="15" y2="15"/><line x1="10" x2="8" y1="3" y2="21"/><line x1="16" x2="14" y1="3" y2="21"/>',
|
|
41
|
+
flags: '<path d="M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z"/><line x1="4" x2="4" y1="22" y2="15"/>'
|
|
42
|
+
};
|
|
43
|
+
var CATEGORY_ICON_ATTRS = {
|
|
44
|
+
viewBox: "0 0 24 24",
|
|
45
|
+
fill: "none",
|
|
46
|
+
stroke: "currentColor",
|
|
47
|
+
strokeWidth: 2,
|
|
48
|
+
strokeLinecap: "round",
|
|
49
|
+
strokeLinejoin: "round"
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
// src/components/composites/emoji-picker/data.ts
|
|
53
|
+
var _cache = null;
|
|
54
|
+
var _inflight = null;
|
|
55
|
+
var _listeners = /* @__PURE__ */ new Set();
|
|
56
|
+
var _setEmojiData = (data) => {
|
|
57
|
+
_cache = data;
|
|
58
|
+
Object.values(data.emojis);
|
|
59
|
+
for (const cb of _listeners) cb();
|
|
60
|
+
_listeners.clear();
|
|
61
|
+
return data;
|
|
62
|
+
};
|
|
63
|
+
function onEmojiDataLoaded(cb) {
|
|
64
|
+
if (_cache) {
|
|
65
|
+
cb();
|
|
66
|
+
return () => {
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
_listeners.add(cb);
|
|
70
|
+
return () => {
|
|
71
|
+
_listeners.delete(cb);
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
async function loadEmojiData(loader) {
|
|
75
|
+
if (!_inflight) {
|
|
76
|
+
if (typeof loader !== "string") {
|
|
77
|
+
_setEmojiData(loader);
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
_inflight = fetch(loader).then((r) => r.json()).then(_setEmojiData).catch((err) => {
|
|
81
|
+
_inflight = null;
|
|
82
|
+
throw err;
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
return _inflight;
|
|
86
|
+
}
|
|
87
|
+
function getEmojiData() {
|
|
88
|
+
return _cache;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// src/components/composites/emoji-picker/dom.ts
|
|
92
|
+
var COLUMN_COUNT = 8;
|
|
93
|
+
var el = (tag, className) => {
|
|
94
|
+
const node = document.createElement(tag);
|
|
95
|
+
node.className = className;
|
|
96
|
+
return node;
|
|
97
|
+
};
|
|
98
|
+
var attr = (value) => value.replace(/[&<>"]/g, (c) => `&#${c.charCodeAt(0)};`);
|
|
99
|
+
function createEmojiGrid(scroll, getEmojiUrl2, tileIdPrefix) {
|
|
100
|
+
const buttons = [];
|
|
101
|
+
const sections = [];
|
|
102
|
+
const timers = [];
|
|
103
|
+
const swapInNativeGlyph = (e) => {
|
|
104
|
+
const img = e.target;
|
|
105
|
+
if (img.matches?.(".on-emoji-btn-img")) img.parentElement.textContent = img.alt;
|
|
106
|
+
};
|
|
107
|
+
scroll.addEventListener("error", swapInNativeGlyph, true);
|
|
108
|
+
const tile = (emoji, idx, order) => `<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}"><img class="on-emoji-btn-img" src="${attr(getEmojiUrl2(emoji.id, "picker-grid"))}" loading="lazy" draggable="false" alt="${attr(emoji.unicode)}"></button>`;
|
|
109
|
+
const addCategory = (title, key, ids) => {
|
|
110
|
+
const data = getEmojiData();
|
|
111
|
+
if (!data) return;
|
|
112
|
+
const header = el("div", "on-emoji-header");
|
|
113
|
+
header.textContent = title;
|
|
114
|
+
header.setAttribute("aria-hidden", "true");
|
|
115
|
+
scroll.appendChild(header);
|
|
116
|
+
const start = buttons.length;
|
|
117
|
+
const emojis = ids.map((id) => data.emojis[id]).filter(Boolean);
|
|
118
|
+
const grid = el("div", "on-emoji-grid");
|
|
119
|
+
grid.setAttribute("role", "group");
|
|
120
|
+
grid.setAttribute("aria-label", title);
|
|
121
|
+
grid.style.setProperty("--cols", String(COLUMN_COUNT));
|
|
122
|
+
grid.style.setProperty("--rows", String(Math.ceil(emojis.length / COLUMN_COUNT)));
|
|
123
|
+
grid.innerHTML = emojis.map((emoji, i) => tile(emoji, start + i, i)).join("");
|
|
124
|
+
scroll.appendChild(grid);
|
|
125
|
+
buttons.push(...grid.children);
|
|
126
|
+
if (emojis.length) sections.push({ key, header, start, count: emojis.length });
|
|
127
|
+
};
|
|
128
|
+
const indexOfKey = (key) => sections.findIndex((s) => s.key === key);
|
|
129
|
+
const showEmpty = (message) => {
|
|
130
|
+
scroll.insertAdjacentHTML("beforeend", `<div class="on-emoji-empty">${attr(message)}</div>`);
|
|
131
|
+
};
|
|
132
|
+
const clear = () => {
|
|
133
|
+
timers.forEach(clearTimeout);
|
|
134
|
+
timers.length = 0;
|
|
135
|
+
scroll.innerHTML = "";
|
|
136
|
+
buttons.length = 0;
|
|
137
|
+
sections.length = 0;
|
|
138
|
+
};
|
|
139
|
+
const destroy = () => {
|
|
140
|
+
clear();
|
|
141
|
+
scroll.removeEventListener("error", swapInNativeGlyph, true);
|
|
142
|
+
};
|
|
143
|
+
return { buttons, sections, timers, addCategory, showEmpty, clear, indexOfKey, destroy };
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// src/components/composites/emoji-picker/navigation.ts
|
|
147
|
+
var MOVES = {
|
|
148
|
+
ArrowRight: [1, 0],
|
|
149
|
+
ArrowLeft: [-1, 0],
|
|
150
|
+
ArrowDown: [0, 1],
|
|
151
|
+
ArrowUp: [0, -1]
|
|
152
|
+
};
|
|
153
|
+
function createNavigator(buttons, sections, onFocus) {
|
|
154
|
+
let focusedIdx = -1;
|
|
155
|
+
let desiredCol = 0;
|
|
156
|
+
const sectionOf = (idx) => sections.findIndex((s) => idx >= s.start && idx < s.start + s.count);
|
|
157
|
+
const landAt = (si, rowStart, col) => {
|
|
158
|
+
const s = sections[si];
|
|
159
|
+
return s.start + rowStart + Math.min(col, Math.min(COLUMN_COUNT, s.count - rowStart) - 1);
|
|
160
|
+
};
|
|
161
|
+
const focusAt = (next, scroll = true) => {
|
|
162
|
+
if (!buttons.length) return;
|
|
163
|
+
const clamped = Math.max(0, Math.min(next, buttons.length - 1));
|
|
164
|
+
if (clamped === focusedIdx) return;
|
|
165
|
+
onFocus(buttons[clamped]);
|
|
166
|
+
if (scroll) buttons[clamped].scrollIntoView({ block: "nearest", behavior: "smooth" });
|
|
167
|
+
focusedIdx = clamped;
|
|
168
|
+
};
|
|
169
|
+
const setFocus = (next, scroll = true) => {
|
|
170
|
+
focusAt(next, scroll);
|
|
171
|
+
const si = sectionOf(focusedIdx);
|
|
172
|
+
desiredCol = si >= 0 ? (focusedIdx - sections[si].start) % COLUMN_COUNT : 0;
|
|
173
|
+
};
|
|
174
|
+
const move = (dx, dy) => {
|
|
175
|
+
if (focusedIdx < 0) return setFocus(0);
|
|
176
|
+
const si = sectionOf(focusedIdx);
|
|
177
|
+
if (si < 0) return;
|
|
178
|
+
const s = sections[si];
|
|
179
|
+
const local = focusedIdx - s.start;
|
|
180
|
+
const rowStart = local - local % COLUMN_COUNT;
|
|
181
|
+
if (dx) {
|
|
182
|
+
const next = focusedIdx + dx;
|
|
183
|
+
if (next >= s.start && next < s.start + s.count) return setFocus(next);
|
|
184
|
+
if (dx > 0 && si + 1 < sections.length) return setFocus(sections[si + 1].start);
|
|
185
|
+
if (dx < 0 && si > 0) return setFocus(sections[si - 1].start + sections[si - 1].count - 1);
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
const targetRow = rowStart + dy * COLUMN_COUNT;
|
|
189
|
+
if (targetRow >= 0 && targetRow < s.count) focusAt(landAt(si, targetRow, desiredCol));
|
|
190
|
+
else if (dy > 0 && si + 1 < sections.length) focusAt(landAt(si + 1, 0, desiredCol));
|
|
191
|
+
else if (dy < 0 && si > 0) {
|
|
192
|
+
const prev = sections[si - 1];
|
|
193
|
+
focusAt(landAt(si - 1, Math.floor((prev.count - 1) / COLUMN_COUNT) * COLUMN_COUNT, desiredCol));
|
|
194
|
+
} else setFocus(dy > 0 ? buttons.length - 1 : 0);
|
|
195
|
+
};
|
|
196
|
+
const handleKey = (event, onEnter) => {
|
|
197
|
+
if (!buttons.length) return false;
|
|
198
|
+
if (event.key === "Enter") {
|
|
199
|
+
event.preventDefault();
|
|
200
|
+
onEnter();
|
|
201
|
+
return true;
|
|
202
|
+
}
|
|
203
|
+
const delta = MOVES[event.key];
|
|
204
|
+
if (!delta) return false;
|
|
205
|
+
event.preventDefault();
|
|
206
|
+
move(delta[0], delta[1]);
|
|
207
|
+
return true;
|
|
208
|
+
};
|
|
209
|
+
const reset = () => {
|
|
210
|
+
focusedIdx = -1;
|
|
211
|
+
desiredCol = 0;
|
|
212
|
+
onFocus(null);
|
|
213
|
+
};
|
|
214
|
+
return { setFocus, handleKey, reset, getFocusedIdx: () => focusedIdx };
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
// src/components/composites/emoji-picker/scaffold.ts
|
|
218
|
+
var IDLE_CAPTION = "Pick an emoji\u2026";
|
|
219
|
+
var MARKER_OPACITY = 0.6;
|
|
220
|
+
function createScaffold(root, emojiData, getEmojiUrl2, listboxId) {
|
|
221
|
+
const scroll = el("div", "on-emoji-scroll");
|
|
222
|
+
const marker = el("span", "on-emoji-marker");
|
|
223
|
+
const caption = el("div", "on-emoji-caption");
|
|
224
|
+
scroll.id = listboxId;
|
|
225
|
+
scroll.setAttribute("role", "listbox");
|
|
226
|
+
scroll.setAttribute("aria-label", "Emoji");
|
|
227
|
+
caption.innerHTML = '<img class="on-emoji-caption-img" alt="" draggable="false" hidden><span class="on-emoji-caption-name"></span><span class="on-emoji-caption-code"></span>';
|
|
228
|
+
const [captionImg, captionName, captionCode] = caption.children;
|
|
229
|
+
root.className = "on-emoji-body";
|
|
230
|
+
root.append(scroll, caption);
|
|
231
|
+
const setCaption = (btn) => {
|
|
232
|
+
const emoji = btn?.dataset.id ? emojiData.emojis[btn.dataset.id] : null;
|
|
233
|
+
caption.classList.toggle("is-idle", !emoji);
|
|
234
|
+
captionImg.hidden = !emoji;
|
|
235
|
+
captionName.textContent = emoji ? emoji.name : IDLE_CAPTION;
|
|
236
|
+
captionCode.textContent = emoji ? `:${emoji.shortcodes[0] ?? emoji.id}:` : "";
|
|
237
|
+
if (emoji) captionImg.src = getEmojiUrl2(emoji.id, "picker-grid");
|
|
238
|
+
};
|
|
239
|
+
setCaption(null);
|
|
240
|
+
const offsetWithinScroll = (node) => {
|
|
241
|
+
let left = 0;
|
|
242
|
+
let top = 0;
|
|
243
|
+
for (let box = node; box && box !== scroll; box = box.offsetParent) {
|
|
244
|
+
left += box.offsetLeft;
|
|
245
|
+
top += box.offsetTop;
|
|
246
|
+
}
|
|
247
|
+
return { left, top };
|
|
248
|
+
};
|
|
249
|
+
let hadFocus = false;
|
|
250
|
+
const positionMarker = (btn) => {
|
|
251
|
+
if (!btn?.offsetHeight) {
|
|
252
|
+
animate(marker, { opacity: [0], timing: UIMotion.t.exit });
|
|
253
|
+
hadFocus = false;
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
const from = hadFocus ? measure(marker) : null;
|
|
257
|
+
const tile = offsetWithinScroll(btn);
|
|
258
|
+
set(marker, { x: [tile.left], y: [tile.top], width: [btn.offsetWidth], height: [btn.offsetHeight] });
|
|
259
|
+
animate(marker, { opacity: [MARKER_OPACITY], timing: { duration: UIMotion.dur.fast, ease: UIMotion.ease.standard } });
|
|
260
|
+
hadFocus = true;
|
|
261
|
+
if (from && !UIMotion.reduced)
|
|
262
|
+
flip(marker, from, { size: "none", timing: { duration: UIMotion.dur.base, ease: UIMotion.ease.standard } });
|
|
263
|
+
};
|
|
264
|
+
const mountMarker = () => {
|
|
265
|
+
hadFocus = false;
|
|
266
|
+
set(marker, { opacity: [0] });
|
|
267
|
+
scroll.appendChild(marker);
|
|
268
|
+
};
|
|
269
|
+
return { scroll, setCaption, positionMarker, mountMarker };
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
// src/components/composites/emoji-picker/search.ts
|
|
273
|
+
var MAX_RESULTS = 90;
|
|
274
|
+
var splitWords = (s) => s.toLowerCase().split(/[\s_-]+/).filter(Boolean);
|
|
275
|
+
var source = null;
|
|
276
|
+
var index = [];
|
|
277
|
+
var buildIndex = (data) => {
|
|
278
|
+
source = data;
|
|
279
|
+
index = Object.values(data.emojis).map((e) => ({
|
|
280
|
+
id: e.id,
|
|
281
|
+
shortcodes: e.shortcodes.map((s) => s.toLowerCase()),
|
|
282
|
+
words: [.../* @__PURE__ */ new Set([...splitWords(e.name), ...e.shortcodes.flatMap(splitWords)])],
|
|
283
|
+
tagWords: [...new Set(e.tags.flatMap(splitWords))],
|
|
284
|
+
nameLen: e.name.length
|
|
285
|
+
}));
|
|
286
|
+
};
|
|
287
|
+
var rank = (word, t, exact, prefix, mid = 0) => {
|
|
288
|
+
if (word === t) return exact;
|
|
289
|
+
if (word.startsWith(t)) return prefix;
|
|
290
|
+
return mid && t.length >= 3 && word.includes(t) ? mid : 0;
|
|
291
|
+
};
|
|
292
|
+
var scoreToken = (e, t) => {
|
|
293
|
+
let best = 0;
|
|
294
|
+
for (const s of e.shortcodes) best = Math.max(best, rank(s, t, 100, 60));
|
|
295
|
+
if (best === 100) return best;
|
|
296
|
+
for (const w of e.words) best = Math.max(best, rank(w, t, 70, 55, 15));
|
|
297
|
+
for (const w of e.tagWords) best = Math.max(best, rank(w, t, 30, 22));
|
|
298
|
+
return best;
|
|
299
|
+
};
|
|
300
|
+
var getRankedEmojiIds = (query) => {
|
|
301
|
+
const data = getEmojiData();
|
|
302
|
+
if (!data) return [];
|
|
303
|
+
if (source !== data) buildIndex(data);
|
|
304
|
+
const tokens = query.toLowerCase().trim().split(/\s+/).filter(Boolean);
|
|
305
|
+
if (!tokens.length) return [];
|
|
306
|
+
const scored = [];
|
|
307
|
+
for (const e of index) {
|
|
308
|
+
let total = 0;
|
|
309
|
+
for (const t of tokens) {
|
|
310
|
+
const s = scoreToken(e, t);
|
|
311
|
+
if (!s) {
|
|
312
|
+
total = 0;
|
|
313
|
+
break;
|
|
314
|
+
}
|
|
315
|
+
total += s;
|
|
316
|
+
}
|
|
317
|
+
if (total) scored.push({ id: e.id, score: total, nameLen: e.nameLen });
|
|
318
|
+
}
|
|
319
|
+
scored.sort((a, b) => b.score - a.score || a.nameLen - b.nameLen);
|
|
320
|
+
return scored.slice(0, MAX_RESULTS).map((s) => s.id);
|
|
321
|
+
};
|
|
322
|
+
|
|
323
|
+
// src/components/composites/emoji-picker/picker.ts
|
|
324
|
+
var STORAGE_KEY = "recentEmojis";
|
|
325
|
+
var MAX_RECENT = 18;
|
|
326
|
+
var SPY_READING_LINE = 12;
|
|
327
|
+
function createEmojiPicker(root, options) {
|
|
328
|
+
const emojiData = getEmojiData();
|
|
329
|
+
if (!emojiData) throw new Error("Emoji data not found");
|
|
330
|
+
let recent = typeof localStorage !== "undefined" ? JSON.parse(localStorage.getItem(STORAGE_KEY) || "[]") : [];
|
|
331
|
+
let activeKey = null;
|
|
332
|
+
let spyFrame = 0;
|
|
333
|
+
const ui = createScaffold(root, emojiData, options.getEmojiUrl, options.listboxId);
|
|
334
|
+
const area = createEmojiGrid(ui.scroll, options.getEmojiUrl, `${options.listboxId}-o`);
|
|
335
|
+
let activeTile = null;
|
|
336
|
+
const nav = createNavigator(area.buttons, area.sections, (btn) => {
|
|
337
|
+
activeTile?.removeAttribute("aria-selected");
|
|
338
|
+
btn?.setAttribute("aria-selected", "true");
|
|
339
|
+
activeTile = btn;
|
|
340
|
+
const host = options.getFocusHost?.();
|
|
341
|
+
if (btn) host?.setAttribute("aria-activedescendant", btn.id);
|
|
342
|
+
else host?.removeAttribute("aria-activedescendant");
|
|
343
|
+
ui.positionMarker(btn);
|
|
344
|
+
ui.setCaption(btn);
|
|
345
|
+
});
|
|
346
|
+
const spy = () => {
|
|
347
|
+
spyFrame = 0;
|
|
348
|
+
const line = ui.scroll.scrollTop + SPY_READING_LINE;
|
|
349
|
+
let current = 0;
|
|
350
|
+
for (let i = 0; i < area.sections.length; i++) {
|
|
351
|
+
if (area.sections[i].header.offsetTop <= line) current = i;
|
|
352
|
+
else break;
|
|
353
|
+
}
|
|
354
|
+
const key = area.sections[current]?.key ?? null;
|
|
355
|
+
if (key === activeKey) return;
|
|
356
|
+
activeKey = key;
|
|
357
|
+
options.onActiveCategoryChange?.(key);
|
|
358
|
+
};
|
|
359
|
+
const scheduleSpy = () => {
|
|
360
|
+
if (!spyFrame) spyFrame = requestAnimationFrame(spy);
|
|
361
|
+
};
|
|
362
|
+
const selectById = (id) => {
|
|
363
|
+
const shortcode = emojiData.emojis[id]?.shortcodes[0];
|
|
364
|
+
if (!shortcode) return;
|
|
365
|
+
recent = [id, ...recent.filter((x) => x !== id)].slice(0, MAX_RECENT);
|
|
366
|
+
localStorage.setItem(STORAGE_KEY, JSON.stringify(recent));
|
|
367
|
+
options.onSelect(shortcode, id);
|
|
368
|
+
};
|
|
369
|
+
const selectFocused = () => {
|
|
370
|
+
const id = area.buttons[nav.getFocusedIdx()]?.dataset.id;
|
|
371
|
+
if (id) selectById(id);
|
|
372
|
+
};
|
|
373
|
+
const handleMouseMove = (e) => {
|
|
374
|
+
const btn = e.target.closest("button");
|
|
375
|
+
if (btn?.dataset.idx) nav.setFocus(parseInt(btn.dataset.idx));
|
|
376
|
+
};
|
|
377
|
+
const selectPressed = (e) => {
|
|
378
|
+
const btn = e.target.closest("button");
|
|
379
|
+
if (btn?.dataset.id && ui.scroll.contains(btn)) selectById(btn.dataset.id);
|
|
380
|
+
};
|
|
381
|
+
const handlePointerDown = (e) => {
|
|
382
|
+
if (options.getActivateOn?.() !== "pointerdown") return declinePointerDown();
|
|
383
|
+
if (pointerDownActivates(e, true)) selectPressed(e);
|
|
384
|
+
};
|
|
385
|
+
const handleClick = (e) => {
|
|
386
|
+
e.preventDefault();
|
|
387
|
+
if (clickActivates(e)) selectPressed(e);
|
|
388
|
+
};
|
|
389
|
+
ui.scroll.addEventListener("scroll", scheduleSpy, { passive: true });
|
|
390
|
+
ui.scroll.addEventListener("mousemove", handleMouseMove, { passive: true });
|
|
391
|
+
root.addEventListener("pointerdown", handlePointerDown);
|
|
392
|
+
root.addEventListener("click", handleClick);
|
|
393
|
+
const beginRender = (keys) => {
|
|
394
|
+
area.clear();
|
|
395
|
+
nav.reset();
|
|
396
|
+
ui.mountMarker();
|
|
397
|
+
activeKey = null;
|
|
398
|
+
options.onCategoriesChange?.(keys);
|
|
399
|
+
options.onActiveCategoryChange?.(null);
|
|
400
|
+
};
|
|
401
|
+
const renderAll = () => {
|
|
402
|
+
const keys = emojiData.categories.map((c) => c.id);
|
|
403
|
+
const hasRecent = recent.length > 0;
|
|
404
|
+
beginRender(hasRecent ? ["recent", ...keys] : keys);
|
|
405
|
+
if (hasRecent) area.addCategory("Recently Used", "recent", recent);
|
|
406
|
+
let i = 0;
|
|
407
|
+
const step = () => {
|
|
408
|
+
const category = emojiData.categories[i++];
|
|
409
|
+
if (!category) return;
|
|
410
|
+
area.addCategory(category.id.replace("-", " & "), category.id, category.emojis);
|
|
411
|
+
spy();
|
|
412
|
+
area.timers.push(window.setTimeout(step, 200));
|
|
413
|
+
};
|
|
414
|
+
step();
|
|
415
|
+
};
|
|
416
|
+
const renderFiltered = (query) => {
|
|
417
|
+
beginRender([]);
|
|
418
|
+
const ids = getRankedEmojiIds(query);
|
|
419
|
+
if (!ids.length) return area.showEmpty("No emojis found");
|
|
420
|
+
area.addCategory("Results", "search", ids);
|
|
421
|
+
nav.setFocus(0, false);
|
|
422
|
+
};
|
|
423
|
+
const scrollToCategory = (key) => {
|
|
424
|
+
const section = area.sections[area.indexOfKey(key)];
|
|
425
|
+
if (!section) return;
|
|
426
|
+
area.buttons[section.start].scrollIntoView({ block: "start", behavior: "smooth" });
|
|
427
|
+
nav.setFocus(section.start, false);
|
|
428
|
+
};
|
|
429
|
+
const destroy = () => {
|
|
430
|
+
area.destroy();
|
|
431
|
+
if (spyFrame) cancelAnimationFrame(spyFrame);
|
|
432
|
+
ui.scroll.removeEventListener("scroll", scheduleSpy);
|
|
433
|
+
ui.scroll.removeEventListener("mousemove", handleMouseMove);
|
|
434
|
+
root.removeEventListener("pointerdown", handlePointerDown);
|
|
435
|
+
root.removeEventListener("click", handleClick);
|
|
436
|
+
root.innerHTML = "";
|
|
437
|
+
};
|
|
438
|
+
return {
|
|
439
|
+
renderAll,
|
|
440
|
+
renderFiltered,
|
|
441
|
+
scrollToCategory,
|
|
442
|
+
handleKey: (event) => nav.handleKey(event, selectFocused),
|
|
443
|
+
selectFocused,
|
|
444
|
+
destroy
|
|
445
|
+
};
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
// src/components/composites/emoji-picker/react/useEmojiPicker.ts
|
|
449
|
+
var FOCUSABLE = "input, textarea, [tabindex]";
|
|
450
|
+
var NO_CATEGORIES = [];
|
|
451
|
+
var notActive = () => false;
|
|
452
|
+
function createEmojiPickerStore(listboxId, handlers) {
|
|
453
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
454
|
+
const emit = () => listeners.forEach((listener) => listener());
|
|
455
|
+
let api = null;
|
|
456
|
+
let focusHost = null;
|
|
457
|
+
let categories = NO_CATEGORIES;
|
|
458
|
+
let active = null;
|
|
459
|
+
let query = "";
|
|
460
|
+
let drawn = false;
|
|
461
|
+
const draw = () => {
|
|
462
|
+
if (!api) return;
|
|
463
|
+
drawn = true;
|
|
464
|
+
if (query) api.renderFiltered(query);
|
|
465
|
+
else api.renderAll();
|
|
466
|
+
};
|
|
467
|
+
return {
|
|
468
|
+
/** Spread onto the field that drives the picker: combobox roles, already pointing at the grid. */
|
|
469
|
+
searchProps: {
|
|
470
|
+
role: "combobox",
|
|
471
|
+
"aria-expanded": true,
|
|
472
|
+
"aria-autocomplete": "list",
|
|
473
|
+
"aria-controls": listboxId
|
|
474
|
+
},
|
|
475
|
+
/** Callback ref for the element the picker takes over. The grid is built the moment the node
|
|
476
|
+
* arrives, which for a popover is a commit or two after the hook first ran. */
|
|
477
|
+
mount: (node) => {
|
|
478
|
+
api?.destroy();
|
|
479
|
+
drawn = false;
|
|
480
|
+
api = node ? createEmojiPicker(node, {
|
|
481
|
+
listboxId,
|
|
482
|
+
getEmojiUrl: (...args) => handlers.getEmojiUrl(...args),
|
|
483
|
+
getFocusHost: () => focusHost,
|
|
484
|
+
getActivateOn: () => handlers.activateOn,
|
|
485
|
+
onSelect: (...args) => handlers.onSelect(...args),
|
|
486
|
+
onCategoriesChange: (keys) => {
|
|
487
|
+
categories = keys;
|
|
488
|
+
emit();
|
|
489
|
+
},
|
|
490
|
+
onActiveCategoryChange: (key) => {
|
|
491
|
+
active = key;
|
|
492
|
+
emit();
|
|
493
|
+
}
|
|
494
|
+
}) : null;
|
|
495
|
+
draw();
|
|
496
|
+
},
|
|
497
|
+
/** Callback ref for the field that keeps focus while the grid is navigated, or anything wrapping it.
|
|
498
|
+
* The picker moves `aria-activedescendant` on it directly, so running the marker down 1900 tiles
|
|
499
|
+
* never costs a render. */
|
|
500
|
+
searchRef: (node) => {
|
|
501
|
+
focusHost = node?.matches(FOCUSABLE) ? node : node?.querySelector(FOCUSABLE) ?? null;
|
|
502
|
+
},
|
|
503
|
+
setHandlers: (next) => {
|
|
504
|
+
handlers = next;
|
|
505
|
+
},
|
|
506
|
+
subscribe: (listener) => {
|
|
507
|
+
listeners.add(listener);
|
|
508
|
+
return () => {
|
|
509
|
+
listeners.delete(listener);
|
|
510
|
+
};
|
|
511
|
+
},
|
|
512
|
+
getCategories: () => categories,
|
|
513
|
+
isActive: (key) => active === key,
|
|
514
|
+
render: (next = "") => {
|
|
515
|
+
if (drawn && next === query) return;
|
|
516
|
+
query = next;
|
|
517
|
+
draw();
|
|
518
|
+
},
|
|
519
|
+
scrollToCategory: (key) => api?.scrollToCategory(key),
|
|
520
|
+
/** Redraw the full category grid, dropping whatever query was showing. */
|
|
521
|
+
renderAll: () => {
|
|
522
|
+
query = "";
|
|
523
|
+
draw();
|
|
524
|
+
},
|
|
525
|
+
/** Redraw the grid as the ranked results for `next`, with the first hit already marked. */
|
|
526
|
+
renderFiltered: (next) => {
|
|
527
|
+
query = next;
|
|
528
|
+
draw();
|
|
529
|
+
},
|
|
530
|
+
/** Feed a key event from your own field into the grid - arrows move, Enter picks.
|
|
531
|
+
* Returns true when the grid consumed the key, so you can leave the rest to your input. */
|
|
532
|
+
handleKey: (event) => api?.handleKey(event) ?? false,
|
|
533
|
+
/** Commit the tile the marker is on, exactly as a click on it would. */
|
|
534
|
+
selectFocused: () => api?.selectFocused()
|
|
535
|
+
};
|
|
536
|
+
}
|
|
537
|
+
function useEmojiPicker({ onSelect, getEmojiUrl: getEmojiUrl2, query, activateOn }) {
|
|
538
|
+
const listboxId = useId();
|
|
539
|
+
const store = useMemo(() => createEmojiPickerStore(listboxId, { onSelect, getEmojiUrl: getEmojiUrl2 }), [listboxId]);
|
|
540
|
+
useEffect(() => {
|
|
541
|
+
store.setHandlers({ onSelect, getEmojiUrl: getEmojiUrl2, activateOn });
|
|
542
|
+
});
|
|
543
|
+
useEffect(() => {
|
|
544
|
+
store.render(query);
|
|
545
|
+
}, [store, query]);
|
|
546
|
+
return store;
|
|
547
|
+
}
|
|
548
|
+
var useCategories = (store) => useSyncExternalStore(store.subscribe, store.getCategories, store.getCategories);
|
|
549
|
+
var useIsActiveCategory = (store, key) => useSyncExternalStore(store.subscribe, () => store.isActive(key), notActive);
|
|
550
|
+
var RAIL_GLIDE = { timing: { duration: UIMotion.dur.base, ease: UIMotion.ease.standard } };
|
|
551
|
+
function Category({ store, categoryKey, railId, glide, activateOn }) {
|
|
552
|
+
const isActive = useIsActiveCategory(store, categoryKey);
|
|
553
|
+
return /* @__PURE__ */ jsxs(
|
|
554
|
+
"button",
|
|
555
|
+
{
|
|
556
|
+
type: "button",
|
|
557
|
+
className: isActive ? "on-emoji-cat on-emoji-cat--active" : "on-emoji-cat",
|
|
558
|
+
"aria-label": categoryKey.replace(/-/g, " "),
|
|
559
|
+
"aria-current": isActive ? true : void 0,
|
|
560
|
+
onPointerEnter: (e) => glide.enter(e.currentTarget),
|
|
561
|
+
...activationProps(() => store.scrollToCategory(categoryKey), {
|
|
562
|
+
on: activateOn,
|
|
563
|
+
holdFocus: true
|
|
564
|
+
}),
|
|
565
|
+
children: [
|
|
566
|
+
/* @__PURE__ */ jsx(
|
|
567
|
+
"svg",
|
|
568
|
+
{
|
|
569
|
+
...CATEGORY_ICON_ATTRS,
|
|
570
|
+
dangerouslySetInnerHTML: { __html: CATEGORY_ICONS[categoryKey] ?? CATEGORY_ICONS.symbols }
|
|
571
|
+
}
|
|
572
|
+
),
|
|
573
|
+
isActive && /* @__PURE__ */ jsx(
|
|
574
|
+
Motion,
|
|
575
|
+
{
|
|
576
|
+
as: "span",
|
|
577
|
+
layoutId: railId,
|
|
578
|
+
layoutTransition: RAIL_GLIDE,
|
|
579
|
+
className: "on-emoji-cat-rail",
|
|
580
|
+
"aria-hidden": "true"
|
|
581
|
+
}
|
|
582
|
+
)
|
|
583
|
+
]
|
|
584
|
+
}
|
|
585
|
+
);
|
|
586
|
+
}
|
|
587
|
+
function CategoryBar({ store, activateOn }) {
|
|
588
|
+
const barRef = useRef(null);
|
|
589
|
+
const glide = useGlide(barRef);
|
|
590
|
+
const railId = useId();
|
|
591
|
+
const categories = useCategories(store);
|
|
592
|
+
if (!categories.length) return null;
|
|
593
|
+
return /* @__PURE__ */ jsxs(
|
|
594
|
+
"div",
|
|
595
|
+
{
|
|
596
|
+
ref: barRef,
|
|
597
|
+
className: "on-emoji-bar",
|
|
598
|
+
onPointerLeave: glide.leave,
|
|
599
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
600
|
+
role: "group",
|
|
601
|
+
"aria-label": "Emoji categories",
|
|
602
|
+
children: [
|
|
603
|
+
/* @__PURE__ */ jsx(GlidePill, { className: "on-emoji-bar-marker", glide }),
|
|
604
|
+
categories.map((key) => /* @__PURE__ */ jsx(Category, { store, categoryKey: key, railId, glide, activateOn }, key))
|
|
605
|
+
]
|
|
606
|
+
}
|
|
607
|
+
);
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
// src/components/composites/emoji-picker/getEmojiUrl.ts
|
|
611
|
+
var TWEMOJI = "https://cdn.jsdelivr.net/gh/jdecked/twemoji@latest/assets";
|
|
612
|
+
var NOTO_ANIMATED = "https://fonts.gstatic.com/s/e/notoemoji/latest";
|
|
613
|
+
var getEmojiUrl = (hexId, source2) => {
|
|
614
|
+
const lower = hexId.toLowerCase();
|
|
615
|
+
switch (source2) {
|
|
616
|
+
case "inline":
|
|
617
|
+
return `${TWEMOJI}/svg/${lower}.svg`;
|
|
618
|
+
case "picker-grid":
|
|
619
|
+
return `${TWEMOJI}/72x72/${lower}.png`;
|
|
620
|
+
case "category-bar":
|
|
621
|
+
case "callout-icon":
|
|
622
|
+
return `${NOTO_ANIMATED}/${lower.replace(/-/g, "_")}/512.webp`;
|
|
623
|
+
}
|
|
624
|
+
};
|
|
625
|
+
var SHEET_BREAKPOINT = "(max-width: 40rem)";
|
|
626
|
+
var inflate = (anchor, by) => {
|
|
627
|
+
if (!anchor || !by) return anchor ?? null;
|
|
628
|
+
return {
|
|
629
|
+
getBoundingClientRect: () => {
|
|
630
|
+
const r = anchor.getBoundingClientRect();
|
|
631
|
+
return new DOMRect(r.x - by, r.y - by, r.width + by * 2, r.height + by * 2);
|
|
632
|
+
}
|
|
633
|
+
};
|
|
634
|
+
};
|
|
635
|
+
function EmojiPickerPanel({
|
|
636
|
+
open,
|
|
637
|
+
onOpenChange,
|
|
638
|
+
onSelect,
|
|
639
|
+
getEmojiUrl: getEmojiUrl2,
|
|
640
|
+
trigger = null,
|
|
641
|
+
offset = 0,
|
|
642
|
+
search = false,
|
|
643
|
+
query,
|
|
644
|
+
activateOn,
|
|
645
|
+
breakpoint = SHEET_BREAKPOINT,
|
|
646
|
+
popoverProps,
|
|
647
|
+
sheetProps,
|
|
648
|
+
className,
|
|
649
|
+
ref
|
|
650
|
+
}) {
|
|
651
|
+
const asSheet = useMediaQuery(breakpoint);
|
|
652
|
+
const [ownQuery, setOwnQuery] = useState("");
|
|
653
|
+
const drivenFromOutside = !asSheet && query !== void 0;
|
|
654
|
+
const picker = useEmojiPicker({ onSelect, getEmojiUrl: getEmojiUrl2, query: drivenFromOutside ? query : ownQuery, activateOn });
|
|
655
|
+
useImperativeHandle(ref, () => picker, [picker]);
|
|
656
|
+
const { mount, searchRef, searchProps, handleKey } = picker;
|
|
657
|
+
const anchor = popoverProps?.anchor;
|
|
658
|
+
const positioned = useMemo(() => inflate(anchor, offset), [anchor, offset]);
|
|
659
|
+
const frame = /* @__PURE__ */ jsxs("div", { className: ["on-emoji", asSheet && "on-emoji--sheet", className].filter(Boolean).join(" "), children: [
|
|
660
|
+
asSheet || search ? /* @__PURE__ */ jsx("div", { className: "on-emoji-search", ref: searchRef, children: /* @__PURE__ */ jsx(
|
|
661
|
+
TextField,
|
|
662
|
+
{
|
|
663
|
+
size: "sm",
|
|
664
|
+
type: "search",
|
|
665
|
+
clearable: true,
|
|
666
|
+
placeholder: "Search emoji",
|
|
667
|
+
leadingIcon: /* @__PURE__ */ jsx(Icon, { name: "magnifying-glass", size: "sm" }),
|
|
668
|
+
value: ownQuery,
|
|
669
|
+
onChange: (e) => setOwnQuery(e.target.value),
|
|
670
|
+
onKeyDown: (e) => {
|
|
671
|
+
const horizontal = e.key === "ArrowLeft" || e.key === "ArrowRight";
|
|
672
|
+
if (horizontal && e.currentTarget.value) return;
|
|
673
|
+
if (e.key.startsWith("Arrow") || e.key === "Enter") handleKey(e.nativeEvent);
|
|
674
|
+
},
|
|
675
|
+
htmlProps: { ...searchProps, autoFocus: true, spellCheck: false, "aria-label": "Search emoji" }
|
|
676
|
+
}
|
|
677
|
+
) }) : null,
|
|
678
|
+
/* @__PURE__ */ jsx(CategoryBar, { store: picker, activateOn }),
|
|
679
|
+
/* @__PURE__ */ jsx("div", { ref: mount })
|
|
680
|
+
] });
|
|
681
|
+
return asSheet ? /* @__PURE__ */ jsx(
|
|
682
|
+
Sheet,
|
|
683
|
+
{
|
|
684
|
+
...sheetProps,
|
|
685
|
+
open,
|
|
686
|
+
onOpenChange,
|
|
687
|
+
side: "bottom",
|
|
688
|
+
trigger,
|
|
689
|
+
activateOn,
|
|
690
|
+
htmlProps: { className: "on-emoji-sheet" },
|
|
691
|
+
children: /* @__PURE__ */ jsx("div", { role: "dialog", "aria-label": "Emoji picker", children: frame })
|
|
692
|
+
}
|
|
693
|
+
) : /* @__PURE__ */ jsx(
|
|
694
|
+
Popover,
|
|
695
|
+
{
|
|
696
|
+
side: "right",
|
|
697
|
+
align: "center",
|
|
698
|
+
...popoverProps,
|
|
699
|
+
anchor: positioned,
|
|
700
|
+
open,
|
|
701
|
+
onOpenChange,
|
|
702
|
+
trigger,
|
|
703
|
+
activateOn,
|
|
704
|
+
animation: { ease: { open: "exit" } },
|
|
705
|
+
htmlProps: { className: "on-emoji-pop", "aria-label": "Emoji picker" },
|
|
706
|
+
children: frame
|
|
707
|
+
}
|
|
708
|
+
);
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
export { EmojiPickerPanel, SHEET_BREAKPOINT, getEmojiUrl, loadEmojiData, onEmojiDataLoaded };
|
|
712
|
+
//# sourceMappingURL=emoji-picker.js.map
|
|
713
|
+
//# sourceMappingURL=emoji-picker.js.map
|