@oslokommune/punkt-elements 19.18.2 → 19.18.4

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 (178) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/{accordion-gEzU_AQC.js → accordion-BHVzR-6Z.js} +3 -2
  3. package/dist/{accordion-Ea61u8Xj.cjs → accordion-Bg4CMrUM.cjs} +2 -2
  4. package/dist/alert-CBW94-ku.cjs +39 -0
  5. package/dist/{alert-B3ify6mt.js → alert-CdfTJcT2.js} +3 -2
  6. package/dist/{backlink-HF3DMgLc.js → backlink-D3rkJWkd.js} +1 -1
  7. package/dist/{backlink-CNRyH73A.cjs → backlink-GIyyoDoi.cjs} +1 -1
  8. package/dist/base-elements/input-element.d.ts +3 -0
  9. package/dist/{breadcrumbs-qyZMkJtA.js → breadcrumbs-B4WdX4QR.js} +1 -1
  10. package/dist/{breadcrumbs-YQ1orAK_.cjs → breadcrumbs-B7U57Zey.cjs} +1 -1
  11. package/dist/{button-DWXtPiAA.cjs → button-DdR_XzMY.cjs} +1 -1
  12. package/dist/{button-U4r2XSv4.js → button-DwcFG7bU.js} +1 -1
  13. package/dist/{calendar-C8maj_iv.js → calendar-DGOwyX3o.js} +1 -1
  14. package/dist/{calendar-4S_k7_KN.cjs → calendar-DcenMWOQ.cjs} +1 -1
  15. package/dist/{card-CS0OoVjJ.cjs → card-CizBnD59.cjs} +1 -1
  16. package/dist/{card-yxsQ563N.js → card-D4rpTD_e.js} +3 -2
  17. package/dist/{checkbox-Cj3S0xJE.cjs → checkbox-B8foyiOW.cjs} +1 -1
  18. package/dist/{checkbox-A5B82H0n.js → checkbox-D9-KugOh.js} +2 -1
  19. package/dist/{checkbox-group-AVOtCLSB.js → checkbox-group-BCtUOlZp.js} +2 -2
  20. package/dist/{checkbox-group-BFtLRclu.cjs → checkbox-group-C3CwgQIq.cjs} +1 -1
  21. package/dist/{combobox-rmrzvK3U.cjs → combobox-Bfe2p8d8.cjs} +1 -1
  22. package/dist/{combobox-CScZtqsn.js → combobox-CXdUSMaA.js} +4 -4
  23. package/dist/components/accordion/accordionitem.d.ts +1 -1
  24. package/dist/components/datepicker/datepicker-popup.d.ts +1 -0
  25. package/dist/components/header/header-chrome-controller.d.ts +5 -0
  26. package/dist/components/header/header-service.d.ts +1 -0
  27. package/dist/components/loader/loader.d.ts +3 -3
  28. package/dist/components/modal/modal.d.ts +2 -2
  29. package/dist/components/progressbar/progressbar.d.ts +1 -0
  30. package/dist/components/select/select.d.ts +3 -1
  31. package/dist/components/tag/tag.d.ts +3 -4
  32. package/dist/{consent-JoGVWIB7.js → consent-Chtz1yL0.js} +2 -1
  33. package/dist/consent-Dhh207Zz.cjs +18 -0
  34. package/dist/{datepicker-BOi60ruU.cjs → datepicker-CGpQOyQb.cjs} +3 -3
  35. package/dist/{datepicker-C8DQaZa8.js → datepicker-DQt_f4MP.js} +10 -7
  36. package/dist/{fileupload-Dov3DkmR.cjs → fileupload-BrDtkw2A.cjs} +1 -1
  37. package/dist/{fileupload-jSc9M2Ok.js → fileupload-_v5x0RrP.js} +7 -7
  38. package/dist/{footer-BOIVSL59.js → footer-D4R-9si6.js} +3 -2
  39. package/dist/{footer-MYZSMtmP.cjs → footer-QGnujLm9.cjs} +1 -1
  40. package/dist/{header-CecwTgso.cjs → header-BnyUkagz.cjs} +2 -2
  41. package/dist/{header-BCpCu0HP.js → header-CZUjgMNP.js} +19 -9
  42. package/dist/{header-menu-BEhnqxnw.js → header-menu-Bxuz8rw9.js} +3 -2
  43. package/dist/{header-menu-CkZjAxHb.cjs → header-menu-D9ErtEEq.cjs} +1 -1
  44. package/dist/{helptext-BXoDjtNs.js → helptext-BXryqHy5.js} +1 -1
  45. package/dist/{helptext-DPqzGQeD.cjs → helptext-KrtUyA7H.cjs} +1 -1
  46. package/dist/{icon-D3XT49vM.js → icon-BVSiUQSL.js} +1 -0
  47. package/dist/icon-BsRlhXU2.cjs +1 -0
  48. package/dist/input-element-D82laWtR.cjs +1 -0
  49. package/dist/{input-element-JH4qPly5.js → input-element-DczlJQb1.js} +12 -8
  50. package/dist/{input-wrapper-BttEKK9G.js → input-wrapper-7RSISZu6.js} +4 -3
  51. package/dist/{input-wrapper-Bekd6DGA.cjs → input-wrapper-DT9h0n2i.cjs} +1 -1
  52. package/dist/{link-Cb0ufHt0.js → link-DL4dZoI5.js} +1 -1
  53. package/dist/{link-UEoCDWe-.cjs → link-u69d_-Zh.cjs} +1 -1
  54. package/dist/{linkcard-Dmp8DOyg.cjs → linkcard-B6N7xChn.cjs} +1 -1
  55. package/dist/{linkcard-CD-tRZnz.js → linkcard-C_9NCgkD.js} +1 -1
  56. package/dist/{loader-B0p9ZrAa.js → loader-DJGAd8c-.js} +8 -8
  57. package/dist/{loader-nd4WUR88.cjs → loader-l7CLjzgI.cjs} +8 -8
  58. package/dist/{messagebox-B-DU7T5q.js → messagebox-V1Kszdop.js} +2 -1
  59. package/dist/{messagebox-Bx9jEw4V.cjs → messagebox-YkknrtEM.cjs} +1 -1
  60. package/dist/{modal-Cv0uz8iY.js → modal-BV77IiGH.js} +44 -46
  61. package/dist/{modal-SFoXzth5.cjs → modal-i8CzjbyX.cjs} +20 -22
  62. package/dist/option-group-element-BEGRouXw.cjs +23 -0
  63. package/dist/{option-group-element-16F2MJlO.js → option-group-element-CQViBzca.js} +2 -1
  64. package/dist/pkt-accordion.cjs +1 -1
  65. package/dist/pkt-accordion.js +1 -1
  66. package/dist/pkt-alert.cjs +1 -1
  67. package/dist/pkt-alert.js +1 -1
  68. package/dist/pkt-backlink.cjs +1 -1
  69. package/dist/pkt-backlink.js +1 -1
  70. package/dist/pkt-breadcrumbs.cjs +1 -1
  71. package/dist/pkt-breadcrumbs.js +1 -1
  72. package/dist/pkt-button.cjs +1 -1
  73. package/dist/pkt-button.js +1 -1
  74. package/dist/pkt-calendar.cjs +1 -1
  75. package/dist/pkt-calendar.js +1 -1
  76. package/dist/pkt-card.cjs +1 -1
  77. package/dist/pkt-card.js +1 -1
  78. package/dist/pkt-checkbox-group.cjs +1 -1
  79. package/dist/pkt-checkbox-group.js +1 -1
  80. package/dist/pkt-checkbox.cjs +1 -1
  81. package/dist/pkt-checkbox.js +1 -1
  82. package/dist/pkt-combobox.cjs +1 -1
  83. package/dist/pkt-combobox.js +1 -1
  84. package/dist/pkt-consent.cjs +1 -1
  85. package/dist/pkt-consent.js +1 -1
  86. package/dist/pkt-datepicker.cjs +1 -1
  87. package/dist/pkt-datepicker.js +1 -1
  88. package/dist/pkt-fileupload.cjs +1 -1
  89. package/dist/pkt-fileupload.js +1 -1
  90. package/dist/pkt-footer.cjs +1 -1
  91. package/dist/pkt-footer.js +1 -1
  92. package/dist/pkt-header-menu.cjs +1 -1
  93. package/dist/pkt-header-menu.js +1 -1
  94. package/dist/pkt-header.cjs +1 -1
  95. package/dist/pkt-header.js +1 -1
  96. package/dist/pkt-helptext.cjs +1 -1
  97. package/dist/pkt-helptext.js +1 -1
  98. package/dist/pkt-icon.cjs +1 -1
  99. package/dist/pkt-icon.js +1 -1
  100. package/dist/pkt-index.cjs +1 -1
  101. package/dist/pkt-index.js +34 -34
  102. package/dist/pkt-input-wrapper.cjs +1 -1
  103. package/dist/pkt-input-wrapper.js +1 -1
  104. package/dist/pkt-link.cjs +1 -1
  105. package/dist/pkt-link.js +1 -1
  106. package/dist/pkt-linkcard.cjs +1 -1
  107. package/dist/pkt-linkcard.js +1 -1
  108. package/dist/pkt-loader.cjs +1 -1
  109. package/dist/pkt-loader.js +1 -1
  110. package/dist/pkt-messagebox.cjs +1 -1
  111. package/dist/pkt-messagebox.js +1 -1
  112. package/dist/pkt-modal.cjs +1 -1
  113. package/dist/pkt-modal.js +1 -1
  114. package/dist/pkt-progressbar.cjs +1 -1
  115. package/dist/pkt-progressbar.js +1 -1
  116. package/dist/pkt-radio-group.cjs +1 -1
  117. package/dist/pkt-radio-group.js +1 -1
  118. package/dist/pkt-radiobutton.cjs +1 -1
  119. package/dist/pkt-radiobutton.js +1 -1
  120. package/dist/pkt-searchinput.cjs +1 -1
  121. package/dist/pkt-searchinput.js +1 -1
  122. package/dist/pkt-select.cjs +1 -1
  123. package/dist/pkt-select.js +1 -1
  124. package/dist/pkt-tabs.cjs +1 -1
  125. package/dist/pkt-tabs.js +1 -1
  126. package/dist/pkt-tag.cjs +1 -1
  127. package/dist/pkt-tag.js +1 -1
  128. package/dist/pkt-textarea.cjs +1 -1
  129. package/dist/pkt-textarea.js +1 -1
  130. package/dist/pkt-textinput.cjs +1 -1
  131. package/dist/pkt-textinput.js +1 -1
  132. package/dist/pkt-timepicker.cjs +1 -1
  133. package/dist/pkt-timepicker.js +1 -1
  134. package/dist/{progressbar-eRJU41Uc.cjs → progressbar-Do0ZPeMk.cjs} +3 -2
  135. package/dist/{progressbar-CMwFXEMB.js → progressbar-bamcqcZ2.js} +8 -4
  136. package/dist/{radio-group-CO3dzdOl.js → radio-group-Dz3a7Dgq.js} +2 -2
  137. package/dist/{radio-group-S8Gg4Qaq.cjs → radio-group-iv9QgcSe.cjs} +1 -1
  138. package/dist/{radiobutton-BNsed-4-.js → radiobutton-DMvVv81Y.js} +2 -1
  139. package/dist/{radiobutton-CYlly_Zk.cjs → radiobutton-IcDc6ze2.cjs} +1 -1
  140. package/dist/{searchinput-CVpPmZAJ.cjs → searchinput-B1m241pF.cjs} +1 -1
  141. package/dist/{searchinput-Ca6zFqH5.js → searchinput-zxHqZ-jG.js} +1 -1
  142. package/dist/{select-C74U9Tyl.cjs → select-BuikSUfZ.cjs} +1 -1
  143. package/dist/{select-C7r2Y7Bq.js → select-CN3d9HWQ.js} +9 -6
  144. package/dist/shared-types/heading.d.ts +2 -1
  145. package/dist/shared-types/index.d.ts +2 -2
  146. package/dist/shared-types/size.d.ts +4 -12
  147. package/dist/shared-types-A6iGIX-f.js +1 -0
  148. package/dist/shared-types-BvRk9kiK.cjs +0 -0
  149. package/dist/{tabs-CxG9lgAB.js → tabs-ZhYxE5fX.js} +1 -1
  150. package/dist/{tabs-BsVUzKix.cjs → tabs-fXlMzPFJ.cjs} +1 -1
  151. package/dist/{tag-BfFtiV5e.cjs → tag-B2EEjkjD.cjs} +9 -9
  152. package/dist/{tag-BswfpmoV.js → tag-Bv5JRS69.js} +9 -9
  153. package/dist/{textarea-VObZEvUw.cjs → textarea-Bb_DpiQc.cjs} +1 -1
  154. package/dist/{textarea-5aOI1Qkq.js → textarea-BdeJyPFA.js} +5 -4
  155. package/dist/{textinput-DABFhf0d.js → textinput-B1fKltx7.js} +4 -4
  156. package/dist/{textinput-Wd1yRQuN.cjs → textinput-B5xO_FmE.cjs} +1 -1
  157. package/dist/{timepicker-Bfp365j8.js → timepicker-CUxP-zLZ.js} +3 -3
  158. package/dist/{timepicker-Cc_7siiw.cjs → timepicker-CmSgKlJ4.cjs} +1 -1
  159. package/dist/types/size.d.ts +2 -1
  160. package/package.json +2 -3
  161. package/src/components/accordion/accordionitem.ts +3 -2
  162. package/src/components/datepicker/datepicker-popup.ts +5 -1
  163. package/src/components/datepicker/datepicker.ts +1 -0
  164. package/src/components/fileupload/fileupload-base.ts +6 -6
  165. package/src/components/header/header-chrome-controller.ts +18 -5
  166. package/src/components/header/header-service.ts +6 -3
  167. package/src/components/loader/loader.ts +15 -13
  168. package/src/components/modal/modal.ts +35 -34
  169. package/src/components/progressbar/progressbar.ts +8 -2
  170. package/src/components/select/select.ts +22 -19
  171. package/src/components/tag/tag.ts +21 -25
  172. package/src/components/textarea/textarea.ts +3 -0
  173. package/src/components/textinput/textinput.ts +3 -0
  174. package/dist/alert-ByQC8-D1.cjs +0 -39
  175. package/dist/consent-T0-aOOEh.cjs +0 -18
  176. package/dist/icon-Dk8y6odR.cjs +0 -1
  177. package/dist/input-element-BhbkMU20.cjs +0 -1
  178. package/dist/option-group-element-DHpno4pS.cjs +0 -23
@@ -1,12 +1,12 @@
1
1
  import { classMap } from 'lit/directives/class-map.js'
2
2
  import { ifDefined } from 'lit/directives/if-defined.js'
3
- import { customElement, property, state } from 'lit/decorators.js'
3
+ import { customElement, property } from 'lit/decorators.js'
4
4
  import { html, nothing, PropertyValues } from 'lit'
5
5
  import { PktElementWithSlot } from '@/base-elements/element-with-slot'
6
6
  import { slotContent } from '@/directives/slot-content'
7
7
  import { ref } from 'lit/directives/ref.js'
8
8
  import { Ref, createRef } from 'lit/directives/ref.js'
9
- import { TPktSize } from '@/types/size'
9
+ import type { TPktSizeBase } from 'shared-types'
10
10
  import {
11
11
  createScrollLockToken,
12
12
  setScrollLock,
@@ -16,7 +16,7 @@ import { uuidish } from 'shared-utils/utils'
16
16
  import specs from 'componentSpecs/modal.json'
17
17
  import '@/components/icon'
18
18
 
19
- type ModalSize = TPktSize | 'fit-content'
19
+ type ModalSize = TPktSizeBase | 'fit-content'
20
20
 
21
21
  export interface IPktModal {
22
22
  open?: boolean
@@ -57,7 +57,7 @@ export class PktModal extends PktElementWithSlot implements IPktModal {
57
57
  private readonly _headingId = `pkt-modal__headingText-${this._idSuffix}`
58
58
  private readonly _contentId = `pkt-modal__content-${this._idSuffix}`
59
59
 
60
- @state() _isOpen: boolean = false
60
+ _isOpen: boolean = false
61
61
 
62
62
  constructor() {
63
63
  super()
@@ -143,8 +143,6 @@ export class PktModal extends PktElementWithSlot implements IPktModal {
143
143
  new CustomEvent('close', { detail: { origin: event }, bubbles: true, composed: true }),
144
144
  )
145
145
  if (!bypassNativeClose) this.dialogRef.value?.close()
146
-
147
- this.requestUpdate()
148
146
  }
149
147
 
150
148
  public showModal = (event: Event | null = null) => {
@@ -156,7 +154,6 @@ export class PktModal extends PktElementWithSlot implements IPktModal {
156
154
  this.dispatchEvent(
157
155
  new CustomEvent('showModal', { detail: { origin: event }, bubbles: true, composed: true }),
158
156
  )
159
- this.requestUpdate()
160
157
  }
161
158
 
162
159
  render() {
@@ -205,34 +202,38 @@ export class PktModal extends PktElementWithSlot implements IPktModal {
205
202
  @close=${(event: Event) => this.close(event, true)}
206
203
  >
207
204
  <div class="pkt-modal__wrapper">
208
- ${this.headingText || !this.hideCloseButton
209
- ? html`<div class="pkt-modal__header">
210
- <div class="pkt-modal__header-background"></div>
211
- ${this.headingText
212
- ? html`<h1 id=${this._headingId} class=${classMap(headingClasses)}>
213
- ${headingIcon}${this.headingText}
214
- </h1>`
215
- : html`<div class="pkt-modal__headingText"></div>`}
216
- ${!this.hideCloseButton
217
- ? html`<div class="${classMap(closeButtonClasses)}">
218
- <pkt-button
219
- @click=${(event: Event) => this.close(event)}
220
- aria-label=${this.pktStrings.get('generic').close}
221
- iconname="close"
222
- variant="icon-only"
223
- size="medium"
224
- skin=${isCloseButtonSkinDefault ? 'tertiary' : 'primary'}
225
- >
226
- ${this.pktStrings.get('generic').close}
227
- </pkt-button>
228
- </div>`
229
- : html`<div class="pkt-modal__noCloseButton"></div>`}
230
- </div>`
231
- : nothing}
205
+ ${
206
+ this.headingText || !this.hideCloseButton
207
+ ? html`<div class="pkt-modal__header">
208
+ <div class="pkt-modal__header-background"></div>
209
+ ${
210
+ this.headingText
211
+ ? html`<h1 id=${this._headingId} class=${classMap(headingClasses)}>
212
+ ${headingIcon}${this.headingText}
213
+ </h1>`
214
+ : html`<div class="pkt-modal__headingText"></div>`
215
+ }
216
+ ${
217
+ !this.hideCloseButton
218
+ ? html`<div class="${classMap(closeButtonClasses)}">
219
+ <pkt-button
220
+ @click=${(event: Event) => this.close(event)}
221
+ aria-label=${this.pktStrings.get('generic').close}
222
+ iconname="close"
223
+ variant="icon-only"
224
+ size="medium"
225
+ skin=${isCloseButtonSkinDefault ? 'tertiary' : 'primary'}
226
+ >
227
+ ${this.pktStrings.get('generic').close}
228
+ </pkt-button>
229
+ </div>`
230
+ : html`<div class="pkt-modal__noCloseButton"></div>`
231
+ }
232
+ </div>`
233
+ : nothing
234
+ }
232
235
  <div class="pkt-modal__container">
233
- <div id=${this._contentId} class=${classMap(contentClasses)}>
234
- ${slotContent(this)}
235
- </div>
236
+ <div id=${this._contentId} class=${classMap(contentClasses)}>${slotContent(this)}</div>
236
237
  </div>
237
238
  </div>
238
239
  </dialog>
@@ -57,13 +57,14 @@ export class PktProgressbar extends PktElement implements IPktProgressbar {
57
57
  @property({ type: Number }) valueMin = 0
58
58
 
59
59
  // State
60
- @state() private labelWidth = 0
60
+ private labelWidth = 0
61
61
  @state() private progressbarId: string = this.id
62
62
  @state() private resolvedRole: TProgressbarRole = 'progressbar'
63
63
 
64
64
  // Private refs
65
65
  private labelRef: Ref<HTMLSpanElement> = createRef()
66
66
  private progressBarRef: Ref<HTMLDivElement> = createRef()
67
+ private containerRef: Ref<HTMLDivElement> = createRef()
67
68
 
68
69
  protected willUpdate(changedProperties: Map<string | number | symbol, unknown>) {
69
70
  super.willUpdate(changedProperties)
@@ -85,7 +86,11 @@ export class PktProgressbar extends PktElement implements IPktProgressbar {
85
86
  super.updated(changedProperties)
86
87
 
87
88
  if (changedProperties.has('valueCurrent') && this.labelRef.value) {
88
- this.labelWidth = this.labelRef.value.getBoundingClientRect().width || 0
89
+ const width = this.labelRef.value.getBoundingClientRect().width || 0
90
+ if (width !== this.labelWidth) {
91
+ this.labelWidth = width
92
+ this.containerRef.value?.style.setProperty('--pkt-progress-label-width', `${width}px`)
93
+ }
89
94
  }
90
95
  }
91
96
 
@@ -140,6 +145,7 @@ export class PktProgressbar extends PktElement implements IPktProgressbar {
140
145
  class="pkt-progressbar"
141
146
  >
142
147
  <div
148
+ ${ref(this.containerRef)}
143
149
  class="pkt-progressbar__container"
144
150
  style=${styleMap({
145
151
  '--pkt-progress-label-width': `${this.labelWidth}px`,
@@ -50,6 +50,7 @@ export class PktSelect extends PktOptionsInputElement<{}, TSelectOption> impleme
50
50
 
51
51
  public selectedIndex: number | null = -1
52
52
  public selectedOptions: HTMLCollectionOf<HTMLOptionElement> | undefined = undefined
53
+ private defaultedToFirstOption = false
53
54
 
54
55
  constructor() {
55
56
  super()
@@ -145,19 +146,31 @@ export class PktSelect extends PktOptionsInputElement<{}, TSelectOption> impleme
145
146
  super.attributeChangedCallback(name, _old, value)
146
147
  }
147
148
 
148
- update(changedProperties: PropertyValues) {
149
- super.update(changedProperties)
149
+ protected willUpdate(changedProperties: PropertyValues): void {
150
150
  if (changedProperties.has('_optionsProp') && this._optionsProp.length > 0) {
151
151
  this._options = this._optionsProp
152
- this.requestUpdate('_options')
153
-
154
- // If no value is set and we have options, set to first option
155
152
  if (!this.value && this._options.length > 0) {
156
- // eslint-disable-next-line lit/no-property-change-update -- Initial value setup is intentional
157
153
  this.value = this._options[0].value
158
154
  this.selectedIndex = 0
159
155
  }
160
156
  }
157
+ super.willUpdate(changedProperties)
158
+ if (!this.hasUpdated) {
159
+ if (!this.value && this._options.length > 0) {
160
+ this.value = this._options[0].value
161
+ this.selectedIndex = 0
162
+ this.defaultedToFirstOption = true
163
+ } else {
164
+ this.selectedIndex = this._options.findIndex((option) => option.value === this.value)
165
+ }
166
+ }
167
+ if (changedProperties.has('id')) {
168
+ !this.name && this.id && (this.name = this.id)
169
+ }
170
+ }
171
+
172
+ protected updated(changedProperties: PropertyValues): void {
173
+ super.updated(changedProperties)
161
174
  if (changedProperties.has('value') && this.value !== changedProperties.get('value')) {
162
175
  this.selectedIndex = this.touched
163
176
  ? this.returnNumberOrNull(this.inputRef.value?.selectedIndex)
@@ -165,25 +178,15 @@ export class PktSelect extends PktOptionsInputElement<{}, TSelectOption> impleme
165
178
  this.selectedOptions = this.inputRef.value?.selectedOptions
166
179
  this.valueChanged(this.value, changedProperties.get('value'))
167
180
  }
168
- if (changedProperties.has('id')) {
169
- !this.name && this.id && (this.name = this.id)
170
- }
171
181
  }
172
182
 
173
183
  protected firstUpdated(_changedProperties: PropertyValues): void {
174
184
  super.firstUpdated(_changedProperties)
175
185
  this.classList.add('pkt-select')
176
- if (this._optionsProp.length) {
177
- this._options = this._optionsProp
178
- }
179
- // If no options are selected, set value and selectedIndex to the first option
180
- if (!this.value && this._options.length > 0) {
181
- this.value = this._options[0].value
182
- this.selectedIndex = 0
183
- } else {
184
- this.selectedIndex = this._options.findIndex((option) => option.value === this.value)
185
- }
186
186
  this.selectedOptions = this.inputRef.value?.selectedOptions
187
+ if (this.defaultedToFirstOption) {
188
+ this.updateComplete.then(() => this.dispatchChangeEvents(this.value))
189
+ }
187
190
  }
188
191
 
189
192
  render() {
@@ -3,30 +3,21 @@ import { customElement, property, state } from 'lit/decorators.js'
3
3
  import { html, PropertyValues } from 'lit'
4
4
  import { PktElementWithSlot } from '@/base-elements/element-with-slot'
5
5
  import { getSlotManager, slotContent } from '@/directives/slot-content'
6
- import { TPktSize } from '@/types/size'
7
6
  import specs from 'componentSpecs/tag.json'
8
7
 
9
8
  import '@/components/icon'
10
- import type { IAriaAttributes, THTMLButtonType } from 'shared-types'
9
+ import type { IAriaAttributes, THTMLButtonType, TPktSizeBase } from 'shared-types'
11
10
  import { PktIconName } from '@oslokommune/punkt-assets/dist/icons/icon'
12
11
  import { ifDefined } from 'lit/directives/if-defined.js'
13
12
  import { formatString, type IPktStringsProps } from 'shared-strings'
14
13
 
15
14
  export type TTagSkin =
16
- | 'blue'
17
- | 'blue-dark'
18
- | 'blue-light'
19
- | 'green'
20
- | 'red'
21
- | 'yellow'
22
- | 'beige'
23
- | 'gray'
24
- | 'grey'
15
+ 'blue' | 'blue-dark' | 'blue-light' | 'green' | 'red' | 'yellow' | 'beige' | 'gray' | 'grey'
25
16
  export type TTagType = THTMLButtonType
26
17
 
27
18
  export interface IPktTag extends IPktStringsProps<'tag'> {
28
19
  closeTag?: boolean
29
- size?: TPktSize
20
+ size?: TPktSizeBase
30
21
  skin?: TTagSkin
31
22
  textStyle?: string | null
32
23
  iconName?: PktIconName
@@ -44,7 +35,8 @@ export class PktTag extends PktElementWithSlot<IPktTag> implements IPktTag {
44
35
  * Element attributes
45
36
  */
46
37
  @property({ type: Boolean, reflect: true }) closeTag: boolean = specs.props.closeTag.default
47
- @property({ type: String, reflect: true }) size: TPktSize = specs.props.size.default as TPktSize
38
+ @property({ type: String, reflect: true }) size: TPktSizeBase = specs.props.size
39
+ .default as TPktSizeBase
48
40
  @property({ type: String, reflect: true }) skin: TTagSkin = specs.props.skin.default as TTagSkin
49
41
  @property({ type: String, reflect: true }) textStyle: string | null = null
50
42
  @property({ type: String, reflect: true }) iconName: string | undefined = undefined
@@ -118,12 +110,14 @@ export class PktTag extends PktElementWithSlot<IPktTag> implements IPktTag {
118
110
  aria-label=${ifDefined(this.ariaLabel || undefined)}
119
111
  aria-description=${ifDefined(this._ariaDescription || undefined)}
120
112
  >
121
- ${this.iconName &&
122
- html`<pkt-icon
123
- class="pkt-tag__icon"
124
- name=${this.iconName}
125
- aria-hidden="true"
126
- ></pkt-icon>`}
113
+ ${
114
+ this.iconName &&
115
+ html`<pkt-icon
116
+ class="pkt-tag__icon"
117
+ name=${this.iconName}
118
+ aria-hidden="true"
119
+ ></pkt-icon>`
120
+ }
127
121
  <span>${slotContent(this)}</span>
128
122
  <pkt-icon class="pkt-tag__close-btn" name="close"></pkt-icon>
129
123
  </button>
@@ -131,12 +125,14 @@ export class PktTag extends PktElementWithSlot<IPktTag> implements IPktTag {
131
125
  } else {
132
126
  return html`
133
127
  <span class=${classMap(classes)}>
134
- ${this.iconName &&
135
- html`<pkt-icon
136
- class="pkt-tag__icon"
137
- name=${this.iconName}
138
- aria-hidden="true"
139
- ></pkt-icon>`}
128
+ ${
129
+ this.iconName &&
130
+ html`<pkt-icon
131
+ class="pkt-tag__icon"
132
+ name=${this.iconName}
133
+ aria-hidden="true"
134
+ ></pkt-icon>`
135
+ }
140
136
  <span>${slotContent(this)}</span>
141
137
  </span>
142
138
  `
@@ -65,6 +65,9 @@ export class PktTextarea extends PktInputElement<Props> implements IPktTextarea
65
65
 
66
66
  protected willUpdate(changedProperties: PropertyValues) {
67
67
  super.willUpdate(changedProperties)
68
+ if (changedProperties.has('value') && typeof this.value !== 'string' && !Array.isArray(this.value)) {
69
+ this.value = this.coerceToString(this.value)
70
+ }
68
71
  if (changedProperties.has('value')) {
69
72
  this.counterCurrent = this.value?.length || 0
70
73
  }
@@ -46,6 +46,9 @@ export class PktTextinput extends PktInputElement<Props> {
46
46
 
47
47
  protected willUpdate(changedProperties: PropertyValues) {
48
48
  super.willUpdate(changedProperties)
49
+ if (changedProperties.has('value') && typeof this.value !== 'string' && !Array.isArray(this.value)) {
50
+ this.value = this.coerceToString(this.value)
51
+ }
49
52
  if (changedProperties.has('value')) {
50
53
  this.counterCurrent = this.value?.length || 0
51
54
  }
@@ -1,39 +0,0 @@
1
- const e=require("./element-C6WTyJFE.cjs"),t=require("./class-map-Bh6toDeV.cjs"),n=require("./format-B8meU8Tm.cjs"),r=require("./element-with-slot-B0Vp_OuR.cjs");require("./icon-Dk8y6odR.cjs");const i=require("./classutils-CbklAJDe.cjs"),a=require("./define-component-spec-DBNd2FJY.cjs");require("./button-DWXtPiAA.cjs");var o=[`off`,`polite`,`assertive`],s=[`info`,`success`,`warning`,`error`],c=[`medium`,`small`,`xsmall`],l={compact:!1},u=a.t({name:`pkt-alert`,react:`PktAlert`,"css-class":`pkt-alert`,"dark-mode":!0,isElement:!0,isPureReact:!0,events:{onClose:{reactOnly:!0,description:`React: Klikk-event for 'Lukk'-knappen`},close:{elementsOnly:!0,description:`Elements: Klikk-event for 'Lukk'-knappen`},"on-close":{elementsOnly:!0,description:`Elements: Samme event som <code>close</code>, beholdt for eldre Vue-oppsett.`,deprecated:`Bruk <code>close</code>. <code>on-close</code> fjernes i en senere hovedversjon.`}},props:{title:{name:`Tittel`,description:`Tittelen som vises øverst i på meldingen`,type:`string`,category:`contents`},skin:{name:`Utseende`,description:`Hvordan type melding er dette?`,type:[...s],default:`info`,category:`ui`},date:{name:`Sist oppdatert`,description:`Dato som vises nederst i på meldingen`,type:`string`,category:`contents`},ariaLive:{name:`aria-live`,description:`Hvordan skal skjermleseren lese opp meldingen?`,type:[...o],default:`polite`,category:`accessibility`},size:{name:`Størrelse`,description:`Endrer størrelsen på ulike elementer i alerten.`,type:[...c],default:`medium`,category:`ui`},closeAlert:{name:`Vis 'Lukk'-knapp`,description:`Viser 'Lukk'-knappen`,type:`boolean`,default:!1,category:`ui`},compact:{name:`Kompakt`,description:`Kompakt visning av alerten.`,deprecated:"Bruk `size` i stedet; uten eksplisitt `size` gir compact størrelsen 'small'.",type:`boolean`,category:`ui`,default:l.compact}},slots:{default:{description:`Innholdet i meldingen`}}}),d=class extends r.t{constructor(){super(),this.compact=l.compact,this.title=``,this.skin=u.props.skin.default,this.ariaLive=u.props.ariaLive.default,this.ariaLiveAttr=null,this.closeAlert=u.props.closeAlert.default,this.date=null,this.role=`status`,this._isClosed=!1,this.close=e=>{this._isClosed=!0,this.dispatchEvent(new CustomEvent(`close`,{detail:{origin:e},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`on-close`,{detail:{origin:e},bubbles:!0,composed:!0}))},this._isClosed=!1}connectedCallback(){super.connectedCallback(),this.ariaLiveAttr=this.getAttribute(`aria-live`)||this.ariaLive}attributeChangedCallback(e,t,n){e===`ariaLive`&&(this.ariaLiveAttr=n),super.attributeChangedCallback(e,t,n)}updated(e){super.updated(e),e.has(`ariaLive`)&&e.get(`ariaLive`)!==void 0&&(this.ariaLiveAttr=this.ariaLive),e.has(`_isClosed`)&&i.t(this,`pkt-hide`,this._isClosed)}render(){let i=this.size??(this.compact?`small`:`medium`),a={"pkt-alert":!0,[`pkt-alert--${i}`]:!0,[`pkt-alert--${this.skin}`]:!0,"pkt-hide":this._isClosed},o={"pkt-alert__grid":!0,"pkt-alert__noTitle":!this.title,"pkt-alert__noDate":!this.date};return e._`
2
- <div
3
- class=${t.t(a)}
4
- aria-live=${this.ariaLiveAttr}
5
- role=${this.role}
6
- >
7
- <div class=${t.t(o)}>
8
- <pkt-icon
9
- class="pkt-alert__icon"
10
- aria-hidden="true"
11
- name=${this.skin===`info`?`alert-information`:`alert-${this.skin}`}
12
- ></pkt-icon>
13
-
14
- ${this.closeAlert?e._`
15
- <div class="pkt-alert__close">
16
- <pkt-button
17
- tabindex="0"
18
- aria-label=${this.pktStrings.get(`generic`).close}
19
- size=${i}
20
- type="button"
21
- skin="tertiary"
22
- iconName="close"
23
- variant="icon-only"
24
- @click=${this.close}
25
- >
26
- <span class="sr-only">${this.pktStrings.get(`generic`).close}</span>
27
- </pkt-button>
28
- </div>
29
- `:e.h}
30
- ${this.title?e._`<div class="pkt-alert__title">${this.title}</div>`:e.h}
31
-
32
- <div class="pkt-alert__text">${r.i(this)}</div>
33
-
34
- ${this.date?e._`<div class="pkt-alert__date">
35
- ${n.t(this.pktStrings.get(`alert`).lastUpdated,{date:this.date})}
36
- </div>`:e.h}
37
- </div>
38
- </div>
39
- `}};e.n([e.u({type:Boolean,reflect:!1})],d.prototype,`compact`,void 0),e.n([e.u({type:String,reflect:!0})],d.prototype,`title`,void 0),e.n([e.u({type:String,reflect:!0})],d.prototype,`skin`,void 0),e.n([e.u({type:String})],d.prototype,`ariaLive`,void 0),e.n([e.u({type:String,reflect:!0,attribute:`aria-live`})],d.prototype,`ariaLiveAttr`,void 0),e.n([e.u({type:Boolean,reflect:!0})],d.prototype,`closeAlert`,void 0),e.n([e.u({type:String,reflect:!0})],d.prototype,`date`,void 0),e.n([e.u({type:String})],d.prototype,`role`,void 0),e.n([e.u({type:String,attribute:`size`})],d.prototype,`size`,void 0),e.n([e.l()],d.prototype,`_isClosed`,void 0);try{e.d(`pkt-alert`)(d)}catch{console.warn(`Forsøker å definere <pkt-alert>, men den er allerede definert`)}var f=d;Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return f}});
@@ -1,18 +0,0 @@
1
- const e=require("./element-C6WTyJFE.cjs");require("./button-DWXtPiAA.cjs");var t={i18n:{nb:{contentPresentation:{title:`Oslo kommune bruker informasjonskapsler`,description:[`For at nettstedet skal fungere og være trygt, bruker Oslo kommune informasjonskapsler. Noen er teknisk nødvendige, mens andre sikrer ulik funksjonalitet.`,`Godtar du alle informasjonskapsler, tillater du også at vi samler inn data om statistikk og brukeradferd. Da hjelper du oss med å lage et bedre nettsted uten at du trenger å dele noe personlig informasjon med oss.`],buttons:{accept:`Godta alle`,reject:`Kun nødvendige`,settings:`Innstillinger for informasjonskapsler`}},contentSettings:{title:`Innstillinger for informasjonskapsler`,description:[`Her kan du velge hvilke typer informasjonskapsler du vil tillate. Tillatelsen gjelder i 90 dager. Husk at nødvendige informasjonskapsler ikke kan velges bort.`,`Du kan når som helst endre innstillingene og finne mer informasjon nederst på nettstedet under «Innstillinger for informasjonskapsler» og «Personvern og informasjonskapsler».`],buttons:{back:`Tilbake`,save:`Lagre innstillinger`}}},en:{contentPresentation:{title:`Before you visit Oslo kommune ...`,description:[`This website uses cookies to make improvements. In this context, we need your consent to measure the traffic on the website in relation to statistics and feedback.`,`To read more about what we use cookies for, go to our privacy declaration which you will find at the bottom of our websites.`],buttons:{accept:`Yes, I accept`,reject:`Only necessary`,settings:`Go to settings`}},contentSettings:{title:`Her kan du aktivt velge mellom ulike informasjonskapsler`,description:[`For å lese mer om hva vi bruker informasjonskapsler til gå til vår personvernserklering som du finner på våre nettsider`],buttons:{back:`Back`,save:`Save settings`}}}},cookies:[{name:`statistics`,defaultValue:null,i18n:{nb:{title:`Statistikk og analyse`,description:`Jeg godtar at Oslo kommune bruker informasjonskapsler til å innhente data om statistikk og brukeradferd.`,buttons:{yes:`Ja`,no:`Nei`}},en:{title:`Statistics and analytics`,description:`Select your preference for statistics and analytics`,buttons:{yes:`Yes`,no:`No`}}}},{name:`survey`,defaultValue:null,i18n:{nb:{title:`Skriftlige tilbakemeldinger`,description:`Jeg godtar at Oslo kommune bruker informasjonskapsler til å vise responsfelt og registrere tilbakemeldinger.`,buttons:{yes:`Ja`,no:`Nei`}},en:{title:`Survey`,description:`Select your preference for survey`,buttons:{yes:`Yes`,no:`No`}}}},{name:`functional`,defaultValue:!0,i18n:{nb:{title:`Funksjonelle informasjonskapsler`,description:`Jeg godtar at Oslo kommune bruker informasjonskapsler for å gjøre ulike funksjoner på nettstedet mulige (for eksempel skjemaer og barnehagevelger).`,buttons:{yes:`Ja`,no:`Nei`}},en:{title:`Functional cookies`,description:`For the website to function optimally, we recommend that you accept these cookies`,buttons:{yes:`Yes`,no:`No`}}}}]},n={devMode:!1,i18nLanguage:`nb`,triggerType:`button`},r=null;function i(){return r||(r=new Promise((e,t)=>{if(document.querySelector(`#oslo-consent-script`)){e();return}let n=document.createElement(`script`);n.src=`https://cdn.web.oslo.kommune.no/cb/cb-v2.0.0.js`,n.id=`oslo-consent-script`,n.onload=()=>e(),n.onerror=t,document.head.appendChild(n);let r=document.createElement(`link`);r.href=`https://cdn.web.oslo.kommune.no/cb/cb-v2.0.0.css`,r.type=`text/css`,r.rel=`stylesheet`,r.id=`oslo-consent-styles`,document.head.appendChild(r)}),r)}var a=e=>{if(typeof e!=`string`)return e;try{return JSON.parse(e)}catch{return e}},o=e=>a(e.value).items.reduce((e,t)=>(e[t.name]=t.consent,e),{}),s=class extends e.t{constructor(...e){super(...e),this.devMode=n.devMode,this.hotjarId=null,this.googleAnalyticsId=null,this.cookieDomain=null,this.cookieSecure=null,this.cookieExpiryDays=null,this.triggerType=n.triggerType,this.triggerText=null,this.i18nLanguage=n.i18nLanguage}connectedCallback(){super.connectedCallback();let e=Object.prototype.hasOwnProperty.call(t.i18n,this.i18nLanguage)?this.i18nLanguage:`nb`;this.triggerText=this.triggerText||t.i18n[e].contentPresentation.buttons.settings}disconnectedCallback(){super.disconnectedCallback(),this._cookieEventHandler&&window.__cookieEvents?.off(`CookieManager.setCookie`,this._cookieEventHandler)}returnJsonOrObject(e){return a(e)}emitCookieConsents(e){this.dispatchEvent(new CustomEvent(`toggle-consent`,{detail:o(e),bubbles:!0,cancelable:!1}))}async firstUpdated(e){window.cookieBanner_googleAnalyticsId=this.googleAnalyticsId,window.cookieBanner_hotjarId=this.hotjarId,this.cookieDomain&&(window.cookieBanner_cookieDomain=this.cookieDomain),this.cookieSecure&&(window.cookieBanner_cookieSecure=this.cookieSecure),this.cookieExpiryDays&&(window.cookieBanner_cookieExpiryDays=this.cookieExpiryDays),this.devMode&&(window.cookieBanner_devMode=this.devMode),await i(),this.triggerInit()}triggerInit(){window.document.dispatchEvent(new Event(`CookieBannerReady`,{bubbles:!0,cancelable:!0}));let e=window.cookieBanner,t=window.__cookieEvents;e&&t&&e.cookieConsent.validateConsentCookie().then(n=>{if(!n)return;let r=e.cookieConsent.getConsentCookie();window.setTimeout(()=>this.emitCookieConsents({value:r}),0),this._cookieEventHandler&&t.off(`CookieManager.setCookie`,this._cookieEventHandler),this._cookieEventHandler=e=>this.emitCookieConsents(e),t.on(`CookieManager.setCookie`,this._cookieEventHandler)})}openModal(e){e.preventDefault(),window.cookieBanner?.cookieConsent||this.triggerInit(),setTimeout(()=>window.cookieBanner?.openCookieModal())}render(){return this.triggerType===`link`?e._`<a href="#" class="pkt-link" aria-haspopup="dialog" @click=${this.openModal}
2
- >${this.triggerText}</a
3
- >`:this.triggerType===`footerlink`?e._`<a
4
- href="#"
5
- class="pkt-footer__link"
6
- aria-haspopup="dialog"
7
- @click=${this.openModal}
8
- >${this.triggerText}</a
9
- >`:this.triggerType===`icon`?e._`<pkt-button
10
- skin="tertiary"
11
- variant="icon-only"
12
- iconName="cookie"
13
- aria-haspopup="dialog"
14
- @click=${this.openModal}
15
- >${this.triggerText}</pkt-button
16
- >`:e._`<pkt-button aria-haspopup="dialog" @click=${this.openModal}
17
- >${this.triggerText}</pkt-button
18
- >`}};e.n([e.u({type:Boolean})],s.prototype,`devMode`,void 0),e.n([e.u({type:String})],s.prototype,`hotjarId`,void 0),e.n([e.u({type:String})],s.prototype,`googleAnalyticsId`,void 0),e.n([e.u({type:String})],s.prototype,`cookieDomain`,void 0),e.n([e.u({type:String})],s.prototype,`cookieSecure`,void 0),e.n([e.u({type:String})],s.prototype,`cookieExpiryDays`,void 0),e.n([e.u({type:String})],s.prototype,`triggerType`,void 0),e.n([e.u({type:String})],s.prototype,`triggerText`,void 0),e.n([e.u({type:String})],s.prototype,`i18nLanguage`,void 0);try{e.d(`pkt-consent`)(s)}catch{console.warn(`Forsøker å definere <pkt-consent>, men den er allerede definert`)}var c=s;Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return c}});
@@ -1 +0,0 @@
1
- const e=require("./element-C6WTyJFE.cjs");var t={name:``,path:`https://punkt-cdn.oslo.kommune.no/latest/icons/`},n=class extends e.p{constructor(t){if(super(t),this.it=e.h,t.type!==e.m.CHILD)throw Error(this.constructor.directiveName+`() can only be used in child bindings`)}render(t){if(t===e.h||t==null)return this._t=void 0,this.it=t;if(t===e.g)return t;if(typeof t!=`string`)throw Error(this.constructor.directiveName+`() called with a non-string value`);if(t===this.it)return this._t;this.it=t;let n=[t];return n.raw=n,this._t={_$litType$:this.constructor.resultType,strings:n,values:[]}}};n.directiveName=`unsafeHTML`,n.resultType=1;var r=e.f(n),i=class extends n{};i.directiveName=`unsafeSVG`,i.resultType=2;var a=e.f(i);typeof window<`u`&&(window.pktFetch=window.pktFetch===void 0?fetch:window.pktFetch,window.pktIconPath=window.pktIconPath||t.path);var o=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"></svg>`,s={},c=2,l=1500,u=(()=>{try{return typeof Storage<`u`&&typeof sessionStorage<`u`}catch{return!1}})(),d=e=>window.pktFetch(e).then(t=>{if(!t.ok)throw Error(`Missing icon: `+e);return t.text()}),f=async(e,t=c)=>{try{return await d(e)}catch{return t>0?(await new Promise(e=>setTimeout(e,l)),f(e,t-1)):(console.error(`Failed to fetch icon: `+e),o)}},p=async(e,t)=>{let n=t+e+`.svg`;return u&&sessionStorage.getItem(n)?sessionStorage.getItem(n):n in s?s[n]:typeof window<`u`&&typeof window.pktFetch==`function`?(s[n]=f(n).then(e=>(e!==o&&u&&sessionStorage.setItem(n,e),delete s[n],e)),s[n]):o},m=class extends e.t{constructor(...e){super(...e),this.path=typeof window<`u`?window.pktIconPath:t.path,this.name=t.name,this.ariaHidden=null,this.ariaLabel=null,this.icon=a(o),this._updatedProps=[]}get effectiveAriaHidden(){return this.ariaHidden!==null&&this.ariaHidden!==void 0?this.ariaHidden===``||this.ariaHidden===`true`:!this.ariaLabel}get effectiveAriaLabel(){return this.effectiveAriaHidden?null:this.ariaLabel||this.name||null}connectedCallback(){super.connectedCallback(),this.classList.add(`pkt-icon`)}async attributeChangedCallback(e,t,n){super.attributeChangedCallback(e,t,n),(e===`name`||e===`path`)&&this.getIcon(this.name)}async updated(e){super.updated(e),(e.has(`name`)||e.has(`path`))&&this.getIcon(this.name),this.applyAriaToSvg()}applyAriaToSvg(){let e=this.querySelector(`svg`);if(!e)return;e.setAttribute(`aria-hidden`,String(this.effectiveAriaHidden));let t=this.effectiveAriaLabel;t?e.setAttribute(`aria-label`,t):e.removeAttribute(`aria-label`)}async getIcon(e=``){if(this._updatedProps.length>0){this.path||=typeof window<`u`?window.pktIconPath:t.path;try{this.icon=a(await p(this.name||``,this.path))}catch{this.icon=a(o)}this._updatedProps=[]}else this._updatedProps.includes(e)||this._updatedProps.push(e)}render(){return e._`${this.name&&this.icon}`}};e.n([e.u({type:String,reflect:!1})],m.prototype,`path`,void 0),e.n([e.u({type:String,reflect:!0})],m.prototype,`name`,void 0),e.n([e.u({type:String,attribute:`aria-hidden`,reflect:!0})],m.prototype,`ariaHidden`,void 0),e.n([e.u({type:String,attribute:`aria-label`,reflect:!0})],m.prototype,`ariaLabel`,void 0),e.n([e.u({type:SVGElement})],m.prototype,`icon`,void 0),e.n([e.u({type:Array,noAccessor:!0})],m.prototype,`_updatedProps`,void 0);try{e.d(`pkt-icon`)(m)}catch{console.warn(`Forsøker å definere <pkt-icon>, men den er allerede definert`)}var h=m;Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return h}});
@@ -1 +0,0 @@
1
- const e=require("./element-C6WTyJFE.cjs"),t=require("./format-B8meU8Tm.cjs"),n=require("./element-with-slot-B0Vp_OuR.cjs"),r=require("./booleanish-BF8l4scU.cjs"),i=require("./utils-63cRpWut.cjs");var a=new WeakMap,o=new WeakMap,s=new WeakMap,c=new WeakMap,l=new WeakMap,u=new WeakMap,d=new WeakMap,f=new WeakMap,p=new WeakMap,m=new WeakMap,h=new WeakMap,g=new WeakMap,_=new WeakMap,v=new WeakMap,y=new WeakMap,b=(e,t,n)=>{e.getAttribute(t)!==n&&e.setAttribute(t,n)},x=(e,t)=>{e.toggleAttribute(`internals-disabled`,t),t?b(e,`aria-disabled`,`true`):e.removeAttribute(`aria-disabled`),e.formDisabledCallback&&e.formDisabledCallback.apply(e,[t])},S=e=>{s.get(e).forEach(e=>{e.remove()}),s.set(e,[])},C=(e,t)=>{let n=document.createElement(`input`);return n.type=`hidden`,n.name=e.getAttribute(`name`),e.after(n),s.get(t).push(n),n},w=(e,t)=>{if(t.length){let n=Array.from(t);n.forEach(t=>t.addEventListener(`click`,e.click.bind(e)));let[r]=n,i=r.id;r.id||=(i=`${r.htmlFor}_Label`,i),b(e,`aria-labelledby`,i)}},T=e=>{let t=Array.from(e.elements).filter(e=>!e.tagName.includes(`-`)&&e.validity).map(e=>e.validity.valid),n=f.get(e)||[],r=Array.from(n).filter(e=>e.isConnected).map(e=>c.get(e).validity.valid),i=[...t,...r].includes(!1);e.toggleAttribute(`internals-invalid`,i),e.toggleAttribute(`internals-valid`,!i)},ee=e=>{T(E(e.target))},te=e=>{T(E(e.target))},ne=e=>{let t=[`button[type=submit]`,`input[type=submit]`,`button:not([type])`].map(e=>`${e}:not([disabled])`).map(t=>`${t}:not([form])${e.id?`,${t}[form='${e.id}']`:``}`).join(`,`);e.addEventListener(`click`,n=>{if(n.target.closest(t)){let t=f.get(e);if(e.noValidate)return;t.size&&Array.from(t).reverse().map(e=>c.get(e).reportValidity()).includes(!1)&&n.preventDefault()}})},re=e=>{let t=f.get(e.target);t&&t.size&&t.forEach(e=>{e.constructor.formAssociated&&e.formResetCallback&&e.formResetCallback.apply(e)})},ie=(e,t,n)=>{if(t){let r=f.get(t);if(r)r.add(e);else{let n=new Set;n.add(e),f.set(t,n),ne(t),t.addEventListener(`reset`,re),t.addEventListener(`input`,ee),t.addEventListener(`change`,te)}u.set(t,{ref:e,internals:n}),e.constructor.formAssociated&&e.formAssociatedCallback&&setTimeout(()=>{e.formAssociatedCallback.apply(e,[t])},0),T(t)}},E=e=>{let t=e.parentNode;return t&&t.tagName!==`FORM`&&(t=E(t)),t},D=(e,t,n=DOMException)=>{if(!e.constructor.formAssociated)throw new n(t)},O=(e,t,n)=>{let r=f.get(e);return r&&r.size&&r.forEach(e=>{c.get(e)[n]()||(t=!1)}),t},k=e=>{let t=!1;if(e.constructor.formAssociated){let n=c.get(e);n===void 0&&(e.attachInternals(),n=c.get(e),t=!0);let{labels:r,form:i}=n;w(e,r),ie(e,i,n)}return t};function A(){return typeof MutationObserver<`u`}var j={ariaAtomic:`aria-atomic`,ariaAutoComplete:`aria-autocomplete`,ariaBrailleLabel:`aria-braillelabel`,ariaBrailleRoleDescription:`aria-brailleroledescription`,ariaBusy:`aria-busy`,ariaChecked:`aria-checked`,ariaColCount:`aria-colcount`,ariaColIndex:`aria-colindex`,ariaColIndexText:`aria-colindextext`,ariaColSpan:`aria-colspan`,ariaCurrent:`aria-current`,ariaDescription:`aria-description`,ariaDisabled:`aria-disabled`,ariaExpanded:`aria-expanded`,ariaHasPopup:`aria-haspopup`,ariaHidden:`aria-hidden`,ariaInvalid:`aria-invalid`,ariaKeyShortcuts:`aria-keyshortcuts`,ariaLabel:`aria-label`,ariaLevel:`aria-level`,ariaLive:`aria-live`,ariaModal:`aria-modal`,ariaMultiLine:`aria-multiline`,ariaMultiSelectable:`aria-multiselectable`,ariaOrientation:`aria-orientation`,ariaPlaceholder:`aria-placeholder`,ariaPosInSet:`aria-posinset`,ariaPressed:`aria-pressed`,ariaReadOnly:`aria-readonly`,ariaRelevant:`aria-relevant`,ariaRequired:`aria-required`,ariaRoleDescription:`aria-roledescription`,ariaRowCount:`aria-rowcount`,ariaRowIndex:`aria-rowindex`,ariaRowIndexText:`aria-rowindextext`,ariaRowSpan:`aria-rowspan`,ariaSelected:`aria-selected`,ariaSetSize:`aria-setsize`,ariaSort:`aria-sort`,ariaValueMax:`aria-valuemax`,ariaValueMin:`aria-valuemin`,ariaValueNow:`aria-valuenow`,ariaValueText:`aria-valuetext`,role:`role`},ae=(e,t)=>{for(let n in j){t[n]=null;let r=null,i=j[n];Object.defineProperty(t,n,{get(){return r},set(n){r=n,e.isConnected?b(e,i,n):m.set(e,t)}})}},oe=(e,t)=>{s.set(t,[]),F.observe?.(e,P)};function M(e){let t=c.get(e),{form:n}=t;ie(e,n,t),w(e,t.labels)}var N=(e,t=!1)=>{let n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode(e){return c.has(e)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}}),r=n.nextNode(),i=!t||e.disabled;for(;r;)r.formDisabledCallback&&i&&x(r,e.disabled),r=n.nextNode()},P={attributes:!0,attributeFilter:[`disabled`,`name`]},F=A()?new MutationObserver(e=>{for(let t of e){let e=t.target;if(t.attributeName===`disabled`&&(e.constructor.formAssociated?x(e,e.hasAttribute(`disabled`)):e.localName===`fieldset`&&N(e)),t.attributeName===`name`&&e.constructor.formAssociated){let t=c.get(e),n=p.get(e);t.setFormValue(n)}}}):{};function I(e){e.forEach(e=>{let{addedNodes:t,removedNodes:n}=e,r=Array.from(t),i=Array.from(n);r.forEach(e=>{if(c.has(e)&&e.constructor.formAssociated&&M(e),m.has(e)){let t=m.get(e);Object.keys(j).filter(e=>t[e]!==null).forEach(n=>{b(e,j[n],t[n])}),m.delete(e)}if(y.has(e)){let t=y.get(e);b(e,`internals-valid`,t.validity.valid.toString()),b(e,`internals-invalid`,(!t.validity.valid).toString()),b(e,`aria-invalid`,(!t.validity.valid).toString()),y.delete(e)}if(e.localName===`form`){let t=f.get(e),n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode(e){return c.has(e)&&e.constructor.formAssociated&&!(t&&t.has(e))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}}),r=n.nextNode();for(;r;)M(r),r=n.nextNode()}e.localName===`fieldset`&&(F.observe?.(e,P),N(e,!0))}),i.forEach(e=>{let t=c.get(e);t&&s.get(t)&&S(t),d.has(e)&&d.get(e).disconnect()})})}function se(e){e.forEach(e=>{let{removedNodes:t}=e;t.forEach(t=>{let n=_.get(e.target);c.has(t)&&k(t),n.disconnect()})})}var ce=e=>{let t=new MutationObserver(se);window?.ShadyDOM?.inUse&&e.mode&&e.host&&(e=e.host),t.observe?.(e,{childList:!0}),_.set(e,t)};A()&&new MutationObserver(I);var L={childList:!0,subtree:!0},le=class{constructor(){this.badInput=!1,this.customError=!1,this.patternMismatch=!1,this.rangeOverflow=!1,this.rangeUnderflow=!1,this.stepMismatch=!1,this.tooLong=!1,this.tooShort=!1,this.typeMismatch=!1,this.valid=!0,this.valueMissing=!1,Object.seal(this)}},ue=e=>(e.badInput=!1,e.customError=!1,e.patternMismatch=!1,e.rangeOverflow=!1,e.rangeUnderflow=!1,e.stepMismatch=!1,e.tooLong=!1,e.tooShort=!1,e.typeMismatch=!1,e.valid=!0,e.valueMissing=!1,e),de=(e,t,n)=>(e.valid=fe(t),Object.keys(t).forEach(n=>e[n]=t[n]),n&&T(n),e),fe=e=>{let t=!0;for(let n in e)n!==`valid`&&e[n]!==!1&&(t=!1);return t},R=new WeakMap;function z(e,t){e.toggleAttribute(t,!0),e.part&&e.part.add(t)}var B=class extends Set{static get isPolyfilled(){return!0}constructor(e){if(super(),!e||!e.tagName||e.tagName.indexOf(`-`)===-1)throw TypeError(`Illegal constructor`);R.set(this,e)}add(e){if(!/^--/.test(e)||typeof e!=`string`)throw new DOMException(`Failed to execute 'add' on 'CustomStateSet': The specified value ${e} must start with '--'.`);let t=super.add(e),n=R.get(this),r=`state${e}`;return n.isConnected?z(n,r):setTimeout(()=>{z(n,r)}),t}clear(){for(let[e]of this.entries())this.delete(e);super.clear()}delete(e){let t=super.delete(e),n=R.get(this);return n.isConnected?(n.toggleAttribute(`state${e}`,!1),n.part&&n.part.remove(`state${e}`)):setTimeout(()=>{n.toggleAttribute(`state${e}`,!1),n.part&&n.part.remove(`state${e}`)}),t}},pe=function(e,t,n,r,i){if(r===`m`)throw TypeError(`Private method is not writable`);if(r===`a`&&!i)throw TypeError(`Private accessor was defined without a setter`);if(typeof t==`function`?e!==t||!i:!t.has(e))throw TypeError(`Cannot write private member to an object whose class did not declare it`);return r===`a`?i.call(e,n):i?i.value=n:t.set(e,n),n},V=function(e,t,n,r){if(n===`a`&&!r)throw TypeError(`Private accessor was defined without a getter`);if(typeof t==`function`?e!==t||!r:!t.has(e))throw TypeError(`Cannot read private member from an object whose class did not declare it`);return n===`m`?r:n===`a`?r.call(e):r?r.value:t.get(e)},H,me=class{constructor(e){H.set(this,void 0),pe(this,H,e,`f`);for(let t=0;t<e.length;t++){let n=e[t];this[t]=n,n.hasAttribute(`name`)&&(this[n.getAttribute(`name`)]=n)}Object.freeze(this)}get length(){return V(this,H,`f`).length}[(H=new WeakMap,Symbol.iterator)](){return V(this,H,`f`)[Symbol.iterator]()}item(e){return this[e]==null?null:this[e]}namedItem(e){return this[e]==null?null:this[e]}};function he(){let e=HTMLFormElement.prototype.checkValidity;HTMLFormElement.prototype.checkValidity=n;let t=HTMLFormElement.prototype.reportValidity;HTMLFormElement.prototype.reportValidity=r;function n(...t){let n=e.apply(this,t);return O(this,n,`checkValidity`)}function r(...e){let n=t.apply(this,e);return O(this,n,`reportValidity`)}let{get:i}=Object.getOwnPropertyDescriptor(HTMLFormElement.prototype,`elements`);Object.defineProperty(HTMLFormElement.prototype,"elements",{get(...e){let t=i.call(this,...e),n=Array.from(f.get(this)||[]);return n.length===0?t:new me(Array.from(t).concat(n).sort((e,t)=>e.compareDocumentPosition?e.compareDocumentPosition(t)&2?1:-1:0))}})}var U=class{static get isPolyfilled(){return!0}constructor(e){if(!e||!e.tagName||e.tagName.indexOf(`-`)===-1)throw TypeError(`Illegal constructor`);let t=e.getRootNode(),n=new le;this.states=new B(e),a.set(this,e),o.set(this,n),c.set(e,this),ae(e,this),oe(e,this),Object.seal(this),t instanceof DocumentFragment&&ce(t)}checkValidity(){let e=a.get(this);if(D(e,`Failed to execute 'checkValidity' on 'ElementInternals': The target element is not a form-associated custom element.`),!this.willValidate)return!0;let t=o.get(this);if(!t.valid){let t=new Event(`invalid`,{bubbles:!1,cancelable:!0,composed:!1});e.dispatchEvent(t)}return t.valid}get form(){let e=a.get(this);D(e,`Failed to read the 'form' property from 'ElementInternals': The target element is not a form-associated custom element.`);let t;return e.constructor.formAssociated===!0&&(t=E(e)),t}get labels(){let e=a.get(this);D(e,`Failed to read the 'labels' property from 'ElementInternals': The target element is not a form-associated custom element.`);let t=e.getAttribute(`id`),n=e.getRootNode();return n&&t?n.querySelectorAll(`[for="${t}"]`):[]}reportValidity(){let e=a.get(this);if(D(e,`Failed to execute 'reportValidity' on 'ElementInternals': The target element is not a form-associated custom element.`),!this.willValidate)return!0;let t=this.checkValidity(),n=g.get(this);if(n&&!e.constructor.formAssociated)throw new DOMException(`Failed to execute 'reportValidity' on 'ElementInternals': The target element is not a form-associated custom element.`);return!t&&n&&(e.focus(),n.focus()),t}setFormValue(e){let t=a.get(this);if(D(t,`Failed to execute 'setFormValue' on 'ElementInternals': The target element is not a form-associated custom element.`),S(this),e!=null&&!(e instanceof FormData)){if(t.getAttribute(`name`)){let n=C(t,this);n.value=e}}else e!=null&&e instanceof FormData&&Array.from(e).reverse().forEach(([e,n])=>{if(typeof n==`string`){let r=C(t,this);r.name=e,r.value=n}});p.set(t,e)}setValidity(e,t,n){let r=a.get(this);if(D(r,`Failed to execute 'setValidity' on 'ElementInternals': The target element is not a form-associated custom element.`),!e)throw TypeError(`Failed to execute 'setValidity' on 'ElementInternals': 1 argument required, but only 0 present.`);g.set(this,n);let i=o.get(this),s={};for(let t in e)s[t]=e[t];Object.keys(s).length===0&&ue(i);let c={...i,...s};delete c.valid;let{valid:u}=de(i,c,this.form);if(!u&&!t)throw new DOMException(`Failed to execute 'setValidity' on 'ElementInternals': The second argument should not be empty if one or more flags in the first argument are true.`);l.set(this,u?``:t),r.isConnected?(r.toggleAttribute(`internals-invalid`,!u),r.toggleAttribute(`internals-valid`,u),b(r,`aria-invalid`,`${!u}`)):y.set(r,this)}get shadowRoot(){let e=a.get(this);return h.get(e)||null}get validationMessage(){return D(a.get(this),`Failed to read the 'validationMessage' property from 'ElementInternals': The target element is not a form-associated custom element.`),l.get(this)}get validity(){return D(a.get(this),`Failed to read the 'validity' property from 'ElementInternals': The target element is not a form-associated custom element.`),o.get(this)}get willValidate(){let e=a.get(this);return D(e,`Failed to read the 'willValidate' property from 'ElementInternals': The target element is not a form-associated custom element.`),!(e.matches(`:disabled`)||e.disabled||e.hasAttribute(`disabled`)||e.hasAttribute(`readonly`))}};function ge(){if(typeof window>`u`||!window.ElementInternals||!HTMLElement.prototype.attachInternals)return!1;class e extends HTMLElement{constructor(){super(),this.internals=this.attachInternals()}}let t=`element-internals-feature-detection-${Math.random().toString(36).replace(/[^a-z]+/g,``)}`;customElements.define(t,e);let n=new e;return[`shadowRoot`,`form`,`willValidate`,`validity`,`validationMessage`,`labels`,`setFormValue`,`setValidity`,`checkValidity`,`reportValidity`].every(e=>e in n.internals)}var W=!1,G=!1;function K(e){G||(G=!0,window.CustomStateSet=B,e&&(HTMLElement.prototype.attachInternals=function(...t){let n=e.call(this,t);return n.states=new B(this),n}))}function _e(e=!0){let t=!1;if(!W){if(W=!0,typeof window<`u`&&(window.ElementInternals=U),typeof CustomElementRegistry<`u`){let e=CustomElementRegistry.prototype.define;CustomElementRegistry.prototype.define=function(n,r,i){if(r.formAssociated){let e=r.prototype.connectedCallback;r.prototype.connectedCallback=function(){v.has(this)||(v.set(this,!0),this.hasAttribute(`disabled`)&&x(this,!0)),e?.apply(this),t=k(this)}}e.call(this,n,r,i)}}if(typeof HTMLElement<`u`&&(HTMLElement.prototype.attachInternals=function(){if(!this.tagName)return{};if(this.tagName.indexOf(`-`)===-1)throw Error(`Failed to execute 'attachInternals' on 'HTMLElement': Unable to attach ElementInternals to non-custom elements.`);if(c.has(this)&&!t)throw new DOMException(`DOMException: Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.`);return new U(this)}),typeof Element<`u`){function n(...t){let n=e.apply(this,t);if(h.set(this,n),A()){let e=new MutationObserver(I);window.ShadyDOM?e.observe(this,L):e.observe(n,L),d.set(this,e)}return n}let e=Element.prototype.attachShadow;Element.prototype.attachShadow=n}A()&&typeof document<`u`&&new MutationObserver(I).observe(document.documentElement,L),typeof HTMLFormElement<`u`&&he(),(e||typeof window<`u`&&!window.CustomStateSet)&&K()}}customElements.polyfillWrapFlushCallback||(ge()?typeof window<`u`&&!window.CustomStateSet&&K(HTMLElement.prototype.attachInternals):_e(!1));var q=`on`,J=`--checked`,Y=`,`,X=e=>e===!0||e===``||e===`true`,Z=new WeakMap,ve=0,ye=e=>{let t=Z.get(e);return t||(t=e.id||`form${++ve}`,Z.set(e,t)),t},Q=()=>!!globalThis.ElementInternals?.isPolyfilled,$=class e extends n.t{static get formAssociated(){return!0}get form(){let e=this.getAttribute(`form`);if(e!==null){if(!e)return null;let t=this.getRootNode(),n=typeof t.getElementById==`function`?t.getElementById(e):this.ownerDocument?.getElementById(e);return n instanceof HTMLFormElement?n:null}return this.internals?.form??this.closest(`form`)}get ariaDescribedBy(){return this.ariaDescribedby}set ariaDescribedBy(e){this.ariaDescribedby=e}formDisabledCallback(e){this.formDisabled=e}get isDisabled(){return this.disabled||this.formDisabled}get optionGroup(){return this.groupContext}setGroupValidity(e){this.groupValidityMessage!==e&&(this.groupValidityMessage=e,this.inputRef?.value&&this.manageValidity(this.inputRef.value))}syncGroupName(){let e=this.optionGroup?.name;if(!e)return;let t=!this.name||this.name===this.derivedName;t&&this.name!==e&&(this.name=e),t&&(this.derivedName=e)}effectiveCounter(e){return this.counter??e}effectiveHasFieldset(e){return this.hasFieldset??e}constructor(){super(),this.defaultValue=null,this.disabled=!1,this.readonly=!1,this.required=!1,this.max=null,this.maxlength=null,this.min=null,this.minlength=null,this.step=null,this.ariaDescribedby=null,this.ariaLabelledby=null,this.name=``,this.pattern=null,this.placeholder=null,this.id=i.n(),this.counter=null,this.hasError=!1,this.inline=!1,this.hasFieldset=null,this.optionalTag=!1,this.requiredTag=!1,this.skipForwardTestid=!1,this.useWrapper=!0,this.fullwidth=!1,this.counterMaxLength=0,this.errorMessage=``,this.helptext=``,this.helptextDropdown=``,this.helptextDropdownButton=null,this.label=null,this.tagText=null,this.inputSize=`medium`,this.dataTestid=``,this.formDisabled=!1,this.derivedName=null,this.groupValidityMessage=``,this.touched=!1,this._initialized=!1,this.polyfillFormValue=null,this._didInitDerivedState=!1,this._defaultCheckedState=!1,this.internals=this.attachInternals()}connectedCallback(){super.connectedCallback(),Q()&&queueMicrotask(()=>{this.isConnected&&this.polyfillFormValue&&this.internals.setFormValue(this.polyfillFormValue.value)})}get internalName(){let e=this.form;return e?`${this.name}-internal-${ye(e)}`:`${this.name}-internal`}formAssociatedCallback(){this.requestUpdate()}writeFormValue(e){this.internals.setFormValue(e),Q()&&(this.polyfillFormValue={value:e})}manageValidity(e,n){if(!e){console.warn(`manageValidity called without valid input element`);return}let r=this.pktStrings.get(`validation`);(this.isCheckable?this.checkableValueMissing(n??this.checkableGroup()):this.required&&!this.value)?this.internals.setValidity(this.groupValidityMessage?{valueMissing:!0,customError:!0}:{valueMissing:!0},this.groupValidityMessage||r.valueMissing,e):e.validity?.typeMismatch||e.validity?.badInput?this.internals.setValidity({typeMismatch:!0},r.typeMismatch,e):e.validity?.patternMismatch?this.internals.setValidity({patternMismatch:!0},r.patternMismatch,e):e.validity?.tooShort||this.minlength&&this.minlength>0&&this.valueLength<this.minlength?this.internals.setValidity({tooShort:!0},r.tooShort,e):e.validity?.tooLong||this.maxlength&&this.maxlength>0&&this.valueLength>this.maxlength?this.internals.setValidity({tooLong:!0},r.tooLong,e):e.validity?.rangeUnderflow?this.internals.setValidity({rangeUnderflow:!0},this.min?t.t(r.rangeUnderflowMin,{min:this.min.toString()}):r.rangeUnderflow,e):e.validity?.stepMismatch?this.internals.setValidity({stepMismatch:!0},r.typeMismatch,e):e.validity?.rangeOverflow?this.internals.setValidity({rangeOverflow:!0},this.max?t.t(r.rangeOverflowMax,{max:this.max.toString()}):r.rangeOverflow,e):e.validity?.customError?this.internals.setValidity({customError:!0},e.validationMessage,e):this.groupValidityMessage?this.internals.setValidity({customError:!0},this.groupValidityMessage,e):this.internals.setValidity({})}setFormValue(e){if(this.internals){if(Array.isArray(e)){let t=new FormData;e.forEach(e=>{t.append(this.name,e)}),this.writeFormValue(t)}else this.writeFormValue(e)}}radioGroupMembers(){let e=this.getRootNode();if(typeof e.querySelectorAll!=`function`)return[];let t=this.form;return Array.from(e.querySelectorAll(`pkt-radiobutton, input[type="radio"]`)).filter(e=>e!==this&&e.getAttribute(`name`)===this.name&&e.form===t)}get valueLength(){return!this.multiple||Array.isArray(this.value)?this.value.length:this.value?this.value.split(Y).length:0}get isCheckable(){return this.type===`checkbox`||this.type===`radio`}checkableGroup(){return this.type===`radio`?[this,...this.radioGroupMembers()]:[this]}get isRequired(){return this.required||this.type===`radio`&&!!this.optionGroup?.required}checkableValueMissing(t){return this.type===`radio`?t.some(t=>t instanceof e?t.isRequired:t.required)&&!t.some(e=>X(e.checked)):this.required&&!X(this.checked)}syncCheckedState(){if(!this.internals)return;let e=X(this.checked);this.internals.ariaChecked=String(e),e?(this.writeFormValue((typeof this.value==`string`?this.value:``)||q),this.internals.states?.add(J)):(this.writeFormValue(null),this.internals.states?.delete(J)),this.inputRef?.value&&this.inputRef.value.checked!==e&&(this.inputRef.value.checked=e)}validateCheckable(){let t=this.checkableGroup();t.forEach(n=>{if(!(n instanceof e))return;let r=n;r.inputRef?.value&&r.manageValidity(r.inputRef.value,t)})}coordinateRadioGroup(){this.name&&this.type===`radio`&&this.radioGroupMembers().forEach(t=>{t instanceof e?X(t.checked)&&(t.checked=!1,t.syncCheckedState()):t.checked&&=!1})}valueChecked(e){this.touched&&(this.type===`radio`&&this.coordinateRadioGroup(),typeof e==`string`?this.checked=e===`true`:typeof e==`boolean`&&(this.checked=e),this.syncCheckedState(),this.validateCheckable(),this.onInput(),this.dispatchChangeEvents(this.checked))}valueChanged(e,t){let n=e;if(typeof n==`number`||typeof n==`boolean`)e=String(n);else if(n!=null&&typeof n!=`string`&&!Array.isArray(n)){let e=typeof n==`object`?n?.constructor?.name??`object`:typeof n;console.warn(`${this.localName}: value må være en streng eller et tall, men fikk ${e}. Verdien ignoreres. For dato-/tidsfelt, send en ISO-formatert streng (f.eks. "2026-07-09" eller "13:45").`)}(t!==this.value||t!==this._value)&&(typeof e==`string`?((this.multiple||this.range)&&e.includes(Y)&&(e=e.split(Y)),this.value=e,this._value=Array.isArray(e)?e:[e]):Array.isArray(e)?(this.value=this.multiple||this.range?e:e[0],this._value=e):(this.value=``,this._value=[]),(!this.value||this.value.length===0)&&t&&t.length!==0?this.clearInputValue():this.value&&this.value.toString()!==t?.toString()&&this.onChange(this.value))}dispatchChangeEvents(e){this.dispatchEvent(new Event(`change`,{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`value-change`,{detail:e,bubbles:!0,composed:!0}))}clearInputValue(){let e=this.multiple||this.range?[]:``;this.value=e,this.setFormValue(e),this.dispatchChangeEvents(e)}onFocus(){this.dispatchEvent(new FocusEvent(`focus`,{bubbles:!0,composed:!0}))}onBlur(){this.dispatchEvent(new FocusEvent(`blur`,{bubbles:!0,composed:!0}))}onInput(){this.dispatchEvent(new InputEvent(`input`,{bubbles:!0,composed:!0}))}normalizeValue(e){return(this.range||this.multiple)&&typeof e==`string`&&e.includes(Y)?e.split(Y):!this.multiple&&!this.range&&Array.isArray(e)?e[0]||``:e}validate(){this.inputRef?.value&&this.manageValidity(this.inputRef.value),this.inputRefTo?.value&&this.manageValidity(this.inputRefTo.value)}onChange(e){if(this.touched=!0,typeof e!=`string`&&!Array.isArray(e))return;let t=this.normalizeValue(e);this.setFormValue(t),this.validate(),this._initialized&&this.dispatchChangeEvents(t)}formResetCallback(){if(this.touched=!1,this._options&&this._options.length&&this._options.forEach(e=>{`selected`in e&&(e.selected=!1)}),this.checked!==void 0)this.checked=this._defaultCheckedState,this.syncCheckedState(),this.validateCheckable();else{this.writeFormValue(``);let e=this.defaultValue||(this.multiple||this.range?[]:``);this.value=e,this._value=Array.isArray(e)?e:[e],this.valueChanged(this.value,null)}this.internals.ariaInvalid=`false`}updated(e){super.updated(e),this.isCheckable&&this._initialized&&(e.has(`defaultChecked`)&&e.get(`defaultChecked`)!==void 0&&(this._defaultCheckedState=!!this.defaultChecked),e.has(`groupContext`)&&this.isRequired&&(this.internals.ariaRequired=`true`),[`checked`,`value`,`required`,`name`,`groupContext`].some(t=>e.has(t))&&(this.syncCheckedState(),this.validateCheckable())),e.has(`dataTestid`)&&this.dataTestid&&this.inputRef.value&&(this.skipForwardTestid?this.hasAttribute(`data-testid`)||this.setAttribute(`data-testid`,this.dataTestid):(this.inputRef.value.dataset.testid=this.dataTestid,this.removeAttribute(`data-testid`)))}willUpdate(e){super.willUpdate(e),e.has(`disabled`)&&this.toggleAttribute(`disabled`,this.disabled),this.syncGroupName(),!this._didInitDerivedState&&(this._didInitDerivedState=!0,this.defaultChecked&&(this.checked=!0),this.id&&!this.name&&(this.name=this.id,this.derivedName=this.id),this.value&&this.defaultValue===null&&(this.defaultValue=this.value),this.defaultValue!==null&&!this.value&&this.valueChanged(this.defaultValue,null))}firstUpdated(e){if(super.firstUpdated(e),this.value&&this.defaultValue===null&&(this.defaultValue=this.value),this.defaultValue!==null&&!this.value&&this.valueChanged(this.defaultValue,null),this.defaultChecked&&(this.internals.ariaChecked=`true`),this.isRequired&&(this.internals.ariaRequired=`true`),this.disabled&&(this.internals.ariaDisabled=`true`),this.checked!==void 0){let e=X(this.checked);this._defaultCheckedState=e,this.internals.ariaChecked=String(e);let t=e?(typeof this.value==`string`?this.value:``)||q:null;this.writeFormValue(t)}else this.setFormValue(this.value);this.inputRef&&this.inputRef.value&&(this.inputRef.value.setAttribute(`form`,``),this.isCheckable?this.validateCheckable():this.manageValidity(this.inputRef.value)),this.inputRefTo&&this.inputRefTo.value&&(this.inputRefTo.value.setAttribute(`form`,``),this.manageValidity(this.inputRefTo.value)),this.updateComplete.then(()=>{this._initialized=!0})}};e.n([e.u({type:Boolean,reflect:!0})],$.prototype,`checked`,void 0),e.n([e.u({type:Boolean})],$.prototype,`defaultChecked`,void 0),e.n([e.u({type:Boolean})],$.prototype,`multiple`,void 0),e.n([e.u({type:Boolean})],$.prototype,`range`,void 0),e.n([e.u({type:String,reflect:!0})],$.prototype,`type`,void 0),e.n([e.u()],$.prototype,`defaultValue`,void 0),e.n([e.u({type:Boolean,reflect:!0})],$.prototype,`disabled`,void 0),e.n([e.u({type:Boolean,reflect:!0})],$.prototype,`readonly`,void 0),e.n([e.u({type:Boolean,reflect:!0})],$.prototype,`required`,void 0),e.n([e.u({reflect:!0,converter:{fromAttribute:e=>e,toAttribute:e=>e?.toString()??null}})],$.prototype,`max`,void 0),e.n([e.u({type:Number,reflect:!0})],$.prototype,`maxlength`,void 0),e.n([e.u({reflect:!0,converter:{fromAttribute:e=>e,toAttribute:e=>e?.toString()??null}})],$.prototype,`min`,void 0),e.n([e.u({type:Number,reflect:!0})],$.prototype,`minlength`,void 0),e.n([e.u({type:Number,reflect:!0})],$.prototype,`step`,void 0),e.n([e.u({type:String,attribute:`aria-describedby`})],$.prototype,`ariaDescribedby`,void 0),e.n([e.u({type:String,attribute:`aria-labelledby`})],$.prototype,`ariaLabelledby`,void 0),e.n([e.u({type:String,reflect:!0})],$.prototype,`name`,void 0),e.n([e.u({type:String,reflect:!0})],$.prototype,`pattern`,void 0),e.n([e.u({type:String,reflect:!0})],$.prototype,`placeholder`,void 0),e.n([e.u({type:String,reflect:!0})],$.prototype,`id`,void 0),e.n([e.u({type:Boolean,converter:r.n})],$.prototype,`counter`,void 0),e.n([e.u({type:Boolean})],$.prototype,`hasError`,void 0),e.n([e.u({type:Boolean})],$.prototype,`inline`,void 0),e.n([e.u({type:Boolean,converter:r.n})],$.prototype,`hasFieldset`,void 0),e.n([e.u({type:Boolean})],$.prototype,`optionalTag`,void 0),e.n([e.u({type:Boolean})],$.prototype,`requiredTag`,void 0),e.n([e.u({type:Boolean})],$.prototype,`skipForwardTestid`,void 0),e.n([e.u({type:Boolean,reflect:!0,converter:r.t})],$.prototype,`useWrapper`,void 0),e.n([e.u({type:Boolean,reflect:!0})],$.prototype,`fullwidth`,void 0),e.n([e.u({type:Number})],$.prototype,`counterMaxLength`,void 0),e.n([e.u({type:String})],$.prototype,`errorMessage`,void 0),e.n([e.u({type:String})],$.prototype,`helptext`,void 0),e.n([e.u({type:String})],$.prototype,`helptextDropdown`,void 0),e.n([e.u({type:String,reflect:!1})],$.prototype,`helptextDropdownButton`,void 0),e.n([e.u({type:String})],$.prototype,`label`,void 0),e.n([e.u({type:String,reflect:!1})],$.prototype,`optionalText`,void 0),e.n([e.u({type:String,reflect:!1})],$.prototype,`requiredText`,void 0),e.n([e.u({type:String,reflect:!1})],$.prototype,`tagText`,void 0),e.n([e.u({type:String,attribute:`input-size`})],$.prototype,`inputSize`,void 0),e.n([e.u({type:String,attribute:`data-testid`})],$.prototype,`dataTestid`,void 0),e.n([e.l()],$.prototype,`formDisabled`,void 0),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return $}});
@@ -1,23 +0,0 @@
1
- const e=require("./element-C6WTyJFE.cjs"),t=require("./element-with-slot-B0Vp_OuR.cjs"),n=require("./booleanish-BF8l4scU.cjs");require("./input-wrapper-Bekd6DGA.cjs");const r=require("./utils-63cRpWut.cjs");var i={layout:`vertical`,inputSize:`medium`,hasTile:!1,required:!1,disabled:!1,hasError:!1,useWrapper:!0,requiredTag:!1,optionalTag:!1},a=[`change`,`input`,`value-change`,`focus`,`blur`];function o(e){return e.checked===void 0?e.hasAttribute(`checked`):e.checked===!0||e.checked===``||e.checked===`true`}function s(e){return(typeof e.value==`string`?e.value:e.getAttribute(`value`))||`on`}function c(e){return e.hasAttribute(`disabled`)||e.matches(`:disabled`)}var l=class extends t.t{get groupName(){return this.name||this.id||this.generatedId}options(){return Array.from(this.querySelectorAll(this.optionSelector))}createGroupContext(){return{name:this.groupName,hasTile:this.hasTile,hasError:this.hasError}}syncValidity(){}constructor(){super(),this.name=``,this.label=``,this.helptext=``,this.helptextDropdown=``,this.helptextDropdownButton=null,this.hasError=i.hasError,this.errorMessage=``,this.disabled=i.disabled,this.required=i.required,this.hasTile=i.hasTile,this.layout=i.layout,this.inputSize=i.inputSize,this.useWrapper=i.useWrapper,this.optionalTag=i.optionalTag,this.requiredTag=i.requiredTag,this.tagText=null,this.generatedId=r.n(),this.knownOptions=new Set,this.resetForm=null,this.handleFormReset=()=>{setTimeout(()=>{this.hasStoredValue&&this.storeCurrentValue(),this.syncValidity()})},this.relayOptionEvent=e=>{let t=e.target;if(!t||t===this||!t.matches(this.optionSelector))return;e.stopImmediatePropagation();let n={bubbles:!0,composed:!0};e.type===`change`?(this.storeCurrentValue(),this.syncValidity(),this.dispatchEvent(new Event(`change`,n))):e.type===`input`?this.dispatchEvent(new InputEvent(`input`,n)):e.type===`value-change`&&this.dispatchEvent(new CustomEvent(`value-change`,{...n,detail:this.value}))},this.handleFocusIn=e=>{this.contains(e.relatedTarget)||this.dispatchEvent(new FocusEvent(`focus`,{bubbles:!0,composed:!0,relatedTarget:e.relatedTarget}))},this.handleFocusOut=e=>{this.contains(e.relatedTarget)||this.dispatchEvent(new FocusEvent(`blur`,{bubbles:!0,composed:!0,relatedTarget:e.relatedTarget}))};for(let e of a)this.addEventListener(e,this.relayOptionEvent);this.addEventListener(`focusin`,this.handleFocusIn),this.addEventListener(`focusout`,this.handleFocusOut)}disconnectedCallback(){super.disconnectedCallback(),this.watchFormReset(null)}focus(e){let t=this.options();(t.find(e=>o(e)&&!c(e))??t.find(e=>!c(e)))?.querySelector(`input`)?.focus(e)}willUpdate(e){super.willUpdate(e);let t=this.createGroupContext(),n=this.groupContext;(!n||Object.keys(t).some(e=>t[e]!==n[e]))&&(this.groupContext=t)}updated(e){super.updated(e);let t=this.options(),n=t.filter(e=>!this.knownOptions.has(e));this.knownOptions=new Set(t),this.hasStoredValue&&n.length&&this.applyStoredValue(n),this.syncValidity(),this.watchFormReset(t[0]?.form??null)}watchFormReset(e){e!==this.resetForm&&(this.resetForm?.removeEventListener(`reset`,this.handleFormReset),this.resetForm=e,this.resetForm?.addEventListener(`reset`,this.handleFormReset))}render(){return e._`
2
- <pkt-input-wrapper
3
- ${t.n(this,[null,`helptext`])}
4
- .strings=${this.strings}
5
- label=${this.label}
6
- hasFieldset
7
- ?disabled=${this.disabled}
8
- ?hasError=${this.hasError}
9
- ?optionalTag=${this.optionalTag}
10
- ?requiredTag=${this.requiredTag}
11
- useWrapper=${this.useWrapper}
12
- .errorMessage=${this.errorMessage}
13
- .forId=${this.id||this.generatedId}
14
- .helptext=${this.helptext}
15
- .helptextDropdown=${this.helptextDropdown}
16
- .helptextDropdownButton=${this.helptextDropdownButton}
17
- .layout=${this.layout}
18
- .optionalText=${this.optionalText}
19
- .requiredText=${this.requiredText}
20
- .tagText=${this.tagText}
21
- .size=${this.inputSize}
22
- ></pkt-input-wrapper>
23
- `}};e.n([e.u({type:String})],l.prototype,`name`,void 0),e.n([e.u({type:String})],l.prototype,`label`,void 0),e.n([e.u({type:String})],l.prototype,`helptext`,void 0),e.n([e.u({type:String})],l.prototype,`helptextDropdown`,void 0),e.n([e.u({type:String})],l.prototype,`helptextDropdownButton`,void 0),e.n([e.u({type:Boolean})],l.prototype,`hasError`,void 0),e.n([e.u({type:String})],l.prototype,`errorMessage`,void 0),e.n([e.u({type:Boolean})],l.prototype,`disabled`,void 0),e.n([e.u({type:Boolean})],l.prototype,`required`,void 0),e.n([e.u({type:Boolean})],l.prototype,`hasTile`,void 0),e.n([e.u({type:String})],l.prototype,`layout`,void 0),e.n([e.u({type:String,attribute:`input-size`})],l.prototype,`inputSize`,void 0),e.n([e.u({type:Boolean,converter:n.t})],l.prototype,`useWrapper`,void 0),e.n([e.u({type:Boolean})],l.prototype,`optionalTag`,void 0),e.n([e.u({type:String})],l.prototype,`optionalText`,void 0),e.n([e.u({type:Boolean})],l.prototype,`requiredTag`,void 0),e.n([e.u({type:String})],l.prototype,`requiredText`,void 0),e.n([e.u({type:String})],l.prototype,`tagText`,void 0),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return l}});