@notificationapi/react 1.6.2 → 1.8.0
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.
- package/dist/assets/Badge.js +4 -3
- package/dist/assets/Box.js +26 -24
- package/dist/assets/Button.js +20 -18
- package/dist/assets/ButtonBase.js +193 -185
- package/dist/assets/DefaultPropsProvider.js +416 -4199
- package/dist/assets/DefaultPropsProvider2.js +992 -0
- package/dist/assets/Divider.js +2 -1
- package/dist/assets/GlobalStyles.js +23 -0
- package/dist/assets/Grow.js +87 -92
- package/dist/assets/IconButton.js +8 -7
- package/dist/assets/List.js +12 -11
- package/dist/assets/Modal.js +18 -17
- package/dist/assets/Notification.js +787 -770
- package/dist/assets/Paper.js +6 -6
- package/dist/assets/Popover.js +38 -37
- package/dist/assets/Portal.js +38 -48
- package/dist/assets/Stack.js +32 -30
- package/dist/assets/Typography.js +84 -97
- package/dist/assets/createSvgIcon.js +25 -24
- package/dist/assets/createTheme.js +2828 -0
- package/dist/assets/dividerClasses.js +16 -15
- package/dist/assets/exactProp.js +13 -0
- package/dist/assets/index.js +19 -148
- package/dist/assets/index2.js +151 -0
- package/dist/assets/useTheme.js +6 -7
- package/dist/assets/{useTheme2.js → useThemeWithoutDefault.js} +63 -67
- package/dist/assets/utils.js +2 -2
- package/dist/components/Notifications/DefaultEmpty.d.ts +0 -1
- package/dist/components/Notifications/Inbox.d.ts +0 -1
- package/dist/components/Notifications/Inbox.js +592 -582
- package/dist/components/Notifications/InboxHeader.js +31 -30
- package/dist/components/Notifications/Notification.d.ts +0 -1
- package/dist/components/Notifications/Notification.js +4 -2
- package/dist/components/Notifications/NotificationCounter.d.ts +0 -1
- package/dist/components/Notifications/NotificationFeed.d.ts +0 -1
- package/dist/components/Notifications/NotificationFeed.js +40 -32
- package/dist/components/Notifications/NotificationLauncher.d.ts +0 -1
- package/dist/components/Notifications/NotificationLauncher.js +90 -64
- package/dist/components/Notifications/NotificationPopup.d.ts +0 -1
- package/dist/components/Notifications/NotificationPopup.js +76 -65
- package/dist/components/Notifications/UnreadBadge.d.ts +0 -1
- package/dist/components/Preferences/NotificationPreferencesInline.js +57 -39
- package/dist/components/Preferences/NotificationPreferencesPopup.js +111 -99
- package/dist/components/Preferences/PreferenceInput.d.ts +0 -1
- package/dist/components/Preferences/PreferenceInput.js +427 -414
- package/dist/components/Preferences/Preferences.js +329 -278
- package/dist/components/Preferences/channelUtils.d.ts +0 -1
- package/dist/components/Provider/context.d.ts +0 -1
- package/dist/components/Provider/index.d.ts +4 -2
- package/dist/components/Provider/index.js +986 -375
- package/dist/components/Slack/SlackConnect.js +8 -7
- package/dist/components/WebPush/WebPushOptInMessage.d.ts +0 -1
- package/dist/main.d.ts +2 -1
- package/dist/main.js +6 -3
- package/dist/utils/theme.d.ts +17 -0
- package/dist/utils/theme.js +104 -0
- package/package.json +7 -3
|
@@ -1,27 +1,29 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { Inbox as
|
|
4
|
-
import { UnreadBadge as
|
|
5
|
-
import { NotificationAPIContext as
|
|
6
|
-
import { NotificationPreferencesPopup as
|
|
7
|
-
import { Filter as
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
import { jsx as t, jsxs as a, Fragment as O } from "react/jsx-runtime";
|
|
2
|
+
import { useState as b, useContext as S } from "react";
|
|
3
|
+
import { Inbox as v } from "./Inbox.js";
|
|
4
|
+
import { UnreadBadge as N } from "./UnreadBadge.js";
|
|
5
|
+
import { NotificationAPIContext as k } from "../Provider/context.js";
|
|
6
|
+
import { NotificationPreferencesPopup as z } from "../Preferences/NotificationPreferencesPopup.js";
|
|
7
|
+
import { Filter as T } from "./interface.js";
|
|
8
|
+
import { getThemeColors as y } from "../../utils/theme.js";
|
|
9
|
+
import { W as H } from "../../assets/WebPushOptInMessage.js";
|
|
10
|
+
import { N as A } from "../../assets/channelUtils.js";
|
|
11
|
+
import { u as w } from "../../assets/ButtonBase.js";
|
|
12
|
+
import { I as B } from "../../assets/IconButton.js";
|
|
13
|
+
import { P as W } from "../../assets/Popover.js";
|
|
14
|
+
import { D as E } from "../../assets/Divider.js";
|
|
15
|
+
const V = (e) => {
|
|
16
|
+
var d, u, h, s, p, g, f, m;
|
|
17
|
+
const [I, l] = b(!1), [r, c] = b(null), i = S(k), P = w(), n = y(P);
|
|
18
|
+
if (!i)
|
|
17
19
|
return null;
|
|
18
|
-
const
|
|
19
|
-
buttonIcon: e.buttonIcon || /* @__PURE__ */
|
|
20
|
-
|
|
20
|
+
const o = {
|
|
21
|
+
buttonIcon: e.buttonIcon || /* @__PURE__ */ t(
|
|
22
|
+
A,
|
|
21
23
|
{
|
|
22
24
|
style: {
|
|
23
25
|
fontSize: e.buttonIconSize || 20,
|
|
24
|
-
color: e.iconColor ||
|
|
26
|
+
color: e.iconColor || n.icon
|
|
25
27
|
}
|
|
26
28
|
}
|
|
27
29
|
),
|
|
@@ -33,106 +35,115 @@ const j = (e) => {
|
|
|
33
35
|
popupWidth: e.popupWidth || 400,
|
|
34
36
|
popupHeight: e.popupHeight || 600,
|
|
35
37
|
buttonIconSize: e.buttonIconSize || 20,
|
|
36
|
-
iconColor: e.iconColor ||
|
|
38
|
+
iconColor: e.iconColor || n.icon,
|
|
37
39
|
pagination: e.pagination || "INFINITE_SCROLL",
|
|
38
40
|
pageSize: e.pageSize || 10,
|
|
39
41
|
pagePosition: e.pagePosition || "bottom",
|
|
40
42
|
popupZIndex: e.popupZIndex || 1030,
|
|
41
43
|
unreadBadgeProps: e.unreadBadgeProps ?? {},
|
|
42
44
|
count: e.count || "COUNT_UNOPENED_NOTIFICATIONS",
|
|
43
|
-
filter: e.filter ||
|
|
45
|
+
filter: e.filter || T.ALL,
|
|
44
46
|
header: {
|
|
45
|
-
title: (
|
|
46
|
-
button1ClickHandler: ((
|
|
47
|
-
button2ClickHandler: ((
|
|
47
|
+
title: (d = e.header) == null ? void 0 : d.title,
|
|
48
|
+
button1ClickHandler: ((u = e.header) == null ? void 0 : u.button1ClickHandler) ?? i.markAsArchived,
|
|
49
|
+
button2ClickHandler: ((h = e.header) == null ? void 0 : h.button2ClickHandler) ?? (() => l(!0))
|
|
48
50
|
},
|
|
49
51
|
renderers: {
|
|
50
|
-
notification: (
|
|
52
|
+
notification: (s = e.renderers) == null ? void 0 : s.notification
|
|
51
53
|
},
|
|
52
54
|
popoverPosition: {
|
|
53
55
|
anchorOrigin: {
|
|
54
|
-
vertical: ((
|
|
55
|
-
horizontal: ((
|
|
56
|
+
vertical: ((g = (p = e.popoverPosition) == null ? void 0 : p.anchorOrigin) == null ? void 0 : g.vertical) ?? "top",
|
|
57
|
+
horizontal: ((m = (f = e.popoverPosition) == null ? void 0 : f.anchorOrigin) == null ? void 0 : m.horizontal) ?? "left"
|
|
56
58
|
}
|
|
57
59
|
},
|
|
58
60
|
newTab: e.newTab ?? !1
|
|
59
|
-
},
|
|
60
|
-
|
|
61
|
+
}, C = (x) => {
|
|
62
|
+
c(x.currentTarget), i.markAsOpened();
|
|
61
63
|
};
|
|
62
|
-
return /* @__PURE__ */
|
|
63
|
-
/* @__PURE__ */
|
|
64
|
+
return /* @__PURE__ */ a(O, { children: [
|
|
65
|
+
/* @__PURE__ */ t(
|
|
64
66
|
"div",
|
|
65
67
|
{
|
|
66
68
|
style: {
|
|
67
69
|
display: "inline-block"
|
|
68
70
|
},
|
|
69
|
-
children: /* @__PURE__ */
|
|
70
|
-
|
|
71
|
+
children: /* @__PURE__ */ t(
|
|
72
|
+
N,
|
|
71
73
|
{
|
|
72
74
|
...e.unreadBadgeProps,
|
|
73
|
-
count:
|
|
74
|
-
filter:
|
|
75
|
-
children: /* @__PURE__ */
|
|
75
|
+
count: o.count,
|
|
76
|
+
filter: o.filter,
|
|
77
|
+
children: /* @__PURE__ */ t(B, { onClick: C, style: o.buttonStyles, children: o.buttonIcon })
|
|
76
78
|
}
|
|
77
79
|
)
|
|
78
80
|
}
|
|
79
81
|
),
|
|
80
|
-
/* @__PURE__ */
|
|
81
|
-
|
|
82
|
+
/* @__PURE__ */ t(
|
|
83
|
+
W,
|
|
82
84
|
{
|
|
83
|
-
open: !!
|
|
84
|
-
onClose: () =>
|
|
85
|
-
anchorEl:
|
|
85
|
+
open: !!r,
|
|
86
|
+
onClose: () => c(null),
|
|
87
|
+
anchorEl: r,
|
|
86
88
|
slotProps: {
|
|
87
89
|
paper: {
|
|
88
90
|
style: {
|
|
89
|
-
borderRadius: 8
|
|
91
|
+
borderRadius: 8,
|
|
92
|
+
backgroundColor: n.paper,
|
|
93
|
+
color: n.text
|
|
90
94
|
}
|
|
91
95
|
}
|
|
92
96
|
},
|
|
93
|
-
"aria-hidden": !
|
|
94
|
-
anchorOrigin:
|
|
95
|
-
children: /* @__PURE__ */
|
|
97
|
+
"aria-hidden": !r,
|
|
98
|
+
anchorOrigin: o.popoverPosition.anchorOrigin,
|
|
99
|
+
children: /* @__PURE__ */ a(
|
|
96
100
|
"div",
|
|
97
101
|
{
|
|
98
102
|
style: {
|
|
99
|
-
width:
|
|
103
|
+
width: o.popupWidth,
|
|
100
104
|
padding: "0 16px",
|
|
101
105
|
zIndex: e.popupZIndex,
|
|
102
|
-
height:
|
|
106
|
+
height: o.popupHeight,
|
|
107
|
+
backgroundColor: n.paper,
|
|
108
|
+
color: n.text
|
|
103
109
|
},
|
|
104
110
|
children: [
|
|
105
|
-
/* @__PURE__ */
|
|
106
|
-
|
|
111
|
+
/* @__PURE__ */ t(
|
|
112
|
+
v,
|
|
107
113
|
{
|
|
108
|
-
maxHeight:
|
|
109
|
-
pagination:
|
|
110
|
-
filter:
|
|
111
|
-
pageSize:
|
|
112
|
-
pagePosition:
|
|
113
|
-
notificationRenderer:
|
|
114
|
-
header:
|
|
115
|
-
newTab:
|
|
114
|
+
maxHeight: o.popupHeight - 73,
|
|
115
|
+
pagination: o.pagination,
|
|
116
|
+
filter: o.filter,
|
|
117
|
+
pageSize: o.pageSize,
|
|
118
|
+
pagePosition: o.pagePosition,
|
|
119
|
+
notificationRenderer: o.renderers.notification,
|
|
120
|
+
header: o.header,
|
|
121
|
+
newTab: o.newTab
|
|
116
122
|
}
|
|
117
123
|
),
|
|
118
|
-
|
|
119
|
-
/* @__PURE__ */
|
|
120
|
-
|
|
124
|
+
i.webPushOptInMessage && localStorage.getItem("hideWebPushOptInMessage") !== "true" && /* @__PURE__ */ a("div", { children: [
|
|
125
|
+
/* @__PURE__ */ t(
|
|
126
|
+
E,
|
|
127
|
+
{
|
|
128
|
+
style: { margin: "10px 0", borderColor: n.divider }
|
|
129
|
+
}
|
|
130
|
+
),
|
|
131
|
+
/* @__PURE__ */ t(H, { hideAfterInteraction: !0 })
|
|
121
132
|
] })
|
|
122
133
|
]
|
|
123
134
|
}
|
|
124
135
|
)
|
|
125
136
|
}
|
|
126
137
|
),
|
|
127
|
-
/* @__PURE__ */
|
|
128
|
-
|
|
138
|
+
/* @__PURE__ */ t(
|
|
139
|
+
z,
|
|
129
140
|
{
|
|
130
141
|
open: I,
|
|
131
|
-
onClose: () =>
|
|
142
|
+
onClose: () => l(!1)
|
|
132
143
|
}
|
|
133
144
|
)
|
|
134
145
|
] });
|
|
135
146
|
};
|
|
136
147
|
export {
|
|
137
|
-
|
|
148
|
+
V as NotificationPopup
|
|
138
149
|
};
|
|
@@ -2,7 +2,6 @@ import { PropsWithChildren } from 'react';
|
|
|
2
2
|
import { NotificationPopupProps } from './NotificationPopup';
|
|
3
3
|
import { InAppNotification } from '@notificationapi/core/dist/interfaces';
|
|
4
4
|
import { COUNT_TYPE } from './interface';
|
|
5
|
-
|
|
6
5
|
export type UnreadBadgeProps = {
|
|
7
6
|
dot?: boolean;
|
|
8
7
|
showZero?: boolean;
|
|
@@ -1,42 +1,60 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useContext as
|
|
3
|
-
import { Preferences as
|
|
4
|
-
import { NotificationAPIContext as
|
|
5
|
-
import { W as
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
{
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
1
|
+
import { jsxs as o, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { useContext as n } from "react";
|
|
3
|
+
import { Preferences as s } from "./Preferences.js";
|
|
4
|
+
import { NotificationAPIContext as m } from "../Provider/context.js";
|
|
5
|
+
import { W as f } from "../../assets/WebPushOptInMessage.js";
|
|
6
|
+
import { getThemeColors as l } from "../../utils/theme.js";
|
|
7
|
+
import { u as a } from "../../assets/ButtonBase.js";
|
|
8
|
+
import { D as p } from "../../assets/Divider.js";
|
|
9
|
+
function y(c) {
|
|
10
|
+
const r = n(m), i = a(), e = l(i);
|
|
11
|
+
return r ? /* @__PURE__ */ o(
|
|
12
|
+
"div",
|
|
13
|
+
{
|
|
14
|
+
style: {
|
|
15
|
+
borderRadius: 8,
|
|
16
|
+
border: `1px solid ${e.border}`,
|
|
17
|
+
backgroundColor: e.paper,
|
|
18
|
+
color: e.text
|
|
19
|
+
},
|
|
20
|
+
children: [
|
|
21
|
+
/* @__PURE__ */ t(s, {}),
|
|
22
|
+
" ",
|
|
23
|
+
r.webPushOptInMessage && /* @__PURE__ */ o("div", { children: [
|
|
24
|
+
/* @__PURE__ */ t(
|
|
25
|
+
p,
|
|
26
|
+
{
|
|
27
|
+
style: { margin: "10px 0", borderColor: e.divider }
|
|
28
|
+
}
|
|
29
|
+
),
|
|
30
|
+
/* @__PURE__ */ t(
|
|
31
|
+
f,
|
|
32
|
+
{
|
|
33
|
+
hideAfterInteraction: !1,
|
|
34
|
+
descriptionStyle: {
|
|
35
|
+
flexDirection: "column",
|
|
36
|
+
// Stack the elements vertically
|
|
37
|
+
justifyContent: "flex-start",
|
|
38
|
+
// Align items to the left
|
|
39
|
+
fontSize: "14px",
|
|
40
|
+
alignItems: "flex-start"
|
|
41
|
+
// Align items to the left
|
|
42
|
+
},
|
|
43
|
+
buttonContainerStyle: {
|
|
44
|
+
justifyContent: "flex-start",
|
|
45
|
+
// Align buttons to the left
|
|
46
|
+
alignItems: "flex-start",
|
|
47
|
+
// Align buttons to the left
|
|
48
|
+
marginTop: "10px"
|
|
49
|
+
// Add some space between message and buttons
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
)
|
|
53
|
+
] })
|
|
54
|
+
]
|
|
55
|
+
}
|
|
56
|
+
) : null;
|
|
39
57
|
}
|
|
40
58
|
export {
|
|
41
|
-
|
|
59
|
+
y as NotificationPreferencesInline
|
|
42
60
|
};
|