@oslokommune/punkt-elements 16.7.1 → 16.7.3
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 +17 -0
- package/dist/accordionitem-_9AiCIvd.cjs +34 -0
- package/dist/{accordionitem-ZlaXvjt5.js → accordionitem-dCfSrxh5.js} +57 -55
- package/dist/alert-BtOk8yRH.cjs +33 -0
- package/dist/{alert-BuAXrnKl.js → alert-DlY2_grU.js} +48 -46
- package/dist/backlink-Ce5Vldop.js +49 -0
- package/dist/backlink-y3dwjKPC.cjs +13 -0
- package/dist/button-B_TXwNzt.cjs +27 -0
- package/dist/{button-DEyvt1LI.js → button-BiY-wlKF.js} +79 -77
- package/dist/calendar-B2pji2zn.cjs +90 -0
- package/dist/{calendar-S63oreVW.js → calendar-DhjQDC4C.js} +689 -687
- package/dist/card-BwMNB5Bb.cjs +87 -0
- package/dist/{card-DDiLfuO4.js → card-CGlmcMSR.js} +99 -97
- package/dist/checkbox-BsJZYA26.js +147 -0
- package/dist/checkbox-CTY8f_qn.cjs +31 -0
- package/dist/{combobox-BmxSecfE.js → combobox-DSB5WOxg.js} +223 -226
- package/dist/{combobox-Hb2V-fPX.cjs → combobox-DbICIgKG.cjs} +4 -4
- package/dist/consent-DkOQpbsg.cjs +11 -0
- package/dist/{consent-iXyx5v6J.js → consent-SNWV_mMU.js} +48 -46
- package/dist/datepicker-BEWl9iz3.cjs +273 -0
- package/dist/{datepicker-CZl7b8Na.js → datepicker-euHyzXnb.js} +341 -329
- package/dist/{heading-CKt7cVn7.js → heading-D2tVS6lS.js} +30 -28
- package/dist/heading-DrzbgDb6.cjs +1 -0
- package/dist/helptext-BKtU4mas.js +82 -0
- package/dist/helptext-DcRC7wW2.cjs +24 -0
- package/dist/icon-CxQcIa5F.js +105 -0
- package/dist/icon-q81vqPK_.cjs +9 -0
- package/dist/input-wrapper-Bs4CRNst.js +181 -0
- package/dist/input-wrapper-Bv9aqqVq.cjs +54 -0
- package/dist/link-C0rl-86s.cjs +7 -0
- package/dist/link-Cdqgl60z.js +55 -0
- package/dist/linkcard-Dimu7Rlx.cjs +13 -0
- package/dist/linkcard-Lbq_UhjZ.js +56 -0
- package/dist/{listbox-BQKDZvZn.js → listbox-Bia4_tvN.js} +131 -129
- package/dist/listbox-La2GZQei.cjs +106 -0
- package/dist/loader-D1ugDXGV.cjs +16 -0
- package/dist/{loader-Ci3CHU8k.js → loader-DyN6RGC5.js} +51 -49
- package/dist/messagebox-BGMVm2t9.js +71 -0
- package/dist/messagebox-M0yIgCz9.cjs +13 -0
- package/dist/modal-CMO1RtIi.cjs +36 -0
- package/dist/{modal-DzGe1g8Z.js → modal-DjPQDE-Z.js} +53 -51
- package/dist/pkt-accordion.cjs +1 -1
- package/dist/pkt-accordion.js +2 -2
- package/dist/pkt-alert.cjs +1 -1
- package/dist/pkt-alert.js +3 -4
- package/dist/pkt-backlink.cjs +1 -1
- package/dist/pkt-backlink.js +2 -3
- package/dist/pkt-breadcrumbs.cjs +11 -11
- package/dist/pkt-breadcrumbs.js +30 -28
- package/dist/pkt-button.cjs +1 -1
- package/dist/pkt-button.js +3 -4
- package/dist/pkt-calendar.cjs +1 -1
- package/dist/pkt-calendar.js +2 -3
- package/dist/pkt-card.cjs +1 -1
- package/dist/pkt-card.js +2 -3
- package/dist/pkt-checkbox.cjs +1 -1
- package/dist/pkt-checkbox.js +3 -4
- package/dist/pkt-combobox.cjs +1 -1
- package/dist/pkt-combobox.js +3 -4
- package/dist/pkt-consent.cjs +1 -1
- package/dist/pkt-consent.js +2 -3
- package/dist/pkt-datepicker.cjs +1 -1
- package/dist/pkt-datepicker.js +7 -8
- package/dist/pkt-header.cjs +35 -35
- package/dist/pkt-header.js +224 -218
- package/dist/pkt-heading.cjs +1 -1
- package/dist/pkt-heading.js +3 -4
- package/dist/pkt-helptext.cjs +1 -1
- package/dist/pkt-helptext.js +3 -4
- package/dist/pkt-icon.cjs +1 -1
- package/dist/pkt-icon.js +3 -4
- package/dist/pkt-index.cjs +1 -1
- package/dist/pkt-index.js +26 -26
- package/dist/pkt-input-wrapper.cjs +1 -1
- package/dist/pkt-input-wrapper.js +2 -3
- package/dist/pkt-link.cjs +1 -1
- package/dist/pkt-link.js +2 -3
- package/dist/pkt-linkcard.cjs +1 -1
- package/dist/pkt-linkcard.js +3 -4
- package/dist/pkt-listbox.cjs +1 -1
- package/dist/pkt-listbox.js +3 -4
- package/dist/pkt-loader.cjs +1 -1
- package/dist/pkt-loader.js +3 -4
- package/dist/pkt-messagebox.cjs +1 -1
- package/dist/pkt-messagebox.js +3 -4
- package/dist/pkt-modal.cjs +1 -1
- package/dist/pkt-modal.js +3 -4
- package/dist/pkt-progressbar.cjs +1 -1
- package/dist/pkt-progressbar.js +2 -3
- package/dist/pkt-radiobutton.cjs +1 -1
- package/dist/pkt-radiobutton.js +3 -4
- package/dist/pkt-select.cjs +1 -1
- package/dist/pkt-select.js +3 -4
- package/dist/pkt-tabs.cjs +1 -1
- package/dist/pkt-tabs.js +2 -2
- package/dist/pkt-tag.cjs +1 -1
- package/dist/pkt-tag.js +3 -4
- package/dist/pkt-textarea.cjs +1 -1
- package/dist/pkt-textarea.js +3 -4
- package/dist/pkt-textinput.cjs +1 -1
- package/dist/pkt-textinput.js +3 -4
- package/dist/pkt-timepicker.cjs +16 -16
- package/dist/pkt-timepicker.js +91 -89
- package/dist/progressbar-BqlMzkM_.cjs +21 -0
- package/dist/{progressbar-By7e0lEI.js → progressbar-sbHDFC12.js} +88 -88
- package/dist/radiobutton-5ZqVVtTT.cjs +31 -0
- package/dist/{radiobutton-6frNG9J_.js → radiobutton-D8Ai8ETa.js} +44 -42
- package/dist/select-De-n8on9.js +230 -0
- package/dist/select-dTWibR6_.cjs +49 -0
- package/dist/tabitem-B9-jeV97.js +334 -0
- package/dist/tabitem-BnhzqfW3.cjs +65 -0
- package/dist/tag-CbwO8yvD.cjs +27 -0
- package/dist/{tag-BuCpqaks.js → tag-D4FI5t3y.js} +42 -40
- package/dist/textarea-BmLaKzsc.cjs +50 -0
- package/dist/{textarea-Bzuymclz.js → textarea-CMiSJaYL.js} +62 -60
- package/dist/textinput-em9y4yrL.cjs +70 -0
- package/dist/{textinput-9lHjs4ce.js → textinput-r8udK0IX.js} +57 -55
- package/package.json +2 -2
- package/src/components/accordion/accordion.ts +6 -1
- package/src/components/accordion/accordionitem.ts +6 -1
- package/src/components/alert/alert.ts +6 -1
- package/src/components/backlink/backlink.ts +6 -1
- package/src/components/breadcrumbs/breadcrumbs.ts +6 -1
- package/src/components/button/button.ts +6 -1
- package/src/components/calendar/calendar.ts +6 -1
- package/src/components/card/card.ts +6 -1
- package/src/components/checkbox/checkbox.ts +6 -1
- package/src/components/combobox/combobox.ts +6 -1
- package/src/components/consent/consent.ts +6 -1
- package/src/components/datepicker/date-tags.ts +6 -1
- package/src/components/datepicker/datepicker-multiple.ts +6 -1
- package/src/components/datepicker/datepicker-popup.ts +6 -1
- package/src/components/datepicker/datepicker-range.ts +6 -1
- package/src/components/datepicker/datepicker-single.ts +6 -1
- package/src/components/datepicker/datepicker.ts +6 -1
- package/src/components/header/header-service.ts +6 -1
- package/src/components/header/header-user-menu.ts +6 -1
- package/src/components/header/header.ts +6 -1
- package/src/components/heading/heading.ts +6 -1
- package/src/components/helptext/helptext.ts +6 -1
- package/src/components/icon/icon.ts +6 -1
- package/src/components/input-wrapper/input-wrapper.ts +6 -1
- package/src/components/link/link.ts +6 -1
- package/src/components/linkcard/linkcard.ts +6 -1
- package/src/components/listbox/listbox.ts +6 -1
- package/src/components/loader/loader.ts +6 -1
- package/src/components/messagebox/messagebox.ts +6 -1
- package/src/components/modal/modal.ts +6 -1
- package/src/components/progressbar/progressbar.ts +6 -1
- package/src/components/radiobutton/radiobutton.ts +6 -1
- package/src/components/select/select.ts +6 -1
- package/src/components/tabs/tabitem.ts +6 -1
- package/src/components/tabs/tabs.ts +6 -1
- package/src/components/tag/tag.ts +6 -1
- package/src/components/textarea/textarea.ts +6 -1
- package/src/components/textinput/textinput.ts +6 -1
- package/src/components/timepicker/timepicker.ts +6 -1
- package/dist/accordionitem-D1Agl1bB.cjs +0 -34
- package/dist/alert-DFkFNTxh.cjs +0 -33
- package/dist/backlink-EiAXUUZP.cjs +0 -13
- package/dist/backlink-V4DAt17e.js +0 -47
- package/dist/button-DYv5Dg4M.cjs +0 -27
- package/dist/calendar-HIE9nxcc.cjs +0 -90
- package/dist/card-CyeH6l1c.cjs +0 -87
- package/dist/checkbox-BLlwTABj.cjs +0 -31
- package/dist/checkbox-ejBUa5qQ.js +0 -145
- package/dist/consent-ruWAEVXW.cjs +0 -11
- package/dist/datepicker-D2H7U6MS.cjs +0 -273
- package/dist/heading-Cvz8m1xL.cjs +0 -1
- package/dist/helptext-5Mzp65-F.cjs +0 -24
- package/dist/helptext-jIoWRcCF.js +0 -80
- package/dist/icon-BlKA8YuW.js +0 -103
- package/dist/icon-Bqj9oBbl.cjs +0 -9
- package/dist/input-wrapper-B0MkQ0IZ.cjs +0 -54
- package/dist/input-wrapper-B2JpK016.js +0 -179
- package/dist/link-R_lNhViF.cjs +0 -7
- package/dist/link-Z_GizclR.js +0 -53
- package/dist/linkcard-BlQvdB1a.js +0 -54
- package/dist/linkcard-C7HbSLlX.cjs +0 -13
- package/dist/listbox-CGgV9MAe.cjs +0 -106
- package/dist/loader-e2gs_1xz.cjs +0 -16
- package/dist/messagebox-Bf-XMlvW.js +0 -69
- package/dist/messagebox-D67w71VX.cjs +0 -13
- package/dist/modal-CyvEkbfQ.cjs +0 -36
- package/dist/progressbar-DsJ2B9Vm.cjs +0 -21
- package/dist/radiobutton-Bv-BZ1Hw.cjs +0 -31
- package/dist/select-CXZt1nHS.js +0 -228
- package/dist/select-WFhS4Vfp.cjs +0 -49
- package/dist/tabitem-CB8wkKmv.js +0 -332
- package/dist/tabitem-DZpspU4Q.cjs +0 -65
- package/dist/tag-X6xdjR0N.cjs +0 -27
- package/dist/textarea-DoeHJ7HR.cjs +0 -50
- package/dist/textinput-BNsLd26i.cjs +0 -70
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";const p=require("./class-map-CsENJXf1.cjs"),l=require("./if-defined-BOW3ODSj.cjs"),e=require("./element-gR_VtSiD.cjs"),c=require("./element-with-slot-ZX-up7jO.cjs");require("./icon-q81vqPK_.cjs");require("./tag-CbwO8yvD.cjs");require("./heading-DrzbgDb6.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,a=(i,r,s,h)=>{for(var n=void 0,d=i.length-1,g;d>=0;d--)(g=i[d])&&(n=g(r,s,n)||n);return n&&u(r,s,n),n};class t extends c.PktElementWithSlot{constructor(){super(...arguments),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=[]}connectedCallback(){super.connectedCallback()}render(){var n,d;const r={"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=((n=this.ariaLabel)==null?void 0:n.trim())||(this.heading?`${this.heading} lenkekort`:"lenkekort"),h=((d=this.ariaLabel)==null?void 0:d.trim())||(this.heading?this.heading:"kort");return e.b`
|
|
2
|
+
<article
|
|
3
|
+
class=${p.e(r)}
|
|
4
|
+
aria-label=${l.o(this.clickCardLink?s:h)}
|
|
5
|
+
>
|
|
6
|
+
${this.renderImage()}
|
|
7
|
+
<div class="pkt-card__wrapper">
|
|
8
|
+
${this.tagPosition==="top"?this.renderTags():e.A}
|
|
9
|
+
${this.renderHeader()}
|
|
10
|
+
${this.renderSlot()}
|
|
11
|
+
${this.tagPosition==="bottom"?this.renderTags():e.A}
|
|
12
|
+
${this.renderMetadata()}
|
|
13
|
+
</div>
|
|
14
|
+
</article>
|
|
15
|
+
`}renderImage(){const r={"pkt-card__image":!0,[`pkt-card__image-${this.imageShape}`]:this.imageShape};return e.b`
|
|
16
|
+
${this.image.src&&e.b`
|
|
17
|
+
<div class=${p.e(r)}>
|
|
18
|
+
<img src=${this.image.src} alt=${this.image.alt||""} />
|
|
19
|
+
</div>
|
|
20
|
+
`}
|
|
21
|
+
`}renderHeading(){return e.b`
|
|
22
|
+
${this.heading&&!this.clickCardLink?e.b`
|
|
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.A}
|
|
33
|
+
`}renderLinkHeading(){return e.b`
|
|
34
|
+
${this.clickCardLink?e.b`
|
|
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.A}
|
|
50
|
+
`}renderSubheading(){return e.b`
|
|
51
|
+
${this.subheading?e.b` <p class="pkt-card__subheading ">${this.subheading}</p> `:e.A}
|
|
52
|
+
`}renderHeader(){const r=!!this.heading||!!this.subheading;return e.b`
|
|
53
|
+
${r?e.b`
|
|
54
|
+
<header class="pkt-card__header">
|
|
55
|
+
${this.renderHeading()}
|
|
56
|
+
${this.renderLinkHeading()}
|
|
57
|
+
${this.renderSubheading()}
|
|
58
|
+
</header>
|
|
59
|
+
`:e.A}
|
|
60
|
+
`}renderTags(){const r={"pkt-card__tags":!0,[`pkt-card__tags-${this.tagPosition}`]:this.tagPosition};return e.b`
|
|
61
|
+
${this.tags.length>0?e.b`
|
|
62
|
+
<div
|
|
63
|
+
class=${p.e(r)}
|
|
64
|
+
role="list"
|
|
65
|
+
aria-label=${this.tags.length>1?"merkelapper":"merkelapp"}
|
|
66
|
+
>
|
|
67
|
+
${this.tags.map(s=>e.b`
|
|
68
|
+
<pkt-tag
|
|
69
|
+
role="listitem"
|
|
70
|
+
textStyle="normal-text"
|
|
71
|
+
size="medium"
|
|
72
|
+
skin=${l.o(s.skin)}
|
|
73
|
+
iconName=${l.o(s.iconName)}
|
|
74
|
+
>
|
|
75
|
+
<span>${s.text}</span>
|
|
76
|
+
</pkt-tag>
|
|
77
|
+
`)}
|
|
78
|
+
</div>
|
|
79
|
+
`:e.A}
|
|
80
|
+
`}renderSlot(){return e.b`<section class="pkt-card__content">${c.slotContent(this)}</section>`}renderMetadata(){return e.b`
|
|
81
|
+
${this.metaLead||this.metaTrail?e.b`
|
|
82
|
+
<footer class="pkt-card__metadata">
|
|
83
|
+
${this.metaLead?e.b`<span class="pkt-card__metadata-lead">${this.metaLead}</span>`:e.A}
|
|
84
|
+
${this.metaTrail?e.b`<span class="pkt-card__metadata-trail">${this.metaTrail}</span>`:e.A}
|
|
85
|
+
</footer>
|
|
86
|
+
`:e.A}
|
|
87
|
+
`}}a([e.n({type:String})],t.prototype,"ariaLabel");a([e.n({type:String})],t.prototype,"metaLead");a([e.n({type:Boolean})],t.prototype,"borderOnHover");a([e.n({type:String,reflect:!0})],t.prototype,"clickCardLink");a([e.n({type:String})],t.prototype,"metaTrail");a([e.n({type:String})],t.prototype,"layout");a([e.n({type:String})],t.prototype,"heading");a([e.n({type:Number})],t.prototype,"headinglevel");a([e.n({type:Object})],t.prototype,"image");a([e.n({type:String})],t.prototype,"imageShape");a([e.n({type:Boolean})],t.prototype,"openLinkInNewTab");a([e.n({type:String})],t.prototype,"padding");a([e.n({type:String,converter:{fromAttribute:i=>{const r=o.props.skin.type;return i&&r.includes(i)?i:(i&&!r.includes(i)&&console.warn(`Invalid skin value "${i}". Using default skin "${o.props.skin.default}".`),o.props.skin.default)},toAttribute:i=>i}})],t.prototype,"skin");a([e.n({type:String})],t.prototype,"subheading");a([e.n({type:String})],t.prototype,"tagPosition");a([e.n({type:Array})],t.prototype,"tags");try{e.t("pkt-card")(t)}catch{console.warn("Forsøker å definere <pkt-card>, men den er allerede definert")}exports.PktCard=t;
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { e as
|
|
2
|
-
import { o as
|
|
3
|
-
import {
|
|
4
|
-
import { P as
|
|
5
|
-
import "./icon-
|
|
6
|
-
import "./tag-
|
|
7
|
-
import "./heading-
|
|
8
|
-
const y = { layout: { default: "vertical" }, skin: { type: ["outlined", "outlined-beige", "gray", "blue", "beige", "green"], default: "outlined" }, padding: { default: "default" } },
|
|
1
|
+
import { e as h } from "./class-map-CEnykyO_.js";
|
|
2
|
+
import { o as g } from "./if-defined-B0krMLad.js";
|
|
3
|
+
import { t as m, A as n, b as t, n as a } from "./element-CPpT3rFQ.js";
|
|
4
|
+
import { P as u, s as $ } from "./element-with-slot-Dqk6-TRR.js";
|
|
5
|
+
import "./icon-CxQcIa5F.js";
|
|
6
|
+
import "./tag-D4FI5t3y.js";
|
|
7
|
+
import "./heading-D2tVS6lS.js";
|
|
8
|
+
const y = { layout: { default: "vertical" }, skin: { type: ["outlined", "outlined-beige", "gray", "blue", "beige", "green"], default: "outlined" }, padding: { default: "default" } }, l = {
|
|
9
9
|
props: y
|
|
10
10
|
};
|
|
11
|
-
var
|
|
12
|
-
for (var
|
|
13
|
-
(
|
|
14
|
-
return
|
|
11
|
+
var b = Object.defineProperty, i = (r, s, p, c) => {
|
|
12
|
+
for (var d = void 0, o = r.length - 1, k; o >= 0; o--)
|
|
13
|
+
(k = r[o]) && (d = k(s, p, d) || d);
|
|
14
|
+
return d && b(s, p, d), d;
|
|
15
15
|
};
|
|
16
|
-
|
|
16
|
+
class e extends u {
|
|
17
17
|
constructor() {
|
|
18
|
-
super(...arguments), this.ariaLabel = "", this.metaLead = null, this.borderOnHover = !0, this.clickCardLink = null, this.metaTrail = null, this.layout =
|
|
18
|
+
super(...arguments), this.ariaLabel = "", this.metaLead = null, this.borderOnHover = !0, this.clickCardLink = null, this.metaTrail = null, this.layout = l.props.layout.default, this.heading = "", this.headinglevel = 3, this.image = {
|
|
19
19
|
src: "",
|
|
20
20
|
alt: ""
|
|
21
|
-
}, this.imageShape = "square", this.openLinkInNewTab = !1, this.padding =
|
|
21
|
+
}, 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 = [];
|
|
22
22
|
}
|
|
23
23
|
connectedCallback() {
|
|
24
24
|
super.connectedCallback();
|
|
@@ -27,25 +27,25 @@ let a = class extends m {
|
|
|
27
27
|
// Main render method
|
|
28
28
|
// prettier-ignore
|
|
29
29
|
render() {
|
|
30
|
-
var
|
|
31
|
-
const
|
|
30
|
+
var d, o;
|
|
31
|
+
const s = {
|
|
32
32
|
"pkt-card": !0,
|
|
33
33
|
[`pkt-card--${this.skin}`]: this.skin,
|
|
34
34
|
[`pkt-card--${this.layout}`]: this.layout,
|
|
35
35
|
[`pkt-card--padding-${this.padding}`]: this.padding,
|
|
36
36
|
"pkt-card--border-on-hover": this.borderOnHover
|
|
37
|
-
},
|
|
38
|
-
return
|
|
37
|
+
}, p = ((d = this.ariaLabel) == null ? void 0 : d.trim()) || (this.heading ? `${this.heading} lenkekort` : "lenkekort"), c = ((o = this.ariaLabel) == null ? void 0 : o.trim()) || (this.heading ? this.heading : "kort");
|
|
38
|
+
return t`
|
|
39
39
|
<article
|
|
40
|
-
class=${
|
|
41
|
-
aria-label=${
|
|
40
|
+
class=${h(s)}
|
|
41
|
+
aria-label=${g(this.clickCardLink ? p : c)}
|
|
42
42
|
>
|
|
43
43
|
${this.renderImage()}
|
|
44
44
|
<div class="pkt-card__wrapper">
|
|
45
|
-
${this.tagPosition === "top" ? this.renderTags() :
|
|
45
|
+
${this.tagPosition === "top" ? this.renderTags() : n}
|
|
46
46
|
${this.renderHeader()}
|
|
47
47
|
${this.renderSlot()}
|
|
48
|
-
${this.tagPosition === "bottom" ? this.renderTags() :
|
|
48
|
+
${this.tagPosition === "bottom" ? this.renderTags() : n}
|
|
49
49
|
${this.renderMetadata()}
|
|
50
50
|
</div>
|
|
51
51
|
</article>
|
|
@@ -53,13 +53,13 @@ let a = class extends m {
|
|
|
53
53
|
}
|
|
54
54
|
// Render methods for different parts of the card
|
|
55
55
|
renderImage() {
|
|
56
|
-
const
|
|
56
|
+
const s = {
|
|
57
57
|
"pkt-card__image": !0,
|
|
58
58
|
[`pkt-card__image-${this.imageShape}`]: this.imageShape
|
|
59
59
|
};
|
|
60
|
-
return
|
|
61
|
-
${this.image.src &&
|
|
62
|
-
<div class=${
|
|
60
|
+
return t`
|
|
61
|
+
${this.image.src && t`
|
|
62
|
+
<div class=${h(s)}>
|
|
63
63
|
<img src=${this.image.src} alt=${this.image.alt || ""} />
|
|
64
64
|
</div>
|
|
65
65
|
`}
|
|
@@ -68,8 +68,8 @@ let a = class extends m {
|
|
|
68
68
|
// Do not render heading if link is present, render link heading instead
|
|
69
69
|
// Combine the rendering for headings into a renderHeader method
|
|
70
70
|
renderHeading() {
|
|
71
|
-
return
|
|
72
|
-
${this.heading && !this.clickCardLink ?
|
|
71
|
+
return t`
|
|
72
|
+
${this.heading && !this.clickCardLink ? t`
|
|
73
73
|
<pkt-heading
|
|
74
74
|
class="pkt-card__heading"
|
|
75
75
|
.level=${this.headinglevel || 3}
|
|
@@ -79,12 +79,12 @@ let a = class extends m {
|
|
|
79
79
|
>
|
|
80
80
|
${this.heading}
|
|
81
81
|
</pkt-heading>
|
|
82
|
-
` :
|
|
82
|
+
` : n}
|
|
83
83
|
`;
|
|
84
84
|
}
|
|
85
85
|
renderLinkHeading() {
|
|
86
|
-
return
|
|
87
|
-
${this.clickCardLink ?
|
|
86
|
+
return t`
|
|
87
|
+
${this.clickCardLink ? t`
|
|
88
88
|
<pkt-heading
|
|
89
89
|
class="pkt-card__link-heading pkt-card__heading"
|
|
90
90
|
.level=${this.headinglevel || 3}
|
|
@@ -99,133 +99,135 @@ let a = class extends m {
|
|
|
99
99
|
>${this.heading}</a
|
|
100
100
|
>
|
|
101
101
|
</pkt-heading>
|
|
102
|
-
` :
|
|
102
|
+
` : n}
|
|
103
103
|
`;
|
|
104
104
|
}
|
|
105
105
|
renderSubheading() {
|
|
106
|
-
return
|
|
107
|
-
${this.subheading ?
|
|
106
|
+
return t`
|
|
107
|
+
${this.subheading ? t` <p class="pkt-card__subheading ">${this.subheading}</p> ` : n}
|
|
108
108
|
`;
|
|
109
109
|
}
|
|
110
110
|
// Render header
|
|
111
111
|
// prettier-ignore
|
|
112
112
|
renderHeader() {
|
|
113
|
-
const
|
|
114
|
-
return
|
|
115
|
-
${
|
|
113
|
+
const s = !!this.heading || !!this.subheading;
|
|
114
|
+
return t`
|
|
115
|
+
${s ? t`
|
|
116
116
|
<header class="pkt-card__header">
|
|
117
117
|
${this.renderHeading()}
|
|
118
118
|
${this.renderLinkHeading()}
|
|
119
119
|
${this.renderSubheading()}
|
|
120
120
|
</header>
|
|
121
|
-
` :
|
|
121
|
+
` : n}
|
|
122
122
|
`;
|
|
123
123
|
}
|
|
124
124
|
renderTags() {
|
|
125
|
-
const
|
|
125
|
+
const s = {
|
|
126
126
|
"pkt-card__tags": !0,
|
|
127
127
|
[`pkt-card__tags-${this.tagPosition}`]: this.tagPosition
|
|
128
128
|
};
|
|
129
|
-
return
|
|
130
|
-
${this.tags.length > 0 ?
|
|
129
|
+
return t`
|
|
130
|
+
${this.tags.length > 0 ? t`
|
|
131
131
|
<div
|
|
132
|
-
class=${
|
|
132
|
+
class=${h(s)}
|
|
133
133
|
role="list"
|
|
134
134
|
aria-label=${this.tags.length > 1 ? "merkelapper" : "merkelapp"}
|
|
135
135
|
>
|
|
136
136
|
${this.tags.map(
|
|
137
|
-
(
|
|
137
|
+
(p) => t`
|
|
138
138
|
<pkt-tag
|
|
139
139
|
role="listitem"
|
|
140
140
|
textStyle="normal-text"
|
|
141
141
|
size="medium"
|
|
142
|
-
skin=${
|
|
143
|
-
iconName=${
|
|
142
|
+
skin=${g(p.skin)}
|
|
143
|
+
iconName=${g(p.iconName)}
|
|
144
144
|
>
|
|
145
|
-
<span>${
|
|
145
|
+
<span>${p.text}</span>
|
|
146
146
|
</pkt-tag>
|
|
147
147
|
`
|
|
148
148
|
)}
|
|
149
149
|
</div>
|
|
150
|
-
` :
|
|
150
|
+
` : n}
|
|
151
151
|
`;
|
|
152
152
|
}
|
|
153
153
|
renderSlot() {
|
|
154
|
-
return
|
|
154
|
+
return t`<section class="pkt-card__content">${$(this)}</section>`;
|
|
155
155
|
}
|
|
156
156
|
renderMetadata() {
|
|
157
|
-
return
|
|
158
|
-
${this.metaLead || this.metaTrail ?
|
|
157
|
+
return t`
|
|
158
|
+
${this.metaLead || this.metaTrail ? t`
|
|
159
159
|
<footer class="pkt-card__metadata">
|
|
160
|
-
${this.metaLead ?
|
|
161
|
-
${this.metaTrail ?
|
|
160
|
+
${this.metaLead ? t`<span class="pkt-card__metadata-lead">${this.metaLead}</span>` : n}
|
|
161
|
+
${this.metaTrail ? t`<span class="pkt-card__metadata-trail">${this.metaTrail}</span>` : n}
|
|
162
162
|
</footer>
|
|
163
|
-
` :
|
|
163
|
+
` : n}
|
|
164
164
|
`;
|
|
165
165
|
}
|
|
166
|
-
}
|
|
166
|
+
}
|
|
167
167
|
i([
|
|
168
|
-
|
|
169
|
-
],
|
|
168
|
+
a({ type: String })
|
|
169
|
+
], e.prototype, "ariaLabel");
|
|
170
170
|
i([
|
|
171
|
-
|
|
172
|
-
],
|
|
171
|
+
a({ type: String })
|
|
172
|
+
], e.prototype, "metaLead");
|
|
173
173
|
i([
|
|
174
|
-
|
|
175
|
-
],
|
|
174
|
+
a({ type: Boolean })
|
|
175
|
+
], e.prototype, "borderOnHover");
|
|
176
176
|
i([
|
|
177
|
-
|
|
178
|
-
],
|
|
177
|
+
a({ type: String, reflect: !0 })
|
|
178
|
+
], e.prototype, "clickCardLink");
|
|
179
179
|
i([
|
|
180
|
-
|
|
181
|
-
],
|
|
180
|
+
a({ type: String })
|
|
181
|
+
], e.prototype, "metaTrail");
|
|
182
182
|
i([
|
|
183
|
-
|
|
184
|
-
],
|
|
183
|
+
a({ type: String })
|
|
184
|
+
], e.prototype, "layout");
|
|
185
185
|
i([
|
|
186
|
-
|
|
187
|
-
],
|
|
186
|
+
a({ type: String })
|
|
187
|
+
], e.prototype, "heading");
|
|
188
188
|
i([
|
|
189
|
-
|
|
190
|
-
],
|
|
189
|
+
a({ type: Number })
|
|
190
|
+
], e.prototype, "headinglevel");
|
|
191
191
|
i([
|
|
192
|
-
|
|
193
|
-
],
|
|
192
|
+
a({ type: Object })
|
|
193
|
+
], e.prototype, "image");
|
|
194
194
|
i([
|
|
195
|
-
|
|
196
|
-
],
|
|
195
|
+
a({ type: String })
|
|
196
|
+
], e.prototype, "imageShape");
|
|
197
197
|
i([
|
|
198
|
-
|
|
199
|
-
],
|
|
198
|
+
a({ type: Boolean })
|
|
199
|
+
], e.prototype, "openLinkInNewTab");
|
|
200
200
|
i([
|
|
201
|
-
|
|
202
|
-
],
|
|
201
|
+
a({ type: String })
|
|
202
|
+
], e.prototype, "padding");
|
|
203
203
|
i([
|
|
204
|
-
|
|
204
|
+
a({
|
|
205
205
|
type: String,
|
|
206
206
|
converter: {
|
|
207
|
-
fromAttribute: (
|
|
208
|
-
const s =
|
|
209
|
-
return
|
|
210
|
-
`Invalid skin value "${
|
|
211
|
-
),
|
|
207
|
+
fromAttribute: (r) => {
|
|
208
|
+
const s = l.props.skin.type;
|
|
209
|
+
return r && s.includes(r) ? r : (r && !s.includes(r) && console.warn(
|
|
210
|
+
`Invalid skin value "${r}". Using default skin "${l.props.skin.default}".`
|
|
211
|
+
), l.props.skin.default);
|
|
212
212
|
},
|
|
213
|
-
toAttribute: (
|
|
213
|
+
toAttribute: (r) => r
|
|
214
214
|
}
|
|
215
215
|
})
|
|
216
|
-
],
|
|
216
|
+
], e.prototype, "skin");
|
|
217
217
|
i([
|
|
218
|
-
|
|
219
|
-
],
|
|
218
|
+
a({ type: String })
|
|
219
|
+
], e.prototype, "subheading");
|
|
220
220
|
i([
|
|
221
|
-
|
|
222
|
-
],
|
|
221
|
+
a({ type: String })
|
|
222
|
+
], e.prototype, "tagPosition");
|
|
223
223
|
i([
|
|
224
|
-
|
|
225
|
-
],
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
224
|
+
a({ type: Array })
|
|
225
|
+
], e.prototype, "tags");
|
|
226
|
+
try {
|
|
227
|
+
m("pkt-card")(e);
|
|
228
|
+
} catch {
|
|
229
|
+
console.warn("Forsøker å definere <pkt-card>, men den er allerede definert");
|
|
230
|
+
}
|
|
229
231
|
export {
|
|
230
|
-
|
|
232
|
+
e as P
|
|
231
233
|
};
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { t as u, A as l, b as n, n as i } from "./element-CPpT3rFQ.js";
|
|
2
|
+
import { P as k } from "./input-element-8nLwuQS4.js";
|
|
3
|
+
import { e as f, n as b } from "./ref-Bg_Swj5w.js";
|
|
4
|
+
import { e as o } from "./class-map-CEnykyO_.js";
|
|
5
|
+
var g = Object.defineProperty, s = (r, e, h, d) => {
|
|
6
|
+
for (var a = void 0, p = r.length - 1, c; p >= 0; p--)
|
|
7
|
+
(c = r[p]) && (a = c(e, h, a) || a);
|
|
8
|
+
return a && g(e, h, a), a;
|
|
9
|
+
};
|
|
10
|
+
class t extends k {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments), this.inputRef = f(), this.value = "", this.checkHelptext = null, this.defaultChecked = !1, this.hasTile = !1, this.isSwitch = !1, this.labelPosition = "right", this.hideLabel = !1, this.checked = null, this.indeterminate = !1, this.type = "checkbox", this.tagText = null, this.optionalTag = !1, this.optionalText = "Valgfritt", this.requiredTag = !1, this.requiredText = "Må fylles ut";
|
|
13
|
+
}
|
|
14
|
+
connectedCallback() {
|
|
15
|
+
super.connectedCallback();
|
|
16
|
+
}
|
|
17
|
+
attributeChangedCallback(e, h, d) {
|
|
18
|
+
e === "defaultChecked" && !this.checked && (this.checked = this.defaultChecked), e === "checked" && (this.checked = this.checked === "" || this.checked === "true" || this.checked === !0, this.inputRef.value && (this.inputRef.value.checked = this.checked)), e === "indeterminate" && (this.indeterminate = this.indeterminate === "" || this.indeterminate === "true" || this.indeterminate === !0, this.inputRef.value && (this.inputRef.value.indeterminate = this.indeterminate)), super.attributeChangedCallback(e, h, d);
|
|
19
|
+
}
|
|
20
|
+
firstUpdated(e) {
|
|
21
|
+
e.has("defaultChecked") && !this.checked && (this.checked = this.defaultChecked), this.inputRef.value && (this.inputRef.value.indeterminate = this.indeterminate === "" || this.indeterminate === "true" || this.indeterminate === !0), super.firstUpdated(e);
|
|
22
|
+
}
|
|
23
|
+
updated(e) {
|
|
24
|
+
e.has("defaultChecked") && !this.checked && (this.checked = this.defaultChecked), e.has("checked") && this.inputRef.value && (this.inputRef.value.checked = this.checked === "" || this.checked === "true" || this.checked === !0), e.has("indeterminate") && this.inputRef.value && (this.inputRef.value.indeterminate = this.indeterminate === "" || this.indeterminate === "true" || this.indeterminate === !0), super.updated(e);
|
|
25
|
+
}
|
|
26
|
+
render() {
|
|
27
|
+
const e = o({
|
|
28
|
+
"pkt-input-check__input": !0,
|
|
29
|
+
"pkt-input-check__input--tile": this.hasTile,
|
|
30
|
+
"pkt-input-check__input--tile-disabled": this.disabled && this.hasTile
|
|
31
|
+
}), h = o({
|
|
32
|
+
"pkt-input-check__input-checkbox": !0,
|
|
33
|
+
"pkt-input-check__input-checkbox--error": this.hasError
|
|
34
|
+
}), d = o({
|
|
35
|
+
"pkt-input-check__input-label": !0,
|
|
36
|
+
"pkt-input-check__input-label--disabled": this.disabled,
|
|
37
|
+
"pkt-input-check__input-label--left": this.labelPosition === "left",
|
|
38
|
+
"pkt-input-check__input-label--right": this.labelPosition === "right",
|
|
39
|
+
"pkt-sr-only": this.hideLabel
|
|
40
|
+
}), a = "pkt-tag pkt-tag--small pkt-tag--thin-text", p = () => n`
|
|
41
|
+
${this.tagText ? n`<span class=${a + " pkt-tag--gray"}>${this.tagText}</span>` : l}
|
|
42
|
+
${this.optionalTag ? n`<span class=${a + " pkt-tag--blue-light"}>${this.optionalText}</span>` : l}
|
|
43
|
+
${this.requiredTag ? n`<span class=${a + " pkt-tag--beige"}>${this.requiredText}</span>` : l}
|
|
44
|
+
`, c = () => n`
|
|
45
|
+
<label class=${d} for=${this.id + "-internal"}>
|
|
46
|
+
${this.label} ${p()}
|
|
47
|
+
${this.checkHelptext ? n`<div class="pkt-input-check__input-helptext">${this.checkHelptext}</div>` : l}
|
|
48
|
+
</label>
|
|
49
|
+
`;
|
|
50
|
+
return n`
|
|
51
|
+
<div class="pkt-input-check">
|
|
52
|
+
<div class=${e}>
|
|
53
|
+
${this.labelPosition === "left" ? c() : l}
|
|
54
|
+
<input
|
|
55
|
+
id=${this.id + "-internal"}
|
|
56
|
+
class=${h}
|
|
57
|
+
type="checkbox"
|
|
58
|
+
?disabled=${this.disabled}
|
|
59
|
+
name=${this.name + "-internal"}
|
|
60
|
+
${b(this.inputRef)}
|
|
61
|
+
@change=${this.handleChange}
|
|
62
|
+
@click=${this.handleClick}
|
|
63
|
+
@blur=${this.onBlur}
|
|
64
|
+
@focus=${this.onFocus}
|
|
65
|
+
?checked=${this.checked}
|
|
66
|
+
role=${this.isSwitch ? "switch" : "checkbox"}
|
|
67
|
+
/>
|
|
68
|
+
${this.labelPosition === "right" ? c() : l}
|
|
69
|
+
</div>
|
|
70
|
+
</div>
|
|
71
|
+
`;
|
|
72
|
+
}
|
|
73
|
+
handleClick(e) {
|
|
74
|
+
if (this.disabled)
|
|
75
|
+
return e.preventDefault(), e.stopImmediatePropagation(), !1;
|
|
76
|
+
}
|
|
77
|
+
handleChange(e) {
|
|
78
|
+
if (this.disabled)
|
|
79
|
+
return e.preventDefault(), e.stopImmediatePropagation(), !1;
|
|
80
|
+
this.toggleChecked(e);
|
|
81
|
+
}
|
|
82
|
+
toggleChecked(e) {
|
|
83
|
+
if (this.disabled) {
|
|
84
|
+
e.preventDefault(), e.stopImmediatePropagation();
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
const h = e.target;
|
|
88
|
+
if (h && h.disabled) {
|
|
89
|
+
e.preventDefault(), e.stopImmediatePropagation();
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
e.stopImmediatePropagation(), this.touched = !0, this.inputRef.value && (this.checked = this.inputRef.value.matches(":checked"), this.valueChecked(this.checked));
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
s([
|
|
96
|
+
i({ type: String, reflect: !0 })
|
|
97
|
+
], t.prototype, "value");
|
|
98
|
+
s([
|
|
99
|
+
i({ type: String })
|
|
100
|
+
], t.prototype, "checkHelptext");
|
|
101
|
+
s([
|
|
102
|
+
i({ type: Boolean })
|
|
103
|
+
], t.prototype, "defaultChecked");
|
|
104
|
+
s([
|
|
105
|
+
i({ type: Boolean })
|
|
106
|
+
], t.prototype, "hasTile");
|
|
107
|
+
s([
|
|
108
|
+
i({ type: Boolean })
|
|
109
|
+
], t.prototype, "isSwitch");
|
|
110
|
+
s([
|
|
111
|
+
i({ type: String })
|
|
112
|
+
], t.prototype, "labelPosition");
|
|
113
|
+
s([
|
|
114
|
+
i({ type: Boolean })
|
|
115
|
+
], t.prototype, "hideLabel");
|
|
116
|
+
s([
|
|
117
|
+
i({ type: Boolean, reflect: !0 })
|
|
118
|
+
], t.prototype, "checked");
|
|
119
|
+
s([
|
|
120
|
+
i({ type: Boolean, reflect: !0 })
|
|
121
|
+
], t.prototype, "indeterminate");
|
|
122
|
+
s([
|
|
123
|
+
i({ type: String, reflect: !0 })
|
|
124
|
+
], t.prototype, "type");
|
|
125
|
+
s([
|
|
126
|
+
i({ type: String })
|
|
127
|
+
], t.prototype, "tagText");
|
|
128
|
+
s([
|
|
129
|
+
i({ type: Boolean })
|
|
130
|
+
], t.prototype, "optionalTag");
|
|
131
|
+
s([
|
|
132
|
+
i({ type: String })
|
|
133
|
+
], t.prototype, "optionalText");
|
|
134
|
+
s([
|
|
135
|
+
i({ type: Boolean })
|
|
136
|
+
], t.prototype, "requiredTag");
|
|
137
|
+
s([
|
|
138
|
+
i({ type: String })
|
|
139
|
+
], t.prototype, "requiredText");
|
|
140
|
+
try {
|
|
141
|
+
u("pkt-checkbox")(t);
|
|
142
|
+
} catch {
|
|
143
|
+
console.warn("Forsøker å definere <pkt-checkbox>, men den er allerede definert");
|
|
144
|
+
}
|
|
145
|
+
export {
|
|
146
|
+
t as P
|
|
147
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";const t=require("./element-gR_VtSiD.cjs"),u=require("./input-element-DdVhUvva.cjs"),d=require("./ref-CL-Xk9Xm.cjs"),p=require("./class-map-CsENJXf1.cjs");var o=Object.defineProperty,s=(c,e,n,r)=>{for(var a=void 0,h=c.length-1,l;h>=0;h--)(l=c[h])&&(a=l(e,n,a)||a);return a&&o(e,n,a),a};class i extends u.PktInputElement{constructor(){super(...arguments),this.inputRef=d.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.indeterminate=!1,this.type="checkbox",this.tagText=null,this.optionalTag=!1,this.optionalText="Valgfritt",this.requiredTag=!1,this.requiredText="Må fylles ut"}connectedCallback(){super.connectedCallback()}attributeChangedCallback(e,n,r){e==="defaultChecked"&&!this.checked&&(this.checked=this.defaultChecked),e==="checked"&&(this.checked=this.checked===""||this.checked==="true"||this.checked===!0,this.inputRef.value&&(this.inputRef.value.checked=this.checked)),e==="indeterminate"&&(this.indeterminate=this.indeterminate===""||this.indeterminate==="true"||this.indeterminate===!0,this.inputRef.value&&(this.inputRef.value.indeterminate=this.indeterminate)),super.attributeChangedCallback(e,n,r)}firstUpdated(e){e.has("defaultChecked")&&!this.checked&&(this.checked=this.defaultChecked),this.inputRef.value&&(this.inputRef.value.indeterminate=this.indeterminate===""||this.indeterminate==="true"||this.indeterminate===!0),super.firstUpdated(e)}updated(e){e.has("defaultChecked")&&!this.checked&&(this.checked=this.defaultChecked),e.has("checked")&&this.inputRef.value&&(this.inputRef.value.checked=this.checked===""||this.checked==="true"||this.checked===!0),e.has("indeterminate")&&this.inputRef.value&&(this.inputRef.value.indeterminate=this.indeterminate===""||this.indeterminate==="true"||this.indeterminate===!0),super.updated(e)}render(){const e=p.e({"pkt-input-check__input":!0,"pkt-input-check__input--tile":this.hasTile,"pkt-input-check__input--tile-disabled":this.disabled&&this.hasTile}),n=p.e({"pkt-input-check__input-checkbox":!0,"pkt-input-check__input-checkbox--error":this.hasError}),r=p.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}),a="pkt-tag pkt-tag--small pkt-tag--thin-text",h=()=>t.b`
|
|
2
|
+
${this.tagText?t.b`<span class=${a+" pkt-tag--gray"}>${this.tagText}</span>`:t.A}
|
|
3
|
+
${this.optionalTag?t.b`<span class=${a+" pkt-tag--blue-light"}>${this.optionalText}</span>`:t.A}
|
|
4
|
+
${this.requiredTag?t.b`<span class=${a+" pkt-tag--beige"}>${this.requiredText}</span>`:t.A}
|
|
5
|
+
`,l=()=>t.b`
|
|
6
|
+
<label class=${r} for=${this.id+"-internal"}>
|
|
7
|
+
${this.label} ${h()}
|
|
8
|
+
${this.checkHelptext?t.b`<div class="pkt-input-check__input-helptext">${this.checkHelptext}</div>`:t.A}
|
|
9
|
+
</label>
|
|
10
|
+
`;return t.b`
|
|
11
|
+
<div class="pkt-input-check">
|
|
12
|
+
<div class=${e}>
|
|
13
|
+
${this.labelPosition==="left"?l():t.A}
|
|
14
|
+
<input
|
|
15
|
+
id=${this.id+"-internal"}
|
|
16
|
+
class=${n}
|
|
17
|
+
type="checkbox"
|
|
18
|
+
?disabled=${this.disabled}
|
|
19
|
+
name=${this.name+"-internal"}
|
|
20
|
+
${d.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():t.A}
|
|
29
|
+
</div>
|
|
30
|
+
</div>
|
|
31
|
+
`}handleClick(e){if(this.disabled)return e.preventDefault(),e.stopImmediatePropagation(),!1}handleChange(e){if(this.disabled)return e.preventDefault(),e.stopImmediatePropagation(),!1;this.toggleChecked(e)}toggleChecked(e){if(this.disabled){e.preventDefault(),e.stopImmediatePropagation();return}const n=e.target;if(n&&n.disabled){e.preventDefault(),e.stopImmediatePropagation();return}e.stopImmediatePropagation(),this.touched=!0,this.inputRef.value&&(this.checked=this.inputRef.value.matches(":checked"),this.valueChecked(this.checked))}}s([t.n({type:String,reflect:!0})],i.prototype,"value");s([t.n({type:String})],i.prototype,"checkHelptext");s([t.n({type:Boolean})],i.prototype,"defaultChecked");s([t.n({type:Boolean})],i.prototype,"hasTile");s([t.n({type:Boolean})],i.prototype,"isSwitch");s([t.n({type:String})],i.prototype,"labelPosition");s([t.n({type:Boolean})],i.prototype,"hideLabel");s([t.n({type:Boolean,reflect:!0})],i.prototype,"checked");s([t.n({type:Boolean,reflect:!0})],i.prototype,"indeterminate");s([t.n({type:String,reflect:!0})],i.prototype,"type");s([t.n({type:String})],i.prototype,"tagText");s([t.n({type:Boolean})],i.prototype,"optionalTag");s([t.n({type:String})],i.prototype,"optionalText");s([t.n({type:Boolean})],i.prototype,"requiredTag");s([t.n({type:String})],i.prototype,"requiredText");try{t.t("pkt-checkbox")(i)}catch{console.warn("Forsøker å definere <pkt-checkbox>, men den er allerede definert")}exports.PktCheckbox=i;
|