@oslokommune/punkt-elements 19.5.0 → 19.5.1

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 (153) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/{accordion-CZ0O4c0_.cjs → accordion-5lSFQToJ.cjs} +6 -6
  3. package/dist/{accordion-DFcdonl-.js → accordion-BJh6X1Ek.js} +6 -6
  4. package/dist/{alert-CUOWdvit.js → alert-C0PiYnot.js} +28 -35
  5. package/dist/alert-IaZzEgyI.cjs +39 -0
  6. package/dist/{backlink-vLhK1hsj.cjs → backlink-BRqhwUr2.cjs} +1 -1
  7. package/dist/{button-B0uSFQVn.js → button-B78im4wB.js} +15 -15
  8. package/dist/button-BNVTj7nB.cjs +32 -0
  9. package/dist/{card-CfFW7_-K.js → card-CYKhPUNI.js} +11 -11
  10. package/dist/{card-C15acwk4.cjs → card-CaLEuumN.cjs} +10 -10
  11. package/dist/{checkbox-C0zLtnCI.cjs → checkbox-DIyi1Cya.cjs} +1 -1
  12. package/dist/{checkbox-B2O0fkh9.js → checkbox-DKeErDb5.js} +1 -1
  13. package/dist/{combobox-Bhfh04Su.js → combobox-BKnHg_-E.js} +29 -29
  14. package/dist/{combobox-DvsnfA0c.cjs → combobox-C7FUvv5T.cjs} +22 -22
  15. package/dist/components/alert/alert.d.ts +0 -2
  16. package/dist/{consent-_DBvIRT2.js → consent-CleJMbVH.js} +1 -1
  17. package/dist/{consent-BfLkJbOk.cjs → consent-Dl-R0iC3.cjs} +1 -1
  18. package/dist/{datepicker-BY2IKrPk.js → datepicker-COFEJpB4.js} +9 -9
  19. package/dist/{datepicker-Cg-iueRC.cjs → datepicker-CeUpoQuG.cjs} +27 -27
  20. package/dist/directives/slot-content.d.ts +36 -1
  21. package/dist/element-with-slot-D7sTqOr3.cjs +1 -0
  22. package/dist/{element-with-slot-FD826ooP.js → element-with-slot-DQv0cbbD.js} +80 -21
  23. package/dist/{fileupload-iuXrgrog.js → fileupload-CUPl41uN.js} +31 -31
  24. package/dist/{fileupload-Djp6VJYY.cjs → fileupload-CaZGBvZr.cjs} +21 -21
  25. package/dist/{footer-BCdb0wlF.js → footer-DdLls3F-.js} +13 -13
  26. package/dist/{footer-bTpLxigB.cjs → footer-vy9NqT65.cjs} +9 -9
  27. package/dist/{header-DbSSOX-h.cjs → header-CgP3-6-b.cjs} +50 -50
  28. package/dist/{header-2fF-Zu5T.js → header-Cq6INZmI.js} +55 -55
  29. package/dist/{header-menu-DVYLZyez.js → header-menu-ANj5nL2M.js} +1 -1
  30. package/dist/{header-menu-ChDMnWhW.cjs → header-menu-BfkCp8jw.cjs} +1 -1
  31. package/dist/{heading-BRHCV_5J.js → heading-CUrZvkrM.js} +1 -1
  32. package/dist/{heading-u9Arof4p.cjs → heading-zoz-QZJ9.cjs} +1 -1
  33. package/dist/{helptext-CmsuAXSE.cjs → helptext-BCkwSz1m.cjs} +2 -2
  34. package/dist/{helptext-4TAHKV5_.js → helptext-DCT_9dw1.js} +1 -1
  35. package/dist/{input-element-B1BntJeJ.js → input-element-5hsxasU3.js} +1 -1
  36. package/dist/{input-element-W6Gklt2E.cjs → input-element-Ctkz5fQk.cjs} +1 -1
  37. package/dist/{input-wrapper-B5rqKWSB.cjs → input-wrapper-Cf__-4E-.cjs} +28 -28
  38. package/dist/{input-wrapper-CaMP5-Vm.js → input-wrapper-DACDx6Ie.js} +44 -44
  39. package/dist/{link-CCFAmhL5.js → link-CmZwAw5u.js} +1 -1
  40. package/dist/{link-Bo2o0Akv.cjs → link-LO_5_La8.cjs} +2 -2
  41. package/dist/{linkcard-9L6QF7US.js → linkcard-CQluSyJJ.js} +7 -7
  42. package/dist/{linkcard-D7NbrluR.cjs → linkcard-UKsxADrP.cjs} +3 -3
  43. package/dist/{listbox-DEzd-dxF.js → listbox-Ct9jIV_5.js} +8 -8
  44. package/dist/{listbox-BoBwzL4p.cjs → listbox-g-vHHLkD.cjs} +20 -20
  45. package/dist/{loader-CQaGvyF9.cjs → loader-C_PH05aw.cjs} +2 -2
  46. package/dist/{loader-RQQ_o2aR.js → loader-DzctJ9jW.js} +1 -1
  47. package/dist/{messagebox-C-BQREWz.js → messagebox-DPFBuisE.js} +1 -1
  48. package/dist/{messagebox-BRqI3DW2.cjs → messagebox-JWKMJEFc.cjs} +2 -2
  49. package/dist/{modal-BGTTVHeW.cjs → modal-BymjMIJi.cjs} +2 -2
  50. package/dist/{modal-DCwqqNQc.js → modal-CELmA0-8.js} +1 -1
  51. package/dist/pkt-accordion.cjs +1 -1
  52. package/dist/pkt-accordion.js +1 -1
  53. package/dist/pkt-alert.cjs +1 -1
  54. package/dist/pkt-alert.js +1 -1
  55. package/dist/pkt-backlink.cjs +1 -1
  56. package/dist/pkt-backlink.js +1 -1
  57. package/dist/pkt-button.cjs +1 -1
  58. package/dist/pkt-button.js +1 -1
  59. package/dist/pkt-card.cjs +1 -1
  60. package/dist/pkt-card.js +1 -1
  61. package/dist/pkt-checkbox.cjs +1 -1
  62. package/dist/pkt-checkbox.js +1 -1
  63. package/dist/pkt-combobox.cjs +1 -1
  64. package/dist/pkt-combobox.js +1 -1
  65. package/dist/pkt-consent.cjs +1 -1
  66. package/dist/pkt-consent.js +1 -1
  67. package/dist/pkt-datepicker.cjs +1 -1
  68. package/dist/pkt-datepicker.js +1 -1
  69. package/dist/pkt-fileupload.cjs +1 -1
  70. package/dist/pkt-fileupload.js +1 -1
  71. package/dist/pkt-footer.cjs +1 -1
  72. package/dist/pkt-footer.js +1 -1
  73. package/dist/pkt-header-menu.cjs +1 -1
  74. package/dist/pkt-header-menu.js +1 -1
  75. package/dist/pkt-header.cjs +1 -1
  76. package/dist/pkt-header.js +1 -1
  77. package/dist/pkt-heading.cjs +1 -1
  78. package/dist/pkt-heading.js +1 -1
  79. package/dist/pkt-helptext.cjs +1 -1
  80. package/dist/pkt-helptext.js +1 -1
  81. package/dist/pkt-index.cjs +1 -1
  82. package/dist/pkt-index.js +30 -30
  83. package/dist/pkt-input-wrapper.cjs +1 -1
  84. package/dist/pkt-input-wrapper.js +1 -1
  85. package/dist/pkt-link.cjs +1 -1
  86. package/dist/pkt-link.js +1 -1
  87. package/dist/pkt-linkcard.cjs +1 -1
  88. package/dist/pkt-linkcard.js +1 -1
  89. package/dist/pkt-listbox.cjs +1 -1
  90. package/dist/pkt-listbox.js +1 -1
  91. package/dist/pkt-loader.cjs +1 -1
  92. package/dist/pkt-loader.js +1 -1
  93. package/dist/pkt-messagebox.cjs +1 -1
  94. package/dist/pkt-messagebox.js +1 -1
  95. package/dist/pkt-modal.cjs +1 -1
  96. package/dist/pkt-modal.js +1 -1
  97. package/dist/{pkt-options-controller-Dz-rYCG1.cjs → pkt-options-controller-CpEZcomb.cjs} +1 -1
  98. package/dist/{pkt-options-controller-sUzxHa5A.js → pkt-options-controller-D7l18Iw0.js} +1 -1
  99. package/dist/pkt-progressbar.cjs +1 -1
  100. package/dist/pkt-progressbar.js +1 -1
  101. package/dist/pkt-radiobutton.cjs +1 -1
  102. package/dist/pkt-radiobutton.js +1 -1
  103. package/dist/pkt-searchinput.cjs +1 -1
  104. package/dist/pkt-searchinput.js +1 -1
  105. package/dist/pkt-select.cjs +1 -1
  106. package/dist/pkt-select.js +1 -1
  107. package/dist/pkt-tabs.cjs +1 -1
  108. package/dist/pkt-tabs.js +1 -1
  109. package/dist/pkt-tag.cjs +1 -1
  110. package/dist/pkt-tag.js +1 -1
  111. package/dist/pkt-textarea.cjs +1 -1
  112. package/dist/pkt-textarea.js +1 -1
  113. package/dist/pkt-textinput.cjs +1 -1
  114. package/dist/pkt-textinput.js +1 -1
  115. package/dist/pkt-timepicker.cjs +1 -1
  116. package/dist/pkt-timepicker.js +1 -1
  117. package/dist/{progressbar-CAEQkFpP.cjs → progressbar-CIXNSwTy.cjs} +2 -3
  118. package/dist/{progressbar-DzX0p2vn.js → progressbar-DH5lIBpx.js} +6 -4
  119. package/dist/{radiobutton-B0V-jSEX.js → radiobutton-DP791tUe.js} +1 -1
  120. package/dist/{radiobutton-Cv1BlwLV.cjs → radiobutton-oEYrBiT6.cjs} +1 -1
  121. package/dist/{searchinput-D6vtMUHw.cjs → searchinput-CbClDE-d.cjs} +1 -1
  122. package/dist/{select-C0GafKtu.js → select-B97S4g1v.js} +18 -18
  123. package/dist/{select-Bd6Gg4Ar.cjs → select-QobXCtIL.cjs} +13 -13
  124. package/dist/{tabs-B134M9k2.js → tabs-B8blHQrL.js} +18 -18
  125. package/dist/{tabs-Dw9E06fL.cjs → tabs-CjX-GWvM.cjs} +15 -15
  126. package/dist/tag-B5dUg7AD.cjs +27 -0
  127. package/dist/{tag-CvFakm1k.js → tag-Bns7Xj1O.js} +10 -10
  128. package/dist/{textarea-BZ2ufamc.js → textarea-DgW0hRV5.js} +16 -16
  129. package/dist/{textarea-CeqScqQa.cjs → textarea-ZMbtZNp3.cjs} +10 -10
  130. package/dist/{textinput-L218fT2-.cjs → textinput-DfT_1aGb.cjs} +10 -10
  131. package/dist/{textinput-DI8Tgmep.js → textinput-s-qz2xSC.js} +14 -14
  132. package/dist/{timepicker-ZSHZt0aW.cjs → timepicker-BAa_VEnf.cjs} +10 -10
  133. package/dist/{timepicker-CgXpmG3h.js → timepicker-Crj4isb9.js} +15 -15
  134. package/package.json +2 -2
  135. package/src/components/alert/alert.test.ts +15 -0
  136. package/src/components/alert/alert.ts +0 -12
  137. package/src/components/combobox/combobox.ts +3 -3
  138. package/src/components/datepicker/datepicker.ts +5 -5
  139. package/src/components/helptext/helptext-association.test.ts +79 -0
  140. package/src/components/input-wrapper/input-wrapper.test.ts +49 -0
  141. package/src/components/input-wrapper/input-wrapper.ts +6 -4
  142. package/src/components/progressbar/progressbar.test.ts +19 -0
  143. package/src/components/progressbar/progressbar.ts +2 -6
  144. package/src/components/select/select.ts +3 -3
  145. package/src/components/textarea/textarea.ts +3 -3
  146. package/src/components/textinput/textinput.ts +3 -3
  147. package/src/components/timepicker/timepicker.ts +3 -3
  148. package/dist/alert-DcyO0WfW.cjs +0 -40
  149. package/dist/button-PcKtiNGS.cjs +0 -32
  150. package/dist/element-with-slot-2PHu2w7O.cjs +0 -1
  151. package/dist/tag--kFPXNaj.cjs +0 -27
  152. package/dist/{backlink-DdyQq62f.js → backlink-BslFewn-.js} +1 -1
  153. package/dist/{searchinput-DyjUl08X.js → searchinput-Co8tcq-l.js} +1 -1
@@ -82,6 +82,85 @@ describe('helptext association', () => {
82
82
  expect(input?.getAttribute('aria-label')).toBe('Velg fil')
83
83
  })
84
84
 
85
+ describe('helptext from the slot', () => {
86
+ const slotCases: Array<[string, string]> = [
87
+ ['pkt-textinput', ''],
88
+ ['pkt-textarea', ''],
89
+ ['pkt-select', ''],
90
+ ['pkt-datepicker', ''],
91
+ ['pkt-timepicker', ''],
92
+ ['pkt-combobox', ''],
93
+ ['pkt-combobox', 'allow-user-input'],
94
+ ]
95
+
96
+ const settle = async (host: HTMLElement & { updateComplete: Promise<unknown> }) => {
97
+ for (let i = 0; i < 3; i++) {
98
+ await new Promise((resolve) => setTimeout(resolve, 0))
99
+ await host.updateComplete
100
+ const nested = Array.from(
101
+ host.querySelectorAll<HTMLElement & { updateComplete: Promise<unknown> }>(
102
+ 'pkt-input-wrapper, pkt-helptext',
103
+ ),
104
+ )
105
+ await Promise.all(nested.map((el) => el.updateComplete))
106
+ }
107
+ }
108
+
109
+ const mountWithSlot = async (tag: string, attrs: string, slot: string) => {
110
+ document.body.innerHTML = `<${tag} id="felt" name="felt" label="Etikett" ${attrs}>${slot}</${tag}>`
111
+ await customElements.whenDefined(tag)
112
+ const host = document.querySelector(tag) as HTMLElement & { updateComplete: Promise<unknown> }
113
+ await settle(host)
114
+ return host
115
+ }
116
+
117
+ const controls = (host: HTMLElement) =>
118
+ host.localName === 'pkt-timepicker'
119
+ ? Array.from(host.querySelectorAll('[role="spinbutton"]'))
120
+ : [host.querySelector(CONTROL)]
121
+
122
+ const expectDescribedBySlot = (host: HTMLElement) => {
123
+ const helptext = host.querySelector('.pkt-inputwrapper__helptext')
124
+ expect(helptext?.textContent).toContain('Hjelp fra slot')
125
+ controls(host).forEach((control) => {
126
+ expect(control?.getAttribute('aria-describedby')?.split(' ')).toContain(helptext?.id)
127
+ })
128
+ }
129
+
130
+ test.each(slotCases)('%s %s renders slotted helptext inside the helptext element', async (tag, attrs) => {
131
+ const host = await mountWithSlot(tag, attrs, '<div slot="helptext">Hjelp fra slot</div>')
132
+
133
+ expectDescribedBySlot(host)
134
+ })
135
+
136
+ test.each(slotCases)('%s %s picks up slotted helptext added after the first render', async (tag, attrs) => {
137
+ const host = await mountWithSlot(tag, attrs, '')
138
+ controls(host).forEach((control) => {
139
+ expect(control?.getAttribute('aria-describedby') ?? '').not.toContain('helptext')
140
+ })
141
+
142
+ const slotted = document.createElement('div')
143
+ slotted.setAttribute('slot', 'helptext')
144
+ slotted.textContent = 'Hjelp fra slot'
145
+ host.appendChild(slotted)
146
+ await settle(host)
147
+
148
+ expectDescribedBySlot(host)
149
+ })
150
+
151
+ test.each(slotCases)('%s %s drops the link when slotted helptext is removed', async (tag, attrs) => {
152
+ const host = await mountWithSlot(tag, attrs, '<div slot="helptext" class="slotted">Hjelp fra slot</div>')
153
+ expectDescribedBySlot(host)
154
+
155
+ host.querySelector('.slotted')?.remove()
156
+ await settle(host)
157
+
158
+ controls(host).forEach((control) => {
159
+ expect(control?.getAttribute('aria-describedby') ?? '').not.toContain('helptext')
160
+ })
161
+ })
162
+ })
163
+
85
164
  test('no label carries the description', async () => {
86
165
  for (const [tag, attrs] of cases) {
87
166
  const host = await mount(tag, attrs)
@@ -373,6 +373,55 @@ describe('PktInputWrapper', () => {
373
373
  })
374
374
  })
375
375
 
376
+ describe('Fieldset name and description', () => {
377
+ const mountFieldset = async (attributes: string, content = '') => {
378
+ document.body.innerHTML = `<pkt-input-wrapper forId="g" label="Gruppe" hasFieldset ${attributes}>${content}</pkt-input-wrapper>`
379
+ await customElements.whenDefined('pkt-input-wrapper')
380
+ const wrapper = document.querySelector('pkt-input-wrapper') as CustomElementFor<'pkt-input-wrapper'>
381
+ await wrapper.updateComplete
382
+ return wrapper.querySelector('fieldset') as HTMLFieldSetElement
383
+ }
384
+
385
+ const describedByIds = (fieldset: HTMLFieldSetElement) =>
386
+ (fieldset.getAttribute('aria-describedby') ?? '').split(' ').filter(Boolean)
387
+
388
+ afterEach(() => {
389
+ document.body.innerHTML = ''
390
+ })
391
+
392
+ test('links slotted helptext to the fieldset', async () => {
393
+ const fieldset = await mountFieldset('', '<div class="pkt-contents" slot="helptext">Velg ett</div>')
394
+
395
+ expect(describedByIds(fieldset)).toEqual(['g-helptext'])
396
+ })
397
+
398
+ test('renders slotted helptext inside the helptext element', async () => {
399
+ await mountFieldset('', '<div slot="helptext">Velg ett</div>')
400
+
401
+ expect(document.getElementById('g-helptext')?.textContent).toContain('Velg ett')
402
+ })
403
+
404
+ test('links slotted helptext added after the first render', async () => {
405
+ const fieldset = await mountFieldset('')
406
+ expect(fieldset.hasAttribute('aria-describedby')).toBe(false)
407
+ await new Promise((resolve) => setTimeout(resolve, 0))
408
+
409
+ const wrapper = document.querySelector('pkt-input-wrapper') as CustomElementFor<'pkt-input-wrapper'>
410
+ const slotted = document.createElement('div')
411
+ slotted.setAttribute('slot', 'helptext')
412
+ slotted.textContent = 'Velg ett'
413
+ wrapper.appendChild(slotted)
414
+ for (let i = 0; i < 3; i++) {
415
+ await new Promise((resolve) => setTimeout(resolve, 0))
416
+ await wrapper.updateComplete
417
+ await (wrapper.querySelector('pkt-helptext') as CustomElementFor<'pkt-helptext'>).updateComplete
418
+ }
419
+
420
+ expect(describedByIds(fieldset)).toEqual(['g-helptext'])
421
+ expect(document.getElementById('g-helptext')?.textContent).toContain('Velg ett')
422
+ })
423
+ })
424
+
376
425
  describe('Wrapper functionality', () => {
377
426
  test('handles useWrapper property values', async () => {
378
427
  // Test true value
@@ -1,5 +1,5 @@
1
1
  import { PktElementWithSlot } from '@/base-elements/element-with-slot'
2
- import { slotContent } from '@/directives/slot-content'
2
+ import { forwardSlots, slotContent } from '@/directives/slot-content'
3
3
  import { counterStatusId, isCounterExceeded } from 'shared-utils/forms/described-by'
4
4
  import { formatString, type IPktStringsProps } from 'shared-strings'
5
5
  import { ifDefined } from 'lit/directives/if-defined.js'
@@ -99,9 +99,10 @@ export class PktInputWrapper extends PktElementWithSlot<Props> {
99
99
  render() {
100
100
  const tagClasses = 'pkt-tag pkt-tag--small pkt-tag--thin-text'
101
101
 
102
+ const hasHelptext = !!this.helptext || this.hasSlotContent('helptext')
102
103
  const describedBy = this.ariaDescribedby
103
104
  ? this.ariaDescribedby
104
- : this.helptext
105
+ : hasHelptext
105
106
  ? `${this.forId}-helptext`
106
107
  : nothing
107
108
 
@@ -152,8 +153,10 @@ export class PktInputWrapper extends PktElementWithSlot<Props> {
152
153
  }
153
154
 
154
155
  const helptextElement = () => {
156
+ if (!hasHelptext && !this.helptextDropdown) return nothing
155
157
  return html`
156
158
  <pkt-helptext
159
+ ${forwardSlots(this, { helptext: null })}
157
160
  class="${ifDefined(!this.useWrapper ? 'pkt-hide' : undefined)}"
158
161
  .forId=${this.forId}
159
162
  .helptext=${this.helptext}
@@ -162,8 +165,7 @@ export class PktInputWrapper extends PktElementWithSlot<Props> {
162
165
  @toggleHelpText=${(e: CustomEvent) => {
163
166
  this.toggleDropdown(e)
164
167
  }}
165
- >${slotContent(this, 'helptext')}</pkt-helptext
166
- >
168
+ ></pkt-helptext>
167
169
  `
168
170
  }
169
171
 
@@ -26,6 +26,25 @@ afterEach(() => {
26
26
  })
27
27
 
28
28
  describe('PktProgressbar', () => {
29
+ describe('Host id', () => {
30
+ afterEach(() => {
31
+ document.body.innerHTML = ''
32
+ })
33
+
34
+ test('keeps the id on the host element', async () => {
35
+ document.body.innerHTML = '<pkt-progressbar id="min-framdrift" title="Framdrift"></pkt-progressbar>'
36
+ const progressbar = document.querySelector('pkt-progressbar') as CustomElementFor<'pkt-progressbar'>
37
+ await progressbar.updateComplete
38
+
39
+ expect(document.getElementById('min-framdrift')).toBe(progressbar)
40
+ expect(document.querySelectorAll('[id="min-framdrift"]')).toHaveLength(1)
41
+ expect(progressbar.querySelector('[role="progressbar"]')).toHaveAttribute(
42
+ 'aria-labelledby',
43
+ 'min-framdrift-title',
44
+ )
45
+ })
46
+ })
47
+
29
48
  describe('Rendering and basic functionality', () => {
30
49
  test('renders without errors', async () => {
31
50
  const { progressbar } = await createProgressbarTest()
@@ -45,7 +45,7 @@ export class PktProgressbar extends PktElement implements IPktProgressbar {
45
45
  @property({ type: String, reflect: true }) ariaLabelledby: string | null = null
46
46
  @property({ type: String, reflect: true }) ariaValueText: string | null = null
47
47
  @property({ type: String }) ariaLive: TAriaLive = 'polite'
48
- @property({ type: String }) id: string = uuidish()
48
+ @property({ type: String, reflect: true }) id: string = uuidish()
49
49
  @property({ type: String }) role: TProgressbarRole = 'progressbar'
50
50
  @property({ type: String }) skin: TProgressbarSkin = 'dark-blue'
51
51
  @property({ type: String }) statusPlacement: TProgressbarStatusPlacement = 'following'
@@ -67,10 +67,7 @@ export class PktProgressbar extends PktElement implements IPktProgressbar {
67
67
 
68
68
  protected willUpdate(changedProperties: Map<string | number | symbol, unknown>) {
69
69
  super.willUpdate(changedProperties)
70
- if (this.hasAttribute('id')) {
71
- this.progressbarId = this.getAttribute('id') || this.progressbarId
72
- this.removeAttribute('id')
73
- } else if (this.id) {
70
+ if (this.id) {
74
71
  this.progressbarId = this.id
75
72
  }
76
73
  // Verdien må fanges FØR removeAttribute: den utløser attributeChangedCallback,
@@ -131,7 +128,6 @@ export class PktProgressbar extends PktElement implements IPktProgressbar {
131
128
 
132
129
  return html`<div
133
130
  ${ref(this.progressBarRef)}
134
- id=${this.progressbarId}
135
131
  role=${this.resolvedRole}
136
132
  aria-live=${ifDefined(this.ariaLive || undefined)}
137
133
  aria-atomic="true"
@@ -4,7 +4,7 @@ import { Ref, createRef, ref } from 'lit/directives/ref.js'
4
4
  import { ifDefined } from 'lit/directives/if-defined.js'
5
5
  import { PktOptionsInputElement } from '@/base-elements/options-input-element'
6
6
  import { PktOptionsSlotController } from '@/controllers/pkt-options-controller'
7
- import { slotContent } from '@/directives/slot-content'
7
+ import { forwardSlots } from '@/directives/slot-content'
8
8
  import type { TSelectOption } from 'shared-types/select'
9
9
  import '@/components/input-wrapper'
10
10
  import { describedByIds } from 'shared-utils/forms/described-by'
@@ -182,6 +182,7 @@ export class PktSelect extends PktOptionsInputElement<{}, TSelectOption> impleme
182
182
 
183
183
  return html`
184
184
  <pkt-input-wrapper
185
+ ${forwardSlots(this, ['helptext'])}
185
186
  .strings=${this.strings}
186
187
  .size=${this.inputSize}
187
188
  ?disabled=${this.disabled}
@@ -209,7 +210,7 @@ export class PktSelect extends PktOptionsInputElement<{}, TSelectOption> impleme
209
210
  aria-describedby=${ifDefined(
210
211
  describedByIds({
211
212
  id: this.id + '-input',
212
- hasHelptext: !!this.helptext,
213
+ hasHelptext: !!this.helptext || this.hasSlotContent('helptext'),
213
214
  hasCounter: false,
214
215
  ariaDescribedby: this.ariaDescribedby,
215
216
  }),
@@ -251,7 +252,6 @@ export class PktSelect extends PktOptionsInputElement<{}, TSelectOption> impleme
251
252
  )
252
253
  : ''}
253
254
  </select>
254
- <div class="pkt-contents" slot="helptext">${slotContent(this, 'helptext')}</div>
255
255
  </pkt-input-wrapper>
256
256
  `
257
257
  }
@@ -5,7 +5,7 @@ import { Ref, createRef, ref } from 'lit/directives/ref.js'
5
5
  import { classMap } from 'lit/directives/class-map.js'
6
6
  import { live } from 'lit/directives/live.js'
7
7
  import { PktInputElement } from '@/base-elements/input-element'
8
- import { slotContent } from '@/directives/slot-content'
8
+ import { forwardSlots } from '@/directives/slot-content'
9
9
 
10
10
  import '@/components/input-wrapper'
11
11
  import '@/components/icon'
@@ -61,6 +61,7 @@ export class PktTextarea extends PktInputElement<Props> {
61
61
  const labelledBy = this.ariaLabelledby || `${this.id}-input-label`
62
62
 
63
63
  return html`<pkt-input-wrapper
64
+ ${forwardSlots(this, ['helptext'])}
64
65
  .strings=${this.strings}
65
66
  label=${this.label}
66
67
  ?counter=${showCounter}
@@ -85,7 +86,6 @@ export class PktTextarea extends PktInputElement<Props> {
85
86
  .tagText=${this.tagText}
86
87
  .size=${this.inputSize}
87
88
  >
88
- <div class="pkt-contents" slot="helptext">${slotContent(this, 'helptext')}</div>
89
89
  <textarea
90
90
  ${ref(this.inputRef)}
91
91
  class=${inputClasses}
@@ -103,7 +103,7 @@ export class PktTextarea extends PktInputElement<Props> {
103
103
  aria-describedby=${ifDefined(
104
104
  describedByIds({
105
105
  id: this.id + '-input',
106
- hasHelptext: !!this.helptext,
106
+ hasHelptext: !!this.helptext || this.hasSlotContent('helptext'),
107
107
  hasCounter: showCounter,
108
108
  ariaDescribedby: this.ariaDescribedby,
109
109
  }),
@@ -5,7 +5,7 @@ import { Ref, createRef, ref } from 'lit/directives/ref.js'
5
5
  import { ElementProps } from '@/types/typeUtils'
6
6
  import { classMap } from 'lit/directives/class-map.js'
7
7
  import { PktInputElement } from '@/base-elements/input-element'
8
- import { slotContent } from '@/directives/slot-content'
8
+ import { forwardSlots } from '@/directives/slot-content'
9
9
 
10
10
  import '@/components/input-wrapper'
11
11
  import '@/components/icon'
@@ -77,6 +77,7 @@ export class PktTextinput extends PktInputElement<Props> {
77
77
 
78
78
  return html`
79
79
  <pkt-input-wrapper
80
+ ${forwardSlots(this, ['helptext'])}
80
81
  .strings=${this.strings}
81
82
  label="${this.label}"
82
83
  ?counter=${showCounter}
@@ -101,7 +102,6 @@ export class PktTextinput extends PktInputElement<Props> {
101
102
  .tagText=${this.tagText}
102
103
  .size=${this.inputSize}
103
104
  >
104
- <div class="pkt-contents" slot="helptext">${slotContent(this, 'helptext')}</div>
105
105
  <div class=${`pkt-input__container pkt-input__container--${this.inputSize}`}>
106
106
  ${this.prefix ? html`<div class="pkt-input-prefix">${this.prefix}</div>` : nothing}
107
107
  <input
@@ -127,7 +127,7 @@ export class PktTextinput extends PktInputElement<Props> {
127
127
  aria-describedby=${ifDefined(
128
128
  describedByIds({
129
129
  id: this.id + '-input',
130
- hasHelptext: !!this.helptext,
130
+ hasHelptext: !!this.helptext || this.hasSlotContent('helptext'),
131
131
  hasCounter: showCounter,
132
132
  ariaDescribedby: this.ariaDescribedby,
133
133
  }),
@@ -4,7 +4,7 @@ import { Ref, createRef, ref } from 'lit/directives/ref.js'
4
4
  import { ifDefined } from 'lit/directives/if-defined.js'
5
5
  import { classMap } from 'lit/directives/class-map.js'
6
6
  import { PktInputElement } from '@/base-elements/input-element'
7
- import { slotContent } from '@/directives/slot-content'
7
+ import { forwardSlots } from '@/directives/slot-content'
8
8
  import { ElementProps } from '@/types/typeUtils'
9
9
  import { formatString, type IPktStringsProps } from 'shared-strings'
10
10
  import { isValidTimeString, timeToMinutes } from 'shared-utils/timepicker/time-utils'
@@ -149,7 +149,7 @@ export class PktTimepicker extends PktInputElement<Props> {
149
149
  private _describedBy(): string | undefined {
150
150
  return describedByIds({
151
151
  id: `${this.id}-hours`,
152
- hasHelptext: !!this.helptext,
152
+ hasHelptext: !!this.helptext || this.hasSlotContent('helptext'),
153
153
  ariaDescribedby: this.ariaDescribedby,
154
154
  })
155
155
  }
@@ -784,6 +784,7 @@ export class PktTimepicker extends PktInputElement<Props> {
784
784
  render() {
785
785
  return html`
786
786
  <pkt-input-wrapper
787
+ ${forwardSlots(this, ['helptext'])}
787
788
  .strings=${this.strings}
788
789
  label="${this.label}"
789
790
  ?disabled=${this.disabled}
@@ -806,7 +807,6 @@ export class PktTimepicker extends PktInputElement<Props> {
806
807
  .tagText=${this.tagText}
807
808
  .size=${this.inputSize}
808
809
  >
809
- <div class="pkt-contents" slot="helptext">${slotContent(this, 'helptext')}</div>
810
810
  ${!this.hidePicker && !this.stepArrows
811
811
  ? html`
812
812
  <div class="pkt-timepicker__anchor">
@@ -1,40 +0,0 @@
1
- const e=require("./element-BOmr9YLv.cjs"),t=require("./class-map-Drv0_anQ.cjs"),n=require("./if-defined-2mkIDgOm.cjs"),r=require("./format-B8meU8Tm.cjs"),i=require("./element-with-slot-2PHu2w7O.cjs");require("./icon-Dnv6LtPC.cjs");const a=require("./classutils-CbklAJDe.cjs"),o=require("./define-component-spec-DBNd2FJY.cjs");require("./button-PcKtiNGS.cjs");var s=[`off`,`polite`,`assertive`],c=[`info`,`success`,`warning`,`error`],l=[`medium`,`small`,`xsmall`],u={compact:!1},d=o.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`}},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:[...c],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:[...s],default:`polite`,category:`accessibility`},size:{name:`Størrelse`,description:`Endrer størrelsen på ulike elementer i alerten.`,type:[...l],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:u.compact}},slots:{default:{description:`Innholdet i meldingen`}}}),f=class extends i.t{constructor(){super(),this.compact=u.compact,this.title=``,this.skin=d.props.skin.default,this.ariaLive=d.props.ariaLive.default,this.ariaLiveAttr=null,this.closeAlert=d.props.closeAlert.default,this.date=null,this.role=`status`,this._hostId=null,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}willUpdate(e){super.willUpdate(e);let t=this.getAttribute(`id`);t&&(this._hostId=t,this.removeAttribute(`id`))}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`)&&a.t(this,`pkt-hide`,this._isClosed)}render(){let a=this.size??(this.compact?`small`:`medium`),o={"pkt-alert":!0,[`pkt-alert--${a}`]:!0,[`pkt-alert--${this.skin}`]:!0,"pkt-hide":this._isClosed},s={"pkt-alert__grid":!0,"pkt-alert__noTitle":!this.title,"pkt-alert__noDate":!this.date};return e._`
2
- <div
3
- class=${t.t(o)}
4
- id=${n.t(this._hostId||void 0)}
5
- aria-live=${this.ariaLiveAttr}
6
- role=${this.role}
7
- >
8
- <div class=${t.t(s)}>
9
- <pkt-icon
10
- class="pkt-alert__icon"
11
- aria-hidden="true"
12
- name=${this.skin===`info`?`alert-information`:`alert-${this.skin}`}
13
- ></pkt-icon>
14
-
15
- ${this.closeAlert?e._`
16
- <div class="pkt-alert__close">
17
- <pkt-button
18
- tabindex="0"
19
- aria-label=${this.pktStrings.get(`generic`).close}
20
- size=${a}
21
- type="button"
22
- skin="tertiary"
23
- iconName="close"
24
- variant="icon-only"
25
- @click=${this.close}
26
- >
27
- <span class="sr-only">${this.pktStrings.get(`generic`).close}</span>
28
- </pkt-button>
29
- </div>
30
- `:e.h}
31
- ${this.title?e._`<div class="pkt-alert__title">${this.title}</div>`:e.h}
32
-
33
- <div class="pkt-alert__text">${i.r(this)}</div>
34
-
35
- ${this.date?e._`<div class="pkt-alert__date">
36
- ${r.t(this.pktStrings.get(`alert`).lastUpdated,{date:this.date})}
37
- </div>`:e.h}
38
- </div>
39
- </div>
40
- `}};e.n([e.u({type:Boolean,reflect:!1})],f.prototype,`compact`,void 0),e.n([e.u({type:String,reflect:!0})],f.prototype,`title`,void 0),e.n([e.u({type:String,reflect:!0})],f.prototype,`skin`,void 0),e.n([e.u({type:String})],f.prototype,`ariaLive`,void 0),e.n([e.u({type:String,reflect:!0,attribute:`aria-live`})],f.prototype,`ariaLiveAttr`,void 0),e.n([e.u({type:Boolean,reflect:!0})],f.prototype,`closeAlert`,void 0),e.n([e.u({type:String,reflect:!0})],f.prototype,`date`,void 0),e.n([e.u({type:String})],f.prototype,`role`,void 0),e.n([e.l()],f.prototype,`_hostId`,void 0),e.n([e.u({type:String,attribute:`size`})],f.prototype,`size`,void 0),e.n([e.l()],f.prototype,`_isClosed`,void 0);try{e.d(`pkt-alert`)(f)}catch{console.warn(`Forsøker å definere <pkt-alert>, men den er allerede definert`)}var p=f;Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return p}});
@@ -1,32 +0,0 @@
1
- const e=require("./element-BOmr9YLv.cjs"),t=require("./class-map-Drv0_anQ.cjs"),n=require("./if-defined-2mkIDgOm.cjs"),r=require("./element-with-slot-2PHu2w7O.cjs");require("./icon-Dnv6LtPC.cjs");var i=`https://punkt-cdn.oslo.kommune.no/latest/animations/`;typeof window<`u`&&(window.pktAnimationPath=window.pktAnimationPath||i);var a=class a extends r.t{constructor(...e){super(...e),this.iconName=`user`,this.secondIconName=`user`,this.size=`medium`,this.fullWidth=!1,this.fullWidthOnMobile=!1,this.skin=`primary`,this.variant=`label-only`,this.state=void 0,this.type=`button`,this.form=void 0,this.isLoading=!1,this.disabled=!1,this.loadingAnimationPath=typeof window<`u`?window.pktAnimationPath:i,this.relocatedAria={}}connectedCallback(){super.connectedCallback(),this.addEventListener(`click`,e=>{(this.disabled||this.hasAttribute(`disabled`)||this.isLoading)&&(e.preventDefault(),e.stopImmediatePropagation())},!0),this.addEventListener(`keydown`,e=>{(this.disabled||this.hasAttribute(`disabled`)||this.isLoading)&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.stopImmediatePropagation())},!0)}attributeChangedCallback(e,t,n){super.attributeChangedCallback(e,t,n),e===`disabled`&&n===`false`&&(this.disabled=!1),(e===`isloading`||e===`isLoading`)&&n===`false`&&(this.isLoading=!1)}static{this.relocatedAriaAttributes=[`aria-haspopup`,`aria-expanded`,`aria-controls`,`aria-label`,`tabindex`]}willUpdate(e){super.willUpdate(e);let t=!1,n={...this.relocatedAria};for(let e of a.relocatedAriaAttributes){let r=this.getAttribute(e);r!==null&&(n[e]=r,this.removeAttribute(e),t=!0)}t&&(this.relocatedAria=n)}firstUpdated(e){super.firstUpdated(e),this.disabled===`false`&&(this.disabled=!1),this.isLoading===`false`&&(this.isLoading=!1)}render(){let i=this.form??this.getAttribute(`form`)??void 0,a={"pkt-btn":!0,[`pkt-btn--${this.size}`]:!!this.size,[`pkt-btn--${this.skin}`]:!!this.skin,[`pkt-btn--${this.variant}`]:!!this.variant,[`pkt-btn--${this.color}`]:!!this.color,[`pkt-btn--${this.state}`]:!!this.state,"pkt-btn--full":!!this.fullWidth,"pkt-btn--full-small":!!this.fullWidthOnMobile,"pkt-btn--isLoading":!!this.isLoading};return e._`
2
- <button
3
- class=${t.t(a)}
4
- type=${this.type}
5
- ?disabled=${!!this.disabled}
6
- aria-busy=${n.t(this.isLoading?`true`:void 0)}
7
- aria-disabled=${n.t(this.disabled||this.isLoading?`true`:void 0)}
8
- aria-haspopup=${n.t(this.relocatedAria[`aria-haspopup`])}
9
- aria-expanded=${n.t(this.relocatedAria[`aria-expanded`])}
10
- aria-controls=${n.t(this.relocatedAria[`aria-controls`])}
11
- aria-label=${n.t(this.relocatedAria[`aria-label`])}
12
- tabindex=${n.t(this.relocatedAria.tabindex)}
13
- form=${n.t(i)}
14
- >
15
- ${this.isLoading?e._`<pkt-icon
16
- class="pkt-btn__icon pkt-btn__spinner"
17
- name="spinner-blue"
18
- path=${n.t(this.loadingAnimationPath)}
19
- ></pkt-icon>`:e.h}
20
- ${this.variant===`label-only`?e.h:e._`<pkt-icon
21
- class="pkt-btn__icon pkt-icon"
22
- name=${this.iconName}
23
- path=${n.t(this.iconPath)}
24
- ></pkt-icon>`}
25
- <span class="pkt-btn__text">${r.r(this)}</span>
26
- ${this.variant===`icons-right-and-left`?e._`<pkt-icon
27
- class="pkt-btn__icon"
28
- name=${this.secondIconName}
29
- path=${n.t(this.secondIconPath)}
30
- ></pkt-icon>`:e.h}
31
- </button>
32
- `}};e.n([e.u({type:String})],a.prototype,`iconName`,void 0),e.n([e.u({type:String})],a.prototype,`secondIconName`,void 0),e.n([e.u({type:String})],a.prototype,`iconPath`,void 0),e.n([e.u({type:String})],a.prototype,`secondIconPath`,void 0),e.n([e.u({type:String})],a.prototype,`size`,void 0),e.n([e.u({type:Boolean,attribute:`full-width`})],a.prototype,`fullWidth`,void 0),e.n([e.u({type:Boolean,attribute:`full-width-on-mobile`})],a.prototype,`fullWidthOnMobile`,void 0),e.n([e.u({type:String})],a.prototype,`color`,void 0),e.n([e.u({type:String})],a.prototype,`skin`,void 0),e.n([e.u({type:String})],a.prototype,`variant`,void 0),e.n([e.u({type:String,reflect:!0})],a.prototype,`state`,void 0),e.n([e.u({type:String,reflect:!0})],a.prototype,`type`,void 0),e.n([e.u({type:String})],a.prototype,`form`,void 0),e.n([e.u({type:Boolean,reflect:!0})],a.prototype,`isLoading`,void 0),e.n([e.u({type:Boolean,reflect:!0})],a.prototype,`disabled`,void 0),e.n([e.u({type:String})],a.prototype,`loadingAnimationPath`,void 0),e.n([e.l()],a.prototype,`relocatedAria`,void 0);try{e.d(`pkt-button`)(a)}catch{console.warn(`Forsøker å definere <pkt-button>, 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 +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 d(e),a.set(e,t)),t}var s=Symbol(`default`);function c(e){return e===void 0?s:e}function l(e,t){if(e.nodeType===Node.COMMENT_NODE)return!1;if(e.nodeType===Node.TEXT_NODE)return i(e)?(u(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)u(t,n,r);return!0}let a=i.getAttribute(`slot`);return u(t,a===null?s:c(a),e),!0}return!1}function u(e,t,n){let r=e.get(t);r||(r=[],e.set(t,r)),r.push(n)}var d=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.host=e}collectNodes(){if(this.initialCollectionDone)return;this.initialCollectionDone=!0,this.generation++;let e=Array.from(this.host.childNodes);for(let t of e)l(t,this.nodesBySlot)&&this.trackedNodes.add(t)}addDirective(e){this.directives.add(e),this.startObserving()}removeDirective(e){this.directives.delete(e),this.directives.size===0&&this.stopObserving()}getNodes(e){return this.nodesBySlot.get(c(e))??[]}hasContent(e){return this.getNodes(e).length>0}ensurePlaceholder(t){if(this.nodeToPlaceholder.has(t)||t.parentNode!==this.host)return;let n=document.createComment(e.PLACEHOLDER_PREFIX);this.host.insertBefore(n,t),this.placeholderToNode.set(n,t),this.nodeToPlaceholder.set(t,n)}startObserving(){this.observing||(this.observing=!0,setTimeout(()=>{this.observing&&(this.observer=new MutationObserver(e=>{this.handleMutations(e)}),this.observer.observe(this.host,{childList:!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)if(n.target===this.host){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.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}}for(let e of n.addedNodes)this.placeholderToNode.has(e)||!this.trackedNodes.has(e)&&this.isUserContent(e)&&l(e,this.nodesBySlot)&&(this.trackedNodes.add(e),t=!0)}t&&(this.generation++,this.notifyDirectives()),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()}},f=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))}},p=e.f(f),m=class extends e.t{connectedCallback(){o(this).collectNodes(),super.connectedCallback()}hasSlotContent(e){return o(this).hasContent(e)}};Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return m}});
@@ -1,27 +0,0 @@
1
- const e=require("./element-BOmr9YLv.cjs"),t=require("./class-map-Drv0_anQ.cjs"),n=require("./if-defined-2mkIDgOm.cjs"),r=require("./format-B8meU8Tm.cjs"),i=require("./element-with-slot-2PHu2w7O.cjs");require("./icon-Dnv6LtPC.cjs");var a={name:`pkt-tag`,react:`PktTag`,"css-class":`pkt-tag`,isElement:!0,"dark-mode":!0,props:{size:{name:`Størrelse`,description:`Størrelsen på taggen`,required:!1,default:`medium`,type:[`small`,`medium`,`large`],category:`ui`},iconName:{name:`Ikon`,description:`Navnet på ikonet som skal vises i taggen`,type:`icon`,required:!1,category:`ui`},skin:{name:`Utseende`,description:`Utseendet til taggen`,required:!1,default:`blue`,type:[`blue`,`blue-light`,`blue-dark`,`green`,`red`,`beige`,`yellow`,`gray`],category:`ui`},closeTag:{name:`Lukk tag`,description:`Skal taggen ha en lukkeknapp?`,type:`boolean`,required:!1,default:!1,category:`ui`},textStyle:{name:`Tekststil`,description:`Stilen på teksten i taggen`,required:!1,default:`normal-text`,type:[`thin-text`,`normal-text`],category:`ui`},type:{name:`Type, dersom lukkeknapp`,description:`Type tag, brukes for å spesifisere om det er en knapp, submit eller reset`,required:!1,default:`button`,type:[`button`,`submit`,`reset`],category:`tech`},ariaLabel:{name:`aria-label`,description:`aria-label for taggen, brukes for tilgjengelighet`,type:`string`,required:!1,category:`accessibility`}},slots:{default:{description:`Teksten til tag`}}},o=class extends i.t{constructor(){super(),this.closeTag=a.props.closeTag.default,this.size=a.props.size.default,this.skin=a.props.skin.default,this.textStyle=null,this.iconName=void 0,this.type=a.props.type.default,this.ariaLabel=null,this.buttonTabindex=void 0,this._isClosed=!1,this._ariaDescription=null,this.close=e=>{this._isClosed=!0,this.dispatchEvent(new CustomEvent(`close`,{detail:{origin:e},bubbles:!1,composed:!0})),this.dispatchEvent(new CustomEvent(`on-close`,{detail:{origin:e},bubbles:!1,composed:!0}))},this._isClosed=!1}willUpdate(e){if(super.willUpdate(e),this.closeTag&&!this.ariaLabel){let e=i.n(this).getNodes().map(e=>e.textContent??``).join(``).trim();e&&(this._ariaDescription=r.t(this.pktStrings.get(`tag`).remove,{label:e}))}}render(){let r={"pkt-tag":!0,[`pkt-tag--${this.size}`]:!!this.size,[`pkt-tag--${this.skin}`]:!!this.skin,[`pkt-tag--${this.textStyle}`]:!!this.textStyle},a={"pkt-tag":!0,[`pkt-tag--${this.textStyle}`]:!!this.textStyle,[`pkt-tag--${this.size}`]:!!this.size,[`pkt-tag--${this.skin}`]:!!this.skin,"pkt-hide":this._isClosed};return this.closeTag?e._`
2
- <button
3
- class=${t.t(a)}
4
- type=${this.type}
5
- tabindex=${n.t(this.buttonTabindex)}
6
- @click=${this.close}
7
- aria-label=${n.t(this.ariaLabel||void 0)}
8
- aria-description=${n.t(this._ariaDescription||void 0)}
9
- >
10
- ${this.iconName&&e._`<pkt-icon
11
- class="pkt-tag__icon"
12
- name=${this.iconName}
13
- aria-hidden="true"
14
- ></pkt-icon>`}
15
- <span>${i.r(this)}</span>
16
- <pkt-icon class="pkt-tag__close-btn" name="close"></pkt-icon>
17
- </button>
18
- `:e._`
19
- <span class=${t.t(r)}>
20
- ${this.iconName&&e._`<pkt-icon
21
- class="pkt-tag__icon"
22
- name=${this.iconName}
23
- aria-hidden="true"
24
- ></pkt-icon>`}
25
- <span>${i.r(this)}</span>
26
- </span>
27
- `}};e.n([e.u({type:Boolean,reflect:!0})],o.prototype,`closeTag`,void 0),e.n([e.u({type:String,reflect:!0})],o.prototype,`size`,void 0),e.n([e.u({type:String,reflect:!0})],o.prototype,`skin`,void 0),e.n([e.u({type:String,reflect:!0})],o.prototype,`textStyle`,void 0),e.n([e.u({type:String,reflect:!0})],o.prototype,`iconName`,void 0),e.n([e.u({type:String})],o.prototype,`type`,void 0),e.n([e.u({type:String})],o.prototype,`ariaLabel`,void 0),e.n([e.u({type:Number,attribute:`button-tabindex`})],o.prototype,`buttonTabindex`,void 0),e.n([e.l()],o.prototype,`_isClosed`,void 0),e.n([e.l()],o.prototype,`_ariaDescription`,void 0);try{e.d(`pkt-tag`)(o)}catch{console.warn(`Forsøker å definere <pkt-tag>, men den er allerede definert`)}var s=o;Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return s}});
@@ -1,6 +1,6 @@
1
1
  import { _ as e, d as t, n, t as r, u as i } from "./element-mwwC2Rra.js";
2
- import { t as a } from "./if-defined-Bebu3LXY.js";
3
2
  import "./icon-JigbxxF7.js";
3
+ import { t as a } from "./if-defined-Bebu3LXY.js";
4
4
  //#region src/components/backlink/backlink.ts
5
5
  var o = class extends r {
6
6
  constructor(...e) {
@@ -1,7 +1,7 @@
1
1
  import { _ as e, d as t, h as n, l as r, n as i, t as a, u as o } from "./element-mwwC2Rra.js";
2
2
  import { t as s } from "./class-map-C4hdfSfY.js";
3
- import { t as c } from "./if-defined-Bebu3LXY.js";
4
3
  import "./icon-JigbxxF7.js";
4
+ import { t as c } from "./if-defined-Bebu3LXY.js";
5
5
  import { n as l } from "./utils-BwF4QSrq.js";
6
6
  import { t as u } from "./focus-modality-controller-Dc2S-KqR.js";
7
7
  //#region src/components/searchinput/searchinput.ts