rc-notification
Advanced tools
Comparing version 4.0.0 to 4.3.0
@@ -1,2 +0,15 @@ | ||
import Notification from './Notification'; | ||
export default Notification; | ||
"use strict"; | ||
var __importDefault = this && this.__importDefault || function (mod) { | ||
return mod && mod.__esModule ? mod : { | ||
"default": mod | ||
}; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var Notification_1 = __importDefault(require("./Notification")); | ||
exports.default = Notification_1.default; |
import React, { Component } from 'react'; | ||
interface DivProps extends React.HTMLProps<HTMLDivElement> { | ||
'data-testid'?: string; | ||
} | ||
export interface NoticeProps { | ||
@@ -11,2 +14,3 @@ prefixCls: string; | ||
closable?: boolean; | ||
props?: DivProps; | ||
onClick?: React.MouseEventHandler<HTMLDivElement>; | ||
@@ -25,3 +29,3 @@ onClose?: () => void; | ||
}; | ||
closeTimer: number; | ||
closeTimer: number | null; | ||
componentDidMount(): void; | ||
@@ -36,1 +40,2 @@ componentDidUpdate(prevProps: NoticeProps): void; | ||
} | ||
export {}; |
@@ -0,1 +1,3 @@ | ||
"use strict"; | ||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
@@ -11,2 +13,8 @@ | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
@@ -16,17 +24,37 @@ | ||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
var __importStar = this && this.__importStar || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) { | ||
if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; | ||
} | ||
result["default"] = mod; | ||
return result; | ||
}; | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
var __importDefault = this && this.__importDefault || function (mod) { | ||
return mod && mod.__esModule ? mod : { | ||
"default": mod | ||
}; | ||
}; | ||
import React, { Component } from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import classNames from 'classnames'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var Notice = | ||
/*#__PURE__*/ | ||
function (_Component) { | ||
_inherits(Notice, _Component); | ||
var react_1 = __importStar(require("react")); | ||
var react_dom_1 = __importDefault(require("react-dom")); | ||
var classnames_1 = __importDefault(require("classnames")); | ||
var Notice = /*#__PURE__*/function (_react_1$Component) { | ||
_inherits(Notice, _react_1$Component); | ||
var _super = _createSuper(Notice); | ||
function Notice() { | ||
@@ -37,3 +65,4 @@ var _this; | ||
_this = _possibleConstructorReturn(this, _getPrototypeOf(Notice).apply(this, arguments)); | ||
_this = _super.apply(this, arguments); | ||
_this.closeTimer = null; | ||
@@ -47,3 +76,7 @@ _this.close = function (e) { | ||
_this.props.onClose(); | ||
var onClose = _this.props.onClose; | ||
if (onClose) { | ||
onClose(); | ||
} | ||
}; | ||
@@ -95,2 +128,4 @@ | ||
value: function render() { | ||
var _this2 = this; | ||
var _this$props = this.props, | ||
@@ -106,4 +141,11 @@ prefixCls = _this$props.prefixCls, | ||
var componentClass = "".concat(prefixCls, "-notice"); | ||
var node = React.createElement("div", { | ||
className: classNames(componentClass, className, _defineProperty({}, "".concat(componentClass, "-closable"), closable)), | ||
var dataOrAriaAttributeProps = Object.keys(this.props).reduce(function (acc, key) { | ||
if (key.substr(0, 5) === 'data-' || key.substr(0, 5) === 'aria-' || key === 'role') { | ||
acc[key] = _this2.props[key]; | ||
} | ||
return acc; | ||
}, {}); | ||
var node = react_1.default.createElement("div", Object.assign({ | ||
className: classnames_1.default(componentClass, className, _defineProperty({}, "".concat(componentClass, "-closable"), closable)), | ||
style: style, | ||
@@ -113,9 +155,9 @@ onMouseEnter: this.clearCloseTimer, | ||
onClick: onClick | ||
}, React.createElement("div", { | ||
}, dataOrAriaAttributeProps), react_1.default.createElement("div", { | ||
className: "".concat(componentClass, "-content") | ||
}, children), closable ? React.createElement("a", { | ||
}, children), closable ? react_1.default.createElement("a", { | ||
tabIndex: 0, | ||
onClick: this.close, | ||
className: "".concat(componentClass, "-close") | ||
}, closeIcon || React.createElement("span", { | ||
}, closeIcon || react_1.default.createElement("span", { | ||
className: "".concat(componentClass, "-close-x") | ||
@@ -125,3 +167,3 @@ })) : null); | ||
if (holder) { | ||
return ReactDOM.createPortal(node, holder); | ||
return react_dom_1.default.createPortal(node, holder); | ||
} | ||
@@ -134,5 +176,5 @@ | ||
return Notice; | ||
}(Component); | ||
}(react_1.Component); | ||
export { Notice as default }; | ||
exports.default = Notice; | ||
Notice.defaultProps = { | ||
@@ -139,0 +181,0 @@ onClose: function onClose() {}, |
@@ -51,5 +51,5 @@ import React, { Component } from 'react'; | ||
add: (notice: NoticeContent, holderCallback?: HolderReadyCallback) => void; | ||
remove: (key: string | number) => void; | ||
remove: (key: React.ReactText) => void; | ||
render(): JSX.Element; | ||
} | ||
export default Notification; |
@@ -0,1 +1,3 @@ | ||
"use strict"; | ||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } | ||
@@ -19,2 +21,8 @@ | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
@@ -24,15 +32,40 @@ | ||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
var __importStar = this && this.__importStar || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) { | ||
if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; | ||
} | ||
result["default"] = mod; | ||
return result; | ||
}; | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
var __importDefault = this && this.__importDefault || function (mod) { | ||
return mod && mod.__esModule ? mod : { | ||
"default": mod | ||
}; | ||
}; | ||
import React, { Component } from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import Animate from 'rc-animate'; | ||
import createChainedFunction from "rc-util/es/createChainedFunction"; | ||
import classnames from 'classnames'; | ||
import Notice from './Notice'; | ||
import _useNotification from './useNotification'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var react_1 = __importStar(require("react")); | ||
var react_dom_1 = __importDefault(require("react-dom")); | ||
var rc_animate_1 = __importDefault(require("rc-animate")); | ||
var createChainedFunction_1 = __importDefault(require("rc-util/lib/createChainedFunction")); | ||
var classnames_1 = __importDefault(require("classnames")); | ||
var Notice_1 = __importDefault(require("./Notice")); | ||
var useNotification_1 = __importDefault(require("./useNotification")); | ||
var seed = 0; | ||
@@ -47,7 +80,7 @@ var now = Date.now(); | ||
var Notification = | ||
/*#__PURE__*/ | ||
function (_Component) { | ||
_inherits(Notification, _Component); | ||
var Notification = /*#__PURE__*/function (_react_1$Component) { | ||
_inherits(Notification, _react_1$Component); | ||
var _super = _createSuper(Notification); | ||
function Notification() { | ||
@@ -58,3 +91,3 @@ var _this; | ||
_this = _possibleConstructorReturn(this, _getPrototypeOf(Notification).apply(this, arguments)); | ||
_this = _super.apply(this, arguments); | ||
_this.state = { | ||
@@ -66,2 +99,3 @@ notices: [] | ||
_this.add = function (notice, holderCallback) { | ||
// eslint-disable-next-line no-param-reassign | ||
notice.key = notice.key || getUuid(); | ||
@@ -88,2 +122,3 @@ var key = notice.key; | ||
// manual control and b) internal react 'key' prop , which is not that good. | ||
// eslint-disable-next-line no-param-reassign | ||
notice.updateKey = updatedNotices[0].notice.updateKey || updatedNotices[0].notice.key; | ||
@@ -149,8 +184,8 @@ updatedNotices.shift(); | ||
var key = notice.updateKey ? notice.updateKey : notice.key; | ||
var onClose = createChainedFunction(_this2.remove.bind(_this2, notice.key), notice.onClose); | ||
var onClose = createChainedFunction_1.default(_this2.remove.bind(_this2, notice.key), notice.onClose); | ||
var noticeProps = _objectSpread({ | ||
var noticeProps = _objectSpread(_objectSpread(_objectSpread({ | ||
prefixCls: prefixCls, | ||
closeIcon: closeIcon | ||
}, notice, { | ||
}, notice), notice.props), {}, { | ||
key: key, | ||
@@ -164,6 +199,10 @@ update: update, | ||
if (holderCallback) { | ||
return React.createElement("div", { | ||
return react_1.default.createElement("div", { | ||
key: key, | ||
className: "".concat(prefixCls, "-hook-holder"), | ||
ref: function ref(div) { | ||
if (typeof key === 'undefined') { | ||
return; | ||
} | ||
if (div) { | ||
@@ -180,8 +219,8 @@ _this2.hookRefs.set(key, div); | ||
return React.createElement(Notice, Object.assign({}, noticeProps)); | ||
return react_1.default.createElement(Notice_1.default, Object.assign({}, noticeProps)); | ||
}); | ||
return React.createElement("div", { | ||
className: classnames(prefixCls, className), | ||
return react_1.default.createElement("div", { | ||
className: classnames_1.default(prefixCls, className), | ||
style: style | ||
}, React.createElement(Animate, { | ||
}, react_1.default.createElement(rc_animate_1.default, { | ||
transitionName: this.getTransitionName() | ||
@@ -193,3 +232,3 @@ }, noticeNodes)); | ||
return Notification; | ||
}(Component); | ||
}(react_1.Component); | ||
@@ -236,8 +275,11 @@ Notification.defaultProps = { | ||
destroy: function destroy() { | ||
ReactDOM.unmountComponentAtNode(div); | ||
div.parentNode.removeChild(div); | ||
react_dom_1.default.unmountComponentAtNode(div); | ||
if (div.parentNode) { | ||
div.parentNode.removeChild(div); | ||
} | ||
}, | ||
// Hooks | ||
useNotification: function useNotification() { | ||
return _useNotification(notification); | ||
return useNotification_1.default(notification); | ||
} | ||
@@ -249,3 +291,3 @@ }); | ||
if (process.env.NODE_ENV === 'test' && properties.TEST_RENDER) { | ||
properties.TEST_RENDER(React.createElement(Notification, Object.assign({}, props, { | ||
properties.TEST_RENDER(react_1.default.createElement(Notification, Object.assign({}, props, { | ||
ref: ref | ||
@@ -256,3 +298,3 @@ }))); | ||
ReactDOM.render(React.createElement(Notification, Object.assign({}, props, { | ||
react_dom_1.default.render(react_1.default.createElement(Notification, Object.assign({}, props, { | ||
ref: ref | ||
@@ -262,2 +304,2 @@ })), div); | ||
export default Notification; | ||
exports.default = Notification; |
@@ -1,20 +0,48 @@ | ||
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); } | ||
"use strict"; | ||
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); } | ||
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } | ||
function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); } | ||
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } | ||
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } } | ||
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); } | ||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); } | ||
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } | ||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } | ||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } | ||
function _iterableToArrayLimit(arr, i) { if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) { return; } var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } | ||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } | ||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } | ||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } | ||
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } | ||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } | ||
import * as React from 'react'; | ||
import Notice from './Notice'; | ||
export default function useNotification(notificationInstance) { | ||
var __importStar = this && this.__importStar || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) { | ||
if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; | ||
} | ||
result["default"] = mod; | ||
return result; | ||
}; | ||
var __importDefault = this && this.__importDefault || function (mod) { | ||
return mod && mod.__esModule ? mod : { | ||
"default": mod | ||
}; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var React = __importStar(require("react")); | ||
var Notice_1 = __importDefault(require("./Notice")); | ||
function useNotification(notificationInstance) { | ||
var createdRef = React.useRef({}); | ||
@@ -32,3 +60,3 @@ | ||
if (div && !createdRef.current[key]) { | ||
var noticeEle = React.createElement(Notice, Object.assign({}, props, { | ||
var noticeEle = React.createElement(Notice_1.default, Object.assign({}, props, { | ||
holder: div | ||
@@ -45,2 +73,4 @@ })); | ||
return [notify, React.createElement(React.Fragment, null, elements)]; | ||
} | ||
} | ||
exports.default = useNotification; |
# History | ||
## 4.3.0 | ||
- Upgrade `rc-animate` to `3.x`. | ||
## 3.3.0 | ||
@@ -4,0 +8,0 @@ |
"use strict"; | ||
var __importDefault = void 0 && (void 0).__importDefault || function (mod) { | ||
return mod && mod.__esModule ? mod : { | ||
"default": mod | ||
}; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = void 0; | ||
var _Notification = _interopRequireDefault(require("./Notification")); | ||
var Notification_1 = __importDefault(require("./Notification")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var _default = _Notification.default; | ||
exports.default = _default; | ||
exports.default = Notification_1.default; |
import React, { Component } from 'react'; | ||
interface DivProps extends React.HTMLProps<HTMLDivElement> { | ||
'data-testid'?: string; | ||
} | ||
export interface NoticeProps { | ||
@@ -11,2 +14,3 @@ prefixCls: string; | ||
closable?: boolean; | ||
props?: DivProps; | ||
onClick?: React.MouseEventHandler<HTMLDivElement>; | ||
@@ -25,3 +29,3 @@ onClose?: () => void; | ||
}; | ||
closeTimer: number; | ||
closeTimer: number | null; | ||
componentDidMount(): void; | ||
@@ -36,1 +40,2 @@ componentDidUpdate(prevProps: NoticeProps): void; | ||
} | ||
export {}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = void 0; | ||
var _react = _interopRequireWildcard(require("react")); | ||
var _reactDom = _interopRequireDefault(require("react-dom")); | ||
var _classnames = _interopRequireDefault(require("classnames")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; } | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
@@ -30,2 +13,8 @@ | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
@@ -35,13 +24,37 @@ | ||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
var __importStar = void 0 && (void 0).__importStar || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) { | ||
if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; | ||
} | ||
result["default"] = mod; | ||
return result; | ||
}; | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
var __importDefault = void 0 && (void 0).__importDefault || function (mod) { | ||
return mod && mod.__esModule ? mod : { | ||
"default": mod | ||
}; | ||
}; | ||
var Notice = | ||
/*#__PURE__*/ | ||
function (_Component) { | ||
_inherits(Notice, _Component); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var react_1 = __importStar(require("react")); | ||
var react_dom_1 = __importDefault(require("react-dom")); | ||
var classnames_1 = __importDefault(require("classnames")); | ||
var Notice = /*#__PURE__*/function (_react_1$Component) { | ||
_inherits(Notice, _react_1$Component); | ||
var _super = _createSuper(Notice); | ||
function Notice() { | ||
@@ -52,3 +65,4 @@ var _this; | ||
_this = _possibleConstructorReturn(this, _getPrototypeOf(Notice).apply(this, arguments)); | ||
_this = _super.apply(this, arguments); | ||
_this.closeTimer = null; | ||
@@ -62,3 +76,7 @@ _this.close = function (e) { | ||
_this.props.onClose(); | ||
var onClose = _this.props.onClose; | ||
if (onClose) { | ||
onClose(); | ||
} | ||
}; | ||
@@ -110,2 +128,4 @@ | ||
value: function render() { | ||
var _this2 = this; | ||
var _this$props = this.props, | ||
@@ -121,5 +141,11 @@ prefixCls = _this$props.prefixCls, | ||
var componentClass = "".concat(prefixCls, "-notice"); | ||
var dataOrAriaAttributeProps = Object.keys(this.props).reduce(function (acc, key) { | ||
if (key.substr(0, 5) === 'data-' || key.substr(0, 5) === 'aria-' || key === 'role') { | ||
acc[key] = _this2.props[key]; | ||
} | ||
var node = _react.default.createElement("div", { | ||
className: (0, _classnames.default)(componentClass, className, _defineProperty({}, "".concat(componentClass, "-closable"), closable)), | ||
return acc; | ||
}, {}); | ||
var node = react_1.default.createElement("div", Object.assign({ | ||
className: classnames_1.default(componentClass, className, _defineProperty({}, "".concat(componentClass, "-closable"), closable)), | ||
style: style, | ||
@@ -129,9 +155,9 @@ onMouseEnter: this.clearCloseTimer, | ||
onClick: onClick | ||
}, _react.default.createElement("div", { | ||
}, dataOrAriaAttributeProps), react_1.default.createElement("div", { | ||
className: "".concat(componentClass, "-content") | ||
}, children), closable ? _react.default.createElement("a", { | ||
}, children), closable ? react_1.default.createElement("a", { | ||
tabIndex: 0, | ||
onClick: this.close, | ||
className: "".concat(componentClass, "-close") | ||
}, closeIcon || _react.default.createElement("span", { | ||
}, closeIcon || react_1.default.createElement("span", { | ||
className: "".concat(componentClass, "-close-x") | ||
@@ -141,3 +167,3 @@ })) : null); | ||
if (holder) { | ||
return _reactDom.default.createPortal(node, holder); | ||
return react_dom_1.default.createPortal(node, holder); | ||
} | ||
@@ -150,3 +176,3 @@ | ||
return Notice; | ||
}(_react.Component); | ||
}(react_1.Component); | ||
@@ -153,0 +179,0 @@ exports.default = Notice; |
@@ -51,5 +51,5 @@ import React, { Component } from 'react'; | ||
add: (notice: NoticeContent, holderCallback?: HolderReadyCallback) => void; | ||
remove: (key: string | number) => void; | ||
remove: (key: React.ReactText) => void; | ||
render(): JSX.Element; | ||
} | ||
export default Notification; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = void 0; | ||
var _react = _interopRequireWildcard(require("react")); | ||
var _reactDom = _interopRequireDefault(require("react-dom")); | ||
var _rcAnimate = _interopRequireDefault(require("rc-animate")); | ||
var _createChainedFunction = _interopRequireDefault(require("rc-util/lib/createChainedFunction")); | ||
var _classnames = _interopRequireDefault(require("classnames")); | ||
var _Notice = _interopRequireDefault(require("./Notice")); | ||
var _useNotification2 = _interopRequireDefault(require("./useNotification")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; } | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } | ||
@@ -46,2 +21,8 @@ | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function () { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
@@ -51,8 +32,40 @@ | ||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } | ||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } | ||
var __importStar = void 0 && (void 0).__importStar || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) { | ||
if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; | ||
} | ||
result["default"] = mod; | ||
return result; | ||
}; | ||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } | ||
var __importDefault = void 0 && (void 0).__importDefault || function (mod) { | ||
return mod && mod.__esModule ? mod : { | ||
"default": mod | ||
}; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var react_1 = __importStar(require("react")); | ||
var react_dom_1 = __importDefault(require("react-dom")); | ||
var rc_animate_1 = __importDefault(require("rc-animate")); | ||
var createChainedFunction_1 = __importDefault(require("rc-util/lib/createChainedFunction")); | ||
var classnames_1 = __importDefault(require("classnames")); | ||
var Notice_1 = __importDefault(require("./Notice")); | ||
var useNotification_1 = __importDefault(require("./useNotification")); | ||
var seed = 0; | ||
@@ -67,7 +80,7 @@ var now = Date.now(); | ||
var Notification = | ||
/*#__PURE__*/ | ||
function (_Component) { | ||
_inherits(Notification, _Component); | ||
var Notification = /*#__PURE__*/function (_react_1$Component) { | ||
_inherits(Notification, _react_1$Component); | ||
var _super = _createSuper(Notification); | ||
function Notification() { | ||
@@ -78,3 +91,3 @@ var _this; | ||
_this = _possibleConstructorReturn(this, _getPrototypeOf(Notification).apply(this, arguments)); | ||
_this = _super.apply(this, arguments); | ||
_this.state = { | ||
@@ -86,2 +99,3 @@ notices: [] | ||
_this.add = function (notice, holderCallback) { | ||
// eslint-disable-next-line no-param-reassign | ||
notice.key = notice.key || getUuid(); | ||
@@ -108,2 +122,3 @@ var key = notice.key; | ||
// manual control and b) internal react 'key' prop , which is not that good. | ||
// eslint-disable-next-line no-param-reassign | ||
notice.updateKey = updatedNotices[0].notice.updateKey || updatedNotices[0].notice.key; | ||
@@ -169,8 +184,8 @@ updatedNotices.shift(); | ||
var key = notice.updateKey ? notice.updateKey : notice.key; | ||
var onClose = (0, _createChainedFunction.default)(_this2.remove.bind(_this2, notice.key), notice.onClose); | ||
var onClose = createChainedFunction_1.default(_this2.remove.bind(_this2, notice.key), notice.onClose); | ||
var noticeProps = _objectSpread({ | ||
var noticeProps = _objectSpread(_objectSpread(_objectSpread({ | ||
prefixCls: prefixCls, | ||
closeIcon: closeIcon | ||
}, notice, { | ||
}, notice), notice.props), {}, { | ||
key: key, | ||
@@ -184,6 +199,10 @@ update: update, | ||
if (holderCallback) { | ||
return _react.default.createElement("div", { | ||
return react_1.default.createElement("div", { | ||
key: key, | ||
className: "".concat(prefixCls, "-hook-holder"), | ||
ref: function ref(div) { | ||
if (typeof key === 'undefined') { | ||
return; | ||
} | ||
if (div) { | ||
@@ -200,8 +219,8 @@ _this2.hookRefs.set(key, div); | ||
return _react.default.createElement(_Notice.default, Object.assign({}, noticeProps)); | ||
return react_1.default.createElement(Notice_1.default, Object.assign({}, noticeProps)); | ||
}); | ||
return _react.default.createElement("div", { | ||
className: (0, _classnames.default)(prefixCls, className), | ||
return react_1.default.createElement("div", { | ||
className: classnames_1.default(prefixCls, className), | ||
style: style | ||
}, _react.default.createElement(_rcAnimate.default, { | ||
}, react_1.default.createElement(rc_animate_1.default, { | ||
transitionName: this.getTransitionName() | ||
@@ -213,3 +232,3 @@ }, noticeNodes)); | ||
return Notification; | ||
}(_react.Component); | ||
}(react_1.Component); | ||
@@ -256,9 +275,11 @@ Notification.defaultProps = { | ||
destroy: function destroy() { | ||
_reactDom.default.unmountComponentAtNode(div); | ||
react_dom_1.default.unmountComponentAtNode(div); | ||
div.parentNode.removeChild(div); | ||
if (div.parentNode) { | ||
div.parentNode.removeChild(div); | ||
} | ||
}, | ||
// Hooks | ||
useNotification: function useNotification() { | ||
return (0, _useNotification2.default)(notification); | ||
return useNotification_1.default(notification); | ||
} | ||
@@ -270,3 +291,3 @@ }); | ||
if (process.env.NODE_ENV === 'test' && properties.TEST_RENDER) { | ||
properties.TEST_RENDER(_react.default.createElement(Notification, Object.assign({}, props, { | ||
properties.TEST_RENDER(react_1.default.createElement(Notification, Object.assign({}, props, { | ||
ref: ref | ||
@@ -277,3 +298,3 @@ }))); | ||
_reactDom.default.render(_react.default.createElement(Notification, Object.assign({}, props, { | ||
react_dom_1.default.render(react_1.default.createElement(Notification, Object.assign({}, props, { | ||
ref: ref | ||
@@ -283,3 +304,2 @@ })), div); | ||
var _default = Notification; | ||
exports.default = _default; | ||
exports.default = Notification; |
"use strict"; | ||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = useNotification; | ||
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } | ||
var React = _interopRequireWildcard(require("react")); | ||
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); } | ||
var _Notice = _interopRequireDefault(require("./Notice")); | ||
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } | ||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; } | ||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } | ||
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); } | ||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } | ||
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); } | ||
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } | ||
function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); } | ||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } | ||
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } } | ||
var __importStar = void 0 && (void 0).__importStar || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) { | ||
if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; | ||
} | ||
result["default"] = mod; | ||
return result; | ||
}; | ||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); } | ||
var __importDefault = void 0 && (void 0).__importDefault || function (mod) { | ||
return mod && mod.__esModule ? mod : { | ||
"default": mod | ||
}; | ||
}; | ||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
function _iterableToArrayLimit(arr, i) { if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) { return; } var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } | ||
var React = __importStar(require("react")); | ||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } | ||
var Notice_1 = __importDefault(require("./Notice")); | ||
@@ -49,3 +60,3 @@ function useNotification(notificationInstance) { | ||
if (div && !createdRef.current[key]) { | ||
var noticeEle = React.createElement(_Notice.default, Object.assign({}, props, { | ||
var noticeEle = React.createElement(Notice_1.default, Object.assign({}, props, { | ||
holder: div | ||
@@ -62,2 +73,4 @@ })); | ||
return [notify, React.createElement(React.Fragment, null, elements)]; | ||
} | ||
} | ||
exports.default = useNotification; |
{ | ||
"name": "rc-notification", | ||
"version": "4.0.0", | ||
"version": "4.3.0", | ||
"description": "notification ui component for react", | ||
@@ -50,8 +50,10 @@ "engines": { | ||
"devDependencies": { | ||
"@types/classnames": "^2.2.10", | ||
"@types/jest": "^25.1.0", | ||
"@types/react": "^16.8.19", | ||
"@types/react-dom": "^16.8.4", | ||
"@types/react": "^16.9.34", | ||
"@types/react-dom": "^16.9.7", | ||
"cross-env": "^7.0.0", | ||
"enzyme": "^3.3.0", | ||
"enzyme-to-json": "^3.4.0", | ||
"eslint": "^6.8.0", | ||
"father": "^2.13.2", | ||
@@ -66,5 +68,5 @@ "less": "^3.10.3", | ||
"classnames": "2.x", | ||
"rc-animate": "2.x", | ||
"rc-animate": "3.x", | ||
"rc-util": "^4.0.4" | ||
} | ||
} |
@@ -9,41 +9,24 @@ # rc-notification | ||
[![Test coverage][coveralls-image]][coveralls-url] | ||
[![gemnasium deps][gemnasium-image]][gemnasium-url] | ||
[![node version][node-image]][node-url] | ||
[![Dependencies][david-image]][david-url] | ||
[![DevDependencies][david-dev-image]][david-dev-url] | ||
[![npm download][download-image]][download-url] | ||
[![bundle size][bundlephobia-image]][bundlephobia-url] | ||
[npm-image]: http://img.shields.io/npm/v/rc-notification.svg?style=flat-square | ||
[npm-url]: http://npmjs.org/package/rc-notification | ||
[travis-image]: https://img.shields.io/travis/react-component/notification.svg?style=flat-square | ||
[travis-image]: https://img.shields.io/travis/react-component/notification/master?style=flat-square | ||
[travis-url]: https://travis-ci.org/react-component/notification | ||
[coveralls-image]: https://img.shields.io/coveralls/react-component/notification.svg?style=flat-square | ||
[coveralls-url]: https://coveralls.io/r/react-component/notification?branch=master | ||
[gemnasium-image]: http://img.shields.io/gemnasium/react-component/notification.svg?style=flat-square | ||
[gemnasium-url]: https://gemnasium.com/react-component/notification | ||
[node-image]: https://img.shields.io/badge/node.js-%3E=_0.10-green.svg?style=flat-square | ||
[node-url]: http://nodejs.org/download/ | ||
[david-url]: https://david-dm.org/react-component/notification | ||
[david-image]: https://david-dm.org/react-component/notification/status.svg?style=flat-square | ||
[david-dev-url]: https://david-dm.org/react-component/notification?type=dev | ||
[david-dev-image]: https://david-dm.org/react-component/notification/dev-status.svg?style=flat-square | ||
[download-image]: https://img.shields.io/npm/dm/rc-notification.svg?style=flat-square | ||
[download-url]: https://npmjs.org/package/rc-notification | ||
[bundlephobia-url]: https://bundlephobia.com/result?p=rc-notification | ||
[bundlephobia-image]: https://badgen.net/bundlephobia/minzip/rc-notification | ||
## Install | ||
## Development | ||
``` | ||
npm install | ||
npm start | ||
``` | ||
## Example | ||
http://localhost:8000/examples/ | ||
online example: http://react-component.github.io/notification/examples/ | ||
## Feature | ||
* support ie9,ie9+,chrome,firefox,safari | ||
## install | ||
[![rc-notification](https://nodei.co/npm/rc-notification.png)](https://npmjs.org/package/rc-notification) | ||
@@ -54,3 +37,4 @@ | ||
```js | ||
var Notification = require('rc-notification'); | ||
import Notification from 'rc-notification'; | ||
Notification.newInstance({}, notification => { | ||
@@ -63,2 +47,14 @@ notification.notice({ | ||
## Compatibility | ||
| [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/edge/edge_48x48.png" alt="IE / Edge" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)<br>IE / Edge | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/firefox/firefox_48x48.png" alt="Firefox" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)<br>Firefox | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/chrome/chrome_48x48.png" alt="Chrome" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)<br>Chrome | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/safari/safari_48x48.png" alt="Safari" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)<br>Safari | [<img src="https://raw.githubusercontent.com/alrra/browser-logos/master/src/electron/electron_48x48.png" alt="Electron" width="24px" height="24px" />](http://godban.github.io/browsers-support-badges/)<br>Electron | | ||
| --- | --- | --- | --- | --- | | ||
| IE11, Edge | last 2 versions | last 2 versions | last 2 versions | last 2 versions | | ||
## Example | ||
http://localhost:8001 | ||
online example: http://react-component.github.io/notification/ | ||
## API | ||
@@ -163,2 +159,8 @@ | ||
</tr> | ||
<tr> | ||
<td>props</td> | ||
<td>Object</td> | ||
<td></td> | ||
<td>An object that can contain <code>data-*</code>, <code>aria-*</code>, or <code>role</code> props, to be put on the notification <code>div</code>. This currently only allows <code>data-testid</code> instead of <code>data-*</code> in TypeScript. See https://github.com/microsoft/TypeScript/issues/28960.</td> | ||
</tr> | ||
</tbody> | ||
@@ -165,0 +167,0 @@ </table> |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
65809
1164
191
14
+ Added@ant-design/css-animation@1.7.3(transitive)
+ Addedrc-animate@3.1.1(transitive)
- Removedbabel-runtime@6.26.0(transitive)
- Removedcomponent-classes@1.2.6(transitive)
- Removedcomponent-indexof@0.0.3(transitive)
- Removedcore-js@2.6.12(transitive)
- Removedcss-animation@1.6.1(transitive)
- Removedrc-animate@2.11.1(transitive)
- Removedregenerator-runtime@0.11.1(transitive)
Updatedrc-animate@3.x