emoji-picker-react 4.15.2 → 4.16.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
- "version": "4.15.2",
2
+ "version": "4.16.1",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
- "homepage": "https://ealush.com/emoji-picker-react",
6
5
  "typings": "dist/index.d.ts",
6
+ "homepage": "https://ealush.com/emoji-picker-react",
7
7
  "files": [
8
8
  "dist",
9
9
  "src"
@@ -46,6 +46,7 @@ export function useSetConfig(config: PickerConfig) {
46
46
  config.reactionsDefaultOpen,
47
47
  config.searchPlaceHolder,
48
48
  config.searchPlaceholder,
49
+ config.searchClearButtonLabel,
49
50
  config.defaultSkinTone,
50
51
  config.skinTonesDisabled,
51
52
  config.autoFocusSearch,
@@ -6,6 +6,7 @@ import {
6
6
  darkMode,
7
7
  stylesheet
8
8
  } from '../../../Stylesheet/stylesheet';
9
+ import { useSearchClearButtonLabelConfig } from '../../../config/useConfig';
9
10
  import { useClearSearch } from '../../../hooks/useFilter';
10
11
  import { Button } from '../../atoms/Button';
11
12
 
@@ -13,6 +14,7 @@ import SVGTimes from './svg/times.svg';
13
14
 
14
15
  export function BtnClearSearch() {
15
16
  const clearSearch = useClearSearch();
17
+ const searchClearButtonLabel = useSearchClearButtonLabelConfig();
16
18
 
17
19
  return (
18
20
  <Button
@@ -21,8 +23,8 @@ export function BtnClearSearch() {
21
23
  commonInteractionStyles.visibleOnSearchOnly
22
24
  )}
23
25
  onClick={clearSearch}
24
- aria-label="Clear"
25
- title="Clear"
26
+ aria-label={searchClearButtonLabel}
27
+ title={searchClearButtonLabel}
26
28
  >
27
29
  <div className={cx(styles.icnClearnSearch)} />
28
30
  </Button>
@@ -10,6 +10,7 @@ export function compareConfig(prev: PickerConfig, next: PickerConfig) {
10
10
  prev.reactionsDefaultOpen === next.reactionsDefaultOpen &&
11
11
  prev.searchPlaceHolder === next.searchPlaceHolder &&
12
12
  prev.searchPlaceholder === next.searchPlaceholder &&
13
+ prev.searchClearButtonLabel === next.searchClearButtonLabel &&
13
14
  prev.defaultSkinTone === next.defaultSkinTone &&
14
15
  prev.skinTonesDisabled === next.skinTonesDisabled &&
15
16
  prev.autoFocusSearch === next.autoFocusSearch &&
@@ -25,6 +25,7 @@ import { CustomEmoji } from './customEmojiConfig';
25
25
  const KNOWN_FAILING_EMOJIS = ['2640-fe0f', '2642-fe0f', '2695-fe0f'];
26
26
 
27
27
  export const DEFAULT_SEARCH_PLACEHOLDER = 'Search';
28
+ export const DEFAULT_SEARCH_CLEAR_BUTTON_LABEL = 'Clear';
28
29
  export const SEARCH_RESULTS_NO_RESULTS_FOUND = 'No results found';
29
30
  export const SEARCH_RESULTS_SUFFIX =
30
31
  ' found. Use up and down arrow keys to navigate.';
@@ -84,6 +85,7 @@ export function basePickerConfig(): PickerConfigInternal {
84
85
  searchDisabled: false,
85
86
  searchPlaceHolder: DEFAULT_SEARCH_PLACEHOLDER,
86
87
  searchPlaceholder: DEFAULT_SEARCH_PLACEHOLDER,
88
+ searchClearButtonLabel: DEFAULT_SEARCH_CLEAR_BUTTON_LABEL,
87
89
  skinTonePickerLocation: SkinTonePickerLocation.SEARCH,
88
90
  skinTonesDisabled: false,
89
91
  style: {},
@@ -103,6 +105,7 @@ export type PickerConfigInternal = {
103
105
  emojiVersion: string | null;
104
106
  searchPlaceHolder: string;
105
107
  searchPlaceholder: string;
108
+ searchClearButtonLabel: string;
106
109
  defaultSkinTone: SkinTones;
107
110
  skinTonesDisabled: boolean;
108
111
  autoFocusSearch: boolean;
@@ -14,6 +14,7 @@ import {
14
14
  import { CategoriesConfig } from './categoryConfig';
15
15
  import {
16
16
  DEFAULT_SEARCH_PLACEHOLDER,
17
+ DEFAULT_SEARCH_CLEAR_BUTTON_LABEL,
17
18
  SEARCH_RESULTS_NO_RESULTS_FOUND,
18
19
  SEARCH_RESULTS_ONE_RESULT_FOUND,
19
20
  SEARCH_RESULTS_MULTIPLE_RESULTS_FOUND,
@@ -37,6 +38,11 @@ export function useSearchPlaceHolderConfig(): string {
37
38
  );
38
39
  }
39
40
 
41
+ export function useSearchClearButtonLabelConfig(): string {
42
+ const { searchClearButtonLabel } = usePickerConfig();
43
+ return searchClearButtonLabel ?? DEFAULT_SEARCH_CLEAR_BUTTON_LABEL;
44
+ }
45
+
40
46
  export function useDefaultSkinToneConfig(): SkinTones {
41
47
  const { defaultSkinTone } = usePickerConfig();
42
48
  return defaultSkinTone;