@oslokommune/punkt-elements 18.4.0 → 18.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +25 -0
- package/dist/{accordion-4eAsO-Sr.js → accordion-D814csFx.js} +6 -6
- package/dist/{accordion-DOa5vubf.cjs → accordion-E0-pLzBq.cjs} +6 -6
- package/dist/{alert-BUpd4yWu.js → alert-DNZtr3gd.js} +39 -31
- package/dist/alert-DqM9l5as.cjs +40 -0
- package/dist/{backlink-CA5R69FX.cjs → backlink-DYO8qA9C.cjs} +1 -1
- package/dist/{button-Dk6ued7E.js → button-Drwt7Qe5.js} +28 -25
- package/dist/button-jJfzE9C7.cjs +32 -0
- package/dist/{card-DgRvtnnk.js → card-BhmJZOGh.js} +90 -70
- package/dist/card-D-1JMn_h.cjs +64 -0
- package/dist/{combobox-DuTrCV1l.js → combobox-BNstYIC5.js} +20 -20
- package/dist/{combobox-DQ0yPhEy.cjs → combobox-CRdBlMz1.cjs} +17 -17
- package/dist/components/alert/alert.d.ts +2 -0
- package/dist/components/card/card.d.ts +12 -3
- package/dist/components/linkcard/linkcard.d.ts +1 -1
- package/dist/components/loader/loader.d.ts +2 -2
- package/dist/components/messagebox/messagebox.d.ts +1 -1
- package/dist/components/progressbar/progressbar.d.ts +2 -6
- package/dist/{consent-agJtEZHc.cjs → consent-DaOFbopy.cjs} +1 -1
- package/dist/{consent-yXeRsyAl.js → consent-Yvw7gZI_.js} +1 -1
- package/dist/{datepicker-CYndy_BG.cjs → datepicker-DjvL_Nb8.cjs} +16 -16
- package/dist/{datepicker-C7KtgfDs.js → datepicker-DzTdWHkX.js} +3 -3
- package/dist/{fileupload-BcJSBp9e.js → fileupload-B8Uhfx2d.js} +24 -24
- package/dist/{fileupload-CmxozEde.cjs → fileupload-BJVYPl8u.cjs} +15 -15
- package/dist/{footer-J-fOEOj5.cjs → footer-BGC5PkLa.cjs} +1 -1
- package/dist/{footer-DSrWdWxm.js → footer-BPxKLaut.js} +2 -2
- package/dist/{header-EtPWdXaI.js → header-BPzlBRhY.js} +30 -30
- package/dist/{header-DmJiygel.cjs → header-CAqegPzW.cjs} +34 -34
- package/dist/{header-menu-DpQbRKcm.cjs → header-menu-DBy7Yrd_.cjs} +1 -1
- package/dist/{header-menu-Dgem4HO9.js → header-menu-DWiPoQ58.js} +1 -1
- package/dist/{helptext-Ds8Q9IGV.cjs → helptext-BwDhf6VB.cjs} +2 -2
- package/dist/{helptext-BzLJKMMO.js → helptext-mf-67-fv.js} +2 -2
- package/dist/{input-wrapper-DZhzHSxD.js → input-wrapper-BetB7OLQ.js} +16 -15
- package/dist/{input-wrapper-B9wREHHW.cjs → input-wrapper-CS0qrYcm.cjs} +8 -7
- package/dist/{link-CpwR3BLX.cjs → link-DXnoMJIo.cjs} +3 -3
- package/dist/{link-C9xAIILf.js → link-DkO7a3Fs.js} +3 -3
- package/dist/{linkcard-Bzv3CEw5.cjs → linkcard-2l6z1M2U.cjs} +3 -3
- package/dist/{linkcard-C6ljKc0B.js → linkcard-aVKL5JPP.js} +8 -8
- package/dist/{loader-D6dau_7w.js → loader-CRVUJ-HU.js} +1 -1
- package/dist/{loader-Bv-1vwju.cjs → loader-D23kzlaR.cjs} +1 -1
- package/dist/{messagebox-CmhjIh0n.js → messagebox-CqI6_Ah7.js} +2 -2
- package/dist/{messagebox-DNUfv2FN.cjs → messagebox-DP06cyqc.cjs} +1 -1
- package/dist/pkt-accordion.cjs +1 -1
- package/dist/pkt-accordion.js +1 -1
- package/dist/pkt-alert.cjs +1 -1
- package/dist/pkt-alert.js +1 -1
- package/dist/pkt-backlink.cjs +1 -1
- package/dist/pkt-backlink.js +1 -1
- package/dist/pkt-button.cjs +1 -1
- package/dist/pkt-button.js +1 -1
- package/dist/pkt-card.cjs +1 -1
- package/dist/pkt-card.js +1 -1
- package/dist/pkt-combobox.cjs +1 -1
- package/dist/pkt-combobox.js +1 -1
- package/dist/pkt-consent.cjs +1 -1
- package/dist/pkt-consent.js +1 -1
- package/dist/pkt-datepicker.cjs +1 -1
- package/dist/pkt-datepicker.js +1 -1
- package/dist/pkt-fileupload.cjs +1 -1
- package/dist/pkt-fileupload.js +1 -1
- package/dist/pkt-footer.cjs +1 -1
- package/dist/pkt-footer.js +1 -1
- package/dist/pkt-header-menu.cjs +1 -1
- package/dist/pkt-header-menu.js +1 -1
- package/dist/pkt-header.cjs +1 -1
- package/dist/pkt-header.js +1 -1
- package/dist/pkt-helptext.cjs +1 -1
- package/dist/pkt-helptext.js +1 -1
- package/dist/pkt-index.cjs +1 -1
- package/dist/pkt-index.js +31 -31
- package/dist/pkt-input-wrapper.cjs +1 -1
- package/dist/pkt-input-wrapper.js +1 -1
- package/dist/pkt-link.cjs +1 -1
- package/dist/pkt-link.js +1 -1
- package/dist/pkt-linkcard.cjs +1 -1
- package/dist/pkt-linkcard.js +1 -1
- package/dist/pkt-loader.cjs +1 -1
- package/dist/pkt-loader.js +1 -1
- package/dist/pkt-messagebox.cjs +1 -1
- package/dist/pkt-messagebox.js +1 -1
- package/dist/pkt-progressbar.cjs +1 -1
- package/dist/pkt-progressbar.js +1 -1
- package/dist/pkt-radiobutton.cjs +1 -1
- package/dist/pkt-radiobutton.js +1 -1
- package/dist/pkt-searchinput.cjs +1 -1
- package/dist/pkt-searchinput.js +1 -1
- package/dist/pkt-select.cjs +1 -1
- package/dist/pkt-select.js +1 -1
- package/dist/pkt-tabs.cjs +1 -1
- package/dist/pkt-tabs.js +1 -1
- package/dist/pkt-tag.cjs +1 -1
- package/dist/pkt-tag.js +1 -1
- package/dist/pkt-textarea.cjs +1 -1
- package/dist/pkt-textarea.js +1 -1
- package/dist/pkt-textinput.cjs +1 -1
- package/dist/pkt-textinput.js +1 -1
- package/dist/pkt-timepicker.cjs +1 -1
- package/dist/pkt-timepicker.js +1 -1
- package/dist/progressbar-BPHLC7ce.js +117 -0
- package/dist/progressbar-BpcsDCnG.cjs +31 -0
- package/dist/{radiobutton-B_j_nYCC.js → radiobutton-B2e9Vyp8.js} +0 -1
- package/dist/{radiobutton-DsL-FNDd.cjs → radiobutton-C3nmL9rA.cjs} +0 -1
- package/dist/{searchinput-Dm3T0tGS.cjs → searchinput-CiPB8xvh.cjs} +3 -2
- package/dist/{searchinput-D7Dd2W2z.js → searchinput-DrUcPajl.js} +14 -12
- package/dist/{select-CIGYIrl3.js → select-B7TvZGIL.js} +15 -16
- package/dist/{select-DA5ZBqbg.cjs → select-qxjHJ8bu.cjs} +13 -14
- package/dist/{tabs-DPdDkHSk.js → tabs-C_tCCdBK.js} +18 -18
- package/dist/{tabs-nvIpMwHK.cjs → tabs-DBanbSG1.cjs} +15 -15
- package/dist/tag-BDlwKjgT.cjs +27 -0
- package/dist/{tag-DBCzfbPE.js → tag-CdiDs9zb.js} +10 -10
- package/dist/{textarea-CST8hYg2.cjs → textarea-DgFwd2LY.cjs} +10 -10
- package/dist/{textarea-BqK3V7uZ.js → textarea-YL6JYsB5.js} +14 -14
- package/dist/{textinput-DByVORsj.cjs → textinput-CIxMtaIo.cjs} +10 -10
- package/dist/{textinput-B3xYwLt3.js → textinput-CrJYDOHb.js} +12 -12
- package/dist/{timepicker-DZwmwpWM.js → timepicker-BHWOqlr8.js} +11 -11
- package/dist/{timepicker-Boj-9I40.cjs → timepicker-avaMu1hN.cjs} +8 -8
- package/package.json +3 -3
- package/src/components/accordion/accordion.ts +2 -1
- package/src/components/alert/alert.test.ts +2 -1
- package/src/components/alert/alert.ts +21 -3
- package/src/components/button/button.test.ts +0 -2
- package/src/components/button/button.ts +32 -23
- package/src/components/card/card.test.ts +7 -7
- package/src/components/card/card.ts +99 -80
- package/src/components/helptext/helptext.ts +2 -2
- package/src/components/input-wrapper/input-wrapper.ts +1 -0
- package/src/components/link/link.ts +4 -2
- package/src/components/linkcard/linkcard.test.ts +3 -3
- package/src/components/linkcard/linkcard.ts +1 -1
- package/src/components/loader/loader.test.ts +1 -1
- package/src/components/loader/loader.ts +3 -3
- package/src/components/messagebox/messagebox.test.ts +1 -1
- package/src/components/messagebox/messagebox.ts +2 -2
- package/src/components/progressbar/progressbar.test.ts +10 -8
- package/src/components/progressbar/progressbar.ts +63 -84
- package/src/components/radiobutton/radiobutton.ts +0 -1
- package/src/components/searchinput/searchinput.ts +3 -1
- package/src/components/select/select.test.ts +2 -1
- package/src/components/select/select.ts +0 -1
- package/dist/alert-BYDWYgyL.cjs +0 -35
- package/dist/button-C5BYwmoo.cjs +0 -30
- package/dist/card-DMKvuvNv.cjs +0 -87
- package/dist/progressbar-Bk_RsEjW.js +0 -112
- package/dist/progressbar-T5_MpZGN.cjs +0 -17
- package/dist/tag-Bp9gJnYh.cjs +0 -27
- package/dist/{backlink-BYUtL8cO.js → backlink-BHtxOlTw.js} +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { classMap } from 'lit/directives/class-map.js'
|
|
2
2
|
import { customElement, property, state } from 'lit/decorators.js'
|
|
3
3
|
import { html, nothing } from 'lit'
|
|
4
|
+
import { ifDefined } from 'lit/directives/if-defined.js'
|
|
4
5
|
import { PktElement } from '@/base-elements/element'
|
|
5
6
|
import { Ref, createRef, ref } from 'lit/directives/ref.js'
|
|
6
7
|
import { styleMap } from 'lit/directives/style-map.js'
|
|
@@ -44,7 +45,7 @@ export class PktProgressbar extends PktElement implements IPktProgressbar {
|
|
|
44
45
|
@property({ type: String, reflect: true }) ariaLabelledby: string | null = null
|
|
45
46
|
@property({ type: String, reflect: true }) ariaValueText: string | null = null
|
|
46
47
|
@property({ type: String }) ariaLive: TAriaLive = 'polite'
|
|
47
|
-
@property({ type: String
|
|
48
|
+
@property({ type: String }) id: string = uuidish()
|
|
48
49
|
@property({ type: String }) role: TProgressbarRole = 'progressbar'
|
|
49
50
|
@property({ type: String }) skin: TProgressbarSkin = 'dark-blue'
|
|
50
51
|
@property({ type: String }) statusPlacement: TProgressbarStatusPlacement = 'following'
|
|
@@ -58,17 +59,29 @@ export class PktProgressbar extends PktElement implements IPktProgressbar {
|
|
|
58
59
|
// State
|
|
59
60
|
@state() private labelWidth = 0
|
|
60
61
|
@state() private progressbarId: string = this.id
|
|
61
|
-
@state() private
|
|
62
|
-
@state() private computedAriaValueText = ''
|
|
62
|
+
@state() private resolvedRole: TProgressbarRole = 'progressbar'
|
|
63
63
|
|
|
64
64
|
// Private refs
|
|
65
65
|
private labelRef: Ref<HTMLSpanElement> = createRef()
|
|
66
66
|
private progressBarRef: Ref<HTMLDivElement> = createRef()
|
|
67
67
|
|
|
68
|
-
|
|
69
|
-
super.
|
|
70
|
-
this.
|
|
71
|
-
|
|
68
|
+
protected willUpdate(changedProperties: Map<string | number | symbol, unknown>) {
|
|
69
|
+
super.willUpdate(changedProperties)
|
|
70
|
+
if (this.hasAttribute('id')) {
|
|
71
|
+
this.progressbarId = this.getAttribute('id') || this.progressbarId
|
|
72
|
+
this.removeAttribute('id')
|
|
73
|
+
} else if (this.id) {
|
|
74
|
+
this.progressbarId = this.id
|
|
75
|
+
}
|
|
76
|
+
// Verdien må fanges FØR removeAttribute: den utløser attributeChangedCallback,
|
|
77
|
+
// som nuller propertyen.
|
|
78
|
+
const roleAttr = this.getAttribute('role')
|
|
79
|
+
if (roleAttr) {
|
|
80
|
+
this.resolvedRole = roleAttr as TProgressbarRole
|
|
81
|
+
this.removeAttribute('role')
|
|
82
|
+
} else if (this.role) {
|
|
83
|
+
this.resolvedRole = this.role
|
|
84
|
+
}
|
|
72
85
|
}
|
|
73
86
|
|
|
74
87
|
updated(changedProperties: Map<string | number | symbol, unknown>) {
|
|
@@ -77,30 +90,6 @@ export class PktProgressbar extends PktElement implements IPktProgressbar {
|
|
|
77
90
|
if (changedProperties.has('valueCurrent') && this.labelRef.value) {
|
|
78
91
|
this.labelWidth = this.labelRef.value.getBoundingClientRect().width || 0
|
|
79
92
|
}
|
|
80
|
-
if (changedProperties.has('id') && this.id) {
|
|
81
|
-
this.progressBarId = this.id
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
if (
|
|
85
|
-
changedProperties.has('statusType') ||
|
|
86
|
-
changedProperties.has('id') ||
|
|
87
|
-
changedProperties.has('ariaLabelledby')
|
|
88
|
-
) {
|
|
89
|
-
this.progressbarId = this.id || uuidish()
|
|
90
|
-
this.computedAriaLabelledby = this.ariaLabelledby || `${this.progressbarId}-title`
|
|
91
|
-
}
|
|
92
|
-
if (
|
|
93
|
-
changedProperties.has('ariaValueText') ||
|
|
94
|
-
changedProperties.has('valueCurrent') ||
|
|
95
|
-
changedProperties.has('valueMax')
|
|
96
|
-
) {
|
|
97
|
-
this.computedAriaValueText =
|
|
98
|
-
this.statusType === 'fraction' && !this.ariaValueText
|
|
99
|
-
? `${this.valueCurrent} av ${this.valueMax - this.valueMin}`
|
|
100
|
-
: this.ariaValueText || ''
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
this.syncAttributes()
|
|
104
93
|
}
|
|
105
94
|
|
|
106
95
|
render() {
|
|
@@ -114,6 +103,14 @@ export class PktProgressbar extends PktElement implements IPktProgressbar {
|
|
|
114
103
|
|
|
115
104
|
const formattedTitle = `${this.valueCurrent} av ${totalSteps}`
|
|
116
105
|
|
|
106
|
+
const computedAriaValueText =
|
|
107
|
+
this.statusType === 'fraction' && !this.ariaValueText
|
|
108
|
+
? `${this.valueCurrent} av ${this.valueMax - this.valueMin}`
|
|
109
|
+
: this.ariaValueText || ''
|
|
110
|
+
const computedAriaLabelledby = this.ariaLabel
|
|
111
|
+
? undefined
|
|
112
|
+
: this.ariaLabelledby || `${this.progressbarId}-title`
|
|
113
|
+
|
|
117
114
|
const barClasses = classMap({
|
|
118
115
|
'pkt-progressbar__bar': true,
|
|
119
116
|
[`pkt-progressbar__bar--${this.skin}`]: !!this.skin,
|
|
@@ -132,64 +129,46 @@ export class PktProgressbar extends PktElement implements IPktProgressbar {
|
|
|
132
129
|
[`pkt-progressbar__status-placement--left`]: this.statusPlacement === 'left',
|
|
133
130
|
})
|
|
134
131
|
|
|
135
|
-
return html
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
}
|
|
132
|
+
return html`<div
|
|
133
|
+
${ref(this.progressBarRef)}
|
|
134
|
+
id=${this.progressbarId}
|
|
135
|
+
role=${this.resolvedRole}
|
|
136
|
+
aria-live=${ifDefined(this.ariaLive || undefined)}
|
|
137
|
+
aria-atomic="true"
|
|
138
|
+
aria-valuenow=${this.valueCurrent}
|
|
139
|
+
aria-valuemin=${this.valueMin}
|
|
140
|
+
aria-valuemax=${this.valueMax}
|
|
141
|
+
aria-valuetext=${ifDefined(computedAriaValueText || undefined)}
|
|
142
|
+
aria-label=${ifDefined(this.ariaLabel || undefined)}
|
|
143
|
+
aria-labelledby=${ifDefined(computedAriaLabelledby)}
|
|
144
|
+
class="pkt-progressbar"
|
|
142
145
|
>
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
146
|
+
<div
|
|
147
|
+
class="pkt-progressbar__container"
|
|
148
|
+
style=${styleMap({
|
|
149
|
+
'--pkt-progress-label-width': `${this.labelWidth}px`,
|
|
150
|
+
'--pkt-progress-width': `${currentPercentage}%`,
|
|
151
|
+
})}
|
|
152
|
+
>
|
|
153
|
+
${this.title
|
|
154
|
+
? html`<p id=${`${this.progressbarId}-title`} class=${titleClasses}>${this.title}</p>`
|
|
155
|
+
: nothing}
|
|
156
|
+
|
|
157
|
+
<div class="pkt-progressbar__bar-wrapper">
|
|
158
|
+
<div class=${barClasses}></div>
|
|
159
|
+
</div>
|
|
160
|
+
|
|
161
|
+
${hasStatus
|
|
162
|
+
? html`<div class=${statusClasses}>
|
|
163
|
+
<span class=${placementClasses} ${ref(this.labelRef)}>
|
|
164
|
+
${this.statusType === 'percentage' ? `${currentPercentage}%` : formattedTitle}
|
|
165
|
+
</span>
|
|
166
|
+
</div>`
|
|
167
|
+
: nothing}
|
|
149
168
|
</div>
|
|
150
|
-
|
|
151
|
-
${hasStatus
|
|
152
|
-
? html`<div class=${statusClasses}>
|
|
153
|
-
<span class=${placementClasses} ${ref(this.labelRef)}>
|
|
154
|
-
${this.statusType === 'percentage' ? `${currentPercentage}%` : formattedTitle}
|
|
155
|
-
</span>
|
|
156
|
-
</div>`
|
|
157
|
-
: nothing}
|
|
158
169
|
</div>`
|
|
159
170
|
}
|
|
160
171
|
|
|
161
|
-
// methods
|
|
162
|
-
private setComputedValues() {
|
|
163
|
-
this.progressbarId = this.id || uuidish()
|
|
164
|
-
this.computedAriaLabelledby = this.ariaLabelledby || `${this.progressbarId}-title`
|
|
165
|
-
this.computedAriaValueText =
|
|
166
|
-
this.statusType === 'fraction' && !this.ariaValueText
|
|
167
|
-
? `${this.valueCurrent} av ${this.valueMax - this.valueMin}`
|
|
168
|
-
: this.ariaValueText || ''
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
private syncAttributes() {
|
|
172
|
-
this._handleAttribute('aria-live', this.ariaLive)
|
|
173
|
-
this._handleAttribute('aria-valuenow', this.valueCurrent)
|
|
174
|
-
this._handleAttribute('aria-valuemin', this.valueMin)
|
|
175
|
-
this._handleAttribute('aria-valuemax', this.valueMax)
|
|
176
|
-
this._handleAttribute('aria-valuetext', this.computedAriaValueText)
|
|
177
|
-
this._handleAttribute('aria-label', this.ariaLabel)
|
|
178
|
-
this._handleAttribute('role', this.role)
|
|
179
|
-
this._handleAttribute('aria-atomic', 'true')
|
|
180
|
-
this._handleAttribute('id', this.progressbarId)
|
|
181
|
-
if (!this.ariaLabel) {
|
|
182
|
-
this._handleAttribute('aria-labelledby', this.computedAriaLabelledby)
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
private _handleAttribute(name: string, value: string | number | null) {
|
|
187
|
-
if (value == null || value === '') {
|
|
188
|
-
this.removeAttribute(name)
|
|
189
|
-
} else {
|
|
190
|
-
this.setAttribute(name, String(value))
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
172
|
}
|
|
194
173
|
|
|
195
174
|
export default PktProgressbar
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { PktElement } from '@/base-elements/element'
|
|
2
|
+
import { uuidish } from 'shared-utils/utils'
|
|
2
3
|
import { html, nothing, type PropertyValues } from 'lit'
|
|
3
4
|
import { customElement, property, state } from 'lit/decorators.js'
|
|
4
5
|
import { classMap } from 'lit/directives/class-map.js'
|
|
@@ -27,7 +28,7 @@ export class PktSearchInput extends PktElement<IPktSearchInput> implements IPktS
|
|
|
27
28
|
@property({ type: String, attribute: 'input-size' }) inputSize: TPktInputSize = 'medium'
|
|
28
29
|
@property({ type: Boolean, reflect: true }) disabled: boolean = false
|
|
29
30
|
@property({ type: Boolean, reflect: true }) fullwidth: boolean = false
|
|
30
|
-
@property({ type: String, reflect: true }) id: string =
|
|
31
|
+
@property({ type: String, reflect: true }) id: string = uuidish()
|
|
31
32
|
@property({ type: String }) label: string | undefined
|
|
32
33
|
@property({ type: String }) name: string | undefined
|
|
33
34
|
/** @deprecated Bruk `strings={{ searchinput: { placeholder: '…' } }}` eller `setPktStrings()`. */
|
|
@@ -176,6 +177,7 @@ export class PktSearchInput extends PktElement<IPktSearchInput> implements IPktS
|
|
|
176
177
|
name=${this.name || this.id}
|
|
177
178
|
id=${this.id}
|
|
178
179
|
placeholder=${this.placeholder || searchStrings.placeholder}
|
|
180
|
+
value=${this.value}
|
|
179
181
|
.value=${this.value}
|
|
180
182
|
?disabled=${this.disabled}
|
|
181
183
|
autocomplete="off"
|
|
@@ -82,7 +82,8 @@ describe('pkt-select', () => {
|
|
|
82
82
|
expect(selectElement).toBeInTheDocument()
|
|
83
83
|
expect(selectElement?.getAttribute('id')).toBe('my-select-input')
|
|
84
84
|
expect(selectElement?.hasAttribute('disabled')).toBe(true)
|
|
85
|
-
expect(selectElement?.
|
|
85
|
+
expect(selectElement?.hasAttribute('value')).toBe(false)
|
|
86
|
+
expect(select.value).toBe('option2')
|
|
86
87
|
})
|
|
87
88
|
|
|
88
89
|
test('handles options array property', async () => {
|
|
@@ -218,7 +218,6 @@ export class PktSelect extends PktOptionsInputElement<{}, TSelectOption> impleme
|
|
|
218
218
|
?disabled=${this.disabled}
|
|
219
219
|
id=${this.id + '-input'}
|
|
220
220
|
name=${(this.name || this.id) + '-input'}
|
|
221
|
-
value=${this.value}
|
|
222
221
|
@change=${(e: Event) => {
|
|
223
222
|
this.touched = true
|
|
224
223
|
this.value = (e.target as HTMLSelectElement).value
|
package/dist/alert-BYDWYgyL.cjs
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
const e=require("./element-DRc10X2R.cjs"),t=require("./class-map-BEib48YL.cjs"),n=require("./format-B8meU8Tm.cjs"),r=require("./element-with-slot-MkibfzHp.cjs"),i=require("./classutils-CbklAJDe.cjs"),a=require("./define-component-spec-DBNd2FJY.cjs");require("./icon-DBFTFd-J.cjs"),require("./button-C5BYwmoo.cjs");var o=[`off`,`polite`,`assertive`],s=[`info`,`success`,`warning`,`error`],c=[`medium`,`small`,`xsmall`],l=a.t({name:`pkt-alert`,react:`PktAlert`,"css-class":`pkt-alert`,"dark-mode":!0,isElement:!0,isPureReact:!0,events:{onClose:{reactOnly:!0,description:`React: Klikk-event for 'Lukk'-knappen`},close:{elementsOnly:!0,description:`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:[...s],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:[...o],default:`polite`,category:`accessibility`},size:{name:`Størrelse`,description:`Endrer størrelsen på ulike elementer i alerten.`,type:[...c],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}}}),u=class extends r.t{constructor(){super(),this.compact=l.deprecated.compact.default,this.title=``,this.skin=l.props.skin.default,this.ariaLive=l.props.ariaLive.default,this.ariaLiveAttr=null,this.closeAlert=l.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`)&&i.t(this,`pkt-hide`,this._isClosed)}render(){let i=this.size??(this.compact?`small`:`medium`),a={"pkt-alert":!0,[`pkt-alert--${i}`]:!0,[`pkt-alert--${this.skin}`]:!0,"pkt-hide":this._isClosed},o={"pkt-alert__grid":!0,"pkt-alert__noTitle":!this.title,"pkt-alert__noDate":!this.date};return e._`
|
|
2
|
-
<div class=${t.t(a)} aria-live=${this.ariaLiveAttr}>
|
|
3
|
-
<div class=${t.t(o)}>
|
|
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=${i}
|
|
16
|
-
type="button"
|
|
17
|
-
skin="tertiary"
|
|
18
|
-
iconName="close"
|
|
19
|
-
variant="icon-only"
|
|
20
|
-
@click=${this.close}
|
|
21
|
-
>
|
|
22
|
-
<span class="sr-only">${this.pktStrings.get(`generic`).close}</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">${r.n(this)}</div>
|
|
29
|
-
|
|
30
|
-
${this.date?e._`<div class="pkt-alert__date">
|
|
31
|
-
${n.t(this.pktStrings.get(`alert`).lastUpdated,{date:this.date})}
|
|
32
|
-
</div>`:e.h}
|
|
33
|
-
</div>
|
|
34
|
-
</div>
|
|
35
|
-
`}};e.n([e.u({type:Boolean,reflect:!1})],u.prototype,`compact`,void 0),e.n([e.u({type:String,reflect:!0})],u.prototype,`title`,void 0),e.n([e.u({type:String,reflect:!0})],u.prototype,`skin`,void 0),e.n([e.u({type:String})],u.prototype,`ariaLive`,void 0),e.n([e.u({type:String,reflect:!0,attribute:`aria-live`})],u.prototype,`ariaLiveAttr`,void 0),e.n([e.u({type:Boolean,reflect:!0})],u.prototype,`closeAlert`,void 0),e.n([e.u({type:String,reflect:!0})],u.prototype,`date`,void 0),e.n([e.u({type:String,reflect:!0})],u.prototype,`role`,void 0),e.n([e.u({type:String,attribute:`size`})],u.prototype,`size`,void 0),e.n([e.l()],u.prototype,`_isClosed`,void 0);try{e.d(`pkt-alert`)(u)}catch{console.warn(`Forsøker å definere <pkt-alert>, men den er allerede definert`)}var d=u;Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return d}});
|
package/dist/button-C5BYwmoo.cjs
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
const e=require("./element-DRc10X2R.cjs"),t=require("./class-map-BEib48YL.cjs"),n=require("./element-with-slot-MkibfzHp.cjs");require("./icon-DBFTFd-J.cjs");const r=require("./if-defined-BeVQnl3C.cjs");var i=`https://punkt-cdn.oslo.kommune.no/latest/animations/`;typeof window<`u`&&(window.pktAnimationPath=window.pktAnimationPath||i);var a=class a extends n.t{constructor(...e){super(...e),this.iconName=`user`,this.secondIconName=`user`,this.size=`medium`,this.fullWidth=!1,this.fullWidthOnMobile=!1,this.skin=`primary`,this.variant=`label-only`,this.state=`normal`,this.type=`button`,this.form=void 0,this.isLoading=!1,this.disabled=!1,this.loadingAnimationPath=typeof window<`u`?window.pktAnimationPath:i,this.relocatedAria={}}connectedCallback(){super.connectedCallback(),this.addEventListener(`click`,e=>{(this.disabled||this.hasAttribute(`disabled`)||this.isLoading)&&(e.preventDefault(),e.stopImmediatePropagation())},!0),this.addEventListener(`keydown`,e=>{(this.disabled||this.hasAttribute(`disabled`)||this.isLoading)&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.stopImmediatePropagation())},!0)}attributeChangedCallback(e,t,n){super.attributeChangedCallback(e,t,n),e===`disabled`&&n===`false`&&(this.disabled=!1),(e===`isloading`||e===`isLoading`)&&n===`false`&&(this.isLoading=!1)}static{this.relocatedAriaAttributes=[`aria-haspopup`,`aria-expanded`,`aria-controls`]}willUpdate(e){super.willUpdate(e);let t=!1,n={...this.relocatedAria};for(let e of a.relocatedAriaAttributes){let r=this.getAttribute(e);r!==null&&(n[e]=r,this.removeAttribute(e),t=!0)}t&&(this.relocatedAria=n)}firstUpdated(e){super.firstUpdated(e),this.disabled===`false`&&(this.disabled=!1),this.isLoading===`false`&&(this.isLoading=!1)}render(){let i=this.form??this.getAttribute(`form`)??void 0,a={"pkt-btn":!0,[`pkt-btn--${this.size}`]:!!this.size,[`pkt-btn--${this.skin}`]:!!this.skin,[`pkt-btn--${this.variant}`]:!!this.variant,[`pkt-btn--${this.color}`]:!!this.color,[`pkt-btn--${this.state}`]:!!this.state,"pkt-btn--full":!!this.fullWidth,"pkt-btn--full-small":!!this.fullWidthOnMobile,"pkt-btn--disabled":!!this.disabled,"pkt-btn--isLoading":!!this.isLoading};return e._`
|
|
2
|
-
<button
|
|
3
|
-
class=${t.t(a)}
|
|
4
|
-
type=${this.type}
|
|
5
|
-
?disabled=${!!this.disabled}
|
|
6
|
-
aria-busy=${r.t(this.isLoading?`true`:void 0)}
|
|
7
|
-
aria-disabled=${r.t(this.disabled||this.isLoading?`true`:void 0)}
|
|
8
|
-
aria-haspopup=${r.t(this.relocatedAria[`aria-haspopup`])}
|
|
9
|
-
aria-expanded=${r.t(this.relocatedAria[`aria-expanded`])}
|
|
10
|
-
aria-controls=${r.t(this.relocatedAria[`aria-controls`])}
|
|
11
|
-
form=${r.t(i)}
|
|
12
|
-
>
|
|
13
|
-
${this.isLoading?e._`<pkt-icon
|
|
14
|
-
class="pkt-btn__icon pkt-btn__spinner"
|
|
15
|
-
name="spinner-blue"
|
|
16
|
-
path=${r.t(this.loadingAnimationPath)}
|
|
17
|
-
></pkt-icon>`:e.h}
|
|
18
|
-
${this.variant===`label-only`?e.h:e._`<pkt-icon
|
|
19
|
-
class="pkt-btn__icon pkt-icon"
|
|
20
|
-
name=${this.iconName}
|
|
21
|
-
path=${r.t(this.iconPath)}
|
|
22
|
-
></pkt-icon>`}
|
|
23
|
-
<span class="pkt-btn__text">${n.n(this)}</span>
|
|
24
|
-
${this.variant===`icons-right-and-left`?e._`<pkt-icon
|
|
25
|
-
class="pkt-btn__icon"
|
|
26
|
-
name=${this.secondIconName}
|
|
27
|
-
path=${r.t(this.secondIconPath)}
|
|
28
|
-
></pkt-icon>`:e.h}
|
|
29
|
-
</button>
|
|
30
|
-
`}};e.n([e.u({type:String})],a.prototype,`iconName`,void 0),e.n([e.u({type:String})],a.prototype,`secondIconName`,void 0),e.n([e.u({type:String})],a.prototype,`iconPath`,void 0),e.n([e.u({type:String})],a.prototype,`secondIconPath`,void 0),e.n([e.u({type:String})],a.prototype,`size`,void 0),e.n([e.u({type:Boolean,attribute:`full-width`})],a.prototype,`fullWidth`,void 0),e.n([e.u({type:Boolean,attribute:`full-width-on-mobile`})],a.prototype,`fullWidthOnMobile`,void 0),e.n([e.u({type:String})],a.prototype,`color`,void 0),e.n([e.u({type:String})],a.prototype,`skin`,void 0),e.n([e.u({type:String})],a.prototype,`variant`,void 0),e.n([e.u({type:String,reflect:!0})],a.prototype,`state`,void 0),e.n([e.u({type:String,reflect:!0})],a.prototype,`type`,void 0),e.n([e.u({type:String})],a.prototype,`form`,void 0),e.n([e.u({type:Boolean,reflect:!0})],a.prototype,`isLoading`,void 0),e.n([e.u({type:Boolean,reflect:!0})],a.prototype,`disabled`,void 0),e.n([e.u({type:String})],a.prototype,`loadingAnimationPath`,void 0),e.n([e.l()],a.prototype,`relocatedAria`,void 0);try{e.d(`pkt-button`)(a)}catch{console.warn(`Forsøker å definere <pkt-button>, men den er allerede definert`)}var o=a;Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return o}});
|
package/dist/card-DMKvuvNv.cjs
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
const e=require("./element-DRc10X2R.cjs"),t=require("./class-map-BEib48YL.cjs"),n=require("./element-with-slot-MkibfzHp.cjs");require("./icon-DBFTFd-J.cjs");const r=require("./if-defined-BeVQnl3C.cjs");require("./tag-Bp9gJnYh.cjs"),require("./heading-BAoIzzJO.cjs");var i={name:`pkt-card`,react:`PktCard`,"css-class":`pkt-card`,isElement:!0,isPureReact:!0,"dark-mode":!0,props:{heading:{type:`string`,name:`Overskrift`,description:`Tittel på card`,category:`contents`},headingLevel:{type:[1,2,3,4,5,6],name:`Overskriftsnivå`,description:`Nivået på headingen. Brukes for tilgjengelighet.`,default:3,category:`accessibility`},subheading:{type:`string`,name:`Undertittel`,description:`Undertittel på card`,category:`contents`},layout:{type:[`vertical`,`horizontal`],name:`Layout`,description:`Horisontal eller vertikal layout. Ved horisontal layout vil bildet være plassert til venstre for teksten på desktop, og over teksten på mobil.`,default:`vertical`,category:`ui`},skin:{type:[`outlined`,`outlined-beige`,`gray`,`blue`,`beige`,`green`],name:`Utseende`,description:`Fargen på card. Velg mellom outlined, outlined-beige, gray, blue, beige og green. Ved padding=none er det ikke mulighet for outlined-skin. Card med kombinasjonen av propsene padding=none + layout=vertical vil alltid være transparante.`,default:`outlined`,category:`ui`},padding:{type:[`none`,`default`],name:`Padding`,description:`Padding rundt card. Ved "none" strekker innholdet i card seg ut til kantene, og dette er derfor ikke mulig å kombinere med outlined skin.`,default:`default`,category:`ui`},metaLead:{type:`string`,name:`Forfatter eller annen metadata`,description:`Undertekst med fet skriftvekt`,default:!1,category:`contents`},metaTrail:{type:`string`,name:`Dato eller annen metadata`,description:`Undertekst med normal skriftvekt`,default:!1,category:`contents`},tagPosition:{type:[`top`,`bottom`],name:`Tagplassering`,description:`Plassering av tags i card`,default:`top`,category:`ui`},clickCardLink:{type:`string`,name:`Lenke for klikkbart card`,description:`Href sendes inn som streng for å gjøre card klikkbart. Ved bruk MÅ heading sendes inn da denne vil brukes som lenketekst i klikkbart card.`,category:`contents`},openLinkInNewTab:{type:`boolean`,name:`Åpne i ny fane`,description:`Velg denne dersom du ønsker at lenken i card skal åpnes i ny fane.`,default:!1,category:`tech`},borderOnHover:{type:`boolean`,name:`Hover border for klikkbart card`,description:`Vi anbefaler hoverborder på klikkbart card. Kan slås av ved behov.`,default:!0,category:`ui`},image:{type:`object`,name:`Bilde`,description:`Bildet på card. Tar inn et objekt av typen {src: string, alt: string}.`,properties:{src:{type:`string`,description:`Stien til bildet`,required:!0},alt:{type:`string`,description:`Tekst til skjermleser. Skal kun sendes inn for bilder som ikke er dekorative`,required:!1}},category:`contents`},imageShape:{type:[`square`,`round`],name:`Bildeform`,description:`Valg for om bildet skal ha rektangulær eller rund form.`,default:`square`,category:`contents`},tags:{type:`array`,description:`Liste av tags på card. Tar inn et array med objekter med følgende stringproperties: skin, iconName, ariaLabel, text`,name:`Tags`,items:{type:`object`,name:`Tag`,properties:{skin:{type:[`blue`,`green`,`red`,`yellow`],description:`Farge på tag`},iconName:{type:`icon`,description:`Id på ikonet du ønsker å bruke til tag`},ariaLabel:{type:`string`,description:`Tekst for aria-label`},text:{type:`string`,description:`Tekst på tag`,required:!0}}},category:`contents`},ariaLabel:{type:`string`,name:`Aria-label for card`,description:`Tekst til skjermleser for aria-label på card. Settes automatisk til headingen, eller subheadingen der heading ikke eksisterer. Ved bruk av klikkbart card må heading alltid sendes inn da denne brukes som lenketekst.`,category:`accessibility`}},slots:{default:{description:`Innholdet i card`}}},a=class extends n.t{constructor(...e){super(...e),this.ariaLabel=``,this.metaLead=null,this.borderOnHover=!0,this.clickCardLink=null,this.metaTrail=null,this.layout=i.props.layout.default,this.heading=``,this.headinglevel=3,this.image={src:``,alt:``},this.imageShape=`square`,this.openLinkInNewTab=!1,this.padding=i.props.padding.default,this.skin=i.props.skin.default,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},i=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=${r.t(this.clickCardLink?i: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};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
|
-
`}renderHeading(){return e._`
|
|
22
|
-
${this.heading&&!this.clickCardLink?e._`
|
|
23
|
-
<pkt-heading
|
|
24
|
-
class="pkt-card__heading"
|
|
25
|
-
.level=${this.headinglevel||3}
|
|
26
|
-
size="medium"
|
|
27
|
-
nospacing
|
|
28
|
-
weight="regular"
|
|
29
|
-
>
|
|
30
|
-
${this.heading}
|
|
31
|
-
</pkt-heading>
|
|
32
|
-
`:e.h}
|
|
33
|
-
`}renderLinkHeading(){return e._`
|
|
34
|
-
${this.clickCardLink?e._`
|
|
35
|
-
<pkt-heading
|
|
36
|
-
class="pkt-card__link-heading pkt-card__heading"
|
|
37
|
-
.level=${this.headinglevel||3}
|
|
38
|
-
size="medium"
|
|
39
|
-
weight="regular"
|
|
40
|
-
nospacing
|
|
41
|
-
>
|
|
42
|
-
<a
|
|
43
|
-
class="pkt-card__link"
|
|
44
|
-
href=${this.clickCardLink}
|
|
45
|
-
target=${this.openLinkInNewTab?`_blank`:`_self`}
|
|
46
|
-
>${this.heading}</a
|
|
47
|
-
>
|
|
48
|
-
</pkt-heading>
|
|
49
|
-
`:e.h}
|
|
50
|
-
`}renderSubheading(){return e._`
|
|
51
|
-
${this.subheading?e._` <p class="pkt-card__subheading ">${this.subheading}</p> `:e.h}
|
|
52
|
-
`}renderHeader(){let t=!!this.heading||!!this.subheading;return e._`
|
|
53
|
-
${t?e._`
|
|
54
|
-
<header class="pkt-card__header">
|
|
55
|
-
${this.renderHeading()}
|
|
56
|
-
${this.renderLinkHeading()}
|
|
57
|
-
${this.renderSubheading()}
|
|
58
|
-
</header>
|
|
59
|
-
`:e.h}
|
|
60
|
-
`}renderTags(){let n={"pkt-card__tags":!0,[`pkt-card__tags-${this.tagPosition}`]:this.tagPosition};return e._`
|
|
61
|
-
${this.tags.length>0?e._`
|
|
62
|
-
<div
|
|
63
|
-
class=${t.t(n)}
|
|
64
|
-
role="list"
|
|
65
|
-
aria-label=${this.tags.length>1?`merkelapper`:`merkelapp`}
|
|
66
|
-
>
|
|
67
|
-
${this.tags.map(t=>e._`
|
|
68
|
-
<pkt-tag
|
|
69
|
-
role="listitem"
|
|
70
|
-
textStyle="normal-text"
|
|
71
|
-
size="medium"
|
|
72
|
-
skin=${r.t(t.skin)}
|
|
73
|
-
iconName=${r.t(t.iconName)}
|
|
74
|
-
>
|
|
75
|
-
<span>${t.text}</span>
|
|
76
|
-
</pkt-tag>
|
|
77
|
-
`)}
|
|
78
|
-
</div>
|
|
79
|
-
`:e.h}
|
|
80
|
-
`}renderSlot(){return e._`<section class="pkt-card__content">${n.n(this)}</section>`}renderMetadata(){return e._`
|
|
81
|
-
${this.metaLead||this.metaTrail?e._`
|
|
82
|
-
<footer class="pkt-card__metadata">
|
|
83
|
-
${this.metaLead?e._`<span class="pkt-card__metadata-lead">${this.metaLead}</span>`:e.h}
|
|
84
|
-
${this.metaTrail?e._`<span class="pkt-card__metadata-trail">${this.metaTrail}</span>`:e.h}
|
|
85
|
-
</footer>
|
|
86
|
-
`:e.h}
|
|
87
|
-
`}};e.n([e.u({type:String})],a.prototype,`ariaLabel`,void 0),e.n([e.u({type:String})],a.prototype,`metaLead`,void 0),e.n([e.u({type:Boolean})],a.prototype,`borderOnHover`,void 0),e.n([e.u({type:String,reflect:!0})],a.prototype,`clickCardLink`,void 0),e.n([e.u({type:String})],a.prototype,`metaTrail`,void 0),e.n([e.u({type:String})],a.prototype,`layout`,void 0),e.n([e.u({type:String})],a.prototype,`heading`,void 0),e.n([e.u({type:Number})],a.prototype,`headinglevel`,void 0),e.n([e.u({type:Object})],a.prototype,`image`,void 0),e.n([e.u({type:String})],a.prototype,`imageShape`,void 0),e.n([e.u({type:Boolean})],a.prototype,`openLinkInNewTab`,void 0),e.n([e.u({type:String})],a.prototype,`padding`,void 0),e.n([e.u({type:String,converter:{fromAttribute:e=>{let t=i.props.skin.type;return e&&t.includes(e)?e:(e&&!t.includes(e)&&console.warn(`Invalid skin value "${e}". Using default skin "${i.props.skin.default}".`),i.props.skin.default)},toAttribute:e=>e}})],a.prototype,`skin`,void 0),e.n([e.u({type:String})],a.prototype,`subheading`,void 0),e.n([e.u({type:String})],a.prototype,`tagPosition`,void 0),e.n([e.u({type:Array})],a.prototype,`tags`,void 0);try{e.d(`pkt-card`)(a)}catch{console.warn(`Forsøker å definere <pkt-card>, 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,112 +0,0 @@
|
|
|
1
|
-
import { _ as e, d as t, f as n, g as r, h as i, l as a, m as o, n as s, p as c, t as l, u } from "./element-e2MAMNEP.js";
|
|
2
|
-
import { t as d } from "./class-map-BL_YL_Ed.js";
|
|
3
|
-
import "./icon-jEFbKTB_.js";
|
|
4
|
-
import { n as f, t as p } from "./ref-lE1mGUOL.js";
|
|
5
|
-
import { n as m } from "./utils-BwF4QSrq.js";
|
|
6
|
-
//#region ../../node_modules/lit-html/directives/style-map.js
|
|
7
|
-
var h = "important", g = " !" + h, _ = n(class extends c {
|
|
8
|
-
constructor(e) {
|
|
9
|
-
if (super(e), e.type !== o.ATTRIBUTE || e.name !== "style" || e.strings?.length > 2) throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.");
|
|
10
|
-
}
|
|
11
|
-
render(e) {
|
|
12
|
-
return Object.keys(e).reduce((t, n) => {
|
|
13
|
-
let r = e[n];
|
|
14
|
-
return r == null ? t : t + `${n = n.includes("-") ? n : n.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g, "-$&").toLowerCase()}:${r};`;
|
|
15
|
-
}, "");
|
|
16
|
-
}
|
|
17
|
-
update(e, [t]) {
|
|
18
|
-
let { style: n } = e.element;
|
|
19
|
-
if (this.ft === void 0) return this.ft = new Set(Object.keys(t)), this.render(t);
|
|
20
|
-
for (let e of this.ft) t[e] ?? (this.ft.delete(e), e.includes("-") ? n.removeProperty(e) : n[e] = null);
|
|
21
|
-
for (let e in t) {
|
|
22
|
-
let r = t[e];
|
|
23
|
-
if (r != null) {
|
|
24
|
-
this.ft.add(e);
|
|
25
|
-
let t = typeof r == "string" && r.endsWith(g);
|
|
26
|
-
e.includes("-") || t ? n.setProperty(e, t ? r.slice(0, -11) : r, t ? h : "") : n[e] = r;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
return r;
|
|
30
|
-
}
|
|
31
|
-
}), v = class extends l {
|
|
32
|
-
constructor() {
|
|
33
|
-
super(), this.ariaLabel = null, this.ariaLabelledby = null, this.ariaValueText = null, this.ariaLive = "polite", this.id = m(), this.role = "progressbar", this.skin = "dark-blue", this.statusPlacement = "following", this.statusType = "none", this.title = "", this.titlePosition = "left", this.valueCurrent = 0, this.valueMax = 100, this.valueMin = 0, this.labelWidth = 0, this.progressbarId = this.id, this.computedAriaLabelledby = null, this.computedAriaValueText = "", this.labelRef = p(), this.progressBarRef = p();
|
|
34
|
-
}
|
|
35
|
-
firstUpdated(e) {
|
|
36
|
-
super.firstUpdated(e), this.setComputedValues(), this.syncAttributes();
|
|
37
|
-
}
|
|
38
|
-
updated(e) {
|
|
39
|
-
super.updated(e), e.has("valueCurrent") && this.labelRef.value && (this.labelWidth = this.labelRef.value.getBoundingClientRect().width || 0), e.has("id") && this.id && (this.progressBarId = this.id), (e.has("statusType") || e.has("id") || e.has("ariaLabelledby")) && (this.progressbarId = this.id || m(), this.computedAriaLabelledby = this.ariaLabelledby || `${this.progressbarId}-title`), (e.has("ariaValueText") || e.has("valueCurrent") || e.has("valueMax")) && (this.computedAriaValueText = this.statusType === "fraction" && !this.ariaValueText ? `${this.valueCurrent} av ${this.valueMax - this.valueMin}` : this.ariaValueText || ""), this.syncAttributes();
|
|
40
|
-
}
|
|
41
|
-
render() {
|
|
42
|
-
let t = this.statusType !== "none", n = this.valueMax - this.valueMin, r = this.valueCurrent / n * 100, a = this.statusType === "fraction" ? Math.round(r) : Math.round((this.valueCurrent - this.valueMin) / (this.valueMax - this.valueMin) * 100), o = `${this.valueCurrent} av ${n}`, s = d({
|
|
43
|
-
"pkt-progressbar__bar": !0,
|
|
44
|
-
[`pkt-progressbar__bar--${this.skin}`]: !!this.skin
|
|
45
|
-
}), c = d({
|
|
46
|
-
"pkt-progressbar__title": !0,
|
|
47
|
-
"pkt-progressbar__title-center": this.titlePosition === "center"
|
|
48
|
-
}), l = d({
|
|
49
|
-
"pkt-progressbar__status": !0,
|
|
50
|
-
"pkt-progressbar__status--center": this.statusPlacement === "center"
|
|
51
|
-
}), u = d({
|
|
52
|
-
"pkt-progressbar__status-placement--following": this.statusPlacement === "following",
|
|
53
|
-
"pkt-progressbar__status-placement--center": this.statusPlacement === "center",
|
|
54
|
-
"pkt-progressbar__status-placement--left": this.statusPlacement === "left"
|
|
55
|
-
});
|
|
56
|
-
return e` <div
|
|
57
|
-
class="pkt-progressbar__container"
|
|
58
|
-
.ref=${this.progressBarRef}
|
|
59
|
-
style=${_({
|
|
60
|
-
"--pkt-progress-label-width": `${this.labelWidth}px`,
|
|
61
|
-
"--pkt-progress-width": `${a}%`
|
|
62
|
-
})}
|
|
63
|
-
>
|
|
64
|
-
${this.title ? e`<p id=${`${this.progressBarId}-title`} class=${c}>${this.title}</p>` : i}
|
|
65
|
-
|
|
66
|
-
<div class="pkt-progressbar__bar-wrapper">
|
|
67
|
-
<div class=${s}></div>
|
|
68
|
-
</div>
|
|
69
|
-
|
|
70
|
-
${t ? e`<div class=${l}>
|
|
71
|
-
<span class=${u} ${f(this.labelRef)}>
|
|
72
|
-
${this.statusType === "percentage" ? `${a}%` : o}
|
|
73
|
-
</span>
|
|
74
|
-
</div>` : i}
|
|
75
|
-
</div>`;
|
|
76
|
-
}
|
|
77
|
-
setComputedValues() {
|
|
78
|
-
this.progressbarId = this.id || m(), this.computedAriaLabelledby = this.ariaLabelledby || `${this.progressbarId}-title`, this.computedAriaValueText = this.statusType === "fraction" && !this.ariaValueText ? `${this.valueCurrent} av ${this.valueMax - this.valueMin}` : this.ariaValueText || "";
|
|
79
|
-
}
|
|
80
|
-
syncAttributes() {
|
|
81
|
-
this._handleAttribute("aria-live", this.ariaLive), this._handleAttribute("aria-valuenow", this.valueCurrent), this._handleAttribute("aria-valuemin", this.valueMin), this._handleAttribute("aria-valuemax", this.valueMax), this._handleAttribute("aria-valuetext", this.computedAriaValueText), this._handleAttribute("aria-label", this.ariaLabel), this._handleAttribute("role", this.role), this._handleAttribute("aria-atomic", "true"), this._handleAttribute("id", this.progressbarId), this.ariaLabel || this._handleAttribute("aria-labelledby", this.computedAriaLabelledby);
|
|
82
|
-
}
|
|
83
|
-
_handleAttribute(e, t) {
|
|
84
|
-
t == null || t === "" ? this.removeAttribute(e) : this.setAttribute(e, String(t));
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
s([u({ type: String })], v.prototype, "ariaLabel", void 0), s([u({
|
|
88
|
-
type: String,
|
|
89
|
-
reflect: !0
|
|
90
|
-
})], v.prototype, "ariaLabelledby", void 0), s([u({
|
|
91
|
-
type: String,
|
|
92
|
-
reflect: !0
|
|
93
|
-
})], v.prototype, "ariaValueText", void 0), s([u({ type: String })], v.prototype, "ariaLive", void 0), s([u({
|
|
94
|
-
type: String,
|
|
95
|
-
reflect: !0
|
|
96
|
-
})], v.prototype, "id", void 0), s([u({ type: String })], v.prototype, "role", void 0), s([u({ type: String })], v.prototype, "skin", void 0), s([u({ type: String })], v.prototype, "statusPlacement", void 0), s([u({ type: String })], v.prototype, "statusType", void 0), s([u({
|
|
97
|
-
type: String,
|
|
98
|
-
reflect: !0
|
|
99
|
-
})], v.prototype, "title", void 0), s([u({ type: String })], v.prototype, "titlePosition", void 0), s([u({
|
|
100
|
-
type: Number,
|
|
101
|
-
reflect: !0
|
|
102
|
-
})], v.prototype, "valueCurrent", void 0), s([u({ type: Number })], v.prototype, "valueMax", void 0), s([u({ type: Number })], v.prototype, "valueMin", void 0), s([a()], v.prototype, "labelWidth", void 0), s([a()], v.prototype, "progressbarId", void 0), s([a()], v.prototype, "computedAriaLabelledby", void 0), s([a()], v.prototype, "computedAriaValueText", void 0);
|
|
103
|
-
try {
|
|
104
|
-
t("pkt-progressbar")(v);
|
|
105
|
-
} catch {
|
|
106
|
-
console.warn("Forsøker å definere <pkt-progressbar>, men den er allerede definert");
|
|
107
|
-
}
|
|
108
|
-
//#endregion
|
|
109
|
-
//#region src/components/progressbar/index.ts
|
|
110
|
-
var y = v;
|
|
111
|
-
//#endregion
|
|
112
|
-
export { v as n, y as t };
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
const e=require("./element-DRc10X2R.cjs"),t=require("./class-map-BEib48YL.cjs");require("./icon-DBFTFd-J.cjs");const n=require("./ref-BkV4Cd8U.cjs"),r=require("./utils-63cRpWut.cjs");var i=`important`,a=` !`+i,o=e.f(class extends e.p{constructor(t){if(super(t),t.type!==e.m.ATTRIBUTE||t.name!==`style`||t.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(e){return Object.keys(e).reduce((t,n)=>{let r=e[n];return r==null?t:t+`${n=n.includes(`-`)?n:n.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,`-$&`).toLowerCase()}:${r};`},``)}update(t,[n]){let{style:r}=t.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(n)),this.render(n);for(let e of this.ft)n[e]??(this.ft.delete(e),e.includes(`-`)?r.removeProperty(e):r[e]=null);for(let e in n){let t=n[e];if(t!=null){this.ft.add(e);let n=typeof t==`string`&&t.endsWith(a);e.includes(`-`)||n?r.setProperty(e,n?t.slice(0,-11):t,n?i:``):r[e]=t}}return e.g}}),s=class extends e.t{constructor(){super(),this.ariaLabel=null,this.ariaLabelledby=null,this.ariaValueText=null,this.ariaLive=`polite`,this.id=r.n(),this.role=`progressbar`,this.skin=`dark-blue`,this.statusPlacement=`following`,this.statusType=`none`,this.title=``,this.titlePosition=`left`,this.valueCurrent=0,this.valueMax=100,this.valueMin=0,this.labelWidth=0,this.progressbarId=this.id,this.computedAriaLabelledby=null,this.computedAriaValueText=``,this.labelRef=n.t(),this.progressBarRef=n.t()}firstUpdated(e){super.firstUpdated(e),this.setComputedValues(),this.syncAttributes()}updated(e){super.updated(e),e.has(`valueCurrent`)&&this.labelRef.value&&(this.labelWidth=this.labelRef.value.getBoundingClientRect().width||0),e.has(`id`)&&this.id&&(this.progressBarId=this.id),(e.has(`statusType`)||e.has(`id`)||e.has(`ariaLabelledby`))&&(this.progressbarId=this.id||r.n(),this.computedAriaLabelledby=this.ariaLabelledby||`${this.progressbarId}-title`),(e.has(`ariaValueText`)||e.has(`valueCurrent`)||e.has(`valueMax`))&&(this.computedAriaValueText=this.statusType===`fraction`&&!this.ariaValueText?`${this.valueCurrent} av ${this.valueMax-this.valueMin}`:this.ariaValueText||``),this.syncAttributes()}render(){let r=this.statusType!==`none`,i=this.valueMax-this.valueMin,a=this.valueCurrent/i*100,s=this.statusType===`fraction`?Math.round(a):Math.round((this.valueCurrent-this.valueMin)/(this.valueMax-this.valueMin)*100),c=`${this.valueCurrent} av ${i}`,l=t.t({"pkt-progressbar__bar":!0,[`pkt-progressbar__bar--${this.skin}`]:!!this.skin}),u=t.t({"pkt-progressbar__title":!0,"pkt-progressbar__title-center":this.titlePosition===`center`}),d=t.t({"pkt-progressbar__status":!0,"pkt-progressbar__status--center":this.statusPlacement===`center`}),f=t.t({"pkt-progressbar__status-placement--following":this.statusPlacement===`following`,"pkt-progressbar__status-placement--center":this.statusPlacement===`center`,"pkt-progressbar__status-placement--left":this.statusPlacement===`left`});return e._` <div
|
|
2
|
-
class="pkt-progressbar__container"
|
|
3
|
-
.ref=${this.progressBarRef}
|
|
4
|
-
style=${o({"--pkt-progress-label-width":`${this.labelWidth}px`,"--pkt-progress-width":`${s}%`})}
|
|
5
|
-
>
|
|
6
|
-
${this.title?e._`<p id=${`${this.progressBarId}-title`} class=${u}>${this.title}</p>`:e.h}
|
|
7
|
-
|
|
8
|
-
<div class="pkt-progressbar__bar-wrapper">
|
|
9
|
-
<div class=${l}></div>
|
|
10
|
-
</div>
|
|
11
|
-
|
|
12
|
-
${r?e._`<div class=${d}>
|
|
13
|
-
<span class=${f} ${n.n(this.labelRef)}>
|
|
14
|
-
${this.statusType===`percentage`?`${s}%`:c}
|
|
15
|
-
</span>
|
|
16
|
-
</div>`:e.h}
|
|
17
|
-
</div>`}setComputedValues(){this.progressbarId=this.id||r.n(),this.computedAriaLabelledby=this.ariaLabelledby||`${this.progressbarId}-title`,this.computedAriaValueText=this.statusType===`fraction`&&!this.ariaValueText?`${this.valueCurrent} av ${this.valueMax-this.valueMin}`:this.ariaValueText||``}syncAttributes(){this._handleAttribute(`aria-live`,this.ariaLive),this._handleAttribute(`aria-valuenow`,this.valueCurrent),this._handleAttribute(`aria-valuemin`,this.valueMin),this._handleAttribute(`aria-valuemax`,this.valueMax),this._handleAttribute(`aria-valuetext`,this.computedAriaValueText),this._handleAttribute(`aria-label`,this.ariaLabel),this._handleAttribute(`role`,this.role),this._handleAttribute(`aria-atomic`,`true`),this._handleAttribute(`id`,this.progressbarId),this.ariaLabel||this._handleAttribute(`aria-labelledby`,this.computedAriaLabelledby)}_handleAttribute(e,t){t==null||t===``?this.removeAttribute(e):this.setAttribute(e,String(t))}};e.n([e.u({type:String})],s.prototype,`ariaLabel`,void 0),e.n([e.u({type:String,reflect:!0})],s.prototype,`ariaLabelledby`,void 0),e.n([e.u({type:String,reflect:!0})],s.prototype,`ariaValueText`,void 0),e.n([e.u({type:String})],s.prototype,`ariaLive`,void 0),e.n([e.u({type:String,reflect:!0})],s.prototype,`id`,void 0),e.n([e.u({type:String})],s.prototype,`role`,void 0),e.n([e.u({type:String})],s.prototype,`skin`,void 0),e.n([e.u({type:String})],s.prototype,`statusPlacement`,void 0),e.n([e.u({type:String})],s.prototype,`statusType`,void 0),e.n([e.u({type:String,reflect:!0})],s.prototype,`title`,void 0),e.n([e.u({type:String})],s.prototype,`titlePosition`,void 0),e.n([e.u({type:Number,reflect:!0})],s.prototype,`valueCurrent`,void 0),e.n([e.u({type:Number})],s.prototype,`valueMax`,void 0),e.n([e.u({type:Number})],s.prototype,`valueMin`,void 0),e.n([e.l()],s.prototype,`labelWidth`,void 0),e.n([e.l()],s.prototype,`progressbarId`,void 0),e.n([e.l()],s.prototype,`computedAriaLabelledby`,void 0),e.n([e.l()],s.prototype,`computedAriaValueText`,void 0);try{e.d(`pkt-progressbar`)(s)}catch{console.warn(`Forsøker å definere <pkt-progressbar>, 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}});
|
package/dist/tag-Bp9gJnYh.cjs
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
const e=require("./element-DRc10X2R.cjs"),t=require("./class-map-BEib48YL.cjs"),n=require("./format-B8meU8Tm.cjs"),r=require("./element-with-slot-MkibfzHp.cjs");require("./icon-DBFTFd-J.cjs");const i=require("./if-defined-BeVQnl3C.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}firstUpdated(e){if(super.firstUpdated(e),this.closeTag&&!this.ariaLabel){let e=this.querySelector(`button span, .pkt-tag > span`)?.textContent?.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.n(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.n(this)}</span>
|
|
26
|
-
</span>
|
|
27
|
-
`}};e.n([e.u({type:Boolean,reflect:!0})],o.prototype,`closeTag`,void 0),e.n([e.u({type:String,reflect:!0})],o.prototype,`size`,void 0),e.n([e.u({type:String,reflect:!0})],o.prototype,`skin`,void 0),e.n([e.u({type:String,reflect:!0})],o.prototype,`textStyle`,void 0),e.n([e.u({type:String,reflect:!0})],o.prototype,`iconName`,void 0),e.n([e.u({type:String})],o.prototype,`type`,void 0),e.n([e.u({type:String})],o.prototype,`ariaLabel`,void 0),e.n([e.u({type:Number,attribute:`button-tabindex`})],o.prototype,`buttonTabindex`,void 0),e.n([e.l()],o.prototype,`_isClosed`,void 0),e.n([e.l()],o.prototype,`_ariaDescription`,void 0);try{e.d(`pkt-tag`)(o)}catch{console.warn(`Forsøker å definere <pkt-tag>, men den er allerede definert`)}var s=o;Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return s}});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { _ as e, d as t, n, t as r, u as i } from "./element-e2MAMNEP.js";
|
|
2
|
-
import "./icon-jEFbKTB_.js";
|
|
3
2
|
import { t as a } from "./if-defined-r8tKY4tG.js";
|
|
3
|
+
import "./icon-jEFbKTB_.js";
|
|
4
4
|
//#region src/components/backlink/backlink.ts
|
|
5
5
|
var o = class extends r {
|
|
6
6
|
constructor(...e) {
|