UNPKG

@mistong/eui-alert

Version:
771 lines (766 loc) 38.3 kB
!function(e, t) { "object" == typeof exports && "object" == typeof module ? module.exports = t(require("react")) : "function" == typeof define && define.amd ? define([ "react" ], t) : "object" == typeof exports ? exports["@mistong/eui-alert"] = t(require("react")) : e["@mistong/eui-alert"] = t(e.React); }(this, function(e) { return function(e) { function t(r) { if (n[r]) return n[r].exports; var o = n[r] = { "exports": {}, "id": r, "loaded": !1 }; return e[r].call(o.exports, o, o.exports, t), o.loaded = !0, o.exports; } var n = {}; return t.m = e, t.c = n, t.p = "/", t(0); }([ function(e, t, n) { "use strict"; function r(e) { return e && e.__esModule ? e : { "default": e }; } var o = n(1), i = r(o); e.exports = i.default; }, function(e, t, n) { "use strict"; function r(e) { return e && e.__esModule ? e : { "default": e }; } function o(e, t) { var n = {}; for (var r in e) t.indexOf(r) >= 0 || Object.prototype.hasOwnProperty.call(e, r) && (n[r] = e[r]); return n; } function i(e, t) { if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function"); } function a(e, t) { if (!e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return !t || "object" != typeof t && "function" != typeof t ? e : t; } function u(e, t) { if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function, not " + typeof t); e.prototype = Object.create(t && t.prototype, { "constructor": { "value": e, "enumerable": !1, "writable": !0, "configurable": !0 } }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t); } Object.defineProperty(t, "__esModule", { "value": !0 }); var c = Object.assign || function(e) { for (var t = 1; t < arguments.length; t++) { var n = arguments[t]; for (var r in n) Object.prototype.hasOwnProperty.call(n, r) && (e[r] = n[r]); } return e; }, f = function() { function e(e, t) { for (var n = 0; n < t.length; n++) { var r = t[n]; r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r); } } return function(t, n, r) { return n && e(t.prototype, n), r && e(t, r), t; }; }(), s = n(2), l = r(s), p = n(3), y = r(p), d = n(4), v = r(d); n(5); var b = function(e) { function t() { var e, n, r, o; i(this, t); for (var u = arguments.length, c = Array(u), f = 0; f < u; f++) c[f] = arguments[f]; return n = r = a(this, (e = t.__proto__ || Object.getPrototypeOf(t)).call.apply(e, [ this ].concat(c))), r.state = { "visible": !0 }, r.close = function() { var e = r.props, t = e.onClose, n = e.afterClose; "function" == typeof t && t(), r.setState({ "visible": !1 }, function() { "function" == typeof n && n(); }); }, o = n, a(r, o); } return u(t, e), f(t, [ { "key": "render", "value": function() { var e = this.props, t = e.closable, n = e.icon, r = e.message, i = e.showIcon, a = e.type, u = e.className, f = o(e, [ "closable", "icon", "message", "showIcon", "type", "className" ]), s = this.state.visible, p = i ? l.default.createElement(v.default, { "type": n || a, "className": "eui-alert-icon" }) : null, d = t ? l.default.createElement(v.default, { "type": "close", "className": "eui-alert-close", "onClick": this.close }) : null; return l.default.createElement("div", c({}, f, { "className": (0, y.default)("eui-alert", "eui-alert-" + a, u, { "eui-alert-hidden": !s }) }), p, l.default.createElement("div", { "className": "eui-alert-body" }, r), d); } } ]), t; }(s.Component); b.propTypes = { "afterClose": s.PropTypes.func, "closable": s.PropTypes.bool, "icon": s.PropTypes.string, "message": s.PropTypes.node, "showIcon": s.PropTypes.bool, "type": s.PropTypes.oneOf([ "info", "success", "warning", "error" ]), "onClose": s.PropTypes.func }, b.defaultProps = { "afterClose": function(e) {}, "closable": !1, "icon": "", "message": null, "showIcon": !1, "type": "info", "onClose": function(e) {} }, t.default = b; }, function(t, n) { t.exports = e; }, function(e, t, n) { var r, o; /*! Copyright (c) 2017 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames */ !function() { "use strict"; function n() { for (var e = [], t = 0; t < arguments.length; t++) { var r = arguments[t]; if (r) { var o = typeof r; if ("string" === o || "number" === o) e.push(r); else if (Array.isArray(r) && r.length) { var a = n.apply(null, r); a && e.push(a); } else if ("object" === o) for (var u in r) i.call(r, u) && r[u] && e.push(u); } } return e.join(" "); } var i = {}.hasOwnProperty; "undefined" != typeof e && e.exports ? (n.default = n, e.exports = n) : (r = [], o = function() { return n; }.apply(t, r), !(void 0 !== o && (e.exports = o))); }(); }, function(e, t, n) { !function(t, r) { e.exports = r(n(2)); }(this, function(e) { return function(e) { function t(r) { if (n[r]) return n[r].exports; var o = n[r] = { "exports": {}, "id": r, "loaded": !1 }; return e[r].call(o.exports, o, o.exports, t), o.loaded = !0, o.exports; } var n = {}; return t.m = e, t.c = n, t.p = "/", t(0); }([ function(e, t, n) { "use strict"; function r(e) { return e && e.__esModule ? e : { "default": e }; } var o = n(1), i = r(o); e.exports = i.default; }, function(e, t, n) { "use strict"; function r(e) { return e && e.__esModule ? e : { "default": e }; } function o(e, t, n) { return t in e ? Object.defineProperty(e, t, { "value": n, "enumerable": !0, "configurable": !0, "writable": !0 }) : e[t] = n, e; } function i(e, t) { var n = {}; for (var r in e) t.indexOf(r) >= 0 || Object.prototype.hasOwnProperty.call(e, r) && (n[r] = e[r]); return n; } function a(e, t) { if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function"); } function u(e, t) { if (!e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return !t || "object" != typeof t && "function" != typeof t ? e : t; } function c(e, t) { if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function, not " + typeof t); e.prototype = Object.create(t && t.prototype, { "constructor": { "value": e, "enumerable": !1, "writable": !0, "configurable": !0 } }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t); } Object.defineProperty(t, "__esModule", { "value": !0 }); var f = Object.assign || function(e) { for (var t = 1; t < arguments.length; t++) { var n = arguments[t]; for (var r in n) Object.prototype.hasOwnProperty.call(n, r) && (e[r] = n[r]); } return e; }, s = function() { function e(e, t) { for (var n = 0; n < t.length; n++) { var r = t[n]; r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r); } } return function(t, n, r) { return n && e(t.prototype, n), r && e(t, r), t; }; }(), l = n(2), p = r(l), y = n(3), d = r(y), v = n(4), b = r(v); n(11); var h = p.default.Component, m = function(e) { function t() { return a(this, t), u(this, (t.__proto__ || Object.getPrototypeOf(t)).apply(this, arguments)); } return c(t, e), s(t, [ { "key": "render", "value": function() { var e = this.props, t = e.type, n = e.style, r = e.className, a = e.prefixCls, u = i(e, [ "type", "style", "className", "prefixCls" ]); return p.default.createElement("i", f({ "className": (0, d.default)(o({}, "" + a, !0), "icon iconfont", o({}, "icon-" + t, !!t), o({}, r, !!r)), "style": n }, u)); } } ]), t; }(h); m.displayName = "eui-icon", m.propTypes = { "type": b.default.string, "style": b.default.object, "className": b.default.string, "prefixCls": b.default.string }, m.defaultProps = { "type": "", "style": {}, "className": "", "prefixCls": "eui-icon" }, t.default = m; }, function(t, n) { t.exports = e; }, function(e, t, n) { var r, o; /*! Copyright (c) 2017 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames */ !function() { "use strict"; function n() { for (var e = [], t = 0; t < arguments.length; t++) { var r = arguments[t]; if (r) { var o = typeof r; if ("string" === o || "number" === o) e.push(r); else if (Array.isArray(r) && r.length) { var a = n.apply(null, r); a && e.push(a); } else if ("object" === o) for (var u in r) i.call(r, u) && r[u] && e.push(u); } } return e.join(" "); } var i = {}.hasOwnProperty; "undefined" != typeof e && e.exports ? (n.default = n, e.exports = n) : (r = [], o = function() { return n; }.apply(t, r), !(void 0 !== o && (e.exports = o))); }(); }, function(e, t, n) { (function(t) { if ("production" !== t.env.NODE_ENV) { var r = "function" == typeof Symbol && Symbol.for && Symbol.for("react.element") || 60103, o = function(e) { return "object" == typeof e && null !== e && e.$$typeof === r; }, i = !0; e.exports = n(6)(o, i); } else e.exports = n(10)(); }).call(t, n(5)); }, function(e, t) { function n() { throw new Error("setTimeout has not been defined"); } function r() { throw new Error("clearTimeout has not been defined"); } function o(e) { if (s === setTimeout) return setTimeout(e, 0); if ((s === n || !s) && setTimeout) return s = setTimeout, setTimeout(e, 0); try { return s(e, 0); } catch (t) { try { return s.call(null, e, 0); } catch (t) { return s.call(this, e, 0); } } } function i(e) { if (l === clearTimeout) return clearTimeout(e); if ((l === r || !l) && clearTimeout) return l = clearTimeout, clearTimeout(e); try { return l(e); } catch (t) { try { return l.call(null, e); } catch (t) { return l.call(this, e); } } } function a() { v && y && (v = !1, y.length ? d = y.concat(d) : b = -1, d.length && u()); } function u() { if (!v) { var e = o(a); v = !0; for (var t = d.length; t; ) { for (y = d, d = []; ++b < t; ) y && y[b].run(); b = -1, t = d.length; } y = null, v = !1, i(e); } } function c(e, t) { this.fun = e, this.array = t; } function f() {} var s, l, p = e.exports = {}; !function() { try { s = "function" == typeof setTimeout ? setTimeout : n; } catch (e) { s = n; } try { l = "function" == typeof clearTimeout ? clearTimeout : r; } catch (e) { l = r; } }(); var y, d = [], v = !1, b = -1; p.nextTick = function(e) { var t = new Array(arguments.length - 1); if (arguments.length > 1) for (var n = 1; n < arguments.length; n++) t[n - 1] = arguments[n]; d.push(new c(e, t)), 1 !== d.length || v || o(u); }, c.prototype.run = function() { this.fun.apply(null, this.array); }, p.title = "browser", p.browser = !0, p.env = {}, p.argv = [], p.version = "", p.versions = {}, p.on = f, p.addListener = f, p.once = f, p.off = f, p.removeListener = f, p.removeAllListeners = f, p.emit = f, p.prependListener = f, p.prependOnceListener = f, p.listeners = function(e) { return []; }, p.binding = function(e) { throw new Error("process.binding is not supported"); }, p.cwd = function() { return "/"; }, p.chdir = function(e) { throw new Error("process.chdir is not supported"); }, p.umask = function() { return 0; }; }, function(e, t, n) { (function(t) { "use strict"; function r() { return null; } var o = n(7), i = n(8), a = n(9), u = function() {}; "production" !== t.env.NODE_ENV && (u = function(e) { var t = "Warning: " + e; "undefined" != typeof console && console.error(t); try { throw new Error(t); } catch (n) {} }), e.exports = function(e, n) { function c(e) { var t = e && (k && e[k] || e[I]); if ("function" == typeof t) return t; } function f(e, t) { return e === t ? 0 !== e || 1 / e === 1 / t : e !== e && t !== t; } function s(e) { this.message = e, this.stack = ""; } function l(e) { function r(r, c, f, l, p, y, d) { if (l = l || S, y = y || f, d !== i) { if (n) { var v = new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types"); throw v.name = "Invariant Violation", v; } if ("production" !== t.env.NODE_ENV && "undefined" != typeof console) { var b = l + ":" + f; !o[b] && a < 3 && (u("You are manually calling a React.PropTypes validation function for the `" + y + "` prop on `" + l + "`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."), o[b] = !0, a++); } } return null == c[f] ? r ? new s(null === c[f] ? "The " + p + " `" + y + "` is marked as required " + ("in `" + l + "`, but its value is `null`.") : "The " + p + " `" + y + "` is marked as required in " + ("`" + l + "`, but its value is `undefined`.")) : null : e(c, f, l, p, y); } if ("production" !== t.env.NODE_ENV) var o = {}, a = 0; var c = r.bind(null, !1); return c.isRequired = r.bind(null, !0), c; } function p(e) { function t(t, n, r, o, i, a) { var u = t[n], c = E(u); if (c !== e) { var f = P(u); return new s("Invalid " + o + " `" + i + "` of type " + ("`" + f + "` supplied to `" + r + "`, expected ") + ("`" + e + "`.")); } return null; } return l(t); } function y() { return l(r); } function d(e) { function t(t, n, r, o, a) { if ("function" != typeof e) return new s("Property `" + a + "` of component `" + r + "` has invalid PropType notation inside arrayOf."); var u = t[n]; if (!Array.isArray(u)) { var c = E(u); return new s("Invalid " + o + " `" + a + "` of type " + ("`" + c + "` supplied to `" + r + "`, expected an array.")); } for (var f = 0; f < u.length; f++) { var l = e(u, f, r, o, a + "[" + f + "]", i); if (l instanceof Error) return l; } return null; } return l(t); } function v() { function t(t, n, r, o, i) { var a = t[n]; if (!e(a)) { var u = E(a); return new s("Invalid " + o + " `" + i + "` of type " + ("`" + u + "` supplied to `" + r + "`, expected a single ReactElement.")); } return null; } return l(t); } function b(e) { function t(t, n, r, o, i) { if (!(t[n] instanceof e)) { var a = e.name || S, u = N(t[n]); return new s("Invalid " + o + " `" + i + "` of type " + ("`" + u + "` supplied to `" + r + "`, expected ") + ("instance of `" + a + "`.")); } return null; } return l(t); } function h(e) { function n(t, n, r, o, i) { for (var a = t[n], u = 0; u < e.length; u++) if (f(a, e[u])) return null; var c = JSON.stringify(e); return new s("Invalid " + o + " `" + i + "` of value `" + a + "` " + ("supplied to `" + r + "`, expected one of " + c + ".")); } return Array.isArray(e) ? l(n) : ("production" !== t.env.NODE_ENV ? u("Invalid argument supplied to oneOf, expected an instance of array.") : void 0, r); } function m(e) { function t(t, n, r, o, a) { if ("function" != typeof e) return new s("Property `" + a + "` of component `" + r + "` has invalid PropType notation inside objectOf."); var u = t[n], c = E(u); if ("object" !== c) return new s("Invalid " + o + " `" + a + "` of type " + ("`" + c + "` supplied to `" + r + "`, expected an object.")); for (var f in u) if (u.hasOwnProperty(f)) { var l = e(u, f, r, o, a + "." + f, i); if (l instanceof Error) return l; } return null; } return l(t); } function g(e) { function n(t, n, r, o, a) { for (var u = 0; u < e.length; u++) { var c = e[u]; if (null == c(t, n, r, o, a, i)) return null; } return new s("Invalid " + o + " `" + a + "` supplied to " + ("`" + r + "`.")); } if (!Array.isArray(e)) return "production" !== t.env.NODE_ENV ? u("Invalid argument supplied to oneOfType, expected an instance of array.") : void 0, r; for (var o = 0; o < e.length; o++) { var a = e[o]; if ("function" != typeof a) return u("Invalid argument supplied to oneOfType. Expected an array of check functions, but received " + _(a) + " at index " + o + "."), r; } return l(n); } function O() { function e(e, t, n, r, o) { return x(e[t]) ? null : new s("Invalid " + r + " `" + o + "` supplied to " + ("`" + n + "`, expected a ReactNode.")); } return l(e); } function w(e) { function t(t, n, r, o, a) { var u = t[n], c = E(u); if ("object" !== c) return new s("Invalid " + o + " `" + a + "` of type `" + c + "` " + ("supplied to `" + r + "`, expected `object`.")); for (var f in e) { var l = e[f]; if (l) { var p = l(u, f, r, o, a + "." + f, i); if (p) return p; } } return null; } return l(t); } function j(e) { function t(t, n, r, a, u) { var c = t[n], f = E(c); if ("object" !== f) return new s("Invalid " + a + " `" + u + "` of type `" + f + "` " + ("supplied to `" + r + "`, expected `object`.")); var l = o({}, t[n], e); for (var p in l) { var y = e[p]; if (!y) return new s("Invalid " + a + " `" + u + "` key `" + p + "` supplied to `" + r + "`.\nBad object: " + JSON.stringify(t[n], null, " ") + "\nValid keys: " + JSON.stringify(Object.keys(e), null, " ")); var d = y(c, p, r, a, u + "." + p, i); if (d) return d; } return null; } return l(t); } function x(t) { switch (typeof t) { case "number": case "string": case "undefined": return !0; case "boolean": return !t; case "object": if (Array.isArray(t)) return t.every(x); if (null === t || e(t)) return !0; var n = c(t); if (!n) return !1; var r, o = n.call(t); if (n !== t.entries) { for (;!(r = o.next()).done; ) if (!x(r.value)) return !1; } else for (;!(r = o.next()).done; ) { var i = r.value; if (i && !x(i[1])) return !1; } return !0; default: return !1; } } function T(e, t) { return "symbol" === e || "Symbol" === t["@@toStringTag"] || "function" == typeof Symbol && t instanceof Symbol; } function E(e) { var t = typeof e; return Array.isArray(e) ? "array" : e instanceof RegExp ? "object" : T(t, e) ? "symbol" : t; } function P(e) { if ("undefined" == typeof e || null === e) return "" + e; var t = E(e); if ("object" === t) { if (e instanceof Date) return "date"; if (e instanceof RegExp) return "regexp"; } return t; } function _(e) { var t = P(e); switch (t) { case "array": case "object": return "an " + t; case "boolean": case "date": case "regexp": return "a " + t; default: return t; } } function N(e) { return e.constructor && e.constructor.name ? e.constructor.name : S; } var k = "function" == typeof Symbol && Symbol.iterator, I = "@@iterator", S = "<<anonymous>>", C = { "array": p("array"), "bool": p("boolean"), "func": p("function"), "number": p("number"), "object": p("object"), "string": p("string"), "symbol": p("symbol"), "any": y(), "arrayOf": d, "element": v(), "instanceOf": b, "node": O(), "objectOf": m, "oneOf": h, "oneOfType": g, "shape": w, "exact": j }; return s.prototype = Error.prototype, C.checkPropTypes = a, C.PropTypes = C, C; }; }).call(t, n(5)); }, function(e, t) { /* object-assign (c) Sindre Sorhus @license MIT */ "use strict"; function n(e) { if (null === e || void 0 === e) throw new TypeError("Object.assign cannot be called with null or undefined"); return Object(e); } function r() { try { if (!Object.assign) return !1; var e = new String("abc"); if (e[5] = "de", "5" === Object.getOwnPropertyNames(e)[0]) return !1; for (var t = {}, n = 0; n < 10; n++) t["_" + String.fromCharCode(n)] = n; var r = Object.getOwnPropertyNames(t).map(function(e) { return t[e]; }); if ("0123456789" !== r.join("")) return !1; var o = {}; return "abcdefghijklmnopqrst".split("").forEach(function(e) { o[e] = e; }), "abcdefghijklmnopqrst" === Object.keys(Object.assign({}, o)).join(""); } catch (i) { return !1; } } var o = Object.getOwnPropertySymbols, i = Object.prototype.hasOwnProperty, a = Object.prototype.propertyIsEnumerable; e.exports = r() ? Object.assign : function(e, t) { for (var r, u, c = n(e), f = 1; f < arguments.length; f++) { r = Object(arguments[f]); for (var s in r) i.call(r, s) && (c[s] = r[s]); if (o) { u = o(r); for (var l = 0; l < u.length; l++) a.call(r, u[l]) && (c[u[l]] = r[u[l]]); } } return c; }; }, function(e, t) { "use strict"; var n = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"; e.exports = n; }, function(e, t, n) { (function(t) { "use strict"; function r(e, n, r, u, c) { if ("production" !== t.env.NODE_ENV) for (var f in e) if (e.hasOwnProperty(f)) { var s; try { if ("function" != typeof e[f]) { var l = Error((u || "React class") + ": " + r + " type `" + f + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[f] + "`."); throw l.name = "Invariant Violation", l; } s = e[f](n, f, u, r, null, i); } catch (p) { s = p; } if (!s || s instanceof Error || o((u || "React class") + ": type specification of " + r + " `" + f + "` is invalid; the type checker function must return `null` or an `Error` but returned a " + typeof s + ". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."), s instanceof Error && !(s.message in a)) { a[s.message] = !0; var y = c ? c() : ""; o("Failed " + r + " type: " + s.message + (null != y ? y : "")); } } } var o = function() {}; if ("production" !== t.env.NODE_ENV) { var i = n(8), a = {}; o = function(e) { var t = "Warning: " + e; "undefined" != typeof console && console.error(t); try { throw new Error(t); } catch (n) {} }; } e.exports = r; }).call(t, n(5)); }, function(e, t, n) { "use strict"; function r() {} var o = n(8); e.exports = function() { function e(e, t, n, r, i, a) { if (a !== o) { var u = new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types"); throw u.name = "Invariant Violation", u; } } function t() { return e; } e.isRequired = e; var n = { "array": e, "bool": e, "func": e, "number": e, "object": e, "string": e, "symbol": e, "any": e, "arrayOf": t, "element": e, "instanceOf": t, "node": e, "objectOf": t, "oneOf": t, "oneOfType": t, "shape": t, "exact": t }; return n.checkPropTypes = r, n.PropTypes = n, n; }; }, function(e, t) {} ]); }); }, function(e, t) {} ]); });