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