@oslokommune/punkt-elements 12.42.7 → 12.42.9

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.
Files changed (96) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/dist/{accordionitem-Dz6jwPpb.cjs → accordionitem-C4NQFQHo.cjs} +1 -1
  3. package/dist/{accordionitem-DkE9or0K.js → accordionitem-aQHOrGzf.js} +1 -1
  4. package/dist/{alert-BY97zZYx.cjs → alert-DUWuhtFC.cjs} +1 -1
  5. package/dist/{alert-oh7nc3ip.js → alert-sBHt7DSh.js} +1 -1
  6. package/dist/{button-OLSvT2Im.js → button-B4Oe8Ar0.js} +62 -47
  7. package/dist/button-BT-FRGMk.cjs +19 -0
  8. package/dist/{card-BxHlJq4J.js → card-0Kf9L0A_.js} +2 -2
  9. package/dist/{card-CmdIb2X9.cjs → card-CXhVAeOG.cjs} +1 -1
  10. package/dist/{combobox-hYeZxIku.js → combobox-CsFDvh8U.js} +4 -4
  11. package/dist/{combobox-CZJrOopi.cjs → combobox-Dq7F5v-u.cjs} +1 -1
  12. package/dist/{consent-ChCTj6FB.js → consent-B17ZIuwm.js} +1 -1
  13. package/dist/{consent-B7w1--m7.cjs → consent-CILYIgC-.cjs} +1 -1
  14. package/dist/{datepicker-Cf45KOxr.js → datepicker-Cz6seIz1.js} +3 -3
  15. package/dist/{datepicker-CE5oM9D3.cjs → datepicker-DOf9XK9v.cjs} +1 -1
  16. package/dist/{heading-Bxonbv8M.js → heading-CGGKEZve.js} +1 -1
  17. package/dist/{heading-CxJ0IqpU.cjs → heading-Cmh5bbTl.cjs} +1 -1
  18. package/dist/helptext-BG_b6ytC.js +87 -0
  19. package/dist/helptext-CC3qLmEz.cjs +24 -0
  20. package/dist/index.d.ts +3 -2
  21. package/dist/{input-wrapper-DnyRiuHR.js → input-wrapper-CC_R5w7V.js} +61 -68
  22. package/dist/input-wrapper-Dk0rKRlz.cjs +53 -0
  23. package/dist/{link-Qj1bJCPw.js → link-C9X0huxP.js} +1 -1
  24. package/dist/{link-BWJrqWi7.cjs → link-qTz-qNVI.cjs} +1 -1
  25. package/dist/{linkcard-Byt10fUI.js → linkcard-Bhk2ttou.js} +1 -1
  26. package/dist/{linkcard-0KLDuaGM.cjs → linkcard-CaBz6i7A.cjs} +1 -1
  27. package/dist/{loader--5h6NKGl.cjs → loader-BqYcg8Di.cjs} +1 -1
  28. package/dist/{loader-xkMMWgaj.js → loader-DMp859px.js} +1 -1
  29. package/dist/{messagebox-IJOkv427.cjs → messagebox-Do_nAUo3.cjs} +1 -1
  30. package/dist/{messagebox-BLTBG8nD.js → messagebox-_1f12rDq.js} +1 -1
  31. package/dist/{modal-CBURcXBd.cjs → modal-C1inKvts.cjs} +1 -1
  32. package/dist/{modal-C6ljjVs6.js → modal-C3kEgTMj.js} +1 -1
  33. package/dist/pkt-accordion.cjs +1 -1
  34. package/dist/pkt-accordion.js +2 -2
  35. package/dist/pkt-alert.cjs +1 -1
  36. package/dist/pkt-alert.js +1 -1
  37. package/dist/pkt-button.cjs +1 -1
  38. package/dist/pkt-button.js +1 -1
  39. package/dist/pkt-card.cjs +1 -1
  40. package/dist/pkt-card.js +1 -1
  41. package/dist/pkt-combobox.cjs +1 -1
  42. package/dist/pkt-combobox.js +1 -1
  43. package/dist/pkt-consent.cjs +1 -1
  44. package/dist/pkt-consent.js +1 -1
  45. package/dist/pkt-datepicker.cjs +1 -1
  46. package/dist/pkt-datepicker.js +1 -1
  47. package/dist/pkt-heading.cjs +1 -1
  48. package/dist/pkt-heading.js +1 -1
  49. package/dist/pkt-helptext.cjs +1 -1
  50. package/dist/pkt-helptext.js +1 -1
  51. package/dist/pkt-index.cjs +1 -1
  52. package/dist/pkt-index.js +20 -20
  53. package/dist/pkt-input-wrapper.cjs +1 -1
  54. package/dist/pkt-input-wrapper.js +1 -1
  55. package/dist/pkt-link.cjs +1 -1
  56. package/dist/pkt-link.js +1 -1
  57. package/dist/pkt-linkcard.cjs +1 -1
  58. package/dist/pkt-linkcard.js +1 -1
  59. package/dist/pkt-loader.cjs +1 -1
  60. package/dist/pkt-loader.js +1 -1
  61. package/dist/pkt-messagebox.cjs +1 -1
  62. package/dist/pkt-messagebox.js +1 -1
  63. package/dist/pkt-modal.cjs +1 -1
  64. package/dist/pkt-modal.js +1 -1
  65. package/dist/pkt-options-controller-CZO1nxZ8.js +39 -0
  66. package/dist/pkt-options-controller-CiuBG6Lt.cjs +1 -0
  67. package/dist/pkt-select.cjs +1 -1
  68. package/dist/pkt-select.js +1 -1
  69. package/dist/{pkt-slot-controller-DtDaD9q_.js → pkt-slot-controller-BPGj-LC5.js} +39 -28
  70. package/dist/pkt-slot-controller-BzddBp7z.cjs +1 -0
  71. package/dist/pkt-tag.cjs +1 -1
  72. package/dist/pkt-tag.js +1 -1
  73. package/dist/pkt-textarea.cjs +1 -1
  74. package/dist/pkt-textarea.js +1 -1
  75. package/dist/pkt-textinput.cjs +1 -1
  76. package/dist/pkt-textinput.js +1 -1
  77. package/dist/{select-BNGnC2U9.cjs → select-BkVSXR5K.cjs} +1 -1
  78. package/dist/{select-Drl_8-OU.js → select-BlL8T2BX.js} +18 -18
  79. package/dist/{tag-lU4vz70a.cjs → tag-DrbI0ng3.cjs} +1 -1
  80. package/dist/{tag-CX-zbR-7.js → tag-m7OTZaCG.js} +1 -1
  81. package/dist/{textarea-DcpZnWkt.cjs → textarea-Dc1sUaxx.cjs} +1 -1
  82. package/dist/{textarea-CctE69uw.js → textarea-Dk8hQMD2.js} +2 -2
  83. package/dist/{textinput-BAPxDvKu.js → textinput-6Ip-0aVY.js} +2 -2
  84. package/dist/{textinput-DcES1ibY.cjs → textinput-DuLZ26DB.cjs} +1 -1
  85. package/package.json +3 -3
  86. package/src/components/button/button.ts +28 -2
  87. package/src/components/helptext/helptext.ts +13 -1
  88. package/src/components/input-wrapper/input-wrapper.ts +1 -10
  89. package/src/components/select/select.ts +1 -1
  90. package/dist/button-KzBZ-Bff.cjs +0 -19
  91. package/dist/helptext-AqNI_oFG.cjs +0 -24
  92. package/dist/helptext-DBearL3P.js +0 -78
  93. package/dist/input-wrapper-Uw7_cZ4w.cjs +0 -53
  94. package/dist/pkt-options-controller-C_Yl_3P6.js +0 -39
  95. package/dist/pkt-options-controller-ftMgG5DP.cjs +0 -1
  96. package/dist/pkt-slot-controller-Da-RgXfS.cjs +0 -1
@@ -1,4 +1,4 @@
1
- import { P as p } from "./input-wrapper-DnyRiuHR.js";
1
+ import { P as p } from "./input-wrapper-CC_R5w7V.js";
2
2
  const r = p;
3
3
  export {
4
4
  p as PktInputWrapper,
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-BWJrqWi7.cjs"),t=e.PktLink;Object.defineProperty(exports,"PktLink",{enumerable:!0,get:()=>e.PktLink});exports.default=t;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./link-qTz-qNVI.cjs"),t=e.PktLink;Object.defineProperty(exports,"PktLink",{enumerable:!0,get:()=>e.PktLink});exports.default=t;
package/dist/pkt-link.js CHANGED
@@ -1,4 +1,4 @@
1
- import { P as t } from "./link-Qj1bJCPw.js";
1
+ import { P as t } from "./link-C9X0huxP.js";
2
2
  const a = t;
3
3
  export {
4
4
  t as PktLink,
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./linkcard-0KLDuaGM.cjs"),t=e.PktLinkCard;Object.defineProperty(exports,"PktLinkCard",{enumerable:!0,get:()=>e.PktLinkCard});exports.default=t;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./linkcard-CaBz6i7A.cjs"),t=e.PktLinkCard;Object.defineProperty(exports,"PktLinkCard",{enumerable:!0,get:()=>e.PktLinkCard});exports.default=t;
@@ -1,4 +1,4 @@
1
- import { P as a } from "./linkcard-Byt10fUI.js";
1
+ import { P as a } from "./linkcard-Bhk2ttou.js";
2
2
  const k = a;
3
3
  export {
4
4
  a as PktLinkCard,
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./loader--5h6NKGl.cjs"),t=e.PktLoader;Object.defineProperty(exports,"PktLoader",{enumerable:!0,get:()=>e.PktLoader});exports.default=t;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./loader-BqYcg8Di.cjs"),t=e.PktLoader;Object.defineProperty(exports,"PktLoader",{enumerable:!0,get:()=>e.PktLoader});exports.default=t;
@@ -1,4 +1,4 @@
1
- import { P as a } from "./loader-xkMMWgaj.js";
1
+ import { P as a } from "./loader-DMp859px.js";
2
2
  const t = a;
3
3
  export {
4
4
  a as PktLoader,
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./messagebox-IJOkv427.cjs"),t=e.PktMessagebox;Object.defineProperty(exports,"PktMessagebox",{enumerable:!0,get:()=>e.PktMessagebox});exports.default=t;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./messagebox-Do_nAUo3.cjs"),t=e.PktMessagebox;Object.defineProperty(exports,"PktMessagebox",{enumerable:!0,get:()=>e.PktMessagebox});exports.default=t;
@@ -1,4 +1,4 @@
1
- import { P as s } from "./messagebox-BLTBG8nD.js";
1
+ import { P as s } from "./messagebox-_1f12rDq.js";
2
2
  const a = s;
3
3
  export {
4
4
  s as PktMessagebox,
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./modal-CBURcXBd.cjs"),t=e.PktModal;Object.defineProperty(exports,"PktModal",{enumerable:!0,get:()=>e.PktModal});exports.default=t;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./modal-C1inKvts.cjs"),t=e.PktModal;Object.defineProperty(exports,"PktModal",{enumerable:!0,get:()=>e.PktModal});exports.default=t;
package/dist/pkt-modal.js CHANGED
@@ -1,4 +1,4 @@
1
- import { P as a } from "./modal-C6ljjVs6.js";
1
+ import { P as a } from "./modal-C3kEgTMj.js";
2
2
  const t = a;
3
3
  export {
4
4
  a as PktModal,
@@ -0,0 +1,39 @@
1
+ import { i as r } from "./pkt-slot-controller-BPGj-LC5.js";
2
+ class o {
3
+ constructor(t) {
4
+ this.nodes = [], this.options = [], this.host = t, this.host.addController(this), this.nodes = [], this.options = [], this.observer = new MutationObserver((e) => this.handleMutations(e));
5
+ }
6
+ hostConnected() {
7
+ Array.from(this.host.childNodes).forEach((t) => {
8
+ (t.nodeName === "OPTION" || t.nodeName === "DATA") && this.addNode(t);
9
+ }), this.observer.observe(this.host, { childList: !0, subtree: !1, attributes: !0 });
10
+ }
11
+ hostDisconnected() {
12
+ this.observer.disconnect();
13
+ }
14
+ addNode(t) {
15
+ (t.nodeName === "OPTION" || t.nodeName === "DATA") && (t.hasAttribute("hidden") && !t.hasAttribute("data-skip") && t.setAttribute("data-hidden", "true"), !t.hasAttribute("hidden") && t.hasAttribute("data-skip") && t.hasAttribute("data-hidden") && t.removeAttribute("data-hidden"), t.setAttribute("class", "pkt-hide"), t.setAttribute("data-skip", "true"), t.setAttribute("hidden", "true"), this.nodes.push(t));
16
+ }
17
+ createOptions() {
18
+ this.options = this.nodes.map((t) => ({
19
+ value: t.hasAttribute("value") ? t.getAttribute("value") ?? "" : t.textContent ?? "",
20
+ label: t.textContent || t.getAttribute("value") || "",
21
+ selected: t.hasAttribute("selected"),
22
+ disabled: t.hasAttribute("disabled"),
23
+ hidden: t.hasAttribute("data-hidden")
24
+ })), this.host.setAttribute("options", JSON.stringify(this.options));
25
+ }
26
+ handleMutations(t) {
27
+ let e = !1;
28
+ t.forEach((s) => {
29
+ s.type === "childList" && (s.addedNodes.forEach((i) => {
30
+ r(i) && (this.addNode(i), e = !0);
31
+ }), s.removedNodes.forEach((i) => {
32
+ r(i) && (this.nodes = this.nodes.filter((h) => h !== i), e = !0);
33
+ })), s.type === "attributes" && r(s.target) && (this.addNode(s.target), e = !0);
34
+ }), e && this.createOptions();
35
+ }
36
+ }
37
+ export {
38
+ o as P
39
+ };
@@ -0,0 +1 @@
1
+ "use strict";const r=require("./pkt-slot-controller-BzddBp7z.cjs");class a{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,subtree:!1,attributes:!0})}hostDisconnected(){this.observer.disconnect()}addNode(t){(t.nodeName==="OPTION"||t.nodeName==="DATA")&&(t.hasAttribute("hidden")&&!t.hasAttribute("data-skip")&&t.setAttribute("data-hidden","true"),!t.hasAttribute("hidden")&&t.hasAttribute("data-skip")&&t.hasAttribute("data-hidden")&&t.removeAttribute("data-hidden"),t.setAttribute("class","pkt-hide"),t.setAttribute("data-skip","true"),t.setAttribute("hidden","true"),this.nodes.push(t))}createOptions(){this.options=this.nodes.map(t=>({value:t.hasAttribute("value")?t.getAttribute("value")??"":t.textContent??"",label:t.textContent||t.getAttribute("value")||"",selected:t.hasAttribute("selected"),disabled:t.hasAttribute("disabled"),hidden:t.hasAttribute("data-hidden")})),this.host.setAttribute("options",JSON.stringify(this.options))}handleMutations(t){let e=!1;t.forEach(s=>{s.type==="childList"&&(s.addedNodes.forEach(i=>{r.isOptionElement(i)&&(this.addNode(i),e=!0)}),s.removedNodes.forEach(i=>{r.isOptionElement(i)&&(this.nodes=this.nodes.filter(h=>h!==i),e=!0)})),s.type==="attributes"&&r.isOptionElement(s.target)&&(this.addNode(s.target),e=!0)}),e&&this.createOptions()}}exports.PktOptionsSlotController=a;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./select-BNGnC2U9.cjs"),t=e.PktSelect;Object.defineProperty(exports,"PktSelect",{enumerable:!0,get:()=>e.PktSelect});exports.default=t;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./select-BkVSXR5K.cjs"),t=e.PktSelect;Object.defineProperty(exports,"PktSelect",{enumerable:!0,get:()=>e.PktSelect});exports.default=t;
@@ -1,4 +1,4 @@
1
- import { P as t } from "./select-Drl_8-OU.js";
1
+ import { P as t } from "./select-BlL8T2BX.js";
2
2
  const a = t;
3
3
  export {
4
4
  t as PktSelect,
@@ -1,22 +1,22 @@
1
- function d(e, s) {
1
+ function c(e, s) {
2
2
  return s.some((t) => t.value === e);
3
3
  }
4
- function n(e) {
4
+ function r(e) {
5
5
  return e.classList && (e.classList.contains("_dialog_overlay") || e.classList.contains("backdrop")) ? !0 : typeof e.hasAttribute == "function" && e.hasAttribute("data-skip");
6
6
  }
7
- function r(e) {
7
+ function a(e) {
8
8
  return e.nodeName === "OPTION" || e.nodeName === "DATA";
9
9
  }
10
- function u(e, s) {
11
- return e.nodeType === Node.ELEMENT_NODE && !d(e, s);
10
+ function p(e, s) {
11
+ return e.nodeType === Node.ELEMENT_NODE && !c(e, s);
12
12
  }
13
- function a(e) {
13
+ function d(e) {
14
14
  var s;
15
15
  return e.nodeType === Node.TEXT_NODE && ((s = e.nodeValue) == null ? void 0 : s.trim()) !== "";
16
16
  }
17
- class c {
17
+ class N {
18
18
  constructor(s, ...t) {
19
- this.nodes = [], this.filledSlots = /* @__PURE__ */ new Set(), this.skipOptions = !1, this.updatingSlots = !1, this.host = s, this.host.addController(this), this.slots = t, this.nodes = [], this.observer = new MutationObserver((o) => this.handleMutations(o)), this.contentObserver = new MutationObserver((o) => this.handleSlotMutations(o));
19
+ this.nodes = [], this.filledSlots = /* @__PURE__ */ new Set(), this.skipOptions = !1, this.updatingSlots = !1, this.host = s, this.host.addController(this), this.slots = t, this.nodes = [], this.observer = new MutationObserver((l) => this.handleMutations(l)), this.contentObserver = new MutationObserver((l) => this.handleSlotMutations(l));
20
20
  }
21
21
  hostConnected() {
22
22
  this.updateNodes(), this.observer.observe(this.host, { childList: !0 }), this.contentObserver.observe(this.host, { childList: !0, subtree: !0 });
@@ -30,7 +30,7 @@ class c {
30
30
  // ********* UPDATE NODES *********
31
31
  updateNodes() {
32
32
  this.nodes = [], Array.from(this.host.childNodes).forEach((t) => {
33
- n(t) || r(t) && this.skipOptions || (!d(t, this.slots) || a(t)) && this.nodes.push(t);
33
+ r(t) || a(t) && this.skipOptions || (!c(t, this.slots) || d(t)) && this.nodes.push(t);
34
34
  });
35
35
  }
36
36
  // ********* UPDATE SLOTS *********
@@ -40,43 +40,54 @@ class c {
40
40
  const s = /* @__PURE__ */ new Set();
41
41
  this.slots.forEach((t) => {
42
42
  if (!t.value) return;
43
- const o = t.value.getAttribute("name"), h = this.nodes.flatMap(
44
- (l) => a(l) || l.getAttribute && l.getAttribute("slot") == o && !n(l) ? l : []
43
+ const l = t.value.getAttribute("name");
44
+ Array.from(t.value.childNodes).some((o) => {
45
+ var u, f;
46
+ if (o.nodeType === Node.COMMENT_NODE) return !1;
47
+ if (o.nodeType === Node.TEXT_NODE) return !!((u = o.textContent) != null && u.trim());
48
+ if (o.nodeType === Node.ELEMENT_NODE) {
49
+ if (r(o)) return !1;
50
+ if ((f = o.textContent) != null && f.trim()) return !0;
51
+ }
52
+ return !1;
53
+ }) && s.add(l);
54
+ const n = this.nodes.flatMap(
55
+ (o) => d(o) || o.getAttribute && o.getAttribute("slot") == l && !r(o) ? o : []
45
56
  ).filter(
46
- (l) => t.value && !t.value.contains(l) && !l.contains(t.value)
57
+ (o) => t.value && !t.value.contains(o) && !o.contains(t.value)
47
58
  );
48
- if (h.length > 0)
49
- if (s.add(o), typeof t.value.replaceChildren != "function") {
59
+ if (n.length > 0)
60
+ if (typeof t.value.replaceChildren != "function") {
50
61
  for (; t.value.firstChild; )
51
62
  t.value.removeChild(t.value.firstChild);
52
- t.value.append(...h);
63
+ t.value.append(...n);
53
64
  } else
54
- t.value.replaceChildren(...h);
55
- }), (this.filledSlots.size !== s.size || ![...this.filledSlots].every((t) => s.has(t))) && (this.filledSlots = s, this.host.requestUpdate()), this.updatingSlots = !1;
65
+ t.value.replaceChildren(...n);
66
+ }), (this.filledSlots.size !== s.size || ![...this.filledSlots].every((t) => s.has(t))) && (this.filledSlots = s, typeof this.host.updateSlots == "function" && this.host.updateSlots(this.filledSlots)), this.updatingSlots = !1;
56
67
  }
57
68
  // ********* HANDLE MUTATIONS *********
58
69
  handleMutations(s) {
59
70
  let t = !1;
60
- s.forEach((o) => {
61
- o.type === "childList" && (o.addedNodes.forEach((i) => {
62
- n(i) || r(i) && this.skipOptions || (u(i, this.slots) || a(i)) && (this.nodes.push(i), t = !0);
63
- }), o.removedNodes.forEach((i) => {
64
- n(i) || r(i) && this.skipOptions || (this.nodes = this.nodes.filter((h) => h !== i), t = !0);
71
+ s.forEach((l) => {
72
+ l.type === "childList" && (l.addedNodes.forEach((i) => {
73
+ r(i) || a(i) && this.skipOptions || (p(i, this.slots) || d(i)) && (this.nodes.push(i), t = !0);
74
+ }), l.removedNodes.forEach((i) => {
75
+ r(i) || a(i) && this.skipOptions || (this.nodes = this.nodes.filter((h) => h !== i), t = !0);
65
76
  }));
66
77
  }), t && this.updateSlots();
67
78
  }
68
79
  handleSlotMutations(s) {
69
80
  let t = !1;
70
- s.forEach((o) => {
71
- const i = o.target.parentElement;
81
+ s.forEach((l) => {
82
+ const i = l.target.parentElement;
72
83
  if (i != null && i.hasAttribute("slot")) {
73
- const h = i.getAttribute("slot"), l = i.hasChildNodes();
74
- l && !this.filledSlots.has(h) ? (this.filledSlots.add(h), t = !0) : !l && this.filledSlots.has(h) && (this.filledSlots.delete(h), t = !0);
84
+ const h = i.getAttribute("slot"), n = i.hasChildNodes();
85
+ n && !this.filledSlots.has(h) ? (this.filledSlots.add(h), t = !0) : !n && this.filledSlots.has(h) && (this.filledSlots.delete(h), t = !0);
75
86
  }
76
87
  }), t && typeof this.host.updateSlots == "function" && this.host.updateSlots(this.filledSlots);
77
88
  }
78
89
  }
79
90
  export {
80
- c as P,
81
- r as i
91
+ N as P,
92
+ a as i
82
93
  };
@@ -0,0 +1 @@
1
+ "use strict";function c(e,s){return s.some(t=>t.value===e)}function h(e){return e.classList&&(e.classList.contains("_dialog_overlay")||e.classList.contains("backdrop"))?!0:typeof e.hasAttribute=="function"&&e.hasAttribute("data-skip")}function a(e){return e.nodeName==="OPTION"||e.nodeName==="DATA"}function p(e,s){return e.nodeType===Node.ELEMENT_NODE&&!c(e,s)}function d(e){var s;return e.nodeType===Node.TEXT_NODE&&((s=e.nodeValue)==null?void 0:s.trim())!==""}class N{constructor(s,...t){this.nodes=[],this.filledSlots=new Set,this.skipOptions=!1,this.updatingSlots=!1,this.host=s,this.host.addController(this),this.slots=t,this.nodes=[],this.observer=new MutationObserver(l=>this.handleMutations(l)),this.contentObserver=new MutationObserver(l=>this.handleSlotMutations(l))}hostConnected(){this.updateNodes(),this.observer.observe(this.host,{childList:!0}),this.contentObserver.observe(this.host,{childList:!0,subtree:!0})}hostDisconnected(){this.observer.disconnect(),this.contentObserver.disconnect()}hostUpdated(){this.updateSlots()}updateNodes(){this.nodes=[],Array.from(this.host.childNodes).forEach(t=>{h(t)||a(t)&&this.skipOptions||(!c(t,this.slots)||d(t))&&this.nodes.push(t)})}updateSlots(){if(this.updatingSlots)return;this.updatingSlots=!0;const s=new Set;this.slots.forEach(t=>{if(!t.value)return;const l=t.value.getAttribute("name");Array.from(t.value.childNodes).some(o=>{var u,f;if(o.nodeType===Node.COMMENT_NODE)return!1;if(o.nodeType===Node.TEXT_NODE)return!!((u=o.textContent)!=null&&u.trim());if(o.nodeType===Node.ELEMENT_NODE){if(h(o))return!1;if((f=o.textContent)!=null&&f.trim())return!0}return!1})&&s.add(l);const r=this.nodes.flatMap(o=>d(o)||o.getAttribute&&o.getAttribute("slot")==l&&!h(o)?o:[]).filter(o=>t.value&&!t.value.contains(o)&&!o.contains(t.value));if(r.length>0)if(typeof t.value.replaceChildren!="function"){for(;t.value.firstChild;)t.value.removeChild(t.value.firstChild);t.value.append(...r)}else t.value.replaceChildren(...r)}),(this.filledSlots.size!==s.size||![...this.filledSlots].every(t=>s.has(t)))&&(this.filledSlots=s,typeof this.host.updateSlots=="function"&&this.host.updateSlots(this.filledSlots)),this.updatingSlots=!1}handleMutations(s){let t=!1;s.forEach(l=>{l.type==="childList"&&(l.addedNodes.forEach(i=>{h(i)||a(i)&&this.skipOptions||(p(i,this.slots)||d(i))&&(this.nodes.push(i),t=!0)}),l.removedNodes.forEach(i=>{h(i)||a(i)&&this.skipOptions||(this.nodes=this.nodes.filter(n=>n!==i),t=!0)}))}),t&&this.updateSlots()}handleSlotMutations(s){let t=!1;s.forEach(l=>{const i=l.target.parentElement;if(i!=null&&i.hasAttribute("slot")){const n=i.getAttribute("slot"),r=i.hasChildNodes();r&&!this.filledSlots.has(n)?(this.filledSlots.add(n),t=!0):!r&&this.filledSlots.has(n)&&(this.filledSlots.delete(n),t=!0)}}),t&&typeof this.host.updateSlots=="function"&&this.host.updateSlots(this.filledSlots)}}exports.PktSlotController=N;exports.isOptionElement=a;
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-lU4vz70a.cjs"),t=e.PktTag;Object.defineProperty(exports,"PktTag",{enumerable:!0,get:()=>e.PktTag});exports.default=t;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./tag-DrbI0ng3.cjs"),t=e.PktTag;Object.defineProperty(exports,"PktTag",{enumerable:!0,get:()=>e.PktTag});exports.default=t;
package/dist/pkt-tag.js CHANGED
@@ -1,4 +1,4 @@
1
- import { P as a } from "./tag-CX-zbR-7.js";
1
+ import { P as a } from "./tag-m7OTZaCG.js";
2
2
  const o = a;
3
3
  export {
4
4
  a as PktTag,
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./textarea-DcpZnWkt.cjs"),t=e.PktTextarea;Object.defineProperty(exports,"PktTextarea",{enumerable:!0,get:()=>e.PktTextarea});exports.default=t;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./textarea-Dc1sUaxx.cjs"),t=e.PktTextarea;Object.defineProperty(exports,"PktTextarea",{enumerable:!0,get:()=>e.PktTextarea});exports.default=t;
@@ -1,4 +1,4 @@
1
- import { P as a } from "./textarea-CctE69uw.js";
1
+ import { P as a } from "./textarea-Dk8hQMD2.js";
2
2
  const e = a;
3
3
  export {
4
4
  a as PktTextarea,
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./textinput-DcES1ibY.cjs"),t=e.PktTextinput;Object.defineProperty(exports,"PktTextinput",{enumerable:!0,get:()=>e.PktTextinput});exports.default=t;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./textinput-DuLZ26DB.cjs"),t=e.PktTextinput;Object.defineProperty(exports,"PktTextinput",{enumerable:!0,get:()=>e.PktTextinput});exports.default=t;
@@ -1,4 +1,4 @@
1
- import { P as t } from "./textinput-BAPxDvKu.js";
1
+ import { P as t } from "./textinput-6Ip-0aVY.js";
2
2
  const p = t;
3
3
  export {
4
4
  t as PktTextinput,
@@ -1,4 +1,4 @@
1
- "use strict";const r=require("./element-90YeMNbV.cjs"),p=require("./state-D-Recv7U.cjs"),h=require("./ref-B-w1vCo8.cjs"),o=require("./if-defined-C8eotHpL.cjs"),d=require("./input-element-CInrWeac.cjs"),c=require("./pkt-options-controller-ftMgG5DP.cjs"),v=require("./pkt-slot-controller-Da-RgXfS.cjs");require("./input-wrapper-Uw7_cZ4w.cjs");var f=Object.defineProperty,b=Object.getOwnPropertyDescriptor,a=(u,t,e,s)=>{for(var i=s>1?void 0:s?b(t,e):t,l=u.length-1,n;l>=0;l--)(n=u[l])&&(i=(s?n(t,e,i):n(i))||i);return s&&i&&f(t,e,i),i};exports.PktSelect=class extends d.PktInputElement{constructor(){super(),this.inputRef=h.e(),this.helptextSlot=h.e(),this.options=[],this.value="",this._options=[],this.selectedIndex=-1,this.selectedOptions=void 0,this.optionsController=new c.PktOptionsSlotController(this),this.slotController=new v.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.hasAttribute("value")?s.getAttribute("value")??"":s.textContent??"",label:s.textContent||s.getAttribute("value")||"",disabled:s.hasAttribute("disabled"),hidden:s.hasAttribute("hidden")};s.getAttribute("selected")&&!this.value&&(this.value=i.value),this._options.push(i)}):(this._options=this.options,this._options.forEach(s=>{s.selected&&!this.value&&(this.value=s.value)}))}add(t,e){var s,i,l;(s=this.inputRef.value)==null||s.add(t,e),this._options.push({value:t.value||t.text,label:t.text||t.value,selected:t.selected,disabled:t.disabled}),t.selected&&(this.value=t.value||t.text,this.selectedIndex=this.returnNumberOrNull((i=this.inputRef.value)==null?void 0:i.selectedIndex),this.selectedOptions=(l=this.inputRef.value)==null?void 0:l.selectedOptions),this.requestUpdate()}remove(t){var e,s;typeof t=="number"&&(this.selectedIndex===t&&(this.value=((e=this._options[0])==null?void 0:e.value)||""),(s=this.inputRef.value)==null||s.remove(t))}item(t){var e;return(e=this.inputRef.value)==null?void 0:e.item(t)}namedItem(t){var e;return(e=this.inputRef.value)==null?void 0:e.namedItem(t)}showPicker(){var t;(t=this.inputRef.value)==null||t.showPicker()}attributeChangedCallback(t,e,s){var i,l;t==="options"&&(this._options=s?JSON.parse(s):[]),t==="value"&&this.value!==e&&(this.selectedIndex=this.touched?this.returnNumberOrNull((i=this.inputRef.value)==null?void 0:i.selectedIndex):this.options.findIndex(n=>n.value===s),this.selectedOptions=(l=this.inputRef.value)==null?void 0:l.selectedOptions,this.valueChanged(s,e)),super.attributeChangedCallback(t,e,s)}update(t){var e,s;super.update(t),t.has("value")&&this.value!==t.get("value")&&(this.selectedIndex=this.touched?this.returnNumberOrNull((e=this.inputRef.value)==null?void 0:e.selectedIndex):this.options.findIndex(i=>i.value===this.value),this.selectedOptions=(s=this.inputRef.value)==null?void 0:s.selectedOptions,this.valueChanged(this.value,t.get("value"))),t.has("id")&&!this.name&&this.id&&(this.name=this.id)}firstUpdated(t){var e;super.firstUpdated(t),this.options.length&&(this._options=this.options),!this.value&&this._options.length>0?(this.value=this._options[0].value,this.selectedIndex=0):this.selectedIndex=this._options.findIndex(s=>s.value===this.value),this.selectedOptions=(e=this.inputRef.value)==null?void 0:e.selectedOptions}render(){const t=`pkt-input ${this.fullwidth?"pkt-input--fullwidth":""}`;return r.x`
1
+ "use strict";const r=require("./element-90YeMNbV.cjs"),p=require("./state-D-Recv7U.cjs"),h=require("./ref-B-w1vCo8.cjs"),o=require("./if-defined-C8eotHpL.cjs"),d=require("./input-element-CInrWeac.cjs"),c=require("./pkt-options-controller-CiuBG6Lt.cjs"),v=require("./pkt-slot-controller-BzddBp7z.cjs");require("./input-wrapper-Dk0rKRlz.cjs");var f=Object.defineProperty,b=Object.getOwnPropertyDescriptor,a=(u,t,e,s)=>{for(var i=s>1?void 0:s?b(t,e):t,l=u.length-1,n;l>=0;l--)(n=u[l])&&(i=(s?n(t,e,i):n(i))||i);return s&&i&&f(t,e,i),i};exports.PktSelect=class extends d.PktInputElement{constructor(){super(),this.inputRef=h.e(),this.helptextSlot=h.e(),this.options=[],this.value="",this._options=[],this.selectedIndex=-1,this.selectedOptions=void 0,this.optionsController=new c.PktOptionsSlotController(this),this.slotController=new v.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.hasAttribute("value")?s.getAttribute("value")??"":s.textContent??"",label:s.textContent||s.getAttribute("value")||"",disabled:s.hasAttribute("disabled"),hidden:s.hasAttribute("data-hidden")};s.getAttribute("selected")&&!this.value&&(this.value=i.value),this._options.push(i)}):(this._options=this.options,this._options.forEach(s=>{s.selected&&!this.value&&(this.value=s.value)}))}add(t,e){var s,i,l;(s=this.inputRef.value)==null||s.add(t,e),this._options.push({value:t.value||t.text,label:t.text||t.value,selected:t.selected,disabled:t.disabled}),t.selected&&(this.value=t.value||t.text,this.selectedIndex=this.returnNumberOrNull((i=this.inputRef.value)==null?void 0:i.selectedIndex),this.selectedOptions=(l=this.inputRef.value)==null?void 0:l.selectedOptions),this.requestUpdate()}remove(t){var e,s;typeof t=="number"&&(this.selectedIndex===t&&(this.value=((e=this._options[0])==null?void 0:e.value)||""),(s=this.inputRef.value)==null||s.remove(t))}item(t){var e;return(e=this.inputRef.value)==null?void 0:e.item(t)}namedItem(t){var e;return(e=this.inputRef.value)==null?void 0:e.namedItem(t)}showPicker(){var t;(t=this.inputRef.value)==null||t.showPicker()}attributeChangedCallback(t,e,s){var i,l;t==="options"&&(this._options=s?JSON.parse(s):[]),t==="value"&&this.value!==e&&(this.selectedIndex=this.touched?this.returnNumberOrNull((i=this.inputRef.value)==null?void 0:i.selectedIndex):this.options.findIndex(n=>n.value===s),this.selectedOptions=(l=this.inputRef.value)==null?void 0:l.selectedOptions,this.valueChanged(s,e)),super.attributeChangedCallback(t,e,s)}update(t){var e,s;super.update(t),t.has("value")&&this.value!==t.get("value")&&(this.selectedIndex=this.touched?this.returnNumberOrNull((e=this.inputRef.value)==null?void 0:e.selectedIndex):this.options.findIndex(i=>i.value===this.value),this.selectedOptions=(s=this.inputRef.value)==null?void 0:s.selectedOptions,this.valueChanged(this.value,t.get("value"))),t.has("id")&&!this.name&&this.id&&(this.name=this.id)}firstUpdated(t){var e;super.firstUpdated(t),this.options.length&&(this._options=this.options),!this.value&&this._options.length>0?(this.value=this._options[0].value,this.selectedIndex=0):this.selectedIndex=this._options.findIndex(s=>s.value===this.value),this.selectedOptions=(e=this.inputRef.value)==null?void 0:e.selectedOptions}render(){const t=`pkt-input ${this.fullwidth?"pkt-input--fullwidth":""}`;return r.x`
2
2
  <pkt-input-wrapper
3
3
  ?counter=${this.counter}
4
4
  ?disabled=${this.disabled}
@@ -3,15 +3,15 @@ import { r as f } from "./state-BxrO4zNJ.js";
3
3
  import { e as u, n as d } from "./ref-DnSbnXsj.js";
4
4
  import { o } from "./if-defined-Cj-3Kdsr.js";
5
5
  import { P as b } from "./input-element-BEvaQK4g.js";
6
- import { P as $ } from "./pkt-options-controller-C_Yl_3P6.js";
7
- import { P as x } from "./pkt-slot-controller-DtDaD9q_.js";
8
- import "./input-wrapper-DnyRiuHR.js";
9
- var m = Object.defineProperty, g = Object.getOwnPropertyDescriptor, a = (t, e, s, i) => {
10
- for (var l = i > 1 ? void 0 : i ? g(e, s) : e, n = t.length - 1, r; n >= 0; n--)
11
- (r = t[n]) && (l = (i ? r(e, s, l) : r(l)) || l);
6
+ import { P as $ } from "./pkt-options-controller-CZO1nxZ8.js";
7
+ import { P as x } from "./pkt-slot-controller-BPGj-LC5.js";
8
+ import "./input-wrapper-CC_R5w7V.js";
9
+ var m = Object.defineProperty, g = Object.getOwnPropertyDescriptor, h = (t, e, s, i) => {
10
+ for (var l = i > 1 ? void 0 : i ? g(e, s) : e, a = t.length - 1, r; a >= 0; a--)
11
+ (r = t[a]) && (l = (i ? r(e, s, l) : r(l)) || l);
12
12
  return i && l && m(e, s, l), l;
13
13
  };
14
- let h = class extends b {
14
+ let n = class extends b {
15
15
  constructor() {
16
16
  super(), this.inputRef = u(), this.helptextSlot = u(), this.options = [], this.value = "", this._options = [], this.selectedIndex = -1, this.selectedOptions = void 0, this.optionsController = new $(this), this.slotController = new x(this, this.helptextSlot), this.slotController.skipOptions = !0;
17
17
  }
@@ -24,7 +24,7 @@ let h = class extends b {
24
24
  value: s.hasAttribute("value") ? s.getAttribute("value") ?? "" : s.textContent ?? "",
25
25
  label: s.textContent || s.getAttribute("value") || "",
26
26
  disabled: s.hasAttribute("disabled"),
27
- hidden: s.hasAttribute("hidden")
27
+ hidden: s.hasAttribute("data-hidden")
28
28
  };
29
29
  s.getAttribute("selected") && !this.value && (this.value = i.value), this._options.push(i);
30
30
  }) : (this._options = this.options, this._options.forEach((s) => {
@@ -63,7 +63,7 @@ let h = class extends b {
63
63
  }
64
64
  attributeChangedCallback(t, e, s) {
65
65
  var i, l;
66
- t === "options" && (this._options = s ? JSON.parse(s) : []), t === "value" && this.value !== e && (this.selectedIndex = this.touched ? this.returnNumberOrNull((i = this.inputRef.value) == null ? void 0 : i.selectedIndex) : this.options.findIndex((n) => n.value === s), this.selectedOptions = (l = this.inputRef.value) == null ? void 0 : l.selectedOptions, this.valueChanged(s, e)), super.attributeChangedCallback(t, e, s);
66
+ t === "options" && (this._options = s ? JSON.parse(s) : []), t === "value" && this.value !== e && (this.selectedIndex = this.touched ? this.returnNumberOrNull((i = this.inputRef.value) == null ? void 0 : i.selectedIndex) : this.options.findIndex((a) => a.value === s), this.selectedOptions = (l = this.inputRef.value) == null ? void 0 : l.selectedOptions, this.valueChanged(s, e)), super.attributeChangedCallback(t, e, s);
67
67
  }
68
68
  update(t) {
69
69
  var e, s;
@@ -138,18 +138,18 @@ let h = class extends b {
138
138
  return t == null || isNaN(t) ? null : t;
139
139
  }
140
140
  };
141
- a([
141
+ h([
142
142
  c({ type: Array })
143
- ], h.prototype, "options", 2);
144
- a([
143
+ ], n.prototype, "options", 2);
144
+ h([
145
145
  c({ type: String })
146
- ], h.prototype, "value", 2);
147
- a([
146
+ ], n.prototype, "value", 2);
147
+ h([
148
148
  f()
149
- ], h.prototype, "_options", 2);
150
- h = a([
149
+ ], n.prototype, "_options", 2);
150
+ n = h([
151
151
  v("pkt-select")
152
- ], h);
152
+ ], n);
153
153
  export {
154
- h as P
154
+ n as P
155
155
  };
@@ -1,4 +1,4 @@
1
- "use strict";const u=require("./class-map-DWDPOqjO.cjs"),t=require("./element-90YeMNbV.cjs"),k=require("./state-D-Recv7U.cjs"),g=require("./pkt-slot-controller-Da-RgXfS.cjs"),c=require("./ref-B-w1vCo8.cjs");require("./icon-B1_BRNqf.cjs");const h=require("./if-defined-C8eotHpL.cjs"),f={closeTag:{default:!1},size:{default:"medium"},skin:{default:"blue"},type:{default:"button"}},r={props:f};var d=Object.defineProperty,y=Object.getOwnPropertyDescriptor,i=(n,e,o,a)=>{for(var s=a>1?void 0:a?y(e,o):e,l=n.length-1,p;l>=0;l--)(p=n[l])&&(s=(a?p(e,o,s):p(s))||s);return a&&s&&d(e,o,s),s};exports.PktTag=class extends t.PktElement{constructor(){super(),this.defaultSlot=c.e(),this.closeTag=r.props.closeTag.default,this.size=r.props.size.default,this.skin=r.props.skin.default,this.textStyle=null,this.iconName=void 0,this.type=r.props.type.default,this.ariaLabel=null,this._isClosed=!1,this._ariaDescription=null,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}firstUpdated(e){var o,a;if(super.firstUpdated(e),this.closeTag&&!this.ariaLabel){const s=(a=(o=this.defaultSlot.value)==null?void 0:o.textContent)==null?void 0:a.trim();s&&(this._ariaDescription=`Klikk for å fjerne ${s}`)}}render(){const e={"pkt-tag":!0,[`pkt-tag--${this.size}`]:!!this.size,[`pkt-tag--${this.skin}`]:!!this.skin,[`pkt-tag--${this.textStyle}`]:!!this.textStyle},o={"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`
1
+ "use strict";const u=require("./class-map-DWDPOqjO.cjs"),t=require("./element-90YeMNbV.cjs"),k=require("./state-D-Recv7U.cjs"),g=require("./pkt-slot-controller-BzddBp7z.cjs"),c=require("./ref-B-w1vCo8.cjs");require("./icon-B1_BRNqf.cjs");const h=require("./if-defined-C8eotHpL.cjs"),f={closeTag:{default:!1},size:{default:"medium"},skin:{default:"blue"},type:{default:"button"}},r={props:f};var d=Object.defineProperty,y=Object.getOwnPropertyDescriptor,i=(n,e,o,a)=>{for(var s=a>1?void 0:a?y(e,o):e,l=n.length-1,p;l>=0;l--)(p=n[l])&&(s=(a?p(e,o,s):p(s))||s);return a&&s&&d(e,o,s),s};exports.PktTag=class extends t.PktElement{constructor(){super(),this.defaultSlot=c.e(),this.closeTag=r.props.closeTag.default,this.size=r.props.size.default,this.skin=r.props.skin.default,this.textStyle=null,this.iconName=void 0,this.type=r.props.type.default,this.ariaLabel=null,this._isClosed=!1,this._ariaDescription=null,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}firstUpdated(e){var o,a;if(super.firstUpdated(e),this.closeTag&&!this.ariaLabel){const s=(a=(o=this.defaultSlot.value)==null?void 0:o.textContent)==null?void 0:a.trim();s&&(this._ariaDescription=`Klikk for å fjerne ${s}`)}}render(){const e={"pkt-tag":!0,[`pkt-tag--${this.size}`]:!!this.size,[`pkt-tag--${this.skin}`]:!!this.skin,[`pkt-tag--${this.textStyle}`]:!!this.textStyle},o={"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(o)}
4
4
  type=${this.type}
@@ -1,7 +1,7 @@
1
1
  import { e as u } from "./class-map-m7ZCZ49w.js";
2
2
  import { P as m, x as l, n as r, a as g } from "./element-gAd63VwC.js";
3
3
  import { r as k } from "./state-BxrO4zNJ.js";
4
- import { P as y } from "./pkt-slot-controller-DtDaD9q_.js";
4
+ import { P as y } from "./pkt-slot-controller-BPGj-LC5.js";
5
5
  import { e as b, n as f } from "./ref-DnSbnXsj.js";
6
6
  import "./icon-CO1TLSs5.js";
7
7
  import { o as d } from "./if-defined-Cj-3Kdsr.js";
@@ -1,4 +1,4 @@
1
- "use strict";const s=require("./element-90YeMNbV.cjs"),p=require("./if-defined-C8eotHpL.cjs"),c=require("./state-D-Recv7U.cjs"),l=require("./ref-B-w1vCo8.cjs"),$=require("./class-map-DWDPOqjO.cjs"),a=require("./directive-C7oCP5Bh.cjs"),d=require("./directive-helpers-v9b0v7lu.cjs"),x=require("./input-element-CInrWeac.cjs"),T=require("./pkt-slot-controller-Da-RgXfS.cjs");require("./input-wrapper-Uw7_cZ4w.cjs");require("./icon-B1_BRNqf.cjs");/**
1
+ "use strict";const s=require("./element-90YeMNbV.cjs"),p=require("./if-defined-C8eotHpL.cjs"),c=require("./state-D-Recv7U.cjs"),l=require("./ref-B-w1vCo8.cjs"),$=require("./class-map-DWDPOqjO.cjs"),a=require("./directive-C7oCP5Bh.cjs"),d=require("./directive-helpers-v9b0v7lu.cjs"),x=require("./input-element-CInrWeac.cjs"),T=require("./pkt-slot-controller-BzddBp7z.cjs");require("./input-wrapper-Dk0rKRlz.cjs");require("./icon-B1_BRNqf.cjs");/**
2
2
  * @license
3
3
  * Copyright 2020 Google LLC
4
4
  * SPDX-License-Identifier: BSD-3-Clause
@@ -6,8 +6,8 @@ import { e as v } from "./class-map-m7ZCZ49w.js";
6
6
  import { e as b, i as T, t as a } from "./directive-oAbCiebi.js";
7
7
  import { f as y, m as w } from "./directive-helpers--4ibN__v.js";
8
8
  import { P as C } from "./input-element-BEvaQK4g.js";
9
- import { P as E } from "./pkt-slot-controller-DtDaD9q_.js";
10
- import "./input-wrapper-DnyRiuHR.js";
9
+ import { P as E } from "./pkt-slot-controller-BPGj-LC5.js";
10
+ import "./input-wrapper-CC_R5w7V.js";
11
11
  import "./icon-CO1TLSs5.js";
12
12
  /**
13
13
  * @license
@@ -4,8 +4,8 @@ import { r as f } from "./state-BxrO4zNJ.js";
4
4
  import { e as m, n as d } from "./ref-DnSbnXsj.js";
5
5
  import { e as g } from "./class-map-m7ZCZ49w.js";
6
6
  import { P as x } from "./input-element-BEvaQK4g.js";
7
- import { P as y } from "./pkt-slot-controller-DtDaD9q_.js";
8
- import "./input-wrapper-DnyRiuHR.js";
7
+ import { P as y } from "./pkt-slot-controller-BPGj-LC5.js";
8
+ import "./input-wrapper-CC_R5w7V.js";
9
9
  import "./icon-CO1TLSs5.js";
10
10
  var v = Object.defineProperty, b = Object.getOwnPropertyDescriptor, o = (e, i, r, t) => {
11
11
  for (var n = t > 1 ? void 0 : t ? b(i, r) : i, l = e.length - 1, c; l >= 0; l--)
@@ -1,4 +1,4 @@
1
- "use strict";const t=require("./element-90YeMNbV.cjs"),a=require("./if-defined-C8eotHpL.cjs"),l=require("./state-D-Recv7U.cjs"),h=require("./ref-B-w1vCo8.cjs"),c=require("./class-map-DWDPOqjO.cjs"),x=require("./input-element-CInrWeac.cjs"),d=require("./pkt-slot-controller-Da-RgXfS.cjs");require("./input-wrapper-Uw7_cZ4w.cjs");require("./icon-B1_BRNqf.cjs");var $=Object.defineProperty,f=Object.getOwnPropertyDescriptor,r=(u,i,s,n)=>{for(var e=n>1?void 0:n?f(i,s):i,o=u.length-1,p;o>=0;o--)(p=u[o])&&(e=(n?p(i,s,e):p(e))||e);return n&&e&&$(i,s,e),e};exports.PktTextinput=class extends x.PktInputElement{constructor(){super(),this.inputRef=h.e(),this.helptextSlot=h.e(),this.value="",this.type="text",this.size=null,this.autocomplete=null,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,s,n){i==="value"&&this.value!==s&&(this.counterCurrent=n?n.length:0,this.valueChanged(n,s)),super.attributeChangedCallback(i,s,n)}updated(i){var s;super.updated(i),i.has("value")&&(this.counterCurrent=((s=this.value)==null?void 0:s.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,s=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}),n=this.ariaLabelledby||`${this.id}-input-label`;return t.x`
1
+ "use strict";const t=require("./element-90YeMNbV.cjs"),a=require("./if-defined-C8eotHpL.cjs"),l=require("./state-D-Recv7U.cjs"),h=require("./ref-B-w1vCo8.cjs"),c=require("./class-map-DWDPOqjO.cjs"),x=require("./input-element-CInrWeac.cjs"),d=require("./pkt-slot-controller-BzddBp7z.cjs");require("./input-wrapper-Dk0rKRlz.cjs");require("./icon-B1_BRNqf.cjs");var $=Object.defineProperty,f=Object.getOwnPropertyDescriptor,r=(u,i,s,n)=>{for(var e=n>1?void 0:n?f(i,s):i,o=u.length-1,p;o>=0;o--)(p=u[o])&&(e=(n?p(i,s,e):p(e))||e);return n&&e&&$(i,s,e),e};exports.PktTextinput=class extends x.PktInputElement{constructor(){super(),this.inputRef=h.e(),this.helptextSlot=h.e(),this.value="",this.type="text",this.size=null,this.autocomplete=null,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,s,n){i==="value"&&this.value!==s&&(this.counterCurrent=n?n.length:0,this.valueChanged(n,s)),super.attributeChangedCallback(i,s,n)}updated(i){var s;super.updated(i),i.has("value")&&(this.counterCurrent=((s=this.value)==null?void 0:s.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,s=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}),n=this.ariaLabelledby||`${this.id}-input-label`;return t.x`
2
2
  <pkt-input-wrapper
3
3
  label="${this.label}"
4
4
  ?counter=${this.counter}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oslokommune/punkt-elements",
3
- "version": "12.42.7",
3
+ "version": "12.42.9",
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",
@@ -31,7 +31,7 @@
31
31
  },
32
32
  "devDependencies": {
33
33
  "@oslokommune/punkt-assets": "^12.39.2",
34
- "@oslokommune/punkt-css": "^12.42.7",
34
+ "@oslokommune/punkt-css": "^12.42.9",
35
35
  "sass": "^1.78.0",
36
36
  "typescript": "^5.6.2",
37
37
  "vite": "^5.4.18",
@@ -58,5 +58,5 @@
58
58
  "url": "https://github.com/oslokommune/punkt/issues"
59
59
  },
60
60
  "license": "MIT",
61
- "gitHead": "c7b7988a22eb94069abbcfb1b31501b0d97a878c"
61
+ "gitHead": "b1c84b3a7403e934703bd982d6dec86f1aa11131"
62
62
  }
@@ -70,7 +70,7 @@ export class PktButton extends PktElement<IPktButton> implements IPktButton {
70
70
  @property({ type: String }) skin: TPktButtonSkin = 'primary'
71
71
  @property({ type: String }) variant: TPktButtonVariant = 'label-only'
72
72
  @property({ type: String, reflect: true }) state?: TPktButtonState = 'normal'
73
- @property({ type: String }) type: TPktButtonType = 'button'
73
+ @property({ type: String, reflect: true }) type: TPktButtonType = 'button'
74
74
  @property({ type: String }) form: string | undefined = undefined
75
75
  @property({ type: Boolean, reflect: true }) isLoading: Booleanish = false
76
76
  @property({ type: Boolean, reflect: true }) disabled: Booleanish = false
@@ -78,6 +78,32 @@ export class PktButton extends PktElement<IPktButton> implements IPktButton {
78
78
 
79
79
  // Lifecycle
80
80
 
81
+ connectedCallback(): void {
82
+ super.connectedCallback()
83
+ this.addEventListener(
84
+ 'click',
85
+ (e) => {
86
+ if (this.disabled || this.hasAttribute('disabled') || this.isLoading) {
87
+ e.preventDefault()
88
+ e.stopImmediatePropagation()
89
+ }
90
+ },
91
+ true,
92
+ )
93
+
94
+ this.addEventListener(
95
+ 'keydown',
96
+ (e) => {
97
+ if (!(this.disabled || this.hasAttribute('disabled') || this.isLoading)) return
98
+ if (e.key === 'Enter' || e.key === ' ') {
99
+ e.preventDefault()
100
+ e.stopImmediatePropagation()
101
+ }
102
+ },
103
+ true,
104
+ )
105
+ }
106
+
81
107
  attributeChangedCallback(name: string, _old: string | null, value: string | null): void {
82
108
  super.attributeChangedCallback(name, _old, value)
83
109
  // Convert strings to booleans
@@ -122,7 +148,7 @@ export class PktButton extends PktElement<IPktButton> implements IPktButton {
122
148
  type=${this.type}
123
149
  ?disabled=${!!this.disabled}
124
150
  aria-busy=${ifDefined(this.isLoading ? 'true' : undefined)}
125
- aria-disabled=${ifDefined(this.disabled ? 'true' : undefined)}
151
+ aria-disabled=${ifDefined(this.disabled || this.isLoading ? 'true' : undefined)}
126
152
  form=${ifDefined(formId)}
127
153
  >
128
154
  ${this.isLoading
@@ -32,6 +32,12 @@ export class PktHelptext extends PktElement {
32
32
 
33
33
  @state() isHelpTextOpen: boolean = false
34
34
 
35
+ @state() filledSlots: Set<string | null | undefined> = new Set()
36
+
37
+ updateSlots(filledSlots: Set<string | null | undefined>) {
38
+ this.filledSlots = new Set(filledSlots)
39
+ }
40
+
35
41
  render() {
36
42
  const toggleDropdown = () => {
37
43
  const isOpen = !this.isHelpTextOpen
@@ -44,6 +50,12 @@ export class PktHelptext extends PktElement {
44
50
  )
45
51
  }
46
52
 
53
+ const helptextClasses = classMap({
54
+ 'pkt-inputwrapper__helptext-container': true,
55
+ 'pkt-inputwrapper__has-helptext':
56
+ this.helptext || this.helptextDropdown || this.filledSlots.size > 0,
57
+ })
58
+
47
59
  const helptextDropdown = () => {
48
60
  if (this.helptextDropdown) {
49
61
  return html`<div class="pkt-inputwrapper__helptext-expandable">
@@ -74,7 +86,7 @@ export class PktHelptext extends PktElement {
74
86
  }
75
87
 
76
88
  const helptextElement = () => {
77
- return html`<div class="pkt-inputwrapper__helptext-container">
89
+ return html`<div class="${helptextClasses}">
78
90
  <div class="pkt-inputwrapper__helptext" id="${this.forId}-helptext">
79
91
  <div class="pkt-contents" ${ref(this.defaultSlot)} name="helptext"></div>
80
92
  ${this.helptext && unsafeHTML(this.helptext)}
@@ -5,7 +5,7 @@ import { ifDefined } from 'lit/directives/if-defined.js'
5
5
  import { html, nothing, PropertyValues } from 'lit'
6
6
  import { unsafeHTML } from 'lit/directives/unsafe-html.js'
7
7
  import { classMap } from 'lit/directives/class-map.js'
8
- import { customElement, property, state } from 'lit/decorators.js'
8
+ import { customElement, property } from 'lit/decorators.js'
9
9
  import { ElementProps } from '@/types/typeUtils'
10
10
  import { uuidish } from '@/utils/stringutils'
11
11
  import specs from 'componentSpecs/input-wrapper.json'
@@ -57,7 +57,6 @@ const booleanishConverter = {
57
57
  export class PktInputWrapper extends PktElement<Props> {
58
58
  defaultSlot: Ref<HTMLElement> = createRef()
59
59
  helptextSlot: Ref<HTMLElement> = createRef()
60
- @state() hasHelptextSlot: boolean = true
61
60
 
62
61
  constructor() {
63
62
  super()
@@ -91,11 +90,6 @@ export class PktInputWrapper extends PktElement<Props> {
91
90
  @property({ type: Boolean, reflect: true, converter: booleanishConverter })
92
91
  useWrapper: Booleanish = specs.props.useWrapper.default
93
92
 
94
- public updateSlots(filledSlots: Set<string | null | undefined>): void {
95
- this.hasHelptextSlot = filledSlots.has('helptext')
96
- this.requestUpdate()
97
- }
98
-
99
93
  protected updated(changedProperties: PropertyValues): void {
100
94
  super.updated(changedProperties)
101
95
  }
@@ -169,9 +163,6 @@ export class PktInputWrapper extends PktElement<Props> {
169
163
  }
170
164
 
171
165
  const helptextElement = () => {
172
- if (!this.helptext && !this.hasHelptextSlot && !this.helptextDropdown) {
173
- return nothing
174
- }
175
166
  return html`
176
167
  <pkt-helptext
177
168
  class="${ifDefined(!this.useWrapper ? 'pkt-hide' : undefined)}"
@@ -74,7 +74,7 @@ export class PktSelect extends PktInputElement implements IPktSelect {
74
74
  : (node.textContent ?? ''),
75
75
  label: node.textContent || node.getAttribute('value') || '',
76
76
  disabled: node.hasAttribute('disabled'),
77
- hidden: node.hasAttribute('hidden'),
77
+ hidden: node.hasAttribute('data-hidden'),
78
78
  }
79
79
  if (node.getAttribute('selected') && !this.value) {
80
80
  this.value = option.value