@public-ui/components
Version:
Contains all web components that belong to KoliBri - The accessible HTML-Standard.
38 lines (37 loc) • 1.21 kB
JavaScript
/*!
* KoliBri - The accessible HTML-Standard
*/
import { Fragment, h } from "@stencil/core";
import { translate } from "../../i18n";
import { IconFC } from "../../internal/functional-components/icon/component";
import { bem } from "../../schema/bem-registry";
const alertBem = bem.forBlock('kol-alert');
const BEM_CLASS_ALERT__ICON = alertBem('icon');
const ALERT_ICON_CONFIG = {
error: {
label: translate('kol-error'),
icon: 'kolicon-alert-error',
},
info: {
label: translate('kol-info'),
icon: 'kolicon-alert-info',
},
warning: {
label: translate('kol-warning'),
icon: 'kolicon-alert-warning',
},
success: {
label: translate('kol-success'),
icon: 'kolicon-alert-success',
},
default: {
label: translate('kol-message'),
icon: 'kolicon-alert-info',
},
};
const AlertIcon = ({ type = 'default' }) => {
const config = ALERT_ICON_CONFIG[type || 'default'];
return (h(Fragment, null, h("span", { class: "visually-hidden" }, config.label), h(IconFC, { class: BEM_CLASS_ALERT__ICON, label: "", icons: config.icon })));
};
export default AlertIcon;
//# sourceMappingURL=AlertIcon.js.map