@postenbring/hedwig-react 1.3.2 → 1.4.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/dist/index.mjs CHANGED
@@ -2,10 +2,6 @@ import "./chunk-3D2MWIEX.mjs";
2
2
  import {
3
3
  WarningBanner
4
4
  } from "./chunk-EMQB6JIS.mjs";
5
- import "./chunk-CSXSUQ2M.mjs";
6
- import {
7
- Text
8
- } from "./chunk-DMOMTRIY.mjs";
9
5
  import "./chunk-7YWW46R3.mjs";
10
6
  import {
11
7
  Tabs
@@ -19,6 +15,10 @@ import {
19
15
  TabsTab
20
16
  } from "./chunk-J5SCUELT.mjs";
21
17
  import "./chunk-KQITCS3U.mjs";
18
+ import "./chunk-CSXSUQ2M.mjs";
19
+ import {
20
+ Text
21
+ } from "./chunk-DMOMTRIY.mjs";
22
22
  import "./chunk-AJFQHFQT.mjs";
23
23
  import {
24
24
  Spinner
@@ -27,14 +27,14 @@ import "./chunk-TJH5QJMS.mjs";
27
27
  import {
28
28
  StepIndicator
29
29
  } from "./chunk-XQBJ75VD.mjs";
30
- import "./chunk-3LYJRAOC.mjs";
31
- import {
32
- Table
33
- } from "./chunk-ZOZPWP3N.mjs";
34
30
  import "./chunk-JKCVB5TR.mjs";
35
31
  import {
36
32
  StyledHtml
37
33
  } from "./chunk-EGW3RCXD.mjs";
34
+ import "./chunk-3LYJRAOC.mjs";
35
+ import {
36
+ Table
37
+ } from "./chunk-ZOZPWP3N.mjs";
38
38
  import "./chunk-H3E546OT.mjs";
39
39
  import {
40
40
  Navbar,
@@ -53,14 +53,14 @@ import {
53
53
  useNavbarExpendableMenuContext
54
54
  } from "./chunk-ZV4GTALL.mjs";
55
55
  import "./chunk-XMDDGSCF.mjs";
56
- import "./chunk-SRLM3K2X.mjs";
57
- import {
58
- ShowMoreButton
59
- } from "./chunk-JUHJZLH2.mjs";
60
56
  import "./chunk-JTZPQHKD.mjs";
61
57
  import {
62
58
  Skeleton
63
59
  } from "./chunk-WLESNP6Z.mjs";
60
+ import "./chunk-SRLM3K2X.mjs";
61
+ import {
62
+ ShowMoreButton
63
+ } from "./chunk-JUHJZLH2.mjs";
64
64
  import "./chunk-FYFJ75NX.mjs";
65
65
  import {
66
66
  Modal,
@@ -74,10 +74,6 @@ import "./chunk-AGZHQDCQ.mjs";
74
74
  import {
75
75
  Textarea
76
76
  } from "./chunk-JEAGKB4V.mjs";
77
- import "./chunk-BYEJZSG5.mjs";
78
- import {
79
- Select
80
- } from "./chunk-AXEAIXG7.mjs";
81
77
  import "./chunk-XAFNJELJ.mjs";
82
78
  import {
83
79
  RadioButton
@@ -86,6 +82,10 @@ import {
86
82
  RadioGroup,
87
83
  useRadioGroupContext
88
84
  } from "./chunk-E6OOFTRQ.mjs";
85
+ import "./chunk-BYEJZSG5.mjs";
86
+ import {
87
+ Select
88
+ } from "./chunk-AXEAIXG7.mjs";
89
89
  import "./chunk-KPPLVGZ3.mjs";
90
90
  import {
91
91
  ErrorSummary
@@ -157,6 +157,18 @@ import {
157
157
  Link
158
158
  } from "./chunk-VYS2QNTL.mjs";
159
159
  import "./chunk-ARHJZUZG.mjs";
160
+ import {
161
+ Card,
162
+ CardBody,
163
+ CardBodyAction,
164
+ CardBodyActionArrow,
165
+ CardBodyDescription,
166
+ CardBodyHeader,
167
+ CardBodyHeaderOverline,
168
+ CardBodyHeaderTitle,
169
+ CardMedia,
170
+ CardMediaImg
171
+ } from "./chunk-IEDOH22E.mjs";
160
172
  import "./chunk-2YL2MVWN.mjs";
161
173
  import {
162
174
  DescriptionList
@@ -180,9 +192,6 @@ import {
180
192
  UnorderedList
181
193
  } from "./chunk-LGEGXOPU.mjs";
182
194
  import "./chunk-HT2EIJAD.mjs";
183
- import {
184
- Button
185
- } from "./chunk-AYCHNAU7.mjs";
186
195
  import "./chunk-K6PP3ACJ.mjs";
187
196
  import "./chunk-KFDS3IPB.mjs";
188
197
  import {
@@ -198,17 +207,8 @@ import {
198
207
  Breadcrumbs
199
208
  } from "./chunk-A42PXOVR.mjs";
200
209
  import {
201
- Card,
202
- CardBody,
203
- CardBodyAction,
204
- CardBodyActionArrow,
205
- CardBodyDescription,
206
- CardBodyHeader,
207
- CardBodyHeaderOverline,
208
- CardBodyHeaderTitle,
209
- CardMedia,
210
- CardMediaImg
211
- } from "./chunk-AZ6X4L5C.mjs";
210
+ Button
211
+ } from "./chunk-AYCHNAU7.mjs";
212
212
  import "./chunk-ZKMFJZSH.mjs";
213
213
  import {
214
214
  Accordion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@postenbring/hedwig-react",
3
- "version": "1.3.2",
3
+ "version": "1.4.0",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",
@@ -23,15 +23,15 @@
23
23
  "hedwig-tsconfig": "0.0.0"
24
24
  },
25
25
  "peerDependencies": {
26
- "@types/react": "^17.0.0 || ^18.0.0",
27
- "@types/react-dom": "^17.0.0 || ^18.0.0",
28
- "react": "^17.0.0 || ^18.0.0",
29
- "react-dom": "^17.0.0 || ^18.0.0"
26
+ "@types/react": "^17.0.0 || ^18.0.0 || ^19.0.0",
27
+ "@types/react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0",
28
+ "react": "^17.0.0 || ^18.0.0 || ^19.0.0",
29
+ "react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0"
30
30
  },
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.4.1"
34
+ "@postenbring/hedwig-css": "1.5.0"
35
35
  },
36
36
  "publishConfig": {
37
37
  "access": "public"
package/src/card/card.tsx CHANGED
@@ -150,14 +150,25 @@ interface CardBodyActionArrowProps extends React.HTMLAttributes<HTMLSpanElement>
150
150
  * @default false
151
151
  */
152
152
  asChild?: boolean;
153
+
154
+ /**
155
+ * Set direction of the arrow
156
+ *
157
+ * @default "right"
158
+ */
159
+ direction?: "right" | "up-right";
153
160
  }
154
161
  export const CardBodyActionArrow = forwardRef<HTMLSpanElement, CardBodyActionArrowProps>(
155
- ({ asChild, className, ...rest }, ref) => {
162
+ ({ asChild, className, direction, ...rest }, ref) => {
156
163
  const Component = asChild ? Slot : "span";
157
164
  return (
158
165
  <Component
159
166
  {...rest}
160
- className={clsx("hds-card__body-action-arrow", className as undefined)}
167
+ className={clsx(
168
+ "hds-card__body-action-arrow",
169
+ { "hds-card__body-action-arrow-up-right": direction === "up-right" },
170
+ className as undefined,
171
+ )}
161
172
  ref={ref}
162
173
  />
163
174
  );
@@ -178,20 +189,48 @@ export interface CardBaseProps extends React.HTMLAttributes<HTMLDivElement> {
178
189
 
179
190
  export interface CardProps extends CardBaseProps {
180
191
  /**
181
- * A Card should in most cases appear as a big link,
182
- * but the actual link should just be the header title.
183
- * To make life better for those with screen readers we should not make
184
- * the entire card a link, as that would cause the entire card to be read
185
- * as a link to the user. That would be perceived as information overload.
192
+ * Change the default rendered element for Card.
186
193
  */
187
194
  as?: "section" | "div" | "article" | "aside";
195
+ /**
196
+ * Allows for a horizontal variant for sizes above small.
197
+ *
198
+ * @default "slim"
199
+ */
200
+ variant?: "slim" | "full-width" | "miniature" | "focus";
201
+ /**
202
+ * The color of the card.
203
+ *
204
+ * @default "lighter-brand"
205
+ * */
206
+ color?: "white" | "lighter-brand" | "light-grey-fill";
207
+ }
208
+
209
+ interface CardFocusProps extends CardBaseProps {
210
+ as?: "section" | "div" | "article" | "aside";
211
+ variant: "focus";
212
+ color: "darker";
188
213
  }
189
214
 
190
- export const Card = forwardRef<HTMLDivElement, CardProps>(
191
- ({ as: Tag = "section", asChild, className, children, ...rest }, ref) => {
215
+ export const Card = forwardRef<HTMLDivElement, CardProps | CardFocusProps>(
216
+ ({ as: Tag = "section", asChild, className, children, variant, color, ...rest }, ref) => {
192
217
  const Component = asChild ? Slot : Tag;
218
+ const effectiveColor = variant === "focus" && !color ? "darker" : color;
193
219
  return (
194
- <Component {...rest} className={clsx("hds-card", className as undefined)} ref={ref}>
220
+ <Component
221
+ {...rest}
222
+ className={clsx(
223
+ "hds-card",
224
+ { "hds-card--full-width": variant === "full-width" },
225
+ { "hds-card--miniature": variant === "miniature" },
226
+ { "hds-card--focus": variant === "focus" },
227
+ { "hds-card--color-white": effectiveColor === "white" },
228
+ { "hds-card--color-light-grey-fill": effectiveColor === "light-grey-fill" },
229
+ { "hds-card--color-darker": effectiveColor === "darker" },
230
+ className as undefined,
231
+ )}
232
+ ref={ref}
233
+ >
195
234
  {children}
196
235
  </Component>
197
236
  );
@@ -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}\nexport const CardBodyActionArrow = forwardRef<HTMLSpanElement, CardBodyActionArrowProps>(\n ({ asChild, className, ...rest }, ref) => {\n const Component = asChild ? Slot : \"span\";\n return (\n <Component\n {...rest}\n className={clsx(\"hds-card__body-action-arrow\", className as undefined)}\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 * A Card should in most cases appear as a big link,\n * but the actual link should just be the header title.\n * To make life better for those with screen readers we should not make\n * the entire card a link, as that would cause the entire card to be read\n * as a link to the user. That would be perceived as information overload.\n */\n as?: \"section\" | \"div\" | \"article\" | \"aside\";\n}\n\nexport const Card = forwardRef<HTMLDivElement, CardProps>(\n ({ as: Tag = \"section\", asChild, className, children, ...rest }, ref) => {\n const Component = asChild ? Slot : Tag;\n return (\n <Component {...rest} className={clsx(\"hds-card\", className as undefined)} ref={ref}>\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,SANzB,IAMG,IAAmC,iBAAnC,IAAmC,CAAjC,WAAS,aAAW;AACrB,UAAM,YAAY,UAAU,OAAO;AACnC,WACE,oBAAC,4CAAc,OAAd,EAAoB,WAAW,KAAK,mBAAmB,SAAsB,GAAG,KAC9E,WACH;AAAA,EAEJ;AACF;AACA,UAAU,cAAc;AAUjB,IAAM,eAAe;AAAA,EAC1B,CAAC,IAAiC,QAAQ;AAAzC,iBAAE,WAAS,UA1Bd,IA0BG,IAAyB,iBAAzB,IAAyB,CAAvB,WAAS;AACV,UAAM,YAAY,UAAU,OAAO;AACnC,WACE;AAAA,MAAC;AAAA,uCACK,OADL;AAAA,QAEC,WAAW,KAAK,wBAAwB,SAAsB;AAAA,QAC9D;AAAA;AAAA,IACF;AAAA,EAEJ;AACF;AACA,aAAa,cAAc;AAEpB,IAAM,WAAW;AAAA,EACtB,CAAC,IAA2C,QAAQ;AAAnD,iBAAE,WAAS,WAAW,SAxCzB,IAwCG,IAAmC,iBAAnC,IAAmC,CAAjC,WAAS,aAAW;AACrB,UAAM,YAAY,UAAU,OAAO;AACnC,WACE,oBAAC,4CAAc,OAAd,EAAoB,WAAW,KAAK,kBAAkB,SAAsB,GAAG,KAC7E,WACH;AAAA,EAEJ;AACF;AACA,SAAS,cAAc;AAEhB,IAAM,iBAAiB,WAgB5B,CAAC,IAAoD,QAAQ;A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