@progress/kendo-react-notification
Version:
React Notification renders a message to the user with information about the status of an app process. KendoReact Notification package
101 lines (100 loc) • 2.74 kB
JavaScript
/**
* @license
*-------------------------------------------------------------------------------------------
* Copyright © 2025 Progress Software Corporation. All rights reserved.
* Licensed under commercial license. See LICENSE.md in the package root for more information
*-------------------------------------------------------------------------------------------
*/
import * as t from "react";
import e from "prop-types";
import { IconWrap as l } from "@progress/kendo-react-common";
import { xIcon as p, checkOutlineIcon as m, xOutlineIcon as f, infoCircleIcon as y, exclamationCircleIcon as u } from "@progress/kendo-svg-icons";
const d = "Close", h = {
success: "check-outline",
error: "x-outline",
info: "info-circle",
warning: "exclamation-circle"
}, b = {
success: m,
error: f,
info: y,
warning: u
}, o = class o extends t.Component {
/**
* @hidden
*/
render() {
const {
onClose: c,
className: i,
closable: s = o.defaultProps.closable,
type: n = o.defaultProps.type
} = this.props;
return /* @__PURE__ */ t.createElement(
"div",
{
dir: this.props.dir,
className: "k-notification" + (i ? ` ${i}` : "") + (n.style === "none" ? "" : ` k-notification-${n.style}`) + (s ? " k-notification-closable" : ""),
style: this.props.style
},
n.icon && /* @__PURE__ */ t.createElement(
l,
{
className: "k-notification-status",
name: h[n.style],
icon: b[n.style]
}
),
/* @__PURE__ */ t.createElement("div", { className: "k-notification-content" }, this.props.children),
s && /* @__PURE__ */ t.createElement("span", { className: "k-notification-actions" }, /* @__PURE__ */ t.createElement(
"span",
{
className: "k-notification-action k-notification-close-action",
title: d,
onClick: (a) => {
c && c.call(void 0, {
target: this,
syntheticEvent: a,
nativeEvent: a.nativeEvent
});
},
...typeof s != "boolean" ? s : {}
},
/* @__PURE__ */ t.createElement(l, { name: "x", icon: p })
))
);
}
};
o.propTypes = {
className: e.string,
closable: e.oneOfType([e.bool, e.object]),
dir: e.string,
style: e.object,
type: e.shape({
style: e.oneOf([
"base",
"secondary",
"success",
"error",
"light",
"inverse",
"primary",
"tertiary",
"warning",
"info",
"dark"
]),
icon: e.bool
}),
onClose: e.func
}, o.defaultProps = {
closable: !1,
type: {
style: "none",
icon: !0
}
};
let r = o;
export {
r as Notification
};