@s-ui/react-atom-toast
Advanced tools
Comparing version 1.7.0 to 1.8.0
export var BASE_CLASS = 'sui-AtomToast'; | ||
export var POSITIONS = { | ||
topLeft: 'top-left', | ||
top: 'top', | ||
topRight: 'top-right', | ||
bottomLeft: 'bottom-left', | ||
bottom: 'bottom', | ||
bottomLeft: 'bottom-left', | ||
bottomRight: 'bottom-right', | ||
top: 'top', | ||
topLeft: 'top-left', | ||
topRight: 'top-right' | ||
bottomRight: 'bottom-right' | ||
}; | ||
@@ -10,0 +10,0 @@ export var AUTO_CLOSE_TIMES = { |
@@ -1,7 +0,7 @@ | ||
import { jsxs as _jsxs } from "react/jsx-runtime"; | ||
import { jsx as _jsx } from "react/jsx-runtime"; | ||
import { useState, useEffect, useRef, useCallback } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import cx from 'classnames'; | ||
import { AUTO_CLOSE_TIMES, BASE_CLASS, EFFECT_DELAY, POSITIONS } from './config'; | ||
import { AUTO_CLOSE_TIMES, BASE_CLASS, EFFECT_DELAY, POSITIONS } from './config.js'; | ||
import { jsx as _jsx } from "react/jsx-runtime"; | ||
import { jsxs as _jsxs } from "react/jsx-runtime"; | ||
@@ -22,4 +22,3 @@ function AtomToast(_ref) { | ||
iconClose = _ref$iconClose === void 0 ? null : _ref$iconClose, | ||
_ref$onClose = _ref.onClose, | ||
onClose = _ref$onClose === void 0 ? function () {} : _ref$onClose, | ||
onClose = _ref.onClose, | ||
_ref$position = _ref.position, | ||
@@ -45,3 +44,3 @@ position = _ref$position === void 0 ? POSITIONS.topRight : _ref$position, | ||
setShow(false); | ||
if (!effect) onClose(); | ||
if (!effect && typeof onClose === 'function') onClose(); | ||
}, [effect, onClose]); | ||
@@ -74,3 +73,3 @@ useEffect(function () { | ||
setDelay(false); | ||
onClose(); | ||
typeof onClose === 'function' && onClose(); | ||
}, EFFECT_DELAY.close); | ||
@@ -77,0 +76,0 @@ } |
{ | ||
"name": "@s-ui/react-atom-toast", | ||
"version": "1.7.0", | ||
"version": "1.8.0", | ||
"description": "", | ||
"main": "lib/index.js", | ||
"scripts": { | ||
"prepare": "npx rimraf ./lib && npx mkdirp ./lib && npm run build:js && npm run build:styles", | ||
"build:js": "../../../node_modules/.bin/babel --presets sui ./src --out-dir ./lib", | ||
"build:styles": "../../../node_modules/.bin/cpx './src/**/*.scss' ./lib" | ||
"prepublishOnly": "rimraf ./lib && npm run build:js && npm run build:styles", | ||
"build:js": "babel --presets sui ./src --out-dir ./lib", | ||
"build:styles": "cpx './src/**/*.scss' ./lib" | ||
}, | ||
@@ -11,0 +11,0 @@ "dependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
8
7786
115