@oslokommune/punkt-elements 12.30.2 → 12.31.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/dist/{alert-CP5oN7df.cjs → alert-BDxxRqgi.cjs} +1 -1
- package/dist/{alert-CugVni4g.js → alert-D0S57u0r.js} +5 -5
- package/dist/backlink-CzpB-ih9.js +46 -0
- package/dist/backlink-Dn4DfWVR.cjs +13 -0
- package/dist/backlink.d.ts +15 -0
- package/dist/{button-BCcznC7Q.js → button-9NwGr-OS.js} +2 -2
- package/dist/{button-rngMU-vh.cjs → button-Beo3c7cx.cjs} +1 -1
- package/dist/{calendar-DevhqUoj.js → calendar-BbZNxsKY.js} +4 -4
- package/dist/{calendar-DUkAC9Hx.cjs → calendar-CxBo98iI.cjs} +1 -1
- package/dist/{card-CGMZxbH_.js → card-B0uNyDCw.js} +6 -6
- package/dist/{card-D6VEEvX3.cjs → card-BWslf2mu.cjs} +1 -1
- package/dist/{checkbox-CDMUepTW.cjs → checkbox-9Zjy_NU7.cjs} +1 -1
- package/dist/{checkbox-Dw2CX5zY.js → checkbox-CzDpR6_8.js} +11 -11
- package/dist/{class-map-BYCG9U47.js → class-map-DWtqmIRS.js} +10 -9
- package/dist/class-map-Dj5mbCUg.cjs +5 -0
- package/dist/datepicker-BczZqaup.cjs +155 -0
- package/dist/{datepicker-LKIwV9DD.js → datepicker-CQZ84VOS.js} +18 -17
- package/dist/directive-B76A7YXI.js +27 -0
- package/dist/directive-C_VV3qwo.cjs +5 -0
- package/dist/{element-D_ZgQsSr.js → element-C7XjZtLU.js} +401 -426
- package/dist/{element-r-PeQ419.cjs → element-CzFXQBoS.cjs} +23 -27
- package/dist/{helptext-C0mrdhRi.cjs → helptext-B9kxDc2b.cjs} +1 -1
- package/dist/{helptext-RPq_TKzJ.js → helptext-CqnoPodd.js} +5 -5
- package/dist/{icon-BBFK-d-X.js → icon-BEUgV9Wo.js} +18 -17
- package/dist/icon-BOKusjAA.cjs +9 -0
- package/dist/{if-defined-CWHk9Kqm.cjs → if-defined-CpIkv1A4.cjs} +1 -1
- package/dist/{if-defined-u8oGOhnv.js → if-defined-eRX4e5zO.js} +1 -1
- package/dist/index.d.ts +16 -2
- package/dist/{input-element-B6BTwL1q.js → input-element-BK8UkQli.js} +32 -20
- package/dist/input-element-Dtyuf6s8.cjs +1 -0
- package/dist/{input-wrapper-Dqj4uers.cjs → input-wrapper-Bo2_t6pA.cjs} +1 -1
- package/dist/{input-wrapper-D-pEAZaj.js → input-wrapper-DaZZq8c0.js} +6 -6
- package/dist/{link-C_bwx1Ml.cjs → link-1iq0Pmuf.cjs} +1 -1
- package/dist/{link-CDkU7zsB.js → link-D3U0Jkz8.js} +4 -4
- package/dist/{linkcard-C6mZOE0R.cjs → linkcard-2WzDJPZz.cjs} +1 -1
- package/dist/{linkcard-Dr5iKZrV.js → linkcard-CRpo3tiw.js} +3 -3
- package/dist/{loader-ChVEsONa.js → loader-B1edLWTg.js} +5 -5
- package/dist/{loader-DQV1hMM3.cjs → loader-DI74pe25.cjs} +1 -1
- package/dist/{messagebox-BSyLVNas.cjs → messagebox-DQpEMkS2.cjs} +1 -1
- package/dist/{messagebox-Di7LUz4C.js → messagebox-KP-8-tA9.js} +5 -5
- package/dist/{modal-DZUQb_yG.js → modal-kPX8nO_L.js} +5 -5
- package/dist/{modal-CblCiNUi.cjs → modal-ytIJwfr3.cjs} +1 -1
- package/dist/pkt-alert.cjs +1 -1
- package/dist/pkt-alert.js +1 -1
- package/dist/pkt-backlink.cjs +1 -0
- package/dist/pkt-backlink.js +6 -0
- package/dist/pkt-button.cjs +1 -1
- package/dist/pkt-button.js +1 -1
- package/dist/pkt-calendar.cjs +1 -1
- package/dist/pkt-calendar.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-datepicker.cjs +1 -1
- package/dist/pkt-datepicker.js +1 -1
- package/dist/pkt-helptext.cjs +1 -1
- package/dist/pkt-helptext.js +1 -1
- package/dist/pkt-icon.cjs +1 -1
- package/dist/pkt-icon.js +1 -1
- package/dist/pkt-index.cjs +3 -3
- package/dist/pkt-index.js +46 -44
- package/dist/pkt-input-wrapper.cjs +1 -1
- package/dist/pkt-input-wrapper.js +1 -1
- package/dist/pkt-link.cjs +1 -1
- package/dist/pkt-link.js +1 -1
- package/dist/pkt-linkcard.cjs +1 -1
- package/dist/pkt-linkcard.js +1 -1
- package/dist/pkt-loader.cjs +1 -1
- package/dist/pkt-loader.js +1 -1
- package/dist/pkt-messagebox.cjs +1 -1
- package/dist/pkt-messagebox.js +1 -1
- package/dist/pkt-modal.cjs +1 -1
- package/dist/pkt-modal.js +1 -1
- package/dist/pkt-progressbar.cjs +1 -1
- package/dist/pkt-progressbar.js +2 -2
- 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-tag.cjs +1 -1
- package/dist/pkt-tag.js +1 -1
- package/dist/pkt-textarea.cjs +1 -1
- package/dist/pkt-textarea.js +1 -1
- package/dist/pkt-textinput.cjs +1 -1
- package/dist/pkt-textinput.js +1 -1
- package/dist/progressbar-B6A9UVXS.cjs +21 -0
- package/dist/{progressbar-CuZj4FWi.js → progressbar-D0nxLqHu.js} +14 -13
- package/dist/radiobutton-BWyQgR_x.cjs +24 -0
- package/dist/radiobutton-DLWjvLBO.js +88 -0
- package/dist/ref-2anvRHT4.cjs +13 -0
- package/dist/{ref-BSGI8ogR.js → ref-DbOSDQbk.js} +27 -26
- package/dist/{select-CnizDIYN.js → select-CzuxXKll.js} +6 -6
- package/dist/{select-DJu4Wr1y.cjs → select-DZL6aa2s.cjs} +1 -1
- package/dist/{state-DuS4ffEQ.js → state-CDQk0DFQ.js} +1 -1
- package/dist/{state-B77EXPZ9.cjs → state-HNj0_316.cjs} +1 -1
- package/dist/{tag-BFqxindw.js → tag-CHtPXyP5.js} +5 -5
- package/dist/{tag-B3KEILId.cjs → tag-D6ARkq2Z.cjs} +1 -1
- package/dist/{textarea-uzzCtHtj.js → textarea-BPqWCymU.js} +17 -16
- package/dist/textarea-VG-UTMLP.cjs +49 -0
- package/dist/{textinput-BRupcl9v.cjs → textinput-CEP7QA3E.cjs} +1 -1
- package/dist/{textinput-DRkv93vp.js → textinput-VD74aGzx.js} +8 -8
- package/package.json +3 -3
- package/src/components/backlink/backlink.ts +52 -0
- package/src/components/backlink/index.ts +6 -0
- package/src/components/checkbox/checkbox.ts +1 -1
- package/src/components/index.ts +3 -0
- package/src/components/radiobutton/radiobutton.ts +13 -3
- package/dist/class-map-Dzci3Pfe.cjs +0 -5
- package/dist/datepicker-NbLoqIKZ.cjs +0 -155
- package/dist/icon-DcJIqTIY.cjs +0 -9
- package/dist/input-element-KOSm5htR.cjs +0 -1
- package/dist/progressbar-C_q48_qh.cjs +0 -21
- package/dist/radiobutton-3e105CXX.cjs +0 -24
- package/dist/radiobutton-CcZ2-z8q.js +0 -88
- package/dist/ref-BUWgvhgU.cjs +0 -13
- package/dist/textarea-BKCVcJ6E.cjs +0 -49
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const e=require("./element-
|
|
1
|
+
"use strict";const e=require("./element-CzFXQBoS.cjs"),x=require("./ref-2anvRHT4.cjs"),h=require("./icon-BOKusjAA.cjs"),u=require("./class-map-Dj5mbCUg.cjs"),c=require("./state-HNj0_316.cjs"),a=require("./stringutils-CkVRq4jP.cjs"),d=require("./input-wrapper-jPnKsfEC.cjs"),k=require("./pkt-slot-controller-Oc32unDk.cjs");var v=Object.defineProperty,w=Object.getOwnPropertyDescriptor,r=(o,p,l,n)=>{for(var t=n>1?void 0:n?w(p,l):p,s=o.length-1,i;s>=0;s--)(i=o[s])&&(t=(n?i(p,l,t):i(t))||t);return n&&t&&v(p,l,t),t};exports.PktHelptext=class extends e.PktElement{constructor(){super(),this.defaultSlot=x.e(),this.forId=a.uuidish(),this.helptext="",this.helptextDropdown="",this.helptextDropdownButton=d.specs.props.helptextDropdownButton.default,this.isHelpTextOpen=!1,this.slotController=new k.PktSlotController(this,this.defaultSlot)}render(){const p=()=>{const t=!this.isHelpTextOpen;this.isHelpTextOpen=t,this.dispatchEvent(new CustomEvent("toggleHelpText",{bubbles:!0,detail:{isOpen:t}}))},l=()=>this.helptextDropdown?e.x`<div class="pkt-inputwrapper__helptext-expandable">
|
|
2
2
|
<button
|
|
3
3
|
class="pkt-link pkt-link--icon-right pkt-btn pkt-btn--small pkt-btn--tertiary pkt-btn--icon-right"
|
|
4
4
|
type="button"
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { P as d, x as a, n as i, a as u, E as c } from "./element-
|
|
2
|
-
import { e as f, n as m } from "./ref-
|
|
3
|
-
import { o as x } from "./icon-
|
|
4
|
-
import { e as v } from "./class-map-
|
|
5
|
-
import { r as w } from "./state-
|
|
1
|
+
import { P as d, x as a, n as i, a as u, E as c } from "./element-C7XjZtLU.js";
|
|
2
|
+
import { e as f, n as m } from "./ref-DbOSDQbk.js";
|
|
3
|
+
import { o as x } from "./icon-BEUgV9Wo.js";
|
|
4
|
+
import { e as v } from "./class-map-DWtqmIRS.js";
|
|
5
|
+
import { r as w } from "./state-CDQk0DFQ.js";
|
|
6
6
|
import { u as _ } from "./stringutils-DJjRa8dG.js";
|
|
7
7
|
import { s as k } from "./input-wrapper-Bw9tARAD.js";
|
|
8
8
|
import { P as b } from "./pkt-slot-controller-Clbye6cM.js";
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { E as f, T as v, P as m, x as y, n as h, a as P } from "./element-C7XjZtLU.js";
|
|
2
|
+
import { i as k, t as _, e as g } from "./directive-B76A7YXI.js";
|
|
2
3
|
/**
|
|
3
4
|
* @license
|
|
4
5
|
* Copyright 2017 Google LLC
|
|
5
6
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
6
7
|
*/
|
|
7
|
-
class a extends
|
|
8
|
+
class a extends k {
|
|
8
9
|
constructor(t) {
|
|
9
|
-
if (super(t), this.it =
|
|
10
|
+
if (super(t), this.it = f, t.type !== _.CHILD) throw Error(this.constructor.directiveName + "() can only be used in child bindings");
|
|
10
11
|
}
|
|
11
12
|
render(t) {
|
|
12
|
-
if (t ===
|
|
13
|
-
if (t ===
|
|
13
|
+
if (t === f || t == null) return this._t = void 0, this.it = t;
|
|
14
|
+
if (t === v) return t;
|
|
14
15
|
if (typeof t != "string") throw Error(this.constructor.directiveName + "() called with a non-string value");
|
|
15
16
|
if (t === this.it) return this._t;
|
|
16
17
|
this.it = t;
|
|
@@ -19,7 +20,7 @@ class a extends v {
|
|
|
19
20
|
}
|
|
20
21
|
}
|
|
21
22
|
a.directiveName = "unsafeHTML", a.resultType = 1;
|
|
22
|
-
const
|
|
23
|
+
const x = g(a);
|
|
23
24
|
/**
|
|
24
25
|
* @license
|
|
25
26
|
* Copyright 2017 Google LLC
|
|
@@ -28,11 +29,11 @@ const $ = g(a);
|
|
|
28
29
|
class d extends a {
|
|
29
30
|
}
|
|
30
31
|
d.directiveName = "unsafeSVG", d.resultType = 2;
|
|
31
|
-
const
|
|
32
|
-
var I = Object.defineProperty, b = Object.getOwnPropertyDescriptor, n = (e, t, s,
|
|
33
|
-
for (var
|
|
34
|
-
(l = e[p]) && (
|
|
35
|
-
return
|
|
32
|
+
const w = g(d);
|
|
33
|
+
var I = Object.defineProperty, b = Object.getOwnPropertyDescriptor, n = (e, t, s, o) => {
|
|
34
|
+
for (var i = o > 1 ? void 0 : o ? b(t, s) : t, p = e.length - 1, l; p >= 0; p--)
|
|
35
|
+
(l = e[p]) && (i = (o ? l(t, s, i) : l(i)) || i);
|
|
36
|
+
return o && i && I(t, s, i), i;
|
|
36
37
|
};
|
|
37
38
|
window.pktFetch = window.pktFetch === void 0 ? fetch : window.pktFetch;
|
|
38
39
|
window.pktIconPath = window.pktIconPath || "https://punkt-cdn.oslo.kommune.no/latest/icons/";
|
|
@@ -41,12 +42,12 @@ const C = (e) => new Promise((t) => setTimeout(t, e)), c = '<svg xmlns="http://w
|
|
|
41
42
|
for (; u[t + e + ".svg"] === "fetching" && (s++, !(s > 50)); )
|
|
42
43
|
await C(50);
|
|
43
44
|
return localStorage.getItem(t + e + ".svg") ? Promise.resolve(localStorage.getItem(t + e + ".svg")) : typeof window.pktFetch == "function" ? (u[t + e + ".svg"] = "fetching", Promise.resolve(
|
|
44
|
-
window.pktFetch(t + e + ".svg").then((
|
|
45
|
+
window.pktFetch(t + e + ".svg").then((o) => o.ok ? o.text() : (console.error("Missing icon: " + t + e + ".svg"), c)).then((o) => (o !== c && localStorage.setItem(t + e + ".svg", o), u[t + e + ".svg"] = "fetched", o))
|
|
45
46
|
)) : Promise.resolve(c);
|
|
46
47
|
};
|
|
47
48
|
let r = class extends m {
|
|
48
49
|
constructor() {
|
|
49
|
-
super(...arguments), this.path = window.pktIconPath, this.name = "", this.icon =
|
|
50
|
+
super(...arguments), this.path = window.pktIconPath, this.name = "", this.icon = w(c), this._updatedProps = [];
|
|
50
51
|
}
|
|
51
52
|
connectedCallback() {
|
|
52
53
|
super.connectedCallback(), this.classList.add("pkt-icon");
|
|
@@ -58,12 +59,12 @@ let r = class extends m {
|
|
|
58
59
|
super.updated(e), (e.has("name") || e.has("path")) && this.getIcon(this.name);
|
|
59
60
|
}
|
|
60
61
|
async getIcon(e = "") {
|
|
61
|
-
this._updatedProps.length > 0 ? (this.path || (this.path, window.pktIconPath), this.icon =
|
|
62
|
+
this._updatedProps.length > 0 ? (this.path || (this.path, window.pktIconPath), this.icon = w(
|
|
62
63
|
await S(this.name || "", this.path).then((t) => t)
|
|
63
64
|
), this._updatedProps = []) : this._updatedProps.includes(e) || this._updatedProps.push(e);
|
|
64
65
|
}
|
|
65
66
|
render() {
|
|
66
|
-
return
|
|
67
|
+
return y`${this.name && this.icon}`;
|
|
67
68
|
}
|
|
68
69
|
};
|
|
69
70
|
n([
|
|
@@ -79,9 +80,9 @@ n([
|
|
|
79
80
|
h({ type: Array, noAccessor: !0 })
|
|
80
81
|
], r.prototype, "_updatedProps", 2);
|
|
81
82
|
r = n([
|
|
82
|
-
|
|
83
|
+
P("pkt-icon")
|
|
83
84
|
], r);
|
|
84
85
|
export {
|
|
85
86
|
r as P,
|
|
86
|
-
|
|
87
|
+
x as o
|
|
87
88
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";const o=require("./element-CzFXQBoS.cjs"),a=require("./directive-C_VV3qwo.cjs");/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2017 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
+
*/class h extends a.i{constructor(t){if(super(t),this.it=o.E,t.type!==a.t.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===o.E||t==null)return this._t=void 0,this.it=t;if(t===o.T)return t;if(typeof t!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;const s=[t];return s.raw=s,this._t={_$litType$:this.constructor.resultType,strings:s,values:[]}}}h.directiveName="unsafeHTML",h.resultType=1;const f=a.e(h);/**
|
|
6
|
+
* @license
|
|
7
|
+
* Copyright 2017 Google LLC
|
|
8
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
9
|
+
*/class d extends h{}d.directiveName="unsafeSVG",d.resultType=2;const w=a.e(d);var g=Object.defineProperty,v=Object.getOwnPropertyDescriptor,r=(e,t,s,n)=>{for(var i=n>1?void 0:n?v(t,s):t,l=e.length-1,p;l>=0;l--)(p=e[l])&&(i=(n?p(t,s,i):p(i))||i);return n&&i&&g(t,s,i),i};window.pktFetch=window.pktFetch===void 0?fetch:window.pktFetch;window.pktIconPath=window.pktIconPath||"https://punkt-cdn.oslo.kommune.no/latest/icons/";const P=e=>new Promise(t=>setTimeout(t,e)),c='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"></svg>',u={},k=async(e,t)=>{let s=0;for(;u[t+e+".svg"]==="fetching"&&(s++,!(s>50));)await P(50);return localStorage.getItem(t+e+".svg")?Promise.resolve(localStorage.getItem(t+e+".svg")):typeof window.pktFetch=="function"?(u[t+e+".svg"]="fetching",Promise.resolve(window.pktFetch(t+e+".svg").then(n=>n.ok?n.text():(console.error("Missing icon: "+t+e+".svg"),c)).then(n=>(n!==c&&localStorage.setItem(t+e+".svg",n),u[t+e+".svg"]="fetched",n)))):Promise.resolve(c)};exports.PktIcon=class extends o.PktElement{constructor(){super(...arguments),this.path=window.pktIconPath,this.name="",this.icon=w(c),this._updatedProps=[]}connectedCallback(){super.connectedCallback(),this.classList.add("pkt-icon")}async attributeChangedCallback(t,s,n){super.attributeChangedCallback(t,s,n),(t==="name"||t==="path")&&this.getIcon(this.name)}async updated(t){super.updated(t),(t.has("name")||t.has("path"))&&this.getIcon(this.name)}async getIcon(t=""){this._updatedProps.length>0?(this.path||(this.path,window.pktIconPath),this.icon=w(await k(this.name||"",this.path).then(s=>s)),this._updatedProps=[]):this._updatedProps.includes(t)||this._updatedProps.push(t)}render(){return o.x`${this.name&&this.icon}`}};r([o.n({type:String,reflect:!1})],exports.PktIcon.prototype,"path",2);r([o.n({type:String,reflect:!0})],exports.PktIcon.prototype,"name",2);r([o.n({type:SVGElement})],exports.PktIcon.prototype,"icon",2);r([o.n({type:Array,noAccessor:!0})],exports.PktIcon.prototype,"_updatedProps",2);exports.PktIcon=r([o.t("pkt-icon")],exports.PktIcon);exports.o=f;
|
package/dist/index.d.ts
CHANGED
|
@@ -24,6 +24,12 @@ declare interface IPktAlert {
|
|
|
24
24
|
compact?: boolean;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
export declare interface IPktBackLink {
|
|
28
|
+
href?: string;
|
|
29
|
+
text?: string;
|
|
30
|
+
ariaLabel?: string;
|
|
31
|
+
}
|
|
32
|
+
|
|
27
33
|
export declare interface IPktButton {
|
|
28
34
|
iconName?: PktIconName;
|
|
29
35
|
secondIconName?: PktIconName;
|
|
@@ -143,6 +149,14 @@ export declare class PktAlert extends PktElement implements IPktAlert {
|
|
|
143
149
|
private close;
|
|
144
150
|
}
|
|
145
151
|
|
|
152
|
+
export declare class PktBackLink extends PktElement<IPktBackLink> implements IPktBackLink {
|
|
153
|
+
href: string;
|
|
154
|
+
text: string;
|
|
155
|
+
ariaLabel: string;
|
|
156
|
+
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
157
|
+
render(): TemplateResult<1>;
|
|
158
|
+
}
|
|
159
|
+
|
|
146
160
|
export declare class PktButton extends PktElement<IPktButton> implements IPktButton {
|
|
147
161
|
static formAssociated: boolean;
|
|
148
162
|
private internals;
|
|
@@ -271,7 +285,7 @@ export declare class PktCheckbox extends PktInputElement {
|
|
|
271
285
|
isSwitch: boolean;
|
|
272
286
|
labelPosition: 'right' | 'left';
|
|
273
287
|
hideLabel: boolean;
|
|
274
|
-
checked: boolean | string;
|
|
288
|
+
checked: boolean | string | null;
|
|
275
289
|
type: string;
|
|
276
290
|
connectedCallback(): void;
|
|
277
291
|
attributeChangedCallback(name: string, _old: string | null, value: string | null): void;
|
|
@@ -638,7 +652,7 @@ declare class PktRadioButton extends PktInputElement {
|
|
|
638
652
|
checkHelptext: string | null;
|
|
639
653
|
defaultChecked: boolean;
|
|
640
654
|
hasTile: boolean;
|
|
641
|
-
checked: boolean | string;
|
|
655
|
+
checked: boolean | string | null;
|
|
642
656
|
type: string;
|
|
643
657
|
_checked: boolean;
|
|
644
658
|
connectedCallback(): void;
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import { n as s, P as y, t as
|
|
2
|
-
import { r as c } from "./state-
|
|
1
|
+
import { n as s, P as y, t as n } from "./element-C7XjZtLU.js";
|
|
2
|
+
import { r as c } from "./state-CDQk0DFQ.js";
|
|
3
3
|
import { u as m } from "./stringutils-DJjRa8dG.js";
|
|
4
4
|
import { s as g } from "./input-wrapper-Bw9tARAD.js";
|
|
5
|
-
var v = Object.defineProperty, e = (p, t, r,
|
|
6
|
-
for (var a = void 0,
|
|
7
|
-
(o = p[
|
|
5
|
+
var v = Object.defineProperty, e = (p, t, r, l) => {
|
|
6
|
+
for (var a = void 0, h = p.length - 1, o; h >= 0; h--)
|
|
7
|
+
(o = p[h]) && (a = o(t, r, a) || a);
|
|
8
8
|
return a && v(t, r, a), a;
|
|
9
9
|
};
|
|
10
10
|
class i extends y {
|
|
11
11
|
constructor() {
|
|
12
|
-
super(), this.defaultValue = null, this.disabled = !1, this.readonly = !1, this.required = !1, this.max = null, this.maxlength = null, this.min = null, this.minlength = null, this.ariaDescribedBy = null, this.ariaLabelledby = null, this.name = "", this.pattern = null, this.placeholder = null, this.id = m(), this.counter = !1, this.hasError = !1, this.inline = !1, this.optionalTag = !1, this.requiredTag = !1, this.skipForwardTestid = !1, this.useWrapper = !0, this.fullwidth = !1, this.counterMaxLength = 0, this.errorMessage = "", this.helptext = "", this.helptextDropdown = "", this.helptextDropdownButton = g.props.helptextDropdownButton.default, this.label = null, this.optionalText =
|
|
12
|
+
super(), this.defaultValue = null, this.disabled = !1, this.readonly = !1, this.required = !1, this.max = null, this.maxlength = null, this.min = null, this.minlength = null, this.ariaDescribedBy = null, this.ariaLabelledby = null, this.name = "", this.pattern = null, this.placeholder = null, this.id = m(), this.counter = !1, this.hasError = !1, this.inline = !1, this.optionalTag = !1, this.requiredTag = !1, this.skipForwardTestid = !1, this.useWrapper = !0, this.fullwidth = !1, this.counterMaxLength = 0, this.errorMessage = "", this.helptext = "", this.helptextDropdown = "", this.helptextDropdownButton = g.props.helptextDropdownButton.default, this.label = null, this.optionalText = n.forms.labels.optional, this.requiredText = n.forms.labels.required, this.dataTestid = "", this.touched = !1, this.internals = this.attachInternals();
|
|
13
13
|
}
|
|
14
14
|
static get formAssociated() {
|
|
15
15
|
return !0;
|
|
16
16
|
}
|
|
17
17
|
manageValidity(t) {
|
|
18
|
-
var r,
|
|
19
|
-
t && (this.required && !this.value ? this.internals.setValidity({ valueMissing: !0 },
|
|
18
|
+
var r, l, a, h, o, u, d, f;
|
|
19
|
+
t && (this.required && !this.value ? this.internals.setValidity({ valueMissing: !0 }, n.forms.messages.required, t) : (r = t.validity) != null && r.typeMismatch || (l = t.validity) != null && l.badInput ? this.internals.setValidity({ typeMismatch: !0 }, n.forms.messages.invalid, t) : (a = t.validity) != null && a.patternMismatch ? this.internals.setValidity(
|
|
20
20
|
{ patternMismatch: !0 },
|
|
21
|
-
|
|
21
|
+
n.forms.messages.invalidPattern,
|
|
22
22
|
t
|
|
23
|
-
) : (
|
|
23
|
+
) : (h = t.validity) != null && h.tooShort || this.minlength && this.minlength > 0 && this.value.length < this.minlength ? this.internals.setValidity({ tooShort: !0 }, n.forms.messages.tooShort, t) : (o = t.validity) != null && o.tooLong || this.maxlength && this.maxlength > 0 && this.value.length > this.maxlength ? this.internals.setValidity({ tooLong: !0 }, n.forms.messages.tooLong, t) : (u = t.validity) != null && u.rangeUnderflow ? this.internals.setValidity(
|
|
24
24
|
{ rangeUnderflow: !0 },
|
|
25
|
-
|
|
25
|
+
n.forms.messages.rangeUnderflow,
|
|
26
26
|
t
|
|
27
27
|
) : (d = t.validity) != null && d.rangeOverflow ? this.internals.setValidity(
|
|
28
28
|
{ rangeOverflow: !0 },
|
|
29
|
-
|
|
29
|
+
n.forms.messages.rangeOverflow,
|
|
30
30
|
t
|
|
31
31
|
) : (f = t.validity) != null && f.customError ? this.internals.setValidity({ customError: !0 }, t.validationMessage, t) : this.internals.setValidity({}));
|
|
32
32
|
}
|
|
@@ -34,8 +34,8 @@ class i extends y {
|
|
|
34
34
|
if (this.internals)
|
|
35
35
|
if (Array.isArray(t)) {
|
|
36
36
|
const r = new FormData();
|
|
37
|
-
t.forEach((
|
|
38
|
-
r.append(this.name,
|
|
37
|
+
t.forEach((l) => {
|
|
38
|
+
r.append(this.name, l);
|
|
39
39
|
}), this.internals.setFormValue(r);
|
|
40
40
|
} else
|
|
41
41
|
this.internals.setFormValue(t);
|
|
@@ -43,16 +43,20 @@ class i extends y {
|
|
|
43
43
|
// Trigger this when you want to set the value of the *radio or checkbox* input out to the form
|
|
44
44
|
// Do not use valueChanged or onChange for radios and checkboxes!
|
|
45
45
|
valueChecked(t) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
if (!this.touched) return;
|
|
47
|
+
const r = this.internals.form || this.closest("form");
|
|
48
|
+
r && r.querySelectorAll(
|
|
49
|
+
`pkt-radiobutton[name=${this.name}], input[type=radio][name=${this.name}]`
|
|
50
|
+
).forEach((l) => {
|
|
51
|
+
const a = l;
|
|
52
|
+
a.name === this.name && a.value !== this.value && a.checked && (a.checked = !1);
|
|
53
|
+
}), typeof t == "string" ? (this.checked = t === "true", this.internals.ariaChecked = t === "true") : typeof t == "boolean" && (this.checked = t, this.internals.ariaChecked = t), this.checked ? (this.internals.setFormValue(this.value || "on", this.value || "on"), this.internals.states.add("--checked")) : (this.internals.setFormValue("", ""), this.internals.states.delete("--checked")), this.dispatchEvent(new Event("change")), this.dispatchEvent(
|
|
50
54
|
new CustomEvent("value-change", {
|
|
51
55
|
detail: this.checked,
|
|
52
56
|
bubbles: !0,
|
|
53
57
|
composed: !0
|
|
54
58
|
})
|
|
55
|
-
), this.internals.reportValidity()
|
|
59
|
+
), this.internals.reportValidity();
|
|
56
60
|
}
|
|
57
61
|
valueChanged(t, r) {
|
|
58
62
|
(r !== this.value || r !== this._value) && (typeof t == "string" ? ((this.multiple || this.range) && t.includes(",") && (t = t.split(",")), this.value = t, this._value = Array.isArray(t) ? t : [t]) : Array.isArray(t) ? (this.value = t, this._value = t) : (this.value = "", this._value = []), (!this.value || this.value.length === 0) && r && r.length !== 0 ? this.clearInputValue() : this.value && this.value.toString() !== (r == null ? void 0 : r.toString()) && this.onChange(this.value), this.updateComplete.then(() => this.requestUpdate()));
|
|
@@ -98,7 +102,15 @@ class i extends y {
|
|
|
98
102
|
super.updated(t), t.has("dataTestid") && this.dataTestid && this.inputRef.value && (this.skipForwardTestid ? this.hasAttribute("data-testid") || this.setAttribute("data-testid", this.dataTestid) : (this.inputRef.value.dataset.testid = this.dataTestid, this.removeAttribute("data-testid")));
|
|
99
103
|
}
|
|
100
104
|
firstUpdated(t) {
|
|
101
|
-
super.firstUpdated(t), this.value && this.defaultValue !== null && (this.defaultValue = this.value), this.defaultValue !== null && !this.value && this.valueChanged(this.defaultValue, null), this.defaultChecked && (this.internals.ariaChecked = !0, this.checked = !0), this.required && (this.internals.ariaRequired = !0), this.disabled && (this.internals.ariaDisabled = !0), this.id && !this.name && (this.name = this.id), this.
|
|
105
|
+
if (super.firstUpdated(t), this.value && this.defaultValue !== null && (this.defaultValue = this.value), this.defaultValue !== null && !this.value && this.valueChanged(this.defaultValue, null), this.defaultChecked && (this.internals.ariaChecked = !0, this.checked = !0), this.required && (this.internals.ariaRequired = !0), this.disabled && (this.internals.ariaDisabled = !0), this.id && !this.name && (this.name = this.id), this.checked !== void 0) {
|
|
106
|
+
const r = this.checked === "" || this.checked === "true" || this.checked === !0;
|
|
107
|
+
this.internals.ariaChecked = r, this.internals.setFormValue(
|
|
108
|
+
r ? this.value || "on" : "",
|
|
109
|
+
r ? this.value || "on" : ""
|
|
110
|
+
);
|
|
111
|
+
} else
|
|
112
|
+
this.internals.setFormValue(this.value);
|
|
113
|
+
this.inputRef && this.inputRef.value && (this.inputRef.value.setAttribute("form", ""), this.manageValidity(this.inputRef.value)), this.inputRefTo && this.inputRefTo.value && (this.inputRefTo.value.setAttribute("form", ""), this.manageValidity(this.inputRefTo.value));
|
|
102
114
|
}
|
|
103
115
|
}
|
|
104
116
|
e([
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("./element-CzFXQBoS.cjs"),f=require("./state-HNj0_316.cjs"),y=require("./stringutils-CkVRq4jP.cjs"),c=require("./input-wrapper-jPnKsfEC.cjs");var m=Object.defineProperty,s=(o,t,r,n)=>{for(var a=void 0,l=o.length-1,h;l>=0;l--)(h=o[l])&&(a=h(t,r,a)||a);return a&&m(t,r,a),a};class i extends e.PktElement{constructor(){super(),this.defaultValue=null,this.disabled=!1,this.readonly=!1,this.required=!1,this.max=null,this.maxlength=null,this.min=null,this.minlength=null,this.ariaDescribedBy=null,this.ariaLabelledby=null,this.name="",this.pattern=null,this.placeholder=null,this.id=y.uuidish(),this.counter=!1,this.hasError=!1,this.inline=!1,this.optionalTag=!1,this.requiredTag=!1,this.skipForwardTestid=!1,this.useWrapper=!0,this.fullwidth=!1,this.counterMaxLength=0,this.errorMessage="",this.helptext="",this.helptextDropdown="",this.helptextDropdownButton=c.specs.props.helptextDropdownButton.default,this.label=null,this.optionalText=e.translations.forms.labels.optional,this.requiredText=e.translations.forms.labels.required,this.dataTestid="",this.touched=!1,this.internals=this.attachInternals()}static get formAssociated(){return!0}manageValidity(t){var r,n,a,l,h,u,p,d;t&&(this.required&&!this.value?this.internals.setValidity({valueMissing:!0},e.translations.forms.messages.required,t):(r=t.validity)!=null&&r.typeMismatch||(n=t.validity)!=null&&n.badInput?this.internals.setValidity({typeMismatch:!0},e.translations.forms.messages.invalid,t):(a=t.validity)!=null&&a.patternMismatch?this.internals.setValidity({patternMismatch:!0},e.translations.forms.messages.invalidPattern,t):(l=t.validity)!=null&&l.tooShort||this.minlength&&this.minlength>0&&this.value.length<this.minlength?this.internals.setValidity({tooShort:!0},e.translations.forms.messages.tooShort,t):(h=t.validity)!=null&&h.tooLong||this.maxlength&&this.maxlength>0&&this.value.length>this.maxlength?this.internals.setValidity({tooLong:!0},e.translations.forms.messages.tooLong,t):(u=t.validity)!=null&&u.rangeUnderflow?this.internals.setValidity({rangeUnderflow:!0},e.translations.forms.messages.rangeUnderflow,t):(p=t.validity)!=null&&p.rangeOverflow?this.internals.setValidity({rangeOverflow:!0},e.translations.forms.messages.rangeOverflow,t):(d=t.validity)!=null&&d.customError?this.internals.setValidity({customError:!0},t.validationMessage,t):this.internals.setValidity({}))}setFormValue(t){if(this.internals)if(Array.isArray(t)){const r=new FormData;t.forEach(n=>{r.append(this.name,n)}),this.internals.setFormValue(r)}else this.internals.setFormValue(t)}valueChecked(t){if(!this.touched)return;const r=this.internals.form||this.closest("form");r&&r.querySelectorAll(`pkt-radiobutton[name=${this.name}], input[type=radio][name=${this.name}]`).forEach(n=>{const a=n;a.name===this.name&&a.value!==this.value&&a.checked&&(a.checked=!1)}),typeof t=="string"?(this.checked=t==="true",this.internals.ariaChecked=t==="true"):typeof t=="boolean"&&(this.checked=t,this.internals.ariaChecked=t),this.checked?(this.internals.setFormValue(this.value||"on",this.value||"on"),this.internals.states.add("--checked")):(this.internals.setFormValue("",""),this.internals.states.delete("--checked")),this.dispatchEvent(new Event("change")),this.dispatchEvent(new CustomEvent("value-change",{detail:this.checked,bubbles:!0,composed:!0})),this.internals.reportValidity()}valueChanged(t,r){(r!==this.value||r!==this._value)&&(typeof t=="string"?((this.multiple||this.range)&&t.includes(",")&&(t=t.split(",")),this.value=t,this._value=Array.isArray(t)?t:[t]):Array.isArray(t)?(this.value=t,this._value=t):(this.value="",this._value=[]),(!this.value||this.value.length===0)&&r&&r.length!==0?this.clearInputValue():this.value&&this.value.toString()!==(r==null?void 0:r.toString())&&this.onChange(this.value),this.updateComplete.then(()=>this.requestUpdate()))}clearInputValue(){const t=this.multiple||this.range?[]:"";this.value=t,this.internals.setFormValue(t),this.dispatchEvent(new Event("change")),this.dispatchEvent(new CustomEvent("value-change",{detail:t,bubbles:!0,composed:!0}))}onFocus(){this.dispatchEvent(new FocusEvent("focus"))}onBlur(){this.dispatchEvent(new FocusEvent("blur"))}onInput(){this.dispatchEvent(new InputEvent("input"))}onChange(t){if(!this.touched){this.touched=!0,t&&this.setFormValue(t);return}typeof t!="string"&&!Array.isArray(t)||((this.range||this.multiple)&&!Array.isArray(t)&&t.includes(",")&&(t=t.split(",")),!this.multiple&&!this.range&&Array.isArray(t)&&(t=t[0]),this.setFormValue(t),this.manageValidity(this.inputRef.value),this.inputRefTo&&this.manageValidity(this.inputRefTo.value),this.dispatchEvent(new Event("change")),this.dispatchEvent(new CustomEvent("value-change",{detail:t,bubbles:!0,composed:!0})),this.internals.reportValidity())}updated(t){super.updated(t),t.has("dataTestid")&&this.dataTestid&&this.inputRef.value&&(this.skipForwardTestid?this.hasAttribute("data-testid")||this.setAttribute("data-testid",this.dataTestid):(this.inputRef.value.dataset.testid=this.dataTestid,this.removeAttribute("data-testid")))}firstUpdated(t){if(super.firstUpdated(t),this.value&&this.defaultValue!==null&&(this.defaultValue=this.value),this.defaultValue!==null&&!this.value&&this.valueChanged(this.defaultValue,null),this.defaultChecked&&(this.internals.ariaChecked=!0,this.checked=!0),this.required&&(this.internals.ariaRequired=!0),this.disabled&&(this.internals.ariaDisabled=!0),this.id&&!this.name&&(this.name=this.id),this.checked!==void 0){const r=this.checked===""||this.checked==="true"||this.checked===!0;this.internals.ariaChecked=r,this.internals.setFormValue(r?this.value||"on":"",r?this.value||"on":"")}else this.internals.setFormValue(this.value);this.inputRef&&this.inputRef.value&&(this.inputRef.value.setAttribute("form",""),this.manageValidity(this.inputRef.value)),this.inputRefTo&&this.inputRefTo.value&&(this.inputRefTo.value.setAttribute("form",""),this.manageValidity(this.inputRefTo.value))}}s([e.n()],i.prototype,"defaultValue");s([e.n({type:Boolean,reflect:!0})],i.prototype,"disabled");s([e.n({type:Boolean,reflect:!0})],i.prototype,"readonly");s([e.n({type:Boolean,reflect:!0})],i.prototype,"required");s([e.n({type:Number,reflect:!0})],i.prototype,"max");s([e.n({type:Number,reflect:!0})],i.prototype,"maxlength");s([e.n({type:Number,reflect:!0})],i.prototype,"min");s([e.n({type:Number,reflect:!0})],i.prototype,"minlength");s([e.n({type:String})],i.prototype,"ariaDescribedBy");s([e.n({type:String})],i.prototype,"ariaLabelledby");s([e.n({type:String,reflect:!0})],i.prototype,"name");s([e.n({type:String,reflect:!0})],i.prototype,"pattern");s([e.n({type:String,reflect:!0})],i.prototype,"placeholder");s([e.n({type:String,reflect:!0})],i.prototype,"id");s([e.n({type:Boolean})],i.prototype,"counter");s([e.n({type:Boolean})],i.prototype,"hasError");s([e.n({type:Boolean})],i.prototype,"inline");s([e.n({type:Boolean})],i.prototype,"optionalTag");s([e.n({type:Boolean})],i.prototype,"requiredTag");s([e.n({type:Boolean})],i.prototype,"skipForwardTestid");s([e.n({type:Boolean})],i.prototype,"useWrapper");s([e.n({type:Boolean,reflect:!0})],i.prototype,"fullwidth");s([e.n({type:Number})],i.prototype,"counterMaxLength");s([e.n({type:String})],i.prototype,"errorMessage");s([e.n({type:String})],i.prototype,"helptext");s([e.n({type:String})],i.prototype,"helptextDropdown");s([e.n({type:String})],i.prototype,"helptextDropdownButton");s([e.n({type:String})],i.prototype,"label");s([e.n({type:String})],i.prototype,"optionalText");s([e.n({type:String})],i.prototype,"requiredText");s([e.n({type:String,attribute:"data-testid"})],i.prototype,"dataTestid");s([f.r()],i.prototype,"touched");exports.PktInputElement=i;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const t=require("./element-
|
|
1
|
+
"use strict";const t=require("./element-CzFXQBoS.cjs"),f=require("./pkt-slot-controller-Oc32unDk.cjs"),u=require("./ref-2anvRHT4.cjs"),$=require("./icon-BOKusjAA.cjs"),a=require("./class-map-Dj5mbCUg.cjs"),I=require("./state-HNj0_316.cjs"),P=require("./stringutils-CkVRq4jP.cjs"),p=require("./input-wrapper-jPnKsfEC.cjs");require("./helptext-B9kxDc2b.cjs");var W=Object.defineProperty,w=Object.getOwnPropertyDescriptor,e=(h,s,n,o)=>{for(var r=o>1?void 0:o?w(s,n):s,i=h.length-1,l;i>=0;i--)(l=h[i])&&(r=(o?l(s,n,r):l(r))||r);return o&&r&&W(s,n,r),r};exports.PktInputWrapper=class extends t.PktElement{constructor(){super(),this.defaultSlot=u.e(),this.helptextSlot=u.e(),this.hasHelptextSlot=!1,this.forId=P.uuidish(),this.label="",this.helptext=null,this.helptextDropdown=null,this.helptextDropdownButton=null,this.counter=p.specs.props.counter.default,this.counterCurrent=0,this.counterMaxLength=0,this.optionalTag=p.specs.props.optionalTag.default,this.optionalText=p.specs.props.optionalText.default,this.requiredTag=p.specs.props.requiredTag.default,this.requiredText=p.specs.props.requiredText.default,this.hasError=p.specs.props.hasError.default,this.errorMessage="",this.disabled=p.specs.props.disabled.default,this.inline=p.specs.props.inline.default,this.ariaDescribedby=void 0,this.hasFieldset=p.specs.props.hasFieldset.default,this.useWrapper=p.specs.props.useWrapper.default,this.role="group",this.slotController=new f.PktSlotController(this,this.defaultSlot,this.helptextSlot)}updateSlots(){this.hasHelptextSlot=this.slotController.filledSlots.has("helptext")}updated(s){this.updateSlots(),super.updated(s)}render(){const s={"pkt-inputwrapper":!0,"pkt-inputwrapper--error":this.hasError,"pkt-inputwrapper--disabled":this.disabled,"pkt-inputwrapper--inline":this.inline},n={"pkt-tag":!0,"pkt-tag--small":!0,"pkt-tag--thin-text":!0,"pkt-tag--blue-light":this.optionalTag,"pkt-tag--beige":!this.optionalTag&&this.requiredTag},o=!!this.helptextDropdown,r={"pkt-inputwrapper__label":!0,"pkt-inputwrapper__fieldset":this.hasFieldset,"pkt-inputwrapper__legend":this.hasFieldset},i=this.ariaDescribedby?this.ariaDescribedby:this.helptext?`${this.forId}-helptext`:t.E,l=()=>this.optionalTag||this.requiredTag?t.x`<span class=${a.e(n)}
|
|
2
2
|
>${this.optionalTag?this.optionalText:this.requiredTag?this.requiredText:t.E}</span
|
|
3
3
|
>`:t.E,c=()=>this.useWrapper?this.hasFieldset?t.x`<legend class="pkt-inputwrapper__legend" id="${this.forId}-label">
|
|
4
4
|
${this.label} ${l()}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { P as k, E as h, x as o, n as r, a as v } from "./element-
|
|
1
|
+
import { P as k, E as h, x as o, n as r, a as v } from "./element-C7XjZtLU.js";
|
|
2
2
|
import { P as S } from "./pkt-slot-controller-Clbye6cM.js";
|
|
3
|
-
import { e as g, n as y } from "./ref-
|
|
4
|
-
import { o as T } from "./icon-
|
|
5
|
-
import { e as c } from "./class-map-
|
|
6
|
-
import { r as _ } from "./state-
|
|
3
|
+
import { e as g, n as y } from "./ref-DbOSDQbk.js";
|
|
4
|
+
import { o as T } from "./icon-BEUgV9Wo.js";
|
|
5
|
+
import { e as c } from "./class-map-DWtqmIRS.js";
|
|
6
|
+
import { r as _ } from "./state-CDQk0DFQ.js";
|
|
7
7
|
import { u as D } from "./stringutils-DJjRa8dG.js";
|
|
8
8
|
import { s } from "./input-wrapper-Bw9tARAD.js";
|
|
9
|
-
import "./helptext-
|
|
9
|
+
import "./helptext-CqnoPodd.js";
|
|
10
10
|
var E = Object.defineProperty, B = Object.getOwnPropertyDescriptor, e = (i, d, a, l) => {
|
|
11
11
|
for (var p = l > 1 ? void 0 : l ? B(d, a) : d, n = i.length - 1, u; n >= 0; n--)
|
|
12
12
|
(u = i[n]) && (p = (l ? u(d, a, p) : u(p)) || p);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const e=require("./element-
|
|
1
|
+
"use strict";const e=require("./element-CzFXQBoS.cjs"),k=require("./pkt-slot-controller-Oc32unDk.cjs"),p=require("./ref-2anvRHT4.cjs"),h=require("./class-map-Dj5mbCUg.cjs");require("./icon-BOKusjAA.cjs");const f="pkt-link",u=!0,d={href:{name:"URL",description:"URL til lenken",type:"string",default:"#"},target:{name:"Mål",description:"Mål for lenken",type:["_blank","_self","_parent","_top"],default:"_self"},iconName:{name:"Ikon",description:"Ikon som skal vises ved siden av lenketeksten",type:"icon"},iconPosition:{name:"Ikonposisjon",description:"Posisjonen til ikonet i forhold til lenketeksten",type:["left","right"]},external:{name:"Ekstern lenke",description:"Vis ikon for ekstern lenke",type:"boolean",default:!1}},m={default:{description:"Innholdet i lenken"}},c={name:f,"css-class":"pkt-link","dark-mode":!0,isElement:u,props:d,slots:m};var P=Object.defineProperty,y=Object.getOwnPropertyDescriptor,i=(s,n,r,o)=>{for(var t=o>1?void 0:o?y(n,r):n,l=s.length-1,a;l>=0;l--)(a=s[l])&&(t=(o?a(n,r,t):a(t))||t);return o&&t&&P(n,r,t),t};exports.PktLink=class extends e.PktElement{constructor(){super(),this.defaultSlot=p.e(),this.href=c.props.href.default,this.iconName=void 0,this.iconPosition=void 0,this.external=c.props.external.default,this.target=c.props.target.default,this.slotController=new k.PktSlotController(this,this.defaultSlot)}render(){const n={"pkt-link":!0,"pkt-link--icon-left":!!this.iconName&&this.iconPosition==="left"||!!(this.iconName&&!this.iconPosition),"pkt-link--icon-right":!!this.iconName&&this.iconPosition==="right","pkt-link--external":this.external};return e.x`<a
|
|
2
2
|
class=${h.e(n)}
|
|
3
3
|
href=${this.href}
|
|
4
4
|
@click=${this.handleClick}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { P as f, x as k, E as h, n as i, a as m } from "./element-
|
|
1
|
+
import { P as f, x as k, E as h, n as i, a as m } from "./element-C7XjZtLU.js";
|
|
2
2
|
import { P as d } from "./pkt-slot-controller-Clbye6cM.js";
|
|
3
|
-
import { e as u, n as P } from "./ref-
|
|
4
|
-
import { e as y } from "./class-map-
|
|
5
|
-
import "./icon-
|
|
3
|
+
import { e as u, n as P } from "./ref-DbOSDQbk.js";
|
|
4
|
+
import { e as y } from "./class-map-DWtqmIRS.js";
|
|
5
|
+
import "./icon-BEUgV9Wo.js";
|
|
6
6
|
const g = "pkt-link", v = !0, _ = {
|
|
7
7
|
href: {
|
|
8
8
|
name: "URL",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const t=require("./element-
|
|
1
|
+
"use strict";const t=require("./element-CzFXQBoS.cjs"),k=require("./ref-2anvRHT4.cjs"),p=require("./pkt-slot-controller-Oc32unDk.cjs");require("./icon-BOKusjAA.cjs");var c=Object.defineProperty,h=Object.getOwnPropertyDescriptor,r=(s,n,i,l)=>{for(var e=l>1?void 0:l?h(n,i):n,o=s.length-1,a;o>=0;o--)(a=s[o])&&(e=(l?a(n,i,e):a(e))||e);return l&&e&&c(n,i,e),e};exports.PktLinkCard=class extends t.PktElement{constructor(){super(),this.defaultSlot=k.e(),this.title="",this.href="#",this.iconName="",this.external=!1,this.openInNewTab=!1,this.skin="normal",this.slotController=new p.PktSlotController(this,this.defaultSlot)}render(){const n=["pkt-linkcard",this.skin&&`pkt-linkcard--${this.skin}`].filter(Boolean).join(" "),i=["pkt-linkcard__title",this.external&&"pkt-link pkt-link--external"].filter(Boolean).join(" ");return t.x`
|
|
2
2
|
<a
|
|
3
3
|
href=${this.href}
|
|
4
4
|
class=${n}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { P as f, x as c, n, a as h } from "./element-
|
|
2
|
-
import { e as k, n as m } from "./ref-
|
|
1
|
+
import { P as f, x as c, n, a as h } from "./element-C7XjZtLU.js";
|
|
2
|
+
import { e as k, n as m } from "./ref-DbOSDQbk.js";
|
|
3
3
|
import { P as u } from "./pkt-slot-controller-Clbye6cM.js";
|
|
4
|
-
import "./icon-
|
|
4
|
+
import "./icon-BEUgV9Wo.js";
|
|
5
5
|
var _ = Object.defineProperty, d = Object.getOwnPropertyDescriptor, r = (l, i, s, o) => {
|
|
6
6
|
for (var e = o > 1 ? void 0 : o ? d(i, s) : i, a = l.length - 1, p; a >= 0; a--)
|
|
7
7
|
(p = l[a]) && (e = (o ? p(i, s, e) : p(e)) || e);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { P as u, x as d, E as y, n as o, a as c } from "./element-
|
|
2
|
-
import { e as h } from "./class-map-
|
|
3
|
-
import { r as m } from "./state-
|
|
4
|
-
import { e as f, n as v } from "./ref-
|
|
1
|
+
import { P as u, x as d, E as y, n as o, a as c } from "./element-C7XjZtLU.js";
|
|
2
|
+
import { e as h } from "./class-map-DWtqmIRS.js";
|
|
3
|
+
import { r as m } from "./state-CDQk0DFQ.js";
|
|
4
|
+
import { e as f, n as v } from "./ref-DbOSDQbk.js";
|
|
5
5
|
import { P as _ } from "./pkt-slot-controller-Clbye6cM.js";
|
|
6
|
-
import "./icon-
|
|
6
|
+
import "./icon-BEUgV9Wo.js";
|
|
7
7
|
var g = Object.defineProperty, L = Object.getOwnPropertyDescriptor, s = (e, a, l, r) => {
|
|
8
8
|
for (var i = r > 1 ? void 0 : r ? L(a, l) : a, p = e.length - 1, n; p >= 0; p--)
|
|
9
9
|
(n = e[p]) && (i = (r ? n(a, l, i) : n(i)) || i);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const e=require("./element-
|
|
1
|
+
"use strict";const e=require("./element-CzFXQBoS.cjs"),d=require("./class-map-Dj5mbCUg.cjs"),u=require("./state-HNj0_316.cjs"),p=require("./ref-2anvRHT4.cjs"),h=require("./pkt-slot-controller-Oc32unDk.cjs");require("./icon-BOKusjAA.cjs");var c=Object.defineProperty,y=Object.getOwnPropertyDescriptor,s=(o,t,r,i)=>{for(var a=i>1?void 0:i?y(t,r):t,l=o.length-1,n;l>=0;l--)(n=o[l])&&(a=(i?n(t,r,a):n(a))||a);return i&&a&&c(t,r,a),a};exports.PktLoader=class extends e.PktElement{constructor(){super(),this.defaultSlot=p.e(),this.delay=0,this.inline=!1,this.isLoading=!0,this.message=null,this.size="medium",this.variant="shapes",this._shouldDisplayLoader=!1,this.slotController=new h.PktSlotController(this,this.defaultSlot)}connectedCallback(){super.connectedCallback(),this._shouldDisplayLoader=this.delay===0,this.delay>0&&this.setupLoader()}updated(t){t.has("delay")&&this.setupLoader()}render(){const t=d.e({"pkt-loader":!0,[`pkt-loader--${this.inline?"inline":"box"}`]:!0,[`pkt-loader--${this.size}`]:!0}),r=d.e({"pkt-contents":!0,"pkt-hide":this.isLoading});return e.x`<div role="status" aria-live="polite" .aria-busy=${this.isLoading} class=${t}>
|
|
2
2
|
${this.isLoading&&this._shouldDisplayLoader?e.x`<div class="pkt-loader__spinner">
|
|
3
3
|
<pkt-icon
|
|
4
4
|
name=${this.getVariant(this.variant)}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const s=require("./element-
|
|
1
|
+
"use strict";const s=require("./element-CzFXQBoS.cjs"),b=require("./pkt-slot-controller-Oc32unDk.cjs"),c=require("./ref-2anvRHT4.cjs"),d=require("./class-map-Dj5mbCUg.cjs"),k=require("./state-HNj0_316.cjs");require("./icon-BOKusjAA.cjs");const u=require("./classutils-BwNK82ZQ.cjs"),m="pkt-messagebox",g=!0,h={onClose:{description:"React: Event som trigges når meldingsboksen lukkes"},"on-close":{description:"Vue: Event som trigges når meldingsboksen lukkes"}},f={title:{name:"Tittel",description:"Tittelen på meldingsboksen",type:"string"},skin:{name:"Utseende",description:"Velg farge på meldingsboksen",type:["beige","blue","red","green"],default:"beige"},compact:{name:"Kompakt",description:"Gjør meldingsboksen mindre",type:"boolean",default:!1},closable:{name:"Kan lukkes",description:"Viser lukkeknapp",type:"boolean",default:!1}},x={default:{description:"Innholdet i meldingsboksen"}},p={name:m,"css-class":"pkt-messagebox",isElement:g,events:h,props:f,slots:x};var v=Object.defineProperty,_=Object.getOwnPropertyDescriptor,o=(i,e,n,l)=>{for(var t=l>1?void 0:l?_(e,n):e,a=i.length-1,r;a>=0;a--)(r=i[a])&&(t=(l?r(e,n,t):r(t))||t);return l&&t&&v(e,n,t),t};exports.PktMessagebox=class extends s.PktElement{constructor(){super(),this.defaultSlot=c.e(),this.closable=p.props.closable.default,this.compact=p.props.compact.default,this.title="",this.skin=p.props.skin.default,this._isClosed=!1,this.close=e=>{this._isClosed=!0,this.dispatchEvent(new CustomEvent("close",{detail:{origin:e},bubbles:!0})),this.dispatchEvent(new CustomEvent("on-close",{detail:{origin:e},bubbles:!0}))},this.slotController=new b.PktSlotController(this,this.defaultSlot),this._isClosed=!1}updated(e){super.updated(e),e.has("_isClosed")&&u.updateClassAttribute(this,"pkt-hide",this._isClosed)}render(){const e={"pkt-messagebox":!0,"pkt-messagebox--compact":this.compact,[`pkt-messagebox--${this.skin}`]:this.skin,"pkt-messagebox--closable":this.closable,"pkt-hide":this._isClosed};return s.x`<div class=${d.e(e)}>
|
|
2
2
|
${this.closable?s.x`<div class="pkt-messagebox__close">
|
|
3
3
|
<button
|
|
4
4
|
@click=${this.close}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { P as b, x as c, E as m, n, a as u } from "./element-
|
|
1
|
+
import { P as b, x as c, E as m, n, a as u } from "./element-C7XjZtLU.js";
|
|
2
2
|
import { P as k } from "./pkt-slot-controller-Clbye6cM.js";
|
|
3
|
-
import { e as h, n as f } from "./ref-
|
|
4
|
-
import { e as g } from "./class-map-
|
|
5
|
-
import { r as v } from "./state-
|
|
6
|
-
import "./icon-
|
|
3
|
+
import { e as h, n as f } from "./ref-DbOSDQbk.js";
|
|
4
|
+
import { e as g } from "./class-map-DWtqmIRS.js";
|
|
5
|
+
import { r as v } from "./state-CDQk0DFQ.js";
|
|
6
|
+
import "./icon-BEUgV9Wo.js";
|
|
7
7
|
import { u as _ } from "./classutils-RQs1k6D9.js";
|
|
8
8
|
const x = "pkt-messagebox", y = !0, C = {
|
|
9
9
|
onClose: {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { e as c } from "./class-map-
|
|
2
|
-
import { P as f, x as p, E as k, n as r, a as g } from "./element-
|
|
3
|
-
import { r as v } from "./state-
|
|
1
|
+
import { e as c } from "./class-map-DWtqmIRS.js";
|
|
2
|
+
import { P as f, x as p, E as k, n as r, a as g } from "./element-C7XjZtLU.js";
|
|
3
|
+
import { r as v } from "./state-CDQk0DFQ.js";
|
|
4
4
|
import { P as b } from "./pkt-slot-controller-Clbye6cM.js";
|
|
5
|
-
import { e as m, n as h } from "./ref-
|
|
6
|
-
import "./icon-
|
|
5
|
+
import { e as m, n as h } from "./ref-DbOSDQbk.js";
|
|
6
|
+
import "./icon-BEUgV9Wo.js";
|
|
7
7
|
const y = "pkt-modal", _ = !0, C = {
|
|
8
8
|
"background-click": {
|
|
9
9
|
description: "Event som trigges når bakgrunnen trykkes på"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const d=require("./class-map-
|
|
1
|
+
"use strict";const d=require("./class-map-Dj5mbCUg.cjs"),s=require("./element-CzFXQBoS.cjs"),k=require("./state-HNj0_316.cjs"),m=require("./pkt-slot-controller-Oc32unDk.cjs"),r=require("./ref-2anvRHT4.cjs");require("./icon-BOKusjAA.cjs");const h="pkt-modal",g=!0,f={"background-click":{description:"Event som trigges når bakgrunnen trykkes på"},close:{description:"Event som trigges når meldingsboksen lukkes"}},v={headingText:{name:"Heading text",description:"Heading tekst på modalen",type:"string"},hideCloseButton:{name:"Gjem 'Lukk'-knapp",description:"Gjemmer lukkeknappen. Dersom denne er satt til true, vil ikke lukkeknappen vises, og dermed er det viktig at man tilbyr en annen måte som f.eks. en knapp for å lukke modalen på.",type:"boolean",default:!1},closeOnBackdropClick:{name:"Lukk modalen når bakgrunnen trykkes på",description:"Lukk modalen når bakgrunnen trykkes på",type:"boolean",default:!1},closeButtonSkin:{name:"Stil på lukkeknappen",description:"Stil på lukkeknappen",type:["blue","yellow-filled"],default:"blue"},size:{name:"Størrelse",description:"Størrelsen på modalen",type:["small","medium","large"],default:"medium"}},b={default:{description:"Innholdet i meldingen. Her tilbyr vi støtteklasser for å style 1-3 knapper i modalen."}},u={name:h,"css-class":"pkt-modal",isElements:g,events:f,props:v,slots:b};var y=Object.defineProperty,_=Object.getOwnPropertyDescriptor,l=(c,e,t,n)=>{for(var o=n>1?void 0:n?_(e,t):e,i=c.length-1,a;i>=0;i--)(a=c[i])&&(o=(n?a(e,t,o):a(o))||o);return n&&o&&y(e,t,o),o};exports.PktModal=class extends s.PktElement{constructor(){super(),this.headingText="",this.removePadding=!1,this.hideCloseButton=u.props.hideCloseButton.default,this.closeOnBackdropClick=u.props.closeOnBackdropClick.default,this.closeButtonSkin="blue",this.size=u.props.size.default,this.defaultSlot=r.e(),this.dialogRef=r.e(),this._isOpen=!1,this.close=(e,t=!1)=>{var o;if(!this._isOpen)return;this._isOpen=!1,document.body.classList.remove("pkt-modal--open");const n=document.activeElement;n&&!this.isElementInViewport(n)&&n.scrollIntoView({behavior:"smooth",block:"nearest"}),this.dispatchEvent(new CustomEvent("close",{detail:{origin:e},bubbles:!0,composed:!0})),t||(o=this.dialogRef.value)==null||o.close(),this.requestUpdate()},this.showModal=e=>{var n;this._isOpen=!0,(n=this.dialogRef.value)==null||n.showModal();const t=document.querySelector(".pkt-modal");requestAnimationFrame(()=>{var o;this.dialogRef.value&&((o=this.dialogRef.value)==null||o.focus())}),t&&document.body.classList.add("pkt-modal--open"),this.dispatchEvent(new CustomEvent("showModal",{detail:{origin:e},bubbles:!0,composed:!0})),this.requestUpdate()},this.slotController=new m.PktSlotController(this,this.defaultSlot),this._isOpen=!1}async connectedCallback(){super.connectedCallback(),document.addEventListener("keydown",this.handleKeyDown),document.addEventListener("click",this.handleBackdropClick)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("click",this.handleBackdropClick)}handleKeyDown(e){e.key==="Escape"&&this.close(e)}handleBackdropClick(e){var t;this.closeOnBackdropClick&&e.target===((t=this.dialogRef)==null?void 0:t.value)&&this.close(e)}isElementInViewport(e){const t=e.getBoundingClientRect();return t.top>=0&&t.left>=0&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&t.right<=(window.innerWidth||document.documentElement.clientWidth)}render(){const e={"pkt-modal":!0,"pkt-modal--removePadding":this.removePadding??!1,"pkt-modal--noHeadingText":this.headingText===""||this.headingText===void 0,[`pkt-modal--${this.size}`]:this.size!==void 0},t={"pkt-modal__headingText":!0,"pkt-txt-24":!0},n={"pkt-modal__content":!0,"pkt-txt-18-light":!0},o=this.closeButtonSkin==="blue",i={"pkt-modal__closeButton":!0,[`pkt-modal__closeButton--${this.closeButtonSkin}`]:!0},a={"pkt-btn":!0,[`pkt-btn--${o?"tertiary":"primary"}`]:!0,"pkt-btn--icon-only":!0,"pkt-btn--medium":!0};return s.x`
|
|
2
2
|
<dialog
|
|
3
3
|
class=${d.e(e)}
|
|
4
4
|
${r.n(this.dialogRef)}
|
package/dist/pkt-alert.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./alert-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./alert-BDxxRqgi.cjs"),t=e.PktAlert;Object.defineProperty(exports,"PktAlert",{enumerable:!0,get:()=>e.PktAlert});exports.default=t;
|
package/dist/pkt-alert.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./backlink-Dn4DfWVR.cjs"),t=e.PktBackLink;Object.defineProperty(exports,"PktBackLink",{enumerable:!0,get:()=>e.PktBackLink});exports.default=t;
|
package/dist/pkt-button.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("./button-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("./button-Beo3c7cx.cjs"),e=t.PktButton;Object.defineProperty(exports,"PktButton",{enumerable:!0,get:()=>t.PktButton});exports.default=e;
|
package/dist/pkt-button.js
CHANGED
package/dist/pkt-calendar.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./calendar-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./calendar-CxBo98iI.cjs"),t=e.PktCalendar;Object.defineProperty(exports,"PktCalendar",{enumerable:!0,get:()=>e.PktCalendar});exports.default=t;
|
package/dist/pkt-calendar.js
CHANGED
package/dist/pkt-card.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./card-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./card-BWslf2mu.cjs"),t=e.PktCard;Object.defineProperty(exports,"PktCard",{enumerable:!0,get:()=>e.PktCard});exports.default=t;
|
package/dist/pkt-card.js
CHANGED
package/dist/pkt-checkbox.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./checkbox-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./checkbox-9Zjy_NU7.cjs"),t=e.PktCheckbox;Object.defineProperty(exports,"PktCheckbox",{enumerable:!0,get:()=>e.PktCheckbox});exports.default=t;
|
package/dist/pkt-checkbox.js
CHANGED
package/dist/pkt-datepicker.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./datepicker-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./datepicker-BczZqaup.cjs"),t=e.PktDatepicker;Object.defineProperty(exports,"PktDatepicker",{enumerable:!0,get:()=>e.PktDatepicker});exports.default=t;
|