@synerise/ds-section-message 1.0.1

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 ADDED
@@ -0,0 +1,8 @@
1
+ # Change Log
2
+
3
+ All notable changes to this project will be documented in this file.
4
+ See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
+
6
+ ## 1.0.1 (2025-07-17)
7
+
8
+ **Note:** Version bump only for package @synerise/ds-section-message
package/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2019 Synerise
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,46 @@
1
+ ---
2
+ id: section-message
3
+ title: SectionMessage
4
+ ---
5
+
6
+ SectionMessage UI Component
7
+
8
+ ## Installation
9
+ ```
10
+ npm i @synerise/ds-section-message
11
+ or
12
+ yarn add @synerise/ds-section-message
13
+ ```
14
+
15
+ ## Usage
16
+ ```
17
+ import SectionMessage from '@synerise/ds-section-message'
18
+
19
+ <SectionMessage />
20
+
21
+ ```
22
+
23
+ ## Demo
24
+
25
+ <iframe src="/storybook-static/iframe.html?id=components-section-message--default"></iframe>
26
+
27
+ ## API
28
+
29
+ | Property | Description | Type | Default |
30
+ | --------------- | ---------------------------------------------------------------------------------------------------------------------- | ------------| ---------- |
31
+ | type | Type of SectionMessage, options: `notice`, `negative`, `positive`,`neutral`,`supply`,`service`,`entity` | `string` | `negative` |
32
+ | message | Message of section messsage | `ReactNode` | - |
33
+ | customColor | type of colors,options:`red`, `blue`, `green`,`yellow`,`grey`,`purple`,`violet`, `cyan`,`fern`,`orange`, `mars`,`pink` | `string` | - |
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
+ | showMoreLabel | prop to show label | `ReactNode` | - |
37
+ | onShowMore | callback executed after clicking | `void` | - |
38
+ | moreButtons | prop to show buttons | `ReactNode` | - |
39
+ | withEmphasis | prop to show bolder text | `ReactNode` | - |
40
+ | withLink | prop to show highlited text | `ReactNode` | - |
41
+ | unorderedList | prop to show unordered list | `ReactNode` | - |
42
+ | withClose | prop to show close button | `ReactNode` | - |
43
+ | customIcon | prop to set custom icon | `ReactNode` | - |
44
+ | textButton | text for button | `string ` | - |
45
+ | icon | prop to set icon | `ReactNode` | - |
46
+ | description | prop to show description | `ReactNode` | - |
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { type SectionMessageProps } from './SectionMessage.types';
3
+ declare const SectionMessage: ({ icon, type, message, description, showMoreLabel, onShowMore, onClose, suffixel, moreButtons, withEmphasis, withLink, unorderedList, color, withClose, customColor, customColorIcon, customIcon, ...htmlAttributes }: SectionMessageProps) => React.JSX.Element;
4
+ export default SectionMessage;
@@ -0,0 +1,61 @@
1
+ var _excluded = ["icon", "type", "message", "description", "showMoreLabel", "onShowMore", "onClose", "suffixel", "moreButtons", "withEmphasis", "withLink", "unorderedList", "color", "withClose", "customColor", "customColorIcon", "customIcon"];
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
+ 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
+ import React, { useMemo } from 'react';
5
+ import Icon, { CloseM } from '@synerise/ds-icon';
6
+ import * as S from './SectionMessage.styles';
7
+ import { DEFAULT_ICON, ICONS } from './utils/utils';
8
+ var SectionMessage = function SectionMessage(_ref) {
9
+ var icon = _ref.icon,
10
+ type = _ref.type,
11
+ message = _ref.message,
12
+ description = _ref.description,
13
+ showMoreLabel = _ref.showMoreLabel,
14
+ onShowMore = _ref.onShowMore,
15
+ onClose = _ref.onClose,
16
+ suffixel = _ref.suffixel,
17
+ moreButtons = _ref.moreButtons,
18
+ withEmphasis = _ref.withEmphasis,
19
+ withLink = _ref.withLink,
20
+ unorderedList = _ref.unorderedList,
21
+ color = _ref.color,
22
+ withClose = _ref.withClose,
23
+ customColor = _ref.customColor,
24
+ customColorIcon = _ref.customColorIcon,
25
+ customIcon = _ref.customIcon,
26
+ htmlAttributes = _objectWithoutPropertiesLoose(_ref, _excluded);
27
+ var renderMessage = useMemo(function () {
28
+ return /*#__PURE__*/React.createElement(S.AlertContent, {
29
+ withLink: withLink
30
+ }, message && /*#__PURE__*/React.createElement(S.AlertMessage, null, message), /*#__PURE__*/React.createElement(S.Text, null, description && /*#__PURE__*/React.createElement(S.AlertDescription, null, description), withLink && /*#__PURE__*/React.createElement(S.LinkWrapper, null, withLink), withEmphasis && !withLink && /*#__PURE__*/React.createElement(S.EmphasisWrapper, null, withEmphasis)), onShowMore && showMoreLabel && /*#__PURE__*/React.createElement(S.AlertShowMore, {
31
+ onClick: onShowMore
32
+ }, showMoreLabel), moreButtons, unorderedList && !moreButtons && unorderedList);
33
+ }, [message, description, showMoreLabel, onShowMore, moreButtons, withEmphasis, withLink, unorderedList]);
34
+ var renderIcon = useMemo(function () {
35
+ if (icon) {
36
+ return icon;
37
+ }
38
+ if (ICONS[type]) {
39
+ return ICONS[type];
40
+ }
41
+ return DEFAULT_ICON;
42
+ }, [icon, type]);
43
+ var handleClose = function handleClose() {
44
+ onClose && onClose();
45
+ };
46
+ return /*#__PURE__*/React.createElement(S.Container, _extends({
47
+ "data-testid": "ds-section-message-" + type,
48
+ color: color,
49
+ customColor: customColor
50
+ }, htmlAttributes), /*#__PURE__*/React.createElement(S.WrapperSectionMessage, null, /*#__PURE__*/React.createElement(S.AllContent, null, /*#__PURE__*/React.createElement(S.IconWrapper, {
51
+ color: color,
52
+ customColorIcon: customColorIcon
53
+ }, customIcon || /*#__PURE__*/React.createElement(Icon, {
54
+ component: renderIcon
55
+ })), renderMessage), /*#__PURE__*/React.createElement(S.ButtonWrapper, null, suffixel && /*#__PURE__*/React.createElement(S.SuffixWrapper, null, suffixel), withClose && /*#__PURE__*/React.createElement(S.IconCloseWrapper, {
56
+ onClick: handleClose
57
+ }, /*#__PURE__*/React.createElement(Icon, {
58
+ component: /*#__PURE__*/React.createElement(CloseM, null)
59
+ })))));
60
+ };
61
+ export default SectionMessage;
@@ -0,0 +1,24 @@
1
+ import type { ReactNode } from 'react';
2
+ import { type ColorType, type CustomColorType } from './SectionMessage.types';
3
+ export declare const AlertContent: import("styled-components").StyledComponent<"div", any, {
4
+ withLink?: ReactNode;
5
+ }, never>;
6
+ export declare const AllContent: import("styled-components").StyledComponent<"div", any, {}, never>;
7
+ export declare const Text: import("styled-components").StyledComponent<"div", any, {}, never>;
8
+ export declare const IconWrapper: import("styled-components").StyledComponent<"div", any, {
9
+ color?: ColorType | undefined;
10
+ customColorIcon?: CustomColorType | undefined;
11
+ }, never>;
12
+ export declare const IconCloseWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
13
+ export declare const ButtonWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
14
+ export declare const SuffixWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
15
+ export declare const Container: import("styled-components").StyledComponent<"div", any, {
16
+ color?: ColorType | undefined;
17
+ customColor?: CustomColorType | undefined;
18
+ }, never>;
19
+ export declare const WrapperSectionMessage: import("styled-components").StyledComponent<"div", any, {}, never>;
20
+ export declare const AlertMessage: import("styled-components").StyledComponent<"span", any, {}, never>;
21
+ export declare const AlertDescription: import("styled-components").StyledComponent<"span", any, {}, never>;
22
+ export declare const EmphasisWrapper: import("styled-components").StyledComponent<"span", any, {}, never>;
23
+ export declare const LinkWrapper: import("styled-components").StyledComponent<"span", any, {}, never>;
24
+ export declare const AlertShowMore: import("styled-components").StyledComponent<"span", any, {}, never>;
@@ -0,0 +1,73 @@
1
+ import styled from 'styled-components';
2
+ export var AlertContent = styled.div.withConfig({
3
+ displayName: "SectionMessagestyles__AlertContent",
4
+ componentId: "sc-1qohcjm-0"
5
+ })(["display:flex;flex-direction:column;align-items:flex-start;justify-content:flex-start;padding:", ";"], function (props) {
6
+ return props.withLink ? '12px 0 11px' : '12px 0';
7
+ });
8
+ export var AllContent = styled.div.withConfig({
9
+ displayName: "SectionMessagestyles__AllContent",
10
+ componentId: "sc-1qohcjm-1"
11
+ })(["display:flex;color:inherit;"]);
12
+ export var Text = styled.div.withConfig({
13
+ displayName: "SectionMessagestyles__Text",
14
+ componentId: "sc-1qohcjm-2"
15
+ })(["display:flex;"]);
16
+ export var IconWrapper = styled.div.withConfig({
17
+ displayName: "SectionMessagestyles__IconWrapper",
18
+ componentId: "sc-1qohcjm-3"
19
+ })(["margin:10px 12px;display:flex;color:", ";"], function (props) {
20
+ return props.customColorIcon ? props.theme.palette[props.customColorIcon + "-600"] : props.theme.palette[props.color + "-600"];
21
+ });
22
+ export var IconCloseWrapper = styled.div.withConfig({
23
+ displayName: "SectionMessagestyles__IconCloseWrapper",
24
+ componentId: "sc-1qohcjm-4"
25
+ })(["margin:3px 5px 2px;cursor:pointer;color:", ";"], function (props) {
26
+ return props.theme.palette['grey-700'];
27
+ });
28
+ export var ButtonWrapper = styled.div.withConfig({
29
+ displayName: "SectionMessagestyles__ButtonWrapper",
30
+ componentId: "sc-1qohcjm-5"
31
+ })(["padding:6px 8px 0 8px;display:flex;"]);
32
+ export var SuffixWrapper = styled.div.withConfig({
33
+ displayName: "SectionMessagestyles__SuffixWrapper",
34
+ componentId: "sc-1qohcjm-6"
35
+ })(["display:flex;"]);
36
+ export var Container = styled.div.withConfig({
37
+ displayName: "SectionMessagestyles__Container",
38
+ componentId: "sc-1qohcjm-7"
39
+ })(["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.theme.palette[props.color + "-050"];
41
+ }, function (props) {
42
+ return props.customColor ? props.theme.palette[props.customColor + "-200"] : props.theme.palette[props.color + "-200"];
43
+ }, function (props) {
44
+ return props.customColor ? props.theme.palette[props.customColor + "-600"] : props.theme.palette[props.color + "-600"];
45
+ });
46
+ export var WrapperSectionMessage = styled.div.withConfig({
47
+ displayName: "SectionMessagestyles__WrapperSectionMessage",
48
+ componentId: "sc-1qohcjm-8"
49
+ })(["display:flex;font-size:13px;color:inherit;justify-content:space-between;"]);
50
+ export var AlertMessage = styled.span.withConfig({
51
+ displayName: "SectionMessagestyles__AlertMessage",
52
+ componentId: "sc-1qohcjm-9"
53
+ })(["font-size:13px;line-height:1.39;font-weight:500;max-width:400px;overflow:hidden;text-overflow:ellipsis;color:", ";"], function (props) {
54
+ return props.theme.palette['grey-700'];
55
+ });
56
+ export var AlertDescription = styled.span.withConfig({
57
+ displayName: "SectionMessagestyles__AlertDescription",
58
+ componentId: "sc-1qohcjm-10"
59
+ })(["display:flex;font-size:13px;line-height:1.39;font-weight:normal;padding-right:3px;margin-top:2px;color:", ";"], function (props) {
60
+ return props.theme.palette['grey-700'];
61
+ });
62
+ export var EmphasisWrapper = styled.span.withConfig({
63
+ displayName: "SectionMessagestyles__EmphasisWrapper",
64
+ componentId: "sc-1qohcjm-11"
65
+ })(["display:flex;font-size:13px;line-height:1.39;font-weight:500;margin-top:2px;color:inherit;"]);
66
+ export var LinkWrapper = styled.span.withConfig({
67
+ displayName: "SectionMessagestyles__LinkWrapper",
68
+ componentId: "sc-1qohcjm-12"
69
+ })(["display:flex;font-size:13px;line-height:1.5;font-weight:400;margin-top:2px;color:inherit;text-decoration:underline;cursor:pointer;a{color:inherit;}"]);
70
+ export var AlertShowMore = styled.span.withConfig({
71
+ displayName: "SectionMessagestyles__AlertShowMore",
72
+ componentId: "sc-1qohcjm-13"
73
+ })(["display:flex;font-size:13px;font-weight:500;color:inherit;text-decoration:underline;cursor:pointer;margin-top:6px;"]);
@@ -0,0 +1,24 @@
1
+ import type { ReactElement, ReactNode } from 'react';
2
+ import type { WithHTMLAttributes } from '@synerise/ds-utils';
3
+ export type CustomColorType = 'blue' | 'grey' | 'red' | 'green' | 'yellow' | 'pink' | 'mars' | 'orange' | 'fern' | 'cyan' | 'purple' | 'violet';
4
+ export type ColorType = 'grey' | 'red' | 'green' | 'yellow' | 'violet' | 'purple' | 'cyan';
5
+ export type SectionType = 'positive' | 'notice' | 'negative' | 'neutral' | 'supply' | 'service' | 'entity';
6
+ export type SectionMessageProps = WithHTMLAttributes<HTMLDivElement, {
7
+ message?: ReactNode;
8
+ type: string | SectionType;
9
+ customColor?: CustomColorType;
10
+ customColorIcon?: CustomColorType;
11
+ color?: ColorType;
12
+ description?: ReactNode;
13
+ showMoreLabel?: ReactNode;
14
+ onShowMore?: () => void;
15
+ onClose?: () => void;
16
+ suffixel?: ReactNode;
17
+ moreButtons?: ReactNode;
18
+ withEmphasis?: ReactNode;
19
+ withLink?: ReactNode;
20
+ unorderedList?: ReactNode;
21
+ withClose?: ReactNode;
22
+ customIcon?: ReactElement;
23
+ icon?: ReactNode;
24
+ }>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ export { default } from './SectionMessage';
2
+ export type { SectionMessageProps } from './SectionMessage.types';
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ export { default } from './SectionMessage';
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom';
@@ -0,0 +1,4 @@
1
+ import React, { type ReactNode } from 'react';
2
+ import { type SectionType } from '../SectionMessage.types';
3
+ export declare const ICONS: Record<SectionType, ReactNode>;
4
+ export declare const DEFAULT_ICON: React.JSX.Element;
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import { Check3M, HelpFillM, NotificationsReceiveM, UpdateDataM, UserUpM, WarningFillM } from '@synerise/ds-icon';
3
+ export var ICONS = {
4
+ positive: /*#__PURE__*/React.createElement(Check3M, null),
5
+ notice: /*#__PURE__*/React.createElement(WarningFillM, null),
6
+ negative: /*#__PURE__*/React.createElement(WarningFillM, null),
7
+ neutral: /*#__PURE__*/React.createElement(HelpFillM, null),
8
+ supply: /*#__PURE__*/React.createElement(UserUpM, null),
9
+ service: /*#__PURE__*/React.createElement(UpdateDataM, null),
10
+ entity: /*#__PURE__*/React.createElement(NotificationsReceiveM, null)
11
+ };
12
+ export var DEFAULT_ICON = /*#__PURE__*/React.createElement(WarningFillM, null);
package/package.json ADDED
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "@synerise/ds-section-message",
3
+ "version": "1.0.1",
4
+ "description": "SectionMessage UI Component for the Synerise Design System",
5
+ "license": "ISC",
6
+ "repository": "Synerise/synerise-design",
7
+ "main": "dist/index.js",
8
+ "files": [
9
+ "/dist",
10
+ "CHANGELOG.md",
11
+ "README.md",
12
+ "package.json",
13
+ "LICENSE.md"
14
+ ],
15
+ "publishConfig": {
16
+ "access": "public"
17
+ },
18
+ "scripts": {
19
+ "build": "npm run build:js && npm run build:css && npm run defs",
20
+ "build:css": "node ../../../scripts/style/less.js",
21
+ "build:js": "babel --delete-dir-on-start --root-mode upward src --out-dir dist --extensions '.js,.ts,.tsx'",
22
+ "build:watch": "npm run build:js -- --watch",
23
+ "defs": "tsc --declaration --outDir dist/ --emitDeclarationOnly",
24
+ "prepublish": "npm run build",
25
+ "types": "tsc --noEmit",
26
+ "pack:ci": "npm pack --pack-destination ../../storybook/storybook-static/static",
27
+ "test": "jest",
28
+ "test:watch": "npm run test -- --watchAll",
29
+ "upgrade:ds": "ncu -f \"@synerise/ds-*\" -u"
30
+ },
31
+ "sideEffects": [
32
+ "dist/style/*",
33
+ "*.less"
34
+ ],
35
+ "types": "dist/index.d.ts",
36
+ "dependencies": {
37
+ "@synerise/ds-icon": "^1.6.1",
38
+ "@synerise/ds-utils": "^1.3.0"
39
+ },
40
+ "peerDependencies": {
41
+ "@synerise/ds-core": "*",
42
+ "react": ">=16.9.0 <= 18.3.1",
43
+ "styled-components": "^5.3.3"
44
+ },
45
+ "gitHead": "4e851d649cb25346f2f8e0575dde91cc50f43bc4"
46
+ }