@synerise/ds-section-message 2.0.8 → 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 +18 -12
- package/dist/SectionMessage.styles.d.ts +2 -2
- package/dist/SectionMessage.styles.js +19 -10
- package/dist/SectionMessage.utils.d.ts +4 -4
- package/dist/SectionMessage.utils.js +14 -62
- package/dist/index.d.ts +1 -0
- package/dist/index.js +5 -0
- package/package.json +4 -4
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-section-message@2.0.8...@synerise/ds-section-message@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.8](https://github.com/Synerise/synerise-design/compare/@synerise/ds-section-message@2.0.7...@synerise/ds-section-message@2.0.8) (2026-10-26)
|
|
7
18
|
|
|
8
19
|
|
package/CLAUDE.md
CHANGED
|
@@ -33,7 +33,7 @@ export type { SectionMessageProps, SectionType, CustomColorType };
|
|
|
33
33
|
| `description` | `ReactNode` | — | Regular-weight body text rendered below the message |
|
|
34
34
|
| `icon` | `ReactNode` | type-derived icon | Overrides the automatic icon for the given type |
|
|
35
35
|
| `customIcon` | `ReactElement` | — | Renders the element directly (bypasses `<Icon>` wrapper); takes precedence over `icon` |
|
|
36
|
-
| `customColor` | `CustomColorType` | — | Overrides the background and border colours
|
|
36
|
+
| `customColor` | `CustomColorType` | — | Overrides the background and border colours via `resolveCustomColor` (`--ds-color-custom-*` tokens) |
|
|
37
37
|
| `customColorIcon` | `CustomColorType` | — | Overrides the icon and top-border colour |
|
|
38
38
|
| `showMoreLabel` | `ReactNode` | — | Label for the "show more" link; only rendered when `onShowMore` is also provided |
|
|
39
39
|
| `onShowMore` | `() => void` | — | Click handler for the "show more" link; requires `showMoreLabel` |
|
|
@@ -87,19 +87,25 @@ import SectionMessage from '@synerise/ds-section-message';
|
|
|
87
87
|
|
|
88
88
|
## Styling
|
|
89
89
|
|
|
90
|
-
|
|
90
|
+
`AlertMessage` and `AlertDescription` use the shared `message` module for every type: `var(--ds-message-text-title)` and `var(--ds-message-text-description)`.
|
|
91
91
|
|
|
92
|
-
|
|
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` |
|
|
92
|
+
All other colours come from `var(--ds-section-message-variant-<variant>-{bg,border,bordertop,icon})` tokens (`SectionMessage.utils.tsx`), with `type` mapped to a token variant:
|
|
101
93
|
|
|
102
|
-
|
|
94
|
+
| `type` | Token variant |
|
|
95
|
+
|--------|---------------|
|
|
96
|
+
| `positive` | `success` |
|
|
97
|
+
| `negative` | `error` |
|
|
98
|
+
| `notice` | `warning` |
|
|
99
|
+
| `neutral` | `informative` |
|
|
100
|
+
| `supply` | `supply` |
|
|
101
|
+
| `service` | `service` |
|
|
102
|
+
| `entity` | `entity` |
|
|
103
|
+
|
|
104
|
+
An unknown `type` (untyped consumer data) falls back to the `informative` variant, as `neutral` does.
|
|
105
|
+
|
|
106
|
+
When `customColor` / `customColorIcon` are set, they go through `resolveCustomColor` (`@synerise/ds-utils`) to the `--ds-color-custom-*` tokens (background shade `50`, border `200`, icon/top-border `600`) and fully override the type-derived values.
|
|
107
|
+
|
|
108
|
+
Links inside `description` take the description colour and are underlined in every state, like the `withLink` slot, so the global `a` colours from ds-core's reset do not apply.
|
|
103
109
|
|
|
104
110
|
The component has a `border-radius: 2px` and a thicker `border-top: 2px` that carries the accent colour.
|
|
105
111
|
|
|
@@ -6,14 +6,14 @@ export declare const AlertContent: import('styled-components').StyledComponent<"
|
|
|
6
6
|
export declare const AllContent: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
7
7
|
export declare const Text: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
8
8
|
export declare const IconWrapper: import('styled-components').StyledComponent<"div", any, {
|
|
9
|
-
type
|
|
9
|
+
type: SectionType;
|
|
10
10
|
customColorIcon?: CustomColorType;
|
|
11
11
|
}, never>;
|
|
12
12
|
export declare const IconCloseWrapper: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
13
13
|
export declare const ButtonWrapper: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
14
14
|
export declare const SuffixWrapper: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
15
15
|
export declare const Container: import('styled-components').StyledComponent<"div", any, {
|
|
16
|
-
type
|
|
16
|
+
type: SectionType;
|
|
17
17
|
customColor?: CustomColorType;
|
|
18
18
|
}, never>;
|
|
19
19
|
export declare const WrapperSectionMessage: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import styled from "styled-components";
|
|
2
|
-
import {
|
|
2
|
+
import { resolveCustomColor } from "@synerise/ds-utils";
|
|
3
|
+
import { getColorBackground, getColorBorder, getColorBorderTop, getColorIconAndBorderTop } from "./SectionMessage.utils.js";
|
|
3
4
|
const AlertContent = /* @__PURE__ */ styled.div.withConfig({
|
|
4
5
|
displayName: "SectionMessagestyles__AlertContent",
|
|
5
6
|
componentId: "sc-1qohcjm-0"
|
|
@@ -15,11 +16,13 @@ const Text = /* @__PURE__ */ styled.div.withConfig({
|
|
|
15
16
|
const IconWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
16
17
|
displayName: "SectionMessagestyles__IconWrapper",
|
|
17
18
|
componentId: "sc-1qohcjm-3"
|
|
18
|
-
})(["margin:10px 12px;display:flex;color:", ";"], (props) => props.customColorIcon ? props.
|
|
19
|
+
})(["margin:10px 12px;display:flex;color:", ";"], (props) => props.customColorIcon ? resolveCustomColor(props.customColorIcon, getColorIconAndBorderTop(props.type), {
|
|
20
|
+
defaultShade: "600"
|
|
21
|
+
}) : getColorIconAndBorderTop(props.type));
|
|
19
22
|
const IconCloseWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
20
23
|
displayName: "SectionMessagestyles__IconCloseWrapper",
|
|
21
24
|
componentId: "sc-1qohcjm-4"
|
|
22
|
-
})(["margin:3px 5px 2px;cursor:pointer;color:
|
|
25
|
+
})(["margin:3px 5px 2px;cursor:pointer;color:var(--ds-color-icon-base-default);"]);
|
|
23
26
|
const ButtonWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
24
27
|
displayName: "SectionMessagestyles__ButtonWrapper",
|
|
25
28
|
componentId: "sc-1qohcjm-5"
|
|
@@ -31,7 +34,13 @@ const SuffixWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
|
31
34
|
const Container = /* @__PURE__ */ styled.div.withConfig({
|
|
32
35
|
displayName: "SectionMessagestyles__Container",
|
|
33
36
|
componentId: "sc-1qohcjm-7"
|
|
34
|
-
})(["width:100%;align-items:center;justify-content:center;position:relative;background-color:", ";border:1px solid ", ";border-radius:3px;&::after{content:'';position:absolute;top:-1px;left:-1px;right:-1px;height:2px;border-radius:3px 3px 0 0;background-color:", ";}"], (props) => props.customColor ? props.
|
|
37
|
+
})(["width:100%;align-items:center;justify-content:center;position:relative;background-color:", ";border:1px solid ", ";border-radius:3px;&::after{content:'';position:absolute;top:-1px;left:-1px;right:-1px;height:2px;border-radius:3px 3px 0 0;background-color:", ";}"], (props) => props.customColor ? resolveCustomColor(props.customColor, getColorBackground(props.type), {
|
|
38
|
+
defaultShade: "50"
|
|
39
|
+
}) : getColorBackground(props.type), (props) => props.customColor ? resolveCustomColor(props.customColor, getColorBorder(props.type), {
|
|
40
|
+
defaultShade: "200"
|
|
41
|
+
}) : getColorBorder(props.type), (props) => props.customColor ? resolveCustomColor(props.customColor, getColorBorderTop(props.type), {
|
|
42
|
+
defaultShade: "600"
|
|
43
|
+
}) : getColorBorderTop(props.type));
|
|
35
44
|
const WrapperSectionMessage = /* @__PURE__ */ styled.div.withConfig({
|
|
36
45
|
displayName: "SectionMessagestyles__WrapperSectionMessage",
|
|
37
46
|
componentId: "sc-1qohcjm-8"
|
|
@@ -39,11 +48,11 @@ const WrapperSectionMessage = /* @__PURE__ */ styled.div.withConfig({
|
|
|
39
48
|
const AlertMessage = /* @__PURE__ */ styled.span.withConfig({
|
|
40
49
|
displayName: "SectionMessagestyles__AlertMessage",
|
|
41
50
|
componentId: "sc-1qohcjm-9"
|
|
42
|
-
})(["font-size:13px;line-height:1.39;font-weight:500;overflow-wrap:break-word;min-width:0;width:100%;color:
|
|
51
|
+
})(["font-size:13px;line-height:1.39;font-weight:500;overflow-wrap:break-word;min-width:0;width:100%;color:var(--ds-message-text-title);"]);
|
|
43
52
|
const AlertDescription = /* @__PURE__ */ styled.span.withConfig({
|
|
44
53
|
displayName: "SectionMessagestyles__AlertDescription",
|
|
45
54
|
componentId: "sc-1qohcjm-10"
|
|
46
|
-
})(["overflow-wrap:break-word;min-width:0;font-size:13px;line-height:1.39;font-weight:normal;padding-right:3px;margin-top:2px;color:
|
|
55
|
+
})(["overflow-wrap:break-word;min-width:0;font-size:13px;line-height:1.39;font-weight:normal;padding-right:3px;margin-top:2px;color:var(--ds-message-text-description);a,a:hover,a:active{color:inherit;text-decoration:underline;}"]);
|
|
47
56
|
const EmphasisWrapper = /* @__PURE__ */ styled.span.withConfig({
|
|
48
57
|
displayName: "SectionMessagestyles__EmphasisWrapper",
|
|
49
58
|
componentId: "sc-1qohcjm-11"
|
|
@@ -59,19 +68,19 @@ const AlertShowMore = /* @__PURE__ */ styled.span.withConfig({
|
|
|
59
68
|
const NumberWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
60
69
|
displayName: "SectionMessagestyles__NumberWrapper",
|
|
61
70
|
componentId: "sc-1qohcjm-14"
|
|
62
|
-
})(["margin-left:4px;color:
|
|
71
|
+
})(["margin-left:4px;color:var(--ds-color-text-base-disabled);cursor:pointer;&:hover{background-image:linear-gradient( to right,var(--ds-color-text-base-disabled) 20%,transparent 10% );background-color:transparent;background-position:bottom left;background-size:5px 1px;background-repeat:repeat-x;color:var(--ds-color-text-base-subtle);}"]);
|
|
63
72
|
const IconOrderWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
64
73
|
displayName: "SectionMessagestyles__IconOrderWrapper",
|
|
65
74
|
componentId: "sc-1qohcjm-15"
|
|
66
|
-
})(["display:none;margin:-4px 0;
|
|
75
|
+
})(["display:none;margin:-4px 0;color:var(--ds-color-icon-base-default);&:hover{color:var(--ds-color-icon-brand-default);cursor:pointer;}"]);
|
|
67
76
|
const OrderWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
68
77
|
displayName: "SectionMessagestyles__OrderWrapper",
|
|
69
78
|
componentId: "sc-1qohcjm-16"
|
|
70
|
-
})(["display:flex;&:hover{", "{display:block;}", "{background-image:linear-gradient( to right,
|
|
79
|
+
})(["display:flex;&:hover{", "{display:block;}", "{background-image:linear-gradient( to right,var(--ds-color-text-base-disabled) 20%,transparent 10% );background-color:transparent;background-position:bottom left;background-size:5px 1px;background-repeat:repeat-x;color:var(--ds-color-text-base-subtle);}}"], IconOrderWrapper, NumberWrapper);
|
|
71
80
|
const Wrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
72
81
|
displayName: "SectionMessagestyles__Wrapper",
|
|
73
82
|
componentId: "sc-1qohcjm-17"
|
|
74
|
-
})(["margin-top:10px;color:
|
|
83
|
+
})(["margin-top:10px;color:var(--ds-color-text-base-subtle);"]);
|
|
75
84
|
export {
|
|
76
85
|
AlertContent,
|
|
77
86
|
AlertDescription,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ThemePropsVars } from '@synerise/ds-core';
|
|
2
1
|
import { SectionType } from './SectionMessage.types';
|
|
3
2
|
export declare const isSectionType: (type: string) => type is SectionType;
|
|
4
|
-
export declare const getColorBackground: (type: SectionType
|
|
5
|
-
export declare const getColorIconAndBorderTop: (type: SectionType
|
|
6
|
-
export declare const getColorBorder: (type: SectionType
|
|
3
|
+
export declare const getColorBackground: (type: SectionType) => string;
|
|
4
|
+
export declare const getColorIconAndBorderTop: (type: SectionType) => string;
|
|
5
|
+
export declare const getColorBorder: (type: SectionType) => string;
|
|
6
|
+
export declare const getColorBorderTop: (type: SectionType) => string;
|
|
@@ -2,72 +2,24 @@ import { SECTION_TYPES } from "./SectionMessage.const.js";
|
|
|
2
2
|
const isSectionType = (type) => {
|
|
3
3
|
return SECTION_TYPES.includes(type);
|
|
4
4
|
};
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
return theme.palette["yellow-050"];
|
|
14
|
-
}
|
|
15
|
-
if (type === "service") {
|
|
16
|
-
return theme.palette["purple-050"];
|
|
17
|
-
}
|
|
18
|
-
if (type === "supply") {
|
|
19
|
-
return theme.palette["violet-050"];
|
|
20
|
-
}
|
|
21
|
-
if (type === "entity") {
|
|
22
|
-
return theme.palette["cyan-050"];
|
|
23
|
-
}
|
|
24
|
-
return theme.palette[`grey-050`];
|
|
25
|
-
};
|
|
26
|
-
const getColorIconAndBorderTop = (type, theme) => {
|
|
27
|
-
if (type === "positive") {
|
|
28
|
-
return theme.palette["green-600"];
|
|
29
|
-
}
|
|
30
|
-
if (type === "negative") {
|
|
31
|
-
return theme.palette["red-600"];
|
|
32
|
-
}
|
|
33
|
-
if (type === "notice") {
|
|
34
|
-
return theme.palette["yellow-600"];
|
|
35
|
-
}
|
|
36
|
-
if (type === "service") {
|
|
37
|
-
return theme.palette["purple-600"];
|
|
38
|
-
}
|
|
39
|
-
if (type === "supply") {
|
|
40
|
-
return theme.palette["violet-600"];
|
|
41
|
-
}
|
|
42
|
-
if (type === "entity") {
|
|
43
|
-
return theme.palette["cyan-600"];
|
|
44
|
-
}
|
|
45
|
-
return theme.palette[`grey-600`];
|
|
46
|
-
};
|
|
47
|
-
const getColorBorder = (type, theme) => {
|
|
48
|
-
if (type === "positive") {
|
|
49
|
-
return theme.palette["green-200"];
|
|
50
|
-
}
|
|
51
|
-
if (type === "negative") {
|
|
52
|
-
return theme.palette["red-200"];
|
|
53
|
-
}
|
|
54
|
-
if (type === "notice") {
|
|
55
|
-
return theme.palette["yellow-200"];
|
|
56
|
-
}
|
|
57
|
-
if (type === "service") {
|
|
58
|
-
return theme.palette["purple-200"];
|
|
59
|
-
}
|
|
60
|
-
if (type === "supply") {
|
|
61
|
-
return theme.palette["violet-200"];
|
|
62
|
-
}
|
|
63
|
-
if (type === "entity") {
|
|
64
|
-
return theme.palette["cyan-200"];
|
|
65
|
-
}
|
|
66
|
-
return theme.palette[`grey-200`];
|
|
5
|
+
const TYPE_TO_TOKEN_VARIANT = {
|
|
6
|
+
positive: "success",
|
|
7
|
+
negative: "error",
|
|
8
|
+
notice: "warning",
|
|
9
|
+
neutral: "informative",
|
|
10
|
+
supply: "supply",
|
|
11
|
+
service: "service",
|
|
12
|
+
entity: "entity"
|
|
67
13
|
};
|
|
14
|
+
const variantOf = (type) => isSectionType(type) ? TYPE_TO_TOKEN_VARIANT[type] : TYPE_TO_TOKEN_VARIANT.neutral;
|
|
15
|
+
const getColorBackground = (type) => `var(--ds-section-message-variant-${variantOf(type)}-bg)`;
|
|
16
|
+
const getColorIconAndBorderTop = (type) => `var(--ds-section-message-variant-${variantOf(type)}-icon)`;
|
|
17
|
+
const getColorBorder = (type) => `var(--ds-section-message-variant-${variantOf(type)}-border)`;
|
|
18
|
+
const getColorBorderTop = (type) => `var(--ds-section-message-variant-${variantOf(type)}-bordertop)`;
|
|
68
19
|
export {
|
|
69
20
|
getColorBackground,
|
|
70
21
|
getColorBorder,
|
|
22
|
+
getColorBorderTop,
|
|
71
23
|
getColorIconAndBorderTop,
|
|
72
24
|
isSectionType
|
|
73
25
|
};
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-section-message",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "SectionMessage UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "Synerise/synerise-design",
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
],
|
|
43
43
|
"types": "dist/index.d.ts",
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@synerise/ds-icon": "^2.
|
|
46
|
-
"@synerise/ds-utils": "^2.
|
|
45
|
+
"@synerise/ds-icon": "^2.3.0",
|
|
46
|
+
"@synerise/ds-utils": "^2.3.0"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"vitest": "4"
|
|
@@ -53,5 +53,5 @@
|
|
|
53
53
|
"react": ">=16.9.0 <= 18.3.1",
|
|
54
54
|
"styled-components": "^5.3.3"
|
|
55
55
|
},
|
|
56
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "5c3d61e30289486d14c7d6becb682e2d4a08ce41"
|
|
57
57
|
}
|