@notificationapi/react 0.0.37 → 1.0.1

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.
Files changed (72) hide show
  1. package/dist/assets/Badge.js +456 -0
  2. package/dist/assets/Box.js +57 -0
  3. package/dist/assets/ButtonBase.js +1224 -0
  4. package/dist/assets/DefaultPropsProvider.js +4368 -0
  5. package/dist/assets/Divider.js +343 -0
  6. package/dist/assets/IconButton.js +225 -0
  7. package/dist/assets/Inbox.js +3051 -0
  8. package/dist/assets/InboxHeader.js +2338 -0
  9. package/dist/assets/Notification.js +5349 -7150
  10. package/dist/assets/NotificationPreferencesPopup.js +1694 -0
  11. package/dist/assets/Paper.js +154 -0
  12. package/dist/assets/Popover.js +451 -0
  13. package/dist/assets/Portal.js +110 -0
  14. package/dist/assets/PreferenceInput.js +1545 -1366
  15. package/dist/assets/Typography.js +292 -0
  16. package/dist/assets/WebPushOptInMessage.js +794 -407
  17. package/dist/assets/channelUtils.js +33 -65
  18. package/dist/assets/createSimplePaletteValueFilter.js +17 -0
  19. package/dist/assets/createSvgIcon.js +248 -0
  20. package/dist/assets/integerPropType.js +31 -0
  21. package/dist/assets/resolveComponentProps.js +93 -0
  22. package/dist/assets/style.css +1 -0
  23. package/dist/assets/useSlotProps.js +24 -0
  24. package/dist/assets/useTheme.js +10 -0
  25. package/dist/assets/useTheme2.js +16 -0
  26. package/dist/assets/utils.js +743 -0
  27. package/dist/components/Notifications/DefaultEmpty.d.ts +3 -0
  28. package/dist/components/Notifications/DefaultEmpty.js +7 -0
  29. package/dist/components/Notifications/Inbox.d.ts +4 -4
  30. package/dist/components/Notifications/Inbox.js +9 -6450
  31. package/dist/components/Notifications/InboxHeader.d.ts +1 -1
  32. package/dist/components/Notifications/InboxHeader.js +7 -53
  33. package/dist/components/Notifications/Notification.d.ts +3 -4
  34. package/dist/components/Notifications/Notification.js +6 -5
  35. package/dist/components/Notifications/NotificationCounter.js +16 -6
  36. package/dist/components/Notifications/NotificationFeed.d.ts +1 -2
  37. package/dist/components/Notifications/NotificationFeed.js +41 -38
  38. package/dist/components/Notifications/NotificationLauncher.d.ts +1 -0
  39. package/dist/components/Notifications/NotificationLauncher.js +100 -114
  40. package/dist/components/Notifications/NotificationPopup.d.ts +3 -4
  41. package/dist/components/Notifications/NotificationPopup.js +86 -88
  42. package/dist/components/Notifications/UnreadBadge.d.ts +7 -4
  43. package/dist/components/Notifications/UnreadBadge.js +28 -20
  44. package/dist/components/Notifications/interface.d.ts +0 -4
  45. package/dist/components/Notifications/interface.js +4 -5
  46. package/dist/components/Preferences/NotificationPreferencesInline.js +14 -14
  47. package/dist/components/Preferences/NotificationPreferencesPopup.js +7 -2068
  48. package/dist/components/Preferences/PreferenceInput.js +4 -3
  49. package/dist/components/Preferences/Preferences.js +1042 -547
  50. package/dist/components/Preferences/channelUtils.js +3 -4
  51. package/dist/components/Preferences/index.js +1 -1
  52. package/dist/components/Provider/context.d.ts +27 -0
  53. package/dist/components/Provider/context.js +7 -0
  54. package/dist/components/Provider/index.d.ts +2 -25
  55. package/dist/components/Provider/index.js +22 -24
  56. package/dist/components/WebPush/WebPushOptInMessage.js +3 -4
  57. package/dist/main.d.ts +1 -0
  58. package/dist/main.js +4 -4
  59. package/package.json +14 -12
  60. package/dist/assets/AntdIcon.js +0 -200
  61. package/dist/assets/CloseOutlined.js +0 -13
  62. package/dist/assets/PurePanel.js +0 -59
  63. package/dist/assets/RightOutlined.js +0 -13
  64. package/dist/assets/button.js +0 -1660
  65. package/dist/assets/colors.js +0 -36
  66. package/dist/assets/compact-item.js +0 -860
  67. package/dist/assets/index.js +0 -271
  68. package/dist/assets/index2.js +0 -647
  69. package/dist/assets/index3.js +0 -7527
  70. package/dist/assets/pickAttrs.js +0 -42
  71. package/dist/assets/presets.js +0 -810
  72. package/dist/assets/reactNode.js +0 -20821
@@ -1,5 +1,5 @@
1
1
  export type InboxHeaderProps = {
2
- title?: JSX.Element;
2
+ title?: React.ReactNode;
3
3
  button1ClickHandler?: (ids: string[] | 'ALL') => void;
4
4
  button2ClickHandler?: () => void;
5
5
  };
@@ -1,55 +1,9 @@
1
- import { jsx as t, jsxs as n } from "react/jsx-runtime";
2
- import { T as s, R as d } from "../../assets/index3.js";
3
- import { P as c } from "../../assets/index.js";
4
- import { B as a } from "../../assets/button.js";
5
- import { a as m } from "../../assets/presets.js";
6
- import * as i from "react";
7
- import { I as f } from "../../assets/AntdIcon.js";
8
- var u = { icon: { tag: "svg", attrs: { viewBox: "64 64 896 896", focusable: "false" }, children: [{ tag: "path", attrs: { d: "M924.8 625.7l-65.5-56c3.1-19 4.7-38.4 4.7-57.8s-1.6-38.8-4.7-57.8l65.5-56a32.03 32.03 0 009.3-35.2l-.9-2.6a443.74 443.74 0 00-79.7-137.9l-1.8-2.1a32.12 32.12 0 00-35.1-9.5l-81.3 28.9c-30-24.6-63.5-44-99.7-57.6l-15.7-85a32.05 32.05 0 00-25.8-25.7l-2.7-.5c-52.1-9.4-106.9-9.4-159 0l-2.7.5a32.05 32.05 0 00-25.8 25.7l-15.8 85.4a351.86 351.86 0 00-99 57.4l-81.9-29.1a32 32 0 00-35.1 9.5l-1.8 2.1a446.02 446.02 0 00-79.7 137.9l-.9 2.6c-4.5 12.5-.8 26.5 9.3 35.2l66.3 56.6c-3.1 18.8-4.6 38-4.6 57.1 0 19.2 1.5 38.4 4.6 57.1L99 625.5a32.03 32.03 0 00-9.3 35.2l.9 2.6c18.1 50.4 44.9 96.9 79.7 137.9l1.8 2.1a32.12 32.12 0 0035.1 9.5l81.9-29.1c29.8 24.5 63.1 43.9 99 57.4l15.8 85.4a32.05 32.05 0 0025.8 25.7l2.7.5a449.4 449.4 0 00159 0l2.7-.5a32.05 32.05 0 0025.8-25.7l15.7-85a350 350 0 0099.7-57.6l81.3 28.9a32 32 0 0035.1-9.5l1.8-2.1c34.8-41.1 61.6-87.5 79.7-137.9l.9-2.6c4.5-12.3.8-26.3-9.3-35zM788.3 465.9c2.5 15.1 3.8 30.6 3.8 46.1s-1.3 31-3.8 46.1l-6.6 40.1 74.7 63.9a370.03 370.03 0 01-42.6 73.6L721 702.8l-31.4 25.8c-23.9 19.6-50.5 35-79.3 45.8l-38.1 14.3-17.9 97a377.5 377.5 0 01-85 0l-17.9-97.2-37.8-14.5c-28.5-10.8-55-26.2-78.7-45.7l-31.4-25.9-93.4 33.2c-17-22.9-31.2-47.6-42.6-73.6l75.5-64.5-6.5-40c-2.4-14.9-3.7-30.3-3.7-45.5 0-15.3 1.2-30.6 3.7-45.5l6.5-40-75.5-64.5c11.3-26.1 25.6-50.7 42.6-73.6l93.4 33.2 31.4-25.9c23.7-19.5 50.2-34.9 78.7-45.7l37.9-14.3 17.9-97.2c28.1-3.2 56.8-3.2 85 0l17.9 97 38.1 14.3c28.7 10.8 55.4 26.2 79.3 45.8l31.4 25.8 92.8-32.9c17 22.9 31.2 47.6 42.6 73.6L781.8 426l6.5 39.9zM512 326c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm79.2 255.2A111.6 111.6 0 01512 614c-29.9 0-58-11.7-79.2-32.8A111.6 111.6 0 01400 502c0-29.9 11.7-58 32.8-79.2C454 401.6 482.1 390 512 390c29.9 0 58 11.6 79.2 32.8A111.6 111.6 0 01624 502c0 29.9-11.7 58-32.8 79.2z" } }] }, name: "setting", theme: "outlined" }, p = function(l, r) {
9
- return /* @__PURE__ */ i.createElement(f, m({}, l, {
10
- ref: r,
11
- icon: u
12
- }));
13
- }, o = /* @__PURE__ */ i.forwardRef(p);
14
- process.env.NODE_ENV !== "production" && (o.displayName = "SettingOutlined");
15
- const R = (e) => {
16
- const l = e.title ?? /* @__PURE__ */ t(s.Text, { strong: !0, children: "Notifications" });
17
- return /* @__PURE__ */ n(
18
- "div",
19
- {
20
- style: {
21
- display: "flex",
22
- justifyContent: "space-between",
23
- paddingRight: 5
24
- },
25
- children: [
26
- l,
27
- /* @__PURE__ */ n("div", { children: [
28
- /* @__PURE__ */ t(c, { content: "Resolve all", children: /* @__PURE__ */ t(
29
- a,
30
- {
31
- icon: /* @__PURE__ */ t(d, {}),
32
- size: "small",
33
- type: "text",
34
- onClick: () => {
35
- e.button1ClickHandler && e.button1ClickHandler("ALL");
36
- }
37
- }
38
- ) }),
39
- /* @__PURE__ */ t(c, { content: "Notification Preferences", children: /* @__PURE__ */ t(
40
- a,
41
- {
42
- icon: /* @__PURE__ */ t(o, {}),
43
- size: "small",
44
- type: "text",
45
- onClick: e.button2ClickHandler
46
- }
47
- ) })
48
- ] })
49
- ]
50
- }
51
- );
52
- };
1
+ import "react/jsx-runtime";
2
+ import "../../assets/Typography.js";
3
+ import "../../assets/Box.js";
4
+ import { I as a } from "../../assets/InboxHeader.js";
5
+ import "../../assets/IconButton.js";
6
+ import "../../assets/Divider.js";
53
7
  export {
54
- R as InboxHeader
8
+ a as InboxHeader
55
9
  };
@@ -1,11 +1,10 @@
1
+ import { ReactNode } from 'react';
1
2
  import { InAppNotification } from '@notificationapi/core/dist/interfaces';
2
- import { ImageShape } from './interface';
3
3
 
4
4
  export type NotificationProps = {
5
5
  notifications: InAppNotification[];
6
6
  markAsArchived: (ids: string[] | 'ALL') => void;
7
7
  markAsClicked: (ids: string[]) => void;
8
- imageShape: keyof typeof ImageShape;
9
- renderer?: (notification: InAppNotification[]) => JSX.Element;
8
+ renderer?: (notification: InAppNotification[]) => ReactNode;
10
9
  };
11
- export declare const Notification: (props: NotificationProps) => JSX.Element;
10
+ export declare const Notification: (props: NotificationProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,8 +1,9 @@
1
1
  import "react/jsx-runtime";
2
- import { N as a } from "../../assets/Notification.js";
3
- import "../../assets/index3.js";
4
- import "../../assets/button.js";
5
- import "../../assets/index2.js";
2
+ import { N as f } from "../../assets/Notification.js";
3
+ import "../../assets/DefaultPropsProvider.js";
4
+ import "../../assets/Typography.js";
5
+ import "../../assets/IconButton.js";
6
+ import "../../assets/Badge.js";
6
7
  export {
7
- a as Notification
8
+ f as Notification
8
9
  };
@@ -1,9 +1,19 @@
1
- import { jsx as n } from "react/jsx-runtime";
2
- import { UnreadBadge as r } from "./UnreadBadge.js";
3
- const e = (o) => {
4
- const t = o.count || "COUNT_UNOPENED_NOTIFICATIONS";
5
- return /* @__PURE__ */ n(r, { ...o, count: t });
1
+ import { jsx as r } from "react/jsx-runtime";
2
+ import { UnreadBadge as n } from "./UnreadBadge.js";
3
+ const N = (t) => {
4
+ const o = t.count || "COUNT_UNOPENED_NOTIFICATIONS";
5
+ return /* @__PURE__ */ r(
6
+ n,
7
+ {
8
+ ...t,
9
+ count: o,
10
+ offset: {
11
+ top: 0,
12
+ right: 0
13
+ }
14
+ }
15
+ );
6
16
  };
7
17
  export {
8
- e as NotificationCounter
18
+ N as NotificationCounter
9
19
  };
@@ -1,10 +1,9 @@
1
1
  import { NotificationProps } from './Notification';
2
2
  import { InboxHeaderProps } from './InboxHeader';
3
3
  import { InAppNotification } from '@notificationapi/core/dist/interfaces';
4
- import { Filter, ImageShape, Pagination } from './interface';
4
+ import { Filter, Pagination } from './interface';
5
5
 
6
6
  export type NotificationFeedProps = {
7
- imageShape?: keyof typeof ImageShape;
8
7
  pagination?: keyof typeof Pagination;
9
8
  pageSize?: number;
10
9
  pagePosition?: 'top' | 'bottom';
@@ -1,70 +1,73 @@
1
- import { jsxs as s, jsx as n } from "react/jsx-runtime";
2
- import { useState as d, useContext as m, useEffect as h } from "react";
3
- import { Inbox as u } from "./Inbox.js";
4
- import { NotificationAPIContext as p } from "../Provider/index.js";
5
- import { NotificationPreferencesPopup as x } from "../Preferences/NotificationPreferencesPopup.js";
6
- import { D as S } from "../../assets/PreferenceInput.js";
7
- import { W as I, R as b } from "../../assets/WebPushOptInMessage.js";
8
- import { Filter as P } from "./interface.js";
9
- const L = (e) => {
10
- var o, a, l, f;
11
- const [c, r] = d(!1), i = m(p);
1
+ import { jsx as n, jsxs as l } from "react/jsx-runtime";
2
+ import { useState as g, useContext as m, useEffect as h } from "react";
3
+ import { I as u } from "../../assets/Inbox.js";
4
+ import { NotificationAPIContext as p } from "../Provider/context.js";
5
+ import { N as x } from "../../assets/NotificationPreferencesPopup.js";
6
+ import { Filter as S } from "./interface.js";
7
+ import { W as I } from "../../assets/WebPushOptInMessage.js";
8
+ import { c as b } from "../../assets/createSvgIcon.js";
9
+ import { D as C } from "../../assets/Divider.js";
10
+ const H = b(/* @__PURE__ */ n("path", {
11
+ d: "M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2m6.93 6h-2.95c-.32-1.25-.78-2.45-1.38-3.56 1.84.63 3.37 1.91 4.33 3.56M12 4.04c.83 1.2 1.48 2.53 1.91 3.96h-3.82c.43-1.43 1.08-2.76 1.91-3.96M4.26 14C4.1 13.36 4 12.69 4 12s.1-1.36.26-2h3.38c-.08.66-.14 1.32-.14 2s.06 1.34.14 2zm.82 2h2.95c.32 1.25.78 2.45 1.38 3.56-1.84-.63-3.37-1.9-4.33-3.56m2.95-8H5.08c.96-1.66 2.49-2.93 4.33-3.56C8.81 5.55 8.35 6.75 8.03 8M12 19.96c-.83-1.2-1.48-2.53-1.91-3.96h3.82c-.43 1.43-1.08 2.76-1.91 3.96M14.34 14H9.66c-.09-.66-.16-1.32-.16-2s.07-1.35.16-2h4.68c.09.65.16 1.32.16 2s-.07 1.34-.16 2m.25 5.56c.6-1.11 1.06-2.31 1.38-3.56h2.95c-.96 1.65-2.49 2.93-4.33 3.56M16.36 14c.08-.66.14-1.32.14-2s-.06-1.34-.14-2h3.38c.16.64.26 1.31.26 2s-.1 1.36-.26 2z"
12
+ }), "Language"), N = (e) => {
13
+ var o, a, c, s;
14
+ const [f, r] = g(!1), t = m(p);
12
15
  if (h(() => {
13
- if (!i) return;
14
- i.markAsOpened();
15
- const g = setInterval(() => {
16
- i.markAsOpened();
16
+ if (!t) return;
17
+ t.markAsOpened();
18
+ const d = setInterval(() => {
19
+ t.markAsOpened();
17
20
  }, 5e3);
18
- return () => clearInterval(g);
19
- }, [i]), !i)
21
+ return () => clearInterval(d);
22
+ }, [t]), !t)
20
23
  return null;
21
- const t = {
22
- imageShape: e.imageShape || "circle",
24
+ const i = {
23
25
  pagination: e.pagination || "INFINITE_SCROLL",
24
- pageSize: e.pageSize || 10,
26
+ pageSize: e.pageSize || 5,
25
27
  pagePosition: e.pagePosition || "top",
26
28
  style: e.style || {},
27
- filter: e.filter || P.ALL,
29
+ filter: e.filter || S.ALL,
28
30
  infiniteScrollHeight: e.infiniteScrollHeight ? e.infiniteScrollHeight : window.innerHeight * 0.75,
29
31
  renderers: {
30
32
  notification: (o = e.renderers) == null ? void 0 : o.notification
31
33
  },
32
34
  header: {
33
35
  title: (a = e.header) == null ? void 0 : a.title,
34
- button1ClickHandler: ((l = e.header) == null ? void 0 : l.button1ClickHandler) ?? i.markAsArchived,
35
- button2ClickHandler: ((f = e.header) == null ? void 0 : f.button2ClickHandler) ?? (() => r(!0))
36
+ button1ClickHandler: ((c = e.header) == null ? void 0 : c.button1ClickHandler) ?? t.markAsArchived,
37
+ button2ClickHandler: ((s = e.header) == null ? void 0 : s.button2ClickHandler) ?? (() => r(!0))
36
38
  }
37
39
  };
38
- return /* @__PURE__ */ s(
40
+ return /* @__PURE__ */ l(
39
41
  "div",
40
42
  {
41
43
  style: {
42
- padding: 12,
44
+ padding: "0 12px",
43
45
  boxSizing: "border-box",
46
+ borderRadius: 8,
44
47
  background: "#fff",
48
+ border: "1px solid #dcdcdc",
45
49
  ...e.style
46
50
  },
47
51
  children: [
48
52
  /* @__PURE__ */ n(
49
53
  u,
50
54
  {
51
- maxHeight: t.infiniteScrollHeight,
52
- pagination: t.pagination,
53
- filter: t.filter,
54
- imageShape: t.imageShape,
55
- pageSize: t.pageSize,
56
- pagePosition: t.pagePosition,
57
- notificationRenderer: t.renderers.notification,
58
- header: t.header
55
+ maxHeight: i.infiniteScrollHeight,
56
+ pagination: i.pagination,
57
+ filter: i.filter,
58
+ pageSize: i.pageSize,
59
+ pagePosition: i.pagePosition,
60
+ notificationRenderer: i.renderers.notification,
61
+ header: i.header
59
62
  }
60
63
  ),
61
- i.webPushOptInMessage && localStorage.getItem("hideWebPushOptInMessage") !== "true" && /* @__PURE__ */ s("div", { children: [
62
- /* @__PURE__ */ n(S, { style: { margin: "10px 0" } }),
64
+ t.webPushOptInMessage && localStorage.getItem("hideWebPushOptInMessage") !== "true" && /* @__PURE__ */ l("div", { children: [
65
+ /* @__PURE__ */ n(C, { style: { margin: "10px 0" } }),
63
66
  /* @__PURE__ */ n(
64
67
  I,
65
68
  {
66
69
  hideAfterInteraction: !0,
67
- icon: /* @__PURE__ */ n(b, { type: "text", style: { marginLeft: "9px" } }),
70
+ icon: /* @__PURE__ */ n(H, { type: "text", style: { marginLeft: "9px" } }),
68
71
  descriptionStyle: {
69
72
  flexDirection: "column",
70
73
  // Stack the elements vertically
@@ -88,7 +91,7 @@ const L = (e) => {
88
91
  /* @__PURE__ */ n(
89
92
  x,
90
93
  {
91
- open: c,
94
+ open: f,
92
95
  onClose: () => r(!1)
93
96
  }
94
97
  )
@@ -97,5 +100,5 @@ const L = (e) => {
97
100
  );
98
101
  };
99
102
  export {
100
- L as NotificationFeed
103
+ N as NotificationFeed
101
104
  };
@@ -5,6 +5,7 @@ type NotificationLaucherProps = NotificationPopupProps & {
5
5
  position?: keyof typeof Position;
6
6
  offsetX?: number | string;
7
7
  offsetY?: number | string;
8
+ buttonStyles?: React.CSSProperties;
8
9
  };
9
10
  export declare const NotificationLauncher: React.FC<NotificationLaucherProps>;
10
11
  export {};
@@ -1,148 +1,134 @@
1
- import { jsx as i, jsxs as o, Fragment as h } from "react/jsx-runtime";
2
- import { Inbox as g } from "./Inbox.js";
3
- import { UnreadBadge as m } from "./UnreadBadge.js";
4
- import { useState as s, useContext as b } from "react";
5
- import { NotificationAPIContext as I } from "../Provider/index.js";
6
- import { NotificationPreferencesPopup as p } from "../Preferences/NotificationPreferencesPopup.js";
7
- import { D as x } from "../../assets/PreferenceInput.js";
8
- import { W as P, R as S } from "../../assets/WebPushOptInMessage.js";
9
- import { R as C } from "../../assets/channelUtils.js";
10
- import { P as W } from "../../assets/index.js";
11
- import { B as O } from "../../assets/button.js";
12
- const w = (t) => {
13
- var r, d, c, u;
14
- const [f, a] = s(!1), n = b(I);
1
+ import { jsx as o, jsxs as a } from "react/jsx-runtime";
2
+ import { useState as c, useContext as b } from "react";
3
+ import { I as P } from "../../assets/Inbox.js";
4
+ import { UnreadBadge as x } from "./UnreadBadge.js";
5
+ import { NotificationAPIContext as C } from "../Provider/context.js";
6
+ import { N as O } from "../../assets/NotificationPreferencesPopup.js";
7
+ import { W as S, L as y } from "../../assets/WebPushOptInMessage.js";
8
+ import { N } from "../../assets/channelUtils.js";
9
+ import { I as z } from "../../assets/IconButton.js";
10
+ import { P as k } from "../../assets/Popover.js";
11
+ import { D as A } from "../../assets/Divider.js";
12
+ const D = (e) => {
13
+ var d, f, u, h;
14
+ const [g, l] = c(!1), [i, s] = c(!1), n = b(C), [m, p] = c(null);
15
15
  if (!n)
16
16
  return null;
17
- const e = {
18
- buttonIcon: t.buttonIcon || /* @__PURE__ */ i(
19
- C,
17
+ const t = {
18
+ buttonIcon: e.buttonIcon || /* @__PURE__ */ o(
19
+ N,
20
20
  {
21
21
  style: {
22
- fontSize: t.buttonIconSize || (t.buttonWidth ? t.buttonWidth / 2 : 20),
23
- color: t.iconColor || "#000000"
22
+ fontSize: e.buttonIconSize || 20,
23
+ color: e.iconColor || "#000000"
24
24
  }
25
25
  }
26
26
  ),
27
- buttonWidth: t.buttonWidth || 40,
28
- buttonHeight: t.buttonHeight || 40,
29
- popupWidth: t.popupWidth || 400,
30
- popupHeight: t.popupHeight || 600,
31
- buttonIconSize: t.buttonIconSize || (t.buttonWidth ? t.buttonWidth / 2 : 20),
32
- imageShape: t.imageShape || "circle",
33
- iconColor: t.iconColor || "#000000",
34
- pagination: t.pagination || "INFINITE_SCROLL",
35
- pageSize: t.pageSize || 10,
36
- pagePosition: t.pagePosition || "top",
37
- popupZIndex: t.popupZIndex || 1030,
38
- unreadBadgeProps: t.unreadBadgeProps ?? {},
39
- offsetX: t.offsetX || 16,
40
- offsetY: t.offsetY || 16,
41
- position: t.position || "BOTTOM_RIGHT",
42
- count: t.count || "COUNT_UNOPENED_NOTIFICATIONS",
43
- filter: t.filter || "ALL",
27
+ buttonStyles: {
28
+ width: 40,
29
+ height: 40,
30
+ ...e.buttonStyles
31
+ },
32
+ popupWidth: e.popupWidth || 400,
33
+ popupHeight: e.popupHeight || 600,
34
+ buttonIconSize: e.buttonIconSize || 20,
35
+ iconColor: e.iconColor || "#000000",
36
+ pagination: e.pagination || "INFINITE_SCROLL",
37
+ pageSize: e.pageSize || 10,
38
+ pagePosition: e.pagePosition || "top",
39
+ popupZIndex: e.popupZIndex || 1030,
40
+ unreadBadgeProps: e.unreadBadgeProps ?? {},
41
+ offsetX: e.offsetX || 16,
42
+ offsetY: e.offsetY || 16,
43
+ position: e.position || "BOTTOM_RIGHT",
44
+ count: e.count || "COUNT_UNOPENED_NOTIFICATIONS",
45
+ filter: e.filter || "ALL",
44
46
  header: {
45
- title: (r = t.header) == null ? void 0 : r.title,
46
- button1ClickHandler: ((d = t.header) == null ? void 0 : d.button1ClickHandler) ?? n.markAsArchived,
47
- button2ClickHandler: ((c = t.header) == null ? void 0 : c.button2ClickHandler) ?? (() => a(!0))
47
+ title: (d = e.header) == null ? void 0 : d.title,
48
+ button1ClickHandler: ((f = e.header) == null ? void 0 : f.button1ClickHandler) ?? n.markAsArchived,
49
+ button2ClickHandler: ((u = e.header) == null ? void 0 : u.button2ClickHandler) ?? (() => l(!0))
48
50
  },
49
51
  renderers: {
50
- notification: (u = t.renderers) == null ? void 0 : u.notification
52
+ notification: (h = e.renderers) == null ? void 0 : h.notification
51
53
  }
54
+ }, I = (r) => {
55
+ s(!i), p(r == null ? void 0 : r.currentTarget), i && n.markAsOpened();
52
56
  };
53
- return /* @__PURE__ */ o(
57
+ return /* @__PURE__ */ a(
54
58
  "div",
55
59
  {
56
60
  style: {
57
61
  position: "fixed",
58
- right: e.offsetX,
59
- bottom: e.offsetY,
60
- zIndex: 9999
62
+ right: t.offsetX,
63
+ bottom: t.offsetY,
64
+ zIndex: 999
61
65
  },
62
66
  children: [
63
- /* @__PURE__ */ i(
64
- W,
67
+ /* @__PURE__ */ o(
68
+ "div",
69
+ {
70
+ style: {
71
+ display: "inline-block"
72
+ },
73
+ children: /* @__PURE__ */ o(x, { ...e.unreadBadgeProps, count: t.count, children: /* @__PURE__ */ o(z, { style: t.buttonStyles, onClick: I, children: t.buttonIcon }) })
74
+ }
75
+ ),
76
+ /* @__PURE__ */ a(
77
+ k,
65
78
  {
66
- autoAdjustOverflow: !0,
67
- trigger: "click",
68
- content: /* @__PURE__ */ o(h, { children: [
69
- /* @__PURE__ */ i(
70
- g,
79
+ open: i,
80
+ anchorEl: m,
81
+ anchorReference: "anchorEl",
82
+ anchorOrigin: {
83
+ horizontal: "center",
84
+ vertical: "top"
85
+ },
86
+ transformOrigin: {
87
+ vertical: "bottom",
88
+ horizontal: "center"
89
+ },
90
+ onClose: () => s(!1),
91
+ slotProps: {
92
+ paper: {
93
+ style: {
94
+ width: t.popupWidth,
95
+ padding: "0 16px",
96
+ borderRadius: 8
97
+ }
98
+ }
99
+ },
100
+ children: [
101
+ /* @__PURE__ */ o(
102
+ P,
71
103
  {
72
104
  maxHeight: 500,
73
- pagination: e.pagination,
74
- filter: e.filter,
75
- imageShape: e.imageShape,
76
- pageSize: e.pageSize,
77
- pagePosition: e.pagePosition,
78
- notificationRenderer: e.renderers.notification,
79
- header: e.header
105
+ pagination: t.pagination,
106
+ filter: t.filter,
107
+ pageSize: t.pageSize,
108
+ pagePosition: t.pagePosition,
109
+ notificationRenderer: t.renderers.notification,
110
+ header: t.header
80
111
  }
81
112
  ),
82
- n.webPushOptInMessage && localStorage.getItem("hideWebPushOptInMessage") !== "true" && /* @__PURE__ */ o("div", { children: [
83
- /* @__PURE__ */ i(x, { style: { margin: "10px 0" } }),
84
- /* @__PURE__ */ i(
85
- P,
113
+ n.webPushOptInMessage && localStorage.getItem("hideWebPushOptInMessage") !== "true" && /* @__PURE__ */ a("div", { children: [
114
+ /* @__PURE__ */ o(A, { style: { margin: "10px 0" } }),
115
+ /* @__PURE__ */ o(
116
+ S,
86
117
  {
87
118
  hideAfterInteraction: !0,
88
- icon: /* @__PURE__ */ i(
89
- S,
90
- {
91
- type: "text",
92
- style: { marginLeft: "9px" }
93
- }
94
- ),
119
+ icon: /* @__PURE__ */ o(y, { type: "text", style: { marginLeft: "9px" } }),
95
120
  alertContainerStyle: { maxWidth: "345px" }
96
121
  }
97
122
  )
98
123
  ] })
99
- ] }),
100
- arrow: !1,
101
- overlayStyle: {
102
- padding: "0 16px",
103
- minWidth: e.popupWidth
104
- },
105
- onOpenChange: (l) => {
106
- l && n.markAsOpened();
107
- },
108
- children: /* @__PURE__ */ i(
109
- "div",
110
- {
111
- style: {
112
- display: "inline-block"
113
- },
114
- children: /* @__PURE__ */ i(
115
- m,
116
- {
117
- ...t.unreadBadgeProps,
118
- style: {
119
- top: 5,
120
- right: 5
121
- },
122
- count: e.count,
123
- children: /* @__PURE__ */ i(
124
- O,
125
- {
126
- icon: e.buttonIcon,
127
- style: {
128
- width: e.buttonWidth,
129
- height: e.buttonHeight
130
- },
131
- shape: "circle",
132
- type: "default"
133
- }
134
- )
135
- }
136
- )
137
- }
138
- )
124
+ ]
139
125
  }
140
126
  ),
141
- /* @__PURE__ */ i(
142
- p,
127
+ /* @__PURE__ */ o(
128
+ O,
143
129
  {
144
- open: f,
145
- onClose: () => a(!1)
130
+ open: g,
131
+ onClose: () => l(!1)
146
132
  }
147
133
  )
148
134
  ]
@@ -150,5 +136,5 @@ const w = (t) => {
150
136
  );
151
137
  };
152
138
  export {
153
- w as NotificationLauncher
139
+ D as NotificationLauncher
154
140
  };
@@ -1,17 +1,16 @@
1
+ import { default as React } from 'react';
1
2
  import { UnreadBadgeProps } from './UnreadBadge';
2
3
  import { NotificationProps } from './Notification';
3
4
  import { InAppNotification } from '@notificationapi/core/dist/interfaces';
4
5
  import { InboxHeaderProps } from './InboxHeader';
5
- import { Filter, ImageShape, Pagination } from './interface';
6
+ import { Filter, Pagination } from './interface';
6
7
 
7
8
  export type NotificationPopupProps = {
8
9
  buttonIcon?: React.ReactNode;
9
10
  buttonIconSize?: number;
10
- buttonWidth?: number;
11
- buttonHeight?: number;
11
+ buttonStyles?: React.CSSProperties;
12
12
  popupWidth?: number | string;
13
13
  popupHeight?: number;
14
- imageShape?: keyof typeof ImageShape;
15
14
  iconColor?: string;
16
15
  pagination?: keyof typeof Pagination;
17
16
  pageSize?: number;