@notificationapi/react 1.7.0 → 1.9.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 (47) hide show
  1. package/dist/assets/Badge.js +60 -64
  2. package/dist/assets/Box.js +26 -24
  3. package/dist/assets/Button.js +22 -19
  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 +22 -18
  8. package/dist/assets/GlobalStyles.js +23 -0
  9. package/dist/assets/Grow.js +1513 -120
  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 +8 -8
  15. package/dist/assets/Popover.js +37 -36
  16. package/dist/assets/Portal.js +39 -49
  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/exactProp.js +13 -0
  22. package/dist/assets/index.js +19 -148
  23. package/dist/assets/index2.js +151 -0
  24. package/dist/assets/useControlled.js +49 -0
  25. package/dist/assets/usePreviousProps.js +10 -0
  26. package/dist/assets/useTheme.js +6 -7
  27. package/dist/assets/{useTheme2.js → useThemeWithoutDefault.js} +63 -67
  28. package/dist/assets/utils.js +4 -4
  29. package/dist/components/Notifications/Inbox.js +593 -583
  30. package/dist/components/Notifications/InboxHeader.js +360 -1754
  31. package/dist/components/Notifications/Notification.js +4 -2
  32. package/dist/components/Notifications/NotificationFeed.js +40 -32
  33. package/dist/components/Notifications/NotificationLauncher.js +90 -64
  34. package/dist/components/Notifications/NotificationPopup.js +76 -65
  35. package/dist/components/Preferences/NotificationPreferencesInline.js +57 -39
  36. package/dist/components/Preferences/NotificationPreferencesPopup.js +111 -99
  37. package/dist/components/Preferences/PreferenceInput.js +427 -414
  38. package/dist/components/Preferences/Preferences.js +329 -278
  39. package/dist/components/Provider/index.d.ts +2 -0
  40. package/dist/components/Provider/index.js +1008 -401
  41. package/dist/components/Slack/SlackConnect.js +4627 -2024
  42. package/dist/main.d.ts +2 -0
  43. package/dist/main.js +6 -3
  44. package/dist/utils/theme.d.ts +17 -0
  45. package/dist/utils/theme.js +104 -0
  46. package/package.json +1 -1
  47. package/dist/assets/dividerClasses.js +0 -56
package/dist/main.d.ts CHANGED
@@ -3,3 +3,5 @@ export { NotificationPreferencesInline, NotificationPreferencesPopup } from './c
3
3
  export { NotificationAPIProvider } from './components/Provider';
4
4
  export { SlackConnect } from './components/Slack';
5
5
  export { createDebugLogger, type DebugLogger } from './utils/debug';
6
+ export type { NotificationAPITheme, NotificationAPIThemeMode, NotificationAPIThemeColors } from './utils/theme';
7
+ export { createNotificationAPITheme, getThemeColors } from './utils/theme';
package/dist/main.js CHANGED
@@ -5,8 +5,9 @@ import { NotificationCounter as p } from "./components/Notifications/Notificatio
5
5
  import { NotificationPreferencesPopup as m } from "./components/Preferences/NotificationPreferencesPopup.js";
6
6
  import { NotificationPreferencesInline as N } from "./components/Preferences/NotificationPreferencesInline.js";
7
7
  import { NotificationAPIProvider as u } from "./components/Provider/index.js";
8
- import { SlackConnect as d } from "./components/Slack/SlackConnect.js";
8
+ import { SlackConnect as h } from "./components/Slack/SlackConnect.js";
9
9
  import { createDebugLogger as s } from "./utils/debug.js";
10
+ import { createNotificationAPITheme as I, getThemeColors as d } from "./utils/theme.js";
10
11
  export {
11
12
  u as NotificationAPIProvider,
12
13
  p as NotificationCounter,
@@ -15,6 +16,8 @@ export {
15
16
  i as NotificationPopup,
16
17
  N as NotificationPreferencesInline,
17
18
  m as NotificationPreferencesPopup,
18
- d as SlackConnect,
19
- s as createDebugLogger
19
+ h as SlackConnect,
20
+ s as createDebugLogger,
21
+ I as createNotificationAPITheme,
22
+ d as getThemeColors
20
23
  };
@@ -0,0 +1,17 @@
1
+ import { Theme } from '@mui/material/styles';
2
+ export type NotificationAPIThemeMode = 'light' | 'dark';
3
+ export type NotificationAPIThemeColors = {
4
+ background?: string;
5
+ paper?: string;
6
+ text?: string;
7
+ textSecondary?: string;
8
+ border?: string;
9
+ icon?: string;
10
+ divider?: string;
11
+ };
12
+ export type NotificationAPITheme = NotificationAPIThemeMode | {
13
+ mode?: NotificationAPIThemeMode;
14
+ colors?: NotificationAPIThemeColors;
15
+ } | Theme;
16
+ export declare function createNotificationAPITheme(theme: NotificationAPITheme): Theme;
17
+ export declare function getThemeColors(theme: Theme): Required<NotificationAPIThemeColors>;
@@ -0,0 +1,104 @@
1
+ import { c } from "../assets/createTheme.js";
2
+ const d = {
3
+ background: "#ffffff",
4
+ paper: "#ffffff",
5
+ text: "#000000",
6
+ textSecondary: "#666666",
7
+ border: "#dcdcdc",
8
+ icon: "#000000",
9
+ divider: "#e0e0e0"
10
+ }, a = {
11
+ background: "#1e1e1e",
12
+ paper: "#2d2d2d",
13
+ text: "#ffffff",
14
+ textSecondary: "#b0b0b0",
15
+ border: "#404040",
16
+ icon: "#ffffff",
17
+ divider: "#404040"
18
+ };
19
+ function n(r) {
20
+ if (r && typeof r == "object" && "palette" in r)
21
+ return r;
22
+ let t = "light", e = {};
23
+ r === "dark" || r === "light" ? t = r : r && typeof r == "object" && (t = r.mode || "light", e = r.colors || {});
24
+ const o = { ...t === "dark" ? a : d, ...e }, i = {
25
+ palette: {
26
+ mode: t,
27
+ background: {
28
+ default: o.background,
29
+ paper: o.paper
30
+ },
31
+ text: {
32
+ primary: o.text,
33
+ secondary: o.textSecondary
34
+ },
35
+ divider: o.divider
36
+ },
37
+ components: {
38
+ MuiPaper: {
39
+ styleOverrides: {
40
+ root: {
41
+ backgroundColor: o.paper,
42
+ color: o.text
43
+ }
44
+ }
45
+ },
46
+ MuiPopover: {
47
+ styleOverrides: {
48
+ paper: {
49
+ backgroundColor: o.paper,
50
+ color: o.text
51
+ }
52
+ }
53
+ },
54
+ MuiDialog: {
55
+ styleOverrides: {
56
+ paper: {
57
+ backgroundColor: o.paper,
58
+ color: o.text
59
+ }
60
+ }
61
+ },
62
+ MuiList: {
63
+ styleOverrides: {
64
+ root: {
65
+ backgroundColor: o.paper,
66
+ color: o.text
67
+ }
68
+ }
69
+ },
70
+ MuiListItem: {
71
+ styleOverrides: {
72
+ root: {
73
+ backgroundColor: o.paper,
74
+ color: o.text
75
+ }
76
+ }
77
+ },
78
+ MuiDivider: {
79
+ styleOverrides: {
80
+ root: {
81
+ borderColor: o.divider
82
+ }
83
+ }
84
+ }
85
+ }
86
+ };
87
+ return c(i);
88
+ }
89
+ function f(r) {
90
+ const e = r.palette.mode === "dark" ? a : d;
91
+ return {
92
+ background: r.palette.background.default || e.background,
93
+ paper: r.palette.background.paper || e.paper,
94
+ text: r.palette.text.primary || e.text,
95
+ textSecondary: r.palette.text.secondary || e.textSecondary,
96
+ border: e.border,
97
+ icon: e.icon,
98
+ divider: r.palette.divider || e.divider
99
+ };
100
+ }
101
+ export {
102
+ n as createNotificationAPITheme,
103
+ f as getThemeColors
104
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@notificationapi/react",
3
3
  "private": false,
4
- "version": "1.7.0",
4
+ "version": "1.9.0",
5
5
  "type": "module",
6
6
  "overrides": {
7
7
  "esbuild": "^0.25.0",
@@ -1,56 +0,0 @@
1
- import * as n from "react";
2
- import { g as h, e as g } from "./DefaultPropsProvider.js";
3
- let r = 0;
4
- function m(e) {
5
- const [t, o] = n.useState(e), s = e || t;
6
- return n.useEffect(() => {
7
- t == null && (r += 1, o(`mui-${r}`));
8
- }, [t]), s;
9
- }
10
- const p = {
11
- ...n
12
- }, u = p.useId;
13
- function b(e) {
14
- if (u !== void 0) {
15
- const t = u();
16
- return e ?? t;
17
- }
18
- return m(e);
19
- }
20
- function v({
21
- controlled: e,
22
- default: t,
23
- name: o,
24
- state: s = "value"
25
- }) {
26
- const {
27
- current: i
28
- } = n.useRef(e !== void 0), [c, a] = n.useState(t), d = i ? e : c;
29
- if (process.env.NODE_ENV !== "production") {
30
- n.useEffect(() => {
31
- i !== (e !== void 0) && console.error([`MUI: A component is changing the ${i ? "" : "un"}controlled ${s} state of ${o} to be ${i ? "un" : ""}controlled.`, "Elements should not switch from uncontrolled to controlled (or vice versa).", `Decide between using a controlled or uncontrolled ${o} element for the lifetime of the component.`, "The nature of the state is determined during the first render. It's considered controlled if the value is not `undefined`.", "More info: https://fb.me/react-controlled-components"].join(`
32
- `));
33
- }, [s, o, e]);
34
- const {
35
- current: l
36
- } = n.useRef(t);
37
- n.useEffect(() => {
38
- !i && !Object.is(l, t) && console.error([`MUI: A component is changing the default ${s} state of an uncontrolled ${o} after being initialized. To suppress this warning opt to use a controlled ${o}.`].join(`
39
- `));
40
- }, [JSON.stringify(t)]);
41
- }
42
- const f = n.useCallback((l) => {
43
- i || a(l);
44
- }, []);
45
- return [d, f];
46
- }
47
- function C(e) {
48
- return g("MuiDivider", e);
49
- }
50
- const $ = h("MuiDivider", ["root", "absolute", "fullWidth", "inset", "middle", "flexItem", "light", "vertical", "withChildren", "withChildrenVertical", "textAlignRight", "textAlignLeft", "wrapper", "wrapperVertical"]);
51
- export {
52
- v as a,
53
- $ as d,
54
- C as g,
55
- b as u
56
- };