@oslokommune/punkt-elements 12.3.9 → 12.3.10

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.
@@ -1,9 +1,9 @@
1
- import { R as K, a as z, k as P, D as N, n as y } from "./index-BoxUN9GL.js";
1
+ import { R as K, a as z, k as O, D as B, n as y } from "./index-BoxUN9GL.js";
2
2
  import { e as Z, i as tt, a as et, t as nt } from "./directive-DA0-wdk7.js";
3
- import { u as at, c as M, a as S, p as F, d as rt, i as C, K as D } from "./ref-DzpbHCb_.js";
3
+ import { u as at, c as $, a as S, p as F, d as rt, i as C, K as P } from "./ref-DzpbHCb_.js";
4
4
  import { R } from "./class-map-DnAEF9tj.js";
5
5
  import { a as G } from "./converters-DNCwIFwr.js";
6
- import { s as it, t as k, c as _, m as st, a as ot, g as ut, b as lt, d as dt } from "./index-CiTPWPc2.js";
6
+ import { s as it, t as k, c as _, m as st, a as ot, g as ut, b as lt, d as dt } from "./index-BAKMcM4b.js";
7
7
  import "./pkt-input-wrapper.js";
8
8
  import "./index-CsKoXqeT.js";
9
9
  import "./pkt-tag.js";
@@ -18,7 +18,7 @@ function U(t) {
18
18
  const s = Y(i);
19
19
  return e.getTime() >= r.getTime() ? n + 1 : e.getTime() >= s.getTime() ? n : n - 1;
20
20
  }
21
- function B(t) {
21
+ function V(t) {
22
22
  const e = k(t);
23
23
  return e.setHours(0, 0, 0, 0), e;
24
24
  }
@@ -37,18 +37,18 @@ function H(t) {
37
37
  return n.setUTCFullYear(e.getFullYear()), +t - +n;
38
38
  }
39
39
  function ct(t, e) {
40
- const n = B(t), a = B(e), r = +n - H(n), i = +a - H(a);
40
+ const n = V(t), a = V(e), r = +n - H(n), i = +a - H(a);
41
41
  return Math.round((r - i) / st);
42
42
  }
43
43
  function ht(t) {
44
44
  const e = U(t), n = _(t, 0);
45
45
  return n.setFullYear(e, 0, 4), n.setHours(0, 0, 0, 0), Y(n);
46
46
  }
47
- function mt(t) {
47
+ function ft(t) {
48
48
  return t instanceof Date || typeof t == "object" && Object.prototype.toString.call(t) === "[object Date]";
49
49
  }
50
- function ft(t) {
51
- if (!mt(t) && typeof t != "number")
50
+ function mt(t) {
51
+ if (!ft(t) && typeof t != "number")
52
52
  return !1;
53
53
  const e = k(t);
54
54
  return !isNaN(Number(e));
@@ -165,7 +165,7 @@ const vt = {
165
165
  tomorrow: "'tomorrow at' p",
166
166
  nextWeek: "eeee 'at' p",
167
167
  other: "P"
168
- }, Ot = (t, e, n, a) => xt[t];
168
+ }, Mt = (t, e, n, a) => xt[t];
169
169
  function E(t) {
170
170
  return (e, n) => {
171
171
  const a = n != null && n.context ? String(n.context) : "standalone";
@@ -181,15 +181,15 @@ function E(t) {
181
181
  return r[i];
182
182
  };
183
183
  }
184
- const Pt = {
184
+ const Ot = {
185
185
  narrow: ["B", "A"],
186
186
  abbreviated: ["BC", "AD"],
187
187
  wide: ["Before Christ", "Anno Domini"]
188
- }, Mt = {
188
+ }, $t = {
189
189
  narrow: ["1", "2", "3", "4"],
190
190
  abbreviated: ["Q1", "Q2", "Q3", "Q4"],
191
191
  wide: ["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"]
192
- }, Dt = {
192
+ }, Pt = {
193
193
  narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"],
194
194
  abbreviated: [
195
195
  "Jan",
@@ -219,7 +219,7 @@ const Pt = {
219
219
  "November",
220
220
  "December"
221
221
  ]
222
- }, Tt = {
222
+ }, Dt = {
223
223
  narrow: ["S", "M", "T", "W", "T", "F", "S"],
224
224
  short: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
225
225
  abbreviated: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
@@ -232,7 +232,7 @@ const Pt = {
232
232
  "Friday",
233
233
  "Saturday"
234
234
  ]
235
- }, $t = {
235
+ }, Tt = {
236
236
  narrow: {
237
237
  am: "a",
238
238
  pm: "p",
@@ -309,24 +309,24 @@ const Pt = {
309
309
  }, Rt = {
310
310
  ordinalNumber: Ct,
311
311
  era: E({
312
- values: Pt,
312
+ values: Ot,
313
313
  defaultWidth: "wide"
314
314
  }),
315
315
  quarter: E({
316
- values: Mt,
316
+ values: $t,
317
317
  defaultWidth: "wide",
318
318
  argumentCallback: (t) => t - 1
319
319
  }),
320
320
  month: E({
321
- values: Dt,
321
+ values: Pt,
322
322
  defaultWidth: "wide"
323
323
  }),
324
324
  day: E({
325
- values: Tt,
325
+ values: Dt,
326
326
  defaultWidth: "wide"
327
327
  }),
328
328
  dayPeriod: E({
329
- values: $t,
329
+ values: Tt,
330
330
  defaultWidth: "wide",
331
331
  formattingValues: St,
332
332
  defaultFormattingWidth: "wide"
@@ -384,11 +384,11 @@ const Yt = /^(\d+)(th|st|nd|rd)?/i, Ft = /\d+/i, qt = {
384
384
  wide: /^[1234](th|st|nd|rd)? quarter/i
385
385
  }, Bt = {
386
386
  any: [/1/i, /2/i, /3/i, /4/i]
387
- }, Ht = {
387
+ }, Vt = {
388
388
  narrow: /^[jfmasond]/i,
389
389
  abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
390
390
  wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
391
- }, Vt = {
391
+ }, Ht = {
392
392
  narrow: [
393
393
  /^j/i,
394
394
  /^f/i,
@@ -459,9 +459,9 @@ const Yt = /^(\d+)(th|st|nd|rd)?/i, Ft = /\d+/i, qt = {
459
459
  valueCallback: (t) => t + 1
460
460
  }),
461
461
  month: W({
462
- matchPatterns: Ht,
462
+ matchPatterns: Vt,
463
463
  defaultMatchWidth: "wide",
464
- parsePatterns: Vt,
464
+ parsePatterns: Ht,
465
465
  defaultParseWidth: "any"
466
466
  }),
467
467
  day: W({
@@ -480,7 +480,7 @@ const Yt = /^(\d+)(th|st|nd|rd)?/i, Ft = /\d+/i, qt = {
480
480
  code: "en-US",
481
481
  formatDistance: yt,
482
482
  formatLong: kt,
483
- formatRelative: Ot,
483
+ formatRelative: Mt,
484
484
  localize: Rt,
485
485
  match: Xt,
486
486
  options: {
@@ -554,7 +554,7 @@ const b = {
554
554
  );
555
555
  return o(r, e.length);
556
556
  }
557
- }, $ = {
557
+ }, T = {
558
558
  am: "am",
559
559
  pm: "pm",
560
560
  midnight: "midnight",
@@ -563,7 +563,7 @@ const b = {
563
563
  afternoon: "afternoon",
564
564
  evening: "evening",
565
565
  night: "night"
566
- }, V = {
566
+ }, j = {
567
567
  // Era
568
568
  G: function(t, e, n) {
569
569
  const a = t.getFullYear() > 0 ? 1 : 0;
@@ -898,7 +898,7 @@ const b = {
898
898
  b: function(t, e, n) {
899
899
  const a = t.getHours();
900
900
  let r;
901
- switch (a === 12 ? r = $.noon : a === 0 ? r = $.midnight : r = a / 12 >= 1 ? "pm" : "am", e) {
901
+ switch (a === 12 ? r = T.noon : a === 0 ? r = T.midnight : r = a / 12 >= 1 ? "pm" : "am", e) {
902
902
  case "b":
903
903
  case "bb":
904
904
  return n.dayPeriod(r, {
@@ -927,7 +927,7 @@ const b = {
927
927
  B: function(t, e, n) {
928
928
  const a = t.getHours();
929
929
  let r;
930
- switch (a >= 17 ? r = $.evening : a >= 12 ? r = $.afternoon : a >= 4 ? r = $.morning : r = $.night, e) {
930
+ switch (a >= 17 ? r = T.evening : a >= 12 ? r = T.afternoon : a >= 4 ? r = T.morning : r = T.night, e) {
931
931
  case "B":
932
932
  case "BB":
933
933
  case "BBB":
@@ -989,14 +989,14 @@ const b = {
989
989
  return "Z";
990
990
  switch (e) {
991
991
  case "X":
992
- return A(a);
992
+ return L(a);
993
993
  case "XXXX":
994
994
  case "XX":
995
- return T(a);
995
+ return D(a);
996
996
  case "XXXXX":
997
997
  case "XXX":
998
998
  default:
999
- return T(a, ":");
999
+ return D(a, ":");
1000
1000
  }
1001
1001
  },
1002
1002
  // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)
@@ -1004,14 +1004,14 @@ const b = {
1004
1004
  const a = t.getTimezoneOffset();
1005
1005
  switch (e) {
1006
1006
  case "x":
1007
- return A(a);
1007
+ return L(a);
1008
1008
  case "xxxx":
1009
1009
  case "xx":
1010
- return T(a);
1010
+ return D(a);
1011
1011
  case "xxxxx":
1012
1012
  case "xxx":
1013
1013
  default:
1014
- return T(a, ":");
1014
+ return D(a, ":");
1015
1015
  }
1016
1016
  },
1017
1017
  // Timezone (GMT)
@@ -1021,10 +1021,10 @@ const b = {
1021
1021
  case "O":
1022
1022
  case "OO":
1023
1023
  case "OOO":
1024
- return "GMT" + j(a, ":");
1024
+ return "GMT" + A(a, ":");
1025
1025
  case "OOOO":
1026
1026
  default:
1027
- return "GMT" + T(a, ":");
1027
+ return "GMT" + D(a, ":");
1028
1028
  }
1029
1029
  },
1030
1030
  // Timezone (specific non-location)
@@ -1034,10 +1034,10 @@ const b = {
1034
1034
  case "z":
1035
1035
  case "zz":
1036
1036
  case "zzz":
1037
- return "GMT" + j(a, ":");
1037
+ return "GMT" + A(a, ":");
1038
1038
  case "zzzz":
1039
1039
  default:
1040
- return "GMT" + T(a, ":");
1040
+ return "GMT" + D(a, ":");
1041
1041
  }
1042
1042
  },
1043
1043
  // Seconds timestamp
@@ -1051,18 +1051,18 @@ const b = {
1051
1051
  return o(a, e.length);
1052
1052
  }
1053
1053
  };
1054
- function j(t, e = "") {
1054
+ function A(t, e = "") {
1055
1055
  const n = t > 0 ? "-" : "+", a = Math.abs(t), r = Math.trunc(a / 60), i = a % 60;
1056
1056
  return i === 0 ? n + String(r) : n + String(r) + e + o(i, 2);
1057
1057
  }
1058
- function A(t, e) {
1059
- return t % 60 === 0 ? (t > 0 ? "-" : "+") + o(Math.abs(t) / 60, 2) : T(t, e);
1058
+ function L(t, e) {
1059
+ return t % 60 === 0 ? (t > 0 ? "-" : "+") + o(Math.abs(t) / 60, 2) : D(t, e);
1060
1060
  }
1061
- function T(t, e = "") {
1061
+ function D(t, e = "") {
1062
1062
  const n = t > 0 ? "-" : "+", a = Math.abs(t), r = o(Math.trunc(a / 60), 2), i = o(a % 60, 2);
1063
1063
  return n + r + e + i;
1064
1064
  }
1065
- const L = (t, e) => {
1065
+ const Q = (t, e) => {
1066
1066
  switch (t) {
1067
1067
  case "P":
1068
1068
  return e.date({ width: "short" });
@@ -1089,7 +1089,7 @@ const L = (t, e) => {
1089
1089
  }, Kt = (t, e) => {
1090
1090
  const n = t.match(/(P+)(p+)?/) || [], a = n[1], r = n[2];
1091
1091
  if (!r)
1092
- return L(t, e);
1092
+ return Q(t, e);
1093
1093
  let i;
1094
1094
  switch (a) {
1095
1095
  case "P":
@@ -1106,7 +1106,7 @@ const L = (t, e) => {
1106
1106
  i = e.dateTime({ width: "full" });
1107
1107
  break;
1108
1108
  }
1109
- return i.replace("{{date}}", L(a, e)).replace("{{time}}", J(r, e));
1109
+ return i.replace("{{date}}", Q(a, e)).replace("{{time}}", J(r, e));
1110
1110
  }, zt = {
1111
1111
  p: J,
1112
1112
  P: Kt
@@ -1127,15 +1127,15 @@ function ie(t, e, n) {
1127
1127
  }
1128
1128
  const se = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g, oe = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g, ue = /^'([^]*?)'?$/, le = /''/g, de = /[a-zA-Z]/;
1129
1129
  function ce(t, e, n) {
1130
- var x, l, f, h;
1131
- const a = dt(), r = a.locale ?? Gt, i = a.firstWeekContainsDate ?? ((l = (x = a.locale) == null ? void 0 : x.options) == null ? void 0 : l.firstWeekContainsDate) ?? 1, s = a.weekStartsOn ?? ((h = (f = a.locale) == null ? void 0 : f.options) == null ? void 0 : h.weekStartsOn) ?? 0, d = k(t);
1132
- if (!ft(d))
1130
+ var x, l, m, h;
1131
+ const a = dt(), r = a.locale ?? Gt, i = a.firstWeekContainsDate ?? ((l = (x = a.locale) == null ? void 0 : x.options) == null ? void 0 : l.firstWeekContainsDate) ?? 1, s = a.weekStartsOn ?? ((h = (m = a.locale) == null ? void 0 : m.options) == null ? void 0 : h.weekStartsOn) ?? 0, d = k(t);
1132
+ if (!mt(d))
1133
1133
  throw new RangeError("Invalid time value");
1134
1134
  let g = e.match(oe).map((u) => {
1135
1135
  const c = u[0];
1136
1136
  if (c === "p" || c === "P") {
1137
- const O = zt[c];
1138
- return O(u, r.formatLong);
1137
+ const M = zt[c];
1138
+ return M(u, r.formatLong);
1139
1139
  }
1140
1140
  return u;
1141
1141
  }).join("").match(se).map((u) => {
@@ -1144,7 +1144,7 @@ function ce(t, e, n) {
1144
1144
  const c = u[0];
1145
1145
  if (c === "'")
1146
1146
  return { isToken: !1, value: he(u) };
1147
- if (V[c])
1147
+ if (j[c])
1148
1148
  return { isToken: !0, value: u };
1149
1149
  if (c.match(de))
1150
1150
  throw new RangeError(
@@ -1162,8 +1162,8 @@ function ce(t, e, n) {
1162
1162
  if (!u.isToken) return u.value;
1163
1163
  const c = u.value;
1164
1164
  (ae(c) || ne(c)) && re(c, e, String(t));
1165
- const O = V[c[0]];
1166
- return O(d, c, r.localize, v);
1165
+ const M = j[c[0]];
1166
+ return M(d, c, r.localize, v);
1167
1167
  }).join("");
1168
1168
  }
1169
1169
  function he(t) {
@@ -1175,11 +1175,11 @@ function he(t) {
1175
1175
  * Copyright 2017 Google LLC
1176
1176
  * SPDX-License-Identifier: BSD-3-Clause
1177
1177
  */
1178
- const Q = (t, e, n) => {
1178
+ const X = (t, e, n) => {
1179
1179
  const a = /* @__PURE__ */ new Map();
1180
1180
  for (let r = e; r <= n; r++) a.set(t[r], r);
1181
1181
  return a;
1182
- }, me = Z(class extends tt {
1182
+ }, fe = Z(class extends tt {
1183
1183
  constructor(t) {
1184
1184
  if (super(t), t.type !== et.CHILD) throw Error("repeat() can only be used in text expressions");
1185
1185
  }
@@ -1198,33 +1198,33 @@ const Q = (t, e, n) => {
1198
1198
  const r = at(t), { values: i, keys: s } = this.dt(e, n, a);
1199
1199
  if (!Array.isArray(r)) return this.ut = s, i;
1200
1200
  const d = this.ut ?? (this.ut = []), g = [];
1201
- let v, x, l = 0, f = r.length - 1, h = 0, u = i.length - 1;
1202
- for (; l <= f && h <= u; ) if (r[l] === null) l++;
1203
- else if (r[f] === null) f--;
1204
- else if (d[l] === s[h]) g[h] = M(r[l], i[h]), l++, h++;
1205
- else if (d[f] === s[u]) g[u] = M(r[f], i[u]), f--, u--;
1206
- else if (d[l] === s[u]) g[u] = M(r[l], i[u]), S(t, g[u + 1], r[l]), l++, u--;
1207
- else if (d[f] === s[h]) g[h] = M(r[f], i[h]), S(t, r[l], r[f]), f--, h++;
1208
- else if (v === void 0 && (v = Q(s, h, u), x = Q(d, l, f)), v.has(d[l])) if (v.has(d[f])) {
1209
- const c = x.get(s[h]), O = c !== void 0 ? r[c] : null;
1210
- if (O === null) {
1211
- const I = S(t, r[l]);
1212
- M(I, i[h]), g[h] = I;
1213
- } else g[h] = M(O, i[h]), S(t, r[l], O), r[c] = null;
1201
+ let v, x, l = 0, m = r.length - 1, h = 0, u = i.length - 1;
1202
+ for (; l <= m && h <= u; ) if (r[l] === null) l++;
1203
+ else if (r[m] === null) m--;
1204
+ else if (d[l] === s[h]) g[h] = $(r[l], i[h]), l++, h++;
1205
+ else if (d[m] === s[u]) g[u] = $(r[m], i[u]), m--, u--;
1206
+ else if (d[l] === s[u]) g[u] = $(r[l], i[u]), S(t, g[u + 1], r[l]), l++, u--;
1207
+ else if (d[m] === s[h]) g[h] = $(r[m], i[h]), S(t, r[l], r[m]), m--, h++;
1208
+ else if (v === void 0 && (v = X(s, h, u), x = X(d, l, m)), v.has(d[l])) if (v.has(d[m])) {
1209
+ const c = x.get(s[h]), M = c !== void 0 ? r[c] : null;
1210
+ if (M === null) {
1211
+ const N = S(t, r[l]);
1212
+ $(N, i[h]), g[h] = N;
1213
+ } else g[h] = $(M, i[h]), S(t, r[l], M), r[c] = null;
1214
1214
  h++;
1215
- } else F(r[f]), f--;
1215
+ } else F(r[m]), m--;
1216
1216
  else F(r[l]), l++;
1217
1217
  for (; h <= u; ) {
1218
1218
  const c = S(t, g[u + 1]);
1219
- M(c, i[h]), g[h++] = c;
1219
+ $(c, i[h]), g[h++] = c;
1220
1220
  }
1221
- for (; l <= f; ) {
1221
+ for (; l <= m; ) {
1222
1222
  const c = r[l++];
1223
1223
  c !== null && F(c);
1224
1224
  }
1225
1225
  return this.ut = s, rt(t, g), K;
1226
1226
  }
1227
- }), fe = "pkt-datepicker", pe = !0, ge = {
1227
+ }), me = "pkt-datepicker", pe = !0, ge = {
1228
1228
  name: {
1229
1229
  type: "string",
1230
1230
  name: "Navn",
@@ -1400,7 +1400,7 @@ const Q = (t, e, n) => {
1400
1400
  description: "Returnerer <code>event.detail { isOpen: true }</code> eller <code>event.detail { isOpen: false }</code> når hjelpeteksten åpnes eller lukkes"
1401
1401
  }
1402
1402
  }, w = {
1403
- name: fe,
1403
+ name: me,
1404
1404
  "css-class": "pkt-datepicker",
1405
1405
  isElement: pe,
1406
1406
  props: ge,
@@ -1411,8 +1411,8 @@ var ve = Object.defineProperty, we = Object.getOwnPropertyDescriptor, p = (t, e,
1411
1411
  (s = t[i]) && (r = (a ? s(e, n, r) : s(r)) || r);
1412
1412
  return a && r && ve(e, n, r), r;
1413
1413
  };
1414
- const X = (t) => new Promise((e) => setTimeout(e, t));
1415
- let m = class extends z {
1414
+ const I = (t) => new Promise((e) => setTimeout(e, t));
1415
+ let f = class extends z {
1416
1416
  constructor() {
1417
1417
  super(...arguments), this.value = "", this._value = this.value ? Array.isArray(this.value) ? this.value : this.value.split(",") : [], this.label = "Datovelger", this.helptext = "", this.helptextDropdown = "", this.helptextDropdownButton = w.props.helptextDropdownButton.default, this.dateformat = w.props.dateformat.default, this.multiple = w.props.multiple.default, this.maxlength = w.props.maxlength.default, this.range = w.props.range.default, this.weeknumbers = w.props.weeknumbers.default, this.withcontrols = w.props.withcontrols.default, this.fullwidth = !1, this.excludedates = [], this.excludeweekdays = [], this.currentmonth = this.formatISODate(/* @__PURE__ */ new Date()), this.calendarOpen = !1, this.inputRef = C(), this.inputRefTo = C(), this.btnRef = C(), this.calRef = C(), this.popupRef = C(), this.inputClasses = {
1418
1418
  "pkt-input": !0,
@@ -1443,10 +1443,10 @@ let m = class extends z {
1443
1443
  * Housekeeping / lifecycle methods
1444
1444
  */
1445
1445
  async connectedCallback() {
1446
- super.connectedCallback(), document && document.body.addEventListener("click", (t) => {
1446
+ super.connectedCallback(), this.isMobileSafari = /iP(ad|od|hone)/i.test(window.navigator.userAgent) && !!navigator.userAgent.match(/Version\/[\d\.]+.*Safari/), this.inputType = this.isMobileSafari ? "text" : "date", document && document.body.addEventListener("click", (t) => {
1447
1447
  var e, n;
1448
1448
  (e = this.inputRef) != null && e.value && ((n = this.btnRef) != null && n.value) && !this.inputRef.value.contains(t.target) && !(this.inputRefTo.value && this.inputRefTo.value.contains(t.target)) && !this.btnRef.value.contains(t.target) && !t.target.closest(".pkt-calendar-popup") && this.hideCalendar();
1449
- }), this.value.length && this._value.length === 0 && (this._value = Array.isArray(this.value) ? this.value : this.value.split(",")), this.min = this.min || w.props.min.default, this.max = this.max || w.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 X(20), this.handleCalendarPosition());
1449
+ }), this.value.length && this._value.length === 0 && (this._value = Array.isArray(this.value) ? this.value : this.value.split(",")), this.min = this.min || w.props.min.default, this.max = this.max || w.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 I(20), this.handleCalendarPosition());
1450
1450
  }
1451
1451
  disconnectedCallback() {
1452
1452
  super.disconnectedCallback(), document && document.body.removeEventListener("click", (t) => {
@@ -1473,10 +1473,10 @@ let m = class extends z {
1473
1473
  return t.toISOString().split("T")[0];
1474
1474
  }
1475
1475
  renderInput() {
1476
- return P`
1476
+ return O`
1477
1477
  <input
1478
1478
  class="${R(this.inputClasses)}"
1479
- type="date"
1479
+ .type=${this.inputType}
1480
1480
  id="${this.id}-input"
1481
1481
  .value=${this._value[0] ?? ""}
1482
1482
  min=${this.min}
@@ -1485,22 +1485,29 @@ let m = class extends z {
1485
1485
  t.preventDefault(), this.showCalendar();
1486
1486
  }}
1487
1487
  ?disabled=${this.disabled}
1488
+ @keydown=${(t) => {
1489
+ var e;
1490
+ (t.key === "," || t.key === "Enter") && ((e = this.inputRef.value) == null || e.blur());
1491
+ }}
1492
+ @focus=${() => {
1493
+ this.isMobileSafari && this.showCalendar();
1494
+ }}
1488
1495
  @blur=${(t) => {
1489
1496
  this.manageValidity(t.target), this.value = t.target.value;
1490
1497
  }}
1491
1498
  @change=${(t) => {
1492
1499
  t.stopImmediatePropagation();
1493
1500
  }}
1494
- ${D(this.inputRef)}
1501
+ ${P(this.inputRef)}
1495
1502
  />
1496
1503
  `;
1497
1504
  }
1498
1505
  renderRangeInput() {
1499
- return P`
1506
+ return O`
1500
1507
  <div class="pkt-input-prefix">Fra</div>
1501
1508
  <input
1502
1509
  class=${R(this.inputClasses)}
1503
- type="date"
1510
+ .type=${this.inputType}
1504
1511
  id="${this.id}-input"
1505
1512
  .value=${this._value[0] ?? ""}
1506
1513
  min=${this.min}
@@ -1509,6 +1516,13 @@ let m = class extends z {
1509
1516
  t.preventDefault(), this.showCalendar();
1510
1517
  }}
1511
1518
  ?disabled=${this.disabled}
1519
+ @keydown=${(t) => {
1520
+ var e;
1521
+ (t.key === "," || t.key === "Enter") && ((e = this.inputRef.value) == null || e.blur());
1522
+ }}
1523
+ @focus=${() => {
1524
+ this.isMobileSafari && this.showCalendar();
1525
+ }}
1512
1526
  @blur=${(t) => {
1513
1527
  var e, n;
1514
1528
  if (t.target.value) {
@@ -1520,12 +1534,12 @@ let m = class extends z {
1520
1534
  @change=${(t) => {
1521
1535
  t.stopImmediatePropagation();
1522
1536
  }}
1523
- ${D(this.inputRef)}
1537
+ ${P(this.inputRef)}
1524
1538
  />
1525
1539
  <div class="pkt-input-prefix">Til</div>
1526
1540
  <input
1527
1541
  class=${R(this.inputClasses)}
1528
- type="date"
1542
+ .type=${this.inputType}
1529
1543
  id="${this.id}-to"
1530
1544
  .value=${this._value[1] ?? ""}
1531
1545
  min=${this.min}
@@ -1534,6 +1548,13 @@ let m = class extends z {
1534
1548
  t.preventDefault(), this.showCalendar();
1535
1549
  }}
1536
1550
  ?disabled=${this.disabled}
1551
+ @keydown=${(t) => {
1552
+ var e;
1553
+ (t.key === "," || t.key === "Enter") && ((e = this.inputRefTo.value) == null || e.blur());
1554
+ }}
1555
+ @focus=${() => {
1556
+ this.isMobileSafari && this.showCalendar();
1557
+ }}
1537
1558
  @blur=${(t) => {
1538
1559
  var e, n;
1539
1560
  if (t.target.value) {
@@ -1555,15 +1576,15 @@ let m = class extends z {
1555
1576
  @change=${(t) => {
1556
1577
  t.stopImmediatePropagation();
1557
1578
  }}
1558
- ${D(this.inputRefTo)}
1579
+ ${P(this.inputRefTo)}
1559
1580
  />
1560
1581
  `;
1561
1582
  }
1562
1583
  renderMultipleInput() {
1563
- return P`
1584
+ return O`
1564
1585
  <input
1565
1586
  class=${R(this.inputClasses)}
1566
- type="date"
1587
+ .type=${this.inputType}
1567
1588
  id="${this.id}-input"
1568
1589
  min=${this.min}
1569
1590
  max=${this.max}
@@ -1572,6 +1593,9 @@ let m = class extends z {
1572
1593
  }}
1573
1594
  @blur=${(t) => {
1574
1595
  this.addToSelected(t);
1596
+ }}
1597
+ @focus=${() => {
1598
+ this.isMobileSafari && this.showCalendar();
1575
1599
  }}
1576
1600
  @keydown=${(t) => {
1577
1601
  (t.key === "," || t.key === "Enter") && (t.preventDefault(), this.addToSelected(t));
@@ -1580,17 +1604,17 @@ let m = class extends z {
1580
1604
  @change=${(t) => {
1581
1605
  t.stopImmediatePropagation();
1582
1606
  }}
1583
- ${D(this.inputRef)}
1607
+ ${P(this.inputRef)}
1584
1608
  />
1585
1609
  `;
1586
1610
  }
1587
1611
  renderTags() {
1588
- return P`
1612
+ return O`
1589
1613
  <div class="pkt-datepicker__tags" aria-live="polite">
1590
- ${this._value[0] ? me(
1614
+ ${this._value[0] ? fe(
1591
1615
  this._value ?? [],
1592
1616
  (t) => t,
1593
- (t) => P`
1617
+ (t) => O`
1594
1618
  <pkt-tag
1595
1619
  .id="${this.id + t + "-tag"}"
1596
1620
  closeTag
@@ -1601,16 +1625,16 @@ let m = class extends z {
1601
1625
  >${this.fromISOtoLocal(t)}</pkt-tag
1602
1626
  >
1603
1627
  `
1604
- ) : N}
1628
+ ) : B}
1605
1629
  </div>
1606
1630
  `;
1607
1631
  }
1608
1632
  renderCalendar() {
1609
- return P`<div
1633
+ return O`<div
1610
1634
  class="pkt-calendar-popup pkt-${this.calendarOpen ? "show" : "hide"}"
1611
1635
  @focusout=${this.handleFocusOut}
1612
1636
  id="${this.id}-popup"
1613
- ${D(this.popupRef)}
1637
+ ${P(this.popupRef)}
1614
1638
  >
1615
1639
  <pkt-calendar
1616
1640
  ?multiple=${this.multiple}
@@ -1628,12 +1652,12 @@ let m = class extends z {
1628
1652
  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] : ""));
1629
1653
  }}
1630
1654
  @close=${this.hideCalendar}
1631
- ${D(this.calRef)}
1655
+ ${P(this.calRef)}
1632
1656
  ></pkt-calendar>
1633
1657
  </div>`;
1634
1658
  }
1635
1659
  render() {
1636
- return P`
1660
+ return O`
1637
1661
  <pkt-input-wrapper
1638
1662
  label="${this.label}"
1639
1663
  forId="${this.id}-input"
@@ -1645,6 +1669,7 @@ let m = class extends z {
1645
1669
  ?required=${this.required}
1646
1670
  ?optionalTag=${this.optionalTag}
1647
1671
  ?requiredTag=${this.requiredTag}
1672
+ ?focusPreventDefault=${!0}
1648
1673
  .optionalText=${this.optionalText}
1649
1674
  .requiredText=${this.requiredText}
1650
1675
  .errorMessage=${this.errorMessage}
@@ -1653,14 +1678,15 @@ let m = class extends z {
1653
1678
  .helptextDropdownButton=${this.helptextDropdownButton}
1654
1679
  class="pkt-datepicker"
1655
1680
  >
1656
- ${this.multiple ? this.renderTags() : N}
1681
+ ${this.multiple ? this.renderTags() : B}
1657
1682
  <div class="pkt-datepicker__inputs ${this.range ? "pkt-input__range-inputs" : ""}">
1658
1683
  <div class="pkt-input__container">
1659
1684
  ${this.range ? this.renderRangeInput() : this.multiple ? this.renderMultipleInput() : this.renderInput()}
1660
1685
  <button
1661
1686
  class="${R(this.buttonClasses)}"
1662
1687
  @click=${this.toggleCalendar}
1663
- ${D(this.btnRef)}
1688
+ ?disabled=${this.disabled}
1689
+ ${P(this.btnRef)}
1664
1690
  >
1665
1691
  <pkt-icon name="calendar"></pkt-icon>
1666
1692
  <span class="pkt-btn__text">${this.strings.calendar.buttonAltText}</span>
@@ -1686,69 +1712,71 @@ let m = class extends z {
1686
1712
  this.contains(t.target) || this.hideCalendar();
1687
1713
  }
1688
1714
  async showCalendar() {
1689
- this.calendarOpen = !0, await X(20), this.handleCalendarPosition();
1715
+ var t;
1716
+ this.calendarOpen = !0, await I(20), this.handleCalendarPosition(), this.isMobileSafari && ((t = this.calRef.value) == null || t.focusOnCurrentDate());
1690
1717
  }
1691
1718
  hideCalendar() {
1692
1719
  this.calendarOpen = !1;
1693
1720
  }
1694
- toggleCalendar(t) {
1695
- t.preventDefault(), this.calendarOpen ? this.hideCalendar() : this.showCalendar();
1721
+ async toggleCalendar(t) {
1722
+ var e;
1723
+ t.preventDefault(), this.calendarOpen ? this.hideCalendar() : this.showCalendar(), await I(20), this.isMobileSafari && ((e = this.calRef.value) == null || e.focusOnCurrentDate());
1696
1724
  }
1697
1725
  };
1698
1726
  p([
1699
1727
  y({ type: String, reflect: !0 })
1700
- ], m.prototype, "value", 2);
1728
+ ], f.prototype, "value", 2);
1701
1729
  p([
1702
1730
  y({ type: Array, reflect: !1 })
1703
- ], m.prototype, "_value", 2);
1731
+ ], f.prototype, "_value", 2);
1704
1732
  p([
1705
1733
  y({ type: String })
1706
- ], m.prototype, "label", 2);
1734
+ ], f.prototype, "label", 2);
1707
1735
  p([
1708
1736
  y({ type: String })
1709
- ], m.prototype, "helptext", 2);
1737
+ ], f.prototype, "helptext", 2);
1710
1738
  p([
1711
1739
  y({ type: String })
1712
- ], m.prototype, "helptextDropdown", 2);
1740
+ ], f.prototype, "helptextDropdown", 2);
1713
1741
  p([
1714
1742
  y({ type: String })
1715
- ], m.prototype, "helptextDropdownButton", 2);
1743
+ ], f.prototype, "helptextDropdownButton", 2);
1716
1744
  p([
1717
1745
  y({ type: String })
1718
- ], m.prototype, "dateformat", 2);
1746
+ ], f.prototype, "dateformat", 2);
1719
1747
  p([
1720
1748
  y({ type: Boolean, reflect: !0 })
1721
- ], m.prototype, "multiple", 2);
1749
+ ], f.prototype, "multiple", 2);
1722
1750
  p([
1723
1751
  y({ type: Number })
1724
- ], m.prototype, "maxlength", 2);
1752
+ ], f.prototype, "maxlength", 2);
1725
1753
  p([
1726
1754
  y({ type: Boolean, reflect: !0 })
1727
- ], m.prototype, "range", 2);
1755
+ ], f.prototype, "range", 2);
1728
1756
  p([
1729
1757
  y({ type: Boolean })
1730
- ], m.prototype, "weeknumbers", 2);
1758
+ ], f.prototype, "weeknumbers", 2);
1731
1759
  p([
1732
1760
  y({ type: Boolean })
1733
- ], m.prototype, "withcontrols", 2);
1761
+ ], f.prototype, "withcontrols", 2);
1734
1762
  p([
1735
1763
  y({ type: Boolean })
1736
- ], m.prototype, "fullwidth", 2);
1764
+ ], f.prototype, "fullwidth", 2);
1737
1765
  p([
1738
1766
  y({ converter: G.csvToArray })
1739
- ], m.prototype, "excludedates", 2);
1767
+ ], f.prototype, "excludedates", 2);
1740
1768
  p([
1741
1769
  y({ converter: G.csvToArray })
1742
- ], m.prototype, "excludeweekdays", 2);
1770
+ ], f.prototype, "excludeweekdays", 2);
1743
1771
  p([
1744
1772
  y({ type: String })
1745
- ], m.prototype, "currentmonth", 2);
1773
+ ], f.prototype, "currentmonth", 2);
1746
1774
  p([
1747
1775
  y({ type: Boolean, reflect: !0 })
1748
- ], m.prototype, "calendarOpen", 2);
1749
- m = p([
1776
+ ], f.prototype, "calendarOpen", 2);
1777
+ f = p([
1750
1778
  nt("pkt-datepicker")
1751
- ], m);
1779
+ ], f);
1752
1780
  export {
1753
- m as PktDatepicker
1781
+ f as PktDatepicker
1754
1782
  };