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,398 @@
|
|
|
1
|
+
/* global process: readonly */
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { cx } from 'shipstyles';
|
|
4
|
+
|
|
5
|
+
import { ClassNames } from '../DomUtils/classNames';
|
|
6
|
+
import { PickerStyleTag } from '../Stylesheet/stylesheet';
|
|
7
|
+
import {
|
|
8
|
+
ElementRefContextProvider,
|
|
9
|
+
usePickerMainRef,
|
|
10
|
+
} from '../components/context/ElementRefContext';
|
|
11
|
+
import { PickerConfigProvider } from '../components/context/PickerConfigContext';
|
|
12
|
+
import {
|
|
13
|
+
PickerContextProvider,
|
|
14
|
+
useReactionsModeState,
|
|
15
|
+
} from '../components/context/PickerContext';
|
|
16
|
+
import { PickerDataProvider } from '../components/context/PickerDataContext';
|
|
17
|
+
import {
|
|
18
|
+
NavigationInvalidation,
|
|
19
|
+
ReactionsModeObserver,
|
|
20
|
+
SearchSync,
|
|
21
|
+
} from '../components/main/PickerMainBehaviors';
|
|
22
|
+
import { ActiveCategoryProvider } from '../components/navigation/CategoryNavigation';
|
|
23
|
+
import { basePickerConfig } from '../config/config';
|
|
24
|
+
import { DefaultPickerConfiguration } from '../config/defaultPickerConfiguration';
|
|
25
|
+
import {
|
|
26
|
+
MutableConfigProvider,
|
|
27
|
+
NO_MUTABLE_PROVIDER,
|
|
28
|
+
useDefineMutableConfig,
|
|
29
|
+
useInheritedMutableConfig,
|
|
30
|
+
} from '../config/mutableConfig';
|
|
31
|
+
import { useColumnsConfig } from '../config/useConfig';
|
|
32
|
+
import useIsSearchMode from '../hooks/useIsSearchMode';
|
|
33
|
+
import { useKeyboardNavigation } from '../hooks/useKeyboardNavigation';
|
|
34
|
+
import { useOnFocus } from '../hooks/useOnFocus';
|
|
35
|
+
import { useReactionsFocusManager } from '../hooks/useReactionsFocus';
|
|
36
|
+
import {
|
|
37
|
+
DataLoadingProvider,
|
|
38
|
+
EmojiDataInput,
|
|
39
|
+
useResolvedEmojiData,
|
|
40
|
+
} from '../hooks/useResolvedEmojiData';
|
|
41
|
+
import {
|
|
42
|
+
SkinTonePickerLocation,
|
|
43
|
+
Theme,
|
|
44
|
+
ThemeValue,
|
|
45
|
+
} from '../types/exposedTypes';
|
|
46
|
+
|
|
47
|
+
import { AppearanceContext } from './appearance';
|
|
48
|
+
import { PickerComponentsContext, EMPTY_COMPONENTS } from './components';
|
|
49
|
+
import { useMergedRefs } from './nativeProps';
|
|
50
|
+
import { RootScopeProvider } from './scope';
|
|
51
|
+
import { StructuralStyleTag, structuralStyles } from './structuralStyles';
|
|
52
|
+
import type { RootProps } from './types';
|
|
53
|
+
|
|
54
|
+
// Public Root primitive.
|
|
55
|
+
//
|
|
56
|
+
// Root owns behavior/configuration and renders the actual `aside`. It does
|
|
57
|
+
// not own the branded default appearance: theme/width/height stay with the
|
|
58
|
+
// default wrapper, while `className`/`style`/other native `aside`
|
|
59
|
+
// attributes land on the real element. `role` is library-owned and
|
|
60
|
+
// `data-epr-*` is reserved, so both are stripped from consumer props.
|
|
61
|
+
//
|
|
62
|
+
// Caller JSX owns every part's presence and placement. Root installs no
|
|
63
|
+
// ErrorBoundary; consumer render errors propagate to the application's
|
|
64
|
+
// own boundary.
|
|
65
|
+
|
|
66
|
+
const APPEARANCE_ONLY_PROPS = new Set([
|
|
67
|
+
'theme',
|
|
68
|
+
'width',
|
|
69
|
+
'height',
|
|
70
|
+
'className',
|
|
71
|
+
'style',
|
|
72
|
+
]);
|
|
73
|
+
|
|
74
|
+
const BEHAVIOR_KEYS: ReadonlySet<string> = new Set(
|
|
75
|
+
Object.keys(basePickerConfig()),
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
// Event callbacks live outside the base config shape (they are Partial-only
|
|
79
|
+
// inputs), but they are behavior: they feed the mutable config, never the
|
|
80
|
+
// DOM element.
|
|
81
|
+
const CALLBACK_KEYS = new Set([
|
|
82
|
+
'onEmojiClick',
|
|
83
|
+
'onReactionClick',
|
|
84
|
+
'onSkinToneChange',
|
|
85
|
+
]);
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Whether `key` is a picker configuration prop or callback (as opposed to
|
|
89
|
+
* a native attribute). The default picker forwards only these to Root, so
|
|
90
|
+
* unknown props never reach the DOM, as in v4.
|
|
91
|
+
*/
|
|
92
|
+
export function isPickerBehaviorProp(key: string): boolean {
|
|
93
|
+
return CALLBACK_KEYS.has(key) || BEHAVIOR_KEYS.has(key);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
let warnedTheme = false;
|
|
97
|
+
function warnThemeOnRoot(): void {
|
|
98
|
+
if (warnedTheme || process.env.NODE_ENV === 'production') return;
|
|
99
|
+
warnedTheme = true;
|
|
100
|
+
// eslint-disable-next-line no-console
|
|
101
|
+
console.warn(
|
|
102
|
+
'[emoji-picker-react] Root ignores `theme`; use colorScheme="light" | "dark" | "auto".',
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/** Test-only: allow the one-time warning to fire again. */
|
|
107
|
+
export function __resetRootWarningsForTest(): void {
|
|
108
|
+
warnedTheme = false;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function splitRootProps(props: Omit<RootProps, 'children'>): {
|
|
112
|
+
behaviorProps: Record<string, unknown>;
|
|
113
|
+
asideProps: Record<string, unknown>;
|
|
114
|
+
} {
|
|
115
|
+
const behaviorProps: Record<string, unknown> = {};
|
|
116
|
+
const asideProps: Record<string, unknown> = {};
|
|
117
|
+
for (const key of Object.keys(props)) {
|
|
118
|
+
assignRootProp(
|
|
119
|
+
key,
|
|
120
|
+
(props as Record<string, unknown>)[key],
|
|
121
|
+
behaviorProps,
|
|
122
|
+
asideProps,
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
return { behaviorProps, asideProps };
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
const COMPOSITION_PROPS = new Set([
|
|
129
|
+
'open',
|
|
130
|
+
'searchDisabled',
|
|
131
|
+
'skinTonesDisabled',
|
|
132
|
+
'skinTonePickerLocation',
|
|
133
|
+
'composition',
|
|
134
|
+
'panelProps',
|
|
135
|
+
]);
|
|
136
|
+
|
|
137
|
+
const NON_BEHAVIOR_PROPS = new Set([
|
|
138
|
+
...COMPOSITION_PROPS,
|
|
139
|
+
'role',
|
|
140
|
+
'width',
|
|
141
|
+
'height',
|
|
142
|
+
'dangerouslySetInnerHTML',
|
|
143
|
+
]);
|
|
144
|
+
|
|
145
|
+
function assignRootProp(
|
|
146
|
+
key: string,
|
|
147
|
+
value: unknown,
|
|
148
|
+
behaviorProps: Record<string, unknown>,
|
|
149
|
+
asideProps: Record<string, unknown>,
|
|
150
|
+
): void {
|
|
151
|
+
if (NON_BEHAVIOR_PROPS.has(key) || key.startsWith('data-epr-')) {
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
// `colorScheme` is a Root appearance prop (color tokens), consumed by
|
|
155
|
+
// the aside; it never reaches behavior config. It is not named `theme`:
|
|
156
|
+
// Emotion, styled-components and MUI reserve that prop on components
|
|
157
|
+
// they wrap, so a styled(Root) would swallow (or crash on) it.
|
|
158
|
+
if (key === 'colorScheme') {
|
|
159
|
+
asideProps[key] = value;
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
// `theme` is the default picker's v4 name; it is not a Root prop and
|
|
163
|
+
// must not leak onto the DOM element. Development says so once, since
|
|
164
|
+
// a silently ignored prop reads like a broken dark mode.
|
|
165
|
+
if (key === 'theme') {
|
|
166
|
+
warnThemeOnRoot();
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
if (isRootBehaviorProp(key)) {
|
|
170
|
+
behaviorProps[key] =
|
|
171
|
+
key === 'previewConfig' ? omitPreviewPresence(value) : value;
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
asideProps[key] = value;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
const useIgnoredCompositionWarning: (
|
|
178
|
+
props: Omit<RootProps, 'children'>,
|
|
179
|
+
) => void =
|
|
180
|
+
process.env.NODE_ENV === 'production'
|
|
181
|
+
? () => undefined
|
|
182
|
+
: useDevIgnoredCompositionWarning;
|
|
183
|
+
|
|
184
|
+
function useDevIgnoredCompositionWarning(
|
|
185
|
+
props: Omit<RootProps, 'children'>,
|
|
186
|
+
): void {
|
|
187
|
+
const ignoredProps =
|
|
188
|
+
Object.keys(props).some((key) => COMPOSITION_PROPS.has(key)) ||
|
|
189
|
+
'showPreview' in ((props.previewConfig ?? {}) as object);
|
|
190
|
+
React.useEffect(() => {
|
|
191
|
+
if (ignoredProps) {
|
|
192
|
+
// eslint-disable-next-line no-console
|
|
193
|
+
console.warn(
|
|
194
|
+
'[emoji-picker-react] Root ignores composition props. Compose parts instead.',
|
|
195
|
+
);
|
|
196
|
+
}
|
|
197
|
+
}, [ignoredProps]);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
function isRootBehaviorProp(key: string): boolean {
|
|
201
|
+
return (
|
|
202
|
+
CALLBACK_KEYS.has(key) ||
|
|
203
|
+
(BEHAVIOR_KEYS.has(key) && !APPEARANCE_ONLY_PROPS.has(key))
|
|
204
|
+
);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
function omitPreviewPresence(value: unknown): unknown {
|
|
208
|
+
if (!value || typeof value !== 'object') return value;
|
|
209
|
+
const preview = { ...(value as Record<string, unknown>) };
|
|
210
|
+
delete preview.showPreview;
|
|
211
|
+
return preview;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
export const Root = /* @__PURE__ */ React.forwardRef<HTMLElement, RootProps>(
|
|
215
|
+
function Root(props, forwardedRef) {
|
|
216
|
+
const { children, appearance = 'none', components, ...rest } = props;
|
|
217
|
+
const { behaviorProps: rawBehaviorProps, asideProps } =
|
|
218
|
+
splitRootProps(rest);
|
|
219
|
+
const defaultConfiguration = React.useContext(DefaultPickerConfiguration);
|
|
220
|
+
useIgnoredCompositionWarning(rest);
|
|
221
|
+
// emojiData may be an object, a loader, or absent; everything below
|
|
222
|
+
// Root only ever sees a synchronous dataset.
|
|
223
|
+
const dataState = useResolvedEmojiData(
|
|
224
|
+
rawBehaviorProps.emojiData as EmojiDataInput | undefined,
|
|
225
|
+
);
|
|
226
|
+
const resolvedEmojiData = dataState.data;
|
|
227
|
+
const behaviorProps = {
|
|
228
|
+
...rawBehaviorProps,
|
|
229
|
+
emojiData: resolvedEmojiData,
|
|
230
|
+
// Mounted primitives are always available. Legacy engine behavior
|
|
231
|
+
// (e.g. suppressing variations) is supplied by the default wrapper.
|
|
232
|
+
searchDisabled: false,
|
|
233
|
+
skinTonesDisabled: false,
|
|
234
|
+
skinTonePickerLocation: SkinTonePickerLocation.NONE,
|
|
235
|
+
...defaultConfiguration,
|
|
236
|
+
};
|
|
237
|
+
const parentMutableRef = useInheritedMutableConfig();
|
|
238
|
+
const ownedMutableRef = useDefineMutableConfig({
|
|
239
|
+
onEmojiClick: behaviorProps.onEmojiClick as never,
|
|
240
|
+
onReactionClick: behaviorProps.onReactionClick as never,
|
|
241
|
+
onSkinToneChange: behaviorProps.onSkinToneChange as never,
|
|
242
|
+
onSearchChange: behaviorProps.onSearchChange as never,
|
|
243
|
+
onReactionsModeChange: behaviorProps.onReactionsModeChange as never,
|
|
244
|
+
});
|
|
245
|
+
// Adopt callbacks supplied by the default wrapper across its memo
|
|
246
|
+
// boundary, so callback-only parent updates stay fresh. Root's
|
|
247
|
+
// provider does not pass ownership to nested Roots: each bare Root
|
|
248
|
+
// owns its callbacks. Hooks stay unconditional when closed.
|
|
249
|
+
const mutableRef =
|
|
250
|
+
parentMutableRef !== NO_MUTABLE_PROVIDER
|
|
251
|
+
? parentMutableRef
|
|
252
|
+
: ownedMutableRef;
|
|
253
|
+
|
|
254
|
+
return (
|
|
255
|
+
<DefaultPickerConfiguration.Provider value={null}>
|
|
256
|
+
<ElementRefContextProvider>
|
|
257
|
+
<DataLoadingProvider value={dataState}>
|
|
258
|
+
<PickerConfigProvider {...behaviorProps}>
|
|
259
|
+
<MutableConfigProvider value={mutableRef}>
|
|
260
|
+
<PickerDataProvider>
|
|
261
|
+
<PickerContextProvider>
|
|
262
|
+
<RootScopeProvider>
|
|
263
|
+
<AppearanceContext.Provider
|
|
264
|
+
value={appearance === 'default'}
|
|
265
|
+
>
|
|
266
|
+
<PickerComponentsContext.Provider
|
|
267
|
+
value={components ?? EMPTY_COMPONENTS}
|
|
268
|
+
>
|
|
269
|
+
<ActiveCategoryProvider>
|
|
270
|
+
{defaultConfiguration?.open === false ? null : (
|
|
271
|
+
<RootAside
|
|
272
|
+
defaultLayout={defaultConfiguration !== null}
|
|
273
|
+
appearance={appearance}
|
|
274
|
+
ref={forwardedRef}
|
|
275
|
+
asideProps={asideProps}
|
|
276
|
+
behaviorNonce={
|
|
277
|
+
behaviorProps.nonce as string | undefined
|
|
278
|
+
}
|
|
279
|
+
cssLayer={
|
|
280
|
+
behaviorProps.cssLayer as string | undefined
|
|
281
|
+
}
|
|
282
|
+
>
|
|
283
|
+
{children}
|
|
284
|
+
</RootAside>
|
|
285
|
+
)}
|
|
286
|
+
</ActiveCategoryProvider>
|
|
287
|
+
</PickerComponentsContext.Provider>
|
|
288
|
+
</AppearanceContext.Provider>
|
|
289
|
+
</RootScopeProvider>
|
|
290
|
+
</PickerContextProvider>
|
|
291
|
+
</PickerDataProvider>
|
|
292
|
+
</MutableConfigProvider>
|
|
293
|
+
</PickerConfigProvider>
|
|
294
|
+
</DataLoadingProvider>
|
|
295
|
+
</ElementRefContextProvider>
|
|
296
|
+
</DefaultPickerConfiguration.Provider>
|
|
297
|
+
);
|
|
298
|
+
},
|
|
299
|
+
);
|
|
300
|
+
|
|
301
|
+
const RootAside = /* @__PURE__ */ React.forwardRef<
|
|
302
|
+
HTMLElement,
|
|
303
|
+
{
|
|
304
|
+
asideProps: Record<string, unknown>;
|
|
305
|
+
behaviorNonce: string | undefined;
|
|
306
|
+
cssLayer: string | undefined;
|
|
307
|
+
children: React.ReactNode;
|
|
308
|
+
defaultLayout: boolean;
|
|
309
|
+
appearance: 'none' | 'default';
|
|
310
|
+
}
|
|
311
|
+
>(function RootAside(
|
|
312
|
+
{ asideProps, behaviorNonce, cssLayer, children, defaultLayout, appearance },
|
|
313
|
+
forwardedRef,
|
|
314
|
+
) {
|
|
315
|
+
const columns = useColumnsConfig();
|
|
316
|
+
const PickerMainRef = usePickerMainRef();
|
|
317
|
+
const mergedRef = useMergedRefs<HTMLElement>(forwardedRef, PickerMainRef);
|
|
318
|
+
const [reactionsOpen] = useReactionsModeState();
|
|
319
|
+
const searchModeActive = useIsSearchMode();
|
|
320
|
+
useKeyboardNavigation();
|
|
321
|
+
useOnFocus();
|
|
322
|
+
useReactionsFocusManager();
|
|
323
|
+
|
|
324
|
+
const {
|
|
325
|
+
className,
|
|
326
|
+
style,
|
|
327
|
+
colorScheme: theme,
|
|
328
|
+
...nativeAside
|
|
329
|
+
} = asideProps as {
|
|
330
|
+
className?: string;
|
|
331
|
+
style?: React.CSSProperties;
|
|
332
|
+
colorScheme?: ThemeValue;
|
|
333
|
+
[key: string]: unknown;
|
|
334
|
+
};
|
|
335
|
+
const rootStyle: React.CSSProperties = {
|
|
336
|
+
...(columns && ({ '--epr-columns': columns } as React.CSSProperties)),
|
|
337
|
+
...style,
|
|
338
|
+
};
|
|
339
|
+
// The default assembly owns compact sizing; caller compositions keep theirs.
|
|
340
|
+
if (reactionsOpen && defaultLayout) {
|
|
341
|
+
delete rootStyle.height;
|
|
342
|
+
delete rootStyle.width;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
return (
|
|
346
|
+
<>
|
|
347
|
+
{/*
|
|
348
|
+
Managed components (search/grid/tabs/…) carry their styles on the
|
|
349
|
+
shared component sheet; measurement, virtualization and keyboard
|
|
350
|
+
navigation depend on those rules, so every Root emits them. The
|
|
351
|
+
branded layer (theme classes, transitions, default tokens via the
|
|
352
|
+
default tree's className) is what bare compositions opt out of —
|
|
353
|
+
never the functional component styles. Bundle separation (no
|
|
354
|
+
default-appearance module in this closure) is asserted separately.
|
|
355
|
+
*/}
|
|
356
|
+
<PickerStyleTag nonce={behaviorNonce} cssLayer={cssLayer} />
|
|
357
|
+
<StructuralStyleTag nonce={behaviorNonce} cssLayer={cssLayer} />
|
|
358
|
+
<aside
|
|
359
|
+
{...(nativeAside as React.HTMLAttributes<HTMLElement>)}
|
|
360
|
+
ref={mergedRef}
|
|
361
|
+
data-epr-part="root"
|
|
362
|
+
data-epr-columns={columns}
|
|
363
|
+
className={cx(
|
|
364
|
+
structuralStyles.root,
|
|
365
|
+
theme === Theme.LIGHT && structuralStyles.themeLight,
|
|
366
|
+
theme === Theme.DARK && structuralStyles.themeDark,
|
|
367
|
+
theme === Theme.AUTO && structuralStyles.themeAuto,
|
|
368
|
+
appearance === 'default' && 'epr-appearance-default',
|
|
369
|
+
{
|
|
370
|
+
[ClassNames.searchActive]: searchModeActive,
|
|
371
|
+
[ClassNames.reactions]: reactionsOpen,
|
|
372
|
+
},
|
|
373
|
+
className,
|
|
374
|
+
collapsedClassName(defaultLayout, appearance, reactionsOpen),
|
|
375
|
+
)}
|
|
376
|
+
style={rootStyle}
|
|
377
|
+
>
|
|
378
|
+
{children}
|
|
379
|
+
<SearchSync />
|
|
380
|
+
<ReactionsModeObserver />
|
|
381
|
+
<NavigationInvalidation />
|
|
382
|
+
</aside>
|
|
383
|
+
</>
|
|
384
|
+
);
|
|
385
|
+
});
|
|
386
|
+
|
|
387
|
+
function collapsedClassName(
|
|
388
|
+
defaultLayout: boolean,
|
|
389
|
+
appearance: 'none' | 'default',
|
|
390
|
+
reactionsOpen: boolean,
|
|
391
|
+
) {
|
|
392
|
+
return cx(
|
|
393
|
+
defaultLayout && reactionsOpen && structuralStyles.collapsed,
|
|
394
|
+
appearance === 'default' &&
|
|
395
|
+
reactionsOpen &&
|
|
396
|
+
structuralStyles.collapsedAppearance,
|
|
397
|
+
);
|
|
398
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
import { SearchContainer } from '../components/header/Search/Search';
|
|
4
|
+
|
|
5
|
+
import { filterPrimitiveProps } from './nativeProps';
|
|
6
|
+
import { useRootScope } from './scope';
|
|
7
|
+
import type { SearchProps } from './types';
|
|
8
|
+
|
|
9
|
+
// Public Search primitive.
|
|
10
|
+
//
|
|
11
|
+
// Managed search region: input, status live region, clear control and icon.
|
|
12
|
+
// Additional controls are supplied as children. Ref addresses the region
|
|
13
|
+
// wrapper; `inputRef` addresses the input itself.
|
|
14
|
+
export const Search = /* @__PURE__ */ React.forwardRef<
|
|
15
|
+
HTMLDivElement,
|
|
16
|
+
SearchProps
|
|
17
|
+
>(function Search(props, forwardedRef) {
|
|
18
|
+
const inScope = useRootScope('Search');
|
|
19
|
+
const { children, inputProps, inputRef, ...rest } = props;
|
|
20
|
+
const nativeProps = filterPrimitiveProps(rest as Record<string, unknown>, [
|
|
21
|
+
'role',
|
|
22
|
+
]);
|
|
23
|
+
|
|
24
|
+
// Out-of-scope (production only; development throws above) renders
|
|
25
|
+
// null after a warn-once: continuing would crash with a TypeError.
|
|
26
|
+
if (!inScope) {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<div
|
|
32
|
+
{...(nativeProps as React.HTMLAttributes<HTMLDivElement>)}
|
|
33
|
+
ref={forwardedRef}
|
|
34
|
+
data-epr-part="search"
|
|
35
|
+
>
|
|
36
|
+
<SearchContainer inputProps={inputProps} inputRef={inputRef}>
|
|
37
|
+
{children}
|
|
38
|
+
</SearchContainer>
|
|
39
|
+
</div>
|
|
40
|
+
);
|
|
41
|
+
});
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
import { useSearchInputRef } from '../components/context/ElementRefContext';
|
|
4
|
+
import {
|
|
5
|
+
formatSearchResultsLabel,
|
|
6
|
+
useLabels,
|
|
7
|
+
useAutoFocusSearchConfig,
|
|
8
|
+
useSearchLabelConfig,
|
|
9
|
+
useSearchPlaceHolderConfig,
|
|
10
|
+
} from '../config/useConfig';
|
|
11
|
+
import { useCloseAllOpenToggles } from '../hooks/useCloseAllOpenToggles';
|
|
12
|
+
import { useRegisterRegion } from '../hooks/useRegisterRegion';
|
|
13
|
+
import { useEmojiDataState } from '../hooks/useResolvedEmojiData';
|
|
14
|
+
import { useSearchInputController } from '../hooks/useSearchController';
|
|
15
|
+
import { useVisibleSearchResultCount } from '../hooks/useSearchResults';
|
|
16
|
+
|
|
17
|
+
import {
|
|
18
|
+
composeHandlers,
|
|
19
|
+
filterPrimitiveProps,
|
|
20
|
+
useMergedRefs,
|
|
21
|
+
} from './nativeProps';
|
|
22
|
+
import { useRootScope } from './scope';
|
|
23
|
+
import type {
|
|
24
|
+
SearchInputComponent,
|
|
25
|
+
SearchInputElement,
|
|
26
|
+
SearchInputProps,
|
|
27
|
+
} from './types';
|
|
28
|
+
|
|
29
|
+
const hiddenStatus: React.CSSProperties = {
|
|
30
|
+
clip: 'rect(0 0 0 0)',
|
|
31
|
+
clipPath: 'inset(50%)',
|
|
32
|
+
height: 1,
|
|
33
|
+
overflow: 'hidden',
|
|
34
|
+
position: 'absolute',
|
|
35
|
+
whiteSpace: 'nowrap',
|
|
36
|
+
width: 1,
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/** Native input, or a ref-forwarding design-system input. Root owns its value. */
|
|
40
|
+
export const SearchInput = /* @__PURE__ */ React.forwardRef<
|
|
41
|
+
HTMLInputElement,
|
|
42
|
+
SearchInputProps<SearchInputElement>
|
|
43
|
+
>(function SearchInput(props, ref) {
|
|
44
|
+
const inScope = useRootScope('SearchInput');
|
|
45
|
+
const inputRef = useSearchInputRef();
|
|
46
|
+
const mergedRef = useMergedRefs(inputRef, ref);
|
|
47
|
+
const closeToggles = useCloseAllOpenToggles();
|
|
48
|
+
const labels = useLabels();
|
|
49
|
+
const label = useSearchLabelConfig();
|
|
50
|
+
const placeholder = useSearchPlaceHolderConfig();
|
|
51
|
+
const autoFocus = useAutoFocusSearchConfig();
|
|
52
|
+
const resultCount = useVisibleSearchResultCount();
|
|
53
|
+
const { loading, error } = useEmojiDataState();
|
|
54
|
+
const controller = useSearchInputController();
|
|
55
|
+
useRegisterRegion('search', inputRef);
|
|
56
|
+
const {
|
|
57
|
+
as: Input = 'input',
|
|
58
|
+
onChange,
|
|
59
|
+
onFocus,
|
|
60
|
+
onCompositionStart,
|
|
61
|
+
onCompositionEnd,
|
|
62
|
+
...rest
|
|
63
|
+
} = props;
|
|
64
|
+
const nativeProps = filterPrimitiveProps(rest, [
|
|
65
|
+
'role',
|
|
66
|
+
'type',
|
|
67
|
+
'value',
|
|
68
|
+
'defaultValue',
|
|
69
|
+
'aria-controls',
|
|
70
|
+
'children',
|
|
71
|
+
'dangerouslySetInnerHTML',
|
|
72
|
+
]);
|
|
73
|
+
if (!inScope) return null;
|
|
74
|
+
return (
|
|
75
|
+
<>
|
|
76
|
+
<Input
|
|
77
|
+
// eslint-disable-next-line jsx-a11y/no-autofocus
|
|
78
|
+
autoFocus={autoFocus}
|
|
79
|
+
placeholder={placeholder}
|
|
80
|
+
aria-label={label}
|
|
81
|
+
{...nativeProps}
|
|
82
|
+
type="text"
|
|
83
|
+
value={controller.value}
|
|
84
|
+
data-epr-part="search-input"
|
|
85
|
+
ref={mergedRef}
|
|
86
|
+
onChange={composeHandlers(controller.handleChange, onChange)}
|
|
87
|
+
onFocus={composeHandlers(closeToggles, onFocus)}
|
|
88
|
+
onCompositionStart={composeHandlers(
|
|
89
|
+
controller.handleCompositionStart,
|
|
90
|
+
onCompositionStart,
|
|
91
|
+
)}
|
|
92
|
+
onCompositionEnd={composeHandlers(
|
|
93
|
+
controller.handleCompositionEnd,
|
|
94
|
+
onCompositionEnd,
|
|
95
|
+
)}
|
|
96
|
+
/>
|
|
97
|
+
{!loading && !error && resultCount !== null && (
|
|
98
|
+
<span
|
|
99
|
+
className="epr-status-search-results"
|
|
100
|
+
role="status"
|
|
101
|
+
aria-live="polite"
|
|
102
|
+
aria-atomic="true"
|
|
103
|
+
style={hiddenStatus}
|
|
104
|
+
>
|
|
105
|
+
{formatSearchResultsLabel(labels, resultCount)}
|
|
106
|
+
</span>
|
|
107
|
+
)}
|
|
108
|
+
</>
|
|
109
|
+
);
|
|
110
|
+
}) as SearchInputComponent;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { cx } from 'shipstyles';
|
|
3
|
+
|
|
4
|
+
import { stylesheet } from '../Stylesheet/stylesheet';
|
|
5
|
+
import { useSkinTonePickerRef } from '../components/context/ElementRefContext';
|
|
6
|
+
import {
|
|
7
|
+
SkinTonePicker,
|
|
8
|
+
SkinTonePickerDirection,
|
|
9
|
+
} from '../components/header/SkinTonePicker/SkinTonePicker';
|
|
10
|
+
import { useRegisterRegion } from '../hooks/useRegisterRegion';
|
|
11
|
+
|
|
12
|
+
import { filterPrimitiveProps } from './nativeProps';
|
|
13
|
+
import { useRootScope } from './scope';
|
|
14
|
+
import type { SkinToneProps } from './types';
|
|
15
|
+
|
|
16
|
+
// Place the shared skin-tone control anywhere inside Root. Presence and
|
|
17
|
+
// orientation belong to this part; Search and Preview never insert it.
|
|
18
|
+
export const SkinTone = /* @__PURE__ */ React.forwardRef<
|
|
19
|
+
HTMLDivElement,
|
|
20
|
+
SkinToneProps
|
|
21
|
+
>(function SkinTone(props, forwardedRef) {
|
|
22
|
+
const inScope = useRootScope('SkinTone');
|
|
23
|
+
const { orientation = 'horizontal', className, ...rest } = props;
|
|
24
|
+
const nativeProps = filterPrimitiveProps(rest as Record<string, unknown>, [
|
|
25
|
+
'role',
|
|
26
|
+
]);
|
|
27
|
+
const SkinTonePickerRef = useSkinTonePickerRef();
|
|
28
|
+
useRegisterRegion('preview-skin-tone', SkinTonePickerRef);
|
|
29
|
+
|
|
30
|
+
if (!inScope) return null;
|
|
31
|
+
|
|
32
|
+
const vertical = orientation === 'vertical';
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<div
|
|
36
|
+
{...(nativeProps as React.HTMLAttributes<HTMLDivElement>)}
|
|
37
|
+
ref={forwardedRef}
|
|
38
|
+
className={cx(
|
|
39
|
+
vertical ? styles.verticalHost : styles.horizontalHost,
|
|
40
|
+
className,
|
|
41
|
+
)}
|
|
42
|
+
>
|
|
43
|
+
{vertical ? (
|
|
44
|
+
<div className={cx(styles.verticalAnchor)}>
|
|
45
|
+
<SkinTonePicker direction={SkinTonePickerDirection.VERTICAL} />
|
|
46
|
+
</div>
|
|
47
|
+
) : (
|
|
48
|
+
<SkinTonePicker direction={SkinTonePickerDirection.HORIZONTAL} />
|
|
49
|
+
)}
|
|
50
|
+
</div>
|
|
51
|
+
);
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
const ITEM_SIZE = 28;
|
|
55
|
+
|
|
56
|
+
const styles = /* @__PURE__ */ (() =>
|
|
57
|
+
stylesheet.create({
|
|
58
|
+
horizontalHost: {
|
|
59
|
+
'.': 'epr-skin-tone-host',
|
|
60
|
+
display: 'flex',
|
|
61
|
+
justifyContent: 'flex-end',
|
|
62
|
+
alignItems: 'center',
|
|
63
|
+
position: 'relative',
|
|
64
|
+
},
|
|
65
|
+
verticalHost: {
|
|
66
|
+
'.': 'epr-skin-tone-host-vertical',
|
|
67
|
+
position: 'relative',
|
|
68
|
+
height: `${ITEM_SIZE}px`,
|
|
69
|
+
width: `${ITEM_SIZE}px`,
|
|
70
|
+
},
|
|
71
|
+
verticalAnchor: {
|
|
72
|
+
position: 'absolute',
|
|
73
|
+
bottom: '0',
|
|
74
|
+
insetInlineEnd: '0',
|
|
75
|
+
},
|
|
76
|
+
}))();
|