fansunited-frontend-components 0.0.39 → 0.0.40

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 (48) hide show
  1. package/ChanceGame.js +104 -102
  2. package/ClassicQuizPlay.js +45 -42
  3. package/CollectLead.js +25 -24
  4. package/Discussion.js +376 -378
  5. package/EitherOrPlay.d.ts +4 -0
  6. package/EitherOrPlay.d.ts.map +1 -0
  7. package/EitherOrPlay.js +2533 -0
  8. package/EventGamePlay.js +59 -54
  9. package/MatchQuizPlay.js +63 -57
  10. package/PersonalityQuizPlay.js +7935 -7201
  11. package/PickThePair.js +153 -151
  12. package/PollVote.js +108 -104
  13. package/chunks/{AlertMessage-C2aBXCrl.js → AlertMessage-cjTHrMUK.js} +51 -51
  14. package/chunks/ArrowRightAlt-88jKjh6A.js +8 -0
  15. package/chunks/Avatar-CQCrd1m-.js +352 -0
  16. package/chunks/ChanceGameEmbedVariant-DWqOTf4o.js +1051 -0
  17. package/chunks/{CheckCircle-D-GH16Lb.js → CheckCircle-ClY-iOQ5.js} +105 -105
  18. package/chunks/{CollectLeadForm-o9NdYQgu.js → CollectLeadForm-0vVnu4DL.js} +5 -5
  19. package/chunks/FavoriteBorder-BHnvGBrn.js +11 -0
  20. package/chunks/{useInfoPage-v91yL5SS.js → NotFoundSkeleton-B3RNa8KJ.js} +451 -646
  21. package/chunks/Notification-BTtUhfZQ.js +615 -0
  22. package/chunks/OverlayLeadAfterCollection-CaBbwZVo.js +480 -0
  23. package/chunks/{OverlayScoreStateSkeleton-xvq9lQEi.js → OverlayScoreStateSkeleton-DJn0Rim3.js} +3 -3
  24. package/chunks/Person-D0Im9_zE.js +522 -0
  25. package/chunks/{PickOneOfX-C2YpLk40.js → PickOneOfX-DYQ4c1o2.js} +7 -7
  26. package/chunks/{Portal-DWAr8MhA.js → Portal-B9wkUnY2.js} +7 -7
  27. package/chunks/{ConstantsProvider-BPJJz9fq.js → PrizeCard-gMp7I66d.js} +3593 -2860
  28. package/chunks/{Spinner-m59ZJZ35.js → Spinner-BBA89t5s.js} +50 -50
  29. package/chunks/StandardLeadAfterCollection-L1cOGfS6.js +432 -0
  30. package/chunks/{Tabs-BGihvj9C.js → Tabs-D_n8rNw3.js} +28 -28
  31. package/chunks/{Textarea-Bzlb89Zp.js → Textarea-BdN2xj4j.js} +44 -44
  32. package/chunks/{TimerOutlined-DiX8hCoC.js → TimerOutlined-DmKZDDI-.js} +1 -1
  33. package/chunks/chevron-right-DGEksBI7.js +330 -0
  34. package/chunks/default-quiz-bg-vertical-CT7rrg9o.js +5 -0
  35. package/chunks/index-2s5UkG1y.js +1607 -0
  36. package/chunks/useImageVariant-pnFelF9A.js +535 -0
  37. package/chunks/useInfoPage-DPkzE5Gn.js +204 -0
  38. package/components.d.ts +2 -1
  39. package/components.d.ts.map +1 -1
  40. package/index.d.ts +1 -0
  41. package/index.d.ts.map +1 -1
  42. package/index.js +4 -2
  43. package/package.json +1 -1
  44. package/chunks/ChanceGameEmbedVariant-BvIKBhq_.js +0 -2609
  45. package/chunks/Notification-Bwcoljir.js +0 -961
  46. package/chunks/OverlayLeadAfterCollection-B3D5ct0J.js +0 -901
  47. package/chunks/chevron-right-Dlc9ZKhv.js +0 -846
  48. package/chunks/useImageVariant-Do8kOVs2.js +0 -537
@@ -1,961 +0,0 @@
1
- import { j as ve, U, V as j, P as e, X as me, Y as he, _ as h, Z as K, n as I, m as $, s as T, p as G, k as W, q as C, K as re, t as X, r as A, $ as ne, O as ge, Q as ye, R as be, d as ke, w as Se, v as ze, B as Oe, T as Q } from "./ConstantsProvider-BPJJz9fq.js";
2
- import * as d from "react";
3
- import { c as xe, C as Ae } from "./CheckCircle-D-GH16Lb.js";
4
- import { jsx as k, jsxs as te } from "react/jsx-runtime";
5
- import { e as Ce } from "./Spinner-m59ZJZ35.js";
6
- function Z(r) {
7
- return r.substring(2).toLowerCase();
8
- }
9
- function Te(r, o) {
10
- return o.documentElement.clientWidth < r.clientX || o.documentElement.clientHeight < r.clientY;
11
- }
12
- function M(r) {
13
- const {
14
- children: o,
15
- disableReactTree: s = !1,
16
- mouseEvent: n = "onClick",
17
- onClickAway: a,
18
- touchEvent: t = "onTouchEnd"
19
- } = r, u = d.useRef(!1), l = d.useRef(null), g = d.useRef(!1), b = d.useRef(!1);
20
- d.useEffect(() => (setTimeout(() => {
21
- g.current = !0;
22
- }, 0), () => {
23
- g.current = !1;
24
- }), []);
25
- const y = ve(
26
- // @ts-expect-error TODO upstream fix
27
- o.ref,
28
- l
29
- ), f = U((p) => {
30
- const v = b.current;
31
- b.current = !1;
32
- const S = j(l.current);
33
- if (!g.current || !l.current || "clientX" in p && Te(p, S))
34
- return;
35
- if (u.current) {
36
- u.current = !1;
37
- return;
38
- }
39
- let i;
40
- p.composedPath ? i = p.composedPath().indexOf(l.current) > -1 : i = !S.documentElement.contains(
41
- // @ts-expect-error returns `false` as intended when not dispatched from a Node
42
- p.target
43
- ) || l.current.contains(
44
- // @ts-expect-error returns `false` as intended when not dispatched from a Node
45
- p.target
46
- ), !i && (s || !v) && a(p);
47
- }), O = (p) => (v) => {
48
- b.current = !0;
49
- const S = o.props[p];
50
- S && S(v);
51
- }, z = {
52
- ref: y
53
- };
54
- return t !== !1 && (z[t] = O(t)), d.useEffect(() => {
55
- if (t !== !1) {
56
- const p = Z(t), v = j(l.current), S = () => {
57
- u.current = !0;
58
- };
59
- return v.addEventListener(p, f), v.addEventListener("touchmove", S), () => {
60
- v.removeEventListener(p, f), v.removeEventListener("touchmove", S);
61
- };
62
- }
63
- }, [f, t]), n !== !1 && (z[n] = O(n)), d.useEffect(() => {
64
- if (n !== !1) {
65
- const p = Z(n), v = j(l.current);
66
- return v.addEventListener(p, f), () => {
67
- v.removeEventListener(p, f);
68
- };
69
- }
70
- }, [f, n]), /* @__PURE__ */ k(d.Fragment, {
71
- children: /* @__PURE__ */ d.cloneElement(o, z)
72
- });
73
- }
74
- process.env.NODE_ENV !== "production" && (M.propTypes = {
75
- // ┌────────────────────────────── Warning ──────────────────────────────┐
76
- // │ These PropTypes are generated from the TypeScript type definitions. │
77
- // │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
78
- // └─────────────────────────────────────────────────────────────────────┘
79
- /**
80
- * The wrapped element.
81
- */
82
- children: Ce.isRequired,
83
- /**
84
- * If `true`, the React tree is ignored and only the DOM tree is considered.
85
- * This prop changes how portaled elements are handled.
86
- * @default false
87
- */
88
- disableReactTree: e.bool,
89
- /**
90
- * The mouse event to listen to. You can disable the listener by providing `false`.
91
- * @default 'onClick'
92
- */
93
- mouseEvent: e.oneOf(["onClick", "onMouseDown", "onMouseUp", "onPointerDown", "onPointerUp", !1]),
94
- /**
95
- * Callback fired when a "click away" event is detected.
96
- */
97
- onClickAway: e.func.isRequired,
98
- /**
99
- * The touch event to listen to. You can disable the listener by providing `false`.
100
- * @default 'onTouchEnd'
101
- */
102
- touchEvent: e.oneOf(["onTouchEnd", "onTouchStart", !1])
103
- });
104
- process.env.NODE_ENV !== "production" && (M.propTypes = me(M.propTypes));
105
- function Ee(r = {}) {
106
- const {
107
- autoHideDuration: o = null,
108
- disableWindowBlurListener: s = !1,
109
- onClose: n,
110
- open: a,
111
- resumeHideDuration: t
112
- } = r, u = he();
113
- d.useEffect(() => {
114
- if (!a)
115
- return;
116
- function i(c) {
117
- c.defaultPrevented || (c.key === "Escape" || c.key === "Esc") && (n == null || n(c, "escapeKeyDown"));
118
- }
119
- return document.addEventListener("keydown", i), () => {
120
- document.removeEventListener("keydown", i);
121
- };
122
- }, [a, n]);
123
- const l = U((i, c) => {
124
- n == null || n(i, c);
125
- }), g = U((i) => {
126
- !n || i == null || u.start(i, () => {
127
- l(null, "timeout");
128
- });
129
- });
130
- d.useEffect(() => (a && g(o), u.clear), [a, o, g, u]);
131
- const b = (i) => {
132
- n == null || n(i, "clickaway");
133
- }, y = u.clear, f = d.useCallback(() => {
134
- o != null && g(t ?? o * 0.5);
135
- }, [o, t, g]), O = (i) => (c) => {
136
- const m = i.onBlur;
137
- m == null || m(c), f();
138
- }, z = (i) => (c) => {
139
- const m = i.onFocus;
140
- m == null || m(c), y();
141
- }, p = (i) => (c) => {
142
- const m = i.onMouseEnter;
143
- m == null || m(c), y();
144
- }, v = (i) => (c) => {
145
- const m = i.onMouseLeave;
146
- m == null || m(c), f();
147
- };
148
- return d.useEffect(() => {
149
- if (!s && a)
150
- return window.addEventListener("focus", f), window.addEventListener("blur", y), () => {
151
- window.removeEventListener("focus", f), window.removeEventListener("blur", y);
152
- };
153
- }, [s, a, f, y]), {
154
- getRootProps: (i = {}) => {
155
- const c = h({}, K(r), K(i));
156
- return h({
157
- // ClickAwayListener adds an `onClick` prop which results in the alert not being announced.
158
- // See https://github.com/mui/material-ui/issues/29080
159
- role: "presentation"
160
- }, i, c, {
161
- onBlur: O(c),
162
- onFocus: z(c),
163
- onMouseEnter: p(c),
164
- onMouseLeave: v(c)
165
- });
166
- },
167
- onClickAway: b
168
- };
169
- }
170
- const Re = xe(/* @__PURE__ */ k("path", {
171
- d: "M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"
172
- }), "Person");
173
- function De(r) {
174
- return I("MuiAvatar", r);
175
- }
176
- $("MuiAvatar", ["root", "colorPrimary", "colorNeutral", "colorDanger", "colorSuccess", "colorWarning", "colorContext", "fallback", "sizeSm", "sizeMd", "sizeLg", "img", "variantOutlined", "variantSoft", "variantSolid"]);
177
- function Pe(r) {
178
- return I("MuiAvatarGroup", r);
179
- }
180
- $("MuiAvatarGroup", ["root"]);
181
- const we = ["className", "color", "component", "size", "variant", "children", "slots", "slotProps"], J = /* @__PURE__ */ d.createContext(void 0);
182
- process.env.NODE_ENV !== "production" && (J.displayName = "AvatarGroupContext");
183
- const Ne = () => X({
184
- root: ["root"]
185
- }, Pe, {}), Le = T("div", {
186
- name: "JoyAvatarGroup",
187
- slot: "Root",
188
- overridesResolver: (r, o) => o.root
189
- })(({
190
- ownerState: r,
191
- theme: o
192
- }) => h({}, r.size === "sm" && {
193
- "--AvatarGroup-gap": "-0.375rem",
194
- "--Avatar-ringSize": "2px"
195
- }, r.size === "md" && {
196
- "--AvatarGroup-gap": "-0.5rem",
197
- "--Avatar-ringSize": "2px"
198
- }, r.size === "lg" && {
199
- "--AvatarGroup-gap": "-0.625rem",
200
- "--Avatar-ringSize": "4px"
201
- }, {
202
- "--Avatar-ring": `0 0 0 var(--Avatar-ringSize) var(--Avatar-ringColor, ${o.vars.palette.background.surface})`,
203
- "--Avatar-marginInlineStart": "var(--AvatarGroup-gap)",
204
- display: "flex",
205
- marginInlineStart: "calc(-1 * var(--AvatarGroup-gap))"
206
- })), Me = /* @__PURE__ */ d.forwardRef(function(o, s) {
207
- const n = G({
208
- props: o,
209
- name: "JoyAvatarGroup"
210
- }), {
211
- className: a,
212
- color: t,
213
- component: u = "div",
214
- size: l = "md",
215
- variant: g,
216
- children: b,
217
- slots: y = {},
218
- slotProps: f = {}
219
- } = n, O = W(n, we), z = d.useMemo(() => h({}, n, {
220
- color: t,
221
- component: u,
222
- size: l,
223
- variant: g
224
- }), [t, u, n, l, g]), p = Ne(), [v, S] = C("root", {
225
- ref: s,
226
- className: re(p.root, a),
227
- elementType: Le,
228
- externalForwardedProps: h({}, O, {
229
- component: u,
230
- slots: y,
231
- slotProps: f
232
- }),
233
- ownerState: z
234
- });
235
- return /* @__PURE__ */ k(J.Provider, {
236
- value: z,
237
- children: /* @__PURE__ */ k(v, h({}, S, {
238
- children: b
239
- }))
240
- });
241
- });
242
- process.env.NODE_ENV !== "production" && (Me.propTypes = {
243
- // ┌────────────────────────────── Warning ──────────────────────────────┐
244
- // │ These PropTypes are generated from the TypeScript type definitions. │
245
- // │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
246
- // └─────────────────────────────────────────────────────────────────────┘
247
- /**
248
- * Used to render icon or text elements inside the AvatarGroup if `src` is not set.
249
- * This can be an element, or just a string.
250
- */
251
- children: e.node,
252
- /**
253
- * @ignore
254
- */
255
- className: e.string,
256
- /**
257
- * The color of the component. It supports those theme colors that make sense for this component.
258
- * @default 'neutral'
259
- */
260
- color: e.oneOfType([e.oneOf(["danger", "neutral", "primary", "success", "warning"]), e.string]),
261
- /**
262
- * The component used for the root node.
263
- * Either a string to use a HTML element or a component.
264
- */
265
- component: e.elementType,
266
- /**
267
- * The size of the component.
268
- * It accepts theme values between 'sm' and 'lg'.
269
- * @default 'md'
270
- */
271
- size: e.oneOfType([e.oneOf(["lg", "md", "sm"]), e.string]),
272
- /**
273
- * The props used for each slot inside.
274
- * @default {}
275
- */
276
- slotProps: e.shape({
277
- root: e.oneOfType([e.func, e.object])
278
- }),
279
- /**
280
- * The components used for each slot inside.
281
- * @default {}
282
- */
283
- slots: e.shape({
284
- root: e.elementType
285
- }),
286
- /**
287
- * The system prop that allows defining system overrides as well as additional CSS styles.
288
- */
289
- sx: e.oneOfType([e.arrayOf(e.oneOfType([e.func, e.object, e.bool])), e.func, e.object]),
290
- /**
291
- * The [global variant](https://mui.com/joy-ui/main-features/global-variants/) to use.
292
- * @default 'soft'
293
- */
294
- variant: e.oneOfType([e.oneOf(["outlined", "plain", "soft", "solid"]), e.string])
295
- });
296
- const Ie = ["alt", "color", "size", "variant", "src", "srcSet", "children", "component", "slots", "slotProps"], $e = (r) => {
297
- const {
298
- size: o,
299
- variant: s,
300
- color: n,
301
- src: a,
302
- srcSet: t
303
- } = r, u = {
304
- root: ["root", s && `variant${A(s)}`, n && `color${A(n)}`, o && `size${A(o)}`],
305
- img: [(a || t) && "img"],
306
- fallback: ["fallback"]
307
- };
308
- return X(u, De, {});
309
- }, _e = T("div", {
310
- name: "JoyAvatar",
311
- slot: "Root",
312
- overridesResolver: (r, o) => o.root
313
- })(({
314
- theme: r,
315
- ownerState: o
316
- }) => {
317
- var s;
318
- return h({
319
- "--Icon-color": o.color !== "neutral" || o.variant === "solid" ? "currentColor" : r.vars.palette.text.icon
320
- }, r.typography[`title-${o.size}`], o.size === "sm" && {
321
- width: "var(--Avatar-size, 2rem)",
322
- height: "var(--Avatar-size, 2rem)",
323
- fontSize: "calc(var(--Avatar-size, 2rem) * 0.4375)"
324
- // default as 14px
325
- }, o.size === "md" && {
326
- width: "var(--Avatar-size, 2.5rem)",
327
- height: "var(--Avatar-size, 2.5rem)",
328
- fontSize: "calc(var(--Avatar-size, 2.5rem) * 0.4)"
329
- // default as 16px
330
- }, o.size === "lg" && {
331
- width: "var(--Avatar-size, 3rem)",
332
- height: "var(--Avatar-size, 3rem)",
333
- fontSize: "calc(var(--Avatar-size, 3rem) * 0.375)"
334
- // default as 18px
335
- }, {
336
- marginInlineStart: "var(--Avatar-marginInlineStart)",
337
- boxShadow: "var(--Avatar-ring)",
338
- position: "relative",
339
- display: "flex",
340
- alignItems: "center",
341
- justifyContent: "center",
342
- flexShrink: 0,
343
- lineHeight: 1,
344
- overflow: "hidden",
345
- borderRadius: "var(--Avatar-radius, 50%)",
346
- userSelect: "none"
347
- }, (s = r.variants[o.variant]) == null ? void 0 : s[o.color]);
348
- }), He = T("img", {
349
- name: "JoyAvatar",
350
- slot: "Img",
351
- overridesResolver: (r, o) => o.img
352
- })({
353
- width: "100%",
354
- height: "100%",
355
- textAlign: "center",
356
- // Handle non-square image. The property isn't supported by IE11.
357
- objectFit: "cover",
358
- // Hide alt text.
359
- color: "transparent",
360
- // Hide the image broken icon, only works on Chrome.
361
- textIndent: 1e4
362
- }), Be = T(Re, {
363
- name: "JoyAvatar",
364
- slot: "Fallback",
365
- overridesResolver: (r, o) => o.fallback
366
- })({
367
- width: "64%",
368
- height: "64%"
369
- });
370
- function Fe({
371
- crossOrigin: r,
372
- referrerPolicy: o,
373
- src: s,
374
- srcSet: n
375
- }) {
376
- const [a, t] = d.useState(!1);
377
- return d.useEffect(() => {
378
- if (!s && !n)
379
- return;
380
- t(!1);
381
- let u = !0;
382
- const l = new Image();
383
- return l.onload = () => {
384
- u && t("loaded");
385
- }, l.onerror = () => {
386
- u && t("error");
387
- }, l.crossOrigin = r, l.referrerPolicy = o, s && (l.src = s), n && (l.srcset = n), () => {
388
- u = !1;
389
- };
390
- }, [r, o, s, n]), a;
391
- }
392
- const je = /* @__PURE__ */ d.forwardRef(function(o, s) {
393
- const n = G({
394
- props: o,
395
- name: "JoyAvatar"
396
- }), a = d.useContext(J), {
397
- alt: t,
398
- color: u = "neutral",
399
- size: l = "md",
400
- variant: g = "soft",
401
- src: b,
402
- srcSet: y,
403
- children: f,
404
- component: O,
405
- slots: z = {},
406
- slotProps: p = {}
407
- } = n, v = W(n, Ie), S = o.variant || (a == null ? void 0 : a.variant) || g, i = o.color || (a == null ? void 0 : a.color) || u, c = o.size || (a == null ? void 0 : a.size) || l;
408
- let m = null;
409
- const E = h({}, n, {
410
- color: i,
411
- size: c,
412
- variant: S,
413
- grouped: !!a
414
- }), D = $e(E), P = h({}, v, {
415
- component: O,
416
- slots: z,
417
- slotProps: p
418
- }), [L, _] = C("root", {
419
- ref: s,
420
- className: D.root,
421
- elementType: _e,
422
- externalForwardedProps: P,
423
- ownerState: E
424
- }), [w, R] = C("img", {
425
- additionalProps: {
426
- alt: t,
427
- src: b,
428
- srcSet: y
429
- },
430
- className: D.img,
431
- elementType: He,
432
- externalForwardedProps: P,
433
- ownerState: E
434
- }), [x, N] = C("fallback", {
435
- className: D.fallback,
436
- elementType: Be,
437
- externalForwardedProps: P,
438
- ownerState: E
439
- }), H = Fe(h({}, R, {
440
- src: b,
441
- srcSet: y
442
- }));
443
- return (b || y) && H !== "error" ? m = /* @__PURE__ */ k(w, h({}, R)) : f != null ? m = f : t ? m = t[0] : m = /* @__PURE__ */ k(x, h({}, N)), /* @__PURE__ */ k(L, h({}, _, {
444
- children: m
445
- }));
446
- });
447
- process.env.NODE_ENV !== "production" && (je.propTypes = {
448
- // ┌────────────────────────────── Warning ──────────────────────────────┐
449
- // │ These PropTypes are generated from the TypeScript type definitions. │
450
- // │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
451
- // └─────────────────────────────────────────────────────────────────────┘
452
- /**
453
- * Used in combination with `src` or `srcSet` to
454
- * provide an alt attribute for the rendered `img` element.
455
- */
456
- alt: e.string,
457
- /**
458
- * Used to render icon or text elements inside the Avatar if `src` is not set.
459
- * This can be an element, or just a string.
460
- */
461
- children: e.node,
462
- /**
463
- * The color of the component. It supports those theme colors that make sense for this component.
464
- * @default 'neutral'
465
- */
466
- color: e.oneOfType([e.oneOf(["danger", "neutral", "primary", "success", "warning"]), e.string]),
467
- /**
468
- * The component used for the root node.
469
- * Either a string to use a HTML element or a component.
470
- */
471
- component: e.elementType,
472
- /**
473
- * The size of the component.
474
- * It accepts theme values between 'sm' and 'lg'.
475
- * @default 'md'
476
- */
477
- size: e.oneOfType([e.oneOf(["lg", "md", "sm"]), e.string]),
478
- /**
479
- * The props used for each slot inside.
480
- * @default {}
481
- */
482
- slotProps: e.shape({
483
- fallback: e.oneOfType([e.func, e.object]),
484
- img: e.oneOfType([e.func, e.object]),
485
- root: e.oneOfType([e.func, e.object])
486
- }),
487
- /**
488
- * The components used for each slot inside.
489
- * @default {}
490
- */
491
- slots: e.shape({
492
- fallback: e.elementType,
493
- img: e.elementType,
494
- root: e.elementType
495
- }),
496
- /**
497
- * The `src` attribute for the `img` element.
498
- */
499
- src: e.string,
500
- /**
501
- * The `srcSet` attribute for the `img` element.
502
- * Use this attribute for responsive image display.
503
- */
504
- srcSet: e.string,
505
- /**
506
- * The system prop that allows defining system overrides as well as additional CSS styles.
507
- */
508
- sx: e.oneOfType([e.arrayOf(e.oneOfType([e.func, e.object, e.bool])), e.func, e.object]),
509
- /**
510
- * The [global variant](https://mui.com/joy-ui/main-features/global-variants/) to use.
511
- * @default 'soft'
512
- */
513
- variant: e.oneOfType([e.oneOf(["outlined", "plain", "soft", "solid"]), e.string])
514
- });
515
- function no(r) {
516
- return I("MuiDivider", r);
517
- }
518
- const to = $("MuiDivider", ["root", "horizontal", "vertical", "insetContext", "insetNone"]);
519
- function Ue(r) {
520
- return I("MuiSnackbar", r);
521
- }
522
- $("MuiSnackbar", ["root", "anchorOriginTopCenter", "anchorOriginBottomCenter", "anchorOriginTopRight", "anchorOriginBottomRight", "anchorOriginTopLeft", "anchorOriginBottomLeft", "colorPrimary", "colorDanger", "colorNeutral", "colorSuccess", "colorWarning", "endDecorator", "sizeSm", "sizeMd", "sizeLg", "startDecorator", "variantPlain", "variantOutlined", "variantSoft", "variantSolid"]);
523
- const Ge = ["anchorOrigin", "animationDuration", "autoHideDuration", "color", "children", "className", "component", "disableWindowBlurListener", "endDecorator", "invertedColors", "onBlur", "onClose", "onFocus", "onMouseEnter", "onMouseLeave", "onUnmount", "open", "resumeHideDuration", "size", "slots", "slotProps", "startDecorator", "variant"];
524
- let ae = (r) => r, ee, oe;
525
- const We = (r) => {
526
- const {
527
- variant: o,
528
- color: s,
529
- size: n,
530
- anchorOrigin: a
531
- } = r, t = {
532
- root: ["root", n && `size${A(n)}`, s && `color${A(s)}`, o && `variant${A(o)}`, `anchorOrigin${A(a.vertical)}${A(a.horizontal)}`],
533
- startDecorator: ["startDecorator"],
534
- endDecorator: ["endDecorator"]
535
- };
536
- return X(t, Ue, {});
537
- }, Xe = ne(ee || (ee = ae`
538
- 0% {
539
- transform: translateX(var(--Snackbar-translateX, 0px)) translateY(calc(var(--_Snackbar-anchorBottom, 1) * 100%));
540
- opacity: 0;
541
- }
542
- 50% {
543
- opacity: 1;
544
- }
545
- 100% {
546
- transform: translateX(var(--Snackbar-translateX, 0px)) translateY(0);
547
- }
548
- `)), Je = ne(oe || (oe = ae`
549
- 0% {
550
- transform: translateX(var(--Snackbar-translateX, 0px)) translateY(0);
551
- opacity: 1;
552
- }
553
- 100% {
554
- transform: translateX(var(--Snackbar-translateX, 0px)) translateY(calc(var(--_Snackbar-anchorBottom, 1) * 100%));
555
- opacity: 0;
556
- }
557
- `)), Ve = T("div", {
558
- name: "JoySnackbar",
559
- slot: "Root",
560
- overridesResolver: (r, o) => o.root
561
- })(({
562
- theme: r,
563
- ownerState: o
564
- }) => {
565
- var s, n, a, t, u, l, g;
566
- const {
567
- p: b,
568
- padding: y,
569
- borderRadius: f
570
- } = ge({
571
- theme: r,
572
- ownerState: o
573
- }, ["p", "padding", "borderRadius"]);
574
- return [h({
575
- "--Snackbar-radius": r.vars.radius.sm,
576
- "--Snackbar-decoratorChildRadius": "max((var(--Snackbar-radius) - var(--variant-borderWidth, 0px)) - var(--Snackbar-padding), min(var(--Snackbar-padding) + var(--variant-borderWidth, 0px), var(--Snackbar-radius) / 2))",
577
- "--Button-minHeight": "var(--Snackbar-decoratorChildHeight)",
578
- "--IconButton-size": "var(--Snackbar-decoratorChildHeight)",
579
- "--Button-radius": "var(--Snackbar-decoratorChildRadius)",
580
- "--IconButton-radius": "var(--Snackbar-decoratorChildRadius)",
581
- "--Icon-color": "currentColor"
582
- }, o.size === "sm" && {
583
- "--Snackbar-padding": "0.75rem",
584
- "--Snackbar-inset": "0.5rem",
585
- "--Snackbar-decoratorChildHeight": "1.5rem",
586
- "--Icon-fontSize": r.vars.fontSize.xl,
587
- gap: "0.5rem"
588
- }, o.size === "md" && {
589
- "--Snackbar-padding": "1rem",
590
- "--Snackbar-inset": "0.75rem",
591
- // the spacing between Snackbar and the viewport
592
- "--Snackbar-decoratorChildHeight": "2rem",
593
- "--Icon-fontSize": r.vars.fontSize.xl,
594
- gap: "0.625rem"
595
- }, o.size === "lg" && {
596
- "--Snackbar-padding": "1.25rem",
597
- "--Snackbar-inset": "1rem",
598
- "--Snackbar-decoratorChildHeight": "2.375rem",
599
- "--Icon-fontSize": r.vars.fontSize.xl2,
600
- gap: "0.875rem"
601
- }, {
602
- zIndex: r.vars.zIndex.snackbar,
603
- position: "fixed",
604
- display: "flex",
605
- alignItems: "center",
606
- minWidth: 300,
607
- top: ((s = o.anchorOrigin) == null ? void 0 : s.vertical) === "top" ? "var(--Snackbar-inset)" : void 0,
608
- left: ((n = o.anchorOrigin) == null ? void 0 : n.horizontal) === "left" ? "var(--Snackbar-inset)" : void 0,
609
- bottom: ((a = o.anchorOrigin) == null ? void 0 : a.vertical) === "bottom" ? "var(--Snackbar-inset)" : void 0,
610
- right: ((t = o.anchorOrigin) == null ? void 0 : t.horizontal) === "right" ? "var(--Snackbar-inset)" : void 0
611
- }, ((u = o.anchorOrigin) == null ? void 0 : u.horizontal) === "center" && {
612
- "--Snackbar-translateX": "-50%",
613
- left: "50%",
614
- transform: "translateX(var(--Snackbar-translateX))"
615
- }, ((l = o.anchorOrigin) == null ? void 0 : l.vertical) === "top" && {
616
- "--_Snackbar-anchorBottom": "-1"
617
- }, {
618
- animation: `${Xe} ${o.animationDuration}ms forwards`
619
- }, !o.open && {
620
- animationName: Je
621
- }, {
622
- boxShadow: r.vars.shadow.lg,
623
- backgroundColor: r.vars.palette.background.surface,
624
- padding: "var(--Snackbar-padding)",
625
- borderRadius: "var(--Snackbar-radius)"
626
- }, r.typography[`body-${{
627
- sm: "xs",
628
- md: "sm",
629
- lg: "md"
630
- }[o.size]}`], o.variant === "solid" && o.color && o.invertedColors && ye(o.color)(r), o.variant === "soft" && o.color && o.invertedColors && be(o.color)(r), (g = r.variants[o.variant]) == null ? void 0 : g[o.color]), b !== void 0 && {
631
- "--Snackbar-padding": b
632
- }, y !== void 0 && {
633
- "--Snackbar-padding": y
634
- }, f !== void 0 && {
635
- "--Snackbar-radius": f
636
- }];
637
- }), qe = T("span", {
638
- name: "JoySnackbar",
639
- slot: "StartDecorator",
640
- overridesResolver: (r, o) => o.startDecorator
641
- })({
642
- display: "inherit",
643
- flex: "none"
644
- }), Ye = T("span", {
645
- name: "JoySnackbar",
646
- slot: "EndDecorator",
647
- overridesResolver: (r, o) => o.endDecorator
648
- })({
649
- display: "inherit",
650
- flex: "none",
651
- marginLeft: "auto"
652
- }), Ke = {
653
- vertical: "bottom",
654
- horizontal: "right"
655
- }, se = /* @__PURE__ */ d.forwardRef(function(o, s) {
656
- const n = G({
657
- props: o,
658
- name: "JoySnackbar"
659
- }), {
660
- anchorOrigin: a = Ke,
661
- animationDuration: t = 300,
662
- autoHideDuration: u = null,
663
- color: l = "neutral",
664
- children: g,
665
- className: b,
666
- component: y,
667
- disableWindowBlurListener: f = !1,
668
- endDecorator: O,
669
- invertedColors: z = !1,
670
- onUnmount: p,
671
- open: v,
672
- size: S = "md",
673
- slots: i = {},
674
- slotProps: c,
675
- startDecorator: m,
676
- variant: E = "outlined"
677
- } = n, D = W(n, Ge), [P, L] = d.useState(!0), [_, w] = d.useState(!1), R = d.useRef(p);
678
- R.current = p, d.useEffect(() => {
679
- if (v)
680
- w(!1), L(!1);
681
- else {
682
- w(!0);
683
- const F = setTimeout(() => {
684
- var Y;
685
- L(!0), w(!1), (Y = R.current) == null || Y.call(R);
686
- }, t);
687
- return () => {
688
- clearTimeout(F);
689
- };
690
- }
691
- }, [v, t]);
692
- const x = h({}, n, {
693
- anchorOrigin: a,
694
- autoHideDuration: u,
695
- color: l,
696
- animationDuration: t,
697
- disableWindowBlurListener: f,
698
- invertedColors: z,
699
- size: S,
700
- variant: E
701
- });
702
- delete x.onUnmount;
703
- const N = We(x), {
704
- getRootProps: H,
705
- onClickAway: V
706
- } = Ee(x), q = (F) => {
707
- _ || V(F);
708
- }, B = h({}, D, {
709
- component: y,
710
- slots: i,
711
- slotProps: c
712
- }), [ie, ce] = C("root", {
713
- ref: s,
714
- className: re(N.root, b),
715
- elementType: Ve,
716
- externalForwardedProps: B,
717
- getSlotProps: H,
718
- ownerState: x
719
- }), [le, ue] = C("startDecorator", {
720
- className: N.startDecorator,
721
- elementType: qe,
722
- externalForwardedProps: B,
723
- ownerState: x
724
- }), [de, pe] = C("endDecorator", {
725
- className: N.endDecorator,
726
- elementType: Ye,
727
- externalForwardedProps: B,
728
- ownerState: x
729
- }), fe = i.clickAway || M;
730
- return !v && P ? null : /* @__PURE__ */ k(fe, h({
731
- onClickAway: q
732
- }, typeof (c == null ? void 0 : c.clickAway) == "function" ? c.clickAway(x) : c == null ? void 0 : c.clickAway, {
733
- children: /* @__PURE__ */ te(ie, h({}, ce, {
734
- children: [m && /* @__PURE__ */ k(le, h({}, ue, {
735
- children: m
736
- })), g, O && /* @__PURE__ */ k(de, h({}, pe, {
737
- children: O
738
- }))]
739
- }))
740
- }));
741
- });
742
- process.env.NODE_ENV !== "production" && (se.propTypes = {
743
- // ┌────────────────────────────── Warning ──────────────────────────────┐
744
- // │ These PropTypes are generated from the TypeScript type definitions. │
745
- // │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
746
- // └─────────────────────────────────────────────────────────────────────┘
747
- /**
748
- * The anchor of the `Snackbar`.
749
- * On smaller screens, the component grows to occupy all the available width,
750
- * the horizontal alignment is ignored.
751
- * @default { vertical: 'bottom', horizontal: 'right' }
752
- */
753
- anchorOrigin: e.shape({
754
- horizontal: e.oneOf(["center", "left", "right"]).isRequired,
755
- vertical: e.oneOf(["bottom", "top"]).isRequired
756
- }),
757
- /**
758
- * The duration of the animation in milliseconds. This value is used to control
759
- * the length of time it takes for an animation to complete one cycle. It is also
760
- * utilized for delaying the unmount of the component.
761
- * Provide this value if you have your own animation so that we can precisely
762
- * time the component's unmount to match your custom animation.
763
- * @default 300
764
- */
765
- animationDuration: e.number,
766
- /**
767
- * The number of milliseconds to wait before automatically calling the
768
- * `onClose` function. `onClose` should then set the state of the `open`
769
- * prop to hide the Snackbar. This behavior is disabled by default with
770
- * the `null` value.
771
- * @default null
772
- */
773
- autoHideDuration: e.number,
774
- /**
775
- * @ignore
776
- */
777
- children: e.node,
778
- /**
779
- * @ignore
780
- */
781
- className: e.string,
782
- /**
783
- * The color of the component. It supports those theme colors that make sense for this component.
784
- * @default 'neutral'
785
- */
786
- color: e.oneOf(["danger", "neutral", "primary", "success", "warning"]),
787
- /**
788
- * The component used for the root node.
789
- * Either a string to use a HTML element or a component.
790
- */
791
- component: e.elementType,
792
- /**
793
- * If `true`, the `autoHideDuration` timer will expire even if the window is not focused.
794
- * @default false
795
- */
796
- disableWindowBlurListener: e.bool,
797
- /**
798
- * Element placed after the children.
799
- */
800
- endDecorator: e.node,
801
- /**
802
- * If `true`, the children with an implicit color prop invert their colors to match the component's variant and color.
803
- * @default false
804
- */
805
- invertedColors: e.bool,
806
- /**
807
- * When displaying multiple consecutive snackbars using a single parent-rendered
808
- * `<Snackbar/>`, add the `key` prop to ensure independent treatment of each message.
809
- * For instance, use `<Snackbar key={message} />`. Otherwise, messages might update
810
- * in place, and features like `autoHideDuration` could be affected.
811
- */
812
- key: () => null,
813
- /**
814
- * @ignore
815
- */
816
- onBlur: e.func,
817
- /**
818
- * Callback fired when the component requests to be closed.
819
- * Typically `onClose` is used to set state in the parent component,
820
- * which is used to control the `Snackbar` `open` prop.
821
- * The `reason` parameter can optionally be used to control the response to `onClose`,
822
- * for example ignoring `clickaway`.
823
- *
824
- * @param {React.SyntheticEvent<any> | Event} event The event source of the callback.
825
- * @param {string} reason Can be: `"timeout"` (`autoHideDuration` expired), `"clickaway"`, or `"escapeKeyDown"`.
826
- */
827
- onClose: e.func,
828
- /**
829
- * @ignore
830
- */
831
- onFocus: e.func,
832
- /**
833
- * @ignore
834
- */
835
- onMouseEnter: e.func,
836
- /**
837
- * @ignore
838
- */
839
- onMouseLeave: e.func,
840
- /**
841
- * A callback fired when the component is about to be unmounted.
842
- */
843
- onUnmount: e.func,
844
- /**
845
- * If `true`, the component is shown.
846
- */
847
- open: e.bool.isRequired,
848
- /**
849
- * The number of milliseconds to wait before dismissing after user interaction.
850
- * If `autoHideDuration` prop isn't specified, it does nothing.
851
- * If `autoHideDuration` prop is specified but `resumeHideDuration` isn't,
852
- * we default to `autoHideDuration / 2` ms.
853
- */
854
- resumeHideDuration: e.number,
855
- /**
856
- * The size of the component.
857
- * @default 'md'
858
- */
859
- size: e.oneOf(["sm", "md", "lg"]),
860
- /**
861
- * The props used for each slot inside.
862
- * @default {}
863
- */
864
- slotProps: e.shape({
865
- clickAway: e.oneOfType([e.func, e.shape({
866
- children: e.element.isRequired,
867
- disableReactTree: e.bool,
868
- mouseEvent: e.oneOf(["onClick", "onMouseDown", "onMouseUp", "onPointerDown", "onPointerUp", !1]),
869
- onClickAway: e.func.isRequired,
870
- touchEvent: e.oneOf(["onTouchEnd", "onTouchStart", !1])
871
- })]),
872
- endDecorator: e.oneOfType([e.func, e.object]),
873
- root: e.oneOfType([e.func, e.object]),
874
- startDecorator: e.oneOfType([e.func, e.object])
875
- }),
876
- /**
877
- * The components used for each slot inside.
878
- * @default {}
879
- */
880
- slots: e.shape({
881
- clickAway: e.elementType,
882
- endDecorator: e.elementType,
883
- root: e.elementType,
884
- startDecorator: e.elementType
885
- }),
886
- /**
887
- * Element placed before the children.
888
- */
889
- startDecorator: e.node,
890
- /**
891
- * The system prop that allows defining system overrides as well as additional CSS styles.
892
- */
893
- sx: e.oneOfType([e.arrayOf(e.oneOfType([e.func, e.object, e.bool])), e.func, e.object]),
894
- /**
895
- * The [global variant](https://mui.com/joy-ui/main-features/global-variants/) to use.
896
- * @default 'outlined'
897
- */
898
- variant: e.oneOf(["outlined", "plain", "soft", "solid"])
899
- });
900
- const Qe = ke(/* @__PURE__ */ k("path", {
901
- d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m1 15h-2v-2h2zm0-4h-2V7h2z"
902
- }), "Error"), ao = ({
903
- notification: r,
904
- onClose: o
905
- }) => {
906
- const s = Se(), n = ze();
907
- return r.open ? /* @__PURE__ */ k(
908
- se,
909
- {
910
- open: r.open,
911
- onClose: o,
912
- autoHideDuration: r.variant === "error" ? 5e3 : 3e3,
913
- anchorOrigin: { vertical: "top", horizontal: "center" },
914
- color: r.variant === "success" ? "success" : "danger",
915
- variant: "soft",
916
- startDecorator: r.variant === "success" ? /* @__PURE__ */ k(Ae, {}) : /* @__PURE__ */ k(Qe, {}),
917
- sx: {
918
- borderRadius: s.sm,
919
- fontFamily: n.secondary,
920
- minWidth: "300px",
921
- maxWidth: "400px",
922
- zIndex: 9999,
923
- position: "fixed"
924
- },
925
- children: /* @__PURE__ */ te(Oe, { sx: { display: "flex", flexDirection: "column", gap: "4px" }, children: [
926
- r.title && /* @__PURE__ */ k(
927
- Q,
928
- {
929
- level: "title-md",
930
- sx: {
931
- fontWeight: 600,
932
- fontSize: "16px",
933
- lineHeight: 1.2,
934
- color: "inherit"
935
- },
936
- children: r.title
937
- }
938
- ),
939
- r.message && /* @__PURE__ */ k(
940
- Q,
941
- {
942
- level: "body-sm",
943
- sx: {
944
- fontSize: "14px",
945
- lineHeight: 1.3,
946
- color: "inherit",
947
- opacity: 0.9
948
- },
949
- children: r.message
950
- }
951
- )
952
- ] })
953
- }
954
- ) : null;
955
- };
956
- export {
957
- je as A,
958
- ao as N,
959
- to as d,
960
- no as g
961
- };