UNPKG

@workday/canvas-kit-react

Version:

The parent module that contains all Workday Canvas Kit React components

20 lines (19 loc) 887 B
import { jsx as _jsx } from "react/jsx-runtime"; import { createComponent } from '@workday/canvas-kit-react/common'; import { SystemIcon } from '@workday/canvas-kit-react/icon'; import { px2rem } from '@workday/canvas-kit-styling'; const iconSizes = { extraSmall: 18, small: 20, medium: 20, large: 24, }; export const ButtonLabelIcon = createComponent('span')({ Component: ({ icon, size = 'medium', shouldMirrorIcon = false, shouldMirrorIconInRTL = false, ...elemProps }, ref, Element) => { if (icon === undefined) { return null; } const iconSize = iconSizes[size]; return (_jsx(SystemIcon, { ref: ref, as: Element, size: iconSize, icon: icon, width: px2rem(iconSize), height: px2rem(iconSize), display: "inline-block", shouldMirror: shouldMirrorIcon, shouldMirrorInRTL: shouldMirrorIconInRTL, ...elemProps })); }, });