gasp-components 1.0.10 → 1.0.11

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 (86) hide show
  1. package/dist/UploadOutlined-9WKjHsqa.js +878 -0
  2. package/dist/components/ag-grid-table/index.js +57877 -38314
  3. package/dist/components/button/index.js +18 -18
  4. package/dist/components/checklist/checklist-item.js +3 -3
  5. package/dist/components/checklist/index.js +5 -5
  6. package/dist/components/date-picker/index.js +9 -5022
  7. package/dist/components/dragger/index.js +28 -28
  8. package/dist/components/dropdown/index.js +10 -11
  9. package/dist/components/form/index.js +8 -9
  10. package/dist/components/form-item/index.js +10 -10
  11. package/dist/components/input/index.js +8 -8
  12. package/dist/components/modal/index.js +18 -20
  13. package/dist/components/password-input/index.js +2 -2
  14. package/dist/components/progress/index.js +16 -18
  15. package/dist/components/progress-circle/index.js +3 -3
  16. package/dist/components/radio-button/index.js +8 -8
  17. package/dist/components/result-popup/index.js +13 -14
  18. package/dist/components/select/index.js +1 -1
  19. package/dist/components/side-menu/index.js +2 -2
  20. package/dist/components/side-menu/menu-item.js +4 -6
  21. package/dist/components/steps/index.js +9 -9
  22. package/dist/components/table/index.js +16 -9298
  23. package/dist/components/tabs/index.js +10 -10
  24. package/dist/components/tabs/tab.js +7 -8
  25. package/dist/components/tag/index.js +9 -258
  26. package/dist/components/timeline-horizontal/index.js +7 -7
  27. package/dist/components/upload/index.js +62 -77
  28. package/dist/index-WlPrqxgY.js +87 -0
  29. package/dist/main.js +69 -457
  30. package/package.json +1 -1
  31. package/dist/CheckCircleFilled-xt-0R96Z.js +0 -16
  32. package/dist/CheckOutlined-EgxCAgj_.js +0 -16
  33. package/dist/CloseCircleFilled-bIgIULWb.js +0 -16
  34. package/dist/CloseOutlined-Q3kC3EZS.js +0 -16
  35. package/dist/Compact-fdEKV_mF.js +0 -180
  36. package/dist/ExclamationCircleFilled-XzDBEGmA.js +0 -16
  37. package/dist/KeyCode-qFRXB1-n.js +0 -517
  38. package/dist/LoadingOutlined-6Ipqn0og.js +0 -16
  39. package/dist/Overflow-JFdXKgCr.js +0 -231
  40. package/dist/PurePanel-hLGnXbul.js +0 -60
  41. package/dist/SearchOutlined-rJTFGXUi.js +0 -16
  42. package/dist/TextArea-n3dknzTq.js +0 -716
  43. package/dist/UploadOutlined-D8jfLEgv.js +0 -27
  44. package/dist/asyncToGenerator-t4sKr8R4.js +0 -340
  45. package/dist/button-LN5ZDad8.js +0 -819
  46. package/dist/collapse-ilv4Tji1.js +0 -20
  47. package/dist/colors-opGg9oSz.js +0 -25
  48. package/dist/compact-item-jjuVmDBH.js +0 -61
  49. package/dist/context-h3WSVDPz.js +0 -2087
  50. package/dist/createFormattedComponent-FcpICAm8.js +0 -3260
  51. package/dist/index--6VfGMUo.js +0 -402
  52. package/dist/index-0mpuHoS5.js +0 -996
  53. package/dist/index-1KQbTQJ2.js +0 -4405
  54. package/dist/index-5Uo03BMk.js +0 -681
  55. package/dist/index-BFgxz47K.js +0 -89
  56. package/dist/index-D3LMPWyJ.js +0 -1437
  57. package/dist/index-DVS_nWxv.js +0 -3026
  58. package/dist/index-ELHBhuK9.js +0 -100
  59. package/dist/index-Fn8q8B3V.js +0 -107
  60. package/dist/index-GgkQrebz.js +0 -950
  61. package/dist/index-L-MzVDcK.js +0 -616
  62. package/dist/index-M3WnMjiA.js +0 -230
  63. package/dist/index-NQd_zMf0.js +0 -69
  64. package/dist/index-ZT64Ec6u.js +0 -267
  65. package/dist/index-aawDqn9q.js +0 -3337
  66. package/dist/index-k04G4nlS.js +0 -1416
  67. package/dist/index-s3u4YBl4.js +0 -8
  68. package/dist/index-vtDVJV8q.js +0 -19571
  69. package/dist/isVisible-Qi9l15Ty.js +0 -232
  70. package/dist/motion-0ToOu81j.js +0 -226
  71. package/dist/motion-NQme0FJ_.js +0 -32
  72. package/dist/omit-ylWA0ZLZ.js +0 -10
  73. package/dist/pickAttrs-zaQzRTqh.js +0 -42
  74. package/dist/progress-a1_pwKVT.js +0 -722
  75. package/dist/reactNode-R20zZQk1.js +0 -18
  76. package/dist/responsiveObserver-V1_1G14X.js +0 -71
  77. package/dist/roundedArrow-p1Pmd9av.js +0 -64
  78. package/dist/row-sPFiFm0C.js +0 -230
  79. package/dist/slide-mFXPRHku.js +0 -265
  80. package/dist/styleChecker-pZ3k2IiY.js +0 -37
  81. package/dist/useCSSVarCls-GwZT_WiF.js +0 -9
  82. package/dist/useClosable-4G12n4Bp.js +0 -15
  83. package/dist/useLocale-eThlLZJw.js +0 -16
  84. package/dist/useMergedState-qUafLuUa.js +0 -23
  85. package/dist/useVariants-s0IcneBD.js +0 -25
  86. package/dist/zoom-Ps8y0jNW.js +0 -174
@@ -1,1416 +0,0 @@
1
- import { e as G, i as U, a as dt, t as ut, _ as P, b as ce, F as Ie, w as Ce, ag as ve, f as ft, ah as Re, ae as mt, h as gt, d as S, r as Ct, a0 as vt, m as pt, C as oe, D as de, B as bt, j as yt, A as Be, u as xt, ai as ht, aj as $t, af as Me, l as Et } from "./index-1KQbTQJ2.js";
2
- import * as r from "react";
3
- import y, { useContext as Y, useRef as q, useEffect as pe } from "react";
4
- import { u as Nt, r as Ot } from "./index-ZT64Ec6u.js";
5
- import { C as St } from "./CheckCircleFilled-xt-0R96Z.js";
6
- import { C as wt } from "./CloseCircleFilled-bIgIULWb.js";
7
- import { E as Pt } from "./ExclamationCircleFilled-XzDBEGmA.js";
8
- import { A as Tt, u as It } from "./isVisible-Qi9l15Ty.js";
9
- import { c as T } from "./index-NQd_zMf0.js";
10
- import { a as Rt, P as Bt, K as je, i as Mt, u as jt, z as zt, C as Ft } from "./motion-0ToOu81j.js";
11
- import { g as ne } from "./motion-NQme0FJ_.js";
12
- import { B as ue, c as ze } from "./button-LN5ZDad8.js";
13
- import { C as Fe } from "./CloseOutlined-Q3kC3EZS.js";
14
- import { K as be } from "./KeyCode-qFRXB1-n.js";
15
- import { p as Dt } from "./pickAttrs-zaQzRTqh.js";
16
- import { u as _t } from "./useClosable-4G12n4Bp.js";
17
- import { N as At } from "./context-h3WSVDPz.js";
18
- import { N as Ht } from "./Compact-fdEKV_mF.js";
19
- import { u as fe } from "./useLocale-eThlLZJw.js";
20
- import { i as Lt } from "./zoom-Ps8y0jNW.js";
21
- import { u as De } from "./useCSSVarCls-GwZT_WiF.js";
22
- import { w as Vt } from "./PurePanel-hLGnXbul.js";
23
- var Wt = { icon: { tag: "svg", attrs: { viewBox: "64 64 896 896", focusable: "false" }, children: [{ tag: "path", attrs: { d: "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm32 664c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V456c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v272zm-32-344a48.01 48.01 0 010-96 48.01 48.01 0 010 96z" } }] }, name: "info-circle", theme: "filled" };
24
- const qt = Wt;
25
- var _e = function(t, o) {
26
- return /* @__PURE__ */ r.createElement(Tt, G({}, t, {
27
- ref: o,
28
- icon: qt
29
- }));
30
- };
31
- process.env.NODE_ENV !== "production" && (_e.displayName = "InfoCircleFilled");
32
- const Gt = /* @__PURE__ */ r.forwardRef(_e);
33
- function Ut() {
34
- const [e, t] = r.useState([]), o = r.useCallback((n) => (t((a) => [].concat(U(a), [n])), () => {
35
- t((a) => a.filter((l) => l !== n));
36
- }), []);
37
- return [e, o];
38
- }
39
- function ye(e) {
40
- return !!(e && e.then);
41
- }
42
- const Xt = (e) => {
43
- const {
44
- type: t,
45
- children: o,
46
- prefixCls: n,
47
- buttonProps: a,
48
- close: l,
49
- autoFocus: f,
50
- emitEvent: c,
51
- isSilent: s,
52
- quitOnNullishReturnValue: u,
53
- actionFn: i
54
- } = e, d = r.useRef(!1), v = r.useRef(null), [g, x] = dt(!1), C = function() {
55
- l == null || l.apply(void 0, arguments);
56
- };
57
- r.useEffect(() => {
58
- let m = null;
59
- return f && (m = setTimeout(() => {
60
- var b;
61
- (b = v.current) === null || b === void 0 || b.focus();
62
- })), () => {
63
- m && clearTimeout(m);
64
- };
65
- }, []);
66
- const h = (m) => {
67
- ye(m) && (x(!0), m.then(function() {
68
- x(!1, !0), C.apply(void 0, arguments), d.current = !1;
69
- }, (b) => {
70
- if (x(!1, !0), d.current = !1, !(s != null && s()))
71
- return Promise.reject(b);
72
- }));
73
- }, p = (m) => {
74
- if (d.current)
75
- return;
76
- if (d.current = !0, !i) {
77
- C();
78
- return;
79
- }
80
- let b;
81
- if (c) {
82
- if (b = i(m), u && !ye(b)) {
83
- d.current = !1, C(m);
84
- return;
85
- }
86
- } else if (i.length)
87
- b = i(l), d.current = !1;
88
- else if (b = i(), !b) {
89
- C();
90
- return;
91
- }
92
- h(b);
93
- };
94
- return /* @__PURE__ */ r.createElement(ue, Object.assign({}, ze(t), {
95
- onClick: p,
96
- loading: g,
97
- prefixCls: n
98
- }, a, {
99
- ref: v
100
- }), o);
101
- }, Ae = Xt, J = /* @__PURE__ */ y.createContext({}), {
102
- Provider: He
103
- } = J, Kt = () => {
104
- const {
105
- autoFocusButton: e,
106
- cancelButtonProps: t,
107
- cancelTextLocale: o,
108
- isSilent: n,
109
- mergedOkCancel: a,
110
- rootPrefixCls: l,
111
- close: f,
112
- onCancel: c,
113
- onConfirm: s
114
- } = Y(J);
115
- return a ? /* @__PURE__ */ y.createElement(Ae, {
116
- isSilent: n,
117
- actionFn: c,
118
- close: function() {
119
- f == null || f.apply(void 0, arguments), s == null || s(!1);
120
- },
121
- autoFocus: e === "cancel",
122
- buttonProps: t,
123
- prefixCls: `${l}-btn`
124
- }, o) : null;
125
- }, xe = Kt, Qt = () => {
126
- const {
127
- autoFocusButton: e,
128
- close: t,
129
- isSilent: o,
130
- okButtonProps: n,
131
- rootPrefixCls: a,
132
- okTextLocale: l,
133
- okType: f,
134
- onConfirm: c,
135
- onOk: s
136
- } = Y(J);
137
- return /* @__PURE__ */ y.createElement(Ae, {
138
- isSilent: o,
139
- type: f || "primary",
140
- actionFn: s,
141
- close: function() {
142
- t == null || t.apply(void 0, arguments), c == null || c(!0);
143
- },
144
- autoFocus: e === "ok",
145
- buttonProps: n,
146
- prefixCls: `${a}-btn`
147
- }, l);
148
- }, he = Qt;
149
- var Le = /* @__PURE__ */ r.createContext({});
150
- function $e(e, t, o) {
151
- var n = t;
152
- return !n && o && (n = "".concat(e, "-").concat(o)), n;
153
- }
154
- function Ee(e, t) {
155
- var o = e["page".concat(t ? "Y" : "X", "Offset")], n = "scroll".concat(t ? "Top" : "Left");
156
- if (typeof o != "number") {
157
- var a = e.document;
158
- o = a.documentElement[n], typeof o != "number" && (o = a.body[n]);
159
- }
160
- return o;
161
- }
162
- function Zt(e) {
163
- var t = e.getBoundingClientRect(), o = {
164
- left: t.left,
165
- top: t.top
166
- }, n = e.ownerDocument, a = n.defaultView || n.parentWindow;
167
- return o.left += Ee(a), o.top += Ee(a, !0), o;
168
- }
169
- const Yt = /* @__PURE__ */ r.memo(function(e) {
170
- var t = e.children;
171
- return t;
172
- }, function(e, t) {
173
- var o = t.shouldUpdate;
174
- return !o;
175
- });
176
- var Ne = {
177
- width: 0,
178
- height: 0,
179
- overflow: "hidden",
180
- outline: "none"
181
- }, me = /* @__PURE__ */ y.forwardRef(function(e, t) {
182
- var o = e.prefixCls, n = e.className, a = e.style, l = e.title, f = e.ariaId, c = e.footer, s = e.closable, u = e.closeIcon, i = e.onClose, d = e.children, v = e.bodyStyle, g = e.bodyProps, x = e.modalRender, C = e.onMouseDown, h = e.onMouseUp, p = e.holderRef, m = e.visible, b = e.forceRender, $ = e.width, w = e.height, E = e.classNames, N = e.styles, _ = y.useContext(Le), R = _.panel, A = ut(p, R), j = q(), H = q();
183
- y.useImperativeHandle(t, function() {
184
- return {
185
- focus: function() {
186
- var F;
187
- (F = j.current) === null || F === void 0 || F.focus();
188
- },
189
- changeActive: function(F) {
190
- var X = document, K = X.activeElement;
191
- F && K === H.current ? j.current.focus() : !F && K === j.current && H.current.focus();
192
- }
193
- };
194
- });
195
- var I = {};
196
- $ !== void 0 && (I.width = $), w !== void 0 && (I.height = w);
197
- var B;
198
- c && (B = /* @__PURE__ */ y.createElement("div", {
199
- className: T("".concat(o, "-footer"), E == null ? void 0 : E.footer),
200
- style: P({}, N == null ? void 0 : N.footer)
201
- }, c));
202
- var z;
203
- l && (z = /* @__PURE__ */ y.createElement("div", {
204
- className: T("".concat(o, "-header"), E == null ? void 0 : E.header),
205
- style: P({}, N == null ? void 0 : N.header)
206
- }, /* @__PURE__ */ y.createElement("div", {
207
- className: "".concat(o, "-title"),
208
- id: f
209
- }, l)));
210
- var L;
211
- s && (L = /* @__PURE__ */ y.createElement("button", {
212
- type: "button",
213
- onClick: i,
214
- "aria-label": "Close",
215
- className: "".concat(o, "-close")
216
- }, u || /* @__PURE__ */ y.createElement("span", {
217
- className: "".concat(o, "-close-x")
218
- })));
219
- var W = /* @__PURE__ */ y.createElement("div", {
220
- className: T("".concat(o, "-content"), E == null ? void 0 : E.content),
221
- style: N == null ? void 0 : N.content
222
- }, L, z, /* @__PURE__ */ y.createElement("div", G({
223
- className: T("".concat(o, "-body"), E == null ? void 0 : E.body),
224
- style: P(P({}, v), N == null ? void 0 : N.body)
225
- }, g), d), B);
226
- return /* @__PURE__ */ y.createElement("div", {
227
- key: "dialog-element",
228
- role: "dialog",
229
- "aria-labelledby": l ? f : null,
230
- "aria-modal": "true",
231
- ref: A,
232
- style: P(P({}, a), I),
233
- className: T(o, n),
234
- onMouseDown: C,
235
- onMouseUp: h
236
- }, /* @__PURE__ */ y.createElement("div", {
237
- tabIndex: 0,
238
- ref: j,
239
- style: Ne,
240
- "aria-hidden": "true"
241
- }), /* @__PURE__ */ y.createElement(Yt, {
242
- shouldUpdate: m || b
243
- }, x ? x(W) : W), /* @__PURE__ */ y.createElement("div", {
244
- tabIndex: 0,
245
- ref: H,
246
- style: Ne,
247
- "aria-hidden": "true"
248
- }));
249
- });
250
- process.env.NODE_ENV !== "production" && (me.displayName = "Panel");
251
- var Ve = /* @__PURE__ */ r.forwardRef(function(e, t) {
252
- var o = e.prefixCls, n = e.title, a = e.style, l = e.className, f = e.visible, c = e.forceRender, s = e.destroyOnClose, u = e.motionName, i = e.ariaId, d = e.onVisibleChanged, v = e.mousePosition, g = q(), x = r.useState(), C = ce(x, 2), h = C[0], p = C[1], m = {};
253
- h && (m.transformOrigin = h);
254
- function b() {
255
- var $ = Zt(g.current);
256
- p(v ? "".concat(v.x - $.left, "px ").concat(v.y - $.top, "px") : "");
257
- }
258
- return /* @__PURE__ */ r.createElement(Ie, {
259
- visible: f,
260
- onVisibleChanged: d,
261
- onAppearPrepare: b,
262
- onEnterPrepare: b,
263
- forceRender: c,
264
- motionName: u,
265
- removeOnLeave: s,
266
- ref: g
267
- }, function($, w) {
268
- var E = $.className, N = $.style;
269
- return /* @__PURE__ */ r.createElement(me, G({}, e, {
270
- ref: t,
271
- title: n,
272
- ariaId: i,
273
- prefixCls: o,
274
- holderRef: w,
275
- style: P(P(P({}, N), a), m),
276
- className: T(l, E)
277
- }));
278
- });
279
- });
280
- Ve.displayName = "Content";
281
- function Jt(e) {
282
- var t = e.prefixCls, o = e.style, n = e.visible, a = e.maskProps, l = e.motionName, f = e.className;
283
- return /* @__PURE__ */ r.createElement(Ie, {
284
- key: "mask",
285
- visible: n,
286
- motionName: l,
287
- leavedClassName: "".concat(t, "-mask-hidden")
288
- }, function(c, s) {
289
- var u = c.className, i = c.style;
290
- return /* @__PURE__ */ r.createElement("div", G({
291
- ref: s,
292
- style: P(P({}, i), o),
293
- className: T("".concat(t, "-mask"), u, f)
294
- }, a));
295
- });
296
- }
297
- function kt(e) {
298
- var t = e.prefixCls, o = t === void 0 ? "rc-dialog" : t, n = e.zIndex, a = e.visible, l = a === void 0 ? !1 : a, f = e.keyboard, c = f === void 0 ? !0 : f, s = e.focusTriggerAfterClose, u = s === void 0 ? !0 : s, i = e.wrapStyle, d = e.wrapClassName, v = e.wrapProps, g = e.onClose, x = e.afterOpenChange, C = e.afterClose, h = e.transitionName, p = e.animation, m = e.closable, b = m === void 0 ? !0 : m, $ = e.mask, w = $ === void 0 ? !0 : $, E = e.maskTransitionName, N = e.maskAnimation, _ = e.maskClosable, R = _ === void 0 ? !0 : _, A = e.maskStyle, j = e.maskProps, H = e.rootClassName, I = e.classNames, B = e.styles;
299
- process.env.NODE_ENV !== "production" && (["wrapStyle", "bodyStyle", "maskStyle"].forEach(function(O) {
300
- Ce(!(O in e), "".concat(O, " is deprecated, please use styles instead."));
301
- }), "wrapClassName" in e && Ce(!1, "wrapClassName is deprecated, please use classNames instead."));
302
- var z = q(), L = q(), W = q(), Z = r.useState(l), F = ce(Z, 2), X = F[0], K = F[1], V = Rt();
303
- function D() {
304
- ve(L.current, document.activeElement) || (z.current = document.activeElement);
305
- }
306
- function ee() {
307
- if (!ve(L.current, document.activeElement)) {
308
- var O;
309
- (O = W.current) === null || O === void 0 || O.focus();
310
- }
311
- }
312
- function ae(O) {
313
- if (O)
314
- ee();
315
- else {
316
- if (K(!1), w && z.current && u) {
317
- try {
318
- z.current.focus({
319
- preventScroll: !0
320
- });
321
- } catch {
322
- }
323
- z.current = null;
324
- }
325
- X && (C == null || C());
326
- }
327
- x == null || x(O);
328
- }
329
- function re(O) {
330
- g == null || g(O);
331
- }
332
- var te = q(!1), le = q(), it = function() {
333
- clearTimeout(le.current), te.current = !0;
334
- }, st = function() {
335
- le.current = setTimeout(function() {
336
- te.current = !1;
337
- });
338
- }, ge = null;
339
- R && (ge = function(ie) {
340
- te.current ? te.current = !1 : L.current === ie.target && re(ie);
341
- });
342
- function ct(O) {
343
- if (c && O.keyCode === be.ESC) {
344
- O.stopPropagation(), re(O);
345
- return;
346
- }
347
- l && O.keyCode === be.TAB && W.current.changeActive(!O.shiftKey);
348
- }
349
- return pe(function() {
350
- l && (K(!0), D());
351
- }, [l]), pe(function() {
352
- return function() {
353
- clearTimeout(le.current);
354
- };
355
- }, []), /* @__PURE__ */ r.createElement("div", G({
356
- className: T("".concat(o, "-root"), H)
357
- }, Dt(e, {
358
- data: !0
359
- })), /* @__PURE__ */ r.createElement(Jt, {
360
- prefixCls: o,
361
- visible: w && l,
362
- motionName: $e(o, E, N),
363
- style: P(P({
364
- zIndex: n
365
- }, A), B == null ? void 0 : B.mask),
366
- maskProps: j,
367
- className: I == null ? void 0 : I.mask
368
- }), /* @__PURE__ */ r.createElement("div", G({
369
- tabIndex: -1,
370
- onKeyDown: ct,
371
- className: T("".concat(o, "-wrap"), d, I == null ? void 0 : I.wrapper),
372
- ref: L,
373
- onClick: ge,
374
- style: P(P(P({
375
- zIndex: n
376
- }, i), B == null ? void 0 : B.wrapper), {}, {
377
- display: X ? null : "none"
378
- })
379
- }, v), /* @__PURE__ */ r.createElement(Ve, G({}, e, {
380
- onMouseDown: it,
381
- onMouseUp: st,
382
- ref: W,
383
- closable: b,
384
- ariaId: V,
385
- prefixCls: o,
386
- visible: l && X,
387
- onClose: re,
388
- onVisibleChanged: ae,
389
- motionName: $e(o, h, p)
390
- }))));
391
- }
392
- var We = function(t) {
393
- var o = t.visible, n = t.getContainer, a = t.forceRender, l = t.destroyOnClose, f = l === void 0 ? !1 : l, c = t.afterClose, s = t.panelRef, u = r.useState(o), i = ce(u, 2), d = i[0], v = i[1], g = r.useMemo(function() {
394
- return {
395
- panel: s
396
- };
397
- }, [s]);
398
- return r.useEffect(function() {
399
- o && v(!0);
400
- }, [o]), !a && f && !d ? null : /* @__PURE__ */ r.createElement(Le.Provider, {
401
- value: g
402
- }, /* @__PURE__ */ r.createElement(Bt, {
403
- open: o || a || d,
404
- autoDestroy: !1,
405
- getContainer: n,
406
- autoLock: o || d
407
- }, /* @__PURE__ */ r.createElement(kt, G({}, t, {
408
- destroyOnClose: f,
409
- afterClose: function() {
410
- c == null || c(), v(!1);
411
- }
412
- }))));
413
- };
414
- We.displayName = "Dialog";
415
- const en = () => ft() && window.document.documentElement;
416
- function Oe() {
417
- }
418
- const tn = /* @__PURE__ */ r.createContext({
419
- add: Oe,
420
- remove: Oe
421
- });
422
- function nn(e) {
423
- const t = r.useContext(tn), o = r.useRef();
424
- return It((a) => {
425
- if (a) {
426
- const l = e ? a.querySelector(e) : a;
427
- t.add(l), o.current = l;
428
- } else
429
- t.remove(o.current);
430
- });
431
- }
432
- const on = () => {
433
- const {
434
- cancelButtonProps: e,
435
- cancelTextLocale: t,
436
- onCancel: o
437
- } = Y(J);
438
- return /* @__PURE__ */ y.createElement(ue, Object.assign({
439
- onClick: o
440
- }, e), t);
441
- }, Se = on, an = () => {
442
- const {
443
- confirmLoading: e,
444
- okButtonProps: t,
445
- okType: o,
446
- okTextLocale: n,
447
- onOk: a
448
- } = Y(J);
449
- return /* @__PURE__ */ y.createElement(ue, Object.assign({}, ze(o), {
450
- loading: e,
451
- onClick: a
452
- }, t), n);
453
- }, we = an;
454
- function qe(e, t) {
455
- return /* @__PURE__ */ y.createElement("span", {
456
- className: `${e}-close-x`
457
- }, t || /* @__PURE__ */ y.createElement(Fe, {
458
- className: `${e}-close-icon`
459
- }));
460
- }
461
- const Ge = (e) => {
462
- const {
463
- okText: t,
464
- okType: o = "primary",
465
- cancelText: n,
466
- confirmLoading: a,
467
- onOk: l,
468
- onCancel: f,
469
- okButtonProps: c,
470
- cancelButtonProps: s,
471
- footer: u
472
- } = e, [i] = fe("Modal", Re()), d = t || (i == null ? void 0 : i.okText), v = n || (i == null ? void 0 : i.cancelText), g = {
473
- confirmLoading: a,
474
- okButtonProps: c,
475
- cancelButtonProps: s,
476
- okTextLocale: d,
477
- cancelTextLocale: v,
478
- okType: o,
479
- onOk: l,
480
- onCancel: f
481
- }, x = y.useMemo(() => g, U(Object.values(g)));
482
- let C;
483
- return typeof u == "function" || typeof u > "u" ? (C = /* @__PURE__ */ y.createElement(y.Fragment, null, /* @__PURE__ */ y.createElement(Se, null), /* @__PURE__ */ y.createElement(we, null)), typeof u == "function" && (C = u(C, {
484
- OkBtn: we,
485
- CancelBtn: Se
486
- })), C = /* @__PURE__ */ y.createElement(He, {
487
- value: x
488
- }, C)) : C = u, /* @__PURE__ */ y.createElement(mt, {
489
- disabled: !1
490
- }, C);
491
- }, rn = new je("antFadeIn", {
492
- "0%": {
493
- opacity: 0
494
- },
495
- "100%": {
496
- opacity: 1
497
- }
498
- }), ln = new je("antFadeOut", {
499
- "0%": {
500
- opacity: 1
501
- },
502
- "100%": {
503
- opacity: 0
504
- }
505
- }), sn = function(e) {
506
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1;
507
- const {
508
- antCls: o
509
- } = e, n = `${o}-fade`, a = t ? "&" : "";
510
- return [Mt(n, rn, ln, e.motionDurationMid, t), {
511
- [`
512
- ${a}${n}-enter,
513
- ${a}${n}-appear
514
- `]: {
515
- opacity: 0,
516
- animationTimingFunction: "linear"
517
- },
518
- [`${a}${n}-leave`]: {
519
- animationTimingFunction: "linear"
520
- }
521
- }];
522
- };
523
- function Pe(e) {
524
- return {
525
- position: e,
526
- inset: 0
527
- };
528
- }
529
- const cn = (e) => {
530
- const {
531
- componentCls: t,
532
- antCls: o
533
- } = e;
534
- return [{
535
- [`${t}-root`]: {
536
- [`${t}${o}-zoom-enter, ${t}${o}-zoom-appear`]: {
537
- // reset scale avoid mousePosition bug
538
- transform: "none",
539
- opacity: 0,
540
- animationDuration: e.motionDurationSlow,
541
- // https://github.com/ant-design/ant-design/issues/11777
542
- userSelect: "none"
543
- },
544
- // https://github.com/ant-design/ant-design/issues/37329
545
- // https://github.com/ant-design/ant-design/issues/40272
546
- [`${t}${o}-zoom-leave ${t}-content`]: {
547
- pointerEvents: "none"
548
- },
549
- [`${t}-mask`]: Object.assign(Object.assign({}, Pe("fixed")), {
550
- zIndex: e.zIndexPopupBase,
551
- height: "100%",
552
- backgroundColor: e.colorBgMask,
553
- pointerEvents: "none",
554
- [`${t}-hidden`]: {
555
- display: "none"
556
- }
557
- }),
558
- [`${t}-wrap`]: Object.assign(Object.assign({}, Pe("fixed")), {
559
- zIndex: e.zIndexPopupBase,
560
- overflow: "auto",
561
- outline: 0,
562
- WebkitOverflowScrolling: "touch",
563
- // Note: Firefox not support `:has` yet
564
- [`&:has(${t}${o}-zoom-enter), &:has(${t}${o}-zoom-appear)`]: {
565
- pointerEvents: "none"
566
- }
567
- })
568
- }
569
- }, {
570
- [`${t}-root`]: sn(e)
571
- }];
572
- }, dn = (e) => {
573
- const {
574
- componentCls: t
575
- } = e;
576
- return [
577
- // ======================== Root =========================
578
- {
579
- [`${t}-root`]: {
580
- [`${t}-wrap-rtl`]: {
581
- direction: "rtl"
582
- },
583
- [`${t}-centered`]: {
584
- textAlign: "center",
585
- "&::before": {
586
- display: "inline-block",
587
- width: 0,
588
- height: "100%",
589
- verticalAlign: "middle",
590
- content: '""'
591
- },
592
- [t]: {
593
- top: 0,
594
- display: "inline-block",
595
- paddingBottom: 0,
596
- textAlign: "start",
597
- verticalAlign: "middle"
598
- }
599
- },
600
- [`@media (max-width: ${e.screenSMMax}px)`]: {
601
- [t]: {
602
- maxWidth: "calc(100vw - 16px)",
603
- margin: `${S(e.marginXS)} auto`
604
- },
605
- [`${t}-centered`]: {
606
- [t]: {
607
- flex: 1
608
- }
609
- }
610
- }
611
- }
612
- },
613
- // ======================== Modal ========================
614
- {
615
- [t]: Object.assign(Object.assign({}, Ct(e)), {
616
- pointerEvents: "none",
617
- position: "relative",
618
- top: 100,
619
- width: "auto",
620
- maxWidth: `calc(100vw - ${S(e.calc(e.margin).mul(2).equal())})`,
621
- margin: "0 auto",
622
- paddingBottom: e.paddingLG,
623
- [`${t}-title`]: {
624
- margin: 0,
625
- color: e.titleColor,
626
- fontWeight: e.fontWeightStrong,
627
- fontSize: e.titleFontSize,
628
- lineHeight: e.titleLineHeight,
629
- wordWrap: "break-word"
630
- },
631
- [`${t}-content`]: {
632
- position: "relative",
633
- backgroundColor: e.contentBg,
634
- backgroundClip: "padding-box",
635
- border: 0,
636
- borderRadius: e.borderRadiusLG,
637
- boxShadow: e.boxShadow,
638
- pointerEvents: "auto",
639
- padding: e.contentPadding
640
- },
641
- [`${t}-close`]: Object.assign({
642
- position: "absolute",
643
- top: e.calc(e.modalHeaderHeight).sub(e.modalCloseBtnSize).div(2).equal(),
644
- insetInlineEnd: e.calc(e.modalHeaderHeight).sub(e.modalCloseBtnSize).div(2).equal(),
645
- zIndex: e.calc(e.zIndexPopupBase).add(10).equal(),
646
- padding: 0,
647
- color: e.modalCloseIconColor,
648
- fontWeight: e.fontWeightStrong,
649
- lineHeight: 1,
650
- textDecoration: "none",
651
- background: "transparent",
652
- borderRadius: e.borderRadiusSM,
653
- width: e.modalCloseBtnSize,
654
- height: e.modalCloseBtnSize,
655
- border: 0,
656
- outline: 0,
657
- cursor: "pointer",
658
- transition: `color ${e.motionDurationMid}, background-color ${e.motionDurationMid}`,
659
- "&-x": {
660
- display: "flex",
661
- fontSize: e.fontSizeLG,
662
- fontStyle: "normal",
663
- lineHeight: `${S(e.modalCloseBtnSize)}`,
664
- justifyContent: "center",
665
- textTransform: "none",
666
- textRendering: "auto"
667
- },
668
- "&:hover": {
669
- color: e.modalIconHoverColor,
670
- backgroundColor: e.closeBtnHoverBg,
671
- textDecoration: "none"
672
- },
673
- "&:active": {
674
- backgroundColor: e.closeBtnActiveBg
675
- }
676
- }, vt(e)),
677
- [`${t}-header`]: {
678
- color: e.colorText,
679
- background: e.headerBg,
680
- borderRadius: `${S(e.borderRadiusLG)} ${S(e.borderRadiusLG)} 0 0`,
681
- marginBottom: e.headerMarginBottom,
682
- padding: e.headerPadding,
683
- borderBottom: e.headerBorderBottom
684
- },
685
- [`${t}-body`]: {
686
- fontSize: e.fontSize,
687
- lineHeight: e.lineHeight,
688
- wordWrap: "break-word",
689
- padding: e.bodyPadding
690
- },
691
- [`${t}-footer`]: {
692
- textAlign: "end",
693
- background: e.footerBg,
694
- marginTop: e.footerMarginTop,
695
- padding: e.footerPadding,
696
- borderTop: e.footerBorderTop,
697
- borderRadius: e.footerBorderRadius,
698
- [`> ${e.antCls}-btn + ${e.antCls}-btn`]: {
699
- marginInlineStart: e.marginXS
700
- }
701
- },
702
- [`${t}-open`]: {
703
- overflow: "hidden"
704
- }
705
- })
706
- },
707
- // ======================== Pure =========================
708
- {
709
- [`${t}-pure-panel`]: {
710
- top: "auto",
711
- padding: 0,
712
- display: "flex",
713
- flexDirection: "column",
714
- [`${t}-content,
715
- ${t}-body,
716
- ${t}-confirm-body-wrapper`]: {
717
- display: "flex",
718
- flexDirection: "column",
719
- flex: "auto"
720
- },
721
- [`${t}-confirm-body`]: {
722
- marginBottom: "auto"
723
- }
724
- }
725
- }
726
- ];
727
- }, un = (e) => {
728
- const {
729
- componentCls: t
730
- } = e;
731
- return {
732
- [`${t}-root`]: {
733
- [`${t}-wrap-rtl`]: {
734
- direction: "rtl",
735
- [`${t}-confirm-body`]: {
736
- direction: "rtl"
737
- }
738
- }
739
- }
740
- };
741
- }, Ue = (e) => {
742
- const t = e.padding, o = e.fontSizeHeading5, n = e.lineHeightHeading5;
743
- return pt(e, {
744
- modalHeaderHeight: e.calc(e.calc(n).mul(o).equal()).add(e.calc(t).mul(2).equal()).equal(),
745
- modalFooterBorderColorSplit: e.colorSplit,
746
- modalFooterBorderStyle: e.lineType,
747
- modalFooterBorderWidth: e.lineWidth,
748
- modalIconHoverColor: e.colorIconHover,
749
- modalCloseIconColor: e.colorIcon,
750
- modalCloseBtnSize: e.fontHeight,
751
- modalConfirmIconSize: e.fontHeight,
752
- modalTitleHeight: e.calc(e.titleFontSize).mul(e.titleLineHeight).equal()
753
- });
754
- }, Xe = (e) => ({
755
- footerBg: "transparent",
756
- headerBg: e.colorBgElevated,
757
- titleLineHeight: e.lineHeightHeading5,
758
- titleFontSize: e.fontSizeHeading5,
759
- contentBg: e.colorBgElevated,
760
- titleColor: e.colorTextHeading,
761
- // internal
762
- closeBtnHoverBg: e.wireframe ? "transparent" : e.colorFillContent,
763
- closeBtnActiveBg: e.wireframe ? "transparent" : e.colorFillContentHover,
764
- contentPadding: e.wireframe ? 0 : `${S(e.paddingMD)} ${S(e.paddingContentHorizontalLG)}`,
765
- headerPadding: e.wireframe ? `${S(e.padding)} ${S(e.paddingLG)}` : 0,
766
- headerBorderBottom: e.wireframe ? `${S(e.lineWidth)} ${e.lineType} ${e.colorSplit}` : "none",
767
- headerMarginBottom: e.wireframe ? 0 : e.marginXS,
768
- bodyPadding: e.wireframe ? e.paddingLG : 0,
769
- footerPadding: e.wireframe ? `${S(e.paddingXS)} ${S(e.padding)}` : 0,
770
- footerBorderTop: e.wireframe ? `${S(e.lineWidth)} ${e.lineType} ${e.colorSplit}` : "none",
771
- footerBorderRadius: e.wireframe ? `0 0 ${S(e.borderRadiusLG)} ${S(e.borderRadiusLG)}` : 0,
772
- footerMarginTop: e.wireframe ? 0 : e.marginSM,
773
- confirmBodyPadding: e.wireframe ? `${S(e.padding * 2)} ${S(e.padding * 2)} ${S(e.paddingLG)}` : 0,
774
- confirmIconMarginInlineEnd: e.wireframe ? e.margin : e.marginSM,
775
- confirmBtnsMarginTop: e.wireframe ? e.marginLG : e.marginSM
776
- }), Ke = gt("Modal", (e) => {
777
- const t = Ue(e);
778
- return [dn(t), un(t), cn(t), Lt(t, "zoom")];
779
- }, Xe, {
780
- unitless: {
781
- titleLineHeight: !0
782
- }
783
- });
784
- var fn = function(e, t) {
785
- var o = {};
786
- for (var n in e)
787
- Object.prototype.hasOwnProperty.call(e, n) && t.indexOf(n) < 0 && (o[n] = e[n]);
788
- if (e != null && typeof Object.getOwnPropertySymbols == "function")
789
- for (var a = 0, n = Object.getOwnPropertySymbols(e); a < n.length; a++)
790
- t.indexOf(n[a]) < 0 && Object.prototype.propertyIsEnumerable.call(e, n[a]) && (o[n[a]] = e[n[a]]);
791
- return o;
792
- };
793
- let se;
794
- const mn = (e) => {
795
- se = {
796
- x: e.pageX,
797
- y: e.pageY
798
- }, setTimeout(() => {
799
- se = null;
800
- }, 100);
801
- };
802
- en() && document.documentElement.addEventListener("click", mn, !0);
803
- const gn = (e) => {
804
- var t;
805
- const {
806
- getPopupContainer: o,
807
- getPrefixCls: n,
808
- direction: a,
809
- modal: l
810
- } = r.useContext(oe), f = (V) => {
811
- const {
812
- onCancel: D
813
- } = e;
814
- D == null || D(V);
815
- }, c = (V) => {
816
- const {
817
- onOk: D
818
- } = e;
819
- D == null || D(V);
820
- };
821
- if (process.env.NODE_ENV !== "production") {
822
- const V = de("Modal");
823
- [["visible", "open"], ["bodyStyle", "styles.body"], ["maskStyle", "styles.mask"]].forEach((D) => {
824
- let [ee, ae] = D;
825
- V.deprecated(!(ee in e), ee, ae);
826
- });
827
- }
828
- const {
829
- prefixCls: s,
830
- className: u,
831
- rootClassName: i,
832
- open: d,
833
- wrapClassName: v,
834
- centered: g,
835
- getContainer: x,
836
- closeIcon: C,
837
- closable: h,
838
- focusTriggerAfterClose: p = !0,
839
- style: m,
840
- // Deprecated
841
- visible: b,
842
- width: $ = 520,
843
- footer: w,
844
- classNames: E,
845
- styles: N
846
- } = e, _ = fn(e, ["prefixCls", "className", "rootClassName", "open", "wrapClassName", "centered", "getContainer", "closeIcon", "closable", "focusTriggerAfterClose", "style", "visible", "width", "footer", "classNames", "styles"]), R = n("modal", s), A = n(), j = De(R), [H, I, B] = Ke(R, j), z = T(v, {
847
- [`${R}-centered`]: !!g,
848
- [`${R}-wrap-rtl`]: a === "rtl"
849
- }), L = w !== null && /* @__PURE__ */ r.createElement(Ge, Object.assign({}, e, {
850
- onOk: c,
851
- onCancel: f
852
- })), [W, Z] = _t(h, C, (V) => qe(R, V), /* @__PURE__ */ r.createElement(Fe, {
853
- className: `${R}-close-icon`
854
- }), !0), F = nn(`.${R}-content`), [X, K] = jt("Modal", _.zIndex);
855
- return H(/* @__PURE__ */ r.createElement(Ht, null, /* @__PURE__ */ r.createElement(At, {
856
- status: !0,
857
- override: !0
858
- }, /* @__PURE__ */ r.createElement(zt.Provider, {
859
- value: K
860
- }, /* @__PURE__ */ r.createElement(We, Object.assign({
861
- width: $
862
- }, _, {
863
- zIndex: X,
864
- getContainer: x === void 0 ? o : x,
865
- prefixCls: R,
866
- rootClassName: T(I, i, B, j),
867
- footer: L,
868
- visible: d ?? b,
869
- mousePosition: (t = _.mousePosition) !== null && t !== void 0 ? t : se,
870
- onClose: f,
871
- closable: W,
872
- closeIcon: Z,
873
- focusTriggerAfterClose: p,
874
- transitionName: ne(A, "zoom", e.transitionName),
875
- maskTransitionName: ne(A, "fade", e.maskTransitionName),
876
- className: T(I, u, l == null ? void 0 : l.className),
877
- style: Object.assign(Object.assign({}, l == null ? void 0 : l.style), m),
878
- classNames: Object.assign(Object.assign({
879
- wrapper: z
880
- }, l == null ? void 0 : l.classNames), E),
881
- styles: Object.assign(Object.assign({}, l == null ? void 0 : l.styles), N),
882
- panelRef: F
883
- }))))));
884
- }, Qe = gn, Cn = (e) => {
885
- const {
886
- componentCls: t,
887
- titleFontSize: o,
888
- titleLineHeight: n,
889
- modalConfirmIconSize: a,
890
- fontSize: l,
891
- lineHeight: f,
892
- modalTitleHeight: c,
893
- fontHeight: s,
894
- confirmBodyPadding: u
895
- } = e, i = `${t}-confirm`;
896
- return {
897
- [i]: {
898
- "&-rtl": {
899
- direction: "rtl"
900
- },
901
- [`${e.antCls}-modal-header`]: {
902
- display: "none"
903
- },
904
- [`${i}-body-wrapper`]: Object.assign({}, yt()),
905
- [`&${t} ${t}-body`]: {
906
- padding: u
907
- },
908
- // ====================== Body ======================
909
- [`${i}-body`]: {
910
- display: "flex",
911
- flexWrap: "nowrap",
912
- alignItems: "start",
913
- [`> ${e.iconCls}`]: {
914
- flex: "none",
915
- fontSize: a,
916
- marginInlineEnd: e.confirmIconMarginInlineEnd,
917
- marginTop: e.calc(e.calc(s).sub(a).equal()).div(2).equal()
918
- },
919
- [`&-has-title > ${e.iconCls}`]: {
920
- marginTop: e.calc(e.calc(c).sub(a).equal()).div(2).equal()
921
- }
922
- },
923
- [`${i}-paragraph`]: {
924
- display: "flex",
925
- flexDirection: "column",
926
- flex: "auto",
927
- rowGap: e.marginXS,
928
- maxWidth: `calc(100% - ${S(e.calc(e.modalConfirmIconSize).add(e.marginSM).equal())})`
929
- },
930
- [`${i}-title`]: {
931
- color: e.colorTextHeading,
932
- fontWeight: e.fontWeightStrong,
933
- fontSize: o,
934
- lineHeight: n
935
- },
936
- [`${i}-content`]: {
937
- color: e.colorText,
938
- fontSize: l,
939
- lineHeight: f
940
- },
941
- // ===================== Footer =====================
942
- [`${i}-btns`]: {
943
- textAlign: "end",
944
- marginTop: e.confirmBtnsMarginTop,
945
- [`${e.antCls}-btn + ${e.antCls}-btn`]: {
946
- marginBottom: 0,
947
- marginInlineStart: e.marginXS
948
- }
949
- }
950
- },
951
- [`${i}-error ${i}-body > ${e.iconCls}`]: {
952
- color: e.colorError
953
- },
954
- [`${i}-warning ${i}-body > ${e.iconCls},
955
- ${i}-confirm ${i}-body > ${e.iconCls}`]: {
956
- color: e.colorWarning
957
- },
958
- [`${i}-info ${i}-body > ${e.iconCls}`]: {
959
- color: e.colorInfo
960
- },
961
- [`${i}-success ${i}-body > ${e.iconCls}`]: {
962
- color: e.colorSuccess
963
- }
964
- };
965
- }, vn = bt(["Modal", "confirm"], (e) => {
966
- const t = Ue(e);
967
- return [Cn(t)];
968
- }, Xe, {
969
- // confirm is weak than modal since no conflict here
970
- order: -1e3
971
- });
972
- var pn = function(e, t) {
973
- var o = {};
974
- for (var n in e)
975
- Object.prototype.hasOwnProperty.call(e, n) && t.indexOf(n) < 0 && (o[n] = e[n]);
976
- if (e != null && typeof Object.getOwnPropertySymbols == "function")
977
- for (var a = 0, n = Object.getOwnPropertySymbols(e); a < n.length; a++)
978
- t.indexOf(n[a]) < 0 && Object.prototype.propertyIsEnumerable.call(e, n[a]) && (o[n[a]] = e[n[a]]);
979
- return o;
980
- };
981
- function Ze(e) {
982
- const {
983
- prefixCls: t,
984
- icon: o,
985
- okText: n,
986
- cancelText: a,
987
- confirmPrefixCls: l,
988
- type: f,
989
- okCancel: c,
990
- footer: s,
991
- // Legacy for static function usage
992
- locale: u
993
- } = e, i = pn(e, ["prefixCls", "icon", "okText", "cancelText", "confirmPrefixCls", "type", "okCancel", "footer", "locale"]);
994
- if (process.env.NODE_ENV !== "production") {
995
- const N = de("Modal");
996
- process.env.NODE_ENV !== "production" && N(!(typeof o == "string" && o.length > 2), "breaking", `\`icon\` is using ReactNode instead of string naming in v4. Please check \`${o}\` at https://ant.design/components/icon`);
997
- }
998
- let d = o;
999
- if (!o && o !== null)
1000
- switch (f) {
1001
- case "info":
1002
- d = /* @__PURE__ */ r.createElement(Gt, null);
1003
- break;
1004
- case "success":
1005
- d = /* @__PURE__ */ r.createElement(St, null);
1006
- break;
1007
- case "error":
1008
- d = /* @__PURE__ */ r.createElement(wt, null);
1009
- break;
1010
- default:
1011
- d = /* @__PURE__ */ r.createElement(Pt, null);
1012
- }
1013
- const v = c ?? f === "confirm", g = e.autoFocusButton === null ? !1 : e.autoFocusButton || "ok", [x] = fe("Modal"), C = u || x, h = n || (v ? C == null ? void 0 : C.okText : C == null ? void 0 : C.justOkText), p = a || (C == null ? void 0 : C.cancelText), m = Object.assign({
1014
- autoFocusButton: g,
1015
- cancelTextLocale: p,
1016
- okTextLocale: h,
1017
- mergedOkCancel: v
1018
- }, i), b = r.useMemo(() => m, U(Object.values(m))), $ = /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement(xe, null), /* @__PURE__ */ r.createElement(he, null)), w = e.title !== void 0 && e.title !== null, E = `${l}-body`;
1019
- return /* @__PURE__ */ r.createElement("div", {
1020
- className: `${l}-body-wrapper`
1021
- }, /* @__PURE__ */ r.createElement("div", {
1022
- className: T(E, {
1023
- [`${E}-has-title`]: w
1024
- })
1025
- }, d, /* @__PURE__ */ r.createElement("div", {
1026
- className: `${l}-paragraph`
1027
- }, w && /* @__PURE__ */ r.createElement("span", {
1028
- className: `${l}-title`
1029
- }, e.title), /* @__PURE__ */ r.createElement("div", {
1030
- className: `${l}-content`
1031
- }, e.content))), s === void 0 || typeof s == "function" ? /* @__PURE__ */ r.createElement(He, {
1032
- value: b
1033
- }, /* @__PURE__ */ r.createElement("div", {
1034
- className: `${l}-btns`
1035
- }, typeof s == "function" ? s($, {
1036
- OkBtn: he,
1037
- CancelBtn: xe
1038
- }) : $)) : s, /* @__PURE__ */ r.createElement(vn, {
1039
- prefixCls: t
1040
- }));
1041
- }
1042
- const Ye = (e) => {
1043
- const {
1044
- close: t,
1045
- zIndex: o,
1046
- afterClose: n,
1047
- open: a,
1048
- keyboard: l,
1049
- centered: f,
1050
- getContainer: c,
1051
- maskStyle: s,
1052
- direction: u,
1053
- prefixCls: i,
1054
- wrapClassName: d,
1055
- rootPrefixCls: v,
1056
- bodyStyle: g,
1057
- closable: x = !1,
1058
- closeIcon: C,
1059
- modalRender: h,
1060
- focusTriggerAfterClose: p,
1061
- onConfirm: m,
1062
- styles: b
1063
- } = e;
1064
- if (process.env.NODE_ENV !== "production") {
1065
- const H = de("Modal");
1066
- [["visible", "open"], ["bodyStyle", "styles.body"], ["maskStyle", "styles.mask"]].forEach((I) => {
1067
- let [B, z] = I;
1068
- H.deprecated(!(B in e), B, z);
1069
- });
1070
- }
1071
- const $ = `${i}-confirm`, w = e.width || 416, E = e.style || {}, N = e.mask === void 0 ? !0 : e.mask, _ = e.maskClosable === void 0 ? !1 : e.maskClosable, R = T($, `${$}-${e.type}`, {
1072
- [`${$}-rtl`]: u === "rtl"
1073
- }, e.className), [, A] = xt(), j = r.useMemo(() => o !== void 0 ? o : A.zIndexPopupBase + Ft, [o, A]);
1074
- return /* @__PURE__ */ r.createElement(Qe, {
1075
- prefixCls: i,
1076
- className: R,
1077
- wrapClassName: T({
1078
- [`${$}-centered`]: !!e.centered
1079
- }, d),
1080
- onCancel: () => {
1081
- t == null || t({
1082
- triggerCancel: !0
1083
- }), m == null || m(!1);
1084
- },
1085
- open: a,
1086
- title: "",
1087
- footer: null,
1088
- transitionName: ne(v || "", "zoom", e.transitionName),
1089
- maskTransitionName: ne(v || "", "fade", e.maskTransitionName),
1090
- mask: N,
1091
- maskClosable: _,
1092
- style: E,
1093
- styles: Object.assign({
1094
- body: g,
1095
- mask: s
1096
- }, b),
1097
- width: w,
1098
- zIndex: j,
1099
- afterClose: n,
1100
- keyboard: l,
1101
- centered: f,
1102
- getContainer: c,
1103
- closable: x,
1104
- closeIcon: C,
1105
- modalRender: h,
1106
- focusTriggerAfterClose: p
1107
- }, /* @__PURE__ */ r.createElement(Ze, Object.assign({}, e, {
1108
- confirmPrefixCls: $
1109
- })));
1110
- }, Je = (e) => {
1111
- const {
1112
- rootPrefixCls: t,
1113
- iconPrefixCls: o,
1114
- direction: n,
1115
- theme: a
1116
- } = e;
1117
- return /* @__PURE__ */ r.createElement(Be, {
1118
- prefixCls: t,
1119
- iconPrefixCls: o,
1120
- direction: n,
1121
- theme: a
1122
- }, /* @__PURE__ */ r.createElement(Ye, Object.assign({}, e)));
1123
- };
1124
- process.env.NODE_ENV !== "production" && (Ye.displayName = "ConfirmDialog", Je.displayName = "ConfirmDialogWrapper");
1125
- const ke = Je, Q = [];
1126
- let et = "";
1127
- function bn() {
1128
- return et;
1129
- }
1130
- const yn = (e) => {
1131
- var t, o;
1132
- const {
1133
- prefixCls: n,
1134
- getContainer: a,
1135
- direction: l
1136
- } = e, f = Re(), c = Y(oe), s = n || bn() || c.getPrefixCls(), u = n || `${s}-modal`;
1137
- let i = a;
1138
- return i === !1 && (i = void 0, process.env.NODE_ENV !== "production" && process.env.NODE_ENV !== "production" && Me(!1, "Modal", "Static method not support `getContainer` to be `false` since it do not have context env.")), /* @__PURE__ */ y.createElement(ke, Object.assign({}, e, {
1139
- rootPrefixCls: s,
1140
- prefixCls: u,
1141
- iconPrefixCls: c.iconPrefixCls,
1142
- theme: c.theme,
1143
- direction: l ?? c.direction,
1144
- locale: (o = (t = c.locale) === null || t === void 0 ? void 0 : t.Modal) !== null && o !== void 0 ? o : f,
1145
- getContainer: i
1146
- }));
1147
- };
1148
- function k(e) {
1149
- const t = $t();
1150
- process.env.NODE_ENV !== "production" && !t.holderRender && ht("Modal");
1151
- const o = document.createDocumentFragment();
1152
- let n = Object.assign(Object.assign({}, e), {
1153
- close: c,
1154
- open: !0
1155
- }), a;
1156
- function l() {
1157
- for (var u = arguments.length, i = new Array(u), d = 0; d < u; d++)
1158
- i[d] = arguments[d];
1159
- const v = i.some((g) => g && g.triggerCancel);
1160
- e.onCancel && v && e.onCancel.apply(e, [() => {
1161
- }].concat(U(i.slice(1))));
1162
- for (let g = 0; g < Q.length; g++)
1163
- if (Q[g] === c) {
1164
- Q.splice(g, 1);
1165
- break;
1166
- }
1167
- Nt(o);
1168
- }
1169
- function f(u) {
1170
- clearTimeout(a), a = setTimeout(() => {
1171
- const i = t.getRootPrefixCls(), d = t.getIconPrefixCls(), v = t.getTheme(), g = /* @__PURE__ */ y.createElement(yn, Object.assign({}, u));
1172
- Ot(/* @__PURE__ */ y.createElement(Be, {
1173
- prefixCls: i,
1174
- iconPrefixCls: d,
1175
- theme: v
1176
- }, t.holderRender ? t.holderRender(g) : g), o);
1177
- });
1178
- }
1179
- function c() {
1180
- for (var u = arguments.length, i = new Array(u), d = 0; d < u; d++)
1181
- i[d] = arguments[d];
1182
- n = Object.assign(Object.assign({}, n), {
1183
- open: !1,
1184
- afterClose: () => {
1185
- typeof e.afterClose == "function" && e.afterClose(), l.apply(this, i);
1186
- }
1187
- }), n.visible && delete n.visible, f(n);
1188
- }
1189
- function s(u) {
1190
- typeof u == "function" ? n = u(n) : n = Object.assign(Object.assign({}, n), u), f(n);
1191
- }
1192
- return f(n), Q.push(c), {
1193
- destroy: c,
1194
- update: s
1195
- };
1196
- }
1197
- function tt(e) {
1198
- return Object.assign(Object.assign({}, e), {
1199
- type: "warning"
1200
- });
1201
- }
1202
- function nt(e) {
1203
- return Object.assign(Object.assign({}, e), {
1204
- type: "info"
1205
- });
1206
- }
1207
- function ot(e) {
1208
- return Object.assign(Object.assign({}, e), {
1209
- type: "success"
1210
- });
1211
- }
1212
- function at(e) {
1213
- return Object.assign(Object.assign({}, e), {
1214
- type: "error"
1215
- });
1216
- }
1217
- function rt(e) {
1218
- return Object.assign(Object.assign({}, e), {
1219
- type: "confirm"
1220
- });
1221
- }
1222
- function xn(e) {
1223
- let {
1224
- rootPrefixCls: t
1225
- } = e;
1226
- process.env.NODE_ENV !== "production" && Me(!1, "Modal", "Modal.config is deprecated. Please use ConfigProvider.config instead."), et = t;
1227
- }
1228
- var hn = function(e, t) {
1229
- var o = {};
1230
- for (var n in e)
1231
- Object.prototype.hasOwnProperty.call(e, n) && t.indexOf(n) < 0 && (o[n] = e[n]);
1232
- if (e != null && typeof Object.getOwnPropertySymbols == "function")
1233
- for (var a = 0, n = Object.getOwnPropertySymbols(e); a < n.length; a++)
1234
- t.indexOf(n[a]) < 0 && Object.prototype.propertyIsEnumerable.call(e, n[a]) && (o[n[a]] = e[n[a]]);
1235
- return o;
1236
- };
1237
- const $n = (e, t) => {
1238
- var o, {
1239
- afterClose: n,
1240
- config: a
1241
- } = e, l = hn(e, ["afterClose", "config"]);
1242
- const [f, c] = r.useState(!0), [s, u] = r.useState(a), {
1243
- direction: i,
1244
- getPrefixCls: d
1245
- } = r.useContext(oe), v = d("modal"), g = d(), x = () => {
1246
- var m;
1247
- n(), (m = s.afterClose) === null || m === void 0 || m.call(s);
1248
- }, C = function() {
1249
- c(!1);
1250
- for (var m = arguments.length, b = new Array(m), $ = 0; $ < m; $++)
1251
- b[$] = arguments[$];
1252
- const w = b.some((E) => E && E.triggerCancel);
1253
- s.onCancel && w && s.onCancel.apply(s, [() => {
1254
- }].concat(U(b.slice(1))));
1255
- };
1256
- r.useImperativeHandle(t, () => ({
1257
- destroy: C,
1258
- update: (m) => {
1259
- u((b) => Object.assign(Object.assign({}, b), m));
1260
- }
1261
- }));
1262
- const h = (o = s.okCancel) !== null && o !== void 0 ? o : s.type === "confirm", [p] = fe("Modal", Et.Modal);
1263
- return /* @__PURE__ */ r.createElement(ke, Object.assign({
1264
- prefixCls: v,
1265
- rootPrefixCls: g
1266
- }, s, {
1267
- close: C,
1268
- open: f,
1269
- afterClose: x,
1270
- okText: s.okText || (h ? p == null ? void 0 : p.okText : p == null ? void 0 : p.justOkText),
1271
- direction: s.direction || i,
1272
- cancelText: s.cancelText || (p == null ? void 0 : p.cancelText)
1273
- }, l));
1274
- }, En = /* @__PURE__ */ r.forwardRef($n);
1275
- let Te = 0;
1276
- const Nn = /* @__PURE__ */ r.memo(/* @__PURE__ */ r.forwardRef((e, t) => {
1277
- const [o, n] = Ut();
1278
- return r.useImperativeHandle(t, () => ({
1279
- patchElement: n
1280
- }), []), /* @__PURE__ */ r.createElement(r.Fragment, null, o);
1281
- }));
1282
- function On() {
1283
- const e = r.useRef(null), [t, o] = r.useState([]);
1284
- r.useEffect(() => {
1285
- t.length && (U(t).forEach((f) => {
1286
- f();
1287
- }), o([]));
1288
- }, [t]);
1289
- const n = r.useCallback((l) => function(c) {
1290
- var s;
1291
- Te += 1;
1292
- const u = /* @__PURE__ */ r.createRef();
1293
- let i;
1294
- const d = new Promise((h) => {
1295
- i = h;
1296
- });
1297
- let v = !1, g;
1298
- const x = /* @__PURE__ */ r.createElement(En, {
1299
- key: `modal-${Te}`,
1300
- config: l(c),
1301
- ref: u,
1302
- afterClose: () => {
1303
- g == null || g();
1304
- },
1305
- isSilent: () => v,
1306
- onConfirm: (h) => {
1307
- i(h);
1308
- }
1309
- });
1310
- return g = (s = e.current) === null || s === void 0 ? void 0 : s.patchElement(x), g && Q.push(g), {
1311
- destroy: () => {
1312
- function h() {
1313
- var p;
1314
- (p = u.current) === null || p === void 0 || p.destroy();
1315
- }
1316
- u.current ? h() : o((p) => [].concat(U(p), [h]));
1317
- },
1318
- update: (h) => {
1319
- function p() {
1320
- var m;
1321
- (m = u.current) === null || m === void 0 || m.update(h);
1322
- }
1323
- u.current ? p() : o((m) => [].concat(U(m), [p]));
1324
- },
1325
- then: (h) => (v = !0, d.then(h))
1326
- };
1327
- }, []);
1328
- return [r.useMemo(() => ({
1329
- info: n(nt),
1330
- success: n(ot),
1331
- error: n(at),
1332
- warning: n(tt),
1333
- confirm: n(rt)
1334
- }), []), /* @__PURE__ */ r.createElement(Nn, {
1335
- key: "modal-holder",
1336
- ref: e
1337
- })];
1338
- }
1339
- var Sn = function(e, t) {
1340
- var o = {};
1341
- for (var n in e)
1342
- Object.prototype.hasOwnProperty.call(e, n) && t.indexOf(n) < 0 && (o[n] = e[n]);
1343
- if (e != null && typeof Object.getOwnPropertySymbols == "function")
1344
- for (var a = 0, n = Object.getOwnPropertySymbols(e); a < n.length; a++)
1345
- t.indexOf(n[a]) < 0 && Object.prototype.propertyIsEnumerable.call(e, n[a]) && (o[n[a]] = e[n[a]]);
1346
- return o;
1347
- };
1348
- const wn = (e) => {
1349
- const {
1350
- prefixCls: t,
1351
- className: o,
1352
- closeIcon: n,
1353
- closable: a,
1354
- type: l,
1355
- title: f,
1356
- children: c,
1357
- footer: s
1358
- } = e, u = Sn(e, ["prefixCls", "className", "closeIcon", "closable", "type", "title", "children", "footer"]), {
1359
- getPrefixCls: i
1360
- } = r.useContext(oe), d = i(), v = t || i("modal"), g = De(d), [x, C, h] = Ke(v, g), p = `${v}-confirm`;
1361
- let m = {};
1362
- return l ? m = {
1363
- closable: a ?? !1,
1364
- title: "",
1365
- footer: "",
1366
- children: /* @__PURE__ */ r.createElement(Ze, Object.assign({}, e, {
1367
- prefixCls: v,
1368
- confirmPrefixCls: p,
1369
- rootPrefixCls: d,
1370
- content: c
1371
- }))
1372
- } : m = {
1373
- closable: a ?? !0,
1374
- title: f,
1375
- footer: s !== null && /* @__PURE__ */ r.createElement(Ge, Object.assign({}, e)),
1376
- children: c
1377
- }, x(/* @__PURE__ */ r.createElement(me, Object.assign({
1378
- prefixCls: v,
1379
- className: T(C, `${v}-pure-panel`, l && p, l && `${p}-${l}`, o, h, g)
1380
- }, u, {
1381
- closeIcon: qe(v, n),
1382
- closable: a
1383
- }, m)));
1384
- }, Pn = Vt(wn);
1385
- function lt(e) {
1386
- return k(tt(e));
1387
- }
1388
- const M = Qe;
1389
- M.useModal = On;
1390
- M.info = function(t) {
1391
- return k(nt(t));
1392
- };
1393
- M.success = function(t) {
1394
- return k(ot(t));
1395
- };
1396
- M.error = function(t) {
1397
- return k(at(t));
1398
- };
1399
- M.warning = lt;
1400
- M.warn = lt;
1401
- M.confirm = function(t) {
1402
- return k(rt(t));
1403
- };
1404
- M.destroyAll = function() {
1405
- for (; Q.length; ) {
1406
- const t = Q.pop();
1407
- t && t();
1408
- }
1409
- };
1410
- M.config = xn;
1411
- M._InternalPanelDoNotUseOrYouWillBeFired = Pn;
1412
- process.env.NODE_ENV !== "production" && (M.displayName = "Modal");
1413
- const Zn = M;
1414
- export {
1415
- Zn as M
1416
- };