@synerise/ds-card 1.3.15 → 1.3.17
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 +8 -0
- package/CLAUDE.md +160 -0
- package/dist/Card/Card.styles.d.ts +1 -1
- package/dist/CardSummary/CardSummary.styles.d.ts +3 -2
- package/package.json +8 -7
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
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
|
+
## [1.3.17](https://github.com/Synerise/synerise-design/compare/@synerise/ds-card@1.3.16...@synerise/ds-card@1.3.17) (2026-07-23)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @synerise/ds-card
|
|
9
|
+
|
|
10
|
+
## [1.3.16](https://github.com/Synerise/synerise-design/compare/@synerise/ds-card@1.3.15...@synerise/ds-card@1.3.16) (2026-06-17)
|
|
11
|
+
|
|
12
|
+
**Note:** Version bump only for package @synerise/ds-card
|
|
13
|
+
|
|
6
14
|
## [1.3.15](https://github.com/Synerise/synerise-design/compare/@synerise/ds-card@1.3.14...@synerise/ds-card@1.3.15) (2026-06-11)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @synerise/ds-card
|
package/CLAUDE.md
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
# Card (`@synerise/ds-card`)
|
|
2
|
+
|
|
3
|
+
> A content container with an optional header, collapsible body, and summary section; companion components handle badge icons and grouped layouts.
|
|
4
|
+
|
|
5
|
+
## Package structure
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
src/
|
|
9
|
+
Card/
|
|
10
|
+
Card.tsx — main component
|
|
11
|
+
Card.types.ts — CardProps, Backgrounds type
|
|
12
|
+
Card.styles.ts — styled-components for Card
|
|
13
|
+
CardGroup/
|
|
14
|
+
CardGroup.tsx — CSS grid wrapper for multiple cards
|
|
15
|
+
CardGroup.types.ts
|
|
16
|
+
CardGroup.styles.ts
|
|
17
|
+
CardBadge/
|
|
18
|
+
CardBadge.tsx — circular icon badge used in card header
|
|
19
|
+
CardBadge.types.ts
|
|
20
|
+
CardBadge.styles.tsx
|
|
21
|
+
CardSummary/
|
|
22
|
+
CardSummary.tsx — bulleted summary list (used in staticContent)
|
|
23
|
+
CardSummaryItem.tsx — single summary row with optional collapsible objects
|
|
24
|
+
CardSummary.types.ts
|
|
25
|
+
CardSummary.styles.tsx
|
|
26
|
+
constants.ts — ANIMATION_DURATION = 300 (ms)
|
|
27
|
+
index.ts — public exports
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Public exports
|
|
31
|
+
|
|
32
|
+
### `Card` (default export)
|
|
33
|
+
|
|
34
|
+
Props (`CardProps` = `WithHTMLAttributes<HTMLDivElement, …>`):
|
|
35
|
+
|
|
36
|
+
| Prop | Type | Default | Description |
|
|
37
|
+
|------|------|---------|-------------|
|
|
38
|
+
| `children` | `ReactNode` | `undefined` | Main body content (animated, hidden when `hideContent=true`). |
|
|
39
|
+
| `background` | `'white' \| 'white-shadow' \| 'grey' \| 'grey-shadow' \| 'outline'` | `'white-shadow'` | Controls background colour and box-shadow. |
|
|
40
|
+
| `raised` | `boolean` | `undefined` | Forces active box-shadow regardless of hover. |
|
|
41
|
+
| `lively` | `boolean` | `undefined` | Adds hover box-shadow. |
|
|
42
|
+
| `disabled` | `boolean` | `undefined` | `pointer-events: none` + 40% opacity. |
|
|
43
|
+
| `withHeader` | `boolean` | `undefined` | Renders the header section (title, icon, description, side actions). |
|
|
44
|
+
| `title` | `ReactNode` | `undefined` | Card header title (`<Title level={4}>`). |
|
|
45
|
+
| `titleTag` | `ReactNode` | `undefined` | Element rendered inline next to the title (e.g. a status tag). |
|
|
46
|
+
| `description` | `ReactNode` | `undefined` | Subtitle text below (or beside, if `compactHeader`) the title. |
|
|
47
|
+
| `compactHeader` | `boolean` | `undefined` | Renders title + description side by side on one line. |
|
|
48
|
+
| `icon` | `ReactNode` | `undefined` | Icon shown in the header slot. Takes precedence over `avatar` and `renderBadge`. |
|
|
49
|
+
| `iconColor` | `string` | `undefined` | CSS colour passed to `<Icon color>`. |
|
|
50
|
+
| `avatar` | `ReactNode` | `undefined` | Avatar shown in the header slot when `icon` is absent. |
|
|
51
|
+
| `renderBadge` | `() => ReactNode` | `undefined` | Render-prop for a custom badge; used when neither `icon` nor `avatar` is set. |
|
|
52
|
+
| `headerSideChildren` | `ReactNode` | `undefined` | Actions area on the right side of the header. Wrapped in `VisibilitySensor`. |
|
|
53
|
+
| `onHeaderClick` | `(e: SyntheticEvent) => void` | `undefined` | Click handler on the header; adds `cursor: pointer` when set. |
|
|
54
|
+
| `headerBorderBottom` | `boolean` | `undefined` | Renders a 1px bottom border under the header. |
|
|
55
|
+
| `defaultHeaderBackgroundColor` | `boolean` | `undefined` | Forces white background on the header. |
|
|
56
|
+
| `withoutPadding` | `boolean` | `undefined` | Removes 24px padding from the content wrapper. |
|
|
57
|
+
| `hideContent` | `boolean` | `undefined` | Collapses the main `children` area (animated via `react-animate-height`). |
|
|
58
|
+
| `staticContent` | `ReactNode` | `undefined` | Content that animates in the *opposite* direction of `children` — visible when `hideContent=true`, hidden otherwise. |
|
|
59
|
+
| `showSideChildrenWhenHeaderHidden` | `boolean` | `undefined` | Re-renders `headerSideChildren` in a sticky footer when the header scrolls out of view (tracked via `VisibilitySensor`). |
|
|
60
|
+
| `className` | `string` | `undefined` | Additional class; `ds-card` is always added. |
|
|
61
|
+
| `style` | `CSSProperties` | `undefined` | Inline styles on the root container. |
|
|
62
|
+
|
|
63
|
+
### `CardGroup`
|
|
64
|
+
|
|
65
|
+
CSS grid wrapper for laying out multiple `Card`s side by side.
|
|
66
|
+
|
|
67
|
+
| Prop | Type | Default | Description |
|
|
68
|
+
|------|------|---------|-------------|
|
|
69
|
+
| `columns` | `number` | — | **Required.** Number of equal-width columns (`1fr` each, 24px gap). |
|
|
70
|
+
| `children` | `ReactNode` | — | **Required.** `Card` elements. |
|
|
71
|
+
|
|
72
|
+
### `CardBadge`
|
|
73
|
+
|
|
74
|
+
Circular 24×24 icon badge for use as `renderBadge` content or standalone.
|
|
75
|
+
|
|
76
|
+
| Prop | Type | Default | Description |
|
|
77
|
+
|------|------|---------|-------------|
|
|
78
|
+
| `icon` | `ReactNode` | — | **Required.** Icon element rendered inside the badge. |
|
|
79
|
+
| `status` | `'success' \| 'checked' \| 'warning' \| 'error' \| 'default'` | `'default'` | Controls background (`green/yellow/red-600` or transparent) and icon colour. |
|
|
80
|
+
|
|
81
|
+
### `CardSummary`
|
|
82
|
+
|
|
83
|
+
Bulleted summary list intended for use in `Card`'s `staticContent` prop.
|
|
84
|
+
|
|
85
|
+
| Prop | Type | Default | Description |
|
|
86
|
+
|------|------|---------|-------------|
|
|
87
|
+
| `items` | `CardSummaryItemProps[]` | — | **Required.** List of summary rows. |
|
|
88
|
+
| `title` | `ReactNode` | `undefined` | Optional heading above the list. |
|
|
89
|
+
|
|
90
|
+
Each item in `items` (`CardSummaryItemProps`):
|
|
91
|
+
|
|
92
|
+
| Prop | Type | Default | Description |
|
|
93
|
+
|------|------|---------|-------------|
|
|
94
|
+
| `key` | `Key` | — | **Required.** React key. |
|
|
95
|
+
| `value` | `ReactNode` | — | **Required.** Primary value displayed. |
|
|
96
|
+
| `label` | `ReactNode` | `undefined` | Optional label shown before `value` with a colon. |
|
|
97
|
+
| `valueButton` | `ReactNode` | `undefined` | Action button placed to the right of the value. |
|
|
98
|
+
| `summaryObjects` | `ReactElement[]` | `undefined` | Collapsible list of child elements (toggled with an angle icon). |
|
|
99
|
+
| `summaryObjectsDirection` | `'row' \| 'column'` | `'row'` | Flex direction of the `summaryObjects` container. |
|
|
100
|
+
|
|
101
|
+
### `CardStyles`
|
|
102
|
+
|
|
103
|
+
Named export containing all styled-component maps (`CardStyles.Card`, `CardStyles.CardGroup`, `CardStyles.CardBadge`) for targeted overrides in consuming apps.
|
|
104
|
+
|
|
105
|
+
### Type exports
|
|
106
|
+
|
|
107
|
+
`CardProps`, `Backgrounds`, `CardGroupProps`, `CardBadgeProps`, `BadgeStatus`, `CardSummaryProps`
|
|
108
|
+
|
|
109
|
+
## Usage patterns
|
|
110
|
+
|
|
111
|
+
```tsx
|
|
112
|
+
import Card, { CardGroup, CardBadge, CardSummary } from '@synerise/ds-card';
|
|
113
|
+
|
|
114
|
+
// Basic card with header
|
|
115
|
+
<Card withHeader title="Title" description="Subtitle" icon={<MyIcon />} iconColor="#54cb0b" lively>
|
|
116
|
+
Content goes here
|
|
117
|
+
</Card>
|
|
118
|
+
|
|
119
|
+
// Collapsible card — body hidden, static content shown
|
|
120
|
+
<Card
|
|
121
|
+
withHeader
|
|
122
|
+
title="Summary"
|
|
123
|
+
hideContent
|
|
124
|
+
staticContent={
|
|
125
|
+
<CardSummary
|
|
126
|
+
items={[
|
|
127
|
+
{ key: '1', label: 'Status', value: 'Active' },
|
|
128
|
+
{ key: '2', value: 'Details', summaryObjects: [<span>Item</span>] },
|
|
129
|
+
]}
|
|
130
|
+
/>
|
|
131
|
+
}
|
|
132
|
+
/>
|
|
133
|
+
|
|
134
|
+
// Grid of cards
|
|
135
|
+
<CardGroup columns={3}>
|
|
136
|
+
<Card>A</Card>
|
|
137
|
+
<Card>B</Card>
|
|
138
|
+
<Card>C</Card>
|
|
139
|
+
</CardGroup>
|
|
140
|
+
|
|
141
|
+
// CardBadge as renderBadge
|
|
142
|
+
<Card withHeader renderBadge={() => <CardBadge icon={<CheckS />} status="success" />} title="Done" />
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## Key dependencies
|
|
146
|
+
|
|
147
|
+
- `react-animate-height` — animates `children` and `staticContent` show/hide (300ms). The `children` area fades in via a `.card-animation` CSS class that targets `.rah-static--height-auto`.
|
|
148
|
+
- `react-visibility-sensor` — wraps `headerSideChildren` to detect when the header leaves the viewport; powers `showSideChildrenWhenHeaderHidden`.
|
|
149
|
+
- `uuid` — used in `CardSummaryItem` to key `summaryObjects` elements that lack a `.key`.
|
|
150
|
+
|
|
151
|
+
## Implementation notes
|
|
152
|
+
|
|
153
|
+
- **`icon` > `avatar` > `renderBadge`**: all three occupy the same header slot. Rendering order is `(icon && …) || avatar || (renderBadge && renderBadge())` — `icon` wins if set.
|
|
154
|
+
- **`staticContent` is inverted**: it uses `height={hideContent ? 'auto' : 0}` while `children` uses `height={hideContent ? 0 : 'auto'}`. Pass `staticContent` when you want content that stays visible when the main body is collapsed.
|
|
155
|
+
- **`headerSideChildren` click propagation**: the element is wrapped in a `div` with `onClick={(e) => e.stopPropagation()}` to prevent triggering `onHeaderClick`.
|
|
156
|
+
- **`background` default** is `'white-shadow'`, not `'white'` — the README incorrectly listed `'white'`.
|
|
157
|
+
- **`size` prop does not exist** in the current source — the README mentions it but it is not in `Card.types.ts` and is not used anywhere in the component.
|
|
158
|
+
- **`CardSummary` placement**: `PaddingWrapper` in `Card.styles.ts` applies `margin: 0 48px` specifically to `CardSummaryWrapper` children, so `CardSummary` inside `staticContent` gets extra horizontal margin automatically.
|
|
159
|
+
- **`compactHeader`**: when `true`, title and description appear side by side (flex row) with a vertical divider between them. Title height is fixed at 32px.
|
|
160
|
+
- **`titleTag`**: rendered in a flex row next to the title text, not below — useful for a status `<Tag>`.
|
|
@@ -16,7 +16,7 @@ export declare const Header: import('styled-components').StyledComponent<"div",
|
|
|
16
16
|
headerBorderBottom?: boolean;
|
|
17
17
|
defaultHeaderBackgroundColor?: boolean;
|
|
18
18
|
}, never>;
|
|
19
|
-
export declare const Title: import('styled-components').StyledComponent<({ level, withoutMargin, children, className, ellipsis, ...
|
|
19
|
+
export declare const Title: import('styled-components').StyledComponent<({ level, withoutMargin, children, className, ellipsis, ...rest }: import('@synerise/ds-typography/dist/Title.types').Props) => React.JSX.Element, any, {
|
|
20
20
|
fat: boolean;
|
|
21
21
|
}, never>;
|
|
22
22
|
export declare const TitleWrapper: import('styled-components').StyledComponent<"div", any, {
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { SummaryObjectsDirection } from './CardSummary.types';
|
|
2
2
|
export declare const CardSummaryWrapper: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
3
|
-
export declare const CardSummaryTitle: import('styled-components').StyledComponent<({ level, withoutMargin, children, className, ellipsis, ...
|
|
3
|
+
export declare const CardSummaryTitle: import('styled-components').StyledComponent<({ level, withoutMargin, children, className, ellipsis, ...rest }: import('@synerise/ds-typography/dist/Title.types').Props) => React.JSX.Element, any, {}, never>;
|
|
4
4
|
export declare const CardSummaryList: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
5
5
|
export declare const CardSummaryItemWrapper: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
6
6
|
export declare const ValueButtonWrapper: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
7
7
|
export declare const CardSummaryItemDetailsWrapper: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
8
8
|
export declare const CardSummaryItemDetails: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
9
9
|
export declare const CardSummaryItemLabelValueWrapper: import('styled-components').StyledComponent<"span", any, {}, never>;
|
|
10
|
-
export declare const CardSummaryItemLabel: import('styled-components').StyledComponent<({ size, className, children, ellipsis, style, }: {
|
|
10
|
+
export declare const CardSummaryItemLabel: import('styled-components').StyledComponent<({ size, className, children, ellipsis, style, strong, ...dataAttributes }: import('@synerise/ds-utils').DataAttributes & {
|
|
11
11
|
size?: import('@synerise/ds-typography').TextSize;
|
|
12
12
|
ellipsis?: import('@synerise/ds-typography/dist/Ellipsis').EllipsisProps;
|
|
13
13
|
children?: import('react').ReactNode;
|
|
14
14
|
className?: string;
|
|
15
15
|
style?: import('react').CSSProperties;
|
|
16
|
+
strong?: boolean;
|
|
16
17
|
}) => React.JSX.Element, any, {}, never>;
|
|
17
18
|
export declare const CardSummaryItemValue: import('styled-components').StyledComponent<"span", any, {}, never>;
|
|
18
19
|
export declare const IconWrapper: import('styled-components').StyledComponent<"div", any, {}, never>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-card",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.17",
|
|
4
4
|
"description": "Card UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "Synerise/synerise-design",
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
"files": [
|
|
18
18
|
"/dist",
|
|
19
19
|
"CHANGELOG.md",
|
|
20
|
+
"CLAUDE.md",
|
|
20
21
|
"README.md",
|
|
21
22
|
"package.json",
|
|
22
23
|
"LICENSE.md"
|
|
@@ -41,11 +42,11 @@
|
|
|
41
42
|
],
|
|
42
43
|
"types": "dist/index.d.ts",
|
|
43
44
|
"dependencies": {
|
|
44
|
-
"@synerise/ds-avatar": "^1.3.
|
|
45
|
-
"@synerise/ds-icon": "^1.18.
|
|
46
|
-
"@synerise/ds-tag": "^1.4.
|
|
47
|
-
"@synerise/ds-typography": "^1.1.
|
|
48
|
-
"@synerise/ds-utils": "^1.10.
|
|
45
|
+
"@synerise/ds-avatar": "^1.3.19",
|
|
46
|
+
"@synerise/ds-icon": "^1.18.5",
|
|
47
|
+
"@synerise/ds-tag": "^1.4.32",
|
|
48
|
+
"@synerise/ds-typography": "^1.1.27",
|
|
49
|
+
"@synerise/ds-utils": "^1.10.2",
|
|
49
50
|
"react-animate-height": "^2.0.23",
|
|
50
51
|
"react-visibility-sensor": "^5.1.1",
|
|
51
52
|
"uuid": "^8.3.2"
|
|
@@ -57,5 +58,5 @@
|
|
|
57
58
|
"styled-components": "^5.3.3",
|
|
58
59
|
"vitest": "4"
|
|
59
60
|
},
|
|
60
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "d0a43cc43d8528a36f105aceea52ab470edb71d9"
|
|
61
62
|
}
|