@oslokommune/punkt-elements 12.18.0 → 12.18.2

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 (126) hide show
  1. package/dist/alert-BbVWu2lm.cjs +27 -0
  2. package/dist/alert-Dh6A96vo.js +159 -0
  3. package/dist/{index-D2jSRMrn.js → calendar-BUqcNvfI.js} +41 -29
  4. package/dist/calendar-QSulz7im.cjs +108 -0
  5. package/dist/card-B0GPdG5M.cjs +23 -0
  6. package/dist/card-kWt0BA2a.js +170 -0
  7. package/dist/{class-map-a5HUzP83.cjs → class-map-Boa7BqCc.cjs} +2 -2
  8. package/dist/{class-map-CBvUV2N3.js → class-map-hz16xq5a.js} +9 -10
  9. package/dist/datepicker-BhavwiBZ.js +659 -0
  10. package/dist/datepicker-vX74tb3R.cjs +154 -0
  11. package/dist/helptext--4FLdAWi.js +194 -0
  12. package/dist/helptext-iZEgxz2U.cjs +23 -0
  13. package/dist/icon-CdMQ6zBT.cjs +250 -0
  14. package/dist/{index-CFDwiDTU.js → icon-wUXeHiBk.js} +7371 -7559
  15. package/dist/if-defined-DEDlGbAc.cjs +5 -0
  16. package/dist/if-defined-ZFE4ti2t.js +10 -0
  17. package/dist/index.d.ts +49 -51
  18. package/dist/input-element-BQTCZtNQ.js +185 -0
  19. package/dist/input-element-DNklGY_O.cjs +1 -0
  20. package/dist/{input-wrapper-DVXNuxVu.js → input-wrapper-BTQk3W8T.js} +10 -11
  21. package/dist/input-wrapper-D-PNRJB_.cjs +46 -0
  22. package/dist/link-BpqavGSD.cjs +8 -0
  23. package/dist/link-Bx9nVgZi.js +108 -0
  24. package/dist/linkcard-CUrbzjLK.js +53 -0
  25. package/dist/linkcard-DSu3A4Yx.cjs +13 -0
  26. package/dist/messagebox-C1aWoQbu.cjs +12 -0
  27. package/dist/messagebox-LpiVQIoM.js +107 -0
  28. package/dist/modal-Avai5eVz.cjs +30 -0
  29. package/dist/{modal-lQfiTbGh.js → modal-Co1YFmHi.js} +7 -8
  30. package/dist/pkt-alert.cjs +1 -27
  31. package/dist/pkt-alert.js +4 -158
  32. package/dist/pkt-calendar.cjs +1 -1
  33. package/dist/pkt-calendar.js +4 -7
  34. package/dist/pkt-card.cjs +1 -23
  35. package/dist/pkt-card.js +4 -169
  36. package/dist/pkt-datepicker.cjs +1 -154
  37. package/dist/pkt-datepicker.js +4 -657
  38. package/dist/pkt-helptext.cjs +1 -1
  39. package/dist/pkt-helptext.js +1 -1
  40. package/dist/pkt-icon.cjs +1 -1
  41. package/dist/pkt-icon.js +4 -4
  42. package/dist/pkt-index.cjs +29 -1
  43. package/dist/pkt-index.js +127 -32
  44. package/dist/pkt-input-wrapper.cjs +1 -1
  45. package/dist/pkt-input-wrapper.js +1 -1
  46. package/dist/pkt-link.cjs +1 -8
  47. package/dist/pkt-link.js +4 -108
  48. package/dist/pkt-linkcard.cjs +1 -1
  49. package/dist/pkt-linkcard.js +1 -1
  50. package/dist/pkt-messagebox.cjs +1 -12
  51. package/dist/pkt-messagebox.js +4 -106
  52. package/dist/pkt-modal.cjs +1 -1
  53. package/dist/pkt-modal.js +1 -1
  54. package/dist/pkt-progressbar.cjs +1 -1
  55. package/dist/pkt-progressbar.js +2 -2
  56. package/dist/pkt-tag.cjs +1 -17
  57. package/dist/pkt-tag.js +4 -149
  58. package/dist/pkt-textarea.cjs +1 -1
  59. package/dist/pkt-textarea.js +1 -1
  60. package/dist/pkt-textinput.cjs +1 -1
  61. package/dist/pkt-textinput.js +1 -1
  62. package/dist/{progressbar-1PEs_SMc.js → progressbar-BS_oawSB.js} +42 -47
  63. package/dist/{progressbar-BlzTFI9U.cjs → progressbar-CuXkbAhJ.cjs} +7 -11
  64. package/dist/ref-DCOsLZQg.cjs +13 -0
  65. package/dist/{ref-Dzme4zb6.js → ref-DuFGTLVX.js} +26 -27
  66. package/dist/state-BfyXV7EL.js +12 -0
  67. package/dist/state-SKYD8kRO.cjs +5 -0
  68. package/dist/stringutils-CkVRq4jP.cjs +1 -0
  69. package/dist/stringutils-DJjRa8dG.js +7 -0
  70. package/dist/tag-CGy2mSLE.cjs +17 -0
  71. package/dist/tag-DGFgUF3l.js +150 -0
  72. package/dist/textarea-BFWHQHLs.cjs +48 -0
  73. package/dist/{textarea-BXzQA_ub.js → textarea-BYtGXst8.js} +29 -29
  74. package/dist/{textinput-52G3CfwA.cjs → textinput-33wZwZ4O.cjs} +2 -2
  75. package/dist/{textinput-CTNWiIaP.js → textinput-IgHewJDJ.js} +23 -23
  76. package/package.json +2 -2
  77. package/src/components/alert/alert.ts +115 -0
  78. package/src/components/alert/index.ts +4 -113
  79. package/src/components/calendar/calendar.ts +711 -0
  80. package/src/components/calendar/index.ts +3 -711
  81. package/src/components/card/card.ts +78 -0
  82. package/src/components/card/index.ts +4 -77
  83. package/src/components/datepicker/datepicker.ts +619 -0
  84. package/src/components/datepicker/index.ts +3 -618
  85. package/src/components/helptext/helptext.ts +2 -2
  86. package/src/components/icon/icon.ts +99 -0
  87. package/src/components/icon/index.ts +3 -98
  88. package/src/components/index.ts +21 -17
  89. package/src/components/input-wrapper/input-wrapper.ts +2 -2
  90. package/src/components/link/index.ts +3 -56
  91. package/src/components/link/link.ts +57 -0
  92. package/src/components/linkcard/index.ts +1 -1
  93. package/src/components/linkcard/linkcard.ts +5 -6
  94. package/src/components/messagebox/index.ts +4 -69
  95. package/src/components/messagebox/messagebox.ts +69 -0
  96. package/src/components/modal/index.ts +0 -1
  97. package/src/components/modal/modal.ts +5 -7
  98. package/src/components/progressbar/progressbar.ts +2 -2
  99. package/src/components/tag/index.ts +4 -109
  100. package/src/components/tag/tag.ts +118 -0
  101. package/src/components/textarea/textarea.ts +5 -4
  102. package/src/components/textinput/textinput.ts +3 -3
  103. package/dist/component-template.d.ts +0 -8
  104. package/dist/converters-DNCwIFwr.js +0 -17
  105. package/dist/converters-DhM11VlY.cjs +0 -1
  106. package/dist/custom-element-B-TlBwRu.cjs +0 -9
  107. package/dist/custom-element-CWfU4dcr.js +0 -38
  108. package/dist/element.d.ts +0 -8
  109. package/dist/helptext-DBolvFI4.js +0 -72
  110. package/dist/helptext-_fMLOOCL.cjs +0 -23
  111. package/dist/index-CR7t1zY9.cjs +0 -238
  112. package/dist/index-CmTjXoAb.cjs +0 -9
  113. package/dist/index-RwtTBIhT.js +0 -88
  114. package/dist/index-tvpcg-ad.cjs +0 -108
  115. package/dist/input-wrapper-tJE-X4Ac.cjs +0 -46
  116. package/dist/linkcard-BHokvuVN.js +0 -55
  117. package/dist/linkcard-CUXMP6BH.cjs +0 -13
  118. package/dist/modal-CjsQgmmH.cjs +0 -30
  119. package/dist/pkt-component-template.cjs +0 -29
  120. package/dist/pkt-component-template.js +0 -100
  121. package/dist/pkt-element.cjs +0 -1
  122. package/dist/pkt-element.js +0 -5
  123. package/dist/ref-CA2-0S_W.cjs +0 -13
  124. package/dist/textarea-D_ud1Mpa.cjs +0 -48
  125. package/src/components/component-template/index.ts +0 -129
  126. package/src/components/element/index.ts +0 -353
@@ -1,113 +1,4 @@
1
- import { classMap } from 'lit/directives/class-map.js'
2
- import { customElement, property, state } from 'lit/decorators.js'
3
- import { html, nothing, PropertyValues } from 'lit'
4
- import { PktElement } from '../element'
5
- import { PktSlotController } from '@/controllers/pkt-slot-controller'
6
- import { ref, createRef, Ref } from 'lit/directives/ref.js'
7
-
8
- import specs from 'componentSpecs/alert.json'
9
-
10
- import '../icon'
11
-
12
- type AlertSkin = 'error' | 'success' | 'warning' | 'info'
13
- type AlertAriaLive = 'off' | 'polite' | 'assertive' | null
14
- export interface IPktAlert {
15
- skin?: AlertSkin
16
- closeAlert?: boolean
17
- title?: string
18
- date?: string
19
- ariaLive?: AlertAriaLive
20
- 'aria-live'?: AlertAriaLive
21
- compact?: boolean
22
- }
23
- @customElement('pkt-alert')
24
- export class PktAlert extends PktElement {
25
- defaultSlot: Ref<HTMLElement> = createRef()
26
-
27
- constructor() {
28
- super()
29
- this.slotController = new PktSlotController(this, this.defaultSlot)
30
- this._isClosed = false
31
- }
32
-
33
- @property({ type: Boolean, reflect: false }) compact = specs.props.compact.default
34
- @property({ type: String, reflect: true }) title: string = ''
35
- @property({ type: String, reflect: true }) skin: AlertSkin = specs.props.skin.default as AlertSkin
36
- @property({ type: String }) ariaLive: AlertAriaLive = specs.props.ariaLive
37
- .default as AlertAriaLive
38
- @property({ type: String, reflect: true }) 'aria-live': AlertAriaLive = null
39
- @property({ type: Boolean, reflect: true }) closeAlert = specs.props.closeAlert.default
40
- @property({ type: String, reflect: true }) date: string | null = null
41
-
42
- @state() _isClosed: boolean = false
43
-
44
- private close = (event: MouseEvent) => {
45
- this._isClosed = true
46
- this.dispatchEvent(
47
- new CustomEvent('close', { detail: { origin: event }, bubbles: true, composed: true }),
48
- )
49
- // Historical support of old Vue implementations…
50
- this.dispatchEvent(
51
- new CustomEvent('on-close', { detail: { origin: event }, bubbles: true, composed: true }),
52
- )
53
- }
54
-
55
- connectedCallback(): void {
56
- super.connectedCallback()
57
- this['aria-live'] = (this.getAttribute('aria-live') as AlertAriaLive) || this.ariaLive
58
- }
59
-
60
- attributeChangedCallback(name: string, _old: string | null, value: string | null): void {
61
- if (name === 'ariaLive') {
62
- this['aria-live'] = value as AlertAriaLive
63
- }
64
- }
65
-
66
- protected updated(_changedProperties: PropertyValues): void {
67
- super.updated(_changedProperties)
68
- if (_changedProperties.has('ariaLive')) {
69
- this['aria-live'] = this.ariaLive
70
- }
71
- }
72
-
73
- render() {
74
- const classes = {
75
- 'pkt-alert': true,
76
- 'pkt-alert--compact': this.compact,
77
- [`pkt-alert--${this.skin}`]: this.skin,
78
- 'pkt-hide': this._isClosed,
79
- }
80
-
81
- return html`
82
- <div class=${classMap(classes)}>
83
- <pkt-icon
84
- class="pkt-alert__icon"
85
- name=${this.skin === 'info' ? 'alert-information' : `alert-${this.skin}`}
86
- ></pkt-icon>
87
-
88
- ${this.closeAlert
89
- ? html`
90
- <div class="pkt-alert__close">
91
- <button
92
- type="button"
93
- class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only"
94
- tabindex="0"
95
- aria-label="close"
96
- @click=${this.close}
97
- >
98
- <pkt-icon name="close" class="pkt-btn__icon" aria-hidden="true"></pkt-icon>
99
- </button>
100
- </div>
101
- `
102
- : nothing}
103
- ${this.title ? html`<div class="pkt-alert__title">${this.title}</div>` : nothing}
104
-
105
- <div class="pkt-alert__text" ${ref(this.defaultSlot)}></div>
106
-
107
- ${this.date
108
- ? html`<div class="pkt-alert__date">Sist oppdatert: ${this.date}</div>`
109
- : nothing}
110
- </div>
111
- `
112
- }
113
- }
1
+ import { PktAlert } from './alert'
2
+ import type { IPktAlert, TAlertSkin } from './alert'
3
+ export { PktAlert, IPktAlert, TAlertSkin }
4
+ export default PktAlert