@postenbring/hedwig-react 1.4.1 → 1.5.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 (40) hide show
  1. package/dist/card/card.d.ts +28 -2
  2. package/dist/card/card.d.ts.map +1 -1
  3. package/dist/card/card.js +22 -3
  4. package/dist/card/card.js.map +1 -1
  5. package/dist/card/card.mjs +3 -1
  6. package/dist/card/index.js +20 -3
  7. package/dist/card/index.js.map +1 -1
  8. package/dist/card/index.mjs +1 -1
  9. package/dist/{chunk-VU2GCAM4.mjs → chunk-BQR4ZRFT.mjs} +2 -2
  10. package/dist/{chunk-IEDOH22E.mjs → chunk-NE6PE5W7.mjs} +22 -4
  11. package/dist/chunk-NE6PE5W7.mjs.map +1 -0
  12. package/dist/{chunk-VYS2QNTL.mjs → chunk-V5X3ZS23.mjs} +3 -3
  13. package/dist/chunk-V5X3ZS23.mjs.map +1 -0
  14. package/dist/form/error-summary/error-summary.js +2 -2
  15. package/dist/form/error-summary/error-summary.js.map +1 -1
  16. package/dist/form/error-summary/error-summary.mjs +2 -2
  17. package/dist/form/error-summary/index.js +2 -2
  18. package/dist/form/error-summary/index.js.map +1 -1
  19. package/dist/form/error-summary/index.mjs +2 -2
  20. package/dist/form/index.js +2 -2
  21. package/dist/form/index.js.map +1 -1
  22. package/dist/form/index.mjs +8 -8
  23. package/dist/index.js +22 -5
  24. package/dist/index.js.map +1 -1
  25. package/dist/index.mjs +9 -9
  26. package/dist/link/index.js +2 -2
  27. package/dist/link/index.js.map +1 -1
  28. package/dist/link/index.mjs +1 -1
  29. package/dist/link/link.d.ts +3 -1
  30. package/dist/link/link.d.ts.map +1 -1
  31. package/dist/link/link.js +2 -2
  32. package/dist/link/link.js.map +1 -1
  33. package/dist/link/link.mjs +1 -1
  34. package/package.json +4 -4
  35. package/src/card/card.tsx +57 -8
  36. package/src/link/link.stories.tsx +1 -1
  37. package/src/link/link.tsx +5 -3
  38. package/dist/chunk-IEDOH22E.mjs.map +0 -1
  39. package/dist/chunk-VYS2QNTL.mjs.map +0 -1
  40. /package/dist/{chunk-VU2GCAM4.mjs.map → chunk-BQR4ZRFT.mjs.map} +0 -0
package/dist/index.mjs CHANGED
@@ -86,21 +86,15 @@ import "./chunk-BYEJZSG5.mjs";
86
86
  import {
87
87
  Select
88
88
  } from "./chunk-AXEAIXG7.mjs";
89
- import "./chunk-TDLSHJ4Z.mjs";
90
- import {
91
- DatePicker
92
- } from "./chunk-GVO57ZWU.mjs";
93
89
  import "./chunk-KPPLVGZ3.mjs";
94
90
  import {
95
91
  ErrorSummary
96
- } from "./chunk-VU2GCAM4.mjs";
92
+ } from "./chunk-BQR4ZRFT.mjs";
97
93
  import "./chunk-CKAL5ZJZ.mjs";
98
94
  import "./chunk-7LPYJC6S.mjs";
99
95
  import {
100
96
  Input
101
97
  } from "./chunk-ITLZQ47H.mjs";
102
- import "./chunk-Y5SUMFYJ.mjs";
103
- import "./chunk-XZ43OSZ5.mjs";
104
98
  import "./chunk-CYDWEPFL.mjs";
105
99
  import "./chunk-YJOOSTJC.mjs";
106
100
  import {
@@ -111,6 +105,12 @@ import {
111
105
  Fieldset,
112
106
  useFieldsetContext
113
107
  } from "./chunk-Z2ZPTZ6F.mjs";
108
+ import "./chunk-TDLSHJ4Z.mjs";
109
+ import {
110
+ DatePicker
111
+ } from "./chunk-GVO57ZWU.mjs";
112
+ import "./chunk-Y5SUMFYJ.mjs";
113
+ import "./chunk-XZ43OSZ5.mjs";
114
114
  import "./chunk-NSLSA7F7.mjs";
115
115
  import {
116
116
  ErrorMessage
@@ -155,7 +155,7 @@ import "./chunk-NE6W2PCD.mjs";
155
155
  import "./chunk-XLLYMQLW.mjs";
156
156
  import {
157
157
  Link
158
- } from "./chunk-VYS2QNTL.mjs";
158
+ } from "./chunk-V5X3ZS23.mjs";
159
159
  import "./chunk-ARHJZUZG.mjs";
160
160
  import {
161
161
  Card,
@@ -168,7 +168,7 @@ import {
168
168
  CardBodyHeaderTitle,
169
169
  CardMedia,
170
170
  CardMediaImg
171
- } from "./chunk-IEDOH22E.mjs";
171
+ } from "./chunk-NE6PE5W7.mjs";
172
172
  import "./chunk-2YL2MVWN.mjs";
173
173
  import {
174
174
  DescriptionList
@@ -61,7 +61,7 @@ var import_react_slot = require("@radix-ui/react-slot");
61
61
  var import_jsx_runtime = require("react/jsx-runtime");
62
62
  var Link = (0, import_react.forwardRef)(
63
63
  (_a, ref) => {
64
- var _b = _a, { asChild, children, variant = "underline", size = "medium", className } = _b, rest = __objRest(_b, ["asChild", "children", "variant", "size", "className"]);
64
+ var _b = _a, { asChild, children, variant = "underline", size = "default", className } = _b, rest = __objRest(_b, ["asChild", "children", "variant", "size", "className"]);
65
65
  const Component = asChild ? import_react_slot.Slot : "a";
66
66
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
67
67
  Component,
@@ -69,7 +69,7 @@ var Link = (0, import_react.forwardRef)(
69
69
  className: (0, import_typed_classname.clsx)(
70
70
  "hds-link",
71
71
  variant !== "underline" && `hds-link--${variant}`,
72
- size !== "medium" && `hds-link--${size}`,
72
+ size !== "default" && size !== "medium" && `hds-link--${size}`,
73
73
  className
74
74
  ),
75
75
  ref
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/link/index.tsx","../../src/link/link.tsx"],"sourcesContent":["export { Link } from \"./link\";\n\nexport type * from \"./link\";\n","import * as React from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { forwardRef } from \"react\";\nimport { Slot } from \"@radix-ui/react-slot\";\n\nexport interface LinkProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {\n /**\n * The visual style of the link\n */\n variant?: \"underline\" | \"solid\" | \"inverted\" | \"no-underline\";\n\n /**\n * Font size of the link\n */\n size?: \"small\" | \"medium\" | \"large\";\n\n children: React.ReactNode;\n\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n *\n * @default false\n */\n asChild?: boolean;\n}\n\nexport const Link = forwardRef<HTMLAnchorElement, LinkProps>(\n ({ asChild, children, variant = \"underline\", size = \"medium\", className, ...rest }, ref) => {\n const Component = asChild ? Slot : \"a\";\n return (\n <Component\n className={clsx(\n \"hds-link\",\n variant !== \"underline\" && `hds-link--${variant}`,\n size !== \"medium\" && `hds-link--${size}`,\n className as undefined,\n )}\n ref={ref}\n {...rest}\n >\n {children}\n </Component>\n );\n },\n);\nLink.displayName = \"Link\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,YAAuB;AACvB,6BAAqB;AACrB,mBAA2B;AAC3B,wBAAqB;AA2Bf;AAJC,IAAM,WAAO;AAAA,EAClB,CAAC,IAAmF,QAAQ;AAA3F,iBAAE,WAAS,UAAU,UAAU,aAAa,OAAO,UAAU,UA3BhE,IA2BG,IAA2E,iBAA3E,IAA2E,CAAzE,WAAS,YAAU,WAAuB,QAAiB;AAC5D,UAAM,YAAY,UAAU,yBAAO;AACnC,WACE;AAAA,MAAC;AAAA;AAAA,QACC,eAAW;AAAA,UACT;AAAA,UACA,YAAY,eAAe,aAAa,OAAO;AAAA,UAC/C,SAAS,YAAY,aAAa,IAAI;AAAA,UACtC;AAAA,QACF;AAAA,QACA;AAAA,SACI,OARL;AAAA,QAUE;AAAA;AAAA,IACH;AAAA,EAEJ;AACF;AACA,KAAK,cAAc;","names":[]}
1
+ {"version":3,"sources":["../../src/link/index.tsx","../../src/link/link.tsx"],"sourcesContent":["export { Link } from \"./link\";\n\nexport type * from \"./link\";\n","import * as React from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { forwardRef } from \"react\";\nimport { Slot } from \"@radix-ui/react-slot\";\n\nexport interface LinkProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {\n /**\n * The visual style of the link\n */\n variant?: \"underline\" | \"solid\" | \"inverted\" | \"no-underline\";\n\n /**\n * Font size of the link\n *\n * Note: `medium` is deprecated, use `default` instead of `medium`\n */\n size?: \"default\" | \"small\" | \"large\" | \"technical\" | \"medium\";\n\n children: React.ReactNode;\n\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n *\n * @default false\n */\n asChild?: boolean;\n}\n\nexport const Link = forwardRef<HTMLAnchorElement, LinkProps>(\n ({ asChild, children, variant = \"underline\", size = \"default\", className, ...rest }, ref) => {\n const Component = asChild ? Slot : \"a\";\n return (\n <Component\n className={clsx(\n \"hds-link\",\n variant !== \"underline\" && `hds-link--${variant}`,\n size !== \"default\" && size !== \"medium\" && `hds-link--${size}`,\n className as undefined,\n )}\n ref={ref}\n {...rest}\n >\n {children}\n </Component>\n );\n },\n);\nLink.displayName = \"Link\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,YAAuB;AACvB,6BAAqB;AACrB,mBAA2B;AAC3B,wBAAqB;AA6Bf;AAJC,IAAM,WAAO;AAAA,EAClB,CAAC,IAAoF,QAAQ;AAA5F,iBAAE,WAAS,UAAU,UAAU,aAAa,OAAO,WAAW,UA7BjE,IA6BG,IAA4E,iBAA5E,IAA4E,CAA1E,WAAS,YAAU,WAAuB,QAAkB;AAC7D,UAAM,YAAY,UAAU,yBAAO;AACnC,WACE;AAAA,MAAC;AAAA;AAAA,QACC,eAAW;AAAA,UACT;AAAA,UACA,YAAY,eAAe,aAAa,OAAO;AAAA,UAC/C,SAAS,aAAa,SAAS,YAAY,aAAa,IAAI;AAAA,UAC5D;AAAA,QACF;AAAA,QACA;AAAA,SACI,OARL;AAAA,QAUE;AAAA;AAAA,IACH;AAAA,EAEJ;AACF;AACA,KAAK,cAAc;","names":[]}
@@ -1,7 +1,7 @@
1
1
  import "../chunk-XLLYMQLW.mjs";
2
2
  import {
3
3
  Link
4
- } from "../chunk-VYS2QNTL.mjs";
4
+ } from "../chunk-V5X3ZS23.mjs";
5
5
  import "../chunk-YOSPWY5K.mjs";
6
6
  export {
7
7
  Link
@@ -6,8 +6,10 @@ export interface LinkProps extends React.AnchorHTMLAttributes<HTMLAnchorElement>
6
6
  variant?: "underline" | "solid" | "inverted" | "no-underline";
7
7
  /**
8
8
  * Font size of the link
9
+ *
10
+ * Note: `medium` is deprecated, use `default` instead of `medium`
9
11
  */
10
- size?: "small" | "medium" | "large";
12
+ size?: "default" | "small" | "large" | "technical" | "medium";
11
13
  children: React.ReactNode;
12
14
  /**
13
15
  * Change the default rendered element for the one passed as a child, merging their props and behavior.
@@ -1 +1 @@
1
- {"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../../src/link/link.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,MAAM,WAAW,SAAU,SAAQ,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC;IAC9E;;OAEG;IACH,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,GAAG,UAAU,GAAG,cAAc,CAAC;IAE9D;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;IAEpC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAE1B;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,eAAO,MAAM,IAAI,qFAkBhB,CAAC"}
1
+ {"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../../src/link/link.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,MAAM,WAAW,SAAU,SAAQ,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC;IAC9E;;OAEG;IACH,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,GAAG,UAAU,GAAG,cAAc,CAAC;IAE9D;;;;OAIG;IACH,IAAI,CAAC,EAAE,SAAS,GAAG,OAAO,GAAG,OAAO,GAAG,WAAW,GAAG,QAAQ,CAAC;IAE9D,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAE1B;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,eAAO,MAAM,IAAI,qFAkBhB,CAAC"}
package/dist/link/link.js CHANGED
@@ -59,7 +59,7 @@ var import_react_slot = require("@radix-ui/react-slot");
59
59
  var import_jsx_runtime = require("react/jsx-runtime");
60
60
  var Link = (0, import_react.forwardRef)(
61
61
  (_a, ref) => {
62
- var _b = _a, { asChild, children, variant = "underline", size = "medium", className } = _b, rest = __objRest(_b, ["asChild", "children", "variant", "size", "className"]);
62
+ var _b = _a, { asChild, children, variant = "underline", size = "default", className } = _b, rest = __objRest(_b, ["asChild", "children", "variant", "size", "className"]);
63
63
  const Component = asChild ? import_react_slot.Slot : "a";
64
64
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
65
65
  Component,
@@ -67,7 +67,7 @@ var Link = (0, import_react.forwardRef)(
67
67
  className: (0, import_typed_classname.clsx)(
68
68
  "hds-link",
69
69
  variant !== "underline" && `hds-link--${variant}`,
70
- size !== "medium" && `hds-link--${size}`,
70
+ size !== "default" && size !== "medium" && `hds-link--${size}`,
71
71
  className
72
72
  ),
73
73
  ref
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/link/link.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { forwardRef } from \"react\";\nimport { Slot } from \"@radix-ui/react-slot\";\n\nexport interface LinkProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {\n /**\n * The visual style of the link\n */\n variant?: \"underline\" | \"solid\" | \"inverted\" | \"no-underline\";\n\n /**\n * Font size of the link\n */\n size?: \"small\" | \"medium\" | \"large\";\n\n children: React.ReactNode;\n\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n *\n * @default false\n */\n asChild?: boolean;\n}\n\nexport const Link = forwardRef<HTMLAnchorElement, LinkProps>(\n ({ asChild, children, variant = \"underline\", size = \"medium\", className, ...rest }, ref) => {\n const Component = asChild ? Slot : \"a\";\n return (\n <Component\n className={clsx(\n \"hds-link\",\n variant !== \"underline\" && `hds-link--${variant}`,\n size !== \"medium\" && `hds-link--${size}`,\n className as undefined,\n )}\n ref={ref}\n {...rest}\n >\n {children}\n </Component>\n );\n },\n);\nLink.displayName = \"Link\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,YAAuB;AACvB,6BAAqB;AACrB,mBAA2B;AAC3B,wBAAqB;AA2Bf;AAJC,IAAM,WAAO;AAAA,EAClB,CAAC,IAAmF,QAAQ;AAA3F,iBAAE,WAAS,UAAU,UAAU,aAAa,OAAO,UAAU,UA3BhE,IA2BG,IAA2E,iBAA3E,IAA2E,CAAzE,WAAS,YAAU,WAAuB,QAAiB;AAC5D,UAAM,YAAY,UAAU,yBAAO;AACnC,WACE;AAAA,MAAC;AAAA;AAAA,QACC,eAAW;AAAA,UACT;AAAA,UACA,YAAY,eAAe,aAAa,OAAO;AAAA,UAC/C,SAAS,YAAY,aAAa,IAAI;AAAA,UACtC;AAAA,QACF;AAAA,QACA;AAAA,SACI,OARL;AAAA,QAUE;AAAA;AAAA,IACH;AAAA,EAEJ;AACF;AACA,KAAK,cAAc;","names":[]}
1
+ {"version":3,"sources":["../../src/link/link.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { forwardRef } from \"react\";\nimport { Slot } from \"@radix-ui/react-slot\";\n\nexport interface LinkProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {\n /**\n * The visual style of the link\n */\n variant?: \"underline\" | \"solid\" | \"inverted\" | \"no-underline\";\n\n /**\n * Font size of the link\n *\n * Note: `medium` is deprecated, use `default` instead of `medium`\n */\n size?: \"default\" | \"small\" | \"large\" | \"technical\" | \"medium\";\n\n children: React.ReactNode;\n\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n *\n * @default false\n */\n asChild?: boolean;\n}\n\nexport const Link = forwardRef<HTMLAnchorElement, LinkProps>(\n ({ asChild, children, variant = \"underline\", size = \"default\", className, ...rest }, ref) => {\n const Component = asChild ? Slot : \"a\";\n return (\n <Component\n className={clsx(\n \"hds-link\",\n variant !== \"underline\" && `hds-link--${variant}`,\n size !== \"default\" && size !== \"medium\" && `hds-link--${size}`,\n className as undefined,\n )}\n ref={ref}\n {...rest}\n >\n {children}\n </Component>\n );\n },\n);\nLink.displayName = \"Link\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,YAAuB;AACvB,6BAAqB;AACrB,mBAA2B;AAC3B,wBAAqB;AA6Bf;AAJC,IAAM,WAAO;AAAA,EAClB,CAAC,IAAoF,QAAQ;AAA5F,iBAAE,WAAS,UAAU,UAAU,aAAa,OAAO,WAAW,UA7BjE,IA6BG,IAA4E,iBAA5E,IAA4E,CAA1E,WAAS,YAAU,WAAuB,QAAkB;AAC7D,UAAM,YAAY,UAAU,yBAAO;AACnC,WACE;AAAA,MAAC;AAAA;AAAA,QACC,eAAW;AAAA,UACT;AAAA,UACA,YAAY,eAAe,aAAa,OAAO;AAAA,UAC/C,SAAS,aAAa,SAAS,YAAY,aAAa,IAAI;AAAA,UAC5D;AAAA,QACF;AAAA,QACA;AAAA,SACI,OARL;AAAA,QAUE;AAAA;AAAA,IACH;AAAA,EAEJ;AACF;AACA,KAAK,cAAc;","names":[]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Link
3
- } from "../chunk-VYS2QNTL.mjs";
3
+ } from "../chunk-V5X3ZS23.mjs";
4
4
  import "../chunk-YOSPWY5K.mjs";
5
5
  export {
6
6
  Link
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@postenbring/hedwig-react",
3
- "version": "1.4.1",
3
+ "version": "1.5.0",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",
@@ -19,8 +19,8 @@
19
19
  "react-dom": "18.3.1",
20
20
  "tsup": "^8.3.5",
21
21
  "typescript": "^5.6.3",
22
- "hedwig-tsconfig": "0.0.0",
23
- "eslint-config-custom": "0.0.1"
22
+ "eslint-config-custom": "0.0.1",
23
+ "hedwig-tsconfig": "0.0.0"
24
24
  },
25
25
  "peerDependencies": {
26
26
  "@types/react": "^17.0.0 || ^18.0.0 || ^19.0.0",
@@ -31,7 +31,7 @@
31
31
  "dependencies": {
32
32
  "@radix-ui/react-popover": "1.1.2",
33
33
  "@radix-ui/react-slot": "1.1.0",
34
- "@postenbring/hedwig-css": "1.5.1"
34
+ "@postenbring/hedwig-css": "1.6.0"
35
35
  },
36
36
  "publishConfig": {
37
37
  "access": "public"
package/src/card/card.tsx CHANGED
@@ -42,7 +42,7 @@ export const CardBody = forwardRef<HTMLDivElement, CardBaseProps>(
42
42
  const Component = asChild ? Slot : "div";
43
43
  return (
44
44
  <Component {...rest} className={clsx("hds-card__body", className as undefined)} ref={ref}>
45
- {children}
45
+ <div className={clsx("hds-card__centerbody", className as undefined)}>{children}</div>
46
46
  </Component>
47
47
  );
48
48
  },
@@ -143,6 +143,22 @@ export const CardBodyAction = forwardRef<HTMLDivElement, CardBaseProps>(
143
143
  );
144
144
  CardBodyAction.displayName = "Card.BodyAction";
145
145
 
146
+ export const CardBodyActionRow = forwardRef<HTMLDivElement, CardBaseProps>(
147
+ ({ asChild, className, children, ...rest }, ref) => {
148
+ const Component = asChild ? Slot : "div";
149
+ return (
150
+ <Component
151
+ {...rest}
152
+ className={clsx("hds-card__body-action-row", className as undefined)}
153
+ ref={ref}
154
+ >
155
+ {children}
156
+ </Component>
157
+ );
158
+ },
159
+ );
160
+ CardBodyActionRow.displayName = "Card.BodyActionRow";
161
+
146
162
  interface CardBodyActionArrowProps extends React.HTMLAttributes<HTMLSpanElement> {
147
163
  /**
148
164
  * Change the default rendered element for the one passed as a child, merging their props and behavior.
@@ -187,7 +203,7 @@ export interface CardBaseProps extends React.HTMLAttributes<HTMLDivElement> {
187
203
  asChild?: boolean;
188
204
  }
189
205
 
190
- export interface CardProps extends CardBaseProps {
206
+ export interface CardSlimAndMiniatureProps extends CardBaseProps {
191
207
  /**
192
208
  * Change the default rendered element for Card.
193
209
  */
@@ -197,23 +213,49 @@ export interface CardProps extends CardBaseProps {
197
213
  *
198
214
  * @default "slim"
199
215
  */
200
- variant?: "slim" | "full-width" | "miniature" | "focus";
216
+ variant?: "slim" | "miniature";
201
217
  /**
202
218
  * The color of the card.
203
219
  *
204
220
  * @default "lighter-brand"
205
221
  * */
206
222
  color?: "white" | "lighter-brand" | "light-grey-fill";
223
+
224
+ /* Only fullwidth or focus cards can have images to the left or right of the text: */
225
+ imagePosition?: never;
207
226
  }
208
227
 
209
- interface CardFocusProps extends CardBaseProps {
228
+ export interface CardFocusProps extends CardBaseProps {
210
229
  as?: "section" | "div" | "article" | "aside";
211
230
  variant: "focus";
212
- color: "darker";
231
+ color?: "darker";
232
+ /**
233
+ * fullwidth or focus cards can have images to the left or right of the text.
234
+ *
235
+ * @default "left"
236
+ * */
237
+ imagePosition?: "left" | "right";
213
238
  }
214
239
 
215
- export const Card = forwardRef<HTMLDivElement, CardProps | CardFocusProps>(
216
- ({ as: Tag = "section", asChild, className, children, variant, color, ...rest }, ref) => {
240
+ export interface CardFullwidthProps extends CardBaseProps {
241
+ as?: "section" | "div" | "article" | "aside";
242
+ variant: "full-width";
243
+ color: "white" | "lighter-brand" | "light-grey-fill";
244
+ /**
245
+ * fullwidth or focus cards can have images to the left or right of the text.
246
+ *
247
+ * @default "left"
248
+ * */
249
+ imagePosition?: "left" | "right";
250
+ }
251
+
252
+ export type CardProps = CardSlimAndMiniatureProps | CardFocusProps | CardFullwidthProps;
253
+
254
+ export const Card = forwardRef<HTMLDivElement, CardProps>(
255
+ (
256
+ { as: Tag = "section", asChild, className, children, variant, color, imagePosition, ...rest },
257
+ ref,
258
+ ) => {
217
259
  const Component = asChild ? Slot : Tag;
218
260
  const effectiveColor = variant === "focus" && !color ? "darker" : color;
219
261
  return (
@@ -227,11 +269,16 @@ export const Card = forwardRef<HTMLDivElement, CardProps | CardFocusProps>(
227
269
  { "hds-card--color-white": effectiveColor === "white" },
228
270
  { "hds-card--color-light-grey-fill": effectiveColor === "light-grey-fill" },
229
271
  { "hds-card--color-darker": effectiveColor === "darker" },
272
+ { "hds-card--image-position-right": imagePosition === "right" },
230
273
  className as undefined,
231
274
  )}
232
275
  ref={ref}
233
276
  >
234
- {children}
277
+ {variant === "full-width" ? (
278
+ <div className={clsx("hds-card__layoutwrapper", className as undefined)}>{children}</div>
279
+ ) : (
280
+ children
281
+ )}
235
282
  </Component>
236
283
  );
237
284
  },
@@ -246,6 +293,7 @@ Card.BodyHeaderOverline = CardBodyHeaderOverline;
246
293
  Card.BodyHeaderTitle = CardBodyHeaderTitle;
247
294
  Card.BodyDescription = CardBodyDescription;
248
295
  Card.BodyAction = CardBodyAction;
296
+ Card.BodyActionRow = CardBodyActionRow;
249
297
  Card.BodyActionArrow = CardBodyActionArrow;
250
298
 
251
299
  type CardType = ReturnType<typeof forwardRef<HTMLDivElement, CardProps>> & {
@@ -257,5 +305,6 @@ type CardType = ReturnType<typeof forwardRef<HTMLDivElement, CardProps>> & {
257
305
  BodyHeaderTitle: typeof CardBodyHeaderTitle;
258
306
  BodyDescription: typeof CardBodyDescription;
259
307
  BodyAction: typeof CardBodyAction;
308
+ BodyActionRow: typeof CardBodyActionRow;
260
309
  BodyActionArrow: typeof CardBodyActionArrow;
261
310
  };
@@ -23,7 +23,7 @@ type Story = StoryObj<typeof Link>;
23
23
  export const Preview: Story = {
24
24
  tags: ["!dev"],
25
25
  args: {
26
- children: "Link",
26
+ children: <>Link</>,
27
27
  href: "https://www.posten.no/",
28
28
  onClick: (e) => {
29
29
  e.preventDefault();
package/src/link/link.tsx CHANGED
@@ -11,8 +11,10 @@ export interface LinkProps extends React.AnchorHTMLAttributes<HTMLAnchorElement>
11
11
 
12
12
  /**
13
13
  * Font size of the link
14
+ *
15
+ * Note: `medium` is deprecated, use `default` instead of `medium`
14
16
  */
15
- size?: "small" | "medium" | "large";
17
+ size?: "default" | "small" | "large" | "technical" | "medium";
16
18
 
17
19
  children: React.ReactNode;
18
20
 
@@ -25,14 +27,14 @@ export interface LinkProps extends React.AnchorHTMLAttributes<HTMLAnchorElement>
25
27
  }
26
28
 
27
29
  export const Link = forwardRef<HTMLAnchorElement, LinkProps>(
28
- ({ asChild, children, variant = "underline", size = "medium", className, ...rest }, ref) => {
30
+ ({ asChild, children, variant = "underline", size = "default", className, ...rest }, ref) => {
29
31
  const Component = asChild ? Slot : "a";
30
32
  return (
31
33
  <Component
32
34
  className={clsx(
33
35
  "hds-link",
34
36
  variant !== "underline" && `hds-link--${variant}`,
35
- size !== "medium" && `hds-link--${size}`,
37
+ size !== "default" && size !== "medium" && `hds-link--${size}`,
36
38
  className as undefined,
37
39
  )}
38
40
  ref={ref}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/card/card.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { forwardRef } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { Slot } from \"@radix-ui/react-slot\";\n\nexport const CardMedia = forwardRef<HTMLDivElement, CardBaseProps>(\n ({ asChild, className, children, ...rest }, ref) => {\n const Component = asChild ? Slot : \"div\";\n return (\n <Component {...rest} className={clsx(\"hds-card__media\", className as undefined)} ref={ref}>\n {children}\n </Component>\n );\n },\n);\nCardMedia.displayName = \"Card.Media\";\n\nexport interface CardImageMediaProps extends React.ImgHTMLAttributes<HTMLImageElement> {\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n *\n * @default false\n */\n asChild?: boolean;\n}\nexport const CardMediaImg = forwardRef<HTMLImageElement, CardImageMediaProps>(\n ({ asChild, className, ...rest }, ref) => {\n const Component = asChild ? Slot : \"img\";\n return (\n <Component\n {...rest}\n className={clsx(\"hds-card__media__img\", className as undefined)}\n ref={ref}\n />\n );\n },\n);\nCardMediaImg.displayName = \"Card.MediaImg\";\n\nexport const CardBody = forwardRef<HTMLDivElement, CardBaseProps>(\n ({ asChild, className, children, ...rest }, ref) => {\n const Component = asChild ? Slot : \"div\";\n return (\n <Component {...rest} className={clsx(\"hds-card__body\", className as undefined)} ref={ref}>\n {children}\n </Component>\n );\n },\n);\nCardBody.displayName = \"Card.Body\";\n\nexport const CardBodyHeader = forwardRef<\n HTMLHeadingElement,\n CardBaseProps &\n (\n | {\n /**\n * Heading level of the card heading\n */\n as: \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\";\n asChild?: never;\n }\n | {\n asChild: true;\n as?: never;\n }\n )\n>(({ as: Tag, asChild, className, children, ...rest }, ref) => {\n const Component = asChild ? Slot : Tag;\n return (\n <Component\n {...rest}\n className={clsx(\"hds-card__body-header\", className as undefined)}\n ref={ref}\n >\n {children}\n </Component>\n );\n});\nCardBodyHeader.displayName = \"Card.BodyHeader\";\n\nexport const CardBodyHeaderOverline = forwardRef<HTMLDivElement, CardBaseProps>(\n ({ asChild, className, children, ...rest }, ref) => {\n const Component = asChild ? Slot : \"span\";\n return (\n <Component\n {...rest}\n className={clsx(\"hds-card__body-header-overline\", className as undefined)}\n ref={ref}\n >\n {children}\n </Component>\n );\n },\n);\nCardBodyHeaderOverline.displayName = \"Card.BodyHeaderOverline\";\n\nexport const CardBodyHeaderTitle = forwardRef<HTMLDivElement, CardBaseProps>(\n ({ asChild, className, children, ...rest }, ref) => {\n const Component = asChild ? Slot : \"div\";\n return (\n <Component\n {...rest}\n className={clsx(\"hds-card__body-header-title\", className as undefined)}\n ref={ref}\n >\n {children}\n </Component>\n );\n },\n);\nCardBodyHeaderTitle.displayName = \"Card.BodyHeaderTitle\";\n\nexport const CardBodyDescription = forwardRef<HTMLParagraphElement, CardBaseProps>(\n ({ asChild, className, children, ...rest }, ref) => {\n const Component = asChild ? Slot : \"p\";\n return (\n <Component\n {...rest}\n className={clsx(\"hds-card__body-description\", className as undefined)}\n ref={ref}\n >\n {children}\n </Component>\n );\n },\n);\nCardBodyDescription.displayName = \"Card.BodyDescription\";\n\nexport const CardBodyAction = forwardRef<HTMLDivElement, CardBaseProps>(\n ({ asChild, className, children, ...rest }, ref) => {\n const Component = asChild ? Slot : \"div\";\n return (\n <Component\n {...rest}\n className={clsx(\"hds-card__body-action\", className as undefined)}\n ref={ref}\n >\n {children}\n </Component>\n );\n },\n);\nCardBodyAction.displayName = \"Card.BodyAction\";\n\ninterface CardBodyActionArrowProps extends React.HTMLAttributes<HTMLSpanElement> {\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n *\n * @default false\n */\n asChild?: boolean;\n\n /**\n * Set direction of the arrow\n *\n * @default \"right\"\n */\n direction?: \"right\" | \"up-right\";\n}\nexport const CardBodyActionArrow = forwardRef<HTMLSpanElement, CardBodyActionArrowProps>(\n ({ asChild, className, direction, ...rest }, ref) => {\n const Component = asChild ? Slot : \"span\";\n return (\n <Component\n {...rest}\n className={clsx(\n \"hds-card__body-action-arrow\",\n { \"hds-card__body-action-arrow-up-right\": direction === \"up-right\" },\n className as undefined,\n )}\n ref={ref}\n />\n );\n },\n);\nCardBodyActionArrow.displayName = \"Card.BodyActionArrow\";\n\nexport interface CardBaseProps extends React.HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n *\n * @default false\n */\n asChild?: boolean;\n}\n\nexport interface CardProps extends CardBaseProps {\n /**\n * Change the default rendered element for Card.\n */\n as?: \"section\" | \"div\" | \"article\" | \"aside\";\n /**\n * Allows for a horizontal variant for sizes above small.\n *\n * @default \"slim\"\n */\n variant?: \"slim\" | \"full-width\" | \"miniature\" | \"focus\";\n /**\n * The color of the card.\n *\n * @default \"lighter-brand\"\n * */\n color?: \"white\" | \"lighter-brand\" | \"light-grey-fill\";\n}\n\ninterface CardFocusProps extends CardBaseProps {\n as?: \"section\" | \"div\" | \"article\" | \"aside\";\n variant: \"focus\";\n color: \"darker\";\n}\n\nexport const Card = forwardRef<HTMLDivElement, CardProps | CardFocusProps>(\n ({ as: Tag = \"section\", asChild, className, children, variant, color, ...rest }, ref) => {\n const Component = asChild ? Slot : Tag;\n const effectiveColor = variant === \"focus\" && !color ? \"darker\" : color;\n return (\n <Component\n {...rest}\n className={clsx(\n \"hds-card\",\n { \"hds-card--full-width\": variant === \"full-width\" },\n { \"hds-card--miniature\": variant === \"miniature\" },\n { \"hds-card--focus\": variant === \"focus\" },\n { \"hds-card--color-white\": effectiveColor === \"white\" },\n { \"hds-card--color-light-grey-fill\": effectiveColor === \"light-grey-fill\" },\n { \"hds-card--color-darker\": effectiveColor === \"darker\" },\n className as undefined,\n )}\n ref={ref}\n >\n {children}\n </Component>\n );\n },\n) as CardType;\nCard.displayName = \"Card\";\n\nCard.Media = CardMedia;\nCard.MediaImg = CardMediaImg;\nCard.Body = CardBody;\nCard.BodyHeader = CardBodyHeader;\nCard.BodyHeaderOverline = CardBodyHeaderOverline;\nCard.BodyHeaderTitle = CardBodyHeaderTitle;\nCard.BodyDescription = CardBodyDescription;\nCard.BodyAction = CardBodyAction;\nCard.BodyActionArrow = CardBodyActionArrow;\n\ntype CardType = ReturnType<typeof forwardRef<HTMLDivElement, CardProps>> & {\n Media: typeof CardMedia;\n MediaImg: typeof CardMediaImg;\n Body: typeof CardBody;\n BodyHeader: typeof CardBodyHeader;\n BodyHeaderOverline: typeof CardBodyHeaderOverline;\n BodyHeaderTitle: typeof CardBodyHeaderTitle;\n BodyDescription: typeof CardBodyDescription;\n BodyAction: typeof CardBodyAction;\n BodyActionArrow: typeof CardBodyActionArrow;\n};\n"],"mappings":";;;;;;;AACA,SAAS,kBAAkB;AAC3B,SAAS,YAAY;AACrB,SAAS,YAAY;AAMf;AAJC,IAAM,YAAY;AAAA,EACvB,CAAC,IAA2C,QAAQ;AAAnD,iBAAE,WAAS,WAAW,SAN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esContent":["import * as React from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { forwardRef } from \"react\";\nimport { Slot } from \"@radix-ui/react-slot\";\n\nexport interface LinkProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {\n /**\n * The visual style of the link\n */\n variant?: \"underline\" | \"solid\" | \"inverted\" | \"no-underline\";\n\n /**\n * Font size of the link\n */\n size?: \"small\" | \"medium\" | \"large\";\n\n children: React.ReactNode;\n\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n *\n * @default false\n */\n asChild?: boolean;\n}\n\nexport const Link = forwardRef<HTMLAnchorElement, LinkProps>(\n ({ asChild, children, variant = \"underline\", size = \"medium\", className, ...rest }, ref) => {\n const Component = asChild ? Slot : \"a\";\n return (\n <Component\n className={clsx(\n \"hds-link\",\n variant !== \"underline\" && `hds-link--${variant}`,\n size !== \"medium\" && `hds-link--${size}`,\n className as undefined,\n )}\n ref={ref}\n {...rest}\n >\n {children}\n </Component>\n );\n },\n);\nLink.displayName = \"Link\";\n"],"mappings":";;;;;;;AAAA,OAAuB;AACvB,SAAS,YAAY;AACrB,SAAS,kBAAkB;AAC3B,SAAS,YAAY;AA2Bf;AAJC,IAAM,OAAO;AAAA,EAClB,CAAC,IAAmF,QAAQ;AAA3F,iBAAE,WAAS,UAAU,UAAU,aAAa,OAAO,UAAU,UA3BhE,IA2BG,IAA2E,iBAA3E,IAA2E,CAAzE,WAAS,YAAU,WAAuB,QAAiB;AAC5D,UAAM,YAAY,UAAU,OAAO;AACnC,WACE;AAAA,MAAC;AAAA;AAAA,QACC,WAAW;AAAA,UACT;AAAA,UACA,YAAY,eAAe,aAAa,OAAO;AAAA,UAC/C,SAAS,YAAY,aAAa,IAAI;AAAA,UACtC;AAAA,QACF;AAAA,QACA;AAAA,SACI,OARL;AAAA,QAUE;AAAA;AAAA,IACH;AAAA,EAEJ;AACF;AACA,KAAK,cAAc;","names":[]}