@oslokommune/punkt-react 19.15.1 → 19.15.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -0
- package/dist/punkt-react.cjs +1 -1
- package/dist/punkt-react.js +587 -606
- package/dist/shared-types/calendar.d.ts +0 -1
- package/dist/shared-utils/calendar/calendar-grid.d.ts +0 -4
- package/dist/shared-utils/calendar/index.d.ts +1 -1
- package/package.json +3 -3
- package/src/components/calendar/Calendar.core.test.tsx +9 -0
- package/src/components/calendar/CalendarGrid.tsx +3 -15
package/dist/punkt-react.js
CHANGED
|
@@ -2379,7 +2379,6 @@ function Rn(e, t) {
|
|
|
2379
2379
|
startingDay: i,
|
|
2380
2380
|
numDays: a,
|
|
2381
2381
|
numRows: Math.ceil((a + i) / 7),
|
|
2382
|
-
numDaysPrevMonth: hn(e, t, 0).getDate(),
|
|
2383
2382
|
initialWeek: xt(n)
|
|
2384
2383
|
};
|
|
2385
2384
|
}
|
|
@@ -2387,35 +2386,31 @@ function zn(e, t, n, r) {
|
|
|
2387
2386
|
let { startingDay: i, numDays: a } = r;
|
|
2388
2387
|
return e === 0 && t < i ? "prev-month" : n > a ? "next-month" : "current-month";
|
|
2389
2388
|
}
|
|
2390
|
-
function Bn(e, t, n, r) {
|
|
2391
|
-
let { startingDay: i, numDaysPrevMonth: a, numDays: o } = r;
|
|
2392
|
-
return e === "prev-month" ? a - (i - t - 1) : e === "next-month" ? n - o : n;
|
|
2393
|
-
}
|
|
2394
2389
|
//#endregion
|
|
2395
2390
|
//#region ../../shared-utils/calendar/keyboard-navigation.ts
|
|
2396
|
-
var
|
|
2391
|
+
var Bn = {
|
|
2397
2392
|
ArrowLeft: -1,
|
|
2398
2393
|
ArrowRight: 1,
|
|
2399
2394
|
ArrowUp: -7,
|
|
2400
2395
|
ArrowDown: 7
|
|
2401
2396
|
};
|
|
2402
|
-
function
|
|
2397
|
+
function Vn(e) {
|
|
2403
2398
|
let t = e.nodeName;
|
|
2404
2399
|
return t === "INPUT" || t === "SELECT" || t === "BUTTON" && !e.dataset?.date;
|
|
2405
2400
|
}
|
|
2406
|
-
function
|
|
2401
|
+
function Hn(e, t, n) {
|
|
2407
2402
|
let r = Ve(e, t);
|
|
2408
2403
|
if (!r) return null;
|
|
2409
2404
|
let i = n(`button[data-date="${dn(r)}"]`);
|
|
2410
2405
|
for (; i instanceof HTMLButtonElement && i.dataset.disabled;) if (r = Ve(r, t), i = n(`button[data-date="${dn(r)}"]`), !i) return null;
|
|
2411
2406
|
return r;
|
|
2412
2407
|
}
|
|
2413
|
-
function
|
|
2414
|
-
return
|
|
2408
|
+
function Un(e) {
|
|
2409
|
+
return Bn[e] ?? null;
|
|
2415
2410
|
}
|
|
2416
2411
|
//#endregion
|
|
2417
2412
|
//#region src/components/calendar/useCalendarState.ts
|
|
2418
|
-
function
|
|
2413
|
+
function Wn(e) {
|
|
2419
2414
|
let { selected: t, multiple: n = ae.multiple, maxMultiple: r = ae.maxMultiple, range: i = ae.range, earliest: a = ae.earliest, latest: s = ae.latest, excludedates: c, excludeweekdays: u = [], weeknumbers: d = ae.weeknumbers, withcontrols: h = ae.withcontrols, currentmonth: g, today: _, strings: v, onDateSelected: y, onClose: b, id: x, className: S } = e, C = l(), w = x ?? C, T = ke(["dates", "calendar"], v), E = f(() => ({
|
|
2420
2415
|
month: T.dates.month,
|
|
2421
2416
|
year: T.dates.year,
|
|
@@ -2557,12 +2552,12 @@ function Gn(e) {
|
|
|
2557
2552
|
}
|
|
2558
2553
|
}, []), ye = o((e, t) => {
|
|
2559
2554
|
let n = e.target;
|
|
2560
|
-
if (
|
|
2555
|
+
if (Vn(n)) return;
|
|
2561
2556
|
if (e.preventDefault(), !L) {
|
|
2562
2557
|
ve();
|
|
2563
2558
|
return;
|
|
2564
2559
|
}
|
|
2565
|
-
let r =
|
|
2560
|
+
let r = Hn(mn(L), t, z.current.querySelector.bind(z.current));
|
|
2566
2561
|
if (r) {
|
|
2567
2562
|
let e = z.current.querySelector(`button[data-date="${dn(r)}"]`);
|
|
2568
2563
|
e instanceof HTMLButtonElement && !e.dataset.disabled && (R(dn(r)), e.focus());
|
|
@@ -2608,7 +2603,7 @@ function Gn(e) {
|
|
|
2608
2603
|
e.preventDefault(), q();
|
|
2609
2604
|
return;
|
|
2610
2605
|
}
|
|
2611
|
-
let t =
|
|
2606
|
+
let t = Un(e.key);
|
|
2612
2607
|
t !== null && ye(e.nativeEvent, t);
|
|
2613
2608
|
}, [q, ye]),
|
|
2614
2609
|
handleFocusOut: o((e) => {
|
|
@@ -2621,7 +2616,7 @@ function Gn(e) {
|
|
|
2621
2616
|
}
|
|
2622
2617
|
//#endregion
|
|
2623
2618
|
//#region src/components/calendar/CalendarNav.tsx
|
|
2624
|
-
var
|
|
2619
|
+
var Gn = ({ componentId: e, strings: t, year: n, month: r, earliest: i, latest: a, withcontrols: o, prevMonth: s, nextMonth: c, changeMonth: l }) => {
|
|
2625
2620
|
let u = (e) => {
|
|
2626
2621
|
let o = e === "prev", l = o ? kn(n, r, i) : An(n, r, a), u = o ? t.prevMonth : t.nextMonth, d = o ? "chevron-thin-left" : "chevron-thin-right", f = o ? "pkt-calendar__prev-month" : "pkt-calendar__next-month", p = o ? s : c;
|
|
2627
2622
|
return /* @__PURE__ */ _("div", { children: /* @__PURE__ */ v("button", {
|
|
@@ -2706,7 +2701,7 @@ var Kn = ({ componentId: e, strings: t, year: n, month: r, earliest: i, latest:
|
|
|
2706
2701
|
};
|
|
2707
2702
|
//#endregion
|
|
2708
2703
|
//#region src/components/calendar/calendar-utils.ts
|
|
2709
|
-
function
|
|
2704
|
+
function Kn(e, t, n) {
|
|
2710
2705
|
let r = hn(n.year, n.month, e), i = dn(r), a = i === dn(t), o = n.activeSelected.includes(i), s = n.isDayDisabled(r, o), c;
|
|
2711
2706
|
return n.focusedDate ? c = n.focusedDate === i && !s ? "0" : "-1" : !s && n.tabIndexSetRef.current === 0 ? (n.tabIndexSetRef.current = e, c = "0") : c = n.tabIndexSetRef.current === e ? "0" : "-1", {
|
|
2712
2707
|
currentDate: r,
|
|
@@ -2718,7 +2713,7 @@ function qn(e, t, n) {
|
|
|
2718
2713
|
tabindex: c
|
|
2719
2714
|
};
|
|
2720
2715
|
}
|
|
2721
|
-
function
|
|
2716
|
+
function qn(e, t) {
|
|
2722
2717
|
let { currentDateISO: n, isToday: r, isSelected: i } = e, a = t.range && (t.activeSelected.length === 2 || t.rangeHovered !== null) && n === t.activeSelected[0], o = t.range && t.activeSelected.length === 2 && n === t.activeSelected[1];
|
|
2723
2718
|
return (0, z.default)({
|
|
2724
2719
|
"pkt-cal-today": r,
|
|
@@ -2730,7 +2725,7 @@ function Jn(e, t) {
|
|
|
2730
2725
|
"pkt-cal-range-hover": t.rangeHovered !== null && n === dn(t.rangeHovered)
|
|
2731
2726
|
});
|
|
2732
2727
|
}
|
|
2733
|
-
function
|
|
2728
|
+
function Jn(e, t) {
|
|
2734
2729
|
let { currentDateISO: n, isToday: r, isSelected: i, isDisabled: a } = e, o = t.range && (t.activeSelected.length === 2 || t.rangeHovered !== null) && n === t.activeSelected[0], s = t.range && t.activeSelected.length === 2 && n === t.activeSelected[1];
|
|
2735
2730
|
return (0, z.default)({
|
|
2736
2731
|
"pkt-calendar__date": !0,
|
|
@@ -2745,7 +2740,7 @@ function Yn(e, t) {
|
|
|
2745
2740
|
}
|
|
2746
2741
|
//#endregion
|
|
2747
2742
|
//#region src/components/calendar/CalendarGrid.tsx
|
|
2748
|
-
var
|
|
2743
|
+
var Yn = ({ state: e }) => {
|
|
2749
2744
|
let { strings: t, year: n, month: r, activeSelected: i, focusedDate: a, inRange: o, rangeHovered: s, range: c, multiple: l, weeknumbers: u, selectableDatesRef: d, tabIndexSetRef: f, handleDateSelect: p, handleRangeHover: m, isExcluded: h, isDayDisabled: g, setFocusedDate: y, todayDate: b } = e, x = {
|
|
2750
2745
|
year: n,
|
|
2751
2746
|
month: r,
|
|
@@ -2775,13 +2770,13 @@ var Xn = ({ state: e }) => {
|
|
|
2775
2770
|
children: e
|
|
2776
2771
|
});
|
|
2777
2772
|
}, w = (e, t) => {
|
|
2778
|
-
let n =
|
|
2773
|
+
let n = Kn(e, t, x), { currentDate: r, currentDateISO: i, isSelected: a, isDisabled: o, ariaLabel: s, tabindex: l } = n;
|
|
2779
2774
|
d.current.push({
|
|
2780
2775
|
currentDateISO: i,
|
|
2781
2776
|
isDisabled: o,
|
|
2782
2777
|
tabindex: l
|
|
2783
2778
|
});
|
|
2784
|
-
let u =
|
|
2779
|
+
let u = qn(n, S), f = Jn(n, S);
|
|
2785
2780
|
return /* @__PURE__ */ _("td", {
|
|
2786
2781
|
className: u,
|
|
2787
2782
|
children: /* @__PURE__ */ _("button", {
|
|
@@ -2809,17 +2804,7 @@ var Xn = ({ state: e }) => {
|
|
|
2809
2804
|
})
|
|
2810
2805
|
})
|
|
2811
2806
|
}, i);
|
|
2812
|
-
}, T = (e
|
|
2813
|
-
className: "pkt-cal-other",
|
|
2814
|
-
children: /* @__PURE__ */ _("div", {
|
|
2815
|
-
className: "pkt-btn pkt-btn--tertiary pkt-btn--small pkt-btn--label-only",
|
|
2816
|
-
"data-disabled": "disabled",
|
|
2817
|
-
children: /* @__PURE__ */ _("span", {
|
|
2818
|
-
className: "pkt-btn__text pkt-txt-14-light",
|
|
2819
|
-
children: e
|
|
2820
|
-
})
|
|
2821
|
-
})
|
|
2822
|
-
}, t);
|
|
2807
|
+
}, T = (e) => /* @__PURE__ */ _("td", { className: "pkt-cal-other" }, e);
|
|
2823
2808
|
return /* @__PURE__ */ v("table", {
|
|
2824
2809
|
className: "pkt-cal-days pkt-txt-12-medium pkt-calendar__body",
|
|
2825
2810
|
role: "grid",
|
|
@@ -2836,11 +2821,7 @@ var Xn = ({ state: e }) => {
|
|
|
2836
2821
|
}, `week-${a}`)), a++;
|
|
2837
2822
|
for (let a = 0; a < 7; a++) {
|
|
2838
2823
|
let o = zn(n, a, i, t);
|
|
2839
|
-
|
|
2840
|
-
else {
|
|
2841
|
-
let e = Bn(o, a, i, t);
|
|
2842
|
-
r.push(T(e, `${o}-${n}-${a}`)), o === "next-month" && i++;
|
|
2843
|
-
}
|
|
2824
|
+
o === "current-month" ? (r.push(w(i, e)), i++) : (r.push(T(`${o}-${n}-${a}`)), o === "next-month" && i++);
|
|
2844
2825
|
}
|
|
2845
2826
|
o.push(/* @__PURE__ */ _("tr", {
|
|
2846
2827
|
className: "pkt-cal-week-row",
|
|
@@ -2851,8 +2832,8 @@ var Xn = ({ state: e }) => {
|
|
|
2851
2832
|
return o;
|
|
2852
2833
|
})() })]
|
|
2853
2834
|
});
|
|
2854
|
-
},
|
|
2855
|
-
let n =
|
|
2835
|
+
}, Xn = i((e, t) => {
|
|
2836
|
+
let n = Wn(e);
|
|
2856
2837
|
return u(t, () => ({
|
|
2857
2838
|
handleDateSelect: n.handleDateSelect,
|
|
2858
2839
|
addToSelected: n.addToSelected,
|
|
@@ -2876,7 +2857,7 @@ var Xn = ({ state: e }) => {
|
|
|
2876
2857
|
].filter(Boolean).join(" "),
|
|
2877
2858
|
onBlur: n.handleFocusOut,
|
|
2878
2859
|
onKeyDown: n.handleKeydown,
|
|
2879
|
-
children: [/* @__PURE__ */ _(
|
|
2860
|
+
children: [/* @__PURE__ */ _(Gn, {
|
|
2880
2861
|
componentId: n.componentId,
|
|
2881
2862
|
strings: n.strings,
|
|
2882
2863
|
year: n.year,
|
|
@@ -2887,13 +2868,13 @@ var Xn = ({ state: e }) => {
|
|
|
2887
2868
|
prevMonth: n.prevMonth,
|
|
2888
2869
|
nextMonth: n.nextMonth,
|
|
2889
2870
|
changeMonth: n.changeMonth
|
|
2890
|
-
}), /* @__PURE__ */ _(
|
|
2871
|
+
}), /* @__PURE__ */ _(Yn, { state: n })]
|
|
2891
2872
|
});
|
|
2892
2873
|
});
|
|
2893
|
-
|
|
2874
|
+
Xn.displayName = "PktCalendar";
|
|
2894
2875
|
//#endregion
|
|
2895
2876
|
//#region src/components/heading/Heading.tsx
|
|
2896
|
-
var
|
|
2877
|
+
var Zn = (e) => {
|
|
2897
2878
|
switch (e) {
|
|
2898
2879
|
case 1: return "xlarge";
|
|
2899
2880
|
case 2: return "large";
|
|
@@ -2903,7 +2884,7 @@ var Qn = (e) => {
|
|
|
2903
2884
|
case 6: return "xsmall";
|
|
2904
2885
|
default: return "medium";
|
|
2905
2886
|
}
|
|
2906
|
-
},
|
|
2887
|
+
}, Qn = (e) => {
|
|
2907
2888
|
switch (e) {
|
|
2908
2889
|
case 1:
|
|
2909
2890
|
case 2: return "regular";
|
|
@@ -2913,8 +2894,8 @@ var Qn = (e) => {
|
|
|
2913
2894
|
case 6: return "medium";
|
|
2914
2895
|
default: return "medium";
|
|
2915
2896
|
}
|
|
2916
|
-
},
|
|
2917
|
-
let l = t ??
|
|
2897
|
+
}, $n = i(function({ level: e = 2, size: t, weight: n, visuallyHidden: r, align: i, className: a, children: o, ...s }, c) {
|
|
2898
|
+
let l = t ?? Zn(e), u = n ?? Qn(e), d = (0, z.default)("pkt-heading", `pkt-heading--${l}`, `pkt-heading--fw-${u}`, i && `pkt-heading--${i}`, r && "pkt-sr-only", a), f = `h${e}`;
|
|
2918
2899
|
return /* @__PURE__ */ _(f, {
|
|
2919
2900
|
...s,
|
|
2920
2901
|
ref: c,
|
|
@@ -2922,10 +2903,10 @@ var Qn = (e) => {
|
|
|
2922
2903
|
children: o
|
|
2923
2904
|
});
|
|
2924
2905
|
});
|
|
2925
|
-
|
|
2906
|
+
$n.displayName = "PktHeading";
|
|
2926
2907
|
//#endregion
|
|
2927
2908
|
//#region src/components/tag/Tag.tsx
|
|
2928
|
-
var
|
|
2909
|
+
var er = i(({ children: e, skin: t = "blue", textStyle: n, size: r = "medium", closeTag: i, className: a, iconName: s, ariaLabel: l, onClose: u, type: d = "button", "aria-description": h, strings: g, ...y }, b) => {
|
|
2929
2910
|
let [x, S] = m(!1), C = o(() => {
|
|
2930
2911
|
S(!0), u && u();
|
|
2931
2912
|
}, [u]), w = p(null), [T, E] = m("");
|
|
@@ -2989,10 +2970,10 @@ var tr = i(({ children: e, skin: t = "blue", textStyle: n, size: r = "medium", c
|
|
|
2989
2970
|
})]
|
|
2990
2971
|
});
|
|
2991
2972
|
});
|
|
2992
|
-
|
|
2973
|
+
er.displayName = "PktTag";
|
|
2993
2974
|
//#endregion
|
|
2994
2975
|
//#region src/components/card/Card.tsx
|
|
2995
|
-
var
|
|
2976
|
+
var tr = i(({ children: e, className: t, ariaLabel: n, metaLead: r, borderOnHover: i = P.borderOnHover, metaTrail: a, layout: o = P.layout, heading: s = "", headingLevel: c = P.headingLevel, image: l, imageShape: u = P.imageShape, imageAspect: d, restrictImageHeight: f = P.restrictImageHeight, clickCardLink: p, padding: m = P.padding, openLinkInNewTab: h = P.openLinkInNewTab, skin: g = P.skin, subheading: y = "", tagPosition: b = P.tagPosition, zoom: x = P.zoom, tags: S = [], strings: C, ...w }, T) => {
|
|
2996
2977
|
let E = ke(["card"], C), D = (0, z.default)({
|
|
2997
2978
|
"pkt-card": !0,
|
|
2998
2979
|
[`pkt-card--${g}`]: g,
|
|
@@ -3010,7 +2991,7 @@ var nr = i(({ children: e, className: t, ariaLabel: n, metaLead: r, borderOnHove
|
|
|
3010
2991
|
className: (0, z.default)("pkt-card__tags", `pkt-card__tags-${b}`),
|
|
3011
2992
|
role: "list",
|
|
3012
2993
|
"aria-label": Y(S.length, E.card.tagsLabelOne, E.card.tagsLabelOther),
|
|
3013
|
-
children: Me(S, (e) => e.text).map(({ item: e, key: t }) => /* @__PURE__ */ _(
|
|
2994
|
+
children: Me(S, (e) => e.text).map(({ item: e, key: t }) => /* @__PURE__ */ _(er, {
|
|
3014
2995
|
role: "listitem",
|
|
3015
2996
|
textStyle: "normal-text",
|
|
3016
2997
|
size: "medium",
|
|
@@ -3018,13 +2999,13 @@ var nr = i(({ children: e, className: t, ariaLabel: n, metaLead: r, borderOnHove
|
|
|
3018
2999
|
iconName: e.iconName,
|
|
3019
3000
|
children: /* @__PURE__ */ _("span", { children: e.text })
|
|
3020
3001
|
}, t))
|
|
3021
|
-
}), M = () => !s || p ? null : /* @__PURE__ */ _(
|
|
3002
|
+
}), M = () => !s || p ? null : /* @__PURE__ */ _($n, {
|
|
3022
3003
|
className: "pkt-card__heading",
|
|
3023
3004
|
level: c,
|
|
3024
3005
|
size: "medium",
|
|
3025
3006
|
weight: "regular",
|
|
3026
3007
|
children: s
|
|
3027
|
-
}), N = () => p ? /* @__PURE__ */ _(
|
|
3008
|
+
}), N = () => p ? /* @__PURE__ */ _($n, {
|
|
3028
3009
|
className: "pkt-card__link-heading pkt-card__heading",
|
|
3029
3010
|
level: c,
|
|
3030
3011
|
size: "medium",
|
|
@@ -3076,23 +3057,23 @@ var nr = i(({ children: e, className: t, ariaLabel: n, metaLead: r, borderOnHove
|
|
|
3076
3057
|
})]
|
|
3077
3058
|
});
|
|
3078
3059
|
});
|
|
3079
|
-
|
|
3060
|
+
tr.displayName = "PktCard";
|
|
3080
3061
|
//#endregion
|
|
3081
3062
|
//#region ../../shared-utils/utils.ts
|
|
3082
|
-
var
|
|
3083
|
-
let e =
|
|
3063
|
+
var nr = () => ("00000000000000000" + (Math.random() * 0x10000000000000000).toString(16)).slice(-16), rr = () => {
|
|
3064
|
+
let e = nr(), t = nr();
|
|
3084
3065
|
return e.slice(0, 8) + "-" + e.slice(8, 12) + "-4" + e.slice(13) + "-a" + t.slice(1, 4) + "-" + t.slice(4);
|
|
3085
3066
|
};
|
|
3086
3067
|
//#endregion
|
|
3087
3068
|
//#region src/hooks/useGeneratedId.ts
|
|
3088
|
-
function
|
|
3089
|
-
let t = f(() =>
|
|
3069
|
+
function ir(e) {
|
|
3070
|
+
let t = f(() => rr(), []);
|
|
3090
3071
|
return e || t;
|
|
3091
3072
|
}
|
|
3092
3073
|
//#endregion
|
|
3093
3074
|
//#region src/components/checkboxgroup/CheckboxGroupContext.ts
|
|
3094
|
-
var
|
|
3095
|
-
let j = ke(["forms"], C), M =
|
|
3075
|
+
var ar = n(null), or = () => s(ar), sr = i(({ id: e, hasTile: t = ee.hasTile, disabled: n = ee.disabled, label: r, checkHelptext: i, hasError: a = ee.hasError, className: o, isSwitch: s = ee.isSwitch, hideLabel: l = ee.hideLabel, labelPosition: u = ee.labelPosition, inputSize: d, defaultChecked: f, checked: m, indeterminate: h, optionalTag: y, optionalText: b, requiredTag: x, requiredText: S, strings: C, tagText: w, name: T, value: E, onChange: D, "aria-describedby": O, ...k }, A) => {
|
|
3076
|
+
let j = ke(["forms"], C), M = ir(e), N = p(null), P = or(), te = E ?? "on", F = P?.value, I = F !== void 0, ne = I ? F.includes(te) : m, re = f ?? (P?.defaultValue === void 0 ? void 0 : P.defaultValue.includes(te)), ie = t || !!P?.hasTile, ae = a || !!P?.hasError, oe = n || !!P?.disabled;
|
|
3096
3077
|
c(() => {
|
|
3097
3078
|
I && m !== void 0 && console.warn(`PktCheckbox (${M}): checked ignoreres når PktCheckboxGroup har value. Styr valget med value på gruppen.`);
|
|
3098
3079
|
}, [
|
|
@@ -3181,11 +3162,11 @@ var or = n(null), sr = () => s(or), cr = i(({ id: e, hasTile: t = ee.hasTile, di
|
|
|
3181
3162
|
})
|
|
3182
3163
|
});
|
|
3183
3164
|
});
|
|
3184
|
-
|
|
3165
|
+
sr.displayName = "PktCheckbox";
|
|
3185
3166
|
//#endregion
|
|
3186
3167
|
//#region src/hooks/useOptionGroupField.ts
|
|
3187
|
-
var
|
|
3188
|
-
function
|
|
3168
|
+
var cr = (e) => !e.matches(":disabled");
|
|
3169
|
+
function lr({ type: e, name: t, forwardedRef: n, onChange: r, onValueChange: i, onFocus: a, onBlur: s, onValueSet: l }) {
|
|
3189
3170
|
let u = p(null), d = p({
|
|
3190
3171
|
name: t,
|
|
3191
3172
|
onValueSet: l
|
|
@@ -3198,7 +3179,7 @@ function ur({ type: e, name: t, forwardedRef: n, onChange: r, onValueChange: i,
|
|
|
3198
3179
|
});
|
|
3199
3180
|
let f = o(() => Array.from(u.current?.querySelectorAll(`input[type="${e}"]`) ?? []), [e]), m = o(() => {
|
|
3200
3181
|
let t = f();
|
|
3201
|
-
return e === "radio" ? t.find((e) => e.checked)?.value ?? "" : t.filter((e) => e.checked &&
|
|
3182
|
+
return e === "radio" ? t.find((e) => e.checked)?.value ?? "" : t.filter((e) => e.checked && cr(e)).map((e) => e.value);
|
|
3202
3183
|
}, [f, e]), h = o((e) => {
|
|
3203
3184
|
let t = Array.isArray(e) ? e.map(String) : e == null || e === "" ? [] : [String(e)];
|
|
3204
3185
|
f().forEach((e) => {
|
|
@@ -3206,7 +3187,7 @@ function ur({ type: e, name: t, forwardedRef: n, onChange: r, onValueChange: i,
|
|
|
3206
3187
|
}), d.current.onValueSet?.();
|
|
3207
3188
|
}, [f]), g = o((e) => {
|
|
3208
3189
|
let t = f();
|
|
3209
|
-
(t.find((e) => e.checked &&
|
|
3190
|
+
(t.find((e) => e.checked && cr(e)) ?? t.find(cr))?.focus(e);
|
|
3210
3191
|
}, [f]), _ = o((e) => {
|
|
3211
3192
|
e && Object.defineProperties(e, {
|
|
3212
3193
|
name: {
|
|
@@ -3252,7 +3233,7 @@ function ur({ type: e, name: t, forwardedRef: n, onChange: r, onValueChange: i,
|
|
|
3252
3233
|
}
|
|
3253
3234
|
//#endregion
|
|
3254
3235
|
//#region src/hooks/useFocusModality.ts
|
|
3255
|
-
function
|
|
3236
|
+
function ur(e) {
|
|
3256
3237
|
let t = p(null), n = p(!1), r = p(void 0), i = (e) => {
|
|
3257
3238
|
let n = t.current;
|
|
3258
3239
|
n && (e === void 0 ? delete n.dataset.navtype : n.dataset.navtype = e);
|
|
@@ -3278,11 +3259,11 @@ function dr(e) {
|
|
|
3278
3259
|
}
|
|
3279
3260
|
//#endregion
|
|
3280
3261
|
//#region ../../shared-utils/forms/described-by.ts
|
|
3281
|
-
var
|
|
3262
|
+
var dr = (e) => {
|
|
3282
3263
|
let t = [];
|
|
3283
3264
|
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;
|
|
3284
|
-
},
|
|
3285
|
-
let [l, u] = m(!1), d = f(() =>
|
|
3265
|
+
}, fr = (e) => `${e}-counter-status`, pr = (e, t) => !!t && t > 0 && (e ?? 0) > t, mr = "Les mer <span class='pkt-sr-only'>om feltet</span>", hr = (e) => e == null || e === "" ? null : typeof e == "string" ? /* @__PURE__ */ _("span", { dangerouslySetInnerHTML: { __html: e } }) : e, gr = i(function({ helptext: e, helptextDropdown: t, helptextDropdownButton: n, forId: r, onToggleHelpText: i, className: a, children: o, ...s }, c) {
|
|
3266
|
+
let [l, u] = m(!1), d = f(() => rr(), []), p = r || d, h = () => {
|
|
3286
3267
|
let e = !l;
|
|
3287
3268
|
u(e), i?.(e);
|
|
3288
3269
|
}, g = (0, z.default)("pkt-inputwrapper__helptext-container", !!(e || t || o) && "pkt-inputwrapper__has-helptext", a);
|
|
@@ -3296,7 +3277,7 @@ var fr = (e) => {
|
|
|
3296
3277
|
children: [o && /* @__PURE__ */ _("div", {
|
|
3297
3278
|
className: "pkt-contents",
|
|
3298
3279
|
children: o
|
|
3299
|
-
}),
|
|
3280
|
+
}), hr(e)]
|
|
3300
3281
|
}), t && /* @__PURE__ */ v("div", {
|
|
3301
3282
|
className: "pkt-inputwrapper__helptext-expandable",
|
|
3302
3283
|
children: [/* @__PURE__ */ v("button", {
|
|
@@ -3310,21 +3291,21 @@ var fr = (e) => {
|
|
|
3310
3291
|
name: l ? "chevron-thin-up" : "chevron-thin-down"
|
|
3311
3292
|
}), /* @__PURE__ */ _("span", {
|
|
3312
3293
|
className: "pkt-btn__text",
|
|
3313
|
-
dangerouslySetInnerHTML: { __html: n ??
|
|
3294
|
+
dangerouslySetInnerHTML: { __html: n ?? mr }
|
|
3314
3295
|
})]
|
|
3315
3296
|
}), /* @__PURE__ */ _("div", {
|
|
3316
3297
|
id: `${p}-helptext-expandable`,
|
|
3317
3298
|
className: (0, z.default)("pkt-inputwrapper__helptext", l ? "pkt-inputwrapper__helptext-expandable-open" : "pkt-inputwrapper__helptext-expandable-closed"),
|
|
3318
|
-
children:
|
|
3299
|
+
children: hr(t)
|
|
3319
3300
|
})]
|
|
3320
3301
|
})]
|
|
3321
3302
|
});
|
|
3322
3303
|
});
|
|
3323
|
-
|
|
3304
|
+
gr.displayName = "PktHelptext";
|
|
3324
3305
|
//#endregion
|
|
3325
3306
|
//#region src/components/inputwrapper/InputWrapper.tsx
|
|
3326
|
-
var
|
|
3327
|
-
let ee =
|
|
3307
|
+
var _r = i(({ id: e, forId: t, label: n, helptext: r, helptextDropdown: i, helptextDropdownButton: a, counter: o, counterCurrent: s = 0, counterMaxLength: c, optionalTag: l = !1, optionalText: u, requiredTag: d = !1, requiredText: p, tagText: m = null, hasError: h = !1, errorMessage: y, disabled: b = !1, inline: x = !1, ariaDescribedby: S, useWrapper: C = !0, children: w, className: T = "", hasFieldset: E = !1, layout: D = "vertical", role: O, counterPosition: k = "bottom", size: A = "medium", strings: j, onFocus: M, onBlur: N }, P) => {
|
|
3308
|
+
let ee = ur(P), te = ke(["forms", "validation"], j), F = f(() => rr(), []), I = t || F, ne = [...new Set([S || (r ? `${I}-helptext` : ""), h && y ? `${I}-error` : ""].join(" ").split(" ").filter(Boolean))].join(" ") || void 0, re = !!o, ie = re && k === "top", ae = re && k === "bottom", oe = [
|
|
3328
3309
|
"pkt-inputwrapper",
|
|
3329
3310
|
T,
|
|
3330
3311
|
h ? "pkt-inputwrapper--error" : "",
|
|
@@ -3335,13 +3316,13 @@ var vr = i(({ id: e, forId: t, label: n, helptext: r, helptextDropdown: i, helpt
|
|
|
3335
3316
|
"pkt-tag",
|
|
3336
3317
|
"pkt-tag--small",
|
|
3337
3318
|
"pkt-tag--thin-text"
|
|
3338
|
-
].join(" "), R =
|
|
3319
|
+
].join(" "), R = pr(s, c), z = re ? /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ v("div", {
|
|
3339
3320
|
className: "pkt-input__counter",
|
|
3340
3321
|
"aria-hidden": "true",
|
|
3341
3322
|
children: [s, c ? `/${c}` : ""]
|
|
3342
3323
|
}), /* @__PURE__ */ _("div", {
|
|
3343
3324
|
className: "pkt-sr-only",
|
|
3344
|
-
id:
|
|
3325
|
+
id: fr(I),
|
|
3345
3326
|
"aria-live": "polite",
|
|
3346
3327
|
children: R ? pe(te.validation.counterExceeded, {
|
|
3347
3328
|
current: s,
|
|
@@ -3387,7 +3368,7 @@ var vr = i(({ id: e, forId: t, label: n, helptext: r, helptextDropdown: i, helpt
|
|
|
3387
3368
|
});
|
|
3388
3369
|
}, V = () => {
|
|
3389
3370
|
let e = C ? r : void 0;
|
|
3390
|
-
return !e && !i ? null : /* @__PURE__ */ _(
|
|
3371
|
+
return !e && !i ? null : /* @__PURE__ */ _(gr, {
|
|
3391
3372
|
forId: I,
|
|
3392
3373
|
helptext: e,
|
|
3393
3374
|
helptextDropdown: i,
|
|
@@ -3437,11 +3418,11 @@ var vr = i(({ id: e, forId: t, label: n, helptext: r, helptextDropdown: i, helpt
|
|
|
3437
3418
|
})
|
|
3438
3419
|
});
|
|
3439
3420
|
});
|
|
3440
|
-
|
|
3421
|
+
_r.displayName = "PktInputWrapper";
|
|
3441
3422
|
//#endregion
|
|
3442
3423
|
//#region src/components/checkboxgroup/CheckboxGroup.tsx
|
|
3443
|
-
var
|
|
3444
|
-
let N =
|
|
3424
|
+
var vr = i(({ id: e, name: t, label: n, helptext: r, helptextDropdown: i, helptextDropdownButton: a, value: o, defaultValue: s, layout: l = F.layout, inputSize: u = F.inputSize, hasTile: d = F.hasTile, required: m = F.required, disabled: h = F.disabled, hasError: g = F.hasError, errorMessage: v, useWrapper: y = F.useWrapper, optionalTag: b = F.optionalTag, optionalText: x, requiredTag: S = F.requiredTag, requiredText: C, tagText: w, strings: T, className: E, children: D, onChange: O, onValueChange: k, onFocus: A, onBlur: j }, M) => {
|
|
3425
|
+
let N = ir(e), P = t || N, ee = ke(["validation"], T).validation.checkboxGroupValueMissing, te = p(!1), I = lr({
|
|
3445
3426
|
type: "checkbox",
|
|
3446
3427
|
name: P,
|
|
3447
3428
|
forwardedRef: M,
|
|
@@ -3453,7 +3434,7 @@ var yr = i(({ id: e, name: t, label: n, helptext: r, helptextDropdown: i, helpte
|
|
|
3453
3434
|
}), ne = () => {
|
|
3454
3435
|
if (!m && !te.current) return;
|
|
3455
3436
|
te.current = m;
|
|
3456
|
-
let e = I.options(), t = m && !e.some((e) => e.checked &&
|
|
3437
|
+
let e = I.options(), t = m && !e.some((e) => e.checked && cr(e));
|
|
3457
3438
|
e.forEach((e) => e.setCustomValidity(t ? ee : ""));
|
|
3458
3439
|
};
|
|
3459
3440
|
c(() => {
|
|
@@ -3485,9 +3466,9 @@ var yr = i(({ id: e, name: t, label: n, helptext: r, helptextDropdown: i, helpte
|
|
|
3485
3466
|
s,
|
|
3486
3467
|
I
|
|
3487
3468
|
]);
|
|
3488
|
-
return /* @__PURE__ */ _(
|
|
3469
|
+
return /* @__PURE__ */ _(ar.Provider, {
|
|
3489
3470
|
value: re,
|
|
3490
|
-
children: /* @__PURE__ */ _(
|
|
3471
|
+
children: /* @__PURE__ */ _(_r, {
|
|
3491
3472
|
ref: I.mergedRef,
|
|
3492
3473
|
onFocus: I.onRootFocus,
|
|
3493
3474
|
onBlur: I.onRootBlur,
|
|
@@ -3515,35 +3496,35 @@ var yr = i(({ id: e, name: t, label: n, helptext: r, helptextDropdown: i, helpte
|
|
|
3515
3496
|
})
|
|
3516
3497
|
});
|
|
3517
3498
|
});
|
|
3518
|
-
|
|
3499
|
+
vr.displayName = "PktCheckboxGroup";
|
|
3519
3500
|
//#endregion
|
|
3520
3501
|
//#region ../../shared-utils/combobox/option-utils.ts
|
|
3521
|
-
var
|
|
3502
|
+
var yr = (e, t) => t && (e.find((e) => e.value === t) || e.find((e) => e.label === t)) || null, br = (e, t) => {
|
|
3522
3503
|
if (!t) return -1;
|
|
3523
3504
|
let n = e.findIndex((e) => e.value === t);
|
|
3524
3505
|
return n >= 0 ? n : e.findIndex((e) => e.label === t);
|
|
3525
|
-
},
|
|
3506
|
+
}, xr = (e) => e.value + (e.label || "") + (e.prefix || ""), Sr = (e, t) => (e.fulltext || xr(e)).toLowerCase().includes(t), Cr = (e, t) => {
|
|
3526
3507
|
if (!t) return [...e];
|
|
3527
3508
|
let n = t.toLowerCase();
|
|
3528
|
-
return e.filter((e) =>
|
|
3529
|
-
},
|
|
3509
|
+
return e.filter((e) => Sr(e, n));
|
|
3510
|
+
}, wr = (e, t) => t !== null && e >= t, Tr = (e, t) => {
|
|
3530
3511
|
if (!e) return "";
|
|
3531
3512
|
switch (t) {
|
|
3532
3513
|
case "prefixAndValue": return `${e.prefix || ""} ${e.value}`.trim();
|
|
3533
3514
|
case "value": return e.value;
|
|
3534
3515
|
default: return e.label || e.value;
|
|
3535
3516
|
}
|
|
3536
|
-
},
|
|
3517
|
+
}, Er = (e, t) => e ? Array.isArray(e) ? t ? e : e.length > 0 ? [e[0]] : [] : t ? e.split(",").filter(Boolean) : [e] : [], Dr = (e, t) => {
|
|
3537
3518
|
if (!t) return {
|
|
3538
3519
|
filtered: [...e],
|
|
3539
3520
|
suggestion: null
|
|
3540
3521
|
};
|
|
3541
|
-
let n = t.toLowerCase(), r = e.filter((e) =>
|
|
3522
|
+
let n = t.toLowerCase(), r = e.filter((e) => Sr(e, n));
|
|
3542
3523
|
return {
|
|
3543
3524
|
filtered: r,
|
|
3544
3525
|
suggestion: r.find((e) => !e.selected && e.label?.toLowerCase().startsWith(n)) || null
|
|
3545
3526
|
};
|
|
3546
|
-
},
|
|
3527
|
+
}, Or = (e, t, n, r) => {
|
|
3547
3528
|
if (!e.trim()) return {
|
|
3548
3529
|
addValueText: null,
|
|
3549
3530
|
userInfoMessage: ""
|
|
@@ -3562,7 +3543,7 @@ var br = (e, t) => t && (e.find((e) => e.value === t) || e.find((e) => e.label =
|
|
|
3562
3543
|
addValueText: null,
|
|
3563
3544
|
userInfoMessage: ""
|
|
3564
3545
|
};
|
|
3565
|
-
},
|
|
3546
|
+
}, kr = (e, t, n) => {
|
|
3566
3547
|
switch (e) {
|
|
3567
3548
|
case ",": return n ? "addValue" : null;
|
|
3568
3549
|
case "Enter": return "addValue";
|
|
@@ -3571,12 +3552,12 @@ var br = (e, t) => t && (e.find((e) => e.value === t) || e.find((e) => e.label =
|
|
|
3571
3552
|
case "Escape": return "closeOptions";
|
|
3572
3553
|
default: return null;
|
|
3573
3554
|
}
|
|
3574
|
-
},
|
|
3555
|
+
}, Ar = (e, t, n, r, i) => {
|
|
3575
3556
|
if (!e) return {
|
|
3576
3557
|
action: "none",
|
|
3577
3558
|
value: null
|
|
3578
3559
|
};
|
|
3579
|
-
let a =
|
|
3560
|
+
let a = yr(n, e);
|
|
3580
3561
|
return !t.includes(e) && !a ? r ? {
|
|
3581
3562
|
action: "addUserValue",
|
|
3582
3563
|
value: e
|
|
@@ -3593,36 +3574,36 @@ var br = (e, t) => t && (e.find((e) => e.value === t) || e.find((e) => e.label =
|
|
|
3593
3574
|
action: "none",
|
|
3594
3575
|
value: null
|
|
3595
3576
|
};
|
|
3596
|
-
},
|
|
3597
|
-
let r =
|
|
3577
|
+
}, jr = (e, t, n) => {
|
|
3578
|
+
let r = yr(t, e);
|
|
3598
3579
|
return n === "label" && r?.label ? r.label : e;
|
|
3599
|
-
},
|
|
3580
|
+
}, Mr = (e) => {
|
|
3600
3581
|
e.scrollIntoView({ block: "nearest" }), window.setTimeout(() => e.focus(), 0);
|
|
3601
|
-
},
|
|
3582
|
+
}, Nr = (e) => Array.from(e.querySelectorAll("[role=\"option\"]:not([data-disabled])") || []), Pr = (e) => {
|
|
3602
3583
|
let t = e.nextElementSibling;
|
|
3603
|
-
t &&
|
|
3604
|
-
},
|
|
3584
|
+
t && Mr(t);
|
|
3585
|
+
}, Fr = (e, t, n) => {
|
|
3605
3586
|
let r = e.previousElementSibling;
|
|
3606
3587
|
if (e.dataset.index === "0" && n) {
|
|
3607
3588
|
let e = t.querySelector("[role=\"searchbox\"]");
|
|
3608
|
-
e &&
|
|
3609
|
-
} else r &&
|
|
3610
|
-
},
|
|
3611
|
-
let t =
|
|
3612
|
-
t[0] &&
|
|
3613
|
-
},
|
|
3589
|
+
e && Mr(e);
|
|
3590
|
+
} else r && Mr(r);
|
|
3591
|
+
}, Ir = (e) => {
|
|
3592
|
+
let t = Nr(e);
|
|
3593
|
+
t[0] && Mr(t[0]);
|
|
3594
|
+
}, Lr = (e, t) => {
|
|
3614
3595
|
if (t.disabled) return;
|
|
3615
|
-
let n =
|
|
3596
|
+
let n = Nr(e);
|
|
3616
3597
|
if (t.allowUserInput && t.customUserInput) {
|
|
3617
3598
|
let t = e.querySelector("[data-type=\"new-option\"]");
|
|
3618
3599
|
if (t) {
|
|
3619
|
-
|
|
3600
|
+
Mr(t);
|
|
3620
3601
|
return;
|
|
3621
3602
|
}
|
|
3622
3603
|
}
|
|
3623
3604
|
let r = n.find((e) => e.dataset.selected === "true");
|
|
3624
3605
|
if (r) {
|
|
3625
|
-
|
|
3606
|
+
Mr(r);
|
|
3626
3607
|
return;
|
|
3627
3608
|
}
|
|
3628
3609
|
if (t.includeSearch && !(document.activeElement instanceof HTMLInputElement)) {
|
|
@@ -3632,8 +3613,8 @@ var br = (e, t) => t && (e.find((e) => e.value === t) || e.find((e) => e.label =
|
|
|
3632
3613
|
return;
|
|
3633
3614
|
}
|
|
3634
3615
|
}
|
|
3635
|
-
n[0] &&
|
|
3636
|
-
},
|
|
3616
|
+
n[0] && Mr(n[0]);
|
|
3617
|
+
}, Rr = ({ state: e, outside: t = !1 }) => {
|
|
3637
3618
|
let { values: n, options: r, disabled: i, displayValueAs: a, handleTagRemove: o, handleTagKeydown: s, focusedTagIndex: l } = e, u = p([]);
|
|
3638
3619
|
if (c(() => {
|
|
3639
3620
|
!t && l >= 0 && l < n.length && u.current[l]?.focus();
|
|
@@ -3643,10 +3624,10 @@ var br = (e, t) => t && (e.find((e) => e.value === t) || e.find((e) => e.label =
|
|
|
3643
3624
|
n.length
|
|
3644
3625
|
]), n.length === 0) return null;
|
|
3645
3626
|
let d = n.map((e, n) => {
|
|
3646
|
-
let c =
|
|
3627
|
+
let c = yr(r, e), d = c?.tagSkinColor, f = c ? Tr(c, a) : e;
|
|
3647
3628
|
return i ? /* @__PURE__ */ _("li", {
|
|
3648
3629
|
role: "listitem",
|
|
3649
|
-
children: /* @__PURE__ */ _(
|
|
3630
|
+
children: /* @__PURE__ */ _(er, {
|
|
3650
3631
|
skin: d || "blue",
|
|
3651
3632
|
children: /* @__PURE__ */ _("span", {
|
|
3652
3633
|
className: "pkt-combobox__value",
|
|
@@ -3655,7 +3636,7 @@ var br = (e, t) => t && (e.find((e) => e.value === t) || e.find((e) => e.label =
|
|
|
3655
3636
|
})
|
|
3656
3637
|
}, e) : t ? /* @__PURE__ */ _("li", {
|
|
3657
3638
|
role: "listitem",
|
|
3658
|
-
children: /* @__PURE__ */ _(
|
|
3639
|
+
children: /* @__PURE__ */ _(er, {
|
|
3659
3640
|
skin: d || "blue",
|
|
3660
3641
|
closeTag: !0,
|
|
3661
3642
|
onClose: () => o(e),
|
|
@@ -3668,7 +3649,7 @@ var br = (e, t) => t && (e.find((e) => e.value === t) || e.find((e) => e.label =
|
|
|
3668
3649
|
role: "listitem",
|
|
3669
3650
|
onClick: (e) => e.stopPropagation(),
|
|
3670
3651
|
onMouseDown: (e) => e.preventDefault(),
|
|
3671
|
-
children: /* @__PURE__ */ _(
|
|
3652
|
+
children: /* @__PURE__ */ _(er, {
|
|
3672
3653
|
ref: (e) => {
|
|
3673
3654
|
u.current[n] = e;
|
|
3674
3655
|
},
|
|
@@ -3696,17 +3677,17 @@ var br = (e, t) => t && (e.find((e) => e.value === t) || e.find((e) => e.label =
|
|
|
3696
3677
|
className: "pkt-combobox__tag-list",
|
|
3697
3678
|
children: d
|
|
3698
3679
|
});
|
|
3699
|
-
},
|
|
3680
|
+
}, zr = ({ state: e }) => {
|
|
3700
3681
|
let { values: t, options: n, editingSingleValue: r, displayValueAs: i } = e;
|
|
3701
3682
|
if (r || t.length === 0) return null;
|
|
3702
|
-
let a =
|
|
3683
|
+
let a = yr(n, t[0]);
|
|
3703
3684
|
if (!a) return null;
|
|
3704
|
-
let o =
|
|
3685
|
+
let o = Tr(a, i);
|
|
3705
3686
|
return /* @__PURE__ */ _("span", {
|
|
3706
3687
|
className: "pkt-combobox__value",
|
|
3707
3688
|
children: o
|
|
3708
3689
|
});
|
|
3709
|
-
},
|
|
3690
|
+
}, Br = ({ state: e }) => {
|
|
3710
3691
|
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 = [
|
|
3711
3692
|
"pkt-combobox__input",
|
|
3712
3693
|
`pkt-combobox__input--${j}`,
|
|
@@ -3714,7 +3695,7 @@ var br = (e, t) => t && (e.find((e) => e.value === t) || e.find((e) => e.label =
|
|
|
3714
3695
|
o && "pkt-combobox__input--open",
|
|
3715
3696
|
m && "pkt-combobox__input--error",
|
|
3716
3697
|
f && "pkt-combobox__input--disabled"
|
|
3717
|
-
].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", F = o && i[0] &&
|
|
3698
|
+
].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", F = o && i[0] && yr(a, i[0]) ? `${r}-${br(a, i[0])}` : void 0, I = s && i.length > 0 ? `${i.length} valgt` : void 0, ne = dr({
|
|
3718
3699
|
id: P ? n : `${t}-combobox`,
|
|
3719
3700
|
hasHelptext: !!e.helptext,
|
|
3720
3701
|
ariaDescribedby: e.ariaDescribedby
|
|
@@ -3744,7 +3725,7 @@ var br = (e, t) => t && (e.find((e) => e.value === t) || e.find((e) => e.label =
|
|
|
3744
3725
|
className: "pkt-combobox__placeholder",
|
|
3745
3726
|
onClick: O,
|
|
3746
3727
|
children: d
|
|
3747
|
-
}) : te ? s ? /* @__PURE__ */ _(
|
|
3728
|
+
}) : te ? s ? /* @__PURE__ */ _(Rr, { state: e }) : P ? null : /* @__PURE__ */ _(zr, { state: e }) : null,
|
|
3748
3729
|
P ? /* @__PURE__ */ _("div", {
|
|
3749
3730
|
className: "pkt-combobox__input-div combobox__input",
|
|
3750
3731
|
children: /* @__PURE__ */ _("input", {
|
|
@@ -3783,7 +3764,7 @@ var br = (e, t) => t && (e.find((e) => e.value === t) || e.find((e) => e.label =
|
|
|
3783
3764
|
})
|
|
3784
3765
|
]
|
|
3785
3766
|
});
|
|
3786
|
-
},
|
|
3767
|
+
}, Vr = ({ state: e }) => {
|
|
3787
3768
|
let t = ke(["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 = [
|
|
3788
3769
|
"pkt-listbox",
|
|
3789
3770
|
i && "pkt-listbox__open",
|
|
@@ -3909,29 +3890,29 @@ var br = (e, t) => t && (e.find((e) => e.value === t) || e.find((e) => e.label =
|
|
|
3909
3890
|
className: "pkt-visually-hidden",
|
|
3910
3891
|
children: m
|
|
3911
3892
|
})] });
|
|
3912
|
-
},
|
|
3893
|
+
}, Hr = (e, t) => {
|
|
3913
3894
|
if (!e) return null;
|
|
3914
3895
|
if (t === void 0) return e.closest("form");
|
|
3915
3896
|
let n = t ? e.ownerDocument.getElementById(t) : null;
|
|
3916
3897
|
return n instanceof HTMLFormElement ? n : null;
|
|
3917
|
-
},
|
|
3898
|
+
}, Ur = (e, t) => {
|
|
3918
3899
|
let [n, r] = m(null);
|
|
3919
3900
|
return c(() => {
|
|
3920
|
-
r(
|
|
3901
|
+
r(Hr(e.current, t));
|
|
3921
3902
|
}, [e, t]), n;
|
|
3922
3903
|
};
|
|
3923
3904
|
//#endregion
|
|
3924
3905
|
//#region src/components/combobox/useComboboxState.ts
|
|
3925
|
-
function
|
|
3906
|
+
function Wr(e, t) {
|
|
3926
3907
|
return e.map((e) => ({
|
|
3927
3908
|
...e,
|
|
3928
3909
|
label: e.label || e.value,
|
|
3929
|
-
fulltext:
|
|
3910
|
+
fulltext: xr(e),
|
|
3930
3911
|
selected: t.includes(e.value)
|
|
3931
3912
|
}));
|
|
3932
3913
|
}
|
|
3933
|
-
function
|
|
3934
|
-
let { id: r = "", label: i, value: s, defaultValue: l, options: d, defaultOptions: h, multiple: g = oe.multiple, maxlength: _, typeahead: v = oe.typeahead, includeSearch: y = oe.includeSearch, allowUserInput: b = oe.allowUserInput, displayValueAs: x = oe.displayValueAs, tagPlacement: S, searchPlaceholder: C, placeholder: w, disabled: T = oe.disabled, required: E = oe.required, fullwidth: D = oe.fullwidth, hasError: O = oe.hasError, errorMessage: k, helptext: A, helptextDropdown: j, helptextDropdownButton: M, optionalTag: N = oe.optionalTag, optionalText: P, requiredTag: ee = oe.requiredTag, requiredText: te, tagText: F, useWrapper: I = oe.useWrapper, inline: ne = oe.inline, counter: re, inputSize: ie = oe.inputSize, name: ae, form: L, ariaDescribedby: R, className: z, onChange: se, onValueChange: B, children: V, strings: H } = t, ce = `${r}-input`, le = `${r}-listbox`, U = v || b, W = p(null), G = p(null), K = p(null), q = p(null), J = p(null), ue =
|
|
3914
|
+
function Gr(t, n) {
|
|
3915
|
+
let { id: r = "", label: i, value: s, defaultValue: l, options: d, defaultOptions: h, multiple: g = oe.multiple, maxlength: _, typeahead: v = oe.typeahead, includeSearch: y = oe.includeSearch, allowUserInput: b = oe.allowUserInput, displayValueAs: x = oe.displayValueAs, tagPlacement: S, searchPlaceholder: C, placeholder: w, disabled: T = oe.disabled, required: E = oe.required, fullwidth: D = oe.fullwidth, hasError: O = oe.hasError, errorMessage: k, helptext: A, helptextDropdown: j, helptextDropdownButton: M, optionalTag: N = oe.optionalTag, optionalText: P, requiredTag: ee = oe.requiredTag, requiredText: te, tagText: F, useWrapper: I = oe.useWrapper, inline: ne = oe.inline, counter: re, inputSize: ie = oe.inputSize, name: ae, form: L, ariaDescribedby: R, className: z, onChange: se, onValueChange: B, children: V, strings: H } = t, ce = `${r}-input`, le = `${r}-listbox`, U = v || b, W = p(null), G = p(null), K = p(null), q = p(null), J = p(null), ue = Ur(J, L), de = o(() => {
|
|
3935
3916
|
U ? W.current?.focus() : K.current?.focus();
|
|
3936
3917
|
}, [U]), fe = o(() => {
|
|
3937
3918
|
Le(!0);
|
|
@@ -3952,27 +3933,27 @@ function Kr(t, n) {
|
|
|
3952
3933
|
}), t;
|
|
3953
3934
|
}, [V]), me = f(() => h && h.length > 0 ? h.map((e) => ({
|
|
3954
3935
|
...e,
|
|
3955
|
-
fulltext:
|
|
3936
|
+
fulltext: xr(e)
|
|
3956
3937
|
})) : d && d.length > 0 ? d.map((e) => ({
|
|
3957
3938
|
...e,
|
|
3958
|
-
fulltext:
|
|
3939
|
+
fulltext: xr(e)
|
|
3959
3940
|
})) : Y.length > 0 ? Y.map((e) => ({
|
|
3960
3941
|
...e,
|
|
3961
|
-
fulltext:
|
|
3942
|
+
fulltext: xr(e)
|
|
3962
3943
|
})) : [], [
|
|
3963
3944
|
h,
|
|
3964
3945
|
d,
|
|
3965
3946
|
Y
|
|
3966
3947
|
]), he = s !== void 0, [ge, _e] = m(() => {
|
|
3967
|
-
let e =
|
|
3948
|
+
let e = Er(s ?? l, g), t = me.filter((t) => t.selected && !e.includes(t.value)).map((e) => e.value);
|
|
3968
3949
|
return t.length ? g ? [...e, ...t] : e.length ? e : [t[0]] : e;
|
|
3969
3950
|
}), X = p(ge), [ve, ye] = m(s);
|
|
3970
|
-
he && s !== ve && (ye(s), _e(
|
|
3971
|
-
let Z = he ?
|
|
3951
|
+
he && s !== ve && (ye(s), _e(Er(s, g)));
|
|
3952
|
+
let Z = he ? Er(s, g) : ge, [be, xe] = m([]), Q = f(() => Wr([...be.filter((e) => !me.some((t) => t.value === e.value)), ...me], Z), [
|
|
3972
3953
|
me,
|
|
3973
3954
|
be,
|
|
3974
3955
|
Z
|
|
3975
|
-
]), [Se, Ce] = m(!1), [we, Te] = m(""), [Ee, De] = m(""), [Oe, Ae] = m(""), [je, Me] = m(null), [Ne, $] = m(null), [Pe, Fe] = m(!1), [Ie, Le] = m(!1), Re = p(!1), [ze, Be] = m(!1), [Ve, He] = m(-1), Ue = ke(["combobox"], H), We = Oe ? pe(Ue.combobox[Oe], { value: je ?? "" }) : "", Ge =
|
|
3956
|
+
]), [Se, Ce] = m(!1), [we, Te] = m(""), [Ee, De] = m(""), [Oe, Ae] = m(""), [je, Me] = m(null), [Ne, $] = m(null), [Pe, Fe] = m(!1), [Ie, Le] = m(!1), Re = p(!1), [ze, Be] = m(!1), [Ve, He] = m(-1), Ue = ke(["combobox"], H), We = Oe ? pe(Ue.combobox[Oe], { value: je ?? "" }) : "", Ge = wr(Z.length, _ ?? null), Ke = re ?? (g && _ != null), qe = f(() => we ? v ? Dr(Q, we).filtered : Cr(Q, we) : Q, [
|
|
3976
3957
|
Q,
|
|
3977
3958
|
we,
|
|
3978
3959
|
v
|
|
@@ -3986,7 +3967,7 @@ function Kr(t, n) {
|
|
|
3986
3967
|
G.current && (G.current.value = Xe);
|
|
3987
3968
|
}, [Xe]), c(() => {
|
|
3988
3969
|
if (Se || !W.current) return;
|
|
3989
|
-
let e = !g && Z[0] ?
|
|
3970
|
+
let e = !g && Z[0] ? jr(Z[0], Q, x) : "";
|
|
3990
3971
|
W.current.value !== e && (W.current.value = e);
|
|
3991
3972
|
}, [
|
|
3992
3973
|
Z,
|
|
@@ -4003,7 +3984,7 @@ function Kr(t, n) {
|
|
|
4003
3984
|
Ye
|
|
4004
3985
|
]), Qe = o((e) => {
|
|
4005
3986
|
if (!e || Z.includes(e)) return;
|
|
4006
|
-
if (g &&
|
|
3987
|
+
if (g && wr(Z.length, _ ?? null)) {
|
|
4007
3988
|
Ae("maxSelected");
|
|
4008
3989
|
return;
|
|
4009
3990
|
}
|
|
@@ -4017,7 +3998,7 @@ function Kr(t, n) {
|
|
|
4017
3998
|
]), $e = o((e) => {
|
|
4018
3999
|
if (!e) return;
|
|
4019
4000
|
let t = Z.filter((t) => t !== e);
|
|
4020
|
-
|
|
4001
|
+
yr(Q, e)?.userAdded && xe((t) => t.filter((t) => t.value !== e)), Ze(t);
|
|
4021
4002
|
}, [
|
|
4022
4003
|
Z,
|
|
4023
4004
|
Q,
|
|
@@ -4029,7 +4010,7 @@ function Kr(t, n) {
|
|
|
4029
4010
|
let t;
|
|
4030
4011
|
if (!g) t = [e];
|
|
4031
4012
|
else {
|
|
4032
|
-
if (
|
|
4013
|
+
if (yr(Q, e) || wr(Z.length, _ ?? null)) return;
|
|
4033
4014
|
t = [...Z, e];
|
|
4034
4015
|
}
|
|
4035
4016
|
let n = {
|
|
@@ -4049,7 +4030,7 @@ function Kr(t, n) {
|
|
|
4049
4030
|
if ($(null), e && W.current && W.current.type !== "hidden") {
|
|
4050
4031
|
Te(""), De("");
|
|
4051
4032
|
let e = t === void 0 ? Z[0] : t;
|
|
4052
|
-
!g && e ? W.current.value =
|
|
4033
|
+
!g && e ? W.current.value = jr(e, Q, x) : W.current.value = "", g || (Be(!1), Ae(""));
|
|
4053
4034
|
}
|
|
4054
4035
|
}, [
|
|
4055
4036
|
g,
|
|
@@ -4059,8 +4040,8 @@ function Kr(t, n) {
|
|
|
4059
4040
|
]), rt = o((e) => {
|
|
4060
4041
|
if (T) return;
|
|
4061
4042
|
Ae(""), $(null);
|
|
4062
|
-
let t =
|
|
4063
|
-
i || (!r && b && !a ? (tt(e), d = "valueAdded", l = s, o && (m = e || "")) : !r && !b ? (o && Z[0] && $e(Z[0]), u = !1, l = !0, d = "noResults") : n ? ($e(t), l = !0, m = "", o && U && W.current && W.current.type !== "hidden" && (W.current.value = "")) : a && o ? (et(), l = !0, m = "") : o ? (Z[0] && $e(Z[0]), Qe(t), l = !1, m = t || "", d = "valueSelected", f = U ?
|
|
4043
|
+
let t = yr(Q, e)?.value || null, n = Z.includes(e || t || ""), r = !!t, i = Q.find((t) => t.value === e)?.disabled || !1, a = !e?.trim(), o = !g, s = g, c = wr(Z.length, _ ?? null), l = !1, u = !0, d = "", f = null, p = "", m;
|
|
4044
|
+
i || (!r && b && !a ? (tt(e), d = "valueAdded", l = s, o && (m = e || "")) : !r && !b ? (o && Z[0] && $e(Z[0]), u = !1, l = !0, d = "noResults") : n ? ($e(t), l = !0, m = "", o && U && W.current && W.current.type !== "hidden" && (W.current.value = "")) : a && o ? (et(), l = !0, m = "") : o ? (Z[0] && $e(Z[0]), Qe(t), l = !1, m = t || "", d = "valueSelected", f = U ? jr(t || "", Q, x) : Tr(yr(Q, t), x)) : s && !c ? (Qe(t), l = !0) : s && c ? (d = "maxSelected", u = !1, p = e || "") : (o && et(), d = "noValidValue", u = !1, l = !0, p = e || "", m = ""), Ce(l), Te(p), nt(u, m), Ae(d), Me(f), l || window.setTimeout(() => {
|
|
4064
4045
|
fe();
|
|
4065
4046
|
}, 0));
|
|
4066
4047
|
}, [
|
|
@@ -4084,11 +4065,11 @@ function Kr(t, n) {
|
|
|
4084
4065
|
if (!g) {
|
|
4085
4066
|
if (!e) Z[0] && $e(Z[0]), t = void 0;
|
|
4086
4067
|
else {
|
|
4087
|
-
let n =
|
|
4068
|
+
let n = yr(Q, e);
|
|
4088
4069
|
n && n.value !== Z[0] ? (Z[0] && $e(Z[0]), Qe(n.value), t = n.value) : !n && b && (Z[0] && $e(Z[0]), tt(e), t = e);
|
|
4089
4070
|
}
|
|
4090
4071
|
} else if (e !== "") {
|
|
4091
|
-
let { action: t, value: n } =
|
|
4072
|
+
let { action: t, value: n } = Ar(e, Z, Q, b, g);
|
|
4092
4073
|
switch (t) {
|
|
4093
4074
|
case "addUserValue":
|
|
4094
4075
|
tt(n);
|
|
@@ -4099,7 +4080,7 @@ function Kr(t, n) {
|
|
|
4099
4080
|
case "removeValue": $e(n);
|
|
4100
4081
|
}
|
|
4101
4082
|
}
|
|
4102
|
-
!g && t ? W.current.value =
|
|
4083
|
+
!g && t ? W.current.value = jr(t, Q, x) : W.current.value = "";
|
|
4103
4084
|
}
|
|
4104
4085
|
Ce(!1), Be(!1);
|
|
4105
4086
|
}, [
|
|
@@ -4116,7 +4097,7 @@ function Kr(t, n) {
|
|
|
4116
4097
|
$(null), Ae(""), !g && Z[0] && $e(Z[0]);
|
|
4117
4098
|
return;
|
|
4118
4099
|
}
|
|
4119
|
-
let t =
|
|
4100
|
+
let t = Or(e, Z, Q, b);
|
|
4120
4101
|
$(t.addValueText), Ae(t.userInfoMessage);
|
|
4121
4102
|
}, [
|
|
4122
4103
|
Z,
|
|
@@ -4128,7 +4109,7 @@ function Kr(t, n) {
|
|
|
4128
4109
|
if (T) return;
|
|
4129
4110
|
let t = e.target.value;
|
|
4130
4111
|
if (De(t), Te(t), at(t), v && t) {
|
|
4131
|
-
let { suggestion: n } =
|
|
4112
|
+
let { suggestion: n } = Dr(Q, t);
|
|
4132
4113
|
n?.label && W.current && !e.nativeEvent.inputType?.includes("deleteContent") && (W.current.value = n.label, window.setTimeout(() => W.current?.setSelectionRange(t.length, n.label.length), 0));
|
|
4133
4114
|
}
|
|
4134
4115
|
}, [
|
|
@@ -4150,7 +4131,7 @@ function Kr(t, n) {
|
|
|
4150
4131
|
e.preventDefault(), He(Z.length - 1);
|
|
4151
4132
|
return;
|
|
4152
4133
|
}
|
|
4153
|
-
let t =
|
|
4134
|
+
let t = kr(e.key, e.shiftKey, g);
|
|
4154
4135
|
if (t && !(e.key === "Tab" && !Se)) {
|
|
4155
4136
|
if (t === "focusListbox" && e.key === "Tab" && !q.current?.querySelector("[role=\"option\"]:not([data-disabled]), [data-type=\"new-option\"]")) {
|
|
4156
4137
|
it();
|
|
@@ -4167,7 +4148,7 @@ function Kr(t, n) {
|
|
|
4167
4148
|
break;
|
|
4168
4149
|
}
|
|
4169
4150
|
case "focusListbox":
|
|
4170
|
-
q.current && (Se || Ce(!0),
|
|
4151
|
+
q.current && (Se || Ce(!0), Lr(q.current, {
|
|
4171
4152
|
disabled: T,
|
|
4172
4153
|
allowUserInput: b,
|
|
4173
4154
|
customUserInput: Ne,
|
|
@@ -4195,7 +4176,7 @@ function Kr(t, n) {
|
|
|
4195
4176
|
Re.current = !1, Fe(!0);
|
|
4196
4177
|
return;
|
|
4197
4178
|
}
|
|
4198
|
-
!g && Z[0] && W.current && W.current.type !== "hidden" && (Be(!0), W.current.value =
|
|
4179
|
+
!g && Z[0] && W.current && W.current.type !== "hidden" && (Be(!0), W.current.value = jr(Z[0], Q, x)), Fe(!0), Te(""), Ce(!0);
|
|
4199
4180
|
}
|
|
4200
4181
|
}, [
|
|
4201
4182
|
T,
|
|
@@ -4222,7 +4203,7 @@ function Kr(t, n) {
|
|
|
4222
4203
|
else {
|
|
4223
4204
|
e.stopPropagation(), e.preventDefault();
|
|
4224
4205
|
let t = !Se;
|
|
4225
|
-
Ce(t), t && q.current &&
|
|
4206
|
+
Ce(t), t && q.current && Lr(q.current, {
|
|
4226
4207
|
disabled: T,
|
|
4227
4208
|
allowUserInput: b,
|
|
4228
4209
|
customUserInput: Ne,
|
|
@@ -4245,7 +4226,7 @@ function Kr(t, n) {
|
|
|
4245
4226
|
case "ArrowDown":
|
|
4246
4227
|
case "ArrowUp":
|
|
4247
4228
|
e.preventDefault(), Se ? Ce(!1) : (Ce(!0), q.current && window.setTimeout(() => {
|
|
4248
|
-
q.current &&
|
|
4229
|
+
q.current && Lr(q.current, {
|
|
4249
4230
|
disabled: T,
|
|
4250
4231
|
allowUserInput: b && !Ge,
|
|
4251
4232
|
customUserInput: Ne,
|
|
@@ -4259,7 +4240,7 @@ function Kr(t, n) {
|
|
|
4259
4240
|
case "Home":
|
|
4260
4241
|
case "End":
|
|
4261
4242
|
e.preventDefault(), Se || Ce(!0), q.current && window.setTimeout(() => {
|
|
4262
|
-
q.current &&
|
|
4243
|
+
q.current && Lr(q.current, {
|
|
4263
4244
|
disabled: T,
|
|
4264
4245
|
allowUserInput: b && !Ge,
|
|
4265
4246
|
customUserInput: Ne,
|
|
@@ -4296,10 +4277,10 @@ function Kr(t, n) {
|
|
|
4296
4277
|
e.preventDefault(), rt(t);
|
|
4297
4278
|
break;
|
|
4298
4279
|
case "ArrowDown":
|
|
4299
|
-
e.preventDefault(),
|
|
4280
|
+
e.preventDefault(), Pr(e.currentTarget);
|
|
4300
4281
|
break;
|
|
4301
4282
|
case "ArrowUp":
|
|
4302
|
-
e.preventDefault(), q.current &&
|
|
4283
|
+
e.preventDefault(), q.current && Fr(e.currentTarget, q.current, y);
|
|
4303
4284
|
break;
|
|
4304
4285
|
case "Escape":
|
|
4305
4286
|
e.preventDefault(), Ce(!1), U && (Re.current = !0), de();
|
|
@@ -4364,10 +4345,10 @@ function Kr(t, n) {
|
|
|
4364
4345
|
e.preventDefault(), rt(e.currentTarget.dataset.value || "");
|
|
4365
4346
|
break;
|
|
4366
4347
|
case "ArrowDown":
|
|
4367
|
-
e.preventDefault(), q.current &&
|
|
4348
|
+
e.preventDefault(), q.current && Ir(q.current);
|
|
4368
4349
|
break;
|
|
4369
4350
|
case "ArrowUp":
|
|
4370
|
-
e.preventDefault(), q.current &&
|
|
4351
|
+
e.preventDefault(), q.current && Fr(e.currentTarget, q.current, y);
|
|
4371
4352
|
break;
|
|
4372
4353
|
case "Escape": e.preventDefault(), Ce(!1), U && (Re.current = !0), de();
|
|
4373
4354
|
}
|
|
@@ -4489,8 +4470,8 @@ function Kr(t, n) {
|
|
|
4489
4470
|
}
|
|
4490
4471
|
//#endregion
|
|
4491
4472
|
//#region src/components/combobox/Combobox.tsx
|
|
4492
|
-
var
|
|
4493
|
-
let n =
|
|
4473
|
+
var Kr = i((e, t) => {
|
|
4474
|
+
let n = Gr(e, t), r = [
|
|
4494
4475
|
"pkt-combobox-component",
|
|
4495
4476
|
n.fullwidth && "pkt-combobox-component--fullwidth",
|
|
4496
4477
|
n.className
|
|
@@ -4499,7 +4480,7 @@ var qr = i((e, t) => {
|
|
|
4499
4480
|
className: r,
|
|
4500
4481
|
ref: n.wrapperRef,
|
|
4501
4482
|
id: n.id || void 0,
|
|
4502
|
-
children: [/* @__PURE__ */ v(
|
|
4483
|
+
children: [/* @__PURE__ */ v(_r, {
|
|
4503
4484
|
strings: n.strings,
|
|
4504
4485
|
forId: a,
|
|
4505
4486
|
hasFieldset: e.hasFieldset ?? !i,
|
|
@@ -4525,8 +4506,8 @@ var qr = i((e, t) => {
|
|
|
4525
4506
|
children: [/* @__PURE__ */ v("div", {
|
|
4526
4507
|
className: "pkt-combobox",
|
|
4527
4508
|
onBlur: n.handleFocusOut,
|
|
4528
|
-
children: [/* @__PURE__ */ _(
|
|
4529
|
-
}), n.tagPlacement === "outside" && n.multiple && /* @__PURE__ */ _(
|
|
4509
|
+
children: [/* @__PURE__ */ _(Br, { state: n }), /* @__PURE__ */ _(Vr, { state: n })]
|
|
4510
|
+
}), n.tagPlacement === "outside" && n.multiple && /* @__PURE__ */ _(Rr, {
|
|
4530
4511
|
state: n,
|
|
4531
4512
|
outside: !0
|
|
4532
4513
|
})]
|
|
@@ -4542,10 +4523,10 @@ var qr = i((e, t) => {
|
|
|
4542
4523
|
})]
|
|
4543
4524
|
});
|
|
4544
4525
|
});
|
|
4545
|
-
|
|
4526
|
+
Kr.displayName = "PktCombobox";
|
|
4546
4527
|
//#endregion
|
|
4547
4528
|
//#region src/components/consent/Consent.tsx
|
|
4548
|
-
var
|
|
4529
|
+
var qr = null, Jr = () => qr || (qr = new Promise((e, t) => {
|
|
4549
4530
|
if (document.querySelector("#oslo-consent-script")) {
|
|
4550
4531
|
e();
|
|
4551
4532
|
return;
|
|
@@ -4554,14 +4535,14 @@ var Jr = null, Yr = () => Jr || (Jr = new Promise((e, t) => {
|
|
|
4554
4535
|
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);
|
|
4555
4536
|
let r = document.createElement("link");
|
|
4556
4537
|
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);
|
|
4557
|
-
}),
|
|
4538
|
+
}), qr), Yr = (e) => {
|
|
4558
4539
|
if (typeof e != "string") return e;
|
|
4559
4540
|
try {
|
|
4560
4541
|
return JSON.parse(e);
|
|
4561
4542
|
} catch {
|
|
4562
4543
|
return e;
|
|
4563
4544
|
}
|
|
4564
|
-
},
|
|
4545
|
+
}, Xr = (e) => Yr(e.value).items.reduce((e, t) => (e[t.name] = t.consent, e), {}), Zr = i(function({ devMode: e = I.devMode, cookieDomain: t = null, cookieSecure: n = null, cookieExpiryDays: r = null, hotjarId: i = null, googleAnalyticsId: a = null, i18nLanguage: o = I.i18nLanguage, triggerType: s = I.triggerType, triggerText: l, onToggleConsent: u, ...d }, f) {
|
|
4565
4546
|
let m = p(u);
|
|
4566
4547
|
m.current = u;
|
|
4567
4548
|
let h = p({
|
|
@@ -4587,7 +4568,7 @@ var Jr = null, Yr = () => Jr || (Jr = new Promise((e, t) => {
|
|
|
4587
4568
|
let i = (e) => {
|
|
4588
4569
|
let t = m.current;
|
|
4589
4570
|
t && t(new CustomEvent("toggle-consent", {
|
|
4590
|
-
detail:
|
|
4571
|
+
detail: Xr(e),
|
|
4591
4572
|
bubbles: !0,
|
|
4592
4573
|
cancelable: !1
|
|
4593
4574
|
}));
|
|
@@ -4605,7 +4586,7 @@ var Jr = null, Yr = () => Jr || (Jr = new Promise((e, t) => {
|
|
|
4605
4586
|
e || i({ value: s });
|
|
4606
4587
|
}, 0), t && a.off("CookieManager.setCookie", t), t = (e) => i(e), a.on("CookieManager.setCookie", t);
|
|
4607
4588
|
});
|
|
4608
|
-
},
|
|
4589
|
+
}, Jr().then(() => {
|
|
4609
4590
|
e || g.current();
|
|
4610
4591
|
}), () => {
|
|
4611
4592
|
e = !0, window.clearTimeout(n), t && window.__cookieEvents?.off("CookieManager.setCookie", t);
|
|
@@ -4645,13 +4626,13 @@ var Jr = null, Yr = () => Jr || (Jr = new Promise((e, t) => {
|
|
|
4645
4626
|
children: y
|
|
4646
4627
|
});
|
|
4647
4628
|
});
|
|
4648
|
-
|
|
4629
|
+
Zr.displayName = "PktConsent";
|
|
4649
4630
|
//#endregion
|
|
4650
4631
|
//#region ../../shared-utils/device-utils.ts
|
|
4651
|
-
var
|
|
4632
|
+
var Qr = () => {
|
|
4652
4633
|
let e = navigator.userAgent;
|
|
4653
4634
|
return !!(/iP(hone|od|ad)/.test(e) || /Macintosh/.test(e) && "ontouchend" in document);
|
|
4654
|
-
},
|
|
4635
|
+
}, $r = () => Qr() ? "text" : "date", ei = (e) => !e || e.length !== 2 || En(e[0], e[1]), ti = (e, t, n, r, i, a, o = "medium") => ({
|
|
4655
4636
|
"pkt-input": !0,
|
|
4656
4637
|
"pkt-datepicker__input": !0,
|
|
4657
4638
|
[`pkt-input--${o}`]: !0,
|
|
@@ -4660,27 +4641,27 @@ var $r = () => {
|
|
|
4660
4641
|
"pkt-datepicker--multiple": n,
|
|
4661
4642
|
"pkt-datepicker--range": r,
|
|
4662
4643
|
"ios-readonly-hack": i === !1 && a === "text"
|
|
4663
|
-
}),
|
|
4644
|
+
}), ni = (e = "medium") => ({
|
|
4664
4645
|
"pkt-input-icon": !0,
|
|
4665
4646
|
"pkt-btn": !0,
|
|
4666
4647
|
"pkt-btn--icon-only": !0,
|
|
4667
4648
|
"pkt-btn--tertiary": !0,
|
|
4668
4649
|
[`pkt-btn--${e}`]: !0,
|
|
4669
4650
|
"pkt-datepicker__calendar-button": !0
|
|
4670
|
-
}),
|
|
4651
|
+
}), ri = (e) => ({
|
|
4671
4652
|
"pkt-input-prefix": e,
|
|
4672
4653
|
"pkt-hide": !e
|
|
4673
|
-
}),
|
|
4654
|
+
}), ii = (e, t, n) => !t && !n ? Array.isArray(e) ? e[0] || "" : e : Array.isArray(e) ? e.join(",") : e, ai = (e, t, n = !1) => {
|
|
4674
4655
|
if (!e || !t) return;
|
|
4675
4656
|
let r = t.parentElement?.getBoundingClientRect() || t.getBoundingClientRect(), i = n ? r.height + 30 : r.height, a = e.getBoundingClientRect().height, o = n ? "calc(100% - 30px)" : "100%";
|
|
4676
4657
|
r && typeof window < "u" && r.top + a > window.innerHeight && r.top - a > 0 && (o = `calc(100% - ${i}px - ${a}px)`), e.style.top = o;
|
|
4677
|
-
},
|
|
4658
|
+
}, oi = (e, t, n, r, i, a) => {
|
|
4678
4659
|
let { key: o } = e;
|
|
4679
4660
|
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());
|
|
4680
|
-
},
|
|
4661
|
+
}, si = ({ 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 }) => {
|
|
4681
4662
|
let b = p(null), x = p(!1);
|
|
4682
4663
|
e && (x.current = !0), c(() => {
|
|
4683
|
-
e &&
|
|
4664
|
+
e && ai(b.current, h?.current ?? null, g);
|
|
4684
4665
|
}, [
|
|
4685
4666
|
e,
|
|
4686
4667
|
h,
|
|
@@ -4692,7 +4673,7 @@ var $r = () => {
|
|
|
4692
4673
|
className: S,
|
|
4693
4674
|
hidden: !e,
|
|
4694
4675
|
"aria-hidden": !e,
|
|
4695
|
-
children: C && /* @__PURE__ */ _(
|
|
4676
|
+
children: C && /* @__PURE__ */ _(Xn, {
|
|
4696
4677
|
multiple: t,
|
|
4697
4678
|
range: n,
|
|
4698
4679
|
weeknumbers: r,
|
|
@@ -4709,14 +4690,14 @@ var $r = () => {
|
|
|
4709
4690
|
onClose: y
|
|
4710
4691
|
})
|
|
4711
4692
|
});
|
|
4712
|
-
},
|
|
4693
|
+
}, ci = ({ dates: e, dateformat: t, idBase: n, strings: r, onDateRemoved: i }) => {
|
|
4713
4694
|
let a = Tn(e), o = ke(["datepicker"], r).datepicker.deleteDate;
|
|
4714
4695
|
return /* @__PURE__ */ _("div", {
|
|
4715
4696
|
className: "pkt-date-tags pkt-datepicker__tags",
|
|
4716
4697
|
"aria-live": "polite",
|
|
4717
4698
|
children: a.map((e) => {
|
|
4718
4699
|
let r = pn(e, t);
|
|
4719
|
-
return /* @__PURE__ */ _(
|
|
4700
|
+
return /* @__PURE__ */ _(er, {
|
|
4720
4701
|
id: `${n}${e}-tag`,
|
|
4721
4702
|
closeTag: !0,
|
|
4722
4703
|
ariaLabel: `${o} ${r}`,
|
|
@@ -4728,7 +4709,7 @@ var $r = () => {
|
|
|
4728
4709
|
}, e);
|
|
4729
4710
|
})
|
|
4730
4711
|
});
|
|
4731
|
-
},
|
|
4712
|
+
}, li = ({ state: e }) => {
|
|
4732
4713
|
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, inputToRef: A, btnRef: j, toggleCalendar: M, handleFocus: N, handleSingleInputChange: P, handleRangeFromChange: ee, handleRangeToChange: te, handleRangeBlur: F, handleMultipleBlur: I, handleTagRemoved: ne, handleSingleKeydown: re, handleRangeFromKeydown: ie, handleRangeToKeydown: ae, handleMultipleKeydown: oe, restProps: L } = e, R = (e) => {
|
|
4733
4714
|
e.preventDefault(), M();
|
|
4734
4715
|
}, z = (e) => {
|
|
@@ -4744,7 +4725,7 @@ var $r = () => {
|
|
|
4744
4725
|
children: C.datepicker.openPicker
|
|
4745
4726
|
})]
|
|
4746
4727
|
});
|
|
4747
|
-
return a ? /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _(
|
|
4728
|
+
return a ? /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _(ci, {
|
|
4748
4729
|
dates: r,
|
|
4749
4730
|
dateformat: i,
|
|
4750
4731
|
idBase: t,
|
|
@@ -4870,7 +4851,7 @@ var $r = () => {
|
|
|
4870
4851
|
}), se()]
|
|
4871
4852
|
})
|
|
4872
4853
|
});
|
|
4873
|
-
},
|
|
4854
|
+
}, ui = (e) => {
|
|
4874
4855
|
if (!e) return [];
|
|
4875
4856
|
if (Array.isArray(e)) return e.filter(Boolean);
|
|
4876
4857
|
if (typeof e == "string" && e.trimStart().startsWith("[")) try {
|
|
@@ -4881,17 +4862,17 @@ var $r = () => {
|
|
|
4881
4862
|
};
|
|
4882
4863
|
//#endregion
|
|
4883
4864
|
//#region src/components/datepicker/useDatepickerState.ts
|
|
4884
|
-
function
|
|
4885
|
-
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: F = !1, requiredText: I, tagText: ne, useWrapper: re = !0, strings: ie, disabled: ae = !1, readOnly: oe = !1, required: L = !1, name: R, min: z, max: se, placeholder: B, onChange: V, onValueChange: H, className: ce, ...le } = e, U = o((e) => e === void 0 ? [] :
|
|
4865
|
+
function di(e, t) {
|
|
4866
|
+
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: F = !1, requiredText: I, tagText: ne, useWrapper: re = !0, strings: ie, disabled: ae = !1, readOnly: oe = !1, required: L = !1, name: R, min: z, max: se, placeholder: B, onChange: V, onValueChange: H, className: ce, ...le } = e, U = o((e) => e === void 0 ? [] : ui(e), []), W = i !== void 0, G = typeof a == "number" ? void 0 : a, [K, q] = m(() => U(i ?? G)), J = W ? U(i) : K, ue = p(K), [de, fe] = m(i);
|
|
4886
4867
|
W && i !== de && (fe(i), q(U(i)));
|
|
4887
4868
|
let [pe, Y] = m(C ?? !1), [me, he] = m(C);
|
|
4888
4869
|
C !== me && (he(C), C !== void 0 && Y(C));
|
|
4889
|
-
let ge = p(null), _e = p(null), X = p(null), ve = p(null), ye = p(null), Z = f(() =>
|
|
4870
|
+
let ge = p(null), _e = p(null), X = p(null), ve = p(null), ye = p(null), Z = f(() => $r(), []), be = f(() => Qr(), []), xe = ke([
|
|
4890
4871
|
"generic",
|
|
4891
4872
|
"datepicker",
|
|
4892
4873
|
"validation"
|
|
4893
4874
|
], ie), Q = ie, Se = typeof z == "string" ? z : z === void 0 ? void 0 : String(z), Ce = typeof se == "string" ? se : se === void 0 ? void 0 : String(se), we = f(() => {
|
|
4894
|
-
let e =
|
|
4875
|
+
let e = ti(T, g, l, h, oe, Z, E);
|
|
4895
4876
|
return Object.entries(e).filter(([, e]) => e).map(([e]) => e).join(" ");
|
|
4896
4877
|
}, [
|
|
4897
4878
|
T,
|
|
@@ -4901,8 +4882,8 @@ function fi(e, t) {
|
|
|
4901
4882
|
oe,
|
|
4902
4883
|
Z,
|
|
4903
4884
|
E
|
|
4904
|
-
]), Te = Object.entries(
|
|
4905
|
-
let e =
|
|
4885
|
+
]), Te = Object.entries(ni(E)).filter(([, e]) => e).map(([e]) => e).join(" "), Ee = f(() => {
|
|
4886
|
+
let e = ri(g);
|
|
4906
4887
|
return Object.entries(e).filter(([, e]) => e).map(([e]) => e).join(" ");
|
|
4907
4888
|
}, [g]), De = f(() => ["pkt-datepicker__inputs", h && "pkt-input__range-inputs"].filter(Boolean).join(" "), [h, g]), Oe = f(() => {
|
|
4908
4889
|
if (x) return x;
|
|
@@ -4939,7 +4920,7 @@ function fi(e, t) {
|
|
|
4939
4920
|
let Re = o(() => {
|
|
4940
4921
|
be && !pe && Y(!0);
|
|
4941
4922
|
}, [be, pe]), ze = o((e) => {
|
|
4942
|
-
let t =
|
|
4923
|
+
let t = ui(ii(e, l, h));
|
|
4943
4924
|
$(t), Fe(t), !l && !h && (Le(), ge.current?.focus());
|
|
4944
4925
|
}, [
|
|
4945
4926
|
l,
|
|
@@ -4967,7 +4948,7 @@ function fi(e, t) {
|
|
|
4967
4948
|
$,
|
|
4968
4949
|
Fe
|
|
4969
4950
|
]), We = o(() => {
|
|
4970
|
-
J.length === 2 && !
|
|
4951
|
+
J.length === 2 && !ei(J) && ($([J[0]]), Fe([J[0]]));
|
|
4971
4952
|
}, [
|
|
4972
4953
|
J,
|
|
4973
4954
|
$,
|
|
@@ -5003,13 +4984,13 @@ function fi(e, t) {
|
|
|
5003
4984
|
let t = e?.closest("form");
|
|
5004
4985
|
t ? t.requestSubmit() : e?.blur();
|
|
5005
4986
|
}, []), Xe = o((e) => {
|
|
5006
|
-
|
|
4987
|
+
oi(e.nativeEvent, () => Ie(), () => Ye(ge.current), void 0, () => ge.current?.blur());
|
|
5007
4988
|
}, [Ie, Ye]), Ze = o((e) => {
|
|
5008
|
-
|
|
4989
|
+
oi(e.nativeEvent, () => Ie(), () => Ye(ge.current), () => _e.current?.focus(), () => ge.current?.blur());
|
|
5009
4990
|
}, [Ie, Ye]), Qe = o((e) => {
|
|
5010
|
-
|
|
4991
|
+
oi(e.nativeEvent, () => Ie(), () => Ye(_e.current), void 0, () => _e.current?.blur());
|
|
5011
4992
|
}, [Ie, Ye]), $e = o((e) => {
|
|
5012
|
-
|
|
4993
|
+
oi(e.nativeEvent, () => Ie(), () => Ye(ge.current), void 0, () => ge.current?.blur(), qe);
|
|
5013
4994
|
}, [
|
|
5014
4995
|
Ie,
|
|
5015
4996
|
Ye,
|
|
@@ -5116,8 +5097,8 @@ function fi(e, t) {
|
|
|
5116
5097
|
}
|
|
5117
5098
|
//#endregion
|
|
5118
5099
|
//#region src/components/datepicker/Datepicker.tsx
|
|
5119
|
-
var
|
|
5120
|
-
let n =
|
|
5100
|
+
var fi = i((e, t) => {
|
|
5101
|
+
let n = di(e, t), r = [
|
|
5121
5102
|
"pkt-datepicker",
|
|
5122
5103
|
`pkt-datepicker--${n.inputSize}`,
|
|
5123
5104
|
n.fullwidth ? "pkt-datepicker--fullwidth" : "",
|
|
@@ -5127,7 +5108,7 @@ var pi = i((e, t) => {
|
|
|
5127
5108
|
className: r,
|
|
5128
5109
|
id: n.id || void 0,
|
|
5129
5110
|
children: [
|
|
5130
|
-
/* @__PURE__ */ _(
|
|
5111
|
+
/* @__PURE__ */ _(_r, {
|
|
5131
5112
|
strings: n.stringsOverride,
|
|
5132
5113
|
ref: n.wrapperRef,
|
|
5133
5114
|
ariaDescribedby: e.ariaDescribedby,
|
|
@@ -5151,9 +5132,9 @@ var pi = i((e, t) => {
|
|
|
5151
5132
|
counter: n.hasCounter,
|
|
5152
5133
|
counterCurrent: n.values.length,
|
|
5153
5134
|
counterMaxLength: n.maxlength,
|
|
5154
|
-
children: /* @__PURE__ */ _(
|
|
5135
|
+
children: /* @__PURE__ */ _(li, { state: n })
|
|
5155
5136
|
}),
|
|
5156
|
-
/* @__PURE__ */ _(
|
|
5137
|
+
/* @__PURE__ */ _(si, {
|
|
5157
5138
|
open: n.calendarOpen,
|
|
5158
5139
|
multiple: n.multiple,
|
|
5159
5140
|
range: n.range,
|
|
@@ -5184,10 +5165,10 @@ var pi = i((e, t) => {
|
|
|
5184
5165
|
]
|
|
5185
5166
|
});
|
|
5186
5167
|
});
|
|
5187
|
-
|
|
5168
|
+
fi.displayName = "PktDatepicker";
|
|
5188
5169
|
//#endregion
|
|
5189
5170
|
//#region ../../shared-utils/fileupload/size.ts
|
|
5190
|
-
function
|
|
5171
|
+
function pi(e) {
|
|
5191
5172
|
if (e == null || e === "") return;
|
|
5192
5173
|
if (typeof e == "number") return Number.isFinite(e) && e > 0 ? e : void 0;
|
|
5193
5174
|
let t = String(e).trim(), n = Number(t);
|
|
@@ -5206,15 +5187,15 @@ function mi(e) {
|
|
|
5206
5187
|
default: return;
|
|
5207
5188
|
}
|
|
5208
5189
|
}
|
|
5209
|
-
function
|
|
5190
|
+
function mi(e) {
|
|
5210
5191
|
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`;
|
|
5211
5192
|
}
|
|
5212
5193
|
//#endregion
|
|
5213
5194
|
//#region ../../shared-utils/fileupload/formats.ts
|
|
5214
|
-
function
|
|
5195
|
+
function hi(e) {
|
|
5215
5196
|
return Array.isArray(e) ? e.map((e) => String(e).trim().toLowerCase()).filter(Boolean) : [];
|
|
5216
5197
|
}
|
|
5217
|
-
function
|
|
5198
|
+
function gi(e, t, n) {
|
|
5218
5199
|
let r = e.toLowerCase().replace(/^\./, "");
|
|
5219
5200
|
if (r.includes("/")) {
|
|
5220
5201
|
if (r.endsWith("/*")) {
|
|
@@ -5225,33 +5206,33 @@ function _i(e, t, n) {
|
|
|
5225
5206
|
}
|
|
5226
5207
|
return t === r;
|
|
5227
5208
|
}
|
|
5228
|
-
function
|
|
5229
|
-
let n =
|
|
5209
|
+
function _i(e, t) {
|
|
5210
|
+
let n = hi(t);
|
|
5230
5211
|
if (n.length === 0) return !0;
|
|
5231
5212
|
let r = e.name.split(".").pop()?.toLowerCase() ?? "", i = e.type.toLowerCase();
|
|
5232
|
-
return n.some((e) =>
|
|
5213
|
+
return n.some((e) => gi(e, r, i));
|
|
5233
5214
|
}
|
|
5234
|
-
function
|
|
5215
|
+
function vi(e, t) {
|
|
5235
5216
|
let n = (e ?? "").trim();
|
|
5236
5217
|
if (n) return n;
|
|
5237
|
-
let r =
|
|
5218
|
+
let r = hi(t);
|
|
5238
5219
|
return r.length === 0 ? "" : r.map((e) => e.includes("/") || e.startsWith(".") ? e : `.${e}`).join(", ");
|
|
5239
5220
|
}
|
|
5240
5221
|
//#endregion
|
|
5241
5222
|
//#region ../../shared-utils/fileupload/validation.ts
|
|
5242
|
-
function
|
|
5223
|
+
function yi(e, t, n) {
|
|
5243
5224
|
return ((e ?? "").trim() || t).replace(/\{(\w+)\}/g, (e, t) => n[t] ?? `{${t}}`);
|
|
5244
5225
|
}
|
|
5245
|
-
function
|
|
5246
|
-
let n =
|
|
5247
|
-
if (n.length > 0 && !
|
|
5226
|
+
function bi(e, t) {
|
|
5227
|
+
let n = hi(t.allowedFormats);
|
|
5228
|
+
if (n.length > 0 && !_i(e, n)) {
|
|
5248
5229
|
let e = n.join(", "), r = de.fileupload.invalidFormat;
|
|
5249
|
-
return
|
|
5230
|
+
return yi(t.formatErrorMessage, r, { formats: e });
|
|
5250
5231
|
}
|
|
5251
|
-
let r =
|
|
5232
|
+
let r = pi(t.maxFileSize);
|
|
5252
5233
|
if (r !== void 0 && e.size > r) {
|
|
5253
|
-
let e =
|
|
5254
|
-
return
|
|
5234
|
+
let e = mi(r), n = de.fileupload.sizeTooLarge;
|
|
5235
|
+
return yi(t.sizeErrorMessage, n, { maxSize: e });
|
|
5255
5236
|
}
|
|
5256
5237
|
if (t.onFileValidation) {
|
|
5257
5238
|
let n = t.onFileValidation(e);
|
|
@@ -5259,7 +5240,7 @@ function xi(e, t) {
|
|
|
5259
5240
|
}
|
|
5260
5241
|
return null;
|
|
5261
5242
|
}
|
|
5262
|
-
function
|
|
5243
|
+
function xi(e) {
|
|
5263
5244
|
let t = e.file;
|
|
5264
5245
|
if (t?.type?.startsWith("image/")) return !0;
|
|
5265
5246
|
let n = e.attributes?.targetFilename || t?.name || "";
|
|
@@ -5267,10 +5248,10 @@ function Si(e) {
|
|
|
5267
5248
|
}
|
|
5268
5249
|
//#endregion
|
|
5269
5250
|
//#region ../../shared-utils/fileupload/transfers.ts
|
|
5270
|
-
function
|
|
5251
|
+
function Si(e) {
|
|
5271
5252
|
return typeof e == "number" ? "in-progress" : e === "error" ? "error" : "idle";
|
|
5272
5253
|
}
|
|
5273
|
-
function
|
|
5254
|
+
function Ci(e, t, n) {
|
|
5274
5255
|
let r = {
|
|
5275
5256
|
"in-progress": 0,
|
|
5276
5257
|
error: 1,
|
|
@@ -5285,11 +5266,11 @@ function wi(e, t, n) {
|
|
|
5285
5266
|
showProgress: r?.showProgress,
|
|
5286
5267
|
lastProgress: r?.lastProgress
|
|
5287
5268
|
};
|
|
5288
|
-
}).sort((e, t) => r[
|
|
5269
|
+
}).sort((e, t) => r[Si(e.progress)] - r[Si(t.progress)]);
|
|
5289
5270
|
}
|
|
5290
5271
|
//#endregion
|
|
5291
5272
|
//#region ../../shared-utils/focus-trap/index.ts
|
|
5292
|
-
function
|
|
5273
|
+
function wi(e) {
|
|
5293
5274
|
if (!e) return [];
|
|
5294
5275
|
let t = [
|
|
5295
5276
|
"a[href]:not([tabindex=\"-1\"])",
|
|
@@ -5301,7 +5282,7 @@ function Ti(e) {
|
|
|
5301
5282
|
].join(", ");
|
|
5302
5283
|
return Array.from(e.querySelectorAll(t)).filter((e) => !e.hasAttribute("inert"));
|
|
5303
5284
|
}
|
|
5304
|
-
var
|
|
5285
|
+
var Ti = [
|
|
5305
5286
|
"a[href]",
|
|
5306
5287
|
"button:not([disabled])",
|
|
5307
5288
|
"input:not([disabled]):not([type=\"hidden\"])",
|
|
@@ -5309,7 +5290,7 @@ var Ei = [
|
|
|
5309
5290
|
"textarea:not([disabled])",
|
|
5310
5291
|
"summary",
|
|
5311
5292
|
"[tabindex]:not([tabindex=\"-1\"])"
|
|
5312
|
-
].join(", "),
|
|
5293
|
+
].join(", "), Ei = (e) => {
|
|
5313
5294
|
if (e.hasAttribute("inert") || e.closest("[inert]") || e.hidden || e.closest("[hidden]")) return !0;
|
|
5314
5295
|
let t = e;
|
|
5315
5296
|
for (; t;) {
|
|
@@ -5322,33 +5303,33 @@ var Ei = [
|
|
|
5322
5303
|
t = n.parentElement;
|
|
5323
5304
|
}
|
|
5324
5305
|
return !1;
|
|
5325
|
-
},
|
|
5326
|
-
e.matches(
|
|
5306
|
+
}, Di = (e, t) => {
|
|
5307
|
+
e.matches(Ti) && !Ei(e) && t.push(e);
|
|
5327
5308
|
let n = e.shadowRoot;
|
|
5328
|
-
if (n) for (let e of Array.from(n.children))
|
|
5329
|
-
for (let n of Array.from(e.children))
|
|
5309
|
+
if (n) for (let e of Array.from(n.children)) Di(e, t);
|
|
5310
|
+
for (let n of Array.from(e.children)) Di(n, t);
|
|
5330
5311
|
};
|
|
5331
|
-
function
|
|
5312
|
+
function Oi(e) {
|
|
5332
5313
|
if (!e) return [];
|
|
5333
5314
|
let t = [];
|
|
5334
|
-
for (let n of Array.from(e.children))
|
|
5315
|
+
for (let n of Array.from(e.children)) Di(n, t);
|
|
5335
5316
|
return t;
|
|
5336
5317
|
}
|
|
5337
|
-
function
|
|
5318
|
+
function ki(e = document) {
|
|
5338
5319
|
let t = e.activeElement;
|
|
5339
5320
|
for (; t?.shadowRoot?.activeElement;) t = t.shadowRoot.activeElement;
|
|
5340
5321
|
return t;
|
|
5341
5322
|
}
|
|
5342
|
-
function
|
|
5323
|
+
function Ai(e, t) {
|
|
5343
5324
|
if (e.key !== "Tab") return !1;
|
|
5344
|
-
let n =
|
|
5325
|
+
let n = wi(t);
|
|
5345
5326
|
if (n.length === 0) return e.preventDefault(), !0;
|
|
5346
5327
|
let r = n[0], i = n[n.length - 1], a = (t?.ownerDocument ?? document).activeElement, o = !!a && n.includes(a);
|
|
5347
5328
|
return e.shiftKey ? !o || a === r ? (e.preventDefault(), i.focus(), !0) : !1 : !o || a === i ? (e.preventDefault(), r.focus(), !0) : !1;
|
|
5348
5329
|
}
|
|
5349
5330
|
//#endregion
|
|
5350
5331
|
//#region ../../shared-utils/fileupload/truncate.ts
|
|
5351
|
-
function
|
|
5332
|
+
function ji(e, t) {
|
|
5352
5333
|
return !t || t <= 0 || e.length <= t + 3 ? null : {
|
|
5353
5334
|
head: e.slice(0, e.length - t),
|
|
5354
5335
|
tail: e.slice(-t)
|
|
@@ -5356,12 +5337,12 @@ function Mi(e, t) {
|
|
|
5356
5337
|
}
|
|
5357
5338
|
//#endregion
|
|
5358
5339
|
//#region ../../shared-utils/fileupload/navigation.ts
|
|
5359
|
-
function
|
|
5340
|
+
function Mi(e, t, n) {
|
|
5360
5341
|
return n <= 0 ? 0 : t === "prev" ? e <= 0 ? n - 1 : e - 1 : e >= n - 1 ? 0 : e + 1;
|
|
5361
5342
|
}
|
|
5362
5343
|
//#endregion
|
|
5363
5344
|
//#region ../../shared-utils/fileupload/announcements.ts
|
|
5364
|
-
function
|
|
5345
|
+
function Ni(e, t) {
|
|
5365
5346
|
let n = e.length;
|
|
5366
5347
|
if (n === 0 || !t || t.length === 0) return {
|
|
5367
5348
|
totalCount: n,
|
|
@@ -5381,23 +5362,23 @@ function Pi(e, t) {
|
|
|
5381
5362
|
}
|
|
5382
5363
|
//#endregion
|
|
5383
5364
|
//#region ../../shared-utils/fileupload/filename.ts
|
|
5384
|
-
var
|
|
5385
|
-
function
|
|
5365
|
+
var Pi = ".jpeg, .jpg, .png, .gif, .webp, .heic";
|
|
5366
|
+
function Fi(e, t = de.fileupload.unknownFilename) {
|
|
5386
5367
|
return e.attributes?.targetFilename || e.file?.name || t;
|
|
5387
5368
|
}
|
|
5388
5369
|
//#endregion
|
|
5389
5370
|
//#region src/utils/stringutils.ts
|
|
5390
|
-
var
|
|
5391
|
-
let e =
|
|
5371
|
+
var Ii = () => ("00000000000000000" + (Math.random() * 0x10000000000000000).toString(16)).slice(-16), Li = () => {
|
|
5372
|
+
let e = Ii(), t = Ii();
|
|
5392
5373
|
return e.slice(0, 8) + "-" + e.slice(8, 12) + "-4" + e.slice(13) + "-a" + t.slice(1, 4) + "-" + t.slice(4);
|
|
5393
|
-
},
|
|
5374
|
+
}, Ri = class {
|
|
5394
5375
|
fileId;
|
|
5395
5376
|
file;
|
|
5396
5377
|
attributes;
|
|
5397
5378
|
constructor(e, t) {
|
|
5398
|
-
this.fileId = t ||
|
|
5379
|
+
this.fileId = t || Li(), this.file = e, this.attributes = { targetFilename: e.name };
|
|
5399
5380
|
}
|
|
5400
|
-
},
|
|
5381
|
+
}, zi = n({}), Bi = 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) => {
|
|
5401
5382
|
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]);
|
|
5402
5383
|
u(x, () => S.current);
|
|
5403
5384
|
let [T, E] = m(!1), D = ke(["fileupload"], y), O = f(() => l ? t ? {
|
|
@@ -5422,14 +5403,14 @@ var Li = () => ("00000000000000000" + (Math.random() * 0x10000000000000000).toSt
|
|
|
5422
5403
|
D
|
|
5423
5404
|
]), k = o((e) => {
|
|
5424
5405
|
if (S.current) try {
|
|
5425
|
-
S.current.files =
|
|
5406
|
+
S.current.files = Vi(e);
|
|
5426
5407
|
} catch {}
|
|
5427
5408
|
}, [S.current, n]);
|
|
5428
5409
|
c(() => {
|
|
5429
5410
|
k(n);
|
|
5430
5411
|
}, [S, n]);
|
|
5431
5412
|
let A = o((e) => {
|
|
5432
|
-
r(e.map((e) => new
|
|
5413
|
+
r(e.map((e) => new Ri(e))), S.current && (S.current.value = "");
|
|
5433
5414
|
}, [r]), j = (e) => {
|
|
5434
5415
|
let t = e.target.files;
|
|
5435
5416
|
if (t.length === 0) {
|
|
@@ -5513,21 +5494,21 @@ var Li = () => ("00000000000000000" + (Math.random() * 0x10000000000000000).toSt
|
|
|
5513
5494
|
})
|
|
5514
5495
|
]
|
|
5515
5496
|
});
|
|
5516
|
-
}),
|
|
5497
|
+
}), Vi = (e) => {
|
|
5517
5498
|
let t = new DataTransfer();
|
|
5518
5499
|
for (let n of e) t.items.add(n.file);
|
|
5519
5500
|
return t.files;
|
|
5520
|
-
},
|
|
5501
|
+
}, Hi = i(({ id: e, ariaDescribedby: t, ariaLabelledby: n, counter: r, hasFieldset: i, counterMaxLength: a, className: o, disabled: s, errorMessage: c, hasError: l = !1, helptext: u, helptextDropdown: d, helptextDropdownButton: f, inline: p, fullwidth: h = !1, label: g, name: v, optionalTag: y = !1, optionalText: b, requiredTag: x = !1, requiredText: S, tagText: C = null, placeholder: w, rows: T, useWrapper: E = !0, onChange: D, value: O, autoComplete: k = "off", minLength: A, maxLength: j, readOnly: M, skipForwardTestid: N = !1, inputSize: P = "medium", strings: ee, ...te }, F) => {
|
|
5521
5502
|
let I = r ?? (a ?? 0) > 0, ne = [
|
|
5522
5503
|
o,
|
|
5523
5504
|
"pkt-textinput",
|
|
5524
5505
|
"pkt-textarea"
|
|
5525
|
-
].filter(Boolean).join(" "), re =
|
|
5506
|
+
].filter(Boolean).join(" "), re = ir(e), ie = `${re}-input`, ae = `${ie}-label`, oe = n || ae, [L, R] = m(0), z = O === void 0 ? L : O?.length || 0, se = (e) => {
|
|
5526
5507
|
I && R(e.currentTarget?.value?.length || 0), D && D(e);
|
|
5527
5508
|
};
|
|
5528
5509
|
return /* @__PURE__ */ _("div", {
|
|
5529
5510
|
className: ne,
|
|
5530
|
-
children: /* @__PURE__ */ _(
|
|
5511
|
+
children: /* @__PURE__ */ _(_r, {
|
|
5531
5512
|
strings: ee,
|
|
5532
5513
|
ariaDescribedby: t,
|
|
5533
5514
|
disabled: s,
|
|
@@ -5563,7 +5544,7 @@ var Li = () => ("00000000000000000" + (Math.random() * 0x10000000000000000).toSt
|
|
|
5563
5544
|
"aria-labelledby": oe,
|
|
5564
5545
|
"aria-invalid": l,
|
|
5565
5546
|
"aria-errormessage": l ? `${re}-error` : void 0,
|
|
5566
|
-
"aria-describedby":
|
|
5547
|
+
"aria-describedby": dr({
|
|
5567
5548
|
id: ie,
|
|
5568
5549
|
hasHelptext: !!u,
|
|
5569
5550
|
hasCounter: I,
|
|
@@ -5581,10 +5562,10 @@ var Li = () => ("00000000000000000" + (Math.random() * 0x10000000000000000).toSt
|
|
|
5581
5562
|
})
|
|
5582
5563
|
});
|
|
5583
5564
|
});
|
|
5584
|
-
|
|
5565
|
+
Hi.displayName = "PktTextarea";
|
|
5585
5566
|
//#endregion
|
|
5586
5567
|
//#region src/components/fileupload/extensions/Comments.tsx
|
|
5587
|
-
var
|
|
5568
|
+
var Ui = "comments", Wi = (e, t) => {
|
|
5588
5569
|
let n = new Date(e);
|
|
5589
5570
|
if (Number.isNaN(n.getTime())) return e;
|
|
5590
5571
|
let r = String(n.getDate()).padStart(2, "0"), i = String(n.getMonth() + 1).padStart(2, "0"), a = n.getFullYear(), o = String(n.getHours()).padStart(2, "0"), s = String(n.getMinutes()).padStart(2, "0");
|
|
@@ -5592,13 +5573,13 @@ var Wi = "comments", Gi = (e, t) => {
|
|
|
5592
5573
|
date: `${r}.${i}.${a}`,
|
|
5593
5574
|
time: `${o}:${s}`
|
|
5594
5575
|
});
|
|
5595
|
-
},
|
|
5596
|
-
let { strings: a } = s(
|
|
5576
|
+
}, Gi = ({ fileItem: e, disabled: t, closeOperationUi: n, onAddComment: r, existingComment: i }) => {
|
|
5577
|
+
let { strings: a } = s(zi), o = p(null), c = !!i;
|
|
5597
5578
|
return d(() => {
|
|
5598
5579
|
let e = setTimeout(() => o.current?.focus({ preventScroll: !0 }), 0);
|
|
5599
5580
|
return () => clearTimeout(e);
|
|
5600
5581
|
}, [e.fileId]), /* @__PURE__ */ v(g, { children: [
|
|
5601
|
-
/* @__PURE__ */ _(
|
|
5582
|
+
/* @__PURE__ */ _(Hi, {
|
|
5602
5583
|
autoFocus: !0,
|
|
5603
5584
|
label: c ? a.editComment : a.addComment,
|
|
5604
5585
|
name: `comment-${e.fileId}`,
|
|
@@ -5631,8 +5612,8 @@ var Wi = "comments", Gi = (e, t) => {
|
|
|
5631
5612
|
children: a.cancel
|
|
5632
5613
|
})
|
|
5633
5614
|
] });
|
|
5634
|
-
},
|
|
5635
|
-
let { strings: i } = s(
|
|
5615
|
+
}, Ki = ({ comment: e, disabled: t, onDeleteComment: n, onEditComment: r }) => {
|
|
5616
|
+
let { strings: i } = s(zi);
|
|
5636
5617
|
return /* @__PURE__ */ _("div", {
|
|
5637
5618
|
className: "pkt-fileupload__queue-display__item__comments",
|
|
5638
5619
|
children: /* @__PURE__ */ v("div", {
|
|
@@ -5645,7 +5626,7 @@ var Wi = "comments", Gi = (e, t) => {
|
|
|
5645
5626
|
children: e.text
|
|
5646
5627
|
}), /* @__PURE__ */ _("time", {
|
|
5647
5628
|
className: "pkt-fileupload__queue-display__item__comment__time",
|
|
5648
|
-
children:
|
|
5629
|
+
children: Wi(e.timestamp, i)
|
|
5649
5630
|
})]
|
|
5650
5631
|
}), /* @__PURE__ */ v("div", {
|
|
5651
5632
|
className: "pkt-fileupload__queue-display__item__comment__actions",
|
|
@@ -5667,47 +5648,47 @@ var Wi = "comments", Gi = (e, t) => {
|
|
|
5667
5648
|
})]
|
|
5668
5649
|
})
|
|
5669
5650
|
});
|
|
5670
|
-
},
|
|
5671
|
-
let t = s(
|
|
5651
|
+
}, qi = ({ comments: e }) => {
|
|
5652
|
+
let t = s(zi);
|
|
5672
5653
|
return /* @__PURE__ */ _("input", {
|
|
5673
5654
|
type: "hidden",
|
|
5674
5655
|
name: `${t.name}-comments`,
|
|
5675
5656
|
value: e ? JSON.stringify(e) : ""
|
|
5676
5657
|
});
|
|
5677
|
-
},
|
|
5658
|
+
}, Ji = (e) => e.getAttribute(Ui) ?? [], Yi = (e) => ({
|
|
5678
5659
|
id: "comment",
|
|
5679
|
-
title: (t) => (t.attributes?.[
|
|
5660
|
+
title: (t) => (t.attributes?.[Ui] ?? []).length > 0 ? "" : e.addComment,
|
|
5680
5661
|
ariaLabel: e.addComment,
|
|
5681
5662
|
renderExtendedUI: (e) => {
|
|
5682
|
-
let t =
|
|
5683
|
-
return /* @__PURE__ */ _(
|
|
5663
|
+
let t = Ji(e)[0];
|
|
5664
|
+
return /* @__PURE__ */ _(Gi, {
|
|
5684
5665
|
fileItem: e.file,
|
|
5685
5666
|
disabled: e.disabled,
|
|
5686
5667
|
closeOperationUi: e.close,
|
|
5687
5668
|
onAddComment: (t) => {
|
|
5688
|
-
e.setAttribute(
|
|
5669
|
+
e.setAttribute(Ui, [t]);
|
|
5689
5670
|
},
|
|
5690
5671
|
existingComment: t
|
|
5691
5672
|
});
|
|
5692
5673
|
},
|
|
5693
5674
|
renderContent: (e) => {
|
|
5694
5675
|
if (e.isActive) return null;
|
|
5695
|
-
let t =
|
|
5696
|
-
return t ? /* @__PURE__ */ _(
|
|
5676
|
+
let t = Ji(e)[0];
|
|
5677
|
+
return t ? /* @__PURE__ */ _(Ki, {
|
|
5697
5678
|
comment: t,
|
|
5698
5679
|
disabled: e.disabled,
|
|
5699
5680
|
onEditComment: e.activate,
|
|
5700
|
-
onDeleteComment: () => e.setAttribute(
|
|
5681
|
+
onDeleteComment: () => e.setAttribute(Ui, void 0)
|
|
5701
5682
|
}) : null;
|
|
5702
5683
|
},
|
|
5703
|
-
renderHidden: (e) => /* @__PURE__ */ _(
|
|
5704
|
-
}),
|
|
5684
|
+
renderHidden: (e) => /* @__PURE__ */ _(qi, { comments: e.getAttribute(Ui) }, `comments${e.file.fileId}`)
|
|
5685
|
+
}), Xi = (e, t) => ({
|
|
5705
5686
|
id: "remove",
|
|
5706
5687
|
title: t.remove,
|
|
5707
5688
|
ariaLabel: t.removeFile,
|
|
5708
5689
|
onClick: ({ file: t }) => e(t.fileId)
|
|
5709
|
-
}),
|
|
5710
|
-
let { strings: i } = s(
|
|
5690
|
+
}), Zi = ({ initialValue: e, disabled: t, onSave: n, onCancel: r }) => {
|
|
5691
|
+
let { strings: i } = s(zi), a = p(null), o = l(), c = () => n(a.current?.value ?? "");
|
|
5711
5692
|
return /* @__PURE__ */ v(g, { children: [
|
|
5712
5693
|
/* @__PURE__ */ _("label", {
|
|
5713
5694
|
htmlFor: o,
|
|
@@ -5741,19 +5722,19 @@ var Wi = "comments", Gi = (e, t) => {
|
|
|
5741
5722
|
children: i.cancel
|
|
5742
5723
|
})
|
|
5743
5724
|
] });
|
|
5744
|
-
},
|
|
5745
|
-
let t = s(
|
|
5725
|
+
}, Qi = ({ targetFilename: e }) => {
|
|
5726
|
+
let t = s(zi);
|
|
5746
5727
|
return /* @__PURE__ */ _("input", {
|
|
5747
5728
|
type: "hidden",
|
|
5748
5729
|
name: `${t.name}-targetFilename`,
|
|
5749
5730
|
value: e
|
|
5750
5731
|
});
|
|
5751
|
-
},
|
|
5732
|
+
}, $i = (e) => e.getAttribute("targetFilename") || Fi(e.file, ""), ea = (e) => ({
|
|
5752
5733
|
id: "rename",
|
|
5753
5734
|
title: e.rename,
|
|
5754
5735
|
ariaLabel: e.renameFile,
|
|
5755
|
-
renderInlineUI: (e) => /* @__PURE__ */ _(
|
|
5756
|
-
initialValue:
|
|
5736
|
+
renderInlineUI: (e) => /* @__PURE__ */ _(Zi, {
|
|
5737
|
+
initialValue: $i(e),
|
|
5757
5738
|
disabled: e.disabled,
|
|
5758
5739
|
onSave: (t) => {
|
|
5759
5740
|
let n = t.trim();
|
|
@@ -5761,8 +5742,8 @@ var Wi = "comments", Gi = (e, t) => {
|
|
|
5761
5742
|
},
|
|
5762
5743
|
onCancel: e.close
|
|
5763
5744
|
}),
|
|
5764
|
-
renderHidden: (e) => /* @__PURE__ */ _(
|
|
5765
|
-
}),
|
|
5745
|
+
renderHidden: (e) => /* @__PURE__ */ _(Qi, { targetFilename: $i(e) }, `rename${e.file.fileId}`)
|
|
5746
|
+
}), ta = (e, t) => {
|
|
5766
5747
|
let n = o((t, n) => e.find((e) => e.fileId === t)?.attributes?.[n], [e]), r = o((n, r, i) => {
|
|
5767
5748
|
let a = e.find((e) => e.fileId === n);
|
|
5768
5749
|
if (!a) return;
|
|
@@ -5782,7 +5763,7 @@ var Wi = "comments", Gi = (e, t) => {
|
|
|
5782
5763
|
setAttribute: (t, n) => r(e, t, n)
|
|
5783
5764
|
}), [n, r])
|
|
5784
5765
|
};
|
|
5785
|
-
},
|
|
5766
|
+
}, na = (e) => {
|
|
5786
5767
|
let [t, n] = m(!1), [r, i] = m(0), a = p(null);
|
|
5787
5768
|
return {
|
|
5788
5769
|
isOpen: t,
|
|
@@ -5796,10 +5777,10 @@ var Wi = "comments", Gi = (e, t) => {
|
|
|
5796
5777
|
n(!1), a.current?.close();
|
|
5797
5778
|
}, []),
|
|
5798
5779
|
navigate: o((t) => {
|
|
5799
|
-
e.length !== 0 && i((n) =>
|
|
5780
|
+
e.length !== 0 && i((n) => Mi(n, t, e.length));
|
|
5800
5781
|
}, [e.length])
|
|
5801
5782
|
};
|
|
5802
|
-
},
|
|
5783
|
+
}, ra = (e) => {
|
|
5803
5784
|
let [t, n] = m(null);
|
|
5804
5785
|
return c(() => {
|
|
5805
5786
|
if (!e?.type.startsWith("image/")) return;
|
|
@@ -5809,7 +5790,7 @@ var Wi = "comments", Gi = (e, t) => {
|
|
|
5809
5790
|
url: t
|
|
5810
5791
|
}), () => URL.revokeObjectURL(t);
|
|
5811
5792
|
}, [e]), t && t.file === e ? t.url : null;
|
|
5812
|
-
},
|
|
5793
|
+
}, ia = (e) => {
|
|
5813
5794
|
let [t, n] = m({}), [r, i] = m(e);
|
|
5814
5795
|
if (e !== r) {
|
|
5815
5796
|
i(e);
|
|
@@ -5835,7 +5816,7 @@ var Wi = "comments", Gi = (e, t) => {
|
|
|
5835
5816
|
});
|
|
5836
5817
|
}, [])
|
|
5837
5818
|
};
|
|
5838
|
-
},
|
|
5819
|
+
}, aa = (e, { uploadStrategy: t, required: n, currentFileCount: r, onMissingFiles: i }) => {
|
|
5839
5820
|
c(() => {
|
|
5840
5821
|
if (t !== "custom" || !n) return;
|
|
5841
5822
|
let a = e.current?.form;
|
|
@@ -5853,8 +5834,8 @@ var Wi = "comments", Gi = (e, t) => {
|
|
|
5853
5834
|
r,
|
|
5854
5835
|
i
|
|
5855
5836
|
]);
|
|
5856
|
-
},
|
|
5857
|
-
let C = f(() =>
|
|
5837
|
+
}, oa = 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) => {
|
|
5838
|
+
let C = f(() => rr(), []), w = i || C, T = p(null), [E, D] = m(0);
|
|
5858
5839
|
c(() => {
|
|
5859
5840
|
T.current && D(T.current.getBoundingClientRect().width || 0);
|
|
5860
5841
|
}, [h]);
|
|
@@ -5905,44 +5886,44 @@ var Wi = "comments", Gi = (e, t) => {
|
|
|
5905
5886
|
})
|
|
5906
5887
|
});
|
|
5907
5888
|
});
|
|
5908
|
-
|
|
5889
|
+
oa.displayName = "PktProgressbar";
|
|
5909
5890
|
//#endregion
|
|
5910
5891
|
//#region ../../shared-utils/scroll-lock/index.ts
|
|
5911
|
-
var
|
|
5892
|
+
var sa = "is-scroll-locked", ca = 0, la = 0, ua = () => typeof document < "u" && typeof window < "u", da = () => {
|
|
5912
5893
|
let e = document.body, t = document.documentElement;
|
|
5913
|
-
|
|
5894
|
+
la = window.scrollY || window.pageYOffset;
|
|
5914
5895
|
let n = window.innerWidth - t.clientWidth;
|
|
5915
|
-
n > 0 && (e.style.paddingRight = `${n}px`), e.style.position = "fixed", e.style.top = `-${
|
|
5916
|
-
},
|
|
5896
|
+
n > 0 && (e.style.paddingRight = `${n}px`), e.style.position = "fixed", e.style.top = `-${la}px`, e.style.left = "0", e.style.right = "0", e.style.width = "100%", e.style.overflow = "hidden", t.classList.add(sa);
|
|
5897
|
+
}, fa = () => {
|
|
5917
5898
|
let e = document.body, t = document.documentElement;
|
|
5918
|
-
e.style.removeProperty("position"), e.style.removeProperty("top"), e.style.removeProperty("left"), e.style.removeProperty("right"), e.style.removeProperty("width"), e.style.removeProperty("overflow"), e.style.removeProperty("padding-right"), t.classList.remove(
|
|
5919
|
-
top:
|
|
5899
|
+
e.style.removeProperty("position"), e.style.removeProperty("top"), e.style.removeProperty("left"), e.style.removeProperty("right"), e.style.removeProperty("width"), e.style.removeProperty("overflow"), e.style.removeProperty("padding-right"), t.classList.remove(sa), typeof window.scrollTo == "function" && window.scrollTo({
|
|
5900
|
+
top: la,
|
|
5920
5901
|
behavior: "instant"
|
|
5921
5902
|
});
|
|
5903
|
+
}, pa = () => {
|
|
5904
|
+
ua() && (ca += 1, ca === 1 && da());
|
|
5922
5905
|
}, ma = () => {
|
|
5923
|
-
|
|
5924
|
-
}, ha = () => {
|
|
5925
|
-
|
|
5926
|
-
},
|
|
5927
|
-
|
|
5928
|
-
}, va = i(({ children: e, className: t, open: n = !1, headingText: r = "", headingIconName: i, headingIconPath: a, hideCloseButton: s = !1, closeOnBackdropClick: l = !1, size: u = "medium", removePadding: d = !1, closeButtonSkin: f = "blue", variant: m = "dialog", drawerPosition: h = "right", transparentBackdrop: g = !1, onClose: y, strings: b, ...x }, S) => {
|
|
5929
|
-
let C = ke(["generic"], b), w = p(null), T = p(ga()), E = ar(), D = `pkt-modal__headingText-${E}`, O = `pkt-modal__content-${E}`, k = o((e) => {
|
|
5906
|
+
!ua() || ca === 0 || (--ca, ca === 0 && fa());
|
|
5907
|
+
}, ha = () => ({ locked: !1 }), ga = (e, t) => {
|
|
5908
|
+
e.locked !== t && (e.locked = t, t ? pa() : ma());
|
|
5909
|
+
}, _a = i(({ children: e, className: t, open: n = !1, headingText: r = "", headingIconName: i, headingIconPath: a, hideCloseButton: s = !1, closeOnBackdropClick: l = !1, size: u = "medium", removePadding: d = !1, closeButtonSkin: f = "blue", variant: m = "dialog", drawerPosition: h = "right", transparentBackdrop: g = !1, onClose: y, strings: b, ...x }, S) => {
|
|
5910
|
+
let C = ke(["generic"], b), w = p(null), T = p(ha()), E = ir(), D = `pkt-modal__headingText-${E}`, O = `pkt-modal__content-${E}`, k = o((e) => {
|
|
5930
5911
|
w.current = e, typeof S == "function" ? S(e) : S && (S.current = e);
|
|
5931
5912
|
}, [S]), A = o(() => {
|
|
5932
|
-
w.current?.open && (w.current.close(),
|
|
5913
|
+
w.current?.open && (w.current.close(), ga(T.current, !1), y?.());
|
|
5933
5914
|
}, [y]);
|
|
5934
5915
|
c(() => {
|
|
5935
|
-
n ? (w.current?.open || w.current?.showModal(),
|
|
5916
|
+
n ? (w.current?.open || w.current?.showModal(), ga(T.current, !0)) : (w.current?.open && w.current.close(), ga(T.current, !1));
|
|
5936
5917
|
}, [n]), c(() => {
|
|
5937
5918
|
let e = T.current;
|
|
5938
5919
|
return () => {
|
|
5939
|
-
|
|
5920
|
+
ga(e, !1);
|
|
5940
5921
|
};
|
|
5941
5922
|
}, []);
|
|
5942
5923
|
let j = o((e) => {
|
|
5943
5924
|
l && e.target === w.current && A();
|
|
5944
5925
|
}, [l, A]), M = o(() => {
|
|
5945
|
-
|
|
5926
|
+
ga(T.current, !1), y?.();
|
|
5946
5927
|
}, [y]), N = f === "blue", P = (0, z.default)({
|
|
5947
5928
|
"pkt-modal": !0,
|
|
5948
5929
|
"pkt-modal--removePadding": d,
|
|
@@ -6000,11 +5981,11 @@ var ca = "is-scroll-locked", la = 0, ua = 0, da = () => typeof document < "u" &&
|
|
|
6000
5981
|
})
|
|
6001
5982
|
});
|
|
6002
5983
|
});
|
|
6003
|
-
|
|
5984
|
+
_a.displayName = "PktModal";
|
|
6004
5985
|
//#endregion
|
|
6005
5986
|
//#region src/components/fileupload/Truncate.tsx
|
|
6006
|
-
var
|
|
6007
|
-
let n = s(
|
|
5987
|
+
var va = n({ tail: 5 }), ya = ({ children: e, tail: t }) => {
|
|
5988
|
+
let n = s(va), r = ji(e, t === void 0 ? n.tail : t);
|
|
6008
5989
|
return r ? /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _("span", {
|
|
6009
5990
|
className: "pkt-fileupload__queue-display__item__title__head",
|
|
6010
5991
|
"data-pkt-truncate-part": "first",
|
|
@@ -6017,8 +5998,8 @@ var ya = n({ tail: 5 }), ba = ({ children: e, tail: t }) => {
|
|
|
6017
5998
|
"data-pkt-truncate-part": "first",
|
|
6018
5999
|
children: e
|
|
6019
6000
|
});
|
|
6020
|
-
},
|
|
6021
|
-
let { strings: t } = s(
|
|
6001
|
+
}, ba = (e) => {
|
|
6002
|
+
let { strings: t } = s(zi);
|
|
6022
6003
|
return /* @__PURE__ */ _("button", {
|
|
6023
6004
|
type: "button",
|
|
6024
6005
|
onClick: e.onClick,
|
|
@@ -6027,15 +6008,15 @@ var ya = n({ tail: 5 }), ba = ({ children: e, tail: t }) => {
|
|
|
6027
6008
|
"aria-label": e.ariaLabel || t.cancelUpload,
|
|
6028
6009
|
children: e.label || t.cancel
|
|
6029
6010
|
});
|
|
6030
|
-
},
|
|
6031
|
-
let { strings: e } = s(
|
|
6011
|
+
}, xa = () => {
|
|
6012
|
+
let { strings: e } = s(zi);
|
|
6032
6013
|
return /* @__PURE__ */ _("span", {
|
|
6033
6014
|
className: "pkt-fileupload__queue-display__item__loading-text",
|
|
6034
6015
|
"aria-label": e.uploadingFile,
|
|
6035
6016
|
children: e.uploading
|
|
6036
6017
|
});
|
|
6037
|
-
},
|
|
6038
|
-
let { strings: r } = s(
|
|
6018
|
+
}, Sa = ({ cancelTransfer: e, transferItem: t, disabled: n = !1 }) => {
|
|
6019
|
+
let { strings: r } = s(zi), i = t.showProgress ?? t.progress !== 0;
|
|
6039
6020
|
return /* @__PURE__ */ v(g, { children: [
|
|
6040
6021
|
/* @__PURE__ */ _(J, {
|
|
6041
6022
|
name: "document-text",
|
|
@@ -6045,21 +6026,21 @@ var ya = n({ tail: 5 }), ba = ({ children: e, tail: t }) => {
|
|
|
6045
6026
|
/* @__PURE__ */ v("p", {
|
|
6046
6027
|
className: "pkt-fileupload__queue-display__item__title",
|
|
6047
6028
|
"aria-label": r.filename,
|
|
6048
|
-
children: [/* @__PURE__ */ _(
|
|
6029
|
+
children: [/* @__PURE__ */ _(ya, { children: Fi(t) }), /* @__PURE__ */ v("span", {
|
|
6049
6030
|
className: "pkt-fileupload__queue-display__item__filesize",
|
|
6050
6031
|
children: [
|
|
6051
6032
|
" ",
|
|
6052
6033
|
"(",
|
|
6053
|
-
|
|
6034
|
+
mi(t.file.size),
|
|
6054
6035
|
")"
|
|
6055
6036
|
]
|
|
6056
6037
|
})]
|
|
6057
6038
|
}),
|
|
6058
|
-
/* @__PURE__ */ _(
|
|
6039
|
+
/* @__PURE__ */ _(ba, {
|
|
6059
6040
|
onClick: e,
|
|
6060
6041
|
disabled: n
|
|
6061
6042
|
}),
|
|
6062
|
-
i ? /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _(
|
|
6043
|
+
i ? /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _(oa, {
|
|
6063
6044
|
valueCurrent: t.progress * 100,
|
|
6064
6045
|
statusType: "none",
|
|
6065
6046
|
valueMax: 100,
|
|
@@ -6069,34 +6050,34 @@ var ya = n({ tail: 5 }), ba = ({ children: e, tail: t }) => {
|
|
|
6069
6050
|
className: "pkt-fileupload__queue-display__item__percentage",
|
|
6070
6051
|
"aria-hidden": "true",
|
|
6071
6052
|
children: `${Math.round(t.progress * 100)}%`
|
|
6072
|
-
})] }) : /* @__PURE__ */ _(
|
|
6053
|
+
})] }) : /* @__PURE__ */ _(xa, {})
|
|
6073
6054
|
] });
|
|
6074
|
-
},
|
|
6055
|
+
}, Ca = ({ transferItem: e }) => /* @__PURE__ */ v("p", {
|
|
6075
6056
|
className: "pkt-fileupload__queue-display__item__title",
|
|
6076
|
-
children: [/* @__PURE__ */ _(
|
|
6057
|
+
children: [/* @__PURE__ */ _(ya, { children: Fi(e) }), e.file && /* @__PURE__ */ v("span", {
|
|
6077
6058
|
className: "pkt-fileupload__queue-display__item__filesize",
|
|
6078
6059
|
children: [
|
|
6079
6060
|
" (",
|
|
6080
|
-
|
|
6061
|
+
mi(e.file.size),
|
|
6081
6062
|
")"
|
|
6082
6063
|
]
|
|
6083
6064
|
})]
|
|
6084
|
-
}),
|
|
6085
|
-
let { strings: r } = s(
|
|
6065
|
+
}), wa = ({ transferItem: e, onRemove: t, disabled: n }) => {
|
|
6066
|
+
let { strings: r } = s(zi), i = (e.lastProgress ?? 1) * 100;
|
|
6086
6067
|
return /* @__PURE__ */ v(g, { children: [
|
|
6087
6068
|
/* @__PURE__ */ _(J, {
|
|
6088
6069
|
className: "pkt-fileupload__queue-display__item__icon pkt-icon--medium",
|
|
6089
6070
|
name: "alert-error",
|
|
6090
6071
|
"aria-hidden": "true"
|
|
6091
6072
|
}),
|
|
6092
|
-
/* @__PURE__ */ _(
|
|
6093
|
-
/* @__PURE__ */ _(
|
|
6073
|
+
/* @__PURE__ */ _(Ca, { transferItem: e }),
|
|
6074
|
+
/* @__PURE__ */ _(ba, {
|
|
6094
6075
|
onClick: t,
|
|
6095
6076
|
label: r.removeFailed,
|
|
6096
6077
|
ariaLabel: r.removeFailedFile,
|
|
6097
6078
|
disabled: n
|
|
6098
6079
|
}),
|
|
6099
|
-
/* @__PURE__ */ _(
|
|
6080
|
+
/* @__PURE__ */ _(oa, {
|
|
6100
6081
|
valueCurrent: i,
|
|
6101
6082
|
statusType: "none",
|
|
6102
6083
|
valueMax: 100,
|
|
@@ -6108,16 +6089,16 @@ var ya = n({ tail: 5 }), ba = ({ children: e, tail: t }) => {
|
|
|
6108
6089
|
children: e.errorMessage
|
|
6109
6090
|
})
|
|
6110
6091
|
] });
|
|
6111
|
-
},
|
|
6112
|
-
let { strings: r } = s(
|
|
6092
|
+
}, Ta = ({ transferItem: e, onRemove: t, disabled: n }) => {
|
|
6093
|
+
let { strings: r } = s(zi);
|
|
6113
6094
|
return /* @__PURE__ */ v(g, { children: [
|
|
6114
6095
|
/* @__PURE__ */ _(J, {
|
|
6115
6096
|
className: "pkt-fileupload__queue-display__item__icon pkt-icon--medium",
|
|
6116
6097
|
name: "alert-error",
|
|
6117
6098
|
"aria-hidden": "true"
|
|
6118
6099
|
}),
|
|
6119
|
-
/* @__PURE__ */ _(
|
|
6120
|
-
/* @__PURE__ */ _(
|
|
6100
|
+
/* @__PURE__ */ _(Ca, { transferItem: e }),
|
|
6101
|
+
/* @__PURE__ */ _(ba, {
|
|
6121
6102
|
onClick: t,
|
|
6122
6103
|
label: r.removeFailed,
|
|
6123
6104
|
ariaLabel: r.removeFailedFile,
|
|
@@ -6128,15 +6109,15 @@ var ya = n({ tail: 5 }), ba = ({ children: e, tail: t }) => {
|
|
|
6128
6109
|
children: e.errorMessage
|
|
6129
6110
|
})
|
|
6130
6111
|
] });
|
|
6131
|
-
},
|
|
6112
|
+
}, Ea = ({ transferItem: e, onRemove: t, disabled: n }) => e.showProgress ? /* @__PURE__ */ _(wa, {
|
|
6132
6113
|
transferItem: e,
|
|
6133
6114
|
onRemove: t,
|
|
6134
6115
|
disabled: n
|
|
6135
|
-
}) : /* @__PURE__ */ _(
|
|
6116
|
+
}) : /* @__PURE__ */ _(Ta, {
|
|
6136
6117
|
transferItem: e,
|
|
6137
6118
|
onRemove: t,
|
|
6138
6119
|
disabled: n
|
|
6139
|
-
}),
|
|
6120
|
+
}), Da = ({ operation: e, context: t }) => {
|
|
6140
6121
|
let n = typeof e.title == "function" ? e.title(t.file) : e.title;
|
|
6141
6122
|
return n ? /* @__PURE__ */ _("button", {
|
|
6142
6123
|
type: "button",
|
|
@@ -6148,12 +6129,12 @@ var ya = n({ tail: 5 }), ba = ({ children: e, tail: t }) => {
|
|
|
6148
6129
|
"aria-label": typeof e.ariaLabel == "function" ? e.ariaLabel(t.file) : e.ariaLabel,
|
|
6149
6130
|
children: n
|
|
6150
6131
|
}) : null;
|
|
6151
|
-
},
|
|
6132
|
+
}, Oa = ({ transferItem: e }) => /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _(J, {
|
|
6152
6133
|
name: "document-text",
|
|
6153
6134
|
className: "pkt-fileupload__queue-display__item__icon pkt-icon--medium",
|
|
6154
6135
|
"aria-hidden": "true"
|
|
6155
|
-
}), /* @__PURE__ */ _(
|
|
6156
|
-
let { strings: n } = s(
|
|
6136
|
+
}), /* @__PURE__ */ _(Ca, { transferItem: e })] }), ka = ({ transferItem: e, onPreviewClick: t }) => {
|
|
6137
|
+
let { strings: n } = s(zi), r = ra(e.file), [i, a] = m(null), o = !!r && i === r, c = r && !o && /* @__PURE__ */ _("img", {
|
|
6157
6138
|
src: r,
|
|
6158
6139
|
alt: e.attributes.targetFilename,
|
|
6159
6140
|
onError: () => a(r)
|
|
@@ -6176,16 +6157,16 @@ var ya = n({ tail: 5 }), ba = ({ children: e, tail: t }) => {
|
|
|
6176
6157
|
}), c]
|
|
6177
6158
|
}), /* @__PURE__ */ _("span", {
|
|
6178
6159
|
className: "pkt-fileupload__queue-display__item__thumbnail__title",
|
|
6179
|
-
children: /* @__PURE__ */ _(
|
|
6160
|
+
children: /* @__PURE__ */ _(ya, { children: e.attributes.targetFilename })
|
|
6180
6161
|
})]
|
|
6181
6162
|
});
|
|
6182
|
-
},
|
|
6183
|
-
let { strings: o } = s(
|
|
6163
|
+
}, Aa = ({ isOpen: e, images: t, currentIndex: n, onClose: r, onNavigate: i, modalRef: a }) => {
|
|
6164
|
+
let { strings: o } = s(zi), l = t[n], u = t.length > 1, d = ra(l?.file), [f, p] = m(null), h = !!d && f === d;
|
|
6184
6165
|
return c(() => {
|
|
6185
6166
|
if (!e) return;
|
|
6186
6167
|
let t = (e) => {
|
|
6187
6168
|
if (e.key === "Tab") {
|
|
6188
|
-
|
|
6169
|
+
Ai(e, a.current);
|
|
6189
6170
|
return;
|
|
6190
6171
|
}
|
|
6191
6172
|
switch (e.key) {
|
|
@@ -6204,7 +6185,7 @@ var ya = n({ tail: 5 }), ba = ({ children: e, tail: t }) => {
|
|
|
6204
6185
|
i,
|
|
6205
6186
|
r,
|
|
6206
6187
|
a
|
|
6207
|
-
]), l ? /* @__PURE__ */ _(
|
|
6188
|
+
]), l ? /* @__PURE__ */ _(_a, {
|
|
6208
6189
|
ref: a,
|
|
6209
6190
|
headingText: l.attributes.targetFilename,
|
|
6210
6191
|
closeOnBackdropClick: !0,
|
|
@@ -6264,7 +6245,7 @@ var ya = n({ tail: 5 }), ba = ({ children: e, tail: t }) => {
|
|
|
6264
6245
|
]
|
|
6265
6246
|
})
|
|
6266
6247
|
}) : null;
|
|
6267
|
-
},
|
|
6248
|
+
}, ja = ({ operation: e, transferItem: t, inputName: n, disabled: r, activatedOperation: i, onActivate: a, onClose: o, buildAttributeAccessors: s }) => {
|
|
6268
6249
|
let c = s(t.fileId);
|
|
6269
6250
|
return {
|
|
6270
6251
|
file: t,
|
|
@@ -6276,29 +6257,29 @@ var ya = n({ tail: 5 }), ba = ({ children: e, tail: t }) => {
|
|
|
6276
6257
|
getAttribute: c.getAttribute,
|
|
6277
6258
|
setAttribute: c.setAttribute
|
|
6278
6259
|
};
|
|
6279
|
-
},
|
|
6260
|
+
}, Ma = (e, t) => e.map((e) => ({
|
|
6280
6261
|
operation: e,
|
|
6281
|
-
context:
|
|
6262
|
+
context: ja({
|
|
6282
6263
|
operation: e,
|
|
6283
6264
|
...t
|
|
6284
6265
|
})
|
|
6285
|
-
})),
|
|
6286
|
-
let t =
|
|
6266
|
+
})), Na = (e) => {
|
|
6267
|
+
let t = Ma(e.operations, e);
|
|
6287
6268
|
return /* @__PURE__ */ _("div", {
|
|
6288
6269
|
className: "pkt-fileupload__queue-display__item__actions",
|
|
6289
|
-
children: t.filter(({ operation: t }) => t.id !== e.activatedOperation?.id).map(({ operation: e, context: t }) => /* @__PURE__ */ _(
|
|
6270
|
+
children: t.filter(({ operation: t }) => t.id !== e.activatedOperation?.id).map(({ operation: e, context: t }) => /* @__PURE__ */ _(Da, {
|
|
6290
6271
|
operation: e,
|
|
6291
6272
|
context: t
|
|
6292
6273
|
}, e.id))
|
|
6293
6274
|
});
|
|
6294
|
-
},
|
|
6295
|
-
let t =
|
|
6275
|
+
}, Pa = (e) => {
|
|
6276
|
+
let t = Ma(e.operations, e);
|
|
6296
6277
|
return /* @__PURE__ */ _(g, { children: t.filter(({ operation: e }) => e.renderContent).map(({ operation: e, context: t }) => /* @__PURE__ */ _("div", {
|
|
6297
6278
|
className: "pkt-fileupload__queue-display__item__operation-content",
|
|
6298
6279
|
children: e.renderContent(t)
|
|
6299
6280
|
}, e.id)) });
|
|
6300
|
-
},
|
|
6301
|
-
let { transferItem: t, activatedOperation: n, operations: r, ItemRenderer: i, onPreviewClick: a } = e, o = n ?
|
|
6281
|
+
}, Fa = (e) => {
|
|
6282
|
+
let { transferItem: t, activatedOperation: n, operations: r, ItemRenderer: i, onPreviewClick: a } = e, o = n ? ja({
|
|
6302
6283
|
operation: n,
|
|
6303
6284
|
...e
|
|
6304
6285
|
}) : void 0, s = n?.renderInlineUI || n?.renderExtendedUI ? [] : r;
|
|
@@ -6314,43 +6295,43 @@ var ya = n({ tail: 5 }), ba = ({ children: e, tail: t }) => {
|
|
|
6314
6295
|
queueItemOperations: r,
|
|
6315
6296
|
onPreviewClick: a
|
|
6316
6297
|
}),
|
|
6317
|
-
s.length > 0 && /* @__PURE__ */ _(
|
|
6298
|
+
s.length > 0 && /* @__PURE__ */ _(Na, {
|
|
6318
6299
|
...e,
|
|
6319
6300
|
operations: s
|
|
6320
6301
|
}),
|
|
6321
|
-
/* @__PURE__ */ _(
|
|
6302
|
+
/* @__PURE__ */ _(Pa, { ...e }),
|
|
6322
6303
|
n?.renderExtendedUI && o && /* @__PURE__ */ _("div", {
|
|
6323
6304
|
className: "pkt-fileupload__queue-display__item__expanded-operation-ui",
|
|
6324
6305
|
children: n.renderExtendedUI(o)
|
|
6325
6306
|
})
|
|
6326
6307
|
] });
|
|
6327
|
-
},
|
|
6328
|
-
let { transferItem: t, enableImagePreview: n, onCancelTransfer: r, onOpenPreview: i, disabled: a } = e, o =
|
|
6308
|
+
}, Ia = (e) => {
|
|
6309
|
+
let { transferItem: t, enableImagePreview: n, onCancelTransfer: r, onOpenPreview: i, disabled: a } = e, o = Si(t.progress), s = n && t.progress === "done" && xi(t);
|
|
6329
6310
|
switch (o) {
|
|
6330
|
-
case "in-progress": return /* @__PURE__ */ _(
|
|
6311
|
+
case "in-progress": return /* @__PURE__ */ _(Sa, {
|
|
6331
6312
|
transferItem: t,
|
|
6332
6313
|
cancelTransfer: () => r(t.fileId),
|
|
6333
6314
|
disabled: a
|
|
6334
6315
|
});
|
|
6335
|
-
case "error": return /* @__PURE__ */ _(
|
|
6316
|
+
case "error": return /* @__PURE__ */ _(Ea, {
|
|
6336
6317
|
transferItem: t,
|
|
6337
6318
|
onRemove: () => r(t.fileId),
|
|
6338
6319
|
disabled: a
|
|
6339
6320
|
});
|
|
6340
|
-
case "idle": return /* @__PURE__ */ _(
|
|
6321
|
+
case "idle": return /* @__PURE__ */ _(Fa, {
|
|
6341
6322
|
...e,
|
|
6342
6323
|
onPreviewClick: s ? () => i(t.fileId) : void 0
|
|
6343
6324
|
});
|
|
6344
6325
|
}
|
|
6345
|
-
},
|
|
6326
|
+
}, La = (e, t, n) => f(() => Ci(e, t, n), [
|
|
6346
6327
|
e,
|
|
6347
6328
|
t,
|
|
6348
6329
|
n
|
|
6349
|
-
]),
|
|
6350
|
-
let d =
|
|
6330
|
+
]), Ra = (e, t) => f(() => t ? e.filter((e) => e.progress === "done" && xi(e)) : [], [e, t]), za = ({ files: e, cancelTransfer: t, transfers: n = [], queueItemOperations: r = [], ItemRenderer: i = Oa, truncateTail: a, enableImagePreview: o = !1, uploadStrategy: s = "form", disabled: c = !1, inputName: l, buildAttributeAccessors: u }) => {
|
|
6331
|
+
let d = La(e, n, s), f = Ra(d, o), p = ia(r), m = na(f);
|
|
6351
6332
|
return /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _("ul", {
|
|
6352
6333
|
className: "pkt-fileupload__queue-display",
|
|
6353
|
-
children: /* @__PURE__ */ _(
|
|
6334
|
+
children: /* @__PURE__ */ _(va.Provider, {
|
|
6354
6335
|
value: { tail: a },
|
|
6355
6336
|
children: d.map((e) => {
|
|
6356
6337
|
let n = {
|
|
@@ -6368,10 +6349,10 @@ var ya = n({ tail: 5 }), ba = ({ children: e, tail: t }) => {
|
|
|
6368
6349
|
"pkt-fileupload__queue-display__item--in-progress": typeof e.progress == "number",
|
|
6369
6350
|
[`pkt-fileupload__queue-display__item--${e.progress}`]: typeof e.progress == "string"
|
|
6370
6351
|
}),
|
|
6371
|
-
children: [r.filter((e) => e.renderHidden).map((t) => /* @__PURE__ */ _("span", { children: t.renderHidden(
|
|
6352
|
+
children: [r.filter((e) => e.renderHidden).map((t) => /* @__PURE__ */ _("span", { children: t.renderHidden(ja({
|
|
6372
6353
|
operation: t,
|
|
6373
6354
|
...n
|
|
6374
|
-
})) }, `${t.id}-${e.fileId}`)), /* @__PURE__ */ _(
|
|
6355
|
+
})) }, `${t.id}-${e.fileId}`)), /* @__PURE__ */ _(Ia, {
|
|
6375
6356
|
...n,
|
|
6376
6357
|
ItemRenderer: i,
|
|
6377
6358
|
enableImagePreview: o,
|
|
@@ -6381,7 +6362,7 @@ var ya = n({ tail: 5 }), ba = ({ children: e, tail: t }) => {
|
|
|
6381
6362
|
}, e.fileId);
|
|
6382
6363
|
})
|
|
6383
6364
|
})
|
|
6384
|
-
}), o && f.length > 0 && /* @__PURE__ */ _(
|
|
6365
|
+
}), o && f.length > 0 && /* @__PURE__ */ _(Aa, {
|
|
6385
6366
|
modalRef: m.modalRef,
|
|
6386
6367
|
isOpen: m.isOpen,
|
|
6387
6368
|
images: f,
|
|
@@ -6389,10 +6370,10 @@ var ya = n({ tail: 5 }), ba = ({ children: e, tail: t }) => {
|
|
|
6389
6370
|
onClose: m.close,
|
|
6390
6371
|
onNavigate: m.navigate
|
|
6391
6372
|
})] });
|
|
6392
|
-
},
|
|
6393
|
-
filename:
|
|
6394
|
-
thumbnail:
|
|
6395
|
-
},
|
|
6373
|
+
}, Ba = {
|
|
6374
|
+
filename: Oa,
|
|
6375
|
+
thumbnail: ka
|
|
6376
|
+
}, Va = 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 = Ba.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: M, helptextDropdown: N, helptextDropdownButton: P, optionalTag: ee, optionalText: te, requiredTag: F, requiredText: I, tagText: ne, required: re = !1, enableImagePreview: ie = !1, "aria-describedby": ae, "aria-invalid": oe, strings: L, ...R }, se) => {
|
|
6396
6377
|
let B = l(), V = n ?? `pkt-fileupload-${B}`, H = p(null);
|
|
6397
6378
|
u(se, () => H.current, []);
|
|
6398
6379
|
let ce = "transfers" in R ? R.transfers : void 0, le = ke(["fileupload"], L).fileupload, [U, W] = m(null), [G, K] = m("");
|
|
@@ -6406,7 +6387,7 @@ var ya = n({ tail: 5 }), ba = ({ children: e, tail: t }) => {
|
|
|
6406
6387
|
M ? `${V}-helptext` : void 0,
|
|
6407
6388
|
ue
|
|
6408
6389
|
].filter(Boolean).join(" ") || void 0, fe = J || oe === !0 || oe === "true", me = o((e) => {
|
|
6409
|
-
let t =
|
|
6390
|
+
let t = bi(e, {
|
|
6410
6391
|
allowedFormats: S,
|
|
6411
6392
|
maxFileSize: w,
|
|
6412
6393
|
formatErrorMessage: C,
|
|
@@ -6432,13 +6413,13 @@ var ya = n({ tail: 5 }), ba = ({ children: e, tail: t }) => {
|
|
|
6432
6413
|
]);
|
|
6433
6414
|
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");
|
|
6434
6415
|
let he = e !== void 0, [ge, _e] = m(() => t ?? []), X = he ? e : ge;
|
|
6435
|
-
|
|
6416
|
+
aa(H, {
|
|
6436
6417
|
uploadStrategy: i,
|
|
6437
6418
|
required: re,
|
|
6438
6419
|
currentFileCount: X.length,
|
|
6439
6420
|
onMissingFiles: o(() => W(le.requiredMissing), [le])
|
|
6440
6421
|
});
|
|
6441
|
-
let ve = typeof b == "string" ?
|
|
6422
|
+
let ve = typeof b == "string" ? Ba[b] : b, ye = b === "thumbnail", Z = typeof R.accept == "string" ? R.accept.trim() : void 0, be = f(() => vi(Z, S) || void 0, [Z, S]), xe = s && !ye, Q = a && !ye, Se = o((e) => {
|
|
6442
6423
|
for (let t of e) {
|
|
6443
6424
|
let e = me(t.file);
|
|
6444
6425
|
if (e) {
|
|
@@ -6478,16 +6459,16 @@ var ya = n({ tail: 5 }), ba = ({ children: e, tail: t }) => {
|
|
|
6478
6459
|
X,
|
|
6479
6460
|
R,
|
|
6480
6461
|
he
|
|
6481
|
-
]), { buildAttributeAccessors: Te } =
|
|
6462
|
+
]), { buildAttributeAccessors: Te } = ta(X, Ce), Ee = f(() => {
|
|
6482
6463
|
let e = [];
|
|
6483
|
-
return xe && e.push(
|
|
6464
|
+
return xe && e.push(ea(le)), Q && e.push(Yi(le)), e.push(...y), e.push(Xi(we, le)), e;
|
|
6484
6465
|
}, [
|
|
6485
6466
|
xe,
|
|
6486
6467
|
Q,
|
|
6487
6468
|
y,
|
|
6488
6469
|
we,
|
|
6489
6470
|
le
|
|
6490
|
-
]), { totalCount: De, uploadedCount: Oe, failedCount: je } = f(() =>
|
|
6471
|
+
]), { totalCount: De, uploadedCount: Oe, failedCount: je } = f(() => Ni(X, ce), [X, ce]), Me = Y(De, le.fileLabelOne, le.fileLabelOther), Ne = /* @__PURE__ */ _("div", {
|
|
6491
6472
|
className: (0, z.default)("pkt-fileupload", {
|
|
6492
6473
|
"pkt-fileupload--full-width": x,
|
|
6493
6474
|
"pkt-fileupload--error": J,
|
|
@@ -6495,7 +6476,7 @@ var ya = n({ tail: 5 }), ba = ({ children: e, tail: t }) => {
|
|
|
6495
6476
|
}),
|
|
6496
6477
|
"aria-disabled": A,
|
|
6497
6478
|
...A ? { inert: !0 } : {},
|
|
6498
|
-
children: /* @__PURE__ */ v(
|
|
6479
|
+
children: /* @__PURE__ */ v(zi.Provider, {
|
|
6499
6480
|
value: {
|
|
6500
6481
|
name: R.name || "",
|
|
6501
6482
|
multiple: !!r,
|
|
@@ -6523,7 +6504,7 @@ var ya = n({ tail: 5 }), ba = ({ children: e, tail: t }) => {
|
|
|
6523
6504
|
label: Me
|
|
6524
6505
|
})
|
|
6525
6506
|
}),
|
|
6526
|
-
/* @__PURE__ */ _(
|
|
6507
|
+
/* @__PURE__ */ _(Bi, {
|
|
6527
6508
|
id: V,
|
|
6528
6509
|
name: R.name || "",
|
|
6529
6510
|
form: R.form,
|
|
@@ -6532,7 +6513,7 @@ var ya = n({ tail: 5 }), ba = ({ children: e, tail: t }) => {
|
|
|
6532
6513
|
multiple: r,
|
|
6533
6514
|
uploadStrategy: i,
|
|
6534
6515
|
ref: H,
|
|
6535
|
-
accept: ye ?
|
|
6516
|
+
accept: ye ? Pi : be,
|
|
6536
6517
|
isThumbnailView: ye,
|
|
6537
6518
|
disabled: A,
|
|
6538
6519
|
required: re && i === "form",
|
|
@@ -6551,7 +6532,7 @@ var ya = n({ tail: 5 }), ba = ({ children: e, tail: t }) => {
|
|
|
6551
6532
|
className: "pkt-fileupload__error-alert",
|
|
6552
6533
|
children: q
|
|
6553
6534
|
}),
|
|
6554
|
-
X.length > 0 && /* @__PURE__ */ _(
|
|
6535
|
+
X.length > 0 && /* @__PURE__ */ _(za, {
|
|
6555
6536
|
files: X,
|
|
6556
6537
|
cancelTransfer: we,
|
|
6557
6538
|
truncateTail: d,
|
|
@@ -6569,7 +6550,7 @@ var ya = n({ tail: 5 }), ba = ({ children: e, tail: t }) => {
|
|
|
6569
6550
|
});
|
|
6570
6551
|
return /* @__PURE__ */ _("div", {
|
|
6571
6552
|
className: "pkt-fileupload-component",
|
|
6572
|
-
children: /* @__PURE__ */ _(
|
|
6553
|
+
children: /* @__PURE__ */ _(_r, {
|
|
6573
6554
|
strings: L,
|
|
6574
6555
|
forId: V,
|
|
6575
6556
|
label: j ?? "",
|
|
@@ -6588,10 +6569,10 @@ var ya = n({ tail: 5 }), ba = ({ children: e, tail: t }) => {
|
|
|
6588
6569
|
})
|
|
6589
6570
|
});
|
|
6590
6571
|
});
|
|
6591
|
-
|
|
6572
|
+
Va.displayName = "PktFileUpload";
|
|
6592
6573
|
//#endregion
|
|
6593
6574
|
//#region ../../shared-utils/header-footer/icon-map.ts
|
|
6594
|
-
var
|
|
6575
|
+
var Ha = {
|
|
6595
6576
|
automat: "parking-meter",
|
|
6596
6577
|
bike: "bicycle",
|
|
6597
6578
|
corona: "virus",
|
|
@@ -6616,10 +6597,10 @@ var Ua = {
|
|
|
6616
6597
|
treatment: "processing",
|
|
6617
6598
|
"warning-triangle": "alert-warning"
|
|
6618
6599
|
};
|
|
6619
|
-
function
|
|
6620
|
-
return e && (
|
|
6600
|
+
function Ua(e) {
|
|
6601
|
+
return e && (Ha[e] ?? e);
|
|
6621
6602
|
}
|
|
6622
|
-
var
|
|
6603
|
+
var Wa = {
|
|
6623
6604
|
"facebook.com": "facebook",
|
|
6624
6605
|
"fb.com": "facebook",
|
|
6625
6606
|
"instagram.com": "instagram",
|
|
@@ -6627,36 +6608,36 @@ var Ga = {
|
|
|
6627
6608
|
"x.com": "x",
|
|
6628
6609
|
"github.com": "github"
|
|
6629
6610
|
};
|
|
6630
|
-
function
|
|
6611
|
+
function Ga(e) {
|
|
6631
6612
|
return e.toLowerCase().replace(/^(?:www|m)\./, "");
|
|
6632
6613
|
}
|
|
6633
|
-
function
|
|
6614
|
+
function Ka(e, t) {
|
|
6634
6615
|
if (e) try {
|
|
6635
|
-
let t = Ga
|
|
6616
|
+
let t = Wa[Ga(new URL(e).hostname)];
|
|
6636
6617
|
if (t) return t;
|
|
6637
6618
|
} catch {}
|
|
6638
6619
|
if (t) {
|
|
6639
6620
|
let e = t.trim().toLowerCase().replace(/\s+/g, "-");
|
|
6640
6621
|
if (e) {
|
|
6641
|
-
let t =
|
|
6622
|
+
let t = Ua(e);
|
|
6642
6623
|
if (t) return t;
|
|
6643
6624
|
}
|
|
6644
6625
|
}
|
|
6645
6626
|
}
|
|
6646
6627
|
//#endregion
|
|
6647
6628
|
//#region ../../shared-utils/header-footer/select-megamenu.ts
|
|
6648
|
-
var
|
|
6649
|
-
function
|
|
6650
|
-
if (e) return e[t] ?? e[
|
|
6629
|
+
var qa = "nb-NO";
|
|
6630
|
+
function Ja(e, t = qa) {
|
|
6631
|
+
if (e) return e[t] ?? e[qa];
|
|
6651
6632
|
}
|
|
6652
6633
|
//#endregion
|
|
6653
6634
|
//#region ../../shared-utils/header-footer/external-domain.ts
|
|
6654
|
-
var
|
|
6655
|
-
function
|
|
6635
|
+
var Ya = "oslo.kommune.no", Xa = /\.(?:co|com|org|net|gov|edu|ac|kommune)\.[a-z]{2}$/i;
|
|
6636
|
+
function Za(e) {
|
|
6656
6637
|
let t = e.toLowerCase().replace(/\.$/, ""), n = t.split(".");
|
|
6657
|
-
return n.length <= 2 ? t : n.slice(
|
|
6638
|
+
return n.length <= 2 ? t : n.slice(Xa.test(t) ? -3 : -2).join(".");
|
|
6658
6639
|
}
|
|
6659
|
-
function
|
|
6640
|
+
function Qa(e) {
|
|
6660
6641
|
if (!e) return;
|
|
6661
6642
|
let t;
|
|
6662
6643
|
try {
|
|
@@ -6664,9 +6645,9 @@ function $a(e) {
|
|
|
6664
6645
|
} catch {
|
|
6665
6646
|
return;
|
|
6666
6647
|
}
|
|
6667
|
-
if (t.protocol === "http:" || t.protocol === "https:") return
|
|
6648
|
+
if (t.protocol === "http:" || t.protocol === "https:") return Za(t.hostname.toLowerCase().replace(/\.$/, ""));
|
|
6668
6649
|
}
|
|
6669
|
-
function
|
|
6650
|
+
function $a(e, t = Ya) {
|
|
6670
6651
|
if (!e) return;
|
|
6671
6652
|
let n;
|
|
6672
6653
|
try {
|
|
@@ -6676,21 +6657,21 @@ function eo(e, t = Xa) {
|
|
|
6676
6657
|
}
|
|
6677
6658
|
if (n.protocol !== "http:" && n.protocol !== "https:") return;
|
|
6678
6659
|
let r = n.hostname.toLowerCase().replace(/\.$/, ""), i = t.toLowerCase();
|
|
6679
|
-
if (!(r === i || r.endsWith(`.${i}`))) return
|
|
6660
|
+
if (!(r === i || r.endsWith(`.${i}`))) return Za(r);
|
|
6680
6661
|
}
|
|
6681
6662
|
//#endregion
|
|
6682
6663
|
//#region ../../shared-utils/header-footer/fetch-header-footer-data.ts
|
|
6683
|
-
var
|
|
6684
|
-
async function
|
|
6664
|
+
var eo = /* @__PURE__ */ new Map();
|
|
6665
|
+
async function to(e) {
|
|
6685
6666
|
let t = await fetch(e);
|
|
6686
6667
|
if (!t.ok) throw Error(`pkt-header-menu: failed to fetch ${e} (HTTP ${t.status})`);
|
|
6687
6668
|
let n = await t.json();
|
|
6688
6669
|
if (!n || typeof n != "object") throw Error(`pkt-header-menu: ${e} returned a non-object payload`);
|
|
6689
6670
|
return n;
|
|
6690
6671
|
}
|
|
6691
|
-
function
|
|
6692
|
-
return t ? t.aborted ? Promise.reject(
|
|
6693
|
-
let i = () => r(
|
|
6672
|
+
function no(e, t) {
|
|
6673
|
+
return t ? t.aborted ? Promise.reject(ro(t.reason)) : new Promise((n, r) => {
|
|
6674
|
+
let i = () => r(ro(t.reason));
|
|
6694
6675
|
t.addEventListener("abort", i, { once: !0 }), e.then((e) => {
|
|
6695
6676
|
t.removeEventListener("abort", i), n(e);
|
|
6696
6677
|
}, (e) => {
|
|
@@ -6698,22 +6679,22 @@ function ro(e, t) {
|
|
|
6698
6679
|
});
|
|
6699
6680
|
}) : e;
|
|
6700
6681
|
}
|
|
6701
|
-
function
|
|
6682
|
+
function ro(e) {
|
|
6702
6683
|
return e instanceof Error ? e : new DOMException("The operation was aborted.", "AbortError");
|
|
6703
6684
|
}
|
|
6704
|
-
async function
|
|
6705
|
-
let n =
|
|
6706
|
-
return n || (n =
|
|
6685
|
+
async function io(e = M, t) {
|
|
6686
|
+
let n = eo.get(e);
|
|
6687
|
+
return n || (n = to(e), n.catch(() => eo.delete(e)), eo.set(e, n)), no(n, t);
|
|
6707
6688
|
}
|
|
6708
6689
|
//#endregion
|
|
6709
6690
|
//#region src/components/footer/FooterGlobal.tsx
|
|
6710
|
-
var
|
|
6711
|
-
function
|
|
6691
|
+
var ao = "#cb-trigger";
|
|
6692
|
+
function oo({ data: e, dataUrl: t, locale: n = "nb-NO", skipGlobal: r = !1, onDataError: i }) {
|
|
6712
6693
|
let [a, o] = m(), s = p(i);
|
|
6713
6694
|
s.current = i, c(() => {
|
|
6714
6695
|
if (e || r) return;
|
|
6715
6696
|
let n = new AbortController();
|
|
6716
|
-
return
|
|
6697
|
+
return io(t, n.signal).then((e) => {
|
|
6717
6698
|
n.signal.aborted || o(e);
|
|
6718
6699
|
}).catch((e) => {
|
|
6719
6700
|
e.name !== "AbortError" && (console.warn("Failed to fetch header/footer data:", e), s.current?.(e));
|
|
@@ -6725,20 +6706,20 @@ function so({ data: e, dataUrl: t, locale: n = "nb-NO", skipGlobal: r = !1, onDa
|
|
|
6725
6706
|
]);
|
|
6726
6707
|
let l = e ?? a;
|
|
6727
6708
|
return f(() => {
|
|
6728
|
-
if (!r) return
|
|
6709
|
+
if (!r) return Ja(l, n)?.footer;
|
|
6729
6710
|
}, [
|
|
6730
6711
|
l,
|
|
6731
6712
|
n,
|
|
6732
6713
|
r
|
|
6733
6714
|
]);
|
|
6734
6715
|
}
|
|
6735
|
-
var
|
|
6736
|
-
if (e.url ===
|
|
6716
|
+
var so = ({ link: e, includeConsent: t, consent: n }) => {
|
|
6717
|
+
if (e.url === ao) return t ? /* @__PURE__ */ _("li", { children: /* @__PURE__ */ _(Zr, {
|
|
6737
6718
|
triggerType: "footerlink",
|
|
6738
6719
|
triggerText: e.text,
|
|
6739
6720
|
...n
|
|
6740
6721
|
}) }) : null;
|
|
6741
|
-
let r =
|
|
6722
|
+
let r = $a(e.url);
|
|
6742
6723
|
return /* @__PURE__ */ _("li", { children: /* @__PURE__ */ v("a", {
|
|
6743
6724
|
href: e.url,
|
|
6744
6725
|
children: [e.text, r && /* @__PURE__ */ v("span", {
|
|
@@ -6750,15 +6731,15 @@ var co = ({ link: e, includeConsent: t, consent: n }) => {
|
|
|
6750
6731
|
]
|
|
6751
6732
|
})]
|
|
6752
6733
|
}) });
|
|
6753
|
-
},
|
|
6734
|
+
}, co = ({ section: e, includeConsent: t, consent: n }) => /* @__PURE__ */ v("section", { children: [/* @__PURE__ */ _("h2", { children: e.title }), /* @__PURE__ */ _("ul", {
|
|
6754
6735
|
className: "pkt-footer__link-list",
|
|
6755
|
-
children: e.links.map((e) => /* @__PURE__ */ _(
|
|
6736
|
+
children: e.links.map((e) => /* @__PURE__ */ _(so, {
|
|
6756
6737
|
link: e,
|
|
6757
6738
|
includeConsent: t,
|
|
6758
6739
|
consent: n
|
|
6759
6740
|
}, `${e.url}|${e.text}`))
|
|
6760
|
-
})] }),
|
|
6761
|
-
let t =
|
|
6741
|
+
})] }), lo = ({ entry: e }) => {
|
|
6742
|
+
let t = Ka(e.url, e.text);
|
|
6762
6743
|
return t ? /* @__PURE__ */ _("li", { children: /* @__PURE__ */ _("a", {
|
|
6763
6744
|
className: "pkt-footer__some-link",
|
|
6764
6745
|
href: e.url,
|
|
@@ -6771,7 +6752,7 @@ var co = ({ link: e, includeConsent: t, consent: n }) => {
|
|
|
6771
6752
|
href: e.url,
|
|
6772
6753
|
children: e.text
|
|
6773
6754
|
}) });
|
|
6774
|
-
},
|
|
6755
|
+
}, uo = ({ footer: e, includeConsent: t = !1, consent: n = {} }) => {
|
|
6775
6756
|
let r = e.links?.length > 0, i = e.some?.length > 0;
|
|
6776
6757
|
return /* @__PURE__ */ _("div", {
|
|
6777
6758
|
className: "pkt-footer__band pkt-footer__band--global",
|
|
@@ -6779,7 +6760,7 @@ var co = ({ link: e, includeConsent: t, consent: n }) => {
|
|
|
6779
6760
|
className: "pkt-footer__inner",
|
|
6780
6761
|
children: /* @__PURE__ */ v("div", {
|
|
6781
6762
|
className: "pkt-footer__sections",
|
|
6782
|
-
children: [e.sections.map((e) => /* @__PURE__ */ _(
|
|
6763
|
+
children: [e.sections.map((e) => /* @__PURE__ */ _(co, {
|
|
6783
6764
|
section: e,
|
|
6784
6765
|
includeConsent: t,
|
|
6785
6766
|
consent: n
|
|
@@ -6793,14 +6774,14 @@ var co = ({ link: e, includeConsent: t, consent: n }) => {
|
|
|
6793
6774
|
}) }, `${e.url}|${e.text}`))
|
|
6794
6775
|
}), i && /* @__PURE__ */ _("ul", {
|
|
6795
6776
|
className: "pkt-footer__some",
|
|
6796
|
-
children: e.some.map((e) => /* @__PURE__ */ _(
|
|
6777
|
+
children: e.some.map((e) => /* @__PURE__ */ _(lo, { entry: e }, `${e.url}|${e.text}`))
|
|
6797
6778
|
})]
|
|
6798
6779
|
})]
|
|
6799
6780
|
})
|
|
6800
6781
|
})
|
|
6801
6782
|
});
|
|
6802
|
-
},
|
|
6803
|
-
let n = e.openInNewTab || t, r = e.external ?
|
|
6783
|
+
}, fo = ({ link: e, openLinksInNewTab: t }) => {
|
|
6784
|
+
let n = e.openInNewTab || t, r = e.external ? Qa(e.href) : void 0;
|
|
6804
6785
|
return /* @__PURE__ */ _("li", { children: /* @__PURE__ */ v("a", {
|
|
6805
6786
|
href: e.href,
|
|
6806
6787
|
target: n ? "_blank" : "_self",
|
|
@@ -6814,17 +6795,17 @@ var co = ({ link: e, includeConsent: t, consent: n }) => {
|
|
|
6814
6795
|
]
|
|
6815
6796
|
})]
|
|
6816
6797
|
}) });
|
|
6817
|
-
},
|
|
6798
|
+
}, po = ({ column: e, openLinksInNewTab: t }) => /* @__PURE__ */ v("section", { children: [
|
|
6818
6799
|
/* @__PURE__ */ _("h2", { children: e.title }),
|
|
6819
6800
|
e.text && /* @__PURE__ */ _("p", { children: e.text }),
|
|
6820
6801
|
!!e.links?.length && /* @__PURE__ */ _("ul", {
|
|
6821
6802
|
className: "pkt-footer__link-list",
|
|
6822
|
-
children: e.links.map((e) => /* @__PURE__ */ _(
|
|
6803
|
+
children: e.links.map((e) => /* @__PURE__ */ _(fo, {
|
|
6823
6804
|
link: e,
|
|
6824
6805
|
openLinksInNewTab: t
|
|
6825
6806
|
}, `${e.href}|${e.text}`))
|
|
6826
6807
|
})
|
|
6827
|
-
] }),
|
|
6808
|
+
] }), mo = ({ columns: e, columnOne: t, columnTwo: n, personvernOgInfoLink: r, tilgjengelighetLink: i, socialLinks: a, skipGlobal: o = !1, data: s, dataUrl: l, locale: u = "nb-NO", openLinksInNewTab: d = !1, includeConsent: p = !1, hotjarId: m = null, googleAnalyticsId: h = null, devMode: g = !1, cookieDomain: y = null, cookieSecure: b = null, cookieExpiryDays: x = null, onToggleConsent: S, onDataError: C, className: w, ...T }) => {
|
|
6828
6809
|
c(() => {
|
|
6829
6810
|
(t || n) && console.warn("PktFooter: The \"columnOne\"/\"columnTwo\" props are deprecated and will be removed in a future version. Please use \"columns\" instead.");
|
|
6830
6811
|
}, [t, n]), c(() => {
|
|
@@ -6832,7 +6813,7 @@ var co = ({ link: e, includeConsent: t, consent: n }) => {
|
|
|
6832
6813
|
}, [r, i]), c(() => {
|
|
6833
6814
|
a && console.warn("PktFooter: The \"socialLinks\" prop is deprecated and will be removed in a future version — the social media links now come from the global footer.");
|
|
6834
6815
|
}, [a]);
|
|
6835
|
-
let E =
|
|
6816
|
+
let E = oo({
|
|
6836
6817
|
data: s,
|
|
6837
6818
|
dataUrl: l,
|
|
6838
6819
|
locale: u,
|
|
@@ -6875,14 +6856,14 @@ var co = ({ link: e, includeConsent: t, consent: n }) => {
|
|
|
6875
6856
|
children: [
|
|
6876
6857
|
D.length > 0 && /* @__PURE__ */ _("div", {
|
|
6877
6858
|
className: "pkt-footer__sections",
|
|
6878
|
-
children: D.map((e) => /* @__PURE__ */ _(
|
|
6859
|
+
children: D.map((e) => /* @__PURE__ */ _(po, {
|
|
6879
6860
|
column: e,
|
|
6880
6861
|
openLinksInNewTab: d
|
|
6881
6862
|
}, e.title))
|
|
6882
6863
|
}),
|
|
6883
6864
|
k && /* @__PURE__ */ _("div", {
|
|
6884
6865
|
className: "pkt-footer__consent",
|
|
6885
|
-
children: /* @__PURE__ */ _(
|
|
6866
|
+
children: /* @__PURE__ */ _(Zr, {
|
|
6886
6867
|
triggerType: "footerlink",
|
|
6887
6868
|
...O
|
|
6888
6869
|
})
|
|
@@ -6915,14 +6896,14 @@ var co = ({ link: e, includeConsent: t, consent: n }) => {
|
|
|
6915
6896
|
})
|
|
6916
6897
|
]
|
|
6917
6898
|
})
|
|
6918
|
-
}), E && /* @__PURE__ */ _(
|
|
6899
|
+
}), E && /* @__PURE__ */ _(uo, {
|
|
6919
6900
|
footer: E,
|
|
6920
6901
|
includeConsent: p,
|
|
6921
6902
|
consent: O
|
|
6922
6903
|
})]
|
|
6923
6904
|
});
|
|
6924
|
-
},
|
|
6925
|
-
let n = e.openInNewTab || t, r = e.external ?
|
|
6905
|
+
}, ho = ({ link: e, openLinksInNewTab: t }) => {
|
|
6906
|
+
let n = e.openInNewTab || t, r = e.external ? Qa(e.href) : void 0;
|
|
6926
6907
|
return /* @__PURE__ */ v("a", {
|
|
6927
6908
|
className: "pkt-footer-simple__link",
|
|
6928
6909
|
href: e.href,
|
|
@@ -6940,11 +6921,11 @@ var co = ({ link: e, includeConsent: t, consent: n }) => {
|
|
|
6940
6921
|
]
|
|
6941
6922
|
})] })]
|
|
6942
6923
|
});
|
|
6943
|
-
},
|
|
6924
|
+
}, go = ({ links: e, personvernOgInfoLink: t, tilgjengelighetLink: n, skipGlobal: r = !1, data: i, dataUrl: a, locale: o = "nb-NO", openLinksInNewTab: s = !1, includeConsent: l = !1, hotjarId: u = null, googleAnalyticsId: d = null, devMode: p = !1, cookieDomain: m = null, cookieSecure: h = null, cookieExpiryDays: g = null, onToggleConsent: y, onDataError: b, className: x, ...S }) => {
|
|
6944
6925
|
c(() => {
|
|
6945
6926
|
(t || n) && console.warn("PktFooterSimple: The \"personvernOgInfoLink\"/\"tilgjengelighetLink\" props are deprecated — the links now come from the global footer. Overridden values are rendered in the secondary footer.");
|
|
6946
6927
|
}, [t, n]);
|
|
6947
|
-
let C =
|
|
6928
|
+
let C = oo({
|
|
6948
6929
|
data: i,
|
|
6949
6930
|
dataUrl: a,
|
|
6950
6931
|
locale: o,
|
|
@@ -6981,22 +6962,22 @@ var co = ({ link: e, includeConsent: t, consent: n }) => {
|
|
|
6981
6962
|
className: "pkt-footer__inner pkt-footer__inner--compact",
|
|
6982
6963
|
children: /* @__PURE__ */ v("ul", {
|
|
6983
6964
|
className: "pkt-footer-simple__list",
|
|
6984
|
-
children: [w.map((e) => /* @__PURE__ */ _("li", { children: /* @__PURE__ */ _(
|
|
6965
|
+
children: [w.map((e) => /* @__PURE__ */ _("li", { children: /* @__PURE__ */ _(ho, {
|
|
6985
6966
|
link: e,
|
|
6986
6967
|
openLinksInNewTab: s
|
|
6987
|
-
}) }, `${e.href}|${e.text}`)), E && /* @__PURE__ */ _("li", { children: /* @__PURE__ */ _(
|
|
6968
|
+
}) }, `${e.href}|${e.text}`)), E && /* @__PURE__ */ _("li", { children: /* @__PURE__ */ _(Zr, {
|
|
6988
6969
|
triggerType: "footerlink",
|
|
6989
6970
|
...T
|
|
6990
6971
|
}) })]
|
|
6991
6972
|
})
|
|
6992
6973
|
})
|
|
6993
|
-
}), C && /* @__PURE__ */ _(
|
|
6974
|
+
}), C && /* @__PURE__ */ _(uo, {
|
|
6994
6975
|
footer: C,
|
|
6995
6976
|
includeConsent: l,
|
|
6996
6977
|
consent: T
|
|
6997
6978
|
})]
|
|
6998
6979
|
});
|
|
6999
|
-
},
|
|
6980
|
+
}, _o = (e, t) => {
|
|
7000
6981
|
let [n, r] = m(() => typeof window > "u" ? t ?? 0 : t ?? window.innerWidth);
|
|
7001
6982
|
return c(() => {
|
|
7002
6983
|
let t = e.current;
|
|
@@ -7017,10 +6998,10 @@ var co = ({ link: e, includeConsent: t, consent: n }) => {
|
|
|
7017
6998
|
};
|
|
7018
6999
|
//#endregion
|
|
7019
7000
|
//#region src/hooks/useHeaderChrome.ts
|
|
7020
|
-
function
|
|
7001
|
+
function vo({ forwardedRef: e, mobileBreakpoint: t, tabletBreakpoint: n, position: r, scrollBehavior: i, pauseScrollHide: a = !1 }) {
|
|
7021
7002
|
let s = p(null), l = o((t) => {
|
|
7022
7003
|
s.current = t, typeof e == "function" ? e(t) : e && (e.current = t);
|
|
7023
|
-
}, [e]), u =
|
|
7004
|
+
}, [e]), u = _o(s), d = u < t, f = u < n, h = r === "fixed", g = r === "sticky", [_, v] = m(!1), y = p(0), b = i === "hide";
|
|
7024
7005
|
c(() => {
|
|
7025
7006
|
let e = () => {
|
|
7026
7007
|
if (!b || a) return;
|
|
@@ -7050,16 +7031,16 @@ function yo({ forwardedRef: e, mobileBreakpoint: t, tabletBreakpoint: n, positio
|
|
|
7050
7031
|
}
|
|
7051
7032
|
//#endregion
|
|
7052
7033
|
//#region src/hooks/useScrollLock.ts
|
|
7053
|
-
function
|
|
7054
|
-
let t = p(
|
|
7034
|
+
function yo(e) {
|
|
7035
|
+
let t = p(ha());
|
|
7055
7036
|
c(() => {
|
|
7056
7037
|
let n = t.current;
|
|
7057
|
-
return
|
|
7038
|
+
return ga(n, e), () => ga(n, !1);
|
|
7058
7039
|
}, [e]);
|
|
7059
7040
|
}
|
|
7060
7041
|
//#endregion
|
|
7061
7042
|
//#region src/components/header-menu/HeaderMenu.tsx
|
|
7062
|
-
var
|
|
7043
|
+
var bo = ({ dataUrl: e = M, data: t, locale: n = "nb-NO", open: r = !1, mobileBreakpoint: i = 768, className: a, onDataLoaded: s, onDataError: l, ref: u, strings: d, ...h }) => {
|
|
7063
7044
|
let y = ke(["header"], d).header, [b, x] = m("loading"), [S, C] = m(void 0), w = t ? "ready" : b, T = p(s), E = p(l);
|
|
7064
7045
|
c(() => {
|
|
7065
7046
|
T.current = s;
|
|
@@ -7068,19 +7049,19 @@ var xo = ({ dataUrl: e = M, data: t, locale: n = "nb-NO", open: r = !1, mobileBr
|
|
|
7068
7049
|
}, [l]);
|
|
7069
7050
|
let D = p(null), O = o((e) => {
|
|
7070
7051
|
D.current = e, typeof u == "function" ? u(e) : u && (u.current = e);
|
|
7071
|
-
}, [u]), k =
|
|
7052
|
+
}, [u]), k = _o(D) < i;
|
|
7072
7053
|
c(() => {
|
|
7073
7054
|
t && T.current?.(t);
|
|
7074
7055
|
}, [t]), c(() => {
|
|
7075
7056
|
if (t) return;
|
|
7076
7057
|
let n = new AbortController();
|
|
7077
|
-
return
|
|
7058
|
+
return io(e, n.signal).then((e) => {
|
|
7078
7059
|
n.signal.aborted || (C(e), x("ready"), T.current?.(e));
|
|
7079
7060
|
}).catch((e) => {
|
|
7080
7061
|
e.name !== "AbortError" && (x("error"), E.current?.(e));
|
|
7081
7062
|
}), () => n.abort();
|
|
7082
7063
|
}, [t, e]);
|
|
7083
|
-
let A = t ?? S, j = f(() =>
|
|
7064
|
+
let A = t ?? S, j = f(() => Ja(A, n), [A, n]), N = [
|
|
7084
7065
|
"pkt-header-menu",
|
|
7085
7066
|
r && "pkt-header-menu--open",
|
|
7086
7067
|
a
|
|
@@ -7112,28 +7093,28 @@ var xo = ({ dataUrl: e = M, data: t, locale: n = "nb-NO", open: r = !1, mobileBr
|
|
|
7112
7093
|
className: N,
|
|
7113
7094
|
"aria-label": te,
|
|
7114
7095
|
children: [
|
|
7115
|
-
k ? /* @__PURE__ */ _(
|
|
7096
|
+
k ? /* @__PURE__ */ _(So, {
|
|
7116
7097
|
services: P.services,
|
|
7117
7098
|
sections: P.sections
|
|
7118
7099
|
}) : /* @__PURE__ */ v(g, { children: [
|
|
7119
|
-
/* @__PURE__ */ _(
|
|
7120
|
-
/* @__PURE__ */ _(
|
|
7100
|
+
/* @__PURE__ */ _(Co, { services: P.services }),
|
|
7101
|
+
/* @__PURE__ */ _(wo, {
|
|
7121
7102
|
buttons: P.buttons,
|
|
7122
7103
|
mobile: !1
|
|
7123
7104
|
}),
|
|
7124
|
-
/* @__PURE__ */ _(
|
|
7105
|
+
/* @__PURE__ */ _(To, { sections: P.sections })
|
|
7125
7106
|
] }),
|
|
7126
|
-
/* @__PURE__ */ _(
|
|
7107
|
+
/* @__PURE__ */ _(wo, {
|
|
7127
7108
|
buttons: P.buttons,
|
|
7128
7109
|
mobile: !0
|
|
7129
7110
|
}),
|
|
7130
|
-
/* @__PURE__ */ _(
|
|
7111
|
+
/* @__PURE__ */ _(Do, {
|
|
7131
7112
|
links: P.links,
|
|
7132
7113
|
some: P.some
|
|
7133
7114
|
})
|
|
7134
7115
|
]
|
|
7135
7116
|
});
|
|
7136
|
-
},
|
|
7117
|
+
}, xo = ({ services: e }) => /* @__PURE__ */ _("ul", {
|
|
7137
7118
|
className: "pkt-header-menu__services-list",
|
|
7138
7119
|
children: e.links.map((e) => /* @__PURE__ */ _("li", {
|
|
7139
7120
|
className: "pkt-header-menu__service",
|
|
@@ -7142,7 +7123,7 @@ var xo = ({ dataUrl: e = M, data: t, locale: n = "nb-NO", open: r = !1, mobileBr
|
|
|
7142
7123
|
href: e.url,
|
|
7143
7124
|
children: [/* @__PURE__ */ _(J, {
|
|
7144
7125
|
className: "pkt-header-menu__service-icon",
|
|
7145
|
-
name:
|
|
7126
|
+
name: Ua(e.icon),
|
|
7146
7127
|
"aria-hidden": "true"
|
|
7147
7128
|
}), /* @__PURE__ */ _("span", {
|
|
7148
7129
|
className: "pkt-header-menu__service-text",
|
|
@@ -7150,7 +7131,7 @@ var xo = ({ dataUrl: e = M, data: t, locale: n = "nb-NO", open: r = !1, mobileBr
|
|
|
7150
7131
|
})]
|
|
7151
7132
|
})
|
|
7152
7133
|
}, e.url))
|
|
7153
|
-
}),
|
|
7134
|
+
}), So = ({ services: e, sections: t }) => /* @__PURE__ */ _("div", {
|
|
7154
7135
|
className: "pkt-header-menu__sections",
|
|
7155
7136
|
children: /* @__PURE__ */ v(j, {
|
|
7156
7137
|
className: "pkt-header-menu__sections-inner",
|
|
@@ -7161,22 +7142,22 @@ var xo = ({ dataUrl: e = M, data: t, locale: n = "nb-NO", open: r = !1, mobileBr
|
|
|
7161
7142
|
skin: "plus-minus",
|
|
7162
7143
|
id: "pkt-header-menu-services",
|
|
7163
7144
|
title: e.title,
|
|
7164
|
-
children: /* @__PURE__ */ _(
|
|
7145
|
+
children: /* @__PURE__ */ _(xo, { services: e })
|
|
7165
7146
|
}), t.map((e, t) => /* @__PURE__ */ _(ue, {
|
|
7166
7147
|
className: "pkt-header-menu__section",
|
|
7167
7148
|
skin: "plus-minus",
|
|
7168
7149
|
id: `pkt-header-menu-section-${t}`,
|
|
7169
7150
|
title: e.title,
|
|
7170
|
-
children: /* @__PURE__ */ _(
|
|
7151
|
+
children: /* @__PURE__ */ _(Eo, { links: e.links })
|
|
7171
7152
|
}, e.title))]
|
|
7172
7153
|
})
|
|
7173
|
-
}),
|
|
7154
|
+
}), Co = ({ services: e }) => /* @__PURE__ */ v("div", {
|
|
7174
7155
|
className: "pkt-header-menu__services",
|
|
7175
7156
|
children: [/* @__PURE__ */ _("h2", {
|
|
7176
7157
|
className: "pkt-header-menu__services-title",
|
|
7177
7158
|
children: e.title
|
|
7178
|
-
}), /* @__PURE__ */ _(
|
|
7179
|
-
}),
|
|
7159
|
+
}), /* @__PURE__ */ _(xo, { services: e })]
|
|
7160
|
+
}), wo = ({ buttons: e, mobile: t }) => {
|
|
7180
7161
|
if (!e || e.length === 0) return null;
|
|
7181
7162
|
let n = ["pkt-header-menu__buttons", t && "pkt-header-menu__buttons--mobile"].filter(Boolean).join(" ");
|
|
7182
7163
|
return /* @__PURE__ */ _("div", {
|
|
@@ -7186,7 +7167,7 @@ var xo = ({ dataUrl: e = M, data: t, locale: n = "nb-NO", open: r = !1, mobileBr
|
|
|
7186
7167
|
href: e.url,
|
|
7187
7168
|
children: [/* @__PURE__ */ _(J, {
|
|
7188
7169
|
className: "pkt-btn__icon",
|
|
7189
|
-
name: e.iconName ?
|
|
7170
|
+
name: e.iconName ? Ua(e.iconName) : "user",
|
|
7190
7171
|
"aria-hidden": "true"
|
|
7191
7172
|
}), /* @__PURE__ */ _("span", {
|
|
7192
7173
|
className: "pkt-btn__text",
|
|
@@ -7194,7 +7175,7 @@ var xo = ({ dataUrl: e = M, data: t, locale: n = "nb-NO", open: r = !1, mobileBr
|
|
|
7194
7175
|
})]
|
|
7195
7176
|
}, e.url))
|
|
7196
7177
|
});
|
|
7197
|
-
},
|
|
7178
|
+
}, To = ({ sections: e }) => !e || e.length === 0 ? null : /* @__PURE__ */ _("div", {
|
|
7198
7179
|
className: "pkt-header-menu__sections",
|
|
7199
7180
|
children: /* @__PURE__ */ _("div", {
|
|
7200
7181
|
className: "pkt-header-menu__sections-inner",
|
|
@@ -7203,17 +7184,17 @@ var xo = ({ dataUrl: e = M, data: t, locale: n = "nb-NO", open: r = !1, mobileBr
|
|
|
7203
7184
|
children: [/* @__PURE__ */ _("h2", {
|
|
7204
7185
|
className: "pkt-header-menu__section-title",
|
|
7205
7186
|
children: e.title
|
|
7206
|
-
}), /* @__PURE__ */ _(
|
|
7187
|
+
}), /* @__PURE__ */ _(Eo, { links: e.links })]
|
|
7207
7188
|
}, e.title))
|
|
7208
7189
|
})
|
|
7209
|
-
}),
|
|
7190
|
+
}), Eo = ({ links: e }) => /* @__PURE__ */ _("ul", {
|
|
7210
7191
|
className: "pkt-header-menu__section-list",
|
|
7211
7192
|
children: e.map((e) => /* @__PURE__ */ _("li", { children: /* @__PURE__ */ _("a", {
|
|
7212
7193
|
className: "pkt-header-menu__section-link",
|
|
7213
7194
|
href: e.url,
|
|
7214
7195
|
children: e.text
|
|
7215
7196
|
}) }, e.url))
|
|
7216
|
-
}),
|
|
7197
|
+
}), Do = ({ links: e, some: t }) => {
|
|
7217
7198
|
let n = e && e.length > 0, r = t && t.length > 0;
|
|
7218
7199
|
return !n && !r ? null : /* @__PURE__ */ v("div", {
|
|
7219
7200
|
className: "pkt-header-menu__footer",
|
|
@@ -7226,11 +7207,11 @@ var xo = ({ dataUrl: e = M, data: t, locale: n = "nb-NO", open: r = !1, mobileBr
|
|
|
7226
7207
|
}) }, e.url))
|
|
7227
7208
|
}), r && /* @__PURE__ */ _("ul", {
|
|
7228
7209
|
className: "pkt-header-menu__footer-list pkt-header-menu__footer-list--social",
|
|
7229
|
-
children: t.map((e) => /* @__PURE__ */ _(
|
|
7210
|
+
children: t.map((e) => /* @__PURE__ */ _(Oo, { entry: e }, e.url))
|
|
7230
7211
|
})]
|
|
7231
7212
|
});
|
|
7232
|
-
},
|
|
7233
|
-
let t =
|
|
7213
|
+
}, Oo = ({ entry: e }) => {
|
|
7214
|
+
let t = Ka(e.url, e.text);
|
|
7234
7215
|
return /* @__PURE__ */ _("li", { children: /* @__PURE__ */ _("a", {
|
|
7235
7216
|
className: "pkt-header-menu__social-link",
|
|
7236
7217
|
href: e.url,
|
|
@@ -7240,7 +7221,7 @@ var xo = ({ dataUrl: e = M, data: t, locale: n = "nb-NO", open: r = !1, mobileBr
|
|
|
7240
7221
|
"aria-hidden": "true"
|
|
7241
7222
|
}) : /* @__PURE__ */ _("span", { children: e.text })
|
|
7242
7223
|
}) });
|
|
7243
|
-
},
|
|
7224
|
+
}, ko = ({ href: e, iconName: t, className: n, iconPosition: r, external: i, target: a, renderLink: o, children: s, ...c }) => {
|
|
7244
7225
|
let l = {
|
|
7245
7226
|
"pkt-link": !0,
|
|
7246
7227
|
"pkt-link--icon-left": !!t && r === "left" || !!(t && !r),
|
|
@@ -7266,10 +7247,10 @@ var xo = ({ dataUrl: e = M, data: t, locale: n = "nb-NO", open: r = !1, mobileBr
|
|
|
7266
7247
|
}
|
|
7267
7248
|
});
|
|
7268
7249
|
};
|
|
7269
|
-
|
|
7250
|
+
ko.displayName = "PktLink";
|
|
7270
7251
|
//#endregion
|
|
7271
7252
|
//#region src/components/headerUserMenu/UserMenu.tsx
|
|
7272
|
-
var
|
|
7253
|
+
var Ao = (e) => typeof e.target == "string" ? {
|
|
7273
7254
|
title: e.title,
|
|
7274
7255
|
iconName: e.iconName,
|
|
7275
7256
|
href: e.target
|
|
@@ -7277,7 +7258,7 @@ var jo = (e) => typeof e.target == "string" ? {
|
|
|
7277
7258
|
title: e.title,
|
|
7278
7259
|
iconName: e.iconName,
|
|
7279
7260
|
onClick: e.target
|
|
7280
|
-
},
|
|
7261
|
+
}, jo = ({ item: e, className: t }) => "href" in e ? /* @__PURE__ */ _(ko, {
|
|
7281
7262
|
iconName: e.iconName,
|
|
7282
7263
|
href: e.href,
|
|
7283
7264
|
className: (0, z.default)("pkt-user-menu__link", t),
|
|
@@ -7293,14 +7274,14 @@ var jo = (e) => typeof e.target == "string" ? {
|
|
|
7293
7274
|
className: "pkt-link__icon",
|
|
7294
7275
|
"aria-hidden": "true"
|
|
7295
7276
|
}), e.title]
|
|
7296
|
-
}),
|
|
7277
|
+
}), Mo = ({ links: e }) => /* @__PURE__ */ _("ul", {
|
|
7297
7278
|
className: "pkt-user-menu__sublist",
|
|
7298
7279
|
children: Me(e, (e) => `${"href" in e ? e.href : ""}|${e.title}`).map(({ item: e, key: t }) => /* @__PURE__ */ _("li", {
|
|
7299
7280
|
className: "pkt-user-menu__subitem",
|
|
7300
|
-
children: /* @__PURE__ */ _(
|
|
7281
|
+
children: /* @__PURE__ */ _(jo, { item: e })
|
|
7301
7282
|
}, t))
|
|
7302
|
-
}),
|
|
7303
|
-
let l = ke(["header"], e).header, u = i?.map(
|
|
7283
|
+
}), No = i(({ strings: e, user: t, formattedLastLoggedIn: n, representing: r, userMenu: i, canChangeRepresentation: a, changeRepresentation: o, logoutOnClick: s }, c) => {
|
|
7284
|
+
let l = ke(["header"], e).header, u = i?.map(Ao);
|
|
7304
7285
|
return /* @__PURE__ */ _("nav", {
|
|
7305
7286
|
className: "pkt-user-menu",
|
|
7306
7287
|
ref: c,
|
|
@@ -7332,7 +7313,7 @@ var jo = (e) => typeof e.target == "string" ? {
|
|
|
7332
7313
|
}),
|
|
7333
7314
|
u && u.length > 0 && /* @__PURE__ */ _("li", {
|
|
7334
7315
|
className: "pkt-user-menu__item",
|
|
7335
|
-
children: /* @__PURE__ */ _(
|
|
7316
|
+
children: /* @__PURE__ */ _(Mo, { links: u })
|
|
7336
7317
|
}),
|
|
7337
7318
|
r && /* @__PURE__ */ v("li", {
|
|
7338
7319
|
className: "pkt-user-menu__item",
|
|
@@ -7354,7 +7335,7 @@ var jo = (e) => typeof e.target == "string" ? {
|
|
|
7354
7335
|
className: "pkt-user-menu__sublist mt-size-16",
|
|
7355
7336
|
children: /* @__PURE__ */ _("li", {
|
|
7356
7337
|
className: "pkt-user-menu__subitem",
|
|
7357
|
-
children: /* @__PURE__ */ _(
|
|
7338
|
+
children: /* @__PURE__ */ _(jo, { item: {
|
|
7358
7339
|
title: l.changeRepresentation,
|
|
7359
7340
|
iconName: "cogwheel",
|
|
7360
7341
|
onClick: o
|
|
@@ -7369,7 +7350,7 @@ var jo = (e) => typeof e.target == "string" ? {
|
|
|
7369
7350
|
className: "pkt-user-menu__sublist",
|
|
7370
7351
|
children: /* @__PURE__ */ _("li", {
|
|
7371
7352
|
className: "pkt-user-menu__subitem",
|
|
7372
|
-
children: /* @__PURE__ */ _(
|
|
7353
|
+
children: /* @__PURE__ */ _(jo, { item: {
|
|
7373
7354
|
title: l.changeRepresentation,
|
|
7374
7355
|
iconName: "cogwheel",
|
|
7375
7356
|
onClick: o
|
|
@@ -7379,7 +7360,7 @@ var jo = (e) => typeof e.target == "string" ? {
|
|
|
7379
7360
|
}),
|
|
7380
7361
|
s && /* @__PURE__ */ _("li", {
|
|
7381
7362
|
className: "pkt-user-menu__item",
|
|
7382
|
-
children: /* @__PURE__ */ _(
|
|
7363
|
+
children: /* @__PURE__ */ _(jo, { item: {
|
|
7383
7364
|
title: l.logOut,
|
|
7384
7365
|
iconName: "exit",
|
|
7385
7366
|
onClick: s
|
|
@@ -7389,10 +7370,10 @@ var jo = (e) => typeof e.target == "string" ? {
|
|
|
7389
7370
|
})
|
|
7390
7371
|
});
|
|
7391
7372
|
});
|
|
7392
|
-
|
|
7373
|
+
No.displayName = "PktHeaderUserMenu";
|
|
7393
7374
|
//#endregion
|
|
7394
7375
|
//#region src/components/searchinput/SearchInput.tsx
|
|
7395
|
-
var
|
|
7376
|
+
var Po = i(({ appearance: e = "local", inputSize: t = "medium", disabled: n = !1, fullwidth: r = !1, id: i, label: a, name: o, placeholder: s, suggestions: c, value: l = "", action: u, method: d, onChange: p, onSearch: m, onSuggestionClick: h, strings: y, ...b }, x) => {
|
|
7396
7377
|
let S = ke(["searchinput"], y), C = s ?? S.searchinput.placeholder, w = (e, t) => {
|
|
7397
7378
|
e ? e() : h && h(t);
|
|
7398
7379
|
}, T = (e) => {
|
|
@@ -7402,10 +7383,10 @@ var Fo = i(({ appearance: e = "local", inputSize: t = "medium", disabled: n = !1
|
|
|
7402
7383
|
`pkt-searchinput--${e}`,
|
|
7403
7384
|
`pkt-searchinput--${t}`,
|
|
7404
7385
|
r && "pkt-searchinput--fullwidth"
|
|
7405
|
-
].filter(Boolean).join(" "), D = f(() =>
|
|
7386
|
+
].filter(Boolean).join(" "), D = f(() => rr(), []), O = i || D, k = {
|
|
7406
7387
|
role: "search",
|
|
7407
7388
|
className: E,
|
|
7408
|
-
...
|
|
7389
|
+
...ur()
|
|
7409
7390
|
}, A = (e) => u ? /* @__PURE__ */ _("form", {
|
|
7410
7391
|
...k,
|
|
7411
7392
|
action: u,
|
|
@@ -7482,19 +7463,19 @@ var Fo = i(({ appearance: e = "local", inputSize: t = "medium", disabled: n = !1
|
|
|
7482
7463
|
})
|
|
7483
7464
|
] }));
|
|
7484
7465
|
});
|
|
7485
|
-
|
|
7466
|
+
Po.displayName = "PktSearchInput";
|
|
7486
7467
|
//#endregion
|
|
7487
7468
|
//#region src/components/header/HeaderGlobal.tsx
|
|
7488
|
-
var
|
|
7489
|
-
typeof window < "u" && (window.pktLogoPath = window.pktLogoPath ||
|
|
7490
|
-
var
|
|
7469
|
+
var Fo = "https://punkt-cdn.oslo.kommune.no/latest/logos/";
|
|
7470
|
+
typeof window < "u" && (window.pktLogoPath = window.pktLogoPath || Fo);
|
|
7471
|
+
var Io = "pkt-header-global-menu", Lo = "pkt-header-global-menu-toggle", Ro = "pkt-header-global-search-panel", zo = "pkt-header-global-search-toggle", Bo = i(({ className: e, "data-mode": t, dataUrl: n, data: r, locale: i = "nb-NO", logoLink: a = N, logoClick: s, logoPath: l = typeof window < "u" ? window.pktLogoPath : Fo, 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: M, onDataError: P, strings: ee }, te) => {
|
|
7491
7472
|
let F = k === "hide", [I, ne] = m("none"), [re, ie] = m(void 0), [ae, oe] = m(!1), L = p(M), R = p(P);
|
|
7492
7473
|
c(() => {
|
|
7493
7474
|
L.current = M;
|
|
7494
7475
|
}, [M]), c(() => {
|
|
7495
7476
|
R.current = P;
|
|
7496
7477
|
}, [P]);
|
|
7497
|
-
let { setRef: se, isMobile: B, isTablet: V, isFixed: H, isSticky: ce, hidden: le, captureFocus: U, flagRestoreFocus: W, restoreFocus: G } =
|
|
7478
|
+
let { setRef: se, isMobile: B, isTablet: V, isFixed: H, isSticky: ce, hidden: le, captureFocus: U, flagRestoreFocus: W, restoreFocus: G } = vo({
|
|
7498
7479
|
forwardedRef: te,
|
|
7499
7480
|
mobileBreakpoint: A,
|
|
7500
7481
|
tabletBreakpoint: j,
|
|
@@ -7502,13 +7483,13 @@ var Lo = "pkt-header-global-menu", Ro = "pkt-header-global-menu-toggle", zo = "p
|
|
|
7502
7483
|
scrollBehavior: k,
|
|
7503
7484
|
pauseScrollHide: I !== "none"
|
|
7504
7485
|
});
|
|
7505
|
-
|
|
7486
|
+
yo(I === "menu" || I === "search");
|
|
7506
7487
|
let K = p(null), q = o((e) => {
|
|
7507
7488
|
K.current = e, se(e);
|
|
7508
7489
|
}, [se]);
|
|
7509
7490
|
d(() => {
|
|
7510
7491
|
if (I !== "menu" && I !== "search") return;
|
|
7511
|
-
let e = document.getElementById(I === "menu" ?
|
|
7492
|
+
let e = document.getElementById(I === "menu" ? Io : Ro), t = K.current?.getBoundingClientRect();
|
|
7512
7493
|
!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`));
|
|
7513
7494
|
}, [
|
|
7514
7495
|
I,
|
|
@@ -7519,17 +7500,17 @@ var Lo = "pkt-header-global-menu", Ro = "pkt-header-global-menu-toggle", zo = "p
|
|
|
7519
7500
|
}, [r]), c(() => {
|
|
7520
7501
|
if (r) return;
|
|
7521
7502
|
let e = new AbortController();
|
|
7522
|
-
return
|
|
7503
|
+
return io(n, e.signal).then((t) => {
|
|
7523
7504
|
e.signal.aborted || (ie(t), oe(!1), L.current?.(t));
|
|
7524
7505
|
}).catch((e) => {
|
|
7525
7506
|
e.name !== "AbortError" && (oe(!0), R.current?.(e));
|
|
7526
7507
|
}), () => e.abort();
|
|
7527
7508
|
}, [r, n]);
|
|
7528
|
-
let ue = r ?? re, de = f(() =>
|
|
7509
|
+
let ue = r ?? re, de = f(() => Ja(ue, i), [ue, i]);
|
|
7529
7510
|
c(() => {
|
|
7530
7511
|
let e = (e) => {
|
|
7531
7512
|
let t = e.target;
|
|
7532
|
-
I === "user" && !t.closest(".pkt-header-global__user-container") && !t.closest(".pkt-header-global__user-menu") && ne("none"), I === "menu" && !t.closest(".pkt-header-menu") && !t.closest(`#${
|
|
7513
|
+
I === "user" && !t.closest(".pkt-header-global__user-container") && !t.closest(".pkt-header-global__user-menu") && ne("none"), I === "menu" && !t.closest(".pkt-header-menu") && !t.closest(`#${Lo}`) && ne("none"), I === "search" && !t.closest(".pkt-header-global__search-panel-inner") && !t.closest(`#${zo}`) && ne("none");
|
|
7533
7514
|
}, t = (e) => {
|
|
7534
7515
|
e.key === "Escape" && I !== "none" && (e.preventDefault(), W(), ne("none"));
|
|
7535
7516
|
};
|
|
@@ -7543,13 +7524,13 @@ var Lo = "pkt-header-global-menu", Ro = "pkt-header-global-menu-toggle", zo = "p
|
|
|
7543
7524
|
W
|
|
7544
7525
|
]), c(() => {
|
|
7545
7526
|
if (I !== "menu" && I !== "search") return;
|
|
7546
|
-
let e = I === "menu" ?
|
|
7527
|
+
let e = I === "menu" ? Io : Ro, t = I === "menu" ? Lo : zo, n = () => document.getElementById(e), r = () => document.getElementById(t), i = (e) => {
|
|
7547
7528
|
ne("none"), (e.querySelector("button") ?? e).focus();
|
|
7548
7529
|
}, a = (e) => {
|
|
7549
7530
|
if (e.key !== "Tab") return;
|
|
7550
7531
|
let t = n(), a = r();
|
|
7551
7532
|
if (!t || !a) return;
|
|
7552
|
-
let o =
|
|
7533
|
+
let o = Oi(t), s = ki();
|
|
7553
7534
|
if (s && a.contains(s)) {
|
|
7554
7535
|
!e.shiftKey && o.length > 0 && (e.preventDefault(), o[0].focus());
|
|
7555
7536
|
return;
|
|
@@ -7612,7 +7593,7 @@ var Lo = "pkt-header-global-menu", Ro = "pkt-header-global-menu-toggle", zo = "p
|
|
|
7612
7593
|
children: [
|
|
7613
7594
|
!be && xe && he && /* @__PURE__ */ _("div", {
|
|
7614
7595
|
className: "pkt-header-global__search",
|
|
7615
|
-
children: /* @__PURE__ */ _(
|
|
7596
|
+
children: /* @__PURE__ */ _(Po, {
|
|
7616
7597
|
appearance: "global",
|
|
7617
7598
|
inputSize: V ? "small" : "medium",
|
|
7618
7599
|
fullwidth: !0,
|
|
@@ -7627,7 +7608,7 @@ var Lo = "pkt-header-global-menu", Ro = "pkt-header-global-menu-toggle", zo = "p
|
|
|
7627
7608
|
})
|
|
7628
7609
|
}),
|
|
7629
7610
|
be && xe && /* @__PURE__ */ _(Ee, {
|
|
7630
|
-
id:
|
|
7611
|
+
id: zo,
|
|
7631
7612
|
className: "pkt-header-global__search-toggle",
|
|
7632
7613
|
skin: "primary",
|
|
7633
7614
|
color: Z ? void 0 : "yellow",
|
|
@@ -7636,12 +7617,12 @@ var Lo = "pkt-header-global-menu", Ro = "pkt-header-global-menu-toggle", zo = "p
|
|
|
7636
7617
|
size: B ? "small" : "medium",
|
|
7637
7618
|
state: Z ? "active" : "normal",
|
|
7638
7619
|
"aria-expanded": Z,
|
|
7639
|
-
"aria-controls":
|
|
7620
|
+
"aria-controls": Ro,
|
|
7640
7621
|
onClick: () => pe("search"),
|
|
7641
7622
|
children: X
|
|
7642
7623
|
}),
|
|
7643
7624
|
/* @__PURE__ */ _(Ee, {
|
|
7644
|
-
id:
|
|
7625
|
+
id: Lo,
|
|
7645
7626
|
className: "pkt-header-global__menu-toggle",
|
|
7646
7627
|
skin: be ? "tertiary" : "secondary",
|
|
7647
7628
|
variant: be ? "icon-only" : "icon-right",
|
|
@@ -7649,7 +7630,7 @@ var Lo = "pkt-header-global-menu", Ro = "pkt-header-global-menu-toggle", zo = "p
|
|
|
7649
7630
|
size: V ? "small" : "medium",
|
|
7650
7631
|
state: ve ? "active" : "normal",
|
|
7651
7632
|
"aria-expanded": ve,
|
|
7652
|
-
"aria-controls":
|
|
7633
|
+
"aria-controls": Io,
|
|
7653
7634
|
disabled: Se,
|
|
7654
7635
|
onClick: () => pe("menu"),
|
|
7655
7636
|
children: _e
|
|
@@ -7686,7 +7667,7 @@ var Lo = "pkt-header-global-menu", Ro = "pkt-header-global-menu-toggle", zo = "p
|
|
|
7686
7667
|
})]
|
|
7687
7668
|
}), ye && /* @__PURE__ */ _("div", {
|
|
7688
7669
|
className: "pkt-header-global__user-menu is-open",
|
|
7689
|
-
children: /* @__PURE__ */ _(
|
|
7670
|
+
children: /* @__PURE__ */ _(No, {
|
|
7690
7671
|
strings: ee,
|
|
7691
7672
|
user: x,
|
|
7692
7673
|
formattedLastLoggedIn: fe,
|
|
@@ -7702,8 +7683,8 @@ var Lo = "pkt-header-global-menu", Ro = "pkt-header-global-menu-toggle", zo = "p
|
|
|
7702
7683
|
]
|
|
7703
7684
|
}), we = ve && /* @__PURE__ */ _("div", {
|
|
7704
7685
|
className: (0, z.default)("pkt-header-global__menu", B && "pkt-header-global__menu--mobile", V && !B && "pkt-header-global__menu--tablet"),
|
|
7705
|
-
id:
|
|
7706
|
-
children: de ? /* @__PURE__ */ _(
|
|
7686
|
+
id: Io,
|
|
7687
|
+
children: de ? /* @__PURE__ */ _(bo, {
|
|
7707
7688
|
data: ue,
|
|
7708
7689
|
locale: i,
|
|
7709
7690
|
open: !0,
|
|
@@ -7718,10 +7699,10 @@ var Lo = "pkt-header-global-menu", Ro = "pkt-header-global-menu-toggle", zo = "p
|
|
|
7718
7699
|
})
|
|
7719
7700
|
}), Te = Z && xe && he && /* @__PURE__ */ _("div", {
|
|
7720
7701
|
className: (0, z.default)("pkt-header-global__search-panel", B && "pkt-header-global__search-panel--mobile", V && !B && "pkt-header-global__search-panel--tablet"),
|
|
7721
|
-
id:
|
|
7702
|
+
id: Ro,
|
|
7722
7703
|
children: /* @__PURE__ */ _("div", {
|
|
7723
7704
|
className: "pkt-header-global__search-panel-inner",
|
|
7724
|
-
children: /* @__PURE__ */ _(
|
|
7705
|
+
children: /* @__PURE__ */ _(Po, {
|
|
7725
7706
|
appearance: "global",
|
|
7726
7707
|
fullwidth: !0,
|
|
7727
7708
|
id: Q,
|
|
@@ -7750,16 +7731,16 @@ var Lo = "pkt-header-global-menu", Ro = "pkt-header-global-menu-toggle", zo = "p
|
|
|
7750
7731
|
we
|
|
7751
7732
|
] });
|
|
7752
7733
|
});
|
|
7753
|
-
|
|
7734
|
+
Bo.displayName = "PktHeaderGlobal";
|
|
7754
7735
|
//#endregion
|
|
7755
7736
|
//#region src/components/textinput/Textinput.tsx
|
|
7756
|
-
var
|
|
7757
|
-
let V = i ?? (o ?? 0) > 0, H = [s, "pkt-textinput"].filter(Boolean).join(" "), ce = A === "search" && !h && !M, le = A === "date" && N ? N.slice(0, 10) : N, [U, W] = m(0), G = N === void 0 ? U : N?.length || 0, K =
|
|
7737
|
+
var Vo = i(({ id: e, ariaDescribedby: t, ariaLabelledby: n, autocomplete: r = "off", counter: i, hasFieldset: a, counterMaxLength: o, className: s, disabled: c = !1, errorMessage: l, hasError: u = !1, helptext: d, helptextDropdown: f, helptextDropdownButton: p, iconNameRight: h, inline: g = !1, fullwidth: y = !1, label: b, name: x, optionalTag: S = !1, optionalText: C, requiredTag: w = !1, requiredText: T, tagText: E = null, placeholder: D, prefix: O, suffix: k, type: A = "text", useWrapper: j = !0, omitSearchIcon: M = !1, value: N, minLength: P, maxLength: ee, min: te, max: F, step: I, size: ne, readonly: re, required: ie, dataTestid: ae, onChange: oe, skipForwardTestid: L = !1, inputSize: R = "medium", strings: z, ...se }, B) => {
|
|
7738
|
+
let V = i ?? (o ?? 0) > 0, H = [s, "pkt-textinput"].filter(Boolean).join(" "), ce = A === "search" && !h && !M, le = A === "date" && N ? N.slice(0, 10) : N, [U, W] = m(0), G = N === void 0 ? U : N?.length || 0, K = ir(e), q = `${K}`, ue = `${q}-label`, de = n || ue, fe = (e) => {
|
|
7758
7739
|
V && W(e.currentTarget?.value?.length || 0), oe && oe(e);
|
|
7759
7740
|
};
|
|
7760
7741
|
return /* @__PURE__ */ _("div", {
|
|
7761
7742
|
className: H,
|
|
7762
|
-
children: /* @__PURE__ */ _(
|
|
7743
|
+
children: /* @__PURE__ */ _(_r, {
|
|
7763
7744
|
strings: z,
|
|
7764
7745
|
ariaDescribedby: t,
|
|
7765
7746
|
disabled: c,
|
|
@@ -7804,7 +7785,7 @@ var Ho = i(({ id: e, ariaDescribedby: t, ariaLabelledby: n, autocomplete: r = "o
|
|
|
7804
7785
|
disabled: c,
|
|
7805
7786
|
"aria-invalid": u,
|
|
7806
7787
|
"aria-errormessage": u ? `${K}-error` : void 0,
|
|
7807
|
-
"aria-describedby":
|
|
7788
|
+
"aria-describedby": dr({
|
|
7808
7789
|
id: q,
|
|
7809
7790
|
hasHelptext: !!d,
|
|
7810
7791
|
hasCounter: V,
|
|
@@ -7848,12 +7829,12 @@ var Ho = i(({ id: e, ariaDescribedby: t, ariaLabelledby: n, autocomplete: r = "o
|
|
|
7848
7829
|
})
|
|
7849
7830
|
});
|
|
7850
7831
|
});
|
|
7851
|
-
|
|
7832
|
+
Vo.displayName = "PktTextinput";
|
|
7852
7833
|
//#endregion
|
|
7853
7834
|
//#region src/components/header/HeaderService.tsx
|
|
7854
|
-
var
|
|
7855
|
-
typeof window < "u" && (window.pktLogoPath = window.pktLogoPath ||
|
|
7856
|
-
var
|
|
7835
|
+
var Ho = "https://punkt-cdn.oslo.kommune.no/latest/logos/";
|
|
7836
|
+
typeof window < "u" && (window.pktLogoPath = window.pktLogoPath || Ho);
|
|
7837
|
+
var Uo = 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: M = !1, logoLink: P = N, logoClick: ee, logoPath: te = typeof window < "u" ? window.pktLogoPath : Ho, position: F = "fixed", scrollBehavior: I = "hide", slotMenuVariant: ne = "icon-only", slotMenuText: re, strings: ie }, ae) => {
|
|
7857
7838
|
let oe = I === "hide";
|
|
7858
7839
|
c(() => {
|
|
7859
7840
|
O && console.warn("PktHeaderService: The \"userMenuFooter\" prop is deprecated and will be removed in a future version. Please use \"userMenu\" instead.");
|
|
@@ -7872,14 +7853,14 @@ var Wo = i(({ mobileBreakpoint: e = 768, tabletBreakpoint: t = 1280, children: n
|
|
|
7872
7853
|
});
|
|
7873
7854
|
}, [E?.lastLoggedIn]), [B, V] = m(u || "none"), [H, ce] = m(u);
|
|
7874
7855
|
u !== H && (ce(u), u !== void 0 && V(u));
|
|
7875
|
-
let [le, U] = m(!1), [W, G] = m(!1), K = p(null), q = p(null), ue = p(null), de = p(null), fe = p(null), { setRef: pe, isMobile: Y, isTablet: me, isFixed: he, isSticky: ge, hidden: _e, captureFocus: X, flagRestoreFocus: ve, restoreFocus: ye } =
|
|
7856
|
+
let [le, U] = m(!1), [W, G] = m(!1), K = p(null), q = p(null), ue = p(null), de = p(null), fe = p(null), { setRef: pe, isMobile: Y, isTablet: me, isFixed: he, isSticky: ge, hidden: _e, captureFocus: X, flagRestoreFocus: ve, restoreFocus: ye } = vo({
|
|
7876
7857
|
forwardedRef: ae,
|
|
7877
7858
|
mobileBreakpoint: e,
|
|
7878
7859
|
tabletBreakpoint: t,
|
|
7879
7860
|
position: F,
|
|
7880
7861
|
scrollBehavior: I
|
|
7881
7862
|
});
|
|
7882
|
-
|
|
7863
|
+
yo((he || ge) && Y && B !== "none");
|
|
7883
7864
|
let Z = o((e, t) => {
|
|
7884
7865
|
let n = e.relatedTarget, r;
|
|
7885
7866
|
switch (t) {
|
|
@@ -7961,7 +7942,7 @@ var Wo = i(({ mobileBreakpoint: e = 768, tabletBreakpoint: t = 1280, children: n
|
|
|
7961
7942
|
})), T && /* @__PURE__ */ _("span", {
|
|
7962
7943
|
className: "pkt-header-service__service-name",
|
|
7963
7944
|
translate: "no",
|
|
7964
|
-
children: C ? /* @__PURE__ */ _(
|
|
7945
|
+
children: C ? /* @__PURE__ */ _(ko, {
|
|
7965
7946
|
href: C,
|
|
7966
7947
|
className: "pkt-header-service__service-link ",
|
|
7967
7948
|
children: T
|
|
@@ -8024,7 +8005,7 @@ var Wo = i(({ mobileBreakpoint: e = 768, tabletBreakpoint: t = 1280, children: n
|
|
|
8024
8005
|
}), /* @__PURE__ */ _("div", {
|
|
8025
8006
|
className: (0, z.default)("pkt-header-service__mobile-menu", B === "search" && "is-open", W && "align-right"),
|
|
8026
8007
|
ref: fe,
|
|
8027
|
-
children: B === "search" && /* @__PURE__ */ _(
|
|
8008
|
+
children: B === "search" && /* @__PURE__ */ _(Vo, {
|
|
8028
8009
|
id: "mobile-search-menu",
|
|
8029
8010
|
className: "pkt-header-service__search-input",
|
|
8030
8011
|
type: "search",
|
|
@@ -8040,7 +8021,7 @@ var Wo = i(({ mobileBreakpoint: e = 768, tabletBreakpoint: t = 1280, children: n
|
|
|
8040
8021
|
}
|
|
8041
8022
|
})
|
|
8042
8023
|
})]
|
|
8043
|
-
}) : /* @__PURE__ */ _(
|
|
8024
|
+
}) : /* @__PURE__ */ _(Vo, {
|
|
8044
8025
|
id: "header-service-search",
|
|
8045
8026
|
className: "pkt-header-service__search-input",
|
|
8046
8027
|
type: "search",
|
|
@@ -8087,7 +8068,7 @@ var Wo = i(({ mobileBreakpoint: e = 768, tabletBreakpoint: t = 1280, children: n
|
|
|
8087
8068
|
})]
|
|
8088
8069
|
}), B === "user" && E && /* @__PURE__ */ _("div", {
|
|
8089
8070
|
className: (0, z.default)(Y ? "pkt-header-service__mobile-menu" : "pkt-header-service__user-menu", "is-open"),
|
|
8090
|
-
children: /* @__PURE__ */ _(
|
|
8071
|
+
children: /* @__PURE__ */ _(No, {
|
|
8091
8072
|
strings: ie,
|
|
8092
8073
|
user: E,
|
|
8093
8074
|
formattedLastLoggedIn: se,
|
|
@@ -8114,20 +8095,20 @@ var Wo = i(({ mobileBreakpoint: e = 768, tabletBreakpoint: t = 1280, children: n
|
|
|
8114
8095
|
children: [Se, /* @__PURE__ */ _("div", { className: (0, z.default)("pkt-header-service-spacer", i && "pkt-header-service-spacer--compact", E && "pkt-header-service-spacer--has-user", Y && "pkt-header-service-spacer--mobile", me && "pkt-header-service-spacer--tablet") })]
|
|
8115
8096
|
}) : Se;
|
|
8116
8097
|
});
|
|
8117
|
-
|
|
8098
|
+
Uo.displayName = "PktHeaderService";
|
|
8118
8099
|
//#endregion
|
|
8119
8100
|
//#region src/components/header/Header.tsx
|
|
8120
|
-
var
|
|
8101
|
+
var Wo = i((e, t) => e.type === "global" ? /* @__PURE__ */ _(Bo, {
|
|
8121
8102
|
...e,
|
|
8122
8103
|
ref: t
|
|
8123
|
-
}) : /* @__PURE__ */ _(
|
|
8104
|
+
}) : /* @__PURE__ */ _(Uo, {
|
|
8124
8105
|
...e,
|
|
8125
8106
|
ref: t
|
|
8126
8107
|
}));
|
|
8127
|
-
|
|
8108
|
+
Wo.displayName = "PktHeader";
|
|
8128
8109
|
//#endregion
|
|
8129
8110
|
//#region src/components/input/Input.tsx
|
|
8130
|
-
var
|
|
8111
|
+
var Go = i(({ label: e, id: t, children: n, ...r }, i) => /* @__PURE__ */ v("div", {
|
|
8131
8112
|
className: "pkt-form-group",
|
|
8132
8113
|
children: [
|
|
8133
8114
|
/* @__PURE__ */ _("label", {
|
|
@@ -8144,10 +8125,10 @@ var Ko = i(({ label: e, id: t, children: n, ...r }, i) => /* @__PURE__ */ v("div
|
|
|
8144
8125
|
n
|
|
8145
8126
|
]
|
|
8146
8127
|
}));
|
|
8147
|
-
|
|
8128
|
+
Go.displayName = "PktInput";
|
|
8148
8129
|
//#endregion
|
|
8149
8130
|
//#region src/components/linkcard/LinkCard.tsx
|
|
8150
|
-
var
|
|
8131
|
+
var Ko = ({ children: e, skin: t, title: n, href: r, iconName: i, openInNewTab: a, external: o, className: s, strings: c, ...l }) => {
|
|
8151
8132
|
let u = ke(["linkcard"], c), d = ["pkt-linkcard", t && `pkt-linkcard--${t}`].filter(Boolean).join(" "), f = ["pkt-linkcard__title", o && "pkt-link pkt-link--external"].filter(Boolean).join(" ");
|
|
8152
8133
|
return /* @__PURE__ */ v("a", {
|
|
8153
8134
|
...l,
|
|
@@ -8177,14 +8158,14 @@ var qo = ({ children: e, skin: t, title: n, href: r, iconName: i, openInNewTab:
|
|
|
8177
8158
|
};
|
|
8178
8159
|
//#endregion
|
|
8179
8160
|
//#region src/components/loader/Loader.tsx
|
|
8180
|
-
|
|
8181
|
-
var
|
|
8161
|
+
Ko.displayName = "PktLinkCard", typeof window < "u" && (window.pktAnimationPath = window.pktAnimationPath || "https://punkt-cdn.oslo.kommune.no/latest/animations/");
|
|
8162
|
+
var qo = (e) => {
|
|
8182
8163
|
switch (e) {
|
|
8183
8164
|
case "blue": return "spinner-blue";
|
|
8184
8165
|
case "rainbow": return "spinner";
|
|
8185
8166
|
default: return "loader";
|
|
8186
8167
|
}
|
|
8187
|
-
},
|
|
8168
|
+
}, Jo = i(function({ delay: e = 0, inline: t = !1, isLoading: n = !0, message: r = null, size: i = "medium", variant: a = "rainbow", loadingAnimationPath: o = typeof window < "u" ? window.pktAnimationPath : void 0, className: s, children: l, ...u }, d) {
|
|
8188
8169
|
let [f, p] = m(!1), [h, g] = m(e);
|
|
8189
8170
|
e !== h && (g(e), p(!1)), c(() => {
|
|
8190
8171
|
if (e <= 0) return;
|
|
@@ -8202,7 +8183,7 @@ var Jo = (e) => {
|
|
|
8202
8183
|
children: [n && y && /* @__PURE__ */ v("div", {
|
|
8203
8184
|
className: "pkt-loader__spinner",
|
|
8204
8185
|
children: [/* @__PURE__ */ _(J, {
|
|
8205
|
-
name:
|
|
8186
|
+
name: qo(a),
|
|
8206
8187
|
path: o,
|
|
8207
8188
|
className: `pkt-loader__svg pkt-loader__${a}`
|
|
8208
8189
|
}), r && /* @__PURE__ */ _("p", { children: r })]
|
|
@@ -8212,10 +8193,10 @@ var Jo = (e) => {
|
|
|
8212
8193
|
})]
|
|
8213
8194
|
});
|
|
8214
8195
|
});
|
|
8215
|
-
|
|
8196
|
+
Jo.displayName = "PktLoader";
|
|
8216
8197
|
//#endregion
|
|
8217
8198
|
//#region src/components/messagebox/Messagebox.tsx
|
|
8218
|
-
var
|
|
8199
|
+
var Yo = ({ children: e, className: t, skin: n = ie.skin, title: i, compact: a = ie.compact, closable: s = ie.closable, onClose: c, strings: l, ...u }) => {
|
|
8219
8200
|
let d = ke(["generic"], l), [f, p] = m(!1), h = {
|
|
8220
8201
|
"pkt-messagebox": !0,
|
|
8221
8202
|
"pkt-messagebox--compact": a,
|
|
@@ -8253,11 +8234,11 @@ var Xo = ({ children: e, className: t, skin: n = ie.skin, title: i, compact: a =
|
|
|
8253
8234
|
]
|
|
8254
8235
|
});
|
|
8255
8236
|
};
|
|
8256
|
-
|
|
8237
|
+
Yo.displayName = "PktMessagebox";
|
|
8257
8238
|
//#endregion
|
|
8258
8239
|
//#region src/components/radiogroup/RadioGroupContext.ts
|
|
8259
|
-
var
|
|
8260
|
-
let D = ke(["forms"], y), O =
|
|
8240
|
+
var Xo = n(null), Zo = () => s(Xo), Qo = i(({ id: e, name: t, label: n, className: r, hasTile: i = te.hasTile, inputSize: a, disabled: o = te.disabled, checkHelptext: s, hasError: l = te.hasError, defaultChecked: u, checked: d, optionalTag: f, optionalText: p, requiredTag: m, requiredText: h, strings: y, tagText: b, value: x, required: S, onChange: C, "aria-describedby": w, ...T }, E) => {
|
|
8241
|
+
let D = ke(["forms"], y), O = ir(e), k = Zo(), A = x ?? "on", j = k?.value, M = j !== void 0, N = M ? j === A : d, P = u ?? (k?.defaultValue === void 0 ? void 0 : k.defaultValue === A), ee = i || !!k?.hasTile, F = l || !!k?.hasError, I = o || !!k?.disabled;
|
|
8261
8242
|
c(() => {
|
|
8262
8243
|
M && d !== void 0 && console.warn(`PktRadioButton (${O}): checked ignoreres når PktRadioGroup har value. Styr valget med value på gruppen.`);
|
|
8263
8244
|
}, [
|
|
@@ -8330,11 +8311,11 @@ var Zo = n(null), Qo = () => s(Zo), $o = i(({ id: e, name: t, label: n, classNam
|
|
|
8330
8311
|
})
|
|
8331
8312
|
});
|
|
8332
8313
|
});
|
|
8333
|
-
|
|
8314
|
+
Qo.displayName = "PktRadioButton";
|
|
8334
8315
|
//#endregion
|
|
8335
8316
|
//#region src/components/radiogroup/RadioGroup.tsx
|
|
8336
|
-
var
|
|
8337
|
-
let j =
|
|
8317
|
+
var $o = i(({ id: e, name: t, label: n, helptext: r, helptextDropdown: i, helptextDropdownButton: a, value: o, defaultValue: s, layout: c = F.layout, inputSize: l = F.inputSize, hasTile: u = F.hasTile, required: d = F.required, disabled: p = F.disabled, hasError: m = F.hasError, errorMessage: h, useWrapper: g = F.useWrapper, optionalTag: v = F.optionalTag, optionalText: y, requiredTag: b = F.requiredTag, requiredText: x, tagText: S, strings: C, className: w, children: T, onChange: E, onValueChange: D, onFocus: O, onBlur: k }, A) => {
|
|
8318
|
+
let j = ir(e), M = t || j, N = lr({
|
|
8338
8319
|
type: "radio",
|
|
8339
8320
|
name: M,
|
|
8340
8321
|
forwardedRef: A,
|
|
@@ -8361,9 +8342,9 @@ var es = i(({ id: e, name: t, label: n, helptext: r, helptextDropdown: i, helpte
|
|
|
8361
8342
|
s,
|
|
8362
8343
|
N
|
|
8363
8344
|
]);
|
|
8364
|
-
return /* @__PURE__ */ _(
|
|
8345
|
+
return /* @__PURE__ */ _(Xo.Provider, {
|
|
8365
8346
|
value: P,
|
|
8366
|
-
children: /* @__PURE__ */ _(
|
|
8347
|
+
children: /* @__PURE__ */ _(_r, {
|
|
8367
8348
|
ref: N.mergedRef,
|
|
8368
8349
|
onFocus: N.onRootFocus,
|
|
8369
8350
|
onBlur: N.onRootBlur,
|
|
@@ -8391,14 +8372,14 @@ var es = i(({ id: e, name: t, label: n, helptext: r, helptextDropdown: i, helpte
|
|
|
8391
8372
|
})
|
|
8392
8373
|
});
|
|
8393
8374
|
});
|
|
8394
|
-
|
|
8375
|
+
$o.displayName = "PktRadioGroup";
|
|
8395
8376
|
//#endregion
|
|
8396
8377
|
//#region src/components/select/Select.tsx
|
|
8397
|
-
var
|
|
8398
|
-
let D =
|
|
8378
|
+
var es = i(({ ariaDescribedby: e, ariaLabelledby: t, children: n, className: r, disabled: i = L.disabled, errorMessage: a, hasError: o = L.hasError, helptext: s, helptextDropdown: c, helptextDropdownButton: l, id: u, inline: d = L.inline, fullwidth: f = L.fullwidth, label: p, name: m, optionalTag: h = L.optionalTag, optionalText: g, requiredTag: v = L.requiredTag, requiredText: y, tagText: b, useWrapper: x = L.useWrapper, hasFieldset: S, inputSize: C = L.inputSize, strings: w, ...T }, E) => {
|
|
8379
|
+
let D = ir(u), O = [r, "pkt-select"].filter(Boolean).join(" ");
|
|
8399
8380
|
return /* @__PURE__ */ _("div", {
|
|
8400
8381
|
className: O,
|
|
8401
|
-
children: /* @__PURE__ */ _(
|
|
8382
|
+
children: /* @__PURE__ */ _(_r, {
|
|
8402
8383
|
strings: w,
|
|
8403
8384
|
forId: `${D}-input`,
|
|
8404
8385
|
label: p,
|
|
@@ -8423,7 +8404,7 @@ var ts = i(({ ariaDescribedby: e, ariaLabelledby: t, children: n, className: r,
|
|
|
8423
8404
|
className: `pkt-input pkt-input--${C} ${f ? "pkt-input--fullwidth" : ""}`,
|
|
8424
8405
|
"aria-invalid": o,
|
|
8425
8406
|
"aria-errormessage": o ? `${D}-error` : void 0,
|
|
8426
|
-
"aria-describedby":
|
|
8407
|
+
"aria-describedby": dr({
|
|
8427
8408
|
id: `${D}-input`,
|
|
8428
8409
|
hasHelptext: !!s,
|
|
8429
8410
|
hasCounter: !1,
|
|
@@ -8439,10 +8420,10 @@ var ts = i(({ ariaDescribedby: e, ariaLabelledby: t, children: n, className: r,
|
|
|
8439
8420
|
})
|
|
8440
8421
|
});
|
|
8441
8422
|
});
|
|
8442
|
-
|
|
8423
|
+
es.displayName = "PktSelect";
|
|
8443
8424
|
//#endregion
|
|
8444
8425
|
//#region src/components/stepper/Step.tsx
|
|
8445
|
-
var
|
|
8426
|
+
var ts = /* @__PURE__ */ _("svg", {
|
|
8446
8427
|
xmlns: "http://www.w3.org/2000/svg",
|
|
8447
8428
|
width: "24",
|
|
8448
8429
|
height: "24",
|
|
@@ -8453,7 +8434,7 @@ var ns = /* @__PURE__ */ _("svg", {
|
|
|
8453
8434
|
r: "7",
|
|
8454
8435
|
style: { fill: "var(--pkt-color-brand-neutrals-300, #CCC)" }
|
|
8455
8436
|
})
|
|
8456
|
-
}),
|
|
8437
|
+
}), ns = /* @__PURE__ */ v("svg", {
|
|
8457
8438
|
xmlns: "http://www.w3.org/2000/svg",
|
|
8458
8439
|
width: "24",
|
|
8459
8440
|
height: "24",
|
|
@@ -8470,7 +8451,7 @@ var ns = /* @__PURE__ */ _("svg", {
|
|
|
8470
8451
|
r: "6",
|
|
8471
8452
|
fill: "#2A2859"
|
|
8472
8453
|
})]
|
|
8473
|
-
}),
|
|
8454
|
+
}), rs = /* @__PURE__ */ v("svg", {
|
|
8474
8455
|
xmlns: "http://www.w3.org/2000/svg",
|
|
8475
8456
|
width: "24",
|
|
8476
8457
|
height: "24",
|
|
@@ -8482,7 +8463,7 @@ var ns = /* @__PURE__ */ _("svg", {
|
|
|
8482
8463
|
d: "m10.34 16-1.11-1.14L7 12.58l1.11-1.15 2.23 2.28L15.88 8 17 9.15l-5.55 5.71L10.34 16Z",
|
|
8483
8464
|
fill: "#F1FDFF"
|
|
8484
8465
|
})]
|
|
8485
|
-
}),
|
|
8466
|
+
}), is = ({ children: e, className: t, status: n = "incomplete", title: r }) => /* @__PURE__ */ v("li", {
|
|
8486
8467
|
className: (0, z.default)("pkt-step", t, `pkt-step--${n}`),
|
|
8487
8468
|
"data-testid": "pkt-step",
|
|
8488
8469
|
children: [
|
|
@@ -8496,7 +8477,7 @@ var ns = /* @__PURE__ */ _("svg", {
|
|
|
8496
8477
|
}),
|
|
8497
8478
|
/* @__PURE__ */ _("span", {
|
|
8498
8479
|
className: (0, z.default)("pkt-step__indicator"),
|
|
8499
|
-
children: n === "current" ?
|
|
8480
|
+
children: n === "current" ? ns : n === "completed" ? rs : ts
|
|
8500
8481
|
}),
|
|
8501
8482
|
/* @__PURE__ */ _("span", {
|
|
8502
8483
|
className: "pkt-step__line pkt-step__line--3",
|
|
@@ -8513,7 +8494,7 @@ var ns = /* @__PURE__ */ _("svg", {
|
|
|
8513
8494
|
})]
|
|
8514
8495
|
})
|
|
8515
8496
|
]
|
|
8516
|
-
}),
|
|
8497
|
+
}), as = i(({ activeStep: n, className: r, children: i, hideNonActiveSteps: o = !1, hideNonActiveStepsContent: s = !0, orientation: c = "vertical", ...l }, u) => {
|
|
8517
8498
|
let d = (0, z.default)(r, "pkt-stepper", c === "horizontal" ? "pkt-stepper--horizontal" : "pkt-stepper--vertical"), f = e.map(i, (e, r) => a(e) ? t(e, { className: (0, z.default)(e.props.className, {
|
|
8518
8499
|
"pkt-step--hideStep": o && r !== n,
|
|
8519
8500
|
"pkt-step--hideContent": s && r !== n
|
|
@@ -8526,10 +8507,10 @@ var ns = /* @__PURE__ */ _("svg", {
|
|
|
8526
8507
|
children: f
|
|
8527
8508
|
});
|
|
8528
8509
|
});
|
|
8529
|
-
|
|
8510
|
+
as.displayName = "PktStepper";
|
|
8530
8511
|
//#endregion
|
|
8531
8512
|
//#region src/components/table/Table.tsx
|
|
8532
|
-
var
|
|
8513
|
+
var os = ({ className: e, compact: t = R.compact, skin: n = R.skin, responsiveView: r = R.responsiveView, children: i, ...a }) => /* @__PURE__ */ _("table", {
|
|
8533
8514
|
"data-testid": "pkt-table",
|
|
8534
8515
|
className: (0, z.default)(e, "pkt-table", {
|
|
8535
8516
|
"pkt-table--responsive": r,
|
|
@@ -8540,36 +8521,36 @@ var ss = ({ className: e, compact: t = R.compact, skin: n = R.skin, responsiveVi
|
|
|
8540
8521
|
role: "table",
|
|
8541
8522
|
...a,
|
|
8542
8523
|
children: i
|
|
8543
|
-
}),
|
|
8524
|
+
}), ss = ({ id: e, children: t, className: n, ...r }) => /* @__PURE__ */ _("tbody", {
|
|
8544
8525
|
id: e,
|
|
8545
8526
|
className: (0, z.default)(n, "pkt-table__body", {}),
|
|
8546
8527
|
role: "rowgroup",
|
|
8547
8528
|
...r,
|
|
8548
8529
|
children: t
|
|
8549
|
-
}),
|
|
8530
|
+
}), cs = ({ children: e, className: t, dataLabel: n, ...r }) => /* @__PURE__ */ _("td", {
|
|
8550
8531
|
className: (0, z.default)(t, "pkt-table__data-cell", {}),
|
|
8551
8532
|
"data-label": n,
|
|
8552
8533
|
role: "cell",
|
|
8553
8534
|
"data-testid": "pkt-table__data-cell",
|
|
8554
8535
|
...r,
|
|
8555
8536
|
children: e
|
|
8556
|
-
}),
|
|
8537
|
+
}), ls = ({ className: e, children: t, ...n }) => /* @__PURE__ */ _("thead", {
|
|
8557
8538
|
className: (0, z.default)(e, "pkt-table__header", {}),
|
|
8558
8539
|
role: "rowgroup",
|
|
8559
8540
|
...n,
|
|
8560
8541
|
children: t
|
|
8561
|
-
}),
|
|
8542
|
+
}), us = ({ className: e, children: t, ...n }) => /* @__PURE__ */ _("th", {
|
|
8562
8543
|
className: (0, z.default)(e, "pkt-table__header-cell", {}),
|
|
8563
8544
|
role: "columnheader",
|
|
8564
8545
|
...n,
|
|
8565
8546
|
children: t
|
|
8566
|
-
}),
|
|
8547
|
+
}), ds = ({ className: e, children: t, ...n }) => /* @__PURE__ */ _("tr", {
|
|
8567
8548
|
className: (0, z.default)(e, "pkt-table__row", {}),
|
|
8568
8549
|
role: "row",
|
|
8569
8550
|
...n,
|
|
8570
8551
|
children: t
|
|
8571
|
-
}),
|
|
8572
|
-
let { arrowNav: d, registerTabRef: f, handleKeyPress: p, selectTab: m } =
|
|
8552
|
+
}), fs = i(({ children: e, active: t, disabled: n = !1, href: r, onClick: i, icon: a, controls: o, tag: s, tagSkin: c, index: l = 0 }, u) => {
|
|
8553
|
+
let { arrowNav: d, registerTabRef: f, handleKeyPress: p, selectTab: m } = ms(), h = !!t && !n, y = {
|
|
8573
8554
|
"aria-selected": d ? h : void 0,
|
|
8574
8555
|
"aria-controls": o,
|
|
8575
8556
|
role: d ? "tab" : void 0,
|
|
@@ -8597,7 +8578,7 @@ var ss = ({ className: e, compact: t = R.compact, skin: n = R.skin, responsiveVi
|
|
|
8597
8578
|
className: `pkt-icon--small ${a === "check" ? "pkt-tabs__status-icon" : ""}`
|
|
8598
8579
|
}),
|
|
8599
8580
|
e,
|
|
8600
|
-
s && /* @__PURE__ */ _(
|
|
8581
|
+
s && /* @__PURE__ */ _(er, {
|
|
8601
8582
|
skin: c,
|
|
8602
8583
|
size: "small",
|
|
8603
8584
|
children: s
|
|
@@ -8618,14 +8599,14 @@ var ss = ({ className: e, compact: t = R.compact, skin: n = R.skin, responsiveVi
|
|
|
8618
8599
|
children: b
|
|
8619
8600
|
});
|
|
8620
8601
|
});
|
|
8621
|
-
|
|
8602
|
+
fs.displayName = "PktTabItem";
|
|
8622
8603
|
//#endregion
|
|
8623
8604
|
//#region src/components/tabs/Tabs.tsx
|
|
8624
|
-
var
|
|
8625
|
-
let e = s(
|
|
8605
|
+
var ps = n(null), ms = () => {
|
|
8606
|
+
let e = s(ps);
|
|
8626
8607
|
if (!e) throw Error("TabItem must be used within a Tabs component");
|
|
8627
8608
|
return e;
|
|
8628
|
-
},
|
|
8609
|
+
}, hs = i(({ arrowNav: t = !0, disableArrowNav: n = !1, separatorIconName: r, separatorIconPath: i, tabs: a, onTabSelected: o, children: s }, l) => {
|
|
8629
8610
|
let u = p([]), d = p({}), f = t && !n, m = e.toArray(s), h = m.length > 0, g = h ? m.length : a?.length || 0, v = !!(r || i);
|
|
8630
8611
|
c(() => {
|
|
8631
8612
|
u.current = u.current.slice(0, g), Object.keys(d.current).forEach((e) => {
|
|
@@ -8672,7 +8653,7 @@ var ms = n(null), hs = () => {
|
|
|
8672
8653
|
name: r,
|
|
8673
8654
|
className: "pkt-tabs__separator-icon"
|
|
8674
8655
|
}) : null
|
|
8675
|
-
}, e), T = (e) => !v || e.length <= 1 ? e : e.flatMap((t, n) => n < e.length - 1 ? [t, w(`separator-${n}`)] : [t]), E = Me(a ?? [], (e) => `${e.href ?? ""}|${e.text}`).map(({ item: e, key: t }, n) => /* @__PURE__ */ _(
|
|
8656
|
+
}, e), T = (e) => !v || e.length <= 1 ? e : e.flatMap((t, n) => n < e.length - 1 ? [t, w(`separator-${n}`)] : [t]), E = Me(a ?? [], (e) => `${e.href ?? ""}|${e.text}`).map(({ item: e, key: t }, n) => /* @__PURE__ */ _(fs, {
|
|
8676
8657
|
active: !e.disabled && e.active,
|
|
8677
8658
|
disabled: e.disabled,
|
|
8678
8659
|
href: e.href,
|
|
@@ -8683,7 +8664,7 @@ var ms = n(null), hs = () => {
|
|
|
8683
8664
|
index: n,
|
|
8684
8665
|
children: e.text
|
|
8685
8666
|
}, t)), D = ["pkt-tabs", v && "pkt-tabs--with-separator"].filter(Boolean).join(" "), O = T(h ? m : E || []);
|
|
8686
|
-
return /* @__PURE__ */ _(
|
|
8667
|
+
return /* @__PURE__ */ _(ps.Provider, {
|
|
8687
8668
|
value: {
|
|
8688
8669
|
arrowNav: f,
|
|
8689
8670
|
registerTabRef: C,
|
|
@@ -8701,53 +8682,53 @@ var ms = n(null), hs = () => {
|
|
|
8701
8682
|
})
|
|
8702
8683
|
});
|
|
8703
8684
|
});
|
|
8704
|
-
|
|
8685
|
+
hs.displayName = "PktTabs";
|
|
8705
8686
|
//#endregion
|
|
8706
8687
|
//#region ../../shared-utils/timepicker/options.ts
|
|
8707
|
-
var
|
|
8688
|
+
var gs = (e) => e ? Math.max(1, Math.round(e / 60)) : 1, _s = (e, t) => {
|
|
8708
8689
|
let n = e ? parseInt(String(e).split(":")[0], 10) : 0, r = t ? parseInt(String(t).split(":")[0], 10) : 23;
|
|
8709
8690
|
return Array.from({ length: r - n + 1 }, (e, t) => t + n);
|
|
8710
|
-
},
|
|
8711
|
-
let t =
|
|
8691
|
+
}, vs = (e) => {
|
|
8692
|
+
let t = gs(e);
|
|
8712
8693
|
return Array.from({ length: Math.floor(60 / t) }, (e, n) => n * t);
|
|
8713
|
-
},
|
|
8694
|
+
}, ys = (e, t, n, r) => {
|
|
8714
8695
|
let i = e === "" ? n === 1 ? 0 : 23 : parseInt(e, 10), a = t === "" ? n === 1 ? 0 : Math.floor(59 / r) * r : parseInt(t, 10);
|
|
8715
8696
|
return a += n * r, a > 59 ? (a = 0, i = (i + 1) % 24) : a < 0 && (a = Math.floor(59 / r) * r, i = (i - 1 + 24) % 24), {
|
|
8716
8697
|
hours: String(i).padStart(2, "0"),
|
|
8717
8698
|
minutes: String(a).padStart(2, "0")
|
|
8718
8699
|
};
|
|
8719
|
-
},
|
|
8700
|
+
}, bs = (e) => /^\d{2}:\d{2}$/.test(e) && parseInt(e.slice(0, 2), 10) <= 23 && parseInt(e.slice(3), 10) <= 59, xs = (e) => {
|
|
8720
8701
|
let [t, n] = e.split(":").map(Number);
|
|
8721
8702
|
return t * 60 + n;
|
|
8722
8703
|
};
|
|
8723
8704
|
//#endregion
|
|
8724
8705
|
//#region src/components/timepicker/useTimepickerState.ts
|
|
8725
|
-
function
|
|
8726
|
-
if (e &&
|
|
8706
|
+
function Ss(e) {
|
|
8707
|
+
if (e && bs(e)) {
|
|
8727
8708
|
let [t, n] = e.split(":");
|
|
8728
8709
|
return [t, n];
|
|
8729
8710
|
}
|
|
8730
8711
|
return ["", ""];
|
|
8731
8712
|
}
|
|
8732
|
-
function
|
|
8713
|
+
function Cs(e, t) {
|
|
8733
8714
|
return `${String(parseInt(e, 10)).padStart(2, "0")}:${String(parseInt(t, 10)).padStart(2, "0")}`;
|
|
8734
8715
|
}
|
|
8735
|
-
function
|
|
8716
|
+
function ws(e, t, n) {
|
|
8736
8717
|
let { required: r, min: i, max: a, step: o } = t;
|
|
8737
8718
|
if (r && !e) return {
|
|
8738
8719
|
valid: !1,
|
|
8739
8720
|
message: n.valueMissing
|
|
8740
8721
|
};
|
|
8741
8722
|
if (!e) return { valid: !0 };
|
|
8742
|
-
if (!
|
|
8723
|
+
if (!bs(e)) return {
|
|
8743
8724
|
valid: !1,
|
|
8744
8725
|
message: n.typeMismatch
|
|
8745
8726
|
};
|
|
8746
|
-
let s =
|
|
8747
|
-
return i && s <
|
|
8727
|
+
let s = xs(e), c = gs(o);
|
|
8728
|
+
return i && s < xs(String(i)) ? {
|
|
8748
8729
|
valid: !1,
|
|
8749
8730
|
message: pe(n.rangeUnderflowMin, { min: String(i) })
|
|
8750
|
-
} : a && s >
|
|
8731
|
+
} : a && s > xs(String(a)) ? {
|
|
8751
8732
|
valid: !1,
|
|
8752
8733
|
message: pe(n.rangeOverflowMax, { max: String(a) })
|
|
8753
8734
|
} : o && s % c !== 0 ? {
|
|
@@ -8755,24 +8736,24 @@ function Ts(e, t, n) {
|
|
|
8755
8736
|
message: c === 60 ? n.timeStepMismatchHour : c === 30 ? n.timeStepMismatchHalfHour : pe(n.timeStepMismatch, { step: `${c}, ${c * 2}, ${c * 3}` })
|
|
8756
8737
|
} : { valid: !0 };
|
|
8757
8738
|
}
|
|
8758
|
-
function
|
|
8739
|
+
function Ts(e) {
|
|
8759
8740
|
return e === 3600 || e < 3600 && 3600 % e == 0 && e % 60 == 0;
|
|
8760
8741
|
}
|
|
8761
|
-
function
|
|
8762
|
-
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, form: b, disabled: x = !1, required: S = !1, helptext: C, helptextDropdown: w, helptextDropdownButton: T, hasError: E = !1, errorMessage: D, optionalTag: O = !1, optionalText: k, requiredTag: A = !1, requiredText: j, tagText: M, inline: N = !1, useWrapper: P = !0, ariaDescribedby: ee, strings: te, className: F, inputSize: I = "medium", onValueChange: ne, onFocus: re, onBlur: ie } = e, ae = ke(["timepicker", "validation"], te), oe = ae.timepicker, L = te, R = i !== void 0, z = i === void 0 ? a ?? "" : i ?? "", se = p(z), [B, V] = m(() => z), H = R ? i ?? "" : B, [ce, le] = m(() =>
|
|
8742
|
+
function Es(e, t) {
|
|
8743
|
+
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, form: b, disabled: x = !1, required: S = !1, helptext: C, helptextDropdown: w, helptextDropdownButton: T, hasError: E = !1, errorMessage: D, optionalTag: O = !1, optionalText: k, requiredTag: A = !1, requiredText: j, tagText: M, inline: N = !1, useWrapper: P = !0, ariaDescribedby: ee, strings: te, className: F, inputSize: I = "medium", onValueChange: ne, onFocus: re, onBlur: ie } = e, ae = ke(["timepicker", "validation"], te), oe = ae.timepicker, L = te, R = i !== void 0, z = i === void 0 ? a ?? "" : i ?? "", se = p(z), [B, V] = m(() => z), H = R ? i ?? "" : B, [ce, le] = m(() => Ss(i === void 0 ? a : i)[0]), [U, W] = m(() => Ss(i === void 0 ? a : i)[1]), G = p(ce), K = p(U), q = o((e) => {
|
|
8763
8744
|
G.current = e, le(e);
|
|
8764
8745
|
}, []), J = o((e) => {
|
|
8765
8746
|
K.current = e, W(e);
|
|
8766
8747
|
}, []), [ue, de] = m(!1), [fe, pe] = m(i);
|
|
8767
8748
|
if (R && i !== fe) {
|
|
8768
8749
|
pe(i);
|
|
8769
|
-
let [e, t] =
|
|
8750
|
+
let [e, t] = Ss(i);
|
|
8770
8751
|
q(e), J(t);
|
|
8771
8752
|
}
|
|
8772
8753
|
c(() => {
|
|
8773
|
-
h != null && !
|
|
8754
|
+
h != null && !Ts(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).`);
|
|
8774
8755
|
}, [h]);
|
|
8775
|
-
let Y = p(null), me = p(null), he = p(null), ge = p(null), _e = p(null), X = p(null), ve =
|
|
8756
|
+
let Y = p(null), me = p(null), he = p(null), ge = p(null), _e = p(null), X = p(null), ve = Ur(_e, b), ye = p(0), Z = p(-1), be = p(0), xe = p(-1), [Q, Se] = m(!1), Ce = f(() => Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value")?.set, []), we = f(() => gs(h), [h]), Te = f(() => _s(s, l), [s, l]), Ee = f(() => vs(h), [h]), De = `${n}-hours`, Oe = `${n}-minutes`, Ae = `${n}-popup`, je = `${n}-input`, Me = f(() => ws(H, {
|
|
8776
8757
|
required: S,
|
|
8777
8758
|
min: s,
|
|
8778
8759
|
max: l,
|
|
@@ -8799,20 +8780,20 @@ function Ds(e, t) {
|
|
|
8799
8780
|
]), Pe = o(() => {
|
|
8800
8781
|
let e = G.current, t = K.current;
|
|
8801
8782
|
if (e !== "" && t !== "") {
|
|
8802
|
-
let n =
|
|
8783
|
+
let n = Cs(e, t);
|
|
8803
8784
|
n !== H && $(n);
|
|
8804
8785
|
} else H !== "" && $("");
|
|
8805
8786
|
}, [H, $]), Fe = o(() => {
|
|
8806
8787
|
let e = G.current, t = K.current;
|
|
8807
8788
|
if (e !== "" && t !== "") {
|
|
8808
|
-
let n =
|
|
8789
|
+
let n = Cs(e, t);
|
|
8809
8790
|
n === H ? X.current?.dispatchEvent(new Event("input", { bubbles: !0 })) : $(n);
|
|
8810
8791
|
} else H === "" ? X.current?.dispatchEvent(new Event("input", { bubbles: !0 })) : $("");
|
|
8811
8792
|
}, [H, $]), Ie = o(() => {
|
|
8812
8793
|
Se(!0), Pe();
|
|
8813
8794
|
let e = Y.current, t = X.current;
|
|
8814
8795
|
if (!e) return;
|
|
8815
|
-
let n =
|
|
8796
|
+
let n = ws(t?.value ?? "", {
|
|
8816
8797
|
required: S,
|
|
8817
8798
|
min: s,
|
|
8818
8799
|
max: l,
|
|
@@ -8885,7 +8866,7 @@ function Ds(e, t) {
|
|
|
8885
8866
|
q,
|
|
8886
8867
|
J
|
|
8887
8868
|
]), Be = o((e) => {
|
|
8888
|
-
let t =
|
|
8869
|
+
let t = ys(G.current, K.current, e, we);
|
|
8889
8870
|
q(t.hours), J(t.minutes), `${t.hours}:${t.minutes}` !== H && $(`${t.hours}:${t.minutes}`);
|
|
8890
8871
|
}, [
|
|
8891
8872
|
we,
|
|
@@ -9103,7 +9084,7 @@ function Ds(e, t) {
|
|
|
9103
9084
|
set value(e) {
|
|
9104
9085
|
let t = e ?? "";
|
|
9105
9086
|
R || V(t);
|
|
9106
|
-
let [n, r] =
|
|
9087
|
+
let [n, r] = Ss(t);
|
|
9107
9088
|
q(n), J(r), X.current && (X.current.value = t);
|
|
9108
9089
|
},
|
|
9109
9090
|
focus() {
|
|
@@ -9120,7 +9101,7 @@ function Ds(e, t) {
|
|
|
9120
9101
|
if (!ve) return;
|
|
9121
9102
|
let e, t = () => {
|
|
9122
9103
|
window.clearTimeout(e), e = window.setTimeout(() => {
|
|
9123
|
-
let e = se.current, [t, n] =
|
|
9104
|
+
let e = se.current, [t, n] = Ss(e);
|
|
9124
9105
|
q(t), J(n), R || V(e), X.current && (X.current.value = e), de(!1), Se(!1);
|
|
9125
9106
|
}, 0);
|
|
9126
9107
|
};
|
|
@@ -9200,8 +9181,8 @@ function Ds(e, t) {
|
|
|
9200
9181
|
}
|
|
9201
9182
|
//#endregion
|
|
9202
9183
|
//#region src/components/timepicker/Timepicker.tsx
|
|
9203
|
-
var
|
|
9204
|
-
let { onChange: n, inputSize: r = "medium" } = e, i =
|
|
9184
|
+
var Ds = i((e, t) => {
|
|
9185
|
+
let { onChange: n, inputSize: r = "medium" } = e, i = Es(e, t), a = i.strings.hours, o = i.strings.minutes, s = i.label ? `${a}, ${i.label}` : a, c = i.label ? `${o}, ${i.label}` : o, l = dr({
|
|
9205
9186
|
id: i.hoursId,
|
|
9206
9187
|
hasHelptext: !!i.helptext,
|
|
9207
9188
|
ariaDescribedby: i.ariaDescribedby
|
|
@@ -9386,7 +9367,7 @@ var Os = i((e, t) => {
|
|
|
9386
9367
|
id: i.id || void 0,
|
|
9387
9368
|
onFocus: i.handleFocusIn,
|
|
9388
9369
|
onBlur: i.handleFocusOut,
|
|
9389
|
-
children: /* @__PURE__ */ _(
|
|
9370
|
+
children: /* @__PURE__ */ _(_r, {
|
|
9390
9371
|
strings: i.stringsOverride,
|
|
9391
9372
|
forId: i.hoursId,
|
|
9392
9373
|
label: i.label,
|
|
@@ -9413,6 +9394,6 @@ var Os = i((e, t) => {
|
|
|
9413
9394
|
})
|
|
9414
9395
|
});
|
|
9415
9396
|
});
|
|
9416
|
-
|
|
9397
|
+
Ds.displayName = "PktTimepicker";
|
|
9417
9398
|
//#endregion
|
|
9418
|
-
export {
|
|
9399
|
+
export { Ri as FileItem, Ba as ItemRenderers, j as PktAccordion, ue as PktAccordionItem, Ae as PktAlert, je as PktBackLink, $ as PktBreadcrumbs, Ee as PktButton, Xn as PktCalendar, tr as PktCard, sr as PktCheckbox, vr as PktCheckboxGroup, Kr as PktCombobox, Zr as PktConsent, fi as PktDatepicker, Va as PktFileUpload, mo as PktFooter, go as PktFooterSimple, Wo as PktHeader, Bo as PktHeaderGlobal, bo as PktHeaderMenu, Uo as PktHeaderService, $n as PktHeading, gr as PktHelptext, J as PktIcon, Go as PktInput, _r as PktInputWrapper, ko as PktLink, Ko as PktLinkCard, Jo as PktLoader, Yo as PktMessagebox, _a as PktModal, oa as PktProgressbar, Qo as PktRadioButton, $o as PktRadioGroup, Po as PktSearchInput, es as PktSelect, is as PktStep, as as PktStepper, Oe as PktStringsProvider, fs as PktTabItem, os as PktTable, ss as PktTableBody, cs as PktTableDataCell, ls as PktTableHeader, us as PktTableHeaderCell, ds as PktTableRow, hs as PktTabs, er as PktTag, Hi as PktTextarea, Vo as PktTextinput, Ds as PktTimepicker, ve as getPktStrings, de as pktStringsNb, ye as resetPktStrings, X as setPktStrings, Z as subscribePktStrings };
|