@felleslosninger/minid-elements 0.0.138 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +69 -4
- package/dist/components/alert.component.d.ts +6 -4
- package/dist/components/alert.component.d.ts.map +1 -1
- package/dist/components/alert.js +33 -61
- package/dist/components/alert.js.map +1 -1
- package/dist/components/button.component.d.ts +1 -1
- package/dist/components/checkbox.component.d.ts +1 -2
- package/dist/components/checkbox.component.d.ts.map +1 -1
- package/dist/components/checkbox.js +25 -55
- package/dist/components/checkbox.js.map +1 -1
- package/dist/components/code-input-old.component.d.ts +1 -1
- package/dist/components/code-input-old.js +1 -1
- package/dist/components/code-input.component.d.ts +2 -1
- package/dist/components/code-input.component.d.ts.map +1 -1
- package/dist/components/code-input.js +247 -98
- package/dist/components/code-input.js.map +1 -1
- package/dist/components/combobox.component.d.ts +1 -1
- package/dist/components/countdown.component.d.ts +1 -1
- package/dist/components/dialog.component.d.ts +1 -1
- package/dist/components/dropdown.component.d.ts +1 -1
- package/dist/components/heading.component.d.ts +1 -1
- package/dist/components/heading.component.d.ts.map +1 -1
- package/dist/components/heading.js +1 -11
- package/dist/components/heading.js.map +1 -1
- package/dist/components/helptext.component.d.ts +1 -1
- package/dist/components/icon/icon.component.d.ts +1 -0
- package/dist/components/icon/icon.component.d.ts.map +1 -1
- package/dist/components/icon/icon.js +13 -9
- package/dist/components/icon/icon.js.map +1 -1
- package/dist/components/label.component.d.ts +1 -1
- package/dist/components/label.component.d.ts.map +1 -1
- package/dist/components/label.js +3 -12
- package/dist/components/label.js.map +1 -1
- package/dist/components/link.component.d.ts +1 -1
- package/dist/components/link.js +1 -1
- package/dist/components/link.js.map +1 -1
- package/dist/components/menu-item.component.d.ts +1 -1
- package/dist/components/menu.component.d.ts +1 -1
- package/dist/components/paragraph.component.d.ts +1 -1
- package/dist/components/paragraph.component.d.ts.map +1 -1
- package/dist/components/paragraph.js +2 -8
- package/dist/components/paragraph.js.map +1 -1
- package/dist/components/phone-input.component.d.ts +27 -4
- package/dist/components/phone-input.component.d.ts.map +1 -1
- package/dist/components/phone-input.js +91 -22
- package/dist/components/phone-input.js.map +1 -1
- package/dist/components/popup.component.d.ts +1 -1
- package/dist/components/qr-code.component.d.ts +1 -1
- package/dist/components/radio-button.component.d.ts +1 -1
- package/dist/components/radio-group.component.d.ts +1 -1
- package/dist/components/radio.component.d.ts +1 -1
- package/dist/components/radio.component.d.ts.map +1 -1
- package/dist/components/radio.js +12 -16
- package/dist/components/radio.js.map +1 -1
- package/dist/components/search.component.d.ts +11 -4
- package/dist/components/search.component.d.ts.map +1 -1
- package/dist/components/search.js +75 -31
- package/dist/components/search.js.map +1 -1
- package/dist/components/spinner.component.d.ts +1 -1
- package/dist/components/step-indicator.component.d.ts +1 -1
- package/dist/components/textfield.component.d.ts +2 -2
- package/dist/components/textfield.component.d.ts.map +1 -1
- package/dist/components/textfield.js +75 -86
- package/dist/components/textfield.js.map +1 -1
- package/dist/components/tooltip.component.d.ts +1 -1
- package/dist/components/validation-message.component.d.ts +1 -1
- package/dist/controllers/lang.controller.d.ts +14 -0
- package/dist/controllers/lang.controller.d.ts.map +1 -0
- package/dist/designsystemet-tailwind.css +355 -297
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/lang.controller-P4W-9ipy.js +32 -0
- package/dist/lang.controller-P4W-9ipy.js.map +1 -0
- package/dist/styles.css +5 -0
- package/dist/theme.css +1155 -0
- package/dist/utilities/lang.d.ts +6 -0
- package/dist/utilities/lang.d.ts.map +1 -0
- package/dist/utilities/lang.js +18 -0
- package/dist/utilities/lang.js.map +1 -0
- package/dist/utilities/translations.d.ts +42 -0
- package/dist/utilities/translations.d.ts.map +1 -0
- package/dist/utilities/translations.js +45 -0
- package/dist/utilities/translations.js.map +1 -0
- package/package.json +34 -16
|
@@ -37,6 +37,7 @@ export declare class MinidIcon extends MinidIcon_base {
|
|
|
37
37
|
*/
|
|
38
38
|
library: 'system' | 'country' | 'nav-aksel';
|
|
39
39
|
private hasRendered;
|
|
40
|
+
private updateAccessibilityAttributes;
|
|
40
41
|
/**
|
|
41
42
|
* Given a URL, this function returns the resulting SVG element or an appropriate error symbol.
|
|
42
43
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icon.component.d.ts","sourceRoot":"","sources":["../../../src/components/icon/icon.component.ts"],"names":[],"mappings":"AACA,OAAO,EAAO,KAAK,kBAAkB,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAI/D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAGzD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,UAAU,EAAE,SAAS,CAAC;KACvB;CACF;;AA8BD;;;;;;GAMG;AACH,qBACa,SAAU,SAAQ,cAA0B;IAEvD,OAAO,CAAC,GAAG,CAAgD;IAE3D;;;;OAIG;IAEH,IAAI,CAAC,EAAE,WAAW,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;IAEnC;;;OAGG;IAEH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;;OAGG;IAEH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;;OAGG;IAEH,OAAO,EAAE,QAAQ,GAAG,SAAS,GAAG,WAAW,CAAe;IAE1D,OAAO,CAAC,WAAW,CAAS;IAE5B;;OAEG;YACW,WAAW;IA8CzB,YAAY;
|
|
1
|
+
{"version":3,"file":"icon.component.d.ts","sourceRoot":"","sources":["../../../src/components/icon/icon.component.ts"],"names":[],"mappings":"AACA,OAAO,EAAO,KAAK,kBAAkB,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAI/D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAGzD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,UAAU,EAAE,SAAS,CAAC;KACvB;CACF;;AA8BD;;;;;;GAMG;AACH,qBACa,SAAU,SAAQ,cAA0B;IAEvD,OAAO,CAAC,GAAG,CAAgD;IAE3D;;;;OAIG;IAEH,IAAI,CAAC,EAAE,WAAW,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;IAEnC;;;OAGG;IAEH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;;OAGG;IAEH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;;OAGG;IAEH,OAAO,EAAE,QAAQ,GAAG,SAAS,GAAG,WAAW,CAAe;IAE1D,OAAO,CAAC,WAAW,CAAS;IAE5B,OAAO,CAAC,6BAA6B;IAYrC;;OAEG;YACW,WAAW;IA8CzB,YAAY;IAOZ,iBAAiB;IAKX,OAAO;IAsEb,SAAS,CAAC,MAAM;CAGjB"}
|
|
@@ -103,6 +103,17 @@ let MinidIcon = class extends styled(LitElement, styles) {
|
|
|
103
103
|
this.library = "nav-aksel";
|
|
104
104
|
this.hasRendered = false;
|
|
105
105
|
}
|
|
106
|
+
updateAccessibilityAttributes() {
|
|
107
|
+
if (typeof this.alt === "string" && this.alt.length > 0) {
|
|
108
|
+
this.setAttribute("role", "img");
|
|
109
|
+
this.setAttribute("aria-label", this.alt);
|
|
110
|
+
this.removeAttribute("aria-hidden");
|
|
111
|
+
} else {
|
|
112
|
+
this.removeAttribute("role");
|
|
113
|
+
this.removeAttribute("aria-label");
|
|
114
|
+
this.setAttribute("aria-hidden", "true");
|
|
115
|
+
}
|
|
116
|
+
}
|
|
106
117
|
/**
|
|
107
118
|
* Given a URL, this function returns the resulting SVG element or an appropriate error symbol.
|
|
108
119
|
*/
|
|
@@ -145,18 +156,11 @@ let MinidIcon = class extends styled(LitElement, styles) {
|
|
|
145
156
|
}
|
|
146
157
|
firstUpdated() {
|
|
147
158
|
this.hasRendered = true;
|
|
159
|
+
this.updateAccessibilityAttributes();
|
|
148
160
|
this.setIcon();
|
|
149
161
|
}
|
|
150
162
|
handleLabelChange() {
|
|
151
|
-
|
|
152
|
-
this.setAttribute("role", "img");
|
|
153
|
-
this.setAttribute("aria-label", this.alt);
|
|
154
|
-
this.removeAttribute("aria-hidden");
|
|
155
|
-
} else {
|
|
156
|
-
this.removeAttribute("role");
|
|
157
|
-
this.removeAttribute("aria-label");
|
|
158
|
-
this.setAttribute("aria-hidden", "true");
|
|
159
|
-
}
|
|
163
|
+
this.updateAccessibilityAttributes();
|
|
160
164
|
}
|
|
161
165
|
async setIcon() {
|
|
162
166
|
if (!this.library && !this.name && !this.src) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icon.js","sources":["../../../src/components/icon/system.icon-library.ts","../../../src/components/icon/icon.component.ts"],"sourcesContent":["//\n// System icons are a separate library to ensure they're always available, regardless of how the default icon library is\n// configured or if its icons resolve properly.\n//\n// All MinID components must use the system library instead of the default library. For visual consistency, system\n// icons are a subset of Nav Aksel Icons.\n//\nexport const systemIcons = {\n 'circle-broken': `\n <svg width=\"1em\" height=\"1em\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M12 3.75C7.44365 3.75 3.75 7.44365 3.75 12C3.75 15.5909 6.04464 18.6478 9.24993 19.7808C10.1091 20.0844 11.0344 20.25 12 20.25C12.4142 20.25 12.75 20.5858 12.75 21C12.75 21.4142 12.4142 21.75 12 21.75C10.8618 21.75 9.76756 21.5546 8.75007 21.195C4.9642 19.8569 2.25 16.2464 2.25 12C2.25 6.61522 6.61522 2.25 12 2.25C16.2464 2.25 19.8569 4.9642 21.195 8.75007C21.5546 9.76756 21.75 10.8618 21.75 12C21.75 12.4142 21.4142 12.75 21 12.75C20.5858 12.75 20.25 12.4142 20.25 12C20.25 11.0344 20.0844 10.1091 19.7808 9.24993C18.6478 6.04464 15.5909 3.75 12 3.75Z\" fill=\"currentColor\"/>\n </svg>\n `,\n 'magnifying-glass': `\n <svg width=\"1em\" height=\"1em\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M10.5 3.25C6.49594 3.25 3.25 6.49594 3.25 10.5C3.25 14.5041 6.49594 17.75 10.5 17.75C12.2319 17.75 13.8219 17.1427 15.0689 16.1295L20.4801 21.5407C20.773 21.8336 21.2478 21.8336 21.5407 21.5407C21.8336 21.2478 21.8336 20.773 21.5407 20.4801L16.1295 15.0689C17.1427 13.8219 17.75 12.2319 17.75 10.5C17.75 6.49594 14.5041 3.25 10.5 3.25ZM4.75 10.5C4.75 7.32436 7.32436 4.75 10.5 4.75C13.6756 4.75 16.25 7.32436 16.25 10.5C16.25 13.6756 13.6756 16.25 10.5 16.25C7.32436 16.25 4.75 13.6756 4.75 10.5Z\" fill=\"currentColor\"/>\n </svg>\n\n `,\n 'questionmark-circle-fill': `\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"1em\" height=\"1em\" fill=\"none\" aria-hidden=\"true\" viewBox=\"0 0 24 24\">\n <path fill=\"currentColor\" fill-rule=\"evenodd\" d=\"M12 0c6.627 0 12 5.373 12 12s-5.373 12-12 12S0 18.627 0 12 5.373 0 12 0Zm0 16a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3Zm0-11c2.205 0 4 1.657 4 3.693 0 .986-.416 1.914-1.172 2.612l-.593.54-.294.28c-.477.466-.869.94-.936 1.417l-.01.144v.814h-1.991v-.814c0-1.254.84-2.214 1.675-3.002l.74-.68c.38-.35.59-.816.59-1.31 0-1.024-.901-1.856-2.01-1.856-1.054 0-1.922.755-2.002 1.71l-.006.145H8C8 6.657 9.794 5 12 5Z\" clip-rule=\"evenodd\"/>\n </svg>\n `,\n 'questionmark-circle': `\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"1em\" height=\"1em\" fill=\"none\" aria-hidden=\"true\" viewBox=\"0 0 24 24\">\n <path fill=\"currentColor\" fill-rule=\"evenodd\" d=\"M12 0c6.627 0 12 5.373 12 12s-5.373 12-12 12S0 18.627 0 12 5.373 0 12 0Zm0 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2Zm0 14a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3Zm0-11c2.205 0 4 1.657 4 3.693 0 .986-.416 1.914-1.172 2.612l-.593.54-.294.28c-.477.466-.869.94-.936 1.417l-.01.144v.814h-1.991v-.814c0-1.254.84-2.214 1.675-3.002l.74-.68c.38-.35.59-.816.59-1.31 0-1.024-.901-1.856-2.01-1.856-1.054 0-1.922.755-2.002 1.71l-.006.145H8C8 6.657 9.794 5 12 5Z\" clip-rule=\"evenodd\"/>\n </svg>\n `,\n 'xmark-octagon-fill': `\n <svg width=\"1em\" height=\"1em\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M7.74175 2.46967C7.8824 2.32902 8.07317 2.25 8.27208 2.25L15.7279 2.25C15.9268 2.25 16.1176 2.32902 16.2583 2.46967L21.5303 7.74175C21.671 7.8824 21.75 8.07317 21.75 8.27208V15.7279C21.75 15.9268 21.671 16.1176 21.5303 16.2583L16.2583 21.5303C16.1176 21.671 15.9268 21.75 15.7279 21.75H8.27208C8.07316 21.75 7.8824 21.671 7.74175 21.5303L2.46967 16.2583C2.32902 16.1176 2.25 15.9268 2.25 15.7279L2.25 8.27208C2.25 8.07317 2.32902 7.8824 2.46967 7.74175L7.74175 2.46967ZM9.03033 7.96967C8.73744 7.67678 8.26256 7.67678 7.96967 7.96967C7.67678 8.26256 7.67678 8.73744 7.96967 9.03033L10.9393 12L7.96967 14.9697C7.67678 15.2626 7.67678 15.7374 7.96967 16.0303C8.26256 16.3232 8.73744 16.3232 9.03033 16.0303L12 13.0607L14.9697 16.0303C15.2626 16.3232 15.7374 16.3232 16.0303 16.0303C16.3232 15.7374 16.3232 15.2626 16.0303 14.9697L13.0607 12L16.0303 9.03033C16.3232 8.73744 16.3232 8.26256 16.0303 7.96967C15.7374 7.67678 15.2626 7.67678 14.9697 7.96967L12 10.9393L9.03033 7.96967Z\" fill=\"currentColor\"/>\n </svg>\n `,\n 'exclamationmark-triangle-fill': `\n <svg width=\"1em\" height=\"1em\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M11.9999 2.25C12.273 2.25 12.5244 2.3984 12.6565 2.63743L22.1827 19.8874C22.311 20.1198 22.307 20.4026 22.1721 20.6312C22.0372 20.8597 21.7916 21 21.5262 21H2.47363C2.20823 21 1.96259 20.8597 1.82771 20.6312C1.69283 20.4026 1.68879 20.1198 1.8171 19.8874L11.3434 2.63743C11.4754 2.3984 11.7269 2.25 11.9999 2.25ZM12.001 8.75C12.4152 8.75 12.751 9.08579 12.751 9.5V13.5C12.751 13.9142 12.4152 14.25 12.001 14.25C11.5868 14.25 11.251 13.9142 11.251 13.5V9.5C11.251 9.08579 11.5868 8.75 12.001 8.75ZM11.001 16.5C11.001 15.9477 11.4487 15.5 12.001 15.5C12.5533 15.5 13.001 15.9477 13.001 16.5C13.001 17.0523 12.5533 17.5 12.001 17.5C11.4487 17.5 11.001 17.0523 11.001 16.5Z\" fill=\"currentColor\"/>\n </svg>\n `,\n 'checkmark-circle-fill': `\n <svg width=\"1em\" height=\"1em\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M12 21.75C17.3848 21.75 21.75 17.3848 21.75 12C21.75 6.61522 17.3848 2.25 12 2.25C6.61522 2.25 2.25 6.61522 2.25 12C2.25 17.3848 6.61522 21.75 12 21.75ZM16.9536 9.27485C17.2434 8.93229 17.2007 8.41962 16.8582 8.12977C16.5156 7.83991 16.0029 7.88263 15.7131 8.22519L10.3251 14.5928L7.69952 11.9672C7.38222 11.6499 6.86778 11.6499 6.55048 11.9672C6.23317 12.2845 6.23317 12.7989 6.55048 13.1162L9.80048 16.3662C9.96114 16.5269 10.1817 16.6129 10.4088 16.6035C10.6358 16.594 10.8485 16.49 10.9953 16.3165L16.9536 9.27485Z\" fill=\"currentColor\"/>\n </svg>\n `,\n 'eye-slash': `\n <svg width=\"1em\" height=\"1em\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M21.0303 5.03033C21.3232 4.73744 21.3232 4.26256 21.0303 3.96967C20.7374 3.67678 20.2626 3.67678 19.9697 3.96967L16.659 7.28033C15.3593 6.67264 13.8043 6.25 12 6.25C8.77743 6.25 6.36338 7.59591 4.76986 8.92384C3.97354 9.58744 3.37644 10.2507 2.97685 10.7502C2.77672 11.0004 2.62518 11.2107 2.52208 11.361C2.4705 11.4362 2.43096 11.4966 2.40345 11.5396C2.38969 11.5611 2.37894 11.5782 2.37118 11.5908L2.36178 11.606L2.35877 11.611L2.35768 11.6128C2.35768 11.6128 2.35688 11.6141 3 12L2.35688 11.6141C2.21437 11.8517 2.21437 12.1484 2.35688 12.3859L2.35826 12.3882L2.36033 12.3916L2.36653 12.4017L2.38715 12.4348C2.40456 12.4624 2.42932 12.5009 2.46141 12.5492C2.52559 12.6457 2.61927 12.7814 2.74252 12.9466C2.98876 13.2768 3.35458 13.7273 3.84068 14.2208C4.64096 15.0333 5.77932 15.9744 7.25858 16.6808L3.96967 19.9697C3.67678 20.2626 3.67678 20.7374 3.96967 21.0303C4.26256 21.3232 4.73744 21.3232 5.03033 21.0303L10.5954 15.4653C10.6007 15.4601 10.6061 15.4549 10.6113 15.4495L10.6165 15.4441L15.4441 10.6165C15.4514 10.6096 15.4584 10.6025 15.4653 10.5954L21.0303 5.03033ZM13.914 10.0254L10.0254 13.914C9.91032 13.7953 9.80586 13.6661 9.71346 13.5278C9.47911 13.1771 9.32859 12.7772 9.27353 12.3589C9.21847 11.9407 9.26035 11.5155 9.39594 11.116C9.53153 10.7166 9.75719 10.3537 10.0555 10.0555C10.3537 9.75719 10.7166 9.53153 11.116 9.39594C11.5155 9.26035 11.9407 9.21847 12.3589 9.27353C12.7772 9.32859 13.1771 9.47911 13.5278 9.71346C13.6661 9.80586 13.7953 9.91033 13.914 10.0254ZM14.3612 8.46626C14.5814 8.61342 14.7867 8.78038 14.9747 8.96462L15.5189 8.42045C14.5061 8.01586 13.3343 7.75 12 7.75C9.22257 7.75 7.13662 8.9041 5.73014 10.0762C5.02646 10.6626 4.49856 11.2493 4.14815 11.6873C4.05539 11.8032 3.97534 11.9084 3.90802 12L3.94498 12.0499C4.15707 12.3343 4.47875 12.7311 4.90932 13.1682C5.71064 13.9817 6.8738 14.9197 8.39477 15.5446L8.96462 14.9747C8.78038 14.7867 8.61342 14.5814 8.46625 14.3612C8.10408 13.8191 7.87145 13.2011 7.78636 12.5547C7.70127 11.9084 7.766 11.2512 7.97555 10.6339C8.18509 10.0166 8.53384 9.45576 8.9948 8.9948C9.45576 8.53384 10.0166 8.18509 10.6339 7.97555C11.2512 7.766 11.9084 7.70127 12.5547 7.78636C13.2011 7.87145 13.8191 8.10408 14.3612 8.46626ZM19.5988 9.24339C19.2909 8.96625 18.8167 8.99114 18.5396 9.29898C18.2624 9.60682 18.2873 10.081 18.5952 10.3582C18.7178 10.4686 18.8341 10.5782 18.9442 10.6859C19.4237 11.1555 19.7822 11.589 20.0189 11.9022C20.0448 11.9364 20.0691 11.9691 20.092 12.0002C20.0247 12.0918 19.9446 12.197 19.8518 12.3129C19.5014 12.7509 18.9735 13.3376 18.2699 13.924C16.8634 15.0961 14.7774 16.2502 12 16.2502C11.5858 16.2502 11.25 16.586 11.25 17.0002C11.25 17.4144 11.5858 17.7502 12 17.7502C15.2226 17.7502 17.6366 16.4043 19.2301 15.0764C20.0265 14.4128 20.6236 13.7495 21.0232 13.25C21.2233 12.9998 21.3748 12.7895 21.4779 12.6392C21.5295 12.564 21.569 12.5036 21.5965 12.4606C21.6023 12.4516 21.6076 12.4433 21.6123 12.4359C21.6188 12.4255 21.6243 12.4167 21.6288 12.4094L21.6382 12.3942L21.6412 12.3892L21.6428 12.3867C21.7853 12.1492 21.7856 11.8518 21.6431 11.6143L21 12.0002C21.6431 11.6143 21.6425 11.6134 21.6425 11.6133L21.6416 11.6119L21.6394 11.6082L21.6326 11.5971L21.6099 11.5607C21.5907 11.5303 21.5633 11.4878 21.5277 11.4346C21.4565 11.3283 21.3525 11.1789 21.2155 10.9977C20.9419 10.6357 20.5349 10.1442 19.9937 9.61422C19.8692 9.49235 19.7376 9.36837 19.5988 9.24339ZM21 12.0002L21.6428 12.3867C21.6429 12.3864 21.6431 12.3861 21 12.0002Z\" fill=\"currentColor\"/>\n </svg>\n `,\n eye: `\n <svg width=\"1em\" height=\"1em\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M4.14838 12.3172C4.0542 12.1994 3.97317 12.0926 3.90533 12C3.97317 11.9074 4.0542 11.8006 4.14838 11.6828C4.49853 11.2446 5.02627 10.6584 5.72985 10.0727C7.13607 8.90197 9.22211 7.75 12 7.75C9.65279 7.75 7.75 9.65279 7.75 12C7.75 14.3472 9.65279 16.25 12 16.25C9.22211 16.25 7.13607 15.098 5.72985 13.9273C5.02627 13.3416 4.49853 12.7554 4.14838 12.3172ZM12 16.25C14.3472 16.25 16.25 14.3472 16.25 12C16.25 9.65279 14.3472 7.75 12 7.75C14.7779 7.75 16.8639 8.90197 18.2701 10.0727C18.9737 10.6584 19.5015 11.2446 19.8516 11.6828C19.9458 11.8006 20.0268 11.9074 20.0947 12C20.0268 12.0926 19.9458 12.1994 19.8516 12.3172C19.5015 12.7554 18.9737 13.3416 18.2701 13.9273C16.8639 15.098 14.7779 16.25 12 16.25ZM12 6.25C8.77789 6.25 6.36393 7.59303 4.77014 8.91985C3.97373 9.58286 3.37647 10.246 2.97662 10.7463C2.77639 10.9968 2.6246 11.2079 2.52109 11.3596C2.46936 11.4354 2.42935 11.4969 2.4011 11.5416C2.38707 11.5638 2.37537 11.5828 2.36621 11.598C2.36186 11.6052 2.35682 11.6137 2.35187 11.6223C2.34981 11.6259 2.34523 11.6339 2.33994 11.6438C2.33787 11.6476 2.33154 11.6594 2.32419 11.6747C2.32003 11.6835 2.30949 11.7072 2.30329 11.7223C2.29144 11.7541 2.2578 11.8921 2.25 12C2.2578 12.1079 2.29144 12.2459 2.30329 12.2777C2.30949 12.2928 2.32003 12.3165 2.32419 12.3253C2.33154 12.3406 2.33787 12.3524 2.33994 12.3562C2.34523 12.3661 2.34981 12.3741 2.35187 12.3777C2.35682 12.3863 2.36186 12.3948 2.36621 12.402C2.37537 12.4172 2.38707 12.4362 2.4011 12.4584C2.42935 12.5031 2.46936 12.5646 2.52109 12.6404C2.6246 12.7921 2.77639 13.0032 2.97662 13.2537C3.37647 13.754 3.97373 14.4171 4.77015 15.0802C6.36393 16.407 8.77789 17.75 12 17.75C15.2221 17.75 17.6361 16.407 19.2299 15.0802C20.0263 14.4171 20.6235 13.754 21.0234 13.2537C21.2236 13.0032 21.3754 12.7921 21.4789 12.6404C21.5306 12.5646 21.5706 12.5031 21.5989 12.4584C21.6129 12.4362 21.6246 12.4172 21.6338 12.402L21.6391 12.3931L21.6481 12.3777C21.6502 12.3741 21.6548 12.3661 21.6601 12.3562C21.6621 12.3524 21.6685 12.3406 21.6758 12.3253C21.68 12.3165 21.6905 12.2928 21.6967 12.2777C21.7086 12.2459 21.7422 12.1079 21.75 12C21.7422 11.8921 21.7086 11.7541 21.6967 11.7223C21.6905 11.7072 21.68 11.6835 21.6758 11.6747C21.6685 11.6594 21.6621 11.6476 21.6601 11.6438C21.6548 11.6339 21.6502 11.6259 21.6481 11.6223C21.6457 11.6181 21.6433 11.614 21.6409 11.61C21.6384 11.6058 21.636 11.6017 21.6338 11.598C21.6246 11.5828 21.6129 11.5638 21.5989 11.5416C21.5706 11.4969 21.5306 11.4354 21.4789 11.3596C21.3754 11.2079 21.2236 10.9968 21.0234 10.7463C20.6235 10.246 20.0263 9.58286 19.2299 8.91985C17.6361 7.59303 15.2221 6.25 12 6.25ZM9.25 12C9.25 10.4812 10.4812 9.25 12 9.25C13.5188 9.25 14.75 10.4812 14.75 12C14.75 13.5188 13.5188 14.75 12 14.75C10.4812 14.75 9.25 13.5188 9.25 12Z\" fill=\"currentColor\"/>\n </svg>\n `,\n 'information-square-fill': `\n <svg width=\"1em\" height=\"1em\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M3.25 4C3.25 3.58579 3.58579 3.25 4 3.25H20C20.4142 3.25 20.75 3.58579 20.75 4V20C20.75 20.4142 20.4142 20.75 20 20.75H4C3.58579 20.75 3.25 20.4142 3.25 20V4ZM11 7.75C11 7.19772 11.4477 6.75 12 6.75C12.5523 6.75 13 7.19772 13 7.75C13 8.30228 12.5523 8.75 12 8.75C11.4477 8.75 11 8.30228 11 7.75ZM9.75 10.75C9.75 10.3358 10.0858 10 10.5 10H12C12.4142 10 12.75 10.3358 12.75 10.75V15.5H13.5C13.9142 15.5 14.25 15.8358 14.25 16.25C14.25 16.6642 13.9142 17 13.5 17H12H10.5C10.0858 17 9.75 16.6642 9.75 16.25C9.75 15.8358 10.0858 15.5 10.5 15.5H11.25V11.5H10.5C10.0858 11.5 9.75 11.1642 9.75 10.75Z\" fill=\"currentColor\"/>\n </svg>\n `,\n 'padlock-locked-fill': `\n <svg width=\"1em\" height=\"1em\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M12 2.25C9.37665 2.25 7.25 4.37665 7.25 7V9.25H7C6.0335 9.25 5.25 10.0335 5.25 11V20C5.25 20.4142 5.58579 20.75 6 20.75H18C18.4142 20.75 18.75 20.4142 18.75 20V11C18.75 10.0335 17.9665 9.25 17 9.25H16.75V7C16.75 4.37665 14.6234 2.25 12 2.25ZM15.25 9.25V7C15.25 5.20507 13.7949 3.75 12 3.75C10.2051 3.75 8.75 5.20507 8.75 7V9.25H15.25ZM12 13C11.1716 13 10.5 13.6716 10.5 14.5C10.5 15.0552 10.8016 15.54 11.25 15.7993V17C11.25 17.4142 11.5858 17.75 12 17.75C12.4142 17.75 12.75 17.4142 12.75 17V15.7993C13.1984 15.54 13.5 15.0552 13.5 14.5C13.5 13.6716 12.8284 13 12 13Z\" fill=\"currentColor\"/>\n </svg>\n `,\n xmark: `\n <svg width=\"1em\" height=\"1em\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M6.53033 5.46967C6.23744 5.17678 5.76256 5.17678 5.46967 5.46967C5.17678 5.76256 5.17678 6.23744 5.46967 6.53033L10.9393 12L5.46967 17.4697C5.17678 17.7626 5.17678 18.2374 5.46967 18.5303C5.76256 18.8232 6.23744 18.8232 6.53033 18.5303L12 13.0607L17.4697 18.5303C17.7626 18.8232 18.2374 18.8232 18.5303 18.5303C18.8232 18.2374 18.8232 17.7626 18.5303 17.4697L13.0607 12L18.5303 6.53033C18.8232 6.23744 18.8232 5.76256 18.5303 5.46967C18.2374 5.17678 17.7626 5.17678 17.4697 5.46967L12 10.9393L6.53033 5.46967Z\" fill=\"currentColor\"/>\n </svg>\n `,\n};\n","import { customElement, property, state } from 'lit/decorators.js';\nimport { css, type HTMLTemplateResult, LitElement } from 'lit';\nimport { styled } from '../../mixins/tailwind.mixin';\nimport { watch } from '../../internal/watch.ts';\nimport { isTemplateResult } from 'lit/directive-helpers.js';\nimport type { MidIconName } from '../../types/icon-name';\nimport { systemIcons } from './system.icon-library.ts';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'mid-icon': MinidIcon;\n }\n}\n\nconst styles = [\n css`\n :host {\n display: inline-flex;\n width: 1em;\n height: 1em;\n box-sizing: content-box !important;\n }\n\n svg {\n width: 100%;\n height: 100%;\n display: block;\n }\n `,\n];\n\nconst CACHEABLE_ERROR = Symbol();\nconst RETRYABLE_ERROR = Symbol();\ntype SVGResult =\n | HTMLTemplateResult\n | SVGSVGElement\n | typeof RETRYABLE_ERROR\n | typeof CACHEABLE_ERROR;\n\nlet parser: DOMParser;\nconst iconCache = new Map<string, Promise<SVGResult>>();\n\n/**\n *\n * Size and color can be adjusted with `font-size` and `color` css properties\n *\n * @event mid-load - Emitted when the icon has loaded\n * @event mid-error - Emitted when the icon fails to load\n */\n@customElement('mid-icon')\nexport class MinidIcon extends styled(LitElement, styles) {\n @state()\n private svg: SVGElement | HTMLTemplateResult | null = null;\n\n /**\n * The name of the icon to draw. Available names depend on the icon library being used.\n * Preview default icons [here](https://aksel.nav.no/ikoner)\n * @type string\n */\n @property({ reflect: true })\n name?: MidIconName | (string & {}); // weird typing makes sure we have both intellisense and ability to input any string\n\n /**\n * An external URL of an SVG file. Be sure you trust the content you are including, as it will be executed as code and\n * can result in XSS attacks.\n */\n @property()\n src?: string;\n\n /**\n * An alternate description to use for assistive devices. If omitted, the icon will be considered presentational and\n * ignored by assistive devices.\n */\n @property()\n alt?: string;\n\n /**\n * The name of a registered custom icon library.\n * @default nav-aksel\n */\n @property()\n library: 'system' | 'country' | 'nav-aksel' = 'nav-aksel';\n\n private hasRendered = false;\n\n /**\n * Given a URL, this function returns the resulting SVG element or an appropriate error symbol.\n */\n private async resolveIcon(url: string): Promise<SVGResult> {\n let svgString = '';\n\n if (url.startsWith('data:image/svg+xml')) {\n svgString = decodeURIComponent(url);\n } else {\n let fileData: Response;\n try {\n fileData = await fetch(url, { mode: 'cors' });\n\n if (!fileData.ok) {\n return fileData.status === 410 ? CACHEABLE_ERROR : RETRYABLE_ERROR;\n }\n } catch {\n return RETRYABLE_ERROR;\n }\n svgString = await fileData.text();\n }\n\n try {\n const div = document.createElement('div');\n div.innerHTML = svgString;\n\n const svg = div.firstElementChild;\n if (svg?.tagName?.toLowerCase() !== 'svg') {\n return CACHEABLE_ERROR;\n }\n\n if (!parser) {\n parser = new DOMParser();\n }\n const doc = parser.parseFromString(svg.outerHTML, 'text/html');\n\n const svgEl = doc.body.querySelector('svg');\n if (!svgEl) {\n return CACHEABLE_ERROR;\n }\n\n svgEl.part.add('svg');\n\n return document.adoptNode(svgEl);\n } catch {\n return CACHEABLE_ERROR;\n }\n }\n\n firstUpdated() {\n this.hasRendered = true;\n this.setIcon();\n }\n\n @watch('alt')\n handleLabelChange() {\n if (typeof this.alt === 'string' && this.alt.length > 0) {\n this.setAttribute('role', 'img');\n this.setAttribute('aria-label', this.alt);\n this.removeAttribute('aria-hidden');\n } else {\n this.removeAttribute('role');\n this.removeAttribute('aria-label');\n this.setAttribute('aria-hidden', 'true');\n }\n }\n\n @watch(['name', 'src', 'library'])\n async setIcon() {\n if (!this.library && !this.name && !this.src) {\n this.svg = null;\n return;\n }\n\n let iconResolver = iconCache.get(`${this.library}-${this.name}`);\n const iconKey = `${this.library}-${this.name}`;\n if (!iconResolver) {\n let svgUrl: string;\n if (this.src) {\n iconResolver = this.resolveIcon(this.src);\n iconCache.set(iconKey, iconResolver);\n } else if (this.library === 'nav-aksel') {\n svgUrl = `/icons/${this.name}.svg`;\n iconResolver = this.resolveIcon(svgUrl);\n iconCache.set(iconKey, iconResolver);\n } else if (this.library === 'country') {\n svgUrl = `/flags/${this.name}.svg`;\n iconResolver = this.resolveIcon(svgUrl);\n iconCache.set(iconKey, iconResolver);\n } else if (this.library === 'system') {\n svgUrl = `data:image/svg+xml,${encodeURIComponent(systemIcons[this.name as keyof typeof systemIcons])}`;\n iconResolver = this.resolveIcon(svgUrl);\n iconCache.set(iconKey, iconResolver);\n }\n }\n\n // If we haven't rendered yet, exit early. This avoids unnecessary work due to watching multiple props.\n if (!this.hasRendered) {\n return;\n }\n\n const svg = await iconResolver;\n\n if (!svg) {\n return;\n }\n\n if (svg === RETRYABLE_ERROR) {\n iconCache.delete(iconKey);\n }\n\n if (iconKey !== `${this.library}-${this.name}`) {\n // If the url has changed while fetching the icon, ignore this request\n return;\n }\n\n if (isTemplateResult(svg)) {\n this.svg = svg;\n\n return;\n }\n\n switch (svg) {\n case RETRYABLE_ERROR:\n case CACHEABLE_ERROR:\n this.svg = null;\n this.dispatchEvent(\n new Event('mid-error', { bubbles: true, composed: true })\n );\n break;\n default:\n this.svg = svg.cloneNode(true) as SVGElement;\n this.dispatchEvent(\n new Event('mid-load', { bubbles: true, composed: true })\n );\n }\n }\n\n protected render() {\n return this.svg;\n }\n}\n"],"names":[],"mappings":";;;;;AAOO,MAAM,cAAc;AAAA,EACzB,iBAAiB;AAAA;AAAA;AAAA;AAAA;AAAA,EAKjB,oBAAoB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMpB,4BAA4B;AAAA;AAAA;AAAA;AAAA;AAAA,EAK5B,uBAAuB;AAAA;AAAA;AAAA;AAAA;AAAA,EAKvB,sBAAsB;AAAA;AAAA;AAAA;AAAA;AAAA,EAKtB,iCAAiC;AAAA;AAAA;AAAA;AAAA;AAAA,EAKjC,yBAAyB;AAAA;AAAA;AAAA;AAAA;AAAA,EAKzB,aAAa;AAAA;AAAA;AAAA;AAAA;AAAA,EAKb,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA,EAKL,2BAA2B;AAAA;AAAA;AAAA;AAAA;AAAA,EAK3B,uBAAuB;AAAA;AAAA;AAAA;AAAA;AAAA,EAKvB,OAAO;AAAA;AAAA;AAAA;AAAA;AAKT;;;;;;;;;;;ACvDA,MAAM,SAAS;AAAA,EACb;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAcF;AAEA,MAAM,kBAAkB,OAAA;AACxB,MAAM,kBAAkB,OAAA;AAOxB,IAAI;AACJ,MAAM,gCAAgB,IAAA;AAUf,IAAM,YAAN,cAAwB,OAAO,YAAY,MAAM,EAAE;AAAA,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AK,MAAM;AAEX;AAAA,IACF;AAEA,YAAQ,KAAA;AAAA,MACN,KAAK;AAAA,MACL,KAAK;AACH,aAAK,MAAM;AACX,aAAK;AAAA,UACH,IAAI,MAAM,aAAa,EAAE,SAAS,MAAM,UAAU,MAAM;AAAA,QAAA;AAE1D;AAAA,MACF;AACE,aAAK,MAAM,IAAI,UAAU,IAAI;AAC7B,aAAK;AAAA,UACH,IAAI,MAAM,YAAY,EAAE,SAAS,MAAM,UAAU,MAAM;AAAA,QAAA;AAAA,IACzD;AAAA,EAEN;AAAA,EAEU,SAAS;AACjB,WAAO,KAAK;AAAA,EACd;AACF;AA9KU,gBAAA;AAAA,EADP,MAAA;AAAM,GADI,UAEH,WAAA,OAAA,CAAA;AAQR,gBAAA;AAAA,EADC,SAAS,EAAE,SAAS,KAAA,CAAM;AAAA,GAThB,UAUX,WAAA,QAAA,CAAA;AAOA,gBAAA;AAAA,EADC,SAAA;AAAS,GAhBC,UAiBX,WAAA,OAAA,CAAA;AAOA,gBAAA;AAAA,EADC,SAAA;AAAS,GAvBC,UAwBX,WAAA,OAAA,CAAA;AAOA,gBAAA;AAAA,EADC,SAAA;AAAS,GA9BC,UA+BX,WAAA,WAAA,CAAA;AA2DA,gBAAA;AAAA,EADC,MAAM,KAAK;AAAA,GAzFD,UA0FX,WAAA,qBAAA,CAAA;AAaM,gBAAA;AAAA,EADL,MAAM,CAAC,QAAQ,OAAO,SAAS,CAAC;AAAA,GAtGtB,UAuGL,WAAA,WAAA,CAAA;AAvGK,YAAN,gBAAA;AAAA,EADN,cAAc,UAAU;AAAA,GACZ,SAAA;"}
|
|
1
|
+
{"version":3,"file":"icon.js","sources":["../../../src/components/icon/system.icon-library.ts","../../../src/components/icon/icon.component.ts"],"sourcesContent":["//\n// System icons are a separate library to ensure they're always available, regardless of how the default icon library is\n// configured or if its icons resolve properly.\n//\n// All MinID components must use the system library instead of the default library. For visual consistency, system\n// icons are a subset of Nav Aksel Icons.\n//\nexport const systemIcons = {\n 'circle-broken': `\n <svg width=\"1em\" height=\"1em\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M12 3.75C7.44365 3.75 3.75 7.44365 3.75 12C3.75 15.5909 6.04464 18.6478 9.24993 19.7808C10.1091 20.0844 11.0344 20.25 12 20.25C12.4142 20.25 12.75 20.5858 12.75 21C12.75 21.4142 12.4142 21.75 12 21.75C10.8618 21.75 9.76756 21.5546 8.75007 21.195C4.9642 19.8569 2.25 16.2464 2.25 12C2.25 6.61522 6.61522 2.25 12 2.25C16.2464 2.25 19.8569 4.9642 21.195 8.75007C21.5546 9.76756 21.75 10.8618 21.75 12C21.75 12.4142 21.4142 12.75 21 12.75C20.5858 12.75 20.25 12.4142 20.25 12C20.25 11.0344 20.0844 10.1091 19.7808 9.24993C18.6478 6.04464 15.5909 3.75 12 3.75Z\" fill=\"currentColor\"/>\n </svg>\n `,\n 'magnifying-glass': `\n <svg width=\"1em\" height=\"1em\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M10.5 3.25C6.49594 3.25 3.25 6.49594 3.25 10.5C3.25 14.5041 6.49594 17.75 10.5 17.75C12.2319 17.75 13.8219 17.1427 15.0689 16.1295L20.4801 21.5407C20.773 21.8336 21.2478 21.8336 21.5407 21.5407C21.8336 21.2478 21.8336 20.773 21.5407 20.4801L16.1295 15.0689C17.1427 13.8219 17.75 12.2319 17.75 10.5C17.75 6.49594 14.5041 3.25 10.5 3.25ZM4.75 10.5C4.75 7.32436 7.32436 4.75 10.5 4.75C13.6756 4.75 16.25 7.32436 16.25 10.5C16.25 13.6756 13.6756 16.25 10.5 16.25C7.32436 16.25 4.75 13.6756 4.75 10.5Z\" fill=\"currentColor\"/>\n </svg>\n\n `,\n 'questionmark-circle-fill': `\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"1em\" height=\"1em\" fill=\"none\" aria-hidden=\"true\" viewBox=\"0 0 24 24\">\n <path fill=\"currentColor\" fill-rule=\"evenodd\" d=\"M12 0c6.627 0 12 5.373 12 12s-5.373 12-12 12S0 18.627 0 12 5.373 0 12 0Zm0 16a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3Zm0-11c2.205 0 4 1.657 4 3.693 0 .986-.416 1.914-1.172 2.612l-.593.54-.294.28c-.477.466-.869.94-.936 1.417l-.01.144v.814h-1.991v-.814c0-1.254.84-2.214 1.675-3.002l.74-.68c.38-.35.59-.816.59-1.31 0-1.024-.901-1.856-2.01-1.856-1.054 0-1.922.755-2.002 1.71l-.006.145H8C8 6.657 9.794 5 12 5Z\" clip-rule=\"evenodd\"/>\n </svg>\n `,\n 'questionmark-circle': `\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"1em\" height=\"1em\" fill=\"none\" aria-hidden=\"true\" viewBox=\"0 0 24 24\">\n <path fill=\"currentColor\" fill-rule=\"evenodd\" d=\"M12 0c6.627 0 12 5.373 12 12s-5.373 12-12 12S0 18.627 0 12 5.373 0 12 0Zm0 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2Zm0 14a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3Zm0-11c2.205 0 4 1.657 4 3.693 0 .986-.416 1.914-1.172 2.612l-.593.54-.294.28c-.477.466-.869.94-.936 1.417l-.01.144v.814h-1.991v-.814c0-1.254.84-2.214 1.675-3.002l.74-.68c.38-.35.59-.816.59-1.31 0-1.024-.901-1.856-2.01-1.856-1.054 0-1.922.755-2.002 1.71l-.006.145H8C8 6.657 9.794 5 12 5Z\" clip-rule=\"evenodd\"/>\n </svg>\n `,\n 'xmark-octagon-fill': `\n <svg width=\"1em\" height=\"1em\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M7.74175 2.46967C7.8824 2.32902 8.07317 2.25 8.27208 2.25L15.7279 2.25C15.9268 2.25 16.1176 2.32902 16.2583 2.46967L21.5303 7.74175C21.671 7.8824 21.75 8.07317 21.75 8.27208V15.7279C21.75 15.9268 21.671 16.1176 21.5303 16.2583L16.2583 21.5303C16.1176 21.671 15.9268 21.75 15.7279 21.75H8.27208C8.07316 21.75 7.8824 21.671 7.74175 21.5303L2.46967 16.2583C2.32902 16.1176 2.25 15.9268 2.25 15.7279L2.25 8.27208C2.25 8.07317 2.32902 7.8824 2.46967 7.74175L7.74175 2.46967ZM9.03033 7.96967C8.73744 7.67678 8.26256 7.67678 7.96967 7.96967C7.67678 8.26256 7.67678 8.73744 7.96967 9.03033L10.9393 12L7.96967 14.9697C7.67678 15.2626 7.67678 15.7374 7.96967 16.0303C8.26256 16.3232 8.73744 16.3232 9.03033 16.0303L12 13.0607L14.9697 16.0303C15.2626 16.3232 15.7374 16.3232 16.0303 16.0303C16.3232 15.7374 16.3232 15.2626 16.0303 14.9697L13.0607 12L16.0303 9.03033C16.3232 8.73744 16.3232 8.26256 16.0303 7.96967C15.7374 7.67678 15.2626 7.67678 14.9697 7.96967L12 10.9393L9.03033 7.96967Z\" fill=\"currentColor\"/>\n </svg>\n `,\n 'exclamationmark-triangle-fill': `\n <svg width=\"1em\" height=\"1em\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M11.9999 2.25C12.273 2.25 12.5244 2.3984 12.6565 2.63743L22.1827 19.8874C22.311 20.1198 22.307 20.4026 22.1721 20.6312C22.0372 20.8597 21.7916 21 21.5262 21H2.47363C2.20823 21 1.96259 20.8597 1.82771 20.6312C1.69283 20.4026 1.68879 20.1198 1.8171 19.8874L11.3434 2.63743C11.4754 2.3984 11.7269 2.25 11.9999 2.25ZM12.001 8.75C12.4152 8.75 12.751 9.08579 12.751 9.5V13.5C12.751 13.9142 12.4152 14.25 12.001 14.25C11.5868 14.25 11.251 13.9142 11.251 13.5V9.5C11.251 9.08579 11.5868 8.75 12.001 8.75ZM11.001 16.5C11.001 15.9477 11.4487 15.5 12.001 15.5C12.5533 15.5 13.001 15.9477 13.001 16.5C13.001 17.0523 12.5533 17.5 12.001 17.5C11.4487 17.5 11.001 17.0523 11.001 16.5Z\" fill=\"currentColor\"/>\n </svg>\n `,\n 'checkmark-circle-fill': `\n <svg width=\"1em\" height=\"1em\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M12 21.75C17.3848 21.75 21.75 17.3848 21.75 12C21.75 6.61522 17.3848 2.25 12 2.25C6.61522 2.25 2.25 6.61522 2.25 12C2.25 17.3848 6.61522 21.75 12 21.75ZM16.9536 9.27485C17.2434 8.93229 17.2007 8.41962 16.8582 8.12977C16.5156 7.83991 16.0029 7.88263 15.7131 8.22519L10.3251 14.5928L7.69952 11.9672C7.38222 11.6499 6.86778 11.6499 6.55048 11.9672C6.23317 12.2845 6.23317 12.7989 6.55048 13.1162L9.80048 16.3662C9.96114 16.5269 10.1817 16.6129 10.4088 16.6035C10.6358 16.594 10.8485 16.49 10.9953 16.3165L16.9536 9.27485Z\" fill=\"currentColor\"/>\n </svg>\n `,\n 'eye-slash': `\n <svg width=\"1em\" height=\"1em\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M21.0303 5.03033C21.3232 4.73744 21.3232 4.26256 21.0303 3.96967C20.7374 3.67678 20.2626 3.67678 19.9697 3.96967L16.659 7.28033C15.3593 6.67264 13.8043 6.25 12 6.25C8.77743 6.25 6.36338 7.59591 4.76986 8.92384C3.97354 9.58744 3.37644 10.2507 2.97685 10.7502C2.77672 11.0004 2.62518 11.2107 2.52208 11.361C2.4705 11.4362 2.43096 11.4966 2.40345 11.5396C2.38969 11.5611 2.37894 11.5782 2.37118 11.5908L2.36178 11.606L2.35877 11.611L2.35768 11.6128C2.35768 11.6128 2.35688 11.6141 3 12L2.35688 11.6141C2.21437 11.8517 2.21437 12.1484 2.35688 12.3859L2.35826 12.3882L2.36033 12.3916L2.36653 12.4017L2.38715 12.4348C2.40456 12.4624 2.42932 12.5009 2.46141 12.5492C2.52559 12.6457 2.61927 12.7814 2.74252 12.9466C2.98876 13.2768 3.35458 13.7273 3.84068 14.2208C4.64096 15.0333 5.77932 15.9744 7.25858 16.6808L3.96967 19.9697C3.67678 20.2626 3.67678 20.7374 3.96967 21.0303C4.26256 21.3232 4.73744 21.3232 5.03033 21.0303L10.5954 15.4653C10.6007 15.4601 10.6061 15.4549 10.6113 15.4495L10.6165 15.4441L15.4441 10.6165C15.4514 10.6096 15.4584 10.6025 15.4653 10.5954L21.0303 5.03033ZM13.914 10.0254L10.0254 13.914C9.91032 13.7953 9.80586 13.6661 9.71346 13.5278C9.47911 13.1771 9.32859 12.7772 9.27353 12.3589C9.21847 11.9407 9.26035 11.5155 9.39594 11.116C9.53153 10.7166 9.75719 10.3537 10.0555 10.0555C10.3537 9.75719 10.7166 9.53153 11.116 9.39594C11.5155 9.26035 11.9407 9.21847 12.3589 9.27353C12.7772 9.32859 13.1771 9.47911 13.5278 9.71346C13.6661 9.80586 13.7953 9.91033 13.914 10.0254ZM14.3612 8.46626C14.5814 8.61342 14.7867 8.78038 14.9747 8.96462L15.5189 8.42045C14.5061 8.01586 13.3343 7.75 12 7.75C9.22257 7.75 7.13662 8.9041 5.73014 10.0762C5.02646 10.6626 4.49856 11.2493 4.14815 11.6873C4.05539 11.8032 3.97534 11.9084 3.90802 12L3.94498 12.0499C4.15707 12.3343 4.47875 12.7311 4.90932 13.1682C5.71064 13.9817 6.8738 14.9197 8.39477 15.5446L8.96462 14.9747C8.78038 14.7867 8.61342 14.5814 8.46625 14.3612C8.10408 13.8191 7.87145 13.2011 7.78636 12.5547C7.70127 11.9084 7.766 11.2512 7.97555 10.6339C8.18509 10.0166 8.53384 9.45576 8.9948 8.9948C9.45576 8.53384 10.0166 8.18509 10.6339 7.97555C11.2512 7.766 11.9084 7.70127 12.5547 7.78636C13.2011 7.87145 13.8191 8.10408 14.3612 8.46626ZM19.5988 9.24339C19.2909 8.96625 18.8167 8.99114 18.5396 9.29898C18.2624 9.60682 18.2873 10.081 18.5952 10.3582C18.7178 10.4686 18.8341 10.5782 18.9442 10.6859C19.4237 11.1555 19.7822 11.589 20.0189 11.9022C20.0448 11.9364 20.0691 11.9691 20.092 12.0002C20.0247 12.0918 19.9446 12.197 19.8518 12.3129C19.5014 12.7509 18.9735 13.3376 18.2699 13.924C16.8634 15.0961 14.7774 16.2502 12 16.2502C11.5858 16.2502 11.25 16.586 11.25 17.0002C11.25 17.4144 11.5858 17.7502 12 17.7502C15.2226 17.7502 17.6366 16.4043 19.2301 15.0764C20.0265 14.4128 20.6236 13.7495 21.0232 13.25C21.2233 12.9998 21.3748 12.7895 21.4779 12.6392C21.5295 12.564 21.569 12.5036 21.5965 12.4606C21.6023 12.4516 21.6076 12.4433 21.6123 12.4359C21.6188 12.4255 21.6243 12.4167 21.6288 12.4094L21.6382 12.3942L21.6412 12.3892L21.6428 12.3867C21.7853 12.1492 21.7856 11.8518 21.6431 11.6143L21 12.0002C21.6431 11.6143 21.6425 11.6134 21.6425 11.6133L21.6416 11.6119L21.6394 11.6082L21.6326 11.5971L21.6099 11.5607C21.5907 11.5303 21.5633 11.4878 21.5277 11.4346C21.4565 11.3283 21.3525 11.1789 21.2155 10.9977C20.9419 10.6357 20.5349 10.1442 19.9937 9.61422C19.8692 9.49235 19.7376 9.36837 19.5988 9.24339ZM21 12.0002L21.6428 12.3867C21.6429 12.3864 21.6431 12.3861 21 12.0002Z\" fill=\"currentColor\"/>\n </svg>\n `,\n eye: `\n <svg width=\"1em\" height=\"1em\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M4.14838 12.3172C4.0542 12.1994 3.97317 12.0926 3.90533 12C3.97317 11.9074 4.0542 11.8006 4.14838 11.6828C4.49853 11.2446 5.02627 10.6584 5.72985 10.0727C7.13607 8.90197 9.22211 7.75 12 7.75C9.65279 7.75 7.75 9.65279 7.75 12C7.75 14.3472 9.65279 16.25 12 16.25C9.22211 16.25 7.13607 15.098 5.72985 13.9273C5.02627 13.3416 4.49853 12.7554 4.14838 12.3172ZM12 16.25C14.3472 16.25 16.25 14.3472 16.25 12C16.25 9.65279 14.3472 7.75 12 7.75C14.7779 7.75 16.8639 8.90197 18.2701 10.0727C18.9737 10.6584 19.5015 11.2446 19.8516 11.6828C19.9458 11.8006 20.0268 11.9074 20.0947 12C20.0268 12.0926 19.9458 12.1994 19.8516 12.3172C19.5015 12.7554 18.9737 13.3416 18.2701 13.9273C16.8639 15.098 14.7779 16.25 12 16.25ZM12 6.25C8.77789 6.25 6.36393 7.59303 4.77014 8.91985C3.97373 9.58286 3.37647 10.246 2.97662 10.7463C2.77639 10.9968 2.6246 11.2079 2.52109 11.3596C2.46936 11.4354 2.42935 11.4969 2.4011 11.5416C2.38707 11.5638 2.37537 11.5828 2.36621 11.598C2.36186 11.6052 2.35682 11.6137 2.35187 11.6223C2.34981 11.6259 2.34523 11.6339 2.33994 11.6438C2.33787 11.6476 2.33154 11.6594 2.32419 11.6747C2.32003 11.6835 2.30949 11.7072 2.30329 11.7223C2.29144 11.7541 2.2578 11.8921 2.25 12C2.2578 12.1079 2.29144 12.2459 2.30329 12.2777C2.30949 12.2928 2.32003 12.3165 2.32419 12.3253C2.33154 12.3406 2.33787 12.3524 2.33994 12.3562C2.34523 12.3661 2.34981 12.3741 2.35187 12.3777C2.35682 12.3863 2.36186 12.3948 2.36621 12.402C2.37537 12.4172 2.38707 12.4362 2.4011 12.4584C2.42935 12.5031 2.46936 12.5646 2.52109 12.6404C2.6246 12.7921 2.77639 13.0032 2.97662 13.2537C3.37647 13.754 3.97373 14.4171 4.77015 15.0802C6.36393 16.407 8.77789 17.75 12 17.75C15.2221 17.75 17.6361 16.407 19.2299 15.0802C20.0263 14.4171 20.6235 13.754 21.0234 13.2537C21.2236 13.0032 21.3754 12.7921 21.4789 12.6404C21.5306 12.5646 21.5706 12.5031 21.5989 12.4584C21.6129 12.4362 21.6246 12.4172 21.6338 12.402L21.6391 12.3931L21.6481 12.3777C21.6502 12.3741 21.6548 12.3661 21.6601 12.3562C21.6621 12.3524 21.6685 12.3406 21.6758 12.3253C21.68 12.3165 21.6905 12.2928 21.6967 12.2777C21.7086 12.2459 21.7422 12.1079 21.75 12C21.7422 11.8921 21.7086 11.7541 21.6967 11.7223C21.6905 11.7072 21.68 11.6835 21.6758 11.6747C21.6685 11.6594 21.6621 11.6476 21.6601 11.6438C21.6548 11.6339 21.6502 11.6259 21.6481 11.6223C21.6457 11.6181 21.6433 11.614 21.6409 11.61C21.6384 11.6058 21.636 11.6017 21.6338 11.598C21.6246 11.5828 21.6129 11.5638 21.5989 11.5416C21.5706 11.4969 21.5306 11.4354 21.4789 11.3596C21.3754 11.2079 21.2236 10.9968 21.0234 10.7463C20.6235 10.246 20.0263 9.58286 19.2299 8.91985C17.6361 7.59303 15.2221 6.25 12 6.25ZM9.25 12C9.25 10.4812 10.4812 9.25 12 9.25C13.5188 9.25 14.75 10.4812 14.75 12C14.75 13.5188 13.5188 14.75 12 14.75C10.4812 14.75 9.25 13.5188 9.25 12Z\" fill=\"currentColor\"/>\n </svg>\n `,\n 'information-square-fill': `\n <svg width=\"1em\" height=\"1em\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M3.25 4C3.25 3.58579 3.58579 3.25 4 3.25H20C20.4142 3.25 20.75 3.58579 20.75 4V20C20.75 20.4142 20.4142 20.75 20 20.75H4C3.58579 20.75 3.25 20.4142 3.25 20V4ZM11 7.75C11 7.19772 11.4477 6.75 12 6.75C12.5523 6.75 13 7.19772 13 7.75C13 8.30228 12.5523 8.75 12 8.75C11.4477 8.75 11 8.30228 11 7.75ZM9.75 10.75C9.75 10.3358 10.0858 10 10.5 10H12C12.4142 10 12.75 10.3358 12.75 10.75V15.5H13.5C13.9142 15.5 14.25 15.8358 14.25 16.25C14.25 16.6642 13.9142 17 13.5 17H12H10.5C10.0858 17 9.75 16.6642 9.75 16.25C9.75 15.8358 10.0858 15.5 10.5 15.5H11.25V11.5H10.5C10.0858 11.5 9.75 11.1642 9.75 10.75Z\" fill=\"currentColor\"/>\n </svg>\n `,\n 'padlock-locked-fill': `\n <svg width=\"1em\" height=\"1em\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M12 2.25C9.37665 2.25 7.25 4.37665 7.25 7V9.25H7C6.0335 9.25 5.25 10.0335 5.25 11V20C5.25 20.4142 5.58579 20.75 6 20.75H18C18.4142 20.75 18.75 20.4142 18.75 20V11C18.75 10.0335 17.9665 9.25 17 9.25H16.75V7C16.75 4.37665 14.6234 2.25 12 2.25ZM15.25 9.25V7C15.25 5.20507 13.7949 3.75 12 3.75C10.2051 3.75 8.75 5.20507 8.75 7V9.25H15.25ZM12 13C11.1716 13 10.5 13.6716 10.5 14.5C10.5 15.0552 10.8016 15.54 11.25 15.7993V17C11.25 17.4142 11.5858 17.75 12 17.75C12.4142 17.75 12.75 17.4142 12.75 17V15.7993C13.1984 15.54 13.5 15.0552 13.5 14.5C13.5 13.6716 12.8284 13 12 13Z\" fill=\"currentColor\"/>\n </svg>\n `,\n xmark: `\n <svg width=\"1em\" height=\"1em\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M6.53033 5.46967C6.23744 5.17678 5.76256 5.17678 5.46967 5.46967C5.17678 5.76256 5.17678 6.23744 5.46967 6.53033L10.9393 12L5.46967 17.4697C5.17678 17.7626 5.17678 18.2374 5.46967 18.5303C5.76256 18.8232 6.23744 18.8232 6.53033 18.5303L12 13.0607L17.4697 18.5303C17.7626 18.8232 18.2374 18.8232 18.5303 18.5303C18.8232 18.2374 18.8232 17.7626 18.5303 17.4697L13.0607 12L18.5303 6.53033C18.8232 6.23744 18.8232 5.76256 18.5303 5.46967C18.2374 5.17678 17.7626 5.17678 17.4697 5.46967L12 10.9393L6.53033 5.46967Z\" fill=\"currentColor\"/>\n </svg>\n `,\n};\n","import { customElement, property, state } from 'lit/decorators.js';\nimport { css, type HTMLTemplateResult, LitElement } from 'lit';\nimport { styled } from '../../mixins/tailwind.mixin';\nimport { watch } from '../../internal/watch.ts';\nimport { isTemplateResult } from 'lit/directive-helpers.js';\nimport type { MidIconName } from '../../types/icon-name';\nimport { systemIcons } from './system.icon-library.ts';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'mid-icon': MinidIcon;\n }\n}\n\nconst styles = [\n css`\n :host {\n display: inline-flex;\n width: 1em;\n height: 1em;\n box-sizing: content-box !important;\n }\n\n svg {\n width: 100%;\n height: 100%;\n display: block;\n }\n `,\n];\n\nconst CACHEABLE_ERROR = Symbol();\nconst RETRYABLE_ERROR = Symbol();\ntype SVGResult =\n | HTMLTemplateResult\n | SVGSVGElement\n | typeof RETRYABLE_ERROR\n | typeof CACHEABLE_ERROR;\n\nlet parser: DOMParser;\nconst iconCache = new Map<string, Promise<SVGResult>>();\n\n/**\n *\n * Size and color can be adjusted with `font-size` and `color` css properties\n *\n * @event mid-load - Emitted when the icon has loaded\n * @event mid-error - Emitted when the icon fails to load\n */\n@customElement('mid-icon')\nexport class MinidIcon extends styled(LitElement, styles) {\n @state()\n private svg: SVGElement | HTMLTemplateResult | null = null;\n\n /**\n * The name of the icon to draw. Available names depend on the icon library being used.\n * Preview default icons [here](https://aksel.nav.no/ikoner)\n * @type string\n */\n @property({ reflect: true })\n name?: MidIconName | (string & {}); // weird typing makes sure we have both intellisense and ability to input any string\n\n /**\n * An external URL of an SVG file. Be sure you trust the content you are including, as it will be executed as code and\n * can result in XSS attacks.\n */\n @property()\n src?: string;\n\n /**\n * An alternate description to use for assistive devices. If omitted, the icon will be considered presentational and\n * ignored by assistive devices.\n */\n @property()\n alt?: string;\n\n /**\n * The name of a registered custom icon library.\n * @default nav-aksel\n */\n @property()\n library: 'system' | 'country' | 'nav-aksel' = 'nav-aksel';\n\n private hasRendered = false;\n\n private updateAccessibilityAttributes() {\n if (typeof this.alt === 'string' && this.alt.length > 0) {\n this.setAttribute('role', 'img');\n this.setAttribute('aria-label', this.alt);\n this.removeAttribute('aria-hidden');\n } else {\n this.removeAttribute('role');\n this.removeAttribute('aria-label');\n this.setAttribute('aria-hidden', 'true');\n }\n }\n\n /**\n * Given a URL, this function returns the resulting SVG element or an appropriate error symbol.\n */\n private async resolveIcon(url: string): Promise<SVGResult> {\n let svgString = '';\n\n if (url.startsWith('data:image/svg+xml')) {\n svgString = decodeURIComponent(url);\n } else {\n let fileData: Response;\n try {\n fileData = await fetch(url, { mode: 'cors' });\n\n if (!fileData.ok) {\n return fileData.status === 410 ? CACHEABLE_ERROR : RETRYABLE_ERROR;\n }\n } catch {\n return RETRYABLE_ERROR;\n }\n svgString = await fileData.text();\n }\n\n try {\n const div = document.createElement('div');\n div.innerHTML = svgString;\n\n const svg = div.firstElementChild;\n if (svg?.tagName?.toLowerCase() !== 'svg') {\n return CACHEABLE_ERROR;\n }\n\n if (!parser) {\n parser = new DOMParser();\n }\n const doc = parser.parseFromString(svg.outerHTML, 'text/html');\n\n const svgEl = doc.body.querySelector('svg');\n if (!svgEl) {\n return CACHEABLE_ERROR;\n }\n\n svgEl.part.add('svg');\n\n return document.adoptNode(svgEl);\n } catch {\n return CACHEABLE_ERROR;\n }\n }\n\n firstUpdated() {\n this.hasRendered = true;\n this.updateAccessibilityAttributes();\n this.setIcon();\n }\n\n @watch('alt')\n handleLabelChange() {\n this.updateAccessibilityAttributes();\n }\n\n @watch(['name', 'src', 'library'])\n async setIcon() {\n if (!this.library && !this.name && !this.src) {\n this.svg = null;\n return;\n }\n\n let iconResolver = iconCache.get(`${this.library}-${this.name}`);\n const iconKey = `${this.library}-${this.name}`;\n if (!iconResolver) {\n let svgUrl: string;\n if (this.src) {\n iconResolver = this.resolveIcon(this.src);\n iconCache.set(iconKey, iconResolver);\n } else if (this.library === 'nav-aksel') {\n svgUrl = `/icons/${this.name}.svg`;\n iconResolver = this.resolveIcon(svgUrl);\n iconCache.set(iconKey, iconResolver);\n } else if (this.library === 'country') {\n svgUrl = `/flags/${this.name}.svg`;\n iconResolver = this.resolveIcon(svgUrl);\n iconCache.set(iconKey, iconResolver);\n } else if (this.library === 'system') {\n svgUrl = `data:image/svg+xml,${encodeURIComponent(systemIcons[this.name as keyof typeof systemIcons])}`;\n iconResolver = this.resolveIcon(svgUrl);\n iconCache.set(iconKey, iconResolver);\n }\n }\n\n // If we haven't rendered yet, exit early. This avoids unnecessary work due to watching multiple props.\n if (!this.hasRendered) {\n return;\n }\n\n const svg = await iconResolver;\n\n if (!svg) {\n return;\n }\n\n if (svg === RETRYABLE_ERROR) {\n iconCache.delete(iconKey);\n }\n\n if (iconKey !== `${this.library}-${this.name}`) {\n // If the url has changed while fetching the icon, ignore this request\n return;\n }\n\n if (isTemplateResult(svg)) {\n this.svg = svg;\n\n return;\n }\n\n switch (svg) {\n case RETRYABLE_ERROR:\n case CACHEABLE_ERROR:\n this.svg = null;\n this.dispatchEvent(\n new Event('mid-error', { bubbles: true, composed: true })\n );\n break;\n default:\n this.svg = svg.cloneNode(true) as SVGElement;\n this.dispatchEvent(\n new Event('mid-load', { bubbles: true, composed: true })\n );\n }\n }\n\n protected render() {\n return this.svg;\n }\n}\n"],"names":[],"mappings":";;;;;AAOO,MAAM,cAAc;AAAA,EACzB,iBAAiB;AAAA;AAAA;AAAA;AAAA;AAAA,EAKjB,oBAAoB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMpB,4BAA4B;AAAA;AA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AA;AAAA,EADC,SAAS,EAAE,SAAS,KAAA,CAAM;AAAA,GAThB,UAUX,WAAA,QAAA,CAAA;AAOA,gBAAA;AAAA,EADC,SAAA;AAAS,GAhBC,UAiBX,WAAA,OAAA,CAAA;AAOA,gBAAA;AAAA,EADC,SAAA;AAAS,GAvBC,UAwBX,WAAA,OAAA,CAAA;AAOA,gBAAA;AAAA,EADC,SAAA;AAAS,GA9BC,UA+BX,WAAA,WAAA,CAAA;AAwEA,gBAAA;AAAA,EADC,MAAM,KAAK;AAAA,GAtGD,UAuGX,WAAA,qBAAA,CAAA;AAKM,gBAAA;AAAA,EADL,MAAM,CAAC,QAAQ,OAAO,SAAS,CAAC;AAAA,GA3GtB,UA4GL,WAAA,WAAA,CAAA;AA5GK,YAAN,gBAAA;AAAA,EADN,cAAc,UAAU;AAAA,GACZ,SAAA;"}
|
|
@@ -22,7 +22,7 @@ export declare class MinidLabel extends MinidLabel_base {
|
|
|
22
22
|
* @default 'medium'
|
|
23
23
|
*/
|
|
24
24
|
weight: 'medium' | 'normal' | 'semibold';
|
|
25
|
-
render(): import('lit
|
|
25
|
+
render(): import('lit').TemplateResult<1>;
|
|
26
26
|
}
|
|
27
27
|
export {};
|
|
28
28
|
//# sourceMappingURL=label.component.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"label.component.d.ts","sourceRoot":"","sources":["../../src/components/label.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,UAAU,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"label.component.d.ts","sourceRoot":"","sources":["../../src/components/label.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,UAAU,EAAE,MAAM,KAAK,CAAC;AAKvC,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,WAAW,EAAE,UAAU,CAAC;KACzB;CACF;;AAED,qBACa,UAAW,SAAQ,eAAkB;IAChD;;;OAGG;IAEH,IAAI,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAQ;IAGvC,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;;OAGG;IAEH,OAAO,UAAS;IAEhB;;;OAGG;IAEH,MAAM,EAAE,QAAQ,GAAG,QAAQ,GAAG,UAAU,CAAY;IAE3C,MAAM;CAYhB"}
|
package/dist/components/label.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { LitElement, html } from "lit";
|
|
2
2
|
import { property, customElement } from "lit/decorators.js";
|
|
3
|
-
import { classMap } from "lit/directives/class-map.js";
|
|
4
3
|
import { ifDefined } from "lit/directives/if-defined.js";
|
|
5
4
|
import { styled } from "../mixins/tailwind.mixin.js";
|
|
6
5
|
var __defProp = Object.defineProperty;
|
|
@@ -24,17 +23,9 @@ let MinidLabel = class extends styled(LitElement) {
|
|
|
24
23
|
return html`
|
|
25
24
|
<label
|
|
26
25
|
for=${ifDefined(this.for)}
|
|
27
|
-
class
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
"fds-label--xs": this.size === "xs",
|
|
31
|
-
"fds-label--sm": this.size === "sm",
|
|
32
|
-
"fds-label--md": this.size === "md",
|
|
33
|
-
"fds-label--lg": this.size === "lg",
|
|
34
|
-
"fds-label--medium-weight": this.weight === "medium",
|
|
35
|
-
"fds-label--regular-weight": this.weight === "normal",
|
|
36
|
-
"fds-label--semibold-weight": this.weight === "semibold"
|
|
37
|
-
})}
|
|
26
|
+
class="ds-label"
|
|
27
|
+
data-weight=${this.weight}
|
|
28
|
+
data-size=${this.size}
|
|
38
29
|
>
|
|
39
30
|
<slot></slot>
|
|
40
31
|
</label>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"label.js","sources":["../../src/components/label.component.ts"],"sourcesContent":["import { html, LitElement } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport {
|
|
1
|
+
{"version":3,"file":"label.js","sources":["../../src/components/label.component.ts"],"sourcesContent":["import { html, LitElement } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { styled } from '../mixins/tailwind.mixin';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'mid-label': MinidLabel;\n }\n}\n\n@customElement('mid-label')\nexport class MinidLabel extends styled(LitElement) {\n /**\n * Font size\n * @default 'md'\n */\n @property()\n size: 'xs' | 'sm' | 'md' | 'lg' = 'md';\n\n @property()\n for?: string;\n\n /**\n * Add margin below element\n * @default false\n */\n @property({ type: Boolean })\n spacing = false;\n\n /**\n * Font weight\n * @default 'medium'\n */\n @property()\n weight: 'medium' | 'normal' | 'semibold' = 'medium';\n\n override render() {\n return html`\n <label\n for=${ifDefined(this.for)}\n class=\"ds-label\"\n data-weight=${this.weight}\n data-size=${this.size}\n >\n <slot></slot>\n </label>\n `;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAYO,IAAM,aAAN,cAAyB,OAAO,UAAU,EAAE;AAAA,EAA5C,cAAA;AAAA,UAAA,GAAA,SAAA;AAML,SAAA,OAAkC;AAUlC,SAAA,UAAU;AAOV,SAAA,SAA2C;AAAA,EAAA;AAAA,EAElC,SAAS;AAChB,WAAO;AAAA;AAAA,cAEG,UAAU,KAAK,GAAG,CAAC;AAAA;AAAA,sBAEX,KAAK,MAAM;AAAA,oBACb,KAAK,IAAI;AAAA;AAAA;AAAA;AAAA;AAAA,EAK3B;AACF;AA/BE,gBAAA;AAAA,EADC,SAAA;AAAS,GALC,WAMX,WAAA,QAAA,CAAA;AAGA,gBAAA;AAAA,EADC,SAAA;AAAS,GARC,WASX,WAAA,OAAA,CAAA;AAOA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,QAAA,CAAS;AAAA,GAfhB,WAgBX,WAAA,WAAA,CAAA;AAOA,gBAAA;AAAA,EADC,SAAA;AAAS,GAtBC,WAuBX,WAAA,UAAA,CAAA;AAvBW,aAAN,gBAAA;AAAA,EADN,cAAc,WAAW;AAAA,GACb,UAAA;"}
|
|
@@ -8,7 +8,7 @@ declare const MinidLink_base: typeof LitElement;
|
|
|
8
8
|
export declare class MinidLink extends MinidLink_base {
|
|
9
9
|
href?: string;
|
|
10
10
|
target?: string;
|
|
11
|
-
render(): import('lit
|
|
11
|
+
render(): import('lit').TemplateResult<1>;
|
|
12
12
|
}
|
|
13
13
|
export {};
|
|
14
14
|
//# sourceMappingURL=link.component.d.ts.map
|
package/dist/components/link.js
CHANGED
|
@@ -16,7 +16,7 @@ let MinidLink = class extends styled(LitElement) {
|
|
|
16
16
|
render() {
|
|
17
17
|
return html`
|
|
18
18
|
<a
|
|
19
|
-
class="
|
|
19
|
+
class="ds-link"
|
|
20
20
|
href=${ifDefined(this.href)}
|
|
21
21
|
target=${ifDefined(this.target)}
|
|
22
22
|
>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"link.js","sources":["../../src/components/link.component.ts"],"sourcesContent":["import { html, LitElement } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { styled } from '../mixins/tailwind.mixin';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'mid-link': MinidLink;\n }\n}\n\n@customElement('mid-link')\nexport class MinidLink extends styled(LitElement) {\n @property()\n href?: string;\n\n @property()\n target?: string;\n\n override render() {\n return html`\n <a\n class=\"
|
|
1
|
+
{"version":3,"file":"link.js","sources":["../../src/components/link.component.ts"],"sourcesContent":["import { html, LitElement } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { styled } from '../mixins/tailwind.mixin';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'mid-link': MinidLink;\n }\n}\n\n@customElement('mid-link')\nexport class MinidLink extends styled(LitElement) {\n @property()\n href?: string;\n\n @property()\n target?: string;\n\n override render() {\n return html`\n <a\n class=\"ds-link\"\n href=${ifDefined(this.href)}\n target=${ifDefined(this.target)}\n >\n <slot></slot>\n </a>\n `;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAYO,IAAM,YAAN,cAAwB,OAAO,UAAU,EAAE;AAAA,EAOvC,SAAS;AAChB,WAAO;AAAA;AAAA;AAAA,eAGI,UAAU,KAAK,IAAI,CAAC;AAAA,iBAClB,UAAU,KAAK,MAAM,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA,EAKrC;AACF;AAhBE,gBAAA;AAAA,EADC,SAAA;AAAS,GADC,UAEX,WAAA,QAAA,CAAA;AAGA,gBAAA;AAAA,EADC,SAAA;AAAS,GAJC,UAKX,WAAA,UAAA,CAAA;AALW,YAAN,gBAAA;AAAA,EADN,cAAc,UAAU;AAAA,GACZ,SAAA;"}
|
|
@@ -30,7 +30,7 @@ export declare class MinidMenuItem extends MinidMenuItem_base {
|
|
|
30
30
|
handleHostFocus(): void;
|
|
31
31
|
focus(): void;
|
|
32
32
|
setActive(active: boolean): void;
|
|
33
|
-
render(): import('lit
|
|
33
|
+
render(): import('lit').TemplateResult<1>;
|
|
34
34
|
}
|
|
35
35
|
export {};
|
|
36
36
|
//# sourceMappingURL=menu-item.component.d.ts.map
|
|
@@ -52,7 +52,7 @@ export declare class MinidMenu extends MinidMenu_base {
|
|
|
52
52
|
*/
|
|
53
53
|
setCurrentItem(item: MinidMenuItem): void;
|
|
54
54
|
focusSearchField(): void;
|
|
55
|
-
render(): import('lit
|
|
55
|
+
render(): import('lit').TemplateResult<1>;
|
|
56
56
|
}
|
|
57
57
|
export {};
|
|
58
58
|
//# sourceMappingURL=menu.component.d.ts.map
|
|
@@ -22,7 +22,7 @@ export declare class MinidParagraph extends MinidParagraph_base {
|
|
|
22
22
|
* @default false
|
|
23
23
|
*/
|
|
24
24
|
spacing: boolean;
|
|
25
|
-
render(): import('lit
|
|
25
|
+
render(): import('lit').TemplateResult<1>;
|
|
26
26
|
}
|
|
27
27
|
export {};
|
|
28
28
|
//# sourceMappingURL=paragraph.component.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paragraph.component.d.ts","sourceRoot":"","sources":["../../src/components/paragraph.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,UAAU,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"paragraph.component.d.ts","sourceRoot":"","sources":["../../src/components/paragraph.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,UAAU,EAAE,MAAM,KAAK,CAAC;AAIvC,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,eAAe,EAAE,cAAc,CAAC;KACjC;CACF;;AAED;;GAEG;AACH,qBACa,cAAe,SAAQ,mBAAkB;IACpD;;;;;;OAMG;IAEH,IAAI,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAQ;IAEvC;;;OAGG;IAEH,OAAO,UAAS;IAEP,MAAM;CAQhB"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { LitElement, html } from "lit";
|
|
2
2
|
import { property, customElement } from "lit/decorators.js";
|
|
3
|
-
import { classMap } from "lit/directives/class-map.js";
|
|
4
3
|
import { styled } from "../mixins/tailwind.mixin.js";
|
|
5
4
|
var __defProp = Object.defineProperty;
|
|
6
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -20,13 +19,8 @@ let MinidParagraph = class extends styled(LitElement) {
|
|
|
20
19
|
}
|
|
21
20
|
render() {
|
|
22
21
|
return html`<p
|
|
23
|
-
class="
|
|
24
|
-
|
|
25
|
-
"text-body-xs": this.size === "xs",
|
|
26
|
-
"text-body-sm": this.size === "sm",
|
|
27
|
-
"text-body-md": this.size === "md",
|
|
28
|
-
"text-body-lg": this.size === "lg"
|
|
29
|
-
})}"
|
|
22
|
+
class="ds-paragraph"
|
|
23
|
+
data-size=${this.size}
|
|
30
24
|
>
|
|
31
25
|
<slot></slot>
|
|
32
26
|
</p> `;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paragraph.js","sources":["../../src/components/paragraph.component.ts"],"sourcesContent":["import { html, LitElement } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport {
|
|
1
|
+
{"version":3,"file":"paragraph.js","sources":["../../src/components/paragraph.component.ts"],"sourcesContent":["import { html, LitElement } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { styled } from '../mixins/tailwind.mixin';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'mid-paragraph': MinidParagraph;\n }\n}\n\n/**\n * A paragraph\n */\n@customElement('mid-paragraph')\nexport class MinidParagraph extends styled(LitElement) {\n /**\n * `'xs' = 14px`\n * `'sm' = 16px`\n * `'md' = 18px`\n * `'lg' = 21px`\n * @default 'md'\n */\n @property()\n size: 'xs' | 'sm' | 'md' | 'lg' = 'md';\n\n /**\n * Add margin below element\n * @default false\n */\n @property({ type: Boolean })\n spacing = false;\n\n override render() {\n return html`<p\n class=\"ds-paragraph\"\n data-size=${this.size}\n >\n <slot></slot>\n </p> `;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;AAcO,IAAM,iBAAN,cAA6B,OAAO,UAAU,EAAE;AAAA,EAAhD,cAAA;AAAA,UAAA,GAAA,SAAA;AASL,SAAA,OAAkC;AAOlC,SAAA,UAAU;AAAA,EAAA;AAAA,EAED,SAAS;AAChB,WAAO;AAAA;AAAA,kBAEO,KAAK,IAAI;AAAA;AAAA;AAAA;AAAA,EAIzB;AACF;AAjBE,gBAAA;AAAA,EADC,SAAA;AAAS,GARC,eASX,WAAA,QAAA,CAAA;AAOA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,QAAA,CAAS;AAAA,GAfhB,eAgBX,WAAA,WAAA,CAAA;AAhBW,iBAAN,gBAAA;AAAA,EADN,cAAc,eAAe;AAAA,GACjB,cAAA;"}
|
|
@@ -5,7 +5,8 @@ declare global {
|
|
|
5
5
|
'mid-phone-input': MinidPhoneInput;
|
|
6
6
|
}
|
|
7
7
|
}
|
|
8
|
-
|
|
8
|
+
type PhoneAutocomplete = 'tel' | 'tel-national';
|
|
9
|
+
declare const MinidPhoneInput_base: import('../types/mixin-constructor.js').Constructor<import('../types/form-control.js').FormControlInterface> & typeof LitElement;
|
|
9
10
|
/**
|
|
10
11
|
* @event {Event} mid-country-click - Emitted when the country button is clicked
|
|
11
12
|
* @event {Event} mid-change - Emitted when the value is modified by the user
|
|
@@ -20,6 +21,9 @@ declare const MinidPhoneInput_base: import('../types/mixin-constructor').Constru
|
|
|
20
21
|
* @part input - Select the phone number input
|
|
21
22
|
*/
|
|
22
23
|
export declare class MinidPhoneInput extends MinidPhoneInput_base {
|
|
24
|
+
private readonly inputId;
|
|
25
|
+
private readonly validationId;
|
|
26
|
+
private readonly labelId;
|
|
23
27
|
private formatter;
|
|
24
28
|
private skipCountryUpdate;
|
|
25
29
|
private currentEvent;
|
|
@@ -52,10 +56,23 @@ export declare class MinidPhoneInput extends MinidPhoneInput_base {
|
|
|
52
56
|
* The country selected. A two letter ISO country code like: `"NO"`
|
|
53
57
|
*/
|
|
54
58
|
country?: CountryCode;
|
|
59
|
+
/**
|
|
60
|
+
* Controls the native browser autofill token used for the phone number input.
|
|
61
|
+
*
|
|
62
|
+
* `tel` expects a full phone number, including country code when available.
|
|
63
|
+
* If a value without a country code matches the selected country, the country
|
|
64
|
+
* prefix is added.
|
|
65
|
+
* `tel-national` expects the national number and prefixes the selected country.
|
|
66
|
+
*/
|
|
67
|
+
autocomplete: PhoneAutocomplete;
|
|
55
68
|
/**
|
|
56
69
|
* Activates invalid styling
|
|
57
70
|
*/
|
|
58
71
|
invalid: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Error message to display when the input is invalid, also activates invalid styling
|
|
74
|
+
*/
|
|
75
|
+
invalidmessage: string;
|
|
59
76
|
/**
|
|
60
77
|
* Makes the input required
|
|
61
78
|
*/
|
|
@@ -65,7 +82,11 @@ export declare class MinidPhoneInput extends MinidPhoneInput_base {
|
|
|
65
82
|
*/
|
|
66
83
|
readonly: boolean;
|
|
67
84
|
hasFocus: boolean;
|
|
68
|
-
static get formControlValidators(): import('../types/validator.type').Validator[];
|
|
85
|
+
static get formControlValidators(): import('../types/validator.type.js').Validator[];
|
|
86
|
+
constructor();
|
|
87
|
+
get validationTarget(): HTMLInputElement;
|
|
88
|
+
validationMessageCallback(message: string): void;
|
|
89
|
+
resetFormControl(): void;
|
|
69
90
|
handleCountryClick(): void;
|
|
70
91
|
handleCountryKeyDown(event: KeyboardEvent): void;
|
|
71
92
|
connectedCallback(): void;
|
|
@@ -75,13 +96,15 @@ export declare class MinidPhoneInput extends MinidPhoneInput_base {
|
|
|
75
96
|
private handleChange;
|
|
76
97
|
private handleKeydown;
|
|
77
98
|
private handleInput;
|
|
99
|
+
private getCountryCodePrefix;
|
|
100
|
+
private applyAutocompletePrefix;
|
|
78
101
|
private handleNewValue;
|
|
79
102
|
private valueChangeCallback;
|
|
80
103
|
private handleFocus;
|
|
81
104
|
private removePhonePrefix;
|
|
82
|
-
focus(): void;
|
|
105
|
+
focus(options?: FocusOptions): void;
|
|
83
106
|
handleCountryChange(): void;
|
|
84
|
-
render(): import('lit
|
|
107
|
+
render(): import('lit').TemplateResult<1>;
|
|
85
108
|
}
|
|
86
109
|
export {};
|
|
87
110
|
//# sourceMappingURL=phone-input.component.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"phone-input.component.d.ts","sourceRoot":"","sources":["../../src/components/phone-input.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,UAAU,EAAW,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"phone-input.component.d.ts","sourceRoot":"","sources":["../../src/components/phone-input.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,UAAU,EAAW,MAAM,KAAK,CAAC;AAKrD,OAAO,EAIL,KAAK,WAAW,EAGjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,uBAAuB,CAAC;AAe/B,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,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