@workday/canvas-kit-react
Version:
The parent module that contains all Workday Canvas Kit React components
23 lines (22 loc) • 1.09 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ButtonLabelIcon = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
const common_1 = require("@workday/canvas-kit-react/common");
const icon_1 = require("@workday/canvas-kit-react/icon");
const canvas_kit_styling_1 = require("@workday/canvas-kit-styling");
const iconSizes = {
extraSmall: 18,
small: 20,
medium: 20,
large: 24,
};
exports.ButtonLabelIcon = (0, common_1.createComponent)('span')({
Component: ({ icon, size = 'medium', shouldMirrorIcon = false, shouldMirrorIconInRTL = false, ...elemProps }, ref, Element) => {
if (icon === undefined) {
return null;
}
const iconSize = iconSizes[size];
return ((0, jsx_runtime_1.jsx)(icon_1.SystemIcon, { ref: ref, as: Element, size: iconSize, icon: icon, width: (0, canvas_kit_styling_1.px2rem)(iconSize), height: (0, canvas_kit_styling_1.px2rem)(iconSize), display: "inline-block", shouldMirror: shouldMirrorIcon, shouldMirrorInRTL: shouldMirrorIconInRTL, ...elemProps }));
},
});