UNPKG

2.62 kBTypeScriptView Raw
1import { IRawStyle, IFontFace } from '@uifabric/merge-styles';
2export interface IIconSubset {
3 fontFace?: IFontFace;
4 icons: {
5 [key: string]: string | JSX.Element;
6 };
7 style?: IRawStyle;
8 /**
9 * Indicates to the icon renderer that it is safe to merge any props on the original `Icon` element
10 * onto the child content element registered for the icon which are valid for HTML images.
11 */
12 mergeImageProps?: boolean;
13}
14export interface IIconSubsetRecord extends IIconSubset {
15 isRegistered?: boolean;
16 className?: string;
17}
18export interface IIconRecord {
19 code: string | undefined;
20 subset: IIconSubsetRecord;
21}
22export interface IIconOptions {
23 /**
24 * By default, registering the same set of icons will generate a console warning per duplicate icon
25 * registered, because this scenario can create unexpected consequences.
26 *
27 * Some scenarios include:
28 *
29 * Icon set was previously registered using a different base url.
30 * Icon set was previously registered but a different version was provided.
31 * Icons in a previous registered set overlap with a new set.
32 *
33 * To simply ignore previously registered icons, you can specify to disable warnings. This means
34 * that if an icon which was previous registered is registered again, it will be silently ignored.
35 * However, consider whether the problems listed above will cause issues.
36 **/
37 disableWarnings: boolean;
38 /**
39 * @deprecated
40 * Use 'disableWarnings' instead.
41 */
42 warnOnMissingIcons?: boolean;
43}
44export interface IIconRecords {
45 __options: IIconOptions;
46 __remapped: {
47 [key: string]: string;
48 };
49 [key: string]: IIconRecord | {};
50}
51/**
52 * Registers a given subset of icons.
53 *
54 * @param iconSubset - the icon subset definition.
55 */
56export declare function registerIcons(iconSubset: IIconSubset, options?: Partial<IIconOptions>): void;
57/**
58 * Unregisters icons by name.
59 *
60 * @param iconNames - List of icons to unregister.
61 */
62export declare function unregisterIcons(iconNames: string[]): void;
63/**
64 * Remaps one icon name to another.
65 */
66export declare function registerIconAlias(iconName: string, mappedToName: string): void;
67/**
68 * Gets an icon definition. If an icon is requested but the subset has yet to be registered,
69 * it will get registered immediately.
70 *
71 * @public
72 * @param name - Name of icon.
73 */
74export declare function getIcon(name?: string): IIconRecord | undefined;
75/**
76 * Sets the icon options.
77 *
78 * @public
79 */
80export declare function setIconOptions(options: Partial<IIconOptions>): void;