@oslokommune/punkt-elements 19.20.0 → 20.0.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 (169) hide show
  1. package/CHANGELOG.md +59 -0
  2. package/dist/{alert-UbQzzkXb.js → alert-CA1fDbyc.js} +2 -2
  3. package/dist/{alert-KxCE28nq.cjs → alert-DkyTTo7S.cjs} +1 -1
  4. package/dist/{backlink-bbYpIZJI.js → backlink-CDBRcaAu.js} +1 -1
  5. package/dist/{backlink-CqRcFURx.cjs → backlink-CXOxMeyt.cjs} +1 -1
  6. package/dist/{breadcrumbs-D7gddV5F.js → breadcrumbs-5oUaCef3.js} +1 -1
  7. package/dist/{breadcrumbs-C_JR4ZI_.cjs → breadcrumbs-zfUto2U5.cjs} +1 -1
  8. package/dist/{button-BJ6QLwxJ.js → button-Bswo1C0M.js} +1 -1
  9. package/dist/{button-pFlrTF2P.cjs → button-bVWAX98x.cjs} +1 -1
  10. package/dist/{calendar-CYsQEfZn.js → calendar-BOd-9PDd.js} +1 -1
  11. package/dist/{calendar-Fk5ubNGR.cjs → calendar-CDTCgTJn.cjs} +1 -1
  12. package/dist/{card-CKu696QC.js → card-DH1kPnyi.js} +40 -38
  13. package/dist/card-njWrvrHm.cjs +67 -0
  14. package/dist/{checkbox-BLmQSdWB.js → checkbox-DIJbuqWm.js} +1 -1
  15. package/dist/{checkbox-group-DFKzbaHC.js → checkbox-group-DLLbWgQb.js} +2 -2
  16. package/dist/{checkbox-group-B9TtWVpG.cjs → checkbox-group-Kua6HuRE.cjs} +1 -1
  17. package/dist/{checkbox-PAtsn1TO.cjs → checkbox-iMOdzpJ_.cjs} +1 -1
  18. package/dist/{combobox-CJAmzQFD.cjs → combobox-BwAxmoG9.cjs} +1 -1
  19. package/dist/{combobox-KnYdXXRm.js → combobox-H5FLG8BV.js} +3 -3
  20. package/dist/components/card/card.d.ts +0 -10
  21. package/dist/components/card/index.d.ts +2 -2
  22. package/dist/components/link/link.d.ts +1 -1
  23. package/dist/components/linkcard/linkcard.d.ts +0 -1
  24. package/dist/components/tabs/tabitem.d.ts +2 -1
  25. package/dist/components/tag/tag.d.ts +4 -2
  26. package/dist/{consent-BjWx64Gv.cjs → consent-UkinU27V.cjs} +1 -1
  27. package/dist/{consent-CeJKY2EB.js → consent-p-0n2b9x.js} +1 -1
  28. package/dist/{datepicker-IMxHS-ex.cjs → datepicker-COar3rRT.cjs} +1 -1
  29. package/dist/{datepicker-Cco0rRLa.js → datepicker-ZSwWg8xW.js} +4 -4
  30. package/dist/{fileupload-CjqIhSJ1.cjs → fileupload-DXJtAagE.cjs} +1 -1
  31. package/dist/{fileupload-BrSWPUcy.js → fileupload-vPDmtXiM.js} +4 -4
  32. package/dist/{footer-BJCxJUW9.cjs → footer-CpE05IW2.cjs} +1 -1
  33. package/dist/{footer-DQq09VjI.js → footer-D8t0PCPC.js} +2 -2
  34. package/dist/{header-C_BUBeOQ.js → header-Bo8uvddg.js} +6 -6
  35. package/dist/{header-_KjqW2oJ.cjs → header-DzYKgl-k.cjs} +1 -1
  36. package/dist/{header-menu-BV0XlRez.js → header-menu-BrjsNjBH.js} +1 -1
  37. package/dist/{header-menu-BiW5cNun.cjs → header-menu-Dq9lwNr1.cjs} +1 -1
  38. package/dist/{helptext-CL1vxEaL.js → helptext-BFQzrOw4.js} +1 -1
  39. package/dist/{helptext-B4h3Xlqa.cjs → helptext-Bse1LpRd.cjs} +1 -1
  40. package/dist/icon-5A378_yh.cjs +1 -0
  41. package/dist/{icon-C82IxnSO.js → icon-C1oCGwEe.js} +1 -1
  42. package/dist/{input-wrapper-BNu6kOOn.cjs → input-wrapper-C_Rzwxx7.cjs} +2 -2
  43. package/dist/{input-wrapper-DowJHbGF.js → input-wrapper-DkpJS1hR.js} +4 -4
  44. package/dist/{link-DqPFlWxz.cjs → link-B7t4iOKk.cjs} +3 -3
  45. package/dist/{link-D9kjggXZ.js → link-DZgG_8Ni.js} +12 -7
  46. package/dist/linkcard-DIG6VYpl.cjs +15 -0
  47. package/dist/{linkcard-BEmG-2lN.js → linkcard-Dr-r8jBO.js} +22 -18
  48. package/dist/{loader-lDVe6rUf.js → loader-CFidlqSG.js} +1 -1
  49. package/dist/{loader-C4fbS8vr.cjs → loader-DTIrOtTo.cjs} +1 -1
  50. package/dist/messagebox-BLYx3AL7.cjs +16 -0
  51. package/dist/{messagebox-C8dsqW20.js → messagebox-B_07P0QA.js} +22 -13
  52. package/dist/{modal-EgQREcb8.cjs → modal-BvTfLfFq.cjs} +1 -1
  53. package/dist/{modal-D389hSbe.js → modal-CA_M2Ix6.js} +1 -1
  54. package/dist/{option-group-element-DhYJmGgW.cjs → option-group-element-CVNaBIlP.cjs} +1 -1
  55. package/dist/{option-group-element-CB0Qqev_.js → option-group-element-DzM8YznZ.js} +1 -1
  56. package/dist/pkt-alert.cjs +1 -1
  57. package/dist/pkt-alert.js +1 -1
  58. package/dist/pkt-backlink.cjs +1 -1
  59. package/dist/pkt-backlink.js +1 -1
  60. package/dist/pkt-breadcrumbs.cjs +1 -1
  61. package/dist/pkt-breadcrumbs.js +1 -1
  62. package/dist/pkt-button.cjs +1 -1
  63. package/dist/pkt-button.js +1 -1
  64. package/dist/pkt-calendar.cjs +1 -1
  65. package/dist/pkt-calendar.js +1 -1
  66. package/dist/pkt-card.cjs +1 -1
  67. package/dist/pkt-card.js +1 -1
  68. package/dist/pkt-checkbox-group.cjs +1 -1
  69. package/dist/pkt-checkbox-group.js +1 -1
  70. package/dist/pkt-checkbox.cjs +1 -1
  71. package/dist/pkt-checkbox.js +1 -1
  72. package/dist/pkt-combobox.cjs +1 -1
  73. package/dist/pkt-combobox.js +1 -1
  74. package/dist/pkt-consent.cjs +1 -1
  75. package/dist/pkt-consent.js +1 -1
  76. package/dist/pkt-datepicker.cjs +1 -1
  77. package/dist/pkt-datepicker.js +1 -1
  78. package/dist/pkt-fileupload.cjs +1 -1
  79. package/dist/pkt-fileupload.js +1 -1
  80. package/dist/pkt-footer.cjs +1 -1
  81. package/dist/pkt-footer.js +1 -1
  82. package/dist/pkt-header-menu.cjs +1 -1
  83. package/dist/pkt-header-menu.js +1 -1
  84. package/dist/pkt-header.cjs +1 -1
  85. package/dist/pkt-header.js +1 -1
  86. package/dist/pkt-helptext.cjs +1 -1
  87. package/dist/pkt-helptext.js +1 -1
  88. package/dist/pkt-icon.cjs +1 -1
  89. package/dist/pkt-icon.js +1 -1
  90. package/dist/pkt-index.cjs +1 -1
  91. package/dist/pkt-index.js +35 -35
  92. package/dist/pkt-input-wrapper.cjs +1 -1
  93. package/dist/pkt-input-wrapper.js +1 -1
  94. package/dist/pkt-link.cjs +1 -1
  95. package/dist/pkt-link.js +1 -1
  96. package/dist/pkt-linkcard.cjs +1 -1
  97. package/dist/pkt-linkcard.js +1 -1
  98. package/dist/pkt-loader.cjs +1 -1
  99. package/dist/pkt-loader.js +1 -1
  100. package/dist/pkt-messagebox.cjs +1 -1
  101. package/dist/pkt-messagebox.js +1 -1
  102. package/dist/pkt-modal.cjs +1 -1
  103. package/dist/pkt-modal.js +1 -1
  104. package/dist/pkt-radio-group.cjs +1 -1
  105. package/dist/pkt-radio-group.js +1 -1
  106. package/dist/pkt-radiobutton.cjs +1 -1
  107. package/dist/pkt-radiobutton.js +1 -1
  108. package/dist/pkt-searchinput.cjs +1 -1
  109. package/dist/pkt-searchinput.js +1 -1
  110. package/dist/pkt-select.cjs +1 -1
  111. package/dist/pkt-select.js +1 -1
  112. package/dist/pkt-tabs.cjs +1 -1
  113. package/dist/pkt-tabs.js +1 -1
  114. package/dist/pkt-tag.cjs +1 -1
  115. package/dist/pkt-tag.js +1 -1
  116. package/dist/pkt-textarea.cjs +1 -1
  117. package/dist/pkt-textarea.js +1 -1
  118. package/dist/pkt-textinput.cjs +1 -1
  119. package/dist/pkt-textinput.js +1 -1
  120. package/dist/pkt-timepicker.cjs +1 -1
  121. package/dist/pkt-timepicker.js +1 -1
  122. package/dist/{radio-group-CSs8YnEO.js → radio-group-BRY_74od.js} +2 -2
  123. package/dist/{radio-group-DRNGFfUh.cjs → radio-group-CsUgnEv0.cjs} +1 -1
  124. package/dist/{radiobutton-Be66H6On.cjs → radiobutton-CQhuG2lj.cjs} +1 -1
  125. package/dist/{radiobutton-BN67oAvC.js → radiobutton-lHnq8wX_.js} +1 -1
  126. package/dist/{searchinput-B26-Xp00.js → searchinput-BLGaXkP6.js} +1 -1
  127. package/dist/{searchinput-Trn6uU2J.cjs → searchinput-TAqMUJ0B.cjs} +1 -1
  128. package/dist/{select-DZftfjQt.js → select-BvtUxW0Q.js} +1 -1
  129. package/dist/{select-o6iuy9hC.cjs → select-Dle67Uwv.cjs} +1 -1
  130. package/dist/shared-types/card.d.ts +5 -17
  131. package/dist/shared-types/combobox.d.ts +3 -3
  132. package/dist/shared-types/icon.d.ts +2 -2
  133. package/dist/shared-types/index.d.ts +9 -8
  134. package/dist/shared-types/linkcard.d.ts +7 -4
  135. package/dist/shared-types/messagebox.d.ts +4 -2
  136. package/dist/shared-types/skin.d.ts +8 -2
  137. package/dist/{tabs-Bu9PP33-.js → tabs-Bu_-WfCK.js} +1 -1
  138. package/dist/{tabs-gRjrFqeG.cjs → tabs-Dwk5PKzP.cjs} +1 -1
  139. package/dist/tag-1SSexs0H.cjs +27 -0
  140. package/dist/{tag-CtdOrK18.js → tag-CkZ2Mn4a.js} +29 -7
  141. package/dist/{textarea-Cc2aQLbm.cjs → textarea-DSX3jMlI.cjs} +1 -1
  142. package/dist/{textarea-DP7GVL2c.js → textarea-Djp5L2Zd.js} +2 -2
  143. package/dist/{textinput-Dhwotaxv.js → textinput-CBrOZcvL.js} +2 -2
  144. package/dist/{textinput-B6FPNOJB.cjs → textinput-CN2F3Q3H.cjs} +1 -1
  145. package/dist/{timepicker-DxwQ7-Bl.js → timepicker-CT4wfrgQ.js} +2 -2
  146. package/dist/{timepicker-Ce9hXP0B.cjs → timepicker-CkaJkIGn.cjs} +1 -1
  147. package/package.json +3 -3
  148. package/src/components/card/card.test.ts +50 -53
  149. package/src/components/card/card.ts +14 -24
  150. package/src/components/card/index.ts +2 -2
  151. package/src/components/checkbox/checkbox.test.ts +3 -3
  152. package/src/components/checkbox/checkbox.ts +1 -1
  153. package/src/components/input-wrapper/input-wrapper.ts +1 -1
  154. package/src/components/link/link.test.ts +14 -18
  155. package/src/components/link/link.ts +2 -3
  156. package/src/components/linkcard/linkcard.test.ts +18 -6
  157. package/src/components/linkcard/linkcard.ts +5 -7
  158. package/src/components/messagebox/messagebox.test.ts +14 -1
  159. package/src/components/messagebox/messagebox.ts +13 -2
  160. package/src/components/radiobutton/radiobutton.test.ts +1 -1
  161. package/src/components/radiobutton/radiobutton.ts +1 -1
  162. package/src/components/tabs/tabitem.ts +6 -2
  163. package/src/components/tag/tag.test.ts +21 -12
  164. package/src/components/tag/tag.ts +12 -3
  165. package/dist/card-Da0JkVcv.cjs +0 -64
  166. package/dist/icon-B3YGHHa7.cjs +0 -1
  167. package/dist/linkcard-BMJvjo7R.cjs +0 -14
  168. package/dist/messagebox-DFaDuvHQ.cjs +0 -13
  169. package/dist/tag-BgHEzLM3.cjs +0 -27
@@ -72,7 +72,11 @@ describe('PktMessagebox', () => {
72
72
  expect(messagebox.closable).toBe(false)
73
73
  expect(messagebox.compact).toBe(false)
74
74
  expect(messagebox.title).toBe('')
75
- expect(messagebox.skin).toBe('beige')
75
+ expect(messagebox.skin).toBe('gray')
76
+
77
+ const messageboxDiv = messagebox.querySelector('.pkt-messagebox')
78
+ expect(messageboxDiv?.classList.contains('pkt-messagebox--gray')).toBe(true)
79
+ expect(messageboxDiv?.hasAttribute('data-mode')).toBe(false)
76
80
  })
77
81
 
78
82
  test('sets properties correctly', async () => {
@@ -91,6 +95,15 @@ describe('PktMessagebox', () => {
91
95
  })
92
96
 
93
97
  describe('Skin variants', () => {
98
+ test('keeps light-only skins in light mode', async () => {
99
+ for (const skin of ['beige', 'blue', 'red', 'green'] as const) {
100
+ const { messagebox } = await createMessageboxTest({ skin })
101
+
102
+ const messageboxDiv = messagebox.querySelector('.pkt-messagebox')
103
+ expect(messageboxDiv?.getAttribute('data-mode')).toBe('light')
104
+ }
105
+ })
106
+
94
107
  test('applies beige skin correctly', async () => {
95
108
  const { messagebox } = await createMessageboxTest({ skin: 'beige' })
96
109
 
@@ -2,11 +2,17 @@ import { PktElementWithSlot } from '@/base-elements/element-with-slot'
2
2
  import { slotContent } from '@/directives/slot-content'
3
3
  import { html, nothing, PropertyValues } from 'lit'
4
4
  import { classMap } from 'lit/directives/class-map.js'
5
+ import { ifDefined } from 'lit/directives/if-defined.js'
5
6
  import { customElement, property, state } from 'lit/decorators.js'
6
7
 
7
8
  import '@/components/icon'
8
9
  import { updateClassAttribute } from '@/utils/classutils'
9
- import { MESSAGEBOX_DEFAULTS, type IPktMessageboxBase, type TMessageboxSkin } from 'shared-types'
10
+ import {
11
+ MESSAGEBOX_DEFAULTS,
12
+ MESSAGEBOX_LIGHT_ONLY_SKINS,
13
+ type IPktMessageboxBase,
14
+ type TMessageboxSkin,
15
+ } from 'shared-types'
10
16
 
11
17
  export type { TMessageboxSkin }
12
18
 
@@ -48,7 +54,12 @@ export class PktMessagebox extends PktElementWithSlot implements IPktMessagebox
48
54
  'pkt-hide': this._isClosed,
49
55
  }
50
56
 
51
- return html`<div class=${classMap(classes)}>
57
+ return html`<div
58
+ class=${classMap(classes)}
59
+ data-mode=${ifDefined(
60
+ this.skin && MESSAGEBOX_LIGHT_ONLY_SKINS.includes(this.skin) ? 'light' : undefined,
61
+ )}
62
+ >
52
63
  ${this.closable
53
64
  ? html`<div class="pkt-messagebox__close">
54
65
  <button
@@ -187,7 +187,7 @@ describe('pkt-radiobutton', () => {
187
187
  optionalTag: true,
188
188
  })
189
189
 
190
- const tag = radiobutton.querySelector('.pkt-tag--blue-light')
190
+ const tag = radiobutton.querySelector('.pkt-tag--blue-pale')
191
191
  expect(tag).toBeInTheDocument()
192
192
  expect(tag?.textContent).toBe('Valgfritt')
193
193
  })
@@ -97,7 +97,7 @@ export class PktRadioButton extends PktInputElement<Props> implements IPktRadioB
97
97
  }
98
98
  ${
99
99
  this.optionalTag
100
- ? html`<span class=${tagClasses + ' pkt-tag--blue-light'}
100
+ ? html`<span class=${tagClasses + ' pkt-tag--blue-pale'}
101
101
  >${this.optionalText ?? formStrings.optional}</span
102
102
  >`
103
103
  : nothing
@@ -6,9 +6,10 @@ import { consume } from '@lit/context'
6
6
  import { createRef, Ref, ref } from 'lit/directives/ref.js'
7
7
  import { ifDefined } from 'lit/directives/if-defined.js'
8
8
  import { tabsContext, type TabsContext } from './tabs-context'
9
+ import type { TTagSkin } from 'shared-types'
9
10
  import '@/components/tag'
10
11
 
11
- export type TSkin = 'blue' | 'green' | 'red' | 'beige' | 'yellow' | 'grey' | 'gray' | 'blue-light'
12
+ export type TSkin = TTagSkin
12
13
 
13
14
  export interface IPktTabItem {
14
15
  active?: boolean
@@ -85,7 +86,10 @@ export class PktTabItem extends PktElementWithSlot<IPktTabItem> implements IPktT
85
86
  render() {
86
87
  const useArrowNav = this.context?.useArrowNav ?? true
87
88
  const isActive = this.active && !this.disabled
88
- const commonClasses = [isActive ? 'active' : '', this.disabled ? 'pkt-tabs__item--disabled' : '']
89
+ const commonClasses = [
90
+ isActive ? 'active' : '',
91
+ this.disabled ? 'pkt-tabs__item--disabled' : '',
92
+ ]
89
93
  .filter(Boolean)
90
94
  .join(' ')
91
95
  const role = useArrowNav ? 'tab' : undefined
@@ -2,6 +2,7 @@ import '@testing-library/jest-dom'
2
2
  import { axe, toHaveNoViolations } from 'jest-axe'
3
3
  import { fireEvent } from '@testing-library/dom'
4
4
  import { vi } from 'vitest'
5
+ import { TAG_SKINS, TAG_STATES } from 'shared-types'
5
6
  import { createElementTest, BaseTestConfig } from '../../tests/test-framework'
6
7
  import { CustomElementFor } from '../../tests/component-registry'
7
8
  import { type IPktTag } from './tag'
@@ -25,17 +26,8 @@ export const createTagTest = async (config: TagTestConfig = {}) => {
25
26
  expect.extend(toHaveNoViolations)
26
27
 
27
28
  // Test data constants
28
- const VALID_SKINS = [
29
- 'blue',
30
- 'blue-dark',
31
- 'blue-light',
32
- 'green',
33
- 'red',
34
- 'yellow',
35
- 'beige',
36
- 'gray',
37
- 'grey',
38
- ] as const
29
+ const VALID_SKINS = TAG_SKINS
30
+ const VALID_STATES = TAG_STATES
39
31
  const VALID_SIZES = ['small', 'medium', 'large'] as const
40
32
  const VALID_TYPES = ['button', 'reset', 'submit'] as const
41
33
 
@@ -54,7 +46,8 @@ describe('PktTag', () => {
54
46
  const { tag } = await createTagTest()
55
47
  expect(tag.closeTag).toBe(false)
56
48
  expect(tag.size).toBe('medium')
57
- expect(tag.skin).toBe('blue')
49
+ expect(tag.skin).toBe('gray')
50
+ expect(tag.state).toBe(null)
58
51
  expect(tag.type).toBe('button')
59
52
  })
60
53
 
@@ -76,6 +69,22 @@ describe('PktTag', () => {
76
69
  })
77
70
  })
78
71
 
72
+ describe('Forced States', () => {
73
+ test('applies forced state classes correctly', async () => {
74
+ for (const state of VALID_STATES) {
75
+ const { tag } = await createTagTest({ state })
76
+ const tagElement = tag.querySelector('span') || tag.querySelector('button')
77
+ expect(tagElement).toHaveClass(`pkt-tag--${state}`)
78
+ }
79
+ })
80
+
81
+ test('applies no state class by default', async () => {
82
+ const { tag } = await createTagTest()
83
+ const tagElement = tag.querySelector('span')
84
+ expect(tagElement?.className).not.toContain('pkt-tag--null')
85
+ })
86
+ })
87
+
79
88
  describe('Size Variations', () => {
80
89
  test('applies different size classes correctly', async () => {
81
90
  for (const size of VALID_SIZES) {
@@ -6,19 +6,25 @@ import { getSlotManager, slotContent } from '@/directives/slot-content'
6
6
  import specs from 'componentSpecs/tag.json'
7
7
 
8
8
  import '@/components/icon'
9
- import type { IAriaAttributes, THTMLButtonType, TPktSizeBase } from 'shared-types'
9
+ import type {
10
+ IAriaAttributes,
11
+ THTMLButtonType,
12
+ TTagSkin,
13
+ TTagState,
14
+ TPktSizeBase,
15
+ } from 'shared-types'
10
16
  import { PktIconName } from '@oslokommune/punkt-assets/dist/icons/icon'
11
17
  import { ifDefined } from 'lit/directives/if-defined.js'
12
18
  import { formatString, type IPktStringsProps } from 'shared-strings'
13
19
 
14
- export type TTagSkin =
15
- 'blue' | 'blue-dark' | 'blue-light' | 'green' | 'red' | 'yellow' | 'beige' | 'gray' | 'grey'
20
+ export type { TTagSkin, TTagState }
16
21
  export type TTagType = THTMLButtonType
17
22
 
18
23
  export interface IPktTag extends IPktStringsProps<'tag'> {
19
24
  closeTag?: boolean
20
25
  size?: TPktSizeBase
21
26
  skin?: TTagSkin
27
+ state?: TTagState | null
22
28
  textStyle?: string | null
23
29
  iconName?: PktIconName
24
30
  type?: TTagType
@@ -38,6 +44,7 @@ export class PktTag extends PktElementWithSlot<IPktTag> implements IPktTag {
38
44
  @property({ type: String, reflect: true }) size: TPktSizeBase = specs.props.size
39
45
  .default as TPktSizeBase
40
46
  @property({ type: String, reflect: true }) skin: TTagSkin = specs.props.skin.default as TTagSkin
47
+ @property({ type: String, reflect: true }) state: TTagState | null = null
41
48
  @property({ type: String, reflect: true }) textStyle: string | null = null
42
49
  @property({ type: String, reflect: true }) iconName: string | undefined = undefined
43
50
  @property({ type: String }) type: TTagType = specs.props.type.default as TTagType
@@ -89,6 +96,7 @@ export class PktTag extends PktElementWithSlot<IPktTag> implements IPktTag {
89
96
  'pkt-tag': true,
90
97
  [`pkt-tag--${this.size}`]: !!this.size,
91
98
  [`pkt-tag--${this.skin}`]: !!this.skin,
99
+ [`pkt-tag--${this.state}`]: !!this.state,
92
100
  [`pkt-tag--${this.textStyle}`]: !!this.textStyle,
93
101
  }
94
102
 
@@ -97,6 +105,7 @@ export class PktTag extends PktElementWithSlot<IPktTag> implements IPktTag {
97
105
  [`pkt-tag--${this.textStyle}`]: !!this.textStyle,
98
106
  [`pkt-tag--${this.size}`]: !!this.size,
99
107
  [`pkt-tag--${this.skin}`]: !!this.skin,
108
+ [`pkt-tag--${this.state}`]: !!this.state,
100
109
  'pkt-hide': this._isClosed,
101
110
  }
102
111
 
@@ -1,64 +0,0 @@
1
- const e=require("./element-CEarCnHH.cjs"),t=require("./class-map-C82GtM1w.cjs"),n=require("./format-B8meU8Tm.cjs"),r=require("./element-with-slot-CeKuRE3_.cjs");require("./shared-types-BvRk9kiK.cjs"),require("./icon-B3YGHHa7.cjs");const i=require("./if-defined-Ci4ZQsgL.cjs");require("./tag-BgHEzLM3.cjs");var a=[`outlined`,`outlined-beige`,`gray`,`blue`,`beige`,`green`],o={headingLevel:3,layout:`vertical`,skin:`outlined`,padding:`default`,tagPosition:`top`,openLinkInNewTab:!1,borderOnHover:!0,zoom:!1,imageShape:`square`,restrictImageHeight:!1},s=class extends r.t{constructor(...e){super(...e),this.ariaLabel=``,this.metaLead=null,this.borderOnHover=o.borderOnHover,this.zoom=o.zoom,this.imageAspect=null,this.restrictImageHeight=o.restrictImageHeight,this.clickCardLink=null,this.metaTrail=null,this.layout=o.layout,this.heading=``,this.headingLevel=o.headingLevel,this.image={src:``,alt:``},this.imageShape=o.imageShape,this.openLinkInNewTab=o.openLinkInNewTab,this.padding=o.padding,this.skin=o.skin,this.subheading=``,this.tagPosition=`top`,this.tags=[]}connectedCallback(){super.connectedCallback()}render(){let n={"pkt-card":!0,[`pkt-card--${this.skin}`]:this.skin,[`pkt-card--${this.layout}`]:this.layout,[`pkt-card--padding-${this.padding}`]:this.padding,"pkt-card--border-on-hover":this.borderOnHover,"pkt-card--zoom":this.zoom},r=this.ariaLabel?.trim()||(this.heading?`${this.heading} lenkekort`:`lenkekort`),a=this.ariaLabel?.trim()||(this.heading?this.heading:`kort`);return e._`
2
- <article
3
- class=${t.t(n)}
4
- aria-label=${i.t(this.clickCardLink?r:a)}
5
- >
6
- ${this.renderImage()}
7
- <div class="pkt-card__wrapper">
8
- ${this.tagPosition===`top`?this.renderTags():e.h}
9
- ${this.renderHeader()}
10
- ${this.renderSlot()}
11
- ${this.tagPosition===`bottom`?this.renderTags():e.h}
12
- ${this.renderMetadata()}
13
- </div>
14
- </article>
15
- `}renderImage(){let n={"pkt-card__image":!0,[`pkt-card__image-${this.imageShape}`]:this.imageShape,[`pkt-card__image-aspect-${this.imageAspect}`]:!!this.imageAspect,"pkt-card__image-restricted":this.restrictImageHeight};return e._`
16
- ${this.image.src&&e._`
17
- <div class=${t.t(n)}>
18
- <img src=${this.image.src} alt=${this.image.alt||``} />
19
- </div>
20
- `}
21
- `}renderHeadingTag(t,n){let r=this.headingLevel&&this.headingLevel>=1&&this.headingLevel<=6?this.headingLevel:3,i=`pkt-heading pkt-heading--medium pkt-heading--fw-regular ${t}`;switch(r){case 1:return e._`<h1 class=${i}>${n}</h1>`;case 2:return e._`<h2 class=${i}>${n}</h2>`;case 4:return e._`<h4 class=${i}>${n}</h4>`;case 5:return e._`<h5 class=${i}>${n}</h5>`;case 6:return e._`<h6 class=${i}>${n}</h6>`;default:return e._`<h3 class=${i}>${n}</h3>`}}renderHeading(){return!this.heading||this.clickCardLink?e.h:this.renderHeadingTag(`pkt-card__heading`,this.heading)}renderLinkHeading(){return this.clickCardLink?this.renderHeadingTag(`pkt-card__link-heading pkt-card__heading`,e._`<a
22
- class="pkt-card__link"
23
- href=${this.clickCardLink}
24
- target=${this.openLinkInNewTab?`_blank`:`_self`}
25
- rel=${i.t(this.openLinkInNewTab?`noopener noreferrer`:void 0)}
26
- >${this.heading}</a
27
- >`):e.h}renderSubheading(){return e._`
28
- ${this.subheading?e._` <p class="pkt-card__subheading ">${this.subheading}</p> `:e.h}
29
- `}renderHeader(){let t=!!this.heading||!!this.subheading;return e._`
30
- ${t?e._`
31
- <header class="pkt-card__header">
32
- ${this.renderHeading()}
33
- ${this.renderLinkHeading()}
34
- ${this.renderSubheading()}
35
- </header>
36
- `:e.h}
37
- `}renderTags(){let r={"pkt-card__tags":!0,[`pkt-card__tags-${this.tagPosition}`]:this.tagPosition};return e._`
38
- ${this.tags.length>0?e._`
39
- <div
40
- class=${t.t(r)}
41
- role="list"
42
- aria-label=${n.n(this.tags.length,this.pktStrings.get(`card`).tagsLabelOne,this.pktStrings.get(`card`).tagsLabelOther)}
43
- >
44
- ${this.tags.map(t=>e._`
45
- <pkt-tag
46
- role="listitem"
47
- textStyle="normal-text"
48
- size="medium"
49
- skin=${i.t(t.skin)}
50
- iconName=${i.t(t.iconName)}
51
- >
52
- <span>${t.text}</span>
53
- </pkt-tag>
54
- `)}
55
- </div>
56
- `:e.h}
57
- `}renderSlot(){return e._`<section class="pkt-card__content">${r.i(this)}</section>`}renderMetadata(){return e._`
58
- ${this.metaLead||this.metaTrail?e._`
59
- <footer class="pkt-card__metadata">
60
- ${this.metaLead?e._`<span class="pkt-card__metadata-lead">${this.metaLead}</span>`:e.h}
61
- ${this.metaTrail?e._`<span class="pkt-card__metadata-trail">${this.metaTrail}</span>`:e.h}
62
- </footer>
63
- `:e.h}
64
- `}};e.n([e.u({type:String})],s.prototype,`ariaLabel`,void 0),e.n([e.u({type:String})],s.prototype,`metaLead`,void 0),e.n([e.u({type:Boolean})],s.prototype,`borderOnHover`,void 0),e.n([e.u({type:Boolean})],s.prototype,`zoom`,void 0),e.n([e.u({type:String})],s.prototype,`imageAspect`,void 0),e.n([e.u({type:Boolean})],s.prototype,`restrictImageHeight`,void 0),e.n([e.u({type:String,reflect:!0})],s.prototype,`clickCardLink`,void 0),e.n([e.u({type:String})],s.prototype,`metaTrail`,void 0),e.n([e.u({type:String})],s.prototype,`layout`,void 0),e.n([e.u({type:String})],s.prototype,`heading`,void 0),e.n([e.u({type:Number,attribute:`headinglevel`})],s.prototype,`headingLevel`,void 0),e.n([e.u({type:Object})],s.prototype,`image`,void 0),e.n([e.u({type:String})],s.prototype,`imageShape`,void 0),e.n([e.u({type:Boolean})],s.prototype,`openLinkInNewTab`,void 0),e.n([e.u({type:String})],s.prototype,`padding`,void 0),e.n([e.u({type:String,converter:{fromAttribute:e=>{let t=a;return e&&t.includes(e)?e:(e&&!t.includes(e)&&console.warn(`Invalid skin value "${e}". Using default skin "${o.skin}".`),o.skin)},toAttribute:e=>e}})],s.prototype,`skin`,void 0),e.n([e.u({type:String})],s.prototype,`subheading`,void 0),e.n([e.u({type:String})],s.prototype,`tagPosition`,void 0),e.n([e.u({type:Array})],s.prototype,`tags`,void 0);try{e.d(`pkt-card`)(s)}catch{console.warn(`Forsøker å definere <pkt-card>, men den er allerede definert`)}var c=s;Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return c}});
@@ -1 +0,0 @@
1
- const e=require("./element-CEarCnHH.cjs");require("./shared-types-BvRk9kiK.cjs");var t=`https://punkt-cdn.oslo.kommune.no/latest/icons/`,n=`https://punkt-cdn.oslo.kommune.no/latest/animations/`,r={name:``,path:t},i=class extends e.p{constructor(t){if(super(t),this.it=e.h,t.type!==e.m.CHILD)throw Error(this.constructor.directiveName+`() can only be used in child bindings`)}render(t){if(t===e.h||t==null)return this._t=void 0,this.it=t;if(t===e.g)return t;if(typeof t!=`string`)throw Error(this.constructor.directiveName+`() called with a non-string value`);if(t===this.it)return this._t;this.it=t;let n=[t];return n.raw=n,this._t={_$litType$:this.constructor.resultType,strings:n,values:[]}}};i.directiveName=`unsafeHTML`,i.resultType=1;var a=e.f(i),o=class extends i{};o.directiveName=`unsafeSVG`,o.resultType=2;var s=e.f(o);typeof window<`u`&&(window.pktFetch=window.pktFetch===void 0?fetch:window.pktFetch,window.pktIconPath=window.pktIconPath||r.path);var c=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"></svg>`,l={},u=2,d=1500,f=(()=>{try{return typeof Storage<`u`&&typeof sessionStorage<`u`}catch{return!1}})(),p=e=>window.pktFetch(e).then(t=>{if(!t.ok)throw Error(`Missing icon: `+e);return t.text()}),m=async(e,t=u)=>{try{return await p(e)}catch{return t>0?(await new Promise(e=>setTimeout(e,d)),m(e,t-1)):(console.error(`Failed to fetch icon: `+e),c)}},h=async(e,t)=>{let n=t+e+`.svg`;return f&&sessionStorage.getItem(n)?sessionStorage.getItem(n):n in l?l[n]:typeof window<`u`&&typeof window.pktFetch==`function`?(l[n]=m(n).then(e=>(e!==c&&f&&sessionStorage.setItem(n,e),delete l[n],e)),l[n]):c},g=class extends e.t{constructor(...e){super(...e),this.path=typeof window<`u`?window.pktIconPath:r.path,this.name=r.name,this.ariaHidden=null,this.ariaLabel=null,this.icon=s(c),this._updatedProps=[]}get effectiveAriaHidden(){return this.ariaHidden!==null&&this.ariaHidden!==void 0?this.ariaHidden===``||this.ariaHidden===`true`:!this.ariaLabel}get effectiveAriaLabel(){return this.effectiveAriaHidden?null:this.ariaLabel||this.name||null}connectedCallback(){super.connectedCallback(),this.classList.add(`pkt-icon`)}async attributeChangedCallback(e,t,n){super.attributeChangedCallback(e,t,n),(e===`name`||e===`path`)&&this.getIcon(this.name)}async updated(e){super.updated(e),(e.has(`name`)||e.has(`path`))&&this.getIcon(this.name),this.applyAriaToSvg()}applyAriaToSvg(){let e=this.querySelector(`svg`);if(!e)return;e.setAttribute(`aria-hidden`,String(this.effectiveAriaHidden));let t=this.effectiveAriaLabel;t?e.setAttribute(`aria-label`,t):e.removeAttribute(`aria-label`)}async getIcon(e=``){if(this._updatedProps.length>0){this.path||=typeof window<`u`?window.pktIconPath:r.path;try{this.icon=s(await h(this.name||``,this.path))}catch{this.icon=s(c)}this._updatedProps=[]}else this._updatedProps.includes(e)||this._updatedProps.push(e)}render(){return e._`${this.name&&this.icon}`}};e.n([e.u({type:String,reflect:!1})],g.prototype,`path`,void 0),e.n([e.u({type:String,reflect:!0})],g.prototype,`name`,void 0),e.n([e.u({type:String,attribute:`aria-hidden`,reflect:!0})],g.prototype,`ariaHidden`,void 0),e.n([e.u({type:String,attribute:`aria-label`,reflect:!0})],g.prototype,`ariaLabel`,void 0),e.n([e.u({type:SVGElement})],g.prototype,`icon`,void 0),e.n([e.u({type:Array,noAccessor:!0})],g.prototype,`_updatedProps`,void 0);try{e.d(`pkt-icon`)(g)}catch{console.warn(`Forsøker å definere <pkt-icon>, men den er allerede definert`)}var _=g;Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return _}});
@@ -1,14 +0,0 @@
1
- const e=require("./element-CEarCnHH.cjs"),t=require("./element-with-slot-CeKuRE3_.cjs");require("./icon-B3YGHHa7.cjs");const n=require("./if-defined-Ci4ZQsgL.cjs");var r=class extends t.t{constructor(...e){super(...e),this.title=``,this.href=`#`,this.iconName=``,this.external=!1,this.openInNewTab=!1,this.skin=void 0}render(){let r=[`pkt-linkcard`,this.skin&&`pkt-linkcard--${this.skin}`].filter(Boolean).join(` `),i=[`pkt-linkcard__title`,this.external&&`pkt-link pkt-link--external`].filter(Boolean).join(` `),a=this.pktStrings.get(`linkcard`),o=this.openInNewTab?a.openInNewTab:``;return e._`
2
- <a
3
- href=${this.href}
4
- class=${r}
5
- target=${this.openInNewTab?`_blank`:`_self`}
6
- rel=${n.t(this.openInNewTab?`noopener noreferrer`:void 0)}
7
- >
8
- ${this.iconName&&e._`<pkt-icon class="pkt-link__icon" name="${this.iconName}"></pkt-icon>`}
9
- ${this.title&&e._`<div class=${i}>${this.title}</div>`}
10
- ${o?e._`<span class="pkt-sr-only">${o}</span>`:``}
11
-
12
- <div class="pkt-linkcard__text">${t.i(this)}</div>
13
- </a>
14
- `}};e.n([e.u({type:String,reflect:!0})],r.prototype,`title`,void 0),e.n([e.u({type:String,reflect:!0})],r.prototype,`href`,void 0),e.n([e.u({type:String,reflect:!0})],r.prototype,`iconName`,void 0),e.n([e.u({type:Boolean,reflect:!0})],r.prototype,`external`,void 0),e.n([e.u({type:Boolean,reflect:!0})],r.prototype,`openInNewTab`,void 0),e.n([e.u({type:String,reflect:!0})],r.prototype,`skin`,void 0);try{e.d(`pkt-linkcard`)(r)}catch{console.warn(`Forsøker å definere <pkt-linkcard>, men den er allerede definert`)}var i=r;Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return i}});
@@ -1,13 +0,0 @@
1
- const e=require("./element-CEarCnHH.cjs"),t=require("./class-map-C82GtM1w.cjs"),n=require("./element-with-slot-CeKuRE3_.cjs");require("./shared-types-BvRk9kiK.cjs"),require("./icon-B3YGHHa7.cjs");const r=require("./classutils-CbklAJDe.cjs");var i={skin:`beige`,compact:!1,closable:!1},a=class extends n.t{constructor(){super(),this.closable=i.closable,this.compact=i.compact,this.title=``,this.skin=i.skin,this._isClosed=!1,this.close=e=>{this._isClosed=!0,this.dispatchEvent(new CustomEvent(`close`,{detail:{origin:e},bubbles:!0})),this.dispatchEvent(new CustomEvent(`on-close`,{detail:{origin:e},bubbles:!0}))},this._isClosed=!1}updated(e){super.updated(e),e.has(`_isClosed`)&&r.t(this,`pkt-hide`,this._isClosed)}render(){let r={"pkt-messagebox":!0,"pkt-messagebox--compact":this.compact,[`pkt-messagebox--${this.skin}`]:!!this.skin,"pkt-messagebox--closable":this.closable,"pkt-hide":this._isClosed};return e._`<div class=${t.t(r)}>
2
- ${this.closable?e._`<div class="pkt-messagebox__close">
3
- <button
4
- @click=${this.close}
5
- class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only"
6
- aria-label=${this.pktStrings.get(`generic`).close}
7
- >
8
- <pkt-icon name="close" class="pkt-link__icon"></pkt-icon>
9
- </button>
10
- </div>`:e.h}
11
- ${this.title?e._`<div class="pkt-messagebox__title">${this.title}</div>`:e.h}
12
- <div class="pkt-messagebox__text">${n.i(this)}</div>
13
- </div>`}};e.n([e.u({type:Boolean,reflect:!0})],a.prototype,`closable`,void 0),e.n([e.u({type:Boolean,reflect:!0})],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.l()],a.prototype,`_isClosed`,void 0);try{e.d(`pkt-messagebox`)(a)}catch{console.warn(`Forsøker å definere <pkt-messagebox>, 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,27 +0,0 @@
1
- const e=require("./element-CEarCnHH.cjs"),t=require("./class-map-C82GtM1w.cjs"),n=require("./format-B8meU8Tm.cjs"),r=require("./element-with-slot-CeKuRE3_.cjs");require("./icon-B3YGHHa7.cjs");const i=require("./if-defined-Ci4ZQsgL.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 r.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=r.r(this).getNodes().map(e=>e.textContent??``).join(``).trim();e&&(this._ariaDescription=n.t(this.pktStrings.get(`tag`).remove,{label:e}))}}render(){let n={"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=${i.t(this.buttonTabindex)}
6
- @click=${this.close}
7
- aria-label=${i.t(this.ariaLabel||void 0)}
8
- aria-description=${i.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>${r.i(this)}</span>
16
- <pkt-icon class="pkt-tag__close-btn" name="close"></pkt-icon>
17
- </button>
18
- `:e._`
19
- <span class=${t.t(n)}>
20
- ${this.iconName&&e._`<pkt-icon
21
- class="pkt-tag__icon"
22
- name=${this.iconName}
23
- aria-hidden="true"
24
- ></pkt-icon>`}
25
- <span>${r.i(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}});