@notificationapi/react 0.0.24 → 0.0.25

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