@oslokommune/punkt-elements 16.0.3 → 16.1.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.
Files changed (151) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/{accordionitem-CHXGzgLv.js → accordionitem-Cj74XruR.js} +31 -31
  3. package/dist/accordionitem-D7sWqDM_.cjs +34 -0
  4. package/dist/alert-C95U_RZ0.cjs +33 -0
  5. package/dist/{alert-BHSd2Vpj.js → alert-ca_hFi-u.js} +19 -20
  6. package/dist/async-directive-B158h3ba.cjs +5 -0
  7. package/dist/async-directive-CKx6pubI.js +65 -0
  8. package/dist/{button-CHUuxLQV.js → button-BRovt5nm.js} +10 -11
  9. package/dist/button-BXN_JPaH.cjs +27 -0
  10. package/dist/{card-Db9QSEqh.cjs → card-DfHo45CG.cjs} +11 -13
  11. package/dist/{card-CmfUyl_s.js → card-DvgCTN4B.js} +47 -51
  12. package/dist/{checkbox-D6nltMuc.js → checkbox-CbIUMIYt.js} +2 -2
  13. package/dist/{checkbox-Cpyay9_l.cjs → checkbox-mmn3v9ry.cjs} +1 -1
  14. package/dist/{combobox-TKTemUxN.js → combobox-CwW0md6G.js} +31 -31
  15. package/dist/combobox-TKL44xnV.cjs +135 -0
  16. package/dist/{consent-BQLkfN3d.cjs → consent-CIhFwuFO.cjs} +1 -1
  17. package/dist/{consent-knPF4PS_.js → consent-CgS1L1xF.js} +1 -1
  18. package/dist/{datepicker-CPNcXd-o.cjs → datepicker-oN9L0Wnm.cjs} +14 -14
  19. package/dist/{datepicker-MuQYeXhL.js → datepicker-qRWWzmbo.js} +51 -51
  20. package/dist/element-with-slot-1djk8KXi.js +240 -0
  21. package/dist/element-with-slot-yT8k1Z37.cjs +1 -0
  22. package/dist/helptext-B366oeR9.cjs +24 -0
  23. package/dist/{helptext-TFpeGJ1P.js → helptext-DepcDYFV.js} +32 -39
  24. package/dist/index.d.ts +39 -90
  25. package/dist/input-element-Xe9FTi2a.cjs +1 -0
  26. package/dist/{input-element-BGNbdzy2.js → input-element-n5U38pZ1.js} +8 -7
  27. package/dist/{input-wrapper-CaUY90qz.js → input-wrapper-B__6jW4U.js} +25 -28
  28. package/dist/{input-wrapper-JU4D2TGu.cjs → input-wrapper-BdFdJU-k.cjs} +7 -9
  29. package/dist/link-DLjXMpvi.cjs +7 -0
  30. package/dist/link-oGYvBLYL.js +53 -0
  31. package/dist/linkcard-BhVIc18n.js +54 -0
  32. package/dist/linkcard-C20WC6Nw.cjs +13 -0
  33. package/dist/{loader-BF9K1VCZ.js → loader-BHt9i5Xp.js} +12 -13
  34. package/dist/{loader-C1LI8Q4z.cjs → loader-DxAGCcNF.cjs} +2 -2
  35. package/dist/messagebox-B8LW0PSQ.cjs +13 -0
  36. package/dist/messagebox-DkspcMQg.js +69 -0
  37. package/dist/modal-Bfk_ncLQ.cjs +36 -0
  38. package/dist/{modal-CGHWsjk8.js → modal-p1rvuP8e.js} +26 -27
  39. package/dist/pkt-accordion.cjs +1 -1
  40. package/dist/pkt-accordion.js +2 -2
  41. package/dist/pkt-alert.cjs +1 -1
  42. package/dist/pkt-alert.js +1 -1
  43. package/dist/pkt-button.cjs +1 -1
  44. package/dist/pkt-button.js +1 -1
  45. package/dist/pkt-card.cjs +1 -1
  46. package/dist/pkt-card.js +1 -1
  47. package/dist/pkt-checkbox.cjs +1 -1
  48. package/dist/pkt-checkbox.js +1 -1
  49. package/dist/pkt-combobox.cjs +1 -1
  50. package/dist/pkt-combobox.js +1 -1
  51. package/dist/pkt-consent.cjs +1 -1
  52. package/dist/pkt-consent.js +1 -1
  53. package/dist/pkt-datepicker.cjs +1 -1
  54. package/dist/pkt-datepicker.js +2 -2
  55. package/dist/pkt-header.cjs +16 -17
  56. package/dist/pkt-header.js +62 -69
  57. package/dist/pkt-helptext.cjs +1 -1
  58. package/dist/pkt-helptext.js +1 -1
  59. package/dist/pkt-index.cjs +1 -1
  60. package/dist/pkt-index.js +22 -22
  61. package/dist/pkt-input-wrapper.cjs +1 -1
  62. package/dist/pkt-input-wrapper.js +1 -1
  63. package/dist/pkt-link.cjs +1 -1
  64. package/dist/pkt-link.js +1 -1
  65. package/dist/pkt-linkcard.cjs +1 -1
  66. package/dist/pkt-linkcard.js +1 -1
  67. package/dist/pkt-loader.cjs +1 -1
  68. package/dist/pkt-loader.js +1 -1
  69. package/dist/pkt-messagebox.cjs +1 -1
  70. package/dist/pkt-messagebox.js +1 -1
  71. package/dist/pkt-modal.cjs +1 -1
  72. package/dist/pkt-modal.js +1 -1
  73. package/dist/pkt-options-controller-DIeKSpWv.cjs +1 -0
  74. package/dist/{pkt-options-controller-Z-bPox7n.js → pkt-options-controller-W4ITGQy9.js} +1 -1
  75. package/dist/pkt-progressbar.cjs +1 -1
  76. package/dist/pkt-progressbar.js +2 -2
  77. package/dist/pkt-radiobutton.cjs +1 -1
  78. package/dist/pkt-radiobutton.js +1 -1
  79. package/dist/pkt-select.cjs +1 -1
  80. package/dist/pkt-select.js +1 -1
  81. package/dist/pkt-tabs.cjs +1 -1
  82. package/dist/pkt-tabs.js +2 -2
  83. package/dist/pkt-tag.cjs +1 -1
  84. package/dist/pkt-tag.js +1 -1
  85. package/dist/pkt-textarea.cjs +1 -1
  86. package/dist/pkt-textarea.js +1 -1
  87. package/dist/pkt-textinput.cjs +1 -1
  88. package/dist/pkt-textinput.js +1 -1
  89. package/dist/{progressbar-Bxh335uT.cjs → progressbar-CC9Qr82_.cjs} +1 -1
  90. package/dist/{progressbar-GSA4Md1u.js → progressbar-CcX-xiPI.js} +1 -1
  91. package/dist/{radiobutton-CNHCpKn0.cjs → radiobutton-BUDQYAH-.cjs} +1 -1
  92. package/dist/{radiobutton-DgC27mb0.js → radiobutton-RW3h0tJj.js} +2 -2
  93. package/dist/ref-DBGHvw2G.js +42 -0
  94. package/dist/ref-DahIePMT.cjs +5 -0
  95. package/dist/select-PuEeK4jQ.cjs +49 -0
  96. package/dist/{select-7VuYtPZv.js → select-iXKeM3yz.js} +37 -37
  97. package/dist/{tabitem-DQRzgAT4.js → tabitem-DZSzwag2.js} +30 -30
  98. package/dist/{tabitem-BKv4eN0a.cjs → tabitem-Jenus4Qd.cjs} +13 -13
  99. package/dist/{tag-DZPqFiem.js → tag-CIWBLpjv.js} +17 -18
  100. package/dist/tag-DeE1OpmF.cjs +27 -0
  101. package/dist/{textarea-VpCEjVFx.js → textarea-DR9lVDN-.js} +13 -13
  102. package/dist/{textarea-CO7Ikug5.cjs → textarea-DtiYQWjy.cjs} +7 -7
  103. package/dist/{textinput-C2AZ9ss2.js → textinput-0Bttvt9V.js} +22 -22
  104. package/dist/{textinput-DRFZU3dA.cjs → textinput-cKrjvbJW.cjs} +9 -9
  105. package/package.json +3 -3
  106. package/src/components/accordion/accordionitem.ts +4 -6
  107. package/src/components/alert/alert.ts +4 -8
  108. package/src/components/button/button.ts +4 -12
  109. package/src/components/card/card.ts +4 -19
  110. package/src/components/combobox/combobox-base.ts +0 -5
  111. package/src/components/combobox/combobox-utils.ts +1 -1
  112. package/src/components/combobox/combobox.ts +2 -1
  113. package/src/components/datepicker/datepicker.ts +2 -8
  114. package/src/components/header/header-service.ts +5 -19
  115. package/src/components/header/header.ts +4 -13
  116. package/src/components/helptext/helptext.test.ts +2 -12
  117. package/src/components/helptext/helptext.ts +5 -19
  118. package/src/components/input-wrapper/input-wrapper.test.ts +3 -3
  119. package/src/components/input-wrapper/input-wrapper.ts +5 -16
  120. package/src/components/link/link.ts +4 -12
  121. package/src/components/linkcard/linkcard.test.ts +2 -2
  122. package/src/components/linkcard/linkcard.ts +4 -13
  123. package/src/components/loader/loader.ts +4 -12
  124. package/src/components/messagebox/messagebox.ts +4 -9
  125. package/src/components/modal/modal.ts +4 -7
  126. package/src/components/select/select.ts +2 -5
  127. package/src/components/tabs/tabitem.ts +4 -7
  128. package/src/components/tabs/tabs.ts +4 -13
  129. package/src/components/tag/tag.ts +6 -12
  130. package/src/components/textarea/textarea.ts +2 -8
  131. package/src/components/textinput/textinput.ts +2 -8
  132. package/dist/accordionitem-To95GT6b.cjs +0 -34
  133. package/dist/alert-BDXWFRcf.cjs +0 -33
  134. package/dist/button-VWxZW89G.cjs +0 -27
  135. package/dist/combobox-DX2BLzIm.cjs +0 -135
  136. package/dist/helptext-BjW1WdOn.cjs +0 -24
  137. package/dist/input-element-CSDVA3Y6.cjs +0 -1
  138. package/dist/link-Bscfb6s9.js +0 -54
  139. package/dist/link-CDuv1jxx.cjs +0 -7
  140. package/dist/linkcard-3WUL0CpY.cjs +0 -13
  141. package/dist/linkcard-wNgRxJ-S.js +0 -55
  142. package/dist/messagebox-Dmot5szX.cjs +0 -13
  143. package/dist/messagebox-LBEzcr6B.js +0 -70
  144. package/dist/modal-S9MOKOaz.cjs +0 -37
  145. package/dist/pkt-options-controller-BogGk-6J.cjs +0 -1
  146. package/dist/pkt-slot-controller-D4nKlom5.cjs +0 -1
  147. package/dist/pkt-slot-controller-D7CrjM52.js +0 -95
  148. package/dist/ref-CxLwrCxt.cjs +0 -9
  149. package/dist/ref-Dma3n3i8.js +0 -102
  150. package/dist/select-PWPy5gTB.cjs +0 -49
  151. package/dist/tag-DmbgBCKu.cjs +0 -27
@@ -1,54 +0,0 @@
1
- import { P as h, A as m, b as c, n as o, t as u } from "./element-CV9utnHJ.js";
2
- import { P } from "./pkt-slot-controller-D7CrjM52.js";
3
- import { e as k, n as g } from "./ref-Dma3n3i8.js";
4
- import { e as y } from "./class-map-3ADKve8g.js";
5
- import "./icon-D0IQAVwS.js";
6
- const d = { href: { default: "#" }, target: { default: "_self" } }, f = {
7
- props: d
8
- };
9
- var _ = Object.defineProperty, $ = Object.getOwnPropertyDescriptor, r = (i, n, l, s) => {
10
- for (var t = s > 1 ? void 0 : s ? $(n, l) : n, p = i.length - 1, a; p >= 0; p--)
11
- (a = i[p]) && (t = (s ? a(n, l, t) : a(t)) || t);
12
- return s && t && _(n, l, t), t;
13
- };
14
- let e = class extends h {
15
- constructor() {
16
- super(), this.defaultSlot = k(), this.href = f.props.href.default, this.iconName = void 0, this.iconPosition = void 0, this.external = !1, this.target = f.props.target.default, this.slotController = new P(this, this.defaultSlot);
17
- }
18
- render() {
19
- const i = {
20
- "pkt-link": !0,
21
- "pkt-link--icon-left": !!this.iconName && this.iconPosition === "left" || !!(this.iconName && !this.iconPosition),
22
- "pkt-link--icon-right": !!this.iconName && this.iconPosition === "right",
23
- "pkt-link--external": this.external
24
- };
25
- return c`<a
26
- class=${y(i)}
27
- href=${this.href}
28
- .target=${this.target}
29
- .rel=${this.external ? "noopener noreferrer" : m}
30
- >${this.iconName ? c`<pkt-icon name=${this.iconName} class="pkt-link__icon"></pkt-icon>` : ""} <span ${g(this.defaultSlot)}>Link</span></a
31
- >`;
32
- }
33
- };
34
- r([
35
- o({ type: String, reflect: !0 })
36
- ], e.prototype, "href", 2);
37
- r([
38
- o({ type: String, reflect: !0 })
39
- ], e.prototype, "iconName", 2);
40
- r([
41
- o({ type: String, reflect: !0 })
42
- ], e.prototype, "iconPosition", 2);
43
- r([
44
- o({ type: Boolean, reflect: !0 })
45
- ], e.prototype, "external", 2);
46
- r([
47
- o({ type: String, reflect: !0 })
48
- ], e.prototype, "target", 2);
49
- e = r([
50
- u("pkt-link")
51
- ], e);
52
- export {
53
- e as P
54
- };
@@ -1,7 +0,0 @@
1
- "use strict";const t=require("./element-CMTfByxQ.cjs"),h=require("./pkt-slot-controller-D4nKlom5.cjs"),c=require("./ref-CxLwrCxt.cjs"),k=require("./class-map-Bokp1SoS.cjs");require("./icon-Dj0oZZSa.cjs");const f={href:{default:"#"},target:{default:"_self"}},a={props:f};var u=Object.defineProperty,P=Object.getOwnPropertyDescriptor,i=(o,r,s,n)=>{for(var e=n>1?void 0:n?P(r,s):r,l=o.length-1,p;l>=0;l--)(p=o[l])&&(e=(n?p(r,s,e):p(e))||e);return n&&e&&u(r,s,e),e};exports.PktLink=class extends t.PktElement{constructor(){super(),this.defaultSlot=c.e(),this.href=a.props.href.default,this.iconName=void 0,this.iconPosition=void 0,this.external=!1,this.target=a.props.target.default,this.slotController=new h.PktSlotController(this,this.defaultSlot)}render(){const r={"pkt-link":!0,"pkt-link--icon-left":!!this.iconName&&this.iconPosition==="left"||!!(this.iconName&&!this.iconPosition),"pkt-link--icon-right":!!this.iconName&&this.iconPosition==="right","pkt-link--external":this.external};return t.b`<a
2
- class=${k.e(r)}
3
- href=${this.href}
4
- .target=${this.target}
5
- .rel=${this.external?"noopener noreferrer":t.A}
6
- >${this.iconName?t.b`<pkt-icon name=${this.iconName} class="pkt-link__icon"></pkt-icon>`:""} <span ${c.n(this.defaultSlot)}>Link</span></a
7
- >`}};i([t.n({type:String,reflect:!0})],exports.PktLink.prototype,"href",2);i([t.n({type:String,reflect:!0})],exports.PktLink.prototype,"iconName",2);i([t.n({type:String,reflect:!0})],exports.PktLink.prototype,"iconPosition",2);i([t.n({type:Boolean,reflect:!0})],exports.PktLink.prototype,"external",2);i([t.n({type:String,reflect:!0})],exports.PktLink.prototype,"target",2);exports.PktLink=i([t.t("pkt-link")],exports.PktLink);
@@ -1,13 +0,0 @@
1
- "use strict";const t=require("./element-CMTfByxQ.cjs"),k=require("./ref-CxLwrCxt.cjs"),p=require("./pkt-slot-controller-D4nKlom5.cjs");require("./icon-Dj0oZZSa.cjs");const c=require("./if-defined-hKKmbsI8.cjs");var f=Object.defineProperty,h=Object.getOwnPropertyDescriptor,r=(o,n,i,l)=>{for(var e=l>1?void 0:l?h(n,i):n,s=o.length-1,a;s>=0;s--)(a=o[s])&&(e=(l?a(n,i,e):a(e))||e);return l&&e&&f(n,i,e),e};exports.PktLinkCard=class extends t.PktElement{constructor(){super(),this.defaultSlot=k.e(),this.title="",this.href="#",this.iconName="",this.external=!1,this.openInNewTab=!1,this.skin="normal",this.slotController=new p.PktSlotController(this,this.defaultSlot)}render(){const n=["pkt-linkcard",this.skin&&`pkt-linkcard--${this.skin}`].filter(Boolean).join(" "),i=["pkt-linkcard__title",this.external&&"pkt-link pkt-link--external"].filter(Boolean).join(" ");return t.b`
2
- <a
3
- href=${this.href}
4
- class=${n}
5
- target=${this.openInNewTab?"_blank":"_self"}
6
- rel=${c.o(this.openInNewTab?"noopener noreferrer":void 0)}
7
- >
8
- ${this.iconName&&t.b`<pkt-icon class="pkt-link__icon" name="${this.iconName}" />`}
9
- ${this.title&&t.b`<div class=${i}>${this.title}</div>`}
10
-
11
- <div class="pkt-linkcard__text" ${k.n(this.defaultSlot)}></div>
12
- </a>
13
- `}};r([t.n({type:String,reflect:!0})],exports.PktLinkCard.prototype,"title",2);r([t.n({type:String,reflect:!0})],exports.PktLinkCard.prototype,"href",2);r([t.n({type:String,reflect:!0})],exports.PktLinkCard.prototype,"iconName",2);r([t.n({type:Boolean,reflect:!0})],exports.PktLinkCard.prototype,"external",2);r([t.n({type:Boolean,reflect:!0})],exports.PktLinkCard.prototype,"openInNewTab",2);r([t.n({type:String,reflect:!0})],exports.PktLinkCard.prototype,"skin",2);exports.PktLinkCard=r([t.t("pkt-linkcard")],exports.PktLinkCard);
@@ -1,55 +0,0 @@
1
- import { P as f, b as c, n as o, t as h } from "./element-CV9utnHJ.js";
2
- import { e as k, n as m } from "./ref-Dma3n3i8.js";
3
- import { P as d } from "./pkt-slot-controller-D7CrjM52.js";
4
- import "./icon-D0IQAVwS.js";
5
- import { o as u } from "./if-defined-rXcLNTzN.js";
6
- var _ = Object.defineProperty, y = Object.getOwnPropertyDescriptor, r = (n, i, s, l) => {
7
- for (var e = l > 1 ? void 0 : l ? y(i, s) : i, a = n.length - 1, p; a >= 0; a--)
8
- (p = n[a]) && (e = (l ? p(i, s, e) : p(e)) || e);
9
- return l && e && _(i, s, e), e;
10
- };
11
- let t = class extends f {
12
- constructor() {
13
- super(), this.defaultSlot = k(), this.title = "", this.href = "#", this.iconName = "", this.external = !1, this.openInNewTab = !1, this.skin = "normal", this.slotController = new d(this, this.defaultSlot);
14
- }
15
- render() {
16
- const n = ["pkt-linkcard", this.skin && `pkt-linkcard--${this.skin}`].filter(Boolean).join(" "), i = ["pkt-linkcard__title", this.external && "pkt-link pkt-link--external"].filter(Boolean).join(" ");
17
- return c`
18
- <a
19
- href=${this.href}
20
- class=${n}
21
- target=${this.openInNewTab ? "_blank" : "_self"}
22
- rel=${u(this.openInNewTab ? "noopener noreferrer" : void 0)}
23
- >
24
- ${this.iconName && c`<pkt-icon class="pkt-link__icon" name="${this.iconName}" />`}
25
- ${this.title && c`<div class=${i}>${this.title}</div>`}
26
-
27
- <div class="pkt-linkcard__text" ${m(this.defaultSlot)}></div>
28
- </a>
29
- `;
30
- }
31
- };
32
- r([
33
- o({ type: String, reflect: !0 })
34
- ], t.prototype, "title", 2);
35
- r([
36
- o({ type: String, reflect: !0 })
37
- ], t.prototype, "href", 2);
38
- r([
39
- o({ type: String, reflect: !0 })
40
- ], t.prototype, "iconName", 2);
41
- r([
42
- o({ type: Boolean, reflect: !0 })
43
- ], t.prototype, "external", 2);
44
- r([
45
- o({ type: Boolean, reflect: !0 })
46
- ], t.prototype, "openInNewTab", 2);
47
- r([
48
- o({ type: String, reflect: !0 })
49
- ], t.prototype, "skin", 2);
50
- t = r([
51
- h("pkt-linkcard")
52
- ], t);
53
- export {
54
- t as P
55
- };
@@ -1,13 +0,0 @@
1
- "use strict";const e=require("./element-CMTfByxQ.cjs"),b=require("./pkt-slot-controller-D4nKlom5.cjs"),n=require("./ref-CxLwrCxt.cjs"),u=require("./class-map-Bokp1SoS.cjs"),d=require("./state-BNgpvY-A.cjs");require("./icon-Dj0oZZSa.cjs");const k=require("./classutils-BwNK82ZQ.cjs"),h={skin:{default:"beige"},compact:{default:!1},closable:{default:!1}},p={props:h};var f=Object.defineProperty,g=Object.getOwnPropertyDescriptor,o=(i,t,a,l)=>{for(var s=l>1?void 0:l?g(t,a):t,r=i.length-1,c;r>=0;r--)(c=i[r])&&(s=(l?c(t,a,s):c(s))||s);return l&&s&&f(t,a,s),s};exports.PktMessagebox=class extends e.PktElement{constructor(){super(),this.defaultSlot=n.e(),this.closable=p.props.closable.default,this.compact=p.props.compact.default,this.title="",this.skin=p.props.skin.default,this._isClosed=!1,this.close=t=>{this._isClosed=!0,this.dispatchEvent(new CustomEvent("close",{detail:{origin:t},bubbles:!0})),this.dispatchEvent(new CustomEvent("on-close",{detail:{origin:t},bubbles:!0}))},this.slotController=new b.PktSlotController(this,this.defaultSlot),this._isClosed=!1}updated(t){super.updated(t),t.has("_isClosed")&&k.updateClassAttribute(this,"pkt-hide",this._isClosed)}render(){const t={"pkt-messagebox":!0,"pkt-messagebox--compact":this.compact,[`pkt-messagebox--${this.skin}`]:this.skin,"pkt-messagebox--closable":this.closable,"pkt-hide":this._isClosed};return e.b`<div class=${u.e(t)}>
2
- ${this.closable?e.b`<div class="pkt-messagebox__close">
3
- <button
4
- @click=${this.close}
5
- class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only"
6
- aria-label="Lukk"
7
- >
8
- <pkt-icon name="close" class="pkt-link__icon"></pkt-icon>
9
- </button>
10
- </div>`:e.A}
11
- ${this.title?e.b`<div class="pkt-messagebox__title">${this.title}</div>`:e.A}
12
- <div class="pkt-messagebox__text" ${n.n(this.defaultSlot)}></div>
13
- </div>`}};o([e.n({type:Boolean,reflect:!0})],exports.PktMessagebox.prototype,"closable",2);o([e.n({type:Boolean,reflect:!0})],exports.PktMessagebox.prototype,"compact",2);o([e.n({type:String,reflect:!0})],exports.PktMessagebox.prototype,"title",2);o([e.n({type:String,reflect:!0})],exports.PktMessagebox.prototype,"skin",2);o([d.r()],exports.PktMessagebox.prototype,"_isClosed",2);exports.PktMessagebox=o([e.t("pkt-messagebox")],exports.PktMessagebox);
@@ -1,70 +0,0 @@
1
- import { P as d, A as b, b as n, n as a, t as m } from "./element-CV9utnHJ.js";
2
- import { P as h } from "./pkt-slot-controller-D7CrjM52.js";
3
- import { e as f, n as k } from "./ref-Dma3n3i8.js";
4
- import { e as _ } from "./class-map-3ADKve8g.js";
5
- import { r as v } from "./state-l4hGZdFJ.js";
6
- import "./icon-D0IQAVwS.js";
7
- import { u as g } from "./classutils-RQs1k6D9.js";
8
- const C = { skin: { default: "beige" }, compact: { default: !1 }, closable: { default: !1 } }, u = {
9
- props: C
10
- };
11
- var x = Object.defineProperty, y = Object.getOwnPropertyDescriptor, o = (t, l, p, i) => {
12
- for (var s = i > 1 ? void 0 : i ? y(l, p) : l, r = t.length - 1, c; r >= 0; r--)
13
- (c = t[r]) && (s = (i ? c(l, p, s) : c(s)) || s);
14
- return i && s && x(l, p, s), s;
15
- };
16
- let e = class extends d {
17
- constructor() {
18
- super(), this.defaultSlot = f(), this.closable = u.props.closable.default, this.compact = u.props.compact.default, this.title = "", this.skin = u.props.skin.default, this._isClosed = !1, this.close = (t) => {
19
- this._isClosed = !0, this.dispatchEvent(new CustomEvent("close", { detail: { origin: t }, bubbles: !0 })), this.dispatchEvent(new CustomEvent("on-close", { detail: { origin: t }, bubbles: !0 }));
20
- }, this.slotController = new h(this, this.defaultSlot), this._isClosed = !1;
21
- }
22
- // Lifecycle
23
- updated(t) {
24
- super.updated(t), t.has("_isClosed") && g(this, "pkt-hide", this._isClosed);
25
- }
26
- // Render
27
- render() {
28
- const t = {
29
- "pkt-messagebox": !0,
30
- "pkt-messagebox--compact": this.compact,
31
- [`pkt-messagebox--${this.skin}`]: this.skin,
32
- "pkt-messagebox--closable": this.closable,
33
- "pkt-hide": this._isClosed
34
- };
35
- return n`<div class=${_(t)}>
36
- ${this.closable ? n`<div class="pkt-messagebox__close">
37
- <button
38
- @click=${this.close}
39
- class="pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--icon-only"
40
- aria-label="Lukk"
41
- >
42
- <pkt-icon name="close" class="pkt-link__icon"></pkt-icon>
43
- </button>
44
- </div>` : b}
45
- ${this.title ? n`<div class="pkt-messagebox__title">${this.title}</div>` : b}
46
- <div class="pkt-messagebox__text" ${k(this.defaultSlot)}></div>
47
- </div>`;
48
- }
49
- };
50
- o([
51
- a({ type: Boolean, reflect: !0 })
52
- ], e.prototype, "closable", 2);
53
- o([
54
- a({ type: Boolean, reflect: !0 })
55
- ], e.prototype, "compact", 2);
56
- o([
57
- a({ type: String, reflect: !0 })
58
- ], e.prototype, "title", 2);
59
- o([
60
- a({ type: String, reflect: !0 })
61
- ], e.prototype, "skin", 2);
62
- o([
63
- v()
64
- ], e.prototype, "_isClosed", 2);
65
- e = o([
66
- m("pkt-messagebox")
67
- ], e);
68
- export {
69
- e as P
70
- };
@@ -1,37 +0,0 @@
1
- "use strict";const d=require("./class-map-Bokp1SoS.cjs"),o=require("./element-CMTfByxQ.cjs"),h=require("./state-BNgpvY-A.cjs"),u=require("./pkt-slot-controller-D4nKlom5.cjs"),r=require("./ref-CxLwrCxt.cjs");require("./icon-Dj0oZZSa.cjs");const k={hideCloseButton:{default:!1},closeOnBackdropClick:{default:!1},size:{default:"medium"}},p={props:k};var m=Object.defineProperty,v=Object.getOwnPropertyDescriptor,l=(c,t,e,i)=>{for(var s=i>1?void 0:i?v(t,e):t,a=c.length-1,n;a>=0;a--)(n=c[a])&&(s=(i?n(t,e,s):n(s))||s);return i&&s&&m(t,e,s),s};exports.PktModal=class extends o.PktElement{constructor(){super(),this.headingText="",this.removePadding=!1,this.hideCloseButton=p.props.hideCloseButton.default,this.closeOnBackdropClick=p.props.closeOnBackdropClick.default,this.closeButtonSkin="blue",this.size=p.props.size.default,this.variant="dialog",this.drawerPosition="right",this.transparentBackdrop=!1,this.defaultSlot=r.e(),this.dialogRef=r.e(),this._isOpen=!1,this.close=(t,e=!1)=>{var s;if(!this._isOpen)return;this._isOpen=!1,document.body.classList.remove("pkt-modal--open");const i=document.activeElement;i&&!this.isElementInViewport(i)&&i.scrollIntoView({behavior:"smooth",block:"nearest"}),this.dispatchEvent(new CustomEvent("close",{detail:{origin:t},bubbles:!0,composed:!0})),e||(s=this.dialogRef.value)==null||s.close(),this.requestUpdate()},this.showModal=(t=null)=>{var i;this._isOpen=!0,(i=this.dialogRef.value)==null||i.showModal();const e=document.querySelector(".pkt-modal");requestAnimationFrame(()=>{var s;this.dialogRef.value&&((s=this.dialogRef.value)==null||s.focus())}),e&&document.body.classList.add("pkt-modal--open"),this.dispatchEvent(new CustomEvent("showModal",{detail:{origin:t},bubbles:!0,composed:!0})),this.requestUpdate()},this.slotController=new u.PktSlotController(this,this.defaultSlot),this._isOpen=!1}async connectedCallback(){super.connectedCallback(),document.addEventListener("keydown",this.handleKeyDown.bind(this)),document.addEventListener("click",this.handleBackdropClick.bind(this))}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("click",this.handleBackdropClick)}async firstUpdated(t){super.firstUpdated(t),this.dialogRef.value&&!window.HTMLDialogElement&&!this.dialogRef.value.showModal&&("document"in window&&"createElement"in document&&(await Promise.resolve().then(()=>require("./dialog-polyfill.esm-CPKZe7AL.cjs")).then(i=>i.default)).registerDialog(this.dialogRef.value),this.dialogRef.value.addEventListener("close",()=>{this.close(new Event("close"),!0)}))}handleKeyDown(t){t.key==="Escape"&&this.close(t)}handleBackdropClick(t){var e;this.closeOnBackdropClick&&t.target===((e=this.dialogRef)==null?void 0:e.value)&&this.close(t)}isElementInViewport(t){const e=t.getBoundingClientRect();return e.top>=0&&e.left>=0&&e.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&e.right<=(window.innerWidth||document.documentElement.clientWidth)}render(){const t={"pkt-modal":!0,"pkt-modal--removePadding":this.removePadding??!1,"pkt-modal--noHeadingText":this.headingText===""||this.headingText===void 0,"pkt-modal--noShadow":this.closeButtonSkin==="yellow-filled","pkt-modal--transparentBackdrop":this.transparentBackdrop??!1,[`pkt-modal--${this.size}`]:this.size!==void 0,[`pkt-modal__${this.variant}`]:this.variant!==void 0,[`pkt-modal__drawer--${this.drawerPosition}`]:this.variant==="drawer"},e={"pkt-modal__headingText":!0,"pkt-txt-24":!0},i={"pkt-modal__content":!0,"pkt-txt-18-light":!0},s=this.closeButtonSkin==="blue",a={"pkt-modal__closeButton":!0,[`pkt-modal__closeButton--${this.closeButtonSkin}`]:!0};return o.b`
2
- <dialog
3
- class=${d.e(t)}
4
- ${r.n(this.dialogRef)}
5
- aria-labelledby="pkt-modal__headingText"
6
- aria-describedby="pkt-modal__content"
7
- @close=${n=>this.close(n,!0)}
8
- >
9
- <div class="pkt-modal__wrapper">
10
- ${this.headingText||!this.hideCloseButton?o.b`<div class="pkt-modal__header">
11
- <div class="pkt-modal__header-background"></div>
12
- ${this.headingText?o.b`<h1 id="pkt-modal__headingText" class=${d.e(e)}>
13
- ${this.headingText}
14
- </h1>`:o.b`<div class="pkt-modal__headingText"></div>`}
15
- ${this.hideCloseButton?o.b`<div class="pkt-modal__noCloseButton"></div>`:o.b`<div class="${d.e(a)}">
16
- <pkt-button
17
- @click=${n=>this.close(n)}
18
- aria-label="close"
19
- iconname="close"
20
- variant="icon-only"
21
- size="medium"
22
- skin=${s?"tertiary":"primary"}
23
- >
24
- Lukk
25
- </pkt-button>
26
- </div>`}
27
- </div>`:o.A}
28
- <div class="pkt-modal__container">
29
- <div
30
- id="pkt-modal__content"
31
- class=${d.e(i)}
32
- ${r.n(this.defaultSlot)}
33
- ></div>
34
- </div>
35
- </div>
36
- </dialog>
37
- `}};l([o.n({type:String})],exports.PktModal.prototype,"headingText",2);l([o.n({type:Boolean})],exports.PktModal.prototype,"removePadding",2);l([o.n({type:Boolean})],exports.PktModal.prototype,"hideCloseButton",2);l([o.n({type:Boolean})],exports.PktModal.prototype,"closeOnBackdropClick",2);l([o.n({type:String})],exports.PktModal.prototype,"closeButtonSkin",2);l([o.n({type:String})],exports.PktModal.prototype,"size",2);l([o.n({type:String})],exports.PktModal.prototype,"variant",2);l([o.n({type:String})],exports.PktModal.prototype,"drawerPosition",2);l([o.n({type:Boolean})],exports.PktModal.prototype,"transparentBackdrop",2);l([h.r()],exports.PktModal.prototype,"_isOpen",2);exports.PktModal=l([o.t("pkt-modal")],exports.PktModal);
@@ -1 +0,0 @@
1
- "use strict";const r=require("./pkt-slot-controller-D4nKlom5.cjs");class a{constructor(t){this.nodes=[],this.options=[],this.generation=0,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.createOptions(),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.generation++,this.host.requestUpdate()}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 +0,0 @@
1
- "use strict";function p(e,s){return s.some(t=>t.value===e)}function r(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 c(e,s){return e.nodeType===Node.ELEMENT_NODE&&!p(e,s)}function d(e){var s;return e.nodeType===Node.TEXT_NODE&&((s=e.nodeValue)==null?void 0:s.trim())!==""}class S{constructor(s,...t){this.nodes=[],this.filledSlots=new Set,this.skipOptions=!1,this.updatingSlots=!1,this.needsSlotUpdate=!0,this.host=s,this.host.addController(this),this.slots=t,this.nodes=[],this.observer=new MutationObserver(l=>{this.handleMutations(l),this.handleSlotMutations(l)})}hostConnected(){this.updateNodes(),this.observer.observe(this.host,{childList:!0,subtree:!0})}hostDisconnected(){this.observer.disconnect()}hostUpdated(){this.needsSlotUpdate&&(this.needsSlotUpdate=!1,this.updateSlots())}updateNodes(){this.nodes=[],Array.from(this.host.childNodes).forEach(t=>{r(t)||a(t)&&this.skipOptions||(!p(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(r(o))return!1;if((f=o.textContent)!=null&&f.trim())return!0}return!1})&&s.add(l);const n=this.nodes.flatMap(o=>d(o)||o.getAttribute&&o.getAttribute("slot")==l&&!r(o)?o:[]).filter(o=>t.value&&!t.value.contains(o)&&!o.contains(t.value));if(n.length>0)if(typeof t.value.replaceChildren!="function"){for(;t.value.firstChild;)t.value.removeChild(t.value.firstChild);t.value.append(...n)}else t.value.replaceChildren(...n)}),(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.target!==this.host||(l.addedNodes.forEach(i=>{r(i)||a(i)&&this.skipOptions||(c(i,this.slots)||d(i))&&(this.nodes.push(i),t=!0)}),l.removedNodes.forEach(i=>{r(i)||a(i)&&this.skipOptions||(this.nodes=this.nodes.filter(h=>h!==i),t=!0)}))}),t&&(this.needsSlotUpdate=!0,this.updateSlots())}handleSlotMutations(s){let t=!1;s.forEach(l=>{const i=l.target.parentElement;if(i!=null&&i.hasAttribute("slot")){const h=i.getAttribute("slot"),n=i.hasChildNodes();n&&!this.filledSlots.has(h)?(this.filledSlots.add(h),t=!0):!n&&this.filledSlots.has(h)&&(this.filledSlots.delete(h),t=!0)}}),t&&typeof this.host.updateSlots=="function"&&this.host.updateSlots(this.filledSlots)}}exports.PktSlotController=S;exports.isOptionElement=a;
@@ -1,95 +0,0 @@
1
- function p(e, s) {
2
- return s.some((t) => t.value === e);
3
- }
4
- function n(e) {
5
- return e.classList && (e.classList.contains("_dialog_overlay") || e.classList.contains("backdrop")) ? !0 : typeof e.hasAttribute == "function" && e.hasAttribute("data-skip");
6
- }
7
- function r(e) {
8
- return e.nodeName === "OPTION" || e.nodeName === "DATA";
9
- }
10
- function c(e, s) {
11
- return e.nodeType === Node.ELEMENT_NODE && !p(e, s);
12
- }
13
- function d(e) {
14
- var s;
15
- return e.nodeType === Node.TEXT_NODE && ((s = e.nodeValue) == null ? void 0 : s.trim()) !== "";
16
- }
17
- class S {
18
- constructor(s, ...t) {
19
- this.nodes = [], this.filledSlots = /* @__PURE__ */ new Set(), this.skipOptions = !1, this.updatingSlots = !1, this.needsSlotUpdate = !0, this.host = s, this.host.addController(this), this.slots = t, this.nodes = [], this.observer = new MutationObserver((l) => {
20
- this.handleMutations(l), this.handleSlotMutations(l);
21
- });
22
- }
23
- hostConnected() {
24
- this.updateNodes(), this.observer.observe(this.host, { childList: !0, subtree: !0 });
25
- }
26
- hostDisconnected() {
27
- this.observer.disconnect();
28
- }
29
- hostUpdated() {
30
- this.needsSlotUpdate && (this.needsSlotUpdate = !1, this.updateSlots());
31
- }
32
- // ********* UPDATE NODES *********
33
- updateNodes() {
34
- this.nodes = [], Array.from(this.host.childNodes).forEach((t) => {
35
- n(t) || r(t) && this.skipOptions || (!p(t, this.slots) || d(t)) && this.nodes.push(t);
36
- });
37
- }
38
- // ********* UPDATE SLOTS *********
39
- updateSlots() {
40
- if (this.updatingSlots) return;
41
- this.updatingSlots = !0;
42
- const s = /* @__PURE__ */ new Set();
43
- this.slots.forEach((t) => {
44
- if (!t.value) return;
45
- const l = t.value.getAttribute("name");
46
- Array.from(t.value.childNodes).some((o) => {
47
- var u, f;
48
- if (o.nodeType === Node.COMMENT_NODE) return !1;
49
- if (o.nodeType === Node.TEXT_NODE) return !!((u = o.textContent) != null && u.trim());
50
- if (o.nodeType === Node.ELEMENT_NODE) {
51
- if (n(o)) return !1;
52
- if ((f = o.textContent) != null && f.trim()) return !0;
53
- }
54
- return !1;
55
- }) && s.add(l);
56
- const a = this.nodes.flatMap(
57
- (o) => d(o) || o.getAttribute && o.getAttribute("slot") == l && !n(o) ? o : []
58
- ).filter(
59
- (o) => t.value && !t.value.contains(o) && !o.contains(t.value)
60
- );
61
- if (a.length > 0)
62
- if (typeof t.value.replaceChildren != "function") {
63
- for (; t.value.firstChild; )
64
- t.value.removeChild(t.value.firstChild);
65
- t.value.append(...a);
66
- } else
67
- t.value.replaceChildren(...a);
68
- }), (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;
69
- }
70
- // ********* HANDLE MUTATIONS *********
71
- handleMutations(s) {
72
- let t = !1;
73
- s.forEach((l) => {
74
- l.type !== "childList" || l.target !== this.host || (l.addedNodes.forEach((i) => {
75
- n(i) || r(i) && this.skipOptions || (c(i, this.slots) || d(i)) && (this.nodes.push(i), t = !0);
76
- }), l.removedNodes.forEach((i) => {
77
- n(i) || r(i) && this.skipOptions || (this.nodes = this.nodes.filter((h) => h !== i), t = !0);
78
- }));
79
- }), t && (this.needsSlotUpdate = !0, this.updateSlots());
80
- }
81
- handleSlotMutations(s) {
82
- let t = !1;
83
- s.forEach((l) => {
84
- const i = l.target.parentElement;
85
- if (i != null && i.hasAttribute("slot")) {
86
- const h = i.getAttribute("slot"), a = i.hasChildNodes();
87
- a && !this.filledSlots.has(h) ? (this.filledSlots.add(h), t = !0) : !a && this.filledSlots.has(h) && (this.filledSlots.delete(h), t = !0);
88
- }
89
- }), t && typeof this.host.updateSlots == "function" && this.host.updateSlots(this.filledSlots);
90
- }
91
- }
92
- export {
93
- S as P,
94
- r as i
95
- };
@@ -1,9 +0,0 @@
1
- "use strict";const d=require("./element-CMTfByxQ.cjs"),a=require("./directive-helpers-B3Vpl3xV.cjs"),l=require("./directive-C7oCP5Bh.cjs");/**
2
- * @license
3
- * Copyright 2017 Google LLC
4
- * SPDX-License-Identifier: BSD-3-Clause
5
- */const n=(t,e)=>{var i;const s=t._$AN;if(s===void 0)return!1;for(const h of s)(i=h._$AO)==null||i.call(h,e,!1),n(h,e);return!0},r=t=>{let e,s;do{if((e=t._$AM)===void 0)break;s=e._$AN,s.delete(t),t=e}while((s==null?void 0:s.size)===0)},$=t=>{for(let e;e=t._$AM;t=e){let s=e._$AN;if(s===void 0)e._$AN=s=new Set;else if(s.has(t))break;s.add(t),f(e)}};function _(t){this._$AN!==void 0?(r(this),this._$AM=t,$(this)):this._$AM=t}function A(t,e=!1,s=0){const i=this._$AH,h=this._$AN;if(h!==void 0&&h.size!==0)if(e)if(Array.isArray(i))for(let o=s;o<i.length;o++)n(i[o],!1),r(i[o]);else i!=null&&(n(i,!1),r(i));else n(this,t)}const f=t=>{t.type==l.t.CHILD&&(t._$AP??(t._$AP=A),t._$AQ??(t._$AQ=_))};class u extends l.i{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,s,i){super._$AT(e,s,i),$(this),this.isConnected=e._$AU}_$AO(e,s=!0){var i,h;e!==this.isConnected&&(this.isConnected=e,e?(i=this.reconnected)==null||i.call(this):(h=this.disconnected)==null||h.call(this)),s&&(n(this,e),r(this))}setValue(e){if(a.r(this._$Ct))this._$Ct._$AI(e,this);else{const s=[...this._$Ct._$AH];s[this._$Ci]=e,this._$Ct._$AI(s,this,0)}}disconnected(){}reconnected(){}}/**
6
- * @license
7
- * Copyright 2020 Google LLC
8
- * SPDX-License-Identifier: BSD-3-Clause
9
- */const v=()=>new G;class G{}const c=new WeakMap,p=l.e(class extends u{render(t){return d.A}update(t,[e]){var i;const s=e!==this.G;return s&&this.G!==void 0&&this.rt(void 0),(s||this.lt!==this.ct)&&(this.G=e,this.ht=(i=t.options)==null?void 0:i.host,this.rt(this.ct=t.element)),d.A}rt(t){if(this.isConnected||(t=void 0),typeof this.G=="function"){const e=this.ht??globalThis;let s=c.get(e);s===void 0&&(s=new WeakMap,c.set(e,s)),s.get(this.G)!==void 0&&this.G.call(this.ht,void 0),s.set(this.G,t),t!==void 0&&this.G.call(this.ht,t)}else this.G.value=t}get lt(){var t,e;return typeof this.G=="function"?(t=c.get(this.ht??globalThis))==null?void 0:t.get(this.G):(e=this.G)==null?void 0:e.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});exports.e=v;exports.n=p;
@@ -1,102 +0,0 @@
1
- import { A as l } from "./element-CV9utnHJ.js";
2
- import { r as $ } from "./directive-helpers-CyPtA1_i.js";
3
- import { i as a, t as f, e as _ } from "./directive-oAbCiebi.js";
4
- /**
5
- * @license
6
- * Copyright 2017 Google LLC
7
- * SPDX-License-Identifier: BSD-3-Clause
8
- */
9
- const o = (t, s) => {
10
- var i;
11
- const e = t._$AN;
12
- if (e === void 0) return !1;
13
- for (const h of e) (i = h._$AO) == null || i.call(h, s, !1), o(h, s);
14
- return !0;
15
- }, r = (t) => {
16
- let s, e;
17
- do {
18
- if ((s = t._$AM) === void 0) break;
19
- e = s._$AN, e.delete(t), t = s;
20
- } while ((e == null ? void 0 : e.size) === 0);
21
- }, d = (t) => {
22
- for (let s; s = t._$AM; t = s) {
23
- let e = s._$AN;
24
- if (e === void 0) s._$AN = e = /* @__PURE__ */ new Set();
25
- else if (e.has(t)) break;
26
- e.add(t), v(s);
27
- }
28
- };
29
- function A(t) {
30
- this._$AN !== void 0 ? (r(this), this._$AM = t, d(this)) : this._$AM = t;
31
- }
32
- function u(t, s = !1, e = 0) {
33
- const i = this._$AH, h = this._$AN;
34
- if (h !== void 0 && h.size !== 0) if (s) if (Array.isArray(i)) for (let n = e; n < i.length; n++) o(i[n], !1), r(i[n]);
35
- else i != null && (o(i, !1), r(i));
36
- else o(this, t);
37
- }
38
- const v = (t) => {
39
- t.type == f.CHILD && (t._$AP ?? (t._$AP = u), t._$AQ ?? (t._$AQ = A));
40
- };
41
- class p extends a {
42
- constructor() {
43
- super(...arguments), this._$AN = void 0;
44
- }
45
- _$AT(s, e, i) {
46
- super._$AT(s, e, i), d(this), this.isConnected = s._$AU;
47
- }
48
- _$AO(s, e = !0) {
49
- var i, h;
50
- s !== this.isConnected && (this.isConnected = s, s ? (i = this.reconnected) == null || i.call(this) : (h = this.disconnected) == null || h.call(this)), e && (o(this, s), r(this));
51
- }
52
- setValue(s) {
53
- if ($(this._$Ct)) this._$Ct._$AI(s, this);
54
- else {
55
- const e = [...this._$Ct._$AH];
56
- e[this._$Ci] = s, this._$Ct._$AI(e, this, 0);
57
- }
58
- }
59
- disconnected() {
60
- }
61
- reconnected() {
62
- }
63
- }
64
- /**
65
- * @license
66
- * Copyright 2020 Google LLC
67
- * SPDX-License-Identifier: BSD-3-Clause
68
- */
69
- const N = () => new G();
70
- class G {
71
- }
72
- const c = /* @__PURE__ */ new WeakMap(), M = _(class extends p {
73
- render(t) {
74
- return l;
75
- }
76
- update(t, [s]) {
77
- var i;
78
- const e = s !== this.G;
79
- return e && this.G !== void 0 && this.rt(void 0), (e || this.lt !== this.ct) && (this.G = s, this.ht = (i = t.options) == null ? void 0 : i.host, this.rt(this.ct = t.element)), l;
80
- }
81
- rt(t) {
82
- if (this.isConnected || (t = void 0), typeof this.G == "function") {
83
- const s = this.ht ?? globalThis;
84
- let e = c.get(s);
85
- e === void 0 && (e = /* @__PURE__ */ new WeakMap(), c.set(s, e)), e.get(this.G) !== void 0 && this.G.call(this.ht, void 0), e.set(this.G, t), t !== void 0 && this.G.call(this.ht, t);
86
- } else this.G.value = t;
87
- }
88
- get lt() {
89
- var t, s;
90
- return typeof this.G == "function" ? (t = c.get(this.ht ?? globalThis)) == null ? void 0 : t.get(this.G) : (s = this.G) == null ? void 0 : s.value;
91
- }
92
- disconnected() {
93
- this.lt === this.ct && this.rt(void 0);
94
- }
95
- reconnected() {
96
- this.rt(this.ct);
97
- }
98
- });
99
- export {
100
- N as e,
101
- M as n
102
- };
@@ -1,49 +0,0 @@
1
- "use strict";const p=require("./element-CMTfByxQ.cjs"),h=require("./ref-CxLwrCxt.cjs"),l=require("./if-defined-hKKmbsI8.cjs"),c=require("./state-BNgpvY-A.cjs"),v=require("./input-element-CSDVA3Y6.cjs"),f=require("./pkt-options-controller-BogGk-6J.cjs"),_=require("./pkt-slot-controller-D4nKlom5.cjs");require("./input-wrapper-JU4D2TGu.cjs");var $=Object.defineProperty,u=(r,t,e,i)=>{for(var s=void 0,o=r.length-1,n;o>=0;o--)(n=r[o])&&(s=n(t,e,s)||s);return s&&$(t,e,s),s};class a extends v.PktInputElement{constructor(){super(...arguments),this._optionsProp=[],this._options=[]}get options(){return this._options.map(t=>({...t,selected:this.isOptionSelected(t)}))}set options(t){this._optionsProp=t,this.requestUpdate("_optionsProp",this._options)}isOptionSelected(t){return Array.isArray(this.value)?this.value.includes(t.value):t.value===this.value}findOptionByValue(t){return this._options.find(e=>e.value===t)}getSelectedOptions(){return this._options.filter(t=>this.isOptionSelected(t))}parseOptions(){var i,s;const t=this._optionsProp.length>0,e=((s=(i=this.optionsController)==null?void 0:i.nodes)==null?void 0:s.length)&&this.optionsController.nodes.length>0;t?this._options=this._optionsProp:e&&(this._options=this.optionsController.options)}willUpdate(t){super.willUpdate(t),this.parseOptions()}}u([p.n({type:Array,attribute:"options"})],a.prototype,"_optionsProp");u([c.r()],a.prototype,"_options");var x=Object.defineProperty,b=Object.getOwnPropertyDescriptor,d=(r,t,e,i)=>{for(var s=i>1?void 0:i?b(t,e):t,o=r.length-1,n;o>=0;o--)(n=r[o])&&(s=(i?n(t,e,s):n(s))||s);return i&&s&&x(t,e,s),s};exports.PktSelect=class extends a{constructor(){super(),this.inputRef=h.e(),this.helptextSlot=h.e(),this.value="",this.selectedIndex=-1,this.selectedOptions=void 0,this.optionsController=new f.PktOptionsSlotController(this),this.slotController=new _.PktSlotController(this,this.helptextSlot),this.slotController.skipOptions=!0}connectedCallback(){super.connectedCallback(),this.parseOptions(),this._options.forEach(t=>{t.selected&&!this.value&&(this.value=t.value)})}add(t,e){const i={value:t.value||t.text,label:t.text||t.value,selected:t.selected,disabled:t.disabled};if(e===void 0)this._options.push(i);else if(typeof e=="number")this._options.splice(e,0,i);else{const s=e.value||e.text,o=this._options.findIndex(n=>n.value===s);o>=0?this._options.splice(o,0,i):this._options.push(i)}t.selected&&(this.value=t.value||t.text,this.selectedIndex=this._options.findIndex(s=>s.value===this.value)),this.requestUpdate()}remove(t){var e;typeof t=="number"&&(this.selectedIndex===t&&(this.value=((e=this._options[0])==null?void 0:e.value)||""),this._options.splice(t,1),this.requestUpdate())}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(){this.inputRef.value&&"showPicker"in this.inputRef.value&&this.inputRef.value.showPicker()}attributeChangedCallback(t,e,i){var s,o;t==="options"&&(this._options=i?JSON.parse(i):[]),t==="value"&&this.value!==e&&(this.selectedIndex=this.touched?this.returnNumberOrNull((s=this.inputRef.value)==null?void 0:s.selectedIndex):this._options.findIndex(n=>n.value===i),this.selectedOptions=(o=this.inputRef.value)==null?void 0:o.selectedOptions,this.valueChanged(i,e)),super.attributeChangedCallback(t,e,i)}update(t){var e,i;super.update(t),t.has("_optionsProp")&&this._optionsProp.length>0&&(this._options=this._optionsProp,this.requestUpdate("_options"),!this.value&&this._options.length>0&&(this.value=this._options[0].value,this.selectedIndex=0)),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(s=>s.value===this.value),this.selectedOptions=(i=this.inputRef.value)==null?void 0:i.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._optionsProp.length&&(this._options=this._optionsProp),!this.value&&this._options.length>0?(this.value=this._options[0].value,this.selectedIndex=0):this.selectedIndex=this._options.findIndex(i=>i.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 p.b`
2
- <pkt-input-wrapper
3
- ?counter=${this.counter}
4
- ?disabled=${this.disabled}
5
- ?hasError=${this.hasError}
6
- ?hasFieldset=${this.hasFieldset}
7
- ?inline=${this.inline}
8
- ?optionalTag=${this.optionalTag}
9
- ?requiredTag=${this.requiredTag}
10
- useWrapper=${this.useWrapper}
11
- ariaDescribedBy=${l.o(this.ariaDescribedBy)}
12
- class="pkt-select"
13
- errorMessage=${l.o(this.errorMessage)}
14
- forId=${this.id+"-input"}
15
- helptext=${l.o(this.helptext)}
16
- helptextDropdown=${l.o(this.helptextDropdown)}
17
- helptextDropdownButton=${l.o(this.helptextDropdownButton)}
18
- label=${l.o(this.label)}
19
- optionalText=${l.o(this.optionalText)}
20
- requiredText=${l.o(this.requiredText)}
21
- tagText=${l.o(this.tagText)}
22
- >
23
- <select
24
- class=${t}
25
- aria-invalid=${this.hasError}
26
- aria-errormessage=${`${this.id}-error`}
27
- aria-labelledby=${l.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.touched=!0,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
- ${h.n(this.inputRef)}
37
- >
38
- ${this._options.length>0?this._options.map(e=>p.b`<option
39
- value=${e.value}
40
- ?selected=${this.value==e.value||e.selected}
41
- ?disabled=${e.disabled}
42
- ?hidden=${e.hidden}
43
- >
44
- ${e.label}
45
- </option>`):""}
46
- </select>
47
- <div class="pkt-contents" ${h.n(this.helptextSlot)} name="helptext" slot="helptext"></div>
48
- </pkt-input-wrapper>
49
- `}returnNumberOrNull(t){return t==null||isNaN(t)?null:t}};d([p.n({type:String})],exports.PktSelect.prototype,"value",2);exports.PktSelect=d([p.t("pkt-select")],exports.PktSelect);
@@ -1,27 +0,0 @@
1
- "use strict";const h=require("./class-map-Bokp1SoS.cjs"),t=require("./element-CMTfByxQ.cjs"),d=require("./state-BNgpvY-A.cjs"),k=require("./pkt-slot-controller-D4nKlom5.cjs"),c=require("./ref-CxLwrCxt.cjs");require("./icon-Dj0oZZSa.cjs");const u=require("./if-defined-hKKmbsI8.cjs"),g={size:{default:"medium"},skin:{default:"blue"},closeTag:{default:!1},type:{default:"button"}},n={props:g};var f=Object.defineProperty,b=Object.getOwnPropertyDescriptor,s=(r,e,a,o)=>{for(var i=o>1?void 0:o?b(e,a):e,l=r.length-1,p;l>=0;l--)(p=r[l])&&(i=(o?p(e,a,i):p(i))||i);return o&&i&&f(e,a,i),i};exports.PktTag=class extends t.PktElement{constructor(){super(),this.defaultSlot=c.e(),this.closeTag=n.props.closeTag.default,this.size=n.props.size.default,this.skin=n.props.skin.default,this.textStyle=null,this.iconName=void 0,this.type=n.props.type.default,this.ariaLabel=null,this.buttonTabindex=void 0,this._isClosed=!1,this._ariaDescription=null,this.close=e=>{this._isClosed=!0,this.dispatchEvent(new CustomEvent("close",{detail:{origin:e},bubbles:!1,composed:!0})),this.dispatchEvent(new CustomEvent("on-close",{detail:{origin:e},bubbles:!1,composed:!0}))},this.slotController=new k.PktSlotController(this,this.defaultSlot),this._isClosed=!1}firstUpdated(e){var a,o;if(super.firstUpdated(e),this.closeTag&&!this.ariaLabel){const i=(o=(a=this.defaultSlot.value)==null?void 0:a.textContent)==null?void 0:o.trim();i&&(this._ariaDescription=`Klikk for å fjerne ${i}`)}}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.b`
2
- <button
3
- class=${h.e(a)}
4
- type=${this.type}
5
- tabindex=${u.o(this.buttonTabindex)}
6
- @click=${this.close}
7
- aria-label=${u.o(this.ariaLabel||void 0)}
8
- aria-description=${u.o(this._ariaDescription||void 0)}
9
- >
10
- ${this.iconName&&t.b`<pkt-icon
11
- class="pkt-tag__icon"
12
- name=${this.iconName}
13
- aria-hidden="true"
14
- ></pkt-icon>`}
15
- <span ${c.n(this.defaultSlot)}></span>
16
- <pkt-icon class="pkt-tag__close-btn" name="close"></pkt-icon>
17
- </button>
18
- `:t.b`
19
- <span class=${h.e(e)}>
20
- ${this.iconName&&t.b`<pkt-icon
21
- class="pkt-tag__icon"
22
- name=${this.iconName}
23
- aria-hidden="true"
24
- ></pkt-icon>`}
25
- <span ${c.n(this.defaultSlot)}></span>
26
- </span>
27
- `}};s([t.n({type:Boolean,reflect:!0})],exports.PktTag.prototype,"closeTag",2);s([t.n({type:String,reflect:!0})],exports.PktTag.prototype,"size",2);s([t.n({type:String,reflect:!0})],exports.PktTag.prototype,"skin",2);s([t.n({type:String,reflect:!0})],exports.PktTag.prototype,"textStyle",2);s([t.n({type:String,reflect:!0})],exports.PktTag.prototype,"iconName",2);s([t.n({type:String})],exports.PktTag.prototype,"type",2);s([t.n({type:String})],exports.PktTag.prototype,"ariaLabel",2);s([t.n({type:Number,attribute:"button-tabindex"})],exports.PktTag.prototype,"buttonTabindex",2);s([d.r()],exports.PktTag.prototype,"_isClosed",2);s([d.r()],exports.PktTag.prototype,"_ariaDescription",2);exports.PktTag=s([t.t("pkt-tag")],exports.PktTag);