@notificationapi/react 0.0.24 → 0.0.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/AntdIcon.js +200 -0
- package/dist/assets/Notification.js +118 -119
- package/dist/assets/PurePanel.js +69 -0
- package/dist/assets/RightOutlined.js +13 -0
- package/dist/assets/button.js +19 -18
- package/dist/assets/channelUtils.js +77 -0
- package/dist/assets/colors.js +8534 -9304
- package/dist/assets/index.js +16 -15
- package/dist/assets/index2.js +33 -32
- package/dist/assets/index3.js +722 -8531
- package/dist/assets/index4.js +8408 -0
- package/dist/assets/pickAttrs.js +42 -0
- package/dist/components/Notifications/Inbox.d.ts +3 -7
- package/dist/components/Notifications/Inbox.js +6250 -8
- package/dist/components/Notifications/InboxHeader.d.ts +1 -1
- package/dist/components/Notifications/InboxHeader.js +8 -7
- package/dist/components/Notifications/Notification.d.ts +2 -5
- package/dist/components/Notifications/Notification.js +3 -4
- package/dist/components/Notifications/NotificationCounter.d.ts +2 -2
- package/dist/components/Notifications/NotificationFeed.d.ts +4 -5
- package/dist/components/Notifications/NotificationFeed.js +28 -26
- package/dist/components/Notifications/NotificationLauncher.d.ts +1 -6
- package/dist/components/Notifications/NotificationLauncher.js +16 -18
- package/dist/components/Notifications/NotificationPopup.d.ts +5 -9
- package/dist/components/Notifications/NotificationPopup.js +119 -12
- package/dist/components/Notifications/UnreadBadge.d.ts +4 -7
- package/dist/components/Notifications/UnreadBadge.js +8 -10
- package/dist/components/Notifications/index.js +5 -5
- package/dist/components/Notifications/interface.d.ts +46 -0
- package/dist/components/Notifications/interface.js +19 -0
- package/dist/components/Preferences/NotificationPreferencesInline.d.ts +1 -1
- package/dist/components/Preferences/NotificationPreferencesInline.js +1 -1
- package/dist/components/Preferences/NotificationPreferencesPopup.js +1503 -4
- package/dist/components/Preferences/PreferenceInput.d.ts +5 -4
- package/dist/components/Preferences/PreferenceInput.js +1435 -4
- package/dist/components/Preferences/Preferences.d.ts +1 -4
- package/dist/components/Preferences/Preferences.js +579 -8
- package/dist/components/Preferences/channelUtils.d.ts +4 -0
- package/dist/components/Preferences/channelUtils.js +8 -0
- package/dist/components/Preferences/index.js +1 -1
- package/dist/components/Provider/index.d.ts +8 -2
- package/dist/components/Provider/index.js +162 -135
- package/dist/main.d.ts +2 -2
- package/dist/main.js +9 -9
- package/package.json +5 -2
- package/dist/assets/Inbox.js +0 -6363
- package/dist/assets/NotificationPreferencesPopup.js +0 -1562
- package/dist/assets/Preferences.js +0 -2120
|
@@ -1,6 +1,1437 @@
|
|
|
1
|
-
import "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import "../../assets/
|
|
1
|
+
import { jsx as R, Fragment as te, jsxs as q } from "react/jsx-runtime";
|
|
2
|
+
import { g as Oe, a as ze } from "../../assets/channelUtils.js";
|
|
3
|
+
import { u as K, F as Pe, l as ce, W as ue, m as Ne, e as he, C as Me, t as Re, n as je, K as ie, h as De, T as Be } from "../../assets/index4.js";
|
|
4
|
+
import * as s from "react";
|
|
5
|
+
import _e, { forwardRef as Te, useRef as oe, useImperativeHandle as He } from "react";
|
|
6
|
+
import { d as ge, e as be, c as D, h as F, a as pe, _ as re } from "../../assets/index3.js";
|
|
7
|
+
import { g as Z, m as ee, r as W, u as O, p as fe, a as _, o as qe, e as me, D as Ce, l as We, T as Ve } from "../../assets/colors.js";
|
|
8
|
+
import { p as Le } from "../../assets/pickAttrs.js";
|
|
9
|
+
const ve = /* @__PURE__ */ s.createContext(null), Ae = ve.Provider, Se = /* @__PURE__ */ s.createContext(null), Ge = Se.Provider;
|
|
10
|
+
var Fe = ["prefixCls", "className", "style", "checked", "disabled", "defaultChecked", "type", "title", "onChange"], Xe = /* @__PURE__ */ Te(function(e, t) {
|
|
11
|
+
var o = e.prefixCls, n = o === void 0 ? "rc-checkbox" : o, i = e.className, r = e.style, d = e.checked, a = e.disabled, l = e.defaultChecked, c = l === void 0 ? !1 : l, h = e.type, u = h === void 0 ? "checkbox" : h, v = e.title, f = e.onChange, E = ge(e, Fe), p = oe(null), S = oe(null), w = K(c, {
|
|
12
|
+
value: d
|
|
13
|
+
}), m = be(w, 2), $ = m[0], y = m[1];
|
|
14
|
+
He(t, function() {
|
|
15
|
+
return {
|
|
16
|
+
focus: function(b) {
|
|
17
|
+
var k;
|
|
18
|
+
(k = p.current) === null || k === void 0 || k.focus(b);
|
|
19
|
+
},
|
|
20
|
+
blur: function() {
|
|
21
|
+
var b;
|
|
22
|
+
(b = p.current) === null || b === void 0 || b.blur();
|
|
23
|
+
},
|
|
24
|
+
input: p.current,
|
|
25
|
+
nativeElement: S.current
|
|
26
|
+
};
|
|
27
|
+
});
|
|
28
|
+
var x = D(n, i, F(F({}, "".concat(n, "-checked"), $), "".concat(n, "-disabled"), a)), g = function(b) {
|
|
29
|
+
a || ("checked" in e || y(b.target.checked), f == null || f({
|
|
30
|
+
target: re(re({}, e), {}, {
|
|
31
|
+
type: u,
|
|
32
|
+
checked: b.target.checked
|
|
33
|
+
}),
|
|
34
|
+
stopPropagation: function() {
|
|
35
|
+
b.stopPropagation();
|
|
36
|
+
},
|
|
37
|
+
preventDefault: function() {
|
|
38
|
+
b.preventDefault();
|
|
39
|
+
},
|
|
40
|
+
nativeEvent: b.nativeEvent
|
|
41
|
+
}));
|
|
42
|
+
};
|
|
43
|
+
return /* @__PURE__ */ s.createElement("span", {
|
|
44
|
+
className: x,
|
|
45
|
+
title: v,
|
|
46
|
+
style: r,
|
|
47
|
+
ref: S
|
|
48
|
+
}, /* @__PURE__ */ s.createElement("input", pe({}, E, {
|
|
49
|
+
className: "".concat(n, "-input"),
|
|
50
|
+
ref: p,
|
|
51
|
+
onChange: g,
|
|
52
|
+
disabled: a,
|
|
53
|
+
checked: !!$,
|
|
54
|
+
type: u
|
|
55
|
+
})), /* @__PURE__ */ s.createElement("span", {
|
|
56
|
+
className: "".concat(n, "-inner")
|
|
57
|
+
}));
|
|
58
|
+
});
|
|
59
|
+
const Ke = (e) => {
|
|
60
|
+
const {
|
|
61
|
+
componentCls: t,
|
|
62
|
+
antCls: o
|
|
63
|
+
} = e, n = `${t}-group`;
|
|
64
|
+
return {
|
|
65
|
+
[n]: Object.assign(Object.assign({}, W(e)), {
|
|
66
|
+
display: "inline-block",
|
|
67
|
+
fontSize: 0,
|
|
68
|
+
// RTL
|
|
69
|
+
[`&${n}-rtl`]: {
|
|
70
|
+
direction: "rtl"
|
|
71
|
+
},
|
|
72
|
+
[`${o}-badge ${o}-badge-count`]: {
|
|
73
|
+
zIndex: 1
|
|
74
|
+
},
|
|
75
|
+
[`> ${o}-badge:not(:first-child) > ${o}-button-wrapper`]: {
|
|
76
|
+
borderInlineStart: "none"
|
|
77
|
+
}
|
|
78
|
+
})
|
|
79
|
+
};
|
|
80
|
+
}, Ue = (e) => {
|
|
81
|
+
const {
|
|
82
|
+
componentCls: t,
|
|
83
|
+
wrapperMarginInlineEnd: o,
|
|
84
|
+
colorPrimary: n,
|
|
85
|
+
radioSize: i,
|
|
86
|
+
motionDurationSlow: r,
|
|
87
|
+
motionDurationMid: d,
|
|
88
|
+
motionEaseInOutCirc: a,
|
|
89
|
+
colorBgContainer: l,
|
|
90
|
+
colorBorder: c,
|
|
91
|
+
lineWidth: h,
|
|
92
|
+
colorBgContainerDisabled: u,
|
|
93
|
+
colorTextDisabled: v,
|
|
94
|
+
paddingXS: f,
|
|
95
|
+
dotColorDisabled: E,
|
|
96
|
+
lineType: p,
|
|
97
|
+
radioColor: S,
|
|
98
|
+
radioBgColor: w,
|
|
99
|
+
calc: m
|
|
100
|
+
} = e, $ = `${t}-inner`, x = m(i).sub(m(4).mul(2)), g = m(1).mul(i).equal();
|
|
101
|
+
return {
|
|
102
|
+
[`${t}-wrapper`]: Object.assign(Object.assign({}, W(e)), {
|
|
103
|
+
display: "inline-flex",
|
|
104
|
+
alignItems: "baseline",
|
|
105
|
+
marginInlineStart: 0,
|
|
106
|
+
marginInlineEnd: o,
|
|
107
|
+
cursor: "pointer",
|
|
108
|
+
// RTL
|
|
109
|
+
[`&${t}-wrapper-rtl`]: {
|
|
110
|
+
direction: "rtl"
|
|
111
|
+
},
|
|
112
|
+
"&-disabled": {
|
|
113
|
+
cursor: "not-allowed",
|
|
114
|
+
color: e.colorTextDisabled
|
|
115
|
+
},
|
|
116
|
+
"&::after": {
|
|
117
|
+
display: "inline-block",
|
|
118
|
+
width: 0,
|
|
119
|
+
overflow: "hidden",
|
|
120
|
+
content: '"\\a0"'
|
|
121
|
+
},
|
|
122
|
+
// hashId 在 wrapper 上,只能铺平
|
|
123
|
+
[`${t}-checked::after`]: {
|
|
124
|
+
position: "absolute",
|
|
125
|
+
insetBlockStart: 0,
|
|
126
|
+
insetInlineStart: 0,
|
|
127
|
+
width: "100%",
|
|
128
|
+
height: "100%",
|
|
129
|
+
border: `${O(h)} ${p} ${n}`,
|
|
130
|
+
borderRadius: "50%",
|
|
131
|
+
visibility: "hidden",
|
|
132
|
+
opacity: 0,
|
|
133
|
+
content: '""'
|
|
134
|
+
},
|
|
135
|
+
[t]: Object.assign(Object.assign({}, W(e)), {
|
|
136
|
+
position: "relative",
|
|
137
|
+
display: "inline-block",
|
|
138
|
+
outline: "none",
|
|
139
|
+
cursor: "pointer",
|
|
140
|
+
alignSelf: "center",
|
|
141
|
+
borderRadius: "50%"
|
|
142
|
+
}),
|
|
143
|
+
[`${t}-wrapper:hover &,
|
|
144
|
+
&:hover ${$}`]: {
|
|
145
|
+
borderColor: n
|
|
146
|
+
},
|
|
147
|
+
[`${t}-input:focus-visible + ${$}`]: Object.assign({}, fe(e)),
|
|
148
|
+
[`${t}:hover::after, ${t}-wrapper:hover &::after`]: {
|
|
149
|
+
visibility: "visible"
|
|
150
|
+
},
|
|
151
|
+
[`${t}-inner`]: {
|
|
152
|
+
"&::after": {
|
|
153
|
+
boxSizing: "border-box",
|
|
154
|
+
position: "absolute",
|
|
155
|
+
insetBlockStart: "50%",
|
|
156
|
+
insetInlineStart: "50%",
|
|
157
|
+
display: "block",
|
|
158
|
+
width: g,
|
|
159
|
+
height: g,
|
|
160
|
+
marginBlockStart: m(1).mul(i).div(-2).equal(),
|
|
161
|
+
marginInlineStart: m(1).mul(i).div(-2).equal(),
|
|
162
|
+
backgroundColor: S,
|
|
163
|
+
borderBlockStart: 0,
|
|
164
|
+
borderInlineStart: 0,
|
|
165
|
+
borderRadius: g,
|
|
166
|
+
transform: "scale(0)",
|
|
167
|
+
opacity: 0,
|
|
168
|
+
transition: `all ${r} ${a}`,
|
|
169
|
+
content: '""'
|
|
170
|
+
},
|
|
171
|
+
boxSizing: "border-box",
|
|
172
|
+
position: "relative",
|
|
173
|
+
insetBlockStart: 0,
|
|
174
|
+
insetInlineStart: 0,
|
|
175
|
+
display: "block",
|
|
176
|
+
width: g,
|
|
177
|
+
height: g,
|
|
178
|
+
backgroundColor: l,
|
|
179
|
+
borderColor: c,
|
|
180
|
+
borderStyle: "solid",
|
|
181
|
+
borderWidth: h,
|
|
182
|
+
borderRadius: "50%",
|
|
183
|
+
transition: `all ${d}`
|
|
184
|
+
},
|
|
185
|
+
[`${t}-input`]: {
|
|
186
|
+
position: "absolute",
|
|
187
|
+
inset: 0,
|
|
188
|
+
zIndex: 1,
|
|
189
|
+
cursor: "pointer",
|
|
190
|
+
opacity: 0
|
|
191
|
+
},
|
|
192
|
+
// 选中状态
|
|
193
|
+
[`${t}-checked`]: {
|
|
194
|
+
[$]: {
|
|
195
|
+
borderColor: n,
|
|
196
|
+
backgroundColor: w,
|
|
197
|
+
"&::after": {
|
|
198
|
+
transform: `scale(${e.calc(e.dotSize).div(i).equal()})`,
|
|
199
|
+
opacity: 1,
|
|
200
|
+
transition: `all ${r} ${a}`
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
[`${t}-disabled`]: {
|
|
205
|
+
cursor: "not-allowed",
|
|
206
|
+
[$]: {
|
|
207
|
+
backgroundColor: u,
|
|
208
|
+
borderColor: c,
|
|
209
|
+
cursor: "not-allowed",
|
|
210
|
+
"&::after": {
|
|
211
|
+
backgroundColor: E
|
|
212
|
+
}
|
|
213
|
+
},
|
|
214
|
+
[`${t}-input`]: {
|
|
215
|
+
cursor: "not-allowed"
|
|
216
|
+
},
|
|
217
|
+
[`${t}-disabled + span`]: {
|
|
218
|
+
color: v,
|
|
219
|
+
cursor: "not-allowed"
|
|
220
|
+
},
|
|
221
|
+
[`&${t}-checked`]: {
|
|
222
|
+
[$]: {
|
|
223
|
+
"&::after": {
|
|
224
|
+
transform: `scale(${m(x).div(i).equal({
|
|
225
|
+
unit: !1
|
|
226
|
+
})})`
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
},
|
|
231
|
+
[`span${t} + *`]: {
|
|
232
|
+
paddingInlineStart: f,
|
|
233
|
+
paddingInlineEnd: f
|
|
234
|
+
}
|
|
235
|
+
})
|
|
236
|
+
};
|
|
237
|
+
}, Qe = (e) => {
|
|
238
|
+
const {
|
|
239
|
+
buttonColor: t,
|
|
240
|
+
controlHeight: o,
|
|
241
|
+
componentCls: n,
|
|
242
|
+
lineWidth: i,
|
|
243
|
+
lineType: r,
|
|
244
|
+
colorBorder: d,
|
|
245
|
+
motionDurationSlow: a,
|
|
246
|
+
motionDurationMid: l,
|
|
247
|
+
buttonPaddingInline: c,
|
|
248
|
+
fontSize: h,
|
|
249
|
+
buttonBg: u,
|
|
250
|
+
fontSizeLG: v,
|
|
251
|
+
controlHeightLG: f,
|
|
252
|
+
controlHeightSM: E,
|
|
253
|
+
paddingXS: p,
|
|
254
|
+
borderRadius: S,
|
|
255
|
+
borderRadiusSM: w,
|
|
256
|
+
borderRadiusLG: m,
|
|
257
|
+
buttonCheckedBg: $,
|
|
258
|
+
buttonSolidCheckedColor: y,
|
|
259
|
+
colorTextDisabled: x,
|
|
260
|
+
colorBgContainerDisabled: g,
|
|
261
|
+
buttonCheckedBgDisabled: z,
|
|
262
|
+
buttonCheckedColorDisabled: b,
|
|
263
|
+
colorPrimary: k,
|
|
264
|
+
colorPrimaryHover: P,
|
|
265
|
+
colorPrimaryActive: I,
|
|
266
|
+
buttonSolidCheckedBg: N,
|
|
267
|
+
buttonSolidCheckedHoverBg: j,
|
|
268
|
+
buttonSolidCheckedActiveBg: C,
|
|
269
|
+
calc: M
|
|
270
|
+
} = e;
|
|
271
|
+
return {
|
|
272
|
+
[`${n}-button-wrapper`]: {
|
|
273
|
+
position: "relative",
|
|
274
|
+
display: "inline-block",
|
|
275
|
+
height: o,
|
|
276
|
+
margin: 0,
|
|
277
|
+
paddingInline: c,
|
|
278
|
+
paddingBlock: 0,
|
|
279
|
+
color: t,
|
|
280
|
+
fontSize: h,
|
|
281
|
+
lineHeight: O(M(o).sub(M(i).mul(2)).equal()),
|
|
282
|
+
background: u,
|
|
283
|
+
border: `${O(i)} ${r} ${d}`,
|
|
284
|
+
// strange align fix for chrome but works
|
|
285
|
+
// https://gw.alipayobjects.com/zos/rmsportal/VFTfKXJuogBAXcvfAUWJ.gif
|
|
286
|
+
borderBlockStartWidth: M(i).add(0.02).equal(),
|
|
287
|
+
borderInlineStartWidth: 0,
|
|
288
|
+
borderInlineEndWidth: i,
|
|
289
|
+
cursor: "pointer",
|
|
290
|
+
transition: [`color ${l}`, `background ${l}`, `box-shadow ${l}`].join(","),
|
|
291
|
+
a: {
|
|
292
|
+
color: t
|
|
293
|
+
},
|
|
294
|
+
[`> ${n}-button`]: {
|
|
295
|
+
position: "absolute",
|
|
296
|
+
insetBlockStart: 0,
|
|
297
|
+
insetInlineStart: 0,
|
|
298
|
+
zIndex: -1,
|
|
299
|
+
width: "100%",
|
|
300
|
+
height: "100%"
|
|
301
|
+
},
|
|
302
|
+
"&:not(:first-child)": {
|
|
303
|
+
"&::before": {
|
|
304
|
+
position: "absolute",
|
|
305
|
+
insetBlockStart: M(i).mul(-1).equal(),
|
|
306
|
+
insetInlineStart: M(i).mul(-1).equal(),
|
|
307
|
+
display: "block",
|
|
308
|
+
boxSizing: "content-box",
|
|
309
|
+
width: 1,
|
|
310
|
+
height: "100%",
|
|
311
|
+
paddingBlock: i,
|
|
312
|
+
paddingInline: 0,
|
|
313
|
+
backgroundColor: d,
|
|
314
|
+
transition: `background-color ${a}`,
|
|
315
|
+
content: '""'
|
|
316
|
+
}
|
|
317
|
+
},
|
|
318
|
+
"&:first-child": {
|
|
319
|
+
borderInlineStart: `${O(i)} ${r} ${d}`,
|
|
320
|
+
borderStartStartRadius: S,
|
|
321
|
+
borderEndStartRadius: S
|
|
322
|
+
},
|
|
323
|
+
"&:last-child": {
|
|
324
|
+
borderStartEndRadius: S,
|
|
325
|
+
borderEndEndRadius: S
|
|
326
|
+
},
|
|
327
|
+
"&:first-child:last-child": {
|
|
328
|
+
borderRadius: S
|
|
329
|
+
},
|
|
330
|
+
[`${n}-group-large &`]: {
|
|
331
|
+
height: f,
|
|
332
|
+
fontSize: v,
|
|
333
|
+
lineHeight: O(M(f).sub(M(i).mul(2)).equal()),
|
|
334
|
+
"&:first-child": {
|
|
335
|
+
borderStartStartRadius: m,
|
|
336
|
+
borderEndStartRadius: m
|
|
337
|
+
},
|
|
338
|
+
"&:last-child": {
|
|
339
|
+
borderStartEndRadius: m,
|
|
340
|
+
borderEndEndRadius: m
|
|
341
|
+
}
|
|
342
|
+
},
|
|
343
|
+
[`${n}-group-small &`]: {
|
|
344
|
+
height: E,
|
|
345
|
+
paddingInline: M(p).sub(i).equal(),
|
|
346
|
+
paddingBlock: 0,
|
|
347
|
+
lineHeight: O(M(E).sub(M(i).mul(2)).equal()),
|
|
348
|
+
"&:first-child": {
|
|
349
|
+
borderStartStartRadius: w,
|
|
350
|
+
borderEndStartRadius: w
|
|
351
|
+
},
|
|
352
|
+
"&:last-child": {
|
|
353
|
+
borderStartEndRadius: w,
|
|
354
|
+
borderEndEndRadius: w
|
|
355
|
+
}
|
|
356
|
+
},
|
|
357
|
+
"&:hover": {
|
|
358
|
+
position: "relative",
|
|
359
|
+
color: k
|
|
360
|
+
},
|
|
361
|
+
"&:has(:focus-visible)": Object.assign({}, fe(e)),
|
|
362
|
+
[`${n}-inner, input[type='checkbox'], input[type='radio']`]: {
|
|
363
|
+
width: 0,
|
|
364
|
+
height: 0,
|
|
365
|
+
opacity: 0,
|
|
366
|
+
pointerEvents: "none"
|
|
367
|
+
},
|
|
368
|
+
[`&-checked:not(${n}-button-wrapper-disabled)`]: {
|
|
369
|
+
zIndex: 1,
|
|
370
|
+
color: k,
|
|
371
|
+
background: $,
|
|
372
|
+
borderColor: k,
|
|
373
|
+
"&::before": {
|
|
374
|
+
backgroundColor: k
|
|
375
|
+
},
|
|
376
|
+
"&:first-child": {
|
|
377
|
+
borderColor: k
|
|
378
|
+
},
|
|
379
|
+
"&:hover": {
|
|
380
|
+
color: P,
|
|
381
|
+
borderColor: P,
|
|
382
|
+
"&::before": {
|
|
383
|
+
backgroundColor: P
|
|
384
|
+
}
|
|
385
|
+
},
|
|
386
|
+
"&:active": {
|
|
387
|
+
color: I,
|
|
388
|
+
borderColor: I,
|
|
389
|
+
"&::before": {
|
|
390
|
+
backgroundColor: I
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
},
|
|
394
|
+
[`${n}-group-solid &-checked:not(${n}-button-wrapper-disabled)`]: {
|
|
395
|
+
color: y,
|
|
396
|
+
background: N,
|
|
397
|
+
borderColor: N,
|
|
398
|
+
"&:hover": {
|
|
399
|
+
color: y,
|
|
400
|
+
background: j,
|
|
401
|
+
borderColor: j
|
|
402
|
+
},
|
|
403
|
+
"&:active": {
|
|
404
|
+
color: y,
|
|
405
|
+
background: C,
|
|
406
|
+
borderColor: C
|
|
407
|
+
}
|
|
408
|
+
},
|
|
409
|
+
"&-disabled": {
|
|
410
|
+
color: x,
|
|
411
|
+
backgroundColor: g,
|
|
412
|
+
borderColor: d,
|
|
413
|
+
cursor: "not-allowed",
|
|
414
|
+
"&:first-child, &:hover": {
|
|
415
|
+
color: x,
|
|
416
|
+
backgroundColor: g,
|
|
417
|
+
borderColor: d
|
|
418
|
+
}
|
|
419
|
+
},
|
|
420
|
+
[`&-disabled${n}-button-wrapper-checked`]: {
|
|
421
|
+
color: b,
|
|
422
|
+
backgroundColor: z,
|
|
423
|
+
borderColor: d,
|
|
424
|
+
boxShadow: "none"
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
};
|
|
428
|
+
}, Ye = (e) => {
|
|
429
|
+
const {
|
|
430
|
+
wireframe: t,
|
|
431
|
+
padding: o,
|
|
432
|
+
marginXS: n,
|
|
433
|
+
lineWidth: i,
|
|
434
|
+
fontSizeLG: r,
|
|
435
|
+
colorText: d,
|
|
436
|
+
colorBgContainer: a,
|
|
437
|
+
colorTextDisabled: l,
|
|
438
|
+
controlItemBgActiveDisabled: c,
|
|
439
|
+
colorTextLightSolid: h,
|
|
440
|
+
colorPrimary: u,
|
|
441
|
+
colorPrimaryHover: v,
|
|
442
|
+
colorPrimaryActive: f,
|
|
443
|
+
colorWhite: E
|
|
444
|
+
} = e, p = 4, S = r, w = t ? S - p * 2 : S - (p + i) * 2;
|
|
445
|
+
return {
|
|
446
|
+
// Radio
|
|
447
|
+
radioSize: S,
|
|
448
|
+
dotSize: w,
|
|
449
|
+
dotColorDisabled: l,
|
|
450
|
+
// Radio buttons
|
|
451
|
+
buttonSolidCheckedColor: h,
|
|
452
|
+
buttonSolidCheckedBg: u,
|
|
453
|
+
buttonSolidCheckedHoverBg: v,
|
|
454
|
+
buttonSolidCheckedActiveBg: f,
|
|
455
|
+
buttonBg: a,
|
|
456
|
+
buttonCheckedBg: a,
|
|
457
|
+
buttonColor: d,
|
|
458
|
+
buttonCheckedBgDisabled: c,
|
|
459
|
+
buttonCheckedColorDisabled: l,
|
|
460
|
+
buttonPaddingInline: o - i,
|
|
461
|
+
wrapperMarginInlineEnd: n,
|
|
462
|
+
// internal
|
|
463
|
+
radioColor: t ? u : E,
|
|
464
|
+
radioBgColor: t ? a : u
|
|
465
|
+
};
|
|
466
|
+
}, $e = Z("Radio", (e) => {
|
|
467
|
+
const {
|
|
468
|
+
controlOutline: t,
|
|
469
|
+
controlOutlineWidth: o
|
|
470
|
+
} = e, n = `0 0 0 ${O(o)} ${t}`, r = ee(e, {
|
|
471
|
+
radioFocusShadow: n,
|
|
472
|
+
radioButtonFocusShadow: n
|
|
473
|
+
});
|
|
474
|
+
return [Ke(r), Ue(r), Qe(r)];
|
|
475
|
+
}, Ye, {
|
|
476
|
+
unitless: {
|
|
477
|
+
radioSize: !0,
|
|
478
|
+
dotSize: !0
|
|
479
|
+
}
|
|
480
|
+
});
|
|
481
|
+
var Je = function(e, t) {
|
|
482
|
+
var o = {};
|
|
483
|
+
for (var n in e)
|
|
484
|
+
Object.prototype.hasOwnProperty.call(e, n) && t.indexOf(n) < 0 && (o[n] = e[n]);
|
|
485
|
+
if (e != null && typeof Object.getOwnPropertySymbols == "function")
|
|
486
|
+
for (var i = 0, n = Object.getOwnPropertySymbols(e); i < n.length; i++)
|
|
487
|
+
t.indexOf(n[i]) < 0 && Object.prototype.propertyIsEnumerable.call(e, n[i]) && (o[n[i]] = e[n[i]]);
|
|
488
|
+
return o;
|
|
489
|
+
};
|
|
490
|
+
const Ze = (e, t) => {
|
|
491
|
+
var o, n;
|
|
492
|
+
const i = s.useContext(ve), r = s.useContext(Se), {
|
|
493
|
+
getPrefixCls: d,
|
|
494
|
+
direction: a,
|
|
495
|
+
radio: l
|
|
496
|
+
} = s.useContext(_), c = s.useRef(null), h = qe(t, c), {
|
|
497
|
+
isFormItemInput: u
|
|
498
|
+
} = s.useContext(Pe);
|
|
499
|
+
if (process.env.NODE_ENV !== "production") {
|
|
500
|
+
const C = me("Radio");
|
|
501
|
+
process.env.NODE_ENV !== "production" && C(!("optionType" in e), "usage", "`optionType` is only support in Radio.Group.");
|
|
502
|
+
}
|
|
503
|
+
const v = (C) => {
|
|
504
|
+
var M, B;
|
|
505
|
+
(M = e.onChange) === null || M === void 0 || M.call(e, C), (B = i == null ? void 0 : i.onChange) === null || B === void 0 || B.call(i, C);
|
|
506
|
+
}, {
|
|
507
|
+
prefixCls: f,
|
|
508
|
+
className: E,
|
|
509
|
+
rootClassName: p,
|
|
510
|
+
children: S,
|
|
511
|
+
style: w,
|
|
512
|
+
title: m
|
|
513
|
+
} = e, $ = Je(e, ["prefixCls", "className", "rootClassName", "children", "style", "title"]), y = d("radio", f), x = ((i == null ? void 0 : i.optionType) || r) === "button", g = x ? `${y}-button` : y, z = ce(y), [b, k, P] = $e(y, z), I = Object.assign({}, $), N = s.useContext(Ce);
|
|
514
|
+
i && (I.name = i.name, I.onChange = v, I.checked = e.value === i.value, I.disabled = (o = I.disabled) !== null && o !== void 0 ? o : i.disabled), I.disabled = (n = I.disabled) !== null && n !== void 0 ? n : N;
|
|
515
|
+
const j = D(`${g}-wrapper`, {
|
|
516
|
+
[`${g}-wrapper-checked`]: I.checked,
|
|
517
|
+
[`${g}-wrapper-disabled`]: I.disabled,
|
|
518
|
+
[`${g}-wrapper-rtl`]: a === "rtl",
|
|
519
|
+
[`${g}-wrapper-in-form-item`]: u
|
|
520
|
+
}, l == null ? void 0 : l.className, E, p, k, P, z);
|
|
521
|
+
return b(/* @__PURE__ */ s.createElement(ue, {
|
|
522
|
+
component: "Radio",
|
|
523
|
+
disabled: I.disabled
|
|
524
|
+
}, /* @__PURE__ */ s.createElement("label", {
|
|
525
|
+
className: j,
|
|
526
|
+
style: Object.assign(Object.assign({}, l == null ? void 0 : l.style), w),
|
|
527
|
+
onMouseEnter: e.onMouseEnter,
|
|
528
|
+
onMouseLeave: e.onMouseLeave,
|
|
529
|
+
title: m
|
|
530
|
+
}, /* @__PURE__ */ s.createElement(Xe, Object.assign({}, I, {
|
|
531
|
+
className: D(I.className, !x && Ne),
|
|
532
|
+
type: "radio",
|
|
533
|
+
prefixCls: g,
|
|
534
|
+
ref: h
|
|
535
|
+
})), S !== void 0 ? /* @__PURE__ */ s.createElement("span", null, S) : null)));
|
|
536
|
+
}, V = /* @__PURE__ */ s.forwardRef(Ze);
|
|
537
|
+
process.env.NODE_ENV !== "production" && (V.displayName = "Radio");
|
|
538
|
+
const en = /* @__PURE__ */ s.forwardRef((e, t) => {
|
|
539
|
+
const {
|
|
540
|
+
getPrefixCls: o,
|
|
541
|
+
direction: n
|
|
542
|
+
} = s.useContext(_), [i, r] = K(e.defaultValue, {
|
|
543
|
+
value: e.value
|
|
544
|
+
}), d = (C) => {
|
|
545
|
+
const M = i, B = C.target.value;
|
|
546
|
+
"value" in e || r(B);
|
|
547
|
+
const {
|
|
548
|
+
onChange: T
|
|
549
|
+
} = e;
|
|
550
|
+
T && B !== M && T(C);
|
|
551
|
+
}, {
|
|
552
|
+
prefixCls: a,
|
|
553
|
+
className: l,
|
|
554
|
+
rootClassName: c,
|
|
555
|
+
options: h,
|
|
556
|
+
buttonStyle: u = "outline",
|
|
557
|
+
disabled: v,
|
|
558
|
+
children: f,
|
|
559
|
+
size: E,
|
|
560
|
+
style: p,
|
|
561
|
+
id: S,
|
|
562
|
+
onMouseEnter: w,
|
|
563
|
+
onMouseLeave: m,
|
|
564
|
+
onFocus: $,
|
|
565
|
+
onBlur: y
|
|
566
|
+
} = e, x = o("radio", a), g = `${x}-group`, z = ce(x), [b, k, P] = $e(x, z);
|
|
567
|
+
let I = f;
|
|
568
|
+
h && h.length > 0 && (I = h.map((C) => typeof C == "string" || typeof C == "number" ? /* @__PURE__ */ s.createElement(V, {
|
|
569
|
+
key: C.toString(),
|
|
570
|
+
prefixCls: x,
|
|
571
|
+
disabled: v,
|
|
572
|
+
value: C,
|
|
573
|
+
checked: i === C
|
|
574
|
+
}, C) : /* @__PURE__ */ s.createElement(V, {
|
|
575
|
+
key: `radio-group-value-options-${C.value}`,
|
|
576
|
+
prefixCls: x,
|
|
577
|
+
disabled: C.disabled || v,
|
|
578
|
+
value: C.value,
|
|
579
|
+
checked: i === C.value,
|
|
580
|
+
title: C.title,
|
|
581
|
+
style: C.style,
|
|
582
|
+
id: C.id,
|
|
583
|
+
required: C.required
|
|
584
|
+
}, C.label)));
|
|
585
|
+
const N = he(E), j = D(g, `${g}-${u}`, {
|
|
586
|
+
[`${g}-${N}`]: N,
|
|
587
|
+
[`${g}-rtl`]: n === "rtl"
|
|
588
|
+
}, l, c, k, P, z);
|
|
589
|
+
return b(/* @__PURE__ */ s.createElement("div", Object.assign({}, Le(e, {
|
|
590
|
+
aria: !0,
|
|
591
|
+
data: !0
|
|
592
|
+
}), {
|
|
593
|
+
className: j,
|
|
594
|
+
style: p,
|
|
595
|
+
onMouseEnter: w,
|
|
596
|
+
onMouseLeave: m,
|
|
597
|
+
onFocus: $,
|
|
598
|
+
onBlur: y,
|
|
599
|
+
id: S,
|
|
600
|
+
ref: t
|
|
601
|
+
}), /* @__PURE__ */ s.createElement(Ae, {
|
|
602
|
+
value: {
|
|
603
|
+
onChange: d,
|
|
604
|
+
value: i,
|
|
605
|
+
disabled: e.disabled,
|
|
606
|
+
name: e.name,
|
|
607
|
+
optionType: e.optionType
|
|
608
|
+
}
|
|
609
|
+
}, I)));
|
|
610
|
+
}), nn = /* @__PURE__ */ s.memo(en);
|
|
611
|
+
var tn = function(e, t) {
|
|
612
|
+
var o = {};
|
|
613
|
+
for (var n in e)
|
|
614
|
+
Object.prototype.hasOwnProperty.call(e, n) && t.indexOf(n) < 0 && (o[n] = e[n]);
|
|
615
|
+
if (e != null && typeof Object.getOwnPropertySymbols == "function")
|
|
616
|
+
for (var i = 0, n = Object.getOwnPropertySymbols(e); i < n.length; i++)
|
|
617
|
+
t.indexOf(n[i]) < 0 && Object.prototype.propertyIsEnumerable.call(e, n[i]) && (o[n[i]] = e[n[i]]);
|
|
618
|
+
return o;
|
|
619
|
+
};
|
|
620
|
+
const on = (e, t) => {
|
|
621
|
+
const {
|
|
622
|
+
getPrefixCls: o
|
|
623
|
+
} = s.useContext(_), {
|
|
624
|
+
prefixCls: n
|
|
625
|
+
} = e, i = tn(e, ["prefixCls"]), r = o("radio", n);
|
|
626
|
+
return /* @__PURE__ */ s.createElement(Ge, {
|
|
627
|
+
value: "button"
|
|
628
|
+
}, /* @__PURE__ */ s.createElement(V, Object.assign({
|
|
629
|
+
prefixCls: r
|
|
630
|
+
}, i, {
|
|
631
|
+
type: "radio",
|
|
632
|
+
ref: t
|
|
633
|
+
})));
|
|
634
|
+
}, rn = /* @__PURE__ */ s.forwardRef(on), L = V;
|
|
635
|
+
L.Button = rn;
|
|
636
|
+
L.Group = nn;
|
|
637
|
+
L.__ANT_RADIO = !0;
|
|
638
|
+
const an = (e) => {
|
|
639
|
+
const {
|
|
640
|
+
componentCls: t,
|
|
641
|
+
sizePaddingEdgeHorizontal: o,
|
|
642
|
+
colorSplit: n,
|
|
643
|
+
lineWidth: i,
|
|
644
|
+
textPaddingInline: r,
|
|
645
|
+
orientationMargin: d,
|
|
646
|
+
verticalMarginInline: a
|
|
647
|
+
} = e;
|
|
648
|
+
return {
|
|
649
|
+
[t]: Object.assign(Object.assign({}, W(e)), {
|
|
650
|
+
borderBlockStart: `${O(i)} solid ${n}`,
|
|
651
|
+
// vertical
|
|
652
|
+
"&-vertical": {
|
|
653
|
+
position: "relative",
|
|
654
|
+
top: "-0.06em",
|
|
655
|
+
display: "inline-block",
|
|
656
|
+
height: "0.9em",
|
|
657
|
+
marginInline: a,
|
|
658
|
+
marginBlock: 0,
|
|
659
|
+
verticalAlign: "middle",
|
|
660
|
+
borderTop: 0,
|
|
661
|
+
borderInlineStart: `${O(i)} solid ${n}`
|
|
662
|
+
},
|
|
663
|
+
"&-horizontal": {
|
|
664
|
+
display: "flex",
|
|
665
|
+
clear: "both",
|
|
666
|
+
width: "100%",
|
|
667
|
+
minWidth: "100%",
|
|
668
|
+
// Fix https://github.com/ant-design/ant-design/issues/10914
|
|
669
|
+
margin: `${O(e.dividerHorizontalGutterMargin)} 0`
|
|
670
|
+
},
|
|
671
|
+
[`&-horizontal${t}-with-text`]: {
|
|
672
|
+
display: "flex",
|
|
673
|
+
alignItems: "center",
|
|
674
|
+
margin: `${O(e.dividerHorizontalWithTextGutterMargin)} 0`,
|
|
675
|
+
color: e.colorTextHeading,
|
|
676
|
+
fontWeight: 500,
|
|
677
|
+
fontSize: e.fontSizeLG,
|
|
678
|
+
whiteSpace: "nowrap",
|
|
679
|
+
textAlign: "center",
|
|
680
|
+
borderBlockStart: `0 ${n}`,
|
|
681
|
+
"&::before, &::after": {
|
|
682
|
+
position: "relative",
|
|
683
|
+
width: "50%",
|
|
684
|
+
borderBlockStart: `${O(i)} solid transparent`,
|
|
685
|
+
// Chrome not accept `inherit` in `border-top`
|
|
686
|
+
borderBlockStartColor: "inherit",
|
|
687
|
+
borderBlockEnd: 0,
|
|
688
|
+
transform: "translateY(50%)",
|
|
689
|
+
content: "''"
|
|
690
|
+
}
|
|
691
|
+
},
|
|
692
|
+
[`&-horizontal${t}-with-text-left`]: {
|
|
693
|
+
"&::before": {
|
|
694
|
+
width: `calc(${d} * 100%)`
|
|
695
|
+
},
|
|
696
|
+
"&::after": {
|
|
697
|
+
width: `calc(100% - ${d} * 100%)`
|
|
698
|
+
}
|
|
699
|
+
},
|
|
700
|
+
[`&-horizontal${t}-with-text-right`]: {
|
|
701
|
+
"&::before": {
|
|
702
|
+
width: `calc(100% - ${d} * 100%)`
|
|
703
|
+
},
|
|
704
|
+
"&::after": {
|
|
705
|
+
width: `calc(${d} * 100%)`
|
|
706
|
+
}
|
|
707
|
+
},
|
|
708
|
+
[`${t}-inner-text`]: {
|
|
709
|
+
display: "inline-block",
|
|
710
|
+
paddingBlock: 0,
|
|
711
|
+
paddingInline: r
|
|
712
|
+
},
|
|
713
|
+
"&-dashed": {
|
|
714
|
+
background: "none",
|
|
715
|
+
borderColor: n,
|
|
716
|
+
borderStyle: "dashed",
|
|
717
|
+
borderWidth: `${O(i)} 0 0`
|
|
718
|
+
},
|
|
719
|
+
[`&-horizontal${t}-with-text${t}-dashed`]: {
|
|
720
|
+
"&::before, &::after": {
|
|
721
|
+
borderStyle: "dashed none none"
|
|
722
|
+
}
|
|
723
|
+
},
|
|
724
|
+
[`&-vertical${t}-dashed`]: {
|
|
725
|
+
borderInlineStartWidth: i,
|
|
726
|
+
borderInlineEnd: 0,
|
|
727
|
+
borderBlockStart: 0,
|
|
728
|
+
borderBlockEnd: 0
|
|
729
|
+
},
|
|
730
|
+
[`&-plain${t}-with-text`]: {
|
|
731
|
+
color: e.colorText,
|
|
732
|
+
fontWeight: "normal",
|
|
733
|
+
fontSize: e.fontSize
|
|
734
|
+
},
|
|
735
|
+
[`&-horizontal${t}-with-text-left${t}-no-default-orientation-margin-left`]: {
|
|
736
|
+
"&::before": {
|
|
737
|
+
width: 0
|
|
738
|
+
},
|
|
739
|
+
"&::after": {
|
|
740
|
+
width: "100%"
|
|
741
|
+
},
|
|
742
|
+
[`${t}-inner-text`]: {
|
|
743
|
+
paddingInlineStart: o
|
|
744
|
+
}
|
|
745
|
+
},
|
|
746
|
+
[`&-horizontal${t}-with-text-right${t}-no-default-orientation-margin-right`]: {
|
|
747
|
+
"&::before": {
|
|
748
|
+
width: "100%"
|
|
749
|
+
},
|
|
750
|
+
"&::after": {
|
|
751
|
+
width: 0
|
|
752
|
+
},
|
|
753
|
+
[`${t}-inner-text`]: {
|
|
754
|
+
paddingInlineEnd: o
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
})
|
|
758
|
+
};
|
|
759
|
+
}, ln = (e) => ({
|
|
760
|
+
textPaddingInline: "1em",
|
|
761
|
+
orientationMargin: 0.05,
|
|
762
|
+
verticalMarginInline: e.marginXS
|
|
763
|
+
}), dn = Z("Divider", (e) => {
|
|
764
|
+
const t = ee(e, {
|
|
765
|
+
dividerHorizontalWithTextGutterMargin: e.margin,
|
|
766
|
+
dividerHorizontalGutterMargin: e.marginLG,
|
|
767
|
+
sizePaddingEdgeHorizontal: 0
|
|
768
|
+
});
|
|
769
|
+
return [an(t)];
|
|
770
|
+
}, ln, {
|
|
771
|
+
unitless: {
|
|
772
|
+
orientationMargin: !0
|
|
773
|
+
}
|
|
774
|
+
});
|
|
775
|
+
var sn = function(e, t) {
|
|
776
|
+
var o = {};
|
|
777
|
+
for (var n in e)
|
|
778
|
+
Object.prototype.hasOwnProperty.call(e, n) && t.indexOf(n) < 0 && (o[n] = e[n]);
|
|
779
|
+
if (e != null && typeof Object.getOwnPropertySymbols == "function")
|
|
780
|
+
for (var i = 0, n = Object.getOwnPropertySymbols(e); i < n.length; i++)
|
|
781
|
+
t.indexOf(n[i]) < 0 && Object.prototype.propertyIsEnumerable.call(e, n[i]) && (o[n[i]] = e[n[i]]);
|
|
782
|
+
return o;
|
|
783
|
+
};
|
|
784
|
+
const ye = (e) => {
|
|
785
|
+
const {
|
|
786
|
+
getPrefixCls: t,
|
|
787
|
+
direction: o,
|
|
788
|
+
divider: n
|
|
789
|
+
} = s.useContext(_), {
|
|
790
|
+
prefixCls: i,
|
|
791
|
+
type: r = "horizontal",
|
|
792
|
+
orientation: d = "center",
|
|
793
|
+
orientationMargin: a,
|
|
794
|
+
className: l,
|
|
795
|
+
rootClassName: c,
|
|
796
|
+
children: h,
|
|
797
|
+
dashed: u,
|
|
798
|
+
plain: v,
|
|
799
|
+
style: f
|
|
800
|
+
} = e, E = sn(e, ["prefixCls", "type", "orientation", "orientationMargin", "className", "rootClassName", "children", "dashed", "plain", "style"]), p = t("divider", i), [S, w, m] = dn(p), $ = d.length > 0 ? `-${d}` : d, y = !!h, x = d === "left" && a != null, g = d === "right" && a != null, z = D(p, n == null ? void 0 : n.className, w, m, `${p}-${r}`, {
|
|
801
|
+
[`${p}-with-text`]: y,
|
|
802
|
+
[`${p}-with-text${$}`]: y,
|
|
803
|
+
[`${p}-dashed`]: !!u,
|
|
804
|
+
[`${p}-plain`]: !!v,
|
|
805
|
+
[`${p}-rtl`]: o === "rtl",
|
|
806
|
+
[`${p}-no-default-orientation-margin-left`]: x,
|
|
807
|
+
[`${p}-no-default-orientation-margin-right`]: g
|
|
808
|
+
}, l, c), b = s.useMemo(() => typeof a == "number" ? a : /^\d+$/.test(a) ? Number(a) : a, [a]), k = Object.assign(Object.assign({}, x && {
|
|
809
|
+
marginLeft: b
|
|
810
|
+
}), g && {
|
|
811
|
+
marginRight: b
|
|
812
|
+
});
|
|
813
|
+
if (process.env.NODE_ENV !== "production") {
|
|
814
|
+
const P = me("Divider");
|
|
815
|
+
process.env.NODE_ENV !== "production" && P(!h || r !== "vertical", "usage", "`children` not working in `vertical` mode.");
|
|
816
|
+
}
|
|
817
|
+
return S(/* @__PURE__ */ s.createElement("div", Object.assign({
|
|
818
|
+
className: z,
|
|
819
|
+
style: Object.assign(Object.assign({}, n == null ? void 0 : n.style), f)
|
|
820
|
+
}, E, {
|
|
821
|
+
role: "separator"
|
|
822
|
+
}), h && r !== "vertical" && /* @__PURE__ */ s.createElement("span", {
|
|
823
|
+
className: `${p}-inner-text`,
|
|
824
|
+
style: k
|
|
825
|
+
}, h)));
|
|
826
|
+
};
|
|
827
|
+
process.env.NODE_ENV !== "production" && (ye.displayName = "Divider");
|
|
828
|
+
function ae(e) {
|
|
829
|
+
return ["small", "middle", "large"].includes(e);
|
|
830
|
+
}
|
|
831
|
+
function le(e) {
|
|
832
|
+
return e ? typeof e == "number" && !Number.isNaN(e) : !1;
|
|
833
|
+
}
|
|
834
|
+
const xe = /* @__PURE__ */ _e.createContext({
|
|
835
|
+
latestIndex: 0
|
|
836
|
+
}), cn = xe.Provider, un = (e) => {
|
|
837
|
+
let {
|
|
838
|
+
className: t,
|
|
839
|
+
index: o,
|
|
840
|
+
children: n,
|
|
841
|
+
split: i,
|
|
842
|
+
style: r
|
|
843
|
+
} = e;
|
|
844
|
+
const {
|
|
845
|
+
latestIndex: d
|
|
846
|
+
} = s.useContext(xe);
|
|
847
|
+
return n == null ? null : /* @__PURE__ */ s.createElement(s.Fragment, null, /* @__PURE__ */ s.createElement("div", {
|
|
848
|
+
className: t,
|
|
849
|
+
style: r
|
|
850
|
+
}, n), o < d && i && /* @__PURE__ */ s.createElement("span", {
|
|
851
|
+
className: `${t}-split`
|
|
852
|
+
}, i));
|
|
853
|
+
};
|
|
854
|
+
var hn = function(e, t) {
|
|
855
|
+
var o = {};
|
|
856
|
+
for (var n in e)
|
|
857
|
+
Object.prototype.hasOwnProperty.call(e, n) && t.indexOf(n) < 0 && (o[n] = e[n]);
|
|
858
|
+
if (e != null && typeof Object.getOwnPropertySymbols == "function")
|
|
859
|
+
for (var i = 0, n = Object.getOwnPropertySymbols(e); i < n.length; i++)
|
|
860
|
+
t.indexOf(n[i]) < 0 && Object.prototype.propertyIsEnumerable.call(e, n[i]) && (o[n[i]] = e[n[i]]);
|
|
861
|
+
return o;
|
|
862
|
+
};
|
|
863
|
+
const gn = /* @__PURE__ */ s.forwardRef((e, t) => {
|
|
864
|
+
var o, n;
|
|
865
|
+
const {
|
|
866
|
+
getPrefixCls: i,
|
|
867
|
+
space: r,
|
|
868
|
+
direction: d
|
|
869
|
+
} = s.useContext(_), {
|
|
870
|
+
size: a = (r == null ? void 0 : r.size) || "small",
|
|
871
|
+
align: l,
|
|
872
|
+
className: c,
|
|
873
|
+
rootClassName: h,
|
|
874
|
+
children: u,
|
|
875
|
+
direction: v = "horizontal",
|
|
876
|
+
prefixCls: f,
|
|
877
|
+
split: E,
|
|
878
|
+
style: p,
|
|
879
|
+
wrap: S = !1,
|
|
880
|
+
classNames: w,
|
|
881
|
+
styles: m
|
|
882
|
+
} = e, $ = hn(e, ["size", "align", "className", "rootClassName", "children", "direction", "prefixCls", "split", "style", "wrap", "classNames", "styles"]), [y, x] = Array.isArray(a) ? a : [a, a], g = ae(x), z = ae(y), b = le(x), k = le(y), P = Re(u, {
|
|
883
|
+
keepEmpty: !0
|
|
884
|
+
}), I = l === void 0 && v === "horizontal" ? "center" : l, N = i("space", f), [j, C, M] = je(N), B = D(N, r == null ? void 0 : r.className, C, `${N}-${v}`, {
|
|
885
|
+
[`${N}-rtl`]: d === "rtl",
|
|
886
|
+
[`${N}-align-${I}`]: I,
|
|
887
|
+
[`${N}-gap-row-${x}`]: g,
|
|
888
|
+
[`${N}-gap-col-${y}`]: z
|
|
889
|
+
}, c, h, M), T = D(`${N}-item`, (o = w == null ? void 0 : w.item) !== null && o !== void 0 ? o : (n = r == null ? void 0 : r.classNames) === null || n === void 0 ? void 0 : n.item);
|
|
890
|
+
let U = 0;
|
|
891
|
+
const ke = P.map((H, Q) => {
|
|
892
|
+
var Y, J;
|
|
893
|
+
H != null && (U = Q);
|
|
894
|
+
const Ee = H && H.key || `${T}-${Q}`;
|
|
895
|
+
return /* @__PURE__ */ s.createElement(un, {
|
|
896
|
+
className: T,
|
|
897
|
+
key: Ee,
|
|
898
|
+
index: Q,
|
|
899
|
+
split: E,
|
|
900
|
+
style: (Y = m == null ? void 0 : m.item) !== null && Y !== void 0 ? Y : (J = r == null ? void 0 : r.styles) === null || J === void 0 ? void 0 : J.item
|
|
901
|
+
}, H);
|
|
902
|
+
}), Ie = s.useMemo(() => ({
|
|
903
|
+
latestIndex: U
|
|
904
|
+
}), [U]);
|
|
905
|
+
if (P.length === 0)
|
|
906
|
+
return null;
|
|
907
|
+
const A = {};
|
|
908
|
+
return S && (A.flexWrap = "wrap"), !z && k && (A.columnGap = y), !g && b && (A.rowGap = x), j(/* @__PURE__ */ s.createElement("div", Object.assign({
|
|
909
|
+
ref: t,
|
|
910
|
+
className: B,
|
|
911
|
+
style: Object.assign(Object.assign(Object.assign({}, A), r == null ? void 0 : r.style), p)
|
|
912
|
+
}, $), /* @__PURE__ */ s.createElement(cn, {
|
|
913
|
+
value: Ie
|
|
914
|
+
}, ke)));
|
|
915
|
+
}), ne = gn;
|
|
916
|
+
ne.Compact = Me;
|
|
917
|
+
process.env.NODE_ENV !== "production" && (ne.displayName = "Space");
|
|
918
|
+
var bn = ["prefixCls", "className", "checked", "defaultChecked", "disabled", "loadingIcon", "checkedChildren", "unCheckedChildren", "onClick", "onChange", "onKeyDown"], we = /* @__PURE__ */ s.forwardRef(function(e, t) {
|
|
919
|
+
var o, n = e.prefixCls, i = n === void 0 ? "rc-switch" : n, r = e.className, d = e.checked, a = e.defaultChecked, l = e.disabled, c = e.loadingIcon, h = e.checkedChildren, u = e.unCheckedChildren, v = e.onClick, f = e.onChange, E = e.onKeyDown, p = ge(e, bn), S = K(!1, {
|
|
920
|
+
value: d,
|
|
921
|
+
defaultValue: a
|
|
922
|
+
}), w = be(S, 2), m = w[0], $ = w[1];
|
|
923
|
+
function y(b, k) {
|
|
924
|
+
var P = m;
|
|
925
|
+
return l || (P = b, $(P), f == null || f(P, k)), P;
|
|
926
|
+
}
|
|
927
|
+
function x(b) {
|
|
928
|
+
b.which === ie.LEFT ? y(!1, b) : b.which === ie.RIGHT && y(!0, b), E == null || E(b);
|
|
929
|
+
}
|
|
930
|
+
function g(b) {
|
|
931
|
+
var k = y(!m, b);
|
|
932
|
+
v == null || v(k, b);
|
|
933
|
+
}
|
|
934
|
+
var z = D(i, r, (o = {}, F(o, "".concat(i, "-checked"), m), F(o, "".concat(i, "-disabled"), l), o));
|
|
935
|
+
return /* @__PURE__ */ s.createElement("button", pe({}, p, {
|
|
936
|
+
type: "button",
|
|
937
|
+
role: "switch",
|
|
938
|
+
"aria-checked": m,
|
|
939
|
+
disabled: l,
|
|
940
|
+
className: z,
|
|
941
|
+
ref: t,
|
|
942
|
+
onKeyDown: x,
|
|
943
|
+
onClick: g
|
|
944
|
+
}), c, /* @__PURE__ */ s.createElement("span", {
|
|
945
|
+
className: "".concat(i, "-inner")
|
|
946
|
+
}, /* @__PURE__ */ s.createElement("span", {
|
|
947
|
+
className: "".concat(i, "-inner-checked")
|
|
948
|
+
}, h), /* @__PURE__ */ s.createElement("span", {
|
|
949
|
+
className: "".concat(i, "-inner-unchecked")
|
|
950
|
+
}, u)));
|
|
951
|
+
});
|
|
952
|
+
we.displayName = "Switch";
|
|
953
|
+
const pn = (e) => {
|
|
954
|
+
const {
|
|
955
|
+
componentCls: t,
|
|
956
|
+
trackHeightSM: o,
|
|
957
|
+
trackPadding: n,
|
|
958
|
+
trackMinWidthSM: i,
|
|
959
|
+
innerMinMarginSM: r,
|
|
960
|
+
innerMaxMarginSM: d,
|
|
961
|
+
handleSizeSM: a,
|
|
962
|
+
calc: l
|
|
963
|
+
} = e, c = `${t}-inner`, h = O(l(a).add(l(n).mul(2)).equal()), u = O(l(d).mul(2).equal());
|
|
964
|
+
return {
|
|
965
|
+
[t]: {
|
|
966
|
+
[`&${t}-small`]: {
|
|
967
|
+
minWidth: i,
|
|
968
|
+
height: o,
|
|
969
|
+
lineHeight: O(o),
|
|
970
|
+
[`${t}-inner`]: {
|
|
971
|
+
paddingInlineStart: d,
|
|
972
|
+
paddingInlineEnd: r,
|
|
973
|
+
[`${c}-checked, ${c}-unchecked`]: {
|
|
974
|
+
minHeight: o
|
|
975
|
+
},
|
|
976
|
+
[`${c}-checked`]: {
|
|
977
|
+
marginInlineStart: `calc(-100% + ${h} - ${u})`,
|
|
978
|
+
marginInlineEnd: `calc(100% - ${h} + ${u})`
|
|
979
|
+
},
|
|
980
|
+
[`${c}-unchecked`]: {
|
|
981
|
+
marginTop: l(o).mul(-1).equal(),
|
|
982
|
+
marginInlineStart: 0,
|
|
983
|
+
marginInlineEnd: 0
|
|
984
|
+
}
|
|
985
|
+
},
|
|
986
|
+
[`${t}-handle`]: {
|
|
987
|
+
width: a,
|
|
988
|
+
height: a
|
|
989
|
+
},
|
|
990
|
+
[`${t}-loading-icon`]: {
|
|
991
|
+
top: l(l(a).sub(e.switchLoadingIconSize)).div(2).equal(),
|
|
992
|
+
fontSize: e.switchLoadingIconSize
|
|
993
|
+
},
|
|
994
|
+
[`&${t}-checked`]: {
|
|
995
|
+
[`${t}-inner`]: {
|
|
996
|
+
paddingInlineStart: r,
|
|
997
|
+
paddingInlineEnd: d,
|
|
998
|
+
[`${c}-checked`]: {
|
|
999
|
+
marginInlineStart: 0,
|
|
1000
|
+
marginInlineEnd: 0
|
|
1001
|
+
},
|
|
1002
|
+
[`${c}-unchecked`]: {
|
|
1003
|
+
marginInlineStart: `calc(100% - ${h} + ${u})`,
|
|
1004
|
+
marginInlineEnd: `calc(-100% + ${h} - ${u})`
|
|
1005
|
+
}
|
|
1006
|
+
},
|
|
1007
|
+
[`${t}-handle`]: {
|
|
1008
|
+
insetInlineStart: `calc(100% - ${O(l(a).add(n).equal())})`
|
|
1009
|
+
}
|
|
1010
|
+
},
|
|
1011
|
+
[`&:not(${t}-disabled):active`]: {
|
|
1012
|
+
[`&:not(${t}-checked) ${c}`]: {
|
|
1013
|
+
[`${c}-unchecked`]: {
|
|
1014
|
+
marginInlineStart: l(e.marginXXS).div(2).equal(),
|
|
1015
|
+
marginInlineEnd: l(e.marginXXS).mul(-1).div(2).equal()
|
|
1016
|
+
}
|
|
1017
|
+
},
|
|
1018
|
+
[`&${t}-checked ${c}`]: {
|
|
1019
|
+
[`${c}-checked`]: {
|
|
1020
|
+
marginInlineStart: l(e.marginXXS).mul(-1).div(2).equal(),
|
|
1021
|
+
marginInlineEnd: l(e.marginXXS).div(2).equal()
|
|
1022
|
+
}
|
|
1023
|
+
}
|
|
1024
|
+
}
|
|
1025
|
+
}
|
|
1026
|
+
}
|
|
1027
|
+
};
|
|
1028
|
+
}, fn = (e) => {
|
|
1029
|
+
const {
|
|
1030
|
+
componentCls: t,
|
|
1031
|
+
handleSize: o,
|
|
1032
|
+
calc: n
|
|
1033
|
+
} = e;
|
|
1034
|
+
return {
|
|
1035
|
+
[t]: {
|
|
1036
|
+
[`${t}-loading-icon${e.iconCls}`]: {
|
|
1037
|
+
position: "relative",
|
|
1038
|
+
top: n(n(o).sub(e.fontSize)).div(2).equal(),
|
|
1039
|
+
color: e.switchLoadingIconColor,
|
|
1040
|
+
verticalAlign: "top"
|
|
1041
|
+
},
|
|
1042
|
+
[`&${t}-checked ${t}-loading-icon`]: {
|
|
1043
|
+
color: e.switchColor
|
|
1044
|
+
}
|
|
1045
|
+
}
|
|
1046
|
+
};
|
|
1047
|
+
}, mn = (e) => {
|
|
1048
|
+
const {
|
|
1049
|
+
componentCls: t,
|
|
1050
|
+
trackPadding: o,
|
|
1051
|
+
handleBg: n,
|
|
1052
|
+
handleShadow: i,
|
|
1053
|
+
handleSize: r,
|
|
1054
|
+
calc: d
|
|
1055
|
+
} = e, a = `${t}-handle`;
|
|
1056
|
+
return {
|
|
1057
|
+
[t]: {
|
|
1058
|
+
[a]: {
|
|
1059
|
+
position: "absolute",
|
|
1060
|
+
top: o,
|
|
1061
|
+
insetInlineStart: o,
|
|
1062
|
+
width: r,
|
|
1063
|
+
height: r,
|
|
1064
|
+
transition: `all ${e.switchDuration} ease-in-out`,
|
|
1065
|
+
"&::before": {
|
|
1066
|
+
position: "absolute",
|
|
1067
|
+
top: 0,
|
|
1068
|
+
insetInlineEnd: 0,
|
|
1069
|
+
bottom: 0,
|
|
1070
|
+
insetInlineStart: 0,
|
|
1071
|
+
backgroundColor: n,
|
|
1072
|
+
borderRadius: d(r).div(2).equal(),
|
|
1073
|
+
boxShadow: i,
|
|
1074
|
+
transition: `all ${e.switchDuration} ease-in-out`,
|
|
1075
|
+
content: '""'
|
|
1076
|
+
}
|
|
1077
|
+
},
|
|
1078
|
+
[`&${t}-checked ${a}`]: {
|
|
1079
|
+
insetInlineStart: `calc(100% - ${O(d(r).add(o).equal())})`
|
|
1080
|
+
},
|
|
1081
|
+
[`&:not(${t}-disabled):active`]: {
|
|
1082
|
+
[`${a}::before`]: {
|
|
1083
|
+
insetInlineEnd: e.switchHandleActiveInset,
|
|
1084
|
+
insetInlineStart: 0
|
|
1085
|
+
},
|
|
1086
|
+
[`&${t}-checked ${a}::before`]: {
|
|
1087
|
+
insetInlineEnd: 0,
|
|
1088
|
+
insetInlineStart: e.switchHandleActiveInset
|
|
1089
|
+
}
|
|
1090
|
+
}
|
|
1091
|
+
}
|
|
1092
|
+
};
|
|
1093
|
+
}, Cn = (e) => {
|
|
1094
|
+
const {
|
|
1095
|
+
componentCls: t,
|
|
1096
|
+
trackHeight: o,
|
|
1097
|
+
trackPadding: n,
|
|
1098
|
+
innerMinMargin: i,
|
|
1099
|
+
innerMaxMargin: r,
|
|
1100
|
+
handleSize: d,
|
|
1101
|
+
calc: a
|
|
1102
|
+
} = e, l = `${t}-inner`, c = O(a(d).add(a(n).mul(2)).equal()), h = O(a(r).mul(2).equal());
|
|
1103
|
+
return {
|
|
1104
|
+
[t]: {
|
|
1105
|
+
[l]: {
|
|
1106
|
+
display: "block",
|
|
1107
|
+
overflow: "hidden",
|
|
1108
|
+
borderRadius: 100,
|
|
1109
|
+
height: "100%",
|
|
1110
|
+
paddingInlineStart: r,
|
|
1111
|
+
paddingInlineEnd: i,
|
|
1112
|
+
transition: `padding-inline-start ${e.switchDuration} ease-in-out, padding-inline-end ${e.switchDuration} ease-in-out`,
|
|
1113
|
+
[`${l}-checked, ${l}-unchecked`]: {
|
|
1114
|
+
display: "block",
|
|
1115
|
+
color: e.colorTextLightSolid,
|
|
1116
|
+
fontSize: e.fontSizeSM,
|
|
1117
|
+
transition: `margin-inline-start ${e.switchDuration} ease-in-out, margin-inline-end ${e.switchDuration} ease-in-out`,
|
|
1118
|
+
pointerEvents: "none",
|
|
1119
|
+
minHeight: o
|
|
1120
|
+
},
|
|
1121
|
+
[`${l}-checked`]: {
|
|
1122
|
+
marginInlineStart: `calc(-100% + ${c} - ${h})`,
|
|
1123
|
+
marginInlineEnd: `calc(100% - ${c} + ${h})`
|
|
1124
|
+
},
|
|
1125
|
+
[`${l}-unchecked`]: {
|
|
1126
|
+
marginTop: a(o).mul(-1).equal(),
|
|
1127
|
+
marginInlineStart: 0,
|
|
1128
|
+
marginInlineEnd: 0
|
|
1129
|
+
}
|
|
1130
|
+
},
|
|
1131
|
+
[`&${t}-checked ${l}`]: {
|
|
1132
|
+
paddingInlineStart: i,
|
|
1133
|
+
paddingInlineEnd: r,
|
|
1134
|
+
[`${l}-checked`]: {
|
|
1135
|
+
marginInlineStart: 0,
|
|
1136
|
+
marginInlineEnd: 0
|
|
1137
|
+
},
|
|
1138
|
+
[`${l}-unchecked`]: {
|
|
1139
|
+
marginInlineStart: `calc(100% - ${c} + ${h})`,
|
|
1140
|
+
marginInlineEnd: `calc(-100% + ${c} - ${h})`
|
|
1141
|
+
}
|
|
1142
|
+
},
|
|
1143
|
+
[`&:not(${t}-disabled):active`]: {
|
|
1144
|
+
[`&:not(${t}-checked) ${l}`]: {
|
|
1145
|
+
[`${l}-unchecked`]: {
|
|
1146
|
+
marginInlineStart: a(n).mul(2).equal(),
|
|
1147
|
+
marginInlineEnd: a(n).mul(-1).mul(2).equal()
|
|
1148
|
+
}
|
|
1149
|
+
},
|
|
1150
|
+
[`&${t}-checked ${l}`]: {
|
|
1151
|
+
[`${l}-checked`]: {
|
|
1152
|
+
marginInlineStart: a(n).mul(-1).mul(2).equal(),
|
|
1153
|
+
marginInlineEnd: a(n).mul(2).equal()
|
|
1154
|
+
}
|
|
1155
|
+
}
|
|
1156
|
+
}
|
|
1157
|
+
}
|
|
1158
|
+
};
|
|
1159
|
+
}, vn = (e) => {
|
|
1160
|
+
const {
|
|
1161
|
+
componentCls: t,
|
|
1162
|
+
trackHeight: o,
|
|
1163
|
+
trackMinWidth: n
|
|
1164
|
+
} = e;
|
|
1165
|
+
return {
|
|
1166
|
+
[t]: Object.assign(Object.assign(Object.assign(Object.assign({}, W(e)), {
|
|
1167
|
+
position: "relative",
|
|
1168
|
+
display: "inline-block",
|
|
1169
|
+
boxSizing: "border-box",
|
|
1170
|
+
minWidth: n,
|
|
1171
|
+
height: o,
|
|
1172
|
+
lineHeight: `${O(o)}`,
|
|
1173
|
+
verticalAlign: "middle",
|
|
1174
|
+
background: e.colorTextQuaternary,
|
|
1175
|
+
border: "0",
|
|
1176
|
+
borderRadius: 100,
|
|
1177
|
+
cursor: "pointer",
|
|
1178
|
+
transition: `all ${e.motionDurationMid}`,
|
|
1179
|
+
userSelect: "none",
|
|
1180
|
+
[`&:hover:not(${t}-disabled)`]: {
|
|
1181
|
+
background: e.colorTextTertiary
|
|
1182
|
+
}
|
|
1183
|
+
}), We(e)), {
|
|
1184
|
+
[`&${t}-checked`]: {
|
|
1185
|
+
background: e.switchColor,
|
|
1186
|
+
[`&:hover:not(${t}-disabled)`]: {
|
|
1187
|
+
background: e.colorPrimaryHover
|
|
1188
|
+
}
|
|
1189
|
+
},
|
|
1190
|
+
[`&${t}-loading, &${t}-disabled`]: {
|
|
1191
|
+
cursor: "not-allowed",
|
|
1192
|
+
opacity: e.switchDisabledOpacity,
|
|
1193
|
+
"*": {
|
|
1194
|
+
boxShadow: "none",
|
|
1195
|
+
cursor: "not-allowed"
|
|
1196
|
+
}
|
|
1197
|
+
},
|
|
1198
|
+
// rtl style
|
|
1199
|
+
[`&${t}-rtl`]: {
|
|
1200
|
+
direction: "rtl"
|
|
1201
|
+
}
|
|
1202
|
+
})
|
|
1203
|
+
};
|
|
1204
|
+
}, Sn = (e) => {
|
|
1205
|
+
const {
|
|
1206
|
+
fontSize: t,
|
|
1207
|
+
lineHeight: o,
|
|
1208
|
+
controlHeight: n,
|
|
1209
|
+
colorWhite: i
|
|
1210
|
+
} = e, r = t * o, d = n / 2, a = 2, l = r - a * 2, c = d - a * 2;
|
|
1211
|
+
return {
|
|
1212
|
+
trackHeight: r,
|
|
1213
|
+
trackHeightSM: d,
|
|
1214
|
+
trackMinWidth: l * 2 + a * 4,
|
|
1215
|
+
trackMinWidthSM: c * 2 + a * 2,
|
|
1216
|
+
trackPadding: a,
|
|
1217
|
+
// Fixed value
|
|
1218
|
+
handleBg: i,
|
|
1219
|
+
handleSize: l,
|
|
1220
|
+
handleSizeSM: c,
|
|
1221
|
+
handleShadow: `0 2px 4px 0 ${new Ve("#00230b").setAlpha(0.2).toRgbString()}`,
|
|
1222
|
+
innerMinMargin: l / 2,
|
|
1223
|
+
innerMaxMargin: l + a + a * 2,
|
|
1224
|
+
innerMinMarginSM: c / 2,
|
|
1225
|
+
innerMaxMarginSM: c + a + a * 2
|
|
1226
|
+
};
|
|
1227
|
+
}, $n = Z("Switch", (e) => {
|
|
1228
|
+
const t = ee(e, {
|
|
1229
|
+
switchDuration: e.motionDurationMid,
|
|
1230
|
+
switchColor: e.colorPrimary,
|
|
1231
|
+
switchDisabledOpacity: e.opacityLoading,
|
|
1232
|
+
switchLoadingIconSize: e.calc(e.fontSizeIcon).mul(0.75).equal(),
|
|
1233
|
+
switchLoadingIconColor: `rgba(0, 0, 0, ${e.opacityLoading})`,
|
|
1234
|
+
switchHandleActiveInset: "-30%"
|
|
1235
|
+
});
|
|
1236
|
+
return [
|
|
1237
|
+
vn(t),
|
|
1238
|
+
// inner style
|
|
1239
|
+
Cn(t),
|
|
1240
|
+
// handle style
|
|
1241
|
+
mn(t),
|
|
1242
|
+
// loading style
|
|
1243
|
+
fn(t),
|
|
1244
|
+
// small style
|
|
1245
|
+
pn(t)
|
|
1246
|
+
];
|
|
1247
|
+
}, Sn);
|
|
1248
|
+
var yn = function(e, t) {
|
|
1249
|
+
var o = {};
|
|
1250
|
+
for (var n in e)
|
|
1251
|
+
Object.prototype.hasOwnProperty.call(e, n) && t.indexOf(n) < 0 && (o[n] = e[n]);
|
|
1252
|
+
if (e != null && typeof Object.getOwnPropertySymbols == "function")
|
|
1253
|
+
for (var i = 0, n = Object.getOwnPropertySymbols(e); i < n.length; i++)
|
|
1254
|
+
t.indexOf(n[i]) < 0 && Object.prototype.propertyIsEnumerable.call(e, n[i]) && (o[n[i]] = e[n[i]]);
|
|
1255
|
+
return o;
|
|
1256
|
+
};
|
|
1257
|
+
const xn = /* @__PURE__ */ s.forwardRef((e, t) => {
|
|
1258
|
+
const {
|
|
1259
|
+
prefixCls: o,
|
|
1260
|
+
size: n,
|
|
1261
|
+
disabled: i,
|
|
1262
|
+
loading: r,
|
|
1263
|
+
className: d,
|
|
1264
|
+
rootClassName: a,
|
|
1265
|
+
style: l,
|
|
1266
|
+
checked: c,
|
|
1267
|
+
value: h,
|
|
1268
|
+
defaultChecked: u,
|
|
1269
|
+
defaultValue: v,
|
|
1270
|
+
onChange: f
|
|
1271
|
+
} = e, E = yn(e, ["prefixCls", "size", "disabled", "loading", "className", "rootClassName", "style", "checked", "value", "defaultChecked", "defaultValue", "onChange"]), [p, S] = K(!1, {
|
|
1272
|
+
value: c ?? h,
|
|
1273
|
+
defaultValue: u ?? v
|
|
1274
|
+
}), {
|
|
1275
|
+
getPrefixCls: w,
|
|
1276
|
+
direction: m,
|
|
1277
|
+
switch: $
|
|
1278
|
+
} = s.useContext(_), y = s.useContext(Ce), x = (i ?? y) || r, g = w("switch", o), z = /* @__PURE__ */ s.createElement("div", {
|
|
1279
|
+
className: `${g}-handle`
|
|
1280
|
+
}, r && /* @__PURE__ */ s.createElement(De, {
|
|
1281
|
+
className: `${g}-loading-icon`
|
|
1282
|
+
})), [b, k, P] = $n(g), I = he(n), N = D($ == null ? void 0 : $.className, {
|
|
1283
|
+
[`${g}-small`]: I === "small",
|
|
1284
|
+
[`${g}-loading`]: r,
|
|
1285
|
+
[`${g}-rtl`]: m === "rtl"
|
|
1286
|
+
}, d, a, k, P), j = Object.assign(Object.assign({}, $ == null ? void 0 : $.style), l), C = function() {
|
|
1287
|
+
S(arguments.length <= 0 ? void 0 : arguments[0]), f == null || f.apply(void 0, arguments);
|
|
1288
|
+
};
|
|
1289
|
+
return b(/* @__PURE__ */ s.createElement(ue, {
|
|
1290
|
+
component: "Switch"
|
|
1291
|
+
}, /* @__PURE__ */ s.createElement(we, Object.assign({}, E, {
|
|
1292
|
+
checked: p,
|
|
1293
|
+
onChange: C,
|
|
1294
|
+
prefixCls: g,
|
|
1295
|
+
className: N,
|
|
1296
|
+
style: j,
|
|
1297
|
+
disabled: x,
|
|
1298
|
+
ref: t,
|
|
1299
|
+
loadingIcon: z
|
|
1300
|
+
}))));
|
|
1301
|
+
}), X = xn;
|
|
1302
|
+
X.__ANT_SWITCH = !0;
|
|
1303
|
+
process.env.NODE_ENV !== "production" && (X.displayName = "Switch");
|
|
1304
|
+
const G = Be.Text, wn = (e, t) => {
|
|
1305
|
+
const o = ["EMAIL", "INAPP_WEB", "SMS", "CALL", "PUSH", "WEB_PUSH"];
|
|
1306
|
+
return o.indexOf(e) - o.indexOf(t);
|
|
1307
|
+
}, de = (e, t) => {
|
|
1308
|
+
const o = ["off", "instant", "hourly", "daily", "weekly", "monthly"];
|
|
1309
|
+
return o.indexOf(e) - o.indexOf(t);
|
|
1310
|
+
}, se = (e) => ({
|
|
1311
|
+
off: "Off",
|
|
1312
|
+
instant: "Instant",
|
|
1313
|
+
hourly: "Hourly",
|
|
1314
|
+
daily: "Daily",
|
|
1315
|
+
weekly: "Weekly",
|
|
1316
|
+
monthly: "Monthly"
|
|
1317
|
+
})[e], Mn = ({
|
|
1318
|
+
notification: e,
|
|
1319
|
+
preferences: t,
|
|
1320
|
+
updateDelivery: o,
|
|
1321
|
+
subNotificationId: n
|
|
1322
|
+
}) => /* @__PURE__ */ R(te, { children: e.channels.sort(wn).map((i, r) => {
|
|
1323
|
+
const d = t.find(
|
|
1324
|
+
(u) => u.notificationId === e.notificationId && u.channel === i
|
|
1325
|
+
);
|
|
1326
|
+
if (!d)
|
|
1327
|
+
return null;
|
|
1328
|
+
const a = Oe(i), l = ze(i), c = Object.keys(
|
|
1329
|
+
e.options[i]
|
|
1330
|
+
).filter(
|
|
1331
|
+
(u) => u !== "defaultDeliveryOption" && u !== "defaultDeliverOption"
|
|
1332
|
+
);
|
|
1333
|
+
let h;
|
|
1334
|
+
return c.length === 1 ? h = /* @__PURE__ */ R(G, { children: se(d.delivery) }) : c.length === 2 && c.includes("off") ? h = /* @__PURE__ */ R(
|
|
1335
|
+
X,
|
|
1336
|
+
{
|
|
1337
|
+
checked: d.delivery !== "off",
|
|
1338
|
+
onChange: (u) => {
|
|
1339
|
+
if (u) {
|
|
1340
|
+
const v = c.find((f) => f !== "off");
|
|
1341
|
+
o(
|
|
1342
|
+
e.notificationId,
|
|
1343
|
+
i,
|
|
1344
|
+
v,
|
|
1345
|
+
n
|
|
1346
|
+
);
|
|
1347
|
+
} else
|
|
1348
|
+
o(
|
|
1349
|
+
e.notificationId,
|
|
1350
|
+
i,
|
|
1351
|
+
"off",
|
|
1352
|
+
n
|
|
1353
|
+
);
|
|
1354
|
+
}
|
|
1355
|
+
}
|
|
1356
|
+
) : h = /* @__PURE__ */ q(te, { children: [
|
|
1357
|
+
/* @__PURE__ */ R(
|
|
1358
|
+
X,
|
|
1359
|
+
{
|
|
1360
|
+
checked: d.delivery !== "off",
|
|
1361
|
+
onChange: (u) => {
|
|
1362
|
+
if (u) {
|
|
1363
|
+
const v = c.sort(de).find((f) => f !== "off");
|
|
1364
|
+
o(
|
|
1365
|
+
e.notificationId,
|
|
1366
|
+
i,
|
|
1367
|
+
v,
|
|
1368
|
+
n
|
|
1369
|
+
);
|
|
1370
|
+
} else
|
|
1371
|
+
o(
|
|
1372
|
+
e.notificationId,
|
|
1373
|
+
i,
|
|
1374
|
+
"off",
|
|
1375
|
+
n
|
|
1376
|
+
);
|
|
1377
|
+
}
|
|
1378
|
+
}
|
|
1379
|
+
),
|
|
1380
|
+
/* @__PURE__ */ R(
|
|
1381
|
+
"div",
|
|
1382
|
+
{
|
|
1383
|
+
style: {
|
|
1384
|
+
width: "100%",
|
|
1385
|
+
marginTop: 8,
|
|
1386
|
+
maxHeight: d.delivery !== "off" ? 1e3 : 0,
|
|
1387
|
+
overflow: "hidden",
|
|
1388
|
+
transition: "max-height 0.3s ease"
|
|
1389
|
+
},
|
|
1390
|
+
children: /* @__PURE__ */ q("div", { children: [
|
|
1391
|
+
/* @__PURE__ */ R("div", { style: { marginTop: 20 }, children: /* @__PURE__ */ R(G, { strong: !0, children: "Choose frequency:" }) }),
|
|
1392
|
+
/* @__PURE__ */ R(
|
|
1393
|
+
L.Group,
|
|
1394
|
+
{
|
|
1395
|
+
value: d.delivery,
|
|
1396
|
+
onChange: (u) => {
|
|
1397
|
+
o(
|
|
1398
|
+
e.notificationId,
|
|
1399
|
+
i,
|
|
1400
|
+
u.target.value,
|
|
1401
|
+
n
|
|
1402
|
+
);
|
|
1403
|
+
},
|
|
1404
|
+
children: /* @__PURE__ */ R(ne, { direction: "vertical", style: { paddingTop: 10 }, children: c.filter((u) => u !== "off").sort(de).map((u) => /* @__PURE__ */ R(L, { value: u, children: /* @__PURE__ */ R(G, { children: se(u) }) }, u)) })
|
|
1405
|
+
}
|
|
1406
|
+
)
|
|
1407
|
+
] })
|
|
1408
|
+
}
|
|
1409
|
+
)
|
|
1410
|
+
] }), /* @__PURE__ */ q("div", { children: [
|
|
1411
|
+
/* @__PURE__ */ q(
|
|
1412
|
+
"div",
|
|
1413
|
+
{
|
|
1414
|
+
style: {
|
|
1415
|
+
display: "flex",
|
|
1416
|
+
justifyContent: "space-between",
|
|
1417
|
+
flexWrap: "wrap",
|
|
1418
|
+
marginTop: r === 0 ? 12 : 0,
|
|
1419
|
+
marginBottom: r === e.channels.length - 1 ? 12 : 0
|
|
1420
|
+
},
|
|
1421
|
+
children: [
|
|
1422
|
+
/* @__PURE__ */ q(G, { children: [
|
|
1423
|
+
l,
|
|
1424
|
+
" ",
|
|
1425
|
+
a
|
|
1426
|
+
] }),
|
|
1427
|
+
h
|
|
1428
|
+
]
|
|
1429
|
+
},
|
|
1430
|
+
i
|
|
1431
|
+
),
|
|
1432
|
+
r !== e.channels.length - 1 && /* @__PURE__ */ R(ye, {})
|
|
1433
|
+
] }, i);
|
|
1434
|
+
}) });
|
|
4
1435
|
export {
|
|
5
|
-
|
|
1436
|
+
Mn as PreferenceInput
|
|
6
1437
|
};
|