@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.
Files changed (49) hide show
  1. package/CHANGELOG.md +67 -0
  2. package/README.md +3 -2
  3. package/dist/components/card/Card.js +77 -70
  4. package/dist/components/checkbox/Checkbox.js +1 -1
  5. package/dist/components/inputwrapper/InputWrapper.js +1 -1
  6. package/dist/components/link/Link.d.ts +0 -1
  7. package/dist/components/link/Link.js +10 -12
  8. package/dist/components/linkcard/LinkCard.d.ts +1 -1
  9. package/dist/components/linkcard/LinkCard.js +23 -20
  10. package/dist/components/messagebox/Messagebox.js +29 -28
  11. package/dist/components/progressbar/Progressbar.d.ts +2 -16
  12. package/dist/components/progressbar/Progressbar.js +49 -42
  13. package/dist/components/radio/RadioButton.js +1 -1
  14. package/dist/components/tag/Tag.d.ts +2 -1
  15. package/dist/components/tag/Tag.js +37 -35
  16. package/dist/punkt-react.cjs +1 -1
  17. package/dist/shared-strings/nb.d.ts +3 -0
  18. package/dist/shared-strings/nb.js +1 -0
  19. package/dist/shared-types/card.d.ts +5 -17
  20. package/dist/shared-types/card.js +9 -8
  21. package/dist/shared-types/combobox.d.ts +3 -3
  22. package/dist/shared-types/icon.d.ts +2 -2
  23. package/dist/shared-types/icon.js +1 -1
  24. package/dist/shared-types/index.d.ts +11 -9
  25. package/dist/shared-types/index.js +17 -15
  26. package/dist/shared-types/linkcard.d.ts +7 -4
  27. package/dist/shared-types/linkcard.js +9 -0
  28. package/dist/shared-types/messagebox.d.ts +4 -2
  29. package/dist/shared-types/messagebox.js +8 -3
  30. package/dist/shared-types/progressbar.d.ts +82 -5
  31. package/dist/shared-types/progressbar.js +14 -0
  32. package/dist/shared-types/skin.d.ts +8 -2
  33. package/package.json +4 -4
  34. package/src/components/button/Button.test.tsx +1 -1
  35. package/src/components/card/Card.test.tsx +78 -43
  36. package/src/components/card/Card.tsx +17 -24
  37. package/src/components/checkbox/Checkbox.tsx +1 -1
  38. package/src/components/inputwrapper/InputWrapper.tsx +1 -1
  39. package/src/components/link/Link.test.tsx +9 -21
  40. package/src/components/link/Link.tsx +0 -4
  41. package/src/components/linkcard/LinkCard.test.tsx +20 -9
  42. package/src/components/linkcard/LinkCard.tsx +5 -11
  43. package/src/components/messagebox/Messagebox.test.tsx +10 -1
  44. package/src/components/messagebox/Messagebox.tsx +11 -2
  45. package/src/components/progressbar/Progressbar.test.tsx +25 -0
  46. package/src/components/progressbar/Progressbar.tsx +30 -40
  47. package/src/components/radio/RadioButton.tsx +1 -1
  48. package/src/components/tag/Tag.test.tsx +21 -0
  49. 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-light",
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 = "blue", textStyle: a, size: m = "medium", closeTag: h, className: g, iconName: _, ariaLabel: v, onClose: y, type: b = "button", "aria-description": x, strings: S, ...C }, w) => {
11
- let [T, E] = u(!1), D = o(() => {
12
- E(!0), y && y();
13
- }, [y]), O = l(null), [k, A] = u("");
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
- A(O.current?.textContent?.trim() ?? "");
15
+ j(k.current?.textContent?.trim() ?? "");
16
16
  }, [e]);
17
- let j = i(["tag"], S), M = c(() => {
18
- if (h && !v) return k && r(j.tag.remove, { label: k }) || x;
17
+ let M = i(["tag"], C), N = c(() => {
18
+ if (g && !y) return A && r(M.tag.remove, { label: A }) || S;
19
19
  }, [
20
- h,
21
- v,
22
- k,
23
- x,
24
- j
25
- ]), N = {
20
+ g,
21
+ y,
22
+ A,
23
+ S,
24
+ M
25
+ ]), P = {
26
26
  "pkt-tag": !0,
27
- [`pkt-tag--${m}`]: !!m,
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
- "pkt-hide": T
36
+ [`pkt-tag--${a}`]: !!a,
37
+ "pkt-hide": E
36
38
  };
37
- return h ? /* @__PURE__ */ f("button", {
38
- ...C,
39
- className: (0, p.default)(P, g),
40
- type: b,
41
- onClick: D,
42
- "aria-label": v,
43
- "aria-description": M,
44
- ref: w,
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
- _ && /* @__PURE__ */ d(n, {
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: O,
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
- ...C,
62
- className: (0, p.default)(N, g),
63
- ref: w,
64
- children: [_ && /* @__PURE__ */ d(n, {
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: O,
71
+ ref: k,
70
72
  children: e
71
73
  })]
72
74
  });