@snack-uikit/toaster 0.6.11 → 0.6.13-preview-c70fa919.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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
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.6.12 (2024-04-25)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **PDS-0000:** set default button type as button ([4ec64de](https://github.com/cloud-ru-tech/snack-uikit/commit/4ec64de508826df4a1e82fd8c75448d9919e563f))
12
+
13
+
14
+
15
+
16
+
6
17
  ## 0.6.11 (2024-04-23)
7
18
 
8
19
  ### Only dependencies have been changed
@@ -29,5 +29,5 @@ export function ToastSystemEvent(_a) {
29
29
  onCloseClick ? onCloseClick(e, closeToast) : closeToast === null || closeToast === void 0 ? void 0 : closeToast();
30
30
  };
31
31
  const icon = useMemo(() => getIcon(appearance), [appearance]);
32
- return (_jsxs("div", Object.assign({ className: cn(styles.container, className) }, extractSupportProps(rest), { "data-appearance": appearance, children: [_jsxs("div", { className: styles.body, children: [_jsx("div", { className: styles.icon, children: icon }), _jsxs("div", { className: styles.contentLayout, children: [_jsxs("div", { children: [_jsx("span", { className: styles.title, children: _jsx(TruncateString, { text: title, maxLines: 2, hideTooltip: true, "data-test-id": TOAST_SYSTEM_EVENT_TEST_IDS.title }) }), description && (_jsx("span", { className: styles.description, children: _jsx(TruncateString, { maxLines: 4, text: description, hideTooltip: true, "data-test-id": TOAST_SYSTEM_EVENT_TEST_IDS.description }) }))] }), link && (_jsx(Link, { text: link.text, href: link.href, size: 'm', onClick: link.onClick, appearance: APPEARANCE_TO_ON_COLOR_MAP[appearance], "data-test-id": TOAST_SYSTEM_EVENT_TEST_IDS.link, textMode: appearance === 'errorCritical' ? 'on-accent' : 'accent' }))] }), closable && (_jsx("button", { className: styles.buttonClose, onClick: handleCloseClick, "data-test-id": TOAST_SYSTEM_EVENT_TEST_IDS.buttonClose, "aria-label": 'close notification', children: _jsx(CrossSVG, {}) }))] }), progressBar && (_jsx("div", { role: 'progressbar', "aria-label": 'progressbar', "data-test-id": TOAST_SYSTEM_EVENT_TEST_IDS.progressbar, className: styles.progress, style: { animationDuration: `${AUTO_CLOSE_TIME[TOASTER_TYPE.SystemEvent]}ms` } })), Array.isArray(action) && action.length > 0 && (_jsx("div", { className: styles.footer, children: action.map(buttonProps => (_jsx(ButtonAction, Object.assign({}, buttonProps, { critical: appearance === 'errorCritical' }), buttonProps.label))) }))] })));
32
+ return (_jsxs("div", Object.assign({ className: cn(styles.container, className) }, extractSupportProps(rest), { "data-appearance": appearance, children: [_jsxs("div", { className: styles.body, children: [_jsx("div", { className: styles.icon, children: icon }), _jsxs("div", { className: styles.contentLayout, children: [_jsxs("div", { children: [_jsx("span", { className: styles.title, children: _jsx(TruncateString, { text: title, maxLines: 2, hideTooltip: true, "data-test-id": TOAST_SYSTEM_EVENT_TEST_IDS.title }) }), description && (_jsx("span", { className: styles.description, children: _jsx(TruncateString, { maxLines: 4, text: description, hideTooltip: true, "data-test-id": TOAST_SYSTEM_EVENT_TEST_IDS.description }) }))] }), link && (_jsx(Link, { text: link.text, href: link.href, size: 'm', onClick: link.onClick, appearance: APPEARANCE_TO_ON_COLOR_MAP[appearance], "data-test-id": TOAST_SYSTEM_EVENT_TEST_IDS.link, textMode: appearance === 'errorCritical' ? 'on-accent' : 'accent' }))] }), closable && (_jsx("button", { type: 'button', className: styles.buttonClose, onClick: handleCloseClick, "data-test-id": TOAST_SYSTEM_EVENT_TEST_IDS.buttonClose, "aria-label": 'close notification', children: _jsx(CrossSVG, {}) }))] }), progressBar && (_jsx("div", { role: 'progressbar', "aria-label": 'progressbar', "data-test-id": TOAST_SYSTEM_EVENT_TEST_IDS.progressbar, className: styles.progress, style: { animationDuration: `${AUTO_CLOSE_TIME[TOASTER_TYPE.SystemEvent]}ms` } })), Array.isArray(action) && action.length > 0 && (_jsx("div", { className: styles.footer, children: action.map(buttonProps => (_jsx(ButtonAction, Object.assign({}, buttonProps, { critical: appearance === 'errorCritical' }), buttonProps.label))) }))] })));
33
33
  }
@@ -32,5 +32,5 @@ export function ToasterContainer({ position = 'bottom-right', limit = 5, contain
32
32
  [styles.containerWithCloseAllButton]: hasCloseAllButton,
33
33
  'osThemeSnack__toast-container__system-event': type === TOASTER_TYPE.SystemEvent,
34
34
  'osThemeSnack__toast-container__user-action': type === TOASTER_TYPE.UserAction,
35
- }), toastClassName: styles.toaster, bodyClassName: styles.toaster, position: position, limit: limit, containerId: containerId }), hasCloseAllButton && (_jsx("div", { className: cn(styles.buttonCloseColumnWrapper, styles[position]), children: _jsx("button", { className: styles.buttonCloseColumn, onClick: closeAll, "data-test-id": TOAST_SYSTEM_EVENT_TEST_IDS.buttonCloseColumn, children: "\u0417\u0430\u043A\u0440\u044B\u0442\u044C \u0432\u0441\u0435" }) }))] }));
35
+ }), toastClassName: styles.toaster, bodyClassName: styles.toaster, position: position, limit: limit, containerId: containerId }), hasCloseAllButton && (_jsx("div", { className: cn(styles.buttonCloseColumnWrapper, styles[position]), children: _jsx("button", { type: 'button', className: styles.buttonCloseColumn, onClick: closeAll, "data-test-id": TOAST_SYSTEM_EVENT_TEST_IDS.buttonCloseColumn, children: "\u0417\u0430\u043A\u0440\u044B\u0442\u044C \u0432\u0441\u0435" }) }))] }));
36
36
  }
@@ -2,5 +2,5 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { TOAST_SYSTEM_EVENT_TEST_IDS } from '../../testIds';
3
3
  import styles from './styles.module.css';
4
4
  export function ButtonAction({ label, onClick, critical }) {
5
- return (_jsx("button", { className: styles.buttonAction, onClick: onClick, "data-test-id": TOAST_SYSTEM_EVENT_TEST_IDS.buttonAction, "aria-label": 'action', "data-critical": critical || undefined, children: label }));
5
+ return (_jsx("button", { type: 'button', className: styles.buttonAction, onClick: onClick, "data-test-id": TOAST_SYSTEM_EVENT_TEST_IDS.buttonAction, "aria-label": 'action', "data-critical": critical || undefined, children: label }));
6
6
  }
package/dist/helpers.js CHANGED
@@ -79,24 +79,36 @@ const userAction = {
79
79
  return openToast({
80
80
  type: TOASTER_TYPE.UserAction,
81
81
  toasterProps: Object.assign(Object.assign({}, options), { appearance: 'success' }),
82
+ toastOptions: {
83
+ id: options.id,
84
+ },
82
85
  });
83
86
  },
84
87
  neutral(options) {
85
88
  return openToast({
86
89
  type: TOASTER_TYPE.UserAction,
87
90
  toasterProps: Object.assign(Object.assign({}, options), { appearance: 'neutral' }),
91
+ toastOptions: {
92
+ id: options.id,
93
+ },
88
94
  });
89
95
  },
90
96
  error(options) {
91
97
  return openToast({
92
98
  type: TOASTER_TYPE.UserAction,
93
99
  toasterProps: Object.assign(Object.assign({}, options), { appearance: 'error' }),
100
+ toastOptions: {
101
+ id: options.id,
102
+ },
94
103
  });
95
104
  },
96
105
  warning(options) {
97
106
  return openToast({
98
107
  type: TOASTER_TYPE.UserAction,
99
108
  toasterProps: Object.assign(Object.assign({}, options), { appearance: 'warning' }),
109
+ toastOptions: {
110
+ id: options.id,
111
+ },
100
112
  });
101
113
  },
102
114
  update: {
@@ -134,30 +146,45 @@ const systemEvent = {
134
146
  return openToast({
135
147
  type: TOASTER_TYPE.SystemEvent,
136
148
  toasterProps: Object.assign(Object.assign({}, options), { appearance: 'success' }),
149
+ toastOptions: {
150
+ id: options.id,
151
+ },
137
152
  });
138
153
  },
139
154
  neutral(options) {
140
155
  return openToast({
141
156
  type: TOASTER_TYPE.SystemEvent,
142
157
  toasterProps: Object.assign(Object.assign({}, options), { appearance: 'neutral' }),
158
+ toastOptions: {
159
+ id: options.id,
160
+ },
143
161
  });
144
162
  },
145
163
  warning(options) {
146
164
  return openToast({
147
165
  type: TOASTER_TYPE.SystemEvent,
148
166
  toasterProps: Object.assign(Object.assign({}, options), { appearance: 'warning' }),
167
+ toastOptions: {
168
+ id: options.id,
169
+ },
149
170
  });
150
171
  },
151
172
  error(options) {
152
173
  return openToast({
153
174
  type: TOASTER_TYPE.SystemEvent,
154
175
  toasterProps: Object.assign(Object.assign({}, options), { appearance: 'error' }),
176
+ toastOptions: {
177
+ id: options.id,
178
+ },
155
179
  });
156
180
  },
157
181
  errorCritical(options) {
158
182
  return openToast({
159
183
  type: TOASTER_TYPE.SystemEvent,
160
184
  toasterProps: Object.assign(Object.assign({}, options), { appearance: 'errorCritical' }),
185
+ toastOptions: {
186
+ id: options.id,
187
+ },
161
188
  });
162
189
  },
163
190
  update: {
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "access": "public"
5
5
  },
6
6
  "title": "Toaster",
7
- "version": "0.6.11",
7
+ "version": "0.6.13-preview-c70fa919.0",
8
8
  "sideEffects": [
9
9
  "*.css",
10
10
  "*.woff",
@@ -40,5 +40,5 @@
40
40
  "classnames": "2.3.2",
41
41
  "react-toastify": "10.0.5"
42
42
  },
43
- "gitHead": "bf1e1f3cfabccc1ee288c18722e33009bd001798"
43
+ "gitHead": "4f5eb16add84bb2a55e90afad89553b8e54b7255"
44
44
  }
@@ -95,6 +95,7 @@ export function ToastSystemEvent({
95
95
 
96
96
  {closable && (
97
97
  <button
98
+ type='button'
98
99
  className={styles.buttonClose}
99
100
  onClick={handleCloseClick}
100
101
  data-test-id={TOAST_SYSTEM_EVENT_TEST_IDS.buttonClose}
@@ -78,6 +78,7 @@ export function ToasterContainer({
78
78
  {hasCloseAllButton && (
79
79
  <div className={cn(styles.buttonCloseColumnWrapper, styles[position])}>
80
80
  <button
81
+ type='button'
81
82
  className={styles.buttonCloseColumn}
82
83
  onClick={closeAll}
83
84
  data-test-id={TOAST_SYSTEM_EVENT_TEST_IDS.buttonCloseColumn}
@@ -12,6 +12,7 @@ export type ButtonActionProps = {
12
12
  export function ButtonAction({ label, onClick, critical }: ButtonActionProps) {
13
13
  return (
14
14
  <button
15
+ type='button'
15
16
  className={styles.buttonAction}
16
17
  onClick={onClick}
17
18
  data-test-id={TOAST_SYSTEM_EVENT_TEST_IDS.buttonAction}
package/src/helpers.tsx CHANGED
@@ -156,6 +156,9 @@ const userAction = {
156
156
  return openToast({
157
157
  type: TOASTER_TYPE.UserAction,
158
158
  toasterProps: { ...options, appearance: 'success' },
159
+ toastOptions: {
160
+ id: options.id,
161
+ },
159
162
  });
160
163
  },
161
164
 
@@ -163,6 +166,9 @@ const userAction = {
163
166
  return openToast({
164
167
  type: TOASTER_TYPE.UserAction,
165
168
  toasterProps: { ...options, appearance: 'neutral' },
169
+ toastOptions: {
170
+ id: options.id,
171
+ },
166
172
  });
167
173
  },
168
174
 
@@ -170,6 +176,9 @@ const userAction = {
170
176
  return openToast({
171
177
  type: TOASTER_TYPE.UserAction,
172
178
  toasterProps: { ...options, appearance: 'error' },
179
+ toastOptions: {
180
+ id: options.id,
181
+ },
173
182
  });
174
183
  },
175
184
 
@@ -177,6 +186,9 @@ const userAction = {
177
186
  return openToast({
178
187
  type: TOASTER_TYPE.UserAction,
179
188
  toasterProps: { ...options, appearance: 'warning' },
189
+ toastOptions: {
190
+ id: options.id,
191
+ },
180
192
  });
181
193
  },
182
194
 
@@ -220,6 +232,9 @@ const systemEvent = {
220
232
  return openToast({
221
233
  type: TOASTER_TYPE.SystemEvent,
222
234
  toasterProps: { ...options, appearance: 'success' },
235
+ toastOptions: {
236
+ id: options.id,
237
+ },
223
238
  });
224
239
  },
225
240
 
@@ -227,6 +242,9 @@ const systemEvent = {
227
242
  return openToast({
228
243
  type: TOASTER_TYPE.SystemEvent,
229
244
  toasterProps: { ...options, appearance: 'neutral' },
245
+ toastOptions: {
246
+ id: options.id,
247
+ },
230
248
  });
231
249
  },
232
250
 
@@ -234,6 +252,9 @@ const systemEvent = {
234
252
  return openToast({
235
253
  type: TOASTER_TYPE.SystemEvent,
236
254
  toasterProps: { ...options, appearance: 'warning' },
255
+ toastOptions: {
256
+ id: options.id,
257
+ },
237
258
  });
238
259
  },
239
260
 
@@ -241,6 +262,9 @@ const systemEvent = {
241
262
  return openToast({
242
263
  type: TOASTER_TYPE.SystemEvent,
243
264
  toasterProps: { ...options, appearance: 'error' },
265
+ toastOptions: {
266
+ id: options.id,
267
+ },
244
268
  });
245
269
  },
246
270
 
@@ -248,6 +272,9 @@ const systemEvent = {
248
272
  return openToast({
249
273
  type: TOASTER_TYPE.SystemEvent,
250
274
  toasterProps: { ...options, appearance: 'errorCritical' },
275
+ toastOptions: {
276
+ id: options.id,
277
+ },
251
278
  });
252
279
  },
253
280