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