@oslokommune/punkt-react 19.15.5 → 19.16.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 +27 -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.d.ts +1 -1
- 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 -9394
- 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/helptext/Helptext.tsx +3 -4
- package/src/components/hydration.test.tsx +32 -0
- 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/inputwrapper/InputWrapper.tsx +3 -4
- package/src/components/link/Link.tsx +0 -2
- package/src/components/progressbar/Progressbar.test.tsx +8 -29
- package/src/components/progressbar/Progressbar.tsx +17 -12
- package/src/components/radio/RadioButton.tsx +2 -0
- package/src/components/searchinput/SearchInput.tsx +3 -4
- package/src/components/server-components.test.ts +69 -0
- package/src/components/ssr.test.tsx +3 -35
- 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/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,128 @@
|
|
|
1
|
+
import { PktIcon as e } from "../../icon/Icon.js";
|
|
2
|
+
import { formatString as t } from "../../../shared-strings/format.js";
|
|
3
|
+
import { PktButton as n } from "../../button/Button.js";
|
|
4
|
+
import { PktTextarea as r } from "../../textarea/Textarea.js";
|
|
5
|
+
import { PktFileUploadContext as i } from "../FileUploadContext.js";
|
|
6
|
+
import { useContext as a, useLayoutEffect as o, useRef as s } from "react";
|
|
7
|
+
import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
8
|
+
//#region src/components/fileupload/extensions/Comments.tsx
|
|
9
|
+
var d = "comments", f = (e, n) => {
|
|
10
|
+
let r = new Date(e);
|
|
11
|
+
if (Number.isNaN(r.getTime())) return e;
|
|
12
|
+
let i = String(r.getDate()).padStart(2, "0"), a = String(r.getMonth() + 1).padStart(2, "0"), o = r.getFullYear(), s = String(r.getHours()).padStart(2, "0"), c = String(r.getMinutes()).padStart(2, "0");
|
|
13
|
+
return t(n.commentTimestamp, {
|
|
14
|
+
date: `${i}.${a}.${o}`,
|
|
15
|
+
time: `${s}:${c}`
|
|
16
|
+
});
|
|
17
|
+
}, p = ({ fileItem: e, disabled: t, closeOperationUi: d, onAddComment: f, existingComment: p }) => {
|
|
18
|
+
let { strings: m } = a(i), h = s(null), g = !!p;
|
|
19
|
+
return o(() => {
|
|
20
|
+
let e = setTimeout(() => h.current?.focus({ preventScroll: !0 }), 0);
|
|
21
|
+
return () => clearTimeout(e);
|
|
22
|
+
}, [e.fileId]), /* @__PURE__ */ u(c, { children: [
|
|
23
|
+
/* @__PURE__ */ l(r, {
|
|
24
|
+
autoFocus: !0,
|
|
25
|
+
label: g ? m.editComment : m.addComment,
|
|
26
|
+
name: `comment-${e.fileId}`,
|
|
27
|
+
className: "pkt-fileupload__queue-display__item__comment-input",
|
|
28
|
+
placeholder: m.commentPlaceholder,
|
|
29
|
+
rows: 2,
|
|
30
|
+
id: `comment-${e.fileId}`,
|
|
31
|
+
ref: h,
|
|
32
|
+
disabled: t,
|
|
33
|
+
defaultValue: p?.text
|
|
34
|
+
}),
|
|
35
|
+
/* @__PURE__ */ l(n, {
|
|
36
|
+
skin: "secondary",
|
|
37
|
+
size: "small",
|
|
38
|
+
disabled: t,
|
|
39
|
+
onClick: () => {
|
|
40
|
+
let e = h.current?.value?.trim();
|
|
41
|
+
e && f({
|
|
42
|
+
text: e,
|
|
43
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
44
|
+
}), d();
|
|
45
|
+
},
|
|
46
|
+
children: g ? m.saveComment : m.addComment
|
|
47
|
+
}),
|
|
48
|
+
/* @__PURE__ */ l(n, {
|
|
49
|
+
skin: "tertiary",
|
|
50
|
+
size: "small",
|
|
51
|
+
disabled: t,
|
|
52
|
+
onClick: d,
|
|
53
|
+
children: m.cancel
|
|
54
|
+
})
|
|
55
|
+
] });
|
|
56
|
+
}, m = ({ comment: t, disabled: n, onDeleteComment: r, onEditComment: o }) => {
|
|
57
|
+
let { strings: s } = a(i);
|
|
58
|
+
return /* @__PURE__ */ l("div", {
|
|
59
|
+
className: "pkt-fileupload__queue-display__item__comments",
|
|
60
|
+
children: /* @__PURE__ */ u("div", {
|
|
61
|
+
className: "pkt-fileupload__queue-display__item__comment",
|
|
62
|
+
children: [/* @__PURE__ */ u("div", {
|
|
63
|
+
className: "pkt-fileupload__queue-display__item__comment__content",
|
|
64
|
+
children: [/* @__PURE__ */ l("span", {
|
|
65
|
+
className: "pkt-fileupload__queue-display__item__comment__text",
|
|
66
|
+
"aria-label": s.commentText,
|
|
67
|
+
children: t.text
|
|
68
|
+
}), /* @__PURE__ */ l("time", {
|
|
69
|
+
className: "pkt-fileupload__queue-display__item__comment__time",
|
|
70
|
+
children: f(t.timestamp, s)
|
|
71
|
+
})]
|
|
72
|
+
}), /* @__PURE__ */ u("div", {
|
|
73
|
+
className: "pkt-fileupload__queue-display__item__comment__actions",
|
|
74
|
+
children: [/* @__PURE__ */ l("button", {
|
|
75
|
+
type: "button",
|
|
76
|
+
className: "pkt-fileupload__queue-display__item__comment__action",
|
|
77
|
+
onClick: o,
|
|
78
|
+
disabled: n,
|
|
79
|
+
"aria-label": s.editComment,
|
|
80
|
+
children: /* @__PURE__ */ l(e, { name: "edit" })
|
|
81
|
+
}), /* @__PURE__ */ l("button", {
|
|
82
|
+
type: "button",
|
|
83
|
+
className: "pkt-fileupload__queue-display__item__comment__action",
|
|
84
|
+
onClick: r,
|
|
85
|
+
disabled: n,
|
|
86
|
+
"aria-label": s.deleteComment,
|
|
87
|
+
children: /* @__PURE__ */ l(e, { name: "trash-can" })
|
|
88
|
+
})]
|
|
89
|
+
})]
|
|
90
|
+
})
|
|
91
|
+
});
|
|
92
|
+
}, h = ({ comments: e }) => {
|
|
93
|
+
let t = a(i);
|
|
94
|
+
return /* @__PURE__ */ l("input", {
|
|
95
|
+
type: "hidden",
|
|
96
|
+
name: `${t.name}-comments`,
|
|
97
|
+
value: e ? JSON.stringify(e) : ""
|
|
98
|
+
});
|
|
99
|
+
}, g = (e) => e.getAttribute(d) ?? [], _ = (e) => ({
|
|
100
|
+
id: "comment",
|
|
101
|
+
title: (t) => (t.attributes?.[d] ?? []).length > 0 ? "" : e.addComment,
|
|
102
|
+
ariaLabel: e.addComment,
|
|
103
|
+
renderExtendedUI: (e) => {
|
|
104
|
+
let t = g(e)[0];
|
|
105
|
+
return /* @__PURE__ */ l(p, {
|
|
106
|
+
fileItem: e.file,
|
|
107
|
+
disabled: e.disabled,
|
|
108
|
+
closeOperationUi: e.close,
|
|
109
|
+
onAddComment: (t) => {
|
|
110
|
+
e.setAttribute(d, [t]);
|
|
111
|
+
},
|
|
112
|
+
existingComment: t
|
|
113
|
+
});
|
|
114
|
+
},
|
|
115
|
+
renderContent: (e) => {
|
|
116
|
+
if (e.isActive) return null;
|
|
117
|
+
let t = g(e)[0];
|
|
118
|
+
return t ? /* @__PURE__ */ l(m, {
|
|
119
|
+
comment: t,
|
|
120
|
+
disabled: e.disabled,
|
|
121
|
+
onEditComment: e.activate,
|
|
122
|
+
onDeleteComment: () => e.setAttribute(d, void 0)
|
|
123
|
+
}) : null;
|
|
124
|
+
},
|
|
125
|
+
renderHidden: (e) => /* @__PURE__ */ l(h, { comments: e.getAttribute(d) }, `comments${e.file.fileId}`)
|
|
126
|
+
});
|
|
127
|
+
//#endregion
|
|
128
|
+
export { _ as addCommentOperation };
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { PktButton as e } from "../../button/Button.js";
|
|
2
|
+
import { getDisplayFilename as t } from "../../../shared-utils/fileupload/filename.js";
|
|
3
|
+
import "../../../shared-utils/fileupload/index.js";
|
|
4
|
+
import { PktFileUploadContext as n } from "../FileUploadContext.js";
|
|
5
|
+
import { useContext as r, useId as i, useRef as a } from "react";
|
|
6
|
+
import { Fragment as o, jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
7
|
+
//#region src/components/fileupload/extensions/Rename.tsx
|
|
8
|
+
var l = ({ initialValue: t, disabled: l, onSave: u, onCancel: d }) => {
|
|
9
|
+
let { strings: f } = r(n), p = a(null), m = i(), h = () => u(p.current?.value ?? "");
|
|
10
|
+
return /* @__PURE__ */ c(o, { children: [
|
|
11
|
+
/* @__PURE__ */ s("label", {
|
|
12
|
+
htmlFor: m,
|
|
13
|
+
className: "pkt-sr-only",
|
|
14
|
+
children: f.renameInputLabel
|
|
15
|
+
}),
|
|
16
|
+
/* @__PURE__ */ s("input", {
|
|
17
|
+
id: m,
|
|
18
|
+
ref: p,
|
|
19
|
+
type: "text",
|
|
20
|
+
autoFocus: !0,
|
|
21
|
+
disabled: l,
|
|
22
|
+
defaultValue: t,
|
|
23
|
+
className: "pkt-fileupload__queue-display__item__rename-input",
|
|
24
|
+
onKeyDown: (e) => {
|
|
25
|
+
e.key === "Enter" && (e.preventDefault(), e.stopPropagation(), h()), e.key === "Escape" && (e.preventDefault(), e.stopPropagation(), d());
|
|
26
|
+
}
|
|
27
|
+
}),
|
|
28
|
+
/* @__PURE__ */ s(e, {
|
|
29
|
+
skin: "secondary",
|
|
30
|
+
size: "small",
|
|
31
|
+
disabled: l,
|
|
32
|
+
onClick: h,
|
|
33
|
+
children: f.save
|
|
34
|
+
}),
|
|
35
|
+
/* @__PURE__ */ s(e, {
|
|
36
|
+
skin: "tertiary",
|
|
37
|
+
size: "small",
|
|
38
|
+
disabled: l,
|
|
39
|
+
onClick: d,
|
|
40
|
+
children: f.cancel
|
|
41
|
+
})
|
|
42
|
+
] });
|
|
43
|
+
}, u = ({ targetFilename: e }) => {
|
|
44
|
+
let t = r(n);
|
|
45
|
+
return /* @__PURE__ */ s("input", {
|
|
46
|
+
type: "hidden",
|
|
47
|
+
name: `${t.name}-targetFilename`,
|
|
48
|
+
value: e
|
|
49
|
+
});
|
|
50
|
+
}, d = (e) => e.getAttribute("targetFilename") || t(e.file, ""), f = (e) => ({
|
|
51
|
+
id: "rename",
|
|
52
|
+
title: e.rename,
|
|
53
|
+
ariaLabel: e.renameFile,
|
|
54
|
+
renderInlineUI: (e) => /* @__PURE__ */ s(l, {
|
|
55
|
+
initialValue: d(e),
|
|
56
|
+
disabled: e.disabled,
|
|
57
|
+
onSave: (t) => {
|
|
58
|
+
let n = t.trim();
|
|
59
|
+
n && e.setAttribute("targetFilename", n), e.close();
|
|
60
|
+
},
|
|
61
|
+
onCancel: e.close
|
|
62
|
+
}),
|
|
63
|
+
renderHidden: (e) => /* @__PURE__ */ s(u, { targetFilename: d(e) }, `rename${e.file.fileId}`)
|
|
64
|
+
});
|
|
65
|
+
//#endregion
|
|
66
|
+
export { f as renameFileOperation };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { useCallback as e, useMemo as t } from "react";
|
|
2
|
+
//#region src/components/fileupload/hooks/useFileAttributes.ts
|
|
3
|
+
var n = (n, r) => {
|
|
4
|
+
let i = e((e, t) => n.find((t) => t.fileId === e)?.attributes?.[t], [n]), a = e((e, t, i) => {
|
|
5
|
+
let a = n.find((t) => t.fileId === e);
|
|
6
|
+
if (!a) return;
|
|
7
|
+
let o = {
|
|
8
|
+
...a.attributes,
|
|
9
|
+
[t]: i
|
|
10
|
+
};
|
|
11
|
+
i === void 0 && delete o[t], r(e, { attributes: o });
|
|
12
|
+
}, [r, n]);
|
|
13
|
+
return {
|
|
14
|
+
fileAttributes: t(() => (e) => ({
|
|
15
|
+
get: (t) => i(t, e),
|
|
16
|
+
set: (t, n) => a(t, e, n)
|
|
17
|
+
}), [i, a]),
|
|
18
|
+
buildAttributeAccessors: e((e) => ({
|
|
19
|
+
getAttribute: (t) => i(e, t),
|
|
20
|
+
setAttribute: (t, n) => a(e, t, n)
|
|
21
|
+
}), [i, a])
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
//#endregion
|
|
25
|
+
export { n as useFileAttributes };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { useEffect as e, useState as t } from "react";
|
|
2
|
+
//#region src/components/fileupload/hooks/useImageObjectUrl.ts
|
|
3
|
+
var n = (n) => {
|
|
4
|
+
let [r, i] = t(null);
|
|
5
|
+
return e(() => {
|
|
6
|
+
if (!n?.type.startsWith("image/")) return;
|
|
7
|
+
let e = URL.createObjectURL(n);
|
|
8
|
+
return i({
|
|
9
|
+
file: n,
|
|
10
|
+
url: e
|
|
11
|
+
}), () => URL.revokeObjectURL(e);
|
|
12
|
+
}, [n]), r && r.file === n ? r.url : null;
|
|
13
|
+
};
|
|
14
|
+
//#endregion
|
|
15
|
+
export { n as useImageObjectUrl };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { navigateCyclic as e } from "../../../shared-utils/fileupload/navigation.js";
|
|
2
|
+
import "../../../shared-utils/fileupload/index.js";
|
|
3
|
+
import { useCallback as t, useRef as n, useState as r } from "react";
|
|
4
|
+
//#region src/components/fileupload/hooks/useImagePreview.ts
|
|
5
|
+
var i = (i) => {
|
|
6
|
+
let [a, o] = r(!1), [s, c] = r(0), l = n(null);
|
|
7
|
+
return {
|
|
8
|
+
isOpen: a,
|
|
9
|
+
currentIndex: s,
|
|
10
|
+
modalRef: l,
|
|
11
|
+
open: t((e) => {
|
|
12
|
+
let t = i.findIndex((t) => t.fileId === e);
|
|
13
|
+
t >= 0 && (c(t), o(!0), l.current?.showModal());
|
|
14
|
+
}, [i]),
|
|
15
|
+
close: t(() => {
|
|
16
|
+
o(!1), l.current?.close();
|
|
17
|
+
}, []),
|
|
18
|
+
navigate: t((t) => {
|
|
19
|
+
i.length !== 0 && c((n) => e(n, t, i.length));
|
|
20
|
+
}, [i.length])
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
//#endregion
|
|
24
|
+
export { i as useImagePreview };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { useCallback as e, useState as t } from "react";
|
|
2
|
+
//#region src/components/fileupload/hooks/useOperationState.ts
|
|
3
|
+
var n = (n) => {
|
|
4
|
+
let [r, i] = t({}), [a, o] = t(n);
|
|
5
|
+
if (n !== a) {
|
|
6
|
+
o(n);
|
|
7
|
+
let e = new Set(n.map((e) => e.id)), t = Object.entries(r), a = t.filter(([, t]) => e.has(t));
|
|
8
|
+
a.length !== t.length && i(Object.fromEntries(a));
|
|
9
|
+
}
|
|
10
|
+
return {
|
|
11
|
+
getActivated: e((e) => {
|
|
12
|
+
let t = r[e];
|
|
13
|
+
if (t) return n.find((e) => e.id === t);
|
|
14
|
+
}, [r, n]),
|
|
15
|
+
activate: e((e, t) => {
|
|
16
|
+
i((n) => ({
|
|
17
|
+
...n,
|
|
18
|
+
[e]: t.id
|
|
19
|
+
}));
|
|
20
|
+
}, []),
|
|
21
|
+
close: e((e) => {
|
|
22
|
+
i((t) => {
|
|
23
|
+
if (!(e in t)) return t;
|
|
24
|
+
let n = { ...t };
|
|
25
|
+
return delete n[e], n;
|
|
26
|
+
});
|
|
27
|
+
}, [])
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
//#endregion
|
|
31
|
+
export { n as useOperationState };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { useEffect as e } from "react";
|
|
2
|
+
//#region src/components/fileupload/hooks/useRequiredFormValidation.ts
|
|
3
|
+
var t = (t, { uploadStrategy: n, required: r, currentFileCount: i, onMissingFiles: a }) => {
|
|
4
|
+
e(() => {
|
|
5
|
+
if (n !== "custom" || !r) return;
|
|
6
|
+
let e = t.current?.form;
|
|
7
|
+
if (!e) return;
|
|
8
|
+
let o = (e) => {
|
|
9
|
+
i > 0 || (e.preventDefault(), a());
|
|
10
|
+
};
|
|
11
|
+
return e.addEventListener("submit", o), () => {
|
|
12
|
+
e.removeEventListener("submit", o);
|
|
13
|
+
};
|
|
14
|
+
}, [
|
|
15
|
+
t,
|
|
16
|
+
n,
|
|
17
|
+
r,
|
|
18
|
+
i,
|
|
19
|
+
a
|
|
20
|
+
]);
|
|
21
|
+
};
|
|
22
|
+
//#endregion
|
|
23
|
+
export { t as useRequiredFormValidation };
|
|
@@ -27,7 +27,6 @@ export type TPktFileUploadContext = {
|
|
|
27
27
|
id?: string;
|
|
28
28
|
strings: TPktStrings['fileupload'];
|
|
29
29
|
};
|
|
30
|
-
export declare const PktFileUploadContext: import('react').Context<TPktFileUploadContext>;
|
|
31
30
|
/** The value type for `PktFileUpload` (`value` / `defaultValue`). */
|
|
32
31
|
export type TFileItemList = Array<FileItem>;
|
|
33
32
|
/** Transfer status for a file when using `uploadStrategy="custom"` — aliased from `shared-types`. */
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { uuidish as e } from "../../utils/stringutils.js";
|
|
2
|
+
//#region src/components/fileupload/types.ts
|
|
3
|
+
var t = class {
|
|
4
|
+
fileId;
|
|
5
|
+
file;
|
|
6
|
+
attributes;
|
|
7
|
+
constructor(t, n) {
|
|
8
|
+
this.fileId = n || e(), this.file = t, this.attributes = { targetFilename: t.name };
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
//#endregion
|
|
12
|
+
export { t as FileItem };
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../shared-types/footer.js";
|
|
3
|
+
import { PktIcon as e } from "../icon/Icon.js";
|
|
4
|
+
import { PktConsent as t } from "../consent/Consent.js";
|
|
5
|
+
import { getLinkDomainLabel as n } from "../../shared-utils/header-footer/external-domain.js";
|
|
6
|
+
import { FooterGlobal as r, useGlobalFooterData as i } from "./FooterGlobal.js";
|
|
7
|
+
import { useEffect as a, useMemo as o } from "react";
|
|
8
|
+
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
9
|
+
//#region src/components/footer/Footer.tsx
|
|
10
|
+
var l = ({ link: e, openLinksInNewTab: t }) => {
|
|
11
|
+
let r = e.openInNewTab || t, i = e.external ? n(e.href) : void 0;
|
|
12
|
+
return /* @__PURE__ */ s("li", { children: /* @__PURE__ */ c("a", {
|
|
13
|
+
href: e.href,
|
|
14
|
+
target: r ? "_blank" : "_self",
|
|
15
|
+
rel: r ? "noopener noreferrer" : void 0,
|
|
16
|
+
children: [e.text, i && /* @__PURE__ */ c("span", {
|
|
17
|
+
className: "pkt-footer__link-domain",
|
|
18
|
+
children: [
|
|
19
|
+
" (",
|
|
20
|
+
i,
|
|
21
|
+
")"
|
|
22
|
+
]
|
|
23
|
+
})]
|
|
24
|
+
}) });
|
|
25
|
+
}, u = ({ column: e, openLinksInNewTab: t }) => /* @__PURE__ */ c("section", { children: [
|
|
26
|
+
/* @__PURE__ */ s("h2", { children: e.title }),
|
|
27
|
+
e.text && /* @__PURE__ */ s("p", { children: e.text }),
|
|
28
|
+
!!e.links?.length && /* @__PURE__ */ s("ul", {
|
|
29
|
+
className: "pkt-footer__link-list",
|
|
30
|
+
children: e.links.map((e) => /* @__PURE__ */ s(l, {
|
|
31
|
+
link: e,
|
|
32
|
+
openLinksInNewTab: t
|
|
33
|
+
}, `${e.href}|${e.text}`))
|
|
34
|
+
})
|
|
35
|
+
] }), d = ({ columns: n, columnOne: l, columnTwo: d, personvernOgInfoLink: f, tilgjengelighetLink: p, socialLinks: m, skipGlobal: h = !1, data: g, dataUrl: _, locale: v = "nb-NO", openLinksInNewTab: y = !1, includeConsent: b = !1, hotjarId: x = null, googleAnalyticsId: S = null, devMode: C = !1, cookieDomain: w = null, cookieSecure: T = null, cookieExpiryDays: E = null, onToggleConsent: D, onDataError: O, className: k, ...A }) => {
|
|
36
|
+
a(() => {
|
|
37
|
+
(l || d) && console.warn("PktFooter: The \"columnOne\"/\"columnTwo\" props are deprecated and will be removed in a future version. Please use \"columns\" instead.");
|
|
38
|
+
}, [l, d]), a(() => {
|
|
39
|
+
(f || p) && console.warn("PktFooter: The \"personvernOgInfoLink\"/\"tilgjengelighetLink\" props are deprecated — the links now come from the global footer. Overridden values are rendered in the secondary footer.");
|
|
40
|
+
}, [f, p]), a(() => {
|
|
41
|
+
m && 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.");
|
|
42
|
+
}, [m]);
|
|
43
|
+
let j = i({
|
|
44
|
+
data: g,
|
|
45
|
+
dataUrl: _,
|
|
46
|
+
locale: v,
|
|
47
|
+
skipGlobal: h,
|
|
48
|
+
onDataError: O
|
|
49
|
+
}), M = o(() => {
|
|
50
|
+
let e = n?.length ? n : [l, d].filter(Boolean), t = [];
|
|
51
|
+
return f && f !== "https://www.oslo.kommune.no/personvern-og-informasjonskapsler/" && t.push({
|
|
52
|
+
text: "Personvern og informasjonskapsler",
|
|
53
|
+
href: f
|
|
54
|
+
}), p && p !== "https://www.oslo.kommune.no/tilgjengelighet/" && t.push({
|
|
55
|
+
text: "Tilgjengelighet",
|
|
56
|
+
href: p
|
|
57
|
+
}), t.length ? [...e, {
|
|
58
|
+
title: "Om nettstedet",
|
|
59
|
+
links: t
|
|
60
|
+
}] : e;
|
|
61
|
+
}, [
|
|
62
|
+
n,
|
|
63
|
+
l,
|
|
64
|
+
d,
|
|
65
|
+
f,
|
|
66
|
+
p
|
|
67
|
+
]), N = {
|
|
68
|
+
hotjarId: x,
|
|
69
|
+
googleAnalyticsId: S,
|
|
70
|
+
devMode: C,
|
|
71
|
+
cookieDomain: w,
|
|
72
|
+
cookieSecure: T,
|
|
73
|
+
cookieExpiryDays: E,
|
|
74
|
+
onToggleConsent: D
|
|
75
|
+
}, P = h && b, F = m?.filter((e) => e.language) ?? [], I = m?.filter((e) => e.iconName) ?? [], L = M.length > 0 || P || !!m?.length, R = [k, "pkt-footer"].filter(Boolean).join(" ");
|
|
76
|
+
return /* @__PURE__ */ c("footer", {
|
|
77
|
+
className: R,
|
|
78
|
+
...A,
|
|
79
|
+
children: [L && /* @__PURE__ */ s("div", {
|
|
80
|
+
className: "pkt-footer__band pkt-footer__band--secondary",
|
|
81
|
+
children: /* @__PURE__ */ c("div", {
|
|
82
|
+
className: "pkt-footer__inner",
|
|
83
|
+
children: [
|
|
84
|
+
M.length > 0 && /* @__PURE__ */ s("div", {
|
|
85
|
+
className: "pkt-footer__sections",
|
|
86
|
+
children: M.map((e) => /* @__PURE__ */ s(u, {
|
|
87
|
+
column: e,
|
|
88
|
+
openLinksInNewTab: y
|
|
89
|
+
}, e.title))
|
|
90
|
+
}),
|
|
91
|
+
P && /* @__PURE__ */ s("div", {
|
|
92
|
+
className: "pkt-footer__consent",
|
|
93
|
+
children: /* @__PURE__ */ s(t, {
|
|
94
|
+
triggerType: "footerlink",
|
|
95
|
+
...N
|
|
96
|
+
})
|
|
97
|
+
}),
|
|
98
|
+
!!m?.length && /* @__PURE__ */ c("div", {
|
|
99
|
+
className: "pkt-footer__bottom",
|
|
100
|
+
children: [/* @__PURE__ */ s("ul", {
|
|
101
|
+
className: "pkt-footer__bottom-links",
|
|
102
|
+
children: F.map((e) => /* @__PURE__ */ s("li", { children: /* @__PURE__ */ s("a", {
|
|
103
|
+
href: e.href,
|
|
104
|
+
"aria-label": `til ${e.language} versjon av nettsiden`,
|
|
105
|
+
target: e.openInNewTab || y ? "_blank" : "_self",
|
|
106
|
+
rel: e.openInNewTab || y ? "noopener noreferrer" : void 0,
|
|
107
|
+
children: e.language
|
|
108
|
+
}) }, `${e.href}|${e.language}`))
|
|
109
|
+
}), /* @__PURE__ */ s("ul", {
|
|
110
|
+
className: "pkt-footer__some",
|
|
111
|
+
children: I.map((t) => /* @__PURE__ */ s("li", { children: /* @__PURE__ */ s("a", {
|
|
112
|
+
className: "pkt-footer__some-link",
|
|
113
|
+
href: t.href,
|
|
114
|
+
"aria-label": `til ${t.iconName}`,
|
|
115
|
+
target: t.openInNewTab || y ? "_blank" : "_self",
|
|
116
|
+
rel: t.openInNewTab || y ? "noopener noreferrer" : void 0,
|
|
117
|
+
children: /* @__PURE__ */ s(e, {
|
|
118
|
+
className: "pkt-footer__some-icon",
|
|
119
|
+
name: t.iconName
|
|
120
|
+
})
|
|
121
|
+
}) }, `${t.href}|${t.iconName}`))
|
|
122
|
+
})]
|
|
123
|
+
})
|
|
124
|
+
]
|
|
125
|
+
})
|
|
126
|
+
}), j && /* @__PURE__ */ s(r, {
|
|
127
|
+
footer: j,
|
|
128
|
+
includeConsent: b,
|
|
129
|
+
consent: N
|
|
130
|
+
})]
|
|
131
|
+
});
|
|
132
|
+
};
|
|
133
|
+
//#endregion
|
|
134
|
+
export { d as PktFooter };
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { PktIcon as e } from "../icon/Icon.js";
|
|
3
|
+
import { PktConsent as t } from "../consent/Consent.js";
|
|
4
|
+
import { deriveSocialIcon as n } from "../../shared-utils/header-footer/icon-map.js";
|
|
5
|
+
import { selectLocaleData as r } from "../../shared-utils/header-footer/select-megamenu.js";
|
|
6
|
+
import { getExternalDomainLabel as i } from "../../shared-utils/header-footer/external-domain.js";
|
|
7
|
+
import { fetchHeaderFooterData as a } from "../../shared-utils/header-footer/fetch-header-footer-data.js";
|
|
8
|
+
import { useEffect as o, useMemo as s, useRef as c, useState as l } from "react";
|
|
9
|
+
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
10
|
+
//#region src/components/footer/FooterGlobal.tsx
|
|
11
|
+
var f = "#cb-trigger";
|
|
12
|
+
function p({ data: e, dataUrl: t, locale: n = "nb-NO", skipGlobal: i = !1, onDataError: u }) {
|
|
13
|
+
let [d, f] = l(), p = c(u);
|
|
14
|
+
p.current = u, o(() => {
|
|
15
|
+
if (e || i) return;
|
|
16
|
+
let n = new AbortController();
|
|
17
|
+
return a(t, n.signal).then((e) => {
|
|
18
|
+
n.signal.aborted || f(e);
|
|
19
|
+
}).catch((e) => {
|
|
20
|
+
e.name !== "AbortError" && (console.warn("Failed to fetch header/footer data:", e), p.current?.(e));
|
|
21
|
+
}), () => n.abort();
|
|
22
|
+
}, [
|
|
23
|
+
e,
|
|
24
|
+
t,
|
|
25
|
+
i
|
|
26
|
+
]);
|
|
27
|
+
let m = e ?? d;
|
|
28
|
+
return s(() => {
|
|
29
|
+
if (!i) return r(m, n)?.footer;
|
|
30
|
+
}, [
|
|
31
|
+
m,
|
|
32
|
+
n,
|
|
33
|
+
i
|
|
34
|
+
]);
|
|
35
|
+
}
|
|
36
|
+
var m = ({ link: e, includeConsent: n, consent: r }) => {
|
|
37
|
+
if (e.url === f) return n ? /* @__PURE__ */ u("li", { children: /* @__PURE__ */ u(t, {
|
|
38
|
+
triggerType: "footerlink",
|
|
39
|
+
triggerText: e.text,
|
|
40
|
+
...r
|
|
41
|
+
}) }) : null;
|
|
42
|
+
let a = i(e.url);
|
|
43
|
+
return /* @__PURE__ */ u("li", { children: /* @__PURE__ */ d("a", {
|
|
44
|
+
href: e.url,
|
|
45
|
+
children: [e.text, a && /* @__PURE__ */ d("span", {
|
|
46
|
+
className: "pkt-footer__link-domain",
|
|
47
|
+
children: [
|
|
48
|
+
" (",
|
|
49
|
+
a,
|
|
50
|
+
")"
|
|
51
|
+
]
|
|
52
|
+
})]
|
|
53
|
+
}) });
|
|
54
|
+
}, h = ({ section: e, includeConsent: t, consent: n }) => /* @__PURE__ */ d("section", { children: [/* @__PURE__ */ u("h2", { children: e.title }), /* @__PURE__ */ u("ul", {
|
|
55
|
+
className: "pkt-footer__link-list",
|
|
56
|
+
children: e.links.map((e) => /* @__PURE__ */ u(m, {
|
|
57
|
+
link: e,
|
|
58
|
+
includeConsent: t,
|
|
59
|
+
consent: n
|
|
60
|
+
}, `${e.url}|${e.text}`))
|
|
61
|
+
})] }), g = ({ entry: t }) => {
|
|
62
|
+
let r = n(t.url, t.text);
|
|
63
|
+
return r ? /* @__PURE__ */ u("li", { children: /* @__PURE__ */ u("a", {
|
|
64
|
+
className: "pkt-footer__some-link",
|
|
65
|
+
href: t.url,
|
|
66
|
+
"aria-label": t.text,
|
|
67
|
+
children: /* @__PURE__ */ u(e, {
|
|
68
|
+
className: "pkt-footer__some-icon",
|
|
69
|
+
name: r
|
|
70
|
+
})
|
|
71
|
+
}) }) : /* @__PURE__ */ u("li", { children: /* @__PURE__ */ u("a", {
|
|
72
|
+
href: t.url,
|
|
73
|
+
children: t.text
|
|
74
|
+
}) });
|
|
75
|
+
}, _ = ({ footer: e, includeConsent: t = !1, consent: n = {} }) => {
|
|
76
|
+
let r = e.links?.length > 0, i = e.some?.length > 0;
|
|
77
|
+
return /* @__PURE__ */ u("div", {
|
|
78
|
+
className: "pkt-footer__band pkt-footer__band--global",
|
|
79
|
+
children: /* @__PURE__ */ u("div", {
|
|
80
|
+
className: "pkt-footer__inner",
|
|
81
|
+
children: /* @__PURE__ */ d("div", {
|
|
82
|
+
className: "pkt-footer__sections",
|
|
83
|
+
children: [e.sections.map((e) => /* @__PURE__ */ u(h, {
|
|
84
|
+
section: e,
|
|
85
|
+
includeConsent: t,
|
|
86
|
+
consent: n
|
|
87
|
+
}, e.title)), (r || i) && /* @__PURE__ */ d("div", {
|
|
88
|
+
className: "pkt-footer__bottom",
|
|
89
|
+
children: [r && /* @__PURE__ */ u("ul", {
|
|
90
|
+
className: "pkt-footer__bottom-links",
|
|
91
|
+
children: e.links.map((e) => /* @__PURE__ */ u("li", { children: /* @__PURE__ */ u("a", {
|
|
92
|
+
href: e.url,
|
|
93
|
+
children: e.text
|
|
94
|
+
}) }, `${e.url}|${e.text}`))
|
|
95
|
+
}), i && /* @__PURE__ */ u("ul", {
|
|
96
|
+
className: "pkt-footer__some",
|
|
97
|
+
children: e.some.map((e) => /* @__PURE__ */ u(g, { entry: e }, `${e.url}|${e.text}`))
|
|
98
|
+
})]
|
|
99
|
+
})]
|
|
100
|
+
})
|
|
101
|
+
})
|
|
102
|
+
});
|
|
103
|
+
};
|
|
104
|
+
//#endregion
|
|
105
|
+
export { _ as FooterGlobal, p as useGlobalFooterData };
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../shared-types/footer.js";
|
|
3
|
+
import { PktIcon as e } from "../icon/Icon.js";
|
|
4
|
+
import { PktConsent as t } from "../consent/Consent.js";
|
|
5
|
+
import { getLinkDomainLabel as n } from "../../shared-utils/header-footer/external-domain.js";
|
|
6
|
+
import { FooterGlobal as r, useGlobalFooterData as i } from "../footer/FooterGlobal.js";
|
|
7
|
+
import { useEffect as a, useMemo as o } from "react";
|
|
8
|
+
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
9
|
+
//#region src/components/footerSimple/FooterSimple.tsx
|
|
10
|
+
var l = ({ link: t, openLinksInNewTab: r }) => {
|
|
11
|
+
let i = t.openInNewTab || r, a = t.external ? n(t.href) : void 0;
|
|
12
|
+
return /* @__PURE__ */ c("a", {
|
|
13
|
+
className: "pkt-footer-simple__link",
|
|
14
|
+
href: t.href,
|
|
15
|
+
target: i ? "_blank" : "_self",
|
|
16
|
+
rel: i ? "noopener noreferrer" : void 0,
|
|
17
|
+
children: [/* @__PURE__ */ s(e, {
|
|
18
|
+
className: "pkt-footer-simple__link-icon",
|
|
19
|
+
name: "arrow-link"
|
|
20
|
+
}), /* @__PURE__ */ c("span", { children: [t.text, a && /* @__PURE__ */ c("span", {
|
|
21
|
+
className: "pkt-footer-simple__link-domain",
|
|
22
|
+
children: [
|
|
23
|
+
" (",
|
|
24
|
+
a,
|
|
25
|
+
")"
|
|
26
|
+
]
|
|
27
|
+
})] })]
|
|
28
|
+
});
|
|
29
|
+
}, u = ({ links: e, personvernOgInfoLink: n, tilgjengelighetLink: u, skipGlobal: d = !1, data: f, dataUrl: p, locale: m = "nb-NO", openLinksInNewTab: h = !1, includeConsent: g = !1, hotjarId: _ = null, googleAnalyticsId: v = null, devMode: y = !1, cookieDomain: b = null, cookieSecure: x = null, cookieExpiryDays: S = null, onToggleConsent: C, onDataError: w, className: T, ...E }) => {
|
|
30
|
+
a(() => {
|
|
31
|
+
(n || u) && 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.");
|
|
32
|
+
}, [n, u]);
|
|
33
|
+
let D = i({
|
|
34
|
+
data: f,
|
|
35
|
+
dataUrl: p,
|
|
36
|
+
locale: m,
|
|
37
|
+
skipGlobal: d,
|
|
38
|
+
onDataError: w
|
|
39
|
+
}), O = o(() => {
|
|
40
|
+
let t = [];
|
|
41
|
+
return n && n !== "https://www.oslo.kommune.no/personvern-og-informasjonskapsler/" && t.push({
|
|
42
|
+
text: "Personvern og informasjonskapsler",
|
|
43
|
+
href: n
|
|
44
|
+
}), u && u !== "https://www.oslo.kommune.no/tilgjengelighet/" && t.push({
|
|
45
|
+
text: "Tilgjengelighet",
|
|
46
|
+
href: u
|
|
47
|
+
}), [...e ?? [], ...t];
|
|
48
|
+
}, [
|
|
49
|
+
e,
|
|
50
|
+
n,
|
|
51
|
+
u
|
|
52
|
+
]), k = {
|
|
53
|
+
hotjarId: _,
|
|
54
|
+
googleAnalyticsId: v,
|
|
55
|
+
devMode: y,
|
|
56
|
+
cookieDomain: b,
|
|
57
|
+
cookieSecure: x,
|
|
58
|
+
cookieExpiryDays: S,
|
|
59
|
+
onToggleConsent: C
|
|
60
|
+
}, A = d && g, j = O.length > 0 || A, M = [T, "pkt-footer-simple"].filter(Boolean).join(" ");
|
|
61
|
+
return /* @__PURE__ */ c("footer", {
|
|
62
|
+
className: M,
|
|
63
|
+
...E,
|
|
64
|
+
children: [j && /* @__PURE__ */ s("div", {
|
|
65
|
+
className: "pkt-footer__band pkt-footer__band--secondary",
|
|
66
|
+
children: /* @__PURE__ */ s("div", {
|
|
67
|
+
className: "pkt-footer__inner pkt-footer__inner--compact",
|
|
68
|
+
children: /* @__PURE__ */ c("ul", {
|
|
69
|
+
className: "pkt-footer-simple__list",
|
|
70
|
+
children: [O.map((e) => /* @__PURE__ */ s("li", { children: /* @__PURE__ */ s(l, {
|
|
71
|
+
link: e,
|
|
72
|
+
openLinksInNewTab: h
|
|
73
|
+
}) }, `${e.href}|${e.text}`)), A && /* @__PURE__ */ s("li", { children: /* @__PURE__ */ s(t, {
|
|
74
|
+
triggerType: "footerlink",
|
|
75
|
+
...k
|
|
76
|
+
}) })]
|
|
77
|
+
})
|
|
78
|
+
})
|
|
79
|
+
}), D && /* @__PURE__ */ s(r, {
|
|
80
|
+
footer: D,
|
|
81
|
+
includeConsent: g,
|
|
82
|
+
consent: k
|
|
83
|
+
})]
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
//#endregion
|
|
87
|
+
export { u as PktFooterSimple };
|