emoji-picker-react 4.22.3 → 5.0.1
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 +331 -49
- package/dist/DomUtils/categoryNameFromDom.d.ts +1 -1
- package/dist/DomUtils/classNames.d.ts +23 -23
- package/dist/DomUtils/detectEmojyPartiallyBelowFold.d.ts +2 -2
- package/dist/DomUtils/elementPositionInRow.d.ts +5 -5
- package/dist/DomUtils/eventBelongsToPicker.d.ts +2 -0
- package/dist/DomUtils/focusElement.d.ts +5 -5
- package/dist/DomUtils/getActiveElement.d.ts +2 -2
- package/dist/DomUtils/isJsdom.d.ts +1 -0
- package/dist/DomUtils/isRtl.d.ts +1 -0
- package/dist/DomUtils/keyboardNavigation.d.ts +15 -8
- package/dist/DomUtils/scrollTo.d.ts +4 -5
- package/dist/DomUtils/selectors.d.ts +31 -35
- package/dist/EmojiPickerReact.d.ts +5 -5
- package/dist/Stylesheet/DedupedStyle.d.ts +13 -0
- package/dist/Stylesheet/stylesheet.d.ts +40 -37
- package/dist/components/ErrorBoundary.d.ts +15 -15
- package/dist/components/Layout/Absolute.d.ts +8 -8
- package/dist/components/Layout/Flex.d.ts +13 -13
- package/dist/components/Layout/Relative.d.ts +8 -8
- package/dist/components/Layout/Space.d.ts +7 -7
- package/dist/components/Reactions/BtnPlus.d.ts +2 -2
- package/dist/components/Reactions/DEFAULT_REACTIONS.d.ts +1 -1
- package/dist/components/Reactions/Reactions.d.ts +3 -2
- package/dist/components/atoms/Button.d.ts +11 -6
- package/dist/components/body/EmojiCategory.d.ts +13 -12
- package/dist/components/body/EmojiList.d.ts +7 -4
- package/dist/components/body/EmojiVariationPicker.d.ts +2 -2
- package/dist/components/body/MeasureEmoji.d.ts +2 -2
- package/dist/components/body/listComponents.d.ts +47 -0
- package/dist/components/context/ElementRefContext.d.ts +18 -16
- package/dist/components/context/PickerConfigContext.d.ts +14 -9
- package/dist/components/context/PickerContext.d.ts +57 -25
- package/dist/components/context/PickerDataContext.d.ts +23 -17
- package/dist/components/emoji/BaseEmojiProps.d.ts +14 -13
- package/dist/components/emoji/ClickableEmojiButton.d.ts +23 -15
- package/dist/components/emoji/Emoji.d.ts +18 -15
- package/dist/components/emoji/EmojiImg.d.ts +11 -11
- package/dist/components/emoji/ExportedEmoji.d.ts +11 -11
- package/dist/components/emoji/NativeEmoji.d.ts +6 -6
- package/dist/components/emoji/ViewOnlyEmoji.d.ts +3 -3
- package/dist/components/emoji/emojiStyles.d.ts +6 -1
- package/dist/components/footer/Preview.d.ts +7 -7
- package/dist/components/header/Header.d.ts +2 -2
- package/dist/components/header/Search/BtnClearSearch.d.ts +2 -2
- package/dist/components/header/Search/IcnSearch.d.ts +2 -2
- package/dist/components/header/Search/Search.d.ts +11 -3
- package/dist/components/header/SkinTonePicker/BtnSkinToneVariation.d.ts +12 -12
- package/dist/components/header/SkinTonePicker/SkinTonePicker.d.ts +11 -11
- package/dist/components/icons/svgIcons.d.ts +4 -0
- package/dist/components/main/PickerMainBehaviors.d.ts +4 -0
- package/dist/components/main/defaultAppearance.d.ts +12 -0
- package/dist/components/main/labelHeight.d.ts +1 -0
- package/dist/components/navigation/CategoryButton.d.ts +12 -12
- package/dist/components/navigation/CategoryNavIcon.d.ts +4 -4
- package/dist/components/navigation/CategoryNavigation.d.ts +19 -2
- package/dist/config/categoryConfig.d.ts +34 -34
- package/dist/config/cdnUrls.d.ts +2 -2
- package/dist/config/compareConfig.d.ts +10 -2
- package/dist/config/config.d.ts +166 -64
- package/dist/config/customEmojiConfig.d.ts +14 -14
- package/dist/config/defaultPickerConfiguration.d.ts +10 -0
- package/dist/config/mutableConfig.d.ts +32 -10
- package/dist/config/useConfig.d.ts +48 -36
- package/dist/data/defaultEmojiData.d.ts +9 -0
- package/dist/data/defaultEmojiData.js +40 -0
- package/dist/data/emojis-bn.d.mts +39 -0
- package/dist/data/emojis-bn.d.ts +38 -2
- package/dist/data/emojis-bn.js +25 -2
- package/dist/data/emojis-bn.mjs +2 -0
- package/dist/data/emojis-da.d.mts +39 -0
- package/dist/data/emojis-da.d.ts +38 -2
- package/dist/data/emojis-da.js +25 -2
- package/dist/data/emojis-da.mjs +2 -0
- package/dist/data/emojis-de.d.mts +39 -0
- package/dist/data/emojis-de.d.ts +38 -2
- package/dist/data/emojis-de.js +25 -2
- package/dist/data/emojis-de.mjs +2 -0
- package/dist/data/emojis-en-gb.d.mts +39 -0
- package/dist/data/emojis-en-gb.d.ts +38 -2
- package/dist/data/emojis-en-gb.js +25 -2
- package/dist/data/emojis-en-gb.mjs +2 -0
- package/dist/data/emojis-en.d.mts +39 -0
- package/dist/data/emojis-en.d.ts +38 -2
- package/dist/data/emojis-en.js +25 -2
- package/dist/data/emojis-en.mjs +2 -0
- package/dist/data/emojis-es-mx.d.mts +39 -0
- package/dist/data/emojis-es-mx.d.ts +38 -2
- package/dist/data/emojis-es-mx.js +25 -2
- package/dist/data/emojis-es-mx.mjs +2 -0
- package/dist/data/emojis-es.d.mts +39 -0
- package/dist/data/emojis-es.d.ts +38 -2
- package/dist/data/emojis-es.js +25 -2
- package/dist/data/emojis-es.mjs +2 -0
- package/dist/data/emojis-et.d.mts +39 -0
- package/dist/data/emojis-et.d.ts +38 -2
- package/dist/data/emojis-et.js +25 -2
- package/dist/data/emojis-et.mjs +2 -0
- package/dist/data/emojis-fi.d.mts +39 -0
- package/dist/data/emojis-fi.d.ts +38 -2
- package/dist/data/emojis-fi.js +25 -2
- package/dist/data/emojis-fi.mjs +2 -0
- package/dist/data/emojis-fr.d.mts +39 -0
- package/dist/data/emojis-fr.d.ts +38 -2
- package/dist/data/emojis-fr.js +25 -2
- package/dist/data/emojis-fr.mjs +2 -0
- package/dist/data/emojis-hi.d.mts +39 -0
- package/dist/data/emojis-hi.d.ts +38 -2
- package/dist/data/emojis-hi.js +25 -2
- package/dist/data/emojis-hi.mjs +2 -0
- package/dist/data/emojis-hu.d.mts +39 -0
- package/dist/data/emojis-hu.d.ts +38 -2
- package/dist/data/emojis-hu.js +25 -2
- package/dist/data/emojis-hu.mjs +2 -0
- package/dist/data/emojis-it.d.mts +39 -0
- package/dist/data/emojis-it.d.ts +38 -2
- package/dist/data/emojis-it.js +25 -2
- package/dist/data/emojis-it.mjs +2 -0
- package/dist/data/emojis-ja.d.mts +39 -0
- package/dist/data/emojis-ja.d.ts +38 -2
- package/dist/data/emojis-ja.js +25 -2
- package/dist/data/emojis-ja.mjs +2 -0
- package/dist/data/emojis-ko.d.mts +39 -0
- package/dist/data/emojis-ko.d.ts +38 -2
- package/dist/data/emojis-ko.js +25 -2
- package/dist/data/emojis-ko.mjs +2 -0
- package/dist/data/emojis-lt.d.mts +39 -0
- package/dist/data/emojis-lt.d.ts +38 -2
- package/dist/data/emojis-lt.js +25 -2
- package/dist/data/emojis-lt.mjs +2 -0
- package/dist/data/emojis-ms.d.mts +39 -0
- package/dist/data/emojis-ms.d.ts +38 -2
- package/dist/data/emojis-ms.js +25 -2
- package/dist/data/emojis-ms.mjs +2 -0
- package/dist/data/emojis-nb.d.mts +39 -0
- package/dist/data/emojis-nb.d.ts +38 -2
- package/dist/data/emojis-nb.js +25 -2
- package/dist/data/emojis-nb.mjs +2 -0
- package/dist/data/emojis-nl.d.mts +39 -0
- package/dist/data/emojis-nl.d.ts +38 -2
- package/dist/data/emojis-nl.js +25 -2
- package/dist/data/emojis-nl.mjs +2 -0
- package/dist/data/emojis-pl.d.mts +39 -0
- package/dist/data/emojis-pl.d.ts +38 -2
- package/dist/data/emojis-pl.js +25 -2
- package/dist/data/emojis-pl.mjs +2 -0
- package/dist/data/emojis-pt.d.mts +39 -0
- package/dist/data/emojis-pt.d.ts +38 -2
- package/dist/data/emojis-pt.js +25 -2
- package/dist/data/emojis-pt.mjs +2 -0
- package/dist/data/emojis-ru.d.mts +39 -0
- package/dist/data/emojis-ru.d.ts +38 -2
- package/dist/data/emojis-ru.js +25 -2
- package/dist/data/emojis-ru.mjs +2 -0
- package/dist/data/emojis-sv.d.mts +39 -0
- package/dist/data/emojis-sv.d.ts +38 -2
- package/dist/data/emojis-sv.js +25 -2
- package/dist/data/emojis-sv.mjs +2 -0
- package/dist/data/emojis-th.d.mts +39 -0
- package/dist/data/emojis-th.d.ts +38 -2
- package/dist/data/emojis-th.js +25 -2
- package/dist/data/emojis-th.mjs +2 -0
- package/dist/data/emojis-uk.d.mts +39 -0
- package/dist/data/emojis-uk.d.ts +38 -2
- package/dist/data/emojis-uk.js +25 -2
- package/dist/data/emojis-uk.mjs +2 -0
- package/dist/data/emojis-vi.d.mts +39 -0
- package/dist/data/emojis-vi.d.ts +38 -2
- package/dist/data/emojis-vi.js +25 -2
- package/dist/data/emojis-vi.mjs +2 -0
- package/dist/data/emojis-zh-hant.d.mts +39 -0
- package/dist/data/emojis-zh-hant.d.ts +38 -2
- package/dist/data/emojis-zh-hant.js +25 -2
- package/dist/data/emojis-zh-hant.mjs +2 -0
- package/dist/data/emojis-zh.d.mts +39 -0
- package/dist/data/emojis-zh.d.ts +38 -2
- package/dist/data/emojis-zh.js +25 -2
- package/dist/data/emojis-zh.mjs +2 -0
- package/dist/data/index.js +1 -0
- package/dist/data/registerDefaultEmojiData.d.ts +1 -0
- package/dist/data/registerDefaultEmojiData.js +3 -0
- package/dist/data/skinToneVariations.js +2 -2
- package/dist/data/skinToneVariations.ts +8 -7
- package/dist/data-core/pickerData.d.ts +12 -0
- package/dist/data-core/prepare.d.ts +23 -0
- package/dist/data-core/search.d.ts +13 -0
- package/dist/data-core/types.d.ts +23 -0
- package/dist/data.d.mts +72 -0
- package/dist/data.d.ts +72 -0
- package/dist/dataUtils/DataTypes.d.ts +23 -19
- package/dist/dataUtils/emojiSelectors.d.ts +15 -16
- package/dist/dataUtils/emojiUtils.d.ts +1 -12
- package/dist/dataUtils/nativeEmojiSequenceSupport.d.ts +10 -0
- package/dist/dataUtils/nativeEmojiSupport.d.ts +40 -0
- package/dist/dataUtils/parseNativeEmoji.d.ts +1 -1
- package/dist/dataUtils/suggested.d.ts +11 -11
- package/dist/dataUtils/suggestedEmojis.d.ts +7 -0
- package/dist/esm/chunks/chunk-7ZGTUZFB.mjs +8025 -0
- package/dist/esm/chunks/chunk-ACXAQEKG.mjs +149 -0
- package/dist/esm/chunks/chunk-F2KS7DCA.mjs +6735 -0
- package/dist/esm/chunks/chunk-L5W4PFRJ.mjs +14 -0
- package/dist/esm/chunks/chunk-LO4TPPLH.mjs +33 -0
- package/dist/esm/chunks/emojis-6L3GRBAP.mjs +7 -0
- package/dist/esm/data.mjs +11 -0
- package/dist/esm/index.mjs +279 -0
- package/dist/esm/primitives/index.mjs +8 -0
- package/dist/hooks/preloadEmoji.d.ts +5 -9
- package/dist/hooks/useActiveCategoryScrollDetection.d.ts +11 -11
- package/dist/hooks/useCategoryHeight.d.ts +7 -5
- package/dist/hooks/useCloseAllOpenToggles.d.ts +2 -2
- package/dist/hooks/useDataIdentityStabilityWarning.d.ts +13 -0
- package/dist/hooks/useDebouncedState.d.ts +1 -1
- package/dist/hooks/useDisallowMouseMove.d.ts +4 -4
- package/dist/hooks/useDisallowedEmojis.d.ts +2 -3
- package/dist/hooks/useEmojiPreviewEvents.d.ts +3 -3
- package/dist/hooks/useEmojiVirtualization.d.ts +22 -17
- package/dist/hooks/useFilter.d.ts +10 -16
- package/dist/hooks/useFocus.d.ts +3 -3
- package/dist/hooks/useInitialLoad.d.ts +2 -2
- package/dist/hooks/useIsEmojiHidden.d.ts +8 -8
- package/dist/hooks/useIsMounted.d.ts +1 -1
- package/dist/hooks/useIsSearchMode.d.ts +1 -1
- package/dist/hooks/useIsomorphicLayoutEffect.d.ts +2 -2
- package/dist/hooks/useKeyboardNavigation.d.ts +3 -1
- package/dist/hooks/useMouseDownHandlers.d.ts +8 -4
- package/dist/hooks/useOnFocus.d.ts +1 -1
- package/dist/hooks/useOnScroll.d.ts +2 -2
- package/dist/hooks/useReactionsFocus.d.ts +1 -0
- package/dist/hooks/useRegisterRegion.d.ts +24 -0
- package/dist/hooks/useResolvedEmojiData.d.ts +37 -0
- package/dist/hooks/useScrollCategoryIntoView.d.ts +1 -1
- package/dist/hooks/useSearchController.d.ts +17 -0
- package/dist/hooks/useSearchResults.d.ts +8 -0
- package/dist/hooks/useSetVariationPicker.d.ts +2 -2
- package/dist/hooks/useShouldHideCustomEmojis.d.ts +1 -1
- package/dist/hooks/useShouldShowSkinTonePicker.d.ts +4 -4
- package/dist/index.d.mts +376 -0
- package/dist/index.d.ts +376 -9
- package/dist/index.js +2 -8
- package/dist/primitives/CategoryNav.d.ts +4 -0
- package/dist/primitives/Empty.d.ts +6 -0
- package/dist/primitives/List.d.ts +4 -0
- package/dist/primitives/LoadError.d.ts +8 -0
- package/dist/primitives/Loading.d.ts +4 -0
- package/dist/primitives/Panel.d.ts +3 -0
- package/dist/primitives/Preview.d.ts +3 -0
- package/dist/primitives/Reactions.d.ts +2 -0
- package/dist/primitives/Root.d.ts +26 -0
- package/dist/primitives/Search.d.ts +5 -0
- package/dist/primitives/SearchInput.d.ts +3 -0
- package/dist/primitives/SkinTone.d.ts +4 -0
- package/dist/primitives/Viewport.d.ts +19 -0
- package/dist/primitives/appearance.d.ts +3 -0
- package/dist/primitives/components.d.ts +27 -0
- package/dist/primitives/hooks.d.ts +48 -0
- package/dist/primitives/index.d.mts +561 -0
- package/dist/primitives/index.d.ts +561 -0
- package/dist/primitives/index.js +2 -0
- package/dist/primitives/nativeProps.d.ts +15 -0
- package/dist/primitives/scope.d.ts +13 -0
- package/dist/primitives/structuralStyles.d.ts +16 -0
- package/dist/primitives/tokens.d.ts +18 -0
- package/dist/primitives/types.d.ts +85 -0
- package/dist/state/activeEmojiStore.d.ts +7 -0
- package/dist/state/navigationRegistry.d.ts +61 -0
- package/dist/state/regionTraversal.d.ts +20 -0
- package/dist/typeRefinements/typeRefinements.d.ts +6 -6
- package/dist/types/exposedTypes.d.ts +16 -6
- package/dist/types/exposedTypes.js +5 -0
- package/dist/virtualization/virtualizationHelpers.d.ts +22 -18
- package/llms-full.txt +3683 -0
- package/llms.txt +66 -480
- package/package.json +180 -66
- package/src/DomUtils/categoryNameFromDom.ts +1 -1
- package/src/DomUtils/classNames.ts +1 -4
- package/src/DomUtils/elementPositionInRow.ts +28 -6
- package/src/DomUtils/eventBelongsToPicker.ts +17 -0
- package/src/DomUtils/getActiveElement.ts +7 -1
- package/src/DomUtils/isJsdom.ts +12 -0
- package/src/DomUtils/isRtl.ts +5 -0
- package/src/DomUtils/keyboardNavigation.ts +164 -144
- package/src/DomUtils/scrollTo.ts +20 -18
- package/src/DomUtils/selectors.ts +30 -127
- package/src/EmojiPickerReact.tsx +155 -48
- package/src/Stylesheet/DedupedStyle.tsx +80 -0
- package/src/Stylesheet/stylesheet.tsx +128 -59
- package/src/components/Layout/Flex.tsx +12 -11
- package/src/components/Reactions/BtnPlus.tsx +61 -51
- package/src/components/Reactions/Reactions.tsx +113 -55
- package/src/components/atoms/Button.tsx +18 -15
- package/src/components/body/EmojiCategory.tsx +77 -40
- package/src/components/body/EmojiList.tsx +107 -44
- package/src/components/body/EmojiVariationPicker.tsx +113 -66
- package/src/components/body/MeasureEmoji.tsx +9 -2
- package/src/components/body/listComponents.tsx +79 -0
- package/src/components/context/ElementRefContext.tsx +46 -35
- package/src/components/context/PickerConfigContext.tsx +55 -40
- package/src/components/context/PickerContext.tsx +567 -92
- package/src/components/context/PickerDataContext.tsx +114 -99
- package/src/components/emoji/BaseEmojiProps.ts +5 -4
- package/src/components/emoji/ClickableEmojiButton.tsx +148 -63
- package/src/components/emoji/Emoji.tsx +24 -2
- package/src/components/emoji/EmojiImg.tsx +13 -12
- package/src/components/emoji/ExportedEmoji.tsx +5 -4
- package/src/components/emoji/NativeEmoji.tsx +19 -16
- package/src/components/emoji/ViewOnlyEmoji.tsx +55 -30
- package/src/components/emoji/emojiStyles.ts +12 -11
- package/src/components/footer/Preview.tsx +86 -91
- package/src/components/header/Header.tsx +21 -6
- package/src/components/header/Search/BtnClearSearch.tsx +69 -55
- package/src/components/header/Search/IcnSearch.tsx +21 -21
- package/src/components/header/Search/Search.tsx +79 -137
- package/src/components/header/SkinTonePicker/BtnSkinToneVariation.tsx +99 -62
- package/src/components/header/SkinTonePicker/SkinTonePicker.tsx +84 -46
- package/src/components/icons/svgIcons.ts +17 -0
- package/src/components/main/PickerMainBehaviors.tsx +163 -0
- package/src/components/main/defaultAppearance.tsx +189 -0
- package/src/components/main/labelHeight.ts +5 -0
- package/src/components/navigation/CategoryButton.tsx +83 -57
- package/src/components/navigation/CategoryNavIcon.tsx +73 -194
- package/src/components/navigation/CategoryNavigation.tsx +118 -46
- package/src/config/categoryConfig.ts +7 -3
- package/src/config/cdnUrls.ts +11 -21
- package/src/config/compareConfig.ts +128 -30
- package/src/config/config.ts +228 -24
- package/src/config/defaultPickerConfiguration.ts +7 -0
- package/src/config/mutableConfig.ts +44 -20
- package/src/config/useConfig.ts +130 -37
- package/src/data/defaultEmojiData.ts +49 -0
- package/src/data/registerDefaultEmojiData.ts +8 -0
- package/src/data/skinToneVariations.ts +8 -7
- package/src/data-core/pickerData.ts +171 -0
- package/src/data-core/prepare.ts +163 -0
- package/src/data-core/search.ts +122 -0
- package/src/data-core/types.ts +36 -0
- package/src/data.ts +10 -0
- package/src/dataUtils/DataTypes.ts +4 -0
- package/src/dataUtils/emojiSelectors.ts +59 -63
- package/src/dataUtils/emojiUtils.ts +17 -74
- package/src/dataUtils/nativeEmojiSequenceSupport.ts +116 -0
- package/src/dataUtils/nativeEmojiSupport.ts +160 -0
- package/src/dataUtils/parseNativeEmoji.ts +3 -4
- package/src/dataUtils/suggested.ts +8 -4
- package/src/dataUtils/suggestedEmojis.ts +92 -0
- package/src/env.d.ts +4 -0
- package/src/hooks/preloadEmoji.ts +2 -47
- package/src/hooks/useActiveCategoryScrollDetection.ts +28 -16
- package/src/hooks/useCategoryHeight.ts +116 -10
- package/src/hooks/useDataIdentityStabilityWarning.ts +86 -0
- package/src/hooks/useDebouncedState.ts +13 -1
- package/src/hooks/useDisallowedEmojis.ts +31 -42
- package/src/hooks/useEmojiPreviewEvents.ts +43 -10
- package/src/hooks/useEmojiVirtualization.tsx +112 -52
- package/src/hooks/useFilter.ts +92 -132
- package/src/hooks/useFocus.ts +14 -24
- package/src/hooks/useIsEmojiHidden.ts +22 -14
- package/src/hooks/useKeyboardNavigation.ts +412 -432
- package/src/hooks/useMouseDownHandlers.ts +91 -16
- package/src/hooks/useOnFocus.ts +12 -3
- package/src/hooks/useOnScroll.ts +18 -2
- package/src/hooks/useReactionsFocus.ts +118 -0
- package/src/hooks/useRegisterRegion.ts +92 -0
- package/src/hooks/useResolvedEmojiData.ts +200 -0
- package/src/hooks/useScrollCategoryIntoView.ts +74 -12
- package/src/hooks/useSearchController.ts +369 -0
- package/src/hooks/useSearchResults.ts +51 -0
- package/src/hooks/useSetVariationPicker.ts +4 -1
- package/src/index.tsx +67 -5
- package/src/primitives/CategoryNav.tsx +40 -0
- package/src/primitives/Empty.tsx +68 -0
- package/src/primitives/List.tsx +61 -0
- package/src/primitives/LoadError.tsx +38 -0
- package/src/primitives/Loading.tsx +60 -0
- package/src/primitives/Panel.tsx +47 -0
- package/src/primitives/Preview.tsx +38 -0
- package/src/primitives/Reactions.tsx +2 -0
- package/src/primitives/Root.tsx +398 -0
- package/src/primitives/Search.tsx +41 -0
- package/src/primitives/SearchInput.tsx +110 -0
- package/src/primitives/SkinTone.tsx +76 -0
- package/src/primitives/Viewport.tsx +204 -0
- package/src/primitives/appearance.tsx +7 -0
- package/src/primitives/components.tsx +30 -0
- package/src/primitives/hooks.ts +165 -0
- package/src/primitives/index.ts +94 -0
- package/src/primitives/nativeProps.ts +90 -0
- package/src/primitives/scope.tsx +109 -0
- package/src/primitives/structuralStyles.tsx +136 -0
- package/src/primitives/tokens.ts +150 -0
- package/src/primitives/types.ts +192 -0
- package/src/state/activeEmojiStore.ts +39 -0
- package/src/state/navigationRegistry.ts +209 -0
- package/src/state/regionTraversal.ts +116 -0
- package/src/svg.d.ts +2 -2
- package/src/types/exposedTypes.ts +28 -1
- package/src/virtualization/virtualizationHelpers.ts +29 -8
- package/dist/components/body/Body.d.ts +0 -2
- package/dist/components/main/PickerMain.d.ts +0 -7
- package/dist/dataUtils/alphaNumericEmojiIndex.d.ts +0 -5
- package/dist/emoji-picker-react.cjs.development.js +0 -31413
- package/dist/emoji-picker-react.cjs.development.js.map +0 -1
- package/dist/emoji-picker-react.cjs.production.min.js +0 -2
- package/dist/emoji-picker-react.cjs.production.min.js.map +0 -1
- package/dist/emoji-picker-react.esm.js +0 -31411
- package/dist/emoji-picker-react.esm.js.map +0 -1
- package/dist/hooks/useHideEmojisByUniocode.d.ts +0 -1
- package/src/components/body/Body.tsx +0 -43
- package/src/components/main/PickerMain.tsx +0 -249
- package/src/dataUtils/alphaNumericEmojiIndex.ts +0 -21
|
@@ -1,20 +1,27 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
import {
|
|
4
|
+
useSuggestedEmojisConfig,
|
|
5
|
+
useSuggestedEmojisModeConfig,
|
|
6
|
+
} from '../../config/useConfig';
|
|
7
|
+
import { getPickerDataSnapshot } from '../../data-core/pickerData';
|
|
8
|
+
import { normalizeQuery } from '../../data-core/prepare';
|
|
9
|
+
import { searchEmojis } from '../../data-core/search';
|
|
6
10
|
import {
|
|
7
11
|
DataEmoji,
|
|
8
12
|
DataEmojis,
|
|
9
|
-
EmojiProperties,
|
|
10
13
|
EmojiProperties as Keys,
|
|
11
14
|
} from '../../dataUtils/DataTypes';
|
|
12
15
|
import { emojiByUnified } from '../../dataUtils/emojiSelectors';
|
|
13
16
|
import {
|
|
14
17
|
activeVariationFromUnified,
|
|
18
|
+
emojiNames,
|
|
15
19
|
unifiedWithoutSkinTone,
|
|
16
20
|
} from '../../dataUtils/emojiUtils';
|
|
17
21
|
import { getSuggested } from '../../dataUtils/suggested';
|
|
22
|
+
import { resolveSuggestedRenderIds } from '../../dataUtils/suggestedEmojis';
|
|
23
|
+
import { useDataIdentityStabilityWarning } from '../../hooks/useDataIdentityStabilityWarning';
|
|
24
|
+
import type { FilterDict } from '../../hooks/useFilter';
|
|
18
25
|
import { useIsMounted } from '../../hooks/useIsMounted';
|
|
19
26
|
import { Categories, EmojiData, SkinTones } from '../../types/exposedTypes';
|
|
20
27
|
|
|
@@ -25,21 +32,27 @@ export interface PickerDataContextValue {
|
|
|
25
32
|
emojiData: EmojiData;
|
|
26
33
|
allEmojis: DataEmojis;
|
|
27
34
|
allEmojisByUnified: Record<string, DataEmoji>;
|
|
28
|
-
searchIndex: Record<string, Record<string, DataEmoji>>;
|
|
29
35
|
customGroups: Record<string, DataEmojis>;
|
|
30
36
|
emojiByUnified: (unified?: string) => DataEmoji | undefined;
|
|
31
37
|
activeVariationFromUnified: (unified: string) => SkinTones | null;
|
|
38
|
+
/**
|
|
39
|
+
* Query-to-filter-dict through the single shared prepared core: core
|
|
40
|
+
* dataset matches mapped back to source records, unioned with the
|
|
41
|
+
* Root-local custom emojis the core never sees.
|
|
42
|
+
*/
|
|
43
|
+
queryFilterDict: (query: string) => FilterDict;
|
|
32
44
|
}
|
|
33
45
|
|
|
34
|
-
const PickerDataContext =
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
})
|
|
46
|
+
const PickerDataContext =
|
|
47
|
+
/* @__PURE__ */ React.createContext<PickerDataContextValue>({
|
|
48
|
+
emojiData: {} as EmojiData,
|
|
49
|
+
allEmojis: [],
|
|
50
|
+
allEmojisByUnified: Object.create(null),
|
|
51
|
+
customGroups: Object.create(null),
|
|
52
|
+
emojiByUnified,
|
|
53
|
+
activeVariationFromUnified: () => null,
|
|
54
|
+
queryFilterDict: () => ({}),
|
|
55
|
+
});
|
|
43
56
|
|
|
44
57
|
export function PickerDataProvider({
|
|
45
58
|
children,
|
|
@@ -48,72 +61,17 @@ export function PickerDataProvider({
|
|
|
48
61
|
}) {
|
|
49
62
|
const { customEmojis, emojiData: genericEmojiData } = usePickerConfig();
|
|
50
63
|
|
|
51
|
-
|
|
52
|
-
const emojiData = genericEmojiData || (defaultEmojiData as EmojiData);
|
|
53
|
-
|
|
54
|
-
// Clone to avoid mutation of shared source
|
|
55
|
-
const newData: EmojiData = JSON.parse(JSON.stringify(emojiData));
|
|
56
|
-
|
|
57
|
-
// Group names and emoji ids are user-controlled strings: use
|
|
58
|
-
// null-prototype dictionaries so names like `__proto__` behave as
|
|
59
|
-
// ordinary data instead of resolving Object.prototype members.
|
|
60
|
-
const customGroups: Record<string, DataEmojis> = Object.create(null);
|
|
61
|
-
|
|
62
|
-
if (customEmojis && customEmojis.length > 0) {
|
|
63
|
-
for (const emoji of customEmojis) {
|
|
64
|
-
if (!emoji.group) {
|
|
65
|
-
continue;
|
|
66
|
-
}
|
|
67
|
-
customGroups[emoji.group] = customGroups[emoji.group] ?? [];
|
|
68
|
-
customGroups[emoji.group].push(customToRegularEmoji(emoji));
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
newData.emojis[Categories.CUSTOM] = customEmojis
|
|
72
|
-
.filter(emoji => !emoji.group)
|
|
73
|
-
.map(customToRegularEmoji);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
const emojis = newData.emojis || {};
|
|
77
|
-
|
|
78
|
-
const allEmojis: DataEmojis = Object.values(emojis)
|
|
79
|
-
.concat(Object.values(customGroups))
|
|
80
|
-
.flat();
|
|
81
|
-
const allEmojisByUnified: Record<string, DataEmoji> =
|
|
82
|
-
Object.create(null);
|
|
83
|
-
const searchIndex: Record<string, Record<string, DataEmoji>> =
|
|
84
|
-
Object.create(null);
|
|
85
|
-
|
|
86
|
-
allEmojis.forEach((emoji) => {
|
|
87
|
-
const unified = emoji[Keys.unified];
|
|
88
|
-
allEmojisByUnified[unified] = emoji;
|
|
89
|
-
|
|
90
|
-
if (emoji[Keys.variations]) {
|
|
91
|
-
emoji[Keys.variations]?.forEach((variation) => {
|
|
92
|
-
allEmojisByUnified[variation] = emoji;
|
|
93
|
-
});
|
|
94
|
-
}
|
|
64
|
+
useDataIdentityStabilityWarning(genericEmojiData, customEmojis);
|
|
95
65
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
searchIndex[char][unified] = emoji;
|
|
106
|
-
});
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
return {
|
|
110
|
-
emojiData: newData,
|
|
111
|
-
allEmojis,
|
|
112
|
-
allEmojisByUnified,
|
|
113
|
-
searchIndex,
|
|
114
|
-
customGroups,
|
|
115
|
-
};
|
|
116
|
-
}, [genericEmojiData, customEmojis]);
|
|
66
|
+
// Shared derivation: no per-Root JSON clone of the full dataset,
|
|
67
|
+
// caller data never mutated, base index shared by dataset identity, custom
|
|
68
|
+
// derivation cached separately by customEmojis identity. emojiVersion /
|
|
69
|
+
// hiddenEmojis remain per-Root filtering layers elsewhere and never force
|
|
70
|
+
// a base-index rebuild.
|
|
71
|
+
const data = React.useMemo(
|
|
72
|
+
() => getPickerDataSnapshot(genericEmojiData, customEmojis),
|
|
73
|
+
[genericEmojiData, customEmojis],
|
|
74
|
+
);
|
|
117
75
|
|
|
118
76
|
const emojiByUnified = React.useCallback(
|
|
119
77
|
(unified?: string): DataEmoji | undefined => {
|
|
@@ -127,14 +85,57 @@ export function PickerDataProvider({
|
|
|
127
85
|
[data.allEmojisByUnified],
|
|
128
86
|
);
|
|
129
87
|
|
|
88
|
+
const allCustomEmojis = React.useMemo(
|
|
89
|
+
() => [
|
|
90
|
+
...(data.emojiData.emojis?.[Categories.CUSTOM] ?? []),
|
|
91
|
+
...Object.values(data.customGroups).flat(),
|
|
92
|
+
],
|
|
93
|
+
[data.emojiData, data.customGroups],
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
const queryFilterDict = React.useCallback(
|
|
97
|
+
(query: string): FilterDict => {
|
|
98
|
+
const normalized = normalizeQuery(query);
|
|
99
|
+
const dict: FilterDict = Object.create(null);
|
|
100
|
+
if (!normalized) {
|
|
101
|
+
return dict;
|
|
102
|
+
}
|
|
103
|
+
for (const info of searchEmojis(normalized, {
|
|
104
|
+
emojiData: genericEmojiData,
|
|
105
|
+
})) {
|
|
106
|
+
const emoji = data.allEmojisByUnified[info.unified];
|
|
107
|
+
if (emoji) {
|
|
108
|
+
dict[info.unified] = emoji;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
for (const custom of allCustomEmojis) {
|
|
112
|
+
if (
|
|
113
|
+
emojiNames(custom).some((name) =>
|
|
114
|
+
name.toLowerCase().includes(normalized),
|
|
115
|
+
)
|
|
116
|
+
) {
|
|
117
|
+
dict[custom[Keys.unified]] = custom;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return dict;
|
|
121
|
+
},
|
|
122
|
+
[genericEmojiData, data.allEmojisByUnified, allCustomEmojis],
|
|
123
|
+
);
|
|
124
|
+
|
|
125
|
+
// Stable value identity: provider rerenders must not rerender data
|
|
126
|
+
// consumers while the dataset itself is unchanged.
|
|
127
|
+
const value = React.useMemo(
|
|
128
|
+
() => ({
|
|
129
|
+
...data,
|
|
130
|
+
emojiByUnified,
|
|
131
|
+
activeVariationFromUnified,
|
|
132
|
+
queryFilterDict,
|
|
133
|
+
}),
|
|
134
|
+
[data, emojiByUnified, queryFilterDict],
|
|
135
|
+
);
|
|
136
|
+
|
|
130
137
|
return (
|
|
131
|
-
<PickerDataContext.Provider
|
|
132
|
-
value={{
|
|
133
|
-
...data,
|
|
134
|
-
emojiByUnified,
|
|
135
|
-
activeVariationFromUnified,
|
|
136
|
-
}}
|
|
137
|
-
>
|
|
138
|
+
<PickerDataContext.Provider value={value}>
|
|
138
139
|
{children}
|
|
139
140
|
</PickerDataContext.Provider>
|
|
140
141
|
);
|
|
@@ -147,6 +148,7 @@ export function usePickerDataContext() {
|
|
|
147
148
|
export function useGetEmojisByCategory() {
|
|
148
149
|
const { emojiData, emojiByUnified, customGroups } = usePickerDataContext();
|
|
149
150
|
const suggestedEmojisModeConfig = useSuggestedEmojisModeConfig();
|
|
151
|
+
const callerSuggestedEmojis = useSuggestedEmojisConfig();
|
|
150
152
|
const [suggestedUpdated] = useUpdateSuggested();
|
|
151
153
|
// Suggestions come from localStorage, which doesn't exist during SSR.
|
|
152
154
|
// Read them only after mount so the first client render matches the server.
|
|
@@ -157,6 +159,24 @@ export function useGetEmojisByCategory() {
|
|
|
157
159
|
return [] as DataEmojis;
|
|
158
160
|
}
|
|
159
161
|
|
|
162
|
+
// Caller-defined suggestions fully determine contents/order while the
|
|
163
|
+
// prop is present; persistence mode is ignored and nothing is written
|
|
164
|
+
// to localStorage by this path.
|
|
165
|
+
if (callerSuggestedEmojis !== undefined) {
|
|
166
|
+
return resolveSuggestedRenderIds(callerSuggestedEmojis, (id) =>
|
|
167
|
+
emojiByUnified(id),
|
|
168
|
+
)
|
|
169
|
+
.map((identity) => {
|
|
170
|
+
const emoji = emojiByUnified(identity);
|
|
171
|
+
if (!emoji) return undefined;
|
|
172
|
+
return {
|
|
173
|
+
...emoji,
|
|
174
|
+
renderUnified: identity,
|
|
175
|
+
};
|
|
176
|
+
})
|
|
177
|
+
.filter(Boolean) as DataEmojis;
|
|
178
|
+
}
|
|
179
|
+
|
|
160
180
|
const suggested = getSuggested(suggestedEmojisModeConfig) ?? [];
|
|
161
181
|
|
|
162
182
|
return suggested
|
|
@@ -165,12 +185,18 @@ export function useGetEmojisByCategory() {
|
|
|
165
185
|
if (!emoji) return undefined;
|
|
166
186
|
return {
|
|
167
187
|
...emoji,
|
|
168
|
-
|
|
188
|
+
fallbackUnified: s.unified,
|
|
169
189
|
};
|
|
170
190
|
})
|
|
171
191
|
.filter(Boolean) as DataEmojis;
|
|
172
192
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
173
|
-
}, [
|
|
193
|
+
}, [
|
|
194
|
+
isMounted,
|
|
195
|
+
suggestedUpdated,
|
|
196
|
+
suggestedEmojisModeConfig,
|
|
197
|
+
callerSuggestedEmojis,
|
|
198
|
+
emojiByUnified,
|
|
199
|
+
]);
|
|
174
200
|
|
|
175
201
|
return function getEmojisByCategory(
|
|
176
202
|
category: Categories,
|
|
@@ -187,14 +213,3 @@ export function useGetEmojisByCategory() {
|
|
|
187
213
|
return emojiData.emojis?.[category] ?? [];
|
|
188
214
|
};
|
|
189
215
|
}
|
|
190
|
-
|
|
191
|
-
function customToRegularEmoji(emoji: CustomEmoji): DataEmoji {
|
|
192
|
-
return {
|
|
193
|
-
[EmojiProperties.name]: emoji.names.map((name: string) =>
|
|
194
|
-
name.toLowerCase(),
|
|
195
|
-
),
|
|
196
|
-
[EmojiProperties.unified]: emoji.id.toLowerCase(),
|
|
197
|
-
[EmojiProperties.added_in]: '0',
|
|
198
|
-
[EmojiProperties.imgUrl]: emoji.imgUrl,
|
|
199
|
-
};
|
|
200
|
-
}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { CustomEmoji } from '../../config/customEmojiConfig';
|
|
2
2
|
import { DataEmoji } from '../../dataUtils/DataTypes';
|
|
3
|
-
import {
|
|
3
|
+
import { EmojiStyleValue } from '../../types/exposedTypes';
|
|
4
4
|
|
|
5
5
|
export type BaseEmojiProps = {
|
|
6
6
|
emoji?: DataEmoji | CustomEmoji;
|
|
7
|
-
emojiStyle:
|
|
7
|
+
emojiStyle: EmojiStyleValue;
|
|
8
8
|
unified: string;
|
|
9
|
-
|
|
9
|
+
/** Pixels, or any CSS length (e.g. a `var(--epr-*)` token). */
|
|
10
|
+
size?: number | string;
|
|
10
11
|
lazyLoad?: boolean;
|
|
11
12
|
getEmojiUrl?: GetEmojiUrl;
|
|
12
13
|
className?: string;
|
|
13
14
|
};
|
|
14
|
-
export type GetEmojiUrl = (unified: string, style:
|
|
15
|
+
export type GetEmojiUrl = (unified: string, style: EmojiStyleValue) => string;
|
|
@@ -7,7 +7,10 @@ import {
|
|
|
7
7
|
commonStyles,
|
|
8
8
|
stylesheet,
|
|
9
9
|
} from '../../Stylesheet/stylesheet';
|
|
10
|
+
import { useDefaultAppearance } from '../../primitives/appearance';
|
|
10
11
|
import { Button } from '../atoms/Button';
|
|
12
|
+
import { EmojiRenderProps, ListEmoji } from '../body/listComponents';
|
|
13
|
+
import { useIsActiveEmoji } from '../context/PickerContext';
|
|
11
14
|
|
|
12
15
|
type ClickableEmojiButtonProps = Readonly<{
|
|
13
16
|
hidden?: boolean;
|
|
@@ -20,6 +23,13 @@ type ClickableEmojiButtonProps = Readonly<{
|
|
|
20
23
|
noBackground?: boolean;
|
|
21
24
|
className?: string;
|
|
22
25
|
style?: React.CSSProperties;
|
|
26
|
+
tabIndex?: number;
|
|
27
|
+
/** Consumer cell (List `components.Emoji`) replacing the default button. */
|
|
28
|
+
as?: React.ComponentType<EmojiRenderProps>;
|
|
29
|
+
emojiInfo?: Omit<ListEmoji, 'isActive'>;
|
|
30
|
+
/** `gridcell` inside the emoji grid; native button role elsewhere. */
|
|
31
|
+
role?: 'gridcell';
|
|
32
|
+
index?: number;
|
|
23
33
|
}>;
|
|
24
34
|
|
|
25
35
|
export function ClickableEmojiButton({
|
|
@@ -33,23 +43,56 @@ export function ClickableEmojiButton({
|
|
|
33
43
|
className,
|
|
34
44
|
noBackground = false,
|
|
35
45
|
style,
|
|
46
|
+
tabIndex,
|
|
47
|
+
as: Custom,
|
|
48
|
+
emojiInfo,
|
|
49
|
+
role,
|
|
50
|
+
index,
|
|
36
51
|
}: ClickableEmojiButtonProps) {
|
|
52
|
+
const isActive = useIsActiveEmoji(unified);
|
|
53
|
+
const appearance = useDefaultAppearance();
|
|
54
|
+
const cellClassName = emojiCellClassName({
|
|
55
|
+
hidden,
|
|
56
|
+
hiddenOnSearch,
|
|
57
|
+
hasVariations,
|
|
58
|
+
showVariations,
|
|
59
|
+
noBackground,
|
|
60
|
+
className,
|
|
61
|
+
custom: !!Custom || !appearance,
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
if (Custom && emojiInfo) {
|
|
65
|
+
const managedProps = {
|
|
66
|
+
type: 'button' as const,
|
|
67
|
+
role,
|
|
68
|
+
tabIndex,
|
|
69
|
+
className: cellClassName,
|
|
70
|
+
'data-epr-part': 'emoji',
|
|
71
|
+
'data-epr-active': isActive ? '' : undefined,
|
|
72
|
+
'data-epr-unified': unified,
|
|
73
|
+
'data-epr-index': index,
|
|
74
|
+
'aria-label': getAriaLabel(emojiNames),
|
|
75
|
+
'data-epr-full-name': emojiNames.join(','),
|
|
76
|
+
style,
|
|
77
|
+
};
|
|
78
|
+
return (
|
|
79
|
+
<Custom {...managedProps} emoji={{ ...emojiInfo, isActive }}>
|
|
80
|
+
{children}
|
|
81
|
+
</Custom>
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
|
|
37
85
|
return (
|
|
38
86
|
<Button
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
!!(hasVariations && showVariations) && styles.hasVariations,
|
|
47
|
-
noBackground && styles.noBackground,
|
|
48
|
-
className,
|
|
49
|
-
)}
|
|
50
|
-
data-unified={unified}
|
|
87
|
+
tabIndex={tabIndex}
|
|
88
|
+
role={role}
|
|
89
|
+
className={cellClassName}
|
|
90
|
+
data-epr-part="emoji"
|
|
91
|
+
data-epr-active={isActive ? '' : undefined}
|
|
92
|
+
data-epr-unified={unified}
|
|
93
|
+
data-epr-index={index}
|
|
51
94
|
aria-label={getAriaLabel(emojiNames)}
|
|
52
|
-
data-full-name={emojiNames}
|
|
95
|
+
data-epr-full-name={emojiNames}
|
|
53
96
|
style={style}
|
|
54
97
|
>
|
|
55
98
|
{children}
|
|
@@ -57,62 +100,104 @@ export function ClickableEmojiButton({
|
|
|
57
100
|
);
|
|
58
101
|
}
|
|
59
102
|
|
|
103
|
+
function emojiCellClassName({
|
|
104
|
+
hidden,
|
|
105
|
+
hiddenOnSearch,
|
|
106
|
+
hasVariations,
|
|
107
|
+
showVariations,
|
|
108
|
+
noBackground,
|
|
109
|
+
className,
|
|
110
|
+
custom,
|
|
111
|
+
}: {
|
|
112
|
+
hidden?: boolean;
|
|
113
|
+
hiddenOnSearch?: boolean;
|
|
114
|
+
hasVariations: boolean;
|
|
115
|
+
showVariations: boolean;
|
|
116
|
+
noBackground: boolean;
|
|
117
|
+
className?: string;
|
|
118
|
+
custom: boolean;
|
|
119
|
+
}): string {
|
|
120
|
+
return cx(
|
|
121
|
+
styles.emoji,
|
|
122
|
+
!custom && styles.appearance,
|
|
123
|
+
hidden && commonStyles.hidden,
|
|
124
|
+
hiddenOnSearch && commonInteractionStyles.hiddenOnSearch,
|
|
125
|
+
{
|
|
126
|
+
[ClassNames.visible]: !hidden && !hiddenOnSearch,
|
|
127
|
+
},
|
|
128
|
+
variationClassName(hasVariations && showVariations, custom),
|
|
129
|
+
!custom && noBackground && styles.noBackground,
|
|
130
|
+
className,
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function variationClassName(show: boolean, custom: boolean): string {
|
|
135
|
+
return cx(
|
|
136
|
+
show && ClassNames.emojiHasVariations,
|
|
137
|
+
show && !custom && styles.hasVariations,
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
|
|
60
141
|
function getAriaLabel(emojiNames: string[]) {
|
|
61
142
|
return emojiNames[emojiNames.length - 1];
|
|
62
143
|
}
|
|
63
144
|
|
|
64
|
-
const styles =
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
transition: 'background-color 0.2s',
|
|
79
|
-
':hover': {
|
|
80
|
-
backgroundColor: 'var(--epr-emoji-hover-color)',
|
|
145
|
+
const styles = /* @__PURE__ */ (() =>
|
|
146
|
+
stylesheet.create({
|
|
147
|
+
emoji: {
|
|
148
|
+
'.': ClassNames.emoji,
|
|
149
|
+
position: 'relative',
|
|
150
|
+
width: 'var(--epr-emoji-fullsize)',
|
|
151
|
+
height: 'var(--epr-emoji-fullsize)',
|
|
152
|
+
boxSizing: 'border-box',
|
|
153
|
+
display: 'flex',
|
|
154
|
+
alignItems: 'center',
|
|
155
|
+
justifyContent: 'center',
|
|
156
|
+
maxWidth: 'var(--epr-emoji-fullsize)',
|
|
157
|
+
maxHeight: 'var(--epr-emoji-fullsize)',
|
|
158
|
+
overflow: 'hidden',
|
|
81
159
|
},
|
|
82
|
-
|
|
83
|
-
|
|
160
|
+
appearance: {
|
|
161
|
+
'.': 'epr-emoji-appearance',
|
|
162
|
+
borderRadius: '8px',
|
|
163
|
+
transition: 'background-color 0.2s',
|
|
164
|
+
':hover': {
|
|
165
|
+
backgroundColor: 'var(--epr-emoji-hover-color)',
|
|
166
|
+
},
|
|
167
|
+
':focus': {
|
|
168
|
+
backgroundColor: 'var(--epr-focus-bg-color)',
|
|
169
|
+
},
|
|
84
170
|
},
|
|
85
|
-
|
|
86
|
-
noBackground: {
|
|
87
|
-
background: 'none',
|
|
88
|
-
':hover': {
|
|
89
|
-
backgroundColor: 'transparent',
|
|
171
|
+
noBackground: {
|
|
90
172
|
background: 'none',
|
|
173
|
+
':hover': {
|
|
174
|
+
backgroundColor: 'transparent',
|
|
175
|
+
background: 'none',
|
|
176
|
+
},
|
|
177
|
+
':focus': {
|
|
178
|
+
backgroundColor: 'transparent',
|
|
179
|
+
background: 'none',
|
|
180
|
+
},
|
|
91
181
|
},
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
},
|
|
113
|
-
':hover:after': {
|
|
114
|
-
borderBottom:
|
|
115
|
-
'4px solid var(--epr-emoji-variation-indicator-color-hover)',
|
|
182
|
+
hasVariations: {
|
|
183
|
+
'.': 'epr-emoji-variation-indicator',
|
|
184
|
+
':after': {
|
|
185
|
+
content: '',
|
|
186
|
+
display: 'block',
|
|
187
|
+
width: '0',
|
|
188
|
+
height: '0',
|
|
189
|
+
right: '0px',
|
|
190
|
+
bottom: '1px',
|
|
191
|
+
position: 'absolute',
|
|
192
|
+
borderLeft: '4px solid transparent',
|
|
193
|
+
borderRight: '4px solid transparent',
|
|
194
|
+
transform: 'rotate(135deg)',
|
|
195
|
+
borderBottom: '4px solid var(--epr-emoji-variation-indicator-color)',
|
|
196
|
+
zIndex: 'var(--epr-emoji-variations-indictator-z-index)',
|
|
197
|
+
},
|
|
198
|
+
':hover:after': {
|
|
199
|
+
borderBottom:
|
|
200
|
+
'4px solid var(--epr-emoji-variation-indicator-color-hover)',
|
|
201
|
+
},
|
|
116
202
|
},
|
|
117
|
-
}
|
|
118
|
-
});
|
|
203
|
+
}))();
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
|
|
3
3
|
import { DataEmoji } from '../../dataUtils/DataTypes';
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
emojiHasVariations,
|
|
6
|
+
emojiNames,
|
|
7
|
+
emojiUrlByUnified,
|
|
8
|
+
} from '../../dataUtils/emojiUtils';
|
|
9
|
+
import { usePickerComponents } from '../../primitives/components';
|
|
10
|
+
import { emojiRenderInfo, useListComponents } from '../body/listComponents';
|
|
5
11
|
|
|
6
12
|
import { BaseEmojiProps } from './BaseEmojiProps';
|
|
7
13
|
import { ClickableEmojiButton } from './ClickableEmojiButton';
|
|
@@ -17,6 +23,9 @@ type ClickableEmojiProps = Readonly<
|
|
|
17
23
|
buttonClassName?: string;
|
|
18
24
|
noBackground?: boolean;
|
|
19
25
|
style?: React.CSSProperties;
|
|
26
|
+
tabIndex?: number;
|
|
27
|
+
role?: 'gridcell';
|
|
28
|
+
index?: number;
|
|
20
29
|
}
|
|
21
30
|
>;
|
|
22
31
|
|
|
@@ -29,16 +38,25 @@ export function ClickableEmoji({
|
|
|
29
38
|
showVariations = true,
|
|
30
39
|
size,
|
|
31
40
|
lazyLoad,
|
|
32
|
-
getEmojiUrl,
|
|
41
|
+
getEmojiUrl = emojiUrlByUnified,
|
|
33
42
|
className,
|
|
34
43
|
buttonClassName,
|
|
35
44
|
noBackground = false,
|
|
36
45
|
style,
|
|
46
|
+
tabIndex,
|
|
47
|
+
role,
|
|
48
|
+
index,
|
|
37
49
|
}: ClickableEmojiProps) {
|
|
38
50
|
const hasVariations = emojiHasVariations(emoji);
|
|
51
|
+
const { Emoji: SharedEmoji } = usePickerComponents();
|
|
52
|
+
const Custom = useListComponents().Emoji ?? SharedEmoji;
|
|
53
|
+
const info = Custom
|
|
54
|
+
? emojiRenderInfo(emoji, unified, emojiStyle, getEmojiUrl)
|
|
55
|
+
: undefined;
|
|
39
56
|
|
|
40
57
|
return (
|
|
41
58
|
<ClickableEmojiButton
|
|
59
|
+
tabIndex={tabIndex}
|
|
42
60
|
hasVariations={hasVariations}
|
|
43
61
|
showVariations={showVariations}
|
|
44
62
|
hidden={hidden}
|
|
@@ -48,6 +66,10 @@ export function ClickableEmoji({
|
|
|
48
66
|
noBackground={noBackground}
|
|
49
67
|
style={style}
|
|
50
68
|
className={buttonClassName}
|
|
69
|
+
as={Custom}
|
|
70
|
+
emojiInfo={info}
|
|
71
|
+
role={role}
|
|
72
|
+
index={index}
|
|
51
73
|
>
|
|
52
74
|
<ViewOnlyEmoji
|
|
53
75
|
unified={unified}
|
|
@@ -2,7 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import { cx } from 'shipstyles';
|
|
3
3
|
|
|
4
4
|
import { stylesheet } from '../../Stylesheet/stylesheet';
|
|
5
|
-
import {
|
|
5
|
+
import { EmojiStyleValue } from '../../types/exposedTypes';
|
|
6
6
|
|
|
7
7
|
import { emojiStyles } from './emojiStyles';
|
|
8
8
|
|
|
@@ -15,7 +15,7 @@ export function EmojiImg({
|
|
|
15
15
|
className,
|
|
16
16
|
}: {
|
|
17
17
|
emojiName: string;
|
|
18
|
-
emojiStyle:
|
|
18
|
+
emojiStyle: EmojiStyleValue;
|
|
19
19
|
style: React.CSSProperties;
|
|
20
20
|
lazyLoad?: boolean;
|
|
21
21
|
imgUrl: string;
|
|
@@ -39,13 +39,14 @@ export function EmojiImg({
|
|
|
39
39
|
);
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
const styles =
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
42
|
+
const styles = /* @__PURE__ */ (() =>
|
|
43
|
+
stylesheet.create({
|
|
44
|
+
emojiImag: {
|
|
45
|
+
'.': 'epr-emoji-img',
|
|
46
|
+
maxWidth: 'var(--epr-emoji-fullsize)',
|
|
47
|
+
maxHeight: 'var(--epr-emoji-fullsize)',
|
|
48
|
+
minWidth: 'var(--epr-emoji-fullsize)',
|
|
49
|
+
minHeight: 'var(--epr-emoji-fullsize)',
|
|
50
|
+
padding: 'var(--epr-emoji-padding)',
|
|
51
|
+
},
|
|
52
|
+
}))();
|