@snack-uikit/toaster 0.6.24 → 0.6.25

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.25 (2024-09-23)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **PDS-480:** remove direct usage of browser api elements ([1231ff7](https://github.com/cloud-ru-tech/snack-uikit/commit/1231ff7ab7a1b210b579a7b694633ef23bffcf44))
12
+
13
+
14
+
15
+
16
+
6
17
  ## 0.6.24 (2024-09-06)
7
18
 
8
19
  ### Only dependencies have been changed
@@ -113,7 +113,7 @@
113
113
  animation-play-state:paused;
114
114
  }
115
115
  .container[data-appearance=neutral]{
116
- background-color:var(--sys-invert-neutral-background, #2a2a35);
116
+ background-color:var(--sys-invert-neutral-background, #30303c);
117
117
  }
118
118
  .container[data-appearance=neutral] .icon{
119
119
  color:var(--sys-invert-neutral-accent-default, #cfd2dc);
@@ -128,7 +128,7 @@
128
128
  background-color:var(--sys-neutral-accent-default, #787b8a);
129
129
  }
130
130
  .container[data-appearance=error]{
131
- background-color:var(--sys-invert-neutral-background, #2a2a35);
131
+ background-color:var(--sys-invert-neutral-background, #30303c);
132
132
  }
133
133
  .container[data-appearance=error] .icon{
134
134
  color:var(--sys-red-accent-default, #cb3f3e);
@@ -168,7 +168,7 @@
168
168
  opacity:var(--opacity-a048, 0.48);
169
169
  }
170
170
  .container[data-appearance=warning]{
171
- background-color:var(--sys-invert-neutral-background, #2a2a35);
171
+ background-color:var(--sys-invert-neutral-background, #30303c);
172
172
  }
173
173
  .container[data-appearance=warning] .icon{
174
174
  color:var(--sys-yellow-accent-default, #e2b134);
@@ -183,7 +183,7 @@
183
183
  background-color:var(--sys-yellow-accent-default, #e2b134);
184
184
  }
185
185
  .container[data-appearance=success]{
186
- background-color:var(--sys-invert-neutral-background, #2a2a35);
186
+ background-color:var(--sys-invert-neutral-background, #30303c);
187
187
  }
188
188
  .container[data-appearance=success] .icon{
189
189
  color:var(--sys-green-accent-default, #57b762);
@@ -27,7 +27,7 @@
27
27
  align-items:center;
28
28
  justify-content:center;
29
29
  box-sizing:border-box;
30
- background-color:var(--sys-invert-neutral-background, #2a2a35);
30
+ background-color:var(--sys-invert-neutral-background, #30303c);
31
31
  }
32
32
  .container[data-appearance=error] .icon{
33
33
  color:var(--sys-red-accent-default, #cb3f3e);
@@ -19,7 +19,7 @@
19
19
  box-sizing:border-box;
20
20
  width:100%;
21
21
  color:var(--sys-invert-neutral-text-main, #e6e8ef);
22
- background-color:var(--sys-invert-neutral-background, #2a2a35);
22
+ background-color:var(--sys-invert-neutral-background, #30303c);
23
23
  border:none;
24
24
  outline:none;
25
25
  }
@@ -31,7 +31,7 @@
31
31
  outline-style:var(--border-state-focus-s-border-style, solid);
32
32
  outline-color:var(--border-state-focus-s-border-color, );
33
33
  background-color:var(--sys-invert-neutral-decor-hovered, #656774);
34
- outline-color:var(--sys-available-complementary, #15151b);
34
+ outline-color:var(--sys-available-complementary, #1c1c24);
35
35
  outline-offset:var(--spacing-state-focus-offset, 2px);
36
36
  }
37
37
  .buttonCloseColumn:active{
package/dist/helpers.js CHANGED
@@ -2,14 +2,15 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  // eslint-disable-next-line react/no-deprecated
3
3
  import { render } from 'react-dom';
4
4
  import { toast } from 'react-toastify';
5
+ import { isBrowser } from '@snack-uikit/utils';
5
6
  import { ToasterContainer, ToastSystemEvent, ToastUserAction, } from './components';
6
7
  import { AUTO_CLOSE_TIME, TOASTER_CONTAINER_DEFAULT_PROPS, TOASTER_CONTAINER_PREFIX, TOASTER_ROOT_ID, TOASTER_TYPE, } from './constants';
7
8
  function getToasterContainer({ type, toasterParent, containerProps, }) {
8
9
  const containerId = (containerProps === null || containerProps === void 0 ? void 0 : containerProps.containerId) || `${TOASTER_CONTAINER_PREFIX}${type}`;
9
10
  const toasterContainerProps = Object.assign(Object.assign(Object.assign({}, TOASTER_CONTAINER_DEFAULT_PROPS[type]), (containerProps || {})), { containerId });
10
11
  const toasterRootId = `${TOASTER_ROOT_ID}__${type}`;
11
- let rootInDOM = toasterParent.querySelector(`#${toasterRootId}`);
12
- if (!rootInDOM) {
12
+ let rootInDOM = toasterParent ? toasterParent.querySelector(`#${toasterRootId}`) : null;
13
+ if (!rootInDOM && toasterParent && isBrowser()) {
13
14
  rootInDOM = document.createElement('div');
14
15
  rootInDOM.id = toasterRootId;
15
16
  toasterParent.appendChild(rootInDOM);
@@ -40,7 +41,7 @@ function getToastComponent({ type, toasterProps, }) {
40
41
  return undefined;
41
42
  }
42
43
  }
43
- export const openToast = ({ type, toasterProps, containerProps, toastOptions, toasterParent = document.body, }) => {
44
+ export const openToast = ({ type, toasterProps, containerProps, toastOptions, toasterParent = isBrowser() ? document.body : undefined, }) => {
44
45
  const { toasterContainer, toasterContainerProps } = getToasterContainer({
45
46
  type,
46
47
  toasterParent,
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "access": "public"
5
5
  },
6
6
  "title": "Toaster",
7
- "version": "0.6.24",
7
+ "version": "0.6.25",
8
8
  "sideEffects": [
9
9
  "*.css",
10
10
  "*.woff",
@@ -32,13 +32,13 @@
32
32
  "license": "Apache-2.0",
33
33
  "scripts": {},
34
34
  "dependencies": {
35
- "@snack-uikit/icons": "0.22.0",
36
- "@snack-uikit/link": "0.13.1",
37
- "@snack-uikit/loaders": "0.5.2",
38
- "@snack-uikit/truncate-string": "0.4.21",
39
- "@snack-uikit/utils": "3.3.0",
35
+ "@snack-uikit/icons": "0.22.1",
36
+ "@snack-uikit/link": "0.13.2",
37
+ "@snack-uikit/loaders": "0.5.3",
38
+ "@snack-uikit/truncate-string": "0.4.22",
39
+ "@snack-uikit/utils": "3.4.0",
40
40
  "classnames": "2.3.2",
41
41
  "react-toastify": "10.0.5"
42
42
  },
43
- "gitHead": "f238fd8b9d363de790ebcfd189aa17cbe101f3eb"
43
+ "gitHead": "f9212fe04b0dbba9bedea1bb3a034ab612287841"
44
44
  }
package/src/helpers.tsx CHANGED
@@ -2,6 +2,8 @@
2
2
  import { render } from 'react-dom';
3
3
  import { Id, toast, ToastOptions as RtToastOptions } from 'react-toastify';
4
4
 
5
+ import { isBrowser } from '@snack-uikit/utils';
6
+
5
7
  import {
6
8
  ToasterContainer,
7
9
  ToasterContainerProps,
@@ -35,7 +37,7 @@ function getToasterContainer({
35
37
  containerProps,
36
38
  }: {
37
39
  type: ToasterType;
38
- toasterParent: HTMLElement;
40
+ toasterParent?: HTMLElement;
39
41
  containerProps?: ToasterContainerProps;
40
42
  }) {
41
43
  const containerId = containerProps?.containerId || `${TOASTER_CONTAINER_PREFIX}${type}`;
@@ -48,9 +50,9 @@ function getToasterContainer({
48
50
 
49
51
  const toasterRootId = `${TOASTER_ROOT_ID}__${type}`;
50
52
 
51
- let rootInDOM = toasterParent.querySelector(`#${toasterRootId}`);
53
+ let rootInDOM = toasterParent ? toasterParent.querySelector(`#${toasterRootId}`) : null;
52
54
 
53
- if (!rootInDOM) {
55
+ if (!rootInDOM && toasterParent && isBrowser()) {
54
56
  rootInDOM = document.createElement('div');
55
57
  rootInDOM.id = toasterRootId;
56
58
  toasterParent.appendChild(rootInDOM);
@@ -105,7 +107,7 @@ export const openToast: OpenToast = ({
105
107
  toasterProps,
106
108
  containerProps,
107
109
  toastOptions,
108
- toasterParent = document.body,
110
+ toasterParent = isBrowser() ? document.body : undefined,
109
111
  }) => {
110
112
  const { toasterContainer, toasterContainerProps } = getToasterContainer({
111
113
  type,