@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.
43 lines (42 loc) • 2.06 kB
JavaScript
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Icon = void 0;
const React = __importStar(require("react"));
const icon_1 = require("@workday/canvas-kit-react/icon");
const common_1 = require("@workday/canvas-kit-react/common");
const canvas_system_icons_web_1 = require("@workday/canvas-system-icons-web");
const useInformationHighlightModel_1 = require("../hooks/useInformationHighlightModel");
const defaultIcons = {
informational: canvas_system_icons_web_1.infoIcon,
caution: canvas_system_icons_web_1.exclamationTriangleIcon,
critical: canvas_system_icons_web_1.exclamationCircleIcon,
};
exports.Icon = (0, common_1.createSubcomponent)('span')({
displayName: 'Icon',
modelHook: useInformationHighlightModel_1.useInformationHighlightModel,
})(({ icon, ...props }, Element, model) => {
return (React.createElement(icon_1.SystemIcon, { as: Element, icon: icon ? icon : defaultIcons[model.state.variant], "data-part": "information-highlight-icon", ...props }));
});
;