@synerise/ds-card 2.0.11 → 2.1.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/CHANGELOG.md +11 -0
- package/CLAUDE.md +1 -1
- package/dist/Card/Card.js +14 -2
- package/dist/Card/Card.styles.js +17 -17
- package/dist/CardBadge/CardBadge.styles.js +12 -12
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [2.1.0](https://github.com/Synerise/synerise-design/compare/@synerise/ds-card@2.0.11...@synerise/ds-card@2.1.0) (2026-10-29)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* integrate Token Studio design tokens across the design system ([aabb447](https://github.com/Synerise/synerise-design/commit/aabb447edfb2d0c85e3de1f07e809ef84083453b))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [2.0.11](https://github.com/Synerise/synerise-design/compare/@synerise/ds-card@2.0.10...@synerise/ds-card@2.0.11) (2026-10-28)
|
|
7
18
|
|
|
8
19
|
**Note:** Version bump only for package @synerise/ds-card
|
package/CLAUDE.md
CHANGED
|
@@ -76,7 +76,7 @@ Circular 24×24 icon badge for use as `renderBadge` content or standalone.
|
|
|
76
76
|
| Prop | Type | Default | Description |
|
|
77
77
|
|------|------|---------|-------------|
|
|
78
78
|
| `icon` | `ReactNode` | — | **Required.** Icon element rendered inside the badge. |
|
|
79
|
-
| `status` | `'success' \| 'checked' \| 'warning' \| 'error' \| 'default'` | `'default'` | Controls background
|
|
79
|
+
| `status` | `'success' \| 'checked' \| 'warning' \| 'error' \| 'default'` | `'default'` | Controls background and icon colour via `--ds-card-header-badge-<status>-bg` / `-icon`. |
|
|
80
80
|
|
|
81
81
|
### `CardSummary`
|
|
82
82
|
|
package/dist/Card/Card.js
CHANGED
|
@@ -1,10 +1,22 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useState } from "react";
|
|
2
|
+
import { useState, isValidElement, cloneElement } from "react";
|
|
3
3
|
import AnimateHeight from "react-animate-height";
|
|
4
4
|
import VisibilitySensor from "react-visibility-sensor";
|
|
5
5
|
import Icon from "@synerise/ds-icon";
|
|
6
|
+
import CardBadge from "../CardBadge/CardBadge.js";
|
|
6
7
|
import { ANIMATION_DURATION } from "../constants.js";
|
|
7
8
|
import { Container, Header, IconContainer, HeaderContent, Description, HeaderSideChildren, ChildrenContainer, PaddingWrapper, FooterContainer, TitleWrapper, Title, TitleTag } from "./Card.styles.js";
|
|
9
|
+
const renderHeaderIcon = (icon, iconColor) => {
|
|
10
|
+
if (isValidElement(icon) && icon.type === CardBadge) {
|
|
11
|
+
return icon;
|
|
12
|
+
}
|
|
13
|
+
if (isValidElement(icon) && icon.type === Icon) {
|
|
14
|
+
return iconColor && !icon.props.color ? cloneElement(icon, {
|
|
15
|
+
color: iconColor
|
|
16
|
+
}) : icon;
|
|
17
|
+
}
|
|
18
|
+
return /* @__PURE__ */ jsx(Icon, { component: icon, color: iconColor });
|
|
19
|
+
};
|
|
8
20
|
const Card = ({
|
|
9
21
|
children,
|
|
10
22
|
raised,
|
|
@@ -54,7 +66,7 @@ const Card = ({
|
|
|
54
66
|
...htmlAttributes,
|
|
55
67
|
children: [
|
|
56
68
|
withHeader && /* @__PURE__ */ jsxs(Header, { onClick: onHeaderClick, headerBorderBottom, defaultHeaderBackgroundColor, children: [
|
|
57
|
-
icon && /* @__PURE__ */ jsx(IconContainer, { description, compact: compactHeader, children:
|
|
69
|
+
icon && /* @__PURE__ */ jsx(IconContainer, { description, compact: compactHeader, children: renderHeaderIcon(icon, iconColor) }) || avatar || renderBadge && renderBadge(),
|
|
58
70
|
/* @__PURE__ */ jsxs(HeaderContent, { compact: compactHeader, hasIconOrAvatar: Boolean(icon || avatar), children: [
|
|
59
71
|
renderTitle(),
|
|
60
72
|
description && /* @__PURE__ */ jsx(Description, { "data-testid": "card-description", children: description })
|
package/dist/Card/Card.styles.js
CHANGED
|
@@ -5,21 +5,21 @@ const whiteBg = ["white", "white-shadow"];
|
|
|
5
5
|
const greyBg = ["grey", "grey-shadow"];
|
|
6
6
|
const withBoxShadow = ["white-shadow", "grey-shadow"];
|
|
7
7
|
const withOutline = ["outline"];
|
|
8
|
-
const backgroundColor = (
|
|
9
|
-
if (whiteBg.includes(
|
|
10
|
-
return
|
|
8
|
+
const backgroundColor = (background) => {
|
|
9
|
+
if (whiteBg.includes(background)) {
|
|
10
|
+
return "var(--ds-card-variant-white-bg)";
|
|
11
11
|
}
|
|
12
|
-
if (greyBg.includes(
|
|
13
|
-
return
|
|
12
|
+
if (greyBg.includes(background)) {
|
|
13
|
+
return "var(--ds-card-variant-grey-bg)";
|
|
14
14
|
}
|
|
15
|
-
return
|
|
15
|
+
return "var(--ds-card-variant-outline-bg)";
|
|
16
16
|
};
|
|
17
|
-
const boxShadow = (
|
|
18
|
-
if (withBoxShadow.includes(
|
|
19
|
-
return
|
|
17
|
+
const boxShadow = (background) => {
|
|
18
|
+
if (withBoxShadow.includes(background)) {
|
|
19
|
+
return "var(--ds-card-shadow-raised)";
|
|
20
20
|
}
|
|
21
|
-
if (withOutline.includes(
|
|
22
|
-
return
|
|
21
|
+
if (withOutline.includes(background)) {
|
|
22
|
+
return "var(--ds-card-variant-outline-border) 0px 0px 0px 1px inset";
|
|
23
23
|
}
|
|
24
24
|
return "none";
|
|
25
25
|
};
|
|
@@ -34,15 +34,15 @@ const IconContainer = /* @__PURE__ */ styled.div.withConfig({
|
|
|
34
34
|
const Container = /* @__PURE__ */ styled.div.withConfig({
|
|
35
35
|
displayName: "Cardstyles__Container",
|
|
36
36
|
componentId: "sc-18exblx-2"
|
|
37
|
-
})(["background-color:", ";box-shadow:", ";border-radius:", ";display:flex;flex-flow:column;width:100%;.card-animation{> *{transition:opacity 0.3s ease;opacity:0;}&.rah-static--height-auto{> *{opacity:1;}}}", " ", ";", ""], (props) => props.background ? backgroundColor(props) :
|
|
37
|
+
})(["background-color:", ";box-shadow:", ";border-radius:", ";display:flex;flex-flow:column;width:100%;.card-animation{> *{transition:opacity 0.3s ease;opacity:0;}&.rah-static--height-auto{> *{opacity:1;}}}", " ", ";", ""], (props) => props.background ? backgroundColor(props.background) : "transparent", (props) => props.background ? boxShadow(props.background) : "none", (props) => props.theme.variable("@border-radius-base"), (props) => !!props.raised && css(["box-shadow:var(--ds-card-shadow-hover);"]), (props) => !!props.disabled && css(["pointer-events:none;opacity:var(--ds-card-disabled-opacity);"]), (props) => !!props.lively && css(["&:hover{box-shadow:var(--ds-card-shadow-hover);}"]));
|
|
38
38
|
const Header = /* @__PURE__ */ styled.div.withConfig({
|
|
39
39
|
displayName: "Cardstyles__Header",
|
|
40
40
|
componentId: "sc-18exblx-3"
|
|
41
|
-
})(["padding:24px 24px 24px 24px;display:flex;flex-direction:row;flex-wrap:nowrap;align-items:flex-start;position:relative;&:after{position:absolute;bottom:0;left:24px;right:24px;height:1px;content:'';display:", ";background-color:
|
|
41
|
+
})(["padding:24px 24px 24px 24px;display:flex;flex-direction:row;flex-wrap:nowrap;align-items:flex-start;position:relative;&:after{position:absolute;bottom:0;left:24px;right:24px;height:1px;content:'';display:", ";background-color:var(--ds-card-header-borderbottom);}&:hover{", "}", ""], (props) => props.headerBorderBottom ? "block" : "none", (props) => !!props.onClick && `cursor:pointer;`, (props) => !!props.defaultHeaderBackgroundColor && css(["background-color:var(--ds-card-header-bg);"]));
|
|
42
42
|
const Title = /* @__PURE__ */ styled(Title$1).withConfig({
|
|
43
43
|
displayName: "Cardstyles__Title",
|
|
44
44
|
componentId: "sc-18exblx-4"
|
|
45
|
-
})(["&&{display:flex;align-items:center;min-height:", ";margin:0;line-height:1.4;}"], (props) => props.fat ? "32px" : "20px");
|
|
45
|
+
})(["&&{color:var(--ds-card-header-title);display:flex;align-items:center;min-height:", ";margin:0;line-height:1.4;}"], (props) => props.fat ? "32px" : "20px");
|
|
46
46
|
const TitleWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
47
47
|
displayName: "Cardstyles__TitleWrapper",
|
|
48
48
|
componentId: "sc-18exblx-5"
|
|
@@ -54,7 +54,7 @@ const TitleTag = /* @__PURE__ */ styled.div.withConfig({
|
|
|
54
54
|
const Description = /* @__PURE__ */ styled.div.withConfig({
|
|
55
55
|
displayName: "Cardstyles__Description",
|
|
56
56
|
componentId: "sc-18exblx-7"
|
|
57
|
-
})(["&&{color:
|
|
57
|
+
})(["&&{color:var(--ds-color-text-base-muted);font-size:13px;line-height:1.38;margin:0;}"]);
|
|
58
58
|
const HeaderContent = /* @__PURE__ */ styled.div.withConfig({
|
|
59
59
|
displayName: "Cardstyles__HeaderContent",
|
|
60
60
|
componentId: "sc-18exblx-8"
|
|
@@ -63,7 +63,7 @@ const HeaderContent = /* @__PURE__ */ styled.div.withConfig({
|
|
|
63
63
|
return "24px";
|
|
64
64
|
}
|
|
65
65
|
return "0";
|
|
66
|
-
}, (props) => !!props.compact && css(["", "{height:32px;line-height:32px;margin:0;}", "{border-left:1px solid
|
|
66
|
+
}, (props) => !!props.compact && css(["", "{height:32px;line-height:32px;margin:0;}", "{border-left:1px solid var(--ds-card-header-divider);height:32px;line-height:32px;padding:0 0 0 24px;margin:0 0 0 24px;}"], Title, Description));
|
|
67
67
|
const ChildrenContainer = /* @__PURE__ */ styled.div.withConfig({
|
|
68
68
|
displayName: "Cardstyles__ChildrenContainer",
|
|
69
69
|
componentId: "sc-18exblx-9"
|
|
@@ -75,7 +75,7 @@ const PaddingWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
|
75
75
|
const FooterContainer = /* @__PURE__ */ styled.div.withConfig({
|
|
76
76
|
displayName: "Cardstyles__FooterContainer",
|
|
77
77
|
componentId: "sc-18exblx-11"
|
|
78
|
-
})(["padding:24px;display:flex;align-items:center;justify-content:flex-end;background:
|
|
78
|
+
})(["padding:24px;display:flex;align-items:center;justify-content:flex-end;background:var(--ds-card-footer-bg);border-top:solid 1px var(--ds-card-footer-border);"]);
|
|
79
79
|
export {
|
|
80
80
|
ChildrenContainer,
|
|
81
81
|
Container,
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import styled from "styled-components";
|
|
2
2
|
const background = {
|
|
3
|
-
success: "
|
|
4
|
-
warning: "
|
|
5
|
-
error: "
|
|
6
|
-
default: "
|
|
7
|
-
checked: "
|
|
3
|
+
success: "var(--ds-card-header-badge-success-bg)",
|
|
4
|
+
warning: "var(--ds-card-header-badge-warning-bg)",
|
|
5
|
+
error: "var(--ds-card-header-badge-error-bg)",
|
|
6
|
+
default: "var(--ds-card-header-badge-default-bg)",
|
|
7
|
+
checked: "var(--ds-card-header-badge-checked-bg)"
|
|
8
8
|
};
|
|
9
9
|
const color = {
|
|
10
|
-
success: "
|
|
11
|
-
warning: "
|
|
12
|
-
error: "
|
|
13
|
-
default: "
|
|
14
|
-
checked: "
|
|
10
|
+
success: "var(--ds-card-header-badge-success-icon)",
|
|
11
|
+
warning: "var(--ds-card-header-badge-warning-icon)",
|
|
12
|
+
error: "var(--ds-card-header-badge-error-icon)",
|
|
13
|
+
default: "var(--ds-card-header-badge-default-icon)",
|
|
14
|
+
checked: "var(--ds-card-header-badge-checked-icon)"
|
|
15
15
|
};
|
|
16
16
|
const boxShadow = (props) => {
|
|
17
|
-
return props.status === "default" ?
|
|
17
|
+
return props.status === "default" ? "var(--ds-card-header-badge-default-border) 0px 0px 0px 1.5px inset" : "none";
|
|
18
18
|
};
|
|
19
19
|
const CardBadge = /* @__PURE__ */ styled.div.withConfig({
|
|
20
20
|
displayName: "CardBadgestyles__CardBadge",
|
|
21
21
|
componentId: "sc-1xcnpyh-0"
|
|
22
|
-
})(["width:24px;height:24px;display:flex;align-items:center;justify-content:center;background-color:", ";box-shadow:", ";border-radius:50%;&&& svg{color:", ";}"], (props) =>
|
|
22
|
+
})(["width:24px;height:24px;display:flex;align-items:center;justify-content:center;background-color:", ";box-shadow:", ";border-radius:50%;&&& svg{color:", ";}"], (props) => background[props.status], (props) => boxShadow(props), (props) => color[props.status]);
|
|
23
23
|
export {
|
|
24
24
|
CardBadge
|
|
25
25
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-card",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "Card UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "Synerise/synerise-design",
|
|
@@ -42,11 +42,11 @@
|
|
|
42
42
|
],
|
|
43
43
|
"types": "dist/index.d.ts",
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@synerise/ds-avatar": "^2.0
|
|
46
|
-
"@synerise/ds-icon": "^2.
|
|
47
|
-
"@synerise/ds-tag": "^2.0
|
|
48
|
-
"@synerise/ds-typography": "^2.0
|
|
49
|
-
"@synerise/ds-utils": "^2.
|
|
45
|
+
"@synerise/ds-avatar": "^2.1.0",
|
|
46
|
+
"@synerise/ds-icon": "^2.3.0",
|
|
47
|
+
"@synerise/ds-tag": "^2.1.0",
|
|
48
|
+
"@synerise/ds-typography": "^2.1.0",
|
|
49
|
+
"@synerise/ds-utils": "^2.3.0",
|
|
50
50
|
"react-animate-height": "^2.0.23",
|
|
51
51
|
"react-visibility-sensor": "^5.1.1"
|
|
52
52
|
},
|
|
@@ -58,5 +58,5 @@
|
|
|
58
58
|
"react": ">=16.9.0 <= 18.3.1",
|
|
59
59
|
"styled-components": "^5.3.3"
|
|
60
60
|
},
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "5c3d61e30289486d14c7d6becb682e2d4a08ce41"
|
|
62
62
|
}
|