@workday/canvas-kit-react
Version:
The parent module that contains all Workday Canvas Kit React components
21 lines (20 loc) • 1.22 kB
JavaScript
import { jsx as _jsx } from "react/jsx-runtime";
import { createComponent } from '@workday/canvas-kit-react/common';
import { Avatar, avatarStencil } from '@workday/canvas-kit-react/avatar';
import { system } from '@workday/canvas-tokens-web';
import { createStencil } from '@workday/canvas-kit-styling';
import { mergeStyles } from '@workday/canvas-kit-react/layout';
export const expandableAvatarStencil = createStencil({
extends: avatarStencil,
base: { name: "3995dc", styles: "box-sizing:border-box;margin-inline-end:var(--cnvs-sys-space-x2);flex-shrink:0;" }
}, "expandable-avatar-d56832");
// When the component is created, it needs to be a button element to match AvatarProps.
// Once Avatar becomes a `createComponent` we can default the element type to a `div`
// and the types should be properly extracted
// Setting altText prop to a default empty string for decorative purposes
export const ExpandableAvatar = createComponent('div')({
displayName: 'Expandable.Avatar',
Component: ({ altText = '', ...elemProps }, ref, Element) => {
return (_jsx(Avatar, { as: Element, altText: altText, ref: ref, size: "medium", ...mergeStyles(elemProps, expandableAvatarStencil()) }));
},
});