@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
@@ -0,0 +1,456 @@
1
+ import * as x from "react";
2
+ import { g as Y, a as w, s as M, h as t, m as rr, u as or, c as A, P as o, f as ar } from "./DefaultPropsProvider.js";
3
+ import { c as nr } from "./createSimplePaletteValueFilter.js";
4
+ import { jsxs as tr, jsx as er } from "react/jsx-runtime";
5
+ import { u as F } from "./useSlotProps.js";
6
+ const U = (a) => {
7
+ const r = x.useRef({});
8
+ return x.useEffect(() => {
9
+ r.current = a;
10
+ }), r.current;
11
+ };
12
+ function ir(a) {
13
+ const {
14
+ badgeContent: r,
15
+ invisible: n = !1,
16
+ max: e = 99,
17
+ showZero: l = !1
18
+ } = a, d = U({
19
+ badgeContent: r,
20
+ max: e
21
+ });
22
+ let c = n;
23
+ n === !1 && r === 0 && !l && (c = !0);
24
+ const {
25
+ badgeContent: i,
26
+ max: p = e
27
+ } = c ? d : a, m = i && Number(i) > p ? `${p}+` : i;
28
+ return {
29
+ badgeContent: i,
30
+ invisible: c,
31
+ max: p,
32
+ displayValue: m
33
+ };
34
+ }
35
+ function sr(a) {
36
+ return w("MuiBadge", a);
37
+ }
38
+ const s = Y("MuiBadge", [
39
+ "root",
40
+ "badge",
41
+ "dot",
42
+ "standard",
43
+ "anchorOriginTopRight",
44
+ "anchorOriginBottomRight",
45
+ "anchorOriginTopLeft",
46
+ "anchorOriginBottomLeft",
47
+ "invisible",
48
+ "colorError",
49
+ "colorInfo",
50
+ "colorPrimary",
51
+ "colorSecondary",
52
+ "colorSuccess",
53
+ "colorWarning",
54
+ "overlapRectangular",
55
+ "overlapCircular",
56
+ // TODO: v6 remove the overlap value from these class keys
57
+ "anchorOriginTopLeftCircular",
58
+ "anchorOriginTopLeftRectangular",
59
+ "anchorOriginTopRightCircular",
60
+ "anchorOriginTopRightRectangular",
61
+ "anchorOriginBottomLeftCircular",
62
+ "anchorOriginBottomLeftRectangular",
63
+ "anchorOriginBottomRightCircular",
64
+ "anchorOriginBottomRightRectangular"
65
+ ]), O = 10, y = 4, lr = (a) => {
66
+ const {
67
+ color: r,
68
+ anchorOrigin: n,
69
+ invisible: e,
70
+ overlap: l,
71
+ variant: d,
72
+ classes: c = {}
73
+ } = a, i = {
74
+ root: ["root"],
75
+ badge: ["badge", d, e && "invisible", `anchorOrigin${t(n.vertical)}${t(n.horizontal)}`, `anchorOrigin${t(n.vertical)}${t(n.horizontal)}${t(l)}`, `overlap${t(l)}`, r !== "default" && `color${t(r)}`]
76
+ };
77
+ return ar(i, sr, c);
78
+ }, cr = M("span", {
79
+ name: "MuiBadge",
80
+ slot: "Root",
81
+ overridesResolver: (a, r) => r.root
82
+ })({
83
+ position: "relative",
84
+ display: "inline-flex",
85
+ // For correct alignment with the text.
86
+ verticalAlign: "middle",
87
+ flexShrink: 0
88
+ }), pr = M("span", {
89
+ name: "MuiBadge",
90
+ slot: "Badge",
91
+ overridesResolver: (a, r) => {
92
+ const {
93
+ ownerState: n
94
+ } = a;
95
+ return [r.badge, r[n.variant], r[`anchorOrigin${t(n.anchorOrigin.vertical)}${t(n.anchorOrigin.horizontal)}${t(n.overlap)}`], n.color !== "default" && r[`color${t(n.color)}`], n.invisible && r.invisible];
96
+ }
97
+ })(rr(({
98
+ theme: a
99
+ }) => ({
100
+ display: "flex",
101
+ flexDirection: "row",
102
+ flexWrap: "wrap",
103
+ justifyContent: "center",
104
+ alignContent: "center",
105
+ alignItems: "center",
106
+ position: "absolute",
107
+ boxSizing: "border-box",
108
+ fontFamily: a.typography.fontFamily,
109
+ fontWeight: a.typography.fontWeightMedium,
110
+ fontSize: a.typography.pxToRem(12),
111
+ minWidth: O * 2,
112
+ lineHeight: 1,
113
+ padding: "0 6px",
114
+ height: O * 2,
115
+ borderRadius: O,
116
+ zIndex: 1,
117
+ // Render the badge on top of potential ripples.
118
+ transition: a.transitions.create("transform", {
119
+ easing: a.transitions.easing.easeInOut,
120
+ duration: a.transitions.duration.enteringScreen
121
+ }),
122
+ variants: [...Object.entries(a.palette).filter(nr(["contrastText"])).map(([r]) => ({
123
+ props: {
124
+ color: r
125
+ },
126
+ style: {
127
+ backgroundColor: (a.vars || a).palette[r].main,
128
+ color: (a.vars || a).palette[r].contrastText
129
+ }
130
+ })), {
131
+ props: {
132
+ variant: "dot"
133
+ },
134
+ style: {
135
+ borderRadius: y,
136
+ height: y * 2,
137
+ minWidth: y * 2,
138
+ padding: 0
139
+ }
140
+ }, {
141
+ props: ({
142
+ ownerState: r
143
+ }) => r.anchorOrigin.vertical === "top" && r.anchorOrigin.horizontal === "right" && r.overlap === "rectangular",
144
+ style: {
145
+ top: 0,
146
+ right: 0,
147
+ transform: "scale(1) translate(50%, -50%)",
148
+ transformOrigin: "100% 0%",
149
+ [`&.${s.invisible}`]: {
150
+ transform: "scale(0) translate(50%, -50%)"
151
+ }
152
+ }
153
+ }, {
154
+ props: ({
155
+ ownerState: r
156
+ }) => r.anchorOrigin.vertical === "bottom" && r.anchorOrigin.horizontal === "right" && r.overlap === "rectangular",
157
+ style: {
158
+ bottom: 0,
159
+ right: 0,
160
+ transform: "scale(1) translate(50%, 50%)",
161
+ transformOrigin: "100% 100%",
162
+ [`&.${s.invisible}`]: {
163
+ transform: "scale(0) translate(50%, 50%)"
164
+ }
165
+ }
166
+ }, {
167
+ props: ({
168
+ ownerState: r
169
+ }) => r.anchorOrigin.vertical === "top" && r.anchorOrigin.horizontal === "left" && r.overlap === "rectangular",
170
+ style: {
171
+ top: 0,
172
+ left: 0,
173
+ transform: "scale(1) translate(-50%, -50%)",
174
+ transformOrigin: "0% 0%",
175
+ [`&.${s.invisible}`]: {
176
+ transform: "scale(0) translate(-50%, -50%)"
177
+ }
178
+ }
179
+ }, {
180
+ props: ({
181
+ ownerState: r
182
+ }) => r.anchorOrigin.vertical === "bottom" && r.anchorOrigin.horizontal === "left" && r.overlap === "rectangular",
183
+ style: {
184
+ bottom: 0,
185
+ left: 0,
186
+ transform: "scale(1) translate(-50%, 50%)",
187
+ transformOrigin: "0% 100%",
188
+ [`&.${s.invisible}`]: {
189
+ transform: "scale(0) translate(-50%, 50%)"
190
+ }
191
+ }
192
+ }, {
193
+ props: ({
194
+ ownerState: r
195
+ }) => r.anchorOrigin.vertical === "top" && r.anchorOrigin.horizontal === "right" && r.overlap === "circular",
196
+ style: {
197
+ top: "14%",
198
+ right: "14%",
199
+ transform: "scale(1) translate(50%, -50%)",
200
+ transformOrigin: "100% 0%",
201
+ [`&.${s.invisible}`]: {
202
+ transform: "scale(0) translate(50%, -50%)"
203
+ }
204
+ }
205
+ }, {
206
+ props: ({
207
+ ownerState: r
208
+ }) => r.anchorOrigin.vertical === "bottom" && r.anchorOrigin.horizontal === "right" && r.overlap === "circular",
209
+ style: {
210
+ bottom: "14%",
211
+ right: "14%",
212
+ transform: "scale(1) translate(50%, 50%)",
213
+ transformOrigin: "100% 100%",
214
+ [`&.${s.invisible}`]: {
215
+ transform: "scale(0) translate(50%, 50%)"
216
+ }
217
+ }
218
+ }, {
219
+ props: ({
220
+ ownerState: r
221
+ }) => r.anchorOrigin.vertical === "top" && r.anchorOrigin.horizontal === "left" && r.overlap === "circular",
222
+ style: {
223
+ top: "14%",
224
+ left: "14%",
225
+ transform: "scale(1) translate(-50%, -50%)",
226
+ transformOrigin: "0% 0%",
227
+ [`&.${s.invisible}`]: {
228
+ transform: "scale(0) translate(-50%, -50%)"
229
+ }
230
+ }
231
+ }, {
232
+ props: ({
233
+ ownerState: r
234
+ }) => r.anchorOrigin.vertical === "bottom" && r.anchorOrigin.horizontal === "left" && r.overlap === "circular",
235
+ style: {
236
+ bottom: "14%",
237
+ left: "14%",
238
+ transform: "scale(1) translate(-50%, 50%)",
239
+ transformOrigin: "0% 100%",
240
+ [`&.${s.invisible}`]: {
241
+ transform: "scale(0) translate(-50%, 50%)"
242
+ }
243
+ }
244
+ }, {
245
+ props: {
246
+ invisible: !0
247
+ },
248
+ style: {
249
+ transition: a.transitions.create("transform", {
250
+ easing: a.transitions.easing.easeInOut,
251
+ duration: a.transitions.duration.leavingScreen
252
+ })
253
+ }
254
+ }]
255
+ })));
256
+ function L(a) {
257
+ return {
258
+ vertical: (a == null ? void 0 : a.vertical) ?? "top",
259
+ horizontal: (a == null ? void 0 : a.horizontal) ?? "right"
260
+ };
261
+ }
262
+ const gr = /* @__PURE__ */ x.forwardRef(function(r, n) {
263
+ const e = or({
264
+ props: r,
265
+ name: "MuiBadge"
266
+ }), {
267
+ anchorOrigin: l,
268
+ className: d,
269
+ classes: c,
270
+ component: i,
271
+ components: p = {},
272
+ componentsProps: m = {},
273
+ children: V,
274
+ overlap: T = "rectangular",
275
+ color: P = "default",
276
+ invisible: W = !1,
277
+ max: k = 99,
278
+ badgeContent: R,
279
+ slots: g,
280
+ slotProps: f,
281
+ showZero: C = !1,
282
+ variant: h = "standard",
283
+ ...E
284
+ } = e, {
285
+ badgeContent: B,
286
+ invisible: H,
287
+ max: Z,
288
+ displayValue: _
289
+ } = ir({
290
+ max: k,
291
+ invisible: W,
292
+ badgeContent: R,
293
+ showZero: C
294
+ }), q = U({
295
+ anchorOrigin: L(l),
296
+ color: P,
297
+ overlap: T,
298
+ variant: h,
299
+ badgeContent: R
300
+ }), $ = H || B == null && h !== "dot", {
301
+ color: G = P,
302
+ overlap: J = T,
303
+ anchorOrigin: K,
304
+ variant: z = h
305
+ } = $ ? q : e, Q = L(K), j = z !== "dot" ? _ : void 0, b = {
306
+ ...e,
307
+ badgeContent: B,
308
+ invisible: $,
309
+ max: Z,
310
+ displayValue: j,
311
+ showZero: C,
312
+ anchorOrigin: Q,
313
+ color: G,
314
+ overlap: J,
315
+ variant: z
316
+ }, N = lr(b), D = (g == null ? void 0 : g.root) ?? p.Root ?? cr, I = (g == null ? void 0 : g.badge) ?? p.Badge ?? pr, u = (f == null ? void 0 : f.root) ?? m.root, v = (f == null ? void 0 : f.badge) ?? m.badge, S = F({
317
+ elementType: D,
318
+ externalSlotProps: u,
319
+ externalForwardedProps: E,
320
+ additionalProps: {
321
+ ref: n,
322
+ as: i
323
+ },
324
+ ownerState: b,
325
+ className: A(u == null ? void 0 : u.className, N.root, d)
326
+ }), X = F({
327
+ elementType: I,
328
+ externalSlotProps: v,
329
+ ownerState: b,
330
+ className: A(N.badge, v == null ? void 0 : v.className)
331
+ });
332
+ return /* @__PURE__ */ tr(D, {
333
+ ...S,
334
+ children: [V, /* @__PURE__ */ er(I, {
335
+ ...X,
336
+ children: j
337
+ })]
338
+ });
339
+ });
340
+ process.env.NODE_ENV !== "production" && (gr.propTypes = {
341
+ // ┌────────────────────────────── Warning ──────────────────────────────┐
342
+ // │ These PropTypes are generated from the TypeScript type definitions. │
343
+ // │ To update them, edit the d.ts file and run `pnpm proptypes`. │
344
+ // └─────────────────────────────────────────────────────────────────────┘
345
+ /**
346
+ * The anchor of the badge.
347
+ * @default {
348
+ * vertical: 'top',
349
+ * horizontal: 'right',
350
+ * }
351
+ */
352
+ anchorOrigin: o.shape({
353
+ horizontal: o.oneOf(["left", "right"]),
354
+ vertical: o.oneOf(["bottom", "top"])
355
+ }),
356
+ /**
357
+ * The content rendered within the badge.
358
+ */
359
+ badgeContent: o.node,
360
+ /**
361
+ * The badge will be added relative to this node.
362
+ */
363
+ children: o.node,
364
+ /**
365
+ * Override or extend the styles applied to the component.
366
+ */
367
+ classes: o.object,
368
+ /**
369
+ * @ignore
370
+ */
371
+ className: o.string,
372
+ /**
373
+ * The color of the component.
374
+ * It supports both default and custom theme colors, which can be added as shown in the
375
+ * [palette customization guide](https://mui.com/material-ui/customization/palette/#custom-colors).
376
+ * @default 'default'
377
+ */
378
+ color: o.oneOfType([o.oneOf(["default", "primary", "secondary", "error", "info", "success", "warning"]), o.string]),
379
+ /**
380
+ * The component used for the root node.
381
+ * Either a string to use a HTML element or a component.
382
+ */
383
+ component: o.elementType,
384
+ /**
385
+ * The components used for each slot inside.
386
+ *
387
+ * @deprecated use the `slots` prop instead. This prop will be removed in v7. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
388
+ *
389
+ * @default {}
390
+ */
391
+ components: o.shape({
392
+ Badge: o.elementType,
393
+ Root: o.elementType
394
+ }),
395
+ /**
396
+ * The extra props for the slot components.
397
+ * You can override the existing props or add new ones.
398
+ *
399
+ * @deprecated use the `slotProps` prop instead. This prop will be removed in v7. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
400
+ *
401
+ * @default {}
402
+ */
403
+ componentsProps: o.shape({
404
+ badge: o.oneOfType([o.func, o.object]),
405
+ root: o.oneOfType([o.func, o.object])
406
+ }),
407
+ /**
408
+ * If `true`, the badge is invisible.
409
+ * @default false
410
+ */
411
+ invisible: o.bool,
412
+ /**
413
+ * Max count to show.
414
+ * @default 99
415
+ */
416
+ max: o.number,
417
+ /**
418
+ * Wrapped shape the badge should overlap.
419
+ * @default 'rectangular'
420
+ */
421
+ overlap: o.oneOf(["circular", "rectangular"]),
422
+ /**
423
+ * Controls whether the badge is hidden when `badgeContent` is zero.
424
+ * @default false
425
+ */
426
+ showZero: o.bool,
427
+ /**
428
+ * The props used for each slot inside the Badge.
429
+ * @default {}
430
+ */
431
+ slotProps: o.shape({
432
+ badge: o.oneOfType([o.func, o.object]),
433
+ root: o.oneOfType([o.func, o.object])
434
+ }),
435
+ /**
436
+ * The components used for each slot inside the Badge.
437
+ * Either a string to use a HTML element or a component.
438
+ * @default {}
439
+ */
440
+ slots: o.shape({
441
+ badge: o.elementType,
442
+ root: o.elementType
443
+ }),
444
+ /**
445
+ * The system prop that allows defining system overrides as well as additional CSS styles.
446
+ */
447
+ sx: o.oneOfType([o.arrayOf(o.oneOfType([o.func, o.object, o.bool])), o.func, o.object]),
448
+ /**
449
+ * The variant to use.
450
+ * @default 'standard'
451
+ */
452
+ variant: o.oneOfType([o.oneOf(["dot", "standard"]), o.string])
453
+ });
454
+ export {
455
+ gr as B
456
+ };
@@ -0,0 +1,57 @@
1
+ import { k as x, l as p, c as h, g as T, n as y, T as B, C as N, P as e } from "./DefaultPropsProvider.js";
2
+ import * as C from "react";
3
+ import { jsx as g } from "react/jsx-runtime";
4
+ import { u as b } from "./useTheme2.js";
5
+ import { e as v } from "./Typography.js";
6
+ function E(n = {}) {
7
+ const {
8
+ themeId: t,
9
+ defaultTheme: m,
10
+ defaultClassName: a = "MuiBox-root",
11
+ generateClassName: r
12
+ } = n, c = x("div", {
13
+ shouldForwardProp: (o) => o !== "theme" && o !== "sx" && o !== "as"
14
+ })(p);
15
+ return /* @__PURE__ */ C.forwardRef(function(l, f) {
16
+ const s = b(m), {
17
+ className: d,
18
+ component: i = "div",
19
+ ...u
20
+ } = v(l);
21
+ return /* @__PURE__ */ g(c, {
22
+ as: i,
23
+ ref: f,
24
+ className: h(d, r ? r(a) : a),
25
+ theme: t && s[t] || s,
26
+ ...u
27
+ });
28
+ });
29
+ }
30
+ const O = T("MuiBox", ["root"]), P = y(), j = E({
31
+ themeId: B,
32
+ defaultTheme: P,
33
+ defaultClassName: O.root,
34
+ generateClassName: N.generate
35
+ });
36
+ process.env.NODE_ENV !== "production" && (j.propTypes = {
37
+ // ┌────────────────────────────── Warning ──────────────────────────────┐
38
+ // │ These PropTypes are generated from the TypeScript type definitions. │
39
+ // │ To update them, edit the d.ts file and run `pnpm proptypes`. │
40
+ // └─────────────────────────────────────────────────────────────────────┘
41
+ /**
42
+ * @ignore
43
+ */
44
+ children: e.node,
45
+ /**
46
+ * The component used for the root node.
47
+ * Either a string to use a HTML element or a component.
48
+ */
49
+ component: e.elementType,
50
+ /**
51
+ * The system prop that allows defining system overrides as well as additional CSS styles.
52
+ */
53
+ sx: e.oneOfType([e.arrayOf(e.oneOfType([e.func, e.object, e.bool])), e.func, e.object])
54
+ });
55
+ export {
56
+ j as B
57
+ };