@oslokommune/punkt-elements 12.37.0 → 12.37.2

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 (105) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/dist/{accordionitem-cvsySqgK.cjs → accordionitem-RFwXQC_0.cjs} +1 -1
  3. package/dist/{accordionitem-Db-3WiJS.js → accordionitem-vmwqD9rr.js} +1 -1
  4. package/dist/{alert-DWIElKEZ.cjs → alert-C2EPmB0W.cjs} +1 -1
  5. package/dist/{alert-B5lVS6Qs.js → alert-C33z1kBf.js} +1 -1
  6. package/dist/{button-BNdVIhUp.cjs → button-jdMbbn-e.cjs} +1 -1
  7. package/dist/{button-B6uRE7uT.js → button-sf_Yzx3X.js} +2 -2
  8. package/dist/{card-B5zTEmH1.js → card-Cyww1yKr.js} +2 -2
  9. package/dist/{card-BDcr3PII.cjs → card-DH-3qNgp.cjs} +1 -1
  10. package/dist/{checkbox-CyYfA2fu.js → checkbox-Cz3sIWt0.js} +1 -1
  11. package/dist/{checkbox-CqatE-eX.cjs → checkbox-U8aPrLjG.cjs} +1 -1
  12. package/dist/{combobox-CELUAZxF.js → combobox-CFH5-Ioh.js} +5 -5
  13. package/dist/{combobox-D9NKnao2.cjs → combobox-ChFttX7F.cjs} +1 -1
  14. package/dist/{consent-jXR0vKAu.cjs → consent-BNY1XvpV.cjs} +1 -1
  15. package/dist/{consent-Baktq_-1.js → consent-CTX9zf81.js} +6 -6
  16. package/dist/{datepicker-CpkTwszH.js → datepicker-hetVXVX4.js} +118 -105
  17. package/dist/{datepicker-cR9MtXOh.cjs → datepicker-mhQrHoNJ.cjs} +16 -16
  18. package/dist/dialog-polyfill.esm-CPKZe7AL.cjs +1 -0
  19. package/dist/dialog-polyfill.esm-CbjBMXAG.js +395 -0
  20. package/dist/{heading-CP3NaeWE.cjs → heading-BnJhJDMD.cjs} +1 -1
  21. package/dist/{heading-BkC05ohM.js → heading-DNLQdsXY.js} +1 -1
  22. package/dist/{helptext-BLHAJ1aC.js → helptext-DcSUjjEq.js} +1 -1
  23. package/dist/{helptext-CCnYxYA9.cjs → helptext-bMgnhZ1R.cjs} +1 -1
  24. package/dist/index.d.ts +2 -0
  25. package/dist/input-element-XmmyUZmB.cjs +1 -0
  26. package/dist/{input-element-Bic-t96S.js → input-element-aQDMXDVQ.js} +31 -26
  27. package/dist/{input-wrapper-Cn929YTV.cjs → input-wrapper-B-f_SotM.cjs} +1 -1
  28. package/dist/{input-wrapper-CeeNYbDA.js → input-wrapper-BdeoMGnk.js} +2 -2
  29. package/dist/{link-BYI8VNGd.js → link-B748tCGi.js} +1 -1
  30. package/dist/{link-CnibgS3c.cjs → link-BrDbM3GT.cjs} +1 -1
  31. package/dist/{linkcard--zuuAt_v.js → linkcard-Bt-Qa_SP.js} +1 -1
  32. package/dist/{linkcard-DPGX1kb1.cjs → linkcard-s9yoOq90.cjs} +1 -1
  33. package/dist/{loader-BN4q8pSl.cjs → loader-Bk4XPiOY.cjs} +1 -1
  34. package/dist/{loader-DgIiyYBl.js → loader-C9EtX_mK.js} +1 -1
  35. package/dist/{messagebox-BWJr42m9.cjs → messagebox-B0kgftoP.cjs} +1 -1
  36. package/dist/{messagebox-cme5VbUM.js → messagebox-DZDP8XZt.js} +1 -1
  37. package/dist/modal-4aQZVxGl.cjs +33 -0
  38. package/dist/{modal-DIwagdAc.js → modal-m--Sfj_1.js} +14 -9
  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 +1 -1
  55. package/dist/pkt-heading.cjs +1 -1
  56. package/dist/pkt-heading.js +1 -1
  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-TJ1apYGF.cjs → pkt-options-controller-Ay9ELZTV.cjs} +1 -1
  74. package/dist/{pkt-options-controller-CFmzX4xL.js → pkt-options-controller-DepYQBqb.js} +1 -1
  75. package/dist/pkt-radiobutton.cjs +1 -1
  76. package/dist/pkt-radiobutton.js +1 -1
  77. package/dist/pkt-select.cjs +1 -1
  78. package/dist/pkt-select.js +1 -1
  79. package/dist/pkt-slot-controller-Da-RgXfS.cjs +1 -0
  80. package/dist/{pkt-slot-controller-DFrc5O93.js → pkt-slot-controller-DtDaD9q_.js} +19 -19
  81. package/dist/pkt-tag.cjs +1 -1
  82. package/dist/pkt-tag.js +1 -1
  83. package/dist/pkt-textarea.cjs +1 -1
  84. package/dist/pkt-textarea.js +1 -1
  85. package/dist/pkt-textinput.cjs +1 -1
  86. package/dist/pkt-textinput.js +1 -1
  87. package/dist/{radiobutton-CIW0FvT8.cjs → radiobutton-DtL-nc1b.cjs} +1 -1
  88. package/dist/{radiobutton-DtHuz7qn.js → radiobutton-DtpGqoci.js} +1 -1
  89. package/dist/{select-DbRLz-7l.js → select-CNK8uoVi.js} +4 -4
  90. package/dist/{select-BJziJVde.cjs → select-s98KeDqQ.cjs} +1 -1
  91. package/dist/{tag-CgkUxA5D.cjs → tag-B9kFYxHg.cjs} +1 -1
  92. package/dist/{tag-CGnj4c1Z.js → tag-Cu8afZy8.js} +1 -1
  93. package/dist/{textarea-CiA4IzMs.js → textarea-C9Kj6gGv.js} +3 -3
  94. package/dist/{textarea-qX4Inr1X.cjs → textarea-CeUz6coA.cjs} +1 -1
  95. package/dist/{textinput-BlsgLNwW.cjs → textinput-BArDDwC2.cjs} +4 -3
  96. package/dist/{textinput-CrxjZNEq.js → textinput-Dj6R0L45.js} +33 -26
  97. package/package.json +4 -3
  98. package/src/components/button/button.ts +1 -0
  99. package/src/components/consent/consent.ts +1 -1
  100. package/src/components/datepicker/datepicker.ts +36 -4
  101. package/src/components/modal/modal.ts +14 -2
  102. package/src/components/textinput/textinput.ts +10 -0
  103. package/dist/input-element-C9ma8cdz.cjs +0 -1
  104. package/dist/modal-OC0efchb.cjs +0 -33
  105. package/dist/pkt-slot-controller-plQxXRvV.cjs +0 -1
@@ -1,4 +1,4 @@
1
- "use strict";const t=require("./element-BSypUpzA.cjs"),a=require("./state-B5KCNjEd.cjs"),p=require("./input-element-C9ma8cdz.cjs"),d=require("./ref-BvbyvXRH.cjs"),o=require("./class-map-DCyaICmy.cjs");var k=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=(u,e,c,s)=>{for(var h=s>1?void 0:s?r(e,c):e,n=u.length-1,l;n>=0;n--)(l=u[n])&&(h=(s?l(e,c,h):l(h))||h);return s&&h&&k(e,c,h),h};exports.PktRadioButton=class extends p.PktInputElement{constructor(){super(...arguments),this.inputRef=d.e(),this.value="",this.checkHelptext=null,this.defaultChecked=!1,this.hasTile=!1,this.checked=null,this.type="radio",this._checked=!1}connectedCallback(){super.connectedCallback()}attributeChangedCallback(e,c,s){e==="defaultChecked"&&(this._checked=this.defaultChecked),e==="checked"&&(this._checked=this.checked===""||this.checked==="true"||this.checked===!0),super.attributeChangedCallback(e,c,s)}updated(e){e.has("checked")&&this.checked!==null&&(this._checked=this.checked===""||this.checked==="true"||this.checked===!0,(e.get("checked")===""||e.get("checked")==="true"||e.get("checked")===!0)!==this._checked&&this.toggleChecked()),super.updated(e)}render(){const e=o.e({"pkt-input-check__input":!0,"pkt-input-check__input--tile":this.hasTile,"pkt-input-check__input--tile-disabled":this.disabled&&this.hasTile}),c=o.e({"pkt-input-check__input-checkbox":!0,"pkt-input-check__input-checkbox--error":this.hasError});return t.x`
1
+ "use strict";const t=require("./element-BSypUpzA.cjs"),a=require("./state-B5KCNjEd.cjs"),p=require("./input-element-XmmyUZmB.cjs"),d=require("./ref-BvbyvXRH.cjs"),o=require("./class-map-DCyaICmy.cjs");var k=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=(u,e,c,s)=>{for(var h=s>1?void 0:s?r(e,c):e,n=u.length-1,l;n>=0;n--)(l=u[n])&&(h=(s?l(e,c,h):l(h))||h);return s&&h&&k(e,c,h),h};exports.PktRadioButton=class extends p.PktInputElement{constructor(){super(...arguments),this.inputRef=d.e(),this.value="",this.checkHelptext=null,this.defaultChecked=!1,this.hasTile=!1,this.checked=null,this.type="radio",this._checked=!1}connectedCallback(){super.connectedCallback()}attributeChangedCallback(e,c,s){e==="defaultChecked"&&(this._checked=this.defaultChecked),e==="checked"&&(this._checked=this.checked===""||this.checked==="true"||this.checked===!0),super.attributeChangedCallback(e,c,s)}updated(e){e.has("checked")&&this.checked!==null&&(this._checked=this.checked===""||this.checked==="true"||this.checked===!0,(e.get("checked")===""||e.get("checked")==="true"||e.get("checked")===!0)!==this._checked&&this.toggleChecked()),super.updated(e)}render(){const e=o.e({"pkt-input-check__input":!0,"pkt-input-check__input--tile":this.hasTile,"pkt-input-check__input--tile-disabled":this.disabled&&this.hasTile}),c=o.e({"pkt-input-check__input-checkbox":!0,"pkt-input-check__input-checkbox--error":this.hasError});return t.x`
2
2
  <div class="pkt-input-check">
3
3
  <div class=${e}>
4
4
  <input
@@ -1,6 +1,6 @@
1
1
  import { E as n, x as r, n as s, a as o } from "./element-DjjF_tEh.js";
2
2
  import { r as k } from "./state-BtbpSrdV.js";
3
- import { P as f } from "./input-element-Bic-t96S.js";
3
+ import { P as f } from "./input-element-aQDMXDVQ.js";
4
4
  import { e as _, n as b } from "./ref-iIffqQAI.js";
5
5
  import { e as a } from "./class-map-KyMqi0fa.js";
6
6
  var C = Object.defineProperty, v = Object.getOwnPropertyDescriptor, i = (e, t, l, p) => {
@@ -2,10 +2,10 @@ import { x as h, n as c, a as $ } from "./element-DjjF_tEh.js";
2
2
  import { r as b } from "./state-BtbpSrdV.js";
3
3
  import { e as u, n as d } from "./ref-iIffqQAI.js";
4
4
  import { o as s } from "./if-defined-BErSJCeJ.js";
5
- import { P as v } from "./input-element-Bic-t96S.js";
6
- import { P as f } from "./pkt-options-controller-CFmzX4xL.js";
7
- import { P as m } from "./pkt-slot-controller-DFrc5O93.js";
8
- import "./input-wrapper-CeeNYbDA.js";
5
+ import { P as v } from "./input-element-aQDMXDVQ.js";
6
+ import { P as f } from "./pkt-options-controller-DepYQBqb.js";
7
+ import { P as m } from "./pkt-slot-controller-DtDaD9q_.js";
8
+ import "./input-wrapper-BdeoMGnk.js";
9
9
  var g = Object.defineProperty, C = Object.getOwnPropertyDescriptor, a = (e, t, i, o) => {
10
10
  for (var r = o > 1 ? void 0 : o ? C(t, i) : t, n = e.length - 1, p; n >= 0; n--)
11
11
  (p = e[n]) && (r = (o ? p(t, i, r) : p(r)) || r);
@@ -1,4 +1,4 @@
1
- "use strict";const r=require("./element-BSypUpzA.cjs"),u=require("./state-B5KCNjEd.cjs"),l=require("./ref-BvbyvXRH.cjs"),o=require("./if-defined-a3sotaUr.cjs"),d=require("./input-element-C9ma8cdz.cjs"),c=require("./pkt-options-controller-TJ1apYGF.cjs"),$=require("./pkt-slot-controller-plQxXRvV.cjs");require("./input-wrapper-Cn929YTV.cjs");var b=Object.defineProperty,v=Object.getOwnPropertyDescriptor,n=(a,e,t,i)=>{for(var s=i>1?void 0:i?v(e,t):e,p=a.length-1,h;p>=0;p--)(h=a[p])&&(s=(i?h(e,t,s):h(s))||s);return i&&s&&b(e,t,s),s};exports.PktSelect=class extends d.PktInputElement{constructor(){super(),this.inputRef=l.e(),this.helptextSlot=l.e(),this.options=[],this.value="",this._options=[],this.optionsController=new c.PktOptionsSlotController(this),this.slotController=new $.PktSlotController(this,this.helptextSlot),this.slotController.skipOptions=!0}connectedCallback(){super.connectedCallback();const e=this.options.length>0,t=this.optionsController.nodes.length&&this.optionsController.nodes.length>0;!e&&t?this.optionsController.nodes.forEach(i=>{const s={value:i.getAttribute("value")||i.textContent||"",label:i.textContent||i.getAttribute("value")||"",disabled:!!i.getAttribute("disabled")};i.getAttribute("selected")&&!this.value&&(this.value=s.value),this._options.push(s)}):this._options=this.options}attributeChangedCallback(e,t,i){e==="options"&&(this._options=i?JSON.parse(i):[]),e==="value"&&this.value!==t&&this.valueChanged(i,t),super.attributeChangedCallback(e,t,i)}updated(e){var t;super.updated(e),e.has("value")&&(this.counterCurrent=((t=this.value)==null?void 0:t.length)||0,this.valueChanged(this.value,e.get("value"))),e.has("id")&&!this.name&&this.id&&(this.name=this.id)}firstUpdated(e){super.firstUpdated(e),this.options.length&&(this._options=this.options)}render(){const e=`pkt-input ${this.fullwidth?"pkt-input--fullwidth":""}`;return r.x`
1
+ "use strict";const r=require("./element-BSypUpzA.cjs"),u=require("./state-B5KCNjEd.cjs"),l=require("./ref-BvbyvXRH.cjs"),o=require("./if-defined-a3sotaUr.cjs"),d=require("./input-element-XmmyUZmB.cjs"),c=require("./pkt-options-controller-Ay9ELZTV.cjs"),$=require("./pkt-slot-controller-Da-RgXfS.cjs");require("./input-wrapper-B-f_SotM.cjs");var b=Object.defineProperty,v=Object.getOwnPropertyDescriptor,n=(a,e,t,i)=>{for(var s=i>1?void 0:i?v(e,t):e,p=a.length-1,h;p>=0;p--)(h=a[p])&&(s=(i?h(e,t,s):h(s))||s);return i&&s&&b(e,t,s),s};exports.PktSelect=class extends d.PktInputElement{constructor(){super(),this.inputRef=l.e(),this.helptextSlot=l.e(),this.options=[],this.value="",this._options=[],this.optionsController=new c.PktOptionsSlotController(this),this.slotController=new $.PktSlotController(this,this.helptextSlot),this.slotController.skipOptions=!0}connectedCallback(){super.connectedCallback();const e=this.options.length>0,t=this.optionsController.nodes.length&&this.optionsController.nodes.length>0;!e&&t?this.optionsController.nodes.forEach(i=>{const s={value:i.getAttribute("value")||i.textContent||"",label:i.textContent||i.getAttribute("value")||"",disabled:!!i.getAttribute("disabled")};i.getAttribute("selected")&&!this.value&&(this.value=s.value),this._options.push(s)}):this._options=this.options}attributeChangedCallback(e,t,i){e==="options"&&(this._options=i?JSON.parse(i):[]),e==="value"&&this.value!==t&&this.valueChanged(i,t),super.attributeChangedCallback(e,t,i)}updated(e){var t;super.updated(e),e.has("value")&&(this.counterCurrent=((t=this.value)==null?void 0:t.length)||0,this.valueChanged(this.value,e.get("value"))),e.has("id")&&!this.name&&this.id&&(this.name=this.id)}firstUpdated(e){super.firstUpdated(e),this.options.length&&(this._options=this.options)}render(){const e=`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}
@@ -1,4 +1,4 @@
1
- "use strict";const u=require("./class-map-DCyaICmy.cjs"),t=require("./element-BSypUpzA.cjs"),k=require("./state-B5KCNjEd.cjs"),g=require("./pkt-slot-controller-plQxXRvV.cjs"),c=require("./ref-BvbyvXRH.cjs");require("./icon-BnKGwYjj.cjs");const h=require("./if-defined-a3sotaUr.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-DCyaICmy.cjs"),t=require("./element-BSypUpzA.cjs"),k=require("./state-B5KCNjEd.cjs"),g=require("./pkt-slot-controller-Da-RgXfS.cjs"),c=require("./ref-BvbyvXRH.cjs");require("./icon-BnKGwYjj.cjs");const h=require("./if-defined-a3sotaUr.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-KyMqi0fa.js";
2
2
  import { P as m, x as l, n as r, a as g } from "./element-DjjF_tEh.js";
3
3
  import { r as k } from "./state-BtbpSrdV.js";
4
- import { P as y } from "./pkt-slot-controller-DFrc5O93.js";
4
+ import { P as y } from "./pkt-slot-controller-DtDaD9q_.js";
5
5
  import { e as b, n as f } from "./ref-iIffqQAI.js";
6
6
  import "./icon-Beoxup8E.js";
7
7
  import { o as d } from "./if-defined-BErSJCeJ.js";
@@ -5,9 +5,9 @@ import { e as m, n as c } from "./ref-iIffqQAI.js";
5
5
  import { e as v } from "./class-map-KyMqi0fa.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-8uS_Izwn.js";
8
- import { P as C } from "./input-element-Bic-t96S.js";
9
- import { P as E } from "./pkt-slot-controller-DFrc5O93.js";
10
- import "./input-wrapper-CeeNYbDA.js";
8
+ import { P as C } from "./input-element-aQDMXDVQ.js";
9
+ import { P as E } from "./pkt-slot-controller-DtDaD9q_.js";
10
+ import "./input-wrapper-BdeoMGnk.js";
11
11
  import "./icon-Beoxup8E.js";
12
12
  /**
13
13
  * @license
@@ -1,4 +1,4 @@
1
- "use strict";const s=require("./element-BSypUpzA.cjs"),p=require("./if-defined-a3sotaUr.cjs"),c=require("./state-B5KCNjEd.cjs"),l=require("./ref-BvbyvXRH.cjs"),$=require("./class-map-DCyaICmy.cjs"),a=require("./directive-C7oCP5Bh.cjs"),d=require("./directive-helpers-CG7Oxal3.cjs"),x=require("./input-element-C9ma8cdz.cjs"),T=require("./pkt-slot-controller-plQxXRvV.cjs");require("./input-wrapper-Cn929YTV.cjs");require("./icon-BnKGwYjj.cjs");/**
1
+ "use strict";const s=require("./element-BSypUpzA.cjs"),p=require("./if-defined-a3sotaUr.cjs"),c=require("./state-B5KCNjEd.cjs"),l=require("./ref-BvbyvXRH.cjs"),$=require("./class-map-DCyaICmy.cjs"),a=require("./directive-C7oCP5Bh.cjs"),d=require("./directive-helpers-CG7Oxal3.cjs"),x=require("./input-element-XmmyUZmB.cjs"),T=require("./pkt-slot-controller-Da-RgXfS.cjs");require("./input-wrapper-B-f_SotM.cjs");require("./icon-BnKGwYjj.cjs");/**
2
2
  * @license
3
3
  * Copyright 2020 Google LLC
4
4
  * SPDX-License-Identifier: BSD-3-Clause
@@ -1,4 +1,4 @@
1
- "use strict";const t=require("./element-BSypUpzA.cjs"),u=require("./if-defined-a3sotaUr.cjs"),l=require("./state-B5KCNjEd.cjs"),p=require("./ref-BvbyvXRH.cjs"),c=require("./class-map-DCyaICmy.cjs"),d=require("./input-element-C9ma8cdz.cjs"),x=require("./pkt-slot-controller-plQxXRvV.cjs");require("./input-wrapper-Cn929YTV.cjs");require("./icon-BnKGwYjj.cjs");var $=Object.defineProperty,g=Object.getOwnPropertyDescriptor,r=(o,i,s,n)=>{for(var e=n>1?void 0:n?g(i,s):i,a=o.length-1,h;a>=0;a--)(h=o[a])&&(e=(n?h(i,s,e):h(e))||e);return n&&e&&$(i,s,e),e};exports.PktTextinput=class extends d.PktInputElement{constructor(){super(),this.inputRef=p.e(),this.helptextSlot=p.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 x.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-BSypUpzA.cjs"),u=require("./if-defined-a3sotaUr.cjs"),l=require("./state-B5KCNjEd.cjs"),a=require("./ref-BvbyvXRH.cjs"),c=require("./class-map-DCyaICmy.cjs"),d=require("./input-element-XmmyUZmB.cjs"),x=require("./pkt-slot-controller-Da-RgXfS.cjs");require("./input-wrapper-B-f_SotM.cjs");require("./icon-BnKGwYjj.cjs");var $=Object.defineProperty,f=Object.getOwnPropertyDescriptor,r=(h,i,s,n)=>{for(var e=n>1?void 0:n?f(i,s):i,o=h.length-1,p;o>=0;o--)(p=h[o])&&(e=(n?p(i,s,e):p(e))||e);return n&&e&&$(i,s,e),e};exports.PktTextinput=class extends d.PktInputElement{constructor(){super(),this.inputRef=a.e(),this.helptextSlot=a.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 x.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}
@@ -22,11 +22,11 @@
22
22
  .requiredText=${this.requiredText}
23
23
  class="pkt-textinput"
24
24
  >
25
- <div class="pkt-contents" ${p.n(this.helptextSlot)} name="helptext" slot="helptext"></div>
25
+ <div class="pkt-contents" ${a.n(this.helptextSlot)} name="helptext" slot="helptext"></div>
26
26
  <div class="pkt-input__container">
27
27
  ${this.prefix?t.x`<div class="pkt-input-prefix">${this.prefix}</div>`:t.E}
28
28
  <input
29
- ${p.n(this.inputRef)}
29
+ ${a.n(this.inputRef)}
30
30
  class=${s}
31
31
  type=${this.type}
32
32
  name=${(this.name||this.id)+"-input"}
@@ -46,6 +46,7 @@
46
46
  @change=${e=>{e.stopImmediatePropagation()}}
47
47
  @focus=${e=>{this.onFocus(),e.stopImmediatePropagation()}}
48
48
  @blur=${e=>{this.value=e.target.value,this.onBlur(),e.stopImmediatePropagation()}}
49
+ @keydown=${e=>{var o;if(e.key==="Enter"){const p=this.internals.form;p?p.requestSubmit():(o=this.inputRef.value)==null||o.blur()}}}
49
50
  />
50
51
  ${this.suffix?t.x`<div class="pkt-input-suffix">
51
52
  ${this.suffix}
@@ -1,16 +1,16 @@
1
- import { E as p, x as h, n as o, a as $ } from "./element-DjjF_tEh.js";
1
+ import { E as p, x as h, n as a, a as $ } from "./element-DjjF_tEh.js";
2
2
  import { o as c } from "./if-defined-BErSJCeJ.js";
3
3
  import { r as f } from "./state-BtbpSrdV.js";
4
4
  import { e as d, n as m } from "./ref-iIffqQAI.js";
5
5
  import { e as g } from "./class-map-KyMqi0fa.js";
6
- import { P as x } from "./input-element-Bic-t96S.js";
7
- import { P as y } from "./pkt-slot-controller-DFrc5O93.js";
8
- import "./input-wrapper-CeeNYbDA.js";
6
+ import { P as x } from "./input-element-aQDMXDVQ.js";
7
+ import { P as y } from "./pkt-slot-controller-DtDaD9q_.js";
8
+ import "./input-wrapper-BdeoMGnk.js";
9
9
  import "./icon-Beoxup8E.js";
10
- var v = Object.defineProperty, b = Object.getOwnPropertyDescriptor, n = (e, i, r, t) => {
11
- for (var a = t > 1 ? void 0 : t ? b(i, r) : i, l = e.length - 1, u; l >= 0; l--)
12
- (u = e[l]) && (a = (t ? u(i, r, a) : u(a)) || a);
13
- return t && a && v(i, r, a), a;
10
+ var v = Object.defineProperty, b = Object.getOwnPropertyDescriptor, o = (e, i, r, t) => {
11
+ for (var n = t > 1 ? void 0 : t ? b(i, r) : i, l = e.length - 1, u; l >= 0; l--)
12
+ (u = e[l]) && (n = (t ? u(i, r, n) : u(n)) || n);
13
+ return t && n && v(i, r, n), n;
14
14
  };
15
15
  let s = class extends x {
16
16
  constructor() {
@@ -84,6 +84,13 @@ let s = class extends x {
84
84
  }}
85
85
  @blur=${(t) => {
86
86
  this.value = t.target.value, this.onBlur(), t.stopImmediatePropagation();
87
+ }}
88
+ @keydown=${(t) => {
89
+ var n;
90
+ if (t.key === "Enter") {
91
+ const l = this.internals.form;
92
+ l ? l.requestSubmit() : (n = this.inputRef.value) == null || n.blur();
93
+ }
87
94
  }}
88
95
  />
89
96
  ${this.suffix ? h`<div class="pkt-input-suffix">
@@ -104,34 +111,34 @@ let s = class extends x {
104
111
  `;
105
112
  }
106
113
  };
107
- n([
108
- o({ type: String, reflect: !0 })
114
+ o([
115
+ a({ type: String, reflect: !0 })
109
116
  ], s.prototype, "value", 2);
110
- n([
111
- o({ type: String })
117
+ o([
118
+ a({ type: String })
112
119
  ], s.prototype, "type", 2);
113
- n([
114
- o({ type: Number })
120
+ o([
121
+ a({ type: Number })
115
122
  ], s.prototype, "size", 2);
116
- n([
117
- o({ type: String })
123
+ o([
124
+ a({ type: String })
118
125
  ], s.prototype, "autocomplete", 2);
119
- n([
120
- o({ type: String })
126
+ o([
127
+ a({ type: String })
121
128
  ], s.prototype, "iconNameRight", 2);
122
- n([
123
- o({ type: String })
129
+ o([
130
+ a({ type: String })
124
131
  ], s.prototype, "prefix", 2);
125
- n([
126
- o({ type: String })
132
+ o([
133
+ a({ type: String })
127
134
  ], s.prototype, "suffix", 2);
128
- n([
129
- o({ type: Boolean })
135
+ o([
136
+ a({ type: Boolean })
130
137
  ], s.prototype, "omitSearchIcon", 2);
131
- n([
138
+ o([
132
139
  f()
133
140
  ], s.prototype, "counterCurrent", 2);
134
- s = n([
141
+ s = o([
135
142
  $("pkt-textinput")
136
143
  ], s);
137
144
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oslokommune/punkt-elements",
3
- "version": "12.37.0",
3
+ "version": "12.37.2",
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",
@@ -25,13 +25,14 @@
25
25
  "@lit-labs/router": "^0.1.3",
26
26
  "@oslokommune/cookie-manager": "^1.1.0",
27
27
  "date-fns": "^4.1.0",
28
+ "dialog-polyfill": "^0.5.6",
28
29
  "lit": "^3.3.0",
29
30
  "react-dom": ">=18.2.22",
30
31
  "urlpattern-polyfill": "^10.0.0"
31
32
  },
32
33
  "devDependencies": {
33
34
  "@oslokommune/punkt-assets": "^12.37.0",
34
- "@oslokommune/punkt-css": "^12.37.0",
35
+ "@oslokommune/punkt-css": "^12.37.2",
35
36
  "sass": "^1.78.0",
36
37
  "typescript": "^5.6.2",
37
38
  "vite": "^5.4.18",
@@ -58,5 +59,5 @@
58
59
  "url": "https://github.com/oslokommune/punkt/issues"
59
60
  },
60
61
  "license": "MIT",
61
- "gitHead": "119c31d1536757ed597224baa05966cf8bca5ecc"
62
+ "gitHead": "d6608a66551554a1f07952e1c1f7ffe414190a54"
62
63
  }
@@ -82,6 +82,7 @@ export class PktButton extends PktElement<IPktButton> implements IPktButton {
82
82
  super.updated(_changedProperties)
83
83
 
84
84
  this.setAttribute('role', 'button')
85
+ this.internals.role = 'button'
85
86
 
86
87
  if (this.disabled) {
87
88
  if (this.getAttribute('tabindex') !== '-1') {
@@ -73,7 +73,7 @@ export class PktConsent extends PktElement<IPktConsent> implements IPktConsent {
73
73
  protected firstUpdated(_changedProperties: PropertyValues): void {
74
74
  if (
75
75
  !document.querySelector('#oslo-consent-script') &&
76
- window.location.hostname !== 'localhost'
76
+ window.location.hostname.toLowerCase().includes('oslo.kommune.no')
77
77
  ) {
78
78
  window.googleAnalyticsId = this.googleAnalyticsId
79
79
  window.hotjarId = this.hotjarId
@@ -205,13 +205,21 @@ export class PktDatepicker extends PktInputElement {
205
205
  }}
206
206
  ?disabled=${this.disabled}
207
207
  @keydown=${(e: KeyboardEvent) => {
208
- if (e.key === ',' || e.key === 'Enter') {
208
+ if (e.key === ',') {
209
209
  this.inputRef.value?.blur()
210
210
  }
211
211
  if (e.key === 'Space' || e.key === ' ') {
212
212
  e.preventDefault()
213
213
  this.toggleCalendar(e)
214
214
  }
215
+ if (e.key === 'Enter') {
216
+ const form = this.internals.form as HTMLFormElement
217
+ if (form) {
218
+ form.requestSubmit()
219
+ } else {
220
+ this.inputRef.value?.blur()
221
+ }
222
+ }
215
223
  }}
216
224
  @input=${(e: Event) => {
217
225
  this.onInput()
@@ -260,13 +268,21 @@ export class PktDatepicker extends PktInputElement {
260
268
  this.showCalendar()
261
269
  }}
262
270
  @keydown=${(e: KeyboardEvent) => {
263
- if (e.key === ',' || e.key === 'Enter') {
271
+ if (e.key === ',') {
264
272
  this.inputRef.value?.blur()
265
273
  }
266
274
  if (e.key === 'Space' || e.key === ' ') {
267
275
  e.preventDefault()
268
276
  this.toggleCalendar(e)
269
277
  }
278
+ if (e.key === 'Enter') {
279
+ const form = this.internals.form as HTMLFormElement
280
+ if (form) {
281
+ form.requestSubmit()
282
+ } else {
283
+ this.inputRefTo.value?.focus()
284
+ }
285
+ }
270
286
  }}
271
287
  @input=${(e: Event) => {
272
288
  this.onInput()
@@ -315,13 +331,21 @@ export class PktDatepicker extends PktInputElement {
315
331
  this.showCalendar()
316
332
  }}
317
333
  @keydown=${(e: KeyboardEvent) => {
318
- if (e.key === ',' || e.key === 'Enter') {
334
+ if (e.key === ',') {
319
335
  this.inputRefTo.value?.blur()
320
336
  }
321
337
  if (e.key === 'Space' || e.key === ' ') {
322
338
  e.preventDefault()
323
339
  this.toggleCalendar(e)
324
340
  }
341
+ if (e.key === 'Enter') {
342
+ const form = this.internals.form as HTMLFormElement
343
+ if (form) {
344
+ form.requestSubmit()
345
+ } else {
346
+ this.inputRefTo.value?.blur()
347
+ }
348
+ }
325
349
  }}
326
350
  @input=${(e: Event) => {
327
351
  this.onInput()
@@ -399,7 +423,7 @@ export class PktDatepicker extends PktInputElement {
399
423
  }
400
424
  }}
401
425
  @keydown=${(e: KeyboardEvent) => {
402
- if (e.key === ',' || e.key === 'Enter') {
426
+ if (e.key === ',') {
403
427
  e.preventDefault()
404
428
  this.addToSelected(e)
405
429
  }
@@ -407,6 +431,14 @@ export class PktDatepicker extends PktInputElement {
407
431
  e.preventDefault()
408
432
  this.toggleCalendar(e)
409
433
  }
434
+ if (e.key === 'Enter') {
435
+ const form = this.internals.form as HTMLFormElement
436
+ if (form) {
437
+ form.requestSubmit()
438
+ } else {
439
+ this.inputRef.value?.blur()
440
+ }
441
+ }
410
442
  }}
411
443
  @change=${(e: Event) => {
412
444
  e.stopImmediatePropagation()
@@ -1,6 +1,6 @@
1
1
  import { classMap } from 'lit/directives/class-map.js'
2
2
  import { customElement, property, state } from 'lit/decorators.js'
3
- import { html, nothing } from 'lit'
3
+ import { html, nothing, PropertyValues } from 'lit'
4
4
  import { PktElement } from '@/base-elements/element'
5
5
  import { PktSlotController } from '@/controllers/pkt-slot-controller'
6
6
  import { ref } from 'lit/directives/ref.js'
@@ -9,7 +9,6 @@ import { TPktSize } from '@/types/size'
9
9
  import specs from 'componentSpecs/modal.json'
10
10
  import '@/components/icon'
11
11
 
12
- // TODO: Exchange <button> here with <pkt-button> when it is available in pkt-elements
13
12
  export interface IPktModal {
14
13
  headingText?: string
15
14
  removePadding?: boolean
@@ -53,6 +52,19 @@ export class PktModal extends PktElement implements IPktModal {
53
52
  document.removeEventListener('click', this.handleBackdropClick)
54
53
  }
55
54
 
55
+ protected async firstUpdated(_changedProperties: PropertyValues): Promise<void> {
56
+ super.firstUpdated(_changedProperties)
57
+ if (this.dialogRef.value) {
58
+ if ('document' in window && 'createElement' in document) {
59
+ const dialogPolyfill = await import('dialog-polyfill').then((module) => module.default)
60
+ dialogPolyfill.registerDialog(this.dialogRef.value)
61
+ }
62
+ this.dialogRef.value.addEventListener('close', () => {
63
+ this.close(new Event('close'), true)
64
+ })
65
+ }
66
+ }
67
+
56
68
  // P R I V A T E M E T H O D S
57
69
  private handleKeyDown(event: KeyboardEvent) {
58
70
  if (event.key === 'Escape') {
@@ -152,6 +152,16 @@ export class PktTextinput extends PktInputElement<Props> {
152
152
  this.onBlur()
153
153
  e.stopImmediatePropagation()
154
154
  }}
155
+ @keydown=${(e: KeyboardEvent) => {
156
+ if (e.key === 'Enter') {
157
+ const form = this.internals.form as HTMLFormElement
158
+ if (form) {
159
+ form.requestSubmit()
160
+ } else {
161
+ this.inputRef.value?.blur()
162
+ }
163
+ }
164
+ }}
155
165
  />
156
166
  ${this.suffix
157
167
  ? html`<div class="pkt-input-suffix">
@@ -1 +0,0 @@
1
- "use strict";const e=require("./element-BSypUpzA.cjs"),f=require("./state-B5KCNjEd.cjs"),c=require("./stringutils-CkVRq4jP.cjs"),y=require("./input-wrapper-EoSAbU-U.cjs");var m=Object.defineProperty,s=(o,t,r,n)=>{for(var a=void 0,l=o.length-1,h;l>=0;l--)(h=o[l])&&(a=h(t,r,a)||a);return a&&m(t,r,a),a};class i extends e.PktElement{constructor(){super(),this.defaultValue=null,this.disabled=!1,this.readonly=!1,this.required=!1,this.max=null,this.maxlength=null,this.min=null,this.minlength=null,this.ariaDescribedBy=null,this.ariaLabelledby=null,this.name="",this.pattern=null,this.placeholder=null,this.id=c.uuidish(),this.counter=!1,this.hasError=!1,this.inline=!1,this.hasFieldset=!1,this.optionalTag=!1,this.requiredTag=!1,this.skipForwardTestid=!1,this.useWrapper=!0,this.fullwidth=!1,this.counterMaxLength=0,this.errorMessage="",this.helptext="",this.helptextDropdown="",this.helptextDropdownButton=y.specs.props.helptextDropdownButton.default,this.label=null,this.optionalText=e.translations.forms.labels.optional,this.requiredText=e.translations.forms.labels.required,this.dataTestid="",this.touched=!1,this.internals=this.attachInternals()}static get formAssociated(){return!0}manageValidity(t){var r,n,a,l,h,u,p,d;t&&(this.required&&!this.value?this.internals.setValidity({valueMissing:!0},e.translations.forms.messages.required,t):(r=t.validity)!=null&&r.typeMismatch||(n=t.validity)!=null&&n.badInput?this.internals.setValidity({typeMismatch:!0},e.translations.forms.messages.invalid,t):(a=t.validity)!=null&&a.patternMismatch?this.internals.setValidity({patternMismatch:!0},e.translations.forms.messages.invalidPattern,t):(l=t.validity)!=null&&l.tooShort||this.minlength&&this.minlength>0&&this.value.length<this.minlength?this.internals.setValidity({tooShort:!0},e.translations.forms.messages.tooShort,t):(h=t.validity)!=null&&h.tooLong||this.maxlength&&this.maxlength>0&&this.value.length>this.maxlength?this.internals.setValidity({tooLong:!0},e.translations.forms.messages.tooLong,t):(u=t.validity)!=null&&u.rangeUnderflow?this.internals.setValidity({rangeUnderflow:!0},e.translations.forms.messages.rangeUnderflow,t):(p=t.validity)!=null&&p.rangeOverflow?this.internals.setValidity({rangeOverflow:!0},e.translations.forms.messages.rangeOverflow,t):(d=t.validity)!=null&&d.customError?this.internals.setValidity({customError:!0},t.validationMessage,t):this.internals.setValidity({}))}setFormValue(t){if(this.internals)if(Array.isArray(t)){const r=new FormData;t.forEach(n=>{r.append(this.name,n)}),this.internals.setFormValue(r)}else this.internals.setFormValue(t)}valueChecked(t){if(!this.touched)return;const r=this.internals.form||this.closest("form");r&&r.querySelectorAll(`pkt-radiobutton[name=${this.name}], input[type=radio][name=${this.name}]`).forEach(n=>{const a=n;a.name===this.name&&a.value!==this.value&&a.checked&&(a.checked=!1)}),typeof t=="string"?(this.checked=t==="true",this.internals.ariaChecked=t==="true"):typeof t=="boolean"&&(this.checked=t,this.internals.ariaChecked=t),this.checked?(this.internals.setFormValue(this.value||"on",this.value||"on"),this.internals.states.add("--checked")):(this.internals.setFormValue("",""),this.internals.states.delete("--checked")),this.dispatchEvent(new Event("change")),this.dispatchEvent(new CustomEvent("value-change",{detail:this.checked,bubbles:!0,composed:!0})),this.internals.reportValidity()}valueChanged(t,r){(r!==this.value||r!==this._value)&&(typeof t=="string"?((this.multiple||this.range)&&t.includes(",")&&(t=t.split(",")),this.value=t,this._value=Array.isArray(t)?t:[t]):Array.isArray(t)?(this.value=this.multiple||this.range?t:t[0],this._value=t):(this.value="",this._value=[]),(!this.value||this.value.length===0)&&r&&r.length!==0?this.clearInputValue():this.value&&this.value.toString()!==(r==null?void 0:r.toString())&&this.onChange(this.value),this.updateComplete.then(()=>this.requestUpdate()))}clearInputValue(){const t=this.multiple||this.range?[]:"";this.value=t,this.internals.setFormValue(t),this.dispatchEvent(new Event("change")),this.dispatchEvent(new CustomEvent("value-change",{detail:t,bubbles:!0,composed:!0}))}onFocus(){this.dispatchEvent(new FocusEvent("focus"))}onBlur(){this.dispatchEvent(new FocusEvent("blur"))}onInput(){this.dispatchEvent(new InputEvent("input"))}onChange(t){if(!this.touched){this.touched=!0,t&&this.setFormValue(t);return}typeof t!="string"&&!Array.isArray(t)||((this.range||this.multiple)&&!Array.isArray(t)&&t.includes(",")&&(t=t.split(",")),!this.multiple&&!this.range&&Array.isArray(t)&&(t=t[0]),this.setFormValue(t),this.manageValidity(this.inputRef.value),this.inputRefTo&&this.manageValidity(this.inputRefTo.value),this.dispatchEvent(new Event("change")),this.dispatchEvent(new CustomEvent("value-change",{detail:t,bubbles:!0,composed:!0})),this.internals.reportValidity())}updated(t){super.updated(t),t.has("dataTestid")&&this.dataTestid&&this.inputRef.value&&(this.skipForwardTestid?this.hasAttribute("data-testid")||this.setAttribute("data-testid",this.dataTestid):(this.inputRef.value.dataset.testid=this.dataTestid,this.removeAttribute("data-testid")))}firstUpdated(t){if(super.firstUpdated(t),this.value&&this.defaultValue!==null&&(this.defaultValue=this.value),this.defaultValue!==null&&!this.value&&this.valueChanged(this.defaultValue,null),this.defaultChecked&&(this.internals.ariaChecked=!0,this.checked=!0),this.required&&(this.internals.ariaRequired=!0),this.disabled&&(this.internals.ariaDisabled=!0),this.id&&!this.name&&(this.name=this.id),this.checked!==void 0){const r=this.checked===""||this.checked==="true"||this.checked===!0;this.internals.ariaChecked=r,this.internals.setFormValue(r?this.value||"on":"",r?this.value||"on":"")}else this.internals.setFormValue(this.value);this.inputRef&&this.inputRef.value&&(this.inputRef.value.setAttribute("form",""),this.manageValidity(this.inputRef.value)),this.inputRefTo&&this.inputRefTo.value&&(this.inputRefTo.value.setAttribute("form",""),this.manageValidity(this.inputRefTo.value))}}s([e.n()],i.prototype,"defaultValue");s([e.n({type:Boolean,reflect:!0})],i.prototype,"disabled");s([e.n({type:Boolean,reflect:!0})],i.prototype,"readonly");s([e.n({type:Boolean,reflect:!0})],i.prototype,"required");s([e.n({type:Number,reflect:!0})],i.prototype,"max");s([e.n({type:Number,reflect:!0})],i.prototype,"maxlength");s([e.n({type:Number,reflect:!0})],i.prototype,"min");s([e.n({type:Number,reflect:!0})],i.prototype,"minlength");s([e.n({type:String})],i.prototype,"ariaDescribedBy");s([e.n({type:String})],i.prototype,"ariaLabelledby");s([e.n({type:String,reflect:!0})],i.prototype,"name");s([e.n({type:String,reflect:!0})],i.prototype,"pattern");s([e.n({type:String,reflect:!0})],i.prototype,"placeholder");s([e.n({type:String,reflect:!0})],i.prototype,"id");s([e.n({type:Boolean})],i.prototype,"counter");s([e.n({type:Boolean})],i.prototype,"hasError");s([e.n({type:Boolean})],i.prototype,"inline");s([e.n({type:Boolean})],i.prototype,"hasFieldset");s([e.n({type:Boolean})],i.prototype,"optionalTag");s([e.n({type:Boolean})],i.prototype,"requiredTag");s([e.n({type:Boolean})],i.prototype,"skipForwardTestid");s([e.n({type:Boolean,reflect:!1})],i.prototype,"useWrapper");s([e.n({type:Boolean,reflect:!0})],i.prototype,"fullwidth");s([e.n({type:Number})],i.prototype,"counterMaxLength");s([e.n({type:String})],i.prototype,"errorMessage");s([e.n({type:String})],i.prototype,"helptext");s([e.n({type:String})],i.prototype,"helptextDropdown");s([e.n({type:String,reflect:!1})],i.prototype,"helptextDropdownButton");s([e.n({type:String})],i.prototype,"label");s([e.n({type:String,reflect:!1})],i.prototype,"optionalText");s([e.n({type:String,reflect:!1})],i.prototype,"requiredText");s([e.n({type:String,attribute:"data-testid"})],i.prototype,"dataTestid");s([f.r()],i.prototype,"touched");exports.PktInputElement=i;
@@ -1,33 +0,0 @@
1
- "use strict";const d=require("./class-map-DCyaICmy.cjs"),l=require("./element-BSypUpzA.cjs"),h=require("./state-B5KCNjEd.cjs"),k=require("./pkt-slot-controller-plQxXRvV.cjs"),r=require("./ref-BvbyvXRH.cjs");require("./icon-BnKGwYjj.cjs");const m={hideCloseButton:{default:!1},closeOnBackdropClick:{default:!1},size:{default:"medium"}},p={props:m};var f=Object.defineProperty,v=Object.getOwnPropertyDescriptor,i=(c,e,t,s)=>{for(var o=s>1?void 0:s?v(e,t):e,n=c.length-1,a;n>=0;n--)(a=c[n])&&(o=(s?a(e,t,o):a(o))||o);return s&&o&&f(e,t,o),o};exports.PktModal=class extends l.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.defaultSlot=r.e(),this.dialogRef=r.e(),this._isOpen=!1,this.close=(e,t=!1)=>{var o;if(!this._isOpen)return;this._isOpen=!1,document.body.classList.remove("pkt-modal--open");const s=document.activeElement;s&&!this.isElementInViewport(s)&&s.scrollIntoView({behavior:"smooth",block:"nearest"}),this.dispatchEvent(new CustomEvent("close",{detail:{origin:e},bubbles:!0,composed:!0})),t||(o=this.dialogRef.value)==null||o.close(),this.requestUpdate()},this.showModal=(e=null)=>{var s;this._isOpen=!0,(s=this.dialogRef.value)==null||s.showModal();const t=document.querySelector(".pkt-modal");requestAnimationFrame(()=>{var o;this.dialogRef.value&&((o=this.dialogRef.value)==null||o.focus())}),t&&document.body.classList.add("pkt-modal--open"),this.dispatchEvent(new CustomEvent("showModal",{detail:{origin:e},bubbles:!0,composed:!0})),this.requestUpdate()},this.slotController=new k.PktSlotController(this,this.defaultSlot),this._isOpen=!1}async connectedCallback(){super.connectedCallback(),document.addEventListener("keydown",this.handleKeyDown),document.addEventListener("click",this.handleBackdropClick)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("click",this.handleBackdropClick)}handleKeyDown(e){e.key==="Escape"&&this.close(e)}handleBackdropClick(e){var t;this.closeOnBackdropClick&&e.target===((t=this.dialogRef)==null?void 0:t.value)&&this.close(e)}isElementInViewport(e){const t=e.getBoundingClientRect();return t.top>=0&&t.left>=0&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&t.right<=(window.innerWidth||document.documentElement.clientWidth)}render(){const e={"pkt-modal":!0,"pkt-modal--removePadding":this.removePadding??!1,"pkt-modal--noHeadingText":this.headingText===""||this.headingText===void 0,[`pkt-modal--${this.size}`]:this.size!==void 0},t={"pkt-modal__headingText":!0,"pkt-txt-24":!0},s={"pkt-modal__content":!0,"pkt-txt-18-light":!0},o=this.closeButtonSkin==="blue",n={"pkt-modal__closeButton":!0,[`pkt-modal__closeButton--${this.closeButtonSkin}`]:!0},a={"pkt-btn":!0,[`pkt-btn--${o?"tertiary":"primary"}`]:!0,"pkt-btn--icon-only":!0,"pkt-btn--medium":!0};return l.x`
2
- <dialog
3
- class=${d.e(e)}
4
- ${r.n(this.dialogRef)}
5
- aria-labelledby="pkt-modal__headingText"
6
- aria-describedby="pkt-modal__content"
7
- @close=${u=>this.close(u,!0)}
8
- >
9
- <div class="pkt-modal__header">
10
- <div class="pkt-modal__header-background"></div>
11
- ${this.headingText?l.x`<h1 id="pkt-modal__headingText" class=${d.e(t)}>
12
- ${this.headingText}
13
- </h1>`:l.E}
14
- ${this.hideCloseButton?l.E:l.x`<div class="${d.e(n)}">
15
- <pkt-button
16
- @click=${u=>this.close(u)}
17
- class=${d.e(a)}
18
- aria-label="close"
19
- iconname="close"
20
- variant="icon-only"
21
- >
22
- </pkt-button>
23
- </div>`}
24
- </div>
25
- <div class="pkt-modal__container">
26
- <div
27
- id="pkt-modal__content"
28
- class=${d.e(s)}
29
- ${r.n(this.defaultSlot)}
30
- ></div>
31
- </div>
32
- </dialog>
33
- `}};i([l.n({type:String,reflect:!0})],exports.PktModal.prototype,"headingText",2);i([l.n({type:Boolean,reflect:!0})],exports.PktModal.prototype,"removePadding",2);i([l.n({type:Boolean,reflect:!0})],exports.PktModal.prototype,"hideCloseButton",2);i([l.n({type:Boolean,reflect:!0})],exports.PktModal.prototype,"closeOnBackdropClick",2);i([l.n({type:String,reflect:!0})],exports.PktModal.prototype,"closeButtonSkin",2);i([l.n({type:String,reflect:!0})],exports.PktModal.prototype,"size",2);i([h.r()],exports.PktModal.prototype,"_isOpen",2);exports.PktModal=i([l.t("pkt-modal")],exports.PktModal);
@@ -1 +0,0 @@
1
- "use strict";function a(i,s){return s.some(t=>t.value===i)}function n(i){return typeof i.hasAttribute=="function"&&i.hasAttribute("data-skip")}function r(i){return i.nodeName==="OPTION"||i.nodeName==="DATA"}function u(i,s){return i.nodeType===Node.ELEMENT_NODE&&!a(i,s)}function d(i){var s;return i.nodeType===Node.TEXT_NODE&&((s=i.nodeValue)==null?void 0:s.trim())!==""}class f{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(o=>this.handleMutations(o)),this.contentObserver=new MutationObserver(o=>this.handleSlotMutations(o))}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=>{n(t)||r(t)&&this.skipOptions||(!a(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 o=t.value.getAttribute("name"),h=this.nodes.flatMap(l=>d(l)||l.getAttribute&&l.getAttribute("slot")==o&&!n(l)?l:[]).filter(l=>t.value&&!t.value.contains(l)&&!l.contains(t.value));if(h.length>0)if(s.add(o),typeof t.value.replaceChildren!="function"){for(;t.value.firstChild;)t.value.removeChild(t.value.firstChild);t.value.append(...h)}else t.value.replaceChildren(...h)}),(this.filledSlots.size!==s.size||![...this.filledSlots].every(t=>s.has(t)))&&(this.filledSlots=s,this.host.requestUpdate()),this.updatingSlots=!1}handleMutations(s){let t=!1;s.forEach(o=>{o.type==="childList"&&(o.addedNodes.forEach(e=>{n(e)||r(e)&&this.skipOptions||(u(e,this.slots)||d(e))&&(this.nodes.push(e),t=!0)}),o.removedNodes.forEach(e=>{n(e)||r(e)&&this.skipOptions||(this.nodes=this.nodes.filter(h=>h!==e),t=!0)}))}),t&&this.updateSlots()}handleSlotMutations(s){let t=!1;s.forEach(o=>{const e=o.target.parentElement;if(e!=null&&e.hasAttribute("slot")){const h=e.getAttribute("slot"),l=e.hasChildNodes();l&&!this.filledSlots.has(h)?(this.filledSlots.add(h),t=!0):!l&&this.filledSlots.has(h)&&(this.filledSlots.delete(h),t=!0)}}),t&&typeof this.host.updateSlots=="function"&&this.host.updateSlots(this.filledSlots)}}exports.PktSlotController=f;exports.isOptionElement=r;