@synerise/ds-section-message 1.0.38 → 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/CHANGELOG.md +8 -0
- package/CLAUDE.md +123 -0
- package/package.json +5 -4
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
|
+
# [2.0.0](https://github.com/Synerise/synerise-design/compare/@synerise/ds-section-message@1.0.39...@synerise/ds-section-message@2.0.0) (2026-08-26)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @synerise/ds-section-message
|
|
9
|
+
|
|
10
|
+
## [1.0.39](https://github.com/Synerise/synerise-design/compare/@synerise/ds-section-message@1.0.38...@synerise/ds-section-message@1.0.39) (2026-07-23)
|
|
11
|
+
|
|
12
|
+
**Note:** Version bump only for package @synerise/ds-section-message
|
|
13
|
+
|
|
6
14
|
## [1.0.38](https://github.com/Synerise/synerise-design/compare/@synerise/ds-section-message@1.0.37...@synerise/ds-section-message@1.0.38) (2026-06-17)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @synerise/ds-section-message
|
package/CLAUDE.md
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# SectionMessage (`@synerise/ds-section-message`)
|
|
2
|
+
|
|
3
|
+
> A themed alert/banner component that displays a message with a type-specific icon, optional description, actions, and a close button.
|
|
4
|
+
|
|
5
|
+
## Package structure
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
src/
|
|
9
|
+
SectionMessage.tsx — main component
|
|
10
|
+
SectionMessage.types.ts — prop types and union types
|
|
11
|
+
SectionMessage.const.tsx — ICONS map and DEFAULT_ICON
|
|
12
|
+
SectionMessage.styles.tsx — styled-components
|
|
13
|
+
SectionMessage.utils.tsx — color helpers and isSectionType guard
|
|
14
|
+
index.ts — public exports
|
|
15
|
+
modules.d.ts — jest-dom augmentation
|
|
16
|
+
__specs__/
|
|
17
|
+
SectionMessage.spec.tsx — Vitest tests
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Public exports
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
export default SectionMessage;
|
|
24
|
+
export type { SectionMessageProps, SectionType, CustomColorType };
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### `SectionMessage`
|
|
28
|
+
|
|
29
|
+
| Prop | Type | Default | Description |
|
|
30
|
+
|------|------|---------|-------------|
|
|
31
|
+
| `type` | `SectionType` | — (required) | Visual variant; drives background, border and icon colours |
|
|
32
|
+
| `message` | `ReactNode` | — | Bold heading text |
|
|
33
|
+
| `description` | `ReactNode` | — | Regular-weight body text rendered below the message |
|
|
34
|
+
| `icon` | `ReactNode` | type-derived icon | Overrides the automatic icon for the given type |
|
|
35
|
+
| `customIcon` | `ReactElement` | — | Renders the element directly (bypasses `<Icon>` wrapper); takes precedence over `icon` |
|
|
36
|
+
| `customColor` | `CustomColorType` | — | Overrides the background and border colours using the palette |
|
|
37
|
+
| `customColorIcon` | `CustomColorType` | — | Overrides the icon and top-border colour |
|
|
38
|
+
| `showMoreLabel` | `ReactNode` | — | Label for the "show more" link; only rendered when `onShowMore` is also provided |
|
|
39
|
+
| `onShowMore` | `() => void` | — | Click handler for the "show more" link; requires `showMoreLabel` |
|
|
40
|
+
| `onClose` | `() => void` | — | Called when the close button is clicked; only active when `withClose` is truthy |
|
|
41
|
+
| `withClose` | `ReactNode` | — | When truthy, shows a close (`CloseM`) button; actual value is unused — only truthiness matters |
|
|
42
|
+
| `suffixel` | `ReactNode` | — | Content placed in the right-hand action area, before the close button |
|
|
43
|
+
| `moreButtons` | `ReactNode` | — | Additional action buttons rendered inside the content area |
|
|
44
|
+
| `withEmphasis` | `ReactNode` | — | Bold inline content; only rendered when `withLink` is falsy |
|
|
45
|
+
| `withLink` | `ReactNode` | — | Underlined link content; rendered instead of `withEmphasis`; also adjusts content area padding |
|
|
46
|
+
| `unorderedList` | `ReactNode` | — | List content; only rendered when `moreButtons` is falsy |
|
|
47
|
+
| `color` | `ColorType` | — | **Deprecated** — use `customColor` instead |
|
|
48
|
+
|
|
49
|
+
All standard `HTMLDivElement` attributes are forwarded to the root `<div>` via `WithHTMLAttributes`.
|
|
50
|
+
|
|
51
|
+
### Type aliases
|
|
52
|
+
|
|
53
|
+
```ts
|
|
54
|
+
type SectionType = 'positive' | 'notice' | 'negative' | 'neutral' | 'supply' | 'service' | 'entity';
|
|
55
|
+
|
|
56
|
+
type CustomColorType =
|
|
57
|
+
| 'blue' | 'grey' | 'red' | 'green' | 'yellow'
|
|
58
|
+
| 'pink' | 'mars' | 'orange' | 'fern' | 'cyan' | 'purple' | 'violet';
|
|
59
|
+
|
|
60
|
+
/** @deprecated */
|
|
61
|
+
type ColorType = 'grey' | 'red' | 'green' | 'yellow' | 'violet' | 'purple' | 'cyan';
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Usage patterns
|
|
65
|
+
|
|
66
|
+
```tsx
|
|
67
|
+
import SectionMessage from '@synerise/ds-section-message';
|
|
68
|
+
|
|
69
|
+
// Basic
|
|
70
|
+
<SectionMessage type="negative" message="Payment failed" description="Please check your card details." />
|
|
71
|
+
|
|
72
|
+
// With close button
|
|
73
|
+
<SectionMessage type="notice" message="Maintenance window" withClose onClose={() => setVisible(false)} />
|
|
74
|
+
|
|
75
|
+
// Custom colour override
|
|
76
|
+
<SectionMessage type="neutral" message="Info" customColor="pink" customColorIcon="pink" />
|
|
77
|
+
|
|
78
|
+
// Show more + suffix actions
|
|
79
|
+
<SectionMessage
|
|
80
|
+
type="positive"
|
|
81
|
+
message="Import complete"
|
|
82
|
+
showMoreLabel="See details"
|
|
83
|
+
onShowMore={handleDetails}
|
|
84
|
+
suffixel={<Button>Undo</Button>}
|
|
85
|
+
/>
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Styling
|
|
89
|
+
|
|
90
|
+
All colours are derived from the design-system theme palette using the `type` prop:
|
|
91
|
+
|
|
92
|
+
| `type` | Background | Border | Icon / top-border |
|
|
93
|
+
|--------|-----------|--------|-------------------|
|
|
94
|
+
| `positive` | `green-050` | `green-200` | `green-600` |
|
|
95
|
+
| `negative` | `red-050` | `red-200` | `red-600` |
|
|
96
|
+
| `notice` | `yellow-050` | `yellow-200` | `yellow-600` |
|
|
97
|
+
| `neutral` | `grey-050` | `grey-200` | `grey-600` |
|
|
98
|
+
| `supply` | `violet-050` | `violet-200` | `violet-600` |
|
|
99
|
+
| `service` | `purple-050` | `purple-200` | `purple-600` |
|
|
100
|
+
| `entity` | `cyan-050` | `cyan-200` | `cyan-600` |
|
|
101
|
+
|
|
102
|
+
When `customColor` / `customColorIcon` are set, they use the same palette pattern (`<color>-050`, `<color>-200`, `<color>-600`) and fully override the type-derived values.
|
|
103
|
+
|
|
104
|
+
The component has a `border-radius: 2px` and a thicker `border-top: 2px` that carries the accent colour.
|
|
105
|
+
|
|
106
|
+
Several styled components (`NumberWrapper`, `OrderWrapper`, `IconOrderWrapper`, `Wrapper`) are defined in `SectionMessage.styles.tsx` but are not used in `SectionMessage.tsx` — they appear to be legacy/unused.
|
|
107
|
+
|
|
108
|
+
## Key dependencies
|
|
109
|
+
|
|
110
|
+
- `@synerise/ds-icon` — `Icon` wrapper component plus icon components (`Check2M`, `WarningM`, `InfoM`, `NotificationsReceiveM`, `UpdateDataM`, `UserUpM`, `CloseM`)
|
|
111
|
+
- `@synerise/ds-utils` — `WithHTMLAttributes` utility type
|
|
112
|
+
- `@synerise/ds-core` — `ThemePropsVars` (for colour helpers), `renderWithProvider` in tests
|
|
113
|
+
|
|
114
|
+
## Implementation notes
|
|
115
|
+
|
|
116
|
+
- `customIcon` takes a `ReactElement` and is rendered directly as a child of `IconWrapper`, bypassing the `<Icon component={..}>` wrapper. `icon` (type `ReactNode`) is passed as the `component` prop to `<Icon>`.
|
|
117
|
+
- `withClose` controls visibility of the close button but the close action fires `onClose` — both props must be set together for the button to work.
|
|
118
|
+
- `showMoreLabel` is only rendered when `onShowMore` is also provided (both must be truthy).
|
|
119
|
+
- `unorderedList` is suppressed when `moreButtons` is truthy.
|
|
120
|
+
- `withEmphasis` is suppressed when `withLink` is truthy.
|
|
121
|
+
- The `data-testid` on the root element is `ds-section-message-${type}`.
|
|
122
|
+
- `isSectionType` is a type-guard used internally to validate the `type` prop before indexing `ICONS`.
|
|
123
|
+
- The package uses **Jest** (not Vitest) for testing.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-section-message",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "SectionMessage 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,8 +42,8 @@
|
|
|
41
42
|
],
|
|
42
43
|
"types": "dist/index.d.ts",
|
|
43
44
|
"dependencies": {
|
|
44
|
-
"@synerise/ds-icon": "^
|
|
45
|
-
"@synerise/ds-utils": "^
|
|
45
|
+
"@synerise/ds-icon": "^2.0.0",
|
|
46
|
+
"@synerise/ds-utils": "^2.0.0"
|
|
46
47
|
},
|
|
47
48
|
"peerDependencies": {
|
|
48
49
|
"@synerise/ds-core": "*",
|
|
@@ -50,5 +51,5 @@
|
|
|
50
51
|
"styled-components": "^5.3.3",
|
|
51
52
|
"vitest": "4"
|
|
52
53
|
},
|
|
53
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "033854a18f038079e9a16b0ff250f8401a2287c2"
|
|
54
55
|
}
|