@oslokommune/punkt-elements 18.0.0 → 18.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (202) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/{accordion-1_pdxTgJ.js → accordion-CcUosZjL.js} +5 -5
  3. package/dist/{accordion-DobbH-Sv.cjs → accordion-k0pWTG1X.cjs} +1 -1
  4. package/dist/alert-BD8YVKia.cjs +35 -0
  5. package/dist/{alert-xspFetQ8.js → alert-Bmaly2Yo.js} +46 -41
  6. package/dist/{async-directive-D2Sht790.js → async-directive-COqx0IYj.js} +2 -2
  7. package/dist/{async-directive-B5pcIMfO.cjs → async-directive-DN2eg9gA.cjs} +1 -1
  8. package/dist/{backlink-C0jZFnZ2.js → backlink-C_ZO-ZbR.js} +4 -4
  9. package/dist/{backlink-ZMhqHaVs.cjs → backlink-Ch64Pivx.cjs} +1 -1
  10. package/dist/{breadcrumbs-BvMownZN.js → breadcrumbs-CF_gAbUk.js} +2 -2
  11. package/dist/{breadcrumbs-BS64xd1s.cjs → breadcrumbs-CzzbardP.cjs} +1 -1
  12. package/dist/{button-C44vNLFC.js → button-C1CQSASU.js} +5 -5
  13. package/dist/{button-CR4CXtnj.cjs → button-CF3dNKeI.cjs} +1 -1
  14. package/dist/{calendar-DQ4byeom.cjs → calendar-BxF81kB9.cjs} +1 -1
  15. package/dist/{calendar-DgjCKMMV.js → calendar-DRmxORMc.js} +3 -3
  16. package/dist/{card-Dpqi6HVt.cjs → card-Cg1daj05.cjs} +1 -1
  17. package/dist/{card-DhHqC265.js → card-W_Jb0Tlo.js} +7 -7
  18. package/dist/{checkbox-CXQxbiaX.cjs → checkbox-BHQv8lHq.cjs} +1 -1
  19. package/dist/{checkbox-BQ1K57AB.js → checkbox-BQw2dMSX.js} +4 -4
  20. package/dist/{class-map-CzCE5pqG.cjs → class-map-C33ixq7O.cjs} +1 -1
  21. package/dist/{class-map-F1DJHyb7.js → class-map-wh4Yi3oj.js} +1 -1
  22. package/dist/{combobox-BV4oDiII.cjs → combobox-BpZow9OU.cjs} +1 -1
  23. package/dist/{combobox-DPck39I2.js → combobox-C9wwnUfM.js} +12 -12
  24. package/dist/components/accordion/accordion.d.ts +2 -6
  25. package/dist/components/accordion/accordionitem.d.ts +2 -8
  26. package/dist/components/alert/alert.d.ts +2 -2
  27. package/dist/components/backlink/backlink.d.ts +4 -5
  28. package/dist/components/backlink/backlink.test.d.ts +1 -1
  29. package/dist/components/breadcrumbs/breadcrumbs.d.ts +6 -7
  30. package/dist/components/breadcrumbs/index.d.ts +1 -1
  31. package/dist/components/fileupload/fileupload-base.d.ts +4 -2
  32. package/dist/components/fileupload/fileupload-types.d.ts +5 -43
  33. package/dist/components/index.d.ts +2 -2
  34. package/dist/{consent-_N9foluG.cjs → consent-CPtr7cBw.cjs} +1 -1
  35. package/dist/{consent-BneInZov.js → consent-D8MrqGKk.js} +2 -2
  36. package/dist/{datepicker-nSSSr1U7.js → datepicker-D4YnAtWG.js} +11 -11
  37. package/dist/{datepicker-9NX5qt2z.cjs → datepicker-DaoumZT9.cjs} +1 -1
  38. package/dist/define-component-spec-BYOSeplU.js +6 -0
  39. package/dist/define-component-spec-DBNd2FJY.cjs +1 -0
  40. package/dist/{directive-helpers-BARw3nEZ.js → directive-helpers-BWSAVe00.js} +1 -1
  41. package/dist/{directive-helpers-D6AAMFKs.cjs → directive-helpers-C6J4AkFk.cjs} +1 -1
  42. package/dist/docs/components/alert.d.ts +2 -3
  43. package/dist/{element-B8OGznK0.cjs → element-DiFhBcIl.cjs} +1 -1
  44. package/dist/{element-BKSPVgs2.js → element-WEzISABa.js} +1 -0
  45. package/dist/{element-with-slot-YUAUFRqw.js → element-with-slot-BKYUx4gb.js} +2 -2
  46. package/dist/{element-with-slot-DTxILHVv.cjs → element-with-slot-CBK4zrdN.cjs} +1 -1
  47. package/dist/{fileupload-E0LGGNgj.js → fileupload-DEHSETw0.js} +110 -412
  48. package/dist/{fileupload-D05VSbEP.cjs → fileupload-DWu6FIMv.cjs} +37 -37
  49. package/dist/{footer-DYilVBMC.js → footer-BJLEw6Ab.js} +4 -4
  50. package/dist/{footer-DBApIdGh.cjs → footer-D_yYWkQ6.cjs} +1 -1
  51. package/dist/{header-B7tbX-Ok.cjs → header-B7_4Cwaq.cjs} +1 -1
  52. package/dist/{header-v3GWAzOK.js → header-DLVq7-dM.js} +11 -11
  53. package/dist/{header-menu-D522-VTV.js → header-menu-BsrrTjpT.js} +4 -4
  54. package/dist/{header-menu-1FFWhvNc.cjs → header-menu-m7nOOC1g.cjs} +1 -1
  55. package/dist/{heading-rx_oSCqe.js → heading-DSArgrDK.js} +2 -2
  56. package/dist/{heading-CvytvcL7.cjs → heading-_RPw2UW9.cjs} +1 -1
  57. package/dist/{helptext-DYFdcylX.cjs → helptext-QMVsW5g6.cjs} +1 -1
  58. package/dist/{helptext-LShGPm-b.js → helptext-dtVVufNH.js} +4 -4
  59. package/dist/{icon-HYU1f54x.js → icon-DEtOSWRK.js} +1 -1
  60. package/dist/{icon-BmMC09mi.cjs → icon-DIavy2cB.cjs} +1 -1
  61. package/dist/{if-defined-BF8XcDi5.js → if-defined-BmnvvxtR.js} +1 -1
  62. package/dist/if-defined-Dc3xFDaM.cjs +1 -0
  63. package/dist/{input-element-DumGj_oJ.cjs → input-element-DQY1Rpbp.cjs} +1 -1
  64. package/dist/{input-element-D07DmR34.js → input-element-IBypGOaV.js} +2 -2
  65. package/dist/{input-wrapper-Cci_wTvD.js → input-wrapper-CQgAL1Br.js} +6 -6
  66. package/dist/{input-wrapper-DDfapoRX.cjs → input-wrapper-mJZLVXy_.cjs} +1 -1
  67. package/dist/{link-CQK0SH4H.js → link-DwLeY37f.js} +51 -18
  68. package/dist/link-yk4IXDWm.cjs +7 -0
  69. package/dist/{linkcard-DNYsVlV6.cjs → linkcard-BinKnxQF.cjs} +1 -1
  70. package/dist/{linkcard-B4GlmjJ6.js → linkcard-D5DXpmXI.js} +4 -4
  71. package/dist/{listbox-BlFRhyI7.cjs → listbox-C5zTRNAO.cjs} +1 -1
  72. package/dist/{listbox-wd_OofyF.js → listbox-C8ooO8qZ.js} +4 -4
  73. package/dist/{loader-0C3qVk16.js → loader-C3HyayzL.js} +4 -4
  74. package/dist/{loader-B9u2qUlR.cjs → loader-DHF7M5Vn.cjs} +1 -1
  75. package/dist/{messagebox-BD5tGmT-.cjs → messagebox-DqYf6VmQ.cjs} +1 -1
  76. package/dist/{messagebox-C-y1ICmr.js → messagebox-u8i3R5QA.js} +4 -4
  77. package/dist/{modal-BzPGQYCs.cjs → modal-CnJ9y2TQ.cjs} +1 -1
  78. package/dist/{modal-Cghs3w-d.js → modal-V-jEe0aY.js} +5 -5
  79. package/dist/pkt-accordion.cjs +1 -1
  80. package/dist/pkt-accordion.js +1 -1
  81. package/dist/pkt-alert.cjs +1 -1
  82. package/dist/pkt-alert.js +1 -1
  83. package/dist/pkt-backlink.cjs +1 -1
  84. package/dist/pkt-backlink.js +1 -1
  85. package/dist/pkt-breadcrumbs.cjs +1 -1
  86. package/dist/pkt-breadcrumbs.js +1 -1
  87. package/dist/pkt-button.cjs +1 -1
  88. package/dist/pkt-button.js +1 -1
  89. package/dist/pkt-calendar.cjs +1 -1
  90. package/dist/pkt-calendar.js +1 -1
  91. package/dist/pkt-card.cjs +1 -1
  92. package/dist/pkt-card.js +1 -1
  93. package/dist/pkt-checkbox.cjs +1 -1
  94. package/dist/pkt-checkbox.js +1 -1
  95. package/dist/pkt-combobox.cjs +1 -1
  96. package/dist/pkt-combobox.js +1 -1
  97. package/dist/pkt-consent.cjs +1 -1
  98. package/dist/pkt-consent.js +1 -1
  99. package/dist/pkt-datepicker.cjs +1 -1
  100. package/dist/pkt-datepicker.js +1 -1
  101. package/dist/pkt-fileupload.cjs +1 -1
  102. package/dist/pkt-fileupload.js +1 -1
  103. package/dist/pkt-footer.cjs +1 -1
  104. package/dist/pkt-footer.js +1 -1
  105. package/dist/pkt-header-menu.cjs +1 -1
  106. package/dist/pkt-header-menu.js +1 -1
  107. package/dist/pkt-header.cjs +1 -1
  108. package/dist/pkt-header.js +1 -1
  109. package/dist/pkt-heading.cjs +1 -1
  110. package/dist/pkt-heading.js +1 -1
  111. package/dist/pkt-helptext.cjs +1 -1
  112. package/dist/pkt-helptext.js +1 -1
  113. package/dist/pkt-icon.cjs +1 -1
  114. package/dist/pkt-icon.js +1 -1
  115. package/dist/pkt-index.cjs +1 -1
  116. package/dist/pkt-index.js +34 -34
  117. package/dist/pkt-input-wrapper.cjs +1 -1
  118. package/dist/pkt-input-wrapper.js +1 -1
  119. package/dist/pkt-link.cjs +1 -1
  120. package/dist/pkt-link.js +1 -1
  121. package/dist/pkt-linkcard.cjs +1 -1
  122. package/dist/pkt-linkcard.js +1 -1
  123. package/dist/pkt-listbox.cjs +1 -1
  124. package/dist/pkt-listbox.js +1 -1
  125. package/dist/pkt-loader.cjs +1 -1
  126. package/dist/pkt-loader.js +1 -1
  127. package/dist/pkt-messagebox.cjs +1 -1
  128. package/dist/pkt-messagebox.js +1 -1
  129. package/dist/pkt-modal.cjs +1 -1
  130. package/dist/pkt-modal.js +1 -1
  131. package/dist/{pkt-options-controller-CEEAqXaB.cjs → pkt-options-controller-BhMNCWcc.cjs} +1 -1
  132. package/dist/{pkt-options-controller-PtjhmTGk.js → pkt-options-controller-CuQ6SClv.js} +1 -1
  133. package/dist/pkt-progressbar.cjs +1 -1
  134. package/dist/pkt-progressbar.js +1 -1
  135. package/dist/pkt-radiobutton.cjs +1 -1
  136. package/dist/pkt-radiobutton.js +1 -1
  137. package/dist/pkt-searchinput.cjs +1 -1
  138. package/dist/pkt-searchinput.js +1 -1
  139. package/dist/pkt-select.cjs +1 -1
  140. package/dist/pkt-select.js +1 -1
  141. package/dist/pkt-tabs.cjs +1 -1
  142. package/dist/pkt-tabs.js +1 -1
  143. package/dist/pkt-tag.cjs +1 -1
  144. package/dist/pkt-tag.js +1 -1
  145. package/dist/pkt-textarea.cjs +1 -1
  146. package/dist/pkt-textarea.js +1 -1
  147. package/dist/pkt-textinput.cjs +1 -1
  148. package/dist/pkt-textinput.js +1 -1
  149. package/dist/pkt-timepicker.cjs +1 -1
  150. package/dist/pkt-timepicker.js +1 -1
  151. package/dist/{progressbar-BexQQw1o.js → progressbar-DS4i8IWq.js} +4 -4
  152. package/dist/{progressbar-X9mSvpjw.cjs → progressbar-DY5hxImR.cjs} +1 -1
  153. package/dist/{radiobutton-CkhTasn4.js → radiobutton-BhvZztMZ.js} +4 -4
  154. package/dist/{radiobutton-ln29Ad3U.cjs → radiobutton-BswqwRnA.cjs} +1 -1
  155. package/dist/{ref-CHbJYtKE.cjs → ref-DZmN5Qgj.cjs} +1 -1
  156. package/dist/{ref-Chc_DZAb.js → ref-OU8ryfP6.js} +2 -2
  157. package/dist/{repeat-CHDs__rN.cjs → repeat-DIa_g6WL.cjs} +1 -1
  158. package/dist/{repeat-P9SMlKd5.js → repeat-Dx2H127b.js} +2 -2
  159. package/dist/{searchinput-Da7dKHBH.js → searchinput-CJo1PpM7.js} +4 -4
  160. package/dist/{searchinput-CPgMEAZZ.cjs → searchinput-Cl46nW0r.cjs} +1 -1
  161. package/dist/{select-jabMSjft.js → select-CBrjauXT.js} +7 -7
  162. package/dist/{select-DCuvdAuK.cjs → select-Dman8Skr.cjs} +1 -1
  163. package/dist/shared-strings/index.d.ts +1 -1
  164. package/dist/shared-strings/nb.d.ts +3 -0
  165. package/dist/shared-strings/types.d.ts +11 -0
  166. package/dist/shared-types/accordion.d.ts +58 -0
  167. package/dist/shared-types/alert.d.ts +20 -0
  168. package/dist/shared-types/aria.d.ts +2 -1
  169. package/dist/shared-types/backlink.d.ts +23 -0
  170. package/dist/shared-types/breadcrumbs.d.ts +33 -0
  171. package/dist/shared-types/fileupload.d.ts +56 -2
  172. package/dist/shared-types/footer.d.ts +10 -0
  173. package/dist/shared-types/form-field.d.ts +45 -0
  174. package/dist/shared-types/header-footer.d.ts +2 -0
  175. package/dist/shared-types/index.d.ts +15 -5
  176. package/dist/shared-types/render-link.d.ts +22 -0
  177. package/dist/shared-types/skin.d.ts +2 -9
  178. package/dist/{tabs-DV5CQNDL.cjs → tabs-C1m5rSrR.cjs} +1 -1
  179. package/dist/{tabs-D_hoi1zu.js → tabs-Xu3mIedh.js} +4 -4
  180. package/dist/{tag-DK5SgKry.js → tag-Azkjhkeu.js} +5 -5
  181. package/dist/{tag-BxYulmZn.cjs → tag-BS6dDPxY.cjs} +1 -1
  182. package/dist/{textarea-BR7Riace.js → textarea-D4qXcVGD.js} +9 -9
  183. package/dist/{textarea-ffBD_VHq.cjs → textarea-DftUkR6w.cjs} +1 -1
  184. package/dist/{textinput-CtHFzAux.cjs → textinput-Ar-1Sbqy.cjs} +1 -1
  185. package/dist/{textinput-CRNrsRNV.js → textinput-iCgwwNPU.js} +8 -8
  186. package/dist/{timepicker-ixs_E5RY.js → timepicker-W6HVWtmA.js} +8 -8
  187. package/dist/{timepicker-AfgJipo6.cjs → timepicker-dpAF7h49.cjs} +1 -1
  188. package/package.json +2 -2
  189. package/src/components/accordion/accordion.ts +2 -10
  190. package/src/components/accordion/accordionitem.ts +2 -9
  191. package/src/components/alert/alert.ts +19 -10
  192. package/src/components/backlink/backlink.test.ts +3 -3
  193. package/src/components/backlink/backlink.ts +4 -6
  194. package/src/components/breadcrumbs/breadcrumbs.ts +8 -9
  195. package/src/components/breadcrumbs/index.ts +1 -1
  196. package/src/components/fileupload/fileupload-base.ts +4 -3
  197. package/src/components/fileupload/fileupload-types.ts +5 -42
  198. package/src/components/index.ts +2 -2
  199. package/src/components/link/link.ts +8 -3
  200. package/dist/alert-COeHz6o2.cjs +0 -33
  201. package/dist/if-defined-CVYApOgK.cjs +0 -1
  202. package/dist/link-11g2ZNin.cjs +0 -7
@@ -2,21 +2,13 @@ import { provide } from '@lit/context'
2
2
  import { html, LitElement } from 'lit'
3
3
  import { customElement, property, state } from 'lit/decorators.js'
4
4
  import { classMap } from 'lit/directives/class-map.js'
5
- import type { TAccordionSkin } from 'shared-types'
5
+ import type { IPktAccordionBase, TAccordionSkin } from 'shared-types'
6
6
 
7
7
  import { accordionContext, type AccordionContext } from './accordion-context'
8
8
 
9
9
  export type TPktAccordionSkin = TAccordionSkin
10
10
 
11
- export interface IPktAccordion {
12
- compact?: boolean
13
- skin?: TPktAccordionSkin
14
- ariaLabelledBy?: string
15
- name?: string
16
- /**
17
- * @description A unique identifier to connect the accordion with a heading
18
- */
19
- }
11
+ export interface IPktAccordion extends IPktAccordionBase {}
20
12
 
21
13
  export class PktAccordion extends LitElement implements IPktAccordion {
22
14
  // Properties
@@ -4,6 +4,7 @@ import { consume } from '@lit/context'
4
4
  import { html, PropertyValues } from 'lit'
5
5
  import { customElement, property } from 'lit/decorators.js'
6
6
  import { createRef, Ref, ref } from 'lit/directives/ref.js'
7
+ import type { IPktAccordionItemBase } from 'shared-types'
7
8
  import { TPktAccordionSkin } from './accordion'
8
9
  import { accordionContext, type AccordionContext } from './accordion-context'
9
10
  import { classMap } from 'lit/directives/class-map.js'
@@ -16,15 +17,7 @@ import { ifDefined } from 'lit/directives/if-defined.js'
16
17
  * to override the automatic toggling
17
18
  */
18
19
 
19
- export interface IPktAccordionItem {
20
- defaultOpen?: boolean
21
- id: string
22
- title: string
23
- skin?: TPktAccordionSkin
24
- compact?: boolean
25
- isOpen?: boolean
26
- name?: string | undefined
27
- }
20
+ export interface IPktAccordionItem extends IPktAccordionItemBase {}
28
21
 
29
22
  export class PktAccordionItem extends PktElementWithSlot implements IPktAccordionItem {
30
23
  @property({ type: Boolean }) defaultOpen: boolean = false
@@ -3,9 +3,10 @@ import { customElement, property, state } from 'lit/decorators.js'
3
3
  import { html, nothing, PropertyValues } from 'lit'
4
4
  import { PktElementWithSlot } from '@/base-elements/element-with-slot'
5
5
  import { slotContent } from '@/directives/slot-content'
6
- import type { TAriaLive, TAlertSkin } from 'shared-types'
6
+ import type { TAriaLive, TAlertSkin, TAlertSize } from 'shared-types'
7
7
  import { updateClassAttribute } from '@/utils/classutils'
8
- import specs from 'componentSpecs/alert.json'
8
+ import { formatString } from 'shared-strings'
9
+ import specs from 'componentSpecs/alert.spec'
9
10
 
10
11
  import '@/components/icon'
11
12
  import '@/components/button'
@@ -23,7 +24,7 @@ export interface IPktAlert {
23
24
  */
24
25
  compact?: boolean
25
26
  role?: string
26
- size?: 'medium' | 'small' | 'xsmall'
27
+ size?: TAlertSize
27
28
  }
28
29
  export class PktAlert extends PktElementWithSlot implements IPktAlert {
29
30
  constructor() {
@@ -33,14 +34,20 @@ export class PktAlert extends PktElementWithSlot implements IPktAlert {
33
34
 
34
35
  // Properties
35
36
 
36
- @property({ type: Boolean, reflect: false }) compact = specs.deprecated.compact.default
37
+ @property({ type: Boolean, reflect: false })
38
+ compact = specs.deprecated!.compact.default as boolean
37
39
  @property({ type: String, reflect: true }) title: string = ''
38
- @property({ type: String, reflect: true }) skin: TAlertSkin = specs.props.skin
39
- .default as TAlertSkin
40
- @property({ type: String }) ariaLive: TAriaLive = specs.props.ariaLive.default as TAriaLive
40
+ @property({ type: String, reflect: true }) skin: TAlertSkin = (
41
+ specs.props!.skin as { default: TAlertSkin }
42
+ ).default
43
+ @property({ type: String }) ariaLive: TAriaLive = (
44
+ specs.props!.ariaLive as { default: TAriaLive }
45
+ ).default
41
46
  @property({ type: String, reflect: true, attribute: 'aria-live' })
42
47
  ariaLiveAttr: TAriaLive | null = null
43
- @property({ type: Boolean, reflect: true }) closeAlert = specs.props.closeAlert.default
48
+ @property({ type: Boolean, reflect: true }) closeAlert = (
49
+ specs.props!.closeAlert as { default: boolean }
50
+ ).default
44
51
  @property({ type: String, reflect: true }) date: string | null = null
45
52
  @property({ type: String, reflect: true }) role: string = 'status'
46
53
  @property({ type: String, attribute: 'size' })
@@ -110,7 +117,7 @@ export class PktAlert extends PktElementWithSlot implements IPktAlert {
110
117
  variant="icon-only"
111
118
  @click=${this.close}
112
119
  >
113
- <span class="sr-only">Lukk</span>
120
+ <span class="sr-only">${this.pktStrings.get('generic').close}</span>
114
121
  </pkt-button>
115
122
  </div>
116
123
  `
@@ -120,7 +127,9 @@ export class PktAlert extends PktElementWithSlot implements IPktAlert {
120
127
  <div class="pkt-alert__text">${slotContent(this)}</div>
121
128
 
122
129
  ${this.date
123
- ? html`<div class="pkt-alert__date">Sist oppdatert: ${this.date}</div>`
130
+ ? html`<div class="pkt-alert__date">
131
+ ${formatString(this.pktStrings.get('alert').lastUpdated, { date: this.date })}
132
+ </div>`
124
133
  : nothing}
125
134
  </div>
126
135
  </div>
@@ -9,7 +9,7 @@ expect.extend(toHaveNoViolations)
9
9
  export interface BacklinkTestConfig extends BaseTestConfig {
10
10
  href?: string
11
11
  text?: string
12
- ariaLabel?: string
12
+ ariaLabel?: string | null
13
13
  }
14
14
 
15
15
  // Use shared framework
@@ -70,7 +70,7 @@ describe('PktBackLink', () => {
70
70
 
71
71
  expect(backlink.href).toBe('')
72
72
  expect(backlink.text).toBe('Forsiden')
73
- expect(backlink.ariaLabel).toBe('')
73
+ expect(backlink.ariaLabel).toBe(null)
74
74
 
75
75
  const nav = backlink.querySelector('nav')
76
76
  const link = nav?.querySelector('a')
@@ -133,7 +133,7 @@ describe('PktBackLink', () => {
133
133
  test('uses default aria-label when none provided', async () => {
134
134
  const { backlink } = await createBacklinkTest()
135
135
 
136
- expect(backlink.ariaLabel).toBe('')
136
+ expect(backlink.ariaLabel).toBe(null)
137
137
 
138
138
  const nav = backlink.querySelector('nav')
139
139
  expect(nav?.getAttribute('aria-label')).toBe('Gå tilbake til forrige side')
@@ -2,21 +2,19 @@ import { PktElement } from '@/base-elements/element'
2
2
  import { html } from 'lit'
3
3
  import { property, customElement } from 'lit/decorators.js'
4
4
  import { ifDefined } from 'lit/directives/if-defined.js'
5
+ import type { IPktBackLinkBase } from 'shared-types'
5
6
 
6
7
  import '@/components/icon'
7
8
 
8
- export interface IPktBackLink {
9
- href?: string
10
- text?: string
11
- ariaLabel?: string
12
- }
9
+ export interface IPktBackLink extends IPktBackLinkBase {}
13
10
 
14
11
  export class PktBackLink extends PktElement<IPktBackLink> implements IPktBackLink {
15
12
  // Properties
16
13
 
17
14
  @property({ type: String }) href: string = ''
18
15
  @property({ type: String }) text: string = 'Forsiden'
19
- @property({ type: String }) ariaLabel: string = ''
16
+ /** @deprecated Bruk `strings={{ backlink: { label: '…' } }}` eller `setPktStrings()`. */
17
+ @property({ type: String }) ariaLabel: string | null = null
20
18
 
21
19
  // Lifecycle
22
20
 
@@ -1,22 +1,21 @@
1
1
  import { customElement, property } from 'lit/decorators.js'
2
2
  import { html, nothing } from 'lit'
3
3
  import { PktElement } from '@/base-elements/element'
4
+ import type { IBreadcrumb, IPktBreadcrumbsBase } from 'shared-types'
4
5
 
5
6
  import '@/components/icon'
6
7
 
7
- export interface IBreadcrumbItem {
8
- text: string
9
- href: string
10
- }
8
+ export type { IBreadcrumb }
11
9
 
12
- export interface IPktBreadcrumbs {
13
- breadcrumbs: IBreadcrumbItem[]
14
- }
10
+ /** @deprecated Use `IBreadcrumb`. */
11
+ export type IBreadcrumbItem = IBreadcrumb
12
+
13
+ export interface IPktBreadcrumbs extends IPktBreadcrumbsBase {}
15
14
 
16
15
  export class PktBreadcrumbs extends PktElement implements IPktBreadcrumbs {
17
- @property({ type: Array }) breadcrumbs: IBreadcrumbItem[] = []
16
+ @property({ type: Array }) breadcrumbs: IBreadcrumb[] = []
18
17
 
19
- private handleLinkClick(event: MouseEvent, item: IBreadcrumbItem, index: number) {
18
+ private handleLinkClick(event: MouseEvent, item: IBreadcrumb, index: number) {
20
19
  const navigateEvent = new CustomEvent('navigate', {
21
20
  detail: { item, index, originalEvent: event },
22
21
  bubbles: true,
@@ -1,2 +1,2 @@
1
1
  export { PktBreadcrumbs } from './breadcrumbs'
2
- export type { IBreadcrumbItem, IPktBreadcrumbs } from './breadcrumbs'
2
+ export type { IBreadcrumb, IBreadcrumbItem, IPktBreadcrumbs } from './breadcrumbs'
@@ -13,7 +13,6 @@ import {
13
13
 
14
14
  import { PktElement } from '@/base-elements/element'
15
15
  import converters from '../../helpers/converters'
16
- import specs from 'componentSpecs/fileupload.json'
17
16
 
18
17
  import type {
19
18
  FileItem,
@@ -45,8 +44,9 @@ export abstract class PktFileUploadBase
45
44
  /** Expandable help text (dropdown) shown by `pkt-input-wrapper`. */
46
45
  @property({ type: String, attribute: 'helptext-dropdown' }) helptextDropdown: string = ''
47
46
  /** Button label for expandable help text. */
47
+ /** @deprecated Bruk `strings={{ forms: { readMore: '…' } }}` eller `setPktStrings()`. */
48
48
  @property({ type: String, attribute: 'helptext-dropdown-button' })
49
- helptextDropdownButton: string = specs.props.helptextDropdownButton.default
49
+ helptextDropdownButton?: string
50
50
  /** Mark input as required in form strategy. */
51
51
  @property({ type: Boolean, reflect: true }) required = false
52
52
  /** Allow selecting/dropping multiple files. */
@@ -98,8 +98,9 @@ export abstract class PktFileUploadBase
98
98
  /** Show "Må fylles ut" tag in the input wrapper. */
99
99
  @property({ type: Boolean, attribute: 'required-tag' }) requiredTag = false
100
100
  /** Label text for the required tag. */
101
+ /** @deprecated Bruk `strings={{ forms: { required: '…' } }}` eller `setPktStrings()`. */
101
102
  @property({ type: String, attribute: 'required-text' })
102
- requiredText: string = specs.props.requiredText.default
103
+ requiredText?: string
103
104
  /** Extra tag next to the label. */
104
105
  @property({ type: String, attribute: 'tag-text' }) tagText: string | null = null
105
106
  /** Trailing characters to keep when middle-truncating long filenames. Set to `0` to disable. */
@@ -5,6 +5,7 @@ import type {
5
5
  IFileTransfer,
6
6
  IFileValidateDetail,
7
7
  IFilesChangedDetail,
8
+ IPktFileUploadBase,
8
9
  ITransferCancelledDetail,
9
10
  TFilesChangedReason,
10
11
  TFileUploadItemRenderer,
@@ -50,49 +51,11 @@ export type TQueueItemOperation = {
50
51
  renderHidden?: (context: TQueueOperationContext) => TemplateResult | null
51
52
  }
52
53
 
53
- export interface IPktFileUpload {
54
- id?: string
54
+ export interface IPktFileUpload extends Omit<IPktFileUploadBase, 'extraOperations' | 'name'> {
55
55
  name?: string
56
- label?: string
57
- helptext?: string
58
- /** Expandable help text (dropdown) in input-wrapper. */
59
- helptextDropdown?: string
60
- /** Button label for expandable help text. */
61
- helptextDropdownButton?: string
62
- required?: boolean
63
- multiple?: boolean
64
- disabled?: boolean
65
- fullwidth?: boolean
66
- uploadStrategy?: TUploadStrategy
67
- itemRenderer?: TFileUploadItemRenderer
56
+ /** Custom element id — required for `uploadStrategy="custom"`. */
57
+ id?: string
58
+ /** HTML `accept` attribute on the native file input. */
68
59
  accept?: string
69
- allowedFormats?: string[]
70
- formatErrorMessage?: string
71
- maxFileSize?: string | number
72
- sizeErrorMessage?: string
73
- onFileValidation?: TFileValidator
74
- /** External error state (combined with internal validation errors). */
75
- hasError?: boolean
76
- /** External error message shown under the component. */
77
- errorMessage?: string
78
- /** Show "Valgfritt" tag in input-wrapper. */
79
- optionalTag?: boolean
80
- /** Label text for the optional tag. */
81
- optionalText?: string
82
- /** Show "Må fylles ut" tag in input-wrapper. */
83
- requiredTag?: boolean
84
- /** Label text for the required tag. */
85
- requiredText?: string
86
- /** Extra tag next to the label. */
87
- tagText?: string | null
88
- /** Trailing characters to keep when truncating long filenames. */
89
- truncateTail?: number
90
- /** Transfer states keyed by `fileId` (custom strategy progress/error/cancel rendering). */
91
- transfers?: TFileTransfer[]
92
- addCommentsEnabled?: boolean
93
- renameFilesEnabled?: boolean
94
60
  extraOperations?: TQueueItemOperation[]
95
- enableImagePreview?: boolean
96
- value?: FileItem[]
97
- defaultValue?: FileItem[]
98
61
  }
@@ -97,7 +97,7 @@ export type { IPktSelectOption, TSelectOption } from '@/components/select'
97
97
 
98
98
  export type { IPktBackLink } from '@/components/backlink'
99
99
 
100
- export type { IPktBreadcrumbs, IBreadcrumbItem } from '@/components/breadcrumbs'
100
+ export type { IPktBreadcrumbs, IBreadcrumb, IBreadcrumbItem } from '@/components/breadcrumbs'
101
101
 
102
102
  export type { IPktLoader, TPktLoaderVariant } from '@/components/loader'
103
103
 
@@ -140,4 +140,4 @@ export {
140
140
  setPktStrings,
141
141
  subscribePktStrings,
142
142
  } from 'shared-strings'
143
- export type { TPktStrings, TPktStringsNamespace, TPktStringsOverride } from 'shared-strings'
143
+ export type { TPktStrings, TPktStringsNamespace, TPktStringsOverride, IPktStringsProps } from 'shared-strings'
@@ -3,18 +3,23 @@ import { slotContent } from '@/directives/slot-content'
3
3
  import { html, nothing } from 'lit'
4
4
  import { classMap } from 'lit/directives/class-map.js'
5
5
  import { customElement, property } from 'lit/decorators.js'
6
- import specs from 'componentSpecs/link.json'
6
+ import specs from 'componentSpecs/link.spec'
7
+ import type { TPropObject } from 'componentSpecs/lib/define-component-spec'
7
8
  import '@/components/icon'
8
9
 
10
+ /** Spec defaults — narrow cast for `@property` initializers. */
11
+ const specDefaults = specs.props! as Record<string, TPropObject>
12
+
9
13
  export class PktLink extends PktElementWithSlot {
10
14
  /**
11
15
  * Element attributes
12
16
  */
13
- @property({ type: String, reflect: true }) href: string = specs.props.href.default
17
+ @property({ type: String, reflect: true }) href: string = specDefaults.href.default as string
14
18
  @property({ type: String, reflect: true }) iconName: string | undefined = undefined
15
19
  @property({ type: String, reflect: true }) iconPosition: string | undefined = undefined
16
20
  @property({ type: Boolean, reflect: true }) external: boolean = false
17
- @property({ type: String, reflect: true }) target: string | null = specs.props.target.default
21
+ @property({ type: String, reflect: true }) target: string | null =
22
+ specDefaults.target.default as string
18
23
 
19
24
  render() {
20
25
  const classes = {
@@ -1,33 +0,0 @@
1
- const e=require("./element-B8OGznK0.cjs"),t=require("./class-map-CzCE5pqG.cjs"),n=require("./element-with-slot-DTxILHVv.cjs"),r=require("./classutils-CbklAJDe.cjs");require("./icon-BmMC09mi.cjs"),require("./button-CR4CXtnj.cjs");var i={name:`pkt-alert`,react:`PktAlert`,"css-class":`pkt-alert`,"dark-mode":!0,isElement:!0,isPureReact:!0,events:{onClose:{description:`React: Klikk-event for 'Lukk'-knappen`},close:{description:`Vue: 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:[`info`,`success`,`warning`,`error`],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:[`off`,`polite`,`assertive`],default:`polite`,category:`accessibility`},size:{name:`Størrelse`,description:`Endrer størrelsen på ulike elementer i alerten.`,type:[`medium`,`small`,`xsmall`],default:`medium`,category:`ui`},closeAlert:{name:`Vis 'Lukk'-knapp`,description:`Viser 'Lukk'-knappen`,type:`boolean`,default:!1,category:`ui`}},slots:{default:{description:`Innholdet i meldingen`}},deprecated:{compact:{name:`Kompakt (deprecated)`,description:`Bruk size i stedet; uten eksplisitt size gir compact størrelsen 'small'.`,type:`boolean`,category:`ui`,default:!1}}},a=class extends n.t{constructor(){super(),this.compact=i.deprecated.compact.default,this.title=``,this.skin=i.props.skin.default,this.ariaLive=i.props.ariaLive.default,this.ariaLiveAttr=null,this.closeAlert=i.props.closeAlert.default,this.date=null,this.role=`status`,this._isClosed=!1,this.close=e=>{this._isClosed=!0,this.dispatchEvent(new CustomEvent(`close`,{detail:{origin:e},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`on-close`,{detail:{origin:e},bubbles:!0,composed:!0}))},this._isClosed=!1}connectedCallback(){super.connectedCallback(),this.ariaLiveAttr=this.getAttribute(`aria-live`)||this.ariaLive}attributeChangedCallback(e,t,n){e===`ariaLive`&&(this.ariaLiveAttr=n),super.attributeChangedCallback(e,t,n)}updated(e){super.updated(e),e.has(`ariaLive`)&&(this.ariaLiveAttr=this.ariaLive),e.has(`_isClosed`)&&r.t(this,`pkt-hide`,this._isClosed)}render(){let r=this.size??(this.compact?`small`:`medium`),i={"pkt-alert":!0,[`pkt-alert--${r}`]:!0,[`pkt-alert--${this.skin}`]:!0,"pkt-hide":this._isClosed},a={"pkt-alert__grid":!0,"pkt-alert__noTitle":!this.title,"pkt-alert__noDate":!this.date};return e._`
2
- <div class=${t.t(i)} aria-live=${this.ariaLiveAttr}>
3
- <div class=${t.t(a)}>
4
- <pkt-icon
5
- class="pkt-alert__icon"
6
- aria-hidden="true"
7
- name=${this.skin===`info`?`alert-information`:`alert-${this.skin}`}
8
- ></pkt-icon>
9
-
10
- ${this.closeAlert?e._`
11
- <div class="pkt-alert__close">
12
- <pkt-button
13
- tabindex="0"
14
- aria-label="close"
15
- size=${r}
16
- type="button"
17
- skin="tertiary"
18
- iconName="close"
19
- variant="icon-only"
20
- @click=${this.close}
21
- >
22
- <span class="sr-only">Lukk</span>
23
- </pkt-button>
24
- </div>
25
- `:e.h}
26
- ${this.title?e._`<div class="pkt-alert__title">${this.title}</div>`:e.h}
27
-
28
- <div class="pkt-alert__text">${n.n(this)}</div>
29
-
30
- ${this.date?e._`<div class="pkt-alert__date">Sist oppdatert: ${this.date}</div>`:e.h}
31
- </div>
32
- </div>
33
- `}};e.n([e.u({type:Boolean,reflect:!1})],a.prototype,`compact`,void 0),e.n([e.u({type:String,reflect:!0})],a.prototype,`title`,void 0),e.n([e.u({type:String,reflect:!0})],a.prototype,`skin`,void 0),e.n([e.u({type:String})],a.prototype,`ariaLive`,void 0),e.n([e.u({type:String,reflect:!0,attribute:`aria-live`})],a.prototype,`ariaLiveAttr`,void 0),e.n([e.u({type:Boolean,reflect:!0})],a.prototype,`closeAlert`,void 0),e.n([e.u({type:String,reflect:!0})],a.prototype,`date`,void 0),e.n([e.u({type:String,reflect:!0})],a.prototype,`role`,void 0),e.n([e.u({type:String,attribute:`size`})],a.prototype,`size`,void 0),e.n([e.l()],a.prototype,`_isClosed`,void 0);try{e.d(`pkt-alert`)(a)}catch{console.warn(`Forsøker å definere <pkt-alert>, 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-B8OGznK0.cjs");var t=t=>t??e.h;Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return t}});
@@ -1,7 +0,0 @@
1
- const e=require("./element-B8OGznK0.cjs"),t=require("./class-map-CzCE5pqG.cjs"),n=require("./element-with-slot-DTxILHVv.cjs");require("./icon-BmMC09mi.cjs");var r={name:`pkt-link`,react:`PktLink`,"css-class":`pkt-link`,"dark-mode":!0,isElement:!0,props:{href:{name:`URL`,description:`URL til lenken`,type:`string`,default:`#`,category:`contents`},target:{name:`Mål`,description:`Mål for lenken`,type:[`_blank`,`_self`,`_parent`,`_top`],default:`_self`,category:`tech`},iconName:{name:`Ikon`,description:`Ikon som skal vises ved siden av lenketeksten`,type:`icon`,category:`ui`},iconPosition:{name:`Ikonposisjon`,description:`Posisjonen til ikonet i forhold til lenketeksten`,type:[`left`,`right`],category:`ui`},renderLink:{name:`Egendefinert lenkekomponent`,description:`React: Funksjon for å rendre en egendefinert lenkekomponent (f.eks. Next.js Link eller React Router Link). Mottar et objekt med href, className, children og props. Standard er et vanlig <a>-element.`,type:`function`,required:!1,category:`tech`,reactOnly:!0}},slots:{default:{description:`Innholdet i lenken`}}},i=class extends n.t{constructor(...e){super(...e),this.href=r.props.href.default,this.iconName=void 0,this.iconPosition=void 0,this.external=!1,this.target=r.props.target.default}render(){let r={"pkt-link":!0,"pkt-link--icon-left":!!this.iconName&&this.iconPosition===`left`||!!(this.iconName&&!this.iconPosition),"pkt-link--icon-right":!!this.iconName&&this.iconPosition===`right`,"pkt-link--external":this.external};return e._`<a
2
- class=${t.t(r)}
3
- href=${this.href}
4
- .target=${this.target}
5
- .rel=${this.external?`noopener noreferrer`:e.h}
6
- >${this.iconName?e._`<pkt-icon name=${this.iconName} class="pkt-link__icon"></pkt-icon>`:``} <span>${n.n(this)}</span></a
7
- >`}};e.n([e.u({type:String,reflect:!0})],i.prototype,`href`,void 0),e.n([e.u({type:String,reflect:!0})],i.prototype,`iconName`,void 0),e.n([e.u({type:String,reflect:!0})],i.prototype,`iconPosition`,void 0),e.n([e.u({type:Boolean,reflect:!0})],i.prototype,`external`,void 0),e.n([e.u({type:String,reflect:!0})],i.prototype,`target`,void 0);try{e.d(`pkt-link`)(i)}catch{console.warn(`Forsøker å definere <pkt-link>, 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}});