@oslokommune/punkt-react 16.20.0 → 16.21.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 +18 -0
- package/dist/index.d.ts +36 -15
- package/dist/punkt-react.es.js +47 -24
- package/dist/punkt-react.umd.js +5 -5
- package/package.json +3 -3
- package/src/components/loader/Loader.test.tsx +54 -17
- package/src/components/loader/Loader.tsx +113 -23
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,24 @@ og skriver commits ca etter [Conventional Commits](https://conventionalcommits.o
|
|
|
5
5
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
+
## [16.21.0](https://github.com/oslokommune/punkt/compare/16.20.0...16.21.0) (2026-05-29)
|
|
9
|
+
|
|
10
|
+
### ⚠ BREAKING CHANGES
|
|
11
|
+
Ingen
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
* PktLoader i React (#3502).
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
Ingen
|
|
19
|
+
|
|
20
|
+
### Chores
|
|
21
|
+
Ingen
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
|
|
8
26
|
## [16.20.0](https://github.com/oslokommune/punkt/compare/16.19.0...16.20.0) (2026-05-28)
|
|
9
27
|
|
|
10
28
|
### ⚠ BREAKING CHANGES
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ import { Booleanish } from './shared-types';
|
|
|
3
3
|
import { ButtonHTMLAttributes } from 'react';
|
|
4
4
|
import { ChangeEvent } from 'react';
|
|
5
5
|
import { ChangeEventHandler } from 'react';
|
|
6
|
-
import { CSSProperties } from 'react';
|
|
7
6
|
import { FC } from 'react';
|
|
8
7
|
import { FocusEvent as FocusEvent_2 } from 'react';
|
|
9
8
|
import { ForwardRefExoticComponent } from 'react';
|
|
@@ -17,7 +16,6 @@ import { InputHTMLAttributes } from 'react';
|
|
|
17
16
|
import { IPktComboboxOption } from './shared-types/combobox';
|
|
18
17
|
import { IPktConsent as IPktConsent_2 } from '@oslokommune/punkt-elements';
|
|
19
18
|
import { IPktHeaderMenu as IPktHeaderMenu_2 } from './shared-types';
|
|
20
|
-
import { IPktLoader as IPktLoader_2 } from '@oslokommune/punkt-elements';
|
|
21
19
|
import { IPktSearchInputSuggestion } from './shared-types/searchinput';
|
|
22
20
|
import { ITimepickerStrings } from './shared-types/timepicker';
|
|
23
21
|
import { JSX as JSX_2 } from 'react/jsx-runtime';
|
|
@@ -28,7 +26,6 @@ import { ReactElement } from 'react';
|
|
|
28
26
|
import { ReactNode } from 'react';
|
|
29
27
|
import { Ref } from 'react';
|
|
30
28
|
import { RefAttributes } from 'react';
|
|
31
|
-
import { RefObject } from 'react';
|
|
32
29
|
import { SelectHTMLAttributes } from 'react';
|
|
33
30
|
import { SyntheticEvent } from 'react';
|
|
34
31
|
import { TAccordionSkin } from './shared-types';
|
|
@@ -80,8 +77,6 @@ declare interface Column {
|
|
|
80
77
|
text?: string;
|
|
81
78
|
}
|
|
82
79
|
|
|
83
|
-
declare type ExtendedLoader = IPktLoader_2 & PktElType;
|
|
84
|
-
|
|
85
80
|
/**
|
|
86
81
|
* A selected file plus metadata used by the FileUpload UI.
|
|
87
82
|
*
|
|
@@ -624,7 +619,37 @@ export declare interface IPktLinkCard extends Omit<HTMLAttributes<HTMLAnchorElem
|
|
|
624
619
|
children?: ReactNode;
|
|
625
620
|
}
|
|
626
621
|
|
|
627
|
-
export declare interface IPktLoader extends
|
|
622
|
+
export declare interface IPktLoader extends HTMLAttributes<HTMLDivElement> {
|
|
623
|
+
/**
|
|
624
|
+
* Tid i millisekunder før loader vises. Nyttig når lastetiden kan være
|
|
625
|
+
* så kort at loader ikke trengs.
|
|
626
|
+
*/
|
|
627
|
+
delay?: number;
|
|
628
|
+
/**
|
|
629
|
+
* Vises loader inline eller som blokk.
|
|
630
|
+
*/
|
|
631
|
+
inline?: boolean;
|
|
632
|
+
/**
|
|
633
|
+
* Styrer om loader eller barnenoder vises. Når `false` vises barnenoder.
|
|
634
|
+
*/
|
|
635
|
+
isLoading?: boolean;
|
|
636
|
+
/**
|
|
637
|
+
* Meldingstekst som vises sammen med loader.
|
|
638
|
+
*/
|
|
639
|
+
message?: string | null;
|
|
640
|
+
/**
|
|
641
|
+
* Størrelse på loader. Standard er "medium".
|
|
642
|
+
*/
|
|
643
|
+
size?: TPktLoaderSize;
|
|
644
|
+
/**
|
|
645
|
+
* Loader-variant. Standard er "shapes" (Oslo-bølger). Andre er "blue" og "rainbow" (spinner-varianter).
|
|
646
|
+
*/
|
|
647
|
+
variant?: TPktLoaderVariant;
|
|
648
|
+
/**
|
|
649
|
+
* Overstyrer stien til loader-animasjoner.
|
|
650
|
+
*/
|
|
651
|
+
loadingAnimationPath?: string;
|
|
652
|
+
children?: ReactNode;
|
|
628
653
|
}
|
|
629
654
|
|
|
630
655
|
export declare interface IPktMessagebox extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
|
|
@@ -1064,14 +1089,6 @@ export declare const PktConsent: ForwardRefExoticComponent<IPktConsent>;
|
|
|
1064
1089
|
|
|
1065
1090
|
export declare const PktDatepicker: ForwardRefExoticComponent<IPktDatepicker & RefAttributes<HTMLDivElement>>;
|
|
1066
1091
|
|
|
1067
|
-
declare interface PktElType extends HTMLAttributes<HTMLElement> {
|
|
1068
|
-
className?: string;
|
|
1069
|
-
style?: CSSProperties;
|
|
1070
|
-
children?: string | ReactNode | ReactNode[];
|
|
1071
|
-
ref?: RefObject<HTMLElement> | LegacyRef<HTMLElement>;
|
|
1072
|
-
id?: string;
|
|
1073
|
-
}
|
|
1074
|
-
|
|
1075
1092
|
export declare const PktFileUpload: FC<IPktFileUpload>;
|
|
1076
1093
|
|
|
1077
1094
|
export declare const PktFooter: FC<IPktFooter>;
|
|
@@ -1137,7 +1154,7 @@ export declare const PktLinkCard: {
|
|
|
1137
1154
|
displayName: string;
|
|
1138
1155
|
};
|
|
1139
1156
|
|
|
1140
|
-
export declare const PktLoader:
|
|
1157
|
+
export declare const PktLoader: ForwardRefExoticComponent<IPktLoader & RefAttributes<HTMLDivElement>>;
|
|
1141
1158
|
|
|
1142
1159
|
export declare const PktMessagebox: FC<IPktMessagebox>;
|
|
1143
1160
|
|
|
@@ -1260,6 +1277,10 @@ declare type TPktHeadingSize = THeadingSize;
|
|
|
1260
1277
|
|
|
1261
1278
|
declare type TPktHeadingWeight = THeadingWeight;
|
|
1262
1279
|
|
|
1280
|
+
declare type TPktLoaderSize = 'small' | 'medium' | 'large';
|
|
1281
|
+
|
|
1282
|
+
declare type TPktLoaderVariant = 'blue' | 'rainbow' | 'shapes';
|
|
1283
|
+
|
|
1263
1284
|
/**
|
|
1264
1285
|
* An operation that can be attached to a queue item (rename, comment, remove, etc).
|
|
1265
1286
|
*
|
package/dist/punkt-react.es.js
CHANGED
|
@@ -93,7 +93,7 @@ var A = /* @__PURE__ */ O((/* @__PURE__ */ ee(((e, t) => {
|
|
|
93
93
|
return n;
|
|
94
94
|
}) : window.classNames = n;
|
|
95
95
|
})();
|
|
96
|
-
})))(), 1), re = "https://punkt-cdn.oslo.kommune.no/16.
|
|
96
|
+
})))(), 1), re = "https://punkt-cdn.oslo.kommune.no/16.21/icons/";
|
|
97
97
|
typeof window < "u" && (window.pktFetch = window.pktFetch === void 0 ? fetch : window.pktFetch, window.pktIconPath = window.pktIconPath || re);
|
|
98
98
|
var ie = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 32 32\"></svg>", ae = {}, oe = 2, se = 1500, ce = typeof Storage < "u" && typeof sessionStorage < "u", le = typeof window < "u" ? p : u, ue = (e, t) => !e || !ce ? "" : sessionStorage.getItem(t + e + ".svg") ?? "", de = (e) => window.pktFetch(e).then((t) => {
|
|
99
99
|
if (!t.ok) throw Error("Missing icon: " + e);
|
|
@@ -208,7 +208,7 @@ var N = o(({ defaultOpen: e = !1, id: t, title: n, skin: r, compact: i = !1, isO
|
|
|
208
208
|
});
|
|
209
209
|
//#endregion
|
|
210
210
|
//#region src/components/button/Button.tsx
|
|
211
|
-
N.displayName = "PktAccordionItem", window.pktAnimationPath = window.pktAnimationPath || "https://punkt-cdn.oslo.kommune.no/16.
|
|
211
|
+
N.displayName = "PktAccordionItem", window.pktAnimationPath = window.pktAnimationPath || "https://punkt-cdn.oslo.kommune.no/16.21/animations/";
|
|
212
212
|
var P = o(({ children: e, className: t, iconName: n = "user", secondIconName: r = "user", iconPath: i, secondIconPath: a, size: o = "medium", fullWidth: s = !1, fullWidthOnMobile: c = !1, skin: l = "primary", type: u = "button", variant: d = "label-only", state: f, color: p, isLoading: m = void 0, disabled: h = void 0, loadingAnimationPath: g = window.pktAnimationPath, ..._ }, b) => {
|
|
213
213
|
let x = [
|
|
214
214
|
t,
|
|
@@ -4837,7 +4837,7 @@ var ea = class extends Kr {
|
|
|
4837
4837
|
ea.directiveName = "unsafeHTML", ea.resultType = 1;
|
|
4838
4838
|
var ta = Gr(ea), na = class extends ea {};
|
|
4839
4839
|
na.directiveName = "unsafeSVG", na.resultType = 2;
|
|
4840
|
-
var ra = Gr(na), ia = "https://punkt-cdn.oslo.kommune.no/16.
|
|
4840
|
+
var ra = Gr(na), ia = "https://punkt-cdn.oslo.kommune.no/16.21/icons/";
|
|
4841
4841
|
typeof window < "u" && (window.pktFetch = window.pktFetch === void 0 ? fetch : window.pktFetch, window.pktIconPath = window.pktIconPath || ia);
|
|
4842
4842
|
var aa = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 32 32\"></svg>", oa = {}, sa = 2, ca = 1500, la = typeof Storage < "u" && typeof sessionStorage < "u", ua = (e) => window.pktFetch(e).then((t) => {
|
|
4843
4843
|
if (!t.ok) throw Error("Missing icon: " + e);
|
|
@@ -4920,7 +4920,7 @@ try {
|
|
|
4920
4920
|
var Q = (e) => e ?? K;
|
|
4921
4921
|
//#endregion
|
|
4922
4922
|
//#region ../elements/dist/button-CR-KWhTT.js
|
|
4923
|
-
window.pktAnimationPath = window.pktAnimationPath || "https://punkt-cdn.oslo.kommune.no/16.
|
|
4923
|
+
window.pktAnimationPath = window.pktAnimationPath || "https://punkt-cdn.oslo.kommune.no/16.21/animations/";
|
|
4924
4924
|
var ma = class extends Qi {
|
|
4925
4925
|
constructor(...e) {
|
|
4926
4926
|
super(...e), this.iconName = "user", this.secondIconName = "user", this.mode = "light", this.size = "medium", this.fullWidth = !1, this.fullWidthOnMobile = !1, this.skin = "primary", this.variant = "label-only", this.state = "normal", this.type = "button", this.form = void 0, this.isLoading = !1, this.disabled = !1, this.loadingAnimationPath = window.pktAnimationPath;
|
|
@@ -10741,7 +10741,7 @@ try {
|
|
|
10741
10741
|
} catch {
|
|
10742
10742
|
console.warn("Forsøker å definere <pkt-header-user-menu>, men den er allerede definert");
|
|
10743
10743
|
}
|
|
10744
|
-
var Bc = "https://punkt-cdn.oslo.kommune.no/16.
|
|
10744
|
+
var Bc = "https://punkt-cdn.oslo.kommune.no/16.21/logos/", Vc = class extends Qi {
|
|
10745
10745
|
constructor(...e) {
|
|
10746
10746
|
super(...e), this.searchPlaceholder = "Søk", this.searchValue = "", this.mobileBreakpoint = 768, this.tabletBreakpoint = 1280, this.openedMenu = "none", this.logOutButtonPlacement = "none", this.position = "fixed", this.scrollBehavior = "hide", this.slotMenuVariant = "icon-only", this.slotMenuText = "Meny", this.hideLogo = !1, this.compact = !1, this.showSearch = !1, this.canChangeRepresentation = !1, this.hasLogOut = !1, this.isMobile = !1, this.isTablet = !1, this.openMenu = "none", this.isHidden = !1, this.componentWidth = typeof window < "u" ? window.innerWidth : 0, this.alignSlotRight = !1, this.alignSearchRight = !1, this.headerRef = _a(), this.userContainerRef = _a(), this.slotContainerRef = _a(), this.searchContainerRef = _a(), this.slotContentRef = _a(), this.searchMenuRef = _a(), this.lastScrollPosition = 0, this.savedScrollY = 0, this.lastFocusedElement = null, this.shouldRestoreFocus = !1, this.handleScroll = () => {
|
|
10747
10747
|
if (!this.shouldHideOnScroll) return;
|
|
@@ -14736,7 +14736,7 @@ try {
|
|
|
14736
14736
|
}
|
|
14737
14737
|
//#endregion
|
|
14738
14738
|
//#region ../elements/dist/loader-gKdQpOOQ.js
|
|
14739
|
-
window.pktAnimationPath = window.pktAnimationPath || "https://punkt-cdn.oslo.kommune.no/16.
|
|
14739
|
+
window.pktAnimationPath = window.pktAnimationPath || "https://punkt-cdn.oslo.kommune.no/16.21/animations/";
|
|
14740
14740
|
var Ru = class extends Qi {
|
|
14741
14741
|
constructor(...e) {
|
|
14742
14742
|
super(...e), this.delay = 0, this.inline = !1, this.isLoading = !0, this.message = null, this.size = "medium", this.variant = "shapes", this.loadingAnimationPath = window.pktAnimationPath, this._shouldDisplayLoader = !1;
|
|
@@ -18652,7 +18652,7 @@ var dp = o(({ mobileBreakpoint: e = 768, tabletBreakpoint: t = 1280, children: n
|
|
|
18652
18652
|
children: /* @__PURE__ */ v(M, {
|
|
18653
18653
|
name: "oslologo",
|
|
18654
18654
|
"aria-hidden": "true",
|
|
18655
|
-
path: "https://punkt-cdn.oslo.kommune.no/16.
|
|
18655
|
+
path: "https://punkt-cdn.oslo.kommune.no/16.21/logos/"
|
|
18656
18656
|
})
|
|
18657
18657
|
}) : ie ? /* @__PURE__ */ v("button", {
|
|
18658
18658
|
"aria-label": "Tilbake til forside",
|
|
@@ -18661,12 +18661,12 @@ var dp = o(({ mobileBreakpoint: e = 768, tabletBreakpoint: t = 1280, children: n
|
|
|
18661
18661
|
children: /* @__PURE__ */ v(M, {
|
|
18662
18662
|
name: "oslologo",
|
|
18663
18663
|
"aria-hidden": "true",
|
|
18664
|
-
path: "https://punkt-cdn.oslo.kommune.no/16.
|
|
18664
|
+
path: "https://punkt-cdn.oslo.kommune.no/16.21/logos/"
|
|
18665
18665
|
})
|
|
18666
18666
|
}) : /* @__PURE__ */ v(M, {
|
|
18667
18667
|
name: "oslologo",
|
|
18668
18668
|
"aria-hidden": "true",
|
|
18669
|
-
path: "https://punkt-cdn.oslo.kommune.no/16.
|
|
18669
|
+
path: "https://punkt-cdn.oslo.kommune.no/16.21/logos/"
|
|
18670
18670
|
})
|
|
18671
18671
|
}), T && /* @__PURE__ */ v("span", {
|
|
18672
18672
|
className: "pkt-header-service__service-name",
|
|
@@ -19164,23 +19164,46 @@ var Pp = ({ children: e, skin: t, title: n, href: r, iconName: i, openInNewTab:
|
|
|
19164
19164
|
]
|
|
19165
19165
|
});
|
|
19166
19166
|
};
|
|
19167
|
-
Pp.displayName = "PktLinkCard";
|
|
19168
19167
|
//#endregion
|
|
19169
19168
|
//#region src/components/loader/Loader.tsx
|
|
19170
|
-
|
|
19171
|
-
|
|
19172
|
-
|
|
19173
|
-
|
|
19174
|
-
|
|
19175
|
-
|
|
19176
|
-
}
|
|
19177
|
-
|
|
19178
|
-
|
|
19179
|
-
|
|
19180
|
-
|
|
19181
|
-
|
|
19182
|
-
|
|
19183
|
-
|
|
19169
|
+
Pp.displayName = "PktLinkCard", typeof window < "u" && (window.pktAnimationPath = window.pktAnimationPath || "https://punkt-cdn.oslo.kommune.no/16.21/animations/");
|
|
19170
|
+
var Fp = (e) => {
|
|
19171
|
+
switch (e) {
|
|
19172
|
+
case "blue": return "spinner-blue";
|
|
19173
|
+
case "rainbow": return "spinner";
|
|
19174
|
+
default: return "loader";
|
|
19175
|
+
}
|
|
19176
|
+
}, Ip = o(function({ delay: e = 0, inline: t = !1, isLoading: n = !0, message: r = null, size: i = "medium", variant: a = "shapes", loadingAnimationPath: o = typeof window < "u" ? window.pktAnimationPath : void 0, className: s, children: c, ...l }, d) {
|
|
19177
|
+
let [f, p] = g(e === 0);
|
|
19178
|
+
u(() => {
|
|
19179
|
+
if (e > 0) {
|
|
19180
|
+
p(!1);
|
|
19181
|
+
let t = setTimeout(() => p(!0), e);
|
|
19182
|
+
return () => clearTimeout(t);
|
|
19183
|
+
}
|
|
19184
|
+
p(!0);
|
|
19185
|
+
}, [e]);
|
|
19186
|
+
let m = (0, A.default)("pkt-loader", t ? "pkt-loader--inline" : "pkt-loader--box", `pkt-loader--${i}`, s);
|
|
19187
|
+
return /* @__PURE__ */ y("div", {
|
|
19188
|
+
...l,
|
|
19189
|
+
ref: d,
|
|
19190
|
+
role: "status",
|
|
19191
|
+
"aria-live": "polite",
|
|
19192
|
+
"aria-busy": n ? "true" : "false",
|
|
19193
|
+
className: m,
|
|
19194
|
+
children: [n && f && /* @__PURE__ */ y("div", {
|
|
19195
|
+
className: "pkt-loader__spinner",
|
|
19196
|
+
children: [/* @__PURE__ */ v(M, {
|
|
19197
|
+
name: Fp(a),
|
|
19198
|
+
path: o,
|
|
19199
|
+
className: `pkt-loader__svg pkt-loader__${a}`
|
|
19200
|
+
}), r && /* @__PURE__ */ v("p", { children: r })]
|
|
19201
|
+
}), /* @__PURE__ */ v("div", {
|
|
19202
|
+
className: (0, A.default)("pkt-contents", n && "pkt-hide"),
|
|
19203
|
+
children: c
|
|
19204
|
+
})]
|
|
19205
|
+
});
|
|
19206
|
+
});
|
|
19184
19207
|
Ip.displayName = "PktLoader";
|
|
19185
19208
|
//#endregion
|
|
19186
19209
|
//#region src/components/messagebox/Messagebox.tsx
|