@postenbring/hedwig-react 4.3.0 → 4.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
@@ -6,14 +6,14 @@ import "./chunk-3D2MWIEX.mjs";
6
6
  import {
7
7
  WarningBanner
8
8
  } from "./chunk-EMQB6JIS.mjs";
9
- import "./chunk-3LYJRAOC.mjs";
10
- import {
11
- Table
12
- } from "./chunk-ZOZPWP3N.mjs";
13
9
  import "./chunk-JKCVB5TR.mjs";
14
10
  import {
15
11
  StyledHtml
16
12
  } from "./chunk-I76U35YW.mjs";
13
+ import "./chunk-3LYJRAOC.mjs";
14
+ import {
15
+ Table
16
+ } from "./chunk-ZOZPWP3N.mjs";
17
17
  import "./chunk-7YWW46R3.mjs";
18
18
  import {
19
19
  Tabs
@@ -27,10 +27,6 @@ import {
27
27
  TabsTab
28
28
  } from "./chunk-WVCJV74B.mjs";
29
29
  import "./chunk-KQITCS3U.mjs";
30
- import "./chunk-SRLM3K2X.mjs";
31
- import {
32
- ShowMoreButton
33
- } from "./chunk-JUHJZLH2.mjs";
34
30
  import "./chunk-JTZPQHKD.mjs";
35
31
  import {
36
32
  Skeleton
@@ -43,12 +39,6 @@ import "./chunk-TJH5QJMS.mjs";
43
39
  import {
44
40
  StepIndicator
45
41
  } from "./chunk-XQBJ75VD.mjs";
46
- import "./chunk-RC76SXBP.mjs";
47
- import {
48
- Message,
49
- MessageDescription,
50
- MessageTitle
51
- } from "./chunk-ILN2L5NX.mjs";
52
42
  import "./chunk-FYFJ75NX.mjs";
53
43
  import {
54
44
  Modal,
@@ -56,6 +46,10 @@ import {
56
46
  ModalFooter,
57
47
  ModalHeader
58
48
  } from "./chunk-YQT2TN3U.mjs";
49
+ import "./chunk-SRLM3K2X.mjs";
50
+ import {
51
+ ShowMoreButton
52
+ } from "./chunk-JUHJZLH2.mjs";
59
53
  import "./chunk-H3E546OT.mjs";
60
54
  import {
61
55
  Navbar,
@@ -91,6 +85,12 @@ import {
91
85
  } from "./chunk-FUIKSOJF.mjs";
92
86
  import "./chunk-7ROE6ADK.mjs";
93
87
  import "./chunk-NE6W2PCD.mjs";
88
+ import "./chunk-RC76SXBP.mjs";
89
+ import {
90
+ Message,
91
+ MessageDescription,
92
+ MessageTitle
93
+ } from "./chunk-ILN2L5NX.mjs";
94
94
  import "./chunk-2YL2MVWN.mjs";
95
95
  import "./chunk-K2CB2NLY.mjs";
96
96
  import {
@@ -104,6 +104,10 @@ import {
104
104
  FooterLinkSections,
105
105
  FooterLogo
106
106
  } from "./chunk-QDG2QLFV.mjs";
107
+ import "./chunk-CFAH2LID.mjs";
108
+ import {
109
+ HelpText
110
+ } from "./chunk-INDTHGWZ.mjs";
107
111
  import "./chunk-5J5LYE6Z.mjs";
108
112
  import "./chunk-XSID7YR7.mjs";
109
113
  import {
@@ -120,27 +124,33 @@ import "./chunk-AGZHQDCQ.mjs";
120
124
  import {
121
125
  Textarea
122
126
  } from "./chunk-OQD4GKOS.mjs";
123
- import "./chunk-7LPYJC6S.mjs";
127
+ import "./chunk-XAFNJELJ.mjs";
124
128
  import {
125
- Input
126
- } from "./chunk-62VLFCXX.mjs";
127
- import "./chunk-CAIGPMDS.mjs";
129
+ RadioButton
130
+ } from "./chunk-DOW6EHBI.mjs";
128
131
  import {
129
- SearchWrapper
130
- } from "./chunk-RJ763KDH.mjs";
132
+ RadioGroup,
133
+ useRadioGroupContext
134
+ } from "./chunk-QER35NXN.mjs";
131
135
  import "./chunk-BYEJZSG5.mjs";
132
136
  import {
133
137
  Select
134
138
  } from "./chunk-JGQTAIEP.mjs";
139
+ import "./chunk-CAIGPMDS.mjs";
140
+ import {
141
+ SearchWrapper
142
+ } from "./chunk-RJ763KDH.mjs";
135
143
  import "./chunk-KPPLVGZ3.mjs";
136
- import "./chunk-XAFNJELJ.mjs";
144
+ import "./chunk-7LPYJC6S.mjs";
137
145
  import {
138
- RadioButton
139
- } from "./chunk-DOW6EHBI.mjs";
146
+ Input
147
+ } from "./chunk-62VLFCXX.mjs";
148
+ import "./chunk-TDLSHJ4Z.mjs";
140
149
  import {
141
- RadioGroup,
142
- useRadioGroupContext
143
- } from "./chunk-QER35NXN.mjs";
150
+ DatePicker
151
+ } from "./chunk-RGZSYJFL.mjs";
152
+ import "./chunk-Y5SUMFYJ.mjs";
153
+ import "./chunk-DMRQEQQK.mjs";
144
154
  import "./chunk-YJOOSTJC.mjs";
145
155
  import {
146
156
  Checkbox
@@ -156,12 +166,6 @@ import {
156
166
  import {
157
167
  FieldsetLegend
158
168
  } from "./chunk-CD4LCDK3.mjs";
159
- import "./chunk-TDLSHJ4Z.mjs";
160
- import {
161
- DatePicker
162
- } from "./chunk-RGZSYJFL.mjs";
163
- import "./chunk-Y5SUMFYJ.mjs";
164
- import "./chunk-DMRQEQQK.mjs";
165
169
  import "./chunk-NSLSA7F7.mjs";
166
170
  import {
167
171
  ErrorMessage
@@ -186,15 +190,11 @@ import {
186
190
  OrderedList,
187
191
  UnorderedList
188
192
  } from "./chunk-3QHKPEXO.mjs";
189
- import "./chunk-CFAH2LID.mjs";
190
- import {
191
- HelpText
192
- } from "./chunk-INDTHGWZ.mjs";
193
- import "./chunk-ISAHCU7C.mjs";
194
193
  import "./chunk-HT2EIJAD.mjs";
194
+ import "./chunk-ISAHCU7C.mjs";
195
195
  import {
196
- Button
197
- } from "./chunk-45Q2TCH6.mjs";
196
+ Breadcrumbs
197
+ } from "./chunk-A42PXOVR.mjs";
198
198
  import "./chunk-Y6NOEN7R.mjs";
199
199
  import {
200
200
  ButtonList
@@ -211,7 +211,7 @@ import {
211
211
  CardBodyHeaderTitle,
212
212
  CardMedia,
213
213
  CardMediaImg
214
- } from "./chunk-TTDR3NZL.mjs";
214
+ } from "./chunk-EWZYDO7Z.mjs";
215
215
  import {
216
216
  DescriptionList
217
217
  } from "./chunk-C7ZTOZP3.mjs";
@@ -226,8 +226,8 @@ import {
226
226
  } from "./chunk-NZB6BBFT.mjs";
227
227
  import "./chunk-BCFV6VOE.mjs";
228
228
  import {
229
- Breadcrumbs
230
- } from "./chunk-A42PXOVR.mjs";
229
+ Button
230
+ } from "./chunk-45Q2TCH6.mjs";
231
231
  import "./chunk-ZKMFJZSH.mjs";
232
232
  import {
233
233
  Accordion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@postenbring/hedwig-react",
3
- "version": "4.3.0",
3
+ "version": "4.4.0",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",
@@ -31,7 +31,7 @@
31
31
  "dependencies": {
32
32
  "@radix-ui/react-popover": "1.1.23",
33
33
  "@radix-ui/react-slot": "1.3.3",
34
- "@postenbring/hedwig-css": "4.3.0"
34
+ "@postenbring/hedwig-css": "4.4.0"
35
35
  },
36
36
  "publishConfig": {
37
37
  "access": "public"
@@ -24,9 +24,9 @@ export const Preview: Story = {
24
24
  />
25
25
  </Card.Media>
26
26
  <Card.Body>
27
- <Card.BodyHeader as="h2">
27
+ <Card.BodyHeader>
28
28
  <Card.BodyHeaderOverline>Theme</Card.BodyHeaderOverline>
29
- <Card.BodyHeaderTitle>Cool article</Card.BodyHeaderTitle>
29
+ <Card.BodyHeaderTitle as="h2">Cool article</Card.BodyHeaderTitle>
30
30
  </Card.BodyHeader>
31
31
  <Card.BodyDescription>
32
32
  This is a card The card component provides a lot of flexibility.
package/src/card/card.tsx CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { ReactNode } from "react";
2
- import { forwardRef } from "react";
2
+ import { createContext, forwardRef, useContext } from "react";
3
3
  import { clsx } from "@postenbring/hedwig-css/typed-classname";
4
4
  import { Slot } from "@radix-ui/react-slot";
5
5
 
@@ -63,39 +63,64 @@ export const CardBody = forwardRef<HTMLDivElement, CardBaseProps>(
63
63
  );
64
64
  CardBody.displayName = "Card.Body";
65
65
 
66
+ /**
67
+ * This is the current interface of CardBodyHeader
68
+ */
69
+ export interface CardBodyHeaderProps extends React.HtmlHTMLAttributes<HTMLElement> {
70
+ asChild?: boolean;
71
+ /**
72
+ * This element is always an hgroup
73
+ */
74
+ as?: never;
75
+ }
76
+
77
+ type CardBodyHeaderTag = "h2" | "h3" | "h4" | "h5" | "h6";
78
+
79
+ const CardBodyHeaderContext = createContext<CardBodyHeaderTag>("h2");
80
+
81
+ /**
82
+ * @deprecated This interface is deprecated and will be removed in a future release.
83
+ * Set the `as` prop on CardBodyHeaderTitle instead
84
+ */
85
+ export interface CardBodyHeaderPropsDeprecated extends React.HTMLAttributes<HTMLHeadingElement> {
86
+ /**
87
+ * Change the default rendered element for the one passed as a child, merging their props and behavior.
88
+ *
89
+ * @default false
90
+ */
91
+ asChild?: boolean;
92
+
93
+ /**
94
+ * Heading level of the card heading.
95
+ * Will affect the CardBodyHeaderTitle for backwards compability
96
+ *
97
+ * @deprecated This prop will be removed in a future release. Set it on CardBodyHeaderTitle instead.
98
+ */
99
+ as?: CardBodyHeaderTag;
100
+ }
101
+
66
102
  export const CardBodyHeader = forwardRef<
67
- HTMLHeadingElement,
68
- CardBaseProps &
69
- (
70
- | {
71
- /**
72
- * Heading level of the card heading
73
- */
74
- as: "h2" | "h3" | "h4" | "h5" | "h6";
75
- asChild?: never;
76
- }
77
- | {
78
- asChild: true;
79
- as?: never;
80
- }
81
- )
103
+ HTMLElement,
104
+ CardBodyHeaderProps | CardBodyHeaderPropsDeprecated
82
105
  >(({ as: Tag, asChild, className, children, ...rest }, ref) => {
83
- const Component = asChild ? Slot : Tag;
106
+ const Component = asChild ? Slot : "hgroup";
84
107
  return (
85
- <Component
86
- {...rest}
87
- className={clsx("hds-card__body-header", className as undefined)}
88
- ref={ref}
89
- >
90
- {children}
91
- </Component>
108
+ <CardBodyHeaderContext.Provider value={Tag ?? "h2"}>
109
+ <Component
110
+ {...rest}
111
+ className={clsx("hds-card__body-header", className as undefined)}
112
+ ref={ref}
113
+ >
114
+ {children}
115
+ </Component>
116
+ </CardBodyHeaderContext.Provider>
92
117
  );
93
118
  });
94
119
  CardBodyHeader.displayName = "Card.BodyHeader";
95
120
 
96
- export const CardBodyHeaderOverline = forwardRef<HTMLDivElement, CardBaseProps>(
121
+ export const CardBodyHeaderOverline = forwardRef<HTMLParagraphElement, CardBaseProps>(
97
122
  ({ asChild, className, children, ...rest }, ref) => {
98
- const Component = asChild ? Slot : "span";
123
+ const Component = asChild ? Slot : "p";
99
124
  return (
100
125
  <Component
101
126
  {...rest}
@@ -109,13 +134,35 @@ export const CardBodyHeaderOverline = forwardRef<HTMLDivElement, CardBaseProps>(
109
134
  );
110
135
  CardBodyHeaderOverline.displayName = "Card.BodyHeaderOverline";
111
136
 
112
- export const CardBodyHeaderTitle = forwardRef<HTMLDivElement, CardBaseProps>(
113
- ({ asChild, className, children, ...rest }, ref) => {
114
- const Component = asChild ? Slot : "div";
137
+ export interface CardBodyHeaderTitleProps extends CardBaseProps {
138
+ /**
139
+ * Heading level of the card title.
140
+ */
141
+ as?: "h1" | "h2" | "h3" | "h4" | "h5" | "h6";
142
+
143
+ /**
144
+ * Displayed font size of Card title
145
+ * These will not be displayed in Miniature Card
146
+ * Should probably not be used in Slim Card
147
+ *
148
+ * @default: h2
149
+ */
150
+ variant?: "h1" | "h2";
151
+ }
152
+
153
+ export const CardBodyHeaderTitle = forwardRef<HTMLHeadingElement, CardBodyHeaderTitleProps>(
154
+ ({ as: TitleTag, variant = "h2", asChild, className, children, ...rest }, ref) => {
155
+ const ParentTag = useContext(CardBodyHeaderContext);
156
+ const Tag = TitleTag ?? ParentTag;
157
+ const Component = asChild ? Slot : Tag;
115
158
  return (
116
159
  <Component
117
160
  {...rest}
118
- className={clsx("hds-card__body-header-title", className as undefined)}
161
+ className={clsx(
162
+ "hds-card__body-header-title",
163
+ { "hds-card__body-header-title-h1": variant === "h1" },
164
+ className as undefined,
165
+ )}
119
166
  ref={ref}
120
167
  >
121
168
  {children}
@@ -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 /**\n * Define image scaling behavior when the image are varies in both width and height across different page breaks and sizes of the card.\n * \"crop\": Image always fills the available space.\n * If the aspect ratio doesn't match, then the top/bottom or left/right edges are cropped away.\n * \"scale\": No cropping, image scales to the maximum size available and centers.\n * If the aspect ratio doesn't match, then the background will show on the top/bottom or left/right sides of the image.\n *\n * @default \"scale\"\n */\n variant?: \"crop\" | \"scale\";\n}\nexport const CardMediaImg = forwardRef<HTMLImageElement, CardImageMediaProps>(\n ({ asChild, variant, className, ...rest }, ref) => {\n const Component = asChild ? Slot : \"img\";\n return (\n <Component\n {...rest}\n className={clsx(\n \"hds-card__media__img\",\n { \"hds-card__img__crop\": variant === \"crop\" },\n className as undefined,\n )}\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 <div className={clsx(\"hds-card__centerbody\", className as undefined)}>{children}</div>\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\nexport const CardBodyActionRow = 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-row\", className as undefined)}\n ref={ref}\n >\n {children}\n </Component>\n );\n },\n);\nCardBodyActionRow.displayName = \"Card.BodyActionRow\";\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\n/**\n * @deprecated This interface is deprecated and will be removed in a future release.\n * Use `CardSlimAndMiniatureProps` with props `data-color` and `theme` instead.\n */\nexport interface CardSlimAndMiniaturePropsDeprecated 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\" | \"miniature\";\n \"data-color\"?: never;\n theme?: never;\n /**\n * @deprecated\n * Use props `data-color` and `theme` instead.\n * These colors will be removed in a future release.\n */\n color?: \"white\" | \"lighter-brand\" | \"light-grey-fill\";\n\n /* Only fullwidth or focus cards can have images to the left or right of the text: */\n imagePosition?: never;\n}\n\nexport interface CardSlimAndMiniatureProps 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\" | \"miniature\";\n /**\n * Set theme for card\n * @default \"default\"\n */\n theme?: \"default\" | \"tinted\" | \"base\";\n /**\n * Set data-color for card.\n */\n \"data-color\"?: \"neutral\" | \"posten\" | \"bring\";\n /* Only fullwidth or focus cards can have images to the left or right of the text: */\n imagePosition?: never;\n}\n\n/**\n * @deprecated Use Full-width card instead\n */\nexport interface CardFocusProps extends CardBaseProps {\n /**\n * Change the default rendered element for Card.\n */\n as?: \"section\" | \"div\" | \"article\" | \"aside\";\n /** @deprecated Use Full-width card instead */\n variant: \"focus\";\n /**\n * @deprecated\n * Use props `data-color` and `theme` instead.\n * The color prop will be removed in a future release.\n */\n color?: \"darker\" | \"dark\";\n \"data-color\"?: never;\n theme?: never;\n /**\n * fullwidth or focus cards can have images to the left or right of the text.\n *\n * @default \"left\"\n * */\n imagePosition?: \"left\" | \"right\";\n}\n\n/**\n * @deprecated This interface is deprecated and will be removed in a future release.\n * Use `CardSlimAndMiniatureProps` with props `data-color` and `theme` instead.\n */\nexport interface CardFullwidthPropsDeprecated extends CardBaseProps {\n /**\n * Change the default rendered element for Card.\n */\n as?: \"section\" | \"div\" | \"article\" | \"aside\";\n variant: \"full-width\";\n \"data-color\"?: never;\n theme?: never;\n /**\n * @deprecated\n * Use `data-color` and `theme` instead.\n * The color prop will be removed in a future release.\n */\n color: \"white\" | \"lighter-brand\" | \"light-grey-fill\";\n /**\n * fullwidth or focus cards can have images to the left or right of the text.\n *\n * @default \"left\"\n * */\n imagePosition?: \"left\" | \"right\";\n}\n\nexport interface CardFullwidthProps extends CardBaseProps {\n /**\n * Change the default rendered element for Card.\n */\n as?: \"section\" | \"div\" | \"article\" | \"aside\";\n variant: \"full-width\";\n /**\n * Set theme for card\n * @default \"default\"\n */\n theme?: \"default\" | \"tinted\" | \"base\";\n /**\n * Set data-color for card.\n */\n \"data-color\"?: \"neutral\" | \"posten\" | \"bring\";\n /**\n * fullwidth or focus cards can have images to the left or right of the text.\n *\n * @default \"left\"\n * */\n imagePosition?: \"left\" | \"right\";\n}\n\nexport type CardProps =\n | CardSlimAndMiniatureProps\n | CardFocusProps\n | CardFullwidthProps\n | CardSlimAndMiniaturePropsDeprecated\n | CardFullwidthPropsDeprecated;\n\n/**\n * Converts deprecated colors to current colors\n * @param color\n * @returns\n */\nconst convertDeprecatedColor = (\n color: string | undefined,\n): Partial<{\n theme: NonNullable<CardSlimAndMiniatureProps[\"theme\"]>;\n dataColor: NonNullable<CardSlimAndMiniatureProps[\"data-color\"]>;\n dataColorScheme: \"light\" | \"dark\";\n}> => {\n switch (color) {\n case \"lighter-brand\":\n return { theme: \"default\" };\n case \"light-grey-fill\":\n return { theme: \"base\", dataColor: \"neutral\" };\n case \"white\":\n return { theme: \"default\", dataColor: \"neutral\" };\n case \"dark\":\n return { theme: \"base\" };\n case \"darker\":\n return { theme: \"tinted\", dataColorScheme: \"dark\" };\n default:\n return {};\n }\n};\n\nexport const Card = forwardRef<HTMLDivElement, CardProps>(\n (\n {\n as: Tag = \"section\",\n asChild,\n className,\n children,\n variant = \"slim\",\n \"data-color\": dataColorAttr,\n theme = \"default\",\n color,\n imagePosition,\n ...rest\n },\n ref,\n ) => {\n const Component = asChild ? Slot : Tag;\n\n const {\n theme: themeFromDeprecated,\n dataColor: dataColorFromDeprecated,\n dataColorScheme: dataColorSchemeFromDeprecated,\n } = convertDeprecatedColor(color ?? (variant === \"focus\" ? \"darker\" : undefined));\n\n return (\n <Component\n {...rest}\n {...(dataColorAttr ? { \"data-color\": dataColorAttr } : {})}\n {...(dataColorFromDeprecated ? { \"data-color\": dataColorFromDeprecated } : {})}\n {...(dataColorSchemeFromDeprecated\n ? { \"data-color-scheme\": dataColorSchemeFromDeprecated }\n : {})}\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\" }, // @deprecated\n { \"hds-card--slim\": variant === \"slim\" },\n { \"hds-card--theme-default\": (themeFromDeprecated ?? theme) === \"default\" },\n { \"hds-card--theme-tinted\": (themeFromDeprecated ?? theme) === \"tinted\" },\n { \"hds-card--theme-base\": (themeFromDeprecated ?? theme) === \"base\" },\n { \"hds-card--image-position-right\": imagePosition === \"right\" },\n className as undefined,\n )}\n ref={ref}\n >\n {variant === \"full-width\" || variant === \"focus\" ? (\n <div className={clsx(\"hds-card__layoutwrapper\", className as undefined)}>{children}</div>\n ) : (\n children\n )}\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.BodyActionRow = CardBodyActionRow;\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 BodyActionRow: typeof CardBodyActionRow;\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,IAAm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