@oslokommune/punkt-elements 12.26.2 → 12.27.1
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-MKb7NX3r.js → alert-BvN80UkI.js} +1 -1
- package/dist/{alert-3DZNN48_.cjs → alert-uNzcOJR9.cjs} +1 -1
- package/dist/alert.d.ts +7 -0
- package/dist/calendar.d.ts +7 -0
- package/dist/{card-CtipjQuP.cjs → card-BaxqXP-k.cjs} +1 -1
- package/dist/{card-ClWsCQfD.js → card-Br6A74Q1.js} +2 -2
- package/dist/card.d.ts +7 -0
- package/dist/{datepicker-B2W8ra1B.cjs → datepicker-BC0e34ws.cjs} +16 -15
- package/dist/{datepicker-BVI4szRk.js → datepicker-ONV4HuJt.js} +84 -82
- package/dist/datepicker.d.ts +7 -0
- package/dist/helptext-DHfBEO42.js +78 -0
- package/dist/helptext-xUdEGuNQ.cjs +24 -0
- package/dist/helptext.d.ts +7 -0
- package/dist/icon.d.ts +7 -0
- package/dist/index.d.ts +29 -8
- package/dist/input-wrapper-DeCY6nta.cjs +50 -0
- package/dist/input-wrapper-Df18_PvD.js +172 -0
- package/dist/input-wrapper.d.ts +7 -0
- package/dist/{link-B3PDtnXT.js → link-0N9wG5l8.js} +1 -1
- package/dist/{link-BnL83t0x.cjs → link-I_LKEBVK.cjs} +1 -1
- package/dist/link.d.ts +7 -0
- package/dist/{linkcard-C4q7HCwY.js → linkcard-BJeRbpq_.js} +1 -1
- package/dist/{linkcard-RyOjvpmF.cjs → linkcard-ClXGVwdJ.cjs} +1 -1
- package/dist/linkcard.d.ts +7 -0
- package/dist/{messagebox-BDfhozc3.js → messagebox-C5M56R8f.js} +1 -1
- package/dist/{messagebox-CuM1y2P_.cjs → messagebox-CC3j63Wp.cjs} +1 -1
- package/dist/messagebox.d.ts +7 -0
- package/dist/{modal-gLMGJSSY.cjs → modal-BkchlKkL.cjs} +1 -1
- package/dist/{modal-CYv8Qk0Y.js → modal-PKDnp91S.js} +1 -1
- package/dist/modal.d.ts +7 -0
- package/dist/pkt-alert.cjs +1 -1
- package/dist/pkt-alert.js +1 -1
- package/dist/pkt-card.cjs +1 -1
- package/dist/pkt-card.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-index.cjs +1 -1
- package/dist/pkt-index.js +14 -14
- 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-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-select.cjs +1 -1
- package/dist/pkt-select.js +1 -1
- package/dist/pkt-slot-controller-Clbye6cM.js +85 -0
- package/dist/pkt-slot-controller-Oc32unDk.cjs +1 -0
- 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.d.ts +7 -0
- package/dist/radiobutton.d.ts +7 -0
- package/dist/select-DFlu7Eq6.cjs +48 -0
- package/dist/{select-BJr30hL7.js → select-DVyh7z8C.js} +60 -43
- package/dist/select.d.ts +7 -0
- package/dist/{tag-nAMwKi6B.cjs → tag-DGywzHJ5.cjs} +1 -1
- package/dist/{tag-CPLBzyiV.js → tag-W9Lf1doW.js} +1 -1
- package/dist/tag.d.ts +7 -0
- package/dist/{textarea-Da-bIu5d.js → textarea-80zuPTTD.js} +35 -33
- package/dist/textarea-WWRAA1LV.cjs +49 -0
- package/dist/textarea.d.ts +7 -0
- package/dist/{textinput-C9pkRR6S.cjs → textinput-CE5AzOur.cjs} +4 -3
- package/dist/{textinput-Buj2CAKl.js → textinput-CZIE3v3S.js} +44 -42
- package/dist/textinput.d.ts +7 -0
- package/package.json +4 -4
- package/src/components/datepicker/datepicker.ts +8 -0
- package/src/components/helptext/helptext.ts +41 -35
- package/src/components/icon/icon.ts +10 -3
- package/src/components/input-wrapper/input-wrapper.ts +28 -19
- package/src/components/select/select.ts +41 -8
- package/src/components/textarea/textarea.ts +9 -1
- package/src/components/textinput/textinput.ts +10 -1
- package/dist/helptext-CNgXo34f.js +0 -75
- package/dist/helptext-XPScYIkx.cjs +0 -23
- package/dist/input-wrapper-CWvzXs6X.js +0 -160
- package/dist/input-wrapper-nvacN4EY.cjs +0 -48
- package/dist/pkt-slot-controller-BEDVscvU.cjs +0 -1
- package/dist/pkt-slot-controller-DhwCJd_0.js +0 -67
- package/dist/select-B19JEWYw.cjs +0 -44
- package/dist/textarea-D7uvC79V.cjs +0 -48
package/dist/pkt-index.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { P as w } from "./alert-
|
|
1
|
+
import { P as w } from "./alert-BvN80UkI.js";
|
|
2
2
|
import { c as P } from "./calendar-DB_8j4en.js";
|
|
3
3
|
import { P as O } from "./calendar-DB_8j4en.js";
|
|
4
|
-
import { P as j } from "./card-
|
|
4
|
+
import { P as j } from "./card-Br6A74Q1.js";
|
|
5
5
|
import { P as f, x as m, s as k, n, t as c } from "./element-BKrU5soj.js";
|
|
6
|
-
import { P as x } from "./pkt-slot-controller-
|
|
6
|
+
import { P as x } from "./pkt-slot-controller-Clbye6cM.js";
|
|
7
7
|
import { e as h, n as d } from "./ref-D5qG7OFB.js";
|
|
8
8
|
import { e as u } from "./class-map-CQzsZCwS.js";
|
|
9
|
-
import { P as D } from "./datepicker-
|
|
10
|
-
import { P as R } from "./helptext-
|
|
9
|
+
import { P as D } from "./datepicker-ONV4HuJt.js";
|
|
10
|
+
import { P as R } from "./helptext-DHfBEO42.js";
|
|
11
11
|
import { P as G } from "./icon-Bsb0MB2h.js";
|
|
12
|
-
import { P as M } from "./input-wrapper-
|
|
13
|
-
import { P as N } from "./link-
|
|
14
|
-
import { P as W } from "./linkcard-
|
|
15
|
-
import { P as z } from "./messagebox-
|
|
16
|
-
import { P as J } from "./modal-
|
|
12
|
+
import { P as M } from "./input-wrapper-Df18_PvD.js";
|
|
13
|
+
import { P as N } from "./link-0N9wG5l8.js";
|
|
14
|
+
import { P as W } from "./linkcard-BJeRbpq_.js";
|
|
15
|
+
import { P as z } from "./messagebox-C5M56R8f.js";
|
|
16
|
+
import { P as J } from "./modal-PKDnp91S.js";
|
|
17
17
|
import { P as V } from "./progressbar-DETyIwXf.js";
|
|
18
18
|
import { P as Y } from "./radiobutton-BhQCBJ0I.js";
|
|
19
|
-
import { P as tt } from "./tag-
|
|
20
|
-
import { P as rt } from "./textarea-
|
|
21
|
-
import { P as ot } from "./textinput-
|
|
22
|
-
import { P as nt } from "./select-
|
|
19
|
+
import { P as tt } from "./tag-W9Lf1doW.js";
|
|
20
|
+
import { P as rt } from "./textarea-80zuPTTD.js";
|
|
21
|
+
import { P as ot } from "./textinput-CZIE3v3S.js";
|
|
22
|
+
import { P as nt } from "./select-DVyh7z8C.js";
|
|
23
23
|
var g = Object.defineProperty, v = Object.getOwnPropertyDescriptor, o = (t, e, i, a) => {
|
|
24
24
|
for (var r = a > 1 ? void 0 : a ? v(e, i) : e, p = t.length - 1, l; p >= 0; p--)
|
|
25
25
|
(l = t[p]) && (r = (a ? l(e, i, r) : l(r)) || r);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./input-wrapper-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./input-wrapper-DeCY6nta.cjs"),t=e.PktInputWrapper;Object.defineProperty(exports,"PktInputWrapper",{enumerable:!0,get:()=>e.PktInputWrapper});exports.default=t;
|
package/dist/pkt-link.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./link-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./link-I_LKEBVK.cjs"),t=e.PktLink;Object.defineProperty(exports,"PktLink",{enumerable:!0,get:()=>e.PktLink});exports.default=t;
|
package/dist/pkt-link.js
CHANGED
package/dist/pkt-linkcard.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./linkcard-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./linkcard-ClXGVwdJ.cjs"),t=e.PktLinkCard;Object.defineProperty(exports,"PktLinkCard",{enumerable:!0,get:()=>e.PktLinkCard});exports.default=t;
|
package/dist/pkt-linkcard.js
CHANGED
package/dist/pkt-messagebox.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./messagebox-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./messagebox-CC3j63Wp.cjs"),t=e.PktMessagebox;Object.defineProperty(exports,"PktMessagebox",{enumerable:!0,get:()=>e.PktMessagebox});exports.default=t;
|
package/dist/pkt-messagebox.js
CHANGED
package/dist/pkt-modal.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./modal-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./modal-BkchlKkL.cjs"),t=e.PktModal;Object.defineProperty(exports,"PktModal",{enumerable:!0,get:()=>e.PktModal});exports.default=t;
|
package/dist/pkt-modal.js
CHANGED
package/dist/pkt-select.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./select-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./select-DFlu7Eq6.cjs"),t=e.PktSelect;Object.defineProperty(exports,"PktSelect",{enumerable:!0,get:()=>e.PktSelect});exports.default=t;
|
package/dist/pkt-select.js
CHANGED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
function a(s, e) {
|
|
2
|
+
return e.some((t) => t.value === s);
|
|
3
|
+
}
|
|
4
|
+
function d(s, e) {
|
|
5
|
+
var t;
|
|
6
|
+
return s.hasAttribute("data-skip") ? [] : s === ((t = e.value) == null ? void 0 : t.parentNode) ? [] : s instanceof HTMLTemplateElement ? Array.from(s.content.childNodes) : [s];
|
|
7
|
+
}
|
|
8
|
+
function r(s) {
|
|
9
|
+
return typeof s.hasAttribute == "function" && s.hasAttribute("data-skip");
|
|
10
|
+
}
|
|
11
|
+
function h(s) {
|
|
12
|
+
return s.nodeName === "OPTION" || s.nodeName === "DATA";
|
|
13
|
+
}
|
|
14
|
+
function u(s, e) {
|
|
15
|
+
return s.nodeType === Node.ELEMENT_NODE && !a(s, e);
|
|
16
|
+
}
|
|
17
|
+
function p(s) {
|
|
18
|
+
var e;
|
|
19
|
+
return s.nodeType === Node.TEXT_NODE && ((e = s.nodeValue) == null ? void 0 : e.trim()) !== "";
|
|
20
|
+
}
|
|
21
|
+
class f {
|
|
22
|
+
constructor(e, ...t) {
|
|
23
|
+
this.nodes = [], this.filledSlots = /* @__PURE__ */ new Set(), this.skipOptions = !1, this.updatingSlots = !1, this.host = e, this.host.addController(this), this.slots = t, this.nodes = [], this.observer = new MutationObserver((o) => this.handleMutations(o));
|
|
24
|
+
}
|
|
25
|
+
hostConnected() {
|
|
26
|
+
this.updateNodes(), this.observer.observe(this.host, { childList: !0 });
|
|
27
|
+
}
|
|
28
|
+
hostDisconnected() {
|
|
29
|
+
this.observer.disconnect();
|
|
30
|
+
}
|
|
31
|
+
hostUpdated() {
|
|
32
|
+
this.updateSlots();
|
|
33
|
+
}
|
|
34
|
+
updateNodes() {
|
|
35
|
+
this.nodes = [], Array.from(this.host.childNodes).forEach((t) => {
|
|
36
|
+
var o;
|
|
37
|
+
if (!r(t) && !(h(t) && this.skipOptions))
|
|
38
|
+
if (t.nodeType === Node.TEXT_NODE && ((o = t.nodeValue) != null && o.trim())) {
|
|
39
|
+
const i = document == null ? void 0 : document.createElement("template");
|
|
40
|
+
i.content.appendChild(t), this.nodes.push(i);
|
|
41
|
+
} else a(t, this.slots) || this.nodes.push(t);
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
updateSlots() {
|
|
45
|
+
if (this.updatingSlots) return;
|
|
46
|
+
this.updatingSlots = !0;
|
|
47
|
+
const e = /* @__PURE__ */ new Set();
|
|
48
|
+
this.slots.forEach((t) => {
|
|
49
|
+
if (!t.value) return;
|
|
50
|
+
const o = t.value.getAttribute("name"), l = this.nodes.flatMap(
|
|
51
|
+
(n) => n.getAttribute && n.getAttribute("slot") == o && !n.hasAttribute("data-skip") ? d(n, t) : []
|
|
52
|
+
).filter(
|
|
53
|
+
(n) => t.value && !t.value.contains(n) && !n.contains(t.value)
|
|
54
|
+
);
|
|
55
|
+
if (l.length > 0)
|
|
56
|
+
if (e.add(o), typeof t.value.replaceChildren != "function") {
|
|
57
|
+
for (; t.value.firstChild; )
|
|
58
|
+
t.value.removeChild(t.value.firstChild);
|
|
59
|
+
t.value.append(...l);
|
|
60
|
+
} else
|
|
61
|
+
t.value.replaceChildren(...l);
|
|
62
|
+
}), (this.filledSlots.size !== e.size || ![...this.filledSlots].every((t) => e.has(t))) && (this.filledSlots = e, Array.from(this.filledSlots).length && !(Array.from(this.filledSlots).length === 1 && Array.from(this.filledSlots)[0] !== null) && this.host.requestUpdate()), this.updatingSlots = !1;
|
|
63
|
+
}
|
|
64
|
+
handleMutations(e) {
|
|
65
|
+
let t = !1;
|
|
66
|
+
e.forEach((o) => {
|
|
67
|
+
o.type === "childList" && (o.addedNodes.forEach((i) => {
|
|
68
|
+
if (!r(i) && !(h(i) && this.skipOptions)) {
|
|
69
|
+
if (u(i, this.slots))
|
|
70
|
+
this.nodes.push(i), t = !0;
|
|
71
|
+
else if (p(i)) {
|
|
72
|
+
const l = document == null ? void 0 : document.createElement("template");
|
|
73
|
+
l.content.appendChild(i), this.nodes.push(l), t = !0;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}), o.removedNodes.forEach((i) => {
|
|
77
|
+
r(i) || h(i) && this.skipOptions || (this.nodes = this.nodes.filter((l) => l !== i), t = !0);
|
|
78
|
+
}));
|
|
79
|
+
}), t && this.updateSlots();
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
export {
|
|
83
|
+
f as P,
|
|
84
|
+
h as i
|
|
85
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";function a(s,e){return e.some(t=>t.value===s)}function d(s,e){var t;return s.hasAttribute("data-skip")?[]:s===((t=e.value)==null?void 0:t.parentNode)?[]:s instanceof HTMLTemplateElement?Array.from(s.content.childNodes):[s]}function h(s){return typeof s.hasAttribute=="function"&&s.hasAttribute("data-skip")}function r(s){return s.nodeName==="OPTION"||s.nodeName==="DATA"}function u(s,e){return s.nodeType===Node.ELEMENT_NODE&&!a(s,e)}function p(s){var e;return s.nodeType===Node.TEXT_NODE&&((e=s.nodeValue)==null?void 0:e.trim())!==""}class f{constructor(e,...t){this.nodes=[],this.filledSlots=new Set,this.skipOptions=!1,this.updatingSlots=!1,this.host=e,this.host.addController(this),this.slots=t,this.nodes=[],this.observer=new MutationObserver(o=>this.handleMutations(o))}hostConnected(){this.updateNodes(),this.observer.observe(this.host,{childList:!0})}hostDisconnected(){this.observer.disconnect()}hostUpdated(){this.updateSlots()}updateNodes(){this.nodes=[],Array.from(this.host.childNodes).forEach(t=>{var o;if(!h(t)&&!(r(t)&&this.skipOptions))if(t.nodeType===Node.TEXT_NODE&&((o=t.nodeValue)!=null&&o.trim())){const i=document==null?void 0:document.createElement("template");i.content.appendChild(t),this.nodes.push(i)}else a(t,this.slots)||this.nodes.push(t)})}updateSlots(){if(this.updatingSlots)return;this.updatingSlots=!0;const e=new Set;this.slots.forEach(t=>{if(!t.value)return;const o=t.value.getAttribute("name"),l=this.nodes.flatMap(n=>n.getAttribute&&n.getAttribute("slot")==o&&!n.hasAttribute("data-skip")?d(n,t):[]).filter(n=>t.value&&!t.value.contains(n)&&!n.contains(t.value));if(l.length>0)if(e.add(o),typeof t.value.replaceChildren!="function"){for(;t.value.firstChild;)t.value.removeChild(t.value.firstChild);t.value.append(...l)}else t.value.replaceChildren(...l)}),(this.filledSlots.size!==e.size||![...this.filledSlots].every(t=>e.has(t)))&&(this.filledSlots=e,Array.from(this.filledSlots).length&&!(Array.from(this.filledSlots).length===1&&Array.from(this.filledSlots)[0]!==null)&&this.host.requestUpdate()),this.updatingSlots=!1}handleMutations(e){let t=!1;e.forEach(o=>{o.type==="childList"&&(o.addedNodes.forEach(i=>{if(!h(i)&&!(r(i)&&this.skipOptions)){if(u(i,this.slots))this.nodes.push(i),t=!0;else if(p(i)){const l=document==null?void 0:document.createElement("template");l.content.appendChild(i),this.nodes.push(l),t=!0}}}),o.removedNodes.forEach(i=>{h(i)||r(i)&&this.skipOptions||(this.nodes=this.nodes.filter(l=>l!==i),t=!0)}))}),t&&this.updateSlots()}}exports.PktSlotController=f;exports.isOptionElement=r;
|
package/dist/pkt-tag.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./tag-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./tag-DGywzHJ5.cjs"),t=e.PktTag;Object.defineProperty(exports,"PktTag",{enumerable:!0,get:()=>e.PktTag});exports.default=t;
|
package/dist/pkt-tag.js
CHANGED
package/dist/pkt-textarea.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./textarea-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./textarea-WWRAA1LV.cjs"),t=e.PktTextarea;Object.defineProperty(exports,"PktTextarea",{enumerable:!0,get:()=>e.PktTextarea});exports.default=t;
|
package/dist/pkt-textarea.js
CHANGED
package/dist/pkt-textinput.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./textinput-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./textinput-CE5AzOur.cjs"),t=e.PktTextinput;Object.defineProperty(exports,"PktTextinput",{enumerable:!0,get:()=>e.PktTextinput});exports.default=t;
|
package/dist/pkt-textinput.js
CHANGED
package/dist/progressbar.d.ts
CHANGED
package/dist/radiobutton.d.ts
CHANGED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";const l=require("./element-B0UgldHm.cjs"),d=require("./state-CG-binsl.cjs"),a=require("./ref-DDYBJ4EB.cjs"),o=require("./if-defined-Br3lDE5v.cjs"),c=require("./input-element-Dnda8hac.cjs"),u=require("./pkt-slot-controller-Oc32unDk.cjs");require("./input-wrapper-DeCY6nta.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
|
+
<pkt-input-wrapper
|
|
3
|
+
?counter=${this.counter}
|
|
4
|
+
?disabled=${this.disabled}
|
|
5
|
+
?hasError=${this.hasError}
|
|
6
|
+
?inline=${this.inline}
|
|
7
|
+
?optionalTag=${this.optionalTag}
|
|
8
|
+
?requiredTag=${this.requiredTag}
|
|
9
|
+
?useWrapper=${this.useWrapper}
|
|
10
|
+
ariaDescribedBy=${o.o(this.ariaDescribedBy)}
|
|
11
|
+
.counterCurrent=${this.counterCurrent}
|
|
12
|
+
.counterMaxLength=${this.counterMaxLength}
|
|
13
|
+
class="pkt-select"
|
|
14
|
+
errorMessage=${o.o(this.errorMessage)}
|
|
15
|
+
forId=${this.id+"-input"}
|
|
16
|
+
helptext=${o.o(this.helptext)}
|
|
17
|
+
helptextDropdown=${o.o(this.helptextDropdown)}
|
|
18
|
+
helptextDropdownButton=${o.o(this.helptextDropdownButton)}
|
|
19
|
+
label=${o.o(this.label)}
|
|
20
|
+
optionalText=${o.o(this.optionalText)}
|
|
21
|
+
requiredText=${o.o(this.requiredText)}
|
|
22
|
+
>
|
|
23
|
+
<select
|
|
24
|
+
class=${t}
|
|
25
|
+
aria-invalid=${this.hasError}
|
|
26
|
+
aria-errormessage=${`${this.id}-error`}
|
|
27
|
+
aria-labelledby=${o.o(this.ariaLabelledby)}
|
|
28
|
+
?disabled=${this.disabled}
|
|
29
|
+
id=${this.id+"-input"}
|
|
30
|
+
name=${(this.name||this.id)+"-input"}
|
|
31
|
+
value=${this.value}
|
|
32
|
+
@change=${e=>{this.value=e.target.value,e.stopImmediatePropagation()}}
|
|
33
|
+
@input=${e=>{this.onInput(),e.stopImmediatePropagation()}}
|
|
34
|
+
@focus=${e=>{this.onFocus(),e.stopImmediatePropagation()}}
|
|
35
|
+
@blur=${e=>{this.onBlur(),e.stopImmediatePropagation()}}
|
|
36
|
+
${a.n(this.inputRef)}
|
|
37
|
+
>
|
|
38
|
+
${this._options.length>0&&this._options.map(e=>l.x`<option
|
|
39
|
+
value=${e.value}
|
|
40
|
+
?selected=${this.value==e.value}
|
|
41
|
+
?disabled=${e.disabled}
|
|
42
|
+
>
|
|
43
|
+
${e.label}
|
|
44
|
+
</option>`)}
|
|
45
|
+
</select>
|
|
46
|
+
<div class="pkt-contents" ${a.n(this.helptextSlot)} name="helptext" slot="helptext"></div>
|
|
47
|
+
</pkt-input-wrapper>
|
|
48
|
+
`}};h([l.n({type:Array})],exports.PktSelect.prototype,"options",2);h([l.n({type:String,reflect:!0})],exports.PktSelect.prototype,"value",2);h([d.r()],exports.PktSelect.prototype,"_options",2);exports.PktSelect=h([l.t("pkt-select")],exports.PktSelect);
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { x as p, n as
|
|
2
|
-
import { r as
|
|
3
|
-
import { e as
|
|
1
|
+
import { x as p, n as b, t as f } from "./element-BKrU5soj.js";
|
|
2
|
+
import { r as v } from "./state-C36ZmZgt.js";
|
|
3
|
+
import { e as u, n as d } from "./ref-D5qG7OFB.js";
|
|
4
4
|
import { o as r } from "./if-defined-f3M1y6S-.js";
|
|
5
5
|
import { P as $ } from "./input-element-URKBm_vS.js";
|
|
6
|
-
import "./
|
|
7
|
-
|
|
6
|
+
import { i as c, P as m } from "./pkt-slot-controller-Clbye6cM.js";
|
|
7
|
+
import "./input-wrapper-Df18_PvD.js";
|
|
8
|
+
class g {
|
|
8
9
|
constructor(t) {
|
|
9
10
|
this.nodes = [], this.options = [], this.host = t, this.host.addController(this), this.nodes = [], this.options = [], this.observer = new MutationObserver((e) => this.handleMutations(e));
|
|
10
11
|
}
|
|
@@ -17,7 +18,7 @@ class v {
|
|
|
17
18
|
this.observer.disconnect();
|
|
18
19
|
}
|
|
19
20
|
addNode(t) {
|
|
20
|
-
(t.nodeName === "OPTION" || t.nodeName === "DATA") && (t.setAttribute("class", "pkt-hide"), this.nodes.push(t));
|
|
21
|
+
(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));
|
|
21
22
|
}
|
|
22
23
|
createOptions() {
|
|
23
24
|
this.options = this.nodes.map((t) => ({
|
|
@@ -30,28 +31,28 @@ class v {
|
|
|
30
31
|
handleMutations(t) {
|
|
31
32
|
let e = !1;
|
|
32
33
|
t.forEach((o) => {
|
|
33
|
-
o.addedNodes.forEach((
|
|
34
|
-
(
|
|
35
|
-
}), o.removedNodes.forEach((
|
|
36
|
-
(
|
|
37
|
-
});
|
|
34
|
+
o.type === "childList" && (o.addedNodes.forEach((i) => {
|
|
35
|
+
c(i) && (this.addNode(i), e = !0);
|
|
36
|
+
}), o.removedNodes.forEach((i) => {
|
|
37
|
+
c(i) && (this.nodes = this.nodes.filter((a) => a !== i), e = !0);
|
|
38
|
+
}));
|
|
38
39
|
}), e && this.createOptions();
|
|
39
40
|
}
|
|
40
41
|
}
|
|
41
|
-
var
|
|
42
|
-
for (var
|
|
43
|
-
(n =
|
|
44
|
-
return o &&
|
|
42
|
+
var C = Object.defineProperty, x = Object.getOwnPropertyDescriptor, l = (s, t, e, o) => {
|
|
43
|
+
for (var i = o > 1 ? void 0 : o ? x(t, e) : t, a = s.length - 1, n; a >= 0; a--)
|
|
44
|
+
(n = s[a]) && (i = (o ? n(t, e, i) : n(i)) || i);
|
|
45
|
+
return o && i && C(t, e, i), i;
|
|
45
46
|
};
|
|
46
|
-
let
|
|
47
|
+
let h = class extends $ {
|
|
47
48
|
constructor() {
|
|
48
|
-
super(), this.
|
|
49
|
+
super(), this.inputRef = u(), this.helptextSlot = u(), this.options = [], this.value = "", this._options = [], this.optionsController = new g(this), this.slotController = new m(this, this.helptextSlot), this.slotController.skipOptions = !0;
|
|
49
50
|
}
|
|
50
51
|
// Used for initilization
|
|
51
52
|
connectedCallback() {
|
|
52
53
|
super.connectedCallback();
|
|
53
|
-
const
|
|
54
|
-
!
|
|
54
|
+
const s = this.options.length > 0, t = this.optionsController.nodes.length && this.optionsController.nodes.length > 0;
|
|
55
|
+
!s && t ? this.optionsController.nodes.forEach((e) => {
|
|
55
56
|
const o = {
|
|
56
57
|
value: e.getAttribute("value") || e.textContent || "",
|
|
57
58
|
label: e.textContent || e.getAttribute("value") || "",
|
|
@@ -60,14 +61,18 @@ let l = class extends $ {
|
|
|
60
61
|
e.getAttribute("selected") && !this.value && (this.value = o.value), this._options.push(o);
|
|
61
62
|
}) : this._options = this.options;
|
|
62
63
|
}
|
|
63
|
-
attributeChangedCallback(
|
|
64
|
-
|
|
64
|
+
attributeChangedCallback(s, t, e) {
|
|
65
|
+
s === "options" && (this._options = e ? JSON.parse(e) : []), s === "value" && this.value !== t && this.valueChanged(e, t), super.attributeChangedCallback(s, t, e);
|
|
65
66
|
}
|
|
66
|
-
|
|
67
|
-
|
|
67
|
+
updated(s) {
|
|
68
|
+
var t;
|
|
69
|
+
super.updated(s), s.has("value") && (this.counterCurrent = ((t = this.value) == null ? void 0 : t.length) || 0, this.valueChanged(this.value, s.get("value"))), s.has("id") && !this.name && this.id && (this.name = this.id);
|
|
70
|
+
}
|
|
71
|
+
firstUpdated(s) {
|
|
72
|
+
super.firstUpdated(s), this.options.length && (this._options = this.options);
|
|
68
73
|
}
|
|
69
74
|
render() {
|
|
70
|
-
const
|
|
75
|
+
const s = `pkt-input ${this.fullwidth ? "pkt-input--fullwidth" : ""}`;
|
|
71
76
|
return p`
|
|
72
77
|
<pkt-input-wrapper
|
|
73
78
|
?counter=${this.counter}
|
|
@@ -82,7 +87,7 @@ let l = class extends $ {
|
|
|
82
87
|
.counterMaxLength=${this.counterMaxLength}
|
|
83
88
|
class="pkt-select"
|
|
84
89
|
errorMessage=${r(this.errorMessage)}
|
|
85
|
-
forId=${this.id}
|
|
90
|
+
forId=${this.id + "-input"}
|
|
86
91
|
helptext=${r(this.helptext)}
|
|
87
92
|
helptextDropdown=${r(this.helptextDropdown)}
|
|
88
93
|
helptextDropdownButton=${r(this.helptextDropdownButton)}
|
|
@@ -91,16 +96,27 @@ let l = class extends $ {
|
|
|
91
96
|
requiredText=${r(this.requiredText)}
|
|
92
97
|
>
|
|
93
98
|
<select
|
|
94
|
-
class=${
|
|
99
|
+
class=${s}
|
|
95
100
|
aria-invalid=${this.hasError}
|
|
96
101
|
aria-errormessage=${`${this.id}-error`}
|
|
97
102
|
aria-labelledby=${r(this.ariaLabelledby)}
|
|
98
103
|
?disabled=${this.disabled}
|
|
99
|
-
id=${this.id}
|
|
100
|
-
name=${this.name || this.id}
|
|
104
|
+
id=${this.id + "-input"}
|
|
105
|
+
name=${(this.name || this.id) + "-input"}
|
|
101
106
|
value=${this.value}
|
|
102
|
-
|
|
103
|
-
|
|
107
|
+
@change=${(t) => {
|
|
108
|
+
this.value = t.target.value, t.stopImmediatePropagation();
|
|
109
|
+
}}
|
|
110
|
+
@input=${(t) => {
|
|
111
|
+
this.onInput(), t.stopImmediatePropagation();
|
|
112
|
+
}}
|
|
113
|
+
@focus=${(t) => {
|
|
114
|
+
this.onFocus(), t.stopImmediatePropagation();
|
|
115
|
+
}}
|
|
116
|
+
@blur=${(t) => {
|
|
117
|
+
this.onBlur(), t.stopImmediatePropagation();
|
|
118
|
+
}}
|
|
119
|
+
${d(this.inputRef)}
|
|
104
120
|
>
|
|
105
121
|
${this._options.length > 0 && this._options.map(
|
|
106
122
|
(t) => p`<option
|
|
@@ -112,22 +128,23 @@ let l = class extends $ {
|
|
|
112
128
|
</option>`
|
|
113
129
|
)}
|
|
114
130
|
</select>
|
|
131
|
+
<div class="pkt-contents" ${d(this.helptextSlot)} name="helptext" slot="helptext"></div>
|
|
115
132
|
</pkt-input-wrapper>
|
|
116
133
|
`;
|
|
117
134
|
}
|
|
118
135
|
};
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
],
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
],
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
],
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
],
|
|
136
|
+
l([
|
|
137
|
+
b({ type: Array })
|
|
138
|
+
], h.prototype, "options", 2);
|
|
139
|
+
l([
|
|
140
|
+
b({ type: String, reflect: !0 })
|
|
141
|
+
], h.prototype, "value", 2);
|
|
142
|
+
l([
|
|
143
|
+
v()
|
|
144
|
+
], h.prototype, "_options", 2);
|
|
145
|
+
h = l([
|
|
146
|
+
f("pkt-select")
|
|
147
|
+
], h);
|
|
131
148
|
export {
|
|
132
|
-
|
|
149
|
+
h as P
|
|
133
150
|
};
|
package/dist/select.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const u=require("./class-map-aeZWY44S.cjs"),t=require("./element-B0UgldHm.cjs"),h=require("./state-CG-binsl.cjs"),g=require("./pkt-slot-controller-
|
|
1
|
+
"use strict";const u=require("./class-map-aeZWY44S.cjs"),t=require("./element-B0UgldHm.cjs"),h=require("./state-CG-binsl.cjs"),g=require("./pkt-slot-controller-Oc32unDk.cjs"),c=require("./ref-DDYBJ4EB.cjs");require("./icon-PWn7rnfg.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"}},a={name:k,"css-class":"pkt-tag",isElement:d,props:f,slots:y};var b=Object.defineProperty,m=Object.getOwnPropertyDescriptor,s=(o,e,l,r)=>{for(var i=r>1?void 0:r?m(e,l):e,n=o.length-1,p;n>=0;n--)(p=o[n])&&(i=(r?p(e,l,i):p(i))||i);return r&&i&&b(e,l,i),i};exports.PktTag=class extends t.PktElement{constructor(){super(),this.defaultSlot=c.e(),this.closeTag=a.props.closeTag.default,this.size=a.props.size.default,this.skin=a.props.skin.default,this.textStyle=a.props.textStyle.default,this.iconName=void 0,this.type=a.props.type.default,this.ariaLabel=a.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},l={"pkt-tag":!0,"pkt-btn":!0,"pkt-btn--tertiary":!0,[`pkt-tag--${this.size}`]:!!this.size,[`pkt-tag--${this.skin}`]:!!this.skin,[`pkt-tag--${this.textStyle}`]:!!this.textStyle,"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(l)}
|
|
4
4
|
type=${this.type}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { e as h } from "./class-map-CQzsZCwS.js";
|
|
2
2
|
import { P as d, x as p, n as o, t as m } from "./element-BKrU5soj.js";
|
|
3
3
|
import { r as y } from "./state-C36ZmZgt.js";
|
|
4
|
-
import { P as g } from "./pkt-slot-controller-
|
|
4
|
+
import { P as g } from "./pkt-slot-controller-Clbye6cM.js";
|
|
5
5
|
import { e as k, n as f } from "./ref-D5qG7OFB.js";
|
|
6
6
|
import "./icon-Bsb0MB2h.js";
|
|
7
7
|
const b = "pkt-tag", S = !0, $ = {
|