@oslokommune/punkt-react 19.19.1 → 20.0.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 +67 -0
- package/README.md +3 -2
- package/dist/components/card/Card.js +77 -70
- package/dist/components/checkbox/Checkbox.js +1 -1
- package/dist/components/inputwrapper/InputWrapper.js +1 -1
- package/dist/components/link/Link.d.ts +0 -1
- package/dist/components/link/Link.js +10 -12
- package/dist/components/linkcard/LinkCard.d.ts +1 -1
- package/dist/components/linkcard/LinkCard.js +23 -20
- package/dist/components/messagebox/Messagebox.js +29 -28
- package/dist/components/progressbar/Progressbar.d.ts +2 -16
- package/dist/components/progressbar/Progressbar.js +49 -42
- package/dist/components/radio/RadioButton.js +1 -1
- package/dist/components/tag/Tag.d.ts +2 -1
- package/dist/components/tag/Tag.js +37 -35
- package/dist/punkt-react.cjs +1 -1
- package/dist/shared-strings/nb.d.ts +3 -0
- package/dist/shared-strings/nb.js +1 -0
- package/dist/shared-types/card.d.ts +5 -17
- package/dist/shared-types/card.js +9 -8
- package/dist/shared-types/combobox.d.ts +3 -3
- package/dist/shared-types/icon.d.ts +2 -2
- package/dist/shared-types/icon.js +1 -1
- package/dist/shared-types/index.d.ts +11 -9
- package/dist/shared-types/index.js +17 -15
- package/dist/shared-types/linkcard.d.ts +7 -4
- package/dist/shared-types/linkcard.js +9 -0
- package/dist/shared-types/messagebox.d.ts +4 -2
- package/dist/shared-types/messagebox.js +8 -3
- package/dist/shared-types/progressbar.d.ts +82 -5
- package/dist/shared-types/progressbar.js +14 -0
- package/dist/shared-types/skin.d.ts +8 -2
- package/package.json +4 -4
- package/src/components/button/Button.test.tsx +1 -1
- package/src/components/card/Card.test.tsx +78 -43
- package/src/components/card/Card.tsx +17 -24
- package/src/components/checkbox/Checkbox.tsx +1 -1
- package/src/components/inputwrapper/InputWrapper.tsx +1 -1
- package/src/components/link/Link.test.tsx +9 -21
- package/src/components/link/Link.tsx +0 -4
- package/src/components/linkcard/LinkCard.test.tsx +20 -9
- package/src/components/linkcard/LinkCard.tsx +5 -11
- package/src/components/messagebox/Messagebox.test.tsx +10 -1
- package/src/components/messagebox/Messagebox.tsx +11 -2
- package/src/components/progressbar/Progressbar.test.tsx +25 -0
- package/src/components/progressbar/Progressbar.tsx +30 -40
- package/src/components/radio/RadioButton.tsx +1 -1
- package/src/components/tag/Tag.test.tsx +21 -0
- package/src/components/tag/Tag.tsx +6 -2
|
@@ -36,7 +36,7 @@ var l = i(({ id: i, name: l, label: u, className: d, hasTile: f = e.hasTile, inp
|
|
|
36
36
|
children: w
|
|
37
37
|
}),
|
|
38
38
|
y && /* @__PURE__ */ s("span", {
|
|
39
|
-
className: q + " pkt-tag--blue-
|
|
39
|
+
className: q + " pkt-tag--blue-pale",
|
|
40
40
|
children: b ?? j.forms.optional
|
|
41
41
|
}),
|
|
42
42
|
x && /* @__PURE__ */ s("span", {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
-
import { TPktSizeBase, TTagSkin } from '../../shared-types';
|
|
2
|
+
import { TPktSizeBase, TTagSkin, TTagState } from '../../shared-types';
|
|
3
3
|
import { IPktStringsProps } from '../../shared-strings';
|
|
4
4
|
interface BasePktTagProps extends IPktStringsProps<'tag'> {
|
|
5
5
|
skin?: TTagSkin;
|
|
6
|
+
state?: TTagState;
|
|
6
7
|
textStyle?: 'normal-text' | 'thin-text';
|
|
7
8
|
size?: TPktSizeBase;
|
|
8
9
|
closeTag?: boolean;
|
|
@@ -7,49 +7,51 @@ import { usePktStrings as i } from "../../hooks/usePktStrings.js";
|
|
|
7
7
|
import { forwardRef as a, useCallback as o, useEffect as s, useMemo as c, useRef as l, useState as u } from "react";
|
|
8
8
|
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
9
9
|
//#region src/components/tag/Tag.tsx
|
|
10
|
-
var p = /* @__PURE__ */ e(t(), 1), m = a(({ children: e, skin: t = "
|
|
11
|
-
let [
|
|
12
|
-
|
|
13
|
-
}, [
|
|
10
|
+
var p = /* @__PURE__ */ e(t(), 1), m = a(({ children: e, skin: t = "gray", state: a, textStyle: m, size: h = "medium", closeTag: g, className: _, iconName: v, ariaLabel: y, onClose: b, type: x = "button", "aria-description": S, strings: C, ...w }, T) => {
|
|
11
|
+
let [E, D] = u(!1), O = o(() => {
|
|
12
|
+
D(!0), b && b();
|
|
13
|
+
}, [b]), k = l(null), [A, j] = u("");
|
|
14
14
|
s(() => {
|
|
15
|
-
|
|
15
|
+
j(k.current?.textContent?.trim() ?? "");
|
|
16
16
|
}, [e]);
|
|
17
|
-
let
|
|
18
|
-
if (
|
|
17
|
+
let M = i(["tag"], C), N = c(() => {
|
|
18
|
+
if (g && !y) return A && r(M.tag.remove, { label: A }) || S;
|
|
19
19
|
}, [
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
]),
|
|
20
|
+
g,
|
|
21
|
+
y,
|
|
22
|
+
A,
|
|
23
|
+
S,
|
|
24
|
+
M
|
|
25
|
+
]), P = {
|
|
26
26
|
"pkt-tag": !0,
|
|
27
|
-
[`pkt-tag--${
|
|
27
|
+
[`pkt-tag--${h}`]: !!h,
|
|
28
28
|
[`pkt-tag--${t}`]: !!t,
|
|
29
|
-
[`pkt-tag--${a}`]: !!a
|
|
30
|
-
}, P = {
|
|
31
|
-
"pkt-tag": !0,
|
|
32
29
|
[`pkt-tag--${a}`]: !!a,
|
|
30
|
+
[`pkt-tag--${m}`]: !!m
|
|
31
|
+
}, F = {
|
|
32
|
+
"pkt-tag": !0,
|
|
33
33
|
[`pkt-tag--${m}`]: !!m,
|
|
34
|
+
[`pkt-tag--${h}`]: !!h,
|
|
34
35
|
[`pkt-tag--${t}`]: !!t,
|
|
35
|
-
|
|
36
|
+
[`pkt-tag--${a}`]: !!a,
|
|
37
|
+
"pkt-hide": E
|
|
36
38
|
};
|
|
37
|
-
return
|
|
38
|
-
...
|
|
39
|
-
className: (0, p.default)(
|
|
40
|
-
type:
|
|
41
|
-
onClick:
|
|
42
|
-
"aria-label":
|
|
43
|
-
"aria-description":
|
|
44
|
-
ref:
|
|
39
|
+
return g ? /* @__PURE__ */ f("button", {
|
|
40
|
+
...w,
|
|
41
|
+
className: (0, p.default)(F, _),
|
|
42
|
+
type: x,
|
|
43
|
+
onClick: O,
|
|
44
|
+
"aria-label": y,
|
|
45
|
+
"aria-description": N,
|
|
46
|
+
ref: T,
|
|
45
47
|
children: [
|
|
46
|
-
|
|
48
|
+
v && /* @__PURE__ */ d(n, {
|
|
47
49
|
className: "pkt-tag__icon",
|
|
48
|
-
name:
|
|
50
|
+
name: v,
|
|
49
51
|
"aria-hidden": "true"
|
|
50
52
|
}),
|
|
51
53
|
/* @__PURE__ */ d("span", {
|
|
52
|
-
ref:
|
|
54
|
+
ref: k,
|
|
53
55
|
children: e
|
|
54
56
|
}),
|
|
55
57
|
/* @__PURE__ */ d(n, {
|
|
@@ -58,15 +60,15 @@ var p = /* @__PURE__ */ e(t(), 1), m = a(({ children: e, skin: t = "blue", textS
|
|
|
58
60
|
})
|
|
59
61
|
]
|
|
60
62
|
}) : /* @__PURE__ */ f("span", {
|
|
61
|
-
...
|
|
62
|
-
className: (0, p.default)(
|
|
63
|
-
ref:
|
|
64
|
-
children: [
|
|
63
|
+
...w,
|
|
64
|
+
className: (0, p.default)(P, _),
|
|
65
|
+
ref: T,
|
|
66
|
+
children: [v && /* @__PURE__ */ d(n, {
|
|
65
67
|
className: "pkt-tag__icon",
|
|
66
|
-
name:
|
|
68
|
+
name: v,
|
|
67
69
|
"aria-hidden": "true"
|
|
68
70
|
}), /* @__PURE__ */ d("span", {
|
|
69
|
-
ref:
|
|
71
|
+
ref: k,
|
|
70
72
|
children: e
|
|
71
73
|
})]
|
|
72
74
|
});
|