@utrecht/web-component-library-stencil
Version:
Stencil component library bundle for the Municipality of Utrecht based on the NL Design System architecture
59 lines (58 loc) • 1.8 kB
JavaScript
/**
* @license EUPL-1.2
* Copyright (c) 2020-2024 Frameless B.V.
* Copyright (c) 2021-2024 Gemeente Utrecht
*/
import { h } from "@stencil/core";
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 ');
export class IBANData {
constructor() {
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 is() { return "utrecht-iban-data"; }
static get encapsulation() { return "shadow"; }
static get originalStyleUrls() {
return {
"$": ["iban-data.scss"]
};
}
static get styleUrls() {
return {
"$": ["iban-data.css"]
};
}
static get properties() {
return {
"value": {
"type": "string",
"mutable": false,
"complexType": {
"original": "string",
"resolved": "string",
"references": {}
},
"required": false,
"optional": false,
"docs": {
"tags": [],
"text": ""
},
"attribute": "value",
"reflect": false
}
};
}
}
//# sourceMappingURL=iban-data.js.map