@aloudata/aloudata-design 2.8.7 → 2.9.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.
@@ -1,8 +1,9 @@
1
1
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
- var _excluded = ["icon", "closeIcon", "description", "footer"],
3
- _excluded2 = ["icon", "closeIcon", "description", "footer"],
4
- _excluded3 = ["icon", "closeIcon", "description", "footer"],
5
- _excluded4 = ["icon", "closeIcon", "description", "footer"];
2
+ var _excluded = ["message", "description", "placement", "className", "duration"],
3
+ _excluded2 = ["message", "description", "placement", "className", "duration"],
4
+ _excluded3 = ["message", "description", "placement", "className", "duration"],
5
+ _excluded4 = ["message", "description", "placement", "className", "duration"],
6
+ _excluded5 = ["message", "description", "placement", "className", "duration"];
6
7
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
7
8
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
8
9
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
@@ -10,144 +11,195 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _ty
10
11
  function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
11
12
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
12
13
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
13
- import { notification as AntdNotification } from 'antd';
14
- import classnames from 'classnames';
14
+ import classNames from 'classnames';
15
15
  import React from 'react';
16
- import { AttentionTriangleLightLine, CheckCircleLightLine, CloseCircleLightLine, CloseLLine, InformationCircleLightLine } from "../Icon";
17
- import theme from "../style/themes/default/themeColor.module.less";
16
+ import { Slide, toast } from 'react-toastify';
17
+ import { AttentionTriangleFill, CheckCircleFill, CloseLLine, DangerFill, InformationCircleFill } from "../Icon";
18
+ var closeX = /*#__PURE__*/React.createElement(CloseLLine, {
19
+ size: 20,
20
+ color: "#6B7280"
21
+ });
22
+ var defaultOptions = {
23
+ closeButton: closeX,
24
+ pauseOnHover: true,
25
+ transition: Slide,
26
+ position: 'top-center',
27
+ autoClose: 3000,
28
+ hideProgressBar: true,
29
+ closeOnClick: true,
30
+ draggable: false,
31
+ progress: undefined,
32
+ theme: 'light',
33
+ containerId: 'notification-container'
34
+ };
18
35
  var iconMap = {
19
36
  info: /*#__PURE__*/React.createElement("div", {
20
- className: "ald-notification-notice-icon-success"
21
- }, /*#__PURE__*/React.createElement(InformationCircleLightLine, {
22
- color: "#22C55E",
37
+ className: "ald-notification-notice-icon"
38
+ }, /*#__PURE__*/React.createElement(InformationCircleFill, {
39
+ color: "var(--alias-colors-icon-information ,#2986F4)",
23
40
  size: 24
24
41
  })),
25
42
  success: /*#__PURE__*/React.createElement("div", {
26
- className: "ald-notification-notice-icon-success"
27
- }, /*#__PURE__*/React.createElement(CheckCircleLightLine, {
28
- color: 'var(--global-colors-green-600)',
43
+ className: "ald-notification-notice-icon"
44
+ }, /*#__PURE__*/React.createElement(CheckCircleFill, {
45
+ color: "var(--alias-colors-icon-success ,#22C55E)",
29
46
  size: 24
30
47
  })),
31
48
  error: /*#__PURE__*/React.createElement("div", {
32
- className: "ald-notification-notice-icon-error"
33
- }, /*#__PURE__*/React.createElement(CloseCircleLightLine, {
34
- color: "#EF4444",
49
+ className: "ald-notification-notice-icon"
50
+ }, /*#__PURE__*/React.createElement(DangerFill, {
51
+ color: "var(--alias-colors-icon-error ,#EF4444)",
35
52
  size: 24
36
53
  })),
37
54
  warning: /*#__PURE__*/React.createElement("div", {
38
- className: "ald-notification-notice-icon-warning"
39
- }, /*#__PURE__*/React.createElement(AttentionTriangleLightLine, {
40
- color: "#FFB01F",
55
+ className: "ald-notification-notice-icon"
56
+ }, /*#__PURE__*/React.createElement(AttentionTriangleFill, {
57
+ color: "var(--alias-colors-icon-warning ,#EAB308)",
41
58
  size: 24
42
59
  }))
43
60
  };
44
- var closeX = /*#__PURE__*/React.createElement(CloseLLine, {
45
- size: 20,
46
- color: "#171717"
47
- });
48
- var getSDefaultStyle = function getSDefaultStyle() {
49
- return {
50
- padding: '24px',
51
- border: '1px solid #D1D5DB',
52
- borderRadius: '2px',
53
- boxShadow: theme.SHADOW_LG,
54
- background: '#FFF'
55
- };
56
- };
61
+ function getPosition(placement) {
62
+ switch (placement) {
63
+ case 'topLeft':
64
+ return 'top-left';
65
+ case 'topCenter':
66
+ return 'top-center';
67
+ case 'topRight':
68
+ return 'top-right';
69
+ case 'bottomCenter':
70
+ return 'bottom-center';
71
+ case 'bottomLeft':
72
+ return 'bottom-left';
73
+ case 'bottomRight':
74
+ return 'bottom-right';
75
+ default:
76
+ return placement;
77
+ }
78
+ }
57
79
  var notification = {
58
80
  open: function open(config) {
59
- return AntdNotification.open(config);
81
+ var message = config.message,
82
+ description = config.description,
83
+ _config$placement = config.placement,
84
+ placement = _config$placement === void 0 ? 'topRight' : _config$placement,
85
+ className = config.className,
86
+ duration = config.duration,
87
+ restConfig = _objectWithoutProperties(config, _excluded);
88
+ return toast( /*#__PURE__*/React.createElement("div", {
89
+ className: "ald-notification-content"
90
+ }, /*#__PURE__*/React.createElement("div", {
91
+ className: "ald-notification-message"
92
+ }, message), description && /*#__PURE__*/React.createElement("div", {
93
+ className: 'ald-notification-desc'
94
+ }, description)), _objectSpread(_objectSpread({
95
+ icon: false
96
+ }, defaultOptions), {}, {
97
+ autoClose: duration ? duration * 1000 : 3000,
98
+ position: getPosition(placement),
99
+ className: classNames('ald-notification', className)
100
+ }, restConfig));
60
101
  },
61
102
  success: function success(config) {
62
- var _config$icon = config.icon,
63
- icon = _config$icon === void 0 ? iconMap.success : _config$icon,
64
- _config$closeIcon = config.closeIcon,
65
- closeIcon = _config$closeIcon === void 0 ? closeX : _config$closeIcon,
103
+ var message = config.message,
66
104
  description = config.description,
67
- footer = config.footer,
68
- rest = _objectWithoutProperties(config, _excluded);
69
- return AntdNotification.success(_objectSpread(_objectSpread({}, rest), {}, {
70
- style: Object.assign({}, getSDefaultStyle(), config.style),
71
- className: classnames('ald-notification-notice', config.className),
72
- icon: icon,
73
- closeIcon: closeIcon,
74
- description: /*#__PURE__*/React.createElement("div", {
75
- className: "ald-notification-content"
76
- }, /*#__PURE__*/React.createElement("div", {
77
- className: 'ald-notification-desc'
78
- }, description), footer && /*#__PURE__*/React.createElement("div", {
79
- className: 'ald-notification-footer'
80
- }, footer))
81
- }));
105
+ _config$placement2 = config.placement,
106
+ placement = _config$placement2 === void 0 ? 'topRight' : _config$placement2,
107
+ className = config.className,
108
+ duration = config.duration,
109
+ restConfig = _objectWithoutProperties(config, _excluded2);
110
+ return toast.success( /*#__PURE__*/React.createElement("div", {
111
+ className: "ald-notification-content"
112
+ }, /*#__PURE__*/React.createElement("div", {
113
+ className: "ald-notification-message"
114
+ }, message), description && /*#__PURE__*/React.createElement("div", {
115
+ className: 'ald-notification-desc'
116
+ }, description)), _objectSpread(_objectSpread({
117
+ icon: function icon() {
118
+ return iconMap.success;
119
+ }
120
+ }, defaultOptions), {}, {
121
+ autoClose: duration ? duration * 1000 : 3000,
122
+ position: getPosition(placement),
123
+ className: classNames('ald-notification', className)
124
+ }, restConfig));
82
125
  },
83
126
  error: function error(config) {
84
- var _config$icon2 = config.icon,
85
- icon = _config$icon2 === void 0 ? iconMap.error : _config$icon2,
86
- _config$closeIcon2 = config.closeIcon,
87
- closeIcon = _config$closeIcon2 === void 0 ? closeX : _config$closeIcon2,
127
+ var message = config.message,
88
128
  description = config.description,
89
- footer = config.footer,
90
- rest = _objectWithoutProperties(config, _excluded2);
91
- return AntdNotification.error(_objectSpread(_objectSpread({}, rest), {}, {
92
- className: classnames('ald-notification-notice', config.className),
93
- style: Object.assign(getSDefaultStyle(), config.style),
94
- icon: icon,
95
- closeIcon: closeIcon,
96
- description: /*#__PURE__*/React.createElement("div", {
97
- className: "ald-notification-content"
98
- }, /*#__PURE__*/React.createElement("div", {
99
- className: 'ald-notification-desc'
100
- }, description), footer && /*#__PURE__*/React.createElement("div", {
101
- className: 'ald-notification-footer'
102
- }, footer))
103
- }));
129
+ _config$placement3 = config.placement,
130
+ placement = _config$placement3 === void 0 ? 'topRight' : _config$placement3,
131
+ className = config.className,
132
+ duration = config.duration,
133
+ restConfig = _objectWithoutProperties(config, _excluded3);
134
+ return toast.error( /*#__PURE__*/React.createElement("div", {
135
+ className: "ald-notification-content"
136
+ }, /*#__PURE__*/React.createElement("div", {
137
+ className: "ald-notification-message"
138
+ }, message), description && /*#__PURE__*/React.createElement("div", {
139
+ className: 'ald-notification-desc'
140
+ }, description)), _objectSpread(_objectSpread({
141
+ icon: function icon() {
142
+ return iconMap.error;
143
+ }
144
+ }, defaultOptions), {}, {
145
+ autoClose: duration ? duration * 1000 : 3000,
146
+ position: getPosition(placement),
147
+ className: classNames('ald-notification', className)
148
+ }, restConfig));
104
149
  },
105
- warning: function warning(config) {
106
- var _config$icon3 = config.icon,
107
- icon = _config$icon3 === void 0 ? iconMap.warning : _config$icon3,
108
- _config$closeIcon3 = config.closeIcon,
109
- closeIcon = _config$closeIcon3 === void 0 ? closeX : _config$closeIcon3,
150
+ info: function info(config) {
151
+ var message = config.message,
110
152
  description = config.description,
111
- footer = config.footer,
112
- rest = _objectWithoutProperties(config, _excluded3);
113
- return AntdNotification.warning(_objectSpread(_objectSpread({}, rest), {}, {
114
- className: classnames('ald-notification-notice', config.className),
115
- style: Object.assign(getSDefaultStyle(), config.style),
116
- icon: icon,
117
- closeIcon: closeIcon,
118
- description: /*#__PURE__*/React.createElement("div", {
119
- className: "ald-notification-content"
120
- }, /*#__PURE__*/React.createElement("div", {
121
- className: 'ald-notification-desc'
122
- }, description), footer && /*#__PURE__*/React.createElement("div", {
123
- className: 'ald-notification-footer'
124
- }, footer))
125
- }));
153
+ _config$placement4 = config.placement,
154
+ placement = _config$placement4 === void 0 ? 'topRight' : _config$placement4,
155
+ className = config.className,
156
+ duration = config.duration,
157
+ restConfig = _objectWithoutProperties(config, _excluded4);
158
+ return toast.info( /*#__PURE__*/React.createElement("div", {
159
+ className: "ald-notification-content"
160
+ }, /*#__PURE__*/React.createElement("div", {
161
+ className: "ald-notification-message"
162
+ }, message), description && /*#__PURE__*/React.createElement("div", {
163
+ className: 'ald-notification-desc'
164
+ }, description)), _objectSpread(_objectSpread({
165
+ icon: function icon() {
166
+ return iconMap.info;
167
+ }
168
+ }, defaultOptions), {}, {
169
+ autoClose: duration ? duration * 1000 : 3000,
170
+ position: getPosition(placement),
171
+ className: classNames('ald-notification', className)
172
+ }, restConfig));
126
173
  },
127
- info: function info(config) {
128
- var _config$icon4 = config.icon,
129
- icon = _config$icon4 === void 0 ? iconMap.info : _config$icon4,
130
- _config$closeIcon4 = config.closeIcon,
131
- closeIcon = _config$closeIcon4 === void 0 ? closeX : _config$closeIcon4,
174
+ warning: function warning(config) {
175
+ var message = config.message,
132
176
  description = config.description,
133
- footer = config.footer,
134
- rest = _objectWithoutProperties(config, _excluded4);
135
- return AntdNotification.info(_objectSpread(_objectSpread({}, rest), {}, {
136
- className: classnames('ald-notification-notice', config.className),
137
- style: Object.assign(getSDefaultStyle(), config.style),
138
- icon: icon,
139
- closeIcon: closeIcon,
140
- description: /*#__PURE__*/React.createElement("div", {
141
- className: "ald-notification-content"
142
- }, /*#__PURE__*/React.createElement("div", {
143
- className: 'ald-notification-desc'
144
- }, description), footer && /*#__PURE__*/React.createElement("div", {
145
- className: 'ald-notification-footer'
146
- }, footer))
147
- }));
177
+ _config$placement5 = config.placement,
178
+ placement = _config$placement5 === void 0 ? 'topRight' : _config$placement5,
179
+ className = config.className,
180
+ duration = config.duration,
181
+ restConfig = _objectWithoutProperties(config, _excluded5);
182
+ return toast.warn( /*#__PURE__*/React.createElement("div", {
183
+ className: "ald-notification-content"
184
+ }, /*#__PURE__*/React.createElement("div", {
185
+ className: "ald-notification-message"
186
+ }, message), description && /*#__PURE__*/React.createElement("div", {
187
+ className: 'ald-notification-desc'
188
+ }, description)), _objectSpread(_objectSpread({
189
+ icon: function icon() {
190
+ return iconMap.warning;
191
+ }
192
+ }, defaultOptions), {}, {
193
+ autoClose: duration ? duration * 1000 : 3000,
194
+ position: getPosition(placement),
195
+ className: classNames('ald-notification', className)
196
+ }, restConfig));
197
+ },
198
+ close: function close(id) {
199
+ toast.dismiss(id);
148
200
  },
149
- destroy: function destroy(key) {
150
- return AntdNotification.destroy(key);
201
+ closeAll: function closeAll() {
202
+ toast.dismiss();
151
203
  }
152
204
  };
153
205
  export default notification;
@@ -1,73 +1,54 @@
1
- @import '../../style/index.less';
2
-
3
- .ald-notification-notice.ant-notification-notice {
4
- .ant-notification-notice-icon {
5
- top: 24px;
6
- }
7
-
8
- .ant-notification-notice-message {
9
- margin-inline-start: 28px;
10
- padding-inline-end: 28px;
11
- margin-bottom: 8px !important;
12
- margin-left: 56px !important;
13
- color: var(--alias-colors-text-strong, #111827);
14
- font-size: 18px;
15
- font-weight: 600;
16
- line-height: 28px; /* 155.556% */
1
+ @import '../../style/components/toastify.less';
2
+ @import '../../style/themes/default/themeColor.module.less';
3
+ /* stylelint-disable selector-class-pattern, keyframes-name-pattern */
4
+ .ald-notification {
5
+ width: 360px;
6
+ padding: 16px;
7
+ background: var(--alias-colors-bg-skeleton-subtler, #fff);
8
+ border-radius: var(--alias-radius-75, 6px);
9
+ border: 1px solid var(--alias-colors-border-strong, #d1d5db);
10
+
11
+ /* shadow/shadow-xl */
12
+ box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.05),
13
+ 0 8px 10px -6px rgba(0, 0, 0, 0.05);
14
+
15
+ & > svg {
16
+ flex-shrink: 0;
17
17
  }
18
18
 
19
- .ant-notification-notice-description {
20
- margin-inline-start: 28px;
21
- padding-inline-end: 28px;
22
- margin-bottom: 8px !important;
23
- margin-left: 56px !important;
24
- display: flex;
25
- flex-direction: column;
26
- gap: 16px;
19
+ .Toastify__toast-body {
20
+ .Toastify__toast-icon {
21
+ align-self: flex-start;
22
+ margin-right: 12px;
27
23
 
28
- .ald-notification-desc {
29
- color: var(--alias-colors-text-subtle, #4b5563);
30
- font-size: 14px;
31
- font-weight: 400;
32
- line-height: 20px; /* 142.857% */
24
+ .ald-notification-notice-icon {
25
+ display: flex;
26
+ height: 28px;
27
+ align-items: center;
28
+ }
33
29
  }
34
- }
35
30
 
36
- .ant-notification-notice-close {
37
- top: 24px;
38
- right: 24px;
39
- width: fit-content;
40
- height: fit-content;
41
-
42
- &:hover {
43
- background: none;
31
+ .ald-notification-content {
32
+ display: flex;
33
+ flex-direction: column;
34
+ gap: 4px;
35
+
36
+ .ald-notification-message {
37
+ color: var(--alias-colors-text-default, #1f2937);
38
+ text-align: justify;
39
+ font-size: 18px;
40
+ font-style: normal;
41
+ font-weight: 500;
42
+ line-height: 28px;
43
+ }
44
+
45
+ .ald-notification-description {
46
+ color: var(--alias-colors-text-subtle, #4b5563);
47
+ font-size: 14px;
48
+ font-style: normal;
49
+ font-weight: 400;
50
+ line-height: 20px;
51
+ }
44
52
  }
45
53
  }
46
54
  }
47
-
48
- .ald-notification-notice-icon-success,
49
- .ald-notification-notice-icon-error,
50
- .ald-notification-notice-icon-warning,
51
- .ald-notification-notice-icon-info {
52
- display: grid;
53
- place-items: center;
54
- width: 40px;
55
- height: 40px;
56
- border-radius: 20px;
57
- }
58
-
59
- .ald-notification-notice-icon-success {
60
- background: var(--alias-colors-bg-accent-green-subtle-default, #dcfce7);
61
- }
62
-
63
- .ald-notification-notice-icon-error {
64
- background: var(--alias-colors-bg-accent-red-subtle-default, #fee2e2);
65
- }
66
-
67
- .ald-notification-notice-icon-warning {
68
- background: var(--alias-colors-bg-accent-yellow-subtle-default, #fef9c3);
69
- }
70
-
71
- .ald-notification-notice-icon-info {
72
- background: var(--alias-colors-bg-accent-blue-subtle-default, #d4e7fd);
73
- }