@oslokommune/punkt-react 19.3.1 → 19.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -0
- package/dist/components/consent/Consent.d.ts +6 -38
- package/dist/punkt-react.cjs +1 -1
- package/dist/punkt-react.js +552 -548
- package/dist/shared-types/consent.d.ts +69 -0
- package/dist/shared-types/index.d.ts +2 -0
- package/package.json +2 -2
- package/src/components/consent/Consent.test.tsx +6 -0
- package/src/components/consent/Consent.tsx +26 -54
package/dist/punkt-react.js
CHANGED
|
@@ -2834,7 +2834,11 @@ var Bn = "https://cdn.web.oslo.kommune.no/header-footer/header-footer.json", Vn
|
|
|
2834
2834
|
labelPosition: "right",
|
|
2835
2835
|
requiredTag: !1,
|
|
2836
2836
|
optionalTag: !1
|
|
2837
|
-
}, Wn =
|
|
2837
|
+
}, Wn = {
|
|
2838
|
+
devMode: !1,
|
|
2839
|
+
i18nLanguage: "nb",
|
|
2840
|
+
triggerType: "button"
|
|
2841
|
+
}, Gn = (e) => {
|
|
2838
2842
|
switch (e) {
|
|
2839
2843
|
case 1: return "xlarge";
|
|
2840
2844
|
case 2: return "large";
|
|
@@ -2844,7 +2848,7 @@ var Bn = "https://cdn.web.oslo.kommune.no/header-footer/header-footer.json", Vn
|
|
|
2844
2848
|
case 6: return "xsmall";
|
|
2845
2849
|
default: return "medium";
|
|
2846
2850
|
}
|
|
2847
|
-
},
|
|
2851
|
+
}, Kn = (e) => {
|
|
2848
2852
|
switch (e) {
|
|
2849
2853
|
case 1:
|
|
2850
2854
|
case 2: return "regular";
|
|
@@ -2854,8 +2858,8 @@ var Bn = "https://cdn.web.oslo.kommune.no/header-footer/header-footer.json", Vn
|
|
|
2854
2858
|
case 6: return "medium";
|
|
2855
2859
|
default: return "medium";
|
|
2856
2860
|
}
|
|
2857
|
-
},
|
|
2858
|
-
let l = t ??
|
|
2861
|
+
}, qn = i(function({ level: e = 2, size: t, weight: n, visuallyHidden: r, align: i, className: a, children: o, ...s }, c) {
|
|
2862
|
+
let l = t ?? Gn(e), u = n ?? Kn(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}`;
|
|
2859
2863
|
return /* @__PURE__ */ _(f, {
|
|
2860
2864
|
...s,
|
|
2861
2865
|
ref: c,
|
|
@@ -2863,10 +2867,10 @@ var Bn = "https://cdn.web.oslo.kommune.no/header-footer/header-footer.json", Vn
|
|
|
2863
2867
|
children: o
|
|
2864
2868
|
});
|
|
2865
2869
|
});
|
|
2866
|
-
|
|
2870
|
+
qn.displayName = "PktHeading";
|
|
2867
2871
|
//#endregion
|
|
2868
2872
|
//#region src/components/tag/Tag.tsx
|
|
2869
|
-
var
|
|
2873
|
+
var Jn = 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) => {
|
|
2870
2874
|
let [x, S] = m(!1), C = o(() => {
|
|
2871
2875
|
S(!0), u && u();
|
|
2872
2876
|
}, [u]), w = p(null), [T, E] = m("");
|
|
@@ -2930,10 +2934,10 @@ var qn = i(({ children: e, skin: t = "blue", textStyle: n, size: r = "medium", c
|
|
|
2930
2934
|
})]
|
|
2931
2935
|
});
|
|
2932
2936
|
});
|
|
2933
|
-
|
|
2937
|
+
Jn.displayName = "PktTag";
|
|
2934
2938
|
//#endregion
|
|
2935
2939
|
//#region src/components/card/Card.tsx
|
|
2936
|
-
var
|
|
2940
|
+
var Yn = i(({ children: e, className: t, ariaLabel: n, metaLead: r, borderOnHover: i = Hn.borderOnHover, metaTrail: a, layout: o = Hn.layout, heading: s = "", headingLevel: c = Hn.headingLevel, image: l, imageShape: u = Hn.imageShape, imageAspect: d, restrictImageHeight: f = Hn.restrictImageHeight, clickCardLink: p, padding: m = Hn.padding, openLinkInNewTab: h = Hn.openLinkInNewTab, skin: g = Hn.skin, subheading: y = "", tagPosition: b = Hn.tagPosition, zoom: x = Hn.zoom, tags: S = [], strings: C, ...w }, T) => {
|
|
2937
2941
|
let E = ve(["card"], C), D = (0, M.default)({
|
|
2938
2942
|
"pkt-card": !0,
|
|
2939
2943
|
[`pkt-card--${g}`]: g,
|
|
@@ -2951,7 +2955,7 @@ var Jn = i(({ children: e, className: t, ariaLabel: n, metaLead: r, borderOnHove
|
|
|
2951
2955
|
className: (0, M.default)("pkt-card__tags", `pkt-card__tags-${b}`),
|
|
2952
2956
|
role: "list",
|
|
2953
2957
|
"aria-label": le(S.length, E.card.tagsLabelOne, E.card.tagsLabelOther),
|
|
2954
|
-
children: be(S, (e) => e.text).map(({ item: e, key: t }) => /* @__PURE__ */ _(
|
|
2958
|
+
children: be(S, (e) => e.text).map(({ item: e, key: t }) => /* @__PURE__ */ _(Jn, {
|
|
2955
2959
|
role: "listitem",
|
|
2956
2960
|
textStyle: "normal-text",
|
|
2957
2961
|
size: "medium",
|
|
@@ -2959,13 +2963,13 @@ var Jn = i(({ children: e, className: t, ariaLabel: n, metaLead: r, borderOnHove
|
|
|
2959
2963
|
iconName: e.iconName,
|
|
2960
2964
|
children: /* @__PURE__ */ _("span", { children: e.text })
|
|
2961
2965
|
}, t))
|
|
2962
|
-
}), N = () => !s || p ? null : /* @__PURE__ */ _(
|
|
2966
|
+
}), N = () => !s || p ? null : /* @__PURE__ */ _(qn, {
|
|
2963
2967
|
className: "pkt-card__heading",
|
|
2964
2968
|
level: c,
|
|
2965
2969
|
size: "medium",
|
|
2966
2970
|
weight: "regular",
|
|
2967
2971
|
children: s
|
|
2968
|
-
}), P = () => p ? /* @__PURE__ */ _(
|
|
2972
|
+
}), P = () => p ? /* @__PURE__ */ _(qn, {
|
|
2969
2973
|
className: "pkt-card__link-heading pkt-card__heading",
|
|
2970
2974
|
level: c,
|
|
2971
2975
|
size: "medium",
|
|
@@ -3017,23 +3021,23 @@ var Jn = i(({ children: e, className: t, ariaLabel: n, metaLead: r, borderOnHove
|
|
|
3017
3021
|
})]
|
|
3018
3022
|
});
|
|
3019
3023
|
});
|
|
3020
|
-
|
|
3024
|
+
Yn.displayName = "PktCard";
|
|
3021
3025
|
//#endregion
|
|
3022
3026
|
//#region ../../shared-utils/utils.ts
|
|
3023
|
-
var
|
|
3024
|
-
let e =
|
|
3027
|
+
var Xn = () => ("00000000000000000" + (Math.random() * 0x10000000000000000).toString(16)).slice(-16), Zn = () => {
|
|
3028
|
+
let e = Xn(), t = Xn();
|
|
3025
3029
|
return e.slice(0, 8) + "-" + e.slice(8, 12) + "-4" + e.slice(13) + "-a" + t.slice(1, 4) + "-" + t.slice(4);
|
|
3026
3030
|
};
|
|
3027
3031
|
//#endregion
|
|
3028
3032
|
//#region src/hooks/useGeneratedId.ts
|
|
3029
|
-
function
|
|
3030
|
-
let t = f(() =>
|
|
3033
|
+
function Qn(e) {
|
|
3034
|
+
let t = f(() => Zn(), []);
|
|
3031
3035
|
return e || t;
|
|
3032
3036
|
}
|
|
3033
3037
|
//#endregion
|
|
3034
3038
|
//#region src/components/checkbox/Checkbox.tsx
|
|
3035
|
-
var
|
|
3036
|
-
let D = ve(["forms"], S), O =
|
|
3039
|
+
var $n = i(({ id: e, hasTile: t = Un.hasTile, disabled: n = Un.disabled, label: r, checkHelptext: i, hasError: a = Un.hasError, className: o, isSwitch: s = Un.isSwitch, hideLabel: l = Un.hideLabel, labelPosition: u = Un.labelPosition, defaultChecked: d, checked: f, indeterminate: m, optionalTag: h, optionalText: y, requiredTag: b, requiredText: x, strings: S, tagText: C, "aria-describedby": w, ...T }, E) => {
|
|
3040
|
+
let D = ve(["forms"], S), O = Qn(e), k = p(null);
|
|
3037
3041
|
c(() => {
|
|
3038
3042
|
k.current && m !== void 0 && (k.current.indeterminate = m);
|
|
3039
3043
|
}, [m]), c(() => {
|
|
@@ -3105,10 +3109,10 @@ var Qn = i(({ id: e, hasTile: t = Un.hasTile, disabled: n = Un.disabled, label:
|
|
|
3105
3109
|
})
|
|
3106
3110
|
});
|
|
3107
3111
|
});
|
|
3108
|
-
|
|
3112
|
+
$n.displayName = "PktCheckbox";
|
|
3109
3113
|
//#endregion
|
|
3110
3114
|
//#region src/hooks/useFocusModality.ts
|
|
3111
|
-
function
|
|
3115
|
+
function er(e) {
|
|
3112
3116
|
let t = p(null), n = p(!1), r = p(void 0), i = (e) => {
|
|
3113
3117
|
let n = t.current;
|
|
3114
3118
|
n && (e === void 0 ? delete n.dataset.navtype : n.dataset.navtype = e);
|
|
@@ -3134,11 +3138,11 @@ function $n(e) {
|
|
|
3134
3138
|
}
|
|
3135
3139
|
//#endregion
|
|
3136
3140
|
//#region ../../shared-utils/forms/described-by.ts
|
|
3137
|
-
var
|
|
3141
|
+
var tr = (e) => {
|
|
3138
3142
|
let t = [];
|
|
3139
3143
|
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;
|
|
3140
|
-
},
|
|
3141
|
-
let [l, u] = m(!1), d = f(() =>
|
|
3144
|
+
}, nr = (e) => `${e}-counter-status`, rr = (e, t) => !!t && t > 0 && (e ?? 0) > t, ir = "Les mer <span class='pkt-sr-only'>om feltet</span>", ar = (e) => e == null || e === "" ? null : typeof e == "string" ? /* @__PURE__ */ _("span", { dangerouslySetInnerHTML: { __html: e } }) : e, or = i(function({ helptext: e, helptextDropdown: t, helptextDropdownButton: n, forId: r, onToggleHelpText: i, className: a, children: o, ...s }, c) {
|
|
3145
|
+
let [l, u] = m(!1), d = f(() => Zn(), []), p = r || d, h = () => {
|
|
3142
3146
|
let e = !l;
|
|
3143
3147
|
u(e), i?.(e);
|
|
3144
3148
|
}, g = (0, M.default)("pkt-inputwrapper__helptext-container", !!(e || t || o) && "pkt-inputwrapper__has-helptext", a);
|
|
@@ -3152,7 +3156,7 @@ var er = (e) => {
|
|
|
3152
3156
|
children: [o && /* @__PURE__ */ _("div", {
|
|
3153
3157
|
className: "pkt-contents",
|
|
3154
3158
|
children: o
|
|
3155
|
-
}),
|
|
3159
|
+
}), ar(e)]
|
|
3156
3160
|
}), t && /* @__PURE__ */ v("div", {
|
|
3157
3161
|
className: "pkt-inputwrapper__helptext-expandable",
|
|
3158
3162
|
children: [/* @__PURE__ */ v("button", {
|
|
@@ -3166,21 +3170,21 @@ var er = (e) => {
|
|
|
3166
3170
|
name: l ? "chevron-thin-up" : "chevron-thin-down"
|
|
3167
3171
|
}), /* @__PURE__ */ _("span", {
|
|
3168
3172
|
className: "pkt-btn__text",
|
|
3169
|
-
dangerouslySetInnerHTML: { __html: n ??
|
|
3173
|
+
dangerouslySetInnerHTML: { __html: n ?? ir }
|
|
3170
3174
|
})]
|
|
3171
3175
|
}), /* @__PURE__ */ _("div", {
|
|
3172
3176
|
id: `${p}-helptext-expandable`,
|
|
3173
3177
|
className: (0, M.default)("pkt-inputwrapper__helptext", l ? "pkt-inputwrapper__helptext-expandable-open" : "pkt-inputwrapper__helptext-expandable-closed"),
|
|
3174
|
-
children:
|
|
3178
|
+
children: ar(t)
|
|
3175
3179
|
})]
|
|
3176
3180
|
})]
|
|
3177
3181
|
});
|
|
3178
3182
|
});
|
|
3179
|
-
|
|
3183
|
+
or.displayName = "PktHelptext";
|
|
3180
3184
|
//#endregion
|
|
3181
3185
|
//#region src/components/inputwrapper/InputWrapper.tsx
|
|
3182
|
-
var
|
|
3183
|
-
let j =
|
|
3186
|
+
var sr = 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) => {
|
|
3187
|
+
let j = er(A), M = ve(["forms", "validation"], k), N = f(() => Zn(), []), P = e || N, ee = x || (n ? `${P}-helptext` : void 0), te = !!a, ne = te && D === "top", F = te && D === "bottom", re = [
|
|
3184
3188
|
"pkt-inputwrapper",
|
|
3185
3189
|
w,
|
|
3186
3190
|
m ? "pkt-inputwrapper--error" : "",
|
|
@@ -3191,13 +3195,13 @@ var or = i(({ forId: e, label: t, helptext: n, helptextDropdown: r, helptextDrop
|
|
|
3191
3195
|
"pkt-tag",
|
|
3192
3196
|
"pkt-tag--small",
|
|
3193
3197
|
"pkt-tag--thin-text"
|
|
3194
|
-
].join(" "), ae =
|
|
3198
|
+
].join(" "), ae = rr(o, s), oe = te ? /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ v("div", {
|
|
3195
3199
|
className: "pkt-input__counter",
|
|
3196
3200
|
"aria-hidden": "true",
|
|
3197
3201
|
children: [o, s ? `/${s}` : ""]
|
|
3198
3202
|
}), /* @__PURE__ */ _("div", {
|
|
3199
3203
|
className: "pkt-sr-only",
|
|
3200
|
-
id:
|
|
3204
|
+
id: nr(P),
|
|
3201
3205
|
"aria-live": "polite",
|
|
3202
3206
|
children: ae ? B(M.validation.counterExceeded, {
|
|
3203
3207
|
current: o,
|
|
@@ -3239,7 +3243,7 @@ var or = i(({ forId: e, label: t, helptext: n, helptextDropdown: r, helptextDrop
|
|
|
3239
3243
|
});
|
|
3240
3244
|
}, L = () => {
|
|
3241
3245
|
let e = S ? n : void 0;
|
|
3242
|
-
return !e && !r ? null : /* @__PURE__ */ _(
|
|
3246
|
+
return !e && !r ? null : /* @__PURE__ */ _(or, {
|
|
3243
3247
|
forId: P,
|
|
3244
3248
|
helptext: e,
|
|
3245
3249
|
helptextDropdown: r,
|
|
@@ -3278,35 +3282,35 @@ var or = i(({ forId: e, label: t, helptext: n, helptextDropdown: r, helptextDrop
|
|
|
3278
3282
|
})
|
|
3279
3283
|
});
|
|
3280
3284
|
});
|
|
3281
|
-
|
|
3285
|
+
sr.displayName = "PktInputWrapper";
|
|
3282
3286
|
//#endregion
|
|
3283
3287
|
//#region ../../shared-utils/combobox/option-utils.ts
|
|
3284
|
-
var
|
|
3288
|
+
var cr = (e, t) => t && (e.find((e) => e.value === t) || e.find((e) => e.label === t)) || null, lr = (e, t) => {
|
|
3285
3289
|
if (!t) return -1;
|
|
3286
3290
|
let n = e.findIndex((e) => e.value === t);
|
|
3287
3291
|
return n >= 0 ? n : e.findIndex((e) => e.label === t);
|
|
3288
|
-
},
|
|
3292
|
+
}, ur = (e) => e.value + (e.label || "") + (e.prefix || ""), dr = (e, t) => (e.fulltext || ur(e)).toLowerCase().includes(t), fr = (e, t) => {
|
|
3289
3293
|
if (!t) return [...e];
|
|
3290
3294
|
let n = t.toLowerCase();
|
|
3291
|
-
return e.filter((e) =>
|
|
3292
|
-
},
|
|
3295
|
+
return e.filter((e) => dr(e, n));
|
|
3296
|
+
}, pr = (e, t) => t !== null && e >= t, mr = (e, t) => {
|
|
3293
3297
|
if (!e) return "";
|
|
3294
3298
|
switch (t) {
|
|
3295
3299
|
case "prefixAndValue": return `${e.prefix || ""} ${e.value}`.trim();
|
|
3296
3300
|
case "value": return e.value;
|
|
3297
3301
|
default: return e.label || e.value;
|
|
3298
3302
|
}
|
|
3299
|
-
},
|
|
3303
|
+
}, hr = (e, t) => e ? Array.isArray(e) ? t ? e : e.length > 0 ? [e[0]] : [] : t ? e.split(",").filter(Boolean) : [e] : [], gr = (e, t) => {
|
|
3300
3304
|
if (!t) return {
|
|
3301
3305
|
filtered: [...e],
|
|
3302
3306
|
suggestion: null
|
|
3303
3307
|
};
|
|
3304
|
-
let n = t.toLowerCase(), r = e.filter((e) =>
|
|
3308
|
+
let n = t.toLowerCase(), r = e.filter((e) => dr(e, n));
|
|
3305
3309
|
return {
|
|
3306
3310
|
filtered: r,
|
|
3307
3311
|
suggestion: r.find((e) => !e.selected && e.label?.toLowerCase().startsWith(n)) || null
|
|
3308
3312
|
};
|
|
3309
|
-
},
|
|
3313
|
+
}, _r = (e, t, n, r) => {
|
|
3310
3314
|
if (!e.trim()) return {
|
|
3311
3315
|
addValueText: null,
|
|
3312
3316
|
userInfoMessage: ""
|
|
@@ -3325,7 +3329,7 @@ var sr = (e, t) => t && (e.find((e) => e.value === t) || e.find((e) => e.label =
|
|
|
3325
3329
|
addValueText: null,
|
|
3326
3330
|
userInfoMessage: ""
|
|
3327
3331
|
};
|
|
3328
|
-
},
|
|
3332
|
+
}, vr = (e, t, n) => {
|
|
3329
3333
|
switch (e) {
|
|
3330
3334
|
case ",": return n ? "addValue" : null;
|
|
3331
3335
|
case "Enter": return "addValue";
|
|
@@ -3334,12 +3338,12 @@ var sr = (e, t) => t && (e.find((e) => e.value === t) || e.find((e) => e.label =
|
|
|
3334
3338
|
case "Escape": return "closeOptions";
|
|
3335
3339
|
default: return null;
|
|
3336
3340
|
}
|
|
3337
|
-
},
|
|
3341
|
+
}, yr = (e, t, n, r, i) => {
|
|
3338
3342
|
if (!e) return {
|
|
3339
3343
|
action: "none",
|
|
3340
3344
|
value: null
|
|
3341
3345
|
};
|
|
3342
|
-
let a =
|
|
3346
|
+
let a = cr(n, e);
|
|
3343
3347
|
return !t.includes(e) && !a ? r ? {
|
|
3344
3348
|
action: "addUserValue",
|
|
3345
3349
|
value: e
|
|
@@ -3356,36 +3360,36 @@ var sr = (e, t) => t && (e.find((e) => e.value === t) || e.find((e) => e.label =
|
|
|
3356
3360
|
action: "none",
|
|
3357
3361
|
value: null
|
|
3358
3362
|
};
|
|
3359
|
-
},
|
|
3360
|
-
let r =
|
|
3363
|
+
}, br = (e, t, n) => {
|
|
3364
|
+
let r = cr(t, e);
|
|
3361
3365
|
return n === "label" && r?.label ? r.label : e;
|
|
3362
|
-
},
|
|
3366
|
+
}, xr = (e) => {
|
|
3363
3367
|
e.scrollIntoView({ block: "nearest" }), window.setTimeout(() => e.focus(), 0);
|
|
3364
|
-
},
|
|
3368
|
+
}, Sr = (e) => Array.from(e.querySelectorAll("[role=\"option\"]:not([data-disabled])") || []), Cr = (e) => {
|
|
3365
3369
|
let t = e.nextElementSibling;
|
|
3366
|
-
t &&
|
|
3367
|
-
},
|
|
3370
|
+
t && xr(t);
|
|
3371
|
+
}, wr = (e, t, n) => {
|
|
3368
3372
|
let r = e.previousElementSibling;
|
|
3369
3373
|
if (e.dataset.index === "0" && n) {
|
|
3370
3374
|
let e = t.querySelector("[role=\"searchbox\"]");
|
|
3371
|
-
e &&
|
|
3372
|
-
} else r &&
|
|
3373
|
-
},
|
|
3374
|
-
let t =
|
|
3375
|
-
t[0] &&
|
|
3376
|
-
},
|
|
3375
|
+
e && xr(e);
|
|
3376
|
+
} else r && xr(r);
|
|
3377
|
+
}, Tr = (e) => {
|
|
3378
|
+
let t = Sr(e);
|
|
3379
|
+
t[0] && xr(t[0]);
|
|
3380
|
+
}, Er = (e, t) => {
|
|
3377
3381
|
if (t.disabled) return;
|
|
3378
|
-
let n =
|
|
3382
|
+
let n = Sr(e);
|
|
3379
3383
|
if (t.allowUserInput && t.customUserInput) {
|
|
3380
3384
|
let t = e.querySelector("[data-type=\"new-option\"]");
|
|
3381
3385
|
if (t) {
|
|
3382
|
-
|
|
3386
|
+
xr(t);
|
|
3383
3387
|
return;
|
|
3384
3388
|
}
|
|
3385
3389
|
}
|
|
3386
3390
|
let r = n.find((e) => e.dataset.selected === "true");
|
|
3387
3391
|
if (r) {
|
|
3388
|
-
|
|
3392
|
+
xr(r);
|
|
3389
3393
|
return;
|
|
3390
3394
|
}
|
|
3391
3395
|
if (t.includeSearch && !(document.activeElement instanceof HTMLInputElement)) {
|
|
@@ -3395,8 +3399,8 @@ var sr = (e, t) => t && (e.find((e) => e.value === t) || e.find((e) => e.label =
|
|
|
3395
3399
|
return;
|
|
3396
3400
|
}
|
|
3397
3401
|
}
|
|
3398
|
-
n[0] &&
|
|
3399
|
-
},
|
|
3402
|
+
n[0] && xr(n[0]);
|
|
3403
|
+
}, Dr = ({ state: e, outside: t = !1 }) => {
|
|
3400
3404
|
let { values: n, options: r, disabled: i, displayValueAs: a, handleTagRemove: o, handleTagKeydown: s, focusedTagIndex: l } = e, u = p([]);
|
|
3401
3405
|
if (c(() => {
|
|
3402
3406
|
!t && l >= 0 && l < n.length && u.current[l]?.focus();
|
|
@@ -3406,10 +3410,10 @@ var sr = (e, t) => t && (e.find((e) => e.value === t) || e.find((e) => e.label =
|
|
|
3406
3410
|
n.length
|
|
3407
3411
|
]), n.length === 0) return null;
|
|
3408
3412
|
let d = n.map((e, n) => {
|
|
3409
|
-
let c =
|
|
3413
|
+
let c = cr(r, e), d = c?.tagSkinColor, f = c ? mr(c, a) : e;
|
|
3410
3414
|
return i ? /* @__PURE__ */ _("li", {
|
|
3411
3415
|
role: "listitem",
|
|
3412
|
-
children: /* @__PURE__ */ _(
|
|
3416
|
+
children: /* @__PURE__ */ _(Jn, {
|
|
3413
3417
|
skin: d || "blue-dark",
|
|
3414
3418
|
children: /* @__PURE__ */ _("span", {
|
|
3415
3419
|
className: "pkt-combobox__value",
|
|
@@ -3418,7 +3422,7 @@ var sr = (e, t) => t && (e.find((e) => e.value === t) || e.find((e) => e.label =
|
|
|
3418
3422
|
})
|
|
3419
3423
|
}, e) : t ? /* @__PURE__ */ _("li", {
|
|
3420
3424
|
role: "listitem",
|
|
3421
|
-
children: /* @__PURE__ */ _(
|
|
3425
|
+
children: /* @__PURE__ */ _(Jn, {
|
|
3422
3426
|
skin: d || "blue-dark",
|
|
3423
3427
|
closeTag: !0,
|
|
3424
3428
|
onClose: () => o(e),
|
|
@@ -3431,7 +3435,7 @@ var sr = (e, t) => t && (e.find((e) => e.value === t) || e.find((e) => e.label =
|
|
|
3431
3435
|
role: "listitem",
|
|
3432
3436
|
onClick: (e) => e.stopPropagation(),
|
|
3433
3437
|
onMouseDown: (e) => e.preventDefault(),
|
|
3434
|
-
children: /* @__PURE__ */ _(
|
|
3438
|
+
children: /* @__PURE__ */ _(Jn, {
|
|
3435
3439
|
ref: (e) => {
|
|
3436
3440
|
u.current[n] = e;
|
|
3437
3441
|
},
|
|
@@ -3459,17 +3463,17 @@ var sr = (e, t) => t && (e.find((e) => e.value === t) || e.find((e) => e.label =
|
|
|
3459
3463
|
className: "pkt-combobox__tag-list",
|
|
3460
3464
|
children: d
|
|
3461
3465
|
});
|
|
3462
|
-
},
|
|
3466
|
+
}, Or = ({ state: e }) => {
|
|
3463
3467
|
let { values: t, options: n, editingSingleValue: r, displayValueAs: i } = e;
|
|
3464
3468
|
if (r || t.length === 0) return null;
|
|
3465
|
-
let a =
|
|
3469
|
+
let a = cr(n, t[0]);
|
|
3466
3470
|
if (!a) return null;
|
|
3467
|
-
let o =
|
|
3471
|
+
let o = mr(a, i);
|
|
3468
3472
|
return /* @__PURE__ */ _("span", {
|
|
3469
3473
|
className: "pkt-combobox__value",
|
|
3470
3474
|
children: o
|
|
3471
3475
|
});
|
|
3472
|
-
},
|
|
3476
|
+
}, kr = ({ state: e }) => {
|
|
3473
3477
|
let { id: t, inputId: n, listboxId: r, values: i, options: a, isOpen: o, multiple: s, typeahead: c, allowUserInput: l, tagPlacement: u, placeholder: d, disabled: f, fullwidth: p, hasError: m, label: h, inputFocus: g, skipInputTab: y, restoreInputTab: b, inputRef: x, triggerRef: S, handleInputChange: C, handleInputKeydown: w, handleInputFocus: T, handleInputBlur: E, handleInputClick: D, handlePlaceholderClick: O, handleSelectOnlyKeydown: k, name: A, inputSize: j } = e, M = [
|
|
3474
3478
|
"pkt-combobox__input",
|
|
3475
3479
|
`pkt-combobox__input--${j}`,
|
|
@@ -3477,7 +3481,7 @@ var sr = (e, t) => t && (e.find((e) => e.value === t) || e.find((e) => e.label =
|
|
|
3477
3481
|
o && "pkt-combobox__input--open",
|
|
3478
3482
|
m && "pkt-combobox__input--error",
|
|
3479
3483
|
f && "pkt-combobox__input--disabled"
|
|
3480
|
-
].filter(Boolean).join(" "), N = ["pkt-combobox__arrow-icon", o && "pkt-combobox__arrow-icon--open"].filter(Boolean).join(" "), P = c || l, ee = !P && d && (!i.length || s && u === "outside") && !g, te = u !== "outside", ne = o && i[0] &&
|
|
3484
|
+
].filter(Boolean).join(" "), N = ["pkt-combobox__arrow-icon", o && "pkt-combobox__arrow-icon--open"].filter(Boolean).join(" "), P = c || l, ee = !P && d && (!i.length || s && u === "outside") && !g, te = u !== "outside", ne = o && i[0] && cr(a, i[0]) ? `${r}-${lr(a, i[0])}` : void 0, F = s && i.length > 0 ? `${i.length} valgt` : void 0, re = tr({
|
|
3481
3485
|
id: P ? n : `${t}-combobox`,
|
|
3482
3486
|
hasHelptext: !!e.helptext,
|
|
3483
3487
|
ariaDescribedby: e.ariaDescribedby
|
|
@@ -3507,7 +3511,7 @@ var sr = (e, t) => t && (e.find((e) => e.value === t) || e.find((e) => e.label =
|
|
|
3507
3511
|
className: "pkt-combobox__placeholder",
|
|
3508
3512
|
onClick: O,
|
|
3509
3513
|
children: d
|
|
3510
|
-
}) : te ? s ? /* @__PURE__ */ _(
|
|
3514
|
+
}) : te ? s ? /* @__PURE__ */ _(Dr, { state: e }) : P ? null : /* @__PURE__ */ _(Or, { state: e }) : null,
|
|
3511
3515
|
P ? /* @__PURE__ */ _("div", {
|
|
3512
3516
|
className: "pkt-combobox__input-div combobox__input",
|
|
3513
3517
|
children: /* @__PURE__ */ _("input", {
|
|
@@ -3546,7 +3550,7 @@ var sr = (e, t) => t && (e.find((e) => e.value === t) || e.find((e) => e.label =
|
|
|
3546
3550
|
})
|
|
3547
3551
|
]
|
|
3548
3552
|
});
|
|
3549
|
-
},
|
|
3553
|
+
}, Ar = ({ state: e }) => {
|
|
3550
3554
|
let t = ve(["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 = [
|
|
3551
3555
|
"pkt-listbox",
|
|
3552
3556
|
i && "pkt-listbox__open",
|
|
@@ -3672,29 +3676,29 @@ var sr = (e, t) => t && (e.find((e) => e.value === t) || e.find((e) => e.label =
|
|
|
3672
3676
|
className: "pkt-visually-hidden",
|
|
3673
3677
|
children: m
|
|
3674
3678
|
})] });
|
|
3675
|
-
},
|
|
3679
|
+
}, jr = (e, t) => {
|
|
3676
3680
|
if (!e) return null;
|
|
3677
3681
|
if (t === void 0) return e.closest("form");
|
|
3678
3682
|
let n = t ? e.ownerDocument.getElementById(t) : null;
|
|
3679
3683
|
return n instanceof HTMLFormElement ? n : null;
|
|
3680
|
-
},
|
|
3684
|
+
}, Mr = (e, t) => {
|
|
3681
3685
|
let [n, r] = m(null);
|
|
3682
3686
|
return c(() => {
|
|
3683
|
-
r(
|
|
3687
|
+
r(jr(e.current, t));
|
|
3684
3688
|
}, [e, t]), n;
|
|
3685
3689
|
};
|
|
3686
3690
|
//#endregion
|
|
3687
3691
|
//#region src/components/combobox/useComboboxState.ts
|
|
3688
|
-
function
|
|
3692
|
+
function Nr(e, t) {
|
|
3689
3693
|
return e.map((e) => ({
|
|
3690
3694
|
...e,
|
|
3691
3695
|
label: e.label || e.value,
|
|
3692
|
-
fulltext:
|
|
3696
|
+
fulltext: ur(e),
|
|
3693
3697
|
selected: t.includes(e.value)
|
|
3694
3698
|
}));
|
|
3695
3699
|
}
|
|
3696
|
-
function
|
|
3697
|
-
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, form: se, ariaDescribedby: I, className: L, onChange: R, onValueChange: ce, children: z, strings: le } = t, ue = `${r}-input`, de = `${r}-listbox`, V = v || b, H = p(null), U = p(null), W = p(null), G = p(null), K = p(null), fe =
|
|
3700
|
+
function Pr(t, n) {
|
|
3701
|
+
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, form: se, ariaDescribedby: I, className: L, onChange: R, onValueChange: ce, children: z, strings: le } = t, ue = `${r}-input`, de = `${r}-listbox`, V = v || b, H = p(null), U = p(null), W = p(null), G = p(null), K = p(null), fe = Mr(K, se), pe = o(() => {
|
|
3698
3702
|
V ? H.current?.focus() : W.current?.focus();
|
|
3699
3703
|
}, [V]), me = o(() => {
|
|
3700
3704
|
Ie(!0);
|
|
@@ -3715,27 +3719,27 @@ function Nr(t, n) {
|
|
|
3715
3719
|
}), t;
|
|
3716
3720
|
}, [z]), J = f(() => h && h.length > 0 ? h.map((e) => ({
|
|
3717
3721
|
...e,
|
|
3718
|
-
fulltext:
|
|
3722
|
+
fulltext: ur(e)
|
|
3719
3723
|
})) : d && d.length > 0 ? d.map((e) => ({
|
|
3720
3724
|
...e,
|
|
3721
|
-
fulltext:
|
|
3725
|
+
fulltext: ur(e)
|
|
3722
3726
|
})) : q.length > 0 ? q.map((e) => ({
|
|
3723
3727
|
...e,
|
|
3724
|
-
fulltext:
|
|
3728
|
+
fulltext: ur(e)
|
|
3725
3729
|
})) : [], [
|
|
3726
3730
|
h,
|
|
3727
3731
|
d,
|
|
3728
3732
|
q
|
|
3729
3733
|
]), he = s !== void 0, [ge, Y] = m(() => {
|
|
3730
|
-
let e =
|
|
3734
|
+
let e = hr(s ?? l, g), t = J.filter((t) => t.selected && !e.includes(t.value)).map((e) => e.value);
|
|
3731
3735
|
return t.length ? g ? [...e, ...t] : e.length ? e : [t[0]] : e;
|
|
3732
3736
|
}), _e = p(ge), [X, ye] = m(s);
|
|
3733
|
-
he && s !== X && (ye(s), Y(
|
|
3734
|
-
let Z = he ?
|
|
3737
|
+
he && s !== X && (ye(s), Y(hr(s, g)));
|
|
3738
|
+
let Z = he ? hr(s, g) : ge, [be, xe] = m([]), Q = f(() => Nr([...be.filter((e) => !J.some((t) => t.value === e.value)), ...J], Z), [
|
|
3735
3739
|
J,
|
|
3736
3740
|
be,
|
|
3737
3741
|
Z
|
|
3738
|
-
]), [Se, Ce] = m(!1), [we, Te] = m(""), [Ee, De] = m(""), [Oe, ke] = m(""), [Ae, je] = m(null), [Me, Ne] = m(null), [$, Pe] = m(!1), [Fe, Ie] = m(!1), Le = p(!1), [Re, ze] = m(!1), [Be, Ve] = m(-1), He = ve(["combobox"], le), Ue = Oe ? B(He.combobox[Oe], { value: Ae ?? "" }) : "", We =
|
|
3742
|
+
]), [Se, Ce] = m(!1), [we, Te] = m(""), [Ee, De] = m(""), [Oe, ke] = m(""), [Ae, je] = m(null), [Me, Ne] = m(null), [$, Pe] = m(!1), [Fe, Ie] = m(!1), Le = p(!1), [Re, ze] = m(!1), [Be, Ve] = m(-1), He = ve(["combobox"], le), Ue = Oe ? B(He.combobox[Oe], { value: Ae ?? "" }) : "", We = pr(Z.length, _ ?? null), Ge = ie ?? (g && _ != null), Ke = f(() => we ? v ? gr(Q, we).filtered : fr(Q, we) : Q, [
|
|
3739
3743
|
Q,
|
|
3740
3744
|
we,
|
|
3741
3745
|
v
|
|
@@ -3749,7 +3753,7 @@ function Nr(t, n) {
|
|
|
3749
3753
|
U.current && (U.current.value = Ye);
|
|
3750
3754
|
}, [Ye]), c(() => {
|
|
3751
3755
|
if (Se || !H.current) return;
|
|
3752
|
-
let e = !g && Z[0] ?
|
|
3756
|
+
let e = !g && Z[0] ? br(Z[0], Q, x) : "";
|
|
3753
3757
|
H.current.value !== e && (H.current.value = e);
|
|
3754
3758
|
}, [
|
|
3755
3759
|
Z,
|
|
@@ -3766,7 +3770,7 @@ function Nr(t, n) {
|
|
|
3766
3770
|
Je
|
|
3767
3771
|
]), Ze = o((e) => {
|
|
3768
3772
|
if (!e || Z.includes(e)) return;
|
|
3769
|
-
if (g &&
|
|
3773
|
+
if (g && pr(Z.length, _ ?? null)) {
|
|
3770
3774
|
ke("maxSelected");
|
|
3771
3775
|
return;
|
|
3772
3776
|
}
|
|
@@ -3780,7 +3784,7 @@ function Nr(t, n) {
|
|
|
3780
3784
|
]), Qe = o((e) => {
|
|
3781
3785
|
if (!e) return;
|
|
3782
3786
|
let t = Z.filter((t) => t !== e);
|
|
3783
|
-
|
|
3787
|
+
cr(Q, e)?.userAdded && xe((t) => t.filter((t) => t.value !== e)), Xe(t);
|
|
3784
3788
|
}, [
|
|
3785
3789
|
Z,
|
|
3786
3790
|
Q,
|
|
@@ -3792,7 +3796,7 @@ function Nr(t, n) {
|
|
|
3792
3796
|
let t;
|
|
3793
3797
|
if (!g) t = [e];
|
|
3794
3798
|
else {
|
|
3795
|
-
if (
|
|
3799
|
+
if (cr(Q, e) || pr(Z.length, _ ?? null)) return;
|
|
3796
3800
|
t = [...Z, e];
|
|
3797
3801
|
}
|
|
3798
3802
|
let n = {
|
|
@@ -3812,7 +3816,7 @@ function Nr(t, n) {
|
|
|
3812
3816
|
if (Ne(null), e && H.current && H.current.type !== "hidden") {
|
|
3813
3817
|
Te(""), De("");
|
|
3814
3818
|
let e = t === void 0 ? Z[0] : t;
|
|
3815
|
-
!g && e ? H.current.value =
|
|
3819
|
+
!g && e ? H.current.value = br(e, Q, x) : H.current.value = "", g || (ze(!1), ke(""));
|
|
3816
3820
|
}
|
|
3817
3821
|
}, [
|
|
3818
3822
|
g,
|
|
@@ -3822,8 +3826,8 @@ function Nr(t, n) {
|
|
|
3822
3826
|
]), nt = o((e) => {
|
|
3823
3827
|
if (T) return;
|
|
3824
3828
|
ke(""), Ne(null);
|
|
3825
|
-
let t =
|
|
3826
|
-
i || (!r && b && !a ? (et(e), d = "valueAdded", l = s, o && (m = e || "")) : !r && !b ? (o && Z[0] && Qe(Z[0]), u = !1, l = !0, d = "noResults") : n ? (Qe(t), l = !0, m = "", o && V && H.current && H.current.type !== "hidden" && (H.current.value = "")) : a && o ? ($e(), l = !0, m = "") : o ? (Z[0] && Qe(Z[0]), Ze(t), l = !1, m = t || "", d = "valueSelected", f = V ?
|
|
3829
|
+
let t = cr(Q, e)?.value || null, n = Z.includes(e || t || ""), r = !!t, i = Q.find((t) => t.value === e)?.disabled || !1, a = !e?.trim(), o = !g, s = g, c = pr(Z.length, _ ?? null), l = !1, u = !0, d = "", f = null, p = "", m;
|
|
3830
|
+
i || (!r && b && !a ? (et(e), d = "valueAdded", l = s, o && (m = e || "")) : !r && !b ? (o && Z[0] && Qe(Z[0]), u = !1, l = !0, d = "noResults") : n ? (Qe(t), l = !0, m = "", o && V && H.current && H.current.type !== "hidden" && (H.current.value = "")) : a && o ? ($e(), l = !0, m = "") : o ? (Z[0] && Qe(Z[0]), Ze(t), l = !1, m = t || "", d = "valueSelected", f = V ? br(t || "", Q, x) : mr(cr(Q, t), x)) : s && !c ? (Ze(t), l = !0) : s && c ? (d = "maxSelected", u = !1, p = e || "") : (o && $e(), d = "noValidValue", u = !1, l = !0, p = e || "", m = ""), Ce(l), Te(p), tt(u, m), ke(d), je(f), l || window.setTimeout(() => {
|
|
3827
3831
|
me();
|
|
3828
3832
|
}, 0));
|
|
3829
3833
|
}, [
|
|
@@ -3847,11 +3851,11 @@ function Nr(t, n) {
|
|
|
3847
3851
|
if (!g) {
|
|
3848
3852
|
if (!e) Z[0] && Qe(Z[0]), t = void 0;
|
|
3849
3853
|
else {
|
|
3850
|
-
let n =
|
|
3854
|
+
let n = cr(Q, e);
|
|
3851
3855
|
n && n.value !== Z[0] ? (Z[0] && Qe(Z[0]), Ze(n.value), t = n.value) : !n && b && (Z[0] && Qe(Z[0]), et(e), t = e);
|
|
3852
3856
|
}
|
|
3853
3857
|
} else if (e !== "") {
|
|
3854
|
-
let { action: t, value: n } =
|
|
3858
|
+
let { action: t, value: n } = yr(e, Z, Q, b, g);
|
|
3855
3859
|
switch (t) {
|
|
3856
3860
|
case "addUserValue":
|
|
3857
3861
|
et(n);
|
|
@@ -3862,7 +3866,7 @@ function Nr(t, n) {
|
|
|
3862
3866
|
case "removeValue": Qe(n);
|
|
3863
3867
|
}
|
|
3864
3868
|
}
|
|
3865
|
-
!g && t ? H.current.value =
|
|
3869
|
+
!g && t ? H.current.value = br(t, Q, x) : H.current.value = "";
|
|
3866
3870
|
}
|
|
3867
3871
|
Ce(!1), ze(!1);
|
|
3868
3872
|
}, [
|
|
@@ -3879,7 +3883,7 @@ function Nr(t, n) {
|
|
|
3879
3883
|
Ne(null), ke(""), !g && Z[0] && Qe(Z[0]);
|
|
3880
3884
|
return;
|
|
3881
3885
|
}
|
|
3882
|
-
let t =
|
|
3886
|
+
let t = _r(e, Z, Q, b);
|
|
3883
3887
|
Ne(t.addValueText), ke(t.userInfoMessage);
|
|
3884
3888
|
}, [
|
|
3885
3889
|
Z,
|
|
@@ -3891,7 +3895,7 @@ function Nr(t, n) {
|
|
|
3891
3895
|
if (T) return;
|
|
3892
3896
|
let t = e.target.value;
|
|
3893
3897
|
if (De(t), Te(t), it(t), v && t) {
|
|
3894
|
-
let { suggestion: n } =
|
|
3898
|
+
let { suggestion: n } = gr(Q, t);
|
|
3895
3899
|
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));
|
|
3896
3900
|
}
|
|
3897
3901
|
}, [
|
|
@@ -3913,7 +3917,7 @@ function Nr(t, n) {
|
|
|
3913
3917
|
e.preventDefault(), Ve(Z.length - 1);
|
|
3914
3918
|
return;
|
|
3915
3919
|
}
|
|
3916
|
-
let t =
|
|
3920
|
+
let t = vr(e.key, e.shiftKey, g);
|
|
3917
3921
|
if (t && !(e.key === "Tab" && !Se)) {
|
|
3918
3922
|
if (t === "focusListbox" && e.key === "Tab" && !G.current?.querySelector("[role=\"option\"]:not([data-disabled]), [data-type=\"new-option\"]")) {
|
|
3919
3923
|
rt();
|
|
@@ -3930,7 +3934,7 @@ function Nr(t, n) {
|
|
|
3930
3934
|
break;
|
|
3931
3935
|
}
|
|
3932
3936
|
case "focusListbox":
|
|
3933
|
-
G.current && (Se || Ce(!0),
|
|
3937
|
+
G.current && (Se || Ce(!0), Er(G.current, {
|
|
3934
3938
|
disabled: T,
|
|
3935
3939
|
allowUserInput: b,
|
|
3936
3940
|
customUserInput: Me,
|
|
@@ -3958,7 +3962,7 @@ function Nr(t, n) {
|
|
|
3958
3962
|
Le.current = !1, Pe(!0);
|
|
3959
3963
|
return;
|
|
3960
3964
|
}
|
|
3961
|
-
!g && Z[0] && H.current && H.current.type !== "hidden" && (ze(!0), H.current.value =
|
|
3965
|
+
!g && Z[0] && H.current && H.current.type !== "hidden" && (ze(!0), H.current.value = br(Z[0], Q, x)), Pe(!0), Te(""), Ce(!0);
|
|
3962
3966
|
}
|
|
3963
3967
|
}, [
|
|
3964
3968
|
T,
|
|
@@ -3985,7 +3989,7 @@ function Nr(t, n) {
|
|
|
3985
3989
|
else {
|
|
3986
3990
|
e.stopPropagation(), e.preventDefault();
|
|
3987
3991
|
let t = !Se;
|
|
3988
|
-
Ce(t), t && G.current &&
|
|
3992
|
+
Ce(t), t && G.current && Er(G.current, {
|
|
3989
3993
|
disabled: T,
|
|
3990
3994
|
allowUserInput: b,
|
|
3991
3995
|
customUserInput: Me,
|
|
@@ -4008,7 +4012,7 @@ function Nr(t, n) {
|
|
|
4008
4012
|
case "ArrowDown":
|
|
4009
4013
|
case "ArrowUp":
|
|
4010
4014
|
e.preventDefault(), Se ? Ce(!1) : (Ce(!0), G.current && window.setTimeout(() => {
|
|
4011
|
-
G.current &&
|
|
4015
|
+
G.current && Er(G.current, {
|
|
4012
4016
|
disabled: T,
|
|
4013
4017
|
allowUserInput: b && !We,
|
|
4014
4018
|
customUserInput: Me,
|
|
@@ -4022,7 +4026,7 @@ function Nr(t, n) {
|
|
|
4022
4026
|
case "Home":
|
|
4023
4027
|
case "End":
|
|
4024
4028
|
e.preventDefault(), Se || Ce(!0), G.current && window.setTimeout(() => {
|
|
4025
|
-
G.current &&
|
|
4029
|
+
G.current && Er(G.current, {
|
|
4026
4030
|
disabled: T,
|
|
4027
4031
|
allowUserInput: b && !We,
|
|
4028
4032
|
customUserInput: Me,
|
|
@@ -4059,10 +4063,10 @@ function Nr(t, n) {
|
|
|
4059
4063
|
e.preventDefault(), nt(t);
|
|
4060
4064
|
break;
|
|
4061
4065
|
case "ArrowDown":
|
|
4062
|
-
e.preventDefault(),
|
|
4066
|
+
e.preventDefault(), Cr(e.currentTarget);
|
|
4063
4067
|
break;
|
|
4064
4068
|
case "ArrowUp":
|
|
4065
|
-
e.preventDefault(), G.current &&
|
|
4069
|
+
e.preventDefault(), G.current && wr(e.currentTarget, G.current, y);
|
|
4066
4070
|
break;
|
|
4067
4071
|
case "Escape":
|
|
4068
4072
|
e.preventDefault(), Ce(!1), V && (Le.current = !0), pe();
|
|
@@ -4127,10 +4131,10 @@ function Nr(t, n) {
|
|
|
4127
4131
|
e.preventDefault(), nt(e.currentTarget.dataset.value || "");
|
|
4128
4132
|
break;
|
|
4129
4133
|
case "ArrowDown":
|
|
4130
|
-
e.preventDefault(), G.current &&
|
|
4134
|
+
e.preventDefault(), G.current && Tr(G.current);
|
|
4131
4135
|
break;
|
|
4132
4136
|
case "ArrowUp":
|
|
4133
|
-
e.preventDefault(), G.current &&
|
|
4137
|
+
e.preventDefault(), G.current && wr(e.currentTarget, G.current, y);
|
|
4134
4138
|
break;
|
|
4135
4139
|
case "Escape": e.preventDefault(), Ce(!1), V && (Le.current = !0), pe();
|
|
4136
4140
|
}
|
|
@@ -4252,8 +4256,8 @@ function Nr(t, n) {
|
|
|
4252
4256
|
}
|
|
4253
4257
|
//#endregion
|
|
4254
4258
|
//#region src/components/combobox/Combobox.tsx
|
|
4255
|
-
var
|
|
4256
|
-
let n =
|
|
4259
|
+
var Fr = i((e, t) => {
|
|
4260
|
+
let n = Pr(e, t), r = [
|
|
4257
4261
|
"pkt-combobox-component",
|
|
4258
4262
|
n.fullwidth && "pkt-combobox-component--fullwidth",
|
|
4259
4263
|
n.className
|
|
@@ -4262,7 +4266,7 @@ var Pr = i((e, t) => {
|
|
|
4262
4266
|
className: r,
|
|
4263
4267
|
ref: n.wrapperRef,
|
|
4264
4268
|
id: n.id || void 0,
|
|
4265
|
-
children: [/* @__PURE__ */ v(
|
|
4269
|
+
children: [/* @__PURE__ */ v(sr, {
|
|
4266
4270
|
strings: n.strings,
|
|
4267
4271
|
forId: a,
|
|
4268
4272
|
hasFieldset: e.hasFieldset ?? !i,
|
|
@@ -4288,8 +4292,8 @@ var Pr = i((e, t) => {
|
|
|
4288
4292
|
children: [/* @__PURE__ */ v("div", {
|
|
4289
4293
|
className: "pkt-combobox",
|
|
4290
4294
|
onBlur: n.handleFocusOut,
|
|
4291
|
-
children: [/* @__PURE__ */ _(
|
|
4292
|
-
}), n.tagPlacement === "outside" && n.multiple && /* @__PURE__ */ _(
|
|
4295
|
+
children: [/* @__PURE__ */ _(kr, { state: n }), /* @__PURE__ */ _(Ar, { state: n })]
|
|
4296
|
+
}), n.tagPlacement === "outside" && n.multiple && /* @__PURE__ */ _(Dr, {
|
|
4293
4297
|
state: n,
|
|
4294
4298
|
outside: !0
|
|
4295
4299
|
})]
|
|
@@ -4305,10 +4309,10 @@ var Pr = i((e, t) => {
|
|
|
4305
4309
|
})]
|
|
4306
4310
|
});
|
|
4307
4311
|
});
|
|
4308
|
-
|
|
4312
|
+
Fr.displayName = "PktCombobox";
|
|
4309
4313
|
//#endregion
|
|
4310
4314
|
//#region src/components/consent/Consent.tsx
|
|
4311
|
-
var
|
|
4315
|
+
var Ir = null, Lr = () => Ir || (Ir = new Promise((e, t) => {
|
|
4312
4316
|
if (document.querySelector("#oslo-consent-script")) {
|
|
4313
4317
|
e();
|
|
4314
4318
|
return;
|
|
@@ -4317,14 +4321,14 @@ var Fr = null, Ir = () => Fr || (Fr = new Promise((e, t) => {
|
|
|
4317
4321
|
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);
|
|
4318
4322
|
let r = document.createElement("link");
|
|
4319
4323
|
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);
|
|
4320
|
-
}),
|
|
4324
|
+
}), Ir), Rr = (e) => {
|
|
4321
4325
|
if (typeof e != "string") return e;
|
|
4322
4326
|
try {
|
|
4323
4327
|
return JSON.parse(e);
|
|
4324
4328
|
} catch {
|
|
4325
4329
|
return e;
|
|
4326
4330
|
}
|
|
4327
|
-
},
|
|
4331
|
+
}, zr = (e) => Rr(e.value).items.reduce((e, t) => (e[t.name] = t.consent, e), {}), Br = i(function({ devMode: e = Wn.devMode, cookieDomain: t = null, cookieSecure: n = null, cookieExpiryDays: r = null, hotjarId: i = null, googleAnalyticsId: a = null, i18nLanguage: o = Wn.i18nLanguage, triggerType: s = Wn.triggerType, triggerText: l, onToggleConsent: u, ...d }, f) {
|
|
4328
4332
|
let m = p(u);
|
|
4329
4333
|
m.current = u;
|
|
4330
4334
|
let h = p({
|
|
@@ -4343,14 +4347,14 @@ var Fr = null, Ir = () => Fr || (Fr = new Promise((e, t) => {
|
|
|
4343
4347
|
hotjarId: i,
|
|
4344
4348
|
googleAnalyticsId: a
|
|
4345
4349
|
};
|
|
4346
|
-
let g = p(() => {}), v =
|
|
4350
|
+
let g = p(() => {}), v = Object.hasOwn(ge.i18n, o) ? o : "nb", y = l ?? ge.i18n[v].contentPresentation.buttons.settings;
|
|
4347
4351
|
c(() => {
|
|
4348
4352
|
let e = !1, t, n, r = h.current;
|
|
4349
4353
|
window.cookieBanner_googleAnalyticsId = r.googleAnalyticsId, window.cookieBanner_hotjarId = r.hotjarId, r.cookieDomain && (window.cookieBanner_cookieDomain = r.cookieDomain), r.cookieSecure && (window.cookieBanner_cookieSecure = r.cookieSecure), r.cookieExpiryDays && (window.cookieBanner_cookieExpiryDays = r.cookieExpiryDays), r.devMode && (window.cookieBanner_devMode = r.devMode);
|
|
4350
4354
|
let i = (e) => {
|
|
4351
4355
|
let t = m.current;
|
|
4352
4356
|
t && t(new CustomEvent("toggle-consent", {
|
|
4353
|
-
detail:
|
|
4357
|
+
detail: zr(e),
|
|
4354
4358
|
bubbles: !0,
|
|
4355
4359
|
cancelable: !1
|
|
4356
4360
|
}));
|
|
@@ -4368,7 +4372,7 @@ var Fr = null, Ir = () => Fr || (Fr = new Promise((e, t) => {
|
|
|
4368
4372
|
e || i({ value: s });
|
|
4369
4373
|
}, 0), t && a.off("CookieManager.setCookie", t), t = (e) => i(e), a.on("CookieManager.setCookie", t);
|
|
4370
4374
|
});
|
|
4371
|
-
},
|
|
4375
|
+
}, Lr().then(() => {
|
|
4372
4376
|
e || g.current();
|
|
4373
4377
|
}), () => {
|
|
4374
4378
|
e = !0, window.clearTimeout(n), t && window.__cookieEvents?.off("CookieManager.setCookie", t);
|
|
@@ -4408,13 +4412,13 @@ var Fr = null, Ir = () => Fr || (Fr = new Promise((e, t) => {
|
|
|
4408
4412
|
children: y
|
|
4409
4413
|
});
|
|
4410
4414
|
});
|
|
4411
|
-
|
|
4415
|
+
Br.displayName = "PktConsent";
|
|
4412
4416
|
//#endregion
|
|
4413
4417
|
//#region ../../shared-utils/device-utils.ts
|
|
4414
|
-
var
|
|
4418
|
+
var Vr = () => {
|
|
4415
4419
|
let e = navigator.userAgent;
|
|
4416
4420
|
return !!(/iP(hone|od|ad)/.test(e) || /Macintosh/.test(e) && "ontouchend" in document);
|
|
4417
|
-
},
|
|
4421
|
+
}, Hr = () => Vr() ? "text" : "date", Ur = (e) => !e || e.length !== 2 || pn(e[0], e[1]), Wr = (e, t, n, r, i, a, o = "medium") => ({
|
|
4418
4422
|
"pkt-input": !0,
|
|
4419
4423
|
"pkt-datepicker__input": !0,
|
|
4420
4424
|
[`pkt-input--${o}`]: !0,
|
|
@@ -4423,27 +4427,27 @@ var Br = () => {
|
|
|
4423
4427
|
"pkt-datepicker--multiple": n,
|
|
4424
4428
|
"pkt-datepicker--range": r,
|
|
4425
4429
|
"ios-readonly-hack": i === !1 && a === "text"
|
|
4426
|
-
}),
|
|
4430
|
+
}), Gr = (e = "medium") => ({
|
|
4427
4431
|
"pkt-input-icon": !0,
|
|
4428
4432
|
"pkt-btn": !0,
|
|
4429
4433
|
"pkt-btn--icon-only": !0,
|
|
4430
4434
|
"pkt-btn--tertiary": !0,
|
|
4431
4435
|
[`pkt-btn--${e}`]: !0,
|
|
4432
4436
|
"pkt-datepicker__calendar-button": !0
|
|
4433
|
-
}),
|
|
4437
|
+
}), Kr = (e) => ({
|
|
4434
4438
|
"pkt-input-prefix": e,
|
|
4435
4439
|
"pkt-hide": !e
|
|
4436
|
-
}),
|
|
4440
|
+
}), qr = (e, t, n) => !t && !n ? Array.isArray(e) ? e[0] || "" : e : Array.isArray(e) ? e.join(",") : e, Jr = (e, t, n = !1) => {
|
|
4437
4441
|
if (!e || !t) return;
|
|
4438
4442
|
let r = t.parentElement?.getBoundingClientRect() || t.getBoundingClientRect(), i = n ? r.height + 30 : r.height, a = e.getBoundingClientRect().height, o = n ? "calc(100% - 30px)" : "100%";
|
|
4439
4443
|
r && typeof window < "u" && r.top + a > window.innerHeight && r.top - a > 0 && (o = `calc(100% - ${i}px - ${a}px)`), e.style.top = o;
|
|
4440
|
-
},
|
|
4444
|
+
}, Yr = (e, t, n, r, i, a) => {
|
|
4441
4445
|
let { key: o } = e;
|
|
4442
4446
|
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());
|
|
4443
|
-
},
|
|
4447
|
+
}, Xr = ({ 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 }) => {
|
|
4444
4448
|
let b = p(null), x = p(!1);
|
|
4445
4449
|
e && (x.current = !0), c(() => {
|
|
4446
|
-
e &&
|
|
4450
|
+
e && Jr(b.current, h?.current ?? null, g);
|
|
4447
4451
|
}, [
|
|
4448
4452
|
e,
|
|
4449
4453
|
h,
|
|
@@ -4472,14 +4476,14 @@ var Br = () => {
|
|
|
4472
4476
|
onClose: y
|
|
4473
4477
|
})
|
|
4474
4478
|
});
|
|
4475
|
-
},
|
|
4479
|
+
}, Zr = ({ dates: e, dateformat: t, idBase: n, strings: r, onDateRemoved: i }) => {
|
|
4476
4480
|
let a = fn(e), o = ve(["datepicker"], r).datepicker.deleteDate;
|
|
4477
4481
|
return /* @__PURE__ */ _("div", {
|
|
4478
4482
|
className: "pkt-date-tags pkt-datepicker__tags",
|
|
4479
4483
|
"aria-live": "polite",
|
|
4480
4484
|
children: a.map((e) => {
|
|
4481
4485
|
let r = $t(e, t);
|
|
4482
|
-
return /* @__PURE__ */ _(
|
|
4486
|
+
return /* @__PURE__ */ _(Jn, {
|
|
4483
4487
|
id: `${n}${e}-tag`,
|
|
4484
4488
|
closeTag: !0,
|
|
4485
4489
|
ariaLabel: `${o} ${r}`,
|
|
@@ -4491,7 +4495,7 @@ var Br = () => {
|
|
|
4491
4495
|
}, e);
|
|
4492
4496
|
})
|
|
4493
4497
|
});
|
|
4494
|
-
},
|
|
4498
|
+
}, Qr = ({ state: e }) => {
|
|
4495
4499
|
let { id: t, inputId: n, values: r, dateformat: i, multiple: a, range: o, showRangeLabels: s, disabled: c, readOnly: l, required: u, label: d, name: f, placeholder: p, hasError: m, helptext: h, minStr: y, maxStr: b, inputType: x, isIOSDevice: S, strings: C, inputClasses: w, buttonClasses: T, rangeLabelClasses: E, datepickerInputsClasses: D, isInputDisabled: O, inputRef: k, inputToRef: A, btnRef: j, toggleCalendar: M, handleFocus: N, handleSingleInputChange: P, handleRangeFromChange: ee, handleRangeToChange: te, handleRangeBlur: ne, handleMultipleBlur: F, handleTagRemoved: re, handleSingleKeydown: ie, handleRangeFromKeydown: ae, handleRangeToKeydown: oe, handleMultipleKeydown: se, restProps: I } = e, R = (e) => {
|
|
4496
4500
|
e.preventDefault(), M();
|
|
4497
4501
|
}, ce = (e) => {
|
|
@@ -4507,7 +4511,7 @@ var Br = () => {
|
|
|
4507
4511
|
children: C.datepicker.openPicker
|
|
4508
4512
|
})]
|
|
4509
4513
|
});
|
|
4510
|
-
return a ? /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _(
|
|
4514
|
+
return a ? /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _(Zr, {
|
|
4511
4515
|
dates: r,
|
|
4512
4516
|
dateformat: i,
|
|
4513
4517
|
idBase: t,
|
|
@@ -4633,7 +4637,7 @@ var Br = () => {
|
|
|
4633
4637
|
}), z()]
|
|
4634
4638
|
})
|
|
4635
4639
|
});
|
|
4636
|
-
},
|
|
4640
|
+
}, $r = (e) => {
|
|
4637
4641
|
if (!e) return [];
|
|
4638
4642
|
if (Array.isArray(e)) return e.filter(Boolean);
|
|
4639
4643
|
if (typeof e == "string" && e.trimStart().startsWith("[")) try {
|
|
@@ -4644,17 +4648,17 @@ var Br = () => {
|
|
|
4644
4648
|
};
|
|
4645
4649
|
//#endregion
|
|
4646
4650
|
//#region src/components/datepicker/useDatepickerState.ts
|
|
4647
|
-
function
|
|
4648
|
-
let { id: n, label: r, value: i, defaultValue: a, dateformat: s = "dd.MM.yyyy", multiple: l = !1, maxlength: d, range: h = !1, showRangeLabels: g = !1, weeknumbers: _ = !1, withcontrols: v = !1, excludedates: y, excludeweekdays: b, currentmonth: x, today: S, calendarOpen: C, timezone: w, fullwidth: T = !1, inputSize: E = "medium", hasFieldset: D = !1, counter: O, inline: k = !1, helptext: A, helptextDropdown: j, helptextDropdownButton: M, hasError: N = !1, errorMessage: P, optionalTag: ee = !1, optionalText: te, requiredTag: ne = !1, requiredText: F, tagText: re, useWrapper: ie = !0, strings: ae, disabled: oe = !1, readOnly: se = !1, required: I = !1, name: L, min: R, max: ce, placeholder: z, onChange: B, onValueChange: le, className: ue, ...de } = e, V = o((e) => e === void 0 ? [] :
|
|
4651
|
+
function ei(e, t) {
|
|
4652
|
+
let { id: n, label: r, value: i, defaultValue: a, dateformat: s = "dd.MM.yyyy", multiple: l = !1, maxlength: d, range: h = !1, showRangeLabels: g = !1, weeknumbers: _ = !1, withcontrols: v = !1, excludedates: y, excludeweekdays: b, currentmonth: x, today: S, calendarOpen: C, timezone: w, fullwidth: T = !1, inputSize: E = "medium", hasFieldset: D = !1, counter: O, inline: k = !1, helptext: A, helptextDropdown: j, helptextDropdownButton: M, hasError: N = !1, errorMessage: P, optionalTag: ee = !1, optionalText: te, requiredTag: ne = !1, requiredText: F, tagText: re, useWrapper: ie = !0, strings: ae, disabled: oe = !1, readOnly: se = !1, required: I = !1, name: L, min: R, max: ce, placeholder: z, onChange: B, onValueChange: le, className: ue, ...de } = e, V = o((e) => e === void 0 ? [] : $r(e), []), H = i !== void 0, U = typeof a == "number" ? void 0 : a, [W, G] = m(() => V(i ?? U)), K = H ? V(i) : W, fe = p(W), [pe, me] = m(i);
|
|
4649
4653
|
H && i !== pe && (me(i), G(V(i)));
|
|
4650
4654
|
let [q, J] = m(C ?? !1), [he, ge] = m(C);
|
|
4651
4655
|
C !== he && (ge(C), C !== void 0 && J(C));
|
|
4652
|
-
let Y = p(null), _e = p(null), X = p(null), ye = p(null), Z = p(null), be = f(() =>
|
|
4656
|
+
let Y = p(null), _e = p(null), X = p(null), ye = p(null), Z = p(null), be = f(() => Hr(), []), xe = f(() => Vr(), []), Q = ve([
|
|
4653
4657
|
"generic",
|
|
4654
4658
|
"datepicker",
|
|
4655
4659
|
"validation"
|
|
4656
4660
|
], ae), Se = ae, Ce = typeof R == "string" ? R : R === void 0 ? void 0 : String(R), we = typeof ce == "string" ? ce : ce === void 0 ? void 0 : String(ce), Te = f(() => {
|
|
4657
|
-
let e =
|
|
4661
|
+
let e = Wr(T, g, l, h, se, be, E);
|
|
4658
4662
|
return Object.entries(e).filter(([, e]) => e).map(([e]) => e).join(" ");
|
|
4659
4663
|
}, [
|
|
4660
4664
|
T,
|
|
@@ -4664,8 +4668,8 @@ function $r(e, t) {
|
|
|
4664
4668
|
se,
|
|
4665
4669
|
be,
|
|
4666
4670
|
E
|
|
4667
|
-
]), Ee = Object.entries(
|
|
4668
|
-
let e =
|
|
4671
|
+
]), Ee = Object.entries(Gr(E)).filter(([, e]) => e).map(([e]) => e).join(" "), De = f(() => {
|
|
4672
|
+
let e = Kr(g);
|
|
4669
4673
|
return Object.entries(e).filter(([, e]) => e).map(([e]) => e).join(" ");
|
|
4670
4674
|
}, [g]), Oe = f(() => ["pkt-datepicker__inputs", h && "pkt-input__range-inputs"].filter(Boolean).join(" "), [h, g]), ke = f(() => {
|
|
4671
4675
|
if (x) return x;
|
|
@@ -4702,7 +4706,7 @@ function $r(e, t) {
|
|
|
4702
4706
|
let Re = o(() => {
|
|
4703
4707
|
xe && !q && J(!0);
|
|
4704
4708
|
}, [xe, q]), ze = o((e) => {
|
|
4705
|
-
let t =
|
|
4709
|
+
let t = $r(qr(e, l, h));
|
|
4706
4710
|
$(t), Fe(t), !l && !h && (Le(), Y.current?.focus());
|
|
4707
4711
|
}, [
|
|
4708
4712
|
l,
|
|
@@ -4730,7 +4734,7 @@ function $r(e, t) {
|
|
|
4730
4734
|
$,
|
|
4731
4735
|
Fe
|
|
4732
4736
|
]), We = o(() => {
|
|
4733
|
-
K.length === 2 && !
|
|
4737
|
+
K.length === 2 && !Ur(K) && ($([K[0]]), Fe([K[0]]));
|
|
4734
4738
|
}, [
|
|
4735
4739
|
K,
|
|
4736
4740
|
$,
|
|
@@ -4766,13 +4770,13 @@ function $r(e, t) {
|
|
|
4766
4770
|
let t = e?.closest("form");
|
|
4767
4771
|
t ? t.requestSubmit() : e?.blur();
|
|
4768
4772
|
}, []), Xe = o((e) => {
|
|
4769
|
-
|
|
4773
|
+
Yr(e.nativeEvent, () => Ie(), () => Ye(Y.current), void 0, () => Y.current?.blur());
|
|
4770
4774
|
}, [Ie, Ye]), Ze = o((e) => {
|
|
4771
|
-
|
|
4775
|
+
Yr(e.nativeEvent, () => Ie(), () => Ye(Y.current), () => _e.current?.focus(), () => Y.current?.blur());
|
|
4772
4776
|
}, [Ie, Ye]), Qe = o((e) => {
|
|
4773
|
-
|
|
4777
|
+
Yr(e.nativeEvent, () => Ie(), () => Ye(_e.current), void 0, () => _e.current?.blur());
|
|
4774
4778
|
}, [Ie, Ye]), $e = o((e) => {
|
|
4775
|
-
|
|
4779
|
+
Yr(e.nativeEvent, () => Ie(), () => Ye(Y.current), void 0, () => Y.current?.blur(), qe);
|
|
4776
4780
|
}, [
|
|
4777
4781
|
Ie,
|
|
4778
4782
|
Ye,
|
|
@@ -4879,8 +4883,8 @@ function $r(e, t) {
|
|
|
4879
4883
|
}
|
|
4880
4884
|
//#endregion
|
|
4881
4885
|
//#region src/components/datepicker/Datepicker.tsx
|
|
4882
|
-
var
|
|
4883
|
-
let n =
|
|
4886
|
+
var ti = i((e, t) => {
|
|
4887
|
+
let n = ei(e, t), r = [
|
|
4884
4888
|
"pkt-datepicker",
|
|
4885
4889
|
`pkt-datepicker--${n.inputSize}`,
|
|
4886
4890
|
n.fullwidth ? "pkt-datepicker--fullwidth" : "",
|
|
@@ -4890,7 +4894,7 @@ var ei = i((e, t) => {
|
|
|
4890
4894
|
className: r,
|
|
4891
4895
|
id: n.id || void 0,
|
|
4892
4896
|
children: [
|
|
4893
|
-
/* @__PURE__ */ _(
|
|
4897
|
+
/* @__PURE__ */ _(sr, {
|
|
4894
4898
|
strings: n.stringsOverride,
|
|
4895
4899
|
ref: n.wrapperRef,
|
|
4896
4900
|
ariaDescribedby: e.ariaDescribedby,
|
|
@@ -4914,9 +4918,9 @@ var ei = i((e, t) => {
|
|
|
4914
4918
|
counter: n.hasCounter,
|
|
4915
4919
|
counterCurrent: n.values.length,
|
|
4916
4920
|
counterMaxLength: n.maxlength,
|
|
4917
|
-
children: /* @__PURE__ */ _(
|
|
4921
|
+
children: /* @__PURE__ */ _(Qr, { state: n })
|
|
4918
4922
|
}),
|
|
4919
|
-
/* @__PURE__ */ _(
|
|
4923
|
+
/* @__PURE__ */ _(Xr, {
|
|
4920
4924
|
open: n.calendarOpen,
|
|
4921
4925
|
multiple: n.multiple,
|
|
4922
4926
|
range: n.range,
|
|
@@ -4947,10 +4951,10 @@ var ei = i((e, t) => {
|
|
|
4947
4951
|
]
|
|
4948
4952
|
});
|
|
4949
4953
|
});
|
|
4950
|
-
|
|
4954
|
+
ti.displayName = "PktDatepicker";
|
|
4951
4955
|
//#endregion
|
|
4952
4956
|
//#region ../../shared-utils/fileupload/size.ts
|
|
4953
|
-
function
|
|
4957
|
+
function ni(e) {
|
|
4954
4958
|
if (e == null || e === "") return;
|
|
4955
4959
|
if (typeof e == "number") return Number.isFinite(e) && e > 0 ? e : void 0;
|
|
4956
4960
|
let t = String(e).trim(), n = Number(t);
|
|
@@ -4969,15 +4973,15 @@ function ti(e) {
|
|
|
4969
4973
|
default: return;
|
|
4970
4974
|
}
|
|
4971
4975
|
}
|
|
4972
|
-
function
|
|
4976
|
+
function ri(e) {
|
|
4973
4977
|
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`;
|
|
4974
4978
|
}
|
|
4975
4979
|
//#endregion
|
|
4976
4980
|
//#region ../../shared-utils/fileupload/formats.ts
|
|
4977
|
-
function
|
|
4981
|
+
function ii(e) {
|
|
4978
4982
|
return Array.isArray(e) ? e.map((e) => String(e).trim().toLowerCase()).filter(Boolean) : [];
|
|
4979
4983
|
}
|
|
4980
|
-
function
|
|
4984
|
+
function ai(e, t, n) {
|
|
4981
4985
|
let r = e.toLowerCase().replace(/^\./, "");
|
|
4982
4986
|
if (r.includes("/")) {
|
|
4983
4987
|
if (r.endsWith("/*")) {
|
|
@@ -4988,33 +4992,33 @@ function ii(e, t, n) {
|
|
|
4988
4992
|
}
|
|
4989
4993
|
return t === r;
|
|
4990
4994
|
}
|
|
4991
|
-
function
|
|
4992
|
-
let n =
|
|
4995
|
+
function oi(e, t) {
|
|
4996
|
+
let n = ii(t);
|
|
4993
4997
|
if (n.length === 0) return !0;
|
|
4994
4998
|
let r = e.name.split(".").pop()?.toLowerCase() ?? "", i = e.type.toLowerCase();
|
|
4995
|
-
return n.some((e) =>
|
|
4999
|
+
return n.some((e) => ai(e, r, i));
|
|
4996
5000
|
}
|
|
4997
|
-
function
|
|
5001
|
+
function si(e, t) {
|
|
4998
5002
|
let n = (e ?? "").trim();
|
|
4999
5003
|
if (n) return n;
|
|
5000
|
-
let r =
|
|
5004
|
+
let r = ii(t);
|
|
5001
5005
|
return r.length === 0 ? "" : r.map((e) => e.includes("/") || e.startsWith(".") ? e : `.${e}`).join(", ");
|
|
5002
5006
|
}
|
|
5003
5007
|
//#endregion
|
|
5004
5008
|
//#region ../../shared-utils/fileupload/validation.ts
|
|
5005
|
-
function
|
|
5009
|
+
function ci(e, t, n) {
|
|
5006
5010
|
return ((e ?? "").trim() || t).replace(/\{(\w+)\}/g, (e, t) => n[t] ?? `{${t}}`);
|
|
5007
5011
|
}
|
|
5008
|
-
function
|
|
5009
|
-
let n =
|
|
5010
|
-
if (n.length > 0 && !
|
|
5012
|
+
function li(e, t) {
|
|
5013
|
+
let n = ii(t.allowedFormats);
|
|
5014
|
+
if (n.length > 0 && !oi(e, n)) {
|
|
5011
5015
|
let e = n.join(", "), r = ce.fileupload.invalidFormat;
|
|
5012
|
-
return
|
|
5016
|
+
return ci(t.formatErrorMessage, r, { formats: e });
|
|
5013
5017
|
}
|
|
5014
|
-
let r =
|
|
5018
|
+
let r = ni(t.maxFileSize);
|
|
5015
5019
|
if (r !== void 0 && e.size > r) {
|
|
5016
|
-
let e =
|
|
5017
|
-
return
|
|
5020
|
+
let e = ri(r), n = ce.fileupload.sizeTooLarge;
|
|
5021
|
+
return ci(t.sizeErrorMessage, n, { maxSize: e });
|
|
5018
5022
|
}
|
|
5019
5023
|
if (t.onFileValidation) {
|
|
5020
5024
|
let n = t.onFileValidation(e);
|
|
@@ -5022,7 +5026,7 @@ function ci(e, t) {
|
|
|
5022
5026
|
}
|
|
5023
5027
|
return null;
|
|
5024
5028
|
}
|
|
5025
|
-
function
|
|
5029
|
+
function ui(e) {
|
|
5026
5030
|
let t = e.file;
|
|
5027
5031
|
if (t?.type?.startsWith("image/")) return !0;
|
|
5028
5032
|
let n = e.attributes?.targetFilename || t?.name || "";
|
|
@@ -5030,10 +5034,10 @@ function li(e) {
|
|
|
5030
5034
|
}
|
|
5031
5035
|
//#endregion
|
|
5032
5036
|
//#region ../../shared-utils/fileupload/transfers.ts
|
|
5033
|
-
function
|
|
5037
|
+
function di(e) {
|
|
5034
5038
|
return typeof e == "number" ? "in-progress" : e === "error" ? "error" : "idle";
|
|
5035
5039
|
}
|
|
5036
|
-
function
|
|
5040
|
+
function fi(e, t, n) {
|
|
5037
5041
|
let r = {
|
|
5038
5042
|
"in-progress": 0,
|
|
5039
5043
|
error: 1,
|
|
@@ -5048,11 +5052,11 @@ function di(e, t, n) {
|
|
|
5048
5052
|
showProgress: r?.showProgress,
|
|
5049
5053
|
lastProgress: r?.lastProgress
|
|
5050
5054
|
};
|
|
5051
|
-
}).sort((e, t) => r[
|
|
5055
|
+
}).sort((e, t) => r[di(e.progress)] - r[di(t.progress)]);
|
|
5052
5056
|
}
|
|
5053
5057
|
//#endregion
|
|
5054
5058
|
//#region ../../shared-utils/focus-trap/index.ts
|
|
5055
|
-
function
|
|
5059
|
+
function pi(e) {
|
|
5056
5060
|
if (!e) return [];
|
|
5057
5061
|
let t = [
|
|
5058
5062
|
"a[href]:not([tabindex=\"-1\"])",
|
|
@@ -5064,7 +5068,7 @@ function fi(e) {
|
|
|
5064
5068
|
].join(", ");
|
|
5065
5069
|
return Array.from(e.querySelectorAll(t)).filter((e) => !e.hasAttribute("inert"));
|
|
5066
5070
|
}
|
|
5067
|
-
var
|
|
5071
|
+
var mi = [
|
|
5068
5072
|
"a[href]",
|
|
5069
5073
|
"button:not([disabled])",
|
|
5070
5074
|
"input:not([disabled]):not([type=\"hidden\"])",
|
|
@@ -5072,7 +5076,7 @@ var pi = [
|
|
|
5072
5076
|
"textarea:not([disabled])",
|
|
5073
5077
|
"summary",
|
|
5074
5078
|
"[tabindex]:not([tabindex=\"-1\"])"
|
|
5075
|
-
].join(", "),
|
|
5079
|
+
].join(", "), hi = (e) => {
|
|
5076
5080
|
if (e.hasAttribute("inert") || e.closest("[inert]") || e.hidden || e.closest("[hidden]")) return !0;
|
|
5077
5081
|
let t = e;
|
|
5078
5082
|
for (; t;) {
|
|
@@ -5085,33 +5089,33 @@ var pi = [
|
|
|
5085
5089
|
t = n.parentElement;
|
|
5086
5090
|
}
|
|
5087
5091
|
return !1;
|
|
5088
|
-
},
|
|
5089
|
-
e.matches(
|
|
5092
|
+
}, gi = (e, t) => {
|
|
5093
|
+
e.matches(mi) && !hi(e) && t.push(e);
|
|
5090
5094
|
let n = e.shadowRoot;
|
|
5091
|
-
if (n) for (let e of Array.from(n.children))
|
|
5092
|
-
for (let n of Array.from(e.children))
|
|
5095
|
+
if (n) for (let e of Array.from(n.children)) gi(e, t);
|
|
5096
|
+
for (let n of Array.from(e.children)) gi(n, t);
|
|
5093
5097
|
};
|
|
5094
|
-
function
|
|
5098
|
+
function _i(e) {
|
|
5095
5099
|
if (!e) return [];
|
|
5096
5100
|
let t = [];
|
|
5097
|
-
for (let n of Array.from(e.children))
|
|
5101
|
+
for (let n of Array.from(e.children)) gi(n, t);
|
|
5098
5102
|
return t;
|
|
5099
5103
|
}
|
|
5100
|
-
function
|
|
5104
|
+
function vi(e = document) {
|
|
5101
5105
|
let t = e.activeElement;
|
|
5102
5106
|
for (; t?.shadowRoot?.activeElement;) t = t.shadowRoot.activeElement;
|
|
5103
5107
|
return t;
|
|
5104
5108
|
}
|
|
5105
|
-
function
|
|
5109
|
+
function yi(e, t) {
|
|
5106
5110
|
if (e.key !== "Tab") return !1;
|
|
5107
|
-
let n =
|
|
5111
|
+
let n = pi(t);
|
|
5108
5112
|
if (n.length === 0) return e.preventDefault(), !0;
|
|
5109
5113
|
let r = n[0], i = n[n.length - 1], a = (t?.ownerDocument ?? document).activeElement, o = !!a && n.includes(a);
|
|
5110
5114
|
return e.shiftKey ? !o || a === r ? (e.preventDefault(), i.focus(), !0) : !1 : !o || a === i ? (e.preventDefault(), r.focus(), !0) : !1;
|
|
5111
5115
|
}
|
|
5112
5116
|
//#endregion
|
|
5113
5117
|
//#region ../../shared-utils/fileupload/truncate.ts
|
|
5114
|
-
function
|
|
5118
|
+
function bi(e, t) {
|
|
5115
5119
|
return !t || t <= 0 || e.length <= t + 3 ? null : {
|
|
5116
5120
|
head: e.slice(0, e.length - t),
|
|
5117
5121
|
tail: e.slice(-t)
|
|
@@ -5119,12 +5123,12 @@ function yi(e, t) {
|
|
|
5119
5123
|
}
|
|
5120
5124
|
//#endregion
|
|
5121
5125
|
//#region ../../shared-utils/fileupload/navigation.ts
|
|
5122
|
-
function
|
|
5126
|
+
function xi(e, t, n) {
|
|
5123
5127
|
return n <= 0 ? 0 : t === "prev" ? e <= 0 ? n - 1 : e - 1 : e >= n - 1 ? 0 : e + 1;
|
|
5124
5128
|
}
|
|
5125
5129
|
//#endregion
|
|
5126
5130
|
//#region ../../shared-utils/fileupload/announcements.ts
|
|
5127
|
-
function
|
|
5131
|
+
function Si(e, t) {
|
|
5128
5132
|
let n = e.length;
|
|
5129
5133
|
if (n === 0 || !t || t.length === 0) return {
|
|
5130
5134
|
totalCount: n,
|
|
@@ -5144,23 +5148,23 @@ function xi(e, t) {
|
|
|
5144
5148
|
}
|
|
5145
5149
|
//#endregion
|
|
5146
5150
|
//#region ../../shared-utils/fileupload/filename.ts
|
|
5147
|
-
var
|
|
5148
|
-
function
|
|
5151
|
+
var Ci = ".jpeg, .jpg, .png, .gif, .webp, .heic";
|
|
5152
|
+
function wi(e, t = ce.fileupload.unknownFilename) {
|
|
5149
5153
|
return e.attributes?.targetFilename || e.file?.name || t;
|
|
5150
5154
|
}
|
|
5151
5155
|
//#endregion
|
|
5152
5156
|
//#region src/utils/stringutils.ts
|
|
5153
|
-
var
|
|
5154
|
-
let e =
|
|
5157
|
+
var Ti = () => ("00000000000000000" + (Math.random() * 0x10000000000000000).toString(16)).slice(-16), Ei = () => {
|
|
5158
|
+
let e = Ti(), t = Ti();
|
|
5155
5159
|
return e.slice(0, 8) + "-" + e.slice(8, 12) + "-4" + e.slice(13) + "-a" + t.slice(1, 4) + "-" + t.slice(4);
|
|
5156
|
-
},
|
|
5160
|
+
}, Di = class {
|
|
5157
5161
|
fileId;
|
|
5158
5162
|
file;
|
|
5159
5163
|
attributes;
|
|
5160
5164
|
constructor(e, t) {
|
|
5161
|
-
this.fileId = t ||
|
|
5165
|
+
this.fileId = t || Ei(), this.file = e, this.attributes = { targetFilename: e.name };
|
|
5162
5166
|
}
|
|
5163
|
-
},
|
|
5167
|
+
}, Oi = n({}), ki = 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) => {
|
|
5164
5168
|
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]);
|
|
5165
5169
|
u(x, () => S.current);
|
|
5166
5170
|
let [T, E] = m(!1), D = ve(["fileupload"], y), O = f(() => l ? t ? {
|
|
@@ -5185,14 +5189,14 @@ var wi = () => ("00000000000000000" + (Math.random() * 0x10000000000000000).toSt
|
|
|
5185
5189
|
D
|
|
5186
5190
|
]), k = o((e) => {
|
|
5187
5191
|
if (S.current) try {
|
|
5188
|
-
S.current.files =
|
|
5192
|
+
S.current.files = Ai(e);
|
|
5189
5193
|
} catch {}
|
|
5190
5194
|
}, [S.current, n]);
|
|
5191
5195
|
c(() => {
|
|
5192
5196
|
k(n);
|
|
5193
5197
|
}, [S, n]);
|
|
5194
5198
|
let A = o((e) => {
|
|
5195
|
-
r(e.map((e) => new
|
|
5199
|
+
r(e.map((e) => new Di(e))), S.current && (S.current.value = "");
|
|
5196
5200
|
}, [r]), j = (e) => {
|
|
5197
5201
|
let t = e.target.files;
|
|
5198
5202
|
if (t.length === 0) {
|
|
@@ -5276,21 +5280,21 @@ var wi = () => ("00000000000000000" + (Math.random() * 0x10000000000000000).toSt
|
|
|
5276
5280
|
})
|
|
5277
5281
|
]
|
|
5278
5282
|
});
|
|
5279
|
-
}),
|
|
5283
|
+
}), Ai = (e) => {
|
|
5280
5284
|
let t = new DataTransfer();
|
|
5281
5285
|
for (let n of e) t.items.add(n.file);
|
|
5282
5286
|
return t.files;
|
|
5283
|
-
},
|
|
5287
|
+
}, ji = i(({ id: e, ariaDescribedby: t, ariaLabelledby: n, counter: r, hasFieldset: i, counterMaxLength: a, className: o, disabled: s, errorMessage: c, hasError: l = !1, helptext: u, helptextDropdown: d, helptextDropdownButton: f, inline: p, fullwidth: h = !1, label: g, name: v, optionalTag: y = !1, optionalText: b, requiredTag: x = !1, requiredText: S, tagText: C = null, placeholder: w, rows: T, useWrapper: E = !0, onChange: D, value: O, autoComplete: k = "off", minLength: A, maxLength: j, readOnly: M, skipForwardTestid: N = !1, inputSize: P = "medium", strings: ee, ...te }, ne) => {
|
|
5284
5288
|
let F = r ?? (a ?? 0) > 0, re = [
|
|
5285
5289
|
o,
|
|
5286
5290
|
"pkt-textinput",
|
|
5287
5291
|
"pkt-textarea"
|
|
5288
|
-
].filter(Boolean).join(" "), ie =
|
|
5292
|
+
].filter(Boolean).join(" "), ie = Qn(e), ae = `${ie}-input`, oe = `${ae}-label`, se = n || oe, [I, L] = m(0), R = O === void 0 ? I : O?.length || 0, ce = (e) => {
|
|
5289
5293
|
F && L(e.currentTarget?.value?.length || 0), D && D(e);
|
|
5290
5294
|
};
|
|
5291
5295
|
return /* @__PURE__ */ _("div", {
|
|
5292
5296
|
className: re,
|
|
5293
|
-
children: /* @__PURE__ */ _(
|
|
5297
|
+
children: /* @__PURE__ */ _(sr, {
|
|
5294
5298
|
strings: ee,
|
|
5295
5299
|
ariaDescribedby: t,
|
|
5296
5300
|
disabled: s,
|
|
@@ -5326,7 +5330,7 @@ var wi = () => ("00000000000000000" + (Math.random() * 0x10000000000000000).toSt
|
|
|
5326
5330
|
"aria-labelledby": se,
|
|
5327
5331
|
"aria-invalid": l,
|
|
5328
5332
|
"aria-errormessage": l ? `${ie}-error` : void 0,
|
|
5329
|
-
"aria-describedby":
|
|
5333
|
+
"aria-describedby": tr({
|
|
5330
5334
|
id: ae,
|
|
5331
5335
|
hasHelptext: !!u,
|
|
5332
5336
|
hasCounter: F,
|
|
@@ -5344,10 +5348,10 @@ var wi = () => ("00000000000000000" + (Math.random() * 0x10000000000000000).toSt
|
|
|
5344
5348
|
})
|
|
5345
5349
|
});
|
|
5346
5350
|
});
|
|
5347
|
-
|
|
5351
|
+
ji.displayName = "PktTextarea";
|
|
5348
5352
|
//#endregion
|
|
5349
5353
|
//#region src/components/fileupload/extensions/Comments.tsx
|
|
5350
|
-
var
|
|
5354
|
+
var Mi = "comments", Ni = (e, t) => {
|
|
5351
5355
|
let n = new Date(e);
|
|
5352
5356
|
if (Number.isNaN(n.getTime())) return e;
|
|
5353
5357
|
let r = String(n.getDate()).padStart(2, "0"), i = String(n.getMonth() + 1).padStart(2, "0"), a = n.getFullYear(), o = String(n.getHours()).padStart(2, "0"), s = String(n.getMinutes()).padStart(2, "0");
|
|
@@ -5355,13 +5359,13 @@ var ji = "comments", Mi = (e, t) => {
|
|
|
5355
5359
|
date: `${r}.${i}.${a}`,
|
|
5356
5360
|
time: `${o}:${s}`
|
|
5357
5361
|
});
|
|
5358
|
-
},
|
|
5359
|
-
let { strings: a } = s(
|
|
5362
|
+
}, Pi = ({ fileItem: e, disabled: t, closeOperationUi: n, onAddComment: r, existingComment: i }) => {
|
|
5363
|
+
let { strings: a } = s(Oi), o = p(null), c = !!i;
|
|
5360
5364
|
return d(() => {
|
|
5361
5365
|
let e = setTimeout(() => o.current?.focus({ preventScroll: !0 }), 0);
|
|
5362
5366
|
return () => clearTimeout(e);
|
|
5363
5367
|
}, [e.fileId]), /* @__PURE__ */ v(g, { children: [
|
|
5364
|
-
/* @__PURE__ */ _(
|
|
5368
|
+
/* @__PURE__ */ _(ji, {
|
|
5365
5369
|
autoFocus: !0,
|
|
5366
5370
|
label: c ? a.editComment : a.addComment,
|
|
5367
5371
|
name: `comment-${e.fileId}`,
|
|
@@ -5394,8 +5398,8 @@ var ji = "comments", Mi = (e, t) => {
|
|
|
5394
5398
|
children: a.cancel
|
|
5395
5399
|
})
|
|
5396
5400
|
] });
|
|
5397
|
-
},
|
|
5398
|
-
let { strings: i } = s(
|
|
5401
|
+
}, Fi = ({ comment: e, disabled: t, onDeleteComment: n, onEditComment: r }) => {
|
|
5402
|
+
let { strings: i } = s(Oi);
|
|
5399
5403
|
return /* @__PURE__ */ _("div", {
|
|
5400
5404
|
className: "pkt-fileupload__queue-display__item__comments",
|
|
5401
5405
|
children: /* @__PURE__ */ v("div", {
|
|
@@ -5408,7 +5412,7 @@ var ji = "comments", Mi = (e, t) => {
|
|
|
5408
5412
|
children: e.text
|
|
5409
5413
|
}), /* @__PURE__ */ _("time", {
|
|
5410
5414
|
className: "pkt-fileupload__queue-display__item__comment__time",
|
|
5411
|
-
children:
|
|
5415
|
+
children: Ni(e.timestamp, i)
|
|
5412
5416
|
})]
|
|
5413
5417
|
}), /* @__PURE__ */ v("div", {
|
|
5414
5418
|
className: "pkt-fileupload__queue-display__item__comment__actions",
|
|
@@ -5430,47 +5434,47 @@ var ji = "comments", Mi = (e, t) => {
|
|
|
5430
5434
|
})]
|
|
5431
5435
|
})
|
|
5432
5436
|
});
|
|
5433
|
-
},
|
|
5434
|
-
let t = s(
|
|
5437
|
+
}, Ii = ({ comments: e }) => {
|
|
5438
|
+
let t = s(Oi);
|
|
5435
5439
|
return /* @__PURE__ */ _("input", {
|
|
5436
5440
|
type: "hidden",
|
|
5437
5441
|
name: `${t.name}-comments`,
|
|
5438
5442
|
value: e ? JSON.stringify(e) : ""
|
|
5439
5443
|
});
|
|
5440
|
-
},
|
|
5444
|
+
}, Li = (e) => e.getAttribute(Mi) ?? [], Ri = (e) => ({
|
|
5441
5445
|
id: "comment",
|
|
5442
|
-
title: (t) => (t.attributes?.[
|
|
5446
|
+
title: (t) => (t.attributes?.[Mi] ?? []).length > 0 ? "" : e.addComment,
|
|
5443
5447
|
ariaLabel: e.addComment,
|
|
5444
5448
|
renderExtendedUI: (e) => {
|
|
5445
|
-
let t =
|
|
5446
|
-
return /* @__PURE__ */ _(
|
|
5449
|
+
let t = Li(e)[0];
|
|
5450
|
+
return /* @__PURE__ */ _(Pi, {
|
|
5447
5451
|
fileItem: e.file,
|
|
5448
5452
|
disabled: e.disabled,
|
|
5449
5453
|
closeOperationUi: e.close,
|
|
5450
5454
|
onAddComment: (t) => {
|
|
5451
|
-
e.setAttribute(
|
|
5455
|
+
e.setAttribute(Mi, [t]);
|
|
5452
5456
|
},
|
|
5453
5457
|
existingComment: t
|
|
5454
5458
|
});
|
|
5455
5459
|
},
|
|
5456
5460
|
renderContent: (e) => {
|
|
5457
5461
|
if (e.isActive) return null;
|
|
5458
|
-
let t =
|
|
5459
|
-
return t ? /* @__PURE__ */ _(
|
|
5462
|
+
let t = Li(e)[0];
|
|
5463
|
+
return t ? /* @__PURE__ */ _(Fi, {
|
|
5460
5464
|
comment: t,
|
|
5461
5465
|
disabled: e.disabled,
|
|
5462
5466
|
onEditComment: e.activate,
|
|
5463
|
-
onDeleteComment: () => e.setAttribute(
|
|
5467
|
+
onDeleteComment: () => e.setAttribute(Mi, void 0)
|
|
5464
5468
|
}) : null;
|
|
5465
5469
|
},
|
|
5466
|
-
renderHidden: (e) => /* @__PURE__ */ _(
|
|
5467
|
-
}),
|
|
5470
|
+
renderHidden: (e) => /* @__PURE__ */ _(Ii, { comments: e.getAttribute(Mi) }, `comments${e.file.fileId}`)
|
|
5471
|
+
}), zi = (e, t) => ({
|
|
5468
5472
|
id: "remove",
|
|
5469
5473
|
title: t.remove,
|
|
5470
5474
|
ariaLabel: t.removeFile,
|
|
5471
5475
|
onClick: ({ file: t }) => e(t.fileId)
|
|
5472
|
-
}),
|
|
5473
|
-
let { strings: i } = s(
|
|
5476
|
+
}), Bi = ({ initialValue: e, disabled: t, onSave: n, onCancel: r }) => {
|
|
5477
|
+
let { strings: i } = s(Oi), a = p(null), o = l(), c = () => n(a.current?.value ?? "");
|
|
5474
5478
|
return /* @__PURE__ */ v(g, { children: [
|
|
5475
5479
|
/* @__PURE__ */ _("label", {
|
|
5476
5480
|
htmlFor: o,
|
|
@@ -5504,19 +5508,19 @@ var ji = "comments", Mi = (e, t) => {
|
|
|
5504
5508
|
children: i.cancel
|
|
5505
5509
|
})
|
|
5506
5510
|
] });
|
|
5507
|
-
},
|
|
5508
|
-
let t = s(
|
|
5511
|
+
}, Vi = ({ targetFilename: e }) => {
|
|
5512
|
+
let t = s(Oi);
|
|
5509
5513
|
return /* @__PURE__ */ _("input", {
|
|
5510
5514
|
type: "hidden",
|
|
5511
5515
|
name: `${t.name}-targetFilename`,
|
|
5512
5516
|
value: e
|
|
5513
5517
|
});
|
|
5514
|
-
},
|
|
5518
|
+
}, Hi = (e) => e.getAttribute("targetFilename") || wi(e.file, ""), Ui = (e) => ({
|
|
5515
5519
|
id: "rename",
|
|
5516
5520
|
title: e.rename,
|
|
5517
5521
|
ariaLabel: e.renameFile,
|
|
5518
|
-
renderInlineUI: (e) => /* @__PURE__ */ _(
|
|
5519
|
-
initialValue:
|
|
5522
|
+
renderInlineUI: (e) => /* @__PURE__ */ _(Bi, {
|
|
5523
|
+
initialValue: Hi(e),
|
|
5520
5524
|
disabled: e.disabled,
|
|
5521
5525
|
onSave: (t) => {
|
|
5522
5526
|
let n = t.trim();
|
|
@@ -5524,8 +5528,8 @@ var ji = "comments", Mi = (e, t) => {
|
|
|
5524
5528
|
},
|
|
5525
5529
|
onCancel: e.close
|
|
5526
5530
|
}),
|
|
5527
|
-
renderHidden: (e) => /* @__PURE__ */ _(
|
|
5528
|
-
}),
|
|
5531
|
+
renderHidden: (e) => /* @__PURE__ */ _(Vi, { targetFilename: Hi(e) }, `rename${e.file.fileId}`)
|
|
5532
|
+
}), Wi = (e, t) => {
|
|
5529
5533
|
let n = o((t, n) => e.find((e) => e.fileId === t)?.attributes?.[n], [e]), r = o((n, r, i) => {
|
|
5530
5534
|
let a = e.find((e) => e.fileId === n);
|
|
5531
5535
|
if (!a) return;
|
|
@@ -5545,7 +5549,7 @@ var ji = "comments", Mi = (e, t) => {
|
|
|
5545
5549
|
setAttribute: (t, n) => r(e, t, n)
|
|
5546
5550
|
}), [n, r])
|
|
5547
5551
|
};
|
|
5548
|
-
},
|
|
5552
|
+
}, Gi = (e) => {
|
|
5549
5553
|
let [t, n] = m(!1), [r, i] = m(0), a = p(null);
|
|
5550
5554
|
return {
|
|
5551
5555
|
isOpen: t,
|
|
@@ -5559,10 +5563,10 @@ var ji = "comments", Mi = (e, t) => {
|
|
|
5559
5563
|
n(!1), a.current?.close();
|
|
5560
5564
|
}, []),
|
|
5561
5565
|
navigate: o((t) => {
|
|
5562
|
-
e.length !== 0 && i((n) =>
|
|
5566
|
+
e.length !== 0 && i((n) => xi(n, t, e.length));
|
|
5563
5567
|
}, [e.length])
|
|
5564
5568
|
};
|
|
5565
|
-
},
|
|
5569
|
+
}, Ki = (e) => {
|
|
5566
5570
|
let [t, n] = m(null);
|
|
5567
5571
|
return c(() => {
|
|
5568
5572
|
if (!e?.type.startsWith("image/")) return;
|
|
@@ -5572,7 +5576,7 @@ var ji = "comments", Mi = (e, t) => {
|
|
|
5572
5576
|
url: t
|
|
5573
5577
|
}), () => URL.revokeObjectURL(t);
|
|
5574
5578
|
}, [e]), t && t.file === e ? t.url : null;
|
|
5575
|
-
},
|
|
5579
|
+
}, qi = (e) => {
|
|
5576
5580
|
let [t, n] = m({}), [r, i] = m(e);
|
|
5577
5581
|
if (e !== r) {
|
|
5578
5582
|
i(e);
|
|
@@ -5598,7 +5602,7 @@ var ji = "comments", Mi = (e, t) => {
|
|
|
5598
5602
|
});
|
|
5599
5603
|
}, [])
|
|
5600
5604
|
};
|
|
5601
|
-
},
|
|
5605
|
+
}, Ji = (e, { uploadStrategy: t, required: n, currentFileCount: r, onMissingFiles: i }) => {
|
|
5602
5606
|
c(() => {
|
|
5603
5607
|
if (t !== "custom" || !n) return;
|
|
5604
5608
|
let a = e.current?.form;
|
|
@@ -5616,8 +5620,8 @@ var ji = "comments", Mi = (e, t) => {
|
|
|
5616
5620
|
r,
|
|
5617
5621
|
i
|
|
5618
5622
|
]);
|
|
5619
|
-
},
|
|
5620
|
-
let C = f(() =>
|
|
5623
|
+
}, Yi = 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) => {
|
|
5624
|
+
let C = f(() => Zn(), []), w = i || C, T = p(null), [E, D] = m(0);
|
|
5621
5625
|
c(() => {
|
|
5622
5626
|
T.current && D(T.current.getBoundingClientRect().width || 0);
|
|
5623
5627
|
}, [h]);
|
|
@@ -5668,41 +5672,41 @@ var ji = "comments", Mi = (e, t) => {
|
|
|
5668
5672
|
})
|
|
5669
5673
|
});
|
|
5670
5674
|
});
|
|
5671
|
-
|
|
5675
|
+
Yi.displayName = "PktProgressbar";
|
|
5672
5676
|
//#endregion
|
|
5673
5677
|
//#region ../../shared-utils/scroll-lock/index.ts
|
|
5674
|
-
var
|
|
5678
|
+
var Xi = "is-scroll-locked", Zi = 0, Qi = 0, $i = () => typeof document < "u" && typeof window < "u", ea = () => {
|
|
5675
5679
|
let e = document.body, t = document.documentElement;
|
|
5676
|
-
|
|
5680
|
+
Qi = window.scrollY || window.pageYOffset;
|
|
5677
5681
|
let n = window.innerWidth - t.clientWidth;
|
|
5678
|
-
n > 0 && (e.style.paddingRight = `${n}px`), e.style.position = "fixed", e.style.top = `-${
|
|
5679
|
-
}, ea = () => {
|
|
5680
|
-
let e = document.body, t = document.documentElement;
|
|
5681
|
-
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(Yi), typeof window.scrollTo == "function" && window.scrollTo({ top: Zi });
|
|
5682
|
+
n > 0 && (e.style.paddingRight = `${n}px`), e.style.position = "fixed", e.style.top = `-${Qi}px`, e.style.left = "0", e.style.right = "0", e.style.width = "100%", e.style.overflow = "hidden", t.classList.add(Xi);
|
|
5682
5683
|
}, ta = () => {
|
|
5683
|
-
|
|
5684
|
+
let e = document.body, t = document.documentElement;
|
|
5685
|
+
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(Xi), typeof window.scrollTo == "function" && window.scrollTo({ top: Qi });
|
|
5684
5686
|
}, na = () => {
|
|
5685
|
-
|
|
5686
|
-
}, ra = () =>
|
|
5687
|
-
|
|
5688
|
-
},
|
|
5689
|
-
|
|
5687
|
+
$i() && (Zi += 1, Zi === 1 && ea());
|
|
5688
|
+
}, ra = () => {
|
|
5689
|
+
!$i() || Zi === 0 || (--Zi, Zi === 0 && ta());
|
|
5690
|
+
}, ia = () => ({ locked: !1 }), aa = (e, t) => {
|
|
5691
|
+
e.locked !== t && (e.locked = t, t ? na() : ra());
|
|
5692
|
+
}, oa = 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, strings: g, ...y }, b) => {
|
|
5693
|
+
let x = ve(["generic"], g), S = p(null), C = p(ia()), w = o((e) => {
|
|
5690
5694
|
S.current = e, typeof b == "function" ? b(e) : b && (b.current = e);
|
|
5691
5695
|
}, [b]), T = o(() => {
|
|
5692
|
-
S.current?.open && (S.current.close(),
|
|
5696
|
+
S.current?.open && (S.current.close(), aa(C.current, !1), h?.());
|
|
5693
5697
|
}, [h]);
|
|
5694
5698
|
c(() => {
|
|
5695
|
-
n ? (S.current?.open || S.current?.showModal(),
|
|
5699
|
+
n ? (S.current?.open || S.current?.showModal(), aa(C.current, !0)) : (S.current?.open && S.current.close(), aa(C.current, !1));
|
|
5696
5700
|
}, [n]), c(() => {
|
|
5697
5701
|
let e = C.current;
|
|
5698
5702
|
return () => {
|
|
5699
|
-
|
|
5703
|
+
aa(e, !1);
|
|
5700
5704
|
};
|
|
5701
5705
|
}, []);
|
|
5702
5706
|
let E = o((e) => {
|
|
5703
5707
|
a && e.target === S.current && T();
|
|
5704
5708
|
}, [a, T]), D = o(() => {
|
|
5705
|
-
|
|
5709
|
+
aa(C.current, !1), h?.();
|
|
5706
5710
|
}, [h]), O = u === "blue", k = (0, M.default)({
|
|
5707
5711
|
"pkt-modal": !0,
|
|
5708
5712
|
"pkt-modal--removePadding": l,
|
|
@@ -5756,11 +5760,11 @@ var Yi = "is-scroll-locked", Xi = 0, Zi = 0, Qi = () => typeof document < "u" &&
|
|
|
5756
5760
|
})
|
|
5757
5761
|
});
|
|
5758
5762
|
});
|
|
5759
|
-
|
|
5763
|
+
oa.displayName = "PktModal";
|
|
5760
5764
|
//#endregion
|
|
5761
5765
|
//#region src/components/fileupload/Truncate.tsx
|
|
5762
|
-
var
|
|
5763
|
-
let n = s(
|
|
5766
|
+
var sa = n({ tail: 5 }), ca = ({ children: e, tail: t }) => {
|
|
5767
|
+
let n = s(sa), r = bi(e, t === void 0 ? n.tail : t);
|
|
5764
5768
|
return r ? /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _("span", {
|
|
5765
5769
|
className: "pkt-fileupload__queue-display__item__title__head",
|
|
5766
5770
|
"data-pkt-truncate-part": "first",
|
|
@@ -5773,8 +5777,8 @@ var oa = n({ tail: 5 }), sa = ({ children: e, tail: t }) => {
|
|
|
5773
5777
|
"data-pkt-truncate-part": "first",
|
|
5774
5778
|
children: e
|
|
5775
5779
|
});
|
|
5776
|
-
},
|
|
5777
|
-
let { strings: t } = s(
|
|
5780
|
+
}, la = (e) => {
|
|
5781
|
+
let { strings: t } = s(Oi);
|
|
5778
5782
|
return /* @__PURE__ */ _("button", {
|
|
5779
5783
|
type: "button",
|
|
5780
5784
|
onClick: e.onClick,
|
|
@@ -5783,15 +5787,15 @@ var oa = n({ tail: 5 }), sa = ({ children: e, tail: t }) => {
|
|
|
5783
5787
|
"aria-label": e.ariaLabel || t.cancelUpload,
|
|
5784
5788
|
children: e.label || t.cancel
|
|
5785
5789
|
});
|
|
5786
|
-
},
|
|
5787
|
-
let { strings: e } = s(
|
|
5790
|
+
}, ua = () => {
|
|
5791
|
+
let { strings: e } = s(Oi);
|
|
5788
5792
|
return /* @__PURE__ */ _("span", {
|
|
5789
5793
|
className: "pkt-fileupload__queue-display__item__loading-text",
|
|
5790
5794
|
"aria-label": e.uploadingFile,
|
|
5791
5795
|
children: e.uploading
|
|
5792
5796
|
});
|
|
5793
|
-
},
|
|
5794
|
-
let { strings: r } = s(
|
|
5797
|
+
}, da = ({ cancelTransfer: e, transferItem: t, disabled: n = !1 }) => {
|
|
5798
|
+
let { strings: r } = s(Oi), i = t.showProgress ?? t.progress !== 0;
|
|
5795
5799
|
return /* @__PURE__ */ v(g, { children: [
|
|
5796
5800
|
/* @__PURE__ */ _(L, {
|
|
5797
5801
|
name: "document-text",
|
|
@@ -5801,21 +5805,21 @@ var oa = n({ tail: 5 }), sa = ({ children: e, tail: t }) => {
|
|
|
5801
5805
|
/* @__PURE__ */ v("p", {
|
|
5802
5806
|
className: "pkt-fileupload__queue-display__item__title",
|
|
5803
5807
|
"aria-label": r.filename,
|
|
5804
|
-
children: [/* @__PURE__ */ _(
|
|
5808
|
+
children: [/* @__PURE__ */ _(ca, { children: wi(t) }), /* @__PURE__ */ v("span", {
|
|
5805
5809
|
className: "pkt-fileupload__queue-display__item__filesize",
|
|
5806
5810
|
children: [
|
|
5807
5811
|
" ",
|
|
5808
5812
|
"(",
|
|
5809
|
-
|
|
5813
|
+
ri(t.file.size),
|
|
5810
5814
|
")"
|
|
5811
5815
|
]
|
|
5812
5816
|
})]
|
|
5813
5817
|
}),
|
|
5814
|
-
/* @__PURE__ */ _(
|
|
5818
|
+
/* @__PURE__ */ _(la, {
|
|
5815
5819
|
onClick: e,
|
|
5816
5820
|
disabled: n
|
|
5817
5821
|
}),
|
|
5818
|
-
i ? /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _(
|
|
5822
|
+
i ? /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _(Yi, {
|
|
5819
5823
|
valueCurrent: t.progress * 100,
|
|
5820
5824
|
statusType: "none",
|
|
5821
5825
|
valueMax: 100,
|
|
@@ -5825,34 +5829,34 @@ var oa = n({ tail: 5 }), sa = ({ children: e, tail: t }) => {
|
|
|
5825
5829
|
className: "pkt-fileupload__queue-display__item__percentage",
|
|
5826
5830
|
"aria-hidden": "true",
|
|
5827
5831
|
children: `${Math.round(t.progress * 100)}%`
|
|
5828
|
-
})] }) : /* @__PURE__ */ _(
|
|
5832
|
+
})] }) : /* @__PURE__ */ _(ua, {})
|
|
5829
5833
|
] });
|
|
5830
|
-
},
|
|
5834
|
+
}, fa = ({ transferItem: e }) => /* @__PURE__ */ v("p", {
|
|
5831
5835
|
className: "pkt-fileupload__queue-display__item__title",
|
|
5832
|
-
children: [/* @__PURE__ */ _(
|
|
5836
|
+
children: [/* @__PURE__ */ _(ca, { children: wi(e) }), e.file && /* @__PURE__ */ v("span", {
|
|
5833
5837
|
className: "pkt-fileupload__queue-display__item__filesize",
|
|
5834
5838
|
children: [
|
|
5835
5839
|
" (",
|
|
5836
|
-
|
|
5840
|
+
ri(e.file.size),
|
|
5837
5841
|
")"
|
|
5838
5842
|
]
|
|
5839
5843
|
})]
|
|
5840
|
-
}),
|
|
5841
|
-
let { strings: r } = s(
|
|
5844
|
+
}), pa = ({ transferItem: e, onRemove: t, disabled: n }) => {
|
|
5845
|
+
let { strings: r } = s(Oi), i = (e.lastProgress ?? 1) * 100;
|
|
5842
5846
|
return /* @__PURE__ */ v(g, { children: [
|
|
5843
5847
|
/* @__PURE__ */ _(L, {
|
|
5844
5848
|
className: "pkt-fileupload__queue-display__item__icon pkt-icon--medium",
|
|
5845
5849
|
name: "alert-error",
|
|
5846
5850
|
"aria-hidden": "true"
|
|
5847
5851
|
}),
|
|
5848
|
-
/* @__PURE__ */ _(
|
|
5849
|
-
/* @__PURE__ */ _(
|
|
5852
|
+
/* @__PURE__ */ _(fa, { transferItem: e }),
|
|
5853
|
+
/* @__PURE__ */ _(la, {
|
|
5850
5854
|
onClick: t,
|
|
5851
5855
|
label: r.removeFailed,
|
|
5852
5856
|
ariaLabel: r.removeFailedFile,
|
|
5853
5857
|
disabled: n
|
|
5854
5858
|
}),
|
|
5855
|
-
/* @__PURE__ */ _(
|
|
5859
|
+
/* @__PURE__ */ _(Yi, {
|
|
5856
5860
|
valueCurrent: i,
|
|
5857
5861
|
statusType: "none",
|
|
5858
5862
|
valueMax: 100,
|
|
@@ -5864,16 +5868,16 @@ var oa = n({ tail: 5 }), sa = ({ children: e, tail: t }) => {
|
|
|
5864
5868
|
children: e.errorMessage
|
|
5865
5869
|
})
|
|
5866
5870
|
] });
|
|
5867
|
-
},
|
|
5868
|
-
let { strings: r } = s(
|
|
5871
|
+
}, ma = ({ transferItem: e, onRemove: t, disabled: n }) => {
|
|
5872
|
+
let { strings: r } = s(Oi);
|
|
5869
5873
|
return /* @__PURE__ */ v(g, { children: [
|
|
5870
5874
|
/* @__PURE__ */ _(L, {
|
|
5871
5875
|
className: "pkt-fileupload__queue-display__item__icon pkt-icon--medium",
|
|
5872
5876
|
name: "alert-error",
|
|
5873
5877
|
"aria-hidden": "true"
|
|
5874
5878
|
}),
|
|
5875
|
-
/* @__PURE__ */ _(
|
|
5876
|
-
/* @__PURE__ */ _(
|
|
5879
|
+
/* @__PURE__ */ _(fa, { transferItem: e }),
|
|
5880
|
+
/* @__PURE__ */ _(la, {
|
|
5877
5881
|
onClick: t,
|
|
5878
5882
|
label: r.removeFailed,
|
|
5879
5883
|
ariaLabel: r.removeFailedFile,
|
|
@@ -5884,15 +5888,15 @@ var oa = n({ tail: 5 }), sa = ({ children: e, tail: t }) => {
|
|
|
5884
5888
|
children: e.errorMessage
|
|
5885
5889
|
})
|
|
5886
5890
|
] });
|
|
5887
|
-
},
|
|
5891
|
+
}, ha = ({ transferItem: e, onRemove: t, disabled: n }) => e.showProgress ? /* @__PURE__ */ _(pa, {
|
|
5888
5892
|
transferItem: e,
|
|
5889
5893
|
onRemove: t,
|
|
5890
5894
|
disabled: n
|
|
5891
|
-
}) : /* @__PURE__ */ _(
|
|
5895
|
+
}) : /* @__PURE__ */ _(ma, {
|
|
5892
5896
|
transferItem: e,
|
|
5893
5897
|
onRemove: t,
|
|
5894
5898
|
disabled: n
|
|
5895
|
-
}),
|
|
5899
|
+
}), ga = ({ operation: e, context: t }) => {
|
|
5896
5900
|
let n = typeof e.title == "function" ? e.title(t.file) : e.title;
|
|
5897
5901
|
return n ? /* @__PURE__ */ _("button", {
|
|
5898
5902
|
type: "button",
|
|
@@ -5904,12 +5908,12 @@ var oa = n({ tail: 5 }), sa = ({ children: e, tail: t }) => {
|
|
|
5904
5908
|
"aria-label": typeof e.ariaLabel == "function" ? e.ariaLabel(t.file) : e.ariaLabel,
|
|
5905
5909
|
children: n
|
|
5906
5910
|
}) : null;
|
|
5907
|
-
},
|
|
5911
|
+
}, _a = ({ transferItem: e }) => /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _(L, {
|
|
5908
5912
|
name: "document-text",
|
|
5909
5913
|
className: "pkt-fileupload__queue-display__item__icon pkt-icon--medium",
|
|
5910
5914
|
"aria-hidden": "true"
|
|
5911
|
-
}), /* @__PURE__ */ _(
|
|
5912
|
-
let { strings: n } = s(
|
|
5915
|
+
}), /* @__PURE__ */ _(fa, { transferItem: e })] }), va = ({ transferItem: e, onPreviewClick: t }) => {
|
|
5916
|
+
let { strings: n } = s(Oi), r = Ki(e.file), [i, a] = m(null), o = !!r && i === r, c = r && !o && /* @__PURE__ */ _("img", {
|
|
5913
5917
|
src: r,
|
|
5914
5918
|
alt: e.attributes.targetFilename,
|
|
5915
5919
|
onError: () => a(r)
|
|
@@ -5932,16 +5936,16 @@ var oa = n({ tail: 5 }), sa = ({ children: e, tail: t }) => {
|
|
|
5932
5936
|
}), c]
|
|
5933
5937
|
}), /* @__PURE__ */ _("span", {
|
|
5934
5938
|
className: "pkt-fileupload__queue-display__item__thumbnail__title",
|
|
5935
|
-
children: /* @__PURE__ */ _(
|
|
5939
|
+
children: /* @__PURE__ */ _(ca, { children: e.attributes.targetFilename })
|
|
5936
5940
|
})]
|
|
5937
5941
|
});
|
|
5938
|
-
},
|
|
5939
|
-
let { strings: o } = s(
|
|
5942
|
+
}, ya = ({ isOpen: e, images: t, currentIndex: n, onClose: r, onNavigate: i, modalRef: a }) => {
|
|
5943
|
+
let { strings: o } = s(Oi), l = t[n], u = t.length > 1, d = Ki(l?.file), [f, p] = m(null), h = !!d && f === d;
|
|
5940
5944
|
return c(() => {
|
|
5941
5945
|
if (!e) return;
|
|
5942
5946
|
let t = (e) => {
|
|
5943
5947
|
if (e.key === "Tab") {
|
|
5944
|
-
|
|
5948
|
+
yi(e, a.current);
|
|
5945
5949
|
return;
|
|
5946
5950
|
}
|
|
5947
5951
|
switch (e.key) {
|
|
@@ -5960,7 +5964,7 @@ var oa = n({ tail: 5 }), sa = ({ children: e, tail: t }) => {
|
|
|
5960
5964
|
i,
|
|
5961
5965
|
r,
|
|
5962
5966
|
a
|
|
5963
|
-
]), l ? /* @__PURE__ */ _(
|
|
5967
|
+
]), l ? /* @__PURE__ */ _(oa, {
|
|
5964
5968
|
ref: a,
|
|
5965
5969
|
headingText: l.attributes.targetFilename,
|
|
5966
5970
|
closeOnBackdropClick: !0,
|
|
@@ -6020,7 +6024,7 @@ var oa = n({ tail: 5 }), sa = ({ children: e, tail: t }) => {
|
|
|
6020
6024
|
]
|
|
6021
6025
|
})
|
|
6022
6026
|
}) : null;
|
|
6023
|
-
},
|
|
6027
|
+
}, ba = ({ operation: e, transferItem: t, inputName: n, disabled: r, activatedOperation: i, onActivate: a, onClose: o, buildAttributeAccessors: s }) => {
|
|
6024
6028
|
let c = s(t.fileId);
|
|
6025
6029
|
return {
|
|
6026
6030
|
file: t,
|
|
@@ -6032,29 +6036,29 @@ var oa = n({ tail: 5 }), sa = ({ children: e, tail: t }) => {
|
|
|
6032
6036
|
getAttribute: c.getAttribute,
|
|
6033
6037
|
setAttribute: c.setAttribute
|
|
6034
6038
|
};
|
|
6035
|
-
},
|
|
6039
|
+
}, xa = (e, t) => e.map((e) => ({
|
|
6036
6040
|
operation: e,
|
|
6037
|
-
context:
|
|
6041
|
+
context: ba({
|
|
6038
6042
|
operation: e,
|
|
6039
6043
|
...t
|
|
6040
6044
|
})
|
|
6041
|
-
})),
|
|
6042
|
-
let t =
|
|
6045
|
+
})), Sa = (e) => {
|
|
6046
|
+
let t = xa(e.operations, e);
|
|
6043
6047
|
return /* @__PURE__ */ _("div", {
|
|
6044
6048
|
className: "pkt-fileupload__queue-display__item__actions",
|
|
6045
|
-
children: t.filter(({ operation: t }) => t.id !== e.activatedOperation?.id).map(({ operation: e, context: t }) => /* @__PURE__ */ _(
|
|
6049
|
+
children: t.filter(({ operation: t }) => t.id !== e.activatedOperation?.id).map(({ operation: e, context: t }) => /* @__PURE__ */ _(ga, {
|
|
6046
6050
|
operation: e,
|
|
6047
6051
|
context: t
|
|
6048
6052
|
}, e.id))
|
|
6049
6053
|
});
|
|
6050
|
-
},
|
|
6051
|
-
let t =
|
|
6054
|
+
}, Ca = (e) => {
|
|
6055
|
+
let t = xa(e.operations, e);
|
|
6052
6056
|
return /* @__PURE__ */ _(g, { children: t.filter(({ operation: e }) => e.renderContent).map(({ operation: e, context: t }) => /* @__PURE__ */ _("div", {
|
|
6053
6057
|
className: "pkt-fileupload__queue-display__item__operation-content",
|
|
6054
6058
|
children: e.renderContent(t)
|
|
6055
6059
|
}, e.id)) });
|
|
6056
|
-
},
|
|
6057
|
-
let { transferItem: t, activatedOperation: n, operations: r, ItemRenderer: i, onPreviewClick: a } = e, o = n ?
|
|
6060
|
+
}, wa = (e) => {
|
|
6061
|
+
let { transferItem: t, activatedOperation: n, operations: r, ItemRenderer: i, onPreviewClick: a } = e, o = n ? ba({
|
|
6058
6062
|
operation: n,
|
|
6059
6063
|
...e
|
|
6060
6064
|
}) : void 0, s = n?.renderInlineUI || n?.renderExtendedUI ? [] : r;
|
|
@@ -6070,43 +6074,43 @@ var oa = n({ tail: 5 }), sa = ({ children: e, tail: t }) => {
|
|
|
6070
6074
|
queueItemOperations: r,
|
|
6071
6075
|
onPreviewClick: a
|
|
6072
6076
|
}),
|
|
6073
|
-
s.length > 0 && /* @__PURE__ */ _(
|
|
6077
|
+
s.length > 0 && /* @__PURE__ */ _(Sa, {
|
|
6074
6078
|
...e,
|
|
6075
6079
|
operations: s
|
|
6076
6080
|
}),
|
|
6077
|
-
/* @__PURE__ */ _(
|
|
6081
|
+
/* @__PURE__ */ _(Ca, { ...e }),
|
|
6078
6082
|
n?.renderExtendedUI && o && /* @__PURE__ */ _("div", {
|
|
6079
6083
|
className: "pkt-fileupload__queue-display__item__expanded-operation-ui",
|
|
6080
6084
|
children: n.renderExtendedUI(o)
|
|
6081
6085
|
})
|
|
6082
6086
|
] });
|
|
6083
|
-
},
|
|
6084
|
-
let { transferItem: t, enableImagePreview: n, onCancelTransfer: r, onOpenPreview: i, disabled: a } = e, o =
|
|
6087
|
+
}, Ta = (e) => {
|
|
6088
|
+
let { transferItem: t, enableImagePreview: n, onCancelTransfer: r, onOpenPreview: i, disabled: a } = e, o = di(t.progress), s = n && t.progress === "done" && ui(t);
|
|
6085
6089
|
switch (o) {
|
|
6086
|
-
case "in-progress": return /* @__PURE__ */ _(
|
|
6090
|
+
case "in-progress": return /* @__PURE__ */ _(da, {
|
|
6087
6091
|
transferItem: t,
|
|
6088
6092
|
cancelTransfer: () => r(t.fileId),
|
|
6089
6093
|
disabled: a
|
|
6090
6094
|
});
|
|
6091
|
-
case "error": return /* @__PURE__ */ _(
|
|
6095
|
+
case "error": return /* @__PURE__ */ _(ha, {
|
|
6092
6096
|
transferItem: t,
|
|
6093
6097
|
onRemove: () => r(t.fileId),
|
|
6094
6098
|
disabled: a
|
|
6095
6099
|
});
|
|
6096
|
-
case "idle": return /* @__PURE__ */ _(
|
|
6100
|
+
case "idle": return /* @__PURE__ */ _(wa, {
|
|
6097
6101
|
...e,
|
|
6098
6102
|
onPreviewClick: s ? () => i(t.fileId) : void 0
|
|
6099
6103
|
});
|
|
6100
6104
|
}
|
|
6101
|
-
},
|
|
6105
|
+
}, Ea = (e, t, n) => f(() => fi(e, t, n), [
|
|
6102
6106
|
e,
|
|
6103
6107
|
t,
|
|
6104
6108
|
n
|
|
6105
|
-
]),
|
|
6106
|
-
let d =
|
|
6109
|
+
]), Da = (e, t) => f(() => t ? e.filter((e) => e.progress === "done" && ui(e)) : [], [e, t]), Oa = ({ files: e, cancelTransfer: t, transfers: n = [], queueItemOperations: r = [], ItemRenderer: i = _a, truncateTail: a, enableImagePreview: o = !1, uploadStrategy: s = "form", disabled: c = !1, inputName: l, buildAttributeAccessors: u }) => {
|
|
6110
|
+
let d = Ea(e, n, s), f = Da(d, o), p = qi(r), m = Gi(f);
|
|
6107
6111
|
return /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _("ul", {
|
|
6108
6112
|
className: "pkt-fileupload__queue-display",
|
|
6109
|
-
children: /* @__PURE__ */ _(
|
|
6113
|
+
children: /* @__PURE__ */ _(sa.Provider, {
|
|
6110
6114
|
value: { tail: a },
|
|
6111
6115
|
children: d.map((e) => {
|
|
6112
6116
|
let n = {
|
|
@@ -6124,10 +6128,10 @@ var oa = n({ tail: 5 }), sa = ({ children: e, tail: t }) => {
|
|
|
6124
6128
|
"pkt-fileupload__queue-display__item--in-progress": typeof e.progress == "number",
|
|
6125
6129
|
[`pkt-fileupload__queue-display__item--${e.progress}`]: typeof e.progress == "string"
|
|
6126
6130
|
}),
|
|
6127
|
-
children: [r.filter((e) => e.renderHidden).map((t) => /* @__PURE__ */ _("span", { children: t.renderHidden(
|
|
6131
|
+
children: [r.filter((e) => e.renderHidden).map((t) => /* @__PURE__ */ _("span", { children: t.renderHidden(ba({
|
|
6128
6132
|
operation: t,
|
|
6129
6133
|
...n
|
|
6130
|
-
})) }, `${t.id}-${e.fileId}`)), /* @__PURE__ */ _(
|
|
6134
|
+
})) }, `${t.id}-${e.fileId}`)), /* @__PURE__ */ _(Ta, {
|
|
6131
6135
|
...n,
|
|
6132
6136
|
ItemRenderer: i,
|
|
6133
6137
|
enableImagePreview: o,
|
|
@@ -6137,7 +6141,7 @@ var oa = n({ tail: 5 }), sa = ({ children: e, tail: t }) => {
|
|
|
6137
6141
|
}, e.fileId);
|
|
6138
6142
|
})
|
|
6139
6143
|
})
|
|
6140
|
-
}), o && f.length > 0 && /* @__PURE__ */ _(
|
|
6144
|
+
}), o && f.length > 0 && /* @__PURE__ */ _(ya, {
|
|
6141
6145
|
modalRef: m.modalRef,
|
|
6142
6146
|
isOpen: m.isOpen,
|
|
6143
6147
|
images: f,
|
|
@@ -6145,10 +6149,10 @@ var oa = n({ tail: 5 }), sa = ({ children: e, tail: t }) => {
|
|
|
6145
6149
|
onClose: m.close,
|
|
6146
6150
|
onNavigate: m.navigate
|
|
6147
6151
|
})] });
|
|
6148
|
-
},
|
|
6149
|
-
filename:
|
|
6150
|
-
thumbnail:
|
|
6151
|
-
},
|
|
6152
|
+
}, ka = {
|
|
6153
|
+
filename: _a,
|
|
6154
|
+
thumbnail: va
|
|
6155
|
+
}, Aa = 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 = ka.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) => {
|
|
6152
6156
|
let z = l(), ue = n ?? `pkt-fileupload-${z}`, de = p(null);
|
|
6153
6157
|
u(ce, () => de.current, []);
|
|
6154
6158
|
let V = "transfers" in R ? R.transfers : void 0, H = ve(["fileupload"], L).fileupload, [U, W] = m(null), [G, K] = m("");
|
|
@@ -6162,7 +6166,7 @@ var oa = n({ tail: 5 }), sa = ({ children: e, tail: t }) => {
|
|
|
6162
6166
|
N ? `${ue}-helptext` : void 0,
|
|
6163
6167
|
me
|
|
6164
6168
|
].filter(Boolean).join(" ") || void 0, J = pe || I === !0 || I === "true", he = o((e) => {
|
|
6165
|
-
let t =
|
|
6169
|
+
let t = li(e, {
|
|
6166
6170
|
allowedFormats: S,
|
|
6167
6171
|
maxFileSize: w,
|
|
6168
6172
|
formatErrorMessage: C,
|
|
@@ -6188,13 +6192,13 @@ var oa = n({ tail: 5 }), sa = ({ children: e, tail: t }) => {
|
|
|
6188
6192
|
]);
|
|
6189
6193
|
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");
|
|
6190
6194
|
let ge = e !== void 0, [Y, _e] = m(() => t ?? []), X = ge ? e : Y;
|
|
6191
|
-
|
|
6195
|
+
Ji(de, {
|
|
6192
6196
|
uploadStrategy: i,
|
|
6193
6197
|
required: ae,
|
|
6194
6198
|
currentFileCount: X.length,
|
|
6195
6199
|
onMissingFiles: o(() => W(H.requiredMissing), [H])
|
|
6196
6200
|
});
|
|
6197
|
-
let Z = typeof b == "string" ?
|
|
6201
|
+
let Z = typeof b == "string" ? ka[b] : b, be = b === "thumbnail", xe = typeof R.accept == "string" ? R.accept.trim() : void 0, Q = f(() => si(xe, S) || void 0, [xe, S]), Se = s && !be, Ce = a && !be, we = o((e) => {
|
|
6198
6202
|
for (let t of e) {
|
|
6199
6203
|
let e = he(t.file);
|
|
6200
6204
|
if (e) {
|
|
@@ -6234,16 +6238,16 @@ var oa = n({ tail: 5 }), sa = ({ children: e, tail: t }) => {
|
|
|
6234
6238
|
X,
|
|
6235
6239
|
R,
|
|
6236
6240
|
ge
|
|
6237
|
-
]), { buildAttributeAccessors: De } =
|
|
6241
|
+
]), { buildAttributeAccessors: De } = Wi(X, Te), Oe = f(() => {
|
|
6238
6242
|
let e = [];
|
|
6239
|
-
return Se && e.push(
|
|
6243
|
+
return Se && e.push(Ui(H)), Ce && e.push(Ri(H)), e.push(...y), e.push(zi(Ee, H)), e;
|
|
6240
6244
|
}, [
|
|
6241
6245
|
Se,
|
|
6242
6246
|
Ce,
|
|
6243
6247
|
y,
|
|
6244
6248
|
Ee,
|
|
6245
6249
|
H
|
|
6246
|
-
]), { totalCount: ke, uploadedCount: Ae, failedCount: je } = f(() =>
|
|
6250
|
+
]), { totalCount: ke, uploadedCount: Ae, failedCount: je } = f(() => Si(X, V), [X, V]), Me = le(ke, H.fileLabelOne, H.fileLabelOther), Ne = /* @__PURE__ */ _("div", {
|
|
6247
6251
|
className: (0, M.default)("pkt-fileupload", {
|
|
6248
6252
|
"pkt-fileupload--full-width": x,
|
|
6249
6253
|
"pkt-fileupload--error": pe,
|
|
@@ -6251,7 +6255,7 @@ var oa = n({ tail: 5 }), sa = ({ children: e, tail: t }) => {
|
|
|
6251
6255
|
}),
|
|
6252
6256
|
"aria-disabled": A,
|
|
6253
6257
|
...A ? { inert: !0 } : {},
|
|
6254
|
-
children: /* @__PURE__ */ v(
|
|
6258
|
+
children: /* @__PURE__ */ v(Oi.Provider, {
|
|
6255
6259
|
value: {
|
|
6256
6260
|
name: R.name || "",
|
|
6257
6261
|
multiple: !!r,
|
|
@@ -6279,7 +6283,7 @@ var oa = n({ tail: 5 }), sa = ({ children: e, tail: t }) => {
|
|
|
6279
6283
|
label: Me
|
|
6280
6284
|
})
|
|
6281
6285
|
}),
|
|
6282
|
-
/* @__PURE__ */ _(
|
|
6286
|
+
/* @__PURE__ */ _(ki, {
|
|
6283
6287
|
id: ue,
|
|
6284
6288
|
name: R.name || "",
|
|
6285
6289
|
form: R.form,
|
|
@@ -6288,7 +6292,7 @@ var oa = n({ tail: 5 }), sa = ({ children: e, tail: t }) => {
|
|
|
6288
6292
|
multiple: r,
|
|
6289
6293
|
uploadStrategy: i,
|
|
6290
6294
|
ref: de,
|
|
6291
|
-
accept: be ?
|
|
6295
|
+
accept: be ? Ci : Q,
|
|
6292
6296
|
isThumbnailView: be,
|
|
6293
6297
|
disabled: A,
|
|
6294
6298
|
required: ae && i === "form",
|
|
@@ -6307,7 +6311,7 @@ var oa = n({ tail: 5 }), sa = ({ children: e, tail: t }) => {
|
|
|
6307
6311
|
className: "pkt-fileupload__error-alert",
|
|
6308
6312
|
children: fe
|
|
6309
6313
|
}),
|
|
6310
|
-
X.length > 0 && /* @__PURE__ */ _(
|
|
6314
|
+
X.length > 0 && /* @__PURE__ */ _(Oa, {
|
|
6311
6315
|
files: X,
|
|
6312
6316
|
cancelTransfer: Ee,
|
|
6313
6317
|
truncateTail: d,
|
|
@@ -6325,7 +6329,7 @@ var oa = n({ tail: 5 }), sa = ({ children: e, tail: t }) => {
|
|
|
6325
6329
|
});
|
|
6326
6330
|
return /* @__PURE__ */ _("div", {
|
|
6327
6331
|
className: "pkt-fileupload-component",
|
|
6328
|
-
children: /* @__PURE__ */ _(
|
|
6332
|
+
children: /* @__PURE__ */ _(sr, {
|
|
6329
6333
|
strings: L,
|
|
6330
6334
|
forId: ue,
|
|
6331
6335
|
label: j ?? "",
|
|
@@ -6344,10 +6348,10 @@ var oa = n({ tail: 5 }), sa = ({ children: e, tail: t }) => {
|
|
|
6344
6348
|
})
|
|
6345
6349
|
});
|
|
6346
6350
|
});
|
|
6347
|
-
|
|
6351
|
+
Aa.displayName = "PktFileUpload";
|
|
6348
6352
|
//#endregion
|
|
6349
6353
|
//#region ../../shared-utils/header-footer/icon-map.ts
|
|
6350
|
-
var
|
|
6354
|
+
var ja = {
|
|
6351
6355
|
automat: "parking-meter",
|
|
6352
6356
|
bike: "bicycle",
|
|
6353
6357
|
corona: "virus",
|
|
@@ -6372,10 +6376,10 @@ var Aa = {
|
|
|
6372
6376
|
treatment: "processing",
|
|
6373
6377
|
"warning-triangle": "alert-warning"
|
|
6374
6378
|
};
|
|
6375
|
-
function
|
|
6376
|
-
return e && (
|
|
6379
|
+
function Ma(e) {
|
|
6380
|
+
return e && (ja[e] ?? e);
|
|
6377
6381
|
}
|
|
6378
|
-
var
|
|
6382
|
+
var Na = {
|
|
6379
6383
|
"facebook.com": "facebook",
|
|
6380
6384
|
"fb.com": "facebook",
|
|
6381
6385
|
"instagram.com": "instagram",
|
|
@@ -6383,36 +6387,36 @@ var Ma = {
|
|
|
6383
6387
|
"x.com": "x",
|
|
6384
6388
|
"github.com": "github"
|
|
6385
6389
|
};
|
|
6386
|
-
function
|
|
6390
|
+
function Pa(e) {
|
|
6387
6391
|
return e.toLowerCase().replace(/^(?:www|m)\./, "");
|
|
6388
6392
|
}
|
|
6389
|
-
function
|
|
6393
|
+
function Fa(e, t) {
|
|
6390
6394
|
if (e) try {
|
|
6391
|
-
let t =
|
|
6395
|
+
let t = Na[Pa(new URL(e).hostname)];
|
|
6392
6396
|
if (t) return t;
|
|
6393
6397
|
} catch {}
|
|
6394
6398
|
if (t) {
|
|
6395
6399
|
let e = t.trim().toLowerCase().replace(/\s+/g, "-");
|
|
6396
6400
|
if (e) {
|
|
6397
|
-
let t =
|
|
6401
|
+
let t = Ma(e);
|
|
6398
6402
|
if (t) return t;
|
|
6399
6403
|
}
|
|
6400
6404
|
}
|
|
6401
6405
|
}
|
|
6402
6406
|
//#endregion
|
|
6403
6407
|
//#region ../../shared-utils/header-footer/select-megamenu.ts
|
|
6404
|
-
var
|
|
6405
|
-
function
|
|
6406
|
-
if (e) return e[t] ?? e[
|
|
6408
|
+
var Ia = "nb-NO";
|
|
6409
|
+
function La(e, t = Ia) {
|
|
6410
|
+
if (e) return e[t] ?? e[Ia];
|
|
6407
6411
|
}
|
|
6408
6412
|
//#endregion
|
|
6409
6413
|
//#region ../../shared-utils/header-footer/external-domain.ts
|
|
6410
|
-
var
|
|
6411
|
-
function
|
|
6414
|
+
var Ra = "oslo.kommune.no", za = /\.(?:co|com|org|net|gov|edu|ac|kommune)\.[a-z]{2}$/i;
|
|
6415
|
+
function Ba(e) {
|
|
6412
6416
|
let t = e.toLowerCase().replace(/\.$/, ""), n = t.split(".");
|
|
6413
|
-
return n.length <= 2 ? t : n.slice(
|
|
6417
|
+
return n.length <= 2 ? t : n.slice(za.test(t) ? -3 : -2).join(".");
|
|
6414
6418
|
}
|
|
6415
|
-
function
|
|
6419
|
+
function Va(e) {
|
|
6416
6420
|
if (!e) return;
|
|
6417
6421
|
let t;
|
|
6418
6422
|
try {
|
|
@@ -6420,9 +6424,9 @@ function Ba(e) {
|
|
|
6420
6424
|
} catch {
|
|
6421
6425
|
return;
|
|
6422
6426
|
}
|
|
6423
|
-
if (t.protocol === "http:" || t.protocol === "https:") return
|
|
6427
|
+
if (t.protocol === "http:" || t.protocol === "https:") return Ba(t.hostname.toLowerCase().replace(/\.$/, ""));
|
|
6424
6428
|
}
|
|
6425
|
-
function
|
|
6429
|
+
function Ha(e, t = Ra) {
|
|
6426
6430
|
if (!e) return;
|
|
6427
6431
|
let n;
|
|
6428
6432
|
try {
|
|
@@ -6432,21 +6436,21 @@ function Va(e, t = La) {
|
|
|
6432
6436
|
}
|
|
6433
6437
|
if (n.protocol !== "http:" && n.protocol !== "https:") return;
|
|
6434
6438
|
let r = n.hostname.toLowerCase().replace(/\.$/, ""), i = t.toLowerCase();
|
|
6435
|
-
if (!(r === i || r.endsWith(`.${i}`))) return
|
|
6439
|
+
if (!(r === i || r.endsWith(`.${i}`))) return Ba(r);
|
|
6436
6440
|
}
|
|
6437
6441
|
//#endregion
|
|
6438
6442
|
//#region ../../shared-utils/header-footer/fetch-header-footer-data.ts
|
|
6439
|
-
var
|
|
6440
|
-
async function
|
|
6443
|
+
var Ua = /* @__PURE__ */ new Map();
|
|
6444
|
+
async function Wa(e) {
|
|
6441
6445
|
let t = await fetch(e);
|
|
6442
6446
|
if (!t.ok) throw Error(`pkt-header-menu: failed to fetch ${e} (HTTP ${t.status})`);
|
|
6443
6447
|
let n = await t.json();
|
|
6444
6448
|
if (!n || typeof n != "object") throw Error(`pkt-header-menu: ${e} returned a non-object payload`);
|
|
6445
6449
|
return n;
|
|
6446
6450
|
}
|
|
6447
|
-
function
|
|
6448
|
-
return t ? t.aborted ? Promise.reject(
|
|
6449
|
-
let i = () => r(
|
|
6451
|
+
function Ga(e, t) {
|
|
6452
|
+
return t ? t.aborted ? Promise.reject(Ka(t.reason)) : new Promise((n, r) => {
|
|
6453
|
+
let i = () => r(Ka(t.reason));
|
|
6450
6454
|
t.addEventListener("abort", i, { once: !0 }), e.then((e) => {
|
|
6451
6455
|
t.removeEventListener("abort", i), n(e);
|
|
6452
6456
|
}, (e) => {
|
|
@@ -6454,22 +6458,22 @@ function Wa(e, t) {
|
|
|
6454
6458
|
});
|
|
6455
6459
|
}) : e;
|
|
6456
6460
|
}
|
|
6457
|
-
function
|
|
6461
|
+
function Ka(e) {
|
|
6458
6462
|
return e instanceof Error ? e : new DOMException("The operation was aborted.", "AbortError");
|
|
6459
6463
|
}
|
|
6460
|
-
async function
|
|
6461
|
-
let n =
|
|
6462
|
-
return n || (n =
|
|
6464
|
+
async function qa(e = Bn, t) {
|
|
6465
|
+
let n = Ua.get(e);
|
|
6466
|
+
return n || (n = Wa(e), n.catch(() => Ua.delete(e)), Ua.set(e, n)), Ga(n, t);
|
|
6463
6467
|
}
|
|
6464
6468
|
//#endregion
|
|
6465
6469
|
//#region src/components/footer/FooterGlobal.tsx
|
|
6466
|
-
var
|
|
6467
|
-
function
|
|
6470
|
+
var Ja = "#cb-trigger";
|
|
6471
|
+
function Ya({ data: e, dataUrl: t, locale: n = "nb-NO", skipGlobal: r = !1, onDataError: i }) {
|
|
6468
6472
|
let [a, o] = m(), s = p(i);
|
|
6469
6473
|
s.current = i, c(() => {
|
|
6470
6474
|
if (e || r) return;
|
|
6471
6475
|
let n = new AbortController();
|
|
6472
|
-
return
|
|
6476
|
+
return qa(t, n.signal).then((e) => {
|
|
6473
6477
|
n.signal.aborted || o(e);
|
|
6474
6478
|
}).catch((e) => {
|
|
6475
6479
|
e.name !== "AbortError" && (console.warn("Failed to fetch header/footer data:", e), s.current?.(e));
|
|
@@ -6481,20 +6485,20 @@ function Ja({ data: e, dataUrl: t, locale: n = "nb-NO", skipGlobal: r = !1, onDa
|
|
|
6481
6485
|
]);
|
|
6482
6486
|
let l = e ?? a;
|
|
6483
6487
|
return f(() => {
|
|
6484
|
-
if (!r) return
|
|
6488
|
+
if (!r) return La(l, n)?.footer;
|
|
6485
6489
|
}, [
|
|
6486
6490
|
l,
|
|
6487
6491
|
n,
|
|
6488
6492
|
r
|
|
6489
6493
|
]);
|
|
6490
6494
|
}
|
|
6491
|
-
var
|
|
6492
|
-
if (e.url ===
|
|
6495
|
+
var Xa = ({ link: e, includeConsent: t, consent: n }) => {
|
|
6496
|
+
if (e.url === Ja) return t ? /* @__PURE__ */ _("li", { children: /* @__PURE__ */ _(Br, {
|
|
6493
6497
|
triggerType: "footerlink",
|
|
6494
6498
|
triggerText: e.text,
|
|
6495
6499
|
...n
|
|
6496
6500
|
}) }) : null;
|
|
6497
|
-
let r =
|
|
6501
|
+
let r = Ha(e.url);
|
|
6498
6502
|
return /* @__PURE__ */ _("li", { children: /* @__PURE__ */ v("a", {
|
|
6499
6503
|
href: e.url,
|
|
6500
6504
|
children: [e.text, r && /* @__PURE__ */ v("span", {
|
|
@@ -6506,15 +6510,15 @@ var Ya = ({ link: e, includeConsent: t, consent: n }) => {
|
|
|
6506
6510
|
]
|
|
6507
6511
|
})]
|
|
6508
6512
|
}) });
|
|
6509
|
-
},
|
|
6513
|
+
}, Za = ({ section: e, includeConsent: t, consent: n }) => /* @__PURE__ */ v("section", { children: [/* @__PURE__ */ _("h2", { children: e.title }), /* @__PURE__ */ _("ul", {
|
|
6510
6514
|
className: "pkt-footer__link-list",
|
|
6511
|
-
children: e.links.map((e) => /* @__PURE__ */ _(
|
|
6515
|
+
children: e.links.map((e) => /* @__PURE__ */ _(Xa, {
|
|
6512
6516
|
link: e,
|
|
6513
6517
|
includeConsent: t,
|
|
6514
6518
|
consent: n
|
|
6515
6519
|
}, `${e.url}|${e.text}`))
|
|
6516
|
-
})] }),
|
|
6517
|
-
let t =
|
|
6520
|
+
})] }), Qa = ({ entry: e }) => {
|
|
6521
|
+
let t = Fa(e.url, e.text);
|
|
6518
6522
|
return t ? /* @__PURE__ */ _("li", { children: /* @__PURE__ */ _("a", {
|
|
6519
6523
|
className: "pkt-footer__some-link",
|
|
6520
6524
|
href: e.url,
|
|
@@ -6527,7 +6531,7 @@ var Ya = ({ link: e, includeConsent: t, consent: n }) => {
|
|
|
6527
6531
|
href: e.url,
|
|
6528
6532
|
children: e.text
|
|
6529
6533
|
}) });
|
|
6530
|
-
},
|
|
6534
|
+
}, $a = ({ footer: e, includeConsent: t = !1, consent: n = {} }) => {
|
|
6531
6535
|
let r = e.links?.length > 0, i = e.some?.length > 0;
|
|
6532
6536
|
return /* @__PURE__ */ _("div", {
|
|
6533
6537
|
className: "pkt-footer__band pkt-footer__band--global",
|
|
@@ -6535,7 +6539,7 @@ var Ya = ({ link: e, includeConsent: t, consent: n }) => {
|
|
|
6535
6539
|
className: "pkt-footer__inner",
|
|
6536
6540
|
children: /* @__PURE__ */ v("div", {
|
|
6537
6541
|
className: "pkt-footer__sections",
|
|
6538
|
-
children: [e.sections.map((e) => /* @__PURE__ */ _(
|
|
6542
|
+
children: [e.sections.map((e) => /* @__PURE__ */ _(Za, {
|
|
6539
6543
|
section: e,
|
|
6540
6544
|
includeConsent: t,
|
|
6541
6545
|
consent: n
|
|
@@ -6549,14 +6553,14 @@ var Ya = ({ link: e, includeConsent: t, consent: n }) => {
|
|
|
6549
6553
|
}) }, `${e.url}|${e.text}`))
|
|
6550
6554
|
}), i && /* @__PURE__ */ _("ul", {
|
|
6551
6555
|
className: "pkt-footer__some",
|
|
6552
|
-
children: e.some.map((e) => /* @__PURE__ */ _(
|
|
6556
|
+
children: e.some.map((e) => /* @__PURE__ */ _(Qa, { entry: e }, `${e.url}|${e.text}`))
|
|
6553
6557
|
})]
|
|
6554
6558
|
})]
|
|
6555
6559
|
})
|
|
6556
6560
|
})
|
|
6557
6561
|
});
|
|
6558
|
-
},
|
|
6559
|
-
let n = e.openInNewTab || t, r = e.external ?
|
|
6562
|
+
}, eo = ({ link: e, openLinksInNewTab: t }) => {
|
|
6563
|
+
let n = e.openInNewTab || t, r = e.external ? Va(e.href) : void 0;
|
|
6560
6564
|
return /* @__PURE__ */ _("li", { children: /* @__PURE__ */ v("a", {
|
|
6561
6565
|
href: e.href,
|
|
6562
6566
|
target: n ? "_blank" : "_self",
|
|
@@ -6570,17 +6574,17 @@ var Ya = ({ link: e, includeConsent: t, consent: n }) => {
|
|
|
6570
6574
|
]
|
|
6571
6575
|
})]
|
|
6572
6576
|
}) });
|
|
6573
|
-
},
|
|
6577
|
+
}, to = ({ column: e, openLinksInNewTab: t }) => /* @__PURE__ */ v("section", { children: [
|
|
6574
6578
|
/* @__PURE__ */ _("h2", { children: e.title }),
|
|
6575
6579
|
e.text && /* @__PURE__ */ _("p", { children: e.text }),
|
|
6576
6580
|
!!e.links?.length && /* @__PURE__ */ _("ul", {
|
|
6577
6581
|
className: "pkt-footer__link-list",
|
|
6578
|
-
children: e.links.map((e) => /* @__PURE__ */ _(
|
|
6582
|
+
children: e.links.map((e) => /* @__PURE__ */ _(eo, {
|
|
6579
6583
|
link: e,
|
|
6580
6584
|
openLinksInNewTab: t
|
|
6581
6585
|
}, `${e.href}|${e.text}`))
|
|
6582
6586
|
})
|
|
6583
|
-
] }),
|
|
6587
|
+
] }), no = ({ 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 }) => {
|
|
6584
6588
|
c(() => {
|
|
6585
6589
|
(t || n) && console.warn("PktFooter: The \"columnOne\"/\"columnTwo\" props are deprecated and will be removed in a future version. Please use \"columns\" instead.");
|
|
6586
6590
|
}, [t, n]), c(() => {
|
|
@@ -6588,7 +6592,7 @@ var Ya = ({ link: e, includeConsent: t, consent: n }) => {
|
|
|
6588
6592
|
}, [r, i]), c(() => {
|
|
6589
6593
|
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.");
|
|
6590
6594
|
}, [a]);
|
|
6591
|
-
let E =
|
|
6595
|
+
let E = Ya({
|
|
6592
6596
|
data: s,
|
|
6593
6597
|
dataUrl: l,
|
|
6594
6598
|
locale: u,
|
|
@@ -6631,14 +6635,14 @@ var Ya = ({ link: e, includeConsent: t, consent: n }) => {
|
|
|
6631
6635
|
children: [
|
|
6632
6636
|
D.length > 0 && /* @__PURE__ */ _("div", {
|
|
6633
6637
|
className: "pkt-footer__sections",
|
|
6634
|
-
children: D.map((e) => /* @__PURE__ */ _(
|
|
6638
|
+
children: D.map((e) => /* @__PURE__ */ _(to, {
|
|
6635
6639
|
column: e,
|
|
6636
6640
|
openLinksInNewTab: d
|
|
6637
6641
|
}, e.title))
|
|
6638
6642
|
}),
|
|
6639
6643
|
k && /* @__PURE__ */ _("div", {
|
|
6640
6644
|
className: "pkt-footer__consent",
|
|
6641
|
-
children: /* @__PURE__ */ _(
|
|
6645
|
+
children: /* @__PURE__ */ _(Br, {
|
|
6642
6646
|
triggerType: "footerlink",
|
|
6643
6647
|
...O
|
|
6644
6648
|
})
|
|
@@ -6671,14 +6675,14 @@ var Ya = ({ link: e, includeConsent: t, consent: n }) => {
|
|
|
6671
6675
|
})
|
|
6672
6676
|
]
|
|
6673
6677
|
})
|
|
6674
|
-
}), E && /* @__PURE__ */ _(
|
|
6678
|
+
}), E && /* @__PURE__ */ _($a, {
|
|
6675
6679
|
footer: E,
|
|
6676
6680
|
includeConsent: p,
|
|
6677
6681
|
consent: O
|
|
6678
6682
|
})]
|
|
6679
6683
|
});
|
|
6680
|
-
},
|
|
6681
|
-
let n = e.openInNewTab || t, r = e.external ?
|
|
6684
|
+
}, ro = ({ link: e, openLinksInNewTab: t }) => {
|
|
6685
|
+
let n = e.openInNewTab || t, r = e.external ? Va(e.href) : void 0;
|
|
6682
6686
|
return /* @__PURE__ */ v("a", {
|
|
6683
6687
|
className: "pkt-footer-simple__link",
|
|
6684
6688
|
href: e.href,
|
|
@@ -6696,11 +6700,11 @@ var Ya = ({ link: e, includeConsent: t, consent: n }) => {
|
|
|
6696
6700
|
]
|
|
6697
6701
|
})] })]
|
|
6698
6702
|
});
|
|
6699
|
-
},
|
|
6703
|
+
}, io = ({ 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 }) => {
|
|
6700
6704
|
c(() => {
|
|
6701
6705
|
(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.");
|
|
6702
6706
|
}, [t, n]);
|
|
6703
|
-
let C =
|
|
6707
|
+
let C = Ya({
|
|
6704
6708
|
data: i,
|
|
6705
6709
|
dataUrl: a,
|
|
6706
6710
|
locale: o,
|
|
@@ -6737,22 +6741,22 @@ var Ya = ({ link: e, includeConsent: t, consent: n }) => {
|
|
|
6737
6741
|
className: "pkt-footer__inner pkt-footer__inner--compact",
|
|
6738
6742
|
children: /* @__PURE__ */ v("ul", {
|
|
6739
6743
|
className: "pkt-footer-simple__list",
|
|
6740
|
-
children: [w.map((e) => /* @__PURE__ */ _("li", { children: /* @__PURE__ */ _(
|
|
6744
|
+
children: [w.map((e) => /* @__PURE__ */ _("li", { children: /* @__PURE__ */ _(ro, {
|
|
6741
6745
|
link: e,
|
|
6742
6746
|
openLinksInNewTab: s
|
|
6743
|
-
}) }, `${e.href}|${e.text}`)), E && /* @__PURE__ */ _("li", { children: /* @__PURE__ */ _(
|
|
6747
|
+
}) }, `${e.href}|${e.text}`)), E && /* @__PURE__ */ _("li", { children: /* @__PURE__ */ _(Br, {
|
|
6744
6748
|
triggerType: "footerlink",
|
|
6745
6749
|
...T
|
|
6746
6750
|
}) })]
|
|
6747
6751
|
})
|
|
6748
6752
|
})
|
|
6749
|
-
}), C && /* @__PURE__ */ _(
|
|
6753
|
+
}), C && /* @__PURE__ */ _($a, {
|
|
6750
6754
|
footer: C,
|
|
6751
6755
|
includeConsent: l,
|
|
6752
6756
|
consent: T
|
|
6753
6757
|
})]
|
|
6754
6758
|
});
|
|
6755
|
-
},
|
|
6759
|
+
}, ao = (e, t) => {
|
|
6756
6760
|
let [n, r] = m(() => typeof window > "u" ? t ?? 0 : t ?? window.innerWidth);
|
|
6757
6761
|
return c(() => {
|
|
6758
6762
|
let t = e.current;
|
|
@@ -6773,10 +6777,10 @@ var Ya = ({ link: e, includeConsent: t, consent: n }) => {
|
|
|
6773
6777
|
};
|
|
6774
6778
|
//#endregion
|
|
6775
6779
|
//#region src/hooks/useHeaderChrome.ts
|
|
6776
|
-
function
|
|
6780
|
+
function oo({ forwardedRef: e, mobileBreakpoint: t, tabletBreakpoint: n, position: r, scrollBehavior: i, pauseScrollHide: a = !1 }) {
|
|
6777
6781
|
let s = p(null), l = o((t) => {
|
|
6778
6782
|
s.current = t, typeof e == "function" ? e(t) : e && (e.current = t);
|
|
6779
|
-
}, [e]), u =
|
|
6783
|
+
}, [e]), u = ao(s), d = u < t, f = u < n, h = r === "fixed", g = r === "sticky", [_, v] = m(!1), y = p(0), b = i === "hide";
|
|
6780
6784
|
c(() => {
|
|
6781
6785
|
let e = () => {
|
|
6782
6786
|
if (!b || a) return;
|
|
@@ -6806,16 +6810,16 @@ function ao({ forwardedRef: e, mobileBreakpoint: t, tabletBreakpoint: n, positio
|
|
|
6806
6810
|
}
|
|
6807
6811
|
//#endregion
|
|
6808
6812
|
//#region src/hooks/useScrollLock.ts
|
|
6809
|
-
function
|
|
6810
|
-
let t = p(
|
|
6813
|
+
function so(e) {
|
|
6814
|
+
let t = p(ia());
|
|
6811
6815
|
c(() => {
|
|
6812
6816
|
let n = t.current;
|
|
6813
|
-
return
|
|
6817
|
+
return aa(n, e), () => aa(n, !1);
|
|
6814
6818
|
}, [e]);
|
|
6815
6819
|
}
|
|
6816
6820
|
//#endregion
|
|
6817
6821
|
//#region src/components/header-menu/HeaderMenu.tsx
|
|
6818
|
-
var
|
|
6822
|
+
var co = ({ dataUrl: e = Bn, data: t, locale: n = "nb-NO", open: r = !1, mobileBreakpoint: i = 768, className: a, onDataLoaded: s, onDataError: l, ref: u, strings: d, ...h }) => {
|
|
6819
6823
|
let y = ve(["header"], d).header, [b, x] = m("loading"), [S, C] = m(void 0), w = t ? "ready" : b, T = p(s), E = p(l);
|
|
6820
6824
|
c(() => {
|
|
6821
6825
|
T.current = s;
|
|
@@ -6824,19 +6828,19 @@ var so = ({ dataUrl: e = Bn, data: t, locale: n = "nb-NO", open: r = !1, mobileB
|
|
|
6824
6828
|
}, [l]);
|
|
6825
6829
|
let D = p(null), O = o((e) => {
|
|
6826
6830
|
D.current = e, typeof u == "function" ? u(e) : u && (u.current = e);
|
|
6827
|
-
}, [u]), k =
|
|
6831
|
+
}, [u]), k = ao(D) < i;
|
|
6828
6832
|
c(() => {
|
|
6829
6833
|
t && T.current?.(t);
|
|
6830
6834
|
}, [t]), c(() => {
|
|
6831
6835
|
if (t) return;
|
|
6832
6836
|
let n = new AbortController();
|
|
6833
|
-
return
|
|
6837
|
+
return qa(e, n.signal).then((e) => {
|
|
6834
6838
|
n.signal.aborted || (C(e), x("ready"), T.current?.(e));
|
|
6835
6839
|
}).catch((e) => {
|
|
6836
6840
|
e.name !== "AbortError" && (x("error"), E.current?.(e));
|
|
6837
6841
|
}), () => n.abort();
|
|
6838
6842
|
}, [t, e]);
|
|
6839
|
-
let A = t ?? S, j = f(() =>
|
|
6843
|
+
let A = t ?? S, j = f(() => La(A, n), [A, n]), M = [
|
|
6840
6844
|
"pkt-header-menu",
|
|
6841
6845
|
r && "pkt-header-menu--open",
|
|
6842
6846
|
a
|
|
@@ -6868,28 +6872,28 @@ var so = ({ dataUrl: e = Bn, data: t, locale: n = "nb-NO", open: r = !1, mobileB
|
|
|
6868
6872
|
className: M,
|
|
6869
6873
|
"aria-label": ee,
|
|
6870
6874
|
children: [
|
|
6871
|
-
k ? /* @__PURE__ */ _(
|
|
6875
|
+
k ? /* @__PURE__ */ _(uo, {
|
|
6872
6876
|
services: N.services,
|
|
6873
6877
|
sections: N.sections
|
|
6874
6878
|
}) : /* @__PURE__ */ v(g, { children: [
|
|
6875
|
-
/* @__PURE__ */ _(
|
|
6876
|
-
/* @__PURE__ */ _(
|
|
6879
|
+
/* @__PURE__ */ _(fo, { services: N.services }),
|
|
6880
|
+
/* @__PURE__ */ _(po, {
|
|
6877
6881
|
buttons: N.buttons,
|
|
6878
6882
|
mobile: !1
|
|
6879
6883
|
}),
|
|
6880
|
-
/* @__PURE__ */ _(
|
|
6884
|
+
/* @__PURE__ */ _(mo, { sections: N.sections })
|
|
6881
6885
|
] }),
|
|
6882
|
-
/* @__PURE__ */ _(
|
|
6886
|
+
/* @__PURE__ */ _(po, {
|
|
6883
6887
|
buttons: N.buttons,
|
|
6884
6888
|
mobile: !0
|
|
6885
6889
|
}),
|
|
6886
|
-
/* @__PURE__ */ _(
|
|
6890
|
+
/* @__PURE__ */ _(go, {
|
|
6887
6891
|
links: N.links,
|
|
6888
6892
|
some: N.some
|
|
6889
6893
|
})
|
|
6890
6894
|
]
|
|
6891
6895
|
});
|
|
6892
|
-
},
|
|
6896
|
+
}, lo = ({ services: e }) => /* @__PURE__ */ _("ul", {
|
|
6893
6897
|
className: "pkt-header-menu__services-list",
|
|
6894
6898
|
children: e.links.map((e) => /* @__PURE__ */ _("li", {
|
|
6895
6899
|
className: "pkt-header-menu__service",
|
|
@@ -6898,7 +6902,7 @@ var so = ({ dataUrl: e = Bn, data: t, locale: n = "nb-NO", open: r = !1, mobileB
|
|
|
6898
6902
|
href: e.url,
|
|
6899
6903
|
children: [/* @__PURE__ */ _(L, {
|
|
6900
6904
|
className: "pkt-header-menu__service-icon",
|
|
6901
|
-
name:
|
|
6905
|
+
name: Ma(e.icon),
|
|
6902
6906
|
"aria-hidden": "true"
|
|
6903
6907
|
}), /* @__PURE__ */ _("span", {
|
|
6904
6908
|
className: "pkt-header-menu__service-text",
|
|
@@ -6906,7 +6910,7 @@ var so = ({ dataUrl: e = Bn, data: t, locale: n = "nb-NO", open: r = !1, mobileB
|
|
|
6906
6910
|
})]
|
|
6907
6911
|
})
|
|
6908
6912
|
}, e.url))
|
|
6909
|
-
}),
|
|
6913
|
+
}), uo = ({ services: e, sections: t }) => /* @__PURE__ */ _("div", {
|
|
6910
6914
|
className: "pkt-header-menu__sections",
|
|
6911
6915
|
children: /* @__PURE__ */ v(j, {
|
|
6912
6916
|
className: "pkt-header-menu__sections-inner",
|
|
@@ -6917,22 +6921,22 @@ var so = ({ dataUrl: e = Bn, data: t, locale: n = "nb-NO", open: r = !1, mobileB
|
|
|
6917
6921
|
skin: "plus-minus",
|
|
6918
6922
|
id: "pkt-header-menu-services",
|
|
6919
6923
|
title: e.title,
|
|
6920
|
-
children: /* @__PURE__ */ _(
|
|
6924
|
+
children: /* @__PURE__ */ _(lo, { services: e })
|
|
6921
6925
|
}), t.map((e, t) => /* @__PURE__ */ _(R, {
|
|
6922
6926
|
className: "pkt-header-menu__section",
|
|
6923
6927
|
skin: "plus-minus",
|
|
6924
6928
|
id: `pkt-header-menu-section-${t}`,
|
|
6925
6929
|
title: e.title,
|
|
6926
|
-
children: /* @__PURE__ */ _(
|
|
6930
|
+
children: /* @__PURE__ */ _(ho, { links: e.links })
|
|
6927
6931
|
}, e.title))]
|
|
6928
6932
|
})
|
|
6929
|
-
}),
|
|
6933
|
+
}), fo = ({ services: e }) => /* @__PURE__ */ v("div", {
|
|
6930
6934
|
className: "pkt-header-menu__services",
|
|
6931
6935
|
children: [/* @__PURE__ */ _("h2", {
|
|
6932
6936
|
className: "pkt-header-menu__services-title",
|
|
6933
6937
|
children: e.title
|
|
6934
|
-
}), /* @__PURE__ */ _(
|
|
6935
|
-
}),
|
|
6938
|
+
}), /* @__PURE__ */ _(lo, { services: e })]
|
|
6939
|
+
}), po = ({ buttons: e, mobile: t }) => {
|
|
6936
6940
|
if (!e || e.length === 0) return null;
|
|
6937
6941
|
let n = ["pkt-header-menu__buttons", t && "pkt-header-menu__buttons--mobile"].filter(Boolean).join(" ");
|
|
6938
6942
|
return /* @__PURE__ */ _("div", {
|
|
@@ -6942,7 +6946,7 @@ var so = ({ dataUrl: e = Bn, data: t, locale: n = "nb-NO", open: r = !1, mobileB
|
|
|
6942
6946
|
href: e.url,
|
|
6943
6947
|
children: [/* @__PURE__ */ _(L, {
|
|
6944
6948
|
className: "pkt-btn__icon",
|
|
6945
|
-
name: e.iconName ?
|
|
6949
|
+
name: e.iconName ? Ma(e.iconName) : "user",
|
|
6946
6950
|
"aria-hidden": "true"
|
|
6947
6951
|
}), /* @__PURE__ */ _("span", {
|
|
6948
6952
|
className: "pkt-btn__text",
|
|
@@ -6950,7 +6954,7 @@ var so = ({ dataUrl: e = Bn, data: t, locale: n = "nb-NO", open: r = !1, mobileB
|
|
|
6950
6954
|
})]
|
|
6951
6955
|
}, e.url))
|
|
6952
6956
|
});
|
|
6953
|
-
},
|
|
6957
|
+
}, mo = ({ sections: e }) => !e || e.length === 0 ? null : /* @__PURE__ */ _("div", {
|
|
6954
6958
|
className: "pkt-header-menu__sections",
|
|
6955
6959
|
children: /* @__PURE__ */ _("div", {
|
|
6956
6960
|
className: "pkt-header-menu__sections-inner",
|
|
@@ -6959,17 +6963,17 @@ var so = ({ dataUrl: e = Bn, data: t, locale: n = "nb-NO", open: r = !1, mobileB
|
|
|
6959
6963
|
children: [/* @__PURE__ */ _("h2", {
|
|
6960
6964
|
className: "pkt-header-menu__section-title",
|
|
6961
6965
|
children: e.title
|
|
6962
|
-
}), /* @__PURE__ */ _(
|
|
6966
|
+
}), /* @__PURE__ */ _(ho, { links: e.links })]
|
|
6963
6967
|
}, e.title))
|
|
6964
6968
|
})
|
|
6965
|
-
}),
|
|
6969
|
+
}), ho = ({ links: e }) => /* @__PURE__ */ _("ul", {
|
|
6966
6970
|
className: "pkt-header-menu__section-list",
|
|
6967
6971
|
children: e.map((e) => /* @__PURE__ */ _("li", { children: /* @__PURE__ */ _("a", {
|
|
6968
6972
|
className: "pkt-header-menu__section-link",
|
|
6969
6973
|
href: e.url,
|
|
6970
6974
|
children: e.text
|
|
6971
6975
|
}) }, e.url))
|
|
6972
|
-
}),
|
|
6976
|
+
}), go = ({ links: e, some: t }) => {
|
|
6973
6977
|
let n = e && e.length > 0, r = t && t.length > 0;
|
|
6974
6978
|
return !n && !r ? null : /* @__PURE__ */ v("div", {
|
|
6975
6979
|
className: "pkt-header-menu__footer",
|
|
@@ -6982,11 +6986,11 @@ var so = ({ dataUrl: e = Bn, data: t, locale: n = "nb-NO", open: r = !1, mobileB
|
|
|
6982
6986
|
}) }, e.url))
|
|
6983
6987
|
}), r && /* @__PURE__ */ _("ul", {
|
|
6984
6988
|
className: "pkt-header-menu__footer-list pkt-header-menu__footer-list--social",
|
|
6985
|
-
children: t.map((e) => /* @__PURE__ */ _(
|
|
6989
|
+
children: t.map((e) => /* @__PURE__ */ _(_o, { entry: e }, e.url))
|
|
6986
6990
|
})]
|
|
6987
6991
|
});
|
|
6988
|
-
},
|
|
6989
|
-
let t =
|
|
6992
|
+
}, _o = ({ entry: e }) => {
|
|
6993
|
+
let t = Fa(e.url, e.text);
|
|
6990
6994
|
return /* @__PURE__ */ _("li", { children: /* @__PURE__ */ _("a", {
|
|
6991
6995
|
className: "pkt-header-menu__social-link",
|
|
6992
6996
|
href: e.url,
|
|
@@ -6996,7 +7000,7 @@ var so = ({ dataUrl: e = Bn, data: t, locale: n = "nb-NO", open: r = !1, mobileB
|
|
|
6996
7000
|
"aria-hidden": "true"
|
|
6997
7001
|
}) : /* @__PURE__ */ _("span", { children: e.text })
|
|
6998
7002
|
}) });
|
|
6999
|
-
},
|
|
7003
|
+
}, vo = ({ href: e, iconName: t, className: n, iconPosition: r, external: i, target: a, renderLink: o, children: s, ...c }) => {
|
|
7000
7004
|
let l = {
|
|
7001
7005
|
"pkt-link": !0,
|
|
7002
7006
|
"pkt-link--icon-left": !!t && r === "left" || !!(t && !r),
|
|
@@ -7022,10 +7026,10 @@ var so = ({ dataUrl: e = Bn, data: t, locale: n = "nb-NO", open: r = !1, mobileB
|
|
|
7022
7026
|
}
|
|
7023
7027
|
});
|
|
7024
7028
|
};
|
|
7025
|
-
|
|
7029
|
+
vo.displayName = "PktLink";
|
|
7026
7030
|
//#endregion
|
|
7027
7031
|
//#region src/components/headerUserMenu/UserMenu.tsx
|
|
7028
|
-
var
|
|
7032
|
+
var yo = (e) => typeof e.target == "string" ? {
|
|
7029
7033
|
title: e.title,
|
|
7030
7034
|
iconName: e.iconName,
|
|
7031
7035
|
href: e.target
|
|
@@ -7033,7 +7037,7 @@ var vo = (e) => typeof e.target == "string" ? {
|
|
|
7033
7037
|
title: e.title,
|
|
7034
7038
|
iconName: e.iconName,
|
|
7035
7039
|
onClick: e.target
|
|
7036
|
-
},
|
|
7040
|
+
}, bo = ({ item: e, className: t }) => "href" in e ? /* @__PURE__ */ _(vo, {
|
|
7037
7041
|
iconName: e.iconName,
|
|
7038
7042
|
href: e.href,
|
|
7039
7043
|
className: (0, M.default)("pkt-user-menu__link", t),
|
|
@@ -7049,14 +7053,14 @@ var vo = (e) => typeof e.target == "string" ? {
|
|
|
7049
7053
|
className: "pkt-link__icon",
|
|
7050
7054
|
"aria-hidden": "true"
|
|
7051
7055
|
}), e.title]
|
|
7052
|
-
}),
|
|
7056
|
+
}), xo = ({ links: e }) => /* @__PURE__ */ _("ul", {
|
|
7053
7057
|
className: "pkt-user-menu__sublist",
|
|
7054
7058
|
children: be(e, (e) => `${"href" in e ? e.href : ""}|${e.title}`).map(({ item: e, key: t }) => /* @__PURE__ */ _("li", {
|
|
7055
7059
|
className: "pkt-user-menu__subitem",
|
|
7056
|
-
children: /* @__PURE__ */ _(
|
|
7060
|
+
children: /* @__PURE__ */ _(bo, { item: e })
|
|
7057
7061
|
}, t))
|
|
7058
|
-
}),
|
|
7059
|
-
let l = ve(["header"], e).header, u = i?.map(
|
|
7062
|
+
}), So = i(({ strings: e, user: t, formattedLastLoggedIn: n, representing: r, userMenu: i, canChangeRepresentation: a, changeRepresentation: o, logoutOnClick: s }, c) => {
|
|
7063
|
+
let l = ve(["header"], e).header, u = i?.map(yo);
|
|
7060
7064
|
return /* @__PURE__ */ _("nav", {
|
|
7061
7065
|
className: "pkt-user-menu",
|
|
7062
7066
|
ref: c,
|
|
@@ -7088,7 +7092,7 @@ var vo = (e) => typeof e.target == "string" ? {
|
|
|
7088
7092
|
}),
|
|
7089
7093
|
u && u.length > 0 && /* @__PURE__ */ _("li", {
|
|
7090
7094
|
className: "pkt-user-menu__item",
|
|
7091
|
-
children: /* @__PURE__ */ _(
|
|
7095
|
+
children: /* @__PURE__ */ _(xo, { links: u })
|
|
7092
7096
|
}),
|
|
7093
7097
|
r && /* @__PURE__ */ v("li", {
|
|
7094
7098
|
className: "pkt-user-menu__item",
|
|
@@ -7110,7 +7114,7 @@ var vo = (e) => typeof e.target == "string" ? {
|
|
|
7110
7114
|
className: "pkt-user-menu__sublist mt-size-16",
|
|
7111
7115
|
children: /* @__PURE__ */ _("li", {
|
|
7112
7116
|
className: "pkt-user-menu__subitem",
|
|
7113
|
-
children: /* @__PURE__ */ _(
|
|
7117
|
+
children: /* @__PURE__ */ _(bo, { item: {
|
|
7114
7118
|
title: l.changeRepresentation,
|
|
7115
7119
|
iconName: "cogwheel",
|
|
7116
7120
|
onClick: o
|
|
@@ -7125,7 +7129,7 @@ var vo = (e) => typeof e.target == "string" ? {
|
|
|
7125
7129
|
className: "pkt-user-menu__sublist",
|
|
7126
7130
|
children: /* @__PURE__ */ _("li", {
|
|
7127
7131
|
className: "pkt-user-menu__subitem",
|
|
7128
|
-
children: /* @__PURE__ */ _(
|
|
7132
|
+
children: /* @__PURE__ */ _(bo, { item: {
|
|
7129
7133
|
title: l.changeRepresentation,
|
|
7130
7134
|
iconName: "cogwheel",
|
|
7131
7135
|
onClick: o
|
|
@@ -7135,7 +7139,7 @@ var vo = (e) => typeof e.target == "string" ? {
|
|
|
7135
7139
|
}),
|
|
7136
7140
|
s && /* @__PURE__ */ _("li", {
|
|
7137
7141
|
className: "pkt-user-menu__item",
|
|
7138
|
-
children: /* @__PURE__ */ _(
|
|
7142
|
+
children: /* @__PURE__ */ _(bo, { item: {
|
|
7139
7143
|
title: l.logOut,
|
|
7140
7144
|
iconName: "exit",
|
|
7141
7145
|
onClick: s
|
|
@@ -7145,10 +7149,10 @@ var vo = (e) => typeof e.target == "string" ? {
|
|
|
7145
7149
|
})
|
|
7146
7150
|
});
|
|
7147
7151
|
});
|
|
7148
|
-
|
|
7152
|
+
So.displayName = "PktHeaderUserMenu";
|
|
7149
7153
|
//#endregion
|
|
7150
7154
|
//#region src/components/searchinput/SearchInput.tsx
|
|
7151
|
-
var
|
|
7155
|
+
var Co = 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) => {
|
|
7152
7156
|
let S = ve(["searchinput"], y), C = s ?? S.searchinput.placeholder, w = (e, t) => {
|
|
7153
7157
|
e ? e() : h && h(t);
|
|
7154
7158
|
}, T = (e) => {
|
|
@@ -7158,10 +7162,10 @@ var So = i(({ appearance: e = "local", inputSize: t = "medium", disabled: n = !1
|
|
|
7158
7162
|
`pkt-searchinput--${e}`,
|
|
7159
7163
|
`pkt-searchinput--${t}`,
|
|
7160
7164
|
r && "pkt-searchinput--fullwidth"
|
|
7161
|
-
].filter(Boolean).join(" "), D = f(() =>
|
|
7165
|
+
].filter(Boolean).join(" "), D = f(() => Zn(), []), O = i || D, k = {
|
|
7162
7166
|
role: "search",
|
|
7163
7167
|
className: E,
|
|
7164
|
-
|
|
7168
|
+
...er()
|
|
7165
7169
|
}, A = (e) => u ? /* @__PURE__ */ _("form", {
|
|
7166
7170
|
...k,
|
|
7167
7171
|
action: u,
|
|
@@ -7238,19 +7242,19 @@ var So = i(({ appearance: e = "local", inputSize: t = "medium", disabled: n = !1
|
|
|
7238
7242
|
})
|
|
7239
7243
|
] }));
|
|
7240
7244
|
});
|
|
7241
|
-
|
|
7245
|
+
Co.displayName = "PktSearchInput";
|
|
7242
7246
|
//#endregion
|
|
7243
7247
|
//#region src/components/header/HeaderGlobal.tsx
|
|
7244
|
-
var
|
|
7245
|
-
typeof window < "u" && (window.pktLogoPath = window.pktLogoPath ||
|
|
7246
|
-
var
|
|
7248
|
+
var wo = "https://punkt-cdn.oslo.kommune.no/latest/logos/";
|
|
7249
|
+
typeof window < "u" && (window.pktLogoPath = window.pktLogoPath || wo);
|
|
7250
|
+
var To = "pkt-header-global-menu", Eo = "pkt-header-global-menu-toggle", Do = "pkt-header-global-search-panel", Oo = "pkt-header-global-search-toggle", ko = i(({ className: e, "data-mode": t, dataUrl: n, data: r, locale: i = "nb-NO", logoLink: a = Vn, logoClick: s, logoPath: l = typeof window < "u" ? window.pktLogoPath : wo, 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) => {
|
|
7247
7251
|
let ne = k === "hide", [F, re] = m("none"), [ie, ae] = m(void 0), [oe, se] = m(!1), I = p(N), R = p(P);
|
|
7248
7252
|
c(() => {
|
|
7249
7253
|
I.current = N;
|
|
7250
7254
|
}, [N]), c(() => {
|
|
7251
7255
|
R.current = P;
|
|
7252
7256
|
}, [P]);
|
|
7253
|
-
let { setRef: ce, isMobile: z, isTablet: B, isFixed: le, isSticky: ue, hidden: de, captureFocus: V, flagRestoreFocus: H, restoreFocus: U } =
|
|
7257
|
+
let { setRef: ce, isMobile: z, isTablet: B, isFixed: le, isSticky: ue, hidden: de, captureFocus: V, flagRestoreFocus: H, restoreFocus: U } = oo({
|
|
7254
7258
|
forwardedRef: te,
|
|
7255
7259
|
mobileBreakpoint: A,
|
|
7256
7260
|
tabletBreakpoint: j,
|
|
@@ -7258,13 +7262,13 @@ var wo = "pkt-header-global-menu", To = "pkt-header-global-menu-toggle", Eo = "p
|
|
|
7258
7262
|
scrollBehavior: k,
|
|
7259
7263
|
pauseScrollHide: F !== "none"
|
|
7260
7264
|
});
|
|
7261
|
-
|
|
7265
|
+
so(F === "menu" || F === "search");
|
|
7262
7266
|
let W = p(null), G = o((e) => {
|
|
7263
7267
|
W.current = e, ce(e);
|
|
7264
7268
|
}, [ce]);
|
|
7265
7269
|
d(() => {
|
|
7266
7270
|
if (F !== "menu" && F !== "search") return;
|
|
7267
|
-
let e = document.getElementById(F === "menu" ?
|
|
7271
|
+
let e = document.getElementById(F === "menu" ? To : Do), t = W.current?.getBoundingClientRect();
|
|
7268
7272
|
!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`));
|
|
7269
7273
|
}, [
|
|
7270
7274
|
F,
|
|
@@ -7275,17 +7279,17 @@ var wo = "pkt-header-global-menu", To = "pkt-header-global-menu-toggle", Eo = "p
|
|
|
7275
7279
|
}, [r]), c(() => {
|
|
7276
7280
|
if (r) return;
|
|
7277
7281
|
let e = new AbortController();
|
|
7278
|
-
return
|
|
7282
|
+
return qa(n, e.signal).then((t) => {
|
|
7279
7283
|
e.signal.aborted || (ae(t), se(!1), I.current?.(t));
|
|
7280
7284
|
}).catch((e) => {
|
|
7281
7285
|
e.name !== "AbortError" && (se(!0), R.current?.(e));
|
|
7282
7286
|
}), () => e.abort();
|
|
7283
7287
|
}, [r, n]);
|
|
7284
|
-
let K = r ?? ie, fe = f(() =>
|
|
7288
|
+
let K = r ?? ie, fe = f(() => La(K, i), [K, i]);
|
|
7285
7289
|
c(() => {
|
|
7286
7290
|
let e = (e) => {
|
|
7287
7291
|
let t = e.target;
|
|
7288
|
-
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(`#${
|
|
7292
|
+
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(`#${Eo}`) && re("none"), F === "search" && !t.closest(".pkt-header-global__search-panel-inner") && !t.closest(`#${Oo}`) && re("none");
|
|
7289
7293
|
}, t = (e) => {
|
|
7290
7294
|
e.key === "Escape" && F !== "none" && (e.preventDefault(), H(), re("none"));
|
|
7291
7295
|
};
|
|
@@ -7299,13 +7303,13 @@ var wo = "pkt-header-global-menu", To = "pkt-header-global-menu-toggle", Eo = "p
|
|
|
7299
7303
|
H
|
|
7300
7304
|
]), c(() => {
|
|
7301
7305
|
if (F !== "menu" && F !== "search") return;
|
|
7302
|
-
let e = F === "menu" ?
|
|
7306
|
+
let e = F === "menu" ? To : Do, t = F === "menu" ? Eo : Oo, n = () => document.getElementById(e), r = () => document.getElementById(t), i = (e) => {
|
|
7303
7307
|
re("none"), (e.querySelector("button") ?? e).focus();
|
|
7304
7308
|
}, a = (e) => {
|
|
7305
7309
|
if (e.key !== "Tab") return;
|
|
7306
7310
|
let t = n(), a = r();
|
|
7307
7311
|
if (!t || !a) return;
|
|
7308
|
-
let o =
|
|
7312
|
+
let o = _i(t), s = vi();
|
|
7309
7313
|
if (s && a.contains(s)) {
|
|
7310
7314
|
!e.shiftKey && o.length > 0 && (e.preventDefault(), o[0].focus());
|
|
7311
7315
|
return;
|
|
@@ -7368,7 +7372,7 @@ var wo = "pkt-header-global-menu", To = "pkt-header-global-menu-toggle", Eo = "p
|
|
|
7368
7372
|
children: [
|
|
7369
7373
|
!xe && Q && he && /* @__PURE__ */ _("div", {
|
|
7370
7374
|
className: "pkt-header-global__search",
|
|
7371
|
-
children: /* @__PURE__ */ _(
|
|
7375
|
+
children: /* @__PURE__ */ _(Co, {
|
|
7372
7376
|
appearance: "global",
|
|
7373
7377
|
inputSize: B ? "small" : "medium",
|
|
7374
7378
|
fullwidth: !0,
|
|
@@ -7383,7 +7387,7 @@ var wo = "pkt-header-global-menu", To = "pkt-header-global-menu-toggle", Eo = "p
|
|
|
7383
7387
|
})
|
|
7384
7388
|
}),
|
|
7385
7389
|
xe && Q && /* @__PURE__ */ _(Y, {
|
|
7386
|
-
id:
|
|
7390
|
+
id: Oo,
|
|
7387
7391
|
className: "pkt-header-global__search-toggle",
|
|
7388
7392
|
skin: "primary",
|
|
7389
7393
|
color: be ? void 0 : "yellow",
|
|
@@ -7392,12 +7396,12 @@ var wo = "pkt-header-global-menu", To = "pkt-header-global-menu-toggle", Eo = "p
|
|
|
7392
7396
|
size: z ? "small" : "medium",
|
|
7393
7397
|
state: be ? "active" : "normal",
|
|
7394
7398
|
"aria-expanded": be,
|
|
7395
|
-
"aria-controls":
|
|
7399
|
+
"aria-controls": Do,
|
|
7396
7400
|
onClick: () => me("search"),
|
|
7397
7401
|
children: X
|
|
7398
7402
|
}),
|
|
7399
7403
|
/* @__PURE__ */ _(Y, {
|
|
7400
|
-
id:
|
|
7404
|
+
id: Eo,
|
|
7401
7405
|
className: "pkt-header-global__menu-toggle",
|
|
7402
7406
|
skin: xe ? "tertiary" : "secondary",
|
|
7403
7407
|
variant: xe ? "icon-only" : "icon-right",
|
|
@@ -7405,7 +7409,7 @@ var wo = "pkt-header-global-menu", To = "pkt-header-global-menu-toggle", Eo = "p
|
|
|
7405
7409
|
size: B ? "small" : "medium",
|
|
7406
7410
|
state: ye ? "active" : "normal",
|
|
7407
7411
|
"aria-expanded": ye,
|
|
7408
|
-
"aria-controls":
|
|
7412
|
+
"aria-controls": To,
|
|
7409
7413
|
disabled: Ce,
|
|
7410
7414
|
onClick: () => me("menu"),
|
|
7411
7415
|
children: _e
|
|
@@ -7442,7 +7446,7 @@ var wo = "pkt-header-global-menu", To = "pkt-header-global-menu-toggle", Eo = "p
|
|
|
7442
7446
|
})]
|
|
7443
7447
|
}), Z && /* @__PURE__ */ _("div", {
|
|
7444
7448
|
className: "pkt-header-global__user-menu is-open",
|
|
7445
|
-
children: /* @__PURE__ */ _(
|
|
7449
|
+
children: /* @__PURE__ */ _(So, {
|
|
7446
7450
|
strings: ee,
|
|
7447
7451
|
user: x,
|
|
7448
7452
|
formattedLastLoggedIn: pe,
|
|
@@ -7458,8 +7462,8 @@ var wo = "pkt-header-global-menu", To = "pkt-header-global-menu-toggle", Eo = "p
|
|
|
7458
7462
|
]
|
|
7459
7463
|
}), Te = ye && /* @__PURE__ */ _("div", {
|
|
7460
7464
|
className: (0, M.default)("pkt-header-global__menu", z && "pkt-header-global__menu--mobile", B && !z && "pkt-header-global__menu--tablet"),
|
|
7461
|
-
id:
|
|
7462
|
-
children: fe ? /* @__PURE__ */ _(
|
|
7465
|
+
id: To,
|
|
7466
|
+
children: fe ? /* @__PURE__ */ _(co, {
|
|
7463
7467
|
data: K,
|
|
7464
7468
|
locale: i,
|
|
7465
7469
|
open: !0,
|
|
@@ -7474,10 +7478,10 @@ var wo = "pkt-header-global-menu", To = "pkt-header-global-menu-toggle", Eo = "p
|
|
|
7474
7478
|
})
|
|
7475
7479
|
}), Ee = be && Q && he && /* @__PURE__ */ _("div", {
|
|
7476
7480
|
className: (0, M.default)("pkt-header-global__search-panel", z && "pkt-header-global__search-panel--mobile", B && !z && "pkt-header-global__search-panel--tablet"),
|
|
7477
|
-
id:
|
|
7481
|
+
id: Do,
|
|
7478
7482
|
children: /* @__PURE__ */ _("div", {
|
|
7479
7483
|
className: "pkt-header-global__search-panel-inner",
|
|
7480
|
-
children: /* @__PURE__ */ _(
|
|
7484
|
+
children: /* @__PURE__ */ _(Co, {
|
|
7481
7485
|
appearance: "global",
|
|
7482
7486
|
fullwidth: !0,
|
|
7483
7487
|
id: Se,
|
|
@@ -7506,16 +7510,16 @@ var wo = "pkt-header-global-menu", To = "pkt-header-global-menu-toggle", Eo = "p
|
|
|
7506
7510
|
Te
|
|
7507
7511
|
] });
|
|
7508
7512
|
});
|
|
7509
|
-
|
|
7513
|
+
ko.displayName = "PktHeaderGlobal";
|
|
7510
7514
|
//#endregion
|
|
7511
7515
|
//#region src/components/textinput/Textinput.tsx
|
|
7512
|
-
var
|
|
7513
|
-
let le = i ?? (o ?? 0) > 0, ue = [s, "pkt-textinput"].filter(Boolean).join(" "), de = A === "search" && !h && !M, V = A === "date" && N ? N.slice(0, 10) : N, [H, U] = m(0), W = N === void 0 ? H : N?.length || 0, G =
|
|
7516
|
+
var Ao = i(({ id: e, ariaDescribedby: t, ariaLabelledby: n, autocomplete: r = "off", counter: i, hasFieldset: a, counterMaxLength: o, className: s, disabled: c = !1, errorMessage: l, hasError: u = !1, helptext: d, helptextDropdown: f, helptextDropdownButton: p, iconNameRight: h, inline: g = !1, fullwidth: y = !1, label: b, name: x, optionalTag: S = !1, optionalText: C, requiredTag: w = !1, requiredText: T, tagText: E = null, placeholder: D, prefix: O, suffix: k, type: A = "text", useWrapper: j = !0, omitSearchIcon: M = !1, value: N, minLength: P, maxLength: ee, min: te, max: ne, step: F, size: re, readonly: ie, required: ae, dataTestid: oe, onChange: se, skipForwardTestid: I = !1, inputSize: R = "medium", strings: ce, ...z }, B) => {
|
|
7517
|
+
let le = i ?? (o ?? 0) > 0, ue = [s, "pkt-textinput"].filter(Boolean).join(" "), de = A === "search" && !h && !M, V = A === "date" && N ? N.slice(0, 10) : N, [H, U] = m(0), W = N === void 0 ? H : N?.length || 0, G = Qn(e), K = `${G}`, fe = `${K}-label`, pe = n || fe, me = (e) => {
|
|
7514
7518
|
le && U(e.currentTarget?.value?.length || 0), se && se(e);
|
|
7515
7519
|
};
|
|
7516
7520
|
return /* @__PURE__ */ _("div", {
|
|
7517
7521
|
className: ue,
|
|
7518
|
-
children: /* @__PURE__ */ _(
|
|
7522
|
+
children: /* @__PURE__ */ _(sr, {
|
|
7519
7523
|
strings: ce,
|
|
7520
7524
|
ariaDescribedby: t,
|
|
7521
7525
|
disabled: c,
|
|
@@ -7560,7 +7564,7 @@ var ko = i(({ id: e, ariaDescribedby: t, ariaLabelledby: n, autocomplete: r = "o
|
|
|
7560
7564
|
disabled: c,
|
|
7561
7565
|
"aria-invalid": u,
|
|
7562
7566
|
"aria-errormessage": u ? `${G}-error` : void 0,
|
|
7563
|
-
"aria-describedby":
|
|
7567
|
+
"aria-describedby": tr({
|
|
7564
7568
|
id: K,
|
|
7565
7569
|
hasHelptext: !!d,
|
|
7566
7570
|
hasCounter: le,
|
|
@@ -7604,12 +7608,12 @@ var ko = i(({ id: e, ariaDescribedby: t, ariaLabelledby: n, autocomplete: r = "o
|
|
|
7604
7608
|
})
|
|
7605
7609
|
});
|
|
7606
7610
|
});
|
|
7607
|
-
|
|
7611
|
+
Ao.displayName = "PktTextinput";
|
|
7608
7612
|
//#endregion
|
|
7609
7613
|
//#region src/components/header/HeaderService.tsx
|
|
7610
|
-
var
|
|
7611
|
-
typeof window < "u" && (window.pktLogoPath = window.pktLogoPath ||
|
|
7612
|
-
var
|
|
7614
|
+
var jo = "https://punkt-cdn.oslo.kommune.no/latest/logos/";
|
|
7615
|
+
typeof window < "u" && (window.pktLogoPath = window.pktLogoPath || jo);
|
|
7616
|
+
var Mo = 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 = Vn, logoClick: ee, logoPath: te = typeof window < "u" ? window.pktLogoPath : jo, position: ne = "fixed", scrollBehavior: F = "hide", slotMenuVariant: re = "icon-only", slotMenuText: ie, strings: ae }, oe) => {
|
|
7613
7617
|
let se = F === "hide";
|
|
7614
7618
|
c(() => {
|
|
7615
7619
|
O && console.warn("PktHeaderService: The \"userMenuFooter\" prop is deprecated and will be removed in a future version. Please use \"userMenu\" instead.");
|
|
@@ -7628,14 +7632,14 @@ var jo = i(({ mobileBreakpoint: e = 768, tabletBreakpoint: t = 1280, children: n
|
|
|
7628
7632
|
});
|
|
7629
7633
|
}, [E?.lastLoggedIn]), [z, B] = m(u || "none"), [le, ue] = m(u);
|
|
7630
7634
|
u !== le && (ue(u), u !== void 0 && B(u));
|
|
7631
|
-
let [de, V] = m(!1), [H, U] = m(!1), W = p(null), G = p(null), K = p(null), fe = p(null), pe = p(null), { setRef: me, isMobile: q, isTablet: J, isFixed: he, isSticky: ge, hidden: _e, captureFocus: X, flagRestoreFocus: ye, restoreFocus: Z } =
|
|
7635
|
+
let [de, V] = m(!1), [H, U] = m(!1), W = p(null), G = p(null), K = p(null), fe = p(null), pe = p(null), { setRef: me, isMobile: q, isTablet: J, isFixed: he, isSticky: ge, hidden: _e, captureFocus: X, flagRestoreFocus: ye, restoreFocus: Z } = oo({
|
|
7632
7636
|
forwardedRef: oe,
|
|
7633
7637
|
mobileBreakpoint: e,
|
|
7634
7638
|
tabletBreakpoint: t,
|
|
7635
7639
|
position: ne,
|
|
7636
7640
|
scrollBehavior: F
|
|
7637
7641
|
});
|
|
7638
|
-
|
|
7642
|
+
so((he || ge) && q && z !== "none");
|
|
7639
7643
|
let be = o((e, t) => {
|
|
7640
7644
|
let n = e.relatedTarget, r;
|
|
7641
7645
|
switch (t) {
|
|
@@ -7717,7 +7721,7 @@ var jo = i(({ mobileBreakpoint: e = 768, tabletBreakpoint: t = 1280, children: n
|
|
|
7717
7721
|
})), T && /* @__PURE__ */ _("span", {
|
|
7718
7722
|
className: "pkt-header-service__service-name",
|
|
7719
7723
|
translate: "no",
|
|
7720
|
-
children: C ? /* @__PURE__ */ _(
|
|
7724
|
+
children: C ? /* @__PURE__ */ _(vo, {
|
|
7721
7725
|
href: C,
|
|
7722
7726
|
className: "pkt-header-service__service-link ",
|
|
7723
7727
|
children: T
|
|
@@ -7780,7 +7784,7 @@ var jo = i(({ mobileBreakpoint: e = 768, tabletBreakpoint: t = 1280, children: n
|
|
|
7780
7784
|
}), /* @__PURE__ */ _("div", {
|
|
7781
7785
|
className: (0, M.default)("pkt-header-service__mobile-menu", z === "search" && "is-open", H && "align-right"),
|
|
7782
7786
|
ref: pe,
|
|
7783
|
-
children: z === "search" && /* @__PURE__ */ _(
|
|
7787
|
+
children: z === "search" && /* @__PURE__ */ _(Ao, {
|
|
7784
7788
|
id: "mobile-search-menu",
|
|
7785
7789
|
className: "pkt-header-service__search-input",
|
|
7786
7790
|
type: "search",
|
|
@@ -7796,7 +7800,7 @@ var jo = i(({ mobileBreakpoint: e = 768, tabletBreakpoint: t = 1280, children: n
|
|
|
7796
7800
|
}
|
|
7797
7801
|
})
|
|
7798
7802
|
})]
|
|
7799
|
-
}) : /* @__PURE__ */ _(
|
|
7803
|
+
}) : /* @__PURE__ */ _(Ao, {
|
|
7800
7804
|
id: "header-service-search",
|
|
7801
7805
|
className: "pkt-header-service__search-input",
|
|
7802
7806
|
type: "search",
|
|
@@ -7843,7 +7847,7 @@ var jo = i(({ mobileBreakpoint: e = 768, tabletBreakpoint: t = 1280, children: n
|
|
|
7843
7847
|
})]
|
|
7844
7848
|
}), z === "user" && E && /* @__PURE__ */ _("div", {
|
|
7845
7849
|
className: (0, M.default)(q ? "pkt-header-service__mobile-menu" : "pkt-header-service__user-menu", "is-open"),
|
|
7846
|
-
children: /* @__PURE__ */ _(
|
|
7850
|
+
children: /* @__PURE__ */ _(So, {
|
|
7847
7851
|
strings: ae,
|
|
7848
7852
|
user: E,
|
|
7849
7853
|
formattedLastLoggedIn: ce,
|
|
@@ -7870,20 +7874,20 @@ var jo = i(({ mobileBreakpoint: e = 768, tabletBreakpoint: t = 1280, children: n
|
|
|
7870
7874
|
children: [Ce, /* @__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", J && "pkt-header-service-spacer--tablet") })]
|
|
7871
7875
|
}) : Ce;
|
|
7872
7876
|
});
|
|
7873
|
-
|
|
7877
|
+
Mo.displayName = "PktHeaderService";
|
|
7874
7878
|
//#endregion
|
|
7875
7879
|
//#region src/components/header/Header.tsx
|
|
7876
|
-
var
|
|
7880
|
+
var No = i((e, t) => e.type === "global" ? /* @__PURE__ */ _(ko, {
|
|
7877
7881
|
...e,
|
|
7878
7882
|
ref: t
|
|
7879
|
-
}) : /* @__PURE__ */ _(
|
|
7883
|
+
}) : /* @__PURE__ */ _(Mo, {
|
|
7880
7884
|
...e,
|
|
7881
7885
|
ref: t
|
|
7882
7886
|
}));
|
|
7883
|
-
|
|
7887
|
+
No.displayName = "PktHeader";
|
|
7884
7888
|
//#endregion
|
|
7885
7889
|
//#region src/components/input/Input.tsx
|
|
7886
|
-
var
|
|
7890
|
+
var Po = i(({ label: e, id: t, children: n, ...r }, i) => /* @__PURE__ */ v("div", {
|
|
7887
7891
|
className: "pkt-form-group",
|
|
7888
7892
|
children: [
|
|
7889
7893
|
/* @__PURE__ */ _("label", {
|
|
@@ -7900,10 +7904,10 @@ var No = i(({ label: e, id: t, children: n, ...r }, i) => /* @__PURE__ */ v("div
|
|
|
7900
7904
|
n
|
|
7901
7905
|
]
|
|
7902
7906
|
}));
|
|
7903
|
-
|
|
7907
|
+
Po.displayName = "PktInput";
|
|
7904
7908
|
//#endregion
|
|
7905
7909
|
//#region src/components/linkcard/LinkCard.tsx
|
|
7906
|
-
var
|
|
7910
|
+
var Fo = ({ children: e, skin: t, title: n, href: r, iconName: i, openInNewTab: a, external: o, className: s, strings: c, ...l }) => {
|
|
7907
7911
|
let u = ve(["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(" ");
|
|
7908
7912
|
return /* @__PURE__ */ v("a", {
|
|
7909
7913
|
...l,
|
|
@@ -7933,14 +7937,14 @@ var Po = ({ children: e, skin: t, title: n, href: r, iconName: i, openInNewTab:
|
|
|
7933
7937
|
};
|
|
7934
7938
|
//#endregion
|
|
7935
7939
|
//#region src/components/loader/Loader.tsx
|
|
7936
|
-
|
|
7937
|
-
var
|
|
7940
|
+
Fo.displayName = "PktLinkCard", typeof window < "u" && (window.pktAnimationPath = window.pktAnimationPath || "https://punkt-cdn.oslo.kommune.no/latest/animations/");
|
|
7941
|
+
var Io = (e) => {
|
|
7938
7942
|
switch (e) {
|
|
7939
7943
|
case "blue": return "spinner-blue";
|
|
7940
7944
|
case "rainbow": return "spinner";
|
|
7941
7945
|
default: return "loader";
|
|
7942
7946
|
}
|
|
7943
|
-
},
|
|
7947
|
+
}, Lo = 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) {
|
|
7944
7948
|
let [f, p] = m(!1), [h, g] = m(e);
|
|
7945
7949
|
e !== h && (g(e), p(!1)), c(() => {
|
|
7946
7950
|
if (e <= 0) return;
|
|
@@ -7958,7 +7962,7 @@ var Fo = (e) => {
|
|
|
7958
7962
|
children: [n && y && /* @__PURE__ */ v("div", {
|
|
7959
7963
|
className: "pkt-loader__spinner",
|
|
7960
7964
|
children: [/* @__PURE__ */ _(L, {
|
|
7961
|
-
name:
|
|
7965
|
+
name: Io(a),
|
|
7962
7966
|
path: o,
|
|
7963
7967
|
className: `pkt-loader__svg pkt-loader__${a}`
|
|
7964
7968
|
}), r && /* @__PURE__ */ _("p", { children: r })]
|
|
@@ -7968,10 +7972,10 @@ var Fo = (e) => {
|
|
|
7968
7972
|
})]
|
|
7969
7973
|
});
|
|
7970
7974
|
});
|
|
7971
|
-
|
|
7975
|
+
Lo.displayName = "PktLoader";
|
|
7972
7976
|
//#endregion
|
|
7973
7977
|
//#region src/components/messagebox/Messagebox.tsx
|
|
7974
|
-
var
|
|
7978
|
+
var Ro = ({ children: e, className: t, skin: n, title: i, compact: a, closable: s, onClose: c, strings: l, ...u }) => {
|
|
7975
7979
|
let d = ve(["generic"], l), [f, p] = m(!1), h = {
|
|
7976
7980
|
"pkt-messagebox": !0,
|
|
7977
7981
|
"pkt-messagebox--compact": a,
|
|
@@ -8009,11 +8013,11 @@ var Lo = ({ children: e, className: t, skin: n, title: i, compact: a, closable:
|
|
|
8009
8013
|
]
|
|
8010
8014
|
});
|
|
8011
8015
|
};
|
|
8012
|
-
|
|
8016
|
+
Ro.displayName = "PktMessagebox";
|
|
8013
8017
|
//#endregion
|
|
8014
8018
|
//#region src/components/radio/RadioButton.tsx
|
|
8015
|
-
var
|
|
8016
|
-
let S = ve(["forms"], m), C =
|
|
8019
|
+
var zo = i(({ id: e, name: t, label: n, className: r, hasTile: i = !1, disabled: a = !1, checkHelptext: o, hasError: s = !1, defaultChecked: c, checked: l, optionalTag: u, optionalText: d, requiredTag: f, requiredText: p, strings: m, tagText: h, "aria-describedby": y, ...b }, x) => {
|
|
8020
|
+
let S = ve(["forms"], m), C = Qn(e), w = [r, "pkt-input-check"].filter(Boolean).join(" "), T = [
|
|
8017
8021
|
"pkt-input-check__input",
|
|
8018
8022
|
i ? "pkt-input-check__input--tile" : "",
|
|
8019
8023
|
a && i ? "pkt-input-check__input--tile-disabled" : ""
|
|
@@ -8069,14 +8073,14 @@ var Ro = i(({ id: e, name: t, label: n, className: r, hasTile: i = !1, disabled:
|
|
|
8069
8073
|
})
|
|
8070
8074
|
});
|
|
8071
8075
|
});
|
|
8072
|
-
|
|
8076
|
+
zo.displayName = "PktRadioButton";
|
|
8073
8077
|
//#endregion
|
|
8074
8078
|
//#region src/components/select/Select.tsx
|
|
8075
|
-
var
|
|
8076
|
-
let D =
|
|
8079
|
+
var Bo = 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) => {
|
|
8080
|
+
let D = Qn(u), O = [r, "pkt-select"].filter(Boolean).join(" ");
|
|
8077
8081
|
return /* @__PURE__ */ _("div", {
|
|
8078
8082
|
className: O,
|
|
8079
|
-
children: /* @__PURE__ */ _(
|
|
8083
|
+
children: /* @__PURE__ */ _(sr, {
|
|
8080
8084
|
strings: w,
|
|
8081
8085
|
forId: `${D}-input`,
|
|
8082
8086
|
label: p,
|
|
@@ -8101,7 +8105,7 @@ var zo = i(({ ariaDescribedby: e, ariaLabelledby: t, children: n, className: r,
|
|
|
8101
8105
|
className: `pkt-input pkt-input--${C} ${f ? "pkt-input--fullwidth" : ""}`,
|
|
8102
8106
|
"aria-invalid": o,
|
|
8103
8107
|
"aria-errormessage": o ? `${D}-error` : void 0,
|
|
8104
|
-
"aria-describedby":
|
|
8108
|
+
"aria-describedby": tr({
|
|
8105
8109
|
id: `${D}-input`,
|
|
8106
8110
|
hasHelptext: !!s,
|
|
8107
8111
|
hasCounter: !1,
|
|
@@ -8117,10 +8121,10 @@ var zo = i(({ ariaDescribedby: e, ariaLabelledby: t, children: n, className: r,
|
|
|
8117
8121
|
})
|
|
8118
8122
|
});
|
|
8119
8123
|
});
|
|
8120
|
-
|
|
8124
|
+
Bo.displayName = "PktSelect";
|
|
8121
8125
|
//#endregion
|
|
8122
8126
|
//#region src/components/stepper/Step.tsx
|
|
8123
|
-
var
|
|
8127
|
+
var Vo = /* @__PURE__ */ _("svg", {
|
|
8124
8128
|
xmlns: "http://www.w3.org/2000/svg",
|
|
8125
8129
|
width: "24",
|
|
8126
8130
|
height: "24",
|
|
@@ -8131,7 +8135,7 @@ var Bo = /* @__PURE__ */ _("svg", {
|
|
|
8131
8135
|
r: "7",
|
|
8132
8136
|
style: { fill: "var(--pkt-color-brand-neutrals-300, #CCC)" }
|
|
8133
8137
|
})
|
|
8134
|
-
}),
|
|
8138
|
+
}), Ho = /* @__PURE__ */ v("svg", {
|
|
8135
8139
|
xmlns: "http://www.w3.org/2000/svg",
|
|
8136
8140
|
width: "24",
|
|
8137
8141
|
height: "24",
|
|
@@ -8148,7 +8152,7 @@ var Bo = /* @__PURE__ */ _("svg", {
|
|
|
8148
8152
|
r: "6",
|
|
8149
8153
|
fill: "#2A2859"
|
|
8150
8154
|
})]
|
|
8151
|
-
}),
|
|
8155
|
+
}), Uo = /* @__PURE__ */ v("svg", {
|
|
8152
8156
|
xmlns: "http://www.w3.org/2000/svg",
|
|
8153
8157
|
width: "24",
|
|
8154
8158
|
height: "24",
|
|
@@ -8160,7 +8164,7 @@ var Bo = /* @__PURE__ */ _("svg", {
|
|
|
8160
8164
|
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",
|
|
8161
8165
|
fill: "#F1FDFF"
|
|
8162
8166
|
})]
|
|
8163
|
-
}),
|
|
8167
|
+
}), Wo = ({ children: e, className: t, status: n = "incomplete", title: r }) => /* @__PURE__ */ v("li", {
|
|
8164
8168
|
className: (0, M.default)("pkt-step", t, `pkt-step--${n}`),
|
|
8165
8169
|
"data-testid": "pkt-step",
|
|
8166
8170
|
children: [
|
|
@@ -8174,7 +8178,7 @@ var Bo = /* @__PURE__ */ _("svg", {
|
|
|
8174
8178
|
}),
|
|
8175
8179
|
/* @__PURE__ */ _("span", {
|
|
8176
8180
|
className: (0, M.default)("pkt-step__indicator"),
|
|
8177
|
-
children: n === "current" ?
|
|
8181
|
+
children: n === "current" ? Ho : n === "completed" ? Uo : Vo
|
|
8178
8182
|
}),
|
|
8179
8183
|
/* @__PURE__ */ _("span", {
|
|
8180
8184
|
className: "pkt-step__line pkt-step__line--3",
|
|
@@ -8191,7 +8195,7 @@ var Bo = /* @__PURE__ */ _("svg", {
|
|
|
8191
8195
|
})]
|
|
8192
8196
|
})
|
|
8193
8197
|
]
|
|
8194
|
-
}),
|
|
8198
|
+
}), Go = i(({ activeStep: n, className: r, children: i, hideNonActiveSteps: o = !1, hideNonActiveStepsContent: s = !0, orientation: c = "vertical", ...l }, u) => {
|
|
8195
8199
|
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, {
|
|
8196
8200
|
"pkt-step--hideStep": o && r !== n,
|
|
8197
8201
|
"pkt-step--hideContent": s && r !== n
|
|
@@ -8204,10 +8208,10 @@ var Bo = /* @__PURE__ */ _("svg", {
|
|
|
8204
8208
|
children: f
|
|
8205
8209
|
});
|
|
8206
8210
|
});
|
|
8207
|
-
|
|
8211
|
+
Go.displayName = "PktStepper";
|
|
8208
8212
|
//#endregion
|
|
8209
8213
|
//#region src/components/table/Table.tsx
|
|
8210
|
-
var
|
|
8214
|
+
var Ko = ({ className: e, compact: t = !1, skin: n = "basic", responsiveView: r = !0, children: i, ...a }) => /* @__PURE__ */ _("table", {
|
|
8211
8215
|
"data-testid": "pkt-table",
|
|
8212
8216
|
className: (0, M.default)(e, "pkt-table", {
|
|
8213
8217
|
"pkt-table--responsive": r,
|
|
@@ -8218,36 +8222,36 @@ var Go = ({ className: e, compact: t = !1, skin: n = "basic", responsiveView: r
|
|
|
8218
8222
|
role: "table",
|
|
8219
8223
|
...a,
|
|
8220
8224
|
children: i
|
|
8221
|
-
}),
|
|
8225
|
+
}), qo = ({ id: e, children: t, className: n, ...r }) => /* @__PURE__ */ _("tbody", {
|
|
8222
8226
|
id: e,
|
|
8223
8227
|
className: (0, M.default)(n, "pkt-table__body", {}),
|
|
8224
8228
|
...r,
|
|
8225
8229
|
role: "rowgroup",
|
|
8226
8230
|
children: t
|
|
8227
|
-
}),
|
|
8231
|
+
}), Jo = ({ children: e, className: t, dataLabel: n, ...r }) => /* @__PURE__ */ _("td", {
|
|
8228
8232
|
className: (0, M.default)(t, "pkt-table__data-cell", {}),
|
|
8229
8233
|
"data-label": n,
|
|
8230
8234
|
role: "cell",
|
|
8231
8235
|
"data-testid": "pkt-table__data-cell",
|
|
8232
8236
|
...r,
|
|
8233
8237
|
children: e
|
|
8234
|
-
}),
|
|
8238
|
+
}), Yo = ({ className: e, children: t, ...n }) => /* @__PURE__ */ _("thead", {
|
|
8235
8239
|
className: (0, M.default)(e, "pkt-table__header", {}),
|
|
8236
8240
|
role: "rowgroup",
|
|
8237
8241
|
...n,
|
|
8238
8242
|
children: t
|
|
8239
|
-
}),
|
|
8243
|
+
}), Xo = ({ className: e, children: t, ...n }) => /* @__PURE__ */ _("th", {
|
|
8240
8244
|
className: (0, M.default)(e, "pkt-table__header-cell", {}),
|
|
8241
8245
|
role: "columnheader",
|
|
8242
8246
|
...n,
|
|
8243
8247
|
children: t
|
|
8244
|
-
}),
|
|
8248
|
+
}), Zo = ({ className: e, children: t, ...n }) => /* @__PURE__ */ _("tr", {
|
|
8245
8249
|
className: (0, M.default)(e, "pkt-table__row", {}),
|
|
8246
8250
|
role: "row",
|
|
8247
8251
|
...n,
|
|
8248
8252
|
children: t
|
|
8249
|
-
}),
|
|
8250
|
-
let { arrowNav: d, registerTabRef: f, handleKeyPress: p, selectTab: m } =
|
|
8253
|
+
}), Qo = i(({ children: e, active: t, disabled: n = !1, href: r, onClick: i, icon: a, controls: o, tag: s, tagSkin: c, index: l = 0 }, u) => {
|
|
8254
|
+
let { arrowNav: d, registerTabRef: f, handleKeyPress: p, selectTab: m } = es(), h = !!t && !n, y = {
|
|
8251
8255
|
"aria-selected": d ? h : void 0,
|
|
8252
8256
|
"aria-controls": o,
|
|
8253
8257
|
role: d ? "tab" : void 0,
|
|
@@ -8275,7 +8279,7 @@ var Go = ({ className: e, compact: t = !1, skin: n = "basic", responsiveView: r
|
|
|
8275
8279
|
className: `pkt-icon--small ${a === "check" ? "pkt-tabs__status-icon" : ""}`
|
|
8276
8280
|
}),
|
|
8277
8281
|
e,
|
|
8278
|
-
s && /* @__PURE__ */ _(
|
|
8282
|
+
s && /* @__PURE__ */ _(Jn, {
|
|
8279
8283
|
skin: c,
|
|
8280
8284
|
size: "small",
|
|
8281
8285
|
children: s
|
|
@@ -8296,14 +8300,14 @@ var Go = ({ className: e, compact: t = !1, skin: n = "basic", responsiveView: r
|
|
|
8296
8300
|
children: b
|
|
8297
8301
|
});
|
|
8298
8302
|
});
|
|
8299
|
-
|
|
8303
|
+
Qo.displayName = "PktTabItem";
|
|
8300
8304
|
//#endregion
|
|
8301
8305
|
//#region src/components/tabs/Tabs.tsx
|
|
8302
|
-
var
|
|
8303
|
-
let e = s(
|
|
8306
|
+
var $o = n(null), es = () => {
|
|
8307
|
+
let e = s($o);
|
|
8304
8308
|
if (!e) throw Error("TabItem must be used within a Tabs component");
|
|
8305
8309
|
return e;
|
|
8306
|
-
},
|
|
8310
|
+
}, ts = i(({ arrowNav: t = !0, disableArrowNav: n = !1, separatorIconName: r, separatorIconPath: i, tabs: a, onTabSelected: o, children: s }, l) => {
|
|
8307
8311
|
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);
|
|
8308
8312
|
c(() => {
|
|
8309
8313
|
u.current = u.current.slice(0, g), Object.keys(d.current).forEach((e) => {
|
|
@@ -8350,7 +8354,7 @@ var Qo = n(null), $o = () => {
|
|
|
8350
8354
|
name: r,
|
|
8351
8355
|
className: "pkt-tabs__separator-icon"
|
|
8352
8356
|
}) : null
|
|
8353
|
-
}, e), T = (e) => !v || e.length <= 1 ? e : e.flatMap((t, n) => n < e.length - 1 ? [t, w(`separator-${n}`)] : [t]), E = be(a ?? [], (e) => `${e.href ?? ""}|${e.text}`).map(({ item: e, key: t }, n) => /* @__PURE__ */ _(
|
|
8357
|
+
}, e), T = (e) => !v || e.length <= 1 ? e : e.flatMap((t, n) => n < e.length - 1 ? [t, w(`separator-${n}`)] : [t]), E = be(a ?? [], (e) => `${e.href ?? ""}|${e.text}`).map(({ item: e, key: t }, n) => /* @__PURE__ */ _(Qo, {
|
|
8354
8358
|
active: !e.disabled && e.active,
|
|
8355
8359
|
disabled: e.disabled,
|
|
8356
8360
|
href: e.href,
|
|
@@ -8361,7 +8365,7 @@ var Qo = n(null), $o = () => {
|
|
|
8361
8365
|
index: n,
|
|
8362
8366
|
children: e.text
|
|
8363
8367
|
}, t)), D = ["pkt-tabs", v && "pkt-tabs--with-separator"].filter(Boolean).join(" "), O = T(h ? m : E || []);
|
|
8364
|
-
return /* @__PURE__ */ _(
|
|
8368
|
+
return /* @__PURE__ */ _($o.Provider, {
|
|
8365
8369
|
value: {
|
|
8366
8370
|
arrowNav: f,
|
|
8367
8371
|
registerTabRef: C,
|
|
@@ -8379,53 +8383,53 @@ var Qo = n(null), $o = () => {
|
|
|
8379
8383
|
})
|
|
8380
8384
|
});
|
|
8381
8385
|
});
|
|
8382
|
-
|
|
8386
|
+
ts.displayName = "PktTabs";
|
|
8383
8387
|
//#endregion
|
|
8384
8388
|
//#region ../../shared-utils/timepicker/options.ts
|
|
8385
|
-
var
|
|
8389
|
+
var ns = (e) => e ? Math.max(1, Math.round(e / 60)) : 1, rs = (e, t) => {
|
|
8386
8390
|
let n = e ? parseInt(String(e).split(":")[0], 10) : 0, r = t ? parseInt(String(t).split(":")[0], 10) : 23;
|
|
8387
8391
|
return Array.from({ length: r - n + 1 }, (e, t) => t + n);
|
|
8388
|
-
},
|
|
8389
|
-
let t =
|
|
8392
|
+
}, is = (e) => {
|
|
8393
|
+
let t = ns(e);
|
|
8390
8394
|
return Array.from({ length: Math.floor(60 / t) }, (e, n) => n * t);
|
|
8391
|
-
},
|
|
8395
|
+
}, as = (e, t, n, r) => {
|
|
8392
8396
|
let i = e === "" ? n === 1 ? 0 : 23 : parseInt(e, 10), a = t === "" ? n === 1 ? 0 : Math.floor(59 / r) * r : parseInt(t, 10);
|
|
8393
8397
|
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), {
|
|
8394
8398
|
hours: String(i).padStart(2, "0"),
|
|
8395
8399
|
minutes: String(a).padStart(2, "0")
|
|
8396
8400
|
};
|
|
8397
|
-
},
|
|
8401
|
+
}, os = (e) => /^\d{2}:\d{2}$/.test(e) && parseInt(e.slice(0, 2), 10) <= 23 && parseInt(e.slice(3), 10) <= 59, ss = (e) => {
|
|
8398
8402
|
let [t, n] = e.split(":").map(Number);
|
|
8399
8403
|
return t * 60 + n;
|
|
8400
8404
|
};
|
|
8401
8405
|
//#endregion
|
|
8402
8406
|
//#region src/components/timepicker/useTimepickerState.ts
|
|
8403
|
-
function
|
|
8404
|
-
if (e &&
|
|
8407
|
+
function cs(e) {
|
|
8408
|
+
if (e && os(e)) {
|
|
8405
8409
|
let [t, n] = e.split(":");
|
|
8406
8410
|
return [t, n];
|
|
8407
8411
|
}
|
|
8408
8412
|
return ["", ""];
|
|
8409
8413
|
}
|
|
8410
|
-
function
|
|
8414
|
+
function ls(e, t) {
|
|
8411
8415
|
return `${String(parseInt(e, 10)).padStart(2, "0")}:${String(parseInt(t, 10)).padStart(2, "0")}`;
|
|
8412
8416
|
}
|
|
8413
|
-
function
|
|
8417
|
+
function us(e, t, n) {
|
|
8414
8418
|
let { required: r, min: i, max: a, step: o } = t;
|
|
8415
8419
|
if (r && !e) return {
|
|
8416
8420
|
valid: !1,
|
|
8417
8421
|
message: n.valueMissing
|
|
8418
8422
|
};
|
|
8419
8423
|
if (!e) return { valid: !0 };
|
|
8420
|
-
if (!
|
|
8424
|
+
if (!os(e)) return {
|
|
8421
8425
|
valid: !1,
|
|
8422
8426
|
message: n.typeMismatch
|
|
8423
8427
|
};
|
|
8424
|
-
let s =
|
|
8425
|
-
return i && s <
|
|
8428
|
+
let s = ss(e), c = ns(o);
|
|
8429
|
+
return i && s < ss(String(i)) ? {
|
|
8426
8430
|
valid: !1,
|
|
8427
8431
|
message: B(n.rangeUnderflowMin, { min: String(i) })
|
|
8428
|
-
} : a && s >
|
|
8432
|
+
} : a && s > ss(String(a)) ? {
|
|
8429
8433
|
valid: !1,
|
|
8430
8434
|
message: B(n.rangeOverflowMax, { max: String(a) })
|
|
8431
8435
|
} : o && s % c !== 0 ? {
|
|
@@ -8433,24 +8437,24 @@ function ls(e, t, n) {
|
|
|
8433
8437
|
message: c === 60 ? n.timeStepMismatchHour : c === 30 ? n.timeStepMismatchHalfHour : B(n.timeStepMismatch, { step: `${c}, ${c * 2}, ${c * 3}` })
|
|
8434
8438
|
} : { valid: !0 };
|
|
8435
8439
|
}
|
|
8436
|
-
function
|
|
8440
|
+
function ds(e) {
|
|
8437
8441
|
return e === 3600 || e < 3600 && 3600 % e == 0 && e % 60 == 0;
|
|
8438
8442
|
}
|
|
8439
|
-
function
|
|
8440
|
-
let { id: n, label: r, value: i, defaultValue: a, min: s, max: l, step: h = 60, hidePicker: g = !1, stepArrows: _ = !1, fullwidth: v = !1, name: y, form: b, disabled: x = !1, required: S = !1, helptext: C, helptextDropdown: w, helptextDropdownButton: T, hasError: E = !1, errorMessage: D, optionalTag: O = !1, optionalText: k, requiredTag: A = !1, requiredText: j, tagText: M, inline: N = !1, useWrapper: P = !0, ariaDescribedby: ee, strings: te, className: ne, inputSize: F = "medium", onValueChange: re, onFocus: ie, onBlur: ae } = e, oe = ve(["timepicker", "validation"], te), se = oe.timepicker, I = te, L = i !== void 0, R = i === void 0 ? a ?? "" : i ?? "", ce = p(R), [z, B] = m(() => R), le = L ? i ?? "" : z, [ue, de] = m(() =>
|
|
8443
|
+
function fs(e, t) {
|
|
8444
|
+
let { id: n, label: r, value: i, defaultValue: a, min: s, max: l, step: h = 60, hidePicker: g = !1, stepArrows: _ = !1, fullwidth: v = !1, name: y, form: b, disabled: x = !1, required: S = !1, helptext: C, helptextDropdown: w, helptextDropdownButton: T, hasError: E = !1, errorMessage: D, optionalTag: O = !1, optionalText: k, requiredTag: A = !1, requiredText: j, tagText: M, inline: N = !1, useWrapper: P = !0, ariaDescribedby: ee, strings: te, className: ne, inputSize: F = "medium", onValueChange: re, onFocus: ie, onBlur: ae } = e, oe = ve(["timepicker", "validation"], te), se = oe.timepicker, I = te, L = i !== void 0, R = i === void 0 ? a ?? "" : i ?? "", ce = p(R), [z, B] = m(() => R), le = L ? i ?? "" : z, [ue, de] = m(() => cs(i === void 0 ? a : i)[0]), [V, H] = m(() => cs(i === void 0 ? a : i)[1]), U = p(ue), W = p(V), G = o((e) => {
|
|
8441
8445
|
U.current = e, de(e);
|
|
8442
8446
|
}, []), K = o((e) => {
|
|
8443
8447
|
W.current = e, H(e);
|
|
8444
8448
|
}, []), [fe, pe] = m(!1), [me, q] = m(i);
|
|
8445
8449
|
if (L && i !== me) {
|
|
8446
8450
|
q(i);
|
|
8447
|
-
let [e, t] =
|
|
8451
|
+
let [e, t] = cs(i);
|
|
8448
8452
|
G(e), K(t);
|
|
8449
8453
|
}
|
|
8450
8454
|
c(() => {
|
|
8451
|
-
h != null && !
|
|
8455
|
+
h != null && !ds(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).`);
|
|
8452
8456
|
}, [h]);
|
|
8453
|
-
let J = p(null), he = p(null), ge = p(null), Y = p(null), _e = p(null), X = p(null), ye =
|
|
8457
|
+
let J = p(null), he = p(null), ge = p(null), Y = p(null), _e = p(null), X = p(null), ye = Mr(_e, b), Z = p(0), be = p(-1), xe = p(0), Q = p(-1), [Se, Ce] = m(!1), we = f(() => Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value")?.set, []), Te = f(() => ns(h), [h]), Ee = f(() => rs(s, l), [s, l]), De = f(() => is(h), [h]), Oe = `${n}-hours`, ke = `${n}-minutes`, Ae = `${n}-popup`, je = `${n}-input`, Me = f(() => us(le, {
|
|
8454
8458
|
required: S,
|
|
8455
8459
|
min: s,
|
|
8456
8460
|
max: l,
|
|
@@ -8477,20 +8481,20 @@ function ds(e, t) {
|
|
|
8477
8481
|
]), Pe = o(() => {
|
|
8478
8482
|
let e = U.current, t = W.current;
|
|
8479
8483
|
if (e !== "" && t !== "") {
|
|
8480
|
-
let n =
|
|
8484
|
+
let n = ls(e, t);
|
|
8481
8485
|
n !== le && $(n);
|
|
8482
8486
|
} else le !== "" && $("");
|
|
8483
8487
|
}, [le, $]), Fe = o(() => {
|
|
8484
8488
|
let e = U.current, t = W.current;
|
|
8485
8489
|
if (e !== "" && t !== "") {
|
|
8486
|
-
let n =
|
|
8490
|
+
let n = ls(e, t);
|
|
8487
8491
|
n === le ? X.current?.dispatchEvent(new Event("input", { bubbles: !0 })) : $(n);
|
|
8488
8492
|
} else le === "" ? X.current?.dispatchEvent(new Event("input", { bubbles: !0 })) : $("");
|
|
8489
8493
|
}, [le, $]), Ie = o(() => {
|
|
8490
8494
|
Ce(!0), Pe();
|
|
8491
8495
|
let e = J.current, t = X.current;
|
|
8492
8496
|
if (!e) return;
|
|
8493
|
-
let n =
|
|
8497
|
+
let n = us(t?.value ?? "", {
|
|
8494
8498
|
required: S,
|
|
8495
8499
|
min: s,
|
|
8496
8500
|
max: l,
|
|
@@ -8563,7 +8567,7 @@ function ds(e, t) {
|
|
|
8563
8567
|
G,
|
|
8564
8568
|
K
|
|
8565
8569
|
]), Be = o((e) => {
|
|
8566
|
-
let t =
|
|
8570
|
+
let t = as(U.current, W.current, e, Te);
|
|
8567
8571
|
G(t.hours), K(t.minutes), `${t.hours}:${t.minutes}` !== le && $(`${t.hours}:${t.minutes}`);
|
|
8568
8572
|
}, [
|
|
8569
8573
|
Te,
|
|
@@ -8781,7 +8785,7 @@ function ds(e, t) {
|
|
|
8781
8785
|
set value(e) {
|
|
8782
8786
|
let t = e ?? "";
|
|
8783
8787
|
L || B(t);
|
|
8784
|
-
let [n, r] =
|
|
8788
|
+
let [n, r] = cs(t);
|
|
8785
8789
|
G(n), K(r), X.current && (X.current.value = t);
|
|
8786
8790
|
},
|
|
8787
8791
|
focus() {
|
|
@@ -8798,7 +8802,7 @@ function ds(e, t) {
|
|
|
8798
8802
|
if (!ye) return;
|
|
8799
8803
|
let e, t = () => {
|
|
8800
8804
|
window.clearTimeout(e), e = window.setTimeout(() => {
|
|
8801
|
-
let e = ce.current, [t, n] =
|
|
8805
|
+
let e = ce.current, [t, n] = cs(e);
|
|
8802
8806
|
G(t), K(n), L || B(e), X.current && (X.current.value = e), pe(!1), Ce(!1);
|
|
8803
8807
|
}, 0);
|
|
8804
8808
|
};
|
|
@@ -8878,8 +8882,8 @@ function ds(e, t) {
|
|
|
8878
8882
|
}
|
|
8879
8883
|
//#endregion
|
|
8880
8884
|
//#region src/components/timepicker/Timepicker.tsx
|
|
8881
|
-
var
|
|
8882
|
-
let { onChange: n, inputSize: r = "medium" } = e, i =
|
|
8885
|
+
var ps = i((e, t) => {
|
|
8886
|
+
let { onChange: n, inputSize: r = "medium" } = e, i = fs(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 = tr({
|
|
8883
8887
|
id: i.hoursId,
|
|
8884
8888
|
hasHelptext: !!i.helptext,
|
|
8885
8889
|
ariaDescribedby: i.ariaDescribedby
|
|
@@ -9064,7 +9068,7 @@ var fs = i((e, t) => {
|
|
|
9064
9068
|
id: i.id || void 0,
|
|
9065
9069
|
onFocus: i.handleFocusIn,
|
|
9066
9070
|
onBlur: i.handleFocusOut,
|
|
9067
|
-
children: /* @__PURE__ */ _(
|
|
9071
|
+
children: /* @__PURE__ */ _(sr, {
|
|
9068
9072
|
strings: i.stringsOverride,
|
|
9069
9073
|
forId: i.hoursId,
|
|
9070
9074
|
label: i.label,
|
|
@@ -9091,6 +9095,6 @@ var fs = i((e, t) => {
|
|
|
9091
9095
|
})
|
|
9092
9096
|
});
|
|
9093
9097
|
});
|
|
9094
|
-
|
|
9098
|
+
ps.displayName = "PktTimepicker";
|
|
9095
9099
|
//#endregion
|
|
9096
|
-
export {
|
|
9100
|
+
export { Di as FileItem, ka as ItemRenderers, j as PktAccordion, R as PktAccordionItem, ye as PktAlert, Z as PktBackLink, Q as PktBreadcrumbs, Y as PktButton, zn as PktCalendar, Yn as PktCard, $n as PktCheckbox, Fr as PktCombobox, Br as PktConsent, ti as PktDatepicker, Aa as PktFileUpload, no as PktFooter, io as PktFooterSimple, No as PktHeader, ko as PktHeaderGlobal, co as PktHeaderMenu, Mo as PktHeaderService, qn as PktHeading, or as PktHelptext, L as PktIcon, Po as PktInput, sr as PktInputWrapper, vo as PktLink, Fo as PktLinkCard, Lo as PktLoader, Ro as PktMessagebox, oa as PktModal, Yi as PktProgressbar, zo as PktRadioButton, Co as PktSearchInput, Bo as PktSelect, Wo as PktStep, Go as PktStepper, X as PktStringsProvider, Qo as PktTabItem, Ko as PktTable, qo as PktTableBody, Jo as PktTableDataCell, Yo as PktTableHeader, Xo as PktTableHeaderCell, Zo as PktTableRow, ts as PktTabs, Jn as PktTag, ji as PktTextarea, Ao as PktTextinput, ps as PktTimepicker, W as getPktStrings, ce as pktStringsNb, G as resetPktStrings, U as setPktStrings, K as subscribePktStrings };
|