@oslokommune/punkt-elements 16.7.1 → 16.7.3

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 (193) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/accordionitem-_9AiCIvd.cjs +34 -0
  3. package/dist/{accordionitem-ZlaXvjt5.js → accordionitem-dCfSrxh5.js} +57 -55
  4. package/dist/alert-BtOk8yRH.cjs +33 -0
  5. package/dist/{alert-BuAXrnKl.js → alert-DlY2_grU.js} +48 -46
  6. package/dist/backlink-Ce5Vldop.js +49 -0
  7. package/dist/backlink-y3dwjKPC.cjs +13 -0
  8. package/dist/button-B_TXwNzt.cjs +27 -0
  9. package/dist/{button-DEyvt1LI.js → button-BiY-wlKF.js} +79 -77
  10. package/dist/calendar-B2pji2zn.cjs +90 -0
  11. package/dist/{calendar-S63oreVW.js → calendar-DhjQDC4C.js} +689 -687
  12. package/dist/card-BwMNB5Bb.cjs +87 -0
  13. package/dist/{card-DDiLfuO4.js → card-CGlmcMSR.js} +99 -97
  14. package/dist/checkbox-BsJZYA26.js +147 -0
  15. package/dist/checkbox-CTY8f_qn.cjs +31 -0
  16. package/dist/{combobox-BmxSecfE.js → combobox-DSB5WOxg.js} +223 -226
  17. package/dist/{combobox-Hb2V-fPX.cjs → combobox-DbICIgKG.cjs} +4 -4
  18. package/dist/consent-DkOQpbsg.cjs +11 -0
  19. package/dist/{consent-iXyx5v6J.js → consent-SNWV_mMU.js} +48 -46
  20. package/dist/datepicker-BEWl9iz3.cjs +273 -0
  21. package/dist/{datepicker-CZl7b8Na.js → datepicker-euHyzXnb.js} +341 -329
  22. package/dist/{heading-CKt7cVn7.js → heading-D2tVS6lS.js} +30 -28
  23. package/dist/heading-DrzbgDb6.cjs +1 -0
  24. package/dist/helptext-BKtU4mas.js +82 -0
  25. package/dist/helptext-DcRC7wW2.cjs +24 -0
  26. package/dist/icon-CxQcIa5F.js +105 -0
  27. package/dist/icon-q81vqPK_.cjs +9 -0
  28. package/dist/input-wrapper-Bs4CRNst.js +181 -0
  29. package/dist/input-wrapper-Bv9aqqVq.cjs +54 -0
  30. package/dist/link-C0rl-86s.cjs +7 -0
  31. package/dist/link-Cdqgl60z.js +55 -0
  32. package/dist/linkcard-Dimu7Rlx.cjs +13 -0
  33. package/dist/linkcard-Lbq_UhjZ.js +56 -0
  34. package/dist/{listbox-BQKDZvZn.js → listbox-Bia4_tvN.js} +131 -129
  35. package/dist/listbox-La2GZQei.cjs +106 -0
  36. package/dist/loader-D1ugDXGV.cjs +16 -0
  37. package/dist/{loader-Ci3CHU8k.js → loader-DyN6RGC5.js} +51 -49
  38. package/dist/messagebox-BGMVm2t9.js +71 -0
  39. package/dist/messagebox-M0yIgCz9.cjs +13 -0
  40. package/dist/modal-CMO1RtIi.cjs +36 -0
  41. package/dist/{modal-DzGe1g8Z.js → modal-DjPQDE-Z.js} +53 -51
  42. package/dist/pkt-accordion.cjs +1 -1
  43. package/dist/pkt-accordion.js +2 -2
  44. package/dist/pkt-alert.cjs +1 -1
  45. package/dist/pkt-alert.js +3 -4
  46. package/dist/pkt-backlink.cjs +1 -1
  47. package/dist/pkt-backlink.js +2 -3
  48. package/dist/pkt-breadcrumbs.cjs +11 -11
  49. package/dist/pkt-breadcrumbs.js +30 -28
  50. package/dist/pkt-button.cjs +1 -1
  51. package/dist/pkt-button.js +3 -4
  52. package/dist/pkt-calendar.cjs +1 -1
  53. package/dist/pkt-calendar.js +2 -3
  54. package/dist/pkt-card.cjs +1 -1
  55. package/dist/pkt-card.js +2 -3
  56. package/dist/pkt-checkbox.cjs +1 -1
  57. package/dist/pkt-checkbox.js +3 -4
  58. package/dist/pkt-combobox.cjs +1 -1
  59. package/dist/pkt-combobox.js +3 -4
  60. package/dist/pkt-consent.cjs +1 -1
  61. package/dist/pkt-consent.js +2 -3
  62. package/dist/pkt-datepicker.cjs +1 -1
  63. package/dist/pkt-datepicker.js +7 -8
  64. package/dist/pkt-header.cjs +35 -35
  65. package/dist/pkt-header.js +224 -218
  66. package/dist/pkt-heading.cjs +1 -1
  67. package/dist/pkt-heading.js +3 -4
  68. package/dist/pkt-helptext.cjs +1 -1
  69. package/dist/pkt-helptext.js +3 -4
  70. package/dist/pkt-icon.cjs +1 -1
  71. package/dist/pkt-icon.js +3 -4
  72. package/dist/pkt-index.cjs +1 -1
  73. package/dist/pkt-index.js +26 -26
  74. package/dist/pkt-input-wrapper.cjs +1 -1
  75. package/dist/pkt-input-wrapper.js +2 -3
  76. package/dist/pkt-link.cjs +1 -1
  77. package/dist/pkt-link.js +2 -3
  78. package/dist/pkt-linkcard.cjs +1 -1
  79. package/dist/pkt-linkcard.js +3 -4
  80. package/dist/pkt-listbox.cjs +1 -1
  81. package/dist/pkt-listbox.js +3 -4
  82. package/dist/pkt-loader.cjs +1 -1
  83. package/dist/pkt-loader.js +3 -4
  84. package/dist/pkt-messagebox.cjs +1 -1
  85. package/dist/pkt-messagebox.js +3 -4
  86. package/dist/pkt-modal.cjs +1 -1
  87. package/dist/pkt-modal.js +3 -4
  88. package/dist/pkt-progressbar.cjs +1 -1
  89. package/dist/pkt-progressbar.js +2 -3
  90. package/dist/pkt-radiobutton.cjs +1 -1
  91. package/dist/pkt-radiobutton.js +3 -4
  92. package/dist/pkt-select.cjs +1 -1
  93. package/dist/pkt-select.js +3 -4
  94. package/dist/pkt-tabs.cjs +1 -1
  95. package/dist/pkt-tabs.js +2 -2
  96. package/dist/pkt-tag.cjs +1 -1
  97. package/dist/pkt-tag.js +3 -4
  98. package/dist/pkt-textarea.cjs +1 -1
  99. package/dist/pkt-textarea.js +3 -4
  100. package/dist/pkt-textinput.cjs +1 -1
  101. package/dist/pkt-textinput.js +3 -4
  102. package/dist/pkt-timepicker.cjs +16 -16
  103. package/dist/pkt-timepicker.js +91 -89
  104. package/dist/progressbar-BqlMzkM_.cjs +21 -0
  105. package/dist/{progressbar-By7e0lEI.js → progressbar-sbHDFC12.js} +88 -88
  106. package/dist/radiobutton-5ZqVVtTT.cjs +31 -0
  107. package/dist/{radiobutton-6frNG9J_.js → radiobutton-D8Ai8ETa.js} +44 -42
  108. package/dist/select-De-n8on9.js +230 -0
  109. package/dist/select-dTWibR6_.cjs +49 -0
  110. package/dist/tabitem-B9-jeV97.js +334 -0
  111. package/dist/tabitem-BnhzqfW3.cjs +65 -0
  112. package/dist/tag-CbwO8yvD.cjs +27 -0
  113. package/dist/{tag-BuCpqaks.js → tag-D4FI5t3y.js} +42 -40
  114. package/dist/textarea-BmLaKzsc.cjs +50 -0
  115. package/dist/{textarea-Bzuymclz.js → textarea-CMiSJaYL.js} +62 -60
  116. package/dist/textinput-em9y4yrL.cjs +70 -0
  117. package/dist/{textinput-9lHjs4ce.js → textinput-r8udK0IX.js} +57 -55
  118. package/package.json +2 -2
  119. package/src/components/accordion/accordion.ts +6 -1
  120. package/src/components/accordion/accordionitem.ts +6 -1
  121. package/src/components/alert/alert.ts +6 -1
  122. package/src/components/backlink/backlink.ts +6 -1
  123. package/src/components/breadcrumbs/breadcrumbs.ts +6 -1
  124. package/src/components/button/button.ts +6 -1
  125. package/src/components/calendar/calendar.ts +6 -1
  126. package/src/components/card/card.ts +6 -1
  127. package/src/components/checkbox/checkbox.ts +6 -1
  128. package/src/components/combobox/combobox.ts +6 -1
  129. package/src/components/consent/consent.ts +6 -1
  130. package/src/components/datepicker/date-tags.ts +6 -1
  131. package/src/components/datepicker/datepicker-multiple.ts +6 -1
  132. package/src/components/datepicker/datepicker-popup.ts +6 -1
  133. package/src/components/datepicker/datepicker-range.ts +6 -1
  134. package/src/components/datepicker/datepicker-single.ts +6 -1
  135. package/src/components/datepicker/datepicker.ts +6 -1
  136. package/src/components/header/header-service.ts +6 -1
  137. package/src/components/header/header-user-menu.ts +6 -1
  138. package/src/components/header/header.ts +6 -1
  139. package/src/components/heading/heading.ts +6 -1
  140. package/src/components/helptext/helptext.ts +6 -1
  141. package/src/components/icon/icon.ts +6 -1
  142. package/src/components/input-wrapper/input-wrapper.ts +6 -1
  143. package/src/components/link/link.ts +6 -1
  144. package/src/components/linkcard/linkcard.ts +6 -1
  145. package/src/components/listbox/listbox.ts +6 -1
  146. package/src/components/loader/loader.ts +6 -1
  147. package/src/components/messagebox/messagebox.ts +6 -1
  148. package/src/components/modal/modal.ts +6 -1
  149. package/src/components/progressbar/progressbar.ts +6 -1
  150. package/src/components/radiobutton/radiobutton.ts +6 -1
  151. package/src/components/select/select.ts +6 -1
  152. package/src/components/tabs/tabitem.ts +6 -1
  153. package/src/components/tabs/tabs.ts +6 -1
  154. package/src/components/tag/tag.ts +6 -1
  155. package/src/components/textarea/textarea.ts +6 -1
  156. package/src/components/textinput/textinput.ts +6 -1
  157. package/src/components/timepicker/timepicker.ts +6 -1
  158. package/dist/accordionitem-D1Agl1bB.cjs +0 -34
  159. package/dist/alert-DFkFNTxh.cjs +0 -33
  160. package/dist/backlink-EiAXUUZP.cjs +0 -13
  161. package/dist/backlink-V4DAt17e.js +0 -47
  162. package/dist/button-DYv5Dg4M.cjs +0 -27
  163. package/dist/calendar-HIE9nxcc.cjs +0 -90
  164. package/dist/card-CyeH6l1c.cjs +0 -87
  165. package/dist/checkbox-BLlwTABj.cjs +0 -31
  166. package/dist/checkbox-ejBUa5qQ.js +0 -145
  167. package/dist/consent-ruWAEVXW.cjs +0 -11
  168. package/dist/datepicker-D2H7U6MS.cjs +0 -273
  169. package/dist/heading-Cvz8m1xL.cjs +0 -1
  170. package/dist/helptext-5Mzp65-F.cjs +0 -24
  171. package/dist/helptext-jIoWRcCF.js +0 -80
  172. package/dist/icon-BlKA8YuW.js +0 -103
  173. package/dist/icon-Bqj9oBbl.cjs +0 -9
  174. package/dist/input-wrapper-B0MkQ0IZ.cjs +0 -54
  175. package/dist/input-wrapper-B2JpK016.js +0 -179
  176. package/dist/link-R_lNhViF.cjs +0 -7
  177. package/dist/link-Z_GizclR.js +0 -53
  178. package/dist/linkcard-BlQvdB1a.js +0 -54
  179. package/dist/linkcard-C7HbSLlX.cjs +0 -13
  180. package/dist/listbox-CGgV9MAe.cjs +0 -106
  181. package/dist/loader-e2gs_1xz.cjs +0 -16
  182. package/dist/messagebox-Bf-XMlvW.js +0 -69
  183. package/dist/messagebox-D67w71VX.cjs +0 -13
  184. package/dist/modal-CyvEkbfQ.cjs +0 -36
  185. package/dist/progressbar-DsJ2B9Vm.cjs +0 -21
  186. package/dist/radiobutton-Bv-BZ1Hw.cjs +0 -31
  187. package/dist/select-CXZt1nHS.js +0 -228
  188. package/dist/select-WFhS4Vfp.cjs +0 -49
  189. package/dist/tabitem-CB8wkKmv.js +0 -332
  190. package/dist/tabitem-DZpspU4Q.cjs +0 -65
  191. package/dist/tag-X6xdjR0N.cjs +0 -27
  192. package/dist/textarea-DoeHJ7HR.cjs +0 -50
  193. package/dist/textinput-BNsLd26i.cjs +0 -70
@@ -1,34 +1,34 @@
1
- import { s as d, b as u, A as o, n as b, t as x } from "./element-CPpT3rFQ.js";
1
+ import { t as I, s as c, b as u, A as p, n as b } from "./element-CPpT3rFQ.js";
2
2
  import { r as v } from "./state-C_1EOo3D.js";
3
3
  import { e as m, n as _ } from "./ref-Bg_Swj5w.js";
4
- import { o as f } from "./if-defined-B0krMLad.js";
5
- import { e as I } from "./class-map-CEnykyO_.js";
6
- import { P as F } from "./input-element-8nLwuQS4.js";
7
- import { s as A } from "./element-with-slot-Dqk6-TRR.js";
8
- import "./icon-BlKA8YuW.js";
9
- import "./input-wrapper-B2JpK016.js";
10
- const C = (t) => /^\d{2}:\d{2}$/.test(t) && parseInt(t.slice(0, 2), 10) <= 23 && parseInt(t.slice(3), 10) <= 59, k = (t) => {
11
- const [e, s] = t.split(":").map(Number);
12
- return e * 60 + s;
13
- }, g = (t) => t ? Math.max(1, Math.round(t / 60)) : 1, O = (t, e) => {
14
- const s = t ? parseInt(String(t).split(":")[0], 10) : 0, i = e ? parseInt(String(e).split(":")[0], 10) : 23;
15
- return Array.from({ length: i - s + 1 }, (n, r) => r + s);
16
- }, T = (t) => {
17
- const e = g(t);
18
- return Array.from({ length: Math.floor(60 / e) }, (s, i) => i * e);
19
- }, M = (t, e, s, i) => {
20
- let a = t !== "" ? parseInt(t, 10) : s === 1 ? 0 : 23, p = e !== "" ? parseInt(e, 10) : s === 1 ? 0 : Math.floor(59 / i) * i;
21
- return p += s * i, p > 59 ? (p = 0, a = (a + 1) % 24) : p < 0 && (p = Math.floor(59 / i) * i, a = (a - 1 + 24) % 24), {
22
- hours: String(a).padStart(2, "0"),
23
- minutes: String(p).padStart(2, "0")
4
+ import { o as k } from "./if-defined-B0krMLad.js";
5
+ import { e as F } from "./class-map-CEnykyO_.js";
6
+ import { P as A } from "./input-element-8nLwuQS4.js";
7
+ import { s as C } from "./element-with-slot-Dqk6-TRR.js";
8
+ import "./icon-CxQcIa5F.js";
9
+ import "./input-wrapper-Bs4CRNst.js";
10
+ const O = (a) => /^\d{2}:\d{2}$/.test(a) && parseInt(a.slice(0, 2), 10) <= 23 && parseInt(a.slice(3), 10) <= 59, f = (a) => {
11
+ const [t, e] = a.split(":").map(Number);
12
+ return t * 60 + e;
13
+ }, g = (a) => a ? Math.max(1, Math.round(a / 60)) : 1, T = (a, t) => {
14
+ const e = a ? parseInt(String(a).split(":")[0], 10) : 0, s = t ? parseInt(String(t).split(":")[0], 10) : 23;
15
+ return Array.from({ length: s - e + 1 }, (i, n) => n + e);
16
+ }, M = (a) => {
17
+ const t = g(a);
18
+ return Array.from({ length: Math.floor(60 / t) }, (e, s) => s * t);
19
+ }, V = (a, t, e, s) => {
20
+ let r = a !== "" ? parseInt(a, 10) : e === 1 ? 0 : 23, o = t !== "" ? parseInt(t, 10) : e === 1 ? 0 : Math.floor(59 / s) * s;
21
+ return o += e * s, o > 59 ? (o = 0, r = (r + 1) % 24) : o < 0 && (o = Math.floor(59 / s) * s, r = (r - 1 + 24) % 24), {
22
+ hours: String(r).padStart(2, "0"),
23
+ minutes: String(o).padStart(2, "0")
24
24
  };
25
25
  };
26
- var V = Object.defineProperty, P = Object.getOwnPropertyDescriptor, c = (t, e, s, i) => {
27
- for (var n = i > 1 ? void 0 : i ? P(e, s) : e, r = t.length - 1, a; r >= 0; r--)
28
- (a = t[r]) && (n = (i ? a(e, s, n) : a(n)) || n);
29
- return i && n && V(e, s, n), n;
26
+ var P = Object.defineProperty, d = (a, t, e, s) => {
27
+ for (var i = void 0, n = a.length - 1, r; n >= 0; n--)
28
+ (r = a[n]) && (i = r(t, e, i) || i);
29
+ return i && P(t, e, i), i;
30
30
  };
31
- let h = class extends F {
31
+ class l extends A {
32
32
  constructor() {
33
33
  super(...arguments), this.hiddenInputRef = m(), this.hoursInputRef = m(), this.minutesInputRef = m(), this.buttonRef = m(), this.value = "", this.hidePicker = !1, this.stepArrows = !1, this._hours = "", this._minutes = "", this._isOpen = !1, this._hoursDigitCount = 0, this._hoursFirstDigit = -1, this._minutesDigitCount = 0, this._minutesFirstDigit = -1, this._hasFocus = !1, this._outsideClickHandler = (t) => {
34
34
  this.contains(t.target) || this._closePopup();
@@ -74,8 +74,8 @@ let h = class extends F {
74
74
  if (this._hoursDigitCount === 0)
75
75
  this._hoursFirstDigit = r, this._hours = String(r).padStart(2, "0"), this._hoursDigitCount = 1, this.onInput(), r >= 3 && (this._hoursFirstDigit = -1, this._hoursDigitCount = 0, this._syncValueFromDisplay(), (i = this.minutesInputRef.value) == null || i.focus());
76
76
  else {
77
- const a = this._hoursFirstDigit * 10 + r;
78
- this._hours = a <= 23 ? String(a).padStart(2, "0") : String(r).padStart(2, "0"), this._hoursFirstDigit = -1, this._hoursDigitCount = 0, this._syncValueFromDisplay(), this.onInput(), (n = this.minutesInputRef.value) == null || n.focus();
77
+ const o = this._hoursFirstDigit * 10 + r;
78
+ this._hours = o <= 23 ? String(o).padStart(2, "0") : String(r).padStart(2, "0"), this._hoursFirstDigit = -1, this._hoursDigitCount = 0, this._syncValueFromDisplay(), this.onInput(), (n = this.minutesInputRef.value) == null || n.focus();
79
79
  }
80
80
  } else
81
81
  t.preventDefault();
@@ -129,7 +129,7 @@ let h = class extends F {
129
129
  }, this._handleMinutesBlur = () => {
130
130
  this._minutes !== "" && (this._minutes = String(parseInt(this._minutes, 10)).padStart(2, "0")), this._minutesDigitCount = 0, this._minutesFirstDigit = -1, this._syncValueFromDisplay();
131
131
  }, this._handlePopupKeydown = (t) => {
132
- var a;
132
+ var o;
133
133
  const e = document.activeElement, s = e.closest(".pkt-timepicker-popup__col");
134
134
  if (!s) return;
135
135
  const i = Array.from(s.querySelectorAll(".pkt-timepicker-popup__option")), n = i.indexOf(e), r = e.dataset.type ?? "";
@@ -161,7 +161,7 @@ let h = class extends F {
161
161
  t.preventDefault(), e.click();
162
162
  break;
163
163
  case "Escape":
164
- t.preventDefault(), this._closePopup(), (a = this.buttonRef.value) == null || a.focus();
164
+ t.preventDefault(), this._closePopup(), (o = this.buttonRef.value) == null || o.focus();
165
165
  break;
166
166
  }
167
167
  };
@@ -185,32 +185,32 @@ let h = class extends F {
185
185
  const e = this.hoursInputRef.value;
186
186
  if (!e) return;
187
187
  if (this.required && !this.value) {
188
- this.internals.setValidity({ valueMissing: !0 }, d.forms.messages.required, e), this._setAriaInvalid(!0);
188
+ this.internals.setValidity({ valueMissing: !0 }, c.forms.messages.required, e), this._setAriaInvalid(!0);
189
189
  return;
190
190
  }
191
191
  if (!this.value) {
192
192
  this.internals.setValidity({}), this._setAriaInvalid(!1);
193
193
  return;
194
194
  }
195
- const s = k(this.value), i = g(this.step);
196
- if (this.min && s < k(String(this.min))) {
195
+ const s = f(this.value), i = g(this.step);
196
+ if (this.min && s < f(String(this.min))) {
197
197
  this.internals.setValidity(
198
198
  { rangeUnderflow: !0 },
199
- d.forms.messages.rangeUnderflowMin.replace("{min}", String(this.min)),
199
+ c.forms.messages.rangeUnderflowMin.replace("{min}", String(this.min)),
200
200
  e
201
201
  ), this._setAriaInvalid(!0);
202
202
  return;
203
203
  }
204
- if (this.max && s > k(String(this.max))) {
204
+ if (this.max && s > f(String(this.max))) {
205
205
  this.internals.setValidity(
206
206
  { rangeOverflow: !0 },
207
- d.forms.messages.rangeOverflowMax.replace("{max}", String(this.max)),
207
+ c.forms.messages.rangeOverflowMax.replace("{max}", String(this.max)),
208
208
  e
209
209
  ), this._setAriaInvalid(!0);
210
210
  return;
211
211
  }
212
212
  if (this.step && s % i !== 0) {
213
- const n = i === 60 ? d.forms.messages.timeStepMismatchHour : i === 30 ? d.forms.messages.timeStepMismatchHalfHour : d.forms.messages.timeStepMismatch.replace(
213
+ const n = i === 60 ? c.forms.messages.timeStepMismatchHour : i === 30 ? c.forms.messages.timeStepMismatchHalfHour : c.forms.messages.timeStepMismatch.replace(
214
214
  "{step}",
215
215
  `${i}, ${i * 2}, ${i * 3}`
216
216
  );
@@ -245,7 +245,7 @@ let h = class extends F {
245
245
  return t === 3600 || t < 3600 && 3600 % t === 0 && t % 60 === 0;
246
246
  }
247
247
  _syncDisplayFromValue() {
248
- const t = C(this.value) ? this.value.split(":") : null;
248
+ const t = O(this.value) ? this.value.split(":") : null;
249
249
  t ? (this._hours = t[0], this._minutes = t[1]) : (this._hours = "", this._minutes = "");
250
250
  }
251
251
  _syncValueFromDisplay() {
@@ -258,10 +258,10 @@ let h = class extends F {
258
258
  return g(this.step);
259
259
  }
260
260
  get _hourOptions() {
261
- return O(this.min, this.max);
261
+ return T(this.min, this.max);
262
262
  }
263
263
  get _minuteOptions() {
264
- return T(this.step);
264
+ return M(this.step);
265
265
  }
266
266
  _openPopup() {
267
267
  this._isOpen = !0, this.updateComplete.then(() => {
@@ -282,7 +282,7 @@ let h = class extends F {
282
282
  });
283
283
  }
284
284
  _focusSelectedOrFirst(t) {
285
- var a;
285
+ var o;
286
286
  const e = this.querySelector(".pkt-timepicker-popup");
287
287
  if (!e) return;
288
288
  const s = e.querySelectorAll(".pkt-timepicker-popup__col"), i = t === "hour" ? s[0] : s[1];
@@ -290,7 +290,7 @@ let h = class extends F {
290
290
  const n = i.querySelector(
291
291
  ".pkt-timepicker-popup__option--selected"
292
292
  ), r = i.querySelector(".pkt-timepicker-popup__option");
293
- (a = n || r) == null || a.focus();
293
+ (o = n || r) == null || o.focus();
294
294
  }
295
295
  _handleOptionClick(t, e) {
296
296
  var i;
@@ -303,14 +303,14 @@ let h = class extends F {
303
303
  e === "hour" ? this._hours = String(s).padStart(2, "0") : this._minutes = String(s).padStart(2, "0"), t.focus();
304
304
  }
305
305
  _stepTime(t) {
306
- const e = M(this._hours, this._minutes, t, this._minuteStep);
306
+ const e = V(this._hours, this._minutes, t, this._minuteStep);
307
307
  this._hours = e.hours, this._minutes = e.minutes, this._syncValueFromDisplay();
308
308
  }
309
309
  _renderOption(t, e) {
310
310
  const s = String(t).padStart(2, "0"), i = e === "hour" ? this._hours !== "" ? parseInt(this._hours, 10) : NaN : this._minutes !== "" ? parseInt(this._minutes, 10) : NaN, n = t === i;
311
311
  return u`
312
312
  <button
313
- class=${I({
313
+ class=${F({
314
314
  "pkt-btn": !0,
315
315
  "pkt-btn--tertiary": !0,
316
316
  "pkt-btn--small": !0,
@@ -367,30 +367,30 @@ let h = class extends F {
367
367
  `;
368
368
  }
369
369
  _renderContainer() {
370
- var n, r, a, p, $, y, S, D;
370
+ var n, r, o, $, y, S, D, w;
371
371
  const t = ((n = this.strings.timepicker) == null ? void 0 : n.hours) ?? "Timer", e = ((r = this.strings.timepicker) == null ? void 0 : r.minutes) ?? "Minutter", s = this.label ? `${t}, ${this.label}` : t, i = this.label ? `${e}, ${this.label}` : e;
372
372
  return u`
373
373
  <div
374
374
  class="pkt-input__container"
375
- @click=${(l) => {
376
- var w;
377
- l.target.closest("button, input") || (w = this.hoursInputRef.value) == null || w.focus();
375
+ @click=${(h) => {
376
+ var x;
377
+ h.target.closest("button, input") || (x = this.hoursInputRef.value) == null || x.focus();
378
378
  }}
379
379
  >
380
380
  ${this.stepArrows ? u`
381
381
  <button
382
382
  class="pkt-input-icon pkt-btn pkt-btn--icon-only pkt-btn--tertiary pkt-timepicker__button pkt-timepicker__button--prev"
383
383
  type="button"
384
- aria-label=${((a = this.strings.timepicker) == null ? void 0 : a.prevTime) ?? "Forrige tidspunkt"}
384
+ aria-label=${((o = this.strings.timepicker) == null ? void 0 : o.prevTime) ?? "Forrige tidspunkt"}
385
385
  ?disabled=${this.disabled}
386
386
  @click=${() => this._stepTime(-1)}
387
387
  >
388
388
  <pkt-icon name="chevron-thin-left"></pkt-icon>
389
389
  <span class="pkt-btn__text"
390
- >${((p = this.strings.timepicker) == null ? void 0 : p.prevTime) ?? "Forrige tidspunkt"}</span
390
+ >${(($ = this.strings.timepicker) == null ? void 0 : $.prevTime) ?? "Forrige tidspunkt"}</span
391
391
  >
392
392
  </button>
393
- ` : o}
393
+ ` : p}
394
394
  <input
395
395
  ${_(this.hoursInputRef)}
396
396
  type="text"
@@ -405,17 +405,17 @@ let h = class extends F {
405
405
  placeholder="––"
406
406
  aria-label=${s}
407
407
  role="spinbutton"
408
- aria-invalid=${this.hasError ? "true" : o}
408
+ aria-invalid=${this.hasError ? "true" : p}
409
409
  aria-valuemin="0"
410
410
  aria-valuemax="23"
411
- aria-valuenow=${this._hours !== "" ? this._hours : o}
412
- aria-valuetext=${this._hours !== "" ? `${this._hours} ${t.toLowerCase()}` : o}
411
+ aria-valuenow=${this._hours !== "" ? this._hours : p}
412
+ aria-valuetext=${this._hours !== "" ? `${this._hours} ${t.toLowerCase()}` : p}
413
413
  autocomplete="off"
414
414
  ?disabled=${this.disabled}
415
415
  @keydown=${this._handleHoursKeydown}
416
416
  @blur=${this._handleHoursBlur}
417
- @focus=${(l) => {
418
- l.target.select(), l.stopImmediatePropagation();
417
+ @focus=${(h) => {
418
+ h.target.select(), h.stopImmediatePropagation();
419
419
  }}
420
420
  />
421
421
  <span class="pkt-timepicker__separator">:</span>
@@ -433,30 +433,30 @@ let h = class extends F {
433
433
  placeholder="––"
434
434
  aria-label=${i}
435
435
  role="spinbutton"
436
- aria-invalid=${this.hasError ? "true" : o}
436
+ aria-invalid=${this.hasError ? "true" : p}
437
437
  aria-valuemin="0"
438
438
  aria-valuemax="59"
439
- aria-valuenow=${this._minutes !== "" ? this._minutes : o}
440
- aria-valuetext=${this._minutes !== "" ? `${this._minutes} ${e.toLowerCase()}` : o}
439
+ aria-valuenow=${this._minutes !== "" ? this._minutes : p}
440
+ aria-valuetext=${this._minutes !== "" ? `${this._minutes} ${e.toLowerCase()}` : p}
441
441
  autocomplete="off"
442
442
  ?disabled=${this.disabled}
443
443
  @keydown=${this._handleMinutesKeydown}
444
444
  @blur=${this._handleMinutesBlur}
445
- @focus=${(l) => {
446
- l.target.select(), l.stopImmediatePropagation();
445
+ @focus=${(h) => {
446
+ h.target.select(), h.stopImmediatePropagation();
447
447
  }}
448
448
  />
449
449
  ${this.hidePicker && !this.stepArrows ? u`<pkt-icon
450
450
  class="pkt-input-icon pkt-timepicker__icon"
451
451
  name="clock"
452
452
  aria-hidden="true"
453
- ></pkt-icon>` : o}
453
+ ></pkt-icon>` : p}
454
454
  ${!this.hidePicker && !this.stepArrows ? u`
455
455
  <button
456
456
  ${_(this.buttonRef)}
457
457
  class="pkt-input-icon pkt-btn pkt-btn--icon-only pkt-btn--tertiary pkt-timepicker__button"
458
458
  type="button"
459
- aria-label=${(($ = this.strings.timepicker) == null ? void 0 : $.openPicker) ?? "Åpne tidspunkt-velger"}
459
+ aria-label=${((y = this.strings.timepicker) == null ? void 0 : y.openPicker) ?? "Åpne tidspunkt-velger"}
460
460
  aria-haspopup="listbox"
461
461
  aria-expanded=${this._isOpen ? "true" : "false"}
462
462
  aria-controls=${this.id + "-popup"}
@@ -465,24 +465,24 @@ let h = class extends F {
465
465
  >
466
466
  <pkt-icon name="clock"></pkt-icon>
467
467
  <span class="pkt-btn__text"
468
- >${((y = this.strings.timepicker) == null ? void 0 : y.openPicker) ?? "Åpne tidspunkt-velger"}</span
468
+ >${((S = this.strings.timepicker) == null ? void 0 : S.openPicker) ?? "Åpne tidspunkt-velger"}</span
469
469
  >
470
470
  </button>
471
- ` : o}
471
+ ` : p}
472
472
  ${this.stepArrows ? u`
473
473
  <button
474
474
  class="pkt-input-icon pkt-btn pkt-btn--icon-only pkt-btn--tertiary pkt-timepicker__button pkt-timepicker__button--next"
475
475
  type="button"
476
- aria-label=${((S = this.strings.timepicker) == null ? void 0 : S.nextTime) ?? "Neste tidspunkt"}
476
+ aria-label=${((D = this.strings.timepicker) == null ? void 0 : D.nextTime) ?? "Neste tidspunkt"}
477
477
  ?disabled=${this.disabled}
478
478
  @click=${() => this._stepTime(1)}
479
479
  >
480
480
  <pkt-icon name="chevron-thin-right"></pkt-icon>
481
481
  <span class="pkt-btn__text"
482
- >${((D = this.strings.timepicker) == null ? void 0 : D.nextTime) ?? "Neste tidspunkt"}</span
482
+ >${((w = this.strings.timepicker) == null ? void 0 : w.nextTime) ?? "Neste tidspunkt"}</span
483
483
  >
484
484
  </button>
485
- ` : o}
485
+ ` : p}
486
486
  <input
487
487
  ${_(this.hiddenInputRef)}
488
488
  type="time"
@@ -490,9 +490,9 @@ let h = class extends F {
490
490
  name=${this.name || this.id}
491
491
  id=${this.id + "-input"}
492
492
  .value=${this.value}
493
- min=${f(this.min ?? void 0)}
494
- max=${f(this.max ?? void 0)}
495
- step=${f(this.step ?? void 0)}
493
+ min=${k(this.min ?? void 0)}
494
+ max=${k(this.max ?? void 0)}
495
+ step=${k(this.step ?? void 0)}
496
496
  ?required=${this.required}
497
497
  ?disabled=${this.disabled}
498
498
  tabindex="-1"
@@ -522,7 +522,7 @@ let h = class extends F {
522
522
  .requiredText=${this.requiredText}
523
523
  .tagText=${this.tagText}
524
524
  >
525
- <div class="pkt-contents" slot="helptext">${A(this, "helptext")}</div>
525
+ <div class="pkt-contents" slot="helptext">${C(this, "helptext")}</div>
526
526
  ${!this.hidePicker && !this.stepArrows ? u`
527
527
  <div class="pkt-timepicker__anchor">
528
528
  ${this._renderContainer()} ${this._renderPopup()}
@@ -531,28 +531,30 @@ let h = class extends F {
531
531
  </pkt-input-wrapper>
532
532
  `;
533
533
  }
534
- };
535
- c([
534
+ }
535
+ d([
536
536
  b({ type: String, reflect: !0 })
537
- ], h.prototype, "value", 2);
538
- c([
537
+ ], l.prototype, "value");
538
+ d([
539
539
  b({ type: Boolean, reflect: !0, attribute: "hide-picker" })
540
- ], h.prototype, "hidePicker", 2);
541
- c([
540
+ ], l.prototype, "hidePicker");
541
+ d([
542
542
  b({ type: Boolean, reflect: !0, attribute: "step-arrows" })
543
- ], h.prototype, "stepArrows", 2);
544
- c([
543
+ ], l.prototype, "stepArrows");
544
+ d([
545
545
  v()
546
- ], h.prototype, "_hours", 2);
547
- c([
546
+ ], l.prototype, "_hours");
547
+ d([
548
548
  v()
549
- ], h.prototype, "_minutes", 2);
550
- c([
549
+ ], l.prototype, "_minutes");
550
+ d([
551
551
  v()
552
- ], h.prototype, "_isOpen", 2);
553
- h = c([
554
- x("pkt-timepicker")
555
- ], h);
552
+ ], l.prototype, "_isOpen");
553
+ try {
554
+ I("pkt-timepicker")(l);
555
+ } catch {
556
+ console.warn("Forsøker å definere <pkt-timepicker>, men den er allerede definert");
557
+ }
556
558
  export {
557
- h as PktTimepicker
559
+ l as PktTimepicker
558
560
  };
@@ -0,0 +1,21 @@
1
+ "use strict";const p=require("./class-map-CsENJXf1.cjs"),e=require("./element-gR_VtSiD.cjs"),h=require("./state-Dg-53wQ8.cjs"),d=require("./ref-CL-Xk9Xm.cjs"),b=require("./directive-C7oCP5Bh.cjs"),c=require("./utils-byXsEz1u.cjs");require("./icon-q81vqPK_.cjs");/**
2
+ * @license
3
+ * Copyright 2018 Google LLC
4
+ * SPDX-License-Identifier: BSD-3-Clause
5
+ */const y="important",m=" !"+y,_=b.e(class extends b.i{constructor(n){var t;if(super(n),n.type!==b.t.ATTRIBUTE||n.name!=="style"||((t=n.strings)==null?void 0:t.length)>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(n){return Object.keys(n).reduce((t,s)=>{const a=n[s];return a==null?t:t+`${s=s.includes("-")?s:s.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${a};`},"")}update(n,[t]){const{style:s}=n.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(t)),this.render(t);for(const a of this.ft)t[a]==null&&(this.ft.delete(a),a.includes("-")?s.removeProperty(a):s[a]=null);for(const a in t){const l=t[a];if(l!=null){this.ft.add(a);const u=typeof l=="string"&&l.endsWith(m);a.includes("-")||u?s.setProperty(a,u?l.slice(0,-11):l,u?y:""):s[a]=l}}return e.E}});var A=Object.defineProperty,i=(n,t,s,a)=>{for(var l=void 0,u=n.length-1,o;u>=0;u--)(o=n[u])&&(l=o(t,s,l)||l);return l&&A(t,s,l),l};class r extends e.PktElement{constructor(){super(),this.ariaLabel=null,this.ariaLabelledby=null,this.ariaValueText=null,this.ariaLive="polite",this.id=c.uuidish(),this.role="progressbar",this.skin="dark-blue",this.statusPlacement="following",this.statusType="none",this.title="",this.titlePosition="left",this.valueCurrent=0,this.valueMax=100,this.valueMin=0,this.labelWidth=0,this.progressbarId=this.id,this.computedAriaLabelledby=null,this.computedAriaValueText="",this.labelRef=d.e(),this.progressBarRef=d.e()}firstUpdated(t){super.firstUpdated(t),this.setComputedValues(),this.syncAttributes()}updated(t){super.updated(t),t.has("valueCurrent")&&this.labelRef.value&&(this.labelWidth=this.labelRef.value.getBoundingClientRect().width||0),t.has("id")&&this.id&&(this.progressBarId=this.id),(t.has("statusType")||t.has("id")||t.has("ariaLabelledby"))&&(this.progressbarId=this.id||c.uuidish(),this.computedAriaLabelledby=this.ariaLabelledby||`${this.progressbarId}-title`),(t.has("ariaValueText")||t.has("valueCurrent")||t.has("valueMax"))&&(this.computedAriaValueText=this.statusType==="fraction"&&!this.ariaValueText?`${this.valueCurrent} av ${this.valueMax-this.valueMin}`:this.ariaValueText||""),this.syncAttributes()}render(){const t=this.statusType!=="none",s=this.valueMax-this.valueMin,a=this.valueCurrent/s*100,l=this.statusType==="fraction"?Math.round(a):Math.round((this.valueCurrent-this.valueMin)/(this.valueMax-this.valueMin)*100),u=`${this.valueCurrent} av ${s}`,o=p.e({"pkt-progressbar__bar":!0,[`pkt-progressbar__bar--${this.skin}`]:!!this.skin}),v=p.e({"pkt-progressbar__title":!0,"pkt-progressbar__title-center":this.titlePosition==="center"}),f=p.e({"pkt-progressbar__status":!0,"pkt-progressbar__status--center":this.statusPlacement==="center"}),g=p.e({"pkt-progressbar__status-placement--following":this.statusPlacement==="following","pkt-progressbar__status-placement--center":this.statusPlacement==="center","pkt-progressbar__status-placement--left":this.statusPlacement==="left"});return e.b` <div
6
+ class="pkt-progressbar__container"
7
+ .ref=${this.progressBarRef}
8
+ style=${_({"--pkt-progress-label-width":`${this.labelWidth}px`,"--pkt-progress-width":`${l}%`})}
9
+ >
10
+ ${this.title?e.b`<p id=${`${this.progressBarId}-title`} class=${v}>${this.title}</p>`:e.A}
11
+
12
+ <div class="pkt-progressbar__bar-wrapper">
13
+ <div class=${o}></div>
14
+ </div>
15
+
16
+ ${t?e.b`<div class=${f}>
17
+ <span class=${g} ${d.n(this.labelRef)}>
18
+ ${this.statusType==="percentage"?`${l}%`:u}
19
+ </span>
20
+ </div>`:e.A}
21
+ </div>`}setComputedValues(){this.progressbarId=this.id||c.uuidish(),this.computedAriaLabelledby=this.ariaLabelledby||`${this.progressbarId}-title`,this.computedAriaValueText=this.statusType==="fraction"&&!this.ariaValueText?`${this.valueCurrent} av ${this.valueMax-this.valueMin}`:this.ariaValueText||""}syncAttributes(){this._handleAttribute("aria-live",this.ariaLive),this._handleAttribute("aria-valuenow",this.valueCurrent),this._handleAttribute("aria-valuemin",this.valueMin),this._handleAttribute("aria-valuemax",this.valueMax),this._handleAttribute("aria-valuetext",this.computedAriaValueText),this._handleAttribute("aria-label",this.ariaLabel),this._handleAttribute("role",this.role),this._handleAttribute("aria-atomic","true"),this._handleAttribute("id",this.progressbarId),this.ariaLabel||this._handleAttribute("aria-labelledby",this.computedAriaLabelledby)}_handleAttribute(t,s){s==null||s===""?this.removeAttribute(t):this.setAttribute(t,String(s))}}i([e.n({type:String})],r.prototype,"ariaLabel");i([e.n({type:String,reflect:!0})],r.prototype,"ariaLabelledby");i([e.n({type:String,reflect:!0})],r.prototype,"ariaValueText");i([e.n({type:String})],r.prototype,"ariaLive");i([e.n({type:String,reflect:!0})],r.prototype,"id");i([e.n({type:String})],r.prototype,"role");i([e.n({type:String})],r.prototype,"skin");i([e.n({type:String})],r.prototype,"statusPlacement");i([e.n({type:String})],r.prototype,"statusType");i([e.n({type:String,reflect:!0})],r.prototype,"title");i([e.n({type:String})],r.prototype,"titlePosition");i([e.n({type:Number,reflect:!0})],r.prototype,"valueCurrent");i([e.n({type:Number})],r.prototype,"valueMax");i([e.n({type:Number})],r.prototype,"valueMin");i([h.r()],r.prototype,"labelWidth");i([h.r()],r.prototype,"progressbarId");i([h.r()],r.prototype,"computedAriaLabelledby");i([h.r()],r.prototype,"computedAriaValueText");try{e.t("pkt-progressbar")(r)}catch{console.warn("Forsøker å definere <pkt-progressbar>, men den er allerede definert")}exports.PktProgressbar=r;