mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-03 22:37:03 +00:00
Merge pull request #28095 from Nicell/emoji-mart-2.8
emoji-mart: update for v2.8.0
This commit is contained in:
+2
-3
@@ -1,12 +1,11 @@
|
||||
import React = require('react');
|
||||
|
||||
import { EmojiData } from '..';
|
||||
|
||||
import { Emoji, EmojiProps, I18n } from '.';
|
||||
import { Emoji, EmojiData, EmojiProps, I18n, CategoryName } from '..';
|
||||
|
||||
export interface Props {
|
||||
emojis?: Array<string|EmojiData>;
|
||||
hasStickyPosition?: boolean;
|
||||
id: CategoryName;
|
||||
name: string;
|
||||
native: boolean;
|
||||
perLine: number;
|
||||
|
||||
-31
@@ -1,31 +0,0 @@
|
||||
import React = require('react');
|
||||
|
||||
import { EmojiData, EmojiSkin } from '..';
|
||||
|
||||
export type BackgroundImageFn = (set: EmojiSet, sheetSize: EmojiSheetSize) => string;
|
||||
export type EmojiSet = 'apple'|'google'|'twitter'|'emojione'|'messenger'|'facebook';
|
||||
export type EmojiSheetSize = 16|20|32|64;
|
||||
|
||||
export interface Props {
|
||||
onOver?(emoji: EmojiData, e: React.MouseEvent<HTMLElement>): void;
|
||||
onLeave?(emoji: EmojiData, e: React.MouseEvent<HTMLElement>): void;
|
||||
onClick?(emoji: EmojiData, e: React.MouseEvent<HTMLElement>): void;
|
||||
/** defaults to returning a png from unpkg.com-hosted emoji-datasource-${set} */
|
||||
backgroundImageFn?: BackgroundImageFn;
|
||||
native?: boolean;
|
||||
forceSize?: boolean;
|
||||
tooltip?: boolean;
|
||||
/** defaults to 1 */
|
||||
skin?: EmojiSkin;
|
||||
/** defaults to 64 */
|
||||
sheetSize?: EmojiSheetSize;
|
||||
/** defaults to 'apple' */
|
||||
set?: EmojiSet;
|
||||
size: number;
|
||||
emoji: string|EmojiData;
|
||||
}
|
||||
|
||||
// tslint:disable-next-line strict-export-declare-modifiers
|
||||
declare const Emoji: React.SFC<Props>;
|
||||
|
||||
export { Emoji as default };
|
||||
@@ -0,0 +1,8 @@
|
||||
import React = require('react');
|
||||
|
||||
import { EmojiProps } from '../..';
|
||||
|
||||
// tslint:disable-next-line strict-export-declare-modifiers
|
||||
declare const Emoji: React.StatelessComponent<EmojiProps>;
|
||||
|
||||
export { Emoji as default };
|
||||
@@ -0,0 +1,12 @@
|
||||
import React = require('react');
|
||||
|
||||
import { EmojiProps, Data } from '../..';
|
||||
|
||||
export interface NimbleEmojiProps extends EmojiProps {
|
||||
data: Data;
|
||||
}
|
||||
|
||||
// tslint:disable-next-line strict-export-declare-modifiers
|
||||
declare const NimbleEmoji: React.SFC<NimbleEmojiProps>;
|
||||
|
||||
export { NimbleEmoji as default };
|
||||
+4
-2
@@ -1,4 +1,6 @@
|
||||
// The other exports on the components folder are not public API
|
||||
export { default as Category, Props as CategoryProps } from './category';
|
||||
export { default as Emoji, Props as EmojiProps, BackgroundImageFn, EmojiSet, EmojiSheetSize } from './emoji';
|
||||
export { default as Picker, Props as PickerProps, I18n, PartialI18n, CustomEmoji } from './picker';
|
||||
export { default as Emoji } from './emoji/emoji';
|
||||
export { default as NimbleEmoji, NimbleEmojiProps } from './emoji/nimble-emoji';
|
||||
export { default as Picker } from './picker/picker';
|
||||
export { default as NimblePicker, NimblePickerProps } from './picker/nimble-picker';
|
||||
|
||||
-54
@@ -1,54 +0,0 @@
|
||||
import React = require('react');
|
||||
|
||||
import { EmojiData, EmojiSkin } from '..';
|
||||
|
||||
import { Category, Emoji, EmojiProps, BackgroundImageFn, EmojiSet, EmojiSheetSize } from '.';
|
||||
|
||||
// tslint:disable-next-line interface-name
|
||||
export interface I18n {
|
||||
search: string;
|
||||
categories: Record<'search'|'recent'|'people'|'nature'|'foods'|'activity'|'places'|'objects'|'symbols'|'flags'|'custom', string>;
|
||||
notfound: string;
|
||||
}
|
||||
|
||||
export type PartialI18n = Partial<Pick<I18n, 'search'|'notfound'> & { categories: Partial<I18n['categories']>}>;
|
||||
|
||||
export interface CustomEmoji {
|
||||
// id is overridden by short_names[0]
|
||||
name: string;
|
||||
/** Must contain at least one name. The first name is used as the unique id. */
|
||||
short_names: string[];
|
||||
emoticons?: string[];
|
||||
keywords?: string[];
|
||||
imageUrl: string;
|
||||
}
|
||||
|
||||
export interface Props {
|
||||
/** NOTE: default is not preventable */
|
||||
onClick?(emoji: EmojiData, e: React.MouseEvent<HTMLElement>): void;
|
||||
perLine?: number;
|
||||
emojiSize?: number;
|
||||
i18n?: PartialI18n;
|
||||
style?: React.CSSProperties;
|
||||
title?: string;
|
||||
emoji?: string;
|
||||
color?: string;
|
||||
set?: EmojiSet;
|
||||
skin?: EmojiSkin;
|
||||
native?: boolean;
|
||||
backgroundImageFn?: BackgroundImageFn;
|
||||
sheetSize?: EmojiSheetSize;
|
||||
emojisToShowFilter?(emoji: EmojiData): boolean;
|
||||
showPreview?: boolean;
|
||||
emojiTooltip?: boolean;
|
||||
include?: string[];
|
||||
exclude?: string[];
|
||||
recent?: string[];
|
||||
autoFocus?: boolean;
|
||||
/** NOTE: custom emoji are copied into a singleton object on every new mount */
|
||||
custom: CustomEmoji[];
|
||||
}
|
||||
|
||||
export default class Picker extends React.PureComponent<Props> {
|
||||
// everything inside it is supposed to be private
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
import React = require('react');
|
||||
|
||||
import { Data, PickerProps } from '../..';
|
||||
|
||||
export interface NimblePickerProps extends PickerProps {
|
||||
data: Data;
|
||||
}
|
||||
|
||||
export default class NimblePicker extends React.PureComponent<NimblePickerProps> {
|
||||
// everything inside it is supposed to be private
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
import React = require('react');
|
||||
|
||||
import { PickerProps } from '../..';
|
||||
|
||||
export default class Picker extends React.PureComponent<PickerProps> {
|
||||
// everything inside it is supposed to be private
|
||||
}
|
||||
Vendored
+21
-6
@@ -1,15 +1,30 @@
|
||||
export { default as emojiIndex, EmojiData, EmojiSkin } from './utils/emoji-index';
|
||||
export { default as store, StoreHandlers } from './utils/store';
|
||||
export { default as frequently } from './utils/frequently';
|
||||
export { Data } from './utils/data';
|
||||
|
||||
export {
|
||||
PickerProps,
|
||||
EmojiProps,
|
||||
I18n,
|
||||
PartialI18n,
|
||||
CategoryName
|
||||
} from './utils/shared-props';
|
||||
|
||||
export {
|
||||
emojiIndex,
|
||||
nimbleEmojiIndex,
|
||||
EmojiData,
|
||||
CustomEmoji,
|
||||
EmojiSkin
|
||||
} from './utils/emoji-index';
|
||||
|
||||
export {
|
||||
Picker,
|
||||
PickerProps,
|
||||
I18n,
|
||||
PartialI18n,
|
||||
CustomEmoji,
|
||||
NimblePicker,
|
||||
NimblePickerProps,
|
||||
Emoji,
|
||||
EmojiProps,
|
||||
NimbleEmoji,
|
||||
NimbleEmojiProps,
|
||||
Category,
|
||||
CategoryProps
|
||||
} from './components';
|
||||
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
export interface Data {
|
||||
compressed: boolean;
|
||||
categories: Category[];
|
||||
emojis: { [key: string]: Emoji };
|
||||
aliases: { [key: string]: string };
|
||||
}
|
||||
|
||||
export interface Category {
|
||||
id: string;
|
||||
name: string;
|
||||
emojis: string[];
|
||||
}
|
||||
|
||||
export interface Emoji {
|
||||
name?: string;
|
||||
a?: string;
|
||||
unified?: string;
|
||||
b?: string;
|
||||
non_qualified?: string;
|
||||
c?: string;
|
||||
has_img_apple?: boolean;
|
||||
d?: boolean;
|
||||
has_img_google?: boolean;
|
||||
e?: boolean;
|
||||
has_img_twitter?: boolean;
|
||||
f?: boolean;
|
||||
has_img_emojione?: boolean;
|
||||
g?: boolean;
|
||||
has_img_facebook?: boolean;
|
||||
h?: boolean;
|
||||
has_img_messenger?: boolean;
|
||||
i?: boolean;
|
||||
keywords?: string[];
|
||||
j?: string[];
|
||||
sheet?: number[];
|
||||
k?: number[];
|
||||
emoticons?: string[];
|
||||
l?: string[];
|
||||
text?: string;
|
||||
m?: string;
|
||||
short_names?: string[];
|
||||
n?: string[];
|
||||
added_in?: number;
|
||||
o?: number;
|
||||
sheet_x?: number;
|
||||
sheet_y?: number;
|
||||
skin_variations?: { [key: string]: SkinVariation };
|
||||
obsoleted_by?: string;
|
||||
obsoletes?: string;
|
||||
}
|
||||
|
||||
export interface SkinVariation {
|
||||
unified: string;
|
||||
non_qualified: null | string;
|
||||
image: string;
|
||||
sheet_x: number;
|
||||
sheet_y: number;
|
||||
added_in: string;
|
||||
has_img_apple: boolean;
|
||||
has_img_google: boolean;
|
||||
has_img_twitter: boolean;
|
||||
has_img_emojione: boolean;
|
||||
has_img_facebook: boolean;
|
||||
has_img_messenger: boolean;
|
||||
obsoleted_by?: string;
|
||||
obsoletes?: string;
|
||||
}
|
||||
|
||||
export function buildSearch(emoji: Emoji): string;
|
||||
|
||||
export function compress(emoji: Emoji): void;
|
||||
|
||||
export function uncompress(data: Data): void;
|
||||
-25
@@ -1,25 +0,0 @@
|
||||
export type EmojiSkin = 1|2|3|4|5|6;
|
||||
|
||||
export interface EmojiData {
|
||||
id: string;
|
||||
name: string;
|
||||
colons: string;
|
||||
/** Reverse mapping to keyof emoticons */
|
||||
emoticons: string[];
|
||||
unified: string;
|
||||
skin: EmojiSkin|null;
|
||||
native: string;
|
||||
}
|
||||
|
||||
// tslint:disable-next-line strict-export-declare-modifiers
|
||||
declare const _default: {
|
||||
search(query: ''): null
|
||||
search(query: string): EmojiData|null
|
||||
|
||||
emojis: { [emoji: string]: EmojiData }
|
||||
|
||||
/** Mapping of string to keyof emojis */
|
||||
emoticons: { [emoticon: string]: string }
|
||||
};
|
||||
|
||||
export { _default as default };
|
||||
@@ -0,0 +1,14 @@
|
||||
import { EmojiData } from './nimble-emoji-index';
|
||||
|
||||
// tslint:disable-next-line strict-export-declare-modifiers
|
||||
declare const _default: {
|
||||
search(query: ''): null;
|
||||
search(query: string): EmojiData|null;
|
||||
|
||||
emojis: { [emoji: string]: EmojiData };
|
||||
|
||||
/** Mapping of string to keyof emojis */
|
||||
emoticons: { [emoticon: string]: string };
|
||||
};
|
||||
|
||||
export { _default as default };
|
||||
@@ -0,0 +1,2 @@
|
||||
export { default as emojiIndex } from './emoji-index';
|
||||
export { default as nimbleEmojiIndex, EmojiData, CustomEmoji, EmojiSkin } from './nimble-emoji-index';
|
||||
@@ -0,0 +1,40 @@
|
||||
import { Data } from "../data";
|
||||
|
||||
import { CategoryName } from '../shared-props';
|
||||
|
||||
export type EmojiSkin = 1 | 2 | 3 | 4 | 5 | 6;
|
||||
|
||||
export interface BaseEmoji {
|
||||
id: string;
|
||||
name: string;
|
||||
colons: string;
|
||||
/** Reverse mapping to keyof emoticons */
|
||||
emoticons: string[];
|
||||
unified: string;
|
||||
skin: EmojiSkin | null;
|
||||
native: string;
|
||||
}
|
||||
|
||||
export interface CustomEmoji {
|
||||
// id is overridden by short_names[0]
|
||||
id?: string;
|
||||
// colons is overridden by :id:
|
||||
colons?: string;
|
||||
name: string;
|
||||
/** Must contain at least one name. The first name is used as the unique id. */
|
||||
short_names: string[];
|
||||
emoticons?: string[];
|
||||
keywords?: string[];
|
||||
imageUrl: string;
|
||||
}
|
||||
|
||||
export type EmojiData = BaseEmoji | CustomEmoji;
|
||||
|
||||
export default class NimbleEmojiIndex {
|
||||
constructor(data: Data);
|
||||
search(query: ''): null;
|
||||
search(query: string): EmojiData[]|null;
|
||||
emojis: { [emoji: string]: EmojiData };
|
||||
/** Mapping of string to keyof emojis */
|
||||
emoticons: { [emoticon: string]: string };
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
import React = require('react');
|
||||
|
||||
import { EmojiData, EmojiSkin, CustomEmoji } from './emoji-index/nimble-emoji-index';
|
||||
|
||||
export type BackgroundImageFn = (set: EmojiSet, sheetSize: EmojiSheetSize) => string;
|
||||
export type EmojiSet = 'apple' | 'google' | 'twitter' | 'emojione' | 'messenger' | 'facebook';
|
||||
export type EmojiSheetSize = 16 | 20 | 32 | 64;
|
||||
|
||||
export interface EmojiProps {
|
||||
onOver?(emoji: EmojiData, e: React.MouseEvent<HTMLElement>): void;
|
||||
onLeave?(emoji: EmojiData, e: React.MouseEvent<HTMLElement>): void;
|
||||
onClick?(emoji: EmojiData, e: React.MouseEvent<HTMLElement>): void;
|
||||
fallback?(emoji: EmojiData, props: EmojiProps): React.Component;
|
||||
/** defaults to returning a png from unpkg.com-hosted emoji-datasource-${set} */
|
||||
backgroundImageFn?: BackgroundImageFn;
|
||||
native?: boolean;
|
||||
forceSize?: boolean;
|
||||
tooltip?: boolean;
|
||||
/** defaults to 1 */
|
||||
skin?: EmojiSkin;
|
||||
/** defaults to 64 */
|
||||
sheetSize?: EmojiSheetSize;
|
||||
/** defaults to 52 */
|
||||
sheetColumns?: number;
|
||||
/** defaults to 52 */
|
||||
sheetRows?: number;
|
||||
/** defaults to 'apple' */
|
||||
set?: EmojiSet;
|
||||
size: number;
|
||||
emoji: string | EmojiData;
|
||||
html?: boolean;
|
||||
/** data is omitted here as it should be used for NimbleEmoji only - not emoji */
|
||||
}
|
||||
|
||||
export type CategoryName = 'search' | 'recent' | 'people' | 'nature' | 'foods' | 'activity' | 'places' | 'objects' | 'symbols' | 'flags' | 'custom';
|
||||
|
||||
// tslint:disable-next-line interface-name
|
||||
export interface I18n {
|
||||
search: string;
|
||||
categories: Record<CategoryName, string>;
|
||||
notfound: string;
|
||||
skintext: string;
|
||||
}
|
||||
|
||||
export type PartialI18n = Partial<Pick<I18n, 'search' | 'notfound'> & { categories: Partial<I18n['categories']> }>;
|
||||
|
||||
export interface CustomIcons {
|
||||
categories: Record<CategoryName, () => React.Component>;
|
||||
}
|
||||
|
||||
export interface PickerProps {
|
||||
/** NOTE: default is not preventable */
|
||||
onClick?(emoji: EmojiData, e: React.MouseEvent<HTMLElement>): void;
|
||||
onSelect?(emoji: EmojiData): void;
|
||||
onSkinChange?(skin: EmojiSkin): void;
|
||||
perLine?: number;
|
||||
emojiSize?: number;
|
||||
i18n?: PartialI18n;
|
||||
style?: React.CSSProperties;
|
||||
title?: string;
|
||||
emoji?: string;
|
||||
color?: string;
|
||||
set?: EmojiSet;
|
||||
skin?: EmojiSkin;
|
||||
defaultSkin?: EmojiSkin;
|
||||
native?: boolean;
|
||||
backgroundImageFn?: BackgroundImageFn;
|
||||
sheetSize?: EmojiSheetSize;
|
||||
emojisToShowFilter?(emoji: EmojiData): boolean;
|
||||
showPreview?: boolean;
|
||||
showSkinTones?: boolean;
|
||||
emojiTooltip?: boolean;
|
||||
include?: CategoryName[];
|
||||
exclude?: CategoryName[];
|
||||
recent?: string[];
|
||||
autoFocus?: boolean;
|
||||
/** NOTE: custom emoji are copied into a singleton object on every new mount */
|
||||
custom: CustomEmoji[];
|
||||
skinEmoji?: string;
|
||||
notFound?(): React.Component;
|
||||
notFoundEmoji?: string;
|
||||
icons?: CustomIcons;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
// Port of https://github.com/missive/emoji-mart/blob/master/src/components/emoji.js
|
||||
// Port of https://github.com/missive/emoji-mart/blob/v2.8.0/stories/index.js
|
||||
|
||||
import React = require('react');
|
||||
|
||||
|
||||
Vendored
+2
-3
@@ -1,9 +1,8 @@
|
||||
// Type definitions for emoji-mart 2.2
|
||||
// Type definitions for emoji-mart 2.8
|
||||
// Project: https://github.com/missive/emoji-mart
|
||||
// Definitions by: Diogo Franco <https://github.com/Kovensky>
|
||||
// Nick Winans <https://github.com/Nicell>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
// These definitions should work with 2.3, but the tests doesn't pass on 2.3.
|
||||
|
||||
export * from './dist-es';
|
||||
|
||||
@@ -20,11 +20,17 @@
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"dist-es/components/category.d.ts",
|
||||
"dist-es/components/emoji.d.ts",
|
||||
"dist-es/components/emoji/emoji.d.ts",
|
||||
"dist-es/components/emoji/nimble-emoji.d.ts",
|
||||
"dist-es/components/index.d.ts",
|
||||
"dist-es/components/picker.d.ts",
|
||||
"dist-es/utils/emoji-index.d.ts",
|
||||
"dist-es/components/picker/picker.d.ts",
|
||||
"dist-es/components/picker/nimble-picker.d.ts",
|
||||
"dist-es/utils/emoji-index/emoji-index.d.ts",
|
||||
"dist-es/utils/emoji-index/nimble-emoji-index.d.ts",
|
||||
"dist-es/utils/emoji-index/index.d.ts",
|
||||
"dist-es/utils/data.d.ts",
|
||||
"dist-es/utils/frequently.d.ts",
|
||||
"dist-es/utils/shared-props.d.ts",
|
||||
"dist-es/utils/store.d.ts",
|
||||
"dist-es/index.d.ts",
|
||||
"emoji-mart-tests.tsx"
|
||||
|
||||
Reference in New Issue
Block a user