@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,31 +1,32 @@
|
|
|
1
|
-
import { Z as u,
|
|
1
|
+
import { Z as u, E as d } from "./element-C7XjZtLU.js";
|
|
2
|
+
import { i as p, t as g, e as Y } from "./directive-B76A7YXI.js";
|
|
2
3
|
/**
|
|
3
4
|
* @license
|
|
4
5
|
* Copyright 2020 Google LLC
|
|
5
6
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
6
7
|
*/
|
|
7
|
-
const { I:
|
|
8
|
-
var
|
|
8
|
+
const { I: m } = u, C = (t) => t.strings === void 0, f = () => document.createComment(""), I = (t, s, e) => {
|
|
9
|
+
var o;
|
|
9
10
|
const i = t._$AA.parentNode, n = s === void 0 ? t._$AB : s._$AA;
|
|
10
11
|
if (e === void 0) {
|
|
11
12
|
const c = i.insertBefore(f(), n), $ = i.insertBefore(f(), n);
|
|
12
|
-
e = new
|
|
13
|
+
e = new m(c, $, t, t.options);
|
|
13
14
|
} else {
|
|
14
15
|
const c = e._$AB.nextSibling, $ = e._$AM, l = $ !== t;
|
|
15
16
|
if (l) {
|
|
16
|
-
let
|
|
17
|
-
(
|
|
17
|
+
let h;
|
|
18
|
+
(o = e._$AQ) == null || o.call(e, t), e._$AM = t, e._$AP !== void 0 && (h = t._$AU) !== $._$AU && e._$AP(h);
|
|
18
19
|
}
|
|
19
20
|
if (c !== n || l) {
|
|
20
|
-
let
|
|
21
|
-
for (;
|
|
22
|
-
const v =
|
|
23
|
-
i.insertBefore(
|
|
21
|
+
let h = e._$AA;
|
|
22
|
+
for (; h !== c; ) {
|
|
23
|
+
const v = h.nextSibling;
|
|
24
|
+
i.insertBefore(h, n), h = v;
|
|
24
25
|
}
|
|
25
26
|
}
|
|
26
27
|
}
|
|
27
28
|
return e;
|
|
28
|
-
},
|
|
29
|
+
}, S = (t, s, e = t) => (t._$AI(s, e), t), M = {}, k = (t, s = M) => t._$AH = s, P = (t) => t._$AH, T = (t) => {
|
|
29
30
|
var i;
|
|
30
31
|
(i = t._$AP) == null || i.call(t, !1, !0);
|
|
31
32
|
let s = t._$AA;
|
|
@@ -60,19 +61,19 @@ const r = (t, s) => {
|
|
|
60
61
|
e.add(t), x(s);
|
|
61
62
|
}
|
|
62
63
|
};
|
|
63
|
-
function
|
|
64
|
+
function b(t) {
|
|
64
65
|
this._$AN !== void 0 ? (A(this), this._$AM = t, a(this)) : this._$AM = t;
|
|
65
66
|
}
|
|
66
67
|
function N(t, s = !1, e = 0) {
|
|
67
68
|
const i = this._$AH, n = this._$AN;
|
|
68
|
-
if (n !== void 0 && n.size !== 0) if (s) if (Array.isArray(i)) for (let
|
|
69
|
+
if (n !== void 0 && n.size !== 0) if (s) if (Array.isArray(i)) for (let o = e; o < i.length; o++) r(i[o], !1), A(i[o]);
|
|
69
70
|
else i != null && (r(i, !1), A(i));
|
|
70
71
|
else r(this, t);
|
|
71
72
|
}
|
|
72
73
|
const x = (t) => {
|
|
73
|
-
t.type ==
|
|
74
|
+
t.type == g.CHILD && (t._$AP ?? (t._$AP = N), t._$AQ ?? (t._$AQ = b));
|
|
74
75
|
};
|
|
75
|
-
class w extends
|
|
76
|
+
class w extends p {
|
|
76
77
|
constructor() {
|
|
77
78
|
super(...arguments), this._$AN = void 0;
|
|
78
79
|
}
|
|
@@ -84,7 +85,7 @@ class w extends g {
|
|
|
84
85
|
s !== this.isConnected && (this.isConnected = s, s ? (i = this.reconnected) == null || i.call(this) : (n = this.disconnected) == null || n.call(this)), e && (r(this, s), A(this));
|
|
85
86
|
}
|
|
86
87
|
setValue(s) {
|
|
87
|
-
if (
|
|
88
|
+
if (C(this._$Ct)) this._$Ct._$AI(s, this);
|
|
88
89
|
else {
|
|
89
90
|
const e = [...this._$Ct._$AH];
|
|
90
91
|
e[this._$Ci] = s, this._$Ct._$AI(e, this, 0);
|
|
@@ -100,10 +101,10 @@ class w extends g {
|
|
|
100
101
|
* Copyright 2020 Google LLC
|
|
101
102
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
102
103
|
*/
|
|
103
|
-
const
|
|
104
|
+
const U = () => new B();
|
|
104
105
|
class B {
|
|
105
106
|
}
|
|
106
|
-
const _ = /* @__PURE__ */ new WeakMap(),
|
|
107
|
+
const _ = /* @__PURE__ */ new WeakMap(), z = Y(class extends w {
|
|
107
108
|
render(t) {
|
|
108
109
|
return d;
|
|
109
110
|
}
|
|
@@ -131,12 +132,12 @@ const _ = /* @__PURE__ */ new WeakMap(), U = Y(class extends w {
|
|
|
131
132
|
}
|
|
132
133
|
});
|
|
133
134
|
export {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
135
|
+
T as M,
|
|
136
|
+
U as e,
|
|
137
|
+
C as f,
|
|
138
|
+
k as m,
|
|
139
|
+
z as n,
|
|
140
|
+
P as p,
|
|
141
|
+
I as r,
|
|
142
|
+
S as v
|
|
142
143
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { x as p, n as b, a as f } from "./element-
|
|
2
|
-
import { r as v } from "./state-
|
|
3
|
-
import { e as u, n as d } from "./ref-
|
|
4
|
-
import { o as r } from "./if-defined-
|
|
5
|
-
import { P as $ } from "./input-element-
|
|
1
|
+
import { x as p, n as b, a as f } from "./element-C7XjZtLU.js";
|
|
2
|
+
import { r as v } from "./state-CDQk0DFQ.js";
|
|
3
|
+
import { e as u, n as d } from "./ref-DbOSDQbk.js";
|
|
4
|
+
import { o as r } from "./if-defined-eRX4e5zO.js";
|
|
5
|
+
import { P as $ } from "./input-element-BK8UkQli.js";
|
|
6
6
|
import { i as c, P as m } from "./pkt-slot-controller-Clbye6cM.js";
|
|
7
|
-
import "./input-wrapper-
|
|
7
|
+
import "./input-wrapper-DaZZq8c0.js";
|
|
8
8
|
class g {
|
|
9
9
|
constructor(t) {
|
|
10
10
|
this.nodes = [], this.options = [], this.host = t, this.host.addController(this), this.nodes = [], this.options = [], this.observer = new MutationObserver((e) => this.handleMutations(e));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const l=require("./element-
|
|
1
|
+
"use strict";const l=require("./element-CzFXQBoS.cjs"),d=require("./state-HNj0_316.cjs"),a=require("./ref-2anvRHT4.cjs"),o=require("./if-defined-CpIkv1A4.cjs"),c=require("./input-element-Dtyuf6s8.cjs"),u=require("./pkt-slot-controller-Oc32unDk.cjs");require("./input-wrapper-Bo2_t6pA.cjs");class b{constructor(t){this.nodes=[],this.options=[],this.host=t,this.host.addController(this),this.nodes=[],this.options=[],this.observer=new MutationObserver(e=>this.handleMutations(e))}hostConnected(){Array.from(this.host.childNodes).forEach(t=>{(t.nodeName==="OPTION"||t.nodeName==="DATA")&&this.addNode(t)}),this.observer.observe(this.host,{childList:!0})}hostDisconnected(){this.observer.disconnect()}addNode(t){(t.nodeName==="OPTION"||t.nodeName==="DATA")&&(t.setAttribute("class","pkt-hide"),t.setAttribute("aria-hidden","true"),t.setAttribute("data-skip","true"),this.nodes.push(t))}createOptions(){this.options=this.nodes.map(t=>({value:t.getAttribute("value")||t.textContent||"",label:t.textContent||t.getAttribute("value")||"",selected:!!t.getAttribute("selected"),disabled:!!t.getAttribute("disabled")})),this.host.setAttribute("options",JSON.stringify(this.options))}handleMutations(t){let e=!1;t.forEach(s=>{s.type==="childList"&&(s.addedNodes.forEach(i=>{u.isOptionElement(i)&&(this.addNode(i),e=!0)}),s.removedNodes.forEach(i=>{u.isOptionElement(i)&&(this.nodes=this.nodes.filter(r=>r!==i),e=!0)}))}),e&&this.createOptions()}}var v=Object.defineProperty,f=Object.getOwnPropertyDescriptor,h=(n,t,e,s)=>{for(var i=s>1?void 0:s?f(t,e):t,r=n.length-1,p;r>=0;r--)(p=n[r])&&(i=(s?p(t,e,i):p(i))||i);return s&&i&&v(t,e,i),i};exports.PktSelect=class extends c.PktInputElement{constructor(){super(),this.inputRef=a.e(),this.helptextSlot=a.e(),this.options=[],this.value="",this._options=[],this.optionsController=new b(this),this.slotController=new u.PktSlotController(this,this.helptextSlot),this.slotController.skipOptions=!0}connectedCallback(){super.connectedCallback();const t=this.options.length>0,e=this.optionsController.nodes.length&&this.optionsController.nodes.length>0;!t&&e?this.optionsController.nodes.forEach(s=>{const i={value:s.getAttribute("value")||s.textContent||"",label:s.textContent||s.getAttribute("value")||"",disabled:!!s.getAttribute("disabled")};s.getAttribute("selected")&&!this.value&&(this.value=i.value),this._options.push(i)}):this._options=this.options}attributeChangedCallback(t,e,s){t==="options"&&(this._options=s?JSON.parse(s):[]),t==="value"&&this.value!==e&&this.valueChanged(s,e),super.attributeChangedCallback(t,e,s)}updated(t){var e;super.updated(t),t.has("value")&&(this.counterCurrent=((e=this.value)==null?void 0:e.length)||0,this.valueChanged(this.value,t.get("value"))),t.has("id")&&!this.name&&this.id&&(this.name=this.id)}firstUpdated(t){super.firstUpdated(t),this.options.length&&(this._options=this.options)}render(){const t=`pkt-input ${this.fullwidth?"pkt-input--fullwidth":""}`;return l.x`
|
|
2
2
|
<pkt-input-wrapper
|
|
3
3
|
?counter=${this.counter}
|
|
4
4
|
?disabled=${this.disabled}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { e as h } from "./class-map-
|
|
2
|
-
import { P as d, x as p, n as a, a as m } from "./element-
|
|
3
|
-
import { r as y } from "./state-
|
|
1
|
+
import { e as h } from "./class-map-DWtqmIRS.js";
|
|
2
|
+
import { P as d, x as p, n as a, a as m } from "./element-C7XjZtLU.js";
|
|
3
|
+
import { r as y } from "./state-CDQk0DFQ.js";
|
|
4
4
|
import { P as g } from "./pkt-slot-controller-Clbye6cM.js";
|
|
5
|
-
import { e as k, n as f } from "./ref-
|
|
6
|
-
import "./icon-
|
|
5
|
+
import { e as k, n as f } from "./ref-DbOSDQbk.js";
|
|
6
|
+
import "./icon-BEUgV9Wo.js";
|
|
7
7
|
const b = "pkt-tag", $ = !0, S = {
|
|
8
8
|
closeTag: {
|
|
9
9
|
type: "boolean",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const u=require("./class-map-
|
|
1
|
+
"use strict";const u=require("./class-map-Dj5mbCUg.cjs"),t=require("./element-CzFXQBoS.cjs"),h=require("./state-HNj0_316.cjs"),g=require("./pkt-slot-controller-Oc32unDk.cjs"),c=require("./ref-2anvRHT4.cjs");require("./icon-BOKusjAA.cjs");const k="pkt-tag",d=!0,f={closeTag:{type:"boolean",required:!1,default:!1},size:{required:!1,default:"medium",type:["small","medium","large"]},iconName:{type:"icon",required:!1},skin:{required:!1,default:"blue",type:["blue","blue-light","blue-dark","green","red","beige","yellow","gray"]},textStyle:{required:!1,default:"normal-text",type:["thin-text","normal-text"]},type:{required:!1,default:"button",type:["button","submit","reset"]},ariaLabel:{type:"string",required:!1,default:"Lukk"}},y={default:{description:"Teksten til tag"}},l={name:k,"css-class":"pkt-tag",isElement:d,props:f,slots:y};var b=Object.defineProperty,m=Object.getOwnPropertyDescriptor,s=(o,e,a,r)=>{for(var i=r>1?void 0:r?m(e,a):e,n=o.length-1,p;n>=0;n--)(p=o[n])&&(i=(r?p(e,a,i):p(i))||i);return r&&i&&b(e,a,i),i};exports.PktTag=class extends t.PktElement{constructor(){super(),this.defaultSlot=c.e(),this.closeTag=l.props.closeTag.default,this.size=l.props.size.default,this.skin=l.props.skin.default,this.textStyle=null,this.iconName=void 0,this.type=l.props.type.default,this.ariaLabel=l.props.ariaLabel.default,this._isClosed=!1,this.close=e=>{this._isClosed=!0,this.dispatchEvent(new CustomEvent("close",{detail:{origin:e},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("on-close",{detail:{origin:e},bubbles:!0,composed:!0}))},this.slotController=new g.PktSlotController(this,this.defaultSlot),this._isClosed=!1}render(){const e={"pkt-tag":!0,[`pkt-tag--${this.size}`]:!!this.size,[`pkt-tag--${this.skin}`]:!!this.skin,[`pkt-tag--${this.textStyle}`]:!!this.textStyle},a={"pkt-tag":!0,"pkt-btn":!0,"pkt-btn--tertiary":!0,[`pkt-tag--${this.textStyle}`]:!!this.textStyle,[`pkt-tag--${this.size}`]:!!this.size,[`pkt-tag--${this.skin}`]:!!this.skin,"pkt-btn--icons-right-and-left":this.closeTag&&!!this.iconName,"pkt-hide":this._isClosed};return this.closeTag?t.x`
|
|
2
2
|
<button
|
|
3
3
|
class=${u.e(a)}
|
|
4
4
|
type=${this.type}
|
|
@@ -1,34 +1,35 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { o as u } from "./if-defined-
|
|
3
|
-
import { r as
|
|
4
|
-
import { f as
|
|
5
|
-
import { e as
|
|
6
|
-
import {
|
|
1
|
+
import { T as l, E as $, x as f, n as d, a as g } from "./element-C7XjZtLU.js";
|
|
2
|
+
import { o as u } from "./if-defined-eRX4e5zO.js";
|
|
3
|
+
import { r as x } from "./state-CDQk0DFQ.js";
|
|
4
|
+
import { f as v, m as b, e as c, n as m } from "./ref-DbOSDQbk.js";
|
|
5
|
+
import { e as T } from "./class-map-DWtqmIRS.js";
|
|
6
|
+
import { e as y, i as w, t as a } from "./directive-B76A7YXI.js";
|
|
7
|
+
import { P as C } from "./input-element-BK8UkQli.js";
|
|
7
8
|
import { P as E } from "./pkt-slot-controller-Clbye6cM.js";
|
|
8
|
-
import "./input-wrapper-
|
|
9
|
-
import "./icon-
|
|
9
|
+
import "./input-wrapper-DaZZq8c0.js";
|
|
10
|
+
import "./icon-BEUgV9Wo.js";
|
|
10
11
|
/**
|
|
11
12
|
* @license
|
|
12
13
|
* Copyright 2020 Google LLC
|
|
13
14
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
14
15
|
*/
|
|
15
|
-
const P =
|
|
16
|
+
const P = y(class extends w {
|
|
16
17
|
constructor(t) {
|
|
17
18
|
if (super(t), t.type !== a.PROPERTY && t.type !== a.ATTRIBUTE && t.type !== a.BOOLEAN_ATTRIBUTE) throw Error("The `live` directive is not allowed on child or event bindings");
|
|
18
|
-
if (!
|
|
19
|
+
if (!v(t)) throw Error("`live` bindings can only contain a single expression");
|
|
19
20
|
}
|
|
20
21
|
render(t) {
|
|
21
22
|
return t;
|
|
22
23
|
}
|
|
23
24
|
update(t, [r]) {
|
|
24
|
-
if (r === l || r ===
|
|
25
|
+
if (r === l || r === $) return r;
|
|
25
26
|
const e = t.element, i = t.name;
|
|
26
27
|
if (t.type === a.PROPERTY) {
|
|
27
28
|
if (r === e[i]) return l;
|
|
28
29
|
} else if (t.type === a.BOOLEAN_ATTRIBUTE) {
|
|
29
30
|
if (!!r === e.hasAttribute(i)) return l;
|
|
30
31
|
} else if (t.type === a.ATTRIBUTE && e.getAttribute(i) === r + "") return l;
|
|
31
|
-
return
|
|
32
|
+
return b(t), r;
|
|
32
33
|
}
|
|
33
34
|
});
|
|
34
35
|
var B = Object.defineProperty, I = Object.getOwnPropertyDescriptor, n = (t, r, e, i) => {
|
|
@@ -48,12 +49,12 @@ let o = class extends C {
|
|
|
48
49
|
super.updated(t), t.has("value") && (this.counterCurrent = ((r = this.value) == null ? void 0 : r.length) || 0, this.valueChanged(this.value, t.get("value"))), t.has("id") && !this.name && this.id && (this.name = this.id);
|
|
49
50
|
}
|
|
50
51
|
render() {
|
|
51
|
-
const t =
|
|
52
|
+
const t = T({
|
|
52
53
|
"pkt-input": !0,
|
|
53
54
|
"pkt-input--fullwidth": this.fullwidth,
|
|
54
55
|
"pkt-input--counter-error": this.counter && this.counterMaxLength && this.value.length && this.value.length > this.counterMaxLength
|
|
55
56
|
}), r = this.ariaLabelledby || `${this.id}-input-label`;
|
|
56
|
-
return
|
|
57
|
+
return f`<pkt-input-wrapper
|
|
57
58
|
label=${this.label}
|
|
58
59
|
?counter=${this.counter}
|
|
59
60
|
?disabled=${this.disabled}
|
|
@@ -118,10 +119,10 @@ n([
|
|
|
118
119
|
d({ type: Number })
|
|
119
120
|
], o.prototype, "rows", 2);
|
|
120
121
|
n([
|
|
121
|
-
|
|
122
|
+
x()
|
|
122
123
|
], o.prototype, "counterCurrent", 2);
|
|
123
124
|
o = n([
|
|
124
|
-
|
|
125
|
+
g("pkt-textarea")
|
|
125
126
|
], o);
|
|
126
127
|
export {
|
|
127
128
|
o as P
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";const s=require("./element-CzFXQBoS.cjs"),p=require("./if-defined-CpIkv1A4.cjs"),d=require("./state-HNj0_316.cjs"),o=require("./ref-2anvRHT4.cjs"),c=require("./class-map-Dj5mbCUg.cjs"),a=require("./directive-C_VV3qwo.cjs"),$=require("./input-element-Dtyuf6s8.cjs"),x=require("./pkt-slot-controller-Oc32unDk.cjs");require("./input-wrapper-Bo2_t6pA.cjs");require("./icon-BOKusjAA.cjs");/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2020 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
+
*/const T=a.e(class extends a.i{constructor(r){if(super(r),r.type!==a.t.PROPERTY&&r.type!==a.t.ATTRIBUTE&&r.type!==a.t.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!o.f(r))throw Error("`live` bindings can only contain a single expression")}render(r){return r}update(r,[e]){if(e===s.T||e===s.E)return e;const i=r.element,t=r.name;if(r.type===a.t.PROPERTY){if(e===i[t])return s.T}else if(r.type===a.t.BOOLEAN_ATTRIBUTE){if(!!e===i.hasAttribute(t))return s.T}else if(r.type===a.t.ATTRIBUTE&&i.getAttribute(t)===e+"")return s.T;return o.m(r),e}});var g=Object.defineProperty,f=Object.getOwnPropertyDescriptor,l=(r,e,i,t)=>{for(var n=t>1?void 0:t?f(e,i):e,u=r.length-1,h;u>=0;u--)(h=r[u])&&(n=(t?h(e,i,n):h(n))||n);return t&&n&&g(e,i,n),n};exports.PktTextarea=class extends $.PktInputElement{constructor(){super(),this.inputRef=o.e(),this.helptextSlot=o.e(),this.value="",this.autocomplete="off",this.rows=null,this.counterCurrent=0,this.slotController=new x.PktSlotController(this,this.helptextSlot)}attributeChangedCallback(e,i,t){e==="value"&&this.value!==i&&(this.counterCurrent=t?t.length:0,this.valueChanged(t,i)),super.attributeChangedCallback(e,i,t)}updated(e){var i;super.updated(e),e.has("value")&&(this.counterCurrent=((i=this.value)==null?void 0:i.length)||0,this.valueChanged(this.value,e.get("value"))),e.has("id")&&!this.name&&this.id&&(this.name=this.id)}render(){const e=c.e({"pkt-input":!0,"pkt-input--fullwidth":this.fullwidth,"pkt-input--counter-error":this.counter&&this.counterMaxLength&&this.value.length&&this.value.length>this.counterMaxLength}),i=this.ariaLabelledby||`${this.id}-input-label`;return s.x`<pkt-input-wrapper
|
|
6
|
+
label=${this.label}
|
|
7
|
+
?counter=${this.counter}
|
|
8
|
+
?disabled=${this.disabled}
|
|
9
|
+
?hasError=${this.hasError}
|
|
10
|
+
?inline=${this.inline}
|
|
11
|
+
?optionalTag=${this.optionalTag}
|
|
12
|
+
?required=${this.required}
|
|
13
|
+
?requiredTag=${this.requiredTag}
|
|
14
|
+
?useWrapper=${this.useWrapper}
|
|
15
|
+
.ariaDescribedBy=${this.ariaDescribedBy}
|
|
16
|
+
.counterCurrent=${this.counterCurrent}
|
|
17
|
+
.counterMaxLength=${this.counterMaxLength}
|
|
18
|
+
.errorMessage=${this.errorMessage}
|
|
19
|
+
.forId="${this.id+"-input"}"
|
|
20
|
+
.helptext=${this.helptext}
|
|
21
|
+
.helptextDropdown=${this.helptextDropdown}
|
|
22
|
+
.helptextDropdownButton=${this.helptextDropdownButton}
|
|
23
|
+
.optionalText=${this.optionalText}
|
|
24
|
+
.requiredText=${this.requiredText}
|
|
25
|
+
class="pkt-textarea"
|
|
26
|
+
>
|
|
27
|
+
<div class="pkt-contents" ${o.n(this.helptextSlot)} name="helptext" slot="helptext"></div>
|
|
28
|
+
<textarea
|
|
29
|
+
${o.n(this.inputRef)}
|
|
30
|
+
class=${e}
|
|
31
|
+
id=${this.id+"-input"}
|
|
32
|
+
name=${(this.name||this.id)+"-input"}
|
|
33
|
+
placeholder=${p.o(this.placeholder)}
|
|
34
|
+
.value=${T(this.value)}
|
|
35
|
+
minlength=${p.o(this.minlength)}
|
|
36
|
+
maxlength=${p.o(this.maxlength)}
|
|
37
|
+
?readonly=${this.readonly}
|
|
38
|
+
autocomplete=${this.autocomplete}
|
|
39
|
+
aria-labelledby=${i}
|
|
40
|
+
aria-invalid=${this.hasError}
|
|
41
|
+
aria-errormessage=${`${this.id}-error`}
|
|
42
|
+
rows=${this.rows}
|
|
43
|
+
?disabled=${this.disabled}
|
|
44
|
+
@input=${t=>{this.value=t.target.value,this.onInput(),t.stopImmediatePropagation()}}
|
|
45
|
+
@change=${t=>{t.stopImmediatePropagation()}}
|
|
46
|
+
@focus=${t=>{this.onFocus(),t.stopImmediatePropagation()}}
|
|
47
|
+
@blur=${t=>{this.value=t.target.value,this.onBlur(),t.stopImmediatePropagation()}}
|
|
48
|
+
></textarea>
|
|
49
|
+
</pkt-input-wrapper>`}};l([s.n({type:String,reflect:!0})],exports.PktTextarea.prototype,"value",2);l([s.n({type:String})],exports.PktTextarea.prototype,"autocomplete",2);l([s.n({type:Number})],exports.PktTextarea.prototype,"rows",2);l([d.r()],exports.PktTextarea.prototype,"counterCurrent",2);exports.PktTextarea=l([s.t("pkt-textarea")],exports.PktTextarea);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const t=require("./element-
|
|
1
|
+
"use strict";const t=require("./element-CzFXQBoS.cjs"),u=require("./if-defined-CpIkv1A4.cjs"),l=require("./state-HNj0_316.cjs"),p=require("./ref-2anvRHT4.cjs"),c=require("./class-map-Dj5mbCUg.cjs"),x=require("./input-element-Dtyuf6s8.cjs"),d=require("./pkt-slot-controller-Oc32unDk.cjs");require("./input-wrapper-Bo2_t6pA.cjs");require("./icon-BOKusjAA.cjs");var $=Object.defineProperty,g=Object.getOwnPropertyDescriptor,r=(o,i,n,s)=>{for(var e=s>1?void 0:s?g(i,n):i,a=o.length-1,h;a>=0;a--)(h=o[a])&&(e=(s?h(i,n,e):h(e))||e);return s&&e&&$(i,n,e),e};exports.PktTextinput=class extends x.PktInputElement{constructor(){super(),this.inputRef=p.e(),this.helptextSlot=p.e(),this.value="",this.type="text",this.size=null,this.autocomplete="off",this.iconNameRight=null,this.prefix=null,this.suffix=null,this.omitSearchIcon=!1,this.counterCurrent=0,this.slotController=new d.PktSlotController(this,this.helptextSlot)}attributeChangedCallback(i,n,s){i==="value"&&this.value!==n&&(this.counterCurrent=s?s.length:0,this.valueChanged(s,n)),super.attributeChangedCallback(i,n,s)}updated(i){var n;super.updated(i),i.has("value")&&(this.counterCurrent=((n=this.value)==null?void 0:n.length)||0,this.valueChanged(this.value,i.get("value"))),i.has("id")&&!this.name&&this.id&&(this.name=this.id)}render(){const i=this.type==="search"&&!this.iconNameRight&&!this.omitSearchIcon,n=c.e({"pkt-input":!0,"pkt-input--fullwidth":this.fullwidth,"pkt-input--counter-error":this.counter&&this.counterMaxLength&&this.value.length&&this.value.length>this.counterMaxLength}),s=this.ariaLabelledby||`${this.id}-input-label`;return t.x`
|
|
2
2
|
<pkt-input-wrapper
|
|
3
3
|
label="${this.label}"
|
|
4
4
|
?counter=${this.counter}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { x as p, E as h, n as o, a as $ } from "./element-
|
|
2
|
-
import { o as c } from "./if-defined-
|
|
3
|
-
import { r as f } from "./state-
|
|
4
|
-
import { e as d, n as m } from "./ref-
|
|
5
|
-
import { e as g } from "./class-map-
|
|
6
|
-
import { P as x } from "./input-element-
|
|
1
|
+
import { x as p, E as h, n as o, a as $ } from "./element-C7XjZtLU.js";
|
|
2
|
+
import { o as c } from "./if-defined-eRX4e5zO.js";
|
|
3
|
+
import { r as f } from "./state-CDQk0DFQ.js";
|
|
4
|
+
import { e as d, n as m } from "./ref-DbOSDQbk.js";
|
|
5
|
+
import { e as g } from "./class-map-DWtqmIRS.js";
|
|
6
|
+
import { P as x } from "./input-element-BK8UkQli.js";
|
|
7
7
|
import { P as y } from "./pkt-slot-controller-Clbye6cM.js";
|
|
8
|
-
import "./input-wrapper-
|
|
9
|
-
import "./icon-
|
|
8
|
+
import "./input-wrapper-DaZZq8c0.js";
|
|
9
|
+
import "./icon-BEUgV9Wo.js";
|
|
10
10
|
var v = Object.defineProperty, b = Object.getOwnPropertyDescriptor, n = (i, e, r, t) => {
|
|
11
11
|
for (var a = t > 1 ? void 0 : t ? b(e, r) : e, l = i.length - 1, u; l >= 0; l--)
|
|
12
12
|
(u = i[l]) && (a = (t ? u(e, r, a) : u(a)) || a);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oslokommune/punkt-elements",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.31.0",
|
|
4
4
|
"description": "Komponentbiblioteket til Punkt, et designsystem laget av Oslo Origo",
|
|
5
5
|
"homepage": "https://punkt.oslo.kommune.no",
|
|
6
6
|
"author": "Team Designsystem, Oslo Origo",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@oslokommune/punkt-assets": "^12.30.1",
|
|
33
|
-
"@oslokommune/punkt-css": "^12.
|
|
33
|
+
"@oslokommune/punkt-css": "^12.31.0",
|
|
34
34
|
"sass": "^1.78.0",
|
|
35
35
|
"typescript": "^5.6.2",
|
|
36
36
|
"vite": "^5.4.4",
|
|
@@ -57,5 +57,5 @@
|
|
|
57
57
|
"url": "https://github.com/oslokommune/punkt/issues"
|
|
58
58
|
},
|
|
59
59
|
"license": "MIT",
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "95a46dc5e5fcbab72e2c303c26127a95297c3e83"
|
|
61
61
|
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { PktElement } from '@/base-elements/element'
|
|
2
|
+
import { html } from 'lit'
|
|
3
|
+
import { property, customElement } from 'lit/decorators.js'
|
|
4
|
+
import { ifDefined } from 'lit/directives/if-defined.js'
|
|
5
|
+
|
|
6
|
+
export interface IPktBackLink {
|
|
7
|
+
href?: string
|
|
8
|
+
text?: string
|
|
9
|
+
ariaLabel?: string
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
@customElement('pkt-backlink')
|
|
13
|
+
export class PktBackLink extends PktElement<IPktBackLink> implements IPktBackLink {
|
|
14
|
+
// Properties
|
|
15
|
+
|
|
16
|
+
@property({ type: String, reflect: true }) href: string = ''
|
|
17
|
+
@property({ type: String, reflect: true }) text: string = 'Forsiden'
|
|
18
|
+
@property({ type: String, reflect: true }) ariaLabel: string = ''
|
|
19
|
+
|
|
20
|
+
// Lifecycle
|
|
21
|
+
|
|
22
|
+
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null) {
|
|
23
|
+
if (name === 'arialabel') {
|
|
24
|
+
this.removeAttribute('arialabel')
|
|
25
|
+
}
|
|
26
|
+
if (name === 'href') {
|
|
27
|
+
this.removeAttribute('href')
|
|
28
|
+
}
|
|
29
|
+
if (name === 'text') {
|
|
30
|
+
this.removeAttribute('text')
|
|
31
|
+
}
|
|
32
|
+
super.attributeChangedCallback(name, oldValue, newValue)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
render() {
|
|
36
|
+
return html`<nav
|
|
37
|
+
class="pkt-back-link"
|
|
38
|
+
aria-label=${this.ariaLabel || 'Gå tilbake til forrige side'}
|
|
39
|
+
>
|
|
40
|
+
<a href=${ifDefined(this.href || '/')} class="pkt-link pkt-link--icon-left"
|
|
41
|
+
><pkt-icon
|
|
42
|
+
class="pkt-back-link__icon pkt-icon pkt-link__icon"
|
|
43
|
+
name="chevron-thin-left"
|
|
44
|
+
aria-hidden="true"
|
|
45
|
+
></pkt-icon
|
|
46
|
+
><span class="pkt-back-link__text">${this.text}</span></a
|
|
47
|
+
>
|
|
48
|
+
</nav>`
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export default PktBackLink
|
|
@@ -16,7 +16,7 @@ export class PktCheckbox extends PktInputElement {
|
|
|
16
16
|
@property({ type: Boolean }) isSwitch: boolean = false
|
|
17
17
|
@property({ type: String }) labelPosition: 'right' | 'left' = 'right'
|
|
18
18
|
@property({ type: Boolean }) hideLabel: boolean = false
|
|
19
|
-
@property({ type: Boolean, reflect: true }) checked: boolean | string =
|
|
19
|
+
@property({ type: Boolean, reflect: true }) checked: boolean | string | null = null
|
|
20
20
|
@property({ type: String, reflect: true }) type: string = 'checkbox'
|
|
21
21
|
|
|
22
22
|
connectedCallback() {
|
package/src/components/index.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// Export components
|
|
2
2
|
export { PktAlert } from '@/components/alert'
|
|
3
|
+
export { PktBackLink } from '@/components/backlink'
|
|
3
4
|
export { PktButton } from '@/components/button'
|
|
4
5
|
export { PktCalendar } from '@/components/calendar'
|
|
5
6
|
export { PktCard } from '@/components/card'
|
|
@@ -49,4 +50,6 @@ export type { TTagSkin, TTagType } from '@/components/tag'
|
|
|
49
50
|
|
|
50
51
|
export type { TSelectOption } from '@/components/select'
|
|
51
52
|
|
|
53
|
+
export type { IPktBackLink } from '@/components/backlink'
|
|
54
|
+
|
|
52
55
|
export type { IPktLoader, TPktLoaderVariant } from '@/components/loader'
|
|
@@ -13,7 +13,7 @@ export class PktRadioButton extends PktInputElement {
|
|
|
13
13
|
@property({ type: String }) checkHelptext: string | null = null
|
|
14
14
|
@property({ type: Boolean }) defaultChecked: boolean = false
|
|
15
15
|
@property({ type: Boolean }) hasTile: boolean = false
|
|
16
|
-
@property({ type: Boolean, reflect: true }) checked: boolean | string =
|
|
16
|
+
@property({ type: Boolean, reflect: true }) checked: boolean | string | null = null
|
|
17
17
|
@property({ type: String, reflect: true }) type: string = 'radio'
|
|
18
18
|
|
|
19
19
|
@state() _checked: boolean = false
|
|
@@ -33,6 +33,16 @@ export class PktRadioButton extends PktInputElement {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
updated(changedProperties: PropertyValues) {
|
|
36
|
+
if (changedProperties.has('checked') && this.checked !== null) {
|
|
37
|
+
this._checked = this.checked === '' || this.checked === 'true' || this.checked === true
|
|
38
|
+
const oldChecked =
|
|
39
|
+
changedProperties.get('checked') === '' ||
|
|
40
|
+
changedProperties.get('checked') === 'true' ||
|
|
41
|
+
changedProperties.get('checked') === true
|
|
42
|
+
if (oldChecked !== this._checked) {
|
|
43
|
+
this.toggleChecked()
|
|
44
|
+
}
|
|
45
|
+
}
|
|
36
46
|
super.updated(changedProperties)
|
|
37
47
|
}
|
|
38
48
|
|
|
@@ -76,8 +86,8 @@ export class PktRadioButton extends PktInputElement {
|
|
|
76
86
|
`
|
|
77
87
|
}
|
|
78
88
|
|
|
79
|
-
private toggleChecked(e: Event) {
|
|
80
|
-
e.stopImmediatePropagation()
|
|
89
|
+
private toggleChecked(e: Event | null = null) {
|
|
90
|
+
if (e) e.stopImmediatePropagation()
|
|
81
91
|
this.touched = true
|
|
82
92
|
if (this.inputRef.value) {
|
|
83
93
|
this._checked = this.inputRef.value.matches(':checked')
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
"use strict";const n=require("./element-r-PeQ419.cjs");/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2018 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
-
*/const a=n.e(class extends n.i{constructor(s){var e;if(super(s),s.type!==n.t$1.ATTRIBUTE||s.name!=="class"||((e=s.strings)==null?void 0:e.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(s){return" "+Object.keys(s).filter(e=>s[e]).join(" ")+" "}update(s,[e]){var i,o;if(this.st===void 0){this.st=new Set,s.strings!==void 0&&(this.nt=new Set(s.strings.join(" ").split(/\s/).filter(t=>t!=="")));for(const t in e)e[t]&&!((i=this.nt)!=null&&i.has(t))&&this.st.add(t);return this.render(e)}const r=s.element.classList;for(const t of this.st)t in e||(r.remove(t),this.st.delete(t));for(const t in e){const h=!!e[t];h===this.st.has(t)||(o=this.nt)!=null&&o.has(t)||(h?(r.add(t),this.st.add(t)):(r.remove(t),this.st.delete(t)))}return n.T}});exports.e=a;
|