@oslokommune/punkt-elements 12.17.0 → 12.17.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 (63) hide show
  1. package/dist/{class-map-d4EVPLBg.js → class-map-CBvUV2N3.js} +1 -1
  2. package/dist/{class-map-C92zObAn.cjs → class-map-a5HUzP83.cjs} +1 -1
  3. package/dist/{helptext-P1rM1x3p.js → helptext-DBolvFI4.js} +3 -3
  4. package/dist/{helptext-CquaEC6K.cjs → helptext-_fMLOOCL.cjs} +1 -1
  5. package/dist/{index-BXyp3qCS.js → index-CFDwiDTU.js} +349 -337
  6. package/dist/{index-BsgcXRmM.cjs → index-CR7t1zY9.cjs} +29 -29
  7. package/dist/{index-D2toJo-e.cjs → index-CmTjXoAb.cjs} +1 -1
  8. package/dist/{index-CPB5TLrS.js → index-D2jSRMrn.js} +6 -6
  9. package/dist/{index-BPPtpQWt.js → index-RwtTBIhT.js} +1 -1
  10. package/dist/{index-BPXZmGWV.cjs → index-tvpcg-ad.cjs} +4 -4
  11. package/dist/index.d.ts +5 -0
  12. package/dist/{input-wrapper-BbLHt2GC.js → input-wrapper-6vTrKtsW.js} +5 -5
  13. package/dist/{input-wrapper-Bv0JBG3z.cjs → input-wrapper-DX41tnbj.cjs} +1 -1
  14. package/dist/{linkcard-Gc0adgx0.js → linkcard-BlWQ8jOv.js} +3 -3
  15. package/dist/{linkcard-nkS6ET7M.cjs → linkcard-Det6CJ5D.cjs} +1 -1
  16. package/dist/{modal-Dq7JVtPA.js → modal-3OZTPqee.js} +4 -4
  17. package/dist/{modal-D_7T-rg0.cjs → modal-DYTVJjYh.cjs} +1 -1
  18. package/dist/pkt-alert.cjs +1 -1
  19. package/dist/pkt-alert.js +4 -4
  20. package/dist/pkt-calendar.cjs +1 -1
  21. package/dist/pkt-calendar.js +4 -4
  22. package/dist/pkt-card.cjs +1 -1
  23. package/dist/pkt-card.js +4 -4
  24. package/dist/pkt-component-template.cjs +1 -1
  25. package/dist/pkt-component-template.js +3 -3
  26. package/dist/pkt-datepicker.cjs +4 -5
  27. package/dist/pkt-datepicker.js +52 -53
  28. package/dist/pkt-element.cjs +1 -1
  29. package/dist/pkt-element.js +1 -1
  30. package/dist/pkt-helptext.cjs +1 -1
  31. package/dist/pkt-helptext.js +1 -1
  32. package/dist/pkt-icon.cjs +1 -1
  33. package/dist/pkt-icon.js +2 -2
  34. package/dist/pkt-index.cjs +1 -1
  35. package/dist/pkt-index.js +8 -8
  36. package/dist/pkt-input-wrapper.cjs +1 -1
  37. package/dist/pkt-input-wrapper.js +1 -1
  38. package/dist/pkt-link.cjs +1 -1
  39. package/dist/pkt-link.js +4 -4
  40. package/dist/pkt-linkcard.cjs +1 -1
  41. package/dist/pkt-linkcard.js +1 -1
  42. package/dist/pkt-messagebox.cjs +1 -1
  43. package/dist/pkt-messagebox.js +4 -4
  44. package/dist/pkt-modal.cjs +1 -1
  45. package/dist/pkt-modal.js +1 -1
  46. package/dist/pkt-tag.cjs +1 -1
  47. package/dist/pkt-tag.js +4 -4
  48. package/dist/pkt-textarea.cjs +1 -1
  49. package/dist/pkt-textarea.js +1 -1
  50. package/dist/pkt-textinput.cjs +1 -1
  51. package/dist/pkt-textinput.js +1 -1
  52. package/dist/{ref-DPUgHtT0.cjs → ref-C2yPtMJA.cjs} +1 -1
  53. package/dist/{ref-B5hXBqpP.js → ref-CaiKp3S2.js} +1 -1
  54. package/dist/{textarea-DpLTy6XT.cjs → textarea-B45ZZYpx.cjs} +6 -3
  55. package/dist/{textarea-oZpJKjwI.js → textarea-BTpJjEhO.js} +25 -22
  56. package/dist/{textinput-BD4p3Biy.cjs → textinput-BIhQEr8z.cjs} +7 -3
  57. package/dist/{textinput-ToIpNAvm.js → textinput-CVo5wG14.js} +63 -56
  58. package/package.json +3 -3
  59. package/src/components/calendar/index.ts +4 -4
  60. package/src/components/datepicker/index.ts +3 -4
  61. package/src/components/element/index.ts +20 -0
  62. package/src/components/textarea/textarea.ts +6 -3
  63. package/src/components/textinput/textinput.ts +10 -3
@@ -1,15 +1,15 @@
1
- import { T as u, E as d, r as c, a as $, x as f, n as l } from "./index-BXyp3qCS.js";
2
- import { e as g, i as m, a as n, t as b } from "./custom-element-CWfU4dcr.js";
3
- import { f as v, m as T, e as x, n as y } from "./ref-B5hXBqpP.js";
4
- import { e as w } from "./class-map-d4EVPLBg.js";
5
- import "./input-wrapper-BbLHt2GC.js";
6
- import "./index-BPPtpQWt.js";
1
+ import { T as l, E as h, r as c, a as $, x as g, n as p } from "./index-CFDwiDTU.js";
2
+ import { e as m, i as f, a as n, t as b } from "./custom-element-CWfU4dcr.js";
3
+ import { f as v, m as x, e as T, n as y } from "./ref-CaiKp3S2.js";
4
+ import { e as w } from "./class-map-CBvUV2N3.js";
5
+ import "./input-wrapper-6vTrKtsW.js";
6
+ import "./index-RwtTBIhT.js";
7
7
  /**
8
8
  * @license
9
9
  * Copyright 2020 Google LLC
10
10
  * SPDX-License-Identifier: BSD-3-Clause
11
11
  */
12
- const E = g(class extends m {
12
+ const E = m(class extends f {
13
13
  constructor(t) {
14
14
  if (super(t), t.type !== n.PROPERTY && t.type !== n.ATTRIBUTE && t.type !== n.BOOLEAN_ATTRIBUTE) throw Error("The `live` directive is not allowed on child or event bindings");
15
15
  if (!v(t)) throw Error("`live` bindings can only contain a single expression");
@@ -18,24 +18,24 @@ const E = g(class extends m {
18
18
  return t;
19
19
  }
20
20
  update(t, [r]) {
21
- if (r === u || r === d) return r;
21
+ if (r === l || r === h) return r;
22
22
  const e = t.element, i = t.name;
23
23
  if (t.type === n.PROPERTY) {
24
- if (r === e[i]) return u;
24
+ if (r === e[i]) return l;
25
25
  } else if (t.type === n.BOOLEAN_ATTRIBUTE) {
26
- if (!!r === e.hasAttribute(i)) return u;
27
- } else if (t.type === n.ATTRIBUTE && e.getAttribute(i) === r + "") return u;
28
- return T(t), r;
26
+ if (!!r === e.hasAttribute(i)) return l;
27
+ } else if (t.type === n.ATTRIBUTE && e.getAttribute(i) === r + "") return l;
28
+ return x(t), r;
29
29
  }
30
30
  });
31
31
  var C = Object.defineProperty, B = Object.getOwnPropertyDescriptor, o = (t, r, e, i) => {
32
- for (var a = i > 1 ? void 0 : i ? B(r, e) : r, p = t.length - 1, h; p >= 0; p--)
33
- (h = t[p]) && (a = (i ? h(r, e, a) : h(a)) || a);
32
+ for (var a = i > 1 ? void 0 : i ? B(r, e) : r, u = t.length - 1, d; u >= 0; u--)
33
+ (d = t[u]) && (a = (i ? d(r, e, a) : d(a)) || a);
34
34
  return i && a && C(r, e, a), a;
35
35
  };
36
36
  let s = class extends $ {
37
37
  constructor() {
38
- super(...arguments), this.value = "", this.autocomplete = "off", this.placeholder = "", this.rows = null, this.counterCurrent = 0, this.inputRef = x();
38
+ super(...arguments), this.value = "", this.autocomplete = "off", this.placeholder = "", this.rows = null, this.counterCurrent = 0, this.inputRef = T();
39
39
  }
40
40
  attributeChangedCallback(t, r, e) {
41
41
  t === "value" && this.value !== r && (this.counterCurrent = e ? e.length : 0, this.valueChanged(e, r)), super.attributeChangedCallback(t, r, e);
@@ -50,7 +50,7 @@ let s = class extends $ {
50
50
  "pkt-input--fullwidth": this.fullwidth,
51
51
  "pkt-input--counter-error": this.counter && this.counterMaxLength && this.value.length && this.value.length > this.counterMaxLength
52
52
  }), r = this.ariaLabelledby || `${this.id}-input-label`;
53
- return f`<pkt-input-wrapper
53
+ return g`<pkt-input-wrapper
54
54
  label="${this.label}"
55
55
  ?counter=${this.counter}
56
56
  ?disabled=${this.disabled}
@@ -73,11 +73,15 @@ let s = class extends $ {
73
73
  class="pkt-textarea"
74
74
  >
75
75
  <textarea
76
+ ${y(this.inputRef)}
76
77
  class=${t}
77
78
  id=${this.id + "-input"}
78
79
  name=${(this.name || this.id) + "-input"}
79
- placeholder=${this.placeholder ?? d}
80
+ placeholder=${this.placeholder ?? h}
80
81
  .value=${E(this.value)}
82
+ minlength=${this.minlength || h}
83
+ maxlength=${this.maxlength || h}
84
+ ?readonly=${this.readonly}
81
85
  autocomplete=${this.autocomplete}
82
86
  aria-labelledby=${r}
83
87
  aria-invalid=${this.hasError}
@@ -96,22 +100,21 @@ let s = class extends $ {
96
100
  @blur=${(e) => {
97
101
  this.value = e.target.value, this.onBlur(), e.stopImmediatePropagation();
98
102
  }}
99
- ${y(this.inputRef)}
100
103
  ></textarea>
101
104
  </pkt-input-wrapper>`;
102
105
  }
103
106
  };
104
107
  o([
105
- l({ type: String, reflect: !0 })
108
+ p({ type: String, reflect: !0 })
106
109
  ], s.prototype, "value", 2);
107
110
  o([
108
- l({ type: String })
111
+ p({ type: String })
109
112
  ], s.prototype, "autocomplete", 2);
110
113
  o([
111
- l({ type: String, reflect: !0 })
114
+ p({ type: String })
112
115
  ], s.prototype, "placeholder", 2);
113
116
  o([
114
- l({ type: Number, reflect: !0 })
117
+ p({ type: Number })
115
118
  ], s.prototype, "rows", 2);
116
119
  o([
117
120
  c()
@@ -1,4 +1,4 @@
1
- "use strict";const t=require("./index-BsgcXRmM.cjs"),h=require("./custom-element-B-TlBwRu.cjs"),o=require("./ref-DPUgHtT0.cjs"),l=require("./class-map-C92zObAn.cjs");require("./input-wrapper-Bv0JBG3z.cjs");require("./index-D2toJo-e.cjs");var c=Object.defineProperty,d=Object.getOwnPropertyDescriptor,r=(p,i,n,s)=>{for(var e=s>1?void 0:s?d(i,n):i,a=p.length-1,u;a>=0;a--)(u=p[a])&&(e=(s?u(i,n,e):u(e))||e);return s&&e&&c(i,n,e),e};exports.PktTextinput=class extends t.PktInputElement{constructor(){super(...arguments),this.value="",this.type="text",this.autocomplete="off",this.iconNameRight=null,this.prefix=null,this.suffix=null,this.omitSearchIcon=!1,this.counterCurrent=0,this.inputRef=o.e()}attributeChangedCallback(i,n,s){i==="value"&&this.value!==n&&(this.counterCurrent=s?s.length:0,this.valueChanged(s,n)),super.attributeChangedCallback(i,n,s)}updated(i){var n;super.updated(i),i.has("value")&&(this.counterCurrent=((n=this.value)==null?void 0:n.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,n=l.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}),s=this.ariaLabelledby||`${this.id}-input-label`;return t.x`
1
+ "use strict";const t=require("./index-CR7t1zY9.cjs"),h=require("./custom-element-B-TlBwRu.cjs"),o=require("./ref-C2yPtMJA.cjs"),l=require("./class-map-a5HUzP83.cjs");require("./input-wrapper-DX41tnbj.cjs");require("./index-CmTjXoAb.cjs");var c=Object.defineProperty,d=Object.getOwnPropertyDescriptor,r=(p,i,n,s)=>{for(var e=s>1?void 0:s?d(i,n):i,a=p.length-1,u;a>=0;a--)(u=p[a])&&(e=(s?u(i,n,e):u(e))||e);return s&&e&&c(i,n,e),e};exports.PktTextinput=class extends t.PktInputElement{constructor(){super(...arguments),this.value="",this.type="text",this.size=null,this.autocomplete="off",this.iconNameRight=null,this.prefix=null,this.suffix=null,this.omitSearchIcon=!1,this.counterCurrent=0,this.inputRef=o.e()}attributeChangedCallback(i,n,s){i==="value"&&this.value!==n&&(this.counterCurrent=s?s.length:0,this.valueChanged(s,n)),super.attributeChangedCallback(i,n,s)}updated(i){var n;super.updated(i),i.has("value")&&(this.counterCurrent=((n=this.value)==null?void 0:n.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,n=l.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}),s=this.ariaLabelledby||`${this.id}-input-label`;return t.x`
2
2
  <pkt-input-wrapper
3
3
  label="${this.label}"
4
4
  ?counter=${this.counter}
@@ -29,9 +29,13 @@
29
29
  type=${this.type}
30
30
  name=${(this.name||this.id)+"-input"}
31
31
  id=${this.id+"-input"}
32
- placeholder=${this.placeholder??t.E}
32
+ placeholder=${this.placeholder||t.E}
33
33
  aria-labelledby=${s}
34
34
  autocomplete=${this.autocomplete}
35
+ minlength=${this.minlength||t.E}
36
+ maxlength=${this.maxlength||t.E}
37
+ ?readonly=${this.readonly}
38
+ size=${this.size||t.E}
35
39
  .value=${this.value}
36
40
  ?disabled=${this.disabled}
37
41
  aria-invalid=${this.hasError}
@@ -56,4 +60,4 @@
56
60
  ${!this.suffix&&i?t.x`<pkt-icon class="pkt-input-icon" name="magnifying-glass-big"></pkt-icon>`:t.E}
57
61
  </div>
58
62
  </pkt-input-wrapper>
59
- `}};r([t.n({type:String,reflect:!0})],exports.PktTextinput.prototype,"value",2);r([t.n({type:String,reflect:!0})],exports.PktTextinput.prototype,"type",2);r([t.n({type:String,reflect:!0})],exports.PktTextinput.prototype,"autocomplete",2);r([t.n({type:String})],exports.PktTextinput.prototype,"iconNameRight",2);r([t.n({type:String})],exports.PktTextinput.prototype,"prefix",2);r([t.n({type:String})],exports.PktTextinput.prototype,"suffix",2);r([t.n({type:Boolean})],exports.PktTextinput.prototype,"omitSearchIcon",2);r([t.r()],exports.PktTextinput.prototype,"counterCurrent",2);exports.PktTextinput=r([h.t("pkt-textinput")],exports.PktTextinput);
63
+ `}};r([t.n({type:String,reflect:!0})],exports.PktTextinput.prototype,"value",2);r([t.n({type:String})],exports.PktTextinput.prototype,"type",2);r([t.n({type:Number})],exports.PktTextinput.prototype,"size",2);r([t.n({type:String})],exports.PktTextinput.prototype,"autocomplete",2);r([t.n({type:String})],exports.PktTextinput.prototype,"iconNameRight",2);r([t.n({type:String})],exports.PktTextinput.prototype,"prefix",2);r([t.n({type:String})],exports.PktTextinput.prototype,"suffix",2);r([t.n({type:Boolean})],exports.PktTextinput.prototype,"omitSearchIcon",2);r([t.r()],exports.PktTextinput.prototype,"counterCurrent",2);exports.PktTextinput=r([h.t("pkt-textinput")],exports.PktTextinput);
@@ -1,32 +1,32 @@
1
- import { r as c, a as d, x as p, E as o, n as h } from "./index-BXyp3qCS.js";
2
- import { t as f } from "./custom-element-CWfU4dcr.js";
3
- import { e as $, n as g } from "./ref-B5hXBqpP.js";
4
- import { e as m } from "./class-map-d4EVPLBg.js";
5
- import "./input-wrapper-BbLHt2GC.js";
6
- import "./index-BPPtpQWt.js";
7
- var x = Object.defineProperty, v = Object.getOwnPropertyDescriptor, n = (i, e, s, t) => {
8
- for (var a = t > 1 ? void 0 : t ? v(e, s) : e, u = i.length - 1, l; u >= 0; u--)
9
- (l = i[u]) && (a = (t ? l(e, s, a) : l(a)) || a);
10
- return t && a && x(e, s, a), a;
1
+ import { r as c, a as d, x as h, E as n, n as p } from "./index-CFDwiDTU.js";
2
+ import { t as $ } from "./custom-element-CWfU4dcr.js";
3
+ import { e as g, n as m } from "./ref-CaiKp3S2.js";
4
+ import { e as f } from "./class-map-CBvUV2N3.js";
5
+ import "./input-wrapper-6vTrKtsW.js";
6
+ import "./index-RwtTBIhT.js";
7
+ var x = Object.defineProperty, y = Object.getOwnPropertyDescriptor, a = (i, e, r, t) => {
8
+ for (var o = t > 1 ? void 0 : t ? y(e, r) : e, u = i.length - 1, l; u >= 0; u--)
9
+ (l = i[u]) && (o = (t ? l(e, r, o) : l(o)) || o);
10
+ return t && o && x(e, r, o), o;
11
11
  };
12
- let r = class extends d {
12
+ let s = class extends d {
13
13
  constructor() {
14
- super(...arguments), this.value = "", this.type = "text", this.autocomplete = "off", this.iconNameRight = null, this.prefix = null, this.suffix = null, this.omitSearchIcon = !1, this.counterCurrent = 0, this.inputRef = $();
14
+ super(...arguments), this.value = "", this.type = "text", this.size = null, this.autocomplete = "off", this.iconNameRight = null, this.prefix = null, this.suffix = null, this.omitSearchIcon = !1, this.counterCurrent = 0, this.inputRef = g();
15
15
  }
16
- attributeChangedCallback(i, e, s) {
17
- i === "value" && this.value !== e && (this.counterCurrent = s ? s.length : 0, this.valueChanged(s, e)), super.attributeChangedCallback(i, e, s);
16
+ attributeChangedCallback(i, e, r) {
17
+ i === "value" && this.value !== e && (this.counterCurrent = r ? r.length : 0, this.valueChanged(r, e)), super.attributeChangedCallback(i, e, r);
18
18
  }
19
19
  updated(i) {
20
20
  var e;
21
21
  super.updated(i), i.has("value") && (this.counterCurrent = ((e = this.value) == null ? void 0 : e.length) || 0, this.valueChanged(this.value, i.get("value"))), i.has("id") && !this.name && this.id && (this.name = this.id);
22
22
  }
23
23
  render() {
24
- const i = this.type === "search" && !this.iconNameRight && !this.omitSearchIcon, e = m({
24
+ const i = this.type === "search" && !this.iconNameRight && !this.omitSearchIcon, e = f({
25
25
  "pkt-input": !0,
26
26
  "pkt-input--fullwidth": this.fullwidth,
27
27
  "pkt-input--counter-error": this.counter && this.counterMaxLength && this.value.length && this.value.length > this.counterMaxLength
28
- }), s = this.ariaLabelledby || `${this.id}-input-label`;
29
- return p`
28
+ }), r = this.ariaLabelledby || `${this.id}-input-label`;
29
+ return h`
30
30
  <pkt-input-wrapper
31
31
  label="${this.label}"
32
32
  ?counter=${this.counter}
@@ -50,16 +50,20 @@ let r = class extends d {
50
50
  class="pkt-textinput"
51
51
  >
52
52
  <div class="pkt-input__container">
53
- ${this.prefix ? p`<div class="pkt-input-prefix">${this.prefix}</div>` : o}
53
+ ${this.prefix ? h`<div class="pkt-input-prefix">${this.prefix}</div>` : n}
54
54
  <input
55
- ${g(this.inputRef)}
55
+ ${m(this.inputRef)}
56
56
  class=${e}
57
57
  type=${this.type}
58
58
  name=${(this.name || this.id) + "-input"}
59
59
  id=${this.id + "-input"}
60
- placeholder=${this.placeholder ?? o}
61
- aria-labelledby=${s}
60
+ placeholder=${this.placeholder || n}
61
+ aria-labelledby=${r}
62
62
  autocomplete=${this.autocomplete}
63
+ minlength=${this.minlength || n}
64
+ maxlength=${this.maxlength || n}
65
+ ?readonly=${this.readonly}
66
+ size=${this.size || n}
63
67
  .value=${this.value}
64
68
  ?disabled=${this.disabled}
65
69
  aria-invalid=${this.hasError}
@@ -77,51 +81,54 @@ let r = class extends d {
77
81
  this.value = t.target.value, this.onBlur(), t.stopImmediatePropagation();
78
82
  }}
79
83
  />
80
- ${this.suffix ? p`<div class="pkt-input-suffix">
84
+ ${this.suffix ? h`<div class="pkt-input-suffix">
81
85
  ${this.suffix}
82
- ${this.iconNameRight ? p`<pkt-icon
86
+ ${this.iconNameRight ? h`<pkt-icon
83
87
  class="pkt-input-suffix-icon"
84
88
  name=${this.iconNameRight}
85
- ></pkt-icon>` : o}
86
- ${i ? p`<pkt-icon
89
+ ></pkt-icon>` : n}
90
+ ${i ? h`<pkt-icon
87
91
  class="pkt-input-suffix-icon"
88
92
  name="magnifying-glass-big"
89
- ></pkt-icon>` : o}
90
- </div>` : o}
91
- ${!this.suffix && this.iconNameRight ? p`<pkt-icon class="pkt-input-icon" name=${this.iconNameRight}></pkt-icon>` : o}
92
- ${!this.suffix && i ? p`<pkt-icon class="pkt-input-icon" name="magnifying-glass-big"></pkt-icon>` : o}
93
+ ></pkt-icon>` : n}
94
+ </div>` : n}
95
+ ${!this.suffix && this.iconNameRight ? h`<pkt-icon class="pkt-input-icon" name=${this.iconNameRight}></pkt-icon>` : n}
96
+ ${!this.suffix && i ? h`<pkt-icon class="pkt-input-icon" name="magnifying-glass-big"></pkt-icon>` : n}
93
97
  </div>
94
98
  </pkt-input-wrapper>
95
99
  `;
96
100
  }
97
101
  };
98
- n([
99
- h({ type: String, reflect: !0 })
100
- ], r.prototype, "value", 2);
101
- n([
102
- h({ type: String, reflect: !0 })
103
- ], r.prototype, "type", 2);
104
- n([
105
- h({ type: String, reflect: !0 })
106
- ], r.prototype, "autocomplete", 2);
107
- n([
108
- h({ type: String })
109
- ], r.prototype, "iconNameRight", 2);
110
- n([
111
- h({ type: String })
112
- ], r.prototype, "prefix", 2);
113
- n([
114
- h({ type: String })
115
- ], r.prototype, "suffix", 2);
116
- n([
117
- h({ type: Boolean })
118
- ], r.prototype, "omitSearchIcon", 2);
119
- n([
102
+ a([
103
+ p({ type: String, reflect: !0 })
104
+ ], s.prototype, "value", 2);
105
+ a([
106
+ p({ type: String })
107
+ ], s.prototype, "type", 2);
108
+ a([
109
+ p({ type: Number })
110
+ ], s.prototype, "size", 2);
111
+ a([
112
+ p({ type: String })
113
+ ], s.prototype, "autocomplete", 2);
114
+ a([
115
+ p({ type: String })
116
+ ], s.prototype, "iconNameRight", 2);
117
+ a([
118
+ p({ type: String })
119
+ ], s.prototype, "prefix", 2);
120
+ a([
121
+ p({ type: String })
122
+ ], s.prototype, "suffix", 2);
123
+ a([
124
+ p({ type: Boolean })
125
+ ], s.prototype, "omitSearchIcon", 2);
126
+ a([
120
127
  c()
121
- ], r.prototype, "counterCurrent", 2);
122
- r = n([
123
- f("pkt-textinput")
124
- ], r);
128
+ ], s.prototype, "counterCurrent", 2);
129
+ s = a([
130
+ $("pkt-textinput")
131
+ ], s);
125
132
  export {
126
- r as P
133
+ s as P
127
134
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oslokommune/punkt-elements",
3
- "version": "12.17.0",
3
+ "version": "12.17.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",
@@ -30,7 +30,7 @@
30
30
  },
31
31
  "devDependencies": {
32
32
  "@oslokommune/punkt-assets": "^12.14.0",
33
- "@oslokommune/punkt-css": "^12.15.0",
33
+ "@oslokommune/punkt-css": "^12.17.1",
34
34
  "sass": "^1.78.0",
35
35
  "typescript": "^5.6.2",
36
36
  "vite": "^5.4.4",
@@ -57,5 +57,5 @@
57
57
  "url": "https://github.com/oslokommune/punkt/issues"
58
58
  },
59
59
  "license": "MIT",
60
- "gitHead": "dbe0cf072e3e48f6295734c4debc9d999c116289"
60
+ "gitHead": "998cf96281840a47cba5ba3e0c76e6fa1d2ed10e"
61
61
  }
@@ -304,6 +304,7 @@ export class PktCalendar extends PktElement {
304
304
  class="pkt-input pkt-input-compact"
305
305
  id="${this.id}-monthnav"
306
306
  @change=${(e: any) => {
307
+ e.stopImmediatePropagation()
307
308
  this.changeMonth(this.year, e.target.value)
308
309
  }}
309
310
  >
@@ -321,6 +322,7 @@ export class PktCalendar extends PktElement {
321
322
  size="4"
322
323
  placeholder="0000"
323
324
  @change=${(e: any) => {
325
+ e.stopImmediatePropagation()
324
326
  this.changeMonth(e.target.value, this.month)
325
327
  }}
326
328
  .value=${this.year}
@@ -516,13 +518,11 @@ export class PktCalendar extends PktElement {
516
518
  }
517
519
 
518
520
  private changeMonth(year: number, month: number) {
519
- this.year = year
520
- this.month = month
521
+ this.year = typeof year === 'string' ? parseInt(year) : year
522
+ this.month = typeof month === 'string' ? parseInt(month) : month
521
523
  this.tabIndexSet = 0
522
524
  this.focusedDate = null
523
525
  this.selectableDates = []
524
-
525
- this.requestUpdate()
526
526
  }
527
527
 
528
528
  private isInRange(date: TZDate | Date) {
@@ -246,11 +246,11 @@ export class PktDatepicker extends PktInputElement {
246
246
  .value=${this._value[0] ?? ''}
247
247
  min=${this.min}
248
248
  max=${this.max}
249
+ ?disabled=${this.disabled}
249
250
  @click=${(e: MouseEvent) => {
250
251
  e.preventDefault()
251
252
  this.showCalendar()
252
253
  }}
253
- ?disabled=${this.disabled}
254
254
  @keydown=${(e: KeyboardEvent) => {
255
255
  if (e.key === ',' || e.key === 'Enter') {
256
256
  this.inputRef.value?.blur()
@@ -301,12 +301,11 @@ export class PktDatepicker extends PktInputElement {
301
301
  .value=${this._value[1] ?? ''}
302
302
  min=${this.min}
303
303
  max=${this.max}
304
- aria-labelledby="${this.id}-to-label"
304
+ ?disabled=${this.disabled}
305
305
  @click=${(e: MouseEvent) => {
306
306
  e.preventDefault()
307
307
  this.showCalendar()
308
308
  }}
309
- ?disabled=${this.disabled}
310
309
  @keydown=${(e: KeyboardEvent) => {
311
310
  if (e.key === ',' || e.key === 'Enter') {
312
311
  this.inputRefTo.value?.blur()
@@ -370,6 +369,7 @@ export class PktDatepicker extends PktInputElement {
370
369
  id="${this.id}-input"
371
370
  min=${this.min || nothing}
372
371
  max=${this.max || nothing}
372
+ ?disabled=${this.disabled || (this.maxlength && this._value.length >= this.maxlength)}
373
373
  @click=${(e: MouseEvent) => {
374
374
  e.preventDefault()
375
375
  this.showCalendar()
@@ -400,7 +400,6 @@ export class PktDatepicker extends PktInputElement {
400
400
  this.toggleCalendar(e)
401
401
  }
402
402
  }}
403
- ?disabled=${this.disabled || (this.maxlength && this._value.length >= this.maxlength)}
404
403
  @change=${(e: Event) => {
405
404
  e.stopImmediatePropagation()
406
405
  }}
@@ -99,6 +99,9 @@ export class PktInputElement extends PktElement {
99
99
  @property({ type: String, reflect: true })
100
100
  pattern: string = ''
101
101
 
102
+ @property({ type: Boolean, reflect: true })
103
+ readonly: boolean = false
104
+
102
105
  @property({ type: String })
103
106
  ariaLabelledby: string | null = null
104
107
 
@@ -151,6 +154,12 @@ export class PktInputElement extends PktElement {
151
154
  @property({ type: Boolean })
152
155
  useWrapper: boolean = true
153
156
 
157
+ @property({ type: String, attribute: 'data-testid' })
158
+ dataTestid: string = ''
159
+
160
+ @property({ type: Boolean })
161
+ skipForwardTestid: boolean = false
162
+
154
163
  @state() touched: boolean = false
155
164
 
156
165
  constructor() {
@@ -317,6 +326,17 @@ export class PktInputElement extends PktElement {
317
326
  this.internals.reportValidity()
318
327
  }
319
328
 
329
+ protected updated(_changedProperties: PropertyValues): void {
330
+ if (_changedProperties.has('dataTestid') && this.dataTestid && this.inputRef.value) {
331
+ if (!this.skipForwardTestid) {
332
+ this.inputRef.value.dataset.testid = this.dataTestid
333
+ this.removeAttribute('data-testid')
334
+ } else if (!this.hasAttribute('data-testid')) {
335
+ this.setAttribute('data-testid', this.dataTestid)
336
+ }
337
+ }
338
+ }
339
+
320
340
  protected firstUpdated(_changedProperties: PropertyValues): void {
321
341
  super.firstUpdated(_changedProperties)
322
342
 
@@ -15,10 +15,10 @@ export class PktTextarea extends PktInputElement {
15
15
  @property({ type: String })
16
16
  autocomplete: string = 'off'
17
17
 
18
- @property({ type: String, reflect: true })
18
+ @property({ type: String })
19
19
  placeholder: string = ''
20
20
 
21
- @property({ type: Number, reflect: true })
21
+ @property({ type: Number })
22
22
  rows: number | null = null
23
23
 
24
24
  @state() counterCurrent = 0
@@ -79,11 +79,15 @@ export class PktTextarea extends PktInputElement {
79
79
  class="pkt-textarea"
80
80
  >
81
81
  <textarea
82
+ ${ref(this.inputRef)}
82
83
  class=${inputClasses}
83
84
  id=${this.id + '-input'}
84
85
  name=${(this.name || this.id) + '-input'}
85
86
  placeholder=${this.placeholder ?? nothing}
86
87
  .value=${live(this.value)}
88
+ minlength=${this.minlength || nothing}
89
+ maxlength=${this.maxlength || nothing}
90
+ ?readonly=${this.readonly}
87
91
  autocomplete=${this.autocomplete}
88
92
  aria-labelledby=${labelledBy}
89
93
  aria-invalid=${this.hasError}
@@ -107,7 +111,6 @@ export class PktTextarea extends PktInputElement {
107
111
  this.onBlur()
108
112
  e.stopImmediatePropagation()
109
113
  }}
110
- ${ref(this.inputRef)}
111
114
  ></textarea>
112
115
  </pkt-input-wrapper>`
113
116
  }
@@ -11,10 +11,13 @@ export class PktTextinput extends PktInputElement {
11
11
  @property({ type: String, reflect: true })
12
12
  value: string = ''
13
13
 
14
- @property({ type: String, reflect: true })
14
+ @property({ type: String })
15
15
  type: string = 'text'
16
16
 
17
- @property({ type: String, reflect: true })
17
+ @property({ type: Number })
18
+ size: number | null = null
19
+
20
+ @property({ type: String })
18
21
  autocomplete: string = 'off'
19
22
 
20
23
  @property({ type: String })
@@ -97,9 +100,13 @@ export class PktTextinput extends PktInputElement {
97
100
  type=${this.type}
98
101
  name=${(this.name || this.id) + '-input'}
99
102
  id=${this.id + '-input'}
100
- placeholder=${this.placeholder ?? nothing}
103
+ placeholder=${this.placeholder || nothing}
101
104
  aria-labelledby=${labelledBy}
102
105
  autocomplete=${this.autocomplete}
106
+ minlength=${this.minlength || nothing}
107
+ maxlength=${this.maxlength || nothing}
108
+ ?readonly=${this.readonly}
109
+ size=${this.size || nothing}
103
110
  .value=${this.value}
104
111
  ?disabled=${this.disabled}
105
112
  aria-invalid=${this.hasError}