@felleslosninger/minid-elements 0.0.138 → 0.0.140

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.
@@ -25,6 +25,7 @@ declare const MinidCodeInput_base: import('../types/mixin-constructor.ts').Const
25
25
  export declare class MinidCodeInput extends MinidCodeInput_base {
26
26
  private readonly hasSlotControler;
27
27
  private readonly labelId;
28
+ private readonly validationId;
28
29
  private inputElement;
29
30
  value: string;
30
31
  label: string;
@@ -1 +1 @@
1
- {"version":3,"file":"code-input.component.d.ts","sourceRoot":"","sources":["../../src/components/code-input.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,UAAU,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAQ5D,OAAO,0BAA0B,CAAC;AASlC,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,gBAAgB,EAAE,cAAc,CAAC;KAClC;CACF;;AAyFD;;;;;;;;;;;;;;;;GAgBG;AACH,qBACa,cAAe,SAAQ,mBAEnC;IACC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAwC;IACzE,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA4C;IAGpE,OAAO,CAAC,YAAY,CAAoB;IAGxC,KAAK,SAAM;IAGX,KAAK,SAAM;IAGX,IAAI,EAAE,QAAQ,GAAG,MAAM,CAAY;IAEnC;;OAEG;IAEH,SAAS,EAAE,SAAS,GAAG,MAAM,CAAa;IAE1C;;OAEG;IAEH,IAAI,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAQ;IAEhC;;OAEG;IAEH,MAAM,SAAK;IAGX,QAAQ,UAAS;IAEjB;;OAEG;IAEH,SAAS,UAAS;IAElB;;OAEG;IAEH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IAEH,cAAc,SAAM;IAEpB;;OAEG;IAEH,SAAS,UAAS;IAElB;;OAEG;IAEH,QAAQ,UAAS;IAEjB;;OAEG;IAEH,OAAO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;IAEjB;;OAEG;IAEH,SAAS,UAAS;IAElB;;OAEG;IAEH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IAEH,cAAc,SAAM;IAEpB;;OAEG;IAEH,SAAS,UAAS;IAElB;;OAEG;IAEH,QAAQ,UAAS;IAEjB;;OAEG;IAEH,OAAO,CAAC,EAAE,MAAM,CAAC;IAGjB,OAAO,CAAC,SAAS,CAAS;IAE1B,MAAM,KAAK,qBAAqB,qDAO/B;IAED,IAAI,gBAAgB,qBAEnB;IAED,SAAS,CAAC,YAAY,CAAC,kBAAkB,EAAE,cAAc,GAAG,IAAI;IAIhE,OAAO,CAAC,cAAc;IAYtB,OAAO,CAAC,WAAW;IAInB,OAAO,CAAC,UAAU;IAIlB,OAAO,CAAC,iBAAiB;IAQzB,OAAO,CAAC,WAAW;IA4BnB,OAAO,CAAC,YAAY;IASpB,OAAO,CAAC,aAAa;IAiBrB,KAAK;IAML,gBAAgB;IAKhB,KAAK,CAAC,OAAO,CAAC,EAAE,YAAY,GAAG,IAAI;IAKnC,kBAAkB;IAOT,MAAM;CA2GhB"}
@@ -1,6 +1,7 @@
1
1
  import { css, LitElement, html } from "lit";
2
2
  import { query, property, state, customElement } from "lit/decorators.js";
3
3
  import { classMap } from "lit/directives/class-map.js";
4
+ import { ifDefined } from "lit/directives/if-defined.js";
4
5
  import { live } from "lit/directives/live.js";
5
6
  import { watch } from "../internal/watch.js";
6
7
  import { FormControlMixin } from "../mixins/form-control.mixin.js";
@@ -111,6 +112,7 @@ let MinidCodeInput = class extends FormControlMixin(
111
112
  super(...arguments);
112
113
  this.hasSlotControler = new HasSlotController(this, "label");
113
114
  this.labelId = `mid-code-input-label-${nextUniqueId++}`;
115
+ this.validationId = `mid-code-input-validation-${nextUniqueId++}`;
114
116
  this.value = "";
115
117
  this.label = "";
116
118
  this.type = "number";
@@ -215,12 +217,14 @@ let MinidCodeInput = class extends FormControlMixin(
215
217
  render() {
216
218
  const hasLabelSlot = this.hasSlotControler.test("label");
217
219
  const hasLabel = !!this.label || !!hasLabelSlot;
220
+ const describedBy = this.invalidmessage ? this.validationId : void 0;
218
221
  const chars = this.value.split("");
219
222
  const displayValues = Array.from(
220
223
  { length: this.length },
221
224
  (_, i) => chars[i] || ""
222
225
  );
223
- const caretIndex = this.disabled ? -1 : this.value.length;
226
+ const isComplete = this.value.length >= this.length;
227
+ const caretIndex = this.disabled || this.length === 0 ? -1 : Math.min(this.value.length, this.length - 1);
224
228
  return html`
225
229
  <label
226
230
  id="${this.labelId}"
@@ -241,9 +245,10 @@ let MinidCodeInput = class extends FormControlMixin(
241
245
  })}"
242
246
  @click=${() => this.focus()}
243
247
  >
244
- <div part="character-boxes" class="character-boxes">
248
+ <div part="character-boxes" class="character-boxes" aria-hidden="true">
245
249
  ${displayValues.map((char, index) => {
246
- const hasCaret = this.isFocused && index === caretIndex;
250
+ const isFocusTarget = this.isFocused && index === caretIndex;
251
+ const hasCaret = isFocusTarget && !isComplete;
247
252
  return html`
248
253
  <div
249
254
  part="character-box"
@@ -258,7 +263,7 @@ let MinidCodeInput = class extends FormControlMixin(
258
263
  "text-danger-surface-active": !char && this.invalidmessage,
259
264
  "character-box--caret": hasCaret,
260
265
  "character-box--empty": !char,
261
- "focus-ring-sm": hasCaret
266
+ "focus-ring-sm": isFocusTarget
262
267
  })} size-9 rounded-md text-center font-mono"
263
268
  @click=${(e) => {
264
269
  e.stopPropagation();
@@ -276,6 +281,11 @@ let MinidCodeInput = class extends FormControlMixin(
276
281
  id="mid-code-input-hidden"
277
282
  type="${this.type}"
278
283
  aria-labelledby="${this.labelId}"
284
+ aria-describedby=${ifDefined(describedBy)}
285
+ aria-invalid=${this.invalidmessage ? "true" : "false"}
286
+ aria-errormessage=${ifDefined(
287
+ this.invalidmessage ? this.validationId : void 0
288
+ )}
279
289
  maxlength="${this.length}"
280
290
  ?autofocus="${this.autofocus}"
281
291
  ?disabled="${this.disabled}"
@@ -293,6 +303,7 @@ let MinidCodeInput = class extends FormControlMixin(
293
303
  </div>
294
304
  <div
295
305
  class="text-danger-subtle mt-2 flex gap-1"
306
+ id="${this.validationId}"
296
307
  aria-live="polite"
297
308
  ?hidden=${!this.invalidmessage}
298
309
  >
@@ -1 +1 @@
1
- {"version":3,"file":"code-input.js","sources":["../../src/components/code-input.component.ts"],"sourcesContent":["import { css, html, LitElement, PropertyValues } from 'lit';\nimport { customElement, property, query, state } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { live } from 'lit/directives/live.js';\nimport { watch } from '../internal/watch.ts';\nimport { FormControlMixin } from '../mixins/form-control.mixin.ts';\nimport { styled } from '../mixins/tailwind.mixin.ts';\nimport { HasSlotController } from '../internal/slot.ts';\nimport './icon/icon.component.ts';\nimport {\n maxLengthValidator,\n minLengthValidator,\n patternValidator,\n requiredValidator,\n} from '../mixins/validators.ts';\nimport { webOtpApiInit } from '../utilities/web-otp-api.ts';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'mid-code-input': MinidCodeInput;\n }\n}\n\nlet nextUniqueId = 0;\n\nconst styles = [\n css`\n :host {\n display: block;\n }\n\n .input-wrapper {\n position: relative;\n cursor: text;\n }\n\n .character-boxes {\n display: inline-flex;\n gap: 0.5rem; /* Corresponds to gap-2 in tailwind */\n }\n\n .character-box {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n position: relative;\n }\n\n .hidden-input {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n padding: 0;\n margin: 0;\n background: transparent;\n border: none;\n color: transparent;\n /* Hide the real caret */\n caret-color: transparent;\n font-size: 16px; /* Must be at least 16px to prevent ios from zooming in */\n /* Allow clicks to pass through to elements underneath */\n pointer-events: none;\n }\n\n .hidden-input:focus {\n outline: none;\n }\n\n .hidden-input:disabled {\n cursor: not-allowed;\n }\n\n /* Fake caret using a CSS animation */\n @keyframes blink {\n 0%,\n 100% {\n opacity: 1;\n }\n 50% {\n opacity: 0;\n }\n }\n\n .character-box--caret::after {\n content: '';\n position: absolute;\n width: 2px;\n height: 60%;\n background-color: var(--color-accent-base, blue);\n animation: blink 1s step-end infinite;\n }\n\n /* Hide placeholder circle when the caret is present */\n .character-box--caret.character-box--empty {\n color: transparent;\n }\n\n /* Hide increment/decrement buttons on inputs */\n input[type='number']::-webkit-outer-spin-button,\n input[type='number']::-webkit-inner-spin-button,\n input[type='number'] {\n -webkit-appearance: none;\n margin: 0;\n -moz-appearance: textfield !important;\n }\n `,\n];\n\n/**\n *\n * @event mid-change - Emitted when a change to the input value is comitted by the user\n * @event mid-input - Emitted when the input element recieves input\n * @event mid-complete - Emitted when all characters have been entered.\n * @event {detail: { validity: ValidityState }} mid-invalid-hide - Emitted when the error message should be hidden\n * @event {detail: { validity: ValidityState }} mid-invalid-show - Emitted when the error message should be shown\n *\n * @slot label - The input's label if you need to use HTML. Alternatively, you can use the `label` attribute.\n *\n * @csspart input-container - The wrapper around the input elements. This can be used to adjust font-size.\n * @csspart character-boxes - The container for the visual character boxes.\n * @csspart character-box - An individual character box.\n *\n * @method focus - Focuses the input element\n * @method clear - Clears the input\n */\n@customElement('mid-code-input')\nexport class MinidCodeInput extends FormControlMixin(\n styled(LitElement, styles)\n) {\n private readonly hasSlotControler = new HasSlotController(this, 'label');\n private readonly labelId = `mid-code-input-label-${nextUniqueId++}`;\n\n @query('.hidden-input')\n private inputElement!: HTMLInputElement;\n\n @property({ reflect: true })\n value = '';\n\n @property()\n label = '';\n\n @property()\n type: 'number' | 'text' = 'number';\n\n /**\n * For displaying appropriate virtual keyboard\n */\n @property()\n inputmode: 'numeric' | 'text' = 'numeric';\n\n /**\n * Adjusts the font-size of the code inputs\n */\n @property()\n size: 'sm' | 'md' | 'lg' = 'sm';\n\n /**\n * Number of input characters or digits\n */\n @property({ type: Number })\n length = 5;\n\n @property({ type: Boolean })\n disabled = false;\n\n /**\n * Focuses the first input element on page load\n */\n @property({ type: Boolean })\n autofocus = false;\n\n /**\n * The minimum length of input that will be considered valid.\n */\n @property({ type: Number })\n minlength?: number;\n\n /**\n * Error message to display when the input is invalid, also activates invalid styling\n */\n @property()\n invalidmessage = '';\n\n /**\n * Visually hides `label` (still available for screen readers)\n */\n @property({ type: Boolean })\n hidelabel = false;\n\n /**\n * Makes the input required\n */\n @property({ type: Boolean })\n required = false;\n\n /**\n * A regular expression pattern to validate input against.\n */\n @property()\n pattern?: string;\n\n @state()\n private isFocused = false;\n\n static get formControlValidators() {\n return [\n requiredValidator,\n maxLengthValidator,\n minLengthValidator,\n patternValidator,\n ];\n }\n\n get validationTarget() {\n return this.inputElement;\n }\n\n protected firstUpdated(_changedProperties: PropertyValues): void {\n webOtpApiInit(this.renderRoot);\n }\n\n private handleBoxClick(index: number) {\n if (this.disabled) {\n return;\n }\n\n // Truncate the value to the clicked position\n this.value = this.value.substring(0, index);\n\n // Focus the input to move the caret\n this.focus();\n }\n\n private handleFocus() {\n this.isFocused = true;\n }\n\n private handleBlur() {\n this.isFocused = false;\n }\n\n private handleBeforeInput(e: InputEvent) {\n if (e.inputType === 'insertText' && e.data) {\n if(this.type == \"number\" && e.data.replace(/\\D/g, '') == ''){\n e.preventDefault();\n }\n }\n }\n\n private handleInput(event: InputEvent) {\n const input = event.target as HTMLInputElement;\n let value = input.value;\n\n value = value.substring(0, this.length);\n\n if (input.value !== value) {\n input.value = value;\n }\n\n // Update the component's public `value` property if it has changed.\n if (this.value !== value) {\n this.value = value;\n this.setValue(value);\n }\n\n this.inputElement.dispatchEvent(\n new Event('mid-input', { bubbles: true, composed: true }),\n );\n\n if (this.value.length === this.length && this.value.length > 0) {\n this.inputElement.dispatchEvent(\n new Event('mid-complete', { bubbles: true, composed: true }),\n );\n }\n\n }\n\n private handleChange() {\n this.inputElement.dispatchEvent(\n new Event('mid-change', {\n bubbles: true,\n composed: true,\n }),\n );\n }\n\n private handleKeydown(event: KeyboardEvent) {\n const hasModifier =\n event.metaKey || event.ctrlKey || event.shiftKey || event.altKey;\n\n if (event.key === 'Enter' && !hasModifier) {\n // Pressing enter when focused on an input should submit the form like a native input, but we wait a tick before\n // submitting to allow users to cancel the keydown event if they need to\n setTimeout(() => {\n // When using an Input Method Editor (IME), pressing enter will cause the form to submit unexpectedly. One way\n // to check for this is to look at event.isComposing, which will be true when the IME is open.\n if (!event.defaultPrevented && !event.isComposing) {\n this.form?.requestSubmit();\n }\n });\n }\n }\n\n clear() {\n this.value = '';\n this.setValue('');\n this.invalidmessage = '';\n }\n\n resetFormControl() {\n this.clear();\n }\n\n\n focus(options?: FocusOptions): void {\n this.inputElement?.focus(options);\n }\n\n @watch('length')\n handleLengthChange() {\n if (this.value.length > this.length) {\n this.value = this.value.substring(0, this.length);\n }\n }\n\n\n override render() {\n const hasLabelSlot = this.hasSlotControler.test('label');\n const hasLabel = !!this.label || !!hasLabelSlot;\n\n const chars = this.value.split('');\n const displayValues = Array.from(\n { length: this.length },\n (_, i) => chars[i] || '',\n );\n const caretIndex = this.disabled ? -1 : this.value.length;\n\n return html`\n <label\n id=\"${this.labelId}\"\n class=\"${classMap({\n 'sr-only': this.hidelabel || !hasLabel,\n 'opacity-disabled': this.disabled,\n })} mb-2 block items-center gap-1 font-medium\"\n >\n <slot name=\"label\"> ${this.label} </slot>\n </label>\n <div\n part=\"input-container\"\n class=\"input-wrapper ${classMap({\n 'text-heading-sm': this.size === 'sm',\n 'text-heading-md': this.size === 'md',\n 'text-heading-lg': this.size === 'lg',\n 'opacity-disabled': this.disabled,\n })}\"\n @click=${() => this.focus()}\n >\n <div part=\"character-boxes\" class=\"character-boxes\">\n ${displayValues.map((char, index) => {\n const hasCaret = this.isFocused && index === caretIndex;\n return html`\n <div\n part=\"character-box\"\n class=\"character-box ${classMap({\n 'border': !this.invalidmessage,\n 'border-2': this.invalidmessage,\n 'border-neutral': !this.invalidmessage,\n 'border-danger': this.invalidmessage,\n 'bg-neutral': !this.invalidmessage,\n 'bg-danger-tinted': this.invalidmessage,\n 'text-neutral-surface-active':\n !char && !this.invalidmessage,\n 'text-danger-surface-active': !char && this.invalidmessage,\n 'character-box--caret': hasCaret,\n 'character-box--empty': !char,\n 'focus-ring-sm': hasCaret,\n })} size-9 rounded-md text-center font-mono\"\n @click=${(e: MouseEvent) => {\n e.stopPropagation();\n this.handleBoxClick(index);\n }}\n >\n ${char || '○'}\n </div>\n `;\n })}\n </div>\n <input\n class=\"hidden-input\"\n .value=\"${live(this.value)}\"\n id=\"mid-code-input-hidden\"\n type=\"${this.type}\"\n aria-labelledby=\"${this.labelId}\"\n maxlength=\"${this.length}\"\n ?autofocus=\"${this.autofocus}\"\n ?disabled=\"${this.disabled}\"\n ?required=\"${this.required}\"\n .pattern=\"${this.pattern}\"\n inputmode=\"${this.inputmode}\"\n autocomplete=\"one-time-code\"\n @beforeinput=\"${this.handleBeforeInput}\"\n @input=\"${this.handleInput}\"\n @change=\"${this.handleChange}\"\n @keydown=\"${this.handleKeydown}\"\n @focus=\"${this.handleFocus}\"\n @blur=\"${this.handleBlur}\"\n />\n </div>\n <div\n class=\"text-danger-subtle mt-2 flex gap-1\"\n aria-live=\"polite\"\n ?hidden=${!this.invalidmessage}\n >\n <mid-icon\n name=\"xmark-octagon-fill\"\n class=\"mt-1 min-h-5 min-w-5\"\n ></mid-icon>\n ${this.invalidmessage}\n </div>\n `;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAuBA,IAAI,eAAe;AAEnB,MAAM,SAAS;AAAA,EACb;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;A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;AAMA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,OAAA,CAAQ;AAAA,GAjCf,eAkCX,WAAA,UAAA,CAAA;AAGA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,QAAA,CAAS;AAAA,GApChB,eAqCX,WAAA,YAAA,CAAA;AAMA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,QAAA,CAAS;AAAA,GA1ChB,eA2CX,WAAA,aAAA,CAAA;AAMA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,OAAA,CAAQ;AAAA,GAhDf,eAiDX,WAAA,aAAA,CAAA;AAMA,gBAAA;AAAA,EADC,SAAA;AAAS,GAtDC,eAuDX,WAAA,kBAAA,CAAA;AAMA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,QAAA,CAAS;AAAA,GA5DhB,eA6DX,WAAA,aAAA,CAAA;AAMA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,QAAA,CAAS;AAAA,GAlEhB,eAmEX,WAAA,YAAA,CAAA;AAMA,gBAAA;AAAA,EADC,SAAA;AAAS,GAxEC,eAyEX,WAAA,WAAA,CAAA;AAGQ,gBAAA;AAAA,EADP,MAAA;AAAM,GA3EI,eA4EH,WAAA,aAAA,CAAA;AAqHR,gBAAA;AAAA,EADC,MAAM,QAAQ;AAAA,GAhMJ,eAiMX,WAAA,sBAAA,CAAA;AAjMW,iBAAN,gBAAA;AAAA,EADN,cAAc,gBAAgB;AAAA,GAClB,cAAA;"}
1
+ {"version":3,"file":"code-input.js","sources":["../../src/components/code-input.component.ts"],"sourcesContent":["import { css, html, LitElement, PropertyValues } from 'lit';\nimport { customElement, property, query, state } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { live } from 'lit/directives/live.js';\nimport { watch } from '../internal/watch.ts';\nimport { FormControlMixin } from '../mixins/form-control.mixin.ts';\nimport { styled } from '../mixins/tailwind.mixin.ts';\nimport { HasSlotController } from '../internal/slot.ts';\nimport './icon/icon.component.ts';\nimport {\n maxLengthValidator,\n minLengthValidator,\n patternValidator,\n requiredValidator,\n} from '../mixins/validators.ts';\nimport { webOtpApiInit } from '../utilities/web-otp-api.ts';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'mid-code-input': MinidCodeInput;\n }\n}\n\nlet nextUniqueId = 0;\n\nconst styles = [\n css`\n :host {\n display: block;\n }\n\n .input-wrapper {\n position: relative;\n cursor: text;\n }\n\n .character-boxes {\n display: inline-flex;\n gap: 0.5rem; /* Corresponds to gap-2 in tailwind */\n }\n\n .character-box {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n position: relative;\n }\n\n .hidden-input {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n padding: 0;\n margin: 0;\n background: transparent;\n border: none;\n color: transparent;\n /* Hide the real caret */\n caret-color: transparent;\n font-size: 16px; /* Must be at least 16px to prevent ios from zooming in */\n /* Allow clicks to pass through to elements underneath */\n pointer-events: none;\n }\n\n .hidden-input:focus {\n outline: none;\n }\n\n .hidden-input:disabled {\n cursor: not-allowed;\n }\n\n /* Fake caret using a CSS animation */\n @keyframes blink {\n 0%,\n 100% {\n opacity: 1;\n }\n 50% {\n opacity: 0;\n }\n }\n\n .character-box--caret::after {\n content: '';\n position: absolute;\n width: 2px;\n height: 60%;\n background-color: var(--color-accent-base, blue);\n animation: blink 1s step-end infinite;\n }\n\n /* Hide placeholder circle when the caret is present */\n .character-box--caret.character-box--empty {\n color: transparent;\n }\n\n /* Hide increment/decrement buttons on inputs */\n input[type='number']::-webkit-outer-spin-button,\n input[type='number']::-webkit-inner-spin-button,\n input[type='number'] {\n -webkit-appearance: none;\n margin: 0;\n -moz-appearance: textfield !important;\n }\n `,\n];\n\n/**\n *\n * @event mid-change - Emitted when a change to the input value is comitted by the user\n * @event mid-input - Emitted when the input element recieves input\n * @event mid-complete - Emitted when all characters have been entered.\n * @event {detail: { validity: ValidityState }} mid-invalid-hide - Emitted when the error message should be hidden\n * @event {detail: { validity: ValidityState }} mid-invalid-show - Emitted when the error message should be shown\n *\n * @slot label - The input's label if you need to use HTML. Alternatively, you can use the `label` attribute.\n *\n * @csspart input-container - The wrapper around the input elements. This can be used to adjust font-size.\n * @csspart character-boxes - The container for the visual character boxes.\n * @csspart character-box - An individual character box.\n *\n * @method focus - Focuses the input element\n * @method clear - Clears the input\n */\n@customElement('mid-code-input')\nexport class MinidCodeInput extends FormControlMixin(\n styled(LitElement, styles)\n) {\n private readonly hasSlotControler = new HasSlotController(this, 'label');\n private readonly labelId = `mid-code-input-label-${nextUniqueId++}`;\n private readonly validationId = `mid-code-input-validation-${nextUniqueId++}`;\n\n @query('.hidden-input')\n private inputElement!: HTMLInputElement;\n\n @property({ reflect: true })\n value = '';\n\n @property()\n label = '';\n\n @property()\n type: 'number' | 'text' = 'number';\n\n /**\n * For displaying appropriate virtual keyboard\n */\n @property()\n inputmode: 'numeric' | 'text' = 'numeric';\n\n /**\n * Adjusts the font-size of the code inputs\n */\n @property()\n size: 'sm' | 'md' | 'lg' = 'sm';\n\n /**\n * Number of input characters or digits\n */\n @property({ type: Number })\n length = 5;\n\n @property({ type: Boolean })\n disabled = false;\n\n /**\n * Focuses the first input element on page load\n */\n @property({ type: Boolean })\n autofocus = false;\n\n /**\n * The minimum length of input that will be considered valid.\n */\n @property({ type: Number })\n minlength?: number;\n\n /**\n * Error message to display when the input is invalid, also activates invalid styling\n */\n @property()\n invalidmessage = '';\n\n /**\n * Visually hides `label` (still available for screen readers)\n */\n @property({ type: Boolean })\n hidelabel = false;\n\n /**\n * Makes the input required\n */\n @property({ type: Boolean })\n required = false;\n\n /**\n * A regular expression pattern to validate input against.\n */\n @property()\n pattern?: string;\n\n @state()\n private isFocused = false;\n\n static get formControlValidators() {\n return [\n requiredValidator,\n maxLengthValidator,\n minLengthValidator,\n patternValidator,\n ];\n }\n\n get validationTarget() {\n return this.inputElement;\n }\n\n protected firstUpdated(_changedProperties: PropertyValues): void {\n webOtpApiInit(this.renderRoot);\n }\n\n private handleBoxClick(index: number) {\n if (this.disabled) {\n return;\n }\n\n // Truncate the value to the clicked position\n this.value = this.value.substring(0, index);\n\n // Focus the input to move the caret\n this.focus();\n }\n\n private handleFocus() {\n this.isFocused = true;\n }\n\n private handleBlur() {\n this.isFocused = false;\n }\n\n private handleBeforeInput(e: InputEvent) {\n if (e.inputType === 'insertText' && e.data) {\n if(this.type == \"number\" && e.data.replace(/\\D/g, '') == ''){\n e.preventDefault();\n }\n }\n }\n\n private handleInput(event: InputEvent) {\n const input = event.target as HTMLInputElement;\n let value = input.value;\n\n value = value.substring(0, this.length);\n\n if (input.value !== value) {\n input.value = value;\n }\n\n // Update the component's public `value` property if it has changed.\n if (this.value !== value) {\n this.value = value;\n this.setValue(value);\n }\n\n this.inputElement.dispatchEvent(\n new Event('mid-input', { bubbles: true, composed: true }),\n );\n\n if (this.value.length === this.length && this.value.length > 0) {\n this.inputElement.dispatchEvent(\n new Event('mid-complete', { bubbles: true, composed: true }),\n );\n }\n\n }\n\n private handleChange() {\n this.inputElement.dispatchEvent(\n new Event('mid-change', {\n bubbles: true,\n composed: true,\n }),\n );\n }\n\n private handleKeydown(event: KeyboardEvent) {\n const hasModifier =\n event.metaKey || event.ctrlKey || event.shiftKey || event.altKey;\n\n if (event.key === 'Enter' && !hasModifier) {\n // Pressing enter when focused on an input should submit the form like a native input, but we wait a tick before\n // submitting to allow users to cancel the keydown event if they need to\n setTimeout(() => {\n // When using an Input Method Editor (IME), pressing enter will cause the form to submit unexpectedly. One way\n // to check for this is to look at event.isComposing, which will be true when the IME is open.\n if (!event.defaultPrevented && !event.isComposing) {\n this.form?.requestSubmit();\n }\n });\n }\n }\n\n clear() {\n this.value = '';\n this.setValue('');\n this.invalidmessage = '';\n }\n\n resetFormControl() {\n this.clear();\n }\n\n\n focus(options?: FocusOptions): void {\n this.inputElement?.focus(options);\n }\n\n @watch('length')\n handleLengthChange() {\n if (this.value.length > this.length) {\n this.value = this.value.substring(0, this.length);\n }\n }\n\n\n override render() {\n const hasLabelSlot = this.hasSlotControler.test('label');\n const hasLabel = !!this.label || !!hasLabelSlot;\n const describedBy = this.invalidmessage ? this.validationId : undefined;\n\n const chars = this.value.split('');\n const displayValues = Array.from(\n { length: this.length },\n (_, i) => chars[i] || '',\n );\n const isComplete = this.value.length >= this.length;\n const caretIndex =\n this.disabled || this.length === 0\n ? -1\n : Math.min(this.value.length, this.length - 1);\n\n return html`\n <label\n id=\"${this.labelId}\"\n class=\"${classMap({\n 'sr-only': this.hidelabel || !hasLabel,\n 'opacity-disabled': this.disabled,\n })} mb-2 block items-center gap-1 font-medium\"\n >\n <slot name=\"label\"> ${this.label} </slot>\n </label>\n <div\n part=\"input-container\"\n class=\"input-wrapper ${classMap({\n 'text-heading-sm': this.size === 'sm',\n 'text-heading-md': this.size === 'md',\n 'text-heading-lg': this.size === 'lg',\n 'opacity-disabled': this.disabled,\n })}\"\n @click=${() => this.focus()}\n >\n <div part=\"character-boxes\" class=\"character-boxes\" aria-hidden=\"true\">\n ${displayValues.map((char, index) => {\n const isFocusTarget = this.isFocused && index === caretIndex;\n const hasCaret = isFocusTarget && !isComplete;\n return html`\n <div\n part=\"character-box\"\n class=\"character-box ${classMap({\n 'border': !this.invalidmessage,\n 'border-2': this.invalidmessage,\n 'border-neutral': !this.invalidmessage,\n 'border-danger': this.invalidmessage,\n 'bg-neutral': !this.invalidmessage,\n 'bg-danger-tinted': this.invalidmessage,\n 'text-neutral-surface-active':\n !char && !this.invalidmessage,\n 'text-danger-surface-active': !char && this.invalidmessage,\n 'character-box--caret': hasCaret,\n 'character-box--empty': !char,\n 'focus-ring-sm': isFocusTarget,\n })} size-9 rounded-md text-center font-mono\"\n @click=${(e: MouseEvent) => {\n e.stopPropagation();\n this.handleBoxClick(index);\n }}\n >\n ${char || '○'}\n </div>\n `;\n })}\n </div>\n <input\n class=\"hidden-input\"\n .value=\"${live(this.value)}\"\n id=\"mid-code-input-hidden\"\n type=\"${this.type}\"\n aria-labelledby=\"${this.labelId}\"\n aria-describedby=${ifDefined(describedBy)}\n aria-invalid=${this.invalidmessage ? 'true' : 'false'}\n aria-errormessage=${ifDefined(\n this.invalidmessage ? this.validationId : undefined\n )}\n maxlength=\"${this.length}\"\n ?autofocus=\"${this.autofocus}\"\n ?disabled=\"${this.disabled}\"\n ?required=\"${this.required}\"\n .pattern=\"${this.pattern}\"\n inputmode=\"${this.inputmode}\"\n autocomplete=\"one-time-code\"\n @beforeinput=\"${this.handleBeforeInput}\"\n @input=\"${this.handleInput}\"\n @change=\"${this.handleChange}\"\n @keydown=\"${this.handleKeydown}\"\n @focus=\"${this.handleFocus}\"\n @blur=\"${this.handleBlur}\"\n />\n </div>\n <div\n class=\"text-danger-subtle mt-2 flex gap-1\"\n id=\"${this.validationId}\"\n aria-live=\"polite\"\n ?hidden=${!this.invalidmessage}\n >\n <mid-icon\n name=\"xmark-octagon-fill\"\n class=\"mt-1 min-h-5 min-w-5\"\n ></mid-icon>\n ${this.invalidmessage}\n </div>\n `;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAwBA,IAAI,eAAe;AAEnB,MAAM,SAAS;AAAA,EACb;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAkFF;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
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;IAMZ,iBAAiB;IAaX,OAAO;IAsEb,SAAS,CAAC,MAAM;CAGjB"}
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
- if (typeof this.alt === "string" && this.alt.length > 0) {
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;\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AAM,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;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,EAK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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;"}
@@ -20,6 +20,9 @@ declare const MinidPhoneInput_base: import('../types/mixin-constructor').Constru
20
20
  * @part input - Select the phone number input
21
21
  */
22
22
  export declare class MinidPhoneInput extends MinidPhoneInput_base {
23
+ private readonly inputId;
24
+ private readonly validationId;
25
+ private readonly labelId;
23
26
  private formatter;
24
27
  private skipCountryUpdate;
25
28
  private currentEvent;
@@ -56,6 +59,10 @@ export declare class MinidPhoneInput extends MinidPhoneInput_base {
56
59
  * Activates invalid styling
57
60
  */
58
61
  invalid: boolean;
62
+ /**
63
+ * Error message to display when the input is invalid, also activates invalid styling
64
+ */
65
+ invalidmessage: string;
59
66
  /**
60
67
  * Makes the input required
61
68
  */
@@ -66,6 +73,10 @@ export declare class MinidPhoneInput extends MinidPhoneInput_base {
66
73
  readonly: boolean;
67
74
  hasFocus: boolean;
68
75
  static get formControlValidators(): import('../types/validator.type').Validator[];
76
+ constructor();
77
+ get validationTarget(): HTMLInputElement;
78
+ validationMessageCallback(message: string): void;
79
+ resetFormControl(): void;
69
80
  handleCountryClick(): void;
70
81
  handleCountryKeyDown(event: KeyboardEvent): void;
71
82
  connectedCallback(): void;
@@ -79,7 +90,7 @@ export declare class MinidPhoneInput extends MinidPhoneInput_base {
79
90
  private valueChangeCallback;
80
91
  private handleFocus;
81
92
  private removePhonePrefix;
82
- focus(): void;
93
+ focus(options?: FocusOptions): void;
83
94
  handleCountryChange(): void;
84
95
  render(): import('lit-html').TemplateResult<1>;
85
96
  }
@@ -1 +1 @@
1
- {"version":3,"file":"phone-input.component.d.ts","sourceRoot":"","sources":["../../src/components/phone-input.component.ts"],"names":[],"mappings":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,KAAK,EAAE,aAAa;IAQzC,iBAAiB,IAAI,IAAI;IAmBzB,IAAI,aAAa,yCAEhB;IAED,IAAI,cAAc,0CAEjB;IAED,OAAO,CAAC,UAAU;IAOlB,OAAO,CAAC,YAAY;IAUpB,OAAO,CAAC,aAAa;IAiCrB,OAAO,CAAC,WAAW;IASnB,OAAO,CAAC,cAAc;IAkBtB,OAAO,CAAC,mBAAmB,CAqBzB;IAEF,OAAO,CAAC,WAAW;IAOnB,OAAO,CAAC,iBAAiB;IAUzB,KAAK,CAAC,OAAO,CAAC,EAAE,YAAY,GAAG,IAAI;IAKnC,mBAAmB;IAmBV,MAAM;CAiHhB"}
@@ -1,6 +1,7 @@
1
1
  import { css, LitElement, nothing, html } from "lit";
2
2
  import { query, property, state, customElement } from "lit/decorators.js";
3
3
  import { classMap } from "lit/directives/class-map.js";
4
+ import { ifDefined } from "lit/directives/if-defined.js";
4
5
  import { styled } from "../mixins/tailwind.mixin.js";
5
6
  import { AsYouType, getCountryCallingCode, formatIncompletePhoneNumber, parsePhoneNumberCharacter } from "libphonenumber-js";
6
7
  import "./icon/icon.js";
@@ -26,11 +27,13 @@ const styles = [
26
27
  }
27
28
  `
28
29
  ];
30
+ let nextUniqueId = 0;
29
31
  let MinidPhoneInput = class extends FormControlMixin(
30
32
  styled(LitElement, styles)
31
33
  ) {
32
34
  constructor() {
33
- super(...arguments);
35
+ super();
36
+ this.labelId = `mid-code-input-label-${nextUniqueId++}`;
34
37
  this.formatter = new AsYouType();
35
38
  this.skipCountryUpdate = false;
36
39
  this.currentEvent = new Event("");
@@ -42,6 +45,7 @@ let MinidPhoneInput = class extends FormControlMixin(
42
45
  this.label = "";
43
46
  this.hidelabel = false;
44
47
  this.invalid = false;
48
+ this.invalidmessage = "";
45
49
  this.required = false;
46
50
  this.readonly = false;
47
51
  this.hasFocus = false;
@@ -59,10 +63,22 @@ let MinidPhoneInput = class extends FormControlMixin(
59
63
  }
60
64
  this.dispatchEvent(this.currentEvent);
61
65
  };
66
+ nextUniqueId++;
67
+ this.inputId = `mid-phone-input-input-${nextUniqueId}`;
68
+ this.validationId = `mid-phone-input-validation-${nextUniqueId}`;
62
69
  }
63
70
  static get formControlValidators() {
64
71
  return [requiredValidator];
65
72
  }
73
+ get validationTarget() {
74
+ return this.input;
75
+ }
76
+ validationMessageCallback(message) {
77
+ this.invalidmessage = message;
78
+ }
79
+ resetFormControl() {
80
+ this.invalidmessage = "";
81
+ }
66
82
  handleCountryClick() {
67
83
  this.dispatchEvent(
68
84
  new CustomEvent("mid-country-click", { composed: true, bubbles: true })
@@ -166,14 +182,8 @@ let MinidPhoneInput = class extends FormControlMixin(
166
182
  }
167
183
  return value;
168
184
  }
169
- focus() {
170
- this.input.focus();
171
- setTimeout(() => {
172
- this.input.setSelectionRange(
173
- (this.countrycode?.length ?? 0) + 1,
174
- this.input.value.length
175
- );
176
- }, 0);
185
+ focus(options) {
186
+ this.input.focus(options);
177
187
  }
178
188
  handleCountryChange() {
179
189
  if (this.skipCountryUpdate) {
@@ -195,7 +205,15 @@ let MinidPhoneInput = class extends FormControlMixin(
195
205
  const sm = false;
196
206
  const hasLabelSlot = this.hasSlotControler.test("label");
197
207
  const hasLabel = !!this.label || !!hasLabelSlot;
208
+ const hasError = this.invalid || !!this.invalidmessage;
209
+ const describedBy = this.invalidmessage ? this.validationId : void 0;
198
210
  return html`
211
+ <label
212
+ id="${this.labelId}"
213
+ class="${classMap({
214
+ "sr-only": this.hidelabel || !hasLabel
215
+ })} mb-2 block items-center gap-1 font-medium"
216
+ >
199
217
  <div
200
218
  part="field"
201
219
  class="${classMap({
@@ -205,7 +223,7 @@ let MinidPhoneInput = class extends FormControlMixin(
205
223
  })}"
206
224
  >
207
225
  <label
208
- for="input"
226
+ for="${this.inputId}"
209
227
  class="${classMap({
210
228
  "sr-only": this.hidelabel || !hasLabel
211
229
  })} mb-2 inline-flex items-center gap-1 font-medium"
@@ -246,21 +264,26 @@ let MinidPhoneInput = class extends FormControlMixin(
246
264
  </button>
247
265
 
248
266
  <input
249
- id="input"
267
+ id="${this.inputId}"
250
268
  class="${classMap({
251
- "border-neutral": !this.invalid && !this.readonly,
252
- "border-danger": this.invalid && !this.readonly,
269
+ "border-neutral": !hasError && !this.readonly,
270
+ "border-danger": hasError && !this.readonly,
253
271
  "border-neutral-subtle": this.readonly,
254
272
  "bg-neutral-surface-tinted": this.readonly,
255
273
  "bg-neutral-surface": !this.readonly,
256
- "border-2": this.invalid,
257
- border: !this.invalid
274
+ "border-2": hasError,
275
+ border: !hasError
258
276
  })} focus-visible:focus-ring grow rounded-r px-3"
259
277
  part="phone-number"
260
278
  type="tel"
261
279
  autocomplete="tel"
262
280
  ?readonly=${this.readonly}
263
281
  value=${this.value}
282
+ aria-describedby=${ifDefined(describedBy)}
283
+ aria-invalid=${hasError ? "true" : "false"}
284
+ aria-errormessage=${ifDefined(
285
+ this.invalidmessage ? this.validationId : void 0
286
+ )}
264
287
  @input=${this.handleInput}
265
288
  @focus=${this.handleFocus}
266
289
  @blur=${this.handleBlur}
@@ -268,12 +291,24 @@ let MinidPhoneInput = class extends FormControlMixin(
268
291
  @change=${this.handleChange}
269
292
  />
270
293
  </div>
294
+ <div
295
+ class="text-danger-subtle mt-2 flex gap-1"
296
+ id="${this.validationId}"
297
+ aria-live="polite"
298
+ ?hidden=${!this.invalidmessage}
299
+ >
300
+ <mid-icon
301
+ name="xmark-octagon-fill"
302
+ class="mt-1 min-h-5 min-w-5"
303
+ ></mid-icon>
304
+ ${this.invalidmessage}
305
+ </div>
271
306
  </div>
272
307
  `;
273
308
  }
274
309
  };
275
310
  __decorateClass([
276
- query("#input")
311
+ query("input")
277
312
  ], MinidPhoneInput.prototype, "input", 2);
278
313
  __decorateClass([
279
314
  property({ reflect: true })
@@ -296,6 +331,9 @@ __decorateClass([
296
331
  __decorateClass([
297
332
  property({ type: Boolean })
298
333
  ], MinidPhoneInput.prototype, "invalid", 2);
334
+ __decorateClass([
335
+ property()
336
+ ], MinidPhoneInput.prototype, "invalidmessage", 2);
299
337
  __decorateClass([
300
338
  property({ type: Boolean })
301
339
  ], MinidPhoneInput.prototype, "required", 2);
@@ -1 +1 @@
1
- {"version":3,"file":"phone-input.js","sources":["../../src/components/phone-input.component.ts"],"sourcesContent":["import { css, html, LitElement, nothing } from 'lit';\nimport { customElement, property, query, state } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { styled } from '../mixins/tailwind.mixin';\nimport {\n AsYouType,\n formatIncompletePhoneNumber,\n getCountryCallingCode,\n type CountryCode,\n parsePhoneNumberCharacter,\n} from 'libphonenumber-js';\nimport './icon/icon.component';\nimport {\n onChange,\n onKeyDown,\n templateFormatter,\n templateParser,\n} from 'input-format';\nimport { watch } from '../internal/watch';\nimport { HasSlotController } from '../internal/slot';\nimport { FormControlMixin } from '../mixins/form-control.mixin';\nimport { requiredValidator } from '../mixins/validators';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'mid-phone-input': MinidPhoneInput;\n }\n}\n\nconst styles = [\n css`\n :host {\n display: block;\n }\n `,\n];\n\n/**\n * @event {Event} mid-country-click - Emitted when the country button is clicked\n * @event {Event} mid-change - Emitted when the value is modified by the user\n * @event {Event} mid-input - Emitted after a new user input\n * @event {Event} mid-blur - Emitted after focus is moved away from input\n * @event {Event} mid-focus - Emitted after input gains focus\n *\n * @part base - Select the container outside the country button and phone number input\n * @part field - Select the container around the label and the inputs\n * @part label - Select the label element\n * @part country-button - Select the country button\n * @part input - Select the phone number input\n */\n@customElement('mid-phone-input')\nexport class MinidPhoneInput extends FormControlMixin(\n styled(LitElement, styles)\n) {\n private formatter = new AsYouType();\n private skipCountryUpdate = false; // avoids unwanted update loop\n private currentEvent = new Event(''); // the event to be emitted after value is set\n private currentTemplate = '';\n private hasSlotControler = new HasSlotController(this, 'label');\n\n @query('#input')\n input!: HTMLInputElement;\n\n /**\n * The value of the phone number in E.164 format. Example: `\"+4799999999\"`\n *\n */\n @property({ reflect: true })\n value = '';\n\n /**\n * The phone number without the country code prefix. Example: `\"99999999\"`\n */\n @property({ reflect: true })\n nationalnumber = '';\n\n /**\n * The country code of the current phone number value. Example: `\"+47\"`\n */\n @property({ reflect: true })\n countrycode = '';\n\n /**\n * Label for the phone input.\n * Passed label will be encapsulated by a label element.\n */\n @property()\n label = '';\n\n /**\n * Hide label visually. Still available for screen readers\n */\n @property({ type: Boolean })\n hidelabel = false;\n\n /**\n * The country selected. A two letter ISO country code like: `\"NO\"`\n */\n @property({ reflect: true })\n country?: CountryCode;\n\n /**\n * Activates invalid styling\n */\n @property({ type: Boolean })\n invalid = false;\n\n /**\n * Makes the input required\n */\n @property({ type: Boolean })\n required = false;\n\n /**\n * Makes the input read-only, meaning the user cannot change the value.\n */\n @property({ type: Boolean })\n readonly = false;\n\n @state()\n hasFocus = false;\n\n static get formControlValidators() {\n return [requiredValidator];\n }\n\n handleCountryClick() {\n this.dispatchEvent(\n new CustomEvent('mid-country-click', { composed: true, bubbles: true })\n );\n }\n\n handleCountryKeyDown(event: KeyboardEvent) {\n if ([' ', 'Enter'].includes(event.key)) {\n this.dispatchEvent(\n new CustomEvent('mid-country-click', { composed: true, bubbles: true })\n );\n }\n }\n\n connectedCallback(): void {\n super.connectedCallback();\n\n this.formatter.input(this.value);\n this.country = this.formatter.getCountry() ?? this.country;\n this.countrycode = this.country\n ? `+${getCountryCallingCode(this.country)}`\n : '+';\n\n this.value = formatIncompletePhoneNumber(this.value);\n this.value ||= this.countrycode;\n this.nationalnumber = this.removePhonePrefix(this.value);\n this.setValue(this.value.replaceAll(' ', ''));\n\n setTimeout(() => {\n this.input.value = `${this.countrycode} ${this.nationalnumber}`;\n });\n }\n\n get parseTemplate() {\n return templateParser(this.currentTemplate, parsePhoneNumberCharacter);\n }\n\n get formatTemplate() {\n return templateFormatter(this.currentTemplate);\n }\n\n private handleBlur() {\n this.hasFocus = false;\n this.dispatchEvent(\n new Event('mid-blur', { bubbles: true, composed: true })\n );\n }\n\n private handleChange(event: Event) {\n // Event is dispatched after value is set\n this.currentEvent = new Event('mid-change', {\n bubbles: true,\n composed: true,\n });\n\n this.handleNewValue(event);\n }\n\n private handleKeydown(event: KeyboardEvent) {\n if (event.key === 'Backspace' && this.input.selectionStart === 1) {\n // don't remove '+' symbol which is the first character\n event.preventDefault();\n return;\n }\n\n const hasModifier =\n event.metaKey || event.ctrlKey || event.shiftKey || event.altKey;\n\n // Pressing enter when focused on an input should submit the form like a native input, but we wait a tick before\n // submitting to allow users to cancel the keydown event if they need to\n if (event.key === 'Enter' && !hasModifier) {\n setTimeout(() => {\n //\n // When using an Input Method Editor (IME), pressing enter will cause the form to submit unexpectedly. One way\n // to check for this is to look at event.isComposing, which will be true when the IME is open.\n if (!event.defaultPrevented && !event.isComposing) {\n this.form.requestSubmit();\n }\n });\n return;\n }\n\n onKeyDown(\n event as any,\n this.input,\n this.parseTemplate,\n this.formatTemplate,\n this.valueChangeCallback\n );\n }\n\n private handleInput(event: InputEvent) {\n // Event is dispatched after value is set\n this.currentEvent = new Event('mid-input', {\n composed: true,\n bubbles: true,\n });\n this.handleNewValue(event);\n }\n\n private handleNewValue(event: Event) {\n this.formatter.reset();\n\n if (!this.input.value.startsWith('+')) {\n this.input.value = `+${this.input.value}`;\n }\n this.formatter.input(this.input.value);\n this.currentTemplate = this.formatter.getTemplate();\n\n onChange(\n event as any,\n this.input,\n this.parseTemplate,\n this.formatTemplate,\n this.valueChangeCallback\n );\n }\n\n private valueChangeCallback = (value: string) => {\n const country =\n value.length < 2\n ? undefined\n : (this.formatter.getCountry() ?? this.country);\n\n if (country !== this.country) {\n this.country = country;\n this.countrycode = this.country\n ? `+${getCountryCallingCode(this.country)}`\n : '+';\n this.skipCountryUpdate = true;\n }\n\n if (value !== this.value) {\n this.value = value;\n this.setValue(this.value.replaceAll(' ', ''));\n this.nationalnumber = this.removePhonePrefix(value);\n }\n\n this.dispatchEvent(this.currentEvent);\n };\n\n private handleFocus() {\n this.hasFocus = true;\n this.dispatchEvent(\n new Event('mid-focus', { composed: true, bubbles: true })\n );\n }\n\n private removePhonePrefix(value: string) {\n if (this.countrycode) {\n value = value.slice(this.countrycode.length);\n if (value[0] === ' ') {\n value = value.slice(1);\n }\n }\n return value;\n }\n\n focus() {\n this.input.focus();\n setTimeout(() => {\n this.input.setSelectionRange(\n (this.countrycode?.length ?? 0) + 1,\n this.input.value.length\n );\n }, 0);\n }\n\n @watch('country', { waitUntilFirstUpdate: true })\n handleCountryChange() {\n if (this.skipCountryUpdate) {\n this.skipCountryUpdate = false;\n return;\n }\n\n this.formatter = new AsYouType(this.country);\n this.nationalnumber = this.removePhonePrefix(this.input.value);\n\n this.countrycode = this.country\n ? `+${getCountryCallingCode(this.country)}`\n : '+';\n this.input.value = formatIncompletePhoneNumber(\n `${this.countrycode}${this.nationalnumber}`\n );\n this.input.dispatchEvent(new Event('input', { bubbles: true }));\n this.input.dispatchEvent(new Event('change', { bubbles: true }));\n }\n\n override render() {\n const lg = false;\n const md = true;\n const sm = false;\n\n const hasLabelSlot = this.hasSlotControler.test('label');\n const hasLabel = !!this.label || !!hasLabelSlot;\n\n return html`\n <div\n part=\"field\"\n class=\"${classMap({\n 'text-body-sm': sm,\n 'text-body-md': md,\n 'text-body-lg': lg,\n })}\"\n >\n <label\n for=\"input\"\n class=\"${classMap({\n 'sr-only': this.hidelabel || !hasLabel,\n })} mb-2 inline-flex items-center gap-1 font-medium\"\n >\n ${this.readonly\n ? html`<mid-icon\n class=\"size-5\"\n library=\"system\"\n name=\"padlock-locked-fill\"\n ></mid-icon>`\n : nothing}\n <slot name=\"label\"> ${this.label} </slot>\n </label>\n <div part=\"base\" class=\"flex h-12\">\n <button\n part=\"country-button\"\n aria-label=\"Open country selector\"\n class=\"${classMap({\n 'border-neutral': !this.readonly,\n 'border-neutral-subtle': this.readonly,\n 'bg-neutral-surface-tinted': this.readonly,\n 'bg-neutral-surface': !this.readonly,\n })} focus-visible:focus-ring flex h-full items-center rounded-l border border-r-0 pl-3\"\n iconstyled\n variant=\"tertiary\"\n ?disabled=${this.readonly}\n @click=${this.handleCountryClick}\n @keydown=${this.handleCountryKeyDown}\n >\n ${this.country\n ? html`\n <mid-icon\n class=\"h-4 w-6 overflow-hidden rounded\"\n library=\"country\"\n name=\"${this.country}\"\n ></mid-icon>\n `\n : html`<div\n class=\"bg-neutral-surface-active h-4 w-6 overflow-hidden rounded\"\n ></div>`}\n <mid-icon name=\"chevron-down\"></mid-icon>\n </button>\n\n <input\n id=\"input\"\n class=\"${classMap({\n 'border-neutral': !this.invalid && !this.readonly,\n 'border-danger': this.invalid && !this.readonly,\n 'border-neutral-subtle': this.readonly,\n 'bg-neutral-surface-tinted': this.readonly,\n 'bg-neutral-surface': !this.readonly,\n 'border-2': this.invalid,\n border: !this.invalid,\n })} focus-visible:focus-ring grow rounded-r px-3\"\n part=\"phone-number\"\n type=\"tel\"\n autocomplete=\"tel\"\n ?readonly=${this.readonly}\n value=${this.value}\n @input=${this.handleInput}\n @focus=${this.handleFocus}\n @blur=${this.handleBlur}\n @keydown=${this.handleKeydown}\n @change=${this.handleChange}\n />\n </div>\n </div>\n `;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AA6BA,MAAM,SAAS;AAAA,EACb;AAAA;AAAA;AAAA;AAAA;AAKF;AAgBO,IAAM,kBAAN,cAA8B;AAAA,EACnC,OAAO,YAAY,MAAM;AAC3B,EAAE;AAAA,EAFK,cAAA;AAAA,UAAA,GAAA,SAAA;AAGL,SAAQ,YAAY,IAAI,UAAA;AACxB,SAAQ,oBAAoB;AAC5B,SAAQ,eAAe,IAAI,MAAM,EAAE;AACnC,SAAQ,kBAAkB;AAC1B,SAAQ,mBAAmB,IAAI,kBAAkB,MAAM,OAAO;AAU9D,SAAA,QAAQ;AAMR,SAAA,iBAAiB;AAMjB,SAAA,cAAc;AAOd,SAAA,QAAQ;AAMR,SAAA,YAAY;AAYZ,SAAA,UAAU;AAMV,SAAA,WAAW;AAMX,SAAA,WAAW;AAGX,SAAA,WAAW;AA4HX,SAA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,gBAAA;AAAA,EADC,MAAM,WAAW,EAAE,sBAAsB,MAAM;AAAA,GAnPrC,gBAoPX,WAAA,uBAAA,CAAA;AApPW,kBAAN,gBAAA;AAAA,EADN,cAAc,iBAAiB;AAAA,GACnB,eAAA;"}
1
+ {"version":3,"file":"phone-input.js","sources":["../../src/components/phone-input.component.ts"],"sourcesContent":["import { css, html, LitElement, nothing } from 'lit';\nimport { customElement, property, query, state } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { styled } from '../mixins/tailwind.mixin';\nimport {\n AsYouType,\n formatIncompletePhoneNumber,\n getCountryCallingCode,\n type CountryCode,\n parsePhoneNumberCharacter,\n} from 'libphonenumber-js';\nimport './icon/icon.component';\nimport {\n onChange,\n onKeyDown,\n templateFormatter,\n templateParser,\n} from 'input-format';\nimport { watch } from '../internal/watch';\nimport { HasSlotController } from '../internal/slot';\nimport { FormControlMixin } from '../mixins/form-control.mixin';\nimport { requiredValidator } from '../mixins/validators';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'mid-phone-input': MinidPhoneInput;\n }\n}\n\nconst styles = [\n css`\n :host {\n display: block;\n }\n `,\n];\n\nlet nextUniqueId = 0;\n\n/**\n * @event {Event} mid-country-click - Emitted when the country button is clicked\n * @event {Event} mid-change - Emitted when the value is modified by the user\n * @event {Event} mid-input - Emitted after a new user input\n * @event {Event} mid-blur - Emitted after focus is moved away from input\n * @event {Event} mid-focus - Emitted after input gains focus\n *\n * @part base - Select the container outside the country button and phone number input\n * @part field - Select the container around the label and the inputs\n * @part label - Select the label element\n * @part country-button - Select the country button\n * @part input - Select the phone number input\n */\n@customElement('mid-phone-input')\nexport class MinidPhoneInput extends FormControlMixin(\n styled(LitElement, styles)\n) {\n private readonly inputId: string;\n private readonly validationId: string;\n private readonly labelId = `mid-code-input-label-${nextUniqueId++}`;\n private formatter = new AsYouType();\n private skipCountryUpdate = false; // avoids unwanted update loop\n private currentEvent = new Event(''); // the event to be emitted after value is set\n private currentTemplate = '';\n private hasSlotControler = new HasSlotController(this, 'label');\n\n @query('input')\n input!: HTMLInputElement;\n\n /**\n * The value of the phone number in E.164 format. Example: `\"+4799999999\"`\n *\n */\n @property({ reflect: true })\n value = '';\n\n /**\n * The phone number without the country code prefix. Example: `\"99999999\"`\n */\n @property({ reflect: true })\n nationalnumber = '';\n\n /**\n * The country code of the current phone number value. Example: `\"+47\"`\n */\n @property({ reflect: true })\n countrycode = '';\n\n /**\n * Label for the phone input.\n * Passed label will be encapsulated by a label element.\n */\n @property()\n label = '';\n\n /**\n * Hide label visually. Still available for screen readers\n */\n @property({ type: Boolean })\n hidelabel = false;\n\n /**\n * The country selected. A two letter ISO country code like: `\"NO\"`\n */\n @property({ reflect: true })\n country?: CountryCode;\n\n /**\n * Activates invalid styling\n */\n @property({ type: Boolean })\n invalid = false;\n\n /**\n * Error message to display when the input is invalid, also activates invalid styling\n */\n @property()\n invalidmessage = '';\n\n /**\n * Makes the input required\n */\n @property({ type: Boolean })\n required = false;\n\n /**\n * Makes the input read-only, meaning the user cannot change the value.\n */\n @property({ type: Boolean })\n readonly = false;\n\n @state()\n hasFocus = false;\n\n static get formControlValidators() {\n return [requiredValidator];\n }\n\n constructor() {\n super();\n nextUniqueId++;\n this.inputId = `mid-phone-input-input-${nextUniqueId}`;\n this.validationId = `mid-phone-input-validation-${nextUniqueId}`;\n }\n\n get validationTarget() {\n return this.input;\n }\n\n validationMessageCallback(message: string) {\n this.invalidmessage = message;\n }\n\n resetFormControl() {\n this.invalidmessage = '';\n }\n\n handleCountryClick() {\n this.dispatchEvent(\n new CustomEvent('mid-country-click', { composed: true, bubbles: true })\n );\n }\n\n handleCountryKeyDown(event: KeyboardEvent) {\n if ([' ', 'Enter'].includes(event.key)) {\n this.dispatchEvent(\n new CustomEvent('mid-country-click', { composed: true, bubbles: true })\n );\n }\n }\n\n connectedCallback(): void {\n super.connectedCallback();\n\n this.formatter.input(this.value);\n this.country = this.formatter.getCountry() ?? this.country;\n this.countrycode = this.country\n ? `+${getCountryCallingCode(this.country)}`\n : '+';\n\n this.value = formatIncompletePhoneNumber(this.value);\n this.value ||= this.countrycode;\n this.nationalnumber = this.removePhonePrefix(this.value);\n this.setValue(this.value.replaceAll(' ', ''));\n\n setTimeout(() => {\n this.input.value = `${this.countrycode} ${this.nationalnumber}`;\n });\n }\n\n get parseTemplate() {\n return templateParser(this.currentTemplate, parsePhoneNumberCharacter);\n }\n\n get formatTemplate() {\n return templateFormatter(this.currentTemplate);\n }\n\n private handleBlur() {\n this.hasFocus = false;\n this.dispatchEvent(\n new Event('mid-blur', { bubbles: true, composed: true })\n );\n }\n\n private handleChange(event: Event) {\n // Event is dispatched after value is set\n this.currentEvent = new Event('mid-change', {\n bubbles: true,\n composed: true,\n });\n\n this.handleNewValue(event);\n }\n\n private handleKeydown(event: KeyboardEvent) {\n if (event.key === 'Backspace' && this.input.selectionStart === 1) {\n // don't remove '+' symbol which is the first character\n event.preventDefault();\n return;\n }\n\n const hasModifier =\n event.metaKey || event.ctrlKey || event.shiftKey || event.altKey;\n\n // Pressing enter when focused on an input should submit the form like a native input, but we wait a tick before\n // submitting to allow users to cancel the keydown event if they need to\n if (event.key === 'Enter' && !hasModifier) {\n setTimeout(() => {\n //\n // When using an Input Method Editor (IME), pressing enter will cause the form to submit unexpectedly. One way\n // to check for this is to look at event.isComposing, which will be true when the IME is open.\n if (!event.defaultPrevented && !event.isComposing) {\n this.form.requestSubmit();\n }\n });\n return;\n }\n\n onKeyDown(\n event as any,\n this.input,\n this.parseTemplate,\n this.formatTemplate,\n this.valueChangeCallback\n );\n }\n\n private handleInput(event: InputEvent) {\n // Event is dispatched after value is set\n this.currentEvent = new Event('mid-input', {\n composed: true,\n bubbles: true,\n });\n this.handleNewValue(event);\n }\n\n private handleNewValue(event: Event) {\n this.formatter.reset();\n\n if (!this.input.value.startsWith('+')) {\n this.input.value = `+${this.input.value}`;\n }\n this.formatter.input(this.input.value);\n this.currentTemplate = this.formatter.getTemplate();\n\n onChange(\n event as any,\n this.input,\n this.parseTemplate,\n this.formatTemplate,\n this.valueChangeCallback\n );\n }\n\n private valueChangeCallback = (value: string) => {\n const country =\n value.length < 2\n ? undefined\n : (this.formatter.getCountry() ?? this.country);\n\n if (country !== this.country) {\n this.country = country;\n this.countrycode = this.country\n ? `+${getCountryCallingCode(this.country)}`\n : '+';\n this.skipCountryUpdate = true;\n }\n\n if (value !== this.value) {\n this.value = value;\n this.setValue(this.value.replaceAll(' ', ''));\n this.nationalnumber = this.removePhonePrefix(value);\n }\n\n this.dispatchEvent(this.currentEvent);\n };\n\n private handleFocus() {\n this.hasFocus = true;\n this.dispatchEvent(\n new Event('mid-focus', { composed: true, bubbles: true })\n );\n }\n\n private removePhonePrefix(value: string) {\n if (this.countrycode) {\n value = value.slice(this.countrycode.length);\n if (value[0] === ' ') {\n value = value.slice(1);\n }\n }\n return value;\n }\n\n focus(options?: FocusOptions): void {\n this.input.focus(options);\n }\n\n @watch('country', { waitUntilFirstUpdate: true })\n handleCountryChange() {\n if (this.skipCountryUpdate) {\n this.skipCountryUpdate = false;\n return;\n }\n\n this.formatter = new AsYouType(this.country);\n this.nationalnumber = this.removePhonePrefix(this.input.value);\n\n this.countrycode = this.country\n ? `+${getCountryCallingCode(this.country)}`\n : '+';\n this.input.value = formatIncompletePhoneNumber(\n `${this.countrycode}${this.nationalnumber}`\n );\n this.input.dispatchEvent(new Event('input', { bubbles: true }));\n this.input.dispatchEvent(new Event('change', { bubbles: true }));\n }\n\n override render() {\n const lg = false;\n const md = true;\n const sm = false;\n\n const hasLabelSlot = this.hasSlotControler.test('label');\n const hasLabel = !!this.label || !!hasLabelSlot;\n const hasError = this.invalid || !!this.invalidmessage;\n const describedBy = this.invalidmessage ? this.validationId : undefined;\n\n return html`\n <label\n id=\"${this.labelId}\"\n class=\"${classMap({\n 'sr-only': this.hidelabel || !hasLabel,\n })} mb-2 block items-center gap-1 font-medium\"\n > \n <div\n part=\"field\"\n class=\"${classMap({\n 'text-body-sm': sm,\n 'text-body-md': md,\n 'text-body-lg': lg,\n })}\"\n >\n <label\n for=\"${this.inputId}\"\n class=\"${classMap({\n 'sr-only': this.hidelabel || !hasLabel,\n })} mb-2 inline-flex items-center gap-1 font-medium\"\n >\n ${this.readonly\n ? html`<mid-icon\n class=\"size-5\"\n library=\"system\"\n name=\"padlock-locked-fill\"\n ></mid-icon>`\n : nothing}\n <slot name=\"label\"> ${this.label} </slot>\n </label>\n <div part=\"base\" class=\"flex h-12\">\n <button\n part=\"country-button\"\n aria-label=\"Open country selector\"\n class=\"${classMap({\n 'border-neutral': !this.readonly,\n 'border-neutral-subtle': this.readonly,\n 'bg-neutral-surface-tinted': this.readonly,\n 'bg-neutral-surface': !this.readonly,\n })} focus-visible:focus-ring flex h-full items-center rounded-l border border-r-0 pl-3\"\n iconstyled\n variant=\"tertiary\"\n ?disabled=${this.readonly}\n @click=${this.handleCountryClick}\n @keydown=${this.handleCountryKeyDown}\n >\n ${this.country\n ? html`\n <mid-icon\n class=\"h-4 w-6 overflow-hidden rounded\"\n library=\"country\"\n name=\"${this.country}\"\n ></mid-icon>\n `\n : html`<div\n class=\"bg-neutral-surface-active h-4 w-6 overflow-hidden rounded\"\n ></div>`}\n <mid-icon name=\"chevron-down\"></mid-icon>\n </button>\n\n <input\n id=\"${this.inputId}\"\n class=\"${classMap({\n 'border-neutral': !hasError && !this.readonly,\n 'border-danger': hasError && !this.readonly,\n 'border-neutral-subtle': this.readonly,\n 'bg-neutral-surface-tinted': this.readonly,\n 'bg-neutral-surface': !this.readonly,\n 'border-2': hasError,\n border: !hasError,\n })} focus-visible:focus-ring grow rounded-r px-3\"\n part=\"phone-number\"\n type=\"tel\"\n autocomplete=\"tel\"\n ?readonly=${this.readonly}\n value=${this.value}\n aria-describedby=${ifDefined(describedBy)}\n aria-invalid=${hasError ? 'true' : 'false'}\n aria-errormessage=${ifDefined(\n this.invalidmessage ? this.validationId : undefined\n )}\n @input=${this.handleInput}\n @focus=${this.handleFocus}\n @blur=${this.handleBlur}\n @keydown=${this.handleKeydown}\n @change=${this.handleChange}\n />\n </div>\n <div\n class=\"text-danger-subtle mt-2 flex gap-1\"\n id=\"${this.validationId}\"\n aria-live=\"polite\"\n ?hidden=${!this.invalidmessage}\n >\n <mid-icon\n name=\"xmark-octagon-fill\"\n class=\"mt-1 min-h-5 min-w-5\"\n ></mid-icon>\n ${this.invalidmessage}\n </div>\n </div>\n `;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA8BA,MAAM,SAAS;AAAA,EACb;AAAA;AAAA;AAAA;AAAA;AAKF;AAEA,IAAI,eAAe;AAgBZ,IAAM,kBAAN,cAA8B;AAAA,EACnC,OAAO,YAAY,MAAM;AAC3B,EAAE;AAAA,EAkFA,cAAc;AACZ,UAAA;AAhFF,SAAiB,UAAU,wBAAwB,cAAc;AACjE,SAAQ,YAAY,IAAI,UAAA;AACxB,SAAQ,oBAAoB;AAC5B,SAAQ,eAAe,IAAI,MAAM,EAAE;AACnC,SAAQ,kBAAkB;AAC1B,SAAQ,mBAAmB,IAAI,kBAAkB,MAAM,OAAO;AAU9D,SAAA,QAAQ;AAMR,SAAA,iBAAiB;AAMjB,SAAA,cAAc;AAOd,SAAA,QAAQ;AAMR,SAAA,YAAY;AAYZ,SAAA,UAAU;AAMV,SAAA,iBAAiB;AAMjB,SAAA,WAAW;AAMX,SAAA,WAAW;AAGX,SAAA,WAAW;AA+IX,SAAQ,sBAAsB,CAAC,UAAkB;AAC/C,YAAM,UACJ,MAAM,SAAS,IACX,SACC,KAAK,UAAU,gBAAgB,KAAK;AAE3C,UAAI,YAAY,KAAK,SAAS;AAC5B,aAAK,UAAU;AACf,aAAK,cAAc,KAAK,UACpB,IAAI,sBAAsB,KAAK,OAAO,CAAC,KACvC;AACJ,aAAK,oBAAoB;AAAA,MAC3B;AAEA,UAAI,UAAU,KAAK,OAAO;AACxB,aAAK,QAAQ;AACb,aAAK,SAAS,KAA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|| !!hasLabelSlot;
172
172
  const hasClearIcon = this.clearable && !this.disabled && !this.readonly;
173
173
  const isClearIconVisible = hasClearIcon && (typeof this.value === "number" || this.value.length > 0);
174
+ const describedBy = [
175
+ this.description ? this.descriptionId : void 0,
176
+ this.invalidmessage ? this.validationId : void 0
177
+ ].filter(Boolean).join(" ");
174
178
  return html`
175
179
  <div
176
180
  part="field"
@@ -234,10 +238,11 @@ let MinidTextfield = class extends FormControlMixin(
234
238
  ?autofocus=${this.autofocus}
235
239
  autocomplete=${ifDefined(this.autocomplete)}
236
240
  type=${this.type === "password" && this.passwordvisible ? "text" : this.type}
237
- aria-describedby="${ifDefined(
238
- this.description && this.descriptionId || void 0
239
- )}"
240
- aria-errormessage="${this.validationId}"
241
+ aria-describedby=${ifDefined(describedBy || void 0)}
242
+ aria-invalid=${this.invalidmessage ? "true" : "false"}
243
+ aria-errormessage=${ifDefined(
244
+ this.invalidmessage ? this.validationId : void 0
245
+ )}
241
246
  placeholder=${ifDefined(this.placeholder)}
242
247
  minlength=${ifDefined(this.minlength)}
243
248
  maxlength=${ifDefined(this.maxlength)}
@@ -1 +1 @@
1
- {"version":3,"file":"textfield.js","sources":["../../src/components/textfield.component.ts"],"sourcesContent":["import { css, html, LitElement, nothing } from 'lit';\nimport { customElement, property, query, state } from 'lit/decorators.js';\nimport { live } from 'lit/directives/live.js';\nimport { stringConverter } from '../internal/string-converter';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { styled } from '../mixins/tailwind.mixin.ts';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { HasSlotController } from '../internal/slot';\nimport { FormControlMixin } from '../mixins/form-control.mixin';\nimport {\n maxLengthValidator,\n minLengthValidator,\n patternValidator,\n requiredValidator,\n} from '../mixins/validators';\nimport { watch } from '../internal/watch';\nimport './icon/icon.component.ts';\nimport { MaskInput, type MaskType } from 'maska';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'mid-textfield': MinidTextfield;\n }\n}\n\nconst styles = [\n css`\n :host {\n display: block;\n }\n \n /* Hide increment/decrement buttons on inputs */\n input[type='number']::-webkit-outer-spin-button,\n input[type='number']::-webkit-inner-spin-button,\n input[type='number'] {\n -webkit-appearance: none;\n margin: 0;\n -moz-appearance: textfield !important;\n }\n `,\n];\n\nlet nextUniqueId = 0;\n\n/**\n *\n * @event mid-change - Emitted when a change to the input value is comitted by the user\n * @event mid-input - Emitted when the input element recieves input\n * @event mid-clear - Emitted when the input value is cleared\n * @event mid-focus - Emitted when input element is focused\n * @event mid-blur - Emitted when focus moves away from input element\n * @event {detail: { validity: ValidityState }} mid-invalid-hide - Emitted when the error message should be hidden\n * @event {detail: { validity: ValidityState }} mid-invalid-show - Emitted when the error message should be shown\n *\n * @slot prefix - Used for decoration to the left of the input\n * @slot suffix - Used for decoration to the right of the input\n * @slot label - The input's label. Alternatively, you can use the `label` attribute.\n *\n * @csspart base - The input's wrapper that has the input field styling.\n * @csspart input - The internal `<input>` element.\n * @csspart field - The element that wraps the label, input, and help text.\n * @csspart clear-button - The clear button\n * @csspart password-toggle-button - The button for toggling password visibility\n */\n@customElement('mid-textfield')\nexport class MinidTextfield extends FormControlMixin(\n styled(LitElement, styles)\n) {\n private readonly inputId!: string;\n private readonly descriptionId!: string;\n private readonly validationId!: string;\n private readonly hasSlotControler = new HasSlotController(this, 'label');\n private inputMask?: MaskInput;\n private initialValue = '';\n\n @query('.input')\n input!: HTMLInputElement;\n\n @property()\n label = '';\n\n @property()\n description = '';\n\n @property()\n value = '';\n\n @property()\n size: 'sm' | 'md' | 'lg' = 'md';\n\n @property({ converter: stringConverter })\n placeholder?: string;\n\n /**\n * Autofocus the input field on page load\n */\n @property({ type: Boolean })\n autofocus = false;\n\n /**\n * User agent autocomplete hint\n */\n @property()\n autocomplete?: AutoFill;\n\n /**\n * The minimum length of input that will be considered valid.\n */\n @property({ type: Number })\n minlength?: number;\n\n /**\n * The maximum length of input that will be considered valid.\n */\n @property({ type: Number })\n maxlength?: number;\n\n /**\n * The input's minimum value. Only applies to date and number input types.\n */\n @property()\n min?: number | string;\n\n /**\n * The input's maximum value. Only applies to date and number input types.\n */\n @property()\n max?: number | string;\n\n /**\n * Error message to display when the input is invalid, also activates invalid styling\n */\n @property()\n invalidmessage = '';\n\n @property()\n type:\n 'date'\n | 'datetime-local'\n | 'email'\n | 'file'\n | 'month'\n | 'number'\n | 'password'\n | 'search'\n | 'tel'\n | 'text'\n | 'time'\n | 'url'\n | 'week' = 'text';\n\n /**\n * For displaying appropriate virtual keyboard\n */\n @property()\n inputmode:\n 'none'\n | 'text'\n | 'tel'\n | 'url'\n | 'email'\n | 'numeric'\n | 'decimal' = 'text';\n\n /**\n * Adds a clear button when the input is not empty.\n * */\n @property({ type: Boolean })\n clearable = false;\n\n /**\n * Adds a button to toggle the password's visibility.\n * Only applies if type is password\n */\n @property({ type: Boolean })\n passwordtoggle = false;\n\n /**\n * Determines wether the password is currently visible.\n * Only applies if type is password\n */\n @property({ type: Boolean })\n passwordvisible = false;\n\n @property({ type: Boolean, reflect: true })\n disabled = false;\n\n @property({ type: Boolean, reflect: true })\n readonly = false;\n\n /**\n * A regular expression pattern to validate input against.\n */\n @property()\n pattern?: string;\n\n /**\n * Makes the input required\n */\n @property({ type: Boolean })\n required = false;\n\n /**\n * Visually hides `label` and `description` (still available for screen readers)\n */\n @property({ type: Boolean })\n hidelabel = false;\n\n /**\n * Modify input value based on mask e.g: `\"##:##\"` = 12:34.\n * `#`: /[0-9]/\n * `@`: /[a-zA-Z]/\n * `*`: /[a-zA-Z0-9]/\n * For more information go to https://beholdr.github.io/maska\n */\n @property()\n mask?: MaskType;\n\n @state()\n hasFocus = false;\n\n static get formControlValidators() {\n return [\n requiredValidator,\n maxLengthValidator,\n minLengthValidator,\n patternValidator,\n ];\n }\n\n constructor() {\n super();\n nextUniqueId++;\n this.inputId = `mid-textfield-input-${nextUniqueId}`;\n this.descriptionId = `mid-textfield-description-${nextUniqueId}`;\n this.validationId = `mid-textfield-validation-${nextUniqueId}`;\n this.setValue(this.value);\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.initialValue = this.value;\n }\n\n disconnectedCallback(): void {\n this.inputMask?.destroy();\n }\n\n private handleKeydown(event: KeyboardEvent) {\n const hasModifier =\n event.metaKey || event.ctrlKey || event.shiftKey || event.altKey;\n\n // Pressing enter when focused on an input should submit the form like a native input, but we wait a tick before\n // submitting to allow users to cancel the keydown event if they need to\n if (event.key === 'Enter' && !hasModifier) {\n setTimeout(() => {\n //\n // When using an Input Method Editor (IME), pressing enter will cause the form to submit unexpectedly. One way\n // to check for this is to look at event.isComposing, which will be true when the IME is open.\n if (!event.defaultPrevented && !event.isComposing) {\n this.form.requestSubmit();\n }\n });\n }\n }\n\n private handleBlur() {\n this.hasFocus = false;\n this.dispatchEvent(\n new Event('mid-blur', { bubbles: true, composed: true })\n );\n }\n\n private handleChange() {\n this.value = this.input.value;\n this.dispatchEvent(\n new Event('mid-change', { bubbles: true, composed: true })\n );\n }\n\n private handleInput() {\n let tmp_value = this.input.value;\n\n if (this.type === 'number') {\n tmp_value = tmp_value.replace(/[^0-9]/g, '');\n }\n\n this.value = tmp_value;\n this.setValue(this.value);\n this.dispatchEvent(\n new Event('mid-input', { bubbles: true, composed: true })\n );\n }\n\n private handleFocus() {\n this.hasFocus = true;\n this.dispatchEvent(\n new Event('mid-focus', { composed: true, bubbles: true })\n );\n }\n\n private handlePasswordToggle() {\n this.passwordvisible = !this.passwordvisible;\n }\n\n private handleClearClick(event: MouseEvent) {\n event.preventDefault();\n\n if (this.value !== '') {\n this.value = '';\n this.dispatchEvent(\n new Event('mid-clear', { composed: true, bubbles: true })\n );\n this.dispatchEvent(\n new Event('mid-input', { composed: true, bubbles: true })\n );\n this.dispatchEvent(\n new Event('mid-change', { composed: true, bubbles: true })\n );\n }\n\n this.input.focus();\n }\n\n focus() {\n this.hasFocus = true;\n this.input.focus();\n }\n\n resetFormControl() {\n this.invalidmessage = '';\n this.value = this.initialValue;\n }\n\n forceError(message?: string): void {\n super.forceError(message);\n }\n\n @watch('value')\n handleValueUpdate() {\n this.setValue(this.value);\n }\n\n @watch('mask')\n async handleMaskUpdate() {\n if (!this.mask) return;\n await this.updateComplete;\n this.inputMask?.destroy();\n this.inputMask = new MaskInput(this.input, {\n mask: this.mask,\n eager: true,\n });\n }\n\n override render() {\n const lg = this.size === 'lg';\n const md = this.size === 'md';\n const sm = this.size === 'sm';\n\n const hasLabelSlot = this.hasSlotControler.test('label');\n const hasLabel = !!this.label || !!hasLabelSlot;\n const hasClearIcon = this.clearable && !this.disabled && !this.readonly;\n const isClearIconVisible =\n hasClearIcon && (typeof this.value === 'number' || this.value.length > 0);\n\n return html`\n <div\n part=\"field\"\n class=\"${classMap({\n 'opacity-disabled': this.disabled,\n 'text-body-sm': sm,\n 'text-body-md': md,\n 'text-body-lg': lg,\n })} max-w-full\"\n >\n <label\n for=\"${this.inputId}\"\n class=\"${classMap({\n 'sr-only': this.hidelabel || !hasLabel,\n })} mb-2 inline-flex items-center gap-1 font-medium\"\n >\n ${this.readonly\n ? html`<mid-icon\n class=\"size-5\"\n library=\"system\"\n name=\"padlock-locked-fill\"\n ></mid-icon>`\n : nothing}\n <slot name=\"label\"> ${this.label} </slot>\n </label>\n ${this.description\n ? html`\n <div\n id=\"${this.descriptionId}\"\n part=\"description\"\n class=\"${classMap({\n 'sr-only': this.hidelabel,\n })} text-neutral-subtle mb-2\"\n >\n ${this.description}\n </div>\n `\n : nothing}\n <div\n part=\"base\"\n class=\"${classMap({\n 'border-neutral': !this.invalidmessage && !this.readonly,\n 'border-danger': this.invalidmessage && !this.readonly,\n 'border-neutral-subtle': this.readonly,\n 'bg-neutral-surface-tinted': this.readonly,\n 'bg-neutral-surface': !this.readonly,\n border: !this.invalidmessage,\n 'border-2': this.invalidmessage,\n })} focus-within:focus-ring flex h-12 items-center rounded-md px-3\"\n >\n <span class=\"slotted:!mr-2 slotted:rounded flex items-center\">\n <slot name=\"prefix\"></slot>\n </span>\n <input\n id=\"${this.inputId}\"\n class=\"${classMap({\n 'w-full': !isClearIconVisible,\n 'w-[calc(100%-var(--spacing)*7)]': isClearIconVisible,\n '[&::-webkit-search-cancel-button]:appearance-none':\n this.type === 'search',\n })} input grow overflow-clip focus-visible:outline-0\"\n part=\"input\"\n .value=${live(this.value)}\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n ?autofocus=${this.autofocus}\n autocomplete=${ifDefined(this.autocomplete as any)}\n type=${this.type === 'password' && this.passwordvisible\n ? 'text'\n : this.type}\n aria-describedby=\"${ifDefined(\n (this.description && this.descriptionId) || undefined\n )}\"\n aria-errormessage=\"${this.validationId}\"\n placeholder=${ifDefined(this.placeholder)}\n minlength=${ifDefined(this.minlength)}\n maxlength=${ifDefined(this.maxlength)}\n min=${ifDefined(this.min)}\n max=${ifDefined(this.max)}\n pattern=${ifDefined(this.pattern)}\n @input=${this.handleInput}\n @change=${this.handleChange}\n @focus=${this.handleFocus}\n @blur=${this.handleBlur}\n @keydown=${this.handleKeydown}\n />\n ${isClearIconVisible\n ? html`\n <button\n part=\"clear-button\"\n type=\"button\"\n class=\"focus-visible:focus-ring ml-2 flex items-center justify-center rounded-sm\"\n aria-label=\"Tøm\"\n @click=${this.handleClearClick}\n >\n <mid-icon\n class=\"size-7\"\n library=\"system\"\n name=\"xmark\"\n ></mid-icon>\n </button>\n `\n : ''}\n ${this.passwordtoggle && !this.disabled\n ? html`\n <button\n part=\"password-toggle-button\"\n type=\"button\"\n class=\"ml-2 flex items-center justify-center rounded-sm\"\n aria-label=${this.passwordvisible\n ? 'skjul passord'\n : 'vis passord'}\n @click=${this.handlePasswordToggle}\n tabindex=\"-1\"\n >\n ${this.passwordvisible\n ? html` <mid-icon\n class=\"size-7\"\n library=\"system\"\n name=\"eye-slash\"\n ></mid-icon>`\n : html`\n <mid-icon\n class=\"size-7\"\n library=\"system\"\n name=\"eye\"\n ></mid-icon>\n `}\n </button>\n `\n : ''}\n <span part=\"suffix\" class=\"slotted:!ml-2 slotted:rounded\">\n <slot name=\"suffix\"></slot>\n </span>\n </div>\n <div\n class=\"text-danger-subtle mt-2 flex gap-1\"\n id=\"${this.validationId}\"\n aria-live=\"polite\"\n ?hidden=${!this.invalidmessage}\n >\n <mid-icon\n name=\"xmark-octagon-fill\"\n class=\"mt-1 min-h-5 min-w-5\"\n ></mid-icon>\n ${this.invalidmessage}\n </div>\n </div>\n `;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAyBA,MAAM,SAAS;AAAA,EACb;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAcF;AAEA,IAAI,eAAe;AAuBZ,IAAM,iBAAN,cAA6B;AAAA,EAClC,OAAO,YAAY,MAAM;AAC3B,EAAE;AAAA,EAmKA,cAAc;AACZ,UAAA;AAhKF,SAAiB,mBAAmB,IAAI,kBAAkB,MAAM,OAAO;AAEvE,SAAQ,eAAe;AAMvB,SAAA,QAAQ;AAGR,SAAA,cAAc;AAGd,SAAA,QAAQ;AAGR,SAAA,OAA2B;AAS3B,SAAA,YAAY;AAoCZ,SAAA,iBAAiB;AAGjB,SAAA,OAaa;AAMb,SAAA,YAOgB;AAMhB,SAAA,YAAY;AAOZ,SAAA,iBAAiB;AAOjB,SAAA,kBAAkB;AAGlB,SAAA,WAAW;AAGX,SAAA,WAAW;AAYX,SAAA,WAAW;AAMX,SAAA,YAAY;AAaZ,SAAA,WAAW;AAaT;AACA,SAAK,UAAU,uBAAuB,YAAY;AAClD,SAAK,gBAAgB,6BAA6B,YAAY;AAC9D,SAAK,eAAe,4BAA4B,YAAY;AAC5D,SAAK,SAAS,KAAK,KAAK;AAAA,EAC1B;AAAA,EAhBA,WAAW,wBAAwB;AACjC,WAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IAAA;AAAA,EAEJ;AAAA,EAWS,oBAA0B;AACjC,UAAM,kBAAA;AACN,SAAK,eAAe,KAAK;AAAA,EAC3B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AAS,EAAE,MAAM,SAAS,SAAS,MAAM;AAAA,GA1H/B,eA2HX,WAAA,YAAA,CAAA;AAMA,gBAAA;AAAA,EADC,SAAA;AAAS,GAhIC,eAiIX,WAAA,WAAA,CAAA;AAMA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,QAAA,CAAS;AAAA,GAtIhB,eAuIX,WAAA,YAAA,CAAA;AAMA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,QAAA,CAAS;AAAA,GA5IhB,eA6IX,WAAA,aAAA,CAAA;AAUA,gBAAA;AAAA,EADC,SAAA;AAAS,GAtJC,eAuJX,WAAA,QAAA,CAAA;AAGA,gBAAA;AAAA,EADC,MAAA;AAAM,GAzJI,eA0JX,WAAA,YAAA,CAAA;AAwHA,gBAAA;AAAA,EADC,MAAM,OAAO;AAAA,GAjRH,eAkRX,WAAA,qBAAA,CAAA;AAKM,gBAAA;AAAA,EADL,MAAM,MAAM;AAAA,GAtRF,eAuRL,WAAA,oBAAA,CAAA;AAvRK,iBAAN,gBAAA;AAAA,EADN,cAAc,eAAe;AAAA,GACjB,cAAA;"}
1
+ {"version":3,"file":"textfield.js","sources":["../../src/components/textfield.component.ts"],"sourcesContent":["import { css, html, LitElement, nothing } from 'lit';\nimport { customElement, property, query, state } from 'lit/decorators.js';\nimport { live } from 'lit/directives/live.js';\nimport { stringConverter } from '../internal/string-converter';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { styled } from '../mixins/tailwind.mixin.ts';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { HasSlotController } from '../internal/slot';\nimport { FormControlMixin } from '../mixins/form-control.mixin';\nimport {\n maxLengthValidator,\n minLengthValidator,\n patternValidator,\n requiredValidator,\n} from '../mixins/validators';\nimport { watch } from '../internal/watch';\nimport './icon/icon.component.ts';\nimport { MaskInput, type MaskType } from 'maska';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'mid-textfield': MinidTextfield;\n }\n}\n\nconst styles = [\n css`\n :host {\n display: block;\n }\n \n /* Hide increment/decrement buttons on inputs */\n input[type='number']::-webkit-outer-spin-button,\n input[type='number']::-webkit-inner-spin-button,\n input[type='number'] {\n -webkit-appearance: none;\n margin: 0;\n -moz-appearance: textfield !important;\n }\n `,\n];\n\nlet nextUniqueId = 0;\n\n/**\n *\n * @event mid-change - Emitted when a change to the input value is comitted by the user\n * @event mid-input - Emitted when the input element recieves input\n * @event mid-clear - Emitted when the input value is cleared\n * @event mid-focus - Emitted when input element is focused\n * @event mid-blur - Emitted when focus moves away from input element\n * @event {detail: { validity: ValidityState }} mid-invalid-hide - Emitted when the error message should be hidden\n * @event {detail: { validity: ValidityState }} mid-invalid-show - Emitted when the error message should be shown\n *\n * @slot prefix - Used for decoration to the left of the input\n * @slot suffix - Used for decoration to the right of the input\n * @slot label - The input's label. Alternatively, you can use the `label` attribute.\n *\n * @csspart base - The input's wrapper that has the input field styling.\n * @csspart input - The internal `<input>` element.\n * @csspart field - The element that wraps the label, input, and help text.\n * @csspart clear-button - The clear button\n * @csspart password-toggle-button - The button for toggling password visibility\n */\n@customElement('mid-textfield')\nexport class MinidTextfield extends FormControlMixin(\n styled(LitElement, styles)\n) {\n private readonly inputId!: string;\n private readonly descriptionId!: string;\n private readonly validationId!: string;\n private readonly hasSlotControler = new HasSlotController(this, 'label');\n private inputMask?: MaskInput;\n private initialValue = '';\n\n @query('.input')\n input!: HTMLInputElement;\n\n @property()\n label = '';\n\n @property()\n description = '';\n\n @property()\n value = '';\n\n @property()\n size: 'sm' | 'md' | 'lg' = 'md';\n\n @property({ converter: stringConverter })\n placeholder?: string;\n\n /**\n * Autofocus the input field on page load\n */\n @property({ type: Boolean })\n autofocus = false;\n\n /**\n * User agent autocomplete hint\n */\n @property()\n autocomplete?: AutoFill;\n\n /**\n * The minimum length of input that will be considered valid.\n */\n @property({ type: Number })\n minlength?: number;\n\n /**\n * The maximum length of input that will be considered valid.\n */\n @property({ type: Number })\n maxlength?: number;\n\n /**\n * The input's minimum value. Only applies to date and number input types.\n */\n @property()\n min?: number | string;\n\n /**\n * The input's maximum value. Only applies to date and number input types.\n */\n @property()\n max?: number | string;\n\n /**\n * Error message to display when the input is invalid, also activates invalid styling\n */\n @property()\n invalidmessage = '';\n\n @property()\n type:\n 'date'\n | 'datetime-local'\n | 'email'\n | 'file'\n | 'month'\n | 'number'\n | 'password'\n | 'search'\n | 'tel'\n | 'text'\n | 'time'\n | 'url'\n | 'week' = 'text';\n\n /**\n * For displaying appropriate virtual keyboard\n */\n @property()\n inputmode:\n 'none'\n | 'text'\n | 'tel'\n | 'url'\n | 'email'\n | 'numeric'\n | 'decimal' = 'text';\n\n /**\n * Adds a clear button when the input is not empty.\n * */\n @property({ type: Boolean })\n clearable = false;\n\n /**\n * Adds a button to toggle the password's visibility.\n * Only applies if type is password\n */\n @property({ type: Boolean })\n passwordtoggle = false;\n\n /**\n * Determines wether the password is currently visible.\n * Only applies if type is password\n */\n @property({ type: Boolean })\n passwordvisible = false;\n\n @property({ type: Boolean, reflect: true })\n disabled = false;\n\n @property({ type: Boolean, reflect: true })\n readonly = false;\n\n /**\n * A regular expression pattern to validate input against.\n */\n @property()\n pattern?: string;\n\n /**\n * Makes the input required\n */\n @property({ type: Boolean })\n required = false;\n\n /**\n * Visually hides `label` and `description` (still available for screen readers)\n */\n @property({ type: Boolean })\n hidelabel = false;\n\n /**\n * Modify input value based on mask e.g: `\"##:##\"` = 12:34.\n * `#`: /[0-9]/\n * `@`: /[a-zA-Z]/\n * `*`: /[a-zA-Z0-9]/\n * For more information go to https://beholdr.github.io/maska\n */\n @property()\n mask?: MaskType;\n\n @state()\n hasFocus = false;\n\n static get formControlValidators() {\n return [\n requiredValidator,\n maxLengthValidator,\n minLengthValidator,\n patternValidator,\n ];\n }\n\n constructor() {\n super();\n nextUniqueId++;\n this.inputId = `mid-textfield-input-${nextUniqueId}`;\n this.descriptionId = `mid-textfield-description-${nextUniqueId}`;\n this.validationId = `mid-textfield-validation-${nextUniqueId}`;\n this.setValue(this.value);\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.initialValue = this.value;\n }\n\n disconnectedCallback(): void {\n this.inputMask?.destroy();\n }\n\n private handleKeydown(event: KeyboardEvent) {\n const hasModifier =\n event.metaKey || event.ctrlKey || event.shiftKey || event.altKey;\n\n // Pressing enter when focused on an input should submit the form like a native input, but we wait a tick before\n // submitting to allow users to cancel the keydown event if they need to\n if (event.key === 'Enter' && !hasModifier) {\n setTimeout(() => {\n //\n // When using an Input Method Editor (IME), pressing enter will cause the form to submit unexpectedly. One way\n // to check for this is to look at event.isComposing, which will be true when the IME is open.\n if (!event.defaultPrevented && !event.isComposing) {\n this.form.requestSubmit();\n }\n });\n }\n }\n\n private handleBlur() {\n this.hasFocus = false;\n this.dispatchEvent(\n new Event('mid-blur', { bubbles: true, composed: true })\n );\n }\n\n private handleChange() {\n this.value = this.input.value;\n this.dispatchEvent(\n new Event('mid-change', { bubbles: true, composed: true })\n );\n }\n\n private handleInput() {\n let tmp_value = this.input.value;\n\n if (this.type === 'number') {\n tmp_value = tmp_value.replace(/[^0-9]/g, '');\n }\n\n this.value = tmp_value;\n this.setValue(this.value);\n this.dispatchEvent(\n new Event('mid-input', { bubbles: true, composed: true })\n );\n }\n\n private handleFocus() {\n this.hasFocus = true;\n this.dispatchEvent(\n new Event('mid-focus', { composed: true, bubbles: true })\n );\n }\n\n private handlePasswordToggle() {\n this.passwordvisible = !this.passwordvisible;\n }\n\n private handleClearClick(event: MouseEvent) {\n event.preventDefault();\n\n if (this.value !== '') {\n this.value = '';\n this.dispatchEvent(\n new Event('mid-clear', { composed: true, bubbles: true })\n );\n this.dispatchEvent(\n new Event('mid-input', { composed: true, bubbles: true })\n );\n this.dispatchEvent(\n new Event('mid-change', { composed: true, bubbles: true })\n );\n }\n\n this.input.focus();\n }\n\n focus() {\n this.hasFocus = true;\n this.input.focus();\n }\n\n resetFormControl() {\n this.invalidmessage = '';\n this.value = this.initialValue;\n }\n\n forceError(message?: string): void {\n super.forceError(message);\n }\n\n @watch('value')\n handleValueUpdate() {\n this.setValue(this.value);\n }\n\n @watch('mask')\n async handleMaskUpdate() {\n if (!this.mask) return;\n await this.updateComplete;\n this.inputMask?.destroy();\n this.inputMask = new MaskInput(this.input, {\n mask: this.mask,\n eager: true,\n });\n }\n\n override render() {\n const lg = this.size === 'lg';\n const md = this.size === 'md';\n const sm = this.size === 'sm';\n\n const hasLabelSlot = this.hasSlotControler.test('label');\n const hasLabel = !!this.label || !!hasLabelSlot;\n const hasClearIcon = this.clearable && !this.disabled && !this.readonly;\n const isClearIconVisible =\n hasClearIcon && (typeof this.value === 'number' || this.value.length > 0);\n const describedBy = [\n this.description ? this.descriptionId : undefined,\n this.invalidmessage ? this.validationId : undefined,\n ]\n .filter(Boolean)\n .join(' ');\n\n return html`\n <div\n part=\"field\"\n class=\"${classMap({\n 'opacity-disabled': this.disabled,\n 'text-body-sm': sm,\n 'text-body-md': md,\n 'text-body-lg': lg,\n })} max-w-full\"\n >\n <label\n for=\"${this.inputId}\"\n class=\"${classMap({\n 'sr-only': this.hidelabel || !hasLabel,\n })} mb-2 inline-flex items-center gap-1 font-medium\"\n >\n ${this.readonly\n ? html`<mid-icon\n class=\"size-5\"\n library=\"system\"\n name=\"padlock-locked-fill\"\n ></mid-icon>`\n : nothing}\n <slot name=\"label\"> ${this.label} </slot>\n </label>\n ${this.description\n ? html`\n <div\n id=\"${this.descriptionId}\"\n part=\"description\"\n class=\"${classMap({\n 'sr-only': this.hidelabel,\n })} text-neutral-subtle mb-2\"\n >\n ${this.description}\n </div>\n `\n : nothing}\n <div\n part=\"base\"\n class=\"${classMap({\n 'border-neutral': !this.invalidmessage && !this.readonly,\n 'border-danger': this.invalidmessage && !this.readonly,\n 'border-neutral-subtle': this.readonly,\n 'bg-neutral-surface-tinted': this.readonly,\n 'bg-neutral-surface': !this.readonly,\n border: !this.invalidmessage,\n 'border-2': this.invalidmessage,\n })} focus-within:focus-ring flex h-12 items-center rounded-md px-3\"\n >\n <span class=\"slotted:!mr-2 slotted:rounded flex items-center\">\n <slot name=\"prefix\"></slot>\n </span>\n <input\n id=\"${this.inputId}\"\n class=\"${classMap({\n 'w-full': !isClearIconVisible,\n 'w-[calc(100%-var(--spacing)*7)]': isClearIconVisible,\n '[&::-webkit-search-cancel-button]:appearance-none':\n this.type === 'search',\n })} input grow overflow-clip focus-visible:outline-0\"\n part=\"input\"\n .value=${live(this.value)}\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n ?autofocus=${this.autofocus}\n autocomplete=${ifDefined(this.autocomplete as any)}\n type=${this.type === 'password' && this.passwordvisible\n ? 'text'\n : this.type}\n aria-describedby=${ifDefined(describedBy || undefined)}\n aria-invalid=${this.invalidmessage ? 'true' : 'false'}\n aria-errormessage=${ifDefined(\n this.invalidmessage ? this.validationId : undefined\n )}\n placeholder=${ifDefined(this.placeholder)}\n minlength=${ifDefined(this.minlength)}\n maxlength=${ifDefined(this.maxlength)}\n min=${ifDefined(this.min)}\n max=${ifDefined(this.max)}\n pattern=${ifDefined(this.pattern)}\n @input=${this.handleInput}\n @change=${this.handleChange}\n @focus=${this.handleFocus}\n @blur=${this.handleBlur}\n @keydown=${this.handleKeydown}\n />\n ${isClearIconVisible\n ? html`\n <button\n part=\"clear-button\"\n type=\"button\"\n class=\"focus-visible:focus-ring ml-2 flex items-center justify-center rounded-sm\"\n aria-label=\"Tøm\"\n @click=${this.handleClearClick}\n >\n <mid-icon\n class=\"size-7\"\n library=\"system\"\n name=\"xmark\"\n ></mid-icon>\n </button>\n `\n : ''}\n ${this.passwordtoggle && !this.disabled\n ? html`\n <button\n part=\"password-toggle-button\"\n type=\"button\"\n class=\"ml-2 flex items-center justify-center rounded-sm\"\n aria-label=${this.passwordvisible\n ? 'skjul passord'\n : 'vis passord'}\n @click=${this.handlePasswordToggle}\n tabindex=\"-1\"\n >\n ${this.passwordvisible\n ? html` <mid-icon\n class=\"size-7\"\n library=\"system\"\n name=\"eye-slash\"\n ></mid-icon>`\n : html`\n <mid-icon\n class=\"size-7\"\n library=\"system\"\n name=\"eye\"\n ></mid-icon>\n `}\n </button>\n `\n : ''}\n <span part=\"suffix\" class=\"slotted:!ml-2 slotted:rounded\">\n <slot name=\"suffix\"></slot>\n </span>\n </div>\n <div\n class=\"text-danger-subtle mt-2 flex gap-1\"\n id=\"${this.validationId}\"\n aria-live=\"polite\"\n ?hidden=${!this.invalidmessage}\n >\n <mid-icon\n name=\"xmark-octagon-fill\"\n class=\"mt-1 min-h-5 min-w-5\"\n ></mid-icon>\n ${this.invalidmessage}\n </div>\n </div>\n `;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAyBA,MAAM,SAAS;AAAA,EACb;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAcF;AAEA,IAAI,eAAe;AAuBZ,IAAM,iBAAN,cAA6B;AAAA,EAClC,OAAO,YAAY,MAAM;AAC3B,EAAE;AAAA,EAmKA,cAAc;AACZ,UAAA;AAhKF,SAAiB,mBAAmB,IAAI,kBAAkB,MAAM,OAAO;AAEvE,SAAQ,eAAe;AAMvB,SAAA,QAAQ;AAGR,SAAA,cAAc;AAGd,SAAA,QAAQ;AAGR,SAAA,OAA2B;AAS3B,SAAA,YAAY;AAoCZ,SAAA,iBAAiB;AAGjB,SAAA,OAaa;AAMb,SAAA,YAOgB;AAMhB,SAAA,YAAY;AAOZ,SAAA,iBAAiB;AAOjB,SAAA,kBAAkB;AAGlB,SAAA,WAAW;AAGX,SAAA,WAAW;AAYX,SAAA,WAAW;AAMX,SAAA,YAAY;AAaZ,SAAA,WAAW;AAaT;AACA,SAAK,UAAU,uBAAuB,YAAY;AAClD,SAAK,gBAAgB,6BAA6B,YAAY;AAC9D,SAAK,eAAe,4BAA4B,YAAY;AAC5D,SAAK,SAAS,KAAK,KAAK;AAAA,EAC1B;AAAA,EAhBA,WAAW,wBAAwB;AACjC,WAAO;AAAA,MACL;AAAA,MACA;AAAA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,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,QAAA,CAAS;AAAA,GA7GhB,eA8GX,WAAA,kBAAA,CAAA;AAOA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,QAAA,CAAS;AAAA,GApHhB,eAqHX,WAAA,mBAAA,CAAA;AAGA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,SAAS,SAAS,MAAM;AAAA,GAvH/B,eAwHX,WAAA,YAAA,CAAA;AAGA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,SAAS,SAAS,MAAM;AAAA,GA1H/B,eA2HX,WAAA,YAAA,CAAA;AAMA,gBAAA;AAAA,EADC,SAAA;AAAS,GAhIC,eAiIX,WAAA,WAAA,CAAA;AAMA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,QAAA,CAAS;AAAA,GAtIhB,eAuIX,WAAA,YAAA,CAAA;AAMA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,QAAA,CAAS;AAAA,GA5IhB,eA6IX,WAAA,aAAA,CAAA;AAUA,gBAAA;AAAA,EADC,SAAA;AAAS,GAtJC,eAuJX,WAAA,QAAA,CAAA;AAGA,gBAAA;AAAA,EADC,MAAA;AAAM,GAzJI,eA0JX,WAAA,YAAA,CAAA;AAwHA,gBAAA;AAAA,EADC,MAAM,OAAO;AAAA,GAjRH,eAkRX,WAAA,qBAAA,CAAA;AAKM,gBAAA;AAAA,EADL,MAAM,MAAM;AAAA,GAtRF,eAuRL,WAAA,oBAAA,CAAA;AAvRK,iBAAN,gBAAA;AAAA,EADN,cAAc,eAAe;AAAA,GACjB,cAAA;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@felleslosninger/minid-elements",
3
- "version": "0.0.138",
3
+ "version": "0.0.140",
4
4
  "description": "MinID Web Components",
5
5
  "author": "Digitaliseringsdirektoratet",
6
6
  "license": "MIT",