@notificationapi/react 0.0.4 → 0.0.6

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.
@@ -0,0 +1,832 @@
1
+ import * as z from "react";
2
+ import a, { forwardRef as So, useContext as D, useMemo as _o, useState as uo, Children as Fo, useEffect as go, createRef as Vo } from "react";
3
+ import { a as ho, h as qo, c as $, b as Xo, j as Uo, f as Jo, m as L, k as M, g as Ko, u as I, l as Qo, n as Yo, D as Zo, o as ko } from "./colors.js";
4
+ import { e as oe, f as ee, h as te, j as re, o as ne, W as le } from "./index3.js";
5
+ var ie = function(o, e) {
6
+ var t = {};
7
+ for (var r in o)
8
+ Object.prototype.hasOwnProperty.call(o, r) && e.indexOf(r) < 0 && (t[r] = o[r]);
9
+ if (o != null && typeof Object.getOwnPropertySymbols == "function")
10
+ for (var n = 0, r = Object.getOwnPropertySymbols(o); n < r.length; n++)
11
+ e.indexOf(r[n]) < 0 && Object.prototype.propertyIsEnumerable.call(o, r[n]) && (t[r[n]] = o[r[n]]);
12
+ return t;
13
+ };
14
+ const Co = /* @__PURE__ */ z.createContext(void 0), ae = (o) => {
15
+ const {
16
+ getPrefixCls: e,
17
+ direction: t
18
+ } = z.useContext(ho), {
19
+ prefixCls: r,
20
+ size: n,
21
+ className: l
22
+ } = o, i = ie(o, ["prefixCls", "size", "className"]), c = e("btn-group", r), [, , m] = qo();
23
+ let d = "";
24
+ switch (n) {
25
+ case "large":
26
+ d = "lg";
27
+ break;
28
+ case "small":
29
+ d = "sm";
30
+ break;
31
+ }
32
+ const b = $(c, {
33
+ [`${c}-${d}`]: d,
34
+ [`${c}-rtl`]: t === "rtl"
35
+ }, l, m);
36
+ return /* @__PURE__ */ z.createElement(Co.Provider, {
37
+ value: n
38
+ }, /* @__PURE__ */ z.createElement("div", Object.assign({}, i, {
39
+ className: b
40
+ })));
41
+ }, mo = /^[\u4e00-\u9fa5]{2}$/, q = mo.test.bind(mo);
42
+ function Re(o) {
43
+ return o === "danger" ? {
44
+ danger: !0
45
+ } : {
46
+ type: o
47
+ };
48
+ }
49
+ function bo(o) {
50
+ return typeof o == "string";
51
+ }
52
+ function _(o) {
53
+ return o === "text" || o === "link";
54
+ }
55
+ function ce(o, e) {
56
+ if (o == null)
57
+ return;
58
+ const t = e ? " " : "";
59
+ return typeof o != "string" && typeof o != "number" && bo(o.type) && q(o.props.children) ? Xo(o, {
60
+ children: o.props.children.split("").join(t)
61
+ }) : bo(o) ? q(o) ? /* @__PURE__ */ a.createElement("span", null, o.split("").join(t)) : /* @__PURE__ */ a.createElement("span", null, o) : Uo(o) ? /* @__PURE__ */ a.createElement("span", null, o) : o;
62
+ }
63
+ function se(o, e) {
64
+ let t = !1;
65
+ const r = [];
66
+ return a.Children.forEach(o, (n) => {
67
+ const l = typeof n, i = l === "string" || l === "number";
68
+ if (t && i) {
69
+ const c = r.length - 1, m = r[c];
70
+ r[c] = `${m}${n}`;
71
+ } else
72
+ r.push(n);
73
+ t = i;
74
+ }), a.Children.map(r, (n) => ce(n, e));
75
+ }
76
+ const yo = /* @__PURE__ */ So((o, e) => {
77
+ const {
78
+ className: t,
79
+ style: r,
80
+ children: n,
81
+ prefixCls: l
82
+ } = o, i = $(`${l}-icon`, t);
83
+ return /* @__PURE__ */ a.createElement("span", {
84
+ ref: e,
85
+ className: i,
86
+ style: r
87
+ }, n);
88
+ }), po = /* @__PURE__ */ So((o, e) => {
89
+ const {
90
+ prefixCls: t,
91
+ className: r,
92
+ style: n,
93
+ iconClassName: l,
94
+ iconPosition: i = "start"
95
+ } = o, c = $(r, {
96
+ [`${t}-loading-icon-end`]: i === "end",
97
+ [`${t}-loading-icon`]: i === "start"
98
+ });
99
+ return /* @__PURE__ */ a.createElement(yo, {
100
+ prefixCls: t,
101
+ className: c,
102
+ style: n,
103
+ ref: e
104
+ }, /* @__PURE__ */ a.createElement(oe, {
105
+ className: l
106
+ }));
107
+ }), F = () => ({
108
+ width: 0,
109
+ opacity: 0,
110
+ transform: "scale(0)"
111
+ }), V = (o) => ({
112
+ width: o.scrollWidth,
113
+ opacity: 1,
114
+ transform: "scale(1)"
115
+ }), de = (o) => {
116
+ const {
117
+ prefixCls: e,
118
+ loading: t,
119
+ existIcon: r,
120
+ className: n,
121
+ style: l,
122
+ iconPosition: i
123
+ } = o, c = !!t;
124
+ return r ? /* @__PURE__ */ a.createElement(po, {
125
+ prefixCls: e,
126
+ className: n,
127
+ style: l,
128
+ iconPosition: i
129
+ }) : /* @__PURE__ */ a.createElement(Jo, {
130
+ visible: c,
131
+ // We do not really use this motionName
132
+ motionName: `${e}-loading-icon-motion`,
133
+ motionLeave: c,
134
+ removeOnLeave: !0,
135
+ onAppearStart: F,
136
+ onAppearActive: V,
137
+ onEnterStart: F,
138
+ onEnterActive: V,
139
+ onLeaveStart: V,
140
+ onLeaveActive: F
141
+ }, (m, d) => {
142
+ let {
143
+ className: b,
144
+ style: S
145
+ } = m;
146
+ return /* @__PURE__ */ a.createElement(po, {
147
+ prefixCls: e,
148
+ className: n,
149
+ style: Object.assign(Object.assign({}, l), S),
150
+ ref: d,
151
+ iconClassName: b,
152
+ iconPosition: i
153
+ });
154
+ });
155
+ }, fo = (o, e) => ({
156
+ // Border
157
+ [`> span, > ${o}`]: {
158
+ "&:not(:last-child)": {
159
+ [`&, & > ${o}`]: {
160
+ "&:not(:disabled)": {
161
+ borderInlineEndColor: e
162
+ }
163
+ }
164
+ },
165
+ "&:not(:first-child)": {
166
+ [`&, & > ${o}`]: {
167
+ "&:not(:disabled)": {
168
+ borderInlineStartColor: e
169
+ }
170
+ }
171
+ }
172
+ }
173
+ }), ue = (o) => {
174
+ const {
175
+ componentCls: e,
176
+ fontSize: t,
177
+ lineWidth: r,
178
+ groupBorderColor: n,
179
+ colorErrorHover: l
180
+ } = o;
181
+ return {
182
+ [`${e}-group`]: [
183
+ {
184
+ position: "relative",
185
+ display: "inline-flex",
186
+ // Border
187
+ [`> span, > ${e}`]: {
188
+ "&:not(:last-child)": {
189
+ [`&, & > ${e}`]: {
190
+ borderStartEndRadius: 0,
191
+ borderEndEndRadius: 0
192
+ }
193
+ },
194
+ "&:not(:first-child)": {
195
+ marginInlineStart: o.calc(r).mul(-1).equal(),
196
+ [`&, & > ${e}`]: {
197
+ borderStartStartRadius: 0,
198
+ borderEndStartRadius: 0
199
+ }
200
+ }
201
+ },
202
+ [e]: {
203
+ position: "relative",
204
+ zIndex: 1,
205
+ "&:hover,\n &:focus,\n &:active": {
206
+ zIndex: 2
207
+ },
208
+ "&[disabled]": {
209
+ zIndex: 0
210
+ }
211
+ },
212
+ [`${e}-icon-only`]: {
213
+ fontSize: t
214
+ }
215
+ },
216
+ // Border Color
217
+ fo(`${e}-primary`, n),
218
+ fo(`${e}-danger`, l)
219
+ ]
220
+ };
221
+ }, vo = (o) => {
222
+ const {
223
+ paddingInline: e,
224
+ onlyIconSize: t,
225
+ paddingBlock: r
226
+ } = o;
227
+ return L(o, {
228
+ buttonPaddingHorizontal: e,
229
+ buttonPaddingVertical: r,
230
+ buttonIconOnlyFontSize: t
231
+ });
232
+ }, $o = (o) => {
233
+ var e, t, r, n, l, i;
234
+ const c = (e = o.contentFontSize) !== null && e !== void 0 ? e : o.fontSize, m = (t = o.contentFontSizeSM) !== null && t !== void 0 ? t : o.fontSize, d = (r = o.contentFontSizeLG) !== null && r !== void 0 ? r : o.fontSizeLG, b = (n = o.contentLineHeight) !== null && n !== void 0 ? n : M(c), S = (l = o.contentLineHeightSM) !== null && l !== void 0 ? l : M(m), y = (i = o.contentLineHeightLG) !== null && i !== void 0 ? i : M(d);
235
+ return {
236
+ fontWeight: 400,
237
+ defaultShadow: `0 ${o.controlOutlineWidth}px 0 ${o.controlTmpOutline}`,
238
+ primaryShadow: `0 ${o.controlOutlineWidth}px 0 ${o.controlOutline}`,
239
+ dangerShadow: `0 ${o.controlOutlineWidth}px 0 ${o.colorErrorOutline}`,
240
+ primaryColor: o.colorTextLightSolid,
241
+ dangerColor: o.colorTextLightSolid,
242
+ borderColorDisabled: o.colorBorder,
243
+ defaultGhostColor: o.colorBgContainer,
244
+ ghostBg: "transparent",
245
+ defaultGhostBorderColor: o.colorBgContainer,
246
+ paddingInline: o.paddingContentHorizontal - o.lineWidth,
247
+ paddingInlineLG: o.paddingContentHorizontal - o.lineWidth,
248
+ paddingInlineSM: 8 - o.lineWidth,
249
+ onlyIconSize: o.fontSizeLG,
250
+ onlyIconSizeSM: o.fontSizeLG - 2,
251
+ onlyIconSizeLG: o.fontSizeLG + 2,
252
+ groupBorderColor: o.colorPrimaryHover,
253
+ linkHoverBg: "transparent",
254
+ textHoverBg: o.colorBgTextHover,
255
+ defaultColor: o.colorText,
256
+ defaultBg: o.colorBgContainer,
257
+ defaultBorderColor: o.colorBorder,
258
+ defaultBorderColorDisabled: o.colorBorder,
259
+ defaultHoverBg: o.colorBgContainer,
260
+ defaultHoverColor: o.colorPrimaryHover,
261
+ defaultHoverBorderColor: o.colorPrimaryHover,
262
+ defaultActiveBg: o.colorBgContainer,
263
+ defaultActiveColor: o.colorPrimaryActive,
264
+ defaultActiveBorderColor: o.colorPrimaryActive,
265
+ contentFontSize: c,
266
+ contentFontSizeSM: m,
267
+ contentFontSizeLG: d,
268
+ contentLineHeight: b,
269
+ contentLineHeightSM: S,
270
+ contentLineHeightLG: y,
271
+ paddingBlock: Math.max((o.controlHeight - c * b) / 2 - o.lineWidth, 0),
272
+ paddingBlockSM: Math.max((o.controlHeightSM - m * S) / 2 - o.lineWidth, 0),
273
+ paddingBlockLG: Math.max((o.controlHeightLG - d * y) / 2 - o.lineWidth, 0)
274
+ };
275
+ }, ge = (o) => {
276
+ const {
277
+ componentCls: e,
278
+ iconCls: t,
279
+ fontWeight: r
280
+ } = o;
281
+ return {
282
+ [e]: {
283
+ outline: "none",
284
+ position: "relative",
285
+ display: "inline-block",
286
+ fontWeight: r,
287
+ whiteSpace: "nowrap",
288
+ textAlign: "center",
289
+ backgroundImage: "none",
290
+ background: "transparent",
291
+ border: `${I(o.lineWidth)} ${o.lineType} transparent`,
292
+ cursor: "pointer",
293
+ transition: `all ${o.motionDurationMid} ${o.motionEaseInOut}`,
294
+ userSelect: "none",
295
+ touchAction: "manipulation",
296
+ color: o.colorText,
297
+ "&:disabled > *": {
298
+ pointerEvents: "none"
299
+ },
300
+ "> span": {
301
+ display: "inline-block"
302
+ },
303
+ [`${e}-icon`]: {
304
+ lineHeight: 0,
305
+ // iconPosition in end
306
+ "&-end": {
307
+ marginInlineStart: o.marginXS
308
+ }
309
+ },
310
+ // Leave a space between icon and text.
311
+ [`> ${t} + span, > span + ${t}`]: {
312
+ marginInlineStart: o.marginXS
313
+ },
314
+ [`&:not(${e}-icon-only) > ${e}-icon`]: {
315
+ [`&${e}-loading-icon, &:not(:last-child)`]: {
316
+ marginInlineEnd: o.marginXS
317
+ },
318
+ [`&${e}-loading-icon-end`]: {
319
+ marginInlineStart: o.marginXS
320
+ }
321
+ },
322
+ "> a": {
323
+ color: "currentColor"
324
+ },
325
+ "&:not(:disabled)": Object.assign({}, Qo(o)),
326
+ [`&${e}-two-chinese-chars::first-letter`]: {
327
+ letterSpacing: "0.34em"
328
+ },
329
+ [`&${e}-two-chinese-chars > *:not(${t})`]: {
330
+ marginInlineEnd: "-0.34em",
331
+ letterSpacing: "0.34em"
332
+ },
333
+ // make `btn-icon-only` not too narrow
334
+ [`&-icon-only${e}-compact-item`]: {
335
+ flex: "none"
336
+ }
337
+ }
338
+ };
339
+ }, f = (o, e, t) => ({
340
+ [`&:not(:disabled):not(${o}-disabled)`]: {
341
+ "&:hover": e,
342
+ "&:active": t
343
+ }
344
+ }), me = (o) => ({
345
+ minWidth: o.controlHeight,
346
+ paddingInlineStart: 0,
347
+ paddingInlineEnd: 0,
348
+ borderRadius: "50%"
349
+ }), be = (o) => ({
350
+ borderRadius: o.controlHeight,
351
+ paddingInlineStart: o.calc(o.controlHeight).div(2).equal(),
352
+ paddingInlineEnd: o.calc(o.controlHeight).div(2).equal()
353
+ }), pe = (o) => ({
354
+ cursor: "not-allowed",
355
+ borderColor: o.borderColorDisabled,
356
+ color: o.colorTextDisabled,
357
+ background: o.colorBgContainerDisabled,
358
+ boxShadow: "none"
359
+ }), H = (o, e, t, r, n, l, i, c) => ({
360
+ [`&${o}-background-ghost`]: Object.assign(Object.assign({
361
+ color: t || void 0,
362
+ background: e,
363
+ borderColor: r || void 0,
364
+ boxShadow: "none"
365
+ }, f(o, Object.assign({
366
+ background: e
367
+ }, i), Object.assign({
368
+ background: e
369
+ }, c))), {
370
+ "&:disabled": {
371
+ cursor: "not-allowed",
372
+ color: n || void 0,
373
+ borderColor: l || void 0
374
+ }
375
+ })
376
+ }), X = (o) => ({
377
+ [`&:disabled, &${o.componentCls}-disabled`]: Object.assign({}, pe(o))
378
+ }), Bo = (o) => Object.assign({}, X(o)), j = (o) => ({
379
+ [`&:disabled, &${o.componentCls}-disabled`]: {
380
+ cursor: "not-allowed",
381
+ color: o.colorTextDisabled
382
+ }
383
+ }), Oo = (o) => Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, Bo(o)), {
384
+ background: o.defaultBg,
385
+ borderColor: o.defaultBorderColor,
386
+ color: o.defaultColor,
387
+ boxShadow: o.defaultShadow
388
+ }), f(o.componentCls, {
389
+ color: o.defaultHoverColor,
390
+ borderColor: o.defaultHoverBorderColor,
391
+ background: o.defaultHoverBg
392
+ }, {
393
+ color: o.defaultActiveColor,
394
+ borderColor: o.defaultActiveBorderColor,
395
+ background: o.defaultActiveBg
396
+ })), H(o.componentCls, o.ghostBg, o.defaultGhostColor, o.defaultGhostBorderColor, o.colorTextDisabled, o.colorBorder)), {
397
+ [`&${o.componentCls}-dangerous`]: Object.assign(Object.assign(Object.assign({
398
+ color: o.colorError,
399
+ borderColor: o.colorError
400
+ }, f(o.componentCls, {
401
+ color: o.colorErrorHover,
402
+ borderColor: o.colorErrorBorderHover
403
+ }, {
404
+ color: o.colorErrorActive,
405
+ borderColor: o.colorErrorActive
406
+ })), H(o.componentCls, o.ghostBg, o.colorError, o.colorError, o.colorTextDisabled, o.colorBorder)), X(o))
407
+ }), fe = (o) => Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, Bo(o)), {
408
+ color: o.primaryColor,
409
+ background: o.colorPrimary,
410
+ boxShadow: o.primaryShadow
411
+ }), f(o.componentCls, {
412
+ color: o.colorTextLightSolid,
413
+ background: o.colorPrimaryHover
414
+ }, {
415
+ color: o.colorTextLightSolid,
416
+ background: o.colorPrimaryActive
417
+ })), H(o.componentCls, o.ghostBg, o.colorPrimary, o.colorPrimary, o.colorTextDisabled, o.colorBorder, {
418
+ color: o.colorPrimaryHover,
419
+ borderColor: o.colorPrimaryHover
420
+ }, {
421
+ color: o.colorPrimaryActive,
422
+ borderColor: o.colorPrimaryActive
423
+ })), {
424
+ [`&${o.componentCls}-dangerous`]: Object.assign(Object.assign(Object.assign({
425
+ background: o.colorError,
426
+ boxShadow: o.dangerShadow,
427
+ color: o.dangerColor
428
+ }, f(o.componentCls, {
429
+ background: o.colorErrorHover
430
+ }, {
431
+ background: o.colorErrorActive
432
+ })), H(o.componentCls, o.ghostBg, o.colorError, o.colorError, o.colorTextDisabled, o.colorBorder, {
433
+ color: o.colorErrorHover,
434
+ borderColor: o.colorErrorHover
435
+ }, {
436
+ color: o.colorErrorActive,
437
+ borderColor: o.colorErrorActive
438
+ })), X(o))
439
+ }), Se = (o) => Object.assign(Object.assign({}, Oo(o)), {
440
+ borderStyle: "dashed"
441
+ }), he = (o) => Object.assign(Object.assign(Object.assign({
442
+ color: o.colorLink
443
+ }, f(o.componentCls, {
444
+ color: o.colorLinkHover,
445
+ background: o.linkHoverBg
446
+ }, {
447
+ color: o.colorLinkActive
448
+ })), j(o)), {
449
+ [`&${o.componentCls}-dangerous`]: Object.assign(Object.assign({
450
+ color: o.colorError
451
+ }, f(o.componentCls, {
452
+ color: o.colorErrorHover
453
+ }, {
454
+ color: o.colorErrorActive
455
+ })), j(o))
456
+ }), Ce = (o) => Object.assign(Object.assign(Object.assign({}, f(o.componentCls, {
457
+ color: o.colorText,
458
+ background: o.textHoverBg
459
+ }, {
460
+ color: o.colorText,
461
+ background: o.colorBgTextActive
462
+ })), j(o)), {
463
+ [`&${o.componentCls}-dangerous`]: Object.assign(Object.assign({
464
+ color: o.colorError
465
+ }, j(o)), f(o.componentCls, {
466
+ color: o.colorErrorHover,
467
+ background: o.colorErrorBg
468
+ }, {
469
+ color: o.colorErrorHover,
470
+ background: o.colorErrorBgActive
471
+ }))
472
+ }), ye = (o) => {
473
+ const {
474
+ componentCls: e
475
+ } = o;
476
+ return {
477
+ [`${e}-default`]: Oo(o),
478
+ [`${e}-primary`]: fe(o),
479
+ [`${e}-dashed`]: Se(o),
480
+ [`${e}-link`]: he(o),
481
+ [`${e}-text`]: Ce(o),
482
+ [`${e}-ghost`]: H(o.componentCls, o.ghostBg, o.colorBgContainer, o.colorBgContainer, o.colorTextDisabled, o.colorBorder)
483
+ };
484
+ }, U = function(o) {
485
+ let e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "";
486
+ const {
487
+ componentCls: t,
488
+ controlHeight: r,
489
+ fontSize: n,
490
+ lineHeight: l,
491
+ borderRadius: i,
492
+ buttonPaddingHorizontal: c,
493
+ iconCls: m,
494
+ buttonPaddingVertical: d
495
+ } = o, b = `${t}-icon-only`;
496
+ return [
497
+ {
498
+ [`${e}`]: {
499
+ fontSize: n,
500
+ lineHeight: l,
501
+ height: r,
502
+ padding: `${I(d)} ${I(c)}`,
503
+ borderRadius: i,
504
+ [`&${b}`]: {
505
+ display: "inline-flex",
506
+ alignItems: "center",
507
+ justifyContent: "center",
508
+ width: r,
509
+ paddingInlineStart: 0,
510
+ paddingInlineEnd: 0,
511
+ [`&${t}-round`]: {
512
+ width: "auto"
513
+ },
514
+ [m]: {
515
+ fontSize: o.buttonIconOnlyFontSize
516
+ }
517
+ },
518
+ // Loading
519
+ [`&${t}-loading`]: {
520
+ opacity: o.opacityLoading,
521
+ cursor: "default"
522
+ },
523
+ [`${t}-loading-icon`]: {
524
+ transition: `width ${o.motionDurationSlow} ${o.motionEaseInOut}, opacity ${o.motionDurationSlow} ${o.motionEaseInOut}`
525
+ }
526
+ }
527
+ },
528
+ // Shape - patch prefixCls again to override solid border radius style
529
+ {
530
+ [`${t}${t}-circle${e}`]: me(o)
531
+ },
532
+ {
533
+ [`${t}${t}-round${e}`]: be(o)
534
+ }
535
+ ];
536
+ }, ve = (o) => {
537
+ const e = L(o, {
538
+ fontSize: o.contentFontSize,
539
+ lineHeight: o.contentLineHeight
540
+ });
541
+ return U(e, o.componentCls);
542
+ }, $e = (o) => {
543
+ const e = L(o, {
544
+ controlHeight: o.controlHeightSM,
545
+ fontSize: o.contentFontSizeSM,
546
+ lineHeight: o.contentLineHeightSM,
547
+ padding: o.paddingXS,
548
+ buttonPaddingHorizontal: o.paddingInlineSM,
549
+ buttonPaddingVertical: o.paddingBlockSM,
550
+ borderRadius: o.borderRadiusSM,
551
+ buttonIconOnlyFontSize: o.onlyIconSizeSM
552
+ });
553
+ return U(e, `${o.componentCls}-sm`);
554
+ }, Be = (o) => {
555
+ const e = L(o, {
556
+ controlHeight: o.controlHeightLG,
557
+ fontSize: o.contentFontSizeLG,
558
+ lineHeight: o.contentLineHeightLG,
559
+ buttonPaddingHorizontal: o.paddingInlineLG,
560
+ buttonPaddingVertical: o.paddingBlockLG,
561
+ borderRadius: o.borderRadiusLG,
562
+ buttonIconOnlyFontSize: o.onlyIconSizeLG
563
+ });
564
+ return U(e, `${o.componentCls}-lg`);
565
+ }, Oe = (o) => {
566
+ const {
567
+ componentCls: e
568
+ } = o;
569
+ return {
570
+ [e]: {
571
+ [`&${e}-block`]: {
572
+ width: "100%"
573
+ }
574
+ }
575
+ };
576
+ }, xe = Ko("Button", (o) => {
577
+ const e = vo(o);
578
+ return [
579
+ // Shared
580
+ ge(e),
581
+ // Size
582
+ ve(e),
583
+ $e(e),
584
+ Be(e),
585
+ // Block
586
+ Oe(e),
587
+ // Group (type, ghost, danger, loading)
588
+ ye(e),
589
+ // Button Group
590
+ ue(e)
591
+ ];
592
+ }, $o, {
593
+ unitless: {
594
+ fontWeight: !0,
595
+ contentLineHeight: !0,
596
+ contentLineHeightSM: !0,
597
+ contentLineHeightLG: !0
598
+ }
599
+ });
600
+ function Ee(o, e) {
601
+ return {
602
+ // border collapse
603
+ [`&-item:not(${e}-last-item)`]: {
604
+ marginBottom: o.calc(o.lineWidth).mul(-1).equal()
605
+ },
606
+ "&-item": {
607
+ "&:hover,&:focus,&:active": {
608
+ zIndex: 2
609
+ },
610
+ "&[disabled]": {
611
+ zIndex: 0
612
+ }
613
+ }
614
+ };
615
+ }
616
+ function Ie(o, e) {
617
+ return {
618
+ [`&-item:not(${e}-first-item):not(${e}-last-item)`]: {
619
+ borderRadius: 0
620
+ },
621
+ [`&-item${e}-first-item:not(${e}-last-item)`]: {
622
+ [`&, &${o}-sm, &${o}-lg`]: {
623
+ borderEndEndRadius: 0,
624
+ borderEndStartRadius: 0
625
+ }
626
+ },
627
+ [`&-item${e}-last-item:not(${e}-first-item)`]: {
628
+ [`&, &${o}-sm, &${o}-lg`]: {
629
+ borderStartStartRadius: 0,
630
+ borderStartEndRadius: 0
631
+ }
632
+ }
633
+ };
634
+ }
635
+ function He(o) {
636
+ const e = `${o.componentCls}-compact-vertical`;
637
+ return {
638
+ [e]: Object.assign(Object.assign({}, Ee(o, e)), Ie(o.componentCls, e))
639
+ };
640
+ }
641
+ const ze = (o) => {
642
+ const {
643
+ componentCls: e,
644
+ calc: t
645
+ } = o;
646
+ return {
647
+ [e]: {
648
+ // Special styles for Primary Button
649
+ [`&-compact-item${e}-primary`]: {
650
+ [`&:not([disabled]) + ${e}-compact-item${e}-primary:not([disabled])`]: {
651
+ position: "relative",
652
+ "&:before": {
653
+ position: "absolute",
654
+ top: t(o.lineWidth).mul(-1).equal(),
655
+ insetInlineStart: t(o.lineWidth).mul(-1).equal(),
656
+ display: "inline-block",
657
+ width: o.lineWidth,
658
+ height: `calc(100% + ${I(o.lineWidth)} * 2)`,
659
+ backgroundColor: o.colorPrimaryHover,
660
+ content: '""'
661
+ }
662
+ }
663
+ },
664
+ // Special styles for Primary Button
665
+ "&-compact-vertical-item": {
666
+ [`&${e}-primary`]: {
667
+ [`&:not([disabled]) + ${e}-compact-vertical-item${e}-primary:not([disabled])`]: {
668
+ position: "relative",
669
+ "&:before": {
670
+ position: "absolute",
671
+ top: t(o.lineWidth).mul(-1).equal(),
672
+ insetInlineStart: t(o.lineWidth).mul(-1).equal(),
673
+ display: "inline-block",
674
+ width: `calc(100% + ${I(o.lineWidth)} * 2)`,
675
+ height: o.lineWidth,
676
+ backgroundColor: o.colorPrimaryHover,
677
+ content: '""'
678
+ }
679
+ }
680
+ }
681
+ }
682
+ }
683
+ };
684
+ }, je = Yo(["Button", "compact"], (o) => {
685
+ const e = vo(o);
686
+ return [
687
+ // Space Compact
688
+ ee(e),
689
+ He(e),
690
+ ze(e)
691
+ ];
692
+ }, $o);
693
+ var Le = function(o, e) {
694
+ var t = {};
695
+ for (var r in o)
696
+ Object.prototype.hasOwnProperty.call(o, r) && e.indexOf(r) < 0 && (t[r] = o[r]);
697
+ if (o != null && typeof Object.getOwnPropertySymbols == "function")
698
+ for (var n = 0, r = Object.getOwnPropertySymbols(o); n < r.length; n++)
699
+ e.indexOf(r[n]) < 0 && Object.prototype.propertyIsEnumerable.call(o, r[n]) && (t[r[n]] = o[r[n]]);
700
+ return t;
701
+ };
702
+ function Pe(o) {
703
+ if (typeof o == "object" && o) {
704
+ let e = o == null ? void 0 : o.delay;
705
+ return e = !Number.isNaN(e) && typeof e == "number" ? e : 0, {
706
+ loading: e <= 0,
707
+ delay: e
708
+ };
709
+ }
710
+ return {
711
+ loading: !!o,
712
+ delay: 0
713
+ };
714
+ }
715
+ const Te = /* @__PURE__ */ a.forwardRef((o, e) => {
716
+ var t, r, n;
717
+ const {
718
+ loading: l = !1,
719
+ prefixCls: i,
720
+ type: c,
721
+ danger: m,
722
+ shape: d = "default",
723
+ size: b,
724
+ styles: S,
725
+ disabled: y,
726
+ className: Eo,
727
+ rootClassName: Io,
728
+ children: h,
729
+ icon: B,
730
+ iconPosition: P = "start",
731
+ ghost: Ho = !1,
732
+ block: zo = !1,
733
+ // React does not recognize the `htmlType` prop on a DOM element. Here we pick it out of `rest`.
734
+ htmlType: jo = "button",
735
+ classNames: T,
736
+ style: Lo = {},
737
+ autoInsertSpace: w
738
+ } = o, J = Le(o, ["loading", "prefixCls", "type", "danger", "shape", "size", "styles", "disabled", "className", "rootClassName", "children", "icon", "iconPosition", "ghost", "block", "htmlType", "classNames", "style", "autoInsertSpace"]), O = c || "default", {
739
+ getPrefixCls: Po,
740
+ direction: K,
741
+ button: u
742
+ } = D(ho), N = (t = w ?? (u == null ? void 0 : u.autoInsertSpace)) !== null && t !== void 0 ? t : !0, s = Po("btn", i), [Q, To, wo] = xe(s), No = D(Zo), x = y ?? No, Wo = D(Co), E = _o(() => Pe(l), [l]), [C, Y] = uo(E.loading), [W, Z] = uo(!1), v = ko(e, /* @__PURE__ */ Vo()), k = Fo.count(h) === 1 && !B && !_(O);
743
+ go(() => {
744
+ let g = null;
745
+ E.delay > 0 ? g = setTimeout(() => {
746
+ g = null, Y(!0);
747
+ }, E.delay) : Y(E.loading);
748
+ function p() {
749
+ g && (clearTimeout(g), g = null);
750
+ }
751
+ return p;
752
+ }, [E]), go(() => {
753
+ if (!v || !v.current || !N)
754
+ return;
755
+ const g = v.current.textContent;
756
+ k && q(g) ? W || Z(!0) : W && Z(!1);
757
+ }, [v]);
758
+ const oo = (g) => {
759
+ const {
760
+ onClick: p
761
+ } = o;
762
+ if (C || x) {
763
+ g.preventDefault();
764
+ return;
765
+ }
766
+ p == null || p(g);
767
+ }, {
768
+ compactSize: Ao,
769
+ compactItemClassnames: eo
770
+ } = te(s, K), Ro = {
771
+ large: "lg",
772
+ small: "sm",
773
+ middle: void 0
774
+ }, to = re((g) => {
775
+ var p, G;
776
+ return (G = (p = b ?? Ao) !== null && p !== void 0 ? p : Wo) !== null && G !== void 0 ? G : g;
777
+ }), ro = to && Ro[to] || "", no = C ? "loading" : B, A = ne(J, ["navigate"]), lo = $(s, To, wo, {
778
+ [`${s}-${d}`]: d !== "default" && d,
779
+ [`${s}-${O}`]: O,
780
+ [`${s}-${ro}`]: ro,
781
+ [`${s}-icon-only`]: !h && h !== 0 && !!no,
782
+ [`${s}-background-ghost`]: Ho && !_(O),
783
+ [`${s}-loading`]: C,
784
+ [`${s}-two-chinese-chars`]: W && N && !C,
785
+ [`${s}-block`]: zo,
786
+ [`${s}-dangerous`]: !!m,
787
+ [`${s}-rtl`]: K === "rtl"
788
+ }, eo, Eo, Io, u == null ? void 0 : u.className), io = Object.assign(Object.assign({}, u == null ? void 0 : u.style), Lo), Go = P === "end" && h && h !== 0 && no, Do = $(T == null ? void 0 : T.icon, (r = u == null ? void 0 : u.classNames) === null || r === void 0 ? void 0 : r.icon, {
789
+ [`${s}-icon-end`]: Go
790
+ }), Mo = Object.assign(Object.assign({}, (S == null ? void 0 : S.icon) || {}), ((n = u == null ? void 0 : u.styles) === null || n === void 0 ? void 0 : n.icon) || {}), ao = B && !C ? /* @__PURE__ */ a.createElement(yo, {
791
+ prefixCls: s,
792
+ className: Do,
793
+ style: Mo
794
+ }, B) : /* @__PURE__ */ a.createElement(de, {
795
+ existIcon: !!B,
796
+ prefixCls: s,
797
+ loading: !!C,
798
+ iconPosition: P
799
+ }), co = h || h === 0 ? se(h, k && N) : null, so = (g, p) => P === "start" ? /* @__PURE__ */ a.createElement(a.Fragment, null, g, p) : /* @__PURE__ */ a.createElement(a.Fragment, null, p, g);
800
+ if (A.href !== void 0)
801
+ return Q(/* @__PURE__ */ a.createElement("a", Object.assign({}, A, {
802
+ className: $(lo, {
803
+ [`${s}-disabled`]: x
804
+ }),
805
+ href: x ? void 0 : A.href,
806
+ style: io,
807
+ onClick: oo,
808
+ ref: v,
809
+ tabIndex: x ? -1 : 0
810
+ }), so(ao, co)));
811
+ let R = /* @__PURE__ */ a.createElement("button", Object.assign({}, J, {
812
+ type: jo,
813
+ className: lo,
814
+ style: io,
815
+ onClick: oo,
816
+ disabled: x,
817
+ ref: v
818
+ }), so(ao, co), !!eo && /* @__PURE__ */ a.createElement(je, {
819
+ key: "compact",
820
+ prefixCls: s
821
+ }));
822
+ return _(O) || (R = /* @__PURE__ */ a.createElement(le, {
823
+ component: "Button",
824
+ disabled: !!C
825
+ }, R)), Q(R);
826
+ }), xo = Te;
827
+ xo.Group = ae;
828
+ xo.__ANT_BUTTON = !0;
829
+ export {
830
+ xo as B,
831
+ Re as c
832
+ };