emoji-picker-react 4.22.2 → 5.0.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 +335 -49
- package/dist/DomUtils/categoryNameFromDom.d.ts +1 -1
- package/dist/DomUtils/classNames.d.ts +24 -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 +7 -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-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-46BUDQLE.mjs +228 -0
- package/dist/esm/chunks/chunk-7ZGTUZFB.mjs +16 -0
- package/dist/esm/chunks/chunk-FQIJ4HBW.mjs +25 -0
- package/dist/esm/chunks/chunk-KQPOIRSC.mjs +9305 -0
- package/dist/esm/chunks/chunk-LO4TPPLH.mjs +43 -0
- package/dist/esm/chunks/emojis-6L3GRBAP.mjs +9 -0
- package/dist/esm/data.mjs +18 -0
- package/dist/esm/index.mjs +389 -0
- package/dist/esm/primitives/index.mjs +67 -0
- package/dist/hooks/preloadEmoji.d.ts +9 -9
- package/dist/hooks/useActiveCategoryScrollDetection.d.ts +11 -11
- package/dist/hooks/useCategoryHeight.d.ts +6 -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 +21 -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 +20 -18
- package/llms-full.txt +3680 -0
- package/llms.txt +66 -476
- package/package.json +204 -66
- package/src/DomUtils/categoryNameFromDom.ts +1 -1
- package/src/DomUtils/classNames.ts +1 -0
- package/src/DomUtils/elementPositionInRow.ts +26 -4
- 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 +105 -149
- package/src/DomUtils/scrollTo.ts +18 -16
- package/src/DomUtils/selectors.ts +20 -111
- 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 +55 -23
- 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 +110 -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 +77 -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 +188 -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-core/pickerData.ts +173 -0
- package/src/data-core/prepare.ts +178 -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 +58 -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/suggested.ts +8 -4
- package/src/dataUtils/suggestedEmojis.ts +92 -0
- package/src/env.d.ts +4 -0
- package/src/hooks/preloadEmoji.ts +3 -3
- package/src/hooks/useActiveCategoryScrollDetection.ts +10 -1
- package/src/hooks/useCategoryHeight.ts +82 -8
- package/src/hooks/useDataIdentityStabilityWarning.ts +86 -0
- package/src/hooks/useDebouncedState.ts +13 -1
- package/src/hooks/useDisallowedEmojis.ts +26 -42
- package/src/hooks/useEmojiPreviewEvents.ts +43 -10
- package/src/hooks/useEmojiVirtualization.tsx +38 -4
- package/src/hooks/useFilter.ts +85 -127
- package/src/hooks/useFocus.ts +14 -24
- package/src/hooks/useIsEmojiHidden.ts +10 -6
- package/src/hooks/useKeyboardNavigation.ts +322 -429
- 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 +133 -0
- package/src/primitives/tokens.ts +149 -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 +20 -6
- 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
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
/* global process: readonly */
|
|
4
|
+
|
|
5
|
+
import { categoryIdFromCategoryConfig } from '../../config/categoryConfig';
|
|
6
|
+
import { useMutableConfig } from '../../config/mutableConfig';
|
|
7
|
+
import {
|
|
8
|
+
useCategoriesConfig,
|
|
9
|
+
useDefaultSearchValueConfig,
|
|
10
|
+
useEmojiVersionConfig,
|
|
11
|
+
useSearchValueConfig,
|
|
12
|
+
} from '../../config/useConfig';
|
|
13
|
+
import { useFilter } from '../../hooks/useFilter';
|
|
14
|
+
import {
|
|
15
|
+
useActiveSkinToneState,
|
|
16
|
+
useEmojiSizeState,
|
|
17
|
+
useNavigationRegistry,
|
|
18
|
+
useReactionsModeState,
|
|
19
|
+
} from '../context/PickerContext';
|
|
20
|
+
import { usePickerDataContext } from '../context/PickerDataContext';
|
|
21
|
+
|
|
22
|
+
// Root-scoped behavior companions shared by the default picker and the
|
|
23
|
+
// public Root primitive (single implementation).
|
|
24
|
+
|
|
25
|
+
// Accepted-search synchronization.
|
|
26
|
+
//
|
|
27
|
+
// Controlled mode: filtering is scheduled only when a new accepted
|
|
28
|
+
// `searchValue` prop is observed — a rejected `onSearchChange` proposal
|
|
29
|
+
// schedules nothing. A newer accepted query cancels the pending one via
|
|
30
|
+
// the shared debounced transition. Parent-driven changes never re-emit.
|
|
31
|
+
// Uncontrolled mode: the initial `defaultSearchValue` commits once on
|
|
32
|
+
// mount (filtering applies, but no callback fires for a non-user edit);
|
|
33
|
+
// later edits schedule through the input transition itself.
|
|
34
|
+
export function SearchSync() {
|
|
35
|
+
const searchValue = useSearchValueConfig();
|
|
36
|
+
const defaultSearchValue = useDefaultSearchValueConfig();
|
|
37
|
+
const { onChange: commitFilter } = useFilter();
|
|
38
|
+
|
|
39
|
+
const mode = searchValue !== undefined ? 'controlled' : 'uncontrolled';
|
|
40
|
+
useSearchModeSwitchWarning(mode);
|
|
41
|
+
|
|
42
|
+
// Initial commit only. The stamp (not a first-run flag) makes this
|
|
43
|
+
// StrictMode-safe: the double-invoked mount effect commits once, since
|
|
44
|
+
// the second run observes the stamp. A genuine remount creates a new
|
|
45
|
+
// ref and commits its own initial value again, as it should.
|
|
46
|
+
// commitFilter closes over stable refs/setters only, so the captured
|
|
47
|
+
// first-render instance stays valid for this mount-only effect.
|
|
48
|
+
const initialStamp = React.useRef<string | null | undefined>(undefined);
|
|
49
|
+
React.useEffect(() => {
|
|
50
|
+
if (initialStamp.current !== undefined) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
const initial = mode === 'controlled' ? searchValue : defaultSearchValue;
|
|
54
|
+
initialStamp.current = initial ?? null;
|
|
55
|
+
if (initial) {
|
|
56
|
+
commitFilter(initial);
|
|
57
|
+
}
|
|
58
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
59
|
+
}, []);
|
|
60
|
+
|
|
61
|
+
// Controlled updates only. Previous-value comparison keeps the mount
|
|
62
|
+
// (and the StrictMode double-invoke) silent; uncontrolled commits
|
|
63
|
+
// schedule through the input transition, and the default value is read
|
|
64
|
+
// once, so later prop changes are ignored here.
|
|
65
|
+
const prevAccepted = React.useRef(searchValue);
|
|
66
|
+
React.useEffect(() => {
|
|
67
|
+
if (
|
|
68
|
+
mode === 'controlled' &&
|
|
69
|
+
searchValue !== undefined &&
|
|
70
|
+
searchValue !== prevAccepted.current
|
|
71
|
+
) {
|
|
72
|
+
prevAccepted.current = searchValue;
|
|
73
|
+
commitFilter(searchValue);
|
|
74
|
+
}
|
|
75
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
76
|
+
}, [mode, searchValue]);
|
|
77
|
+
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const useSearchModeSwitchWarning: (mode: string) => void =
|
|
82
|
+
process.env.NODE_ENV === 'production'
|
|
83
|
+
? () => undefined
|
|
84
|
+
: useDevSearchModeSwitchWarning;
|
|
85
|
+
|
|
86
|
+
function useDevSearchModeSwitchWarning(mode: string): void {
|
|
87
|
+
const prevMode = React.useRef<string | null>(null);
|
|
88
|
+
React.useEffect(() => {
|
|
89
|
+
if (prevMode.current !== null && prevMode.current !== mode) {
|
|
90
|
+
// eslint-disable-next-line no-console
|
|
91
|
+
console.warn(
|
|
92
|
+
'[emoji-picker-react] Switching between controlled and uncontrolled ' +
|
|
93
|
+
'search during one mounted lifetime is unsupported.',
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
prevMode.current = mode;
|
|
97
|
+
}, [mode]);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// Reaction-mode observation. Emits only after an
|
|
101
|
+
// actual state change; initial mount never emits. A previous-value ref
|
|
102
|
+
// (not a first-run flag) makes this StrictMode-safe: the double-invoked
|
|
103
|
+
// mount effect observes an unchanged value both times and stays silent.
|
|
104
|
+
export const ReactionsModeObserver = /* @__PURE__ */ React.memo(
|
|
105
|
+
function ReactionsModeObserver() {
|
|
106
|
+
const [reactionsOpen] = useReactionsModeState();
|
|
107
|
+
const { current } = useMutableConfig();
|
|
108
|
+
const prevReactionsOpen = React.useRef(reactionsOpen);
|
|
109
|
+
|
|
110
|
+
React.useEffect(() => {
|
|
111
|
+
if (prevReactionsOpen.current === reactionsOpen) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
prevReactionsOpen.current = reactionsOpen;
|
|
115
|
+
current.onReactionsModeChange?.(reactionsOpen);
|
|
116
|
+
}, [reactionsOpen, current]);
|
|
117
|
+
|
|
118
|
+
return null;
|
|
119
|
+
},
|
|
120
|
+
);
|
|
121
|
+
|
|
122
|
+
// Root-scoped navigation generation.
|
|
123
|
+
// Reactions transitions, dataset identity changes (custom emojis included),
|
|
124
|
+
// category order/membership changes, and measured geometry changes each
|
|
125
|
+
// obsolete pending materialize/scroll/focus completions. Column-count
|
|
126
|
+
// changes invalidate from useCategoryHeight, search intent from
|
|
127
|
+
// useApplySearch, unmount from registry disposal. Native glyph support is
|
|
128
|
+
// deliberately absent: its background check can finish at any moment
|
|
129
|
+
// after the first paint, and a category jump that it cancelled would
|
|
130
|
+
// never arrive. Jumps read their target's offset when they scroll.
|
|
131
|
+
export const NavigationInvalidation = /* @__PURE__ */ React.memo(
|
|
132
|
+
function NavigationInvalidation() {
|
|
133
|
+
const registry = useNavigationRegistry();
|
|
134
|
+
const [reactionsMode] = useReactionsModeState();
|
|
135
|
+
const { emojiData } = usePickerDataContext();
|
|
136
|
+
const [emojiSize] = useEmojiSizeState();
|
|
137
|
+
const emojiVersion = useEmojiVersionConfig();
|
|
138
|
+
const [skinTone] = useActiveSkinToneState();
|
|
139
|
+
// Keyed by order/membership, not identity: the merged config is rebuilt
|
|
140
|
+
// for unrelated prop changes, which must not cancel navigation.
|
|
141
|
+
const inventoryKey = JSON.stringify([
|
|
142
|
+
useCategoriesConfig().map(categoryIdFromCategoryConfig),
|
|
143
|
+
emojiVersion,
|
|
144
|
+
skinTone,
|
|
145
|
+
]);
|
|
146
|
+
const prevSnapshot = React.useRef<unknown[]>([
|
|
147
|
+
reactionsMode,
|
|
148
|
+
emojiData,
|
|
149
|
+
emojiSize,
|
|
150
|
+
inventoryKey,
|
|
151
|
+
]);
|
|
152
|
+
|
|
153
|
+
React.useEffect(() => {
|
|
154
|
+
const next = [reactionsMode, emojiData, emojiSize, inventoryKey];
|
|
155
|
+
if (next.every((value, index) => value === prevSnapshot.current[index]))
|
|
156
|
+
return;
|
|
157
|
+
prevSnapshot.current = next;
|
|
158
|
+
registry.invalidate();
|
|
159
|
+
}, [registry, reactionsMode, emojiData, emojiSize, inventoryKey]);
|
|
160
|
+
|
|
161
|
+
return null;
|
|
162
|
+
},
|
|
163
|
+
);
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { cx } from 'shipstyles';
|
|
3
|
+
|
|
4
|
+
import { ClassNames } from '../../DomUtils/classNames';
|
|
5
|
+
import { stylesheet } from '../../Stylesheet/stylesheet';
|
|
6
|
+
import {
|
|
7
|
+
DEFAULT_PICKER_HEIGHT,
|
|
8
|
+
DEFAULT_PICKER_WIDTH,
|
|
9
|
+
} from '../../config/config';
|
|
10
|
+
import { defaultPickerTokens } from '../../primitives/tokens';
|
|
11
|
+
import { Theme, ThemeValue } from '../../types/exposedTypes';
|
|
12
|
+
|
|
13
|
+
// Official default appearance. Private and DOM-less: classes are merged
|
|
14
|
+
// onto the actual Root `aside` via its native `className` prop, so consumer
|
|
15
|
+
// `className`/`style`/`width`/`height` keep v4 root ownership. The component
|
|
16
|
+
// itself renders no DOM wrapper.
|
|
17
|
+
export function DefaultAppearance({ children }: { children: React.ReactNode }) {
|
|
18
|
+
return <>{children}</>;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// Official default appearance for the picker root. Private and DOM-less:
|
|
22
|
+
// these classes are merged onto the actual Root `aside` via its native `className` prop, so
|
|
23
|
+
// consumer `className`/`style`/`width`/`height` keep v4 root ownership.
|
|
24
|
+
// Selector names are unchanged from v4, keeping pixel compatibility.
|
|
25
|
+
export function defaultRootClassName(
|
|
26
|
+
theme: ThemeValue | undefined,
|
|
27
|
+
className?: string,
|
|
28
|
+
unstyled?: boolean,
|
|
29
|
+
): string {
|
|
30
|
+
// `unstyled` drops the branded chrome and color tokens entirely. Layout,
|
|
31
|
+
// geometry and behavior come from Root's structural sheet, so the picker
|
|
32
|
+
// stays fully functional while every color, border and font is the
|
|
33
|
+
// consumer's (style it through className and [data-epr-part] selectors).
|
|
34
|
+
if (unstyled) {
|
|
35
|
+
return cx(className);
|
|
36
|
+
}
|
|
37
|
+
return cx(
|
|
38
|
+
styles.main,
|
|
39
|
+
styles.baseVariables,
|
|
40
|
+
theme === Theme.DARK && styles.darkTheme,
|
|
41
|
+
theme === Theme.AUTO && styles.autoThemeDark,
|
|
42
|
+
className,
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function defaultRootStyle({
|
|
47
|
+
width,
|
|
48
|
+
height,
|
|
49
|
+
style,
|
|
50
|
+
columns,
|
|
51
|
+
}: {
|
|
52
|
+
width: string | number | undefined;
|
|
53
|
+
height: string | number | undefined;
|
|
54
|
+
style: React.CSSProperties | undefined;
|
|
55
|
+
columns?: number;
|
|
56
|
+
}): React.CSSProperties {
|
|
57
|
+
return {
|
|
58
|
+
// v4-compatible default dimensions; consumer style and explicit
|
|
59
|
+
// width/height props both override them. With `columns`, the width
|
|
60
|
+
// fits the columns instead.
|
|
61
|
+
...(columns === undefined && { width: getDimension(DEFAULT_PICKER_WIDTH) }),
|
|
62
|
+
height: getDimension(DEFAULT_PICKER_HEIGHT),
|
|
63
|
+
...style,
|
|
64
|
+
...(width !== undefined ? { width: getDimension(width) } : {}),
|
|
65
|
+
...(height !== undefined ? { height: getDimension(height) } : {}),
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function getDimension(dimension: string | number): string | number {
|
|
70
|
+
return typeof dimension === 'number' ? `${dimension}px` : dimension;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// Dark-theme value definitions referenced by the DarkTheme overrides.
|
|
74
|
+
// Private to the default tree (see the token preset note): the packed
|
|
75
|
+
// package check scans the primitives bundle for their absence.
|
|
76
|
+
const darkThemeBaseVariables: Record<string, string> = {
|
|
77
|
+
'--epr-dark': '#000',
|
|
78
|
+
'--epr-dark-emoji-variation-picker-bg-color': 'var(--epr-dark)',
|
|
79
|
+
'--epr-dark-highlight-color': '#c0c0c0',
|
|
80
|
+
'--epr-dark-text-color': 'var(--epr-highlight-color)',
|
|
81
|
+
'--epr-dark-hover-bg-color': '#363636f6',
|
|
82
|
+
'--epr-dark-hover-bg-color-reduced-opacity': '#36363680',
|
|
83
|
+
'--epr-dark-focus-bg-color': '#474747',
|
|
84
|
+
'--epr-dark-search-input-bg-color': '#333333',
|
|
85
|
+
'--epr-dark-category-label-bg-color': '#222222e6',
|
|
86
|
+
'--epr-dark-picker-border-color': '#151617',
|
|
87
|
+
'--epr-dark-bg-color': '#222222',
|
|
88
|
+
'--epr-dark-reactions-bg-color': '#22222290',
|
|
89
|
+
'--epr-dark-search-input-bg-color-active': 'var(--epr-dark)',
|
|
90
|
+
'--epr-dark-emoji-variation-indicator-color': '#444',
|
|
91
|
+
'--epr-dark-category-icon-active-color': '#6AA9DD',
|
|
92
|
+
'--epr-dark-category-icon-inactive-color': '#C0C0BF',
|
|
93
|
+
'--epr-dark-skin-tone-picker-menu-color': '#22222295',
|
|
94
|
+
'--epr-dark-skin-tone-outer-border-color':
|
|
95
|
+
'var(--epr-dark-picker-border-color)',
|
|
96
|
+
'--epr-dark-skin-tone-inner-border-color': '#00000000',
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
const DarkTheme = {
|
|
100
|
+
'--epr-emoji-variation-picker-bg-color':
|
|
101
|
+
'var(--epr-dark-emoji-variation-picker-bg-color)',
|
|
102
|
+
'--epr-hover-bg-color-reduced-opacity':
|
|
103
|
+
'var(--epr-dark-hover-bg-color-reduced-opacity)',
|
|
104
|
+
'--epr-highlight-color': 'var(--epr-dark-highlight-color)',
|
|
105
|
+
'--epr-text-color': 'var(--epr-dark-text-color)',
|
|
106
|
+
'--epr-hover-bg-color': 'var(--epr-dark-hover-bg-color)',
|
|
107
|
+
'--epr-focus-bg-color': 'var(--epr-dark-focus-bg-color)',
|
|
108
|
+
'--epr-search-input-bg-color': 'var(--epr-dark-search-input-bg-color)',
|
|
109
|
+
'--epr-category-label-bg-color': 'var(--epr-dark-category-label-bg-color)',
|
|
110
|
+
'--epr-picker-border-color': 'var(--epr-dark-picker-border-color)',
|
|
111
|
+
'--epr-bg-color': 'var(--epr-dark-bg-color)',
|
|
112
|
+
'--epr-reactions-bg-color': 'var(--epr-dark-reactions-bg-color)',
|
|
113
|
+
'--epr-search-input-bg-color-active':
|
|
114
|
+
'var(--epr-dark-search-input-bg-color-active)',
|
|
115
|
+
'--epr-emoji-variation-indicator-color':
|
|
116
|
+
'var(--epr-dark-emoji-variation-indicator-color)',
|
|
117
|
+
'--epr-category-icon-active-color':
|
|
118
|
+
'var(--epr-dark-category-icon-active-color)',
|
|
119
|
+
'--epr-category-icon-inactive-color':
|
|
120
|
+
'var(--epr-dark-category-icon-inactive-color)',
|
|
121
|
+
'--epr-skin-tone-picker-menu-color':
|
|
122
|
+
'var(--epr-dark-skin-tone-picker-menu-color)',
|
|
123
|
+
'--epr-skin-tone-outer-border-color':
|
|
124
|
+
'var(--epr-dark-skin-tone-outer-border-color)',
|
|
125
|
+
'--epr-skin-tone-inner-border-color':
|
|
126
|
+
'var(--epr-dark-skin-tone-inner-border-color)',
|
|
127
|
+
'--epr-dark-text-color': 'var(--epr-highlight-color)',
|
|
128
|
+
'--epr-dark-hover-bg-color': '#363636f6',
|
|
129
|
+
'--epr-dark-hover-bg-color-reduced-opacity': '#36363680',
|
|
130
|
+
'--epr-dark-focus-bg-color': '#474747',
|
|
131
|
+
'--epr-dark-search-input-bg-color': '#333333',
|
|
132
|
+
'--epr-dark-category-label-bg-color': '#222222e6',
|
|
133
|
+
'--epr-dark-picker-border-color': '#151617',
|
|
134
|
+
'--epr-dark-bg-color': '#222222',
|
|
135
|
+
'--epr-dark-reactions-bg-color': '#22222290',
|
|
136
|
+
'--epr-dark-search-input-bg-color-active': 'var(--epr-dark)',
|
|
137
|
+
'--epr-dark-emoji-variation-indicator-color': '#444',
|
|
138
|
+
'--epr-dark-category-icon-active-color': '#6AA9DD',
|
|
139
|
+
'--epr-dark-category-icon-inactive-color': '#C0C0BF',
|
|
140
|
+
'--epr-dark-skin-tone-picker-menu-color': '#22222295',
|
|
141
|
+
'--epr-dark-skin-tone-outer-border-color':
|
|
142
|
+
'var(--epr-dark-picker-border-color)',
|
|
143
|
+
'--epr-dark-skin-tone-inner-border-color': '#00000000',
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
const styles = /* @__PURE__ */ (() =>
|
|
147
|
+
stylesheet.create({
|
|
148
|
+
main: {
|
|
149
|
+
'.': ['epr-main', ClassNames.emojiPicker],
|
|
150
|
+
position: 'relative',
|
|
151
|
+
display: 'flex',
|
|
152
|
+
flexDirection: 'column',
|
|
153
|
+
borderWidth: '1px',
|
|
154
|
+
borderStyle: 'solid',
|
|
155
|
+
borderRadius: 'var(--epr-picker-border-radius)',
|
|
156
|
+
borderColor: 'var(--epr-picker-border-color)',
|
|
157
|
+
backgroundColor: 'var(--epr-bg-color)',
|
|
158
|
+
overflow: 'hidden',
|
|
159
|
+
transition: 'height 0.3s ease-in-out, background-color 0.1s ease-in-out',
|
|
160
|
+
'*': {
|
|
161
|
+
boxSizing: 'border-box',
|
|
162
|
+
// Overridable without a specificity fight (v4 hard-coded sans-serif).
|
|
163
|
+
fontFamily: 'var(--epr-font-family, sans-serif)',
|
|
164
|
+
},
|
|
165
|
+
},
|
|
166
|
+
baseVariables: {
|
|
167
|
+
// Single-sourced from the public token preset: the default tree and
|
|
168
|
+
// bare-Root consumers share the same documented defaults. The private
|
|
169
|
+
// dark-theme values ride along (referenced only by the DarkTheme
|
|
170
|
+
// overrides below); they stay out of the shared preset so the
|
|
171
|
+
// primitives bundle keeps its separation marker scan clean.
|
|
172
|
+
'--': { ...defaultPickerTokens, ...darkThemeBaseVariables },
|
|
173
|
+
},
|
|
174
|
+
// color-scheme makes native parts (scrollbars, the search field's
|
|
175
|
+
// controls) render dark too; without it they stay light on a dark picker.
|
|
176
|
+
autoThemeDark: {
|
|
177
|
+
'.': ClassNames.autoTheme,
|
|
178
|
+
'@media (prefers-color-scheme: dark)': {
|
|
179
|
+
'--': DarkTheme,
|
|
180
|
+
colorScheme: 'dark',
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
darkTheme: {
|
|
184
|
+
'.': ClassNames.darkTheme,
|
|
185
|
+
'--': DarkTheme,
|
|
186
|
+
colorScheme: 'dark',
|
|
187
|
+
},
|
|
188
|
+
}))();
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// Shared label-height fallback (pixels). Lives in its own side-effect-free
|
|
2
|
+
// module so measurement code in the primitives closure never imports the
|
|
3
|
+
// default-appearance stylesheet (which would drag branded CSS into the
|
|
4
|
+
// primitives bundle).
|
|
5
|
+
export const DEFAULT_LABEL_HEIGHT = 40;
|
|
@@ -7,7 +7,12 @@ import {
|
|
|
7
7
|
darkMode,
|
|
8
8
|
stylesheet,
|
|
9
9
|
} from '../../Stylesheet/stylesheet';
|
|
10
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
categoryIdFromCategoryConfig,
|
|
12
|
+
categoryNameFromCategoryConfig,
|
|
13
|
+
} from '../../config/categoryConfig';
|
|
14
|
+
import { useDefaultAppearance } from '../../primitives/appearance';
|
|
15
|
+
import { usePickerComponents } from '../../primitives/components';
|
|
11
16
|
import { CategoryConfig } from '../../types/exposedTypes';
|
|
12
17
|
import { Button } from '../atoms/Button';
|
|
13
18
|
|
|
@@ -30,29 +35,47 @@ export function CategoryButton({
|
|
|
30
35
|
onClick,
|
|
31
36
|
customIcon,
|
|
32
37
|
}: Props) {
|
|
38
|
+
const appearance = useDefaultAppearance();
|
|
39
|
+
const { CategoryButton: Custom } = usePickerComponents();
|
|
40
|
+
const decorated = appearance && !Custom;
|
|
33
41
|
// Priority: categoryConfig.icon > customIcon prop (from categoryIcons)
|
|
34
42
|
const icon = categoryConfig.icon ?? customIcon;
|
|
35
43
|
const hasCustomIcon = icon != null;
|
|
36
44
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
onClick
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
45
|
+
const props: React.ButtonHTMLAttributes<HTMLButtonElement> = {
|
|
46
|
+
type: 'button',
|
|
47
|
+
tabIndex: allowNavigation ? 0 : -1,
|
|
48
|
+
className: cx(
|
|
49
|
+
styles.geometry,
|
|
50
|
+
decorated && styles.catBtn,
|
|
51
|
+
decorated && commonInteractionStyles.categoryBtn,
|
|
52
|
+
hasCustomIcon ? styles.customIcon : `epr-icn-${category}`,
|
|
53
|
+
{ [ClassNames.active]: isActiveCategory },
|
|
54
|
+
),
|
|
55
|
+
onClick: (event) => {
|
|
56
|
+
if (!event.defaultPrevented) onClick();
|
|
57
|
+
},
|
|
58
|
+
'aria-label': categoryNameFromCategoryConfig(categoryConfig),
|
|
59
|
+
'aria-selected': isActiveCategory,
|
|
60
|
+
role: 'tab',
|
|
61
|
+
children: hasCustomIcon ? icon : <CategoryNavIcon category={category} />,
|
|
62
|
+
};
|
|
63
|
+
const managed = {
|
|
64
|
+
...props,
|
|
65
|
+
'data-epr-part': 'category-tab',
|
|
66
|
+
'data-epr-active': isActiveCategory ? '' : undefined,
|
|
67
|
+
};
|
|
68
|
+
return Custom ? (
|
|
69
|
+
<Custom
|
|
70
|
+
{...managed}
|
|
71
|
+
category={{
|
|
72
|
+
id: categoryIdFromCategoryConfig(categoryConfig),
|
|
73
|
+
name: categoryNameFromCategoryConfig(categoryConfig),
|
|
74
|
+
isActive: isActiveCategory,
|
|
75
|
+
}}
|
|
76
|
+
/>
|
|
77
|
+
) : (
|
|
78
|
+
<Button {...managed} />
|
|
56
79
|
);
|
|
57
80
|
}
|
|
58
81
|
|
|
@@ -72,41 +95,44 @@ const DarkInactivePosition = {
|
|
|
72
95
|
},
|
|
73
96
|
};
|
|
74
97
|
|
|
75
|
-
const styles =
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
width: 'var(--epr-category-navigation-button-size)',
|
|
83
|
-
outline: 'none',
|
|
84
|
-
// Icon glyphs are inline SVGs painted with currentColor, so the fill
|
|
85
|
-
// follows the --epr-category-icon-*-color variables.
|
|
86
|
-
// https://github.com/ealush/emoji-picker-react/issues/399
|
|
87
|
-
color: 'var(--epr-category-icon-inactive-color, #868686)',
|
|
88
|
-
':focus:before': {
|
|
89
|
-
content: '',
|
|
90
|
-
position: 'absolute',
|
|
91
|
-
top: '-2px',
|
|
92
|
-
left: '-2px',
|
|
93
|
-
right: '-2px',
|
|
94
|
-
bottom: '-2px',
|
|
95
|
-
border: '2px solid var(--epr-category-icon-active-color)',
|
|
96
|
-
borderRadius: '50%',
|
|
98
|
+
const styles = /* @__PURE__ */ (() =>
|
|
99
|
+
stylesheet.create({
|
|
100
|
+
geometry: {
|
|
101
|
+
display: 'inline-block',
|
|
102
|
+
position: 'relative',
|
|
103
|
+
height: 'var(--epr-category-navigation-button-size)',
|
|
104
|
+
width: 'var(--epr-category-navigation-button-size)',
|
|
97
105
|
},
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
106
|
+
catBtn: {
|
|
107
|
+
'.': 'epr-cat-btn',
|
|
108
|
+
transition: 'opacity 0.2s ease-in-out',
|
|
109
|
+
outline: 'none',
|
|
110
|
+
// Icon glyphs are inline SVGs painted with currentColor, so the fill
|
|
111
|
+
// follows the --epr-category-icon-*-color variables.
|
|
112
|
+
// https://github.com/ealush/emoji-picker-react/issues/399
|
|
113
|
+
color: 'var(--epr-category-icon-inactive-color, #868686)',
|
|
114
|
+
':focus:before': {
|
|
115
|
+
content: '',
|
|
116
|
+
position: 'absolute',
|
|
117
|
+
top: '-2px',
|
|
118
|
+
left: '-2px',
|
|
119
|
+
right: '-2px',
|
|
120
|
+
bottom: '-2px',
|
|
121
|
+
border: '2px solid var(--epr-category-icon-active-color)',
|
|
122
|
+
borderRadius: '50%',
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
customIcon: {
|
|
126
|
+
'.': 'epr-cat-btn-custom-icon',
|
|
127
|
+
display: 'flex',
|
|
128
|
+
alignItems: 'center',
|
|
129
|
+
justifyContent: 'center',
|
|
130
|
+
},
|
|
131
|
+
...darkMode('catBtn', DarkInactiveColor),
|
|
132
|
+
'.epr-dark-theme': {
|
|
133
|
+
...DarkInactivePosition,
|
|
134
|
+
},
|
|
135
|
+
'.epr-auto-theme': {
|
|
136
|
+
...DarkInactivePosition,
|
|
137
|
+
},
|
|
138
|
+
}))();
|