Socket
Socket
Sign inDemoInstall

rc-notification

Package Overview
Dependencies
Maintainers
8
Versions
75
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rc-notification - npm Package Compare versions

Comparing version 5.1.0 to 5.1.1

es/NotificationProvider.d.ts

3

es/index.d.ts
import useNotification from './useNotification';
import Notice from './Notice';
import type { NotificationAPI, NotificationConfig } from './useNotification';
export { useNotification, Notice };
import NotificationProvider from './NotificationProvider';
export { useNotification, Notice, NotificationProvider };
export type { NotificationAPI, NotificationConfig };
import useNotification from "./useNotification";
import Notice from "./Notice";
export { useNotification, Notice };
import NotificationProvider from "./NotificationProvider";
export { useNotification, Notice, NotificationProvider };

@@ -12,6 +12,2 @@ import type { CSSProperties, FC } from 'react';

onNoticeClose?: (key: React.Key) => void;
useStyle?: (prefixCls: string) => {
notice?: string;
list?: string;
};
className?: string;

@@ -18,0 +14,0 @@ style?: CSSProperties;

import _extends from "@babel/runtime/helpers/esm/extends";
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
import React from 'react';
import classNames from 'classnames';
import React, { useContext } from 'react';
import clsx from 'classnames';
import { CSSMotionList } from 'rc-motion';
import Notice from "./Notice";
import { NotificationContext } from "./NotificationProvider";
var NoticeList = function NoticeList(props) {

@@ -13,7 +14,7 @@ var configList = props.configList,

style = props.style,
useStyle = props.useStyle,
motion = props.motion,
onAllNoticeRemoved = props.onAllNoticeRemoved,
onNoticeClose = props.onNoticeClose;
var styles = useStyle === null || useStyle === void 0 ? void 0 : useStyle(prefixCls);
var _useContext = useContext(NotificationContext),
ctxCls = _useContext.classNames;
var keys = configList.map(function (config) {

@@ -28,3 +29,3 @@ return {

key: placement,
className: classNames(prefixCls, "".concat(prefixCls, "-").concat(placement), styles === null || styles === void 0 ? void 0 : styles.list, className),
className: clsx(prefixCls, "".concat(prefixCls, "-").concat(placement), ctxCls === null || ctxCls === void 0 ? void 0 : ctxCls.list, className),
style: style,

@@ -50,3 +51,3 @@ keys: keys,

prefixCls: prefixCls,
className: classNames(motionClassName, configClassName, styles === null || styles === void 0 ? void 0 : styles.notice),
className: clsx(motionClassName, configClassName, ctxCls === null || ctxCls === void 0 ? void 0 : ctxCls.notice),
style: _objectSpread(_objectSpread({}, motionStyle), configStyle),

@@ -53,0 +54,0 @@ times: times,

import * as React from 'react';
import { ReactElement } from 'react';
import type { CSSMotionProps } from 'rc-motion';
import type { OpenConfig, Placement } from './interface';
import { NoticeListProps } from './NoticeList';
export interface NotificationsProps {

@@ -13,3 +13,6 @@ prefixCls?: string;

onAllRemoved?: VoidFunction;
useStyle?: NoticeListProps['useStyle'];
renderNotifications?: (node: ReactElement, info: {
prefixCls: string;
key: React.Key;
}) => ReactElement;
}

@@ -16,0 +19,0 @@ export interface NotificationsRef {

@@ -17,3 +17,3 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";

onAllRemoved = props.onAllRemoved,
useStyle = props.useStyle;
renderNotifications = props.renderNotifications;
var _React$useState = React.useState([]),

@@ -128,3 +128,3 @@ _React$useState2 = _slicedToArray(_React$useState, 2),

var placementConfigList = placements[placement];
return /*#__PURE__*/React.createElement(NoticeList, {
var list = /*#__PURE__*/React.createElement(NoticeList, {
key: placement,

@@ -138,5 +138,8 @@ configList: placementConfigList,

onNoticeClose: onNoticeClose,
onAllNoticeRemoved: onAllNoticeRemoved,
useStyle: useStyle
onAllNoticeRemoved: onAllNoticeRemoved
});
return renderNotifications ? renderNotifications(list, {
prefixCls: prefixCls,
key: placement
}) : list;
})), container);

@@ -143,0 +146,0 @@ });

import type { CSSMotionProps } from 'rc-motion';
import * as React from 'react';
import type { NotificationsProps } from './Notifications';
import type { OpenConfig, Placement } from './interface';
import type { NoticeListProps } from './NoticeList';
type OptionalConfig = Partial<OpenConfig>;

@@ -22,3 +22,3 @@ export interface NotificationConfig {

/** @private Slot for style in Notifications */
useStyle?: NoticeListProps['useStyle'];
renderNotifications?: NotificationsProps['renderNotifications'];
}

@@ -25,0 +25,0 @@ export interface NotificationAPI {

import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
var _excluded = ["getContainer", "motion", "prefixCls", "maxCount", "className", "style", "onAllRemoved", "useStyle"];
var _excluded = ["getContainer", "motion", "prefixCls", "maxCount", "className", "style", "onAllRemoved", "renderNotifications"];
import * as React from 'react';

@@ -38,3 +38,3 @@ import Notifications from "./Notifications";

onAllRemoved = rootConfig.onAllRemoved,
useStyle = rootConfig.useStyle,
renderNotifications = rootConfig.renderNotifications,
shareConfig = _objectWithoutProperties(rootConfig, _excluded);

@@ -55,3 +55,3 @@ var _React$useState = React.useState(),

onAllRemoved: onAllRemoved,
useStyle: useStyle
renderNotifications: renderNotifications
});

@@ -58,0 +58,0 @@ var _React$useState3 = React.useState([]),

import useNotification from './useNotification';
import Notice from './Notice';
import type { NotificationAPI, NotificationConfig } from './useNotification';
export { useNotification, Notice };
import NotificationProvider from './NotificationProvider';
export { useNotification, Notice, NotificationProvider };
export type { NotificationAPI, NotificationConfig };

@@ -13,2 +13,8 @@ "use strict";

});
Object.defineProperty(exports, "NotificationProvider", {
enumerable: true,
get: function get() {
return _NotificationProvider.default;
}
});
Object.defineProperty(exports, "useNotification", {

@@ -21,2 +27,3 @@ enumerable: true,

var _useNotification = _interopRequireDefault(require("./useNotification"));
var _Notice = _interopRequireDefault(require("./Notice"));
var _Notice = _interopRequireDefault(require("./Notice"));
var _NotificationProvider = _interopRequireDefault(require("./NotificationProvider"));

@@ -12,6 +12,2 @@ import type { CSSProperties, FC } from 'react';

onNoticeClose?: (key: React.Key) => void;
useStyle?: (prefixCls: string) => {
notice?: string;
list?: string;
};
className?: string;

@@ -18,0 +14,0 @@ style?: CSSProperties;

"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
var _typeof = require("@babel/runtime/helpers/typeof");
Object.defineProperty(exports, "__esModule", {

@@ -10,6 +11,9 @@ value: true

var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
var _react = _interopRequireDefault(require("react"));
var _react = _interopRequireWildcard(require("react"));
var _classnames = _interopRequireDefault(require("classnames"));
var _rcMotion = require("rc-motion");
var _Notice = _interopRequireDefault(require("./Notice"));
var _NotificationProvider = require("./NotificationProvider");
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && 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; }
var NoticeList = function NoticeList(props) {

@@ -21,7 +25,7 @@ var configList = props.configList,

style = props.style,
useStyle = props.useStyle,
motion = props.motion,
onAllNoticeRemoved = props.onAllNoticeRemoved,
onNoticeClose = props.onNoticeClose;
var styles = useStyle === null || useStyle === void 0 ? void 0 : useStyle(prefixCls);
var _useContext = (0, _react.useContext)(_NotificationProvider.NotificationContext),
ctxCls = _useContext.classNames;
var keys = configList.map(function (config) {

@@ -36,3 +40,3 @@ return {

key: placement,
className: (0, _classnames.default)(prefixCls, "".concat(prefixCls, "-").concat(placement), styles === null || styles === void 0 ? void 0 : styles.list, className),
className: (0, _classnames.default)(prefixCls, "".concat(prefixCls, "-").concat(placement), ctxCls === null || ctxCls === void 0 ? void 0 : ctxCls.list, className),
style: style,

@@ -58,3 +62,3 @@ keys: keys,

prefixCls: prefixCls,
className: (0, _classnames.default)(motionClassName, configClassName, styles === null || styles === void 0 ? void 0 : styles.notice),
className: (0, _classnames.default)(motionClassName, configClassName, ctxCls === null || ctxCls === void 0 ? void 0 : ctxCls.notice),
style: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, motionStyle), configStyle),

@@ -61,0 +65,0 @@ times: times,

import * as React from 'react';
import { ReactElement } from 'react';
import type { CSSMotionProps } from 'rc-motion';
import type { OpenConfig, Placement } from './interface';
import { NoticeListProps } from './NoticeList';
export interface NotificationsProps {

@@ -13,3 +13,6 @@ prefixCls?: string;

onAllRemoved?: VoidFunction;
useStyle?: NoticeListProps['useStyle'];
renderNotifications?: (node: ReactElement, info: {
prefixCls: string;
key: React.Key;
}) => ReactElement;
}

@@ -16,0 +19,0 @@ export interface NotificationsRef {

@@ -27,3 +27,3 @@ "use strict";

onAllRemoved = props.onAllRemoved,
useStyle = props.useStyle;
renderNotifications = props.renderNotifications;
var _React$useState = React.useState([]),

@@ -138,3 +138,3 @@ _React$useState2 = (0, _slicedToArray2.default)(_React$useState, 2),

var placementConfigList = placements[placement];
return /*#__PURE__*/React.createElement(_NoticeList.default, {
var list = /*#__PURE__*/React.createElement(_NoticeList.default, {
key: placement,

@@ -148,5 +148,8 @@ configList: placementConfigList,

onNoticeClose: onNoticeClose,
onAllNoticeRemoved: onAllNoticeRemoved,
useStyle: useStyle
onAllNoticeRemoved: onAllNoticeRemoved
});
return renderNotifications ? renderNotifications(list, {
prefixCls: prefixCls,
key: placement
}) : list;
})), container);

@@ -153,0 +156,0 @@ });

import type { CSSMotionProps } from 'rc-motion';
import * as React from 'react';
import type { NotificationsProps } from './Notifications';
import type { OpenConfig, Placement } from './interface';
import type { NoticeListProps } from './NoticeList';
type OptionalConfig = Partial<OpenConfig>;

@@ -22,3 +22,3 @@ export interface NotificationConfig {

/** @private Slot for style in Notifications */
useStyle?: NoticeListProps['useStyle'];
renderNotifications?: NotificationsProps['renderNotifications'];
}

@@ -25,0 +25,0 @@ export interface NotificationAPI {

@@ -14,3 +14,3 @@ "use strict";

var _Notifications = _interopRequireDefault(require("./Notifications"));
var _excluded = ["getContainer", "motion", "prefixCls", "maxCount", "className", "style", "onAllRemoved", "useStyle"];
var _excluded = ["getContainer", "motion", "prefixCls", "maxCount", "className", "style", "onAllRemoved", "renderNotifications"];
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }

@@ -49,3 +49,3 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && 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; }

onAllRemoved = rootConfig.onAllRemoved,
useStyle = rootConfig.useStyle,
renderNotifications = rootConfig.renderNotifications,
shareConfig = (0, _objectWithoutProperties2.default)(rootConfig, _excluded);

@@ -66,3 +66,3 @@ var _React$useState = React.useState(),

onAllRemoved: onAllRemoved,
useStyle: useStyle
renderNotifications: renderNotifications
});

@@ -69,0 +69,0 @@ var _React$useState3 = React.useState([]),

{
"name": "rc-notification",
"version": "5.1.0",
"version": "5.1.1",
"description": "notification ui component for react",

@@ -5,0 +5,0 @@ "engines": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc