@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
@@ -1,647 +0,0 @@
1
- import * as l from "react";
2
- import { useMemo as et, useRef as X } from "react";
3
- import { c as x } from "./presets.js";
4
- import { g as nt, r as rt, u as E, m as Ot, a as K, c as it, e as xt } from "./reactNode.js";
5
- import { K as z, g as st, i as at } from "./colors.js";
6
- const wt = new z("antStatusProcessing", {
7
- "0%": {
8
- transform: "scale(0.8)",
9
- opacity: 0.5
10
- },
11
- "100%": {
12
- transform: "scale(2.4)",
13
- opacity: 0
14
- }
15
- }), Et = new z("antZoomBadgeIn", {
16
- "0%": {
17
- transform: "scale(0) translate(50%, -50%)",
18
- opacity: 0
19
- },
20
- "100%": {
21
- transform: "scale(1) translate(50%, -50%)"
22
- }
23
- }), jt = new z("antZoomBadgeOut", {
24
- "0%": {
25
- transform: "scale(1) translate(50%, -50%)"
26
- },
27
- "100%": {
28
- transform: "scale(0) translate(50%, -50%)",
29
- opacity: 0
30
- }
31
- }), Pt = new z("antNoWrapperZoomBadgeIn", {
32
- "0%": {
33
- transform: "scale(0)",
34
- opacity: 0
35
- },
36
- "100%": {
37
- transform: "scale(1)"
38
- }
39
- }), It = new z("antNoWrapperZoomBadgeOut", {
40
- "0%": {
41
- transform: "scale(1)"
42
- },
43
- "100%": {
44
- transform: "scale(0)",
45
- opacity: 0
46
- }
47
- }), zt = new z("antBadgeLoadingCircle", {
48
- "0%": {
49
- transformOrigin: "50%"
50
- },
51
- "100%": {
52
- transform: "translate(50%, -50%) rotate(360deg)",
53
- transformOrigin: "50%"
54
- }
55
- }), Bt = (t) => {
56
- const {
57
- componentCls: e,
58
- iconCls: i,
59
- antCls: n,
60
- badgeShadowSize: o,
61
- textFontSize: d,
62
- textFontSizeSM: s,
63
- statusSize: y,
64
- dotSize: v,
65
- textFontWeight: C,
66
- indicatorHeight: c,
67
- indicatorHeightSM: a,
68
- marginXS: m,
69
- calc: b
70
- } = t, u = `${n}-scroll-number`, S = st(t, ($, g) => {
71
- let {
72
- darkColor: f
73
- } = g;
74
- return {
75
- [`&${e} ${e}-color-${$}`]: {
76
- background: f,
77
- [`&:not(${e}-count)`]: {
78
- color: f
79
- },
80
- "a:hover &": {
81
- background: f
82
- }
83
- }
84
- };
85
- });
86
- return {
87
- [e]: Object.assign(Object.assign(Object.assign(Object.assign({}, rt(t)), {
88
- position: "relative",
89
- display: "inline-block",
90
- width: "fit-content",
91
- lineHeight: 1,
92
- [`${e}-count`]: {
93
- display: "inline-flex",
94
- justifyContent: "center",
95
- zIndex: t.indicatorZIndex,
96
- minWidth: c,
97
- height: c,
98
- color: t.badgeTextColor,
99
- fontWeight: C,
100
- fontSize: d,
101
- lineHeight: E(c),
102
- whiteSpace: "nowrap",
103
- textAlign: "center",
104
- background: t.badgeColor,
105
- borderRadius: b(c).div(2).equal(),
106
- boxShadow: `0 0 0 ${E(o)} ${t.badgeShadowColor}`,
107
- transition: `background ${t.motionDurationMid}`,
108
- a: {
109
- color: t.badgeTextColor
110
- },
111
- "a:hover": {
112
- color: t.badgeTextColor
113
- },
114
- "a:hover &": {
115
- background: t.badgeColorHover
116
- }
117
- },
118
- [`${e}-count-sm`]: {
119
- minWidth: a,
120
- height: a,
121
- fontSize: s,
122
- lineHeight: E(a),
123
- borderRadius: b(a).div(2).equal()
124
- },
125
- [`${e}-multiple-words`]: {
126
- padding: `0 ${E(t.paddingXS)}`,
127
- bdi: {
128
- unicodeBidi: "plaintext"
129
- }
130
- },
131
- [`${e}-dot`]: {
132
- zIndex: t.indicatorZIndex,
133
- width: v,
134
- minWidth: v,
135
- height: v,
136
- background: t.badgeColor,
137
- borderRadius: "100%",
138
- boxShadow: `0 0 0 ${E(o)} ${t.badgeShadowColor}`
139
- },
140
- [`${e}-count, ${e}-dot, ${u}-custom-component`]: {
141
- position: "absolute",
142
- top: 0,
143
- insetInlineEnd: 0,
144
- transform: "translate(50%, -50%)",
145
- transformOrigin: "100% 0%",
146
- [`&${i}-spin`]: {
147
- animationName: zt,
148
- animationDuration: "1s",
149
- animationIterationCount: "infinite",
150
- animationTimingFunction: "linear"
151
- }
152
- },
153
- [`&${e}-status`]: {
154
- lineHeight: "inherit",
155
- verticalAlign: "baseline",
156
- [`${e}-status-dot`]: {
157
- position: "relative",
158
- top: -1,
159
- // Magic number, but seems better experience
160
- display: "inline-block",
161
- width: y,
162
- height: y,
163
- verticalAlign: "middle",
164
- borderRadius: "50%"
165
- },
166
- [`${e}-status-success`]: {
167
- backgroundColor: t.colorSuccess
168
- },
169
- [`${e}-status-processing`]: {
170
- overflow: "visible",
171
- color: t.colorInfo,
172
- backgroundColor: t.colorInfo,
173
- borderColor: "currentcolor",
174
- "&::after": {
175
- position: "absolute",
176
- top: 0,
177
- insetInlineStart: 0,
178
- width: "100%",
179
- height: "100%",
180
- borderWidth: o,
181
- borderStyle: "solid",
182
- borderColor: "inherit",
183
- borderRadius: "50%",
184
- animationName: wt,
185
- animationDuration: t.badgeProcessingDuration,
186
- animationIterationCount: "infinite",
187
- animationTimingFunction: "ease-in-out",
188
- content: '""'
189
- }
190
- },
191
- [`${e}-status-default`]: {
192
- backgroundColor: t.colorTextPlaceholder
193
- },
194
- [`${e}-status-error`]: {
195
- backgroundColor: t.colorError
196
- },
197
- [`${e}-status-warning`]: {
198
- backgroundColor: t.colorWarning
199
- },
200
- [`${e}-status-text`]: {
201
- marginInlineStart: m,
202
- color: t.colorText,
203
- fontSize: t.fontSize
204
- }
205
- }
206
- }), S), {
207
- [`${e}-zoom-appear, ${e}-zoom-enter`]: {
208
- animationName: Et,
209
- animationDuration: t.motionDurationSlow,
210
- animationTimingFunction: t.motionEaseOutBack,
211
- animationFillMode: "both"
212
- },
213
- [`${e}-zoom-leave`]: {
214
- animationName: jt,
215
- animationDuration: t.motionDurationSlow,
216
- animationTimingFunction: t.motionEaseOutBack,
217
- animationFillMode: "both"
218
- },
219
- [`&${e}-not-a-wrapper`]: {
220
- [`${e}-zoom-appear, ${e}-zoom-enter`]: {
221
- animationName: Pt,
222
- animationDuration: t.motionDurationSlow,
223
- animationTimingFunction: t.motionEaseOutBack
224
- },
225
- [`${e}-zoom-leave`]: {
226
- animationName: It,
227
- animationDuration: t.motionDurationSlow,
228
- animationTimingFunction: t.motionEaseOutBack
229
- },
230
- [`&:not(${e}-status)`]: {
231
- verticalAlign: "middle"
232
- },
233
- [`${u}-custom-component, ${e}-count`]: {
234
- transform: "none"
235
- },
236
- [`${u}-custom-component, ${u}`]: {
237
- position: "relative",
238
- top: "auto",
239
- display: "block",
240
- transformOrigin: "50% 50%"
241
- }
242
- },
243
- [u]: {
244
- overflow: "hidden",
245
- transition: `all ${t.motionDurationMid} ${t.motionEaseOutBack}`,
246
- [`${u}-only`]: {
247
- position: "relative",
248
- display: "inline-block",
249
- height: c,
250
- transition: `all ${t.motionDurationSlow} ${t.motionEaseOutBack}`,
251
- WebkitTransformStyle: "preserve-3d",
252
- WebkitBackfaceVisibility: "hidden",
253
- [`> p${u}-only-unit`]: {
254
- height: c,
255
- margin: 0,
256
- WebkitTransformStyle: "preserve-3d",
257
- WebkitBackfaceVisibility: "hidden"
258
- }
259
- },
260
- [`${u}-symbol`]: {
261
- verticalAlign: "top"
262
- }
263
- },
264
- // ====================== RTL =======================
265
- "&-rtl": {
266
- direction: "rtl",
267
- [`${e}-count, ${e}-dot, ${u}-custom-component`]: {
268
- transform: "translate(-50%, -50%)"
269
- }
270
- }
271
- })
272
- };
273
- }, lt = (t) => {
274
- const {
275
- fontHeight: e,
276
- lineWidth: i,
277
- marginXS: n,
278
- colorBorderBg: o
279
- } = t, d = e, s = i, y = t.colorBgContainer, v = t.colorError, C = t.colorErrorHover;
280
- return Ot(t, {
281
- badgeFontHeight: d,
282
- badgeShadowSize: s,
283
- badgeTextColor: y,
284
- badgeColor: v,
285
- badgeColorHover: C,
286
- badgeShadowColor: o,
287
- badgeProcessingDuration: "1.2s",
288
- badgeRibbonOffset: n,
289
- // Follow token just by Design. Not related with token
290
- badgeRibbonCornerTransform: "scaleY(0.75)",
291
- badgeRibbonCornerFilter: "brightness(75%)"
292
- });
293
- }, ct = (t) => {
294
- const {
295
- fontSize: e,
296
- lineHeight: i,
297
- fontSizeSM: n,
298
- lineWidth: o
299
- } = t;
300
- return {
301
- indicatorZIndex: "auto",
302
- indicatorHeight: Math.round(e * i) - 2 * o,
303
- indicatorHeightSM: e,
304
- dotSize: n / 2,
305
- textFontSize: n,
306
- textFontSizeSM: n,
307
- textFontWeight: "normal",
308
- statusSize: n / 2
309
- };
310
- }, Tt = nt("Badge", (t) => {
311
- const e = lt(t);
312
- return Bt(e);
313
- }, ct), Rt = (t) => {
314
- const {
315
- antCls: e,
316
- badgeFontHeight: i,
317
- marginXS: n,
318
- badgeRibbonOffset: o,
319
- calc: d
320
- } = t, s = `${e}-ribbon`, y = `${e}-ribbon-wrapper`, v = st(t, (C, c) => {
321
- let {
322
- darkColor: a
323
- } = c;
324
- return {
325
- [`&${s}-color-${C}`]: {
326
- background: a,
327
- color: a
328
- }
329
- };
330
- });
331
- return {
332
- [y]: {
333
- position: "relative"
334
- },
335
- [s]: Object.assign(Object.assign(Object.assign(Object.assign({}, rt(t)), {
336
- position: "absolute",
337
- top: n,
338
- padding: `0 ${E(t.paddingXS)}`,
339
- color: t.colorPrimary,
340
- lineHeight: E(i),
341
- whiteSpace: "nowrap",
342
- backgroundColor: t.colorPrimary,
343
- borderRadius: t.borderRadiusSM,
344
- [`${s}-text`]: {
345
- color: t.colorTextLightSolid
346
- },
347
- [`${s}-corner`]: {
348
- position: "absolute",
349
- top: "100%",
350
- width: o,
351
- height: o,
352
- color: "currentcolor",
353
- border: `${E(d(o).div(2).equal())} solid`,
354
- transform: t.badgeRibbonCornerTransform,
355
- transformOrigin: "top",
356
- filter: t.badgeRibbonCornerFilter
357
- }
358
- }), v), {
359
- [`&${s}-placement-end`]: {
360
- insetInlineEnd: d(o).mul(-1).equal(),
361
- borderEndEndRadius: 0,
362
- [`${s}-corner`]: {
363
- insetInlineEnd: 0,
364
- borderInlineEndColor: "transparent",
365
- borderBlockEndColor: "transparent"
366
- }
367
- },
368
- [`&${s}-placement-start`]: {
369
- insetInlineStart: d(o).mul(-1).equal(),
370
- borderEndStartRadius: 0,
371
- [`${s}-corner`]: {
372
- insetInlineStart: 0,
373
- borderBlockEndColor: "transparent",
374
- borderInlineStartColor: "transparent"
375
- }
376
- },
377
- // ====================== RTL =======================
378
- "&-rtl": {
379
- direction: "rtl"
380
- }
381
- })
382
- };
383
- }, Dt = nt(["Badge", "Ribbon"], (t) => {
384
- const e = lt(t);
385
- return Rt(e);
386
- }, ct), dt = (t) => {
387
- const {
388
- className: e,
389
- prefixCls: i,
390
- style: n,
391
- color: o,
392
- children: d,
393
- text: s,
394
- placement: y = "end",
395
- rootClassName: v
396
- } = t, {
397
- getPrefixCls: C,
398
- direction: c
399
- } = l.useContext(K), a = C("ribbon", i), m = `${a}-wrapper`, [b, u, S] = Dt(a, m), $ = at(o, !1), g = x(a, `${a}-placement-${y}`, {
400
- [`${a}-rtl`]: c === "rtl",
401
- [`${a}-color-${o}`]: $
402
- }, e), f = {}, w = {};
403
- return o && !$ && (f.background = o, w.color = o), b(/* @__PURE__ */ l.createElement("div", {
404
- className: x(m, v, u, S)
405
- }, d, /* @__PURE__ */ l.createElement("div", {
406
- className: x(g, u),
407
- style: Object.assign(Object.assign({}, f), n)
408
- }, /* @__PURE__ */ l.createElement("span", {
409
- className: `${a}-text`
410
- }, s), /* @__PURE__ */ l.createElement("div", {
411
- className: `${a}-corner`,
412
- style: w
413
- }))));
414
- };
415
- process.env.NODE_ENV !== "production" && (dt.displayName = "Ribbon");
416
- const ot = (t) => {
417
- const {
418
- prefixCls: e,
419
- value: i,
420
- current: n,
421
- offset: o = 0
422
- } = t;
423
- let d;
424
- return o && (d = {
425
- position: "absolute",
426
- top: `${o}00%`,
427
- left: 0
428
- }), /* @__PURE__ */ l.createElement("span", {
429
- style: d,
430
- className: x(`${e}-only-unit`, {
431
- current: n
432
- })
433
- }, i);
434
- };
435
- function Wt(t, e, i) {
436
- let n = t, o = 0;
437
- for (; (n + 10) % 10 !== e; )
438
- n += i, o += i;
439
- return o;
440
- }
441
- const Ft = (t) => {
442
- const {
443
- prefixCls: e,
444
- count: i,
445
- value: n
446
- } = t, o = Number(n), d = Math.abs(i), [s, y] = l.useState(o), [v, C] = l.useState(d), c = () => {
447
- y(o), C(d);
448
- };
449
- l.useEffect(() => {
450
- const b = setTimeout(c, 1e3);
451
- return () => clearTimeout(b);
452
- }, [o]);
453
- let a, m;
454
- if (s === o || Number.isNaN(o) || Number.isNaN(s))
455
- a = [/* @__PURE__ */ l.createElement(ot, Object.assign({}, t, {
456
- key: o,
457
- current: !0
458
- }))], m = {
459
- transition: "none"
460
- };
461
- else {
462
- a = [];
463
- const b = o + 10, u = [];
464
- for (let g = o; g <= b; g += 1)
465
- u.push(g);
466
- const S = u.findIndex((g) => g % 10 === s);
467
- a = u.map((g, f) => {
468
- const w = g % 10;
469
- return /* @__PURE__ */ l.createElement(ot, Object.assign({}, t, {
470
- key: g,
471
- value: w,
472
- offset: f - S,
473
- current: f === S
474
- }));
475
- });
476
- const $ = v < d ? 1 : -1;
477
- m = {
478
- transform: `translateY(${-Wt(s, o, $)}00%)`
479
- };
480
- }
481
- return /* @__PURE__ */ l.createElement("span", {
482
- className: `${e}-only`,
483
- style: m,
484
- onTransitionEnd: c
485
- }, a);
486
- };
487
- var Ht = function(t, e) {
488
- var i = {};
489
- for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && e.indexOf(n) < 0 && (i[n] = t[n]);
490
- if (t != null && typeof Object.getOwnPropertySymbols == "function") for (var o = 0, n = Object.getOwnPropertySymbols(t); o < n.length; o++)
491
- e.indexOf(n[o]) < 0 && Object.prototype.propertyIsEnumerable.call(t, n[o]) && (i[n[o]] = t[n[o]]);
492
- return i;
493
- };
494
- const _t = /* @__PURE__ */ l.forwardRef((t, e) => {
495
- const {
496
- prefixCls: i,
497
- count: n,
498
- className: o,
499
- motionClassName: d,
500
- style: s,
501
- title: y,
502
- show: v,
503
- component: C = "sup",
504
- children: c
505
- } = t, a = Ht(t, ["prefixCls", "count", "className", "motionClassName", "style", "title", "show", "component", "children"]), {
506
- getPrefixCls: m
507
- } = l.useContext(K), b = m("scroll-number", i), u = Object.assign(Object.assign({}, a), {
508
- "data-show": v,
509
- style: s,
510
- className: x(b, o, d),
511
- title: y
512
- });
513
- let S = n;
514
- if (n && Number(n) % 1 === 0) {
515
- const $ = String(n).split("");
516
- S = /* @__PURE__ */ l.createElement("bdi", null, $.map((g, f) => /* @__PURE__ */ l.createElement(Ft, {
517
- prefixCls: b,
518
- count: Number(n),
519
- value: g,
520
- // eslint-disable-next-line react/no-array-index-key
521
- key: $.length - f
522
- })));
523
- }
524
- return s != null && s.borderColor && (u.style = Object.assign(Object.assign({}, s), {
525
- boxShadow: `0 0 0 1px ${s.borderColor} inset`
526
- })), c ? it(c, ($) => ({
527
- className: x(`${b}-custom-component`, $ == null ? void 0 : $.className, d)
528
- })) : /* @__PURE__ */ l.createElement(C, Object.assign({}, u, {
529
- ref: e
530
- }), S);
531
- });
532
- var Mt = function(t, e) {
533
- var i = {};
534
- for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && e.indexOf(n) < 0 && (i[n] = t[n]);
535
- if (t != null && typeof Object.getOwnPropertySymbols == "function") for (var o = 0, n = Object.getOwnPropertySymbols(t); o < n.length; o++)
536
- e.indexOf(n[o]) < 0 && Object.prototype.propertyIsEnumerable.call(t, n[o]) && (i[n[o]] = t[n[o]]);
537
- return i;
538
- };
539
- const Zt = /* @__PURE__ */ l.forwardRef((t, e) => {
540
- var i, n, o, d, s;
541
- const {
542
- prefixCls: y,
543
- scrollNumberPrefixCls: v,
544
- children: C,
545
- status: c,
546
- text: a,
547
- color: m,
548
- count: b = null,
549
- overflowCount: u = 99,
550
- dot: S = !1,
551
- size: $ = "default",
552
- title: g,
553
- offset: f,
554
- style: w,
555
- className: mt,
556
- rootClassName: bt,
557
- classNames: O,
558
- styles: h,
559
- showZero: F = !1
560
- } = t, U = Mt(t, ["prefixCls", "scrollNumberPrefixCls", "children", "status", "text", "color", "count", "overflowCount", "dot", "size", "title", "offset", "style", "className", "rootClassName", "classNames", "styles", "showZero"]), {
561
- getPrefixCls: Y,
562
- direction: H,
563
- badge: r
564
- } = l.useContext(K), p = Y("badge", y), [G, gt, ft] = Tt(p), _ = b > u ? `${u}+` : b, T = _ === "0" || _ === 0, pt = b === null || T && !F, M = (c != null || m != null) && pt, B = S && !T, j = B ? "" : _, P = et(() => (j == null || j === "" || T && !F) && !B, [j, T, F, B]), J = X(b);
565
- P || (J.current = b);
566
- const I = J.current, Q = X(j);
567
- P || (Q.current = j);
568
- const Z = Q.current, k = X(B);
569
- P || (k.current = B);
570
- const R = et(() => {
571
- if (!f)
572
- return Object.assign(Object.assign({}, r == null ? void 0 : r.style), w);
573
- const N = {
574
- marginTop: f[1]
575
- };
576
- return H === "rtl" ? N.left = parseInt(f[0], 10) : N.right = -parseInt(f[0], 10), Object.assign(Object.assign(Object.assign({}, N), r == null ? void 0 : r.style), w);
577
- }, [H, f, w, r == null ? void 0 : r.style]), vt = g ?? (typeof I == "string" || typeof I == "number" ? I : void 0), Ct = P || !a ? null : /* @__PURE__ */ l.createElement("span", {
578
- className: `${p}-status-text`
579
- }, a), $t = !I || typeof I != "object" ? void 0 : it(I, (N) => ({
580
- style: Object.assign(Object.assign({}, R), N.style)
581
- })), D = at(m, !1), yt = x(O == null ? void 0 : O.indicator, (i = r == null ? void 0 : r.classNames) === null || i === void 0 ? void 0 : i.indicator, {
582
- [`${p}-status-dot`]: M,
583
- [`${p}-status-${c}`]: !!c,
584
- [`${p}-color-${m}`]: D
585
- }), V = {};
586
- m && !D && (V.color = m, V.background = m);
587
- const tt = x(p, {
588
- [`${p}-status`]: M,
589
- [`${p}-not-a-wrapper`]: !C,
590
- [`${p}-rtl`]: H === "rtl"
591
- }, mt, bt, r == null ? void 0 : r.className, (n = r == null ? void 0 : r.classNames) === null || n === void 0 ? void 0 : n.root, O == null ? void 0 : O.root, gt, ft);
592
- if (!C && M) {
593
- const N = R.color;
594
- return G(/* @__PURE__ */ l.createElement("span", Object.assign({}, U, {
595
- className: tt,
596
- style: Object.assign(Object.assign(Object.assign({}, h == null ? void 0 : h.root), (o = r == null ? void 0 : r.styles) === null || o === void 0 ? void 0 : o.root), R)
597
- }), /* @__PURE__ */ l.createElement("span", {
598
- className: yt,
599
- style: Object.assign(Object.assign(Object.assign({}, h == null ? void 0 : h.indicator), (d = r == null ? void 0 : r.styles) === null || d === void 0 ? void 0 : d.indicator), V)
600
- }), a && /* @__PURE__ */ l.createElement("span", {
601
- style: {
602
- color: N
603
- },
604
- className: `${p}-status-text`
605
- }, a)));
606
- }
607
- return G(/* @__PURE__ */ l.createElement("span", Object.assign({
608
- ref: e
609
- }, U, {
610
- className: tt,
611
- style: Object.assign(Object.assign({}, (s = r == null ? void 0 : r.styles) === null || s === void 0 ? void 0 : s.root), h == null ? void 0 : h.root)
612
- }), C, /* @__PURE__ */ l.createElement(xt, {
613
- visible: !P,
614
- motionName: `${p}-zoom`,
615
- motionAppear: !1,
616
- motionDeadline: 1e3
617
- }, (N) => {
618
- let {
619
- className: ht
620
- } = N;
621
- var A, q;
622
- const St = Y("scroll-number", v), L = k.current, Nt = x(O == null ? void 0 : O.indicator, (A = r == null ? void 0 : r.classNames) === null || A === void 0 ? void 0 : A.indicator, {
623
- [`${p}-dot`]: L,
624
- [`${p}-count`]: !L,
625
- [`${p}-count-sm`]: $ === "small",
626
- [`${p}-multiple-words`]: !L && Z && Z.toString().length > 1,
627
- [`${p}-status-${c}`]: !!c,
628
- [`${p}-color-${m}`]: D
629
- });
630
- let W = Object.assign(Object.assign(Object.assign({}, h == null ? void 0 : h.indicator), (q = r == null ? void 0 : r.styles) === null || q === void 0 ? void 0 : q.indicator), R);
631
- return m && !D && (W = W || {}, W.background = m), /* @__PURE__ */ l.createElement(_t, {
632
- prefixCls: St,
633
- show: !P,
634
- motionClassName: ht,
635
- className: Nt,
636
- count: Z,
637
- title: vt,
638
- style: W,
639
- key: "scrollNumber"
640
- }, $t);
641
- }), Ct));
642
- }), ut = Zt;
643
- ut.Ribbon = dt;
644
- process.env.NODE_ENV !== "production" && (ut.displayName = "Badge");
645
- export {
646
- ut as B
647
- };