@oslokommune/punkt-elements 13.4.0 → 13.4.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.
- package/CHANGELOG.md +34 -0
- package/dist/{alert-B0OUR9oD.js → alert-B07oUpkq.js} +5 -4
- package/dist/{alert-BH0lJ2ny.cjs → alert-DQNBDKjT.cjs} +1 -1
- package/dist/{backlink-B13JTp9D.js → backlink-C2jbzu0U.js} +16 -15
- package/dist/backlink-JbBNi3qg.cjs +13 -0
- package/dist/{button-CDocR7iN.cjs → button-B8rdtaHB.cjs} +1 -1
- package/dist/{button-DrrEvUy9.js → button-DhispFOY.js} +1 -0
- package/dist/{card-uccD6Pnv.cjs → card-BUITGoqX.cjs} +10 -10
- package/dist/{card-BI1NZONj.js → card-Dtw26f7i.js} +96 -76
- package/dist/checkbox-Gn7Wtk9h.cjs +31 -0
- package/dist/checkbox-ym7z6cpt.js +142 -0
- package/dist/{combobox-BhcqC30d.cjs → combobox-DjO0RMUB.cjs} +1 -1
- package/dist/{combobox-D9dGKWuZ.js → combobox-yE4aYhTi.js} +1 -1
- package/dist/{consent-CftYu8Di.js → consent-BpcQFvbi.js} +1 -1
- package/dist/{consent-DrS71kvz.cjs → consent-hYeFWNFr.cjs} +1 -1
- package/dist/index.d.ts +3 -0
- 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-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-consent.cjs +1 -1
- package/dist/pkt-consent.js +1 -1
- package/dist/pkt-index.cjs +1 -1
- package/dist/pkt-index.js +7 -7
- package/package.json +2 -2
- package/src/components/accordion/accordion.test.ts +0 -4
- package/src/components/alert/alert.test.ts +348 -0
- package/src/components/alert/alert.ts +1 -0
- package/src/components/backlink/backlink.test.ts +286 -0
- package/src/components/backlink/backlink.ts +5 -3
- package/src/components/button/button.test.ts +514 -0
- package/src/components/button/button.ts +2 -0
- package/src/components/card/card.test.ts +592 -0
- package/src/components/card/card.ts +24 -1
- package/src/components/checkbox/checkbox.test.ts +535 -0
- package/src/components/checkbox/checkbox.ts +44 -1
- package/src/components/combobox/combobox.test.ts +737 -0
- package/src/components/combobox/combobox.ts +1 -1
- package/dist/backlink-C5jQRMwJ.cjs +0 -13
- package/dist/checkbox-CTRbpbye.js +0 -120
- package/dist/checkbox-wJ26voZd.cjs +0 -30
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,40 @@ og skriver commits ca etter [Conventional Commits](https://conventionalcommits.o
|
|
|
5
5
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
+
## [13.4.2](https://github.com/oslokommune/punkt/compare/13.4.1...13.4.2) (2025-09-04)
|
|
9
|
+
|
|
10
|
+
### ⚠ BREAKING CHANGES
|
|
11
|
+
Ingen
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
Ingen
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
Ingen
|
|
18
|
+
|
|
19
|
+
### Chores
|
|
20
|
+
Ingen
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
## [13.4.1](https://github.com/oslokommune/punkt/compare/13.4.0...13.4.1) (2025-09-03)
|
|
26
|
+
|
|
27
|
+
### ⚠ BREAKING CHANGES
|
|
28
|
+
Ingen
|
|
29
|
+
|
|
30
|
+
### Features
|
|
31
|
+
Ingen
|
|
32
|
+
|
|
33
|
+
### Bug Fixes
|
|
34
|
+
Ingen
|
|
35
|
+
|
|
36
|
+
### Chores
|
|
37
|
+
Ingen
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
|
|
8
42
|
## [13.4.0](https://github.com/oslokommune/punkt/compare/13.3.1...13.4.0) (2025-09-03)
|
|
9
43
|
|
|
10
44
|
### ⚠ BREAKING CHANGES
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { e as u } from "./class-map-BpTj9gtz.js";
|
|
2
2
|
import { P as f, E as h, x as p, n as a, a as v } from "./element-CgEWt74-.js";
|
|
3
|
-
import { r as
|
|
4
|
-
import { P as
|
|
3
|
+
import { r as m } from "./state-Bo2bck5_.js";
|
|
4
|
+
import { P as k } from "./pkt-slot-controller-BPGj-LC5.js";
|
|
5
5
|
import { e as _, n as b } from "./ref-BBYSqgeW.js";
|
|
6
6
|
import { u as y } from "./classutils-RQs1k6D9.js";
|
|
7
7
|
import "./icon-CC1js8eR.js";
|
|
8
|
+
import "./button-DhispFOY.js";
|
|
8
9
|
const C = {
|
|
9
10
|
skin: {
|
|
10
11
|
default: "info"
|
|
@@ -34,7 +35,7 @@ let e = class extends f {
|
|
|
34
35
|
), this.dispatchEvent(
|
|
35
36
|
new CustomEvent("on-close", { detail: { origin: t }, bubbles: !0, composed: !0 })
|
|
36
37
|
);
|
|
37
|
-
}, this.slotController = new
|
|
38
|
+
}, this.slotController = new k(this, this.defaultSlot), this._isClosed = !1;
|
|
38
39
|
}
|
|
39
40
|
// Lifecycle
|
|
40
41
|
connectedCallback() {
|
|
@@ -117,7 +118,7 @@ i([
|
|
|
117
118
|
a({ type: String, reflect: !0 })
|
|
118
119
|
], e.prototype, "role", 2);
|
|
119
120
|
i([
|
|
120
|
-
|
|
121
|
+
m()
|
|
121
122
|
], e.prototype, "_isClosed", 2);
|
|
122
123
|
e = i([
|
|
123
124
|
v("pkt-alert")
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const c=require("./class-map-BBG2gMX4.cjs"),t=require("./element-6DBpyGQm.cjs"),d=require("./state-DPobt-Yz.cjs"),h=require("./pkt-slot-controller-BzddBp7z.cjs"),u=require("./ref-iJtiv3o2.cjs"),k=require("./classutils-BwNK82ZQ.cjs");require("./icon-B_ryAy4Q.cjs");const v={skin:{default:"info"},ariaLive:{default:"polite"},compact:{default:!1},closeAlert:{default:!1}},a={props:v};var f=Object.defineProperty,_=Object.getOwnPropertyDescriptor,i=(o,e,s,
|
|
1
|
+
"use strict";const c=require("./class-map-BBG2gMX4.cjs"),t=require("./element-6DBpyGQm.cjs"),d=require("./state-DPobt-Yz.cjs"),h=require("./pkt-slot-controller-BzddBp7z.cjs"),u=require("./ref-iJtiv3o2.cjs"),k=require("./classutils-BwNK82ZQ.cjs");require("./icon-B_ryAy4Q.cjs");require("./button-B8rdtaHB.cjs");const v={skin:{default:"info"},ariaLive:{default:"polite"},compact:{default:!1},closeAlert:{default:!1}},a={props:v};var f=Object.defineProperty,_=Object.getOwnPropertyDescriptor,i=(o,e,s,r)=>{for(var l=r>1?void 0:r?_(e,s):e,p=o.length-1,n;p>=0;p--)(n=o[p])&&(l=(r?n(e,s,l):n(l))||l);return r&&l&&f(e,s,l),l};exports.PktAlert=class extends t.PktElement{constructor(){super(),this.defaultSlot=u.e(),this.compact=a.props.compact.default,this.title="",this.skin=a.props.skin.default,this.ariaLive=a.props.ariaLive.default,this["aria-live"]=null,this.closeAlert=a.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.slotController=new h.PktSlotController(this,this.defaultSlot),this._isClosed=!1}connectedCallback(){super.connectedCallback(),this["aria-live"]=this.getAttribute("aria-live")||this.ariaLive}attributeChangedCallback(e,s,r){e==="ariaLive"&&(this["aria-live"]=r),super.attributeChangedCallback(e,s,r)}updated(e){super.updated(e),e.has("ariaLive")&&(this["aria-live"]=this.ariaLive),e.has("_isClosed")&&k.updateClassAttribute(this,"pkt-hide",this._isClosed)}render(){const e={"pkt-alert":!0,"pkt-alert--compact":this.compact,[`pkt-alert--${this.skin}`]:this.skin,"pkt-hide":this._isClosed},s={"pkt-alert__grid":!0,"pkt-alert__noTitle":!this.title,"pkt-alert__noDate":!this.date};return t.x`
|
|
2
2
|
<div class=${c.e(e)} aria-live=${this["aria-live"]}>
|
|
3
3
|
<div class=${c.e(s)}>
|
|
4
4
|
<pkt-icon
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { P as c, x as k, n as o, a as
|
|
2
|
-
import { o as
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { P as c, x as k, n as o, a as h } from "./element-CgEWt74-.js";
|
|
2
|
+
import { o as b } from "./if-defined-CmuO4Vz9.js";
|
|
3
|
+
import "./icon-CC1js8eR.js";
|
|
4
|
+
var f = Object.defineProperty, u = Object.getOwnPropertyDescriptor, l = (t, r, i, s) => {
|
|
5
|
+
for (var e = s > 1 ? void 0 : s ? u(r, i) : r, n = t.length - 1, p; n >= 0; n--)
|
|
6
|
+
(p = t[n]) && (e = (s ? p(r, i, e) : p(e)) || e);
|
|
7
|
+
return s && e && f(r, i, e), e;
|
|
7
8
|
};
|
|
8
9
|
let a = class extends c {
|
|
9
10
|
constructor() {
|
|
@@ -18,7 +19,7 @@ let a = class extends c {
|
|
|
18
19
|
class="pkt-back-link"
|
|
19
20
|
aria-label=${this.ariaLabel || "Gå tilbake til forrige side"}
|
|
20
21
|
>
|
|
21
|
-
<a href=${
|
|
22
|
+
<a href=${b(this.href || "/")} class="pkt-link pkt-link--icon-left"
|
|
22
23
|
><pkt-icon
|
|
23
24
|
class="pkt-back-link__icon pkt-icon pkt-link__icon"
|
|
24
25
|
name="chevron-thin-left"
|
|
@@ -29,17 +30,17 @@ let a = class extends c {
|
|
|
29
30
|
</nav>`;
|
|
30
31
|
}
|
|
31
32
|
};
|
|
32
|
-
|
|
33
|
-
o({ type: String
|
|
33
|
+
l([
|
|
34
|
+
o({ type: String })
|
|
34
35
|
], a.prototype, "href", 2);
|
|
35
|
-
|
|
36
|
-
o({ type: String
|
|
36
|
+
l([
|
|
37
|
+
o({ type: String })
|
|
37
38
|
], a.prototype, "text", 2);
|
|
38
|
-
|
|
39
|
-
o({ type: String
|
|
39
|
+
l([
|
|
40
|
+
o({ type: String })
|
|
40
41
|
], a.prototype, "ariaLabel", 2);
|
|
41
|
-
a =
|
|
42
|
-
|
|
42
|
+
a = l([
|
|
43
|
+
h("pkt-backlink")
|
|
43
44
|
], a);
|
|
44
45
|
export {
|
|
45
46
|
a as P
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";const r=require("./element-6DBpyGQm.cjs"),c=require("./if-defined-Cni-RHLS.cjs");require("./icon-B_ryAy4Q.cjs");var p=Object.defineProperty,o=Object.getOwnPropertyDescriptor,n=(k,t,a,i)=>{for(var e=i>1?void 0:i?o(t,a):t,s=k.length-1,l;s>=0;s--)(l=k[s])&&(e=(i?l(t,a,e):l(e))||e);return i&&e&&p(t,a,e),e};exports.PktBackLink=class extends r.PktElement{constructor(){super(...arguments),this.href="",this.text="Forsiden",this.ariaLabel=""}attributeChangedCallback(t,a,i){t==="arialabel"&&this.removeAttribute("arialabel"),t==="href"&&this.removeAttribute("href"),t==="text"&&this.removeAttribute("text"),super.attributeChangedCallback(t,a,i)}render(){return r.x`<nav
|
|
2
|
+
class="pkt-back-link"
|
|
3
|
+
aria-label=${this.ariaLabel||"Gå tilbake til forrige side"}
|
|
4
|
+
>
|
|
5
|
+
<a href=${c.o(this.href||"/")} class="pkt-link pkt-link--icon-left"
|
|
6
|
+
><pkt-icon
|
|
7
|
+
class="pkt-back-link__icon pkt-icon pkt-link__icon"
|
|
8
|
+
name="chevron-thin-left"
|
|
9
|
+
aria-hidden="true"
|
|
10
|
+
></pkt-icon
|
|
11
|
+
><span class="pkt-back-link__text">${this.text}</span></a
|
|
12
|
+
>
|
|
13
|
+
</nav>`}};n([r.n({type:String})],exports.PktBackLink.prototype,"href",2);n([r.n({type:String})],exports.PktBackLink.prototype,"text",2);n([r.n({type:String})],exports.PktBackLink.prototype,"ariaLabel",2);exports.PktBackLink=n([r.t("pkt-backlink")],exports.PktBackLink);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const t=require("./element-6DBpyGQm.cjs"),h=require("./pkt-slot-controller-BzddBp7z.cjs"),u=require("./class-map-BBG2gMX4.cjs"),a=require("./if-defined-Cni-RHLS.cjs"),d=require("./ref-iJtiv3o2.cjs");var c=Object.defineProperty,k=Object.getOwnPropertyDescriptor,e=(r,i,s,n)=>{for(var o=n>1?void 0:n?k(i,s):i,p=r.length-1,l;p>=0;p--)(l=r[p])&&(o=(n?l(i,s,o):l(o))||o);return n&&o&&c(i,s,o),o};window.pktAnimationPath=window.pktAnimationPath||"https://punkt-cdn.oslo.kommune.no/latest/animations/";exports.PktButton=class extends t.PktElement{constructor(){super(),this.defaultSlot=d.e(),this.iconName="user",this.secondIconName="user",this.mode="light",this.size="medium",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=window.pktAnimationPath,this.slotController=new h.PktSlotController(this,this.defaultSlot)}connectedCallback(){super.connectedCallback(),this.addEventListener("click",i=>{(this.disabled||this.hasAttribute("disabled")||this.isLoading)&&(i.preventDefault(),i.stopImmediatePropagation())},!0),this.addEventListener("keydown",i=>{(this.disabled||this.hasAttribute("disabled")||this.isLoading)&&(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),i.stopImmediatePropagation())},!0)}attributeChangedCallback(i,s,n){super.attributeChangedCallback(i,s,n),i==="disabled"&&n==="false"&&(this.disabled=!1),(i==="isloading"||i==="isLoading")&&n==="false"&&(this.isLoading=!1)}firstUpdated(i){super.firstUpdated(i),this.disabled==="false"&&(this.disabled=!1),this.isLoading==="false"&&(this.isLoading=!1)}render(){const i=this.form??this.getAttribute("form")??void 0,s={"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--disabled":!!this.disabled,"pkt-btn--isLoading":!!this.isLoading};return t.x`
|
|
1
|
+
"use strict";const t=require("./element-6DBpyGQm.cjs"),h=require("./pkt-slot-controller-BzddBp7z.cjs"),u=require("./class-map-BBG2gMX4.cjs"),a=require("./if-defined-Cni-RHLS.cjs"),d=require("./ref-iJtiv3o2.cjs");require("./icon-B_ryAy4Q.cjs");var c=Object.defineProperty,k=Object.getOwnPropertyDescriptor,e=(r,i,s,n)=>{for(var o=n>1?void 0:n?k(i,s):i,p=r.length-1,l;p>=0;p--)(l=r[p])&&(o=(n?l(i,s,o):l(o))||o);return n&&o&&c(i,s,o),o};window.pktAnimationPath=window.pktAnimationPath||"https://punkt-cdn.oslo.kommune.no/latest/animations/";exports.PktButton=class extends t.PktElement{constructor(){super(),this.defaultSlot=d.e(),this.iconName="user",this.secondIconName="user",this.mode="light",this.size="medium",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=window.pktAnimationPath,this.slotController=new h.PktSlotController(this,this.defaultSlot)}connectedCallback(){super.connectedCallback(),this.addEventListener("click",i=>{(this.disabled||this.hasAttribute("disabled")||this.isLoading)&&(i.preventDefault(),i.stopImmediatePropagation())},!0),this.addEventListener("keydown",i=>{(this.disabled||this.hasAttribute("disabled")||this.isLoading)&&(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),i.stopImmediatePropagation())},!0)}attributeChangedCallback(i,s,n){super.attributeChangedCallback(i,s,n),i==="disabled"&&n==="false"&&(this.disabled=!1),(i==="isloading"||i==="isLoading")&&n==="false"&&(this.isLoading=!1)}firstUpdated(i){super.firstUpdated(i),this.disabled==="false"&&(this.disabled=!1),this.isLoading==="false"&&(this.isLoading=!1)}render(){const i=this.form??this.getAttribute("form")??void 0,s={"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--disabled":!!this.disabled,"pkt-btn--isLoading":!!this.isLoading};return t.x`
|
|
2
2
|
<button
|
|
3
3
|
class=${u.e(s)}
|
|
4
4
|
type=${this.type}
|
|
@@ -3,6 +3,7 @@ import { P as m } from "./pkt-slot-controller-BPGj-LC5.js";
|
|
|
3
3
|
import { e as u } from "./class-map-BpTj9gtz.js";
|
|
4
4
|
import { o as l } from "./if-defined-CmuO4Vz9.js";
|
|
5
5
|
import { e as y, n as k } from "./ref-BBYSqgeW.js";
|
|
6
|
+
import "./icon-CC1js8eR.js";
|
|
6
7
|
var g = Object.defineProperty, $ = Object.getOwnPropertyDescriptor, e = (t, o, n, r) => {
|
|
7
8
|
for (var a = r > 1 ? void 0 : r ? $(o, n) : o, d = t.length - 1, h; d >= 0; d--)
|
|
8
9
|
(h = t[d]) && (a = (r ? h(o, n, a) : h(a)) || a);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const p=require("./class-map-BBG2gMX4.cjs"),h=require("./if-defined-Cni-RHLS.cjs"),t=require("./element-6DBpyGQm.cjs"),g=require("./pkt-slot-controller-BzddBp7z.cjs"),c=require("./ref-iJtiv3o2.cjs");require("./icon-B_ryAy4Q.cjs");require("./tag-Bbs0U_Au.cjs");require("./heading-BRE_iFtR.cjs");const k={layout:{default:"vertical"},skin:{type:["outlined","outlined-beige","gray","blue","beige","green"],default:"outlined"},padding:{default:"default"}},o={props:k};var u=Object.defineProperty,m=Object.getOwnPropertyDescriptor,e=(i,a,s,n)=>{for(var r=n>1?void 0:n?m(a,s):a,d=i.length-1,l;d>=0;d--)(l=i[d])&&(r=(n?l(a,s,r):l(r))||r);return n&&r&&u(a,s,r),r};exports.PktCard=class extends t.PktElement{constructor(){super(),this.defaultSlot=c.e(),this.ariaLabel="",this.metaLead=null,this.borderOnHover=!0,this.clickCardLink=null,this.metaTrail=null,this.layout=o.props.layout.default,this.heading="",this.headinglevel=3,this.image={src:"",alt:""},this.imageShape="square",this.openLinkInNewTab=!1,this.padding=o.props.padding.default,this.skin=o.props.skin.default,this.subheading="",this.tagPosition="top",this.tags=[],this.slotController=new g.PktSlotController(this,this.defaultSlot)}connectedCallback(){super.connectedCallback()}render(){var r,d;const a={"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},s=((r=this.ariaLabel)==null?void 0:r.trim())||(this.heading?`${this.heading} lenkekort`:"lenkekort"),n=((d=this.ariaLabel)==null?void 0:d.trim())||(this.heading?this.heading:"kort");return t.x`
|
|
2
2
|
<article
|
|
3
|
-
class=${
|
|
4
|
-
aria-label=${
|
|
3
|
+
class=${p.e(a)}
|
|
4
|
+
aria-label=${h.o(this.clickCardLink?s:n)}
|
|
5
5
|
>
|
|
6
6
|
${this.renderImage()}
|
|
7
7
|
<div class="pkt-card__wrapper">
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
</article>
|
|
15
15
|
`}renderImage(){const a={"pkt-card__image":!0,[`pkt-card__image-${this.imageShape}`]:this.imageShape};return t.x`
|
|
16
16
|
${this.image.src&&t.x`
|
|
17
|
-
<div class=${
|
|
17
|
+
<div class=${p.e(a)}>
|
|
18
18
|
<img src=${this.image.src} alt=${this.image.alt||""} />
|
|
19
19
|
</div>
|
|
20
20
|
`}
|
|
@@ -58,19 +58,19 @@
|
|
|
58
58
|
`}renderTags(){const a={"pkt-card__tags":!0,[`pkt-card__tags-${this.tagPosition}`]:this.tagPosition};return t.x`
|
|
59
59
|
${this.tags.length>0?t.x`
|
|
60
60
|
<div
|
|
61
|
-
class=${
|
|
61
|
+
class=${p.e(a)}
|
|
62
62
|
role="list"
|
|
63
63
|
aria-label=${this.tags.length>1?"merkelapper":"merkelapp"}
|
|
64
64
|
>
|
|
65
|
-
${this.tags.map(
|
|
65
|
+
${this.tags.map(s=>t.x`
|
|
66
66
|
<pkt-tag
|
|
67
67
|
role="listitem"
|
|
68
68
|
textStyle="normal-text"
|
|
69
69
|
size="medium"
|
|
70
|
-
skin=${
|
|
71
|
-
iconName=${
|
|
70
|
+
skin=${h.o(s.skin)}
|
|
71
|
+
iconName=${h.o(s.iconName)}
|
|
72
72
|
>
|
|
73
|
-
<span>${
|
|
73
|
+
<span>${s.text}</span>
|
|
74
74
|
</pkt-tag>
|
|
75
75
|
`)}
|
|
76
76
|
</div>
|
|
@@ -84,4 +84,4 @@
|
|
|
84
84
|
${this.metaTrail?t.x`<span class="pkt-card__metadata-trail">${this.metaTrail}</span>`:t.E}
|
|
85
85
|
</footer>
|
|
86
86
|
`:t.E}
|
|
87
|
-
`}};e([t.n({type:String})],exports.PktCard.prototype,"ariaLabel",2);e([t.n({type:String})],exports.PktCard.prototype,"metaLead",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,"metaTrail",2);e([t.n({type:String})],exports.PktCard.prototype,"layout",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);
|
|
87
|
+
`}};e([t.n({type:String})],exports.PktCard.prototype,"ariaLabel",2);e([t.n({type:String})],exports.PktCard.prototype,"metaLead",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,"metaTrail",2);e([t.n({type:String})],exports.PktCard.prototype,"layout",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,converter:{fromAttribute:i=>{const a=o.props.skin.type;return i&&a.includes(i)?i:(i&&!a.includes(i)&&console.warn(`Invalid skin value "${i}". Using default skin "${o.props.skin.default}".`),o.props.skin.default)},toAttribute:i=>i}})],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,35 +1,44 @@
|
|
|
1
|
-
import { e as
|
|
2
|
-
import { o as
|
|
3
|
-
import { P as
|
|
1
|
+
import { e as c } from "./class-map-BpTj9gtz.js";
|
|
2
|
+
import { o as k } from "./if-defined-CmuO4Vz9.js";
|
|
3
|
+
import { P as u, E as d, x as t, n as r, a as m } from "./element-CgEWt74-.js";
|
|
4
4
|
import { P as $ } from "./pkt-slot-controller-BPGj-LC5.js";
|
|
5
5
|
import { e as y, n as _ } from "./ref-BBYSqgeW.js";
|
|
6
6
|
import "./icon-CC1js8eR.js";
|
|
7
7
|
import "./tag-DyXzTY68.js";
|
|
8
|
+
import "./heading-D6jXE_Mz.js";
|
|
8
9
|
const b = {
|
|
9
10
|
layout: {
|
|
10
11
|
default: "vertical"
|
|
11
12
|
},
|
|
12
13
|
skin: {
|
|
14
|
+
type: [
|
|
15
|
+
"outlined",
|
|
16
|
+
"outlined-beige",
|
|
17
|
+
"gray",
|
|
18
|
+
"blue",
|
|
19
|
+
"beige",
|
|
20
|
+
"green"
|
|
21
|
+
],
|
|
13
22
|
default: "outlined"
|
|
14
23
|
},
|
|
15
24
|
padding: {
|
|
16
25
|
default: "default"
|
|
17
26
|
}
|
|
18
|
-
},
|
|
27
|
+
}, p = {
|
|
19
28
|
props: b
|
|
20
29
|
};
|
|
21
|
-
var f = Object.defineProperty, S = Object.getOwnPropertyDescriptor,
|
|
22
|
-
for (var n =
|
|
23
|
-
(
|
|
24
|
-
return
|
|
30
|
+
var f = Object.defineProperty, S = Object.getOwnPropertyDescriptor, i = (e, s, l, o) => {
|
|
31
|
+
for (var n = o > 1 ? void 0 : o ? S(s, l) : s, h = e.length - 1, g; h >= 0; h--)
|
|
32
|
+
(g = e[h]) && (n = (o ? g(s, l, n) : g(n)) || n);
|
|
33
|
+
return o && n && f(s, l, n), n;
|
|
25
34
|
};
|
|
26
|
-
let
|
|
35
|
+
let a = class extends u {
|
|
27
36
|
//Constructor
|
|
28
37
|
constructor() {
|
|
29
|
-
super(), this.defaultSlot = y(), this.ariaLabel = "", this.metaLead = null, this.borderOnHover = !0, this.clickCardLink = null, this.metaTrail = null, this.layout =
|
|
38
|
+
super(), this.defaultSlot = y(), this.ariaLabel = "", this.metaLead = null, this.borderOnHover = !0, this.clickCardLink = null, this.metaTrail = null, this.layout = p.props.layout.default, this.heading = "", this.headinglevel = 3, this.image = {
|
|
30
39
|
src: "",
|
|
31
40
|
alt: ""
|
|
32
|
-
}, this.imageShape = "square", this.openLinkInNewTab = !1, this.padding =
|
|
41
|
+
}, this.imageShape = "square", this.openLinkInNewTab = !1, this.padding = p.props.padding.default, this.skin = p.props.skin.default, this.subheading = "", this.tagPosition = "top", this.tags = [], this.slotController = new $(this, this.defaultSlot);
|
|
33
42
|
}
|
|
34
43
|
connectedCallback() {
|
|
35
44
|
super.connectedCallback();
|
|
@@ -38,18 +47,18 @@ let e = class extends m {
|
|
|
38
47
|
// Main render method
|
|
39
48
|
// prettier-ignore
|
|
40
49
|
render() {
|
|
41
|
-
var
|
|
42
|
-
const
|
|
50
|
+
var o, n;
|
|
51
|
+
const e = {
|
|
43
52
|
"pkt-card": !0,
|
|
44
53
|
[`pkt-card--${this.skin}`]: this.skin,
|
|
45
54
|
[`pkt-card--${this.layout}`]: this.layout,
|
|
46
55
|
[`pkt-card--padding-${this.padding}`]: this.padding,
|
|
47
56
|
"pkt-card--border-on-hover": this.borderOnHover
|
|
48
|
-
}, s = ((
|
|
57
|
+
}, s = ((o = this.ariaLabel) == null ? void 0 : o.trim()) || (this.heading ? `${this.heading} lenkekort` : "lenkekort"), l = ((n = this.ariaLabel) == null ? void 0 : n.trim()) || (this.heading ? this.heading : "kort");
|
|
49
58
|
return t`
|
|
50
59
|
<article
|
|
51
|
-
class=${
|
|
52
|
-
aria-label=${
|
|
60
|
+
class=${c(e)}
|
|
61
|
+
aria-label=${k(this.clickCardLink ? s : l)}
|
|
53
62
|
>
|
|
54
63
|
${this.renderImage()}
|
|
55
64
|
<div class="pkt-card__wrapper">
|
|
@@ -64,13 +73,13 @@ let e = class extends m {
|
|
|
64
73
|
}
|
|
65
74
|
// Render methods for different parts of the card
|
|
66
75
|
renderImage() {
|
|
67
|
-
const
|
|
76
|
+
const e = {
|
|
68
77
|
"pkt-card__image": !0,
|
|
69
78
|
[`pkt-card__image-${this.imageShape}`]: this.imageShape
|
|
70
79
|
};
|
|
71
80
|
return t`
|
|
72
81
|
${this.image.src && t`
|
|
73
|
-
<div class=${
|
|
82
|
+
<div class=${c(e)}>
|
|
74
83
|
<img src=${this.image.src} alt=${this.image.alt || ""} />
|
|
75
84
|
</div>
|
|
76
85
|
`}
|
|
@@ -119,9 +128,9 @@ let e = class extends m {
|
|
|
119
128
|
// Render header
|
|
120
129
|
// prettier-ignore
|
|
121
130
|
renderHeader() {
|
|
122
|
-
const
|
|
131
|
+
const e = !!this.heading || !!this.subheading;
|
|
123
132
|
return t`
|
|
124
|
-
${
|
|
133
|
+
${e ? t`
|
|
125
134
|
<header class="pkt-card__header">
|
|
126
135
|
${this.renderHeading()}
|
|
127
136
|
${this.renderLinkHeading()}
|
|
@@ -131,14 +140,14 @@ let e = class extends m {
|
|
|
131
140
|
`;
|
|
132
141
|
}
|
|
133
142
|
renderTags() {
|
|
134
|
-
const
|
|
143
|
+
const e = {
|
|
135
144
|
"pkt-card__tags": !0,
|
|
136
145
|
[`pkt-card__tags-${this.tagPosition}`]: this.tagPosition
|
|
137
146
|
};
|
|
138
147
|
return t`
|
|
139
148
|
${this.tags.length > 0 ? t`
|
|
140
149
|
<div
|
|
141
|
-
class=${
|
|
150
|
+
class=${c(e)}
|
|
142
151
|
role="list"
|
|
143
152
|
aria-label=${this.tags.length > 1 ? "merkelapper" : "merkelapp"}
|
|
144
153
|
>
|
|
@@ -148,8 +157,8 @@ let e = class extends m {
|
|
|
148
157
|
role="listitem"
|
|
149
158
|
textStyle="normal-text"
|
|
150
159
|
size="medium"
|
|
151
|
-
skin=${
|
|
152
|
-
iconName=${
|
|
160
|
+
skin=${k(s.skin)}
|
|
161
|
+
iconName=${k(s.iconName)}
|
|
153
162
|
>
|
|
154
163
|
<span>${s.text}</span>
|
|
155
164
|
</pkt-tag>
|
|
@@ -175,57 +184,68 @@ let e = class extends m {
|
|
|
175
184
|
`;
|
|
176
185
|
}
|
|
177
186
|
};
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
],
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
],
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
],
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
],
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
],
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
],
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
],
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
],
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
],
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
],
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
],
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
],
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
187
|
+
i([
|
|
188
|
+
r({ type: String })
|
|
189
|
+
], a.prototype, "ariaLabel", 2);
|
|
190
|
+
i([
|
|
191
|
+
r({ type: String })
|
|
192
|
+
], a.prototype, "metaLead", 2);
|
|
193
|
+
i([
|
|
194
|
+
r({ type: Boolean })
|
|
195
|
+
], a.prototype, "borderOnHover", 2);
|
|
196
|
+
i([
|
|
197
|
+
r({ type: String, reflect: !0 })
|
|
198
|
+
], a.prototype, "clickCardLink", 2);
|
|
199
|
+
i([
|
|
200
|
+
r({ type: String })
|
|
201
|
+
], a.prototype, "metaTrail", 2);
|
|
202
|
+
i([
|
|
203
|
+
r({ type: String })
|
|
204
|
+
], a.prototype, "layout", 2);
|
|
205
|
+
i([
|
|
206
|
+
r({ type: String })
|
|
207
|
+
], a.prototype, "heading", 2);
|
|
208
|
+
i([
|
|
209
|
+
r({ type: Number })
|
|
210
|
+
], a.prototype, "headinglevel", 2);
|
|
211
|
+
i([
|
|
212
|
+
r({ type: Object })
|
|
213
|
+
], a.prototype, "image", 2);
|
|
214
|
+
i([
|
|
215
|
+
r({ type: String })
|
|
216
|
+
], a.prototype, "imageShape", 2);
|
|
217
|
+
i([
|
|
218
|
+
r({ type: Boolean })
|
|
219
|
+
], a.prototype, "openLinkInNewTab", 2);
|
|
220
|
+
i([
|
|
221
|
+
r({ type: String })
|
|
222
|
+
], a.prototype, "padding", 2);
|
|
223
|
+
i([
|
|
224
|
+
r({
|
|
225
|
+
type: String,
|
|
226
|
+
converter: {
|
|
227
|
+
fromAttribute: (e) => {
|
|
228
|
+
const s = p.props.skin.type;
|
|
229
|
+
return e && s.includes(e) ? e : (e && !s.includes(e) && console.warn(
|
|
230
|
+
`Invalid skin value "${e}". Using default skin "${p.props.skin.default}".`
|
|
231
|
+
), p.props.skin.default);
|
|
232
|
+
},
|
|
233
|
+
toAttribute: (e) => e
|
|
234
|
+
}
|
|
235
|
+
})
|
|
236
|
+
], a.prototype, "skin", 2);
|
|
237
|
+
i([
|
|
238
|
+
r({ type: String })
|
|
239
|
+
], a.prototype, "subheading", 2);
|
|
240
|
+
i([
|
|
241
|
+
r({ type: String })
|
|
242
|
+
], a.prototype, "tagPosition", 2);
|
|
243
|
+
i([
|
|
244
|
+
r({ type: Array })
|
|
245
|
+
], a.prototype, "tags", 2);
|
|
246
|
+
a = i([
|
|
247
|
+
m("pkt-card")
|
|
248
|
+
], a);
|
|
229
249
|
export {
|
|
230
|
-
|
|
250
|
+
a as P
|
|
231
251
|
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";const e=require("./element-6DBpyGQm.cjs"),r=require("./input-element-C4xJoM-X.cjs"),o=require("./ref-iJtiv3o2.cjs"),n=require("./class-map-BBG2gMX4.cjs");var k=Object.defineProperty,u=Object.getOwnPropertyDescriptor,i=(p,t,h,a)=>{for(var s=a>1?void 0:a?u(t,h):t,c=p.length-1,l;c>=0;c--)(l=p[c])&&(s=(a?l(t,h,s):l(s))||s);return a&&s&&k(t,h,s),s};exports.PktCheckbox=class extends r.PktInputElement{constructor(){super(...arguments),this.inputRef=o.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",this.tagText=null,this.optionalTag=!1,this.optionalText="Valgfritt",this.requiredTag=!1,this.requiredText="Må fylles ut"}connectedCallback(){super.connectedCallback()}attributeChangedCallback(t,h,a){t==="defaultChecked"&&!this.checked&&(this.checked=this.defaultChecked),t==="checked"&&(this.checked=this.checked===""||this.checked==="true"||this.checked===!0),super.attributeChangedCallback(t,h,a)}firstUpdated(t){t.has("defaultChecked")&&!this.checked&&(this.checked=this.defaultChecked),super.firstUpdated(t)}updated(t){t.has("defaultChecked")&&!this.checked&&(this.checked=this.defaultChecked),super.updated(t)}render(){const t=n.e({"pkt-input-check__input":!0,"pkt-input-check__input--tile":this.hasTile,"pkt-input-check__input--tile-disabled":this.disabled&&this.hasTile}),h=n.e({"pkt-input-check__input-checkbox":!0,"pkt-input-check__input-checkbox--error":this.hasError}),a=n.e({"pkt-input-check__input-label":!0,"pkt-input-check__input-label--disabled":this.disabled,"pkt-input-check__input-label--left":this.labelPosition==="left","pkt-input-check__input-label--right":this.labelPosition==="right","pkt-sr-only":this.hideLabel}),s="pkt-tag pkt-tag--small pkt-tag--thin-text",c=()=>e.x`
|
|
2
|
+
${this.tagText?e.x`<span class=${s+" pkt-tag--gray"}>${this.tagText}</span>`:e.E}
|
|
3
|
+
${this.optionalTag?e.x`<span class=${s+" pkt-tag--blue-light"}>${this.optionalText}</span>`:e.E}
|
|
4
|
+
${this.requiredTag?e.x`<span class=${s+" pkt-tag--beige"}>${this.requiredText}</span>`:e.E}
|
|
5
|
+
`,l=()=>e.x`
|
|
6
|
+
<label class=${a} for=${this.id+"-internal"}>
|
|
7
|
+
${this.label} ${c()}
|
|
8
|
+
${this.checkHelptext?e.x`<div class="pkt-input-check__input-helptext">${this.checkHelptext}</div>`:e.E}
|
|
9
|
+
</label>
|
|
10
|
+
`;return e.x`
|
|
11
|
+
<div class="pkt-input-check">
|
|
12
|
+
<div class=${t}>
|
|
13
|
+
${this.labelPosition==="left"?l():e.E}
|
|
14
|
+
<input
|
|
15
|
+
id=${this.id+"-internal"}
|
|
16
|
+
class=${h}
|
|
17
|
+
type="checkbox"
|
|
18
|
+
?disabled=${this.disabled}
|
|
19
|
+
name=${this.name+"-internal"}
|
|
20
|
+
${o.n(this.inputRef)}
|
|
21
|
+
@change=${this.handleChange}
|
|
22
|
+
@click=${this.handleClick}
|
|
23
|
+
@blur=${this.onBlur}
|
|
24
|
+
@focus=${this.onFocus}
|
|
25
|
+
?checked=${this.checked}
|
|
26
|
+
role=${this.isSwitch?"switch":"checkbox"}
|
|
27
|
+
/>
|
|
28
|
+
${this.labelPosition==="right"?l():e.E}
|
|
29
|
+
</div>
|
|
30
|
+
</div>
|
|
31
|
+
`}handleClick(t){if(this.disabled)return t.preventDefault(),t.stopImmediatePropagation(),!1}handleChange(t){if(this.disabled)return t.preventDefault(),t.stopImmediatePropagation(),!1;this.toggleChecked(t)}toggleChecked(t){if(this.disabled){t.preventDefault(),t.stopImmediatePropagation();return}const h=t.target;if(h&&h.disabled){t.preventDefault(),t.stopImmediatePropagation();return}t.stopImmediatePropagation(),this.touched=!0,this.inputRef.value&&(this.checked=this.inputRef.value.matches(":checked"),this.valueChecked(this.checked))}};i([e.n({type:String,reflect:!0})],exports.PktCheckbox.prototype,"value",2);i([e.n({type:String})],exports.PktCheckbox.prototype,"checkHelptext",2);i([e.n({type:Boolean})],exports.PktCheckbox.prototype,"defaultChecked",2);i([e.n({type:Boolean})],exports.PktCheckbox.prototype,"hasTile",2);i([e.n({type:Boolean})],exports.PktCheckbox.prototype,"isSwitch",2);i([e.n({type:String})],exports.PktCheckbox.prototype,"labelPosition",2);i([e.n({type:Boolean})],exports.PktCheckbox.prototype,"hideLabel",2);i([e.n({type:Boolean,reflect:!0})],exports.PktCheckbox.prototype,"checked",2);i([e.n({type:String,reflect:!0})],exports.PktCheckbox.prototype,"type",2);i([e.n({type:String})],exports.PktCheckbox.prototype,"tagText",2);i([e.n({type:Boolean})],exports.PktCheckbox.prototype,"optionalTag",2);i([e.n({type:String})],exports.PktCheckbox.prototype,"optionalText",2);i([e.n({type:Boolean})],exports.PktCheckbox.prototype,"requiredTag",2);i([e.n({type:String})],exports.PktCheckbox.prototype,"requiredText",2);exports.PktCheckbox=i([e.t("pkt-checkbox")],exports.PktCheckbox);
|