@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
@@ -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
  };
@@ -1,28 +1,30 @@
1
1
  import { jsx as i, jsxs as $ } from "react/jsx-runtime";
2
2
  import * as c from "react";
3
- import { useContext as oo } from "react";
4
- import { Preferences as eo } from "./Preferences.js";
5
- import { NotificationAPIContext as ro } from "../Provider/context.js";
6
- import { W as to } from "../../assets/WebPushOptInMessage.js";
7
- import { g as k, e as T, s as f, h as u, m as j, u as S, c as g, P as o, b as P } from "../../assets/DefaultPropsProvider.js";
8
- import { u as ao } from "../../assets/useTheme.js";
9
- import { B as io, M as so, F as no } from "../../assets/Modal.js";
10
- import { P as E } from "../../assets/Paper.js";
11
- import { u as lo } from "../../assets/dividerClasses.js";
12
- import { T as po } from "../../assets/Typography.js";
13
- function co(r) {
14
- return T("MuiDialog", r);
3
+ import { useContext as eo } from "react";
4
+ import { Preferences as ro } from "./Preferences.js";
5
+ import { NotificationAPIContext as to } from "../Provider/context.js";
6
+ import { W as ao } from "../../assets/WebPushOptInMessage.js";
7
+ import { getThemeColors as so } from "../../utils/theme.js";
8
+ import { u as j } from "../../assets/ButtonBase.js";
9
+ import { g as k, e as u, P as o } from "../../assets/createTheme.js";
10
+ import { g as T, s as f, m as E, u as S, c as g, a as P } from "../../assets/DefaultPropsProvider.js";
11
+ import { B as io, M as no, F as lo } from "../../assets/Modal.js";
12
+ import { P as F } from "../../assets/Paper.js";
13
+ import { a as po } from "../../assets/useControlled.js";
14
+ import { T as co } from "../../assets/Typography.js";
15
+ function uo(r) {
16
+ return k("MuiDialog", r);
15
17
  }
16
- const D = k("MuiDialog", ["root", "scrollPaper", "scrollBody", "container", "paper", "paperScrollPaper", "paperScrollBody", "paperWidthFalse", "paperWidthXs", "paperWidthSm", "paperWidthMd", "paperWidthLg", "paperWidthXl", "paperFullWidth", "paperFullScreen"]), w = /* @__PURE__ */ c.createContext({});
18
+ const D = T("MuiDialog", ["root", "scrollPaper", "scrollBody", "container", "paper", "paperScrollPaper", "paperScrollBody", "paperWidthFalse", "paperWidthXs", "paperWidthSm", "paperWidthMd", "paperWidthLg", "paperWidthXl", "paperFullWidth", "paperFullScreen"]), w = /* @__PURE__ */ c.createContext({});
17
19
  process.env.NODE_ENV !== "production" && (w.displayName = "DialogContext");
18
- const uo = f(io, {
20
+ const fo = f(io, {
19
21
  name: "MuiDialog",
20
22
  slot: "Backdrop",
21
23
  overrides: (r, e) => e.backdrop
22
24
  })({
23
25
  // Improve scrollable dialog support.
24
26
  zIndex: -1
25
- }), fo = (r) => {
27
+ }), mo = (r) => {
26
28
  const {
27
29
  classes: e,
28
30
  scroll: t,
@@ -34,8 +36,8 @@ const uo = f(io, {
34
36
  container: ["container", `scroll${u(t)}`],
35
37
  paper: ["paper", `paperScroll${u(t)}`, `paperWidth${u(String(a))}`, s && "paperFullWidth", n && "paperFullScreen"]
36
38
  };
37
- return P(l, co, e);
38
- }, mo = f(so, {
39
+ return P(l, uo, e);
40
+ }, go = f(no, {
39
41
  name: "MuiDialog",
40
42
  slot: "Root",
41
43
  overridesResolver: (r, e) => e.root
@@ -44,7 +46,7 @@ const uo = f(io, {
44
46
  // Use !important to override the Modal inline-style.
45
47
  position: "absolute !important"
46
48
  }
47
- }), go = f("div", {
49
+ }), bo = f("div", {
48
50
  name: "MuiDialog",
49
51
  slot: "Container",
50
52
  overridesResolver: (r, e) => {
@@ -86,7 +88,7 @@ const uo = f(io, {
86
88
  }
87
89
  }
88
90
  }]
89
- }), bo = f(E, {
91
+ }), xo = f(F, {
90
92
  name: "MuiDialog",
91
93
  slot: "Paper",
92
94
  overridesResolver: (r, e) => {
@@ -95,7 +97,7 @@ const uo = f(io, {
95
97
  } = r;
96
98
  return [e.paper, e[`scrollPaper${u(t.scroll)}`], e[`paperWidth${u(String(t.maxWidth))}`], t.fullWidth && e.paperFullWidth, t.fullScreen && e.paperFullScreen];
97
99
  }
98
- })(j(({
100
+ })(E(({
99
101
  theme: r
100
102
  }) => ({
101
103
  margin: 32,
@@ -178,11 +180,11 @@ const uo = f(io, {
178
180
  }
179
181
  }
180
182
  }]
181
- }))), F = /* @__PURE__ */ c.forwardRef(function(e, t) {
183
+ }))), I = /* @__PURE__ */ c.forwardRef(function(e, t) {
182
184
  const a = S({
183
185
  props: e,
184
186
  name: "MuiDialog"
185
- }), s = ao(), n = {
187
+ }), s = j(), n = {
186
188
  enter: s.transitions.duration.enteringScreen,
187
189
  exit: s.transitions.duration.leavingScreen
188
190
  }, {
@@ -190,88 +192,88 @@ const uo = f(io, {
190
192
  "aria-labelledby": p,
191
193
  "aria-modal": m = !0,
192
194
  BackdropComponent: x,
193
- BackdropProps: A,
194
- children: V,
195
- className: Y,
195
+ BackdropProps: V,
196
+ children: Y,
197
+ className: _,
196
198
  disableEscapeKeyDown: W = !1,
197
- fullScreen: _ = !1,
198
- fullWidth: z = !1,
199
- maxWidth: K = "sm",
199
+ fullScreen: z = !1,
200
+ fullWidth: K = !1,
201
+ maxWidth: L = "sm",
200
202
  onBackdropClick: M,
201
203
  onClick: N,
202
- onClose: y,
204
+ onClose: h,
203
205
  open: O,
204
- PaperComponent: L = E,
206
+ PaperComponent: X = F,
205
207
  PaperProps: R = {},
206
- scroll: X = "paper",
207
- TransitionComponent: H = no,
208
+ scroll: H = "paper",
209
+ TransitionComponent: q = lo,
208
210
  transitionDuration: B = n,
209
- TransitionProps: q,
210
- ...G
211
+ TransitionProps: G,
212
+ ...J
211
213
  } = a, b = {
212
214
  ...a,
213
215
  disableEscapeKeyDown: W,
214
- fullScreen: _,
215
- fullWidth: z,
216
- maxWidth: K,
217
- scroll: X
218
- }, h = fo(b), v = c.useRef(), J = (d) => {
216
+ fullScreen: z,
217
+ fullWidth: K,
218
+ maxWidth: L,
219
+ scroll: H
220
+ }, y = mo(b), v = c.useRef(), Q = (d) => {
219
221
  v.current = d.target === d.currentTarget;
220
- }, Q = (d) => {
221
- N && N(d), v.current && (v.current = null, M && M(d), y && y(d, "backdropClick"));
222
- }, C = lo(p), Z = c.useMemo(() => ({
222
+ }, Z = (d) => {
223
+ N && N(d), v.current && (v.current = null, M && M(d), h && h(d, "backdropClick"));
224
+ }, C = po(p), oo = c.useMemo(() => ({
223
225
  titleId: C
224
226
  }), [C]);
225
- return /* @__PURE__ */ i(mo, {
226
- className: g(h.root, Y),
227
+ return /* @__PURE__ */ i(go, {
228
+ className: g(y.root, _),
227
229
  closeAfterTransition: !0,
228
230
  components: {
229
- Backdrop: uo
231
+ Backdrop: fo
230
232
  },
231
233
  componentsProps: {
232
234
  backdrop: {
233
235
  transitionDuration: B,
234
236
  as: x,
235
- ...A
237
+ ...V
236
238
  }
237
239
  },
238
240
  disableEscapeKeyDown: W,
239
- onClose: y,
241
+ onClose: h,
240
242
  open: O,
241
243
  ref: t,
242
- onClick: Q,
244
+ onClick: Z,
243
245
  ownerState: b,
244
- ...G,
245
- children: /* @__PURE__ */ i(H, {
246
+ ...J,
247
+ children: /* @__PURE__ */ i(q, {
246
248
  appear: !0,
247
249
  in: O,
248
250
  timeout: B,
249
251
  role: "presentation",
250
- ...q,
251
- children: /* @__PURE__ */ i(go, {
252
- className: g(h.container),
253
- onMouseDown: J,
252
+ ...G,
253
+ children: /* @__PURE__ */ i(bo, {
254
+ className: g(y.container),
255
+ onMouseDown: Q,
254
256
  ownerState: b,
255
- children: /* @__PURE__ */ i(bo, {
256
- as: L,
257
+ children: /* @__PURE__ */ i(xo, {
258
+ as: X,
257
259
  elevation: 24,
258
260
  role: "dialog",
259
261
  "aria-describedby": l,
260
262
  "aria-labelledby": C,
261
263
  "aria-modal": m,
262
264
  ...R,
263
- className: g(h.paper, R.className),
265
+ className: g(y.paper, R.className),
264
266
  ownerState: b,
265
267
  children: /* @__PURE__ */ i(w.Provider, {
266
- value: Z,
267
- children: V
268
+ value: oo,
269
+ children: Y
268
270
  })
269
271
  })
270
272
  })
271
273
  })
272
274
  });
273
275
  });
274
- process.env.NODE_ENV !== "production" && (F.propTypes = {
276
+ process.env.NODE_ENV !== "production" && (I.propTypes = {
275
277
  // ┌────────────────────────────── Warning ──────────────────────────────┐
276
278
  // │ These PropTypes are generated from the TypeScript type definitions. │
277
279
  // │ To update them, edit the d.ts file and run `pnpm proptypes`. │
@@ -409,22 +411,22 @@ process.env.NODE_ENV !== "production" && (F.propTypes = {
409
411
  */
410
412
  TransitionProps: o.object
411
413
  });
412
- function xo(r) {
413
- return T("MuiDialogContent", r);
414
+ function ho(r) {
415
+ return k("MuiDialogContent", r);
414
416
  }
415
- k("MuiDialogContent", ["root", "dividers"]);
417
+ T("MuiDialogContent", ["root", "dividers"]);
416
418
  function yo(r) {
417
- return T("MuiDialogTitle", r);
419
+ return k("MuiDialogTitle", r);
418
420
  }
419
- const ho = k("MuiDialogTitle", ["root"]), vo = (r) => {
421
+ const vo = T("MuiDialogTitle", ["root"]), Co = (r) => {
420
422
  const {
421
423
  classes: e,
422
424
  dividers: t
423
425
  } = r;
424
426
  return P({
425
427
  root: ["root", t && "dividers"]
426
- }, xo, e);
427
- }, Co = f("div", {
428
+ }, ho, e);
429
+ }, Do = f("div", {
428
430
  name: "MuiDialogContent",
429
431
  slot: "Root",
430
432
  overridesResolver: (r, e) => {
@@ -433,7 +435,7 @@ const ho = k("MuiDialogTitle", ["root"]), vo = (r) => {
433
435
  } = r;
434
436
  return [e.root, t.dividers && e.dividers];
435
437
  }
436
- })(j(({
438
+ })(E(({
437
439
  theme: r
438
440
  }) => ({
439
441
  flex: "1 1 auto",
@@ -455,12 +457,12 @@ const ho = k("MuiDialogTitle", ["root"]), vo = (r) => {
455
457
  ownerState: e
456
458
  }) => !e.dividers,
457
459
  style: {
458
- [`.${ho.root} + &`]: {
460
+ [`.${vo.root} + &`]: {
459
461
  paddingTop: 0
460
462
  }
461
463
  }
462
464
  }]
463
- }))), I = /* @__PURE__ */ c.forwardRef(function(e, t) {
465
+ }))), U = /* @__PURE__ */ c.forwardRef(function(e, t) {
464
466
  const a = S({
465
467
  props: e,
466
468
  name: "MuiDialogContent"
@@ -471,15 +473,15 @@ const ho = k("MuiDialogTitle", ["root"]), vo = (r) => {
471
473
  } = a, p = {
472
474
  ...a,
473
475
  dividers: n
474
- }, m = vo(p);
475
- return /* @__PURE__ */ i(Co, {
476
+ }, m = Co(p);
477
+ return /* @__PURE__ */ i(Do, {
476
478
  className: g(m.root, s),
477
479
  ownerState: p,
478
480
  ref: t,
479
481
  ...l
480
482
  });
481
483
  });
482
- process.env.NODE_ENV !== "production" && (I.propTypes = {
484
+ process.env.NODE_ENV !== "production" && (U.propTypes = {
483
485
  // ┌────────────────────────────── Warning ──────────────────────────────┐
484
486
  // │ These PropTypes are generated from the TypeScript type definitions. │
485
487
  // │ To update them, edit the d.ts file and run `pnpm proptypes`. │
@@ -506,21 +508,21 @@ process.env.NODE_ENV !== "production" && (I.propTypes = {
506
508
  */
507
509
  sx: o.oneOfType([o.arrayOf(o.oneOfType([o.func, o.object, o.bool])), o.func, o.object])
508
510
  });
509
- const Do = (r) => {
511
+ const ko = (r) => {
510
512
  const {
511
513
  classes: e
512
514
  } = r;
513
515
  return P({
514
516
  root: ["root"]
515
517
  }, yo, e);
516
- }, ko = f(po, {
518
+ }, To = f(co, {
517
519
  name: "MuiDialogTitle",
518
520
  slot: "Root",
519
521
  overridesResolver: (r, e) => e.root
520
522
  })({
521
523
  padding: "16px 24px",
522
524
  flex: "0 0 auto"
523
- }), U = /* @__PURE__ */ c.forwardRef(function(e, t) {
525
+ }), A = /* @__PURE__ */ c.forwardRef(function(e, t) {
524
526
  const a = S({
525
527
  props: e,
526
528
  name: "MuiDialogTitle"
@@ -528,10 +530,10 @@ const Do = (r) => {
528
530
  className: s,
529
531
  id: n,
530
532
  ...l
531
- } = a, p = a, m = Do(p), {
533
+ } = a, p = a, m = ko(p), {
532
534
  titleId: x = n
533
535
  } = c.useContext(w);
534
- return /* @__PURE__ */ i(ko, {
536
+ return /* @__PURE__ */ i(To, {
535
537
  component: "h2",
536
538
  className: g(m.root, s),
537
539
  ownerState: p,
@@ -541,7 +543,7 @@ const Do = (r) => {
541
543
  ...l
542
544
  });
543
545
  });
544
- process.env.NODE_ENV !== "production" && (U.propTypes = {
546
+ process.env.NODE_ENV !== "production" && (A.propTypes = {
545
547
  // ┌────────────────────────────── Warning ──────────────────────────────┐
546
548
  // │ These PropTypes are generated from the TypeScript type definitions. │
547
549
  // │ To update them, edit the d.ts file and run `pnpm proptypes`. │
@@ -567,44 +569,54 @@ process.env.NODE_ENV !== "production" && (U.propTypes = {
567
569
  */
568
570
  sx: o.oneOfType([o.arrayOf(o.oneOfType([o.func, o.object, o.bool])), o.func, o.object])
569
571
  });
570
- function jo(r) {
571
- const e = oo(ro);
572
+ function Io(r) {
573
+ const e = eo(to), t = j(), a = so(t);
572
574
  if (!e)
573
575
  return null;
574
- const t = {
576
+ const s = {
575
577
  open: r.open === void 0 ? !0 : r.open,
576
578
  onClose: r.onClose || (() => {
577
579
  }),
578
580
  collapse: r.collapse === void 0 ? !1 : r.collapse
579
581
  };
580
582
  return /* @__PURE__ */ $(
581
- F,
583
+ I,
582
584
  {
583
- open: t.open,
584
- onClose: t.onClose,
585
+ open: s.open,
586
+ onClose: s.onClose,
585
587
  maxWidth: "sm",
586
588
  fullWidth: !0,
587
589
  PaperProps: {
588
- style: { borderRadius: 8 }
590
+ style: {
591
+ borderRadius: 8,
592
+ backgroundColor: a.paper,
593
+ color: a.text
594
+ }
589
595
  },
590
- "aria-hidden": !t.open,
596
+ "aria-hidden": !s.open,
591
597
  scroll: "body",
592
598
  children: [
593
- /* @__PURE__ */ i(U, { children: "Notification Preferences" }),
594
- /* @__PURE__ */ $(I, { children: [
595
- /* @__PURE__ */ i(eo, {}),
596
- e.webPushOptInMessage && /* @__PURE__ */ i("div", { children: /* @__PURE__ */ i(
597
- to,
598
- {
599
- hideAfterInteraction: !1,
600
- descriptionStyle: { fontSize: 12 }
601
- }
602
- ) })
603
- ] })
599
+ /* @__PURE__ */ i(A, { sx: { color: a.text }, children: "Notification Preferences" }),
600
+ /* @__PURE__ */ $(
601
+ U,
602
+ {
603
+ sx: { backgroundColor: a.paper, color: a.text },
604
+ children: [
605
+ /* @__PURE__ */ i(ro, {}),
606
+ e.webPushOptInMessage && /* @__PURE__ */ i("div", { children: /* @__PURE__ */ i(
607
+ ao,
608
+ {
609
+ hideAfterInteraction: !1,
610
+ descriptionStyle: { fontSize: 12 }
611
+ }
612
+ ) })
613
+ ]
614
+ }
615
+ )
604
616
  ]
605
617
  }
606
618
  );
607
619
  }
608
620
  export {
609
- jo as NotificationPreferencesPopup
621
+ Io as NotificationPreferencesPopup
610
622
  };