@oslokommune/punkt-elements 12.37.0 → 12.37.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/dist/{accordionitem-cvsySqgK.cjs → accordionitem-RFwXQC_0.cjs} +1 -1
  3. package/dist/{accordionitem-Db-3WiJS.js → accordionitem-vmwqD9rr.js} +1 -1
  4. package/dist/{alert-DWIElKEZ.cjs → alert-C2EPmB0W.cjs} +1 -1
  5. package/dist/{alert-B5lVS6Qs.js → alert-C33z1kBf.js} +1 -1
  6. package/dist/{button-BNdVIhUp.cjs → button-jdMbbn-e.cjs} +1 -1
  7. package/dist/{button-B6uRE7uT.js → button-sf_Yzx3X.js} +2 -2
  8. package/dist/{card-B5zTEmH1.js → card-Cyww1yKr.js} +2 -2
  9. package/dist/{card-BDcr3PII.cjs → card-DH-3qNgp.cjs} +1 -1
  10. package/dist/{checkbox-CyYfA2fu.js → checkbox-Cz3sIWt0.js} +1 -1
  11. package/dist/{checkbox-CqatE-eX.cjs → checkbox-U8aPrLjG.cjs} +1 -1
  12. package/dist/{combobox-CELUAZxF.js → combobox-CFH5-Ioh.js} +5 -5
  13. package/dist/{combobox-D9NKnao2.cjs → combobox-ChFttX7F.cjs} +1 -1
  14. package/dist/{consent-jXR0vKAu.cjs → consent-BNY1XvpV.cjs} +1 -1
  15. package/dist/{consent-Baktq_-1.js → consent-CTX9zf81.js} +6 -6
  16. package/dist/{datepicker-CpkTwszH.js → datepicker-hetVXVX4.js} +118 -105
  17. package/dist/{datepicker-cR9MtXOh.cjs → datepicker-mhQrHoNJ.cjs} +16 -16
  18. package/dist/dialog-polyfill.esm-CPKZe7AL.cjs +1 -0
  19. package/dist/dialog-polyfill.esm-CbjBMXAG.js +395 -0
  20. package/dist/{heading-CP3NaeWE.cjs → heading-BnJhJDMD.cjs} +1 -1
  21. package/dist/{heading-BkC05ohM.js → heading-DNLQdsXY.js} +1 -1
  22. package/dist/{helptext-BLHAJ1aC.js → helptext-DcSUjjEq.js} +1 -1
  23. package/dist/{helptext-CCnYxYA9.cjs → helptext-bMgnhZ1R.cjs} +1 -1
  24. package/dist/index.d.ts +2 -0
  25. package/dist/input-element-XmmyUZmB.cjs +1 -0
  26. package/dist/{input-element-Bic-t96S.js → input-element-aQDMXDVQ.js} +31 -26
  27. package/dist/{input-wrapper-Cn929YTV.cjs → input-wrapper-B-f_SotM.cjs} +1 -1
  28. package/dist/{input-wrapper-CeeNYbDA.js → input-wrapper-BdeoMGnk.js} +2 -2
  29. package/dist/{link-BYI8VNGd.js → link-B748tCGi.js} +1 -1
  30. package/dist/{link-CnibgS3c.cjs → link-BrDbM3GT.cjs} +1 -1
  31. package/dist/{linkcard--zuuAt_v.js → linkcard-Bt-Qa_SP.js} +1 -1
  32. package/dist/{linkcard-DPGX1kb1.cjs → linkcard-s9yoOq90.cjs} +1 -1
  33. package/dist/{loader-BN4q8pSl.cjs → loader-Bk4XPiOY.cjs} +1 -1
  34. package/dist/{loader-DgIiyYBl.js → loader-C9EtX_mK.js} +1 -1
  35. package/dist/{messagebox-BWJr42m9.cjs → messagebox-B0kgftoP.cjs} +1 -1
  36. package/dist/{messagebox-cme5VbUM.js → messagebox-DZDP8XZt.js} +1 -1
  37. package/dist/modal-4aQZVxGl.cjs +33 -0
  38. package/dist/{modal-DIwagdAc.js → modal-m--Sfj_1.js} +14 -9
  39. package/dist/pkt-accordion.cjs +1 -1
  40. package/dist/pkt-accordion.js +2 -2
  41. package/dist/pkt-alert.cjs +1 -1
  42. package/dist/pkt-alert.js +1 -1
  43. package/dist/pkt-button.cjs +1 -1
  44. package/dist/pkt-button.js +1 -1
  45. package/dist/pkt-card.cjs +1 -1
  46. package/dist/pkt-card.js +1 -1
  47. package/dist/pkt-checkbox.cjs +1 -1
  48. package/dist/pkt-checkbox.js +1 -1
  49. package/dist/pkt-combobox.cjs +1 -1
  50. package/dist/pkt-combobox.js +1 -1
  51. package/dist/pkt-consent.cjs +1 -1
  52. package/dist/pkt-consent.js +1 -1
  53. package/dist/pkt-datepicker.cjs +1 -1
  54. package/dist/pkt-datepicker.js +1 -1
  55. package/dist/pkt-heading.cjs +1 -1
  56. package/dist/pkt-heading.js +1 -1
  57. package/dist/pkt-helptext.cjs +1 -1
  58. package/dist/pkt-helptext.js +1 -1
  59. package/dist/pkt-index.cjs +1 -1
  60. package/dist/pkt-index.js +22 -22
  61. package/dist/pkt-input-wrapper.cjs +1 -1
  62. package/dist/pkt-input-wrapper.js +1 -1
  63. package/dist/pkt-link.cjs +1 -1
  64. package/dist/pkt-link.js +1 -1
  65. package/dist/pkt-linkcard.cjs +1 -1
  66. package/dist/pkt-linkcard.js +1 -1
  67. package/dist/pkt-loader.cjs +1 -1
  68. package/dist/pkt-loader.js +1 -1
  69. package/dist/pkt-messagebox.cjs +1 -1
  70. package/dist/pkt-messagebox.js +1 -1
  71. package/dist/pkt-modal.cjs +1 -1
  72. package/dist/pkt-modal.js +1 -1
  73. package/dist/{pkt-options-controller-TJ1apYGF.cjs → pkt-options-controller-Ay9ELZTV.cjs} +1 -1
  74. package/dist/{pkt-options-controller-CFmzX4xL.js → pkt-options-controller-DepYQBqb.js} +1 -1
  75. package/dist/pkt-radiobutton.cjs +1 -1
  76. package/dist/pkt-radiobutton.js +1 -1
  77. package/dist/pkt-select.cjs +1 -1
  78. package/dist/pkt-select.js +1 -1
  79. package/dist/pkt-slot-controller-Da-RgXfS.cjs +1 -0
  80. package/dist/{pkt-slot-controller-DFrc5O93.js → pkt-slot-controller-DtDaD9q_.js} +19 -19
  81. package/dist/pkt-tag.cjs +1 -1
  82. package/dist/pkt-tag.js +1 -1
  83. package/dist/pkt-textarea.cjs +1 -1
  84. package/dist/pkt-textarea.js +1 -1
  85. package/dist/pkt-textinput.cjs +1 -1
  86. package/dist/pkt-textinput.js +1 -1
  87. package/dist/{radiobutton-CIW0FvT8.cjs → radiobutton-DtL-nc1b.cjs} +1 -1
  88. package/dist/{radiobutton-DtHuz7qn.js → radiobutton-DtpGqoci.js} +1 -1
  89. package/dist/{select-DbRLz-7l.js → select-CNK8uoVi.js} +4 -4
  90. package/dist/{select-BJziJVde.cjs → select-s98KeDqQ.cjs} +1 -1
  91. package/dist/{tag-CgkUxA5D.cjs → tag-B9kFYxHg.cjs} +1 -1
  92. package/dist/{tag-CGnj4c1Z.js → tag-Cu8afZy8.js} +1 -1
  93. package/dist/{textarea-CiA4IzMs.js → textarea-C9Kj6gGv.js} +3 -3
  94. package/dist/{textarea-qX4Inr1X.cjs → textarea-CeUz6coA.cjs} +1 -1
  95. package/dist/{textinput-BlsgLNwW.cjs → textinput-BArDDwC2.cjs} +4 -3
  96. package/dist/{textinput-CrxjZNEq.js → textinput-Dj6R0L45.js} +33 -26
  97. package/package.json +4 -3
  98. package/src/components/button/button.ts +1 -0
  99. package/src/components/consent/consent.ts +1 -1
  100. package/src/components/datepicker/datepicker.ts +36 -4
  101. package/src/components/modal/modal.ts +14 -2
  102. package/src/components/textinput/textinput.ts +10 -0
  103. package/dist/input-element-C9ma8cdz.cjs +0 -1
  104. package/dist/modal-OC0efchb.cjs +0 -33
  105. package/dist/pkt-slot-controller-plQxXRvV.cjs +0 -1
@@ -1,16 +1,16 @@
1
1
  import { e as f } from "./class-map-KyMqi0fa.js";
2
2
  import { o } from "./if-defined-BErSJCeJ.js";
3
- import { x as p, E as m, n as r, a as w } from "./element-DjjF_tEh.js";
4
- import { r as b } from "./state-BtbpSrdV.js";
5
- import { n as $, f as v, a as R, b as y, d as x } from "./calendar-KDcOWD6V.js";
6
- import { P as C } from "./input-element-Bic-t96S.js";
7
- import { e as g, n as u } from "./ref-iIffqQAI.js";
8
- import { c as _ } from "./repeat-D4kMediE.js";
3
+ import { x as u, E as g, n as r, a as w } from "./element-DjjF_tEh.js";
4
+ import { r as k } from "./state-BtbpSrdV.js";
5
+ import { n as v, f as $, a as R, b as y, d as x } from "./calendar-KDcOWD6V.js";
6
+ import { P as C } from "./input-element-aQDMXDVQ.js";
7
+ import { e as m, n as p } from "./ref-iIffqQAI.js";
8
+ import { c as T } from "./repeat-D4kMediE.js";
9
9
  import "./icon-Beoxup8E.js";
10
- import "./input-wrapper-CeeNYbDA.js";
11
- import "./tag-CGnj4c1Z.js";
12
- import { P as T } from "./pkt-slot-controller-DFrc5O93.js";
13
- const D = {
10
+ import "./input-wrapper-BdeoMGnk.js";
11
+ import "./tag-Cu8afZy8.js";
12
+ import { P as _ } from "./pkt-slot-controller-DtDaD9q_.js";
13
+ const S = {
14
14
  dateformat: {
15
15
  default: "dd.MM.yyyy"
16
16
  },
@@ -33,33 +33,33 @@ const D = {
33
33
  default: !1
34
34
  }
35
35
  }, c = {
36
- props: D
36
+ props: S
37
37
  };
38
- var S = Object.defineProperty, I = Object.getOwnPropertyDescriptor, l = (t, e, i, n) => {
39
- for (var s = n > 1 ? void 0 : n ? I(e, i) : e, h = t.length - 1, d; h >= 0; h--)
40
- (d = t[h]) && (s = (n ? d(e, i, s) : d(s)) || s);
41
- return n && s && S(e, i, s), s;
38
+ var D = Object.defineProperty, I = Object.getOwnPropertyDescriptor, n = (t, e, i, a) => {
39
+ for (var s = a > 1 ? void 0 : a ? I(e, i) : e, h = t.length - 1, d; h >= 0; h--)
40
+ (d = t[h]) && (s = (a ? d(e, i, s) : d(s)) || s);
41
+ return a && s && D(e, i, s), s;
42
42
  };
43
- const k = (t) => new Promise((e) => setTimeout(e, t));
44
- let a = class extends C {
43
+ const b = (t) => new Promise((e) => setTimeout(e, t));
44
+ let l = class extends C {
45
45
  /**
46
46
  * Housekeeping / lifecycle methods
47
47
  */
48
48
  constructor() {
49
- super(), this.value = "", this._value = this.value ? Array.isArray(this.value) ? this.value : this.value.split(",") : [], this.label = "Datovelger", this.dateformat = c.props.dateformat.default, this.multiple = c.props.multiple.default, this.maxlength = null, this.range = c.props.range.default, this.showRangeLabels = !1, this.min = null, this.max = null, this.weeknumbers = c.props.weeknumbers.default, this.withcontrols = c.props.withcontrols.default, this.excludedates = [], this.excludeweekdays = [], this.currentmonth = null, this.calendarOpen = !1, this.timezone = "Europe/Oslo", this.inputClasses = {}, this.buttonClasses = {}, this.inputRef = g(), this.inputRefTo = g(), this.btnRef = g(), this.calRef = g(), this.popupRef = g(), this.helptextSlot = g(), this.addToSelected = (t) => {
49
+ super(), this.value = "", this._value = this.value ? Array.isArray(this.value) ? this.value : this.value.split(",") : [], this.label = "Datovelger", this.dateformat = c.props.dateformat.default, this.multiple = c.props.multiple.default, this.maxlength = null, this.range = c.props.range.default, this.showRangeLabels = !1, this.min = null, this.max = null, this.weeknumbers = c.props.weeknumbers.default, this.withcontrols = c.props.withcontrols.default, this.excludedates = [], this.excludeweekdays = [], this.currentmonth = null, this.calendarOpen = !1, this.timezone = "Europe/Oslo", this.inputClasses = {}, this.buttonClasses = {}, this.inputRef = m(), this.inputRefTo = m(), this.btnRef = m(), this.calRef = m(), this.popupRef = m(), this.helptextSlot = m(), this.addToSelected = (t) => {
50
50
  const e = t.target;
51
51
  if (!e.value) return;
52
- const i = this.min ? $(this.min) : null, n = this.max ? $(this.max) : null, s = $(e.value.split(",")[0]);
53
- s && !isNaN(s.getTime()) && (!i || s >= i) && (!n || s <= n) && this.calRef.value && this.calRef.value.handleDateSelect(s), e.value = "";
54
- }, this.slotController = new T(this, this.helptextSlot);
52
+ const i = this.min ? v(this.min) : null, a = this.max ? v(this.max) : null, s = v(e.value.split(",")[0]);
53
+ s && !isNaN(s.getTime()) && (!i || s >= i) && (!a || s <= a) && this.calRef.value && this.calRef.value.handleDateSelect(s), e.value = "";
54
+ }, this.slotController = new _(this, this.helptextSlot);
55
55
  }
56
56
  async connectedCallback() {
57
57
  super.connectedCallback();
58
58
  const t = navigator.userAgent, e = /iP(hone|od|ad)/.test(t);
59
59
  this.inputType = e ? "text" : "date", document && document.body.addEventListener("click", (i) => {
60
- var n, s;
61
- (n = this.inputRef) != null && n.value && ((s = this.btnRef) != null && s.value) && !this.inputRef.value.contains(i.target) && !(this.inputRefTo.value && this.inputRefTo.value.contains(i.target)) && !this.btnRef.value.contains(i.target) && !i.target.closest(".pkt-calendar-popup") && this.calendarOpen && (this.onBlur(), this.hideCalendar());
62
- }), this.value.length && this._value.length === 0 && (this._value = Array.isArray(this.value) ? this.value : this.value.split(",")), this.min = this.min || c.props.min.default, this.max = this.max || c.props.max.default, typeof this.excludedates == "string" && (this.excludedates = this.excludedates.split(",")), typeof this.excludeweekdays == "string" && (this.excludeweekdays = this.excludeweekdays.split(",")), (this.multiple || this.range) && this.name && !this.name.endsWith("[]") && (this.name = this.name + "[]"), this.calendarOpen && (await k(20), this.handleCalendarPosition());
60
+ var a, s;
61
+ (a = this.inputRef) != null && a.value && ((s = this.btnRef) != null && s.value) && !this.inputRef.value.contains(i.target) && !(this.inputRefTo.value && this.inputRefTo.value.contains(i.target)) && !this.btnRef.value.contains(i.target) && !i.target.closest(".pkt-calendar-popup") && this.calendarOpen && (this.onBlur(), this.hideCalendar());
62
+ }), this.value.length && this._value.length === 0 && (this._value = Array.isArray(this.value) ? this.value : this.value.split(",")), this.min = this.min || c.props.min.default, this.max = this.max || c.props.max.default, typeof this.excludedates == "string" && (this.excludedates = this.excludedates.split(",")), typeof this.excludeweekdays == "string" && (this.excludeweekdays = this.excludeweekdays.split(",")), (this.multiple || this.range) && this.name && !this.name.endsWith("[]") && (this.name = this.name + "[]"), this.calendarOpen && (await b(20), this.handleCalendarPosition());
63
63
  }
64
64
  disconnectedCallback() {
65
65
  super.disconnectedCallback(), document && document.body.removeEventListener("click", (t) => {
@@ -85,7 +85,7 @@ let a = class extends C {
85
85
  * Rendering
86
86
  */
87
87
  renderInput() {
88
- return p`
88
+ return u`
89
89
  <input
90
90
  class="${f(this.inputClasses)}"
91
91
  .type=${this.inputType}
@@ -98,8 +98,11 @@ let a = class extends C {
98
98
  }}
99
99
  ?disabled=${this.disabled}
100
100
  @keydown=${(t) => {
101
- var e;
102
- (t.key === "," || t.key === "Enter") && ((e = this.inputRef.value) == null || e.blur()), (t.key === "Space" || t.key === " ") && (t.preventDefault(), this.toggleCalendar(t));
101
+ var e, i;
102
+ if (t.key === "," && ((e = this.inputRef.value) == null || e.blur()), (t.key === "Space" || t.key === " ") && (t.preventDefault(), this.toggleCalendar(t)), t.key === "Enter") {
103
+ const a = this.internals.form;
104
+ a ? a.requestSubmit() : (i = this.inputRef.value) == null || i.blur();
105
+ }
103
106
  }}
104
107
  @input=${(t) => {
105
108
  this.onInput(), t.stopImmediatePropagation();
@@ -114,7 +117,7 @@ let a = class extends C {
114
117
  @change=${(t) => {
115
118
  t.stopImmediatePropagation();
116
119
  }}
117
- ${u(this.inputRef)}
120
+ ${p(this.inputRef)}
118
121
  />
119
122
  `;
120
123
  }
@@ -123,8 +126,8 @@ let a = class extends C {
123
126
  "pkt-input-prefix": this.showRangeLabels,
124
127
  "pkt-hide": !this.showRangeLabels
125
128
  };
126
- return p`
127
- ${this.showRangeLabels ? p` <div class="pkt-input-prefix">${this.strings.generic.from}</div> ` : m}
129
+ return u`
130
+ ${this.showRangeLabels ? u` <div class="pkt-input-prefix">${this.strings.generic.from}</div> ` : g}
128
131
  <input
129
132
  class=${f(this.inputClasses)}
130
133
  .type=${this.inputType}
@@ -137,8 +140,11 @@ let a = class extends C {
137
140
  e.preventDefault(), this.showCalendar();
138
141
  }}
139
142
  @keydown=${(e) => {
140
- var i;
141
- (e.key === "," || e.key === "Enter") && ((i = this.inputRef.value) == null || i.blur()), (e.key === "Space" || e.key === " ") && (e.preventDefault(), this.toggleCalendar(e));
143
+ var i, a;
144
+ if (e.key === "," && ((i = this.inputRef.value) == null || i.blur()), (e.key === "Space" || e.key === " ") && (e.preventDefault(), this.toggleCalendar(e)), e.key === "Enter") {
145
+ const s = this.internals.form;
146
+ s ? s.requestSubmit() : (a = this.inputRefTo.value) == null || a.focus();
147
+ }
142
148
  }}
143
149
  @input=${(e) => {
144
150
  this.onInput(), e.stopImmediatePropagation();
@@ -147,22 +153,22 @@ let a = class extends C {
147
153
  this.onFocus(), this.isMobileSafari && this.showCalendar();
148
154
  }}
149
155
  @blur=${(e) => {
150
- var i, n;
156
+ var i, a;
151
157
  if (e.target.value) {
152
158
  this.manageValidity(e.target);
153
- const s = v(e.target.value);
154
- s && this._value[0] !== e.target.value && this._value[1] && (this.clearInputValue(), (n = (i = this.calRef) == null ? void 0 : i.value) == null || n.handleDateSelect(s));
159
+ const s = $(e.target.value);
160
+ s && this._value[0] !== e.target.value && this._value[1] && (this.clearInputValue(), (a = (i = this.calRef) == null ? void 0 : i.value) == null || a.handleDateSelect(s));
155
161
  } else this._value[0] && this.clearInputValue();
156
162
  }}
157
163
  @change=${(e) => {
158
164
  e.stopImmediatePropagation();
159
165
  }}
160
- ${u(this.inputRef)}
166
+ ${p(this.inputRef)}
161
167
  />
162
168
  <div class="${f(t)}" id="${this.id}-to-label">
163
169
  ${this.strings.generic.to}
164
170
  </div>
165
- ${this.showRangeLabels ? m : p` <div class="pkt-input-separator">–</div> `}
171
+ ${this.showRangeLabels ? g : u` <div class="pkt-input-separator">–</div> `}
166
172
  <input
167
173
  class=${f(this.inputClasses)}
168
174
  .type=${this.inputType}
@@ -176,8 +182,11 @@ let a = class extends C {
176
182
  e.preventDefault(), this.showCalendar();
177
183
  }}
178
184
  @keydown=${(e) => {
179
- var i;
180
- (e.key === "," || e.key === "Enter") && ((i = this.inputRefTo.value) == null || i.blur()), (e.key === "Space" || e.key === " ") && (e.preventDefault(), this.toggleCalendar(e));
185
+ var i, a;
186
+ if (e.key === "," && ((i = this.inputRefTo.value) == null || i.blur()), (e.key === "Space" || e.key === " ") && (e.preventDefault(), this.toggleCalendar(e)), e.key === "Enter") {
187
+ const s = this.internals.form;
188
+ s ? s.requestSubmit() : (a = this.inputRefTo.value) == null || a.blur();
189
+ }
181
190
  }}
182
191
  @input=${(e) => {
183
192
  this.onInput(), e.stopImmediatePropagation();
@@ -186,7 +195,7 @@ let a = class extends C {
186
195
  this.onFocus(), this.isMobileSafari && this.showCalendar();
187
196
  }}
188
197
  @blur=${(e) => {
189
- var i, n, s;
198
+ var i, a, s;
190
199
  if ((i = this.calRef.value) != null && i.contains(e.relatedTarget) || this.onBlur(), e.target.value) {
191
200
  this.manageValidity(e.target);
192
201
  const h = e.target.value;
@@ -199,19 +208,19 @@ let a = class extends C {
199
208
  this.strings.forms.messages.rangeOverflow,
200
209
  e.target
201
210
  );
202
- const d = v(e.target.value);
203
- d && this._value[1] !== R(d) && ((s = (n = this.calRef) == null ? void 0 : n.value) == null || s.handleDateSelect(d));
211
+ const d = $(e.target.value);
212
+ d && this._value[1] !== R(d) && ((s = (a = this.calRef) == null ? void 0 : a.value) == null || s.handleDateSelect(d));
204
213
  }
205
214
  }}
206
215
  @change=${(e) => {
207
216
  e.stopImmediatePropagation();
208
217
  }}
209
- ${u(this.inputRefTo)}
218
+ ${p(this.inputRefTo)}
210
219
  />
211
220
  `;
212
221
  }
213
222
  renderMultipleInput() {
214
- return p`
223
+ return u`
215
224
  <input
216
225
  class=${f(this.inputClasses)}
217
226
  .type=${this.inputType}
@@ -233,22 +242,26 @@ let a = class extends C {
233
242
  this.onFocus(), this.isMobileSafari && this.showCalendar();
234
243
  }}
235
244
  @keydown=${(t) => {
236
- (t.key === "," || t.key === "Enter") && (t.preventDefault(), this.addToSelected(t)), (t.key === "Space" || t.key === " ") && (t.preventDefault(), this.toggleCalendar(t));
245
+ var e;
246
+ if (t.key === "," && (t.preventDefault(), this.addToSelected(t)), (t.key === "Space" || t.key === " ") && (t.preventDefault(), this.toggleCalendar(t)), t.key === "Enter") {
247
+ const i = this.internals.form;
248
+ i ? i.requestSubmit() : (e = this.inputRef.value) == null || e.blur();
249
+ }
237
250
  }}
238
251
  @change=${(t) => {
239
252
  t.stopImmediatePropagation();
240
253
  }}
241
- ${u(this.inputRef)}
254
+ ${p(this.inputRef)}
242
255
  />
243
256
  `;
244
257
  }
245
258
  renderTags() {
246
- return p`
259
+ return u`
247
260
  <div class="pkt-datepicker__tags" aria-live="polite">
248
- ${this._value[0] ? _(
261
+ ${this._value[0] ? T(
249
262
  this._value ?? [],
250
263
  (t) => t,
251
- (t) => p`
264
+ (t) => u`
252
265
  <pkt-tag
253
266
  .id="${this.id + t + "-tag"}"
254
267
  closeTag
@@ -258,23 +271,23 @@ let a = class extends C {
258
271
  )}"
259
272
  @close=${() => {
260
273
  var e;
261
- return (e = this.calRef.value) == null ? void 0 : e.handleDateSelect(v(t));
274
+ return (e = this.calRef.value) == null ? void 0 : e.handleDateSelect($(t));
262
275
  }}
263
276
  ><time datetime="${t}">${y(t, this.dateformat)}</time></pkt-tag
264
277
  >
265
278
  `
266
- ) : m}
279
+ ) : g}
267
280
  </div>
268
281
  `;
269
282
  }
270
283
  renderCalendar() {
271
- return p`<div
284
+ return u`<div
272
285
  class="pkt-calendar-popup pkt-${this.calendarOpen ? "show" : "hide"}"
273
286
  @focusout=${(t) => {
274
287
  this.calendarOpen && this.handleFocusOut(t);
275
288
  }}
276
289
  id="${this.id}-popup"
277
- ${u(this.popupRef)}
290
+ ${p(this.popupRef)}
278
291
  >
279
292
  <pkt-calendar
280
293
  id="${this.id}-calendar"
@@ -288,14 +301,14 @@ let a = class extends C {
288
301
  .latest=${this.max}
289
302
  .excludedates=${Array.isArray(this.excludedates) ? this.excludedates : this.excludedates.split(",")}
290
303
  .excludeweekdays=${this.excludeweekdays}
291
- .currentmonth=${this.currentmonth ? $(this.currentmonth) : null}
304
+ .currentmonth=${this.currentmonth ? v(this.currentmonth) : null}
292
305
  @date-selected=${(t) => {
293
306
  this.value = !this.multiple && !this.range ? t.detail[0] : t.detail, this._value = t.detail, this.inputRef.value && (this.range && this.inputRefTo.value ? (this.inputRef.value.value = this._value[0] ?? "", this.inputRefTo.value.value = this._value[1] ?? "") : this.multiple || (this.inputRef.value.value = this._value.length ? this._value[0] : ""));
294
307
  }}
295
308
  @close=${() => {
296
309
  this.onBlur(), this.hideCalendar();
297
310
  }}
298
- ${u(this.calRef)}
311
+ ${p(this.calRef)}
299
312
  ></pkt-calendar>
300
313
  </div>`;
301
314
  }
@@ -312,7 +325,7 @@ let a = class extends C {
312
325
  "pkt-btn": !0,
313
326
  "pkt-btn--icon-only": !0,
314
327
  "pkt-btn--tertiary": !0
315
- }, p`
328
+ }, u`
316
329
  <pkt-input-wrapper
317
330
  label="${this.label}"
318
331
  forId="${this.id}-input"
@@ -336,8 +349,8 @@ let a = class extends C {
336
349
  .ariaDescribedBy=${this.ariaDescribedBy}
337
350
  class="pkt-datepicker"
338
351
  >
339
- <div class="pkt-contents" ${u(this.helptextSlot)} name="helptext" slot="helptext"></div>
340
- ${this.multiple ? this.renderTags() : m}
352
+ <div class="pkt-contents" ${p(this.helptextSlot)} name="helptext" slot="helptext"></div>
353
+ ${this.multiple ? this.renderTags() : g}
341
354
  <div
342
355
  class="pkt-datepicker__inputs ${this.range && this.showRangeLabels ? "pkt-input__range-inputs" : ""}"
343
356
  >
@@ -348,7 +361,7 @@ let a = class extends C {
348
361
  type="button"
349
362
  @click=${this.toggleCalendar}
350
363
  ?disabled=${this.disabled}
351
- ${u(this.btnRef)}
364
+ ${p(this.btnRef)}
352
365
  >
353
366
  <pkt-icon name="calendar"></pkt-icon>
354
367
  <span class="pkt-btn__text">${this.strings.calendar.buttonAltText}</span>
@@ -365,9 +378,9 @@ let a = class extends C {
365
378
  handleCalendarPosition() {
366
379
  var t;
367
380
  if (this.popupRef.value && this.inputRef.value) {
368
- const e = this.multiple && !!this.maxlength, i = ((t = this.inputRef.value.parentElement) == null ? void 0 : t.getBoundingClientRect()) || this.inputRef.value.getBoundingClientRect(), n = e ? i.height + 30 : i.height, s = this.popupRef.value.getBoundingClientRect().height;
381
+ const e = this.multiple && !!this.maxlength, i = ((t = this.inputRef.value.parentElement) == null ? void 0 : t.getBoundingClientRect()) || this.inputRef.value.getBoundingClientRect(), a = e ? i.height + 30 : i.height, s = this.popupRef.value.getBoundingClientRect().height;
369
382
  let h = e ? "calc(100% - 30px)" : "100%";
370
- i && i.top + s > window.innerHeight && i.top - s > 0 && (h = `calc(100% - ${n}px - ${s}px)`), this.popupRef.value.style.top = h;
383
+ i && i.top + s > window.innerHeight && i.top - s > 0 && (h = `calc(100% - ${a}px - ${s}px)`), this.popupRef.value.style.top = h;
371
384
  }
372
385
  }
373
386
  handleFocusOut(t) {
@@ -375,7 +388,7 @@ let a = class extends C {
375
388
  }
376
389
  async showCalendar() {
377
390
  var t;
378
- this.calendarOpen = !0, await k(20), this.handleCalendarPosition(), this.isMobileSafari && ((t = this.calRef.value) == null || t.focusOnCurrentDate());
391
+ this.calendarOpen = !0, await b(20), this.handleCalendarPosition(), this.isMobileSafari && ((t = this.calRef.value) == null || t.focusOnCurrentDate());
379
392
  }
380
393
  hideCalendar() {
381
394
  this.calendarOpen = !1;
@@ -384,66 +397,66 @@ let a = class extends C {
384
397
  t.preventDefault(), this.calendarOpen ? this.hideCalendar() : this.showCalendar();
385
398
  }
386
399
  };
387
- l([
400
+ n([
388
401
  r({ type: String, reflect: !0 })
389
- ], a.prototype, "value", 2);
390
- l([
402
+ ], l.prototype, "value", 2);
403
+ n([
391
404
  r({ type: Array })
392
- ], a.prototype, "_value", 2);
393
- l([
405
+ ], l.prototype, "_value", 2);
406
+ n([
394
407
  r({ type: String, reflect: !0 })
395
- ], a.prototype, "label", 2);
396
- l([
408
+ ], l.prototype, "label", 2);
409
+ n([
397
410
  r({ type: String })
398
- ], a.prototype, "dateformat", 2);
399
- l([
411
+ ], l.prototype, "dateformat", 2);
412
+ n([
400
413
  r({ type: Boolean, reflect: !0 })
401
- ], a.prototype, "multiple", 2);
402
- l([
414
+ ], l.prototype, "multiple", 2);
415
+ n([
403
416
  r({ type: Number, reflect: !0 })
404
- ], a.prototype, "maxlength", 2);
405
- l([
417
+ ], l.prototype, "maxlength", 2);
418
+ n([
406
419
  r({ type: Boolean, reflect: !0 })
407
- ], a.prototype, "range", 2);
408
- l([
420
+ ], l.prototype, "range", 2);
421
+ n([
409
422
  r({ type: Boolean })
410
- ], a.prototype, "showRangeLabels", 2);
411
- l([
423
+ ], l.prototype, "showRangeLabels", 2);
424
+ n([
412
425
  r({ type: String, reflect: !0 })
413
- ], a.prototype, "min", 2);
414
- l([
426
+ ], l.prototype, "min", 2);
427
+ n([
415
428
  r({ type: String, reflect: !0 })
416
- ], a.prototype, "max", 2);
417
- l([
429
+ ], l.prototype, "max", 2);
430
+ n([
418
431
  r({ type: Boolean })
419
- ], a.prototype, "weeknumbers", 2);
420
- l([
432
+ ], l.prototype, "weeknumbers", 2);
433
+ n([
421
434
  r({ type: Boolean, reflect: !0 })
422
- ], a.prototype, "withcontrols", 2);
423
- l([
435
+ ], l.prototype, "withcontrols", 2);
436
+ n([
424
437
  r({ converter: x.csvToArray })
425
- ], a.prototype, "excludedates", 2);
426
- l([
438
+ ], l.prototype, "excludedates", 2);
439
+ n([
427
440
  r({ converter: x.csvToArray })
428
- ], a.prototype, "excludeweekdays", 2);
429
- l([
441
+ ], l.prototype, "excludeweekdays", 2);
442
+ n([
430
443
  r({ type: String })
431
- ], a.prototype, "currentmonth", 2);
432
- l([
444
+ ], l.prototype, "currentmonth", 2);
445
+ n([
433
446
  r({ type: Boolean, reflect: !0 })
434
- ], a.prototype, "calendarOpen", 2);
435
- l([
447
+ ], l.prototype, "calendarOpen", 2);
448
+ n([
436
449
  r({ type: String })
437
- ], a.prototype, "timezone", 2);
438
- l([
439
- b()
440
- ], a.prototype, "inputClasses", 2);
441
- l([
442
- b()
443
- ], a.prototype, "buttonClasses", 2);
444
- a = l([
450
+ ], l.prototype, "timezone", 2);
451
+ n([
452
+ k()
453
+ ], l.prototype, "inputClasses", 2);
454
+ n([
455
+ k()
456
+ ], l.prototype, "buttonClasses", 2);
457
+ l = n([
445
458
  w("pkt-datepicker")
446
- ], a);
459
+ ], l);
447
460
  export {
448
- a as P
461
+ l as P
449
462
  };
@@ -1,14 +1,14 @@
1
- "use strict";const d=require("./class-map-DCyaICmy.cjs"),u=require("./if-defined-a3sotaUr.cjs"),s=require("./element-BSypUpzA.cjs"),k=require("./state-B5KCNjEd.cjs"),h=require("./calendar-CYY42kN4.cjs"),m=require("./input-element-C9ma8cdz.cjs"),r=require("./ref-BvbyvXRH.cjs"),v=require("./repeat-BnuruAat.cjs");require("./icon-BnKGwYjj.cjs");require("./input-wrapper-Cn929YTV.cjs");require("./tag-CgkUxA5D.cjs");const $=require("./pkt-slot-controller-plQxXRvV.cjs"),y={dateformat:{default:"dd.MM.yyyy"},min:{default:null},max:{default:null},weeknumbers:{default:!1},withcontrols:{default:!1},multiple:{default:!1},range:{default:!1}},o={props:y};var x=Object.defineProperty,b=Object.getOwnPropertyDescriptor,l=(c,t,e,i)=>{for(var n=i>1?void 0:i?b(t,e):t,a=c.length-1,p;a>=0;a--)(p=c[a])&&(n=(i?p(t,e,n):p(n))||n);return i&&n&&x(t,e,n),n};const g=c=>new Promise(t=>setTimeout(t,c));exports.PktDatepicker=class extends m.PktInputElement{constructor(){super(),this.value="",this._value=this.value?Array.isArray(this.value)?this.value:this.value.split(","):[],this.label="Datovelger",this.dateformat=o.props.dateformat.default,this.multiple=o.props.multiple.default,this.maxlength=null,this.range=o.props.range.default,this.showRangeLabels=!1,this.min=null,this.max=null,this.weeknumbers=o.props.weeknumbers.default,this.withcontrols=o.props.withcontrols.default,this.excludedates=[],this.excludeweekdays=[],this.currentmonth=null,this.calendarOpen=!1,this.timezone="Europe/Oslo",this.inputClasses={},this.buttonClasses={},this.inputRef=r.e(),this.inputRefTo=r.e(),this.btnRef=r.e(),this.calRef=r.e(),this.popupRef=r.e(),this.helptextSlot=r.e(),this.addToSelected=t=>{const e=t.target;if(!e.value)return;const i=this.min?h.newDate(this.min):null,n=this.max?h.newDate(this.max):null,a=h.newDate(e.value.split(",")[0]);a&&!isNaN(a.getTime())&&(!i||a>=i)&&(!n||a<=n)&&this.calRef.value&&this.calRef.value.handleDateSelect(a),e.value=""},this.slotController=new $.PktSlotController(this,this.helptextSlot)}async connectedCallback(){super.connectedCallback();const t=navigator.userAgent,e=/iP(hone|od|ad)/.test(t);this.inputType=e?"text":"date",document&&document.body.addEventListener("click",i=>{var n,a;(n=this.inputRef)!=null&&n.value&&((a=this.btnRef)!=null&&a.value)&&!this.inputRef.value.contains(i.target)&&!(this.inputRefTo.value&&this.inputRefTo.value.contains(i.target))&&!this.btnRef.value.contains(i.target)&&!i.target.closest(".pkt-calendar-popup")&&this.calendarOpen&&(this.onBlur(),this.hideCalendar())}),this.value.length&&this._value.length===0&&(this._value=Array.isArray(this.value)?this.value:this.value.split(",")),this.min=this.min||o.props.min.default,this.max=this.max||o.props.max.default,typeof this.excludedates=="string"&&(this.excludedates=this.excludedates.split(",")),typeof this.excludeweekdays=="string"&&(this.excludeweekdays=this.excludeweekdays.split(",")),(this.multiple||this.range)&&this.name&&!this.name.endsWith("[]")&&(this.name=this.name+"[]"),this.calendarOpen&&(await g(20),this.handleCalendarPosition())}disconnectedCallback(){super.disconnectedCallback(),document&&document.body.removeEventListener("click",t=>{var e,i;(e=this.inputRef)!=null&&e.value&&((i=this.btnRef)!=null&&i.value)&&!this.inputRef.value.contains(t.target)&&!this.btnRef.value.contains(t.target)&&this.hideCalendar()})}attributeChangedCallback(t,e,i){if(t==="value"){if(this.range&&(i==null?void 0:i.split(",").length)===1)return;this.value!==e&&this.valueChanged(i,e)}t==="excludedates"&&typeof this.excludedates=="string"&&(this.excludedates=(i==null?void 0:i.split(","))??[]),t==="excludeweekdays"&&typeof this.excludeweekdays=="string"&&(this.excludeweekdays=(i==null?void 0:i.split(","))??[]),super.attributeChangedCallback(t,e,i)}updated(t){if(t.has("value")){if(this.range&&this.value.length===1)return;this.valueChanged(this.value,t.get("value"))}super.updated(t)}renderInput(){return s.x`
1
+ "use strict";const d=require("./class-map-DCyaICmy.cjs"),p=require("./if-defined-a3sotaUr.cjs"),s=require("./element-BSypUpzA.cjs"),m=require("./state-B5KCNjEd.cjs"),h=require("./calendar-CYY42kN4.cjs"),k=require("./input-element-XmmyUZmB.cjs"),r=require("./ref-BvbyvXRH.cjs"),v=require("./repeat-BnuruAat.cjs");require("./icon-BnKGwYjj.cjs");require("./input-wrapper-B-f_SotM.cjs");require("./tag-B9kFYxHg.cjs");const $=require("./pkt-slot-controller-Da-RgXfS.cjs"),y={dateformat:{default:"dd.MM.yyyy"},min:{default:null},max:{default:null},weeknumbers:{default:!1},withcontrols:{default:!1},multiple:{default:!1},range:{default:!1}},o={props:y};var b=Object.defineProperty,x=Object.getOwnPropertyDescriptor,l=(c,t,e,i)=>{for(var a=i>1?void 0:i?x(t,e):t,n=c.length-1,u;n>=0;n--)(u=c[n])&&(a=(i?u(t,e,a):u(a))||a);return i&&a&&b(t,e,a),a};const g=c=>new Promise(t=>setTimeout(t,c));exports.PktDatepicker=class extends k.PktInputElement{constructor(){super(),this.value="",this._value=this.value?Array.isArray(this.value)?this.value:this.value.split(","):[],this.label="Datovelger",this.dateformat=o.props.dateformat.default,this.multiple=o.props.multiple.default,this.maxlength=null,this.range=o.props.range.default,this.showRangeLabels=!1,this.min=null,this.max=null,this.weeknumbers=o.props.weeknumbers.default,this.withcontrols=o.props.withcontrols.default,this.excludedates=[],this.excludeweekdays=[],this.currentmonth=null,this.calendarOpen=!1,this.timezone="Europe/Oslo",this.inputClasses={},this.buttonClasses={},this.inputRef=r.e(),this.inputRefTo=r.e(),this.btnRef=r.e(),this.calRef=r.e(),this.popupRef=r.e(),this.helptextSlot=r.e(),this.addToSelected=t=>{const e=t.target;if(!e.value)return;const i=this.min?h.newDate(this.min):null,a=this.max?h.newDate(this.max):null,n=h.newDate(e.value.split(",")[0]);n&&!isNaN(n.getTime())&&(!i||n>=i)&&(!a||n<=a)&&this.calRef.value&&this.calRef.value.handleDateSelect(n),e.value=""},this.slotController=new $.PktSlotController(this,this.helptextSlot)}async connectedCallback(){super.connectedCallback();const t=navigator.userAgent,e=/iP(hone|od|ad)/.test(t);this.inputType=e?"text":"date",document&&document.body.addEventListener("click",i=>{var a,n;(a=this.inputRef)!=null&&a.value&&((n=this.btnRef)!=null&&n.value)&&!this.inputRef.value.contains(i.target)&&!(this.inputRefTo.value&&this.inputRefTo.value.contains(i.target))&&!this.btnRef.value.contains(i.target)&&!i.target.closest(".pkt-calendar-popup")&&this.calendarOpen&&(this.onBlur(),this.hideCalendar())}),this.value.length&&this._value.length===0&&(this._value=Array.isArray(this.value)?this.value:this.value.split(",")),this.min=this.min||o.props.min.default,this.max=this.max||o.props.max.default,typeof this.excludedates=="string"&&(this.excludedates=this.excludedates.split(",")),typeof this.excludeweekdays=="string"&&(this.excludeweekdays=this.excludeweekdays.split(",")),(this.multiple||this.range)&&this.name&&!this.name.endsWith("[]")&&(this.name=this.name+"[]"),this.calendarOpen&&(await g(20),this.handleCalendarPosition())}disconnectedCallback(){super.disconnectedCallback(),document&&document.body.removeEventListener("click",t=>{var e,i;(e=this.inputRef)!=null&&e.value&&((i=this.btnRef)!=null&&i.value)&&!this.inputRef.value.contains(t.target)&&!this.btnRef.value.contains(t.target)&&this.hideCalendar()})}attributeChangedCallback(t,e,i){if(t==="value"){if(this.range&&(i==null?void 0:i.split(",").length)===1)return;this.value!==e&&this.valueChanged(i,e)}t==="excludedates"&&typeof this.excludedates=="string"&&(this.excludedates=(i==null?void 0:i.split(","))??[]),t==="excludeweekdays"&&typeof this.excludeweekdays=="string"&&(this.excludeweekdays=(i==null?void 0:i.split(","))??[]),super.attributeChangedCallback(t,e,i)}updated(t){if(t.has("value")){if(this.range&&this.value.length===1)return;this.valueChanged(this.value,t.get("value"))}super.updated(t)}renderInput(){return s.x`
2
2
  <input
3
3
  class="${d.e(this.inputClasses)}"
4
4
  .type=${this.inputType}
5
5
  id="${this.id}-input"
6
6
  .value=${this._value[0]??""}
7
- min=${u.o(this.min)}
8
- max=${u.o(this.max)}
7
+ min=${p.o(this.min)}
8
+ max=${p.o(this.max)}
9
9
  @click=${t=>{t.preventDefault(),this.showCalendar()}}
10
10
  ?disabled=${this.disabled}
11
- @keydown=${t=>{var e;(t.key===","||t.key==="Enter")&&((e=this.inputRef.value)==null||e.blur()),(t.key==="Space"||t.key===" ")&&(t.preventDefault(),this.toggleCalendar(t))}}
11
+ @keydown=${t=>{var e,i;if(t.key===","&&((e=this.inputRef.value)==null||e.blur()),(t.key==="Space"||t.key===" ")&&(t.preventDefault(),this.toggleCalendar(t)),t.key==="Enter"){const a=this.internals.form;a?a.requestSubmit():(i=this.inputRef.value)==null||i.blur()}}}
12
12
  @input=${t=>{this.onInput(),t.stopImmediatePropagation()}}
13
13
  @focus=${()=>{this.onFocus(),this.isMobileSafari&&this.showCalendar()}}
14
14
  @blur=${t=>{var e;(e=this.calRef.value)!=null&&e.contains(t.relatedTarget)||this.onBlur(),this.manageValidity(t.target),this.value=t.target.value}}
@@ -22,14 +22,14 @@
22
22
  .type=${this.inputType}
23
23
  id="${this.id}-input"
24
24
  .value=${this._value[0]??""}
25
- min=${u.o(this.min)}
26
- max=${u.o(this.max)}
25
+ min=${p.o(this.min)}
26
+ max=${p.o(this.max)}
27
27
  ?disabled=${this.disabled}
28
28
  @click=${e=>{e.preventDefault(),this.showCalendar()}}
29
- @keydown=${e=>{var i;(e.key===","||e.key==="Enter")&&((i=this.inputRef.value)==null||i.blur()),(e.key==="Space"||e.key===" ")&&(e.preventDefault(),this.toggleCalendar(e))}}
29
+ @keydown=${e=>{var i,a;if(e.key===","&&((i=this.inputRef.value)==null||i.blur()),(e.key==="Space"||e.key===" ")&&(e.preventDefault(),this.toggleCalendar(e)),e.key==="Enter"){const n=this.internals.form;n?n.requestSubmit():(a=this.inputRefTo.value)==null||a.focus()}}}
30
30
  @input=${e=>{this.onInput(),e.stopImmediatePropagation()}}
31
31
  @focus=${()=>{this.onFocus(),this.isMobileSafari&&this.showCalendar()}}
32
- @blur=${e=>{var i,n;if(e.target.value){this.manageValidity(e.target);const a=h.fromISOToDate(e.target.value);a&&this._value[0]!==e.target.value&&this._value[1]&&(this.clearInputValue(),(n=(i=this.calRef)==null?void 0:i.value)==null||n.handleDateSelect(a))}else this._value[0]&&this.clearInputValue()}}
32
+ @blur=${e=>{var i,a;if(e.target.value){this.manageValidity(e.target);const n=h.fromISOToDate(e.target.value);n&&this._value[0]!==e.target.value&&this._value[1]&&(this.clearInputValue(),(a=(i=this.calRef)==null?void 0:i.value)==null||a.handleDateSelect(n))}else this._value[0]&&this.clearInputValue()}}
33
33
  @change=${e=>{e.stopImmediatePropagation()}}
34
34
  ${r.n(this.inputRef)}
35
35
  />
@@ -43,14 +43,14 @@
43
43
  id="${this.id}-to"
44
44
  aria-labelledby="${this.id}-to-label"
45
45
  .value=${this._value[1]??""}
46
- min=${u.o(this.min)}
47
- max=${u.o(this.max)}
46
+ min=${p.o(this.min)}
47
+ max=${p.o(this.max)}
48
48
  ?disabled=${this.disabled}
49
49
  @click=${e=>{e.preventDefault(),this.showCalendar()}}
50
- @keydown=${e=>{var i;(e.key===","||e.key==="Enter")&&((i=this.inputRefTo.value)==null||i.blur()),(e.key==="Space"||e.key===" ")&&(e.preventDefault(),this.toggleCalendar(e))}}
50
+ @keydown=${e=>{var i,a;if(e.key===","&&((i=this.inputRefTo.value)==null||i.blur()),(e.key==="Space"||e.key===" ")&&(e.preventDefault(),this.toggleCalendar(e)),e.key==="Enter"){const n=this.internals.form;n?n.requestSubmit():(a=this.inputRefTo.value)==null||a.blur()}}}
51
51
  @input=${e=>{this.onInput(),e.stopImmediatePropagation()}}
52
52
  @focus=${()=>{this.onFocus(),this.isMobileSafari&&this.showCalendar()}}
53
- @blur=${e=>{var i,n,a;if((i=this.calRef.value)!=null&&i.contains(e.relatedTarget)||this.onBlur(),e.target.value){this.manageValidity(e.target);const p=e.target.value;this.min&&this.min>p?this.internals.setValidity({rangeUnderflow:!0},this.strings.forms.messages.rangeUnderflow,e.target):this.max&&this.max<p&&this.internals.setValidity({rangeOverflow:!0},this.strings.forms.messages.rangeOverflow,e.target);const f=h.fromISOToDate(e.target.value);f&&this._value[1]!==h.formatISODate(f)&&((a=(n=this.calRef)==null?void 0:n.value)==null||a.handleDateSelect(f))}}}
53
+ @blur=${e=>{var i,a,n;if((i=this.calRef.value)!=null&&i.contains(e.relatedTarget)||this.onBlur(),e.target.value){this.manageValidity(e.target);const u=e.target.value;this.min&&this.min>u?this.internals.setValidity({rangeUnderflow:!0},this.strings.forms.messages.rangeUnderflow,e.target):this.max&&this.max<u&&this.internals.setValidity({rangeOverflow:!0},this.strings.forms.messages.rangeOverflow,e.target);const f=h.fromISOToDate(e.target.value);f&&this._value[1]!==h.formatISODate(f)&&((n=(a=this.calRef)==null?void 0:a.value)==null||n.handleDateSelect(f))}}}
54
54
  @change=${e=>{e.stopImmediatePropagation()}}
55
55
  ${r.n(this.inputRefTo)}
56
56
  />
@@ -59,14 +59,14 @@
59
59
  class=${d.e(this.inputClasses)}
60
60
  .type=${this.inputType}
61
61
  id="${this.id}-input"
62
- min=${u.o(this.min)}
63
- max=${u.o(this.max)}
62
+ min=${p.o(this.min)}
63
+ max=${p.o(this.max)}
64
64
  ?disabled=${this.disabled||this.maxlength&&this._value.length>=this.maxlength}
65
65
  @click=${t=>{t.preventDefault(),this.showCalendar()}}
66
66
  @blur=${t=>{var e;(e=this.calRef.value)!=null&&e.contains(t.relatedTarget)||this.onBlur(),this.addToSelected(t)}}
67
67
  @input=${t=>{this.onInput(),t.stopImmediatePropagation()}}
68
68
  @focus=${()=>{this.onFocus(),this.isMobileSafari&&this.showCalendar()}}
69
- @keydown=${t=>{(t.key===","||t.key==="Enter")&&(t.preventDefault(),this.addToSelected(t)),(t.key==="Space"||t.key===" ")&&(t.preventDefault(),this.toggleCalendar(t))}}
69
+ @keydown=${t=>{var e;if(t.key===","&&(t.preventDefault(),this.addToSelected(t)),(t.key==="Space"||t.key===" ")&&(t.preventDefault(),this.toggleCalendar(t)),t.key==="Enter"){const i=this.internals.form;i?i.requestSubmit():(e=this.inputRef.value)==null||e.blur()}}}
70
70
  @change=${t=>{t.stopImmediatePropagation()}}
71
71
  ${r.n(this.inputRef)}
72
72
  />
@@ -150,4 +150,4 @@
150
150
  </div>
151
151
  </pkt-input-wrapper>
152
152
  ${this.renderCalendar()}
153
- `}handleCalendarPosition(){var t;if(this.popupRef.value&&this.inputRef.value){const e=this.multiple&&!!this.maxlength,i=((t=this.inputRef.value.parentElement)==null?void 0:t.getBoundingClientRect())||this.inputRef.value.getBoundingClientRect(),n=e?i.height+30:i.height,a=this.popupRef.value.getBoundingClientRect().height;let p=e?"calc(100% - 30px)":"100%";i&&i.top+a>window.innerHeight&&i.top-a>0&&(p=`calc(100% - ${n}px - ${a}px)`),this.popupRef.value.style.top=p}}handleFocusOut(t){this.contains(t.target)||(this.onBlur(),this.hideCalendar())}async showCalendar(){var t;this.calendarOpen=!0,await g(20),this.handleCalendarPosition(),this.isMobileSafari&&((t=this.calRef.value)==null||t.focusOnCurrentDate())}hideCalendar(){this.calendarOpen=!1}async toggleCalendar(t){t.preventDefault(),this.calendarOpen?this.hideCalendar():this.showCalendar()}};l([s.n({type:String,reflect:!0})],exports.PktDatepicker.prototype,"value",2);l([s.n({type:Array})],exports.PktDatepicker.prototype,"_value",2);l([s.n({type:String,reflect:!0})],exports.PktDatepicker.prototype,"label",2);l([s.n({type:String})],exports.PktDatepicker.prototype,"dateformat",2);l([s.n({type:Boolean,reflect:!0})],exports.PktDatepicker.prototype,"multiple",2);l([s.n({type:Number,reflect:!0})],exports.PktDatepicker.prototype,"maxlength",2);l([s.n({type:Boolean,reflect:!0})],exports.PktDatepicker.prototype,"range",2);l([s.n({type:Boolean})],exports.PktDatepicker.prototype,"showRangeLabels",2);l([s.n({type:String,reflect:!0})],exports.PktDatepicker.prototype,"min",2);l([s.n({type:String,reflect:!0})],exports.PktDatepicker.prototype,"max",2);l([s.n({type:Boolean})],exports.PktDatepicker.prototype,"weeknumbers",2);l([s.n({type:Boolean,reflect:!0})],exports.PktDatepicker.prototype,"withcontrols",2);l([s.n({converter:h.converters.csvToArray})],exports.PktDatepicker.prototype,"excludedates",2);l([s.n({converter:h.converters.csvToArray})],exports.PktDatepicker.prototype,"excludeweekdays",2);l([s.n({type:String})],exports.PktDatepicker.prototype,"currentmonth",2);l([s.n({type:Boolean,reflect:!0})],exports.PktDatepicker.prototype,"calendarOpen",2);l([s.n({type:String})],exports.PktDatepicker.prototype,"timezone",2);l([k.r()],exports.PktDatepicker.prototype,"inputClasses",2);l([k.r()],exports.PktDatepicker.prototype,"buttonClasses",2);exports.PktDatepicker=l([s.t("pkt-datepicker")],exports.PktDatepicker);
153
+ `}handleCalendarPosition(){var t;if(this.popupRef.value&&this.inputRef.value){const e=this.multiple&&!!this.maxlength,i=((t=this.inputRef.value.parentElement)==null?void 0:t.getBoundingClientRect())||this.inputRef.value.getBoundingClientRect(),a=e?i.height+30:i.height,n=this.popupRef.value.getBoundingClientRect().height;let u=e?"calc(100% - 30px)":"100%";i&&i.top+n>window.innerHeight&&i.top-n>0&&(u=`calc(100% - ${a}px - ${n}px)`),this.popupRef.value.style.top=u}}handleFocusOut(t){this.contains(t.target)||(this.onBlur(),this.hideCalendar())}async showCalendar(){var t;this.calendarOpen=!0,await g(20),this.handleCalendarPosition(),this.isMobileSafari&&((t=this.calRef.value)==null||t.focusOnCurrentDate())}hideCalendar(){this.calendarOpen=!1}async toggleCalendar(t){t.preventDefault(),this.calendarOpen?this.hideCalendar():this.showCalendar()}};l([s.n({type:String,reflect:!0})],exports.PktDatepicker.prototype,"value",2);l([s.n({type:Array})],exports.PktDatepicker.prototype,"_value",2);l([s.n({type:String,reflect:!0})],exports.PktDatepicker.prototype,"label",2);l([s.n({type:String})],exports.PktDatepicker.prototype,"dateformat",2);l([s.n({type:Boolean,reflect:!0})],exports.PktDatepicker.prototype,"multiple",2);l([s.n({type:Number,reflect:!0})],exports.PktDatepicker.prototype,"maxlength",2);l([s.n({type:Boolean,reflect:!0})],exports.PktDatepicker.prototype,"range",2);l([s.n({type:Boolean})],exports.PktDatepicker.prototype,"showRangeLabels",2);l([s.n({type:String,reflect:!0})],exports.PktDatepicker.prototype,"min",2);l([s.n({type:String,reflect:!0})],exports.PktDatepicker.prototype,"max",2);l([s.n({type:Boolean})],exports.PktDatepicker.prototype,"weeknumbers",2);l([s.n({type:Boolean,reflect:!0})],exports.PktDatepicker.prototype,"withcontrols",2);l([s.n({converter:h.converters.csvToArray})],exports.PktDatepicker.prototype,"excludedates",2);l([s.n({converter:h.converters.csvToArray})],exports.PktDatepicker.prototype,"excludeweekdays",2);l([s.n({type:String})],exports.PktDatepicker.prototype,"currentmonth",2);l([s.n({type:Boolean,reflect:!0})],exports.PktDatepicker.prototype,"calendarOpen",2);l([s.n({type:String})],exports.PktDatepicker.prototype,"timezone",2);l([m.r()],exports.PktDatepicker.prototype,"inputClasses",2);l([m.r()],exports.PktDatepicker.prototype,"buttonClasses",2);exports.PktDatepicker=l([s.t("pkt-datepicker")],exports.PktDatepicker);
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var d=window.CustomEvent;(!d||typeof d=="object")&&(d=function(t,o){o=o||{};var i=document.createEvent("CustomEvent");return i.initCustomEvent(t,!!o.bubbles,!!o.cancelable,o.detail||null),i},d.prototype=window.Event.prototype);function g(e,t){var o="on"+t.type.toLowerCase();return typeof e[o]=="function"&&e[o](t),e.dispatchEvent(t)}function E(e){for(;e&&e!==document.body;){var t=window.getComputedStyle(e),o=function(i,a){return!(t[i]===void 0||t[i]===a)};if(t.opacity<1||o("zIndex","auto")||o("transform","none")||o("mixBlendMode","normal")||o("filter","none")||o("perspective","none")||t.isolation==="isolate"||t.position==="fixed"||t.webkitOverflowScrolling==="touch")return!0;e=e.parentElement}return!1}function c(e){for(;e;){if(e.localName==="dialog")return e;e.parentElement?e=e.parentElement:e.parentNode?e=e.parentNode.host:e=null}return null}function b(e){for(;e&&e.shadowRoot&&e.shadowRoot.activeElement;)e=e.shadowRoot.activeElement;e&&e.blur&&e!==document.body&&e.blur()}function M(e,t){for(var o=0;o<e.length;++o)if(e[o]===t)return!0;return!1}function h(e){return!e||!e.hasAttribute("method")?!1:e.getAttribute("method").toLowerCase()==="dialog"}function v(e){var t=["button","input","keygen","select","textarea"],o=t.map(function(s){return s+":not([disabled])"});o.push('[tabindex]:not([disabled]):not([tabindex=""])');var i=e.querySelector(o.join(", "));if(!i&&"attachShadow"in Element.prototype)for(var a=e.querySelectorAll("*"),r=0;r<a.length&&!(a[r].tagName&&a[r].shadowRoot&&(i=v(a[r].shadowRoot),i));r++);return i}function m(e){return e.isConnected||document.body.contains(e)}function y(e){if(e.submitter)return e.submitter;var t=e.target;if(!(t instanceof HTMLFormElement))return null;var o=n.formSubmitter;if(!o){var i=e.target,a="getRootNode"in i&&i.getRootNode()||document;o=a.activeElement}return!o||o.form!==t?null:o}function D(e){if(!e.defaultPrevented){var t=e.target,o=n.imagemapUseValue,i=y(e);o===null&&i&&(o=i.value);var a=c(t);if(a){var r=i&&i.getAttribute("formmethod")||t.getAttribute("method");r==="dialog"&&(e.preventDefault(),o!=null?a.close(o):a.close())}}}function _(e){if(this.dialog_=e,this.replacedStyleTop_=!1,this.openAsModal_=!1,e.hasAttribute("role")||e.setAttribute("role","dialog"),e.show=this.show.bind(this),e.showModal=this.showModal.bind(this),e.close=this.close.bind(this),e.addEventListener("submit",D,!1),"returnValue"in e||(e.returnValue=""),"MutationObserver"in window){var t=new MutationObserver(this.maybeHideModal.bind(this));t.observe(e,{attributes:!0,attributeFilter:["open"]})}else{var o=!1,i=(function(){o?this.downgradeModal():this.maybeHideModal(),o=!1}).bind(this),a,r=function(s){if(s.target===e){var u="DOMNodeRemoved";o|=s.type.substr(0,u.length)===u,window.clearTimeout(a),a=window.setTimeout(i,0)}};["DOMAttrModified","DOMNodeRemoved","DOMNodeRemovedFromDocument"].forEach(function(s){e.addEventListener(s,r)})}Object.defineProperty(e,"open",{set:this.setOpen.bind(this),get:e.hasAttribute.bind(e,"open")}),this.backdrop_=document.createElement("div"),this.backdrop_.className="backdrop",this.backdrop_.addEventListener("mouseup",this.backdropMouseEvent_.bind(this)),this.backdrop_.addEventListener("mousedown",this.backdropMouseEvent_.bind(this)),this.backdrop_.addEventListener("click",this.backdropMouseEvent_.bind(this))}_.prototype={get dialog(){return this.dialog_},maybeHideModal:function(){this.dialog_.hasAttribute("open")&&m(this.dialog_)||this.downgradeModal()},downgradeModal:function(){this.openAsModal_&&(this.openAsModal_=!1,this.dialog_.style.zIndex="",this.replacedStyleTop_&&(this.dialog_.style.top="",this.replacedStyleTop_=!1),this.backdrop_.parentNode&&this.backdrop_.parentNode.removeChild(this.backdrop_),n.dm.removeDialog(this))},setOpen:function(e){e?this.dialog_.hasAttribute("open")||this.dialog_.setAttribute("open",""):(this.dialog_.removeAttribute("open"),this.maybeHideModal())},backdropMouseEvent_:function(e){if(this.dialog_.hasAttribute("tabindex"))this.dialog_.focus();else{var t=document.createElement("div");this.dialog_.insertBefore(t,this.dialog_.firstChild),t.tabIndex=-1,t.focus(),this.dialog_.removeChild(t)}var o=document.createEvent("MouseEvents");o.initMouseEvent(e.type,e.bubbles,e.cancelable,window,e.detail,e.screenX,e.screenY,e.clientX,e.clientY,e.ctrlKey,e.altKey,e.shiftKey,e.metaKey,e.button,e.relatedTarget),this.dialog_.dispatchEvent(o),e.stopPropagation()},focus_:function(){var e=this.dialog_.querySelector("[autofocus]:not([disabled])");!e&&this.dialog_.tabIndex>=0&&(e=this.dialog_),e||(e=v(this.dialog_)),b(document.activeElement),e&&e.focus()},updateZIndex:function(e,t){if(e<t)throw new Error("dialogZ should never be < backdropZ");this.dialog_.style.zIndex=e,this.backdrop_.style.zIndex=t},show:function(){this.dialog_.open||(this.setOpen(!0),this.focus_())},showModal:function(){if(this.dialog_.hasAttribute("open"))throw new Error("Failed to execute 'showModal' on dialog: The element is already open, and therefore cannot be opened modally.");if(!m(this.dialog_))throw new Error("Failed to execute 'showModal' on dialog: The element is not in a Document.");if(!n.dm.pushDialog(this))throw new Error("Failed to execute 'showModal' on dialog: There are too many open modal dialogs.");E(this.dialog_.parentElement)&&console.warn("A dialog is being shown inside a stacking context. This may cause it to be unusable. For more information, see this link: https://github.com/GoogleChrome/dialog-polyfill/#stacking-context"),this.setOpen(!0),this.openAsModal_=!0,n.needsCentering(this.dialog_)?(n.reposition(this.dialog_),this.replacedStyleTop_=!0):this.replacedStyleTop_=!1,this.dialog_.parentNode.insertBefore(this.backdrop_,this.dialog_.nextSibling),this.focus_()},close:function(e){if(!this.dialog_.hasAttribute("open"))throw new Error("Failed to execute 'close' on dialog: The element does not have an 'open' attribute, and therefore cannot be closed.");this.setOpen(!1),e!==void 0&&(this.dialog_.returnValue=e);var t=new d("close",{bubbles:!1,cancelable:!1});g(this.dialog_,t)}};var n={};n.reposition=function(e){var t=document.body.scrollTop||document.documentElement.scrollTop,o=t+(window.innerHeight-e.offsetHeight)/2;e.style.top=Math.max(t,o)+"px"};n.isInlinePositionSetByStylesheet=function(e){for(var t=0;t<document.styleSheets.length;++t){var o=document.styleSheets[t],i=null;try{i=o.cssRules}catch{}if(i)for(var a=0;a<i.length;++a){var r=i[a],s=null;try{s=document.querySelectorAll(r.selectorText)}catch{}if(!(!s||!M(s,e))){var u=r.style.getPropertyValue("top"),f=r.style.getPropertyValue("bottom");if(u&&u!=="auto"||f&&f!=="auto")return!0}}}return!1};n.needsCentering=function(e){var t=window.getComputedStyle(e);return t.position!=="absolute"||e.style.top!=="auto"&&e.style.top!==""||e.style.bottom!=="auto"&&e.style.bottom!==""?!1:!n.isInlinePositionSetByStylesheet(e)};n.forceRegisterDialog=function(e){if((window.HTMLDialogElement||e.showModal)&&console.warn("This browser already supports <dialog>, the polyfill may not work correctly",e),e.localName!=="dialog")throw new Error("Failed to register dialog: The element is not a dialog.");new _(e)};n.registerDialog=function(e){e.showModal||n.forceRegisterDialog(e)};n.DialogManager=function(){this.pendingDialogStack=[];var e=this.checkDOM_.bind(this);this.overlay=document.createElement("div"),this.overlay.className="_dialog_overlay",this.overlay.addEventListener("click",(function(t){this.forwardTab_=void 0,t.stopPropagation(),e([])}).bind(this)),this.handleKey_=this.handleKey_.bind(this),this.handleFocus_=this.handleFocus_.bind(this),this.zIndexLow_=1e5,this.zIndexHigh_=100150,this.forwardTab_=void 0,"MutationObserver"in window&&(this.mo_=new MutationObserver(function(t){var o=[];t.forEach(function(i){for(var a=0,r;r=i.removedNodes[a];++a){if(r instanceof Element)r.localName==="dialog"&&o.push(r);else continue;o=o.concat(r.querySelectorAll("dialog"))}}),o.length&&e(o)}))};n.DialogManager.prototype.blockDocument=function(){document.documentElement.addEventListener("focus",this.handleFocus_,!0),document.addEventListener("keydown",this.handleKey_),this.mo_&&this.mo_.observe(document,{childList:!0,subtree:!0})};n.DialogManager.prototype.unblockDocument=function(){document.documentElement.removeEventListener("focus",this.handleFocus_,!0),document.removeEventListener("keydown",this.handleKey_),this.mo_&&this.mo_.disconnect()};n.DialogManager.prototype.updateStacking=function(){for(var e=this.zIndexHigh_,t=0,o;o=this.pendingDialogStack[t];++t)o.updateZIndex(--e,--e),t===0&&(this.overlay.style.zIndex=--e);var i=this.pendingDialogStack[0];if(i){var a=i.dialog.parentNode||document.body;a.appendChild(this.overlay)}else this.overlay.parentNode&&this.overlay.parentNode.removeChild(this.overlay)};n.DialogManager.prototype.containedByTopDialog_=function(e){for(;e=c(e);){for(var t=0,o;o=this.pendingDialogStack[t];++t)if(o.dialog===e)return t===0;e=e.parentElement}return!1};n.DialogManager.prototype.handleFocus_=function(e){var t=e.composedPath?e.composedPath()[0]:e.target;if(!this.containedByTopDialog_(t)&&document.activeElement!==document.documentElement&&(e.preventDefault(),e.stopPropagation(),b(t),this.forwardTab_!==void 0)){var o=this.pendingDialogStack[0],i=o.dialog,a=i.compareDocumentPosition(t);return a&Node.DOCUMENT_POSITION_PRECEDING&&(this.forwardTab_?o.focus_():t!==document.documentElement&&document.documentElement.focus()),!1}};n.DialogManager.prototype.handleKey_=function(e){if(this.forwardTab_=void 0,e.keyCode===27){e.preventDefault(),e.stopPropagation();var t=new d("cancel",{bubbles:!1,cancelable:!0}),o=this.pendingDialogStack[0];o&&g(o.dialog,t)&&o.dialog.close()}else e.keyCode===9&&(this.forwardTab_=!e.shiftKey)};n.DialogManager.prototype.checkDOM_=function(e){var t=this.pendingDialogStack.slice();t.forEach(function(o){e.indexOf(o.dialog)!==-1?o.downgradeModal():o.maybeHideModal()})};n.DialogManager.prototype.pushDialog=function(e){var t=(this.zIndexHigh_-this.zIndexLow_)/2-1;return this.pendingDialogStack.length>=t?!1:(this.pendingDialogStack.unshift(e)===1&&this.blockDocument(),this.updateStacking(),!0)};n.DialogManager.prototype.removeDialog=function(e){var t=this.pendingDialogStack.indexOf(e);t!==-1&&(this.pendingDialogStack.splice(t,1),this.pendingDialogStack.length===0&&this.unblockDocument(),this.updateStacking())};n.dm=new n.DialogManager;n.formSubmitter=null;n.imagemapUseValue=null;if(window.HTMLDialogElement===void 0){var p=document.createElement("form");if(p.setAttribute("method","dialog"),p.method!=="dialog"){var l=Object.getOwnPropertyDescriptor(HTMLFormElement.prototype,"method");if(l){var k=l.get;l.get=function(){return h(this)?"dialog":k.call(this)};var S=l.set;l.set=function(e){return typeof e=="string"&&e.toLowerCase()==="dialog"?this.setAttribute("method",e):S.call(this,e)},Object.defineProperty(HTMLFormElement.prototype,"method",l)}}document.addEventListener("click",function(e){if(n.formSubmitter=null,n.imagemapUseValue=null,!e.defaultPrevented){var t=e.target;if("composedPath"in e){var o=e.composedPath();t=o.shift()||t}if(!(!t||!h(t.form))){var i=t.type==="submit"&&["button","input"].indexOf(t.localName)>-1;if(!i){if(!(t.localName==="input"&&t.type==="image"))return;n.imagemapUseValue=e.offsetX+","+e.offsetY}var a=c(t);a&&(n.formSubmitter=t)}}},!1),document.addEventListener("submit",function(e){var t=e.target,o=c(t);if(!o){var i=y(e),a=i&&i.getAttribute("formmethod")||t.getAttribute("method");a==="dialog"&&e.preventDefault()}});var T=HTMLFormElement.prototype.submit,x=function(){if(!h(this))return T.call(this);var e=c(this);e&&e.close()};HTMLFormElement.prototype.submit=x}exports.default=n;