first commit

This commit is contained in:
Stefan Hacker
2026-04-03 09:38:48 +02:00
commit 37ad745546
47450 changed files with 3120798 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
import * as React from 'react';
import type { IFontIconProps } from './Icon.types';
import type { JSXElement } from '@fluentui/utilities';
export interface IIconContent {
children?: string | JSXElement;
iconClassName?: string;
fontFamily?: string;
mergeImageProps?: boolean;
}
export declare const getIconContent: (iconName?: string) => IIconContent | null;
/**
* Fast icon component which only supports font glyphs (not images) and can't be targeted by customizations.
* To style the icon, use `className` or reference `ms-Icon` in CSS.
* {@docCategory Icon}
*/
export declare const FontIcon: React.FunctionComponent<IFontIconProps>;
/**
* Memoized helper for rendering a FontIcon.
* @param iconName - The name of the icon to use from the icon font.
* @param className - Class name for styling the icon.
* @param ariaLabel - Label for the icon for the benefit of screen readers.
* {@docCategory Icon}
*/
export declare const getFontIcon: (iconName: string, className?: string, ariaLabel?: string) => React.ReactNode;
+65
View File
@@ -0,0 +1,65 @@
import { __assign } from "tslib";
import * as React from 'react';
import { classNames, MS_ICON } from './Icon.styles';
import { css, getNativeProps, htmlElementProperties, memoizeFunction } from '../../Utilities';
import { getIcon } from '../../Styling';
export var getIconContent = memoizeFunction(function (iconName) {
var _a = getIcon(iconName) || {
subset: {},
code: undefined,
}, code = _a.code, subset = _a.subset;
if (!code) {
return null;
}
return {
children: code,
iconClassName: subset.className,
fontFamily: subset.fontFace && subset.fontFace.fontFamily,
mergeImageProps: subset.mergeImageProps,
};
}, undefined, true /*ignoreNullOrUndefinedResult */);
/**
* Fast icon component which only supports font glyphs (not images) and can't be targeted by customizations.
* To style the icon, use `className` or reference `ms-Icon` in CSS.
* {@docCategory Icon}
*/
export var FontIcon = function (props) {
var iconName = props.iconName, className = props.className, _a = props.style, style = _a === void 0 ? {} : _a;
var iconContent = getIconContent(iconName) || {};
var iconClassName = iconContent.iconClassName, children = iconContent.children, fontFamily = iconContent.fontFamily, mergeImageProps = iconContent.mergeImageProps;
var nativeProps = getNativeProps(props, htmlElementProperties);
var accessibleName = props['aria-label'] || props.title;
var containerProps = props['aria-label'] || props['aria-labelledby'] || props.title
? {
role: mergeImageProps ? undefined : 'img',
}
: {
'aria-hidden': true,
};
var finalChildren = children;
if (mergeImageProps) {
if (typeof children === 'object' && typeof children.props === 'object' && accessibleName) {
finalChildren = React.cloneElement(children, { alt: accessibleName });
}
}
return (React.createElement("i", __assign({ "data-icon-name": iconName }, containerProps, nativeProps, (mergeImageProps
? {
title: undefined,
'aria-label': undefined,
}
: {}), { className: css(MS_ICON, classNames.root, iconClassName, !iconName && classNames.placeholder, className),
// Apply the font family this way to ensure it doesn't get overridden by Fabric Core ms-Icon styles
// https://github.com/microsoft/fluentui/issues/10449
style: __assign({ fontFamily: fontFamily }, style) }), finalChildren));
};
/**
* Memoized helper for rendering a FontIcon.
* @param iconName - The name of the icon to use from the icon font.
* @param className - Class name for styling the icon.
* @param ariaLabel - Label for the icon for the benefit of screen readers.
* {@docCategory Icon}
*/
export var getFontIcon = memoizeFunction(function (iconName, className, ariaLabel) {
return FontIcon({ iconName: iconName, className: className, 'aria-label': ariaLabel });
});
//# sourceMappingURL=FontIcon.js.map
File diff suppressed because one or more lines are too long
+11
View File
@@ -0,0 +1,11 @@
import * as React from 'react';
import type { IIconProps } from './Icon.types';
import type { JSXElement } from '@fluentui/utilities';
export interface IIconState {
imageLoadError: boolean;
}
export declare class IconBase extends React.Component<IIconProps, IIconState> {
constructor(props: IIconProps);
render(): JSXElement;
private _onImageLoadingStateChange;
}
+84
View File
@@ -0,0 +1,84 @@
import { __assign, __extends } from "tslib";
import * as React from 'react';
import { IconType } from './Icon.types';
import { Image } from '../Image/Image';
import { ImageLoadState } from '../Image/Image.types';
import { getNativeProps, htmlElementProperties, classNamesFunction } from '../../Utilities';
import { getIconContent } from './FontIcon';
var getClassNames = classNamesFunction({
// Icon is used a lot by other components.
// It's likely to see expected cases which pass different className to the Icon.
// Therefore setting a larger cache size.
cacheSize: 100,
});
var IconBase = /** @class */ (function (_super) {
__extends(IconBase, _super);
function IconBase(props) {
var _this = _super.call(this, props) || this;
_this._onImageLoadingStateChange = function (state) {
if (_this.props.imageProps && _this.props.imageProps.onLoadingStateChange) {
_this.props.imageProps.onLoadingStateChange(state);
}
if (state === ImageLoadState.error) {
_this.setState({ imageLoadError: true });
}
};
_this.state = {
imageLoadError: false,
};
return _this;
}
IconBase.prototype.render = function () {
var _a = this.props, children = _a.children, className = _a.className, styles = _a.styles, iconName = _a.iconName, imageErrorAs = _a.imageErrorAs, theme = _a.theme;
var isPlaceholder = typeof iconName === 'string' && iconName.length === 0;
var isImage =
// eslint-disable-next-line @typescript-eslint/no-deprecated
!!this.props.imageProps || this.props.iconType === IconType.image || this.props.iconType === IconType.Image;
var iconContent = getIconContent(iconName) || {};
var iconClassName = iconContent.iconClassName, iconContentChildren = iconContent.children, mergeImageProps = iconContent.mergeImageProps;
var classNames = getClassNames(styles, {
theme: theme,
className: className,
iconClassName: iconClassName,
isImage: isImage,
isPlaceholder: isPlaceholder,
});
var RootType = isImage ? 'span' : 'i';
var nativeProps = getNativeProps(this.props, htmlElementProperties, [
'aria-label',
]);
var imageLoadError = this.state.imageLoadError;
var imageProps = __assign(__assign({}, this.props.imageProps), { onLoadingStateChange: this._onImageLoadingStateChange });
var ImageType = (imageLoadError && imageErrorAs) || Image;
// eslint-disable-next-line @typescript-eslint/no-deprecated
var ariaLabel = this.props['aria-label'] || this.props.ariaLabel;
var accessibleName = imageProps.alt || ariaLabel || this.props.title;
var hasName = !!(accessibleName ||
this.props['aria-labelledby'] ||
imageProps['aria-label'] ||
imageProps['aria-labelledby']);
var containerProps = hasName
? {
role: isImage || mergeImageProps ? undefined : 'img',
'aria-label': isImage || mergeImageProps ? undefined : accessibleName,
}
: {
'aria-hidden': true,
};
var finalIconContentChildren = iconContentChildren;
if (mergeImageProps && iconContentChildren && typeof iconContentChildren === 'object' && accessibleName) {
finalIconContentChildren = React.cloneElement(iconContentChildren, {
alt: accessibleName,
});
}
return (React.createElement(RootType, __assign({ "data-icon-name": iconName }, containerProps, nativeProps, (mergeImageProps
? {
title: undefined,
'aria-label': undefined,
}
: {}), { className: classNames.root }), isImage ? React.createElement(ImageType, __assign({}, imageProps)) : children || finalIconContentChildren));
};
return IconBase;
}(React.Component));
export { IconBase };
//# sourceMappingURL=Icon.base.js.map
File diff suppressed because one or more lines are too long
+8
View File
@@ -0,0 +1,8 @@
import * as React from 'react';
import type { IIconProps } from './Icon.types';
/**
* Legacy Icon component which can be targeted by customization. It's recommended to use `FontIcon`
* or `ImageIcon` instead, especially in scenarios where rendering performance is important.
* {@docCategory Icon}
*/
export declare const Icon: React.FunctionComponent<IIconProps>;
+13
View File
@@ -0,0 +1,13 @@
import { styled } from '../../Utilities';
import { IconBase } from './Icon.base';
import { getStyles } from './Icon.styles';
/**
* Legacy Icon component which can be targeted by customization. It's recommended to use `FontIcon`
* or `ImageIcon` instead, especially in scenarios where rendering performance is important.
* {@docCategory Icon}
*/
export var Icon = styled(IconBase, getStyles, undefined, {
scope: 'Icon',
}, true);
Icon.displayName = 'Icon';
//# sourceMappingURL=Icon.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"Icon.js","sourceRoot":"../src/","sources":["components/Icon/Icon.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAG1C;;;;GAIG;AACH,MAAM,CAAC,IAAM,IAAI,GAAwC,MAAM,CAC7D,QAAQ,EACR,SAAS,EACT,SAAS,EACT;IACE,KAAK,EAAE,MAAM;CACd,EACD,IAAI,CACL,CAAC;AACF,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC","sourcesContent":["import * as React from 'react';\nimport { styled } from '../../Utilities';\nimport { IconBase } from './Icon.base';\nimport { getStyles } from './Icon.styles';\nimport type { IIconProps, IIconStyleProps, IIconStyles } from './Icon.types';\n\n/**\n * Legacy Icon component which can be targeted by customization. It's recommended to use `FontIcon`\n * or `ImageIcon` instead, especially in scenarios where rendering performance is important.\n * {@docCategory Icon}\n */\nexport const Icon: React.FunctionComponent<IIconProps> = styled<IIconProps, IIconStyleProps, IIconStyles>(\n IconBase,\n getStyles,\n undefined,\n {\n scope: 'Icon',\n },\n true,\n);\nIcon.displayName = 'Icon';\n"]}
+17
View File
@@ -0,0 +1,17 @@
import type { IIconStyleProps, IIconStyles } from './Icon.types';
/** Class names used in themeable and non-themeable Icon components */
export declare const classNames: import("@fluentui/merge-styles/lib/IStyleSet").IProcessedStyleSet<{
root: {
display: string;
textDecoration: string;
};
placeholder: (string | {
width: string;
})[];
image: (string | {
overflow: string;
})[];
}>;
/** Class name used only in non-themeable Icon components */
export declare const MS_ICON = "ms-Icon";
export declare const getStyles: (props: IIconStyleProps) => IIconStyles;
+38
View File
@@ -0,0 +1,38 @@
import { mergeStyleSets } from '../../Styling';
/** Class names used in themeable and non-themeable Icon components */
export var classNames = mergeStyleSets({
root: {
display: 'inline-block',
textDecoration: 'inherit',
},
placeholder: [
'ms-Icon-placeHolder',
{
width: '1em',
},
],
image: [
'ms-Icon-imageContainer',
{
overflow: 'hidden',
},
],
});
/** Class name used only in non-themeable Icon components */
export var MS_ICON = 'ms-Icon';
export var getStyles = function (props) {
var className = props.className, iconClassName = props.iconClassName, isPlaceholder = props.isPlaceholder, isImage = props.isImage, styles = props.styles;
return {
root: [
isPlaceholder && classNames.placeholder,
classNames.root,
isImage && classNames.image,
iconClassName,
className,
styles && styles.root,
// eslint-disable-next-line @typescript-eslint/no-deprecated
styles && styles.imageContainer,
],
};
};
//# sourceMappingURL=Icon.styles.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"Icon.styles.js","sourceRoot":"../src/","sources":["components/Icon/Icon.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAG/C,sEAAsE;AACtE,MAAM,CAAC,IAAM,UAAU,GAAG,cAAc,CAAC;IACvC,IAAI,EAAE;QACJ,OAAO,EAAE,cAAc;QACvB,cAAc,EAAE,SAAS;KAC1B;IACD,WAAW,EAAE;QACX,qBAAqB;QACrB;YACE,KAAK,EAAE,KAAK;SACb;KACF;IACD,KAAK,EAAE;QACL,wBAAwB;QACxB;YACE,QAAQ,EAAE,QAAQ;SACnB;KACF;CACF,CAAC,CAAC;AACH,4DAA4D;AAC5D,MAAM,CAAC,IAAM,OAAO,GAAG,SAAS,CAAC;AAEjC,MAAM,CAAC,IAAM,SAAS,GAAG,UAAC,KAAsB;IACtC,IAAA,SAAS,GAAoD,KAAK,UAAzD,EAAE,aAAa,GAAqC,KAAK,cAA1C,EAAE,aAAa,GAAsB,KAAK,cAA3B,EAAE,OAAO,GAAa,KAAK,QAAlB,EAAE,MAAM,GAAK,KAAK,OAAV,CAAW;IAE3E,OAAO;QACL,IAAI,EAAE;YACJ,aAAa,IAAI,UAAU,CAAC,WAAW;YACvC,UAAU,CAAC,IAAI;YACf,OAAO,IAAI,UAAU,CAAC,KAAK;YAC3B,aAAa;YACb,SAAS;YACT,MAAM,IAAI,MAAM,CAAC,IAAI;YACrB,4DAA4D;YAC5D,MAAM,IAAI,MAAM,CAAC,cAAc;SAChC;KACF,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { mergeStyleSets } from '../../Styling';\nimport type { IIconStyleProps, IIconStyles } from './Icon.types';\n\n/** Class names used in themeable and non-themeable Icon components */\nexport const classNames = mergeStyleSets({\n root: {\n display: 'inline-block',\n textDecoration: 'inherit',\n },\n placeholder: [\n 'ms-Icon-placeHolder',\n {\n width: '1em',\n },\n ],\n image: [\n 'ms-Icon-imageContainer',\n {\n overflow: 'hidden',\n },\n ],\n});\n/** Class name used only in non-themeable Icon components */\nexport const MS_ICON = 'ms-Icon';\n\nexport const getStyles = (props: IIconStyleProps): IIconStyles => {\n const { className, iconClassName, isPlaceholder, isImage, styles } = props;\n\n return {\n root: [\n isPlaceholder && classNames.placeholder,\n classNames.root,\n isImage && classNames.image,\n iconClassName,\n className,\n styles && styles.root,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n styles && styles.imageContainer,\n ],\n };\n};\n"]}
+112
View File
@@ -0,0 +1,112 @@
import * as React from 'react';
import type { IImageProps } from '../Image/Image.types';
import type { IStyle, ITheme } from '../../Styling';
import type { IBaseProps, IStyleFunctionOrObject } from '../../Utilities';
/**
* @deprecated Icon type is inferred based on presence of `IIconProps.imageProps`
* {@docCategory Icon}
*/
export declare enum IconType {
/**
* Render using the fabric icon font.
* @deprecated Icon type is inferred based on presence of `IIconProps.imageProps`
*/
default = 0,
/**
* Render using an image, where imageProps would be used.
* @deprecated Icon type is inferred based on presence of `IIconProps.imageProps`
*/
image = 1,
/**
* @deprecated Icon type is inferred based on presence of `IIconProps.imageProps`
*/
Default = 100000,
/**
* @deprecated Icon type is inferred based on presence of `IIconProps.imageProps`
*/
Image = 100001
}
/**
* {@docCategory Icon}
*/
export interface IIconProps extends IBaseProps, React.HTMLAttributes<HTMLElement> {
/**
* The name of the icon to use from the icon font.
* If string is empty, a placeholder icon will be rendered the same width as an icon.
*/
iconName?: string;
/**
* The aria label of the icon for the benefit of screen readers.
* @deprecated Use the native prop `aria-label`
*/
ariaLabel?: string;
/**
* The type of icon to render (image or icon font).
* @deprecated Inferred based on the presence of `imageProps`
*/
iconType?: IconType;
/**
* If rendering an image icon, these props will be passed to the Image component.
*/
imageProps?: IImageProps;
/**
* If rendering an image icon, this component will be rendered in the event that loading the image fails.
*/
imageErrorAs?: React.ComponentType<IImageProps>;
/**
* Gets the styles for an Icon.
*/
styles?: IStyleFunctionOrObject<IIconStyleProps, IIconStyles>;
theme?: ITheme;
}
/**
* {@docCategory Icon}
*/
export interface IIconStyleProps {
className?: string;
iconClassName?: string;
isPlaceholder: boolean;
isImage: boolean;
styles?: Partial<IIconStyles>;
theme?: ITheme;
}
/**
* {@docCategory Icon}
*/
export interface IIconStyles {
root?: IStyle;
/**
* @deprecated Use `root`.
*/
imageContainer?: IStyle;
}
/**
* Props for a basic icon component which only supports font glyphs and can't be targeted by customizations.
* {@docCategory Icon}
*/
export interface IFontIconProps extends React.HTMLAttributes<HTMLElement> {
/**
* The name of the icon to use from the icon font.
* If string is empty, a placeholder icon will be rendered the same width as an icon.
*/
iconName?: string;
/**
* Custom class to style the icon.
*/
className?: string;
}
/**
* Props for a basic image icon component which doesn't directly provide image load error handling
* and can't be targeted by customizations.
* {@docCategory Icon}
*/
export interface IImageIconProps extends React.HTMLAttributes<HTMLElement> {
/**
* Props passed to the Image component.
*/
imageProps: IImageProps;
/**
* Custom class to style the icon.
*/
className?: string;
}
+26
View File
@@ -0,0 +1,26 @@
/**
* @deprecated Icon type is inferred based on presence of `IIconProps.imageProps`
* {@docCategory Icon}
*/
export var IconType;
(function (IconType) {
/**
* Render using the fabric icon font.
* @deprecated Icon type is inferred based on presence of `IIconProps.imageProps`
*/
IconType[IconType["default"] = 0] = "default";
/**
* Render using an image, where imageProps would be used.
* @deprecated Icon type is inferred based on presence of `IIconProps.imageProps`
*/
IconType[IconType["image"] = 1] = "image";
/**
* @deprecated Icon type is inferred based on presence of `IIconProps.imageProps`
*/
IconType[IconType["Default"] = 100000] = "Default";
/**
* @deprecated Icon type is inferred based on presence of `IIconProps.imageProps`
*/
IconType[IconType["Image"] = 100001] = "Image";
})(IconType || (IconType = {}));
//# sourceMappingURL=Icon.types.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"Icon.types.js","sourceRoot":"../src/","sources":["components/Icon/Icon.types.ts"],"names":[],"mappings":"AAKA;;;GAGG;AACH,MAAM,CAAN,IAAY,QAsBX;AAtBD,WAAY,QAAQ;IAClB;;;OAGG;IACH,6CAAW,CAAA;IAEX;;;OAGG;IACH,yCAAS,CAAA;IAET;;OAEG;IACH,kDAAgB,CAAA;IAEhB;;OAEG;IACH,8CAAc,CAAA;AAChB,CAAC,EAtBW,QAAQ,KAAR,QAAQ,QAsBnB","sourcesContent":["import * as React from 'react';\nimport type { IImageProps } from '../Image/Image.types';\nimport type { IStyle, ITheme } from '../../Styling';\nimport type { IBaseProps, IStyleFunctionOrObject } from '../../Utilities';\n\n/**\n * @deprecated Icon type is inferred based on presence of `IIconProps.imageProps`\n * {@docCategory Icon}\n */\nexport enum IconType {\n /**\n * Render using the fabric icon font.\n * @deprecated Icon type is inferred based on presence of `IIconProps.imageProps`\n */\n default = 0,\n\n /**\n * Render using an image, where imageProps would be used.\n * @deprecated Icon type is inferred based on presence of `IIconProps.imageProps`\n */\n image = 1,\n\n /**\n * @deprecated Icon type is inferred based on presence of `IIconProps.imageProps`\n */\n Default = 100000,\n\n /**\n * @deprecated Icon type is inferred based on presence of `IIconProps.imageProps`\n */\n Image = 100001,\n}\n\n/**\n * {@docCategory Icon}\n */\nexport interface IIconProps extends IBaseProps, React.HTMLAttributes<HTMLElement> {\n /**\n * The name of the icon to use from the icon font.\n * If string is empty, a placeholder icon will be rendered the same width as an icon.\n */\n iconName?: string;\n\n /**\n * The aria label of the icon for the benefit of screen readers.\n * @deprecated Use the native prop `aria-label`\n */\n ariaLabel?: string;\n\n /**\n * The type of icon to render (image or icon font).\n * @deprecated Inferred based on the presence of `imageProps`\n */\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n iconType?: IconType;\n\n /**\n * If rendering an image icon, these props will be passed to the Image component.\n */\n imageProps?: IImageProps;\n\n /**\n * If rendering an image icon, this component will be rendered in the event that loading the image fails.\n */\n imageErrorAs?: React.ComponentType<IImageProps>;\n\n /**\n * Gets the styles for an Icon.\n */\n styles?: IStyleFunctionOrObject<IIconStyleProps, IIconStyles>;\n theme?: ITheme;\n}\n\n/**\n * {@docCategory Icon}\n */\nexport interface IIconStyleProps {\n className?: string;\n iconClassName?: string;\n isPlaceholder: boolean;\n isImage: boolean;\n styles?: Partial<IIconStyles>;\n theme?: ITheme;\n}\n\n/**\n * {@docCategory Icon}\n */\nexport interface IIconStyles {\n root?: IStyle;\n\n /**\n * @deprecated Use `root`.\n */\n imageContainer?: IStyle;\n}\n\n/**\n * Props for a basic icon component which only supports font glyphs and can't be targeted by customizations.\n * {@docCategory Icon}\n */\nexport interface IFontIconProps extends React.HTMLAttributes<HTMLElement> {\n /**\n * The name of the icon to use from the icon font.\n * If string is empty, a placeholder icon will be rendered the same width as an icon.\n */\n iconName?: string;\n\n /**\n * Custom class to style the icon.\n */\n className?: string;\n}\n\n/**\n * Props for a basic image icon component which doesn't directly provide image load error handling\n * and can't be targeted by customizations.\n * {@docCategory Icon}\n */\nexport interface IImageIconProps extends React.HTMLAttributes<HTMLElement> {\n /**\n * Props passed to the Image component.\n */\n imageProps: IImageProps;\n\n /**\n * Custom class to style the icon.\n */\n className?: string;\n}\n"]}
+8
View File
@@ -0,0 +1,8 @@
import * as React from 'react';
import type { IImageIconProps } from './Icon.types';
/**
* Fast icon component which only supports images (not font glyphs) and can't be targeted by customizations.
* To style the icon, use `className` or reference `ms-Icon` in CSS.
* {@docCategory Icon}
*/
export declare const ImageIcon: React.FunctionComponent<IImageIconProps>;
+40
View File
@@ -0,0 +1,40 @@
import { __assign } from "tslib";
import * as React from 'react';
import { Image } from '../Image/Image';
import { css, getNativeProps, htmlElementProperties } from '../../Utilities';
import { classNames, MS_ICON } from './Icon.styles';
/**
* Fast icon component which only supports images (not font glyphs) and can't be targeted by customizations.
* To style the icon, use `className` or reference `ms-Icon` in CSS.
* {@docCategory Icon}
*/
export var ImageIcon = function (props) {
var className = props.className, imageProps = props.imageProps;
var nativeProps = getNativeProps(props, htmlElementProperties, [
'aria-label',
'aria-labelledby',
'title',
'aria-describedby',
]);
var altText = imageProps.alt || props['aria-label'];
var hasName = altText ||
props['aria-labelledby'] ||
props.title ||
imageProps['aria-label'] ||
imageProps['aria-labelledby'] ||
imageProps.title;
// move naming or describing attributes from the container (where they are invalid) to the image
var imageNameProps = {
'aria-labelledby': props['aria-labelledby'],
'aria-describedby': props['aria-describedby'],
title: props.title,
};
var containerProps = hasName
? {}
: {
'aria-hidden': true,
};
return (React.createElement("div", __assign({}, containerProps, nativeProps, { className: css(MS_ICON, classNames.root, classNames.image, className) }),
React.createElement(Image, __assign({}, imageNameProps, imageProps, { alt: hasName ? altText : '' }))));
};
//# sourceMappingURL=ImageIcon.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"ImageIcon.js","sourceRoot":"../src/","sources":["components/Icon/ImageIcon.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,GAAG,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAC7E,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAGpD;;;;GAIG;AACH,MAAM,CAAC,IAAM,SAAS,GAA6C,UAAA,KAAK;IAC9D,IAAA,SAAS,GAAiB,KAAK,UAAtB,EAAE,UAAU,GAAK,KAAK,WAAV,CAAW;IAExC,IAAM,WAAW,GAAG,cAAc,CAAuC,KAAK,EAAE,qBAAqB,EAAE;QACrG,YAAY;QACZ,iBAAiB;QACjB,OAAO;QACP,kBAAkB;KACnB,CAAC,CAAC;IACH,IAAM,OAAO,GAAG,UAAU,CAAC,GAAG,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC;IACtD,IAAM,OAAO,GACX,OAAO;QACP,KAAK,CAAC,iBAAiB,CAAC;QACxB,KAAK,CAAC,KAAK;QACX,UAAU,CAAC,YAAY,CAAC;QACxB,UAAU,CAAC,iBAAiB,CAAC;QAC7B,UAAU,CAAC,KAAK,CAAC;IAEnB,gGAAgG;IAChG,IAAM,cAAc,GAAG;QACrB,iBAAiB,EAAE,KAAK,CAAC,iBAAiB,CAAC;QAC3C,kBAAkB,EAAE,KAAK,CAAC,kBAAkB,CAAC;QAC7C,KAAK,EAAE,KAAK,CAAC,KAAK;KACnB,CAAC;IAEF,IAAM,cAAc,GAAG,OAAO;QAC5B,CAAC,CAAC,EAAE;QACJ,CAAC,CAAC;YACE,aAAa,EAAE,IAAI;SACpB,CAAC;IAEN,OAAO,CACL,wCAAS,cAAc,EAAM,WAAW,IAAE,SAAS,EAAE,GAAG,CAAC,OAAO,EAAE,UAAU,CAAC,IAAI,EAAE,UAAU,CAAC,KAAK,EAAE,SAAS,CAAC;QAC7G,oBAAC,KAAK,eAAK,cAAc,EAAM,UAAU,IAAE,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,IAAI,CACtE,CACP,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import * as React from 'react';\nimport { Image } from '../Image/Image';\nimport { css, getNativeProps, htmlElementProperties } from '../../Utilities';\nimport { classNames, MS_ICON } from './Icon.styles';\nimport type { IImageIconProps } from './Icon.types';\n\n/**\n * Fast icon component which only supports images (not font glyphs) and can't be targeted by customizations.\n * To style the icon, use `className` or reference `ms-Icon` in CSS.\n * {@docCategory Icon}\n */\nexport const ImageIcon: React.FunctionComponent<IImageIconProps> = props => {\n const { className, imageProps } = props;\n\n const nativeProps = getNativeProps<React.HTMLAttributes<HTMLDivElement>>(props, htmlElementProperties, [\n 'aria-label',\n 'aria-labelledby',\n 'title',\n 'aria-describedby',\n ]);\n const altText = imageProps.alt || props['aria-label'];\n const hasName =\n altText ||\n props['aria-labelledby'] ||\n props.title ||\n imageProps['aria-label'] ||\n imageProps['aria-labelledby'] ||\n imageProps.title;\n\n // move naming or describing attributes from the container (where they are invalid) to the image\n const imageNameProps = {\n 'aria-labelledby': props['aria-labelledby'],\n 'aria-describedby': props['aria-describedby'],\n title: props.title,\n };\n\n const containerProps = hasName\n ? {}\n : {\n 'aria-hidden': true,\n };\n\n return (\n <div {...containerProps} {...nativeProps} className={css(MS_ICON, classNames.root, classNames.image, className)}>\n <Image {...imageNameProps} {...imageProps} alt={hasName ? altText : ''} />\n </div>\n );\n};\n"]}
+5
View File
@@ -0,0 +1,5 @@
export * from './Icon';
export * from './Icon.base';
export * from './Icon.types';
export * from './FontIcon';
export * from './ImageIcon';
+6
View File
@@ -0,0 +1,6 @@
export * from './Icon';
export * from './Icon.base';
export * from './Icon.types';
export * from './FontIcon';
export * from './ImageIcon';
//# sourceMappingURL=index.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"../src/","sources":["components/Icon/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC","sourcesContent":["export * from './Icon';\nexport * from './Icon.base';\nexport * from './Icon.types';\nexport * from './FontIcon';\nexport * from './ImageIcon';\n"]}