@public-ui/components
Version:
Contains all web components that belong to KoliBri - The accessible HTML-Standard.
26 lines (25 loc) • 842 B
JavaScript
/*!
* KoliBri - The accessible HTML-Standard
*/
import { createPropDefinition } from "./helpers/factory";
import { normalizeObject, normalizeString } from "./helpers/normalizers";
function normalizeSpanIcons(value) {
if (!value || (typeof value === 'string' && value === '')) {
return {};
}
if (typeof value === 'string') {
return normalizeString(value);
}
if (typeof value === 'object') {
return normalizeObject(value);
}
throw new Error(`Invalid icons: ${typeof value}`);
}
function validateSpanIcons(value) {
if (typeof value === 'string') {
return value.length > 0;
}
return typeof value === 'object' && value !== null;
}
export const spanIconsProp = createPropDefinition('icons', {}, normalizeSpanIcons, validateSpanIcons);
//# sourceMappingURL=span-icons.js.map