@oslokommune/punkt-react 19.15.6 → 19.16.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +30 -0
- package/dist/_virtual/_rolldown/runtime.js +13 -0
- package/dist/components/accordion/Accordion.js +28 -0
- package/dist/components/accordion/AccordionItem.js +60 -0
- package/dist/components/alert/Alert.js +76 -0
- package/dist/components/backlink/BackLink.js +35 -0
- package/dist/components/breadcrumbs/Breadcrumbs.js +67 -0
- package/dist/components/button/Button.js +54 -0
- package/dist/components/calendar/Calendar.js +49 -0
- package/dist/components/calendar/CalendarGrid.js +99 -0
- package/dist/components/calendar/CalendarNav.js +89 -0
- package/dist/components/calendar/calendar-utils.js +44 -0
- package/dist/components/calendar/useCalendarState.js +214 -0
- package/dist/components/card/Card.js +99 -0
- package/dist/components/checkbox/Checkbox.js +101 -0
- package/dist/components/checkboxgroup/CheckboxGroup.js +88 -0
- package/dist/components/checkboxgroup/CheckboxGroupContext.js +5 -0
- package/dist/components/combobox/Combobox.js +65 -0
- package/dist/components/combobox/ComboboxInput.js +87 -0
- package/dist/components/combobox/ComboboxTags.js +82 -0
- package/dist/components/combobox/Listbox.js +136 -0
- package/dist/components/combobox/useComboboxState.js +577 -0
- package/dist/components/consent/Consent.js +110 -0
- package/dist/components/datepicker/DateTags.js +28 -0
- package/dist/components/datepicker/Datepicker.js +79 -0
- package/dist/components/datepicker/DatepickerInputs.js +149 -0
- package/dist/components/datepicker/DatepickerPopup.js +41 -0
- package/dist/components/datepicker/useDatepickerState.js +243 -0
- package/dist/components/fileupload/DropZone.js +131 -0
- package/dist/components/fileupload/FileUpload.js +223 -0
- package/dist/components/fileupload/FileUploadContext.d.ts +2 -0
- package/dist/components/fileupload/FileUploadContext.js +6 -0
- package/dist/components/fileupload/QueueDisplay.js +67 -0
- package/dist/components/fileupload/QueueItemContent.js +88 -0
- package/dist/components/fileupload/Subcomponents.js +265 -0
- package/dist/components/fileupload/Truncate.js +22 -0
- package/dist/components/fileupload/extensions/Comments.js +128 -0
- package/dist/components/fileupload/extensions/Remove.js +9 -0
- package/dist/components/fileupload/extensions/Rename.js +66 -0
- package/dist/components/fileupload/hooks/useFileAttributes.js +25 -0
- package/dist/components/fileupload/hooks/useImageObjectUrl.js +15 -0
- package/dist/components/fileupload/hooks/useImagePreview.js +24 -0
- package/dist/components/fileupload/hooks/useOperationState.js +31 -0
- package/dist/components/fileupload/hooks/useRequiredFormValidation.js +23 -0
- package/dist/components/fileupload/types.d.ts +0 -1
- package/dist/components/fileupload/types.js +12 -0
- package/dist/components/footer/Footer.js +134 -0
- package/dist/components/footer/FooterGlobal.js +105 -0
- package/dist/components/footerSimple/FooterSimple.js +87 -0
- package/dist/components/header/Header.js +15 -0
- package/dist/components/header/HeaderGlobal.js +286 -0
- package/dist/components/header/HeaderService.js +281 -0
- package/dist/components/header-menu/HeaderMenu.js +197 -0
- package/dist/components/headerUserMenu/UserMenu.js +134 -0
- package/dist/components/heading/Heading.js +37 -0
- package/dist/components/helptext/Helptext.js +50 -0
- package/dist/components/icon/Icon.d.ts +6 -0
- package/dist/components/icon/Icon.js +69 -0
- package/dist/components/input/Input.js +23 -0
- package/dist/components/inputwrapper/InputWrapper.js +128 -0
- package/dist/components/link/Link.js +34 -0
- package/dist/components/linkcard/LinkCard.js +38 -0
- package/dist/components/loader/Loader.js +47 -0
- package/dist/components/messagebox/Messagebox.js +50 -0
- package/dist/components/modal/Modal.js +89 -0
- package/dist/components/progressbar/Progressbar.js +62 -0
- package/dist/components/radio/RadioButton.js +85 -0
- package/dist/components/radiogroup/RadioGroup.js +70 -0
- package/dist/components/radiogroup/RadioGroupContext.js +5 -0
- package/dist/components/searchinput/SearchInput.js +102 -0
- package/dist/components/select/Select.js +56 -0
- package/dist/components/stepper/Step.js +78 -0
- package/dist/components/stepper/Stepper.js +21 -0
- package/dist/components/strings/PktStringsProvider.js +21 -0
- package/dist/components/table/Table.js +19 -0
- package/dist/components/table/TableBody.js +13 -0
- package/dist/components/table/TableDataCell.js +14 -0
- package/dist/components/table/TableHeader.js +12 -0
- package/dist/components/table/TableHeaderCell.js +12 -0
- package/dist/components/table/TableRow.js +12 -0
- package/dist/components/tabs/TabItem.js +60 -0
- package/dist/components/tabs/Tabs.js +90 -0
- package/dist/components/tag/Tag.js +76 -0
- package/dist/components/textarea/Textarea.js +74 -0
- package/dist/components/textinput/Textinput.js +106 -0
- package/dist/components/timepicker/Timepicker.js +224 -0
- package/dist/components/timepicker/useTimepickerState.js +483 -0
- package/dist/hooks/useElementWidth.js +23 -0
- package/dist/hooks/useFocusModality.js +28 -0
- package/dist/hooks/useGeneratedId.js +8 -0
- package/dist/hooks/useHeaderChrome.js +36 -0
- package/dist/hooks/useOptionGroupField.js +70 -0
- package/dist/hooks/useOwnerForm.js +15 -0
- package/dist/hooks/usePktStrings.js +16 -0
- package/dist/hooks/useScrollLock.js +12 -0
- package/dist/node_modules/@date-fns/tz/date/index.js +57 -0
- package/dist/node_modules/@date-fns/tz/date/mini.js +75 -0
- package/dist/node_modules/@date-fns/tz/index.js +6 -0
- package/dist/node_modules/@date-fns/tz/tz/index.js +1 -0
- package/dist/node_modules/@date-fns/tz/tzName/index.js +10 -0
- package/dist/node_modules/@date-fns/tz/tzOffset/index.js +22 -0
- package/dist/node_modules/classnames/index.js +32 -0
- package/dist/node_modules/date-fns/_lib/addLeadingZeros.js +6 -0
- package/dist/node_modules/date-fns/_lib/defaultOptions.js +7 -0
- package/dist/node_modules/date-fns/_lib/format/formatters.js +389 -0
- package/dist/node_modules/date-fns/_lib/format/lightFormatters.js +43 -0
- package/dist/node_modules/date-fns/_lib/format/longFormatters.js +38 -0
- package/dist/node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js +8 -0
- package/dist/node_modules/date-fns/_lib/normalizeDates.js +8 -0
- package/dist/node_modules/date-fns/_lib/normalizeInterval.js +11 -0
- package/dist/node_modules/date-fns/_lib/protectedTokens.js +23 -0
- package/dist/node_modules/date-fns/addDays.js +9 -0
- package/dist/node_modules/date-fns/constants.js +10 -0
- package/dist/node_modules/date-fns/constructFrom.js +7 -0
- package/dist/node_modules/date-fns/differenceInCalendarDays.js +11 -0
- package/dist/node_modules/date-fns/eachDayOfInterval.js +15 -0
- package/dist/node_modules/date-fns/endOfDay.js +8 -0
- package/dist/node_modules/date-fns/format.js +59 -0
- package/dist/node_modules/date-fns/getDayOfYear.js +10 -0
- package/dist/node_modules/date-fns/getISODay.js +8 -0
- package/dist/node_modules/date-fns/getISOWeek.js +11 -0
- package/dist/node_modules/date-fns/getISOWeekYear.js +14 -0
- package/dist/node_modules/date-fns/getWeek.js +11 -0
- package/dist/node_modules/date-fns/getWeekYear.js +15 -0
- package/dist/node_modules/date-fns/isDate.js +6 -0
- package/dist/node_modules/date-fns/isValid.js +8 -0
- package/dist/node_modules/date-fns/locale/_lib/buildFormatLongFn.js +9 -0
- package/dist/node_modules/date-fns/locale/_lib/buildLocalizeFn.js +17 -0
- package/dist/node_modules/date-fns/locale/_lib/buildMatchFn.js +22 -0
- package/dist/node_modules/date-fns/locale/_lib/buildMatchPatternFn.js +18 -0
- package/dist/node_modules/date-fns/locale/en-US/_lib/formatDistance.js +69 -0
- package/dist/node_modules/date-fns/locale/en-US/_lib/formatLong.js +32 -0
- package/dist/node_modules/date-fns/locale/en-US/_lib/formatRelative.js +11 -0
- package/dist/node_modules/date-fns/locale/en-US/_lib/localize.js +202 -0
- package/dist/node_modules/date-fns/locale/en-US/_lib/match.js +124 -0
- package/dist/node_modules/date-fns/locale/en-US.js +20 -0
- package/dist/node_modules/date-fns/startOfDay.js +8 -0
- package/dist/node_modules/date-fns/startOfISOWeek.js +10 -0
- package/dist/node_modules/date-fns/startOfISOWeekYear.js +10 -0
- package/dist/node_modules/date-fns/startOfWeek.js +9 -0
- package/dist/node_modules/date-fns/startOfWeekYear.js +11 -0
- package/dist/node_modules/date-fns/startOfYear.js +8 -0
- package/dist/node_modules/date-fns/toDate.js +7 -0
- package/dist/punkt-react.cjs +1 -1
- package/dist/punkt-react.js +55 -9388
- package/dist/shared-strings/consent.js +113 -0
- package/dist/shared-strings/format.js +18 -0
- package/dist/shared-strings/nb.js +201 -0
- package/dist/shared-strings/resolve.js +40 -0
- package/dist/shared-strings/store.js +35 -0
- package/dist/shared-types/accordion.js +4 -0
- package/dist/shared-types/calendar.js +12 -0
- package/dist/shared-types/card.js +15 -0
- package/dist/shared-types/checkbox.js +15 -0
- package/dist/shared-types/combobox.js +19 -0
- package/dist/shared-types/consent.js +8 -0
- package/dist/shared-types/footer.js +4 -0
- package/dist/shared-types/header-footer.js +4 -0
- package/dist/shared-types/icon.js +7 -0
- package/dist/shared-types/messagebox.js +8 -0
- package/dist/shared-types/option-group.js +14 -0
- package/dist/shared-types/radiobutton.js +11 -0
- package/dist/shared-types/select.js +14 -0
- package/dist/shared-types/table.js +8 -0
- package/dist/shared-utils/calendar/calendar-grid.js +19 -0
- package/dist/shared-utils/calendar/date-validation.js +19 -0
- package/dist/shared-utils/calendar/keyboard-navigation.js +26 -0
- package/dist/shared-utils/calendar/selection-manager.js +52 -0
- package/dist/shared-utils/combobox/input-utils.js +39 -0
- package/dist/shared-utils/combobox/keyboard-navigation.js +41 -0
- package/dist/shared-utils/combobox/option-utils.js +48 -0
- package/dist/shared-utils/date-utils.js +71 -0
- package/dist/shared-utils/datepicker-utils.js +32 -0
- package/dist/shared-utils/device-utils.js +7 -0
- package/dist/shared-utils/fileupload/announcements.js +21 -0
- package/dist/shared-utils/fileupload/filename.js +8 -0
- package/dist/shared-utils/fileupload/focus-trap.js +2 -0
- package/dist/shared-utils/fileupload/formats.js +29 -0
- package/dist/shared-utils/fileupload/index.js +11 -0
- package/dist/shared-utils/fileupload/navigation.js +6 -0
- package/dist/shared-utils/fileupload/size.js +25 -0
- package/dist/shared-utils/fileupload/transfers.js +23 -0
- package/dist/shared-utils/fileupload/truncate.js +9 -0
- package/dist/shared-utils/fileupload/validation.js +32 -0
- package/dist/shared-utils/focus-trap/index.js +60 -0
- package/dist/shared-utils/forms/described-by.js +7 -0
- package/dist/shared-utils/header-footer/external-domain.js +30 -0
- package/dist/shared-utils/header-footer/fetch-header-footer-data.js +29 -0
- package/dist/shared-utils/header-footer/icon-map.js +55 -0
- package/dist/shared-utils/header-footer/select-megamenu.js +7 -0
- package/dist/shared-utils/scroll-lock/index.js +21 -0
- package/dist/shared-utils/timepicker/options.js +10 -0
- package/dist/shared-utils/timepicker/stepper.js +10 -0
- package/dist/shared-utils/timepicker/time-utils.js +7 -0
- package/dist/shared-utils/value-utils.js +12 -0
- package/dist/utils/nativeInputValue.js +6 -0
- package/dist/utils/stableKeys.js +13 -0
- package/dist/utils/stringutils.js +7 -0
- package/package.json +3 -2
- package/src/components/checkbox/Checkbox.tsx +2 -0
- package/src/components/combobox/types.ts +0 -2
- package/src/components/fileupload/FileUpload.tsx +3 -1
- package/src/components/fileupload/FileUploadContext.ts +7 -0
- package/src/components/fileupload/QueueDisplay.tsx +3 -3
- package/src/components/fileupload/Subcomponents.tsx +2 -7
- package/src/components/fileupload/extensions/Comments.tsx +2 -1
- package/src/components/fileupload/extensions/Rename.tsx +2 -1
- package/src/components/fileupload/types.ts +1 -2
- package/src/components/header/Header.test.tsx +0 -7
- package/src/components/header/Header.tsx +0 -2
- package/src/components/heading/Heading.tsx +0 -2
- package/src/components/hydration.test.tsx +61 -15
- package/src/components/icon/Icon.test.tsx +0 -7
- package/src/components/icon/Icon.tsx +7 -0
- package/src/components/input/Input.tsx +0 -2
- package/src/components/link/Link.tsx +0 -2
- package/src/components/radio/RadioButton.tsx +2 -0
- package/src/components/server-components.test.ts +69 -0
- package/src/components/stepper/Step.tsx +0 -2
- package/src/components/stepper/Stepper.tsx +0 -2
- package/src/components/strings/PktStringsProvider.tsx +2 -0
- package/src/components/table/Table.tsx +0 -2
- package/src/components/table/TableBody.tsx +1 -3
- package/src/components/table/TableDataCell.tsx +0 -2
- package/src/components/table/TableHeader.tsx +0 -2
- package/src/components/table/TableHeaderCell.tsx +0 -2
- package/src/components/table/TableRow.tsx +0 -2
- package/dist/components/accordion/Accordion.test.d.ts +0 -0
- package/dist/components/alert/Alert.test.d.ts +0 -0
- package/dist/components/backlink/BackLink.test.d.ts +0 -0
- package/dist/components/breadcrumbs/Breadcrumbs.test.d.ts +0 -1
- package/dist/components/button/Button.test.d.ts +0 -0
- package/dist/components/calendar/Calendar.accessibility.test.d.ts +0 -0
- package/dist/components/calendar/Calendar.constraints.test.d.ts +0 -0
- package/dist/components/calendar/Calendar.core.test.d.ts +0 -0
- package/dist/components/calendar/Calendar.interaction.test.d.ts +0 -0
- package/dist/components/calendar/Calendar.selection.test.d.ts +0 -0
- package/dist/components/card/Card.test.d.ts +0 -0
- package/dist/components/checkbox/Checkbox.test.d.ts +0 -0
- package/dist/components/checkboxgroup/CheckboxGroup.forms.test.d.ts +0 -0
- package/dist/components/checkboxgroup/CheckboxGroup.test.d.ts +0 -0
- package/dist/components/combobox/Combobox.accessibility.test.d.ts +0 -0
- package/dist/components/combobox/Combobox.core.test.d.ts +0 -0
- package/dist/components/combobox/Combobox.interaction.test.d.ts +0 -0
- package/dist/components/combobox/Combobox.preselection.test.d.ts +0 -0
- package/dist/components/combobox/Combobox.selection.test.d.ts +0 -0
- package/dist/components/consent/Consent.test.d.ts +0 -0
- package/dist/components/datepicker/Datepicker.accessibility.test.d.ts +0 -0
- package/dist/components/datepicker/Datepicker.core.test.d.ts +0 -0
- package/dist/components/datepicker/Datepicker.input.test.d.ts +0 -0
- package/dist/components/datepicker/Datepicker.selection.test.d.ts +0 -0
- package/dist/components/datepicker/Datepicker.validation.test.d.ts +0 -0
- package/dist/components/fileupload/FileUpload.test.d.ts +0 -0
- package/dist/components/fileupload/QueueDisplay.test.d.ts +0 -0
- package/dist/components/fileupload/Truncate.test.d.ts +0 -0
- package/dist/components/footer/Footer.accessibility.test.d.ts +0 -0
- package/dist/components/footer/Footer.test.d.ts +0 -1
- package/dist/components/footerSimple/FooterSimple.test.d.ts +0 -1
- package/dist/components/formAttribute.test.d.ts +0 -1
- package/dist/components/header/Header.test.d.ts +0 -0
- package/dist/components/header/HeaderGlobal.accessibility.test.d.ts +0 -0
- package/dist/components/header/HeaderGlobal.test.d.ts +0 -0
- package/dist/components/header/HeaderService.accessibility.test.d.ts +0 -0
- package/dist/components/header/HeaderService.test.d.ts +0 -0
- package/dist/components/header-menu/HeaderMenu.test.d.ts +0 -0
- package/dist/components/headerUserMenu/UserMenu.test.d.ts +0 -0
- package/dist/components/heading/Heading.test.d.ts +0 -0
- package/dist/components/helptext/Helptext.test.d.ts +0 -0
- package/dist/components/helptext/helptextAssociation.test.d.ts +0 -1
- package/dist/components/hydration.test.d.ts +0 -1
- package/dist/components/icon/Icon.test.d.ts +0 -9
- package/dist/components/inputwrapper/InputWrapper.test.d.ts +0 -0
- package/dist/components/link/Link.test.d.ts +0 -1
- package/dist/components/linkcard/LinkCard.test.d.ts +0 -0
- package/dist/components/loader/Loader.test.d.ts +0 -0
- package/dist/components/messagebox/Messagebox.test.d.ts +0 -1
- package/dist/components/modal/Modal.test.d.ts +0 -0
- package/dist/components/progressbar/Progressbar.test.d.ts +0 -0
- package/dist/components/radio/RadioButton.test.d.ts +0 -0
- package/dist/components/radiogroup/RadioGroup.forms.test.d.ts +0 -0
- package/dist/components/radiogroup/RadioGroup.test.d.ts +0 -0
- package/dist/components/searchinput/SearchInput.test.d.ts +0 -0
- package/dist/components/select/Select.test.d.ts +0 -0
- package/dist/components/ssr.test.d.ts +0 -1
- package/dist/components/stepper/Stepper.test.d.ts +0 -0
- package/dist/components/strings/strings-override.test.d.ts +0 -1
- package/dist/components/table/Table.test.d.ts +0 -0
- package/dist/components/tabs/Tabs.test.d.ts +0 -0
- package/dist/components/tag/Tag.test.d.ts +0 -0
- package/dist/components/textarea/Textarea.test.d.ts +0 -0
- package/dist/components/textinput/Textinput.test.d.ts +0 -0
- package/dist/components/timepicker/Timepicker.test.d.ts +0 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import e from "../../node_modules/date-fns/eachDayOfInterval.js";
|
|
2
|
+
import t from "../../node_modules/date-fns/getISODay.js";
|
|
3
|
+
import { formatISODate as n, parseISODateString as r } from "../date-utils.js";
|
|
4
|
+
//#region ../../shared-utils/calendar/selection-manager.ts
|
|
5
|
+
function i(e) {
|
|
6
|
+
return typeof e == "string" && (e = e.split(",")), e.length === 1 && e[0] === "" ? [] : e.map((e) => r(e));
|
|
7
|
+
}
|
|
8
|
+
function a(t, r) {
|
|
9
|
+
let i = e({
|
|
10
|
+
start: t,
|
|
11
|
+
end: r
|
|
12
|
+
}), a = {};
|
|
13
|
+
if (Array.isArray(i) && i.length) for (let e = 0; e < i.length; e++) {
|
|
14
|
+
let o = i[e], s = o > t && o < r;
|
|
15
|
+
a[n(o)] = s;
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
}
|
|
19
|
+
function o(n, r, i, a) {
|
|
20
|
+
if (r.length !== 1) return !0;
|
|
21
|
+
let o = e({
|
|
22
|
+
start: r[0],
|
|
23
|
+
end: n
|
|
24
|
+
});
|
|
25
|
+
if (!Array.isArray(o) || !o.length) return !0;
|
|
26
|
+
for (let e = 0; e < o.length; e++) {
|
|
27
|
+
for (let e of i ?? []) if (e > r[0] && e < n) return !1;
|
|
28
|
+
if ((a ?? []).includes(t(o[e]).toString())) return !1;
|
|
29
|
+
}
|
|
30
|
+
return !0;
|
|
31
|
+
}
|
|
32
|
+
function s(e, t) {
|
|
33
|
+
let r = n(e);
|
|
34
|
+
return t.includes(r) ? t : [...t, r];
|
|
35
|
+
}
|
|
36
|
+
function c(e, t) {
|
|
37
|
+
let r = n(e), i = t.indexOf(r);
|
|
38
|
+
if (i === -1) return t;
|
|
39
|
+
if (t.length === 1) return [];
|
|
40
|
+
let a = [...t];
|
|
41
|
+
return a.splice(i, 1), a;
|
|
42
|
+
}
|
|
43
|
+
function l(e, t, r) {
|
|
44
|
+
let i = n(e);
|
|
45
|
+
return t.includes(i) ? c(e, t) : r > 0 && t.length >= r ? t : s(e, t);
|
|
46
|
+
}
|
|
47
|
+
function u(e, t, r) {
|
|
48
|
+
let a = n(e), l = i(t);
|
|
49
|
+
return t.includes(a) ? t.indexOf(a) === 0 ? [] : c(e, t) : t.length > 1 || t.length === 1 && (!o(e, l, r.excludedates, r.excludeweekdays) || l[0] > e) ? [a] : s(e, t);
|
|
50
|
+
}
|
|
51
|
+
//#endregion
|
|
52
|
+
export { s as addToSelection, i as convertSelectedToDates, u as handleRangeSelection, o as isRangeAllowed, c as removeFromSelection, l as toggleSelection, a as updateRangeMap };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { findOptionByValue as e } from "./option-utils.js";
|
|
2
|
+
//#region ../../shared-utils/combobox/input-utils.ts
|
|
3
|
+
var t = (e, t, n) => {
|
|
4
|
+
switch (e) {
|
|
5
|
+
case ",": return n ? "addValue" : null;
|
|
6
|
+
case "Enter": return "addValue";
|
|
7
|
+
case "Tab":
|
|
8
|
+
case "ArrowDown": return t ? null : "focusListbox";
|
|
9
|
+
case "Escape": return "closeOptions";
|
|
10
|
+
default: return null;
|
|
11
|
+
}
|
|
12
|
+
}, n = (t, n, r, i, a) => {
|
|
13
|
+
if (!t) return {
|
|
14
|
+
action: "none",
|
|
15
|
+
value: null
|
|
16
|
+
};
|
|
17
|
+
let o = e(r, t);
|
|
18
|
+
return !n.includes(t) && !o ? i ? {
|
|
19
|
+
action: "addUserValue",
|
|
20
|
+
value: t
|
|
21
|
+
} : a ? {
|
|
22
|
+
action: "none",
|
|
23
|
+
value: null
|
|
24
|
+
} : {
|
|
25
|
+
action: "removeValue",
|
|
26
|
+
value: n[0]
|
|
27
|
+
} : o && !n.includes(o.value) ? {
|
|
28
|
+
action: "selectOption",
|
|
29
|
+
value: o.value
|
|
30
|
+
} : {
|
|
31
|
+
action: "none",
|
|
32
|
+
value: null
|
|
33
|
+
};
|
|
34
|
+
}, r = (t, n, r) => {
|
|
35
|
+
let i = e(n, t);
|
|
36
|
+
return r === "label" && i?.label ? i.label : t;
|
|
37
|
+
};
|
|
38
|
+
//#endregion
|
|
39
|
+
export { t as getInputKeyAction, n as getInputValueAction, r as getSingleValueForInput };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
//#region ../../shared-utils/combobox/keyboard-navigation.ts
|
|
2
|
+
var e = (e) => {
|
|
3
|
+
e.scrollIntoView({ block: "nearest" }), window.setTimeout(() => e.focus(), 0);
|
|
4
|
+
}, t = (e) => Array.from(e.querySelectorAll("[role=\"option\"]:not([data-disabled])") || []), n = (t) => {
|
|
5
|
+
let n = t.nextElementSibling;
|
|
6
|
+
n && e(n);
|
|
7
|
+
}, r = (t, n, r) => {
|
|
8
|
+
let i = t.previousElementSibling;
|
|
9
|
+
if (t.dataset.index === "0" && r) {
|
|
10
|
+
let t = n.querySelector("[role=\"searchbox\"]");
|
|
11
|
+
t && e(t);
|
|
12
|
+
} else i && e(i);
|
|
13
|
+
}, i = (n) => {
|
|
14
|
+
let r = t(n);
|
|
15
|
+
r[0] && e(r[0]);
|
|
16
|
+
}, a = (n, r) => {
|
|
17
|
+
if (r.disabled) return;
|
|
18
|
+
let i = t(n);
|
|
19
|
+
if (r.allowUserInput && r.customUserInput) {
|
|
20
|
+
let t = n.querySelector("[data-type=\"new-option\"]");
|
|
21
|
+
if (t) {
|
|
22
|
+
e(t);
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
let a = i.find((e) => e.dataset.selected === "true");
|
|
27
|
+
if (a) {
|
|
28
|
+
e(a);
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
if (r.includeSearch && !(document.activeElement instanceof HTMLInputElement)) {
|
|
32
|
+
let e = n.querySelector("[role=\"searchbox\"]");
|
|
33
|
+
if (e) {
|
|
34
|
+
window.setTimeout(() => e.focus(), 0);
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
i[0] && e(i[0]);
|
|
39
|
+
};
|
|
40
|
+
//#endregion
|
|
41
|
+
export { e as focusAndScrollIntoView, i as focusFirstOption, a as focusFirstOrSelectedOption, n as focusNextOption, r as focusPreviousOption, t as getOptionElements };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
//#region ../../shared-utils/combobox/option-utils.ts
|
|
2
|
+
var e = (e, t) => t && (e.find((e) => e.value === t) || e.find((e) => e.label === t)) || null, t = (e, t) => {
|
|
3
|
+
if (!t) return -1;
|
|
4
|
+
let n = e.findIndex((e) => e.value === t);
|
|
5
|
+
return n >= 0 ? n : e.findIndex((e) => e.label === t);
|
|
6
|
+
}, n = (e) => e.value + (e.label || "") + (e.prefix || ""), r = (e, t) => (e.fulltext || n(e)).toLowerCase().includes(t), i = (e, t) => {
|
|
7
|
+
if (!t) return [...e];
|
|
8
|
+
let n = t.toLowerCase();
|
|
9
|
+
return e.filter((e) => r(e, n));
|
|
10
|
+
}, a = (e, t) => t !== null && e >= t, o = (e, t) => {
|
|
11
|
+
if (!e) return "";
|
|
12
|
+
switch (t) {
|
|
13
|
+
case "prefixAndValue": return `${e.prefix || ""} ${e.value}`.trim();
|
|
14
|
+
case "value": return e.value;
|
|
15
|
+
default: return e.label || e.value;
|
|
16
|
+
}
|
|
17
|
+
}, s = (e, t) => e ? Array.isArray(e) ? t ? e : e.length > 0 ? [e[0]] : [] : t ? e.split(",").filter(Boolean) : [e] : [], c = (e, t) => {
|
|
18
|
+
if (!t) return {
|
|
19
|
+
filtered: [...e],
|
|
20
|
+
suggestion: null
|
|
21
|
+
};
|
|
22
|
+
let n = t.toLowerCase(), i = e.filter((e) => r(e, n));
|
|
23
|
+
return {
|
|
24
|
+
filtered: i,
|
|
25
|
+
suggestion: i.find((e) => !e.selected && e.label?.toLowerCase().startsWith(n)) || null
|
|
26
|
+
};
|
|
27
|
+
}, l = (e, t, n, r) => {
|
|
28
|
+
if (!e.trim()) return {
|
|
29
|
+
addValueText: null,
|
|
30
|
+
userInfoMessage: ""
|
|
31
|
+
};
|
|
32
|
+
let i = e.trim().toLowerCase(), a = t.find((e) => e.toLowerCase() === i), o = n.filter((e) => e.label?.toLowerCase().includes(i) || e.value.toLowerCase().includes(i)), s = o.find((e) => e.label?.toLowerCase() === i || e.value.toLowerCase() === i);
|
|
33
|
+
return (o.length === 0 || !s) && r ? {
|
|
34
|
+
addValueText: e,
|
|
35
|
+
userInfoMessage: ""
|
|
36
|
+
} : o.length === 0 && !r ? {
|
|
37
|
+
addValueText: null,
|
|
38
|
+
userInfoMessage: "noResults"
|
|
39
|
+
} : a ? {
|
|
40
|
+
addValueText: null,
|
|
41
|
+
userInfoMessage: "alreadySelected"
|
|
42
|
+
} : {
|
|
43
|
+
addValueText: null,
|
|
44
|
+
userInfoMessage: ""
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
//#endregion
|
|
48
|
+
export { n as buildFulltext, i as filterOptionsBySearch, e as findOptionByValue, t as findOptionIndex, c as findTypeaheadMatches, o as getOptionDisplayText, l as getSearchInfoMessage, a as isMaxSelectionReached, s as parseValueToArray };
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import e from "../node_modules/date-fns/startOfDay.js";
|
|
2
|
+
import t from "../node_modules/date-fns/endOfDay.js";
|
|
3
|
+
import n from "../node_modules/date-fns/format.js";
|
|
4
|
+
import { TZDate as r } from "../node_modules/@date-fns/tz/date/index.js";
|
|
5
|
+
import "../node_modules/@date-fns/tz/index.js";
|
|
6
|
+
//#region ../../shared-utils/date-utils.ts
|
|
7
|
+
typeof window < "u" && (window.pktTz = window.pktTz === void 0 ? "Europe/Oslo" : window.pktTz);
|
|
8
|
+
var i = () => typeof window < "u" && window.pktTz || "Europe/Oslo", a = (e = i()) => {
|
|
9
|
+
let t = new r((/* @__PURE__ */ new Date()).toISOString(), e);
|
|
10
|
+
return t.setHours(0, 0, 0, 0), isNaN(t.getTime()) ? /* @__PURE__ */ new Date() : new Date(t.getFullYear(), t.getMonth(), t.getDate());
|
|
11
|
+
};
|
|
12
|
+
function o(e) {
|
|
13
|
+
if (!e || e === "") return /* @__PURE__ */ new Date();
|
|
14
|
+
if (/^\d{4}-\d{2}-\d{2}$/.test(e)) {
|
|
15
|
+
let [t, n, r] = e.split("-").map(Number);
|
|
16
|
+
return new Date(t, n - 1, r);
|
|
17
|
+
}
|
|
18
|
+
if (/^\d{4}-\d{2}$/.test(e)) {
|
|
19
|
+
let [t, n] = e.split("-").map(Number);
|
|
20
|
+
return new Date(t, n - 1, 1);
|
|
21
|
+
}
|
|
22
|
+
return /^\d{4}$/.test(e) ? new Date(Number(e), 0, 1) : new Date(e);
|
|
23
|
+
}
|
|
24
|
+
var s = (e) => !e || isNaN(e.getTime()) ? "" : `${e.getFullYear()}-${String(e.getMonth() + 1).padStart(2, "0")}-${String(e.getDate()).padStart(2, "0")}`, c = (e) => {
|
|
25
|
+
if (!e) return null;
|
|
26
|
+
let t = o(e);
|
|
27
|
+
return isNaN(t.getTime()) ? null : t;
|
|
28
|
+
}, l = (e, t) => {
|
|
29
|
+
let r = u(e);
|
|
30
|
+
return isNaN(r.getTime()) ? "" : n(r, t);
|
|
31
|
+
}, u = (n = "", r) => {
|
|
32
|
+
let i = typeof n == "string" ? o(n) : n;
|
|
33
|
+
return !i || isNaN(i.getTime()) ? /* @__PURE__ */ new Date() : r ? r === "end" ? t(i) : e(i) : i;
|
|
34
|
+
}, d = (e, t, n = 1) => {
|
|
35
|
+
if (typeof e != "number" || typeof t != "number" || typeof n != "number" || isNaN(e) || isNaN(t) || isNaN(n)) return /* @__PURE__ */ new Date();
|
|
36
|
+
let r = new Date(e, t, n);
|
|
37
|
+
return isNaN(r.getTime()) ? /* @__PURE__ */ new Date() : r;
|
|
38
|
+
}, f = (e) => {
|
|
39
|
+
let t;
|
|
40
|
+
return t = new r(e, i()), t.setHours(12, 0, 0, 0), t;
|
|
41
|
+
}, p = null, m = void 0, h = (e) => {
|
|
42
|
+
if (!e || isNaN(e.getTime())) return "";
|
|
43
|
+
let t = i();
|
|
44
|
+
return (!p || m !== t) && (p = new Intl.DateTimeFormat("no", {
|
|
45
|
+
dateStyle: "full",
|
|
46
|
+
timeZone: t
|
|
47
|
+
}), m = t), p.format(e);
|
|
48
|
+
}, g = (e, t, n) => {
|
|
49
|
+
if (!e || isNaN(e.getTime())) return !1;
|
|
50
|
+
let r = t ? u(t) : null, i = n ? u(n) : null;
|
|
51
|
+
return !(r && e < r || i && e > i);
|
|
52
|
+
}, _ = (e, t) => {
|
|
53
|
+
if (!e || isNaN(e.getTime()) || !Array.isArray(t)) return !1;
|
|
54
|
+
let n = s(e);
|
|
55
|
+
return t.includes(n);
|
|
56
|
+
}, v = (e, t) => {
|
|
57
|
+
if (!e || isNaN(e.getTime()) || !Array.isArray(t)) return !1;
|
|
58
|
+
let n = e.getDay().toString();
|
|
59
|
+
return t.includes(n);
|
|
60
|
+
}, y = (e, t, n, r, i) => !(!e || isNaN(e.getTime()) || !g(e, t, n) || r && _(e, r) || i && v(e, i)), b = (e, t, n, r, i) => e.filter((e) => {
|
|
61
|
+
let a = c(e);
|
|
62
|
+
return a && y(a, t, n, r, i);
|
|
63
|
+
}), x = (e) => e.slice().sort((e, t) => {
|
|
64
|
+
let n = c(e), r = c(t);
|
|
65
|
+
return !n || !r ? 0 : n.getTime() - r.getTime();
|
|
66
|
+
}), S = (e, t) => {
|
|
67
|
+
let n = c(e), r = c(t);
|
|
68
|
+
return !n || !r ? !1 : n <= r;
|
|
69
|
+
};
|
|
70
|
+
//#endregion
|
|
71
|
+
export { b as filterSelectableDates, s as formatISODate, h as formatReadableDate, c as fromISOToDate, l as fromISOtoLocal, _ as isDateExcluded, g as isDateInRange, y as isDateSelectable, S as isValidDateRange, v as isWeekdayExcluded, u as newDate, f as newDateFromDate, d as newDateYMD, o as parseISODateString, x as sortDateStrings, a as todayInTz };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { isValidDateRange as e } from "./date-utils.js";
|
|
2
|
+
import { isIOS as t } from "./device-utils.js";
|
|
3
|
+
//#region ../../shared-utils/datepicker-utils.ts
|
|
4
|
+
var n = () => t() ? "text" : "date", r = (t) => !t || t.length !== 2 || e(t[0], t[1]), i = (e, t, n, r, i, a, o = "medium") => ({
|
|
5
|
+
"pkt-input": !0,
|
|
6
|
+
"pkt-datepicker__input": !0,
|
|
7
|
+
[`pkt-input--${o}`]: !0,
|
|
8
|
+
"pkt-input--fullwidth": e,
|
|
9
|
+
"pkt-datepicker--hasrangelabels": t,
|
|
10
|
+
"pkt-datepicker--multiple": n,
|
|
11
|
+
"pkt-datepicker--range": r,
|
|
12
|
+
"ios-readonly-hack": i === !1 && a === "text"
|
|
13
|
+
}), a = (e = "medium") => ({
|
|
14
|
+
"pkt-input-icon": !0,
|
|
15
|
+
"pkt-btn": !0,
|
|
16
|
+
"pkt-btn--icon-only": !0,
|
|
17
|
+
"pkt-btn--tertiary": !0,
|
|
18
|
+
[`pkt-btn--${e}`]: !0,
|
|
19
|
+
"pkt-datepicker__calendar-button": !0
|
|
20
|
+
}), o = (e) => ({
|
|
21
|
+
"pkt-input-prefix": e,
|
|
22
|
+
"pkt-hide": !e
|
|
23
|
+
}), s = (e, t, n) => !t && !n ? Array.isArray(e) ? e[0] || "" : e : Array.isArray(e) ? e.join(",") : e, c = (e, t, n = !1) => {
|
|
24
|
+
if (!e || !t) return;
|
|
25
|
+
let r = t.parentElement?.getBoundingClientRect() || t.getBoundingClientRect(), i = n ? r.height + 30 : r.height, a = e.getBoundingClientRect().height, o = n ? "calc(100% - 30px)" : "100%";
|
|
26
|
+
r && typeof window < "u" && r.top + a > window.innerHeight && r.top - a > 0 && (o = `calc(100% - ${i}px - ${a}px)`), e.style.top = o;
|
|
27
|
+
}, l = (e, t, n, r, i, a) => {
|
|
28
|
+
let { key: o } = e;
|
|
29
|
+
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());
|
|
30
|
+
};
|
|
31
|
+
//#endregion
|
|
32
|
+
export { a as getDatepickerButtonClasses, i as getDatepickerInputClasses, n as getDatepickerInputType, o as getRangeLabelClasses, c as handleCalendarPosition, l as handleDatepickerKeydown, s as processDateSelection, r as validateRangeOrder };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
//#region ../../shared-utils/fileupload/announcements.ts
|
|
2
|
+
function e(e, t) {
|
|
3
|
+
let n = e.length;
|
|
4
|
+
if (n === 0 || !t || t.length === 0) return {
|
|
5
|
+
totalCount: n,
|
|
6
|
+
uploadedCount: 0,
|
|
7
|
+
failedCount: 0
|
|
8
|
+
};
|
|
9
|
+
let r = 0, i = 0;
|
|
10
|
+
for (let n of e) {
|
|
11
|
+
let e = t.find((e) => e.fileId === n.fileId);
|
|
12
|
+
e?.progress === "done" ? r++ : e?.progress === "error" && i++;
|
|
13
|
+
}
|
|
14
|
+
return {
|
|
15
|
+
totalCount: n,
|
|
16
|
+
uploadedCount: r,
|
|
17
|
+
failedCount: i
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
export { e as countFileTransferStates };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { nb as e } from "../../shared-strings/nb.js";
|
|
2
|
+
//#region ../../shared-utils/fileupload/filename.ts
|
|
3
|
+
var t = ".jpeg, .jpg, .png, .gif, .webp, .heic";
|
|
4
|
+
function n(t, n = e.fileupload.unknownFilename) {
|
|
5
|
+
return t.attributes?.targetFilename || t.file?.name || n;
|
|
6
|
+
}
|
|
7
|
+
//#endregion
|
|
8
|
+
export { t as THUMBNAIL_ACCEPT, n as getDisplayFilename };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
//#region ../../shared-utils/fileupload/formats.ts
|
|
2
|
+
function e(e) {
|
|
3
|
+
return Array.isArray(e) ? e.map((e) => String(e).trim().toLowerCase()).filter(Boolean) : [];
|
|
4
|
+
}
|
|
5
|
+
function t(e, t, n) {
|
|
6
|
+
let r = e.toLowerCase().replace(/^\./, "");
|
|
7
|
+
if (r.includes("/")) {
|
|
8
|
+
if (r.endsWith("/*")) {
|
|
9
|
+
let e = r.replace("/*", "");
|
|
10
|
+
return n.startsWith(`${e}/`);
|
|
11
|
+
}
|
|
12
|
+
return n === r;
|
|
13
|
+
}
|
|
14
|
+
return t === r;
|
|
15
|
+
}
|
|
16
|
+
function n(n, r) {
|
|
17
|
+
let i = e(r);
|
|
18
|
+
if (i.length === 0) return !0;
|
|
19
|
+
let a = n.name.split(".").pop()?.toLowerCase() ?? "", o = n.type.toLowerCase();
|
|
20
|
+
return i.some((e) => t(e, a, o));
|
|
21
|
+
}
|
|
22
|
+
function r(t, n) {
|
|
23
|
+
let r = (t ?? "").trim();
|
|
24
|
+
if (r) return r;
|
|
25
|
+
let i = e(n);
|
|
26
|
+
return i.length === 0 ? "" : i.map((e) => e.includes("/") || e.startsWith(".") ? e : `.${e}`).join(", ");
|
|
27
|
+
}
|
|
28
|
+
//#endregion
|
|
29
|
+
export { n as isFileAllowed, t as matchesAllowedFormat, e as normalizeAllowedFormats, r as resolveAcceptAttribute };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { formatFileSize as e } from "./size.js";
|
|
2
|
+
import { resolveAcceptAttribute as t } from "./formats.js";
|
|
3
|
+
import { isImageFileLike as n, validateFile as r } from "./validation.js";
|
|
4
|
+
import { getProgressState as i, mergeFilesAndTransfers as a } from "./transfers.js";
|
|
5
|
+
import { trapTabInside as o } from "../focus-trap/index.js";
|
|
6
|
+
import "./focus-trap.js";
|
|
7
|
+
import { splitFilenameForTruncation as s } from "./truncate.js";
|
|
8
|
+
import { navigateCyclic as c } from "./navigation.js";
|
|
9
|
+
import { countFileTransferStates as l } from "./announcements.js";
|
|
10
|
+
import { THUMBNAIL_ACCEPT as u, getDisplayFilename as d } from "./filename.js";
|
|
11
|
+
export { u as THUMBNAIL_ACCEPT, l as countFileTransferStates, e as formatFileSize, d as getDisplayFilename, i as getProgressState, n as isImageFileLike, a as mergeFilesAndTransfers, c as navigateCyclic, t as resolveAcceptAttribute, s as splitFilenameForTruncation, o as trapTabInside, r as validateFile };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
//#region ../../shared-utils/fileupload/size.ts
|
|
2
|
+
function e(e) {
|
|
3
|
+
if (e == null || e === "") return;
|
|
4
|
+
if (typeof e == "number") return Number.isFinite(e) && e > 0 ? e : void 0;
|
|
5
|
+
let t = String(e).trim(), n = Number(t);
|
|
6
|
+
if (!Number.isNaN(n) && n > 0) return n;
|
|
7
|
+
let r = t.match(/^(\d+(?:\.\d+)?)\s*(B|KB|MB|GB)$/i);
|
|
8
|
+
if (!r) {
|
|
9
|
+
console.warn(`PktFileUpload: Invalid maxFileSize format "${t}". Use format like "5MB", "500KB", "1GB", or bytes.`);
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
let i = parseFloat(r[1]);
|
|
13
|
+
switch (r[2].toUpperCase()) {
|
|
14
|
+
case "B": return i;
|
|
15
|
+
case "KB": return i * 1024;
|
|
16
|
+
case "MB": return i * 1024 * 1024;
|
|
17
|
+
case "GB": return i * 1024 * 1024 * 1024;
|
|
18
|
+
default: return;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function t(e) {
|
|
22
|
+
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`;
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
export { t as formatFileSize, e as parseFileSize };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//#region ../../shared-utils/fileupload/transfers.ts
|
|
2
|
+
function e(e) {
|
|
3
|
+
return typeof e == "number" ? "in-progress" : e === "error" ? "error" : "idle";
|
|
4
|
+
}
|
|
5
|
+
function t(t, n, r) {
|
|
6
|
+
let i = {
|
|
7
|
+
"in-progress": 0,
|
|
8
|
+
error: 1,
|
|
9
|
+
idle: 2
|
|
10
|
+
};
|
|
11
|
+
return t.map((e) => {
|
|
12
|
+
let t = n?.find((t) => t.fileId === e.fileId);
|
|
13
|
+
return {
|
|
14
|
+
...e,
|
|
15
|
+
progress: t?.progress ?? (r === "form" ? "done" : "queued"),
|
|
16
|
+
errorMessage: t?.errorMessage,
|
|
17
|
+
showProgress: t?.showProgress,
|
|
18
|
+
lastProgress: t?.lastProgress
|
|
19
|
+
};
|
|
20
|
+
}).sort((t, n) => i[e(t.progress)] - i[e(n.progress)]);
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
export { e as getProgressState, t as mergeFilesAndTransfers };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { nb as e } from "../../shared-strings/nb.js";
|
|
2
|
+
import { formatFileSize as t, parseFileSize as n } from "./size.js";
|
|
3
|
+
import { isFileAllowed as r, normalizeAllowedFormats as i } from "./formats.js";
|
|
4
|
+
//#region ../../shared-utils/fileupload/validation.ts
|
|
5
|
+
function a(e, t, n) {
|
|
6
|
+
return ((e ?? "").trim() || t).replace(/\{(\w+)\}/g, (e, t) => n[t] ?? `{${t}}`);
|
|
7
|
+
}
|
|
8
|
+
function o(o, s) {
|
|
9
|
+
let c = i(s.allowedFormats);
|
|
10
|
+
if (c.length > 0 && !r(o, c)) {
|
|
11
|
+
let t = c.join(", "), n = e.fileupload.invalidFormat;
|
|
12
|
+
return a(s.formatErrorMessage, n, { formats: t });
|
|
13
|
+
}
|
|
14
|
+
let l = n(s.maxFileSize);
|
|
15
|
+
if (l !== void 0 && o.size > l) {
|
|
16
|
+
let n = t(l), r = e.fileupload.sizeTooLarge;
|
|
17
|
+
return a(s.sizeErrorMessage, r, { maxSize: n });
|
|
18
|
+
}
|
|
19
|
+
if (s.onFileValidation) {
|
|
20
|
+
let e = s.onFileValidation(o);
|
|
21
|
+
if (e) return e;
|
|
22
|
+
}
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
function s(e) {
|
|
26
|
+
let t = e.file;
|
|
27
|
+
if (t?.type?.startsWith("image/")) return !0;
|
|
28
|
+
let n = e.attributes?.targetFilename || t?.name || "";
|
|
29
|
+
return /\.(jpe?g|png|gif|webp|heic|heif|bmp|svg)$/i.test(n);
|
|
30
|
+
}
|
|
31
|
+
//#endregion
|
|
32
|
+
export { a as applyErrorTemplate, s as isImageFileLike, o as validateFile };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
//#region ../../shared-utils/focus-trap/index.ts
|
|
2
|
+
function e(e) {
|
|
3
|
+
if (!e) return [];
|
|
4
|
+
let t = [
|
|
5
|
+
"a[href]:not([tabindex=\"-1\"])",
|
|
6
|
+
"button:not([disabled]):not([tabindex=\"-1\"])",
|
|
7
|
+
"input:not([disabled]):not([type=\"hidden\"]):not([tabindex=\"-1\"])",
|
|
8
|
+
"select:not([disabled]):not([tabindex=\"-1\"])",
|
|
9
|
+
"textarea:not([disabled]):not([tabindex=\"-1\"])",
|
|
10
|
+
"[tabindex]:not([tabindex=\"-1\"])"
|
|
11
|
+
].join(", ");
|
|
12
|
+
return Array.from(e.querySelectorAll(t)).filter((e) => !e.hasAttribute("inert"));
|
|
13
|
+
}
|
|
14
|
+
var t = [
|
|
15
|
+
"a[href]",
|
|
16
|
+
"button:not([disabled])",
|
|
17
|
+
"input:not([disabled]):not([type=\"hidden\"])",
|
|
18
|
+
"select:not([disabled])",
|
|
19
|
+
"textarea:not([disabled])",
|
|
20
|
+
"summary",
|
|
21
|
+
"[tabindex]:not([tabindex=\"-1\"])"
|
|
22
|
+
].join(", "), n = (e) => {
|
|
23
|
+
if (e.hasAttribute("inert") || e.closest("[inert]") || e.hidden || e.closest("[hidden]")) return !0;
|
|
24
|
+
let t = e;
|
|
25
|
+
for (; t;) {
|
|
26
|
+
let n = t.closest("details");
|
|
27
|
+
if (!n) break;
|
|
28
|
+
if (!n.hasAttribute("open")) {
|
|
29
|
+
let t = n.querySelector(":scope > summary");
|
|
30
|
+
if (!t || !t.contains(e)) return !0;
|
|
31
|
+
}
|
|
32
|
+
t = n.parentElement;
|
|
33
|
+
}
|
|
34
|
+
return !1;
|
|
35
|
+
}, r = (e, i) => {
|
|
36
|
+
e.matches(t) && !n(e) && i.push(e);
|
|
37
|
+
let a = e.shadowRoot;
|
|
38
|
+
if (a) for (let e of Array.from(a.children)) r(e, i);
|
|
39
|
+
for (let t of Array.from(e.children)) r(t, i);
|
|
40
|
+
};
|
|
41
|
+
function i(e) {
|
|
42
|
+
if (!e) return [];
|
|
43
|
+
let t = [];
|
|
44
|
+
for (let n of Array.from(e.children)) r(n, t);
|
|
45
|
+
return t;
|
|
46
|
+
}
|
|
47
|
+
function a(e = document) {
|
|
48
|
+
let t = e.activeElement;
|
|
49
|
+
for (; t?.shadowRoot?.activeElement;) t = t.shadowRoot.activeElement;
|
|
50
|
+
return t;
|
|
51
|
+
}
|
|
52
|
+
function o(t, n) {
|
|
53
|
+
if (t.key !== "Tab") return !1;
|
|
54
|
+
let r = e(n);
|
|
55
|
+
if (r.length === 0) return t.preventDefault(), !0;
|
|
56
|
+
let i = r[0], a = r[r.length - 1], o = (n?.ownerDocument ?? document).activeElement, s = !!o && r.includes(o);
|
|
57
|
+
return t.shiftKey ? !s || o === i ? (t.preventDefault(), a.focus(), !0) : !1 : !s || o === a ? (t.preventDefault(), i.focus(), !0) : !1;
|
|
58
|
+
}
|
|
59
|
+
//#endregion
|
|
60
|
+
export { a as getDeepActiveElement, e as getFocusableElements, i as getFocusableElementsDeep, o as trapTabInside };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
//#region ../../shared-utils/forms/described-by.ts
|
|
2
|
+
var e = (e) => {
|
|
3
|
+
let t = [];
|
|
4
|
+
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;
|
|
5
|
+
}, t = (e) => `${e}-counter-status`, n = (e, t) => !!t && t > 0 && (e ?? 0) > t;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { t as counterStatusId, e as describedByIds, n as isCounterExceeded };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//#region ../../shared-utils/header-footer/external-domain.ts
|
|
2
|
+
var e = /\.(?:co|com|org|net|gov|edu|ac|kommune)\.[a-z]{2}$/i;
|
|
3
|
+
function t(t) {
|
|
4
|
+
let n = t.toLowerCase().replace(/\.$/, ""), r = n.split(".");
|
|
5
|
+
return r.length <= 2 ? n : r.slice(e.test(n) ? -3 : -2).join(".");
|
|
6
|
+
}
|
|
7
|
+
function n(e) {
|
|
8
|
+
if (!e) return;
|
|
9
|
+
let n;
|
|
10
|
+
try {
|
|
11
|
+
n = new URL(e);
|
|
12
|
+
} catch {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
if (n.protocol === "http:" || n.protocol === "https:") return t(n.hostname.toLowerCase().replace(/\.$/, ""));
|
|
16
|
+
}
|
|
17
|
+
function r(e, n = "oslo.kommune.no") {
|
|
18
|
+
if (!e) return;
|
|
19
|
+
let r;
|
|
20
|
+
try {
|
|
21
|
+
r = new URL(e);
|
|
22
|
+
} catch {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
if (r.protocol !== "http:" && r.protocol !== "https:") return;
|
|
26
|
+
let i = r.hostname.toLowerCase().replace(/\.$/, ""), a = n.toLowerCase();
|
|
27
|
+
if (!(i === a || i.endsWith(`.${a}`))) return t(i);
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
export { r as getExternalDomainLabel, n as getLinkDomainLabel };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { DEFAULT_HEADER_FOOTER_URL as e } from "../../shared-types/header-footer.js";
|
|
2
|
+
//#region ../../shared-utils/header-footer/fetch-header-footer-data.ts
|
|
3
|
+
var t = /* @__PURE__ */ new Map();
|
|
4
|
+
async function n(e) {
|
|
5
|
+
let t = await fetch(e);
|
|
6
|
+
if (!t.ok) throw Error(`pkt-header-menu: failed to fetch ${e} (HTTP ${t.status})`);
|
|
7
|
+
let n = await t.json();
|
|
8
|
+
if (!n || typeof n != "object") throw Error(`pkt-header-menu: ${e} returned a non-object payload`);
|
|
9
|
+
return n;
|
|
10
|
+
}
|
|
11
|
+
function r(e, t) {
|
|
12
|
+
return t ? t.aborted ? Promise.reject(i(t.reason)) : new Promise((n, r) => {
|
|
13
|
+
let a = () => r(i(t.reason));
|
|
14
|
+
t.addEventListener("abort", a, { once: !0 }), e.then((e) => {
|
|
15
|
+
t.removeEventListener("abort", a), n(e);
|
|
16
|
+
}, (e) => {
|
|
17
|
+
t.removeEventListener("abort", a), r(e);
|
|
18
|
+
});
|
|
19
|
+
}) : e;
|
|
20
|
+
}
|
|
21
|
+
function i(e) {
|
|
22
|
+
return e instanceof Error ? e : new DOMException("The operation was aborted.", "AbortError");
|
|
23
|
+
}
|
|
24
|
+
async function a(i = e, a) {
|
|
25
|
+
let o = t.get(i);
|
|
26
|
+
return o || (o = n(i), o.catch(() => t.delete(i)), t.set(i, o)), r(o, a);
|
|
27
|
+
}
|
|
28
|
+
//#endregion
|
|
29
|
+
export { e as DEFAULT_HEADER_FOOTER_URL, a as fetchHeaderFooterData };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
//#region ../../shared-utils/header-footer/icon-map.ts
|
|
2
|
+
var e = {
|
|
3
|
+
automat: "parking-meter",
|
|
4
|
+
bike: "bicycle",
|
|
5
|
+
corona: "virus",
|
|
6
|
+
directions: "arrow-directions",
|
|
7
|
+
document: "document-plain",
|
|
8
|
+
"download-document": "document-download",
|
|
9
|
+
elcar: "electric-car",
|
|
10
|
+
"error-hexa": "alert-error",
|
|
11
|
+
"fire-emblem": "shield-fire",
|
|
12
|
+
"link-arrow": "arrow-link",
|
|
13
|
+
"linked-in": "linkedin",
|
|
14
|
+
"map-layer": "map-layers",
|
|
15
|
+
mobile: "mobile-phone",
|
|
16
|
+
neutral: "smiley-neutral",
|
|
17
|
+
placeholder: "placeholder-icon",
|
|
18
|
+
sad: "smiley-sad",
|
|
19
|
+
signing: "signature",
|
|
20
|
+
sky: "cloud",
|
|
21
|
+
smile: "smiley-smile",
|
|
22
|
+
"success-square": "alert-success",
|
|
23
|
+
trash: "trash-can",
|
|
24
|
+
treatment: "processing",
|
|
25
|
+
"warning-triangle": "alert-warning"
|
|
26
|
+
};
|
|
27
|
+
function t(t) {
|
|
28
|
+
return t && (e[t] ?? t);
|
|
29
|
+
}
|
|
30
|
+
var n = {
|
|
31
|
+
"facebook.com": "facebook",
|
|
32
|
+
"fb.com": "facebook",
|
|
33
|
+
"instagram.com": "instagram",
|
|
34
|
+
"linkedin.com": "linkedin",
|
|
35
|
+
"x.com": "x",
|
|
36
|
+
"github.com": "github"
|
|
37
|
+
};
|
|
38
|
+
function r(e) {
|
|
39
|
+
return e.toLowerCase().replace(/^(?:www|m)\./, "");
|
|
40
|
+
}
|
|
41
|
+
function i(e, i) {
|
|
42
|
+
if (e) try {
|
|
43
|
+
let t = n[r(new URL(e).hostname)];
|
|
44
|
+
if (t) return t;
|
|
45
|
+
} catch {}
|
|
46
|
+
if (i) {
|
|
47
|
+
let e = i.trim().toLowerCase().replace(/\s+/g, "-");
|
|
48
|
+
if (e) {
|
|
49
|
+
let n = t(e);
|
|
50
|
+
if (n) return n;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
//#endregion
|
|
55
|
+
export { e as ICON_MAP_ODS_TO_PUNKT, n as SOCIAL_HOSTNAME_TO_ICON, i as deriveSocialIcon, t as mapOdsIcon };
|