@oslokommune/punkt-react 20.0.2 → 20.0.3

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 CHANGED
@@ -5,6 +5,18 @@ og skriver commits ca etter [Conventional Commits](https://conventionalcommits.o
5
5
 
6
6
  ---
7
7
 
8
+ ## [20.1.0](https://github.com/oslokommune/punkt/compare/20.0.2...20.1.0) (2026-11-06)
9
+
10
+ ### Bug Fixes
11
+ * Typesikre tag + textStyle overstyrer ikke lenger størrelse (#3815). `textStyle` overstyrte font-size på store tagger. `normal-text` og
12
+ `thin-text` satte 14px selv med `size="large"`. Nå setter `size` bare
13
+ `font-size` og `textStyle` bare `font-weight`, så store tags er 18px.
14
+
15
+ `textStyle` er nå `normal-text` som default i React og Elements.
16
+
17
+ ---
18
+
19
+
8
20
  ## [20.0.0](https://github.com/oslokommune/punkt/compare/19.20.0...20.0.0) (2026-11-03)
9
21
 
10
22
  ### ⚠ BREAKING CHANGES
@@ -1,20 +1,11 @@
1
1
  import { HTMLAttributes, ReactNode } from 'react';
2
- import { TPktSizeBase, TTagSkin, TTagState } from '../../shared-types';
3
- import { IPktStringsProps } from '../../shared-strings';
4
- interface BasePktTagProps extends IPktStringsProps<'tag'> {
5
- skin?: TTagSkin;
6
- state?: TTagState;
7
- textStyle?: 'normal-text' | 'thin-text';
8
- size?: TPktSizeBase;
9
- closeTag?: boolean;
10
- iconName?: string;
11
- ariaLabel?: string;
2
+ import { IPktTagBase } from '../../shared-types';
3
+ interface BasePktTagProps extends IPktTagBase {
12
4
  onClose?: () => void;
13
5
  children?: ReactNode;
14
6
  }
15
7
  interface ButtonPktTagProps extends BasePktTagProps, HTMLAttributes<HTMLButtonElement> {
16
8
  closeTag: true;
17
- type?: 'button' | 'submit' | 'reset';
18
9
  }
19
10
  interface SpanPktTagProps extends BasePktTagProps, HTMLAttributes<HTMLSpanElement> {
20
11
  closeTag?: false | undefined;
@@ -1,78 +1,80 @@
1
1
  "use client";
2
2
  import { __toESM as e } from "../../_virtual/_rolldown/runtime.js";
3
- import { require_classnames as t } from "../../node_modules/classnames/index.js";
4
- import { PktIcon as n } from "../icon/Icon.js";
5
- import { formatString as r } from "../../shared-strings/format.js";
6
- import { usePktStrings as i } from "../../hooks/usePktStrings.js";
7
- import { forwardRef as a, useCallback as o, useEffect as s, useMemo as c, useRef as l, useState as u } from "react";
8
- import { jsx as d, jsxs as f } from "react/jsx-runtime";
3
+ import { TAG_DEFAULTS as t } from "../../shared-types/tag.js";
4
+ import "../../shared-types/index.js";
5
+ import { require_classnames as n } from "../../node_modules/classnames/index.js";
6
+ import { PktIcon as r } from "../icon/Icon.js";
7
+ import { formatString as i } from "../../shared-strings/format.js";
8
+ import { usePktStrings as a } from "../../hooks/usePktStrings.js";
9
+ import { forwardRef as o, useCallback as s, useEffect as c, useMemo as l, useRef as u, useState as d } from "react";
10
+ import { jsx as f, jsxs as p } from "react/jsx-runtime";
9
11
  //#region src/components/tag/Tag.tsx
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
- s(() => {
15
- j(k.current?.textContent?.trim() ?? "");
12
+ var m = /* @__PURE__ */ e(n(), 1), h = o(({ children: e, skin: n = t.skin, state: o, textStyle: h = t.textStyle, size: g = t.size, closeTag: _ = t.closeTag, className: v, iconName: y, ariaLabel: b, onClose: x, type: S = t.type, "aria-description": C, strings: w, ...T }, E) => {
13
+ let [D, O] = d(!1), k = s(() => {
14
+ O(!0), x && x();
15
+ }, [x]), A = u(null), [j, M] = d("");
16
+ c(() => {
17
+ M(A.current?.textContent?.trim() ?? "");
16
18
  }, [e]);
17
- let M = i(["tag"], C), N = c(() => {
18
- if (g && !y) return A && r(M.tag.remove, { label: A }) || S;
19
+ let N = a(["tag"], w), P = l(() => {
20
+ if (_ && !b) return j && i(N.tag.remove, { label: j }) || C;
19
21
  }, [
20
- g,
21
- y,
22
- A,
23
- S,
24
- M
25
- ]), P = {
22
+ _,
23
+ b,
24
+ j,
25
+ C,
26
+ N
27
+ ]), F = {
26
28
  "pkt-tag": !0,
27
- [`pkt-tag--${h}`]: !!h,
28
- [`pkt-tag--${t}`]: !!t,
29
- [`pkt-tag--${a}`]: !!a,
30
- [`pkt-tag--${m}`]: !!m
31
- }, F = {
29
+ [`pkt-tag--${g}`]: !!g,
30
+ [`pkt-tag--${n}`]: !!n,
31
+ [`pkt-tag--${o}`]: !!o,
32
+ [`pkt-tag--${h}`]: !!h
33
+ }, I = {
32
34
  "pkt-tag": !0,
33
- [`pkt-tag--${m}`]: !!m,
34
35
  [`pkt-tag--${h}`]: !!h,
35
- [`pkt-tag--${t}`]: !!t,
36
- [`pkt-tag--${a}`]: !!a,
37
- "pkt-hide": E
36
+ [`pkt-tag--${g}`]: !!g,
37
+ [`pkt-tag--${n}`]: !!n,
38
+ [`pkt-tag--${o}`]: !!o,
39
+ "pkt-hide": D
38
40
  };
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,
41
+ return _ ? /* @__PURE__ */ p("button", {
42
+ ...T,
43
+ className: (0, m.default)(I, v),
44
+ type: S,
45
+ onClick: k,
46
+ "aria-label": b ?? void 0,
47
+ "aria-description": P,
48
+ ref: E,
47
49
  children: [
48
- v && /* @__PURE__ */ d(n, {
50
+ y && /* @__PURE__ */ f(r, {
49
51
  className: "pkt-tag__icon",
50
- name: v,
52
+ name: y,
51
53
  "aria-hidden": "true"
52
54
  }),
53
- /* @__PURE__ */ d("span", {
54
- ref: k,
55
+ /* @__PURE__ */ f("span", {
56
+ ref: A,
55
57
  children: e
56
58
  }),
57
- /* @__PURE__ */ d(n, {
59
+ /* @__PURE__ */ f(r, {
58
60
  className: "pkt-tag__close-btn",
59
61
  name: "close"
60
62
  })
61
63
  ]
62
- }) : /* @__PURE__ */ f("span", {
63
- ...w,
64
- className: (0, p.default)(P, _),
65
- ref: T,
66
- children: [v && /* @__PURE__ */ d(n, {
64
+ }) : /* @__PURE__ */ p("span", {
65
+ ...T,
66
+ className: (0, m.default)(F, v),
67
+ ref: E,
68
+ children: [y && /* @__PURE__ */ f(r, {
67
69
  className: "pkt-tag__icon",
68
- name: v,
70
+ name: y,
69
71
  "aria-hidden": "true"
70
- }), /* @__PURE__ */ d("span", {
71
- ref: k,
72
+ }), /* @__PURE__ */ f("span", {
73
+ ref: A,
72
74
  children: e
73
75
  })]
74
76
  });
75
77
  });
76
- m.displayName = "PktTag";
78
+ h.displayName = "PktTag";
77
79
  //#endregion
78
- export { m as PktTag };
80
+ export { h as PktTag };