@felleslosninger/minid-elements 0.0.113 → 0.0.115
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"phone-input.component.d.ts","sourceRoot":"","sources":["../../src/components/phone-input.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,UAAU,EAAW,MAAM,KAAK,CAAC;AAIrD,OAAO,EAIL,KAAK,WAAW,EAEjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,uBAAuB,CAAC;AAY/B,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,iBAAiB,EAAE,eAAe,CAAC;KACpC;CACF;;AAUD;;;;;;;;;;;;GAYG;AACH,qBACa,eAAgB,SAAQ,oBAEpC;IACC,OAAO,CAAC,SAAS,CAAmB;IACpC,OAAO,CAAC,iBAAiB,CAAS;IAClC,OAAO,CAAC,YAAY,CAAiB;IACrC,OAAO,CAAC,eAAe,CAAM;IAC7B,OAAO,CAAC,gBAAgB,CAAwC;IAGhE,KAAK,EAAG,gBAAgB,CAAC;IAEzB;;;OAGG;IAEH,KAAK,SAAM;IAEX;;OAEG;IAEH,cAAc,SAAM;IAEpB;;OAEG;IAEH,WAAW,SAAM;IAEjB;;;OAGG;IAEH,KAAK,SAAM;IAEX;;OAEG;IAEH,SAAS,UAAS;IAElB;;OAEG;IAEH,OAAO,CAAC,EAAE,WAAW,CAAC;IAEtB;;OAEG;IAEH,OAAO,UAAS;IAEhB;;OAEG;IAEH,QAAQ,UAAS;IAEjB;;OAEG;IAEH,QAAQ,UAAS;IAGjB,QAAQ,UAAS;IAEjB,MAAM,KAAK,qBAAqB,kDAE/B;IAED,kBAAkB;IAMlB,oBAAoB,CAAC,KAAK,EAAE,aAAa;IAQzC,iBAAiB,IAAI,IAAI;
|
|
1
|
+
{"version":3,"file":"phone-input.component.d.ts","sourceRoot":"","sources":["../../src/components/phone-input.component.ts"],"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AAmB;IAmBV,MAAM;CAuFhB"}
|
|
@@ -81,8 +81,9 @@ let MinidPhoneInput = class extends FormControlMixin(
|
|
|
81
81
|
this.country = this.formatter.getCountry() ?? this.country;
|
|
82
82
|
this.countrycode = this.country ? `+${getCountryCallingCode(this.country)}` : "+";
|
|
83
83
|
this.value = formatIncompletePhoneNumber(this.value);
|
|
84
|
-
this.value
|
|
84
|
+
this.value ||= this.countrycode;
|
|
85
85
|
this.nationalnumber = this.removePhonePrefix(this.value);
|
|
86
|
+
this.setValue(this.value.replaceAll(" ", ""));
|
|
86
87
|
setTimeout(() => {
|
|
87
88
|
this.input.value = `${this.countrycode} ${this.nationalnumber}`;
|
|
88
89
|
});
|
|
@@ -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\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,\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,\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 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;AAGG,SAAA,YAAY,IAAI,UAAU;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gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,QAAS,CAAA;AAAA,GA3DhB,gBA4DX,WAAA,YAAA,CAAA;AAMA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,QAAS,CAAA;AAAA,GAjEhB,gBAkEX,WAAA,YAAA,CAAA;AAGA,gBAAA;AAAA,EADC,MAAM;AAAA,GApEI,gBAqEX,WAAA,YAAA,CAAA;AA8KA,gBAAA;AAAA,EADC,MAAM,WAAW,EAAE,sBAAsB,KAAM,CAAA;AAAA,GAlPrC,gBAmPX,WAAA,uBAAA,CAAA;AAnPW,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 { 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,\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,\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 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;AAGG,SAAA,YAAY,IAAI,UAA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AS,CAAA;AAAA,GArDhB,gBAsDX,WAAA,WAAA,CAAA;AAMA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,QAAS,CAAA;AAAA,GA3DhB,gBA4DX,WAAA,YAAA,CAAA;AAMA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,QAAS,CAAA;AAAA,GAjEhB,gBAkEX,WAAA,YAAA,CAAA;AAGA,gBAAA;AAAA,EADC,MAAM;AAAA,GApEI,gBAqEX,WAAA,YAAA,CAAA;AA+KA,gBAAA;AAAA,EADC,MAAM,WAAW,EAAE,sBAAsB,KAAM,CAAA;AAAA,GAnPrC,gBAoPX,WAAA,uBAAA,CAAA;AApPW,kBAAN,gBAAA;AAAA,EADN,cAAc,iBAAiB;AAAA,GACnB,eAAA;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@felleslosninger/minid-elements",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.115",
|
|
4
4
|
"description": "MinID Web Components",
|
|
5
5
|
"author": "Digitaliseringsdirektoratet",
|
|
6
6
|
"license": "MIT",
|
|
@@ -165,15 +165,10 @@
|
|
|
165
165
|
"@digdir/designsystemet-theme": "^1.0.3",
|
|
166
166
|
"@floating-ui/dom": "^1.6.10",
|
|
167
167
|
"@navikt/aksel-icons": "^7.1.2",
|
|
168
|
-
"@storybook/addon-
|
|
169
|
-
"@storybook/addon-
|
|
170
|
-
"@storybook/
|
|
171
|
-
"@storybook/
|
|
172
|
-
"@storybook/blocks": "^8.6.0",
|
|
173
|
-
"@storybook/builder-vite": "^8.6.0",
|
|
174
|
-
"@storybook/test": "^8.6.0",
|
|
175
|
-
"@storybook/web-components": "^8.6.0",
|
|
176
|
-
"@storybook/web-components-vite": "^8.6.0",
|
|
168
|
+
"@storybook/addon-docs": "^9.0.12",
|
|
169
|
+
"@storybook/addon-links": "^9.0.12",
|
|
170
|
+
"@storybook/builder-vite": "^9.0.12",
|
|
171
|
+
"@storybook/web-components-vite": "^9.0.12",
|
|
177
172
|
"@tailwindcss/cli": "^4.1.6",
|
|
178
173
|
"@types/node": "^22.7.4",
|
|
179
174
|
"@types/qrcode": "^1.5.5",
|
|
@@ -187,13 +182,14 @@
|
|
|
187
182
|
"composed-offset-position": "^0.0.6",
|
|
188
183
|
"concurrently": "^9.0.1",
|
|
189
184
|
"eslint": "^9.25.1",
|
|
190
|
-
"eslint-plugin-storybook": "^0.
|
|
185
|
+
"eslint-plugin-storybook": "^9.0.12",
|
|
191
186
|
"postcss": "^8.5.1",
|
|
192
187
|
"prettier": "^3.5.3",
|
|
193
188
|
"prettier-plugin-tailwindcss": "^0.6.11",
|
|
194
189
|
"rimraf": "^6.0.1",
|
|
195
190
|
"rollup": "^4.2.0",
|
|
196
|
-
"storybook": "^
|
|
191
|
+
"storybook": "^9.0.12",
|
|
192
|
+
"storybook-addon-tag-badges": "^2.0.1",
|
|
197
193
|
"tailwindcss": "^4.0.3",
|
|
198
194
|
"terser": "^5.24.0",
|
|
199
195
|
"tslib": "^2.8.0",
|