@devoxin/emoji-picker 1.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/LICENSE +21 -0
- package/README.md +74 -0
- package/dist/chunk-Cke89iAU.mjs +1 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +620 -0
- package/dist/index.d.mts +618 -0
- package/dist/index.mjs +2 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +70 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,620 @@
|
|
|
1
|
+
import * as react3 from "react";
|
|
2
|
+
import { ComponentProps, ComponentType, ReactNode } from "react";
|
|
3
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
|
+
|
|
5
|
+
//#region rolldown:runtime
|
|
6
|
+
//#endregion
|
|
7
|
+
//#region ../../node_modules/.bun/emojibase@16.0.0/node_modules/emojibase/lib/types.d.ts
|
|
8
|
+
type SkinToneKey = 'dark' | 'light' | 'medium-dark' | 'medium-light' | 'medium';
|
|
9
|
+
type Locale$1 = 'bn' | 'da' | 'de' | 'en-gb' | 'en' | 'es-mx' | 'es' | 'et' | 'fi' | 'fr' | 'hi' | 'hu' | 'it' | 'ja' | 'ko' | 'lt' | 'ms' | 'nb' | 'nl' | 'pl' | 'pt' | 'ru' | 'sv' | 'th' | 'uk' | 'vi' | 'zh-hant' | 'zh';
|
|
10
|
+
//#endregion
|
|
11
|
+
//#region src/types.d.ts
|
|
12
|
+
type Resolve<T> = T extends ((...args: unknown[]) => unknown) ? T : { [K in keyof T]: T[K] };
|
|
13
|
+
type Locale = Resolve<Locale$1>;
|
|
14
|
+
type SkinTone = Resolve<"none" | SkinToneKey>;
|
|
15
|
+
type SkinToneVariation = {
|
|
16
|
+
skinTone: SkinTone;
|
|
17
|
+
emoji: string;
|
|
18
|
+
};
|
|
19
|
+
type Emoji = Resolve<EmojiPickerEmoji>;
|
|
20
|
+
type Category = Resolve<EmojiPickerCategory>;
|
|
21
|
+
type CustomCategory = {
|
|
22
|
+
/**
|
|
23
|
+
* The unique identifier of the category (used to associate emojis with categories).
|
|
24
|
+
*/
|
|
25
|
+
id?: number;
|
|
26
|
+
/**
|
|
27
|
+
* The index of the category (determines display order).
|
|
28
|
+
*/
|
|
29
|
+
index: number;
|
|
30
|
+
/**
|
|
31
|
+
* The name/label of the category.
|
|
32
|
+
*/
|
|
33
|
+
label: string;
|
|
34
|
+
/**
|
|
35
|
+
* The icon for the category (emoji character or URL).
|
|
36
|
+
*/
|
|
37
|
+
icon?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Whether the icon is a custom image (URL) rather than an emoji character.
|
|
40
|
+
*/
|
|
41
|
+
isCustomIcon?: boolean;
|
|
42
|
+
};
|
|
43
|
+
type EmojiPickerEmoji = {
|
|
44
|
+
emoji: string;
|
|
45
|
+
label: string;
|
|
46
|
+
isCustom?: boolean;
|
|
47
|
+
tags?: string[];
|
|
48
|
+
category?: number;
|
|
49
|
+
};
|
|
50
|
+
type EmojiPickerCategory = {
|
|
51
|
+
label: string;
|
|
52
|
+
icon?: string;
|
|
53
|
+
isCustomIcon?: boolean;
|
|
54
|
+
};
|
|
55
|
+
type EmojiPickerListComponents = {
|
|
56
|
+
/**
|
|
57
|
+
* The component used to render a sticky category header in the list.
|
|
58
|
+
*
|
|
59
|
+
* @details
|
|
60
|
+
* All category headers should be of the same size.
|
|
61
|
+
*/
|
|
62
|
+
CategoryHeader: ComponentType<EmojiPickerListCategoryHeaderProps>;
|
|
63
|
+
/**
|
|
64
|
+
* The component used to render a row of emojis in the list.
|
|
65
|
+
*
|
|
66
|
+
* @details
|
|
67
|
+
* All rows should be of the same size.
|
|
68
|
+
*/
|
|
69
|
+
Row: ComponentType<EmojiPickerListRowProps>;
|
|
70
|
+
/**
|
|
71
|
+
* The component used to render an emoji button in the list.
|
|
72
|
+
*
|
|
73
|
+
* @details
|
|
74
|
+
* All emojis should be of the same size.
|
|
75
|
+
*/
|
|
76
|
+
Emoji: ComponentType<EmojiPickerListEmojiProps>;
|
|
77
|
+
};
|
|
78
|
+
type EmojiPickerListRowProps = ComponentProps<"div">;
|
|
79
|
+
interface EmojiPickerListCategoryHeaderProps extends Omit<ComponentProps<"div">, "children"> {
|
|
80
|
+
/**
|
|
81
|
+
* The category for this sticky header.
|
|
82
|
+
*/
|
|
83
|
+
category: Category;
|
|
84
|
+
}
|
|
85
|
+
interface EmojiPickerListEmojiProps extends Omit<ComponentProps<"button">, "children"> {
|
|
86
|
+
/**
|
|
87
|
+
* The emoji for this button, its label, and whether the emoji is currently
|
|
88
|
+
* active (either hovered or selected via keyboard navigation).
|
|
89
|
+
*/
|
|
90
|
+
emoji: Resolve<Emoji & {
|
|
91
|
+
isActive: boolean;
|
|
92
|
+
}>;
|
|
93
|
+
}
|
|
94
|
+
interface EmojiPickerListProps extends ComponentProps<"div"> {
|
|
95
|
+
/**
|
|
96
|
+
* The inner components of the list.
|
|
97
|
+
*/
|
|
98
|
+
components?: Partial<EmojiPickerListComponents>;
|
|
99
|
+
}
|
|
100
|
+
interface EmojiPickerRootProps extends ComponentProps<"div"> {
|
|
101
|
+
/**
|
|
102
|
+
* A callback invoked when an emoji is selected.
|
|
103
|
+
*/
|
|
104
|
+
onEmojiSelect?: (emoji: Emoji) => void;
|
|
105
|
+
/**
|
|
106
|
+
* The locale of the emoji picker.
|
|
107
|
+
*
|
|
108
|
+
* @default "en"
|
|
109
|
+
*/
|
|
110
|
+
locale?: Locale;
|
|
111
|
+
/**
|
|
112
|
+
* The skin tone of the emoji picker.
|
|
113
|
+
*
|
|
114
|
+
* @default "none"
|
|
115
|
+
*/
|
|
116
|
+
skinTone?: SkinTone;
|
|
117
|
+
/**
|
|
118
|
+
* The number of columns in the list.
|
|
119
|
+
*
|
|
120
|
+
* @default 10
|
|
121
|
+
*/
|
|
122
|
+
columns?: number;
|
|
123
|
+
/**
|
|
124
|
+
* Which {@link https://emojipedia.org/emoji-versions | Emoji version} to use,
|
|
125
|
+
* to manually control which emojis are visible regardless of the current
|
|
126
|
+
* browser's supported Emoji versions.
|
|
127
|
+
*
|
|
128
|
+
* @default The most recent version supported by the current browser
|
|
129
|
+
*/
|
|
130
|
+
emojiVersion?: number;
|
|
131
|
+
/**
|
|
132
|
+
* The base URL of where the {@link https://emojibase.dev/docs/datasets/ | Emojibase data}
|
|
133
|
+
* should be fetched from, used as follows: `${emojibaseUrl}/${locale}/${file}.json`.
|
|
134
|
+
* (e.g. `${emojibaseUrl}/en/data.json`).
|
|
135
|
+
*
|
|
136
|
+
* The URL can be set to another CDN hosting the {@link https://www.npmjs.com/package/emojibase-data | `emojibase-data`}
|
|
137
|
+
* package and its raw JSON files, or to a self-hosted location. When self-hosting
|
|
138
|
+
* with a single locale (e.g. `en`), only that locale's directory needs to be hosted
|
|
139
|
+
* instead of the entire package.
|
|
140
|
+
*
|
|
141
|
+
* @example "https://unpkg.com/emojibase-data"
|
|
142
|
+
*
|
|
143
|
+
* @example "https://example.com/self-hosted-emojibase-data"
|
|
144
|
+
*
|
|
145
|
+
* @default "https://cdn.jsdelivr.net/npm/emojibase-data"
|
|
146
|
+
*/
|
|
147
|
+
emojibaseUrl?: string;
|
|
148
|
+
/**
|
|
149
|
+
* Custom emojis to include in the picker.
|
|
150
|
+
*/
|
|
151
|
+
customEmojis?: Emoji[];
|
|
152
|
+
/**
|
|
153
|
+
* Custom categories to include in the picker.
|
|
154
|
+
*/
|
|
155
|
+
customCategories?: CustomCategory[];
|
|
156
|
+
/**
|
|
157
|
+
* Whether the category headers should be sticky.
|
|
158
|
+
*
|
|
159
|
+
* @default true
|
|
160
|
+
*/
|
|
161
|
+
sticky?: boolean;
|
|
162
|
+
}
|
|
163
|
+
type EmojiPickerViewportProps = ComponentProps<"div">;
|
|
164
|
+
type EmojiPickerSearchProps = ComponentProps<"input">;
|
|
165
|
+
interface EmojiPickerSkinToneSelectorProps extends Omit<ComponentProps<"button">, "children"> {
|
|
166
|
+
/**
|
|
167
|
+
* The emoji to use as visual for the skin tone variations.
|
|
168
|
+
*
|
|
169
|
+
* @default "β"
|
|
170
|
+
*/
|
|
171
|
+
emoji?: string;
|
|
172
|
+
}
|
|
173
|
+
type EmojiPickerLoadingProps = ComponentProps<"span">;
|
|
174
|
+
type EmojiPickerEmptyRenderProps = {
|
|
175
|
+
/**
|
|
176
|
+
* The current search value.
|
|
177
|
+
*/
|
|
178
|
+
search: string;
|
|
179
|
+
};
|
|
180
|
+
interface EmojiPickerEmptyProps extends Omit<ComponentProps<"span">, "children"> {
|
|
181
|
+
/**
|
|
182
|
+
* The content to render when no emoji is found for the current search, or
|
|
183
|
+
* a render callback which receives the current search value.
|
|
184
|
+
*/
|
|
185
|
+
children?: ReactNode | ((props: EmojiPickerEmptyRenderProps) => ReactNode);
|
|
186
|
+
}
|
|
187
|
+
type EmojiPickerActiveEmojiRenderProps = {
|
|
188
|
+
/**
|
|
189
|
+
* The currently active emoji (either hovered or selected
|
|
190
|
+
* via keyboard navigation).
|
|
191
|
+
*/
|
|
192
|
+
emoji?: Emoji;
|
|
193
|
+
};
|
|
194
|
+
type EmojiPickerActiveEmojiProps = {
|
|
195
|
+
/**
|
|
196
|
+
* A render callback which receives the currently active emoji (either hovered or selected
|
|
197
|
+
* via keyboard navigation).
|
|
198
|
+
*/
|
|
199
|
+
children: (props: EmojiPickerActiveEmojiRenderProps) => ReactNode;
|
|
200
|
+
};
|
|
201
|
+
type EmojiPickerCategoryNavItem = {
|
|
202
|
+
/**
|
|
203
|
+
* The category to navigate to.
|
|
204
|
+
*/
|
|
205
|
+
category: Category;
|
|
206
|
+
/**
|
|
207
|
+
* Whether this category is currently active in the viewport.
|
|
208
|
+
*/
|
|
209
|
+
isActive: boolean;
|
|
210
|
+
/**
|
|
211
|
+
* Scrolls the list to the corresponding category.
|
|
212
|
+
*/
|
|
213
|
+
scrollTo: () => void;
|
|
214
|
+
};
|
|
215
|
+
type EmojiPickerCategoryNavRenderProps = {
|
|
216
|
+
/**
|
|
217
|
+
* The available categories and their scroll handlers.
|
|
218
|
+
*/
|
|
219
|
+
categories: EmojiPickerCategoryNavItem[];
|
|
220
|
+
};
|
|
221
|
+
type EmojiPickerCategoryNavProps = {
|
|
222
|
+
/**
|
|
223
|
+
* A render callback which receives the available categories and their scroll handlers.
|
|
224
|
+
*/
|
|
225
|
+
children: (props: EmojiPickerCategoryNavRenderProps) => ReactNode;
|
|
226
|
+
};
|
|
227
|
+
type EmojiPickerSkinToneRenderProps = {
|
|
228
|
+
/**
|
|
229
|
+
* The current skin tone.
|
|
230
|
+
*/
|
|
231
|
+
skinTone: SkinTone;
|
|
232
|
+
/**
|
|
233
|
+
* A function to change the current skin tone.
|
|
234
|
+
*/
|
|
235
|
+
setSkinTone: (skinTone: SkinTone) => void;
|
|
236
|
+
/**
|
|
237
|
+
* The skin tone variations of the specified emoji.
|
|
238
|
+
*/
|
|
239
|
+
skinToneVariations: SkinToneVariation[];
|
|
240
|
+
};
|
|
241
|
+
type EmojiPickerSkinToneProps = {
|
|
242
|
+
/**
|
|
243
|
+
* The emoji to use as visual for the skin tone variations.
|
|
244
|
+
*
|
|
245
|
+
* @default "β"
|
|
246
|
+
*/
|
|
247
|
+
emoji?: string;
|
|
248
|
+
/**
|
|
249
|
+
* A render callback which receives the current skin tone and a function
|
|
250
|
+
* to change it, as well as the skin tone variations of the specified emoji.
|
|
251
|
+
*/
|
|
252
|
+
children: (props: EmojiPickerSkinToneRenderProps) => ReactNode;
|
|
253
|
+
};
|
|
254
|
+
//#endregion
|
|
255
|
+
//#region src/components/emoji-picker/active-emoji.d.ts
|
|
256
|
+
/**
|
|
257
|
+
* Exposes the currently active emoji (either hovered or selected
|
|
258
|
+
* via keyboard navigation) via a render callback.
|
|
259
|
+
*
|
|
260
|
+
* @example
|
|
261
|
+
* ```tsx
|
|
262
|
+
* <EmojiPicker.ActiveEmoji>
|
|
263
|
+
* {({ emoji }) => <span>{emoji}</span>}
|
|
264
|
+
* </EmojiPicker.ActiveEmoji>
|
|
265
|
+
* ```
|
|
266
|
+
*
|
|
267
|
+
* It can be used to build a preview area next to the list.
|
|
268
|
+
*
|
|
269
|
+
* @example
|
|
270
|
+
* ```tsx
|
|
271
|
+
* <EmojiPicker.ActiveEmoji>
|
|
272
|
+
* {({ emoji }) => (
|
|
273
|
+
* <div>
|
|
274
|
+
* {emoji ? (
|
|
275
|
+
* <span>{emoji.emoji} {emoji.label}</span>
|
|
276
|
+
* ) : (
|
|
277
|
+
* <span>Select an emojiβ¦</span>
|
|
278
|
+
* )}
|
|
279
|
+
* </div>
|
|
280
|
+
* )}
|
|
281
|
+
* </EmojiPicker.ActiveEmoji>
|
|
282
|
+
* ```
|
|
283
|
+
*
|
|
284
|
+
* @see
|
|
285
|
+
* If you prefer to use a hook rather than a component,
|
|
286
|
+
* {@link useActiveEmoji} is also available.
|
|
287
|
+
*/
|
|
288
|
+
declare function EmojiPickerActiveEmoji({
|
|
289
|
+
children
|
|
290
|
+
}: EmojiPickerActiveEmojiProps): react3.ReactNode;
|
|
291
|
+
//#endregion
|
|
292
|
+
//#region src/components/emoji-picker/category-nav.d.ts
|
|
293
|
+
/**
|
|
294
|
+
* Exposes the emoji categories and provides scroll handlers to navigate
|
|
295
|
+
* to each category via a render callback.
|
|
296
|
+
*
|
|
297
|
+
* @example
|
|
298
|
+
* ```tsx
|
|
299
|
+
* <EmojiPicker.CategoryNav>
|
|
300
|
+
* {({ categories }) => (
|
|
301
|
+
* <div>
|
|
302
|
+
* {categories.map(({ category, scrollTo }) => (
|
|
303
|
+
* <button key={category.label} onClick={scrollTo}>
|
|
304
|
+
* {category.label}
|
|
305
|
+
* </button>
|
|
306
|
+
* ))}
|
|
307
|
+
* </div>
|
|
308
|
+
* )}
|
|
309
|
+
* </EmojiPicker.CategoryNav>
|
|
310
|
+
* ```
|
|
311
|
+
*
|
|
312
|
+
* This component allows building custom category navigation that can scroll
|
|
313
|
+
* to the corresponding section in the emoji list.
|
|
314
|
+
*/
|
|
315
|
+
declare function EmojiPickerCategoryNav({
|
|
316
|
+
children
|
|
317
|
+
}: EmojiPickerCategoryNavProps): react3.ReactNode;
|
|
318
|
+
//#endregion
|
|
319
|
+
//#region src/components/emoji-picker/list.d.ts
|
|
320
|
+
/**
|
|
321
|
+
* The list of emojis.
|
|
322
|
+
*
|
|
323
|
+
* @example
|
|
324
|
+
* ```tsx
|
|
325
|
+
* <EmojiPicker.Root>
|
|
326
|
+
* <EmojiPicker.Search />
|
|
327
|
+
* <EmojiPicker.Viewport>
|
|
328
|
+
* <EmojiPicker.List />
|
|
329
|
+
* </EmojiPicker.Viewport>
|
|
330
|
+
* </EmojiPicker.Root>
|
|
331
|
+
* ```
|
|
332
|
+
*
|
|
333
|
+
* Inner components within the list can be customized via the `components` prop.
|
|
334
|
+
*
|
|
335
|
+
* @example
|
|
336
|
+
* ```tsx
|
|
337
|
+
* <EmojiPicker.List
|
|
338
|
+
* components={{
|
|
339
|
+
* CategoryHeader: ({ category, ...props }) => (
|
|
340
|
+
* <div {...props}>{category.label}</div>
|
|
341
|
+
* ),
|
|
342
|
+
* Emoji: ({ emoji, ...props }) => (
|
|
343
|
+
* <button {...props}>
|
|
344
|
+
* {emoji.emoji}
|
|
345
|
+
* </button>
|
|
346
|
+
* ),
|
|
347
|
+
* Row: ({ children, ...props }) => <div {...props}>{children}</div>,
|
|
348
|
+
* }}
|
|
349
|
+
* />
|
|
350
|
+
* ```
|
|
351
|
+
*/
|
|
352
|
+
declare const EmojiPickerList: react3.ForwardRefExoticComponent<Omit<EmojiPickerListProps, "ref"> & react3.RefAttributes<HTMLDivElement>>;
|
|
353
|
+
//#endregion
|
|
354
|
+
//#region src/components/emoji-picker/status.d.ts
|
|
355
|
+
/**
|
|
356
|
+
* Only renders when the emoji data is loading.
|
|
357
|
+
*
|
|
358
|
+
* @example
|
|
359
|
+
* ```tsx
|
|
360
|
+
* <EmojiPicker.Root>
|
|
361
|
+
* <EmojiPicker.Search />
|
|
362
|
+
* <EmojiPicker.Viewport>
|
|
363
|
+
* <EmojiPicker.Loading>Loadingβ¦</EmojiPicker.Loading>
|
|
364
|
+
* <EmojiPicker.List />
|
|
365
|
+
* </EmojiPicker.Viewport>
|
|
366
|
+
* </EmojiPicker.Root>
|
|
367
|
+
* ```
|
|
368
|
+
*/
|
|
369
|
+
declare function EmojiPickerLoading({
|
|
370
|
+
children,
|
|
371
|
+
...props
|
|
372
|
+
}: EmojiPickerLoadingProps): react_jsx_runtime0.JSX.Element | null;
|
|
373
|
+
/**
|
|
374
|
+
* Only renders when no emoji is found for the current search. The content is
|
|
375
|
+
* rendered without any surrounding DOM element.
|
|
376
|
+
*
|
|
377
|
+
* @example
|
|
378
|
+
* ```tsx
|
|
379
|
+
* <EmojiPicker.Root>
|
|
380
|
+
* <EmojiPicker.Search />
|
|
381
|
+
* <EmojiPicker.Viewport>
|
|
382
|
+
* <EmojiPicker.Empty>No emoji found.</EmojiPicker.Empty>
|
|
383
|
+
* <EmojiPicker.List />
|
|
384
|
+
* </EmojiPicker.Viewport>
|
|
385
|
+
* </EmojiPicker.Root>
|
|
386
|
+
* ```
|
|
387
|
+
*
|
|
388
|
+
* It can also expose the current search via a render callback to build
|
|
389
|
+
* a more detailed empty state.
|
|
390
|
+
*
|
|
391
|
+
* @example
|
|
392
|
+
* ```tsx
|
|
393
|
+
* <EmojiPicker.Empty>
|
|
394
|
+
* {({ search }) => <>No emoji found for "{search}"</>}
|
|
395
|
+
* </EmojiPicker.Empty>
|
|
396
|
+
* ```
|
|
397
|
+
*/
|
|
398
|
+
declare function EmojiPickerEmpty({
|
|
399
|
+
children,
|
|
400
|
+
...props
|
|
401
|
+
}: EmojiPickerEmptyProps): react_jsx_runtime0.JSX.Element | null;
|
|
402
|
+
//#endregion
|
|
403
|
+
//#region src/components/emoji-picker/root.d.ts
|
|
404
|
+
/**
|
|
405
|
+
* Surrounds all the emoji picker parts.
|
|
406
|
+
*
|
|
407
|
+
* @example
|
|
408
|
+
* ```tsx
|
|
409
|
+
* <EmojiPicker.Root onEmojiSelect={({ emoji }) => console.log(emoji)}>
|
|
410
|
+
* <EmojiPicker.Search />
|
|
411
|
+
* <EmojiPicker.Viewport>
|
|
412
|
+
* <EmojiPicker.List />
|
|
413
|
+
* </EmojiPicker.Viewport>
|
|
414
|
+
* </EmojiPicker.Root>
|
|
415
|
+
* ```
|
|
416
|
+
*
|
|
417
|
+
* Options affecting the entire emoji picker are available on this
|
|
418
|
+
* component as props.
|
|
419
|
+
*
|
|
420
|
+
* @example
|
|
421
|
+
* ```tsx
|
|
422
|
+
* <EmojiPicker.Root locale="fr" columns={10} skinTone="medium">
|
|
423
|
+
* {\/* ... *\/}
|
|
424
|
+
* </EmojiPicker.Root>
|
|
425
|
+
* ```
|
|
426
|
+
*/
|
|
427
|
+
declare const EmojiPickerRoot: react3.ForwardRefExoticComponent<Omit<EmojiPickerRootProps, "ref"> & react3.RefAttributes<HTMLDivElement>>;
|
|
428
|
+
//#endregion
|
|
429
|
+
//#region src/components/emoji-picker/search.d.ts
|
|
430
|
+
/**
|
|
431
|
+
* A search input to filter the list of emojis.
|
|
432
|
+
*
|
|
433
|
+
* @example
|
|
434
|
+
* ```tsx
|
|
435
|
+
* <EmojiPicker.Root>
|
|
436
|
+
* <EmojiPicker.Search />
|
|
437
|
+
* <EmojiPicker.Viewport>
|
|
438
|
+
* <EmojiPicker.List />
|
|
439
|
+
* </EmojiPicker.Viewport>
|
|
440
|
+
* </EmojiPicker.Root>
|
|
441
|
+
* ```
|
|
442
|
+
*
|
|
443
|
+
* It can be controlled or uncontrolled.
|
|
444
|
+
*
|
|
445
|
+
* @example
|
|
446
|
+
* ```tsx
|
|
447
|
+
* const [search, setSearch] = useState("");
|
|
448
|
+
*
|
|
449
|
+
* return (
|
|
450
|
+
* <EmojiPicker.Root>
|
|
451
|
+
* <EmojiPicker.Search
|
|
452
|
+
* value={search}
|
|
453
|
+
* onChange={(event) => setSearch(event.target.value)}
|
|
454
|
+
* />
|
|
455
|
+
* {\/* ... *\/}
|
|
456
|
+
* </EmojiPicker.Root>
|
|
457
|
+
* );
|
|
458
|
+
* ```
|
|
459
|
+
*/
|
|
460
|
+
declare const EmojiPickerSearch: react3.ForwardRefExoticComponent<Omit<react3.DetailedHTMLProps<react3.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref"> & react3.RefAttributes<HTMLInputElement>>;
|
|
461
|
+
//#endregion
|
|
462
|
+
//#region src/components/emoji-picker/skin-tone.d.ts
|
|
463
|
+
/**
|
|
464
|
+
* A button to change the current skin tone by cycling through the
|
|
465
|
+
* available skin tones.
|
|
466
|
+
*
|
|
467
|
+
* @example
|
|
468
|
+
* ```tsx
|
|
469
|
+
* <EmojiPicker.SkinToneSelector />
|
|
470
|
+
* ```
|
|
471
|
+
*
|
|
472
|
+
* The emoji used as visual can be customized (by default, β).
|
|
473
|
+
*
|
|
474
|
+
* @example
|
|
475
|
+
* ```tsx
|
|
476
|
+
* <EmojiPicker.SkinToneSelector emoji="π" />
|
|
477
|
+
* ```
|
|
478
|
+
*
|
|
479
|
+
* @see
|
|
480
|
+
* If you want to build a custom skin tone selector, you can use the
|
|
481
|
+
* {@link EmojiPickerSkinTone|`<EmojiPicker.SkinTone />`} component or
|
|
482
|
+
* {@link useSkinTone|`useSkinTone`} hook.
|
|
483
|
+
*/
|
|
484
|
+
declare const EmojiPickerSkinToneSelector: react3.ForwardRefExoticComponent<Omit<EmojiPickerSkinToneSelectorProps, "ref"> & react3.RefAttributes<HTMLButtonElement>>;
|
|
485
|
+
/**
|
|
486
|
+
* Exposes the current skin tone and a function to change it via a render
|
|
487
|
+
* callback.
|
|
488
|
+
*
|
|
489
|
+
* @example
|
|
490
|
+
* ```tsx
|
|
491
|
+
* <EmojiPicker.SkinTone>
|
|
492
|
+
* {({ skinTone, setSkinTone }) => (
|
|
493
|
+
* <div>
|
|
494
|
+
* <span>{skinTone}</span>
|
|
495
|
+
* <button onClick={() => setSkinTone("none")}>Reset skin tone</button>
|
|
496
|
+
* </div>
|
|
497
|
+
* )}
|
|
498
|
+
* </EmojiPicker.SkinTone>
|
|
499
|
+
* ```
|
|
500
|
+
*
|
|
501
|
+
* It can be used to build a custom skin tone selector: pass an emoji
|
|
502
|
+
* you want to use as visual (by default, β) and it will return its skin tone
|
|
503
|
+
* variations.
|
|
504
|
+
*
|
|
505
|
+
* @example
|
|
506
|
+
* ```tsx
|
|
507
|
+
* const [skinTone, setSkinTone, skinToneVariations] = useSkinTone("π");
|
|
508
|
+
*
|
|
509
|
+
* // (π) (ππ») (ππΌ) (ππ½) (ππΎ) (ππΏ)
|
|
510
|
+
* <EmojiPicker.SkinTone emoji="π">
|
|
511
|
+
* {({ skinTone, setSkinTone, skinToneVariations }) => (
|
|
512
|
+
* skinToneVariations.map(({ skinTone, emoji }) => (
|
|
513
|
+
* <button key={skinTone} onClick={() => setSkinTone(skinTone)}>
|
|
514
|
+
* {emoji}
|
|
515
|
+
* </button>
|
|
516
|
+
* ))
|
|
517
|
+
* )}
|
|
518
|
+
* </EmojiPicker.SkinTone>
|
|
519
|
+
* ```
|
|
520
|
+
*
|
|
521
|
+
* @see
|
|
522
|
+
* If you prefer to use a hook rather than a component,
|
|
523
|
+
* {@link useSkinTone} is also available.
|
|
524
|
+
*
|
|
525
|
+
* @see
|
|
526
|
+
* An already-built skin tone selector is also available,
|
|
527
|
+
* {@link EmojiPicker.SkinToneSelector|`<EmojiPicker.SkinToneSelector />`}.
|
|
528
|
+
*/
|
|
529
|
+
declare function EmojiPickerSkinTone({
|
|
530
|
+
children,
|
|
531
|
+
emoji
|
|
532
|
+
}: EmojiPickerSkinToneProps): react3.ReactNode;
|
|
533
|
+
//#endregion
|
|
534
|
+
//#region src/components/emoji-picker/viewport.d.ts
|
|
535
|
+
/**
|
|
536
|
+
* The scrolling container of the emoji picker.
|
|
537
|
+
*
|
|
538
|
+
* @example
|
|
539
|
+
* ```tsx
|
|
540
|
+
* <EmojiPicker.Root>
|
|
541
|
+
* <EmojiPicker.Search />
|
|
542
|
+
* <EmojiPicker.Viewport>
|
|
543
|
+
* <EmojiPicker.Loading>Loadingβ¦</EmojiPicker.Loading>
|
|
544
|
+
* <EmojiPicker.Empty>No emoji found.</EmojiPicker.Empty>
|
|
545
|
+
* <EmojiPicker.List />
|
|
546
|
+
* </EmojiPicker.Viewport>
|
|
547
|
+
* </EmojiPicker.Root>
|
|
548
|
+
* ```
|
|
549
|
+
*/
|
|
550
|
+
declare const EmojiPickerViewport: react3.ForwardRefExoticComponent<Omit<react3.DetailedHTMLProps<react3.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & react3.RefAttributes<HTMLDivElement>>;
|
|
551
|
+
declare namespace emoji_picker_d_exports {
|
|
552
|
+
export { EmojiPickerActiveEmoji as ActiveEmoji, EmojiPickerCategoryNav as CategoryNav, EmojiPickerEmpty as Empty, EmojiPickerList as List, EmojiPickerLoading as Loading, EmojiPickerRoot as Root, EmojiPickerSearch as Search, EmojiPickerSkinTone as SkinTone, EmojiPickerSkinToneSelector as SkinToneSelector, EmojiPickerViewport as Viewport };
|
|
553
|
+
}
|
|
554
|
+
//#endregion
|
|
555
|
+
//#region src/hooks.d.ts
|
|
556
|
+
/**
|
|
557
|
+
* Returns the currently active emoji (either hovered or selected
|
|
558
|
+
* via keyboard navigation).
|
|
559
|
+
*
|
|
560
|
+
* @example
|
|
561
|
+
* ```tsx
|
|
562
|
+
* const activeEmoji = useActiveEmoji();
|
|
563
|
+
* ```
|
|
564
|
+
*
|
|
565
|
+
* It can be used to build a preview area next to the list.
|
|
566
|
+
*
|
|
567
|
+
* @example
|
|
568
|
+
* ```tsx
|
|
569
|
+
* const activeEmoji = useActiveEmoji();
|
|
570
|
+
*
|
|
571
|
+
* <div>
|
|
572
|
+
* {activeEmoji ? (
|
|
573
|
+
* <span>{activeEmoji.emoji} {activeEmoji.label}</span>
|
|
574
|
+
* ) : (
|
|
575
|
+
* <span>Select an emojiβ¦</span>
|
|
576
|
+
* )}
|
|
577
|
+
* </div>
|
|
578
|
+
* ```
|
|
579
|
+
*
|
|
580
|
+
* @see
|
|
581
|
+
* If you prefer to use a component rather than a hook,
|
|
582
|
+
* {@link EmojiPicker.ActiveEmoji|`<EmojiPicker.ActiveEmoji />`} is also available.
|
|
583
|
+
*/
|
|
584
|
+
declare function useActiveEmoji(): Emoji | undefined;
|
|
585
|
+
/**
|
|
586
|
+
* Returns the current skin tone and a function to change it.
|
|
587
|
+
*
|
|
588
|
+
* @example
|
|
589
|
+
* ```tsx
|
|
590
|
+
* const [skinTone, setSkinTone] = useSkinTone();
|
|
591
|
+
* ```
|
|
592
|
+
*
|
|
593
|
+
* It can be used to build a custom skin tone selector: pass an emoji
|
|
594
|
+
* you want to use as visual (by default, β) and it will return its skin tone
|
|
595
|
+
* variations.
|
|
596
|
+
*
|
|
597
|
+
* @example
|
|
598
|
+
* ```tsx
|
|
599
|
+
* const [skinTone, setSkinTone, skinToneVariations] = useSkinTone("π");
|
|
600
|
+
*
|
|
601
|
+
* // (π) (ππ») (ππΌ) (ππ½) (ππΎ) (ππΏ)
|
|
602
|
+
* skinToneVariations.map(({ skinTone, emoji }) => (
|
|
603
|
+
* <button key={skinTone} onClick={() => setSkinTone(skinTone)}>
|
|
604
|
+
* {emoji}
|
|
605
|
+
* </button>
|
|
606
|
+
* ));
|
|
607
|
+
* ```
|
|
608
|
+
*
|
|
609
|
+
* @see
|
|
610
|
+
* If you prefer to use a component rather than a hook,
|
|
611
|
+
* {@link EmojiPicker.SkinTone|`<EmojiPicker.SkinTone />`} is also available.
|
|
612
|
+
*
|
|
613
|
+
* @see
|
|
614
|
+
* An already-built skin tone selector is also available,
|
|
615
|
+
* {@link EmojiPicker.SkinToneSelector|`<EmojiPicker.SkinToneSelector />`}.
|
|
616
|
+
*/
|
|
617
|
+
declare function useSkinTone(emoji?: string): [SkinTone, (skinTone: SkinTone) => void, SkinToneVariation[]];
|
|
618
|
+
//#endregion
|
|
619
|
+
export { type Category, type CustomCategory, type Emoji, emoji_picker_d_exports as EmojiPicker, type EmojiPickerActiveEmojiProps, type EmojiPickerCategoryNavProps, type EmojiPickerEmptyProps, type EmojiPickerListCategoryHeaderProps, type EmojiPickerListComponents, type EmojiPickerListEmojiProps, type EmojiPickerListProps, type EmojiPickerListRowProps, type EmojiPickerLoadingProps, type EmojiPickerRootProps, type EmojiPickerSearchProps, type EmojiPickerSkinToneProps, type EmojiPickerSkinToneSelectorProps, type EmojiPickerViewportProps, type Locale, type SkinTone, useActiveEmoji, useSkinTone };
|
|
620
|
+
//# sourceMappingURL=index.d.cts.map
|