@synerise/ds-section-message 1.0.5 → 1.0.7
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 +19 -0
- package/README.md +0 -1
- package/dist/SectionMessage.const.d.ts +1 -1
- package/dist/SectionMessage.d.ts +1 -1
- package/dist/SectionMessage.js +3 -4
- package/dist/SectionMessage.styles.d.ts +3 -3
- package/dist/SectionMessage.styles.js +5 -4
- package/dist/SectionMessage.types.d.ts +5 -4
- package/dist/SectionMessage.utils.d.ts +4 -0
- package/dist/SectionMessage.utils.js +63 -0
- package/dist/index.d.ts +1 -1
- package/package.json +5 -4
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,25 @@
|
|
|
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.0.7](https://github.com/Synerise/synerise-design/compare/@synerise/ds-section-message@1.0.6...@synerise/ds-section-message@1.0.7) (2025-09-16)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @synerise/ds-section-message
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [1.0.6](https://github.com/Synerise/synerise-design/compare/@synerise/ds-section-message@1.0.5...@synerise/ds-section-message@1.0.6) (2025-09-05)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* **section-message:** remove prop color ([569a1d7](https://github.com/Synerise/synerise-design/commit/569a1d72db5f723f0dd345e897c10ecbd46a5ab6))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
6
25
|
## [1.0.5](https://github.com/Synerise/synerise-design/compare/@synerise/ds-section-message@1.0.4...@synerise/ds-section-message@1.0.5) (2025-08-28)
|
|
7
26
|
|
|
8
27
|
**Note:** Version bump only for package @synerise/ds-section-message
|
package/README.md
CHANGED
|
@@ -32,7 +32,6 @@ import SectionMessage from '@synerise/ds-section-message'
|
|
|
32
32
|
| message | Message of section messsage | `ReactNode` | - |
|
|
33
33
|
| customColor | type of colors,options:`red`, `blue`, `green`,`yellow`,`grey`,`purple`,`violet`, `cyan`,`fern`,`orange`, `mars`,`pink` | `string` | - |
|
|
34
34
|
| customColorIcon | type of colors,options:`red`, `blue`, `green`,`yellow`,`grey`,`purple`,`violet`, `cyan`,`fern`,`orange`, `mars`,`pink` | `string` | - |
|
|
35
|
-
| color | type of colors,options: `red`, `green`,`yellow`,`grey`,`purple`,`violet`, `cyan` | `string` | - |
|
|
36
35
|
| showMoreLabel | prop to show label | `ReactNode` | - |
|
|
37
36
|
| onShowMore | callback executed after clicking | `void` | - |
|
|
38
37
|
| moreButtons | prop to show buttons | `ReactNode` | - |
|
|
@@ -2,4 +2,4 @@ import React, { type ReactNode } from 'react';
|
|
|
2
2
|
import { type SectionType } from './SectionMessage.types';
|
|
3
3
|
export declare const ICONS: Record<SectionType, ReactNode>;
|
|
4
4
|
export declare const DEFAULT_ICON: React.JSX.Element;
|
|
5
|
-
export declare const SECTION_TYPES:
|
|
5
|
+
export declare const SECTION_TYPES: SectionType[];
|
package/dist/SectionMessage.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { type SectionMessageProps } from './SectionMessage.types';
|
|
3
|
-
declare const SectionMessage: ({ icon, type, message, description, showMoreLabel, onShowMore, onClose, suffixel, moreButtons, withEmphasis, withLink, unorderedList,
|
|
3
|
+
declare const SectionMessage: ({ icon, type, message, description, showMoreLabel, onShowMore, onClose, suffixel, moreButtons, withEmphasis, withLink, unorderedList, withClose, customColor, customColorIcon, customIcon, ...htmlAttributes }: SectionMessageProps) => React.JSX.Element;
|
|
4
4
|
export default SectionMessage;
|
package/dist/SectionMessage.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _excluded = ["icon", "type", "message", "description", "showMoreLabel", "onShowMore", "onClose", "suffixel", "moreButtons", "withEmphasis", "withLink", "unorderedList", "
|
|
1
|
+
var _excluded = ["icon", "type", "message", "description", "showMoreLabel", "onShowMore", "onClose", "suffixel", "moreButtons", "withEmphasis", "withLink", "unorderedList", "withClose", "customColor", "customColorIcon", "customIcon"];
|
|
2
2
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
3
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
4
4
|
import React, { useMemo } from 'react';
|
|
@@ -19,7 +19,6 @@ var SectionMessage = function SectionMessage(_ref) {
|
|
|
19
19
|
withEmphasis = _ref.withEmphasis,
|
|
20
20
|
withLink = _ref.withLink,
|
|
21
21
|
unorderedList = _ref.unorderedList,
|
|
22
|
-
color = _ref.color,
|
|
23
22
|
withClose = _ref.withClose,
|
|
24
23
|
customColor = _ref.customColor,
|
|
25
24
|
customColorIcon = _ref.customColorIcon,
|
|
@@ -46,10 +45,10 @@ var SectionMessage = function SectionMessage(_ref) {
|
|
|
46
45
|
};
|
|
47
46
|
return /*#__PURE__*/React.createElement(S.Container, _extends({
|
|
48
47
|
"data-testid": "ds-section-message-" + type,
|
|
49
|
-
|
|
48
|
+
type: type,
|
|
50
49
|
customColor: customColor
|
|
51
50
|
}, htmlAttributes), /*#__PURE__*/React.createElement(S.WrapperSectionMessage, null, /*#__PURE__*/React.createElement(S.AllContent, null, /*#__PURE__*/React.createElement(S.IconWrapper, {
|
|
52
|
-
|
|
51
|
+
type: type,
|
|
53
52
|
customColorIcon: customColorIcon
|
|
54
53
|
}, customIcon || /*#__PURE__*/React.createElement(Icon, {
|
|
55
54
|
component: renderIcon
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
|
-
import { type
|
|
2
|
+
import { type CustomColorType, type SectionType } from './SectionMessage.types';
|
|
3
3
|
export declare const AlertContent: import("styled-components").StyledComponent<"div", any, {
|
|
4
4
|
withLink?: ReactNode;
|
|
5
5
|
}, never>;
|
|
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
|
-
|
|
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
|
-
|
|
16
|
+
type?: SectionType;
|
|
17
17
|
customColor?: CustomColorType;
|
|
18
18
|
}, never>;
|
|
19
19
|
export declare const WrapperSectionMessage: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import styled from 'styled-components';
|
|
2
|
+
import { getColorBackground, getColorBorder, getColorIconAndBorderTop } from './SectionMessage.utils';
|
|
2
3
|
export var AlertContent = styled.div.withConfig({
|
|
3
4
|
displayName: "SectionMessagestyles__AlertContent",
|
|
4
5
|
componentId: "sc-1qohcjm-0"
|
|
@@ -17,7 +18,7 @@ export var IconWrapper = styled.div.withConfig({
|
|
|
17
18
|
displayName: "SectionMessagestyles__IconWrapper",
|
|
18
19
|
componentId: "sc-1qohcjm-3"
|
|
19
20
|
})(["margin:10px 12px;display:flex;color:", ";"], function (props) {
|
|
20
|
-
return props.customColorIcon ? props.theme.palette[props.customColorIcon + "-600"] : props.
|
|
21
|
+
return props.customColorIcon ? props.theme.palette[props.customColorIcon + "-600"] : getColorIconAndBorderTop(props.type, props.theme);
|
|
21
22
|
});
|
|
22
23
|
export var IconCloseWrapper = styled.div.withConfig({
|
|
23
24
|
displayName: "SectionMessagestyles__IconCloseWrapper",
|
|
@@ -37,11 +38,11 @@ export var Container = styled.div.withConfig({
|
|
|
37
38
|
displayName: "SectionMessagestyles__Container",
|
|
38
39
|
componentId: "sc-1qohcjm-7"
|
|
39
40
|
})(["width:100%;align-items:center;justify-content:center;background-color:", ";border:1px solid ", ";border-top:2px solid ", ";border-radius:2px;"], function (props) {
|
|
40
|
-
return props.customColor ? props.theme.palette[props.customColor + "-050"] : props.
|
|
41
|
+
return props.customColor ? props.theme.palette[props.customColor + "-050"] : getColorBackground(props.type, props.theme);
|
|
41
42
|
}, function (props) {
|
|
42
|
-
return props.customColor ? props.theme.palette[props.customColor + "-200"] : props.
|
|
43
|
+
return props.customColor ? props.theme.palette[props.customColor + "-200"] : getColorBorder(props.type, props.theme);
|
|
43
44
|
}, function (props) {
|
|
44
|
-
return props.customColor ? props.theme.palette[props.customColor + "-600"] : props.
|
|
45
|
+
return props.customColor ? props.theme.palette[props.customColor + "-600"] : getColorIconAndBorderTop(props.type, props.theme);
|
|
45
46
|
});
|
|
46
47
|
export var WrapperSectionMessage = styled.div.withConfig({
|
|
47
48
|
displayName: "SectionMessagestyles__WrapperSectionMessage",
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import type { ReactElement, ReactNode } from 'react';
|
|
2
2
|
import type { WithHTMLAttributes } from '@synerise/ds-utils';
|
|
3
|
-
import { type SECTION_TYPES } from './SectionMessage.const';
|
|
4
3
|
export type CustomColorType = 'blue' | 'grey' | 'red' | 'green' | 'yellow' | 'pink' | 'mars' | 'orange' | 'fern' | 'cyan' | 'purple' | 'violet';
|
|
4
|
+
/** @deprecated */
|
|
5
5
|
export type ColorType = 'grey' | 'red' | 'green' | 'yellow' | 'violet' | 'purple' | 'cyan';
|
|
6
|
-
export type SectionType =
|
|
6
|
+
export type SectionType = 'positive' | 'notice' | 'negative' | 'neutral' | 'supply' | 'service' | 'entity';
|
|
7
7
|
export type SectionMessageProps = WithHTMLAttributes<HTMLDivElement, {
|
|
8
8
|
message?: ReactNode;
|
|
9
|
-
type:
|
|
9
|
+
type: SectionType;
|
|
10
10
|
customColor?: CustomColorType;
|
|
11
11
|
customColorIcon?: CustomColorType;
|
|
12
|
-
color?: ColorType;
|
|
13
12
|
description?: ReactNode;
|
|
14
13
|
showMoreLabel?: ReactNode;
|
|
15
14
|
onShowMore?: () => void;
|
|
@@ -21,5 +20,7 @@ export type SectionMessageProps = WithHTMLAttributes<HTMLDivElement, {
|
|
|
21
20
|
unorderedList?: ReactNode;
|
|
22
21
|
withClose?: ReactNode;
|
|
23
22
|
customIcon?: ReactElement;
|
|
23
|
+
/** @deprecated - color is defined by type, use customColor property if you need to voerwrite it */
|
|
24
|
+
color?: ColorType;
|
|
24
25
|
icon?: ReactNode;
|
|
25
26
|
}>;
|
|
@@ -1,2 +1,6 @@
|
|
|
1
|
+
import { type ThemePropsVars } from '@synerise/ds-core';
|
|
1
2
|
import { type SectionType } from './SectionMessage.types';
|
|
2
3
|
export declare const isSectionType: (type: string) => type is SectionType;
|
|
4
|
+
export declare const getColorBackground: (type: SectionType, theme: ThemePropsVars) => string;
|
|
5
|
+
export declare const getColorIconAndBorderTop: (type: SectionType, theme: ThemePropsVars) => string;
|
|
6
|
+
export declare const getColorBorder: (type: SectionType, theme: ThemePropsVars) => string;
|
|
@@ -1,4 +1,67 @@
|
|
|
1
1
|
import { SECTION_TYPES } from './SectionMessage.const';
|
|
2
2
|
export var isSectionType = function isSectionType(type) {
|
|
3
3
|
return SECTION_TYPES.includes(type);
|
|
4
|
+
};
|
|
5
|
+
export var getColorBackground = function getColorBackground(type, theme) {
|
|
6
|
+
if (type === 'positive') {
|
|
7
|
+
return theme.palette['green-050'];
|
|
8
|
+
}
|
|
9
|
+
if (type === 'negative') {
|
|
10
|
+
return theme.palette['red-050'];
|
|
11
|
+
}
|
|
12
|
+
if (type === 'notice') {
|
|
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
|
+
export var getColorIconAndBorderTop = function 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
|
+
export var getColorBorder = function 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"];
|
|
4
67
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { default } from './SectionMessage';
|
|
2
|
-
export type { SectionMessageProps, SectionType,
|
|
2
|
+
export type { SectionMessageProps, SectionType, CustomColorType, } from './SectionMessage.types';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-section-message",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"description": "SectionMessage UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "Synerise/synerise-design",
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
"pack:ci": "npm pack --pack-destination ../../storybook/storybook-static/static",
|
|
27
27
|
"test": "jest",
|
|
28
28
|
"test:watch": "npm run test -- --watchAll",
|
|
29
|
+
"check:circular-dependencies": "madge --circular --extensions ts,tsx,js,jsx --ts-config tsconfig.json src/ --exclude '/dist/'",
|
|
29
30
|
"upgrade:ds": "ncu -f \"@synerise/ds-*\" -u"
|
|
30
31
|
},
|
|
31
32
|
"sideEffects": [
|
|
@@ -34,13 +35,13 @@
|
|
|
34
35
|
],
|
|
35
36
|
"types": "dist/index.d.ts",
|
|
36
37
|
"dependencies": {
|
|
37
|
-
"@synerise/ds-icon": "^1.7.
|
|
38
|
-
"@synerise/ds-utils": "^1.4.
|
|
38
|
+
"@synerise/ds-icon": "^1.7.2",
|
|
39
|
+
"@synerise/ds-utils": "^1.4.2"
|
|
39
40
|
},
|
|
40
41
|
"peerDependencies": {
|
|
41
42
|
"@synerise/ds-core": "*",
|
|
42
43
|
"react": ">=16.9.0 <= 18.3.1",
|
|
43
44
|
"styled-components": "^5.3.3"
|
|
44
45
|
},
|
|
45
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "5beb6ab5f2d77b9e98e04caab7dff20b8436078b"
|
|
46
47
|
}
|