@notificationapi/react 0.0.14 → 0.0.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { jsxs as lt, jsx as ae } from "react/jsx-runtime";
1
+ import { jsxs as lt, jsx as oe } from "react/jsx-runtime";
2
2
  import * as q from "react";
3
3
  import ie, { useRef as Qe, useDebugValue as er, createElement as uo, useContext as co, useMemo as ye, useCallback as fo, useState as lo, useEffect as tr } from "react";
4
4
  import { S as po, U as N, V as le, W as B, X as U, Y as mo, Z as pt, $ as Me, a0 as pe, a1 as ho, a2 as dn, a3 as yo, a4 as go, a5 as mn, a6 as me, a7 as vo, a8 as bo, a9 as Te, aa as rr, ab as nr, h as wo, ac as So, g as Oo, m as To, r as xo, u as Eo, p as Po, a as hn, j as Ao, c as St, b as Ro, ad as Co, ae as $o, af as ko, ag as Do, ah as Io, ai as yn, aj as gn, ak as vn } from "./colors.js";
@@ -436,16 +436,16 @@ const Qo = (e, t) => {
436
436
  } = e, Z = Zo(e, ["prefixCls", "shape", "size", "src", "srcSet", "icon", "className", "rootClassName", "alt", "draggable", "children", "crossOrigin"]), Y = _o((g) => {
437
437
  var w, C;
438
438
  return (C = (w = M ?? (y == null ? void 0 : y.size)) !== null && w !== void 0 ? w : g) !== null && C !== void 0 ? C : "default";
439
- }), Q = Object.keys(typeof Y == "object" ? Y || {} : {}).some((g) => ["xs", "sm", "md", "lg", "xl", "xxl"].includes(g)), oe = Go(Q), X = q.useMemo(() => {
439
+ }), Q = Object.keys(typeof Y == "object" ? Y || {} : {}).some((g) => ["xs", "sm", "md", "lg", "xl", "xxl"].includes(g)), ae = Go(Q), X = q.useMemo(() => {
440
440
  if (typeof Y != "object")
441
441
  return {};
442
- const g = Sn.find((C) => oe[C]), w = Y[g];
442
+ const g = Sn.find((C) => ae[C]), w = Y[g];
443
443
  return w ? {
444
444
  width: w,
445
445
  height: w,
446
446
  fontSize: w && (f || ee) ? w / 2 : 18
447
447
  } : {};
448
- }, [oe, Y]);
448
+ }, [ae, Y]);
449
449
  if (process.env.NODE_ENV !== "production") {
450
450
  const g = Ao("Avatar");
451
451
  process.env.NODE_ENV !== "production" && g(!(typeof f == "string" && f.length > 2), "breaking", `\`icon\` is using ReactNode instead of string naming in v4. Please check \`${f}\` at https://ant.design/components/icon`);
@@ -1142,9 +1142,9 @@ function qa(e, t, r) {
1142
1142
  var k = new Ua(r, b, n ? o.componentStyle : void 0);
1143
1143
  function M(x, f) {
1144
1144
  return function(D, V, W) {
1145
- var K = D.attrs, ee = D.componentStyle, re = D.defaultProps, Z = D.foldedComponentIds, Y = D.styledComponentId, Q = D.target, oe = ie.useContext(Fn), X = mr(), L = D.shouldForwardProp || X.shouldForwardProp;
1145
+ var K = D.attrs, ee = D.componentStyle, re = D.defaultProps, Z = D.foldedComponentIds, Y = D.styledComponentId, Q = D.target, ae = ie.useContext(Fn), X = mr(), L = D.shouldForwardProp || X.shouldForwardProp;
1146
1146
  process.env.NODE_ENV !== "production" && er(Y);
1147
- var J = sa(V, oe, re) || Ce, H = function(_, $, A) {
1147
+ var J = sa(V, ae, re) || Ce, H = function(_, $, A) {
1148
1148
  for (var g, w = te(te({}, $), { className: void 0, theme: A }), C = 0; C < _.length; C += 1) {
1149
1149
  var G = $e(g = _[C]) ? g(w) : g;
1150
1150
  for (var d in G)
@@ -3408,7 +3408,7 @@ function ms() {
3408
3408
  }
3409
3409
  }
3410
3410
  }
3411
- var f = c, D = l, V = s, W = i, K = t, ee = m, re = n, Z = E, Y = y, Q = r, oe = a, X = o, L = v, J = !1;
3411
+ var f = c, D = l, V = s, W = i, K = t, ee = m, re = n, Z = E, Y = y, Q = r, ae = a, X = o, L = v, J = !1;
3412
3412
  function H(d) {
3413
3413
  return J || (J = !0, console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")), p(d) || x(d) === c;
3414
3414
  }
@@ -3448,7 +3448,7 @@ function ms() {
3448
3448
  function G(d) {
3449
3449
  return x(d) === v;
3450
3450
  }
3451
- z.AsyncMode = f, z.ConcurrentMode = D, z.ContextConsumer = V, z.ContextProvider = W, z.Element = K, z.ForwardRef = ee, z.Fragment = re, z.Lazy = Z, z.Memo = Y, z.Portal = Q, z.Profiler = oe, z.StrictMode = X, z.Suspense = L, z.isAsyncMode = H, z.isConcurrentMode = p, z.isContextConsumer = h, z.isContextProvider = T, z.isElement = P, z.isForwardRef = R, z.isFragment = _, z.isLazy = $, z.isMemo = A, z.isPortal = g, z.isProfiler = w, z.isStrictMode = C, z.isSuspense = G, z.isValidElementType = O, z.typeOf = x;
3451
+ z.AsyncMode = f, z.ConcurrentMode = D, z.ContextConsumer = V, z.ContextProvider = W, z.Element = K, z.ForwardRef = ee, z.Fragment = re, z.Lazy = Z, z.Memo = Y, z.Portal = Q, z.Profiler = ae, z.StrictMode = X, z.Suspense = L, z.isAsyncMode = H, z.isConcurrentMode = p, z.isContextConsumer = h, z.isContextProvider = T, z.isElement = P, z.isForwardRef = R, z.isFragment = _, z.isLazy = $, z.isMemo = A, z.isPortal = g, z.isProfiler = w, z.isStrictMode = C, z.isSuspense = G, z.isValidElementType = O, z.typeOf = x;
3452
3452
  }()), z;
3453
3453
  }
3454
3454
  var Qr;
@@ -3738,12 +3738,12 @@ Valid keys: ` + JSON.stringify(Object.keys(p), null, " ")
3738
3738
  return !1;
3739
3739
  }
3740
3740
  }
3741
- function oe(p, h) {
3741
+ function ae(p, h) {
3742
3742
  return p === "symbol" ? !0 : h ? h["@@toStringTag"] === "Symbol" || typeof Symbol == "function" && h instanceof Symbol : !1;
3743
3743
  }
3744
3744
  function X(p) {
3745
3745
  var h = typeof p;
3746
- return Array.isArray(p) ? "array" : p instanceof RegExp ? "object" : oe(h, p) ? "symbol" : h;
3746
+ return Array.isArray(p) ? "array" : p instanceof RegExp ? "object" : ae(h, p) ? "symbol" : h;
3747
3747
  }
3748
3748
  function L(p) {
3749
3749
  if (typeof p > "u" || p === null)
@@ -4293,11 +4293,11 @@ function ru(e) {
4293
4293
  Y(H);
4294
4294
  }
4295
4295
  }, [x]);
4296
- var oe = ye(function() {
4296
+ var ae = ye(function() {
4297
4297
  return Is(M, m);
4298
4298
  }, [M, m]), X = ye(function() {
4299
- return c ? c(t) : oe(t);
4300
- }, [t, c, oe]);
4299
+ return c ? c(t) : ae(t);
4300
+ }, [t, c, ae]);
4301
4301
  return {
4302
4302
  date: t,
4303
4303
  formattedDate: Z,
@@ -4510,7 +4510,7 @@ const pu = Un.div`
4510
4510
  width: "100%"
4511
4511
  },
4512
4512
  children: [
4513
- /* @__PURE__ */ ae("div", { children: /* @__PURE__ */ ae(
4513
+ /* @__PURE__ */ oe("div", { children: /* @__PURE__ */ oe(
4514
4514
  Tn,
4515
4515
  {
4516
4516
  src: e.notification.imageURL,
@@ -4529,13 +4529,14 @@ const pu = Un.div`
4529
4529
  flexGrow: 1
4530
4530
  },
4531
4531
  children: [
4532
- /* @__PURE__ */ ae("div", { children: /* @__PURE__ */ ae(or.Text, { children: /* @__PURE__ */ ae(
4532
+ /* @__PURE__ */ oe("div", { children: /* @__PURE__ */ oe(or.Text, { children: /* @__PURE__ */ oe(
4533
4533
  "span",
4534
4534
  {
4535
4535
  dangerouslySetInnerHTML: { __html: e.notification.title }
4536
4536
  }
4537
4537
  ) }) }),
4538
- /* @__PURE__ */ ae("div", { children: /* @__PURE__ */ ae(or.Text, { type: "secondary", style: { fontSize: 12 }, children: /* @__PURE__ */ ae(
4538
+ e.extraRenderer && /* @__PURE__ */ oe("div", { children: e.extraRenderer(e.notification) }),
4539
+ /* @__PURE__ */ oe("div", { children: /* @__PURE__ */ oe(or.Text, { type: "secondary", style: { fontSize: 12 }, children: /* @__PURE__ */ oe(
4539
4540
  st,
4540
4541
  {
4541
4542
  date: new Date(e.notification.date).getTime(),
@@ -4556,18 +4557,18 @@ const pu = Un.div`
4556
4557
  alignItems: "center"
4557
4558
  },
4558
4559
  children: [
4559
- /* @__PURE__ */ ae(
4560
+ /* @__PURE__ */ oe(
4560
4561
  Fo,
4561
4562
  {
4562
4563
  className: "notification-archive-button",
4563
- icon: /* @__PURE__ */ ae(Mo, {}),
4564
+ icon: /* @__PURE__ */ oe(Mo, {}),
4564
4565
  size: "small",
4565
4566
  type: "text",
4566
4567
  shape: "circle",
4567
4568
  onClick: (t) => (e.markAsArchived([e.notification.id]), t.preventDefault(), t.stopPropagation(), !1)
4568
4569
  }
4569
4570
  ),
4570
- /* @__PURE__ */ ae(
4571
+ /* @__PURE__ */ oe(
4571
4572
  zo,
4572
4573
  {
4573
4574
  dot: !0,
@@ -14,5 +14,6 @@ export type InboxProps = {
14
14
  pageSize: number;
15
15
  pagePosition: NotificationPopupProps["pagePosition"];
16
16
  notificationRenderer: ((notification: InAppNotification) => JSX.Element) | undefined;
17
+ notificationExtraRenderer: ((notification: InAppNotification) => JSX.Element) | undefined;
17
18
  };
18
19
  export declare const Inbox: React.FC<InboxProps>;
@@ -10,5 +10,6 @@ export type NotificationProps = {
10
10
  markAsClicked: (id: string) => void;
11
11
  imageShape: keyof typeof ImageShape;
12
12
  renderer?: (notification: InAppNotification) => JSX.Element;
13
+ extraRenderer?: (notification: InAppNotification) => JSX.Element;
13
14
  };
14
15
  export declare const Notification: (props: NotificationProps) => JSX.Element;
@@ -13,6 +13,7 @@ export type NotificationFeedProps = {
13
13
  filter?: keyof typeof Filter | ((n: InAppNotification) => boolean);
14
14
  renderers?: {
15
15
  notification?: NotificationProps["renderer"];
16
+ notificationExtra?: NotificationProps["extraRenderer"];
16
17
  };
17
18
  };
18
19
  export declare const NotificationFeed: React.FC<NotificationFeedProps>;
@@ -1,28 +1,29 @@
1
- import { jsx as o } from "react/jsx-runtime";
2
- import { useContext as r, useEffect as g } from "react";
3
- import { F as f, I as l } from "../../assets/Inbox.js";
4
- import { NotificationAPIContext as c } from "../Provider/index.js";
1
+ import { jsx as a } from "react/jsx-runtime";
2
+ import { useContext as f, useEffect as c } from "react";
3
+ import { F as g, I as l } from "../../assets/Inbox.js";
4
+ import { NotificationAPIContext as d } from "../Provider/index.js";
5
5
  const h = (i) => {
6
- var n;
6
+ var n, o;
7
7
  const e = {
8
8
  imageShape: i.imageShape || "circle",
9
9
  pagination: i.pagination || "INFINITE_SCROLL",
10
10
  pageSize: i.pageSize || 10,
11
11
  pagePosition: i.pagePosition || "top",
12
12
  style: i.style || {},
13
- filter: i.filter || f.ALL,
13
+ filter: i.filter || g.ALL,
14
14
  infiniteScrollHeight: i.infiniteScrollHeight ? i.infiniteScrollHeight : window.innerHeight * 0.75,
15
15
  renderers: {
16
- notification: (n = i.renderers) == null ? void 0 : n.notification
16
+ notification: (n = i.renderers) == null ? void 0 : n.notification,
17
+ notificationExtra: (o = i.renderers) == null ? void 0 : o.notificationExtra
17
18
  }
18
- }, t = r(c);
19
- return t ? (g(() => {
19
+ }, t = f(d);
20
+ return t ? (c(() => {
20
21
  t.markAsOpened();
21
- const a = setInterval(() => {
22
+ const r = setInterval(() => {
22
23
  t.markAsOpened();
23
24
  }, 5e3);
24
- return () => clearInterval(a);
25
- }, []), /* @__PURE__ */ o(
25
+ return () => clearInterval(r);
26
+ }, []), /* @__PURE__ */ a(
26
27
  "div",
27
28
  {
28
29
  style: {
@@ -31,7 +32,7 @@ const h = (i) => {
31
32
  background: "#fff",
32
33
  ...i.style
33
34
  },
34
- children: /* @__PURE__ */ o(
35
+ children: /* @__PURE__ */ a(
35
36
  l,
36
37
  {
37
38
  maxHeight: e.infiniteScrollHeight,
@@ -40,7 +41,8 @@ const h = (i) => {
40
41
  imageShape: e.imageShape,
41
42
  pageSize: e.pageSize,
42
43
  pagePosition: e.pagePosition,
43
- notificationRenderer: e.renderers.notification
44
+ notificationRenderer: e.renderers.notification,
45
+ notificationExtraRenderer: e.renderers.notificationExtra
44
46
  }
45
47
  )
46
48
  }
@@ -1,14 +1,14 @@
1
1
  import { jsx as i } from "react/jsx-runtime";
2
- import { I as r } from "../../assets/Inbox.js";
3
- import { UnreadBadge as f } from "./UnreadBadge.js";
4
- import { useContext as d } from "react";
2
+ import { I as f } from "../../assets/Inbox.js";
3
+ import { UnreadBadge as d } from "./UnreadBadge.js";
4
+ import { useContext as c } from "react";
5
5
  import { NotificationAPIContext as g } from "../Provider/index.js";
6
6
  import { P as u } from "../../assets/index.js";
7
- import { B as c } from "../../assets/button.js";
8
- import { R as h } from "../../assets/BellOutlined.js";
9
- var l = /* @__PURE__ */ ((t) => (t.TOP_LEFT = "top-left", t.TOP_RIGHT = "top-right", t.BOTTOM_LEFT = "bottom-left", t.BOTTOM_RIGHT = "bottom-right", t))(l || {});
7
+ import { B as h } from "../../assets/button.js";
8
+ import { R as l } from "../../assets/BellOutlined.js";
9
+ var m = /* @__PURE__ */ ((t) => (t.TOP_LEFT = "top-left", t.TOP_RIGHT = "top-right", t.BOTTOM_LEFT = "bottom-left", t.BOTTOM_RIGHT = "bottom-right", t))(m || {});
10
10
  const y = (t) => {
11
- var n;
11
+ var n, a;
12
12
  const e = {
13
13
  buttonWidth: t.buttonWidth || 40,
14
14
  buttonHeight: t.buttonHeight || 40,
@@ -30,9 +30,10 @@ const y = (t) => {
30
30
  count: t.count || "COUNT_UNOPENED_NOTIFICATIONS",
31
31
  filter: t.filter || "ALL",
32
32
  renderers: {
33
- notification: (n = t.renderers) == null ? void 0 : n.notification
33
+ notification: (n = t.renderers) == null ? void 0 : n.notification,
34
+ notificationExtra: (a = t.renderers) == null ? void 0 : a.notificationExtra
34
35
  }
35
- }, o = d(g);
36
+ }, o = c(g);
36
37
  return o ? /* @__PURE__ */ i(
37
38
  "div",
38
39
  {
@@ -48,7 +49,7 @@ const y = (t) => {
48
49
  autoAdjustOverflow: !0,
49
50
  trigger: "click",
50
51
  content: /* @__PURE__ */ i(
51
- r,
52
+ f,
52
53
  {
53
54
  maxHeight: 500,
54
55
  pagination: e.pagination,
@@ -56,7 +57,8 @@ const y = (t) => {
56
57
  imageShape: e.imageShape,
57
58
  pageSize: e.pageSize,
58
59
  pagePosition: e.pagePosition,
59
- notificationRenderer: e.renderers.notification
60
+ notificationRenderer: e.renderers.notification,
61
+ notificationExtraRenderer: e.renderers.notificationExtra
60
62
  }
61
63
  ),
62
64
  arrow: !1,
@@ -64,8 +66,8 @@ const y = (t) => {
64
66
  padding: "0 16px",
65
67
  minWidth: e.popupWidth
66
68
  },
67
- onOpenChange: (a) => {
68
- a && o.markAsOpened();
69
+ onOpenChange: (r) => {
70
+ r && o.markAsOpened();
69
71
  },
70
72
  children: /* @__PURE__ */ i(
71
73
  "div",
@@ -74,7 +76,7 @@ const y = (t) => {
74
76
  display: "inline-block"
75
77
  },
76
78
  children: /* @__PURE__ */ i(
77
- f,
79
+ d,
78
80
  {
79
81
  ...t.unreadBadgeProps,
80
82
  style: {
@@ -83,10 +85,10 @@ const y = (t) => {
83
85
  },
84
86
  count: e.count,
85
87
  children: /* @__PURE__ */ i(
86
- c,
88
+ h,
87
89
  {
88
90
  icon: /* @__PURE__ */ i(
89
- h,
91
+ l,
90
92
  {
91
93
  style: {
92
94
  fontSize: e.buttonIconSize
@@ -112,5 +114,5 @@ const y = (t) => {
112
114
  };
113
115
  export {
114
116
  y as NotificationLauncher,
115
- l as Position
117
+ m as Position
116
118
  };
@@ -23,6 +23,7 @@ export type NotificationPopupProps = {
23
23
  filter?: keyof typeof Filter | ((n: InAppNotification) => boolean);
24
24
  renderers?: {
25
25
  notification?: NotificationProps["renderer"];
26
+ notificationExtra?: NotificationProps["extraRenderer"];
26
27
  };
27
28
  };
28
29
  export declare const NotificationPopup: React.FC<NotificationPopupProps>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@notificationapi/react",
3
3
  "private": false,
4
- "version": "0.0.14",
4
+ "version": "0.0.16",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "dev": "vite",