@utrecht/web-component-library-stencil
Version:
Stencil component library bundle for the Municipality of Utrecht based on the NL Design System architecture
49 lines (44 loc) • 1.82 kB
JavaScript
import { p as proxyCustomElement, H, h } from './p-2f0ff193.js';
const ibanDataCss = ".utrecht-iban-data{font-variant-numeric:lining-nums slashed-zero tabular-nums;white-space:nowrap}:host{display:inline}:host([hidden]){display:none !important}";
const UtrechtIbanDataStyle0 = ibanDataCss;
const normalizeIBAN = (iban) => iban
// Remove whitespace and word separator characters such as the dash
.replace(/[\s+\W]+/g, '')
.toUpperCase();
const formatIBAN = (normalizedIBAN) => normalizedIBAN
// Add a space after every four characters, except at the end
.replace(/(.{4})(?!$)/g, '$1 ');
const IBANData = /*@__PURE__*/ proxyCustomElement(class IBANData extends H {
constructor() {
super();
this.__registerHost();
this.__attachShadow();
this.value = undefined;
}
render() {
const { value } = this;
const normalized = normalizeIBAN(value);
const formatted = formatIBAN(normalized);
return (h("data", { key: '7afcd2cfcf5acdf693b8f134a68d48803ae52eb7', class: "utrecht-iban-data", value: normalized, translate: "no" }, formatted));
}
static get style() { return UtrechtIbanDataStyle0; }
}, [1, "utrecht-iban-data", {
"value": [1]
}]);
function defineCustomElement$1() {
if (typeof customElements === "undefined") {
return;
}
const components = ["utrecht-iban-data"];
components.forEach(tagName => { switch (tagName) {
case "utrecht-iban-data":
if (!customElements.get(tagName)) {
customElements.define(tagName, IBANData);
}
break;
} });
}
const UtrechtIbanData = IBANData;
const defineCustomElement = defineCustomElement$1;
export { UtrechtIbanData, defineCustomElement };
//# sourceMappingURL=utrecht-iban-data.js.map