@notificationapi/react 0.0.16 → 0.0.18

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