@oslokommune/punkt-elements 18.0.0 → 18.2.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 (227) hide show
  1. package/CHANGELOG.md +34 -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/base-elements/element.d.ts +6 -1
  11. package/dist/base-elements/input-element.d.ts +2 -1
  12. package/dist/{breadcrumbs-BvMownZN.js → breadcrumbs-CF_gAbUk.js} +2 -2
  13. package/dist/{breadcrumbs-BS64xd1s.cjs → breadcrumbs-CzzbardP.cjs} +1 -1
  14. package/dist/{button-C44vNLFC.js → button-C1CQSASU.js} +5 -5
  15. package/dist/{button-CR4CXtnj.cjs → button-CF3dNKeI.cjs} +1 -1
  16. package/dist/{calendar-DQ4byeom.cjs → calendar-BxF81kB9.cjs} +1 -1
  17. package/dist/{calendar-DgjCKMMV.js → calendar-DRmxORMc.js} +3 -3
  18. package/dist/{card-Dpqi6HVt.cjs → card-Cg1daj05.cjs} +1 -1
  19. package/dist/{card-DhHqC265.js → card-W_Jb0Tlo.js} +7 -7
  20. package/dist/{checkbox-CXQxbiaX.cjs → checkbox-BHQv8lHq.cjs} +1 -1
  21. package/dist/{checkbox-BQ1K57AB.js → checkbox-BQw2dMSX.js} +4 -4
  22. package/dist/{class-map-CzCE5pqG.cjs → class-map-C33ixq7O.cjs} +1 -1
  23. package/dist/{class-map-F1DJHyb7.js → class-map-wh4Yi3oj.js} +1 -1
  24. package/dist/{combobox-BV4oDiII.cjs → combobox-BpZow9OU.cjs} +1 -1
  25. package/dist/{combobox-DPck39I2.js → combobox-C9wwnUfM.js} +12 -12
  26. package/dist/components/accordion/accordion.d.ts +2 -6
  27. package/dist/components/accordion/accordionitem.d.ts +2 -8
  28. package/dist/components/alert/alert.d.ts +5 -4
  29. package/dist/components/backlink/backlink.d.ts +4 -5
  30. package/dist/components/backlink/backlink.test.d.ts +1 -1
  31. package/dist/components/breadcrumbs/breadcrumbs.d.ts +7 -8
  32. package/dist/components/breadcrumbs/index.d.ts +1 -1
  33. package/dist/components/calendar/calendar.d.ts +2 -1
  34. package/dist/components/combobox/combobox-base.d.ts +2 -1
  35. package/dist/components/combobox/combobox.d.ts +2 -1
  36. package/dist/components/datepicker/date-tags.d.ts +2 -1
  37. package/dist/components/datepicker/datepicker.d.ts +2 -1
  38. package/dist/components/fileupload/fileupload-base.d.ts +4 -2
  39. package/dist/components/fileupload/fileupload-types.d.ts +5 -43
  40. package/dist/components/header/types.d.ts +3 -2
  41. package/dist/components/helptext/helptext.d.ts +2 -1
  42. package/dist/components/index.d.ts +2 -2
  43. package/dist/components/input-wrapper/input-wrapper.d.ts +2 -1
  44. package/dist/components/listbox/listbox.d.ts +3 -2
  45. package/dist/components/tag/tag.d.ts +2 -1
  46. package/dist/components/timepicker/timepicker.d.ts +2 -1
  47. package/dist/{consent-_N9foluG.cjs → consent-CPtr7cBw.cjs} +1 -1
  48. package/dist/{consent-BneInZov.js → consent-D8MrqGKk.js} +2 -2
  49. package/dist/{datepicker-nSSSr1U7.js → datepicker-D4YnAtWG.js} +11 -11
  50. package/dist/{datepicker-9NX5qt2z.cjs → datepicker-DaoumZT9.cjs} +1 -1
  51. package/dist/define-component-spec-BYOSeplU.js +6 -0
  52. package/dist/define-component-spec-DBNd2FJY.cjs +1 -0
  53. package/dist/{directive-helpers-BARw3nEZ.js → directive-helpers-BWSAVe00.js} +1 -1
  54. package/dist/{directive-helpers-D6AAMFKs.cjs → directive-helpers-C6J4AkFk.cjs} +1 -1
  55. package/dist/docs/components/alert.d.ts +2 -3
  56. package/dist/{element-B8OGznK0.cjs → element-DiFhBcIl.cjs} +1 -1
  57. package/dist/{element-BKSPVgs2.js → element-WEzISABa.js} +1 -0
  58. package/dist/{element-with-slot-YUAUFRqw.js → element-with-slot-BKYUx4gb.js} +2 -2
  59. package/dist/{element-with-slot-DTxILHVv.cjs → element-with-slot-CBK4zrdN.cjs} +1 -1
  60. package/dist/{fileupload-E0LGGNgj.js → fileupload-DEHSETw0.js} +110 -412
  61. package/dist/{fileupload-D05VSbEP.cjs → fileupload-DWu6FIMv.cjs} +37 -37
  62. package/dist/{footer-DYilVBMC.js → footer-BJLEw6Ab.js} +4 -4
  63. package/dist/{footer-DBApIdGh.cjs → footer-D_yYWkQ6.cjs} +1 -1
  64. package/dist/{header-B7tbX-Ok.cjs → header-B7_4Cwaq.cjs} +1 -1
  65. package/dist/{header-v3GWAzOK.js → header-DLVq7-dM.js} +11 -11
  66. package/dist/{header-menu-D522-VTV.js → header-menu-BsrrTjpT.js} +4 -4
  67. package/dist/{header-menu-1FFWhvNc.cjs → header-menu-m7nOOC1g.cjs} +1 -1
  68. package/dist/{heading-rx_oSCqe.js → heading-DSArgrDK.js} +2 -2
  69. package/dist/{heading-CvytvcL7.cjs → heading-_RPw2UW9.cjs} +1 -1
  70. package/dist/{helptext-DYFdcylX.cjs → helptext-QMVsW5g6.cjs} +1 -1
  71. package/dist/{helptext-LShGPm-b.js → helptext-dtVVufNH.js} +4 -4
  72. package/dist/{icon-HYU1f54x.js → icon-DEtOSWRK.js} +1 -1
  73. package/dist/{icon-BmMC09mi.cjs → icon-DIavy2cB.cjs} +1 -1
  74. package/dist/{if-defined-BF8XcDi5.js → if-defined-BmnvvxtR.js} +1 -1
  75. package/dist/if-defined-Dc3xFDaM.cjs +1 -0
  76. package/dist/{input-element-DumGj_oJ.cjs → input-element-DQY1Rpbp.cjs} +1 -1
  77. package/dist/{input-element-D07DmR34.js → input-element-IBypGOaV.js} +2 -2
  78. package/dist/{input-wrapper-Cci_wTvD.js → input-wrapper-CQgAL1Br.js} +6 -6
  79. package/dist/{input-wrapper-DDfapoRX.cjs → input-wrapper-mJZLVXy_.cjs} +1 -1
  80. package/dist/{link-CQK0SH4H.js → link-DwLeY37f.js} +51 -18
  81. package/dist/link-yk4IXDWm.cjs +7 -0
  82. package/dist/{linkcard-DNYsVlV6.cjs → linkcard-BinKnxQF.cjs} +1 -1
  83. package/dist/{linkcard-B4GlmjJ6.js → linkcard-D5DXpmXI.js} +4 -4
  84. package/dist/{listbox-BlFRhyI7.cjs → listbox-C5zTRNAO.cjs} +1 -1
  85. package/dist/{listbox-wd_OofyF.js → listbox-C8ooO8qZ.js} +4 -4
  86. package/dist/{loader-0C3qVk16.js → loader-C3HyayzL.js} +4 -4
  87. package/dist/{loader-B9u2qUlR.cjs → loader-DHF7M5Vn.cjs} +1 -1
  88. package/dist/{messagebox-BD5tGmT-.cjs → messagebox-DqYf6VmQ.cjs} +1 -1
  89. package/dist/{messagebox-C-y1ICmr.js → messagebox-u8i3R5QA.js} +4 -4
  90. package/dist/{modal-BzPGQYCs.cjs → modal-CnJ9y2TQ.cjs} +1 -1
  91. package/dist/{modal-Cghs3w-d.js → modal-V-jEe0aY.js} +5 -5
  92. package/dist/pkt-accordion.cjs +1 -1
  93. package/dist/pkt-accordion.js +1 -1
  94. package/dist/pkt-alert.cjs +1 -1
  95. package/dist/pkt-alert.js +1 -1
  96. package/dist/pkt-backlink.cjs +1 -1
  97. package/dist/pkt-backlink.js +1 -1
  98. package/dist/pkt-breadcrumbs.cjs +1 -1
  99. package/dist/pkt-breadcrumbs.js +1 -1
  100. package/dist/pkt-button.cjs +1 -1
  101. package/dist/pkt-button.js +1 -1
  102. package/dist/pkt-calendar.cjs +1 -1
  103. package/dist/pkt-calendar.js +1 -1
  104. package/dist/pkt-card.cjs +1 -1
  105. package/dist/pkt-card.js +1 -1
  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 +34 -34
  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-CEEAqXaB.cjs → pkt-options-controller-BhMNCWcc.cjs} +1 -1
  145. package/dist/{pkt-options-controller-PtjhmTGk.js → pkt-options-controller-CuQ6SClv.js} +1 -1
  146. package/dist/pkt-progressbar.cjs +1 -1
  147. package/dist/pkt-progressbar.js +1 -1
  148. package/dist/pkt-radiobutton.cjs +1 -1
  149. package/dist/pkt-radiobutton.js +1 -1
  150. package/dist/pkt-searchinput.cjs +1 -1
  151. package/dist/pkt-searchinput.js +1 -1
  152. package/dist/pkt-select.cjs +1 -1
  153. package/dist/pkt-select.js +1 -1
  154. package/dist/pkt-tabs.cjs +1 -1
  155. package/dist/pkt-tabs.js +1 -1
  156. package/dist/pkt-tag.cjs +1 -1
  157. package/dist/pkt-tag.js +1 -1
  158. package/dist/pkt-textarea.cjs +1 -1
  159. package/dist/pkt-textarea.js +1 -1
  160. package/dist/pkt-textinput.cjs +1 -1
  161. package/dist/pkt-textinput.js +1 -1
  162. package/dist/pkt-timepicker.cjs +1 -1
  163. package/dist/pkt-timepicker.js +1 -1
  164. package/dist/{progressbar-BexQQw1o.js → progressbar-DS4i8IWq.js} +4 -4
  165. package/dist/{progressbar-X9mSvpjw.cjs → progressbar-DY5hxImR.cjs} +1 -1
  166. package/dist/{radiobutton-CkhTasn4.js → radiobutton-BhvZztMZ.js} +4 -4
  167. package/dist/{radiobutton-ln29Ad3U.cjs → radiobutton-BswqwRnA.cjs} +1 -1
  168. package/dist/{ref-CHbJYtKE.cjs → ref-DZmN5Qgj.cjs} +1 -1
  169. package/dist/{ref-Chc_DZAb.js → ref-OU8ryfP6.js} +2 -2
  170. package/dist/{repeat-CHDs__rN.cjs → repeat-DIa_g6WL.cjs} +1 -1
  171. package/dist/{repeat-P9SMlKd5.js → repeat-Dx2H127b.js} +2 -2
  172. package/dist/{searchinput-Da7dKHBH.js → searchinput-CJo1PpM7.js} +4 -4
  173. package/dist/{searchinput-CPgMEAZZ.cjs → searchinput-Cl46nW0r.cjs} +1 -1
  174. package/dist/{select-jabMSjft.js → select-CBrjauXT.js} +7 -7
  175. package/dist/{select-DCuvdAuK.cjs → select-Dman8Skr.cjs} +1 -1
  176. package/dist/shared-strings/index.d.ts +1 -1
  177. package/dist/shared-strings/nb.d.ts +3 -0
  178. package/dist/shared-strings/types.d.ts +17 -0
  179. package/dist/shared-types/accordion.d.ts +58 -0
  180. package/dist/shared-types/alert.d.ts +20 -0
  181. package/dist/shared-types/aria.d.ts +2 -1
  182. package/dist/shared-types/backlink.d.ts +23 -0
  183. package/dist/shared-types/breadcrumbs.d.ts +33 -0
  184. package/dist/shared-types/fileupload.d.ts +56 -2
  185. package/dist/shared-types/footer.d.ts +10 -0
  186. package/dist/shared-types/form-field.d.ts +46 -0
  187. package/dist/shared-types/header-footer.d.ts +2 -0
  188. package/dist/shared-types/index.d.ts +15 -5
  189. package/dist/shared-types/render-link.d.ts +22 -0
  190. package/dist/shared-types/searchinput.d.ts +2 -1
  191. package/dist/shared-types/skin.d.ts +2 -9
  192. package/dist/{tabs-DV5CQNDL.cjs → tabs-C1m5rSrR.cjs} +1 -1
  193. package/dist/{tabs-D_hoi1zu.js → tabs-Xu3mIedh.js} +4 -4
  194. package/dist/{tag-DK5SgKry.js → tag-Azkjhkeu.js} +5 -5
  195. package/dist/{tag-BxYulmZn.cjs → tag-BS6dDPxY.cjs} +1 -1
  196. package/dist/{textarea-BR7Riace.js → textarea-D4qXcVGD.js} +9 -9
  197. package/dist/{textarea-ffBD_VHq.cjs → textarea-DftUkR6w.cjs} +1 -1
  198. package/dist/{textinput-CtHFzAux.cjs → textinput-Ar-1Sbqy.cjs} +1 -1
  199. package/dist/{textinput-CRNrsRNV.js → textinput-iCgwwNPU.js} +8 -8
  200. package/dist/{timepicker-ixs_E5RY.js → timepicker-W6HVWtmA.js} +8 -8
  201. package/dist/{timepicker-AfgJipo6.cjs → timepicker-dpAF7h49.cjs} +1 -1
  202. package/package.json +2 -2
  203. package/src/components/accordion/accordion.ts +2 -10
  204. package/src/components/accordion/accordionitem.ts +2 -9
  205. package/src/components/alert/alert.ts +21 -12
  206. package/src/components/backlink/backlink.test.ts +3 -3
  207. package/src/components/backlink/backlink.ts +4 -6
  208. package/src/components/breadcrumbs/breadcrumbs.ts +9 -10
  209. package/src/components/breadcrumbs/index.ts +1 -1
  210. package/src/components/calendar/calendar.ts +2 -1
  211. package/src/components/combobox/combobox-base.ts +2 -1
  212. package/src/components/combobox/combobox.ts +2 -1
  213. package/src/components/datepicker/date-tags.ts +2 -1
  214. package/src/components/datepicker/datepicker.ts +3 -1
  215. package/src/components/fileupload/fileupload-base.ts +4 -3
  216. package/src/components/fileupload/fileupload-types.ts +5 -42
  217. package/src/components/header/types.ts +6 -4
  218. package/src/components/helptext/helptext.ts +2 -1
  219. package/src/components/index.ts +2 -2
  220. package/src/components/input-wrapper/input-wrapper.ts +3 -2
  221. package/src/components/link/link.ts +8 -3
  222. package/src/components/listbox/listbox.ts +3 -2
  223. package/src/components/tag/tag.ts +2 -2
  224. package/src/components/timepicker/timepicker.ts +3 -2
  225. package/dist/alert-COeHz6o2.cjs +0 -33
  226. package/dist/if-defined-CVYApOgK.cjs +0 -1
  227. package/dist/link-11g2ZNin.cjs +0 -7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oslokommune/punkt-elements",
3
- "version": "18.0.0",
3
+ "version": "18.2.0",
4
4
  "description": "Komponentbiblioteket til Punkt, et designsystem laget av Oslo Origo",
5
5
  "homepage": "https://punkt.oslo.kommune.no",
6
6
  "author": "Team Designsystem, Oslo Origo",
@@ -83,5 +83,5 @@
83
83
  "engines": {
84
84
  "node": "^22.19.0 || ^24.0.0 || ^26.0.0"
85
85
  },
86
- "gitHead": "057d0045ccd1af4d0f6591f0e2b0e5ab6fda3843"
86
+ "gitHead": "3e850f524f546977081c875a222256fb2e63eb5a"
87
87
  }
@@ -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,16 +3,17 @@ 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, type IPktStringsProps } from 'shared-strings'
9
+ import specs from 'componentSpecs/alert.spec'
9
10
 
10
11
  import '@/components/icon'
11
12
  import '@/components/button'
12
13
 
13
14
  export type { TAlertSkin }
14
15
 
15
- export interface IPktAlert {
16
+ export interface IPktAlert extends IPktStringsProps<'alert' | 'generic'> {
16
17
  skin?: TAlertSkin
17
18
  closeAlert?: boolean
18
19
  title?: string
@@ -23,9 +24,9 @@ export interface IPktAlert {
23
24
  */
24
25
  compact?: boolean
25
26
  role?: string
26
- size?: 'medium' | 'small' | 'xsmall'
27
+ size?: TAlertSize
27
28
  }
28
- export class PktAlert extends PktElementWithSlot implements IPktAlert {
29
+ export class PktAlert extends PktElementWithSlot<IPktAlert> implements IPktAlert {
29
30
  constructor() {
30
31
  super()
31
32
  this._isClosed = false
@@ -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
- export class PktBreadcrumbs extends PktElement implements IPktBreadcrumbs {
17
- @property({ type: Array }) breadcrumbs: IBreadcrumbItem[] = []
15
+ export class PktBreadcrumbs extends PktElement<IPktBreadcrumbs> implements IPktBreadcrumbs {
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'
@@ -11,6 +11,7 @@ import {
11
11
  } from 'shared-utils/date-utils'
12
12
  import { html, nothing, PropertyValues, TemplateResult } from 'lit'
13
13
  import { PktElement } from '@/base-elements/element'
14
+ import type { IPktStringsProps } from 'shared-strings'
14
15
  import converters from '../../helpers/converters'
15
16
  import specs from 'componentSpecs/calendar.json'
16
17
  import '@/components/icon'
@@ -54,7 +55,7 @@ type TDayViewData = {
54
55
  tabindex: string
55
56
  }
56
57
 
57
- export class PktCalendar extends PktElement {
58
+ export class PktCalendar extends PktElement<IPktStringsProps<'dates' | 'calendar'>> {
58
59
  // Selection properties
59
60
  @property({ converter: converters.csvToArray })
60
61
  selected: string | string[] = []
@@ -6,6 +6,7 @@ import { isMaxSelectionReached } from 'shared-utils/combobox/option-utils'
6
6
  import specs from 'componentSpecs/combobox.json'
7
7
 
8
8
  import type { IPktComboboxOption, TPktComboboxTagPlacement } from './combobox-types'
9
+ import type { IPktStringsProps } from 'shared-strings'
9
10
  import PktListbox from '../listbox'
10
11
  import type { TComboboxMessageKey } from 'shared-utils/combobox'
11
12
 
@@ -13,7 +14,7 @@ import type { TComboboxMessageKey } from 'shared-utils/combobox'
13
14
  * Base class for PktCombobox.
14
15
  * Declares all reactive properties, state, refs, and simple helpers.
15
16
  */
16
- export class ComboboxBase extends PktInputElement {
17
+ export class ComboboxBase extends PktInputElement<IPktStringsProps<'combobox' | 'listbox'>> {
17
18
  constructor() {
18
19
  super()
19
20
  this.optionsController = new PktOptionsSlotController(this)
@@ -15,6 +15,7 @@ import { getSingleValueForInput } from 'shared-utils/combobox/input-utils'
15
15
  import { slotUtils, optionStateUtils } from './combobox-utils'
16
16
  import { slotContent } from '@/directives/slot-content'
17
17
  import { ComboboxHandlers } from './combobox-handlers'
18
+ import type { IPktStringsProps } from 'shared-strings'
18
19
 
19
20
  import '../input-wrapper'
20
21
  import '../icon'
@@ -24,7 +25,7 @@ import '../listbox'
24
25
  // Re-export types for backward compatibility
25
26
  export type { IPktComboboxOption, TPktComboboxTagPlacement } from './combobox-types'
26
27
 
27
- export interface IPktCombobox {
28
+ export interface IPktCombobox extends IPktStringsProps<'combobox' | 'listbox'> {
28
29
  allowUserInput?: boolean
29
30
  typeahead?: boolean
30
31
  disabled?: boolean
@@ -8,6 +8,7 @@ import '@/components/tag'
8
8
  import { fromISOtoLocal } from 'shared-utils/date-utils'
9
9
  import { uuidish } from 'shared-utils/utils'
10
10
  import { sortDateStrings } from 'shared-utils/date-utils'
11
+ import type { IPktStringsProps } from 'shared-strings'
11
12
 
12
13
  type TYear = `${number}${number}${number}${number}`
13
14
  type TMonth = `${number}${number}`
@@ -22,7 +23,7 @@ export type TISODate = `${TYear}-${TMonth}-${TDay}`
22
23
  * https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
23
24
  */
24
25
 
25
- export class PktDateTags extends PktElement {
26
+ export class PktDateTags extends PktElement<IPktStringsProps<'datepicker'>> {
26
27
  @property({ type: Array }) dates: TISODate[] = []
27
28
  @property({ type: String }) dateformat: string = 'dd.MM.yyyy' // se kommentar over
28
29
  @property({ type: String, attribute: 'class' }) className: string = 'pkt-datepicker__tags'
@@ -31,6 +31,7 @@ import { PktDatepickerSingle } from './datepicker-single'
31
31
  import { PktDatepickerRange } from './datepicker-range'
32
32
  import { PktDatepickerMultiple } from './datepicker-multiple'
33
33
  import { ElementProps } from '@/types/typeUtils'
34
+ import type { IPktStringsProps } from 'shared-strings'
34
35
 
35
36
  type Props = ElementProps<
36
37
  PktDatepicker,
@@ -49,7 +50,8 @@ type Props = ElementProps<
49
50
  | 'currentmonth'
50
51
  | 'calendarOpen'
51
52
  | 'timezone'
52
- >
53
+ > &
54
+ IPktStringsProps<'generic' | 'datepicker' | 'dates' | 'calendar'>
53
55
 
54
56
  export class PktDatepicker extends PktInputElement<Props> {
55
57
  /**
@@ -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
  }
@@ -16,6 +16,7 @@ import type {
16
16
  THeaderMenuLocale,
17
17
  IPktHeaderGlobal as ISharedPktHeaderGlobal,
18
18
  } from 'shared-types'
19
+ import type { IPktStringsProps } from 'shared-strings'
19
20
 
20
21
  export type {
21
22
  Booleanish,
@@ -51,7 +52,7 @@ export const convertUserMenuItem = (item: UserMenuItem): TInternalMenuItem => {
51
52
  /**
52
53
  * Interface for the Header component props
53
54
  */
54
- export interface IPktHeader {
55
+ export interface IPktHeader extends IPktStringsProps<'header'> {
55
56
  /** Hide the Oslo logo */
56
57
  hideLogo?: Booleanish
57
58
  /** Logo link URL */
@@ -110,9 +111,10 @@ export interface IPktHeader {
110
111
  */
111
112
  export interface IPktHeaderGlobal
112
113
  extends Omit<
113
- ISharedPktHeaderGlobal,
114
- 'showSearch' | 'showContact' | 'canChangeRepresentation' | 'userMenu'
115
- > {
114
+ ISharedPktHeaderGlobal,
115
+ 'showSearch' | 'showContact' | 'canChangeRepresentation' | 'userMenu'
116
+ >,
117
+ IPktStringsProps<'header'> {
116
118
  /** Show the search field. Default: true */
117
119
  showSearch?: Booleanish
118
120
  /** Show the contact link (from the payload's `header.contact`). Default: true */
@@ -4,10 +4,11 @@ import { unsafeHTML } from 'lit/directives/unsafe-html.js'
4
4
  import { classMap } from 'lit/directives/class-map.js'
5
5
  import { customElement, property, state } from 'lit/decorators.js'
6
6
  import { uuidish } from 'shared-utils/utils'
7
+ import type { IPktStringsProps } from 'shared-strings'
7
8
  import '@/components/icon'
8
9
  import { slotContent } from '@/directives/slot-content'
9
10
 
10
- export class PktHelptext extends PktElementWithSlot {
11
+ export class PktHelptext extends PktElementWithSlot<IPktStringsProps<'forms'>> {
11
12
  @property({ type: String, reflect: true })
12
13
  forId: string = uuidish()
13
14
 
@@ -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'
@@ -1,7 +1,7 @@
1
1
  import { PktElementWithSlot } from '@/base-elements/element-with-slot'
2
2
  import { slotContent } from '@/directives/slot-content'
3
3
  import { counterStatusId, isCounterExceeded } from 'shared-utils/forms/described-by'
4
- import { formatString } from 'shared-strings'
4
+ import { formatString, type IPktStringsProps } from 'shared-strings'
5
5
  import { ifDefined } from 'lit/directives/if-defined.js'
6
6
  import { html, nothing, PropertyValues } from 'lit'
7
7
  import { unsafeHTML } from 'lit/directives/unsafe-html.js'
@@ -40,7 +40,8 @@ type Props = ElementProps<
40
40
  | 'hasFieldset'
41
41
  | 'useWrapper'
42
42
  | 'role'
43
- >
43
+ > &
44
+ IPktStringsProps<'forms' | 'validation'>
44
45
 
45
46
  export class PktInputWrapper extends PktElementWithSlot<Props> {
46
47
  /**
@@ -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 = {
@@ -5,6 +5,7 @@ import { PktElement } from '@/base-elements/element'
5
5
  import { repeat } from 'lit/directives/repeat.js'
6
6
  import { classMap } from 'lit/directives/class-map.js'
7
7
  import type { IPktComboboxOption } from 'shared-types/combobox'
8
+ import type { IPktStringsProps } from 'shared-strings'
8
9
  import { uuidish } from 'shared-utils/utils'
9
10
  import { filterOptionsBySearch } from 'shared-utils/combobox/option-utils'
10
11
  import {
@@ -28,7 +29,7 @@ declare global {
28
29
  }
29
30
  }
30
31
 
31
- export interface IPktListbox {
32
+ export interface IPktListbox extends IPktStringsProps<'listbox'> {
32
33
  options: IPktComboboxOption[]
33
34
  isOpen: boolean
34
35
  disabled: boolean
@@ -43,7 +44,7 @@ export interface IPktListbox {
43
44
  userMessage: string | null
44
45
  }
45
46
 
46
- export class PktListbox extends PktElement implements IPktListbox {
47
+ export class PktListbox extends PktElement<IPktListbox> implements IPktListbox {
47
48
  @property({ type: String }) id: string = uuidish()
48
49
  @property({ type: String }) label: string | null = null
49
50
  @property({ type: Array }) options: IPktComboboxOption[] = []
@@ -10,7 +10,7 @@ import '@/components/icon'
10
10
  import type { IAriaAttributes, THTMLButtonType } from 'shared-types'
11
11
  import { PktIconName } from '@oslokommune/punkt-assets/dist/icons/icon'
12
12
  import { ifDefined } from 'lit/directives/if-defined.js'
13
- import { formatString } from 'shared-strings'
13
+ import { formatString, type IPktStringsProps } from 'shared-strings'
14
14
 
15
15
  export type TTagSkin =
16
16
  | 'blue'
@@ -24,7 +24,7 @@ export type TTagSkin =
24
24
  | 'grey'
25
25
  export type TTagType = THTMLButtonType
26
26
 
27
- export interface IPktTag {
27
+ export interface IPktTag extends IPktStringsProps<'tag'> {
28
28
  closeTag?: boolean
29
29
  size?: TPktSize
30
30
  skin?: TTagSkin
@@ -6,7 +6,7 @@ import { classMap } from 'lit/directives/class-map.js'
6
6
  import { PktInputElement } from '@/base-elements/input-element'
7
7
  import { slotContent } from '@/directives/slot-content'
8
8
  import { ElementProps } from '@/types/typeUtils'
9
- import { formatString } from 'shared-strings'
9
+ import { formatString, type IPktStringsProps } from 'shared-strings'
10
10
  import { isValidTimeString, timeToMinutes } from 'shared-utils/timepicker/time-utils'
11
11
  import { getMinuteStep, getHourOptions, getMinuteOptions } from 'shared-utils/timepicker/options'
12
12
  import { stepTime } from 'shared-utils/timepicker/stepper'
@@ -14,7 +14,8 @@ import '@/components/icon'
14
14
  import '@/components/input-wrapper'
15
15
  import { TPktInputSize } from 'shared-types/size'
16
16
 
17
- type Props = ElementProps<PktTimepicker, 'value' | 'hidePicker' | 'stepArrows'>
17
+ type Props = ElementProps<PktTimepicker, 'value' | 'hidePicker' | 'stepArrows'> &
18
+ IPktStringsProps<'timepicker'>
18
19
 
19
20
  export interface IPktTimepicker {
20
21
  value?: string
@@ -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}});