@oslokommune/punkt-elements 14.1.0 → 14.2.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 (54) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/booleanish-BKVonob4.cjs +1 -0
  3. package/dist/booleanish-C9R0tdXH.js +11 -0
  4. package/dist/{checkbox-BP5zOlPy.cjs → checkbox-C0TPnShf.cjs} +1 -1
  5. package/dist/{checkbox-CfXOh6Lw.js → checkbox-CnhA52o_.js} +1 -1
  6. package/dist/{combobox-BWsCkPH2.cjs → combobox-C1xwAju5.cjs} +1 -1
  7. package/dist/{combobox-BMznle0M.js → combobox-Dcp_fHcL.js} +2 -2
  8. package/dist/{datepicker-2s6FUxdi.js → datepicker-Bjb9GK1E.js} +2 -2
  9. package/dist/{datepicker-D1c9oP-2.cjs → datepicker-COIRRau0.cjs} +1 -1
  10. package/dist/index.d.ts +45 -160
  11. package/dist/{input-element-B0VPRK_E.js → input-element-B8M8Nppd.js} +77 -84
  12. package/dist/input-element-D697OAJo.cjs +1 -0
  13. package/dist/{input-wrapper-CAwzMR9o.js → input-wrapper-1PCXqtiu.js} +42 -49
  14. package/dist/{input-wrapper-DXg2N3wx.cjs → input-wrapper-CtBiAb04.cjs} +20 -20
  15. package/dist/pkt-checkbox.cjs +1 -1
  16. package/dist/pkt-checkbox.js +1 -1
  17. package/dist/pkt-combobox.cjs +1 -1
  18. package/dist/pkt-combobox.js +1 -1
  19. package/dist/pkt-datepicker.cjs +1 -1
  20. package/dist/pkt-datepicker.js +2 -2
  21. package/dist/pkt-header.cjs +11 -11
  22. package/dist/pkt-header.js +42 -48
  23. package/dist/pkt-index.cjs +1 -1
  24. package/dist/pkt-index.js +8 -8
  25. package/dist/pkt-input-wrapper.cjs +1 -1
  26. package/dist/pkt-input-wrapper.js +1 -1
  27. package/dist/pkt-radiobutton.cjs +1 -1
  28. package/dist/pkt-radiobutton.js +1 -1
  29. package/dist/pkt-select.cjs +1 -1
  30. package/dist/pkt-select.js +1 -1
  31. package/dist/pkt-textarea.cjs +1 -1
  32. package/dist/pkt-textarea.js +1 -1
  33. package/dist/pkt-textinput.cjs +1 -1
  34. package/dist/pkt-textinput.js +1 -1
  35. package/dist/{radiobutton-BuKXgQm_.cjs → radiobutton-BkqaqO5E.cjs} +1 -1
  36. package/dist/{radiobutton-C_MzK8dE.js → radiobutton-Caq8-GhM.js} +1 -1
  37. package/dist/{select-Ds4Ws1_6.cjs → select-3dwlk22G.cjs} +1 -1
  38. package/dist/{select-CteaDnzz.js → select-_C-yztI0.js} +2 -2
  39. package/dist/{textarea-zeFp1hxO.cjs → textarea-DyUy8u7X.cjs} +1 -1
  40. package/dist/{textarea-D4T9yqw7.js → textarea-a6T4aJJU.js} +2 -2
  41. package/dist/{textinput-Cddq4eF_.js → textinput-DIuM70dd.js} +2 -2
  42. package/dist/{textinput-DFFL5v-U.cjs → textinput-IN3b0nSH.cjs} +1 -1
  43. package/package.json +4 -4
  44. package/src/components/accordion/accordion.ts +2 -1
  45. package/src/components/alert/alert.ts +2 -2
  46. package/src/components/button/button.ts +2 -3
  47. package/src/components/card/card.ts +2 -3
  48. package/src/components/header/types.ts +17 -78
  49. package/src/components/heading/heading.ts +4 -3
  50. package/src/components/input-wrapper/input-wrapper.ts +2 -16
  51. package/src/components/messagebox/messagebox.ts +2 -1
  52. package/src/components/progressbar/progressbar.ts +1 -1
  53. package/src/components/tag/tag.ts +2 -2
  54. package/dist/input-element-BmXkhljw.cjs +0 -1
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("./radiobutton-BuKXgQm_.cjs"),e=t.PktRadioButton;Object.defineProperty(exports,"PktRadioButton",{enumerable:!0,get:()=>t.PktRadioButton});exports.default=e;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("./radiobutton-BkqaqO5E.cjs"),e=t.PktRadioButton;Object.defineProperty(exports,"PktRadioButton",{enumerable:!0,get:()=>t.PktRadioButton});exports.default=e;
@@ -1,4 +1,4 @@
1
- import { P as t } from "./radiobutton-C_MzK8dE.js";
1
+ import { P as t } from "./radiobutton-Caq8-GhM.js";
2
2
  const a = t;
3
3
  export {
4
4
  t as PktRadioButton,
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./select-Ds4Ws1_6.cjs"),t=e.PktSelect;Object.defineProperty(exports,"PktSelect",{enumerable:!0,get:()=>e.PktSelect});exports.default=t;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./select-3dwlk22G.cjs"),t=e.PktSelect;Object.defineProperty(exports,"PktSelect",{enumerable:!0,get:()=>e.PktSelect});exports.default=t;
@@ -1,4 +1,4 @@
1
- import { P as t } from "./select-CteaDnzz.js";
1
+ import { P as t } from "./select-_C-yztI0.js";
2
2
  const a = t;
3
3
  export {
4
4
  t as PktSelect,
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./textarea-zeFp1hxO.cjs"),t=e.PktTextarea;Object.defineProperty(exports,"PktTextarea",{enumerable:!0,get:()=>e.PktTextarea});exports.default=t;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./textarea-DyUy8u7X.cjs"),t=e.PktTextarea;Object.defineProperty(exports,"PktTextarea",{enumerable:!0,get:()=>e.PktTextarea});exports.default=t;
@@ -1,4 +1,4 @@
1
- import { P as a } from "./textarea-D4T9yqw7.js";
1
+ import { P as a } from "./textarea-a6T4aJJU.js";
2
2
  const e = a;
3
3
  export {
4
4
  a as PktTextarea,
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./textinput-DFFL5v-U.cjs"),t=e.PktTextinput;Object.defineProperty(exports,"PktTextinput",{enumerable:!0,get:()=>e.PktTextinput});exports.default=t;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./textinput-IN3b0nSH.cjs"),t=e.PktTextinput;Object.defineProperty(exports,"PktTextinput",{enumerable:!0,get:()=>e.PktTextinput});exports.default=t;
@@ -1,4 +1,4 @@
1
- import { P as t } from "./textinput-Cddq4eF_.js";
1
+ import { P as t } from "./textinput-DIuM70dd.js";
2
2
  const p = t;
3
3
  export {
4
4
  t as PktTextinput,
@@ -1,4 +1,4 @@
1
- "use strict";const t=require("./element-CJ_QKaki.cjs"),r=require("./state-DSjcvzDN.cjs"),u=require("./input-element-BmXkhljw.cjs"),h=require("./ref-BFa5Utho.cjs"),c=require("./class-map-C_erArZz.cjs");var d=Object.defineProperty,k=Object.getOwnPropertyDescriptor,i=(p,e,n,a)=>{for(var s=a>1?void 0:a?k(e,n):e,o=p.length-1,l;o>=0;o--)(l=p[o])&&(s=(a?l(e,n,s):l(s))||s);return a&&s&&d(e,n,s),s};exports.PktRadioButton=class extends u.PktInputElement{constructor(){super(...arguments),this.inputRef=h.e(),this.value="",this.checkHelptext=null,this.defaultChecked=!1,this.hasTile=!1,this.checked=null,this.type="radio",this.tagText=null,this.optionalTag=!1,this.optionalText="Valgfritt",this.requiredTag=!1,this.requiredText="Må fylles ut",this._checked=!1}connectedCallback(){super.connectedCallback()}attributeChangedCallback(e,n,a){e==="defaultChecked"&&(this._checked=this.defaultChecked),e==="checked"&&(this._checked=this.checked===""||this.checked==="true"||this.checked===!0),super.attributeChangedCallback(e,n,a)}render(){const e=c.e({"pkt-input-check__input":!0,"pkt-input-check__input--tile":this.hasTile,"pkt-input-check__input--tile-disabled":this.disabled&&this.hasTile}),n=c.e({"pkt-input-check__input-checkbox":!0,"pkt-input-check__input-checkbox--error":this.hasError}),a=c.e({"pkt-input-check__input-label":!0,"pkt-input-check__input-label--disabled":this.disabled,"pkt-sr-only":this.hideLabel}),s="pkt-tag pkt-tag--small pkt-tag--thin-text",o=()=>t.x`
1
+ "use strict";const t=require("./element-CJ_QKaki.cjs"),r=require("./state-DSjcvzDN.cjs"),u=require("./input-element-D697OAJo.cjs"),h=require("./ref-BFa5Utho.cjs"),c=require("./class-map-C_erArZz.cjs");var d=Object.defineProperty,k=Object.getOwnPropertyDescriptor,i=(p,e,n,a)=>{for(var s=a>1?void 0:a?k(e,n):e,o=p.length-1,l;o>=0;o--)(l=p[o])&&(s=(a?l(e,n,s):l(s))||s);return a&&s&&d(e,n,s),s};exports.PktRadioButton=class extends u.PktInputElement{constructor(){super(...arguments),this.inputRef=h.e(),this.value="",this.checkHelptext=null,this.defaultChecked=!1,this.hasTile=!1,this.checked=null,this.type="radio",this.tagText=null,this.optionalTag=!1,this.optionalText="Valgfritt",this.requiredTag=!1,this.requiredText="Må fylles ut",this._checked=!1}connectedCallback(){super.connectedCallback()}attributeChangedCallback(e,n,a){e==="defaultChecked"&&(this._checked=this.defaultChecked),e==="checked"&&(this._checked=this.checked===""||this.checked==="true"||this.checked===!0),super.attributeChangedCallback(e,n,a)}render(){const e=c.e({"pkt-input-check__input":!0,"pkt-input-check__input--tile":this.hasTile,"pkt-input-check__input--tile-disabled":this.disabled&&this.hasTile}),n=c.e({"pkt-input-check__input-checkbox":!0,"pkt-input-check__input-checkbox--error":this.hasError}),a=c.e({"pkt-input-check__input-label":!0,"pkt-input-check__input-label--disabled":this.disabled,"pkt-sr-only":this.hideLabel}),s="pkt-tag pkt-tag--small pkt-tag--thin-text",o=()=>t.x`
2
2
  ${this.tagText?t.x`<span class=${s+" pkt-tag--gray"}>${this.tagText}</span>`:t.E}
3
3
  ${this.optionalTag?t.x`<span class=${s+" pkt-tag--blue-light"}>${this.optionalText}</span>`:t.E}
4
4
  ${this.requiredTag?t.x`<span class=${s+" pkt-tag--beige"}>${this.requiredText}</span>`:t.E}
@@ -1,6 +1,6 @@
1
1
  import { x as h, E as n, n as s, a as d } from "./element-CRDRygXu.js";
2
2
  import { r as k } from "./state-DS_kr2Fy.js";
3
- import { P as f } from "./input-element-B0VPRK_E.js";
3
+ import { P as f } from "./input-element-B8M8Nppd.js";
4
4
  import { e as g, n as y } from "./ref-Xa5dbh--.js";
5
5
  import { e as u } from "./class-map-wy7PUk0P.js";
6
6
  var $ = Object.defineProperty, b = Object.getOwnPropertyDescriptor, i = (e, p, c, l) => {
@@ -1,4 +1,4 @@
1
- "use strict";const h=require("./element-CJ_QKaki.cjs"),u=require("./state-DSjcvzDN.cjs"),r=require("./ref-BFa5Utho.cjs"),o=require("./if-defined-Bc9-_I01.cjs"),d=require("./input-element-BmXkhljw.cjs"),c=require("./pkt-options-controller-CiuBG6Lt.cjs"),v=require("./pkt-slot-controller-BzddBp7z.cjs");require("./input-wrapper-DXg2N3wx.cjs");var f=Object.defineProperty,_=Object.getOwnPropertyDescriptor,a=(p,t,e,s)=>{for(var i=s>1?void 0:s?_(t,e):t,l=p.length-1,n;l>=0;l--)(n=p[l])&&(i=(s?n(t,e,i):n(i))||i);return s&&i&&f(t,e,i),i};exports.PktSelect=class extends d.PktInputElement{constructor(){super(),this.inputRef=r.e(),this.helptextSlot=r.e(),this._optionsProp=[],this.value="",this._options=[],this.selectedIndex=-1,this.selectedOptions=void 0,this.optionsController=new c.PktOptionsSlotController(this),this.slotController=new v.PktSlotController(this,this.helptextSlot),this.slotController.skipOptions=!0}get options(){return this._options.map(t=>({...t,selected:t.value===this.value}))}set options(t){this._optionsProp=t,this.requestUpdate("_optionsProp",this._options)}connectedCallback(){super.connectedCallback();const t=this._optionsProp.length>0,e=this.optionsController.nodes.length&&this.optionsController.nodes.length>0;!t&&e?this.optionsController.nodes.forEach(s=>{const i={value:s.hasAttribute("value")?s.getAttribute("value")??"":s.textContent??"",label:s.textContent||s.getAttribute("value")||"",disabled:s.hasAttribute("disabled"),selected:s.hasAttribute("selected"),hidden:s.hasAttribute("data-hidden")};s.getAttribute("selected")&&!this.value&&(this.value=i.value),this._options.push(i)}):(this._options=this._optionsProp,this._options.forEach(s=>{s.selected&&!this.value&&(this.value=s.value)}))}add(t,e){const s={value:t.value||t.text,label:t.text||t.value,selected:t.selected,disabled:t.disabled};if(e===void 0)this._options.push(s);else if(typeof e=="number")this._options.splice(e,0,s);else{const i=e.value||e.text,l=this._options.findIndex(n=>n.value===i);l>=0?this._options.splice(l,0,s):this._options.push(s)}t.selected&&(this.value=t.value||t.text,this.selectedIndex=this._options.findIndex(i=>i.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,s){var i,l;t==="options"&&(this._options=s?JSON.parse(s):[]),t==="value"&&this.value!==e&&(this.selectedIndex=this.touched?this.returnNumberOrNull((i=this.inputRef.value)==null?void 0:i.selectedIndex):this._options.findIndex(n=>n.value===s),this.selectedOptions=(l=this.inputRef.value)==null?void 0:l.selectedOptions,this.valueChanged(s,e)),super.attributeChangedCallback(t,e,s)}update(t){var e,s;super.update(t),t.has("_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(i=>i.value===this.value),this.selectedOptions=(s=this.inputRef.value)==null?void 0:s.selectedOptions,this.valueChanged(this.value,t.get("value"))),t.has("id")&&!this.name&&this.id&&(this.name=this.id)}firstUpdated(t){var e;super.firstUpdated(t),this._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(s=>s.value===this.value),this.selectedOptions=(e=this.inputRef.value)==null?void 0:e.selectedOptions}render(){const t=`pkt-input ${this.fullwidth?"pkt-input--fullwidth":""}`;return h.x`
1
+ "use strict";const h=require("./element-CJ_QKaki.cjs"),u=require("./state-DSjcvzDN.cjs"),r=require("./ref-BFa5Utho.cjs"),o=require("./if-defined-Bc9-_I01.cjs"),d=require("./input-element-D697OAJo.cjs"),c=require("./pkt-options-controller-CiuBG6Lt.cjs"),v=require("./pkt-slot-controller-BzddBp7z.cjs");require("./input-wrapper-CtBiAb04.cjs");var f=Object.defineProperty,_=Object.getOwnPropertyDescriptor,a=(p,t,e,s)=>{for(var i=s>1?void 0:s?_(t,e):t,l=p.length-1,n;l>=0;l--)(n=p[l])&&(i=(s?n(t,e,i):n(i))||i);return s&&i&&f(t,e,i),i};exports.PktSelect=class extends d.PktInputElement{constructor(){super(),this.inputRef=r.e(),this.helptextSlot=r.e(),this._optionsProp=[],this.value="",this._options=[],this.selectedIndex=-1,this.selectedOptions=void 0,this.optionsController=new c.PktOptionsSlotController(this),this.slotController=new v.PktSlotController(this,this.helptextSlot),this.slotController.skipOptions=!0}get options(){return this._options.map(t=>({...t,selected:t.value===this.value}))}set options(t){this._optionsProp=t,this.requestUpdate("_optionsProp",this._options)}connectedCallback(){super.connectedCallback();const t=this._optionsProp.length>0,e=this.optionsController.nodes.length&&this.optionsController.nodes.length>0;!t&&e?this.optionsController.nodes.forEach(s=>{const i={value:s.hasAttribute("value")?s.getAttribute("value")??"":s.textContent??"",label:s.textContent||s.getAttribute("value")||"",disabled:s.hasAttribute("disabled"),selected:s.hasAttribute("selected"),hidden:s.hasAttribute("data-hidden")};s.getAttribute("selected")&&!this.value&&(this.value=i.value),this._options.push(i)}):(this._options=this._optionsProp,this._options.forEach(s=>{s.selected&&!this.value&&(this.value=s.value)}))}add(t,e){const s={value:t.value||t.text,label:t.text||t.value,selected:t.selected,disabled:t.disabled};if(e===void 0)this._options.push(s);else if(typeof e=="number")this._options.splice(e,0,s);else{const i=e.value||e.text,l=this._options.findIndex(n=>n.value===i);l>=0?this._options.splice(l,0,s):this._options.push(s)}t.selected&&(this.value=t.value||t.text,this.selectedIndex=this._options.findIndex(i=>i.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,s){var i,l;t==="options"&&(this._options=s?JSON.parse(s):[]),t==="value"&&this.value!==e&&(this.selectedIndex=this.touched?this.returnNumberOrNull((i=this.inputRef.value)==null?void 0:i.selectedIndex):this._options.findIndex(n=>n.value===s),this.selectedOptions=(l=this.inputRef.value)==null?void 0:l.selectedOptions,this.valueChanged(s,e)),super.attributeChangedCallback(t,e,s)}update(t){var e,s;super.update(t),t.has("_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(i=>i.value===this.value),this.selectedOptions=(s=this.inputRef.value)==null?void 0:s.selectedOptions,this.valueChanged(this.value,t.get("value"))),t.has("id")&&!this.name&&this.id&&(this.name=this.id)}firstUpdated(t){var e;super.firstUpdated(t),this._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(s=>s.value===this.value),this.selectedOptions=(e=this.inputRef.value)==null?void 0:e.selectedOptions}render(){const t=`pkt-input ${this.fullwidth?"pkt-input--fullwidth":""}`;return h.x`
2
2
  <pkt-input-wrapper
3
3
  ?counter=${this.counter}
4
4
  ?disabled=${this.disabled}
@@ -2,10 +2,10 @@ import { x as r, n as c, a as v } from "./element-CRDRygXu.js";
2
2
  import { r as f } from "./state-DS_kr2Fy.js";
3
3
  import { e as u, n as d } from "./ref-Xa5dbh--.js";
4
4
  import { o as l } from "./if-defined-BWZGb3bh.js";
5
- import { P as _ } from "./input-element-B0VPRK_E.js";
5
+ import { P as _ } from "./input-element-B8M8Nppd.js";
6
6
  import { P as x } from "./pkt-options-controller-CZO1nxZ8.js";
7
7
  import { P as b } from "./pkt-slot-controller-BPGj-LC5.js";
8
- import "./input-wrapper-CAwzMR9o.js";
8
+ import "./input-wrapper-1PCXqtiu.js";
9
9
  var $ = Object.defineProperty, m = Object.getOwnPropertyDescriptor, a = (t, e, s, i) => {
10
10
  for (var o = i > 1 ? void 0 : i ? m(e, s) : e, n = t.length - 1, p; n >= 0; n--)
11
11
  (p = t[n]) && (o = (i ? p(e, s, o) : p(o)) || o);
@@ -1,4 +1,4 @@
1
- "use strict";const s=require("./element-CJ_QKaki.cjs"),p=require("./if-defined-Bc9-_I01.cjs"),c=require("./state-DSjcvzDN.cjs"),l=require("./ref-BFa5Utho.cjs"),$=require("./class-map-C_erArZz.cjs"),a=require("./directive-C7oCP5Bh.cjs"),d=require("./directive-helpers-4oOjKnGY.cjs"),x=require("./input-element-BmXkhljw.cjs"),T=require("./pkt-slot-controller-BzddBp7z.cjs");require("./input-wrapper-DXg2N3wx.cjs");require("./icon-MRx-m0Or.cjs");/**
1
+ "use strict";const s=require("./element-CJ_QKaki.cjs"),p=require("./if-defined-Bc9-_I01.cjs"),c=require("./state-DSjcvzDN.cjs"),l=require("./ref-BFa5Utho.cjs"),$=require("./class-map-C_erArZz.cjs"),a=require("./directive-C7oCP5Bh.cjs"),d=require("./directive-helpers-4oOjKnGY.cjs"),x=require("./input-element-D697OAJo.cjs"),T=require("./pkt-slot-controller-BzddBp7z.cjs");require("./input-wrapper-CtBiAb04.cjs");require("./icon-MRx-m0Or.cjs");/**
2
2
  * @license
3
3
  * Copyright 2020 Google LLC
4
4
  * SPDX-License-Identifier: BSD-3-Clause
@@ -5,9 +5,9 @@ import { e as m, n as c } from "./ref-Xa5dbh--.js";
5
5
  import { e as v } from "./class-map-wy7PUk0P.js";
6
6
  import { e as T, i as b, t as a } from "./directive-oAbCiebi.js";
7
7
  import { f as y, m as w } from "./directive-helpers-BzAtj9by.js";
8
- import { P as C } from "./input-element-B0VPRK_E.js";
8
+ import { P as C } from "./input-element-B8M8Nppd.js";
9
9
  import { P as E } from "./pkt-slot-controller-BPGj-LC5.js";
10
- import "./input-wrapper-CAwzMR9o.js";
10
+ import "./input-wrapper-1PCXqtiu.js";
11
11
  import "./icon-BB7e5iQN.js";
12
12
  /**
13
13
  * @license
@@ -3,9 +3,9 @@ import { o as u } from "./if-defined-BWZGb3bh.js";
3
3
  import { r as f } from "./state-DS_kr2Fy.js";
4
4
  import { e as d, n as m } from "./ref-Xa5dbh--.js";
5
5
  import { e as g } from "./class-map-wy7PUk0P.js";
6
- import { P as x } from "./input-element-B0VPRK_E.js";
6
+ import { P as x } from "./input-element-B8M8Nppd.js";
7
7
  import { P as v } from "./pkt-slot-controller-BPGj-LC5.js";
8
- import "./input-wrapper-CAwzMR9o.js";
8
+ import "./input-wrapper-1PCXqtiu.js";
9
9
  import "./icon-BB7e5iQN.js";
10
10
  var y = Object.defineProperty, b = Object.getOwnPropertyDescriptor, o = (i, e, r, t) => {
11
11
  for (var n = t > 1 ? void 0 : t ? b(e, r) : e, l = i.length - 1, c; l >= 0; l--)
@@ -1,4 +1,4 @@
1
- "use strict";const t=require("./element-CJ_QKaki.cjs"),a=require("./if-defined-Bc9-_I01.cjs"),l=require("./state-DSjcvzDN.cjs"),h=require("./ref-BFa5Utho.cjs"),c=require("./class-map-C_erArZz.cjs"),d=require("./input-element-BmXkhljw.cjs"),x=require("./pkt-slot-controller-BzddBp7z.cjs");require("./input-wrapper-DXg2N3wx.cjs");require("./icon-MRx-m0Or.cjs");var $=Object.defineProperty,f=Object.getOwnPropertyDescriptor,r=(u,i,s,n)=>{for(var e=n>1?void 0:n?f(i,s):i,o=u.length-1,p;o>=0;o--)(p=u[o])&&(e=(n?p(i,s,e):p(e))||e);return n&&e&&$(i,s,e),e};exports.PktTextinput=class extends d.PktInputElement{constructor(){super(),this.inputRef=h.e(),this.helptextSlot=h.e(),this.value="",this.type="text",this.size=null,this.autocomplete=null,this.iconNameRight=null,this.prefix=null,this.suffix=null,this.omitSearchIcon=!1,this.counterCurrent=0,this.slotController=new 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-CJ_QKaki.cjs"),a=require("./if-defined-Bc9-_I01.cjs"),l=require("./state-DSjcvzDN.cjs"),h=require("./ref-BFa5Utho.cjs"),c=require("./class-map-C_erArZz.cjs"),d=require("./input-element-D697OAJo.cjs"),x=require("./pkt-slot-controller-BzddBp7z.cjs");require("./input-wrapper-CtBiAb04.cjs");require("./icon-MRx-m0Or.cjs");var $=Object.defineProperty,f=Object.getOwnPropertyDescriptor,r=(u,i,s,n)=>{for(var e=n>1?void 0:n?f(i,s):i,o=u.length-1,p;o>=0;o--)(p=u[o])&&(e=(n?p(i,s,e):p(e))||e);return n&&e&&$(i,s,e),e};exports.PktTextinput=class extends d.PktInputElement{constructor(){super(),this.inputRef=h.e(),this.helptextSlot=h.e(),this.value="",this.type="text",this.size=null,this.autocomplete=null,this.iconNameRight=null,this.prefix=null,this.suffix=null,this.omitSearchIcon=!1,this.counterCurrent=0,this.slotController=new 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}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oslokommune/punkt-elements",
3
- "version": "14.1.0",
3
+ "version": "14.2.0",
4
4
  "description": "Komponentbiblioteket til Punkt, et designsystem laget av Oslo Origo",
5
5
  "homepage": "https://punkt.oslo.kommune.no",
6
6
  "author": "Team Designsystem, Oslo Origo",
@@ -41,8 +41,8 @@
41
41
  "@babel/plugin-transform-private-property-in-object": "^7.25.9",
42
42
  "@babel/preset-env": "^7.28.3",
43
43
  "@babel/preset-typescript": "^7.25.9",
44
- "@oslokommune/punkt-assets": "^14.0.4",
45
- "@oslokommune/punkt-css": "^14.0.4",
44
+ "@oslokommune/punkt-assets": "^14.1.1",
45
+ "@oslokommune/punkt-css": "^14.1.1",
46
46
  "@testing-library/jest-dom": "^6.6.3",
47
47
  "@typescript-eslint/eslint-plugin": "^8.46.0",
48
48
  "@typescript-eslint/parser": "^8.46.0",
@@ -79,5 +79,5 @@
79
79
  "url": "https://github.com/oslokommune/punkt/issues"
80
80
  },
81
81
  "license": "MIT",
82
- "gitHead": "5ddba3690f0af28db85f92bd7698af5b54ae8e0b"
82
+ "gitHead": "47682b6620c3d10622e5121814954fa294996b9b"
83
83
  }
@@ -1,8 +1,9 @@
1
1
  import { html, LitElement } from 'lit'
2
2
  import { customElement, property } from 'lit/decorators.js'
3
3
  import { classMap } from 'lit/directives/class-map.js'
4
+ import type { TAccordionSkin } from 'shared-types'
4
5
 
5
- export type TPktAccordionSkin = 'borderless' | 'outlined' | 'beige' | 'blue'
6
+ export type TPktAccordionSkin = TAccordionSkin
6
7
 
7
8
  export interface IPktAccordion {
8
9
  compact?: boolean
@@ -4,14 +4,14 @@ 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, createRef, Ref } from 'lit/directives/ref.js'
7
- import { TAriaLive } from '@/types/aria'
7
+ import type { TAriaLive, TAlertSkin } from 'shared-types'
8
8
  import { updateClassAttribute } from '@/utils/classutils'
9
9
  import specs from 'componentSpecs/alert.json'
10
10
 
11
11
  import '@/components/icon'
12
12
  import '@/components/button'
13
13
 
14
- export type TAlertSkin = 'error' | 'success' | 'warning' | 'info'
14
+ export type { TAlertSkin }
15
15
 
16
16
  export interface IPktAlert {
17
17
  skin?: TAlertSkin
@@ -1,6 +1,7 @@
1
1
  import { PktElement } from '@/base-elements/element'
2
2
  import { PktSlotController } from '@/controllers/pkt-slot-controller'
3
3
  import { PktIconName } from '@oslokommune/punkt-assets/dist/icons/icon'
4
+ import type { Booleanish, THTMLButtonType } from 'shared-types'
4
5
  import { html, nothing, PropertyValues } from 'lit'
5
6
  import { property, customElement } from 'lit/decorators.js'
6
7
  import { classMap } from 'lit/directives/class-map.js'
@@ -12,8 +13,6 @@ import '@/components/icon'
12
13
  // Allow global override of animation assets path
13
14
  window.pktAnimationPath =
14
15
  window.pktAnimationPath || 'https://punkt-cdn.oslo.kommune.no/latest/animations/'
15
-
16
- type Booleanish = boolean | 'true' | 'false'
17
16
  export type TPktButtonMode = 'light' | 'dark'
18
17
  export type TPktButtonSize = 'small' | 'medium' | 'large'
19
18
  export type TPktButtonColor =
@@ -37,7 +36,7 @@ export type TPktButtonVariant =
37
36
  | 'icon-only'
38
37
  | 'icons-right-and-left'
39
38
  export type TPktButtonState = 'normal' | 'focus' | 'hover' | 'active'
40
- export type TPktButtonType = 'button' | 'submit' | 'reset'
39
+ export type TPktButtonType = THTMLButtonType
41
40
 
42
41
  export interface IPktButton {
43
42
  iconName?: PktIconName
@@ -11,10 +11,9 @@ import specs from 'componentSpecs/card.json'
11
11
  import '@/components/icon'
12
12
  import '@/components/tag'
13
13
  import '@/components/heading'
14
- import { IAriaAttributes } from '@/types/aria'
14
+ import type { IAriaAttributes, TCardSkin, TLayout } from 'shared-types'
15
15
 
16
- export type TCardSkin = 'outlined' | 'outlined-beige' | 'gray' | 'beige' | 'green' | 'blue'
17
- export type TLayout = 'vertical' | 'horizontal'
16
+ export type { TCardSkin, TLayout }
18
17
  export type TCardPadding = 'none' | 'default'
19
18
  export type TCardImageShape = 'square' | 'round'
20
19
  export type TCardTagPosition = 'top' | 'bottom'
@@ -1,89 +1,28 @@
1
1
  import { PktIconName } from '@oslokommune/punkt-assets/dist/icons/icon'
2
+ import { booleanishConverter } from 'shared-types'
3
+ import type {
4
+ Booleanish,
5
+ User as SharedUser,
6
+ Representing as SharedRepresenting,
7
+ UserMenuItem as SharedUserMenuItem,
8
+ TInternalMenuItem as SharedTInternalMenuItem,
9
+ } from 'shared-types'
10
+ import { convertUserMenuItem as sharedConvertUserMenuItem } from 'shared-types'
2
11
 
3
- /**
4
- * Booleanish type that accepts boolean or string "true"/"false"
5
- * This allows attributes to be set as strings in HTML
6
- */
7
- export type Booleanish = boolean | 'true' | 'false'
8
-
9
- /**
10
- * Converter for booleanish attributes
11
- * Converts string "true"/"false" to boolean values
12
- */
13
- export const booleanishConverter = {
14
- fromAttribute(value: string | boolean | null): boolean {
15
- if (value === null || value === undefined) return false
16
- if (value === '' || value === 'true' || value === true) return true
17
- if (value === 'false' || value === false) return false
18
- return Boolean(value)
19
- },
20
- toAttribute(value: boolean): string | null {
21
- return value ? 'true' : 'false'
22
- },
23
- }
24
-
25
- /**
26
- * User object containing information about the logged-in user
27
- */
28
- export interface User {
29
- /** Full name of the user */
30
- name: string
31
- /** Short name or initials (deprecated) */
32
- shortname?: string
33
- /** Last login timestamp (ISO string or Date) */
34
- lastLoggedIn?: Date | string
35
- }
36
-
37
- /**
38
- * Representation object containing information about the organization/entity being represented
39
- */
40
- export interface Representing {
41
- /** Name of the organization or entity */
42
- name: string
43
- /** Short name or initials (deprecated) */
44
- shortname?: string
45
- /** Organization number */
46
- orgNumber?: string | number
47
- }
48
-
49
- /**
50
- * Menu item in the user menu
51
- */
52
- export interface UserMenuItem {
53
- /** Icon name to display */
54
- iconName?: PktIconName
55
- /** Text for the menu item */
56
- title: string
57
- /** Link URL or click handler function */
58
- target: string | (() => void)
59
- }
60
-
61
- /**
62
- * Internal type for rendering links/buttons (supports both href and onClick)
63
- */
64
- interface InternalMenuItemBase {
65
- title: string
66
- iconName?: PktIconName
67
- }
68
-
69
- interface InternalMenuLink extends InternalMenuItemBase {
70
- href: string
71
- }
72
-
73
- interface InternalMenuButton extends InternalMenuItemBase {
74
- onClick: () => void
75
- }
12
+ export type { Booleanish }
13
+ export { booleanishConverter }
76
14
 
77
- export type TInternalMenuItem = InternalMenuLink | InternalMenuButton
15
+ // Re-export with PktIconName typing
16
+ export type User = SharedUser
17
+ export type Representing = SharedRepresenting
18
+ export type UserMenuItem = SharedUserMenuItem<PktIconName>
19
+ export type TInternalMenuItem = SharedTInternalMenuItem<PktIconName>
78
20
 
79
21
  /**
80
22
  * Helper to convert UserMenuItem (with target) to internal format
81
23
  */
82
24
  export const convertUserMenuItem = (item: UserMenuItem): TInternalMenuItem => {
83
- if (typeof item.target === 'string') {
84
- return { title: item.title, iconName: item.iconName, href: item.target }
85
- }
86
- return { title: item.title, iconName: item.iconName, onClick: item.target }
25
+ return sharedConvertUserMenuItem(item)
87
26
  }
88
27
 
89
28
  /**
@@ -1,10 +1,11 @@
1
1
  import { PktShadowElement } from '@/base-elements/element'
2
2
  import { html, PropertyValues } from 'lit'
3
3
  import { customElement, property } from 'lit/decorators.js'
4
+ import type { THeadingLevel, THeadingSize, THeadingWeight } from 'shared-types'
4
5
 
5
- export type TPktHeadingLevel = 1 | 2 | 3 | 4 | 5 | 6
6
- export type TPktHeadingSize = 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge'
7
- export type TPktHeadingWeight = 'light' | 'regular' | 'medium' | 'bold'
6
+ export type TPktHeadingLevel = THeadingLevel
7
+ export type TPktHeadingSize = THeadingSize
8
+ export type TPktHeadingWeight = THeadingWeight
8
9
 
9
10
  export interface IPktHeading {
10
11
  size?: TPktHeadingSize
@@ -8,6 +8,8 @@ import { classMap } from 'lit/directives/class-map.js'
8
8
  import { customElement, property } from 'lit/decorators.js'
9
9
  import { ElementProps } from '@/types/typeUtils'
10
10
  import { uuidish } from 'shared-utils/utils'
11
+ import { booleanishConverter } from 'shared-types'
12
+ import type { Booleanish } from 'shared-types'
11
13
  import specs from 'componentSpecs/input-wrapper.json'
12
14
  import '@/components/helptext'
13
15
  import '@/components/icon'
@@ -39,22 +41,6 @@ type Props = ElementProps<
39
41
  | 'role'
40
42
  >
41
43
 
42
- // TODO: Trekk denne logikken ut i utils, så den kan gjenbrukes andre steder
43
- type Booleanish = boolean | 'true' | 'false'
44
- const booleanishConverter = {
45
- fromAttribute(value: string | boolean | null): boolean {
46
- // Accept false, "false", undefined, null as false
47
- if (value === null || value === undefined) return false
48
- if (value === '' || value === 'true' || value === true) return true
49
- if (value === 'false' || value === false) return false
50
- return Boolean(value)
51
- },
52
- toAttribute(value: boolean): string | null {
53
- // Always reflect as "true" or "false"
54
- return value ? 'true' : 'false'
55
- },
56
- }
57
-
58
44
  @customElement('pkt-input-wrapper')
59
45
  export class PktInputWrapper extends PktElement<Props> {
60
46
  defaultSlot: Ref<HTMLElement> = createRef()
@@ -9,8 +9,9 @@ import specs from 'componentSpecs/messagebox.json'
9
9
 
10
10
  import '@/components/icon'
11
11
  import { updateClassAttribute } from '@/utils/classutils'
12
+ import type { TMessageboxSkin } from 'shared-types'
12
13
 
13
- export type TMessageboxSkin = 'beige' | 'blue' | 'red' | 'green'
14
+ export type { TMessageboxSkin }
14
15
 
15
16
  export interface IPktMessagebox {
16
17
  skin?: TMessageboxSkin
@@ -7,7 +7,7 @@ import { styleMap } from 'lit/directives/style-map.js'
7
7
  import { uuidish } from 'shared-utils/utils'
8
8
 
9
9
  import '@/components/icon'
10
- import { TAriaLive } from '@/types/aria'
10
+ import type { TAriaLive } from 'shared-types'
11
11
 
12
12
  export type TProgressbarRole = 'progressbar' | 'meter'
13
13
  export type TProgressbarSkin = 'dark-blue' | 'light-blue' | 'green' | 'red'
@@ -9,7 +9,7 @@ import { TPktSize } from '@/types/size'
9
9
  import specs from 'componentSpecs/tag.json'
10
10
 
11
11
  import '@/components/icon'
12
- import { IAriaAttributes } from '@/types/aria'
12
+ import type { IAriaAttributes, THTMLButtonType } from 'shared-types'
13
13
  import { PktIconName } from '@oslokommune/punkt-assets/dist/icons/icon'
14
14
  import { ifDefined } from 'lit/directives/if-defined.js'
15
15
 
@@ -23,7 +23,7 @@ export type TTagSkin =
23
23
  | 'beige'
24
24
  | 'gray'
25
25
  | 'grey'
26
- export type TTagType = 'button' | 'reset' | 'submit'
26
+ export type TTagType = THTMLButtonType
27
27
 
28
28
  export interface IPktTag {
29
29
  closeTag?: boolean
@@ -1 +0,0 @@
1
- "use strict";const r=require("./element-CJ_QKaki.cjs"),Vt=require("./state-DSjcvzDN.cjs"),Ct=require("./utils-byXsEz1u.cjs"),Ft=require("./input-wrapper-EoSAbU-U.cjs");var nt={},ot;function Tt(){return ot||(ot=1,(function(){(function(f){const s=new WeakMap,u=new WeakMap,m=new WeakMap,h=new WeakMap,g=new WeakMap,k=new WeakMap,C=new WeakMap,b=new WeakMap,F=new WeakMap,V=new WeakMap,T=new WeakMap,A=new WeakMap,$=new WeakMap,U=new WeakMap,x=new WeakMap,I={ariaAtomic:"aria-atomic",ariaAutoComplete:"aria-autocomplete",ariaBusy:"aria-busy",ariaChecked:"aria-checked",ariaColCount:"aria-colcount",ariaColIndex:"aria-colindex",ariaColIndexText:"aria-colindextext",ariaColSpan:"aria-colspan",ariaCurrent:"aria-current",ariaDescription:"aria-description",ariaDisabled:"aria-disabled",ariaExpanded:"aria-expanded",ariaHasPopup:"aria-haspopup",ariaHidden:"aria-hidden",ariaInvalid:"aria-invalid",ariaKeyShortcuts:"aria-keyshortcuts",ariaLabel:"aria-label",ariaLevel:"aria-level",ariaLive:"aria-live",ariaModal:"aria-modal",ariaMultiLine:"aria-multiline",ariaMultiSelectable:"aria-multiselectable",ariaOrientation:"aria-orientation",ariaPlaceholder:"aria-placeholder",ariaPosInSet:"aria-posinset",ariaPressed:"aria-pressed",ariaReadOnly:"aria-readonly",ariaRelevant:"aria-relevant",ariaRequired:"aria-required",ariaRoleDescription:"aria-roledescription",ariaRowCount:"aria-rowcount",ariaRowIndex:"aria-rowindex",ariaRowIndexText:"aria-rowindextext",ariaRowSpan:"aria-rowspan",ariaSelected:"aria-selected",ariaSetSize:"aria-setsize",ariaSort:"aria-sort",ariaValueMax:"aria-valuemax",ariaValueMin:"aria-valuemin",ariaValueNow:"aria-valuenow",ariaValueText:"aria-valuetext",role:"role"},lt=(e,t)=>{for(let i in I){t[i]=null;let a=null;const n=I[i];Object.defineProperty(t,i,{get(){return a},set(o){a=o,e.isConnected?M(e,n,o):V.set(e,t)}})}};function z(e){const t=h.get(e),{form:i}=t;X(e,i,t),Q(e,t.labels)}const K=(e,t=!1)=>{const i=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode(o){return h.has(o)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});let a=i.nextNode();const n=!t||e.disabled;for(;a;)a.formDisabledCallback&&n&&W(a,e.disabled),a=i.nextNode()},j={attributes:!0,attributeFilter:["disabled","name"]},L=O()?new MutationObserver(e=>{for(const t of e){const i=t.target;if(t.attributeName==="disabled"&&(i.constructor.formAssociated?W(i,i.hasAttribute("disabled")):i.localName==="fieldset"&&K(i)),t.attributeName==="name"&&i.constructor.formAssociated){const a=h.get(i),n=F.get(i);a.setFormValue(n)}}}):{};function D(e){e.forEach(t=>{const{addedNodes:i,removedNodes:a}=t,n=Array.from(i),o=Array.from(a);n.forEach(l=>{var y;if(h.has(l)&&l.constructor.formAssociated&&z(l),V.has(l)){const p=V.get(l);Object.keys(I).filter(v=>p[v]!==null).forEach(v=>{M(l,I[v],p[v])}),V.delete(l)}if(x.has(l)){const p=x.get(l);M(l,"internals-valid",p.validity.valid.toString()),M(l,"internals-invalid",(!p.validity.valid).toString()),M(l,"aria-invalid",(!p.validity.valid).toString()),x.delete(l)}if(l.localName==="form"){const p=b.get(l),E=document.createTreeWalker(l,NodeFilter.SHOW_ELEMENT,{acceptNode(_){return h.has(_)&&_.constructor.formAssociated&&!(p&&p.has(_))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});let v=E.nextNode();for(;v;)z(v),v=E.nextNode()}l.localName==="fieldset"&&((y=L.observe)===null||y===void 0||y.call(L,l,j),K(l,!0))}),o.forEach(l=>{const y=h.get(l);y&&m.get(y)&&G(y),C.has(l)&&C.get(l).disconnect()})})}function ct(e){e.forEach(t=>{const{removedNodes:i}=t;i.forEach(a=>{const n=$.get(t.target);h.has(a)&&Z(a),n.disconnect()})})}const dt=e=>{var t,i;const a=new MutationObserver(ct);!((t=window==null?void 0:window.ShadyDOM)===null||t===void 0)&&t.inUse&&e.mode&&e.host&&(e=e.host),(i=a.observe)===null||i===void 0||i.call(a,e,{childList:!0}),$.set(e,a)};O()&&new MutationObserver(D);const P={childList:!0,subtree:!0},M=(e,t,i)=>{e.getAttribute(t)!==i&&e.setAttribute(t,i)},W=(e,t)=>{e.toggleAttribute("internals-disabled",t),t?M(e,"aria-disabled","true"):e.removeAttribute("aria-disabled"),e.formDisabledCallback&&e.formDisabledCallback.apply(e,[t])},G=e=>{m.get(e).forEach(i=>{i.remove()}),m.set(e,[])},J=(e,t)=>{const i=document.createElement("input");return i.type="hidden",i.name=e.getAttribute("name"),e.after(i),m.get(t).push(i),i},ut=(e,t)=>{var i;m.set(t,[]),(i=L.observe)===null||i===void 0||i.call(L,e,j)},Q=(e,t)=>{if(t.length){Array.from(t).forEach(a=>a.addEventListener("click",e.click.bind(e)));let i=t[0].id;t[0].id||(i=`${t[0].htmlFor}_Label`,t[0].id=i),M(e,"aria-labelledby",i)}},N=e=>{const t=Array.from(e.elements).filter(o=>!o.tagName.includes("-")&&o.validity).map(o=>o.validity.valid),i=b.get(e)||[],a=Array.from(i).filter(o=>o.isConnected).map(o=>h.get(o).validity.valid),n=[...t,...a].includes(!1);e.toggleAttribute("internals-invalid",n),e.toggleAttribute("internals-valid",!n)},ht=e=>{N(R(e.target))},ft=e=>{N(R(e.target))},pt=e=>{const t=["button[type=submit]","input[type=submit]","button:not([type])"].map(i=>`${i}:not([disabled])`).map(i=>`${i}:not([form])${e.id?`,${i}[form='${e.id}']`:""}`).join(",");e.addEventListener("click",i=>{if(i.target.closest(t)){const n=b.get(e);if(e.noValidate)return;n.size&&Array.from(n).reverse().map(y=>h.get(y).reportValidity()).includes(!1)&&i.preventDefault()}})},mt=e=>{const t=b.get(e.target);t&&t.size&&t.forEach(i=>{i.constructor.formAssociated&&i.formResetCallback&&i.formResetCallback.apply(i)})},X=(e,t,i)=>{if(t){const a=b.get(t);if(a)a.add(e);else{const n=new Set;n.add(e),b.set(t,n),pt(t),t.addEventListener("reset",mt),t.addEventListener("input",ht),t.addEventListener("change",ft)}k.set(t,{ref:e,internals:i}),e.constructor.formAssociated&&e.formAssociatedCallback&&setTimeout(()=>{e.formAssociatedCallback.apply(e,[t])},0),N(t)}},R=e=>{let t=e.parentNode;return t&&t.tagName!=="FORM"&&(t=R(t)),t},w=(e,t,i=DOMException)=>{if(!e.constructor.formAssociated)throw new i(t)},Y=(e,t,i)=>{const a=b.get(e);return a&&a.size&&a.forEach(n=>{h.get(n)[i]()||(t=!1)}),t},Z=e=>{if(e.constructor.formAssociated){const t=h.get(e),{labels:i,form:a}=t;Q(e,i),X(e,a,t)}};function O(){return typeof MutationObserver<"u"}class yt{constructor(){this.badInput=!1,this.customError=!1,this.patternMismatch=!1,this.rangeOverflow=!1,this.rangeUnderflow=!1,this.stepMismatch=!1,this.tooLong=!1,this.tooShort=!1,this.typeMismatch=!1,this.valid=!0,this.valueMissing=!1,Object.seal(this)}}const gt=e=>(e.badInput=!1,e.customError=!1,e.patternMismatch=!1,e.rangeOverflow=!1,e.rangeUnderflow=!1,e.stepMismatch=!1,e.tooLong=!1,e.tooShort=!1,e.typeMismatch=!1,e.valid=!0,e.valueMissing=!1,e),bt=(e,t,i)=>(e.valid=vt(t),Object.keys(t).forEach(a=>e[a]=t[a]),i&&N(i),e),vt=e=>{let t=!0;for(let i in e)i!=="valid"&&e[i]!==!1&&(t=!1);return t},H=new WeakMap;function tt(e,t){e.toggleAttribute(t,!0),e.part&&e.part.add(t)}class q extends Set{static get isPolyfilled(){return!0}constructor(t){if(super(),!t||!t.tagName||t.tagName.indexOf("-")===-1)throw new TypeError("Illegal constructor");H.set(this,t)}add(t){if(!/^--/.test(t)||typeof t!="string")throw new DOMException(`Failed to execute 'add' on 'CustomStateSet': The specified value ${t} must start with '--'.`);const i=super.add(t),a=H.get(this),n=`state${t}`;return a.isConnected?tt(a,n):setTimeout(()=>{tt(a,n)}),i}clear(){for(let[t]of this.entries())this.delete(t);super.clear()}delete(t){const i=super.delete(t),a=H.get(this);return a.isConnected?(a.toggleAttribute(`state${t}`,!1),a.part&&a.part.remove(`state${t}`)):setTimeout(()=>{a.toggleAttribute(`state${t}`,!1),a.part&&a.part.remove(`state${t}`)}),i}}function et(e,t,i,a){if(typeof t=="function"?e!==t||!a:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return i==="m"?a:i==="a"?a.call(e):a?a.value:t.get(e)}function wt(e,t,i,a,n){if(typeof t=="function"?e!==t||!0:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,i),i}var S;class Et{constructor(t){S.set(this,void 0),wt(this,S,t);for(let i=0;i<t.length;i++){let a=t[i];this[i]=a,a.hasAttribute("name")&&(this[a.getAttribute("name")]=a)}Object.freeze(this)}get length(){return et(this,S,"f").length}[(S=new WeakMap,Symbol.iterator)](){return et(this,S,"f")[Symbol.iterator]()}item(t){return this[t]==null?null:this[t]}namedItem(t){return this[t]==null?null:this[t]}}function Mt(){const e=HTMLFormElement.prototype.checkValidity;HTMLFormElement.prototype.checkValidity=i;const t=HTMLFormElement.prototype.reportValidity;HTMLFormElement.prototype.reportValidity=a;function i(...o){let l=e.apply(this,o);return Y(this,l,"checkValidity")}function a(...o){let l=t.apply(this,o);return Y(this,l,"reportValidity")}const{get:n}=Object.getOwnPropertyDescriptor(HTMLFormElement.prototype,"elements");Object.defineProperty(HTMLFormElement.prototype,"elements",{get(...o){const l=n.call(this,...o),y=Array.from(b.get(this)||[]);if(y.length===0)return l;const p=Array.from(l).concat(y).sort((E,v)=>E.compareDocumentPosition?E.compareDocumentPosition(v)&2?1:-1:0);return new Et(p)}})}class it{static get isPolyfilled(){return!0}constructor(t){if(!t||!t.tagName||t.tagName.indexOf("-")===-1)throw new TypeError("Illegal constructor");const i=t.getRootNode(),a=new yt;this.states=new q(t),s.set(this,t),u.set(this,a),h.set(t,this),lt(t,this),ut(t,this),Object.seal(this),i instanceof DocumentFragment&&dt(i)}checkValidity(){const t=s.get(this);if(w(t,"Failed to execute 'checkValidity' on 'ElementInternals': The target element is not a form-associated custom element."),!this.willValidate)return!0;const i=u.get(this);if(!i.valid){const a=new Event("invalid",{bubbles:!1,cancelable:!0,composed:!1});t.dispatchEvent(a)}return i.valid}get form(){const t=s.get(this);w(t,"Failed to read the 'form' property from 'ElementInternals': The target element is not a form-associated custom element.");let i;return t.constructor.formAssociated===!0&&(i=R(t)),i}get labels(){const t=s.get(this);w(t,"Failed to read the 'labels' property from 'ElementInternals': The target element is not a form-associated custom element.");const i=t.getAttribute("id"),a=t.getRootNode();return a&&i?a.querySelectorAll(`[for="${i}"]`):[]}reportValidity(){const t=s.get(this);if(w(t,"Failed to execute 'reportValidity' on 'ElementInternals': The target element is not a form-associated custom element."),!this.willValidate)return!0;const i=this.checkValidity(),a=A.get(this);if(a&&!t.constructor.formAssociated)throw new DOMException("Failed to execute 'reportValidity' on 'ElementInternals': The target element is not a form-associated custom element.");return!i&&a&&(t.focus(),a.focus()),i}setFormValue(t){const i=s.get(this);if(w(i,"Failed to execute 'setFormValue' on 'ElementInternals': The target element is not a form-associated custom element."),G(this),t!=null&&!(t instanceof FormData)){if(i.getAttribute("name")){const a=J(i,this);a.value=t}}else t!=null&&t instanceof FormData&&Array.from(t).reverse().forEach(([a,n])=>{if(typeof n=="string"){const o=J(i,this);o.name=a,o.value=n}});F.set(i,t)}setValidity(t,i,a){const n=s.get(this);if(w(n,"Failed to execute 'setValidity' on 'ElementInternals': The target element is not a form-associated custom element."),!t)throw new TypeError("Failed to execute 'setValidity' on 'ElementInternals': 1 argument required, but only 0 present.");A.set(this,a);const o=u.get(this),l={};for(const E in t)l[E]=t[E];Object.keys(l).length===0&&gt(o);const y=Object.assign(Object.assign({},o),l);delete y.valid;const{valid:p}=bt(o,y,this.form);if(!p&&!i)throw new DOMException("Failed to execute 'setValidity' on 'ElementInternals': The second argument should not be empty if one or more flags in the first argument are true.");g.set(this,p?"":i),n.isConnected?(n.toggleAttribute("internals-invalid",!p),n.toggleAttribute("internals-valid",p),M(n,"aria-invalid",`${!p}`)):x.set(n,this)}get shadowRoot(){const t=s.get(this),i=T.get(t);return i||null}get validationMessage(){const t=s.get(this);return w(t,"Failed to read the 'validationMessage' property from 'ElementInternals': The target element is not a form-associated custom element."),g.get(this)}get validity(){const t=s.get(this);return w(t,"Failed to read the 'validity' property from 'ElementInternals': The target element is not a form-associated custom element."),u.get(this)}get willValidate(){const t=s.get(this);return w(t,"Failed to read the 'willValidate' property from 'ElementInternals': The target element is not a form-associated custom element."),!(t.disabled||t.hasAttribute("disabled")||t.hasAttribute("readonly"))}}function kt(){if(typeof window>"u"||!window.ElementInternals||!HTMLElement.prototype.attachInternals)return!1;class e extends HTMLElement{constructor(){super(),this.internals=this.attachInternals()}}const t=`element-internals-feature-detection-${Math.random().toString(36).replace(/[^a-z]+/g,"")}`;customElements.define(t,e);const i=new e;return["shadowRoot","form","willValidate","validity","validationMessage","labels","setFormValue","setValidity","checkValidity","reportValidity"].every(a=>a in i.internals)}let at=!1,st=!1;function B(e){st||(st=!0,window.CustomStateSet=q,e&&(HTMLElement.prototype.attachInternals=function(...t){const i=e.call(this,t);return i.states=new q(this),i}))}function rt(e=!0){if(!at){if(at=!0,typeof window<"u"&&(window.ElementInternals=it),typeof CustomElementRegistry<"u"){const t=CustomElementRegistry.prototype.define;CustomElementRegistry.prototype.define=function(i,a,n){if(a.formAssociated){const o=a.prototype.connectedCallback;a.prototype.connectedCallback=function(){U.has(this)||(U.set(this,!0),this.hasAttribute("disabled")&&W(this,!0)),o!=null&&o.apply(this),Z(this)}}t.call(this,i,a,n)}}if(typeof HTMLElement<"u"&&(HTMLElement.prototype.attachInternals=function(){if(this.tagName){if(this.tagName.indexOf("-")===-1)throw new Error("Failed to execute 'attachInternals' on 'HTMLElement': Unable to attach ElementInternals to non-custom elements.")}else return{};if(h.has(this))throw new DOMException("DOMException: Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.");return new it(this)}),typeof Element<"u"){let t=function(...a){const n=i.apply(this,a);if(T.set(this,n),O()){const o=new MutationObserver(D);window.ShadyDOM?o.observe(this,P):o.observe(n,P),C.set(this,o)}return n};const i=Element.prototype.attachShadow;Element.prototype.attachShadow=t}O()&&typeof document<"u"&&new MutationObserver(D).observe(document.documentElement,P),typeof HTMLFormElement<"u"&&Mt(),(e||typeof window<"u"&&!window.CustomStateSet)&&B()}}return!!customElements.polyfillWrapFlushCallback||(kt()?typeof window<"u"&&!window.CustomStateSet&&B(HTMLElement.prototype.attachInternals):rt(!1)),f.forceCustomStateSetPolyfill=B,f.forceElementInternalsPolyfill=rt,Object.defineProperty(f,"__esModule",{value:!0}),f})({})})()),nt}Tt();var At=Object.defineProperty,d=(f,s,u,m)=>{for(var h=void 0,g=f.length-1,k;g>=0;g--)(k=f[g])&&(h=k(s,u,h)||h);return h&&At(s,u,h),h};const St={fromAttribute(f){return f==null?!1:f===""||f==="true"||f===!0?!0:f==="false"||f===!1?!1:!!f},toAttribute(f){return f?"true":"false"}};class c extends r.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.step=null,this.ariaDescribedBy=null,this.ariaLabelledby=null,this.name="",this.pattern=null,this.placeholder=null,this.id=Ct.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=Ft.specs.props.helptextDropdownButton.default,this.label=null,this.optionalText=r.translations.forms.labels.optional,this.requiredText=r.translations.forms.labels.required,this.tagText=null,this.dataTestid="",this.touched=!1,this.internals=this.attachInternals()}static get formAssociated(){return!0}manageValidity(s){var u,m,h,g,k,C,b,F,V,T,A;s&&(this.required&&!this.value?this.internals.setValidity({valueMissing:!0},r.translations.forms.messages.required,s):(u=s.validity)!=null&&u.typeMismatch||(m=s.validity)!=null&&m.badInput?this.internals.setValidity({typeMismatch:!0},r.translations.forms.messages.invalid,s):(h=s.validity)!=null&&h.patternMismatch?this.internals.setValidity({patternMismatch:!0},r.translations.forms.messages.invalidPattern,s):(g=s.validity)!=null&&g.tooShort||this.minlength&&this.minlength>0&&this.value.length<this.minlength?this.internals.setValidity({tooShort:!0},r.translations.forms.messages.tooShort,s):(k=s.validity)!=null&&k.tooLong||this.maxlength&&this.maxlength>0&&this.value.length>this.maxlength?this.internals.setValidity({tooLong:!0},r.translations.forms.messages.tooLong,s):(C=s.validity)!=null&&C.rangeUnderflow?this.internals.setValidity({rangeUnderflow:!0},this.min?r.translations.forms.messages.rangeUnderflowMin.replace("{min}",(b=this.min)==null?void 0:b.toString()):r.translations.forms.messages.rangeUnderflow,s):(F=s.validity)!=null&&F.stepMismatch?this.internals.setValidity({stepMismatch:!0},r.translations.forms.messages.invalid,s):(V=s.validity)!=null&&V.rangeOverflow?this.internals.setValidity({rangeOverflow:!0},this.max?r.translations.forms.messages.rangeOverflowMax.replace("{max}",(T=this.max)==null?void 0:T.toString()):r.translations.forms.messages.rangeOverflow,s):(A=s.validity)!=null&&A.customError?this.internals.setValidity({customError:!0},s.validationMessage,s):this.internals.setValidity({}))}setFormValue(s){if(this.internals)if(Array.isArray(s)){const u=new FormData;s.forEach(m=>{u.append(this.name,m)}),this.internals.setFormValue(u)}else this.internals.setFormValue(s)}valueChecked(s){if(!this.touched)return;const u=this.internals.form||this.closest("form"),m=u?new FormData(u):null;u&&u.querySelectorAll(`pkt-radiobutton[name="${this.name}"], input[type=radio][name="${this.name}"]`).forEach(h=>{const g=h;g.name===this.name&&g.value!==this.value&&g.checked&&(g.checked=!1)}),typeof s=="string"?(this.checked=s==="true",this.internals.ariaChecked=s==="true"):typeof s=="boolean"&&(this.checked=s,this.internals.ariaChecked=s),this.checked?(this.internals.setFormValue(this.value||"on",this.value||"on"),m&&m.append(this.name,this.value||"on"),this.internals.states.add("--checked")):(this.internals.setFormValue(null,null),m&&m.delete(this.name),this.internals.states.delete("--checked")),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("value-change",{detail:this.checked,bubbles:!0,composed:!0})),this.internals.reportValidity()}valueChanged(s,u){(u!==this.value||u!==this._value)&&(typeof s=="string"?((this.multiple||this.range)&&s.includes(",")&&(s=s.split(",")),this.value=s,this._value=Array.isArray(s)?s:[s]):Array.isArray(s)?(this.value=this.multiple||this.range?s:s[0],this._value=s):(this.value="",this._value=[]),(!this.value||this.value.length===0)&&u&&u.length!==0?this.clearInputValue():this.value&&this.value.toString()!==(u==null?void 0:u.toString())&&this.onChange(this.value),this.updateComplete.then(()=>this.requestUpdate()))}clearInputValue(){const s=this.multiple||this.range?[]:"";this.value=s,this.internals.setFormValue(s),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("value-change",{detail:s,bubbles:!0,composed:!0}))}onFocus(){this.dispatchEvent(new FocusEvent("focus",{bubbles:!0,composed:!0}))}onBlur(){this.dispatchEvent(new FocusEvent("blur",{bubbles:!0,composed:!0}))}onInput(){this.dispatchEvent(new InputEvent("input",{bubbles:!0,composed:!0}))}onChange(s){if(!this.touched){this.touched=!0,s&&this.setFormValue(s);return}typeof s!="string"&&!Array.isArray(s)||((this.range||this.multiple)&&!Array.isArray(s)&&s.includes(",")&&(s=s.split(",")),!this.multiple&&!this.range&&Array.isArray(s)&&(s=s[0]),this.setFormValue(s),this.manageValidity(this.inputRef.value),this.inputRefTo&&this.manageValidity(this.inputRefTo.value),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("value-change",{detail:s,bubbles:!0,composed:!0})))}formResetCallback(){this.touched=!1,this._options&&this._options.length&&this._options.forEach(s=>{"selected"in s&&(s.selected=!1)}),this.checked!==void 0?(this.checked=!1,this.internals.ariaChecked=!1,this.internals.setFormValue("",""),this.inputRef.value.checked=!1,this.valueChecked(this.checked)):(this.internals.setFormValue(""),this.value=this.defaultValue||(this.multiple||this.range?[]:""),this._value=this.value,this.valueChanged(this.value,null)),this.internals.ariaInvalid=!1}updated(s){super.updated(s),s.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(s){if(super.firstUpdated(s),!this.form){const u=this.internals.form||this.closest("form");this.form=u}if(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 u=this.checked===""||this.checked==="true"||this.checked===!0;this.internals.ariaChecked=u,this.internals.setFormValue(u?this.value||"on":"",u?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))}}d([r.n()],c.prototype,"defaultValue");d([r.n({type:Boolean,reflect:!0})],c.prototype,"disabled");d([r.n({type:Boolean,reflect:!0})],c.prototype,"readonly");d([r.n({type:Boolean,reflect:!0})],c.prototype,"required");d([r.n({type:Number,reflect:!0})],c.prototype,"max");d([r.n({type:Number,reflect:!0})],c.prototype,"maxlength");d([r.n({type:Number,reflect:!0})],c.prototype,"min");d([r.n({type:Number,reflect:!0})],c.prototype,"minlength");d([r.n({type:Number,reflect:!0})],c.prototype,"step");d([r.n({type:String})],c.prototype,"ariaDescribedBy");d([r.n({type:String})],c.prototype,"ariaLabelledby");d([r.n({type:String,reflect:!0})],c.prototype,"name");d([r.n({type:String,reflect:!0})],c.prototype,"pattern");d([r.n({type:String,reflect:!0})],c.prototype,"placeholder");d([r.n({type:String,reflect:!0})],c.prototype,"id");d([r.n({type:Boolean})],c.prototype,"counter");d([r.n({type:Boolean})],c.prototype,"hasError");d([r.n({type:Boolean})],c.prototype,"inline");d([r.n({type:Boolean})],c.prototype,"hasFieldset");d([r.n({type:Boolean})],c.prototype,"optionalTag");d([r.n({type:Boolean})],c.prototype,"requiredTag");d([r.n({type:Boolean})],c.prototype,"skipForwardTestid");d([r.n({type:Boolean,reflect:!0,converter:St})],c.prototype,"useWrapper");d([r.n({type:Boolean,reflect:!0})],c.prototype,"fullwidth");d([r.n({type:Number})],c.prototype,"counterMaxLength");d([r.n({type:String})],c.prototype,"errorMessage");d([r.n({type:String})],c.prototype,"helptext");d([r.n({type:String})],c.prototype,"helptextDropdown");d([r.n({type:String,reflect:!1})],c.prototype,"helptextDropdownButton");d([r.n({type:String})],c.prototype,"label");d([r.n({type:String,reflect:!1})],c.prototype,"optionalText");d([r.n({type:String,reflect:!1})],c.prototype,"requiredText");d([r.n({type:String,reflect:!1})],c.prototype,"tagText");d([r.n({type:String,attribute:"data-testid"})],c.prototype,"dataTestid");d([Vt.r()],c.prototype,"touched");exports.PktInputElement=c;