@felleslosninger/minid-elements 0.0.140 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/README.md +69 -4
  2. package/dist/components/alert.component.d.ts +6 -4
  3. package/dist/components/alert.component.d.ts.map +1 -1
  4. package/dist/components/alert.js +33 -61
  5. package/dist/components/alert.js.map +1 -1
  6. package/dist/components/button.component.d.ts +1 -1
  7. package/dist/components/checkbox.component.d.ts +1 -2
  8. package/dist/components/checkbox.component.d.ts.map +1 -1
  9. package/dist/components/checkbox.js +25 -55
  10. package/dist/components/checkbox.js.map +1 -1
  11. package/dist/components/code-input-old.component.d.ts +1 -1
  12. package/dist/components/code-input-old.js +1 -1
  13. package/dist/components/code-input.component.d.ts +1 -1
  14. package/dist/components/code-input.component.d.ts.map +1 -1
  15. package/dist/components/code-input.js +232 -94
  16. package/dist/components/code-input.js.map +1 -1
  17. package/dist/components/combobox.component.d.ts +1 -1
  18. package/dist/components/countdown.component.d.ts +1 -1
  19. package/dist/components/dialog.component.d.ts +1 -1
  20. package/dist/components/dropdown.component.d.ts +1 -1
  21. package/dist/components/heading.component.d.ts +1 -1
  22. package/dist/components/heading.component.d.ts.map +1 -1
  23. package/dist/components/heading.js +1 -11
  24. package/dist/components/heading.js.map +1 -1
  25. package/dist/components/helptext.component.d.ts +1 -1
  26. package/dist/components/label.component.d.ts +1 -1
  27. package/dist/components/label.component.d.ts.map +1 -1
  28. package/dist/components/label.js +3 -12
  29. package/dist/components/label.js.map +1 -1
  30. package/dist/components/link.component.d.ts +1 -1
  31. package/dist/components/link.js +1 -1
  32. package/dist/components/link.js.map +1 -1
  33. package/dist/components/menu-item.component.d.ts +1 -1
  34. package/dist/components/menu.component.d.ts +1 -1
  35. package/dist/components/paragraph.component.d.ts +1 -1
  36. package/dist/components/paragraph.component.d.ts.map +1 -1
  37. package/dist/components/paragraph.js +2 -8
  38. package/dist/components/paragraph.js.map +1 -1
  39. package/dist/components/phone-input.component.d.ts +15 -3
  40. package/dist/components/phone-input.component.d.ts.map +1 -1
  41. package/dist/components/phone-input.js +37 -6
  42. package/dist/components/phone-input.js.map +1 -1
  43. package/dist/components/popup.component.d.ts +1 -1
  44. package/dist/components/qr-code.component.d.ts +1 -1
  45. package/dist/components/radio-button.component.d.ts +1 -1
  46. package/dist/components/radio-group.component.d.ts +1 -1
  47. package/dist/components/radio.component.d.ts +1 -1
  48. package/dist/components/radio.component.d.ts.map +1 -1
  49. package/dist/components/radio.js +12 -16
  50. package/dist/components/radio.js.map +1 -1
  51. package/dist/components/search.component.d.ts +11 -4
  52. package/dist/components/search.component.d.ts.map +1 -1
  53. package/dist/components/search.js +75 -31
  54. package/dist/components/search.js.map +1 -1
  55. package/dist/components/spinner.component.d.ts +1 -1
  56. package/dist/components/step-indicator.component.d.ts +1 -1
  57. package/dist/components/textfield.component.d.ts +2 -2
  58. package/dist/components/textfield.component.d.ts.map +1 -1
  59. package/dist/components/textfield.js +66 -82
  60. package/dist/components/textfield.js.map +1 -1
  61. package/dist/components/tooltip.component.d.ts +1 -1
  62. package/dist/components/validation-message.component.d.ts +1 -1
  63. package/dist/controllers/lang.controller.d.ts +14 -0
  64. package/dist/controllers/lang.controller.d.ts.map +1 -0
  65. package/dist/designsystemet-tailwind.css +355 -297
  66. package/dist/index.d.ts +2 -0
  67. package/dist/index.d.ts.map +1 -1
  68. package/dist/index.js +4 -1
  69. package/dist/index.js.map +1 -1
  70. package/dist/lang.controller-P4W-9ipy.js +32 -0
  71. package/dist/lang.controller-P4W-9ipy.js.map +1 -0
  72. package/dist/styles.css +5 -0
  73. package/dist/theme.css +1155 -0
  74. package/dist/utilities/lang.d.ts +6 -0
  75. package/dist/utilities/lang.d.ts.map +1 -0
  76. package/dist/utilities/lang.js +18 -0
  77. package/dist/utilities/lang.js.map +1 -0
  78. package/dist/utilities/translations.d.ts +42 -0
  79. package/dist/utilities/translations.d.ts.map +1 -0
  80. package/dist/utilities/translations.js +45 -0
  81. package/dist/utilities/translations.js.map +1 -0
  82. package/package.json +34 -16
@@ -1,6 +1,5 @@
1
1
  import { LitElement, html } from "lit";
2
2
  import { property, customElement } from "lit/decorators.js";
3
- import { classMap } from "lit/directives/class-map.js";
4
3
  import { ifDefined } from "lit/directives/if-defined.js";
5
4
  import { styled } from "../mixins/tailwind.mixin.js";
6
5
  var __defProp = Object.defineProperty;
@@ -24,17 +23,9 @@ let MinidLabel = class extends styled(LitElement) {
24
23
  return html`
25
24
  <label
26
25
  for=${ifDefined(this.for)}
27
- class=${classMap({
28
- "fds-label": true,
29
- "fds-label--spacing": this.spacing,
30
- "fds-label--xs": this.size === "xs",
31
- "fds-label--sm": this.size === "sm",
32
- "fds-label--md": this.size === "md",
33
- "fds-label--lg": this.size === "lg",
34
- "fds-label--medium-weight": this.weight === "medium",
35
- "fds-label--regular-weight": this.weight === "normal",
36
- "fds-label--semibold-weight": this.weight === "semibold"
37
- })}
26
+ class="ds-label"
27
+ data-weight=${this.weight}
28
+ data-size=${this.size}
38
29
  >
39
30
  <slot></slot>
40
31
  </label>
@@ -1 +1 @@
1
- {"version":3,"file":"label.js","sources":["../../src/components/label.component.ts"],"sourcesContent":["import { html, LitElement } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { styled } from '../mixins/tailwind.mixin';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'mid-label': MinidLabel;\n }\n}\n\n@customElement('mid-label')\nexport class MinidLabel extends styled(LitElement) {\n /**\n * Font size\n * @default 'md'\n */\n @property()\n size: 'xs' | 'sm' | 'md' | 'lg' = 'md';\n\n @property()\n for?: string;\n\n /**\n * Add margin below element\n * @default false\n */\n @property({ type: Boolean })\n spacing = false;\n\n /**\n * Font weight\n * @default 'medium'\n */\n @property()\n weight: 'medium' | 'normal' | 'semibold' = 'medium';\n\n override render() {\n return html`\n <label\n for=${ifDefined(this.for)}\n class=${classMap({\n 'fds-label': true,\n 'fds-label--spacing': this.spacing,\n 'fds-label--xs': this.size === 'xs',\n 'fds-label--sm': this.size === 'sm',\n 'fds-label--md': this.size === 'md',\n 'fds-label--lg': this.size === 'lg',\n 'fds-label--medium-weight': this.weight === 'medium',\n 'fds-label--regular-weight': this.weight === 'normal',\n 'fds-label--semibold-weight': this.weight === 'semibold',\n })}\n >\n <slot></slot>\n </label>\n `;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AAaO,IAAM,aAAN,cAAyB,OAAO,UAAU,EAAE;AAAA,EAA5C,cAAA;AAAA,UAAA,GAAA,SAAA;AAML,SAAA,OAAkC;AAUlC,SAAA,UAAU;AAOV,SAAA,SAA2C;AAAA,EAAA;AAAA,EAElC,SAAS;AAChB,WAAO;AAAA;AAAA,cAEG,UAAU,KAAK,GAAG,CAAC;AAAA,gBACjB,SAAS;AAAA,MACf,aAAa;AAAA,MACb,sBAAsB,KAAK;AAAA,MAC3B,iBAAiB,KAAK,SAAS;AAAA,MAC/B,iBAAiB,KAAK,SAAS;AAAA,MAC/B,iBAAiB,KAAK,SAAS;AAAA,MAC/B,iBAAiB,KAAK,SAAS;AAAA,MAC/B,4BAA4B,KAAK,WAAW;AAAA,MAC5C,6BAA6B,KAAK,WAAW;AAAA,MAC7C,8BAA8B,KAAK,WAAW;AAAA,IAAA,CAC/C,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA,EAKR;AACF;AAvCE,gBAAA;AAAA,EADC,SAAA;AAAS,GALC,WAMX,WAAA,QAAA,CAAA;AAGA,gBAAA;AAAA,EADC,SAAA;AAAS,GARC,WASX,WAAA,OAAA,CAAA;AAOA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,QAAA,CAAS;AAAA,GAfhB,WAgBX,WAAA,WAAA,CAAA;AAOA,gBAAA;AAAA,EADC,SAAA;AAAS,GAtBC,WAuBX,WAAA,UAAA,CAAA;AAvBW,aAAN,gBAAA;AAAA,EADN,cAAc,WAAW;AAAA,GACb,UAAA;"}
1
+ {"version":3,"file":"label.js","sources":["../../src/components/label.component.ts"],"sourcesContent":["import { html, LitElement } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { styled } from '../mixins/tailwind.mixin';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'mid-label': MinidLabel;\n }\n}\n\n@customElement('mid-label')\nexport class MinidLabel extends styled(LitElement) {\n /**\n * Font size\n * @default 'md'\n */\n @property()\n size: 'xs' | 'sm' | 'md' | 'lg' = 'md';\n\n @property()\n for?: string;\n\n /**\n * Add margin below element\n * @default false\n */\n @property({ type: Boolean })\n spacing = false;\n\n /**\n * Font weight\n * @default 'medium'\n */\n @property()\n weight: 'medium' | 'normal' | 'semibold' = 'medium';\n\n override render() {\n return html`\n <label\n for=${ifDefined(this.for)}\n class=\"ds-label\"\n data-weight=${this.weight}\n data-size=${this.size}\n >\n <slot></slot>\n </label>\n `;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAYO,IAAM,aAAN,cAAyB,OAAO,UAAU,EAAE;AAAA,EAA5C,cAAA;AAAA,UAAA,GAAA,SAAA;AAML,SAAA,OAAkC;AAUlC,SAAA,UAAU;AAOV,SAAA,SAA2C;AAAA,EAAA;AAAA,EAElC,SAAS;AAChB,WAAO;AAAA;AAAA,cAEG,UAAU,KAAK,GAAG,CAAC;AAAA;AAAA,sBAEX,KAAK,MAAM;AAAA,oBACb,KAAK,IAAI;AAAA;AAAA;AAAA;AAAA;AAAA,EAK3B;AACF;AA/BE,gBAAA;AAAA,EADC,SAAA;AAAS,GALC,WAMX,WAAA,QAAA,CAAA;AAGA,gBAAA;AAAA,EADC,SAAA;AAAS,GARC,WASX,WAAA,OAAA,CAAA;AAOA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,QAAA,CAAS;AAAA,GAfhB,WAgBX,WAAA,WAAA,CAAA;AAOA,gBAAA;AAAA,EADC,SAAA;AAAS,GAtBC,WAuBX,WAAA,UAAA,CAAA;AAvBW,aAAN,gBAAA;AAAA,EADN,cAAc,WAAW;AAAA,GACb,UAAA;"}
@@ -8,7 +8,7 @@ declare const MinidLink_base: typeof LitElement;
8
8
  export declare class MinidLink extends MinidLink_base {
9
9
  href?: string;
10
10
  target?: string;
11
- render(): import('lit-html').TemplateResult<1>;
11
+ render(): import('lit').TemplateResult<1>;
12
12
  }
13
13
  export {};
14
14
  //# sourceMappingURL=link.component.d.ts.map
@@ -16,7 +16,7 @@ let MinidLink = class extends styled(LitElement) {
16
16
  render() {
17
17
  return html`
18
18
  <a
19
- class="text-accent-subtle visited:text-link-visited focus-visible:bg-focus-outer hover:text-accent inline-flex items-center gap-2 underline decoration-[.0625rem] underline-offset-[.27em] outline-0 hover:decoration-[.125rem] focus-visible:text-white"
19
+ class="ds-link"
20
20
  href=${ifDefined(this.href)}
21
21
  target=${ifDefined(this.target)}
22
22
  >
@@ -1 +1 @@
1
- {"version":3,"file":"link.js","sources":["../../src/components/link.component.ts"],"sourcesContent":["import { html, LitElement } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { styled } from '../mixins/tailwind.mixin';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'mid-link': MinidLink;\n }\n}\n\n@customElement('mid-link')\nexport class MinidLink extends styled(LitElement) {\n @property()\n href?: string;\n\n @property()\n target?: string;\n\n override render() {\n return html`\n <a\n class=\"text-accent-subtle visited:text-link-visited focus-visible:bg-focus-outer hover:text-accent inline-flex items-center gap-2 underline decoration-[.0625rem] underline-offset-[.27em] outline-0 hover:decoration-[.125rem] focus-visible:text-white\"\n href=${ifDefined(this.href)}\n target=${ifDefined(this.target)}\n >\n <slot></slot>\n </a>\n `;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAYO,IAAM,YAAN,cAAwB,OAAO,UAAU,EAAE;AAAA,EAOvC,SAAS;AAChB,WAAO;AAAA;AAAA;AAAA,eAGI,UAAU,KAAK,IAAI,CAAC;AAAA,iBAClB,UAAU,KAAK,MAAM,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA,EAKrC;AACF;AAhBE,gBAAA;AAAA,EADC,SAAA;AAAS,GADC,UAEX,WAAA,QAAA,CAAA;AAGA,gBAAA;AAAA,EADC,SAAA;AAAS,GAJC,UAKX,WAAA,UAAA,CAAA;AALW,YAAN,gBAAA;AAAA,EADN,cAAc,UAAU;AAAA,GACZ,SAAA;"}
1
+ {"version":3,"file":"link.js","sources":["../../src/components/link.component.ts"],"sourcesContent":["import { html, LitElement } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { styled } from '../mixins/tailwind.mixin';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'mid-link': MinidLink;\n }\n}\n\n@customElement('mid-link')\nexport class MinidLink extends styled(LitElement) {\n @property()\n href?: string;\n\n @property()\n target?: string;\n\n override render() {\n return html`\n <a\n class=\"ds-link\"\n href=${ifDefined(this.href)}\n target=${ifDefined(this.target)}\n >\n <slot></slot>\n </a>\n `;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAYO,IAAM,YAAN,cAAwB,OAAO,UAAU,EAAE;AAAA,EAOvC,SAAS;AAChB,WAAO;AAAA;AAAA;AAAA,eAGI,UAAU,KAAK,IAAI,CAAC;AAAA,iBAClB,UAAU,KAAK,MAAM,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA,EAKrC;AACF;AAhBE,gBAAA;AAAA,EADC,SAAA;AAAS,GADC,UAEX,WAAA,QAAA,CAAA;AAGA,gBAAA;AAAA,EADC,SAAA;AAAS,GAJC,UAKX,WAAA,UAAA,CAAA;AALW,YAAN,gBAAA;AAAA,EADN,cAAc,UAAU;AAAA,GACZ,SAAA;"}
@@ -30,7 +30,7 @@ export declare class MinidMenuItem extends MinidMenuItem_base {
30
30
  handleHostFocus(): void;
31
31
  focus(): void;
32
32
  setActive(active: boolean): void;
33
- render(): import('lit-html').TemplateResult<1>;
33
+ render(): import('lit').TemplateResult<1>;
34
34
  }
35
35
  export {};
36
36
  //# sourceMappingURL=menu-item.component.d.ts.map
@@ -52,7 +52,7 @@ export declare class MinidMenu extends MinidMenu_base {
52
52
  */
53
53
  setCurrentItem(item: MinidMenuItem): void;
54
54
  focusSearchField(): void;
55
- render(): import('lit-html').TemplateResult<1>;
55
+ render(): import('lit').TemplateResult<1>;
56
56
  }
57
57
  export {};
58
58
  //# sourceMappingURL=menu.component.d.ts.map
@@ -22,7 +22,7 @@ export declare class MinidParagraph extends MinidParagraph_base {
22
22
  * @default false
23
23
  */
24
24
  spacing: boolean;
25
- render(): import('lit-html').TemplateResult<1>;
25
+ render(): import('lit').TemplateResult<1>;
26
26
  }
27
27
  export {};
28
28
  //# sourceMappingURL=paragraph.component.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"paragraph.component.d.ts","sourceRoot":"","sources":["../../src/components/paragraph.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,UAAU,EAAE,MAAM,KAAK,CAAC;AAKvC,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,eAAe,EAAE,cAAc,CAAC;KACjC;CACF;;AAED;;GAEG;AACH,qBACa,cAAe,SAAQ,mBAAkB;IACpD;;;;;;OAMG;IAEH,IAAI,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAQ;IAEvC;;;OAGG;IAEH,OAAO,UAAS;IAEP,MAAM;CAahB"}
1
+ {"version":3,"file":"paragraph.component.d.ts","sourceRoot":"","sources":["../../src/components/paragraph.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,UAAU,EAAE,MAAM,KAAK,CAAC;AAIvC,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,eAAe,EAAE,cAAc,CAAC;KACjC;CACF;;AAED;;GAEG;AACH,qBACa,cAAe,SAAQ,mBAAkB;IACpD;;;;;;OAMG;IAEH,IAAI,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAQ;IAEvC;;;OAGG;IAEH,OAAO,UAAS;IAEP,MAAM;CAQhB"}
@@ -1,6 +1,5 @@
1
1
  import { LitElement, html } from "lit";
2
2
  import { property, customElement } from "lit/decorators.js";
3
- import { classMap } from "lit/directives/class-map.js";
4
3
  import { styled } from "../mixins/tailwind.mixin.js";
5
4
  var __defProp = Object.defineProperty;
6
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -20,13 +19,8 @@ let MinidParagraph = class extends styled(LitElement) {
20
19
  }
21
20
  render() {
22
21
  return html`<p
23
- class="${classMap({
24
- "mb-2": this.spacing,
25
- "text-body-xs": this.size === "xs",
26
- "text-body-sm": this.size === "sm",
27
- "text-body-md": this.size === "md",
28
- "text-body-lg": this.size === "lg"
29
- })}"
22
+ class="ds-paragraph"
23
+ data-size=${this.size}
30
24
  >
31
25
  <slot></slot>
32
26
  </p> `;
@@ -1 +1 @@
1
- {"version":3,"file":"paragraph.js","sources":["../../src/components/paragraph.component.ts"],"sourcesContent":["import { html, LitElement } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { styled } from '../mixins/tailwind.mixin';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'mid-paragraph': MinidParagraph;\n }\n}\n\n/**\n * A paragraph\n */\n@customElement('mid-paragraph')\nexport class MinidParagraph extends styled(LitElement) {\n /**\n * `'xs' = 14px`\n * `'sm' = 16px`\n * `'md' = 18px`\n * `'lg' = 21px`\n * @default 'md'\n */\n @property()\n size: 'xs' | 'sm' | 'md' | 'lg' = 'md';\n\n /**\n * Add margin below element\n * @default false\n */\n @property({ type: Boolean })\n spacing = false;\n\n override render() {\n return html`<p\n class=\"${classMap({\n 'mb-2': this.spacing,\n 'text-body-xs': this.size === 'xs',\n 'text-body-sm': this.size === 'sm',\n 'text-body-md': this.size === 'md',\n 'text-body-lg': this.size === 'lg',\n })}\"\n >\n <slot></slot>\n </p> `;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAeO,IAAM,iBAAN,cAA6B,OAAO,UAAU,EAAE;AAAA,EAAhD,cAAA;AAAA,UAAA,GAAA,SAAA;AASL,SAAA,OAAkC;AAOlC,SAAA,UAAU;AAAA,EAAA;AAAA,EAED,SAAS;AAChB,WAAO;AAAA,eACI,SAAS;AAAA,MAChB,QAAQ,KAAK;AAAA,MACb,gBAAgB,KAAK,SAAS;AAAA,MAC9B,gBAAgB,KAAK,SAAS;AAAA,MAC9B,gBAAgB,KAAK,SAAS;AAAA,MAC9B,gBAAgB,KAAK,SAAS;AAAA,IAAA,CAC/B,CAAC;AAAA;AAAA;AAAA;AAAA,EAIN;AACF;AAtBE,gBAAA;AAAA,EADC,SAAA;AAAS,GARC,eASX,WAAA,QAAA,CAAA;AAOA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,QAAA,CAAS;AAAA,GAfhB,eAgBX,WAAA,WAAA,CAAA;AAhBW,iBAAN,gBAAA;AAAA,EADN,cAAc,eAAe;AAAA,GACjB,cAAA;"}
1
+ {"version":3,"file":"paragraph.js","sources":["../../src/components/paragraph.component.ts"],"sourcesContent":["import { html, LitElement } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { styled } from '../mixins/tailwind.mixin';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'mid-paragraph': MinidParagraph;\n }\n}\n\n/**\n * A paragraph\n */\n@customElement('mid-paragraph')\nexport class MinidParagraph extends styled(LitElement) {\n /**\n * `'xs' = 14px`\n * `'sm' = 16px`\n * `'md' = 18px`\n * `'lg' = 21px`\n * @default 'md'\n */\n @property()\n size: 'xs' | 'sm' | 'md' | 'lg' = 'md';\n\n /**\n * Add margin below element\n * @default false\n */\n @property({ type: Boolean })\n spacing = false;\n\n override render() {\n return html`<p\n class=\"ds-paragraph\"\n data-size=${this.size}\n >\n <slot></slot>\n </p> `;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;AAcO,IAAM,iBAAN,cAA6B,OAAO,UAAU,EAAE;AAAA,EAAhD,cAAA;AAAA,UAAA,GAAA,SAAA;AASL,SAAA,OAAkC;AAOlC,SAAA,UAAU;AAAA,EAAA;AAAA,EAED,SAAS;AAChB,WAAO;AAAA;AAAA,kBAEO,KAAK,IAAI;AAAA;AAAA;AAAA;AAAA,EAIzB;AACF;AAjBE,gBAAA;AAAA,EADC,SAAA;AAAS,GARC,eASX,WAAA,QAAA,CAAA;AAOA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,QAAA,CAAS;AAAA,GAfhB,eAgBX,WAAA,WAAA,CAAA;AAhBW,iBAAN,gBAAA;AAAA,EADN,cAAc,eAAe;AAAA,GACjB,cAAA;"}
@@ -5,7 +5,8 @@ declare global {
5
5
  'mid-phone-input': MinidPhoneInput;
6
6
  }
7
7
  }
8
- declare const MinidPhoneInput_base: import('../types/mixin-constructor').Constructor<import('../types/form-control').FormControlInterface> & typeof LitElement;
8
+ type PhoneAutocomplete = 'tel' | 'tel-national';
9
+ declare const MinidPhoneInput_base: import('../types/mixin-constructor.js').Constructor<import('../types/form-control.js').FormControlInterface> & typeof LitElement;
9
10
  /**
10
11
  * @event {Event} mid-country-click - Emitted when the country button is clicked
11
12
  * @event {Event} mid-change - Emitted when the value is modified by the user
@@ -55,6 +56,15 @@ export declare class MinidPhoneInput extends MinidPhoneInput_base {
55
56
  * The country selected. A two letter ISO country code like: `"NO"`
56
57
  */
57
58
  country?: CountryCode;
59
+ /**
60
+ * Controls the native browser autofill token used for the phone number input.
61
+ *
62
+ * `tel` expects a full phone number, including country code when available.
63
+ * If a value without a country code matches the selected country, the country
64
+ * prefix is added.
65
+ * `tel-national` expects the national number and prefixes the selected country.
66
+ */
67
+ autocomplete: PhoneAutocomplete;
58
68
  /**
59
69
  * Activates invalid styling
60
70
  */
@@ -72,7 +82,7 @@ export declare class MinidPhoneInput extends MinidPhoneInput_base {
72
82
  */
73
83
  readonly: boolean;
74
84
  hasFocus: boolean;
75
- static get formControlValidators(): import('../types/validator.type').Validator[];
85
+ static get formControlValidators(): import('../types/validator.type.js').Validator[];
76
86
  constructor();
77
87
  get validationTarget(): HTMLInputElement;
78
88
  validationMessageCallback(message: string): void;
@@ -86,13 +96,15 @@ export declare class MinidPhoneInput extends MinidPhoneInput_base {
86
96
  private handleChange;
87
97
  private handleKeydown;
88
98
  private handleInput;
99
+ private getCountryCodePrefix;
100
+ private applyAutocompletePrefix;
89
101
  private handleNewValue;
90
102
  private valueChangeCallback;
91
103
  private handleFocus;
92
104
  private removePhonePrefix;
93
105
  focus(options?: FocusOptions): void;
94
106
  handleCountryChange(): void;
95
- render(): import('lit-html').TemplateResult<1>;
107
+ render(): import('lit').TemplateResult<1>;
96
108
  }
97
109
  export {};
98
110
  //# sourceMappingURL=phone-input.component.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"phone-input.component.d.ts","sourceRoot":"","sources":["../../src/components/phone-input.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,UAAU,EAAW,MAAM,KAAK,CAAC;AAKrD,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;;AAYD;;;;;;;;;;;;GAYG;AACH,qBACa,eAAgB,SAAQ,oBAEpC;IACC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAS;IACtC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA4C;IACpE,OAAO,CAAC,SAAS,CAAmB;IACpC,OAAO,CAAC,iBAAiB,CAAS;IAClC,OAAO,CAAC,YAAY,CAAiB;IACrC,OAAO,CAAC,eAAe,CAAM;IAC7B,OAAO,CAAC,gBAAgB,CAAwC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AO,CAAC,WAAW;IASnB,OAAO,CAAC,oBAAoB;IAQ5B,OAAO,CAAC,uBAAuB;IAsB/B,OAAO,CAAC,cAAc;IAiBtB,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;CAmHhB"}
@@ -3,13 +3,16 @@ import { query, property, state, customElement } from "lit/decorators.js";
3
3
  import { classMap } from "lit/directives/class-map.js";
4
4
  import { ifDefined } from "lit/directives/if-defined.js";
5
5
  import { styled } from "../mixins/tailwind.mixin.js";
6
- import { AsYouType, getCountryCallingCode, formatIncompletePhoneNumber, parsePhoneNumberCharacter } from "libphonenumber-js";
6
+ import { AsYouType, getCountryCallingCode, formatIncompletePhoneNumber, parsePhoneNumberCharacter, parsePhoneNumberFromString } from "libphonenumber-js";
7
7
  import "./icon/icon.js";
8
8
  import { templateParser, templateFormatter, onKeyDown, onChange } from "input-format";
9
9
  import { watch } from "../internal/watch.js";
10
10
  import { HasSlotController } from "../internal/slot.js";
11
11
  import { FormControlMixin } from "../mixins/form-control.mixin.js";
12
12
  import { requiredValidator } from "../mixins/validators.js";
13
+ import { L as LangController } from "../lang.controller-P4W-9ipy.js";
14
+ import { getLang } from "../utilities/lang.js";
15
+ import { getTranslations } from "../utilities/translations.js";
13
16
  var __defProp = Object.defineProperty;
14
17
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
15
18
  var __decorateClass = (decorators, target, key, kind) => {
@@ -44,6 +47,7 @@ let MinidPhoneInput = class extends FormControlMixin(
44
47
  this.countrycode = "";
45
48
  this.label = "";
46
49
  this.hidelabel = false;
50
+ this.autocomplete = "tel";
47
51
  this.invalid = false;
48
52
  this.invalidmessage = "";
49
53
  this.required = false;
@@ -63,6 +67,7 @@ let MinidPhoneInput = class extends FormControlMixin(
63
67
  }
64
68
  this.dispatchEvent(this.currentEvent);
65
69
  };
70
+ new LangController(this);
66
71
  nextUniqueId++;
67
72
  this.inputId = `mid-phone-input-input-${nextUniqueId}`;
68
73
  this.validationId = `mid-phone-input-validation-${nextUniqueId}`;
@@ -152,11 +157,32 @@ let MinidPhoneInput = class extends FormControlMixin(
152
157
  });
153
158
  this.handleNewValue(event);
154
159
  }
160
+ getCountryCodePrefix() {
161
+ if (this.country) {
162
+ return `+${getCountryCallingCode(this.country)}`;
163
+ }
164
+ return this.countrycode;
165
+ }
166
+ applyAutocompletePrefix(value) {
167
+ if (value.startsWith("+")) {
168
+ return value;
169
+ }
170
+ const countryCodePrefix = this.getCountryCodePrefix();
171
+ if (this.autocomplete === "tel-national" && countryCodePrefix) {
172
+ return `${countryCodePrefix}${value}`;
173
+ }
174
+ if (this.autocomplete === "tel" && this.country) {
175
+ const phoneNumber = parsePhoneNumberFromString(value, this.country);
176
+ const valueWithPlus = `+${value.replaceAll(/\D/g, "")}`;
177
+ if (phoneNumber?.isValid() && phoneNumber.number !== valueWithPlus) {
178
+ return phoneNumber.number;
179
+ }
180
+ }
181
+ return `+${value}`;
182
+ }
155
183
  handleNewValue(event) {
156
184
  this.formatter.reset();
157
- if (!this.input.value.startsWith("+")) {
158
- this.input.value = `+${this.input.value}`;
159
- }
185
+ this.input.value = this.applyAutocompletePrefix(this.input.value);
160
186
  this.formatter.input(this.input.value);
161
187
  this.currentTemplate = this.formatter.getTemplate();
162
188
  onChange(
@@ -203,6 +229,8 @@ let MinidPhoneInput = class extends FormControlMixin(
203
229
  const lg = false;
204
230
  const md = true;
205
231
  const sm = false;
232
+ const lang = getLang(this);
233
+ const t = getTranslations(lang);
206
234
  const hasLabelSlot = this.hasSlotControler.test("label");
207
235
  const hasLabel = !!this.label || !!hasLabelSlot;
208
236
  const hasError = this.invalid || !!this.invalidmessage;
@@ -238,7 +266,7 @@ let MinidPhoneInput = class extends FormControlMixin(
238
266
  <div part="base" class="flex h-12">
239
267
  <button
240
268
  part="country-button"
241
- aria-label="Open country selector"
269
+ aria-label=${t.openCountrySelector}
242
270
  class="${classMap({
243
271
  "border-neutral": !this.readonly,
244
272
  "border-neutral-subtle": this.readonly,
@@ -276,7 +304,7 @@ let MinidPhoneInput = class extends FormControlMixin(
276
304
  })} focus-visible:focus-ring grow rounded-r px-3"
277
305
  part="phone-number"
278
306
  type="tel"
279
- autocomplete="tel"
307
+ autocomplete=${this.autocomplete}
280
308
  ?readonly=${this.readonly}
281
309
  value=${this.value}
282
310
  aria-describedby=${ifDefined(describedBy)}
@@ -328,6 +356,9 @@ __decorateClass([
328
356
  __decorateClass([
329
357
  property({ reflect: true })
330
358
  ], MinidPhoneInput.prototype, "country", 2);
359
+ __decorateClass([
360
+ property()
361
+ ], MinidPhoneInput.prototype, "autocomplete", 2);
331
362
  __decorateClass([
332
363
  property({ type: Boolean })
333
364
  ], MinidPhoneInput.prototype, "invalid", 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 { 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,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A;AAAA,EADC,SAAS,EAAE,SAAS,KAAA,CAAM;AAAA,GA/BhB,gBAgCX,WAAA,eAAA,CAAA;AAOA,gBAAA;AAAA,EADC,SAAA;AAAS,GAtCC,gBAuCX,WAAA,SAAA,CAAA;AAMA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,QAAA,CAAS;AAAA,GA5ChB,gBA6CX,WAAA,aAAA,CAAA;AAMA,gBAAA;AAAA,EADC,SAAS,EAAE,SAAS,KAAA,CAAM;AAAA,GAlDhB,gBAmDX,WAAA,WAAA,CAAA;AAMA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,QAAA,CAAS;AAAA,GAxDhB,gBAyDX,WAAA,WAAA,CAAA;AAMA,gBAAA;AAAA,EADC,SAAA;AAAS,GA9DC,gBA+DX,WAAA,kBAAA,CAAA;AAMA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,QAAA,CAAS;AAAA,GApEhB,gBAqEX,WAAA,YAAA,CAAA;AAMA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,QAAA,CAAS;AAAA,GA1EhB,gBA2EX,WAAA,YAAA,CAAA;AAGA,gBAAA;AAAA,EADC,MAAA;AAAM,GA7EI,gBA8EX,WAAA,YAAA,CAAA;AA4LA,gBAAA;AAAA,EADC,MAAM,WAAW,EAAE,sBAAsB,MAAM;AAAA,GAzQrC,gBA0QX,WAAA,uBAAA,CAAA;AA1QW,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 parsePhoneNumberFromString,\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';\nimport { LangController } from '../controllers/lang.controller.js';\nimport { getLang } from '../utilities/lang';\nimport { getTranslations } from '../utilities/translations';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'mid-phone-input': MinidPhoneInput;\n }\n}\n\ntype PhoneAutocomplete = 'tel' | 'tel-national';\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 * Controls the native browser autofill token used for the phone number input.\n *\n * `tel` expects a full phone number, including country code when available.\n * If a value without a country code matches the selected country, the country\n * prefix is added.\n * `tel-national` expects the national number and prefixes the selected country.\n */\n @property()\n autocomplete: PhoneAutocomplete = 'tel';\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 new LangController(this);\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 getCountryCodePrefix() {\n if (this.country) {\n return `+${getCountryCallingCode(this.country)}`;\n }\n\n return this.countrycode;\n }\n\n private applyAutocompletePrefix(value: string) {\n if (value.startsWith('+')) {\n return value;\n }\n\n const countryCodePrefix = this.getCountryCodePrefix();\n if (this.autocomplete === 'tel-national' && countryCodePrefix) {\n return `${countryCodePrefix}${value}`;\n }\n\n if (this.autocomplete === 'tel' && this.country) {\n const phoneNumber = parsePhoneNumberFromString(value, this.country);\n const valueWithPlus = `+${value.replaceAll(/\\D/g, '')}`;\n\n if (phoneNumber?.isValid() && phoneNumber.number !== valueWithPlus) {\n return phoneNumber.number;\n }\n }\n\n return `+${value}`;\n }\n\n private handleNewValue(event: Event) {\n this.formatter.reset();\n\n this.input.value = this.applyAutocompletePrefix(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 lang = getLang(this);\n const t = getTranslations(lang);\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=${t.openCountrySelector}\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=${this.autocomplete}\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":";;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,MAAM,SAAS;AAAA,EACb;AAAA;AAAA;AAAA;AAAA;AAKF;AAEA,IAAI,eAAe;AAgBZ,IAAM,kBAAN,cAA8B;AAAA,EACnC,OAAO,YAAY,MAAM;AAC3B,EAAE;AAAA,EA6FA,cAAc;AACZ,UAAA;AA3FF,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;AAiBZ,SAAA,eAAkC;AAMlC,SAAA,UAAU;AAMV,SAAA,iBAAiB;AAMjB,SAAA,WAAW;AAMX,SAAA,WAAW;AAGX,SAAA,WAAW;AA6KX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M,QAAA,CAAS;AAAA,GA/EhB,gBAgFX,WAAA,YAAA,CAAA;AAMA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,QAAA,CAAS;AAAA,GArFhB,gBAsFX,WAAA,YAAA,CAAA;AAGA,gBAAA;AAAA,EADC,MAAA;AAAM,GAxFI,gBAyFX,WAAA,YAAA,CAAA;AA0NA,gBAAA;AAAA,EADC,MAAM,WAAW,EAAE,sBAAsB,MAAM;AAAA,GAlTrC,gBAmTX,WAAA,uBAAA,CAAA;AAnTW,kBAAN,gBAAA;AAAA,EADN,cAAc,iBAAiB;AAAA,GACnB,eAAA;"}
@@ -166,7 +166,7 @@ export declare class MinidPopup extends MinidPopup_base {
166
166
  /** Forces the popup to recalculate and reposition itself. */
167
167
  reposition(): void;
168
168
  private updateHoverBridge;
169
- render(): import('lit-html').TemplateResult<1>;
169
+ render(): import('lit').TemplateResult<1>;
170
170
  }
171
171
  export {};
172
172
  //# sourceMappingURL=popup.component.d.ts.map
@@ -35,7 +35,7 @@ export declare class MinidQrCode extends MinidQrCode_base {
35
35
  background: string;
36
36
  margin: number;
37
37
  protected updated(): void;
38
- render(): import('lit-html').TemplateResult<1>;
38
+ render(): import('lit').TemplateResult<1>;
39
39
  }
40
40
  export {};
41
41
  //# sourceMappingURL=qr-code.component.d.ts.map
@@ -46,7 +46,7 @@ export declare class MinidRadioButton extends MinidRadioButton_base {
46
46
  * Removes focus from the radio button.
47
47
  */
48
48
  blur(): void;
49
- render(): import('lit-html').TemplateResult<1>;
49
+ render(): import('lit').TemplateResult<1>;
50
50
  }
51
51
  export {};
52
52
  //# sourceMappingURL=radio-button.component.d.ts.map
@@ -55,7 +55,7 @@ export declare class MinidRadioGroup extends MinidRadioGroup_base {
55
55
  * Sets focus on the radio-group.
56
56
  */
57
57
  focus(options?: FocusOptions): void;
58
- render(): import('lit-html').TemplateResult<1>;
58
+ render(): import('lit').TemplateResult<1>;
59
59
  }
60
60
  export {};
61
61
  //# sourceMappingURL=radio-group.component.d.ts.map
@@ -48,7 +48,7 @@ export declare class MinidRadio extends MinidRadio_base {
48
48
  * Sets focus on the radio button.
49
49
  */
50
50
  focus(options?: FocusOptions): void;
51
- render(): import('lit-html').TemplateResult<1>;
51
+ render(): import('lit').TemplateResult<1>;
52
52
  }
53
53
  export {};
54
54
  //# sourceMappingURL=radio.component.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"radio.component.d.ts","sourceRoot":"","sources":["../../src/components/radio.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,UAAU,EAAE,MAAM,KAAK,CAAC;AAO5C,OAAO,0BAA0B,CAAC;AAElC,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,WAAW,EAAE,UAAU,CAAC;KACzB;CACF;;AAcD;;;;;;;;;GASG;AACH,qBACa,UAAW,SAAQ,eAA4C;IAE1E,KAAK,EAAG,gBAAgB,CAAC;IAEzB;;OAEG;IAEH,IAAI,SAAY;IAEhB;;OAEG;IAEH,OAAO,UAAS;IAEhB;;OAEG;IAEH,KAAK,SAAM;IAEX;;OAEG;IAEH,QAAQ,UAAS;IAGjB,OAAO,UAAS;IAEhB,qBAAqB,IAAI,OAAO;IAIhC,IAAI,gBAAgB,qBAEnB;;IASD,iBAAiB;IAQjB,OAAO,CAAC,aAAa;IAkBrB,OAAO,CAAC,UAAU;IAOlB,OAAO,CAAC,WAAW;IAWnB,OAAO,CAAC,WAAW;IAYnB,oBAAoB;IAKpB,iBAAiB;IAIjB;;OAEG;IACH,KAAK,CAAC,OAAO,CAAC,EAAE,YAAY;IAInB,MAAM;CAwBhB"}
1
+ {"version":3,"file":"radio.component.d.ts","sourceRoot":"","sources":["../../src/components/radio.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,UAAU,EAAE,MAAM,KAAK,CAAC;AAM5C,OAAO,0BAA0B,CAAC;AAElC,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,WAAW,EAAE,UAAU,CAAC;KACzB;CACF;;AAcD;;;;;;;;;GASG;AACH,qBACa,UAAW,SAAQ,eAA4C;IAE1E,KAAK,EAAG,gBAAgB,CAAC;IAEzB;;OAEG;IAEH,IAAI,SAAY;IAEhB;;OAEG;IAEH,OAAO,UAAS;IAEhB;;OAEG;IAEH,KAAK,SAAM;IAEX;;OAEG;IAEH,QAAQ,UAAS;IAGjB,OAAO,UAAS;IAEhB,qBAAqB,IAAI,OAAO;IAIhC,IAAI,gBAAgB,qBAEnB;;IASD,iBAAiB;IAQjB,OAAO,CAAC,aAAa;IAkBrB,OAAO,CAAC,UAAU;IAOlB,OAAO,CAAC,WAAW;IAWnB,OAAO,CAAC,WAAW;IAYnB,oBAAoB;IAKpB,iBAAiB;IAIjB;;OAEG;IACH,KAAK,CAAC,OAAO,CAAC,EAAE,YAAY;IAInB,MAAM;CAqBhB"}
@@ -1,7 +1,6 @@
1
1
  import { css, LitElement, html } from "lit";
2
2
  import { query, property, customElement } from "lit/decorators.js";
3
3
  import { live } from "lit/directives/live.js";
4
- import { classMap } from "lit/directives/class-map.js";
5
4
  import { watch } from "../internal/watch.js";
6
5
  import { styled } from "../mixins/tailwind.mixin.js";
7
6
  import { FormControlMixin } from "../mixins/form-control.mixin.js";
@@ -99,26 +98,23 @@ let MinidRadio = class extends FormControlMixin(styled(LitElement, styles)) {
99
98
  }
100
99
  render() {
101
100
  return html`
101
+ <ds-field class="ds-field">
102
+ <input
103
+ type="radio"
104
+ part="radio"
105
+ name="${this.name}"
106
+ class="ds-input"
107
+ ?checked=${live(this.checked)}
108
+ ?disabled=${this.disabled}
109
+ @keydown=${this.handleKeydown}
110
+ />
102
111
  <label
103
112
  part="label"
104
- class="has-disabled:opacity-disabled grid cursor-pointer grid-cols-[auto_1fr] gap-2 has-disabled:cursor-not-allowed"
113
+ class="ds-label"
105
114
  >
106
- <input
107
- type="radio"
108
- part="radio"
109
- name="${this.name}"
110
- class="${classMap({
111
- "bg-neutral": !this.invalid,
112
- "border-neutral": !this.invalid,
113
- "bg-danger-tinted": this.invalid,
114
- "border-danger-base": this.invalid
115
- })} checked:bg-accent-base checked:before:bg-neutral focus-visible:focus-ring-sm checked:border-accent-base my-0.5 grid size-6 cursor-pointer appearance-none place-content-center rounded-full border-2 p-0.5 shadow-none before:size-2.5 before:scale-0 before:rounded-full before:transition-transform before:duration-100 checked:before:scale-100 disabled:cursor-not-allowed"
116
- ?checked=${live(this.checked)}
117
- ?disabled=${this.disabled}
118
- @keydown=${this.handleKeydown}
119
- />
120
115
  <slot></slot>
121
116
  </label>
117
+ </ds-field>
122
118
  `;
123
119
  }
124
120
  };
@@ -1 +1 @@
1
- {"version":3,"file":"radio.js","sources":["../../src/components/radio.component.ts"],"sourcesContent":["import { css, html, LitElement } from 'lit';\nimport { customElement, property, query } from 'lit/decorators.js';\nimport { live } from 'lit/directives/live.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { watch } from '../internal/watch';\nimport { styled } from '../mixins/tailwind.mixin';\nimport { FormControlMixin } from '../mixins/form-control.mixin';\nimport './icon/icon.component.ts';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'mid-radio': MinidRadio;\n }\n}\n\nconst styles = [\n css`\n :host {\n display: inline-flex;\n cursor: pointer;\n }\n :host:has(input:disabled) {\n cursor: not-allowed;\n }\n `,\n];\n\n/**\n *\n * @slot -- The radio's label\n *\n * @event mid-blur - Emitted when the control loses focus.\n * @event mid-focus - Emitted when the control gains focus.\n *\n * @csspart radio - Select the radio input element\n * @csspart label - Select the label element\n */\n@customElement('mid-radio')\nexport class MinidRadio extends FormControlMixin(styled(LitElement, styles)) {\n @query('input[type=\"radio\"]')\n input!: HTMLInputElement;\n\n /**\n * The name of the radio, used to bind together multiple radios.\n */\n @property()\n name = 'option';\n\n /**\n * The radio button's checked state.\n */\n @property({ type: Boolean, reflect: true })\n checked = false;\n\n /**\n * The radio's value. When selected, the radio group will receive this value.\n */\n @property()\n value = '';\n\n /**\n * Disables the radio button.\n */\n @property({ type: Boolean, reflect: true })\n disabled = false;\n\n @property({ type: Boolean })\n invalid = false;\n\n shouldFormValueUpdate(): boolean {\n return this.checked;\n }\n\n get validationTarget() {\n return this.input;\n }\n\n constructor() {\n super();\n this.addEventListener('blur', this.handleBlur);\n this.addEventListener('click', this.handleClick);\n this.addEventListener('focus', this.handleFocus);\n }\n\n connectedCallback() {\n super.connectedCallback();\n this.setAttribute('role', 'presentation');\n this.setAttribute('aria-disabled', this.disabled ? 'true' : 'false');\n\n this.classList.add('rounded');\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.classList.remove('shadow-focus-visible');\n this.dispatchEvent(\n new Event('mid-blur', { composed: true, bubbles: true })\n );\n }\n\n private handleFocus() {\n if (this.disabled) {\n return;\n }\n\n this.focus();\n this.dispatchEvent(\n new Event('mid-focus', { composed: true, bubbles: true })\n );\n }\n\n private handleClick(event: MouseEvent) {\n if (this.disabled) {\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n\n this.checked = true;\n this.dispatchEvent(new Event('mid-change'));\n }\n\n @watch('disabled', { waitUntilFirstUpdate: true })\n handleDisabledChange() {\n this.setAttribute('aria-disabled', this.disabled ? 'true' : 'false');\n }\n\n @watch('checked', { waitUntilFirstUpdate: true })\n handleCheckChange() {\n this.input.checked = this.checked;\n }\n\n /**\n * Sets focus on the radio button.\n */\n focus(options?: FocusOptions) {\n this.input.focus(options);\n }\n\n override render() {\n return html`\n <label\n part=\"label\"\n class=\"has-disabled:opacity-disabled grid cursor-pointer grid-cols-[auto_1fr] gap-2 has-disabled:cursor-not-allowed\"\n >\n <input\n type=\"radio\"\n part=\"radio\"\n name=\"${this.name}\"\n class=\"${classMap({\n 'bg-neutral': !this.invalid,\n 'border-neutral': !this.invalid,\n 'bg-danger-tinted': this.invalid,\n 'border-danger-base': this.invalid,\n })} checked:bg-accent-base checked:before:bg-neutral focus-visible:focus-ring-sm checked:border-accent-base my-0.5 grid size-6 cursor-pointer appearance-none place-content-center rounded-full border-2 p-0.5 shadow-none before:size-2.5 before:scale-0 before:rounded-full before:transition-transform before:duration-100 checked:before:scale-100 disabled:cursor-not-allowed\"\n ?checked=${live(this.checked)}\n ?disabled=${this.disabled}\n @keydown=${this.handleKeydown}\n />\n <slot></slot>\n </label>\n `;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAeA,MAAM,SAAS;AAAA,EACb;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASF;AAaO,IAAM,aAAN,cAAyB,iBAAiB,OAAO,YAAY,MAAM,CAAC,EAAE;AAAA,EAuC3E,cAAc;AACZ,UAAA;AAhCF,SAAA,OAAO;AAMP,SAAA,UAAU;AAMV,SAAA,QAAQ;AAMR,SAAA,WAAW;AAGX,SAAA,UAAU;AAYR,SAAK,iBAAiB,QAAQ,KAAK,UAAU;AAC7C,SAAK,iBAAiB,SAAS,KAAK,WAAW;AAC/C,SAAK,iBAAiB,SAAS,KAAK,WAAW;AAAA,EACjD;AAAA,EAbA,wBAAiC;AAC/B,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,IAAI,mBAAmB;AACrB,WAAO,KAAK;AAAA,EACd;AAAA,EASA,oBAAoB;AAClB,UAAM,kBAAA;AACN,SAAK,aAAa,QAAQ,cAAc;AACxC,SAAK,aAAa,iBAAiB,KAAK,WAAW,SAAS,OAAO;AAEnE,SAAK,UAAU,IAAI,SAAS;AAAA,EAC9B;AAAA,EAEQ,cAAc,OAAsB;AAC1C,UAAM,cACJ,MAAM,WA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,OAAO,CAAC;AAAA,sBACjB,KAAK,QAAQ;AAAA,qBACd,KAAK,aAAa;AAAA;AAAA;AAAA;AAAA;AAAA,EAKrC;AACF;AA5IE,gBAAA;AAAA,EADC,MAAM,qBAAqB;AAAA,GADjB,WAEX,WAAA,SAAA,CAAA;AAMA,gBAAA;AAAA,EADC,SAAA;AAAS,GAPC,WAQX,WAAA,QAAA,CAAA;AAMA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,SAAS,SAAS,MAAM;AAAA,GAb/B,WAcX,WAAA,WAAA,CAAA;AAMA,gBAAA;AAAA,EADC,SAAA;AAAS,GAnBC,WAoBX,WAAA,SAAA,CAAA;AAMA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,SAAS,SAAS,MAAM;AAAA,GAzB/B,WA0BX,WAAA,YAAA,CAAA;AAGA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,QAAA,CAAS;AAAA,GA5BhB,WA6BX,WAAA,WAAA,CAAA;AAyEA,gBAAA;AAAA,EADC,MAAM,YAAY,EAAE,sBAAsB,MAAM;AAAA,GArGtC,WAsGX,WAAA,wBAAA,CAAA;AAKA,gBAAA;AAAA,EADC,MAAM,WAAW,EAAE,sBAAsB,MAAM;AAAA,GA1GrC,WA2GX,WAAA,qBAAA,CAAA;AA3GW,aAAN,gBAAA;AAAA,EADN,cAAc,WAAW;AAAA,GACb,UAAA;"}
1
+ {"version":3,"file":"radio.js","sources":["../../src/components/radio.component.ts"],"sourcesContent":["import { css, html, LitElement } from 'lit';\nimport { customElement, property, query } from 'lit/decorators.js';\nimport { live } from 'lit/directives/live.js';\nimport { watch } from '../internal/watch';\nimport { styled } from '../mixins/tailwind.mixin';\nimport { FormControlMixin } from '../mixins/form-control.mixin';\nimport './icon/icon.component.ts';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'mid-radio': MinidRadio;\n }\n}\n\nconst styles = [\n css`\n :host {\n display: inline-flex;\n cursor: pointer;\n }\n :host:has(input:disabled) {\n cursor: not-allowed;\n }\n `,\n];\n\n/**\n *\n * @slot -- The radio's label\n *\n * @event mid-blur - Emitted when the control loses focus.\n * @event mid-focus - Emitted when the control gains focus.\n *\n * @csspart radio - Select the radio input element\n * @csspart label - Select the label element\n */\n@customElement('mid-radio')\nexport class MinidRadio extends FormControlMixin(styled(LitElement, styles)) {\n @query('input[type=\"radio\"]')\n input!: HTMLInputElement;\n\n /**\n * The name of the radio, used to bind together multiple radios.\n */\n @property()\n name = 'option';\n\n /**\n * The radio button's checked state.\n */\n @property({ type: Boolean, reflect: true })\n checked = false;\n\n /**\n * The radio's value. When selected, the radio group will receive this value.\n */\n @property()\n value = '';\n\n /**\n * Disables the radio button.\n */\n @property({ type: Boolean, reflect: true })\n disabled = false;\n\n @property({ type: Boolean })\n invalid = false;\n\n shouldFormValueUpdate(): boolean {\n return this.checked;\n }\n\n get validationTarget() {\n return this.input;\n }\n\n constructor() {\n super();\n this.addEventListener('blur', this.handleBlur);\n this.addEventListener('click', this.handleClick);\n this.addEventListener('focus', this.handleFocus);\n }\n\n connectedCallback() {\n super.connectedCallback();\n this.setAttribute('role', 'presentation');\n this.setAttribute('aria-disabled', this.disabled ? 'true' : 'false');\n\n this.classList.add('rounded');\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.classList.remove('shadow-focus-visible');\n this.dispatchEvent(\n new Event('mid-blur', { composed: true, bubbles: true })\n );\n }\n\n private handleFocus() {\n if (this.disabled) {\n return;\n }\n\n this.focus();\n this.dispatchEvent(\n new Event('mid-focus', { composed: true, bubbles: true })\n );\n }\n\n private handleClick(event: MouseEvent) {\n if (this.disabled) {\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n\n this.checked = true;\n this.dispatchEvent(new Event('mid-change'));\n }\n\n @watch('disabled', { waitUntilFirstUpdate: true })\n handleDisabledChange() {\n this.setAttribute('aria-disabled', this.disabled ? 'true' : 'false');\n }\n\n @watch('checked', { waitUntilFirstUpdate: true })\n handleCheckChange() {\n this.input.checked = this.checked;\n }\n\n /**\n * Sets focus on the radio button.\n */\n focus(options?: FocusOptions) {\n this.input.focus(options);\n }\n\n override render() {\n return html`\n <ds-field class=\"ds-field\">\n <input\n type=\"radio\"\n part=\"radio\"\n name=\"${this.name}\"\n class=\"ds-input\"\n ?checked=${live(this.checked)}\n ?disabled=${this.disabled}\n @keydown=${this.handleKeydown}\n />\n <label\n part=\"label\"\n class=\"ds-label\"\n >\n <slot></slot>\n </label>\n </ds-field>\n `;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAcA,MAAM,SAAS;AAAA,EACb;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASF;AAaO,IAAM,aAAN,cAAyB,iBAAiB,OAAO,YAAY,MAAM,CAAC,EAAE;AAAA,EAuC3E,cAAc;AACZ,UAAA;AAhCF,SAAA,OAAO;AAMP,SAAA,UAAU;AAMV,SAAA,QAAQ;AAMR,SAAA,WAAW;AAGX,SAAA,UAAU;AAYR,SAAK,iBAAiB,QAAQ,KAAK,UAAU;AAC7C,SAAK,iBAAiB,SAAS,KAAK,WAAW;AAC/C,SAAK,iBAAiB,SAAS,KAAK,WAAW;AAAA,EACjD;AAAA,EAbA,wBAAiC;AAC/B,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,IAAI,mBAAmB;AACrB,WAAO,KAAK;AAAA,EACd;AAAA,EASA,oBAAoB;AAClB,UAAM,kBAAA;AACN,SAAK,aAAa,QAAQ,cAAc;AACxC,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KAAK,QAAQ;AAAA,mBACd,KAAK,aAAa;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUnC;AACF;AAzIE,gBAAA;AAAA,EADC,MAAM,qBAAqB;AAAA,GADjB,WAEX,WAAA,SAAA,CAAA;AAMA,gBAAA;AAAA,EADC,SAAA;AAAS,GAPC,WAQX,WAAA,QAAA,CAAA;AAMA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,SAAS,SAAS,MAAM;AAAA,GAb/B,WAcX,WAAA,WAAA,CAAA;AAMA,gBAAA;AAAA,EADC,SAAA;AAAS,GAnBC,WAoBX,WAAA,SAAA,CAAA;AAMA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,SAAS,SAAS,MAAM;AAAA,GAzB/B,WA0BX,WAAA,YAAA,CAAA;AAGA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,QAAA,CAAS;AAAA,GA5BhB,WA6BX,WAAA,WAAA,CAAA;AAyEA,gBAAA;AAAA,EADC,MAAM,YAAY,EAAE,sBAAsB,MAAM;AAAA,GArGtC,WAsGX,WAAA,wBAAA,CAAA;AAKA,gBAAA;AAAA,EADC,MAAM,WAAW,EAAE,sBAAsB,MAAM;AAAA,GA1GrC,WA2GX,WAAA,qBAAA,CAAA;AA3GW,aAAN,gBAAA;AAAA,EADN,cAAc,WAAW;AAAA,GACb,UAAA;"}
@@ -1,5 +1,4 @@
1
1
  import { LitElement } from 'lit';
2
- import { MinidTextfield } from './textfield.component.ts';
3
2
  declare global {
4
3
  interface HTMLElementTagNameMap {
5
4
  'mid-search': MinidSearch;
@@ -12,10 +11,14 @@ declare const MinidSearch_base: typeof LitElement;
12
11
  * @event mid-clear - Emitted when the input value is cleared
13
12
  * @event mid-focus - Emitted when input element is focused
14
13
  * @event mid-blur - Emitted when focus moves away from input element
14
+ *
15
+ * @csspart base - The search wrapper element
16
+ * @csspart input - The internal `<input>` element
17
+ * @csspart clear-button - The clear button
15
18
  */
16
19
  export declare class MinidSearch extends MinidSearch_base {
17
- textField: MinidTextfield;
18
- size: 'sm' | 'md' | 'lg';
20
+ constructor();
21
+ input: HTMLInputElement;
19
22
  label: string;
20
23
  placeholder: string;
21
24
  value: string;
@@ -24,8 +27,12 @@ export declare class MinidSearch extends MinidSearch_base {
24
27
  */
25
28
  debounce: number;
26
29
  private handleInput;
30
+ private handleChange;
31
+ private handleFocus;
32
+ private handleBlur;
33
+ private handleClear;
27
34
  focus(): void;
28
- render(): import('lit-html').TemplateResult<1>;
35
+ render(): import('lit').TemplateResult<1>;
29
36
  }
30
37
  export {};
31
38
  //# sourceMappingURL=search.component.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"search.component.d.ts","sourceRoot":"","sources":["../../src/components/search.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,UAAU,EAAE,MAAM,KAAK,CAAC;AAGvC,OAAO,uBAAuB,CAAC;AAC/B,OAAO,uBAAuB,CAAC;AAC/B,OAAO,uBAAuB,CAAC;AAE/B,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAG1D,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,YAAY,EAAE,WAAW,CAAC;KAC3B;CACF;;AAED;;;;;;GAMG;AACH,qBACa,WAAY,SAAQ,gBAAkB;IAEjD,SAAS,EAAG,cAAc,CAAC;IAG3B,IAAI,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAQ;IAGhC,KAAK,SAAM;IAGX,WAAW,SAAM;IAGjB,KAAK,SAAM;IAEX;;OAEG;IAEH,QAAQ,SAAK;IAEb,OAAO,CAAC,WAAW,CAKjB;IAEF,KAAK;IAII,MAAM;CAuBhB"}
1
+ {"version":3,"file":"search.component.d.ts","sourceRoot":"","sources":["../../src/components/search.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,UAAU,EAAW,MAAM,KAAK,CAAC;AAUrD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,YAAY,EAAE,WAAW,CAAC;KAC3B;CACF;;AAUD;;;;;;;;;;GAUG;AACH,qBACa,WAAY,SAAQ,gBAA0B;;IAOzD,KAAK,EAAG,gBAAgB,CAAC;IAGzB,KAAK,SAAM;IAGX,WAAW,SAAM;IAGjB,KAAK,SAAM;IAEX;;OAEG;IAEH,QAAQ,SAAK;IAEb,OAAO,CAAC,WAAW,CAKjB;IAEF,OAAO,CAAC,YAAY;IAOpB,OAAO,CAAC,WAAW;IAMnB,OAAO,CAAC,UAAU;IAMlB,OAAO,CAAC,WAAW;IAanB,KAAK;IAII,MAAM;CAoChB"}