@oslokommune/punkt-elements 12.37.6 → 12.38.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.
- package/CHANGELOG.md +54 -0
- package/dist/card-CZG7XGlj.js +231 -0
- package/dist/card-Di1MQneh.cjs +87 -0
- package/dist/{checkbox-DCjl4VM0.js → checkbox-Ds1FrhqK.js} +1 -1
- package/dist/{checkbox-B7ObRUbU.cjs → checkbox-zqd3KVfz.cjs} +1 -1
- package/dist/{combobox-CnnTPWcA.js → combobox-B6x7Qukm.js} +1 -1
- package/dist/{combobox-BokBs9Jo.cjs → combobox-yUrUarU_.cjs} +1 -1
- package/dist/{datepicker-B767w-e9.cjs → datepicker-CH5ZmFhf.cjs} +1 -1
- package/dist/{datepicker-B-ytA8nG.js → datepicker-WpOJS948.js} +1 -1
- package/dist/index.d.ts +52 -4
- package/dist/{input-element-B5EvsMww.js → input-element-4hgBpSNJ.js} +28 -24
- package/dist/{input-element-KzKpjjLc.cjs → input-element-CwUniARD.cjs} +1 -1
- package/dist/pkt-card.cjs +1 -1
- package/dist/pkt-card.js +1 -1
- package/dist/pkt-checkbox.cjs +1 -1
- package/dist/pkt-checkbox.js +1 -1
- package/dist/pkt-combobox.cjs +1 -1
- package/dist/pkt-combobox.js +1 -1
- package/dist/pkt-datepicker.cjs +1 -1
- package/dist/pkt-datepicker.js +1 -1
- package/dist/pkt-index.cjs +1 -1
- package/dist/pkt-index.js +8 -8
- package/dist/pkt-radiobutton.cjs +1 -1
- package/dist/pkt-radiobutton.js +1 -1
- package/dist/pkt-select.cjs +1 -1
- package/dist/pkt-select.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/{radiobutton-DP6RsaQc.cjs → radiobutton-CI2xaqAB.cjs} +2 -1
- package/dist/{radiobutton-DKHjKH75.js → radiobutton-CYJawqxD.js} +8 -7
- package/dist/{select-CQs_BAKs.cjs → select-BCL790jM.cjs} +1 -1
- package/dist/{select-ChsSC4Os.js → select-D3LR5zgE.js} +1 -1
- package/dist/{textarea-DAfViyIl.js → textarea-B8H6-8qY.js} +1 -1
- package/dist/{textarea-DIZf7CVg.cjs → textarea-DxbylapQ.cjs} +1 -1
- package/dist/{textinput-DMPRHokX.cjs → textinput-B__c4c1z.cjs} +1 -1
- package/dist/{textinput-u-UrLS8U.js → textinput-CPYLokFV.js} +1 -1
- package/package.json +3 -3
- package/src/components/card/card.ts +209 -40
- package/src/components/radiobutton/radiobutton.ts +1 -0
- package/dist/card-Cyww1yKr.js +0 -94
- package/dist/card-DH-3qNgp.cjs +0 -28
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,60 @@ og skriver commits ca etter [Conventional Commits](https://conventionalcommits.o
|
|
|
5
5
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
+
## [12.38.0](https://github.com/oslokommune/punkt/compare/12.37.8...12.38.0) (2025-05-13)
|
|
9
|
+
|
|
10
|
+
### ⚠ BREAKING CHANGES
|
|
11
|
+
Ingen
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
* Refaktorering og forbedringer av kort – klikkbart lenkekort, runde bilder, tilgjengelighet, semantikk, fleksibilitet, styling (#2511). Lagt til støtte for:
|
|
15
|
+
- Tilgjenglig, klikkbart lenkekort
|
|
16
|
+
- Variabel tagposisjon
|
|
17
|
+
- Runde bilder
|
|
18
|
+
- Responsivitet
|
|
19
|
+
- Fokus på rammen av kortet
|
|
20
|
+
- Valgfri hover på rammen av kortet
|
|
21
|
+
- Variant uten padding
|
|
22
|
+
- Ny skin: outlined-beige
|
|
23
|
+
- forfatter
|
|
24
|
+
- dato
|
|
25
|
+
|
|
26
|
+
Annet:
|
|
27
|
+
- Bruker ny headingkomponent
|
|
28
|
+
- Støtte for valg av headingnivå
|
|
29
|
+
- Semantisk HTML med article, header, section og footer
|
|
30
|
+
- Fokusert på UU og lagt til aria-label og roller på ulike deler av kortet
|
|
31
|
+
- Kortet går nå fra landskap til portett på små skjermer
|
|
32
|
+
- Mange stylingendringer
|
|
33
|
+
- Håndterer nå at brukere ikke cropper bilder på forhånd slik at de ved ulike størrelser allikevel får uniforme størrelser på bildene i kortene
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
### Bug Fixes
|
|
37
|
+
Ingen
|
|
38
|
+
|
|
39
|
+
### Chores
|
|
40
|
+
Ingen
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
## [12.37.8](https://github.com/oslokommune/punkt/compare/12.37.7...12.37.8) (2025-05-13)
|
|
46
|
+
|
|
47
|
+
### ⚠ BREAKING CHANGES
|
|
48
|
+
Ingen
|
|
49
|
+
|
|
50
|
+
### Features
|
|
51
|
+
Ingen
|
|
52
|
+
|
|
53
|
+
### Bug Fixes
|
|
54
|
+
Ingen
|
|
55
|
+
|
|
56
|
+
### Chores
|
|
57
|
+
Ingen
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
|
|
8
62
|
## [12.37.6](https://github.com/oslokommune/punkt/compare/12.37.5...12.37.6) (2025-05-13)
|
|
9
63
|
|
|
10
64
|
### ⚠ BREAKING CHANGES
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
import { e as c } from "./class-map-KyMqi0fa.js";
|
|
2
|
+
import { o as g } from "./if-defined-BErSJCeJ.js";
|
|
3
|
+
import { P as u, E as d, x as t, n as r, a as $ } from "./element-DjjF_tEh.js";
|
|
4
|
+
import { P as m } from "./pkt-slot-controller-DtDaD9q_.js";
|
|
5
|
+
import { e as _, n as y } from "./ref-iIffqQAI.js";
|
|
6
|
+
import "./icon-Beoxup8E.js";
|
|
7
|
+
import "./tag-Cu8afZy8.js";
|
|
8
|
+
const b = {
|
|
9
|
+
skin: {
|
|
10
|
+
default: "outlined"
|
|
11
|
+
},
|
|
12
|
+
direction: {
|
|
13
|
+
default: "portrait"
|
|
14
|
+
},
|
|
15
|
+
padding: {
|
|
16
|
+
default: "standard"
|
|
17
|
+
}
|
|
18
|
+
}, k = {
|
|
19
|
+
props: b
|
|
20
|
+
};
|
|
21
|
+
var f = Object.defineProperty, S = Object.getOwnPropertyDescriptor, i = (a, s, p, o) => {
|
|
22
|
+
for (var n = o > 1 ? void 0 : o ? S(s, p) : s, h = a.length - 1, l; h >= 0; h--)
|
|
23
|
+
(l = a[h]) && (n = (o ? l(s, p, n) : l(n)) || n);
|
|
24
|
+
return o && n && f(s, p, n), n;
|
|
25
|
+
};
|
|
26
|
+
let e = class extends u {
|
|
27
|
+
//Constructor
|
|
28
|
+
constructor() {
|
|
29
|
+
super(), this.defaultSlot = _(), this.ariaLabel = "", this.author = null, this.borderOnHover = !0, this.clickCardLink = null, this.date = null, this.direction = k.props.direction.default, this.heading = "", this.headinglevel = 3, this.image = {
|
|
30
|
+
src: "",
|
|
31
|
+
alt: ""
|
|
32
|
+
}, this.imageShape = "square", this.openLinkInNewTab = !1, this.padding = k.props.padding.default, this.skin = k.props.skin.default, this.subheading = "", this.tagPosition = "top", this.tags = [], this.slotController = new m(this, this.defaultSlot);
|
|
33
|
+
}
|
|
34
|
+
connectedCallback() {
|
|
35
|
+
super.connectedCallback();
|
|
36
|
+
}
|
|
37
|
+
// Render methods
|
|
38
|
+
// Main render method
|
|
39
|
+
// prettier-ignore
|
|
40
|
+
render() {
|
|
41
|
+
var o, n;
|
|
42
|
+
const a = {
|
|
43
|
+
"pkt-card": !0,
|
|
44
|
+
[`pkt-card--${this.skin}`]: this.skin,
|
|
45
|
+
[`pkt-card--${this.direction}`]: this.direction,
|
|
46
|
+
[`pkt-card--padding-${this.padding}`]: this.padding,
|
|
47
|
+
"pkt-card--border-on-hover": this.borderOnHover
|
|
48
|
+
}, s = ((o = this.ariaLabel) == null ? void 0 : o.trim()) || (this.heading ? `${this.heading} lenkekort` : "lenkekort"), p = ((n = this.ariaLabel) == null ? void 0 : n.trim()) || (this.heading ? this.heading : "kort");
|
|
49
|
+
return t`
|
|
50
|
+
<article
|
|
51
|
+
class=${c(a)}
|
|
52
|
+
aria-label=${g(this.clickCardLink ? s : p)}
|
|
53
|
+
>
|
|
54
|
+
${this.renderImage()}
|
|
55
|
+
<div class="pkt-card__wrapper">
|
|
56
|
+
${this.tagPosition === "top" ? this.renderTags() : d}
|
|
57
|
+
${this.renderHeader()}
|
|
58
|
+
${this.renderSlot()}
|
|
59
|
+
${this.tagPosition === "bottom" ? this.renderTags() : d}
|
|
60
|
+
${this.renderCreditline()}
|
|
61
|
+
</div>
|
|
62
|
+
</article>
|
|
63
|
+
`;
|
|
64
|
+
}
|
|
65
|
+
// Render methods for different parts of the card
|
|
66
|
+
renderImage() {
|
|
67
|
+
const a = {
|
|
68
|
+
"pkt-card__image": !0,
|
|
69
|
+
[`pkt-card__image-${this.imageShape}`]: this.imageShape
|
|
70
|
+
};
|
|
71
|
+
return t`
|
|
72
|
+
${this.image.src && t`
|
|
73
|
+
<div class=${c(a)}>
|
|
74
|
+
<img src=${this.image.src} alt=${this.image.alt || ""} />
|
|
75
|
+
</div>
|
|
76
|
+
`}
|
|
77
|
+
`;
|
|
78
|
+
}
|
|
79
|
+
// Do not render heading if link is present, render link heading instead
|
|
80
|
+
// Combine the rendering for headings into a renderHeader method
|
|
81
|
+
renderHeading() {
|
|
82
|
+
return t`
|
|
83
|
+
${this.heading && !this.clickCardLink ? t`
|
|
84
|
+
<pkt-heading
|
|
85
|
+
class="pkt-card__heading"
|
|
86
|
+
.level=${this.headinglevel || 3}
|
|
87
|
+
size="medium"
|
|
88
|
+
nospacing
|
|
89
|
+
>
|
|
90
|
+
${this.heading}
|
|
91
|
+
</pkt-heading>
|
|
92
|
+
` : d}
|
|
93
|
+
`;
|
|
94
|
+
}
|
|
95
|
+
renderLinkHeading() {
|
|
96
|
+
return t`
|
|
97
|
+
${this.clickCardLink ? t`
|
|
98
|
+
<pkt-heading
|
|
99
|
+
class="pkt-card__link-heading pkt-card__heading"
|
|
100
|
+
.level=${this.headinglevel || 3}
|
|
101
|
+
size="medium"
|
|
102
|
+
nospacing
|
|
103
|
+
>
|
|
104
|
+
<a
|
|
105
|
+
class="pkt-card__link"
|
|
106
|
+
href=${this.clickCardLink}
|
|
107
|
+
target=${this.openLinkInNewTab ? "_blank" : "_self"}
|
|
108
|
+
>${this.heading}</a
|
|
109
|
+
>
|
|
110
|
+
</pkt-heading>
|
|
111
|
+
` : d}
|
|
112
|
+
`;
|
|
113
|
+
}
|
|
114
|
+
renderSubheading() {
|
|
115
|
+
return t`
|
|
116
|
+
${this.subheading ? t` <p class="pkt-card__subheading ">${this.subheading}</p> ` : d}
|
|
117
|
+
`;
|
|
118
|
+
}
|
|
119
|
+
// Render header
|
|
120
|
+
// prettier-ignore
|
|
121
|
+
renderHeader() {
|
|
122
|
+
const a = !!this.heading || !!this.subheading;
|
|
123
|
+
return t`
|
|
124
|
+
${a ? t`
|
|
125
|
+
<header class="pkt-card__header">
|
|
126
|
+
${this.renderHeading()}
|
|
127
|
+
${this.renderLinkHeading()}
|
|
128
|
+
${this.renderSubheading()}
|
|
129
|
+
</header>
|
|
130
|
+
` : d}
|
|
131
|
+
`;
|
|
132
|
+
}
|
|
133
|
+
renderTags() {
|
|
134
|
+
const a = {
|
|
135
|
+
"pkt-card__tags": !0,
|
|
136
|
+
[`pkt-card__tags-${this.tagPosition}`]: this.tagPosition
|
|
137
|
+
};
|
|
138
|
+
return t`
|
|
139
|
+
${this.tags.length > 0 ? t`
|
|
140
|
+
<div
|
|
141
|
+
class=${c(a)}
|
|
142
|
+
role="list"
|
|
143
|
+
aria-label=${this.tags.length > 1 ? "merkelapper" : "merkelapp"}
|
|
144
|
+
>
|
|
145
|
+
${this.tags.map(
|
|
146
|
+
(s) => t`
|
|
147
|
+
<pkt-tag
|
|
148
|
+
role="listitem"
|
|
149
|
+
textStyle="normal-text"
|
|
150
|
+
size="medium"
|
|
151
|
+
skin=${g(s.skin)}
|
|
152
|
+
iconName=${g(s.iconName)}
|
|
153
|
+
>
|
|
154
|
+
${s.text}
|
|
155
|
+
</pkt-tag>
|
|
156
|
+
`
|
|
157
|
+
)}
|
|
158
|
+
</div>
|
|
159
|
+
` : d}
|
|
160
|
+
`;
|
|
161
|
+
}
|
|
162
|
+
renderSlot() {
|
|
163
|
+
return t`
|
|
164
|
+
${this.defaultSlot && t`<section class="pkt-card__content" ${y(this.defaultSlot)}></section>`}
|
|
165
|
+
`;
|
|
166
|
+
}
|
|
167
|
+
renderCreditline() {
|
|
168
|
+
return t`
|
|
169
|
+
${this.author || this.date ? t`
|
|
170
|
+
<footer class="pkt-card__creditline">
|
|
171
|
+
${this.author ? t`<span class="pkt-card__creditline-author">${this.author}</span>` : d}
|
|
172
|
+
${this.date ? t`<span class="pkt-card__creditline-date">${this.date}</span>` : d}
|
|
173
|
+
</footer>
|
|
174
|
+
` : d}
|
|
175
|
+
`;
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
i([
|
|
179
|
+
r({ type: String })
|
|
180
|
+
], e.prototype, "ariaLabel", 2);
|
|
181
|
+
i([
|
|
182
|
+
r({ type: String })
|
|
183
|
+
], e.prototype, "author", 2);
|
|
184
|
+
i([
|
|
185
|
+
r({ type: Boolean })
|
|
186
|
+
], e.prototype, "borderOnHover", 2);
|
|
187
|
+
i([
|
|
188
|
+
r({ type: String, reflect: !0 })
|
|
189
|
+
], e.prototype, "clickCardLink", 2);
|
|
190
|
+
i([
|
|
191
|
+
r({ type: String })
|
|
192
|
+
], e.prototype, "date", 2);
|
|
193
|
+
i([
|
|
194
|
+
r({ type: String })
|
|
195
|
+
], e.prototype, "direction", 2);
|
|
196
|
+
i([
|
|
197
|
+
r({ type: String })
|
|
198
|
+
], e.prototype, "heading", 2);
|
|
199
|
+
i([
|
|
200
|
+
r({ type: Number })
|
|
201
|
+
], e.prototype, "headinglevel", 2);
|
|
202
|
+
i([
|
|
203
|
+
r({ type: Object })
|
|
204
|
+
], e.prototype, "image", 2);
|
|
205
|
+
i([
|
|
206
|
+
r({ type: String })
|
|
207
|
+
], e.prototype, "imageShape", 2);
|
|
208
|
+
i([
|
|
209
|
+
r({ type: Boolean })
|
|
210
|
+
], e.prototype, "openLinkInNewTab", 2);
|
|
211
|
+
i([
|
|
212
|
+
r({ type: String })
|
|
213
|
+
], e.prototype, "padding", 2);
|
|
214
|
+
i([
|
|
215
|
+
r({ type: String })
|
|
216
|
+
], e.prototype, "skin", 2);
|
|
217
|
+
i([
|
|
218
|
+
r({ type: String })
|
|
219
|
+
], e.prototype, "subheading", 2);
|
|
220
|
+
i([
|
|
221
|
+
r({ type: String })
|
|
222
|
+
], e.prototype, "tagPosition", 2);
|
|
223
|
+
i([
|
|
224
|
+
r({ type: Array })
|
|
225
|
+
], e.prototype, "tags", 2);
|
|
226
|
+
e = i([
|
|
227
|
+
$("pkt-card")
|
|
228
|
+
], e);
|
|
229
|
+
export {
|
|
230
|
+
e as P
|
|
231
|
+
};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";const p=require("./class-map-DCyaICmy.cjs"),h=require("./if-defined-a3sotaUr.cjs"),t=require("./element-BSypUpzA.cjs"),g=require("./pkt-slot-controller-Da-RgXfS.cjs"),c=require("./ref-BvbyvXRH.cjs");require("./icon-BnKGwYjj.cjs");require("./tag-B9kFYxHg.cjs");const k={skin:{default:"outlined"},direction:{default:"portrait"},padding:{default:"standard"}},l={props:k};var u=Object.defineProperty,$=Object.getOwnPropertyDescriptor,e=(d,i,a,n)=>{for(var r=n>1?void 0:n?$(i,a):i,s=d.length-1,o;s>=0;s--)(o=d[s])&&(r=(n?o(i,a,r):o(r))||r);return n&&r&&u(i,a,r),r};exports.PktCard=class extends t.PktElement{constructor(){super(),this.defaultSlot=c.e(),this.ariaLabel="",this.author=null,this.borderOnHover=!0,this.clickCardLink=null,this.date=null,this.direction=l.props.direction.default,this.heading="",this.headinglevel=3,this.image={src:"",alt:""},this.imageShape="square",this.openLinkInNewTab=!1,this.padding=l.props.padding.default,this.skin=l.props.skin.default,this.subheading="",this.tagPosition="top",this.tags=[],this.slotController=new g.PktSlotController(this,this.defaultSlot)}connectedCallback(){super.connectedCallback()}render(){var r,s;const i={"pkt-card":!0,[`pkt-card--${this.skin}`]:this.skin,[`pkt-card--${this.direction}`]:this.direction,[`pkt-card--padding-${this.padding}`]:this.padding,"pkt-card--border-on-hover":this.borderOnHover},a=((r=this.ariaLabel)==null?void 0:r.trim())||(this.heading?`${this.heading} lenkekort`:"lenkekort"),n=((s=this.ariaLabel)==null?void 0:s.trim())||(this.heading?this.heading:"kort");return t.x`
|
|
2
|
+
<article
|
|
3
|
+
class=${p.e(i)}
|
|
4
|
+
aria-label=${h.o(this.clickCardLink?a:n)}
|
|
5
|
+
>
|
|
6
|
+
${this.renderImage()}
|
|
7
|
+
<div class="pkt-card__wrapper">
|
|
8
|
+
${this.tagPosition==="top"?this.renderTags():t.E}
|
|
9
|
+
${this.renderHeader()}
|
|
10
|
+
${this.renderSlot()}
|
|
11
|
+
${this.tagPosition==="bottom"?this.renderTags():t.E}
|
|
12
|
+
${this.renderCreditline()}
|
|
13
|
+
</div>
|
|
14
|
+
</article>
|
|
15
|
+
`}renderImage(){const i={"pkt-card__image":!0,[`pkt-card__image-${this.imageShape}`]:this.imageShape};return t.x`
|
|
16
|
+
${this.image.src&&t.x`
|
|
17
|
+
<div class=${p.e(i)}>
|
|
18
|
+
<img src=${this.image.src} alt=${this.image.alt||""} />
|
|
19
|
+
</div>
|
|
20
|
+
`}
|
|
21
|
+
`}renderHeading(){return t.x`
|
|
22
|
+
${this.heading&&!this.clickCardLink?t.x`
|
|
23
|
+
<pkt-heading
|
|
24
|
+
class="pkt-card__heading"
|
|
25
|
+
.level=${this.headinglevel||3}
|
|
26
|
+
size="medium"
|
|
27
|
+
nospacing
|
|
28
|
+
>
|
|
29
|
+
${this.heading}
|
|
30
|
+
</pkt-heading>
|
|
31
|
+
`:t.E}
|
|
32
|
+
`}renderLinkHeading(){return t.x`
|
|
33
|
+
${this.clickCardLink?t.x`
|
|
34
|
+
<pkt-heading
|
|
35
|
+
class="pkt-card__link-heading pkt-card__heading"
|
|
36
|
+
.level=${this.headinglevel||3}
|
|
37
|
+
size="medium"
|
|
38
|
+
nospacing
|
|
39
|
+
>
|
|
40
|
+
<a
|
|
41
|
+
class="pkt-card__link"
|
|
42
|
+
href=${this.clickCardLink}
|
|
43
|
+
target=${this.openLinkInNewTab?"_blank":"_self"}
|
|
44
|
+
>${this.heading}</a
|
|
45
|
+
>
|
|
46
|
+
</pkt-heading>
|
|
47
|
+
`:t.E}
|
|
48
|
+
`}renderSubheading(){return t.x`
|
|
49
|
+
${this.subheading?t.x` <p class="pkt-card__subheading ">${this.subheading}</p> `:t.E}
|
|
50
|
+
`}renderHeader(){const i=!!this.heading||!!this.subheading;return t.x`
|
|
51
|
+
${i?t.x`
|
|
52
|
+
<header class="pkt-card__header">
|
|
53
|
+
${this.renderHeading()}
|
|
54
|
+
${this.renderLinkHeading()}
|
|
55
|
+
${this.renderSubheading()}
|
|
56
|
+
</header>
|
|
57
|
+
`:t.E}
|
|
58
|
+
`}renderTags(){const i={"pkt-card__tags":!0,[`pkt-card__tags-${this.tagPosition}`]:this.tagPosition};return t.x`
|
|
59
|
+
${this.tags.length>0?t.x`
|
|
60
|
+
<div
|
|
61
|
+
class=${p.e(i)}
|
|
62
|
+
role="list"
|
|
63
|
+
aria-label=${this.tags.length>1?"merkelapper":"merkelapp"}
|
|
64
|
+
>
|
|
65
|
+
${this.tags.map(a=>t.x`
|
|
66
|
+
<pkt-tag
|
|
67
|
+
role="listitem"
|
|
68
|
+
textStyle="normal-text"
|
|
69
|
+
size="medium"
|
|
70
|
+
skin=${h.o(a.skin)}
|
|
71
|
+
iconName=${h.o(a.iconName)}
|
|
72
|
+
>
|
|
73
|
+
${a.text}
|
|
74
|
+
</pkt-tag>
|
|
75
|
+
`)}
|
|
76
|
+
</div>
|
|
77
|
+
`:t.E}
|
|
78
|
+
`}renderSlot(){return t.x`
|
|
79
|
+
${this.defaultSlot&&t.x`<section class="pkt-card__content" ${c.n(this.defaultSlot)}></section>`}
|
|
80
|
+
`}renderCreditline(){return t.x`
|
|
81
|
+
${this.author||this.date?t.x`
|
|
82
|
+
<footer class="pkt-card__creditline">
|
|
83
|
+
${this.author?t.x`<span class="pkt-card__creditline-author">${this.author}</span>`:t.E}
|
|
84
|
+
${this.date?t.x`<span class="pkt-card__creditline-date">${this.date}</span>`:t.E}
|
|
85
|
+
</footer>
|
|
86
|
+
`:t.E}
|
|
87
|
+
`}};e([t.n({type:String})],exports.PktCard.prototype,"ariaLabel",2);e([t.n({type:String})],exports.PktCard.prototype,"author",2);e([t.n({type:Boolean})],exports.PktCard.prototype,"borderOnHover",2);e([t.n({type:String,reflect:!0})],exports.PktCard.prototype,"clickCardLink",2);e([t.n({type:String})],exports.PktCard.prototype,"date",2);e([t.n({type:String})],exports.PktCard.prototype,"direction",2);e([t.n({type:String})],exports.PktCard.prototype,"heading",2);e([t.n({type:Number})],exports.PktCard.prototype,"headinglevel",2);e([t.n({type:Object})],exports.PktCard.prototype,"image",2);e([t.n({type:String})],exports.PktCard.prototype,"imageShape",2);e([t.n({type:Boolean})],exports.PktCard.prototype,"openLinkInNewTab",2);e([t.n({type:String})],exports.PktCard.prototype,"padding",2);e([t.n({type:String})],exports.PktCard.prototype,"skin",2);e([t.n({type:String})],exports.PktCard.prototype,"subheading",2);e([t.n({type:String})],exports.PktCard.prototype,"tagPosition",2);e([t.n({type:Array})],exports.PktCard.prototype,"tags",2);exports.PktCard=e([t.t("pkt-card")],exports.PktCard);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { E as n, x as r, n as s, a as d } from "./element-DjjF_tEh.js";
|
|
2
|
-
import { P as k } from "./input-element-
|
|
2
|
+
import { P as k } from "./input-element-4hgBpSNJ.js";
|
|
3
3
|
import { e as b, n as f } from "./ref-iIffqQAI.js";
|
|
4
4
|
import { e as u } from "./class-map-KyMqi0fa.js";
|
|
5
5
|
var _ = Object.defineProperty, y = Object.getOwnPropertyDescriptor, i = (e, h, c, l) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const e=require("./element-BSypUpzA.cjs"),a=require("./input-element-
|
|
1
|
+
"use strict";const e=require("./element-BSypUpzA.cjs"),a=require("./input-element-CwUniARD.cjs"),k=require("./ref-BvbyvXRH.cjs"),o=require("./class-map-DCyaICmy.cjs");var r=Object.defineProperty,u=Object.getOwnPropertyDescriptor,c=(l,t,s,h)=>{for(var i=h>1?void 0:h?u(t,s):t,n=l.length-1,p;n>=0;n--)(p=l[n])&&(i=(h?p(t,s,i):p(i))||i);return h&&i&&r(t,s,i),i};exports.PktCheckbox=class extends a.PktInputElement{constructor(){super(...arguments),this.inputRef=k.e(),this.value="",this.checkHelptext=null,this.defaultChecked=!1,this.hasTile=!1,this.isSwitch=!1,this.labelPosition="right",this.hideLabel=!1,this.checked=null,this.type="checkbox"}connectedCallback(){super.connectedCallback()}attributeChangedCallback(t,s,h){t==="defaultChecked"&&!this.checked&&(this.checked=this.defaultChecked),t==="checked"&&(this.checked=this.checked===""||this.checked==="true"||this.checked===!0),super.attributeChangedCallback(t,s,h)}firstUpdated(t){t.has("defaultChecked")&&!this.checked&&(this.checked=this.defaultChecked),super.firstUpdated(t)}render(){const t=o.e({"pkt-input-check__input":!0,"pkt-input-check__input--tile":this.hasTile,"pkt-input-check__input--tile-disabled":this.disabled&&this.hasTile}),s=o.e({"pkt-input-check__input-checkbox":!0,"pkt-input-check__input-checkbox--error":this.hasError}),h=o.e({"pkt-input-check__input-label":!0,"pkt-input-check__input-label--left":this.labelPosition==="left","pkt-input-check__input-label--right":this.labelPosition==="right","pkt-sr-only":this.hideLabel}),i=()=>e.x`
|
|
2
2
|
<label class=${h} for=${this.id+"-internal"}>
|
|
3
3
|
${this.label}
|
|
4
4
|
${this.checkHelptext?e.x`<div class="pkt-input-check__input-helptext">${this.checkHelptext}</div>`:e.E}
|
|
@@ -4,7 +4,7 @@ import { r as c } from "./state-BtbpSrdV.js";
|
|
|
4
4
|
import { e as _, n as v } from "./ref-iIffqQAI.js";
|
|
5
5
|
import { e as k } from "./class-map-KyMqi0fa.js";
|
|
6
6
|
import { c as R } from "./repeat-D4kMediE.js";
|
|
7
|
-
import { P as V } from "./input-element-
|
|
7
|
+
import { P as V } from "./input-element-4hgBpSNJ.js";
|
|
8
8
|
import { P as C } from "./pkt-options-controller-DepYQBqb.js";
|
|
9
9
|
import { P as S } from "./pkt-slot-controller-DtDaD9q_.js";
|
|
10
10
|
import "./input-wrapper-BdeoMGnk.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const l=require("./element-BSypUpzA.cjs"),c=require("./if-defined-a3sotaUr.cjs"),d=require("./state-B5KCNjEd.cjs"),r=require("./ref-BvbyvXRH.cjs"),$=require("./class-map-DCyaICmy.cjs"),I=require("./repeat-BnuruAat.cjs"),w=require("./input-element-
|
|
1
|
+
"use strict";const l=require("./element-BSypUpzA.cjs"),c=require("./if-defined-a3sotaUr.cjs"),d=require("./state-B5KCNjEd.cjs"),r=require("./ref-BvbyvXRH.cjs"),$=require("./class-map-DCyaICmy.cjs"),I=require("./repeat-BnuruAat.cjs"),w=require("./input-element-CwUniARD.cjs"),y=require("./pkt-options-controller-Ay9ELZTV.cjs"),O=require("./pkt-slot-controller-Da-RgXfS.cjs");require("./input-wrapper-B-f_SotM.cjs");require("./icon-BnKGwYjj.cjs");require("./tag-B9kFYxHg.cjs");require("./listbox-DqpGh7eq.cjs");const C={displayValueAs:{default:"label"}},R={props:C};var V=Object.defineProperty,S=Object.getOwnPropertyDescriptor,o=(b,e,t,i)=>{for(var s=i>1?void 0:i?S(e,t):e,h=b.length-1,n;h>=0;h--)(n=b[h])&&(s=(i?n(e,t,s):n(s))||s);return i&&s&&V(e,t,s),s};exports.PktCombobox=class extends w.PktInputElement{constructor(){super(),this.helptextSlot=r.e(),this.value="",this.options=[],this.allowUserInput=!1,this.typeahead=!1,this.includeSearch=!1,this.searchPlaceholder="",this.multiple=!1,this.maxlength=null,this.displayValueAs=R.props.displayValueAs.default,this.tagPlacement=null,this._options=[],this._isOptionsOpen=!1,this._value=[],this._userInfoMessage="",this._addValueText=null,this._maxIsReached=!1,this._search="",this._inputFocus=!1,this._editingSingleValue=!1,this.inputRef=r.e(),this.arrowRef=r.e(),this.listboxRef=r.e(),this.focusRef=r.e(),this.optionTagRef=r.e(),this.optionsController=new y.PktOptionsSlotController(this),this.slotController=new O.PktSlotController(this,this.helptextSlot),this.slotController.skipOptions=!0}connectedCallback(){if(super.connectedCallback(),document&&document.body.addEventListener("click",e=>{this._isOptionsOpen&&!this.contains(e.target)&&this.handleFocusOut(e)}),this._options=[],this.optionsController.nodes.length){const e=[];this.optionsController.nodes.forEach(t=>{if(!t.textContent&&!t.getAttribute("value"))return null;const i={value:t.getAttribute("value")||t.textContent||"",label:t.textContent||t.getAttribute("value")||""};t.getAttribute("data-prefix")&&(i.prefix=t.getAttribute("data-prefix")||void 0),t.getAttribute("tagskincolor")&&(i.tagSkinColor=t.getAttribute("tagskincolor")),t.getAttribute("description")&&(i.description=t.getAttribute("description")||void 0),i.fulltext=i.value+i.label+(i.prefix||""),e.push(i)}),e.length&&(this.options=[...e],this._options=[...e])}}updated(e){e.has("_value")&&this.valueChanged(this._value,e.get("_value")),e.has("value")&&(this._value=Array.isArray(this.value)?this.value:this.value?this.value.split(","):[],!this.multiple&&this._value.length>1&&(this._value=[this._value[0]]),this.isMaxItemsReached()),e.has("options")&&this.options.length&&(this._options=this.options,this._options.forEach(t=>{if(t.value&&!t.label&&(t.label=t.value),t.selected&&!this._value.includes(t.value)){const i=[...this._value];this._value=[...this._value,t.value],this.valueChanged(this._value,i)}t.fulltext=t.value+t.label+(t.prefix||""),t.selected=t.selected||this._value.includes(t.value)})),e.has("_search")&&this.dispatchEvent(new CustomEvent("search",{detail:this._search,bubbles:!1})),super.updated(e)}attributeChangedCallback(e,t,i){e==="value"&&(this._value=Array.isArray(this.value)?this.value:this.value?this.value.split(","):[],!this.multiple&&this._value.length>1&&(this._value=[this._value[0]])),e==="options"&&(this._options=this.options,this._options.forEach(s=>{s.value&&!s.label&&(s.label=s.value),s.selected&&!this._value.includes(s.value)&&(this._value=[...this._value,s.value]),s.fulltext=s.value+s.label+(s.prefix||"")}),this._search=""),super.attributeChangedCallback(e,t,i)}render(){return l.x`
|
|
2
2
|
<pkt-input-wrapper
|
|
3
3
|
.label=${this.label}
|
|
4
4
|
.helptext=${this.helptext}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const d=require("./class-map-DCyaICmy.cjs"),p=require("./if-defined-a3sotaUr.cjs"),s=require("./element-BSypUpzA.cjs"),m=require("./state-B5KCNjEd.cjs"),h=require("./calendar-CYY42kN4.cjs"),k=require("./input-element-
|
|
1
|
+
"use strict";const d=require("./class-map-DCyaICmy.cjs"),p=require("./if-defined-a3sotaUr.cjs"),s=require("./element-BSypUpzA.cjs"),m=require("./state-B5KCNjEd.cjs"),h=require("./calendar-CYY42kN4.cjs"),k=require("./input-element-CwUniARD.cjs"),r=require("./ref-BvbyvXRH.cjs"),v=require("./repeat-BnuruAat.cjs");require("./icon-BnKGwYjj.cjs");require("./input-wrapper-B-f_SotM.cjs");require("./tag-B9kFYxHg.cjs");const $=require("./pkt-slot-controller-Da-RgXfS.cjs"),y={dateformat:{default:"dd.MM.yyyy"},min:{default:null},max:{default:null},weeknumbers:{default:!1},withcontrols:{default:!1},multiple:{default:!1},range:{default:!1}},o={props:y};var b=Object.defineProperty,x=Object.getOwnPropertyDescriptor,l=(c,t,e,i)=>{for(var a=i>1?void 0:i?x(t,e):t,n=c.length-1,u;n>=0;n--)(u=c[n])&&(a=(i?u(t,e,a):u(a))||a);return i&&a&&b(t,e,a),a};const g=c=>new Promise(t=>setTimeout(t,c));exports.PktDatepicker=class extends k.PktInputElement{constructor(){super(),this.value="",this._value=this.value?Array.isArray(this.value)?this.value:this.value.split(","):[],this.label="Datovelger",this.dateformat=o.props.dateformat.default,this.multiple=o.props.multiple.default,this.maxlength=null,this.range=o.props.range.default,this.showRangeLabels=!1,this.min=null,this.max=null,this.weeknumbers=o.props.weeknumbers.default,this.withcontrols=o.props.withcontrols.default,this.excludedates=[],this.excludeweekdays=[],this.currentmonth=null,this.calendarOpen=!1,this.timezone="Europe/Oslo",this.inputClasses={},this.buttonClasses={},this.inputRef=r.e(),this.inputRefTo=r.e(),this.btnRef=r.e(),this.calRef=r.e(),this.popupRef=r.e(),this.helptextSlot=r.e(),this.addToSelected=t=>{const e=t.target;if(!e.value)return;const i=this.min?h.newDate(this.min):null,a=this.max?h.newDate(this.max):null,n=h.newDate(e.value.split(",")[0]);n&&!isNaN(n.getTime())&&(!i||n>=i)&&(!a||n<=a)&&this.calRef.value&&this.calRef.value.handleDateSelect(n),e.value=""},this.slotController=new $.PktSlotController(this,this.helptextSlot)}async connectedCallback(){super.connectedCallback();const t=navigator.userAgent,e=/iP(hone|od|ad)/.test(t);this.inputType=e?"text":"date",document&&document.body.addEventListener("click",i=>{var a,n;(a=this.inputRef)!=null&&a.value&&((n=this.btnRef)!=null&&n.value)&&!this.inputRef.value.contains(i.target)&&!(this.inputRefTo.value&&this.inputRefTo.value.contains(i.target))&&!this.btnRef.value.contains(i.target)&&!i.target.closest(".pkt-calendar-popup")&&this.calendarOpen&&(this.onBlur(),this.hideCalendar())}),this.value.length&&this._value.length===0&&(this._value=Array.isArray(this.value)?this.value:this.value.split(",")),this.min=this.min||o.props.min.default,this.max=this.max||o.props.max.default,typeof this.excludedates=="string"&&(this.excludedates=this.excludedates.split(",")),typeof this.excludeweekdays=="string"&&(this.excludeweekdays=this.excludeweekdays.split(",")),(this.multiple||this.range)&&this.name&&!this.name.endsWith("[]")&&(this.name=this.name+"[]"),this.calendarOpen&&(await g(20),this.handleCalendarPosition())}disconnectedCallback(){super.disconnectedCallback(),document&&document.body.removeEventListener("click",t=>{var e,i;(e=this.inputRef)!=null&&e.value&&((i=this.btnRef)!=null&&i.value)&&!this.inputRef.value.contains(t.target)&&!this.btnRef.value.contains(t.target)&&this.hideCalendar()})}attributeChangedCallback(t,e,i){if(t==="value"){if(this.range&&(i==null?void 0:i.split(",").length)===1)return;this.value!==e&&this.valueChanged(i,e)}t==="excludedates"&&typeof this.excludedates=="string"&&(this.excludedates=(i==null?void 0:i.split(","))??[]),t==="excludeweekdays"&&typeof this.excludeweekdays=="string"&&(this.excludeweekdays=(i==null?void 0:i.split(","))??[]),super.attributeChangedCallback(t,e,i)}updated(t){if(t.has("value")){if(this.range&&this.value.length===1)return;this.valueChanged(this.value,t.get("value"))}super.updated(t)}renderInput(){return s.x`
|
|
2
2
|
<input
|
|
3
3
|
class="${d.e(this.inputClasses)}"
|
|
4
4
|
.type=${this.inputType}
|
|
@@ -3,7 +3,7 @@ import { o } from "./if-defined-BErSJCeJ.js";
|
|
|
3
3
|
import { x as u, E as g, n as r, a as w } from "./element-DjjF_tEh.js";
|
|
4
4
|
import { r as k } from "./state-BtbpSrdV.js";
|
|
5
5
|
import { n as v, f as $, a as R, b as y, d as x } from "./calendar-KDcOWD6V.js";
|
|
6
|
-
import { P as C } from "./input-element-
|
|
6
|
+
import { P as C } from "./input-element-4hgBpSNJ.js";
|
|
7
7
|
import { e as m, n as p } from "./ref-iIffqQAI.js";
|
|
8
8
|
import { c as T } from "./repeat-D4kMediE.js";
|
|
9
9
|
import "./icon-Beoxup8E.js";
|
package/dist/index.d.ts
CHANGED
|
@@ -117,6 +117,30 @@ export declare interface IPktButton {
|
|
|
117
117
|
disabled?: Booleanish;
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
+
declare interface IPktCard {
|
|
121
|
+
ariaLabel?: IAriaAttributes['aria-label'];
|
|
122
|
+
author?: string | null;
|
|
123
|
+
date?: string | null;
|
|
124
|
+
direction?: TDirection;
|
|
125
|
+
heading?: string;
|
|
126
|
+
headingLevel?: IPktHeading['level'];
|
|
127
|
+
image?: {
|
|
128
|
+
src: string;
|
|
129
|
+
alt: string;
|
|
130
|
+
};
|
|
131
|
+
imageShape?: TCardImageShape;
|
|
132
|
+
clickCardLink?: string | null;
|
|
133
|
+
openLinkInNewTab?: boolean | null;
|
|
134
|
+
borderOnHover?: boolean | null;
|
|
135
|
+
padding?: TCardPadding;
|
|
136
|
+
skin?: TCardSkin;
|
|
137
|
+
subheading?: string;
|
|
138
|
+
tagPosition?: TCardTagPosition;
|
|
139
|
+
tags?: (Omit<IPktTag, 'closeTag'> & {
|
|
140
|
+
text: string;
|
|
141
|
+
})[];
|
|
142
|
+
}
|
|
143
|
+
|
|
120
144
|
export declare interface IPktCombobox {
|
|
121
145
|
allowUserInput?: boolean;
|
|
122
146
|
typeahead?: boolean;
|
|
@@ -425,22 +449,40 @@ export declare class PktCalendar extends PktElement {
|
|
|
425
449
|
close(): void;
|
|
426
450
|
}
|
|
427
451
|
|
|
428
|
-
export declare class PktCard extends PktElement {
|
|
452
|
+
export declare class PktCard extends PktElement implements IPktCard {
|
|
429
453
|
defaultSlot: Ref<HTMLElement>;
|
|
430
454
|
constructor();
|
|
431
|
-
|
|
455
|
+
ariaLabel: string;
|
|
456
|
+
author: string | null;
|
|
457
|
+
borderOnHover: boolean;
|
|
458
|
+
clickCardLink: IPktCard['clickCardLink'];
|
|
459
|
+
date: string | null;
|
|
432
460
|
direction: TDirection;
|
|
461
|
+
heading: string;
|
|
462
|
+
headinglevel: IPktHeading['level'];
|
|
433
463
|
image: {
|
|
434
464
|
src: string;
|
|
435
465
|
alt: string;
|
|
436
466
|
};
|
|
437
|
-
|
|
467
|
+
imageShape: TCardImageShape;
|
|
468
|
+
openLinkInNewTab: boolean;
|
|
469
|
+
padding: TCardPadding;
|
|
470
|
+
skin: TCardSkin;
|
|
438
471
|
subheading: string;
|
|
472
|
+
tagPosition: 'top' | 'bottom';
|
|
439
473
|
tags: (Omit<IPktTag, 'closeTag'> & {
|
|
440
474
|
text: string;
|
|
441
475
|
})[];
|
|
442
476
|
connectedCallback(): void;
|
|
443
477
|
render(): TemplateResult<1>;
|
|
478
|
+
renderImage(): TemplateResult<1>;
|
|
479
|
+
renderHeading(): TemplateResult<1>;
|
|
480
|
+
renderLinkHeading(): TemplateResult<1>;
|
|
481
|
+
renderSubheading(): TemplateResult<1>;
|
|
482
|
+
renderHeader(): TemplateResult<1>;
|
|
483
|
+
renderTags(): TemplateResult<1>;
|
|
484
|
+
renderSlot(): TemplateResult<1>;
|
|
485
|
+
renderCreditline(): TemplateResult<1>;
|
|
444
486
|
}
|
|
445
487
|
|
|
446
488
|
export declare class PktCheckbox extends PktInputElement {
|
|
@@ -1115,7 +1157,13 @@ declare type TAriaRelevant = 'additions' | 'removals' | 'text' | 'all';
|
|
|
1115
1157
|
|
|
1116
1158
|
declare type TAriaSort = 'none' | 'ascending' | 'descending' | 'other';
|
|
1117
1159
|
|
|
1118
|
-
declare type
|
|
1160
|
+
declare type TCardImageShape = 'square' | 'round';
|
|
1161
|
+
|
|
1162
|
+
declare type TCardPadding = 'none' | 'standard';
|
|
1163
|
+
|
|
1164
|
+
declare type TCardSkin = 'outlined' | 'outlined-beige' | 'gray' | 'beige' | 'green' | 'blue';
|
|
1165
|
+
|
|
1166
|
+
declare type TCardTagPosition = 'top' | 'bottom';
|
|
1119
1167
|
|
|
1120
1168
|
declare type TCounterPosition = 'top' | 'bottom';
|
|
1121
1169
|
|