@oslokommune/punkt-react 20.0.3 → 20.0.5
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/_virtual/{_@oxc-project_runtime@0.154.0 → _@oxc-project_runtime@0.156.0}/helpers/esm/defineProperty.js +1 -2
- package/dist/_virtual/{_@oxc-project_runtime@0.154.0 → _@oxc-project_runtime@0.156.0}/helpers/esm/toPrimitive.js +1 -2
- package/dist/_virtual/{_@oxc-project_runtime@0.154.0 → _@oxc-project_runtime@0.156.0}/helpers/esm/toPropertyKey.js +1 -2
- package/dist/_virtual/{_@oxc-project_runtime@0.154.0 → _@oxc-project_runtime@0.156.0}/helpers/esm/typeof.js +1 -2
- package/dist/_virtual/_rolldown/runtime.js +1 -2
- package/dist/components/accordion/Accordion.js +1 -2
- package/dist/components/accordion/AccordionItem.js +9 -10
- package/dist/components/alert/Alert.js +7 -8
- package/dist/components/backlink/BackLink.js +1 -2
- package/dist/components/breadcrumbs/Breadcrumbs.js +1 -2
- package/dist/components/button/Button.js +1 -2
- package/dist/components/calendar/Calendar.js +1 -2
- package/dist/components/calendar/CalendarGrid.js +1 -2
- package/dist/components/calendar/CalendarNav.js +5 -6
- package/dist/components/calendar/calendar-utils.js +1 -2
- package/dist/components/calendar/useCalendarState.js +90 -91
- package/dist/components/card/Card.js +14 -15
- package/dist/components/checkbox/Checkbox.js +3 -8
- package/dist/components/checkboxgroup/CheckboxGroup.js +10 -11
- package/dist/components/checkboxgroup/CheckboxGroupContext.js +1 -2
- package/dist/components/combobox/Combobox.js +5 -6
- package/dist/components/combobox/ComboboxInput.js +6 -7
- package/dist/components/combobox/ComboboxTags.js +11 -12
- package/dist/components/combobox/Listbox.js +25 -26
- package/dist/components/combobox/useComboboxState.js +38 -39
- package/dist/components/consent/Consent.js +6 -7
- package/dist/components/datepicker/DateTags.js +14 -15
- package/dist/components/datepicker/Datepicker.js +1 -2
- package/dist/components/datepicker/DatepickerInputs.js +1 -2
- package/dist/components/datepicker/DatepickerPopup.js +5 -6
- package/dist/components/datepicker/useDatepickerState.js +20 -21
- package/dist/components/fileupload/DropZone.js +6 -7
- package/dist/components/fileupload/FileUpload.js +36 -37
- package/dist/components/fileupload/FileUploadContext.js +1 -2
- package/dist/components/fileupload/QueueDisplay.js +12 -13
- package/dist/components/fileupload/QueueItemContent.js +14 -15
- package/dist/components/fileupload/Subcomponents.js +70 -71
- package/dist/components/fileupload/Truncate.js +1 -2
- package/dist/components/fileupload/extensions/Comments.js +21 -22
- package/dist/components/fileupload/extensions/Remove.js +1 -2
- package/dist/components/fileupload/extensions/Rename.js +8 -9
- package/dist/components/fileupload/hooks/useFileAttributes.js +1 -2
- package/dist/components/fileupload/hooks/useImageObjectUrl.js +1 -2
- package/dist/components/fileupload/hooks/useImagePreview.js +1 -2
- package/dist/components/fileupload/hooks/useOperationState.js +1 -2
- package/dist/components/fileupload/hooks/useRequiredFormValidation.js +1 -2
- package/dist/components/fileupload/types.js +4 -5
- package/dist/components/footer/Footer.js +23 -24
- package/dist/components/footer/FooterGlobal.js +24 -25
- package/dist/components/footerSimple/FooterSimple.js +5 -6
- package/dist/components/header/Header.js +1 -2
- package/dist/components/header/HeaderGlobal.js +127 -128
- package/dist/components/header/HeaderService.js +84 -85
- package/dist/components/header-menu/HeaderMenu.js +34 -35
- package/dist/components/headerUserMenu/UserMenu.js +14 -15
- package/dist/components/heading/Heading.js +1 -2
- package/dist/components/helptext/Helptext.js +5 -6
- package/dist/components/icon/Icon.js +2 -3
- package/dist/components/input/Input.js +1 -2
- package/dist/components/inputwrapper/InputWrapper.js +12 -17
- package/dist/components/link/Link.js +1 -2
- package/dist/components/linkcard/LinkCard.js +2 -3
- package/dist/components/loader/Loader.js +2 -3
- package/dist/components/messagebox/Messagebox.js +6 -7
- package/dist/components/modal/Modal.js +13 -14
- package/dist/components/progressbar/Progressbar.js +5 -6
- package/dist/components/radio/RadioButton.js +3 -8
- package/dist/components/radiogroup/RadioGroup.js +1 -2
- package/dist/components/radiogroup/RadioGroupContext.js +1 -2
- package/dist/components/searchinput/SearchInput.js +11 -12
- package/dist/components/select/Select.js +6 -7
- package/dist/components/stepper/Step.js +1 -2
- package/dist/components/stepper/Stepper.js +1 -2
- package/dist/components/strings/PktStringsProvider.js +1 -2
- package/dist/components/table/Table.js +2 -3
- package/dist/components/table/TableBody.js +1 -2
- package/dist/components/table/TableDataCell.js +1 -2
- package/dist/components/table/TableHeader.js +1 -2
- package/dist/components/table/TableHeaderCell.js +1 -2
- package/dist/components/table/TableRow.js +1 -2
- package/dist/components/tabs/TabItem.js +1 -2
- package/dist/components/tabs/Tabs.js +5 -6
- package/dist/components/tag/Tag.js +6 -7
- package/dist/components/textarea/Textarea.js +5 -6
- package/dist/components/textinput/Textinput.js +6 -7
- package/dist/components/timepicker/Timepicker.js +6 -7
- package/dist/components/timepicker/useTimepickerState.js +27 -28
- package/dist/hooks/useElementWidth.js +1 -2
- package/dist/hooks/useFocusModality.js +1 -2
- package/dist/hooks/useGeneratedId.js +1 -2
- package/dist/hooks/useHeaderChrome.js +1 -2
- package/dist/hooks/useOptionGroupField.js +1 -2
- package/dist/hooks/useOwnerForm.js +1 -2
- package/dist/hooks/usePktStrings.js +1 -2
- package/dist/hooks/useScrollLock.js +1 -2
- package/dist/node_modules/@date-fns/tz/date/index.js +1 -2
- package/dist/node_modules/@date-fns/tz/date/mini.js +1 -2
- package/dist/node_modules/@date-fns/tz/index.js +3 -3
- package/dist/node_modules/@date-fns/tz/tzName/index.js +1 -2
- package/dist/node_modules/@date-fns/tz/tzOffset/index.js +1 -2
- package/dist/node_modules/classnames/index.js +1 -2
- package/dist/node_modules/date-fns/_lib/addLeadingZeros.js +1 -2
- package/dist/node_modules/date-fns/_lib/defaultOptions.js +1 -2
- package/dist/node_modules/date-fns/_lib/format/formatters.js +18 -19
- package/dist/node_modules/date-fns/_lib/format/lightFormatters.js +1 -2
- package/dist/node_modules/date-fns/_lib/format/longFormatters.js +1 -2
- package/dist/node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js +1 -2
- package/dist/node_modules/date-fns/_lib/normalizeDates.js +1 -2
- package/dist/node_modules/date-fns/_lib/normalizeInterval.js +1 -2
- package/dist/node_modules/date-fns/_lib/protectedTokens.js +1 -2
- package/dist/node_modules/date-fns/addDays.js +1 -2
- package/dist/node_modules/date-fns/constants.js +1 -2
- package/dist/node_modules/date-fns/constructFrom.js +1 -2
- package/dist/node_modules/date-fns/differenceInCalendarDays.js +6 -7
- package/dist/node_modules/date-fns/eachDayOfInterval.js +5 -6
- package/dist/node_modules/date-fns/endOfDay.js +1 -2
- package/dist/node_modules/date-fns/format.js +15 -16
- package/dist/node_modules/date-fns/getDayOfYear.js +6 -7
- package/dist/node_modules/date-fns/getISODay.js +1 -2
- package/dist/node_modules/date-fns/getISOWeek.js +5 -6
- package/dist/node_modules/date-fns/getISOWeekYear.js +6 -7
- package/dist/node_modules/date-fns/getWeek.js +5 -6
- package/dist/node_modules/date-fns/getWeekYear.js +8 -9
- package/dist/node_modules/date-fns/isDate.js +1 -2
- package/dist/node_modules/date-fns/isValid.js +4 -5
- package/dist/node_modules/date-fns/locale/_lib/buildFormatLongFn.js +1 -2
- package/dist/node_modules/date-fns/locale/_lib/buildLocalizeFn.js +1 -2
- package/dist/node_modules/date-fns/locale/_lib/buildMatchFn.js +1 -2
- package/dist/node_modules/date-fns/locale/_lib/buildMatchPatternFn.js +1 -2
- package/dist/node_modules/date-fns/locale/en-US/_lib/formatDistance.js +1 -2
- package/dist/node_modules/date-fns/locale/en-US/_lib/formatLong.js +0 -1
- package/dist/node_modules/date-fns/locale/en-US/_lib/formatRelative.js +1 -2
- package/dist/node_modules/date-fns/locale/en-US/_lib/localize.js +0 -1
- package/dist/node_modules/date-fns/locale/en-US/_lib/match.js +0 -1
- package/dist/node_modules/date-fns/locale/en-US.js +1 -2
- package/dist/node_modules/date-fns/startOfDay.js +1 -2
- package/dist/node_modules/date-fns/startOfISOWeek.js +1 -2
- package/dist/node_modules/date-fns/startOfISOWeekYear.js +5 -6
- package/dist/node_modules/date-fns/startOfWeek.js +4 -5
- package/dist/node_modules/date-fns/startOfWeekYear.js +7 -8
- package/dist/node_modules/date-fns/startOfYear.js +1 -2
- package/dist/node_modules/date-fns/toDate.js +1 -2
- package/dist/punkt-react.cjs +1 -1
- package/dist/shared-strings/consent.js +1 -2
- package/dist/shared-strings/format.js +1 -2
- package/dist/shared-strings/nb.js +1 -2
- package/dist/shared-strings/resolve.js +1 -2
- package/dist/shared-strings/store.js +1 -2
- package/dist/shared-types/accordion.js +1 -2
- package/dist/shared-types/calendar.js +1 -2
- package/dist/shared-types/card.js +1 -2
- package/dist/shared-types/checkbox.js +1 -2
- package/dist/shared-types/combobox.js +1 -2
- package/dist/shared-types/consent.js +1 -2
- package/dist/shared-types/footer.js +1 -2
- package/dist/shared-types/header-footer.js +1 -2
- package/dist/shared-types/icon.js +1 -2
- package/dist/shared-types/input-wrapper.js +1 -2
- package/dist/shared-types/linkcard.js +1 -2
- package/dist/shared-types/loader.js +1 -2
- package/dist/shared-types/messagebox.js +1 -2
- package/dist/shared-types/option-group.js +1 -2
- package/dist/shared-types/progressbar.js +1 -2
- package/dist/shared-types/radiobutton.js +1 -2
- package/dist/shared-types/select.js +1 -2
- package/dist/shared-types/size.js +1 -2
- package/dist/shared-types/table.js +1 -2
- package/dist/shared-types/tag.js +1 -2
- package/dist/shared-types/textarea.js +1 -2
- package/dist/shared-types/textinput.js +1 -2
- package/dist/shared-utils/calendar/calendar-grid.js +4 -5
- package/dist/shared-utils/calendar/date-validation.js +1 -2
- package/dist/shared-utils/calendar/keyboard-navigation.js +1 -2
- package/dist/shared-utils/calendar/selection-manager.js +31 -32
- package/dist/shared-utils/combobox/input-utils.js +1 -2
- package/dist/shared-utils/combobox/keyboard-navigation.js +1 -2
- package/dist/shared-utils/combobox/option-utils.js +1 -2
- package/dist/shared-utils/date-utils.js +10 -11
- package/dist/shared-utils/datepicker-utils.js +4 -5
- package/dist/shared-utils/device-utils.js +1 -2
- package/dist/shared-utils/fileupload/announcements.js +1 -2
- package/dist/shared-utils/fileupload/filename.js +1 -2
- package/dist/shared-utils/fileupload/formats.js +1 -2
- package/dist/shared-utils/fileupload/navigation.js +1 -2
- package/dist/shared-utils/fileupload/size.js +1 -2
- package/dist/shared-utils/fileupload/transfers.js +1 -2
- package/dist/shared-utils/fileupload/truncate.js +1 -2
- package/dist/shared-utils/fileupload/validation.js +8 -9
- package/dist/shared-utils/focus-trap/index.js +13 -31
- package/dist/shared-utils/forms/described-by.js +1 -2
- package/dist/shared-utils/header-footer/external-domain.js +1 -2
- package/dist/shared-utils/header-footer/fetch-header-footer-data.js +1 -2
- package/dist/shared-utils/header-footer/icon-map.js +1 -2
- package/dist/shared-utils/header-footer/select-megamenu.js +1 -2
- package/dist/shared-utils/scroll-lock/index.js +1 -2
- package/dist/shared-utils/timepicker/options.js +1 -2
- package/dist/shared-utils/timepicker/stepper.js +1 -2
- package/dist/shared-utils/timepicker/time-utils.js +1 -2
- package/dist/shared-utils/value-utils.js +1 -2
- package/dist/utils/nativeInputValue.js +1 -2
- package/dist/utils/stableKeys.js +1 -2
- package/dist/utils/stringutils.js +1 -2
- package/package.json +20 -21
- package/src/components/accordion/Accordion.test.tsx +2 -4
- package/src/components/tag/Tag.tsx +0 -1
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { COMBOBOX_DEFAULTS as e } from "../../shared-types/combobox.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
2
|
+
import { buildFulltext as t, filterOptionsBySearch as n, findOptionByValue as r, findTypeaheadMatches as i, getOptionDisplayText as ee, getSearchInfoMessage as te, isMaxSelectionReached as a, parseValueToArray as o } from "../../shared-utils/combobox/option-utils.js";
|
|
3
|
+
import { focusFirstOption as s, focusFirstOrSelectedOption as c, focusNextOption as ne, focusPreviousOption as l } from "../../shared-utils/combobox/keyboard-navigation.js";
|
|
4
|
+
import { getInputKeyAction as u, getInputValueAction as d, getSingleValueForInput as f } from "../../shared-utils/combobox/input-utils.js";
|
|
5
|
+
import { formatString as re } from "../../shared-strings/format.js";
|
|
6
|
+
import { usePktStrings as ie } from "../../hooks/usePktStrings.js";
|
|
7
7
|
import { useOwnerForm as p } from "../../hooks/useOwnerForm.js";
|
|
8
8
|
import { setNativeInputValue as ae } from "../../utils/nativeInputValue.js";
|
|
9
9
|
import { Children as oe, isValidElement as se, useCallback as m, useEffect as h, useImperativeHandle as ce, useMemo as g, useRef as _, useState as v } from "react";
|
|
10
|
-
|
|
11
|
-
function le(e,
|
|
10
|
+
// src/components/combobox/useComboboxState.ts
|
|
11
|
+
function le(e, n) {
|
|
12
12
|
return e.map((e) => ({
|
|
13
13
|
...e,
|
|
14
14
|
label: e.label || e.value,
|
|
15
|
-
fulltext:
|
|
16
|
-
selected:
|
|
15
|
+
fulltext: t(e),
|
|
16
|
+
selected: n.includes(e.value)
|
|
17
17
|
}));
|
|
18
18
|
}
|
|
19
19
|
function ue(ue, de) {
|
|
@@ -38,27 +38,27 @@ function ue(ue, de) {
|
|
|
38
38
|
}), e;
|
|
39
39
|
}, [He]), Ye = g(() => ge && ge.length > 0 ? ge.map((e) => ({
|
|
40
40
|
...e,
|
|
41
|
-
fulltext:
|
|
41
|
+
fulltext: t(e)
|
|
42
42
|
})) : he && he.length > 0 ? he.map((e) => ({
|
|
43
43
|
...e,
|
|
44
|
-
fulltext:
|
|
44
|
+
fulltext: t(e)
|
|
45
45
|
})) : Je.length > 0 ? Je.map((e) => ({
|
|
46
46
|
...e,
|
|
47
|
-
fulltext:
|
|
47
|
+
fulltext: t(e)
|
|
48
48
|
})) : [], [
|
|
49
49
|
ge,
|
|
50
50
|
he,
|
|
51
51
|
Je
|
|
52
52
|
]), P = y !== void 0, [Xe, F] = v(() => {
|
|
53
|
-
let e =
|
|
53
|
+
let e = o(y ?? me, b), t = Ye.filter((t) => t.selected && !e.includes(t.value)).map((e) => e.value);
|
|
54
54
|
return t.length ? b ? [...e, ...t] : e.length ? e : [t[0]] : e;
|
|
55
55
|
}), Ze = _(Xe), [Qe, $e] = v(y);
|
|
56
|
-
P && y !== Qe && ($e(y), F(
|
|
57
|
-
let I = P ?
|
|
56
|
+
P && y !== Qe && ($e(y), F(o(y, b)));
|
|
57
|
+
let I = P ? o(y, b) : Xe, [et, tt] = v([]), L = g(() => le([...et.filter((e) => !Ye.some((t) => t.value === e.value)), ...Ye], I), [
|
|
58
58
|
Ye,
|
|
59
59
|
et,
|
|
60
60
|
I
|
|
61
|
-
]), [R, z] = v(!1), [B, V] = v(""), [nt, rt] = v(""), [it, H] = v(""), [at, ot] = v(null), [U, W] = v(null), [st, G] = v(!1), [ct, lt] = v(!1), K = _(!1), [ut, dt] = v(!1), [ft, q] = v(-1), pt =
|
|
61
|
+
]), [R, z] = v(!1), [B, V] = v(""), [nt, rt] = v(""), [it, H] = v(""), [at, ot] = v(null), [U, W] = v(null), [st, G] = v(!1), [ct, lt] = v(!1), K = _(!1), [ut, dt] = v(!1), [ft, q] = v(-1), pt = ie(["combobox"], Ue), mt = it ? re(pt.combobox[it], { value: at ?? "" }) : "", ht = a(I.length, x ?? null), gt = Pe ?? (b && x != null), _t = g(() => B ? S ? i(L, B).filtered : n(L, B) : L, [
|
|
62
62
|
L,
|
|
63
63
|
B,
|
|
64
64
|
S
|
|
@@ -72,7 +72,7 @@ function ue(ue, de) {
|
|
|
72
72
|
k.current && (k.current.value = yt);
|
|
73
73
|
}, [yt]), h(() => {
|
|
74
74
|
if (R || !O.current) return;
|
|
75
|
-
let e = !b && I[0] ?
|
|
75
|
+
let e = !b && I[0] ? f(I[0], L, T) : "";
|
|
76
76
|
O.current.value !== e && (O.current.value = e);
|
|
77
77
|
}, [
|
|
78
78
|
I,
|
|
@@ -89,7 +89,7 @@ function ue(ue, de) {
|
|
|
89
89
|
vt
|
|
90
90
|
]), Y = m((e) => {
|
|
91
91
|
if (!e || I.includes(e)) return;
|
|
92
|
-
if (b &&
|
|
92
|
+
if (b && a(I.length, x ?? null)) {
|
|
93
93
|
H("maxSelected");
|
|
94
94
|
return;
|
|
95
95
|
}
|
|
@@ -103,7 +103,7 @@ function ue(ue, de) {
|
|
|
103
103
|
]), X = m((e) => {
|
|
104
104
|
if (!e) return;
|
|
105
105
|
let t = I.filter((t) => t !== e);
|
|
106
|
-
|
|
106
|
+
r(L, e)?.userAdded && tt((t) => t.filter((t) => t.value !== e)), J(t);
|
|
107
107
|
}, [
|
|
108
108
|
I,
|
|
109
109
|
L,
|
|
@@ -115,7 +115,7 @@ function ue(ue, de) {
|
|
|
115
115
|
let t;
|
|
116
116
|
if (!b) t = [e];
|
|
117
117
|
else {
|
|
118
|
-
if (
|
|
118
|
+
if (r(L, e) || a(I.length, x ?? null)) return;
|
|
119
119
|
t = [...I, e];
|
|
120
120
|
}
|
|
121
121
|
let n = {
|
|
@@ -135,7 +135,7 @@ function ue(ue, de) {
|
|
|
135
135
|
if (W(null), e && O.current && O.current.type !== "hidden") {
|
|
136
136
|
V(""), rt("");
|
|
137
137
|
let e = t === void 0 ? I[0] : t;
|
|
138
|
-
!b && e ? O.current.value =
|
|
138
|
+
!b && e ? O.current.value = f(e, L, T) : O.current.value = "", b || (dt(!1), H(""));
|
|
139
139
|
}
|
|
140
140
|
}, [
|
|
141
141
|
b,
|
|
@@ -145,8 +145,8 @@ function ue(ue, de) {
|
|
|
145
145
|
]), Q = m((e) => {
|
|
146
146
|
if (E) return;
|
|
147
147
|
H(""), W(null);
|
|
148
|
-
let t =
|
|
149
|
-
|
|
148
|
+
let t = r(L, e)?.value || null, n = I.includes(e || t || ""), i = !!t, te = L.find((t) => t.value === e)?.disabled || !1, o = !e?.trim(), s = !b, c = b, ne = a(I.length, x ?? null), l = !1, u = !0, d = "", re = null, ie = "", p;
|
|
149
|
+
te || (!i && w && !o ? (Z(e), d = "valueAdded", l = c, s && (p = e || "")) : !i && !w ? (s && I[0] && X(I[0]), u = !1, l = !0, d = "noResults") : n ? (X(t), l = !0, p = "", s && D && O.current && O.current.type !== "hidden" && (O.current.value = "")) : o && s ? (bt(), l = !0, p = "") : s ? (I[0] && X(I[0]), Y(t), l = !1, p = t || "", d = "valueSelected", re = D ? f(t || "", L, T) : ee(r(L, t), T)) : c && !ne ? (Y(t), l = !0) : c && ne ? (d = "maxSelected", u = !1, ie = e || "") : (s && bt(), d = "noValidValue", u = !1, l = !0, ie = e || "", p = ""), z(l), V(ie), xt(u, p), H(d), ot(re), l || window.setTimeout(() => {
|
|
150
150
|
qe();
|
|
151
151
|
}, 0));
|
|
152
152
|
}, [
|
|
@@ -170,11 +170,11 @@ function ue(ue, de) {
|
|
|
170
170
|
if (!b) {
|
|
171
171
|
if (!e) I[0] && X(I[0]), t = void 0;
|
|
172
172
|
else {
|
|
173
|
-
let n =
|
|
173
|
+
let n = r(L, e);
|
|
174
174
|
n && n.value !== I[0] ? (I[0] && X(I[0]), Y(n.value), t = n.value) : !n && w && (I[0] && X(I[0]), Z(e), t = e);
|
|
175
175
|
}
|
|
176
176
|
} else if (e !== "") {
|
|
177
|
-
let { action: t, value: n } =
|
|
177
|
+
let { action: t, value: n } = d(e, I, L, w, b);
|
|
178
178
|
switch (t) {
|
|
179
179
|
case "addUserValue":
|
|
180
180
|
Z(n);
|
|
@@ -185,7 +185,7 @@ function ue(ue, de) {
|
|
|
185
185
|
case "removeValue": X(n);
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
|
-
!b && t ? O.current.value =
|
|
188
|
+
!b && t ? O.current.value = f(t, L, T) : O.current.value = "";
|
|
189
189
|
}
|
|
190
190
|
z(!1), dt(!1);
|
|
191
191
|
}, [
|
|
@@ -202,7 +202,7 @@ function ue(ue, de) {
|
|
|
202
202
|
W(null), H(""), !b && I[0] && X(I[0]);
|
|
203
203
|
return;
|
|
204
204
|
}
|
|
205
|
-
let t =
|
|
205
|
+
let t = te(e, I, L, w);
|
|
206
206
|
W(t.addValueText), H(t.userInfoMessage);
|
|
207
207
|
}, [
|
|
208
208
|
I,
|
|
@@ -214,7 +214,7 @@ function ue(ue, de) {
|
|
|
214
214
|
if (E) return;
|
|
215
215
|
let t = e.target.value;
|
|
216
216
|
if (rt(t), V(t), St(t), S && t) {
|
|
217
|
-
let { suggestion: n } =
|
|
217
|
+
let { suggestion: n } = i(L, t);
|
|
218
218
|
n?.label && O.current && !e.nativeEvent.inputType?.includes("deleteContent") && (O.current.value = n.label, window.setTimeout(() => O.current?.setSelectionRange(t.length, n.label.length), 0));
|
|
219
219
|
}
|
|
220
220
|
}, [
|
|
@@ -236,7 +236,7 @@ function ue(ue, de) {
|
|
|
236
236
|
e.preventDefault(), q(I.length - 1);
|
|
237
237
|
return;
|
|
238
238
|
}
|
|
239
|
-
let t =
|
|
239
|
+
let t = u(e.key, e.shiftKey, b);
|
|
240
240
|
if (t && (e.key !== "Tab" || R)) {
|
|
241
241
|
if (t === "focusListbox" && e.key === "Tab" && !j.current?.querySelector("[role=\"option\"]:not([data-disabled]), [data-type=\"new-option\"]")) $();
|
|
242
242
|
else switch (e.preventDefault(), t) {
|
|
@@ -250,7 +250,7 @@ function ue(ue, de) {
|
|
|
250
250
|
break;
|
|
251
251
|
}
|
|
252
252
|
case "focusListbox":
|
|
253
|
-
j.current && (R || z(!0),
|
|
253
|
+
j.current && (R || z(!0), c(j.current, {
|
|
254
254
|
disabled: E,
|
|
255
255
|
allowUserInput: w,
|
|
256
256
|
customUserInput: U,
|
|
@@ -273,7 +273,7 @@ function ue(ue, de) {
|
|
|
273
273
|
Q,
|
|
274
274
|
N
|
|
275
275
|
]), Tt = m(() => {
|
|
276
|
-
E || (lt(!1), K.current ? (K.current = !1, G(!0)) : (!b && I[0] && O.current && O.current.type !== "hidden" && (dt(!0), O.current.value =
|
|
276
|
+
E || (lt(!1), K.current ? (K.current = !1, G(!0)) : (!b && I[0] && O.current && O.current.type !== "hidden" && (dt(!0), O.current.value = f(I[0], L, T)), G(!0), V(""), z(!0)));
|
|
277
277
|
}, [
|
|
278
278
|
E,
|
|
279
279
|
b,
|
|
@@ -296,7 +296,7 @@ function ue(ue, de) {
|
|
|
296
296
|
else {
|
|
297
297
|
e.stopPropagation(), e.preventDefault();
|
|
298
298
|
let t = !R;
|
|
299
|
-
z(t), t && j.current &&
|
|
299
|
+
z(t), t && j.current && c(j.current, {
|
|
300
300
|
disabled: E,
|
|
301
301
|
allowUserInput: w,
|
|
302
302
|
customUserInput: U,
|
|
@@ -319,7 +319,7 @@ function ue(ue, de) {
|
|
|
319
319
|
case "ArrowDown":
|
|
320
320
|
case "ArrowUp":
|
|
321
321
|
e.preventDefault(), R ? z(!1) : (z(!0), j.current && window.setTimeout(() => {
|
|
322
|
-
j.current &&
|
|
322
|
+
j.current && c(j.current, {
|
|
323
323
|
disabled: E,
|
|
324
324
|
allowUserInput: w && !ht,
|
|
325
325
|
customUserInput: U,
|
|
@@ -333,7 +333,7 @@ function ue(ue, de) {
|
|
|
333
333
|
case "Home":
|
|
334
334
|
case "End":
|
|
335
335
|
e.preventDefault(), R || z(!0), j.current && window.setTimeout(() => {
|
|
336
|
-
j.current &&
|
|
336
|
+
j.current && c(j.current, {
|
|
337
337
|
disabled: E,
|
|
338
338
|
allowUserInput: w && !ht,
|
|
339
339
|
customUserInput: U,
|
|
@@ -370,10 +370,10 @@ function ue(ue, de) {
|
|
|
370
370
|
e.preventDefault(), Q(t);
|
|
371
371
|
break;
|
|
372
372
|
case "ArrowDown":
|
|
373
|
-
e.preventDefault(),
|
|
373
|
+
e.preventDefault(), ne(e.currentTarget);
|
|
374
374
|
break;
|
|
375
375
|
case "ArrowUp":
|
|
376
|
-
e.preventDefault(), j.current &&
|
|
376
|
+
e.preventDefault(), j.current && l(e.currentTarget, j.current, C);
|
|
377
377
|
break;
|
|
378
378
|
case "Escape":
|
|
379
379
|
e.preventDefault(), z(!1), D && (K.current = !0), N();
|
|
@@ -438,10 +438,10 @@ function ue(ue, de) {
|
|
|
438
438
|
e.preventDefault(), Q(e.currentTarget.dataset.value || "");
|
|
439
439
|
break;
|
|
440
440
|
case "ArrowDown":
|
|
441
|
-
e.preventDefault(), j.current &&
|
|
441
|
+
e.preventDefault(), j.current && s(j.current);
|
|
442
442
|
break;
|
|
443
443
|
case "ArrowUp":
|
|
444
|
-
e.preventDefault(), j.current &&
|
|
444
|
+
e.preventDefault(), j.current && l(e.currentTarget, j.current, C);
|
|
445
445
|
break;
|
|
446
446
|
case "Escape": e.preventDefault(), z(!1), D && (K.current = !0), N();
|
|
447
447
|
}
|
|
@@ -561,5 +561,4 @@ function ue(ue, de) {
|
|
|
561
561
|
onChange: Be
|
|
562
562
|
};
|
|
563
563
|
}
|
|
564
|
-
//#endregion
|
|
565
564
|
export { ue as useComboboxState };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { CONSENT_DEFAULTS as e } from "../../shared-types/consent.js";
|
|
3
3
|
import "../../shared-types/index.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { PktButton as t } from "../button/Button.js";
|
|
5
|
+
import { consentStrings as n } from "../../shared-strings/consent.js";
|
|
6
6
|
import { forwardRef as r, useEffect as i, useRef as a } from "react";
|
|
7
7
|
import { jsx as o } from "react/jsx-runtime";
|
|
8
|
-
|
|
8
|
+
// src/components/consent/Consent.tsx
|
|
9
9
|
var s = null, c = () => s || (s = new Promise((e, t) => {
|
|
10
10
|
if (document.querySelector("#oslo-consent-script")) {
|
|
11
11
|
e();
|
|
@@ -41,7 +41,7 @@ var s = null, c = () => s || (s = new Promise((e, t) => {
|
|
|
41
41
|
hotjarId: f,
|
|
42
42
|
googleAnalyticsId: p
|
|
43
43
|
};
|
|
44
|
-
let S = a(() => {}), C = Object.prototype.hasOwnProperty.call(
|
|
44
|
+
let S = a(() => {}), C = Object.prototype.hasOwnProperty.call(n.i18n, m) ? m : "nb", w = g ?? n.i18n[C].contentPresentation.buttons.settings;
|
|
45
45
|
i(() => {
|
|
46
46
|
let e = !1, t, n, r = x.current;
|
|
47
47
|
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);
|
|
@@ -91,7 +91,7 @@ var s = null, c = () => s || (s = new Promise((e, t) => {
|
|
|
91
91
|
"aria-haspopup": "dialog",
|
|
92
92
|
onClick: T,
|
|
93
93
|
children: w
|
|
94
|
-
}) : h === "icon" ? /* @__PURE__ */ o(
|
|
94
|
+
}) : h === "icon" ? /* @__PURE__ */ o(t, {
|
|
95
95
|
ref: y,
|
|
96
96
|
skin: "tertiary",
|
|
97
97
|
variant: "icon-only",
|
|
@@ -99,7 +99,7 @@ var s = null, c = () => s || (s = new Promise((e, t) => {
|
|
|
99
99
|
"aria-haspopup": "dialog",
|
|
100
100
|
onClick: T,
|
|
101
101
|
children: w
|
|
102
|
-
}) : /* @__PURE__ */ o(
|
|
102
|
+
}) : /* @__PURE__ */ o(t, {
|
|
103
103
|
ref: y,
|
|
104
104
|
"aria-haspopup": "dialog",
|
|
105
105
|
onClick: T,
|
|
@@ -107,5 +107,4 @@ var s = null, c = () => s || (s = new Promise((e, t) => {
|
|
|
107
107
|
});
|
|
108
108
|
});
|
|
109
109
|
d.displayName = "PktConsent";
|
|
110
|
-
//#endregion
|
|
111
110
|
export { d as PktConsent };
|
|
@@ -1,28 +1,27 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { fromISOtoLocal as e, sortDateStrings as t } from "../../shared-utils/date-utils.js";
|
|
3
|
+
import { PktTag as n } from "../tag/Tag.js";
|
|
4
|
+
import { usePktStrings as r } from "../../hooks/usePktStrings.js";
|
|
5
5
|
import { jsx as i } from "react/jsx-runtime";
|
|
6
|
-
|
|
6
|
+
// src/components/datepicker/DateTags.tsx
|
|
7
7
|
var a = ({ dates: a, dateformat: o, idBase: s, strings: c, onDateRemoved: l }) => {
|
|
8
|
-
let u =
|
|
8
|
+
let u = t(a), d = r(["datepicker"], c).datepicker.deleteDate;
|
|
9
9
|
return /* @__PURE__ */ i("div", {
|
|
10
10
|
className: "pkt-date-tags pkt-datepicker__tags",
|
|
11
11
|
"aria-live": "polite",
|
|
12
|
-
children: u.map((
|
|
13
|
-
let
|
|
14
|
-
return /* @__PURE__ */ i(
|
|
15
|
-
id: `${s}${
|
|
12
|
+
children: u.map((t) => {
|
|
13
|
+
let r = e(t, o);
|
|
14
|
+
return /* @__PURE__ */ i(n, {
|
|
15
|
+
id: `${s}${t}-tag`,
|
|
16
16
|
closeTag: !0,
|
|
17
|
-
ariaLabel: `${d} ${
|
|
18
|
-
onClose: () => l(
|
|
17
|
+
ariaLabel: `${d} ${r}`,
|
|
18
|
+
onClose: () => l(t),
|
|
19
19
|
children: /* @__PURE__ */ i("time", {
|
|
20
|
-
dateTime:
|
|
21
|
-
children:
|
|
20
|
+
dateTime: t,
|
|
21
|
+
children: r
|
|
22
22
|
})
|
|
23
|
-
},
|
|
23
|
+
}, t);
|
|
24
24
|
})
|
|
25
25
|
});
|
|
26
26
|
};
|
|
27
|
-
//#endregion
|
|
28
27
|
export { a as DateTags };
|
|
@@ -5,7 +5,7 @@ import { DatepickerInputs as n } from "./DatepickerInputs.js";
|
|
|
5
5
|
import { useDatepickerState as r } from "./useDatepickerState.js";
|
|
6
6
|
import { forwardRef as i } from "react";
|
|
7
7
|
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
8
|
-
|
|
8
|
+
// src/components/datepicker/Datepicker.tsx
|
|
9
9
|
var s = i((i, s) => {
|
|
10
10
|
let c = r(i, s), l = [
|
|
11
11
|
"pkt-datepicker",
|
|
@@ -75,5 +75,4 @@ var s = i((i, s) => {
|
|
|
75
75
|
});
|
|
76
76
|
});
|
|
77
77
|
s.displayName = "PktDatepicker";
|
|
78
|
-
//#endregion
|
|
79
78
|
export { s as PktDatepicker };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PktIcon as e } from "../icon/Icon.js";
|
|
2
2
|
import { DateTags as t } from "./DateTags.js";
|
|
3
3
|
import { Fragment as n, jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
4
|
-
|
|
4
|
+
// src/components/datepicker/DatepickerInputs.tsx
|
|
5
5
|
var a = ({ state: a }) => {
|
|
6
6
|
let { id: o, inputId: s, values: c, dateformat: l, multiple: u, range: d, showRangeLabels: f, disabled: p, readOnly: m, required: h, label: g, name: _, placeholder: v, hasError: y, helptext: b, minStr: x, maxStr: S, inputType: C, isIOSDevice: w, strings: T, inputClasses: E, buttonClasses: D, rangeLabelClasses: O, datepickerInputsClasses: k, isInputDisabled: A, inputRef: j, inputToRef: M, btnRef: N, toggleCalendar: P, handleFocus: F, handleSingleInputChange: I, handleRangeFromChange: L, handleRangeToChange: R, handleRangeBlur: z, handleMultipleBlur: B, handleTagRemoved: V, handleSingleKeydown: H, handleRangeFromKeydown: U, handleRangeToKeydown: W, handleMultipleKeydown: G, restProps: K } = a, q = (e) => {
|
|
7
7
|
e.preventDefault(), P();
|
|
@@ -145,5 +145,4 @@ var a = ({ state: a }) => {
|
|
|
145
145
|
})
|
|
146
146
|
});
|
|
147
147
|
};
|
|
148
|
-
//#endregion
|
|
149
148
|
export { a as DatepickerInputs };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { handleCalendarPosition as e } from "../../shared-utils/datepicker-utils.js";
|
|
3
|
+
import { PktCalendar as t } from "../calendar/Calendar.js";
|
|
4
4
|
import { useEffect as n, useRef as r } from "react";
|
|
5
5
|
import { jsx as i } from "react/jsx-runtime";
|
|
6
|
-
|
|
6
|
+
// src/components/datepicker/DatepickerPopup.tsx
|
|
7
7
|
var a = ({ open: a, multiple: o = !1, range: s = !1, weeknumbers: c = !1, withcontrols: l = !1, selected: u = [], earliest: d, latest: f, excludedates: p, excludeweekdays: m, maxMultiple: h, currentmonth: g, today: _, inputRef: v, hasCounter: y = !1, onDateSelected: b, onClose: x }) => {
|
|
8
8
|
let S = r(null), C = r(!1);
|
|
9
9
|
a && (C.current = !0), n(() => {
|
|
10
|
-
a &&
|
|
10
|
+
a && e(S.current, v?.current ?? null, y);
|
|
11
11
|
}, [
|
|
12
12
|
a,
|
|
13
13
|
v,
|
|
@@ -19,7 +19,7 @@ var a = ({ open: a, multiple: o = !1, range: s = !1, weeknumbers: c = !1, withco
|
|
|
19
19
|
className: w,
|
|
20
20
|
hidden: !a,
|
|
21
21
|
"aria-hidden": !a,
|
|
22
|
-
children: T && /* @__PURE__ */ i(
|
|
22
|
+
children: T && /* @__PURE__ */ i(t, {
|
|
23
23
|
multiple: o,
|
|
24
24
|
range: s,
|
|
25
25
|
weeknumbers: c,
|
|
@@ -37,5 +37,4 @@ var a = ({ open: a, multiple: o = !1, range: s = !1, weeknumbers: c = !1, withco
|
|
|
37
37
|
})
|
|
38
38
|
});
|
|
39
39
|
};
|
|
40
|
-
//#endregion
|
|
41
40
|
export { a as DatepickerPopup };
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { valueToArray as e } from "../../shared-utils/value-utils.js";
|
|
2
|
+
import { isIOS as t } from "../../shared-utils/device-utils.js";
|
|
3
|
+
import { filterSelectableDates as n, newDate as r } from "../../shared-utils/date-utils.js";
|
|
4
|
+
import { getDatepickerButtonClasses as i, getDatepickerInputClasses as a, getDatepickerInputType as ee, getRangeLabelClasses as te, handleDatepickerKeydown as o, processDateSelection as ne, validateRangeOrder as re } from "../../shared-utils/datepicker-utils.js";
|
|
5
|
+
import { usePktStrings as ie } from "../../hooks/usePktStrings.js";
|
|
6
|
+
import { setNativeInputValue as ae } from "../../utils/nativeInputValue.js";
|
|
7
7
|
import { useCallback as s, useEffect as c, useImperativeHandle as oe, useMemo as l, useRef as u, useState as d } from "react";
|
|
8
|
-
|
|
8
|
+
// src/components/datepicker/useDatepickerState.ts
|
|
9
9
|
function f(f, se) {
|
|
10
|
-
let { id: p, label: ce, value: m, defaultValue: h, dateformat: le = "dd.MM.yyyy", multiple: g = !1, maxlength: _, range: v = !1, showRangeLabels: y = !1, weeknumbers: ue = !1, withcontrols: de = !1, excludedates: b, excludeweekdays: x, currentmonth: S, today: fe, calendarOpen: C, timezone: w, fullwidth: T = !1, inputSize: E = "medium", hasFieldset: pe = !1, counter: me, inline: he = !1, helptext: ge, helptextDropdown: _e, helptextDropdownButton: ve, hasError: ye = !1, errorMessage: be, optionalTag: xe = !1, optionalText: Se, requiredTag: Ce = !1, requiredText: we, tagText: Te, useWrapper: Ee = !0, strings: D, disabled: O = !1, readOnly: k = !1, required: De = !1, name: Oe, min: A, max: j, placeholder: ke, onChange: Ae, onValueChange: M, className: je, ...Me } = f, N = s((
|
|
10
|
+
let { id: p, label: ce, value: m, defaultValue: h, dateformat: le = "dd.MM.yyyy", multiple: g = !1, maxlength: _, range: v = !1, showRangeLabels: y = !1, weeknumbers: ue = !1, withcontrols: de = !1, excludedates: b, excludeweekdays: x, currentmonth: S, today: fe, calendarOpen: C, timezone: w, fullwidth: T = !1, inputSize: E = "medium", hasFieldset: pe = !1, counter: me, inline: he = !1, helptext: ge, helptextDropdown: _e, helptextDropdownButton: ve, hasError: ye = !1, errorMessage: be, optionalTag: xe = !1, optionalText: Se, requiredTag: Ce = !1, requiredText: we, tagText: Te, useWrapper: Ee = !0, strings: D, disabled: O = !1, readOnly: k = !1, required: De = !1, name: Oe, min: A, max: j, placeholder: ke, onChange: Ae, onValueChange: M, className: je, ...Me } = f, N = s((t) => t === void 0 ? [] : e(t), []), P = m !== void 0, Ne = typeof h == "number" ? void 0 : h, [F, I] = d(() => N(m ?? Ne)), L = P ? N(m) : F, Pe = u(F), [Fe, Ie] = d(m);
|
|
11
11
|
P && m !== Fe && (Ie(m), I(N(m)));
|
|
12
12
|
let [R, z] = d(C ?? !1), [Le, Re] = d(C);
|
|
13
13
|
C !== Le && (Re(C), C !== void 0 && z(C));
|
|
14
|
-
let B = u(null), V = u(null), H = u(null), ze = u(null), U = u(null), W = l(() =>
|
|
14
|
+
let B = u(null), V = u(null), H = u(null), ze = u(null), U = u(null), W = l(() => ee(), []), G = l(() => t(), []), Be = ie([
|
|
15
15
|
"generic",
|
|
16
16
|
"datepicker",
|
|
17
17
|
"validation"
|
|
18
18
|
], D), Ve = D, K = typeof A == "string" ? A : A === void 0 ? void 0 : String(A), q = typeof j == "string" ? j : j === void 0 ? void 0 : String(j), He = l(() => {
|
|
19
|
-
let e =
|
|
19
|
+
let e = a(T, y, g, v, k, W, E);
|
|
20
20
|
return Object.entries(e).filter(([, e]) => e).map(([e]) => e).join(" ");
|
|
21
21
|
}, [
|
|
22
22
|
T,
|
|
@@ -26,8 +26,8 @@ function f(f, se) {
|
|
|
26
26
|
k,
|
|
27
27
|
W,
|
|
28
28
|
E
|
|
29
|
-
]), Ue = Object.entries(
|
|
30
|
-
let e =
|
|
29
|
+
]), Ue = Object.entries(i(E)).filter(([, e]) => e).map(([e]) => e).join(" "), We = l(() => {
|
|
30
|
+
let e = te(y);
|
|
31
31
|
return Object.entries(e).filter(([, e]) => e).map(([e]) => e).join(" ");
|
|
32
32
|
}, [y]), Ge = l(() => ["pkt-datepicker__inputs", v && "pkt-input__range-inputs"].filter(Boolean).join(" "), [v, y]), Ke = l(() => {
|
|
33
33
|
if (S) return S;
|
|
@@ -43,7 +43,7 @@ function f(f, se) {
|
|
|
43
43
|
}, [P, M]), Y = s((e) => {
|
|
44
44
|
if (v && e.length === 1) return;
|
|
45
45
|
let t = H.current;
|
|
46
|
-
t && (
|
|
46
|
+
t && (ae(t, e.join(",")), t.dispatchEvent(new Event("input", { bubbles: !0 })));
|
|
47
47
|
}, [v]), X = s(() => {
|
|
48
48
|
O || z((e) => !e);
|
|
49
49
|
}, [O]), Z = s(() => {
|
|
@@ -63,9 +63,9 @@ function f(f, se) {
|
|
|
63
63
|
}, [R, Z]);
|
|
64
64
|
let Ze = s(() => {
|
|
65
65
|
G && !R && z(!0);
|
|
66
|
-
}, [G, R]), Qe = s((
|
|
67
|
-
let
|
|
68
|
-
J(
|
|
66
|
+
}, [G, R]), Qe = s((t) => {
|
|
67
|
+
let n = ne(t, g, v), r = e(n);
|
|
68
|
+
J(r), Y(r), !g && !v && (Z(), B.current?.focus());
|
|
69
69
|
}, [
|
|
70
70
|
g,
|
|
71
71
|
v,
|
|
@@ -92,15 +92,15 @@ function f(f, se) {
|
|
|
92
92
|
J,
|
|
93
93
|
Y
|
|
94
94
|
]), rt = s(() => {
|
|
95
|
-
L.length === 2 && !
|
|
95
|
+
L.length === 2 && !re(L) && (J([L[0]]), Y([L[0]]));
|
|
96
96
|
}, [
|
|
97
97
|
L,
|
|
98
98
|
J,
|
|
99
99
|
Y
|
|
100
100
|
]), Q = s((e) => {
|
|
101
|
-
let
|
|
102
|
-
if (
|
|
103
|
-
let
|
|
101
|
+
let t = r(e), i = K ? r(K) : null, a = q ? r(q) : null;
|
|
102
|
+
if (t && !isNaN(t.getTime()) && (!i || t >= i) && (!a || t <= a)) {
|
|
103
|
+
let t = n([...L, e], K, q, b, x), r = [...new Set(t)];
|
|
104
104
|
J(r), Y(r);
|
|
105
105
|
}
|
|
106
106
|
}, [
|
|
@@ -239,5 +239,4 @@ function f(f, se) {
|
|
|
239
239
|
restProps: Me
|
|
240
240
|
};
|
|
241
241
|
}
|
|
242
|
-
//#endregion
|
|
243
242
|
export { f as useDatepickerState };
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { __toESM as e } from "../../_virtual/_rolldown/runtime.js";
|
|
2
2
|
import { require_classnames as t } from "../../node_modules/classnames/index.js";
|
|
3
3
|
import { PktIcon as n } from "../icon/Icon.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { FileItem as r } from "./types.js";
|
|
5
|
+
import { usePktStrings as i } from "../../hooks/usePktStrings.js";
|
|
6
6
|
import { forwardRef as a, useCallback as o, useEffect as s, useImperativeHandle as c, useMemo as l, useRef as u, useState as d } from "react";
|
|
7
7
|
import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
8
|
-
|
|
8
|
+
// src/components/fileupload/DropZone.tsx
|
|
9
9
|
var h = /* @__PURE__ */ e(t(), 1), g = a(({ id: e, multiple: t, value: a, onFilesAdded: g = () => {}, name: v, uploadStrategy: y, accept: b, isThumbnailView: x = !1, disabled: S = !1, hasVisibleLabel: C = !1, strings: w, ...T }, E) => {
|
|
10
10
|
let D = u(null), O = typeof b == "string" && b.trim().length > 0 ? b : void 0, k = l(() => O ? O.split(/\s*,\s*/).map((e) => e.trim()).filter(Boolean).join(", ").toUpperCase() : "", [O]);
|
|
11
11
|
c(E, () => D.current);
|
|
12
|
-
let [A, j] = d(!1), M =
|
|
12
|
+
let [A, j] = d(!1), M = i(["fileupload"], w), N = l(() => x ? t ? {
|
|
13
13
|
dragInactive: M.fileupload.dropZoneDragMultipleThumbnail,
|
|
14
14
|
dragActive: M.fileupload.dropZoneDragActiveMultipleThumbnail,
|
|
15
15
|
openFileDialog: M.fileupload.dropZoneOpenFileDialogMultipleThumbnail
|
|
@@ -38,7 +38,7 @@ var h = /* @__PURE__ */ e(t(), 1), g = a(({ id: e, multiple: t, value: a, onFile
|
|
|
38
38
|
P(a);
|
|
39
39
|
}, [D, a]);
|
|
40
40
|
let F = o((e) => {
|
|
41
|
-
g(e.map((e) => new
|
|
41
|
+
g(e.map((e) => new r(e))), D.current && (D.current.value = "");
|
|
42
42
|
}, [g]), I = (e) => {
|
|
43
43
|
let t = e.target.files;
|
|
44
44
|
t.length === 0 ? P(a) : F(Array.from(t));
|
|
@@ -49,7 +49,7 @@ var h = /* @__PURE__ */ e(t(), 1), g = a(({ id: e, multiple: t, value: a, onFile
|
|
|
49
49
|
let t = e.dataTransfer.files, n = Array.from(t);
|
|
50
50
|
L(n);
|
|
51
51
|
}, z = (e) => {
|
|
52
|
-
e.preventDefault(),
|
|
52
|
+
e.preventDefault(), S || j(!0);
|
|
53
53
|
}, B = () => {
|
|
54
54
|
j(!1);
|
|
55
55
|
}, V = o((e) => {
|
|
@@ -123,5 +123,4 @@ var h = /* @__PURE__ */ e(t(), 1), g = a(({ id: e, multiple: t, value: a, onFile
|
|
|
123
123
|
for (let n of e) t.items.add(n.file);
|
|
124
124
|
return t.files;
|
|
125
125
|
};
|
|
126
|
-
//#endregion
|
|
127
126
|
export { g as DropZone, _ as createFileList };
|