@oslokommune/punkt-react 19.17.0 → 19.18.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 +14 -0
- package/dist/components/consent/Consent.js +2 -2
- package/dist/components/index.d.ts +1 -0
- package/dist/components/textarea/Textarea.d.ts +4 -29
- package/dist/components/textarea/Textarea.js +62 -61
- package/dist/punkt-react.cjs +1 -1
- package/dist/shared-types/index.d.ts +2 -0
- package/dist/shared-types/textarea.d.ts +67 -0
- package/dist/shared-types/textarea.js +16 -0
- package/package.json +2 -2
- package/src/components/consent/Consent.tsx +2 -2
- package/src/components/index.ts +1 -0
- package/src/components/textarea/Textarea.test.tsx +42 -1
- package/src/components/textarea/Textarea.tsx +16 -38
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.18.0](https://github.com/oslokommune/punkt/compare/19.17.1...19.18.0) (2026-10-20)
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
## [19.17.1](https://github.com/oslokommune/punkt/compare/19.17.0...19.17.1) (2026-10-20)
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
* Cookie-banner oppdatert til v2.0.0 (#3773). - Litt mindre luft og et smalere banner (i følge deres changelog)
|
|
17
|
+
- Ingen endringer i hvordan PktConsent og footer brukes
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
|
|
8
22
|
## [19.17.0](https://github.com/oslokommune/punkt/compare/19.16.2...19.17.0) (2026-10-20)
|
|
9
23
|
|
|
10
24
|
---
|
|
@@ -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 {
|
|
@@ -54,6 +54,7 @@ export { PktTabs } from './tabs/Tabs';
|
|
|
54
54
|
export { PktTabItem } from './tabs/TabItem';
|
|
55
55
|
export { PktTag } from './tag/Tag';
|
|
56
56
|
export { PktTextarea } from './textarea/Textarea';
|
|
57
|
+
export type { IPktTextarea } from './textarea/Textarea';
|
|
57
58
|
export { PktTextinput } from './textinput/Textinput';
|
|
58
59
|
export { PktTimepicker } from './timepicker/Timepicker';
|
|
59
60
|
export * from './interfaces';
|
|
@@ -1,39 +1,14 @@
|
|
|
1
1
|
import { ChangeEventHandler, ReactNode, TextareaHTMLAttributes } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
export interface IPktTextarea extends TextareaHTMLAttributes<HTMLTextAreaElement>, IPktStringsProps<'forms' | 'validation'> {
|
|
2
|
+
import { IPktTextareaBase } from '../../shared-types';
|
|
3
|
+
export interface IPktTextarea extends Omit<IPktTextareaBase, 'helptext' | 'helptextDropdown' | 'errorMessage'>, Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, keyof IPktTextareaBase> {
|
|
5
4
|
id: string;
|
|
6
|
-
|
|
7
|
-
ariaLabelledby?: string;
|
|
8
|
-
counter?: boolean;
|
|
9
|
-
hasFieldset?: boolean;
|
|
10
|
-
counterMaxLength?: number;
|
|
11
|
-
disabled?: boolean;
|
|
5
|
+
label: string;
|
|
12
6
|
errorMessage?: string | ReactNode | ReactNode[];
|
|
13
|
-
hasError?: boolean;
|
|
14
7
|
helptext?: string | ReactNode | ReactNode[];
|
|
15
8
|
helptextDropdown?: string | ReactNode | ReactNode[];
|
|
16
|
-
|
|
17
|
-
inline?: boolean;
|
|
18
|
-
fullwidth?: boolean;
|
|
19
|
-
label: string;
|
|
20
|
-
name?: string;
|
|
21
|
-
optionalTag?: boolean;
|
|
22
|
-
optionalText?: string;
|
|
23
|
-
requiredTag?: boolean;
|
|
24
|
-
requiredText?: string;
|
|
25
|
-
tagText?: string | null;
|
|
26
|
-
placeholder?: string;
|
|
27
|
-
rows?: number;
|
|
28
|
-
useWrapper?: boolean;
|
|
29
|
-
value?: string;
|
|
9
|
+
/** @deprecated Bruk `autoComplete`. */
|
|
30
10
|
autocomplete?: string;
|
|
31
|
-
minLength?: number;
|
|
32
|
-
maxLength?: number;
|
|
33
|
-
readOnly?: boolean;
|
|
34
|
-
required?: boolean;
|
|
35
11
|
skipForwardTestid?: boolean;
|
|
36
|
-
inputSize?: TPktInputSize;
|
|
37
12
|
onChange?: ChangeEventHandler<HTMLTextAreaElement>;
|
|
38
13
|
}
|
|
39
14
|
export declare const PktTextarea: import('react').ForwardRefExoticComponent<IPktTextarea & import('react').RefAttributes<HTMLTextAreaElement>>;
|
|
@@ -1,74 +1,75 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
2
|
+
import { TEXTAREA_DEFAULTS as e } from "../../shared-types/textarea.js";
|
|
3
|
+
import { useGeneratedId as t } from "../../hooks/useGeneratedId.js";
|
|
4
|
+
import { describedByIds as n } from "../../shared-utils/forms/described-by.js";
|
|
5
|
+
import { PktInputWrapper as r } from "../inputwrapper/InputWrapper.js";
|
|
6
|
+
import { forwardRef as i, useState as a } from "react";
|
|
7
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
7
8
|
//#region src/components/textarea/Textarea.tsx
|
|
8
|
-
var
|
|
9
|
-
let
|
|
10
|
-
|
|
9
|
+
var s = i(({ id: i, ariaDescribedby: s, ariaLabelledby: c, counter: l, hasFieldset: u, counterMaxLength: d, className: f, disabled: p, errorMessage: m, hasError: h = e.hasError, helptext: g, helptextDropdown: _, helptextDropdownButton: v, inline: y, fullwidth: b = e.fullwidth, label: x, name: S, optionalTag: C = e.optionalTag, optionalText: w, requiredTag: T = e.requiredTag, requiredText: E, tagText: D = null, placeholder: O, rows: k, useWrapper: A = e.useWrapper, onChange: j, value: M, autoComplete: N, autocomplete: P, minLength: F, maxLength: I, readOnly: L, skipForwardTestid: R = !1, inputSize: z = e.inputSize, strings: B, ...V }, H) => {
|
|
10
|
+
let U = l ?? (d ?? 0) > 0, W = [
|
|
11
|
+
f,
|
|
11
12
|
"pkt-textinput",
|
|
12
13
|
"pkt-textarea"
|
|
13
|
-
].filter(Boolean).join(" "),
|
|
14
|
-
|
|
14
|
+
].filter(Boolean).join(" "), G = t(i), K = `${G}-input`, q = `${K}-label`, J = c || q, [Y, X] = a(0), Z = M === void 0 ? Y : M?.length || 0, Q = (e) => {
|
|
15
|
+
U && X(e.currentTarget?.value?.length || 0), j && j(e);
|
|
15
16
|
};
|
|
16
|
-
return /* @__PURE__ */
|
|
17
|
-
className:
|
|
18
|
-
children: /* @__PURE__ */
|
|
19
|
-
strings:
|
|
20
|
-
ariaDescribedby:
|
|
21
|
-
disabled:
|
|
22
|
-
errorMessage:
|
|
23
|
-
forId:
|
|
24
|
-
hasError:
|
|
25
|
-
helptext:
|
|
26
|
-
helptextDropdown:
|
|
27
|
-
helptextDropdownButton:
|
|
28
|
-
inline:
|
|
29
|
-
label:
|
|
30
|
-
optionalTag:
|
|
31
|
-
optionalText:
|
|
32
|
-
requiredTag:
|
|
33
|
-
requiredText:
|
|
34
|
-
tagText:
|
|
35
|
-
useWrapper:
|
|
36
|
-
counter:
|
|
37
|
-
counterCurrent:
|
|
38
|
-
counterMaxLength:
|
|
39
|
-
hasFieldset:
|
|
40
|
-
size:
|
|
41
|
-
children: /* @__PURE__ */
|
|
17
|
+
return /* @__PURE__ */ o("div", {
|
|
18
|
+
className: W,
|
|
19
|
+
children: /* @__PURE__ */ o(r, {
|
|
20
|
+
strings: B,
|
|
21
|
+
ariaDescribedby: s,
|
|
22
|
+
disabled: p,
|
|
23
|
+
errorMessage: m,
|
|
24
|
+
forId: K,
|
|
25
|
+
hasError: h,
|
|
26
|
+
helptext: g,
|
|
27
|
+
helptextDropdown: _,
|
|
28
|
+
helptextDropdownButton: v,
|
|
29
|
+
inline: y,
|
|
30
|
+
label: x,
|
|
31
|
+
optionalTag: C,
|
|
32
|
+
optionalText: w,
|
|
33
|
+
requiredTag: T,
|
|
34
|
+
requiredText: E,
|
|
35
|
+
tagText: D,
|
|
36
|
+
useWrapper: A,
|
|
37
|
+
counter: U,
|
|
38
|
+
counterCurrent: Z,
|
|
39
|
+
counterMaxLength: d,
|
|
40
|
+
hasFieldset: u ?? !1,
|
|
41
|
+
size: z,
|
|
42
|
+
children: /* @__PURE__ */ o("textarea", {
|
|
42
43
|
ref: (e) => {
|
|
43
|
-
|
|
44
|
+
X(e?.value?.length || 0), typeof H == "function" ? H(e) : H && (H.current = e);
|
|
44
45
|
},
|
|
45
|
-
className: `pkt-input pkt-input--${
|
|
46
|
-
name: `${
|
|
47
|
-
id:
|
|
48
|
-
placeholder:
|
|
49
|
-
disabled:
|
|
50
|
-
rows:
|
|
51
|
-
"aria-labelledby":
|
|
52
|
-
"aria-invalid":
|
|
53
|
-
"aria-errormessage":
|
|
54
|
-
"aria-describedby":
|
|
55
|
-
id:
|
|
56
|
-
hasHelptext: !!
|
|
57
|
-
hasCounter:
|
|
58
|
-
ariaDescribedby:
|
|
46
|
+
className: `pkt-input pkt-input--${z} ${b ? "pkt-input--fullwidth" : ""} ${d && Z > d ? "pkt-input--counter-error" : ""}`,
|
|
47
|
+
name: `${S || G}`,
|
|
48
|
+
id: K,
|
|
49
|
+
placeholder: O,
|
|
50
|
+
disabled: p,
|
|
51
|
+
rows: k,
|
|
52
|
+
"aria-labelledby": J,
|
|
53
|
+
"aria-invalid": h,
|
|
54
|
+
"aria-errormessage": h ? `${K}-error` : void 0,
|
|
55
|
+
"aria-describedby": n({
|
|
56
|
+
id: K,
|
|
57
|
+
hasHelptext: !!g,
|
|
58
|
+
hasCounter: U,
|
|
59
|
+
ariaDescribedby: s
|
|
59
60
|
}),
|
|
60
|
-
...
|
|
61
|
-
onChange:
|
|
62
|
-
value:
|
|
63
|
-
autoComplete:
|
|
64
|
-
minLength:
|
|
65
|
-
maxLength:
|
|
66
|
-
readOnly:
|
|
67
|
-
"data-skip-forward-testid":
|
|
61
|
+
...V,
|
|
62
|
+
onChange: Q,
|
|
63
|
+
value: M,
|
|
64
|
+
autoComplete: N ?? P ?? e.autoComplete,
|
|
65
|
+
minLength: F,
|
|
66
|
+
maxLength: I,
|
|
67
|
+
readOnly: L,
|
|
68
|
+
"data-skip-forward-testid": R ? "true" : void 0
|
|
68
69
|
})
|
|
69
70
|
})
|
|
70
71
|
});
|
|
71
72
|
});
|
|
72
|
-
|
|
73
|
+
s.displayName = "PktTextarea";
|
|
73
74
|
//#endregion
|
|
74
|
-
export {
|
|
75
|
+
export { s as PktTextarea };
|