@notificationapi/react 0.0.31 → 0.0.32
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 +4 -4
- package/dist/assets/Notification.js +3094 -2713
- package/dist/assets/PurePanel.js +2 -2
- package/dist/assets/RightOutlined.js +1 -1
- package/dist/assets/button.js +1394 -577
- package/dist/assets/channelUtils.js +1 -1
- package/dist/assets/colors.js +14798 -14301
- package/dist/assets/index.js +156 -158
- package/dist/assets/index2.js +212 -221
- package/dist/assets/index3.js +8307 -724
- package/dist/assets/pickAttrs.js +1 -1
- package/dist/assets/presets.js +810 -0
- package/dist/components/Notifications/Inbox.js +3520 -3323
- package/dist/components/Notifications/InboxHeader.d.ts +1 -2
- package/dist/components/Notifications/InboxHeader.js +2 -2
- package/dist/components/Notifications/Notification.js +1 -1
- package/dist/components/Notifications/NotificationFeed.js +1 -2
- package/dist/components/Preferences/NotificationPreferencesInline.d.ts +1 -2
- package/dist/components/Preferences/NotificationPreferencesPopup.d.ts +1 -2
- package/dist/components/Preferences/NotificationPreferencesPopup.js +1423 -857
- package/dist/components/Preferences/PreferenceInput.d.ts +1 -1
- package/dist/components/Preferences/PreferenceInput.js +843 -812
- package/dist/components/Preferences/Preferences.d.ts +1 -2
- package/dist/components/Preferences/Preferences.js +331 -328
- package/dist/components/Preferences/channelUtils.js +1 -1
- package/dist/components/Provider/index.js +8 -16
- package/package.json +5 -5
- package/dist/assets/index4.js +0 -8408
package/dist/assets/button.js
CHANGED
|
@@ -1,600 +1,1405 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import
|
|
3
|
-
import { c as
|
|
4
|
-
import {
|
|
5
|
-
import { a as
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
for (var
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
e.indexOf(n[r]) < 0 && Object.prototype.propertyIsEnumerable.call(o, n[r]) && (t[n[r]] = o[n[r]]);
|
|
13
|
-
return t;
|
|
1
|
+
import * as ee from "react";
|
|
2
|
+
import u, { forwardRef as ie, useState as ye, useRef as j, useEffect as ne, useMemo as te, useContext as he, Children as pt, createRef as Ct } from "react";
|
|
3
|
+
import { c as L, f as _, d as Xe, _ as P, b as yt, e as U, a as fe } from "./presets.js";
|
|
4
|
+
import { l as St, u as xt, m as Ht, n as $t, e as Bt, o as Et, W as _t } from "./index3.js";
|
|
5
|
+
import { a as Ye, l as Ot, e as Ue, c as Rt, n as Lt, d as wt, o as Nt, p as Pt, q as Je, s as Ke, t as Qe, m as ae, v as me, g as Dt, u as re, k as zt, w as It, D as jt, j as Tt } from "./colors.js";
|
|
6
|
+
var Mt = function(e, t) {
|
|
7
|
+
var r = {};
|
|
8
|
+
for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && t.indexOf(o) < 0 && (r[o] = e[o]);
|
|
9
|
+
if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var n = 0, o = Object.getOwnPropertySymbols(e); n < o.length; n++)
|
|
10
|
+
t.indexOf(o[n]) < 0 && Object.prototype.propertyIsEnumerable.call(e, o[n]) && (r[o[n]] = e[o[n]]);
|
|
11
|
+
return r;
|
|
14
12
|
};
|
|
15
|
-
const
|
|
13
|
+
const Ze = /* @__PURE__ */ ee.createContext(void 0), At = (e) => {
|
|
16
14
|
const {
|
|
17
|
-
getPrefixCls:
|
|
18
|
-
direction:
|
|
19
|
-
} =
|
|
20
|
-
prefixCls:
|
|
21
|
-
size:
|
|
15
|
+
getPrefixCls: t,
|
|
16
|
+
direction: r
|
|
17
|
+
} = ee.useContext(Ye), {
|
|
18
|
+
prefixCls: o,
|
|
19
|
+
size: n,
|
|
22
20
|
className: i
|
|
23
|
-
} =
|
|
24
|
-
let
|
|
25
|
-
switch (
|
|
21
|
+
} = e, s = Mt(e, ["prefixCls", "size", "className"]), a = t("btn-group", o), [, , l] = Ot();
|
|
22
|
+
let c = "";
|
|
23
|
+
switch (n) {
|
|
26
24
|
case "large":
|
|
27
|
-
|
|
25
|
+
c = "lg";
|
|
28
26
|
break;
|
|
29
27
|
case "small":
|
|
30
|
-
|
|
28
|
+
c = "sm";
|
|
31
29
|
break;
|
|
32
30
|
}
|
|
33
31
|
if (process.env.NODE_ENV !== "production") {
|
|
34
|
-
const
|
|
35
|
-
process.env.NODE_ENV !== "production" &&
|
|
36
|
-
}
|
|
37
|
-
const
|
|
38
|
-
[`${
|
|
39
|
-
[`${
|
|
40
|
-
}, i,
|
|
41
|
-
return /* @__PURE__ */
|
|
42
|
-
value:
|
|
43
|
-
}, /* @__PURE__ */
|
|
44
|
-
className:
|
|
32
|
+
const g = Ue("Button.Group");
|
|
33
|
+
process.env.NODE_ENV !== "production" && g(!n || ["large", "small", "middle"].includes(n), "usage", "Invalid prop `size`.");
|
|
34
|
+
}
|
|
35
|
+
const d = L(a, {
|
|
36
|
+
[`${a}-${c}`]: c,
|
|
37
|
+
[`${a}-rtl`]: r === "rtl"
|
|
38
|
+
}, i, l);
|
|
39
|
+
return /* @__PURE__ */ ee.createElement(Ze.Provider, {
|
|
40
|
+
value: n
|
|
41
|
+
}, /* @__PURE__ */ ee.createElement("div", Object.assign({}, s, {
|
|
42
|
+
className: d
|
|
45
43
|
})));
|
|
46
|
-
},
|
|
47
|
-
function
|
|
48
|
-
return
|
|
44
|
+
}, Ge = /^[\u4E00-\u9FA5]{2}$/, Se = Ge.test.bind(Ge);
|
|
45
|
+
function Mr(e) {
|
|
46
|
+
return e === "danger" ? {
|
|
49
47
|
danger: !0
|
|
50
48
|
} : {
|
|
51
|
-
type:
|
|
49
|
+
type: e
|
|
52
50
|
};
|
|
53
51
|
}
|
|
54
|
-
function
|
|
55
|
-
return typeof
|
|
52
|
+
function We(e) {
|
|
53
|
+
return typeof e == "string";
|
|
56
54
|
}
|
|
57
|
-
function
|
|
58
|
-
return
|
|
55
|
+
function oe(e) {
|
|
56
|
+
return e === "text" || e === "link";
|
|
59
57
|
}
|
|
60
|
-
function
|
|
61
|
-
if (
|
|
58
|
+
function Gt(e, t) {
|
|
59
|
+
if (e == null)
|
|
62
60
|
return;
|
|
63
|
-
const
|
|
64
|
-
return typeof
|
|
65
|
-
children:
|
|
66
|
-
}) :
|
|
61
|
+
const r = t ? " " : "";
|
|
62
|
+
return typeof e != "string" && typeof e != "number" && We(e.type) && Se(e.props.children) ? Rt(e, {
|
|
63
|
+
children: e.props.children.split("").join(r)
|
|
64
|
+
}) : We(e) ? Se(e) ? /* @__PURE__ */ u.createElement("span", null, e.split("").join(r)) : /* @__PURE__ */ u.createElement("span", null, e) : Lt(e) ? /* @__PURE__ */ u.createElement("span", null, e) : e;
|
|
67
65
|
}
|
|
68
|
-
function
|
|
69
|
-
let
|
|
70
|
-
const
|
|
71
|
-
return
|
|
72
|
-
const i = typeof
|
|
73
|
-
if (
|
|
74
|
-
const
|
|
75
|
-
|
|
66
|
+
function Wt(e, t) {
|
|
67
|
+
let r = !1;
|
|
68
|
+
const o = [];
|
|
69
|
+
return u.Children.forEach(e, (n) => {
|
|
70
|
+
const i = typeof n, s = i === "string" || i === "number";
|
|
71
|
+
if (r && s) {
|
|
72
|
+
const a = o.length - 1, l = o[a];
|
|
73
|
+
o[a] = `${l}${n}`;
|
|
76
74
|
} else
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}),
|
|
75
|
+
o.push(n);
|
|
76
|
+
r = s;
|
|
77
|
+
}), u.Children.map(o, (n) => Gt(n, t));
|
|
80
78
|
}
|
|
81
|
-
const
|
|
79
|
+
const ke = /* @__PURE__ */ ie((e, t) => {
|
|
82
80
|
const {
|
|
83
|
-
className:
|
|
84
|
-
style:
|
|
85
|
-
children:
|
|
81
|
+
className: r,
|
|
82
|
+
style: o,
|
|
83
|
+
children: n,
|
|
86
84
|
prefixCls: i
|
|
87
|
-
} =
|
|
88
|
-
return /* @__PURE__ */
|
|
89
|
-
ref:
|
|
90
|
-
className:
|
|
91
|
-
style:
|
|
92
|
-
},
|
|
93
|
-
}),
|
|
85
|
+
} = e, s = L(`${i}-icon`, r);
|
|
86
|
+
return /* @__PURE__ */ u.createElement("span", {
|
|
87
|
+
ref: t,
|
|
88
|
+
className: s,
|
|
89
|
+
style: o
|
|
90
|
+
}, n);
|
|
91
|
+
}), Ve = /* @__PURE__ */ ie((e, t) => {
|
|
94
92
|
const {
|
|
95
|
-
prefixCls:
|
|
96
|
-
className:
|
|
97
|
-
style:
|
|
98
|
-
iconClassName: i
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
className: c,
|
|
107
|
-
style: r,
|
|
108
|
-
ref: e
|
|
109
|
-
}, /* @__PURE__ */ a.createElement(Xo, {
|
|
93
|
+
prefixCls: r,
|
|
94
|
+
className: o,
|
|
95
|
+
style: n,
|
|
96
|
+
iconClassName: i
|
|
97
|
+
} = e, s = L(`${r}-loading-icon`, o);
|
|
98
|
+
return /* @__PURE__ */ u.createElement(ke, {
|
|
99
|
+
prefixCls: r,
|
|
100
|
+
className: s,
|
|
101
|
+
style: n,
|
|
102
|
+
ref: t
|
|
103
|
+
}, /* @__PURE__ */ u.createElement(St, {
|
|
110
104
|
className: i
|
|
111
105
|
}));
|
|
112
|
-
}),
|
|
106
|
+
}), ve = () => ({
|
|
113
107
|
width: 0,
|
|
114
108
|
opacity: 0,
|
|
115
109
|
transform: "scale(0)"
|
|
116
|
-
}),
|
|
117
|
-
width:
|
|
110
|
+
}), be = (e) => ({
|
|
111
|
+
width: e.scrollWidth,
|
|
118
112
|
opacity: 1,
|
|
119
113
|
transform: "scale(1)"
|
|
120
|
-
}),
|
|
114
|
+
}), Vt = (e) => {
|
|
121
115
|
const {
|
|
122
|
-
prefixCls:
|
|
123
|
-
loading:
|
|
124
|
-
existIcon:
|
|
125
|
-
className:
|
|
126
|
-
style: i
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
}) : /* @__PURE__ */ a.createElement(ee, {
|
|
135
|
-
visible: c,
|
|
116
|
+
prefixCls: t,
|
|
117
|
+
loading: r,
|
|
118
|
+
existIcon: o,
|
|
119
|
+
className: n,
|
|
120
|
+
style: i
|
|
121
|
+
} = e, s = !!r;
|
|
122
|
+
return o ? /* @__PURE__ */ u.createElement(Ve, {
|
|
123
|
+
prefixCls: t,
|
|
124
|
+
className: n,
|
|
125
|
+
style: i
|
|
126
|
+
}) : /* @__PURE__ */ u.createElement(wt, {
|
|
127
|
+
visible: s,
|
|
136
128
|
// We do not really use this motionName
|
|
137
|
-
motionName: `${
|
|
138
|
-
motionLeave:
|
|
129
|
+
motionName: `${t}-loading-icon-motion`,
|
|
130
|
+
motionLeave: s,
|
|
139
131
|
removeOnLeave: !0,
|
|
140
|
-
onAppearStart:
|
|
141
|
-
onAppearActive:
|
|
142
|
-
onEnterStart:
|
|
143
|
-
onEnterActive:
|
|
144
|
-
onLeaveStart:
|
|
145
|
-
onLeaveActive:
|
|
146
|
-
}, (
|
|
132
|
+
onAppearStart: ve,
|
|
133
|
+
onAppearActive: be,
|
|
134
|
+
onEnterStart: ve,
|
|
135
|
+
onEnterActive: be,
|
|
136
|
+
onLeaveStart: be,
|
|
137
|
+
onLeaveActive: ve
|
|
138
|
+
}, (a, l) => {
|
|
147
139
|
let {
|
|
148
|
-
className:
|
|
149
|
-
style:
|
|
150
|
-
} =
|
|
151
|
-
return /* @__PURE__ */
|
|
152
|
-
prefixCls:
|
|
153
|
-
className:
|
|
154
|
-
style: Object.assign(Object.assign({}, i),
|
|
155
|
-
ref:
|
|
156
|
-
iconClassName:
|
|
157
|
-
iconPosition: l
|
|
140
|
+
className: c,
|
|
141
|
+
style: d
|
|
142
|
+
} = a;
|
|
143
|
+
return /* @__PURE__ */ u.createElement(Ve, {
|
|
144
|
+
prefixCls: t,
|
|
145
|
+
className: n,
|
|
146
|
+
style: Object.assign(Object.assign({}, i), d),
|
|
147
|
+
ref: l,
|
|
148
|
+
iconClassName: c
|
|
158
149
|
});
|
|
159
150
|
});
|
|
160
|
-
},
|
|
151
|
+
}, Fe = (e, t) => ({
|
|
161
152
|
// Border
|
|
162
|
-
[`> span, > ${
|
|
153
|
+
[`> span, > ${e}`]: {
|
|
163
154
|
"&:not(:last-child)": {
|
|
164
|
-
[`&, & > ${
|
|
155
|
+
[`&, & > ${e}`]: {
|
|
165
156
|
"&:not(:disabled)": {
|
|
166
|
-
borderInlineEndColor:
|
|
157
|
+
borderInlineEndColor: t
|
|
167
158
|
}
|
|
168
159
|
}
|
|
169
160
|
},
|
|
170
161
|
"&:not(:first-child)": {
|
|
171
|
-
[`&, & > ${
|
|
162
|
+
[`&, & > ${e}`]: {
|
|
172
163
|
"&:not(:disabled)": {
|
|
173
|
-
borderInlineStartColor:
|
|
164
|
+
borderInlineStartColor: t
|
|
174
165
|
}
|
|
175
166
|
}
|
|
176
167
|
}
|
|
177
168
|
}
|
|
178
|
-
}),
|
|
169
|
+
}), Ft = (e) => {
|
|
179
170
|
const {
|
|
180
|
-
componentCls:
|
|
181
|
-
fontSize:
|
|
182
|
-
lineWidth:
|
|
183
|
-
groupBorderColor:
|
|
171
|
+
componentCls: t,
|
|
172
|
+
fontSize: r,
|
|
173
|
+
lineWidth: o,
|
|
174
|
+
groupBorderColor: n,
|
|
184
175
|
colorErrorHover: i
|
|
185
|
-
} =
|
|
176
|
+
} = e;
|
|
186
177
|
return {
|
|
187
|
-
[`${
|
|
178
|
+
[`${t}-group`]: [
|
|
188
179
|
{
|
|
189
180
|
position: "relative",
|
|
190
181
|
display: "inline-flex",
|
|
191
182
|
// Border
|
|
192
|
-
[`> span, > ${
|
|
183
|
+
[`> span, > ${t}`]: {
|
|
193
184
|
"&:not(:last-child)": {
|
|
194
|
-
[`&, & > ${
|
|
185
|
+
[`&, & > ${t}`]: {
|
|
195
186
|
borderStartEndRadius: 0,
|
|
196
187
|
borderEndEndRadius: 0
|
|
197
188
|
}
|
|
198
189
|
},
|
|
199
190
|
"&:not(:first-child)": {
|
|
200
|
-
marginInlineStart:
|
|
201
|
-
[`&, & > ${
|
|
191
|
+
marginInlineStart: e.calc(o).mul(-1).equal(),
|
|
192
|
+
[`&, & > ${t}`]: {
|
|
202
193
|
borderStartStartRadius: 0,
|
|
203
194
|
borderEndStartRadius: 0
|
|
204
195
|
}
|
|
205
196
|
}
|
|
206
197
|
},
|
|
207
|
-
[
|
|
198
|
+
[t]: {
|
|
208
199
|
position: "relative",
|
|
209
200
|
zIndex: 1,
|
|
210
|
-
"&:hover
|
|
201
|
+
"&:hover, &:focus, &:active": {
|
|
211
202
|
zIndex: 2
|
|
212
203
|
},
|
|
213
204
|
"&[disabled]": {
|
|
214
205
|
zIndex: 0
|
|
215
206
|
}
|
|
216
207
|
},
|
|
217
|
-
[`${
|
|
218
|
-
fontSize:
|
|
208
|
+
[`${t}-icon-only`]: {
|
|
209
|
+
fontSize: r
|
|
219
210
|
}
|
|
220
211
|
},
|
|
221
212
|
// Border Color
|
|
222
|
-
|
|
223
|
-
|
|
213
|
+
Fe(`${t}-primary`, n),
|
|
214
|
+
Fe(`${t}-danger`, i)
|
|
224
215
|
]
|
|
225
216
|
};
|
|
226
|
-
},
|
|
217
|
+
}, $ = Math.round;
|
|
218
|
+
function pe(e, t) {
|
|
219
|
+
const r = e.replace(/^[^(]*\((.*)/, "$1").replace(/\).*/, "").match(/\d*\.?\d+%?/g) || [], o = r.map((n) => parseFloat(n));
|
|
220
|
+
for (let n = 0; n < 3; n += 1)
|
|
221
|
+
o[n] = t(o[n] || 0, r[n] || "", n);
|
|
222
|
+
return r[3] ? o[3] = r[3].includes("%") ? o[3] / 100 : o[3] : o[3] = 1, o;
|
|
223
|
+
}
|
|
224
|
+
const qe = (e, t, r) => r === 0 ? e : e / 100;
|
|
225
|
+
function k(e, t) {
|
|
226
|
+
const r = t || 255;
|
|
227
|
+
return e > r ? r : e < 0 ? 0 : e;
|
|
228
|
+
}
|
|
229
|
+
class se {
|
|
230
|
+
constructor(t) {
|
|
231
|
+
_(this, "isValid", !0), _(this, "r", 0), _(this, "g", 0), _(this, "b", 0), _(this, "a", 1), _(this, "_h", void 0), _(this, "_s", void 0), _(this, "_l", void 0), _(this, "_v", void 0), _(this, "_max", void 0), _(this, "_min", void 0), _(this, "_brightness", void 0);
|
|
232
|
+
function r(o) {
|
|
233
|
+
return o[0] in t && o[1] in t && o[2] in t;
|
|
234
|
+
}
|
|
235
|
+
if (t) if (typeof t == "string") {
|
|
236
|
+
let n = function(i) {
|
|
237
|
+
return o.startsWith(i);
|
|
238
|
+
};
|
|
239
|
+
const o = t.trim();
|
|
240
|
+
/^#?[A-F\d]{3,8}$/i.test(o) ? this.fromHexString(o) : n("rgb") ? this.fromRgbString(o) : n("hsl") ? this.fromHslString(o) : (n("hsv") || n("hsb")) && this.fromHsvString(o);
|
|
241
|
+
} else if (t instanceof se)
|
|
242
|
+
this.r = t.r, this.g = t.g, this.b = t.b, this.a = t.a, this._h = t._h, this._s = t._s, this._l = t._l, this._v = t._v;
|
|
243
|
+
else if (r("rgb"))
|
|
244
|
+
this.r = k(t.r), this.g = k(t.g), this.b = k(t.b), this.a = typeof t.a == "number" ? k(t.a, 1) : 1;
|
|
245
|
+
else if (r("hsl"))
|
|
246
|
+
this.fromHsl(t);
|
|
247
|
+
else if (r("hsv"))
|
|
248
|
+
this.fromHsv(t);
|
|
249
|
+
else
|
|
250
|
+
throw new Error("@ant-design/fast-color: unsupported input " + JSON.stringify(t));
|
|
251
|
+
}
|
|
252
|
+
// ======================= Setter =======================
|
|
253
|
+
setR(t) {
|
|
254
|
+
return this._sc("r", t);
|
|
255
|
+
}
|
|
256
|
+
setG(t) {
|
|
257
|
+
return this._sc("g", t);
|
|
258
|
+
}
|
|
259
|
+
setB(t) {
|
|
260
|
+
return this._sc("b", t);
|
|
261
|
+
}
|
|
262
|
+
setA(t) {
|
|
263
|
+
return this._sc("a", t, 1);
|
|
264
|
+
}
|
|
265
|
+
setHue(t) {
|
|
266
|
+
const r = this.toHsv();
|
|
267
|
+
return r.h = t, this._c(r);
|
|
268
|
+
}
|
|
269
|
+
// ======================= Getter =======================
|
|
270
|
+
/**
|
|
271
|
+
* Returns the perceived luminance of a color, from 0-1.
|
|
272
|
+
* @see http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef
|
|
273
|
+
*/
|
|
274
|
+
getLuminance() {
|
|
275
|
+
function t(i) {
|
|
276
|
+
const s = i / 255;
|
|
277
|
+
return s <= 0.03928 ? s / 12.92 : Math.pow((s + 0.055) / 1.055, 2.4);
|
|
278
|
+
}
|
|
279
|
+
const r = t(this.r), o = t(this.g), n = t(this.b);
|
|
280
|
+
return 0.2126 * r + 0.7152 * o + 0.0722 * n;
|
|
281
|
+
}
|
|
282
|
+
getHue() {
|
|
283
|
+
if (typeof this._h > "u") {
|
|
284
|
+
const t = this.getMax() - this.getMin();
|
|
285
|
+
t === 0 ? this._h = 0 : this._h = $(60 * (this.r === this.getMax() ? (this.g - this.b) / t + (this.g < this.b ? 6 : 0) : this.g === this.getMax() ? (this.b - this.r) / t + 2 : (this.r - this.g) / t + 4));
|
|
286
|
+
}
|
|
287
|
+
return this._h;
|
|
288
|
+
}
|
|
289
|
+
getSaturation() {
|
|
290
|
+
if (typeof this._s > "u") {
|
|
291
|
+
const t = this.getMax() - this.getMin();
|
|
292
|
+
t === 0 ? this._s = 0 : this._s = t / this.getMax();
|
|
293
|
+
}
|
|
294
|
+
return this._s;
|
|
295
|
+
}
|
|
296
|
+
getLightness() {
|
|
297
|
+
return typeof this._l > "u" && (this._l = (this.getMax() + this.getMin()) / 510), this._l;
|
|
298
|
+
}
|
|
299
|
+
getValue() {
|
|
300
|
+
return typeof this._v > "u" && (this._v = this.getMax() / 255), this._v;
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Returns the perceived brightness of the color, from 0-255.
|
|
304
|
+
* Note: this is not the b of HSB
|
|
305
|
+
* @see http://www.w3.org/TR/AERT#color-contrast
|
|
306
|
+
*/
|
|
307
|
+
getBrightness() {
|
|
308
|
+
return typeof this._brightness > "u" && (this._brightness = (this.r * 299 + this.g * 587 + this.b * 114) / 1e3), this._brightness;
|
|
309
|
+
}
|
|
310
|
+
// ======================== Func ========================
|
|
311
|
+
darken(t = 10) {
|
|
312
|
+
const r = this.getHue(), o = this.getSaturation();
|
|
313
|
+
let n = this.getLightness() - t / 100;
|
|
314
|
+
return n < 0 && (n = 0), this._c({
|
|
315
|
+
h: r,
|
|
316
|
+
s: o,
|
|
317
|
+
l: n,
|
|
318
|
+
a: this.a
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
lighten(t = 10) {
|
|
322
|
+
const r = this.getHue(), o = this.getSaturation();
|
|
323
|
+
let n = this.getLightness() + t / 100;
|
|
324
|
+
return n > 1 && (n = 1), this._c({
|
|
325
|
+
h: r,
|
|
326
|
+
s: o,
|
|
327
|
+
l: n,
|
|
328
|
+
a: this.a
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* Mix the current color a given amount with another color, from 0 to 100.
|
|
333
|
+
* 0 means no mixing (return current color).
|
|
334
|
+
*/
|
|
335
|
+
mix(t, r = 50) {
|
|
336
|
+
const o = this._c(t), n = r / 100, i = (a) => (o[a] - this[a]) * n + this[a], s = {
|
|
337
|
+
r: $(i("r")),
|
|
338
|
+
g: $(i("g")),
|
|
339
|
+
b: $(i("b")),
|
|
340
|
+
a: $(i("a") * 100) / 100
|
|
341
|
+
};
|
|
342
|
+
return this._c(s);
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* Mix the color with pure white, from 0 to 100.
|
|
346
|
+
* Providing 0 will do nothing, providing 100 will always return white.
|
|
347
|
+
*/
|
|
348
|
+
tint(t = 10) {
|
|
349
|
+
return this.mix({
|
|
350
|
+
r: 255,
|
|
351
|
+
g: 255,
|
|
352
|
+
b: 255,
|
|
353
|
+
a: 1
|
|
354
|
+
}, t);
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* Mix the color with pure black, from 0 to 100.
|
|
358
|
+
* Providing 0 will do nothing, providing 100 will always return black.
|
|
359
|
+
*/
|
|
360
|
+
shade(t = 10) {
|
|
361
|
+
return this.mix({
|
|
362
|
+
r: 0,
|
|
363
|
+
g: 0,
|
|
364
|
+
b: 0,
|
|
365
|
+
a: 1
|
|
366
|
+
}, t);
|
|
367
|
+
}
|
|
368
|
+
onBackground(t) {
|
|
369
|
+
const r = this._c(t), o = this.a + r.a * (1 - this.a), n = (i) => $((this[i] * this.a + r[i] * r.a * (1 - this.a)) / o);
|
|
370
|
+
return this._c({
|
|
371
|
+
r: n("r"),
|
|
372
|
+
g: n("g"),
|
|
373
|
+
b: n("b"),
|
|
374
|
+
a: o
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
// ======================= Status =======================
|
|
378
|
+
isDark() {
|
|
379
|
+
return this.getBrightness() < 128;
|
|
380
|
+
}
|
|
381
|
+
isLight() {
|
|
382
|
+
return this.getBrightness() >= 128;
|
|
383
|
+
}
|
|
384
|
+
// ======================== MISC ========================
|
|
385
|
+
equals(t) {
|
|
386
|
+
return this.r === t.r && this.g === t.g && this.b === t.b && this.a === t.a;
|
|
387
|
+
}
|
|
388
|
+
clone() {
|
|
389
|
+
return this._c(this);
|
|
390
|
+
}
|
|
391
|
+
// ======================= Format =======================
|
|
392
|
+
toHexString() {
|
|
393
|
+
let t = "#";
|
|
394
|
+
const r = (this.r || 0).toString(16);
|
|
395
|
+
t += r.length === 2 ? r : "0" + r;
|
|
396
|
+
const o = (this.g || 0).toString(16);
|
|
397
|
+
t += o.length === 2 ? o : "0" + o;
|
|
398
|
+
const n = (this.b || 0).toString(16);
|
|
399
|
+
if (t += n.length === 2 ? n : "0" + n, typeof this.a == "number" && this.a >= 0 && this.a < 1) {
|
|
400
|
+
const i = $(this.a * 255).toString(16);
|
|
401
|
+
t += i.length === 2 ? i : "0" + i;
|
|
402
|
+
}
|
|
403
|
+
return t;
|
|
404
|
+
}
|
|
405
|
+
/** CSS support color pattern */
|
|
406
|
+
toHsl() {
|
|
407
|
+
return {
|
|
408
|
+
h: this.getHue(),
|
|
409
|
+
s: this.getSaturation(),
|
|
410
|
+
l: this.getLightness(),
|
|
411
|
+
a: this.a
|
|
412
|
+
};
|
|
413
|
+
}
|
|
414
|
+
/** CSS support color pattern */
|
|
415
|
+
toHslString() {
|
|
416
|
+
const t = this.getHue(), r = $(this.getSaturation() * 100), o = $(this.getLightness() * 100);
|
|
417
|
+
return this.a !== 1 ? `hsla(${t},${r}%,${o}%,${this.a})` : `hsl(${t},${r}%,${o}%)`;
|
|
418
|
+
}
|
|
419
|
+
/** Same as toHsb */
|
|
420
|
+
toHsv() {
|
|
421
|
+
return {
|
|
422
|
+
h: this.getHue(),
|
|
423
|
+
s: this.getSaturation(),
|
|
424
|
+
v: this.getValue(),
|
|
425
|
+
a: this.a
|
|
426
|
+
};
|
|
427
|
+
}
|
|
428
|
+
toRgb() {
|
|
429
|
+
return {
|
|
430
|
+
r: this.r,
|
|
431
|
+
g: this.g,
|
|
432
|
+
b: this.b,
|
|
433
|
+
a: this.a
|
|
434
|
+
};
|
|
435
|
+
}
|
|
436
|
+
toRgbString() {
|
|
437
|
+
return this.a !== 1 ? `rgba(${this.r},${this.g},${this.b},${this.a})` : `rgb(${this.r},${this.g},${this.b})`;
|
|
438
|
+
}
|
|
439
|
+
toString() {
|
|
440
|
+
return this.toRgbString();
|
|
441
|
+
}
|
|
442
|
+
// ====================== Privates ======================
|
|
443
|
+
/** Return a new FastColor object with one channel changed */
|
|
444
|
+
_sc(t, r, o) {
|
|
445
|
+
const n = this.clone();
|
|
446
|
+
return n[t] = k(r, o), n;
|
|
447
|
+
}
|
|
448
|
+
_c(t) {
|
|
449
|
+
return new this.constructor(t);
|
|
450
|
+
}
|
|
451
|
+
getMax() {
|
|
452
|
+
return typeof this._max > "u" && (this._max = Math.max(this.r, this.g, this.b)), this._max;
|
|
453
|
+
}
|
|
454
|
+
getMin() {
|
|
455
|
+
return typeof this._min > "u" && (this._min = Math.min(this.r, this.g, this.b)), this._min;
|
|
456
|
+
}
|
|
457
|
+
fromHexString(t) {
|
|
458
|
+
const r = t.replace("#", "");
|
|
459
|
+
function o(n, i) {
|
|
460
|
+
return parseInt(r[n] + r[i || n], 16);
|
|
461
|
+
}
|
|
462
|
+
r.length < 6 ? (this.r = o(0), this.g = o(1), this.b = o(2), this.a = r[3] ? o(3) / 255 : 1) : (this.r = o(0, 1), this.g = o(2, 3), this.b = o(4, 5), this.a = r[6] ? o(6, 7) / 255 : 1);
|
|
463
|
+
}
|
|
464
|
+
fromHsl({
|
|
465
|
+
h: t,
|
|
466
|
+
s: r,
|
|
467
|
+
l: o,
|
|
468
|
+
a: n
|
|
469
|
+
}) {
|
|
470
|
+
if (this._h = t % 360, this._s = r, this._l = o, this.a = typeof n == "number" ? n : 1, r <= 0) {
|
|
471
|
+
const b = $(o * 255);
|
|
472
|
+
this.r = b, this.g = b, this.b = b;
|
|
473
|
+
}
|
|
474
|
+
let i = 0, s = 0, a = 0;
|
|
475
|
+
const l = t / 60, c = (1 - Math.abs(2 * o - 1)) * r, d = c * (1 - Math.abs(l % 2 - 1));
|
|
476
|
+
l >= 0 && l < 1 ? (i = c, s = d) : l >= 1 && l < 2 ? (i = d, s = c) : l >= 2 && l < 3 ? (s = c, a = d) : l >= 3 && l < 4 ? (s = d, a = c) : l >= 4 && l < 5 ? (i = d, a = c) : l >= 5 && l < 6 && (i = c, a = d);
|
|
477
|
+
const g = o - c / 2;
|
|
478
|
+
this.r = $((i + g) * 255), this.g = $((s + g) * 255), this.b = $((a + g) * 255);
|
|
479
|
+
}
|
|
480
|
+
fromHsv({
|
|
481
|
+
h: t,
|
|
482
|
+
s: r,
|
|
483
|
+
v: o,
|
|
484
|
+
a: n
|
|
485
|
+
}) {
|
|
486
|
+
this._h = t % 360, this._s = r, this._v = o, this.a = typeof n == "number" ? n : 1;
|
|
487
|
+
const i = $(o * 255);
|
|
488
|
+
if (this.r = i, this.g = i, this.b = i, r <= 0)
|
|
489
|
+
return;
|
|
490
|
+
const s = t / 60, a = Math.floor(s), l = s - a, c = $(o * (1 - r) * 255), d = $(o * (1 - r * l) * 255), g = $(o * (1 - r * (1 - l)) * 255);
|
|
491
|
+
switch (a) {
|
|
492
|
+
case 0:
|
|
493
|
+
this.g = g, this.b = c;
|
|
494
|
+
break;
|
|
495
|
+
case 1:
|
|
496
|
+
this.r = d, this.b = c;
|
|
497
|
+
break;
|
|
498
|
+
case 2:
|
|
499
|
+
this.r = c, this.b = g;
|
|
500
|
+
break;
|
|
501
|
+
case 3:
|
|
502
|
+
this.r = c, this.g = d;
|
|
503
|
+
break;
|
|
504
|
+
case 4:
|
|
505
|
+
this.r = g, this.g = c;
|
|
506
|
+
break;
|
|
507
|
+
case 5:
|
|
508
|
+
default:
|
|
509
|
+
this.g = c, this.b = d;
|
|
510
|
+
break;
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
fromHsvString(t) {
|
|
514
|
+
const r = pe(t, qe);
|
|
515
|
+
this.fromHsv({
|
|
516
|
+
h: r[0],
|
|
517
|
+
s: r[1],
|
|
518
|
+
v: r[2],
|
|
519
|
+
a: r[3]
|
|
520
|
+
});
|
|
521
|
+
}
|
|
522
|
+
fromHslString(t) {
|
|
523
|
+
const r = pe(t, qe);
|
|
524
|
+
this.fromHsl({
|
|
525
|
+
h: r[0],
|
|
526
|
+
s: r[1],
|
|
527
|
+
l: r[2],
|
|
528
|
+
a: r[3]
|
|
529
|
+
});
|
|
530
|
+
}
|
|
531
|
+
fromRgbString(t) {
|
|
532
|
+
const r = pe(t, (o, n) => (
|
|
533
|
+
// Convert percentage to number. e.g. 50% -> 128
|
|
534
|
+
n.includes("%") ? $(o / 100 * 255) : o
|
|
535
|
+
));
|
|
536
|
+
this.r = r[0], this.g = r[1], this.b = r[2], this.a = r[3];
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
var qt = ["b"], Xt = ["v"], Ce = function(t) {
|
|
540
|
+
return Math.round(Number(t || 0));
|
|
541
|
+
}, Yt = function(t) {
|
|
542
|
+
if (t instanceof se)
|
|
543
|
+
return t;
|
|
544
|
+
if (t && yt(t) === "object" && "h" in t && "b" in t) {
|
|
545
|
+
var r = t, o = r.b, n = Xe(r, qt);
|
|
546
|
+
return P(P({}, n), {}, {
|
|
547
|
+
v: o
|
|
548
|
+
});
|
|
549
|
+
}
|
|
550
|
+
return typeof t == "string" && /hsb/.test(t) ? t.replace(/hsb/, "hsv") : t;
|
|
551
|
+
}, D = /* @__PURE__ */ function(e) {
|
|
552
|
+
Nt(r, e);
|
|
553
|
+
var t = Pt(r);
|
|
554
|
+
function r(o) {
|
|
555
|
+
return Je(this, r), t.call(this, Yt(o));
|
|
556
|
+
}
|
|
557
|
+
return Ke(r, [{
|
|
558
|
+
key: "toHsbString",
|
|
559
|
+
value: function() {
|
|
560
|
+
var n = this.toHsb(), i = Ce(n.s * 100), s = Ce(n.b * 100), a = Ce(n.h), l = n.a, c = "hsb(".concat(a, ", ").concat(i, "%, ").concat(s, "%)"), d = "hsba(".concat(a, ", ").concat(i, "%, ").concat(s, "%, ").concat(l.toFixed(l === 0 ? 0 : 2), ")");
|
|
561
|
+
return l === 1 ? c : d;
|
|
562
|
+
}
|
|
563
|
+
}, {
|
|
564
|
+
key: "toHsb",
|
|
565
|
+
value: function() {
|
|
566
|
+
var n = this.toHsv(), i = n.v, s = Xe(n, Xt);
|
|
567
|
+
return P(P({}, s), {}, {
|
|
568
|
+
b: i,
|
|
569
|
+
a: this.a
|
|
570
|
+
});
|
|
571
|
+
}
|
|
572
|
+
}]), r;
|
|
573
|
+
}(se), Ut = "rc-color-picker", Y = function(t) {
|
|
574
|
+
return t instanceof D ? t : new D(t);
|
|
575
|
+
}, Jt = Y("#1677ff"), et = function(t) {
|
|
576
|
+
var r = t.offset, o = t.targetRef, n = t.containerRef, i = t.color, s = t.type, a = n.current.getBoundingClientRect(), l = a.width, c = a.height, d = o.current.getBoundingClientRect(), g = d.width, b = d.height, f = g / 2, p = b / 2, B = (r.x + f) / l, E = 1 - (r.y + p) / c, S = i.toHsb(), x = B, O = (r.x + f) / l * 360;
|
|
577
|
+
if (s)
|
|
578
|
+
switch (s) {
|
|
579
|
+
case "hue":
|
|
580
|
+
return Y(P(P({}, S), {}, {
|
|
581
|
+
h: O <= 0 ? 0 : O
|
|
582
|
+
}));
|
|
583
|
+
case "alpha":
|
|
584
|
+
return Y(P(P({}, S), {}, {
|
|
585
|
+
a: x <= 0 ? 0 : x
|
|
586
|
+
}));
|
|
587
|
+
}
|
|
588
|
+
return Y({
|
|
589
|
+
h: S.h,
|
|
590
|
+
s: B <= 0 ? 0 : B,
|
|
591
|
+
b: E >= 1 ? 1 : E,
|
|
592
|
+
a: S.a
|
|
593
|
+
});
|
|
594
|
+
}, tt = function(t, r) {
|
|
595
|
+
var o = t.toHsb();
|
|
596
|
+
switch (r) {
|
|
597
|
+
case "hue":
|
|
598
|
+
return {
|
|
599
|
+
x: o.h / 360 * 100,
|
|
600
|
+
y: 50
|
|
601
|
+
};
|
|
602
|
+
case "alpha":
|
|
603
|
+
return {
|
|
604
|
+
x: t.a * 100,
|
|
605
|
+
y: 50
|
|
606
|
+
};
|
|
607
|
+
default:
|
|
608
|
+
return {
|
|
609
|
+
x: o.s * 100,
|
|
610
|
+
y: (1 - o.b) * 100
|
|
611
|
+
};
|
|
612
|
+
}
|
|
613
|
+
}, Kt = function(t) {
|
|
614
|
+
var r = t.color, o = t.prefixCls, n = t.className, i = t.style, s = t.onClick, a = "".concat(o, "-color-block");
|
|
615
|
+
return /* @__PURE__ */ u.createElement("div", {
|
|
616
|
+
className: L(a, n),
|
|
617
|
+
style: i,
|
|
618
|
+
onClick: s
|
|
619
|
+
}, /* @__PURE__ */ u.createElement("div", {
|
|
620
|
+
className: "".concat(a, "-inner"),
|
|
621
|
+
style: {
|
|
622
|
+
background: r
|
|
623
|
+
}
|
|
624
|
+
}));
|
|
625
|
+
};
|
|
626
|
+
function Qt(e) {
|
|
627
|
+
var t = "touches" in e ? e.touches[0] : e, r = document.documentElement.scrollLeft || document.body.scrollLeft || window.pageXOffset, o = document.documentElement.scrollTop || document.body.scrollTop || window.pageYOffset;
|
|
628
|
+
return {
|
|
629
|
+
pageX: t.pageX - r,
|
|
630
|
+
pageY: t.pageY - o
|
|
631
|
+
};
|
|
632
|
+
}
|
|
633
|
+
function rt(e) {
|
|
634
|
+
var t = e.targetRef, r = e.containerRef, o = e.direction, n = e.onDragChange, i = e.onDragChangeComplete, s = e.calculate, a = e.color, l = e.disabledDrag, c = ye({
|
|
635
|
+
x: 0,
|
|
636
|
+
y: 0
|
|
637
|
+
}), d = U(c, 2), g = d[0], b = d[1], f = j(null), p = j(null);
|
|
638
|
+
ne(function() {
|
|
639
|
+
b(s());
|
|
640
|
+
}, [a]), ne(function() {
|
|
641
|
+
return function() {
|
|
642
|
+
document.removeEventListener("mousemove", f.current), document.removeEventListener("mouseup", p.current), document.removeEventListener("touchmove", f.current), document.removeEventListener("touchend", p.current), f.current = null, p.current = null;
|
|
643
|
+
};
|
|
644
|
+
}, []);
|
|
645
|
+
var B = function(h) {
|
|
646
|
+
var y = Qt(h), K = y.pageX, T = y.pageY, w = r.current.getBoundingClientRect(), z = w.x, M = w.y, A = w.width, F = w.height, R = t.current.getBoundingClientRect(), q = R.width, I = R.height, G = q / 2, W = I / 2, m = Math.max(0, Math.min(K - z, A)) - G, C = Math.max(0, Math.min(T - M, F)) - W, v = {
|
|
647
|
+
x: m,
|
|
648
|
+
y: o === "x" ? g.y : C
|
|
649
|
+
};
|
|
650
|
+
if (q === 0 && I === 0 || q !== I)
|
|
651
|
+
return !1;
|
|
652
|
+
n == null || n(v);
|
|
653
|
+
}, E = function(h) {
|
|
654
|
+
h.preventDefault(), B(h);
|
|
655
|
+
}, S = function(h) {
|
|
656
|
+
h.preventDefault(), document.removeEventListener("mousemove", f.current), document.removeEventListener("mouseup", p.current), document.removeEventListener("touchmove", f.current), document.removeEventListener("touchend", p.current), f.current = null, p.current = null, i == null || i();
|
|
657
|
+
}, x = function(h) {
|
|
658
|
+
document.removeEventListener("mousemove", f.current), document.removeEventListener("mouseup", p.current), !l && (B(h), document.addEventListener("mousemove", E), document.addEventListener("mouseup", S), document.addEventListener("touchmove", E), document.addEventListener("touchend", S), f.current = E, p.current = S);
|
|
659
|
+
};
|
|
660
|
+
return [g, x];
|
|
661
|
+
}
|
|
662
|
+
var ot = function(t) {
|
|
663
|
+
var r = t.size, o = r === void 0 ? "default" : r, n = t.color, i = t.prefixCls;
|
|
664
|
+
return /* @__PURE__ */ u.createElement("div", {
|
|
665
|
+
className: L("".concat(i, "-handler"), _({}, "".concat(i, "-handler-sm"), o === "small")),
|
|
666
|
+
style: {
|
|
667
|
+
backgroundColor: n
|
|
668
|
+
}
|
|
669
|
+
});
|
|
670
|
+
}, nt = function(t) {
|
|
671
|
+
var r = t.children, o = t.style, n = t.prefixCls;
|
|
672
|
+
return /* @__PURE__ */ u.createElement("div", {
|
|
673
|
+
className: "".concat(n, "-palette"),
|
|
674
|
+
style: P({
|
|
675
|
+
position: "relative"
|
|
676
|
+
}, o)
|
|
677
|
+
}, r);
|
|
678
|
+
}, it = /* @__PURE__ */ ie(function(e, t) {
|
|
679
|
+
var r = e.children, o = e.x, n = e.y;
|
|
680
|
+
return /* @__PURE__ */ u.createElement("div", {
|
|
681
|
+
ref: t,
|
|
682
|
+
style: {
|
|
683
|
+
position: "absolute",
|
|
684
|
+
left: "".concat(o, "%"),
|
|
685
|
+
top: "".concat(n, "%"),
|
|
686
|
+
zIndex: 1,
|
|
687
|
+
transform: "translate(-50%, -50%)"
|
|
688
|
+
}
|
|
689
|
+
}, r);
|
|
690
|
+
}), Zt = function(t) {
|
|
691
|
+
var r = t.color, o = t.onChange, n = t.prefixCls, i = t.onChangeComplete, s = t.disabled, a = j(), l = j(), c = j(r), d = Qe(function(B) {
|
|
692
|
+
var E = et({
|
|
693
|
+
offset: B,
|
|
694
|
+
targetRef: l,
|
|
695
|
+
containerRef: a,
|
|
696
|
+
color: r
|
|
697
|
+
});
|
|
698
|
+
c.current = E, o(E);
|
|
699
|
+
}), g = rt({
|
|
700
|
+
color: r,
|
|
701
|
+
containerRef: a,
|
|
702
|
+
targetRef: l,
|
|
703
|
+
calculate: function() {
|
|
704
|
+
return tt(r);
|
|
705
|
+
},
|
|
706
|
+
onDragChange: d,
|
|
707
|
+
onDragChangeComplete: function() {
|
|
708
|
+
return i == null ? void 0 : i(c.current);
|
|
709
|
+
},
|
|
710
|
+
disabledDrag: s
|
|
711
|
+
}), b = U(g, 2), f = b[0], p = b[1];
|
|
712
|
+
return /* @__PURE__ */ u.createElement("div", {
|
|
713
|
+
ref: a,
|
|
714
|
+
className: "".concat(n, "-select"),
|
|
715
|
+
onMouseDown: p,
|
|
716
|
+
onTouchStart: p
|
|
717
|
+
}, /* @__PURE__ */ u.createElement(nt, {
|
|
718
|
+
prefixCls: n
|
|
719
|
+
}, /* @__PURE__ */ u.createElement(it, {
|
|
720
|
+
x: f.x,
|
|
721
|
+
y: f.y,
|
|
722
|
+
ref: l
|
|
723
|
+
}, /* @__PURE__ */ u.createElement(ot, {
|
|
724
|
+
color: r.toRgbString(),
|
|
725
|
+
prefixCls: n
|
|
726
|
+
})), /* @__PURE__ */ u.createElement("div", {
|
|
727
|
+
className: "".concat(n, "-saturation"),
|
|
728
|
+
style: {
|
|
729
|
+
backgroundColor: "hsl(".concat(r.toHsb().h, ",100%, 50%)"),
|
|
730
|
+
backgroundImage: "linear-gradient(0deg, #000, transparent),linear-gradient(90deg, #fff, hsla(0, 0%, 100%, 0))"
|
|
731
|
+
}
|
|
732
|
+
})));
|
|
733
|
+
}, kt = function(t, r) {
|
|
734
|
+
var o = xt(t, {
|
|
735
|
+
value: r
|
|
736
|
+
}), n = U(o, 2), i = n[0], s = n[1], a = te(function() {
|
|
737
|
+
return Y(i);
|
|
738
|
+
}, [i]);
|
|
739
|
+
return [a, s];
|
|
740
|
+
}, er = function(t) {
|
|
741
|
+
var r = t.colors, o = t.children, n = t.direction, i = n === void 0 ? "to right" : n, s = t.type, a = t.prefixCls, l = te(function() {
|
|
742
|
+
return r.map(function(c, d) {
|
|
743
|
+
var g = Y(c);
|
|
744
|
+
return s === "alpha" && d === r.length - 1 && (g = new D(g.setA(1))), g.toRgbString();
|
|
745
|
+
}).join(",");
|
|
746
|
+
}, [r, s]);
|
|
747
|
+
return /* @__PURE__ */ u.createElement("div", {
|
|
748
|
+
className: "".concat(a, "-gradient"),
|
|
749
|
+
style: {
|
|
750
|
+
position: "absolute",
|
|
751
|
+
inset: 0,
|
|
752
|
+
background: "linear-gradient(".concat(i, ", ").concat(l, ")")
|
|
753
|
+
}
|
|
754
|
+
}, o);
|
|
755
|
+
}, tr = function(t) {
|
|
756
|
+
var r = t.prefixCls, o = t.colors, n = t.disabled, i = t.onChange, s = t.onChangeComplete, a = t.color, l = t.type, c = j(), d = j(), g = j(a), b = function(y) {
|
|
757
|
+
return l === "hue" ? y.getHue() : y.a * 100;
|
|
758
|
+
}, f = Qe(function(h) {
|
|
759
|
+
var y = et({
|
|
760
|
+
offset: h,
|
|
761
|
+
targetRef: d,
|
|
762
|
+
containerRef: c,
|
|
763
|
+
color: a,
|
|
764
|
+
type: l
|
|
765
|
+
});
|
|
766
|
+
g.current = y, i(b(y));
|
|
767
|
+
}), p = rt({
|
|
768
|
+
color: a,
|
|
769
|
+
targetRef: d,
|
|
770
|
+
containerRef: c,
|
|
771
|
+
calculate: function() {
|
|
772
|
+
return tt(a, l);
|
|
773
|
+
},
|
|
774
|
+
onDragChange: f,
|
|
775
|
+
onDragChangeComplete: function() {
|
|
776
|
+
s(b(g.current));
|
|
777
|
+
},
|
|
778
|
+
direction: "x",
|
|
779
|
+
disabledDrag: n
|
|
780
|
+
}), B = U(p, 2), E = B[0], S = B[1], x = u.useMemo(function() {
|
|
781
|
+
if (l === "hue") {
|
|
782
|
+
var h = a.toHsb();
|
|
783
|
+
h.s = 1, h.b = 1, h.a = 1;
|
|
784
|
+
var y = new D(h);
|
|
785
|
+
return y;
|
|
786
|
+
}
|
|
787
|
+
return a;
|
|
788
|
+
}, [a, l]), O = u.useMemo(function() {
|
|
789
|
+
return o.map(function(h) {
|
|
790
|
+
return "".concat(h.color, " ").concat(h.percent, "%");
|
|
791
|
+
});
|
|
792
|
+
}, [o]);
|
|
793
|
+
return /* @__PURE__ */ u.createElement("div", {
|
|
794
|
+
ref: c,
|
|
795
|
+
className: L("".concat(r, "-slider"), "".concat(r, "-slider-").concat(l)),
|
|
796
|
+
onMouseDown: S,
|
|
797
|
+
onTouchStart: S
|
|
798
|
+
}, /* @__PURE__ */ u.createElement(nt, {
|
|
799
|
+
prefixCls: r
|
|
800
|
+
}, /* @__PURE__ */ u.createElement(it, {
|
|
801
|
+
x: E.x,
|
|
802
|
+
y: E.y,
|
|
803
|
+
ref: d
|
|
804
|
+
}, /* @__PURE__ */ u.createElement(ot, {
|
|
805
|
+
size: "small",
|
|
806
|
+
color: x.toHexString(),
|
|
807
|
+
prefixCls: r
|
|
808
|
+
})), /* @__PURE__ */ u.createElement(er, {
|
|
809
|
+
colors: O,
|
|
810
|
+
type: l,
|
|
811
|
+
prefixCls: r
|
|
812
|
+
})));
|
|
813
|
+
};
|
|
814
|
+
function rr(e) {
|
|
815
|
+
return ee.useMemo(function() {
|
|
816
|
+
var t = e || {}, r = t.slider;
|
|
817
|
+
return [r || tr];
|
|
818
|
+
}, [e]);
|
|
819
|
+
}
|
|
820
|
+
var or = [{
|
|
821
|
+
color: "rgb(255, 0, 0)",
|
|
822
|
+
percent: 0
|
|
823
|
+
}, {
|
|
824
|
+
color: "rgb(255, 255, 0)",
|
|
825
|
+
percent: 17
|
|
826
|
+
}, {
|
|
827
|
+
color: "rgb(0, 255, 0)",
|
|
828
|
+
percent: 33
|
|
829
|
+
}, {
|
|
830
|
+
color: "rgb(0, 255, 255)",
|
|
831
|
+
percent: 50
|
|
832
|
+
}, {
|
|
833
|
+
color: "rgb(0, 0, 255)",
|
|
834
|
+
percent: 67
|
|
835
|
+
}, {
|
|
836
|
+
color: "rgb(255, 0, 255)",
|
|
837
|
+
percent: 83
|
|
838
|
+
}, {
|
|
839
|
+
color: "rgb(255, 0, 0)",
|
|
840
|
+
percent: 100
|
|
841
|
+
}], nr = /* @__PURE__ */ ie(function(e, t) {
|
|
842
|
+
var r = e.value, o = e.defaultValue, n = e.prefixCls, i = n === void 0 ? Ut : n, s = e.onChange, a = e.onChangeComplete, l = e.className, c = e.style, d = e.panelRender, g = e.disabledAlpha, b = g === void 0 ? !1 : g, f = e.disabled, p = f === void 0 ? !1 : f, B = e.components, E = rr(B), S = U(E, 1), x = S[0], O = kt(o || Jt, r), h = U(O, 2), y = h[0], K = h[1], T = te(function() {
|
|
843
|
+
return y.setA(1).toRgbString();
|
|
844
|
+
}, [y]), w = function(C, v) {
|
|
845
|
+
r || K(C), s == null || s(C, v);
|
|
846
|
+
}, z = function(C) {
|
|
847
|
+
return new D(y.setHue(C));
|
|
848
|
+
}, M = function(C) {
|
|
849
|
+
return new D(y.setA(C / 100));
|
|
850
|
+
}, A = function(C) {
|
|
851
|
+
w(z(C), {
|
|
852
|
+
type: "hue",
|
|
853
|
+
value: C
|
|
854
|
+
});
|
|
855
|
+
}, F = function(C) {
|
|
856
|
+
w(M(C), {
|
|
857
|
+
type: "alpha",
|
|
858
|
+
value: C
|
|
859
|
+
});
|
|
860
|
+
}, R = function(C) {
|
|
861
|
+
a && a(z(C));
|
|
862
|
+
}, q = function(C) {
|
|
863
|
+
a && a(M(C));
|
|
864
|
+
}, I = L("".concat(i, "-panel"), l, _({}, "".concat(i, "-panel-disabled"), p)), G = {
|
|
865
|
+
prefixCls: i,
|
|
866
|
+
disabled: p,
|
|
867
|
+
color: y
|
|
868
|
+
}, W = /* @__PURE__ */ u.createElement(u.Fragment, null, /* @__PURE__ */ u.createElement(Zt, fe({
|
|
869
|
+
onChange: w
|
|
870
|
+
}, G, {
|
|
871
|
+
onChangeComplete: a
|
|
872
|
+
})), /* @__PURE__ */ u.createElement("div", {
|
|
873
|
+
className: "".concat(i, "-slider-container")
|
|
874
|
+
}, /* @__PURE__ */ u.createElement("div", {
|
|
875
|
+
className: L("".concat(i, "-slider-group"), _({}, "".concat(i, "-slider-group-disabled-alpha"), b))
|
|
876
|
+
}, /* @__PURE__ */ u.createElement(x, fe({}, G, {
|
|
877
|
+
type: "hue",
|
|
878
|
+
colors: or,
|
|
879
|
+
min: 0,
|
|
880
|
+
max: 359,
|
|
881
|
+
value: y.getHue(),
|
|
882
|
+
onChange: A,
|
|
883
|
+
onChangeComplete: R
|
|
884
|
+
})), !b && /* @__PURE__ */ u.createElement(x, fe({}, G, {
|
|
885
|
+
type: "alpha",
|
|
886
|
+
colors: [{
|
|
887
|
+
percent: 0,
|
|
888
|
+
color: "rgba(255, 0, 4, 0)"
|
|
889
|
+
}, {
|
|
890
|
+
percent: 100,
|
|
891
|
+
color: T
|
|
892
|
+
}],
|
|
893
|
+
min: 0,
|
|
894
|
+
max: 100,
|
|
895
|
+
value: y.a * 100,
|
|
896
|
+
onChange: F,
|
|
897
|
+
onChangeComplete: q
|
|
898
|
+
}))), /* @__PURE__ */ u.createElement(Kt, {
|
|
899
|
+
color: y.toRgbString(),
|
|
900
|
+
prefixCls: i
|
|
901
|
+
})));
|
|
902
|
+
return /* @__PURE__ */ u.createElement("div", {
|
|
903
|
+
className: I,
|
|
904
|
+
style: c,
|
|
905
|
+
ref: t
|
|
906
|
+
}, typeof d == "function" ? d(W) : W);
|
|
907
|
+
});
|
|
908
|
+
process.env.NODE_ENV !== "production" && (nr.displayName = "ColorPicker");
|
|
909
|
+
const ir = (e, t) => (e == null ? void 0 : e.replace(/[^\w/]/g, "").slice(0, t ? 8 : 6)) || "", ar = (e, t) => e ? ir(e, t) : "";
|
|
910
|
+
let sr = /* @__PURE__ */ function() {
|
|
911
|
+
function e(t) {
|
|
912
|
+
Je(this, e);
|
|
913
|
+
var r;
|
|
914
|
+
if (this.cleared = !1, t instanceof e) {
|
|
915
|
+
this.metaColor = t.metaColor.clone(), this.colors = (r = t.colors) === null || r === void 0 ? void 0 : r.map((n) => ({
|
|
916
|
+
color: new e(n.color),
|
|
917
|
+
percent: n.percent
|
|
918
|
+
})), this.cleared = t.cleared;
|
|
919
|
+
return;
|
|
920
|
+
}
|
|
921
|
+
const o = Array.isArray(t);
|
|
922
|
+
o && t.length ? (this.colors = t.map((n) => {
|
|
923
|
+
let {
|
|
924
|
+
color: i,
|
|
925
|
+
percent: s
|
|
926
|
+
} = n;
|
|
927
|
+
return {
|
|
928
|
+
color: new e(i),
|
|
929
|
+
percent: s
|
|
930
|
+
};
|
|
931
|
+
}), this.metaColor = new D(this.colors[0].color.metaColor)) : this.metaColor = new D(o ? "" : t), (!t || o && !this.colors) && (this.metaColor = this.metaColor.setA(0), this.cleared = !0);
|
|
932
|
+
}
|
|
933
|
+
return Ke(e, [{
|
|
934
|
+
key: "toHsb",
|
|
935
|
+
value: function() {
|
|
936
|
+
return this.metaColor.toHsb();
|
|
937
|
+
}
|
|
938
|
+
}, {
|
|
939
|
+
key: "toHsbString",
|
|
940
|
+
value: function() {
|
|
941
|
+
return this.metaColor.toHsbString();
|
|
942
|
+
}
|
|
943
|
+
}, {
|
|
944
|
+
key: "toHex",
|
|
945
|
+
value: function() {
|
|
946
|
+
return ar(this.toHexString(), this.metaColor.a < 1);
|
|
947
|
+
}
|
|
948
|
+
}, {
|
|
949
|
+
key: "toHexString",
|
|
950
|
+
value: function() {
|
|
951
|
+
return this.metaColor.toHexString();
|
|
952
|
+
}
|
|
953
|
+
}, {
|
|
954
|
+
key: "toRgb",
|
|
955
|
+
value: function() {
|
|
956
|
+
return this.metaColor.toRgb();
|
|
957
|
+
}
|
|
958
|
+
}, {
|
|
959
|
+
key: "toRgbString",
|
|
960
|
+
value: function() {
|
|
961
|
+
return this.metaColor.toRgbString();
|
|
962
|
+
}
|
|
963
|
+
}, {
|
|
964
|
+
key: "isGradient",
|
|
965
|
+
value: function() {
|
|
966
|
+
return !!this.colors && !this.cleared;
|
|
967
|
+
}
|
|
968
|
+
}, {
|
|
969
|
+
key: "getColors",
|
|
970
|
+
value: function() {
|
|
971
|
+
return this.colors || [{
|
|
972
|
+
color: this,
|
|
973
|
+
percent: 0
|
|
974
|
+
}];
|
|
975
|
+
}
|
|
976
|
+
}, {
|
|
977
|
+
key: "toCssString",
|
|
978
|
+
value: function() {
|
|
979
|
+
const {
|
|
980
|
+
colors: r
|
|
981
|
+
} = this;
|
|
982
|
+
return r ? `linear-gradient(90deg, ${r.map((n) => `${n.color.toRgbString()} ${n.percent}%`).join(", ")})` : this.metaColor.toRgbString();
|
|
983
|
+
}
|
|
984
|
+
}, {
|
|
985
|
+
key: "equals",
|
|
986
|
+
value: function(r) {
|
|
987
|
+
return !r || this.isGradient() !== r.isGradient() ? !1 : this.isGradient() ? this.colors.length === r.colors.length && this.colors.every((o, n) => {
|
|
988
|
+
const i = r.colors[n];
|
|
989
|
+
return o.percent === i.percent && o.color.equals(i.color);
|
|
990
|
+
}) : this.toHexString() === r.toHexString();
|
|
991
|
+
}
|
|
992
|
+
}]);
|
|
993
|
+
}();
|
|
994
|
+
const lr = (e, t) => {
|
|
227
995
|
const {
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
996
|
+
r,
|
|
997
|
+
g: o,
|
|
998
|
+
b: n,
|
|
999
|
+
a: i
|
|
1000
|
+
} = e.toRgb(), s = new D(e.toRgbString()).onBackground(t).toHsv();
|
|
1001
|
+
return i <= 0.5 ? s.v > 0.5 : r * 0.299 + o * 0.587 + n * 0.114 > 192;
|
|
1002
|
+
}, at = (e) => {
|
|
1003
|
+
const {
|
|
1004
|
+
paddingInline: t,
|
|
1005
|
+
onlyIconSize: r,
|
|
1006
|
+
paddingBlock: o
|
|
1007
|
+
} = e;
|
|
1008
|
+
return ae(e, {
|
|
1009
|
+
buttonPaddingHorizontal: t,
|
|
1010
|
+
buttonPaddingVertical: o,
|
|
1011
|
+
buttonIconOnlyFontSize: r
|
|
236
1012
|
});
|
|
237
|
-
},
|
|
238
|
-
var
|
|
239
|
-
const
|
|
1013
|
+
}, st = (e) => {
|
|
1014
|
+
var t, r, o, n, i, s;
|
|
1015
|
+
const a = (t = e.contentFontSize) !== null && t !== void 0 ? t : e.fontSize, l = (r = e.contentFontSizeSM) !== null && r !== void 0 ? r : e.fontSize, c = (o = e.contentFontSizeLG) !== null && o !== void 0 ? o : e.fontSizeLG, d = (n = e.contentLineHeight) !== null && n !== void 0 ? n : me(a), g = (i = e.contentLineHeightSM) !== null && i !== void 0 ? i : me(l), b = (s = e.contentLineHeightLG) !== null && s !== void 0 ? s : me(c), f = lr(new sr(e.colorBgSolid), "#fff") ? "#000" : "#fff";
|
|
240
1016
|
return {
|
|
241
1017
|
fontWeight: 400,
|
|
242
|
-
defaultShadow: `0 ${
|
|
243
|
-
primaryShadow: `0 ${
|
|
244
|
-
dangerShadow: `0 ${
|
|
245
|
-
primaryColor:
|
|
246
|
-
dangerColor:
|
|
247
|
-
borderColorDisabled:
|
|
248
|
-
defaultGhostColor:
|
|
1018
|
+
defaultShadow: `0 ${e.controlOutlineWidth}px 0 ${e.controlTmpOutline}`,
|
|
1019
|
+
primaryShadow: `0 ${e.controlOutlineWidth}px 0 ${e.controlOutline}`,
|
|
1020
|
+
dangerShadow: `0 ${e.controlOutlineWidth}px 0 ${e.colorErrorOutline}`,
|
|
1021
|
+
primaryColor: e.colorTextLightSolid,
|
|
1022
|
+
dangerColor: e.colorTextLightSolid,
|
|
1023
|
+
borderColorDisabled: e.colorBorder,
|
|
1024
|
+
defaultGhostColor: e.colorBgContainer,
|
|
249
1025
|
ghostBg: "transparent",
|
|
250
|
-
defaultGhostBorderColor:
|
|
251
|
-
paddingInline:
|
|
252
|
-
paddingInlineLG:
|
|
253
|
-
paddingInlineSM: 8 -
|
|
254
|
-
onlyIconSize:
|
|
255
|
-
onlyIconSizeSM:
|
|
256
|
-
onlyIconSizeLG:
|
|
257
|
-
groupBorderColor:
|
|
1026
|
+
defaultGhostBorderColor: e.colorBgContainer,
|
|
1027
|
+
paddingInline: e.paddingContentHorizontal - e.lineWidth,
|
|
1028
|
+
paddingInlineLG: e.paddingContentHorizontal - e.lineWidth,
|
|
1029
|
+
paddingInlineSM: 8 - e.lineWidth,
|
|
1030
|
+
onlyIconSize: e.fontSizeLG,
|
|
1031
|
+
onlyIconSizeSM: e.fontSizeLG - 2,
|
|
1032
|
+
onlyIconSizeLG: e.fontSizeLG + 2,
|
|
1033
|
+
groupBorderColor: e.colorPrimaryHover,
|
|
258
1034
|
linkHoverBg: "transparent",
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
1035
|
+
textTextColor: e.colorText,
|
|
1036
|
+
textTextHoverColor: e.colorText,
|
|
1037
|
+
textTextActiveColor: e.colorText,
|
|
1038
|
+
textHoverBg: e.colorBgTextHover,
|
|
1039
|
+
defaultColor: e.colorText,
|
|
1040
|
+
defaultBg: e.colorBgContainer,
|
|
1041
|
+
defaultBorderColor: e.colorBorder,
|
|
1042
|
+
defaultBorderColorDisabled: e.colorBorder,
|
|
1043
|
+
defaultHoverBg: e.colorBgContainer,
|
|
1044
|
+
defaultHoverColor: e.colorPrimaryHover,
|
|
1045
|
+
defaultHoverBorderColor: e.colorPrimaryHover,
|
|
1046
|
+
defaultActiveBg: e.colorBgContainer,
|
|
1047
|
+
defaultActiveColor: e.colorPrimaryActive,
|
|
1048
|
+
defaultActiveBorderColor: e.colorPrimaryActive,
|
|
1049
|
+
solidTextColor: f,
|
|
1050
|
+
contentFontSize: a,
|
|
1051
|
+
contentFontSizeSM: l,
|
|
1052
|
+
contentFontSizeLG: c,
|
|
1053
|
+
contentLineHeight: d,
|
|
1054
|
+
contentLineHeightSM: g,
|
|
1055
|
+
contentLineHeightLG: b,
|
|
1056
|
+
paddingBlock: Math.max((e.controlHeight - a * d) / 2 - e.lineWidth, 0),
|
|
1057
|
+
paddingBlockSM: Math.max((e.controlHeightSM - l * g) / 2 - e.lineWidth, 0),
|
|
1058
|
+
paddingBlockLG: Math.max((e.controlHeightLG - c * b) / 2 - e.lineWidth, 0)
|
|
279
1059
|
};
|
|
280
|
-
},
|
|
1060
|
+
}, cr = (e) => {
|
|
281
1061
|
const {
|
|
282
|
-
componentCls:
|
|
283
|
-
iconCls:
|
|
284
|
-
fontWeight:
|
|
285
|
-
} =
|
|
1062
|
+
componentCls: t,
|
|
1063
|
+
iconCls: r,
|
|
1064
|
+
fontWeight: o
|
|
1065
|
+
} = e;
|
|
286
1066
|
return {
|
|
287
|
-
[
|
|
1067
|
+
[t]: {
|
|
288
1068
|
outline: "none",
|
|
289
1069
|
position: "relative",
|
|
290
|
-
display: "inline-
|
|
291
|
-
|
|
1070
|
+
display: "inline-flex",
|
|
1071
|
+
gap: e.marginXS,
|
|
1072
|
+
alignItems: "center",
|
|
1073
|
+
justifyContent: "center",
|
|
1074
|
+
fontWeight: o,
|
|
292
1075
|
whiteSpace: "nowrap",
|
|
293
1076
|
textAlign: "center",
|
|
294
1077
|
backgroundImage: "none",
|
|
295
1078
|
background: "transparent",
|
|
296
|
-
border: `${
|
|
1079
|
+
border: `${re(e.lineWidth)} ${e.lineType} transparent`,
|
|
297
1080
|
cursor: "pointer",
|
|
298
|
-
transition: `all ${
|
|
1081
|
+
transition: `all ${e.motionDurationMid} ${e.motionEaseInOut}`,
|
|
299
1082
|
userSelect: "none",
|
|
300
1083
|
touchAction: "manipulation",
|
|
301
|
-
color:
|
|
1084
|
+
color: e.colorText,
|
|
302
1085
|
"&:disabled > *": {
|
|
303
1086
|
pointerEvents: "none"
|
|
304
1087
|
},
|
|
305
1088
|
"> span": {
|
|
306
1089
|
display: "inline-block"
|
|
307
1090
|
},
|
|
308
|
-
[`${
|
|
309
|
-
lineHeight:
|
|
310
|
-
// iconPosition in end
|
|
311
|
-
"&-end": {
|
|
312
|
-
marginInlineStart: o.marginXS
|
|
313
|
-
}
|
|
314
|
-
},
|
|
315
|
-
// Leave a space between icon and text.
|
|
316
|
-
[`> ${t} + span, > span + ${t}`]: {
|
|
317
|
-
marginInlineStart: o.marginXS
|
|
318
|
-
},
|
|
319
|
-
[`&:not(${e}-icon-only) > ${e}-icon`]: {
|
|
320
|
-
[`&${e}-loading-icon, &:not(:last-child)`]: {
|
|
321
|
-
marginInlineEnd: o.marginXS
|
|
322
|
-
},
|
|
323
|
-
[`&${e}-loading-icon-end`]: {
|
|
324
|
-
marginInlineStart: o.marginXS
|
|
325
|
-
}
|
|
1091
|
+
[`${t}-icon`]: {
|
|
1092
|
+
lineHeight: 1
|
|
326
1093
|
},
|
|
327
1094
|
"> a": {
|
|
328
1095
|
color: "currentColor"
|
|
329
1096
|
},
|
|
330
|
-
"&:not(:disabled)": Object.assign({},
|
|
331
|
-
[`&${
|
|
1097
|
+
"&:not(:disabled)": Object.assign({}, zt(e)),
|
|
1098
|
+
[`&${t}-two-chinese-chars::first-letter`]: {
|
|
332
1099
|
letterSpacing: "0.34em"
|
|
333
1100
|
},
|
|
334
|
-
[`&${
|
|
1101
|
+
[`&${t}-two-chinese-chars > *:not(${r})`]: {
|
|
335
1102
|
marginInlineEnd: "-0.34em",
|
|
336
1103
|
letterSpacing: "0.34em"
|
|
337
1104
|
},
|
|
338
|
-
//
|
|
339
|
-
|
|
340
|
-
|
|
1105
|
+
// iconPosition="end"
|
|
1106
|
+
"&-icon-end": {
|
|
1107
|
+
flexDirection: "row-reverse"
|
|
341
1108
|
}
|
|
342
1109
|
}
|
|
343
1110
|
};
|
|
344
|
-
},
|
|
345
|
-
[`&:not(:disabled):not(${
|
|
346
|
-
"&:hover":
|
|
347
|
-
"&:active":
|
|
1111
|
+
}, lt = (e, t, r) => ({
|
|
1112
|
+
[`&:not(:disabled):not(${e}-disabled)`]: {
|
|
1113
|
+
"&:hover": t,
|
|
1114
|
+
"&:active": r
|
|
348
1115
|
}
|
|
349
|
-
}),
|
|
350
|
-
minWidth:
|
|
1116
|
+
}), ur = (e) => ({
|
|
1117
|
+
minWidth: e.controlHeight,
|
|
351
1118
|
paddingInlineStart: 0,
|
|
352
1119
|
paddingInlineEnd: 0,
|
|
353
1120
|
borderRadius: "50%"
|
|
354
|
-
}),
|
|
355
|
-
borderRadius:
|
|
356
|
-
paddingInlineStart:
|
|
357
|
-
paddingInlineEnd:
|
|
358
|
-
}),
|
|
1121
|
+
}), dr = (e) => ({
|
|
1122
|
+
borderRadius: e.controlHeight,
|
|
1123
|
+
paddingInlineStart: e.calc(e.controlHeight).div(2).equal(),
|
|
1124
|
+
paddingInlineEnd: e.calc(e.controlHeight).div(2).equal()
|
|
1125
|
+
}), gr = (e) => ({
|
|
359
1126
|
cursor: "not-allowed",
|
|
360
|
-
borderColor:
|
|
361
|
-
color:
|
|
362
|
-
background:
|
|
1127
|
+
borderColor: e.borderColorDisabled,
|
|
1128
|
+
color: e.colorTextDisabled,
|
|
1129
|
+
background: e.colorBgContainerDisabled,
|
|
363
1130
|
boxShadow: "none"
|
|
364
|
-
}),
|
|
365
|
-
[`&${
|
|
366
|
-
color:
|
|
367
|
-
background:
|
|
368
|
-
borderColor:
|
|
1131
|
+
}), xe = (e, t, r, o, n, i, s, a) => ({
|
|
1132
|
+
[`&${e}-background-ghost`]: Object.assign(Object.assign({
|
|
1133
|
+
color: r || void 0,
|
|
1134
|
+
background: t,
|
|
1135
|
+
borderColor: o || void 0,
|
|
369
1136
|
boxShadow: "none"
|
|
370
|
-
},
|
|
371
|
-
background:
|
|
372
|
-
},
|
|
373
|
-
background:
|
|
374
|
-
},
|
|
1137
|
+
}, lt(e, Object.assign({
|
|
1138
|
+
background: t
|
|
1139
|
+
}, s), Object.assign({
|
|
1140
|
+
background: t
|
|
1141
|
+
}, a))), {
|
|
375
1142
|
"&:disabled": {
|
|
376
1143
|
cursor: "not-allowed",
|
|
377
|
-
color:
|
|
1144
|
+
color: n || void 0,
|
|
378
1145
|
borderColor: i || void 0
|
|
379
1146
|
}
|
|
380
1147
|
})
|
|
381
|
-
}),
|
|
382
|
-
[`&:disabled, &${
|
|
383
|
-
}),
|
|
384
|
-
[`&:disabled, &${
|
|
1148
|
+
}), hr = (e) => ({
|
|
1149
|
+
[`&:disabled, &${e.componentCls}-disabled`]: Object.assign({}, gr(e))
|
|
1150
|
+
}), fr = (e) => ({
|
|
1151
|
+
[`&:disabled, &${e.componentCls}-disabled`]: {
|
|
385
1152
|
cursor: "not-allowed",
|
|
386
|
-
color:
|
|
387
|
-
}
|
|
388
|
-
}),
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
1153
|
+
color: e.colorTextDisabled
|
|
1154
|
+
}
|
|
1155
|
+
}), le = (e, t, r, o) => {
|
|
1156
|
+
const i = o && ["link", "text"].includes(o) ? fr : hr;
|
|
1157
|
+
return Object.assign(Object.assign({}, i(e)), lt(e.componentCls, t, r));
|
|
1158
|
+
}, He = (e, t, r, o, n) => ({
|
|
1159
|
+
[`&${e.componentCls}-variant-solid`]: Object.assign({
|
|
1160
|
+
color: t,
|
|
1161
|
+
background: r
|
|
1162
|
+
}, le(e, o, n))
|
|
1163
|
+
}), $e = (e, t, r, o, n) => ({
|
|
1164
|
+
[`&${e.componentCls}-variant-outlined, &${e.componentCls}-variant-dashed`]: Object.assign({
|
|
1165
|
+
borderColor: t,
|
|
1166
|
+
background: r
|
|
1167
|
+
}, le(e, o, n))
|
|
1168
|
+
}), Be = (e) => ({
|
|
1169
|
+
[`&${e.componentCls}-variant-dashed`]: {
|
|
1170
|
+
borderStyle: "dashed"
|
|
1171
|
+
}
|
|
1172
|
+
}), Ee = (e, t, r, o) => ({
|
|
1173
|
+
[`&${e.componentCls}-variant-filled`]: Object.assign({
|
|
1174
|
+
boxShadow: "none",
|
|
1175
|
+
background: t
|
|
1176
|
+
}, le(e, r, o))
|
|
1177
|
+
}), J = (e, t, r, o, n) => ({
|
|
1178
|
+
[`&${e.componentCls}-variant-${r}`]: Object.assign({
|
|
1179
|
+
color: t,
|
|
1180
|
+
boxShadow: "none"
|
|
1181
|
+
}, le(e, o, n, r))
|
|
1182
|
+
}), mr = (e) => Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({
|
|
1183
|
+
color: e.defaultColor,
|
|
1184
|
+
boxShadow: e.defaultShadow
|
|
1185
|
+
}, He(e, e.solidTextColor, e.colorBgSolid, {
|
|
1186
|
+
background: e.colorBgSolidHover
|
|
397
1187
|
}, {
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
background:
|
|
401
|
-
})), H(o.componentCls, o.ghostBg, o.defaultGhostColor, o.defaultGhostBorderColor, o.colorTextDisabled, o.colorBorder)), {
|
|
402
|
-
[`&${o.componentCls}-dangerous`]: Object.assign(Object.assign(Object.assign({
|
|
403
|
-
color: o.colorError,
|
|
404
|
-
borderColor: o.colorError
|
|
405
|
-
}, h(o.componentCls, {
|
|
406
|
-
color: o.colorErrorHover,
|
|
407
|
-
borderColor: o.colorErrorBorderHover
|
|
408
|
-
}, {
|
|
409
|
-
color: o.colorErrorActive,
|
|
410
|
-
borderColor: o.colorErrorActive
|
|
411
|
-
})), H(o.componentCls, o.ghostBg, o.colorError, o.colorError, o.colorTextDisabled, o.colorBorder)), X(o))
|
|
412
|
-
}), he = (o) => Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, xo(o)), {
|
|
413
|
-
color: o.primaryColor,
|
|
414
|
-
background: o.colorPrimary,
|
|
415
|
-
boxShadow: o.primaryShadow
|
|
416
|
-
}), h(o.componentCls, {
|
|
417
|
-
color: o.colorTextLightSolid,
|
|
418
|
-
background: o.colorPrimaryHover
|
|
1188
|
+
background: e.colorBgSolidActive
|
|
1189
|
+
})), Be(e)), Ee(e, e.colorFillTertiary, {
|
|
1190
|
+
background: e.colorFillSecondary
|
|
419
1191
|
}, {
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
borderColor: o.colorPrimaryHover
|
|
1192
|
+
background: e.colorFill
|
|
1193
|
+
})), J(e, e.textTextColor, "link", {
|
|
1194
|
+
color: e.colorLinkHover,
|
|
1195
|
+
background: e.linkHoverBg
|
|
425
1196
|
}, {
|
|
426
|
-
color:
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
background: o.colorErrorHover
|
|
435
|
-
}, {
|
|
436
|
-
background: o.colorErrorActive
|
|
437
|
-
})), H(o.componentCls, o.ghostBg, o.colorError, o.colorError, o.colorTextDisabled, o.colorBorder, {
|
|
438
|
-
color: o.colorErrorHover,
|
|
439
|
-
borderColor: o.colorErrorHover
|
|
440
|
-
}, {
|
|
441
|
-
color: o.colorErrorActive,
|
|
442
|
-
borderColor: o.colorErrorActive
|
|
443
|
-
})), X(o))
|
|
444
|
-
}), Se = (o) => Object.assign(Object.assign({}, Io(o)), {
|
|
445
|
-
borderStyle: "dashed"
|
|
446
|
-
}), Ce = (o) => Object.assign(Object.assign(Object.assign({
|
|
447
|
-
color: o.colorLink
|
|
448
|
-
}, h(o.componentCls, {
|
|
449
|
-
color: o.colorLinkHover,
|
|
450
|
-
background: o.linkHoverBg
|
|
1197
|
+
color: e.colorLinkActive
|
|
1198
|
+
})), xe(e.componentCls, e.ghostBg, e.defaultGhostColor, e.defaultGhostBorderColor, e.colorTextDisabled, e.colorBorder)), vr = (e) => Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({
|
|
1199
|
+
color: e.colorPrimary,
|
|
1200
|
+
boxShadow: e.primaryShadow
|
|
1201
|
+
}, $e(e, e.colorPrimary, e.colorBgContainer, {
|
|
1202
|
+
color: e.colorPrimaryTextHover,
|
|
1203
|
+
borderColor: e.colorPrimaryHover,
|
|
1204
|
+
background: e.colorBgContainer
|
|
451
1205
|
}, {
|
|
452
|
-
color:
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
color: o.colorErrorHover
|
|
458
|
-
}, {
|
|
459
|
-
color: o.colorErrorActive
|
|
460
|
-
})), N(o))
|
|
461
|
-
}), ye = (o) => Object.assign(Object.assign(Object.assign({}, h(o.componentCls, {
|
|
462
|
-
color: o.colorText,
|
|
463
|
-
background: o.textHoverBg
|
|
1206
|
+
color: e.colorPrimaryTextActive,
|
|
1207
|
+
borderColor: e.colorPrimaryActive,
|
|
1208
|
+
background: e.colorBgContainer
|
|
1209
|
+
})), Be(e)), Ee(e, e.colorPrimaryBg, {
|
|
1210
|
+
background: e.colorPrimaryBgHover
|
|
464
1211
|
}, {
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
1212
|
+
background: e.colorPrimaryBorder
|
|
1213
|
+
})), J(e, e.colorLink, "text", {
|
|
1214
|
+
color: e.colorPrimaryTextHover,
|
|
1215
|
+
background: e.colorPrimaryBg
|
|
1216
|
+
}, {
|
|
1217
|
+
color: e.colorPrimaryTextActive,
|
|
1218
|
+
background: e.colorPrimaryBorder
|
|
1219
|
+
})), xe(e.componentCls, e.ghostBg, e.colorPrimary, e.colorPrimary, e.colorTextDisabled, e.colorBorder, {
|
|
1220
|
+
color: e.colorPrimaryHover,
|
|
1221
|
+
borderColor: e.colorPrimaryHover
|
|
1222
|
+
}, {
|
|
1223
|
+
color: e.colorPrimaryActive,
|
|
1224
|
+
borderColor: e.colorPrimaryActive
|
|
1225
|
+
})), br = (e) => Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({
|
|
1226
|
+
color: e.colorError,
|
|
1227
|
+
boxShadow: e.dangerShadow
|
|
1228
|
+
}, He(e, e.dangerColor, e.colorError, {
|
|
1229
|
+
background: e.colorErrorHover
|
|
1230
|
+
}, {
|
|
1231
|
+
background: e.colorErrorActive
|
|
1232
|
+
})), $e(e, e.colorError, e.colorBgContainer, {
|
|
1233
|
+
color: e.colorErrorHover,
|
|
1234
|
+
borderColor: e.colorErrorBorderHover
|
|
1235
|
+
}, {
|
|
1236
|
+
color: e.colorErrorActive,
|
|
1237
|
+
borderColor: e.colorErrorActive
|
|
1238
|
+
})), Be(e)), Ee(e, e.colorErrorBg, {
|
|
1239
|
+
background: e.colorErrorBgFilledHover
|
|
1240
|
+
}, {
|
|
1241
|
+
background: e.colorErrorBgActive
|
|
1242
|
+
})), J(e, e.colorError, "text", {
|
|
1243
|
+
color: e.colorErrorHover,
|
|
1244
|
+
background: e.colorErrorBg
|
|
1245
|
+
}, {
|
|
1246
|
+
color: e.colorErrorHover,
|
|
1247
|
+
background: e.colorErrorBgActive
|
|
1248
|
+
})), J(e, e.colorError, "link", {
|
|
1249
|
+
color: e.colorErrorHover
|
|
1250
|
+
}, {
|
|
1251
|
+
color: e.colorErrorActive
|
|
1252
|
+
})), xe(e.componentCls, e.ghostBg, e.colorError, e.colorError, e.colorTextDisabled, e.colorBorder, {
|
|
1253
|
+
color: e.colorErrorHover,
|
|
1254
|
+
borderColor: e.colorErrorHover
|
|
1255
|
+
}, {
|
|
1256
|
+
color: e.colorErrorActive,
|
|
1257
|
+
borderColor: e.colorErrorActive
|
|
1258
|
+
})), pr = (e) => {
|
|
478
1259
|
const {
|
|
479
|
-
componentCls:
|
|
480
|
-
} =
|
|
1260
|
+
componentCls: t
|
|
1261
|
+
} = e;
|
|
481
1262
|
return {
|
|
482
|
-
[`${
|
|
483
|
-
[`${
|
|
484
|
-
[`${
|
|
485
|
-
[`${e}-link`]: Ce(o),
|
|
486
|
-
[`${e}-text`]: ye(o),
|
|
487
|
-
[`${e}-ghost`]: H(o.componentCls, o.ghostBg, o.colorBgContainer, o.colorBgContainer, o.colorTextDisabled, o.colorBorder)
|
|
1263
|
+
[`${t}-color-default`]: mr(e),
|
|
1264
|
+
[`${t}-color-primary`]: vr(e),
|
|
1265
|
+
[`${t}-color-dangerous`]: br(e)
|
|
488
1266
|
};
|
|
489
|
-
},
|
|
490
|
-
|
|
1267
|
+
}, Cr = (e) => Object.assign(Object.assign(Object.assign(Object.assign({}, $e(e, e.defaultBorderColor, e.defaultBg, {
|
|
1268
|
+
color: e.defaultHoverColor,
|
|
1269
|
+
borderColor: e.defaultHoverBorderColor,
|
|
1270
|
+
background: e.defaultHoverBg
|
|
1271
|
+
}, {
|
|
1272
|
+
color: e.defaultActiveColor,
|
|
1273
|
+
borderColor: e.defaultActiveBorderColor,
|
|
1274
|
+
background: e.defaultActiveBg
|
|
1275
|
+
})), J(e, e.textTextColor, "text", {
|
|
1276
|
+
color: e.textTextHoverColor,
|
|
1277
|
+
background: e.textHoverBg
|
|
1278
|
+
}, {
|
|
1279
|
+
color: e.textTextActiveColor,
|
|
1280
|
+
background: e.colorBgTextActive
|
|
1281
|
+
})), He(e, e.primaryColor, e.colorPrimary, {
|
|
1282
|
+
background: e.colorPrimaryHover,
|
|
1283
|
+
color: e.primaryColor
|
|
1284
|
+
}, {
|
|
1285
|
+
background: e.colorPrimaryActive,
|
|
1286
|
+
color: e.primaryColor
|
|
1287
|
+
})), J(e, e.colorLink, "link", {
|
|
1288
|
+
color: e.colorLinkHover,
|
|
1289
|
+
background: e.linkHoverBg
|
|
1290
|
+
}, {
|
|
1291
|
+
color: e.colorLinkActive
|
|
1292
|
+
})), _e = function(e) {
|
|
1293
|
+
let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "";
|
|
491
1294
|
const {
|
|
492
|
-
componentCls:
|
|
493
|
-
controlHeight:
|
|
494
|
-
fontSize:
|
|
1295
|
+
componentCls: r,
|
|
1296
|
+
controlHeight: o,
|
|
1297
|
+
fontSize: n,
|
|
495
1298
|
lineHeight: i,
|
|
496
|
-
borderRadius:
|
|
497
|
-
buttonPaddingHorizontal:
|
|
498
|
-
iconCls:
|
|
499
|
-
buttonPaddingVertical:
|
|
500
|
-
} =
|
|
1299
|
+
borderRadius: s,
|
|
1300
|
+
buttonPaddingHorizontal: a,
|
|
1301
|
+
iconCls: l,
|
|
1302
|
+
buttonPaddingVertical: c
|
|
1303
|
+
} = e, d = `${r}-icon-only`;
|
|
501
1304
|
return [
|
|
502
1305
|
{
|
|
503
|
-
[
|
|
504
|
-
fontSize:
|
|
1306
|
+
[t]: {
|
|
1307
|
+
fontSize: n,
|
|
505
1308
|
lineHeight: i,
|
|
506
|
-
height:
|
|
507
|
-
padding: `${
|
|
508
|
-
borderRadius:
|
|
509
|
-
[`&${
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
[`&${
|
|
1309
|
+
height: o,
|
|
1310
|
+
padding: `${re(c)} ${re(a)}`,
|
|
1311
|
+
borderRadius: s,
|
|
1312
|
+
[`&${d}`]: {
|
|
1313
|
+
width: o,
|
|
1314
|
+
paddingInline: 0,
|
|
1315
|
+
// make `btn-icon-only` not too narrow
|
|
1316
|
+
[`&${r}-compact-item`]: {
|
|
1317
|
+
flex: "none"
|
|
1318
|
+
},
|
|
1319
|
+
[`&${r}-round`]: {
|
|
517
1320
|
width: "auto"
|
|
518
1321
|
},
|
|
519
|
-
[
|
|
520
|
-
fontSize:
|
|
1322
|
+
[l]: {
|
|
1323
|
+
fontSize: e.buttonIconOnlyFontSize
|
|
521
1324
|
}
|
|
522
1325
|
},
|
|
523
1326
|
// Loading
|
|
524
|
-
[`&${
|
|
525
|
-
opacity:
|
|
1327
|
+
[`&${r}-loading`]: {
|
|
1328
|
+
opacity: e.opacityLoading,
|
|
526
1329
|
cursor: "default"
|
|
527
1330
|
},
|
|
528
|
-
[`${
|
|
529
|
-
transition: `width ${
|
|
1331
|
+
[`${r}-loading-icon`]: {
|
|
1332
|
+
transition: `width ${e.motionDurationSlow} ${e.motionEaseInOut}, opacity ${e.motionDurationSlow} ${e.motionEaseInOut}`
|
|
530
1333
|
}
|
|
531
1334
|
}
|
|
532
1335
|
},
|
|
533
1336
|
// Shape - patch prefixCls again to override solid border radius style
|
|
534
1337
|
{
|
|
535
|
-
[`${
|
|
1338
|
+
[`${r}${r}-circle${t}`]: ur(e)
|
|
536
1339
|
},
|
|
537
1340
|
{
|
|
538
|
-
[`${
|
|
1341
|
+
[`${r}${r}-round${t}`]: dr(e)
|
|
539
1342
|
}
|
|
540
1343
|
];
|
|
541
|
-
},
|
|
542
|
-
const
|
|
543
|
-
fontSize:
|
|
544
|
-
lineHeight:
|
|
1344
|
+
}, yr = (e) => {
|
|
1345
|
+
const t = ae(e, {
|
|
1346
|
+
fontSize: e.contentFontSize,
|
|
1347
|
+
lineHeight: e.contentLineHeight
|
|
545
1348
|
});
|
|
546
|
-
return
|
|
547
|
-
},
|
|
548
|
-
const
|
|
549
|
-
controlHeight:
|
|
550
|
-
fontSize:
|
|
551
|
-
lineHeight:
|
|
552
|
-
padding:
|
|
553
|
-
buttonPaddingHorizontal:
|
|
554
|
-
buttonPaddingVertical:
|
|
555
|
-
borderRadius:
|
|
556
|
-
buttonIconOnlyFontSize:
|
|
1349
|
+
return _e(t, e.componentCls);
|
|
1350
|
+
}, Sr = (e) => {
|
|
1351
|
+
const t = ae(e, {
|
|
1352
|
+
controlHeight: e.controlHeightSM,
|
|
1353
|
+
fontSize: e.contentFontSizeSM,
|
|
1354
|
+
lineHeight: e.contentLineHeightSM,
|
|
1355
|
+
padding: e.paddingXS,
|
|
1356
|
+
buttonPaddingHorizontal: e.paddingInlineSM,
|
|
1357
|
+
buttonPaddingVertical: e.paddingBlockSM,
|
|
1358
|
+
borderRadius: e.borderRadiusSM,
|
|
1359
|
+
buttonIconOnlyFontSize: e.onlyIconSizeSM
|
|
557
1360
|
});
|
|
558
|
-
return
|
|
559
|
-
},
|
|
560
|
-
const
|
|
561
|
-
controlHeight:
|
|
562
|
-
fontSize:
|
|
563
|
-
lineHeight:
|
|
564
|
-
buttonPaddingHorizontal:
|
|
565
|
-
buttonPaddingVertical:
|
|
566
|
-
borderRadius:
|
|
567
|
-
buttonIconOnlyFontSize:
|
|
1361
|
+
return _e(t, `${e.componentCls}-sm`);
|
|
1362
|
+
}, xr = (e) => {
|
|
1363
|
+
const t = ae(e, {
|
|
1364
|
+
controlHeight: e.controlHeightLG,
|
|
1365
|
+
fontSize: e.contentFontSizeLG,
|
|
1366
|
+
lineHeight: e.contentLineHeightLG,
|
|
1367
|
+
buttonPaddingHorizontal: e.paddingInlineLG,
|
|
1368
|
+
buttonPaddingVertical: e.paddingBlockLG,
|
|
1369
|
+
borderRadius: e.borderRadiusLG,
|
|
1370
|
+
buttonIconOnlyFontSize: e.onlyIconSizeLG
|
|
568
1371
|
});
|
|
569
|
-
return
|
|
570
|
-
},
|
|
1372
|
+
return _e(t, `${e.componentCls}-lg`);
|
|
1373
|
+
}, Hr = (e) => {
|
|
571
1374
|
const {
|
|
572
|
-
componentCls:
|
|
573
|
-
} =
|
|
1375
|
+
componentCls: t
|
|
1376
|
+
} = e;
|
|
574
1377
|
return {
|
|
575
|
-
[
|
|
576
|
-
[`&${
|
|
1378
|
+
[t]: {
|
|
1379
|
+
[`&${t}-block`]: {
|
|
577
1380
|
width: "100%"
|
|
578
1381
|
}
|
|
579
1382
|
}
|
|
580
1383
|
};
|
|
581
|
-
},
|
|
582
|
-
const
|
|
1384
|
+
}, $r = Dt("Button", (e) => {
|
|
1385
|
+
const t = at(e);
|
|
583
1386
|
return [
|
|
584
1387
|
// Shared
|
|
585
|
-
|
|
1388
|
+
cr(t),
|
|
586
1389
|
// Size
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
1390
|
+
yr(t),
|
|
1391
|
+
Sr(t),
|
|
1392
|
+
xr(t),
|
|
590
1393
|
// Block
|
|
591
|
-
|
|
592
|
-
//
|
|
593
|
-
|
|
1394
|
+
Hr(t),
|
|
1395
|
+
// Color
|
|
1396
|
+
pr(t),
|
|
1397
|
+
// https://github.com/ant-design/ant-design/issues/50969
|
|
1398
|
+
Cr(t),
|
|
594
1399
|
// Button Group
|
|
595
|
-
|
|
1400
|
+
Ft(t)
|
|
596
1401
|
];
|
|
597
|
-
},
|
|
1402
|
+
}, st, {
|
|
598
1403
|
unitless: {
|
|
599
1404
|
fontWeight: !0,
|
|
600
1405
|
contentLineHeight: !0,
|
|
@@ -602,11 +1407,11 @@ const Bo = /* @__PURE__ */ Co((o, e) => {
|
|
|
602
1407
|
contentLineHeightLG: !0
|
|
603
1408
|
}
|
|
604
1409
|
});
|
|
605
|
-
function
|
|
1410
|
+
function Br(e, t) {
|
|
606
1411
|
return {
|
|
607
1412
|
// border collapse
|
|
608
|
-
[`&-item:not(${
|
|
609
|
-
marginBottom:
|
|
1413
|
+
[`&-item:not(${t}-last-item)`]: {
|
|
1414
|
+
marginBottom: e.calc(e.lineWidth).mul(-1).equal()
|
|
610
1415
|
},
|
|
611
1416
|
"&-item": {
|
|
612
1417
|
"&:hover,&:focus,&:active": {
|
|
@@ -618,67 +1423,67 @@ function Ie(o, e) {
|
|
|
618
1423
|
}
|
|
619
1424
|
};
|
|
620
1425
|
}
|
|
621
|
-
function
|
|
1426
|
+
function Er(e, t) {
|
|
622
1427
|
return {
|
|
623
|
-
[`&-item:not(${
|
|
1428
|
+
[`&-item:not(${t}-first-item):not(${t}-last-item)`]: {
|
|
624
1429
|
borderRadius: 0
|
|
625
1430
|
},
|
|
626
|
-
[`&-item${
|
|
627
|
-
[`&, &${
|
|
1431
|
+
[`&-item${t}-first-item:not(${t}-last-item)`]: {
|
|
1432
|
+
[`&, &${e}-sm, &${e}-lg`]: {
|
|
628
1433
|
borderEndEndRadius: 0,
|
|
629
1434
|
borderEndStartRadius: 0
|
|
630
1435
|
}
|
|
631
1436
|
},
|
|
632
|
-
[`&-item${
|
|
633
|
-
[`&, &${
|
|
1437
|
+
[`&-item${t}-last-item:not(${t}-first-item)`]: {
|
|
1438
|
+
[`&, &${e}-sm, &${e}-lg`]: {
|
|
634
1439
|
borderStartStartRadius: 0,
|
|
635
1440
|
borderStartEndRadius: 0
|
|
636
1441
|
}
|
|
637
1442
|
}
|
|
638
1443
|
};
|
|
639
1444
|
}
|
|
640
|
-
function
|
|
641
|
-
const
|
|
1445
|
+
function _r(e) {
|
|
1446
|
+
const t = `${e.componentCls}-compact-vertical`;
|
|
642
1447
|
return {
|
|
643
|
-
[
|
|
1448
|
+
[t]: Object.assign(Object.assign({}, Br(e, t)), Er(e.componentCls, t))
|
|
644
1449
|
};
|
|
645
1450
|
}
|
|
646
|
-
const
|
|
1451
|
+
const Or = (e) => {
|
|
647
1452
|
const {
|
|
648
|
-
componentCls:
|
|
649
|
-
calc:
|
|
650
|
-
} =
|
|
1453
|
+
componentCls: t,
|
|
1454
|
+
calc: r
|
|
1455
|
+
} = e;
|
|
651
1456
|
return {
|
|
652
|
-
[
|
|
1457
|
+
[t]: {
|
|
653
1458
|
// Special styles for Primary Button
|
|
654
|
-
[`&-compact-item${
|
|
655
|
-
[`&:not([disabled]) + ${
|
|
1459
|
+
[`&-compact-item${t}-primary`]: {
|
|
1460
|
+
[`&:not([disabled]) + ${t}-compact-item${t}-primary:not([disabled])`]: {
|
|
656
1461
|
position: "relative",
|
|
657
1462
|
"&:before": {
|
|
658
1463
|
position: "absolute",
|
|
659
|
-
top:
|
|
660
|
-
insetInlineStart:
|
|
1464
|
+
top: r(e.lineWidth).mul(-1).equal(),
|
|
1465
|
+
insetInlineStart: r(e.lineWidth).mul(-1).equal(),
|
|
661
1466
|
display: "inline-block",
|
|
662
|
-
width:
|
|
663
|
-
height: `calc(100% + ${
|
|
664
|
-
backgroundColor:
|
|
1467
|
+
width: e.lineWidth,
|
|
1468
|
+
height: `calc(100% + ${re(e.lineWidth)} * 2)`,
|
|
1469
|
+
backgroundColor: e.colorPrimaryHover,
|
|
665
1470
|
content: '""'
|
|
666
1471
|
}
|
|
667
1472
|
}
|
|
668
1473
|
},
|
|
669
1474
|
// Special styles for Primary Button
|
|
670
1475
|
"&-compact-vertical-item": {
|
|
671
|
-
[`&${
|
|
672
|
-
[`&:not([disabled]) + ${
|
|
1476
|
+
[`&${t}-primary`]: {
|
|
1477
|
+
[`&:not([disabled]) + ${t}-compact-vertical-item${t}-primary:not([disabled])`]: {
|
|
673
1478
|
position: "relative",
|
|
674
1479
|
"&:before": {
|
|
675
1480
|
position: "absolute",
|
|
676
|
-
top:
|
|
677
|
-
insetInlineStart:
|
|
1481
|
+
top: r(e.lineWidth).mul(-1).equal(),
|
|
1482
|
+
insetInlineStart: r(e.lineWidth).mul(-1).equal(),
|
|
678
1483
|
display: "inline-block",
|
|
679
|
-
width: `calc(100% + ${
|
|
680
|
-
height:
|
|
681
|
-
backgroundColor:
|
|
1484
|
+
width: `calc(100% + ${re(e.lineWidth)} * 2)`,
|
|
1485
|
+
height: e.lineWidth,
|
|
1486
|
+
backgroundColor: e.colorPrimaryHover,
|
|
682
1487
|
content: '""'
|
|
683
1488
|
}
|
|
684
1489
|
}
|
|
@@ -686,158 +1491,170 @@ const je = (o) => {
|
|
|
686
1491
|
}
|
|
687
1492
|
}
|
|
688
1493
|
};
|
|
689
|
-
},
|
|
690
|
-
const
|
|
1494
|
+
}, Rr = It(["Button", "compact"], (e) => {
|
|
1495
|
+
const t = at(e);
|
|
691
1496
|
return [
|
|
692
1497
|
// Space Compact
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
1498
|
+
Ht(t),
|
|
1499
|
+
_r(t),
|
|
1500
|
+
Or(t)
|
|
696
1501
|
];
|
|
697
|
-
},
|
|
698
|
-
var
|
|
699
|
-
var
|
|
700
|
-
for (var
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
e.indexOf(n[r]) < 0 && Object.prototype.propertyIsEnumerable.call(o, n[r]) && (t[n[r]] = o[n[r]]);
|
|
705
|
-
return t;
|
|
1502
|
+
}, st);
|
|
1503
|
+
var Lr = function(e, t) {
|
|
1504
|
+
var r = {};
|
|
1505
|
+
for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && t.indexOf(o) < 0 && (r[o] = e[o]);
|
|
1506
|
+
if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var n = 0, o = Object.getOwnPropertySymbols(e); n < o.length; n++)
|
|
1507
|
+
t.indexOf(o[n]) < 0 && Object.prototype.propertyIsEnumerable.call(e, o[n]) && (r[o[n]] = e[o[n]]);
|
|
1508
|
+
return r;
|
|
706
1509
|
};
|
|
707
|
-
function
|
|
708
|
-
if (typeof
|
|
709
|
-
let
|
|
710
|
-
return
|
|
711
|
-
loading:
|
|
712
|
-
delay:
|
|
1510
|
+
function wr(e) {
|
|
1511
|
+
if (typeof e == "object" && e) {
|
|
1512
|
+
let t = e == null ? void 0 : e.delay;
|
|
1513
|
+
return t = !Number.isNaN(t) && typeof t == "number" ? t : 0, {
|
|
1514
|
+
loading: t <= 0,
|
|
1515
|
+
delay: t
|
|
713
1516
|
};
|
|
714
1517
|
}
|
|
715
1518
|
return {
|
|
716
|
-
loading: !!
|
|
1519
|
+
loading: !!e,
|
|
717
1520
|
delay: 0
|
|
718
1521
|
};
|
|
719
1522
|
}
|
|
720
|
-
const
|
|
721
|
-
|
|
1523
|
+
const Nr = {
|
|
1524
|
+
default: ["default", "outlined"],
|
|
1525
|
+
primary: ["primary", "solid"],
|
|
1526
|
+
dashed: ["default", "dashed"],
|
|
1527
|
+
link: ["primary", "link"],
|
|
1528
|
+
text: ["default", "text"]
|
|
1529
|
+
}, Pr = /* @__PURE__ */ u.forwardRef((e, t) => {
|
|
1530
|
+
var r, o, n;
|
|
722
1531
|
const {
|
|
723
1532
|
loading: i = !1,
|
|
724
|
-
prefixCls:
|
|
1533
|
+
prefixCls: s,
|
|
1534
|
+
color: a,
|
|
1535
|
+
variant: l,
|
|
725
1536
|
type: c,
|
|
726
|
-
danger:
|
|
727
|
-
shape:
|
|
728
|
-
size:
|
|
1537
|
+
danger: d = !1,
|
|
1538
|
+
shape: g = "default",
|
|
1539
|
+
size: b,
|
|
729
1540
|
styles: f,
|
|
730
|
-
disabled:
|
|
731
|
-
className:
|
|
732
|
-
rootClassName:
|
|
1541
|
+
disabled: p,
|
|
1542
|
+
className: B,
|
|
1543
|
+
rootClassName: E,
|
|
733
1544
|
children: S,
|
|
734
|
-
icon:
|
|
735
|
-
iconPosition:
|
|
736
|
-
ghost:
|
|
737
|
-
block:
|
|
1545
|
+
icon: x,
|
|
1546
|
+
iconPosition: O = "start",
|
|
1547
|
+
ghost: h = !1,
|
|
1548
|
+
block: y = !1,
|
|
738
1549
|
// React does not recognize the `htmlType` prop on a DOM element. Here we pick it out of `rest`.
|
|
739
|
-
htmlType:
|
|
1550
|
+
htmlType: K = "button",
|
|
740
1551
|
classNames: T,
|
|
741
|
-
style:
|
|
742
|
-
autoInsertSpace:
|
|
743
|
-
} =
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
1552
|
+
style: w = {},
|
|
1553
|
+
autoInsertSpace: z
|
|
1554
|
+
} = e, M = Lr(e, ["loading", "prefixCls", "color", "variant", "type", "danger", "shape", "size", "styles", "disabled", "className", "rootClassName", "children", "icon", "iconPosition", "ghost", "block", "htmlType", "classNames", "style", "autoInsertSpace"]), A = c || "default", [F, R] = te(() => {
|
|
1555
|
+
if (a && l)
|
|
1556
|
+
return [a, l];
|
|
1557
|
+
const H = Nr[A] || [];
|
|
1558
|
+
return d ? ["danger", H[1]] : H;
|
|
1559
|
+
}, [c, a, l, d]), I = F === "danger" ? "dangerous" : F, {
|
|
1560
|
+
getPrefixCls: G,
|
|
1561
|
+
direction: W,
|
|
1562
|
+
button: m
|
|
1563
|
+
} = he(Ye), C = (r = z ?? (m == null ? void 0 : m.autoInsertSpace)) !== null && r !== void 0 ? r : !0, v = G("btn", s), [Re, ct, ut] = $r(v), dt = he(jt), Q = p ?? dt, gt = he(Ze), Z = te(() => wr(i), [i]), [V, Le] = ye(Z.loading), [ce, we] = ye(!1), X = Tt(t, /* @__PURE__ */ Ct()), Ne = pt.count(S) === 1 && !x && !oe(R);
|
|
1564
|
+
ne(() => {
|
|
1565
|
+
let H = null;
|
|
1566
|
+
Z.delay > 0 ? H = setTimeout(() => {
|
|
1567
|
+
H = null, Le(!0);
|
|
1568
|
+
}, Z.delay) : Le(Z.loading);
|
|
1569
|
+
function N() {
|
|
1570
|
+
H && (clearTimeout(H), H = null);
|
|
1571
|
+
}
|
|
1572
|
+
return N;
|
|
1573
|
+
}, [Z]), ne(() => {
|
|
1574
|
+
if (!X || !X.current || !C)
|
|
759
1575
|
return;
|
|
760
|
-
const
|
|
761
|
-
|
|
762
|
-
}, [
|
|
763
|
-
const
|
|
1576
|
+
const H = X.current.textContent;
|
|
1577
|
+
Ne && Se(H) ? ce || we(!0) : ce && we(!1);
|
|
1578
|
+
}, [X]);
|
|
1579
|
+
const Pe = (H) => {
|
|
764
1580
|
const {
|
|
765
|
-
onClick:
|
|
766
|
-
} =
|
|
767
|
-
if (
|
|
768
|
-
|
|
1581
|
+
onClick: N
|
|
1582
|
+
} = e;
|
|
1583
|
+
if (V || Q) {
|
|
1584
|
+
H.preventDefault();
|
|
769
1585
|
return;
|
|
770
1586
|
}
|
|
771
|
-
|
|
1587
|
+
N == null || N(H);
|
|
772
1588
|
};
|
|
773
1589
|
if (process.env.NODE_ENV !== "production") {
|
|
774
|
-
const
|
|
775
|
-
process.env.NODE_ENV !== "production" &&
|
|
1590
|
+
const H = Ue("Button");
|
|
1591
|
+
process.env.NODE_ENV !== "production" && H(!(typeof x == "string" && x.length > 2), "breaking", `\`icon\` is using ReactNode instead of string naming in v4. Please check \`${x}\` at https://ant.design/components/icon`), process.env.NODE_ENV !== "production" && H(!(h && oe(R)), "usage", "`link` or `text` button can't be a `ghost` button.");
|
|
776
1592
|
}
|
|
777
1593
|
const {
|
|
778
|
-
compactSize:
|
|
779
|
-
compactItemClassnames:
|
|
780
|
-
} =
|
|
1594
|
+
compactSize: ht,
|
|
1595
|
+
compactItemClassnames: De
|
|
1596
|
+
} = $t(v, W), ft = {
|
|
781
1597
|
large: "lg",
|
|
782
1598
|
small: "sm",
|
|
783
1599
|
middle: void 0
|
|
784
|
-
},
|
|
785
|
-
var
|
|
786
|
-
return (
|
|
787
|
-
}),
|
|
788
|
-
[`${
|
|
789
|
-
|
|
790
|
-
[`${
|
|
791
|
-
[`${
|
|
792
|
-
[`${
|
|
793
|
-
[`${
|
|
794
|
-
[`${
|
|
795
|
-
[`${
|
|
796
|
-
[`${
|
|
797
|
-
[`${
|
|
798
|
-
|
|
799
|
-
[`${
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
1600
|
+
}, ze = Bt((H) => {
|
|
1601
|
+
var N, ge;
|
|
1602
|
+
return (ge = (N = b ?? ht) !== null && N !== void 0 ? N : gt) !== null && ge !== void 0 ? ge : H;
|
|
1603
|
+
}), Ie = ze && ft[ze] || "", mt = V ? "loading" : x, ue = Et(M, ["navigate"]), je = L(v, ct, ut, {
|
|
1604
|
+
[`${v}-${g}`]: g !== "default" && g,
|
|
1605
|
+
// line(253 - 254): Compatible with versions earlier than 5.21.0
|
|
1606
|
+
[`${v}-${A}`]: A,
|
|
1607
|
+
[`${v}-dangerous`]: d,
|
|
1608
|
+
[`${v}-color-${I}`]: I,
|
|
1609
|
+
[`${v}-variant-${R}`]: R,
|
|
1610
|
+
[`${v}-${Ie}`]: Ie,
|
|
1611
|
+
[`${v}-icon-only`]: !S && S !== 0 && !!mt,
|
|
1612
|
+
[`${v}-background-ghost`]: h && !oe(R),
|
|
1613
|
+
[`${v}-loading`]: V,
|
|
1614
|
+
[`${v}-two-chinese-chars`]: ce && C && !V,
|
|
1615
|
+
[`${v}-block`]: y,
|
|
1616
|
+
[`${v}-rtl`]: W === "rtl",
|
|
1617
|
+
[`${v}-icon-end`]: O === "end"
|
|
1618
|
+
}, De, B, E, m == null ? void 0 : m.className), Te = Object.assign(Object.assign({}, m == null ? void 0 : m.style), w), vt = L(T == null ? void 0 : T.icon, (o = m == null ? void 0 : m.classNames) === null || o === void 0 ? void 0 : o.icon), bt = Object.assign(Object.assign({}, (f == null ? void 0 : f.icon) || {}), ((n = m == null ? void 0 : m.styles) === null || n === void 0 ? void 0 : n.icon) || {}), Me = x && !V ? /* @__PURE__ */ u.createElement(ke, {
|
|
1619
|
+
prefixCls: v,
|
|
1620
|
+
className: vt,
|
|
1621
|
+
style: bt
|
|
1622
|
+
}, x) : /* @__PURE__ */ u.createElement(Vt, {
|
|
1623
|
+
existIcon: !!x,
|
|
1624
|
+
prefixCls: v,
|
|
1625
|
+
loading: V
|
|
1626
|
+
}), Ae = S || S === 0 ? Wt(S, Ne && C) : null;
|
|
1627
|
+
if (ue.href !== void 0)
|
|
1628
|
+
return Re(/* @__PURE__ */ u.createElement("a", Object.assign({}, ue, {
|
|
1629
|
+
className: L(je, {
|
|
1630
|
+
[`${v}-disabled`]: Q
|
|
814
1631
|
}),
|
|
815
|
-
href:
|
|
816
|
-
style:
|
|
817
|
-
onClick:
|
|
818
|
-
ref:
|
|
819
|
-
tabIndex:
|
|
820
|
-
}),
|
|
821
|
-
let
|
|
822
|
-
type:
|
|
823
|
-
className:
|
|
824
|
-
style:
|
|
825
|
-
onClick:
|
|
826
|
-
disabled:
|
|
827
|
-
ref:
|
|
828
|
-
}),
|
|
1632
|
+
href: Q ? void 0 : ue.href,
|
|
1633
|
+
style: Te,
|
|
1634
|
+
onClick: Pe,
|
|
1635
|
+
ref: X,
|
|
1636
|
+
tabIndex: Q ? -1 : 0
|
|
1637
|
+
}), Me, Ae));
|
|
1638
|
+
let de = /* @__PURE__ */ u.createElement("button", Object.assign({}, M, {
|
|
1639
|
+
type: K,
|
|
1640
|
+
className: je,
|
|
1641
|
+
style: Te,
|
|
1642
|
+
onClick: Pe,
|
|
1643
|
+
disabled: Q,
|
|
1644
|
+
ref: X
|
|
1645
|
+
}), Me, Ae, !!De && /* @__PURE__ */ u.createElement(Rr, {
|
|
829
1646
|
key: "compact",
|
|
830
|
-
prefixCls:
|
|
1647
|
+
prefixCls: v
|
|
831
1648
|
}));
|
|
832
|
-
return
|
|
1649
|
+
return oe(R) || (de = /* @__PURE__ */ u.createElement(_t, {
|
|
833
1650
|
component: "Button",
|
|
834
|
-
disabled:
|
|
835
|
-
},
|
|
836
|
-
}),
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
process.env.NODE_ENV !== "production" && (
|
|
1651
|
+
disabled: V
|
|
1652
|
+
}, de)), Re(de);
|
|
1653
|
+
}), Oe = Pr;
|
|
1654
|
+
Oe.Group = At;
|
|
1655
|
+
Oe.__ANT_BUTTON = !0;
|
|
1656
|
+
process.env.NODE_ENV !== "production" && (Oe.displayName = "Button");
|
|
840
1657
|
export {
|
|
841
|
-
|
|
842
|
-
|
|
1658
|
+
Oe as B,
|
|
1659
|
+
Mr as c
|
|
843
1660
|
};
|