@felleslosninger/minid-elements 0.0.97 → 0.0.99

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 (88) hide show
  1. package/dist/components/alert.component.d.ts.map +1 -1
  2. package/dist/components/alert.js +44 -25
  3. package/dist/components/alert.js.map +1 -1
  4. package/dist/components/button.component.d.ts +4 -5
  5. package/dist/components/button.component.d.ts.map +1 -1
  6. package/dist/components/button.js +58 -53
  7. package/dist/components/button.js.map +1 -1
  8. package/dist/components/combobox.component.d.ts +1 -13
  9. package/dist/components/combobox.component.d.ts.map +1 -1
  10. package/dist/components/combobox.js +6 -17
  11. package/dist/components/combobox.js.map +1 -1
  12. package/dist/components/{modal.component.d.ts → dialog.component.d.ts} +15 -16
  13. package/dist/components/dialog.component.d.ts.map +1 -0
  14. package/dist/components/{modal.js → dialog.js} +41 -77
  15. package/dist/components/dialog.js.map +1 -0
  16. package/dist/components/dropdown.component.d.ts +4 -5
  17. package/dist/components/dropdown.component.d.ts.map +1 -1
  18. package/dist/components/dropdown.js +37 -57
  19. package/dist/components/dropdown.js.map +1 -1
  20. package/dist/components/heading.component.d.ts.map +1 -1
  21. package/dist/components/heading.js +9 -10
  22. package/dist/components/heading.js.map +1 -1
  23. package/dist/components/helptext.component.d.ts +1 -25
  24. package/dist/components/helptext.component.d.ts.map +1 -1
  25. package/dist/components/helptext.js +20 -48
  26. package/dist/components/helptext.js.map +1 -1
  27. package/dist/components/icon/icon.component.d.ts +1 -4
  28. package/dist/components/icon/icon.component.d.ts.map +1 -1
  29. package/dist/components/icon/icon.js +3 -12
  30. package/dist/components/icon/icon.js.map +1 -1
  31. package/dist/components/link.component.d.ts +0 -4
  32. package/dist/components/link.component.d.ts.map +1 -1
  33. package/dist/components/link.js +3 -22
  34. package/dist/components/link.js.map +1 -1
  35. package/dist/components/menu-item.component.d.ts +0 -3
  36. package/dist/components/menu-item.component.d.ts.map +1 -1
  37. package/dist/components/menu-item.js +25 -57
  38. package/dist/components/menu-item.js.map +1 -1
  39. package/dist/components/menu.component.d.ts +2 -11
  40. package/dist/components/menu.component.d.ts.map +1 -1
  41. package/dist/components/menu.js +12 -48
  42. package/dist/components/menu.js.map +1 -1
  43. package/dist/components/paragraph.component.d.ts.map +1 -1
  44. package/dist/components/paragraph.js +5 -6
  45. package/dist/components/paragraph.js.map +1 -1
  46. package/dist/components/phone-input.component.d.ts +3 -4
  47. package/dist/components/phone-input.component.d.ts.map +1 -1
  48. package/dist/components/phone-input.js +23 -62
  49. package/dist/components/phone-input.js.map +1 -1
  50. package/dist/components/popup.component.d.ts +2 -1
  51. package/dist/components/popup.component.d.ts.map +1 -1
  52. package/dist/components/popup.js +4 -0
  53. package/dist/components/popup.js.map +1 -1
  54. package/dist/components/radio-button.component.d.ts +0 -3
  55. package/dist/components/radio-button.component.d.ts.map +1 -1
  56. package/dist/components/radio-button.js.map +1 -1
  57. package/dist/components/radio.component.d.ts +0 -3
  58. package/dist/components/radio.component.d.ts.map +1 -1
  59. package/dist/components/radio.js +2 -5
  60. package/dist/components/radio.js.map +1 -1
  61. package/dist/components/textfield.component.d.ts +6 -29
  62. package/dist/components/textfield.component.d.ts.map +1 -1
  63. package/dist/components/textfield.js +55 -131
  64. package/dist/components/textfield.js.map +1 -1
  65. package/dist/components/tooltip.component.d.ts +4 -37
  66. package/dist/components/tooltip.component.d.ts.map +1 -1
  67. package/dist/components/tooltip.js +18 -34
  68. package/dist/components/tooltip.js.map +1 -1
  69. package/dist/designsystemet-tailwind.css +293 -474
  70. package/dist/index.css +0 -1355
  71. package/dist/index.d.ts +1 -2
  72. package/dist/index.d.ts.map +1 -1
  73. package/dist/index.js +3 -5
  74. package/dist/index.js.map +1 -1
  75. package/dist/mixins/tailwind.mixin.d.ts.map +1 -1
  76. package/dist/mixins/tailwind.mixin.js +3 -4
  77. package/dist/mixins/tailwind.mixin.js.map +1 -1
  78. package/dist/types/animation-name.d.ts +1 -1
  79. package/dist/types/animation-name.d.ts.map +1 -1
  80. package/dist/utilities/country-labels-no.d.ts +4 -0
  81. package/dist/utilities/country-labels-no.d.ts.map +1 -0
  82. package/dist/utilities/{countries.js → country-labels-no.js} +3 -3
  83. package/dist/utilities/{countries.js.map → country-labels-no.js.map} +1 -1
  84. package/package.json +10 -4
  85. package/dist/components/modal.component.d.ts.map +0 -1
  86. package/dist/components/modal.js.map +0 -1
  87. package/dist/utilities/countries.d.ts +0 -3
  88. package/dist/utilities/countries.d.ts.map +0 -1
@@ -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 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 { FormControllerMixin } from '../mixins/form-controller.mixin';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'mid-phone-input': MinidPhoneInput;\n }\n}\n\nconst styles = [\n css`\n :host {\n display: flex;\n }\n\n .country-code,\n .phone-number {\n outline: none;\n box-shadow: none;\n background-color: transparent;\n }\n\n .phone-number {\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n }\n\n .country-code {\n border-right: 1px solid currentColor;\n }\n\n .country-button {\n border: 1px solid var(--fds-semantic-border-input-default);\n border-right: 0;\n border-top-left-radius: var(--fds-border_radius-medium);\n border-bottom-left-radius: var(--fds-border_radius-medium);\n }\n\n .fds-focus:focus-within,\n .fds-focus:focus-visible {\n outline: none;\n box-shadow: 0 0 0 3px #00347d;\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 form-control - 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 FormControllerMixin(\n styled(LitElement, styles)\n) {\n #formatter = new AsYouType();\n #skipCountryUpdate = false; // avoids unwanted update loop\n #currentEvent = new Event(''); // the event to be emitted after value is set\n #currentTemplate = '';\n\n /**\n * @ignore\n */\n @query('.phone-number')\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 @state()\n hasFocus = false;\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 }, 0);\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.setValue(event);\n }\n\n private handleKeydown(event: KeyboardEvent) {\n if (event.key === 'Backspace' && this.input.selectionStart === 1) {\n event.preventDefault();\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.setValue(event);\n }\n\n private setValue(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 this.value = value;\n this.nationalnumber = this.removePhonePrefix(value);\n this.dispatchEvent(this.#currentEvent);\n this.setFormValue(this.value);\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 return html`\n <div\n part=\"form-control\"\n class=\"${classMap({\n 'form-control': true,\n 'fds-paragraph': true,\n 'fds-textfield': true,\n 'flex-1': true,\n 'fds-paragraph--sm': sm,\n 'fds-paragraph--md': md,\n 'fds-paragraph--lg': lg,\n 'fds-textfield--sm': sm,\n 'fds-textfield--md': md,\n 'fds-textfield--lg': lg,\n })}\"\n >\n ${!this.label\n ? nothing\n : html`<label\n part=\"label\"\n for=\"input\"\n class=\"${classMap({\n 'sr-only': this.hidelabel,\n 'fds-label': true,\n 'fds-label--medium-weight': true,\n 'fds-textfield__label': true,\n 'fds-label--sm': sm,\n 'fds-label--md': md,\n 'fds-label--lg': lg,\n })}\"\n >\n ${this.label}\n </label>`}\n <div part=\"base\" class=\"flex\">\n <button\n part=\"country-button\"\n class=\"country-button fds-focus flex h-full items-center border pl-3\"\n iconstyled\n variant=\"tertiary\"\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=\"phone-number fds-textfield__field fds-textfield__input fds-focus\"\n part=\"phone-number\"\n type=\"tel\"\n autocomplete=\"tel\"\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":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAA,YAAA,oBAAA,eAAA;AA2BA,MAAM,SAAS;AAAA,EACb;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAkCF;AAgBO,IAAM,kBAAN,cAA8B;AAAA,EACnC,OAAO,YAAY,MAAM;AAC3B,EAAE;AAAA,EAFK,cAAA;AAAA,UAAA,GAAA,SAAA;AAGL,iBAAA,MAAA,YAAa,IAAI,UAAU,CAAA;AACN,iBAAA,MAAA,oBAAA,KAAA;AACL,iBAAA,MAAA,eAAA,IAAI,MAAM,EAAE,CAAA;AACT,iBAAA,MAAA,kBAAA,EAAA;AAaX,SAAA,QAAA;AAMS,SAAA,iBAAA;AAMH,SAAA,cAAA;AAON,SAAA,QAAA;AAMI,SAAA,YAAA;AASD,SAAA,WAAA;AAqGH,SAAA,sBAAsB,CAAC,UAAkB;AACzC,YAAA,UACJ,MAAM,SAAS,IACX,SACC,aAAK,MAAA,UAAA,EAAW,WAAW,KAAK,KAAK;AAExC,UAAA,YAAY,KAAK,SAAS;AAC5B,aAAK,UAAU;AACV,aAAA,cAAc,KAAK,UACpB,IAAI,sBAAsB,KAAK,OAAO,CAAC,KACvC;AACJ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MAAM,QAAS,CAAA;AAAA,GA3ChB,gBA4CX,WAAA,aAAA,CAAA;AAMA,gBAAA;AAAA,EADC,SAAS,EAAE,SAAS,KAAM,CAAA;AAAA,GAjDhB,gBAkDX,WAAA,WAAA,CAAA;AAGA,gBAAA;AAAA,EADC,MAAM;AAAA,GApDI,gBAqDX,WAAA,YAAA,CAAA;AAqJA,gBAAA;AAAA,EADC,MAAM,WAAW,EAAE,sBAAsB,KAAM,CAAA;AAAA,GAzMrC,gBA0MX,WAAA,uBAAA,CAAA;AA1MW,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 } 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 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 { FormControllerMixin } from '../mixins/form-controller.mixin';\nimport { HasSlotController } from '../internal/slot';\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 FormControllerMixin(\n styled(LitElement, styles)\n) {\n #formatter = new AsYouType();\n #skipCountryUpdate = false; // avoids unwanted update loop\n #currentEvent = new Event(''); // the event to be emitted after value is set\n #currentTemplate = '';\n 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 @state()\n hasFocus = false;\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 }, 0);\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.setValue(event);\n }\n\n private handleKeydown(event: KeyboardEvent) {\n if (event.key === 'Backspace' && this.input.selectionStart === 1) {\n event.preventDefault();\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.setValue(event);\n }\n\n private setValue(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 this.value = value;\n this.nationalnumber = this.removePhonePrefix(value);\n this.dispatchEvent(this.#currentEvent);\n this.setFormValue(this.value);\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 })} grow\"\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 <slot name=\"label\"> ${this.label} </slot>\n </label>\n <div part=\"base\" class=\"flex h-12\">\n <button\n part=\"country-button\"\n class=\"border-neutral focus-visible:focus-ring flex h-full items-center rounded-l border border-r-0 pl-3\"\n iconstyled\n variant=\"tertiary\"\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=\"border-neutral p focus-visible:focus-ring grow rounded-r border px-3\"\n part=\"phone-number\"\n type=\"tel\"\n autocomplete=\"tel\"\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":";;;;;;;;;;;;;;;;;;;;;;;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;AAzRE,aAAA,oBAAA,QAAA;AACA,qBAAA,oBAAA,QAAA;AACA,gBAAA,oBAAA,QAAA;AACA,mBAAA,oBAAA,QAAA;AAIA,gBAAA;AAAA,EADC,MAAM,QAAQ;AAAA,GATJ,gBAUX,WAAA,SAAA,CAAA;AAOA,gBAAA;AAAA,EADC,SAAS,EAAE,SAAS,KAAM,CAAA;AAAA,GAhBhB,gBAiBX,WAAA,SAAA,CAAA;AAMA,gBAAA;AAAA,EADC,SAAS,EAAE,SAAS,KAAM,CAAA;AAAA,GAtBhB,gBAuBX,WAAA,kBAAA,CAAA;AAMA,gBAAA;AAAA,EADC,SAAS,EAAE,SAAS,KAAM,CAAA;AAAA,GA5BhB,gBA6BX,WAAA,eAAA,CAAA;AAOA,gBAAA;AAAA,EADC,SAAS;AAAA,GAnCC,gBAoCX,WAAA,SAAA,CAAA;AAMA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,QAAS,CAAA;AAAA,GAzChB,gBA0CX,WAAA,aAAA,CAAA;AAMA,gBAAA;AAAA,EADC,SAAS,EAAE,SAAS,KAAM,CAAA;AAAA,GA/ChB,gBAgDX,WAAA,WAAA,CAAA;AAGA,gBAAA;AAAA,EADC,MAAM;AAAA,GAlDI,gBAmDX,WAAA,YAAA,CAAA;AAqJA,gBAAA;AAAA,EADC,MAAM,WAAW,EAAE,sBAAsB,KAAM,CAAA;AAAA,GAvMrC,gBAwMX,WAAA,uBAAA,CAAA;AAxMW,kBAAN,gBAAA;AAAA,EADN,cAAc,iBAAiB;AAAA,GACnB,eAAA;"}
@@ -30,7 +30,8 @@ declare const MinidPopup_base: typeof LitElement;
30
30
  *
31
31
  * @cssproperty [--arrow-size=6px] - The size of the arrow. Note that an arrow won't be shown unless the `arrow`
32
32
  * attribute is used.
33
- * @cssproperty [--arrow-color=var(--sl-color-neutral-0)] - The color of the arrow.
33
+ * @cssproperty [--arrow-color=white] - The color of the arrow.
34
+ * @cssproperty [--arrow-border-color=transparent] - The color for the arrow border
34
35
  * @cssproperty [--auto-size-available-width] - A read-only custom property that determines the amount of width the
35
36
  * popup can be before overflowing. Useful for positioning child elements that need to overflow. This property is only
36
37
  * available when using `auto-size`.
@@ -1 +1 @@
1
- {"version":3,"file":"popup.component.d.ts","sourceRoot":"","sources":["../../src/components/popup.component.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAa,UAAU,EAAE,MAAM,KAAK,CAAC;AAK5C,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,WAAW,EAAE,UAAU,CAAC;KACzB;CACF;AAED,MAAM,WAAW,cAAc;IAC7B,qBAAqB,EAAE,MAAM,OAAO,CAAC;IACrC,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;;AA8GD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,qBACa,UAAW,SAAQ,eAA0B;;IACxD,OAAO,CAAC,QAAQ,CAAyC;IACzD,OAAO,CAAC,OAAO,CAAC,CAAgC;IAEhD;;OAEG;IAEH,KAAK,EAAG,WAAW,CAAC;IAGpB,OAAO,CAAC,OAAO,CAAe;IAE9B;;;;OAIG;IAEH,MAAM,EAAE,OAAO,GAAG,MAAM,GAAG,cAAc,CAAM;IAE/C;;;OAGG;IAEH,MAAM,UAAS;IAEf;;;OAGG;IAEH,SAAS,EACL,KAAK,GACL,WAAW,GACX,SAAS,GACT,QAAQ,GACR,cAAc,GACd,YAAY,GACZ,OAAO,GACP,aAAa,GACb,WAAW,GACX,MAAM,GACN,YAAY,GACZ,UAAU,CAAS;IAEvB;;;OAGG;IAEH,QAAQ,EAAE,UAAU,GAAG,OAAO,CAAc;IAE5C;;OAEG;IAEH,QAAQ,SAAK;IAEb;;OAEG;IAEH,QAAQ,SAAK;IAEb;;;;OAIG;IAEH,KAAK,UAAS;IAEd;;;;OAIG;IAEH,cAAc,EAAE,OAAO,GAAG,KAAK,GAAG,QAAQ,GAAG,QAAQ,CAAY;IAEjE;;;OAGG;IAEH,YAAY,SAAM;IAElB;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AAC,EAAE,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;IAEnC;;;;OAIG;IAEH,gBAAgB,CAAC,EAAE,OAAO,GAAG,OAAO,EAAE,CAAC;IAEvC;;OAEG;IACyD,eAAe,SACvE;IAEJ;;;;;OAKG;IACqD,WAAW,UAAS;IAEtE,iBAAiB;IAQvB,oBAAoB;IAKd,OAAO,CAAC,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;YAwBlC,kBAAkB;IAgChC,OAAO,CAAC,KAAK;YAWC,IAAI;IAelB,6DAA6D;IAC7D,UAAU;IAiNV,OAAO,CAAC,iBAAiB,CAsFvB;IAaF,MAAM;CAoCP"}
@@ -28,6 +28,7 @@ const styles = [
28
28
  css`
29
29
  :host {
30
30
  --arrow-color: white;
31
+ --arrow-border-color: transparent;
31
32
  --arrow-size: 6px;
32
33
 
33
34
  /*
@@ -62,6 +63,9 @@ const styles = [
62
63
  position: absolute;
63
64
  width: calc(var(--arrow-size-diagonal) * 2);
64
65
  height: calc(var(--arrow-size-diagonal) * 2);
66
+ border: 1px solid var(--arrow-border-color);
67
+ border-left-color: transparent;
68
+ border-top-color: transparent;
65
69
  rotate: 45deg;
66
70
  background: var(--arrow-color);
67
71
  z-index: 901;
@@ -1 +1 @@
1
- {"version":3,"file":"popup.js","sources":["../../src/components/popup.component.ts"],"sourcesContent":["/*\n\nCopyright (c) 2020 A Beautiful Site, LLC\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n*/\n\nimport {\n arrow,\n autoUpdate,\n computePosition,\n flip,\n offset,\n platform,\n shift,\n size,\n} from '@floating-ui/dom';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { css, html, LitElement } from 'lit';\nimport { customElement, property, query } from 'lit/decorators.js';\nimport { styled } from '../mixins/tailwind.mixin';\nimport { offsetParent } from 'composed-offset-position';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'mid-popup': MinidPopup;\n }\n}\n\nexport interface VirtualElement {\n getBoundingClientRect: () => DOMRect;\n contextElement?: Element;\n}\n\nfunction isVirtualElement(e: unknown): e is VirtualElement {\n return (\n e !== null &&\n typeof e === 'object' &&\n 'getBoundingClientRect' in e &&\n ('contextElement' in e ? e instanceof Element : true)\n );\n}\n\nconst styles = [\n css`\n :host {\n --arrow-color: white;\n --arrow-size: 6px;\n\n /*\n These properties are computed to account for the arrow's dimensions after being rotated 45º. The constant\n 0.7071 is derived from sin(45), which is the diagonal size of the arrow's container after rotating.\n */\n --arrow-size-diagonal: calc(var(--arrow-size) * 0.7071);\n --arrow-padding-offset: calc(\n var(--arrow-size-diagonal) - var(--arrow-size)\n );\n\n display: contents;\n }\n\n .popup {\n position: absolute;\n isolation: isolate;\n max-width: var(--auto-size-available-width, none);\n max-height: var(--auto-size-available-height, none);\n z-index: 900;\n }\n\n .popup--fixed {\n position: fixed;\n }\n\n .popup:not(.popup--active) {\n display: none;\n }\n\n .popup__arrow {\n position: absolute;\n width: calc(var(--arrow-size-diagonal) * 2);\n height: calc(var(--arrow-size-diagonal) * 2);\n rotate: 45deg;\n background: var(--arrow-color);\n z-index: 901;\n }\n\n /* Hover bridge */\n .popup-hover-bridge:not(.popup-hover-bridge--visible) {\n display: none;\n }\n\n .popup-hover-bridge {\n position: fixed;\n z-index: calc(900 - 1);\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n clip-path: polygon(\n var(--hover-bridge-top-left-x, 0) var(--hover-bridge-top-left-y, 0),\n var(--hover-bridge-top-right-x, 0) var(--hover-bridge-top-right-y, 0),\n var(--hover-bridge-bottom-right-x, 0)\n var(--hover-bridge-bottom-right-y, 0),\n var(--hover-bridge-bottom-left-x, 0)\n var(--hover-bridge-bottom-left-y, 0)\n );\n }\n\n :host([data-current-placement^='top']) .popup {\n transform-origin: bottom;\n }\n\n :host([data-current-placement^='bottom']) .popup {\n transform-origin: top;\n }\n\n :host([data-current-placement^='left']) .popup {\n transform-origin: right;\n }\n\n :host([data-current-placement^='right']) .popup {\n transform-origin: left;\n }\n\n :host([data-current-placement^='top']) .popup__arrow {\n transform: rotate(0deg);\n }\n\n :host([data-current-placement^='bottom']) .popup__arrow {\n transform: rotate(180deg);\n }\n\n :host([data-current-placement^='left']) .popup__arrow {\n transform: rotate(-90deg);\n }\n\n :host([data-current-placement^='right']) .popup__arrow {\n transform: rotate(90deg);\n }\n `,\n];\n\n/**\n * @summary Popup is a utility that lets you declaratively anchor \"popup\" containers to another element.\n * @documentation https://shoelace.style/components/popup\n * @status stable\n * @since 2.0\n *\n * @event mid-reposition - Emitted when the popup is repositioned. This event can fire a lot, so avoid putting expensive\n * operations in your listener or consider debouncing it.\n *\n * @slot - The popup's content.\n * @slot anchor - The element the popup will be anchored to. If the anchor lives outside of the popup, you can use the\n * `anchor` attribute or property instead.\n *\n * @csspart arrow - The arrow's container. Avoid setting `top|bottom|left|right` properties, as these values are\n * assigned dynamically as the popup moves. This is most useful for applying a background color to match the popup, and\n * maybe a border or box shadow.\n * @csspart popup - The popup's container. Useful for setting a background color, box shadow, etc.\n * @csspart hover-bridge - The hover bridge element. Only available when the `hover-bridge` option is enabled.\n *\n * @cssproperty [--arrow-size=6px] - The size of the arrow. Note that an arrow won't be shown unless the `arrow`\n * attribute is used.\n * @cssproperty [--arrow-color=var(--sl-color-neutral-0)] - The color of the arrow.\n * @cssproperty [--auto-size-available-width] - A read-only custom property that determines the amount of width the\n * popup can be before overflowing. Useful for positioning child elements that need to overflow. This property is only\n * available when using `auto-size`.\n * @cssproperty [--auto-size-available-height] - A read-only custom property that determines the amount of height the\n * popup can be before overflowing. Useful for positioning child elements that need to overflow. This property is only\n * available when using `auto-size`.\n */\n\n@customElement('mid-popup')\nexport class MinidPopup extends styled(LitElement, styles) {\n private anchorEl: Element | VirtualElement | null = null;\n private cleanup?: ReturnType<typeof autoUpdate>;\n\n /**\n * A reference to the internal popup container. Useful for animating and styling the popup with JavaScript.\n */\n @query('.popup')\n popup!: HTMLElement;\n\n @query('.popup__arrow')\n private arrowEl!: HTMLElement;\n\n /**\n * The element the popup will be anchored to. If the anchor lives outside of the popup, you can provide the anchor\n * element `id`, a DOM element reference, or a `VirtualElement`. If the anchor lives inside the popup, use the\n * `anchor` slot instead.\n */\n @property()\n anchor: Element | string | VirtualElement = '';\n\n /**\n * Activates the positioning logic and shows the popup. When this attribute is removed, the positioning logic is torn\n * down and the popup will be hidden.\n */\n @property({ type: Boolean, reflect: true })\n active = false;\n\n /**\n * The preferred placement of the popup. Note that the actual placement will vary as configured to keep the\n * panel inside of the viewport.\n */\n @property({ reflect: true })\n placement:\n | 'top'\n | 'top-start'\n | 'top-end'\n | 'bottom'\n | 'bottom-start'\n | 'bottom-end'\n | 'right'\n | 'right-start'\n | 'right-end'\n | 'left'\n | 'left-start'\n | 'left-end' = 'top';\n\n /**\n * Determines how the popup is positioned. The `absolute` strategy works well in most cases, but if overflow is\n * clipped, using a `fixed` position strategy can often workaround it.\n */\n @property({ reflect: true })\n strategy: 'absolute' | 'fixed' = 'absolute';\n\n /**\n * The distance in pixels from which to offset the panel away from its anchor.\n */\n @property({ type: Number })\n distance = 0;\n\n /**\n * The distance in pixels from which to offset the panel along its anchor.\n */\n @property({ type: Number })\n skidding = 0;\n\n /**\n * Attaches an arrow to the popup. The arrow's size and color can be customized using the `--arrow-size` and\n * `--arrow-color` custom properties. For additional customizations, you can also target the arrow using\n * `::part(arrow)` in your stylesheet.\n */\n @property({ type: Boolean })\n arrow = false;\n\n /**\n * The placement of the arrow. The default is `anchor`, which will align the arrow as close to the center of the\n * anchor as possible, considering available space and `arrow-padding`. A value of `start`, `end`, or `center` will\n * align the arrow to the start, end, or center of the popover instead.\n */\n @property({ attribute: 'arrow-placement' })\n arrowPlacement: 'start' | 'end' | 'center' | 'anchor' = 'anchor';\n\n /**\n * The amount of padding between the arrow and the edges of the popup. If the popup has a border-radius, for example,\n * this will prevent it from overflowing the corners.\n */\n @property({ attribute: 'arrow-padding', type: Number })\n arrowPadding = 10;\n\n /**\n * When set, placement of the popup will flip to the opposite site to keep it in view. You can use\n * `flipFallbackPlacements` to further configure how the fallback placement is determined.\n */\n @property({ type: Boolean })\n flip = false;\n\n /**\n * If the preferred placement doesn't fit, popup will be tested in these fallback placements until one fits. Must be a\n * string of any number of placements separated by a space, e.g. \"top bottom left\". If no placement fits, the flip\n * fallback strategy will be used instead.\n */\n @property({\n attribute: 'flip-fallback-placements',\n converter: {\n fromAttribute: (value: string) => {\n return value\n .split(' ')\n .map((p) => p.trim())\n .filter((p) => p !== '');\n },\n toAttribute: (value: []) => {\n return value.join(' ');\n },\n },\n })\n flipFallbackPlacements = '';\n\n /**\n * When neither the preferred placement nor the fallback placements fit, this value will be used to determine whether\n * the popup should be positioned using the best available fit based on available space or as it was initially\n * preferred.\n */\n @property({ attribute: 'flip-fallback-strategy' })\n flipFallbackStrategy: 'best-fit' | 'initial' = 'best-fit';\n\n /**\n * The flip boundary describes clipping element(s) that overflow will be checked relative to when flipping. By\n * default, the boundary includes overflow ancestors that will cause the element to be clipped. If needed, you can\n * change the boundary by passing a reference to one or more elements to this property.\n */\n @property({ type: Object })\n flipBoundary?: Element | Element[];\n\n /**\n * The amount of padding, in pixels, to exceed before the flip behavior will occur.\n */\n @property({ attribute: 'flip-padding', type: Number })\n flipPadding = 0;\n\n /**\n * Moves the popup along the axis to keep it in view when clipped.\n */\n @property({ type: Boolean })\n shift = false;\n\n /**\n * The shift boundary describes clipping element(s) that overflow will be checked relative to when shifting. By\n * default, the boundary includes overflow ancestors that will cause the element to be clipped. If needed, you can\n * change the boundary by passing a reference to one or more elements to this property.\n */\n @property({ type: Object })\n shiftBoundary?: Element | Element[];\n\n /**\n * The amount of padding, in pixels, to exceed before the shift behavior will occur.\n */\n @property({ attribute: 'shift-padding', type: Number })\n shiftPadding = 0;\n\n /** When set, this will cause the popup to automatically resize itself to prevent it from overflowing. */\n @property({ attribute: 'auto-size' }) autoSize?:\n | 'horizontal'\n | 'vertical'\n | 'both';\n\n /**\n * Syncs the popup's width or height to that of the anchor element.\n */\n @property()\n sync?: 'width' | 'height' | 'both';\n\n /**\n * The auto-size boundary describes clipping element(s) that overflow will be checked relative to when resizing. By\n * default, the boundary includes overflow ancestors that will cause the element to be clipped. If needed, you can\n * change the boundary by passing a reference to one or more elements to this property.\n */\n @property({ type: Object })\n autoSizeBoundary?: Element | Element[];\n\n /**\n * The amount of padding, in pixels, to exceed before the auto-size behavior will occur.\n */\n @property({ attribute: 'auto-size-padding', type: Number }) autoSizePadding =\n 0;\n\n /**\n * When a gap exists between the anchor and the popup element, this option will add a \"hover bridge\" that fills the\n * gap using an invisible element. This makes listening for events such as `mouseenter` and `mouseleave` more sane\n * because the pointer never technically leaves the element. The hover bridge will only be drawn when the popover is\n * active.\n */\n @property({ attribute: 'hover-bridge', type: Boolean }) hoverBridge = false;\n\n async connectedCallback() {\n super.connectedCallback();\n\n // Start the positioner after the first update\n await this.updateComplete;\n this.start();\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n this.stop();\n }\n\n async updated(changedProps: Map<string, unknown>) {\n super.updated(changedProps);\n\n // Start or stop the positioner when active changes\n if (changedProps.has('active')) {\n if (this.active) {\n this.start();\n } else {\n this.stop();\n }\n }\n\n // Update the anchor when anchor changes\n if (changedProps.has('anchor')) {\n this.handleAnchorChange();\n }\n\n // All other properties will trigger a reposition when active\n if (this.active) {\n await this.updateComplete;\n this.reposition();\n }\n }\n\n private async handleAnchorChange() {\n await this.stop();\n\n if (this.anchor && typeof this.anchor === 'string') {\n // Locate the anchor by id\n const root = this.getRootNode() as Document | ShadowRoot;\n this.anchorEl = root.getElementById(this.anchor);\n } else if (\n this.anchor instanceof Element ||\n isVirtualElement(this.anchor)\n ) {\n // Use the anchor's reference\n this.anchorEl = this.anchor;\n } else {\n // Look for a slotted anchor\n this.anchorEl = this.querySelector<HTMLElement>('[slot=\"anchor\"]');\n }\n\n // If the anchor is a <slot>, we'll use the first assigned element as the target since slots use `display: contents`\n // and positioning can't be calculated on them\n if (this.anchorEl instanceof HTMLSlotElement) {\n this.anchorEl = this.anchorEl.assignedElements({\n flatten: true,\n })[0] as HTMLElement;\n }\n\n // If the anchor is valid, start it up\n if (this.anchorEl && this.active) {\n this.start();\n }\n }\n\n private start() {\n // We can't start the positioner without an anchor\n if (!this.anchorEl) {\n return;\n }\n\n this.cleanup = autoUpdate(this.anchorEl, this.popup, () => {\n this.reposition();\n });\n }\n\n private async stop(): Promise<void> {\n return new Promise((resolve) => {\n if (this.cleanup) {\n this.cleanup();\n this.cleanup = undefined;\n this.removeAttribute('data-current-placement');\n this.style.removeProperty('--auto-size-available-width');\n this.style.removeProperty('--auto-size-available-height');\n requestAnimationFrame(() => resolve());\n } else {\n resolve();\n }\n });\n }\n\n /** Forces the popup to recalculate and reposition itself. */\n reposition() {\n // Nothing to do if the popup is inactive or the anchor doesn't exist\n if (!this.active || !this.anchorEl) {\n return;\n }\n\n //\n // NOTE: Floating UI middlewares are order dependent: https://floating-ui.com/docs/middleware\n //\n const middleware = [\n // The offset middleware goes first\n offset({ mainAxis: this.distance, crossAxis: this.skidding }),\n ];\n\n // First we sync width/height\n if (this.sync) {\n middleware.push(\n size({\n apply: ({ rects }) => {\n const syncWidth = this.sync === 'width' || this.sync === 'both';\n const syncHeight = this.sync === 'height' || this.sync === 'both';\n this.popup.style.width = syncWidth\n ? `${rects.reference.width}px`\n : '';\n this.popup.style.height = syncHeight\n ? `${rects.reference.height}px`\n : '';\n },\n })\n );\n } else {\n // Cleanup styles if we're not matching width/height\n this.popup.style.width = '';\n this.popup.style.height = '';\n }\n\n // Then we flip\n if (this.flip) {\n middleware.push(\n flip({\n boundary: this.flipBoundary,\n // @ts-expect-error - We're converting a string attribute to an array here\n fallbackPlacements: this.flipFallbackPlacements,\n fallbackStrategy:\n this.flipFallbackStrategy === 'best-fit'\n ? 'bestFit'\n : 'initialPlacement',\n padding: this.flipPadding,\n })\n );\n }\n\n // Then we shift\n if (this.shift) {\n middleware.push(\n shift({\n boundary: this.shiftBoundary,\n padding: this.shiftPadding,\n })\n );\n }\n\n // Now we adjust the size as needed\n if (this.autoSize) {\n middleware.push(\n size({\n boundary: this.autoSizeBoundary,\n padding: this.autoSizePadding,\n apply: ({ availableWidth, availableHeight }) => {\n if (this.autoSize === 'vertical' || this.autoSize === 'both') {\n this.style.setProperty(\n '--auto-size-available-height',\n `${availableHeight}px`\n );\n } else {\n this.style.removeProperty('--auto-size-available-height');\n }\n\n if (this.autoSize === 'horizontal' || this.autoSize === 'both') {\n this.style.setProperty(\n '--auto-size-available-width',\n `${availableWidth}px`\n );\n } else {\n this.style.removeProperty('--auto-size-available-width');\n }\n },\n })\n );\n } else {\n // Cleanup styles if we're no longer using auto-size\n this.style.removeProperty('--auto-size-available-width');\n this.style.removeProperty('--auto-size-available-height');\n }\n\n // Finally, we add an arrow\n if (this.arrow) {\n middleware.push(\n arrow({\n element: this.arrowEl,\n padding: this.arrowPadding,\n })\n );\n }\n\n //\n // Use custom positioning logic if the strategy is absolute. Otherwise, fall back to the default logic.\n //\n // More info: https://github.com/shoelace-style/shoelace/issues/1135\n //\n const getOffsetParent =\n this.strategy === 'absolute'\n ? (element: Element) => platform.getOffsetParent(element, offsetParent)\n : platform.getOffsetParent;\n\n computePosition(this.anchorEl, this.popup, {\n placement: this.placement,\n middleware,\n strategy: this.strategy,\n platform: {\n ...platform,\n getOffsetParent,\n },\n }).then(({ x, y, middlewareData, placement }) => {\n //\n // Even though we have our own localization utility, it uses different heuristics to determine RTL. Because of\n // that, we'll use the same approach that Floating UI uses.\n //\n // Source: https://github.com/floating-ui/floating-ui/blob/cb3b6ab07f95275730d3e6e46c702f8d4908b55c/packages/dom/src/utils/getDocumentRect.ts#L31\n //\n const isRtl = this.matches(':dir(rtl)');\n const staticSide = {\n top: 'bottom',\n right: 'left',\n bottom: 'top',\n left: 'right',\n }[placement.split('-')[0]]!;\n\n this.setAttribute('data-current-placement', placement);\n\n Object.assign(this.popup.style, {\n left: `${x}px`,\n top: `${y}px`,\n });\n\n if (this.arrow) {\n const arrowX = middlewareData.arrow!.x;\n const arrowY = middlewareData.arrow!.y;\n let top = '';\n let right = '';\n let bottom = '';\n let left = '';\n\n if (this.arrowPlacement === 'start') {\n // Start\n const value =\n typeof arrowX === 'number'\n ? `calc(${this.arrowPadding}px - var(--arrow-padding-offset))`\n : '';\n top =\n typeof arrowY === 'number'\n ? `calc(${this.arrowPadding}px - var(--arrow-padding-offset))`\n : '';\n right = isRtl ? value : '';\n left = isRtl ? '' : value;\n } else if (this.arrowPlacement === 'end') {\n // End\n const value =\n typeof arrowX === 'number'\n ? `calc(${this.arrowPadding}px - var(--arrow-padding-offset))`\n : '';\n right = isRtl ? '' : value;\n left = isRtl ? value : '';\n bottom =\n typeof arrowY === 'number'\n ? `calc(${this.arrowPadding}px - var(--arrow-padding-offset))`\n : '';\n } else if (this.arrowPlacement === 'center') {\n // Center\n left =\n typeof arrowX === 'number'\n ? `calc(50% - var(--arrow-size-diagonal))`\n : '';\n top =\n typeof arrowY === 'number'\n ? `calc(50% - var(--arrow-size-diagonal))`\n : '';\n } else {\n // Anchor (default)\n left = typeof arrowX === 'number' ? `${arrowX}px` : '';\n top = typeof arrowY === 'number' ? `${arrowY}px` : '';\n }\n\n Object.assign(this.arrowEl.style, {\n top,\n right,\n bottom,\n left,\n [staticSide]: 'calc(var(--arrow-size-diagonal) * -1)',\n });\n }\n });\n\n // Wait until the new position is drawn before updating the hover bridge, otherwise it can get out of sync\n requestAnimationFrame(() => this.updateHoverBridge());\n\n this.dispatchEvent(new Event('mid-reposition'));\n }\n\n private updateHoverBridge = () => {\n if (this.hoverBridge && this.anchorEl) {\n const anchorRect = this.anchorEl.getBoundingClientRect();\n const popupRect = this.popup.getBoundingClientRect();\n const isVertical =\n this.placement.includes('top') || this.placement.includes('bottom');\n let topLeftX = 0;\n let topLeftY = 0;\n let topRightX = 0;\n let topRightY = 0;\n let bottomLeftX = 0;\n let bottomLeftY = 0;\n let bottomRightX = 0;\n let bottomRightY = 0;\n\n if (isVertical) {\n if (anchorRect.top < popupRect.top) {\n // Anchor is above\n topLeftX = anchorRect.left;\n topLeftY = anchorRect.bottom;\n topRightX = anchorRect.right;\n topRightY = anchorRect.bottom;\n\n bottomLeftX = popupRect.left;\n bottomLeftY = popupRect.top;\n bottomRightX = popupRect.right;\n bottomRightY = popupRect.top;\n } else {\n // Anchor is below\n topLeftX = popupRect.left;\n topLeftY = popupRect.bottom;\n topRightX = popupRect.right;\n topRightY = popupRect.bottom;\n\n bottomLeftX = anchorRect.left;\n bottomLeftY = anchorRect.top;\n bottomRightX = anchorRect.right;\n bottomRightY = anchorRect.top;\n }\n } else {\n if (anchorRect.left < popupRect.left) {\n // Anchor is on the left\n topLeftX = anchorRect.right;\n topLeftY = anchorRect.top;\n topRightX = popupRect.left;\n topRightY = popupRect.top;\n\n bottomLeftX = anchorRect.right;\n bottomLeftY = anchorRect.bottom;\n bottomRightX = popupRect.left;\n bottomRightY = popupRect.bottom;\n } else {\n // Anchor is on the right\n topLeftX = popupRect.right;\n topLeftY = popupRect.top;\n topRightX = anchorRect.left;\n topRightY = anchorRect.top;\n\n bottomLeftX = popupRect.right;\n bottomLeftY = popupRect.bottom;\n bottomRightX = anchorRect.left;\n bottomRightY = anchorRect.bottom;\n }\n }\n\n this.style.setProperty('--hover-bridge-top-left-x', `${topLeftX}px`);\n this.style.setProperty('--hover-bridge-top-left-y', `${topLeftY}px`);\n this.style.setProperty('--hover-bridge-top-right-x', `${topRightX}px`);\n this.style.setProperty('--hover-bridge-top-right-y', `${topRightY}px`);\n this.style.setProperty(\n '--hover-bridge-bottom-left-x',\n `${bottomLeftX}px`\n );\n this.style.setProperty(\n '--hover-bridge-bottom-left-y',\n `${bottomLeftY}px`\n );\n this.style.setProperty(\n '--hover-bridge-bottom-right-x',\n `${bottomRightX}px`\n );\n this.style.setProperty(\n '--hover-bridge-bottom-right-y',\n `${bottomRightY}px`\n );\n }\n };\n\n #handleAnchorClick() {\n // to make sure clicking another element's anchor closes current element's dropdown menu\n this.dispatchEvent(\n new CustomEvent('mid-anchor-click', {\n bubbles: true,\n composed: true,\n detail: { id: this.id },\n })\n );\n }\n\n render() {\n return html`\n <slot\n name=\"anchor\"\n @slotchange=${this.handleAnchorChange}\n @click=${this.#handleAnchorClick}\n ></slot>\n\n <span\n part=\"hover-bridge\"\n class=${classMap({\n 'popup-hover-bridge': true,\n 'popup-hover-bridge--visible': this.hoverBridge && this.active,\n })}\n ></span>\n\n <div\n part=\"popup\"\n class=${classMap({\n popup: true,\n 'popup--active': this.active,\n 'popup--fixed': this.strategy === 'fixed',\n 'popup--has-arrow': this.arrow,\n })}\n >\n <slot></slot>\n ${this.arrow\n ? html`<div\n part=\"arrow\"\n class=\"popup__arrow\"\n role=\"presentation\"\n ></div>`\n : ''}\n </div>\n `;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,IAAA,uBAAA;AAuCA,SAAS,iBAAiB,GAAiC;AAEvD,SAAA,MAAM,QACN,OAAO,MAAM,YACb,2BAA2B,MAC1B,oBAAoB,IAAI,aAAa,UAAU;AAEpD;AAEA,MAAM,SAAS;AAAA,EACb;AAAA;AAAA;AA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ts"],"sourcesContent":["/*\n\nCopyright (c) 2020 A Beautiful Site, LLC\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n*/\n\nimport {\n arrow,\n autoUpdate,\n computePosition,\n flip,\n offset,\n platform,\n shift,\n size,\n} from '@floating-ui/dom';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { css, html, LitElement } from 'lit';\nimport { customElement, property, query } from 'lit/decorators.js';\nimport { styled } from '../mixins/tailwind.mixin';\nimport { offsetParent } from 'composed-offset-position';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'mid-popup': MinidPopup;\n }\n}\n\nexport interface VirtualElement {\n getBoundingClientRect: () => DOMRect;\n contextElement?: Element;\n}\n\nfunction isVirtualElement(e: unknown): e is VirtualElement {\n return (\n e !== null &&\n typeof e === 'object' &&\n 'getBoundingClientRect' in e &&\n ('contextElement' in e ? e instanceof Element : true)\n );\n}\n\nconst styles = [\n css`\n :host {\n --arrow-color: white;\n --arrow-border-color: transparent;\n --arrow-size: 6px;\n\n /*\n These properties are computed to account for the arrow's dimensions after being rotated 45º. The constant\n 0.7071 is derived from sin(45), which is the diagonal size of the arrow's container after rotating.\n */\n --arrow-size-diagonal: calc(var(--arrow-size) * 0.7071);\n --arrow-padding-offset: calc(\n var(--arrow-size-diagonal) - var(--arrow-size)\n );\n\n display: contents;\n }\n\n .popup {\n position: absolute;\n isolation: isolate;\n max-width: var(--auto-size-available-width, none);\n max-height: var(--auto-size-available-height, none);\n z-index: 900;\n }\n\n .popup--fixed {\n position: fixed;\n }\n\n .popup:not(.popup--active) {\n display: none;\n }\n\n .popup__arrow {\n position: absolute;\n width: calc(var(--arrow-size-diagonal) * 2);\n height: calc(var(--arrow-size-diagonal) * 2);\n border: 1px solid var(--arrow-border-color);\n border-left-color: transparent;\n border-top-color: transparent;\n rotate: 45deg;\n background: var(--arrow-color);\n z-index: 901;\n }\n\n /* Hover bridge */\n .popup-hover-bridge:not(.popup-hover-bridge--visible) {\n display: none;\n }\n\n .popup-hover-bridge {\n position: fixed;\n z-index: calc(900 - 1);\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n clip-path: polygon(\n var(--hover-bridge-top-left-x, 0) var(--hover-bridge-top-left-y, 0),\n var(--hover-bridge-top-right-x, 0) var(--hover-bridge-top-right-y, 0),\n var(--hover-bridge-bottom-right-x, 0)\n var(--hover-bridge-bottom-right-y, 0),\n var(--hover-bridge-bottom-left-x, 0)\n var(--hover-bridge-bottom-left-y, 0)\n );\n }\n\n :host([data-current-placement^='top']) .popup {\n transform-origin: bottom;\n }\n\n :host([data-current-placement^='bottom']) .popup {\n transform-origin: top;\n }\n\n :host([data-current-placement^='left']) .popup {\n transform-origin: right;\n }\n\n :host([data-current-placement^='right']) .popup {\n transform-origin: left;\n }\n\n :host([data-current-placement^='top']) .popup__arrow {\n transform: rotate(0deg);\n }\n\n :host([data-current-placement^='bottom']) .popup__arrow {\n transform: rotate(180deg);\n }\n\n :host([data-current-placement^='left']) .popup__arrow {\n transform: rotate(-90deg);\n }\n\n :host([data-current-placement^='right']) .popup__arrow {\n transform: rotate(90deg);\n }\n `,\n];\n\n/**\n * @summary Popup is a utility that lets you declaratively anchor \"popup\" containers to another element.\n * @documentation https://shoelace.style/components/popup\n * @status stable\n * @since 2.0\n *\n * @event mid-reposition - Emitted when the popup is repositioned. This event can fire a lot, so avoid putting expensive\n * operations in your listener or consider debouncing it.\n *\n * @slot - The popup's content.\n * @slot anchor - The element the popup will be anchored to. If the anchor lives outside of the popup, you can use the\n * `anchor` attribute or property instead.\n *\n * @csspart arrow - The arrow's container. Avoid setting `top|bottom|left|right` properties, as these values are\n * assigned dynamically as the popup moves. This is most useful for applying a background color to match the popup, and\n * maybe a border or box shadow.\n * @csspart popup - The popup's container. Useful for setting a background color, box shadow, etc.\n * @csspart hover-bridge - The hover bridge element. Only available when the `hover-bridge` option is enabled.\n *\n * @cssproperty [--arrow-size=6px] - The size of the arrow. Note that an arrow won't be shown unless the `arrow`\n * attribute is used.\n * @cssproperty [--arrow-color=white] - The color of the arrow.\n * @cssproperty [--arrow-border-color=transparent] - The color for the arrow border\n * @cssproperty [--auto-size-available-width] - A read-only custom property that determines the amount of width the\n * popup can be before overflowing. Useful for positioning child elements that need to overflow. This property is only\n * available when using `auto-size`.\n * @cssproperty [--auto-size-available-height] - A read-only custom property that determines the amount of height the\n * popup can be before overflowing. Useful for positioning child elements that need to overflow. This property is only\n * available when using `auto-size`.\n */\n\n@customElement('mid-popup')\nexport class MinidPopup extends styled(LitElement, styles) {\n private anchorEl: Element | VirtualElement | null = null;\n private cleanup?: ReturnType<typeof autoUpdate>;\n\n /**\n * A reference to the internal popup container. Useful for animating and styling the popup with JavaScript.\n */\n @query('.popup')\n popup!: HTMLElement;\n\n @query('.popup__arrow')\n private arrowEl!: HTMLElement;\n\n /**\n * The element the popup will be anchored to. If the anchor lives outside of the popup, you can provide the anchor\n * element `id`, a DOM element reference, or a `VirtualElement`. If the anchor lives inside the popup, use the\n * `anchor` slot instead.\n */\n @property()\n anchor: Element | string | VirtualElement = '';\n\n /**\n * Activates the positioning logic and shows the popup. When this attribute is removed, the positioning logic is torn\n * down and the popup will be hidden.\n */\n @property({ type: Boolean, reflect: true })\n active = false;\n\n /**\n * The preferred placement of the popup. Note that the actual placement will vary as configured to keep the\n * panel inside of the viewport.\n */\n @property({ reflect: true })\n placement:\n | 'top'\n | 'top-start'\n | 'top-end'\n | 'bottom'\n | 'bottom-start'\n | 'bottom-end'\n | 'right'\n | 'right-start'\n | 'right-end'\n | 'left'\n | 'left-start'\n | 'left-end' = 'top';\n\n /**\n * Determines how the popup is positioned. The `absolute` strategy works well in most cases, but if overflow is\n * clipped, using a `fixed` position strategy can often workaround it.\n */\n @property({ reflect: true })\n strategy: 'absolute' | 'fixed' = 'absolute';\n\n /**\n * The distance in pixels from which to offset the panel away from its anchor.\n */\n @property({ type: Number })\n distance = 0;\n\n /**\n * The distance in pixels from which to offset the panel along its anchor.\n */\n @property({ type: Number })\n skidding = 0;\n\n /**\n * Attaches an arrow to the popup. The arrow's size and color can be customized using the `--arrow-size` and\n * `--arrow-color` custom properties. For additional customizations, you can also target the arrow using\n * `::part(arrow)` in your stylesheet.\n */\n @property({ type: Boolean })\n arrow = false;\n\n /**\n * The placement of the arrow. The default is `anchor`, which will align the arrow as close to the center of the\n * anchor as possible, considering available space and `arrow-padding`. A value of `start`, `end`, or `center` will\n * align the arrow to the start, end, or center of the popover instead.\n */\n @property({ attribute: 'arrow-placement' })\n arrowPlacement: 'start' | 'end' | 'center' | 'anchor' = 'anchor';\n\n /**\n * The amount of padding between the arrow and the edges of the popup. If the popup has a border-radius, for example,\n * this will prevent it from overflowing the corners.\n */\n @property({ attribute: 'arrow-padding', type: Number })\n arrowPadding = 10;\n\n /**\n * When set, placement of the popup will flip to the opposite site to keep it in view. You can use\n * `flipFallbackPlacements` to further configure how the fallback placement is determined.\n */\n @property({ type: Boolean })\n flip = false;\n\n /**\n * If the preferred placement doesn't fit, popup will be tested in these fallback placements until one fits. Must be a\n * string of any number of placements separated by a space, e.g. \"top bottom left\". If no placement fits, the flip\n * fallback strategy will be used instead.\n */\n @property({\n attribute: 'flip-fallback-placements',\n converter: {\n fromAttribute: (value: string) => {\n return value\n .split(' ')\n .map((p) => p.trim())\n .filter((p) => p !== '');\n },\n toAttribute: (value: []) => {\n return value.join(' ');\n },\n },\n })\n flipFallbackPlacements = '';\n\n /**\n * When neither the preferred placement nor the fallback placements fit, this value will be used to determine whether\n * the popup should be positioned using the best available fit based on available space or as it was initially\n * preferred.\n */\n @property({ attribute: 'flip-fallback-strategy' })\n flipFallbackStrategy: 'best-fit' | 'initial' = 'best-fit';\n\n /**\n * The flip boundary describes clipping element(s) that overflow will be checked relative to when flipping. By\n * default, the boundary includes overflow ancestors that will cause the element to be clipped. If needed, you can\n * change the boundary by passing a reference to one or more elements to this property.\n */\n @property({ type: Object })\n flipBoundary?: Element | Element[];\n\n /**\n * The amount of padding, in pixels, to exceed before the flip behavior will occur.\n */\n @property({ attribute: 'flip-padding', type: Number })\n flipPadding = 0;\n\n /**\n * Moves the popup along the axis to keep it in view when clipped.\n */\n @property({ type: Boolean })\n shift = false;\n\n /**\n * The shift boundary describes clipping element(s) that overflow will be checked relative to when shifting. By\n * default, the boundary includes overflow ancestors that will cause the element to be clipped. If needed, you can\n * change the boundary by passing a reference to one or more elements to this property.\n */\n @property({ type: Object })\n shiftBoundary?: Element | Element[];\n\n /**\n * The amount of padding, in pixels, to exceed before the shift behavior will occur.\n */\n @property({ attribute: 'shift-padding', type: Number })\n shiftPadding = 0;\n\n /** When set, this will cause the popup to automatically resize itself to prevent it from overflowing. */\n @property({ attribute: 'auto-size' }) autoSize?:\n | 'horizontal'\n | 'vertical'\n | 'both';\n\n /**\n * Syncs the popup's width or height to that of the anchor element.\n */\n @property()\n sync?: 'width' | 'height' | 'both';\n\n /**\n * The auto-size boundary describes clipping element(s) that overflow will be checked relative to when resizing. By\n * default, the boundary includes overflow ancestors that will cause the element to be clipped. If needed, you can\n * change the boundary by passing a reference to one or more elements to this property.\n */\n @property({ type: Object })\n autoSizeBoundary?: Element | Element[];\n\n /**\n * The amount of padding, in pixels, to exceed before the auto-size behavior will occur.\n */\n @property({ attribute: 'auto-size-padding', type: Number }) autoSizePadding =\n 0;\n\n /**\n * When a gap exists between the anchor and the popup element, this option will add a \"hover bridge\" that fills the\n * gap using an invisible element. This makes listening for events such as `mouseenter` and `mouseleave` more sane\n * because the pointer never technically leaves the element. The hover bridge will only be drawn when the popover is\n * active.\n */\n @property({ attribute: 'hover-bridge', type: Boolean }) hoverBridge = false;\n\n async connectedCallback() {\n super.connectedCallback();\n\n // Start the positioner after the first update\n await this.updateComplete;\n this.start();\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n this.stop();\n }\n\n async updated(changedProps: Map<string, unknown>) {\n super.updated(changedProps);\n\n // Start or stop the positioner when active changes\n if (changedProps.has('active')) {\n if (this.active) {\n this.start();\n } else {\n this.stop();\n }\n }\n\n // Update the anchor when anchor changes\n if (changedProps.has('anchor')) {\n this.handleAnchorChange();\n }\n\n // All other properties will trigger a reposition when active\n if (this.active) {\n await this.updateComplete;\n this.reposition();\n }\n }\n\n private async handleAnchorChange() {\n await this.stop();\n\n if (this.anchor && typeof this.anchor === 'string') {\n // Locate the anchor by id\n const root = this.getRootNode() as Document | ShadowRoot;\n this.anchorEl = root.getElementById(this.anchor);\n } else if (\n this.anchor instanceof Element ||\n isVirtualElement(this.anchor)\n ) {\n // Use the anchor's reference\n this.anchorEl = this.anchor;\n } else {\n // Look for a slotted anchor\n this.anchorEl = this.querySelector<HTMLElement>('[slot=\"anchor\"]');\n }\n\n // If the anchor is a <slot>, we'll use the first assigned element as the target since slots use `display: contents`\n // and positioning can't be calculated on them\n if (this.anchorEl instanceof HTMLSlotElement) {\n this.anchorEl = this.anchorEl.assignedElements({\n flatten: true,\n })[0] as HTMLElement;\n }\n\n // If the anchor is valid, start it up\n if (this.anchorEl && this.active) {\n this.start();\n }\n }\n\n private start() {\n // We can't start the positioner without an anchor\n if (!this.anchorEl) {\n return;\n }\n\n this.cleanup = autoUpdate(this.anchorEl, this.popup, () => {\n this.reposition();\n });\n }\n\n private async stop(): Promise<void> {\n return new Promise((resolve) => {\n if (this.cleanup) {\n this.cleanup();\n this.cleanup = undefined;\n this.removeAttribute('data-current-placement');\n this.style.removeProperty('--auto-size-available-width');\n this.style.removeProperty('--auto-size-available-height');\n requestAnimationFrame(() => resolve());\n } else {\n resolve();\n }\n });\n }\n\n /** Forces the popup to recalculate and reposition itself. */\n reposition() {\n // Nothing to do if the popup is inactive or the anchor doesn't exist\n if (!this.active || !this.anchorEl) {\n return;\n }\n\n //\n // NOTE: Floating UI middlewares are order dependent: https://floating-ui.com/docs/middleware\n //\n const middleware = [\n // The offset middleware goes first\n offset({ mainAxis: this.distance, crossAxis: this.skidding }),\n ];\n\n // First we sync width/height\n if (this.sync) {\n middleware.push(\n size({\n apply: ({ rects }) => {\n const syncWidth = this.sync === 'width' || this.sync === 'both';\n const syncHeight = this.sync === 'height' || this.sync === 'both';\n this.popup.style.width = syncWidth\n ? `${rects.reference.width}px`\n : '';\n this.popup.style.height = syncHeight\n ? `${rects.reference.height}px`\n : '';\n },\n })\n );\n } else {\n // Cleanup styles if we're not matching width/height\n this.popup.style.width = '';\n this.popup.style.height = '';\n }\n\n // Then we flip\n if (this.flip) {\n middleware.push(\n flip({\n boundary: this.flipBoundary,\n // @ts-expect-error - We're converting a string attribute to an array here\n fallbackPlacements: this.flipFallbackPlacements,\n fallbackStrategy:\n this.flipFallbackStrategy === 'best-fit'\n ? 'bestFit'\n : 'initialPlacement',\n padding: this.flipPadding,\n })\n );\n }\n\n // Then we shift\n if (this.shift) {\n middleware.push(\n shift({\n boundary: this.shiftBoundary,\n padding: this.shiftPadding,\n })\n );\n }\n\n // Now we adjust the size as needed\n if (this.autoSize) {\n middleware.push(\n size({\n boundary: this.autoSizeBoundary,\n padding: this.autoSizePadding,\n apply: ({ availableWidth, availableHeight }) => {\n if (this.autoSize === 'vertical' || this.autoSize === 'both') {\n this.style.setProperty(\n '--auto-size-available-height',\n `${availableHeight}px`\n );\n } else {\n this.style.removeProperty('--auto-size-available-height');\n }\n\n if (this.autoSize === 'horizontal' || this.autoSize === 'both') {\n this.style.setProperty(\n '--auto-size-available-width',\n `${availableWidth}px`\n );\n } else {\n this.style.removeProperty('--auto-size-available-width');\n }\n },\n })\n );\n } else {\n // Cleanup styles if we're no longer using auto-size\n this.style.removeProperty('--auto-size-available-width');\n this.style.removeProperty('--auto-size-available-height');\n }\n\n // Finally, we add an arrow\n if (this.arrow) {\n middleware.push(\n arrow({\n element: this.arrowEl,\n padding: this.arrowPadding,\n })\n );\n }\n\n //\n // Use custom positioning logic if the strategy is absolute. Otherwise, fall back to the default logic.\n //\n // More info: https://github.com/shoelace-style/shoelace/issues/1135\n //\n const getOffsetParent =\n this.strategy === 'absolute'\n ? (element: Element) => platform.getOffsetParent(element, offsetParent)\n : platform.getOffsetParent;\n\n computePosition(this.anchorEl, this.popup, {\n placement: this.placement,\n middleware,\n strategy: this.strategy,\n platform: {\n ...platform,\n getOffsetParent,\n },\n }).then(({ x, y, middlewareData, placement }) => {\n //\n // Even though we have our own localization utility, it uses different heuristics to determine RTL. Because of\n // that, we'll use the same approach that Floating UI uses.\n //\n // Source: https://github.com/floating-ui/floating-ui/blob/cb3b6ab07f95275730d3e6e46c702f8d4908b55c/packages/dom/src/utils/getDocumentRect.ts#L31\n //\n const isRtl = this.matches(':dir(rtl)');\n const staticSide = {\n top: 'bottom',\n right: 'left',\n bottom: 'top',\n left: 'right',\n }[placement.split('-')[0]]!;\n\n this.setAttribute('data-current-placement', placement);\n\n Object.assign(this.popup.style, {\n left: `${x}px`,\n top: `${y}px`,\n });\n\n if (this.arrow) {\n const arrowX = middlewareData.arrow!.x;\n const arrowY = middlewareData.arrow!.y;\n let top = '';\n let right = '';\n let bottom = '';\n let left = '';\n\n if (this.arrowPlacement === 'start') {\n // Start\n const value =\n typeof arrowX === 'number'\n ? `calc(${this.arrowPadding}px - var(--arrow-padding-offset))`\n : '';\n top =\n typeof arrowY === 'number'\n ? `calc(${this.arrowPadding}px - var(--arrow-padding-offset))`\n : '';\n right = isRtl ? value : '';\n left = isRtl ? '' : value;\n } else if (this.arrowPlacement === 'end') {\n // End\n const value =\n typeof arrowX === 'number'\n ? `calc(${this.arrowPadding}px - var(--arrow-padding-offset))`\n : '';\n right = isRtl ? '' : value;\n left = isRtl ? value : '';\n bottom =\n typeof arrowY === 'number'\n ? `calc(${this.arrowPadding}px - var(--arrow-padding-offset))`\n : '';\n } else if (this.arrowPlacement === 'center') {\n // Center\n left =\n typeof arrowX === 'number'\n ? `calc(50% - var(--arrow-size-diagonal))`\n : '';\n top =\n typeof arrowY === 'number'\n ? `calc(50% - var(--arrow-size-diagonal))`\n : '';\n } else {\n // Anchor (default)\n left = typeof arrowX === 'number' ? `${arrowX}px` : '';\n top = typeof arrowY === 'number' ? `${arrowY}px` : '';\n }\n\n Object.assign(this.arrowEl.style, {\n top,\n right,\n bottom,\n left,\n [staticSide]: 'calc(var(--arrow-size-diagonal) * -1)',\n });\n }\n });\n\n // Wait until the new position is drawn before updating the hover bridge, otherwise it can get out of sync\n requestAnimationFrame(() => this.updateHoverBridge());\n\n this.dispatchEvent(new Event('mid-reposition'));\n }\n\n private updateHoverBridge = () => {\n if (this.hoverBridge && this.anchorEl) {\n const anchorRect = this.anchorEl.getBoundingClientRect();\n const popupRect = this.popup.getBoundingClientRect();\n const isVertical =\n this.placement.includes('top') || this.placement.includes('bottom');\n let topLeftX = 0;\n let topLeftY = 0;\n let topRightX = 0;\n let topRightY = 0;\n let bottomLeftX = 0;\n let bottomLeftY = 0;\n let bottomRightX = 0;\n let bottomRightY = 0;\n\n if (isVertical) {\n if (anchorRect.top < popupRect.top) {\n // Anchor is above\n topLeftX = anchorRect.left;\n topLeftY = anchorRect.bottom;\n topRightX = anchorRect.right;\n topRightY = anchorRect.bottom;\n\n bottomLeftX = popupRect.left;\n bottomLeftY = popupRect.top;\n bottomRightX = popupRect.right;\n bottomRightY = popupRect.top;\n } else {\n // Anchor is below\n topLeftX = popupRect.left;\n topLeftY = popupRect.bottom;\n topRightX = popupRect.right;\n topRightY = popupRect.bottom;\n\n bottomLeftX = anchorRect.left;\n bottomLeftY = anchorRect.top;\n bottomRightX = anchorRect.right;\n bottomRightY = anchorRect.top;\n }\n } else {\n if (anchorRect.left < popupRect.left) {\n // Anchor is on the left\n topLeftX = anchorRect.right;\n topLeftY = anchorRect.top;\n topRightX = popupRect.left;\n topRightY = popupRect.top;\n\n bottomLeftX = anchorRect.right;\n bottomLeftY = anchorRect.bottom;\n bottomRightX = popupRect.left;\n bottomRightY = popupRect.bottom;\n } else {\n // Anchor is on the right\n topLeftX = popupRect.right;\n topLeftY = popupRect.top;\n topRightX = anchorRect.left;\n topRightY = anchorRect.top;\n\n bottomLeftX = popupRect.right;\n bottomLeftY = popupRect.bottom;\n bottomRightX = anchorRect.left;\n bottomRightY = anchorRect.bottom;\n }\n }\n\n this.style.setProperty('--hover-bridge-top-left-x', `${topLeftX}px`);\n this.style.setProperty('--hover-bridge-top-left-y', `${topLeftY}px`);\n this.style.setProperty('--hover-bridge-top-right-x', `${topRightX}px`);\n this.style.setProperty('--hover-bridge-top-right-y', `${topRightY}px`);\n this.style.setProperty(\n '--hover-bridge-bottom-left-x',\n `${bottomLeftX}px`\n );\n this.style.setProperty(\n '--hover-bridge-bottom-left-y',\n `${bottomLeftY}px`\n );\n this.style.setProperty(\n '--hover-bridge-bottom-right-x',\n `${bottomRightX}px`\n );\n this.style.setProperty(\n '--hover-bridge-bottom-right-y',\n `${bottomRightY}px`\n );\n }\n };\n\n #handleAnchorClick() {\n // to make sure clicking another element's anchor closes current element's dropdown menu\n this.dispatchEvent(\n new CustomEvent('mid-anchor-click', {\n bubbles: true,\n composed: true,\n detail: { id: this.id },\n })\n );\n }\n\n render() {\n return html`\n <slot\n name=\"anchor\"\n @slotchange=${this.handleAnchorChange}\n @click=${this.#handleAnchorClick}\n ></slot>\n\n <span\n part=\"hover-bridge\"\n class=${classMap({\n 'popup-hover-bridge': true,\n 'popup-hover-bridge--visible': this.hoverBridge && this.active,\n })}\n ></span>\n\n <div\n part=\"popup\"\n class=${classMap({\n popup: true,\n 'popup--active': this.active,\n 'popup--fixed': this.strategy === 'fixed',\n 'popup--has-arrow': this.arrow,\n })}\n >\n <slot></slot>\n ${this.arrow\n ? html`<div\n part=\"arrow\"\n class=\"popup__arrow\"\n role=\"presentation\"\n ></div>`\n : ''}\n </div>\n `;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,IAAA,uBAAA;AAuCA,SAAS,iBAAiB,GAAiC;AAEvD,SAAA,MAAM,QACN,OAAO,MAAM,YACb,2BAA2B,MAC1B,oBAAoB,IAAI,aAAa,UAAU;AAEpD;AAEA,MAAM,SAAS;AAAA,EACb;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAoGF;AAkCO,IAAM,aAAN,cAAyB,OAAO,YAAY,MAAM,EAAE;AAAA,EAApD,cAAA;AAAA,UAAA,GAAA,SAAA;AAAA,iBAAA,MAAA,qBAAA;AACL,SAAQ,WAA4C;AAkBR,SAAA,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,WAAA,YAAA,CAAA;AAStC,gBAAA;AAAA,EADC,SAAS;AAAA,GAxKC,WAyKX,WAAA,QAAA,CAAA;AAQA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,OAAQ,CAAA;AAAA,GAhLf,WAiLX,WAAA,oBAAA,CAAA;AAK4D,gBAAA;AAAA,EAA3D,SAAS,EAAE,WAAW,qBAAqB,MAAM,OAAQ,CAAA;AAAA,GAtL/C,WAsLiD,WAAA,mBAAA,CAAA;AASJ,gBAAA;AAAA,EAAvD,SAAS,EAAE,WAAW,gBAAgB,MAAM,QAAS,CAAA;AAAA,GA/L3C,WA+L6C,WAAA,eAAA,CAAA;AA/L7C,aAAN,gBAAA;AAAA,EADN,cAAc,WAAW;AAAA,GACb,UAAA;"}
@@ -15,9 +15,6 @@ declare const MinidRadioButton_base: typeof LitElement;
15
15
  * @csspart button - Select the internal button element
16
16
  */
17
17
  export declare class MinidRadioButton extends MinidRadioButton_base {
18
- /**
19
- * @ignore
20
- */
21
18
  element: HTMLButtonElement;
22
19
  name: string;
23
20
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"radio-button.component.d.ts","sourceRoot":"","sources":["../../src/components/radio-button.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,UAAU,EAAE,MAAM,KAAK,CAAC;AAOvC,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,kBAAkB,EAAE,gBAAgB,CAAC;KACtC;CACF;;AAED;;;;;;;;GAQG;AACH,qBACa,gBAAiB,SAAQ,qBAAkB;IACtD;;OAEG;IAEH,OAAO,EAAG,iBAAiB,CAAC;IAG5B,IAAI,SAAY;IAEhB;;OAEG;IAEH,OAAO,UAAS;IAEhB;;OAEG;IAEH,KAAK,EAAE,MAAM,GAAG,IAAI,CAAQ;IAE5B;;OAEG;IAEH,QAAQ,UAAS;IAEjB;;;OAGG;IAEH,IAAI,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAQ;IAEhC,OAAO,CAAC,UAAU;IAMlB,OAAO,CAAC,WAAW;IAMnB,OAAO,CAAC,WAAW;IAWnB,oBAAoB;IAIpB;;OAEG;IACH,KAAK,CAAC,OAAO,CAAC,EAAE,YAAY;IAI5B;;OAEG;IACH,IAAI;IAIK,MAAM;CA8BhB"}
1
+ {"version":3,"file":"radio-button.component.d.ts","sourceRoot":"","sources":["../../src/components/radio-button.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,UAAU,EAAE,MAAM,KAAK,CAAC;AAOvC,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,kBAAkB,EAAE,gBAAgB,CAAC;KACtC;CACF;;AAED;;;;;;;;GAQG;AACH,qBACa,gBAAiB,SAAQ,qBAAkB;IAEtD,OAAO,EAAG,iBAAiB,CAAC;IAG5B,IAAI,SAAY;IAEhB;;OAEG;IAEH,OAAO,UAAS;IAEhB;;OAEG;IAEH,KAAK,EAAE,MAAM,GAAG,IAAI,CAAQ;IAE5B;;OAEG;IAEH,QAAQ,UAAS;IAEjB;;;OAGG;IAEH,IAAI,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAQ;IAEhC,OAAO,CAAC,UAAU;IAMlB,OAAO,CAAC,WAAW;IAMnB,OAAO,CAAC,WAAW;IAWnB,oBAAoB;IAIpB;;OAEG;IACH,KAAK,CAAC,OAAO,CAAC,EAAE,YAAY;IAI5B;;OAEG;IACH,IAAI;IAIK,MAAM;CA8BhB"}
@@ -1 +1 @@
1
- {"version":3,"file":"radio-button.js","sources":["../../src/components/radio-button.component.ts"],"sourcesContent":["import { html, LitElement } from 'lit';\nimport { customElement, property, query } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { watch } from '../internal/watch';\nimport { styled } from '../mixins/tailwind.mixin';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'mid-radio-button': MinidRadioButton;\n }\n}\n\n/**\n *\n * @slot -- The radio button's label.\n *\n * @event mid-blur - Emitted when the button loses focus.\n * @event mid-focus - Emitted when the button gains focus.\n *\n * @csspart button - Select the internal button element\n */\n@customElement('mid-radio-button')\nexport class MinidRadioButton extends styled(LitElement) {\n /**\n * @ignore\n */\n @query('.radio')\n element!: HTMLButtonElement;\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: string | null = null;\n\n /**\n * Disables the radio button.\n */\n @property({ type: Boolean, reflect: true })\n disabled = false;\n\n /**\n * The radio button's size. When used inside a radio group, the size will be determined by the radio group's size so\n * this attribute can typically be omitted.\n */\n @property({ reflect: true })\n size: 'sm' | 'md' | 'lg' = 'md';\n\n private handleBlur() {\n this.dispatchEvent(\n new Event('mid-blur', { composed: true, bubbles: true })\n );\n }\n\n private handleFocus() {\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 }\n\n @watch('disabled', { waitUntilFirstUpdate: true })\n handleDisabledChange() {\n this.setAttribute('aria-disabled', this.disabled ? 'true' : 'false');\n }\n\n /**\n * Sets focus on the radio button.\n */\n focus(options?: FocusOptions) {\n this.element.focus(options);\n }\n\n /**\n * Removes focus from the radio button.\n */\n blur() {\n this.element.blur();\n }\n\n override render() {\n return html`<button\n role=\"radio\"\n type=\"button\"\n part=\"button\"\n name=${this.name}\n value=${ifDefined(this.value ?? undefined)}\n class=\"${classMap({\n radio: true,\n 'whitespace-nowrap': true,\n 'fds-togglegroup__item': true,\n 'fds-btn': true,\n 'fds-focus': true,\n 'fds-btn--first': true,\n 'fds-btn--full-width': true,\n 'fds-btn--primary': this.checked,\n 'fds-btn--tertiary': !this.checked,\n 'fds-btn--sm': this.size === 'sm',\n 'fds-btn--md': this.size === 'md',\n 'fds-btn--lg': this.size === 'lg',\n })}\"\n aria-checked=${this.checked}\n ?disabled=${this.disabled}\n @blur=${this.handleBlur}\n @focus=${this.handleFocus}\n @click=${this.handleClick}\n >\n <slot></slot>\n </button> `;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAuBO,IAAM,mBAAN,cAA+B,OAAO,UAAU,EAAE;AAAA,EAAlD,cAAA;AAAA,UAAA,GAAA,SAAA;AAQE,SAAA,OAAA;AAMG,SAAA,UAAA;AAMa,SAAA,QAAA;AAMZ,SAAA,WAAA;AAOgB,SAAA,OAAA;AAAA,EAAA;AAAA,EAEnB,aAAa;AACd,SAAA;AAAA,MACH,IAAI,MAAM,YAAY,EAAE,UAAU,MAAM,SAAS,KAAM,CAAA;AAAA,IACzD;AAAA,EAAA;AAAA,EAGM,cAAc;AACf,SAAA;AAAA,MACH,IAAI,MAAM,aAAa,EAAE,UAAU,MAAM,SAAS,KAAM,CAAA;AAAA,IAC1D;AAAA,EAAA;AAAA,EAGM,YAAY,OAAmB;AACrC,QAAI,KAAK,UAAU;AACjB,YAAM,eAAe;AACrB,YAAM,gBAAgB;AACtB;AAAA,IAAA;AAGF,SAAK,UAAU;AAAA,EAAA;AAAA,EAIjB,uBAAuB;AACrB,SAAK,aAAa,iBAAiB,KAAK,WAAW,SAAS,OAAO;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA,EAMrE,MAAM,SAAwB;AACvB,SAAA,QAAQ,MAAM,OAAO;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA,EAM5B,OAAO;AACL,SAAK,QAAQ,KAAK;AAAA,EAAA;AAAA,EAGX,SAAS;AACT,WAAA;AAAA;AAAA;AAAA;AAAA,aAIE,KAAK,IAAI;AAAA,cACR,UAAU,KAAK,SAAS,MAAS,CAAC;AAAA,eACjC,SAAS;AAAA,MAChB,OAAO;AAAA,MACP,qBAAqB;AAAA,MACrB,yBAAyB;AAAA,MACzB,WAAW;AAAA,MACX,aAAa;AAAA,MACb,kBAAkB;AAAA,MAClB,uBAAuB;AAAA,MACvB,oBAAoB,KAAK;AAAA,MACzB,qBAAqB,CAAC,KAAK;AAAA,MAC3B,eAAe,KAAK,SAAS;AAAA,MAC7B,eAAe,KAAK,SAAS;AAAA,MAC7B,eAAe,KAAK,SAAS;AAAA,IAAA,CAC9B,CAAC;AAAA,qBACa,KAAK,OAAO;AAAA,kBACf,KAAK,QAAQ;AAAA,cACjB,KAAK,UAAU;AAAA,eACd,KAAK,WAAW;AAAA,eAChB,KAAK,WAAW;AAAA;AAAA;AAAA;AAAA,EAAA;AAK/B;AArGE,gBAAA;AAAA,EADC,MAAM,QAAQ;AAAA,GAJJ,iBAKX,WAAA,WAAA,CAAA;AAGA,gBAAA;AAAA,EADC,SAAS;AAAA,GAPC,iBAQX,WAAA,QAAA,CAAA;AAMA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,SAAS,SAAS,KAAM,CAAA;AAAA,GAb/B,iBAcX,WAAA,WAAA,CAAA;AAMA,gBAAA;AAAA,EADC,SAAS;AAAA,GAnBC,iBAoBX,WAAA,SAAA,CAAA;AAMA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,SAAS,SAAS,KAAM,CAAA;AAAA,GAzB/B,iBA0BX,WAAA,YAAA,CAAA;AAOA,gBAAA;AAAA,EADC,SAAS,EAAE,SAAS,KAAM,CAAA;AAAA,GAhChB,iBAiCX,WAAA,QAAA,CAAA;AAyBA,gBAAA;AAAA,EADC,MAAM,YAAY,EAAE,sBAAsB,KAAM,CAAA;AAAA,GAzDtC,iBA0DX,WAAA,wBAAA,CAAA;AA1DW,mBAAN,gBAAA;AAAA,EADN,cAAc,kBAAkB;AAAA,GACpB,gBAAA;"}
1
+ {"version":3,"file":"radio-button.js","sources":["../../src/components/radio-button.component.ts"],"sourcesContent":["import { html, LitElement } from 'lit';\nimport { customElement, property, query } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { watch } from '../internal/watch';\nimport { styled } from '../mixins/tailwind.mixin';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'mid-radio-button': MinidRadioButton;\n }\n}\n\n/**\n *\n * @slot -- The radio button's label.\n *\n * @event mid-blur - Emitted when the button loses focus.\n * @event mid-focus - Emitted when the button gains focus.\n *\n * @csspart button - Select the internal button element\n */\n@customElement('mid-radio-button')\nexport class MinidRadioButton extends styled(LitElement) {\n @query('.radio')\n element!: HTMLButtonElement;\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: string | null = null;\n\n /**\n * Disables the radio button.\n */\n @property({ type: Boolean, reflect: true })\n disabled = false;\n\n /**\n * The radio button's size. When used inside a radio group, the size will be determined by the radio group's size so\n * this attribute can typically be omitted.\n */\n @property({ reflect: true })\n size: 'sm' | 'md' | 'lg' = 'md';\n\n private handleBlur() {\n this.dispatchEvent(\n new Event('mid-blur', { composed: true, bubbles: true })\n );\n }\n\n private handleFocus() {\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 }\n\n @watch('disabled', { waitUntilFirstUpdate: true })\n handleDisabledChange() {\n this.setAttribute('aria-disabled', this.disabled ? 'true' : 'false');\n }\n\n /**\n * Sets focus on the radio button.\n */\n focus(options?: FocusOptions) {\n this.element.focus(options);\n }\n\n /**\n * Removes focus from the radio button.\n */\n blur() {\n this.element.blur();\n }\n\n override render() {\n return html`<button\n role=\"radio\"\n type=\"button\"\n part=\"button\"\n name=${this.name}\n value=${ifDefined(this.value ?? undefined)}\n class=\"${classMap({\n radio: true,\n 'whitespace-nowrap': true,\n 'fds-togglegroup__item': true,\n 'fds-btn': true,\n 'fds-focus': true,\n 'fds-btn--first': true,\n 'fds-btn--full-width': true,\n 'fds-btn--primary': this.checked,\n 'fds-btn--tertiary': !this.checked,\n 'fds-btn--sm': this.size === 'sm',\n 'fds-btn--md': this.size === 'md',\n 'fds-btn--lg': this.size === 'lg',\n })}\"\n aria-checked=${this.checked}\n ?disabled=${this.disabled}\n @blur=${this.handleBlur}\n @focus=${this.handleFocus}\n @click=${this.handleClick}\n >\n <slot></slot>\n </button> `;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAuBO,IAAM,mBAAN,cAA+B,OAAO,UAAU,EAAE;AAAA,EAAlD,cAAA;AAAA,UAAA,GAAA,SAAA;AAKE,SAAA,OAAA;AAMG,SAAA,UAAA;AAMa,SAAA,QAAA;AAMZ,SAAA,WAAA;AAOgB,SAAA,OAAA;AAAA,EAAA;AAAA,EAEnB,aAAa;AACd,SAAA;AAAA,MACH,IAAI,MAAM,YAAY,EAAE,UAAU,MAAM,SAAS,KAAM,CAAA;AAAA,IACzD;AAAA,EAAA;AAAA,EAGM,cAAc;AACf,SAAA;AAAA,MACH,IAAI,MAAM,aAAa,EAAE,UAAU,MAAM,SAAS,KAAM,CAAA;AAAA,IAC1D;AAAA,EAAA;AAAA,EAGM,YAAY,OAAmB;AACrC,QAAI,KAAK,UAAU;AACjB,YAAM,eAAe;AACrB,YAAM,gBAAgB;AACtB;AAAA,IAAA;AAGF,SAAK,UAAU;AAAA,EAAA;AAAA,EAIjB,uBAAuB;AACrB,SAAK,aAAa,iBAAiB,KAAK,WAAW,SAAS,OAAO;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA,EAMrE,MAAM,SAAwB;AACvB,SAAA,QAAQ,MAAM,OAAO;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA,EAM5B,OAAO;AACL,SAAK,QAAQ,KAAK;AAAA,EAAA;AAAA,EAGX,SAAS;AACT,WAAA;AAAA;AAAA;AAAA;AAAA,aAIE,KAAK,IAAI;AAAA,cACR,UAAU,KAAK,SAAS,MAAS,CAAC;AAAA,eACjC,SAAS;AAAA,MACh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  export declare class MinidRadio extends MinidRadio_base {
19
- /**
20
- * @ignore
21
- */
22
19
  element: HTMLInputElement;
23
20
  name: string;
24
21
  /**
@@ -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,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,WAAW,EAAE,UAAU,CAAC;KACzB;CACF;;AA+DD;;;;;;;;;GASG;AACH,qBACa,UAAW,SAAQ,eAA0B;IACxD;;OAEG;IAEH,OAAO,EAAG,gBAAgB,CAAC;IAG3B,IAAI,SAAY;IAEhB;;OAEG;IAEH,OAAO,UAAS;IAEhB;;OAEG;IAEH,KAAK,SAAM;IAEX;;OAEG;IAEH,QAAQ,UAAS;IAEjB;;;OAGG;IAEH,IAAI,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAQ;;IAShC,iBAAiB;IAQjB,OAAO,CAAC,UAAU;IAOlB,OAAO,CAAC,WAAW;IAWnB,OAAO,CAAC,WAAW;IAWnB,oBAAoB;IAKpB,iBAAiB;IAIjB;;OAEG;IACH,KAAK,CAAC,OAAO,CAAC,EAAE,YAAY;IAKnB,MAAM;CAgChB"}
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,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,WAAW,EAAE,UAAU,CAAC;KACzB;CACF;;AA4DD;;;;;;;;;GASG;AACH,qBACa,UAAW,SAAQ,eAA0B;IAExD,OAAO,EAAG,gBAAgB,CAAC;IAG3B,IAAI,SAAY;IAEhB;;OAEG;IAEH,OAAO,UAAS;IAEhB;;OAEG;IAEH,KAAK,SAAM;IAEX;;OAEG;IAEH,QAAQ,UAAS;IAEjB;;;OAGG;IAEH,IAAI,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAQ;;IAShC,iBAAiB;IAQjB,OAAO,CAAC,UAAU;IAOlB,OAAO,CAAC,WAAW;IAWnB,OAAO,CAAC,WAAW;IAWnB,oBAAoB;IAKpB,iBAAiB;IAIjB;;OAEG;IACH,KAAK,CAAC,OAAO,CAAC,EAAE,YAAY;IAKnB,MAAM;CAgChB"}
@@ -65,11 +65,8 @@ const styles = [
65
65
 
66
66
  .radio:checked {
67
67
  border-color: var(--color-checked);
68
- background: radial-gradient(
69
- circle closest-side,
70
- currentcolor 45%,
71
- transparent 50%
72
- ),
68
+ background:
69
+ radial-gradient(circle closest-side, currentcolor 45%, transparent 50%),
73
70
  var(--color-checked);
74
71
  }
75
72
  `
@@ -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 { classMap } from 'lit/directives/class-map.js';\nimport { live } from 'lit/directives/live.js';\nimport { watch } from '../internal/watch';\nimport { styled } from '../mixins/tailwind.mixin';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'mid-radio': MinidRadio;\n }\n}\n\nconst styles = [\n css`\n :host {\n --color-checked: #0062ba;\n --color-border: #7a818c;\n\n color: white;\n padding: 0.25rem 0;\n display: grid;\n grid-template-columns: auto 1fr;\n gap: 0.5rem;\n cursor: pointer;\n font-weight: 400;\n }\n\n :host > * {\n cursor: pointer;\n }\n\n :host:has(input:focus-visible) {\n --fds-focus-border-width: 3px;\n box-shadow: 0 0 0 var(--fds-focus-border-width)\n var(--fds-semantic-border-focus-boxshadow);\n }\n\n :host:has(input:disabled),\n :host:has(input:disabled) > * {\n cursor: not-allowed;\n }\n\n :host:has(input:disabled) > * {\n opacity: 0.3;\n }\n\n .label {\n font-weight: 400;\n }\n\n .radio {\n -webkit-appearance: none;\n appearance: none;\n\n border-radius: 999px;\n display: grid;\n place-content: center;\n border: 2px solid var(--color-border);\n transform: translateY(-0.075em);\n }\n\n .radio:checked {\n border-color: var(--color-checked);\n background: radial-gradient(\n circle closest-side,\n currentcolor 45%,\n transparent 50%\n ),\n var(--color-checked);\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 styled(LitElement, styles) {\n /**\n * @ignore\n */\n @query('.radio')\n element!: HTMLInputElement;\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 /**\n * The radio button's size. When used inside a radio group, the size will be determined by the radio group's size so\n * this attribute can typically be omitted.\n */\n @property({ reflect: true })\n size: 'sm' | 'md' | 'lg' = 'md';\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 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 }\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.element.checked = this.checked;\n }\n\n /**\n * Sets focus on the radio button.\n */\n focus(options?: FocusOptions) {\n // this.classList.add('shadow-focus-visible');\n this.element.focus(options);\n }\n\n override render() {\n return html`\n <input\n type=\"radio\"\n part=\"radio\"\n name=\"${this.name}\"\n class=\"${classMap({\n radio: true,\n 'h-7': this.size === 'lg',\n 'w-7': this.size === 'lg',\n 'w-6': this.size === 'md',\n 'h-6': this.size === 'md',\n 'w-5': this.size === 'sm',\n 'h-5': this.size === 'sm',\n })} shadow-none\"\n ?checked=${live(this.checked)}\n ?disabled=${this.disabled}\n />\n <label\n part=\"label\"\n class=\"${classMap({\n label: true,\n 'fds-label': true,\n 'fds-label--sm': this.size === 'sm',\n 'fds-label--md': this.size === 'md',\n 'fds-label--lg': this.size === 'lg',\n })}\"\n >\n <slot></slot>\n </label>\n `;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAaA,MAAM,SAAS;AAAA,EACb;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA0DF;AAaO,IAAM,aAAN,cAAyB,OAAO,YAAY,MAAM,EAAE;AAAA,EAmCzD,cAAc;AACN,UAAA;AA5BD,SAAA,OAAA;AAMG,SAAA,UAAA;AAMF,SAAA,QAAA;AAMG,SAAA,WAAA;AAOgB,SAAA,OAAA;AAIpB,SAAA,iBAAiB,QAAQ,KAAK,UAAU;AACxC,SAAA,i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AAS;AAAA,IAAA,CACtB,CAAC;AAAA,mBACS,KAAK,KAAK,OAAO,CAAC;AAAA,oBACjB,KAAK,QAAQ;AAAA;AAAA;AAAA;AAAA,iBAIhB,SAAS;AAAA,MAChB,OAAO;AAAA,MACP,aAAa;AAAA,MACb,iBAAiB,KAAK,SAAS;AAAA,MAC/B,iBAAiB,KAAK,SAAS;AAAA,MAC/B,iBAAiB,KAAK,SAAS;AAAA,IAAA,CAChC,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA,EAAA;AAMV;AA3HE,gBAAA;AAAA,EADC,MAAM,QAAQ;AAAA,GAJJ,WAKX,WAAA,WAAA,CAAA;AAGA,gBAAA;AAAA,EADC,SAAS;AAAA,GAPC,WAQX,WAAA,QAAA,CAAA;AAMA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,SAAS,SAAS,KAAM,CAAA;AAAA,GAb/B,WAcX,WAAA,WAAA,CAAA;AAMA,gBAAA;AAAA,EADC,SAAS;AAAA,GAnBC,WAoBX,WAAA,SAAA,CAAA;AAMA,gBAAA;AAAA,EADC,SAAS,EAAE,MAAM,SAAS,SAAS,KAAM,CAAA;AAAA,GAzB/B,WA0BX,WAAA,YAAA,CAAA;AAOA,gBAAA;AAAA,EADC,SAAS,EAAE,SAAS,KAAM,CAAA;AAAA,GAhChB,WAiCX,WAAA,QAAA,CAAA;AA8CA,gBAAA;AAAA,EADC,MAAM,YAAY,EAAE,sBAAsB,KAAM,CAAA;AAAA,GA9EtC,WA+EX,WAAA,wBAAA,CAAA;AAKA,gBAAA;AAAA,EADC,MAAM,WAAW,EAAE,sBAAsB,KAAM,CAAA;AAAA,GAnFrC,WAoFX,WAAA,qBAAA,CAAA;AApFW,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 { classMap } from 'lit/directives/class-map.js';\nimport { live } from 'lit/directives/live.js';\nimport { watch } from '../internal/watch';\nimport { styled } from '../mixins/tailwind.mixin';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'mid-radio': MinidRadio;\n }\n}\n\nconst styles = [\n css`\n :host {\n --color-checked: #0062ba;\n --color-border: #7a818c;\n\n color: white;\n padding: 0.25rem 0;\n display: grid;\n grid-template-columns: auto 1fr;\n gap: 0.5rem;\n cursor: pointer;\n font-weight: 400;\n }\n\n :host > * {\n cursor: pointer;\n }\n\n :host:has(input:focus-visible) {\n --fds-focus-border-width: 3px;\n box-shadow: 0 0 0 var(--fds-focus-border-width)\n var(--fds-semantic-border-focus-boxshadow);\n }\n\n :host:has(input:disabled),\n :host:has(input:disabled) > * {\n cursor: not-allowed;\n }\n\n :host:has(input:disabled) > * {\n opacity: 0.3;\n }\n\n .label {\n font-weight: 400;\n }\n\n .radio {\n -webkit-appearance: none;\n appearance: none;\n\n border-radius: 999px;\n display: grid;\n place-content: center;\n border: 2px solid var(--color-border);\n transform: translateY(-0.075em);\n }\n\n .radio:checked {\n border-color: var(--color-checked);\n background:\n radial-gradient(circle closest-side, currentcolor 45%, transparent 50%),\n var(--color-checked);\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 styled(LitElement, styles) {\n @query('.radio')\n element!: HTMLInputElement;\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 /**\n * The radio button's size. When used inside a radio group, the size will be determined by the radio group's size so\n * this attribute can typically be omitted.\n */\n @property({ reflect: true })\n size: 'sm' | 'md' | 'lg' = 'md';\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 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 }\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.element.checked = this.checked;\n }\n\n /**\n * Sets focus on the radio button.\n */\n focus(options?: FocusOptions) {\n // this.classList.add('shadow-focus-visible');\n this.element.focus(options);\n }\n\n override render() {\n return html`\n <input\n type=\"radio\"\n part=\"radio\"\n name=\"${this.name}\"\n class=\"${classMap({\n radio: true,\n 'h-7': this.size === 'lg',\n 'w-7': this.size === 'lg',\n 'w-6': this.size === 'md',\n 'h-6': this.size === 'md',\n 'w-5': this.size === 'sm',\n 'h-5': this.size === 'sm',\n })} shadow-none\"\n ?checked=${live(this.checked)}\n ?disabled=${this.disabled}\n />\n <label\n part=\"label\"\n class=\"${classMap({\n label: true,\n 'fds-label': true,\n 'fds-label--sm': this.size === 'sm',\n 'fds-label--md': this.size === 'md',\n 'fds-label--lg': this.size === 'lg',\n })}\"\n >\n <slot></slot>\n </label>\n `;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAaA,MAAM,SAAS;AAAA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SAAS,EAAE,MAAM,SAAS,SAAS,KAAM,CAAA;AAAA,GAtB/B,WAuBX,WAAA,YAAA,CAAA;AAOA,gBAAA;AAAA,EADC,SAAS,EAAE,SAAS,KAAM,CAAA;AAAA,GA7BhB,WA8BX,WAAA,QAAA,CAAA;AA8CA,gBAAA;AAAA,EADC,MAAM,YAAY,EAAE,sBAAsB,KAAM,CAAA;AAAA,GA3EtC,WA4EX,WAAA,wBAAA,CAAA;AAKA,gBAAA;AAAA,EADC,MAAM,WAAW,EAAE,sBAAsB,KAAM,CAAA;AAAA,GAhFrC,WAiFX,WAAA,qBAAA,CAAA;AAjFW,aAAN,gBAAA;AAAA,EADN,cAAc,WAAW;AAAA,GACb,UAAA;"}
@@ -1,5 +1,4 @@
1
1
  import { LitElement } from 'lit';
2
- import { HasSlotController } from '../internal/slot';
3
2
  declare global {
4
3
  interface HTMLElementTagNameMap {
5
4
  'mid-textfield': MinidTextfield;
@@ -20,33 +19,17 @@ declare const MinidTextfield_base: import('../types/mixin-constructor.ts').Const
20
19
  * @slot suffix - Used for decoration to the right of the input
21
20
  * @slot label - The input's label. Alternatively, you can use the `label` attribute.
22
21
  *
23
- * @csspart base - The fields's base wrapper.
22
+ * @csspart base - The input's wrapper that has the input field styling.
24
23
  * @csspart input - The internal `<input>` element.
25
- * @csspart form-control - The form control that wraps the label, input, and help text.
24
+ * @csspart field - The element that wraps the label, input, and help text.
26
25
  * @csspart clear-button - The clear button
27
26
  * @csspart password-toggle-button - The button for toggling password visibility
28
27
  */
29
28
  export declare class MinidTextfield extends MinidTextfield_base {
30
- #private;
31
- /**
32
- * @ignore
33
- */
34
- inputId: string;
35
- /**
36
- * @ignore
37
- */
38
- descriptionId: string;
39
- /**
40
- * @ignore
41
- */
42
- hasSlotControler: HasSlotController;
43
- /**
44
- * @ignore
45
- */
46
- errorMessageDiv: HTMLDivElement;
47
- /**
48
- * @ignore
49
- */
29
+ private readonly inputId;
30
+ private readonly descriptionId;
31
+ private readonly hasSlotControler;
32
+ private initialValue;
50
33
  input: HTMLInputElement;
51
34
  label: string;
52
35
  description: string;
@@ -111,13 +94,7 @@ export declare class MinidTextfield extends MinidTextfield_base {
111
94
  */
112
95
  hidelabel: boolean;
113
96
  hasFocus: boolean;
114
- /**
115
- * @ignore
116
- */
117
97
  static get formControlValidators(): import('../types/validator.type.ts').Validator[];
118
- /**
119
- * @ignore
120
- */
121
98
  get validationTarget(): HTMLInputElement;
122
99
  constructor();
123
100
  connectedCallback(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"textfield.component.d.ts","sourceRoot":"","sources":["../../src/components/textfield.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,UAAU,EAAW,MAAM,KAAK,CAAC;AAOrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAUrD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,eAAe,EAAE,cAAc,CAAC;KACjC;CACF;;AA6DD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBACa,cAAe,SAAQ,mBAEnC;;IACC;;OAEG;IACH,OAAO,EAAG,MAAM,CAAC;IAEjB;;OAEG;IACH,aAAa,EAAG,MAAM,CAAC;IAEvB;;OAEG;IACH,gBAAgB,oBAAwC;IAOxD;;OAEG;IAEH,eAAe,EAAG,cAAc,CAAC;IAEjC;;OAEG;IAEH,KAAK,EAAG,gBAAgB,CAAC;IAGzB,KAAK,SAAM;IAGX,WAAW,SAAM;IAGjB,KAAK,SAAM;IAGX,IAAI,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAQ;IAGhC,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IAEH,SAAS,UAAS;IAElB;;OAEG;IAEH,YAAY,CAAC,EAAE,QAAQ,CAAC;IAExB;;OAEG;IAEH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IAEH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IAEH,GAAG,CAAC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