@oslokommune/punkt-react 20.0.4 → 20.1.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 +13 -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 +35 -35
- 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/button.d.ts +13 -0
- package/dist/shared-types/button.js +14 -0
- 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/index.d.ts +1 -1
- package/dist/shared-types/index.js +11 -10
- 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/button/Button.tsx +11 -11
- package/src/components/tag/Tag.tsx +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
var n = () =>
|
|
1
|
+
import { isIOS as e } from "./device-utils.js";
|
|
2
|
+
import { isValidDateRange as t } from "./date-utils.js";
|
|
3
|
+
// ../../shared-utils/datepicker-utils.ts
|
|
4
|
+
var n = () => e() ? "text" : "date", r = (e) => !e || e.length !== 2 || t(e[0], e[1]), i = (e, t, n, r, i, a, o = "medium") => ({
|
|
5
5
|
"pkt-input": !0,
|
|
6
6
|
"pkt-datepicker__input": !0,
|
|
7
7
|
[`pkt-input--${o}`]: !0,
|
|
@@ -28,5 +28,4 @@ var n = () => t() ? "text" : "date", r = (t) => !t || t.length !== 2 || e(t[0],
|
|
|
28
28
|
let { key: o } = e;
|
|
29
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
30
|
};
|
|
31
|
-
//#endregion
|
|
32
31
|
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 };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
// ../../shared-utils/device-utils.ts
|
|
2
2
|
var e = () => {
|
|
3
3
|
let e = navigator.userAgent;
|
|
4
4
|
return !!(/iP(hone|od|ad)/.test(e) || /Macintosh/.test(e) && "ontouchend" in document);
|
|
5
5
|
};
|
|
6
|
-
//#endregion
|
|
7
6
|
export { e as isIOS };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// ../../shared-utils/fileupload/announcements.ts
|
|
2
2
|
function e(e, t) {
|
|
3
3
|
let n = e.length;
|
|
4
4
|
if (n === 0 || !t || t.length === 0) return {
|
|
@@ -17,5 +17,4 @@ function e(e, t) {
|
|
|
17
17
|
failedCount: i
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
|
-
//#endregion
|
|
21
20
|
export { e as countFileTransferStates };
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { nb as e } from "../../shared-strings/nb.js";
|
|
2
|
-
|
|
2
|
+
// ../../shared-utils/fileupload/filename.ts
|
|
3
3
|
var t = ".jpeg, .jpg, .png, .gif, .webp, .heic";
|
|
4
4
|
function n(t, n = e.fileupload.unknownFilename) {
|
|
5
5
|
return t.attributes?.targetFilename || t.file?.name || n;
|
|
6
6
|
}
|
|
7
|
-
//#endregion
|
|
8
7
|
export { t as THUMBNAIL_ACCEPT, n as getDisplayFilename };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// ../../shared-utils/fileupload/formats.ts
|
|
2
2
|
function e(e) {
|
|
3
3
|
return Array.isArray(e) ? e.map((e) => String(e).trim().toLowerCase()).filter(Boolean) : [];
|
|
4
4
|
}
|
|
@@ -25,5 +25,4 @@ function r(t, n) {
|
|
|
25
25
|
let i = e(n);
|
|
26
26
|
return i.length === 0 ? "" : i.map((e) => e.includes("/") || e.startsWith(".") ? e : `.${e}`).join(", ");
|
|
27
27
|
}
|
|
28
|
-
//#endregion
|
|
29
28
|
export { n as isFileAllowed, t as matchesAllowedFormat, e as normalizeAllowedFormats, r as resolveAcceptAttribute };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// ../../shared-utils/fileupload/size.ts
|
|
2
2
|
function e(e) {
|
|
3
3
|
if (e == null || e === "") return;
|
|
4
4
|
if (typeof e == "number") return Number.isFinite(e) && e > 0 ? e : void 0;
|
|
@@ -21,5 +21,4 @@ function e(e) {
|
|
|
21
21
|
function t(e) {
|
|
22
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
23
|
}
|
|
24
|
-
//#endregion
|
|
25
24
|
export { t as formatFileSize, e as parseFileSize };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// ../../shared-utils/fileupload/transfers.ts
|
|
2
2
|
function e(e) {
|
|
3
3
|
return typeof e == "number" ? "in-progress" : e === "error" ? "error" : "idle";
|
|
4
4
|
}
|
|
@@ -19,5 +19,4 @@ function t(t, n, r) {
|
|
|
19
19
|
};
|
|
20
20
|
}).sort((t, n) => i[e(t.progress)] - i[e(n.progress)]);
|
|
21
21
|
}
|
|
22
|
-
//#endregion
|
|
23
22
|
export { e as getProgressState, t as mergeFilesAndTransfers };
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
// ../../shared-utils/fileupload/truncate.ts
|
|
2
2
|
function e(e, t) {
|
|
3
3
|
return !t || t <= 0 || e.length <= t + 3 ? null : {
|
|
4
4
|
head: e.slice(0, e.length - t),
|
|
5
5
|
tail: e.slice(-t)
|
|
6
6
|
};
|
|
7
7
|
}
|
|
8
|
-
//#endregion
|
|
9
8
|
export { e as splitFilenameForTruncation };
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { nb as e } from "../../shared-strings/nb.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
2
|
+
import { isFileAllowed as t, normalizeAllowedFormats as n } from "./formats.js";
|
|
3
|
+
import { formatFileSize as r, parseFileSize as i } from "./size.js";
|
|
4
|
+
// ../../shared-utils/fileupload/validation.ts
|
|
5
5
|
function a(e, t, n) {
|
|
6
6
|
return ((e ?? "").trim() || t).replace(/\{(\w+)\}/g, (e, t) => n[t] ?? `{${t}}`);
|
|
7
7
|
}
|
|
8
8
|
function o(o, s) {
|
|
9
|
-
let c =
|
|
10
|
-
if (c.length > 0 && !
|
|
9
|
+
let c = n(s.allowedFormats);
|
|
10
|
+
if (c.length > 0 && !t(o, c)) {
|
|
11
11
|
let t = c.join(", "), n = e.fileupload.invalidFormat;
|
|
12
12
|
return a(s.formatErrorMessage, n, { formats: t });
|
|
13
13
|
}
|
|
14
|
-
let l =
|
|
14
|
+
let l = i(s.maxFileSize);
|
|
15
15
|
if (l !== void 0 && o.size > l) {
|
|
16
|
-
let
|
|
17
|
-
return a(s.sizeErrorMessage,
|
|
16
|
+
let t = r(l), n = e.fileupload.sizeTooLarge;
|
|
17
|
+
return a(s.sizeErrorMessage, n, { maxSize: t });
|
|
18
18
|
}
|
|
19
19
|
if (s.onFileValidation) {
|
|
20
20
|
let e = s.onFileValidation(o);
|
|
@@ -28,5 +28,4 @@ function s(e) {
|
|
|
28
28
|
let n = e.attributes?.targetFilename || t?.name || "";
|
|
29
29
|
return /\.(jpe?g|png|gif|webp|heic|heif|bmp|svg)$/i.test(n);
|
|
30
30
|
}
|
|
31
|
-
//#endregion
|
|
32
31
|
export { a as applyErrorTemplate, s as isImageFileLike, o as validateFile };
|
|
@@ -1,25 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
// ../../shared-utils/focus-trap/index.ts
|
|
2
2
|
function e(e) {
|
|
3
|
-
|
|
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"));
|
|
3
|
+
return e ? Array.from(e.querySelectorAll("a[href]:not([tabindex=\"-1\"]), button:not([disabled]):not([tabindex=\"-1\"]), input:not([disabled]):not([type=\"hidden\"]):not([tabindex=\"-1\"]), select:not([disabled]):not([tabindex=\"-1\"]), textarea:not([disabled]):not([tabindex=\"-1\"]), [tabindex]:not([tabindex=\"-1\"])")).filter((e) => !e.hasAttribute("inert")) : [];
|
|
13
4
|
}
|
|
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) => {
|
|
5
|
+
var t = (e) => {
|
|
23
6
|
if (e.hasAttribute("inert") || e.closest("[inert]") || e.hidden || e.closest("[hidden]")) return !0;
|
|
24
7
|
let t = e;
|
|
25
8
|
for (; t;) {
|
|
@@ -32,29 +15,28 @@ var t = [
|
|
|
32
15
|
t = n.parentElement;
|
|
33
16
|
}
|
|
34
17
|
return !1;
|
|
35
|
-
},
|
|
36
|
-
e.matches(
|
|
37
|
-
let
|
|
38
|
-
if (
|
|
39
|
-
for (let t of Array.from(e.children))
|
|
18
|
+
}, n = (e, r) => {
|
|
19
|
+
e.matches("a[href], button:not([disabled]), input:not([disabled]):not([type=\"hidden\"]), select:not([disabled]), textarea:not([disabled]), summary, [tabindex]:not([tabindex=\"-1\"])") && !t(e) && r.push(e);
|
|
20
|
+
let i = e.shadowRoot;
|
|
21
|
+
if (i) for (let e of Array.from(i.children)) n(e, r);
|
|
22
|
+
for (let t of Array.from(e.children)) n(t, r);
|
|
40
23
|
};
|
|
41
|
-
function
|
|
24
|
+
function r(e) {
|
|
42
25
|
if (!e) return [];
|
|
43
26
|
let t = [];
|
|
44
|
-
for (let
|
|
27
|
+
for (let r of Array.from(e.children)) n(r, t);
|
|
45
28
|
return t;
|
|
46
29
|
}
|
|
47
|
-
function
|
|
30
|
+
function i(e = document) {
|
|
48
31
|
let t = e.activeElement;
|
|
49
32
|
for (; t?.shadowRoot?.activeElement;) t = t.shadowRoot.activeElement;
|
|
50
33
|
return t;
|
|
51
34
|
}
|
|
52
|
-
function
|
|
35
|
+
function a(t, n) {
|
|
53
36
|
if (t.key !== "Tab") return !1;
|
|
54
37
|
let r = e(n);
|
|
55
38
|
if (r.length === 0) return t.preventDefault(), !0;
|
|
56
39
|
let i = r[0], a = r[r.length - 1], o = (n?.ownerDocument ?? document).activeElement, s = !!o && r.includes(o);
|
|
57
40
|
return t.shiftKey ? !s || o === i ? (t.preventDefault(), a.focus(), !0) : !1 : !s || o === a ? (t.preventDefault(), i.focus(), !0) : !1;
|
|
58
41
|
}
|
|
59
|
-
|
|
60
|
-
export { a as getDeepActiveElement, e as getFocusableElements, i as getFocusableElementsDeep, o as trapTabInside };
|
|
42
|
+
export { i as getDeepActiveElement, e as getFocusableElements, r as getFocusableElementsDeep, a as trapTabInside };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
// ../../shared-utils/forms/described-by.ts
|
|
2
2
|
var e = (e) => {
|
|
3
3
|
let t = [];
|
|
4
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
5
|
}, t = (e) => `${e}-counter-status`, n = (e, t) => !!t && t > 0 && (e ?? 0) > t;
|
|
6
|
-
//#endregion
|
|
7
6
|
export { t as counterStatusId, e as describedByIds, n as isCounterExceeded };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// ../../shared-utils/header-footer/external-domain.ts
|
|
2
2
|
var e = /\.(?:co|com|org|net|gov|edu|ac|kommune)\.[a-z]{2}$/i;
|
|
3
3
|
function t(t) {
|
|
4
4
|
let n = t.toLowerCase().replace(/\.$/, ""), r = n.split(".");
|
|
@@ -26,5 +26,4 @@ function r(e, n = "oslo.kommune.no") {
|
|
|
26
26
|
let i = r.hostname.toLowerCase().replace(/\.$/, ""), a = n.toLowerCase();
|
|
27
27
|
if (!(i === a || i.endsWith(`.${a}`))) return t(i);
|
|
28
28
|
}
|
|
29
|
-
//#endregion
|
|
30
29
|
export { r as getExternalDomainLabel, n as getLinkDomainLabel };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DEFAULT_HEADER_FOOTER_URL as e } from "../../shared-types/header-footer.js";
|
|
2
|
-
|
|
2
|
+
// ../../shared-utils/header-footer/fetch-header-footer-data.ts
|
|
3
3
|
var t = /* @__PURE__ */ new Map();
|
|
4
4
|
async function n(e) {
|
|
5
5
|
let t = await fetch(e);
|
|
@@ -25,5 +25,4 @@ async function a(i = e, a) {
|
|
|
25
25
|
let o = t.get(i);
|
|
26
26
|
return o || (o = n(i), o.catch(() => t.delete(i)), t.set(i, o)), r(o, a);
|
|
27
27
|
}
|
|
28
|
-
//#endregion
|
|
29
28
|
export { e as DEFAULT_HEADER_FOOTER_URL, a as fetchHeaderFooterData };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// ../../shared-utils/header-footer/icon-map.ts
|
|
2
2
|
var e = {
|
|
3
3
|
automat: "parking-meter",
|
|
4
4
|
bike: "bicycle",
|
|
@@ -51,5 +51,4 @@ function i(e, i) {
|
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
|
-
//#endregion
|
|
55
54
|
export { e as ICON_MAP_ODS_TO_PUNKT, n as SOCIAL_HOSTNAME_TO_ICON, i as deriveSocialIcon, t as mapOdsIcon };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// ../../shared-utils/scroll-lock/index.ts
|
|
2
2
|
var e = "is-scroll-locked", t = 0, n = 0, r = () => typeof document < "u" && typeof window < "u", i = () => {
|
|
3
3
|
let t = document.body, r = document.documentElement;
|
|
4
4
|
n = window.scrollY || window.pageYOffset;
|
|
@@ -17,5 +17,4 @@ var e = "is-scroll-locked", t = 0, n = 0, r = () => typeof document < "u" && typ
|
|
|
17
17
|
}, c = () => ({ locked: !1 }), l = (e, t) => {
|
|
18
18
|
e.locked !== t && (e.locked = t, t ? o() : s());
|
|
19
19
|
};
|
|
20
|
-
//#endregion
|
|
21
20
|
export { c as createScrollLockToken, l as setScrollLock };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// ../../shared-utils/timepicker/options.ts
|
|
2
2
|
var e = (e) => e ? Math.max(1, Math.round(e / 60)) : 1, t = (e, t) => {
|
|
3
3
|
let n = e ? parseInt(String(e).split(":")[0], 10) : 0, r = t ? parseInt(String(t).split(":")[0], 10) : 23;
|
|
4
4
|
return Array.from({ length: r - n + 1 }, (e, t) => t + n);
|
|
@@ -6,5 +6,4 @@ var e = (e) => e ? Math.max(1, Math.round(e / 60)) : 1, t = (e, t) => {
|
|
|
6
6
|
let n = e(t);
|
|
7
7
|
return Array.from({ length: Math.floor(60 / n) }, (e, t) => t * n);
|
|
8
8
|
};
|
|
9
|
-
//#endregion
|
|
10
9
|
export { t as getHourOptions, n as getMinuteOptions, e as getMinuteStep };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// ../../shared-utils/timepicker/stepper.ts
|
|
2
2
|
var e = (e, t, n, r) => {
|
|
3
3
|
let i = e === "" ? n === 1 ? 0 : 23 : parseInt(e, 10), a = t === "" ? n === 1 ? 0 : Math.floor(59 / r) * r : parseInt(t, 10);
|
|
4
4
|
return a += n * r, a > 59 ? (a = 0, i = (i + 1) % 24) : a < 0 && (a = Math.floor(59 / r) * r, i = (i - 1 + 24) % 24), {
|
|
@@ -6,5 +6,4 @@ var e = (e, t, n, r) => {
|
|
|
6
6
|
minutes: String(a).padStart(2, "0")
|
|
7
7
|
};
|
|
8
8
|
};
|
|
9
|
-
//#endregion
|
|
10
9
|
export { e as stepTime };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
// ../../shared-utils/timepicker/time-utils.ts
|
|
2
2
|
var e = (e) => /^\d{2}:\d{2}$/.test(e) && parseInt(e.slice(0, 2), 10) <= 23 && parseInt(e.slice(3), 10) <= 59, t = (e) => {
|
|
3
3
|
let [t, n] = e.split(":").map(Number);
|
|
4
4
|
return t * 60 + n;
|
|
5
5
|
};
|
|
6
|
-
//#endregion
|
|
7
6
|
export { e as isValidTimeString, t as timeToMinutes };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// ../../shared-utils/value-utils.ts
|
|
2
2
|
var e = (e) => {
|
|
3
3
|
if (!e) return [];
|
|
4
4
|
if (Array.isArray(e)) return e.filter(Boolean);
|
|
@@ -8,5 +8,4 @@ var e = (e) => {
|
|
|
8
8
|
} catch {}
|
|
9
9
|
return String(e).split(",").map((e) => e.trim()).filter(Boolean);
|
|
10
10
|
};
|
|
11
|
-
//#endregion
|
|
12
11
|
export { e as valueToArray };
|
package/dist/utils/stableKeys.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/utils/stableKeys.ts
|
|
2
2
|
var e = (e, t) => {
|
|
3
3
|
let n = /* @__PURE__ */ new Map();
|
|
4
4
|
return e.map((e) => {
|
|
@@ -9,5 +9,4 @@ var e = (e, t) => {
|
|
|
9
9
|
};
|
|
10
10
|
});
|
|
11
11
|
}, t = (e) => typeof e == "string" ? e : "";
|
|
12
|
-
//#endregion
|
|
13
12
|
export { t as textKey, e as withStableKeys };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
// src/utils/stringutils.ts
|
|
2
2
|
var e = () => ("00000000000000000" + (Math.random() * 0x10000000000000000).toString(16)).slice(-16), t = () => {
|
|
3
3
|
let t = e(), n = e();
|
|
4
4
|
return t.slice(0, 8) + "-" + t.slice(8, 12) + "-4" + t.slice(13) + "-a" + n.slice(1, 4) + "-" + n.slice(4);
|
|
5
5
|
};
|
|
6
|
-
//#endregion
|
|
7
6
|
export { t as uuidish };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oslokommune/punkt-react",
|
|
3
|
-
"version": "20.0
|
|
3
|
+
"version": "20.1.0",
|
|
4
4
|
"description": "React komponentbibliotek til Punkt, designsystem for Oslo kommune",
|
|
5
5
|
"homepage": "https://punkt.oslo.kommune.no",
|
|
6
6
|
"author": "Team Designsystem, Oslo kommune",
|
|
@@ -37,39 +37,38 @@
|
|
|
37
37
|
"prepack": "npm run build"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@
|
|
41
|
-
"@eslint-react/eslint-plugin": "^5.9.0",
|
|
40
|
+
"@eslint-react/eslint-plugin": "^5.28.8",
|
|
42
41
|
"@eslint/compat": "^2.1.0",
|
|
43
42
|
"@eslint/eslintrc": "^3.3.5",
|
|
44
43
|
"@eslint/js": "^10.0.1",
|
|
45
|
-
"@oslokommune/punkt-assets": "^20.0.
|
|
46
|
-
"@oslokommune/punkt-css": "^20.0.
|
|
44
|
+
"@oslokommune/punkt-assets": "^20.0.5",
|
|
45
|
+
"@oslokommune/punkt-css": "^20.0.5",
|
|
47
46
|
"@testing-library/jest-dom": "^7.0.1",
|
|
48
|
-
"@testing-library/react": "^16.3.
|
|
49
|
-
"@testing-library/user-event": "^14.6.
|
|
47
|
+
"@testing-library/react": "^16.3.3",
|
|
48
|
+
"@testing-library/user-event": "^14.6.8",
|
|
50
49
|
"@types/jest-axe": "^3.5.9",
|
|
51
|
-
"@types/node": "^
|
|
50
|
+
"@types/node": "^26.6.6",
|
|
52
51
|
"@types/react": "^19.2.17",
|
|
53
52
|
"@types/react-dom": "^19.2.3",
|
|
54
|
-
"@vitejs/plugin-react": "^6.0
|
|
53
|
+
"@vitejs/plugin-react": "^6.3.0",
|
|
55
54
|
"classnames": "^2.5.1",
|
|
56
|
-
"eslint": "^10.
|
|
55
|
+
"eslint": "^10.14.0",
|
|
57
56
|
"eslint-config-prettier": "^10.1.8",
|
|
58
|
-
"eslint-plugin-prettier": "^5.5.
|
|
57
|
+
"eslint-plugin-prettier": "^5.5.7",
|
|
59
58
|
"eslint-plugin-react-hooks": "^7.1.1",
|
|
60
|
-
"eslint-plugin-simple-import-sort": "^
|
|
61
|
-
"globals": "^17.
|
|
59
|
+
"eslint-plugin-simple-import-sort": "^14.0.0",
|
|
60
|
+
"globals": "^17.14.0",
|
|
62
61
|
"jest-axe": "^11.0.0",
|
|
63
|
-
"jsdom": "^
|
|
64
|
-
"prettier": "^3.
|
|
65
|
-
"react-hook-form": "^7.
|
|
66
|
-
"react-router-dom": "^7.18.
|
|
67
|
-
"sass": "^1.
|
|
62
|
+
"jsdom": "^31.0.0",
|
|
63
|
+
"prettier": "^3.9.10",
|
|
64
|
+
"react-hook-form": "^7.91.0",
|
|
65
|
+
"react-router-dom": "^7.18.5",
|
|
66
|
+
"sass": "^1.108.1",
|
|
68
67
|
"typescript": "^7.0.2",
|
|
69
68
|
"typescript-eslint": "^8.61.1",
|
|
70
|
-
"vite": "^8.
|
|
69
|
+
"vite": "^8.3.6",
|
|
71
70
|
"vite-plugin-dts": "^5.0.2",
|
|
72
|
-
"vitest": "^
|
|
71
|
+
"vitest": "^5.1.0"
|
|
73
72
|
},
|
|
74
73
|
"peerDependencies": {
|
|
75
74
|
"@oslokommune/punkt-assets": "*",
|
|
@@ -103,5 +102,5 @@
|
|
|
103
102
|
"url": "https://github.com/oslokommune/punkt/issues"
|
|
104
103
|
},
|
|
105
104
|
"license": "MIT",
|
|
106
|
-
"gitHead": "
|
|
105
|
+
"gitHead": "325fe848095a16e10dcc919ca113f003f44e3e30"
|
|
107
106
|
}
|
|
@@ -231,7 +231,7 @@ describe('PktAccordionItem', () => {
|
|
|
231
231
|
expect(details).toHaveAttribute('open')
|
|
232
232
|
})
|
|
233
233
|
|
|
234
|
-
test('calls onClick handler', () => {
|
|
234
|
+
test('calls onClick handler', async () => {
|
|
235
235
|
const mockOnClick = vi.fn()
|
|
236
236
|
const { container } = render(
|
|
237
237
|
<PktAccordionItem title="Title" id="item1" onClick={mockOnClick}>
|
|
@@ -243,9 +243,7 @@ describe('PktAccordionItem', () => {
|
|
|
243
243
|
fireEvent.click(details)
|
|
244
244
|
|
|
245
245
|
// onClick is called after a setTimeout, so we need to wait
|
|
246
|
-
|
|
247
|
-
expect(mockOnClick).toHaveBeenCalledTimes(1)
|
|
248
|
-
}, 10)
|
|
246
|
+
await waitFor(() => expect(mockOnClick).toHaveBeenCalledTimes(1))
|
|
249
247
|
})
|
|
250
248
|
|
|
251
249
|
test('forwards ref correctly', () => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { type ButtonHTMLAttributes, ForwardedRef, forwardRef } from 'react'
|
|
3
|
-
import { ANIMATION_DEFAULT_PATH, type IPktButtonBase } from 'shared-types'
|
|
3
|
+
import { ANIMATION_DEFAULT_PATH, BUTTON_DEFAULTS, type IPktButtonBase } from 'shared-types'
|
|
4
4
|
|
|
5
5
|
import { PktIcon } from '../icon/Icon'
|
|
6
6
|
declare global {
|
|
@@ -23,20 +23,20 @@ export const PktButton = forwardRef(
|
|
|
23
23
|
{
|
|
24
24
|
children,
|
|
25
25
|
className,
|
|
26
|
-
iconName =
|
|
27
|
-
secondIconName =
|
|
26
|
+
iconName = BUTTON_DEFAULTS.iconName,
|
|
27
|
+
secondIconName = BUTTON_DEFAULTS.secondIconName,
|
|
28
28
|
iconPath,
|
|
29
29
|
secondIconPath,
|
|
30
|
-
size =
|
|
31
|
-
fullWidth =
|
|
32
|
-
fullWidthOnMobile =
|
|
33
|
-
skin =
|
|
34
|
-
type =
|
|
35
|
-
variant =
|
|
30
|
+
size = BUTTON_DEFAULTS.size,
|
|
31
|
+
fullWidth = BUTTON_DEFAULTS.fullWidth,
|
|
32
|
+
fullWidthOnMobile = BUTTON_DEFAULTS.fullWidthOnMobile,
|
|
33
|
+
skin = BUTTON_DEFAULTS.skin,
|
|
34
|
+
type = BUTTON_DEFAULTS.type,
|
|
35
|
+
variant = BUTTON_DEFAULTS.variant,
|
|
36
36
|
state,
|
|
37
37
|
color,
|
|
38
|
-
isLoading =
|
|
39
|
-
disabled =
|
|
38
|
+
isLoading = BUTTON_DEFAULTS.isLoading,
|
|
39
|
+
disabled = BUTTON_DEFAULTS.disabled,
|
|
40
40
|
loadingAnimationPath = typeof window !== 'undefined' ? window.pktAnimationPath : ANIMATION_DEFAULT_PATH,
|
|
41
41
|
...props
|
|
42
42
|
}: IPktButton,
|
|
@@ -72,7 +72,6 @@ export const PktTag = forwardRef<HTMLSpanElement | HTMLButtonElement, ButtonPktT
|
|
|
72
72
|
const [labelText, setLabelText] = useState('')
|
|
73
73
|
|
|
74
74
|
useEffect(() => {
|
|
75
|
-
// eslint-disable-next-line @eslint-react/set-state-in-effect
|
|
76
75
|
setLabelText(spanRef.current?.textContent?.trim() ?? '')
|
|
77
76
|
}, [children])
|
|
78
77
|
|