@oslokommune/punkt-elements 12.26.2 → 12.27.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/dist/{alert-MKb7NX3r.js → alert-BvN80UkI.js} +1 -1
  2. package/dist/{alert-3DZNN48_.cjs → alert-uNzcOJR9.cjs} +1 -1
  3. package/dist/alert.d.ts +7 -0
  4. package/dist/calendar.d.ts +7 -0
  5. package/dist/{card-CtipjQuP.cjs → card-BaxqXP-k.cjs} +1 -1
  6. package/dist/{card-ClWsCQfD.js → card-Br6A74Q1.js} +2 -2
  7. package/dist/card.d.ts +7 -0
  8. package/dist/{datepicker-B2W8ra1B.cjs → datepicker-BC0e34ws.cjs} +16 -15
  9. package/dist/{datepicker-BVI4szRk.js → datepicker-ONV4HuJt.js} +84 -82
  10. package/dist/datepicker.d.ts +7 -0
  11. package/dist/helptext-DHfBEO42.js +78 -0
  12. package/dist/helptext-xUdEGuNQ.cjs +24 -0
  13. package/dist/helptext.d.ts +7 -0
  14. package/dist/icon.d.ts +7 -0
  15. package/dist/index.d.ts +29 -8
  16. package/dist/input-wrapper-DeCY6nta.cjs +50 -0
  17. package/dist/input-wrapper-Df18_PvD.js +172 -0
  18. package/dist/input-wrapper.d.ts +7 -0
  19. package/dist/{link-B3PDtnXT.js → link-0N9wG5l8.js} +1 -1
  20. package/dist/{link-BnL83t0x.cjs → link-I_LKEBVK.cjs} +1 -1
  21. package/dist/link.d.ts +7 -0
  22. package/dist/{linkcard-C4q7HCwY.js → linkcard-BJeRbpq_.js} +1 -1
  23. package/dist/{linkcard-RyOjvpmF.cjs → linkcard-ClXGVwdJ.cjs} +1 -1
  24. package/dist/linkcard.d.ts +7 -0
  25. package/dist/{messagebox-BDfhozc3.js → messagebox-C5M56R8f.js} +1 -1
  26. package/dist/{messagebox-CuM1y2P_.cjs → messagebox-CC3j63Wp.cjs} +1 -1
  27. package/dist/messagebox.d.ts +7 -0
  28. package/dist/{modal-gLMGJSSY.cjs → modal-BkchlKkL.cjs} +1 -1
  29. package/dist/{modal-CYv8Qk0Y.js → modal-PKDnp91S.js} +1 -1
  30. package/dist/modal.d.ts +7 -0
  31. package/dist/pkt-alert.cjs +1 -1
  32. package/dist/pkt-alert.js +1 -1
  33. package/dist/pkt-card.cjs +1 -1
  34. package/dist/pkt-card.js +1 -1
  35. package/dist/pkt-datepicker.cjs +1 -1
  36. package/dist/pkt-datepicker.js +1 -1
  37. package/dist/pkt-helptext.cjs +1 -1
  38. package/dist/pkt-helptext.js +1 -1
  39. package/dist/pkt-index.cjs +1 -1
  40. package/dist/pkt-index.js +14 -14
  41. package/dist/pkt-input-wrapper.cjs +1 -1
  42. package/dist/pkt-input-wrapper.js +1 -1
  43. package/dist/pkt-link.cjs +1 -1
  44. package/dist/pkt-link.js +1 -1
  45. package/dist/pkt-linkcard.cjs +1 -1
  46. package/dist/pkt-linkcard.js +1 -1
  47. package/dist/pkt-messagebox.cjs +1 -1
  48. package/dist/pkt-messagebox.js +1 -1
  49. package/dist/pkt-modal.cjs +1 -1
  50. package/dist/pkt-modal.js +1 -1
  51. package/dist/pkt-select.cjs +1 -1
  52. package/dist/pkt-select.js +1 -1
  53. package/dist/pkt-slot-controller-Clbye6cM.js +85 -0
  54. package/dist/pkt-slot-controller-Oc32unDk.cjs +1 -0
  55. package/dist/pkt-tag.cjs +1 -1
  56. package/dist/pkt-tag.js +1 -1
  57. package/dist/pkt-textarea.cjs +1 -1
  58. package/dist/pkt-textarea.js +1 -1
  59. package/dist/pkt-textinput.cjs +1 -1
  60. package/dist/pkt-textinput.js +1 -1
  61. package/dist/progressbar.d.ts +7 -0
  62. package/dist/radiobutton.d.ts +7 -0
  63. package/dist/select-DFlu7Eq6.cjs +48 -0
  64. package/dist/{select-BJr30hL7.js → select-DVyh7z8C.js} +60 -43
  65. package/dist/select.d.ts +7 -0
  66. package/dist/{tag-nAMwKi6B.cjs → tag-DGywzHJ5.cjs} +1 -1
  67. package/dist/{tag-CPLBzyiV.js → tag-W9Lf1doW.js} +1 -1
  68. package/dist/tag.d.ts +7 -0
  69. package/dist/{textarea-Da-bIu5d.js → textarea-80zuPTTD.js} +35 -33
  70. package/dist/textarea-WWRAA1LV.cjs +49 -0
  71. package/dist/textarea.d.ts +7 -0
  72. package/dist/{textinput-C9pkRR6S.cjs → textinput-CE5AzOur.cjs} +4 -3
  73. package/dist/{textinput-Buj2CAKl.js → textinput-CZIE3v3S.js} +44 -42
  74. package/dist/textinput.d.ts +7 -0
  75. package/package.json +4 -4
  76. package/src/components/datepicker/datepicker.ts +8 -0
  77. package/src/components/helptext/helptext.ts +41 -35
  78. package/src/components/icon/icon.ts +10 -3
  79. package/src/components/input-wrapper/input-wrapper.ts +28 -19
  80. package/src/components/select/select.ts +41 -8
  81. package/src/components/textarea/textarea.ts +9 -1
  82. package/src/components/textinput/textinput.ts +10 -1
  83. package/dist/helptext-CNgXo34f.js +0 -75
  84. package/dist/helptext-XPScYIkx.cjs +0 -23
  85. package/dist/input-wrapper-CWvzXs6X.js +0 -160
  86. package/dist/input-wrapper-nvacN4EY.cjs +0 -48
  87. package/dist/pkt-slot-controller-BEDVscvU.cjs +0 -1
  88. package/dist/pkt-slot-controller-DhwCJd_0.js +0 -67
  89. package/dist/select-B19JEWYw.cjs +0 -44
  90. package/dist/textarea-D7uvC79V.cjs +0 -48
@@ -1,44 +0,0 @@
1
- "use strict";const l=require("./element-B0UgldHm.cjs"),d=require("./state-CG-binsl.cjs"),a=require("./ref-DDYBJ4EB.cjs"),o=require("./if-defined-Br3lDE5v.cjs"),u=require("./input-element-Dnda8hac.cjs");require("./input-wrapper-nvacN4EY.cjs");class c{constructor(t){this.nodes=[],this.options=[],this.host=t,this.host.addController(this),this.nodes=[],this.options=[],this.observer=new MutationObserver(e=>this.handleMutations(e))}hostConnected(){Array.from(this.host.childNodes).forEach(t=>{(t.nodeName==="OPTION"||t.nodeName==="DATA")&&this.addNode(t)}),this.observer.observe(this.host,{childList:!0})}hostDisconnected(){this.observer.disconnect()}addNode(t){(t.nodeName==="OPTION"||t.nodeName==="DATA")&&(t.setAttribute("class","pkt-hide"),this.nodes.push(t))}createOptions(){this.options=this.nodes.map(t=>({value:t.getAttribute("value")||t.textContent||"",label:t.textContent||t.getAttribute("value")||"",selected:!!t.getAttribute("selected"),disabled:!!t.getAttribute("disabled")})),this.host.setAttribute("options",JSON.stringify(this.options))}handleMutations(t){let e=!1;t.forEach(s=>{s.addedNodes.forEach(i=>{(i.nodeName==="OPTION"||i.nodeName==="DATA")&&(this.addNode(i),e=!0)}),s.removedNodes.forEach(i=>{(i.nodeName==="OPTION"||i.nodeName==="DATA")&&(this.nodes=this.nodes.filter(r=>r!==i),e=!0)})}),e&&this.createOptions()}}var b=Object.defineProperty,f=Object.getOwnPropertyDescriptor,h=(n,t,e,s)=>{for(var i=s>1?void 0:s?f(t,e):t,r=n.length-1,p;r>=0;r--)(p=n[r])&&(i=(s?p(t,e,i):p(i))||i);return s&&i&&b(t,e,i),i};exports.PktSelect=class extends u.PktInputElement{constructor(){super(),this.selectRef=a.e(),this.defaultSlot=a.e(),this.options=[],this.value="",this._options=[],this.optionsController=new c(this)}connectedCallback(){super.connectedCallback();const t=this.options.length>0,e=this.optionsController.nodes.length&&this.optionsController.nodes.length>0;!t&&e?this.optionsController.nodes.forEach(s=>{const i={value:s.getAttribute("value")||s.textContent||"",label:s.textContent||s.getAttribute("value")||"",disabled:!!s.getAttribute("disabled")};s.getAttribute("selected")&&!this.value&&(this.value=i.value),this._options.push(i)}):this._options=this.options}attributeChangedCallback(t,e,s){t==="options"&&(this._options=s?JSON.parse(s):[]),super.attributeChangedCallback(t,e,s)}firstUpdated(t){super.firstUpdated(t),this.options.length&&(this._options=this.options)}render(){const t=`pkt-input ${this.fullwidth?"pkt-input--fullwidth":""}`;return l.x`
2
- <pkt-input-wrapper
3
- ?counter=${this.counter}
4
- ?disabled=${this.disabled}
5
- ?hasError=${this.hasError}
6
- ?inline=${this.inline}
7
- ?optionalTag=${this.optionalTag}
8
- ?requiredTag=${this.requiredTag}
9
- ?useWrapper=${this.useWrapper}
10
- ariaDescribedBy=${o.o(this.ariaDescribedBy)}
11
- .counterCurrent=${this.counterCurrent}
12
- .counterMaxLength=${this.counterMaxLength}
13
- class="pkt-select"
14
- errorMessage=${o.o(this.errorMessage)}
15
- forId=${this.id}
16
- helptext=${o.o(this.helptext)}
17
- helptextDropdown=${o.o(this.helptextDropdown)}
18
- helptextDropdownButton=${o.o(this.helptextDropdownButton)}
19
- label=${o.o(this.label)}
20
- optionalText=${o.o(this.optionalText)}
21
- requiredText=${o.o(this.requiredText)}
22
- >
23
- <select
24
- class=${t}
25
- aria-invalid=${this.hasError}
26
- aria-errormessage=${`${this.id}-error`}
27
- aria-labelledby=${o.o(this.ariaLabelledby)}
28
- ?disabled=${this.disabled}
29
- id=${this.id}
30
- name=${this.name||this.id}
31
- value=${this.value}
32
- ${a.n(this.selectRef)}
33
- ${a.n(this.defaultSlot)}
34
- >
35
- ${this._options.length>0&&this._options.map(e=>l.x`<option
36
- value=${e.value}
37
- ?selected=${this.value==e.value}
38
- ?disabled=${e.disabled}
39
- >
40
- ${e.label}
41
- </option>`)}
42
- </select>
43
- </pkt-input-wrapper>
44
- `}};h([l.n({type:Array})],exports.PktSelect.prototype,"options",2);h([l.n({type:String})],exports.PktSelect.prototype,"value",2);h([d.r()],exports.PktSelect.prototype,"_options",2);exports.PktSelect=h([l.t("pkt-select")],exports.PktSelect);
@@ -1,48 +0,0 @@
1
- "use strict";const r=require("./element-B0UgldHm.cjs"),h=require("./state-CG-binsl.cjs"),o=require("./ref-DDYBJ4EB.cjs"),p=require("./class-map-aeZWY44S.cjs"),d=require("./input-element-Dnda8hac.cjs");require("./input-wrapper-nvacN4EY.cjs");require("./icon-PWn7rnfg.cjs");/**
2
- * @license
3
- * Copyright 2020 Google LLC
4
- * SPDX-License-Identifier: BSD-3-Clause
5
- */const c=r.e(class extends r.i{constructor(i){if(super(i),i.type!==r.t$1.PROPERTY&&i.type!==r.t$1.ATTRIBUTE&&i.type!==r.t$1.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!o.f(i))throw Error("`live` bindings can only contain a single expression")}render(i){return i}update(i,[e]){if(e===r.T||e===r.E)return e;const a=i.element,t=i.name;if(i.type===r.t$1.PROPERTY){if(e===a[t])return r.T}else if(i.type===r.t$1.BOOLEAN_ATTRIBUTE){if(!!e===a.hasAttribute(t))return r.T}else if(i.type===r.t$1.ATTRIBUTE&&a.getAttribute(t)===e+"")return r.T;return o.m(i),e}});var $=Object.defineProperty,g=Object.getOwnPropertyDescriptor,n=(i,e,a,t)=>{for(var s=t>1?void 0:t?g(e,a):e,u=i.length-1,l;u>=0;u--)(l=i[u])&&(s=(t?l(e,a,s):l(s))||s);return t&&s&&$(e,a,s),s};exports.PktTextarea=class extends d.PktInputElement{constructor(){super(...arguments),this.value="",this.autocomplete="off",this.placeholder="",this.rows=null,this.counterCurrent=0,this.inputRef=o.e()}attributeChangedCallback(e,a,t){e==="value"&&this.value!==a&&(this.counterCurrent=t?t.length:0,this.valueChanged(t,a)),super.attributeChangedCallback(e,a,t)}updated(e){var a;super.updated(e),e.has("value")&&(this.counterCurrent=((a=this.value)==null?void 0:a.length)||0,this.valueChanged(this.value,e.get("value"))),e.has("id")&&!this.name&&this.id&&(this.name=this.id)}render(){const e=p.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}),a=this.ariaLabelledby||`${this.id}-input-label`;return r.x`<pkt-input-wrapper
6
- label=${this.label}
7
- ?counter=${this.counter}
8
- ?disabled=${this.disabled}
9
- ?hasError=${this.hasError}
10
- ?inline=${this.inline}
11
- ?optionalTag=${this.optionalTag}
12
- ?required=${this.required}
13
- ?requiredTag=${this.requiredTag}
14
- ?useWrapper=${this.useWrapper}
15
- .ariaDescribedBy=${this.ariaDescribedBy}
16
- .counterCurrent=${this.counterCurrent}
17
- .counterMaxLength=${this.counterMaxLength}
18
- .errorMessage=${this.errorMessage}
19
- .forId="${this.id+"-input"}"
20
- .helptext=${this.helptext}
21
- .helptextDropdown=${this.helptextDropdown}
22
- .helptextDropdownButton=${this.helptextDropdownButton}
23
- .optionalText=${this.optionalText}
24
- .requiredText=${this.requiredText}
25
- class="pkt-textarea"
26
- >
27
- <textarea
28
- ${o.n(this.inputRef)}
29
- class=${e}
30
- id=${this.id+"-input"}
31
- name=${(this.name||this.id)+"-input"}
32
- placeholder=${this.placeholder??r.E}
33
- .value=${c(this.value)}
34
- minlength=${this.minlength||r.E}
35
- maxlength=${this.maxlength||r.E}
36
- ?readonly=${this.readonly}
37
- autocomplete=${this.autocomplete}
38
- aria-labelledby=${a}
39
- aria-invalid=${this.hasError}
40
- aria-errormessage=${`${this.id}-error`}
41
- rows=${this.rows}
42
- ?disabled=${this.disabled}
43
- @input=${t=>{this.value=t.target.value,this.onInput(),t.stopImmediatePropagation()}}
44
- @change=${t=>{t.stopImmediatePropagation()}}
45
- @focus=${t=>{this.onFocus(),t.stopImmediatePropagation()}}
46
- @blur=${t=>{this.value=t.target.value,this.onBlur(),t.stopImmediatePropagation()}}
47
- ></textarea>
48
- </pkt-input-wrapper>`}};n([r.n({type:String,reflect:!0})],exports.PktTextarea.prototype,"value",2);n([r.n({type:String})],exports.PktTextarea.prototype,"autocomplete",2);n([r.n({type:String})],exports.PktTextarea.prototype,"placeholder",2);n([r.n({type:Number})],exports.PktTextarea.prototype,"rows",2);n([h.r()],exports.PktTextarea.prototype,"counterCurrent",2);exports.PktTextarea=n([r.t("pkt-textarea")],exports.PktTextarea);