@oslokommune/punkt-elements 16.7.3 → 16.7.4

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 (248) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/accordion-BB1JrONI.cjs +34 -0
  3. package/dist/accordion-nNH87Y60.js +130 -0
  4. package/dist/alert-BEEnTiCb.cjs +33 -0
  5. package/dist/alert-ePJuDtmm.js +171 -0
  6. package/dist/async-directive-B9P1Qa0k.cjs +1 -0
  7. package/dist/async-directive-CaQiqjyV.js +55 -0
  8. package/dist/backlink-Ba03LlbB.cjs +13 -0
  9. package/dist/backlink-CiwXrQYD.js +38 -0
  10. package/dist/booleanish-BmcOU-43.js +11 -0
  11. package/dist/booleanish-jJLlnr6-.cjs +1 -0
  12. package/dist/breadcrumbs-CD1zib3s.cjs +43 -0
  13. package/dist/breadcrumbs-CpuVqWhF.js +76 -0
  14. package/dist/button-BIpd1xJh.js +95 -0
  15. package/dist/button-D-TOBaJB.cjs +27 -0
  16. package/dist/calendar-BzEtOJla.js +2031 -0
  17. package/dist/calendar-E5jJLt8D.cjs +90 -0
  18. package/dist/card-BYJu1MYm.js +339 -0
  19. package/dist/card-CUFhMVim.cjs +87 -0
  20. package/dist/checkbox-BARDb9iV.cjs +31 -0
  21. package/dist/checkbox-Cspxcvt_.js +111 -0
  22. package/dist/class-map-C8HuhNzZ.js +27 -0
  23. package/dist/class-map-CJ-msbHs.cjs +1 -0
  24. package/dist/classutils-DEL164Ur.js +7 -0
  25. package/dist/classutils-z8YsPlOf.cjs +1 -0
  26. package/dist/combobox-BcdLZRDU.js +984 -0
  27. package/dist/combobox-CGbFTWq_.cjs +135 -0
  28. package/dist/consent-DeB_5sWH.js +197 -0
  29. package/dist/consent-hwu7pp3S.cjs +11 -0
  30. package/dist/datepicker-DpmlsnH_.cjs +273 -0
  31. package/dist/datepicker-OVd8pmnZ.js +1125 -0
  32. package/dist/dialog-polyfill.esm-1hPr0gl9.js +280 -0
  33. package/dist/dialog-polyfill.esm-D3Oinvk0.cjs +1 -0
  34. package/dist/directive-3THFsVew.js +28 -0
  35. package/dist/directive-CJ2giQBZ.cjs +1 -0
  36. package/dist/directive-helpers-D1QSxY17.cjs +1 -0
  37. package/dist/directive-helpers-Dkv2gKgs.js +25 -0
  38. package/dist/element-DjtxO-1r.cjs +2 -0
  39. package/dist/element-cZ85T_aa.js +693 -0
  40. package/dist/element-with-slot-4J2o3SeU.js +166 -0
  41. package/dist/element-with-slot-CWoTGA1B.cjs +1 -0
  42. package/dist/header-DWgPgGfS.cjs +304 -0
  43. package/dist/header-a6ztVNp3.js +782 -0
  44. package/dist/heading-BgSWIRii.cjs +1 -0
  45. package/dist/heading-DiQLPxdf.js +73 -0
  46. package/dist/helptext-CCBKKLus.js +65 -0
  47. package/dist/helptext-D-3QfZv5.cjs +24 -0
  48. package/dist/icon-Co72KtgF.js +86 -0
  49. package/dist/icon-Dr8sfT2X.cjs +1 -0
  50. package/dist/if-defined-Cjj8qN-Z.js +5 -0
  51. package/dist/if-defined-XKOD_t_V.cjs +1 -0
  52. package/dist/index.d.ts +1 -2
  53. package/dist/input-element-B1yxcfz4.cjs +1 -0
  54. package/dist/input-element-Bw1s6NlF.js +643 -0
  55. package/dist/input-wrapper-BRuVELpK.cjs +54 -0
  56. package/dist/input-wrapper-CDyHTR1V.js +164 -0
  57. package/dist/input-wrapper-Dwd-_sKm.cjs +1 -0
  58. package/dist/input-wrapper-YfTmpSSY.js +117 -0
  59. package/dist/link-CKAFMz9j.js +89 -0
  60. package/dist/link-CyTCpI0k.cjs +7 -0
  61. package/dist/linkcard-B0KOGaGj.js +55 -0
  62. package/dist/linkcard-BE4-FewK.cjs +13 -0
  63. package/dist/listbox-DCA2JoPV.cjs +106 -0
  64. package/dist/listbox-DuBgTFvH.js +397 -0
  65. package/dist/loader-6kFZUErT.js +66 -0
  66. package/dist/loader-CX2rsC01.cjs +16 -0
  67. package/dist/messagebox-Cwlg5sOr.js +110 -0
  68. package/dist/messagebox-Din9X53b.cjs +13 -0
  69. package/dist/modal-C_wtsh9m.js +209 -0
  70. package/dist/modal-DS_wUOIv.cjs +36 -0
  71. package/dist/pkt-accordion.cjs +1 -1
  72. package/dist/pkt-accordion.js +2 -7
  73. package/dist/pkt-alert.cjs +1 -1
  74. package/dist/pkt-alert.js +2 -5
  75. package/dist/pkt-backlink.cjs +1 -1
  76. package/dist/pkt-backlink.js +2 -5
  77. package/dist/pkt-breadcrumbs.cjs +1 -43
  78. package/dist/pkt-breadcrumbs.js +2 -81
  79. package/dist/pkt-button.cjs +1 -1
  80. package/dist/pkt-button.js +2 -5
  81. package/dist/pkt-calendar.cjs +1 -1
  82. package/dist/pkt-calendar.js +2 -5
  83. package/dist/pkt-card.cjs +1 -1
  84. package/dist/pkt-card.js +2 -5
  85. package/dist/pkt-checkbox.cjs +1 -1
  86. package/dist/pkt-checkbox.js +2 -5
  87. package/dist/pkt-combobox.cjs +1 -1
  88. package/dist/pkt-combobox.js +2 -5
  89. package/dist/pkt-consent.cjs +1 -1
  90. package/dist/pkt-consent.js +2 -5
  91. package/dist/pkt-datepicker.cjs +1 -1
  92. package/dist/pkt-datepicker.js +5 -9
  93. package/dist/pkt-header.cjs +1 -304
  94. package/dist/pkt-header.js +2 -861
  95. package/dist/pkt-heading.cjs +1 -1
  96. package/dist/pkt-heading.js +2 -5
  97. package/dist/pkt-helptext.cjs +1 -1
  98. package/dist/pkt-helptext.js +2 -5
  99. package/dist/pkt-icon.cjs +1 -1
  100. package/dist/pkt-icon.js +2 -5
  101. package/dist/pkt-index.cjs +1 -1
  102. package/dist/pkt-index.js +30 -66
  103. package/dist/pkt-input-wrapper.cjs +1 -1
  104. package/dist/pkt-input-wrapper.js +2 -5
  105. package/dist/pkt-link.cjs +1 -1
  106. package/dist/pkt-link.js +2 -5
  107. package/dist/pkt-linkcard.cjs +1 -1
  108. package/dist/pkt-linkcard.js +2 -5
  109. package/dist/pkt-listbox.cjs +1 -1
  110. package/dist/pkt-listbox.js +2 -5
  111. package/dist/pkt-loader.cjs +1 -1
  112. package/dist/pkt-loader.js +2 -5
  113. package/dist/pkt-messagebox.cjs +1 -1
  114. package/dist/pkt-messagebox.js +2 -5
  115. package/dist/pkt-modal.cjs +1 -1
  116. package/dist/pkt-modal.js +2 -5
  117. package/dist/pkt-options-controller-CRrI6WMk.js +43 -0
  118. package/dist/pkt-options-controller-CXUGx134.cjs +1 -0
  119. package/dist/pkt-progressbar.cjs +1 -1
  120. package/dist/pkt-progressbar.js +2 -5
  121. package/dist/pkt-radiobutton.cjs +1 -1
  122. package/dist/pkt-radiobutton.js +2 -5
  123. package/dist/pkt-select.cjs +1 -1
  124. package/dist/pkt-select.js +2 -5
  125. package/dist/pkt-tabs.cjs +1 -1
  126. package/dist/pkt-tabs.js +2 -7
  127. package/dist/pkt-tag.cjs +1 -1
  128. package/dist/pkt-tag.js +2 -5
  129. package/dist/pkt-textarea.cjs +1 -1
  130. package/dist/pkt-textarea.js +2 -5
  131. package/dist/pkt-textinput.cjs +1 -1
  132. package/dist/pkt-textinput.js +2 -5
  133. package/dist/pkt-timepicker.cjs +1 -191
  134. package/dist/pkt-timepicker.js +2 -560
  135. package/dist/progressbar-CdXtmOBb.cjs +17 -0
  136. package/dist/progressbar-Dy9AiYQz.js +113 -0
  137. package/dist/radiobutton-GOnpUbCW.cjs +31 -0
  138. package/dist/radiobutton-V_KPbup_.js +84 -0
  139. package/dist/ref-BaJ0mBT_.cjs +1 -0
  140. package/dist/ref-RS8Uv6uC.js +30 -0
  141. package/dist/repeat-Cepr3469.js +57 -0
  142. package/dist/repeat-CqcDYBxr.cjs +1 -0
  143. package/dist/select-BSAFd8Wa.js +164 -0
  144. package/dist/select-C2i8sOk5.cjs +49 -0
  145. package/dist/tabs-D8nL9rWx.cjs +37 -0
  146. package/dist/tabs-Y7utmJi9.js +318 -0
  147. package/dist/tag-DLthw5b4.cjs +27 -0
  148. package/dist/tag-VwykmuQR.js +179 -0
  149. package/dist/textarea-D7aGOyDf.cjs +46 -0
  150. package/dist/textarea-DYOBhJrN.js +115 -0
  151. package/dist/textinput-BUgntXnM.js +124 -0
  152. package/dist/textinput-DFh8_9cx.cjs +70 -0
  153. package/dist/timepicker-BIfE7KKJ.cjs +191 -0
  154. package/dist/timepicker-DaSwn1FA.js +503 -0
  155. package/dist/utils-CUqCKGvp.js +7 -0
  156. package/dist/utils-CjAbIttF.cjs +1 -0
  157. package/package.json +6 -6
  158. package/src/components/alert/alert.test.ts +1 -1
  159. package/src/components/alert/alert.ts +6 -6
  160. package/src/components/datepicker/datepicker-utils.test.ts +16 -23
  161. package/dist/accordionitem-_9AiCIvd.cjs +0 -34
  162. package/dist/accordionitem-dCfSrxh5.js +0 -140
  163. package/dist/alert-BtOk8yRH.cjs +0 -33
  164. package/dist/alert-DlY2_grU.js +0 -117
  165. package/dist/async-directive-CMzWMlZ5.js +0 -65
  166. package/dist/async-directive-DoMuclel.cjs +0 -5
  167. package/dist/backlink-Ce5Vldop.js +0 -49
  168. package/dist/backlink-y3dwjKPC.cjs +0 -13
  169. package/dist/booleanish-BKVonob4.cjs +0 -1
  170. package/dist/booleanish-C9R0tdXH.js +0 -11
  171. package/dist/button-B_TXwNzt.cjs +0 -27
  172. package/dist/button-BiY-wlKF.js +0 -139
  173. package/dist/calendar-B2pji2zn.cjs +0 -90
  174. package/dist/calendar-DhjQDC4C.js +0 -2140
  175. package/dist/card-BwMNB5Bb.cjs +0 -87
  176. package/dist/card-CGlmcMSR.js +0 -233
  177. package/dist/checkbox-BsJZYA26.js +0 -147
  178. package/dist/checkbox-CTY8f_qn.cjs +0 -31
  179. package/dist/class-map-CEnykyO_.js +0 -34
  180. package/dist/class-map-CsENJXf1.cjs +0 -5
  181. package/dist/classutils-BwNK82ZQ.cjs +0 -1
  182. package/dist/classutils-RQs1k6D9.js +0 -7
  183. package/dist/combobox-DSB5WOxg.js +0 -815
  184. package/dist/combobox-DbICIgKG.cjs +0 -135
  185. package/dist/consent-DkOQpbsg.cjs +0 -11
  186. package/dist/consent-SNWV_mMU.js +0 -175
  187. package/dist/datepicker-BEWl9iz3.cjs +0 -273
  188. package/dist/datepicker-euHyzXnb.js +0 -1170
  189. package/dist/dialog-polyfill.esm-CPKZe7AL.cjs +0 -1
  190. package/dist/dialog-polyfill.esm-CbjBMXAG.js +0 -395
  191. package/dist/directive-C7oCP5Bh.cjs +0 -5
  192. package/dist/directive-helpers-BP2WOx60.cjs +0 -5
  193. package/dist/directive-helpers-rm-28gIj.js +0 -38
  194. package/dist/directive-oAbCiebi.js +0 -27
  195. package/dist/element-CPpT3rFQ.js +0 -638
  196. package/dist/element-gR_VtSiD.cjs +0 -27
  197. package/dist/element-with-slot-Dqk6-TRR.js +0 -240
  198. package/dist/element-with-slot-ZX-up7jO.cjs +0 -1
  199. package/dist/heading-D2tVS6lS.js +0 -103
  200. package/dist/heading-DrzbgDb6.cjs +0 -1
  201. package/dist/helptext-BKtU4mas.js +0 -82
  202. package/dist/helptext-DcRC7wW2.cjs +0 -24
  203. package/dist/icon-CxQcIa5F.js +0 -105
  204. package/dist/icon-q81vqPK_.cjs +0 -9
  205. package/dist/if-defined-B0krMLad.js +0 -10
  206. package/dist/if-defined-BOW3ODSj.cjs +0 -5
  207. package/dist/input-element-8nLwuQS4.js +0 -837
  208. package/dist/input-element-DdVhUvva.cjs +0 -1
  209. package/dist/input-wrapper-Bs4CRNst.js +0 -181
  210. package/dist/input-wrapper-Bv9aqqVq.cjs +0 -54
  211. package/dist/input-wrapper-CDgenrYA.js +0 -6
  212. package/dist/input-wrapper-EoSAbU-U.cjs +0 -1
  213. package/dist/link-C0rl-86s.cjs +0 -7
  214. package/dist/link-Cdqgl60z.js +0 -55
  215. package/dist/linkcard-Dimu7Rlx.cjs +0 -13
  216. package/dist/linkcard-Lbq_UhjZ.js +0 -56
  217. package/dist/listbox-Bia4_tvN.js +0 -440
  218. package/dist/listbox-La2GZQei.cjs +0 -106
  219. package/dist/loader-D1ugDXGV.cjs +0 -16
  220. package/dist/loader-DyN6RGC5.js +0 -95
  221. package/dist/messagebox-BGMVm2t9.js +0 -71
  222. package/dist/messagebox-M0yIgCz9.cjs +0 -13
  223. package/dist/modal-CMO1RtIi.cjs +0 -36
  224. package/dist/modal-DjPQDE-Z.js +0 -156
  225. package/dist/pkt-options-controller-5LXbEzuk.cjs +0 -1
  226. package/dist/pkt-options-controller-B5YalfCb.js +0 -39
  227. package/dist/progressbar-BqlMzkM_.cjs +0 -21
  228. package/dist/progressbar-sbHDFC12.js +0 -162
  229. package/dist/radiobutton-5ZqVVtTT.cjs +0 -31
  230. package/dist/radiobutton-D8Ai8ETa.js +0 -113
  231. package/dist/ref-Bg_Swj5w.js +0 -42
  232. package/dist/ref-CL-Xk9Xm.cjs +0 -5
  233. package/dist/repeat-BD8TKgJb.js +0 -61
  234. package/dist/repeat-Cfq8CDlf.cjs +0 -5
  235. package/dist/select-De-n8on9.js +0 -230
  236. package/dist/select-dTWibR6_.cjs +0 -49
  237. package/dist/state-C_1EOo3D.js +0 -12
  238. package/dist/state-Dg-53wQ8.cjs +0 -5
  239. package/dist/tabitem-B9-jeV97.js +0 -334
  240. package/dist/tabitem-BnhzqfW3.cjs +0 -65
  241. package/dist/tag-CbwO8yvD.cjs +0 -27
  242. package/dist/tag-D4FI5t3y.js +0 -117
  243. package/dist/textarea-BmLaKzsc.cjs +0 -50
  244. package/dist/textarea-CMiSJaYL.js +0 -133
  245. package/dist/textinput-em9y4yrL.cjs +0 -70
  246. package/dist/textinput-r8udK0IX.js +0 -152
  247. package/dist/utils-DznhwRXm.js +0 -8
  248. package/dist/utils-byXsEz1u.cjs +0 -1
@@ -0,0 +1,1125 @@
1
+ import { c as e, d as t, l as n, o as r, r as i, s as a, t as o } from "./element-cZ85T_aa.js";
2
+ import { t as s } from "./class-map-C8HuhNzZ.js";
3
+ import { n as c } from "./element-with-slot-4J2o3SeU.js";
4
+ import "./icon-Co72KtgF.js";
5
+ import { t as l } from "./if-defined-Cjj8qN-Z.js";
6
+ import { n as u, t as d } from "./ref-RS8Uv6uC.js";
7
+ import { a as f, c as p, d as m, f as h, i as g, l as _, o as v, p as y, r as b, s as x, u as S } from "./calendar-BzEtOJla.js";
8
+ import "./tag-VwykmuQR.js";
9
+ import { t as C } from "./repeat-Cepr3469.js";
10
+ import { n as w, t as T } from "./utils-CUqCKGvp.js";
11
+ import { t as E } from "./input-element-Bw1s6NlF.js";
12
+ import "./input-wrapper-YfTmpSSY.js";
13
+ //#region ../../shared-types/datepicker.ts
14
+ var D = { calendar: { buttonAltText: "Åpne kalender" } }, O = {
15
+ calendar: { buttonAltText: "Åpne kalender" },
16
+ generic: {
17
+ from: "Fra",
18
+ to: "Til"
19
+ }
20
+ }, k = class extends o {
21
+ constructor(...e) {
22
+ super(...e), this.dates = [], this.dateformat = "dd.MM.yyyy", this.className = "pkt-datepicker__tags", this.idBase = w();
23
+ }
24
+ render() {
25
+ return this.classes = {
26
+ "pkt-date-tags": !0,
27
+ [this.className]: !0
28
+ }, t`
29
+ <div class=${s(this.classes)} aria-live="polite">
30
+ ${Array.isArray(this.dates) && this.dates[0] ? C(y((this.dates ?? []).filter(Boolean)), (e) => e, (e) => t` <pkt-tag
31
+ id=${this.idBase + e + "-tag"}
32
+ closeTag
33
+ @close=${() => {
34
+ this.dispatchEvent(new CustomEvent("date-tag-removed", { detail: e }));
35
+ }}
36
+ .ariaLabel=${`${this.strings?.calendar.deleteDate} ${_(e, this.dateformat)}`}
37
+ >
38
+ <time datetime=${e}>${_(e, this.dateformat)}</time>
39
+ </pkt-tag>`) : n}
40
+ </div>
41
+ `;
42
+ }
43
+ };
44
+ i([a({ type: Array })], k.prototype, "dates", void 0), i([a({ type: String })], k.prototype, "dateformat", void 0), i([a({
45
+ type: String,
46
+ attribute: "class"
47
+ })], k.prototype, "className", void 0), i([a({
48
+ type: String,
49
+ attribute: "id-base"
50
+ })], k.prototype, "idBase", void 0);
51
+ try {
52
+ e("pkt-date-tags")(k);
53
+ } catch {
54
+ console.warn("Forsøker å definere <pkt-date-tags>, men den er allerede definert");
55
+ }
56
+ var A = {
57
+ name: "pkt-datepicker",
58
+ react: "PktDatepicker",
59
+ "css-class": "pkt-datepicker",
60
+ isElement: !0,
61
+ isPureReact: !0,
62
+ "dark-mode": !0,
63
+ props: {
64
+ name: {
65
+ type: "string",
66
+ name: "Navn for innsending",
67
+ category: "tech"
68
+ },
69
+ label: {
70
+ type: "string",
71
+ name: "Tekst/label",
72
+ category: "contents"
73
+ },
74
+ helptext: {
75
+ type: "string",
76
+ name: "Hjelpetekst",
77
+ category: "contents"
78
+ },
79
+ helptextDropdown: {
80
+ type: "string",
81
+ name: "Utvidet hjelpetekst",
82
+ description: "Hjelpetekst som vises i en lukket boks man kan åpne",
83
+ category: "contents"
84
+ },
85
+ helptextDropdownButton: {
86
+ type: "string",
87
+ name: "Knappetekst for utvidet hjelpetekst",
88
+ default: "Les mer",
89
+ category: "contents"
90
+ },
91
+ dateformat: {
92
+ name: "Datoformat for tags i flervalg",
93
+ type: "string",
94
+ default: "dd.MM.yyyy",
95
+ category: "tech"
96
+ },
97
+ currentmonth: {
98
+ name: "Måned som vises i datovelgeren",
99
+ type: "ISOdatestring",
100
+ category: "tech"
101
+ },
102
+ value: {
103
+ name: "Verdi (kommaseparert ved flervalg)",
104
+ type: "ISOdatestring",
105
+ variant: "multiple",
106
+ category: "tech"
107
+ },
108
+ excludeweekdays: {
109
+ name: "Utelat ukedager",
110
+ type: "string",
111
+ description: "Kommaseparert liste over ukedager (1-7) som skal ekskluderes",
112
+ category: "functionality"
113
+ },
114
+ excludedates: {
115
+ name: "Utelat datoer (Kommaseparerte ISO-datoer)",
116
+ type: "ISOdatestring",
117
+ variant: "multiple",
118
+ category: "functionality"
119
+ },
120
+ min: {
121
+ name: "Tidligst tillatte dato",
122
+ type: "ISOdatestring",
123
+ default: null,
124
+ category: "functionality"
125
+ },
126
+ max: {
127
+ name: "Senest tillatte dato",
128
+ type: "ISOdatestring",
129
+ default: null,
130
+ category: "functionality"
131
+ },
132
+ weeknumbers: {
133
+ name: "Vis ukenummer",
134
+ type: "boolean",
135
+ reflect: !0,
136
+ default: !1,
137
+ category: "ui"
138
+ },
139
+ withcontrols: {
140
+ name: "Med velgere for måned/år",
141
+ type: "boolean",
142
+ reflect: !0,
143
+ default: !1,
144
+ category: "ui"
145
+ },
146
+ multiple: {
147
+ name: "Flervalg",
148
+ type: "boolean",
149
+ reflect: !0,
150
+ default: !1,
151
+ category: "functionality"
152
+ },
153
+ maxlength: {
154
+ name: "Maks antall datoer i flervalg",
155
+ type: "number",
156
+ category: "functionality",
157
+ showIf: { multiple: !0 }
158
+ },
159
+ range: {
160
+ name: "Datotidsrom (fra og til)",
161
+ type: "boolean",
162
+ reflect: !0,
163
+ default: !1,
164
+ category: "functionality"
165
+ },
166
+ showRangeLabels: {
167
+ attribute: "show-range-labels",
168
+ name: "Vis fra/til-etiketter",
169
+ type: "boolean",
170
+ default: !1,
171
+ category: "ui",
172
+ showIf: { range: !0 }
173
+ },
174
+ today: {
175
+ name: "Dagens dato (overstyring)",
176
+ type: "ISOdatestring",
177
+ description: "ISO-datostreng som overstyrer dagens dato i kalenderen. Nyttig for snapshot-tester.",
178
+ category: "tech"
179
+ },
180
+ calendarOpen: {
181
+ attribute: "calendar-open",
182
+ name: "Kalender åpen",
183
+ type: "boolean",
184
+ reflect: !0,
185
+ default: !1,
186
+ category: "ui"
187
+ },
188
+ hasError: {
189
+ type: "boolean",
190
+ name: "Feil",
191
+ default: !1,
192
+ category: "ui"
193
+ },
194
+ errorMessage: {
195
+ type: "string",
196
+ name: "Feilmelding ved feil",
197
+ category: "contents"
198
+ },
199
+ disabled: {
200
+ type: "boolean",
201
+ name: "Deaktivert",
202
+ default: !1,
203
+ reflect: !0,
204
+ category: "tech"
205
+ },
206
+ fullwidth: {
207
+ type: "boolean",
208
+ name: "Full bredde",
209
+ default: !1,
210
+ reflect: !0,
211
+ category: "ui"
212
+ },
213
+ required: {
214
+ type: "boolean",
215
+ name: "Påkrevd",
216
+ default: !1,
217
+ reflect: !0,
218
+ category: "tech"
219
+ },
220
+ requiredTag: {
221
+ type: "boolean",
222
+ name: "Vise påkrevd-merking",
223
+ default: !1,
224
+ category: "ui"
225
+ },
226
+ requiredText: {
227
+ type: "string",
228
+ name: "Påkrevd-tekst",
229
+ default: "Må fylles ut",
230
+ category: "contents"
231
+ },
232
+ optionalTag: {
233
+ type: "boolean",
234
+ name: "Vise valgfritt-merking",
235
+ default: !1,
236
+ category: "ui"
237
+ },
238
+ optionalText: {
239
+ type: "string",
240
+ name: "Valgfritt-tekst",
241
+ default: "Valgfritt",
242
+ category: "contents"
243
+ },
244
+ tagText: {
245
+ type: "string",
246
+ name: "Tag-tekst",
247
+ description: "Tekst som vises i en tag ved siden av label",
248
+ category: "ui"
249
+ },
250
+ useWrapper: {
251
+ type: "boolean",
252
+ name: "Bruk wrapper",
253
+ description: "Indikerer at feltet skal ha synlig label og hjelpetekst",
254
+ displayAsFalse: !0,
255
+ default: !0,
256
+ category: "ui"
257
+ },
258
+ id: {
259
+ type: "string",
260
+ name: "ID",
261
+ description: "Unik identifikasjon for datovelgeren",
262
+ category: "tech"
263
+ },
264
+ ariaDescribedby: {
265
+ attribute: "aria-describedby",
266
+ name: "aria-describedby",
267
+ description: "Spesifiserer ID-en til elementet som beskriver feltet.",
268
+ type: "string",
269
+ category: "accessibility"
270
+ }
271
+ },
272
+ events: {
273
+ change: {
274
+ type: "Event",
275
+ name: "change (Elements)",
276
+ description: "Returnerer valgt dato som streng i ISO-format. I range-modus utløses kun når begge datoer er valgt."
277
+ },
278
+ "value-change": {
279
+ type: "CustomEvent",
280
+ name: "value-change (Elements)",
281
+ description: "Returnerer en <code>array</code> med valgte datoer i ISO-format. I range-modus utløses kun når begge datoer er valgt."
282
+ },
283
+ toggleHelpText: {
284
+ type: "CustomEvent",
285
+ description: "Returnerer <code>event.detail { isOpen: true }</code> eller <code>event.detail { isOpen: false }</code> når hjelpeteksten åpnes eller lukkes"
286
+ },
287
+ onChange: {
288
+ type: "Event",
289
+ name: "onChange (React)",
290
+ reactOnly: !0,
291
+ description: "Utløses når en dato velges. <code>e.target.value</code> inneholder kommaseparerte ISO-datoer. I range-modus utløses kun når begge datoer er valgt."
292
+ },
293
+ onValueChange: {
294
+ type: "string[]",
295
+ name: "onValueChange (React)",
296
+ reactOnly: !0,
297
+ description: "Returnerer en <code>string[]</code> med valgte datoer i ISO-format. I range-modus utløses kun når begge datoer er valgt."
298
+ }
299
+ }
300
+ }, j = () => {
301
+ let e = navigator.userAgent;
302
+ return !!(/iP(hone|od|ad)/.test(e) || /Macintosh/.test(e) && "ontouchend" in document);
303
+ }, M = () => j() ? "text" : "date", N = (e) => !e || e.length !== 2 ? !0 : S(e[0], e[1]), ee = (e) => y(e), te = (e, t, n, r, i) => v(e, t, n, r, i), P = (e, t, n, r, i, a) => ({
304
+ "pkt-input": !0,
305
+ "pkt-datepicker__input": !0,
306
+ "pkt-input--fullwidth": e,
307
+ "pkt-datepicker--hasrangelabels": t,
308
+ "pkt-datepicker--multiple": n,
309
+ "pkt-datepicker--range": r,
310
+ "ios-readonly-hack": i === !1 && a === "text"
311
+ }), F = () => ({
312
+ "pkt-input-icon": !0,
313
+ "pkt-btn": !0,
314
+ "pkt-btn--icon-only": !0,
315
+ "pkt-btn--tertiary": !0,
316
+ "pkt-datepicker__calendar-button": !0
317
+ }), I = (e) => ({
318
+ "pkt-input-prefix": e,
319
+ "pkt-hide": !e
320
+ }), L = (e, t, n) => !t && !n ? Array.isArray(e) ? e[0] || "" : e : Array.isArray(e) ? e.join(",") : e, R = (e, t, n = !1) => {
321
+ if (!e || !t) return;
322
+ let r = t.parentElement?.getBoundingClientRect() || t.getBoundingClientRect(), i = n ? r.height + 30 : r.height, a = e.getBoundingClientRect().height, o = n ? "calc(100% - 30px)" : "100%";
323
+ r && r.top + a > window.innerHeight && r.top - a > 0 && (o = `calc(100% - ${i}px - ${a}px)`), e.style.top = o;
324
+ }, z = (e, t, n, r, i, a) => {
325
+ let { key: o } = e;
326
+ o === "," && (e.preventDefault(), a ? a(e) : i && i()), (o === "Space" || o === " ") && (e.preventDefault(), t(e)), o === "Enter" && (e.preventDefault(), n ? n() : r ? r() : i && i());
327
+ }, B = (e, t) => {
328
+ let { key: n } = e;
329
+ (n === "Enter" || n === " " || n === "Space") && (e.preventDefault(), t(e));
330
+ }, V = {
331
+ validateRangeOrder: N,
332
+ sortDates: ee,
333
+ filterSelectableDates: te
334
+ }, H = { getInputType: M }, U = {
335
+ submitForm(e) {
336
+ let t = e.internals?.form;
337
+ t && t.requestSubmit();
338
+ },
339
+ submitFormOrFallback(e, t) {
340
+ let n = e?.form;
341
+ n ? n.requestSubmit() : t();
342
+ },
343
+ validateDateInput(e, t, n, r, i) {
344
+ let a = e.value;
345
+ a && (n && n > a ? t.setValidity({ rangeUnderflow: !0 }, i?.forms?.messages?.rangeUnderflow || "Value is below minimum", e) : r && r < a && t.setValidity({ rangeOverflow: !0 }, i?.forms?.messages?.rangeOverflow || "Value is above maximum", e));
346
+ }
347
+ }, W = {
348
+ addToSelected(e, t, n, r) {
349
+ let i = e.target;
350
+ if (!i.value) return;
351
+ let a = n ? m(n) : null, o = r ? m(r) : null, s = m(i.value.split(",")[0]);
352
+ s && !isNaN(s.getTime()) && (!a || s >= a) && (!o || s <= o) && t.value && t.value.handleDateSelect(s), i.value = "";
353
+ },
354
+ handleCalendarPosition(e, t, n = !1) {
355
+ R(e.value ?? null, t.value ?? null, n);
356
+ }
357
+ }, G = {
358
+ getInputClasses: P,
359
+ getButtonClasses: F,
360
+ getRangeLabelClasses: I
361
+ }, K = {
362
+ processDateSelection: L,
363
+ updateInputValues(e, t, n, r, i, a) {
364
+ e.value && (r && t?.value ? (e.value.value = n[0] ?? "", t.value.value = n[1] ?? "", a(e.value), a(t.value)) : i || (e.value.value = n.length ? n[0] : "", a(e.value)));
365
+ },
366
+ processRangeBlur(e, t, n, r, i) {
367
+ let a = e.target;
368
+ if (a.value) {
369
+ i(a);
370
+ let e = p(a.value);
371
+ e && n?.value?.handleDateSelect(e);
372
+ } else t[0] && r();
373
+ }
374
+ }, q = {
375
+ handleInputKeydown: z,
376
+ handleButtonKeydown: B
377
+ }, J = class extends o {
378
+ constructor(...e) {
379
+ super(...e), this.open = !1, this.multiple = !1, this.range = !1, this.weeknumbers = !1, this.withcontrols = !1, this.maxMultiple = null, this.selected = [], this.earliest = null, this.latest = null, this.excludedates = [], this.excludeweekdays = [], this.currentmonth = null, this.today = null, this._hasBeenOpened = !1, this.popupRef = d(), this.calendarRef = d(), this.handleDocumentClick = (e) => {
380
+ if (!this.open) return;
381
+ let t = e.composedPath(), n = this.parentElement, r = this.popupRef.value;
382
+ !t.includes(this) && !t.includes(r) && !(n && t.includes(n)) && (this.hide(), this.dispatchEvent(new CustomEvent("close", {
383
+ bubbles: !0,
384
+ composed: !0
385
+ })));
386
+ }, this.handleDocumentKeydown = (e) => {
387
+ this.open && e.key === "Escape" && (this.hide(), this.dispatchEvent(new CustomEvent("close", {
388
+ bubbles: !0,
389
+ composed: !0
390
+ })));
391
+ };
392
+ }
393
+ firstUpdated() {
394
+ this.calRef = this.calendarRef;
395
+ }
396
+ updated(e) {
397
+ super.updated(e), e.has("open") && (this.open ? (this._hasBeenOpened = !0, document.addEventListener("keydown", this.handleDocumentKeydown), document.addEventListener("click", this.handleDocumentClick)) : (document.removeEventListener("click", this.handleDocumentClick), document.removeEventListener("keydown", this.handleDocumentKeydown)));
398
+ }
399
+ disconnectedCallback() {
400
+ super.disconnectedCallback(), document.removeEventListener("click", this.handleDocumentClick), document.removeEventListener("keydown", this.handleDocumentKeydown);
401
+ }
402
+ show() {
403
+ this.open = !0, this.calendarRef.value?.focus();
404
+ }
405
+ hide() {
406
+ this.open = !1;
407
+ }
408
+ toggle() {
409
+ this.open ? this.hide() : this.show();
410
+ }
411
+ contains(e) {
412
+ return !!e && !!this.popupRef.value?.contains(e);
413
+ }
414
+ focusOnCurrentDate() {
415
+ let e = this.calendarRef.value;
416
+ e && typeof e.focusOnCurrentDate == "function" && e.focusOnCurrentDate();
417
+ }
418
+ addToSelected(e, t, n) {
419
+ if (this.calendarRef.value && typeof W.addToSelected == "function") return W.addToSelected(e, this.calendarRef, t, n);
420
+ let r = e.target;
421
+ if (!r.value) return;
422
+ let i = t ? m(t) : null, a = n ? m(n) : null, o = m(r.value.split(",")[0]);
423
+ o && !isNaN(o.getTime()) && (!i || o >= i) && (!a || o <= a) && this.handleDateSelect(o), r.value = "";
424
+ }
425
+ handleDateSelect(e) {
426
+ let t = this.calendarRef.value;
427
+ if (t && typeof t.handleDateSelect == "function") return t.handleDateSelect(e);
428
+ let n = x(e), r = this.selected.indexOf(n) >= 0 ? this.selected.filter((e) => e !== n) : [...this.selected, n];
429
+ this.selected = r, this.dispatchEvent(new CustomEvent("date-selected", {
430
+ detail: r,
431
+ bubbles: !0,
432
+ composed: !0
433
+ }));
434
+ }
435
+ render() {
436
+ return t`
437
+ <div
438
+ class="${s({
439
+ "pkt-calendar-popup": !0,
440
+ show: this.open,
441
+ hide: !this.open
442
+ })}"
443
+ ${u(this.popupRef)}
444
+ id="date-popup"
445
+ ?hidden=${!this.open}
446
+ aria-hidden="${!this.open}"
447
+ >
448
+ ${this.open || this._hasBeenOpened ? t`<pkt-calendar
449
+ ${u(this.calendarRef)}
450
+ ?multiple=${this.multiple}
451
+ ?range=${this.range}
452
+ ?weeknumbers=${this.weeknumbers}
453
+ ?withcontrols=${this.withcontrols}
454
+ .maxMultiple=${this.maxMultiple}
455
+ .selected=${this.selected}
456
+ .earliest=${this.earliest}
457
+ .latest=${this.latest}
458
+ .excludedates=${this.excludedates}
459
+ .excludeweekdays=${this.excludeweekdays}
460
+ .currentmonth=${this.currentmonth}
461
+ .today=${this.today}
462
+ @date-selected=${(e) => {
463
+ this.selected = e.detail, this.dispatchEvent(new CustomEvent("date-selected", {
464
+ detail: e.detail,
465
+ bubbles: !0,
466
+ composed: !0
467
+ }));
468
+ }}
469
+ @close=${() => {
470
+ this.hide(), this.dispatchEvent(new CustomEvent("close", {
471
+ bubbles: !0,
472
+ composed: !0
473
+ }));
474
+ }}
475
+ ></pkt-calendar>` : n}
476
+ </div>
477
+ `;
478
+ }
479
+ };
480
+ i([a({
481
+ type: Boolean,
482
+ reflect: !0
483
+ })], J.prototype, "open", void 0), i([a({ type: Boolean })], J.prototype, "multiple", void 0), i([a({ type: Boolean })], J.prototype, "range", void 0), i([a({ type: Boolean })], J.prototype, "weeknumbers", void 0), i([a({ type: Boolean })], J.prototype, "withcontrols", void 0), i([a({ type: Number })], J.prototype, "maxMultiple", void 0), i([a({ type: Array })], J.prototype, "selected", void 0), i([a({ type: String })], J.prototype, "earliest", void 0), i([a({ type: String })], J.prototype, "latest", void 0), i([a({ type: Array })], J.prototype, "excludedates", void 0), i([a({ type: Array })], J.prototype, "excludeweekdays", void 0), i([a({ type: String })], J.prototype, "currentmonth", void 0), i([a({ type: String })], J.prototype, "today", void 0), i([r()], J.prototype, "_hasBeenOpened", void 0);
484
+ try {
485
+ e("pkt-datepicker-popup")(J);
486
+ } catch {
487
+ console.warn("Forsøker å definere <pkt-datepicker-popup>, men den er allerede definert");
488
+ }
489
+ //#endregion
490
+ //#region src/components/datepicker/datepicker-base.ts
491
+ var Y = class extends o {
492
+ constructor(...e) {
493
+ super(...e), this.inputType = "date", this.id = "", this.readonly = !1, this.disabled = !1, this.inputClasses = {}, this.inputRef = d(), this.btnRef = d();
494
+ }
495
+ get inputElement() {
496
+ return this.inputRef.value;
497
+ }
498
+ get buttonElement() {
499
+ return this.btnRef.value;
500
+ }
501
+ get isInputReadonly() {
502
+ return this.readonly || this.inputType === "text";
503
+ }
504
+ dispatchToggleCalendar(e) {
505
+ this.readonly || this.dispatchEvent(new CustomEvent("toggle-calendar", {
506
+ detail: e,
507
+ bubbles: !0,
508
+ composed: !0
509
+ }));
510
+ }
511
+ dispatchInput(e) {
512
+ this.dispatchEvent(new CustomEvent("input-change", {
513
+ detail: e,
514
+ bubbles: !0,
515
+ composed: !0
516
+ }));
517
+ }
518
+ dispatchFocus() {
519
+ this.dispatchEvent(new CustomEvent("input-focus", {
520
+ bubbles: !0,
521
+ composed: !0
522
+ }));
523
+ }
524
+ dispatchBlur(e) {
525
+ this.dispatchEvent(new CustomEvent("input-blur", {
526
+ detail: e,
527
+ bubbles: !0,
528
+ composed: !0
529
+ }));
530
+ }
531
+ dispatchChange(e) {
532
+ this.dispatchEvent(new CustomEvent("input-changed", {
533
+ detail: e,
534
+ bubbles: !0,
535
+ composed: !0
536
+ }));
537
+ }
538
+ renderCalendarButton() {
539
+ return t`
540
+ <button
541
+ class="${s(G.getButtonClasses())}"
542
+ type="button"
543
+ @click=${(e) => this.dispatchToggleCalendar(e)}
544
+ @keydown=${(e) => {
545
+ let { key: t } = e;
546
+ (t === "Enter" || t === " " || t === "Space") && (e.preventDefault(), this.dispatchToggleCalendar(e));
547
+ }}
548
+ ?disabled=${this.disabled}
549
+ ${this.btnRef}
550
+ >
551
+ <pkt-icon name="calendar"></pkt-icon>
552
+ <span class="pkt-btn__text">${this.strings.calendar?.buttonAltText || "Åpne kalender"}</span>
553
+ </button>
554
+ `;
555
+ }
556
+ createRenderRoot() {
557
+ return this;
558
+ }
559
+ };
560
+ i([a({ type: String })], Y.prototype, "inputType", void 0), i([a({ type: String })], Y.prototype, "id", void 0), i([a({ type: String })], Y.prototype, "min", void 0), i([a({ type: String })], Y.prototype, "max", void 0), i([a({ type: String })], Y.prototype, "placeholder", void 0), i([a({ type: Boolean })], Y.prototype, "readonly", void 0), i([a({ type: Boolean })], Y.prototype, "disabled", void 0), i([a({ type: Object })], Y.prototype, "inputClasses", void 0), i([a({ type: Object })], Y.prototype, "internals", void 0);
561
+ //#endregion
562
+ //#region src/components/datepicker/datepicker-single.ts
563
+ var X = class extends Y {
564
+ constructor(...e) {
565
+ super(...e), this.value = "", this.strings = D;
566
+ }
567
+ dispatchManageValidity(e) {
568
+ this.dispatchEvent(new CustomEvent("manage-validity", {
569
+ detail: e,
570
+ bubbles: !0,
571
+ composed: !0
572
+ }));
573
+ }
574
+ render() {
575
+ return t`
576
+ <div class="pkt-input__container">
577
+ <input
578
+ class="${s(this.inputClasses)}"
579
+ .type=${this.inputType}
580
+ id="${this.id}-input"
581
+ .value=${this.value}
582
+ min=${l(this.min)}
583
+ max=${l(this.max)}
584
+ placeholder=${l(this.placeholder)}
585
+ ?readonly=${this.isInputReadonly}
586
+ aria-describedby="${this.id}-helptext"
587
+ @click=${(e) => {
588
+ e.preventDefault(), this.dispatchToggleCalendar(e);
589
+ }}
590
+ @touchend=${(e) => {
591
+ e.preventDefault(), this.dispatchToggleCalendar(e);
592
+ }}
593
+ ?disabled=${this.disabled}
594
+ @keydown=${(e) => q.handleInputKeydown(e, (e) => this.dispatchToggleCalendar(e), () => U.submitFormOrFallback(this.internals, () => this.inputRef.value?.blur()), void 0, () => this.inputRef.value?.blur())}
595
+ @input=${(e) => {
596
+ this.dispatchInput(e), e.stopImmediatePropagation();
597
+ }}
598
+ @focus=${() => {
599
+ this.dispatchFocus(), j() && this.dispatchToggleCalendar(new Event("focus"));
600
+ }}
601
+ @blur=${(e) => {
602
+ this.dispatchBlur(e), this.dispatchManageValidity(e.target), this.dispatchEvent(new CustomEvent("value-change", {
603
+ detail: e.target.value,
604
+ bubbles: !0,
605
+ composed: !0
606
+ }));
607
+ }}
608
+ @change=${(e) => {
609
+ this.dispatchChange(e), e.stopImmediatePropagation();
610
+ }}
611
+ ${u(this.inputRef)}
612
+ />
613
+ ${this.renderCalendarButton()}
614
+ </div>
615
+ `;
616
+ }
617
+ };
618
+ i([a({ type: String })], X.prototype, "value", void 0), i([a({ type: Object })], X.prototype, "strings", void 0);
619
+ try {
620
+ e("pkt-datepicker-single")(X);
621
+ } catch {
622
+ console.warn("Forsøker å definere <pkt-datepicker-single>, men den er allerede definert");
623
+ }
624
+ //#endregion
625
+ //#region src/components/datepicker/datepicker-range.ts
626
+ var Z = class extends Y {
627
+ constructor(...e) {
628
+ super(...e), this.value = [], this.label = "", this.showRangeLabels = !1, this.strings = O, this.inputRefTo = d();
629
+ }
630
+ get inputElementTo() {
631
+ return this.inputRefTo.value;
632
+ }
633
+ render() {
634
+ let e = G.getRangeLabelClasses(this.showRangeLabels);
635
+ return t`
636
+ <div class="pkt-input__container">
637
+ ${this.showRangeLabels ? t` <div class="pkt-input-prefix">${this.strings.generic?.from}</div> ` : n}
638
+ <input
639
+ class=${s(this.inputClasses)}
640
+ .type=${this.inputType}
641
+ id="${this.id}-input"
642
+ aria-label="${this.label} ${this.strings.generic?.from ?? "Fra"}"
643
+ .value=${this.value[0] ?? ""}
644
+ min=${l(this.min)}
645
+ max=${l(this.max)}
646
+ placeholder=${l(this.placeholder)}
647
+ ?readonly=${this.isInputReadonly}
648
+ ?disabled=${this.disabled}
649
+ @click=${(e) => {
650
+ e.preventDefault(), this.dispatchToggleCalendar(e);
651
+ }}
652
+ @touchend=${(e) => {
653
+ e.preventDefault(), this.dispatchToggleCalendar(e);
654
+ }}
655
+ @keydown=${(e) => q.handleInputKeydown(e, (e) => this.dispatchToggleCalendar(e), () => U.submitFormOrFallback(this.internals, () => this.inputRefTo.value?.focus()), () => this.inputRefTo.value?.focus(), () => this.inputRef.value?.blur())}
656
+ @input=${(e) => {
657
+ this.dispatchInput(e), e.stopImmediatePropagation();
658
+ }}
659
+ @focus=${() => {
660
+ this.dispatchFocus(), j() && this.dispatchToggleCalendar(new Event("focus"));
661
+ }}
662
+ @blur=${(e) => {
663
+ this.dispatchBlur(e), this.dispatchEvent(new CustomEvent("range-blur", {
664
+ detail: {
665
+ event: e,
666
+ values: this.value,
667
+ inputType: "from"
668
+ },
669
+ bubbles: !0,
670
+ composed: !0
671
+ }));
672
+ }}
673
+ @change=${(e) => {
674
+ this.dispatchChange(e), e.stopImmediatePropagation();
675
+ }}
676
+ ${u(this.inputRef)}
677
+ />
678
+ <div class="${s(e)}" id="${this.id}-to-label">
679
+ ${this.strings.generic?.to}
680
+ </div>
681
+ ${this.showRangeLabels ? n : t` <div class="pkt-input-separator">–</div> `}
682
+ <input
683
+ class=${s(this.inputClasses)}
684
+ .type=${this.inputType}
685
+ id="${this.id}-to"
686
+ aria-label="${this.label} ${this.strings.generic?.to ?? "Til"}"
687
+ .value=${this.value[1] ?? ""}
688
+ min=${l(this.min)}
689
+ max=${l(this.max)}
690
+ placeholder=${l(this.placeholder)}
691
+ ?readonly=${this.isInputReadonly}
692
+ ?disabled=${this.disabled}
693
+ @click=${(e) => {
694
+ e.preventDefault(), this.dispatchToggleCalendar(e);
695
+ }}
696
+ @touchend=${(e) => {
697
+ e.preventDefault(), this.dispatchToggleCalendar(e);
698
+ }}
699
+ @keydown=${(e) => q.handleInputKeydown(e, (e) => this.dispatchToggleCalendar(e), () => U.submitFormOrFallback(this.internals, () => this.inputRefTo.value?.blur()), void 0, () => this.inputRefTo.value?.blur())}
700
+ @input=${(e) => {
701
+ this.dispatchInput(e), e.stopImmediatePropagation();
702
+ }}
703
+ @focus=${() => {
704
+ this.dispatchFocus(), j() && this.dispatchToggleCalendar(new Event("focus"));
705
+ }}
706
+ @blur=${(e) => {
707
+ this.dispatchBlur(e), this.dispatchEvent(new CustomEvent("range-blur", {
708
+ detail: {
709
+ event: e,
710
+ values: this.value,
711
+ inputType: "to"
712
+ },
713
+ bubbles: !0,
714
+ composed: !0
715
+ }));
716
+ }}
717
+ @change=${(e) => {
718
+ this.dispatchChange(e), e.stopImmediatePropagation();
719
+ }}
720
+ ${u(this.inputRefTo)}
721
+ />
722
+ ${this.renderCalendarButton()}
723
+ </div>
724
+ `;
725
+ }
726
+ };
727
+ i([a({ type: Array })], Z.prototype, "value", void 0), i([a({ type: String })], Z.prototype, "label", void 0), i([a({ type: Boolean })], Z.prototype, "showRangeLabels", void 0), i([a({ type: Object })], Z.prototype, "strings", void 0);
728
+ try {
729
+ e("pkt-datepicker-range")(Z);
730
+ } catch {
731
+ console.warn("Forsøker å definere <pkt-datepicker-range>, men den er allerede definert");
732
+ }
733
+ //#endregion
734
+ //#region src/components/datepicker/datepicker-multiple.ts
735
+ var Q = class extends Y {
736
+ constructor(...e) {
737
+ super(...e), this.value = [], this.strings = D;
738
+ }
739
+ get isInputDisabled() {
740
+ return this.disabled || this.maxlength !== void 0 && this.maxlength !== null && this.value.length >= this.maxlength;
741
+ }
742
+ dispatchAddToSelected(e) {
743
+ this.dispatchEvent(new CustomEvent("add-to-selected", {
744
+ detail: e,
745
+ bubbles: !0,
746
+ composed: !0
747
+ }));
748
+ }
749
+ render() {
750
+ return t`
751
+ <div class="pkt-input__container">
752
+ <input
753
+ class=${s(this.inputClasses)}
754
+ .type=${this.inputType}
755
+ id="${this.id}-input"
756
+ min=${l(this.min)}
757
+ max=${l(this.max)}
758
+ placeholder=${l(this.placeholder)}
759
+ ?readonly=${this.isInputReadonly}
760
+ ?disabled=${this.isInputDisabled}
761
+ @click=${(e) => {
762
+ e.preventDefault(), this.dispatchToggleCalendar(e);
763
+ }}
764
+ @touchend=${(e) => {
765
+ e.preventDefault(), this.dispatchToggleCalendar(e);
766
+ }}
767
+ @blur=${(e) => {
768
+ this.dispatchBlur(e), this.dispatchAddToSelected(e);
769
+ }}
770
+ @input=${(e) => {
771
+ this.dispatchInput(e), e.stopImmediatePropagation();
772
+ }}
773
+ @focus=${() => {
774
+ this.dispatchFocus(), j() && this.dispatchToggleCalendar(new Event("focus"));
775
+ }}
776
+ @keydown=${(e) => q.handleInputKeydown(e, (e) => this.dispatchToggleCalendar(e), () => U.submitFormOrFallback(this.internals, () => this.inputRef.value?.blur()), void 0, void 0, (e) => this.dispatchAddToSelected(e))}
777
+ @change=${(e) => {
778
+ this.dispatchChange(e), e.stopImmediatePropagation();
779
+ }}
780
+ ${u(this.inputRef)}
781
+ />
782
+ ${this.renderCalendarButton()}
783
+ </div>
784
+ `;
785
+ }
786
+ };
787
+ i([a({ type: Array })], Q.prototype, "value", void 0), i([a({ type: Number })], Q.prototype, "maxlength", void 0), i([a({ type: Object })], Q.prototype, "strings", void 0);
788
+ try {
789
+ e("pkt-datepicker-multiple")(Q);
790
+ } catch {
791
+ console.warn("Forsøker å definere <pkt-datepicker-multiple>, men den er allerede definert");
792
+ }
793
+ //#endregion
794
+ //#region src/components/datepicker/datepicker.ts
795
+ var $ = class extends E {
796
+ constructor(...e) {
797
+ super(...e), this._valueProperty = "", this._valueProcessing = !1, this.datepickerPopupRef = d(), this._value = [], this.label = "Datovelger", this.dateformat = A.props.dateformat.default, this.multiple = A.props.multiple.default, this.maxlength = null, this.range = A.props.range.default, this.showRangeLabels = !1, this.min = null, this.max = null, this.weeknumbers = A.props.weeknumbers.default, this.withcontrols = A.props.withcontrols.default, this.excludedates = [], this.excludeweekdays = [], this.currentmonth = null, this.today = null, this.calendarOpen = !1, this.timezone = "Europe/Oslo", this.inputClasses = {}, this.calRef = d(), this.popupRef = d(), this.singleInputRef = d(), this.rangeInputRef = d(), this.multipleInputRef = d(), this.addToSelected = (e) => {
798
+ let t = this.datepickerPopupRef.value;
799
+ return t && typeof t.addToSelected == "function" ? t.addToSelected(e, this.min, this.max) : W.addToSelected(e, this.calRef, this.min, this.max);
800
+ };
801
+ }
802
+ get value() {
803
+ return this._valueProperty;
804
+ }
805
+ set value(e) {
806
+ let t = this._valueProperty;
807
+ this._valueProperty = Array.isArray(e) ? e.join(",") : e || "", this.valueChanged(this._valueProperty, t), this.requestUpdate("value", t);
808
+ }
809
+ get inputType() {
810
+ return H.getInputType();
811
+ }
812
+ connectedCallback() {
813
+ super.connectedCallback(), this.timezone && this.timezone !== window.pktTz && (window.pktTz = this.timezone);
814
+ }
815
+ disconnectedCallback() {
816
+ super.disconnectedCallback();
817
+ }
818
+ onInput() {
819
+ this.dispatchEvent(new Event("input", { bubbles: !0 }));
820
+ }
821
+ valueChanged(e, t) {
822
+ if (!(this._valueProcessing || e === t)) {
823
+ this._valueProcessing = !0;
824
+ try {
825
+ let n = f(e), r = this.multiple && n.length > 1 ? V.filterSelectableDates(n, this.min, this.max, this.excludedates, this.excludeweekdays) : n;
826
+ if (this.range && !V.validateRangeOrder(r)) {
827
+ this._value = [], this._valueProperty = "", super.valueChanged("", t);
828
+ return;
829
+ }
830
+ this._value = r;
831
+ let i = g(r);
832
+ if (this._valueProperty !== i && (this._valueProperty = i), this.range && r.length < 2) return;
833
+ super.valueChanged(i, t);
834
+ } finally {
835
+ this._valueProcessing = !1;
836
+ }
837
+ }
838
+ }
839
+ attributeChangedCallback(e, t, n) {
840
+ e === "value" && this.value !== t && this.valueChanged(n, t), e === "excludedates" && typeof this.excludedates == "string" && (this.excludedates = f(n || "")), e === "excludeweekdays" && typeof this.excludeweekdays == "string" && (this.excludeweekdays = f(n || "")), super.attributeChangedCallback(e, t, n);
841
+ }
842
+ updated(e) {
843
+ if (e.has("value") && (e.has("multiple") || e.has("range"))) {
844
+ let t = Array.isArray(this.value) ? this.value.join(",") : this.value, n = e.get("value"), r = Array.isArray(n) ? n.join(",") : n;
845
+ this.valueChanged(t, r);
846
+ }
847
+ e.has("multiple") && (this.multiple && !Array.isArray(this._value) ? this._value = f(this.value) : !this.multiple && Array.isArray(this._value) && (this._value = this._value.filter(Boolean)), !this.multiple && !this.range && Array.isArray(this._value) && (this._value = [this._value[0] ?? ""])), super.updated(e);
848
+ }
849
+ get inputRef() {
850
+ return { value: this.currentInputElement };
851
+ }
852
+ get inputRefTo() {
853
+ return { value: this.currentInputElementTo };
854
+ }
855
+ get currentInputElement() {
856
+ return this.multiple ? this.multipleInputRef.value?.inputElement : this.range ? this.rangeInputRef.value?.inputElement : this.singleInputRef.value?.inputElement;
857
+ }
858
+ get currentInputElementTo() {
859
+ if (this.range) return this.rangeInputRef.value?.inputElementTo;
860
+ }
861
+ get currentButtonElement() {
862
+ return this.multiple ? this.multipleInputRef.value?.buttonElement : this.range ? this.rangeInputRef.value?.buttonElement : this.singleInputRef.value?.buttonElement;
863
+ }
864
+ get btnRef() {
865
+ return { value: this.currentButtonElement };
866
+ }
867
+ renderInput() {
868
+ return t`
869
+ <pkt-datepicker-single
870
+ .value=${this._value[0] ?? ""}
871
+ .inputType=${this.inputType}
872
+ .id=${this.id}
873
+ .min=${this.min}
874
+ .max=${this.max}
875
+ .placeholder=${this.placeholder}
876
+ .readonly=${this.readonly}
877
+ .disabled=${this.disabled}
878
+ .inputClasses=${this.inputClasses}
879
+ .internals=${this.internals}
880
+ .strings=${this.strings}
881
+ @toggle-calendar=${(e) => this.toggleCalendar(e.detail)}
882
+ @input-change=${() => this.onInput()}
883
+ @input-focus=${() => this.onFocus()}
884
+ @input-blur=${(e) => {
885
+ this.calRef.value?.contains(e.detail.relatedTarget) || this.onBlur();
886
+ }}
887
+ @manage-validity=${(e) => this.manageValidity(e.detail)}
888
+ @value-change=${(e) => {
889
+ this.value = e.detail;
890
+ }}
891
+ @input-changed=${() => {
892
+ this.touched = !0;
893
+ }}
894
+ ${u(this.singleInputRef)}
895
+ ></pkt-datepicker-single>
896
+ `;
897
+ }
898
+ renderRangeInput() {
899
+ return t`
900
+ <pkt-datepicker-range
901
+ .value=${this._value}
902
+ .inputType=${this.inputType}
903
+ .id=${this.id}
904
+ .label=${this.label}
905
+ .min=${this.min}
906
+ .max=${this.max}
907
+ .placeholder=${this.placeholder}
908
+ .readonly=${this.readonly}
909
+ .disabled=${this.disabled}
910
+ .showRangeLabels=${this.showRangeLabels}
911
+ .inputClasses=${this.inputClasses}
912
+ .internals=${this.internals}
913
+ .strings=${this.strings}
914
+ @toggle-calendar=${(e) => this.toggleCalendar(e.detail)}
915
+ @input-change=${() => this.onInput()}
916
+ @input-focus=${() => this.onFocus()}
917
+ @input-blur=${(e) => {
918
+ this.calRef.value?.contains(e.detail.relatedTarget) || this.onBlur();
919
+ }}
920
+ @range-blur=${(e) => {
921
+ let t = this.currentInputElement, n = this.currentInputElementTo;
922
+ if (t && n) {
923
+ let e = t.value, r = n.value;
924
+ if (e && r && e > r) n.value = "", this._value = [e], this.value = e;
925
+ else {
926
+ let t = [e, r].filter(Boolean);
927
+ t.length > 0 && (t[0] !== this._value[0] || t[1] !== this._value[1]) && (this._value = t, this.value = t.join(","));
928
+ }
929
+ }
930
+ K.processRangeBlur(e.detail.event, e.detail.values, this.calRef, () => this.clearInputValue(), (e) => this.manageValidity(e));
931
+ }}
932
+ @manage-validity=${(e) => this.manageValidity(e.detail)}
933
+ @validate-date-input=${(e) => {
934
+ U.validateDateInput(e.detail, this.internals, this.min, this.max, this.strings);
935
+ }}
936
+ @handle-date-select=${(e) => {
937
+ let t = p(e.detail);
938
+ if (t) {
939
+ let e = x(t);
940
+ this._value[0] !== e && this._value[1] !== e && this.calRef?.value?.handleDateSelect(t);
941
+ }
942
+ }}
943
+ @input-changed=${() => {
944
+ this.touched = !0;
945
+ }}
946
+ ${u(this.rangeInputRef)}
947
+ ></pkt-datepicker-range>
948
+ `;
949
+ }
950
+ renderMultipleInput() {
951
+ return t`
952
+ <pkt-datepicker-multiple
953
+ .value=${this._value}
954
+ .inputType=${this.inputType}
955
+ .id=${this.id}
956
+ .min=${this.min}
957
+ .max=${this.max}
958
+ .placeholder=${this.placeholder}
959
+ .readonly=${this.readonly}
960
+ .disabled=${this.disabled}
961
+ .maxlength=${this.maxlength}
962
+ .inputClasses=${this.inputClasses}
963
+ .internals=${this.internals}
964
+ .strings=${this.strings}
965
+ @toggle-calendar=${(e) => this.toggleCalendar(e.detail)}
966
+ @input-change=${() => this.onInput()}
967
+ @input-focus=${() => this.onFocus()}
968
+ @input-blur=${(e) => {
969
+ this.calRef.value?.contains(e.detail.relatedTarget) || this.onBlur();
970
+ }}
971
+ @add-to-selected=${(e) => this.addToSelected(e.detail)}
972
+ @input-changed=${() => {
973
+ this.touched = !0;
974
+ }}
975
+ ${u(this.multipleInputRef)}
976
+ ></pkt-datepicker-multiple>
977
+ `;
978
+ }
979
+ renderCalendar() {
980
+ return t`
981
+ <pkt-datepicker-popup
982
+ class="pkt-contents"
983
+ ?open=${this.calendarOpen}
984
+ ?multiple=${this.multiple}
985
+ ?range=${this.range}
986
+ ?weeknumbers=${this.weeknumbers}
987
+ ?withcontrols=${this.withcontrols}
988
+ .maxMultiple=${this.maxlength}
989
+ .selected=${this._value}
990
+ .earliest=${this.min}
991
+ .latest=${this.max}
992
+ .excludedates=${Array.isArray(this.excludedates) ? this.excludedates : this.excludedates.split(",")}
993
+ .excludeweekdays=${this.excludeweekdays}
994
+ .currentmonth=${this.currentmonth ? h(this.currentmonth) : null}
995
+ .today=${this.today}
996
+ @date-selected=${(e) => {
997
+ this.value = K.processDateSelection(e.detail, this.multiple, this.range), this._value = e.detail, K.updateInputValues(this.inputRef, this.inputRefTo, this._value, this.range, this.multiple, (e) => this.manageValidity(e));
998
+ }}
999
+ @close=${() => {
1000
+ this.onBlur(), this.hideCalendar();
1001
+ }}
1002
+ ${u(this.datepickerPopupRef)}
1003
+ ></pkt-datepicker-popup>
1004
+ `;
1005
+ }
1006
+ render() {
1007
+ return this.inputClasses = G.getInputClasses(this.fullwidth, this.showRangeLabels, this.multiple, this.range, this.readonly, this.inputType), t`
1008
+ <pkt-input-wrapper
1009
+ label="${this.label}"
1010
+ forId="${this.id}-input"
1011
+ ?counter=${this.multiple && !!this.maxlength}
1012
+ .counterCurrent=${this.value ? this._value.length : 0}
1013
+ .counterMaxLength=${this.maxlength}
1014
+ ?disabled=${this.disabled}
1015
+ ?hasError=${this.hasError}
1016
+ ?hasFieldset=${this.hasFieldset}
1017
+ ?inline=${this.inline}
1018
+ ?required=${this.required}
1019
+ ?optionalTag=${this.optionalTag}
1020
+ ?requiredTag=${this.requiredTag}
1021
+ useWrapper=${this.useWrapper}
1022
+ .optionalText=${this.optionalText}
1023
+ .requiredText=${this.requiredText}
1024
+ .tagText=${this.tagText}
1025
+ .errorMessage=${this.errorMessage}
1026
+ .helptext=${this.helptext}
1027
+ .helptextDropdown=${this.helptextDropdown}
1028
+ .helptextDropdownButton=${this.helptextDropdownButton}
1029
+ .ariaDescribedBy=${this.ariaDescribedBy}
1030
+ class="pkt-datepicker"
1031
+ >
1032
+ <div class="pkt-contents" slot="helptext">${c(this, "helptext")}</div>
1033
+ ${this.multiple ? t`<pkt-date-tags
1034
+ .dates=${this._value}
1035
+ dateformat=${this.dateformat}
1036
+ strings=${this.strings}
1037
+ id-base=${this.id}
1038
+ @date-tag-removed=${(e) => {
1039
+ let t = this.datepickerPopupRef.value, n = p(e.detail);
1040
+ t && n && typeof t.handleDateSelect == "function" ? t.handleDateSelect(n) : this.calRef.value?.handleDateSelect(n);
1041
+ }}
1042
+ ></pkt-date-tags>` : n}
1043
+ <div class="pkt-datepicker__inputs ${this.range ? "pkt-input__range-inputs" : ""}">
1044
+ ${this.range ? this.renderRangeInput() : this.multiple ? this.renderMultipleInput() : this.renderInput()}
1045
+ </div>
1046
+ </pkt-input-wrapper>
1047
+ ${this.renderCalendar()}
1048
+ `;
1049
+ }
1050
+ handleCalendarPosition() {
1051
+ let e = this.multiple && !!this.maxlength;
1052
+ W.handleCalendarPosition(this.popupRef, this.inputRef, e);
1053
+ }
1054
+ async showCalendar() {
1055
+ let e = this.datepickerPopupRef.value;
1056
+ if (this.calendarOpen = !0, e && typeof e.show == "function") {
1057
+ e.show(), j() && e.focusOnCurrentDate();
1058
+ return;
1059
+ }
1060
+ await T(20), this.handleCalendarPosition(), j() && this.calRef.value?.focusOnCurrentDate();
1061
+ }
1062
+ hideCalendar() {
1063
+ let e = this.datepickerPopupRef.value;
1064
+ if (this.calendarOpen = !1, e && typeof e.hide == "function") return e.hide();
1065
+ }
1066
+ async toggleCalendar(e) {
1067
+ e.preventDefault();
1068
+ let t = this.datepickerPopupRef.value;
1069
+ if (t && typeof t.toggle == "function") {
1070
+ let e = !!t.open;
1071
+ t.toggle(), this.calendarOpen = !e;
1072
+ return;
1073
+ }
1074
+ this.calendarOpen ? this.hideCalendar() : this.showCalendar();
1075
+ }
1076
+ clearInputValue() {
1077
+ this._value = [], this.value = "", this.internals.setFormValue(this.value), this.dispatchEvent(new Event("change", {
1078
+ bubbles: !0,
1079
+ composed: !0
1080
+ })), this.dispatchEvent(new CustomEvent("value-change", {
1081
+ detail: this._value,
1082
+ bubbles: !0,
1083
+ composed: !0
1084
+ }));
1085
+ }
1086
+ };
1087
+ i([a({
1088
+ type: String,
1089
+ reflect: !0
1090
+ })], $.prototype, "value", null), i([a({
1091
+ type: String,
1092
+ reflect: !0
1093
+ })], $.prototype, "label", void 0), i([a({ type: String })], $.prototype, "dateformat", void 0), i([a({
1094
+ type: Boolean,
1095
+ reflect: !0
1096
+ })], $.prototype, "multiple", void 0), i([a({
1097
+ type: Number,
1098
+ reflect: !0
1099
+ })], $.prototype, "maxlength", void 0), i([a({
1100
+ type: Boolean,
1101
+ reflect: !0
1102
+ })], $.prototype, "range", void 0), i([a({
1103
+ type: Boolean,
1104
+ attribute: "show-range-labels"
1105
+ })], $.prototype, "showRangeLabels", void 0), i([a({
1106
+ type: String,
1107
+ reflect: !0
1108
+ })], $.prototype, "min", void 0), i([a({
1109
+ type: String,
1110
+ reflect: !0
1111
+ })], $.prototype, "max", void 0), i([a({ type: Boolean })], $.prototype, "weeknumbers", void 0), i([a({
1112
+ type: Boolean,
1113
+ reflect: !0
1114
+ })], $.prototype, "withcontrols", void 0), i([a({ converter: b.csvToArray })], $.prototype, "excludedates", void 0), i([a({ converter: b.csvToArray })], $.prototype, "excludeweekdays", void 0), i([a({ type: String })], $.prototype, "currentmonth", void 0), i([a({ type: String })], $.prototype, "today", void 0), i([a({
1115
+ type: Boolean,
1116
+ reflect: !0,
1117
+ attribute: "calendar-open"
1118
+ })], $.prototype, "calendarOpen", void 0), i([a({ type: String })], $.prototype, "timezone", void 0), i([r()], $.prototype, "inputClasses", void 0);
1119
+ try {
1120
+ e("pkt-datepicker")($);
1121
+ } catch {
1122
+ console.warn("Forsøker å definere <pkt-datepicker>, men den er allerede definert");
1123
+ }
1124
+ //#endregion
1125
+ export { k as a, X as i, Q as n, Z as r, $ as t };