@xaypay/tui 0.2.4 → 0.2.5

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/dist/index.es.js CHANGED
@@ -4,7 +4,7 @@ import PropTypes from 'prop-types';
4
4
  import classnames from 'classnames';
5
5
  import _ from 'lodash';
6
6
  import styled, { keyframes, css } from 'styled-components';
7
- import ReactDOM from 'react-dom';
7
+ import ReactDOM from 'react-dom/client';
8
8
 
9
9
  // Unique ID creation requires a high quality random # generator. In the browser we therefore
10
10
  // require the crypto API and do not support built-in fallback to lower quality random number
@@ -5272,13 +5272,18 @@ let toastify;
5272
5272
  let path = window.location.href;
5273
5273
  let wWidth = window.innerWidth;
5274
5274
  const removeToast = ref => {
5275
- // eslint-disable-next-line react/no-find-dom-node
5276
- const node = ReactDOM.findDOMNode(ref.current);
5277
- const removeElem = node.parentNode;
5278
- const parent = removeElem.parentNode;
5279
- parent.removeChild(removeElem);
5280
- if (!parent.hasChildNodes()) {
5281
- toastify.removeChild(parent);
5275
+ if (ref.current) {
5276
+ const node = ref.current;
5277
+ const removeElem = node.parentNode;
5278
+ const parent = removeElem.parentNode;
5279
+ if (parent && parent.contains(removeElem)) {
5280
+ parent.removeChild(removeElem);
5281
+ }
5282
+ if (!parent.hasChildNodes()) {
5283
+ if (toastify && toastify.contains(parent)) {
5284
+ toastify.removeChild(parent);
5285
+ }
5286
+ }
5282
5287
  }
5283
5288
  };
5284
5289
  const createToast = ({
@@ -5319,8 +5324,8 @@ const createToast = ({
5319
5324
  toastParentBlock.style.zIndex = 999999999999;
5320
5325
  toastParentBlock.style.flexDirection = position === 'top-left' || position === 'top-right' || position === 'top-center' ? 'column-reverse' : 'column';
5321
5326
  toastParentBlock.setAttribute('id', styles$5[position]);
5322
- toastParentBlock.appendChild(toastBlock);
5323
- toastify.appendChild(toastParentBlock);
5327
+ toastParentBlock && toastParentBlock.appendChild(toastBlock);
5328
+ toastify && toastify.appendChild(toastParentBlock);
5324
5329
  } else {
5325
5330
  document.getElementById(styles$5[position]).appendChild(toastBlock);
5326
5331
  }
package/dist/index.js CHANGED
@@ -7,7 +7,7 @@ var PropTypes = require('prop-types');
7
7
  var classnames = require('classnames');
8
8
  var _ = require('lodash');
9
9
  var styled = require('styled-components');
10
- var ReactDOM = require('react-dom');
10
+ var ReactDOM = require('react-dom/client');
11
11
 
12
12
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
13
13
 
@@ -5303,13 +5303,18 @@ let toastify;
5303
5303
  let path = window.location.href;
5304
5304
  let wWidth = window.innerWidth;
5305
5305
  const removeToast = ref => {
5306
- // eslint-disable-next-line react/no-find-dom-node
5307
- const node = ReactDOM__default["default"].findDOMNode(ref.current);
5308
- const removeElem = node.parentNode;
5309
- const parent = removeElem.parentNode;
5310
- parent.removeChild(removeElem);
5311
- if (!parent.hasChildNodes()) {
5312
- toastify.removeChild(parent);
5306
+ if (ref.current) {
5307
+ const node = ref.current;
5308
+ const removeElem = node.parentNode;
5309
+ const parent = removeElem.parentNode;
5310
+ if (parent && parent.contains(removeElem)) {
5311
+ parent.removeChild(removeElem);
5312
+ }
5313
+ if (!parent.hasChildNodes()) {
5314
+ if (toastify && toastify.contains(parent)) {
5315
+ toastify.removeChild(parent);
5316
+ }
5317
+ }
5313
5318
  }
5314
5319
  };
5315
5320
  const createToast = ({
@@ -5350,8 +5355,8 @@ const createToast = ({
5350
5355
  toastParentBlock.style.zIndex = 999999999999;
5351
5356
  toastParentBlock.style.flexDirection = position === 'top-left' || position === 'top-right' || position === 'top-center' ? 'column-reverse' : 'column';
5352
5357
  toastParentBlock.setAttribute('id', styles$5[position]);
5353
- toastParentBlock.appendChild(toastBlock);
5354
- toastify.appendChild(toastParentBlock);
5358
+ toastParentBlock && toastParentBlock.appendChild(toastBlock);
5359
+ toastify && toastify.appendChild(toastParentBlock);
5355
5360
  } else {
5356
5361
  document.getElementById(styles$5[position]).appendChild(toastBlock);
5357
5362
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xaypay/tui",
3
- "version": "0.2.4",
3
+ "version": "0.2.5",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.es.js",