@synerise/ds-information-card 1.7.7 → 1.7.8
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 +4 -0
- package/CLAUDE.md +147 -0
- package/package.json +22 -21
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,10 @@
|
|
|
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.7.8](https://github.com/Synerise/synerise-design/compare/@synerise/ds-information-card@1.7.7...@synerise/ds-information-card@1.7.8) (2026-07-23)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @synerise/ds-information-card
|
|
9
|
+
|
|
6
10
|
## [1.7.7](https://github.com/Synerise/synerise-design/compare/@synerise/ds-information-card@1.7.6...@synerise/ds-information-card@1.7.7) (2026-07-16)
|
|
7
11
|
|
|
8
12
|
**Note:** Version bump only for package @synerise/ds-information-card
|
package/CLAUDE.md
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
# InformationCard (`@synerise/ds-information-card`)
|
|
2
|
+
|
|
3
|
+
> Rich detail card for displaying entity/object information — title, subtitle, icon badge, description, property list, summary row, footer, and an optional slide-in actions menu. Ships with `InformationCardTooltip` to render it on hover over any trigger element.
|
|
4
|
+
|
|
5
|
+
## Package structure
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
src/
|
|
9
|
+
InformationCard.tsx — main component (forwardRef)
|
|
10
|
+
InformationCard.types.tsx — InformationCardProps, BadgeData
|
|
11
|
+
InformationCard.styles.tsx — INFOCARD_WIDTH, all card styled-components
|
|
12
|
+
InformationCard.utils.tsx — buildInitialsBadge, buildIconBadge, buildExtraInfo
|
|
13
|
+
index.ts — public exports
|
|
14
|
+
InformationCardActions/ — slide-in quick-actions menu panel
|
|
15
|
+
InformationCardDescription/ — editable or static description area
|
|
16
|
+
InformationCardFooter/ — footer text + action button
|
|
17
|
+
InformationCardLoading/ — skeleton placeholder layout used when `isLoading` is true
|
|
18
|
+
InformationCardPropertyList/ — label/value property rows + dividers
|
|
19
|
+
InformationCardSummary/ — icon + label summary items row
|
|
20
|
+
InformationCardTooltip/ — hover popover wrapper (forwardRef)
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Public exports
|
|
24
|
+
|
|
25
|
+
### `InformationCard` (default export)
|
|
26
|
+
|
|
27
|
+
`forwardRef<HTMLDivElement, InformationCardProps>`. Fixed width of **350 px**.
|
|
28
|
+
|
|
29
|
+
| Prop | Type | Default | Description |
|
|
30
|
+
|------|------|---------|-------------|
|
|
31
|
+
| `title` | `ReactNode` | — | Card title; string values get a copy-on-click button. **Required** unless `isLoading` is `true`. |
|
|
32
|
+
| `isLoading` | `boolean` | `false` | Renders a skeleton placeholder (avatar + 3 bars + empty footer band) instead of the card contents. When `true`, all content props are ignored and `title` is not required. |
|
|
33
|
+
| `subtitle` | `ReactNode` | `undefined` | Second line; string values get a copy-on-click button |
|
|
34
|
+
| `icon` | `ReactNode` | `undefined` | Avatar icon (raw SVG); use with `buildIconBadge` or `buildInitialsBadge` helpers |
|
|
35
|
+
| `iconColor` | `string` | `undefined` | Color applied to `icon` element |
|
|
36
|
+
| `renderBadge` | `Function \| null` | `undefined` | Custom badge render prop; `null` hides the badge entirely |
|
|
37
|
+
| `avatarTooltipText` | `string` | `undefined` | Tooltip on the avatar badge (requires `renderBadge`) |
|
|
38
|
+
| `copyTooltip` | `string` | `undefined` | Tooltip shown before copying subtitle |
|
|
39
|
+
| `copiedTooltip` | `string` | `undefined` | Tooltip shown after copying subtitle |
|
|
40
|
+
| `notice` | `ReactNode` | `undefined` | Warning/error/notice shown between subtitle and description |
|
|
41
|
+
| `descriptionConfig` | `SubtleTextAreaProps \| string \| null` | `undefined` | Editable textarea config or static string for description; `null` or omit to hide |
|
|
42
|
+
| `renderAdditionalDescription` | `() => ReactNode` | `undefined` | Render prop for extra content above the footer |
|
|
43
|
+
| `renderFooter` | `() => JSX.Element` | `undefined` | Fully custom footer renderer; replaces default footer |
|
|
44
|
+
| `footerText` | `ReactNode \| null` | `undefined` | Footer label text; `null` hides footer entirely |
|
|
45
|
+
| `actionButton` | `boolean \| (() => ReactNode)` | `undefined` | Bottom-right action button: `true` uses default icon, function renders custom element |
|
|
46
|
+
| `actionButtonCallback` | `() => void` | `undefined` | Click handler for default action button |
|
|
47
|
+
| `actionButtonTooltipText` | `string` | `undefined` | Tooltip for default action button |
|
|
48
|
+
| `actionsMenu` | `Omit<InformationCardActionsProps, 'onHeaderClick' \| 'maxHeight'>` | `undefined` | Quick-actions config; shows a "Quick actions" footer button that slides in a menu |
|
|
49
|
+
| `propertyListItems` | `InformationCardPropertyItem[]` | `undefined` | Label/value property rows; may include `{ type: 'divider' }` entries |
|
|
50
|
+
| `summaryItems` | `InformationCardSummaryItem[]` | `undefined` | Icon+label summary row items with optional tooltip |
|
|
51
|
+
| `asTooltip` | `boolean` | `undefined` | Adjusts internal styles for tooltip rendering (used by `InformationCardTooltip`) |
|
|
52
|
+
| `className` | `string` | `undefined` | Additional CSS class |
|
|
53
|
+
| + all `HTMLDivElement` attributes | | | |
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
### `InformationCardTooltip`
|
|
58
|
+
|
|
59
|
+
`forwardRef<HTMLDivElement, InformationCardTooltipProps>`. Wraps `InformationCard` in a hover popover (floating-ui).
|
|
60
|
+
|
|
61
|
+
| Prop | Type | Default | Description |
|
|
62
|
+
|------|------|---------|-------------|
|
|
63
|
+
| `children` | `ReactNode` | — | **Required.** Trigger element |
|
|
64
|
+
| `informationCardProps` | `InformationCardProps` | `undefined` | Props forwarded to `<InformationCard>` (alternative to `content`) |
|
|
65
|
+
| `content` | `ReactNode` | `undefined` | Custom content alternative to `informationCardProps` |
|
|
66
|
+
| `popoverProps` | `Omit<PopoverOptions, 'listNavigationConfig' \| 'arrowConfig' \| 'returnFocus' \| 'modal'>` | `undefined` | Pass-through to `@synerise/ds-popover` (floating-ui) |
|
|
67
|
+
| `asChild` | `boolean` | `undefined` | Forward trigger props to first child (Radix-style) |
|
|
68
|
+
| + all `HTMLDivElement` attributes | | | |
|
|
69
|
+
|
|
70
|
+
Default popover config: hover trigger, 100 ms open delay, 400 ms close delay, 8 px main-axis offset.
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
### `InformationCardPropertyList`
|
|
75
|
+
|
|
76
|
+
Standalone property list component. Props: `items?: InformationCardPropertyItem[]`.
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
### Utility functions
|
|
81
|
+
|
|
82
|
+
| Function | Signature | Description |
|
|
83
|
+
|----------|-----------|-------------|
|
|
84
|
+
| `buildInitialsBadge` | `(name: string) => ReactNode` | Creates an avatar badge with initials extracted from `name` |
|
|
85
|
+
| `buildIconBadge` | `(data: BadgeData) => ReactNode` | Creates an `ObjectAvatar` badge from `BadgeData` config |
|
|
86
|
+
| `buildExtraInfo` | `(message: ReactNode, level: string) => ReactNode` | Wraps message in a styled alert wrapper for the `notice` prop |
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
### Type exports
|
|
91
|
+
|
|
92
|
+
`InformationCardProps`, `BadgeData`, `InformationCardTooltipProps`, `LegacyInformationCardPlacement`, `StyledInformationCardTooltip`, `InformationCardPropertyItem`, `InformationCardPropertyDivider`, `InformationCardPropertyItemTypes`, `InformationCardPropertyListProps`.
|
|
93
|
+
|
|
94
|
+
## Usage patterns
|
|
95
|
+
|
|
96
|
+
```tsx
|
|
97
|
+
import InformationCard, {
|
|
98
|
+
InformationCardTooltip,
|
|
99
|
+
buildIconBadge,
|
|
100
|
+
buildInitialsBadge,
|
|
101
|
+
} from '@synerise/ds-information-card';
|
|
102
|
+
|
|
103
|
+
// As a standalone card
|
|
104
|
+
<InformationCard
|
|
105
|
+
title="Customer segment"
|
|
106
|
+
subtitle="ID: 12345"
|
|
107
|
+
icon={<SegmentM />}
|
|
108
|
+
iconColor="mars"
|
|
109
|
+
renderBadge={() => buildIconBadge({ iconElement: <SegmentM />, iconColor: 'mars' })}
|
|
110
|
+
propertyListItems={[
|
|
111
|
+
{ label: 'Created', value: '2024-01-01' },
|
|
112
|
+
{ type: 'divider' },
|
|
113
|
+
{ label: 'Members', value: '1,200' },
|
|
114
|
+
]}
|
|
115
|
+
/>
|
|
116
|
+
|
|
117
|
+
// As a tooltip on hover
|
|
118
|
+
<InformationCardTooltip
|
|
119
|
+
informationCardProps={{
|
|
120
|
+
title: 'Customer segment',
|
|
121
|
+
subtitle: 'ID: 12345',
|
|
122
|
+
}}
|
|
123
|
+
popoverProps={{ placement: 'top' }}
|
|
124
|
+
>
|
|
125
|
+
<button>Hover me</button>
|
|
126
|
+
</InformationCardTooltip>
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## Key dependencies
|
|
130
|
+
|
|
131
|
+
- `@synerise/ds-popover` (floating-ui) — `InformationCardTooltip` hover popover
|
|
132
|
+
- `@synerise/ds-subtle-form` — `SubtleTextAreaProps` used for editable description; imported via **deep path** `dist/Elements/TextArea/TextArea.types`
|
|
133
|
+
- `@synerise/ds-avatar` — `Color` and `Size` types imported via **deep path** `dist/Avatar.types`
|
|
134
|
+
- `@floating-ui/react` — `FloatingDelayGroup` wrapping for nested popover delay isolation
|
|
135
|
+
- `react-resize-detector` — `useResizeObserver` used to track card height for the actions-menu slide animation
|
|
136
|
+
|
|
137
|
+
## Implementation notes
|
|
138
|
+
|
|
139
|
+
- The actions-menu panel **slides in over the main card content** (`InfoCardSlide`). Height is tracked via `useResizeObserver` so the slide container matches card height exactly — do not set a fixed height on the card wrapper.
|
|
140
|
+
- The loading branch short-circuits **before** the `FloatingDelayGroup` wrapper: `InformationCardLoading` is rendered directly inside `InfoCardWrapper` so it inherits the 350px width, shadow, and `asTooltip` styling but skips the actions-menu slide machinery. Sets `aria-busy` for assistive tech.
|
|
141
|
+
- `InformationCardLoading` reuses `Skeleton` and `SkeletonAvatar` from `@synerise/ds-skeleton`; the `LoadingBody` style neutralises the inner `Skeleton` `Container` padding via the `Container` import from `@synerise/ds-skeleton/dist/Skeleton.styles`.
|
|
142
|
+
- `InformationCardTooltip` wraps the trigger in a `display: contents` div — this preserves parent layout but means the wrapper itself takes no space. Use `asChild` if you need the trigger to receive ref/event props directly.
|
|
143
|
+
- `subtitle` and `title` accept `ReactNode` (not just `string`) — copy-on-click only activates when the value is a plain string.
|
|
144
|
+
- `actionsMenu` omits `onHeaderClick` and `maxHeight` from `InformationCardActionsProps` — these are managed internally.
|
|
145
|
+
- `renderBadge={null}` explicitly hides the badge; omitting `renderBadge` uses the default icon rendering via `icon` + `buildIconBadge`.
|
|
146
|
+
- Two deep imports are fragile: `@synerise/ds-avatar/dist/Avatar.types` and `@synerise/ds-subtle-form/dist/Elements/TextArea/TextArea.types` — changes to those packages' dist layout will break the build.
|
|
147
|
+
- Uses Jest (not Vitest) — `jest.config.js` is present; several tests are skipped with `xit`/`it.todo`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-information-card",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.8",
|
|
4
4
|
"description": "InformationCard 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"
|
|
@@ -43,25 +44,25 @@
|
|
|
43
44
|
"types": "dist/index.d.ts",
|
|
44
45
|
"dependencies": {
|
|
45
46
|
"@floating-ui/react": "^0.27.16",
|
|
46
|
-
"@synerise/ds-alert": "^1.1.
|
|
47
|
-
"@synerise/ds-avatar": "^1.3.
|
|
48
|
-
"@synerise/ds-badge": "^1.0.
|
|
49
|
-
"@synerise/ds-button": "^1.5.
|
|
50
|
-
"@synerise/ds-card": "^1.3.
|
|
51
|
-
"@synerise/ds-copy-icon": "^1.2.
|
|
52
|
-
"@synerise/ds-description": "^1.3.
|
|
53
|
-
"@synerise/ds-divider": "^1.3.
|
|
54
|
-
"@synerise/ds-dropdown": "^1.3.
|
|
55
|
-
"@synerise/ds-icon": "^1.18.
|
|
56
|
-
"@synerise/ds-menu": "^1.4.
|
|
57
|
-
"@synerise/ds-popover": "^1.6.
|
|
58
|
-
"@synerise/ds-scrollbar": "^1.5.
|
|
59
|
-
"@synerise/ds-skeleton": "^1.0.
|
|
60
|
-
"@synerise/ds-status": "^1.3.
|
|
61
|
-
"@synerise/ds-subtle-form": "^1.2.
|
|
62
|
-
"@synerise/ds-tooltip": "^1.5.
|
|
63
|
-
"@synerise/ds-typography": "^1.1.
|
|
64
|
-
"@synerise/ds-utils": "^1.10.
|
|
47
|
+
"@synerise/ds-alert": "^1.1.62",
|
|
48
|
+
"@synerise/ds-avatar": "^1.3.19",
|
|
49
|
+
"@synerise/ds-badge": "^1.0.58",
|
|
50
|
+
"@synerise/ds-button": "^1.5.35",
|
|
51
|
+
"@synerise/ds-card": "^1.3.17",
|
|
52
|
+
"@synerise/ds-copy-icon": "^1.2.16",
|
|
53
|
+
"@synerise/ds-description": "^1.3.16",
|
|
54
|
+
"@synerise/ds-divider": "^1.3.16",
|
|
55
|
+
"@synerise/ds-dropdown": "^1.3.20",
|
|
56
|
+
"@synerise/ds-icon": "^1.18.5",
|
|
57
|
+
"@synerise/ds-menu": "^1.4.32",
|
|
58
|
+
"@synerise/ds-popover": "^1.6.2",
|
|
59
|
+
"@synerise/ds-scrollbar": "^1.5.2",
|
|
60
|
+
"@synerise/ds-skeleton": "^1.0.60",
|
|
61
|
+
"@synerise/ds-status": "^1.3.32",
|
|
62
|
+
"@synerise/ds-subtle-form": "^1.2.8",
|
|
63
|
+
"@synerise/ds-tooltip": "^1.5.4",
|
|
64
|
+
"@synerise/ds-typography": "^1.1.27",
|
|
65
|
+
"@synerise/ds-utils": "^1.10.2",
|
|
65
66
|
"uuid": "^8.3.2"
|
|
66
67
|
},
|
|
67
68
|
"peerDependencies": {
|
|
@@ -71,5 +72,5 @@
|
|
|
71
72
|
"styled-components": "^5.3.3",
|
|
72
73
|
"vitest": "4"
|
|
73
74
|
},
|
|
74
|
-
"gitHead": "
|
|
75
|
+
"gitHead": "d0a43cc43d8528a36f105aceea52ab470edb71d9"
|
|
75
76
|
}
|