@synerise/ds-alert 0.8.16 → 0.8.17

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 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
+ ## [0.8.17](https://github.com/Synerise/synerise-design/compare/@synerise/ds-alert@0.8.16...@synerise/ds-alert@0.8.17) (2024-07-02)
7
+
8
+ **Note:** Version bump only for package @synerise/ds-alert
9
+
10
+
11
+
12
+
13
+
6
14
  ## [0.8.16](https://github.com/Synerise/synerise-design/compare/@synerise/ds-alert@0.8.15...@synerise/ds-alert@0.8.16) (2024-06-27)
7
15
 
8
16
  **Note:** Version bump only for package @synerise/ds-alert
@@ -1,4 +1,4 @@
1
- import * as React from 'react';
1
+ import React from 'react';
2
2
  import { Props } from './Toast.types';
3
- declare const Toast: React.FC<Props>;
3
+ declare const Toast: ({ icon, type, message, description, expander, expandedContent, color, withClose, customColor, customColorIcon, customIcon, colorIcon, customColorText, expanded, onExpand, onCloseClick, button, className, }: Props) => React.JSX.Element;
4
4
  export default Toast;
@@ -1,4 +1,4 @@
1
- import * as React from 'react';
1
+ import React, { useCallback, useMemo } from 'react';
2
2
  import Icon, { CloseM, WarningFillM, Check3M, HelpFillM, InfoFillM, AngleDownS } from '@synerise/ds-icon';
3
3
  import * as S from './Toast.styles';
4
4
  var ICONS = {
@@ -27,47 +27,44 @@ var Toast = function Toast(_ref) {
27
27
  expanded = _ref.expanded,
28
28
  onExpand = _ref.onExpand,
29
29
  onCloseClick = _ref.onCloseClick,
30
- show = _ref.show,
31
- button = _ref.button;
32
- var renderMessage = React.useMemo(function () {
33
- return /*#__PURE__*/React.createElement(S.AlertContent, null, message && /*#__PURE__*/React.createElement(S.AlertMessage, {
34
- customColorText: customColorText,
35
- color: color
36
- }, message), /*#__PURE__*/React.createElement(S.Text, {
37
- customColorText: customColorText,
38
- color: color
39
- }, description && /*#__PURE__*/React.createElement(S.AlertDescription, {
40
- expandedContent: expandedContent,
41
- button: button,
42
- customColorText: customColorText,
43
- color: color
44
- }, description)), expandedContent && expanded && /*#__PURE__*/React.createElement(S.ListWrapper, {
45
- description: description,
46
- visible: expanded
47
- }, expandedContent), button);
48
- }, [message, description, expandedContent, customColorText, color, expanded, button]);
49
- var renderIcon = React.useMemo(function () {
30
+ button = _ref.button,
31
+ className = _ref.className;
32
+ var hasToastContent = button || description || expandedContent;
33
+ var toastContent = hasToastContent && /*#__PURE__*/React.createElement(S.AlertContent, {
34
+ hasBottomMargin: Boolean(button || description || expandedContent && expanded)
35
+ }, description && /*#__PURE__*/React.createElement(S.AlertDescription, {
36
+ expandedContent: expandedContent,
37
+ button: button,
38
+ customColorText: customColorText,
39
+ color: color
40
+ }, description), expandedContent && /*#__PURE__*/React.createElement(S.ListWrapper, {
41
+ description: description,
42
+ visible: expanded
43
+ }, expandedContent), button);
44
+ var renderIcon = useMemo(function () {
50
45
  if (icon) return icon;
51
46
  if (ICONS[type]) return ICONS[type];
52
47
  return DEFAULT_ICON;
53
48
  }, [icon, type]);
54
- var expandContent = React.useCallback(function () {
49
+ var expandContent = useCallback(function () {
55
50
  onExpand && onExpand(!expanded);
56
51
  }, [onExpand, expanded]);
57
52
  return /*#__PURE__*/React.createElement(S.Container, {
58
- expander: expander,
59
- expandedContent: expandedContent,
60
- withClose: withClose,
61
- visible: show,
62
- onCloseClick: onCloseClick,
63
53
  color: color,
64
- customColor: customColor
65
- }, /*#__PURE__*/React.createElement(S.WrapperSectionMessage, null, /*#__PURE__*/React.createElement(S.AllContent, null, /*#__PURE__*/React.createElement(S.IconWrapper, {
54
+ customColor: customColor,
55
+ className: className
56
+ }, (customIcon || renderIcon) && /*#__PURE__*/React.createElement(S.IconWrapper, {
66
57
  colorIcon: colorIcon,
67
58
  customColorIcon: customColorIcon
68
59
  }, customIcon || /*#__PURE__*/React.createElement(Icon, {
69
60
  component: renderIcon
70
- })), renderMessage), /*#__PURE__*/React.createElement(S.ButtonWrapper, null, expander && /*#__PURE__*/React.createElement(S.IconExpanderWrapper, {
61
+ })), /*#__PURE__*/React.createElement(S.WrapperSectionMessage, null, /*#__PURE__*/React.createElement(S.AlertMessage, {
62
+ noToastContent: !hasToastContent,
63
+ hasClose: !!withClose,
64
+ hasExpander: !!expander,
65
+ customColorText: customColorText,
66
+ color: color
67
+ }, message), /*#__PURE__*/React.createElement(S.ButtonWrapper, null, expander && /*#__PURE__*/React.createElement(S.IconExpanderWrapper, {
71
68
  onClick: expandContent,
72
69
  expanded: expanded,
73
70
  customColorText: customColorText,
@@ -81,7 +78,7 @@ var Toast = function Toast(_ref) {
81
78
  color: color
82
79
  }, /*#__PURE__*/React.createElement(Icon, {
83
80
  component: /*#__PURE__*/React.createElement(CloseM, null)
84
- })))));
81
+ }))), toastContent));
85
82
  };
86
83
 
87
84
  export default Toast;
@@ -1,15 +1,12 @@
1
1
  import { Keyframes } from 'styled-components';
2
- import * as React from 'react';
2
+ import { ReactNode } from 'react';
3
3
  import 'animate.css';
4
4
  import { ColorIconType, ColorType, CustomColorType } from './Toast.types';
5
- export declare const openingAnimation: () => Keyframes;
6
5
  export declare const closingAnimation: () => Keyframes;
7
- export declare const AlertContent: import("styled-components").StyledComponent<"div", any, {}, never>;
8
- export declare const AllContent: import("styled-components").StyledComponent<"div", any, {}, never>;
9
- export declare const Text: import("styled-components").StyledComponent<"div", any, {
10
- customColorText?: CustomColorType | undefined;
11
- color?: ColorType | undefined;
6
+ export declare const AlertContent: import("styled-components").StyledComponent<"div", any, {
7
+ hasBottomMargin?: boolean | undefined;
12
8
  }, never>;
9
+ export declare const AllContent: import("styled-components").StyledComponent<"div", any, {}, never>;
13
10
  export declare const IconWrapper: import("styled-components").StyledComponent<"div", any, {
14
11
  colorIcon?: ColorIconType | undefined;
15
12
  customColorIcon?: CustomColorType | undefined;
@@ -34,7 +31,7 @@ export declare const NumberWrapper: import("styled-components").StyledComponent<
34
31
  }, never>;
35
32
  export declare const ListWrapper: import("styled-components").StyledComponent<"div", any, {
36
33
  visible?: boolean | undefined;
37
- description?: React.ReactNode;
34
+ description?: ReactNode;
38
35
  }, never>;
39
36
  export declare const IconOrderWrapper: import("styled-components").StyledComponent<"div", any, {
40
37
  customColorText?: CustomColorType | undefined;
@@ -50,21 +47,19 @@ export declare const AnimationContainer: import("styled-components").StyledCompo
50
47
  }, never>;
51
48
  export declare const Container: import("styled-components").StyledComponent<"div", any, {
52
49
  color?: ColorType | undefined;
53
- visible?: React.ReactNode | boolean;
54
50
  customColor?: CustomColorType | undefined;
55
- onCloseClick?: (() => void) | undefined;
56
- expandedContent?: React.ReactNode | boolean;
57
- expander?: React.ReactNode | boolean;
58
- withClose?: React.ReactNode | boolean;
59
51
  }, never>;
60
52
  export declare const WrapperSectionMessage: import("styled-components").StyledComponent<"div", any, {}, never>;
61
- export declare const AlertMessage: import("styled-components").StyledComponent<"span", any, {
53
+ export declare const AlertMessage: import("styled-components").StyledComponent<"div", any, {
54
+ noToastContent?: boolean | undefined;
62
55
  customColorText?: CustomColorType | undefined;
63
56
  color?: ColorType | undefined;
57
+ hasClose?: boolean | undefined;
58
+ hasExpander?: boolean | undefined;
64
59
  }, never>;
65
60
  export declare const AlertDescription: import("styled-components").StyledComponent<"span", any, {
66
61
  customColorText?: CustomColorType | undefined;
67
62
  color?: ColorType | undefined;
68
- button?: React.ReactNode | boolean;
69
- expandedContent?: React.ReactNode | boolean;
63
+ button?: ReactNode | boolean;
64
+ expandedContent?: ReactNode | boolean;
70
65
  }, never>;
@@ -1,6 +1,20 @@
1
1
  import styled, { keyframes } from 'styled-components';
2
+ import { hexToRgba } from '@synerise/ds-utils';
3
+ import { UnorderedList } from '@synerise/ds-unordered-list/dist/Unordered-list.styles';
2
4
  import 'animate.css';
3
5
 
6
+ var getWidth = function getWidth(hasClose, hasExpander) {
7
+ if (hasClose && hasExpander) {
8
+ return '72px';
9
+ }
10
+
11
+ if (hasClose || hasExpander) {
12
+ return '48px';
13
+ }
14
+
15
+ return '24px';
16
+ };
17
+
4
18
  var getColorIcon = function getColorIcon(props) {
5
19
  switch (props.colorIcon) {
6
20
  case 'white':
@@ -49,67 +63,56 @@ var getColorBackground = function getColorBackground(props) {
49
63
  }
50
64
  };
51
65
 
52
- var getWidth = function getWidth(props) {
53
- if (props.expandedContent || props.expander && props.withClose) {
54
- return '420px';
55
- }
56
-
57
- return '354px';
58
- };
59
-
60
- export var openingAnimation = function openingAnimation() {
66
+ var openingAnimation = function openingAnimation() {
61
67
  return keyframes(["0%{height:0%;opacity:0;}100%{height:100%;opacity:1;}"]);
62
68
  };
69
+
63
70
  export var closingAnimation = function closingAnimation() {
64
71
  return keyframes(["0%{height:100%;opacity:1;}100%{height:0%;opacity:0;}"]);
65
72
  };
66
73
  export var AlertContent = styled.div.withConfig({
67
74
  displayName: "Toaststyles__AlertContent",
68
75
  componentId: "q5tn0-0"
69
- })(["display:flex;flex-direction:column;align-items:flex-start;justify-content:flex-start;padding:12px 0;"]);
76
+ })(["display:flex;flex-direction:column;align-items:flex-start;justify-content:center;margin-right:24px;", " ", "{margin-bottom:8px;}"], function (props) {
77
+ return props.hasBottomMargin && 'margin-bottom:16px;';
78
+ }, UnorderedList);
70
79
  export var AllContent = styled.div.withConfig({
71
80
  displayName: "Toaststyles__AllContent",
72
81
  componentId: "q5tn0-1"
73
82
  })(["display:flex;color:inherit;"]);
74
- export var Text = styled.div.withConfig({
75
- displayName: "Toaststyles__Text",
76
- componentId: "q5tn0-2"
77
- })(["display:flex;color:", ";"], function (props) {
78
- return props.customColorText ? props.theme.palette[props.customColorText + "-600"] : getColorText(props);
79
- });
80
83
  export var IconWrapper = styled.div.withConfig({
81
84
  displayName: "Toaststyles__IconWrapper",
82
- componentId: "q5tn0-3"
83
- })(["margin:10px 12px;display:flex;svg{color:", ";fill:", ";}"], function (props) {
85
+ componentId: "q5tn0-2"
86
+ })(["margin:12px;display:flex;svg{color:", ";fill:", ";}"], function (props) {
84
87
  return props.customColorIcon ? props.theme.palette[props.customColorIcon + "-600"] : getColorIcon;
85
88
  }, function (props) {
86
89
  return props.customColorIcon ? props.theme.palette[props.customColorIcon + "-600"] : getColorIcon;
87
90
  });
88
91
  export var IconCloseWrapper = styled.div.withConfig({
89
92
  displayName: "Toaststyles__IconCloseWrapper",
90
- componentId: "q5tn0-4"
91
- })(["margin:3px 5px 2px;cursor:pointer;svg{fill:", ";}"], function (props) {
93
+ componentId: "q5tn0-3"
94
+ })(["cursor:pointer;svg{fill:", ";}"], function (props) {
92
95
  return props.customColorText ? props.theme.palette[props.customColorText + "-600"] : getColorText(props);
93
96
  });
94
97
  export var IconExpanderWrapper = styled.div.withConfig({
95
98
  displayName: "Toaststyles__IconExpanderWrapper",
96
- componentId: "q5tn0-5"
97
- })(["margin:3px 5px 2px;cursor:pointer;svg{fill:", ";transition:transform 0.1s linear;transform:rotateZ(", ");}"], function (props) {
99
+ componentId: "q5tn0-4"
100
+ })(["cursor:pointer;svg{fill:", ";transition:transform 0.1s linear;transform:rotateZ(", ");}"], function (props) {
98
101
  return props.customColorText ? props.theme.palette[props.customColorText + "-600"] : getColorText(props);
99
102
  }, function (props) {
100
103
  return props.expanded ? '180deg' : '0deg';
101
104
  });
102
105
  export var ButtonWrapper = styled.div.withConfig({
103
106
  displayName: "Toaststyles__ButtonWrapper",
104
- componentId: "q5tn0-6"
105
- })(["padding:6px 8px 0 8px;display:flex;"]);
107
+ componentId: "q5tn0-5"
108
+ })(["position:absolute;right:12px;top:12px;display:flex;"]);
106
109
  export var FirstButtonWrapper = styled.div.withConfig({
107
110
  displayName: "Toaststyles__FirstButtonWrapper",
108
- componentId: "q5tn0-7"
111
+ componentId: "q5tn0-6"
109
112
  })(["margin-right:8px;"]);
110
113
  export var NumberWrapper = styled.div.withConfig({
111
114
  displayName: "Toaststyles__NumberWrapper",
112
- componentId: "q5tn0-8"
115
+ componentId: "q5tn0-7"
113
116
  })(["margin-left:4px;color:inherit;opacity:0.6;cursor:pointer;&:hover{background-image:linear-gradient( to right,", " 20%,rgba(255,255,255,0) 10% );background-color:transparent;background-position:bottom left;background-size:5px 1px;background-repeat:repeat-x;opacity:1;color:", ";}"], function (props) {
114
117
  return props.theme.palette['grey-400'];
115
118
  }, function (props) {
@@ -117,22 +120,26 @@ export var NumberWrapper = styled.div.withConfig({
117
120
  });
118
121
  export var ListWrapper = styled.div.withConfig({
119
122
  displayName: "Toaststyles__ListWrapper",
120
- componentId: "q5tn0-9"
121
- })(["display:flex;margin-top:", ";"], function (props) {
122
- return !props.description ? '10px' : '0';
123
+ componentId: "q5tn0-8"
124
+ })(["display:flex;visibility:", ";height:", ";margin-top:", ";"], function (props) {
125
+ return props.visible ? 'visible' : 'hidden';
126
+ }, function (props) {
127
+ return props.visible ? 'auto' : '0';
128
+ }, function (props) {
129
+ return !props.description && props.visible ? '10px' : '0';
123
130
  });
124
131
  export var IconOrderWrapper = styled.div.withConfig({
125
132
  displayName: "Toaststyles__IconOrderWrapper",
126
- componentId: "q5tn0-10"
127
- })(["display:none;margin:-4px 0;svg{fill:", ";}&:hover{svg{fill:", ";cursor:pointer;}}"], function (props) {
133
+ componentId: "q5tn0-9"
134
+ })(["visibility:hidden;margin:-4px 0;svg{fill:", ";}&:hover{svg{fill:", ";cursor:pointer;}}"], function (props) {
128
135
  return props.customColorText ? props.theme.palette[props.customColorText + "-600"] : getColorText(props);
129
136
  }, function (props) {
130
137
  return props.theme.palette['blue-600'];
131
138
  });
132
139
  export var OrderWrapper = styled.div.withConfig({
133
140
  displayName: "Toaststyles__OrderWrapper",
134
- componentId: "q5tn0-11"
135
- })(["display:flex;color:", ";&:hover{", "{display:block;}", "{background-image:linear-gradient( to right,", " 20%,rgba(255,255,255,0) 10% );background-color:transparent;background-position:bottom left;background-size:5px 1px;background-repeat:repeat-x;opacity:1;color:", ";}}"], function (props) {
141
+ componentId: "q5tn0-10"
142
+ })(["display:flex;color:", ";&:hover{", "{visibility:visible;}", "{background-image:linear-gradient( to right,", " 20%,rgba(255,255,255,0) 10% );background-color:transparent;background-position:bottom left;background-size:5px 1px;background-repeat:repeat-x;opacity:1;color:", ";}}"], function (props) {
136
143
  return props.customColorText ? props.theme.palette[props.customColorText + "-600"] : getColorText(props);
137
144
  }, IconOrderWrapper, NumberWrapper, function (props) {
138
145
  return props.customColorText ? props.theme.palette[props.customColorText + "-600"] : getColorText(props);
@@ -141,41 +148,43 @@ export var OrderWrapper = styled.div.withConfig({
141
148
  });
142
149
  export var Wrapper = styled.div.withConfig({
143
150
  displayName: "Toaststyles__Wrapper",
144
- componentId: "q5tn0-12"
151
+ componentId: "q5tn0-11"
145
152
  })(["color:", ";"], function (props) {
146
153
  return props.theme.palette['grey-050'];
147
154
  });
148
155
  export var AnimationContainer = styled.div.withConfig({
149
156
  displayName: "Toaststyles__AnimationContainer",
150
- componentId: "q5tn0-13"
157
+ componentId: "q5tn0-12"
151
158
  })(["animation:", " 0.5s ease-in-out 0s 1;"], function (props) {
152
159
  return props.show ? openingAnimation() : closingAnimation();
153
160
  });
154
161
  export var Container = styled.div.withConfig({
155
162
  displayName: "Toaststyles__Container",
156
- componentId: "q5tn0-14"
157
- })(["width:", ";align-items:center;justify-content:center;background-color:", ";border-radius:4px;box-shadow:", ";"], function (props) {
158
- return props.expander && props.expandedContent && props.withClose ? '460px' : getWidth(props);
159
- }, function (props) {
163
+ componentId: "q5tn0-13"
164
+ })(["display:flex;flex-direction:row;max-width:500px;align-items:flex-start;justify-content:center;background-color:", ";border-radius:4px;box-shadow:", ";"], function (props) {
160
165
  return props.customColor ? props.theme.palette[props.customColor + "-600"] : getColorBackground(props);
161
166
  }, function (props) {
162
- return props.color ? "0px 16px 32px 5px " + props.theme.palette["grey-200"] : 'none';
167
+ return props.color ? "0px 16px 32px 5px " + hexToRgba(props.theme.palette['grey-900'], 0.2) : 'none';
163
168
  });
164
169
  export var WrapperSectionMessage = styled.div.withConfig({
165
170
  displayName: "Toaststyles__WrapperSectionMessage",
166
- componentId: "q5tn0-15"
167
- })(["display:flex;font-size:13px;color:inherit;justify-content:space-between;"]);
168
- export var AlertMessage = styled.span.withConfig({
171
+ componentId: "q5tn0-14"
172
+ })(["position:relative;font-size:13px;color:inherit;"]);
173
+ export var AlertMessage = styled.div.withConfig({
169
174
  displayName: "Toaststyles__AlertMessage",
170
- componentId: "q5tn0-16"
171
- })(["font-size:16px;line-height:1.25;font-weight:500;max-width:400px;overflow:hidden;text-overflow:ellipsis;color:", ";"], function (props) {
175
+ componentId: "q5tn0-15"
176
+ })(["font-size:14px;line-height:20px;padding-top:14px;", ";font-weight:500;overflow:hidden;text-overflow:ellipsis;padding-right:", ";color:", ";"], function (props) {
177
+ return props.noToastContent && 'padding-bottom: 14px;';
178
+ }, function (props) {
179
+ return getWidth(props.hasClose, props.hasExpander);
180
+ }, function (props) {
172
181
  return props.customColorText ? props.theme.palette[props.customColorText + "-600"] : getColorText(props);
173
182
  });
174
183
  export var AlertDescription = styled.span.withConfig({
175
184
  displayName: "Toaststyles__AlertDescription",
176
- componentId: "q5tn0-17"
177
- })(["display:flex;font-size:13px;line-height:1.39;font-weight:normal;padding:", ";margin-top:2px;color:", ";"], function (props) {
178
- return props.button || props.expandedContent ? ' 0 3px 10px 0' : '0px';
185
+ componentId: "q5tn0-16"
186
+ })(["display:flex;font-size:13px;line-height:1.39;font-weight:normal;overflow-wrap:anywhere;padding-bottom:", ";margin-top:2px;color:", ";"], function (props) {
187
+ return props.button || props.expandedContent ? '16px' : '0';
179
188
  }, function (props) {
180
189
  return props.customColorText ? props.theme.palette[props.customColorText + "-600"] : getColorText(props);
181
190
  });
@@ -1,24 +1,23 @@
1
+ import { ReactElement, ReactNode } from 'react';
1
2
  import { AlertProps } from 'antd/lib/alert';
2
- import * as React from 'react';
3
3
  export type ToastType = 'success' | 'warning' | 'negative' | 'informative' | 'neutral';
4
4
  export type CustomColorType = 'blue' | 'grey' | 'red' | 'green' | 'yellow' | 'pink' | 'mars' | 'orange' | 'fern' | 'cyan' | 'purple' | 'violet';
5
5
  export type ColorType = 'grey' | 'red' | 'green' | 'yellow' | 'blue';
6
6
  export type ColorIconType = 'white' | 'grey' | 'black' | 'yellow' | 'blue';
7
7
  export interface Props extends Omit<AlertProps, 'type' | 'message'> {
8
- message?: React.ReactNode;
8
+ message?: ReactNode;
9
9
  type: string | ToastType;
10
10
  customColor?: CustomColorType;
11
11
  customColorText?: CustomColorType;
12
12
  customColorIcon?: CustomColorType;
13
13
  color?: ColorType;
14
14
  colorIcon?: ColorIconType;
15
- expander?: boolean | React.ReactNode;
16
- expandedContent?: React.ReactNode;
17
- withClose?: React.ReactNode;
18
- customIcon?: React.ReactElement;
19
- button?: React.ReactNode;
15
+ expander?: ReactNode;
16
+ expandedContent?: ReactNode;
17
+ withClose?: ReactNode;
18
+ customIcon?: ReactElement;
19
+ button?: ReactNode;
20
20
  expanded?: boolean;
21
21
  onExpand?: (isExpanded: boolean) => void;
22
22
  onCloseClick?: () => void;
23
- show?: boolean;
24
23
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synerise/ds-alert",
3
- "version": "0.8.16",
3
+ "version": "0.8.17",
4
4
  "description": "Alert UI Component for the Synerise Design System",
5
5
  "license": "ISC",
6
6
  "repository": "Synerise/synerise-design",
@@ -35,6 +35,7 @@
35
35
  "dependencies": {
36
36
  "@synerise/ds-button": "^0.21.1",
37
37
  "@synerise/ds-icon": "^0.63.0",
38
+ "@synerise/ds-unordered-list": "^0.2.88",
38
39
  "animate.css": "^4.1.1",
39
40
  "react-animate-height": "^2.0.23",
40
41
  "react-dom": "16.13.0",
@@ -51,5 +52,5 @@
51
52
  "@testing-library/jest-dom": "5.1.1",
52
53
  "@testing-library/react": "10.0.1"
53
54
  },
54
- "gitHead": "587eb113074985ae21e4f0c25ec33c3e3e2e072b"
55
+ "gitHead": "0692552b018dc9c8042f18c773f88890c9ad3270"
55
56
  }