@fluentui/react-northstar
Version:
A themable React component library.
79 lines (78 loc) • 2.63 kB
JavaScript
import _extends from "@babel/runtime/helpers/esm/extends";
import { getElementType, getUnhandledProps, useStyles, useFluentContext, useTelemetry } from '@fluentui/react-bindings';
import { svgIconClassName, svgIconDisplayName, svgIconHandledProps } from '@fluentui/react-icons-northstar';
import { callable } from '@fluentui/styles';
import * as React from 'react';
/**
* An SvgIcon displays a pictogram with semantic meaning.
*/
export var SvgIcon = /*#__PURE__*/function () {
var SvgIcon = function SvgIcon(props) {
var context = useFluentContext();
var _useTelemetry = useTelemetry(SvgIcon.displayName, context.telemetry),
setStart = _useTelemetry.setStart,
setEnd = _useTelemetry.setEnd;
setStart();
var alt = props.alt,
ariaLabel = props['aria-label'],
bordered = props.bordered,
circular = props.circular,
className = props.className,
design = props.design,
disabled = props.disabled,
children = props.children,
outline = props.outline,
rotate = props.rotate,
size = props.size,
styles = props.styles,
variables = props.variables,
xSpacing = props.xSpacing;
var _useStyles = useStyles(SvgIcon.displayName, {
className: svgIconClassName,
mapPropsToStyles: function mapPropsToStyles() {
return {
bordered: bordered,
circular: circular,
disabled: disabled,
outline: outline,
rotate: rotate,
size: size,
xSpacing: xSpacing
};
},
mapPropsToInlineStyles: function mapPropsToInlineStyles() {
return {
className: className,
design: design,
styles: styles,
variables: variables
};
},
rtl: context.rtl
}),
classes = _useStyles.classes;
var ElementType = getElementType(props);
var unhandledProps = getUnhandledProps(SvgIcon.handledProps, props);
var element = /*#__PURE__*/React.createElement(ElementType, _extends({
role: "img",
"aria-hidden": alt || ariaLabel ? undefined : 'true',
"aria-label": ariaLabel,
className: classes.root
}, unhandledProps), callable(children)({
classes: classes,
rtl: context.rtl,
props: props
}));
setEnd();
return element;
};
SvgIcon.displayName = svgIconDisplayName;
SvgIcon.handledProps = [].concat(svgIconHandledProps, ['children']);
SvgIcon.defaultProps = {
as: 'span',
size: 'medium',
rotate: 0
};
return SvgIcon;
}();
//# sourceMappingURL=SvgIcon.js.map