@oslokommune/punkt-react 18.7.1 → 18.8.0
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.
- package/CHANGELOG.md +48 -0
- package/dist/components/combobox/Combobox.preselection.test.d.ts +0 -0
- package/dist/components/combobox/types.d.ts +2 -0
- package/dist/punkt-react.cjs +1 -1
- package/dist/punkt-react.js +1043 -1023
- package/dist/shared-strings/nb.d.ts +1 -0
- package/package.json +3 -3
- package/src/components/checkbox/Checkbox.tsx +26 -13
- package/src/components/combobox/Combobox.accessibility.test.tsx +8 -7
- package/src/components/combobox/Combobox.interaction.test.tsx +38 -0
- package/src/components/combobox/Combobox.preselection.test.tsx +247 -0
- package/src/components/combobox/ComboboxInput.tsx +14 -3
- package/src/components/combobox/Listbox.tsx +2 -1
- package/src/components/combobox/types.ts +2 -0
- package/src/components/combobox/useComboboxState.ts +51 -17
- package/src/components/radio/RadioButton.tsx +22 -19
package/dist/punkt-react.js
CHANGED
|
@@ -62,7 +62,7 @@ var M = /* @__PURE__ */ O((/* @__PURE__ */ E(((e, t) => {
|
|
|
62
62
|
return n;
|
|
63
63
|
}) : window.classNames = n;
|
|
64
64
|
})();
|
|
65
|
-
})))(), 1), N = "https://punkt-cdn.oslo.kommune.no/18.
|
|
65
|
+
})))(), 1), N = "https://punkt-cdn.oslo.kommune.no/18.8/icons/";
|
|
66
66
|
typeof window < "u" && (window.pktFetch = window.pktFetch === void 0 ? fetch : window.pktFetch, window.pktIconPath = window.pktIconPath || N);
|
|
67
67
|
var P = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 32 32\"></svg>", ee = {}, te = 2, ne = 1500, F = typeof Storage < "u" && typeof sessionStorage < "u", re = typeof window < "u" ? d : c, ie = (e, t) => !e || !F ? "" : sessionStorage.getItem(t + e + ".svg") ?? "", ae = (e) => window.pktFetch(e).then((t) => {
|
|
68
68
|
if (!t.ok) throw Error("Missing icon: " + e);
|
|
@@ -297,6 +297,7 @@ var ce = {
|
|
|
297
297
|
tooManySelected: "For mange valgt",
|
|
298
298
|
alreadySelected: "Verdien er allerede valgt",
|
|
299
299
|
valueAdded: "Ny verdi lagt til",
|
|
300
|
+
valueSelected: "{value} er valgt",
|
|
300
301
|
noValidValue: "Ingen gyldig verdi valgt"
|
|
301
302
|
},
|
|
302
303
|
fileupload: {
|
|
@@ -331,16 +332,16 @@ var ce = {
|
|
|
331
332
|
function B(e, t) {
|
|
332
333
|
return t ? e.replace(z, (n, r) => {
|
|
333
334
|
let i = t[r];
|
|
334
|
-
return i == null ? (
|
|
335
|
+
return i == null ? (H(r, e), n) : String(i);
|
|
335
336
|
}) : e;
|
|
336
337
|
}
|
|
337
|
-
function
|
|
338
|
+
function le(e, t, n) {
|
|
338
339
|
return e === 1 ? t : n;
|
|
339
340
|
}
|
|
340
|
-
var
|
|
341
|
-
function
|
|
341
|
+
var V = /* @__PURE__ */ new Set();
|
|
342
|
+
function H(e, t) {
|
|
342
343
|
let n = `${e}::${t}`;
|
|
343
|
-
|
|
344
|
+
V.has(n) || (V.add(n), console.warn(`[punkt] Mangler verdi for plassholderen {${e}} i teksten «${t}»`));
|
|
344
345
|
}
|
|
345
346
|
//#endregion
|
|
346
347
|
//#region ../../shared-strings/store.ts
|
|
@@ -352,7 +353,7 @@ function U() {
|
|
|
352
353
|
listeners: /* @__PURE__ */ new Set()
|
|
353
354
|
}), e[ue];
|
|
354
355
|
}
|
|
355
|
-
function
|
|
356
|
+
function W(e) {
|
|
356
357
|
let t = U(), n = { ...t.overrides };
|
|
357
358
|
for (let t of Object.keys(e)) {
|
|
358
359
|
let r = e[t];
|
|
@@ -363,14 +364,14 @@ function de(e) {
|
|
|
363
364
|
}
|
|
364
365
|
t.overrides = n, t.listeners.forEach((e) => e());
|
|
365
366
|
}
|
|
366
|
-
function
|
|
367
|
+
function G() {
|
|
367
368
|
return U().overrides;
|
|
368
369
|
}
|
|
369
|
-
function
|
|
370
|
+
function K() {
|
|
370
371
|
let e = U();
|
|
371
372
|
e.overrides = {}, e.listeners.forEach((e) => e());
|
|
372
373
|
}
|
|
373
|
-
function
|
|
374
|
+
function q(e) {
|
|
374
375
|
let t = U();
|
|
375
376
|
return t.listeners.add(e), () => {
|
|
376
377
|
t.listeners.delete(e);
|
|
@@ -378,44 +379,44 @@ function K(e) {
|
|
|
378
379
|
}
|
|
379
380
|
//#endregion
|
|
380
381
|
//#region ../../shared-strings/resolve.ts
|
|
381
|
-
var
|
|
382
|
-
function
|
|
382
|
+
var de = /* @__PURE__ */ new Map();
|
|
383
|
+
function J(e, t) {
|
|
383
384
|
if (t) for (let n of Object.keys(t)) {
|
|
384
385
|
let r = t[n];
|
|
385
386
|
r !== void 0 && (e[n] = r);
|
|
386
387
|
}
|
|
387
388
|
}
|
|
388
|
-
function
|
|
389
|
+
function fe(e) {
|
|
389
390
|
return !!e && Object.keys(e).length > 0;
|
|
390
391
|
}
|
|
391
|
-
function
|
|
392
|
-
let t =
|
|
392
|
+
function pe(e) {
|
|
393
|
+
let t = G(), n = de.get(e);
|
|
393
394
|
if (n && n.overrides === t) return n.value;
|
|
394
395
|
let r = t[e], i;
|
|
395
|
-
if (
|
|
396
|
+
if (fe(r)) {
|
|
396
397
|
let t = { ...ce[e] };
|
|
397
|
-
|
|
398
|
+
J(t, r), i = t;
|
|
398
399
|
} else i = ce[e];
|
|
399
|
-
return
|
|
400
|
+
return de.set(e, {
|
|
400
401
|
overrides: t,
|
|
401
402
|
value: i
|
|
402
403
|
}), i;
|
|
403
404
|
}
|
|
404
|
-
function
|
|
405
|
-
let n = t.filter((t) =>
|
|
405
|
+
function me(e, ...t) {
|
|
406
|
+
let n = t.filter((t) => fe(t?.[e])), r = pe(e);
|
|
406
407
|
if (n.length === 0) return r;
|
|
407
408
|
let i = { ...r };
|
|
408
|
-
for (let t of n)
|
|
409
|
+
for (let t of n) J(i, t?.[e]);
|
|
409
410
|
return i;
|
|
410
411
|
}
|
|
411
412
|
function Y(e, ...t) {
|
|
412
413
|
let n = {};
|
|
413
|
-
for (let r of e) n[r] =
|
|
414
|
+
for (let r of e) n[r] = me(r, ...t);
|
|
414
415
|
return n;
|
|
415
416
|
}
|
|
416
417
|
//#endregion
|
|
417
418
|
//#region ../../shared-strings/consent.ts
|
|
418
|
-
var
|
|
419
|
+
var X = {
|
|
419
420
|
i18n: {
|
|
420
421
|
nb: {
|
|
421
422
|
contentPresentation: {
|
|
@@ -527,8 +528,8 @@ var he = {
|
|
|
527
528
|
};
|
|
528
529
|
//#endregion
|
|
529
530
|
//#region src/components/button/Button.tsx
|
|
530
|
-
typeof window < "u" && (window.pktAnimationPath = window.pktAnimationPath || "https://punkt-cdn.oslo.kommune.no/18.
|
|
531
|
-
var
|
|
531
|
+
typeof window < "u" && (window.pktAnimationPath = window.pktAnimationPath || "https://punkt-cdn.oslo.kommune.no/18.8/animations/");
|
|
532
|
+
var Z = i(({ children: e, className: t, iconName: n = "user", secondIconName: r = "user", iconPath: i, secondIconPath: a, size: o = "medium", fullWidth: s = !1, fullWidthOnMobile: c = !1, skin: l = "primary", type: u = "button", variant: d = "label-only", state: f, color: p, isLoading: m = void 0, disabled: h = void 0, loadingAnimationPath: g = window.pktAnimationPath, ...y }, b) => {
|
|
532
533
|
let x = [
|
|
533
534
|
t,
|
|
534
535
|
"pkt-btn",
|
|
@@ -572,11 +573,11 @@ var X = i(({ children: e, className: t, iconName: n = "user", secondIconName: r
|
|
|
572
573
|
]
|
|
573
574
|
});
|
|
574
575
|
});
|
|
575
|
-
|
|
576
|
+
Z.displayName = "PktButton";
|
|
576
577
|
//#endregion
|
|
577
578
|
//#region src/components/strings/PktStringsProvider.tsx
|
|
578
|
-
var
|
|
579
|
-
let n = s(
|
|
579
|
+
var he = n(void 0), Q = ({ strings: e, children: t }) => {
|
|
580
|
+
let n = s(he), r = f(() => {
|
|
580
581
|
if (!n) return e;
|
|
581
582
|
let t = { ...n };
|
|
582
583
|
for (let n of Object.keys(e)) t[n] = {
|
|
@@ -585,7 +586,7 @@ var Z = n(void 0), Q = ({ strings: e, children: t }) => {
|
|
|
585
586
|
};
|
|
586
587
|
return t;
|
|
587
588
|
}, [n, e]);
|
|
588
|
-
return /* @__PURE__ */ _(
|
|
589
|
+
return /* @__PURE__ */ _(he.Provider, {
|
|
589
590
|
value: r,
|
|
590
591
|
children: t
|
|
591
592
|
});
|
|
@@ -593,7 +594,7 @@ var Z = n(void 0), Q = ({ strings: e, children: t }) => {
|
|
|
593
594
|
//#endregion
|
|
594
595
|
//#region src/hooks/usePktStrings.ts
|
|
595
596
|
function ge(e, t) {
|
|
596
|
-
let n = h(
|
|
597
|
+
let n = h(q, G, G), r = s(he), i = e.join("|");
|
|
597
598
|
return f(() => Y(e, r, t), [
|
|
598
599
|
i,
|
|
599
600
|
n,
|
|
@@ -603,7 +604,7 @@ function ge(e, t) {
|
|
|
603
604
|
}
|
|
604
605
|
//#endregion
|
|
605
606
|
//#region src/components/alert/Alert.tsx
|
|
606
|
-
var
|
|
607
|
+
var $ = ({ children: e, closeAlert: t, compact: n, size: r = n ? "small" : "medium", title: i, date: a, ariaLive: s, "aria-live": c = "polite", role: l = "status", skin: u = "info", className: d, strings: f, ...p }) => {
|
|
607
608
|
let [h, g] = m(!1), y = ge(["generic", "alert"], f), b = {
|
|
608
609
|
"pkt-alert": !0,
|
|
609
610
|
[`pkt-alert--${r}`]: r,
|
|
@@ -635,7 +636,7 @@ var _e = ({ children: e, closeAlert: t, compact: n, size: r = n ? "small" : "med
|
|
|
635
636
|
}),
|
|
636
637
|
t && /* @__PURE__ */ _("div", {
|
|
637
638
|
className: "pkt-alert__close",
|
|
638
|
-
children: /* @__PURE__ */ _(
|
|
639
|
+
children: /* @__PURE__ */ _(Z, {
|
|
639
640
|
tabIndex: 0,
|
|
640
641
|
"aria-label": "close",
|
|
641
642
|
size: r,
|
|
@@ -666,10 +667,10 @@ var _e = ({ children: e, closeAlert: t, compact: n, size: r = n ? "small" : "med
|
|
|
666
667
|
})
|
|
667
668
|
});
|
|
668
669
|
};
|
|
669
|
-
|
|
670
|
+
$.displayName = "PktAlert";
|
|
670
671
|
//#endregion
|
|
671
672
|
//#region src/components/backlink/BackLink.tsx
|
|
672
|
-
var
|
|
673
|
+
var _e = i(({ href: e = "/", text: t = "Forsiden", ariaLabel: n, renderLink: r, className: i, strings: a, ...o }, s) => {
|
|
673
674
|
let c = /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _(L, {
|
|
674
675
|
className: "pkt-back-link__icon pkt-icon pkt-link__icon",
|
|
675
676
|
name: "chevron-thin-left",
|
|
@@ -695,10 +696,10 @@ var ve = i(({ href: e = "/", text: t = "Forsiden", ariaLabel: n, renderLink: r,
|
|
|
695
696
|
})
|
|
696
697
|
});
|
|
697
698
|
});
|
|
698
|
-
|
|
699
|
+
_e.displayName = "PktBackLink";
|
|
699
700
|
//#endregion
|
|
700
701
|
//#region src/components/breadcrumbs/Breadcrumbs.tsx
|
|
701
|
-
var
|
|
702
|
+
var ve = i(({ breadcrumbs: e, navigationType: t, renderLink: n, className: r, strings: i, ...a }, o) => {
|
|
702
703
|
let s = e, c = s[s.length - 2], l = ge(["breadcrumbs"], i), u = [r, "pkt-breadcrumbs"].filter(Boolean).join(" "), d = n || (t === "router" ? ({ href: e, className: t, children: n, props: r }) => /* @__PURE__ */ _(y, {
|
|
703
704
|
to: e,
|
|
704
705
|
className: t,
|
|
@@ -754,44 +755,44 @@ var ye = i(({ breadcrumbs: e, navigationType: t, renderLink: n, className: r, st
|
|
|
754
755
|
})]
|
|
755
756
|
});
|
|
756
757
|
});
|
|
757
|
-
|
|
758
|
+
ve.displayName = "PktBreadcrumbs";
|
|
758
759
|
//#endregion
|
|
759
760
|
//#region ../../node_modules/date-fns/constants.js
|
|
760
|
-
var
|
|
761
|
-
|
|
762
|
-
var
|
|
761
|
+
var ye = 365.2425, be = 6048e5, xe = 864e5, Se = 86400;
|
|
762
|
+
Se * 7, Se * ye / 12 * 3;
|
|
763
|
+
var Ce = Symbol.for("constructDateFrom");
|
|
763
764
|
//#endregion
|
|
764
765
|
//#region ../../node_modules/date-fns/constructFrom.js
|
|
765
|
-
function
|
|
766
|
-
return typeof e == "function" ? e(t) : e && typeof e == "object" &&
|
|
766
|
+
function we(e, t) {
|
|
767
|
+
return typeof e == "function" ? e(t) : e && typeof e == "object" && Ce in e ? e[Ce](t) : e instanceof Date ? new e.constructor(t) : new Date(t);
|
|
767
768
|
}
|
|
768
769
|
//#endregion
|
|
769
770
|
//#region ../../node_modules/date-fns/toDate.js
|
|
770
|
-
function
|
|
771
|
-
return
|
|
771
|
+
function Te(e, t) {
|
|
772
|
+
return we(t || e, e);
|
|
772
773
|
}
|
|
773
774
|
//#endregion
|
|
774
775
|
//#region ../../node_modules/date-fns/addDays.js
|
|
775
|
-
function
|
|
776
|
-
let r =
|
|
777
|
-
return isNaN(t) ?
|
|
776
|
+
function Ee(e, t, n) {
|
|
777
|
+
let r = Te(e, n?.in);
|
|
778
|
+
return isNaN(t) ? we(n?.in || e, NaN) : (t && r.setDate(r.getDate() + t), r);
|
|
778
779
|
}
|
|
779
780
|
//#endregion
|
|
780
781
|
//#region ../../node_modules/date-fns/_lib/defaultOptions.js
|
|
781
|
-
var
|
|
782
|
-
function
|
|
783
|
-
return
|
|
782
|
+
var De = {};
|
|
783
|
+
function Oe() {
|
|
784
|
+
return De;
|
|
784
785
|
}
|
|
785
786
|
//#endregion
|
|
786
787
|
//#region ../../node_modules/date-fns/startOfWeek.js
|
|
787
|
-
function
|
|
788
|
-
let n =
|
|
788
|
+
function ke(e, t) {
|
|
789
|
+
let n = Oe(), r = t?.weekStartsOn ?? t?.locale?.options?.weekStartsOn ?? n.weekStartsOn ?? n.locale?.options?.weekStartsOn ?? 0, i = Te(e, t?.in), a = i.getDay(), o = (a < r ? 7 : 0) + a - r;
|
|
789
790
|
return i.setDate(i.getDate() - o), i.setHours(0, 0, 0, 0), i;
|
|
790
791
|
}
|
|
791
792
|
//#endregion
|
|
792
793
|
//#region ../../node_modules/date-fns/startOfISOWeek.js
|
|
793
794
|
function Ae(e, t) {
|
|
794
|
-
return
|
|
795
|
+
return ke(e, {
|
|
795
796
|
...t,
|
|
796
797
|
weekStartsOn: 1
|
|
797
798
|
});
|
|
@@ -799,9 +800,9 @@ function Ae(e, t) {
|
|
|
799
800
|
//#endregion
|
|
800
801
|
//#region ../../node_modules/date-fns/getISOWeekYear.js
|
|
801
802
|
function je(e, t) {
|
|
802
|
-
let n =
|
|
803
|
+
let n = Te(e, t?.in), r = n.getFullYear(), i = we(n, 0);
|
|
803
804
|
i.setFullYear(r + 1, 0, 4), i.setHours(0, 0, 0, 0);
|
|
804
|
-
let a = Ae(i), o =
|
|
805
|
+
let a = Ae(i), o = we(n, 0);
|
|
805
806
|
o.setFullYear(r, 0, 4), o.setHours(0, 0, 0, 0);
|
|
806
807
|
let s = Ae(o);
|
|
807
808
|
return n.getTime() >= a.getTime() ? r + 1 : n.getTime() >= s.getTime() ? r : r - 1;
|
|
@@ -809,31 +810,31 @@ function je(e, t) {
|
|
|
809
810
|
//#endregion
|
|
810
811
|
//#region ../../node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js
|
|
811
812
|
function Me(e) {
|
|
812
|
-
let t =
|
|
813
|
+
let t = Te(e), n = new Date(Date.UTC(t.getFullYear(), t.getMonth(), t.getDate(), t.getHours(), t.getMinutes(), t.getSeconds(), t.getMilliseconds()));
|
|
813
814
|
return n.setUTCFullYear(t.getFullYear()), e - +n;
|
|
814
815
|
}
|
|
815
816
|
//#endregion
|
|
816
817
|
//#region ../../node_modules/date-fns/_lib/normalizeDates.js
|
|
817
818
|
function Ne(e, ...t) {
|
|
818
|
-
let n =
|
|
819
|
+
let n = we.bind(null, e || t.find((e) => typeof e == "object"));
|
|
819
820
|
return t.map(n);
|
|
820
821
|
}
|
|
821
822
|
//#endregion
|
|
822
823
|
//#region ../../node_modules/date-fns/startOfDay.js
|
|
823
824
|
function Pe(e, t) {
|
|
824
|
-
let n =
|
|
825
|
+
let n = Te(e, t?.in);
|
|
825
826
|
return n.setHours(0, 0, 0, 0), n;
|
|
826
827
|
}
|
|
827
828
|
//#endregion
|
|
828
829
|
//#region ../../node_modules/date-fns/differenceInCalendarDays.js
|
|
829
830
|
function Fe(e, t, n) {
|
|
830
831
|
let [r, i] = Ne(n?.in, e, t), a = Pe(r), o = Pe(i), s = +a - Me(a), c = +o - Me(o);
|
|
831
|
-
return Math.round((s - c) /
|
|
832
|
+
return Math.round((s - c) / xe);
|
|
832
833
|
}
|
|
833
834
|
//#endregion
|
|
834
835
|
//#region ../../node_modules/date-fns/startOfISOWeekYear.js
|
|
835
836
|
function Ie(e, t) {
|
|
836
|
-
let n = je(e, t), r =
|
|
837
|
+
let n = je(e, t), r = we(t?.in || e, 0);
|
|
837
838
|
return r.setFullYear(n, 0, 4), r.setHours(0, 0, 0, 0), Ae(r);
|
|
838
839
|
}
|
|
839
840
|
//#endregion
|
|
@@ -844,12 +845,12 @@ function Le(e) {
|
|
|
844
845
|
//#endregion
|
|
845
846
|
//#region ../../node_modules/date-fns/isValid.js
|
|
846
847
|
function Re(e) {
|
|
847
|
-
return !(!Le(e) && typeof e != "number" || isNaN(+
|
|
848
|
+
return !(!Le(e) && typeof e != "number" || isNaN(+Te(e)));
|
|
848
849
|
}
|
|
849
850
|
//#endregion
|
|
850
851
|
//#region ../../node_modules/date-fns/endOfDay.js
|
|
851
852
|
function ze(e, t) {
|
|
852
|
-
let n =
|
|
853
|
+
let n = Te(e, t?.in);
|
|
853
854
|
return n.setHours(23, 59, 59, 999), n;
|
|
854
855
|
}
|
|
855
856
|
//#endregion
|
|
@@ -870,13 +871,13 @@ function Ve(e, t) {
|
|
|
870
871
|
if (!s) return [];
|
|
871
872
|
s < 0 && (s = -s, i = !i);
|
|
872
873
|
let c = [];
|
|
873
|
-
for (; +o <= a;) c.push(
|
|
874
|
+
for (; +o <= a;) c.push(we(n, o)), o.setDate(o.getDate() + s), o.setHours(0, 0, 0, 0);
|
|
874
875
|
return i ? c.reverse() : c;
|
|
875
876
|
}
|
|
876
877
|
//#endregion
|
|
877
878
|
//#region ../../node_modules/date-fns/startOfYear.js
|
|
878
879
|
function He(e, t) {
|
|
879
|
-
let n =
|
|
880
|
+
let n = Te(e, t?.in);
|
|
880
881
|
return n.setFullYear(n.getFullYear(), 0, 1), n.setHours(0, 0, 0, 0), n;
|
|
881
882
|
}
|
|
882
883
|
//#endregion
|
|
@@ -1380,36 +1381,36 @@ var tt = {
|
|
|
1380
1381
|
//#endregion
|
|
1381
1382
|
//#region ../../node_modules/date-fns/getDayOfYear.js
|
|
1382
1383
|
function nt(e, t) {
|
|
1383
|
-
let n =
|
|
1384
|
+
let n = Te(e, t?.in);
|
|
1384
1385
|
return Fe(n, He(n)) + 1;
|
|
1385
1386
|
}
|
|
1386
1387
|
//#endregion
|
|
1387
1388
|
//#region ../../node_modules/date-fns/getISOWeek.js
|
|
1388
1389
|
function rt(e, t) {
|
|
1389
|
-
let n =
|
|
1390
|
-
return Math.round(r /
|
|
1390
|
+
let n = Te(e, t?.in), r = Ae(n) - +Ie(n);
|
|
1391
|
+
return Math.round(r / be) + 1;
|
|
1391
1392
|
}
|
|
1392
1393
|
//#endregion
|
|
1393
1394
|
//#region ../../node_modules/date-fns/getWeekYear.js
|
|
1394
1395
|
function it(e, t) {
|
|
1395
|
-
let n =
|
|
1396
|
+
let n = Te(e, t?.in), r = n.getFullYear(), i = Oe(), a = t?.firstWeekContainsDate ?? t?.locale?.options?.firstWeekContainsDate ?? i.firstWeekContainsDate ?? i.locale?.options?.firstWeekContainsDate ?? 1, o = we(t?.in || e, 0);
|
|
1396
1397
|
o.setFullYear(r + 1, 0, a), o.setHours(0, 0, 0, 0);
|
|
1397
|
-
let s =
|
|
1398
|
+
let s = ke(o, t), c = we(t?.in || e, 0);
|
|
1398
1399
|
c.setFullYear(r, 0, a), c.setHours(0, 0, 0, 0);
|
|
1399
|
-
let l =
|
|
1400
|
+
let l = ke(c, t);
|
|
1400
1401
|
return +n >= +s ? r + 1 : +n >= +l ? r : r - 1;
|
|
1401
1402
|
}
|
|
1402
1403
|
//#endregion
|
|
1403
1404
|
//#region ../../node_modules/date-fns/startOfWeekYear.js
|
|
1404
1405
|
function at(e, t) {
|
|
1405
|
-
let n =
|
|
1406
|
-
return a.setFullYear(i, 0, r), a.setHours(0, 0, 0, 0),
|
|
1406
|
+
let n = Oe(), r = t?.firstWeekContainsDate ?? t?.locale?.options?.firstWeekContainsDate ?? n.firstWeekContainsDate ?? n.locale?.options?.firstWeekContainsDate ?? 1, i = it(e, t), a = we(t?.in || e, 0);
|
|
1407
|
+
return a.setFullYear(i, 0, r), a.setHours(0, 0, 0, 0), ke(a, t);
|
|
1407
1408
|
}
|
|
1408
1409
|
//#endregion
|
|
1409
1410
|
//#region ../../node_modules/date-fns/getWeek.js
|
|
1410
1411
|
function ot(e, t) {
|
|
1411
|
-
let n =
|
|
1412
|
-
return Math.round(r /
|
|
1412
|
+
let n = Te(e, t?.in), r = ke(n, t) - +at(n, t);
|
|
1413
|
+
return Math.round(r / be) + 1;
|
|
1413
1414
|
}
|
|
1414
1415
|
//#endregion
|
|
1415
1416
|
//#region ../../node_modules/date-fns/_lib/addLeadingZeros.js
|
|
@@ -1888,7 +1889,7 @@ function Ct(e, t, n) {
|
|
|
1888
1889
|
//#region ../../node_modules/date-fns/format.js
|
|
1889
1890
|
var wt = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g, Tt = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g, Et = /^'([^]*?)'?$/, Dt = /''/g, Ot = /[a-zA-Z]/;
|
|
1890
1891
|
function kt(e, t, n) {
|
|
1891
|
-
let r =
|
|
1892
|
+
let r = Oe(), i = n?.locale ?? r.locale ?? tt, a = n?.firstWeekContainsDate ?? n?.locale?.options?.firstWeekContainsDate ?? r.firstWeekContainsDate ?? r.locale?.options?.firstWeekContainsDate ?? 1, o = n?.weekStartsOn ?? n?.locale?.options?.weekStartsOn ?? r.weekStartsOn ?? r.locale?.options?.weekStartsOn ?? 0, s = Te(e, n?.in);
|
|
1892
1893
|
if (!Re(s)) throw RangeError("Invalid time value");
|
|
1893
1894
|
let c = t.match(Tt).map((e) => {
|
|
1894
1895
|
let t = e[0];
|
|
@@ -1938,7 +1939,7 @@ function At(e) {
|
|
|
1938
1939
|
//#endregion
|
|
1939
1940
|
//#region ../../node_modules/date-fns/getISODay.js
|
|
1940
1941
|
function jt(e, t) {
|
|
1941
|
-
let n =
|
|
1942
|
+
let n = Te(e, t?.in).getDay();
|
|
1942
1943
|
return n === 0 ? 7 : n;
|
|
1943
1944
|
}
|
|
1944
1945
|
//#endregion
|
|
@@ -2269,10 +2270,10 @@ function On(e) {
|
|
|
2269
2270
|
return t === "INPUT" || t === "SELECT" || t === "BUTTON" && !e.dataset?.date;
|
|
2270
2271
|
}
|
|
2271
2272
|
function kn(e, t, n) {
|
|
2272
|
-
let r =
|
|
2273
|
+
let r = Ee(e, t);
|
|
2273
2274
|
if (!r) return null;
|
|
2274
2275
|
let i = n(`button[data-date="${Yt(r)}"]`);
|
|
2275
|
-
for (; i instanceof HTMLButtonElement && i.dataset.disabled;) if (r =
|
|
2276
|
+
for (; i instanceof HTMLButtonElement && i.dataset.disabled;) if (r = Ee(r, t), i = n(`button[data-date="${Yt(r)}"]`), !i) return null;
|
|
2276
2277
|
return r;
|
|
2277
2278
|
}
|
|
2278
2279
|
function An(e) {
|
|
@@ -2290,7 +2291,7 @@ function jn(e) {
|
|
|
2290
2291
|
months: E.dates.months,
|
|
2291
2292
|
prevMonth: E.calendar.prevMonth,
|
|
2292
2293
|
nextMonth: E.calendar.nextMonth
|
|
2293
|
-
}), [E]), O = f(() => v ? Jt(v) : qt(), [v]), k = f(() => u ? u.map((e) => typeof e == "string" ? Jt(e) : e) : [], [u]), A = t !== void 0, [j, M] = m([]), N = A ? t : j, P = f(() => _n(N), [N]), [ee, te] = m(0), [ne, F] = m(0), [re, ie] = m({}), [ae, oe] = m(null), [se, I] = m(null), L = p(null), R = p([]), ce = p(0), z = p(!1), B = p(!1),
|
|
2294
|
+
}), [E]), O = f(() => v ? Jt(v) : qt(), [v]), k = f(() => u ? u.map((e) => typeof e == "string" ? Jt(e) : e) : [], [u]), A = t !== void 0, [j, M] = m([]), N = A ? t : j, P = f(() => _n(N), [N]), [ee, te] = m(0), [ne, F] = m(0), [re, ie] = m({}), [ae, oe] = m(null), [se, I] = m(null), L = p(null), R = p([]), ce = p(0), z = p(!1), B = p(!1), le = f(() => ({
|
|
2294
2295
|
earliest: a,
|
|
2295
2296
|
latest: s,
|
|
2296
2297
|
excludedates: k,
|
|
@@ -2326,9 +2327,9 @@ function jn(e) {
|
|
|
2326
2327
|
}, [N]), c(() => {
|
|
2327
2328
|
i && P.length === 2 ? ie(vn(P[0], P[1])) : (!i || P.length < 2) && ie({});
|
|
2328
2329
|
}, [i, P]);
|
|
2329
|
-
let
|
|
2330
|
+
let V = o((e) => {
|
|
2330
2331
|
A || M(e), b?.(e);
|
|
2331
|
-
}, [A, b]),
|
|
2332
|
+
}, [A, b]), H = o(() => {
|
|
2332
2333
|
x?.();
|
|
2333
2334
|
}, [x]), ue = o((e, t) => {
|
|
2334
2335
|
te(typeof e == "string" ? parseInt(e) : e), F(typeof t == "string" ? parseInt(t) : t), ce.current = 0, I(null), R.current = [], z.current = !0;
|
|
@@ -2339,23 +2340,23 @@ function jn(e) {
|
|
|
2339
2340
|
ee,
|
|
2340
2341
|
ne,
|
|
2341
2342
|
ue
|
|
2342
|
-
]),
|
|
2343
|
+
]), W = o(() => {
|
|
2343
2344
|
let e = ne === 11 ? 0 : ne + 1, t = ne === 11 ? ee + 1 : ee;
|
|
2344
2345
|
ue(t, e);
|
|
2345
2346
|
}, [
|
|
2346
2347
|
ee,
|
|
2347
2348
|
ne,
|
|
2348
2349
|
ue
|
|
2349
|
-
]),
|
|
2350
|
+
]), G = o((e) => pn(e, le), [le]), K = o((e, t) => mn(e, t, le, {
|
|
2350
2351
|
multiple: n,
|
|
2351
2352
|
maxMultiple: r,
|
|
2352
2353
|
selectedCount: N.length
|
|
2353
2354
|
}), [
|
|
2354
|
-
|
|
2355
|
+
le,
|
|
2355
2356
|
n,
|
|
2356
2357
|
r,
|
|
2357
2358
|
N.length
|
|
2358
|
-
]),
|
|
2359
|
+
]), q = o(() => typeof N == "string" ? N.split(",") : N, [N]), de = o((e) => {
|
|
2359
2360
|
if (!i || P.length !== 1 || !yn(e, P, k, d) || P[0] >= e) {
|
|
2360
2361
|
oe(null);
|
|
2361
2362
|
return;
|
|
@@ -2366,47 +2367,47 @@ function jn(e) {
|
|
|
2366
2367
|
P,
|
|
2367
2368
|
k,
|
|
2368
2369
|
d
|
|
2369
|
-
]),
|
|
2370
|
+
]), J = o((e) => {
|
|
2370
2371
|
if (!e) return;
|
|
2371
2372
|
let t;
|
|
2372
|
-
if (i) t = Cn(e,
|
|
2373
|
+
if (i) t = Cn(e, q(), {
|
|
2373
2374
|
excludedates: k,
|
|
2374
2375
|
excludeweekdays: d
|
|
2375
|
-
}), A || M(t), t.length === 2 ? (b?.(t),
|
|
2376
|
-
else if (n) t = Sn(e,
|
|
2376
|
+
}), A || M(t), t.length === 2 ? (b?.(t), H()) : (t.length === 1 && ie({}), b?.(t));
|
|
2377
|
+
else if (n) t = Sn(e, q(), r), V(t);
|
|
2377
2378
|
else {
|
|
2378
2379
|
let n = Yt(e);
|
|
2379
|
-
t = N.includes(n) ? [] : [n],
|
|
2380
|
+
t = N.includes(n) ? [] : [n], V(t), H();
|
|
2380
2381
|
}
|
|
2381
2382
|
}, [
|
|
2382
2383
|
i,
|
|
2383
2384
|
n,
|
|
2384
2385
|
r,
|
|
2385
|
-
|
|
2386
|
+
q,
|
|
2386
2387
|
N,
|
|
2387
2388
|
k,
|
|
2388
2389
|
d,
|
|
2389
2390
|
A,
|
|
2391
|
+
V,
|
|
2390
2392
|
H,
|
|
2391
|
-
le,
|
|
2392
2393
|
b
|
|
2393
|
-
]),
|
|
2394
|
-
let t = bn(e,
|
|
2395
|
-
A || M(t), i && t.length === 2 && (b?.(t),
|
|
2394
|
+
]), fe = o((e) => {
|
|
2395
|
+
let t = bn(e, q());
|
|
2396
|
+
A || M(t), i && t.length === 2 && (b?.(t), H());
|
|
2396
2397
|
}, [
|
|
2397
|
-
|
|
2398
|
+
q,
|
|
2398
2399
|
A,
|
|
2399
2400
|
i,
|
|
2400
2401
|
b,
|
|
2401
|
-
|
|
2402
|
-
]),
|
|
2403
|
-
let t = xn(e,
|
|
2402
|
+
H
|
|
2403
|
+
]), pe = o((e) => {
|
|
2404
|
+
let t = xn(e, q());
|
|
2404
2405
|
A || M(t);
|
|
2405
|
-
}, [
|
|
2406
|
-
let t = Sn(e,
|
|
2406
|
+
}, [q, A]), me = o((e) => {
|
|
2407
|
+
let t = Sn(e, q(), r);
|
|
2407
2408
|
A || M(t);
|
|
2408
2409
|
}, [
|
|
2409
|
-
|
|
2410
|
+
q,
|
|
2410
2411
|
r,
|
|
2411
2412
|
A
|
|
2412
2413
|
]), Y = o(() => {
|
|
@@ -2420,7 +2421,7 @@ function jn(e) {
|
|
|
2420
2421
|
let e = L.current?.querySelector(`button[data-date="${n.currentDateISO}"]`);
|
|
2421
2422
|
e instanceof HTMLButtonElement && (I(n.currentDateISO), e.focus());
|
|
2422
2423
|
}
|
|
2423
|
-
}, []),
|
|
2424
|
+
}, []), X = o((e, t) => {
|
|
2424
2425
|
let n = e.target;
|
|
2425
2426
|
if (On(n)) return;
|
|
2426
2427
|
if (e.preventDefault(), !se) {
|
|
@@ -2453,34 +2454,34 @@ function jn(e) {
|
|
|
2453
2454
|
excludedates: k,
|
|
2454
2455
|
excludeweekdays: d,
|
|
2455
2456
|
className: C,
|
|
2456
|
-
dateConstraints:
|
|
2457
|
+
dateConstraints: le,
|
|
2457
2458
|
calendarRef: L,
|
|
2458
2459
|
selectableDatesRef: R,
|
|
2459
2460
|
tabIndexSetRef: ce,
|
|
2460
2461
|
prevMonth: U,
|
|
2461
|
-
nextMonth:
|
|
2462
|
+
nextMonth: W,
|
|
2462
2463
|
changeMonth: ue,
|
|
2463
|
-
handleDateSelect:
|
|
2464
|
-
addToSelected:
|
|
2465
|
-
removeFromSelected:
|
|
2466
|
-
toggleSelectedDate:
|
|
2467
|
-
handleRangeHover:
|
|
2468
|
-
isExcluded:
|
|
2469
|
-
isDayDisabled:
|
|
2464
|
+
handleDateSelect: J,
|
|
2465
|
+
addToSelected: fe,
|
|
2466
|
+
removeFromSelected: pe,
|
|
2467
|
+
toggleSelectedDate: me,
|
|
2468
|
+
handleRangeHover: de,
|
|
2469
|
+
isExcluded: G,
|
|
2470
|
+
isDayDisabled: K,
|
|
2470
2471
|
focusOnCurrentDate: Y,
|
|
2471
2472
|
handleKeydown: o((e) => {
|
|
2472
2473
|
if (e.key === "Escape") {
|
|
2473
|
-
e.preventDefault(),
|
|
2474
|
+
e.preventDefault(), H();
|
|
2474
2475
|
return;
|
|
2475
2476
|
}
|
|
2476
2477
|
let t = An(e.key);
|
|
2477
|
-
t !== null &&
|
|
2478
|
-
}, [
|
|
2478
|
+
t !== null && X(e.nativeEvent, t);
|
|
2479
|
+
}, [H, X]),
|
|
2479
2480
|
handleFocusOut: o((e) => {
|
|
2480
2481
|
let t = e.target, n = e.relatedTarget;
|
|
2481
|
-
L.current && L.current.contains(n) || t.classList.contains("pkt-hide") || t.closest(".pkt-cal-month-picker") ||
|
|
2482
|
-
}, [
|
|
2483
|
-
close:
|
|
2482
|
+
L.current && L.current.contains(n) || t.classList.contains("pkt-hide") || t.closest(".pkt-cal-month-picker") || H();
|
|
2483
|
+
}, [H]),
|
|
2484
|
+
close: H,
|
|
2484
2485
|
setFocusedDate: I
|
|
2485
2486
|
};
|
|
2486
2487
|
}
|
|
@@ -2954,91 +2955,96 @@ var Gn = i(({ children: e, className: t, ariaLabel: n, metaLead: r, borderOnHove
|
|
|
2954
2955
|
});
|
|
2955
2956
|
Gn.displayName = "PktCard";
|
|
2956
2957
|
//#endregion
|
|
2958
|
+
//#region ../../shared-utils/utils.ts
|
|
2959
|
+
var Kn = () => ("00000000000000000" + (Math.random() * 0x10000000000000000).toString(16)).slice(-16), qn = () => {
|
|
2960
|
+
let e = Kn(), t = Kn();
|
|
2961
|
+
return e.slice(0, 8) + "-" + e.slice(8, 12) + "-4" + e.slice(13) + "-a" + t.slice(1, 4) + "-" + t.slice(4);
|
|
2962
|
+
};
|
|
2963
|
+
//#endregion
|
|
2964
|
+
//#region src/hooks/useGeneratedId.ts
|
|
2965
|
+
function Jn(e) {
|
|
2966
|
+
let t = f(() => qn(), []);
|
|
2967
|
+
return e || t;
|
|
2968
|
+
}
|
|
2969
|
+
//#endregion
|
|
2957
2970
|
//#region src/components/checkbox/Checkbox.tsx
|
|
2958
|
-
var
|
|
2959
|
-
let
|
|
2971
|
+
var Yn = i(({ id: e, hasTile: t = !1, disabled: n = !1, label: r, checkHelptext: i, hasError: a = !1, className: o, isSwitch: s = !1, hideLabel: l = !1, labelPosition: u = "right", defaultChecked: d, checked: f, indeterminate: m, optionalTag: h, optionalText: y, requiredTag: b, requiredText: x, strings: S, tagText: C, "aria-describedby": w, ...T }, E) => {
|
|
2972
|
+
let D = ge(["forms"], S), O = Jn(e), k = p(null);
|
|
2960
2973
|
c(() => {
|
|
2961
|
-
|
|
2974
|
+
k.current && m !== void 0 && (k.current.indeterminate = m);
|
|
2962
2975
|
}, [m]), c(() => {
|
|
2963
|
-
typeof
|
|
2964
|
-
}, [
|
|
2965
|
-
let
|
|
2976
|
+
typeof E == "function" ? E(k.current) : E && (E.current = k.current);
|
|
2977
|
+
}, [E]);
|
|
2978
|
+
let A = [o, "pkt-input-check"].filter(Boolean).join(" "), j = [
|
|
2966
2979
|
"pkt-input-check__input-label",
|
|
2967
2980
|
u === "left" ? "pkt-input-check__input-label--left" : "",
|
|
2968
2981
|
n ? "pkt-input-check__input-label--disabled" : "",
|
|
2969
2982
|
`pkt-input-check__input-label--${u}`,
|
|
2970
2983
|
l ? "pkt-sr-only" : ""
|
|
2971
|
-
].filter(Boolean).join(" "),
|
|
2984
|
+
].filter(Boolean).join(" "), M = [
|
|
2972
2985
|
"pkt-input-check__input",
|
|
2973
2986
|
t ? "pkt-input-check__input--tile" : "",
|
|
2974
2987
|
n && t ? "pkt-input-check__input--tile-disabled" : ""
|
|
2975
|
-
].filter(Boolean).join(" "),
|
|
2988
|
+
].filter(Boolean).join(" "), N = [
|
|
2976
2989
|
"pkt-tag",
|
|
2977
2990
|
"pkt-tag--small",
|
|
2978
2991
|
"pkt-tag--thin-text"
|
|
2979
|
-
].join(" "),
|
|
2992
|
+
].join(" "), P = () => /* @__PURE__ */ v(g, { children: [
|
|
2980
2993
|
C && /* @__PURE__ */ _("span", {
|
|
2981
|
-
className:
|
|
2994
|
+
className: N + " pkt-tag--gray",
|
|
2982
2995
|
children: C
|
|
2983
2996
|
}),
|
|
2984
2997
|
h && /* @__PURE__ */ _("span", {
|
|
2985
|
-
className:
|
|
2986
|
-
children: y ??
|
|
2998
|
+
className: N + " pkt-tag--blue-light",
|
|
2999
|
+
children: y ?? D.forms.optional
|
|
2987
3000
|
}),
|
|
2988
3001
|
b && /* @__PURE__ */ _("span", {
|
|
2989
|
-
className:
|
|
2990
|
-
children: x ??
|
|
3002
|
+
className: N + " pkt-tag--beige",
|
|
3003
|
+
children: x ?? D.forms.required
|
|
2991
3004
|
})
|
|
2992
|
-
] })
|
|
3005
|
+
] }), ee = `${O}-check-label`, te = `${O}-check-helptext`, ne = [i ? te : void 0, w].filter(Boolean).join(" ") || void 0, F = () => /* @__PURE__ */ v("label", {
|
|
3006
|
+
className: j,
|
|
3007
|
+
htmlFor: O,
|
|
3008
|
+
children: [/* @__PURE__ */ v("span", {
|
|
3009
|
+
id: ee,
|
|
3010
|
+
children: [
|
|
3011
|
+
r,
|
|
3012
|
+
" ",
|
|
3013
|
+
P()
|
|
3014
|
+
]
|
|
3015
|
+
}), i && /* @__PURE__ */ _("div", {
|
|
3016
|
+
id: te,
|
|
3017
|
+
className: "pkt-input-check__input-helptext",
|
|
3018
|
+
children: i
|
|
3019
|
+
})]
|
|
3020
|
+
});
|
|
2993
3021
|
return /* @__PURE__ */ _("div", {
|
|
2994
|
-
className:
|
|
3022
|
+
className: A,
|
|
2995
3023
|
children: /* @__PURE__ */ v("div", {
|
|
2996
|
-
className:
|
|
3024
|
+
className: M,
|
|
2997
3025
|
children: [
|
|
2998
|
-
u === "left" &&
|
|
2999
|
-
className: k,
|
|
3000
|
-
htmlFor: e,
|
|
3001
|
-
children: [
|
|
3002
|
-
r,
|
|
3003
|
-
" ",
|
|
3004
|
-
M(),
|
|
3005
|
-
i && /* @__PURE__ */ _("div", {
|
|
3006
|
-
className: "pkt-input-check__input-helptext",
|
|
3007
|
-
children: i
|
|
3008
|
-
})
|
|
3009
|
-
]
|
|
3010
|
-
}),
|
|
3026
|
+
u === "left" && F(),
|
|
3011
3027
|
/* @__PURE__ */ _("input", {
|
|
3012
3028
|
role: s ? "switch" : "checkbox",
|
|
3013
|
-
ref:
|
|
3029
|
+
ref: k,
|
|
3014
3030
|
className: `pkt-input-check__input-checkbox ${a ? "pkt-input-check__input-checkbox--error" : ""}`,
|
|
3015
3031
|
type: "checkbox",
|
|
3016
|
-
id:
|
|
3032
|
+
id: O,
|
|
3017
3033
|
disabled: n,
|
|
3034
|
+
"aria-labelledby": r ? ee : void 0,
|
|
3035
|
+
"aria-describedby": ne,
|
|
3018
3036
|
...f === void 0 ? { defaultChecked: d } : { checked: f },
|
|
3019
|
-
...
|
|
3037
|
+
...T
|
|
3020
3038
|
}),
|
|
3021
|
-
u === "right" &&
|
|
3022
|
-
className: k,
|
|
3023
|
-
htmlFor: e,
|
|
3024
|
-
children: [
|
|
3025
|
-
r,
|
|
3026
|
-
" ",
|
|
3027
|
-
M(),
|
|
3028
|
-
i && /* @__PURE__ */ _("div", {
|
|
3029
|
-
className: "pkt-input-check__input-helptext",
|
|
3030
|
-
children: i
|
|
3031
|
-
})
|
|
3032
|
-
]
|
|
3033
|
-
})
|
|
3039
|
+
u === "right" && F()
|
|
3034
3040
|
]
|
|
3035
3041
|
})
|
|
3036
3042
|
});
|
|
3037
3043
|
});
|
|
3038
|
-
|
|
3044
|
+
Yn.displayName = "PktCheckbox";
|
|
3039
3045
|
//#endregion
|
|
3040
3046
|
//#region src/hooks/useFocusModality.ts
|
|
3041
|
-
function
|
|
3047
|
+
function Xn(e) {
|
|
3042
3048
|
let t = p(null), n = p(!1), r = p(void 0), i = (e) => {
|
|
3043
3049
|
let n = t.current;
|
|
3044
3050
|
n && (e === void 0 ? delete n.dataset.navtype : n.dataset.navtype = e);
|
|
@@ -3064,14 +3070,11 @@ function qn(e) {
|
|
|
3064
3070
|
}
|
|
3065
3071
|
//#endregion
|
|
3066
3072
|
//#region ../../shared-utils/forms/described-by.ts
|
|
3067
|
-
var
|
|
3073
|
+
var Zn = (e) => {
|
|
3068
3074
|
let t = [];
|
|
3069
3075
|
return e.hasHelptext && t.push(`${e.id}-helptext`), e.hasCounter && t.push(`${e.id}-counter-status`), e.ariaDescribedby && t.push(e.ariaDescribedby), t.length ? t.join(" ") : void 0;
|
|
3070
|
-
},
|
|
3071
|
-
let
|
|
3072
|
-
return e.slice(0, 8) + "-" + e.slice(8, 12) + "-4" + e.slice(13) + "-a" + t.slice(1, 4) + "-" + t.slice(4);
|
|
3073
|
-
}, $n = "Les mer <span class='pkt-sr-only'>om feltet</span>", er = (e) => e == null || e === "" ? null : typeof e == "string" ? /* @__PURE__ */ _("span", { dangerouslySetInnerHTML: { __html: e } }) : e, tr = i(function({ helptext: e, helptextDropdown: t, helptextDropdownButton: n, forId: r, onToggleHelpText: i, className: a, children: o, ...s }, c) {
|
|
3074
|
-
let [l, u] = m(!1), d = f(() => Qn(), []), p = r || d, h = () => {
|
|
3076
|
+
}, Qn = (e) => `${e}-counter-status`, $n = (e, t) => !!t && t > 0 && (e ?? 0) > t, er = "Les mer <span class='pkt-sr-only'>om feltet</span>", tr = (e) => e == null || e === "" ? null : typeof e == "string" ? /* @__PURE__ */ _("span", { dangerouslySetInnerHTML: { __html: e } }) : e, nr = i(function({ helptext: e, helptextDropdown: t, helptextDropdownButton: n, forId: r, onToggleHelpText: i, className: a, children: o, ...s }, c) {
|
|
3077
|
+
let [l, u] = m(!1), d = f(() => qn(), []), p = r || d, h = () => {
|
|
3075
3078
|
let e = !l;
|
|
3076
3079
|
u(e), i?.(e);
|
|
3077
3080
|
}, g = (0, M.default)("pkt-inputwrapper__helptext-container", !!(e || t || o) && "pkt-inputwrapper__has-helptext", a);
|
|
@@ -3085,7 +3088,7 @@ var Jn = (e) => {
|
|
|
3085
3088
|
children: [o && /* @__PURE__ */ _("div", {
|
|
3086
3089
|
className: "pkt-contents",
|
|
3087
3090
|
children: o
|
|
3088
|
-
}),
|
|
3091
|
+
}), tr(e)]
|
|
3089
3092
|
}), t && /* @__PURE__ */ v("div", {
|
|
3090
3093
|
className: "pkt-inputwrapper__helptext-expandable",
|
|
3091
3094
|
children: [/* @__PURE__ */ v("button", {
|
|
@@ -3099,21 +3102,21 @@ var Jn = (e) => {
|
|
|
3099
3102
|
name: l ? "chevron-thin-up" : "chevron-thin-down"
|
|
3100
3103
|
}), /* @__PURE__ */ _("span", {
|
|
3101
3104
|
className: "pkt-btn__text",
|
|
3102
|
-
dangerouslySetInnerHTML: { __html: n ??
|
|
3105
|
+
dangerouslySetInnerHTML: { __html: n ?? er }
|
|
3103
3106
|
})]
|
|
3104
3107
|
}), /* @__PURE__ */ _("div", {
|
|
3105
3108
|
id: `${p}-helptext-expandable`,
|
|
3106
3109
|
className: (0, M.default)("pkt-inputwrapper__helptext", l ? "pkt-inputwrapper__helptext-expandable-open" : "pkt-inputwrapper__helptext-expandable-closed"),
|
|
3107
|
-
children:
|
|
3110
|
+
children: tr(t)
|
|
3108
3111
|
})]
|
|
3109
3112
|
})]
|
|
3110
3113
|
});
|
|
3111
3114
|
});
|
|
3112
|
-
|
|
3115
|
+
nr.displayName = "PktHelptext";
|
|
3113
3116
|
//#endregion
|
|
3114
3117
|
//#region src/components/inputwrapper/InputWrapper.tsx
|
|
3115
|
-
var
|
|
3116
|
-
let j =
|
|
3118
|
+
var rr = i(({ forId: e, label: t, helptext: n, helptextDropdown: r, helptextDropdownButton: i, counter: a, counterCurrent: o = 0, counterMaxLength: s, optionalTag: c = !1, optionalText: l, requiredTag: u = !1, requiredText: d, tagText: p = null, hasError: m = !1, errorMessage: h, disabled: y = !1, inline: b = !1, ariaDescribedby: x, useWrapper: S = !0, children: C, className: w = "", hasFieldset: T = !1, role: E, counterPosition: D = "bottom", size: O = "medium", strings: k }, A) => {
|
|
3119
|
+
let j = Xn(A), M = ge(["forms", "validation"], k), N = f(() => qn(), []), P = e || N, ee = x || (n ? `${P}-helptext` : void 0), te = !!a, ne = te && D === "top", F = te && D === "bottom", re = [
|
|
3117
3120
|
"pkt-inputwrapper",
|
|
3118
3121
|
w,
|
|
3119
3122
|
m ? "pkt-inputwrapper--error" : "",
|
|
@@ -3124,13 +3127,13 @@ var nr = i(({ forId: e, label: t, helptext: n, helptextDropdown: r, helptextDrop
|
|
|
3124
3127
|
"pkt-tag",
|
|
3125
3128
|
"pkt-tag--small",
|
|
3126
3129
|
"pkt-tag--thin-text"
|
|
3127
|
-
].join(" "), ae =
|
|
3130
|
+
].join(" "), ae = $n(o, s), oe = () => te ? /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ v("div", {
|
|
3128
3131
|
className: "pkt-input__counter",
|
|
3129
3132
|
"aria-hidden": "true",
|
|
3130
3133
|
children: [o, s ? `/${s}` : ""]
|
|
3131
3134
|
}), /* @__PURE__ */ _("div", {
|
|
3132
3135
|
className: "pkt-sr-only",
|
|
3133
|
-
id:
|
|
3136
|
+
id: Qn(P),
|
|
3134
3137
|
"aria-live": "polite",
|
|
3135
3138
|
children: ae ? B(M.validation.counterExceeded, {
|
|
3136
3139
|
current: o,
|
|
@@ -3172,7 +3175,7 @@ var nr = i(({ forId: e, label: t, helptext: n, helptextDropdown: r, helptextDrop
|
|
|
3172
3175
|
});
|
|
3173
3176
|
}, L = () => {
|
|
3174
3177
|
let e = S ? n : void 0;
|
|
3175
|
-
return !e && !r ? null : /* @__PURE__ */ _(
|
|
3178
|
+
return !e && !r ? null : /* @__PURE__ */ _(nr, {
|
|
3176
3179
|
forId: P,
|
|
3177
3180
|
helptext: e,
|
|
3178
3181
|
helptextDropdown: r,
|
|
@@ -3186,7 +3189,7 @@ var nr = i(({ forId: e, label: t, helptext: n, helptextDropdown: r, helptextDrop
|
|
|
3186
3189
|
F && /* @__PURE__ */ _(oe, {}),
|
|
3187
3190
|
m && h && /* @__PURE__ */ _("div", {
|
|
3188
3191
|
className: "pkt-inputwrapper__alert-wrapper",
|
|
3189
|
-
children: /* @__PURE__ */ _(
|
|
3192
|
+
children: /* @__PURE__ */ _($, {
|
|
3190
3193
|
skin: "error",
|
|
3191
3194
|
size: R,
|
|
3192
3195
|
"aria-live": "assertive",
|
|
@@ -3211,25 +3214,25 @@ var nr = i(({ forId: e, label: t, helptext: n, helptextDropdown: r, helptextDrop
|
|
|
3211
3214
|
})
|
|
3212
3215
|
});
|
|
3213
3216
|
});
|
|
3214
|
-
|
|
3217
|
+
rr.displayName = "PktInputWrapper";
|
|
3215
3218
|
//#endregion
|
|
3216
3219
|
//#region ../../shared-utils/combobox/option-utils.ts
|
|
3217
|
-
var
|
|
3220
|
+
var ir = (e, t) => t && (e.find((e) => e.value === t) || e.find((e) => e.label === t)) || null, ar = (e, t) => {
|
|
3218
3221
|
if (!t) return -1;
|
|
3219
3222
|
let n = e.findIndex((e) => e.value === t);
|
|
3220
3223
|
return n >= 0 ? n : e.findIndex((e) => e.label === t);
|
|
3221
|
-
},
|
|
3224
|
+
}, or = (e, t) => {
|
|
3222
3225
|
if (!t) return [...e];
|
|
3223
3226
|
let n = t.toLowerCase();
|
|
3224
3227
|
return e.filter((e) => (e.fulltext || e.value + (e.label || "") + (e.prefix || "")).toLowerCase().includes(n));
|
|
3225
|
-
},
|
|
3228
|
+
}, sr = (e) => e.value + (e.label || "") + (e.prefix || ""), cr = (e, t) => t !== null && e >= t, lr = (e, t) => {
|
|
3226
3229
|
if (!e) return "";
|
|
3227
3230
|
switch (t) {
|
|
3228
3231
|
case "prefixAndValue": return `${e.prefix || ""} ${e.value}`.trim();
|
|
3229
3232
|
case "value": return e.value;
|
|
3230
3233
|
default: return e.label || e.value;
|
|
3231
3234
|
}
|
|
3232
|
-
},
|
|
3235
|
+
}, ur = (e, t) => e ? Array.isArray(e) ? t ? e : e.length > 0 ? [e[0]] : [] : t ? e.split(",").filter(Boolean) : [e] : [], dr = (e, t) => {
|
|
3233
3236
|
if (!t) return {
|
|
3234
3237
|
filtered: [...e],
|
|
3235
3238
|
suggestion: null
|
|
@@ -3239,7 +3242,7 @@ var rr = (e, t) => t && (e.find((e) => e.value === t) || e.find((e) => e.label =
|
|
|
3239
3242
|
filtered: r,
|
|
3240
3243
|
suggestion: r.find((e) => !e.selected && e.label?.toLowerCase().startsWith(n)) || null
|
|
3241
3244
|
};
|
|
3242
|
-
},
|
|
3245
|
+
}, fr = (e, t, n, r) => {
|
|
3243
3246
|
if (!e.trim()) return {
|
|
3244
3247
|
addValueText: null,
|
|
3245
3248
|
userInfoMessage: ""
|
|
@@ -3258,7 +3261,7 @@ var rr = (e, t) => t && (e.find((e) => e.value === t) || e.find((e) => e.label =
|
|
|
3258
3261
|
addValueText: null,
|
|
3259
3262
|
userInfoMessage: ""
|
|
3260
3263
|
};
|
|
3261
|
-
},
|
|
3264
|
+
}, pr = (e, t, n) => {
|
|
3262
3265
|
switch (e) {
|
|
3263
3266
|
case ",": return n ? "addValue" : null;
|
|
3264
3267
|
case "Enter": return "addValue";
|
|
@@ -3267,12 +3270,12 @@ var rr = (e, t) => t && (e.find((e) => e.value === t) || e.find((e) => e.label =
|
|
|
3267
3270
|
case "Escape": return "closeOptions";
|
|
3268
3271
|
default: return null;
|
|
3269
3272
|
}
|
|
3270
|
-
},
|
|
3273
|
+
}, mr = (e, t, n, r, i) => {
|
|
3271
3274
|
if (!e) return {
|
|
3272
3275
|
action: "none",
|
|
3273
3276
|
value: null
|
|
3274
3277
|
};
|
|
3275
|
-
let a =
|
|
3278
|
+
let a = ir(n, e);
|
|
3276
3279
|
return !t.includes(e) && !a ? r ? {
|
|
3277
3280
|
action: "addUserValue",
|
|
3278
3281
|
value: e
|
|
@@ -3289,36 +3292,36 @@ var rr = (e, t) => t && (e.find((e) => e.value === t) || e.find((e) => e.label =
|
|
|
3289
3292
|
action: "none",
|
|
3290
3293
|
value: null
|
|
3291
3294
|
};
|
|
3292
|
-
},
|
|
3293
|
-
let r =
|
|
3295
|
+
}, hr = (e, t, n) => {
|
|
3296
|
+
let r = ir(t, e);
|
|
3294
3297
|
return n === "label" && r?.label ? r.label : e;
|
|
3295
|
-
},
|
|
3298
|
+
}, gr = (e) => {
|
|
3296
3299
|
e.scrollIntoView({ block: "nearest" }), window.setTimeout(() => e.focus(), 0);
|
|
3297
|
-
},
|
|
3300
|
+
}, _r = (e) => Array.from(e.querySelectorAll("[role=\"option\"]:not([data-disabled])") || []), vr = (e) => {
|
|
3298
3301
|
let t = e.nextElementSibling;
|
|
3299
|
-
t &&
|
|
3300
|
-
},
|
|
3302
|
+
t && gr(t);
|
|
3303
|
+
}, yr = (e, t, n) => {
|
|
3301
3304
|
let r = e.previousElementSibling;
|
|
3302
3305
|
if (e.dataset.index === "0" && n) {
|
|
3303
3306
|
let e = t.querySelector("[role=\"searchbox\"]");
|
|
3304
|
-
e &&
|
|
3305
|
-
} else r &&
|
|
3306
|
-
},
|
|
3307
|
-
let t =
|
|
3308
|
-
t[0] &&
|
|
3309
|
-
},
|
|
3307
|
+
e && gr(e);
|
|
3308
|
+
} else r && gr(r);
|
|
3309
|
+
}, br = (e) => {
|
|
3310
|
+
let t = _r(e);
|
|
3311
|
+
t[0] && gr(t[0]);
|
|
3312
|
+
}, xr = (e, t) => {
|
|
3310
3313
|
if (t.disabled) return;
|
|
3311
|
-
let n =
|
|
3314
|
+
let n = _r(e);
|
|
3312
3315
|
if (t.allowUserInput && t.customUserInput) {
|
|
3313
3316
|
let t = e.querySelector("[data-type=\"new-option\"]");
|
|
3314
3317
|
if (t) {
|
|
3315
|
-
|
|
3318
|
+
gr(t);
|
|
3316
3319
|
return;
|
|
3317
3320
|
}
|
|
3318
3321
|
}
|
|
3319
3322
|
let r = n.find((e) => e.dataset.selected === "true");
|
|
3320
3323
|
if (r) {
|
|
3321
|
-
|
|
3324
|
+
gr(r);
|
|
3322
3325
|
return;
|
|
3323
3326
|
}
|
|
3324
3327
|
if (t.includeSearch && !(document.activeElement instanceof HTMLInputElement)) {
|
|
@@ -3328,8 +3331,8 @@ var rr = (e, t) => t && (e.find((e) => e.value === t) || e.find((e) => e.label =
|
|
|
3328
3331
|
return;
|
|
3329
3332
|
}
|
|
3330
3333
|
}
|
|
3331
|
-
n[0] &&
|
|
3332
|
-
},
|
|
3334
|
+
n[0] && gr(n[0]);
|
|
3335
|
+
}, Sr = ({ state: e, outside: t = !1 }) => {
|
|
3333
3336
|
let { values: n, options: r, disabled: i, displayValueAs: a, handleTagRemove: o, handleTagKeydown: s, focusedTagIndex: l } = e, u = p([]);
|
|
3334
3337
|
if (c(() => {
|
|
3335
3338
|
!t && l >= 0 && l < n.length && u.current[l]?.focus();
|
|
@@ -3339,7 +3342,7 @@ var rr = (e, t) => t && (e.find((e) => e.value === t) || e.find((e) => e.label =
|
|
|
3339
3342
|
n.length
|
|
3340
3343
|
]), n.length === 0) return null;
|
|
3341
3344
|
let d = n.map((e, n) => {
|
|
3342
|
-
let c =
|
|
3345
|
+
let c = ir(r, e), d = c?.tagSkinColor, f = c ? lr(c, a) : e;
|
|
3343
3346
|
return i ? /* @__PURE__ */ _("li", {
|
|
3344
3347
|
role: "listitem",
|
|
3345
3348
|
children: /* @__PURE__ */ _(Wn, {
|
|
@@ -3392,58 +3395,62 @@ var rr = (e, t) => t && (e.find((e) => e.value === t) || e.find((e) => e.label =
|
|
|
3392
3395
|
className: "pkt-combobox__tag-list",
|
|
3393
3396
|
children: d
|
|
3394
3397
|
});
|
|
3395
|
-
},
|
|
3398
|
+
}, Cr = ({ state: e }) => {
|
|
3396
3399
|
let { values: t, options: n, editingSingleValue: r, displayValueAs: i } = e;
|
|
3397
3400
|
if (r || t.length === 0) return null;
|
|
3398
|
-
let a =
|
|
3401
|
+
let a = ir(n, t[0]);
|
|
3399
3402
|
if (!a) return null;
|
|
3400
|
-
let o =
|
|
3403
|
+
let o = lr(a, i);
|
|
3401
3404
|
return /* @__PURE__ */ _("span", {
|
|
3402
3405
|
className: "pkt-combobox__value",
|
|
3403
3406
|
children: o
|
|
3404
3407
|
});
|
|
3405
|
-
},
|
|
3406
|
-
let { id: t, inputId: n, listboxId: r, values: i, options: a, isOpen: o, multiple: s, typeahead: c, allowUserInput: l, tagPlacement: u, placeholder: d, disabled: f, fullwidth: p, hasError: m, label: h, inputFocus: g,
|
|
3408
|
+
}, wr = ({ state: e }) => {
|
|
3409
|
+
let { id: t, inputId: n, listboxId: r, values: i, options: a, isOpen: o, multiple: s, typeahead: c, allowUserInput: l, tagPlacement: u, placeholder: d, disabled: f, fullwidth: p, hasError: m, label: h, inputFocus: g, skipInputTab: y, restoreInputTab: b, inputRef: x, triggerRef: S, handleInputChange: C, handleInputKeydown: w, handleInputFocus: T, handleInputBlur: E, handleInputClick: D, handlePlaceholderClick: O, handleSelectOnlyKeydown: k, name: A, inputSize: j } = e, M = [
|
|
3407
3410
|
"pkt-combobox__input",
|
|
3408
|
-
`pkt-combobox__input--${
|
|
3411
|
+
`pkt-combobox__input--${j}`,
|
|
3409
3412
|
p && "pkt-combobox__input--fullwidth",
|
|
3410
3413
|
o && "pkt-combobox__input--open",
|
|
3411
3414
|
m && "pkt-combobox__input--error",
|
|
3412
3415
|
f && "pkt-combobox__input--disabled"
|
|
3413
|
-
].filter(Boolean).join(" "),
|
|
3416
|
+
].filter(Boolean).join(" "), N = ["pkt-combobox__arrow-icon", o && "pkt-combobox__arrow-icon--open"].filter(Boolean).join(" "), P = c || l, ee = !P && d && (!i.length || s && u === "outside") && !g, te = u !== "outside", ne = o && i[0] && ir(a, i[0]) ? `${r}-${ar(a, i[0])}` : void 0, F = s && i.length > 0 ? `${i.length} valgt` : void 0, re = P ? { tabIndex: -1 } : {
|
|
3414
3417
|
id: `${t}-combobox`,
|
|
3415
3418
|
role: "combobox",
|
|
3416
3419
|
"aria-expanded": o ? "true" : "false",
|
|
3417
3420
|
"aria-controls": r,
|
|
3418
3421
|
"aria-haspopup": "listbox",
|
|
3419
3422
|
"aria-labelledby": `${t}-combobox-label`,
|
|
3420
|
-
"aria-activedescendant":
|
|
3421
|
-
"aria-description":
|
|
3423
|
+
"aria-activedescendant": ne,
|
|
3424
|
+
"aria-description": F,
|
|
3422
3425
|
tabIndex: f ? -1 : 0,
|
|
3423
|
-
onKeyDown:
|
|
3426
|
+
onKeyDown: k
|
|
3424
3427
|
};
|
|
3425
3428
|
return /* @__PURE__ */ v("div", {
|
|
3426
|
-
ref:
|
|
3427
|
-
className:
|
|
3428
|
-
onClick:
|
|
3429
|
-
|
|
3429
|
+
ref: S,
|
|
3430
|
+
className: M,
|
|
3431
|
+
onClick: D,
|
|
3432
|
+
onBlur: (e) => {
|
|
3433
|
+
e.target === e.currentTarget && b();
|
|
3434
|
+
},
|
|
3435
|
+
...re,
|
|
3430
3436
|
children: [
|
|
3431
|
-
|
|
3437
|
+
ee ? /* @__PURE__ */ _("span", {
|
|
3432
3438
|
className: "pkt-combobox__placeholder",
|
|
3433
|
-
onClick:
|
|
3439
|
+
onClick: O,
|
|
3434
3440
|
children: d
|
|
3435
|
-
}) :
|
|
3436
|
-
|
|
3441
|
+
}) : te ? s ? /* @__PURE__ */ _(Sr, { state: e }) : P ? null : /* @__PURE__ */ _(Cr, { state: e }) : null,
|
|
3442
|
+
P ? /* @__PURE__ */ _("div", {
|
|
3437
3443
|
className: "pkt-combobox__input-div combobox__input",
|
|
3438
3444
|
children: /* @__PURE__ */ _("input", {
|
|
3439
|
-
ref:
|
|
3445
|
+
ref: x,
|
|
3440
3446
|
type: "text",
|
|
3441
3447
|
id: n,
|
|
3442
|
-
name: `${
|
|
3443
|
-
onChange:
|
|
3444
|
-
onKeyDown:
|
|
3445
|
-
onFocus:
|
|
3446
|
-
onBlur:
|
|
3448
|
+
name: `${A || t}-input`,
|
|
3449
|
+
onChange: C,
|
|
3450
|
+
onKeyDown: w,
|
|
3451
|
+
onFocus: T,
|
|
3452
|
+
onBlur: E,
|
|
3453
|
+
tabIndex: y ? -1 : void 0,
|
|
3447
3454
|
placeholder: !i.length || s && u === "outside" ? d : void 0,
|
|
3448
3455
|
autoComplete: "off",
|
|
3449
3456
|
role: "combobox",
|
|
@@ -3451,26 +3458,25 @@ var rr = (e, t) => t && (e.find((e) => e.value === t) || e.find((e) => e.label =
|
|
|
3451
3458
|
"aria-label": h,
|
|
3452
3459
|
"aria-autocomplete": c ? "both" : l ? "list" : "none",
|
|
3453
3460
|
"aria-controls": r,
|
|
3454
|
-
"aria-activedescendant":
|
|
3455
|
-
"aria-description":
|
|
3461
|
+
"aria-activedescendant": ne,
|
|
3462
|
+
"aria-description": F,
|
|
3456
3463
|
disabled: f
|
|
3457
3464
|
})
|
|
3458
3465
|
}) : /* @__PURE__ */ _("input", {
|
|
3459
|
-
ref:
|
|
3466
|
+
ref: x,
|
|
3460
3467
|
type: "hidden",
|
|
3461
3468
|
id: n,
|
|
3462
|
-
name: `${
|
|
3463
|
-
value: i.join(",")
|
|
3464
|
-
readOnly: !0
|
|
3469
|
+
name: `${A || t}-input`,
|
|
3470
|
+
value: i.join(",")
|
|
3465
3471
|
}),
|
|
3466
3472
|
/* @__PURE__ */ _(L, {
|
|
3467
|
-
className:
|
|
3473
|
+
className: N,
|
|
3468
3474
|
name: "chevron-thin-down",
|
|
3469
3475
|
"aria-hidden": "true"
|
|
3470
3476
|
})
|
|
3471
3477
|
]
|
|
3472
3478
|
});
|
|
3473
|
-
},
|
|
3479
|
+
}, Tr = ({ state: e }) => {
|
|
3474
3480
|
let t = ge(["listbox"], e.strings), { listboxId: n, label: r, isOpen: i, options: a, filteredOptions: o, multiple: s, disabled: c, maxIsReached: l, maxlength: u, includeSearch: d, allowUserInput: f, addValueText: p, userInfoMessage: m, searchPlaceholder: h, searchValue: y, handleOptionClick: b, handleOptionKeydown: x, handleSearchInput: S, handleSearchKeydown: C, handleNewOptionClick: w, handleNewOptionKeydown: T, listboxRef: E } = e, D = o.filter((e) => e.selected).length, O = s && D > 0 && u != null && u > 0, k = f && p && !l, A = !!m, j = [
|
|
3475
3481
|
"pkt-listbox",
|
|
3476
3482
|
i && "pkt-listbox__open",
|
|
@@ -3574,10 +3580,11 @@ var rr = (e, t) => t && (e.find((e) => e.value === t) || e.find((e) => e.label =
|
|
|
3574
3580
|
s ? /* @__PURE__ */ _("input", {
|
|
3575
3581
|
className: "pkt-input-check__input-checkbox",
|
|
3576
3582
|
type: "checkbox",
|
|
3583
|
+
inert: !0,
|
|
3577
3584
|
tabIndex: -1,
|
|
3578
3585
|
value: e.value,
|
|
3579
3586
|
checked: e.selected || !1,
|
|
3580
|
-
|
|
3587
|
+
onChange: () => {},
|
|
3581
3588
|
"aria-hidden": "true",
|
|
3582
3589
|
disabled: i
|
|
3583
3590
|
}) : e.selected ? /* @__PURE__ */ _(L, { name: "check-big" }) : null,
|
|
@@ -3605,18 +3612,22 @@ var rr = (e, t) => t && (e.find((e) => e.value === t) || e.find((e) => e.label =
|
|
|
3605
3612
|
};
|
|
3606
3613
|
//#endregion
|
|
3607
3614
|
//#region src/components/combobox/useComboboxState.ts
|
|
3608
|
-
function
|
|
3615
|
+
function Er(e, t) {
|
|
3609
3616
|
return e.map((e) => ({
|
|
3610
3617
|
...e,
|
|
3611
3618
|
label: e.label || e.value,
|
|
3612
|
-
fulltext:
|
|
3619
|
+
fulltext: sr(e),
|
|
3613
3620
|
selected: t.includes(e.value)
|
|
3614
3621
|
}));
|
|
3615
3622
|
}
|
|
3616
|
-
function
|
|
3617
|
-
let { id: r = "", label: i, value: s, defaultValue: l, options: d, defaultOptions: h, multiple: g = !1, maxlength: _, typeahead: v = !1, includeSearch: y = !1, allowUserInput: b = !1, displayValueAs: x = "label", tagPlacement: S, searchPlaceholder: C, placeholder: w, disabled: T = !1, required: E = !1, fullwidth: D = !1, hasError: O = !1, errorMessage: k, helptext: A, helptextDropdown: j, helptextDropdownButton: M, optionalTag: N = !1, optionalText: P, requiredTag: ee = !1, requiredText: te, tagText: ne, useWrapper: F = !0, inline: re = !1, counter: ie, inputSize: ae = "medium", name: oe, className: se, onChange: I, onValueChange: L, children: R, strings: ce } = t, z = `${r}-input`,
|
|
3618
|
-
V ? H.current?.focus() :
|
|
3619
|
-
}, [V]),
|
|
3623
|
+
function Dr(t, n) {
|
|
3624
|
+
let { id: r = "", label: i, value: s, defaultValue: l, options: d, defaultOptions: h, multiple: g = !1, maxlength: _, typeahead: v = !1, includeSearch: y = !1, allowUserInput: b = !1, displayValueAs: x = "label", tagPlacement: S, searchPlaceholder: C, placeholder: w, disabled: T = !1, required: E = !1, fullwidth: D = !1, hasError: O = !1, errorMessage: k, helptext: A, helptextDropdown: j, helptextDropdownButton: M, optionalTag: N = !1, optionalText: P, requiredTag: ee = !1, requiredText: te, tagText: ne, useWrapper: F = !0, inline: re = !1, counter: ie, inputSize: ae = "medium", name: oe, className: se, onChange: I, onValueChange: L, children: R, strings: ce } = t, z = `${r}-input`, le = `${r}-listbox`, V = v || b, H = p(null), ue = p(null), U = p(null), W = p(null), G = p(null), K = o(() => {
|
|
3625
|
+
V ? H.current?.focus() : U.current?.focus();
|
|
3626
|
+
}, [V]), q = o(() => {
|
|
3627
|
+
je(!0);
|
|
3628
|
+
let e = H.current;
|
|
3629
|
+
e && e.type !== "hidden" && e.setAttribute("tabindex", "-1"), U.current?.focus();
|
|
3630
|
+
}, []), de = f(() => {
|
|
3620
3631
|
let t = [];
|
|
3621
3632
|
return e.forEach(R, (e) => {
|
|
3622
3633
|
if (a(e) && e.type === "option") {
|
|
@@ -3629,90 +3640,93 @@ function Er(t, n) {
|
|
|
3629
3640
|
});
|
|
3630
3641
|
}
|
|
3631
3642
|
}), t;
|
|
3632
|
-
}, [R]),
|
|
3643
|
+
}, [R]), J = f(() => h && h.length > 0 ? h.map((e) => ({
|
|
3633
3644
|
...e,
|
|
3634
|
-
fulltext:
|
|
3645
|
+
fulltext: sr(e)
|
|
3635
3646
|
})) : d && d.length > 0 ? d.map((e) => ({
|
|
3636
3647
|
...e,
|
|
3637
|
-
fulltext:
|
|
3638
|
-
})) :
|
|
3648
|
+
fulltext: sr(e)
|
|
3649
|
+
})) : de.length > 0 ? de.map((e) => ({
|
|
3639
3650
|
...e,
|
|
3640
|
-
fulltext:
|
|
3651
|
+
fulltext: sr(e)
|
|
3641
3652
|
})) : [], [
|
|
3642
3653
|
h,
|
|
3643
3654
|
d,
|
|
3644
|
-
|
|
3645
|
-
]), fe = s !== void 0, [
|
|
3655
|
+
de
|
|
3656
|
+
]), fe = s !== void 0, [pe, me] = m(() => {
|
|
3657
|
+
let e = ur(s ?? l, g), t = J.filter((t) => t.selected && !e.includes(t.value)).map((e) => e.value);
|
|
3658
|
+
return t.length ? g ? [...e, ...t] : e.length ? e : [t[0]] : e;
|
|
3659
|
+
}), Y = p(pe);
|
|
3646
3660
|
c(() => {
|
|
3647
|
-
fe &&
|
|
3661
|
+
fe && me(ur(s, g));
|
|
3648
3662
|
}, [
|
|
3649
3663
|
s,
|
|
3650
3664
|
fe,
|
|
3651
3665
|
g
|
|
3652
3666
|
]);
|
|
3653
|
-
let
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
|
|
3657
|
-
]), [
|
|
3658
|
-
|
|
3659
|
-
|
|
3667
|
+
let X = fe ? ur(s, g) : pe, [Z, he] = m([]), Q = f(() => Er([...Z.filter((e) => !J.some((t) => t.value === e.value)), ...J], X), [
|
|
3668
|
+
J,
|
|
3669
|
+
Z,
|
|
3670
|
+
X
|
|
3671
|
+
]), [$, _e] = m(!1), [ve, ye] = m(""), [be, xe] = m(""), [Se, Ce] = m(""), [we, Te] = m(null), [Ee, De] = m(null), [Oe, ke] = m(!1), [Ae, je] = m(!1), Me = p(!1), [Ne, Pe] = m(!1), [Fe, Ie] = m(-1), Le = ge(["combobox"], ce), Re = Se ? B(Le.combobox[Se], { value: we ?? "" }) : "", ze = cr(X.length, _ ?? null), Be = ie ?? (g && _ != null), Ve = f(() => ve ? v ? dr(Q, ve).filtered : or(Q, ve) : Q, [
|
|
3672
|
+
Q,
|
|
3673
|
+
ve,
|
|
3660
3674
|
v
|
|
3661
|
-
]),
|
|
3662
|
-
let t =
|
|
3663
|
-
if (!t || !
|
|
3675
|
+
]), He = f(() => Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value")?.set, []), Ue = o((e) => {
|
|
3676
|
+
let t = ue.current;
|
|
3677
|
+
if (!t || !He) return;
|
|
3664
3678
|
let n = g ? e.join(",") : e[0] || "";
|
|
3665
|
-
|
|
3666
|
-
}, [
|
|
3679
|
+
He.call(t, n), t.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
3680
|
+
}, [He, g]), We = g ? X.join(",") : X[0] || "";
|
|
3667
3681
|
c(() => {
|
|
3668
|
-
|
|
3669
|
-
}, [
|
|
3670
|
-
if (
|
|
3671
|
-
let e = !g &&
|
|
3682
|
+
ue.current && (ue.current.value = We);
|
|
3683
|
+
}, [We]), c(() => {
|
|
3684
|
+
if ($ || !H.current) return;
|
|
3685
|
+
let e = !g && X[0] ? hr(X[0], Q, x) : "";
|
|
3672
3686
|
H.current.value !== e && (H.current.value = e);
|
|
3673
3687
|
}, [
|
|
3674
|
-
J,
|
|
3675
3688
|
X,
|
|
3689
|
+
Q,
|
|
3676
3690
|
x,
|
|
3677
3691
|
g,
|
|
3678
|
-
|
|
3692
|
+
$
|
|
3679
3693
|
]);
|
|
3680
|
-
let
|
|
3681
|
-
fe ||
|
|
3694
|
+
let Ge = o((e, t = !0) => {
|
|
3695
|
+
fe || me(e), t && (L?.(e), Ue(e));
|
|
3682
3696
|
}, [
|
|
3683
3697
|
fe,
|
|
3684
3698
|
L,
|
|
3685
|
-
|
|
3686
|
-
]),
|
|
3687
|
-
if (!e ||
|
|
3688
|
-
if (g &&
|
|
3689
|
-
|
|
3699
|
+
Ue
|
|
3700
|
+
]), Ke = o((e) => {
|
|
3701
|
+
if (!e || X.includes(e)) return;
|
|
3702
|
+
if (g && cr(X.length, _ ?? null)) {
|
|
3703
|
+
Ce("maxSelected");
|
|
3690
3704
|
return;
|
|
3691
3705
|
}
|
|
3692
|
-
let t = g ? [...
|
|
3693
|
-
|
|
3706
|
+
let t = g ? [...X, e] : [e];
|
|
3707
|
+
Ge(t);
|
|
3694
3708
|
}, [
|
|
3695
|
-
|
|
3709
|
+
X,
|
|
3696
3710
|
g,
|
|
3697
3711
|
_,
|
|
3698
|
-
|
|
3699
|
-
]),
|
|
3712
|
+
Ge
|
|
3713
|
+
]), qe = o((e) => {
|
|
3700
3714
|
if (!e) return;
|
|
3701
|
-
let t =
|
|
3702
|
-
|
|
3715
|
+
let t = X.filter((t) => t !== e);
|
|
3716
|
+
ir(Q, e)?.userAdded && he((t) => t.filter((t) => t.value !== e)), Ge(t);
|
|
3703
3717
|
}, [
|
|
3704
|
-
J,
|
|
3705
3718
|
X,
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
|
|
3719
|
+
Q,
|
|
3720
|
+
Ge
|
|
3721
|
+
]), Je = o(() => {
|
|
3722
|
+
he([]), Ge([]);
|
|
3723
|
+
}, [Ge]), Ye = o((e) => {
|
|
3710
3724
|
if (!e || e.trim() === "") return;
|
|
3711
3725
|
let t;
|
|
3712
3726
|
if (!g) t = [e];
|
|
3713
3727
|
else {
|
|
3714
|
-
if (
|
|
3715
|
-
t = [...
|
|
3728
|
+
if (ir(Q, e) || cr(X.length, _ ?? null)) return;
|
|
3729
|
+
t = [...X, e];
|
|
3716
3730
|
}
|
|
3717
3731
|
let n = {
|
|
3718
3732
|
value: e,
|
|
@@ -3720,180 +3734,182 @@ function Er(t, n) {
|
|
|
3720
3734
|
userAdded: !0,
|
|
3721
3735
|
selected: !0
|
|
3722
3736
|
};
|
|
3723
|
-
he((t) => [n, ...t.filter((t) => t.value !== e)]),
|
|
3737
|
+
he((t) => [n, ...t.filter((t) => t.value !== e)]), Ge(t);
|
|
3724
3738
|
}, [
|
|
3725
3739
|
g,
|
|
3740
|
+
Q,
|
|
3726
3741
|
X,
|
|
3727
|
-
J,
|
|
3728
3742
|
_,
|
|
3729
|
-
|
|
3730
|
-
]),
|
|
3731
|
-
if (
|
|
3732
|
-
|
|
3733
|
-
let e = t === void 0 ?
|
|
3734
|
-
!g && e ? H.current.value =
|
|
3743
|
+
Ge
|
|
3744
|
+
]), Xe = o((e = !0, t) => {
|
|
3745
|
+
if (De(null), e && H.current && H.current.type !== "hidden") {
|
|
3746
|
+
ye(""), xe("");
|
|
3747
|
+
let e = t === void 0 ? X[0] : t;
|
|
3748
|
+
!g && e ? H.current.value = hr(e, Q, x) : H.current.value = "", g || (Pe(!1), Ce(""));
|
|
3735
3749
|
}
|
|
3736
3750
|
}, [
|
|
3737
3751
|
g,
|
|
3738
|
-
J,
|
|
3739
3752
|
X,
|
|
3753
|
+
Q,
|
|
3740
3754
|
x
|
|
3741
|
-
]),
|
|
3755
|
+
]), Ze = o((e) => {
|
|
3742
3756
|
if (T) return;
|
|
3743
|
-
|
|
3744
|
-
let t =
|
|
3745
|
-
i || (!r && b && !a ? (
|
|
3746
|
-
|
|
3747
|
-
}, 0))
|
|
3757
|
+
Ce(""), De(null);
|
|
3758
|
+
let t = ir(Q, e)?.value || null, n = X.includes(e || t || ""), r = !!t, i = Q.find((t) => t.value === e)?.disabled || !1, a = !e?.trim(), o = !g, s = g, c = cr(X.length, _ ?? null), l = !1, u = !0, d = "", f = null, p = "", m;
|
|
3759
|
+
i || (!r && b && !a ? (Ye(e), d = "valueAdded", l = s, o && (m = e || "")) : !r && !b ? (o && X[0] && qe(X[0]), u = !1, l = !0, d = "noResults") : n ? (qe(t), l = !0, m = "", o && V && H.current && H.current.type !== "hidden" && (H.current.value = "")) : a && o ? (Je(), l = !0, m = "") : o ? (X[0] && qe(X[0]), Ke(t), l = !1, m = t || "", d = "valueSelected", f = V ? hr(t || "", Q, x) : lr(ir(Q, t), x)) : s && !c ? (Ke(t), l = !0) : s && c ? (d = "maxSelected", u = !1, p = e || "") : (o && Je(), d = "noValidValue", u = !1, l = !0, p = e || "", m = ""), _e(l), ye(p), Xe(u, m), Ce(d), Te(f), l || window.setTimeout(() => {
|
|
3760
|
+
q();
|
|
3761
|
+
}, 0));
|
|
3748
3762
|
}, [
|
|
3749
3763
|
T,
|
|
3764
|
+
Q,
|
|
3750
3765
|
X,
|
|
3751
|
-
J,
|
|
3752
3766
|
g,
|
|
3753
3767
|
_,
|
|
3754
3768
|
b,
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3769
|
+
Ye,
|
|
3770
|
+
qe,
|
|
3771
|
+
Je,
|
|
3772
|
+
Ke,
|
|
3773
|
+
Xe,
|
|
3774
|
+
q,
|
|
3775
|
+
V,
|
|
3776
|
+
x
|
|
3777
|
+
]), Qe = o(() => {
|
|
3778
|
+
if (ke(!1), De(null), Ce(""), ye(""), H.current && H.current.type !== "hidden") {
|
|
3779
|
+
let e = H.current.value, t = X[0];
|
|
3764
3780
|
if (!g) {
|
|
3765
|
-
if (!e)
|
|
3781
|
+
if (!e) X[0] && qe(X[0]), t = void 0;
|
|
3766
3782
|
else {
|
|
3767
|
-
let n =
|
|
3768
|
-
n && n.value !==
|
|
3783
|
+
let n = ir(Q, e);
|
|
3784
|
+
n && n.value !== X[0] ? (X[0] && qe(X[0]), Ke(n.value), t = n.value) : !n && b && (X[0] && qe(X[0]), Ye(e), t = e);
|
|
3769
3785
|
}
|
|
3770
3786
|
} else if (e !== "") {
|
|
3771
|
-
let { action: t, value: n } =
|
|
3787
|
+
let { action: t, value: n } = mr(e, X, Q, b, g);
|
|
3772
3788
|
switch (t) {
|
|
3773
3789
|
case "addUserValue":
|
|
3774
|
-
|
|
3790
|
+
Ye(n);
|
|
3775
3791
|
break;
|
|
3776
3792
|
case "selectOption":
|
|
3777
|
-
|
|
3793
|
+
Ke(n);
|
|
3778
3794
|
break;
|
|
3779
|
-
case "removeValue":
|
|
3795
|
+
case "removeValue": qe(n);
|
|
3780
3796
|
}
|
|
3781
3797
|
}
|
|
3782
|
-
!g && t ? H.current.value =
|
|
3798
|
+
!g && t ? H.current.value = hr(t, Q, x) : H.current.value = "";
|
|
3783
3799
|
}
|
|
3784
|
-
|
|
3800
|
+
_e(!1), Pe(!1);
|
|
3785
3801
|
}, [
|
|
3786
|
-
J,
|
|
3787
3802
|
X,
|
|
3803
|
+
Q,
|
|
3788
3804
|
b,
|
|
3789
3805
|
g,
|
|
3790
3806
|
x,
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
|
|
3794
|
-
]),
|
|
3807
|
+
Ye,
|
|
3808
|
+
Ke,
|
|
3809
|
+
qe
|
|
3810
|
+
]), $e = o((e) => {
|
|
3795
3811
|
if (!e.trim().toLowerCase()) {
|
|
3796
|
-
|
|
3812
|
+
De(null), Ce(""), !g && X[0] && qe(X[0]);
|
|
3797
3813
|
return;
|
|
3798
3814
|
}
|
|
3799
|
-
let t =
|
|
3800
|
-
|
|
3815
|
+
let t = fr(e, X, Q, b);
|
|
3816
|
+
De(t.addValueText), Ce(t.userInfoMessage);
|
|
3801
3817
|
}, [
|
|
3802
|
-
J,
|
|
3803
3818
|
X,
|
|
3819
|
+
Q,
|
|
3804
3820
|
b,
|
|
3805
3821
|
g,
|
|
3806
|
-
|
|
3807
|
-
]),
|
|
3822
|
+
qe
|
|
3823
|
+
]), et = o((e) => {
|
|
3808
3824
|
if (T) return;
|
|
3809
3825
|
let t = e.target.value;
|
|
3810
|
-
if (
|
|
3811
|
-
let { suggestion: n } =
|
|
3826
|
+
if (xe(t), ye(t), $e(t), v && t) {
|
|
3827
|
+
let { suggestion: n } = dr(Q, t);
|
|
3812
3828
|
n?.label && H.current && !e.nativeEvent.inputType?.includes("deleteContent") && (H.current.value = n.label, window.setTimeout(() => H.current?.setSelectionRange(t.length, n.label.length), 0));
|
|
3813
3829
|
}
|
|
3814
3830
|
}, [
|
|
3815
3831
|
T,
|
|
3816
3832
|
v,
|
|
3817
|
-
|
|
3818
|
-
|
|
3819
|
-
]),
|
|
3833
|
+
Q,
|
|
3834
|
+
$e
|
|
3835
|
+
]), tt = o((e) => {
|
|
3820
3836
|
if (e.key === "Backspace") {
|
|
3821
3837
|
let t = !H.current?.value;
|
|
3822
|
-
if (!
|
|
3838
|
+
if (!ve && t && g && X.length > 0) {
|
|
3823
3839
|
e.preventDefault();
|
|
3824
|
-
let t =
|
|
3825
|
-
|
|
3840
|
+
let t = X[X.length - 1];
|
|
3841
|
+
qe(t);
|
|
3826
3842
|
}
|
|
3827
3843
|
return;
|
|
3828
3844
|
}
|
|
3829
|
-
if (e.key === "ArrowLeft" && g &&
|
|
3830
|
-
e.preventDefault(),
|
|
3845
|
+
if (e.key === "ArrowLeft" && g && X.length > 0 && (H.current?.selectionStart ?? 0) === 0 && !H.current?.value) {
|
|
3846
|
+
e.preventDefault(), Ie(X.length - 1);
|
|
3831
3847
|
return;
|
|
3832
3848
|
}
|
|
3833
|
-
let t =
|
|
3834
|
-
if (t && !(e.key === "Tab" &&
|
|
3835
|
-
if (t === "focusListbox" && e.key === "Tab" && !
|
|
3836
|
-
|
|
3849
|
+
let t = pr(e.key, e.shiftKey, g);
|
|
3850
|
+
if (t && !(e.key === "Tab" && !$)) {
|
|
3851
|
+
if (t === "focusListbox" && e.key === "Tab" && !W.current?.querySelector("[role=\"option\"]:not([data-disabled]), [data-type=\"new-option\"]")) {
|
|
3852
|
+
Qe();
|
|
3837
3853
|
return;
|
|
3838
3854
|
}
|
|
3839
3855
|
switch (e.preventDefault(), t) {
|
|
3840
3856
|
case "addValue": {
|
|
3841
3857
|
let e = H.current?.value.trim() || "";
|
|
3842
|
-
if (
|
|
3843
|
-
|
|
3858
|
+
if (ye(e), e && X.includes(e)) {
|
|
3859
|
+
Xe(!0), Ce("alreadySelected");
|
|
3844
3860
|
break;
|
|
3845
3861
|
}
|
|
3846
|
-
|
|
3862
|
+
Ze(e);
|
|
3847
3863
|
break;
|
|
3848
3864
|
}
|
|
3849
3865
|
case "focusListbox":
|
|
3850
|
-
|
|
3866
|
+
W.current && ($ || _e(!0), xr(W.current, {
|
|
3851
3867
|
disabled: T,
|
|
3852
3868
|
allowUserInput: b,
|
|
3853
|
-
customUserInput:
|
|
3869
|
+
customUserInput: Ee,
|
|
3854
3870
|
includeSearch: y
|
|
3855
3871
|
}));
|
|
3856
3872
|
break;
|
|
3857
|
-
case "closeOptions":
|
|
3873
|
+
case "closeOptions": _e(!1);
|
|
3858
3874
|
}
|
|
3859
3875
|
}
|
|
3860
3876
|
}, [
|
|
3861
|
-
|
|
3862
|
-
|
|
3877
|
+
ve,
|
|
3878
|
+
X,
|
|
3863
3879
|
g,
|
|
3864
3880
|
T,
|
|
3865
3881
|
b,
|
|
3866
|
-
|
|
3882
|
+
Ee,
|
|
3867
3883
|
y,
|
|
3868
|
-
|
|
3869
|
-
|
|
3870
|
-
|
|
3871
|
-
|
|
3872
|
-
]),
|
|
3884
|
+
$,
|
|
3885
|
+
qe,
|
|
3886
|
+
Ze,
|
|
3887
|
+
K
|
|
3888
|
+
]), nt = o(() => {
|
|
3873
3889
|
if (!T) {
|
|
3874
|
-
if (
|
|
3875
|
-
|
|
3890
|
+
if (je(!1), Me.current) {
|
|
3891
|
+
Me.current = !1, ke(!0);
|
|
3876
3892
|
return;
|
|
3877
3893
|
}
|
|
3878
|
-
!g &&
|
|
3894
|
+
!g && X[0] && H.current && H.current.type !== "hidden" && (Pe(!0), H.current.value = hr(X[0], Q, x)), ke(!0), ye(""), _e(!0);
|
|
3879
3895
|
}
|
|
3880
3896
|
}, [
|
|
3881
3897
|
T,
|
|
3882
3898
|
g,
|
|
3883
|
-
J,
|
|
3884
3899
|
X,
|
|
3900
|
+
Q,
|
|
3885
3901
|
x
|
|
3886
|
-
]),
|
|
3887
|
-
|
|
3888
|
-
}, []),
|
|
3889
|
-
if (T ||
|
|
3890
|
-
let t = e.relatedTarget, n =
|
|
3891
|
-
n && t && n.contains(t) ||
|
|
3902
|
+
]), rt = o(() => {
|
|
3903
|
+
ke(!1), Pe(!1);
|
|
3904
|
+
}, []), it = o((e) => {
|
|
3905
|
+
if (T || !$) return;
|
|
3906
|
+
let t = e.relatedTarget, n = G.current;
|
|
3907
|
+
n && t && n.contains(t) || Qe();
|
|
3892
3908
|
}, [
|
|
3893
3909
|
T,
|
|
3894
|
-
|
|
3895
|
-
|
|
3896
|
-
]),
|
|
3910
|
+
$,
|
|
3911
|
+
Qe
|
|
3912
|
+
]), at = o((e) => {
|
|
3897
3913
|
if (T) {
|
|
3898
3914
|
e.preventDefault(), e.stopPropagation();
|
|
3899
3915
|
return;
|
|
@@ -3901,208 +3917,216 @@ function Er(t, n) {
|
|
|
3901
3917
|
if (V) H.current?.focus();
|
|
3902
3918
|
else {
|
|
3903
3919
|
e.stopPropagation(), e.preventDefault();
|
|
3904
|
-
let t =
|
|
3905
|
-
|
|
3920
|
+
let t = !$;
|
|
3921
|
+
_e(t), t && W.current && xr(W.current, {
|
|
3906
3922
|
disabled: T,
|
|
3907
3923
|
allowUserInput: b,
|
|
3908
|
-
customUserInput:
|
|
3924
|
+
customUserInput: Ee,
|
|
3909
3925
|
includeSearch: y
|
|
3910
3926
|
});
|
|
3911
3927
|
}
|
|
3912
3928
|
}, [
|
|
3913
3929
|
T,
|
|
3914
3930
|
V,
|
|
3915
|
-
|
|
3931
|
+
$,
|
|
3916
3932
|
b,
|
|
3917
|
-
|
|
3933
|
+
Ee,
|
|
3918
3934
|
y
|
|
3919
|
-
]),
|
|
3920
|
-
T || (e.stopPropagation(), V && H.current ? (H.current.focus(),
|
|
3921
|
-
}, [T, V]),
|
|
3935
|
+
]), ot = o((e) => {
|
|
3936
|
+
T || (e.stopPropagation(), V && H.current ? (H.current.focus(), ke(!0)) : _e((e) => !e));
|
|
3937
|
+
}, [T, V]), st = o((e) => {
|
|
3922
3938
|
if (!T) switch (e.key) {
|
|
3923
3939
|
case "Enter":
|
|
3924
3940
|
case " ":
|
|
3925
3941
|
case "ArrowDown":
|
|
3926
3942
|
case "ArrowUp":
|
|
3927
|
-
e.preventDefault(),
|
|
3928
|
-
|
|
3943
|
+
e.preventDefault(), $ ? _e(!1) : (_e(!0), W.current && window.setTimeout(() => {
|
|
3944
|
+
W.current && xr(W.current, {
|
|
3929
3945
|
disabled: T,
|
|
3930
|
-
allowUserInput: b && !
|
|
3931
|
-
customUserInput:
|
|
3946
|
+
allowUserInput: b && !ze,
|
|
3947
|
+
customUserInput: Ee,
|
|
3932
3948
|
includeSearch: y
|
|
3933
3949
|
});
|
|
3934
3950
|
}, 0));
|
|
3935
3951
|
break;
|
|
3936
3952
|
case "Escape":
|
|
3937
|
-
|
|
3953
|
+
$ && (e.preventDefault(), _e(!1));
|
|
3938
3954
|
break;
|
|
3939
3955
|
case "Home":
|
|
3940
3956
|
case "End":
|
|
3941
|
-
e.preventDefault(),
|
|
3942
|
-
|
|
3957
|
+
e.preventDefault(), $ || _e(!0), W.current && window.setTimeout(() => {
|
|
3958
|
+
W.current && xr(W.current, {
|
|
3943
3959
|
disabled: T,
|
|
3944
|
-
allowUserInput: b && !
|
|
3945
|
-
customUserInput:
|
|
3960
|
+
allowUserInput: b && !ze,
|
|
3961
|
+
customUserInput: Ee,
|
|
3946
3962
|
includeSearch: y
|
|
3947
3963
|
});
|
|
3948
3964
|
}, 0);
|
|
3949
3965
|
break;
|
|
3950
3966
|
case "ArrowLeft":
|
|
3951
|
-
g &&
|
|
3967
|
+
g && X.length > 0 && (e.preventDefault(), Ie(X.length - 1));
|
|
3952
3968
|
break;
|
|
3953
3969
|
case "Backspace":
|
|
3954
|
-
case "Delete": if (g &&
|
|
3970
|
+
case "Delete": if (g && X.length > 0) {
|
|
3955
3971
|
e.preventDefault();
|
|
3956
|
-
let t =
|
|
3957
|
-
|
|
3972
|
+
let t = X[X.length - 1];
|
|
3973
|
+
qe(t);
|
|
3958
3974
|
}
|
|
3959
3975
|
}
|
|
3960
3976
|
}, [
|
|
3961
3977
|
T,
|
|
3962
|
-
|
|
3978
|
+
$,
|
|
3963
3979
|
b,
|
|
3964
|
-
|
|
3965
|
-
|
|
3980
|
+
ze,
|
|
3981
|
+
Ee,
|
|
3966
3982
|
y,
|
|
3967
3983
|
g,
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
]),
|
|
3971
|
-
|
|
3972
|
-
}, [
|
|
3984
|
+
X,
|
|
3985
|
+
qe
|
|
3986
|
+
]), ct = o((e) => {
|
|
3987
|
+
Ze(e);
|
|
3988
|
+
}, [Ze]), lt = o((e, t) => {
|
|
3973
3989
|
switch (e.key) {
|
|
3974
3990
|
case "Enter":
|
|
3975
3991
|
case " ":
|
|
3976
|
-
e.preventDefault(),
|
|
3992
|
+
e.preventDefault(), Ze(t);
|
|
3977
3993
|
break;
|
|
3978
3994
|
case "ArrowDown":
|
|
3979
|
-
e.preventDefault(),
|
|
3995
|
+
e.preventDefault(), vr(e.currentTarget);
|
|
3980
3996
|
break;
|
|
3981
3997
|
case "ArrowUp":
|
|
3982
|
-
e.preventDefault(),
|
|
3998
|
+
e.preventDefault(), W.current && yr(e.currentTarget, W.current, y);
|
|
3983
3999
|
break;
|
|
3984
4000
|
case "Escape":
|
|
3985
|
-
e.preventDefault(),
|
|
4001
|
+
e.preventDefault(), _e(!1), V && (Me.current = !0), K();
|
|
3986
4002
|
break;
|
|
3987
|
-
case "Tab":
|
|
4003
|
+
case "Tab": Qe();
|
|
3988
4004
|
}
|
|
3989
4005
|
}, [
|
|
3990
|
-
|
|
4006
|
+
Ze,
|
|
3991
4007
|
y,
|
|
3992
|
-
|
|
3993
|
-
|
|
3994
|
-
|
|
3995
|
-
|
|
3996
|
-
|
|
4008
|
+
K,
|
|
4009
|
+
Qe,
|
|
4010
|
+
V
|
|
4011
|
+
]), ut = o((e) => {
|
|
4012
|
+
qe(e), Ie(-1), V && H.current && (ke(!0), H.current.focus());
|
|
4013
|
+
}, [qe, V]), dt = o((e, t) => {
|
|
3997
4014
|
switch (e.stopPropagation(), e.key) {
|
|
3998
4015
|
case "ArrowLeft":
|
|
3999
|
-
e.preventDefault(), t > 0 &&
|
|
4016
|
+
e.preventDefault(), t > 0 && Ie(t - 1);
|
|
4000
4017
|
break;
|
|
4001
4018
|
case "ArrowRight":
|
|
4002
|
-
e.preventDefault(), t <
|
|
4019
|
+
e.preventDefault(), t < X.length - 1 ? Ie(t + 1) : (Ie(-1), V && H.current ? H.current.focus() : U.current?.focus());
|
|
4003
4020
|
break;
|
|
4004
4021
|
case "Backspace":
|
|
4005
4022
|
case "Delete":
|
|
4006
4023
|
e.preventDefault();
|
|
4007
4024
|
{
|
|
4008
|
-
let e =
|
|
4009
|
-
|
|
4025
|
+
let e = X[t], n = t >= X.length - 1 ? t - 1 : t;
|
|
4026
|
+
qe(e), n >= 0 ? Ie(n) : (Ie(-1), V && H.current ? H.current.focus() : U.current?.focus());
|
|
4010
4027
|
}
|
|
4011
4028
|
break;
|
|
4012
4029
|
case "Tab":
|
|
4013
|
-
|
|
4030
|
+
Ie(-1);
|
|
4014
4031
|
break;
|
|
4015
|
-
case "Escape": e.preventDefault(),
|
|
4032
|
+
case "Escape": e.preventDefault(), Ie(-1), V && H.current ? H.current.focus() : U.current?.focus();
|
|
4016
4033
|
}
|
|
4017
4034
|
}, [
|
|
4018
|
-
|
|
4035
|
+
X,
|
|
4019
4036
|
V,
|
|
4020
|
-
|
|
4021
|
-
]),
|
|
4022
|
-
|
|
4023
|
-
}, [
|
|
4037
|
+
qe
|
|
4038
|
+
]), ft = o((e) => {
|
|
4039
|
+
ye(e.target.value), $e(e.target.value);
|
|
4040
|
+
}, [$e]), pt = o((e) => {
|
|
4024
4041
|
switch (e.key) {
|
|
4025
4042
|
case "ArrowDown":
|
|
4026
|
-
e.preventDefault(),
|
|
4043
|
+
e.preventDefault(), W.current && W.current.querySelector("[role=\"option\"]:not([data-disabled]), [data-type=\"new-option\"]")?.focus();
|
|
4027
4044
|
break;
|
|
4028
4045
|
case "Tab":
|
|
4029
|
-
|
|
4046
|
+
Qe();
|
|
4030
4047
|
break;
|
|
4031
|
-
case "Escape": e.preventDefault(),
|
|
4048
|
+
case "Escape": e.preventDefault(), _e(!1), V && (Me.current = !0), K();
|
|
4032
4049
|
}
|
|
4033
|
-
}, [
|
|
4034
|
-
|
|
4035
|
-
|
|
4050
|
+
}, [
|
|
4051
|
+
K,
|
|
4052
|
+
Qe,
|
|
4053
|
+
V
|
|
4054
|
+
]), mt = o((e) => {
|
|
4055
|
+
Ze(e);
|
|
4056
|
+
}, [Ze]), ht = o((e) => {
|
|
4036
4057
|
switch (e.key) {
|
|
4037
4058
|
case "Enter":
|
|
4038
4059
|
case " ":
|
|
4039
|
-
e.preventDefault(),
|
|
4060
|
+
e.preventDefault(), Ze(e.currentTarget.dataset.value || "");
|
|
4040
4061
|
break;
|
|
4041
4062
|
case "ArrowDown":
|
|
4042
|
-
e.preventDefault(),
|
|
4063
|
+
e.preventDefault(), W.current && br(W.current);
|
|
4043
4064
|
break;
|
|
4044
4065
|
case "ArrowUp":
|
|
4045
|
-
e.preventDefault(),
|
|
4066
|
+
e.preventDefault(), W.current && yr(e.currentTarget, W.current, y);
|
|
4046
4067
|
break;
|
|
4047
|
-
case "Escape": e.preventDefault(),
|
|
4068
|
+
case "Escape": e.preventDefault(), _e(!1), V && (Me.current = !0), K();
|
|
4048
4069
|
}
|
|
4049
4070
|
}, [
|
|
4050
|
-
|
|
4071
|
+
Ze,
|
|
4051
4072
|
y,
|
|
4052
|
-
|
|
4073
|
+
K,
|
|
4074
|
+
V
|
|
4053
4075
|
]);
|
|
4054
4076
|
return c(() => {
|
|
4055
|
-
if (
|
|
4077
|
+
if (!$) return;
|
|
4056
4078
|
let e = (e) => {
|
|
4057
4079
|
let t = e.target;
|
|
4058
|
-
|
|
4080
|
+
G.current && !G.current.contains(t) && Qe();
|
|
4059
4081
|
};
|
|
4060
4082
|
return document.addEventListener("click", e, !0), () => {
|
|
4061
4083
|
document.removeEventListener("click", e, !0);
|
|
4062
4084
|
};
|
|
4063
|
-
}, [
|
|
4064
|
-
let e =
|
|
4085
|
+
}, [$, Qe]), c(() => {
|
|
4086
|
+
let e = G.current?.closest("form");
|
|
4065
4087
|
if (!e) return;
|
|
4066
4088
|
let t = () => {
|
|
4067
4089
|
window.setTimeout(() => {
|
|
4068
|
-
if (
|
|
4069
|
-
let e = g ?
|
|
4070
|
-
|
|
4090
|
+
if (me(Y.current), he([]), xe(""), ye(""), De(null), Ce(""), ue.current) {
|
|
4091
|
+
let e = g ? Y.current.join(",") : Y.current[0] || "";
|
|
4092
|
+
ue.current.value = e;
|
|
4071
4093
|
}
|
|
4072
4094
|
}, 0);
|
|
4073
4095
|
};
|
|
4074
4096
|
return e.addEventListener("reset", t), () => e.removeEventListener("reset", t);
|
|
4075
4097
|
}, [g]), u(n, () => ({
|
|
4076
4098
|
get value() {
|
|
4077
|
-
return
|
|
4099
|
+
return ue.current?.value ?? "";
|
|
4078
4100
|
},
|
|
4079
4101
|
set value(e) {
|
|
4080
4102
|
let t = Array.isArray(e) ? e : e ? String(e).split(",").filter(Boolean) : [];
|
|
4081
|
-
fe ||
|
|
4103
|
+
fe || me(t), ue.current && (ue.current.value = t.join(","));
|
|
4082
4104
|
},
|
|
4083
4105
|
focus() {
|
|
4084
|
-
V ? H.current?.focus() :
|
|
4106
|
+
V ? H.current?.focus() : U.current?.focus();
|
|
4085
4107
|
},
|
|
4086
4108
|
blur() {
|
|
4087
|
-
V ? H.current?.blur() :
|
|
4109
|
+
V ? H.current?.blur() : U.current?.blur();
|
|
4088
4110
|
}
|
|
4089
4111
|
}), [fe]), {
|
|
4090
4112
|
id: r,
|
|
4091
4113
|
inputId: z,
|
|
4092
|
-
listboxId:
|
|
4093
|
-
values:
|
|
4094
|
-
inputValue:
|
|
4095
|
-
searchValue:
|
|
4096
|
-
options:
|
|
4097
|
-
filteredOptions:
|
|
4098
|
-
isOpen:
|
|
4099
|
-
userInfoMessage:
|
|
4114
|
+
listboxId: le,
|
|
4115
|
+
values: X,
|
|
4116
|
+
inputValue: be,
|
|
4117
|
+
searchValue: ve,
|
|
4118
|
+
options: Q,
|
|
4119
|
+
filteredOptions: Ve,
|
|
4120
|
+
isOpen: $,
|
|
4121
|
+
userInfoMessage: Re,
|
|
4122
|
+
skipInputTab: Ae,
|
|
4123
|
+
restoreInputTab: () => je(!1),
|
|
4100
4124
|
strings: ce,
|
|
4101
|
-
addValueText:
|
|
4102
|
-
maxIsReached:
|
|
4103
|
-
editingSingleValue:
|
|
4104
|
-
inputFocus:
|
|
4105
|
-
focusedTagIndex:
|
|
4125
|
+
addValueText: Ee,
|
|
4126
|
+
maxIsReached: ze,
|
|
4127
|
+
editingSingleValue: Ne,
|
|
4128
|
+
inputFocus: Oe,
|
|
4129
|
+
focusedTagIndex: Fe,
|
|
4106
4130
|
label: i,
|
|
4107
4131
|
multiple: g,
|
|
4108
4132
|
maxlength: _,
|
|
@@ -4131,35 +4155,35 @@ function Er(t, n) {
|
|
|
4131
4155
|
inputSize: ae,
|
|
4132
4156
|
name: oe,
|
|
4133
4157
|
className: se,
|
|
4134
|
-
hasCounter:
|
|
4158
|
+
hasCounter: Be,
|
|
4135
4159
|
inputRef: H,
|
|
4136
|
-
changeInputRef:
|
|
4137
|
-
triggerRef:
|
|
4138
|
-
listboxRef:
|
|
4139
|
-
wrapperRef:
|
|
4140
|
-
handleInputChange:
|
|
4141
|
-
handleInputKeydown:
|
|
4142
|
-
handleInputFocus:
|
|
4143
|
-
handleInputBlur:
|
|
4144
|
-
handleFocusOut:
|
|
4145
|
-
handleInputClick:
|
|
4146
|
-
handlePlaceholderClick:
|
|
4147
|
-
handleSelectOnlyKeydown:
|
|
4148
|
-
handleOptionClick:
|
|
4149
|
-
handleOptionKeydown:
|
|
4150
|
-
handleTagRemove:
|
|
4151
|
-
handleTagKeydown:
|
|
4152
|
-
handleSearchInput:
|
|
4153
|
-
handleSearchKeydown:
|
|
4154
|
-
handleNewOptionClick:
|
|
4155
|
-
handleNewOptionKeydown:
|
|
4160
|
+
changeInputRef: ue,
|
|
4161
|
+
triggerRef: U,
|
|
4162
|
+
listboxRef: W,
|
|
4163
|
+
wrapperRef: G,
|
|
4164
|
+
handleInputChange: et,
|
|
4165
|
+
handleInputKeydown: tt,
|
|
4166
|
+
handleInputFocus: nt,
|
|
4167
|
+
handleInputBlur: rt,
|
|
4168
|
+
handleFocusOut: it,
|
|
4169
|
+
handleInputClick: at,
|
|
4170
|
+
handlePlaceholderClick: ot,
|
|
4171
|
+
handleSelectOnlyKeydown: st,
|
|
4172
|
+
handleOptionClick: ct,
|
|
4173
|
+
handleOptionKeydown: lt,
|
|
4174
|
+
handleTagRemove: ut,
|
|
4175
|
+
handleTagKeydown: dt,
|
|
4176
|
+
handleSearchInput: ft,
|
|
4177
|
+
handleSearchKeydown: pt,
|
|
4178
|
+
handleNewOptionClick: mt,
|
|
4179
|
+
handleNewOptionKeydown: ht,
|
|
4156
4180
|
onChange: I
|
|
4157
4181
|
};
|
|
4158
4182
|
}
|
|
4159
4183
|
//#endregion
|
|
4160
4184
|
//#region src/components/combobox/Combobox.tsx
|
|
4161
|
-
var
|
|
4162
|
-
let n =
|
|
4185
|
+
var Or = i((e, t) => {
|
|
4186
|
+
let n = Dr(e, t), r = [
|
|
4163
4187
|
"pkt-combobox-component",
|
|
4164
4188
|
n.fullwidth && "pkt-combobox-component--fullwidth",
|
|
4165
4189
|
n.className
|
|
@@ -4168,7 +4192,7 @@ var Dr = i((e, t) => {
|
|
|
4168
4192
|
className: r,
|
|
4169
4193
|
ref: n.wrapperRef,
|
|
4170
4194
|
id: n.id || void 0,
|
|
4171
|
-
children: [/* @__PURE__ */ v(
|
|
4195
|
+
children: [/* @__PURE__ */ v(rr, {
|
|
4172
4196
|
strings: n.strings,
|
|
4173
4197
|
forId: a,
|
|
4174
4198
|
hasFieldset: e.hasFieldset ?? !i,
|
|
@@ -4194,8 +4218,8 @@ var Dr = i((e, t) => {
|
|
|
4194
4218
|
children: [/* @__PURE__ */ v("div", {
|
|
4195
4219
|
className: "pkt-combobox",
|
|
4196
4220
|
onBlur: n.handleFocusOut,
|
|
4197
|
-
children: [/* @__PURE__ */ _(
|
|
4198
|
-
}), n.tagPlacement === "outside" && n.multiple && /* @__PURE__ */ _(
|
|
4221
|
+
children: [/* @__PURE__ */ _(wr, { state: n }), /* @__PURE__ */ _(Tr, { state: n })]
|
|
4222
|
+
}), n.tagPlacement === "outside" && n.multiple && /* @__PURE__ */ _(Sr, {
|
|
4199
4223
|
state: n,
|
|
4200
4224
|
outside: !0
|
|
4201
4225
|
})]
|
|
@@ -4210,10 +4234,10 @@ var Dr = i((e, t) => {
|
|
|
4210
4234
|
})]
|
|
4211
4235
|
});
|
|
4212
4236
|
});
|
|
4213
|
-
|
|
4237
|
+
Or.displayName = "PktCombobox";
|
|
4214
4238
|
//#endregion
|
|
4215
4239
|
//#region src/components/consent/Consent.tsx
|
|
4216
|
-
var
|
|
4240
|
+
var kr = null, Ar = () => kr || (kr = new Promise((e, t) => {
|
|
4217
4241
|
if (document.querySelector("#oslo-consent-script")) {
|
|
4218
4242
|
e();
|
|
4219
4243
|
return;
|
|
@@ -4222,14 +4246,14 @@ var Or = null, kr = () => Or || (Or = new Promise((e, t) => {
|
|
|
4222
4246
|
n.src = "https://cdn.web.oslo.kommune.no/cb/cb-v1.1.0.js", n.id = "oslo-consent-script", n.onload = () => e(), n.onerror = t, document.head.appendChild(n);
|
|
4223
4247
|
let r = document.createElement("link");
|
|
4224
4248
|
r.href = "https://cdn.web.oslo.kommune.no/cb/cb-v1.1.0.css", r.type = "text/css", r.rel = "stylesheet", r.id = "oslo-consent-styles", document.head.appendChild(r);
|
|
4225
|
-
}),
|
|
4249
|
+
}), kr), jr = (e) => {
|
|
4226
4250
|
if (typeof e != "string") return e;
|
|
4227
4251
|
try {
|
|
4228
4252
|
return JSON.parse(e);
|
|
4229
4253
|
} catch {
|
|
4230
4254
|
return e;
|
|
4231
4255
|
}
|
|
4232
|
-
},
|
|
4256
|
+
}, Mr = (e) => jr(e.value).items.reduce((e, t) => (e[t.name] = t.consent, e), {}), Nr = i(function({ devMode: e = !1, cookieDomain: t = null, cookieSecure: n = null, cookieExpiryDays: r = null, hotjarId: i = null, googleAnalyticsId: a = null, i18nLanguage: o = "nb", triggerType: s = "button", triggerText: l, onToggleConsent: u, ...d }, f) {
|
|
4233
4257
|
let m = p(u);
|
|
4234
4258
|
m.current = u;
|
|
4235
4259
|
let h = p({
|
|
@@ -4248,14 +4272,14 @@ var Or = null, kr = () => Or || (Or = new Promise((e, t) => {
|
|
|
4248
4272
|
hotjarId: i,
|
|
4249
4273
|
googleAnalyticsId: a
|
|
4250
4274
|
};
|
|
4251
|
-
let g = p(() => {}), v = o in
|
|
4275
|
+
let g = p(() => {}), v = o in X.i18n ? o : "nb", y = l ?? X.i18n[v].contentPresentation.buttons.settings;
|
|
4252
4276
|
c(() => {
|
|
4253
4277
|
let e = !1, t, n = h.current;
|
|
4254
4278
|
window.cookieBanner_googleAnalyticsId = n.googleAnalyticsId, window.cookieBanner_hotjarId = n.hotjarId, n.cookieDomain && (window.cookieBanner_cookieDomain = n.cookieDomain), n.cookieSecure && (window.cookieBanner_cookieSecure = n.cookieSecure), n.cookieExpiryDays && (window.cookieBanner_cookieExpiryDays = n.cookieExpiryDays), n.devMode && (window.cookieBanner_devMode = n.devMode);
|
|
4255
4279
|
let r = (e) => {
|
|
4256
4280
|
let t = m.current;
|
|
4257
4281
|
t && t(new CustomEvent("toggle-consent", {
|
|
4258
|
-
detail:
|
|
4282
|
+
detail: Mr(e),
|
|
4259
4283
|
bubbles: !0,
|
|
4260
4284
|
cancelable: !1
|
|
4261
4285
|
}));
|
|
@@ -4273,7 +4297,7 @@ var Or = null, kr = () => Or || (Or = new Promise((e, t) => {
|
|
|
4273
4297
|
e || r({ value: o });
|
|
4274
4298
|
}, 0), t && i.off("CookieManager.setCookie", t), t = (e) => r(e), i.on("CookieManager.setCookie", t);
|
|
4275
4299
|
});
|
|
4276
|
-
},
|
|
4300
|
+
}, Ar().then(() => {
|
|
4277
4301
|
e || g.current();
|
|
4278
4302
|
}), () => {
|
|
4279
4303
|
e = !0, t && window.__cookieEvents?.off("CookieManager.setCookie", t);
|
|
@@ -4298,7 +4322,7 @@ var Or = null, kr = () => Or || (Or = new Promise((e, t) => {
|
|
|
4298
4322
|
"aria-haspopup": "dialog",
|
|
4299
4323
|
onClick: b,
|
|
4300
4324
|
children: y
|
|
4301
|
-
}) : s === "icon" ? /* @__PURE__ */ _(
|
|
4325
|
+
}) : s === "icon" ? /* @__PURE__ */ _(Z, {
|
|
4302
4326
|
ref: f,
|
|
4303
4327
|
skin: "tertiary",
|
|
4304
4328
|
variant: "icon-only",
|
|
@@ -4306,20 +4330,20 @@ var Or = null, kr = () => Or || (Or = new Promise((e, t) => {
|
|
|
4306
4330
|
"aria-haspopup": "dialog",
|
|
4307
4331
|
onClick: b,
|
|
4308
4332
|
children: y
|
|
4309
|
-
}) : /* @__PURE__ */ _(
|
|
4333
|
+
}) : /* @__PURE__ */ _(Z, {
|
|
4310
4334
|
ref: f,
|
|
4311
4335
|
"aria-haspopup": "dialog",
|
|
4312
4336
|
onClick: b,
|
|
4313
4337
|
children: y
|
|
4314
4338
|
});
|
|
4315
4339
|
});
|
|
4316
|
-
|
|
4340
|
+
Nr.displayName = "PktConsent";
|
|
4317
4341
|
//#endregion
|
|
4318
4342
|
//#region ../../shared-utils/device-utils.ts
|
|
4319
|
-
var
|
|
4343
|
+
var Pr = () => {
|
|
4320
4344
|
let e = navigator.userAgent;
|
|
4321
4345
|
return !!(/iP(hone|od|ad)/.test(e) || /Macintosh/.test(e) && "ontouchend" in document);
|
|
4322
|
-
},
|
|
4346
|
+
}, Fr = () => Pr() ? "text" : "date", Ir = (e) => !e || e.length !== 2 || dn(e[0], e[1]), Lr = (e, t, n, r, i, a, o = "medium") => ({
|
|
4323
4347
|
"pkt-input": !0,
|
|
4324
4348
|
"pkt-datepicker__input": !0,
|
|
4325
4349
|
[`pkt-input--${o}`]: !0,
|
|
@@ -4328,27 +4352,27 @@ var Nr = () => {
|
|
|
4328
4352
|
"pkt-datepicker--multiple": n,
|
|
4329
4353
|
"pkt-datepicker--range": r,
|
|
4330
4354
|
"ios-readonly-hack": i === !1 && a === "text"
|
|
4331
|
-
}),
|
|
4355
|
+
}), Rr = (e = "medium") => ({
|
|
4332
4356
|
"pkt-input-icon": !0,
|
|
4333
4357
|
"pkt-btn": !0,
|
|
4334
4358
|
"pkt-btn--icon-only": !0,
|
|
4335
4359
|
"pkt-btn--tertiary": !0,
|
|
4336
4360
|
[`pkt-btn--${e}`]: !0,
|
|
4337
4361
|
"pkt-datepicker__calendar-button": !0
|
|
4338
|
-
}),
|
|
4362
|
+
}), zr = (e) => ({
|
|
4339
4363
|
"pkt-input-prefix": e,
|
|
4340
4364
|
"pkt-hide": !e
|
|
4341
|
-
}),
|
|
4365
|
+
}), Br = (e, t, n) => !t && !n ? Array.isArray(e) ? e[0] || "" : e : Array.isArray(e) ? e.join(",") : e, Vr = (e, t, n = !1) => {
|
|
4342
4366
|
if (!e || !t) return;
|
|
4343
4367
|
let r = t.parentElement?.getBoundingClientRect() || t.getBoundingClientRect(), i = n ? r.height + 30 : r.height, a = e.getBoundingClientRect().height, o = n ? "calc(100% - 30px)" : "100%";
|
|
4344
4368
|
r && typeof window < "u" && r.top + a > window.innerHeight && r.top - a > 0 && (o = `calc(100% - ${i}px - ${a}px)`), e.style.top = o;
|
|
4345
|
-
},
|
|
4369
|
+
}, Hr = (e, t, n, r, i, a) => {
|
|
4346
4370
|
let { key: o } = e;
|
|
4347
4371
|
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());
|
|
4348
|
-
},
|
|
4372
|
+
}, Ur = ({ open: e, multiple: t = !1, range: n = !1, weeknumbers: r = !1, withcontrols: i = !1, selected: a = [], earliest: o, latest: s, excludedates: l, excludeweekdays: u, maxMultiple: d, currentmonth: f, today: m, inputRef: h, hasCounter: g = !1, onDateSelected: v, onClose: y }) => {
|
|
4349
4373
|
let b = p(null), x = p(!1);
|
|
4350
4374
|
e && (x.current = !0), c(() => {
|
|
4351
|
-
e &&
|
|
4375
|
+
e && Vr(b.current, h?.current ?? null, g);
|
|
4352
4376
|
}, [
|
|
4353
4377
|
e,
|
|
4354
4378
|
h,
|
|
@@ -4377,7 +4401,7 @@ var Nr = () => {
|
|
|
4377
4401
|
onClose: y
|
|
4378
4402
|
})
|
|
4379
4403
|
});
|
|
4380
|
-
},
|
|
4404
|
+
}, Wr = ({ dates: e, dateformat: t, idBase: n, strings: r, onDateRemoved: i }) => {
|
|
4381
4405
|
let a = un(e), o = ge(["datepicker"], r).datepicker.deleteDate;
|
|
4382
4406
|
return /* @__PURE__ */ _("div", {
|
|
4383
4407
|
className: "pkt-date-tags pkt-datepicker__tags",
|
|
@@ -4396,7 +4420,7 @@ var Nr = () => {
|
|
|
4396
4420
|
}, e);
|
|
4397
4421
|
})
|
|
4398
4422
|
});
|
|
4399
|
-
},
|
|
4423
|
+
}, Gr = ({ state: e }) => {
|
|
4400
4424
|
let { id: t, inputId: n, values: r, dateformat: i, multiple: a, range: o, showRangeLabels: s, disabled: c, readOnly: l, required: u, label: d, name: f, placeholder: p, hasError: m, helptext: h, minStr: y, maxStr: b, inputType: x, isIOSDevice: S, strings: C, inputClasses: w, buttonClasses: T, rangeLabelClasses: E, datepickerInputsClasses: D, isInputDisabled: O, inputRef: k, inputRefTo: A, btnRef: j, toggleCalendar: M, handleFocus: N, handleSingleInputChange: P, handleRangeFromChange: ee, handleRangeToChange: te, handleRangeBlur: ne, handleMultipleBlur: F, handleTagRemoved: re, handleSingleKeydown: ie, handleRangeFromKeydown: ae, handleRangeToKeydown: oe, handleMultipleKeydown: se, restProps: I } = e, R = (e) => {
|
|
4401
4425
|
e.preventDefault(), M();
|
|
4402
4426
|
}, ce = (e) => {
|
|
@@ -4412,7 +4436,7 @@ var Nr = () => {
|
|
|
4412
4436
|
children: C.datepicker.openPicker
|
|
4413
4437
|
})]
|
|
4414
4438
|
});
|
|
4415
|
-
return a ? /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _(
|
|
4439
|
+
return a ? /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _(Wr, {
|
|
4416
4440
|
dates: r,
|
|
4417
4441
|
dateformat: i,
|
|
4418
4442
|
idBase: t,
|
|
@@ -4538,7 +4562,7 @@ var Nr = () => {
|
|
|
4538
4562
|
}), z()]
|
|
4539
4563
|
})
|
|
4540
4564
|
});
|
|
4541
|
-
},
|
|
4565
|
+
}, Kr = (e) => {
|
|
4542
4566
|
if (!e) return [];
|
|
4543
4567
|
if (Array.isArray(e)) return e.filter(Boolean);
|
|
4544
4568
|
if (typeof e == "string" && e.trimStart().startsWith("[")) try {
|
|
@@ -4549,25 +4573,25 @@ var Nr = () => {
|
|
|
4549
4573
|
};
|
|
4550
4574
|
//#endregion
|
|
4551
4575
|
//#region src/components/datepicker/useDatepickerState.ts
|
|
4552
|
-
function
|
|
4553
|
-
let { id: n, label: r, value: i, defaultValue: a, dateformat: s = "dd.MM.yyyy", multiple: l = !1, maxlength: d, range: h = !1, showRangeLabels: g = !1, weeknumbers: _ = !1, withcontrols: v = !1, excludedates: y, excludeweekdays: b, currentmonth: x, today: S, calendarOpen: C, timezone: w, fullwidth: T = !1, inputSize: E = "medium", hasFieldset: D = !1, counter: O, inline: k = !1, helptext: A, helptextDropdown: j, helptextDropdownButton: M, hasError: N = !1, errorMessage: P, optionalTag: ee = !1, optionalText: te, requiredTag: ne = !1, requiredText: F, tagText: re, useWrapper: ie = !0, strings: ae, disabled: oe = !1, readOnly: se = !1, required: I = !1, name: L, min: R, max: ce, placeholder: z, onChange: B, onValueChange:
|
|
4576
|
+
function qr(e, t) {
|
|
4577
|
+
let { id: n, label: r, value: i, defaultValue: a, dateformat: s = "dd.MM.yyyy", multiple: l = !1, maxlength: d, range: h = !1, showRangeLabels: g = !1, weeknumbers: _ = !1, withcontrols: v = !1, excludedates: y, excludeweekdays: b, currentmonth: x, today: S, calendarOpen: C, timezone: w, fullwidth: T = !1, inputSize: E = "medium", hasFieldset: D = !1, counter: O, inline: k = !1, helptext: A, helptextDropdown: j, helptextDropdownButton: M, hasError: N = !1, errorMessage: P, optionalTag: ee = !1, optionalText: te, requiredTag: ne = !1, requiredText: F, tagText: re, useWrapper: ie = !0, strings: ae, disabled: oe = !1, readOnly: se = !1, required: I = !1, name: L, min: R, max: ce, placeholder: z, onChange: B, onValueChange: le, className: V, ...H } = e, ue = o((e) => e === void 0 ? [] : Kr(e), []), U = i !== void 0, W = typeof a == "number" ? void 0 : a, [G, K] = m(() => ue(i ?? W)), q = U ? ue(i) : G, de = p(G);
|
|
4554
4578
|
c(() => {
|
|
4555
|
-
U &&
|
|
4579
|
+
U && K(ue(i));
|
|
4556
4580
|
}, [
|
|
4557
4581
|
i,
|
|
4558
4582
|
U,
|
|
4559
4583
|
ue
|
|
4560
4584
|
]);
|
|
4561
|
-
let [
|
|
4585
|
+
let [J, fe] = m(C ?? !1);
|
|
4562
4586
|
c(() => {
|
|
4563
|
-
C !== void 0 &&
|
|
4587
|
+
C !== void 0 && fe(C);
|
|
4564
4588
|
}, [C]);
|
|
4565
|
-
let
|
|
4589
|
+
let pe = p(null), me = p(null), Y = p(null), X = p(null), Z = p(null), he = f(() => Fr(), []), Q = f(() => Pr(), []), $ = ge([
|
|
4566
4590
|
"generic",
|
|
4567
4591
|
"datepicker",
|
|
4568
4592
|
"validation"
|
|
4569
|
-
], ae),
|
|
4570
|
-
let e =
|
|
4593
|
+
], ae), _e = ae, ve = typeof R == "string" ? R : R === void 0 ? void 0 : String(R), ye = typeof ce == "string" ? ce : ce === void 0 ? void 0 : String(ce), be = f(() => {
|
|
4594
|
+
let e = Lr(T, g, l, h, se, he, E);
|
|
4571
4595
|
return Object.entries(e).filter(([, e]) => e).map(([e]) => e).join(" ");
|
|
4572
4596
|
}, [
|
|
4573
4597
|
T,
|
|
@@ -4575,92 +4599,92 @@ function Kr(e, t) {
|
|
|
4575
4599
|
l,
|
|
4576
4600
|
h,
|
|
4577
4601
|
se,
|
|
4578
|
-
|
|
4602
|
+
he,
|
|
4579
4603
|
E
|
|
4580
|
-
]),
|
|
4581
|
-
let e =
|
|
4604
|
+
]), xe = Object.entries(Rr(E)).filter(([, e]) => e).map(([e]) => e).join(" "), Se = f(() => {
|
|
4605
|
+
let e = zr(g);
|
|
4582
4606
|
return Object.entries(e).filter(([, e]) => e).map(([e]) => e).join(" ");
|
|
4583
|
-
}, [g]),
|
|
4607
|
+
}, [g]), Ce = f(() => ["pkt-datepicker__inputs", h && "pkt-input__range-inputs"].filter(Boolean).join(" "), [h, g]), we = f(() => {
|
|
4584
4608
|
if (x) return x;
|
|
4585
|
-
if (
|
|
4586
|
-
}, [x,
|
|
4609
|
+
if (ye) return ye.slice(0, 7);
|
|
4610
|
+
}, [x, ye]), Te = oe || l && d != null && q.length >= d, Ee = O ?? (l && d != null), De = `${n}-input`, Oe = q.join(",");
|
|
4587
4611
|
c(() => {
|
|
4588
|
-
Y.current && (Y.current.value =
|
|
4589
|
-
}, [
|
|
4612
|
+
Y.current && (Y.current.value = Oe);
|
|
4613
|
+
}, [Oe]), c(() => {
|
|
4590
4614
|
w && typeof window < "u" && w !== window.pktTz && (window.pktTz = w);
|
|
4591
4615
|
}, [w]);
|
|
4592
|
-
let
|
|
4593
|
-
U ||
|
|
4594
|
-
}, [U,
|
|
4616
|
+
let ke = o((e, t = !0) => {
|
|
4617
|
+
U || K(e), t && le?.(e);
|
|
4618
|
+
}, [U, le]), Ae = f(() => Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value")?.set, []), je = o((e) => {
|
|
4595
4619
|
if (h && e.length === 1) return;
|
|
4596
4620
|
let t = Y.current;
|
|
4597
4621
|
!t || !Ae || (Ae.call(t, e.join(",")), t.dispatchEvent(new Event("input", { bubbles: !0 })));
|
|
4598
4622
|
}, [Ae, h]), Me = o(() => {
|
|
4599
|
-
oe ||
|
|
4623
|
+
oe || fe((e) => !e);
|
|
4600
4624
|
}, [oe]), Ne = o(() => {
|
|
4601
|
-
|
|
4625
|
+
fe(!1);
|
|
4602
4626
|
}, []);
|
|
4603
4627
|
c(() => {
|
|
4604
|
-
if (!
|
|
4628
|
+
if (!J) return;
|
|
4605
4629
|
let e = (e) => {
|
|
4606
4630
|
let t = e.target;
|
|
4607
|
-
|
|
4631
|
+
Z.current && !Z.current.contains(t) && !t.closest?.(".pkt-calendar-popup") && Ne();
|
|
4608
4632
|
}, t = (e) => {
|
|
4609
|
-
e.key === "Escape" && (Ne(),
|
|
4633
|
+
e.key === "Escape" && (Ne(), pe.current?.focus());
|
|
4610
4634
|
};
|
|
4611
4635
|
return document.addEventListener("click", e, !0), document.addEventListener("keydown", t), () => {
|
|
4612
4636
|
document.removeEventListener("click", e, !0), document.removeEventListener("keydown", t);
|
|
4613
4637
|
};
|
|
4614
|
-
}, [
|
|
4638
|
+
}, [J, Ne]);
|
|
4615
4639
|
let Pe = o(() => {
|
|
4616
|
-
Q && !
|
|
4617
|
-
}, [Q,
|
|
4618
|
-
let t =
|
|
4619
|
-
|
|
4640
|
+
Q && !J && fe(!0);
|
|
4641
|
+
}, [Q, J]), Fe = o((e) => {
|
|
4642
|
+
let t = Kr(Br(e, l, h));
|
|
4643
|
+
ke(t), je(t), !l && !h && (Ne(), pe.current?.focus());
|
|
4620
4644
|
}, [
|
|
4621
4645
|
l,
|
|
4622
4646
|
h,
|
|
4623
|
-
|
|
4647
|
+
ke,
|
|
4624
4648
|
je,
|
|
4625
4649
|
Ne
|
|
4626
4650
|
]), Ie = o(() => {
|
|
4627
|
-
Ne(),
|
|
4651
|
+
Ne(), pe.current?.focus();
|
|
4628
4652
|
}, [Ne]), Le = o((e) => {
|
|
4629
4653
|
let t = e.target.value, n = t ? [t] : [];
|
|
4630
|
-
|
|
4631
|
-
}, [
|
|
4632
|
-
let t = [e.target.value,
|
|
4633
|
-
|
|
4654
|
+
ke(n), je(n);
|
|
4655
|
+
}, [ke, je]), Re = o((e) => {
|
|
4656
|
+
let t = [e.target.value, q[1] ?? ""].filter(Boolean);
|
|
4657
|
+
ke(t), je(t);
|
|
4634
4658
|
}, [
|
|
4635
|
-
|
|
4636
|
-
|
|
4659
|
+
q,
|
|
4660
|
+
ke,
|
|
4637
4661
|
je
|
|
4638
4662
|
]), ze = o((e) => {
|
|
4639
|
-
let t = [
|
|
4640
|
-
|
|
4663
|
+
let t = [q[0] ?? "", e.target.value].filter(Boolean);
|
|
4664
|
+
ke(t), je(t);
|
|
4641
4665
|
}, [
|
|
4642
|
-
|
|
4643
|
-
|
|
4666
|
+
q,
|
|
4667
|
+
ke,
|
|
4644
4668
|
je
|
|
4645
4669
|
]), Be = o(() => {
|
|
4646
|
-
|
|
4670
|
+
q.length === 2 && !Ir(q) && (ke([q[0]]), je([q[0]]));
|
|
4647
4671
|
}, [
|
|
4648
|
-
|
|
4649
|
-
|
|
4672
|
+
q,
|
|
4673
|
+
ke,
|
|
4650
4674
|
je
|
|
4651
4675
|
]), Ve = o((e) => {
|
|
4652
|
-
let t = Qt(e), n =
|
|
4676
|
+
let t = Qt(e), n = ve ? Qt(ve) : null, r = ye ? Qt(ye) : null;
|
|
4653
4677
|
if (t && !isNaN(t.getTime()) && (!n || t >= n) && (!r || t <= r)) {
|
|
4654
|
-
let t = ln([...
|
|
4655
|
-
|
|
4678
|
+
let t = ln([...q, e], ve, ye, y, b), n = [...new Set(t)];
|
|
4679
|
+
ke(n), je(n);
|
|
4656
4680
|
}
|
|
4657
4681
|
}, [
|
|
4658
|
-
|
|
4682
|
+
q,
|
|
4683
|
+
ve,
|
|
4659
4684
|
ye,
|
|
4660
|
-
be,
|
|
4661
4685
|
y,
|
|
4662
4686
|
b,
|
|
4663
|
-
|
|
4687
|
+
ke,
|
|
4664
4688
|
je
|
|
4665
4689
|
]), He = o((e) => {
|
|
4666
4690
|
let t = e.target;
|
|
@@ -4669,34 +4693,34 @@ function Kr(e, t) {
|
|
|
4669
4693
|
let t = e.target;
|
|
4670
4694
|
t.value &&= (Ve(t.value.split(",")[0]), "");
|
|
4671
4695
|
}, [Ve]), We = o((e) => {
|
|
4672
|
-
let t =
|
|
4673
|
-
|
|
4696
|
+
let t = q.filter((t) => t !== e);
|
|
4697
|
+
ke(t), je(t);
|
|
4674
4698
|
}, [
|
|
4675
|
-
|
|
4676
|
-
|
|
4699
|
+
q,
|
|
4700
|
+
ke,
|
|
4677
4701
|
je
|
|
4678
4702
|
]), Ge = o((e) => {
|
|
4679
4703
|
let t = e?.closest("form");
|
|
4680
4704
|
t ? t.requestSubmit() : e?.blur();
|
|
4681
4705
|
}, []), Ke = o((e) => {
|
|
4682
|
-
|
|
4706
|
+
Hr(e.nativeEvent, () => Me(), () => Ge(pe.current), void 0, () => pe.current?.blur());
|
|
4683
4707
|
}, [Me, Ge]), qe = o((e) => {
|
|
4684
|
-
|
|
4708
|
+
Hr(e.nativeEvent, () => Me(), () => Ge(pe.current), () => me.current?.focus(), () => pe.current?.blur());
|
|
4685
4709
|
}, [Me, Ge]), Je = o((e) => {
|
|
4686
|
-
|
|
4710
|
+
Hr(e.nativeEvent, () => Me(), () => Ge(me.current), void 0, () => me.current?.blur());
|
|
4687
4711
|
}, [Me, Ge]), Ye = o((e) => {
|
|
4688
|
-
|
|
4712
|
+
Hr(e.nativeEvent, () => Me(), () => Ge(pe.current), void 0, () => pe.current?.blur(), Ue);
|
|
4689
4713
|
}, [
|
|
4690
4714
|
Me,
|
|
4691
4715
|
Ge,
|
|
4692
4716
|
Ue
|
|
4693
4717
|
]);
|
|
4694
4718
|
return c(() => {
|
|
4695
|
-
let e =
|
|
4719
|
+
let e = Z.current?.closest("form");
|
|
4696
4720
|
if (!e) return;
|
|
4697
4721
|
let t = () => {
|
|
4698
4722
|
window.setTimeout(() => {
|
|
4699
|
-
|
|
4723
|
+
K(de.current), fe(!1), Y.current && (Y.current.value = de.current.join(","));
|
|
4700
4724
|
}, 0);
|
|
4701
4725
|
};
|
|
4702
4726
|
return e.addEventListener("reset", t), () => e.removeEventListener("reset", t);
|
|
@@ -4706,20 +4730,20 @@ function Kr(e, t) {
|
|
|
4706
4730
|
},
|
|
4707
4731
|
set value(e) {
|
|
4708
4732
|
let t = e ? e.split(",").filter(Boolean) : [];
|
|
4709
|
-
|
|
4733
|
+
K(t), Y.current && (Y.current.value = e ?? "");
|
|
4710
4734
|
},
|
|
4711
4735
|
focus() {
|
|
4712
|
-
|
|
4736
|
+
pe.current?.focus();
|
|
4713
4737
|
},
|
|
4714
4738
|
blur() {
|
|
4715
|
-
|
|
4739
|
+
pe.current?.blur();
|
|
4716
4740
|
}
|
|
4717
4741
|
}), []), {
|
|
4718
4742
|
id: n,
|
|
4719
|
-
inputId:
|
|
4743
|
+
inputId: De,
|
|
4720
4744
|
label: r,
|
|
4721
|
-
values:
|
|
4722
|
-
calendarOpen:
|
|
4745
|
+
values: q,
|
|
4746
|
+
calendarOpen: J,
|
|
4723
4747
|
dateformat: s,
|
|
4724
4748
|
multiple: l,
|
|
4725
4749
|
maxlength: d,
|
|
@@ -4749,26 +4773,26 @@ function Kr(e, t) {
|
|
|
4749
4773
|
requiredText: F,
|
|
4750
4774
|
tagText: re,
|
|
4751
4775
|
useWrapper: ie,
|
|
4752
|
-
className:
|
|
4753
|
-
minStr:
|
|
4754
|
-
maxStr:
|
|
4755
|
-
effectiveCurrentMonth:
|
|
4776
|
+
className: V,
|
|
4777
|
+
minStr: ve,
|
|
4778
|
+
maxStr: ye,
|
|
4779
|
+
effectiveCurrentMonth: we,
|
|
4756
4780
|
today: S,
|
|
4757
|
-
inputType:
|
|
4781
|
+
inputType: he,
|
|
4758
4782
|
isIOSDevice: Q,
|
|
4759
|
-
strings:
|
|
4760
|
-
stringsOverride:
|
|
4761
|
-
inputClasses:
|
|
4762
|
-
buttonClasses:
|
|
4763
|
-
rangeLabelClasses:
|
|
4764
|
-
datepickerInputsClasses:
|
|
4765
|
-
isInputDisabled:
|
|
4766
|
-
hasCounter:
|
|
4767
|
-
inputRef:
|
|
4768
|
-
inputRefTo:
|
|
4783
|
+
strings: $,
|
|
4784
|
+
stringsOverride: _e,
|
|
4785
|
+
inputClasses: be,
|
|
4786
|
+
buttonClasses: xe,
|
|
4787
|
+
rangeLabelClasses: Se,
|
|
4788
|
+
datepickerInputsClasses: Ce,
|
|
4789
|
+
isInputDisabled: Te,
|
|
4790
|
+
hasCounter: Ee,
|
|
4791
|
+
inputRef: pe,
|
|
4792
|
+
inputRefTo: me,
|
|
4769
4793
|
changeInputRef: Y,
|
|
4770
|
-
btnRef:
|
|
4771
|
-
wrapperRef:
|
|
4794
|
+
btnRef: X,
|
|
4795
|
+
wrapperRef: Z,
|
|
4772
4796
|
onChange: B,
|
|
4773
4797
|
toggleCalendar: Me,
|
|
4774
4798
|
hideCalendar: Ne,
|
|
@@ -4785,13 +4809,13 @@ function Kr(e, t) {
|
|
|
4785
4809
|
handleRangeFromKeydown: qe,
|
|
4786
4810
|
handleRangeToKeydown: Je,
|
|
4787
4811
|
handleMultipleKeydown: Ye,
|
|
4788
|
-
restProps:
|
|
4812
|
+
restProps: H
|
|
4789
4813
|
};
|
|
4790
4814
|
}
|
|
4791
4815
|
//#endregion
|
|
4792
4816
|
//#region src/components/datepicker/Datepicker.tsx
|
|
4793
|
-
var
|
|
4794
|
-
let n =
|
|
4817
|
+
var Jr = i((e, t) => {
|
|
4818
|
+
let n = qr(e, t), r = [
|
|
4795
4819
|
"pkt-datepicker",
|
|
4796
4820
|
`pkt-datepicker--${n.inputSize}`,
|
|
4797
4821
|
n.fullwidth ? "pkt-datepicker--fullwidth" : "",
|
|
@@ -4801,7 +4825,7 @@ var qr = i((e, t) => {
|
|
|
4801
4825
|
className: r,
|
|
4802
4826
|
id: n.id || void 0,
|
|
4803
4827
|
children: [
|
|
4804
|
-
/* @__PURE__ */ _(
|
|
4828
|
+
/* @__PURE__ */ _(rr, {
|
|
4805
4829
|
strings: n.stringsOverride,
|
|
4806
4830
|
ref: n.wrapperRef,
|
|
4807
4831
|
ariaDescribedby: e.ariaDescribedby,
|
|
@@ -4825,9 +4849,9 @@ var qr = i((e, t) => {
|
|
|
4825
4849
|
counter: n.hasCounter,
|
|
4826
4850
|
counterCurrent: n.values.length,
|
|
4827
4851
|
counterMaxLength: n.maxlength,
|
|
4828
|
-
children: /* @__PURE__ */ _(
|
|
4852
|
+
children: /* @__PURE__ */ _(Gr, { state: n })
|
|
4829
4853
|
}),
|
|
4830
|
-
/* @__PURE__ */ _(
|
|
4854
|
+
/* @__PURE__ */ _(Ur, {
|
|
4831
4855
|
open: n.calendarOpen,
|
|
4832
4856
|
multiple: n.multiple,
|
|
4833
4857
|
range: n.range,
|
|
@@ -4858,10 +4882,10 @@ var qr = i((e, t) => {
|
|
|
4858
4882
|
]
|
|
4859
4883
|
});
|
|
4860
4884
|
});
|
|
4861
|
-
|
|
4885
|
+
Jr.displayName = "PktDatepicker";
|
|
4862
4886
|
//#endregion
|
|
4863
4887
|
//#region ../../shared-utils/fileupload/size.ts
|
|
4864
|
-
function
|
|
4888
|
+
function Yr(e) {
|
|
4865
4889
|
if (e == null || e === "") return;
|
|
4866
4890
|
if (typeof e == "number") return Number.isFinite(e) && e > 0 ? e : void 0;
|
|
4867
4891
|
let t = String(e).trim(), n = Number(t);
|
|
@@ -4880,15 +4904,15 @@ function Jr(e) {
|
|
|
4880
4904
|
default: return;
|
|
4881
4905
|
}
|
|
4882
4906
|
}
|
|
4883
|
-
function
|
|
4907
|
+
function Xr(e) {
|
|
4884
4908
|
return e < 1024 ? `${Math.round(e)} B` : e < 1048576 ? `${Math.round(e / 1024)} KB` : e < 1073741824 ? `${Math.round(e / 1048576)} MB` : `${Math.round(e / 1073741824)} GB`;
|
|
4885
4909
|
}
|
|
4886
4910
|
//#endregion
|
|
4887
4911
|
//#region ../../shared-utils/fileupload/formats.ts
|
|
4888
|
-
function
|
|
4912
|
+
function Zr(e) {
|
|
4889
4913
|
return Array.isArray(e) ? e.map((e) => String(e).trim().toLowerCase()).filter(Boolean) : [];
|
|
4890
4914
|
}
|
|
4891
|
-
function
|
|
4915
|
+
function Qr(e, t, n) {
|
|
4892
4916
|
let r = e.toLowerCase().replace(/^\./, "");
|
|
4893
4917
|
if (r.includes("/")) {
|
|
4894
4918
|
if (r.endsWith("/*")) {
|
|
@@ -4899,33 +4923,33 @@ function Zr(e, t, n) {
|
|
|
4899
4923
|
}
|
|
4900
4924
|
return t === r;
|
|
4901
4925
|
}
|
|
4902
|
-
function
|
|
4903
|
-
let n =
|
|
4926
|
+
function $r(e, t) {
|
|
4927
|
+
let n = Zr(t);
|
|
4904
4928
|
if (n.length === 0) return !0;
|
|
4905
4929
|
let r = e.name.split(".").pop()?.toLowerCase() ?? "", i = e.type.toLowerCase();
|
|
4906
|
-
return n.some((e) =>
|
|
4930
|
+
return n.some((e) => Qr(e, r, i));
|
|
4907
4931
|
}
|
|
4908
|
-
function
|
|
4932
|
+
function ei(e, t) {
|
|
4909
4933
|
let n = (e ?? "").trim();
|
|
4910
4934
|
if (n) return n;
|
|
4911
|
-
let r =
|
|
4935
|
+
let r = Zr(t);
|
|
4912
4936
|
return r.length === 0 ? "" : r.map((e) => e.includes("/") || e.startsWith(".") ? e : `.${e}`).join(", ");
|
|
4913
4937
|
}
|
|
4914
4938
|
//#endregion
|
|
4915
4939
|
//#region ../../shared-utils/fileupload/validation.ts
|
|
4916
|
-
function
|
|
4940
|
+
function ti(e, t, n) {
|
|
4917
4941
|
return ((e ?? "").trim() || t).replace(/\{(\w+)\}/g, (e, t) => n[t] ?? `{${t}}`);
|
|
4918
4942
|
}
|
|
4919
|
-
function
|
|
4920
|
-
let n =
|
|
4921
|
-
if (n.length > 0 &&
|
|
4943
|
+
function ni(e, t) {
|
|
4944
|
+
let n = Zr(t.allowedFormats);
|
|
4945
|
+
if (n.length > 0 && !$r(e, n)) {
|
|
4922
4946
|
let e = n.join(", "), r = ce.fileupload.invalidFormat;
|
|
4923
|
-
return
|
|
4947
|
+
return ti(t.formatErrorMessage, r, { formats: e });
|
|
4924
4948
|
}
|
|
4925
|
-
let r =
|
|
4949
|
+
let r = Yr(t.maxFileSize);
|
|
4926
4950
|
if (r !== void 0 && e.size > r) {
|
|
4927
|
-
let e =
|
|
4928
|
-
return
|
|
4951
|
+
let e = Xr(r), n = ce.fileupload.sizeTooLarge;
|
|
4952
|
+
return ti(t.sizeErrorMessage, n, { maxSize: e });
|
|
4929
4953
|
}
|
|
4930
4954
|
if (t.onFileValidation) {
|
|
4931
4955
|
let n = t.onFileValidation(e);
|
|
@@ -4933,7 +4957,7 @@ function ti(e, t) {
|
|
|
4933
4957
|
}
|
|
4934
4958
|
return null;
|
|
4935
4959
|
}
|
|
4936
|
-
function
|
|
4960
|
+
function ri(e) {
|
|
4937
4961
|
let t = e.file;
|
|
4938
4962
|
if (t?.type?.startsWith("image/")) return !0;
|
|
4939
4963
|
let n = e.attributes?.targetFilename || t?.name || "";
|
|
@@ -4941,10 +4965,10 @@ function ni(e) {
|
|
|
4941
4965
|
}
|
|
4942
4966
|
//#endregion
|
|
4943
4967
|
//#region ../../shared-utils/fileupload/transfers.ts
|
|
4944
|
-
function
|
|
4968
|
+
function ii(e) {
|
|
4945
4969
|
return typeof e == "number" ? "in-progress" : e === "error" ? "error" : "idle";
|
|
4946
4970
|
}
|
|
4947
|
-
function
|
|
4971
|
+
function ai(e, t, n) {
|
|
4948
4972
|
let r = {
|
|
4949
4973
|
"in-progress": 0,
|
|
4950
4974
|
error: 1,
|
|
@@ -4959,11 +4983,11 @@ function ii(e, t, n) {
|
|
|
4959
4983
|
showProgress: r?.showProgress,
|
|
4960
4984
|
lastProgress: r?.lastProgress
|
|
4961
4985
|
};
|
|
4962
|
-
}).sort((e, t) => r[
|
|
4986
|
+
}).sort((e, t) => r[ii(e.progress)] - r[ii(t.progress)]);
|
|
4963
4987
|
}
|
|
4964
4988
|
//#endregion
|
|
4965
4989
|
//#region ../../shared-utils/focus-trap/index.ts
|
|
4966
|
-
function
|
|
4990
|
+
function oi(e) {
|
|
4967
4991
|
if (!e) return [];
|
|
4968
4992
|
let t = [
|
|
4969
4993
|
"a[href]:not([tabindex=\"-1\"])",
|
|
@@ -4975,7 +4999,7 @@ function ai(e) {
|
|
|
4975
4999
|
].join(", ");
|
|
4976
5000
|
return Array.from(e.querySelectorAll(t)).filter((e) => !e.hasAttribute("inert"));
|
|
4977
5001
|
}
|
|
4978
|
-
var
|
|
5002
|
+
var si = [
|
|
4979
5003
|
"a[href]",
|
|
4980
5004
|
"button:not([disabled])",
|
|
4981
5005
|
"input:not([disabled]):not([type=\"hidden\"])",
|
|
@@ -4983,7 +5007,7 @@ var oi = [
|
|
|
4983
5007
|
"textarea:not([disabled])",
|
|
4984
5008
|
"summary",
|
|
4985
5009
|
"[tabindex]:not([tabindex=\"-1\"])"
|
|
4986
|
-
].join(", "),
|
|
5010
|
+
].join(", "), ci = (e) => {
|
|
4987
5011
|
if (e.hasAttribute("inert") || e.closest("[inert]") || e.hidden || e.closest("[hidden]")) return !0;
|
|
4988
5012
|
let t = e;
|
|
4989
5013
|
for (; t;) {
|
|
@@ -4996,33 +5020,33 @@ var oi = [
|
|
|
4996
5020
|
t = n.parentElement;
|
|
4997
5021
|
}
|
|
4998
5022
|
return !1;
|
|
4999
|
-
},
|
|
5000
|
-
e.matches(
|
|
5023
|
+
}, li = (e, t) => {
|
|
5024
|
+
e.matches(si) && !ci(e) && t.push(e);
|
|
5001
5025
|
let n = e.shadowRoot;
|
|
5002
|
-
if (n) for (let e of Array.from(n.children))
|
|
5003
|
-
for (let n of Array.from(e.children))
|
|
5026
|
+
if (n) for (let e of Array.from(n.children)) li(e, t);
|
|
5027
|
+
for (let n of Array.from(e.children)) li(n, t);
|
|
5004
5028
|
};
|
|
5005
|
-
function
|
|
5029
|
+
function ui(e) {
|
|
5006
5030
|
if (!e) return [];
|
|
5007
5031
|
let t = [];
|
|
5008
|
-
for (let n of Array.from(e.children))
|
|
5032
|
+
for (let n of Array.from(e.children)) li(n, t);
|
|
5009
5033
|
return t;
|
|
5010
5034
|
}
|
|
5011
|
-
function
|
|
5035
|
+
function di(e = document) {
|
|
5012
5036
|
let t = e.activeElement;
|
|
5013
5037
|
for (; t?.shadowRoot?.activeElement;) t = t.shadowRoot.activeElement;
|
|
5014
5038
|
return t;
|
|
5015
5039
|
}
|
|
5016
|
-
function
|
|
5040
|
+
function fi(e, t) {
|
|
5017
5041
|
if (e.key !== "Tab") return !1;
|
|
5018
|
-
let n =
|
|
5042
|
+
let n = oi(t);
|
|
5019
5043
|
if (n.length === 0) return e.preventDefault(), !0;
|
|
5020
5044
|
let r = n[0], i = n[n.length - 1], a = (t?.ownerDocument ?? document).activeElement, o = !!a && n.includes(a);
|
|
5021
5045
|
return e.shiftKey ? !o || a === r ? (e.preventDefault(), i.focus(), !0) : !1 : !o || a === i ? (e.preventDefault(), r.focus(), !0) : !1;
|
|
5022
5046
|
}
|
|
5023
5047
|
//#endregion
|
|
5024
5048
|
//#region ../../shared-utils/fileupload/truncate.ts
|
|
5025
|
-
function
|
|
5049
|
+
function pi(e, t) {
|
|
5026
5050
|
return !t || t <= 0 || e.length <= t + 3 ? null : {
|
|
5027
5051
|
head: e.slice(0, e.length - t),
|
|
5028
5052
|
tail: e.slice(-t)
|
|
@@ -5030,12 +5054,12 @@ function fi(e, t) {
|
|
|
5030
5054
|
}
|
|
5031
5055
|
//#endregion
|
|
5032
5056
|
//#region ../../shared-utils/fileupload/navigation.ts
|
|
5033
|
-
function
|
|
5057
|
+
function mi(e, t, n) {
|
|
5034
5058
|
return n <= 0 ? 0 : t === "prev" ? e <= 0 ? n - 1 : e - 1 : e >= n - 1 ? 0 : e + 1;
|
|
5035
5059
|
}
|
|
5036
5060
|
//#endregion
|
|
5037
5061
|
//#region ../../shared-utils/fileupload/announcements.ts
|
|
5038
|
-
function
|
|
5062
|
+
function hi(e, t) {
|
|
5039
5063
|
let n = e.length;
|
|
5040
5064
|
if (n === 0 || !t || t.length === 0) return {
|
|
5041
5065
|
totalCount: n,
|
|
@@ -5055,23 +5079,23 @@ function mi(e, t) {
|
|
|
5055
5079
|
}
|
|
5056
5080
|
//#endregion
|
|
5057
5081
|
//#region ../../shared-utils/fileupload/filename.ts
|
|
5058
|
-
var
|
|
5059
|
-
function
|
|
5082
|
+
var gi = ".jpeg, .jpg, .png, .gif, .webp, .heic";
|
|
5083
|
+
function _i(e, t = ce.fileupload.unknownFilename) {
|
|
5060
5084
|
return e.attributes?.targetFilename || e.file?.name || t;
|
|
5061
5085
|
}
|
|
5062
5086
|
//#endregion
|
|
5063
5087
|
//#region src/utils/stringutils.ts
|
|
5064
|
-
var
|
|
5065
|
-
let e =
|
|
5088
|
+
var vi = () => ("00000000000000000" + (Math.random() * 0x10000000000000000).toString(16)).slice(-16), yi = () => {
|
|
5089
|
+
let e = vi(), t = vi();
|
|
5066
5090
|
return e.slice(0, 8) + "-" + e.slice(8, 12) + "-4" + e.slice(13) + "-a" + t.slice(1, 4) + "-" + t.slice(4);
|
|
5067
|
-
},
|
|
5091
|
+
}, bi = class {
|
|
5068
5092
|
fileId;
|
|
5069
5093
|
file;
|
|
5070
5094
|
attributes;
|
|
5071
5095
|
constructor(e, t) {
|
|
5072
|
-
this.fileId = t ||
|
|
5096
|
+
this.fileId = t || yi(), this.file = e, this.attributes = { targetFilename: e.name };
|
|
5073
5097
|
}
|
|
5074
|
-
},
|
|
5098
|
+
}, xi = n({}), Si = i(({ id: e, multiple: t, value: n, onFilesAdded: r = () => {}, name: i, uploadStrategy: a, accept: s, isThumbnailView: l = !1, disabled: d = !1, hasVisibleLabel: h = !1, strings: y, ...b }, x) => {
|
|
5075
5099
|
let S = p(null), C = typeof s == "string" && s.trim().length > 0 ? s : void 0, w = f(() => C ? C.split(/\s*,\s*/).map((e) => e.trim()).filter(Boolean).join(", ").toUpperCase() : "", [C]);
|
|
5076
5100
|
u(x, () => S.current);
|
|
5077
5101
|
let [T, E] = m(!1), D = ge(["fileupload"], y), O = f(() => l ? t ? {
|
|
@@ -5096,14 +5120,14 @@ var _i = () => ("00000000000000000" + (Math.random() * 0x10000000000000000).toSt
|
|
|
5096
5120
|
D
|
|
5097
5121
|
]), k = o((e) => {
|
|
5098
5122
|
if (S.current) try {
|
|
5099
|
-
S.current.files =
|
|
5123
|
+
S.current.files = Ci(e);
|
|
5100
5124
|
} catch {}
|
|
5101
5125
|
}, [S.current, n]);
|
|
5102
5126
|
c(() => {
|
|
5103
5127
|
k(n);
|
|
5104
5128
|
}, [S, n]);
|
|
5105
5129
|
let A = o((e) => {
|
|
5106
|
-
r(e.map((e) => new
|
|
5130
|
+
r(e.map((e) => new bi(e))), S.current && (S.current.value = "");
|
|
5107
5131
|
}, [r]), j = (e) => {
|
|
5108
5132
|
let t = e.target.files;
|
|
5109
5133
|
if (t.length === 0) {
|
|
@@ -5186,32 +5210,23 @@ var _i = () => ("00000000000000000" + (Math.random() * 0x10000000000000000).toSt
|
|
|
5186
5210
|
})
|
|
5187
5211
|
]
|
|
5188
5212
|
});
|
|
5189
|
-
}),
|
|
5213
|
+
}), Ci = (e) => {
|
|
5190
5214
|
let t = new DataTransfer();
|
|
5191
5215
|
for (let n of e) t.items.add(n.file);
|
|
5192
5216
|
return t.files;
|
|
5193
|
-
}
|
|
5194
|
-
//#endregion
|
|
5195
|
-
//#region src/hooks/useGeneratedId.ts
|
|
5196
|
-
function Ci(e) {
|
|
5197
|
-
let t = f(() => Qn(), []);
|
|
5198
|
-
return e || t;
|
|
5199
|
-
}
|
|
5200
|
-
//#endregion
|
|
5201
|
-
//#region src/components/textarea/Textarea.tsx
|
|
5202
|
-
var wi = i(({ id: e, ariaDescribedby: t, ariaLabelledby: n, counter: r, hasFieldset: i, counterMaxLength: a, className: o, disabled: s, errorMessage: l, hasError: u = !1, helptext: d, helptextDropdown: f, helptextDropdownButton: p, inline: h, fullwidth: g = !1, label: v, name: y, optionalTag: b = !1, optionalText: x, requiredTag: S = !1, requiredText: C, tagText: w = null, placeholder: T, rows: E, useWrapper: D = !0, onChange: O, value: k, autoComplete: A = "off", minLength: j, maxLength: M, readOnly: N, skipForwardTestid: P = !1, inputSize: ee = "medium", strings: te, ...ne }, F) => {
|
|
5217
|
+
}, wi = i(({ id: e, ariaDescribedby: t, ariaLabelledby: n, counter: r, hasFieldset: i, counterMaxLength: a, className: o, disabled: s, errorMessage: l, hasError: u = !1, helptext: d, helptextDropdown: f, helptextDropdownButton: p, inline: h, fullwidth: g = !1, label: v, name: y, optionalTag: b = !1, optionalText: x, requiredTag: S = !1, requiredText: C, tagText: w = null, placeholder: T, rows: E, useWrapper: D = !0, onChange: O, value: k, autoComplete: A = "off", minLength: j, maxLength: M, readOnly: N, skipForwardTestid: P = !1, inputSize: ee = "medium", strings: te, ...ne }, F) => {
|
|
5203
5218
|
let re = r ?? (a ?? 0) > 0, ie = [
|
|
5204
5219
|
o,
|
|
5205
5220
|
"pkt-textinput",
|
|
5206
5221
|
"pkt-textarea"
|
|
5207
|
-
].filter(Boolean).join(" "), ae =
|
|
5222
|
+
].filter(Boolean).join(" "), ae = Jn(e), oe = `${ae}-input`, se = `${oe}-label`, I = n || se, [L, R] = m(0), ce = (e) => {
|
|
5208
5223
|
re && R(e.currentTarget?.value?.length || 0), O && O(e);
|
|
5209
5224
|
};
|
|
5210
5225
|
return c(() => {
|
|
5211
5226
|
k !== void 0 && R(k?.length || 0);
|
|
5212
5227
|
}, [k]), /* @__PURE__ */ _("div", {
|
|
5213
5228
|
className: ie,
|
|
5214
|
-
children: /* @__PURE__ */ _(
|
|
5229
|
+
children: /* @__PURE__ */ _(rr, {
|
|
5215
5230
|
strings: te,
|
|
5216
5231
|
ariaDescribedby: t,
|
|
5217
5232
|
disabled: s,
|
|
@@ -5247,7 +5262,7 @@ var wi = i(({ id: e, ariaDescribedby: t, ariaLabelledby: n, counter: r, hasField
|
|
|
5247
5262
|
"aria-labelledby": I,
|
|
5248
5263
|
"aria-invalid": u,
|
|
5249
5264
|
"aria-errormessage": u ? `${ae}-error` : void 0,
|
|
5250
|
-
"aria-describedby":
|
|
5265
|
+
"aria-describedby": Zn({
|
|
5251
5266
|
id: oe,
|
|
5252
5267
|
hasHelptext: !!d,
|
|
5253
5268
|
hasCounter: re,
|
|
@@ -5289,7 +5304,7 @@ var Ti = "comments", Ei = (e) => {
|
|
|
5289
5304
|
disabled: t,
|
|
5290
5305
|
defaultValue: i?.text
|
|
5291
5306
|
}),
|
|
5292
|
-
/* @__PURE__ */ _(
|
|
5307
|
+
/* @__PURE__ */ _(Z, {
|
|
5293
5308
|
skin: "secondary",
|
|
5294
5309
|
size: "small",
|
|
5295
5310
|
disabled: t,
|
|
@@ -5302,7 +5317,7 @@ var Ti = "comments", Ei = (e) => {
|
|
|
5302
5317
|
},
|
|
5303
5318
|
children: o ? "Lagre kommentar" : "Legg til kommentar"
|
|
5304
5319
|
}),
|
|
5305
|
-
/* @__PURE__ */ _(
|
|
5320
|
+
/* @__PURE__ */ _(Z, {
|
|
5306
5321
|
skin: "tertiary",
|
|
5307
5322
|
size: "small",
|
|
5308
5323
|
disabled: t,
|
|
@@ -5344,7 +5359,7 @@ var Ti = "comments", Ei = (e) => {
|
|
|
5344
5359
|
})]
|
|
5345
5360
|
})
|
|
5346
5361
|
}), ki = ({ comments: e }) => {
|
|
5347
|
-
let t = s(
|
|
5362
|
+
let t = s(xi);
|
|
5348
5363
|
return /* @__PURE__ */ _("input", {
|
|
5349
5364
|
type: "hidden",
|
|
5350
5365
|
name: `${t.name}-comments`,
|
|
@@ -5402,14 +5417,14 @@ var Ti = "comments", Ei = (e) => {
|
|
|
5402
5417
|
e.key === "Enter" && (e.preventDefault(), e.stopPropagation(), o()), e.key === "Escape" && (e.preventDefault(), e.stopPropagation(), r());
|
|
5403
5418
|
}
|
|
5404
5419
|
}),
|
|
5405
|
-
/* @__PURE__ */ _(
|
|
5420
|
+
/* @__PURE__ */ _(Z, {
|
|
5406
5421
|
skin: "secondary",
|
|
5407
5422
|
size: "small",
|
|
5408
5423
|
disabled: t,
|
|
5409
5424
|
onClick: o,
|
|
5410
5425
|
children: "Lagre"
|
|
5411
5426
|
}),
|
|
5412
|
-
/* @__PURE__ */ _(
|
|
5427
|
+
/* @__PURE__ */ _(Z, {
|
|
5413
5428
|
skin: "tertiary",
|
|
5414
5429
|
size: "small",
|
|
5415
5430
|
disabled: t,
|
|
@@ -5418,13 +5433,13 @@ var Ti = "comments", Ei = (e) => {
|
|
|
5418
5433
|
})
|
|
5419
5434
|
] });
|
|
5420
5435
|
}, Pi = ({ targetFilename: e }) => {
|
|
5421
|
-
let t = s(
|
|
5436
|
+
let t = s(xi);
|
|
5422
5437
|
return /* @__PURE__ */ _("input", {
|
|
5423
5438
|
type: "hidden",
|
|
5424
5439
|
name: `${t.name}-targetFilename`,
|
|
5425
5440
|
value: e
|
|
5426
5441
|
});
|
|
5427
|
-
}, Fi = (e) => e.getAttribute("targetFilename") ||
|
|
5442
|
+
}, Fi = (e) => e.getAttribute("targetFilename") || _i(e.file, ""), Ii = {
|
|
5428
5443
|
id: "rename",
|
|
5429
5444
|
title: "Rediger",
|
|
5430
5445
|
ariaLabel: "Rediger filnavn",
|
|
@@ -5472,7 +5487,7 @@ var Ti = "comments", Ei = (e) => {
|
|
|
5472
5487
|
n(!1), a.current?.close();
|
|
5473
5488
|
}, []),
|
|
5474
5489
|
navigate: o((t) => {
|
|
5475
|
-
e.length !== 0 && i((n) =>
|
|
5490
|
+
e.length !== 0 && i((n) => mi(n, t, e.length));
|
|
5476
5491
|
}, [e.length])
|
|
5477
5492
|
};
|
|
5478
5493
|
}, zi = (e) => {
|
|
@@ -5521,7 +5536,7 @@ var Ti = "comments", Ei = (e) => {
|
|
|
5521
5536
|
i
|
|
5522
5537
|
]);
|
|
5523
5538
|
}, Vi = i(({ ariaLabel: e, ariaLabelledby: t, ariaLive: n = "polite", ariaValueText: r, id: i, role: a = "progressbar", skin: o = "dark-blue", statusPlacement: s = "following", statusType: l = "none", title: u, titlePosition: d = "left", valueCurrent: h = 0, valueMax: g = 100, valueMin: y = 0, className: b, ...x }, S) => {
|
|
5524
|
-
let C = f(() =>
|
|
5539
|
+
let C = f(() => qn(), []), w = i || C, T = p(null), [E, D] = m(0);
|
|
5525
5540
|
c(() => {
|
|
5526
5541
|
T.current && D(T.current.getBoundingClientRect().width || 0);
|
|
5527
5542
|
}, [h]);
|
|
@@ -5638,7 +5653,7 @@ var Hi = "is-scroll-locked", Ui = 0, Wi = 0, Gi = () => typeof document < "u" &&
|
|
|
5638
5653
|
}) : /* @__PURE__ */ _("div", { className: "pkt-modal__headingText" }),
|
|
5639
5654
|
i ? /* @__PURE__ */ _("div", { className: "pkt-modal__noCloseButton" }) : /* @__PURE__ */ _("div", {
|
|
5640
5655
|
className: (0, M.default)("pkt-modal__closeButton", { [`pkt-modal__closeButton--${u}`]: !0 }),
|
|
5641
|
-
children: /* @__PURE__ */ _(
|
|
5656
|
+
children: /* @__PURE__ */ _(Z, {
|
|
5642
5657
|
onClick: C,
|
|
5643
5658
|
"aria-label": "close",
|
|
5644
5659
|
iconName: "close",
|
|
@@ -5664,7 +5679,7 @@ Qi.displayName = "PktModal";
|
|
|
5664
5679
|
//#endregion
|
|
5665
5680
|
//#region src/components/fileupload/Truncate.tsx
|
|
5666
5681
|
var $i = n({ tail: 5 }), ea = ({ children: e, tail: t }) => {
|
|
5667
|
-
let n = s($i), r =
|
|
5682
|
+
let n = s($i), r = pi(e, t === void 0 ? n.tail : t);
|
|
5668
5683
|
return r ? /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _("span", {
|
|
5669
5684
|
className: "pkt-fileupload__queue-display__item__title__head",
|
|
5670
5685
|
"data-pkt-truncate-part": "first",
|
|
@@ -5699,12 +5714,12 @@ var $i = n({ tail: 5 }), ea = ({ children: e, tail: t }) => {
|
|
|
5699
5714
|
/* @__PURE__ */ v("p", {
|
|
5700
5715
|
className: "pkt-fileupload__queue-display__item__title",
|
|
5701
5716
|
"aria-label": "Filnavn",
|
|
5702
|
-
children: [/* @__PURE__ */ _(ea, { children:
|
|
5717
|
+
children: [/* @__PURE__ */ _(ea, { children: _i(t) }), /* @__PURE__ */ v("span", {
|
|
5703
5718
|
className: "pkt-fileupload__queue-display__item__filesize",
|
|
5704
5719
|
children: [
|
|
5705
5720
|
" ",
|
|
5706
5721
|
"(",
|
|
5707
|
-
|
|
5722
|
+
Xr(t.file.size),
|
|
5708
5723
|
")"
|
|
5709
5724
|
]
|
|
5710
5725
|
})]
|
|
@@ -5727,12 +5742,12 @@ var $i = n({ tail: 5 }), ea = ({ children: e, tail: t }) => {
|
|
|
5727
5742
|
] });
|
|
5728
5743
|
}, ia = ({ transferItem: e }) => /* @__PURE__ */ v("p", {
|
|
5729
5744
|
className: "pkt-fileupload__queue-display__item__title",
|
|
5730
|
-
children: [/* @__PURE__ */ _(ea, { children:
|
|
5745
|
+
children: [/* @__PURE__ */ _(ea, { children: _i(e) }), e.file && /* @__PURE__ */ v("span", {
|
|
5731
5746
|
className: "pkt-fileupload__queue-display__item__filesize",
|
|
5732
5747
|
children: [
|
|
5733
5748
|
" ",
|
|
5734
5749
|
"(",
|
|
5735
|
-
|
|
5750
|
+
Xr(e.file.size),
|
|
5736
5751
|
")"
|
|
5737
5752
|
]
|
|
5738
5753
|
})]
|
|
@@ -5825,7 +5840,7 @@ var $i = n({ tail: 5 }), ea = ({ children: e, tail: t }) => {
|
|
|
5825
5840
|
}), l = !!t;
|
|
5826
5841
|
return /* @__PURE__ */ v("div", {
|
|
5827
5842
|
className: `pkt-fileupload__queue-display__item__thumbnail${n && !i ? "" : " pkt-fileupload__queue-display__item__thumbnail--fallback"}`,
|
|
5828
|
-
children: [/* @__PURE__ */ v(
|
|
5843
|
+
children: [/* @__PURE__ */ v(Z, {
|
|
5829
5844
|
className: "pkt-fileupload__queue-display__item__thumbnail__image-wrapper",
|
|
5830
5845
|
"aria-label": `Forhåndsvis bilde ${e.attributes.targetFilename}`,
|
|
5831
5846
|
type: "button",
|
|
@@ -5853,7 +5868,7 @@ var $i = n({ tail: 5 }), ea = ({ children: e, tail: t }) => {
|
|
|
5853
5868
|
if (!e) return;
|
|
5854
5869
|
let t = (e) => {
|
|
5855
5870
|
if (e.key === "Tab") {
|
|
5856
|
-
|
|
5871
|
+
fi(e, a.current);
|
|
5857
5872
|
return;
|
|
5858
5873
|
}
|
|
5859
5874
|
switch (e.key) {
|
|
@@ -5881,7 +5896,7 @@ var $i = n({ tail: 5 }), ea = ({ children: e, tail: t }) => {
|
|
|
5881
5896
|
children: /* @__PURE__ */ v("div", {
|
|
5882
5897
|
className: "pkt-fileupload__image-preview",
|
|
5883
5898
|
children: [
|
|
5884
|
-
f && /* @__PURE__ */ _(
|
|
5899
|
+
f && /* @__PURE__ */ _(Z, {
|
|
5885
5900
|
variant: "icon-only",
|
|
5886
5901
|
iconName: "chevron-thin-left",
|
|
5887
5902
|
skin: "secondary",
|
|
@@ -5910,7 +5925,7 @@ var $i = n({ tail: 5 }), ea = ({ children: e, tail: t }) => {
|
|
|
5910
5925
|
t.length
|
|
5911
5926
|
]
|
|
5912
5927
|
}),
|
|
5913
|
-
f && /* @__PURE__ */ _(
|
|
5928
|
+
f && /* @__PURE__ */ _(Z, {
|
|
5914
5929
|
variant: "icon-only",
|
|
5915
5930
|
iconName: "chevron-thin-right",
|
|
5916
5931
|
skin: "secondary",
|
|
@@ -5983,7 +5998,7 @@ var $i = n({ tail: 5 }), ea = ({ children: e, tail: t }) => {
|
|
|
5983
5998
|
})
|
|
5984
5999
|
] });
|
|
5985
6000
|
}, _a = (e) => {
|
|
5986
|
-
let { transferItem: t, enableImagePreview: n, onCancelTransfer: r, onOpenPreview: i, disabled: a } = e, o =
|
|
6001
|
+
let { transferItem: t, enableImagePreview: n, onCancelTransfer: r, onOpenPreview: i, disabled: a } = e, o = ii(t.progress), s = n && t.progress === "done" && ri(t);
|
|
5987
6002
|
switch (o) {
|
|
5988
6003
|
case "in-progress": return /* @__PURE__ */ _(ra, {
|
|
5989
6004
|
transferItem: t,
|
|
@@ -6000,11 +6015,11 @@ var $i = n({ tail: 5 }), ea = ({ children: e, tail: t }) => {
|
|
|
6000
6015
|
onPreviewClick: s ? () => i(t.fileId) : void 0
|
|
6001
6016
|
});
|
|
6002
6017
|
}
|
|
6003
|
-
}, va = (e, t, n) => f(() =>
|
|
6018
|
+
}, va = (e, t, n) => f(() => ai(e, t, n), [
|
|
6004
6019
|
e,
|
|
6005
6020
|
t,
|
|
6006
6021
|
n
|
|
6007
|
-
]), ya = (e, t) => f(() => t ? e.filter((e) => e.progress === "done" &&
|
|
6022
|
+
]), ya = (e, t) => f(() => t ? e.filter((e) => e.progress === "done" && ri(e)) : [], [e, t]), ba = ({ files: e, cancelTransfer: t, transfers: n = [], queueItemOperations: r = [], ItemRenderer: i = la, truncateTail: a, enableImagePreview: o = !1, uploadStrategy: s = "form", disabled: c = !1, inputName: l, buildAttributeAccessors: u }) => {
|
|
6008
6023
|
let d = va(e, n, s), f = ya(d, o), p = zi(r), m = Ri(f);
|
|
6009
6024
|
return /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _("ul", {
|
|
6010
6025
|
className: "pkt-fileupload__queue-display",
|
|
@@ -6051,20 +6066,20 @@ var $i = n({ tail: 5 }), ea = ({ children: e, tail: t }) => {
|
|
|
6051
6066
|
filename: la,
|
|
6052
6067
|
thumbnail: ua
|
|
6053
6068
|
}, Sa = i(({ value: e, defaultValue: t, id: n, multiple: r = !1, uploadStrategy: i = "form", addCommentsEnabled: a = !1, renameFilesEnabled: s = !1, truncateTail: d = 4, onFilesChanged: h, onFileUploadRequested: g, extraOperations: y = [], itemRenderer: b = xa.filename, fullwidth: x = !1, allowedFormats: S, formatErrorMessage: C, maxFileSize: w, sizeErrorMessage: T, onFileValidation: E, onFileValidate: D, errorMessage: O, hasError: k = !1, disabled: A = !1, label: j, helptext: N, helptextDropdown: P, helptextDropdownButton: ee, optionalTag: te, optionalText: ne, requiredTag: F, requiredText: re, tagText: ie, required: ae = !1, enableImagePreview: oe = !1, "aria-describedby": se, "aria-invalid": I, strings: L, ...R }, ce) => {
|
|
6054
|
-
let z = l(),
|
|
6055
|
-
u(ce, () =>
|
|
6056
|
-
let ue = "transfers" in R ? R.transfers : void 0, U = ge(["fileupload"], L).fileupload, [
|
|
6069
|
+
let z = l(), V = n ?? `pkt-fileupload-${z}`, H = p(null);
|
|
6070
|
+
u(ce, () => H.current, []);
|
|
6071
|
+
let ue = "transfers" in R ? R.transfers : void 0, U = ge(["fileupload"], L).fileupload, [W, G] = m(null), [K, q] = m("");
|
|
6057
6072
|
c(() => {
|
|
6058
|
-
if (!
|
|
6059
|
-
let e = setTimeout(() =>
|
|
6073
|
+
if (!K) return;
|
|
6074
|
+
let e = setTimeout(() => q(""), 1500);
|
|
6060
6075
|
return () => clearTimeout(e);
|
|
6061
|
-
}, [
|
|
6062
|
-
let
|
|
6076
|
+
}, [K]);
|
|
6077
|
+
let de = W ?? O ?? null, J = k || !!W || !!(O && O.trim()), fe = de ? `${V}-error` : void 0, pe = [
|
|
6063
6078
|
se,
|
|
6064
|
-
N ? `${
|
|
6065
|
-
|
|
6066
|
-
].filter(Boolean).join(" ") || void 0,
|
|
6067
|
-
let t =
|
|
6079
|
+
N ? `${V}-helptext` : void 0,
|
|
6080
|
+
fe
|
|
6081
|
+
].filter(Boolean).join(" ") || void 0, me = J || I === !0 || I === "true", Y = o((e) => {
|
|
6082
|
+
let t = ni(e, {
|
|
6068
6083
|
allowedFormats: S,
|
|
6069
6084
|
maxFileSize: w,
|
|
6070
6085
|
formatErrorMessage: C,
|
|
@@ -6089,24 +6104,24 @@ var $i = n({ tail: 5 }), ea = ({ children: e, tail: t }) => {
|
|
|
6089
6104
|
D
|
|
6090
6105
|
]);
|
|
6091
6106
|
e !== void 0 && t !== void 0 && console.warn("PktFileupload: Både value og defaultValue er angitt. Komponenten kan være enten 'controlled' eller 'uncontrolled', ikke begge deler. Bruk kun én av dem. Se https://react.dev/reference/react-dom/components/input#controlling-an-input-with-a-state-variable"), e !== void 0 && h === void 0 && console.warn("PktFileupload: value-prop er angitt uten onFilesChanged-callback. Når en komponent er 'controlled', må endringer håndteres via en callback. Vennligst legg til onFilesChanged-callback for å håndtere endringer i fil-listen. Se https://react.dev/reference/react-dom/components/input#controlling-an-input-with-a-state-variable");
|
|
6092
|
-
let
|
|
6093
|
-
Bi(
|
|
6107
|
+
let X = e !== void 0, [Z, he] = m(() => t ?? []), Q = X ? e : Z;
|
|
6108
|
+
Bi(H, {
|
|
6094
6109
|
uploadStrategy: i,
|
|
6095
6110
|
required: ae,
|
|
6096
6111
|
currentFileCount: Q.length,
|
|
6097
|
-
onMissingFiles: o(() =>
|
|
6112
|
+
onMissingFiles: o(() => G(U.requiredMissing), [U])
|
|
6098
6113
|
});
|
|
6099
|
-
let
|
|
6114
|
+
let _e = typeof b == "string" ? xa[b] : b, ve = b === "thumbnail", ye = typeof R.accept == "string" ? R.accept.trim() : void 0, be = f(() => ei(ye, S) || void 0, [ye, S]), xe = s && !ve, Se = a && !ve, Ce = o((e) => {
|
|
6100
6115
|
for (let t of e) {
|
|
6101
6116
|
let e = Y(t.file);
|
|
6102
6117
|
if (e) {
|
|
6103
|
-
|
|
6118
|
+
G(e);
|
|
6104
6119
|
return;
|
|
6105
6120
|
}
|
|
6106
6121
|
}
|
|
6107
|
-
|
|
6122
|
+
G(null);
|
|
6108
6123
|
let t = r ? [...Q, ...e] : [e[0]], n = r ? e : [e[0]];
|
|
6109
|
-
|
|
6124
|
+
q(n.length === 1 ? B(U.srFileAdded, { filename: n[0].attributes.targetFilename }) : B(U.srFilesAdded, { count: n.length })), X || he(t), h?.(t), i === "custom" && g && e.forEach((e) => {
|
|
6110
6125
|
g?.(e);
|
|
6111
6126
|
});
|
|
6112
6127
|
}, [
|
|
@@ -6116,56 +6131,56 @@ var $i = n({ tail: 5 }), ea = ({ children: e, tail: t }) => {
|
|
|
6116
6131
|
i,
|
|
6117
6132
|
g,
|
|
6118
6133
|
Y,
|
|
6119
|
-
|
|
6134
|
+
X,
|
|
6120
6135
|
U
|
|
6121
|
-
]),
|
|
6136
|
+
]), we = o((e, t) => {
|
|
6122
6137
|
let n = Q.map((n) => n.fileId === e ? {
|
|
6123
6138
|
...n,
|
|
6124
6139
|
...t
|
|
6125
6140
|
} : n);
|
|
6126
|
-
|
|
6141
|
+
X || he(n), h?.(n);
|
|
6127
6142
|
}, [
|
|
6128
6143
|
h,
|
|
6129
6144
|
Q,
|
|
6130
|
-
|
|
6131
|
-
]),
|
|
6145
|
+
X
|
|
6146
|
+
]), Te = o((e) => {
|
|
6132
6147
|
let t = Q.filter((t) => t.fileId !== e);
|
|
6133
|
-
|
|
6148
|
+
X || he(t), h?.(t), "onTransferCancelled" in R && R.onTransferCancelled && R.onTransferCancelled?.(e);
|
|
6134
6149
|
}, [
|
|
6135
6150
|
h,
|
|
6136
6151
|
Q,
|
|
6137
6152
|
R,
|
|
6138
|
-
|
|
6139
|
-
]), { buildAttributeAccessors:
|
|
6153
|
+
X
|
|
6154
|
+
]), { buildAttributeAccessors: Ee } = Li(Q, we), De = f(() => {
|
|
6140
6155
|
let e = [];
|
|
6141
|
-
return
|
|
6156
|
+
return xe && e.push(Ii), Se && e.push(ji), e.push(...y), e.push(Mi(Te)), e;
|
|
6142
6157
|
}, [
|
|
6158
|
+
xe,
|
|
6143
6159
|
Se,
|
|
6144
|
-
Ce,
|
|
6145
6160
|
y,
|
|
6146
|
-
|
|
6147
|
-
]), { totalCount:
|
|
6161
|
+
Te
|
|
6162
|
+
]), { totalCount: Oe, uploadedCount: ke, failedCount: Ae } = f(() => hi(Q, ue), [Q, ue]), je = le(Oe, U.fileLabelOne, U.fileLabelOther), Me = /* @__PURE__ */ _("div", {
|
|
6148
6163
|
className: (0, M.default)("pkt-fileupload", {
|
|
6149
6164
|
"pkt-fileupload--full-width": x,
|
|
6150
|
-
"pkt-fileupload--error":
|
|
6165
|
+
"pkt-fileupload--error": J,
|
|
6151
6166
|
"pkt-fileupload--disabled": A
|
|
6152
6167
|
}),
|
|
6153
6168
|
"aria-disabled": A,
|
|
6154
6169
|
...A ? { inert: !0 } : {},
|
|
6155
|
-
children: /* @__PURE__ */ v(
|
|
6170
|
+
children: /* @__PURE__ */ v(xi.Provider, {
|
|
6156
6171
|
value: {
|
|
6157
6172
|
name: R.name || "",
|
|
6158
6173
|
multiple: !!r,
|
|
6159
|
-
id:
|
|
6174
|
+
id: V
|
|
6160
6175
|
},
|
|
6161
6176
|
children: [
|
|
6162
6177
|
/* @__PURE__ */ _("div", {
|
|
6163
6178
|
className: "pkt-sr-only",
|
|
6164
6179
|
"aria-live": "polite",
|
|
6165
6180
|
"aria-atomic": "true",
|
|
6166
|
-
children:
|
|
6167
|
-
uploaded:
|
|
6168
|
-
total:
|
|
6181
|
+
children: K || (Oe > 0 && ke > 0 ? B(U.srFilesUploadedOfTotal, {
|
|
6182
|
+
uploaded: ke,
|
|
6183
|
+
total: Oe,
|
|
6169
6184
|
label: je
|
|
6170
6185
|
}) : "")
|
|
6171
6186
|
}),
|
|
@@ -6173,66 +6188,66 @@ var $i = n({ tail: 5 }), ea = ({ children: e, tail: t }) => {
|
|
|
6173
6188
|
className: "pkt-sr-only",
|
|
6174
6189
|
"aria-live": "assertive",
|
|
6175
6190
|
"aria-atomic": "true",
|
|
6176
|
-
children:
|
|
6191
|
+
children: Oe > 0 && Ae > 0 && B(U.srFilesFailedOfTotal, {
|
|
6177
6192
|
failed: Ae,
|
|
6178
|
-
total:
|
|
6193
|
+
total: Oe,
|
|
6179
6194
|
label: je
|
|
6180
6195
|
})
|
|
6181
6196
|
}),
|
|
6182
|
-
/* @__PURE__ */ _(
|
|
6183
|
-
id:
|
|
6197
|
+
/* @__PURE__ */ _(Si, {
|
|
6198
|
+
id: V,
|
|
6184
6199
|
name: R.name || "",
|
|
6185
6200
|
value: Q,
|
|
6186
|
-
onFilesAdded:
|
|
6201
|
+
onFilesAdded: Ce,
|
|
6187
6202
|
multiple: r,
|
|
6188
6203
|
uploadStrategy: i,
|
|
6189
|
-
ref:
|
|
6190
|
-
accept:
|
|
6191
|
-
isThumbnailView:
|
|
6204
|
+
ref: H,
|
|
6205
|
+
accept: ve ? gi : be,
|
|
6206
|
+
isThumbnailView: ve,
|
|
6192
6207
|
disabled: A,
|
|
6193
6208
|
required: ae && i === "form",
|
|
6194
6209
|
"aria-required": ae ? "true" : void 0,
|
|
6195
|
-
"aria-invalid":
|
|
6196
|
-
"aria-describedby":
|
|
6210
|
+
"aria-invalid": me ? "true" : void 0,
|
|
6211
|
+
"aria-describedby": pe,
|
|
6197
6212
|
hasVisibleLabel: !!j,
|
|
6198
6213
|
strings: L
|
|
6199
6214
|
}),
|
|
6200
|
-
|
|
6215
|
+
J && de && /* @__PURE__ */ _($, {
|
|
6201
6216
|
skin: "error",
|
|
6202
6217
|
"aria-live": "assertive",
|
|
6203
6218
|
role: "alert",
|
|
6204
6219
|
compact: !0,
|
|
6205
|
-
id:
|
|
6220
|
+
id: fe,
|
|
6206
6221
|
className: "pkt-fileupload__error-alert",
|
|
6207
|
-
children:
|
|
6222
|
+
children: de
|
|
6208
6223
|
}),
|
|
6209
6224
|
Q.length > 0 && /* @__PURE__ */ _(ba, {
|
|
6210
6225
|
files: Q,
|
|
6211
|
-
cancelTransfer:
|
|
6226
|
+
cancelTransfer: Te,
|
|
6212
6227
|
truncateTail: d,
|
|
6213
6228
|
transfers: ue,
|
|
6214
6229
|
uploadStrategy: i,
|
|
6215
|
-
ItemRenderer:
|
|
6216
|
-
enableImagePreview:
|
|
6230
|
+
ItemRenderer: _e,
|
|
6231
|
+
enableImagePreview: ve && oe,
|
|
6217
6232
|
disabled: A,
|
|
6218
6233
|
inputName: R.name || "",
|
|
6219
|
-
buildAttributeAccessors:
|
|
6220
|
-
queueItemOperations:
|
|
6234
|
+
buildAttributeAccessors: Ee,
|
|
6235
|
+
queueItemOperations: De
|
|
6221
6236
|
})
|
|
6222
6237
|
]
|
|
6223
6238
|
})
|
|
6224
6239
|
});
|
|
6225
6240
|
return j ? /* @__PURE__ */ _("div", {
|
|
6226
6241
|
className: "pkt-fileupload-component",
|
|
6227
|
-
children: /* @__PURE__ */ _(
|
|
6242
|
+
children: /* @__PURE__ */ _(rr, {
|
|
6228
6243
|
strings: L,
|
|
6229
|
-
forId:
|
|
6244
|
+
forId: V,
|
|
6230
6245
|
label: j,
|
|
6231
6246
|
helptext: N,
|
|
6232
6247
|
helptextDropdown: P,
|
|
6233
6248
|
helptextDropdownButton: ee,
|
|
6234
6249
|
disabled: A,
|
|
6235
|
-
hasError:
|
|
6250
|
+
hasError: J,
|
|
6236
6251
|
optionalTag: te,
|
|
6237
6252
|
optionalText: ne,
|
|
6238
6253
|
requiredTag: F,
|
|
@@ -6391,7 +6406,7 @@ function Va({ data: e, dataUrl: t, locale: n = "nb-NO", skipGlobal: r = !1, onDa
|
|
|
6391
6406
|
]);
|
|
6392
6407
|
}
|
|
6393
6408
|
var Ha = ({ link: e, includeConsent: t, consent: n }) => {
|
|
6394
|
-
if (e.url === Ba) return t ? /* @__PURE__ */ _("li", { children: /* @__PURE__ */ _(
|
|
6409
|
+
if (e.url === Ba) return t ? /* @__PURE__ */ _("li", { children: /* @__PURE__ */ _(Nr, {
|
|
6395
6410
|
triggerType: "footerlink",
|
|
6396
6411
|
triggerText: e.text,
|
|
6397
6412
|
...n
|
|
@@ -6540,7 +6555,7 @@ var Ha = ({ link: e, includeConsent: t, consent: n }) => {
|
|
|
6540
6555
|
}),
|
|
6541
6556
|
k && /* @__PURE__ */ _("div", {
|
|
6542
6557
|
className: "pkt-footer__consent",
|
|
6543
|
-
children: /* @__PURE__ */ _(
|
|
6558
|
+
children: /* @__PURE__ */ _(Nr, {
|
|
6544
6559
|
triggerType: "footerlink",
|
|
6545
6560
|
...O
|
|
6546
6561
|
})
|
|
@@ -6642,7 +6657,7 @@ var Ha = ({ link: e, includeConsent: t, consent: n }) => {
|
|
|
6642
6657
|
children: [w.map((e) => /* @__PURE__ */ _("li", { children: /* @__PURE__ */ _(Ya, {
|
|
6643
6658
|
link: e,
|
|
6644
6659
|
openLinksInNewTab: s
|
|
6645
|
-
}) }, `${e.href}|${e.text}`)), E && /* @__PURE__ */ _("li", { children: /* @__PURE__ */ _(
|
|
6660
|
+
}) }, `${e.href}|${e.text}`)), E && /* @__PURE__ */ _("li", { children: /* @__PURE__ */ _(Nr, {
|
|
6646
6661
|
triggerType: "footerlink",
|
|
6647
6662
|
...T
|
|
6648
6663
|
}) })]
|
|
@@ -7056,10 +7071,10 @@ var ho = i(({ appearance: e = "local", inputSize: t = "medium", disabled: n = !1
|
|
|
7056
7071
|
`pkt-searchinput--${e}`,
|
|
7057
7072
|
`pkt-searchinput--${t}`,
|
|
7058
7073
|
r && "pkt-searchinput--fullwidth"
|
|
7059
|
-
].filter(Boolean).join(" "), D = f(() =>
|
|
7074
|
+
].filter(Boolean).join(" "), D = f(() => qn(), []), O = i || D, k = {
|
|
7060
7075
|
role: "search",
|
|
7061
7076
|
className: E,
|
|
7062
|
-
...
|
|
7077
|
+
...Xn()
|
|
7063
7078
|
}, A = (e) => u ? /* @__PURE__ */ _("form", {
|
|
7064
7079
|
...k,
|
|
7065
7080
|
action: u,
|
|
@@ -7100,7 +7115,7 @@ var ho = i(({ appearance: e = "local", inputSize: t = "medium", disabled: n = !1
|
|
|
7100
7115
|
e.key === "Enter" && (e.preventDefault(), m(l));
|
|
7101
7116
|
}),
|
|
7102
7117
|
...b
|
|
7103
|
-
}), /* @__PURE__ */ _(
|
|
7118
|
+
}), /* @__PURE__ */ _(Z, {
|
|
7104
7119
|
className: `pkt-searchinput__button ${e === "local" ? "pkt-input-icon" : ""}`,
|
|
7105
7120
|
variant: "icon-only",
|
|
7106
7121
|
iconName: "magnifying-glass-big",
|
|
@@ -7139,7 +7154,7 @@ var ho = i(({ appearance: e = "local", inputSize: t = "medium", disabled: n = !1
|
|
|
7139
7154
|
ho.displayName = "PktSearchInput";
|
|
7140
7155
|
//#endregion
|
|
7141
7156
|
//#region src/components/header/HeaderGlobal.tsx
|
|
7142
|
-
var go = "https://punkt-cdn.oslo.kommune.no/18.
|
|
7157
|
+
var go = "https://punkt-cdn.oslo.kommune.no/18.8/logos/";
|
|
7143
7158
|
typeof window < "u" && (window.pktLogoPath = window.pktLogoPath || go);
|
|
7144
7159
|
var _o = "pkt-header-global-menu", vo = "pkt-header-global-menu-toggle", yo = "pkt-header-global-search-panel", bo = "pkt-header-global-search-toggle", xo = i(({ className: e, "data-mode": t, dataUrl: n, data: r, locale: i = "nb-NO", logoLink: a = zn, logoClick: s, logoPath: l = typeof window < "u" ? window.pktLogoPath : go, showSearch: u = !0, searchPlaceholder: h, onSearch: y, showContact: b = !0, user: x, userMenu: S, representing: C, canChangeRepresentation: w = !1, changeRepresentation: T, logOutButtonPlacement: E = "none", logOut: D, position: O = "fixed", scrollBehavior: k = "hide", mobileBreakpoint: A = 768, tabletBreakpoint: j = 1024, onDataLoaded: N, onDataError: P, strings: ee }, te) => {
|
|
7145
7160
|
let ne = k === "hide", [F, re] = m("none"), [ie, ae] = m(void 0), [oe, se] = m(!1), I = p(N), R = p(P);
|
|
@@ -7148,7 +7163,7 @@ var _o = "pkt-header-global-menu", vo = "pkt-header-global-menu-toggle", yo = "p
|
|
|
7148
7163
|
}, [N]), c(() => {
|
|
7149
7164
|
R.current = P;
|
|
7150
7165
|
}, [P]);
|
|
7151
|
-
let { setRef: ce, isMobile: z, isTablet: B, isFixed:
|
|
7166
|
+
let { setRef: ce, isMobile: z, isTablet: B, isFixed: le, isSticky: V, hidden: H, captureFocus: ue, flagRestoreFocus: U, restoreFocus: W } = Qa({
|
|
7152
7167
|
forwardedRef: te,
|
|
7153
7168
|
mobileBreakpoint: A,
|
|
7154
7169
|
tabletBreakpoint: j,
|
|
@@ -7157,12 +7172,12 @@ var _o = "pkt-header-global-menu", vo = "pkt-header-global-menu-toggle", yo = "p
|
|
|
7157
7172
|
pauseScrollHide: F !== "none"
|
|
7158
7173
|
});
|
|
7159
7174
|
$a(F === "menu" || F === "search");
|
|
7160
|
-
let
|
|
7161
|
-
|
|
7175
|
+
let G = p(null), K = o((e) => {
|
|
7176
|
+
G.current = e, ce(e);
|
|
7162
7177
|
}, [ce]);
|
|
7163
7178
|
d(() => {
|
|
7164
7179
|
if (F !== "menu" && F !== "search") return;
|
|
7165
|
-
let e = document.getElementById(F === "menu" ? _o : yo), t =
|
|
7180
|
+
let e = document.getElementById(F === "menu" ? _o : yo), t = G.current?.getBoundingClientRect();
|
|
7166
7181
|
!e || !t || (e.style.setProperty("--pkt-header-global-top", `${t.top}px`), e.style.setProperty("--pkt-header-global-left", `${t.left}px`), e.style.setProperty("--pkt-header-global-width", `${t.width}px`));
|
|
7167
7182
|
}, [
|
|
7168
7183
|
F,
|
|
@@ -7179,7 +7194,7 @@ var _o = "pkt-header-global-menu", vo = "pkt-header-global-menu-toggle", yo = "p
|
|
|
7179
7194
|
e.name !== "AbortError" && (se(!0), R.current?.(e));
|
|
7180
7195
|
}), () => e.abort();
|
|
7181
7196
|
}, [r, n]);
|
|
7182
|
-
let
|
|
7197
|
+
let q = r ?? ie, de = f(() => ka(q, i), [q, i]);
|
|
7183
7198
|
c(() => {
|
|
7184
7199
|
let e = (e) => {
|
|
7185
7200
|
let t = e.target;
|
|
@@ -7190,10 +7205,10 @@ var _o = "pkt-header-global-menu", vo = "pkt-header-global-menu-toggle", yo = "p
|
|
|
7190
7205
|
if (F !== "none") return document.addEventListener("mousedown", e), document.addEventListener("keydown", t), () => {
|
|
7191
7206
|
document.removeEventListener("mousedown", e), document.removeEventListener("keydown", t);
|
|
7192
7207
|
};
|
|
7193
|
-
|
|
7208
|
+
W();
|
|
7194
7209
|
}, [
|
|
7195
7210
|
F,
|
|
7196
|
-
|
|
7211
|
+
W,
|
|
7197
7212
|
U
|
|
7198
7213
|
]), c(() => {
|
|
7199
7214
|
if (F !== "menu" && F !== "search") return;
|
|
@@ -7203,7 +7218,7 @@ var _o = "pkt-header-global-menu", vo = "pkt-header-global-menu-toggle", yo = "p
|
|
|
7203
7218
|
if (e.key !== "Tab") return;
|
|
7204
7219
|
let t = n(), a = r();
|
|
7205
7220
|
if (!t || !a) return;
|
|
7206
|
-
let o =
|
|
7221
|
+
let o = ui(t), s = di();
|
|
7207
7222
|
if (s && a.contains(s)) {
|
|
7208
7223
|
!e.shiftKey && o.length > 0 && (e.preventDefault(), o[0].focus());
|
|
7209
7224
|
return;
|
|
@@ -7223,18 +7238,18 @@ var _o = "pkt-header-global-menu", vo = "pkt-header-global-menu-toggle", yo = "p
|
|
|
7223
7238
|
document.removeEventListener("keydown", a), document.removeEventListener("focusin", o);
|
|
7224
7239
|
};
|
|
7225
7240
|
}, [F]);
|
|
7226
|
-
let
|
|
7241
|
+
let J = f(() => {
|
|
7227
7242
|
if (x?.lastLoggedIn) return typeof x.lastLoggedIn == "string" ? x.lastLoggedIn : new Date(x.lastLoggedIn).toLocaleString("nb-NO", {
|
|
7228
7243
|
year: "numeric",
|
|
7229
7244
|
month: "long",
|
|
7230
7245
|
day: "numeric"
|
|
7231
7246
|
});
|
|
7232
|
-
}, [x?.lastLoggedIn]),
|
|
7247
|
+
}, [x?.lastLoggedIn]), fe = o((e) => {
|
|
7233
7248
|
re((t) => t === e ? "none" : (ue(), e));
|
|
7234
|
-
}, [ue]),
|
|
7235
|
-
className: (0, M.default)("pkt-header-global", z && "pkt-header-global--mobile", B && "pkt-header-global--tablet",
|
|
7249
|
+
}, [ue]), pe = E === "userMenu" || E === "both", me = ge(["header"], ee).header, Y = de?.search, X = de?.header?.contact, he = de?.i18n?.menu || me.menu, Q = de?.i18n?.search || me.search, $ = F === "menu", _e = F === "user", ve = F === "search", ye = z, be = !!(u && Y), xe = Y?.input.id || "pkt-header-global-search", Se = !de && !oe, Ce = /* @__PURE__ */ v("header", {
|
|
7250
|
+
className: (0, M.default)("pkt-header-global", z && "pkt-header-global--mobile", B && "pkt-header-global--tablet", le && "pkt-header-global--fixed", V && "pkt-header-global--sticky", ne && "pkt-header-global--scroll-to-hide", H && "pkt-header-global--hidden", e),
|
|
7236
7251
|
"data-mode": t,
|
|
7237
|
-
ref:
|
|
7252
|
+
ref: K,
|
|
7238
7253
|
children: [
|
|
7239
7254
|
/* @__PURE__ */ _("div", {
|
|
7240
7255
|
className: "pkt-header-global__logo-area",
|
|
@@ -7255,13 +7270,13 @@ var _o = "pkt-header-global-menu", vo = "pkt-header-global-menu-toggle", yo = "p
|
|
|
7255
7270
|
/* @__PURE__ */ v("div", {
|
|
7256
7271
|
className: "pkt-header-global__content",
|
|
7257
7272
|
children: [
|
|
7258
|
-
!
|
|
7273
|
+
!ye && be && Y && /* @__PURE__ */ _("div", {
|
|
7259
7274
|
className: "pkt-header-global__search",
|
|
7260
7275
|
children: /* @__PURE__ */ _(ho, {
|
|
7261
7276
|
appearance: "global",
|
|
7262
7277
|
inputSize: B ? "small" : "medium",
|
|
7263
7278
|
fullwidth: !0,
|
|
7264
|
-
id:
|
|
7279
|
+
id: xe,
|
|
7265
7280
|
name: Y.input.name,
|
|
7266
7281
|
"aria-label": Q,
|
|
7267
7282
|
placeholder: h ?? Y.input.placeholder,
|
|
@@ -7271,40 +7286,40 @@ var _o = "pkt-header-global-menu", vo = "pkt-header-global-menu-toggle", yo = "p
|
|
|
7271
7286
|
onChange: () => {}
|
|
7272
7287
|
})
|
|
7273
7288
|
}),
|
|
7274
|
-
|
|
7289
|
+
ye && be && /* @__PURE__ */ _(Z, {
|
|
7275
7290
|
id: bo,
|
|
7276
7291
|
className: "pkt-header-global__search-toggle",
|
|
7277
7292
|
skin: "primary",
|
|
7278
|
-
color:
|
|
7293
|
+
color: ve ? void 0 : "yellow",
|
|
7279
7294
|
variant: "icon-only",
|
|
7280
|
-
iconName:
|
|
7295
|
+
iconName: ve ? "close" : "magnifying-glass-big",
|
|
7281
7296
|
size: z ? "small" : "medium",
|
|
7282
|
-
state:
|
|
7283
|
-
"aria-expanded":
|
|
7297
|
+
state: ve ? "active" : "normal",
|
|
7298
|
+
"aria-expanded": ve,
|
|
7284
7299
|
"aria-controls": yo,
|
|
7285
|
-
onClick: () =>
|
|
7300
|
+
onClick: () => fe("search"),
|
|
7286
7301
|
children: Q
|
|
7287
7302
|
}),
|
|
7288
|
-
/* @__PURE__ */ _(
|
|
7303
|
+
/* @__PURE__ */ _(Z, {
|
|
7289
7304
|
id: vo,
|
|
7290
7305
|
className: "pkt-header-global__menu-toggle",
|
|
7291
|
-
skin:
|
|
7292
|
-
variant:
|
|
7293
|
-
iconName:
|
|
7306
|
+
skin: ye ? "tertiary" : "secondary",
|
|
7307
|
+
variant: ye ? "icon-only" : "icon-right",
|
|
7308
|
+
iconName: $ ? "close" : "menu",
|
|
7294
7309
|
size: B ? "small" : "medium",
|
|
7295
|
-
state:
|
|
7296
|
-
"aria-expanded":
|
|
7310
|
+
state: $ ? "active" : "normal",
|
|
7311
|
+
"aria-expanded": $,
|
|
7297
7312
|
"aria-controls": _o,
|
|
7298
|
-
disabled:
|
|
7299
|
-
onClick: () =>
|
|
7300
|
-
children:
|
|
7313
|
+
disabled: Se,
|
|
7314
|
+
onClick: () => fe("menu"),
|
|
7315
|
+
children: he
|
|
7301
7316
|
}),
|
|
7302
|
-
!
|
|
7317
|
+
!ye && b && X && !x && /* @__PURE__ */ _("a", {
|
|
7303
7318
|
className: (0, M.default)("pkt-header-global__contact", "pkt-btn", "pkt-btn--secondary", "pkt-btn--label-only", B ? "pkt-btn--small" : "pkt-btn--medium"),
|
|
7304
|
-
href:
|
|
7319
|
+
href: X.url,
|
|
7305
7320
|
children: /* @__PURE__ */ _("span", {
|
|
7306
7321
|
className: "pkt-btn__text",
|
|
7307
|
-
children:
|
|
7322
|
+
children: X.text
|
|
7308
7323
|
})
|
|
7309
7324
|
})
|
|
7310
7325
|
]
|
|
@@ -7312,16 +7327,16 @@ var _o = "pkt-header-global-menu", vo = "pkt-header-global-menu-toggle", yo = "p
|
|
|
7312
7327
|
x && /* @__PURE__ */ _("div", {
|
|
7313
7328
|
className: "pkt-header-global__user",
|
|
7314
7329
|
children: /* @__PURE__ */ v("div", {
|
|
7315
|
-
className: (0, M.default)("pkt-header-global__user-container",
|
|
7316
|
-
children: [/* @__PURE__ */ v(
|
|
7330
|
+
className: (0, M.default)("pkt-header-global__user-container", _e && "is-open"),
|
|
7331
|
+
children: [/* @__PURE__ */ v(Z, {
|
|
7317
7332
|
className: "pkt-header-global__user-button",
|
|
7318
7333
|
skin: "secondary",
|
|
7319
7334
|
size: B ? "small" : "medium",
|
|
7320
|
-
state:
|
|
7335
|
+
state: _e ? "active" : "normal",
|
|
7321
7336
|
variant: "icons-right-and-left",
|
|
7322
7337
|
iconName: "user",
|
|
7323
|
-
secondIconName:
|
|
7324
|
-
onClick: () =>
|
|
7338
|
+
secondIconName: _e ? "chevron-thin-up" : "chevron-thin-down",
|
|
7339
|
+
onClick: () => fe("user"),
|
|
7325
7340
|
children: [/* @__PURE__ */ _("span", {
|
|
7326
7341
|
className: "pkt-sr-only",
|
|
7327
7342
|
children: "Brukermeny: "
|
|
@@ -7329,26 +7344,26 @@ var _o = "pkt-header-global-menu", vo = "pkt-header-global-menu-toggle", yo = "p
|
|
|
7329
7344
|
translate: "no",
|
|
7330
7345
|
children: C?.name || x.name
|
|
7331
7346
|
})]
|
|
7332
|
-
}),
|
|
7347
|
+
}), _e && /* @__PURE__ */ _("div", {
|
|
7333
7348
|
className: "pkt-header-global__user-menu is-open",
|
|
7334
7349
|
children: /* @__PURE__ */ _(mo, {
|
|
7335
7350
|
user: x,
|
|
7336
|
-
formattedLastLoggedIn:
|
|
7351
|
+
formattedLastLoggedIn: J,
|
|
7337
7352
|
representing: C,
|
|
7338
7353
|
userMenu: S,
|
|
7339
7354
|
canChangeRepresentation: w,
|
|
7340
7355
|
changeRepresentation: T,
|
|
7341
|
-
logoutOnClick:
|
|
7356
|
+
logoutOnClick: pe ? D : void 0
|
|
7342
7357
|
})
|
|
7343
7358
|
})]
|
|
7344
7359
|
})
|
|
7345
7360
|
})
|
|
7346
7361
|
]
|
|
7347
|
-
}),
|
|
7362
|
+
}), we = $ && /* @__PURE__ */ _("div", {
|
|
7348
7363
|
className: (0, M.default)("pkt-header-global__menu", z && "pkt-header-global__menu--mobile", B && !z && "pkt-header-global__menu--tablet"),
|
|
7349
7364
|
id: _o,
|
|
7350
|
-
children:
|
|
7351
|
-
data:
|
|
7365
|
+
children: de ? /* @__PURE__ */ _(eo, {
|
|
7366
|
+
data: q,
|
|
7352
7367
|
locale: i,
|
|
7353
7368
|
open: !0,
|
|
7354
7369
|
mobileBreakpoint: A
|
|
@@ -7359,7 +7374,7 @@ var _o = "pkt-header-global-menu", vo = "pkt-header-global-menu-toggle", yo = "p
|
|
|
7359
7374
|
children: "Kunne ikke laste meny."
|
|
7360
7375
|
})
|
|
7361
7376
|
})
|
|
7362
|
-
}),
|
|
7377
|
+
}), Te = ve && be && Y && /* @__PURE__ */ _("div", {
|
|
7363
7378
|
className: (0, M.default)("pkt-header-global__search-panel", z && "pkt-header-global__search-panel--mobile", B && !z && "pkt-header-global__search-panel--tablet"),
|
|
7364
7379
|
id: yo,
|
|
7365
7380
|
children: /* @__PURE__ */ _("div", {
|
|
@@ -7367,7 +7382,7 @@ var _o = "pkt-header-global-menu", vo = "pkt-header-global-menu-toggle", yo = "p
|
|
|
7367
7382
|
children: /* @__PURE__ */ _(ho, {
|
|
7368
7383
|
appearance: "global",
|
|
7369
7384
|
fullwidth: !0,
|
|
7370
|
-
id:
|
|
7385
|
+
id: xe,
|
|
7371
7386
|
name: Y.input.name,
|
|
7372
7387
|
"aria-label": Q,
|
|
7373
7388
|
placeholder: h ?? Y.input.placeholder,
|
|
@@ -7379,37 +7394,37 @@ var _o = "pkt-header-global-menu", vo = "pkt-header-global-menu-toggle", yo = "p
|
|
|
7379
7394
|
})
|
|
7380
7395
|
})
|
|
7381
7396
|
});
|
|
7382
|
-
return
|
|
7397
|
+
return le ? /* @__PURE__ */ v("div", {
|
|
7383
7398
|
className: "pkt-header-global-wrapper",
|
|
7384
7399
|
children: [
|
|
7385
|
-
|
|
7400
|
+
Ce,
|
|
7386
7401
|
/* @__PURE__ */ _("div", { className: (0, M.default)("pkt-header-global-spacer", z && "pkt-header-global-spacer--mobile", B && !z && "pkt-header-global-spacer--tablet", x && "pkt-header-global-spacer--has-user") }),
|
|
7387
|
-
|
|
7388
|
-
|
|
7402
|
+
Te,
|
|
7403
|
+
we
|
|
7389
7404
|
]
|
|
7390
7405
|
}) : /* @__PURE__ */ v(g, { children: [
|
|
7391
|
-
|
|
7392
|
-
|
|
7393
|
-
|
|
7406
|
+
Ce,
|
|
7407
|
+
Te,
|
|
7408
|
+
we
|
|
7394
7409
|
] });
|
|
7395
7410
|
});
|
|
7396
7411
|
xo.displayName = "PktHeaderGlobal";
|
|
7397
7412
|
//#endregion
|
|
7398
7413
|
//#region src/components/textinput/Textinput.tsx
|
|
7399
|
-
var So = i(({ id: e, ariaDescribedby: t, ariaLabelledby: n, autocomplete: r = "off", counter: i, hasFieldset: a, counterMaxLength: o, className: s, disabled: l = !1, errorMessage: u, hasError: d = !1, helptext: f, helptextDropdown: p, helptextDropdownButton: h, iconNameRight: g, inline: y = !1, fullwidth: b = !1, label: x, name: S, optionalTag: C = !1, optionalText: w, requiredTag: T = !1, requiredText: E, tagText: D = null, placeholder: O, prefix: k, suffix: A, type: j = "text", useWrapper: M = !0, omitSearchIcon: N = !1, value: P, minLength: ee, maxLength: te, min: ne, max: F, step: re, size: ie, readonly: ae, required: oe, dataTestid: se, onChange: I, skipForwardTestid: R = !1, inputSize: ce = "medium", strings: z, ...B },
|
|
7400
|
-
let
|
|
7401
|
-
|
|
7414
|
+
var So = i(({ id: e, ariaDescribedby: t, ariaLabelledby: n, autocomplete: r = "off", counter: i, hasFieldset: a, counterMaxLength: o, className: s, disabled: l = !1, errorMessage: u, hasError: d = !1, helptext: f, helptextDropdown: p, helptextDropdownButton: h, iconNameRight: g, inline: y = !1, fullwidth: b = !1, label: x, name: S, optionalTag: C = !1, optionalText: w, requiredTag: T = !1, requiredText: E, tagText: D = null, placeholder: O, prefix: k, suffix: A, type: j = "text", useWrapper: M = !0, omitSearchIcon: N = !1, value: P, minLength: ee, maxLength: te, min: ne, max: F, step: re, size: ie, readonly: ae, required: oe, dataTestid: se, onChange: I, skipForwardTestid: R = !1, inputSize: ce = "medium", strings: z, ...B }, le) => {
|
|
7415
|
+
let V = i ?? (o ?? 0) > 0, H = [s, "pkt-textinput"].filter(Boolean).join(" "), ue = j === "search" && !g && !N, U = j === "date" && P ? P.slice(0, 10) : P, [W, G] = m(P?.length || 0), K = Jn(e), q = `${K}`, de = `${q}-label`, J = n || de, fe = (e) => {
|
|
7416
|
+
V && G(e.currentTarget?.value?.length || 0), I && I(e);
|
|
7402
7417
|
};
|
|
7403
7418
|
return c(() => {
|
|
7404
|
-
P !== void 0 &&
|
|
7419
|
+
P !== void 0 && G(P?.length || 0);
|
|
7405
7420
|
}, [P]), /* @__PURE__ */ _("div", {
|
|
7406
|
-
className:
|
|
7407
|
-
children: /* @__PURE__ */ _(
|
|
7421
|
+
className: H,
|
|
7422
|
+
children: /* @__PURE__ */ _(rr, {
|
|
7408
7423
|
strings: z,
|
|
7409
7424
|
ariaDescribedby: t,
|
|
7410
7425
|
disabled: l,
|
|
7411
7426
|
errorMessage: u,
|
|
7412
|
-
forId:
|
|
7427
|
+
forId: q,
|
|
7413
7428
|
hasError: d,
|
|
7414
7429
|
helptext: f,
|
|
7415
7430
|
helptextDropdown: p,
|
|
@@ -7422,8 +7437,8 @@ var So = i(({ id: e, ariaDescribedby: t, ariaLabelledby: n, autocomplete: r = "o
|
|
|
7422
7437
|
requiredText: E,
|
|
7423
7438
|
tagText: D,
|
|
7424
7439
|
useWrapper: M,
|
|
7425
|
-
counter:
|
|
7426
|
-
counterCurrent:
|
|
7440
|
+
counter: V,
|
|
7441
|
+
counterCurrent: W,
|
|
7427
7442
|
counterMaxLength: o,
|
|
7428
7443
|
hasFieldset: a ?? !1,
|
|
7429
7444
|
size: ce,
|
|
@@ -7438,27 +7453,27 @@ var So = i(({ id: e, ariaDescribedby: t, ariaLabelledby: n, autocomplete: r = "o
|
|
|
7438
7453
|
}),
|
|
7439
7454
|
/* @__PURE__ */ _("input", {
|
|
7440
7455
|
...B,
|
|
7441
|
-
ref:
|
|
7442
|
-
className: `pkt-input pkt-input--${ce} ${b ? "pkt-input--fullwidth" : ""} ${o &&
|
|
7456
|
+
ref: le,
|
|
7457
|
+
className: `pkt-input pkt-input--${ce} ${b ? "pkt-input--fullwidth" : ""} ${o && W > o ? "pkt-input--counter-error" : ""}`,
|
|
7443
7458
|
type: j,
|
|
7444
|
-
name: `${S ||
|
|
7459
|
+
name: `${S || K}`,
|
|
7445
7460
|
value: U,
|
|
7446
|
-
id:
|
|
7461
|
+
id: q,
|
|
7447
7462
|
placeholder: O,
|
|
7448
7463
|
autoComplete: r,
|
|
7449
7464
|
disabled: l,
|
|
7450
7465
|
"aria-invalid": d,
|
|
7451
|
-
"aria-errormessage": d ? `${
|
|
7452
|
-
"aria-describedby":
|
|
7453
|
-
id:
|
|
7466
|
+
"aria-errormessage": d ? `${K}-error` : void 0,
|
|
7467
|
+
"aria-describedby": Zn({
|
|
7468
|
+
id: q,
|
|
7454
7469
|
hasHelptext: !!f,
|
|
7455
|
-
hasCounter:
|
|
7470
|
+
hasCounter: V,
|
|
7456
7471
|
ariaDescribedby: t
|
|
7457
7472
|
}),
|
|
7458
|
-
"aria-labelledby":
|
|
7473
|
+
"aria-labelledby": J,
|
|
7459
7474
|
min: ne,
|
|
7460
7475
|
max: F,
|
|
7461
|
-
onChange:
|
|
7476
|
+
onChange: fe,
|
|
7462
7477
|
step: re,
|
|
7463
7478
|
minLength: ee,
|
|
7464
7479
|
maxLength: te,
|
|
@@ -7496,7 +7511,7 @@ var So = i(({ id: e, ariaDescribedby: t, ariaLabelledby: n, autocomplete: r = "o
|
|
|
7496
7511
|
So.displayName = "PktTextinput";
|
|
7497
7512
|
//#endregion
|
|
7498
7513
|
//#region src/components/header/HeaderService.tsx
|
|
7499
|
-
var Co = "https://punkt-cdn.oslo.kommune.no/18.
|
|
7514
|
+
var Co = "https://punkt-cdn.oslo.kommune.no/18.8/logos/";
|
|
7500
7515
|
typeof window < "u" && (window.pktLogoPath = window.pktLogoPath || Co);
|
|
7501
7516
|
var wo = i(({ mobileBreakpoint: e = 768, tabletBreakpoint: t = 1280, children: n, className: r, compact: i = !1, "data-mode": a, logOutButtonPlacement: s = "none", logOut: l, openedMenu: u, showSearch: d = !1, onSearch: h, onSearchChange: y, searchValue: b, searchPlaceholder: x, representing: S, serviceLink: C, serviceClick: w, serviceName: T, user: E, userMenu: D, userMenuFooter: O, userOptions: k, canChangeRepresentation: A = !1, changeRepresentation: j, hideLogo: N = !1, logoLink: P = zn, logoClick: ee, logoPath: te = typeof window < "u" ? window.pktLogoPath : Co, position: ne = "fixed", scrollBehavior: F = "hide", slotMenuVariant: re = "icon-only", slotMenuText: ie = "Meny", strings: ae }, oe) => {
|
|
7502
7517
|
let se = F === "hide";
|
|
@@ -7519,25 +7534,25 @@ var wo = i(({ mobileBreakpoint: e = 768, tabletBreakpoint: t = 1280, children: n
|
|
|
7519
7534
|
c(() => {
|
|
7520
7535
|
u !== void 0 && B(u);
|
|
7521
7536
|
}, [u]);
|
|
7522
|
-
let [
|
|
7537
|
+
let [le, V] = m(!1), [H, ue] = m(!1), U = p(null), W = p(null), G = p(null), K = p(null), q = p(null), { setRef: de, isMobile: J, isTablet: fe, isFixed: pe, isSticky: me, hidden: Y, captureFocus: X, flagRestoreFocus: he, restoreFocus: Q } = Qa({
|
|
7523
7538
|
forwardedRef: oe,
|
|
7524
7539
|
mobileBreakpoint: e,
|
|
7525
7540
|
tabletBreakpoint: t,
|
|
7526
7541
|
position: ne,
|
|
7527
7542
|
scrollBehavior: F
|
|
7528
7543
|
});
|
|
7529
|
-
$a((
|
|
7530
|
-
let
|
|
7544
|
+
$a((pe || me) && J && z !== "none");
|
|
7545
|
+
let $ = o((e, t) => {
|
|
7531
7546
|
let n = e.relatedTarget, r;
|
|
7532
7547
|
switch (t) {
|
|
7533
7548
|
case "user":
|
|
7534
7549
|
r = U;
|
|
7535
7550
|
break;
|
|
7536
7551
|
case "slot":
|
|
7537
|
-
r =
|
|
7552
|
+
r = W;
|
|
7538
7553
|
break;
|
|
7539
7554
|
case "search":
|
|
7540
|
-
r =
|
|
7555
|
+
r = G;
|
|
7541
7556
|
break;
|
|
7542
7557
|
default: return;
|
|
7543
7558
|
}
|
|
@@ -7548,7 +7563,7 @@ var wo = i(({ mobileBreakpoint: e = 768, tabletBreakpoint: t = 1280, children: n
|
|
|
7548
7563
|
let e = (e) => {
|
|
7549
7564
|
E && z === "user" && !e.target.closest(".pkt-header-service__user-container") && B("none"), z === "slot" && !e.target.closest(".pkt-header-service__slot-container") && B("none"), z === "search" && !e.target.closest(".pkt-header-service__search-container") && !e.target.closest(".pkt-header-service__search-input") && B("none");
|
|
7550
7565
|
}, t = (e) => {
|
|
7551
|
-
e.key === "Escape" && z !== "none" && (e.preventDefault(),
|
|
7566
|
+
e.key === "Escape" && z !== "none" && (e.preventDefault(), he(), B("none"));
|
|
7552
7567
|
};
|
|
7553
7568
|
if (z !== "none") return document.addEventListener("mousedown", e), document.addEventListener("keydown", t), () => {
|
|
7554
7569
|
document.removeEventListener("mousedown", e), document.removeEventListener("keydown", t);
|
|
@@ -7558,29 +7573,29 @@ var wo = i(({ mobileBreakpoint: e = 768, tabletBreakpoint: t = 1280, children: n
|
|
|
7558
7573
|
z,
|
|
7559
7574
|
E,
|
|
7560
7575
|
Q,
|
|
7561
|
-
|
|
7576
|
+
he
|
|
7562
7577
|
]);
|
|
7563
|
-
let
|
|
7564
|
-
let t = e === "slot" ?
|
|
7565
|
-
if (!t.current || !n.current || !
|
|
7578
|
+
let _e = o((e) => {
|
|
7579
|
+
let t = e === "slot" ? W : G, n = e === "slot" ? K : q;
|
|
7580
|
+
if (!t.current || !n.current || !fe || J) return;
|
|
7566
7581
|
let r = t.current.getBoundingClientRect(), i = n.current.offsetWidth, a = r.left + i > window.innerWidth;
|
|
7567
|
-
e === "slot" ?
|
|
7568
|
-
}, [
|
|
7569
|
-
if (!
|
|
7582
|
+
e === "slot" ? V(a) : ue(a);
|
|
7583
|
+
}, [fe, J]), ve = o((e) => {
|
|
7584
|
+
if (!fe || z !== "slot") return;
|
|
7570
7585
|
let t = e.target.closest("a[href], button, [role=\"link\"], [role=\"button\"], [role=\"menuitem\"], [role=\"menuitemradio\"], [role=\"menuitemcheckbox\"]");
|
|
7571
|
-
!t || !
|
|
7572
|
-
}, [
|
|
7573
|
-
z === "none" ? (
|
|
7574
|
-
}, [z,
|
|
7586
|
+
!t || !K.current?.contains(t) || t.closest("[data-pkt-header-keep-open]") || t.disabled || t.getAttribute("aria-disabled") === "true" || B("none");
|
|
7587
|
+
}, [fe, z]), ye = o((e) => {
|
|
7588
|
+
z === "none" ? (X(), B(e)) : B("none");
|
|
7589
|
+
}, [z, X]);
|
|
7575
7590
|
c(() => {
|
|
7576
7591
|
(z === "slot" || z === "search") && requestAnimationFrame(() => {
|
|
7577
|
-
|
|
7592
|
+
_e(z);
|
|
7578
7593
|
});
|
|
7579
|
-
}, [z,
|
|
7580
|
-
let
|
|
7581
|
-
className: (0, M.default)("pkt-header-service", i && "pkt-header-service--compact",
|
|
7594
|
+
}, [z, _e]);
|
|
7595
|
+
let be = /* @__PURE__ */ v("header", {
|
|
7596
|
+
className: (0, M.default)("pkt-header-service", i && "pkt-header-service--compact", J && "pkt-header-service--mobile", fe && "pkt-header-service--tablet", pe && "pkt-header-service--fixed", me && "pkt-header-service--sticky", se && "pkt-header-service--scroll-to-hide", Y && "pkt-header-service--hidden", r),
|
|
7582
7597
|
"data-mode": a,
|
|
7583
|
-
ref:
|
|
7598
|
+
ref: de,
|
|
7584
7599
|
children: [
|
|
7585
7600
|
/* @__PURE__ */ v("div", {
|
|
7586
7601
|
className: (0, M.default)("pkt-header-service__logo-area", (!T || T === "") && "pkt-header-service__logo-area--without-service"),
|
|
@@ -7613,55 +7628,55 @@ var wo = i(({ mobileBreakpoint: e = 768, tabletBreakpoint: t = 1280, children: n
|
|
|
7613
7628
|
})
|
|
7614
7629
|
})]
|
|
7615
7630
|
}),
|
|
7616
|
-
n || d ||
|
|
7631
|
+
n || d || fe && l && (s === "header" || s === "both") ? /* @__PURE__ */ v("div", {
|
|
7617
7632
|
className: "pkt-header-service__content",
|
|
7618
7633
|
children: [
|
|
7619
7634
|
/* @__PURE__ */ v("div", {
|
|
7620
7635
|
className: (0, M.default)("pkt-header-service__slot-container", z === "slot" && "is-open"),
|
|
7621
|
-
onBlur: (e) =>
|
|
7622
|
-
ref:
|
|
7623
|
-
children: [
|
|
7636
|
+
onBlur: (e) => $(e, "slot"),
|
|
7637
|
+
ref: W,
|
|
7638
|
+
children: [fe && n && /* @__PURE__ */ _(Z, {
|
|
7624
7639
|
skin: "secondary",
|
|
7625
7640
|
variant: re,
|
|
7626
7641
|
iconName: "menu",
|
|
7627
|
-
size:
|
|
7642
|
+
size: J ? "small" : "medium",
|
|
7628
7643
|
state: z === "slot" ? "active" : "normal",
|
|
7629
|
-
onClick: () =>
|
|
7644
|
+
onClick: () => ye("slot"),
|
|
7630
7645
|
"aria-expanded": z === "slot",
|
|
7631
7646
|
"aria-controls": "mobile-slot-menu",
|
|
7632
7647
|
"aria-label": I.openMenu,
|
|
7633
7648
|
children: ie
|
|
7634
7649
|
}), /* @__PURE__ */ _("div", {
|
|
7635
|
-
className: (0, M.default)("pkt-header-service__slot-content",
|
|
7650
|
+
className: (0, M.default)("pkt-header-service__slot-content", le && "align-right"),
|
|
7636
7651
|
id: "mobile-slot-menu",
|
|
7637
|
-
role:
|
|
7638
|
-
"aria-label":
|
|
7639
|
-
ref:
|
|
7640
|
-
onClick:
|
|
7652
|
+
role: fe ? "group" : void 0,
|
|
7653
|
+
"aria-label": fe ? "Meny" : void 0,
|
|
7654
|
+
ref: K,
|
|
7655
|
+
onClick: ve,
|
|
7641
7656
|
children: /* @__PURE__ */ _("div", {
|
|
7642
7657
|
className: "pkt-contents",
|
|
7643
7658
|
children: n
|
|
7644
7659
|
})
|
|
7645
7660
|
})]
|
|
7646
7661
|
}),
|
|
7647
|
-
d && /* @__PURE__ */ _(g, { children:
|
|
7662
|
+
d && /* @__PURE__ */ _(g, { children: fe ? /* @__PURE__ */ v("div", {
|
|
7648
7663
|
className: (0, M.default)("pkt-header-service__search-container", z === "search" && "is-open"),
|
|
7649
|
-
onBlur: (e) =>
|
|
7650
|
-
ref:
|
|
7651
|
-
children: [/* @__PURE__ */ _(
|
|
7664
|
+
onBlur: (e) => $(e, "search"),
|
|
7665
|
+
ref: G,
|
|
7666
|
+
children: [/* @__PURE__ */ _(Z, {
|
|
7652
7667
|
skin: "secondary",
|
|
7653
7668
|
variant: "icon-only",
|
|
7654
7669
|
iconName: "magnifying-glass-big",
|
|
7655
|
-
size:
|
|
7656
|
-
onClick: () =>
|
|
7670
|
+
size: J ? "small" : "medium",
|
|
7671
|
+
onClick: () => ye("search"),
|
|
7657
7672
|
state: z === "search" ? "active" : "normal",
|
|
7658
7673
|
"aria-expanded": z === "search",
|
|
7659
7674
|
"aria-controls": "mobile-search-menu",
|
|
7660
7675
|
"aria-label": I.openSearch,
|
|
7661
7676
|
children: "Søk"
|
|
7662
7677
|
}), /* @__PURE__ */ _("div", {
|
|
7663
|
-
className: (0, M.default)("pkt-header-service__mobile-menu", z === "search" && "is-open",
|
|
7664
|
-
ref:
|
|
7678
|
+
className: (0, M.default)("pkt-header-service__mobile-menu", z === "search" && "is-open", H && "align-right"),
|
|
7679
|
+
ref: q,
|
|
7665
7680
|
children: z === "search" && /* @__PURE__ */ _(So, {
|
|
7666
7681
|
id: "mobile-search-menu",
|
|
7667
7682
|
className: "pkt-header-service__search-input",
|
|
@@ -7691,9 +7706,9 @@ var wo = i(({ mobileBreakpoint: e = 768, tabletBreakpoint: t = 1280, children: n
|
|
|
7691
7706
|
e.key === "Enter" && h?.(e.target.value);
|
|
7692
7707
|
}
|
|
7693
7708
|
}) }),
|
|
7694
|
-
|
|
7709
|
+
J && l && (s === "header" || s === "both") && /* @__PURE__ */ _(Z, {
|
|
7695
7710
|
skin: "secondary",
|
|
7696
|
-
size:
|
|
7711
|
+
size: J ? "small" : "medium",
|
|
7697
7712
|
variant: "icon-only",
|
|
7698
7713
|
iconName: "exit",
|
|
7699
7714
|
onClick: l,
|
|
@@ -7701,21 +7716,21 @@ var wo = i(({ mobileBreakpoint: e = 768, tabletBreakpoint: t = 1280, children: n
|
|
|
7701
7716
|
})
|
|
7702
7717
|
]
|
|
7703
7718
|
}) : null,
|
|
7704
|
-
(E || !
|
|
7719
|
+
(E || !J && l && (s === "header" || s === "both")) && /* @__PURE__ */ v("div", {
|
|
7705
7720
|
className: "pkt-header-service__user",
|
|
7706
7721
|
children: [E && /* @__PURE__ */ v("div", {
|
|
7707
7722
|
className: "pkt-header-service__user-container",
|
|
7708
|
-
onBlur: (e) =>
|
|
7723
|
+
onBlur: (e) => $(e, "user"),
|
|
7709
7724
|
ref: U,
|
|
7710
|
-
children: [/* @__PURE__ */ v(
|
|
7711
|
-
className: (0, M.default)("pkt-header-service__user-button",
|
|
7725
|
+
children: [/* @__PURE__ */ v(Z, {
|
|
7726
|
+
className: (0, M.default)("pkt-header-service__user-button", J && "pkt-header-service__user-button--mobile"),
|
|
7712
7727
|
skin: "secondary",
|
|
7713
|
-
size:
|
|
7728
|
+
size: J ? "small" : "medium",
|
|
7714
7729
|
state: z === "user" ? "active" : "normal",
|
|
7715
7730
|
variant: "icons-right-and-left",
|
|
7716
7731
|
iconName: "user",
|
|
7717
7732
|
secondIconName: z === "user" ? "chevron-thin-up" : "chevron-thin-down",
|
|
7718
|
-
onClick: () =>
|
|
7733
|
+
onClick: () => ye("user"),
|
|
7719
7734
|
children: [/* @__PURE__ */ _("span", {
|
|
7720
7735
|
className: "pkt-sr-only",
|
|
7721
7736
|
children: "Brukermeny: "
|
|
@@ -7724,7 +7739,7 @@ var wo = i(({ mobileBreakpoint: e = 768, tabletBreakpoint: t = 1280, children: n
|
|
|
7724
7739
|
children: S?.name || E.name
|
|
7725
7740
|
})]
|
|
7726
7741
|
}), z === "user" && E && /* @__PURE__ */ _("div", {
|
|
7727
|
-
className: (0, M.default)(
|
|
7742
|
+
className: (0, M.default)(J ? "pkt-header-service__mobile-menu" : "pkt-header-service__user-menu", "is-open"),
|
|
7728
7743
|
children: /* @__PURE__ */ _(mo, {
|
|
7729
7744
|
user: E,
|
|
7730
7745
|
formattedLastLoggedIn: ce,
|
|
@@ -7735,7 +7750,7 @@ var wo = i(({ mobileBreakpoint: e = 768, tabletBreakpoint: t = 1280, children: n
|
|
|
7735
7750
|
logoutOnClick: s === "userMenu" || s === "both" ? l : void 0
|
|
7736
7751
|
})
|
|
7737
7752
|
})]
|
|
7738
|
-
}), !
|
|
7753
|
+
}), !J && l && (s === "header" || s === "both") && /* @__PURE__ */ _(Z, {
|
|
7739
7754
|
skin: "tertiary",
|
|
7740
7755
|
size: "medium",
|
|
7741
7756
|
variant: "icon-right",
|
|
@@ -7746,10 +7761,10 @@ var wo = i(({ mobileBreakpoint: e = 768, tabletBreakpoint: t = 1280, children: n
|
|
|
7746
7761
|
})
|
|
7747
7762
|
]
|
|
7748
7763
|
});
|
|
7749
|
-
return
|
|
7764
|
+
return pe ? /* @__PURE__ */ v("div", {
|
|
7750
7765
|
className: "pkt-header-service-wrapper",
|
|
7751
|
-
children: [
|
|
7752
|
-
}) :
|
|
7766
|
+
children: [be, /* @__PURE__ */ _("div", { className: (0, M.default)("pkt-header-service-spacer", i && "pkt-header-service-spacer--compact", E && "pkt-header-service-spacer--has-user", J && "pkt-header-service-spacer--mobile", fe && "pkt-header-service-spacer--tablet") })]
|
|
7767
|
+
}) : be;
|
|
7753
7768
|
});
|
|
7754
7769
|
wo.displayName = "PktHeaderService";
|
|
7755
7770
|
//#endregion
|
|
@@ -7814,7 +7829,7 @@ var Do = ({ children: e, skin: t, title: n, href: r, iconName: i, openInNewTab:
|
|
|
7814
7829
|
};
|
|
7815
7830
|
//#endregion
|
|
7816
7831
|
//#region src/components/loader/Loader.tsx
|
|
7817
|
-
Do.displayName = "PktLinkCard", typeof window < "u" && (window.pktAnimationPath = window.pktAnimationPath || "https://punkt-cdn.oslo.kommune.no/18.
|
|
7832
|
+
Do.displayName = "PktLinkCard", typeof window < "u" && (window.pktAnimationPath = window.pktAnimationPath || "https://punkt-cdn.oslo.kommune.no/18.8/animations/");
|
|
7818
7833
|
var Oo = (e) => {
|
|
7819
7834
|
switch (e) {
|
|
7820
7835
|
case "blue": return "spinner-blue";
|
|
@@ -7896,54 +7911,59 @@ var Ao = ({ children: e, className: t, skin: n, title: i, compact: a, closable:
|
|
|
7896
7911
|
Ao.displayName = "PktMessagebox";
|
|
7897
7912
|
//#endregion
|
|
7898
7913
|
//#region src/components/radio/RadioButton.tsx
|
|
7899
|
-
var jo = i(({ id: e, name: t, label: n, className: r, hasTile: i = !1, disabled: a = !1, checkHelptext: o, hasError: s = !1, defaultChecked: c, checked: l, optionalTag: u, optionalText: d, requiredTag: f, requiredText: p, strings: m, tagText: h,
|
|
7900
|
-
let
|
|
7914
|
+
var jo = i(({ id: e, name: t, label: n, className: r, hasTile: i = !1, disabled: a = !1, checkHelptext: o, hasError: s = !1, defaultChecked: c, checked: l, optionalTag: u, optionalText: d, requiredTag: f, requiredText: p, strings: m, tagText: h, "aria-describedby": y, ...b }, x) => {
|
|
7915
|
+
let S = ge(["forms"], m), C = Jn(e), w = [r, "pkt-input-check"].filter(Boolean).join(" "), T = [
|
|
7901
7916
|
"pkt-input-check__input",
|
|
7902
7917
|
i ? "pkt-input-check__input--tile" : "",
|
|
7903
7918
|
a && i ? "pkt-input-check__input--tile-disabled" : ""
|
|
7904
|
-
].filter(Boolean).join(" "),
|
|
7919
|
+
].filter(Boolean).join(" "), E = ["pkt-input-check__input-checkbox", s ? "pkt-input-check__input-checkbox--error" : ""].filter(Boolean).join(" "), D = ["pkt-input-check__input-label", a ? "pkt-input-check__input-label--disabled" : ""].filter(Boolean).join(" "), O = [
|
|
7905
7920
|
"pkt-tag",
|
|
7906
7921
|
"pkt-tag--small",
|
|
7907
7922
|
"pkt-tag--thin-text"
|
|
7908
|
-
].join(" "),
|
|
7923
|
+
].join(" "), k = () => /* @__PURE__ */ v(g, { children: [
|
|
7909
7924
|
h && /* @__PURE__ */ _("span", {
|
|
7910
|
-
className:
|
|
7925
|
+
className: O + " pkt-tag--gray",
|
|
7911
7926
|
children: h
|
|
7912
7927
|
}),
|
|
7913
7928
|
u && /* @__PURE__ */ _("span", {
|
|
7914
|
-
className:
|
|
7915
|
-
children: d ??
|
|
7929
|
+
className: O + " pkt-tag--blue-light",
|
|
7930
|
+
children: d ?? S.forms.optional
|
|
7916
7931
|
}),
|
|
7917
7932
|
f && /* @__PURE__ */ _("span", {
|
|
7918
|
-
className:
|
|
7919
|
-
children: p ??
|
|
7933
|
+
className: O + " pkt-tag--beige",
|
|
7934
|
+
children: p ?? S.forms.required
|
|
7920
7935
|
})
|
|
7921
|
-
] });
|
|
7936
|
+
] }), A = `${C}-check-label`, j = `${C}-check-helptext`, M = [o ? j : void 0, y].filter(Boolean).join(" ") || void 0;
|
|
7922
7937
|
return /* @__PURE__ */ _("div", {
|
|
7923
|
-
className:
|
|
7938
|
+
className: w,
|
|
7924
7939
|
children: /* @__PURE__ */ v("div", {
|
|
7925
|
-
className:
|
|
7940
|
+
className: T,
|
|
7926
7941
|
children: [/* @__PURE__ */ _("input", {
|
|
7927
|
-
ref:
|
|
7928
|
-
id:
|
|
7942
|
+
ref: x,
|
|
7943
|
+
id: C,
|
|
7929
7944
|
type: "radio",
|
|
7930
7945
|
name: t,
|
|
7931
7946
|
disabled: a,
|
|
7932
|
-
className:
|
|
7947
|
+
className: E,
|
|
7948
|
+
"aria-labelledby": n ? A : void 0,
|
|
7949
|
+
"aria-describedby": M,
|
|
7933
7950
|
...l === void 0 ? { defaultChecked: c } : { checked: l },
|
|
7934
|
-
...
|
|
7951
|
+
...b
|
|
7935
7952
|
}), /* @__PURE__ */ v("label", {
|
|
7936
|
-
className:
|
|
7937
|
-
htmlFor:
|
|
7938
|
-
children: [
|
|
7939
|
-
|
|
7940
|
-
|
|
7941
|
-
|
|
7942
|
-
|
|
7943
|
-
|
|
7944
|
-
|
|
7945
|
-
|
|
7946
|
-
|
|
7953
|
+
className: D,
|
|
7954
|
+
htmlFor: C,
|
|
7955
|
+
children: [/* @__PURE__ */ v("span", {
|
|
7956
|
+
id: A,
|
|
7957
|
+
children: [
|
|
7958
|
+
n,
|
|
7959
|
+
" ",
|
|
7960
|
+
k()
|
|
7961
|
+
]
|
|
7962
|
+
}), o && /* @__PURE__ */ _("div", {
|
|
7963
|
+
id: j,
|
|
7964
|
+
className: "pkt-input-check__input-helptext",
|
|
7965
|
+
children: o
|
|
7966
|
+
})]
|
|
7947
7967
|
})]
|
|
7948
7968
|
})
|
|
7949
7969
|
});
|
|
@@ -7952,10 +7972,10 @@ jo.displayName = "PktRadioButton";
|
|
|
7952
7972
|
//#endregion
|
|
7953
7973
|
//#region src/components/select/Select.tsx
|
|
7954
7974
|
var Mo = i(({ ariaDescribedby: e, ariaLabelledby: t, children: n, className: r, disabled: i = !1, errorMessage: a, hasError: o = !1, helptext: s, helptextDropdown: c, helptextDropdownButton: l, id: u, inline: d = !1, fullwidth: f = !1, label: p, name: m, optionalTag: h = !1, optionalText: g, requiredTag: v = !1, requiredText: y, tagText: b, useWrapper: x = !0, hasFieldset: S, inputSize: C = "medium", strings: w, ...T }, E) => {
|
|
7955
|
-
let D =
|
|
7975
|
+
let D = Jn(u), O = [r, "pkt-select"].filter(Boolean).join(" ");
|
|
7956
7976
|
return /* @__PURE__ */ _("div", {
|
|
7957
7977
|
className: O,
|
|
7958
|
-
children: /* @__PURE__ */ _(
|
|
7978
|
+
children: /* @__PURE__ */ _(rr, {
|
|
7959
7979
|
strings: w,
|
|
7960
7980
|
forId: `${D}-input`,
|
|
7961
7981
|
label: p,
|
|
@@ -7980,7 +8000,7 @@ var Mo = i(({ ariaDescribedby: e, ariaLabelledby: t, children: n, className: r,
|
|
|
7980
8000
|
className: `pkt-input pkt-input--${C} ${f ? "pkt-input--fullwidth" : ""}`,
|
|
7981
8001
|
"aria-invalid": o,
|
|
7982
8002
|
"aria-errormessage": o ? `${D}-error` : void 0,
|
|
7983
|
-
"aria-describedby":
|
|
8003
|
+
"aria-describedby": Zn({
|
|
7984
8004
|
id: `${D}-input`,
|
|
7985
8005
|
hasHelptext: !!s,
|
|
7986
8006
|
hasCounter: !1,
|
|
@@ -8316,27 +8336,27 @@ function rs(e) {
|
|
|
8316
8336
|
return e === 3600 || e < 3600 && 3600 % e == 0 && e % 60 == 0;
|
|
8317
8337
|
}
|
|
8318
8338
|
function is(e, t) {
|
|
8319
|
-
let { id: n, label: r, value: i, defaultValue: a, min: s, max: l, step: h = 60, hidePicker: g = !1, stepArrows: _ = !1, fullwidth: v = !1, name: y, disabled: b = !1, required: x = !1, helptext: S, helptextDropdown: C, helptextDropdownButton: w, hasError: T = !1, errorMessage: E, optionalTag: D = !1, optionalText: O, requiredTag: k = !1, requiredText: A, tagText: j, inline: M = !1, useWrapper: N = !0, ariaDescribedby: P, strings: ee, className: te, inputSize: ne = "medium", onValueChange: F, onFocus: re, onBlur: ie } = e, ae = ge(["timepicker", "validation"], ee), oe = ae.timepicker, se = ee, I = i !== void 0, L = i === void 0 ? a ?? "" : i ?? "", R = p(L), [ce, z] = m(() => L), B = I ? i ?? "" : ce, [
|
|
8320
|
-
U.current = e,
|
|
8321
|
-
}, []),
|
|
8322
|
-
|
|
8323
|
-
}, []), [
|
|
8339
|
+
let { id: n, label: r, value: i, defaultValue: a, min: s, max: l, step: h = 60, hidePicker: g = !1, stepArrows: _ = !1, fullwidth: v = !1, name: y, disabled: b = !1, required: x = !1, helptext: S, helptextDropdown: C, helptextDropdownButton: w, hasError: T = !1, errorMessage: E, optionalTag: D = !1, optionalText: O, requiredTag: k = !1, requiredText: A, tagText: j, inline: M = !1, useWrapper: N = !0, ariaDescribedby: P, strings: ee, className: te, inputSize: ne = "medium", onValueChange: F, onFocus: re, onBlur: ie } = e, ae = ge(["timepicker", "validation"], ee), oe = ae.timepicker, se = ee, I = i !== void 0, L = i === void 0 ? a ?? "" : i ?? "", R = p(L), [ce, z] = m(() => L), B = I ? i ?? "" : ce, [le, V] = m(() => es(i === void 0 ? a : i)[0]), [H, ue] = m(() => es(i === void 0 ? a : i)[1]), U = p(le), W = p(H), G = o((e) => {
|
|
8340
|
+
U.current = e, V(e);
|
|
8341
|
+
}, []), K = o((e) => {
|
|
8342
|
+
W.current = e, ue(e);
|
|
8343
|
+
}, []), [q, de] = m(!1), [J, fe] = m(!1), pe = p(i);
|
|
8324
8344
|
c(() => {
|
|
8325
|
-
if (!I || i ===
|
|
8326
|
-
|
|
8345
|
+
if (!I || i === pe.current) return;
|
|
8346
|
+
pe.current = i;
|
|
8327
8347
|
let [e, t] = es(i);
|
|
8328
|
-
|
|
8348
|
+
G(e), K(t);
|
|
8329
8349
|
}, [
|
|
8330
8350
|
i,
|
|
8331
8351
|
I,
|
|
8332
|
-
|
|
8333
|
-
|
|
8352
|
+
G,
|
|
8353
|
+
K
|
|
8334
8354
|
]), c(() => {
|
|
8335
8355
|
h != null && !rs(h) && console.warn(`PktTimepicker: step="${h}" er ikke en gyldig verdi. Step må være et multiplum av 60 (hele minutter) eller nøyaktig 3600 (hel time).`);
|
|
8336
8356
|
}, [h]);
|
|
8337
|
-
let
|
|
8357
|
+
let me = p(null), Y = p(null), X = p(null), Z = p(null), he = p(null), Q = p(null), $ = p(0), _e = p(-1), ve = p(0), ye = p(-1), [be, xe] = m(!1), Se = f(() => Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value")?.set, []), Ce = f(() => Jo(h), [h]), we = f(() => Yo(s, l), [s, l]), Te = f(() => Xo(h), [h]), Ee = `${n}-hours`, De = `${n}-minutes`, Oe = `${n}-popup`, ke = `${n}-input`;
|
|
8338
8358
|
c(() => {
|
|
8339
|
-
let e =
|
|
8359
|
+
let e = me.current;
|
|
8340
8360
|
if (!e) return;
|
|
8341
8361
|
let t = ns(B, {
|
|
8342
8362
|
required: x,
|
|
@@ -8344,39 +8364,39 @@ function is(e, t) {
|
|
|
8344
8364
|
max: l,
|
|
8345
8365
|
step: h
|
|
8346
8366
|
}, ae.validation);
|
|
8347
|
-
e.setCustomValidity(t.valid ? "" : t.message ?? ""),
|
|
8367
|
+
e.setCustomValidity(t.valid ? "" : t.message ?? ""), fe(be && !t.valid);
|
|
8348
8368
|
}, [
|
|
8349
8369
|
B,
|
|
8350
8370
|
x,
|
|
8351
8371
|
s,
|
|
8352
8372
|
l,
|
|
8353
8373
|
h,
|
|
8354
|
-
|
|
8374
|
+
be,
|
|
8355
8375
|
ae.validation
|
|
8356
8376
|
]);
|
|
8357
8377
|
let Ae = o((e) => {
|
|
8358
8378
|
I || z(e);
|
|
8359
8379
|
let t = Q.current;
|
|
8360
|
-
!t || !
|
|
8380
|
+
!t || !Se || (Se.call(t, e), t.dispatchEvent(new Event("input", { bubbles: !0 })), F?.(e));
|
|
8361
8381
|
}, [
|
|
8362
8382
|
I,
|
|
8363
|
-
|
|
8383
|
+
Se,
|
|
8364
8384
|
F
|
|
8365
8385
|
]), je = o(() => {
|
|
8366
|
-
let e = U.current, t =
|
|
8386
|
+
let e = U.current, t = W.current;
|
|
8367
8387
|
if (e !== "" && t !== "") {
|
|
8368
8388
|
let n = ts(e, t);
|
|
8369
8389
|
n !== B && Ae(n);
|
|
8370
8390
|
} else B !== "" && Ae("");
|
|
8371
8391
|
}, [B, Ae]), Me = o(() => {
|
|
8372
|
-
let e = U.current, t =
|
|
8392
|
+
let e = U.current, t = W.current;
|
|
8373
8393
|
if (e !== "" && t !== "") {
|
|
8374
8394
|
let n = ts(e, t);
|
|
8375
8395
|
n === B ? Q.current?.dispatchEvent(new Event("input", { bubbles: !0 })) : Ae(n);
|
|
8376
8396
|
} else B === "" ? Q.current?.dispatchEvent(new Event("input", { bubbles: !0 })) : Ae("");
|
|
8377
8397
|
}, [B, Ae]), Ne = o(() => {
|
|
8378
|
-
|
|
8379
|
-
let e =
|
|
8398
|
+
xe(!0), je();
|
|
8399
|
+
let e = me.current, t = Q.current;
|
|
8380
8400
|
if (!e) return;
|
|
8381
8401
|
let n = ns(t?.value ?? "", {
|
|
8382
8402
|
required: x,
|
|
@@ -8394,7 +8414,7 @@ function is(e, t) {
|
|
|
8394
8414
|
ae.validation
|
|
8395
8415
|
]);
|
|
8396
8416
|
c(() => {
|
|
8397
|
-
let e =
|
|
8417
|
+
let e = he.current?.closest("form");
|
|
8398
8418
|
if (!e) return;
|
|
8399
8419
|
let t = (t) => {
|
|
8400
8420
|
let n = t;
|
|
@@ -8409,11 +8429,11 @@ function is(e, t) {
|
|
|
8409
8429
|
Q.current && (Q.current.value = B);
|
|
8410
8430
|
}, [B]);
|
|
8411
8431
|
let Pe = o(() => {
|
|
8412
|
-
|
|
8432
|
+
de(!1), je();
|
|
8413
8433
|
}, [je]);
|
|
8414
8434
|
d(() => {
|
|
8415
|
-
if (!
|
|
8416
|
-
let e =
|
|
8435
|
+
if (!q) return;
|
|
8436
|
+
let e = Z.current;
|
|
8417
8437
|
if (!e) return;
|
|
8418
8438
|
e.querySelectorAll(".pkt-timepicker-popup__col").forEach((e) => {
|
|
8419
8439
|
let t = e.querySelector(".pkt-timepicker-popup__option--selected");
|
|
@@ -8423,16 +8443,16 @@ function is(e, t) {
|
|
|
8423
8443
|
if (!t) return;
|
|
8424
8444
|
let n = t.querySelector(".pkt-timepicker-popup__option--selected"), r = t.querySelector(".pkt-timepicker-popup__option");
|
|
8425
8445
|
(n || r)?.focus();
|
|
8426
|
-
}, [
|
|
8427
|
-
if (!
|
|
8446
|
+
}, [q]), c(() => {
|
|
8447
|
+
if (!q) return;
|
|
8428
8448
|
let e = (e) => {
|
|
8429
8449
|
let t = e.target;
|
|
8430
|
-
|
|
8450
|
+
he.current && !he.current.contains(t) && Pe();
|
|
8431
8451
|
};
|
|
8432
8452
|
return document.addEventListener("click", e, !0), () => document.removeEventListener("click", e, !0);
|
|
8433
|
-
}, [
|
|
8453
|
+
}, [q, Pe]);
|
|
8434
8454
|
let Fe = o((e) => {
|
|
8435
|
-
let t =
|
|
8455
|
+
let t = Z.current;
|
|
8436
8456
|
if (!t) return;
|
|
8437
8457
|
let n = t.querySelectorAll(".pkt-timepicker-popup__col"), r = e === "hour" ? n[0] : n[1];
|
|
8438
8458
|
if (!r) return;
|
|
@@ -8440,34 +8460,34 @@ function is(e, t) {
|
|
|
8440
8460
|
(i || a)?.focus();
|
|
8441
8461
|
}, []), Ie = o((e, t) => {
|
|
8442
8462
|
let n = String(e).padStart(2, "0");
|
|
8443
|
-
if (t === "hour")
|
|
8463
|
+
if (t === "hour") G(n), requestAnimationFrame(() => Fe("minute"));
|
|
8444
8464
|
else {
|
|
8445
|
-
|
|
8465
|
+
K(n), de(!1);
|
|
8446
8466
|
let e = U.current;
|
|
8447
|
-
e !== "" && Ae(`${e}:${n}`), requestAnimationFrame(() =>
|
|
8467
|
+
e !== "" && Ae(`${e}:${n}`), requestAnimationFrame(() => X.current?.focus());
|
|
8448
8468
|
}
|
|
8449
8469
|
}, [
|
|
8450
8470
|
Ae,
|
|
8451
8471
|
Fe,
|
|
8452
|
-
|
|
8453
|
-
|
|
8472
|
+
G,
|
|
8473
|
+
K
|
|
8454
8474
|
]), Le = o((e) => {
|
|
8455
|
-
let t = Zo(U.current,
|
|
8456
|
-
|
|
8475
|
+
let t = Zo(U.current, W.current, e, Ce);
|
|
8476
|
+
G(t.hours), K(t.minutes), `${t.hours}:${t.minutes}` !== B && Ae(`${t.hours}:${t.minutes}`);
|
|
8457
8477
|
}, [
|
|
8458
|
-
|
|
8478
|
+
Ce,
|
|
8459
8479
|
B,
|
|
8460
8480
|
Ae,
|
|
8461
|
-
|
|
8462
|
-
|
|
8481
|
+
G,
|
|
8482
|
+
K
|
|
8463
8483
|
]), Re = o((e) => {
|
|
8464
|
-
|
|
8465
|
-
let t = e.currentTarget, n =
|
|
8484
|
+
me.current?.setCustomValidity("");
|
|
8485
|
+
let t = e.currentTarget, n = W.current;
|
|
8466
8486
|
switch (e.key) {
|
|
8467
8487
|
case "ArrowUp": {
|
|
8468
8488
|
e.preventDefault();
|
|
8469
8489
|
let t = U.current === "" ? 0 : parseInt(U.current, 10), r = String((t + 1) % 24).padStart(2, "0");
|
|
8470
|
-
if (
|
|
8490
|
+
if (G(r), n !== "") {
|
|
8471
8491
|
let e = `${r}:${n}`;
|
|
8472
8492
|
e === B ? Q.current?.dispatchEvent(new Event("input", { bubbles: !0 })) : Ae(e);
|
|
8473
8493
|
}
|
|
@@ -8476,7 +8496,7 @@ function is(e, t) {
|
|
|
8476
8496
|
case "ArrowDown": {
|
|
8477
8497
|
e.preventDefault();
|
|
8478
8498
|
let t = U.current === "" ? 0 : parseInt(U.current, 10), r = String((t - 1 + 24) % 24).padStart(2, "0");
|
|
8479
|
-
if (
|
|
8499
|
+
if (G(r), n !== "") {
|
|
8480
8500
|
let e = `${r}:${n}`;
|
|
8481
8501
|
e === B ? Q.current?.dispatchEvent(new Event("input", { bubbles: !0 })) : Ae(e);
|
|
8482
8502
|
}
|
|
@@ -8487,9 +8507,9 @@ function is(e, t) {
|
|
|
8487
8507
|
break;
|
|
8488
8508
|
case "Backspace":
|
|
8489
8509
|
case "Delete": {
|
|
8490
|
-
e.preventDefault(),
|
|
8510
|
+
e.preventDefault(), $.current = 0, _e.current = -1;
|
|
8491
8511
|
let t = U.current;
|
|
8492
|
-
t.length > 0 &&
|
|
8512
|
+
t.length > 0 && G(t.slice(0, -1)), Me();
|
|
8493
8513
|
break;
|
|
8494
8514
|
}
|
|
8495
8515
|
case "Tab": break;
|
|
@@ -8502,36 +8522,36 @@ function is(e, t) {
|
|
|
8502
8522
|
default: if (/^\d$/.test(e.key)) {
|
|
8503
8523
|
e.preventDefault();
|
|
8504
8524
|
let t = parseInt(e.key, 10);
|
|
8505
|
-
if (
|
|
8506
|
-
|
|
8525
|
+
if ($.current === 0) {
|
|
8526
|
+
_e.current = t;
|
|
8507
8527
|
let e = String(t).padStart(2, "0");
|
|
8508
|
-
|
|
8528
|
+
G(e), $.current = 1, Q.current?.dispatchEvent(new Event("input", { bubbles: !0 })), t >= 3 && (_e.current = -1, $.current = 0, Me(), Y.current?.focus());
|
|
8509
8529
|
} else {
|
|
8510
|
-
let e =
|
|
8511
|
-
|
|
8530
|
+
let e = _e.current * 10 + t, n = e <= 23 ? String(e).padStart(2, "0") : String(t).padStart(2, "0");
|
|
8531
|
+
G(n), _e.current = -1, $.current = 0, Me(), Y.current?.focus();
|
|
8512
8532
|
}
|
|
8513
8533
|
} else e.preventDefault();
|
|
8514
8534
|
}
|
|
8515
8535
|
}, [
|
|
8516
8536
|
B,
|
|
8517
8537
|
Ae,
|
|
8518
|
-
|
|
8538
|
+
G,
|
|
8519
8539
|
Me,
|
|
8520
8540
|
Ne
|
|
8521
8541
|
]), ze = o(() => {
|
|
8522
|
-
if (
|
|
8542
|
+
if (xe(!0), U.current !== "") {
|
|
8523
8543
|
let e = String(parseInt(U.current, 10)).padStart(2, "0");
|
|
8524
|
-
|
|
8544
|
+
G(e);
|
|
8525
8545
|
}
|
|
8526
|
-
|
|
8527
|
-
}, [
|
|
8528
|
-
|
|
8546
|
+
$.current = 0, _e.current = -1, je();
|
|
8547
|
+
}, [G, je]), Be = o((e) => {
|
|
8548
|
+
me.current?.setCustomValidity("");
|
|
8529
8549
|
let t = e.currentTarget, n = U.current;
|
|
8530
8550
|
switch (e.key) {
|
|
8531
8551
|
case "ArrowUp": {
|
|
8532
8552
|
e.preventDefault();
|
|
8533
|
-
let t =
|
|
8534
|
-
if (
|
|
8553
|
+
let t = W.current === "" ? 0 : parseInt(W.current, 10), r = String((t + Ce) % 60).padStart(2, "0");
|
|
8554
|
+
if (K(r), n !== "") {
|
|
8535
8555
|
let e = `${n}:${r}`;
|
|
8536
8556
|
e === B ? Q.current?.dispatchEvent(new Event("input", { bubbles: !0 })) : Ae(e);
|
|
8537
8557
|
}
|
|
@@ -8539,21 +8559,21 @@ function is(e, t) {
|
|
|
8539
8559
|
}
|
|
8540
8560
|
case "ArrowDown": {
|
|
8541
8561
|
e.preventDefault();
|
|
8542
|
-
let t =
|
|
8543
|
-
if (
|
|
8562
|
+
let t = W.current === "" ? 0 : parseInt(W.current, 10), r = String((t - Ce + 60) % 60).padStart(2, "0");
|
|
8563
|
+
if (K(r), n !== "") {
|
|
8544
8564
|
let e = `${n}:${r}`;
|
|
8545
8565
|
e === B ? Q.current?.dispatchEvent(new Event("input", { bubbles: !0 })) : Ae(e);
|
|
8546
8566
|
}
|
|
8547
8567
|
break;
|
|
8548
8568
|
}
|
|
8549
8569
|
case "ArrowLeft":
|
|
8550
|
-
e.preventDefault(),
|
|
8570
|
+
e.preventDefault(), me.current?.focus();
|
|
8551
8571
|
break;
|
|
8552
8572
|
case "Backspace":
|
|
8553
8573
|
case "Delete": {
|
|
8554
|
-
e.preventDefault(),
|
|
8555
|
-
let t =
|
|
8556
|
-
t.length > 0 &&
|
|
8574
|
+
e.preventDefault(), ve.current = 0, ye.current = -1;
|
|
8575
|
+
let t = W.current;
|
|
8576
|
+
t.length > 0 && K(t.slice(0, -1)), Me();
|
|
8557
8577
|
break;
|
|
8558
8578
|
}
|
|
8559
8579
|
case "Tab": break;
|
|
@@ -8566,36 +8586,36 @@ function is(e, t) {
|
|
|
8566
8586
|
default: if (/^\d$/.test(e.key)) {
|
|
8567
8587
|
e.preventDefault();
|
|
8568
8588
|
let t = parseInt(e.key, 10);
|
|
8569
|
-
if (
|
|
8570
|
-
|
|
8589
|
+
if (ve.current === 0) {
|
|
8590
|
+
ye.current = t;
|
|
8571
8591
|
let e = String(t).padStart(2, "0");
|
|
8572
|
-
|
|
8592
|
+
K(e), ve.current = 1, Q.current?.dispatchEvent(new Event("input", { bubbles: !0 })), t >= 6 && (ye.current = -1, ve.current = 0, Me());
|
|
8573
8593
|
} else {
|
|
8574
|
-
let e =
|
|
8575
|
-
|
|
8594
|
+
let e = ye.current * 10 + t, n = e <= 59 ? String(e).padStart(2, "0") : String(t).padStart(2, "0");
|
|
8595
|
+
K(n), ye.current = -1, ve.current = 0, Me();
|
|
8576
8596
|
}
|
|
8577
8597
|
} else e.preventDefault();
|
|
8578
8598
|
}
|
|
8579
8599
|
}, [
|
|
8580
|
-
|
|
8600
|
+
Ce,
|
|
8581
8601
|
B,
|
|
8582
8602
|
Ae,
|
|
8583
|
-
|
|
8603
|
+
K,
|
|
8584
8604
|
Me,
|
|
8585
8605
|
Ne
|
|
8586
8606
|
]), Ve = o(() => {
|
|
8587
|
-
if (
|
|
8588
|
-
let e = String(parseInt(
|
|
8589
|
-
|
|
8607
|
+
if (xe(!0), W.current !== "") {
|
|
8608
|
+
let e = String(parseInt(W.current, 10)).padStart(2, "0");
|
|
8609
|
+
K(e);
|
|
8590
8610
|
}
|
|
8591
|
-
|
|
8592
|
-
}, [
|
|
8611
|
+
ve.current = 0, ye.current = -1, je();
|
|
8612
|
+
}, [K, je]), He = o((e) => {
|
|
8593
8613
|
let t = document.activeElement, n = t.closest(".pkt-timepicker-popup__col");
|
|
8594
8614
|
if (!n) return;
|
|
8595
8615
|
let r = Array.from(n.querySelectorAll(".pkt-timepicker-popup__option")), i = r.indexOf(t), a = (e) => {
|
|
8596
8616
|
if (!e) return;
|
|
8597
8617
|
let n = parseInt(e.dataset.value ?? "0", 10), r = String(n).padStart(2, "0");
|
|
8598
|
-
t.dataset.type === "hour" ?
|
|
8618
|
+
t.dataset.type === "hour" ? G(r) : K(r), e.focus();
|
|
8599
8619
|
};
|
|
8600
8620
|
switch (e.key) {
|
|
8601
8621
|
case "ArrowDown":
|
|
@@ -8613,8 +8633,8 @@ function is(e, t) {
|
|
|
8613
8633
|
case "ArrowRight":
|
|
8614
8634
|
if (e.preventDefault(), t.dataset.type === "hour") {
|
|
8615
8635
|
let e = parseInt(t.dataset.value ?? "0", 10);
|
|
8616
|
-
|
|
8617
|
-
|
|
8636
|
+
G(String(e).padStart(2, "0")), requestAnimationFrame(() => {
|
|
8637
|
+
Z.current?.querySelectorAll(".pkt-timepicker-popup__col").forEach((e) => {
|
|
8618
8638
|
e.querySelector(".pkt-timepicker-popup__option--selected")?.scrollIntoView({ block: "center" });
|
|
8619
8639
|
}), Fe("minute");
|
|
8620
8640
|
});
|
|
@@ -8623,8 +8643,8 @@ function is(e, t) {
|
|
|
8623
8643
|
case "ArrowLeft":
|
|
8624
8644
|
if (e.preventDefault(), t.dataset.type === "minute") {
|
|
8625
8645
|
let e = parseInt(t.dataset.value ?? "0", 10);
|
|
8626
|
-
|
|
8627
|
-
|
|
8646
|
+
K(String(e).padStart(2, "0")), requestAnimationFrame(() => {
|
|
8647
|
+
Z.current?.querySelectorAll(".pkt-timepicker-popup__col").forEach((e) => {
|
|
8628
8648
|
e.querySelector(".pkt-timepicker-popup__option--selected")?.scrollIntoView({ block: "center" });
|
|
8629
8649
|
}), Fe("hour");
|
|
8630
8650
|
});
|
|
@@ -8634,33 +8654,33 @@ function is(e, t) {
|
|
|
8634
8654
|
case " ":
|
|
8635
8655
|
e.preventDefault(), t.click();
|
|
8636
8656
|
break;
|
|
8637
|
-
case "Escape": e.preventDefault(), Pe(),
|
|
8657
|
+
case "Escape": e.preventDefault(), Pe(), X.current?.focus();
|
|
8638
8658
|
}
|
|
8639
8659
|
}, [
|
|
8640
8660
|
Pe,
|
|
8641
8661
|
Fe,
|
|
8642
|
-
|
|
8643
|
-
|
|
8662
|
+
G,
|
|
8663
|
+
K
|
|
8644
8664
|
]), Ue = o((e) => {
|
|
8645
|
-
let t =
|
|
8665
|
+
let t = Z.current;
|
|
8646
8666
|
if (!t) return;
|
|
8647
8667
|
let n = e.relatedTarget;
|
|
8648
8668
|
(!n || !t.contains(n)) && Pe();
|
|
8649
8669
|
}, [Pe]), We = o((e) => {
|
|
8650
|
-
let t =
|
|
8670
|
+
let t = he.current;
|
|
8651
8671
|
if (!t) return;
|
|
8652
8672
|
let n = e.relatedTarget;
|
|
8653
8673
|
n && t.contains(n) || re?.(e);
|
|
8654
8674
|
}, [re]), Ge = o((e) => {
|
|
8655
|
-
let t =
|
|
8675
|
+
let t = he.current;
|
|
8656
8676
|
if (!t) return;
|
|
8657
8677
|
let n = e.relatedTarget;
|
|
8658
8678
|
n && t.contains(n) || ie?.(e);
|
|
8659
8679
|
}, [ie]), Ke = o(() => {
|
|
8660
|
-
b || (
|
|
8680
|
+
b || (q ? Pe() : de(!0));
|
|
8661
8681
|
}, [
|
|
8662
8682
|
b,
|
|
8663
|
-
|
|
8683
|
+
q,
|
|
8664
8684
|
Pe
|
|
8665
8685
|
]);
|
|
8666
8686
|
return u(t, () => ({
|
|
@@ -8671,35 +8691,35 @@ function is(e, t) {
|
|
|
8671
8691
|
let t = e ?? "";
|
|
8672
8692
|
I || z(t);
|
|
8673
8693
|
let [n, r] = es(t);
|
|
8674
|
-
|
|
8694
|
+
G(n), K(r), Q.current && (Q.current.value = t);
|
|
8675
8695
|
},
|
|
8676
8696
|
focus() {
|
|
8677
|
-
|
|
8697
|
+
me.current?.focus();
|
|
8678
8698
|
},
|
|
8679
8699
|
blur() {
|
|
8680
|
-
|
|
8700
|
+
me.current?.blur();
|
|
8681
8701
|
}
|
|
8682
8702
|
}), [
|
|
8683
8703
|
I,
|
|
8684
|
-
|
|
8685
|
-
|
|
8704
|
+
G,
|
|
8705
|
+
K
|
|
8686
8706
|
]), c(() => {
|
|
8687
|
-
let e =
|
|
8707
|
+
let e = he.current?.closest("form");
|
|
8688
8708
|
if (!e) return;
|
|
8689
8709
|
let t = () => {
|
|
8690
8710
|
window.setTimeout(() => {
|
|
8691
8711
|
let e = R.current, [t, n] = es(e);
|
|
8692
|
-
|
|
8712
|
+
G(t), K(n), I || z(e), Q.current && (Q.current.value = e), de(!1), xe(!1);
|
|
8693
8713
|
}, 0);
|
|
8694
8714
|
};
|
|
8695
8715
|
return e.addEventListener("reset", t), () => e.removeEventListener("reset", t);
|
|
8696
8716
|
}, [
|
|
8697
8717
|
I,
|
|
8698
|
-
|
|
8699
|
-
|
|
8718
|
+
G,
|
|
8719
|
+
K
|
|
8700
8720
|
]), {
|
|
8701
8721
|
id: n,
|
|
8702
|
-
containerRef:
|
|
8722
|
+
containerRef: he,
|
|
8703
8723
|
outerClasses: [
|
|
8704
8724
|
"pkt-timepicker",
|
|
8705
8725
|
`pkt-timepicker--${ne}`,
|
|
@@ -8717,7 +8737,7 @@ function is(e, t) {
|
|
|
8717
8737
|
helptextDropdown: C,
|
|
8718
8738
|
helptextDropdownButton: w,
|
|
8719
8739
|
hasError: T,
|
|
8720
|
-
isInvalid:
|
|
8740
|
+
isInvalid: J,
|
|
8721
8741
|
errorMessage: E,
|
|
8722
8742
|
optionalTag: D,
|
|
8723
8743
|
optionalText: O,
|
|
@@ -8732,20 +8752,20 @@ function is(e, t) {
|
|
|
8732
8752
|
min: s,
|
|
8733
8753
|
max: l,
|
|
8734
8754
|
step: h,
|
|
8735
|
-
hours:
|
|
8736
|
-
minutes:
|
|
8737
|
-
hoursId:
|
|
8738
|
-
minutesId:
|
|
8739
|
-
popupId:
|
|
8740
|
-
hiddenInputId:
|
|
8755
|
+
hours: le,
|
|
8756
|
+
minutes: H,
|
|
8757
|
+
hoursId: Ee,
|
|
8758
|
+
minutesId: De,
|
|
8759
|
+
popupId: Oe,
|
|
8760
|
+
hiddenInputId: ke,
|
|
8741
8761
|
name: y ?? n,
|
|
8742
|
-
isOpen:
|
|
8743
|
-
hourOptions:
|
|
8744
|
-
minuteOptions:
|
|
8745
|
-
hoursInputRef:
|
|
8762
|
+
isOpen: q,
|
|
8763
|
+
hourOptions: we,
|
|
8764
|
+
minuteOptions: Te,
|
|
8765
|
+
hoursInputRef: me,
|
|
8746
8766
|
minutesInputRef: Y,
|
|
8747
|
-
buttonRef:
|
|
8748
|
-
popupRef:
|
|
8767
|
+
buttonRef: X,
|
|
8768
|
+
popupRef: Z,
|
|
8749
8769
|
changeInputRef: Q,
|
|
8750
8770
|
handleHoursKeydown: Re,
|
|
8751
8771
|
handleHoursBlur: ze,
|
|
@@ -8943,7 +8963,7 @@ var as = i((e, t) => {
|
|
|
8943
8963
|
id: i.id || void 0,
|
|
8944
8964
|
onFocus: i.handleFocusIn,
|
|
8945
8965
|
onBlur: i.handleFocusOut,
|
|
8946
|
-
children: /* @__PURE__ */ _(
|
|
8966
|
+
children: /* @__PURE__ */ _(rr, {
|
|
8947
8967
|
strings: i.stringsOverride,
|
|
8948
8968
|
forId: i.hoursId,
|
|
8949
8969
|
label: i.label,
|
|
@@ -8972,4 +8992,4 @@ var as = i((e, t) => {
|
|
|
8972
8992
|
});
|
|
8973
8993
|
as.displayName = "PktTimepicker";
|
|
8974
8994
|
//#endregion
|
|
8975
|
-
export {
|
|
8995
|
+
export { bi as FileItem, xa as ItemRenderers, j as PktAccordion, R as PktAccordionItem, $ as PktAlert, _e as PktBackLink, ve as PktBreadcrumbs, Z as PktButton, Ln as PktCalendar, Gn as PktCard, Yn as PktCheckbox, Or as PktCombobox, Nr as PktConsent, Jr as PktDatepicker, Sa as PktFileUpload, Ja as PktFooter, Xa as PktFooterSimple, To as PktHeader, xo as PktHeaderGlobal, eo as PktHeaderMenu, wo as PktHeaderService, Un as PktHeading, nr as PktHelptext, L as PktIcon, Eo as PktInput, rr as PktInputWrapper, lo as PktLink, Do as PktLinkCard, ko as PktLoader, Ao as PktMessagebox, Qi as PktModal, Vi as PktProgressbar, jo as PktRadioButton, ho as PktSearchInput, Mo as PktSelect, Io as PktStep, Lo as PktStepper, Q as PktStringsProvider, Wo as PktTabItem, Ro as PktTable, zo as PktTableBody, Bo as PktTableDataCell, Vo as PktTableHeader, Ho as PktTableHeaderCell, Uo as PktTableRow, qo as PktTabs, Wn as PktTag, wi as PktTextarea, So as PktTextinput, as as PktTimepicker, G as getPktStrings, ce as pktStringsNb, K as resetPktStrings, W as setPktStrings, q as subscribePktStrings };
|