@oslokommune/punkt-react 18.5.1 → 18.6.1
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 +38 -0
- package/dist/components/calendar/types.d.ts +2 -16
- package/dist/punkt-react.cjs +1 -1
- package/dist/punkt-react.js +601 -593
- package/dist/shared-types/calendar.d.ts +67 -0
- package/dist/shared-types/index.d.ts +2 -1
- package/package.json +2 -2
- package/src/components/calendar/types.ts +2 -23
- package/src/components/calendar/useCalendarState.ts +8 -8
- package/src/components/datepicker/Datepicker.accessibility.test.tsx +9 -5
- package/src/components/datepicker/Datepicker.core.test.tsx +1 -1
- package/src/components/datepicker/Datepicker.selection.test.tsx +23 -0
- package/src/components/datepicker/DatepickerInputs.tsx +6 -7
- package/src/components/datepicker/useDatepickerState.ts +3 -1
package/dist/punkt-react.js
CHANGED
|
@@ -62,7 +62,7 @@ var M = /* @__PURE__ */ O((/* @__PURE__ */ E(((e, t) => {
|
|
|
62
62
|
return n;
|
|
63
63
|
}) : window.classNames = n;
|
|
64
64
|
})();
|
|
65
|
-
})))(), 1), N = "https://punkt-cdn.oslo.kommune.no/18.
|
|
65
|
+
})))(), 1), N = "https://punkt-cdn.oslo.kommune.no/18.6/icons/";
|
|
66
66
|
typeof window < "u" && (window.pktFetch = window.pktFetch === void 0 ? fetch : window.pktFetch, window.pktIconPath = window.pktIconPath || N);
|
|
67
67
|
var P = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 32 32\"></svg>", ee = {}, te = 2, ne = 1500, F = typeof Storage < "u" && typeof sessionStorage < "u", re = typeof window < "u" ? d : c, ie = (e, t) => !e || !F ? "" : sessionStorage.getItem(t + e + ".svg") ?? "", ae = (e) => window.pktFetch(e).then((t) => {
|
|
68
68
|
if (!t.ok) throw Error("Missing icon: " + e);
|
|
@@ -527,7 +527,7 @@ var he = {
|
|
|
527
527
|
};
|
|
528
528
|
//#endregion
|
|
529
529
|
//#region src/components/button/Button.tsx
|
|
530
|
-
typeof window < "u" && (window.pktAnimationPath = window.pktAnimationPath || "https://punkt-cdn.oslo.kommune.no/18.
|
|
530
|
+
typeof window < "u" && (window.pktAnimationPath = window.pktAnimationPath || "https://punkt-cdn.oslo.kommune.no/18.6/animations/");
|
|
531
531
|
var X = i(({ children: e, className: t, iconName: n = "user", secondIconName: r = "user", iconPath: i, secondIconPath: a, size: o = "medium", fullWidth: s = !1, fullWidthOnMobile: c = !1, skin: l = "primary", type: u = "button", variant: d = "label-only", state: f, color: p, isLoading: m = void 0, disabled: h = void 0, loadingAnimationPath: g = window.pktAnimationPath, ...y }, b) => {
|
|
532
532
|
let x = [
|
|
533
533
|
t,
|
|
@@ -2162,30 +2162,38 @@ var Yt = (e) => !e || isNaN(e.getTime()) ? "" : `${e.getFullYear()}-${String(e.g
|
|
|
2162
2162
|
}), dn = (e, t) => {
|
|
2163
2163
|
let n = Xt(e), r = Xt(t);
|
|
2164
2164
|
return !n || !r ? !1 : n <= r;
|
|
2165
|
+
}, fn = {
|
|
2166
|
+
multiple: !1,
|
|
2167
|
+
maxMultiple: 0,
|
|
2168
|
+
range: !1,
|
|
2169
|
+
earliest: null,
|
|
2170
|
+
latest: null,
|
|
2171
|
+
weeknumbers: !1,
|
|
2172
|
+
withcontrols: !1
|
|
2165
2173
|
};
|
|
2166
2174
|
//#endregion
|
|
2167
2175
|
//#region ../../shared-utils/calendar/date-validation.ts
|
|
2168
|
-
function
|
|
2176
|
+
function pn(e, t) {
|
|
2169
2177
|
let n = (t.excludedates ?? []).map((e) => typeof e == "string" ? e : Yt(e));
|
|
2170
2178
|
return !cn(e, t.earliest, t.latest, n, t.excludeweekdays ?? []);
|
|
2171
2179
|
}
|
|
2172
|
-
function
|
|
2173
|
-
return !!(
|
|
2180
|
+
function mn(e, t, n, r) {
|
|
2181
|
+
return !!(pn(e, n) || !t && r.multiple && r.maxMultiple > 0 && r.selectedCount >= r.maxMultiple);
|
|
2174
2182
|
}
|
|
2175
|
-
function
|
|
2183
|
+
function hn(e, t, n) {
|
|
2176
2184
|
let r = $t(e, t, 0);
|
|
2177
2185
|
return !(n && Qt(n) > r);
|
|
2178
2186
|
}
|
|
2179
|
-
function
|
|
2187
|
+
function gn(e, t, n) {
|
|
2180
2188
|
let r = $t(t === 11 ? e + 1 : e, t === 11 ? 0 : t + 1, 1);
|
|
2181
2189
|
return !(n && Qt(n) < r);
|
|
2182
2190
|
}
|
|
2183
2191
|
//#endregion
|
|
2184
2192
|
//#region ../../shared-utils/calendar/selection-manager.ts
|
|
2185
|
-
function
|
|
2193
|
+
function _n(e) {
|
|
2186
2194
|
return typeof e == "string" && (e = e.split(",")), e.length === 1 && e[0] === "" ? [] : e.map((e) => Jt(e));
|
|
2187
2195
|
}
|
|
2188
|
-
function
|
|
2196
|
+
function vn(e, t) {
|
|
2189
2197
|
let n = Ve({
|
|
2190
2198
|
start: e,
|
|
2191
2199
|
end: t
|
|
@@ -2196,7 +2204,7 @@ function _n(e, t) {
|
|
|
2196
2204
|
}
|
|
2197
2205
|
return r;
|
|
2198
2206
|
}
|
|
2199
|
-
function
|
|
2207
|
+
function yn(e, t, n, r) {
|
|
2200
2208
|
if (t.length !== 1) return !0;
|
|
2201
2209
|
let i = Ve({
|
|
2202
2210
|
start: t[0],
|
|
@@ -2209,26 +2217,26 @@ function vn(e, t, n, r) {
|
|
|
2209
2217
|
}
|
|
2210
2218
|
return !0;
|
|
2211
2219
|
}
|
|
2212
|
-
function
|
|
2220
|
+
function bn(e, t) {
|
|
2213
2221
|
let n = Yt(e);
|
|
2214
2222
|
return t.includes(n) ? t : [...t, n];
|
|
2215
2223
|
}
|
|
2216
|
-
function
|
|
2224
|
+
function xn(e, t) {
|
|
2217
2225
|
let n = Yt(e), r = t.indexOf(n);
|
|
2218
2226
|
if (r === -1) return t;
|
|
2219
2227
|
if (t.length === 1) return [];
|
|
2220
2228
|
let i = [...t];
|
|
2221
2229
|
return i.splice(r, 1), i;
|
|
2222
2230
|
}
|
|
2223
|
-
function
|
|
2231
|
+
function Sn(e, t, n) {
|
|
2224
2232
|
let r = Yt(e);
|
|
2225
|
-
return t.includes(r) ?
|
|
2233
|
+
return t.includes(r) ? xn(e, t) : n > 0 && t.length >= n ? t : bn(e, t);
|
|
2226
2234
|
}
|
|
2227
|
-
function
|
|
2228
|
-
let r = Yt(e), i =
|
|
2229
|
-
return t.includes(r) ? t.indexOf(r) === 0 ? [] :
|
|
2235
|
+
function Cn(e, t, n) {
|
|
2236
|
+
let r = Yt(e), i = _n(t);
|
|
2237
|
+
return t.includes(r) ? t.indexOf(r) === 0 ? [] : xn(e, t) : t.length > 1 || t.length === 1 && (!yn(e, i, n.excludedates, n.excludeweekdays) || i[0] > e) ? [r] : bn(e, t);
|
|
2230
2238
|
}
|
|
2231
|
-
function
|
|
2239
|
+
function wn(e, t) {
|
|
2232
2240
|
let n = $t(e, t, 1), r = $t(e, t + 1, 0), i = (n.getDay() + 6) % 7, a = r.getDate();
|
|
2233
2241
|
return {
|
|
2234
2242
|
firstDayOfMonth: n,
|
|
@@ -2240,40 +2248,40 @@ function Cn(e, t) {
|
|
|
2240
2248
|
initialWeek: ot(n)
|
|
2241
2249
|
};
|
|
2242
2250
|
}
|
|
2243
|
-
function
|
|
2251
|
+
function Tn(e, t, n, r) {
|
|
2244
2252
|
let { startingDay: i, numDays: a } = r;
|
|
2245
2253
|
return e === 0 && t < i ? "prev-month" : n > a ? "next-month" : "current-month";
|
|
2246
2254
|
}
|
|
2247
|
-
function
|
|
2255
|
+
function En(e, t, n, r) {
|
|
2248
2256
|
let { startingDay: i, numDaysPrevMonth: a, numDays: o } = r;
|
|
2249
2257
|
return e === "prev-month" ? a - (i - t - 1) : e === "next-month" ? n - o : n;
|
|
2250
2258
|
}
|
|
2251
2259
|
//#endregion
|
|
2252
2260
|
//#region ../../shared-utils/calendar/keyboard-navigation.ts
|
|
2253
|
-
var
|
|
2261
|
+
var Dn = {
|
|
2254
2262
|
ArrowLeft: -1,
|
|
2255
2263
|
ArrowRight: 1,
|
|
2256
2264
|
ArrowUp: -7,
|
|
2257
2265
|
ArrowDown: 7
|
|
2258
2266
|
};
|
|
2259
|
-
function
|
|
2267
|
+
function On(e) {
|
|
2260
2268
|
let t = e.nodeName;
|
|
2261
2269
|
return t === "INPUT" || t === "SELECT" || t === "BUTTON" && !e.dataset?.date;
|
|
2262
2270
|
}
|
|
2263
|
-
function
|
|
2271
|
+
function kn(e, t, n) {
|
|
2264
2272
|
let r = De(e, t);
|
|
2265
2273
|
if (!r) return null;
|
|
2266
2274
|
let i = n(`button[data-date="${Yt(r)}"]`);
|
|
2267
2275
|
for (; i instanceof HTMLButtonElement && i.dataset.disabled;) if (r = De(r, t), i = n(`button[data-date="${Yt(r)}"]`), !i) return null;
|
|
2268
2276
|
return r;
|
|
2269
2277
|
}
|
|
2270
|
-
function
|
|
2271
|
-
return
|
|
2278
|
+
function An(e) {
|
|
2279
|
+
return Dn[e] ?? null;
|
|
2272
2280
|
}
|
|
2273
2281
|
//#endregion
|
|
2274
2282
|
//#region src/components/calendar/useCalendarState.ts
|
|
2275
|
-
function
|
|
2276
|
-
let { selected: t, multiple: n =
|
|
2283
|
+
function jn(e) {
|
|
2284
|
+
let { selected: t, multiple: n = fn.multiple, maxMultiple: r = fn.maxMultiple, range: i = fn.range, earliest: a = fn.earliest, latest: s = fn.latest, excludedates: u, excludeweekdays: d = [], weeknumbers: h = fn.weeknumbers, withcontrols: g = fn.withcontrols, currentmonth: _, today: v, strings: y, onDateSelected: b, onClose: x, id: S, className: C } = e, w = l(), T = S ?? w, E = ge(["dates", "calendar"], y), D = f(() => ({
|
|
2277
2285
|
month: E.dates.month,
|
|
2278
2286
|
year: E.dates.year,
|
|
2279
2287
|
week: E.dates.week,
|
|
@@ -2282,7 +2290,7 @@ function An(e) {
|
|
|
2282
2290
|
months: E.dates.months,
|
|
2283
2291
|
prevMonth: E.calendar.prevMonth,
|
|
2284
2292
|
nextMonth: E.calendar.nextMonth
|
|
2285
|
-
}), [E]), O = f(() => v ? Jt(v) : qt(), [v]), k = f(() => u ? u.map((e) => typeof e == "string" ? Jt(e) : e) : [], [u]), A = t !== void 0, [j, M] = m([]), N = A ? t : j, P = f(() =>
|
|
2293
|
+
}), [E]), O = f(() => v ? Jt(v) : qt(), [v]), k = f(() => u ? u.map((e) => typeof e == "string" ? Jt(e) : e) : [], [u]), A = t !== void 0, [j, M] = m([]), N = A ? t : j, P = f(() => _n(N), [N]), [ee, te] = m(0), [ne, F] = m(0), [re, ie] = m({}), [ae, oe] = m(null), [se, I] = m(null), L = p(null), R = p([]), ce = p(0), z = p(!1), B = p(!1), V = f(() => ({
|
|
2286
2294
|
earliest: a,
|
|
2287
2295
|
latest: s,
|
|
2288
2296
|
excludedates: k,
|
|
@@ -2316,7 +2324,7 @@ function An(e) {
|
|
|
2316
2324
|
isNaN(e.getTime()) || (te(e.getFullYear()), F(e.getMonth()));
|
|
2317
2325
|
}
|
|
2318
2326
|
}, [N]), c(() => {
|
|
2319
|
-
i && P.length === 2 ? ie(
|
|
2327
|
+
i && P.length === 2 ? ie(vn(P[0], P[1])) : (!i || P.length < 2) && ie({});
|
|
2320
2328
|
}, [i, P]);
|
|
2321
2329
|
let H = o((e) => {
|
|
2322
2330
|
A || M(e), b?.(e);
|
|
@@ -2338,7 +2346,7 @@ function An(e) {
|
|
|
2338
2346
|
ee,
|
|
2339
2347
|
ne,
|
|
2340
2348
|
ue
|
|
2341
|
-
]), W = o((e) =>
|
|
2349
|
+
]), W = o((e) => pn(e, V), [V]), G = o((e, t) => mn(e, t, V, {
|
|
2342
2350
|
multiple: n,
|
|
2343
2351
|
maxMultiple: r,
|
|
2344
2352
|
selectedCount: N.length
|
|
@@ -2348,11 +2356,11 @@ function An(e) {
|
|
|
2348
2356
|
r,
|
|
2349
2357
|
N.length
|
|
2350
2358
|
]), K = o(() => typeof N == "string" ? N.split(",") : N, [N]), fe = o((e) => {
|
|
2351
|
-
if (!i || P.length !== 1 || !
|
|
2359
|
+
if (!i || P.length !== 1 || !yn(e, P, k, d) || P[0] >= e) {
|
|
2352
2360
|
oe(null);
|
|
2353
2361
|
return;
|
|
2354
2362
|
}
|
|
2355
|
-
oe(e), ie(
|
|
2363
|
+
oe(e), ie(vn(P[0], e));
|
|
2356
2364
|
}, [
|
|
2357
2365
|
i,
|
|
2358
2366
|
P,
|
|
@@ -2361,11 +2369,11 @@ function An(e) {
|
|
|
2361
2369
|
]), q = o((e) => {
|
|
2362
2370
|
if (!e) return;
|
|
2363
2371
|
let t;
|
|
2364
|
-
if (i) t =
|
|
2372
|
+
if (i) t = Cn(e, K(), {
|
|
2365
2373
|
excludedates: k,
|
|
2366
2374
|
excludeweekdays: d
|
|
2367
2375
|
}), A || M(t), t.length === 2 ? (b?.(t), le()) : (t.length === 1 && ie({}), b?.(t));
|
|
2368
|
-
else if (n) t =
|
|
2376
|
+
else if (n) t = Sn(e, K(), r), H(t);
|
|
2369
2377
|
else {
|
|
2370
2378
|
let n = Yt(e);
|
|
2371
2379
|
t = N.includes(n) ? [] : [n], H(t), le();
|
|
@@ -2383,7 +2391,7 @@ function An(e) {
|
|
|
2383
2391
|
le,
|
|
2384
2392
|
b
|
|
2385
2393
|
]), pe = o((e) => {
|
|
2386
|
-
let t =
|
|
2394
|
+
let t = bn(e, K());
|
|
2387
2395
|
A || M(t), i && t.length === 2 && (b?.(t), le());
|
|
2388
2396
|
}, [
|
|
2389
2397
|
K,
|
|
@@ -2392,10 +2400,10 @@ function An(e) {
|
|
|
2392
2400
|
b,
|
|
2393
2401
|
le
|
|
2394
2402
|
]), me = o((e) => {
|
|
2395
|
-
let t =
|
|
2403
|
+
let t = xn(e, K());
|
|
2396
2404
|
A || M(t);
|
|
2397
2405
|
}, [K, A]), J = o((e) => {
|
|
2398
|
-
let t =
|
|
2406
|
+
let t = Sn(e, K(), r);
|
|
2399
2407
|
A || M(t);
|
|
2400
2408
|
}, [
|
|
2401
2409
|
K,
|
|
@@ -2414,12 +2422,12 @@ function An(e) {
|
|
|
2414
2422
|
}
|
|
2415
2423
|
}, []), he = o((e, t) => {
|
|
2416
2424
|
let n = e.target;
|
|
2417
|
-
if (
|
|
2425
|
+
if (On(n)) return;
|
|
2418
2426
|
if (e.preventDefault(), !se) {
|
|
2419
2427
|
Y();
|
|
2420
2428
|
return;
|
|
2421
2429
|
}
|
|
2422
|
-
let r =
|
|
2430
|
+
let r = kn(Qt(se), t, L.current.querySelector.bind(L.current));
|
|
2423
2431
|
if (r) {
|
|
2424
2432
|
let e = L.current.querySelector(`button[data-date="${Yt(r)}"]`);
|
|
2425
2433
|
e instanceof HTMLButtonElement && !e.dataset.disabled && (I(Yt(r)), e.focus());
|
|
@@ -2465,7 +2473,7 @@ function An(e) {
|
|
|
2465
2473
|
e.preventDefault(), le();
|
|
2466
2474
|
return;
|
|
2467
2475
|
}
|
|
2468
|
-
let t =
|
|
2476
|
+
let t = An(e.key);
|
|
2469
2477
|
t !== null && he(e.nativeEvent, t);
|
|
2470
2478
|
}, [le, he]),
|
|
2471
2479
|
handleFocusOut: o((e) => {
|
|
@@ -2478,9 +2486,9 @@ function An(e) {
|
|
|
2478
2486
|
}
|
|
2479
2487
|
//#endregion
|
|
2480
2488
|
//#region src/components/calendar/CalendarNav.tsx
|
|
2481
|
-
var
|
|
2489
|
+
var Mn = ({ componentId: e, strings: t, year: n, month: r, earliest: i, latest: a, withcontrols: o, prevMonth: s, nextMonth: c, changeMonth: l }) => {
|
|
2482
2490
|
let u = (e) => {
|
|
2483
|
-
let o = e === "prev", l = o ?
|
|
2491
|
+
let o = e === "prev", l = o ? hn(n, r, i) : gn(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;
|
|
2484
2492
|
return /* @__PURE__ */ _("div", { children: /* @__PURE__ */ v("button", {
|
|
2485
2493
|
type: "button",
|
|
2486
2494
|
"aria-label": u,
|
|
@@ -2563,7 +2571,7 @@ var jn = ({ componentId: e, strings: t, year: n, month: r, earliest: i, latest:
|
|
|
2563
2571
|
};
|
|
2564
2572
|
//#endregion
|
|
2565
2573
|
//#region src/components/calendar/calendar-utils.ts
|
|
2566
|
-
function
|
|
2574
|
+
function Nn(e, t, n) {
|
|
2567
2575
|
let r = $t(n.year, n.month, e), i = Yt(r), a = i === Yt(t), o = n.activeSelected.includes(i), s = n.isDayDisabled(r, o), c;
|
|
2568
2576
|
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", {
|
|
2569
2577
|
currentDate: r,
|
|
@@ -2575,7 +2583,7 @@ function Mn(e, t, n) {
|
|
|
2575
2583
|
tabindex: c
|
|
2576
2584
|
};
|
|
2577
2585
|
}
|
|
2578
|
-
function
|
|
2586
|
+
function Pn(e, t) {
|
|
2579
2587
|
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];
|
|
2580
2588
|
return (0, M.default)({
|
|
2581
2589
|
"pkt-cal-today": r,
|
|
@@ -2587,7 +2595,7 @@ function Nn(e, t) {
|
|
|
2587
2595
|
"pkt-cal-range-hover": t.rangeHovered !== null && n === Yt(t.rangeHovered)
|
|
2588
2596
|
});
|
|
2589
2597
|
}
|
|
2590
|
-
function
|
|
2598
|
+
function Fn(e, t) {
|
|
2591
2599
|
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];
|
|
2592
2600
|
return (0, M.default)({
|
|
2593
2601
|
"pkt-calendar__date": !0,
|
|
@@ -2602,7 +2610,7 @@ function Pn(e, t) {
|
|
|
2602
2610
|
}
|
|
2603
2611
|
//#endregion
|
|
2604
2612
|
//#region src/components/calendar/CalendarGrid.tsx
|
|
2605
|
-
var
|
|
2613
|
+
var In = ({ state: e }) => {
|
|
2606
2614
|
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 = {
|
|
2607
2615
|
year: n,
|
|
2608
2616
|
month: r,
|
|
@@ -2632,13 +2640,13 @@ var Fn = ({ state: e }) => {
|
|
|
2632
2640
|
children: e
|
|
2633
2641
|
});
|
|
2634
2642
|
}, w = (e, t) => {
|
|
2635
|
-
let n =
|
|
2643
|
+
let n = Nn(e, t, x), { currentDate: r, currentDateISO: i, isSelected: a, isDisabled: o, ariaLabel: s, tabindex: l } = n;
|
|
2636
2644
|
d.current.push({
|
|
2637
2645
|
currentDateISO: i,
|
|
2638
2646
|
isDisabled: o,
|
|
2639
2647
|
tabindex: l
|
|
2640
2648
|
});
|
|
2641
|
-
let u =
|
|
2649
|
+
let u = Pn(n, S), f = Fn(n, S);
|
|
2642
2650
|
return /* @__PURE__ */ _("td", {
|
|
2643
2651
|
className: u,
|
|
2644
2652
|
children: /* @__PURE__ */ _("button", {
|
|
@@ -2682,7 +2690,7 @@ var Fn = ({ state: e }) => {
|
|
|
2682
2690
|
role: "grid",
|
|
2683
2691
|
"aria-multiselectable": c || l || void 0,
|
|
2684
2692
|
children: [/* @__PURE__ */ _("thead", { children: C() }), /* @__PURE__ */ _("tbody", { children: (() => {
|
|
2685
|
-
let e = b, t =
|
|
2693
|
+
let e = b, t = wn(n, r);
|
|
2686
2694
|
d.current = [], f.current = 0;
|
|
2687
2695
|
let i = 1, a = t.initialWeek, o = [];
|
|
2688
2696
|
for (let n = 0; n < t.numRows; n++) {
|
|
@@ -2692,10 +2700,10 @@ var Fn = ({ state: e }) => {
|
|
|
2692
2700
|
children: a
|
|
2693
2701
|
}, `week-${a}`)), a++;
|
|
2694
2702
|
for (let a = 0; a < 7; a++) {
|
|
2695
|
-
let o =
|
|
2703
|
+
let o = Tn(n, a, i, t);
|
|
2696
2704
|
if (o === "current-month") r.push(w(i, e)), i++;
|
|
2697
2705
|
else {
|
|
2698
|
-
let e =
|
|
2706
|
+
let e = En(o, a, i, t);
|
|
2699
2707
|
r.push(T(e, `${o}-${n}-${a}`)), o === "next-month" && i++;
|
|
2700
2708
|
}
|
|
2701
2709
|
}
|
|
@@ -2708,8 +2716,8 @@ var Fn = ({ state: e }) => {
|
|
|
2708
2716
|
return o;
|
|
2709
2717
|
})() })]
|
|
2710
2718
|
});
|
|
2711
|
-
},
|
|
2712
|
-
let n =
|
|
2719
|
+
}, Ln = i((e, t) => {
|
|
2720
|
+
let n = jn(e);
|
|
2713
2721
|
return u(t, () => ({
|
|
2714
2722
|
handleDateSelect: n.handleDateSelect,
|
|
2715
2723
|
addToSelected: n.addToSelected,
|
|
@@ -2733,7 +2741,7 @@ var Fn = ({ state: e }) => {
|
|
|
2733
2741
|
].filter(Boolean).join(" "),
|
|
2734
2742
|
onBlur: n.handleFocusOut,
|
|
2735
2743
|
onKeyDown: n.handleKeydown,
|
|
2736
|
-
children: [/* @__PURE__ */ _(
|
|
2744
|
+
children: [/* @__PURE__ */ _(Mn, {
|
|
2737
2745
|
componentId: n.componentId,
|
|
2738
2746
|
strings: n.strings,
|
|
2739
2747
|
year: n.year,
|
|
@@ -2744,13 +2752,13 @@ var Fn = ({ state: e }) => {
|
|
|
2744
2752
|
prevMonth: n.prevMonth,
|
|
2745
2753
|
nextMonth: n.nextMonth,
|
|
2746
2754
|
changeMonth: n.changeMonth
|
|
2747
|
-
}), /* @__PURE__ */ _(
|
|
2755
|
+
}), /* @__PURE__ */ _(In, { state: n })]
|
|
2748
2756
|
});
|
|
2749
2757
|
});
|
|
2750
|
-
|
|
2758
|
+
Ln.displayName = "PktCalendar";
|
|
2751
2759
|
//#endregion
|
|
2752
2760
|
//#region src/components/heading/Heading.tsx
|
|
2753
|
-
var
|
|
2761
|
+
var Rn = (e) => {
|
|
2754
2762
|
switch (e) {
|
|
2755
2763
|
case 1: return "xlarge";
|
|
2756
2764
|
case 2: return "large";
|
|
@@ -2760,7 +2768,7 @@ var Ln = (e) => {
|
|
|
2760
2768
|
case 6: return "xsmall";
|
|
2761
2769
|
default: return "medium";
|
|
2762
2770
|
}
|
|
2763
|
-
},
|
|
2771
|
+
}, zn = (e) => {
|
|
2764
2772
|
switch (e) {
|
|
2765
2773
|
case 1:
|
|
2766
2774
|
case 2: return "regular";
|
|
@@ -2770,8 +2778,8 @@ var Ln = (e) => {
|
|
|
2770
2778
|
case 6: return "medium";
|
|
2771
2779
|
default: return "medium";
|
|
2772
2780
|
}
|
|
2773
|
-
},
|
|
2774
|
-
let l = t ??
|
|
2781
|
+
}, Bn = i(function({ level: e = 2, size: t, weight: n, visuallyHidden: r, align: i, className: a, children: o, ...s }, c) {
|
|
2782
|
+
let l = t ?? Rn(e), u = n ?? zn(e), d = (0, M.default)("pkt-heading", `pkt-heading--${l}`, `pkt-heading--fw-${u}`, i && `pkt-heading--${i}`, r && "pkt-sr-only", a), f = `h${e}`;
|
|
2775
2783
|
return /* @__PURE__ */ _(f, {
|
|
2776
2784
|
...s,
|
|
2777
2785
|
ref: c,
|
|
@@ -2779,10 +2787,10 @@ var Ln = (e) => {
|
|
|
2779
2787
|
children: o
|
|
2780
2788
|
});
|
|
2781
2789
|
});
|
|
2782
|
-
|
|
2790
|
+
Bn.displayName = "PktHeading";
|
|
2783
2791
|
//#endregion
|
|
2784
2792
|
//#region src/components/tag/Tag.tsx
|
|
2785
|
-
var
|
|
2793
|
+
var Vn = 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) => {
|
|
2786
2794
|
let [x, S] = m(!1), C = o(() => {
|
|
2787
2795
|
S(!0), u && u();
|
|
2788
2796
|
}, [u]), w = p(null), [T, E] = m("");
|
|
@@ -2846,10 +2854,10 @@ var Bn = i(({ children: e, skin: t = "blue", textStyle: n, size: r = "medium", c
|
|
|
2846
2854
|
})]
|
|
2847
2855
|
});
|
|
2848
2856
|
});
|
|
2849
|
-
|
|
2857
|
+
Vn.displayName = "PktTag";
|
|
2850
2858
|
//#endregion
|
|
2851
2859
|
//#region src/components/card/Card.tsx
|
|
2852
|
-
var
|
|
2860
|
+
var Hn = i(({ children: e, className: t, ariaLabel: n, metaLead: r, borderOnHover: i = !0, metaTrail: a, layout: o = "vertical", heading: s = "", headingLevel: c = 3, image: l, imageShape: u = "square", imageAspect: d, restrictImageHeight: f = !1, clickCardLink: p, padding: m = "default", openLinkInNewTab: h = !1, skin: g = "outlined", subheading: y = "", tagPosition: b = "top", zoom: x = !1, tags: S = [], ...C }, w) => {
|
|
2853
2861
|
let T = (0, M.default)({
|
|
2854
2862
|
"pkt-card": !0,
|
|
2855
2863
|
[`pkt-card--${g}`]: g,
|
|
@@ -2867,7 +2875,7 @@ var Vn = i(({ children: e, className: t, ariaLabel: n, metaLead: r, borderOnHove
|
|
|
2867
2875
|
className: (0, M.default)("pkt-card__tags", `pkt-card__tags-${b}`),
|
|
2868
2876
|
role: "list",
|
|
2869
2877
|
"aria-label": S.length > 1 ? "merkelapper" : "merkelapp",
|
|
2870
|
-
children: S.map((e, t) => /* @__PURE__ */ _(
|
|
2878
|
+
children: S.map((e, t) => /* @__PURE__ */ _(Vn, {
|
|
2871
2879
|
role: "listitem",
|
|
2872
2880
|
textStyle: "normal-text",
|
|
2873
2881
|
size: "medium",
|
|
@@ -2875,13 +2883,13 @@ var Vn = i(({ children: e, className: t, ariaLabel: n, metaLead: r, borderOnHove
|
|
|
2875
2883
|
iconName: e.iconName,
|
|
2876
2884
|
children: /* @__PURE__ */ _("span", { children: e.text })
|
|
2877
2885
|
}, t))
|
|
2878
|
-
}), A = () => !s || p ? null : /* @__PURE__ */ _(
|
|
2886
|
+
}), A = () => !s || p ? null : /* @__PURE__ */ _(Bn, {
|
|
2879
2887
|
className: "pkt-card__heading",
|
|
2880
2888
|
level: c,
|
|
2881
2889
|
size: "medium",
|
|
2882
2890
|
weight: "regular",
|
|
2883
2891
|
children: s
|
|
2884
|
-
}), j = () => p ? /* @__PURE__ */ _(
|
|
2892
|
+
}), j = () => p ? /* @__PURE__ */ _(Bn, {
|
|
2885
2893
|
className: "pkt-card__link-heading pkt-card__heading",
|
|
2886
2894
|
level: c,
|
|
2887
2895
|
size: "medium",
|
|
@@ -2933,10 +2941,10 @@ var Vn = i(({ children: e, className: t, ariaLabel: n, metaLead: r, borderOnHove
|
|
|
2933
2941
|
})]
|
|
2934
2942
|
});
|
|
2935
2943
|
});
|
|
2936
|
-
|
|
2944
|
+
Hn.displayName = "PktCard";
|
|
2937
2945
|
//#endregion
|
|
2938
2946
|
//#region src/components/checkbox/Checkbox.tsx
|
|
2939
|
-
var
|
|
2947
|
+
var Un = i(({ id: e, hasTile: t = !1, disabled: n = !1, label: r, checkHelptext: i, hasError: a = !1, className: o, isSwitch: s = !1, hideLabel: l = !1, labelPosition: u = "right", defaultChecked: d, checked: f, indeterminate: m, optionalTag: h, optionalText: y, requiredTag: b, requiredText: x, strings: S, tagText: C, ...w }, T) => {
|
|
2940
2948
|
let E = ge(["forms"], S), D = p(null);
|
|
2941
2949
|
c(() => {
|
|
2942
2950
|
D.current && m !== void 0 && (D.current.indeterminate = m);
|
|
@@ -3016,10 +3024,10 @@ var Hn = i(({ id: e, hasTile: t = !1, disabled: n = !1, label: r, checkHelptext:
|
|
|
3016
3024
|
})
|
|
3017
3025
|
});
|
|
3018
3026
|
});
|
|
3019
|
-
|
|
3027
|
+
Un.displayName = "PktCheckbox";
|
|
3020
3028
|
//#endregion
|
|
3021
3029
|
//#region src/hooks/useFocusModality.ts
|
|
3022
|
-
function
|
|
3030
|
+
function Wn(e) {
|
|
3023
3031
|
let t = p(null), n = p(!1), r = p(void 0), i = (e) => {
|
|
3024
3032
|
let n = t.current;
|
|
3025
3033
|
n && (e === void 0 ? delete n.dataset.navtype : n.dataset.navtype = e);
|
|
@@ -3045,14 +3053,14 @@ function Un(e) {
|
|
|
3045
3053
|
}
|
|
3046
3054
|
//#endregion
|
|
3047
3055
|
//#region ../../shared-utils/forms/described-by.ts
|
|
3048
|
-
var
|
|
3056
|
+
var Gn = (e) => {
|
|
3049
3057
|
let t = [];
|
|
3050
3058
|
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;
|
|
3051
|
-
},
|
|
3052
|
-
let e =
|
|
3059
|
+
}, Kn = (e) => `${e}-counter-status`, qn = (e, t) => !!t && t > 0 && (e ?? 0) > t, Jn = () => ("00000000000000000" + (Math.random() * 0x10000000000000000).toString(16)).slice(-16), Yn = () => {
|
|
3060
|
+
let e = Jn(), t = Jn();
|
|
3053
3061
|
return e.slice(0, 8) + "-" + e.slice(8, 12) + "-4" + e.slice(13) + "-a" + t.slice(1, 4) + "-" + t.slice(4);
|
|
3054
|
-
},
|
|
3055
|
-
let [l, u] = m(!1), d = f(() =>
|
|
3062
|
+
}, Xn = "Les mer <span class='pkt-sr-only'>om feltet</span>", Zn = (e) => e == null || e === "" ? null : typeof e == "string" ? /* @__PURE__ */ _("span", { dangerouslySetInnerHTML: { __html: e } }) : e, Qn = i(function({ helptext: e, helptextDropdown: t, helptextDropdownButton: n, forId: r, onToggleHelpText: i, className: a, children: o, ...s }, c) {
|
|
3063
|
+
let [l, u] = m(!1), d = f(() => Yn(), []), p = r || d, h = () => {
|
|
3056
3064
|
let e = !l;
|
|
3057
3065
|
u(e), i?.(e);
|
|
3058
3066
|
}, g = (0, M.default)("pkt-inputwrapper__helptext-container", !!(e || t || o) && "pkt-inputwrapper__has-helptext", a);
|
|
@@ -3066,7 +3074,7 @@ var Wn = (e) => {
|
|
|
3066
3074
|
children: [o && /* @__PURE__ */ _("div", {
|
|
3067
3075
|
className: "pkt-contents",
|
|
3068
3076
|
children: o
|
|
3069
|
-
}),
|
|
3077
|
+
}), Zn(e)]
|
|
3070
3078
|
}), t && /* @__PURE__ */ v("div", {
|
|
3071
3079
|
className: "pkt-inputwrapper__helptext-expandable",
|
|
3072
3080
|
children: [/* @__PURE__ */ v("button", {
|
|
@@ -3080,21 +3088,21 @@ var Wn = (e) => {
|
|
|
3080
3088
|
name: l ? "chevron-thin-up" : "chevron-thin-down"
|
|
3081
3089
|
}), /* @__PURE__ */ _("span", {
|
|
3082
3090
|
className: "pkt-btn__text",
|
|
3083
|
-
dangerouslySetInnerHTML: { __html: n ??
|
|
3091
|
+
dangerouslySetInnerHTML: { __html: n ?? Xn }
|
|
3084
3092
|
})]
|
|
3085
3093
|
}), /* @__PURE__ */ _("div", {
|
|
3086
3094
|
id: `${p}-helptext-expandable`,
|
|
3087
3095
|
className: (0, M.default)("pkt-inputwrapper__helptext", l ? "pkt-inputwrapper__helptext-expandable-open" : "pkt-inputwrapper__helptext-expandable-closed"),
|
|
3088
|
-
children:
|
|
3096
|
+
children: Zn(t)
|
|
3089
3097
|
})]
|
|
3090
3098
|
})]
|
|
3091
3099
|
});
|
|
3092
3100
|
});
|
|
3093
|
-
|
|
3101
|
+
Qn.displayName = "PktHelptext";
|
|
3094
3102
|
//#endregion
|
|
3095
3103
|
//#region src/components/inputwrapper/InputWrapper.tsx
|
|
3096
|
-
var
|
|
3097
|
-
let j =
|
|
3104
|
+
var $n = i(({ forId: e, label: t, helptext: n, helptextDropdown: r, helptextDropdownButton: i, counter: a, counterCurrent: o = 0, counterMaxLength: s, optionalTag: c = !1, optionalText: l, requiredTag: u = !1, requiredText: d, tagText: p = null, hasError: m = !1, errorMessage: h, disabled: y = !1, inline: b = !1, ariaDescribedby: x, useWrapper: S = !0, children: C, className: w = "", hasFieldset: T = !1, role: E, counterPosition: D = "bottom", size: O = "medium", strings: k }, A) => {
|
|
3105
|
+
let j = Wn(A), M = ge(["forms", "validation"], k), N = f(() => Yn(), []), P = e || N, ee = x || (n ? `${P}-helptext` : void 0), te = !!a, ne = te && D === "top", F = te && D === "bottom", re = [
|
|
3098
3106
|
"pkt-inputwrapper",
|
|
3099
3107
|
w,
|
|
3100
3108
|
m ? "pkt-inputwrapper--error" : "",
|
|
@@ -3105,13 +3113,13 @@ var Qn = i(({ forId: e, label: t, helptext: n, helptextDropdown: r, helptextDrop
|
|
|
3105
3113
|
"pkt-tag",
|
|
3106
3114
|
"pkt-tag--small",
|
|
3107
3115
|
"pkt-tag--thin-text"
|
|
3108
|
-
].join(" "), ae =
|
|
3116
|
+
].join(" "), ae = qn(o, s), oe = () => te ? /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ v("div", {
|
|
3109
3117
|
className: "pkt-input__counter",
|
|
3110
3118
|
"aria-hidden": "true",
|
|
3111
3119
|
children: [o, s ? `/${s}` : ""]
|
|
3112
3120
|
}), /* @__PURE__ */ _("div", {
|
|
3113
3121
|
className: "pkt-sr-only",
|
|
3114
|
-
id:
|
|
3122
|
+
id: Kn(P),
|
|
3115
3123
|
"aria-live": "polite",
|
|
3116
3124
|
children: ae ? B(M.validation.counterExceeded, {
|
|
3117
3125
|
current: o,
|
|
@@ -3153,7 +3161,7 @@ var Qn = i(({ forId: e, label: t, helptext: n, helptextDropdown: r, helptextDrop
|
|
|
3153
3161
|
});
|
|
3154
3162
|
}, L = () => {
|
|
3155
3163
|
let e = S ? n : void 0;
|
|
3156
|
-
return !e && !r ? null : /* @__PURE__ */ _(
|
|
3164
|
+
return !e && !r ? null : /* @__PURE__ */ _(Qn, {
|
|
3157
3165
|
forId: P,
|
|
3158
3166
|
helptext: e,
|
|
3159
3167
|
helptextDropdown: r,
|
|
@@ -3192,25 +3200,25 @@ var Qn = i(({ forId: e, label: t, helptext: n, helptextDropdown: r, helptextDrop
|
|
|
3192
3200
|
})
|
|
3193
3201
|
});
|
|
3194
3202
|
});
|
|
3195
|
-
|
|
3203
|
+
$n.displayName = "PktInputWrapper";
|
|
3196
3204
|
//#endregion
|
|
3197
3205
|
//#region ../../shared-utils/combobox/option-utils.ts
|
|
3198
|
-
var
|
|
3206
|
+
var er = (e, t) => t && (e.find((e) => e.value === t) || e.find((e) => e.label === t)) || null, tr = (e, t) => {
|
|
3199
3207
|
if (!t) return -1;
|
|
3200
3208
|
let n = e.findIndex((e) => e.value === t);
|
|
3201
3209
|
return n >= 0 ? n : e.findIndex((e) => e.label === t);
|
|
3202
|
-
},
|
|
3210
|
+
}, nr = (e, t) => {
|
|
3203
3211
|
if (!t) return [...e];
|
|
3204
3212
|
let n = t.toLowerCase();
|
|
3205
3213
|
return e.filter((e) => (e.fulltext || e.value + (e.label || "") + (e.prefix || "")).toLowerCase().includes(n));
|
|
3206
|
-
},
|
|
3214
|
+
}, rr = (e) => e.value + (e.label || "") + (e.prefix || ""), ir = (e, t) => t !== null && e >= t, ar = (e, t) => {
|
|
3207
3215
|
if (!e) return "";
|
|
3208
3216
|
switch (t) {
|
|
3209
3217
|
case "prefixAndValue": return `${e.prefix || ""} ${e.value}`.trim();
|
|
3210
3218
|
case "value": return e.value;
|
|
3211
3219
|
default: return e.label || e.value;
|
|
3212
3220
|
}
|
|
3213
|
-
},
|
|
3221
|
+
}, or = (e, t) => e ? Array.isArray(e) ? t ? e : e.length > 0 ? [e[0]] : [] : t ? e.split(",").filter(Boolean) : [e] : [], sr = (e, t) => {
|
|
3214
3222
|
if (!t) return {
|
|
3215
3223
|
filtered: [...e],
|
|
3216
3224
|
suggestion: null
|
|
@@ -3220,7 +3228,7 @@ var $n = (e, t) => t && (e.find((e) => e.value === t) || e.find((e) => e.label =
|
|
|
3220
3228
|
filtered: r,
|
|
3221
3229
|
suggestion: r.find((e) => !e.selected && e.label?.toLowerCase().startsWith(n)) || null
|
|
3222
3230
|
};
|
|
3223
|
-
},
|
|
3231
|
+
}, cr = (e, t, n, r) => {
|
|
3224
3232
|
if (!e.trim()) return {
|
|
3225
3233
|
addValueText: null,
|
|
3226
3234
|
userInfoMessage: ""
|
|
@@ -3239,7 +3247,7 @@ var $n = (e, t) => t && (e.find((e) => e.value === t) || e.find((e) => e.label =
|
|
|
3239
3247
|
addValueText: null,
|
|
3240
3248
|
userInfoMessage: ""
|
|
3241
3249
|
};
|
|
3242
|
-
},
|
|
3250
|
+
}, lr = (e, t, n) => {
|
|
3243
3251
|
switch (e) {
|
|
3244
3252
|
case ",": return n ? "addValue" : null;
|
|
3245
3253
|
case "Enter": return "addValue";
|
|
@@ -3248,12 +3256,12 @@ var $n = (e, t) => t && (e.find((e) => e.value === t) || e.find((e) => e.label =
|
|
|
3248
3256
|
case "Escape": return "closeOptions";
|
|
3249
3257
|
default: return null;
|
|
3250
3258
|
}
|
|
3251
|
-
},
|
|
3259
|
+
}, ur = (e, t, n, r, i) => {
|
|
3252
3260
|
if (!e) return {
|
|
3253
3261
|
action: "none",
|
|
3254
3262
|
value: null
|
|
3255
3263
|
};
|
|
3256
|
-
let a =
|
|
3264
|
+
let a = er(n, e);
|
|
3257
3265
|
return !t.includes(e) && !a ? r ? {
|
|
3258
3266
|
action: "addUserValue",
|
|
3259
3267
|
value: e
|
|
@@ -3270,36 +3278,36 @@ var $n = (e, t) => t && (e.find((e) => e.value === t) || e.find((e) => e.label =
|
|
|
3270
3278
|
action: "none",
|
|
3271
3279
|
value: null
|
|
3272
3280
|
};
|
|
3273
|
-
},
|
|
3274
|
-
let r =
|
|
3281
|
+
}, dr = (e, t, n) => {
|
|
3282
|
+
let r = er(t, e);
|
|
3275
3283
|
return n === "label" && r?.label ? r.label : e;
|
|
3276
|
-
},
|
|
3284
|
+
}, fr = (e) => {
|
|
3277
3285
|
e.scrollIntoView({ block: "nearest" }), window.setTimeout(() => e.focus(), 0);
|
|
3278
|
-
},
|
|
3286
|
+
}, pr = (e) => Array.from(e.querySelectorAll("[role=\"option\"]:not([data-disabled])") || []), mr = (e) => {
|
|
3279
3287
|
let t = e.nextElementSibling;
|
|
3280
|
-
t &&
|
|
3281
|
-
},
|
|
3288
|
+
t && fr(t);
|
|
3289
|
+
}, hr = (e, t, n) => {
|
|
3282
3290
|
let r = e.previousElementSibling;
|
|
3283
3291
|
if (e.dataset.index === "0" && n) {
|
|
3284
3292
|
let e = t.querySelector("[role=\"searchbox\"]");
|
|
3285
|
-
e &&
|
|
3286
|
-
} else r &&
|
|
3287
|
-
},
|
|
3288
|
-
let t =
|
|
3289
|
-
t[0] &&
|
|
3290
|
-
},
|
|
3293
|
+
e && fr(e);
|
|
3294
|
+
} else r && fr(r);
|
|
3295
|
+
}, gr = (e) => {
|
|
3296
|
+
let t = pr(e);
|
|
3297
|
+
t[0] && fr(t[0]);
|
|
3298
|
+
}, _r = (e, t) => {
|
|
3291
3299
|
if (t.disabled) return;
|
|
3292
|
-
let n =
|
|
3300
|
+
let n = pr(e);
|
|
3293
3301
|
if (t.allowUserInput && t.customUserInput) {
|
|
3294
3302
|
let t = e.querySelector("[data-type=\"new-option\"]");
|
|
3295
3303
|
if (t) {
|
|
3296
|
-
|
|
3304
|
+
fr(t);
|
|
3297
3305
|
return;
|
|
3298
3306
|
}
|
|
3299
3307
|
}
|
|
3300
3308
|
let r = n.find((e) => e.dataset.selected === "true");
|
|
3301
3309
|
if (r) {
|
|
3302
|
-
|
|
3310
|
+
fr(r);
|
|
3303
3311
|
return;
|
|
3304
3312
|
}
|
|
3305
3313
|
if (t.includeSearch && !(document.activeElement instanceof HTMLInputElement)) {
|
|
@@ -3309,8 +3317,8 @@ var $n = (e, t) => t && (e.find((e) => e.value === t) || e.find((e) => e.label =
|
|
|
3309
3317
|
return;
|
|
3310
3318
|
}
|
|
3311
3319
|
}
|
|
3312
|
-
n[0] &&
|
|
3313
|
-
},
|
|
3320
|
+
n[0] && fr(n[0]);
|
|
3321
|
+
}, vr = ({ state: e, outside: t = !1 }) => {
|
|
3314
3322
|
let { values: n, options: r, disabled: i, displayValueAs: a, handleTagRemove: o, handleTagKeydown: s, focusedTagIndex: l } = e, u = p([]);
|
|
3315
3323
|
if (c(() => {
|
|
3316
3324
|
!t && l >= 0 && l < n.length && u.current[l]?.focus();
|
|
@@ -3320,10 +3328,10 @@ var $n = (e, t) => t && (e.find((e) => e.value === t) || e.find((e) => e.label =
|
|
|
3320
3328
|
n.length
|
|
3321
3329
|
]), n.length === 0) return null;
|
|
3322
3330
|
let d = n.map((e, n) => {
|
|
3323
|
-
let c =
|
|
3331
|
+
let c = er(r, e), d = c?.tagSkinColor, f = c ? ar(c, a) : e;
|
|
3324
3332
|
return i ? /* @__PURE__ */ _("li", {
|
|
3325
3333
|
role: "listitem",
|
|
3326
|
-
children: /* @__PURE__ */ _(
|
|
3334
|
+
children: /* @__PURE__ */ _(Vn, {
|
|
3327
3335
|
skin: d || "blue-dark",
|
|
3328
3336
|
children: /* @__PURE__ */ _("span", {
|
|
3329
3337
|
className: "pkt-combobox__value",
|
|
@@ -3332,7 +3340,7 @@ var $n = (e, t) => t && (e.find((e) => e.value === t) || e.find((e) => e.label =
|
|
|
3332
3340
|
})
|
|
3333
3341
|
}, e) : t ? /* @__PURE__ */ _("li", {
|
|
3334
3342
|
role: "listitem",
|
|
3335
|
-
children: /* @__PURE__ */ _(
|
|
3343
|
+
children: /* @__PURE__ */ _(Vn, {
|
|
3336
3344
|
skin: d || "blue-dark",
|
|
3337
3345
|
closeTag: !0,
|
|
3338
3346
|
onClose: () => o(e),
|
|
@@ -3345,7 +3353,7 @@ var $n = (e, t) => t && (e.find((e) => e.value === t) || e.find((e) => e.label =
|
|
|
3345
3353
|
role: "listitem",
|
|
3346
3354
|
onClick: (e) => e.stopPropagation(),
|
|
3347
3355
|
onMouseDown: (e) => e.preventDefault(),
|
|
3348
|
-
children: /* @__PURE__ */ _(
|
|
3356
|
+
children: /* @__PURE__ */ _(Vn, {
|
|
3349
3357
|
ref: (e) => {
|
|
3350
3358
|
u.current[n] = e;
|
|
3351
3359
|
},
|
|
@@ -3373,17 +3381,17 @@ var $n = (e, t) => t && (e.find((e) => e.value === t) || e.find((e) => e.label =
|
|
|
3373
3381
|
className: "pkt-combobox__tag-list",
|
|
3374
3382
|
children: d
|
|
3375
3383
|
});
|
|
3376
|
-
},
|
|
3384
|
+
}, yr = ({ state: e }) => {
|
|
3377
3385
|
let { values: t, options: n, editingSingleValue: r, displayValueAs: i } = e;
|
|
3378
3386
|
if (r || t.length === 0) return null;
|
|
3379
|
-
let a =
|
|
3387
|
+
let a = er(n, t[0]);
|
|
3380
3388
|
if (!a) return null;
|
|
3381
|
-
let o =
|
|
3389
|
+
let o = ar(a, i);
|
|
3382
3390
|
return /* @__PURE__ */ _("span", {
|
|
3383
3391
|
className: "pkt-combobox__value",
|
|
3384
3392
|
children: o
|
|
3385
3393
|
});
|
|
3386
|
-
},
|
|
3394
|
+
}, br = ({ state: e }) => {
|
|
3387
3395
|
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, inputRef: y, triggerRef: b, handleInputChange: x, handleInputKeydown: S, handleInputFocus: C, handleInputBlur: w, handleInputClick: T, handlePlaceholderClick: E, handleSelectOnlyKeydown: D, name: O, inputSize: k } = e, A = [
|
|
3388
3396
|
"pkt-combobox__input",
|
|
3389
3397
|
`pkt-combobox__input--${k}`,
|
|
@@ -3391,7 +3399,7 @@ var $n = (e, t) => t && (e.find((e) => e.value === t) || e.find((e) => e.label =
|
|
|
3391
3399
|
o && "pkt-combobox__input--open",
|
|
3392
3400
|
m && "pkt-combobox__input--error",
|
|
3393
3401
|
f && "pkt-combobox__input--disabled"
|
|
3394
|
-
].filter(Boolean).join(" "), j = ["pkt-combobox__arrow-icon", o && "pkt-combobox__arrow-icon--open"].filter(Boolean).join(" "), M = c || l, N = !M && d && (!i.length || s && u === "outside") && !g, P = u !== "outside", ee = i[0] &&
|
|
3402
|
+
].filter(Boolean).join(" "), j = ["pkt-combobox__arrow-icon", o && "pkt-combobox__arrow-icon--open"].filter(Boolean).join(" "), M = c || l, N = !M && d && (!i.length || s && u === "outside") && !g, P = u !== "outside", ee = i[0] && er(a, i[0]) ? `${r}-${tr(a, i[0])}` : void 0, te = s && i.length > 0 ? `${i.length} valgt` : void 0, ne = M ? { tabIndex: -1 } : {
|
|
3395
3403
|
id: `${t}-combobox`,
|
|
3396
3404
|
role: "combobox",
|
|
3397
3405
|
"aria-expanded": o ? "true" : "false",
|
|
@@ -3413,7 +3421,7 @@ var $n = (e, t) => t && (e.find((e) => e.value === t) || e.find((e) => e.label =
|
|
|
3413
3421
|
className: "pkt-combobox__placeholder",
|
|
3414
3422
|
onClick: E,
|
|
3415
3423
|
children: d
|
|
3416
|
-
}) : P ? s ? /* @__PURE__ */ _(
|
|
3424
|
+
}) : P ? s ? /* @__PURE__ */ _(vr, { state: e }) : M ? null : /* @__PURE__ */ _(yr, { state: e }) : null,
|
|
3417
3425
|
M ? /* @__PURE__ */ _("div", {
|
|
3418
3426
|
className: "pkt-combobox__input-div combobox__input",
|
|
3419
3427
|
children: /* @__PURE__ */ _("input", {
|
|
@@ -3451,7 +3459,7 @@ var $n = (e, t) => t && (e.find((e) => e.value === t) || e.find((e) => e.label =
|
|
|
3451
3459
|
})
|
|
3452
3460
|
]
|
|
3453
3461
|
});
|
|
3454
|
-
},
|
|
3462
|
+
}, xr = ({ state: e }) => {
|
|
3455
3463
|
let t = ge(["listbox"], e.strings), { listboxId: n, label: r, isOpen: i, options: a, filteredOptions: o, multiple: s, disabled: c, maxIsReached: l, maxlength: u, includeSearch: d, allowUserInput: f, addValueText: p, userInfoMessage: m, searchPlaceholder: h, searchValue: y, handleOptionClick: b, handleOptionKeydown: x, handleSearchInput: S, handleSearchKeydown: C, handleNewOptionClick: w, handleNewOptionKeydown: T, listboxRef: E } = e, D = o.filter((e) => e.selected).length, O = s && D > 0 && u != null && u > 0, k = f && p && !l, A = !!m, j = [
|
|
3456
3464
|
"pkt-listbox",
|
|
3457
3465
|
i && "pkt-listbox__open",
|
|
@@ -3586,15 +3594,15 @@ var $n = (e, t) => t && (e.find((e) => e.value === t) || e.find((e) => e.label =
|
|
|
3586
3594
|
};
|
|
3587
3595
|
//#endregion
|
|
3588
3596
|
//#region src/components/combobox/useComboboxState.ts
|
|
3589
|
-
function
|
|
3597
|
+
function Sr(e, t) {
|
|
3590
3598
|
return e.map((e) => ({
|
|
3591
3599
|
...e,
|
|
3592
3600
|
label: e.label || e.value,
|
|
3593
|
-
fulltext:
|
|
3601
|
+
fulltext: rr(e),
|
|
3594
3602
|
selected: t.includes(e.value)
|
|
3595
3603
|
}));
|
|
3596
3604
|
}
|
|
3597
|
-
function
|
|
3605
|
+
function Cr(t, n) {
|
|
3598
3606
|
let { id: r = "", label: i, value: s, defaultValue: l, options: d, defaultOptions: h, multiple: g = !1, maxlength: _, typeahead: v = !1, includeSearch: y = !1, allowUserInput: b = !1, displayValueAs: x = "label", tagPlacement: S, searchPlaceholder: C, placeholder: w, disabled: T = !1, required: E = !1, fullwidth: D = !1, hasError: O = !1, errorMessage: k, helptext: A, helptextDropdown: j, helptextDropdownButton: M, optionalTag: N = !1, optionalText: P, requiredTag: ee = !1, requiredText: te, tagText: ne, useWrapper: F = !0, inline: re = !1, counter: ie, inputSize: ae = "medium", name: oe, className: se, onChange: I, onValueChange: L, children: R, strings: ce } = t, z = `${r}-input`, B = `${r}-listbox`, V = v || b, H = p(null), le = p(null), ue = p(null), U = p(null), de = p(null), W = o(() => {
|
|
3599
3607
|
V ? H.current?.focus() : ue.current?.focus();
|
|
3600
3608
|
}, [V]), G = f(() => {
|
|
@@ -3612,30 +3620,30 @@ function Sr(t, n) {
|
|
|
3612
3620
|
}), t;
|
|
3613
3621
|
}, [R]), K = f(() => h && h.length > 0 ? h.map((e) => ({
|
|
3614
3622
|
...e,
|
|
3615
|
-
fulltext:
|
|
3623
|
+
fulltext: rr(e)
|
|
3616
3624
|
})) : d && d.length > 0 ? d.map((e) => ({
|
|
3617
3625
|
...e,
|
|
3618
|
-
fulltext:
|
|
3626
|
+
fulltext: rr(e)
|
|
3619
3627
|
})) : G.length > 0 ? G.map((e) => ({
|
|
3620
3628
|
...e,
|
|
3621
|
-
fulltext:
|
|
3629
|
+
fulltext: rr(e)
|
|
3622
3630
|
})) : [], [
|
|
3623
3631
|
h,
|
|
3624
3632
|
d,
|
|
3625
3633
|
G
|
|
3626
|
-
]), fe = s !== void 0, [q, pe] = m(() =>
|
|
3634
|
+
]), fe = s !== void 0, [q, pe] = m(() => or(s ?? l, g)), me = p(q);
|
|
3627
3635
|
c(() => {
|
|
3628
|
-
fe && pe(
|
|
3636
|
+
fe && pe(or(s, g));
|
|
3629
3637
|
}, [
|
|
3630
3638
|
s,
|
|
3631
3639
|
fe,
|
|
3632
3640
|
g
|
|
3633
3641
|
]);
|
|
3634
|
-
let J = fe ?
|
|
3642
|
+
let J = fe ? or(s, g) : q, [Y, he] = m([]), X = f(() => Sr([...Y.filter((e) => !K.some((t) => t.value === e.value)), ...K], J), [
|
|
3635
3643
|
K,
|
|
3636
3644
|
Y,
|
|
3637
3645
|
J
|
|
3638
|
-
]), [Z, Q] = m(!1), [_e, ve] = m(""), [ye, be] = m(""), [xe, Se] = m(""), [Ce, we] = m(null), [Te, Ee] = m(!1), [De, Oe] = m(!1), [ke, $] = m(-1), Ae = p(!1), je = ge(["combobox"], ce), Me = xe ? je.combobox[xe] : "", Ne =
|
|
3646
|
+
]), [Z, Q] = m(!1), [_e, ve] = m(""), [ye, be] = m(""), [xe, Se] = m(""), [Ce, we] = m(null), [Te, Ee] = m(!1), [De, Oe] = m(!1), [ke, $] = m(-1), Ae = p(!1), je = ge(["combobox"], ce), Me = xe ? je.combobox[xe] : "", Ne = ir(J.length, _ ?? null), Pe = ie ?? (g && _ != null), Fe = f(() => _e ? v ? sr(X, _e).filtered : nr(X, _e) : X, [
|
|
3639
3647
|
X,
|
|
3640
3648
|
_e,
|
|
3641
3649
|
v
|
|
@@ -3649,7 +3657,7 @@ function Sr(t, n) {
|
|
|
3649
3657
|
le.current && (le.current.value = Re);
|
|
3650
3658
|
}, [Re]), c(() => {
|
|
3651
3659
|
if (Z || !H.current) return;
|
|
3652
|
-
let e = !g && J[0] ?
|
|
3660
|
+
let e = !g && J[0] ? dr(J[0], X, x) : "";
|
|
3653
3661
|
H.current.value !== e && (H.current.value = e);
|
|
3654
3662
|
}, [
|
|
3655
3663
|
J,
|
|
@@ -3666,7 +3674,7 @@ function Sr(t, n) {
|
|
|
3666
3674
|
Le
|
|
3667
3675
|
]), Be = o((e) => {
|
|
3668
3676
|
if (!e || J.includes(e)) return;
|
|
3669
|
-
if (g &&
|
|
3677
|
+
if (g && ir(J.length, _ ?? null)) {
|
|
3670
3678
|
Se("maxSelected");
|
|
3671
3679
|
return;
|
|
3672
3680
|
}
|
|
@@ -3680,7 +3688,7 @@ function Sr(t, n) {
|
|
|
3680
3688
|
]), Ve = o((e) => {
|
|
3681
3689
|
if (!e) return;
|
|
3682
3690
|
let t = J.filter((t) => t !== e);
|
|
3683
|
-
|
|
3691
|
+
er(X, e)?.userAdded && he((t) => t.filter((t) => t.value !== e)), ze(t);
|
|
3684
3692
|
}, [
|
|
3685
3693
|
J,
|
|
3686
3694
|
X,
|
|
@@ -3692,7 +3700,7 @@ function Sr(t, n) {
|
|
|
3692
3700
|
let t;
|
|
3693
3701
|
if (!g) t = [e];
|
|
3694
3702
|
else {
|
|
3695
|
-
if (
|
|
3703
|
+
if (er(X, e) || ir(J.length, _ ?? null)) return;
|
|
3696
3704
|
t = [...J, e];
|
|
3697
3705
|
}
|
|
3698
3706
|
let n = {
|
|
@@ -3712,7 +3720,7 @@ function Sr(t, n) {
|
|
|
3712
3720
|
if (we(null), e && H.current && H.current.type !== "hidden") {
|
|
3713
3721
|
ve(""), be("");
|
|
3714
3722
|
let e = t === void 0 ? J[0] : t;
|
|
3715
|
-
!g && e ? H.current.value =
|
|
3723
|
+
!g && e ? H.current.value = dr(e, X, x) : H.current.value = "", g || (Oe(!1), Se(""));
|
|
3716
3724
|
}
|
|
3717
3725
|
}, [
|
|
3718
3726
|
g,
|
|
@@ -3722,7 +3730,7 @@ function Sr(t, n) {
|
|
|
3722
3730
|
]), Ge = o((e) => {
|
|
3723
3731
|
if (T) return;
|
|
3724
3732
|
Se(""), we(null);
|
|
3725
|
-
let t =
|
|
3733
|
+
let t = er(X, e)?.value || null, n = J.includes(e || t || ""), r = !!t, i = X.find((t) => t.value === e)?.disabled || !1, a = !e?.trim(), o = !g, s = g, c = ir(J.length, _ ?? null), l = !1, u = !0, d = "", f = "", p;
|
|
3726
3734
|
i || (!r && b && !a ? (Ue(e), d = "valueAdded", l = s, o && (p = e || "")) : !r && !b ? (o && J[0] && Ve(J[0]), u = !1, l = !0, d = "noResults") : n ? (Ve(t), l = !0, p = "", o && V && H.current && H.current.type !== "hidden" && (H.current.value = "")) : a && o ? (He(), l = !0, p = "") : o ? (J[0] && Ve(J[0]), Be(t), l = !1, p = t || "") : s && !c ? (Be(t), l = !0) : s && c ? (d = "maxSelected", u = !1, f = e || "") : (o && He(), d = "noValidValue", u = !1, l = !0, f = e || "", p = ""), Q(l), Se(d), ve(f), We(u, p), l || (o && V && (Ae.current = !0), window.setTimeout(() => {
|
|
3727
3735
|
W();
|
|
3728
3736
|
}, 0)));
|
|
@@ -3745,11 +3753,11 @@ function Sr(t, n) {
|
|
|
3745
3753
|
if (!g) {
|
|
3746
3754
|
if (!e) J[0] && Ve(J[0]), t = void 0;
|
|
3747
3755
|
else {
|
|
3748
|
-
let n =
|
|
3756
|
+
let n = er(X, e);
|
|
3749
3757
|
n && n.value !== J[0] ? (J[0] && Ve(J[0]), Be(n.value), t = n.value) : !n && b && (J[0] && Ve(J[0]), Ue(e), t = e);
|
|
3750
3758
|
}
|
|
3751
3759
|
} else if (e !== "") {
|
|
3752
|
-
let { action: t, value: n } =
|
|
3760
|
+
let { action: t, value: n } = ur(e, J, X, b, g);
|
|
3753
3761
|
switch (t) {
|
|
3754
3762
|
case "addUserValue":
|
|
3755
3763
|
Ue(n);
|
|
@@ -3760,7 +3768,7 @@ function Sr(t, n) {
|
|
|
3760
3768
|
case "removeValue": Ve(n);
|
|
3761
3769
|
}
|
|
3762
3770
|
}
|
|
3763
|
-
!g && t ? H.current.value =
|
|
3771
|
+
!g && t ? H.current.value = dr(t, X, x) : H.current.value = "";
|
|
3764
3772
|
}
|
|
3765
3773
|
Q(!1), Oe(!1);
|
|
3766
3774
|
}, [
|
|
@@ -3777,7 +3785,7 @@ function Sr(t, n) {
|
|
|
3777
3785
|
we(null), Se(""), !g && J[0] && Ve(J[0]);
|
|
3778
3786
|
return;
|
|
3779
3787
|
}
|
|
3780
|
-
let t =
|
|
3788
|
+
let t = cr(e, J, X, b);
|
|
3781
3789
|
we(t.addValueText), Se(t.userInfoMessage);
|
|
3782
3790
|
}, [
|
|
3783
3791
|
J,
|
|
@@ -3789,7 +3797,7 @@ function Sr(t, n) {
|
|
|
3789
3797
|
if (T) return;
|
|
3790
3798
|
let t = e.target.value;
|
|
3791
3799
|
if (be(t), ve(t), qe(t), v && t) {
|
|
3792
|
-
let { suggestion: n } =
|
|
3800
|
+
let { suggestion: n } = sr(X, t);
|
|
3793
3801
|
n?.label && H.current && !e.nativeEvent.inputType?.includes("deleteContent") && (H.current.value = n.label, window.setTimeout(() => H.current?.setSelectionRange(t.length, n.label.length), 0));
|
|
3794
3802
|
}
|
|
3795
3803
|
}, [
|
|
@@ -3811,7 +3819,7 @@ function Sr(t, n) {
|
|
|
3811
3819
|
e.preventDefault(), $(J.length - 1);
|
|
3812
3820
|
return;
|
|
3813
3821
|
}
|
|
3814
|
-
let t =
|
|
3822
|
+
let t = lr(e.key, e.shiftKey, g);
|
|
3815
3823
|
if (t && !(e.key === "Tab" && !Z)) {
|
|
3816
3824
|
if (t === "focusListbox" && e.key === "Tab" && !U.current?.querySelector("[role=\"option\"]:not([data-disabled]), [data-type=\"new-option\"]")) {
|
|
3817
3825
|
Ke();
|
|
@@ -3828,7 +3836,7 @@ function Sr(t, n) {
|
|
|
3828
3836
|
break;
|
|
3829
3837
|
}
|
|
3830
3838
|
case "focusListbox":
|
|
3831
|
-
U.current && (Z || Q(!0),
|
|
3839
|
+
U.current && (Z || Q(!0), _r(U.current, {
|
|
3832
3840
|
disabled: T,
|
|
3833
3841
|
allowUserInput: b,
|
|
3834
3842
|
customUserInput: Ce,
|
|
@@ -3856,7 +3864,7 @@ function Sr(t, n) {
|
|
|
3856
3864
|
Ae.current = !1, Ee(!0);
|
|
3857
3865
|
return;
|
|
3858
3866
|
}
|
|
3859
|
-
!g && J[0] && H.current && H.current.type !== "hidden" && (Oe(!0), H.current.value =
|
|
3867
|
+
!g && J[0] && H.current && H.current.type !== "hidden" && (Oe(!0), H.current.value = dr(J[0], X, x)), Ee(!0), ve(""), Q(!0);
|
|
3860
3868
|
}
|
|
3861
3869
|
}, [
|
|
3862
3870
|
T,
|
|
@@ -3883,7 +3891,7 @@ function Sr(t, n) {
|
|
|
3883
3891
|
else {
|
|
3884
3892
|
e.stopPropagation(), e.preventDefault();
|
|
3885
3893
|
let t = !Z;
|
|
3886
|
-
Q(t), t && U.current &&
|
|
3894
|
+
Q(t), t && U.current && _r(U.current, {
|
|
3887
3895
|
disabled: T,
|
|
3888
3896
|
allowUserInput: b,
|
|
3889
3897
|
customUserInput: Ce,
|
|
@@ -3906,7 +3914,7 @@ function Sr(t, n) {
|
|
|
3906
3914
|
case "ArrowDown":
|
|
3907
3915
|
case "ArrowUp":
|
|
3908
3916
|
e.preventDefault(), Z ? Q(!1) : (Q(!0), U.current && window.setTimeout(() => {
|
|
3909
|
-
U.current &&
|
|
3917
|
+
U.current && _r(U.current, {
|
|
3910
3918
|
disabled: T,
|
|
3911
3919
|
allowUserInput: b && !Ne,
|
|
3912
3920
|
customUserInput: Ce,
|
|
@@ -3920,7 +3928,7 @@ function Sr(t, n) {
|
|
|
3920
3928
|
case "Home":
|
|
3921
3929
|
case "End":
|
|
3922
3930
|
e.preventDefault(), Z || Q(!0), U.current && window.setTimeout(() => {
|
|
3923
|
-
U.current &&
|
|
3931
|
+
U.current && _r(U.current, {
|
|
3924
3932
|
disabled: T,
|
|
3925
3933
|
allowUserInput: b && !Ne,
|
|
3926
3934
|
customUserInput: Ce,
|
|
@@ -3957,10 +3965,10 @@ function Sr(t, n) {
|
|
|
3957
3965
|
e.preventDefault(), Ge(t);
|
|
3958
3966
|
break;
|
|
3959
3967
|
case "ArrowDown":
|
|
3960
|
-
e.preventDefault(),
|
|
3968
|
+
e.preventDefault(), mr(e.currentTarget);
|
|
3961
3969
|
break;
|
|
3962
3970
|
case "ArrowUp":
|
|
3963
|
-
e.preventDefault(), U.current &&
|
|
3971
|
+
e.preventDefault(), U.current && hr(e.currentTarget, U.current, y);
|
|
3964
3972
|
break;
|
|
3965
3973
|
case "Escape":
|
|
3966
3974
|
e.preventDefault(), Q(!1), W();
|
|
@@ -4020,10 +4028,10 @@ function Sr(t, n) {
|
|
|
4020
4028
|
e.preventDefault(), Ge(e.currentTarget.dataset.value || "");
|
|
4021
4029
|
break;
|
|
4022
4030
|
case "ArrowDown":
|
|
4023
|
-
e.preventDefault(), U.current &&
|
|
4031
|
+
e.preventDefault(), U.current && gr(U.current);
|
|
4024
4032
|
break;
|
|
4025
4033
|
case "ArrowUp":
|
|
4026
|
-
e.preventDefault(), U.current &&
|
|
4034
|
+
e.preventDefault(), U.current && hr(e.currentTarget, U.current, y);
|
|
4027
4035
|
break;
|
|
4028
4036
|
case "Escape": e.preventDefault(), Q(!1), W();
|
|
4029
4037
|
}
|
|
@@ -4139,8 +4147,8 @@ function Sr(t, n) {
|
|
|
4139
4147
|
}
|
|
4140
4148
|
//#endregion
|
|
4141
4149
|
//#region src/components/combobox/Combobox.tsx
|
|
4142
|
-
var
|
|
4143
|
-
let n =
|
|
4150
|
+
var wr = i((e, t) => {
|
|
4151
|
+
let n = Cr(e, t), r = [
|
|
4144
4152
|
"pkt-combobox-component",
|
|
4145
4153
|
n.fullwidth && "pkt-combobox-component--fullwidth",
|
|
4146
4154
|
n.className
|
|
@@ -4149,7 +4157,7 @@ var Cr = i((e, t) => {
|
|
|
4149
4157
|
className: r,
|
|
4150
4158
|
ref: n.wrapperRef,
|
|
4151
4159
|
id: n.id || void 0,
|
|
4152
|
-
children: [/* @__PURE__ */ v(
|
|
4160
|
+
children: [/* @__PURE__ */ v($n, {
|
|
4153
4161
|
strings: n.strings,
|
|
4154
4162
|
forId: a,
|
|
4155
4163
|
hasFieldset: e.hasFieldset ?? !i,
|
|
@@ -4175,8 +4183,8 @@ var Cr = i((e, t) => {
|
|
|
4175
4183
|
children: [/* @__PURE__ */ v("div", {
|
|
4176
4184
|
className: "pkt-combobox",
|
|
4177
4185
|
onBlur: n.handleFocusOut,
|
|
4178
|
-
children: [/* @__PURE__ */ _(
|
|
4179
|
-
}), n.tagPlacement === "outside" && n.multiple && /* @__PURE__ */ _(
|
|
4186
|
+
children: [/* @__PURE__ */ _(br, { state: n }), /* @__PURE__ */ _(xr, { state: n })]
|
|
4187
|
+
}), n.tagPlacement === "outside" && n.multiple && /* @__PURE__ */ _(vr, {
|
|
4180
4188
|
state: n,
|
|
4181
4189
|
outside: !0
|
|
4182
4190
|
})]
|
|
@@ -4191,10 +4199,10 @@ var Cr = i((e, t) => {
|
|
|
4191
4199
|
})]
|
|
4192
4200
|
});
|
|
4193
4201
|
});
|
|
4194
|
-
|
|
4202
|
+
wr.displayName = "PktCombobox";
|
|
4195
4203
|
//#endregion
|
|
4196
4204
|
//#region src/components/consent/Consent.tsx
|
|
4197
|
-
var
|
|
4205
|
+
var Tr = null, Er = () => Tr || (Tr = new Promise((e, t) => {
|
|
4198
4206
|
if (document.querySelector("#oslo-consent-script")) {
|
|
4199
4207
|
e();
|
|
4200
4208
|
return;
|
|
@@ -4203,14 +4211,14 @@ var wr = null, Tr = () => wr || (wr = new Promise((e, t) => {
|
|
|
4203
4211
|
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);
|
|
4204
4212
|
let r = document.createElement("link");
|
|
4205
4213
|
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);
|
|
4206
|
-
}),
|
|
4214
|
+
}), Tr), Dr = (e) => {
|
|
4207
4215
|
if (typeof e != "string") return e;
|
|
4208
4216
|
try {
|
|
4209
4217
|
return JSON.parse(e);
|
|
4210
4218
|
} catch {
|
|
4211
4219
|
return e;
|
|
4212
4220
|
}
|
|
4213
|
-
},
|
|
4221
|
+
}, Or = (e) => Dr(e.value).items.reduce((e, t) => (e[t.name] = t.consent, e), {}), kr = i(function({ devMode: e = !1, cookieDomain: t = null, cookieSecure: n = null, cookieExpiryDays: r = null, hotjarId: i = null, googleAnalyticsId: a = null, i18nLanguage: o = "nb", triggerType: s = "button", triggerText: l, onToggleConsent: u, ...d }, f) {
|
|
4214
4222
|
let m = p(u);
|
|
4215
4223
|
m.current = u;
|
|
4216
4224
|
let h = p({
|
|
@@ -4236,7 +4244,7 @@ var wr = null, Tr = () => wr || (wr = new Promise((e, t) => {
|
|
|
4236
4244
|
let r = (e) => {
|
|
4237
4245
|
let t = m.current;
|
|
4238
4246
|
t && t(new CustomEvent("toggle-consent", {
|
|
4239
|
-
detail:
|
|
4247
|
+
detail: Or(e),
|
|
4240
4248
|
bubbles: !0,
|
|
4241
4249
|
cancelable: !1
|
|
4242
4250
|
}));
|
|
@@ -4254,7 +4262,7 @@ var wr = null, Tr = () => wr || (wr = new Promise((e, t) => {
|
|
|
4254
4262
|
e || r({ value: o });
|
|
4255
4263
|
}, 0), t && i.off("CookieManager.setCookie", t), t = (e) => r(e), i.on("CookieManager.setCookie", t);
|
|
4256
4264
|
});
|
|
4257
|
-
},
|
|
4265
|
+
}, Er().then(() => {
|
|
4258
4266
|
e || g.current();
|
|
4259
4267
|
}), () => {
|
|
4260
4268
|
e = !0, t && window.__cookieEvents?.off("CookieManager.setCookie", t);
|
|
@@ -4294,13 +4302,13 @@ var wr = null, Tr = () => wr || (wr = new Promise((e, t) => {
|
|
|
4294
4302
|
children: y
|
|
4295
4303
|
});
|
|
4296
4304
|
});
|
|
4297
|
-
|
|
4305
|
+
kr.displayName = "PktConsent";
|
|
4298
4306
|
//#endregion
|
|
4299
4307
|
//#region ../../shared-utils/device-utils.ts
|
|
4300
|
-
var
|
|
4308
|
+
var Ar = () => {
|
|
4301
4309
|
let e = navigator.userAgent;
|
|
4302
4310
|
return !!(/iP(hone|od|ad)/.test(e) || /Macintosh/.test(e) && "ontouchend" in document);
|
|
4303
|
-
},
|
|
4311
|
+
}, jr = () => Ar() ? "text" : "date", Mr = (e) => !e || e.length !== 2 || dn(e[0], e[1]), Nr = (e, t, n, r, i, a, o = "medium") => ({
|
|
4304
4312
|
"pkt-input": !0,
|
|
4305
4313
|
"pkt-datepicker__input": !0,
|
|
4306
4314
|
[`pkt-input--${o}`]: !0,
|
|
@@ -4309,27 +4317,27 @@ var kr = () => {
|
|
|
4309
4317
|
"pkt-datepicker--multiple": n,
|
|
4310
4318
|
"pkt-datepicker--range": r,
|
|
4311
4319
|
"ios-readonly-hack": i === !1 && a === "text"
|
|
4312
|
-
}),
|
|
4320
|
+
}), Pr = (e = "medium") => ({
|
|
4313
4321
|
"pkt-input-icon": !0,
|
|
4314
4322
|
"pkt-btn": !0,
|
|
4315
4323
|
"pkt-btn--icon-only": !0,
|
|
4316
4324
|
"pkt-btn--tertiary": !0,
|
|
4317
4325
|
[`pkt-btn--${e}`]: !0,
|
|
4318
4326
|
"pkt-datepicker__calendar-button": !0
|
|
4319
|
-
}),
|
|
4327
|
+
}), Fr = (e) => ({
|
|
4320
4328
|
"pkt-input-prefix": e,
|
|
4321
4329
|
"pkt-hide": !e
|
|
4322
|
-
}),
|
|
4330
|
+
}), Ir = (e, t, n) => !t && !n ? Array.isArray(e) ? e[0] || "" : e : Array.isArray(e) ? e.join(",") : e, Lr = (e, t, n = !1) => {
|
|
4323
4331
|
if (!e || !t) return;
|
|
4324
4332
|
let r = t.parentElement?.getBoundingClientRect() || t.getBoundingClientRect(), i = n ? r.height + 30 : r.height, a = e.getBoundingClientRect().height, o = n ? "calc(100% - 30px)" : "100%";
|
|
4325
4333
|
r && typeof window < "u" && r.top + a > window.innerHeight && r.top - a > 0 && (o = `calc(100% - ${i}px - ${a}px)`), e.style.top = o;
|
|
4326
|
-
},
|
|
4334
|
+
}, Rr = (e, t, n, r, i, a) => {
|
|
4327
4335
|
let { key: o } = e;
|
|
4328
4336
|
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());
|
|
4329
|
-
},
|
|
4337
|
+
}, zr = ({ 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 }) => {
|
|
4330
4338
|
let b = p(null), x = p(!1);
|
|
4331
4339
|
e && (x.current = !0), c(() => {
|
|
4332
|
-
e &&
|
|
4340
|
+
e && Lr(b.current, h?.current ?? null, g);
|
|
4333
4341
|
}, [
|
|
4334
4342
|
e,
|
|
4335
4343
|
h,
|
|
@@ -4341,7 +4349,7 @@ var kr = () => {
|
|
|
4341
4349
|
className: S,
|
|
4342
4350
|
hidden: !e,
|
|
4343
4351
|
"aria-hidden": !e,
|
|
4344
|
-
children: C && /* @__PURE__ */ _(
|
|
4352
|
+
children: C && /* @__PURE__ */ _(Ln, {
|
|
4345
4353
|
multiple: t,
|
|
4346
4354
|
range: n,
|
|
4347
4355
|
weeknumbers: r,
|
|
@@ -4358,14 +4366,14 @@ var kr = () => {
|
|
|
4358
4366
|
onClose: y
|
|
4359
4367
|
})
|
|
4360
4368
|
});
|
|
4361
|
-
},
|
|
4369
|
+
}, Br = ({ dates: e, dateformat: t, idBase: n, strings: r, onDateRemoved: i }) => {
|
|
4362
4370
|
let a = un(e), o = ge(["datepicker"], r).datepicker.deleteDate;
|
|
4363
4371
|
return /* @__PURE__ */ _("div", {
|
|
4364
4372
|
className: "pkt-date-tags pkt-datepicker__tags",
|
|
4365
4373
|
"aria-live": "polite",
|
|
4366
4374
|
children: a.map((e) => {
|
|
4367
4375
|
let r = Zt(e, t);
|
|
4368
|
-
return /* @__PURE__ */ _(
|
|
4376
|
+
return /* @__PURE__ */ _(Vn, {
|
|
4369
4377
|
id: `${n}${e}-tag`,
|
|
4370
4378
|
closeTag: !0,
|
|
4371
4379
|
ariaLabel: `${o} ${r}`,
|
|
@@ -4377,7 +4385,7 @@ var kr = () => {
|
|
|
4377
4385
|
}, e);
|
|
4378
4386
|
})
|
|
4379
4387
|
});
|
|
4380
|
-
},
|
|
4388
|
+
}, Vr = ({ state: e }) => {
|
|
4381
4389
|
let { id: t, inputId: n, values: r, dateformat: i, multiple: a, range: o, showRangeLabels: s, disabled: c, readOnly: l, required: u, label: d, name: f, placeholder: p, hasError: m, helptext: h, minStr: y, maxStr: b, inputType: x, isIOSDevice: S, strings: C, inputClasses: w, buttonClasses: T, rangeLabelClasses: E, datepickerInputsClasses: D, isInputDisabled: O, inputRef: k, inputRefTo: A, btnRef: j, toggleCalendar: M, handleFocus: N, handleSingleInputChange: P, handleRangeFromChange: ee, handleRangeToChange: te, handleRangeBlur: ne, handleMultipleBlur: F, handleTagRemoved: re, handleSingleKeydown: ie, handleRangeFromKeydown: ae, handleRangeToKeydown: oe, handleMultipleKeydown: se, restProps: I } = e, R = (e) => {
|
|
4382
4390
|
e.preventDefault(), M();
|
|
4383
4391
|
}, ce = (e) => {
|
|
@@ -4388,13 +4396,12 @@ var kr = () => {
|
|
|
4388
4396
|
type: "button",
|
|
4389
4397
|
onClick: M,
|
|
4390
4398
|
disabled: c,
|
|
4391
|
-
"aria-label": C.datepicker.openPicker,
|
|
4392
4399
|
children: [/* @__PURE__ */ _(L, { name: "calendar" }), /* @__PURE__ */ _("span", {
|
|
4393
4400
|
className: "pkt-btn__text",
|
|
4394
4401
|
children: C.datepicker.openPicker
|
|
4395
4402
|
})]
|
|
4396
4403
|
});
|
|
4397
|
-
return a ? /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _(
|
|
4404
|
+
return a ? /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _(Br, {
|
|
4398
4405
|
dates: r,
|
|
4399
4406
|
dateformat: i,
|
|
4400
4407
|
idBase: t,
|
|
@@ -4414,9 +4421,9 @@ var kr = () => {
|
|
|
4414
4421
|
placeholder: p,
|
|
4415
4422
|
readOnly: l || S && !l,
|
|
4416
4423
|
disabled: O,
|
|
4417
|
-
"aria-describedby": h ? `${
|
|
4424
|
+
"aria-describedby": h ? `${n}-helptext` : void 0,
|
|
4418
4425
|
"aria-invalid": m,
|
|
4419
|
-
"aria-errormessage": m ? `${
|
|
4426
|
+
"aria-errormessage": m ? `${n}-error` : void 0,
|
|
4420
4427
|
onClick: R,
|
|
4421
4428
|
onTouchEnd: ce,
|
|
4422
4429
|
onKeyDown: se,
|
|
@@ -4448,9 +4455,9 @@ var kr = () => {
|
|
|
4448
4455
|
disabled: c,
|
|
4449
4456
|
required: u,
|
|
4450
4457
|
"aria-label": `${d} ${C.generic.from}`,
|
|
4451
|
-
"aria-describedby": h ? `${
|
|
4458
|
+
"aria-describedby": h ? `${n}-helptext` : void 0,
|
|
4452
4459
|
"aria-invalid": m,
|
|
4453
|
-
"aria-errormessage": m ? `${
|
|
4460
|
+
"aria-errormessage": m ? `${n}-error` : void 0,
|
|
4454
4461
|
onClick: R,
|
|
4455
4462
|
onTouchEnd: ce,
|
|
4456
4463
|
onKeyDown: ae,
|
|
@@ -4508,9 +4515,9 @@ var kr = () => {
|
|
|
4508
4515
|
readOnly: l || S && !l,
|
|
4509
4516
|
disabled: c,
|
|
4510
4517
|
required: u,
|
|
4511
|
-
"aria-describedby": h ? `${
|
|
4518
|
+
"aria-describedby": h ? `${n}-helptext` : void 0,
|
|
4512
4519
|
"aria-invalid": m,
|
|
4513
|
-
"aria-errormessage": m ? `${
|
|
4520
|
+
"aria-errormessage": m ? `${n}-error` : void 0,
|
|
4514
4521
|
onClick: R,
|
|
4515
4522
|
onTouchEnd: ce,
|
|
4516
4523
|
onKeyDown: ie,
|
|
@@ -4520,7 +4527,7 @@ var kr = () => {
|
|
|
4520
4527
|
}), z()]
|
|
4521
4528
|
})
|
|
4522
4529
|
});
|
|
4523
|
-
},
|
|
4530
|
+
}, Hr = (e) => {
|
|
4524
4531
|
if (!e) return [];
|
|
4525
4532
|
if (Array.isArray(e)) return e.filter(Boolean);
|
|
4526
4533
|
if (typeof e == "string" && e.trimStart().startsWith("[")) try {
|
|
@@ -4531,8 +4538,8 @@ var kr = () => {
|
|
|
4531
4538
|
};
|
|
4532
4539
|
//#endregion
|
|
4533
4540
|
//#region src/components/datepicker/useDatepickerState.ts
|
|
4534
|
-
function
|
|
4535
|
-
let { id: n, label: r, value: i, defaultValue: a, dateformat: s = "dd.MM.yyyy", multiple: l = !1, maxlength: d, range: h = !1, showRangeLabels: g = !1, weeknumbers: _ = !1, withcontrols: v = !1, excludedates: y, excludeweekdays: b, currentmonth: x, today: S, calendarOpen: C, timezone: w, fullwidth: T = !1, inputSize: E = "medium", hasFieldset: D = !1, counter: O, inline: k = !1, helptext: A, helptextDropdown: j, helptextDropdownButton: M, hasError: N = !1, errorMessage: P, optionalTag: ee = !1, optionalText: te, requiredTag: ne = !1, requiredText: F, tagText: re, useWrapper: ie = !0, strings: ae, disabled: oe = !1, readOnly: se = !1, required: I = !1, name: L, min: R, max: ce, placeholder: z, onChange: B, onValueChange: V, className: H, ...le } = e, ue = o((e) => e === void 0 ? [] :
|
|
4541
|
+
function Ur(e, t) {
|
|
4542
|
+
let { id: n, label: r, value: i, defaultValue: a, dateformat: s = "dd.MM.yyyy", multiple: l = !1, maxlength: d, range: h = !1, showRangeLabels: g = !1, weeknumbers: _ = !1, withcontrols: v = !1, excludedates: y, excludeweekdays: b, currentmonth: x, today: S, calendarOpen: C, timezone: w, fullwidth: T = !1, inputSize: E = "medium", hasFieldset: D = !1, counter: O, inline: k = !1, helptext: A, helptextDropdown: j, helptextDropdownButton: M, hasError: N = !1, errorMessage: P, optionalTag: ee = !1, optionalText: te, requiredTag: ne = !1, requiredText: F, tagText: re, useWrapper: ie = !0, strings: ae, disabled: oe = !1, readOnly: se = !1, required: I = !1, name: L, min: R, max: ce, placeholder: z, onChange: B, onValueChange: V, className: H, ...le } = e, ue = o((e) => e === void 0 ? [] : Hr(e), []), U = i !== void 0, de = typeof a == "number" ? void 0 : a, [W, G] = m(() => ue(i ?? de)), K = U ? ue(i) : W, fe = p(W);
|
|
4536
4543
|
c(() => {
|
|
4537
4544
|
U && G(ue(i));
|
|
4538
4545
|
}, [
|
|
@@ -4544,12 +4551,12 @@ function Hr(e, t) {
|
|
|
4544
4551
|
c(() => {
|
|
4545
4552
|
C !== void 0 && pe(C);
|
|
4546
4553
|
}, [C]);
|
|
4547
|
-
let me = p(null), J = p(null), Y = p(null), he = p(null), X = p(null), Z = f(() =>
|
|
4554
|
+
let me = p(null), J = p(null), Y = p(null), he = p(null), X = p(null), Z = f(() => jr(), []), Q = f(() => Ar(), []), _e = ge([
|
|
4548
4555
|
"generic",
|
|
4549
4556
|
"datepicker",
|
|
4550
4557
|
"validation"
|
|
4551
4558
|
], ae), ve = ae, ye = typeof R == "string" ? R : R === void 0 ? void 0 : String(R), be = typeof ce == "string" ? ce : ce === void 0 ? void 0 : String(ce), xe = f(() => {
|
|
4552
|
-
let e =
|
|
4559
|
+
let e = Nr(T, g, l, h, se, Z, E);
|
|
4553
4560
|
return Object.entries(e).filter(([, e]) => e).map(([e]) => e).join(" ");
|
|
4554
4561
|
}, [
|
|
4555
4562
|
T,
|
|
@@ -4559,8 +4566,8 @@ function Hr(e, t) {
|
|
|
4559
4566
|
se,
|
|
4560
4567
|
Z,
|
|
4561
4568
|
E
|
|
4562
|
-
]), Se = Object.entries(
|
|
4563
|
-
let e =
|
|
4569
|
+
]), Se = Object.entries(Pr(E)).filter(([, e]) => e).map(([e]) => e).join(" "), Ce = f(() => {
|
|
4570
|
+
let e = Fr(g);
|
|
4564
4571
|
return Object.entries(e).filter(([, e]) => e).map(([e]) => e).join(" ");
|
|
4565
4572
|
}, [g]), we = f(() => ["pkt-datepicker__inputs", h && "pkt-input__range-inputs"].filter(Boolean).join(" "), [h, g]), Te = f(() => {
|
|
4566
4573
|
if (x) return x;
|
|
@@ -4574,9 +4581,10 @@ function Hr(e, t) {
|
|
|
4574
4581
|
let $ = o((e, t = !0) => {
|
|
4575
4582
|
U || G(e), t && V?.(e);
|
|
4576
4583
|
}, [U, V]), Ae = f(() => Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value")?.set, []), je = o((e) => {
|
|
4584
|
+
if (h && e.length === 1) return;
|
|
4577
4585
|
let t = Y.current;
|
|
4578
4586
|
!t || !Ae || (Ae.call(t, e.join(",")), t.dispatchEvent(new Event("input", { bubbles: !0 })));
|
|
4579
|
-
}, [Ae]), Me = o(() => {
|
|
4587
|
+
}, [Ae, h]), Me = o(() => {
|
|
4580
4588
|
oe || pe((e) => !e);
|
|
4581
4589
|
}, [oe]), Ne = o(() => {
|
|
4582
4590
|
pe(!1);
|
|
@@ -4596,7 +4604,7 @@ function Hr(e, t) {
|
|
|
4596
4604
|
let Pe = o(() => {
|
|
4597
4605
|
Q && !q && pe(!0);
|
|
4598
4606
|
}, [Q, q]), Fe = o((e) => {
|
|
4599
|
-
let t =
|
|
4607
|
+
let t = Hr(Ir(e, l, h));
|
|
4600
4608
|
$(t), je(t), !l && !h && (Ne(), me.current?.focus());
|
|
4601
4609
|
}, [
|
|
4602
4610
|
l,
|
|
@@ -4624,7 +4632,7 @@ function Hr(e, t) {
|
|
|
4624
4632
|
$,
|
|
4625
4633
|
je
|
|
4626
4634
|
]), Be = o(() => {
|
|
4627
|
-
K.length === 2 && !
|
|
4635
|
+
K.length === 2 && !Mr(K) && ($([K[0]]), je([K[0]]));
|
|
4628
4636
|
}, [
|
|
4629
4637
|
K,
|
|
4630
4638
|
$,
|
|
@@ -4660,13 +4668,13 @@ function Hr(e, t) {
|
|
|
4660
4668
|
let t = e?.closest("form");
|
|
4661
4669
|
t ? t.requestSubmit() : e?.blur();
|
|
4662
4670
|
}, []), Ke = o((e) => {
|
|
4663
|
-
|
|
4671
|
+
Rr(e.nativeEvent, () => Me(), () => Ge(me.current), void 0, () => me.current?.blur());
|
|
4664
4672
|
}, [Me, Ge]), qe = o((e) => {
|
|
4665
|
-
|
|
4673
|
+
Rr(e.nativeEvent, () => Me(), () => Ge(me.current), () => J.current?.focus(), () => me.current?.blur());
|
|
4666
4674
|
}, [Me, Ge]), Je = o((e) => {
|
|
4667
|
-
|
|
4675
|
+
Rr(e.nativeEvent, () => Me(), () => Ge(J.current), void 0, () => J.current?.blur());
|
|
4668
4676
|
}, [Me, Ge]), Ye = o((e) => {
|
|
4669
|
-
|
|
4677
|
+
Rr(e.nativeEvent, () => Me(), () => Ge(me.current), void 0, () => me.current?.blur(), Ue);
|
|
4670
4678
|
}, [
|
|
4671
4679
|
Me,
|
|
4672
4680
|
Ge,
|
|
@@ -4771,8 +4779,8 @@ function Hr(e, t) {
|
|
|
4771
4779
|
}
|
|
4772
4780
|
//#endregion
|
|
4773
4781
|
//#region src/components/datepicker/Datepicker.tsx
|
|
4774
|
-
var
|
|
4775
|
-
let n =
|
|
4782
|
+
var Wr = i((e, t) => {
|
|
4783
|
+
let n = Ur(e, t), r = [
|
|
4776
4784
|
"pkt-datepicker",
|
|
4777
4785
|
`pkt-datepicker--${n.inputSize}`,
|
|
4778
4786
|
n.fullwidth ? "pkt-datepicker--fullwidth" : "",
|
|
@@ -4782,7 +4790,7 @@ var Ur = i((e, t) => {
|
|
|
4782
4790
|
className: r,
|
|
4783
4791
|
id: n.id || void 0,
|
|
4784
4792
|
children: [
|
|
4785
|
-
/* @__PURE__ */ _(
|
|
4793
|
+
/* @__PURE__ */ _($n, {
|
|
4786
4794
|
strings: n.stringsOverride,
|
|
4787
4795
|
ref: n.wrapperRef,
|
|
4788
4796
|
ariaDescribedby: e.ariaDescribedby,
|
|
@@ -4806,9 +4814,9 @@ var Ur = i((e, t) => {
|
|
|
4806
4814
|
counter: n.hasCounter,
|
|
4807
4815
|
counterCurrent: n.values.length,
|
|
4808
4816
|
counterMaxLength: n.maxlength,
|
|
4809
|
-
children: /* @__PURE__ */ _(
|
|
4817
|
+
children: /* @__PURE__ */ _(Vr, { state: n })
|
|
4810
4818
|
}),
|
|
4811
|
-
/* @__PURE__ */ _(
|
|
4819
|
+
/* @__PURE__ */ _(zr, {
|
|
4812
4820
|
open: n.calendarOpen,
|
|
4813
4821
|
multiple: n.multiple,
|
|
4814
4822
|
range: n.range,
|
|
@@ -4839,10 +4847,10 @@ var Ur = i((e, t) => {
|
|
|
4839
4847
|
]
|
|
4840
4848
|
});
|
|
4841
4849
|
});
|
|
4842
|
-
|
|
4850
|
+
Wr.displayName = "PktDatepicker";
|
|
4843
4851
|
//#endregion
|
|
4844
4852
|
//#region ../../shared-utils/fileupload/size.ts
|
|
4845
|
-
function
|
|
4853
|
+
function Gr(e) {
|
|
4846
4854
|
if (e == null || e === "") return;
|
|
4847
4855
|
if (typeof e == "number") return Number.isFinite(e) && e > 0 ? e : void 0;
|
|
4848
4856
|
let t = String(e).trim(), n = Number(t);
|
|
@@ -4861,15 +4869,15 @@ function Wr(e) {
|
|
|
4861
4869
|
default: return;
|
|
4862
4870
|
}
|
|
4863
4871
|
}
|
|
4864
|
-
function
|
|
4872
|
+
function Kr(e) {
|
|
4865
4873
|
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`;
|
|
4866
4874
|
}
|
|
4867
4875
|
//#endregion
|
|
4868
4876
|
//#region ../../shared-utils/fileupload/formats.ts
|
|
4869
|
-
function
|
|
4877
|
+
function qr(e) {
|
|
4870
4878
|
return Array.isArray(e) ? e.map((e) => String(e).trim().toLowerCase()).filter(Boolean) : [];
|
|
4871
4879
|
}
|
|
4872
|
-
function
|
|
4880
|
+
function Jr(e, t, n) {
|
|
4873
4881
|
let r = e.toLowerCase().replace(/^\./, "");
|
|
4874
4882
|
if (r.includes("/")) {
|
|
4875
4883
|
if (r.endsWith("/*")) {
|
|
@@ -4880,33 +4888,33 @@ function qr(e, t, n) {
|
|
|
4880
4888
|
}
|
|
4881
4889
|
return t === r;
|
|
4882
4890
|
}
|
|
4883
|
-
function
|
|
4884
|
-
let n =
|
|
4891
|
+
function Yr(e, t) {
|
|
4892
|
+
let n = qr(t);
|
|
4885
4893
|
if (n.length === 0) return !0;
|
|
4886
4894
|
let r = e.name.split(".").pop()?.toLowerCase() ?? "", i = e.type.toLowerCase();
|
|
4887
|
-
return n.some((e) =>
|
|
4895
|
+
return n.some((e) => Jr(e, r, i));
|
|
4888
4896
|
}
|
|
4889
|
-
function
|
|
4897
|
+
function Xr(e, t) {
|
|
4890
4898
|
let n = (e ?? "").trim();
|
|
4891
4899
|
if (n) return n;
|
|
4892
|
-
let r =
|
|
4900
|
+
let r = qr(t);
|
|
4893
4901
|
return r.length === 0 ? "" : r.map((e) => e.includes("/") || e.startsWith(".") ? e : `.${e}`).join(", ");
|
|
4894
4902
|
}
|
|
4895
4903
|
//#endregion
|
|
4896
4904
|
//#region ../../shared-utils/fileupload/validation.ts
|
|
4897
|
-
function
|
|
4905
|
+
function Zr(e, t, n) {
|
|
4898
4906
|
return ((e ?? "").trim() || t).replace(/\{(\w+)\}/g, (e, t) => n[t] ?? `{${t}}`);
|
|
4899
4907
|
}
|
|
4900
|
-
function
|
|
4901
|
-
let n =
|
|
4902
|
-
if (n.length > 0 && !
|
|
4908
|
+
function Qr(e, t) {
|
|
4909
|
+
let n = qr(t.allowedFormats);
|
|
4910
|
+
if (n.length > 0 && !Yr(e, n)) {
|
|
4903
4911
|
let e = n.join(", "), r = ce.fileupload.invalidFormat;
|
|
4904
|
-
return
|
|
4912
|
+
return Zr(t.formatErrorMessage, r, { formats: e });
|
|
4905
4913
|
}
|
|
4906
|
-
let r =
|
|
4914
|
+
let r = Gr(t.maxFileSize);
|
|
4907
4915
|
if (r !== void 0 && e.size > r) {
|
|
4908
|
-
let e =
|
|
4909
|
-
return
|
|
4916
|
+
let e = Kr(r), n = ce.fileupload.sizeTooLarge;
|
|
4917
|
+
return Zr(t.sizeErrorMessage, n, { maxSize: e });
|
|
4910
4918
|
}
|
|
4911
4919
|
if (t.onFileValidation) {
|
|
4912
4920
|
let n = t.onFileValidation(e);
|
|
@@ -4914,7 +4922,7 @@ function Zr(e, t) {
|
|
|
4914
4922
|
}
|
|
4915
4923
|
return null;
|
|
4916
4924
|
}
|
|
4917
|
-
function
|
|
4925
|
+
function $r(e) {
|
|
4918
4926
|
let t = e.file;
|
|
4919
4927
|
if (t?.type?.startsWith("image/")) return !0;
|
|
4920
4928
|
let n = e.attributes?.targetFilename || t?.name || "";
|
|
@@ -4922,10 +4930,10 @@ function Qr(e) {
|
|
|
4922
4930
|
}
|
|
4923
4931
|
//#endregion
|
|
4924
4932
|
//#region ../../shared-utils/fileupload/transfers.ts
|
|
4925
|
-
function
|
|
4933
|
+
function ei(e) {
|
|
4926
4934
|
return typeof e == "number" ? "in-progress" : e === "error" ? "error" : "idle";
|
|
4927
4935
|
}
|
|
4928
|
-
function
|
|
4936
|
+
function ti(e, t, n) {
|
|
4929
4937
|
let r = {
|
|
4930
4938
|
"in-progress": 0,
|
|
4931
4939
|
error: 1,
|
|
@@ -4940,11 +4948,11 @@ function ei(e, t, n) {
|
|
|
4940
4948
|
showProgress: r?.showProgress,
|
|
4941
4949
|
lastProgress: r?.lastProgress
|
|
4942
4950
|
};
|
|
4943
|
-
}).sort((e, t) => r[
|
|
4951
|
+
}).sort((e, t) => r[ei(e.progress)] - r[ei(t.progress)]);
|
|
4944
4952
|
}
|
|
4945
4953
|
//#endregion
|
|
4946
4954
|
//#region ../../shared-utils/focus-trap/index.ts
|
|
4947
|
-
function
|
|
4955
|
+
function ni(e) {
|
|
4948
4956
|
if (!e) return [];
|
|
4949
4957
|
let t = [
|
|
4950
4958
|
"a[href]:not([tabindex=\"-1\"])",
|
|
@@ -4956,7 +4964,7 @@ function ti(e) {
|
|
|
4956
4964
|
].join(", ");
|
|
4957
4965
|
return Array.from(e.querySelectorAll(t)).filter((e) => !e.hasAttribute("inert"));
|
|
4958
4966
|
}
|
|
4959
|
-
var
|
|
4967
|
+
var ri = [
|
|
4960
4968
|
"a[href]",
|
|
4961
4969
|
"button:not([disabled])",
|
|
4962
4970
|
"input:not([disabled]):not([type=\"hidden\"])",
|
|
@@ -4964,7 +4972,7 @@ var ni = [
|
|
|
4964
4972
|
"textarea:not([disabled])",
|
|
4965
4973
|
"summary",
|
|
4966
4974
|
"[tabindex]:not([tabindex=\"-1\"])"
|
|
4967
|
-
].join(", "),
|
|
4975
|
+
].join(", "), ii = (e) => {
|
|
4968
4976
|
if (e.hasAttribute("inert") || e.closest("[inert]") || e.hidden || e.closest("[hidden]")) return !0;
|
|
4969
4977
|
let t = e;
|
|
4970
4978
|
for (; t;) {
|
|
@@ -4977,33 +4985,33 @@ var ni = [
|
|
|
4977
4985
|
t = n.parentElement;
|
|
4978
4986
|
}
|
|
4979
4987
|
return !1;
|
|
4980
|
-
},
|
|
4981
|
-
e.matches(
|
|
4988
|
+
}, ai = (e, t) => {
|
|
4989
|
+
e.matches(ri) && !ii(e) && t.push(e);
|
|
4982
4990
|
let n = e.shadowRoot;
|
|
4983
|
-
if (n) for (let e of Array.from(n.children))
|
|
4984
|
-
for (let n of Array.from(e.children))
|
|
4991
|
+
if (n) for (let e of Array.from(n.children)) ai(e, t);
|
|
4992
|
+
for (let n of Array.from(e.children)) ai(n, t);
|
|
4985
4993
|
};
|
|
4986
|
-
function
|
|
4994
|
+
function oi(e) {
|
|
4987
4995
|
if (!e) return [];
|
|
4988
4996
|
let t = [];
|
|
4989
|
-
for (let n of Array.from(e.children))
|
|
4997
|
+
for (let n of Array.from(e.children)) ai(n, t);
|
|
4990
4998
|
return t;
|
|
4991
4999
|
}
|
|
4992
|
-
function
|
|
5000
|
+
function si(e = document) {
|
|
4993
5001
|
let t = e.activeElement;
|
|
4994
5002
|
for (; t?.shadowRoot?.activeElement;) t = t.shadowRoot.activeElement;
|
|
4995
5003
|
return t;
|
|
4996
5004
|
}
|
|
4997
|
-
function
|
|
5005
|
+
function ci(e, t) {
|
|
4998
5006
|
if (e.key !== "Tab") return !1;
|
|
4999
|
-
let n =
|
|
5007
|
+
let n = ni(t);
|
|
5000
5008
|
if (n.length === 0) return e.preventDefault(), !0;
|
|
5001
5009
|
let r = n[0], i = n[n.length - 1], a = (t?.ownerDocument ?? document).activeElement, o = !!a && n.includes(a);
|
|
5002
5010
|
return e.shiftKey ? !o || a === r ? (e.preventDefault(), i.focus(), !0) : !1 : !o || a === i ? (e.preventDefault(), r.focus(), !0) : !1;
|
|
5003
5011
|
}
|
|
5004
5012
|
//#endregion
|
|
5005
5013
|
//#region ../../shared-utils/fileupload/truncate.ts
|
|
5006
|
-
function
|
|
5014
|
+
function li(e, t) {
|
|
5007
5015
|
return !t || t <= 0 || e.length <= t + 3 ? null : {
|
|
5008
5016
|
head: e.slice(0, e.length - t),
|
|
5009
5017
|
tail: e.slice(-t)
|
|
@@ -5011,12 +5019,12 @@ function ci(e, t) {
|
|
|
5011
5019
|
}
|
|
5012
5020
|
//#endregion
|
|
5013
5021
|
//#region ../../shared-utils/fileupload/navigation.ts
|
|
5014
|
-
function
|
|
5022
|
+
function ui(e, t, n) {
|
|
5015
5023
|
return n <= 0 ? 0 : t === "prev" ? e <= 0 ? n - 1 : e - 1 : e >= n - 1 ? 0 : e + 1;
|
|
5016
5024
|
}
|
|
5017
5025
|
//#endregion
|
|
5018
5026
|
//#region ../../shared-utils/fileupload/announcements.ts
|
|
5019
|
-
function
|
|
5027
|
+
function di(e, t) {
|
|
5020
5028
|
let n = e.length;
|
|
5021
5029
|
if (n === 0 || !t || t.length === 0) return {
|
|
5022
5030
|
totalCount: n,
|
|
@@ -5036,23 +5044,23 @@ function ui(e, t) {
|
|
|
5036
5044
|
}
|
|
5037
5045
|
//#endregion
|
|
5038
5046
|
//#region ../../shared-utils/fileupload/filename.ts
|
|
5039
|
-
var
|
|
5040
|
-
function
|
|
5047
|
+
var fi = ".jpeg, .jpg, .png, .gif, .webp, .heic";
|
|
5048
|
+
function pi(e, t = ce.fileupload.unknownFilename) {
|
|
5041
5049
|
return e.attributes?.targetFilename || e.file?.name || t;
|
|
5042
5050
|
}
|
|
5043
5051
|
//#endregion
|
|
5044
5052
|
//#region src/utils/stringutils.ts
|
|
5045
|
-
var
|
|
5046
|
-
let e =
|
|
5053
|
+
var mi = () => ("00000000000000000" + (Math.random() * 0x10000000000000000).toString(16)).slice(-16), hi = () => {
|
|
5054
|
+
let e = mi(), t = mi();
|
|
5047
5055
|
return e.slice(0, 8) + "-" + e.slice(8, 12) + "-4" + e.slice(13) + "-a" + t.slice(1, 4) + "-" + t.slice(4);
|
|
5048
|
-
},
|
|
5056
|
+
}, gi = class {
|
|
5049
5057
|
fileId;
|
|
5050
5058
|
file;
|
|
5051
5059
|
attributes;
|
|
5052
5060
|
constructor(e, t) {
|
|
5053
|
-
this.fileId = t ||
|
|
5061
|
+
this.fileId = t || hi(), this.file = e, this.attributes = { targetFilename: e.name };
|
|
5054
5062
|
}
|
|
5055
|
-
},
|
|
5063
|
+
}, _i = n({}), vi = 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) => {
|
|
5056
5064
|
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]);
|
|
5057
5065
|
u(x, () => S.current);
|
|
5058
5066
|
let [T, E] = m(!1), D = ge(["fileupload"], y), O = f(() => l ? t ? {
|
|
@@ -5077,14 +5085,14 @@ var pi = () => ("00000000000000000" + (Math.random() * 0x10000000000000000).toSt
|
|
|
5077
5085
|
D
|
|
5078
5086
|
]), k = o((e) => {
|
|
5079
5087
|
if (S.current) try {
|
|
5080
|
-
S.current.files =
|
|
5088
|
+
S.current.files = yi(e);
|
|
5081
5089
|
} catch {}
|
|
5082
5090
|
}, [S.current, n]);
|
|
5083
5091
|
c(() => {
|
|
5084
5092
|
k(n);
|
|
5085
5093
|
}, [S, n]);
|
|
5086
5094
|
let A = o((e) => {
|
|
5087
|
-
r(e.map((e) => new
|
|
5095
|
+
r(e.map((e) => new gi(e))), S.current && (S.current.value = "");
|
|
5088
5096
|
}, [r]), j = (e) => {
|
|
5089
5097
|
let t = e.target.files;
|
|
5090
5098
|
if (t.length === 0) {
|
|
@@ -5167,32 +5175,32 @@ var pi = () => ("00000000000000000" + (Math.random() * 0x10000000000000000).toSt
|
|
|
5167
5175
|
})
|
|
5168
5176
|
]
|
|
5169
5177
|
});
|
|
5170
|
-
}),
|
|
5178
|
+
}), yi = (e) => {
|
|
5171
5179
|
let t = new DataTransfer();
|
|
5172
5180
|
for (let n of e) t.items.add(n.file);
|
|
5173
5181
|
return t.files;
|
|
5174
5182
|
};
|
|
5175
5183
|
//#endregion
|
|
5176
5184
|
//#region src/hooks/useGeneratedId.ts
|
|
5177
|
-
function
|
|
5178
|
-
let t = f(() =>
|
|
5185
|
+
function bi(e) {
|
|
5186
|
+
let t = f(() => Yn(), []);
|
|
5179
5187
|
return e || t;
|
|
5180
5188
|
}
|
|
5181
5189
|
//#endregion
|
|
5182
5190
|
//#region src/components/textarea/Textarea.tsx
|
|
5183
|
-
var
|
|
5191
|
+
var xi = i(({ id: e, ariaDescribedby: t, ariaLabelledby: n, counter: r, hasFieldset: i, counterMaxLength: a, className: o, disabled: s, errorMessage: l, hasError: u = !1, helptext: d, helptextDropdown: f, helptextDropdownButton: p, inline: h, fullwidth: g = !1, label: v, name: y, optionalTag: b = !1, optionalText: x, requiredTag: S = !1, requiredText: C, tagText: w = null, placeholder: T, rows: E, useWrapper: D = !0, onChange: O, value: k, autoComplete: A = "off", minLength: j, maxLength: M, readOnly: N, skipForwardTestid: P = !1, inputSize: ee = "medium", strings: te, ...ne }, F) => {
|
|
5184
5192
|
let re = r ?? (a ?? 0) > 0, ie = [
|
|
5185
5193
|
o,
|
|
5186
5194
|
"pkt-textinput",
|
|
5187
5195
|
"pkt-textarea"
|
|
5188
|
-
].filter(Boolean).join(" "), ae =
|
|
5196
|
+
].filter(Boolean).join(" "), ae = bi(e), oe = `${ae}-input`, se = `${oe}-label`, I = n || se, [L, R] = m(0), ce = (e) => {
|
|
5189
5197
|
re && R(e.currentTarget?.value?.length || 0), O && O(e);
|
|
5190
5198
|
};
|
|
5191
5199
|
return c(() => {
|
|
5192
5200
|
k !== void 0 && R(k?.length || 0);
|
|
5193
5201
|
}, [k]), /* @__PURE__ */ _("div", {
|
|
5194
5202
|
className: ie,
|
|
5195
|
-
children: /* @__PURE__ */ _(
|
|
5203
|
+
children: /* @__PURE__ */ _($n, {
|
|
5196
5204
|
strings: te,
|
|
5197
5205
|
ariaDescribedby: t,
|
|
5198
5206
|
disabled: s,
|
|
@@ -5228,7 +5236,7 @@ var bi = i(({ id: e, ariaDescribedby: t, ariaLabelledby: n, counter: r, hasField
|
|
|
5228
5236
|
"aria-labelledby": I,
|
|
5229
5237
|
"aria-invalid": u,
|
|
5230
5238
|
"aria-errormessage": u ? `${ae}-error` : void 0,
|
|
5231
|
-
"aria-describedby":
|
|
5239
|
+
"aria-describedby": Gn({
|
|
5232
5240
|
id: oe,
|
|
5233
5241
|
hasHelptext: !!d,
|
|
5234
5242
|
hasCounter: re,
|
|
@@ -5246,19 +5254,19 @@ var bi = i(({ id: e, ariaDescribedby: t, ariaLabelledby: n, counter: r, hasField
|
|
|
5246
5254
|
})
|
|
5247
5255
|
});
|
|
5248
5256
|
});
|
|
5249
|
-
|
|
5257
|
+
xi.displayName = "PktTextarea";
|
|
5250
5258
|
//#endregion
|
|
5251
5259
|
//#region src/components/fileupload/extensions/Comments.tsx
|
|
5252
|
-
var
|
|
5260
|
+
var Si = "comments", Ci = (e) => {
|
|
5253
5261
|
let t = new Date(e);
|
|
5254
5262
|
return Number.isNaN(t.getTime()) ? e : `${String(t.getDate()).padStart(2, "0")}.${String(t.getMonth() + 1).padStart(2, "0")}.${t.getFullYear()} kl. ${String(t.getHours()).padStart(2, "0")}:${String(t.getMinutes()).padStart(2, "0")}`;
|
|
5255
|
-
},
|
|
5263
|
+
}, wi = ({ fileItem: e, disabled: t, closeOperationUi: n, onAddComment: r, existingComment: i }) => {
|
|
5256
5264
|
let a = p(null), o = !!i;
|
|
5257
5265
|
return d(() => {
|
|
5258
5266
|
let e = setTimeout(() => a.current?.focus({ preventScroll: !0 }), 0);
|
|
5259
5267
|
return () => clearTimeout(e);
|
|
5260
5268
|
}, [e.fileId]), /* @__PURE__ */ v(g, { children: [
|
|
5261
|
-
/* @__PURE__ */ _(
|
|
5269
|
+
/* @__PURE__ */ _(xi, {
|
|
5262
5270
|
autoFocus: !0,
|
|
5263
5271
|
label: o ? "Rediger kommentar" : "Legg til kommentar",
|
|
5264
5272
|
name: `comment-${e.fileId}`,
|
|
@@ -5291,7 +5299,7 @@ var xi = "comments", Si = (e) => {
|
|
|
5291
5299
|
children: "Avbryt"
|
|
5292
5300
|
})
|
|
5293
5301
|
] });
|
|
5294
|
-
},
|
|
5302
|
+
}, Ti = ({ comment: e, disabled: t, onDeleteComment: n, onEditComment: r }) => /* @__PURE__ */ _("div", {
|
|
5295
5303
|
className: "pkt-fileupload__queue-display__item__comments",
|
|
5296
5304
|
children: /* @__PURE__ */ v("div", {
|
|
5297
5305
|
className: "pkt-fileupload__queue-display__item__comment",
|
|
@@ -5303,7 +5311,7 @@ var xi = "comments", Si = (e) => {
|
|
|
5303
5311
|
children: e.text
|
|
5304
5312
|
}), /* @__PURE__ */ _("time", {
|
|
5305
5313
|
className: "pkt-fileupload__queue-display__item__comment__time",
|
|
5306
|
-
children:
|
|
5314
|
+
children: Ci(e.timestamp)
|
|
5307
5315
|
})]
|
|
5308
5316
|
}), /* @__PURE__ */ v("div", {
|
|
5309
5317
|
className: "pkt-fileupload__queue-display__item__comment__actions",
|
|
@@ -5324,46 +5332,46 @@ var xi = "comments", Si = (e) => {
|
|
|
5324
5332
|
})]
|
|
5325
5333
|
})]
|
|
5326
5334
|
})
|
|
5327
|
-
}),
|
|
5328
|
-
let t = s(
|
|
5335
|
+
}), Ei = ({ comments: e }) => {
|
|
5336
|
+
let t = s(_i);
|
|
5329
5337
|
return /* @__PURE__ */ _("input", {
|
|
5330
5338
|
type: "hidden",
|
|
5331
5339
|
name: `${t.name}-comments`,
|
|
5332
5340
|
value: e ? JSON.stringify(e) : ""
|
|
5333
5341
|
});
|
|
5334
|
-
},
|
|
5342
|
+
}, Di = (e) => e.getAttribute(Si) ?? [], Oi = {
|
|
5335
5343
|
id: "comment",
|
|
5336
|
-
title: (e) => (e.attributes?.[
|
|
5344
|
+
title: (e) => (e.attributes?.[Si] ?? []).length > 0 ? "" : "Legg til kommentar",
|
|
5337
5345
|
ariaLabel: "Legg til kommentar",
|
|
5338
5346
|
renderExtendedUI: (e) => {
|
|
5339
|
-
let t =
|
|
5340
|
-
return /* @__PURE__ */ _(
|
|
5347
|
+
let t = Di(e)[0];
|
|
5348
|
+
return /* @__PURE__ */ _(wi, {
|
|
5341
5349
|
fileItem: e.file,
|
|
5342
5350
|
disabled: e.disabled,
|
|
5343
5351
|
closeOperationUi: e.close,
|
|
5344
5352
|
onAddComment: (t) => {
|
|
5345
|
-
e.setAttribute(
|
|
5353
|
+
e.setAttribute(Si, [t]);
|
|
5346
5354
|
},
|
|
5347
5355
|
existingComment: t
|
|
5348
5356
|
});
|
|
5349
5357
|
},
|
|
5350
5358
|
renderContent: (e) => {
|
|
5351
5359
|
if (e.isActive) return null;
|
|
5352
|
-
let t =
|
|
5353
|
-
return t ? /* @__PURE__ */ _(
|
|
5360
|
+
let t = Di(e)[0];
|
|
5361
|
+
return t ? /* @__PURE__ */ _(Ti, {
|
|
5354
5362
|
comment: t,
|
|
5355
5363
|
disabled: e.disabled,
|
|
5356
5364
|
onEditComment: e.activate,
|
|
5357
|
-
onDeleteComment: () => e.setAttribute(
|
|
5365
|
+
onDeleteComment: () => e.setAttribute(Si, void 0)
|
|
5358
5366
|
}) : null;
|
|
5359
5367
|
},
|
|
5360
|
-
renderHidden: (e) => /* @__PURE__ */ _(
|
|
5361
|
-
},
|
|
5368
|
+
renderHidden: (e) => /* @__PURE__ */ _(Ei, { comments: e.getAttribute(Si) }, `comments${e.file.fileId}`)
|
|
5369
|
+
}, ki = (e) => ({
|
|
5362
5370
|
id: "remove",
|
|
5363
5371
|
title: "Slett",
|
|
5364
5372
|
ariaLabel: "Slett fil",
|
|
5365
5373
|
onClick: ({ file: t }) => e(t.fileId)
|
|
5366
|
-
}),
|
|
5374
|
+
}), Ai = ({ initialValue: e, disabled: t, onSave: n, onCancel: r }) => {
|
|
5367
5375
|
let i = p(null), a = l(), o = () => n(i.current?.value ?? "");
|
|
5368
5376
|
return /* @__PURE__ */ v(g, { children: [
|
|
5369
5377
|
/* @__PURE__ */ _("label", {
|
|
@@ -5398,19 +5406,19 @@ var xi = "comments", Si = (e) => {
|
|
|
5398
5406
|
children: "Avbryt"
|
|
5399
5407
|
})
|
|
5400
5408
|
] });
|
|
5401
|
-
},
|
|
5402
|
-
let t = s(
|
|
5409
|
+
}, ji = ({ targetFilename: e }) => {
|
|
5410
|
+
let t = s(_i);
|
|
5403
5411
|
return /* @__PURE__ */ _("input", {
|
|
5404
5412
|
type: "hidden",
|
|
5405
5413
|
name: `${t.name}-targetFilename`,
|
|
5406
5414
|
value: e
|
|
5407
5415
|
});
|
|
5408
|
-
},
|
|
5416
|
+
}, Mi = (e) => e.getAttribute("targetFilename") || pi(e.file, ""), Ni = {
|
|
5409
5417
|
id: "rename",
|
|
5410
5418
|
title: "Rediger",
|
|
5411
5419
|
ariaLabel: "Rediger filnavn",
|
|
5412
|
-
renderInlineUI: (e) => /* @__PURE__ */ _(
|
|
5413
|
-
initialValue:
|
|
5420
|
+
renderInlineUI: (e) => /* @__PURE__ */ _(Ai, {
|
|
5421
|
+
initialValue: Mi(e),
|
|
5414
5422
|
disabled: e.disabled,
|
|
5415
5423
|
onSave: (t) => {
|
|
5416
5424
|
let n = t.trim();
|
|
@@ -5418,8 +5426,8 @@ var xi = "comments", Si = (e) => {
|
|
|
5418
5426
|
},
|
|
5419
5427
|
onCancel: e.close
|
|
5420
5428
|
}),
|
|
5421
|
-
renderHidden: (e) => /* @__PURE__ */ _(
|
|
5422
|
-
},
|
|
5429
|
+
renderHidden: (e) => /* @__PURE__ */ _(ji, { targetFilename: Mi(e) }, `rename${e.file.fileId}`)
|
|
5430
|
+
}, Pi = (e, t) => {
|
|
5423
5431
|
let n = o((t, n) => e.find((e) => e.fileId === t)?.attributes?.[n], [e]), r = o((n, r, i) => {
|
|
5424
5432
|
let a = e.find((e) => e.fileId === n);
|
|
5425
5433
|
if (!a) return;
|
|
@@ -5439,7 +5447,7 @@ var xi = "comments", Si = (e) => {
|
|
|
5439
5447
|
setAttribute: (t, n) => r(e, t, n)
|
|
5440
5448
|
}), [n, r])
|
|
5441
5449
|
};
|
|
5442
|
-
},
|
|
5450
|
+
}, Fi = (e) => {
|
|
5443
5451
|
let [t, n] = m(!1), [r, i] = m(0), a = p(null);
|
|
5444
5452
|
return {
|
|
5445
5453
|
isOpen: t,
|
|
@@ -5453,10 +5461,10 @@ var xi = "comments", Si = (e) => {
|
|
|
5453
5461
|
n(!1), a.current?.close();
|
|
5454
5462
|
}, []),
|
|
5455
5463
|
navigate: o((t) => {
|
|
5456
|
-
e.length !== 0 && i((n) =>
|
|
5464
|
+
e.length !== 0 && i((n) => ui(n, t, e.length));
|
|
5457
5465
|
}, [e.length])
|
|
5458
5466
|
};
|
|
5459
|
-
},
|
|
5467
|
+
}, Ii = (e) => {
|
|
5460
5468
|
let [t, n] = m({});
|
|
5461
5469
|
return c(() => {
|
|
5462
5470
|
n((t) => {
|
|
@@ -5483,7 +5491,7 @@ var xi = "comments", Si = (e) => {
|
|
|
5483
5491
|
});
|
|
5484
5492
|
}, [])
|
|
5485
5493
|
};
|
|
5486
|
-
},
|
|
5494
|
+
}, Li = (e, { uploadStrategy: t, required: n, currentFileCount: r, onMissingFiles: i }) => {
|
|
5487
5495
|
c(() => {
|
|
5488
5496
|
if (t !== "custom" || !n) return;
|
|
5489
5497
|
let a = e.current?.form;
|
|
@@ -5501,8 +5509,8 @@ var xi = "comments", Si = (e) => {
|
|
|
5501
5509
|
r,
|
|
5502
5510
|
i
|
|
5503
5511
|
]);
|
|
5504
|
-
},
|
|
5505
|
-
let C = f(() =>
|
|
5512
|
+
}, Ri = 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) => {
|
|
5513
|
+
let C = f(() => Yn(), []), w = i || C, T = p(null), [E, D] = m(0);
|
|
5506
5514
|
c(() => {
|
|
5507
5515
|
T.current && D(T.current.getBoundingClientRect().width || 0);
|
|
5508
5516
|
}, [h]);
|
|
@@ -5553,41 +5561,41 @@ var xi = "comments", Si = (e) => {
|
|
|
5553
5561
|
})
|
|
5554
5562
|
});
|
|
5555
5563
|
});
|
|
5556
|
-
|
|
5564
|
+
Ri.displayName = "PktProgressbar";
|
|
5557
5565
|
//#endregion
|
|
5558
5566
|
//#region ../../shared-utils/scroll-lock/index.ts
|
|
5559
|
-
var
|
|
5567
|
+
var zi = "is-scroll-locked", Bi = 0, Vi = 0, Hi = () => typeof document < "u" && typeof window < "u", Ui = () => {
|
|
5560
5568
|
let e = document.body, t = document.documentElement;
|
|
5561
|
-
|
|
5569
|
+
Vi = window.scrollY || window.pageYOffset;
|
|
5562
5570
|
let n = window.innerWidth - t.clientWidth;
|
|
5563
|
-
n > 0 && (e.style.paddingRight = `${n}px`), e.style.position = "fixed", e.style.top = `-${
|
|
5564
|
-
}, Ui = () => {
|
|
5565
|
-
let e = document.body, t = document.documentElement;
|
|
5566
|
-
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(Ri), typeof window.scrollTo == "function" && window.scrollTo({ top: Bi });
|
|
5571
|
+
n > 0 && (e.style.paddingRight = `${n}px`), e.style.position = "fixed", e.style.top = `-${Vi}px`, e.style.left = "0", e.style.right = "0", e.style.width = "100%", e.style.overflow = "hidden", t.classList.add(zi);
|
|
5567
5572
|
}, Wi = () => {
|
|
5568
|
-
|
|
5573
|
+
let e = document.body, t = document.documentElement;
|
|
5574
|
+
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(zi), typeof window.scrollTo == "function" && window.scrollTo({ top: Vi });
|
|
5569
5575
|
}, Gi = () => {
|
|
5570
|
-
|
|
5571
|
-
}, Ki = () =>
|
|
5572
|
-
|
|
5573
|
-
},
|
|
5574
|
-
|
|
5576
|
+
Hi() && (Bi += 1, Bi === 1 && Ui());
|
|
5577
|
+
}, Ki = () => {
|
|
5578
|
+
!Hi() || Bi === 0 || (--Bi, Bi === 0 && Wi());
|
|
5579
|
+
}, qi = () => ({ locked: !1 }), Ji = (e, t) => {
|
|
5580
|
+
e.locked !== t && (e.locked = t, t ? Gi() : Ki());
|
|
5581
|
+
}, Yi = i(({ children: e, className: t, open: n = !1, headingText: r = "", hideCloseButton: i = !1, closeOnBackdropClick: a = !1, size: s = "medium", removePadding: l = !1, closeButtonSkin: u = "blue", variant: d = "dialog", drawerPosition: f = "right", transparentBackdrop: m = !1, onClose: h, ...g }, y) => {
|
|
5582
|
+
let b = p(null), x = p(qi()), S = o((e) => {
|
|
5575
5583
|
b.current = e, typeof y == "function" ? y(e) : y && (y.current = e);
|
|
5576
5584
|
}, [y]), C = o(() => {
|
|
5577
|
-
b.current?.open && (b.current.close(),
|
|
5585
|
+
b.current?.open && (b.current.close(), Ji(x.current, !1), h?.());
|
|
5578
5586
|
}, [h]);
|
|
5579
5587
|
c(() => {
|
|
5580
|
-
n ? (b.current?.open || b.current?.showModal(),
|
|
5588
|
+
n ? (b.current?.open || b.current?.showModal(), Ji(x.current, !0)) : (b.current?.open && b.current.close(), Ji(x.current, !1));
|
|
5581
5589
|
}, [n]), c(() => {
|
|
5582
5590
|
let e = x.current;
|
|
5583
5591
|
return () => {
|
|
5584
|
-
|
|
5592
|
+
Ji(e, !1);
|
|
5585
5593
|
};
|
|
5586
5594
|
}, []);
|
|
5587
5595
|
let w = o((e) => {
|
|
5588
5596
|
a && e.target === b.current && C();
|
|
5589
5597
|
}, [a, C]), T = o(() => {
|
|
5590
|
-
|
|
5598
|
+
Ji(x.current, !1), h?.();
|
|
5591
5599
|
}, [h]), E = u === "blue", D = (0, M.default)({
|
|
5592
5600
|
"pkt-modal": !0,
|
|
5593
5601
|
"pkt-modal--removePadding": l,
|
|
@@ -5641,11 +5649,11 @@ var Ri = "is-scroll-locked", zi = 0, Bi = 0, Vi = () => typeof document < "u" &&
|
|
|
5641
5649
|
})
|
|
5642
5650
|
});
|
|
5643
5651
|
});
|
|
5644
|
-
|
|
5652
|
+
Yi.displayName = "PktModal";
|
|
5645
5653
|
//#endregion
|
|
5646
5654
|
//#region src/components/fileupload/Truncate.tsx
|
|
5647
|
-
var
|
|
5648
|
-
let n = s(
|
|
5655
|
+
var Xi = n({ tail: 5 }), Zi = ({ children: e, tail: t }) => {
|
|
5656
|
+
let n = s(Xi), r = li(e, t === void 0 ? n.tail : t);
|
|
5649
5657
|
return r ? /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _("span", {
|
|
5650
5658
|
className: "pkt-fileupload__queue-display__item__title__head",
|
|
5651
5659
|
"data-pkt-truncate-part": "first",
|
|
@@ -5658,18 +5666,18 @@ var Yi = n({ tail: 5 }), Xi = ({ children: e, tail: t }) => {
|
|
|
5658
5666
|
"data-pkt-truncate-part": "first",
|
|
5659
5667
|
children: e
|
|
5660
5668
|
});
|
|
5661
|
-
},
|
|
5669
|
+
}, Qi = (e) => /* @__PURE__ */ _("button", {
|
|
5662
5670
|
type: "button",
|
|
5663
5671
|
onClick: e.onClick,
|
|
5664
5672
|
disabled: e.disabled,
|
|
5665
5673
|
className: "pkt-fileupload__queue-display__item__cancel-button",
|
|
5666
5674
|
"aria-label": e.ariaLabel || "Avbryt opplasting",
|
|
5667
5675
|
children: e.label || "Avbryt"
|
|
5668
|
-
}),
|
|
5676
|
+
}), $i = () => /* @__PURE__ */ _("span", {
|
|
5669
5677
|
className: "pkt-fileupload__queue-display__item__loading-text",
|
|
5670
5678
|
"aria-label": "Laster opp fil",
|
|
5671
5679
|
children: "Laster opp"
|
|
5672
|
-
}),
|
|
5680
|
+
}), ea = ({ cancelTransfer: e, transferItem: t, disabled: n = !1 }) => {
|
|
5673
5681
|
let r = t.showProgress ?? t.progress !== 0;
|
|
5674
5682
|
return /* @__PURE__ */ v(g, { children: [
|
|
5675
5683
|
/* @__PURE__ */ _(L, {
|
|
@@ -5680,21 +5688,21 @@ var Yi = n({ tail: 5 }), Xi = ({ children: e, tail: t }) => {
|
|
|
5680
5688
|
/* @__PURE__ */ v("p", {
|
|
5681
5689
|
className: "pkt-fileupload__queue-display__item__title",
|
|
5682
5690
|
"aria-label": "Filnavn",
|
|
5683
|
-
children: [/* @__PURE__ */ _(
|
|
5691
|
+
children: [/* @__PURE__ */ _(Zi, { children: pi(t) }), /* @__PURE__ */ v("span", {
|
|
5684
5692
|
className: "pkt-fileupload__queue-display__item__filesize",
|
|
5685
5693
|
children: [
|
|
5686
5694
|
" ",
|
|
5687
5695
|
"(",
|
|
5688
|
-
|
|
5696
|
+
Kr(t.file.size),
|
|
5689
5697
|
")"
|
|
5690
5698
|
]
|
|
5691
5699
|
})]
|
|
5692
5700
|
}),
|
|
5693
|
-
/* @__PURE__ */ _(
|
|
5701
|
+
/* @__PURE__ */ _(Qi, {
|
|
5694
5702
|
onClick: e,
|
|
5695
5703
|
disabled: n
|
|
5696
5704
|
}),
|
|
5697
|
-
r ? /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _(
|
|
5705
|
+
r ? /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _(Ri, {
|
|
5698
5706
|
valueCurrent: t.progress * 100,
|
|
5699
5707
|
statusType: "none",
|
|
5700
5708
|
valueMax: 100,
|
|
@@ -5704,20 +5712,20 @@ var Yi = n({ tail: 5 }), Xi = ({ children: e, tail: t }) => {
|
|
|
5704
5712
|
className: "pkt-fileupload__queue-display__item__percentage",
|
|
5705
5713
|
"aria-hidden": "true",
|
|
5706
5714
|
children: `${Math.round(t.progress * 100)}%`
|
|
5707
|
-
})] }) : /* @__PURE__ */ _(
|
|
5715
|
+
})] }) : /* @__PURE__ */ _($i, {})
|
|
5708
5716
|
] });
|
|
5709
|
-
},
|
|
5717
|
+
}, ta = ({ transferItem: e }) => /* @__PURE__ */ v("p", {
|
|
5710
5718
|
className: "pkt-fileupload__queue-display__item__title",
|
|
5711
|
-
children: [/* @__PURE__ */ _(
|
|
5719
|
+
children: [/* @__PURE__ */ _(Zi, { children: pi(e) }), e.file && /* @__PURE__ */ v("span", {
|
|
5712
5720
|
className: "pkt-fileupload__queue-display__item__filesize",
|
|
5713
5721
|
children: [
|
|
5714
5722
|
" ",
|
|
5715
5723
|
"(",
|
|
5716
|
-
|
|
5724
|
+
Kr(e.file.size),
|
|
5717
5725
|
")"
|
|
5718
5726
|
]
|
|
5719
5727
|
})]
|
|
5720
|
-
}),
|
|
5728
|
+
}), na = ({ transferItem: e, onRemove: t, disabled: n }) => {
|
|
5721
5729
|
let r = (e.lastProgress ?? 1) * 100;
|
|
5722
5730
|
return /* @__PURE__ */ v(g, { children: [
|
|
5723
5731
|
/* @__PURE__ */ _(L, {
|
|
@@ -5725,14 +5733,14 @@ var Yi = n({ tail: 5 }), Xi = ({ children: e, tail: t }) => {
|
|
|
5725
5733
|
name: "alert-error",
|
|
5726
5734
|
"aria-hidden": "true"
|
|
5727
5735
|
}),
|
|
5728
|
-
/* @__PURE__ */ _(
|
|
5729
|
-
/* @__PURE__ */ _(
|
|
5736
|
+
/* @__PURE__ */ _(ta, { transferItem: e }),
|
|
5737
|
+
/* @__PURE__ */ _(Qi, {
|
|
5730
5738
|
onClick: t,
|
|
5731
5739
|
label: "Fjern",
|
|
5732
5740
|
ariaLabel: "Fjern fil som feilet under opplasting",
|
|
5733
5741
|
disabled: n
|
|
5734
5742
|
}),
|
|
5735
|
-
/* @__PURE__ */ _(
|
|
5743
|
+
/* @__PURE__ */ _(Ri, {
|
|
5736
5744
|
valueCurrent: r,
|
|
5737
5745
|
statusType: "none",
|
|
5738
5746
|
valueMax: 100,
|
|
@@ -5744,14 +5752,14 @@ var Yi = n({ tail: 5 }), Xi = ({ children: e, tail: t }) => {
|
|
|
5744
5752
|
children: e.errorMessage
|
|
5745
5753
|
})
|
|
5746
5754
|
] });
|
|
5747
|
-
},
|
|
5755
|
+
}, ra = ({ transferItem: e, onRemove: t, disabled: n }) => /* @__PURE__ */ v(g, { children: [
|
|
5748
5756
|
/* @__PURE__ */ _(L, {
|
|
5749
5757
|
className: "pkt-fileupload__queue-display__item__icon pkt-icon--medium",
|
|
5750
5758
|
name: "alert-error",
|
|
5751
5759
|
"aria-hidden": "true"
|
|
5752
5760
|
}),
|
|
5753
|
-
/* @__PURE__ */ _(
|
|
5754
|
-
/* @__PURE__ */ _(
|
|
5761
|
+
/* @__PURE__ */ _(ta, { transferItem: e }),
|
|
5762
|
+
/* @__PURE__ */ _(Qi, {
|
|
5755
5763
|
onClick: t,
|
|
5756
5764
|
label: "Fjern",
|
|
5757
5765
|
ariaLabel: "Fjern fil som feilet under opplasting",
|
|
@@ -5761,15 +5769,15 @@ var Yi = n({ tail: 5 }), Xi = ({ children: e, tail: t }) => {
|
|
|
5761
5769
|
className: "pkt-fileupload__queue-display__item__error-message",
|
|
5762
5770
|
children: e.errorMessage
|
|
5763
5771
|
})
|
|
5764
|
-
] }),
|
|
5772
|
+
] }), ia = ({ transferItem: e, onRemove: t, disabled: n }) => e.showProgress ? /* @__PURE__ */ _(na, {
|
|
5765
5773
|
transferItem: e,
|
|
5766
5774
|
onRemove: t,
|
|
5767
5775
|
disabled: n
|
|
5768
|
-
}) : /* @__PURE__ */ _(
|
|
5776
|
+
}) : /* @__PURE__ */ _(ra, {
|
|
5769
5777
|
transferItem: e,
|
|
5770
5778
|
onRemove: t,
|
|
5771
5779
|
disabled: n
|
|
5772
|
-
}),
|
|
5780
|
+
}), aa = ({ operation: e, context: t }) => {
|
|
5773
5781
|
let n = typeof e.title == "function" ? e.title(t.file) : e.title;
|
|
5774
5782
|
return n ? /* @__PURE__ */ _("button", {
|
|
5775
5783
|
type: "button",
|
|
@@ -5781,11 +5789,11 @@ var Yi = n({ tail: 5 }), Xi = ({ children: e, tail: t }) => {
|
|
|
5781
5789
|
"aria-label": typeof e.ariaLabel == "function" ? e.ariaLabel(t.file) : e.ariaLabel,
|
|
5782
5790
|
children: n
|
|
5783
5791
|
}) : null;
|
|
5784
|
-
},
|
|
5792
|
+
}, oa = ({ transferItem: e }) => /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _(L, {
|
|
5785
5793
|
name: "document-text",
|
|
5786
5794
|
className: "pkt-fileupload__queue-display__item__icon pkt-icon--medium",
|
|
5787
5795
|
"aria-hidden": "true"
|
|
5788
|
-
}), /* @__PURE__ */ _(
|
|
5796
|
+
}), /* @__PURE__ */ _(ta, { transferItem: e })] }), sa = ({ transferItem: e, onPreviewClick: t }) => {
|
|
5789
5797
|
let [n, r] = m(null), [i, a] = m(!1), o = e.file;
|
|
5790
5798
|
c(() => {
|
|
5791
5799
|
if (a(!1), o.type.startsWith("image/")) {
|
|
@@ -5819,10 +5827,10 @@ var Yi = n({ tail: 5 }), Xi = ({ children: e, tail: t }) => {
|
|
|
5819
5827
|
}), s]
|
|
5820
5828
|
}), /* @__PURE__ */ _("span", {
|
|
5821
5829
|
className: "pkt-fileupload__queue-display__item__thumbnail__title",
|
|
5822
|
-
children: /* @__PURE__ */ _(
|
|
5830
|
+
children: /* @__PURE__ */ _(Zi, { children: e.attributes.targetFilename })
|
|
5823
5831
|
})]
|
|
5824
5832
|
});
|
|
5825
|
-
},
|
|
5833
|
+
}, ca = ({ isOpen: e, images: t, currentIndex: n, onClose: r, onNavigate: i, modalRef: a }) => {
|
|
5826
5834
|
let [o, s] = m(null), [l, u] = m(!1), d = t[n], f = t.length > 1;
|
|
5827
5835
|
return c(() => {
|
|
5828
5836
|
if (u(!1), d && d.file.type.startsWith("image/")) {
|
|
@@ -5834,7 +5842,7 @@ var Yi = n({ tail: 5 }), Xi = ({ children: e, tail: t }) => {
|
|
|
5834
5842
|
if (!e) return;
|
|
5835
5843
|
let t = (e) => {
|
|
5836
5844
|
if (e.key === "Tab") {
|
|
5837
|
-
|
|
5845
|
+
ci(e, a.current);
|
|
5838
5846
|
return;
|
|
5839
5847
|
}
|
|
5840
5848
|
switch (e.key) {
|
|
@@ -5853,7 +5861,7 @@ var Yi = n({ tail: 5 }), Xi = ({ children: e, tail: t }) => {
|
|
|
5853
5861
|
i,
|
|
5854
5862
|
r,
|
|
5855
5863
|
a
|
|
5856
|
-
]), d ? /* @__PURE__ */ _(
|
|
5864
|
+
]), d ? /* @__PURE__ */ _(Yi, {
|
|
5857
5865
|
ref: a,
|
|
5858
5866
|
headingText: d.attributes.targetFilename,
|
|
5859
5867
|
closeOnBackdropClick: !0,
|
|
@@ -5903,7 +5911,7 @@ var Yi = n({ tail: 5 }), Xi = ({ children: e, tail: t }) => {
|
|
|
5903
5911
|
]
|
|
5904
5912
|
})
|
|
5905
5913
|
}) : null;
|
|
5906
|
-
},
|
|
5914
|
+
}, la = ({ operation: e, transferItem: t, inputName: n, disabled: r, activatedOperation: i, onActivate: a, onClose: o, buildAttributeAccessors: s }) => {
|
|
5907
5915
|
let c = s(t.fileId);
|
|
5908
5916
|
return {
|
|
5909
5917
|
file: t,
|
|
@@ -5915,29 +5923,29 @@ var Yi = n({ tail: 5 }), Xi = ({ children: e, tail: t }) => {
|
|
|
5915
5923
|
getAttribute: c.getAttribute,
|
|
5916
5924
|
setAttribute: c.setAttribute
|
|
5917
5925
|
};
|
|
5918
|
-
},
|
|
5926
|
+
}, ua = (e, t) => e.map((e) => ({
|
|
5919
5927
|
operation: e,
|
|
5920
|
-
context:
|
|
5928
|
+
context: la({
|
|
5921
5929
|
operation: e,
|
|
5922
5930
|
...t
|
|
5923
5931
|
})
|
|
5924
|
-
})),
|
|
5925
|
-
let t =
|
|
5932
|
+
})), da = (e) => {
|
|
5933
|
+
let t = ua(e.operations, e);
|
|
5926
5934
|
return /* @__PURE__ */ _("div", {
|
|
5927
5935
|
className: "pkt-fileupload__queue-display__item__actions",
|
|
5928
|
-
children: t.filter(({ operation: t }) => t.id !== e.activatedOperation?.id).map(({ operation: e, context: t }) => /* @__PURE__ */ _(
|
|
5936
|
+
children: t.filter(({ operation: t }) => t.id !== e.activatedOperation?.id).map(({ operation: e, context: t }) => /* @__PURE__ */ _(aa, {
|
|
5929
5937
|
operation: e,
|
|
5930
5938
|
context: t
|
|
5931
5939
|
}, e.id))
|
|
5932
5940
|
});
|
|
5933
|
-
},
|
|
5934
|
-
let t =
|
|
5941
|
+
}, fa = (e) => {
|
|
5942
|
+
let t = ua(e.operations, e);
|
|
5935
5943
|
return /* @__PURE__ */ _(g, { children: t.filter(({ operation: e }) => e.renderContent).map(({ operation: e, context: t }) => /* @__PURE__ */ _("div", {
|
|
5936
5944
|
className: "pkt-fileupload__queue-display__item__operation-content",
|
|
5937
5945
|
children: e.renderContent(t)
|
|
5938
5946
|
}, e.id)) });
|
|
5939
|
-
},
|
|
5940
|
-
let { transferItem: t, activatedOperation: n, operations: r, ItemRenderer: i, onPreviewClick: a } = e, o = n ?
|
|
5947
|
+
}, pa = (e) => {
|
|
5948
|
+
let { transferItem: t, activatedOperation: n, operations: r, ItemRenderer: i, onPreviewClick: a } = e, o = n ? la({
|
|
5941
5949
|
operation: n,
|
|
5942
5950
|
...e
|
|
5943
5951
|
}) : void 0, s = n?.renderInlineUI || n?.renderExtendedUI ? [] : r;
|
|
@@ -5953,43 +5961,43 @@ var Yi = n({ tail: 5 }), Xi = ({ children: e, tail: t }) => {
|
|
|
5953
5961
|
queueItemOperations: r,
|
|
5954
5962
|
onPreviewClick: a
|
|
5955
5963
|
}),
|
|
5956
|
-
s.length > 0 && /* @__PURE__ */ _(
|
|
5964
|
+
s.length > 0 && /* @__PURE__ */ _(da, {
|
|
5957
5965
|
...e,
|
|
5958
5966
|
operations: s
|
|
5959
5967
|
}),
|
|
5960
|
-
/* @__PURE__ */ _(
|
|
5968
|
+
/* @__PURE__ */ _(fa, { ...e }),
|
|
5961
5969
|
n?.renderExtendedUI && o && /* @__PURE__ */ _("div", {
|
|
5962
5970
|
className: "pkt-fileupload__queue-display__item__expanded-operation-ui",
|
|
5963
5971
|
children: n.renderExtendedUI(o)
|
|
5964
5972
|
})
|
|
5965
5973
|
] });
|
|
5966
|
-
},
|
|
5967
|
-
let { transferItem: t, enableImagePreview: n, onCancelTransfer: r, onOpenPreview: i, disabled: a } = e, o =
|
|
5974
|
+
}, ma = (e) => {
|
|
5975
|
+
let { transferItem: t, enableImagePreview: n, onCancelTransfer: r, onOpenPreview: i, disabled: a } = e, o = ei(t.progress), s = n && t.progress === "done" && $r(t);
|
|
5968
5976
|
switch (o) {
|
|
5969
|
-
case "in-progress": return /* @__PURE__ */ _(
|
|
5977
|
+
case "in-progress": return /* @__PURE__ */ _(ea, {
|
|
5970
5978
|
transferItem: t,
|
|
5971
5979
|
cancelTransfer: () => r(t.fileId),
|
|
5972
5980
|
disabled: a
|
|
5973
5981
|
});
|
|
5974
|
-
case "error": return /* @__PURE__ */ _(
|
|
5982
|
+
case "error": return /* @__PURE__ */ _(ia, {
|
|
5975
5983
|
transferItem: t,
|
|
5976
5984
|
onRemove: () => r(t.fileId),
|
|
5977
5985
|
disabled: a
|
|
5978
5986
|
});
|
|
5979
|
-
case "idle": return /* @__PURE__ */ _(
|
|
5987
|
+
case "idle": return /* @__PURE__ */ _(pa, {
|
|
5980
5988
|
...e,
|
|
5981
5989
|
onPreviewClick: s ? () => i(t.fileId) : void 0
|
|
5982
5990
|
});
|
|
5983
5991
|
}
|
|
5984
|
-
},
|
|
5992
|
+
}, ha = (e, t, n) => f(() => ti(e, t, n), [
|
|
5985
5993
|
e,
|
|
5986
5994
|
t,
|
|
5987
5995
|
n
|
|
5988
|
-
]),
|
|
5989
|
-
let d =
|
|
5996
|
+
]), ga = (e, t) => f(() => t ? e.filter((e) => e.progress === "done" && $r(e)) : [], [e, t]), _a = ({ 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 }) => {
|
|
5997
|
+
let d = ha(e, n, s), f = ga(d, o), p = Ii(r), m = Fi(f);
|
|
5990
5998
|
return /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _("ul", {
|
|
5991
5999
|
className: "pkt-fileupload__queue-display",
|
|
5992
|
-
children: /* @__PURE__ */ _(
|
|
6000
|
+
children: /* @__PURE__ */ _(Xi.Provider, {
|
|
5993
6001
|
value: { tail: a },
|
|
5994
6002
|
children: d.map((e) => {
|
|
5995
6003
|
let n = {
|
|
@@ -6007,10 +6015,10 @@ var Yi = n({ tail: 5 }), Xi = ({ children: e, tail: t }) => {
|
|
|
6007
6015
|
"pkt-fileupload__queue-display__item--in-progress": typeof e.progress == "number",
|
|
6008
6016
|
[`pkt-fileupload__queue-display__item--${e.progress}`]: typeof e.progress == "string"
|
|
6009
6017
|
}),
|
|
6010
|
-
children: [r.filter((e) => e.renderHidden).map((t) => /* @__PURE__ */ _("span", { children: t.renderHidden(
|
|
6018
|
+
children: [r.filter((e) => e.renderHidden).map((t) => /* @__PURE__ */ _("span", { children: t.renderHidden(la({
|
|
6011
6019
|
operation: t,
|
|
6012
6020
|
...n
|
|
6013
|
-
})) }, `${t.id}-${e.fileId}`)), /* @__PURE__ */ _(
|
|
6021
|
+
})) }, `${t.id}-${e.fileId}`)), /* @__PURE__ */ _(ma, {
|
|
6014
6022
|
...n,
|
|
6015
6023
|
ItemRenderer: i,
|
|
6016
6024
|
enableImagePreview: o,
|
|
@@ -6020,7 +6028,7 @@ var Yi = n({ tail: 5 }), Xi = ({ children: e, tail: t }) => {
|
|
|
6020
6028
|
}, e.fileId);
|
|
6021
6029
|
})
|
|
6022
6030
|
})
|
|
6023
|
-
}), o && f.length > 0 && /* @__PURE__ */ _(
|
|
6031
|
+
}), o && f.length > 0 && /* @__PURE__ */ _(ca, {
|
|
6024
6032
|
modalRef: m.modalRef,
|
|
6025
6033
|
isOpen: m.isOpen,
|
|
6026
6034
|
images: f,
|
|
@@ -6028,10 +6036,10 @@ var Yi = n({ tail: 5 }), Xi = ({ children: e, tail: t }) => {
|
|
|
6028
6036
|
onClose: m.close,
|
|
6029
6037
|
onNavigate: m.navigate
|
|
6030
6038
|
})] });
|
|
6031
|
-
},
|
|
6032
|
-
filename:
|
|
6033
|
-
thumbnail:
|
|
6034
|
-
},
|
|
6039
|
+
}, va = {
|
|
6040
|
+
filename: oa,
|
|
6041
|
+
thumbnail: sa
|
|
6042
|
+
}, ya = 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 = va.filename, fullwidth: x = !1, allowedFormats: S, formatErrorMessage: C, maxFileSize: w, sizeErrorMessage: T, onFileValidation: E, onFileValidate: D, errorMessage: O, hasError: k = !1, disabled: A = !1, label: j, helptext: N, helptextDropdown: P, helptextDropdownButton: ee, optionalTag: te, optionalText: ne, requiredTag: F, requiredText: re, tagText: ie, required: ae = !1, enableImagePreview: oe = !1, "aria-describedby": se, "aria-invalid": I, strings: L, ...R }, ce) => {
|
|
6035
6043
|
let z = l(), H = n ?? `pkt-fileupload-${z}`, le = p(null);
|
|
6036
6044
|
u(ce, () => le.current, []);
|
|
6037
6045
|
let ue = "transfers" in R ? R.transfers : void 0, U = ge(["fileupload"], L).fileupload, [de, W] = m(null), [G, K] = m("");
|
|
@@ -6045,7 +6053,7 @@ var Yi = n({ tail: 5 }), Xi = ({ children: e, tail: t }) => {
|
|
|
6045
6053
|
N ? `${H}-helptext` : void 0,
|
|
6046
6054
|
pe
|
|
6047
6055
|
].filter(Boolean).join(" ") || void 0, J = q || I === !0 || I === "true", Y = o((e) => {
|
|
6048
|
-
let t =
|
|
6056
|
+
let t = Qr(e, {
|
|
6049
6057
|
allowedFormats: S,
|
|
6050
6058
|
maxFileSize: w,
|
|
6051
6059
|
formatErrorMessage: C,
|
|
@@ -6071,13 +6079,13 @@ var Yi = n({ tail: 5 }), Xi = ({ children: e, tail: t }) => {
|
|
|
6071
6079
|
]);
|
|
6072
6080
|
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");
|
|
6073
6081
|
let he = e !== void 0, [X, Z] = m(() => t ?? []), Q = he ? e : X;
|
|
6074
|
-
|
|
6082
|
+
Li(le, {
|
|
6075
6083
|
uploadStrategy: i,
|
|
6076
6084
|
required: ae,
|
|
6077
6085
|
currentFileCount: Q.length,
|
|
6078
6086
|
onMissingFiles: o(() => W(U.requiredMissing), [U])
|
|
6079
6087
|
});
|
|
6080
|
-
let ve = typeof b == "string" ?
|
|
6088
|
+
let ve = typeof b == "string" ? va[b] : b, ye = b === "thumbnail", be = typeof R.accept == "string" ? R.accept.trim() : void 0, xe = f(() => Xr(be, S) || void 0, [be, S]), Se = s && !ye, Ce = a && !ye, we = o((e) => {
|
|
6081
6089
|
for (let t of e) {
|
|
6082
6090
|
let e = Y(t.file);
|
|
6083
6091
|
if (e) {
|
|
@@ -6117,15 +6125,15 @@ var Yi = n({ tail: 5 }), Xi = ({ children: e, tail: t }) => {
|
|
|
6117
6125
|
Q,
|
|
6118
6126
|
R,
|
|
6119
6127
|
he
|
|
6120
|
-
]), { buildAttributeAccessors: De } =
|
|
6128
|
+
]), { buildAttributeAccessors: De } = Pi(Q, Te), Oe = f(() => {
|
|
6121
6129
|
let e = [];
|
|
6122
|
-
return Se && e.push(
|
|
6130
|
+
return Se && e.push(Ni), Ce && e.push(Oi), e.push(...y), e.push(ki(Ee)), e;
|
|
6123
6131
|
}, [
|
|
6124
6132
|
Se,
|
|
6125
6133
|
Ce,
|
|
6126
6134
|
y,
|
|
6127
6135
|
Ee
|
|
6128
|
-
]), { totalCount: ke, uploadedCount: $, failedCount: Ae } = f(() =>
|
|
6136
|
+
]), { totalCount: ke, uploadedCount: $, failedCount: Ae } = f(() => di(Q, ue), [Q, ue]), je = V(ke, U.fileLabelOne, U.fileLabelOther), Me = /* @__PURE__ */ _("div", {
|
|
6129
6137
|
className: (0, M.default)("pkt-fileupload", {
|
|
6130
6138
|
"pkt-fileupload--full-width": x,
|
|
6131
6139
|
"pkt-fileupload--error": q,
|
|
@@ -6133,7 +6141,7 @@ var Yi = n({ tail: 5 }), Xi = ({ children: e, tail: t }) => {
|
|
|
6133
6141
|
}),
|
|
6134
6142
|
"aria-disabled": A,
|
|
6135
6143
|
...A ? { inert: !0 } : {},
|
|
6136
|
-
children: /* @__PURE__ */ v(
|
|
6144
|
+
children: /* @__PURE__ */ v(_i.Provider, {
|
|
6137
6145
|
value: {
|
|
6138
6146
|
name: R.name || "",
|
|
6139
6147
|
multiple: !!r,
|
|
@@ -6160,7 +6168,7 @@ var Yi = n({ tail: 5 }), Xi = ({ children: e, tail: t }) => {
|
|
|
6160
6168
|
label: je
|
|
6161
6169
|
})
|
|
6162
6170
|
}),
|
|
6163
|
-
/* @__PURE__ */ _(
|
|
6171
|
+
/* @__PURE__ */ _(vi, {
|
|
6164
6172
|
id: H,
|
|
6165
6173
|
name: R.name || "",
|
|
6166
6174
|
value: Q,
|
|
@@ -6168,7 +6176,7 @@ var Yi = n({ tail: 5 }), Xi = ({ children: e, tail: t }) => {
|
|
|
6168
6176
|
multiple: r,
|
|
6169
6177
|
uploadStrategy: i,
|
|
6170
6178
|
ref: le,
|
|
6171
|
-
accept: ye ?
|
|
6179
|
+
accept: ye ? fi : xe,
|
|
6172
6180
|
isThumbnailView: ye,
|
|
6173
6181
|
disabled: A,
|
|
6174
6182
|
required: ae && i === "form",
|
|
@@ -6187,7 +6195,7 @@ var Yi = n({ tail: 5 }), Xi = ({ children: e, tail: t }) => {
|
|
|
6187
6195
|
className: "pkt-fileupload__error-alert",
|
|
6188
6196
|
children: fe
|
|
6189
6197
|
}),
|
|
6190
|
-
Q.length > 0 && /* @__PURE__ */ _(
|
|
6198
|
+
Q.length > 0 && /* @__PURE__ */ _(_a, {
|
|
6191
6199
|
files: Q,
|
|
6192
6200
|
cancelTransfer: Ee,
|
|
6193
6201
|
truncateTail: d,
|
|
@@ -6205,7 +6213,7 @@ var Yi = n({ tail: 5 }), Xi = ({ children: e, tail: t }) => {
|
|
|
6205
6213
|
});
|
|
6206
6214
|
return j ? /* @__PURE__ */ _("div", {
|
|
6207
6215
|
className: "pkt-fileupload-component",
|
|
6208
|
-
children: /* @__PURE__ */ _(
|
|
6216
|
+
children: /* @__PURE__ */ _($n, {
|
|
6209
6217
|
strings: L,
|
|
6210
6218
|
forId: H,
|
|
6211
6219
|
label: j,
|
|
@@ -6227,10 +6235,10 @@ var Yi = n({ tail: 5 }), Xi = ({ children: e, tail: t }) => {
|
|
|
6227
6235
|
children: Me
|
|
6228
6236
|
});
|
|
6229
6237
|
});
|
|
6230
|
-
|
|
6238
|
+
ya.displayName = "PktFileUpload";
|
|
6231
6239
|
//#endregion
|
|
6232
6240
|
//#region ../../shared-types/header-footer.ts
|
|
6233
|
-
var
|
|
6241
|
+
var ba = "https://cdn.web.oslo.kommune.no/header-footer/header-footer.json", xa = "https://www.oslo.kommune.no", Sa = {
|
|
6234
6242
|
automat: "parking-meter",
|
|
6235
6243
|
bike: "bicycle",
|
|
6236
6244
|
corona: "virus",
|
|
@@ -6255,10 +6263,10 @@ var ya = "https://cdn.web.oslo.kommune.no/header-footer/header-footer.json", ba
|
|
|
6255
6263
|
treatment: "processing",
|
|
6256
6264
|
"warning-triangle": "alert-warning"
|
|
6257
6265
|
};
|
|
6258
|
-
function
|
|
6259
|
-
return e && (
|
|
6266
|
+
function Ca(e) {
|
|
6267
|
+
return e && (Sa[e] ?? e);
|
|
6260
6268
|
}
|
|
6261
|
-
var
|
|
6269
|
+
var wa = {
|
|
6262
6270
|
"facebook.com": "facebook",
|
|
6263
6271
|
"fb.com": "facebook",
|
|
6264
6272
|
"instagram.com": "instagram",
|
|
@@ -6266,36 +6274,36 @@ var Ca = {
|
|
|
6266
6274
|
"x.com": "x",
|
|
6267
6275
|
"github.com": "github"
|
|
6268
6276
|
};
|
|
6269
|
-
function
|
|
6277
|
+
function Ta(e) {
|
|
6270
6278
|
return e.toLowerCase().replace(/^(?:www|m)\./, "");
|
|
6271
6279
|
}
|
|
6272
|
-
function
|
|
6280
|
+
function Ea(e, t) {
|
|
6273
6281
|
if (e) try {
|
|
6274
|
-
let t =
|
|
6282
|
+
let t = wa[Ta(new URL(e).hostname)];
|
|
6275
6283
|
if (t) return t;
|
|
6276
6284
|
} catch {}
|
|
6277
6285
|
if (t) {
|
|
6278
6286
|
let e = t.trim().toLowerCase().replace(/\s+/g, "-");
|
|
6279
6287
|
if (e) {
|
|
6280
|
-
let t =
|
|
6288
|
+
let t = Ca(e);
|
|
6281
6289
|
if (t) return t;
|
|
6282
6290
|
}
|
|
6283
6291
|
}
|
|
6284
6292
|
}
|
|
6285
6293
|
//#endregion
|
|
6286
6294
|
//#region ../../shared-utils/header-footer/select-megamenu.ts
|
|
6287
|
-
var
|
|
6288
|
-
function
|
|
6289
|
-
if (e) return e[t] ?? e[
|
|
6295
|
+
var Da = "nb-NO";
|
|
6296
|
+
function Oa(e, t = Da) {
|
|
6297
|
+
if (e) return e[t] ?? e[Da];
|
|
6290
6298
|
}
|
|
6291
6299
|
//#endregion
|
|
6292
6300
|
//#region ../../shared-utils/header-footer/external-domain.ts
|
|
6293
|
-
var
|
|
6294
|
-
function
|
|
6301
|
+
var ka = "oslo.kommune.no", Aa = /\.(?:co|com|org|net|gov|edu|ac|kommune)\.[a-z]{2}$/i;
|
|
6302
|
+
function ja(e) {
|
|
6295
6303
|
let t = e.toLowerCase().replace(/\.$/, ""), n = t.split(".");
|
|
6296
|
-
return n.length <= 2 ? t : n.slice(
|
|
6304
|
+
return n.length <= 2 ? t : n.slice(Aa.test(t) ? -3 : -2).join(".");
|
|
6297
6305
|
}
|
|
6298
|
-
function
|
|
6306
|
+
function Ma(e) {
|
|
6299
6307
|
if (!e) return;
|
|
6300
6308
|
let t;
|
|
6301
6309
|
try {
|
|
@@ -6303,9 +6311,9 @@ function ja(e) {
|
|
|
6303
6311
|
} catch {
|
|
6304
6312
|
return;
|
|
6305
6313
|
}
|
|
6306
|
-
if (t.protocol === "http:" || t.protocol === "https:") return
|
|
6314
|
+
if (t.protocol === "http:" || t.protocol === "https:") return ja(t.hostname.toLowerCase().replace(/\.$/, ""));
|
|
6307
6315
|
}
|
|
6308
|
-
function
|
|
6316
|
+
function Na(e, t = ka) {
|
|
6309
6317
|
if (!e) return;
|
|
6310
6318
|
let n;
|
|
6311
6319
|
try {
|
|
@@ -6315,21 +6323,21 @@ function Ma(e, t = Oa) {
|
|
|
6315
6323
|
}
|
|
6316
6324
|
if (n.protocol !== "http:" && n.protocol !== "https:") return;
|
|
6317
6325
|
let r = n.hostname.toLowerCase().replace(/\.$/, ""), i = t.toLowerCase();
|
|
6318
|
-
if (!(r === i || r.endsWith(`.${i}`))) return
|
|
6326
|
+
if (!(r === i || r.endsWith(`.${i}`))) return ja(r);
|
|
6319
6327
|
}
|
|
6320
6328
|
//#endregion
|
|
6321
6329
|
//#region ../../shared-utils/header-footer/fetch-header-footer-data.ts
|
|
6322
|
-
var
|
|
6323
|
-
async function
|
|
6330
|
+
var Pa = /* @__PURE__ */ new Map();
|
|
6331
|
+
async function Fa(e) {
|
|
6324
6332
|
let t = await fetch(e);
|
|
6325
6333
|
if (!t.ok) throw Error(`pkt-header-menu: failed to fetch ${e} (HTTP ${t.status})`);
|
|
6326
6334
|
let n = await t.json();
|
|
6327
6335
|
if (!n || typeof n != "object") throw Error(`pkt-header-menu: ${e} returned a non-object payload`);
|
|
6328
6336
|
return n;
|
|
6329
6337
|
}
|
|
6330
|
-
function
|
|
6331
|
-
return t ? t.aborted ? Promise.reject(
|
|
6332
|
-
let i = () => r(
|
|
6338
|
+
function Ia(e, t) {
|
|
6339
|
+
return t ? t.aborted ? Promise.reject(La(t.reason)) : new Promise((n, r) => {
|
|
6340
|
+
let i = () => r(La(t.reason));
|
|
6333
6341
|
t.addEventListener("abort", i, { once: !0 }), e.then((e) => {
|
|
6334
6342
|
t.removeEventListener("abort", i), n(e);
|
|
6335
6343
|
}, (e) => {
|
|
@@ -6337,22 +6345,22 @@ function Fa(e, t) {
|
|
|
6337
6345
|
});
|
|
6338
6346
|
}) : e;
|
|
6339
6347
|
}
|
|
6340
|
-
function
|
|
6348
|
+
function La(e) {
|
|
6341
6349
|
return e instanceof Error ? e : new DOMException("The operation was aborted.", "AbortError");
|
|
6342
6350
|
}
|
|
6343
|
-
async function
|
|
6344
|
-
let n =
|
|
6345
|
-
return n || (n =
|
|
6351
|
+
async function Ra(e = ba, t) {
|
|
6352
|
+
let n = Pa.get(e);
|
|
6353
|
+
return n || (n = Fa(e), n.catch(() => Pa.delete(e)), Pa.set(e, n)), Ia(n, t);
|
|
6346
6354
|
}
|
|
6347
6355
|
//#endregion
|
|
6348
6356
|
//#region src/components/footer/FooterGlobal.tsx
|
|
6349
|
-
var
|
|
6350
|
-
function
|
|
6357
|
+
var za = "#cb-trigger";
|
|
6358
|
+
function Ba({ data: e, dataUrl: t, locale: n = "nb-NO", skipGlobal: r = !1, onDataError: i }) {
|
|
6351
6359
|
let [a, o] = m(), s = p(i);
|
|
6352
6360
|
s.current = i, c(() => {
|
|
6353
6361
|
if (e || r) return;
|
|
6354
6362
|
let n = new AbortController();
|
|
6355
|
-
return
|
|
6363
|
+
return Ra(t, n.signal).then((e) => {
|
|
6356
6364
|
n.signal.aborted || o(e);
|
|
6357
6365
|
}).catch((e) => {
|
|
6358
6366
|
e.name !== "AbortError" && (console.warn("Failed to fetch header/footer data:", e), s.current?.(e));
|
|
@@ -6364,20 +6372,20 @@ function za({ data: e, dataUrl: t, locale: n = "nb-NO", skipGlobal: r = !1, onDa
|
|
|
6364
6372
|
]);
|
|
6365
6373
|
let l = e ?? a;
|
|
6366
6374
|
return f(() => {
|
|
6367
|
-
if (!r) return
|
|
6375
|
+
if (!r) return Oa(l, n)?.footer;
|
|
6368
6376
|
}, [
|
|
6369
6377
|
l,
|
|
6370
6378
|
n,
|
|
6371
6379
|
r
|
|
6372
6380
|
]);
|
|
6373
6381
|
}
|
|
6374
|
-
var
|
|
6375
|
-
if (e.url ===
|
|
6382
|
+
var Va = ({ link: e, includeConsent: t, consent: n }) => {
|
|
6383
|
+
if (e.url === za) return t ? /* @__PURE__ */ _("li", { children: /* @__PURE__ */ _(kr, {
|
|
6376
6384
|
triggerType: "footerlink",
|
|
6377
6385
|
triggerText: e.text,
|
|
6378
6386
|
...n
|
|
6379
6387
|
}) }) : null;
|
|
6380
|
-
let r =
|
|
6388
|
+
let r = Na(e.url);
|
|
6381
6389
|
return /* @__PURE__ */ _("li", { children: /* @__PURE__ */ v("a", {
|
|
6382
6390
|
href: e.url,
|
|
6383
6391
|
children: [e.text, r && /* @__PURE__ */ v("span", {
|
|
@@ -6389,15 +6397,15 @@ var Ba = ({ link: e, includeConsent: t, consent: n }) => {
|
|
|
6389
6397
|
]
|
|
6390
6398
|
})]
|
|
6391
6399
|
}) });
|
|
6392
|
-
},
|
|
6400
|
+
}, Ha = ({ section: e, includeConsent: t, consent: n }) => /* @__PURE__ */ v("section", { children: [/* @__PURE__ */ _("h2", { children: e.title }), /* @__PURE__ */ _("ul", {
|
|
6393
6401
|
className: "pkt-footer__link-list",
|
|
6394
|
-
children: e.links.map((e) => /* @__PURE__ */ _(
|
|
6402
|
+
children: e.links.map((e) => /* @__PURE__ */ _(Va, {
|
|
6395
6403
|
link: e,
|
|
6396
6404
|
includeConsent: t,
|
|
6397
6405
|
consent: n
|
|
6398
6406
|
}, `${e.url}|${e.text}`))
|
|
6399
|
-
})] }),
|
|
6400
|
-
let t =
|
|
6407
|
+
})] }), Ua = ({ entry: e }) => {
|
|
6408
|
+
let t = Ea(e.url, e.text);
|
|
6401
6409
|
return t ? /* @__PURE__ */ _("li", { children: /* @__PURE__ */ _("a", {
|
|
6402
6410
|
className: "pkt-footer__some-link",
|
|
6403
6411
|
href: e.url,
|
|
@@ -6410,7 +6418,7 @@ var Ba = ({ link: e, includeConsent: t, consent: n }) => {
|
|
|
6410
6418
|
href: e.url,
|
|
6411
6419
|
children: e.text
|
|
6412
6420
|
}) });
|
|
6413
|
-
},
|
|
6421
|
+
}, Wa = ({ footer: e, includeConsent: t = !1, consent: n = {} }) => {
|
|
6414
6422
|
let r = e.links?.length > 0, i = e.some?.length > 0;
|
|
6415
6423
|
return /* @__PURE__ */ _("div", {
|
|
6416
6424
|
className: "pkt-footer__band pkt-footer__band--global",
|
|
@@ -6418,7 +6426,7 @@ var Ba = ({ link: e, includeConsent: t, consent: n }) => {
|
|
|
6418
6426
|
className: "pkt-footer__inner",
|
|
6419
6427
|
children: /* @__PURE__ */ v("div", {
|
|
6420
6428
|
className: "pkt-footer__sections",
|
|
6421
|
-
children: [e.sections.map((e) => /* @__PURE__ */ _(
|
|
6429
|
+
children: [e.sections.map((e) => /* @__PURE__ */ _(Ha, {
|
|
6422
6430
|
section: e,
|
|
6423
6431
|
includeConsent: t,
|
|
6424
6432
|
consent: n
|
|
@@ -6432,14 +6440,14 @@ var Ba = ({ link: e, includeConsent: t, consent: n }) => {
|
|
|
6432
6440
|
}) }, `${e.url}|${e.text}`))
|
|
6433
6441
|
}), i && /* @__PURE__ */ _("ul", {
|
|
6434
6442
|
className: "pkt-footer__some",
|
|
6435
|
-
children: e.some.map((e) => /* @__PURE__ */ _(
|
|
6443
|
+
children: e.some.map((e) => /* @__PURE__ */ _(Ua, { entry: e }, `${e.url}|${e.text}`))
|
|
6436
6444
|
})]
|
|
6437
6445
|
})]
|
|
6438
6446
|
})
|
|
6439
6447
|
})
|
|
6440
6448
|
});
|
|
6441
|
-
},
|
|
6442
|
-
let n = e.openInNewTab || t, r = e.external ?
|
|
6449
|
+
}, Ga = ({ link: e, openLinksInNewTab: t }) => {
|
|
6450
|
+
let n = e.openInNewTab || t, r = e.external ? Ma(e.href) : void 0;
|
|
6443
6451
|
return /* @__PURE__ */ _("li", { children: /* @__PURE__ */ v("a", {
|
|
6444
6452
|
href: e.href,
|
|
6445
6453
|
target: n ? "_blank" : "_self",
|
|
@@ -6453,17 +6461,17 @@ var Ba = ({ link: e, includeConsent: t, consent: n }) => {
|
|
|
6453
6461
|
]
|
|
6454
6462
|
})]
|
|
6455
6463
|
}) });
|
|
6456
|
-
},
|
|
6464
|
+
}, Ka = ({ column: e, openLinksInNewTab: t }) => /* @__PURE__ */ v("section", { children: [
|
|
6457
6465
|
/* @__PURE__ */ _("h2", { children: e.title }),
|
|
6458
6466
|
e.text && /* @__PURE__ */ _("p", { children: e.text }),
|
|
6459
6467
|
!!e.links?.length && /* @__PURE__ */ _("ul", {
|
|
6460
6468
|
className: "pkt-footer__link-list",
|
|
6461
|
-
children: e.links.map((e) => /* @__PURE__ */ _(
|
|
6469
|
+
children: e.links.map((e) => /* @__PURE__ */ _(Ga, {
|
|
6462
6470
|
link: e,
|
|
6463
6471
|
openLinksInNewTab: t
|
|
6464
6472
|
}, `${e.href}|${e.text}`))
|
|
6465
6473
|
})
|
|
6466
|
-
] }),
|
|
6474
|
+
] }), qa = ({ 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 }) => {
|
|
6467
6475
|
c(() => {
|
|
6468
6476
|
(t || n) && console.warn("PktFooter: The \"columnOne\"/\"columnTwo\" props are deprecated and will be removed in a future version. Please use \"columns\" instead.");
|
|
6469
6477
|
}, [t, n]), c(() => {
|
|
@@ -6471,7 +6479,7 @@ var Ba = ({ link: e, includeConsent: t, consent: n }) => {
|
|
|
6471
6479
|
}, [r, i]), c(() => {
|
|
6472
6480
|
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.");
|
|
6473
6481
|
}, [a]);
|
|
6474
|
-
let E =
|
|
6482
|
+
let E = Ba({
|
|
6475
6483
|
data: s,
|
|
6476
6484
|
dataUrl: l,
|
|
6477
6485
|
locale: u,
|
|
@@ -6514,14 +6522,14 @@ var Ba = ({ link: e, includeConsent: t, consent: n }) => {
|
|
|
6514
6522
|
children: [
|
|
6515
6523
|
D.length > 0 && /* @__PURE__ */ _("div", {
|
|
6516
6524
|
className: "pkt-footer__sections",
|
|
6517
|
-
children: D.map((e) => /* @__PURE__ */ _(
|
|
6525
|
+
children: D.map((e) => /* @__PURE__ */ _(Ka, {
|
|
6518
6526
|
column: e,
|
|
6519
6527
|
openLinksInNewTab: d
|
|
6520
6528
|
}, e.title))
|
|
6521
6529
|
}),
|
|
6522
6530
|
k && /* @__PURE__ */ _("div", {
|
|
6523
6531
|
className: "pkt-footer__consent",
|
|
6524
|
-
children: /* @__PURE__ */ _(
|
|
6532
|
+
children: /* @__PURE__ */ _(kr, {
|
|
6525
6533
|
triggerType: "footerlink",
|
|
6526
6534
|
...O
|
|
6527
6535
|
})
|
|
@@ -6554,14 +6562,14 @@ var Ba = ({ link: e, includeConsent: t, consent: n }) => {
|
|
|
6554
6562
|
})
|
|
6555
6563
|
]
|
|
6556
6564
|
})
|
|
6557
|
-
}), E && /* @__PURE__ */ _(
|
|
6565
|
+
}), E && /* @__PURE__ */ _(Wa, {
|
|
6558
6566
|
footer: E,
|
|
6559
6567
|
includeConsent: p,
|
|
6560
6568
|
consent: O
|
|
6561
6569
|
})]
|
|
6562
6570
|
});
|
|
6563
|
-
},
|
|
6564
|
-
let n = e.openInNewTab || t, r = e.external ?
|
|
6571
|
+
}, Ja = ({ link: e, openLinksInNewTab: t }) => {
|
|
6572
|
+
let n = e.openInNewTab || t, r = e.external ? Ma(e.href) : void 0;
|
|
6565
6573
|
return /* @__PURE__ */ v("a", {
|
|
6566
6574
|
className: "pkt-footer-simple__link",
|
|
6567
6575
|
href: e.href,
|
|
@@ -6579,11 +6587,11 @@ var Ba = ({ link: e, includeConsent: t, consent: n }) => {
|
|
|
6579
6587
|
]
|
|
6580
6588
|
})] })]
|
|
6581
6589
|
});
|
|
6582
|
-
},
|
|
6590
|
+
}, Ya = ({ 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 }) => {
|
|
6583
6591
|
c(() => {
|
|
6584
6592
|
(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.");
|
|
6585
6593
|
}, [t, n]);
|
|
6586
|
-
let C =
|
|
6594
|
+
let C = Ba({
|
|
6587
6595
|
data: i,
|
|
6588
6596
|
dataUrl: a,
|
|
6589
6597
|
locale: o,
|
|
@@ -6620,22 +6628,22 @@ var Ba = ({ link: e, includeConsent: t, consent: n }) => {
|
|
|
6620
6628
|
className: "pkt-footer__inner pkt-footer__inner--compact",
|
|
6621
6629
|
children: /* @__PURE__ */ v("ul", {
|
|
6622
6630
|
className: "pkt-footer-simple__list",
|
|
6623
|
-
children: [w.map((e) => /* @__PURE__ */ _("li", { children: /* @__PURE__ */ _(
|
|
6631
|
+
children: [w.map((e) => /* @__PURE__ */ _("li", { children: /* @__PURE__ */ _(Ja, {
|
|
6624
6632
|
link: e,
|
|
6625
6633
|
openLinksInNewTab: s
|
|
6626
|
-
}) }, `${e.href}|${e.text}`)), E && /* @__PURE__ */ _("li", { children: /* @__PURE__ */ _(
|
|
6634
|
+
}) }, `${e.href}|${e.text}`)), E && /* @__PURE__ */ _("li", { children: /* @__PURE__ */ _(kr, {
|
|
6627
6635
|
triggerType: "footerlink",
|
|
6628
6636
|
...T
|
|
6629
6637
|
}) })]
|
|
6630
6638
|
})
|
|
6631
6639
|
})
|
|
6632
|
-
}), C && /* @__PURE__ */ _(
|
|
6640
|
+
}), C && /* @__PURE__ */ _(Wa, {
|
|
6633
6641
|
footer: C,
|
|
6634
6642
|
includeConsent: l,
|
|
6635
6643
|
consent: T
|
|
6636
6644
|
})]
|
|
6637
6645
|
});
|
|
6638
|
-
},
|
|
6646
|
+
}, Xa = (e, t) => {
|
|
6639
6647
|
let [n, r] = m(() => typeof window > "u" ? t ?? 0 : t ?? window.innerWidth);
|
|
6640
6648
|
return c(() => {
|
|
6641
6649
|
let t = e.current;
|
|
@@ -6656,10 +6664,10 @@ var Ba = ({ link: e, includeConsent: t, consent: n }) => {
|
|
|
6656
6664
|
};
|
|
6657
6665
|
//#endregion
|
|
6658
6666
|
//#region src/hooks/useHeaderChrome.ts
|
|
6659
|
-
function
|
|
6667
|
+
function Za({ forwardedRef: e, mobileBreakpoint: t, tabletBreakpoint: n, position: r, scrollBehavior: i, pauseScrollHide: a = !1 }) {
|
|
6660
6668
|
let s = p(null), l = o((t) => {
|
|
6661
6669
|
s.current = t, typeof e == "function" ? e(t) : e && (e.current = t);
|
|
6662
|
-
}, [e]), u =
|
|
6670
|
+
}, [e]), u = Xa(s), d = u < t, f = u < n, h = r === "fixed", g = r === "sticky", [_, v] = m(!1), y = p(0), b = i === "hide";
|
|
6663
6671
|
c(() => {
|
|
6664
6672
|
let e = () => {
|
|
6665
6673
|
if (!b || a) return;
|
|
@@ -6689,16 +6697,16 @@ function Xa({ forwardedRef: e, mobileBreakpoint: t, tabletBreakpoint: n, positio
|
|
|
6689
6697
|
}
|
|
6690
6698
|
//#endregion
|
|
6691
6699
|
//#region src/hooks/useScrollLock.ts
|
|
6692
|
-
function
|
|
6693
|
-
let t = p(
|
|
6700
|
+
function Qa(e) {
|
|
6701
|
+
let t = p(qi());
|
|
6694
6702
|
c(() => {
|
|
6695
6703
|
let n = t.current;
|
|
6696
|
-
return
|
|
6704
|
+
return Ji(n, e), () => Ji(n, !1);
|
|
6697
6705
|
}, [e]);
|
|
6698
6706
|
}
|
|
6699
6707
|
//#endregion
|
|
6700
6708
|
//#region src/components/header-menu/HeaderMenu.tsx
|
|
6701
|
-
var
|
|
6709
|
+
var $a = ({ dataUrl: e = ba, data: t, locale: n = "nb-NO", open: r = !1, mobileBreakpoint: i = 768, className: a, onDataLoaded: s, onDataError: l, ref: u, ...d }) => {
|
|
6702
6710
|
let [h, y] = m("loading"), [b, x] = m(void 0), S = t ? "ready" : h, C = p(s), w = p(l);
|
|
6703
6711
|
c(() => {
|
|
6704
6712
|
C.current = s;
|
|
@@ -6707,19 +6715,19 @@ var Qa = ({ dataUrl: e = ya, data: t, locale: n = "nb-NO", open: r = !1, mobileB
|
|
|
6707
6715
|
}, [l]);
|
|
6708
6716
|
let T = p(null), E = o((e) => {
|
|
6709
6717
|
T.current = e, typeof u == "function" ? u(e) : u && (u.current = e);
|
|
6710
|
-
}, [u]), D =
|
|
6718
|
+
}, [u]), D = Xa(T) < i;
|
|
6711
6719
|
c(() => {
|
|
6712
6720
|
t && C.current?.(t);
|
|
6713
6721
|
}, [t]), c(() => {
|
|
6714
6722
|
if (t) return;
|
|
6715
6723
|
let n = new AbortController();
|
|
6716
|
-
return
|
|
6724
|
+
return Ra(e, n.signal).then((e) => {
|
|
6717
6725
|
n.signal.aborted || (x(e), y("ready"), C.current?.(e));
|
|
6718
6726
|
}).catch((e) => {
|
|
6719
6727
|
e.name !== "AbortError" && (y("error"), w.current?.(e));
|
|
6720
6728
|
}), () => n.abort();
|
|
6721
6729
|
}, [t, e]);
|
|
6722
|
-
let O = t ?? b, k = f(() =>
|
|
6730
|
+
let O = t ?? b, k = f(() => Oa(O, n), [O, n]), A = [
|
|
6723
6731
|
"pkt-header-menu",
|
|
6724
6732
|
r && "pkt-header-menu--open",
|
|
6725
6733
|
a
|
|
@@ -6751,28 +6759,28 @@ var Qa = ({ dataUrl: e = ya, data: t, locale: n = "nb-NO", open: r = !1, mobileB
|
|
|
6751
6759
|
className: A,
|
|
6752
6760
|
"aria-label": N,
|
|
6753
6761
|
children: [
|
|
6754
|
-
D ? /* @__PURE__ */ _(
|
|
6762
|
+
D ? /* @__PURE__ */ _(to, {
|
|
6755
6763
|
services: j.services,
|
|
6756
6764
|
sections: j.sections
|
|
6757
6765
|
}) : /* @__PURE__ */ v(g, { children: [
|
|
6758
|
-
/* @__PURE__ */ _(
|
|
6759
|
-
/* @__PURE__ */ _(
|
|
6766
|
+
/* @__PURE__ */ _(no, { services: j.services }),
|
|
6767
|
+
/* @__PURE__ */ _(ro, {
|
|
6760
6768
|
buttons: j.buttons,
|
|
6761
6769
|
mobile: !1
|
|
6762
6770
|
}),
|
|
6763
|
-
/* @__PURE__ */ _(
|
|
6771
|
+
/* @__PURE__ */ _(io, { sections: j.sections })
|
|
6764
6772
|
] }),
|
|
6765
|
-
/* @__PURE__ */ _(
|
|
6773
|
+
/* @__PURE__ */ _(ro, {
|
|
6766
6774
|
buttons: j.buttons,
|
|
6767
6775
|
mobile: !0
|
|
6768
6776
|
}),
|
|
6769
|
-
/* @__PURE__ */ _(
|
|
6777
|
+
/* @__PURE__ */ _(oo, {
|
|
6770
6778
|
links: j.links,
|
|
6771
6779
|
some: j.some
|
|
6772
6780
|
})
|
|
6773
6781
|
]
|
|
6774
6782
|
});
|
|
6775
|
-
},
|
|
6783
|
+
}, eo = ({ services: e }) => /* @__PURE__ */ _("ul", {
|
|
6776
6784
|
className: "pkt-header-menu__services-list",
|
|
6777
6785
|
children: e.links.map((e) => /* @__PURE__ */ _("li", {
|
|
6778
6786
|
className: "pkt-header-menu__service",
|
|
@@ -6781,7 +6789,7 @@ var Qa = ({ dataUrl: e = ya, data: t, locale: n = "nb-NO", open: r = !1, mobileB
|
|
|
6781
6789
|
href: e.url,
|
|
6782
6790
|
children: [/* @__PURE__ */ _(L, {
|
|
6783
6791
|
className: "pkt-header-menu__service-icon",
|
|
6784
|
-
name:
|
|
6792
|
+
name: Ca(e.icon),
|
|
6785
6793
|
"aria-hidden": "true"
|
|
6786
6794
|
}), /* @__PURE__ */ _("span", {
|
|
6787
6795
|
className: "pkt-header-menu__service-text",
|
|
@@ -6789,7 +6797,7 @@ var Qa = ({ dataUrl: e = ya, data: t, locale: n = "nb-NO", open: r = !1, mobileB
|
|
|
6789
6797
|
})]
|
|
6790
6798
|
})
|
|
6791
6799
|
}, e.url))
|
|
6792
|
-
}),
|
|
6800
|
+
}), to = ({ services: e, sections: t }) => /* @__PURE__ */ _("div", {
|
|
6793
6801
|
className: "pkt-header-menu__sections",
|
|
6794
6802
|
children: /* @__PURE__ */ v(j, {
|
|
6795
6803
|
className: "pkt-header-menu__sections-inner",
|
|
@@ -6800,22 +6808,22 @@ var Qa = ({ dataUrl: e = ya, data: t, locale: n = "nb-NO", open: r = !1, mobileB
|
|
|
6800
6808
|
skin: "plus-minus",
|
|
6801
6809
|
id: "pkt-header-menu-services",
|
|
6802
6810
|
title: e.title,
|
|
6803
|
-
children: /* @__PURE__ */ _(
|
|
6811
|
+
children: /* @__PURE__ */ _(eo, { services: e })
|
|
6804
6812
|
}), t.map((e, t) => /* @__PURE__ */ _(R, {
|
|
6805
6813
|
className: "pkt-header-menu__section",
|
|
6806
6814
|
skin: "plus-minus",
|
|
6807
6815
|
id: `pkt-header-menu-section-${t}`,
|
|
6808
6816
|
title: e.title,
|
|
6809
|
-
children: /* @__PURE__ */ _(
|
|
6817
|
+
children: /* @__PURE__ */ _(ao, { links: e.links })
|
|
6810
6818
|
}, e.title))]
|
|
6811
6819
|
})
|
|
6812
|
-
}),
|
|
6820
|
+
}), no = ({ services: e }) => /* @__PURE__ */ v("div", {
|
|
6813
6821
|
className: "pkt-header-menu__services",
|
|
6814
6822
|
children: [/* @__PURE__ */ _("h2", {
|
|
6815
6823
|
className: "pkt-header-menu__services-title",
|
|
6816
6824
|
children: e.title
|
|
6817
|
-
}), /* @__PURE__ */ _(
|
|
6818
|
-
}),
|
|
6825
|
+
}), /* @__PURE__ */ _(eo, { services: e })]
|
|
6826
|
+
}), ro = ({ buttons: e, mobile: t }) => {
|
|
6819
6827
|
if (!e || e.length === 0) return null;
|
|
6820
6828
|
let n = ["pkt-header-menu__buttons", t && "pkt-header-menu__buttons--mobile"].filter(Boolean).join(" ");
|
|
6821
6829
|
return /* @__PURE__ */ _("div", {
|
|
@@ -6825,7 +6833,7 @@ var Qa = ({ dataUrl: e = ya, data: t, locale: n = "nb-NO", open: r = !1, mobileB
|
|
|
6825
6833
|
href: e.url,
|
|
6826
6834
|
children: [/* @__PURE__ */ _(L, {
|
|
6827
6835
|
className: "pkt-btn__icon",
|
|
6828
|
-
name: e.iconName ?
|
|
6836
|
+
name: e.iconName ? Ca(e.iconName) : "user",
|
|
6829
6837
|
"aria-hidden": "true"
|
|
6830
6838
|
}), /* @__PURE__ */ _("span", {
|
|
6831
6839
|
className: "pkt-btn__text",
|
|
@@ -6833,7 +6841,7 @@ var Qa = ({ dataUrl: e = ya, data: t, locale: n = "nb-NO", open: r = !1, mobileB
|
|
|
6833
6841
|
})]
|
|
6834
6842
|
}, e.url))
|
|
6835
6843
|
});
|
|
6836
|
-
},
|
|
6844
|
+
}, io = ({ sections: e }) => !e || e.length === 0 ? null : /* @__PURE__ */ _("div", {
|
|
6837
6845
|
className: "pkt-header-menu__sections",
|
|
6838
6846
|
children: /* @__PURE__ */ _("div", {
|
|
6839
6847
|
className: "pkt-header-menu__sections-inner",
|
|
@@ -6842,17 +6850,17 @@ var Qa = ({ dataUrl: e = ya, data: t, locale: n = "nb-NO", open: r = !1, mobileB
|
|
|
6842
6850
|
children: [/* @__PURE__ */ _("h2", {
|
|
6843
6851
|
className: "pkt-header-menu__section-title",
|
|
6844
6852
|
children: e.title
|
|
6845
|
-
}), /* @__PURE__ */ _(
|
|
6853
|
+
}), /* @__PURE__ */ _(ao, { links: e.links })]
|
|
6846
6854
|
}, e.title))
|
|
6847
6855
|
})
|
|
6848
|
-
}),
|
|
6856
|
+
}), ao = ({ links: e }) => /* @__PURE__ */ _("ul", {
|
|
6849
6857
|
className: "pkt-header-menu__section-list",
|
|
6850
6858
|
children: e.map((e) => /* @__PURE__ */ _("li", { children: /* @__PURE__ */ _("a", {
|
|
6851
6859
|
className: "pkt-header-menu__section-link",
|
|
6852
6860
|
href: e.url,
|
|
6853
6861
|
children: e.text
|
|
6854
6862
|
}) }, e.url))
|
|
6855
|
-
}),
|
|
6863
|
+
}), oo = ({ links: e, some: t }) => {
|
|
6856
6864
|
let n = e && e.length > 0, r = t && t.length > 0;
|
|
6857
6865
|
return !n && !r ? null : /* @__PURE__ */ v("div", {
|
|
6858
6866
|
className: "pkt-header-menu__footer",
|
|
@@ -6865,11 +6873,11 @@ var Qa = ({ dataUrl: e = ya, data: t, locale: n = "nb-NO", open: r = !1, mobileB
|
|
|
6865
6873
|
}) }, e.url))
|
|
6866
6874
|
}), r && /* @__PURE__ */ _("ul", {
|
|
6867
6875
|
className: "pkt-header-menu__footer-list pkt-header-menu__footer-list--social",
|
|
6868
|
-
children: t.map((e) => /* @__PURE__ */ _(
|
|
6876
|
+
children: t.map((e) => /* @__PURE__ */ _(so, { entry: e }, e.url))
|
|
6869
6877
|
})]
|
|
6870
6878
|
});
|
|
6871
|
-
},
|
|
6872
|
-
let t =
|
|
6879
|
+
}, so = ({ entry: e }) => {
|
|
6880
|
+
let t = Ea(e.url, e.text);
|
|
6873
6881
|
return /* @__PURE__ */ _("li", { children: /* @__PURE__ */ _("a", {
|
|
6874
6882
|
className: "pkt-header-menu__social-link",
|
|
6875
6883
|
href: e.url,
|
|
@@ -6879,7 +6887,7 @@ var Qa = ({ dataUrl: e = ya, data: t, locale: n = "nb-NO", open: r = !1, mobileB
|
|
|
6879
6887
|
"aria-hidden": "true"
|
|
6880
6888
|
}) : /* @__PURE__ */ _("span", { children: e.text })
|
|
6881
6889
|
}) });
|
|
6882
|
-
},
|
|
6890
|
+
}, co = ({ href: e, iconName: t, className: n, iconPosition: r, external: i, target: a, renderLink: o, children: s, ...c }) => {
|
|
6883
6891
|
let l = {
|
|
6884
6892
|
"pkt-link": !0,
|
|
6885
6893
|
"pkt-link--icon-left": !!t && r === "left" || !!(t && !r),
|
|
@@ -6905,10 +6913,10 @@ var Qa = ({ dataUrl: e = ya, data: t, locale: n = "nb-NO", open: r = !1, mobileB
|
|
|
6905
6913
|
}
|
|
6906
6914
|
});
|
|
6907
6915
|
};
|
|
6908
|
-
|
|
6916
|
+
co.displayName = "PktLink";
|
|
6909
6917
|
//#endregion
|
|
6910
6918
|
//#region src/components/headerUserMenu/UserMenu.tsx
|
|
6911
|
-
var
|
|
6919
|
+
var lo = (e) => typeof e.target == "string" ? {
|
|
6912
6920
|
title: e.title,
|
|
6913
6921
|
iconName: e.iconName,
|
|
6914
6922
|
href: e.target
|
|
@@ -6916,7 +6924,7 @@ var co = (e) => typeof e.target == "string" ? {
|
|
|
6916
6924
|
title: e.title,
|
|
6917
6925
|
iconName: e.iconName,
|
|
6918
6926
|
onClick: e.target
|
|
6919
|
-
},
|
|
6927
|
+
}, uo = ({ item: e, className: t }) => "href" in e ? /* @__PURE__ */ _(co, {
|
|
6920
6928
|
iconName: e.iconName,
|
|
6921
6929
|
href: e.href,
|
|
6922
6930
|
className: (0, M.default)("pkt-user-menu__link", t),
|
|
@@ -6932,14 +6940,14 @@ var co = (e) => typeof e.target == "string" ? {
|
|
|
6932
6940
|
className: "pkt-link__icon",
|
|
6933
6941
|
"aria-hidden": "true"
|
|
6934
6942
|
}), e.title]
|
|
6935
|
-
}),
|
|
6943
|
+
}), fo = ({ links: e }) => /* @__PURE__ */ _("ul", {
|
|
6936
6944
|
className: "pkt-user-menu__sublist",
|
|
6937
6945
|
children: e.map((e, t) => /* @__PURE__ */ _("li", {
|
|
6938
6946
|
className: "pkt-user-menu__subitem",
|
|
6939
|
-
children: /* @__PURE__ */ _(
|
|
6947
|
+
children: /* @__PURE__ */ _(uo, { item: e })
|
|
6940
6948
|
}, t))
|
|
6941
|
-
}),
|
|
6942
|
-
let c = r?.map(
|
|
6949
|
+
}), po = i(({ user: e, formattedLastLoggedIn: t, representing: n, userMenu: r, canChangeRepresentation: i, changeRepresentation: a, logoutOnClick: o }, s) => {
|
|
6950
|
+
let c = r?.map(lo);
|
|
6943
6951
|
return /* @__PURE__ */ _("nav", {
|
|
6944
6952
|
className: "pkt-user-menu",
|
|
6945
6953
|
ref: s,
|
|
@@ -6967,7 +6975,7 @@ var co = (e) => typeof e.target == "string" ? {
|
|
|
6967
6975
|
}),
|
|
6968
6976
|
c && c.length > 0 && /* @__PURE__ */ _("li", {
|
|
6969
6977
|
className: "pkt-user-menu__item",
|
|
6970
|
-
children: /* @__PURE__ */ _(
|
|
6978
|
+
children: /* @__PURE__ */ _(fo, { links: c })
|
|
6971
6979
|
}),
|
|
6972
6980
|
n && /* @__PURE__ */ v("li", {
|
|
6973
6981
|
className: "pkt-user-menu__item",
|
|
@@ -6989,7 +6997,7 @@ var co = (e) => typeof e.target == "string" ? {
|
|
|
6989
6997
|
className: "pkt-user-menu__sublist mt-size-16",
|
|
6990
6998
|
children: /* @__PURE__ */ _("li", {
|
|
6991
6999
|
className: "pkt-user-menu__subitem",
|
|
6992
|
-
children: /* @__PURE__ */ _(
|
|
7000
|
+
children: /* @__PURE__ */ _(uo, { item: {
|
|
6993
7001
|
title: "Endre organisasjon",
|
|
6994
7002
|
iconName: "cogwheel",
|
|
6995
7003
|
onClick: a
|
|
@@ -7004,7 +7012,7 @@ var co = (e) => typeof e.target == "string" ? {
|
|
|
7004
7012
|
className: "pkt-user-menu__sublist",
|
|
7005
7013
|
children: /* @__PURE__ */ _("li", {
|
|
7006
7014
|
className: "pkt-user-menu__subitem",
|
|
7007
|
-
children: /* @__PURE__ */ _(
|
|
7015
|
+
children: /* @__PURE__ */ _(uo, { item: {
|
|
7008
7016
|
title: "Endre organisasjon",
|
|
7009
7017
|
iconName: "cogwheel",
|
|
7010
7018
|
onClick: a
|
|
@@ -7014,7 +7022,7 @@ var co = (e) => typeof e.target == "string" ? {
|
|
|
7014
7022
|
}),
|
|
7015
7023
|
o && /* @__PURE__ */ _("li", {
|
|
7016
7024
|
className: "pkt-user-menu__item",
|
|
7017
|
-
children: /* @__PURE__ */ _(
|
|
7025
|
+
children: /* @__PURE__ */ _(uo, { item: {
|
|
7018
7026
|
title: "Logg ut",
|
|
7019
7027
|
iconName: "exit",
|
|
7020
7028
|
onClick: o
|
|
@@ -7024,10 +7032,10 @@ var co = (e) => typeof e.target == "string" ? {
|
|
|
7024
7032
|
})
|
|
7025
7033
|
});
|
|
7026
7034
|
});
|
|
7027
|
-
|
|
7035
|
+
po.displayName = "PktHeaderUserMenu";
|
|
7028
7036
|
//#endregion
|
|
7029
7037
|
//#region src/components/searchinput/SearchInput.tsx
|
|
7030
|
-
var
|
|
7038
|
+
var mo = 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) => {
|
|
7031
7039
|
let S = ge(["searchinput"], y), C = s ?? S.searchinput.placeholder, w = (e, t) => {
|
|
7032
7040
|
e ? e() : h && h(t);
|
|
7033
7041
|
}, T = (e) => {
|
|
@@ -7037,10 +7045,10 @@ var po = i(({ appearance: e = "local", inputSize: t = "medium", disabled: n = !1
|
|
|
7037
7045
|
`pkt-searchinput--${e}`,
|
|
7038
7046
|
`pkt-searchinput--${t}`,
|
|
7039
7047
|
r && "pkt-searchinput--fullwidth"
|
|
7040
|
-
].filter(Boolean).join(" "), D = f(() =>
|
|
7048
|
+
].filter(Boolean).join(" "), D = f(() => Yn(), []), O = i || D, k = {
|
|
7041
7049
|
role: "search",
|
|
7042
7050
|
className: E,
|
|
7043
|
-
...
|
|
7051
|
+
...Wn()
|
|
7044
7052
|
}, A = (e) => u ? /* @__PURE__ */ _("form", {
|
|
7045
7053
|
...k,
|
|
7046
7054
|
action: u,
|
|
@@ -7117,19 +7125,19 @@ var po = i(({ appearance: e = "local", inputSize: t = "medium", disabled: n = !1
|
|
|
7117
7125
|
})
|
|
7118
7126
|
] }));
|
|
7119
7127
|
});
|
|
7120
|
-
|
|
7128
|
+
mo.displayName = "PktSearchInput";
|
|
7121
7129
|
//#endregion
|
|
7122
7130
|
//#region src/components/header/HeaderGlobal.tsx
|
|
7123
|
-
var
|
|
7124
|
-
typeof window < "u" && (window.pktLogoPath = window.pktLogoPath ||
|
|
7125
|
-
var
|
|
7131
|
+
var ho = "https://punkt-cdn.oslo.kommune.no/18.6/logos/";
|
|
7132
|
+
typeof window < "u" && (window.pktLogoPath = window.pktLogoPath || ho);
|
|
7133
|
+
var go = "pkt-header-global-menu", _o = "pkt-header-global-menu-toggle", vo = "pkt-header-global-search-panel", yo = "pkt-header-global-search-toggle", bo = i(({ className: e, "data-mode": t, dataUrl: n, data: r, locale: i = "nb-NO", logoLink: a = xa, logoClick: s, logoPath: l = typeof window < "u" ? window.pktLogoPath : ho, showSearch: u = !0, searchPlaceholder: h, onSearch: y, showContact: b = !0, user: x, userMenu: S, representing: C, canChangeRepresentation: w = !1, changeRepresentation: T, logOutButtonPlacement: E = "none", logOut: D, position: O = "fixed", scrollBehavior: k = "hide", mobileBreakpoint: A = 768, tabletBreakpoint: j = 1024, onDataLoaded: N, onDataError: P, strings: ee }, te) => {
|
|
7126
7134
|
let ne = k === "hide", [F, re] = m("none"), [ie, ae] = m(void 0), [oe, se] = m(!1), I = p(N), R = p(P);
|
|
7127
7135
|
c(() => {
|
|
7128
7136
|
I.current = N;
|
|
7129
7137
|
}, [N]), c(() => {
|
|
7130
7138
|
R.current = P;
|
|
7131
7139
|
}, [P]);
|
|
7132
|
-
let { setRef: ce, isMobile: z, isTablet: B, isFixed: V, isSticky: H, hidden: le, captureFocus: ue, flagRestoreFocus: U, restoreFocus: de } =
|
|
7140
|
+
let { setRef: ce, isMobile: z, isTablet: B, isFixed: V, isSticky: H, hidden: le, captureFocus: ue, flagRestoreFocus: U, restoreFocus: de } = Za({
|
|
7133
7141
|
forwardedRef: te,
|
|
7134
7142
|
mobileBreakpoint: A,
|
|
7135
7143
|
tabletBreakpoint: j,
|
|
@@ -7137,13 +7145,13 @@ var ho = "pkt-header-global-menu", go = "pkt-header-global-menu-toggle", _o = "p
|
|
|
7137
7145
|
scrollBehavior: k,
|
|
7138
7146
|
pauseScrollHide: F !== "none"
|
|
7139
7147
|
});
|
|
7140
|
-
|
|
7148
|
+
Qa(F === "menu" || F === "search");
|
|
7141
7149
|
let W = p(null), G = o((e) => {
|
|
7142
7150
|
W.current = e, ce(e);
|
|
7143
7151
|
}, [ce]);
|
|
7144
7152
|
d(() => {
|
|
7145
7153
|
if (F !== "menu" && F !== "search") return;
|
|
7146
|
-
let e = document.getElementById(F === "menu" ?
|
|
7154
|
+
let e = document.getElementById(F === "menu" ? go : vo), t = W.current?.getBoundingClientRect();
|
|
7147
7155
|
!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`));
|
|
7148
7156
|
}, [
|
|
7149
7157
|
F,
|
|
@@ -7154,17 +7162,17 @@ var ho = "pkt-header-global-menu", go = "pkt-header-global-menu-toggle", _o = "p
|
|
|
7154
7162
|
}, [r]), c(() => {
|
|
7155
7163
|
if (r) return;
|
|
7156
7164
|
let e = new AbortController();
|
|
7157
|
-
return
|
|
7165
|
+
return Ra(n, e.signal).then((t) => {
|
|
7158
7166
|
e.signal.aborted || (ae(t), se(!1), I.current?.(t));
|
|
7159
7167
|
}).catch((e) => {
|
|
7160
7168
|
e.name !== "AbortError" && (se(!0), R.current?.(e));
|
|
7161
7169
|
}), () => e.abort();
|
|
7162
7170
|
}, [r, n]);
|
|
7163
|
-
let K = r ?? ie, fe = f(() =>
|
|
7171
|
+
let K = r ?? ie, fe = f(() => Oa(K, i), [K, i]);
|
|
7164
7172
|
c(() => {
|
|
7165
7173
|
let e = (e) => {
|
|
7166
7174
|
let t = e.target;
|
|
7167
|
-
F === "user" && !t.closest(".pkt-header-global__user-container") && !t.closest(".pkt-header-global__user-menu") && re("none"), F === "menu" && !t.closest(".pkt-header-menu") && !t.closest(`#${
|
|
7175
|
+
F === "user" && !t.closest(".pkt-header-global__user-container") && !t.closest(".pkt-header-global__user-menu") && re("none"), F === "menu" && !t.closest(".pkt-header-menu") && !t.closest(`#${_o}`) && re("none"), F === "search" && !t.closest(".pkt-header-global__search-panel-inner") && !t.closest(`#${yo}`) && re("none");
|
|
7168
7176
|
}, t = (e) => {
|
|
7169
7177
|
e.key === "Escape" && F !== "none" && (e.preventDefault(), U(), re("none"));
|
|
7170
7178
|
};
|
|
@@ -7178,13 +7186,13 @@ var ho = "pkt-header-global-menu", go = "pkt-header-global-menu-toggle", _o = "p
|
|
|
7178
7186
|
U
|
|
7179
7187
|
]), c(() => {
|
|
7180
7188
|
if (F !== "menu" && F !== "search") return;
|
|
7181
|
-
let e = F === "menu" ?
|
|
7189
|
+
let e = F === "menu" ? go : vo, t = F === "menu" ? _o : yo, n = () => document.getElementById(e), r = () => document.getElementById(t), i = (e) => {
|
|
7182
7190
|
re("none"), (e.querySelector("button") ?? e).focus();
|
|
7183
7191
|
}, a = (e) => {
|
|
7184
7192
|
if (e.key !== "Tab") return;
|
|
7185
7193
|
let t = n(), a = r();
|
|
7186
7194
|
if (!t || !a) return;
|
|
7187
|
-
let o =
|
|
7195
|
+
let o = oi(t), s = si();
|
|
7188
7196
|
if (s && a.contains(s)) {
|
|
7189
7197
|
!e.shiftKey && o.length > 0 && (e.preventDefault(), o[0].focus());
|
|
7190
7198
|
return;
|
|
@@ -7238,7 +7246,7 @@ var ho = "pkt-header-global-menu", go = "pkt-header-global-menu-toggle", _o = "p
|
|
|
7238
7246
|
children: [
|
|
7239
7247
|
!be && xe && Y && /* @__PURE__ */ _("div", {
|
|
7240
7248
|
className: "pkt-header-global__search",
|
|
7241
|
-
children: /* @__PURE__ */ _(
|
|
7249
|
+
children: /* @__PURE__ */ _(mo, {
|
|
7242
7250
|
appearance: "global",
|
|
7243
7251
|
inputSize: B ? "small" : "medium",
|
|
7244
7252
|
fullwidth: !0,
|
|
@@ -7253,7 +7261,7 @@ var ho = "pkt-header-global-menu", go = "pkt-header-global-menu-toggle", _o = "p
|
|
|
7253
7261
|
})
|
|
7254
7262
|
}),
|
|
7255
7263
|
be && xe && /* @__PURE__ */ _(X, {
|
|
7256
|
-
id:
|
|
7264
|
+
id: yo,
|
|
7257
7265
|
className: "pkt-header-global__search-toggle",
|
|
7258
7266
|
skin: "primary",
|
|
7259
7267
|
color: ye ? void 0 : "yellow",
|
|
@@ -7262,12 +7270,12 @@ var ho = "pkt-header-global-menu", go = "pkt-header-global-menu-toggle", _o = "p
|
|
|
7262
7270
|
size: z ? "small" : "medium",
|
|
7263
7271
|
state: ye ? "active" : "normal",
|
|
7264
7272
|
"aria-expanded": ye,
|
|
7265
|
-
"aria-controls":
|
|
7273
|
+
"aria-controls": vo,
|
|
7266
7274
|
onClick: () => pe("search"),
|
|
7267
7275
|
children: Q
|
|
7268
7276
|
}),
|
|
7269
7277
|
/* @__PURE__ */ _(X, {
|
|
7270
|
-
id:
|
|
7278
|
+
id: _o,
|
|
7271
7279
|
className: "pkt-header-global__menu-toggle",
|
|
7272
7280
|
skin: be ? "tertiary" : "secondary",
|
|
7273
7281
|
variant: be ? "icon-only" : "icon-right",
|
|
@@ -7275,7 +7283,7 @@ var ho = "pkt-header-global-menu", go = "pkt-header-global-menu-toggle", _o = "p
|
|
|
7275
7283
|
size: B ? "small" : "medium",
|
|
7276
7284
|
state: _e ? "active" : "normal",
|
|
7277
7285
|
"aria-expanded": _e,
|
|
7278
|
-
"aria-controls":
|
|
7286
|
+
"aria-controls": go,
|
|
7279
7287
|
disabled: Ce,
|
|
7280
7288
|
onClick: () => pe("menu"),
|
|
7281
7289
|
children: Z
|
|
@@ -7312,7 +7320,7 @@ var ho = "pkt-header-global-menu", go = "pkt-header-global-menu-toggle", _o = "p
|
|
|
7312
7320
|
})]
|
|
7313
7321
|
}), ve && /* @__PURE__ */ _("div", {
|
|
7314
7322
|
className: "pkt-header-global__user-menu is-open",
|
|
7315
|
-
children: /* @__PURE__ */ _(
|
|
7323
|
+
children: /* @__PURE__ */ _(po, {
|
|
7316
7324
|
user: x,
|
|
7317
7325
|
formattedLastLoggedIn: q,
|
|
7318
7326
|
representing: C,
|
|
@@ -7327,8 +7335,8 @@ var ho = "pkt-header-global-menu", go = "pkt-header-global-menu-toggle", _o = "p
|
|
|
7327
7335
|
]
|
|
7328
7336
|
}), Te = _e && /* @__PURE__ */ _("div", {
|
|
7329
7337
|
className: (0, M.default)("pkt-header-global__menu", z && "pkt-header-global__menu--mobile", B && !z && "pkt-header-global__menu--tablet"),
|
|
7330
|
-
id:
|
|
7331
|
-
children: fe ? /* @__PURE__ */ _(
|
|
7338
|
+
id: go,
|
|
7339
|
+
children: fe ? /* @__PURE__ */ _($a, {
|
|
7332
7340
|
data: K,
|
|
7333
7341
|
locale: i,
|
|
7334
7342
|
open: !0,
|
|
@@ -7342,10 +7350,10 @@ var ho = "pkt-header-global-menu", go = "pkt-header-global-menu-toggle", _o = "p
|
|
|
7342
7350
|
})
|
|
7343
7351
|
}), Ee = ye && xe && Y && /* @__PURE__ */ _("div", {
|
|
7344
7352
|
className: (0, M.default)("pkt-header-global__search-panel", z && "pkt-header-global__search-panel--mobile", B && !z && "pkt-header-global__search-panel--tablet"),
|
|
7345
|
-
id:
|
|
7353
|
+
id: vo,
|
|
7346
7354
|
children: /* @__PURE__ */ _("div", {
|
|
7347
7355
|
className: "pkt-header-global__search-panel-inner",
|
|
7348
|
-
children: /* @__PURE__ */ _(
|
|
7356
|
+
children: /* @__PURE__ */ _(mo, {
|
|
7349
7357
|
appearance: "global",
|
|
7350
7358
|
fullwidth: !0,
|
|
7351
7359
|
id: Se,
|
|
@@ -7374,18 +7382,18 @@ var ho = "pkt-header-global-menu", go = "pkt-header-global-menu-toggle", _o = "p
|
|
|
7374
7382
|
Te
|
|
7375
7383
|
] });
|
|
7376
7384
|
});
|
|
7377
|
-
|
|
7385
|
+
bo.displayName = "PktHeaderGlobal";
|
|
7378
7386
|
//#endregion
|
|
7379
7387
|
//#region src/components/textinput/Textinput.tsx
|
|
7380
|
-
var
|
|
7381
|
-
let H = i ?? (o ?? 0) > 0, le = [s, "pkt-textinput"].filter(Boolean).join(" "), ue = j === "search" && !g && !N, U = j === "date" && P ? P.slice(0, 10) : P, [de, W] = m(P?.length || 0), G =
|
|
7388
|
+
var xo = i(({ id: e, ariaDescribedby: t, ariaLabelledby: n, autocomplete: r = "off", counter: i, hasFieldset: a, counterMaxLength: o, className: s, disabled: l = !1, errorMessage: u, hasError: d = !1, helptext: f, helptextDropdown: p, helptextDropdownButton: h, iconNameRight: g, inline: y = !1, fullwidth: b = !1, label: x, name: S, optionalTag: C = !1, optionalText: w, requiredTag: T = !1, requiredText: E, tagText: D = null, placeholder: O, prefix: k, suffix: A, type: j = "text", useWrapper: M = !0, omitSearchIcon: N = !1, value: P, minLength: ee, maxLength: te, min: ne, max: F, step: re, size: ie, readonly: ae, required: oe, dataTestid: se, onChange: I, skipForwardTestid: R = !1, inputSize: ce = "medium", strings: z, ...B }, V) => {
|
|
7389
|
+
let H = i ?? (o ?? 0) > 0, le = [s, "pkt-textinput"].filter(Boolean).join(" "), ue = j === "search" && !g && !N, U = j === "date" && P ? P.slice(0, 10) : P, [de, W] = m(P?.length || 0), G = bi(e), K = `${G}`, fe = `${K}-label`, q = n || fe, pe = (e) => {
|
|
7382
7390
|
H && W(e.currentTarget?.value?.length || 0), I && I(e);
|
|
7383
7391
|
};
|
|
7384
7392
|
return c(() => {
|
|
7385
7393
|
P !== void 0 && W(P?.length || 0);
|
|
7386
7394
|
}, [P]), /* @__PURE__ */ _("div", {
|
|
7387
7395
|
className: le,
|
|
7388
|
-
children: /* @__PURE__ */ _(
|
|
7396
|
+
children: /* @__PURE__ */ _($n, {
|
|
7389
7397
|
strings: z,
|
|
7390
7398
|
ariaDescribedby: t,
|
|
7391
7399
|
disabled: l,
|
|
@@ -7430,7 +7438,7 @@ var bo = i(({ id: e, ariaDescribedby: t, ariaLabelledby: n, autocomplete: r = "o
|
|
|
7430
7438
|
disabled: l,
|
|
7431
7439
|
"aria-invalid": d,
|
|
7432
7440
|
"aria-errormessage": d ? `${G}-error` : void 0,
|
|
7433
|
-
"aria-describedby":
|
|
7441
|
+
"aria-describedby": Gn({
|
|
7434
7442
|
id: K,
|
|
7435
7443
|
hasHelptext: !!f,
|
|
7436
7444
|
hasCounter: H,
|
|
@@ -7474,12 +7482,12 @@ var bo = i(({ id: e, ariaDescribedby: t, ariaLabelledby: n, autocomplete: r = "o
|
|
|
7474
7482
|
})
|
|
7475
7483
|
});
|
|
7476
7484
|
});
|
|
7477
|
-
|
|
7485
|
+
xo.displayName = "PktTextinput";
|
|
7478
7486
|
//#endregion
|
|
7479
7487
|
//#region src/components/header/HeaderService.tsx
|
|
7480
|
-
var
|
|
7481
|
-
typeof window < "u" && (window.pktLogoPath = window.pktLogoPath ||
|
|
7482
|
-
var
|
|
7488
|
+
var So = "https://punkt-cdn.oslo.kommune.no/18.6/logos/";
|
|
7489
|
+
typeof window < "u" && (window.pktLogoPath = window.pktLogoPath || So);
|
|
7490
|
+
var Co = i(({ mobileBreakpoint: e = 768, tabletBreakpoint: t = 1280, children: n, className: r, compact: i = !1, "data-mode": a, logOutButtonPlacement: s = "none", logOut: l, openedMenu: u, showSearch: d = !1, onSearch: h, onSearchChange: y, searchValue: b, searchPlaceholder: x, representing: S, serviceLink: C, serviceClick: w, serviceName: T, user: E, userMenu: D, userMenuFooter: O, userOptions: k, canChangeRepresentation: A = !1, changeRepresentation: j, hideLogo: N = !1, logoLink: P = xa, logoClick: ee, logoPath: te = typeof window < "u" ? window.pktLogoPath : So, position: ne = "fixed", scrollBehavior: F = "hide", slotMenuVariant: re = "icon-only", slotMenuText: ie = "Meny", strings: ae }, oe) => {
|
|
7483
7491
|
let se = F === "hide";
|
|
7484
7492
|
c(() => {
|
|
7485
7493
|
O && console.warn("PktHeaderService: The \"userMenuFooter\" prop is deprecated and will be removed in a future version. Please use \"userMenu\" instead.");
|
|
@@ -7500,14 +7508,14 @@ var So = i(({ mobileBreakpoint: e = 768, tabletBreakpoint: t = 1280, children: n
|
|
|
7500
7508
|
c(() => {
|
|
7501
7509
|
u !== void 0 && B(u);
|
|
7502
7510
|
}, [u]);
|
|
7503
|
-
let [V, H] = m(!1), [le, ue] = m(!1), U = p(null), de = p(null), W = p(null), G = p(null), K = p(null), { setRef: fe, isMobile: q, isTablet: pe, isFixed: me, isSticky: J, hidden: Y, captureFocus: he, flagRestoreFocus: Z, restoreFocus: Q } =
|
|
7511
|
+
let [V, H] = m(!1), [le, ue] = m(!1), U = p(null), de = p(null), W = p(null), G = p(null), K = p(null), { setRef: fe, isMobile: q, isTablet: pe, isFixed: me, isSticky: J, hidden: Y, captureFocus: he, flagRestoreFocus: Z, restoreFocus: Q } = Za({
|
|
7504
7512
|
forwardedRef: oe,
|
|
7505
7513
|
mobileBreakpoint: e,
|
|
7506
7514
|
tabletBreakpoint: t,
|
|
7507
7515
|
position: ne,
|
|
7508
7516
|
scrollBehavior: F
|
|
7509
7517
|
});
|
|
7510
|
-
|
|
7518
|
+
Qa((me || J) && q && z !== "none");
|
|
7511
7519
|
let _e = o((e, t) => {
|
|
7512
7520
|
let n = e.relatedTarget, r;
|
|
7513
7521
|
switch (t) {
|
|
@@ -7580,7 +7588,7 @@ var So = i(({ mobileBreakpoint: e = 768, tabletBreakpoint: t = 1280, children: n
|
|
|
7580
7588
|
}), T && /* @__PURE__ */ _("span", {
|
|
7581
7589
|
className: "pkt-header-service__service-name",
|
|
7582
7590
|
translate: "no",
|
|
7583
|
-
children: C ? /* @__PURE__ */ _(
|
|
7591
|
+
children: C ? /* @__PURE__ */ _(co, {
|
|
7584
7592
|
href: C,
|
|
7585
7593
|
className: "pkt-header-service__service-link ",
|
|
7586
7594
|
children: T
|
|
@@ -7643,7 +7651,7 @@ var So = i(({ mobileBreakpoint: e = 768, tabletBreakpoint: t = 1280, children: n
|
|
|
7643
7651
|
}), /* @__PURE__ */ _("div", {
|
|
7644
7652
|
className: (0, M.default)("pkt-header-service__mobile-menu", z === "search" && "is-open", le && "align-right"),
|
|
7645
7653
|
ref: K,
|
|
7646
|
-
children: z === "search" && /* @__PURE__ */ _(
|
|
7654
|
+
children: z === "search" && /* @__PURE__ */ _(xo, {
|
|
7647
7655
|
id: "mobile-search-menu",
|
|
7648
7656
|
className: "pkt-header-service__search-input",
|
|
7649
7657
|
type: "search",
|
|
@@ -7659,7 +7667,7 @@ var So = i(({ mobileBreakpoint: e = 768, tabletBreakpoint: t = 1280, children: n
|
|
|
7659
7667
|
}
|
|
7660
7668
|
})
|
|
7661
7669
|
})]
|
|
7662
|
-
}) : /* @__PURE__ */ _(
|
|
7670
|
+
}) : /* @__PURE__ */ _(xo, {
|
|
7663
7671
|
id: "header-service-search",
|
|
7664
7672
|
className: "pkt-header-service__search-input",
|
|
7665
7673
|
type: "search",
|
|
@@ -7706,7 +7714,7 @@ var So = i(({ mobileBreakpoint: e = 768, tabletBreakpoint: t = 1280, children: n
|
|
|
7706
7714
|
})]
|
|
7707
7715
|
}), z === "user" && E && /* @__PURE__ */ _("div", {
|
|
7708
7716
|
className: (0, M.default)(q ? "pkt-header-service__mobile-menu" : "pkt-header-service__user-menu", "is-open"),
|
|
7709
|
-
children: /* @__PURE__ */ _(
|
|
7717
|
+
children: /* @__PURE__ */ _(po, {
|
|
7710
7718
|
user: E,
|
|
7711
7719
|
formattedLastLoggedIn: ce,
|
|
7712
7720
|
representing: S,
|
|
@@ -7732,20 +7740,20 @@ var So = i(({ mobileBreakpoint: e = 768, tabletBreakpoint: t = 1280, children: n
|
|
|
7732
7740
|
children: [xe, /* @__PURE__ */ _("div", { className: (0, M.default)("pkt-header-service-spacer", i && "pkt-header-service-spacer--compact", E && "pkt-header-service-spacer--has-user", q && "pkt-header-service-spacer--mobile", pe && "pkt-header-service-spacer--tablet") })]
|
|
7733
7741
|
}) : xe;
|
|
7734
7742
|
});
|
|
7735
|
-
|
|
7743
|
+
Co.displayName = "PktHeaderService";
|
|
7736
7744
|
//#endregion
|
|
7737
7745
|
//#region src/components/header/Header.tsx
|
|
7738
|
-
var
|
|
7746
|
+
var wo = i((e, t) => e.type === "global" ? /* @__PURE__ */ _(bo, {
|
|
7739
7747
|
...e,
|
|
7740
7748
|
ref: t
|
|
7741
|
-
}) : /* @__PURE__ */ _(
|
|
7749
|
+
}) : /* @__PURE__ */ _(Co, {
|
|
7742
7750
|
...e,
|
|
7743
7751
|
ref: t
|
|
7744
7752
|
}));
|
|
7745
|
-
|
|
7753
|
+
wo.displayName = "PktHeader";
|
|
7746
7754
|
//#endregion
|
|
7747
7755
|
//#region src/components/input/Input.tsx
|
|
7748
|
-
var
|
|
7756
|
+
var To = i(({ label: e, id: t, children: n, ...r }, i) => /* @__PURE__ */ v("div", {
|
|
7749
7757
|
className: "pkt-form-group",
|
|
7750
7758
|
children: [
|
|
7751
7759
|
/* @__PURE__ */ _("label", {
|
|
@@ -7762,10 +7770,10 @@ var wo = i(({ label: e, id: t, children: n, ...r }, i) => /* @__PURE__ */ v("div
|
|
|
7762
7770
|
n
|
|
7763
7771
|
]
|
|
7764
7772
|
}));
|
|
7765
|
-
|
|
7773
|
+
To.displayName = "PktInput";
|
|
7766
7774
|
//#endregion
|
|
7767
7775
|
//#region src/components/linkcard/LinkCard.tsx
|
|
7768
|
-
var
|
|
7776
|
+
var Eo = ({ children: e, skin: t, title: n, href: r, iconName: i, openInNewTab: a, external: o, className: s, strings: c, ...l }) => {
|
|
7769
7777
|
let u = ge(["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(" ");
|
|
7770
7778
|
return /* @__PURE__ */ v("a", {
|
|
7771
7779
|
...l,
|
|
@@ -7795,14 +7803,14 @@ var To = ({ children: e, skin: t, title: n, href: r, iconName: i, openInNewTab:
|
|
|
7795
7803
|
};
|
|
7796
7804
|
//#endregion
|
|
7797
7805
|
//#region src/components/loader/Loader.tsx
|
|
7798
|
-
|
|
7799
|
-
var
|
|
7806
|
+
Eo.displayName = "PktLinkCard", typeof window < "u" && (window.pktAnimationPath = window.pktAnimationPath || "https://punkt-cdn.oslo.kommune.no/18.6/animations/");
|
|
7807
|
+
var Do = (e) => {
|
|
7800
7808
|
switch (e) {
|
|
7801
7809
|
case "blue": return "spinner-blue";
|
|
7802
7810
|
case "rainbow": return "spinner";
|
|
7803
7811
|
default: return "loader";
|
|
7804
7812
|
}
|
|
7805
|
-
},
|
|
7813
|
+
}, Oo = 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) {
|
|
7806
7814
|
let [f, p] = m(e === 0);
|
|
7807
7815
|
c(() => {
|
|
7808
7816
|
if (e > 0) {
|
|
@@ -7823,7 +7831,7 @@ var Eo = (e) => {
|
|
|
7823
7831
|
children: [n && f && /* @__PURE__ */ v("div", {
|
|
7824
7832
|
className: "pkt-loader__spinner",
|
|
7825
7833
|
children: [/* @__PURE__ */ _(L, {
|
|
7826
|
-
name:
|
|
7834
|
+
name: Do(a),
|
|
7827
7835
|
path: o,
|
|
7828
7836
|
className: `pkt-loader__svg pkt-loader__${a}`
|
|
7829
7837
|
}), r && /* @__PURE__ */ _("p", { children: r })]
|
|
@@ -7833,10 +7841,10 @@ var Eo = (e) => {
|
|
|
7833
7841
|
})]
|
|
7834
7842
|
});
|
|
7835
7843
|
});
|
|
7836
|
-
|
|
7844
|
+
Oo.displayName = "PktLoader";
|
|
7837
7845
|
//#endregion
|
|
7838
7846
|
//#region src/components/messagebox/Messagebox.tsx
|
|
7839
|
-
var
|
|
7847
|
+
var ko = ({ children: e, className: t, skin: n, title: i, compact: a, closable: s, onClose: c, ...l }) => {
|
|
7840
7848
|
let [u, d] = m(!1), f = {
|
|
7841
7849
|
"pkt-messagebox": !0,
|
|
7842
7850
|
"pkt-messagebox--compact": a,
|
|
@@ -7874,10 +7882,10 @@ var Oo = ({ children: e, className: t, skin: n, title: i, compact: a, closable:
|
|
|
7874
7882
|
]
|
|
7875
7883
|
});
|
|
7876
7884
|
};
|
|
7877
|
-
|
|
7885
|
+
ko.displayName = "PktMessagebox";
|
|
7878
7886
|
//#endregion
|
|
7879
7887
|
//#region src/components/radio/RadioButton.tsx
|
|
7880
|
-
var
|
|
7888
|
+
var Ao = i(({ id: e, name: t, label: n, className: r, hasTile: i = !1, disabled: a = !1, checkHelptext: o, hasError: s = !1, defaultChecked: c, checked: l, optionalTag: u, optionalText: d, requiredTag: f, requiredText: p, strings: m, tagText: h, ...y }, b) => {
|
|
7881
7889
|
let x = ge(["forms"], m), S = [r, "pkt-input-check"].filter(Boolean).join(" "), C = [
|
|
7882
7890
|
"pkt-input-check__input",
|
|
7883
7891
|
i ? "pkt-input-check__input--tile" : "",
|
|
@@ -7929,14 +7937,14 @@ var ko = i(({ id: e, name: t, label: n, className: r, hasTile: i = !1, disabled:
|
|
|
7929
7937
|
})
|
|
7930
7938
|
});
|
|
7931
7939
|
});
|
|
7932
|
-
|
|
7940
|
+
Ao.displayName = "PktRadioButton";
|
|
7933
7941
|
//#endregion
|
|
7934
7942
|
//#region src/components/select/Select.tsx
|
|
7935
|
-
var
|
|
7936
|
-
let D =
|
|
7943
|
+
var jo = i(({ ariaDescribedby: e, ariaLabelledby: t, children: n, className: r, disabled: i = !1, errorMessage: a, hasError: o = !1, helptext: s, helptextDropdown: c, helptextDropdownButton: l, id: u, inline: d = !1, fullwidth: f = !1, label: p, name: m, optionalTag: h = !1, optionalText: g, requiredTag: v = !1, requiredText: y, tagText: b, useWrapper: x = !0, hasFieldset: S, inputSize: C = "medium", strings: w, ...T }, E) => {
|
|
7944
|
+
let D = bi(u), O = [r, "pkt-select"].filter(Boolean).join(" ");
|
|
7937
7945
|
return /* @__PURE__ */ _("div", {
|
|
7938
7946
|
className: O,
|
|
7939
|
-
children: /* @__PURE__ */ _(
|
|
7947
|
+
children: /* @__PURE__ */ _($n, {
|
|
7940
7948
|
strings: w,
|
|
7941
7949
|
forId: `${D}-input`,
|
|
7942
7950
|
label: p,
|
|
@@ -7961,7 +7969,7 @@ var Ao = i(({ ariaDescribedby: e, ariaLabelledby: t, children: n, className: r,
|
|
|
7961
7969
|
className: `pkt-input pkt-input--${C} ${f ? "pkt-input--fullwidth" : ""}`,
|
|
7962
7970
|
"aria-invalid": o,
|
|
7963
7971
|
"aria-errormessage": o ? `${D}-error` : void 0,
|
|
7964
|
-
"aria-describedby":
|
|
7972
|
+
"aria-describedby": Gn({
|
|
7965
7973
|
id: `${D}-input`,
|
|
7966
7974
|
hasHelptext: !!s,
|
|
7967
7975
|
hasCounter: !1,
|
|
@@ -7977,10 +7985,10 @@ var Ao = i(({ ariaDescribedby: e, ariaLabelledby: t, children: n, className: r,
|
|
|
7977
7985
|
})
|
|
7978
7986
|
});
|
|
7979
7987
|
});
|
|
7980
|
-
|
|
7988
|
+
jo.displayName = "PktSelect";
|
|
7981
7989
|
//#endregion
|
|
7982
7990
|
//#region src/components/stepper/Step.tsx
|
|
7983
|
-
var
|
|
7991
|
+
var Mo = /* @__PURE__ */ _("svg", {
|
|
7984
7992
|
xmlns: "http://www.w3.org/2000/svg",
|
|
7985
7993
|
width: "24",
|
|
7986
7994
|
height: "24",
|
|
@@ -7991,7 +7999,7 @@ var jo = /* @__PURE__ */ _("svg", {
|
|
|
7991
7999
|
r: "7",
|
|
7992
8000
|
style: { fill: "var(--pkt-color-brand-neutrals-300, #CCC)" }
|
|
7993
8001
|
})
|
|
7994
|
-
}),
|
|
8002
|
+
}), No = /* @__PURE__ */ v("svg", {
|
|
7995
8003
|
xmlns: "http://www.w3.org/2000/svg",
|
|
7996
8004
|
width: "24",
|
|
7997
8005
|
height: "24",
|
|
@@ -8008,7 +8016,7 @@ var jo = /* @__PURE__ */ _("svg", {
|
|
|
8008
8016
|
r: "6",
|
|
8009
8017
|
fill: "#2A2859"
|
|
8010
8018
|
})]
|
|
8011
|
-
}),
|
|
8019
|
+
}), Po = /* @__PURE__ */ v("svg", {
|
|
8012
8020
|
xmlns: "http://www.w3.org/2000/svg",
|
|
8013
8021
|
width: "24",
|
|
8014
8022
|
height: "24",
|
|
@@ -8020,7 +8028,7 @@ var jo = /* @__PURE__ */ _("svg", {
|
|
|
8020
8028
|
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",
|
|
8021
8029
|
fill: "#F1FDFF"
|
|
8022
8030
|
})]
|
|
8023
|
-
}),
|
|
8031
|
+
}), Fo = ({ children: e, className: t, status: n = "incomplete", title: r }) => /* @__PURE__ */ v("li", {
|
|
8024
8032
|
className: (0, M.default)("pkt-step", t, `pkt-step--${n}`),
|
|
8025
8033
|
"data-testid": "pkt-step",
|
|
8026
8034
|
children: [
|
|
@@ -8034,7 +8042,7 @@ var jo = /* @__PURE__ */ _("svg", {
|
|
|
8034
8042
|
}),
|
|
8035
8043
|
/* @__PURE__ */ _("span", {
|
|
8036
8044
|
className: (0, M.default)("pkt-step__indicator"),
|
|
8037
|
-
children: n === "current" ?
|
|
8045
|
+
children: n === "current" ? No : n === "completed" ? Po : Mo
|
|
8038
8046
|
}),
|
|
8039
8047
|
/* @__PURE__ */ _("span", {
|
|
8040
8048
|
className: "pkt-step__line pkt-step__line--3",
|
|
@@ -8051,7 +8059,7 @@ var jo = /* @__PURE__ */ _("svg", {
|
|
|
8051
8059
|
})]
|
|
8052
8060
|
})
|
|
8053
8061
|
]
|
|
8054
|
-
}),
|
|
8062
|
+
}), Io = i(({ activeStep: n, className: r, children: i, hideNonActiveSteps: o = !1, hideNonActiveStepsContent: s = !0, orientation: c = "vertical", ...l }, u) => {
|
|
8055
8063
|
let d = (0, M.default)(r, "pkt-stepper", c === "horizontal" ? "pkt-stepper--horizontal" : "pkt-stepper--vertical"), f = e.map(i, (e, r) => a(e) ? t(e, { className: (0, M.default)(e.props.className, {
|
|
8056
8064
|
"pkt-step--hideStep": o && r !== n,
|
|
8057
8065
|
"pkt-step--hideContent": s && r !== n
|
|
@@ -8064,10 +8072,10 @@ var jo = /* @__PURE__ */ _("svg", {
|
|
|
8064
8072
|
children: f
|
|
8065
8073
|
});
|
|
8066
8074
|
});
|
|
8067
|
-
|
|
8075
|
+
Io.displayName = "PktStepper";
|
|
8068
8076
|
//#endregion
|
|
8069
8077
|
//#region src/components/table/Table.tsx
|
|
8070
|
-
var
|
|
8078
|
+
var Lo = ({ className: e, compact: t = !1, skin: n = "basic", responsiveView: r = !0, children: i, ...a }) => /* @__PURE__ */ _("table", {
|
|
8071
8079
|
"data-testid": "pkt-table",
|
|
8072
8080
|
className: (0, M.default)(e, "pkt-table", {
|
|
8073
8081
|
"pkt-table--responsive": r,
|
|
@@ -8078,36 +8086,36 @@ var Io = ({ className: e, compact: t = !1, skin: n = "basic", responsiveView: r
|
|
|
8078
8086
|
role: "table",
|
|
8079
8087
|
...a,
|
|
8080
8088
|
children: i
|
|
8081
|
-
}),
|
|
8089
|
+
}), Ro = ({ id: e, children: t, className: n, ...r }) => /* @__PURE__ */ _("tbody", {
|
|
8082
8090
|
id: e,
|
|
8083
8091
|
className: (0, M.default)(n, "pkt-table__body", {}),
|
|
8084
8092
|
...r,
|
|
8085
8093
|
role: "rowgroup",
|
|
8086
8094
|
children: t
|
|
8087
|
-
}),
|
|
8095
|
+
}), zo = ({ children: e, className: t, dataLabel: n, ...r }) => /* @__PURE__ */ _("td", {
|
|
8088
8096
|
className: (0, M.default)(t, "pkt-table__data-cell", {}),
|
|
8089
8097
|
"data-label": n,
|
|
8090
8098
|
role: "cell",
|
|
8091
8099
|
"data-testid": "pkt-table__data-cell",
|
|
8092
8100
|
...r,
|
|
8093
8101
|
children: e
|
|
8094
|
-
}),
|
|
8102
|
+
}), Bo = ({ className: e, children: t, ...n }) => /* @__PURE__ */ _("thead", {
|
|
8095
8103
|
className: (0, M.default)(e, "pkt-table__header", {}),
|
|
8096
8104
|
role: "rowgroup",
|
|
8097
8105
|
...n,
|
|
8098
8106
|
children: t
|
|
8099
|
-
}),
|
|
8107
|
+
}), Vo = ({ className: e, children: t, ...n }) => /* @__PURE__ */ _("th", {
|
|
8100
8108
|
className: (0, M.default)(e, "pkt-table__header-cell", {}),
|
|
8101
8109
|
role: "columnheader",
|
|
8102
8110
|
...n,
|
|
8103
8111
|
children: t
|
|
8104
|
-
}),
|
|
8112
|
+
}), Ho = ({ className: e, children: t, ...n }) => /* @__PURE__ */ _("tr", {
|
|
8105
8113
|
className: (0, M.default)(e, "pkt-table__row", {}),
|
|
8106
8114
|
role: "row",
|
|
8107
8115
|
...n,
|
|
8108
8116
|
children: t
|
|
8109
|
-
}),
|
|
8110
|
-
let { arrowNav: d, registerTabRef: f, handleKeyPress: p, selectTab: m } =
|
|
8117
|
+
}), Uo = i(({ children: e, active: t, disabled: n = !1, href: r, onClick: i, icon: a, controls: o, tag: s, tagSkin: c, index: l = 0 }, u) => {
|
|
8118
|
+
let { arrowNav: d, registerTabRef: f, handleKeyPress: p, selectTab: m } = Go(), h = !!t && !n, y = {
|
|
8111
8119
|
"aria-selected": d ? h : void 0,
|
|
8112
8120
|
"aria-controls": o,
|
|
8113
8121
|
role: d ? "tab" : void 0,
|
|
@@ -8135,7 +8143,7 @@ var Io = ({ className: e, compact: t = !1, skin: n = "basic", responsiveView: r
|
|
|
8135
8143
|
className: `pkt-icon--small ${a === "check" ? "pkt-tabs__status-icon" : ""}`
|
|
8136
8144
|
}),
|
|
8137
8145
|
e,
|
|
8138
|
-
s && /* @__PURE__ */ _(
|
|
8146
|
+
s && /* @__PURE__ */ _(Vn, {
|
|
8139
8147
|
skin: c,
|
|
8140
8148
|
size: "small",
|
|
8141
8149
|
children: s
|
|
@@ -8156,14 +8164,14 @@ var Io = ({ className: e, compact: t = !1, skin: n = "basic", responsiveView: r
|
|
|
8156
8164
|
children: b
|
|
8157
8165
|
});
|
|
8158
8166
|
});
|
|
8159
|
-
|
|
8167
|
+
Uo.displayName = "PktTabItem";
|
|
8160
8168
|
//#endregion
|
|
8161
8169
|
//#region src/components/tabs/Tabs.tsx
|
|
8162
|
-
var
|
|
8163
|
-
let e = s(
|
|
8170
|
+
var Wo = n(null), Go = () => {
|
|
8171
|
+
let e = s(Wo);
|
|
8164
8172
|
if (!e) throw Error("TabItem must be used within a Tabs component");
|
|
8165
8173
|
return e;
|
|
8166
|
-
},
|
|
8174
|
+
}, Ko = i(({ arrowNav: t = !0, disableArrowNav: n = !1, separatorIconName: r, separatorIconPath: i, tabs: a, onTabSelected: o, children: s }, l) => {
|
|
8167
8175
|
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);
|
|
8168
8176
|
c(() => {
|
|
8169
8177
|
u.current = u.current.slice(0, g), Object.keys(d.current).forEach((e) => {
|
|
@@ -8210,7 +8218,7 @@ var Uo = n(null), Wo = () => {
|
|
|
8210
8218
|
name: r,
|
|
8211
8219
|
className: "pkt-tabs__separator-icon"
|
|
8212
8220
|
}) : null
|
|
8213
|
-
}, e), T = (e) => !v || e.length <= 1 ? e : e.flatMap((t, n) => n < e.length - 1 ? [t, w(`separator-${n}`)] : [t]), E = a?.map((e, t) => /* @__PURE__ */ _(
|
|
8221
|
+
}, e), T = (e) => !v || e.length <= 1 ? e : e.flatMap((t, n) => n < e.length - 1 ? [t, w(`separator-${n}`)] : [t]), E = a?.map((e, t) => /* @__PURE__ */ _(Uo, {
|
|
8214
8222
|
active: !e.disabled && e.active,
|
|
8215
8223
|
disabled: e.disabled,
|
|
8216
8224
|
href: e.href,
|
|
@@ -8221,7 +8229,7 @@ var Uo = n(null), Wo = () => {
|
|
|
8221
8229
|
index: t,
|
|
8222
8230
|
children: e.text
|
|
8223
8231
|
}, t)), D = ["pkt-tabs", v && "pkt-tabs--with-separator"].filter(Boolean).join(" "), O = T(h ? m : E || []);
|
|
8224
|
-
return /* @__PURE__ */ _(
|
|
8232
|
+
return /* @__PURE__ */ _(Wo.Provider, {
|
|
8225
8233
|
value: {
|
|
8226
8234
|
arrowNav: f,
|
|
8227
8235
|
registerTabRef: C,
|
|
@@ -8239,53 +8247,53 @@ var Uo = n(null), Wo = () => {
|
|
|
8239
8247
|
})
|
|
8240
8248
|
});
|
|
8241
8249
|
});
|
|
8242
|
-
|
|
8250
|
+
Ko.displayName = "PktTabs";
|
|
8243
8251
|
//#endregion
|
|
8244
8252
|
//#region ../../shared-utils/timepicker/options.ts
|
|
8245
|
-
var
|
|
8253
|
+
var qo = (e) => e ? Math.max(1, Math.round(e / 60)) : 1, Jo = (e, t) => {
|
|
8246
8254
|
let n = e ? parseInt(String(e).split(":")[0], 10) : 0, r = t ? parseInt(String(t).split(":")[0], 10) : 23;
|
|
8247
8255
|
return Array.from({ length: r - n + 1 }, (e, t) => t + n);
|
|
8248
|
-
},
|
|
8249
|
-
let t =
|
|
8256
|
+
}, Yo = (e) => {
|
|
8257
|
+
let t = qo(e);
|
|
8250
8258
|
return Array.from({ length: Math.floor(60 / t) }, (e, n) => n * t);
|
|
8251
|
-
},
|
|
8259
|
+
}, Xo = (e, t, n, r) => {
|
|
8252
8260
|
let i = e === "" ? n === 1 ? 0 : 23 : parseInt(e, 10), a = t === "" ? n === 1 ? 0 : Math.floor(59 / r) * r : parseInt(t, 10);
|
|
8253
8261
|
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), {
|
|
8254
8262
|
hours: String(i).padStart(2, "0"),
|
|
8255
8263
|
minutes: String(a).padStart(2, "0")
|
|
8256
8264
|
};
|
|
8257
|
-
},
|
|
8265
|
+
}, Zo = (e) => /^\d{2}:\d{2}$/.test(e) && parseInt(e.slice(0, 2), 10) <= 23 && parseInt(e.slice(3), 10) <= 59, Qo = (e) => {
|
|
8258
8266
|
let [t, n] = e.split(":").map(Number);
|
|
8259
8267
|
return t * 60 + n;
|
|
8260
8268
|
};
|
|
8261
8269
|
//#endregion
|
|
8262
8270
|
//#region src/components/timepicker/useTimepickerState.ts
|
|
8263
|
-
function
|
|
8264
|
-
if (e &&
|
|
8271
|
+
function $o(e) {
|
|
8272
|
+
if (e && Zo(e)) {
|
|
8265
8273
|
let [t, n] = e.split(":");
|
|
8266
8274
|
return [t, n];
|
|
8267
8275
|
}
|
|
8268
8276
|
return ["", ""];
|
|
8269
8277
|
}
|
|
8270
|
-
function
|
|
8278
|
+
function es(e, t) {
|
|
8271
8279
|
return `${String(parseInt(e, 10)).padStart(2, "0")}:${String(parseInt(t, 10)).padStart(2, "0")}`;
|
|
8272
8280
|
}
|
|
8273
|
-
function
|
|
8281
|
+
function ts(e, t, n) {
|
|
8274
8282
|
let { required: r, min: i, max: a, step: o } = t;
|
|
8275
8283
|
if (r && !e) return {
|
|
8276
8284
|
valid: !1,
|
|
8277
8285
|
message: n.valueMissing
|
|
8278
8286
|
};
|
|
8279
8287
|
if (!e) return { valid: !0 };
|
|
8280
|
-
if (!
|
|
8288
|
+
if (!Zo(e)) return {
|
|
8281
8289
|
valid: !1,
|
|
8282
8290
|
message: n.typeMismatch
|
|
8283
8291
|
};
|
|
8284
|
-
let s =
|
|
8285
|
-
return i && s <
|
|
8292
|
+
let s = Qo(e), c = qo(o);
|
|
8293
|
+
return i && s < Qo(String(i)) ? {
|
|
8286
8294
|
valid: !1,
|
|
8287
8295
|
message: B(n.rangeUnderflowMin, { min: String(i) })
|
|
8288
|
-
} : a && s >
|
|
8296
|
+
} : a && s > Qo(String(a)) ? {
|
|
8289
8297
|
valid: !1,
|
|
8290
8298
|
message: B(n.rangeOverflowMax, { max: String(a) })
|
|
8291
8299
|
} : o && s % c !== 0 ? {
|
|
@@ -8293,11 +8301,11 @@ function es(e, t, n) {
|
|
|
8293
8301
|
message: c === 60 ? n.timeStepMismatchHour : c === 30 ? n.timeStepMismatchHalfHour : B(n.timeStepMismatch, { step: `${c}, ${c * 2}, ${c * 3}` })
|
|
8294
8302
|
} : { valid: !0 };
|
|
8295
8303
|
}
|
|
8296
|
-
function
|
|
8304
|
+
function ns(e) {
|
|
8297
8305
|
return e === 3600 || e < 3600 && 3600 % e == 0 && e % 60 == 0;
|
|
8298
8306
|
}
|
|
8299
|
-
function
|
|
8300
|
-
let { id: n, label: r, value: i, defaultValue: a, min: s, max: l, step: h = 60, hidePicker: g = !1, stepArrows: _ = !1, fullwidth: v = !1, name: y, disabled: b = !1, required: x = !1, helptext: S, helptextDropdown: C, helptextDropdownButton: w, hasError: T = !1, errorMessage: E, optionalTag: D = !1, optionalText: O, requiredTag: k = !1, requiredText: A, tagText: j, inline: M = !1, useWrapper: N = !0, ariaDescribedby: P, strings: ee, className: te, inputSize: ne = "medium", onValueChange: F, onFocus: re, onBlur: ie } = e, ae = ge(["timepicker", "validation"], ee), oe = ae.timepicker, se = ee, I = i !== void 0, L = i === void 0 ? a ?? "" : i ?? "", R = p(L), [ce, z] = m(() => L), B = I ? i ?? "" : ce, [V, H] = m(() =>
|
|
8307
|
+
function rs(e, t) {
|
|
8308
|
+
let { id: n, label: r, value: i, defaultValue: a, min: s, max: l, step: h = 60, hidePicker: g = !1, stepArrows: _ = !1, fullwidth: v = !1, name: y, disabled: b = !1, required: x = !1, helptext: S, helptextDropdown: C, helptextDropdownButton: w, hasError: T = !1, errorMessage: E, optionalTag: D = !1, optionalText: O, requiredTag: k = !1, requiredText: A, tagText: j, inline: M = !1, useWrapper: N = !0, ariaDescribedby: P, strings: ee, className: te, inputSize: ne = "medium", onValueChange: F, onFocus: re, onBlur: ie } = e, ae = ge(["timepicker", "validation"], ee), oe = ae.timepicker, se = ee, I = i !== void 0, L = i === void 0 ? a ?? "" : i ?? "", R = p(L), [ce, z] = m(() => L), B = I ? i ?? "" : ce, [V, H] = m(() => $o(i === void 0 ? a : i)[0]), [le, ue] = m(() => $o(i === void 0 ? a : i)[1]), U = p(V), de = p(le), W = o((e) => {
|
|
8301
8309
|
U.current = e, H(e);
|
|
8302
8310
|
}, []), G = o((e) => {
|
|
8303
8311
|
de.current = e, ue(e);
|
|
@@ -8305,7 +8313,7 @@ function ns(e, t) {
|
|
|
8305
8313
|
c(() => {
|
|
8306
8314
|
if (!I || i === me.current) return;
|
|
8307
8315
|
me.current = i;
|
|
8308
|
-
let [e, t] =
|
|
8316
|
+
let [e, t] = $o(i);
|
|
8309
8317
|
W(e), G(t);
|
|
8310
8318
|
}, [
|
|
8311
8319
|
i,
|
|
@@ -8313,13 +8321,13 @@ function ns(e, t) {
|
|
|
8313
8321
|
W,
|
|
8314
8322
|
G
|
|
8315
8323
|
]), c(() => {
|
|
8316
|
-
h != null && !
|
|
8324
|
+
h != null && !ns(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).`);
|
|
8317
8325
|
}, [h]);
|
|
8318
|
-
let J = p(null), Y = p(null), he = p(null), X = p(null), Z = p(null), Q = p(null), _e = p(0), ve = p(-1), ye = p(0), be = p(-1), [xe, Se] = m(!1), Ce = f(() => Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value")?.set, []), we = f(() =>
|
|
8326
|
+
let J = p(null), Y = p(null), he = p(null), X = p(null), Z = p(null), Q = p(null), _e = p(0), ve = p(-1), ye = p(0), be = p(-1), [xe, Se] = m(!1), Ce = f(() => Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value")?.set, []), we = f(() => qo(h), [h]), Te = f(() => Jo(s, l), [s, l]), Ee = f(() => Yo(h), [h]), De = `${n}-hours`, Oe = `${n}-minutes`, ke = `${n}-popup`, $ = `${n}-input`;
|
|
8319
8327
|
c(() => {
|
|
8320
8328
|
let e = J.current;
|
|
8321
8329
|
if (!e) return;
|
|
8322
|
-
let t =
|
|
8330
|
+
let t = ts(B, {
|
|
8323
8331
|
required: x,
|
|
8324
8332
|
min: s,
|
|
8325
8333
|
max: l,
|
|
@@ -8346,20 +8354,20 @@ function ns(e, t) {
|
|
|
8346
8354
|
]), je = o(() => {
|
|
8347
8355
|
let e = U.current, t = de.current;
|
|
8348
8356
|
if (e !== "" && t !== "") {
|
|
8349
|
-
let n =
|
|
8357
|
+
let n = es(e, t);
|
|
8350
8358
|
n !== B && Ae(n);
|
|
8351
8359
|
} else B !== "" && Ae("");
|
|
8352
8360
|
}, [B, Ae]), Me = o(() => {
|
|
8353
8361
|
let e = U.current, t = de.current;
|
|
8354
8362
|
if (e !== "" && t !== "") {
|
|
8355
|
-
let n =
|
|
8363
|
+
let n = es(e, t);
|
|
8356
8364
|
n === B ? Q.current?.dispatchEvent(new Event("input", { bubbles: !0 })) : Ae(n);
|
|
8357
8365
|
} else B === "" ? Q.current?.dispatchEvent(new Event("input", { bubbles: !0 })) : Ae("");
|
|
8358
8366
|
}, [B, Ae]), Ne = o(() => {
|
|
8359
8367
|
Se(!0), je();
|
|
8360
8368
|
let e = J.current, t = Q.current;
|
|
8361
8369
|
if (!e) return;
|
|
8362
|
-
let n =
|
|
8370
|
+
let n = ts(t?.value ?? "", {
|
|
8363
8371
|
required: x,
|
|
8364
8372
|
min: s,
|
|
8365
8373
|
max: l,
|
|
@@ -8433,7 +8441,7 @@ function ns(e, t) {
|
|
|
8433
8441
|
W,
|
|
8434
8442
|
G
|
|
8435
8443
|
]), Le = o((e) => {
|
|
8436
|
-
let t =
|
|
8444
|
+
let t = Xo(U.current, de.current, e, we);
|
|
8437
8445
|
W(t.hours), G(t.minutes), `${t.hours}:${t.minutes}` !== B && Ae(`${t.hours}:${t.minutes}`);
|
|
8438
8446
|
}, [
|
|
8439
8447
|
we,
|
|
@@ -8651,7 +8659,7 @@ function ns(e, t) {
|
|
|
8651
8659
|
set value(e) {
|
|
8652
8660
|
let t = e ?? "";
|
|
8653
8661
|
I || z(t);
|
|
8654
|
-
let [n, r] =
|
|
8662
|
+
let [n, r] = $o(t);
|
|
8655
8663
|
W(n), G(r), Q.current && (Q.current.value = t);
|
|
8656
8664
|
},
|
|
8657
8665
|
focus() {
|
|
@@ -8669,7 +8677,7 @@ function ns(e, t) {
|
|
|
8669
8677
|
if (!e) return;
|
|
8670
8678
|
let t = () => {
|
|
8671
8679
|
window.setTimeout(() => {
|
|
8672
|
-
let e = R.current, [t, n] =
|
|
8680
|
+
let e = R.current, [t, n] = $o(e);
|
|
8673
8681
|
W(t), G(n), I || z(e), Q.current && (Q.current.value = e), fe(!1), Se(!1);
|
|
8674
8682
|
}, 0);
|
|
8675
8683
|
};
|
|
@@ -8745,8 +8753,8 @@ function ns(e, t) {
|
|
|
8745
8753
|
}
|
|
8746
8754
|
//#endregion
|
|
8747
8755
|
//#region src/components/timepicker/Timepicker.tsx
|
|
8748
|
-
var
|
|
8749
|
-
let { onChange: n, inputSize: r = "medium" } = e, i =
|
|
8756
|
+
var is = i((e, t) => {
|
|
8757
|
+
let { onChange: n, inputSize: r = "medium" } = e, i = rs(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 = (e, t) => {
|
|
8750
8758
|
let n = String(e).padStart(2, "0"), r = e === (t === "hour" ? i.hours === "" ? NaN : parseInt(i.hours, 10) : i.minutes === "" ? NaN : parseInt(i.minutes, 10));
|
|
8751
8759
|
return /* @__PURE__ */ _("button", {
|
|
8752
8760
|
type: "button",
|
|
@@ -8924,7 +8932,7 @@ var rs = i((e, t) => {
|
|
|
8924
8932
|
id: i.id || void 0,
|
|
8925
8933
|
onFocus: i.handleFocusIn,
|
|
8926
8934
|
onBlur: i.handleFocusOut,
|
|
8927
|
-
children: /* @__PURE__ */ _(
|
|
8935
|
+
children: /* @__PURE__ */ _($n, {
|
|
8928
8936
|
strings: i.stringsOverride,
|
|
8929
8937
|
forId: i.hoursId,
|
|
8930
8938
|
label: i.label,
|
|
@@ -8951,6 +8959,6 @@ var rs = i((e, t) => {
|
|
|
8951
8959
|
})
|
|
8952
8960
|
});
|
|
8953
8961
|
});
|
|
8954
|
-
|
|
8962
|
+
is.displayName = "PktTimepicker";
|
|
8955
8963
|
//#endregion
|
|
8956
|
-
export {
|
|
8964
|
+
export { gi as FileItem, va as ItemRenderers, j as PktAccordion, R as PktAccordionItem, _e as PktAlert, ve as PktBackLink, ye as PktBreadcrumbs, X as PktButton, Ln as PktCalendar, Hn as PktCard, Un as PktCheckbox, wr as PktCombobox, kr as PktConsent, Wr as PktDatepicker, ya as PktFileUpload, qa as PktFooter, Ya as PktFooterSimple, wo as PktHeader, bo as PktHeaderGlobal, $a as PktHeaderMenu, Co as PktHeaderService, Bn as PktHeading, Qn as PktHelptext, L as PktIcon, To as PktInput, $n as PktInputWrapper, co as PktLink, Eo as PktLinkCard, Oo as PktLoader, ko as PktMessagebox, Yi as PktModal, Ri as PktProgressbar, Ao as PktRadioButton, mo as PktSearchInput, jo as PktSelect, Fo as PktStep, Io as PktStepper, Q as PktStringsProvider, Uo as PktTabItem, Lo as PktTable, Ro as PktTableBody, zo as PktTableDataCell, Bo as PktTableHeader, Vo as PktTableHeaderCell, Ho as PktTableRow, Ko as PktTabs, Vn as PktTag, xi as PktTextarea, xo as PktTextinput, is as PktTimepicker, W as getPktStrings, ce as pktStringsNb, G as resetPktStrings, de as setPktStrings, K as subscribePktStrings };
|