@postenbring/hedwig-react 1.4.2 → 2.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.
- package/dist/button/button.d.ts +13 -7
- package/dist/button/button.d.ts.map +1 -1
- package/dist/button/button.js +5 -3
- package/dist/button/button.js.map +1 -1
- package/dist/button/button.mjs +1 -1
- package/dist/button/index.js +5 -3
- package/dist/button/index.js.map +1 -1
- package/dist/button/index.mjs +1 -1
- package/dist/card/card.d.ts +38 -2
- package/dist/card/card.d.ts.map +1 -1
- package/dist/card/card.js +28 -5
- package/dist/card/card.js.map +1 -1
- package/dist/card/card.mjs +3 -1
- package/dist/card/index.js +26 -5
- package/dist/card/index.js.map +1 -1
- package/dist/card/index.mjs +1 -1
- package/dist/{chunk-6DWIJEHQ.mjs → chunk-444SCBJD.mjs} +3 -3
- package/dist/chunk-444SCBJD.mjs.map +1 -0
- package/dist/{chunk-VU2GCAM4.mjs → chunk-7WHIRDTL.mjs} +2 -2
- package/dist/{chunk-6VKQ6IRG.mjs → chunk-GXIKHXWC.mjs} +1 -1
- package/dist/chunk-GXIKHXWC.mjs.map +1 -0
- package/dist/{chunk-IEDOH22E.mjs → chunk-LDZIJR2D.mjs} +28 -6
- package/dist/chunk-LDZIJR2D.mjs.map +1 -0
- package/dist/{chunk-VYS2QNTL.mjs → chunk-OHDHIRAW.mjs} +5 -3
- package/dist/chunk-OHDHIRAW.mjs.map +1 -0
- package/dist/{chunk-AYCHNAU7.mjs → chunk-TYCGAA35.mjs} +6 -4
- package/dist/chunk-TYCGAA35.mjs.map +1 -0
- package/dist/footer/footer.js +6 -4
- package/dist/footer/footer.js.map +1 -1
- package/dist/footer/footer.mjs +2 -2
- package/dist/footer/index.js +6 -4
- package/dist/footer/index.js.map +1 -1
- package/dist/footer/index.mjs +2 -2
- package/dist/form/error-summary/error-summary.js +4 -2
- package/dist/form/error-summary/error-summary.js.map +1 -1
- package/dist/form/error-summary/error-summary.mjs +2 -2
- package/dist/form/error-summary/index.js +4 -2
- package/dist/form/error-summary/index.js.map +1 -1
- package/dist/form/error-summary/index.mjs +2 -2
- package/dist/form/index.js +4 -2
- package/dist/form/index.js.map +1 -1
- package/dist/form/index.mjs +15 -15
- package/dist/index.js +39 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +30 -30
- package/dist/link/index.js +4 -2
- package/dist/link/index.js.map +1 -1
- package/dist/link/index.mjs +1 -1
- package/dist/link/link.d.ts +10 -2
- package/dist/link/link.d.ts.map +1 -1
- package/dist/link/link.js +4 -2
- package/dist/link/link.js.map +1 -1
- package/dist/link/link.mjs +1 -1
- package/dist/modal/index.js.map +1 -1
- package/dist/modal/index.mjs +1 -1
- package/dist/modal/modal.d.ts +1 -1
- package/dist/modal/modal.js.map +1 -1
- package/dist/modal/modal.mjs +1 -1
- package/package.json +6 -6
- package/src/button/button.tsx +19 -10
- package/src/card/card.tsx +73 -10
- package/src/footer/footer.tsx +1 -1
- package/src/link/link.stories.tsx +1 -1
- package/src/link/link.tsx +19 -4
- package/src/modal/modal.stories.tsx +1 -1
- package/src/modal/modal.tsx +1 -1
- package/dist/chunk-6DWIJEHQ.mjs.map +0 -1
- package/dist/chunk-6VKQ6IRG.mjs.map +0 -1
- package/dist/chunk-AYCHNAU7.mjs.map +0 -1
- package/dist/chunk-IEDOH22E.mjs.map +0 -1
- package/dist/chunk-VYS2QNTL.mjs.map +0 -1
- /package/dist/{chunk-VU2GCAM4.mjs.map → chunk-7WHIRDTL.mjs.map} +0 -0
package/dist/button/button.d.ts
CHANGED
|
@@ -1,25 +1,30 @@
|
|
|
1
1
|
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
2
2
|
/**
|
|
3
3
|
* The height, font size and padding of the button
|
|
4
|
+
*
|
|
5
|
+
* @default "large"
|
|
4
6
|
*/
|
|
5
|
-
size?: "small" | "
|
|
7
|
+
size?: "small" | "large";
|
|
6
8
|
/**
|
|
7
9
|
* The background and fill of the button
|
|
8
10
|
*
|
|
9
11
|
* @default "primary"
|
|
10
12
|
*/
|
|
11
|
-
variant?: "primary" | "secondary" | "
|
|
13
|
+
variant?: "primary" | "secondary" | "tertiary" | "inverted";
|
|
12
14
|
/**
|
|
13
15
|
* Make the button use 100% width available.
|
|
14
16
|
* Using the "mobile" it only stretch to full width on smaller screens
|
|
15
17
|
*/
|
|
16
18
|
fullWidth?: boolean | "mobile";
|
|
17
19
|
/**
|
|
18
|
-
*
|
|
20
|
+
* Specify that there is an icon in the button.
|
|
21
|
+
* `icon`: There is only an icon in the button.
|
|
22
|
+
* `icon="leading"`: There is an icon before the text.
|
|
23
|
+
* `icon="trailing"`: There is an icon after the text.
|
|
19
24
|
*
|
|
20
|
-
*
|
|
25
|
+
* @default false
|
|
21
26
|
*/
|
|
22
|
-
icon?: boolean;
|
|
27
|
+
icon?: boolean | "leading" | "trailing";
|
|
23
28
|
/**
|
|
24
29
|
* Change the default rendered element for the one passed as a child, merging their props and behavior.
|
|
25
30
|
*
|
|
@@ -33,8 +38,9 @@ export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElemen
|
|
|
33
38
|
* @example
|
|
34
39
|
* <Button variant="primary">Primary</Button>
|
|
35
40
|
* <Button variant="secondary" size="large">Secondary</Button>
|
|
36
|
-
* <Button variant="
|
|
37
|
-
* <Button variant="
|
|
41
|
+
* <Button variant="inverted">Inverted</Button>
|
|
42
|
+
* <Button variant="tertiary" fullWidth="mobile">Tertiary</Button>
|
|
43
|
+
* <Button icon="leading"><LeadingIcon />Leading icon</Button>
|
|
38
44
|
*
|
|
39
45
|
* @example
|
|
40
46
|
* // If used for navigation use the `asChild` prop with a anchor element as a child.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../src/button/button.tsx"],"names":[],"mappings":"AAIA,MAAM,WAAW,WAAY,SAAQ,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC;IAChF
|
|
1
|
+
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../src/button/button.tsx"],"names":[],"mappings":"AAIA,MAAM,WAAW,WAAY,SAAQ,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC;IAChF;;;;OAIG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC;IAEzB;;;;OAIG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,WAAW,GAAG,UAAU,GAAG,UAAU,CAAC;IAE5D;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;IAE/B;;;;;;;OAOG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,UAAU,CAAC;IAExC;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,MAAM,2GAsClB,CAAC"}
|
package/dist/button/button.js
CHANGED
|
@@ -62,9 +62,9 @@ var Button = (0, import_react.forwardRef)(
|
|
|
62
62
|
asChild,
|
|
63
63
|
children,
|
|
64
64
|
variant = "primary",
|
|
65
|
-
size = "
|
|
65
|
+
size = "large",
|
|
66
66
|
fullWidth = false,
|
|
67
|
-
icon,
|
|
67
|
+
icon = false,
|
|
68
68
|
className
|
|
69
69
|
} = _b, rest = __objRest(_b, [
|
|
70
70
|
"asChild",
|
|
@@ -86,7 +86,9 @@ var Button = (0, import_react.forwardRef)(
|
|
|
86
86
|
{
|
|
87
87
|
"hds-button--full": fullWidth === true,
|
|
88
88
|
"hds-button--mobile-full": fullWidth === "mobile",
|
|
89
|
-
"hds-button--icon
|
|
89
|
+
"hds-button--only-icon": icon === true,
|
|
90
|
+
"hds-button--leading-icon": icon === "leading",
|
|
91
|
+
"hds-button--trailing-icon": icon === "trailing"
|
|
90
92
|
},
|
|
91
93
|
className
|
|
92
94
|
),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/button/button.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { Slot } from \"@radix-ui/react-slot\";\n\nexport interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n /**\n * The height, font size and padding of the button\n */\n size?: \"small\" | \"
|
|
1
|
+
{"version":3,"sources":["../../src/button/button.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { Slot } from \"@radix-ui/react-slot\";\n\nexport interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n /**\n * The height, font size and padding of the button\n *\n * @default \"large\"\n */\n size?: \"small\" | \"large\";\n\n /**\n * The background and fill of the button\n *\n * @default \"primary\"\n */\n variant?: \"primary\" | \"secondary\" | \"tertiary\" | \"inverted\";\n\n /**\n * Make the button use 100% width available.\n * Using the \"mobile\" it only stretch to full width on smaller screens\n */\n fullWidth?: boolean | \"mobile\";\n\n /**\n * Specify that there is an icon in the button.\n * `icon`: There is only an icon in the button.\n * `icon=\"leading\"`: There is an icon before the text.\n * `icon=\"trailing\"`: There is an icon after the text.\n *\n * @default false\n */\n icon?: boolean | \"leading\" | \"trailing\";\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 * Button component\n *\n * @example\n * <Button variant=\"primary\">Primary</Button>\n * <Button variant=\"secondary\" size=\"large\">Secondary</Button>\n * <Button variant=\"inverted\">Inverted</Button>\n * <Button variant=\"tertiary\" fullWidth=\"mobile\">Tertiary</Button>\n * <Button icon=\"leading\"><LeadingIcon />Leading icon</Button>\n *\n * @example\n * // If used for navigation use the `asChild` prop with a anchor element as a child.\n * <Button asChild><a href=\"/home\">Home</a></Button>\n */\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(\n (\n {\n asChild,\n children,\n variant = \"primary\",\n size = \"large\",\n fullWidth = false,\n icon = false,\n className,\n ...rest\n },\n ref,\n ) => {\n const Component = asChild ? Slot : \"button\";\n\n return (\n <Component\n className={clsx(\n \"hds-button\",\n `hds-button--${size}`,\n `hds-button--${variant}`,\n {\n \"hds-button--full\": fullWidth === true,\n \"hds-button--mobile-full\": fullWidth === \"mobile\",\n \"hds-button--only-icon\": icon === true,\n \"hds-button--leading-icon\": icon === \"leading\",\n \"hds-button--trailing-icon\": icon === \"trailing\",\n },\n className as undefined,\n )}\n ref={ref}\n {...rest}\n >\n {children}\n </Component>\n );\n },\n);\nButton.displayName = \"Button\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA2B;AAC3B,6BAAqB;AACrB,wBAAqB;AAwEf;AAjBC,IAAM,aAAS;AAAA,EACpB,CACE,IAUA,QACG;AAXH,iBACE;AAAA;AAAA,MACA;AAAA,MACA,UAAU;AAAA,MACV,OAAO;AAAA,MACP,YAAY;AAAA,MACZ,OAAO;AAAA,MACP;AAAA,IAlEN,IA2DI,IAQK,iBARL,IAQK;AAAA,MAPH;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAKF,UAAM,YAAY,UAAU,yBAAO;AAEnC,WACE;AAAA,MAAC;AAAA;AAAA,QACC,eAAW;AAAA,UACT;AAAA,UACA,eAAe,IAAI;AAAA,UACnB,eAAe,OAAO;AAAA,UACtB;AAAA,YACE,oBAAoB,cAAc;AAAA,YAClC,2BAA2B,cAAc;AAAA,YACzC,yBAAyB,SAAS;AAAA,YAClC,4BAA4B,SAAS;AAAA,YACrC,6BAA6B,SAAS;AAAA,UACxC;AAAA,UACA;AAAA,QACF;AAAA,QACA;AAAA,SACI,OAfL;AAAA,QAiBE;AAAA;AAAA,IACH;AAAA,EAEJ;AACF;AACA,OAAO,cAAc;","names":[]}
|
package/dist/button/button.mjs
CHANGED
package/dist/button/index.js
CHANGED
|
@@ -64,9 +64,9 @@ var Button = (0, import_react.forwardRef)(
|
|
|
64
64
|
asChild,
|
|
65
65
|
children,
|
|
66
66
|
variant = "primary",
|
|
67
|
-
size = "
|
|
67
|
+
size = "large",
|
|
68
68
|
fullWidth = false,
|
|
69
|
-
icon,
|
|
69
|
+
icon = false,
|
|
70
70
|
className
|
|
71
71
|
} = _b, rest = __objRest(_b, [
|
|
72
72
|
"asChild",
|
|
@@ -88,7 +88,9 @@ var Button = (0, import_react.forwardRef)(
|
|
|
88
88
|
{
|
|
89
89
|
"hds-button--full": fullWidth === true,
|
|
90
90
|
"hds-button--mobile-full": fullWidth === "mobile",
|
|
91
|
-
"hds-button--icon
|
|
91
|
+
"hds-button--only-icon": icon === true,
|
|
92
|
+
"hds-button--leading-icon": icon === "leading",
|
|
93
|
+
"hds-button--trailing-icon": icon === "trailing"
|
|
92
94
|
},
|
|
93
95
|
className
|
|
94
96
|
),
|
package/dist/button/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/button/index.tsx","../../src/button/button.tsx"],"sourcesContent":["export { Button } from \"./button\";\n\nexport type * from \"./button\";\n","import { forwardRef } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { Slot } from \"@radix-ui/react-slot\";\n\nexport interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n /**\n * The height, font size and padding of the button\n */\n size?: \"small\" | \"
|
|
1
|
+
{"version":3,"sources":["../../src/button/index.tsx","../../src/button/button.tsx"],"sourcesContent":["export { Button } from \"./button\";\n\nexport type * from \"./button\";\n","import { forwardRef } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { Slot } from \"@radix-ui/react-slot\";\n\nexport interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n /**\n * The height, font size and padding of the button\n *\n * @default \"large\"\n */\n size?: \"small\" | \"large\";\n\n /**\n * The background and fill of the button\n *\n * @default \"primary\"\n */\n variant?: \"primary\" | \"secondary\" | \"tertiary\" | \"inverted\";\n\n /**\n * Make the button use 100% width available.\n * Using the \"mobile\" it only stretch to full width on smaller screens\n */\n fullWidth?: boolean | \"mobile\";\n\n /**\n * Specify that there is an icon in the button.\n * `icon`: There is only an icon in the button.\n * `icon=\"leading\"`: There is an icon before the text.\n * `icon=\"trailing\"`: There is an icon after the text.\n *\n * @default false\n */\n icon?: boolean | \"leading\" | \"trailing\";\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 * Button component\n *\n * @example\n * <Button variant=\"primary\">Primary</Button>\n * <Button variant=\"secondary\" size=\"large\">Secondary</Button>\n * <Button variant=\"inverted\">Inverted</Button>\n * <Button variant=\"tertiary\" fullWidth=\"mobile\">Tertiary</Button>\n * <Button icon=\"leading\"><LeadingIcon />Leading icon</Button>\n *\n * @example\n * // If used for navigation use the `asChild` prop with a anchor element as a child.\n * <Button asChild><a href=\"/home\">Home</a></Button>\n */\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(\n (\n {\n asChild,\n children,\n variant = \"primary\",\n size = \"large\",\n fullWidth = false,\n icon = false,\n className,\n ...rest\n },\n ref,\n ) => {\n const Component = asChild ? Slot : \"button\";\n\n return (\n <Component\n className={clsx(\n \"hds-button\",\n `hds-button--${size}`,\n `hds-button--${variant}`,\n {\n \"hds-button--full\": fullWidth === true,\n \"hds-button--mobile-full\": fullWidth === \"mobile\",\n \"hds-button--only-icon\": icon === true,\n \"hds-button--leading-icon\": icon === \"leading\",\n \"hds-button--trailing-icon\": icon === \"trailing\",\n },\n className as undefined,\n )}\n ref={ref}\n {...rest}\n >\n {children}\n </Component>\n );\n },\n);\nButton.displayName = \"Button\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAA2B;AAC3B,6BAAqB;AACrB,wBAAqB;AAwEf;AAjBC,IAAM,aAAS;AAAA,EACpB,CACE,IAUA,QACG;AAXH,iBACE;AAAA;AAAA,MACA;AAAA,MACA,UAAU;AAAA,MACV,OAAO;AAAA,MACP,YAAY;AAAA,MACZ,OAAO;AAAA,MACP;AAAA,IAlEN,IA2DI,IAQK,iBARL,IAQK;AAAA,MAPH;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAKF,UAAM,YAAY,UAAU,yBAAO;AAEnC,WACE;AAAA,MAAC;AAAA;AAAA,QACC,eAAW;AAAA,UACT;AAAA,UACA,eAAe,IAAI;AAAA,UACnB,eAAe,OAAO;AAAA,UACtB;AAAA,YACE,oBAAoB,cAAc;AAAA,YAClC,2BAA2B,cAAc;AAAA,YACzC,yBAAyB,SAAS;AAAA,YAClC,4BAA4B,SAAS;AAAA,YACrC,6BAA6B,SAAS;AAAA,UACxC;AAAA,UACA;AAAA,QACF;AAAA,QACA;AAAA,SACI,OAfL;AAAA,QAiBE;AAAA;AAAA,IACH;AAAA,EAEJ;AACF;AACA,OAAO,cAAc;","names":[]}
|
package/dist/button/index.mjs
CHANGED
package/dist/card/card.d.ts
CHANGED
|
@@ -8,6 +8,16 @@ export interface CardImageMediaProps extends React.ImgHTMLAttributes<HTMLImageEl
|
|
|
8
8
|
* @default false
|
|
9
9
|
*/
|
|
10
10
|
asChild?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Define image scaling behavior when the image are varies in both width and height across different page breaks and sizes of the card.
|
|
13
|
+
* "crop": Image always fills the available space.
|
|
14
|
+
* If the aspect ratio doesn't match, then the top/bottom or left/right edges are cropped away.
|
|
15
|
+
* "scale": No cropping, image scales to the maximum size available and centers.
|
|
16
|
+
* If the aspect ratio doesn't match, then the background will show on the top/bottom or left/right sides of the image.
|
|
17
|
+
*
|
|
18
|
+
* @default "crop"
|
|
19
|
+
*/
|
|
20
|
+
variant?: "crop" | "scale";
|
|
11
21
|
}
|
|
12
22
|
export declare const CardMediaImg: import("react").ForwardRefExoticComponent<CardImageMediaProps & import("react").RefAttributes<HTMLImageElement>>;
|
|
13
23
|
export declare const CardBody: import("react").ForwardRefExoticComponent<CardBaseProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -25,6 +35,7 @@ export declare const CardBodyHeaderOverline: import("react").ForwardRefExoticCom
|
|
|
25
35
|
export declare const CardBodyHeaderTitle: import("react").ForwardRefExoticComponent<CardBaseProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
26
36
|
export declare const CardBodyDescription: import("react").ForwardRefExoticComponent<CardBaseProps & import("react").RefAttributes<HTMLParagraphElement>>;
|
|
27
37
|
export declare const CardBodyAction: import("react").ForwardRefExoticComponent<CardBaseProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
38
|
+
export declare const CardBodyActionRow: import("react").ForwardRefExoticComponent<CardBaseProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
28
39
|
interface CardBodyActionArrowProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
29
40
|
/**
|
|
30
41
|
* Change the default rendered element for the one passed as a child, merging their props and behavior.
|
|
@@ -49,7 +60,7 @@ export interface CardBaseProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
49
60
|
*/
|
|
50
61
|
asChild?: boolean;
|
|
51
62
|
}
|
|
52
|
-
export interface
|
|
63
|
+
export interface CardSlimAndMiniatureProps extends CardBaseProps {
|
|
53
64
|
/**
|
|
54
65
|
* Change the default rendered element for Card.
|
|
55
66
|
*/
|
|
@@ -59,14 +70,38 @@ export interface CardProps extends CardBaseProps {
|
|
|
59
70
|
*
|
|
60
71
|
* @default "slim"
|
|
61
72
|
*/
|
|
62
|
-
variant?: "slim" | "
|
|
73
|
+
variant?: "slim" | "miniature";
|
|
63
74
|
/**
|
|
64
75
|
* The color of the card.
|
|
65
76
|
*
|
|
66
77
|
* @default "lighter-brand"
|
|
67
78
|
* */
|
|
68
79
|
color?: "white" | "lighter-brand" | "light-grey-fill";
|
|
80
|
+
imagePosition?: never;
|
|
81
|
+
}
|
|
82
|
+
export interface CardFocusProps extends CardBaseProps {
|
|
83
|
+
as?: "section" | "div" | "article" | "aside";
|
|
84
|
+
variant: "focus";
|
|
85
|
+
color?: "darker";
|
|
86
|
+
/**
|
|
87
|
+
* fullwidth or focus cards can have images to the left or right of the text.
|
|
88
|
+
*
|
|
89
|
+
* @default "left"
|
|
90
|
+
* */
|
|
91
|
+
imagePosition?: "left" | "right";
|
|
92
|
+
}
|
|
93
|
+
export interface CardFullwidthProps extends CardBaseProps {
|
|
94
|
+
as?: "section" | "div" | "article" | "aside";
|
|
95
|
+
variant: "full-width";
|
|
96
|
+
color: "white" | "lighter-brand" | "light-grey-fill";
|
|
97
|
+
/**
|
|
98
|
+
* fullwidth or focus cards can have images to the left or right of the text.
|
|
99
|
+
*
|
|
100
|
+
* @default "left"
|
|
101
|
+
* */
|
|
102
|
+
imagePosition?: "left" | "right";
|
|
69
103
|
}
|
|
104
|
+
export type CardProps = CardSlimAndMiniatureProps | CardFocusProps | CardFullwidthProps;
|
|
70
105
|
export declare const Card: CardType;
|
|
71
106
|
type CardType = ReturnType<typeof forwardRef<HTMLDivElement, CardProps>> & {
|
|
72
107
|
Media: typeof CardMedia;
|
|
@@ -77,6 +112,7 @@ type CardType = ReturnType<typeof forwardRef<HTMLDivElement, CardProps>> & {
|
|
|
77
112
|
BodyHeaderTitle: typeof CardBodyHeaderTitle;
|
|
78
113
|
BodyDescription: typeof CardBodyDescription;
|
|
79
114
|
BodyAction: typeof CardBodyAction;
|
|
115
|
+
BodyActionRow: typeof CardBodyActionRow;
|
|
80
116
|
BodyActionArrow: typeof CardBodyActionArrow;
|
|
81
117
|
};
|
|
82
118
|
export {};
|
package/dist/card/card.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"card.d.ts","sourceRoot":"","sources":["../../src/card/card.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC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KAAK,EAAE,OAAO,SAAS,CAAC;IACxB,QAAQ,EAAE,OAAO,YAAY,CAAC;IAC9B,IAAI,EAAE,OAAO,QAAQ,CAAC;IACtB,UAAU,EAAE,OAAO,cAAc,CAAC;IAClC,kBAAkB,EAAE,OAAO,sBAAsB,CAAC;IAClD,eAAe,EAAE,OAAO,mBAAmB,CAAC;IAC5C,eAAe,EAAE,OAAO,mBAAmB,CAAC;IAC5C,UAAU,EAAE,OAAO,cAAc,CAAC;IAClC,aAAa,EAAE,OAAO,iBAAiB,CAAC;IACxC,eAAe,EAAE,OAAO,mBAAmB,CAAC;CAC7C,CAAC"}
|
package/dist/card/card.js
CHANGED
|
@@ -53,6 +53,7 @@ __export(card_exports, {
|
|
|
53
53
|
CardBody: () => CardBody,
|
|
54
54
|
CardBodyAction: () => CardBodyAction,
|
|
55
55
|
CardBodyActionArrow: () => CardBodyActionArrow,
|
|
56
|
+
CardBodyActionRow: () => CardBodyActionRow,
|
|
56
57
|
CardBodyDescription: () => CardBodyDescription,
|
|
57
58
|
CardBodyHeader: () => CardBodyHeader,
|
|
58
59
|
CardBodyHeaderOverline: () => CardBodyHeaderOverline,
|
|
@@ -75,12 +76,16 @@ var CardMedia = (0, import_react.forwardRef)(
|
|
|
75
76
|
CardMedia.displayName = "Card.Media";
|
|
76
77
|
var CardMediaImg = (0, import_react.forwardRef)(
|
|
77
78
|
(_a, ref) => {
|
|
78
|
-
var _b = _a, { asChild, className } = _b, rest = __objRest(_b, ["asChild", "className"]);
|
|
79
|
+
var _b = _a, { asChild, variant, className } = _b, rest = __objRest(_b, ["asChild", "variant", "className"]);
|
|
79
80
|
const Component = asChild ? import_react_slot.Slot : "img";
|
|
80
81
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
81
82
|
Component,
|
|
82
83
|
__spreadProps(__spreadValues({}, rest), {
|
|
83
|
-
className: (0, import_typed_classname.clsx)(
|
|
84
|
+
className: (0, import_typed_classname.clsx)(
|
|
85
|
+
"hds-card__media__img",
|
|
86
|
+
{ "hds-card__img__scale": variant === "scale" },
|
|
87
|
+
className
|
|
88
|
+
),
|
|
84
89
|
ref
|
|
85
90
|
})
|
|
86
91
|
);
|
|
@@ -91,7 +96,7 @@ var CardBody = (0, import_react.forwardRef)(
|
|
|
91
96
|
(_a, ref) => {
|
|
92
97
|
var _b = _a, { asChild, className, children } = _b, rest = __objRest(_b, ["asChild", "className", "children"]);
|
|
93
98
|
const Component = asChild ? import_react_slot.Slot : "div";
|
|
94
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, __spreadProps(__spreadValues({}, rest), { className: (0, import_typed_classname.clsx)("hds-card__body", className), ref, children }));
|
|
99
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, __spreadProps(__spreadValues({}, rest), { className: (0, import_typed_classname.clsx)("hds-card__body", className), ref, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: (0, import_typed_classname.clsx)("hds-card__centerbody", className), children }) }));
|
|
95
100
|
}
|
|
96
101
|
);
|
|
97
102
|
CardBody.displayName = "Card.Body";
|
|
@@ -168,6 +173,21 @@ var CardBodyAction = (0, import_react.forwardRef)(
|
|
|
168
173
|
}
|
|
169
174
|
);
|
|
170
175
|
CardBodyAction.displayName = "Card.BodyAction";
|
|
176
|
+
var CardBodyActionRow = (0, import_react.forwardRef)(
|
|
177
|
+
(_a, ref) => {
|
|
178
|
+
var _b = _a, { asChild, className, children } = _b, rest = __objRest(_b, ["asChild", "className", "children"]);
|
|
179
|
+
const Component = asChild ? import_react_slot.Slot : "div";
|
|
180
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
181
|
+
Component,
|
|
182
|
+
__spreadProps(__spreadValues({}, rest), {
|
|
183
|
+
className: (0, import_typed_classname.clsx)("hds-card__body-action-row", className),
|
|
184
|
+
ref,
|
|
185
|
+
children
|
|
186
|
+
})
|
|
187
|
+
);
|
|
188
|
+
}
|
|
189
|
+
);
|
|
190
|
+
CardBodyActionRow.displayName = "Card.BodyActionRow";
|
|
171
191
|
var CardBodyActionArrow = (0, import_react.forwardRef)(
|
|
172
192
|
(_a, ref) => {
|
|
173
193
|
var _b = _a, { asChild, className, direction } = _b, rest = __objRest(_b, ["asChild", "className", "direction"]);
|
|
@@ -188,7 +208,7 @@ var CardBodyActionArrow = (0, import_react.forwardRef)(
|
|
|
188
208
|
CardBodyActionArrow.displayName = "Card.BodyActionArrow";
|
|
189
209
|
var Card = (0, import_react.forwardRef)(
|
|
190
210
|
(_a, ref) => {
|
|
191
|
-
var _b = _a, { as: Tag = "section", asChild, className, children, variant, color } = _b, rest = __objRest(_b, ["as", "asChild", "className", "children", "variant", "color"]);
|
|
211
|
+
var _b = _a, { as: Tag = "section", asChild, className, children, variant, color, imagePosition } = _b, rest = __objRest(_b, ["as", "asChild", "className", "children", "variant", "color", "imagePosition"]);
|
|
192
212
|
const Component = asChild ? import_react_slot.Slot : Tag;
|
|
193
213
|
const effectiveColor = variant === "focus" && !color ? "darker" : color;
|
|
194
214
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
@@ -202,10 +222,11 @@ var Card = (0, import_react.forwardRef)(
|
|
|
202
222
|
{ "hds-card--color-white": effectiveColor === "white" },
|
|
203
223
|
{ "hds-card--color-light-grey-fill": effectiveColor === "light-grey-fill" },
|
|
204
224
|
{ "hds-card--color-darker": effectiveColor === "darker" },
|
|
225
|
+
{ "hds-card--image-position-right": imagePosition === "right" },
|
|
205
226
|
className
|
|
206
227
|
),
|
|
207
228
|
ref,
|
|
208
|
-
children
|
|
229
|
+
children: variant === "full-width" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: (0, import_typed_classname.clsx)("hds-card__layoutwrapper", className), children }) : children
|
|
209
230
|
})
|
|
210
231
|
);
|
|
211
232
|
}
|
|
@@ -219,6 +240,7 @@ Card.BodyHeaderOverline = CardBodyHeaderOverline;
|
|
|
219
240
|
Card.BodyHeaderTitle = CardBodyHeaderTitle;
|
|
220
241
|
Card.BodyDescription = CardBodyDescription;
|
|
221
242
|
Card.BodyAction = CardBodyAction;
|
|
243
|
+
Card.BodyActionRow = CardBodyActionRow;
|
|
222
244
|
Card.BodyActionArrow = CardBodyActionArrow;
|
|
223
245
|
// Annotate the CommonJS export names for ESM import in node:
|
|
224
246
|
0 && (module.exports = {
|
|
@@ -226,6 +248,7 @@ Card.BodyActionArrow = CardBodyActionArrow;
|
|
|
226
248
|
CardBody,
|
|
227
249
|
CardBodyAction,
|
|
228
250
|
CardBodyActionArrow,
|
|
251
|
+
CardBodyActionRow,
|
|
229
252
|
CardBodyDescription,
|
|
230
253
|
CardBodyHeader,
|
|
231
254
|
CardBodyHeaderOverline,
|
package/dist/card/card.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAA2B;AAC3B,6BAAqB;AACrB,wBAAqB;AAMf;AAJC,IAAM,gBAAY;AAAA,EACvB,CAAC,IAA2C,QAAQ;AAAnD,iBAAE,WAAS,WAAW,SANzB,IAMG,IAAmC,iBAAnC,IAAmC,CAAjC,WA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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 \"crop\"\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__scale\": variant === \"scale\" },\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\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 * The color of the card.\n *\n * @default \"lighter-brand\"\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 CardFocusProps extends CardBaseProps {\n as?: \"section\" | \"div\" | \"article\" | \"aside\";\n variant: \"focus\";\n color?: \"darker\";\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 as?: \"section\" | \"div\" | \"article\" | \"aside\";\n variant: \"full-width\";\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 type CardProps = CardSlimAndMiniatureProps | CardFocusProps | CardFullwidthProps;\n\nexport const Card = forwardRef<HTMLDivElement, CardProps>(\n (\n { as: Tag = \"section\", asChild, className, children, variant, color, imagePosition, ...rest },\n ref,\n ) => {\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 { \"hds-card--image-position-right\": imagePosition === \"right\" },\n className as undefined,\n )}\n ref={ref}\n >\n {variant === \"full-width\" ? (\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAA2B;AAC3B,6BAAqB;AACrB,wBAAqB;AAMf;AAJC,IAAM,gBAAY;AAAA,EACvB,CAAC,IAA2C,QAAQ;AAAnD,iBAAE,WAAS,WAAW,SANzB,IAMG,IAAmC,iBAAnC,IAAmC,CAAjC,WAAS,aAAW;AACrB,UAAM,YAAY,UAAU,yBAAO;AACnC,WACE,4CAAC,4CAAc,OAAd,EAAoB,eAAW,6BAAK,mBAAmB,SAAsB,GAAG,KAC9E,WACH;AAAA,EAEJ;AACF;AACA,UAAU,cAAc;AAoBjB,IAAM,mBAAe;AAAA,EAC1B,CAAC,IAA0C,QAAQ;AAAlD,iBAAE,WAAS,SAAS,UApCvB,IAoCG,IAAkC,iBAAlC,IAAkC,CAAhC,WAAS,WAAS;AACnB,UAAM,YAAY,UAAU,yBAAO;AACnC,WACE;AAAA,MAAC;AAAA,uCACK,OADL;AAAA,QAEC,eAAW;AAAA,UACT;AAAA,UACA,EAAE,wBAAwB,YAAY,QAAQ;AAAA,UAC9C;AAAA,QACF;AAAA,QACA;AAAA;AAAA,IACF;AAAA,EAEJ;AACF;AACA,aAAa,cAAc;AAEpB,IAAM,eAAW;AAAA,EACtB,CAAC,IAA2C,QAAQ;AAAnD,iBAAE,WAAS,WAAW,SAtDzB,IAsDG,IAAmC,iBAAnC,IAAmC,CAAjC,WAAS,aAAW;AACrB,UAAM,YA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
|
CardBodyDescription,
|
|
7
8
|
CardBodyHeader,
|
|
8
9
|
CardBodyHeaderOverline,
|
|
9
10
|
CardBodyHeaderTitle,
|
|
10
11
|
CardMedia,
|
|
11
12
|
CardMediaImg
|
|
12
|
-
} from "../chunk-
|
|
13
|
+
} from "../chunk-LDZIJR2D.mjs";
|
|
13
14
|
import "../chunk-YOSPWY5K.mjs";
|
|
14
15
|
export {
|
|
15
16
|
Card,
|
|
16
17
|
CardBody,
|
|
17
18
|
CardBodyAction,
|
|
18
19
|
CardBodyActionArrow,
|
|
20
|
+
CardBodyActionRow,
|
|
19
21
|
CardBodyDescription,
|
|
20
22
|
CardBodyHeader,
|
|
21
23
|
CardBodyHeaderOverline,
|
package/dist/card/index.js
CHANGED
|
@@ -77,12 +77,16 @@ var CardMedia = (0, import_react.forwardRef)(
|
|
|
77
77
|
CardMedia.displayName = "Card.Media";
|
|
78
78
|
var CardMediaImg = (0, import_react.forwardRef)(
|
|
79
79
|
(_a, ref) => {
|
|
80
|
-
var _b = _a, { asChild, className } = _b, rest = __objRest(_b, ["asChild", "className"]);
|
|
80
|
+
var _b = _a, { asChild, variant, className } = _b, rest = __objRest(_b, ["asChild", "variant", "className"]);
|
|
81
81
|
const Component = asChild ? import_react_slot.Slot : "img";
|
|
82
82
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
83
83
|
Component,
|
|
84
84
|
__spreadProps(__spreadValues({}, rest), {
|
|
85
|
-
className: (0, import_typed_classname.clsx)(
|
|
85
|
+
className: (0, import_typed_classname.clsx)(
|
|
86
|
+
"hds-card__media__img",
|
|
87
|
+
{ "hds-card__img__scale": variant === "scale" },
|
|
88
|
+
className
|
|
89
|
+
),
|
|
86
90
|
ref
|
|
87
91
|
})
|
|
88
92
|
);
|
|
@@ -93,7 +97,7 @@ var CardBody = (0, import_react.forwardRef)(
|
|
|
93
97
|
(_a, ref) => {
|
|
94
98
|
var _b = _a, { asChild, className, children } = _b, rest = __objRest(_b, ["asChild", "className", "children"]);
|
|
95
99
|
const Component = asChild ? import_react_slot.Slot : "div";
|
|
96
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, __spreadProps(__spreadValues({}, rest), { className: (0, import_typed_classname.clsx)("hds-card__body", className), ref, children }));
|
|
100
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, __spreadProps(__spreadValues({}, rest), { className: (0, import_typed_classname.clsx)("hds-card__body", className), ref, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: (0, import_typed_classname.clsx)("hds-card__centerbody", className), children }) }));
|
|
97
101
|
}
|
|
98
102
|
);
|
|
99
103
|
CardBody.displayName = "Card.Body";
|
|
@@ -170,6 +174,21 @@ var CardBodyAction = (0, import_react.forwardRef)(
|
|
|
170
174
|
}
|
|
171
175
|
);
|
|
172
176
|
CardBodyAction.displayName = "Card.BodyAction";
|
|
177
|
+
var CardBodyActionRow = (0, import_react.forwardRef)(
|
|
178
|
+
(_a, ref) => {
|
|
179
|
+
var _b = _a, { asChild, className, children } = _b, rest = __objRest(_b, ["asChild", "className", "children"]);
|
|
180
|
+
const Component = asChild ? import_react_slot.Slot : "div";
|
|
181
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
182
|
+
Component,
|
|
183
|
+
__spreadProps(__spreadValues({}, rest), {
|
|
184
|
+
className: (0, import_typed_classname.clsx)("hds-card__body-action-row", className),
|
|
185
|
+
ref,
|
|
186
|
+
children
|
|
187
|
+
})
|
|
188
|
+
);
|
|
189
|
+
}
|
|
190
|
+
);
|
|
191
|
+
CardBodyActionRow.displayName = "Card.BodyActionRow";
|
|
173
192
|
var CardBodyActionArrow = (0, import_react.forwardRef)(
|
|
174
193
|
(_a, ref) => {
|
|
175
194
|
var _b = _a, { asChild, className, direction } = _b, rest = __objRest(_b, ["asChild", "className", "direction"]);
|
|
@@ -190,7 +209,7 @@ var CardBodyActionArrow = (0, import_react.forwardRef)(
|
|
|
190
209
|
CardBodyActionArrow.displayName = "Card.BodyActionArrow";
|
|
191
210
|
var Card = (0, import_react.forwardRef)(
|
|
192
211
|
(_a, ref) => {
|
|
193
|
-
var _b = _a, { as: Tag = "section", asChild, className, children, variant, color } = _b, rest = __objRest(_b, ["as", "asChild", "className", "children", "variant", "color"]);
|
|
212
|
+
var _b = _a, { as: Tag = "section", asChild, className, children, variant, color, imagePosition } = _b, rest = __objRest(_b, ["as", "asChild", "className", "children", "variant", "color", "imagePosition"]);
|
|
194
213
|
const Component = asChild ? import_react_slot.Slot : Tag;
|
|
195
214
|
const effectiveColor = variant === "focus" && !color ? "darker" : color;
|
|
196
215
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
@@ -204,10 +223,11 @@ var Card = (0, import_react.forwardRef)(
|
|
|
204
223
|
{ "hds-card--color-white": effectiveColor === "white" },
|
|
205
224
|
{ "hds-card--color-light-grey-fill": effectiveColor === "light-grey-fill" },
|
|
206
225
|
{ "hds-card--color-darker": effectiveColor === "darker" },
|
|
226
|
+
{ "hds-card--image-position-right": imagePosition === "right" },
|
|
207
227
|
className
|
|
208
228
|
),
|
|
209
229
|
ref,
|
|
210
|
-
children
|
|
230
|
+
children: variant === "full-width" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: (0, import_typed_classname.clsx)("hds-card__layoutwrapper", className), children }) : children
|
|
211
231
|
})
|
|
212
232
|
);
|
|
213
233
|
}
|
|
@@ -221,6 +241,7 @@ Card.BodyHeaderOverline = CardBodyHeaderOverline;
|
|
|
221
241
|
Card.BodyHeaderTitle = CardBodyHeaderTitle;
|
|
222
242
|
Card.BodyDescription = CardBodyDescription;
|
|
223
243
|
Card.BodyAction = CardBodyAction;
|
|
244
|
+
Card.BodyActionRow = CardBodyActionRow;
|
|
224
245
|
Card.BodyActionArrow = CardBodyActionArrow;
|
|
225
246
|
// Annotate the CommonJS export names for ESM import in node:
|
|
226
247
|
0 && (module.exports = {
|
package/dist/card/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/card/index.tsx","../../src/card/card.tsx"],"sourcesContent":["export {\n Card,\n CardMedia,\n CardMediaImg,\n CardBody,\n CardBodyHeader,\n CardBodyHeaderOverline,\n CardBodyHeaderTitle,\n CardBodyDescription,\n CardBodyAction,\n CardBodyActionArrow,\n} from \"./card\";\n\nexport type * from \"./card\";\n","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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACCA,mBAA2B;AAC3B,6BAAqB;AACrB,wBAAqB;AAMf;AAJC,IAAM,gBAAY;AAAA,EACvB,CAAC,IAA2C,QAAQ;AAAnD,iBAAE,WAAS,WAAW,SANzB,IAMG,IAAmC,iBAAnC,IAAmC,CAAjC,WAAS,aAAW;AACrB,UAAM,YAAY,UAAU,yBAAO;AACnC,WACE,4CAAC,4CAAc,OAAd,EAAoB,eAAW,6BAAK,mBAAmB,SAAsB,GAAG,KAC9E,WACH;AAAA,EAEJ;AACF;AACA,UAAU,cAAc;AAUjB,IAAM,mBAAe;AAAA,EAC1B,CAAC,IAAiC,QAAQ;AAAzC,iBAAE,WAAS,UA1Bd,IA0BG,IAAyB,iBAAzB,IAAyB,CAAvB,WAAS;AACV,UAAM,Y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AsC3B,IAAM,WAAO;AAAA,EAClB,CAAC,IAAgF,QAAQ;AAAxF,iBAAE,MAAI,MAAM,WAAW,SAAS,WAAW,UAAU,SAAS,MAvNjE,IAuNG,IAAwE,iBAAxE,IAAwE,CAAtE,MAAqB,WAAS,aAAW,YAAU,WAAS;AAC7D,UAAM,YAAY,UAAU,yBAAO;AACnC,UAAM,iBAAiB,YAAY,WAAW,CAAC,QAAQ,WAAW;AAClE,WACE;AAAA,MAAC;AAAA,uCACK,OADL;AAAA,QAEC,eAAW;AAAA,UACT;AAAA,UACA,EAAE,wBAAwB,YAAY,aAAa;AAAA,UACnD,EAAE,uBAAuB,YAAY,YAAY;AAAA,UACjD,EAAE,mBAAmB,YAAY,QAAQ;AAAA,UACzC,EAAE,yBAAyB,mBAAmB,QAAQ;AAAA,UACtD,EAAE,mCAAmC,mBAAmB,kBAAkB;AAAA,UAC1E,EAAE,0BAA0B,mBAAmB,SAAS;AAAA,UACxD;AAAA,QACF;AAAA,QACA;AAAA,QAEC;AAAA;AAAA,IACH;AAAA,EAEJ;AACF;AACA,KAAK,cAAc;AAEnB,KAAK,QAAQ;AACb,KAAK,WAAW;AAChB,KAAK,OAAO;AACZ,KAAK,aAAa;AAClB,KAAK,qBAAqB;AAC1B,KAAK,kBAAkB;AACvB,KAAK,kBAAkB;AACvB,KAAK,aAAa;AAClB,KAAK,kBAAkB;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/card/index.tsx","../../src/card/card.tsx"],"sourcesContent":["export {\n Card,\n CardMedia,\n CardMediaImg,\n CardBody,\n CardBodyHeader,\n CardBodyHeaderOverline,\n CardBodyHeaderTitle,\n CardBodyDescription,\n CardBodyAction,\n CardBodyActionArrow,\n} from \"./card\";\n\nexport type * from \"./card\";\n","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 \"crop\"\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__scale\": variant === \"scale\" },\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\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 * The color of the card.\n *\n * @default \"lighter-brand\"\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 CardFocusProps extends CardBaseProps {\n as?: \"section\" | \"div\" | \"article\" | \"aside\";\n variant: \"focus\";\n color?: \"darker\";\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 as?: \"section\" | \"div\" | \"article\" | \"aside\";\n variant: \"full-width\";\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 type CardProps = CardSlimAndMiniatureProps | CardFocusProps | CardFullwidthProps;\n\nexport const Card = forwardRef<HTMLDivElement, CardProps>(\n (\n { as: Tag = \"section\", asChild, className, children, variant, color, imagePosition, ...rest },\n ref,\n ) => {\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 { \"hds-card--image-position-right\": imagePosition === \"right\" },\n className as undefined,\n )}\n ref={ref}\n >\n {variant === \"full-width\" ? (\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACCA,mBAA2B;AAC3B,6BAAqB;AACrB,wBAAqB;AAMf;AAJC,IAAM,gBAAY;AAAA,EACvB,CAAC,IAA2C,QAAQ;AAAnD,iBAAE,WAAS,WAAW,SANzB,IAMG,IAAmC,iBAAnC,IAAmC,CAAjC,WAAS,aAAW;AACrB,UAAM,YAAY,UAAU,yBAAO;AACnC,WACE,4CAAC,4CAAc,OAAd,EAAoB,eAAW,6BAAK,mBAAmB,SAAsB,GAAG,KAC9E,WACH;AAAA,EAEJ;AACF;AACA,UAAU,cAAc;AAoBjB,IAAM,mBAAe;AAAA,EAC1B,CAAC,IAA0C,QAAQ;AAAlD,iBAAE,WAAS,SAAS,UApCvB,IAoCG,IAAkC,iBAAlC,IAAkC,CAAhC,WAAS,WAAS;AACnB,UAAM,YAAY,UAAU,yBAAO;AACnC,WACE;AAAA,MAAC;AAAA,uCACK,OADL;AAAA,QAEC,eAAW;AAAA,UACT;AAAA,UACA,EAAE,wBAAwB,YAAY,QAAQ;AAAA,UAC9C;AAAA,QACF;AAAA,QACA;AAAA;AAAA,IACF;AAAA,EAEJ;AACF;AACA,aAAa,cAAc;AAEpB,IAAM,eAAW;AAAA,EACtB,CAAC,IAA2C,QAAQ;AAAnD,iBAAE,WAAS,WAAW,SAtDzB,IAsDG,IAAmC,iBAAnC,IAAmC,CAAjC,WAAS,aAAW;AACrB,UAAM,YAAY,UAAU,yBAAO;AACnC,WACE,4CAAC,4CAAc,OAAd,EAAoB,eAAW,6BAAK,kBAAkB,SAAsB,GAAG,KAC9E,sDAAC,SAAI,eAAW,6BAAK,w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