@oslokommune/punkt-react 19.16.2 → 19.17.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/dist/components/consent/Consent.js +2 -2
- package/dist/components/index.d.ts +1 -0
- package/dist/components/inputwrapper/InputWrapper.d.ts +2 -25
- package/dist/components/inputwrapper/InputWrapper.js +84 -83
- package/dist/punkt-react.cjs +1 -1
- package/dist/shared-types/index.d.ts +2 -0
- package/dist/shared-types/input-wrapper.d.ts +59 -0
- package/dist/shared-types/input-wrapper.js +17 -0
- package/package.json +2 -2
- package/src/components/consent/Consent.tsx +2 -2
- package/src/components/index.ts +1 -0
- package/src/components/inputwrapper/InputWrapper.tsx +17 -35
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,20 @@ og skriver commits ca etter [Conventional Commits](https://conventionalcommits.o
|
|
|
5
5
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
+
## [19.17.1](https://github.com/oslokommune/punkt/compare/19.17.0...19.17.1) (2026-10-20)
|
|
9
|
+
|
|
10
|
+
### Bug Fixes
|
|
11
|
+
* Cookie-banner oppdatert til v2.0.0 (#3773). - Litt mindre luft og et smalere banner (i følge deres changelog)
|
|
12
|
+
- Ingen endringer i hvordan PktConsent og footer brukes
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## [19.17.0](https://github.com/oslokommune/punkt/compare/19.16.2...19.17.0) (2026-10-20)
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
|
|
8
22
|
## [19.16.1](https://github.com/oslokommune/punkt/compare/19.16.0...19.16.1) (2026-10-19)
|
|
9
23
|
|
|
10
24
|
### Bug Fixes
|
|
@@ -11,9 +11,9 @@ var s = null, c = () => s || (s = new Promise((e, t) => {
|
|
|
11
11
|
return;
|
|
12
12
|
}
|
|
13
13
|
let n = document.createElement("script");
|
|
14
|
-
n.src = "https://cdn.web.oslo.kommune.no/cb/cb-
|
|
14
|
+
n.src = "https://cdn.web.oslo.kommune.no/cb/cb-v2.0.0.js", n.id = "oslo-consent-script", n.onload = () => e(), n.onerror = t, document.head.appendChild(n);
|
|
15
15
|
let r = document.createElement("link");
|
|
16
|
-
r.href = "https://cdn.web.oslo.kommune.no/cb/cb-
|
|
16
|
+
r.href = "https://cdn.web.oslo.kommune.no/cb/cb-v2.0.0.css", r.type = "text/css", r.rel = "stylesheet", r.id = "oslo-consent-styles", document.head.appendChild(r);
|
|
17
17
|
}), s), l = (e) => {
|
|
18
18
|
if (typeof e != "string") return e;
|
|
19
19
|
try {
|
|
@@ -26,6 +26,7 @@ export { PktHelptext } from './helptext/Helptext';
|
|
|
26
26
|
export { PktIcon } from './icon/Icon';
|
|
27
27
|
export { PktInput } from './input/Input';
|
|
28
28
|
export { PktInputWrapper } from './inputwrapper/InputWrapper';
|
|
29
|
+
export type { IPktInputWrapper } from './inputwrapper/InputWrapper';
|
|
29
30
|
export { PktLink } from './link/Link';
|
|
30
31
|
export { PktLinkCard } from './linkcard/LinkCard';
|
|
31
32
|
export { PktLoader } from './loader/Loader';
|
|
@@ -1,37 +1,14 @@
|
|
|
1
1
|
import { FocusEventHandler, ReactNode, RefAttributes } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
export interface IPktInputWrapper extends RefAttributes<HTMLElement>, IPktStringsProps<'forms' | 'validation'> {
|
|
2
|
+
import { IPktInputWrapperBase } from '../../shared-types';
|
|
3
|
+
export interface IPktInputWrapper extends Omit<IPktInputWrapperBase, 'helptext' | 'helptextDropdown' | 'errorMessage'>, RefAttributes<HTMLElement> {
|
|
5
4
|
id?: string;
|
|
6
5
|
forId: string;
|
|
7
6
|
label: string;
|
|
8
7
|
helptext?: string | ReactNode;
|
|
9
8
|
helptextDropdown?: string | ReactNode;
|
|
10
|
-
/** @deprecated Bruk `strings={{ forms: { readMore: '…' } }}` eller `setPktStrings()`. */
|
|
11
|
-
helptextDropdownButton?: string;
|
|
12
|
-
counter?: boolean;
|
|
13
|
-
counterCurrent?: number;
|
|
14
|
-
counterMaxLength?: number;
|
|
15
|
-
optionalTag?: boolean;
|
|
16
|
-
/** @deprecated Bruk `strings={{ forms: { optional: '…' } }}` eller `setPktStrings()`. */
|
|
17
|
-
optionalText?: string;
|
|
18
|
-
requiredTag?: boolean;
|
|
19
|
-
/** @deprecated Bruk `strings={{ forms: { required: '…' } }}` eller `setPktStrings()`. */
|
|
20
|
-
requiredText?: string;
|
|
21
|
-
tagText?: string | null;
|
|
22
|
-
hasError?: boolean;
|
|
23
9
|
errorMessage?: string | ReactNode;
|
|
24
|
-
disabled?: boolean;
|
|
25
|
-
inline?: boolean;
|
|
26
|
-
ariaDescribedby?: string;
|
|
27
|
-
useWrapper?: boolean;
|
|
28
10
|
children?: ReactNode;
|
|
29
11
|
className?: string;
|
|
30
|
-
hasFieldset?: boolean;
|
|
31
|
-
layout?: TLayout;
|
|
32
|
-
role?: string;
|
|
33
|
-
counterPosition?: 'top' | 'bottom';
|
|
34
|
-
size?: 'small' | 'medium' | 'xsmall';
|
|
35
12
|
onFocus?: FocusEventHandler<HTMLDivElement>;
|
|
36
13
|
onBlur?: FocusEventHandler<HTMLDivElement>;
|
|
37
14
|
}
|
|
@@ -1,128 +1,129 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
2
|
+
import { INPUT_WRAPPER_DEFAULTS as e } from "../../shared-types/input-wrapper.js";
|
|
3
|
+
import { formatString as t } from "../../shared-strings/format.js";
|
|
4
|
+
import { usePktStrings as n } from "../../hooks/usePktStrings.js";
|
|
5
|
+
import { PktAlert as r } from "../alert/Alert.js";
|
|
6
|
+
import { useGeneratedId as i } from "../../hooks/useGeneratedId.js";
|
|
7
|
+
import { useFocusModality as a } from "../../hooks/useFocusModality.js";
|
|
8
|
+
import { counterStatusId as o, isCounterExceeded as s } from "../../shared-utils/forms/described-by.js";
|
|
9
|
+
import { PktHelptext as c } from "../helptext/Helptext.js";
|
|
10
|
+
import { forwardRef as l } from "react";
|
|
11
|
+
import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
11
12
|
//#region src/components/inputwrapper/InputWrapper.tsx
|
|
12
|
-
var
|
|
13
|
-
let
|
|
13
|
+
var p = l(({ id: l, forId: p, label: m, helptext: h, helptextDropdown: g, helptextDropdownButton: _, counter: v, counterCurrent: y = e.counterCurrent, counterMaxLength: b, optionalTag: x = e.optionalTag, optionalText: S, requiredTag: C = e.requiredTag, requiredText: w, tagText: T = null, hasError: E = e.hasError, errorMessage: D, disabled: O = e.disabled, inline: k = e.inline, ariaDescribedby: ee, useWrapper: A = e.useWrapper, children: j, className: M = "", hasFieldset: N = e.hasFieldset, layout: P = e.layout, role: F, counterPosition: I = e.counterPosition, size: L = e.size, strings: R, onFocus: z, onBlur: B }, V) => {
|
|
14
|
+
let H = a(V), U = n(["forms", "validation"], R), W = i(p), G = [...new Set([ee || (h ? `${W}-helptext` : ""), E && D ? `${W}-error` : ""].join(" ").split(" ").filter(Boolean))].join(" ") || void 0, K = !!v, q = K && I === "top", J = K && I === "bottom", Y = [
|
|
14
15
|
"pkt-inputwrapper",
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
].filter(Boolean).join(" "),
|
|
16
|
+
M,
|
|
17
|
+
E ? "pkt-inputwrapper--error" : "",
|
|
18
|
+
O ? "pkt-inputwrapper--disabled" : "",
|
|
19
|
+
k ? "pkt-inputwrapper--inline" : "",
|
|
20
|
+
L ? `pkt-inputwrapper--${L}` : ""
|
|
21
|
+
].filter(Boolean).join(" "), X = [
|
|
21
22
|
"pkt-tag",
|
|
22
23
|
"pkt-tag--small",
|
|
23
24
|
"pkt-tag--thin-text"
|
|
24
|
-
].join(" "),
|
|
25
|
+
].join(" "), Z = s(y, b), Q = K ? /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ f("div", {
|
|
25
26
|
className: "pkt-input__counter",
|
|
26
27
|
"aria-hidden": "true",
|
|
27
|
-
children: [
|
|
28
|
-
}), /* @__PURE__ */
|
|
28
|
+
children: [y, b ? `/${b}` : ""]
|
|
29
|
+
}), /* @__PURE__ */ d("div", {
|
|
29
30
|
className: "pkt-sr-only",
|
|
30
|
-
id:
|
|
31
|
+
id: o(W),
|
|
31
32
|
"aria-live": "polite",
|
|
32
|
-
children:
|
|
33
|
-
current:
|
|
34
|
-
max:
|
|
33
|
+
children: Z ? t(U.validation.counterExceeded, {
|
|
34
|
+
current: y,
|
|
35
|
+
max: b ?? 0
|
|
35
36
|
}) : ""
|
|
36
|
-
})] }) : null,
|
|
37
|
-
|
|
38
|
-
className:
|
|
39
|
-
children:
|
|
37
|
+
})] }) : null, te = () => /* @__PURE__ */ f(u, { children: [
|
|
38
|
+
T && /* @__PURE__ */ d("span", {
|
|
39
|
+
className: X + " pkt-tag--gray",
|
|
40
|
+
children: T
|
|
40
41
|
}),
|
|
41
|
-
|
|
42
|
-
className:
|
|
43
|
-
children:
|
|
42
|
+
x && /* @__PURE__ */ d("span", {
|
|
43
|
+
className: X + " pkt-tag--blue-light",
|
|
44
|
+
children: S ?? U.forms.optional
|
|
44
45
|
}),
|
|
45
|
-
|
|
46
|
-
className:
|
|
47
|
-
children:
|
|
46
|
+
C && /* @__PURE__ */ d("span", {
|
|
47
|
+
className: X + " pkt-tag--beige",
|
|
48
|
+
children: w ?? U.forms.required
|
|
48
49
|
})
|
|
49
|
-
] }),
|
|
50
|
-
let e = /* @__PURE__ */
|
|
51
|
-
|
|
50
|
+
] }), ne = () => {
|
|
51
|
+
let e = /* @__PURE__ */ f(u, { children: [
|
|
52
|
+
m,
|
|
52
53
|
" ",
|
|
53
|
-
|
|
54
|
+
te()
|
|
54
55
|
] });
|
|
55
|
-
return !
|
|
56
|
+
return !A && N ? /* @__PURE__ */ d("legend", {
|
|
56
57
|
className: "pkt-sr-only",
|
|
57
|
-
id: `${
|
|
58
|
-
children:
|
|
59
|
-
}) :
|
|
58
|
+
id: `${W}-label`,
|
|
59
|
+
children: m
|
|
60
|
+
}) : A ? N ? /* @__PURE__ */ d("legend", {
|
|
60
61
|
className: "pkt-inputwrapper__legend",
|
|
61
|
-
id: `${
|
|
62
|
+
id: `${W}-label`,
|
|
62
63
|
children: e
|
|
63
|
-
}) : /* @__PURE__ */
|
|
64
|
+
}) : /* @__PURE__ */ d("label", {
|
|
64
65
|
className: "pkt-inputwrapper__label",
|
|
65
|
-
htmlFor:
|
|
66
|
-
id: `${
|
|
66
|
+
htmlFor: W,
|
|
67
|
+
id: `${W}-label`,
|
|
67
68
|
children: e
|
|
68
|
-
}) : /* @__PURE__ */
|
|
69
|
-
htmlFor:
|
|
69
|
+
}) : /* @__PURE__ */ d("label", {
|
|
70
|
+
htmlFor: W,
|
|
70
71
|
className: "pkt-sr-only",
|
|
71
|
-
id: `${
|
|
72
|
-
children:
|
|
72
|
+
id: `${W}-label`,
|
|
73
|
+
children: m
|
|
73
74
|
});
|
|
74
|
-
},
|
|
75
|
-
let e =
|
|
76
|
-
return !e && !
|
|
77
|
-
forId:
|
|
75
|
+
}, re = () => {
|
|
76
|
+
let e = A ? h : void 0;
|
|
77
|
+
return !e && !g ? null : /* @__PURE__ */ d(c, {
|
|
78
|
+
forId: W,
|
|
78
79
|
helptext: e,
|
|
79
|
-
helptextDropdown:
|
|
80
|
-
helptextDropdownButton:
|
|
80
|
+
helptextDropdown: g,
|
|
81
|
+
helptextDropdownButton: _ ?? U.forms.readMore
|
|
81
82
|
});
|
|
82
|
-
},
|
|
83
|
-
te(),
|
|
83
|
+
}, ie = L === "medium" ? "small" : "xsmall", $ = /* @__PURE__ */ f(u, { children: [
|
|
84
84
|
ne(),
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
85
|
+
re(),
|
|
86
|
+
q && Q,
|
|
87
|
+
N || P === "horizontal" ? /* @__PURE__ */ d("div", {
|
|
88
|
+
className: P === "horizontal" ? "pkt-inputwrapper__options pkt-inputwrapper__options--horizontal" : "pkt-inputwrapper__options",
|
|
89
|
+
children: j
|
|
90
|
+
}) : j,
|
|
91
|
+
J && Q,
|
|
92
|
+
E && D && /* @__PURE__ */ d("div", {
|
|
92
93
|
className: "pkt-inputwrapper__alert-wrapper",
|
|
93
|
-
children: /* @__PURE__ */
|
|
94
|
+
children: /* @__PURE__ */ d(r, {
|
|
94
95
|
skin: "error",
|
|
95
|
-
size:
|
|
96
|
+
size: ie,
|
|
96
97
|
"aria-live": "assertive",
|
|
97
98
|
role: "alert",
|
|
98
|
-
id: `${
|
|
99
|
-
children:
|
|
99
|
+
id: `${W}-error`,
|
|
100
|
+
children: D
|
|
100
101
|
})
|
|
101
102
|
})
|
|
102
103
|
] });
|
|
103
|
-
return /* @__PURE__ */
|
|
104
|
-
id:
|
|
105
|
-
className:
|
|
106
|
-
role:
|
|
107
|
-
"aria-labelledby":
|
|
108
|
-
...
|
|
104
|
+
return /* @__PURE__ */ d("div", {
|
|
105
|
+
id: l,
|
|
106
|
+
className: Y,
|
|
107
|
+
role: F,
|
|
108
|
+
"aria-labelledby": F ? `${W}-label` : void 0,
|
|
109
|
+
...H,
|
|
109
110
|
onFocus: (e) => {
|
|
110
|
-
|
|
111
|
+
H.onFocus(), z?.(e);
|
|
111
112
|
},
|
|
112
113
|
onBlur: (e) => {
|
|
113
|
-
|
|
114
|
+
H.onBlur(e), B?.(e);
|
|
114
115
|
},
|
|
115
|
-
children:
|
|
116
|
+
children: N ? /* @__PURE__ */ d("fieldset", {
|
|
116
117
|
className: "pkt-inputwrapper__fieldset",
|
|
117
|
-
"aria-describedby":
|
|
118
|
-
disabled:
|
|
118
|
+
"aria-describedby": G,
|
|
119
|
+
disabled: O || void 0,
|
|
119
120
|
children: $
|
|
120
|
-
}) : /* @__PURE__ */
|
|
121
|
+
}) : /* @__PURE__ */ d("div", {
|
|
121
122
|
className: "pkt-inputwrapper__fieldset",
|
|
122
123
|
children: $
|
|
123
124
|
})
|
|
124
125
|
});
|
|
125
126
|
});
|
|
126
|
-
|
|
127
|
+
p.displayName = "PktInputWrapper";
|
|
127
128
|
//#endregion
|
|
128
|
-
export {
|
|
129
|
+
export { p as PktInputWrapper };
|