@oslokommune/punkt-elements 19.8.0 → 19.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (224) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/dist/accordion-CMCCpxtz.cjs +47 -0
  3. package/dist/{accordion-BJh6X1Ek.js → accordion-Cp2o6wTY.js} +10 -9
  4. package/dist/{alert-WME3geaX.js → alert-CAPiwi4F.js} +5 -5
  5. package/dist/{alert-CKqtC9AM.cjs → alert-QfloIr-o.cjs} +1 -1
  6. package/dist/{async-directive-BGoo_npW.cjs → async-directive-DpyKp6qv.cjs} +1 -1
  7. package/dist/{async-directive-DsdqP_X7.js → async-directive-yh8hG41Q.js} +2 -2
  8. package/dist/{backlink-BRqhwUr2.cjs → backlink-CsFeerTH.cjs} +1 -1
  9. package/dist/{backlink-BslFewn-.js → backlink-ogvv493Y.js} +3 -3
  10. package/dist/base-elements/input-element.d.ts +17 -0
  11. package/dist/base-elements/option-group-element.d.ts +61 -0
  12. package/dist/base-elements/polyfill-form-value.test.d.ts +0 -0
  13. package/dist/{breadcrumbs-Cr3GugPv.js → breadcrumbs-53QVnTFP.js} +2 -2
  14. package/dist/{breadcrumbs-DG4i5UCh.cjs → breadcrumbs-D03id_ha.cjs} +1 -1
  15. package/dist/{button-B78im4wB.js → button-CeRr7oIn.js} +5 -5
  16. package/dist/{button-BNVTj7nB.cjs → button-Dh97H-58.cjs} +1 -1
  17. package/dist/{calendar-TcxvS-1_.cjs → calendar-C5QwPrbk.cjs} +1 -1
  18. package/dist/{calendar-BLaRXUBl.js → calendar-D9w8M99G.js} +3 -3
  19. package/dist/{card-CaLEuumN.cjs → card--NuWdTbG.cjs} +1 -1
  20. package/dist/{card-CYKhPUNI.js → card-_PlgXmgZ.js} +6 -6
  21. package/dist/{checkbox-Tq8ESzwH.js → checkbox-G8k3vg85.js} +39 -35
  22. package/dist/checkbox-QIcdn09A.cjs +40 -0
  23. package/dist/checkbox-group-DoueGGi5.js +50 -0
  24. package/dist/checkbox-group-nLazAkcg.cjs +1 -0
  25. package/dist/checkbox-group.d.ts +1 -0
  26. package/dist/{class-map-C4hdfSfY.js → class-map-Bf-QzUpN.js} +1 -1
  27. package/dist/{class-map-Drv0_anQ.cjs → class-map-Bh6toDeV.cjs} +1 -1
  28. package/dist/{combobox-89Ohd1Oe.cjs → combobox-ClXhKwR9.cjs} +1 -1
  29. package/dist/{combobox-Cpb67TV0.js → combobox-Cz_rq7Mm.js} +13 -13
  30. package/dist/components/checkbox/checkbox.d.ts +1 -0
  31. package/dist/components/checkbox-group/checkbox-group-context.d.ts +5 -0
  32. package/dist/components/checkbox-group/checkbox-group.d.ts +15 -0
  33. package/dist/components/checkbox-group/checkbox-group.test.d.ts +0 -0
  34. package/dist/components/checkbox-group/index.d.ts +3 -0
  35. package/dist/components/index.d.ts +2 -0
  36. package/dist/components/radio-group/index.d.ts +3 -0
  37. package/dist/components/radio-group/radio-group-context.d.ts +7 -0
  38. package/dist/components/radio-group/radio-group.d.ts +14 -0
  39. package/dist/components/radio-group/radio-group.test.d.ts +0 -0
  40. package/dist/components/radiobutton/radiobutton.d.ts +1 -0
  41. package/dist/{consent-CleJMbVH.js → consent-CZMxUavj.js} +2 -2
  42. package/dist/{consent-Dl-R0iC3.cjs → consent-DimzcQxt.cjs} +1 -1
  43. package/dist/consume-Bp12si68.js +61 -0
  44. package/dist/consume-kEjgTrAp.cjs +1 -0
  45. package/dist/{datepicker-DBEKa1aJ.js → datepicker-C7ABsx7H.js} +12 -12
  46. package/dist/{datepicker-B9NCJX4o.cjs → datepicker-usIF9WY7.cjs} +2 -2
  47. package/dist/{directive-helpers-BRrz3Bcj.cjs → directive-helpers-Bv70GjQh.cjs} +1 -1
  48. package/dist/{directive-helpers-D96YEsht.js → directive-helpers-CwxFepWh.js} +1 -1
  49. package/dist/directives/slot-content.d.ts +4 -3
  50. package/dist/docs/components/checkbox-group.d.ts +13 -0
  51. package/dist/docs/components/radio-group.d.ts +13 -0
  52. package/dist/{element-BOmr9YLv.cjs → element-C6WTyJFE.cjs} +1 -1
  53. package/dist/{element-mwwC2Rra.js → element-DBugHPKM.js} +1 -0
  54. package/dist/{element-with-slot-DQv0cbbD.js → element-with-slot-DDLS-aLw.js} +6 -3
  55. package/dist/element-with-slot-DhiAuSjM.cjs +1 -0
  56. package/dist/{fileupload-2YAbjYuU.cjs → fileupload-2uTFjd81.cjs} +1 -1
  57. package/dist/{fileupload-DqWCXMPz.js → fileupload-BR9H6fET.js} +8 -8
  58. package/dist/{footer-DdLls3F-.js → footer-B3DMvo8-.js} +4 -4
  59. package/dist/{footer-vy9NqT65.cjs → footer-CyxRYvT-.cjs} +1 -1
  60. package/dist/{header-Dp0Lq7wS.js → header-BKeSkfB7.js} +11 -11
  61. package/dist/{header-9Y6Q6Cfq.cjs → header-Drj3lTrv.cjs} +1 -1
  62. package/dist/{header-menu-BfkCp8jw.cjs → header-menu-B_5hCNUl.cjs} +1 -1
  63. package/dist/{header-menu-ANj5nL2M.js → header-menu-buYE90FU.js} +4 -4
  64. package/dist/{heading-zoz-QZJ9.cjs → heading-DUYOvlxs.cjs} +1 -1
  65. package/dist/{heading-CUrZvkrM.js → heading-WBB5MO9i.js} +2 -2
  66. package/dist/{helptext-BCkwSz1m.cjs → helptext-C7cyihnu.cjs} +1 -1
  67. package/dist/{helptext-DCT_9dw1.js → helptext-DadLkcoO.js} +4 -4
  68. package/dist/{icon-JigbxxF7.js → icon-Bao96Zb8.js} +1 -1
  69. package/dist/{icon-Dnv6LtPC.cjs → icon-jPhyZD1z.cjs} +1 -1
  70. package/dist/if-defined-CiML3MTM.cjs +1 -0
  71. package/dist/{if-defined-Bebu3LXY.js → if-defined-O59_I-e-.js} +1 -1
  72. package/dist/{input-element-lLzfwdim.js → input-element-BBygBEei.js} +54 -17
  73. package/dist/input-element-C4SelHLD.cjs +1 -0
  74. package/dist/{input-wrapper-CTMf4kCK.cjs → input-wrapper-BT6B3Kco.cjs} +6 -2
  75. package/dist/{input-wrapper-C9K-_7g-.js → input-wrapper-DrSCuw6U.js} +12 -8
  76. package/dist/{link-LO_5_La8.cjs → link-CEP7w1et.cjs} +1 -1
  77. package/dist/{link-CmZwAw5u.js → link-CVnIn74-.js} +4 -4
  78. package/dist/{linkcard-UKsxADrP.cjs → linkcard-D8vitdrQ.cjs} +1 -1
  79. package/dist/{linkcard-CQluSyJJ.js → linkcard-IWiVvRKy.js} +4 -4
  80. package/dist/{listbox-Ct9jIV_5.js → listbox-BDesthOp.js} +4 -4
  81. package/dist/{listbox-g-vHHLkD.cjs → listbox-CvduK_YU.cjs} +1 -1
  82. package/dist/{loader-C_PH05aw.cjs → loader-B0hFoBtF.cjs} +1 -1
  83. package/dist/{loader-DzctJ9jW.js → loader-CAsUPHjl.js} +4 -4
  84. package/dist/{messagebox-D17GYxb9.js → messagebox-6_iNN5F3.js} +4 -4
  85. package/dist/{messagebox-X01V2l_N.cjs → messagebox-C19L2Duq.cjs} +1 -1
  86. package/dist/{modal-BymjMIJi.cjs → modal-CoEPzt4p.cjs} +1 -1
  87. package/dist/{modal-CELmA0-8.js → modal-D7MolBXb.js} +5 -5
  88. package/dist/option-group-element-BIuotbRu.js +135 -0
  89. package/dist/option-group-element-BYS7s-is.cjs +23 -0
  90. package/dist/pkt-accordion.cjs +1 -1
  91. package/dist/pkt-accordion.js +1 -1
  92. package/dist/pkt-alert.cjs +1 -1
  93. package/dist/pkt-alert.js +1 -1
  94. package/dist/pkt-backlink.cjs +1 -1
  95. package/dist/pkt-backlink.js +1 -1
  96. package/dist/pkt-breadcrumbs.cjs +1 -1
  97. package/dist/pkt-breadcrumbs.js +1 -1
  98. package/dist/pkt-button.cjs +1 -1
  99. package/dist/pkt-button.js +1 -1
  100. package/dist/pkt-calendar.cjs +1 -1
  101. package/dist/pkt-calendar.js +1 -1
  102. package/dist/pkt-card.cjs +1 -1
  103. package/dist/pkt-card.js +1 -1
  104. package/dist/pkt-checkbox-group.cjs +1 -0
  105. package/dist/pkt-checkbox-group.js +2 -0
  106. package/dist/pkt-checkbox.cjs +1 -1
  107. package/dist/pkt-checkbox.js +1 -1
  108. package/dist/pkt-combobox.cjs +1 -1
  109. package/dist/pkt-combobox.js +1 -1
  110. package/dist/pkt-consent.cjs +1 -1
  111. package/dist/pkt-consent.js +1 -1
  112. package/dist/pkt-datepicker.cjs +1 -1
  113. package/dist/pkt-datepicker.js +1 -1
  114. package/dist/pkt-fileupload.cjs +1 -1
  115. package/dist/pkt-fileupload.js +1 -1
  116. package/dist/pkt-footer.cjs +1 -1
  117. package/dist/pkt-footer.js +1 -1
  118. package/dist/pkt-header-menu.cjs +1 -1
  119. package/dist/pkt-header-menu.js +1 -1
  120. package/dist/pkt-header.cjs +1 -1
  121. package/dist/pkt-header.js +1 -1
  122. package/dist/pkt-heading.cjs +1 -1
  123. package/dist/pkt-heading.js +1 -1
  124. package/dist/pkt-helptext.cjs +1 -1
  125. package/dist/pkt-helptext.js +1 -1
  126. package/dist/pkt-icon.cjs +1 -1
  127. package/dist/pkt-icon.js +1 -1
  128. package/dist/pkt-index.cjs +1 -1
  129. package/dist/pkt-index.js +37 -35
  130. package/dist/pkt-input-wrapper.cjs +1 -1
  131. package/dist/pkt-input-wrapper.js +1 -1
  132. package/dist/pkt-link.cjs +1 -1
  133. package/dist/pkt-link.js +1 -1
  134. package/dist/pkt-linkcard.cjs +1 -1
  135. package/dist/pkt-linkcard.js +1 -1
  136. package/dist/pkt-listbox.cjs +1 -1
  137. package/dist/pkt-listbox.js +1 -1
  138. package/dist/pkt-loader.cjs +1 -1
  139. package/dist/pkt-loader.js +1 -1
  140. package/dist/pkt-messagebox.cjs +1 -1
  141. package/dist/pkt-messagebox.js +1 -1
  142. package/dist/pkt-modal.cjs +1 -1
  143. package/dist/pkt-modal.js +1 -1
  144. package/dist/{pkt-options-controller-CpEZcomb.cjs → pkt-options-controller-B3vVKnAG.cjs} +1 -1
  145. package/dist/{pkt-options-controller-D7l18Iw0.js → pkt-options-controller-ClFrUWZK.js} +1 -1
  146. package/dist/pkt-progressbar.cjs +1 -1
  147. package/dist/pkt-progressbar.js +1 -1
  148. package/dist/pkt-radio-group.cjs +1 -0
  149. package/dist/pkt-radio-group.js +2 -0
  150. package/dist/pkt-radiobutton.cjs +1 -1
  151. package/dist/pkt-radiobutton.js +1 -1
  152. package/dist/pkt-searchinput.cjs +1 -1
  153. package/dist/pkt-searchinput.js +1 -1
  154. package/dist/pkt-select.cjs +1 -1
  155. package/dist/pkt-select.js +1 -1
  156. package/dist/pkt-tabs.cjs +1 -1
  157. package/dist/pkt-tabs.js +1 -1
  158. package/dist/pkt-tag.cjs +1 -1
  159. package/dist/pkt-tag.js +1 -1
  160. package/dist/pkt-textarea.cjs +1 -1
  161. package/dist/pkt-textarea.js +1 -1
  162. package/dist/pkt-textinput.cjs +1 -1
  163. package/dist/pkt-textinput.js +1 -1
  164. package/dist/pkt-timepicker.cjs +1 -1
  165. package/dist/pkt-timepicker.js +1 -1
  166. package/dist/{progressbar-CIXNSwTy.cjs → progressbar-CnX4fFfR.cjs} +1 -1
  167. package/dist/{progressbar-DH5lIBpx.js → progressbar-DZHiq7B0.js} +5 -5
  168. package/dist/provide-Cz18sYug.cjs +1 -0
  169. package/dist/provide-_MnlMGnw.js +111 -0
  170. package/dist/radio-group-kOzlGn8T.cjs +1 -0
  171. package/dist/radio-group-lhymYEZX.js +52 -0
  172. package/dist/radio-group.d.ts +1 -0
  173. package/dist/radiobutton-BgHCcDJv.cjs +38 -0
  174. package/dist/{radiobutton-l_3oGDbb.js → radiobutton-CFd8TgV9.js} +39 -35
  175. package/dist/{ref-Emu5PNxk.cjs → ref-CB7e9nMY.cjs} +1 -1
  176. package/dist/{ref-CCSGk4MP.js → ref-y_5qv9vU.js} +2 -2
  177. package/dist/{repeat-CdxGS-_3.js → repeat-CV9S4zya.js} +2 -2
  178. package/dist/{repeat-Dh9YKoeV.cjs → repeat-CnnigVcj.cjs} +1 -1
  179. package/dist/{searchinput-Co8tcq-l.js → searchinput-Bkcr3Fby.js} +4 -4
  180. package/dist/{searchinput-CbClDE-d.cjs → searchinput-Mdc9Ihld.cjs} +1 -1
  181. package/dist/{select-Cz80KV3g.js → select-B6CN2Ymq.js} +7 -7
  182. package/dist/{select-CZk57p1_.cjs → select-BowvpCNa.cjs} +1 -1
  183. package/dist/shared-strings/nb.d.ts +1 -0
  184. package/dist/shared-types/index.d.ts +4 -2
  185. package/dist/shared-types/option-group.d.ts +50 -0
  186. package/dist/{tabs-B8blHQrL.js → tabs-DZvtVA0y.js} +9 -8
  187. package/dist/tabs-Dm8xcPRs.cjs +40 -0
  188. package/dist/{tag-Bns7Xj1O.js → tag-C33BPIOm.js} +5 -5
  189. package/dist/{tag-B5dUg7AD.cjs → tag-DyVZrqOQ.cjs} +1 -1
  190. package/dist/tests/component-registry.d.ts +4 -0
  191. package/dist/tests/option-contexts.d.ts +7 -0
  192. package/dist/{textarea-Dwjx-Crl.cjs → textarea-DoH3Il8v.cjs} +1 -1
  193. package/dist/{textarea-Dfvx1I60.js → textarea-hW0kV5gj.js} +9 -9
  194. package/dist/{textinput-7zTPlXVj.js → textinput-B6G4dVuL.js} +8 -8
  195. package/dist/{textinput-BeraGRzb.cjs → textinput-CQknclmV.cjs} +1 -1
  196. package/dist/{timepicker-C0dSH4Ij.js → timepicker-Cd2QI6ua.js} +8 -8
  197. package/dist/{timepicker-DarB9eA6.cjs → timepicker-DB3gor6g.cjs} +1 -1
  198. package/package.json +2 -2
  199. package/src/components/checkbox/checkbox.test.ts +99 -0
  200. package/src/components/checkbox/checkbox.ts +14 -5
  201. package/src/components/checkbox-group/checkbox-group-context.ts +8 -0
  202. package/src/components/checkbox-group/checkbox-group.test.ts +406 -0
  203. package/src/components/checkbox-group/checkbox-group.ts +69 -0
  204. package/src/components/checkbox-group/index.ts +4 -0
  205. package/src/components/combobox/combobox.ts +1 -1
  206. package/src/components/datepicker/datepicker.ts +1 -1
  207. package/src/components/index.ts +2 -0
  208. package/src/components/input-wrapper/input-wrapper.ts +5 -1
  209. package/src/components/input-wrapper/wrapper-parity.test.ts +27 -2
  210. package/src/components/radio-group/index.ts +4 -0
  211. package/src/components/radio-group/radio-group-context.ts +8 -0
  212. package/src/components/radio-group/radio-group.test.ts +530 -0
  213. package/src/components/radio-group/radio-group.ts +65 -0
  214. package/src/components/radiobutton/radiobutton.test.ts +95 -0
  215. package/src/components/radiobutton/radiobutton.ts +11 -5
  216. package/dist/accordion-5lSFQToJ.cjs +0 -47
  217. package/dist/checkbox-D69leWDh.cjs +0 -40
  218. package/dist/consume-BDnMAp2g.js +0 -167
  219. package/dist/consume-Le4HztPo.cjs +0 -1
  220. package/dist/element-with-slot-D7sTqOr3.cjs +0 -1
  221. package/dist/if-defined-2mkIDgOm.cjs +0 -1
  222. package/dist/input-element-CSfDGslx.cjs +0 -1
  223. package/dist/radiobutton-BPr22VmL.cjs +0 -38
  224. package/dist/tabs-CjX-GWvM.cjs +0 -40
@@ -4,6 +4,7 @@ import { fireEvent } from '@testing-library/dom'
4
4
  import { vi } from 'vitest'
5
5
  import { createElementTest, BaseTestConfig } from '../../tests/test-framework'
6
6
  import { CustomElementFor } from '../../tests/component-registry'
7
+ import { mountOption, radioContexts } from '../../tests/option-contexts'
7
8
  import './radiobutton'
8
9
 
9
10
  export interface RadioButtonTestConfig extends BaseTestConfig {
@@ -297,3 +298,97 @@ describe('pkt-radiobutton inputSize', () => {
297
298
  expect(await root('input-size="medium"')).toHaveClass('pkt-input-check--medium')
298
299
  })
299
300
  })
301
+
302
+ describe.each(radioContexts)('pkt-radiobutton $name', ({ wrap }) => {
303
+ type TRadio = HTMLElement & {
304
+ checked: boolean | string | null
305
+ updateComplete: Promise<unknown>
306
+ internals: { validity: ValidityState }
307
+ }
308
+ const host = () => document.getElementById('valg') as TRadio
309
+ const input = () => host().querySelector('input') as HTMLInputElement
310
+
311
+ afterEach(() => {
312
+ document.body.innerHTML = ''
313
+ })
314
+
315
+ test('renders the input with its label and value', async () => {
316
+ await mountOption(wrap('<pkt-radiobutton id="valg" value="a" label="Valg"></pkt-radiobutton>'))
317
+
318
+ expect(input()).toHaveAttribute('type', 'radio')
319
+ expect(host()).toHaveAttribute('value', 'a')
320
+ expect(host().querySelector('label')).toHaveTextContent('Valg')
321
+ })
322
+
323
+ test('is checked when checked is set', async () => {
324
+ await mountOption(
325
+ wrap('<pkt-radiobutton id="valg" value="a" label="Valg" checked></pkt-radiobutton>'),
326
+ )
327
+
328
+ expect(input().checked).toBe(true)
329
+ })
330
+
331
+ test('starts checked with defaultChecked', async () => {
332
+ await mountOption(
333
+ wrap('<pkt-radiobutton id="valg" value="a" label="Valg" defaultChecked></pkt-radiobutton>'),
334
+ )
335
+
336
+ expect(input().checked).toBe(true)
337
+ })
338
+
339
+ test('fires change when the user selects it', async () => {
340
+ await mountOption(wrap('<pkt-radiobutton id="valg" value="a" label="Valg"></pkt-radiobutton>'))
341
+ const changed = vi.fn()
342
+ host().addEventListener('change', changed)
343
+
344
+ fireEvent.click(input())
345
+ await host().updateComplete
346
+
347
+ expect(changed).toHaveBeenCalledTimes(1)
348
+ expect(host().checked).toBe(true)
349
+ })
350
+
351
+ test('keeps its own name', async () => {
352
+ await mountOption(
353
+ wrap('<pkt-radiobutton id="valg" name="eget" value="a" label="Valg"></pkt-radiobutton>'),
354
+ )
355
+
356
+ expect(host()).toHaveAttribute('name', 'eget')
357
+ })
358
+
359
+ test('adds the tile, error and size classes', async () => {
360
+ await mountOption(
361
+ wrap(
362
+ '<pkt-radiobutton id="valg" value="a" label="Valg" hasTile hasError input-size="small"></pkt-radiobutton>',
363
+ ),
364
+ )
365
+
366
+ expect(host().querySelector('.pkt-input-check')).toHaveClass('pkt-input-check--small')
367
+ expect(host().querySelector('.pkt-input-check__input')).toHaveClass(
368
+ 'pkt-input-check__input--tile',
369
+ )
370
+ expect(input()).toHaveClass('pkt-input-check__input-checkbox--error')
371
+ })
372
+
373
+ test('is invalid until checked when required is set', async () => {
374
+ await mountOption(
375
+ wrap('<pkt-radiobutton id="valg" value="a" label="Valg" required></pkt-radiobutton>'),
376
+ )
377
+
378
+ expect(host().internals.validity.valueMissing).toBe(true)
379
+ })
380
+
381
+ test('is disabled when disabled is set', async () => {
382
+ await mountOption(
383
+ wrap('<pkt-radiobutton id="valg" value="a" label="Valg" disabled></pkt-radiobutton>'),
384
+ )
385
+
386
+ expect(input()).toBeDisabled()
387
+ })
388
+
389
+ test('has no axe violations', async () => {
390
+ await mountOption(wrap('<pkt-radiobutton id="valg" value="a" label="Valg"></pkt-radiobutton>'))
391
+
392
+ expect(await axe(document.body.firstElementChild as Element)).toHaveNoViolations()
393
+ })
394
+ })
@@ -1,6 +1,8 @@
1
+ import { consume } from '@lit/context'
1
2
  import { customElement, property, state } from 'lit/decorators.js'
2
3
 
3
4
  import { PktInputElement } from '@/base-elements/input-element'
5
+ import { radioGroupContext, type RadioGroupContext } from '@/components/radio-group/radio-group-context'
4
6
  import { Ref, createRef, ref } from 'lit/directives/ref.js'
5
7
  import { html, nothing } from 'lit'
6
8
  import { classMap } from 'lit/directives/class-map.js'
@@ -39,6 +41,10 @@ export class PktRadioButton extends PktInputElement<Props> {
39
41
 
40
42
  @state() _checked: boolean = false
41
43
 
44
+ @consume({ context: radioGroupContext, subscribe: true })
45
+ @state()
46
+ private groupContext?: RadioGroupContext
47
+
42
48
  connectedCallback() {
43
49
  super.connectedCallback()
44
50
  }
@@ -51,15 +57,16 @@ export class PktRadioButton extends PktInputElement<Props> {
51
57
  }
52
58
 
53
59
  render() {
60
+ const hasTile = this.hasTile || !!this.groupContext?.hasTile
54
61
  const inputTileClasses = classMap({
55
62
  'pkt-input-check__input': true,
56
- 'pkt-input-check__input--tile': this.hasTile,
57
- 'pkt-input-check__input--tile-disabled': this.isDisabled && this.hasTile,
63
+ 'pkt-input-check__input--tile': hasTile,
64
+ 'pkt-input-check__input--tile-disabled': this.isDisabled && hasTile,
58
65
  })
59
66
 
60
67
  const inputCheckBoxClasses = classMap({
61
68
  'pkt-input-check__input-checkbox': true,
62
- 'pkt-input-check__input-checkbox--error': this.hasError,
69
+ 'pkt-input-check__input-checkbox--error': this.hasError || !!this.groupContext?.hasError,
63
70
  })
64
71
 
65
72
  const labelClasses = classMap({
@@ -123,7 +130,7 @@ export class PktRadioButton extends PktInputElement<Props> {
123
130
  type="radio"
124
131
  ?disabled=${this.isDisabled}
125
132
  form=""
126
- name=${this.name + '-internal'}
133
+ name=${this.internalName}
127
134
  ${ref(this.inputRef)}
128
135
  @change=${this.toggleChecked}
129
136
  @input=${this.handleInput}
@@ -141,7 +148,6 @@ export class PktRadioButton extends PktInputElement<Props> {
141
148
 
142
149
  private handleInput(e: Event) {
143
150
  e.stopImmediatePropagation()
144
- this.onInput()
145
151
  }
146
152
 
147
153
  private toggleChecked(e: Event | null = null) {
@@ -1,47 +0,0 @@
1
- const e=require("./element-BOmr9YLv.cjs"),t=require("./class-map-Drv0_anQ.cjs"),n=require("./element-with-slot-D7sTqOr3.cjs"),r=require("./if-defined-2mkIDgOm.cjs"),i=require("./consume-Le4HztPo.cjs"),a=require("./ref-Emu5PNxk.cjs");var o=i.r(Symbol(`pkt-accordion-context`)),s=class extends e.c{constructor(...e){super(...e),this.ariaLabelledBy=``,this.compact=!1,this.skin=`borderless`,this.name=``,this.context={skin:this.skin}}willUpdate(e){e.has(`skin`)&&(this.context={...this.context,skin:this.skin})}updated(e){e.has(`name`)&&this.updateAccordionItemNames()}updateAccordionItemNames(){if(this.name){let e=this.renderRoot?.querySelector(`slot`);e&&e.assignedElements().forEach(e=>{e.tagName.toLowerCase()===`pkt-accordion-item`&&(e.hasAttribute(`name`)||e.setAttribute(`name`,this.name))})}}firstUpdated(){let e=this.renderRoot?.querySelector(`slot`);e&&e.addEventListener(`slotchange`,()=>{this.updateAccordionItemNames()})}render(){let n={"pkt-accordion":!0,"pkt-accordion--compact":this.compact,[`pkt-accordion--${this.skin}`]:this.skin};return e._`
2
- <div
3
- part="container"
4
- class=${t.t(n)}
5
- data-testid="pkt-accordion"
6
- aria-labelledby=${r.t(this.ariaLabelledBy||void 0)}
7
- >
8
- <slot></slot>
9
- </div>
10
- `}};e.n([e.u({type:String,reflect:!0,attribute:`aria-labelledby`})],s.prototype,`ariaLabelledBy`,void 0),e.n([e.u({type:Boolean,reflect:!0,attribute:`compact`})],s.prototype,`compact`,void 0),e.n([e.u({type:String,reflect:!0,attribute:`skin`})],s.prototype,`skin`,void 0),e.n([e.u({type:String,reflect:!0,attribute:`name`})],s.prototype,`name`,void 0),e.n([i.n({context:o}),e.l()],s.prototype,`context`,void 0);try{e.d(`pkt-accordion`)(s)}catch{console.warn(`Forsøker å definere <pkt-accordion>, men den er allerede definert`)}var c=class extends n.t{constructor(){super(),this.defaultOpen=!1,this.title=``,this.skin=void 0,this.compact=!1,this.isOpen=!1,this.name=void 0,this.accordionItemRef=a.t()}firstUpdated(e){this.defaultOpen&&(this.isOpen=!0)}render(){let i={"pkt-accordion-item":!0,"pkt-accordion-item--compact":this.compact,[`pkt-accordion-item--${this.skin}`]:!!this.skin},o=(this.skin??this.context?.skin)===`plus-minus`;return e._`
11
- <details
12
- class=${t.t(i)}
13
- id=${this.id}
14
- ?open=${this.isOpen}
15
- ${a.n(this.accordionItemRef)}
16
- name=${r.t(this.name)}
17
- >
18
- <summary class="pkt-accordion-item__title" id=${`pkt-accordion-item-summary-${this.id}`}>
19
- ${this.title}
20
- ${o?e._`
21
- <pkt-icon
22
- name="plus-sign"
23
- class="pkt-accordion-item__icon pkt-accordion-item__icon--plus"
24
- aria-hidden="true"
25
- ></pkt-icon>
26
- <pkt-icon
27
- name="minus-sign"
28
- class="pkt-accordion-item__icon pkt-accordion-item__icon--minus"
29
- aria-hidden="true"
30
- ></pkt-icon>
31
- `:e._`
32
- <pkt-icon
33
- name="chevron-thin-down"
34
- class="pkt-accordion-item__icon"
35
- aria-hidden="true"
36
- ></pkt-icon>
37
- `}
38
- </summary>
39
- <div
40
- class="pkt-accordion-item__content"
41
- id="pkt-accordion-item__content-${this.id}"
42
- role="region"
43
- >
44
- <div class="pkt-accordion-item__content-inner">${n.i(this)}</div>
45
- </div>
46
- </details>
47
- `}};e.n([e.u({type:Boolean})],c.prototype,`defaultOpen`,void 0),e.n([e.u({type:String})],c.prototype,`title`,void 0),e.n([e.u({type:String,reflect:!0})],c.prototype,`skin`,void 0),e.n([e.u({type:Boolean,reflect:!0})],c.prototype,`compact`,void 0),e.n([e.u({type:Boolean,reflect:!0})],c.prototype,`isOpen`,void 0),e.n([e.u({type:String,reflect:!0})],c.prototype,`name`,void 0),e.n([i.t({context:o,subscribe:!0}),e.u({attribute:!1})],c.prototype,`context`,void 0);try{e.d(`pkt-accordion-item`)(c)}catch{console.warn(`Forsøker å definere <pkt-accordion-item>, men den er allerede definert`)}var l=s;Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return l}});
@@ -1,40 +0,0 @@
1
- const e=require("./element-BOmr9YLv.cjs"),t=require("./class-map-Drv0_anQ.cjs"),n=require("./ref-Emu5PNxk.cjs"),r=require("./input-element-CSfDGslx.cjs");var i={defaultChecked:!1,indeterminate:!1,hasTile:!1,disabled:!1,hasError:!1,isSwitch:!1,hideLabel:!1,labelPosition:`right`,requiredTag:!1,optionalTag:!1},a=class extends r.t{constructor(...e){super(...e),this.inputRef=n.t(),this.value=``,this.checkHelptext=null,this.defaultChecked=i.defaultChecked,this.hasTile=i.hasTile,this.isSwitch=i.isSwitch,this.labelPosition=i.labelPosition,this.hideLabel=i.hideLabel,this.checked=null,this.indeterminate=i.indeterminate,this.type=`checkbox`,this.inputSize=void 0,this.tagText=null,this.optionalTag=i.optionalTag,this.requiredTag=i.requiredTag}connectedCallback(){super.connectedCallback()}attributeChangedCallback(e,t,n){e===`checked`&&(this.checked=this.checked===``||this.checked===`true`||this.checked===!0,this.inputRef.value&&(this.inputRef.value.checked=this.checked)),e===`indeterminate`&&(this.indeterminate=this.indeterminate===``||this.indeterminate===`true`||this.indeterminate===!0,this.inputRef.value&&(this.inputRef.value.indeterminate=this.indeterminate)),super.attributeChangedCallback(e,t,n)}firstUpdated(e){this.inputRef.value&&(this.inputRef.value.indeterminate=this.indeterminate===``||this.indeterminate===`true`||this.indeterminate===!0),super.firstUpdated(e)}willUpdate(e){super.willUpdate(e),e.has(`defaultChecked`)&&!this.checked&&(this.checked=this.defaultChecked)}updated(e){e.has(`checked`)&&this.inputRef.value&&(this.inputRef.value.checked=this.checked===``||this.checked===`true`||this.checked===!0),e.has(`indeterminate`)&&this.inputRef.value&&(this.inputRef.value.indeterminate=this.indeterminate===``||this.indeterminate===`true`||this.indeterminate===!0),super.updated(e)}render(){let r=t.t({"pkt-input-check__input":!0,"pkt-input-check__input--tile":this.hasTile,"pkt-input-check__input--tile-disabled":this.isDisabled&&this.hasTile}),i=t.t({"pkt-input-check__input-checkbox":!0,"pkt-input-check__input-checkbox--error":this.hasError}),a=t.t({"pkt-input-check__input-label":!0,"pkt-input-check__input-label--disabled":this.isDisabled,"pkt-input-check__input-label--left":this.labelPosition===`left`,"pkt-input-check__input-label--right":this.labelPosition===`right`,"pkt-sr-only":this.hideLabel}),o=`pkt-tag pkt-tag--small pkt-tag--thin-text`,s=this.pktStrings.get(`forms`),c=()=>e._`
2
- ${this.tagText?e._`<span class=${o+` pkt-tag--gray`}>${this.tagText}</span>`:e.h}
3
- ${this.optionalTag?e._`<span class=${o+` pkt-tag--blue-light`}
4
- >${this.optionalText??s.optional}</span
5
- >`:e.h}
6
- ${this.requiredTag?e._`<span class=${o+` pkt-tag--beige`}
7
- >${this.requiredText??s.required}</span
8
- >`:e.h}
9
- `,l=this.id+`-check-label`,u=this.id+`-check-helptext`,d=()=>e._`
10
- <label class=${a} for=${this.id+`-internal`}>
11
- <span id=${l}>${this.label} ${c()}</span>
12
- ${this.checkHelptext?e._`<div id=${u} class="pkt-input-check__input-helptext">
13
- ${this.checkHelptext}
14
- </div>`:e.h}
15
- </label>
16
- `;return e._`
17
- <div class="pkt-input-check${this.inputSize?` pkt-input-check--${this.inputSize}`:``}">
18
- <div class=${r}>
19
- ${this.labelPosition===`left`?d():e.h}
20
- <input
21
- id=${this.id+`-internal`}
22
- class=${i}
23
- type="checkbox"
24
- ?disabled=${this.isDisabled}
25
- name=${this.name+`-internal`}
26
- ${n.n(this.inputRef)}
27
- @change=${this.handleChange}
28
- @input=${this.handleInput}
29
- @click=${this.handleClick}
30
- @blur=${this.onBlur}
31
- @focus=${this.onFocus}
32
- ?checked=${this.checked}
33
- role=${this.isSwitch?`switch`:`checkbox`}
34
- aria-labelledby=${this.label?l:e.h}
35
- aria-describedby=${this.checkHelptext?u:e.h}
36
- />
37
- ${this.labelPosition===`right`?d():e.h}
38
- </div>
39
- </div>
40
- `}handleInput(e){e.stopImmediatePropagation(),this.onInput()}handleClick(e){if(this.isDisabled)return e.preventDefault(),e.stopImmediatePropagation(),!1}handleChange(e){if(this.isDisabled)return e.preventDefault(),e.stopImmediatePropagation(),!1;this.toggleChecked(e)}toggleChecked(e){if(this.isDisabled){e.preventDefault(),e.stopImmediatePropagation();return}let t=e.target;if(t&&t.disabled){e.preventDefault(),e.stopImmediatePropagation();return}e.stopImmediatePropagation(),this.touched=!0,this.inputRef.value&&(this.checked=this.inputRef.value.matches(`:checked`),this.valueChecked(this.checked))}};e.n([e.u({type:String,reflect:!0})],a.prototype,`value`,void 0),e.n([e.u({type:String})],a.prototype,`checkHelptext`,void 0),e.n([e.u({type:Boolean})],a.prototype,`defaultChecked`,void 0),e.n([e.u({type:Boolean})],a.prototype,`hasTile`,void 0),e.n([e.u({type:Boolean})],a.prototype,`isSwitch`,void 0),e.n([e.u({type:String})],a.prototype,`labelPosition`,void 0),e.n([e.u({type:Boolean})],a.prototype,`hideLabel`,void 0),e.n([e.u({type:Boolean,reflect:!0})],a.prototype,`checked`,void 0),e.n([e.u({type:Boolean,reflect:!0})],a.prototype,`indeterminate`,void 0),e.n([e.u({type:String,reflect:!0})],a.prototype,`type`,void 0),e.n([e.u({type:String,attribute:`input-size`})],a.prototype,`inputSize`,void 0),e.n([e.u({type:String})],a.prototype,`tagText`,void 0),e.n([e.u({type:Boolean})],a.prototype,`optionalTag`,void 0),e.n([e.u({type:String})],a.prototype,`optionalText`,void 0),e.n([e.u({type:Boolean})],a.prototype,`requiredTag`,void 0),e.n([e.u({type:String})],a.prototype,`requiredText`,void 0);try{e.d(`pkt-checkbox`)(a)}catch{console.warn(`Forsøker å definere <pkt-checkbox>, men den er allerede definert`)}var o=a;Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return o}});
@@ -1,167 +0,0 @@
1
- //#region ../../node_modules/@lit/context/lib/context-request-event.js
2
- var e = class extends Event {
3
- constructor(e, t, n, r) {
4
- super("context-request", {
5
- bubbles: !0,
6
- composed: !0
7
- }), this.context = e, this.contextTarget = t, this.callback = n, this.subscribe = r ?? !1;
8
- }
9
- };
10
- //#endregion
11
- //#region ../../node_modules/@lit/context/lib/create-context.js
12
- function t(e) {
13
- return e;
14
- }
15
- //#endregion
16
- //#region ../../node_modules/@lit/context/lib/controllers/context-consumer.js
17
- var n = class {
18
- constructor(e, t, n, r) {
19
- if (this.subscribe = !1, this.provided = !1, this.value = void 0, this.t = (e, t) => {
20
- this.unsubscribe && (this.unsubscribe !== t && (this.provided = !1, this.unsubscribe()), this.subscribe || this.unsubscribe()), this.value = e, this.host.requestUpdate(), this.provided && !this.subscribe || (this.provided = !0, this.callback && this.callback(e, t)), this.unsubscribe = t;
21
- }, this.host = e, t.context !== void 0) {
22
- let e = t;
23
- this.context = e.context, this.callback = e.callback, this.subscribe = e.subscribe ?? !1;
24
- } else this.context = t, this.callback = n, this.subscribe = r ?? !1;
25
- this.host.addController(this);
26
- }
27
- hostConnected() {
28
- this.dispatchRequest();
29
- }
30
- hostDisconnected() {
31
- this.unsubscribe &&= (this.unsubscribe(), void 0);
32
- }
33
- dispatchRequest() {
34
- this.host.dispatchEvent(new e(this.context, this.host, this.t, this.subscribe));
35
- }
36
- }, r = class {
37
- get value() {
38
- return this.o;
39
- }
40
- set value(e) {
41
- this.setValue(e);
42
- }
43
- setValue(e, t = !1) {
44
- let n = t || !Object.is(e, this.o);
45
- this.o = e, n && this.updateObservers();
46
- }
47
- constructor(e) {
48
- this.subscriptions = /* @__PURE__ */ new Map(), this.updateObservers = () => {
49
- for (let [e, { disposer: t }] of this.subscriptions) e(this.o, t);
50
- }, e !== void 0 && (this.value = e);
51
- }
52
- addCallback(e, t, n) {
53
- if (!n) return void e(this.value);
54
- this.subscriptions.has(e) || this.subscriptions.set(e, {
55
- disposer: () => {
56
- this.subscriptions.delete(e);
57
- },
58
- consumerHost: t
59
- });
60
- let { disposer: r } = this.subscriptions.get(e);
61
- e(this.value, r);
62
- }
63
- clearCallbacks() {
64
- this.subscriptions.clear();
65
- }
66
- }, i = class extends Event {
67
- constructor(e, t) {
68
- super("context-provider", {
69
- bubbles: !0,
70
- composed: !0
71
- }), this.context = e, this.contextTarget = t;
72
- }
73
- }, a = class extends r {
74
- constructor(t, n, r) {
75
- super(n.context === void 0 ? r : n.initialValue), this.onContextRequest = (e) => {
76
- if (e.context !== this.context) return;
77
- let t = e.contextTarget ?? e.composedPath()[0];
78
- t !== this.host && (e.stopPropagation(), this.addCallback(e.callback, t, e.subscribe));
79
- }, this.onProviderRequest = (t) => {
80
- if (t.context !== this.context || (t.contextTarget ?? t.composedPath()[0]) === this.host) return;
81
- let n = /* @__PURE__ */ new Set();
82
- for (let [t, { consumerHost: r }] of this.subscriptions) n.has(t) || (n.add(t), r.dispatchEvent(new e(this.context, r, t, !0)));
83
- t.stopPropagation();
84
- }, this.host = t, this.context = n.context === void 0 ? n : n.context, this.attachListeners(), this.host.addController?.(this);
85
- }
86
- attachListeners() {
87
- this.host.addEventListener("context-request", this.onContextRequest), this.host.addEventListener("context-provider", this.onProviderRequest);
88
- }
89
- hostConnected() {
90
- this.host.dispatchEvent(new i(this.context, this.host));
91
- }
92
- };
93
- //#endregion
94
- //#region ../../node_modules/@lit/context/lib/decorators/provide.js
95
- function o({ context: e }) {
96
- return (t, n) => {
97
- let r = /* @__PURE__ */ new WeakMap();
98
- if (typeof n == "object") return {
99
- get() {
100
- return t.get.call(this);
101
- },
102
- set(e) {
103
- return r.get(this).setValue(e), t.set.call(this, e);
104
- },
105
- init(t) {
106
- return r.set(this, new a(this, {
107
- context: e,
108
- initialValue: t
109
- })), t;
110
- }
111
- };
112
- {
113
- t.constructor.addInitializer(((t) => {
114
- r.set(t, new a(t, { context: e }));
115
- }));
116
- let i = Object.getOwnPropertyDescriptor(t, n), o;
117
- if (i === void 0) {
118
- let e = /* @__PURE__ */ new WeakMap();
119
- o = {
120
- get() {
121
- return e.get(this);
122
- },
123
- set(t) {
124
- r.get(this).setValue(t), e.set(this, t);
125
- },
126
- configurable: !0,
127
- enumerable: !0
128
- };
129
- } else {
130
- let e = i.set;
131
- o = {
132
- ...i,
133
- set(t) {
134
- r.get(this).setValue(t), e?.call(this, t);
135
- }
136
- };
137
- }
138
- Object.defineProperty(t, n, o);
139
- return;
140
- }
141
- };
142
- }
143
- //#endregion
144
- //#region ../../node_modules/@lit/context/lib/decorators/consume.js
145
- function s({ context: e, subscribe: t }) {
146
- return (r, i) => {
147
- typeof i == "object" ? i.addInitializer((function() {
148
- new n(this, {
149
- context: e,
150
- callback: (e) => {
151
- r.set.call(this, e);
152
- },
153
- subscribe: t
154
- });
155
- })) : r.constructor.addInitializer(((r) => {
156
- new n(r, {
157
- context: e,
158
- callback: (e) => {
159
- r[i] = e;
160
- },
161
- subscribe: t
162
- });
163
- }));
164
- };
165
- }
166
- //#endregion
167
- export { o as n, t as r, s as t };
@@ -1 +0,0 @@
1
- var e=class extends Event{constructor(e,t,n,r){super(`context-request`,{bubbles:!0,composed:!0}),this.context=e,this.contextTarget=t,this.callback=n,this.subscribe=r??!1}};function t(e){return e}var n=class{constructor(e,t,n,r){if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(e,t)=>{this.unsubscribe&&(this.unsubscribe!==t&&(this.provided=!1,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=e,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=!0,this.callback&&this.callback(e,t)),this.unsubscribe=t},this.host=e,t.context!==void 0){let e=t;this.context=e.context,this.callback=e.callback,this.subscribe=e.subscribe??!1}else this.context=t,this.callback=n,this.subscribe=r??!1;this.host.addController(this)}hostConnected(){this.dispatchRequest()}hostDisconnected(){this.unsubscribe&&=(this.unsubscribe(),void 0)}dispatchRequest(){this.host.dispatchEvent(new e(this.context,this.host,this.t,this.subscribe))}},r=class{get value(){return this.o}set value(e){this.setValue(e)}setValue(e,t=!1){let n=t||!Object.is(e,this.o);this.o=e,n&&this.updateObservers()}constructor(e){this.subscriptions=new Map,this.updateObservers=()=>{for(let[e,{disposer:t}]of this.subscriptions)e(this.o,t)},e!==void 0&&(this.value=e)}addCallback(e,t,n){if(!n)return void e(this.value);this.subscriptions.has(e)||this.subscriptions.set(e,{disposer:()=>{this.subscriptions.delete(e)},consumerHost:t});let{disposer:r}=this.subscriptions.get(e);e(this.value,r)}clearCallbacks(){this.subscriptions.clear()}},i=class extends Event{constructor(e,t){super(`context-provider`,{bubbles:!0,composed:!0}),this.context=e,this.contextTarget=t}},a=class extends r{constructor(t,n,r){super(n.context===void 0?r:n.initialValue),this.onContextRequest=e=>{if(e.context!==this.context)return;let t=e.contextTarget??e.composedPath()[0];t!==this.host&&(e.stopPropagation(),this.addCallback(e.callback,t,e.subscribe))},this.onProviderRequest=t=>{if(t.context!==this.context||(t.contextTarget??t.composedPath()[0])===this.host)return;let n=new Set;for(let[t,{consumerHost:r}]of this.subscriptions)n.has(t)||(n.add(t),r.dispatchEvent(new e(this.context,r,t,!0)));t.stopPropagation()},this.host=t,this.context=n.context===void 0?n:n.context,this.attachListeners(),this.host.addController?.(this)}attachListeners(){this.host.addEventListener(`context-request`,this.onContextRequest),this.host.addEventListener(`context-provider`,this.onProviderRequest)}hostConnected(){this.host.dispatchEvent(new i(this.context,this.host))}};function o({context:e}){return(t,n)=>{let r=new WeakMap;if(typeof n==`object`)return{get(){return t.get.call(this)},set(e){return r.get(this).setValue(e),t.set.call(this,e)},init(t){return r.set(this,new a(this,{context:e,initialValue:t})),t}};{t.constructor.addInitializer((t=>{r.set(t,new a(t,{context:e}))}));let i=Object.getOwnPropertyDescriptor(t,n),o;if(i===void 0){let e=new WeakMap;o={get(){return e.get(this)},set(t){r.get(this).setValue(t),e.set(this,t)},configurable:!0,enumerable:!0}}else{let e=i.set;o={...i,set(t){r.get(this).setValue(t),e?.call(this,t)}}}Object.defineProperty(t,n,o);return}}}function s({context:e,subscribe:t}){return(r,i)=>{typeof i==`object`?i.addInitializer((function(){new n(this,{context:e,callback:e=>{r.set.call(this,e)},subscribe:t})})):r.constructor.addInitializer((r=>{new n(r,{context:e,callback:e=>{r[i]=e},subscribe:t})}))}}Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return s}});
@@ -1 +0,0 @@
1
- const e=require("./element-BOmr9YLv.cjs"),t=require("./async-directive-BGoo_npW.cjs");function n(e){return e.classList&&(e.classList.contains(`_dialog_overlay`)||e.classList.contains(`backdrop`))?!0:typeof e.hasAttribute==`function`&&e.hasAttribute(`data-skip`)}function r(e){return e.nodeName===`OPTION`||e.nodeName===`DATA`}function i(e){return e.nodeType===Node.TEXT_NODE&&e.nodeValue?.trim()!==``}var a=new WeakMap;function o(e){let t=a.get(e);return t||(t=new p(e),a.set(e,t)),t}var s=Symbol(`default`);function c(e){return e===void 0?s:e}function l(e){return Array.isArray(e)?e.map(e=>[e,e]):Object.entries(e).map(([e,t])=>[e,t===null?s:t])}function u(e,t){return e.length===t.length&&e.every(([e,n],r)=>t[r][0]===e&&t[r][1]===n)}function d(e,t){if(e.nodeType===Node.COMMENT_NODE)return!1;if(e.nodeType===Node.TEXT_NODE)return i(e)?(f(t,s,e),!0):!1;if(e.nodeType===Node.ELEMENT_NODE){let i=e;if(n(i)||r(i))return!1;if(i instanceof HTMLTemplateElement){let e=Array.from(i.content.childNodes),n=c(i.getAttribute(`slot`)??void 0);for(let r of e)f(t,n,r);return!0}let a=i.getAttribute(`slot`);return f(t,a===null?s:c(a),e),!0}return!1}function f(e,t,n){let r=e.get(t);r||(r=[],e.set(t,r)),r.push(n)}var p=class e{static{this.PLACEHOLDER_PREFIX=`pkt-slot`}constructor(e){this.observer=null,this.nodesBySlot=new Map,this.directives=new Set,this.observing=!1,this.trackedNodes=new Set,this.generation=0,this.initialCollectionDone=!1,this.processingMutations=!1,this.placeholderToNode=new Map,this.nodeToPlaceholder=new Map,this.sources=new Map,this.subscribers=new Set,this.host=e}collectNodes(){if(this.initialCollectionDone)return;this.initialCollectionDone=!0,this.generation++;let e=Array.from(this.host.childNodes);for(let t of e)d(t,this.nodesBySlot)&&this.trackedNodes.add(t)}addDirective(e){this.directives.add(e),this.startObserving()}removeDirective(e){this.directives.delete(e),this.stopObservingIfUnused()}addSource(e,t,n){let r=this.sources.get(e);r&&r.manager===t&&u(r.mapping,n)||(r&&r.manager!==t&&this.detachFrom(r.manager,e),this.sources.set(e,{manager:t,mapping:n}),t.subscribers.add(this),t.startObserving(),this.handleChange())}removeSource(e){let t=this.sources.get(e);t&&(this.sources.delete(e),this.detachFrom(t.manager,e),this.handleChange())}getNodes(e){return this.nodesFor(c(e))}hasContent(e){return this.getNodes(e).length>0}ensurePlaceholder(t){if(this.nodeToPlaceholder.has(t))return;if(t.parentNode!==this.host){for(let{manager:e}of this.sources.values())e.ensurePlaceholder(t);return}let n=document.createComment(e.PLACEHOLDER_PREFIX);this.host.insertBefore(n,t),this.placeholderToNode.set(n,t),this.nodeToPlaceholder.set(t,n)}nodesFor(e){let t=this.nodesBySlot.get(e)??[];if(this.sources.size===0)return t;let n=[];for(let{manager:t,mapping:r}of this.sources.values())for(let[i,a]of r)a===e&&n.push(...t.nodesFor(i));return n.length?[...t,...n]:t}detachFrom(e,t){[...this.sources.entries()].some(([n,r])=>n!==t&&r.manager===e)||(e.subscribers.delete(this),e.stopObservingIfUnused())}handleChange(){this.generation++,this.notifyDirectives();for(let e of this.subscribers)e.handleChange();this.host.requestUpdate()}stopObservingIfUnused(){this.directives.size===0&&this.subscribers.size===0&&this.stopObserving()}startObserving(){this.observing||(this.observing=!0,setTimeout(()=>{!this.observing||typeof MutationObserver>`u`||(this.observer=new MutationObserver(e=>{this.handleMutations(e)}),this.observer.observe(this.host,{childList:!0,subtree:!0}))},0))}stopObserving(){this.observing&&(this.observing=!1,this.observer?.disconnect(),this.observer=null)}handleMutations(e){if(this.processingMutations)return;this.processingMutations=!0;let t=!1;for(let n of e){for(let e of n.removedNodes){let n=this.placeholderToNode.get(e);if(n){n.parentNode?.removeChild(n),this.trackedNodes.delete(n),this.removeFromSlots(n),this.placeholderToNode.delete(e),this.nodeToPlaceholder.delete(n),t=!0;continue}if(this.trackedNodes.has(e)&&!this.host.contains(e)){this.trackedNodes.delete(e),this.removeFromSlots(e);let n=this.nodeToPlaceholder.get(e);n&&(n.parentNode?.removeChild(n),this.placeholderToNode.delete(n),this.nodeToPlaceholder.delete(e)),t=!0}}if(n.target===this.host)for(let e of n.addedNodes)this.placeholderToNode.has(e)||!this.trackedNodes.has(e)&&this.isUserContent(e)&&d(e,this.nodesBySlot)&&(this.trackedNodes.add(e),t=!0)}t&&this.handleChange(),this.observer?.takeRecords(),this.processingMutations=!1}isUserContent(e){if(e.nodeType===Node.COMMENT_NODE)return!1;if(e.nodeType===Node.TEXT_NODE)return i(e);if(e.nodeType===Node.ELEMENT_NODE){let t=e;return!(n(t)||r(t))}return!1}removeFromSlots(e){for(let[t,n]of this.nodesBySlot){let r=n.indexOf(e);if(r!==-1){n.splice(r,1),n.length===0&&this.nodesBySlot.delete(t);return}}}notifyDirectives(){for(let e of this.directives)e.handleNodesChanged()}},m=class extends t.t{constructor(t){if(super(t),this.manager=null,this.lastGeneration=-1,t.type!==e.m.CHILD)throw Error(`slotContent() can only be used in child expressions`)}render(t,n){return e.g}update(e,[t,n]){return this.slotName=n,this.manager||(this.manager=o(t),this.manager.collectNodes(),this.manager.addDirective(this)),this.ensurePlaceholders(),this.getNodesOrNoChange()}handleNodesChanged(){if(!this.isConnected||!this.manager)return;this.ensurePlaceholders();let t=this.getNodesOrNoChange();t!==e.g&&this.setValue(t)}ensurePlaceholders(){if(!this.manager)return;let e=this.manager.getNodes(this.slotName);for(let t of e)this.manager.ensurePlaceholder(t)}disconnected(){this.manager?.removeDirective(this),this.manager=null,this.lastGeneration=-1}reconnected(){}getNodesOrNoChange(){if(!this.manager)return e.g;let t=this.manager.generation;return t===this.lastGeneration?e.g:(this.lastGeneration=t,this.manager.getNodes(this.slotName))}},h=e.f(m),g=class extends t.t{constructor(t){if(super(t),this.target=null,this.source=null,this.mapping=[],t.type!==e.m.ELEMENT)throw Error(`forwardSlots() can only be used as an element directive`)}render(t,n){return e.g}update(t,[n,r]){let i=o(t.element);return this.target&&this.target!==i&&this.target.removeSource(this),this.target=i,this.source=o(n),this.source.collectNodes(),this.mapping=l(r),this.target.addSource(this,this.source,this.mapping),e.g}disconnected(){this.target?.removeSource(this)}reconnected(){this.target&&this.source&&this.target.addSource(this,this.source,this.mapping)}},_=e.f(g),v=class extends e.t{connectedCallback(){o(this).collectNodes(),super.connectedCallback()}hasSlotContent(e){return o(this).hasContent(e)}};Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return _}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return v}});
@@ -1 +0,0 @@
1
- const e=require("./element-BOmr9YLv.cjs");var t=t=>t??e.h;Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return t}});
@@ -1 +0,0 @@
1
- const e=require("./element-BOmr9YLv.cjs"),t=require("./format-B8meU8Tm.cjs"),n=require("./element-with-slot-D7sTqOr3.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(O(e.target))},te=e=>{T(O(e.target))},E=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()}})},ne=e=>{let t=f.get(e.target);t&&t.size&&t.forEach(e=>{e.constructor.formAssociated&&e.formResetCallback&&e.formResetCallback.apply(e)})},D=(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),E(t),t.addEventListener(`reset`,ne),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)}},O=e=>{let t=e.parentNode;return t&&t.tagName!==`FORM`&&(t=O(t)),t},k=(e,t,n=DOMException)=>{if(!e.constructor.formAssociated)throw new n(t)},A=(e,t,n)=>{let r=f.get(e);return r&&r.size&&r.forEach(e=>{c.get(e)[n]()||(t=!1)}),t},j=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),D(e,i,n)}return t};function M(){return typeof MutationObserver<`u`}var N={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`},re=(e,t)=>{for(let n in N){t[n]=null;let r=null,i=N[n];Object.defineProperty(t,n,{get(){return r},set(n){r=n,e.isConnected?b(e,i,n):m.set(e,t)}})}},ie=(e,t)=>{s.set(t,[]),L.observe?.(e,I)};function P(e){let t=c.get(e),{form:n}=t;D(e,n,t),w(e,t.labels)}var F=(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()},I={attributes:!0,attributeFilter:[`disabled`,`name`]},L=M()?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`&&F(e)),t.attributeName===`name`&&e.constructor.formAssociated){let t=c.get(e),n=p.get(e);t.setFormValue(n)}}}):{};function R(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&&P(e),m.has(e)){let t=m.get(e);Object.keys(N).filter(e=>t[e]!==null).forEach(n=>{b(e,N[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;)P(r),r=n.nextNode()}e.localName===`fieldset`&&(L.observe?.(e,I),F(e,!0))}),i.forEach(e=>{let t=c.get(e);t&&s.get(t)&&S(t),d.has(e)&&d.get(e).disconnect()})})}function ae(e){e.forEach(e=>{let{removedNodes:t}=e;t.forEach(t=>{let n=_.get(e.target);c.has(t)&&j(t),n.disconnect()})})}var oe=e=>{let t=new MutationObserver(ae);window?.ShadyDOM?.inUse&&e.mode&&e.host&&(e=e.host),t.observe?.(e,{childList:!0}),_.set(e,t)};M()&&new MutationObserver(R);var z={childList:!0,subtree:!0},se=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)}},ce=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),le=(e,t,n)=>(e.valid=ue(t),Object.keys(t).forEach(n=>e[n]=t[n]),n&&T(n),e),ue=e=>{let t=!0;for(let n in e)n!==`valid`&&e[n]!==!1&&(t=!1);return t},B=new WeakMap;function V(e,t){e.toggleAttribute(t,!0),e.part&&e.part.add(t)}var H=class extends Set{static get isPolyfilled(){return!0}constructor(e){if(super(),!e||!e.tagName||e.tagName.indexOf(`-`)===-1)throw TypeError(`Illegal constructor`);B.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=B.get(this),r=`state${e}`;return n.isConnected?V(n,r):setTimeout(()=>{V(n,r)}),t}clear(){for(let[e]of this.entries())this.delete(e);super.clear()}delete(e){let t=super.delete(e),n=B.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}},de=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},U=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)},W,fe=class{constructor(e){W.set(this,void 0),de(this,W,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 U(this,W,`f`).length}[(W=new WeakMap,Symbol.iterator)](){return U(this,W,`f`)[Symbol.iterator]()}item(e){return this[e]==null?null:this[e]}namedItem(e){return this[e]==null?null:this[e]}};function pe(){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 A(this,n,`checkValidity`)}function r(...e){let n=t.apply(this,e);return A(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 fe(Array.from(t).concat(n).sort((e,t)=>e.compareDocumentPosition?e.compareDocumentPosition(t)&2?1:-1:0))}})}var G=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 se;this.states=new H(e),a.set(this,e),o.set(this,n),c.set(e,this),re(e,this),ie(e,this),Object.seal(this),t instanceof DocumentFragment&&oe(t)}checkValidity(){let e=a.get(this);if(k(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);k(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=O(e)),t}get labels(){let e=a.get(this);k(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(k(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(k(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(k(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&&ce(i);let c={...i,...s};delete c.valid;let{valid:u}=le(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 k(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 k(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 k(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 me(){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 K=!1,q=!1;function J(e){q||(q=!0,window.CustomStateSet=H,e&&(HTMLElement.prototype.attachInternals=function(...t){let n=e.call(this,t);return n.states=new H(this),n}))}function he(e=!0){let t=!1;if(!K){if(K=!0,typeof window<`u`&&(window.ElementInternals=G),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=j(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 G(this)}),typeof Element<`u`){function n(...t){let n=e.apply(this,t);if(h.set(this,n),M()){let e=new MutationObserver(R);window.ShadyDOM?e.observe(this,z):e.observe(n,z),d.set(this,e)}return n}let e=Element.prototype.attachShadow;Element.prototype.attachShadow=n}M()&&typeof document<`u`&&new MutationObserver(R).observe(document.documentElement,z),typeof HTMLFormElement<`u`&&pe(),(e||typeof window<`u`&&!window.CustomStateSet)&&J()}}customElements.polyfillWrapFlushCallback||(me()?typeof window<`u`&&!window.CustomStateSet&&J(HTMLElement.prototype.attachInternals):he(!1));var Y=`on`,X=`--checked`,Z=`,`,Q=e=>e===!0||e===``||e===`true`,$=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}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.touched=!1,this._initialized=!1,this._didInitDerivedState=!1,this._defaultCheckedState=!1,this.internals=this.attachInternals()}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({valueMissing:!0},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.value.length<this.minlength?this.internals.setValidity({tooShort:!0},r.tooShort,e):e.validity?.tooLong||this.maxlength&&this.maxlength>0&&this.value.length>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.internals.setValidity({})}setFormValue(e){if(this.internals){if(Array.isArray(e)){let t=new FormData;e.forEach(e=>{t.append(this.name,e)}),this.internals.setFormValue(t)}else this.internals.setFormValue(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 isCheckable(){return this.type===`checkbox`||this.type===`radio`}checkableGroup(){return this.type===`radio`?[this,...this.radioGroupMembers()]:[this]}checkableValueMissing(e){return this.type===`radio`?e.some(e=>e.required)&&!e.some(e=>Q(e.checked)):this.required&&!Q(this.checked)}syncCheckedState(){if(!this.internals)return;let e=Q(this.checked);this.internals.ariaChecked=String(e),e?(this.internals.setFormValue((typeof this.value==`string`?this.value:``)||Y),this.internals.states?.add(X)):(this.internals.setFormValue(null),this.internals.states?.delete(X)),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?Q(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.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(Z)&&(e=e.split(Z)),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(Z)?e.split(Z):!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.internals.setFormValue(``);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),[`checked`,`value`,`required`,`name`].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),!this._didInitDerivedState&&(this._didInitDerivedState=!0,this.defaultChecked&&(this.checked=!0),this.id&&!this.name&&(this.name=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.required&&(this.internals.ariaRequired=`true`),this.disabled&&(this.internals.ariaDisabled=`true`),this.checked!==void 0){let e=Q(this.checked);this._defaultCheckedState=e,this.internals.ariaChecked=String(e);let t=e?(typeof this.value==`string`?this.value:``)||Y:null;this.internals.setFormValue(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,38 +0,0 @@
1
- const e=require("./element-BOmr9YLv.cjs"),t=require("./class-map-Drv0_anQ.cjs"),n=require("./ref-Emu5PNxk.cjs"),r=require("./input-element-CSfDGslx.cjs");var i=class extends r.t{constructor(...e){super(...e),this.inputRef=n.t(),this.value=``,this.checkHelptext=null,this.defaultChecked=!1,this.hasTile=!1,this.checked=null,this.type=`radio`,this.inputSize=void 0,this.tagText=null,this.optionalTag=!1,this.requiredTag=!1,this._checked=!1}connectedCallback(){super.connectedCallback()}attributeChangedCallback(e,t,n){e===`checked`&&(this._checked=this.checked===``||this.checked===`true`||this.checked===!0),super.attributeChangedCallback(e,t,n)}render(){let r=t.t({"pkt-input-check__input":!0,"pkt-input-check__input--tile":this.hasTile,"pkt-input-check__input--tile-disabled":this.isDisabled&&this.hasTile}),i=t.t({"pkt-input-check__input-checkbox":!0,"pkt-input-check__input-checkbox--error":this.hasError}),a=t.t({"pkt-input-check__input-label":!0,"pkt-input-check__input-label--disabled":this.isDisabled,"pkt-sr-only":this.hideLabel}),o=`pkt-tag pkt-tag--small pkt-tag--thin-text`,s=this.pktStrings.get(`forms`),c=()=>e._`
2
- ${this.tagText?e._`<span class=${o+` pkt-tag--gray`}>${this.tagText}</span>`:e.h}
3
- ${this.optionalTag?e._`<span class=${o+` pkt-tag--blue-light`}
4
- >${this.optionalText??s.optional}</span
5
- >`:e.h}
6
- ${this.requiredTag?e._`<span class=${o+` pkt-tag--beige`}
7
- >${this.requiredText??s.required}</span
8
- >`:e.h}
9
- `,l=this.id+`-check-label`,u=this.id+`-check-helptext`;return e._`
10
- <div class="pkt-input-check${this.inputSize?` pkt-input-check--${this.inputSize}`:``}">
11
- <div class=${r}>
12
- <input
13
- id=${this.id+`-internal`}
14
- class=${i}
15
- type="radio"
16
- ?disabled=${this.isDisabled}
17
- form=""
18
- name=${this.name+`-internal`}
19
- ${n.n(this.inputRef)}
20
- @change=${this.toggleChecked}
21
- @input=${this.handleInput}
22
- @blur=${this.onBlur}
23
- @focus=${this.onFocus}
24
- ?checked=${this.checked}
25
- aria-labelledby=${this.label?l:e.h}
26
- aria-describedby=${this.checkHelptext?u:e.h}
27
- />
28
- ${e._`
29
- <label class=${a} for=${this.id+`-internal`}>
30
- <span id=${l}>${this.label} ${c()}</span>
31
- ${this.checkHelptext?e._`<div id=${u} class="pkt-input-check__input-helptext">
32
- ${this.checkHelptext}
33
- </div>`:e.h}
34
- </label>
35
- `}
36
- </div>
37
- </div>
38
- `}handleInput(e){e.stopImmediatePropagation(),this.onInput()}toggleChecked(e=null){e&&e.preventDefault(),e&&e.stopImmediatePropagation(),this.touched=!0,this.inputRef.value&&(this._checked=this.inputRef.value.matches(`:checked`),this.valueChecked(this._checked))}};e.n([e.u({type:String,reflect:!0})],i.prototype,`value`,void 0),e.n([e.u({type:String})],i.prototype,`checkHelptext`,void 0),e.n([e.u({type:Boolean})],i.prototype,`defaultChecked`,void 0),e.n([e.u({type:Boolean})],i.prototype,`hasTile`,void 0),e.n([e.u({type:Boolean,reflect:!0})],i.prototype,`checked`,void 0),e.n([e.u({type:String,reflect:!0})],i.prototype,`type`,void 0),e.n([e.u({type:String,attribute:`input-size`})],i.prototype,`inputSize`,void 0),e.n([e.u({type:String})],i.prototype,`tagText`,void 0),e.n([e.u({type:Boolean})],i.prototype,`optionalTag`,void 0),e.n([e.u({type:String})],i.prototype,`optionalText`,void 0),e.n([e.u({type:Boolean})],i.prototype,`requiredTag`,void 0),e.n([e.u({type:String})],i.prototype,`requiredText`,void 0),e.n([e.l()],i.prototype,`_checked`,void 0);try{e.d(`pkt-radiobutton`)(i)}catch{console.warn(`Forsøker å definere <pkt-radiobutton>, men den er allerede definert`)}var a=i;Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return a}});
@@ -1,40 +0,0 @@
1
- const e=require("./element-BOmr9YLv.cjs"),t=require("./element-with-slot-D7sTqOr3.cjs"),n=require("./if-defined-2mkIDgOm.cjs"),r=require("./consume-Le4HztPo.cjs"),i=require("./ref-Emu5PNxk.cjs");var a=r.r(Symbol(`pkt-tabs-context`)),o=class extends t.t{constructor(...e){super(...e),this.arrowNav=!0,this.disableArrowNav=!1,this.separatorIconName=``,this.separatorIconPath=``,this.tabRefs=[],this.disabledMap={},this.tabCount=0,this.context={useArrowNav:this.useArrowNav,registerTab:this.registerTab.bind(this),handleClick:this.handleClick.bind(this),handleKeyUp:this.handleKeyUp.bind(this)}}get useArrowNav(){return this.arrowNav&&!this.disableArrowNav}willUpdate(e){(e.has(`arrowNav`)||e.has(`disableArrowNav`))&&(this.context={...this.context,useArrowNav:this.useArrowNav})}updated(){this.updateComplete.then(()=>this.syncSeparators())}syncSeparators(){let e=this.querySelector(`.pkt-tabs__list`);if(!e||(e.querySelectorAll(`.pkt-tabs__separator`).forEach(e=>e.remove()),!(this.separatorIconName||this.separatorIconPath)))return;let t=Array.from(e.children).filter(e=>!e.classList.contains(`pkt-tabs__separator`));for(let e=0;e<t.length-1;e++){let n=document.createElement(`span`);if(n.className=`pkt-tabs__separator`,n.setAttribute(`aria-hidden`,`true`),n.setAttribute(`role`,`presentation`),this.separatorIconPath){let e=document.createElement(`img`);e.setAttribute(`src`,this.separatorIconPath),e.setAttribute(`alt`,``),e.setAttribute(`aria-hidden`,`true`),n.appendChild(e)}else if(this.separatorIconName){let e=document.createElement(`pkt-icon`);e.setAttribute(`name`,this.separatorIconName),e.classList.add(`pkt-tabs__separator-icon`),n.appendChild(e)}t[e].after(n)}}registerTab(e,t,n=!1){this.tabRefs[t]=e,this.disabledMap[t]=n,this.tabCount=Math.max(this.tabCount,t+1)}isTabDisabled(e){return!!this.disabledMap[e]}findEnabledIndex(e,t){let n=e+t;for(;n>=0&&n<this.tabCount;){if(!this.isTabDisabled(n))return n;n+=t}return null}handleClick(e){this.isTabDisabled(e)||this.dispatchEvent(new CustomEvent(`tab-selected`,{detail:{index:e},bubbles:!0,composed:!0}))}handleKeyUp(e,t){if(this.useArrowNav){if(e.key===`ArrowLeft`){e.preventDefault();let n=this.findEnabledIndex(t,-1);n!==null&&this.tabRefs[n]?.focus()}if(e.key===`ArrowRight`){e.preventDefault();let n=this.findEnabledIndex(t,1);n!==null&&this.tabRefs[n]?.focus()}(e.key===`Enter`||e.key===` `||e.key===`Spacebar`||e.key===`ArrowDown`)&&(e.preventDefault(),this.handleClick(t))}}render(){let n=this.useArrowNav?`tablist`:`navigation`,r=this.separatorIconName||this.separatorIconPath?`pkt-tabs pkt-tabs--with-separator`:`pkt-tabs`;return e._`
2
- <div class=${r}>
3
- <div class="pkt-tabs__list" role=${n}>${t.i(this)}</div>
4
- </div>
5
- `}};e.n([e.u({type:Boolean,reflect:!0,attribute:`arrow-nav`})],o.prototype,`arrowNav`,void 0),e.n([e.u({type:Boolean,reflect:!0,attribute:`disable-arrow-nav`})],o.prototype,`disableArrowNav`,void 0),e.n([e.u({type:String,reflect:!0,attribute:`separator-icon-name`})],o.prototype,`separatorIconName`,void 0),e.n([e.u({type:String,reflect:!0,attribute:`separator-icon-path`})],o.prototype,`separatorIconPath`,void 0),e.n([e.l()],o.prototype,`tabRefs`,void 0),e.n([e.l()],o.prototype,`disabledMap`,void 0),e.n([e.l()],o.prototype,`tabCount`,void 0),e.n([r.n({context:a}),e.l()],o.prototype,`context`,void 0);try{e.d(`pkt-tabs`)(o)}catch{console.warn(`Forsøker å definere <pkt-tabs>, men den er allerede definert`)}var s=class extends t.t{constructor(){super(),this.active=!1,this.disabled=!1,this.href=``,this.icon=``,this.controls=``,this.tag=``,this.tagSkin=`blue`,this.index=0,this.elementRef=i.t()}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{this.elementRef.value&&this.context&&this.context.registerTab(this.elementRef.value,this.index,this.disabled)})}updated(){this.elementRef.value&&this.context&&this.context.registerTab(this.elementRef.value,this.index,this.disabled)}handleClick(e){if(this.disabled){e.preventDefault(),e.stopPropagation();return}this.context&&this.context.handleClick(this.index)}handleKeyDown(e){if(this.disabled&&(e.key===`Enter`||e.key===` `||e.key===`Spacebar`)){e.preventDefault(),e.stopPropagation();return}this.context&&this.context.handleKeyUp(e,this.index)}render(){let r=this.context?.useArrowNav??!0,a=this.active&&!this.disabled,o=[a?`active`:``,this.disabled?`pkt-tabs__item--disabled`:``].filter(Boolean).join(` `),s=r?`tab`:void 0,c=r?a:void 0,l=this.disabled?-1:a||!r?void 0:-1,u=`pkt-icon--small ${this.icon===`check`?`pkt-tabs__status-icon`:``}`,d=e._`
6
- ${this.icon?e._`<pkt-icon name=${this.icon} class=${u}></pkt-icon>`:``}
7
- <span>${t.i(this)}</span>
8
- ${this.tag?e._`<pkt-tag skin=${this.tagSkin} size="small">${this.tag}</pkt-tag>`:``}
9
- `;return this.href?e._`
10
- <a
11
- ${i.n(this.elementRef)}
12
- href=${n.t(this.disabled?void 0:this.href)}
13
- class="pkt-tabs__link ${o}"
14
- role=${n.t(s)}
15
- aria-selected=${n.t(c)}
16
- aria-disabled=${n.t(this.disabled?`true`:void 0)}
17
- aria-controls=${n.t(this.controls||void 0)}
18
- tabindex=${n.t(l)}
19
- @click=${this.handleClick}
20
- @keydown=${this.handleKeyDown}
21
- >
22
- ${d}
23
- </a>
24
- `:e._`
25
- <button
26
- ${i.n(this.elementRef)}
27
- type="button"
28
- class="pkt-tabs__button pkt-link-button ${o}"
29
- ?disabled=${this.disabled}
30
- aria-disabled=${n.t(this.disabled?`true`:void 0)}
31
- role=${n.t(s)}
32
- aria-selected=${n.t(c)}
33
- aria-controls=${n.t(this.controls||void 0)}
34
- tabindex=${n.t(l)}
35
- @click=${this.handleClick}
36
- @keydown=${this.handleKeyDown}
37
- >
38
- ${d}
39
- </button>
40
- `}};e.n([e.u({type:Boolean,reflect:!0})],s.prototype,`active`,void 0),e.n([e.u({type:Boolean,reflect:!0})],s.prototype,`disabled`,void 0),e.n([e.u({type:String,reflect:!0})],s.prototype,`href`,void 0),e.n([e.u({type:String,reflect:!0})],s.prototype,`icon`,void 0),e.n([e.u({type:String,reflect:!0})],s.prototype,`controls`,void 0),e.n([e.u({type:String,reflect:!0})],s.prototype,`tag`,void 0),e.n([e.u({type:String,reflect:!0,attribute:`tag-skin`})],s.prototype,`tagSkin`,void 0),e.n([e.u({type:Number,reflect:!0})],s.prototype,`index`,void 0),e.n([r.t({context:a,subscribe:!0}),e.u({attribute:!1})],s.prototype,`context`,void 0);try{e.d(`pkt-tab-item`)(s)}catch{console.warn(`Forsøker å definere <pkt-tab-item>, men den er allerede definert`)}var c=o;Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return c}});