@workday/canvas-kit-preview-react
Version:
Canvas Kit Preview is made up of components that have the full design and a11y review, are part of the DS ecosystem and are approved for use in product. The API's could be subject to change, but not without strong communication and migration strategies.
20 lines (19 loc) • 1.12 kB
JavaScript
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.PillAvatar = void 0;
const react_1 = __importDefault(require("react"));
const common_1 = require("@workday/canvas-kit-react/common");
const avatar_1 = require("@workday/canvas-kit-react/avatar");
const usePillModel_1 = require("./usePillModel");
const canvas_kit_styling_1 = require("@workday/canvas-kit-styling");
// 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
exports.PillAvatar = (0, common_1.createSubcomponent)('div')({
modelHook: usePillModel_1.usePillModel,
})(({ ...elemProps }, Element, model) => {
return (react_1.default.createElement(avatar_1.Avatar, { style: { opacity: model.state.disabled ? '.7' : '1' }, size: (0, canvas_kit_styling_1.px2rem)(18), as: Element, altText: undefined, ...elemProps }));
});
;