@aloudata/aloudata-design 2.10.1 → 2.10.3

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.
@@ -4,9 +4,9 @@ interface MessageOptions extends ToastOptions {
4
4
  className?: string;
5
5
  }
6
6
  declare const message: {
7
- success: (message?: string, options?: MessageOptions) => import("react-toastify").Id;
8
- error: (message?: string, options?: MessageOptions) => import("react-toastify").Id;
9
- info: (message?: string, options?: MessageOptions) => import("react-toastify").Id;
7
+ success: (message?: string, options?: MessageOptions) => void;
8
+ error: (message?: string, options?: MessageOptions) => void;
9
+ info: (message?: string, options?: MessageOptions) => void;
10
10
  };
11
11
  export type { MessageOptions };
12
12
  export default message;
@@ -52,27 +52,37 @@ var getMessage = function getMessage(message, type) {
52
52
  className: "ald-message-text"
53
53
  }, message, " ", closeX));
54
54
  };
55
+ var toastId;
55
56
  var message = {
56
57
  success: function success(message) {
57
58
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
58
59
  toast.dismiss();
59
- return toast.success(getMessage(message !== null && message !== void 0 ? message : '', 'success'), _objectSpread(_objectSpread(_objectSpread({}, defaultOptions), options), {}, {
60
- className: classNames('ald-message ald-message-success', options.className)
61
- }));
60
+ clearTimeout(toastId);
61
+ toastId = setTimeout(function () {
62
+ toast.success(getMessage(message !== null && message !== void 0 ? message : '', 'success'), _objectSpread(_objectSpread(_objectSpread({}, defaultOptions), options), {}, {
63
+ className: classNames('ald-message ald-message-success', options.className)
64
+ }));
65
+ }, 200);
62
66
  },
63
67
  error: function error(message) {
64
68
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
65
69
  toast.dismiss();
66
- return toast.error(getMessage(message !== null && message !== void 0 ? message : '', 'error'), _objectSpread(_objectSpread(_objectSpread({}, defaultOptions), options), {}, {
67
- className: classNames('ald-message ald-message-error', options.className)
68
- }));
70
+ clearTimeout(toastId);
71
+ toastId = setTimeout(function () {
72
+ toast.error(getMessage(message !== null && message !== void 0 ? message : '', 'error'), _objectSpread(_objectSpread(_objectSpread({}, defaultOptions), options), {}, {
73
+ className: classNames('ald-message ald-message-error', options.className)
74
+ }));
75
+ }, 200);
69
76
  },
70
77
  info: function info(message) {
71
78
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
72
79
  toast.dismiss();
73
- return toast.info(getMessage(message !== null && message !== void 0 ? message : '', 'info'), _objectSpread(_objectSpread(_objectSpread({}, defaultOptions), options), {}, {
74
- className: classNames('ald-message ald-message-info', options.className)
75
- }));
80
+ clearTimeout(toastId);
81
+ toastId = setTimeout(function () {
82
+ toast.info(getMessage(message !== null && message !== void 0 ? message : '', 'info'), _objectSpread(_objectSpread(_objectSpread({}, defaultOptions), options), {}, {
83
+ className: classNames('ald-message ald-message-info', options.className)
84
+ }));
85
+ }, 200);
76
86
  }
77
87
  };
78
88
  export default message;
@@ -1,4 +1,4 @@
1
- @import '../../style/components/toastify.less';
1
+ @import '../../style/components/toastify.css';
2
2
  @import '../../Divider/style/index.less';
3
3
  /* stylelint-disable selector-class-pattern, keyframes-name-pattern */
4
4
  .ald-message {
@@ -10,11 +10,11 @@ interface IAldArgsProps extends NotificationOptions {
10
10
  style?: React.CSSProperties;
11
11
  }
12
12
  declare const notification: {
13
- open: (config: IAldArgsProps) => import("react-toastify").Id;
14
- success: (config: IAldArgsProps) => import("react-toastify").Id;
15
- error: (config: IAldArgsProps) => import("react-toastify").Id;
16
- info: (config: IAldArgsProps) => import("react-toastify").Id;
17
- warning: (config: IAldArgsProps) => import("react-toastify").Id;
13
+ open: (config: IAldArgsProps) => void;
14
+ success: (config: IAldArgsProps) => void;
15
+ error: (config: IAldArgsProps) => void;
16
+ info: (config: IAldArgsProps) => void;
17
+ warning: (config: IAldArgsProps) => void;
18
18
  close: (id: number) => void;
19
19
  closeAll: () => void;
20
20
  };
@@ -76,6 +76,7 @@ function getPosition(placement) {
76
76
  return placement;
77
77
  }
78
78
  }
79
+ var toastId;
79
80
  var notification = {
80
81
  open: function open(config) {
81
82
  var message = config.message,
@@ -85,19 +86,22 @@ var notification = {
85
86
  className = config.className,
86
87
  duration = config.duration,
87
88
  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));
89
+ clearTimeout(toastId);
90
+ toastId = setTimeout(function () {
91
+ toast( /*#__PURE__*/React.createElement("div", {
92
+ className: "ald-notification-content"
93
+ }, /*#__PURE__*/React.createElement("div", {
94
+ className: "ald-notification-message"
95
+ }, message), description && /*#__PURE__*/React.createElement("div", {
96
+ className: 'ald-notification-desc'
97
+ }, description)), _objectSpread(_objectSpread({
98
+ icon: false
99
+ }, defaultOptions), {}, {
100
+ autoClose: duration ? duration * 1000 : 3000,
101
+ position: getPosition(placement),
102
+ className: classNames('ald-notification', className)
103
+ }, restConfig));
104
+ }, 200);
101
105
  },
102
106
  success: function success(config) {
103
107
  var message = config.message,
@@ -107,21 +111,24 @@ var notification = {
107
111
  className = config.className,
108
112
  duration = config.duration,
109
113
  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));
114
+ clearTimeout(toastId);
115
+ toastId = setTimeout(function () {
116
+ toast.success( /*#__PURE__*/React.createElement("div", {
117
+ className: "ald-notification-content"
118
+ }, /*#__PURE__*/React.createElement("div", {
119
+ className: "ald-notification-message"
120
+ }, message), description && /*#__PURE__*/React.createElement("div", {
121
+ className: 'ald-notification-desc'
122
+ }, description)), _objectSpread(_objectSpread({
123
+ icon: function icon() {
124
+ return iconMap.success;
125
+ }
126
+ }, defaultOptions), {}, {
127
+ autoClose: duration ? duration * 1000 : 3000,
128
+ position: getPosition(placement),
129
+ className: classNames('ald-notification', className)
130
+ }, restConfig));
131
+ }, 200);
125
132
  },
126
133
  error: function error(config) {
127
134
  var message = config.message,
@@ -131,21 +138,24 @@ var notification = {
131
138
  className = config.className,
132
139
  duration = config.duration,
133
140
  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));
141
+ clearTimeout(toastId);
142
+ toastId = setTimeout(function () {
143
+ toast.error( /*#__PURE__*/React.createElement("div", {
144
+ className: "ald-notification-content"
145
+ }, /*#__PURE__*/React.createElement("div", {
146
+ className: "ald-notification-message"
147
+ }, message), description && /*#__PURE__*/React.createElement("div", {
148
+ className: 'ald-notification-desc'
149
+ }, description)), _objectSpread(_objectSpread({
150
+ icon: function icon() {
151
+ return iconMap.error;
152
+ }
153
+ }, defaultOptions), {}, {
154
+ autoClose: duration ? duration * 1000 : 3000,
155
+ position: getPosition(placement),
156
+ className: classNames('ald-notification', className)
157
+ }, restConfig));
158
+ }, 200);
149
159
  },
150
160
  info: function info(config) {
151
161
  var message = config.message,
@@ -155,21 +165,24 @@ var notification = {
155
165
  className = config.className,
156
166
  duration = config.duration,
157
167
  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));
168
+ clearTimeout(toastId);
169
+ toastId = setTimeout(function () {
170
+ toast.info( /*#__PURE__*/React.createElement("div", {
171
+ className: "ald-notification-content"
172
+ }, /*#__PURE__*/React.createElement("div", {
173
+ className: "ald-notification-message"
174
+ }, message), description && /*#__PURE__*/React.createElement("div", {
175
+ className: 'ald-notification-desc'
176
+ }, description)), _objectSpread(_objectSpread({
177
+ icon: function icon() {
178
+ return iconMap.info;
179
+ }
180
+ }, defaultOptions), {}, {
181
+ autoClose: duration ? duration * 1000 : 3000,
182
+ position: getPosition(placement),
183
+ className: classNames('ald-notification', className)
184
+ }, restConfig));
185
+ }, 200);
173
186
  },
174
187
  warning: function warning(config) {
175
188
  var message = config.message,
@@ -179,21 +192,24 @@ var notification = {
179
192
  className = config.className,
180
193
  duration = config.duration,
181
194
  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));
195
+ clearTimeout(toastId);
196
+ toastId = setTimeout(function () {
197
+ toast.warn( /*#__PURE__*/React.createElement("div", {
198
+ className: "ald-notification-content"
199
+ }, /*#__PURE__*/React.createElement("div", {
200
+ className: "ald-notification-message"
201
+ }, message), description && /*#__PURE__*/React.createElement("div", {
202
+ className: 'ald-notification-desc'
203
+ }, description)), _objectSpread(_objectSpread({
204
+ icon: function icon() {
205
+ return iconMap.warning;
206
+ }
207
+ }, defaultOptions), {}, {
208
+ autoClose: duration ? duration * 1000 : 3000,
209
+ position: getPosition(placement),
210
+ className: classNames('ald-notification', className)
211
+ }, restConfig));
212
+ }, 200);
197
213
  },
198
214
  close: function close(id) {
199
215
  toast.dismiss(id);
@@ -1,4 +1,4 @@
1
- @import '../../style/components/toastify.less';
1
+ @import '../../style/components/toastify.css';
2
2
  @import '../../style/themes/default/themeColor.module.less';
3
3
  /* stylelint-disable selector-class-pattern, keyframes-name-pattern */
4
4
  .ald-notification {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aloudata/aloudata-design",
3
- "version": "2.10.1",
3
+ "version": "2.10.3",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "module": "dist/index.js",