emoji-picker-react 4.22.3 → 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 +331 -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 -480
- package/package.json +180 -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,51 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useFilterRef,
|
|
3
|
+
useSearchTermState,
|
|
4
|
+
} from '../components/context/PickerContext';
|
|
5
|
+
import { useGetEmojisByCategory } from '../components/context/PickerDataContext';
|
|
6
|
+
import {
|
|
7
|
+
categoryFromCategoryConfig,
|
|
8
|
+
customGroupFromCategoryConfig,
|
|
9
|
+
} from '../config/categoryConfig';
|
|
10
|
+
import { useCategoriesConfig } from '../config/useConfig';
|
|
11
|
+
import {
|
|
12
|
+
emojiUnified,
|
|
13
|
+
unifiedWithoutSkinTone,
|
|
14
|
+
} from '../dataUtils/emojiUtils';
|
|
15
|
+
|
|
16
|
+
import { useIsEmojiDisallowed } from './useDisallowedEmojis';
|
|
17
|
+
import { useIsEmojiHidden } from './useIsEmojiHidden';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Number of distinct emojis the list actually shows for the active search,
|
|
21
|
+
* or null while no search is applied (or its results are not computed
|
|
22
|
+
* yet). Uses the same predicates as the list itself, so configured
|
|
23
|
+
* categories, emojiVersion, hiddenEmojis, platform support and failed
|
|
24
|
+
* images are all accounted for — the raw match dictionary is not.
|
|
25
|
+
*/
|
|
26
|
+
export function useVisibleSearchResultCount(): number | null {
|
|
27
|
+
const [searchTerm] = useSearchTermState();
|
|
28
|
+
const filterRef = useFilterRef();
|
|
29
|
+
const categories = useCategoriesConfig();
|
|
30
|
+
const getEmojisByCategory = useGetEmojisByCategory();
|
|
31
|
+
const isEmojiDisallowed = useIsEmojiDisallowed();
|
|
32
|
+
const isEmojiHidden = useIsEmojiHidden();
|
|
33
|
+
|
|
34
|
+
if (!searchTerm || !filterRef.current[searchTerm]) {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const visible = new Set<string>();
|
|
39
|
+
for (const categoryConfig of categories) {
|
|
40
|
+
const emojis = getEmojisByCategory(
|
|
41
|
+
categoryFromCategoryConfig(categoryConfig),
|
|
42
|
+
customGroupFromCategoryConfig(categoryConfig),
|
|
43
|
+
);
|
|
44
|
+
for (const emoji of emojis) {
|
|
45
|
+
if (!isEmojiDisallowed(emoji) && !isEmojiHidden(emoji).hidden) {
|
|
46
|
+
visible.add(unifiedWithoutSkinTone(emojiUnified(emoji)));
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return visible.size;
|
|
51
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
allUnifiedFromEmojiElement,
|
|
3
|
+
buttonFromTarget,
|
|
3
4
|
NullableElement,
|
|
4
5
|
} from '../DomUtils/selectors';
|
|
5
6
|
import { useSetAnchoredEmojiRef } from '../components/context/ElementRefContext';
|
|
@@ -25,7 +26,9 @@ export default function useSetVariationPicker() {
|
|
|
25
26
|
const emoji = emojiByUnified(resolvedUnified);
|
|
26
27
|
|
|
27
28
|
if (emoji) {
|
|
28
|
-
|
|
29
|
+
// Anchor to the emoji button, not the event target: the target may
|
|
30
|
+
// be a nested child (an image, or custom cell markup).
|
|
31
|
+
setAnchoredEmojiRef(buttonFromTarget(element) ?? element);
|
|
29
32
|
setEmojiVariationPicker(emoji);
|
|
30
33
|
}
|
|
31
34
|
};
|
package/src/index.tsx
CHANGED
|
@@ -1,12 +1,19 @@
|
|
|
1
|
+
// The batteries-included entry promises synchronous access to the English
|
|
2
|
+
// dataset. The primitives entry intentionally leaves this unregistered so
|
|
3
|
+
// compositions can load it on demand.
|
|
4
|
+
import './data/registerDefaultEmojiData';
|
|
5
|
+
|
|
1
6
|
import * as React from 'react';
|
|
2
7
|
|
|
3
8
|
import EmojiPickerReact from './EmojiPickerReact';
|
|
4
9
|
import ErrorBoundary from './components/ErrorBoundary';
|
|
5
10
|
import { PickerConfig } from './config/config';
|
|
6
11
|
import {
|
|
7
|
-
|
|
12
|
+
MutableConfigProvider,
|
|
8
13
|
useDefineMutableConfig,
|
|
9
14
|
} from './config/mutableConfig';
|
|
15
|
+
import type { PickerComponents } from './primitives/components';
|
|
16
|
+
import type { ThemeValue } from './types/exposedTypes';
|
|
10
17
|
|
|
11
18
|
export { ExportedEmoji as Emoji } from './components/emoji/ExportedEmoji';
|
|
12
19
|
|
|
@@ -15,16 +22,63 @@ export {
|
|
|
15
22
|
SkinTones,
|
|
16
23
|
Theme,
|
|
17
24
|
Categories,
|
|
18
|
-
EmojiClickData,
|
|
19
25
|
SuggestionMode,
|
|
20
26
|
SkinTonePickerLocation,
|
|
27
|
+
} from './types/exposedTypes';
|
|
28
|
+
export type {
|
|
29
|
+
EmojiStyleValue,
|
|
30
|
+
ThemeValue,
|
|
31
|
+
SkinTonesValue,
|
|
32
|
+
EmojiClickData,
|
|
33
|
+
SuggestionModeValue,
|
|
21
34
|
CategoryIcons,
|
|
22
35
|
CategoryConfig,
|
|
36
|
+
EmojiData,
|
|
23
37
|
} from './types/exposedTypes';
|
|
38
|
+
export type {
|
|
39
|
+
PickerLabels,
|
|
40
|
+
PreviewConfig,
|
|
41
|
+
EmojiClickHandler,
|
|
42
|
+
SkinToneChangeHandler,
|
|
43
|
+
OnEmojiClickApi,
|
|
44
|
+
} from './config/config';
|
|
45
|
+
export type { CustomEmoji } from './config/customEmojiConfig';
|
|
46
|
+
export type {
|
|
47
|
+
EmojiDataInput,
|
|
48
|
+
EmojiDataLoader,
|
|
49
|
+
EmojiDataLoaderOptions,
|
|
50
|
+
} from './hooks/useResolvedEmojiData';
|
|
51
|
+
export type {
|
|
52
|
+
CategoryHeaderRenderProps,
|
|
53
|
+
EmojiRenderProps,
|
|
54
|
+
ListComponents,
|
|
55
|
+
ListEmoji,
|
|
56
|
+
} from './components/body/listComponents';
|
|
24
57
|
|
|
25
58
|
export { emojiByUnified } from './dataUtils/emojiSelectors';
|
|
26
59
|
|
|
27
|
-
|
|
60
|
+
// The default picker forwards identifying attributes, but leaves event handlers
|
|
61
|
+
// and library-owned roles to the primitives or a consumer wrapper.
|
|
62
|
+
export interface PickerProps
|
|
63
|
+
extends
|
|
64
|
+
PickerConfig,
|
|
65
|
+
React.AriaAttributes,
|
|
66
|
+
Pick<React.HTMLAttributes<HTMLElement>, 'id' | 'title' | 'lang' | 'dir'> {
|
|
67
|
+
/**
|
|
68
|
+
* Color scheme: 'light' | 'dark' | 'auto'. Preferred over `theme`, which
|
|
69
|
+
* Emotion, styled-components and MUI reserve on components they wrap
|
|
70
|
+
* (a styled(EmojiPicker) would swallow it). `theme` remains supported.
|
|
71
|
+
*/
|
|
72
|
+
colorScheme?: ThemeValue;
|
|
73
|
+
/**
|
|
74
|
+
* Render without decorative styling on every managed part.
|
|
75
|
+
* Geometry, presence and navigation remain managed. Style it with `className`,
|
|
76
|
+
* `--epr-*` variables and `[data-epr-part]` selectors.
|
|
77
|
+
*/
|
|
78
|
+
unstyled?: boolean;
|
|
79
|
+
/** Shared replacements for interactive controls and category headers. */
|
|
80
|
+
components?: PickerComponents;
|
|
81
|
+
}
|
|
28
82
|
export type Props = PickerProps;
|
|
29
83
|
|
|
30
84
|
export default function EmojiPicker(props: PickerProps) {
|
|
@@ -32,13 +86,21 @@ export default function EmojiPicker(props: PickerProps) {
|
|
|
32
86
|
onEmojiClick: props.onEmojiClick,
|
|
33
87
|
onReactionClick: props.onReactionClick,
|
|
34
88
|
onSkinToneChange: props.onSkinToneChange,
|
|
89
|
+
onSearchChange: props.onSearchChange,
|
|
90
|
+
onReactionsModeChange: props.onReactionsModeChange,
|
|
35
91
|
});
|
|
36
92
|
|
|
37
93
|
return (
|
|
38
94
|
<ErrorBoundary>
|
|
39
|
-
<
|
|
95
|
+
<MutableConfigProvider value={MutableConfigRef} inheritToRoot>
|
|
40
96
|
<EmojiPickerReact {...props} />
|
|
41
|
-
</
|
|
97
|
+
</MutableConfigProvider>
|
|
42
98
|
</ErrorBoundary>
|
|
43
99
|
);
|
|
44
100
|
}
|
|
101
|
+
|
|
102
|
+
export type {
|
|
103
|
+
PickerComponents,
|
|
104
|
+
CategoryButtonRenderProps,
|
|
105
|
+
SkinToneButtonRenderProps,
|
|
106
|
+
} from './primitives/components';
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
CategoryNavigation,
|
|
5
|
+
useVisibleCategoryConfigs,
|
|
6
|
+
} from '../components/navigation/CategoryNavigation';
|
|
7
|
+
|
|
8
|
+
import { filterPrimitiveProps } from './nativeProps';
|
|
9
|
+
import { useRootScope } from './scope';
|
|
10
|
+
import type { CategoryNavProps } from './types';
|
|
11
|
+
|
|
12
|
+
// Public CategoryNav primitive.
|
|
13
|
+
//
|
|
14
|
+
// Managed tablist region. Renders nothing when fewer than two tabs would
|
|
15
|
+
// be visible (mirroring the internal single-tab rule).
|
|
16
|
+
export const CategoryNav = /* @__PURE__ */ React.forwardRef<
|
|
17
|
+
HTMLDivElement,
|
|
18
|
+
CategoryNavProps
|
|
19
|
+
>(function CategoryNav(props, forwardedRef) {
|
|
20
|
+
const inScope = useRootScope('CategoryNav');
|
|
21
|
+
const visibleCategories = useVisibleCategoryConfigs();
|
|
22
|
+
const { orientation = 'horizontal', ...rest } = props;
|
|
23
|
+
const nativeProps = filterPrimitiveProps(rest as Record<string, unknown>, [
|
|
24
|
+
'role',
|
|
25
|
+
]);
|
|
26
|
+
|
|
27
|
+
if (!inScope || visibleCategories.length <= 1) {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<div
|
|
33
|
+
{...(nativeProps as React.HTMLAttributes<HTMLDivElement>)}
|
|
34
|
+
ref={forwardedRef}
|
|
35
|
+
data-epr-part="category-nav"
|
|
36
|
+
>
|
|
37
|
+
<CategoryNavigation orientation={orientation} />
|
|
38
|
+
</div>
|
|
39
|
+
);
|
|
40
|
+
});
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { cx } from 'shipstyles';
|
|
3
|
+
|
|
4
|
+
import { stylesheet } from '../Stylesheet/stylesheet';
|
|
5
|
+
import { useLabels } from '../config/useConfig';
|
|
6
|
+
import { useEmojiDataState } from '../hooks/useResolvedEmojiData';
|
|
7
|
+
import { useAcceptedSearchValue } from '../hooks/useSearchController';
|
|
8
|
+
import { useVisibleSearchResultCount } from '../hooks/useSearchResults';
|
|
9
|
+
|
|
10
|
+
import { useDefaultAppearance } from './appearance';
|
|
11
|
+
import { filterPrimitiveProps } from './nativeProps';
|
|
12
|
+
import { useRootScope } from './scope';
|
|
13
|
+
import type { EmptyProps } from './types';
|
|
14
|
+
|
|
15
|
+
// Public Empty primitive: renders only while an applied search shows no
|
|
16
|
+
// emojis. Children may be content or a render function receiving the
|
|
17
|
+
// search text; without children it shows `labels.searchResultsNone`.
|
|
18
|
+
// It is purely visual — the Search live region already announces the
|
|
19
|
+
// result count, so Empty carries no live-region role of its own.
|
|
20
|
+
export const Empty = /* @__PURE__ */ React.forwardRef<
|
|
21
|
+
HTMLDivElement,
|
|
22
|
+
EmptyProps
|
|
23
|
+
>(function Empty(props, forwardedRef) {
|
|
24
|
+
const appearance = useDefaultAppearance();
|
|
25
|
+
const inScope = useRootScope('Empty');
|
|
26
|
+
const { children, className, ...rest } = props;
|
|
27
|
+
const nativeProps = filterPrimitiveProps(rest as Record<string, unknown>, [
|
|
28
|
+
'role',
|
|
29
|
+
]);
|
|
30
|
+
const resultCount = useVisibleSearchResultCount();
|
|
31
|
+
const search = useAcceptedSearchValue();
|
|
32
|
+
const labels = useLabels();
|
|
33
|
+
const { loading, error } = useEmojiDataState();
|
|
34
|
+
|
|
35
|
+
if (!inScope || loading || error || resultCount !== 0) {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<div
|
|
41
|
+
{...(nativeProps as React.HTMLAttributes<HTMLDivElement>)}
|
|
42
|
+
ref={forwardedRef}
|
|
43
|
+
data-epr-part="empty"
|
|
44
|
+
className={cx(styles.geometry, appearance && styles.empty, className)}
|
|
45
|
+
>
|
|
46
|
+
{typeof children === 'function'
|
|
47
|
+
? children({ search })
|
|
48
|
+
: (children ?? labels.searchResultsNone)}
|
|
49
|
+
</div>
|
|
50
|
+
);
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
const styles = /* @__PURE__ */ (() =>
|
|
54
|
+
stylesheet.create({
|
|
55
|
+
geometry: {
|
|
56
|
+
display: 'flex',
|
|
57
|
+
alignItems: 'center',
|
|
58
|
+
justifyContent: 'center',
|
|
59
|
+
padding: 'var(--epr-horizontal-padding)',
|
|
60
|
+
minHeight: 'var(--epr-emoji-fullsize)',
|
|
61
|
+
},
|
|
62
|
+
empty: {
|
|
63
|
+
'.': 'epr-empty',
|
|
64
|
+
color: 'var(--epr-text-color)',
|
|
65
|
+
fontSize: 'var(--epr-preview-text-size)',
|
|
66
|
+
textAlign: 'center',
|
|
67
|
+
},
|
|
68
|
+
}))();
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { cx } from 'shipstyles';
|
|
3
|
+
|
|
4
|
+
import { EmojiList } from '../components/body/EmojiList';
|
|
5
|
+
import { ListComponentsContext } from '../components/body/listComponents';
|
|
6
|
+
import { useEmojiListRef } from '../components/context/ElementRefContext';
|
|
7
|
+
|
|
8
|
+
import { usePickerComponents } from './components';
|
|
9
|
+
import { filterPrimitiveProps, useMergedRefs } from './nativeProps';
|
|
10
|
+
import { useRootScope, useViewportScope, useViewportScrollTop } from './scope';
|
|
11
|
+
import type { ListProps } from './types';
|
|
12
|
+
|
|
13
|
+
// Public List primitive.
|
|
14
|
+
//
|
|
15
|
+
// Managed grid region: owns category rows/groups, managed emoji buttons
|
|
16
|
+
// and virtualization. Accepts no consumer children; when rendered it must
|
|
17
|
+
// be the single List child of Viewport. `components` swaps the markup of
|
|
18
|
+
// emoji cells and category headers while the library keeps owning their
|
|
19
|
+
// behavior (consumers spread the provided props).
|
|
20
|
+
export const List = /* @__PURE__ */ React.forwardRef<
|
|
21
|
+
HTMLUListElement,
|
|
22
|
+
ListProps
|
|
23
|
+
>(function List(props, forwardedRef) {
|
|
24
|
+
const inRoot = useRootScope('List');
|
|
25
|
+
const { components, ...rest } = props;
|
|
26
|
+
const inheritedComponents = usePickerComponents();
|
|
27
|
+
const resolvedComponents = React.useMemo(
|
|
28
|
+
() => ({ ...inheritedComponents, ...components }),
|
|
29
|
+
[inheritedComponents, components],
|
|
30
|
+
);
|
|
31
|
+
const inViewport = useViewportScope('List');
|
|
32
|
+
const nativeProps = filterPrimitiveProps(rest as Record<string, unknown>, [
|
|
33
|
+
'role',
|
|
34
|
+
]);
|
|
35
|
+
const { className, ...restNative } = nativeProps as Omit<
|
|
36
|
+
React.HTMLAttributes<HTMLUListElement>,
|
|
37
|
+
'role' | 'children'
|
|
38
|
+
>;
|
|
39
|
+
|
|
40
|
+
const EmojiListRef = useEmojiListRef();
|
|
41
|
+
const mergedRef = useMergedRefs(EmojiListRef, forwardedRef);
|
|
42
|
+
const scrollTop = useViewportScrollTop();
|
|
43
|
+
|
|
44
|
+
if (!inRoot || !inViewport) {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const list = (
|
|
49
|
+
<EmojiList
|
|
50
|
+
scrollTop={scrollTop}
|
|
51
|
+
outerRef={mergedRef}
|
|
52
|
+
className={cx(className)}
|
|
53
|
+
nativeProps={restNative}
|
|
54
|
+
/>
|
|
55
|
+
);
|
|
56
|
+
return (
|
|
57
|
+
<ListComponentsContext.Provider value={resolvedComponents}>
|
|
58
|
+
{list}
|
|
59
|
+
</ListComponentsContext.Provider>
|
|
60
|
+
);
|
|
61
|
+
});
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
import { useLabels } from '../config/useConfig';
|
|
4
|
+
import { useEmojiDataState } from '../hooks/useResolvedEmojiData';
|
|
5
|
+
|
|
6
|
+
import { filterPrimitiveProps } from './nativeProps';
|
|
7
|
+
import { useRootScope } from './scope';
|
|
8
|
+
import type { LoadErrorProps } from './types';
|
|
9
|
+
|
|
10
|
+
/** Recoverable dataset failure; custom children receive error and retry. */
|
|
11
|
+
export const LoadError = /* @__PURE__ */ React.forwardRef<
|
|
12
|
+
HTMLDivElement,
|
|
13
|
+
LoadErrorProps
|
|
14
|
+
>(function LoadError({ children, ...props }, ref) {
|
|
15
|
+
const inScope = useRootScope('LoadError');
|
|
16
|
+
const { error, retry } = useEmojiDataState();
|
|
17
|
+
const labels = useLabels();
|
|
18
|
+
if (!inScope || !error) return null;
|
|
19
|
+
return (
|
|
20
|
+
<div
|
|
21
|
+
{...filterPrimitiveProps(props, ['role'])}
|
|
22
|
+
ref={ref}
|
|
23
|
+
role="alert"
|
|
24
|
+
data-epr-part="load-error"
|
|
25
|
+
>
|
|
26
|
+
{typeof children === 'function'
|
|
27
|
+
? children({ error, retry })
|
|
28
|
+
: (children ?? (
|
|
29
|
+
<>
|
|
30
|
+
<p>{labels.loadingError}</p>
|
|
31
|
+
<button type="button" onClick={retry}>
|
|
32
|
+
{labels.retryLoading}
|
|
33
|
+
</button>
|
|
34
|
+
</>
|
|
35
|
+
))}
|
|
36
|
+
</div>
|
|
37
|
+
);
|
|
38
|
+
});
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { cx } from 'shipstyles';
|
|
3
|
+
|
|
4
|
+
import { stylesheet } from '../Stylesheet/stylesheet';
|
|
5
|
+
import { useLabels } from '../config/useConfig';
|
|
6
|
+
import { useIsEmojiDataLoading } from '../hooks/useResolvedEmojiData';
|
|
7
|
+
|
|
8
|
+
import { useDefaultAppearance } from './appearance';
|
|
9
|
+
import { filterPrimitiveProps } from './nativeProps';
|
|
10
|
+
import { useRootScope } from './scope';
|
|
11
|
+
import type { LoadingProps } from './types';
|
|
12
|
+
|
|
13
|
+
// Public Loading primitive: renders only while Root's emoji dataset is
|
|
14
|
+
// loading (an `emojiData` loader, or the lazily loaded default dataset in
|
|
15
|
+
// a primitives-only bundle). Without children it shows `labels.loading`.
|
|
16
|
+
export const Loading = /* @__PURE__ */ React.forwardRef<
|
|
17
|
+
HTMLDivElement,
|
|
18
|
+
LoadingProps
|
|
19
|
+
>(function Loading(props, forwardedRef) {
|
|
20
|
+
const appearance = useDefaultAppearance();
|
|
21
|
+
const inScope = useRootScope('Loading');
|
|
22
|
+
const { children, className, ...rest } = props;
|
|
23
|
+
const nativeProps = filterPrimitiveProps(rest as Record<string, unknown>, [
|
|
24
|
+
'role',
|
|
25
|
+
]);
|
|
26
|
+
const loading = useIsEmojiDataLoading();
|
|
27
|
+
const labels = useLabels();
|
|
28
|
+
|
|
29
|
+
if (!inScope || !loading) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<div
|
|
35
|
+
{...(nativeProps as React.HTMLAttributes<HTMLDivElement>)}
|
|
36
|
+
ref={forwardedRef}
|
|
37
|
+
role="status"
|
|
38
|
+
data-epr-part="loading"
|
|
39
|
+
className={cx(styles.geometry, appearance && styles.loading, className)}
|
|
40
|
+
>
|
|
41
|
+
{children ?? labels.loading}
|
|
42
|
+
</div>
|
|
43
|
+
);
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
const styles = /* @__PURE__ */ (() =>
|
|
47
|
+
stylesheet.create({
|
|
48
|
+
geometry: {
|
|
49
|
+
display: 'flex',
|
|
50
|
+
alignItems: 'center',
|
|
51
|
+
justifyContent: 'center',
|
|
52
|
+
padding: 'var(--epr-horizontal-padding)',
|
|
53
|
+
minHeight: 'var(--epr-emoji-fullsize)',
|
|
54
|
+
},
|
|
55
|
+
loading: {
|
|
56
|
+
'.': 'epr-loading',
|
|
57
|
+
color: 'var(--epr-text-color)',
|
|
58
|
+
fontSize: 'var(--epr-preview-text-size)',
|
|
59
|
+
},
|
|
60
|
+
}))();
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { cx } from 'shipstyles';
|
|
3
|
+
|
|
4
|
+
import { useReactionsModeState } from '../components/context/PickerContext';
|
|
5
|
+
import { useSingletonClaim } from '../hooks/useRegisterRegion';
|
|
6
|
+
|
|
7
|
+
import { filterPrimitiveProps, useMergedRefs } from './nativeProps';
|
|
8
|
+
import { useRootScope } from './scope';
|
|
9
|
+
import { structuralStyles } from './structuralStyles';
|
|
10
|
+
|
|
11
|
+
export type PanelProps = Omit<
|
|
12
|
+
React.HTMLAttributes<HTMLDivElement>,
|
|
13
|
+
'role' | 'hidden' | 'inert' | 'dangerouslySetInnerHTML'
|
|
14
|
+
>;
|
|
15
|
+
|
|
16
|
+
/** One full-picker panel; Root owns hidden/inert presence in reactions mode. */
|
|
17
|
+
const PanelImpl = /* @__PURE__ */ React.forwardRef<HTMLDivElement, PanelProps>(
|
|
18
|
+
function Panel(allProps: PanelProps, ref) {
|
|
19
|
+
const { children, className, style, ...props } = allProps;
|
|
20
|
+
const inScope = useRootScope('Panel');
|
|
21
|
+
useSingletonClaim('panel');
|
|
22
|
+
const [hidden] = useReactionsModeState();
|
|
23
|
+
const setInert = React.useCallback(
|
|
24
|
+
(node: HTMLDivElement | null) => {
|
|
25
|
+
if (!node) return;
|
|
26
|
+
if (hidden) node.setAttribute('inert', '');
|
|
27
|
+
else node.removeAttribute('inert');
|
|
28
|
+
},
|
|
29
|
+
[hidden],
|
|
30
|
+
);
|
|
31
|
+
const mergedRef = useMergedRefs(ref, setInert);
|
|
32
|
+
if (!inScope) return null;
|
|
33
|
+
return (
|
|
34
|
+
<div
|
|
35
|
+
{...filterPrimitiveProps(props, ['role', 'hidden', 'inert'])}
|
|
36
|
+
ref={mergedRef}
|
|
37
|
+
data-epr-part="panel"
|
|
38
|
+
hidden={hidden}
|
|
39
|
+
className={cx(structuralStyles.panel, className)}
|
|
40
|
+
style={{ ...style, ...(hidden && { display: 'none' }) }}
|
|
41
|
+
>
|
|
42
|
+
{children}
|
|
43
|
+
</div>
|
|
44
|
+
);
|
|
45
|
+
},
|
|
46
|
+
);
|
|
47
|
+
export const Panel = /* @__PURE__ */ React.memo(PanelImpl);
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
import { Preview as PreviewView } from '../components/footer/Preview';
|
|
4
|
+
import { useSingletonClaim } from '../hooks/useRegisterRegion';
|
|
5
|
+
|
|
6
|
+
import { filterPrimitiveProps } from './nativeProps';
|
|
7
|
+
import { useRootScope } from './scope';
|
|
8
|
+
import type { PreviewProps } from './types';
|
|
9
|
+
|
|
10
|
+
// Public Preview primitive.
|
|
11
|
+
//
|
|
12
|
+
// Managed preview region. Additional controls are supplied as children;
|
|
13
|
+
// omit Preview itself to omit the preview region.
|
|
14
|
+
export const Preview = /* @__PURE__ */ React.forwardRef<
|
|
15
|
+
HTMLDivElement,
|
|
16
|
+
PreviewProps
|
|
17
|
+
>(function Preview(props, forwardedRef) {
|
|
18
|
+
const inScope = useRootScope('Preview');
|
|
19
|
+
useSingletonClaim('preview');
|
|
20
|
+
const { children, ...rest } = props;
|
|
21
|
+
const nativeProps = filterPrimitiveProps(rest as Record<string, unknown>, [
|
|
22
|
+
'role',
|
|
23
|
+
]);
|
|
24
|
+
|
|
25
|
+
if (!inScope) {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<div
|
|
31
|
+
{...(nativeProps as React.HTMLAttributes<HTMLDivElement>)}
|
|
32
|
+
ref={forwardedRef}
|
|
33
|
+
data-epr-part="preview"
|
|
34
|
+
>
|
|
35
|
+
<PreviewView>{children}</PreviewView>
|
|
36
|
+
</div>
|
|
37
|
+
);
|
|
38
|
+
});
|