@gobolt/genesis 0.0.7
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/README.md +86 -0
- package/dist/AntdIcon-Bsnbyy6g.js +200 -0
- package/dist/CheckOutlined-DAynWe12.js +527 -0
- package/dist/CloseCircleFilled-ZIY-u-27.js +13 -0
- package/dist/Compact-CJBo3f0u.js +185 -0
- package/dist/ContextIsolator-CGkdKtc3.js +20 -0
- package/dist/ExclamationCircleFilled-BICVVQIg.js +21 -0
- package/dist/Form-Cylpi4M4.js +1815 -0
- package/dist/Overflow-CP1M4Z0s.js +369 -0
- package/dist/SearchOutlined-DuzJkIiQ.js +52 -0
- package/dist/TextArea-3MOYYuAQ.js +1680 -0
- package/dist/bundle.css +1 -0
- package/dist/button-BNV2qdrP.js +1392 -0
- package/dist/compact-item-DH13cl8A.js +61 -0
- package/dist/components/atoms/button/Button.d.ts +12 -0
- package/dist/components/atoms/button/Button.js +27 -0
- package/dist/components/atoms/button/__stories__/Button.stories.d.ts +13 -0
- package/dist/components/atoms/button/index.d.ts +2 -0
- package/dist/components/atoms/button/index.js +4 -0
- package/dist/components/atoms/button/styles.d.ts +12 -0
- package/dist/components/atoms/button/styles.js +71 -0
- package/dist/components/atoms/checkbox/Checkbox.d.ts +10 -0
- package/dist/components/atoms/checkbox/Checkbox.js +13 -0
- package/dist/components/atoms/checkbox/__stories__/Checkbox.stories.d.ts +8 -0
- package/dist/components/atoms/checkbox/__tests__/Checkbox.test.d.ts +1 -0
- package/dist/components/atoms/checkbox/__tests__/Checkbox.test.js +18 -0
- package/dist/components/atoms/checkbox/index.d.ts +2 -0
- package/dist/components/atoms/checkbox/index.js +4 -0
- package/dist/components/atoms/checkbox/styles.d.ts +11 -0
- package/dist/components/atoms/checkbox/styles.js +582 -0
- package/dist/components/atoms/index.d.ts +1 -0
- package/dist/components/atoms/index.js +3 -0
- package/dist/components/atoms/input/Input.d.ts +11 -0
- package/dist/components/atoms/input/Input.js +12 -0
- package/dist/components/atoms/input/__stories__/Input.stories.d.ts +10 -0
- package/dist/components/atoms/input/__tests__/Input.test.d.ts +1 -0
- package/dist/components/atoms/input/__tests__/Input.test.js +28 -0
- package/dist/components/atoms/input/index.d.ts +2 -0
- package/dist/components/atoms/input/index.js +4 -0
- package/dist/components/atoms/input/styles.d.ts +14 -0
- package/dist/components/atoms/input/styles.js +415 -0
- package/dist/components/atoms/select/Select.d.ts +11 -0
- package/dist/components/atoms/select/Select.js +24 -0
- package/dist/components/atoms/select/__stories__/Select.stories.d.ts +8 -0
- package/dist/components/atoms/select/__tests__/Select.test.d.ts +1 -0
- package/dist/components/atoms/select/__tests__/Select.test.js +10735 -0
- package/dist/components/atoms/select/index.d.ts +2 -0
- package/dist/components/atoms/select/index.js +4 -0
- package/dist/components/atoms/select/styles.d.ts +15 -0
- package/dist/components/atoms/select/styles.js +3868 -0
- package/dist/components/atoms/typography/Typography.d.ts +11 -0
- package/dist/components/atoms/typography/Typography.js +44 -0
- package/dist/components/atoms/typography/__stories__/Typography.stories.d.ts +12 -0
- package/dist/components/atoms/typography/__tests__/Typography.test.d.ts +1 -0
- package/dist/components/atoms/typography/__tests__/Typography.test.js +16 -0
- package/dist/components/atoms/typography/index.d.ts +2 -0
- package/dist/components/atoms/typography/index.js +4 -0
- package/dist/components/atoms/typography/styles.d.ts +11 -0
- package/dist/components/atoms/typography/styles.js +28 -0
- package/dist/components/index.d.js +1 -0
- package/dist/components/index.d.ts +14 -0
- package/dist/components/index.js +16 -0
- package/dist/components/molecules/error-boundary-fallback/ErrorBoundaryFallback.d.ts +10 -0
- package/dist/components/molecules/error-boundary-fallback/ErrorBoundaryFallback.js +35 -0
- package/dist/components/molecules/error-boundary-fallback/__stories__/ErrorBoundaryFallback.stories.d.ts +8 -0
- package/dist/components/molecules/error-boundary-fallback/index.d.ts +1 -0
- package/dist/components/molecules/error-boundary-fallback/index.js +4 -0
- package/dist/components/molecules/error-boundary-fallback/styles.d.ts +1 -0
- package/dist/components/molecules/error-boundary-fallback/styles.js +930 -0
- package/dist/components/molecules/form/Form.d.ts +15 -0
- package/dist/components/molecules/form/Form.js +7 -0
- package/dist/components/molecules/form/__stories__/Form.stories.d.ts +7 -0
- package/dist/components/molecules/form/__stories__/FormStory.d.ts +1 -0
- package/dist/components/molecules/form/__stories__/FormStory.js +90 -0
- package/dist/components/molecules/form/index.d.ts +2 -0
- package/dist/components/molecules/form/index.js +4 -0
- package/dist/constants/index.d.ts +51 -0
- package/dist/constants/index.js +54 -0
- package/dist/context-CZsFJmh6.js +2093 -0
- package/dist/declaration.d.js +1 -0
- package/dist/genesis/GenesisThemeBreakdown.d.ts +4 -0
- package/dist/genesis/GenesisThemeBreakdown.js +56 -0
- package/dist/genesis/GenesisThemeDemo.d.ts +8 -0
- package/dist/genesis/GenesisThemeDemo.js +8 -0
- package/dist/genesis/GenesisThemeDemo.stories.d.ts +7 -0
- package/dist/genesis/styles.d.ts +12 -0
- package/dist/genesis/styles.js +4038 -0
- package/dist/index-3MWkSVA1.js +96 -0
- package/dist/index-BPtFqhcp.js +19110 -0
- package/dist/index-BQO27mgE.js +402 -0
- package/dist/index-BWys7dkb.js +4462 -0
- package/dist/index-C7kFNqp2.js +276 -0
- package/dist/index-D1v_7IIx.js +1057 -0
- package/dist/index-SAAXFt-P.js +946 -0
- package/dist/index-VDH3iLaC.js +884 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +20 -0
- package/dist/isVisible-CNQjrJPN.js +366 -0
- package/dist/magic-string.es-BkUFmFT4.js +858 -0
- package/dist/presetColors-Cl8UP3Nw.js +4 -0
- package/dist/providers/GenesisProvider.d.ts +8 -0
- package/dist/providers/GenesisProvider.js +7 -0
- package/dist/providers/ThemeProvider.d.ts +9 -0
- package/dist/providers/ThemeProvider.js +18 -0
- package/dist/providers/index.d.ts +2 -0
- package/dist/providers/index.js +6 -0
- package/dist/reactNode-sKPeiqPL.js +12 -0
- package/dist/setup-CMYVZCPF.js +33883 -0
- package/dist/styled-components.browser.esm-CZ1XM4o4.js +1144 -0
- package/dist/styles/design-tokens/border-tokens/BorderTokenList.d.ts +1 -0
- package/dist/styles/design-tokens/border-tokens/BorderTokenList.js +37 -0
- package/dist/styles/design-tokens/border-tokens/BorderTokens.stories.d.ts +6 -0
- package/dist/styles/design-tokens/color-tokens/ColorTokens.stories.d.ts +7 -0
- package/dist/styles/design-tokens/sizing-tokens/SizingTokenList.d.ts +3 -0
- package/dist/styles/design-tokens/sizing-tokens/SizingTokenList.js +36 -0
- package/dist/styles/design-tokens/sizing-tokens/index.stories.d.ts +7 -0
- package/dist/styles/design-tokens/typography/TypographyTokens.stories.d.ts +7 -0
- package/dist/styles/design-tokens/variables.d.ts +704 -0
- package/dist/styles/design-tokens/variables.js +697 -0
- package/dist/styles/global-styles.d.ts +1 -0
- package/dist/styles/global-styles.js +35 -0
- package/dist/styles/theme/genesis-theme.d.ts +75 -0
- package/dist/styles/theme/genesis-theme.js +896 -0
- package/dist/styles/theme/genesis-theme.types.d.ts +162 -0
- package/dist/styles/theme/genesis-theme.types.js +4 -0
- package/dist/styles/theme/global-styles.d.ts +1 -0
- package/dist/styles/theme/global-styles.js +35 -0
- package/dist/styles/theme/index.d.ts +1 -0
- package/dist/styles/theme/index.js +9 -0
- package/dist/test/setup.d.ts +5 -0
- package/dist/test/setup.js +7 -0
- package/dist/useVariants-CEpw6Ww6.js +29 -0
- package/dist/utils/getAppointmentColor.d.ts +4 -0
- package/dist/utils/getAppointmentColor.js +91 -0
- package/dist/utils/isAllEnglishString.d.ts +1 -0
- package/dist/utils/isAllEnglishString.js +8 -0
- package/dist/utils/isAllEnglishString.test.d.ts +1 -0
- package/dist/utils/isAllEnglishString.test.js +8 -0
- package/dist/utils/parseAddress.d.ts +3 -0
- package/dist/utils/parseAddress.js +19 -0
- package/dist/vite-env.d.js +1 -0
- package/package.json +115 -0
|
@@ -0,0 +1,1392 @@
|
|
|
1
|
+
import * as K from "react";
|
|
2
|
+
import s, { forwardRef as oe, useState as xe, useRef as j, useEffect as k, useMemo as ee, useContext as be, Children as pr } from "react";
|
|
3
|
+
import { C as Ue, N as yr, A as Qe, c as N, H as Sr, M as xr, o as Er, p as $r, q as Je, r as Ze, d as Ke, a as I, Q as ke, b as Br, e as X, h as Ee, k as er, _ as he, n as ne, R as ve, m as Hr, z as te, T as Or, U as Rr, W as Nr, F as Pr, v as jr } from "./index-BWys7dkb.js";
|
|
4
|
+
import { u as wr, o as Ir } from "./isVisible-CNQjrJPN.js";
|
|
5
|
+
import { W as Dr } from "./index-C7kFNqp2.js";
|
|
6
|
+
import { R as Tr, b as zr, a as Lr } from "./Compact-CJBo3f0u.js";
|
|
7
|
+
import { c as Ar, i as _r } from "./reactNode-sKPeiqPL.js";
|
|
8
|
+
import { P as rr } from "./presetColors-Cl8UP3Nw.js";
|
|
9
|
+
import { g as Mr } from "./compact-item-DH13cl8A.js";
|
|
10
|
+
var Gr = function(e, r) {
|
|
11
|
+
var t = {};
|
|
12
|
+
for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && r.indexOf(o) < 0 && (t[o] = e[o]);
|
|
13
|
+
if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var n = 0, o = Object.getOwnPropertySymbols(e); n < o.length; n++)
|
|
14
|
+
r.indexOf(o[n]) < 0 && Object.prototype.propertyIsEnumerable.call(e, o[n]) && (t[o[n]] = e[o[n]]);
|
|
15
|
+
return t;
|
|
16
|
+
};
|
|
17
|
+
const tr = /* @__PURE__ */ K.createContext(void 0), Fr = (e) => {
|
|
18
|
+
const {
|
|
19
|
+
getPrefixCls: r,
|
|
20
|
+
direction: t
|
|
21
|
+
} = K.useContext(Ue), {
|
|
22
|
+
prefixCls: o,
|
|
23
|
+
size: n,
|
|
24
|
+
className: a
|
|
25
|
+
} = e, l = Gr(e, ["prefixCls", "size", "className"]), i = r("btn-group", o), [, , c] = yr();
|
|
26
|
+
let u = "";
|
|
27
|
+
switch (n) {
|
|
28
|
+
case "large":
|
|
29
|
+
u = "lg";
|
|
30
|
+
break;
|
|
31
|
+
case "small":
|
|
32
|
+
u = "sm";
|
|
33
|
+
break;
|
|
34
|
+
}
|
|
35
|
+
if (process.env.NODE_ENV !== "production") {
|
|
36
|
+
const g = Qe("Button.Group");
|
|
37
|
+
process.env.NODE_ENV !== "production" && g(!n || ["large", "small", "middle"].includes(n), "usage", "Invalid prop `size`.");
|
|
38
|
+
}
|
|
39
|
+
const d = N(i, {
|
|
40
|
+
[`${i}-${u}`]: u,
|
|
41
|
+
[`${i}-rtl`]: t === "rtl"
|
|
42
|
+
}, a, c);
|
|
43
|
+
return /* @__PURE__ */ K.createElement(tr.Provider, {
|
|
44
|
+
value: n
|
|
45
|
+
}, /* @__PURE__ */ K.createElement("div", Object.assign({}, l, {
|
|
46
|
+
className: d
|
|
47
|
+
})));
|
|
48
|
+
}, We = /^[\u4E00-\u9FA5]{2}$/, $e = We.test.bind(We);
|
|
49
|
+
function qe(e) {
|
|
50
|
+
return typeof e == "string";
|
|
51
|
+
}
|
|
52
|
+
function re(e) {
|
|
53
|
+
return e === "text" || e === "link";
|
|
54
|
+
}
|
|
55
|
+
function Vr(e, r) {
|
|
56
|
+
if (e == null)
|
|
57
|
+
return;
|
|
58
|
+
const t = r ? " " : "";
|
|
59
|
+
return typeof e != "string" && typeof e != "number" && qe(e.type) && $e(e.props.children) ? Ar(e, {
|
|
60
|
+
children: e.props.children.split("").join(t)
|
|
61
|
+
}) : qe(e) ? $e(e) ? /* @__PURE__ */ s.createElement("span", null, e.split("").join(t)) : /* @__PURE__ */ s.createElement("span", null, e) : _r(e) ? /* @__PURE__ */ s.createElement("span", null, e) : e;
|
|
62
|
+
}
|
|
63
|
+
function Wr(e, r) {
|
|
64
|
+
let t = !1;
|
|
65
|
+
const o = [];
|
|
66
|
+
return s.Children.forEach(e, (n) => {
|
|
67
|
+
const a = typeof n, l = a === "string" || a === "number";
|
|
68
|
+
if (t && l) {
|
|
69
|
+
const i = o.length - 1, c = o[i];
|
|
70
|
+
o[i] = `${c}${n}`;
|
|
71
|
+
} else
|
|
72
|
+
o.push(n);
|
|
73
|
+
t = l;
|
|
74
|
+
}), s.Children.map(o, (n) => Vr(n, r));
|
|
75
|
+
}
|
|
76
|
+
["default", "primary", "danger"].concat(Sr(rr));
|
|
77
|
+
const Be = /* @__PURE__ */ oe((e, r) => {
|
|
78
|
+
const {
|
|
79
|
+
className: t,
|
|
80
|
+
style: o,
|
|
81
|
+
children: n,
|
|
82
|
+
prefixCls: a
|
|
83
|
+
} = e, l = N(`${a}-icon`, t);
|
|
84
|
+
return /* @__PURE__ */ s.createElement("span", {
|
|
85
|
+
ref: r,
|
|
86
|
+
className: l,
|
|
87
|
+
style: o
|
|
88
|
+
}, n);
|
|
89
|
+
}), Xe = /* @__PURE__ */ oe((e, r) => {
|
|
90
|
+
const {
|
|
91
|
+
prefixCls: t,
|
|
92
|
+
className: o,
|
|
93
|
+
style: n,
|
|
94
|
+
iconClassName: a
|
|
95
|
+
} = e, l = N(`${t}-loading-icon`, o);
|
|
96
|
+
return /* @__PURE__ */ s.createElement(Be, {
|
|
97
|
+
prefixCls: t,
|
|
98
|
+
className: l,
|
|
99
|
+
style: n,
|
|
100
|
+
ref: r
|
|
101
|
+
}, /* @__PURE__ */ s.createElement(Tr, {
|
|
102
|
+
className: a
|
|
103
|
+
}));
|
|
104
|
+
}), pe = () => ({
|
|
105
|
+
width: 0,
|
|
106
|
+
opacity: 0,
|
|
107
|
+
transform: "scale(0)"
|
|
108
|
+
}), ye = (e) => ({
|
|
109
|
+
width: e.scrollWidth,
|
|
110
|
+
opacity: 1,
|
|
111
|
+
transform: "scale(1)"
|
|
112
|
+
}), qr = (e) => {
|
|
113
|
+
const {
|
|
114
|
+
prefixCls: r,
|
|
115
|
+
loading: t,
|
|
116
|
+
existIcon: o,
|
|
117
|
+
className: n,
|
|
118
|
+
style: a,
|
|
119
|
+
mount: l
|
|
120
|
+
} = e, i = !!t;
|
|
121
|
+
return o ? /* @__PURE__ */ s.createElement(Xe, {
|
|
122
|
+
prefixCls: r,
|
|
123
|
+
className: n,
|
|
124
|
+
style: a
|
|
125
|
+
}) : /* @__PURE__ */ s.createElement(xr, {
|
|
126
|
+
visible: i,
|
|
127
|
+
// Used for minus flex gap style only
|
|
128
|
+
motionName: `${r}-loading-icon-motion`,
|
|
129
|
+
motionAppear: !l,
|
|
130
|
+
motionEnter: !l,
|
|
131
|
+
motionLeave: !l,
|
|
132
|
+
removeOnLeave: !0,
|
|
133
|
+
onAppearStart: pe,
|
|
134
|
+
onAppearActive: ye,
|
|
135
|
+
onEnterStart: pe,
|
|
136
|
+
onEnterActive: ye,
|
|
137
|
+
onLeaveStart: ye,
|
|
138
|
+
onLeaveActive: pe
|
|
139
|
+
}, (c, u) => {
|
|
140
|
+
let {
|
|
141
|
+
className: d,
|
|
142
|
+
style: g
|
|
143
|
+
} = c;
|
|
144
|
+
const h = Object.assign(Object.assign({}, a), g);
|
|
145
|
+
return /* @__PURE__ */ s.createElement(Xe, {
|
|
146
|
+
prefixCls: r,
|
|
147
|
+
className: N(n, d),
|
|
148
|
+
style: h,
|
|
149
|
+
ref: u
|
|
150
|
+
});
|
|
151
|
+
});
|
|
152
|
+
}, Ye = (e, r) => ({
|
|
153
|
+
// Border
|
|
154
|
+
[`> span, > ${e}`]: {
|
|
155
|
+
"&:not(:last-child)": {
|
|
156
|
+
[`&, & > ${e}`]: {
|
|
157
|
+
"&:not(:disabled)": {
|
|
158
|
+
borderInlineEndColor: r
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
"&:not(:first-child)": {
|
|
163
|
+
[`&, & > ${e}`]: {
|
|
164
|
+
"&:not(:disabled)": {
|
|
165
|
+
borderInlineStartColor: r
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}), Xr = (e) => {
|
|
171
|
+
const {
|
|
172
|
+
componentCls: r,
|
|
173
|
+
fontSize: t,
|
|
174
|
+
lineWidth: o,
|
|
175
|
+
groupBorderColor: n,
|
|
176
|
+
colorErrorHover: a
|
|
177
|
+
} = e;
|
|
178
|
+
return {
|
|
179
|
+
[`${r}-group`]: [
|
|
180
|
+
{
|
|
181
|
+
position: "relative",
|
|
182
|
+
display: "inline-flex",
|
|
183
|
+
// Border
|
|
184
|
+
[`> span, > ${r}`]: {
|
|
185
|
+
"&:not(:last-child)": {
|
|
186
|
+
[`&, & > ${r}`]: {
|
|
187
|
+
borderStartEndRadius: 0,
|
|
188
|
+
borderEndEndRadius: 0
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
"&:not(:first-child)": {
|
|
192
|
+
marginInlineStart: e.calc(o).mul(-1).equal(),
|
|
193
|
+
[`&, & > ${r}`]: {
|
|
194
|
+
borderStartStartRadius: 0,
|
|
195
|
+
borderEndStartRadius: 0
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
},
|
|
199
|
+
[r]: {
|
|
200
|
+
position: "relative",
|
|
201
|
+
zIndex: 1,
|
|
202
|
+
"&:hover, &:focus, &:active": {
|
|
203
|
+
zIndex: 2
|
|
204
|
+
},
|
|
205
|
+
"&[disabled]": {
|
|
206
|
+
zIndex: 0
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
[`${r}-icon-only`]: {
|
|
210
|
+
fontSize: t
|
|
211
|
+
}
|
|
212
|
+
},
|
|
213
|
+
// Border Color
|
|
214
|
+
Ye(`${r}-primary`, n),
|
|
215
|
+
Ye(`${r}-danger`, a)
|
|
216
|
+
]
|
|
217
|
+
};
|
|
218
|
+
};
|
|
219
|
+
var Yr = ["b"], Ur = ["v"], Se = function(r) {
|
|
220
|
+
return Math.round(Number(r || 0));
|
|
221
|
+
}, Qr = function(r) {
|
|
222
|
+
if (r instanceof ke)
|
|
223
|
+
return r;
|
|
224
|
+
if (r && Br(r) === "object" && "h" in r && "b" in r) {
|
|
225
|
+
var t = r, o = t.b, n = Ke(t, Yr);
|
|
226
|
+
return I(I({}, n), {}, {
|
|
227
|
+
v: o
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
return typeof r == "string" && /hsb/.test(r) ? r.replace(/hsb/, "hsv") : r;
|
|
231
|
+
}, D = /* @__PURE__ */ function(e) {
|
|
232
|
+
Er(t, e);
|
|
233
|
+
var r = $r(t);
|
|
234
|
+
function t(o) {
|
|
235
|
+
return Je(this, t), r.call(this, Qr(o));
|
|
236
|
+
}
|
|
237
|
+
return Ze(t, [{
|
|
238
|
+
key: "toHsbString",
|
|
239
|
+
value: function() {
|
|
240
|
+
var n = this.toHsb(), a = Se(n.s * 100), l = Se(n.b * 100), i = Se(n.h), c = n.a, u = "hsb(".concat(i, ", ").concat(a, "%, ").concat(l, "%)"), d = "hsba(".concat(i, ", ").concat(a, "%, ").concat(l, "%, ").concat(c.toFixed(c === 0 ? 0 : 2), ")");
|
|
241
|
+
return c === 1 ? u : d;
|
|
242
|
+
}
|
|
243
|
+
}, {
|
|
244
|
+
key: "toHsb",
|
|
245
|
+
value: function() {
|
|
246
|
+
var n = this.toHsv(), a = n.v, l = Ke(n, Ur);
|
|
247
|
+
return I(I({}, l), {}, {
|
|
248
|
+
b: a,
|
|
249
|
+
a: this.a
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
}]), t;
|
|
253
|
+
}(ke), Jr = "rc-color-picker", q = function(r) {
|
|
254
|
+
return r instanceof D ? r : new D(r);
|
|
255
|
+
}, Zr = q("#1677ff"), or = function(r) {
|
|
256
|
+
var t = r.offset, o = r.targetRef, n = r.containerRef, a = r.color, l = r.type, i = n.current.getBoundingClientRect(), c = i.width, u = i.height, d = o.current.getBoundingClientRect(), g = d.width, h = d.height, m = g / 2, C = h / 2, y = (t.x + m) / c, $ = 1 - (t.y + C) / u, H = a.toHsb(), B = y, S = (t.x + m) / c * 360;
|
|
257
|
+
if (l)
|
|
258
|
+
switch (l) {
|
|
259
|
+
case "hue":
|
|
260
|
+
return q(I(I({}, H), {}, {
|
|
261
|
+
h: S <= 0 ? 0 : S
|
|
262
|
+
}));
|
|
263
|
+
case "alpha":
|
|
264
|
+
return q(I(I({}, H), {}, {
|
|
265
|
+
a: B <= 0 ? 0 : B
|
|
266
|
+
}));
|
|
267
|
+
}
|
|
268
|
+
return q({
|
|
269
|
+
h: H.h,
|
|
270
|
+
s: y <= 0 ? 0 : y,
|
|
271
|
+
b: $ >= 1 ? 1 : $,
|
|
272
|
+
a: H.a
|
|
273
|
+
});
|
|
274
|
+
}, nr = function(r, t) {
|
|
275
|
+
var o = r.toHsb();
|
|
276
|
+
switch (t) {
|
|
277
|
+
case "hue":
|
|
278
|
+
return {
|
|
279
|
+
x: o.h / 360 * 100,
|
|
280
|
+
y: 50
|
|
281
|
+
};
|
|
282
|
+
case "alpha":
|
|
283
|
+
return {
|
|
284
|
+
x: r.a * 100,
|
|
285
|
+
y: 50
|
|
286
|
+
};
|
|
287
|
+
default:
|
|
288
|
+
return {
|
|
289
|
+
x: o.s * 100,
|
|
290
|
+
y: (1 - o.b) * 100
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
}, Kr = function(r) {
|
|
294
|
+
var t = r.color, o = r.prefixCls, n = r.className, a = r.style, l = r.onClick, i = "".concat(o, "-color-block");
|
|
295
|
+
return /* @__PURE__ */ s.createElement("div", {
|
|
296
|
+
className: N(i, n),
|
|
297
|
+
style: a,
|
|
298
|
+
onClick: l
|
|
299
|
+
}, /* @__PURE__ */ s.createElement("div", {
|
|
300
|
+
className: "".concat(i, "-inner"),
|
|
301
|
+
style: {
|
|
302
|
+
background: t
|
|
303
|
+
}
|
|
304
|
+
}));
|
|
305
|
+
};
|
|
306
|
+
function kr(e) {
|
|
307
|
+
var r = "touches" in e ? e.touches[0] : e, t = document.documentElement.scrollLeft || document.body.scrollLeft || window.pageXOffset, o = document.documentElement.scrollTop || document.body.scrollTop || window.pageYOffset;
|
|
308
|
+
return {
|
|
309
|
+
pageX: r.pageX - t,
|
|
310
|
+
pageY: r.pageY - o
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
function ar(e) {
|
|
314
|
+
var r = e.targetRef, t = e.containerRef, o = e.direction, n = e.onDragChange, a = e.onDragChangeComplete, l = e.calculate, i = e.color, c = e.disabledDrag, u = xe({
|
|
315
|
+
x: 0,
|
|
316
|
+
y: 0
|
|
317
|
+
}), d = X(u, 2), g = d[0], h = d[1], m = j(null), C = j(null);
|
|
318
|
+
k(function() {
|
|
319
|
+
h(l());
|
|
320
|
+
}, [i]), k(function() {
|
|
321
|
+
return function() {
|
|
322
|
+
document.removeEventListener("mousemove", m.current), document.removeEventListener("mouseup", C.current), document.removeEventListener("touchmove", m.current), document.removeEventListener("touchend", C.current), m.current = null, C.current = null;
|
|
323
|
+
};
|
|
324
|
+
}, []);
|
|
325
|
+
var y = function(f) {
|
|
326
|
+
var b = kr(f), Y = b.pageX, U = b.pageY, O = t.current.getBoundingClientRect(), G = O.x, T = O.y, Q = O.width, F = O.height, z = r.current.getBoundingClientRect(), L = z.width, R = z.height, V = L / 2, M = R / 2, P = Math.max(0, Math.min(Y - G, Q)) - V, v = Math.max(0, Math.min(U - T, F)) - M, x = {
|
|
327
|
+
x: P,
|
|
328
|
+
y: o === "x" ? g.y : v
|
|
329
|
+
};
|
|
330
|
+
if (L === 0 && R === 0 || L !== R)
|
|
331
|
+
return !1;
|
|
332
|
+
n == null || n(x);
|
|
333
|
+
}, $ = function(f) {
|
|
334
|
+
f.preventDefault(), y(f);
|
|
335
|
+
}, H = function(f) {
|
|
336
|
+
f.preventDefault(), document.removeEventListener("mousemove", m.current), document.removeEventListener("mouseup", C.current), document.removeEventListener("touchmove", m.current), document.removeEventListener("touchend", C.current), m.current = null, C.current = null, a == null || a();
|
|
337
|
+
}, B = function(f) {
|
|
338
|
+
document.removeEventListener("mousemove", m.current), document.removeEventListener("mouseup", C.current), !c && (y(f), document.addEventListener("mousemove", $), document.addEventListener("mouseup", H), document.addEventListener("touchmove", $), document.addEventListener("touchend", H), m.current = $, C.current = H);
|
|
339
|
+
};
|
|
340
|
+
return [g, B];
|
|
341
|
+
}
|
|
342
|
+
var lr = function(r) {
|
|
343
|
+
var t = r.size, o = t === void 0 ? "default" : t, n = r.color, a = r.prefixCls;
|
|
344
|
+
return /* @__PURE__ */ s.createElement("div", {
|
|
345
|
+
className: N("".concat(a, "-handler"), Ee({}, "".concat(a, "-handler-sm"), o === "small")),
|
|
346
|
+
style: {
|
|
347
|
+
backgroundColor: n
|
|
348
|
+
}
|
|
349
|
+
});
|
|
350
|
+
}, ir = function(r) {
|
|
351
|
+
var t = r.children, o = r.style, n = r.prefixCls;
|
|
352
|
+
return /* @__PURE__ */ s.createElement("div", {
|
|
353
|
+
className: "".concat(n, "-palette"),
|
|
354
|
+
style: I({
|
|
355
|
+
position: "relative"
|
|
356
|
+
}, o)
|
|
357
|
+
}, t);
|
|
358
|
+
}, cr = /* @__PURE__ */ oe(function(e, r) {
|
|
359
|
+
var t = e.children, o = e.x, n = e.y;
|
|
360
|
+
return /* @__PURE__ */ s.createElement("div", {
|
|
361
|
+
ref: r,
|
|
362
|
+
style: {
|
|
363
|
+
position: "absolute",
|
|
364
|
+
left: "".concat(o, "%"),
|
|
365
|
+
top: "".concat(n, "%"),
|
|
366
|
+
zIndex: 1,
|
|
367
|
+
transform: "translate(-50%, -50%)"
|
|
368
|
+
}
|
|
369
|
+
}, t);
|
|
370
|
+
}), et = function(r) {
|
|
371
|
+
var t = r.color, o = r.onChange, n = r.prefixCls, a = r.onChangeComplete, l = r.disabled, i = j(), c = j(), u = j(t), d = er(function(y) {
|
|
372
|
+
var $ = or({
|
|
373
|
+
offset: y,
|
|
374
|
+
targetRef: c,
|
|
375
|
+
containerRef: i,
|
|
376
|
+
color: t
|
|
377
|
+
});
|
|
378
|
+
u.current = $, o($);
|
|
379
|
+
}), g = ar({
|
|
380
|
+
color: t,
|
|
381
|
+
containerRef: i,
|
|
382
|
+
targetRef: c,
|
|
383
|
+
calculate: function() {
|
|
384
|
+
return nr(t);
|
|
385
|
+
},
|
|
386
|
+
onDragChange: d,
|
|
387
|
+
onDragChangeComplete: function() {
|
|
388
|
+
return a == null ? void 0 : a(u.current);
|
|
389
|
+
},
|
|
390
|
+
disabledDrag: l
|
|
391
|
+
}), h = X(g, 2), m = h[0], C = h[1];
|
|
392
|
+
return /* @__PURE__ */ s.createElement("div", {
|
|
393
|
+
ref: i,
|
|
394
|
+
className: "".concat(n, "-select"),
|
|
395
|
+
onMouseDown: C,
|
|
396
|
+
onTouchStart: C
|
|
397
|
+
}, /* @__PURE__ */ s.createElement(ir, {
|
|
398
|
+
prefixCls: n
|
|
399
|
+
}, /* @__PURE__ */ s.createElement(cr, {
|
|
400
|
+
x: m.x,
|
|
401
|
+
y: m.y,
|
|
402
|
+
ref: c
|
|
403
|
+
}, /* @__PURE__ */ s.createElement(lr, {
|
|
404
|
+
color: t.toRgbString(),
|
|
405
|
+
prefixCls: n
|
|
406
|
+
})), /* @__PURE__ */ s.createElement("div", {
|
|
407
|
+
className: "".concat(n, "-saturation"),
|
|
408
|
+
style: {
|
|
409
|
+
backgroundColor: "hsl(".concat(t.toHsb().h, ",100%, 50%)"),
|
|
410
|
+
backgroundImage: "linear-gradient(0deg, #000, transparent),linear-gradient(90deg, #fff, hsla(0, 0%, 100%, 0))"
|
|
411
|
+
}
|
|
412
|
+
})));
|
|
413
|
+
}, rt = function(r, t) {
|
|
414
|
+
var o = wr(r, {
|
|
415
|
+
value: t
|
|
416
|
+
}), n = X(o, 2), a = n[0], l = n[1], i = ee(function() {
|
|
417
|
+
return q(a);
|
|
418
|
+
}, [a]);
|
|
419
|
+
return [i, l];
|
|
420
|
+
}, tt = function(r) {
|
|
421
|
+
var t = r.colors, o = r.children, n = r.direction, a = n === void 0 ? "to right" : n, l = r.type, i = r.prefixCls, c = ee(function() {
|
|
422
|
+
return t.map(function(u, d) {
|
|
423
|
+
var g = q(u);
|
|
424
|
+
return l === "alpha" && d === t.length - 1 && (g = new D(g.setA(1))), g.toRgbString();
|
|
425
|
+
}).join(",");
|
|
426
|
+
}, [t, l]);
|
|
427
|
+
return /* @__PURE__ */ s.createElement("div", {
|
|
428
|
+
className: "".concat(i, "-gradient"),
|
|
429
|
+
style: {
|
|
430
|
+
position: "absolute",
|
|
431
|
+
inset: 0,
|
|
432
|
+
background: "linear-gradient(".concat(a, ", ").concat(c, ")")
|
|
433
|
+
}
|
|
434
|
+
}, o);
|
|
435
|
+
}, ot = function(r) {
|
|
436
|
+
var t = r.prefixCls, o = r.colors, n = r.disabled, a = r.onChange, l = r.onChangeComplete, i = r.color, c = r.type, u = j(), d = j(), g = j(i), h = function(b) {
|
|
437
|
+
return c === "hue" ? b.getHue() : b.a * 100;
|
|
438
|
+
}, m = er(function(f) {
|
|
439
|
+
var b = or({
|
|
440
|
+
offset: f,
|
|
441
|
+
targetRef: d,
|
|
442
|
+
containerRef: u,
|
|
443
|
+
color: i,
|
|
444
|
+
type: c
|
|
445
|
+
});
|
|
446
|
+
g.current = b, a(h(b));
|
|
447
|
+
}), C = ar({
|
|
448
|
+
color: i,
|
|
449
|
+
targetRef: d,
|
|
450
|
+
containerRef: u,
|
|
451
|
+
calculate: function() {
|
|
452
|
+
return nr(i, c);
|
|
453
|
+
},
|
|
454
|
+
onDragChange: m,
|
|
455
|
+
onDragChangeComplete: function() {
|
|
456
|
+
l(h(g.current));
|
|
457
|
+
},
|
|
458
|
+
direction: "x",
|
|
459
|
+
disabledDrag: n
|
|
460
|
+
}), y = X(C, 2), $ = y[0], H = y[1], B = s.useMemo(function() {
|
|
461
|
+
if (c === "hue") {
|
|
462
|
+
var f = i.toHsb();
|
|
463
|
+
f.s = 1, f.b = 1, f.a = 1;
|
|
464
|
+
var b = new D(f);
|
|
465
|
+
return b;
|
|
466
|
+
}
|
|
467
|
+
return i;
|
|
468
|
+
}, [i, c]), S = s.useMemo(function() {
|
|
469
|
+
return o.map(function(f) {
|
|
470
|
+
return "".concat(f.color, " ").concat(f.percent, "%");
|
|
471
|
+
});
|
|
472
|
+
}, [o]);
|
|
473
|
+
return /* @__PURE__ */ s.createElement("div", {
|
|
474
|
+
ref: u,
|
|
475
|
+
className: N("".concat(t, "-slider"), "".concat(t, "-slider-").concat(c)),
|
|
476
|
+
onMouseDown: H,
|
|
477
|
+
onTouchStart: H
|
|
478
|
+
}, /* @__PURE__ */ s.createElement(ir, {
|
|
479
|
+
prefixCls: t
|
|
480
|
+
}, /* @__PURE__ */ s.createElement(cr, {
|
|
481
|
+
x: $.x,
|
|
482
|
+
y: $.y,
|
|
483
|
+
ref: d
|
|
484
|
+
}, /* @__PURE__ */ s.createElement(lr, {
|
|
485
|
+
size: "small",
|
|
486
|
+
color: B.toHexString(),
|
|
487
|
+
prefixCls: t
|
|
488
|
+
})), /* @__PURE__ */ s.createElement(tt, {
|
|
489
|
+
colors: S,
|
|
490
|
+
type: c,
|
|
491
|
+
prefixCls: t
|
|
492
|
+
})));
|
|
493
|
+
};
|
|
494
|
+
function nt(e) {
|
|
495
|
+
return K.useMemo(function() {
|
|
496
|
+
var r = e || {}, t = r.slider;
|
|
497
|
+
return [t || ot];
|
|
498
|
+
}, [e]);
|
|
499
|
+
}
|
|
500
|
+
var at = [{
|
|
501
|
+
color: "rgb(255, 0, 0)",
|
|
502
|
+
percent: 0
|
|
503
|
+
}, {
|
|
504
|
+
color: "rgb(255, 255, 0)",
|
|
505
|
+
percent: 17
|
|
506
|
+
}, {
|
|
507
|
+
color: "rgb(0, 255, 0)",
|
|
508
|
+
percent: 33
|
|
509
|
+
}, {
|
|
510
|
+
color: "rgb(0, 255, 255)",
|
|
511
|
+
percent: 50
|
|
512
|
+
}, {
|
|
513
|
+
color: "rgb(0, 0, 255)",
|
|
514
|
+
percent: 67
|
|
515
|
+
}, {
|
|
516
|
+
color: "rgb(255, 0, 255)",
|
|
517
|
+
percent: 83
|
|
518
|
+
}, {
|
|
519
|
+
color: "rgb(255, 0, 0)",
|
|
520
|
+
percent: 100
|
|
521
|
+
}], lt = /* @__PURE__ */ oe(function(e, r) {
|
|
522
|
+
var t = e.value, o = e.defaultValue, n = e.prefixCls, a = n === void 0 ? Jr : n, l = e.onChange, i = e.onChangeComplete, c = e.className, u = e.style, d = e.panelRender, g = e.disabledAlpha, h = g === void 0 ? !1 : g, m = e.disabled, C = m === void 0 ? !1 : m, y = e.components, $ = nt(y), H = X($, 1), B = H[0], S = rt(o || Zr, t), f = X(S, 2), b = f[0], Y = f[1], U = ee(function() {
|
|
523
|
+
return b.setA(1).toRgbString();
|
|
524
|
+
}, [b]), O = function(v, x) {
|
|
525
|
+
t || Y(v), l == null || l(v, x);
|
|
526
|
+
}, G = function(v) {
|
|
527
|
+
return new D(b.setHue(v));
|
|
528
|
+
}, T = function(v) {
|
|
529
|
+
return new D(b.setA(v / 100));
|
|
530
|
+
}, Q = function(v) {
|
|
531
|
+
O(G(v), {
|
|
532
|
+
type: "hue",
|
|
533
|
+
value: v
|
|
534
|
+
});
|
|
535
|
+
}, F = function(v) {
|
|
536
|
+
O(T(v), {
|
|
537
|
+
type: "alpha",
|
|
538
|
+
value: v
|
|
539
|
+
});
|
|
540
|
+
}, z = function(v) {
|
|
541
|
+
i && i(G(v));
|
|
542
|
+
}, L = function(v) {
|
|
543
|
+
i && i(T(v));
|
|
544
|
+
}, R = N("".concat(a, "-panel"), c, Ee({}, "".concat(a, "-panel-disabled"), C)), V = {
|
|
545
|
+
prefixCls: a,
|
|
546
|
+
disabled: C,
|
|
547
|
+
color: b
|
|
548
|
+
}, M = /* @__PURE__ */ s.createElement(s.Fragment, null, /* @__PURE__ */ s.createElement(et, he({
|
|
549
|
+
onChange: O
|
|
550
|
+
}, V, {
|
|
551
|
+
onChangeComplete: i
|
|
552
|
+
})), /* @__PURE__ */ s.createElement("div", {
|
|
553
|
+
className: "".concat(a, "-slider-container")
|
|
554
|
+
}, /* @__PURE__ */ s.createElement("div", {
|
|
555
|
+
className: N("".concat(a, "-slider-group"), Ee({}, "".concat(a, "-slider-group-disabled-alpha"), h))
|
|
556
|
+
}, /* @__PURE__ */ s.createElement(B, he({}, V, {
|
|
557
|
+
type: "hue",
|
|
558
|
+
colors: at,
|
|
559
|
+
min: 0,
|
|
560
|
+
max: 359,
|
|
561
|
+
value: b.getHue(),
|
|
562
|
+
onChange: Q,
|
|
563
|
+
onChangeComplete: z
|
|
564
|
+
})), !h && /* @__PURE__ */ s.createElement(B, he({}, V, {
|
|
565
|
+
type: "alpha",
|
|
566
|
+
colors: [{
|
|
567
|
+
percent: 0,
|
|
568
|
+
color: "rgba(255, 0, 4, 0)"
|
|
569
|
+
}, {
|
|
570
|
+
percent: 100,
|
|
571
|
+
color: U
|
|
572
|
+
}],
|
|
573
|
+
min: 0,
|
|
574
|
+
max: 100,
|
|
575
|
+
value: b.a * 100,
|
|
576
|
+
onChange: F,
|
|
577
|
+
onChangeComplete: L
|
|
578
|
+
}))), /* @__PURE__ */ s.createElement(Kr, {
|
|
579
|
+
color: b.toRgbString(),
|
|
580
|
+
prefixCls: a
|
|
581
|
+
})));
|
|
582
|
+
return /* @__PURE__ */ s.createElement("div", {
|
|
583
|
+
className: R,
|
|
584
|
+
style: u,
|
|
585
|
+
ref: r
|
|
586
|
+
}, typeof d == "function" ? d(M) : M);
|
|
587
|
+
});
|
|
588
|
+
process.env.NODE_ENV !== "production" && (lt.displayName = "ColorPicker");
|
|
589
|
+
const it = (e, r) => (e == null ? void 0 : e.replace(/[^\w/]/g, "").slice(0, r ? 8 : 6)) || "", ct = (e, r) => e ? it(e, r) : "";
|
|
590
|
+
let st = /* @__PURE__ */ function() {
|
|
591
|
+
function e(r) {
|
|
592
|
+
Je(this, e);
|
|
593
|
+
var t;
|
|
594
|
+
if (this.cleared = !1, r instanceof e) {
|
|
595
|
+
this.metaColor = r.metaColor.clone(), this.colors = (t = r.colors) === null || t === void 0 ? void 0 : t.map((n) => ({
|
|
596
|
+
color: new e(n.color),
|
|
597
|
+
percent: n.percent
|
|
598
|
+
})), this.cleared = r.cleared;
|
|
599
|
+
return;
|
|
600
|
+
}
|
|
601
|
+
const o = Array.isArray(r);
|
|
602
|
+
o && r.length ? (this.colors = r.map((n) => {
|
|
603
|
+
let {
|
|
604
|
+
color: a,
|
|
605
|
+
percent: l
|
|
606
|
+
} = n;
|
|
607
|
+
return {
|
|
608
|
+
color: new e(a),
|
|
609
|
+
percent: l
|
|
610
|
+
};
|
|
611
|
+
}), this.metaColor = new D(this.colors[0].color.metaColor)) : this.metaColor = new D(o ? "" : r), (!r || o && !this.colors) && (this.metaColor = this.metaColor.setA(0), this.cleared = !0);
|
|
612
|
+
}
|
|
613
|
+
return Ze(e, [{
|
|
614
|
+
key: "toHsb",
|
|
615
|
+
value: function() {
|
|
616
|
+
return this.metaColor.toHsb();
|
|
617
|
+
}
|
|
618
|
+
}, {
|
|
619
|
+
key: "toHsbString",
|
|
620
|
+
value: function() {
|
|
621
|
+
return this.metaColor.toHsbString();
|
|
622
|
+
}
|
|
623
|
+
}, {
|
|
624
|
+
key: "toHex",
|
|
625
|
+
value: function() {
|
|
626
|
+
return ct(this.toHexString(), this.metaColor.a < 1);
|
|
627
|
+
}
|
|
628
|
+
}, {
|
|
629
|
+
key: "toHexString",
|
|
630
|
+
value: function() {
|
|
631
|
+
return this.metaColor.toHexString();
|
|
632
|
+
}
|
|
633
|
+
}, {
|
|
634
|
+
key: "toRgb",
|
|
635
|
+
value: function() {
|
|
636
|
+
return this.metaColor.toRgb();
|
|
637
|
+
}
|
|
638
|
+
}, {
|
|
639
|
+
key: "toRgbString",
|
|
640
|
+
value: function() {
|
|
641
|
+
return this.metaColor.toRgbString();
|
|
642
|
+
}
|
|
643
|
+
}, {
|
|
644
|
+
key: "isGradient",
|
|
645
|
+
value: function() {
|
|
646
|
+
return !!this.colors && !this.cleared;
|
|
647
|
+
}
|
|
648
|
+
}, {
|
|
649
|
+
key: "getColors",
|
|
650
|
+
value: function() {
|
|
651
|
+
return this.colors || [{
|
|
652
|
+
color: this,
|
|
653
|
+
percent: 0
|
|
654
|
+
}];
|
|
655
|
+
}
|
|
656
|
+
}, {
|
|
657
|
+
key: "toCssString",
|
|
658
|
+
value: function() {
|
|
659
|
+
const {
|
|
660
|
+
colors: t
|
|
661
|
+
} = this;
|
|
662
|
+
return t ? `linear-gradient(90deg, ${t.map((n) => `${n.color.toRgbString()} ${n.percent}%`).join(", ")})` : this.metaColor.toRgbString();
|
|
663
|
+
}
|
|
664
|
+
}, {
|
|
665
|
+
key: "equals",
|
|
666
|
+
value: function(t) {
|
|
667
|
+
return !t || this.isGradient() !== t.isGradient() ? !1 : this.isGradient() ? this.colors.length === t.colors.length && this.colors.every((o, n) => {
|
|
668
|
+
const a = t.colors[n];
|
|
669
|
+
return o.percent === a.percent && o.color.equals(a.color);
|
|
670
|
+
}) : this.toHexString() === t.toHexString();
|
|
671
|
+
}
|
|
672
|
+
}]);
|
|
673
|
+
}();
|
|
674
|
+
const ut = (e, r) => {
|
|
675
|
+
const {
|
|
676
|
+
r: t,
|
|
677
|
+
g: o,
|
|
678
|
+
b: n,
|
|
679
|
+
a
|
|
680
|
+
} = e.toRgb(), l = new D(e.toRgbString()).onBackground(r).toHsv();
|
|
681
|
+
return a <= 0.5 ? l.v > 0.5 : t * 0.299 + o * 0.587 + n * 0.114 > 192;
|
|
682
|
+
}, sr = (e) => {
|
|
683
|
+
const {
|
|
684
|
+
paddingInline: r,
|
|
685
|
+
onlyIconSize: t
|
|
686
|
+
} = e;
|
|
687
|
+
return ne(e, {
|
|
688
|
+
buttonPaddingHorizontal: r,
|
|
689
|
+
buttonPaddingVertical: 0,
|
|
690
|
+
buttonIconOnlyFontSize: t
|
|
691
|
+
});
|
|
692
|
+
}, ur = (e) => {
|
|
693
|
+
var r, t, o, n, a, l;
|
|
694
|
+
const i = (r = e.contentFontSize) !== null && r !== void 0 ? r : e.fontSize, c = (t = e.contentFontSizeSM) !== null && t !== void 0 ? t : e.fontSize, u = (o = e.contentFontSizeLG) !== null && o !== void 0 ? o : e.fontSizeLG, d = (n = e.contentLineHeight) !== null && n !== void 0 ? n : ve(i), g = (a = e.contentLineHeightSM) !== null && a !== void 0 ? a : ve(c), h = (l = e.contentLineHeightLG) !== null && l !== void 0 ? l : ve(u), m = ut(new st(e.colorBgSolid), "#fff") ? "#000" : "#fff";
|
|
695
|
+
return {
|
|
696
|
+
fontWeight: 400,
|
|
697
|
+
defaultShadow: `0 ${e.controlOutlineWidth}px 0 ${e.controlTmpOutline}`,
|
|
698
|
+
primaryShadow: `0 ${e.controlOutlineWidth}px 0 ${e.controlOutline}`,
|
|
699
|
+
dangerShadow: `0 ${e.controlOutlineWidth}px 0 ${e.colorErrorOutline}`,
|
|
700
|
+
primaryColor: e.colorTextLightSolid,
|
|
701
|
+
dangerColor: e.colorTextLightSolid,
|
|
702
|
+
borderColorDisabled: e.colorBorder,
|
|
703
|
+
defaultGhostColor: e.colorBgContainer,
|
|
704
|
+
ghostBg: "transparent",
|
|
705
|
+
defaultGhostBorderColor: e.colorBgContainer,
|
|
706
|
+
paddingInline: e.paddingContentHorizontal - e.lineWidth,
|
|
707
|
+
paddingInlineLG: e.paddingContentHorizontal - e.lineWidth,
|
|
708
|
+
paddingInlineSM: 8 - e.lineWidth,
|
|
709
|
+
onlyIconSize: "inherit",
|
|
710
|
+
onlyIconSizeSM: "inherit",
|
|
711
|
+
onlyIconSizeLG: "inherit",
|
|
712
|
+
groupBorderColor: e.colorPrimaryHover,
|
|
713
|
+
linkHoverBg: "transparent",
|
|
714
|
+
textTextColor: e.colorText,
|
|
715
|
+
textTextHoverColor: e.colorText,
|
|
716
|
+
textTextActiveColor: e.colorText,
|
|
717
|
+
textHoverBg: e.colorFillTertiary,
|
|
718
|
+
defaultColor: e.colorText,
|
|
719
|
+
defaultBg: e.colorBgContainer,
|
|
720
|
+
defaultBorderColor: e.colorBorder,
|
|
721
|
+
defaultBorderColorDisabled: e.colorBorder,
|
|
722
|
+
defaultHoverBg: e.colorBgContainer,
|
|
723
|
+
defaultHoverColor: e.colorPrimaryHover,
|
|
724
|
+
defaultHoverBorderColor: e.colorPrimaryHover,
|
|
725
|
+
defaultActiveBg: e.colorBgContainer,
|
|
726
|
+
defaultActiveColor: e.colorPrimaryActive,
|
|
727
|
+
defaultActiveBorderColor: e.colorPrimaryActive,
|
|
728
|
+
solidTextColor: m,
|
|
729
|
+
contentFontSize: i,
|
|
730
|
+
contentFontSizeSM: c,
|
|
731
|
+
contentFontSizeLG: u,
|
|
732
|
+
contentLineHeight: d,
|
|
733
|
+
contentLineHeightSM: g,
|
|
734
|
+
contentLineHeightLG: h,
|
|
735
|
+
paddingBlock: Math.max((e.controlHeight - i * d) / 2 - e.lineWidth, 0),
|
|
736
|
+
paddingBlockSM: Math.max((e.controlHeightSM - c * g) / 2 - e.lineWidth, 0),
|
|
737
|
+
paddingBlockLG: Math.max((e.controlHeightLG - u * h) / 2 - e.lineWidth, 0)
|
|
738
|
+
};
|
|
739
|
+
}, dt = (e) => {
|
|
740
|
+
const {
|
|
741
|
+
componentCls: r,
|
|
742
|
+
iconCls: t,
|
|
743
|
+
fontWeight: o,
|
|
744
|
+
opacityLoading: n,
|
|
745
|
+
motionDurationSlow: a,
|
|
746
|
+
motionEaseInOut: l,
|
|
747
|
+
marginXS: i,
|
|
748
|
+
calc: c
|
|
749
|
+
} = e;
|
|
750
|
+
return {
|
|
751
|
+
[r]: {
|
|
752
|
+
outline: "none",
|
|
753
|
+
position: "relative",
|
|
754
|
+
display: "inline-flex",
|
|
755
|
+
gap: e.marginXS,
|
|
756
|
+
alignItems: "center",
|
|
757
|
+
justifyContent: "center",
|
|
758
|
+
fontWeight: o,
|
|
759
|
+
whiteSpace: "nowrap",
|
|
760
|
+
textAlign: "center",
|
|
761
|
+
backgroundImage: "none",
|
|
762
|
+
background: "transparent",
|
|
763
|
+
border: `${te(e.lineWidth)} ${e.lineType} transparent`,
|
|
764
|
+
cursor: "pointer",
|
|
765
|
+
transition: `all ${e.motionDurationMid} ${e.motionEaseInOut}`,
|
|
766
|
+
userSelect: "none",
|
|
767
|
+
touchAction: "manipulation",
|
|
768
|
+
color: e.colorText,
|
|
769
|
+
"&:disabled > *": {
|
|
770
|
+
pointerEvents: "none"
|
|
771
|
+
},
|
|
772
|
+
// https://github.com/ant-design/ant-design/issues/51380
|
|
773
|
+
[`${r}-icon > svg`]: Or(),
|
|
774
|
+
"> a": {
|
|
775
|
+
color: "currentColor"
|
|
776
|
+
},
|
|
777
|
+
"&:not(:disabled)": Rr(e),
|
|
778
|
+
[`&${r}-two-chinese-chars::first-letter`]: {
|
|
779
|
+
letterSpacing: "0.34em"
|
|
780
|
+
},
|
|
781
|
+
[`&${r}-two-chinese-chars > *:not(${t})`]: {
|
|
782
|
+
marginInlineEnd: "-0.34em",
|
|
783
|
+
letterSpacing: "0.34em"
|
|
784
|
+
},
|
|
785
|
+
[`&${r}-icon-only`]: {
|
|
786
|
+
paddingInline: 0,
|
|
787
|
+
// make `btn-icon-only` not too narrow
|
|
788
|
+
[`&${r}-compact-item`]: {
|
|
789
|
+
flex: "none"
|
|
790
|
+
},
|
|
791
|
+
[`&${r}-round`]: {
|
|
792
|
+
width: "auto"
|
|
793
|
+
}
|
|
794
|
+
},
|
|
795
|
+
// Loading
|
|
796
|
+
[`&${r}-loading`]: {
|
|
797
|
+
opacity: n,
|
|
798
|
+
cursor: "default"
|
|
799
|
+
},
|
|
800
|
+
[`${r}-loading-icon`]: {
|
|
801
|
+
transition: ["width", "opacity", "margin"].map((u) => `${u} ${a} ${l}`).join(",")
|
|
802
|
+
},
|
|
803
|
+
// iconPosition
|
|
804
|
+
[`&:not(${r}-icon-end)`]: {
|
|
805
|
+
[`${r}-loading-icon-motion`]: {
|
|
806
|
+
"&-appear-start, &-enter-start": {
|
|
807
|
+
marginInlineEnd: c(i).mul(-1).equal()
|
|
808
|
+
},
|
|
809
|
+
"&-appear-active, &-enter-active": {
|
|
810
|
+
marginInlineEnd: 0
|
|
811
|
+
},
|
|
812
|
+
"&-leave-start": {
|
|
813
|
+
marginInlineEnd: 0
|
|
814
|
+
},
|
|
815
|
+
"&-leave-active": {
|
|
816
|
+
marginInlineEnd: c(i).mul(-1).equal()
|
|
817
|
+
}
|
|
818
|
+
}
|
|
819
|
+
},
|
|
820
|
+
"&-icon-end": {
|
|
821
|
+
flexDirection: "row-reverse",
|
|
822
|
+
[`${r}-loading-icon-motion`]: {
|
|
823
|
+
"&-appear-start, &-enter-start": {
|
|
824
|
+
marginInlineStart: c(i).mul(-1).equal()
|
|
825
|
+
},
|
|
826
|
+
"&-appear-active, &-enter-active": {
|
|
827
|
+
marginInlineStart: 0
|
|
828
|
+
},
|
|
829
|
+
"&-leave-start": {
|
|
830
|
+
marginInlineStart: 0
|
|
831
|
+
},
|
|
832
|
+
"&-leave-active": {
|
|
833
|
+
marginInlineStart: c(i).mul(-1).equal()
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
};
|
|
839
|
+
}, dr = (e, r, t) => ({
|
|
840
|
+
[`&:not(:disabled):not(${e}-disabled)`]: {
|
|
841
|
+
"&:hover": r,
|
|
842
|
+
"&:active": t
|
|
843
|
+
}
|
|
844
|
+
}), gt = (e) => ({
|
|
845
|
+
minWidth: e.controlHeight,
|
|
846
|
+
paddingInlineStart: 0,
|
|
847
|
+
paddingInlineEnd: 0,
|
|
848
|
+
borderRadius: "50%"
|
|
849
|
+
}), ft = (e) => ({
|
|
850
|
+
borderRadius: e.controlHeight,
|
|
851
|
+
paddingInlineStart: e.calc(e.controlHeight).div(2).equal(),
|
|
852
|
+
paddingInlineEnd: e.calc(e.controlHeight).div(2).equal()
|
|
853
|
+
}), mt = (e) => ({
|
|
854
|
+
cursor: "not-allowed",
|
|
855
|
+
borderColor: e.borderColorDisabled,
|
|
856
|
+
color: e.colorTextDisabled,
|
|
857
|
+
background: e.colorBgContainerDisabled,
|
|
858
|
+
boxShadow: "none"
|
|
859
|
+
}), He = (e, r, t, o, n, a, l, i) => ({
|
|
860
|
+
[`&${e}-background-ghost`]: Object.assign(Object.assign({
|
|
861
|
+
color: t || void 0,
|
|
862
|
+
background: r,
|
|
863
|
+
borderColor: o || void 0,
|
|
864
|
+
boxShadow: "none"
|
|
865
|
+
}, dr(e, Object.assign({
|
|
866
|
+
background: r
|
|
867
|
+
}, l), Object.assign({
|
|
868
|
+
background: r
|
|
869
|
+
}, i))), {
|
|
870
|
+
"&:disabled": {
|
|
871
|
+
cursor: "not-allowed",
|
|
872
|
+
color: n || void 0,
|
|
873
|
+
borderColor: a || void 0
|
|
874
|
+
}
|
|
875
|
+
})
|
|
876
|
+
}), Ct = (e) => ({
|
|
877
|
+
[`&:disabled, &${e.componentCls}-disabled`]: Object.assign({}, mt(e))
|
|
878
|
+
}), bt = (e) => ({
|
|
879
|
+
[`&:disabled, &${e.componentCls}-disabled`]: {
|
|
880
|
+
cursor: "not-allowed",
|
|
881
|
+
color: e.colorTextDisabled
|
|
882
|
+
}
|
|
883
|
+
}), ae = (e, r, t, o) => {
|
|
884
|
+
const a = o && ["link", "text"].includes(o) ? bt : Ct;
|
|
885
|
+
return Object.assign(Object.assign({}, a(e)), dr(e.componentCls, r, t));
|
|
886
|
+
}, le = (e, r, t, o, n) => ({
|
|
887
|
+
[`&${e.componentCls}-variant-solid`]: Object.assign({
|
|
888
|
+
color: r,
|
|
889
|
+
background: t
|
|
890
|
+
}, ae(e, o, n))
|
|
891
|
+
}), ie = (e, r, t, o, n) => ({
|
|
892
|
+
[`&${e.componentCls}-variant-outlined, &${e.componentCls}-variant-dashed`]: Object.assign({
|
|
893
|
+
borderColor: r,
|
|
894
|
+
background: t
|
|
895
|
+
}, ae(e, o, n))
|
|
896
|
+
}), ce = (e) => ({
|
|
897
|
+
[`&${e.componentCls}-variant-dashed`]: {
|
|
898
|
+
borderStyle: "dashed"
|
|
899
|
+
}
|
|
900
|
+
}), se = (e, r, t, o) => ({
|
|
901
|
+
[`&${e.componentCls}-variant-filled`]: Object.assign({
|
|
902
|
+
boxShadow: "none",
|
|
903
|
+
background: r
|
|
904
|
+
}, ae(e, t, o))
|
|
905
|
+
}), _ = (e, r, t, o, n) => ({
|
|
906
|
+
[`&${e.componentCls}-variant-${t}`]: Object.assign({
|
|
907
|
+
color: r,
|
|
908
|
+
boxShadow: "none"
|
|
909
|
+
}, ae(e, o, n, t))
|
|
910
|
+
}), ht = (e) => {
|
|
911
|
+
const {
|
|
912
|
+
componentCls: r
|
|
913
|
+
} = e;
|
|
914
|
+
return rr.reduce((t, o) => {
|
|
915
|
+
const n = e[`${o}6`], a = e[`${o}1`], l = e[`${o}5`], i = e[`${o}2`], c = e[`${o}3`], u = e[`${o}7`], d = `0 ${te(e.controlOutlineWidth)} 0 ${e[`${o}1`]}`;
|
|
916
|
+
return Object.assign(Object.assign({}, t), {
|
|
917
|
+
[`&${r}-color-${o}`]: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({
|
|
918
|
+
color: n,
|
|
919
|
+
boxShadow: d
|
|
920
|
+
}, le(e, e.colorTextLightSolid, n, {
|
|
921
|
+
background: l
|
|
922
|
+
}, {
|
|
923
|
+
background: u
|
|
924
|
+
})), ie(e, n, e.colorBgContainer, {
|
|
925
|
+
color: l,
|
|
926
|
+
borderColor: l,
|
|
927
|
+
background: e.colorBgContainer
|
|
928
|
+
}, {
|
|
929
|
+
color: u,
|
|
930
|
+
borderColor: u,
|
|
931
|
+
background: e.colorBgContainer
|
|
932
|
+
})), ce(e)), se(e, a, {
|
|
933
|
+
background: i
|
|
934
|
+
}, {
|
|
935
|
+
background: c
|
|
936
|
+
})), _(e, n, "link", {
|
|
937
|
+
color: l
|
|
938
|
+
}, {
|
|
939
|
+
color: u
|
|
940
|
+
})), _(e, n, "text", {
|
|
941
|
+
color: l,
|
|
942
|
+
background: a
|
|
943
|
+
}, {
|
|
944
|
+
color: u,
|
|
945
|
+
background: c
|
|
946
|
+
}))
|
|
947
|
+
});
|
|
948
|
+
}, {});
|
|
949
|
+
}, vt = (e) => Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({
|
|
950
|
+
color: e.defaultColor,
|
|
951
|
+
boxShadow: e.defaultShadow
|
|
952
|
+
}, le(e, e.solidTextColor, e.colorBgSolid, {
|
|
953
|
+
color: e.solidTextColor,
|
|
954
|
+
background: e.colorBgSolidHover
|
|
955
|
+
}, {
|
|
956
|
+
color: e.solidTextColor,
|
|
957
|
+
background: e.colorBgSolidActive
|
|
958
|
+
})), ce(e)), se(e, e.colorFillTertiary, {
|
|
959
|
+
background: e.colorFillSecondary
|
|
960
|
+
}, {
|
|
961
|
+
background: e.colorFill
|
|
962
|
+
})), _(e, e.textTextColor, "link", {
|
|
963
|
+
color: e.colorLinkHover,
|
|
964
|
+
background: e.linkHoverBg
|
|
965
|
+
}, {
|
|
966
|
+
color: e.colorLinkActive
|
|
967
|
+
})), He(e.componentCls, e.ghostBg, e.defaultGhostColor, e.defaultGhostBorderColor, e.colorTextDisabled, e.colorBorder)), pt = (e) => Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({
|
|
968
|
+
color: e.colorPrimary,
|
|
969
|
+
boxShadow: e.primaryShadow
|
|
970
|
+
}, ie(e, e.colorPrimary, e.colorBgContainer, {
|
|
971
|
+
color: e.colorPrimaryTextHover,
|
|
972
|
+
borderColor: e.colorPrimaryHover,
|
|
973
|
+
background: e.colorBgContainer
|
|
974
|
+
}, {
|
|
975
|
+
color: e.colorPrimaryTextActive,
|
|
976
|
+
borderColor: e.colorPrimaryActive,
|
|
977
|
+
background: e.colorBgContainer
|
|
978
|
+
})), ce(e)), se(e, e.colorPrimaryBg, {
|
|
979
|
+
background: e.colorPrimaryBgHover
|
|
980
|
+
}, {
|
|
981
|
+
background: e.colorPrimaryBorder
|
|
982
|
+
})), _(e, e.colorLink, "text", {
|
|
983
|
+
color: e.colorPrimaryTextHover,
|
|
984
|
+
background: e.colorPrimaryBg
|
|
985
|
+
}, {
|
|
986
|
+
color: e.colorPrimaryTextActive,
|
|
987
|
+
background: e.colorPrimaryBorder
|
|
988
|
+
})), He(e.componentCls, e.ghostBg, e.colorPrimary, e.colorPrimary, e.colorTextDisabled, e.colorBorder, {
|
|
989
|
+
color: e.colorPrimaryHover,
|
|
990
|
+
borderColor: e.colorPrimaryHover
|
|
991
|
+
}, {
|
|
992
|
+
color: e.colorPrimaryActive,
|
|
993
|
+
borderColor: e.colorPrimaryActive
|
|
994
|
+
})), yt = (e) => Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({
|
|
995
|
+
color: e.colorError,
|
|
996
|
+
boxShadow: e.dangerShadow
|
|
997
|
+
}, le(e, e.dangerColor, e.colorError, {
|
|
998
|
+
background: e.colorErrorHover
|
|
999
|
+
}, {
|
|
1000
|
+
background: e.colorErrorActive
|
|
1001
|
+
})), ie(e, e.colorError, e.colorBgContainer, {
|
|
1002
|
+
color: e.colorErrorHover,
|
|
1003
|
+
borderColor: e.colorErrorBorderHover
|
|
1004
|
+
}, {
|
|
1005
|
+
color: e.colorErrorActive,
|
|
1006
|
+
borderColor: e.colorErrorActive
|
|
1007
|
+
})), ce(e)), se(e, e.colorErrorBg, {
|
|
1008
|
+
background: e.colorErrorBgFilledHover
|
|
1009
|
+
}, {
|
|
1010
|
+
background: e.colorErrorBgActive
|
|
1011
|
+
})), _(e, e.colorError, "text", {
|
|
1012
|
+
color: e.colorErrorHover,
|
|
1013
|
+
background: e.colorErrorBg
|
|
1014
|
+
}, {
|
|
1015
|
+
color: e.colorErrorHover,
|
|
1016
|
+
background: e.colorErrorBgActive
|
|
1017
|
+
})), _(e, e.colorError, "link", {
|
|
1018
|
+
color: e.colorErrorHover
|
|
1019
|
+
}, {
|
|
1020
|
+
color: e.colorErrorActive
|
|
1021
|
+
})), He(e.componentCls, e.ghostBg, e.colorError, e.colorError, e.colorTextDisabled, e.colorBorder, {
|
|
1022
|
+
color: e.colorErrorHover,
|
|
1023
|
+
borderColor: e.colorErrorHover
|
|
1024
|
+
}, {
|
|
1025
|
+
color: e.colorErrorActive,
|
|
1026
|
+
borderColor: e.colorErrorActive
|
|
1027
|
+
})), St = (e) => {
|
|
1028
|
+
const {
|
|
1029
|
+
componentCls: r
|
|
1030
|
+
} = e;
|
|
1031
|
+
return Object.assign({
|
|
1032
|
+
[`${r}-color-default`]: vt(e),
|
|
1033
|
+
[`${r}-color-primary`]: pt(e),
|
|
1034
|
+
[`${r}-color-dangerous`]: yt(e)
|
|
1035
|
+
}, ht(e));
|
|
1036
|
+
}, xt = (e) => Object.assign(Object.assign(Object.assign(Object.assign({}, ie(e, e.defaultBorderColor, e.defaultBg, {
|
|
1037
|
+
color: e.defaultHoverColor,
|
|
1038
|
+
borderColor: e.defaultHoverBorderColor,
|
|
1039
|
+
background: e.defaultHoverBg
|
|
1040
|
+
}, {
|
|
1041
|
+
color: e.defaultActiveColor,
|
|
1042
|
+
borderColor: e.defaultActiveBorderColor,
|
|
1043
|
+
background: e.defaultActiveBg
|
|
1044
|
+
})), _(e, e.textTextColor, "text", {
|
|
1045
|
+
color: e.textTextHoverColor,
|
|
1046
|
+
background: e.textHoverBg
|
|
1047
|
+
}, {
|
|
1048
|
+
color: e.textTextActiveColor,
|
|
1049
|
+
background: e.colorBgTextActive
|
|
1050
|
+
})), le(e, e.primaryColor, e.colorPrimary, {
|
|
1051
|
+
background: e.colorPrimaryHover,
|
|
1052
|
+
color: e.primaryColor
|
|
1053
|
+
}, {
|
|
1054
|
+
background: e.colorPrimaryActive,
|
|
1055
|
+
color: e.primaryColor
|
|
1056
|
+
})), _(e, e.colorLink, "link", {
|
|
1057
|
+
color: e.colorLinkHover,
|
|
1058
|
+
background: e.linkHoverBg
|
|
1059
|
+
}, {
|
|
1060
|
+
color: e.colorLinkActive
|
|
1061
|
+
})), Oe = function(e) {
|
|
1062
|
+
let r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "";
|
|
1063
|
+
const {
|
|
1064
|
+
componentCls: t,
|
|
1065
|
+
controlHeight: o,
|
|
1066
|
+
fontSize: n,
|
|
1067
|
+
borderRadius: a,
|
|
1068
|
+
buttonPaddingHorizontal: l,
|
|
1069
|
+
iconCls: i,
|
|
1070
|
+
buttonPaddingVertical: c,
|
|
1071
|
+
buttonIconOnlyFontSize: u
|
|
1072
|
+
} = e;
|
|
1073
|
+
return [
|
|
1074
|
+
{
|
|
1075
|
+
[r]: {
|
|
1076
|
+
fontSize: n,
|
|
1077
|
+
height: o,
|
|
1078
|
+
padding: `${te(c)} ${te(l)}`,
|
|
1079
|
+
borderRadius: a,
|
|
1080
|
+
[`&${t}-icon-only`]: {
|
|
1081
|
+
width: o,
|
|
1082
|
+
[i]: {
|
|
1083
|
+
fontSize: u
|
|
1084
|
+
}
|
|
1085
|
+
}
|
|
1086
|
+
}
|
|
1087
|
+
},
|
|
1088
|
+
// Shape - patch prefixCls again to override solid border radius style
|
|
1089
|
+
{
|
|
1090
|
+
[`${t}${t}-circle${r}`]: gt(e)
|
|
1091
|
+
},
|
|
1092
|
+
{
|
|
1093
|
+
[`${t}${t}-round${r}`]: ft(e)
|
|
1094
|
+
}
|
|
1095
|
+
];
|
|
1096
|
+
}, Et = (e) => {
|
|
1097
|
+
const r = ne(e, {
|
|
1098
|
+
fontSize: e.contentFontSize
|
|
1099
|
+
});
|
|
1100
|
+
return Oe(r, e.componentCls);
|
|
1101
|
+
}, $t = (e) => {
|
|
1102
|
+
const r = ne(e, {
|
|
1103
|
+
controlHeight: e.controlHeightSM,
|
|
1104
|
+
fontSize: e.contentFontSizeSM,
|
|
1105
|
+
padding: e.paddingXS,
|
|
1106
|
+
buttonPaddingHorizontal: e.paddingInlineSM,
|
|
1107
|
+
buttonPaddingVertical: 0,
|
|
1108
|
+
borderRadius: e.borderRadiusSM,
|
|
1109
|
+
buttonIconOnlyFontSize: e.onlyIconSizeSM
|
|
1110
|
+
});
|
|
1111
|
+
return Oe(r, `${e.componentCls}-sm`);
|
|
1112
|
+
}, Bt = (e) => {
|
|
1113
|
+
const r = ne(e, {
|
|
1114
|
+
controlHeight: e.controlHeightLG,
|
|
1115
|
+
fontSize: e.contentFontSizeLG,
|
|
1116
|
+
buttonPaddingHorizontal: e.paddingInlineLG,
|
|
1117
|
+
buttonPaddingVertical: 0,
|
|
1118
|
+
borderRadius: e.borderRadiusLG,
|
|
1119
|
+
buttonIconOnlyFontSize: e.onlyIconSizeLG
|
|
1120
|
+
});
|
|
1121
|
+
return Oe(r, `${e.componentCls}-lg`);
|
|
1122
|
+
}, Ht = (e) => {
|
|
1123
|
+
const {
|
|
1124
|
+
componentCls: r
|
|
1125
|
+
} = e;
|
|
1126
|
+
return {
|
|
1127
|
+
[r]: {
|
|
1128
|
+
[`&${r}-block`]: {
|
|
1129
|
+
width: "100%"
|
|
1130
|
+
}
|
|
1131
|
+
}
|
|
1132
|
+
};
|
|
1133
|
+
}, Ot = Hr("Button", (e) => {
|
|
1134
|
+
const r = sr(e);
|
|
1135
|
+
return [
|
|
1136
|
+
// Shared
|
|
1137
|
+
dt(r),
|
|
1138
|
+
// Size
|
|
1139
|
+
Et(r),
|
|
1140
|
+
$t(r),
|
|
1141
|
+
Bt(r),
|
|
1142
|
+
// Block
|
|
1143
|
+
Ht(r),
|
|
1144
|
+
// Color
|
|
1145
|
+
St(r),
|
|
1146
|
+
// https://github.com/ant-design/ant-design/issues/50969
|
|
1147
|
+
xt(r),
|
|
1148
|
+
// Button Group
|
|
1149
|
+
Xr(r)
|
|
1150
|
+
];
|
|
1151
|
+
}, ur, {
|
|
1152
|
+
unitless: {
|
|
1153
|
+
fontWeight: !0,
|
|
1154
|
+
contentLineHeight: !0,
|
|
1155
|
+
contentLineHeightSM: !0,
|
|
1156
|
+
contentLineHeightLG: !0
|
|
1157
|
+
}
|
|
1158
|
+
});
|
|
1159
|
+
function Rt(e, r) {
|
|
1160
|
+
return {
|
|
1161
|
+
// border collapse
|
|
1162
|
+
[`&-item:not(${r}-last-item)`]: {
|
|
1163
|
+
marginBottom: e.calc(e.lineWidth).mul(-1).equal()
|
|
1164
|
+
},
|
|
1165
|
+
"&-item": {
|
|
1166
|
+
"&:hover,&:focus,&:active": {
|
|
1167
|
+
zIndex: 2
|
|
1168
|
+
},
|
|
1169
|
+
"&[disabled]": {
|
|
1170
|
+
zIndex: 0
|
|
1171
|
+
}
|
|
1172
|
+
}
|
|
1173
|
+
};
|
|
1174
|
+
}
|
|
1175
|
+
function Nt(e, r) {
|
|
1176
|
+
return {
|
|
1177
|
+
[`&-item:not(${r}-first-item):not(${r}-last-item)`]: {
|
|
1178
|
+
borderRadius: 0
|
|
1179
|
+
},
|
|
1180
|
+
[`&-item${r}-first-item:not(${r}-last-item)`]: {
|
|
1181
|
+
[`&, &${e}-sm, &${e}-lg`]: {
|
|
1182
|
+
borderEndEndRadius: 0,
|
|
1183
|
+
borderEndStartRadius: 0
|
|
1184
|
+
}
|
|
1185
|
+
},
|
|
1186
|
+
[`&-item${r}-last-item:not(${r}-first-item)`]: {
|
|
1187
|
+
[`&, &${e}-sm, &${e}-lg`]: {
|
|
1188
|
+
borderStartStartRadius: 0,
|
|
1189
|
+
borderStartEndRadius: 0
|
|
1190
|
+
}
|
|
1191
|
+
}
|
|
1192
|
+
};
|
|
1193
|
+
}
|
|
1194
|
+
function Pt(e) {
|
|
1195
|
+
const r = `${e.componentCls}-compact-vertical`;
|
|
1196
|
+
return {
|
|
1197
|
+
[r]: Object.assign(Object.assign({}, Rt(e, r)), Nt(e.componentCls, r))
|
|
1198
|
+
};
|
|
1199
|
+
}
|
|
1200
|
+
const jt = (e) => {
|
|
1201
|
+
const {
|
|
1202
|
+
componentCls: r,
|
|
1203
|
+
colorPrimaryHover: t,
|
|
1204
|
+
lineWidth: o,
|
|
1205
|
+
calc: n
|
|
1206
|
+
} = e, a = n(o).mul(-1).equal(), l = (i) => ({
|
|
1207
|
+
[`${r}-compact${i ? "-vertical" : ""}-item${r}-primary:not([disabled])`]: {
|
|
1208
|
+
"& + &::before": {
|
|
1209
|
+
position: "absolute",
|
|
1210
|
+
top: i ? a : 0,
|
|
1211
|
+
insetInlineStart: i ? 0 : a,
|
|
1212
|
+
backgroundColor: t,
|
|
1213
|
+
content: '""',
|
|
1214
|
+
width: i ? "100%" : o,
|
|
1215
|
+
height: i ? o : "100%"
|
|
1216
|
+
}
|
|
1217
|
+
}
|
|
1218
|
+
});
|
|
1219
|
+
return Object.assign(Object.assign({}, l()), l(!0));
|
|
1220
|
+
}, wt = Nr(["Button", "compact"], (e) => {
|
|
1221
|
+
const r = sr(e);
|
|
1222
|
+
return [
|
|
1223
|
+
// Space Compact
|
|
1224
|
+
Mr(r),
|
|
1225
|
+
Pt(r),
|
|
1226
|
+
jt(r)
|
|
1227
|
+
];
|
|
1228
|
+
}, ur);
|
|
1229
|
+
var It = function(e, r) {
|
|
1230
|
+
var t = {};
|
|
1231
|
+
for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && r.indexOf(o) < 0 && (t[o] = e[o]);
|
|
1232
|
+
if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var n = 0, o = Object.getOwnPropertySymbols(e); n < o.length; n++)
|
|
1233
|
+
r.indexOf(o[n]) < 0 && Object.prototype.propertyIsEnumerable.call(e, o[n]) && (t[o[n]] = e[o[n]]);
|
|
1234
|
+
return t;
|
|
1235
|
+
};
|
|
1236
|
+
function Dt(e) {
|
|
1237
|
+
if (typeof e == "object" && e) {
|
|
1238
|
+
let r = e == null ? void 0 : e.delay;
|
|
1239
|
+
return r = !Number.isNaN(r) && typeof r == "number" ? r : 0, {
|
|
1240
|
+
loading: r <= 0,
|
|
1241
|
+
delay: r
|
|
1242
|
+
};
|
|
1243
|
+
}
|
|
1244
|
+
return {
|
|
1245
|
+
loading: !!e,
|
|
1246
|
+
delay: 0
|
|
1247
|
+
};
|
|
1248
|
+
}
|
|
1249
|
+
const Tt = {
|
|
1250
|
+
default: ["default", "outlined"],
|
|
1251
|
+
primary: ["primary", "solid"],
|
|
1252
|
+
dashed: ["default", "dashed"],
|
|
1253
|
+
link: ["primary", "link"],
|
|
1254
|
+
text: ["default", "text"]
|
|
1255
|
+
}, zt = /* @__PURE__ */ s.forwardRef((e, r) => {
|
|
1256
|
+
var t, o, n, a;
|
|
1257
|
+
const {
|
|
1258
|
+
loading: l = !1,
|
|
1259
|
+
prefixCls: i,
|
|
1260
|
+
color: c,
|
|
1261
|
+
variant: u,
|
|
1262
|
+
type: d,
|
|
1263
|
+
danger: g = !1,
|
|
1264
|
+
shape: h = "default",
|
|
1265
|
+
size: m,
|
|
1266
|
+
styles: C,
|
|
1267
|
+
disabled: y,
|
|
1268
|
+
className: $,
|
|
1269
|
+
rootClassName: H,
|
|
1270
|
+
children: B,
|
|
1271
|
+
icon: S,
|
|
1272
|
+
iconPosition: f = "start",
|
|
1273
|
+
ghost: b = !1,
|
|
1274
|
+
block: Y = !1,
|
|
1275
|
+
// React does not recognize the `htmlType` prop on a DOM element. Here we pick it out of `rest`.
|
|
1276
|
+
htmlType: U = "button",
|
|
1277
|
+
classNames: O,
|
|
1278
|
+
style: G = {},
|
|
1279
|
+
autoInsertSpace: T,
|
|
1280
|
+
autoFocus: Q
|
|
1281
|
+
} = e, F = It(e, ["loading", "prefixCls", "color", "variant", "type", "danger", "shape", "size", "styles", "disabled", "className", "rootClassName", "children", "icon", "iconPosition", "ghost", "block", "htmlType", "classNames", "style", "autoInsertSpace", "autoFocus"]), z = d || "default", [L, R] = ee(() => {
|
|
1282
|
+
if (c && u)
|
|
1283
|
+
return [c, u];
|
|
1284
|
+
const E = Tt[z] || [];
|
|
1285
|
+
return g ? ["danger", E[1]] : E;
|
|
1286
|
+
}, [d, c, u, g]), M = L === "danger" ? "dangerous" : L, {
|
|
1287
|
+
getPrefixCls: P,
|
|
1288
|
+
direction: v,
|
|
1289
|
+
button: x
|
|
1290
|
+
} = be(Ue), ue = (t = T ?? (x == null ? void 0 : x.autoInsertSpace)) !== null && t !== void 0 ? t : !0, p = P("btn", i), [Ne, gr, fr] = Ot(p), mr = be(Pr), W = y ?? mr, Cr = be(tr), J = ee(() => Dt(l), [l]), [A, Pe] = xe(J.loading), [de, je] = xe(!1), Z = j(null), we = jr(r, Z), Ie = pr.count(B) === 1 && !S && !re(R), ge = j(!0);
|
|
1291
|
+
s.useEffect(() => (ge.current = !1, () => {
|
|
1292
|
+
ge.current = !0;
|
|
1293
|
+
}), []), k(() => {
|
|
1294
|
+
let E = null;
|
|
1295
|
+
J.delay > 0 ? E = setTimeout(() => {
|
|
1296
|
+
E = null, Pe(!0);
|
|
1297
|
+
}, J.delay) : Pe(J.loading);
|
|
1298
|
+
function w() {
|
|
1299
|
+
E && (clearTimeout(E), E = null);
|
|
1300
|
+
}
|
|
1301
|
+
return w;
|
|
1302
|
+
}, [J]), k(() => {
|
|
1303
|
+
if (!Z.current || !ue)
|
|
1304
|
+
return;
|
|
1305
|
+
const E = Z.current.textContent || "";
|
|
1306
|
+
Ie && $e(E) ? de || je(!0) : de && je(!1);
|
|
1307
|
+
}), k(() => {
|
|
1308
|
+
Q && Z.current && Z.current.focus();
|
|
1309
|
+
}, []);
|
|
1310
|
+
const De = s.useCallback((E) => {
|
|
1311
|
+
var w;
|
|
1312
|
+
if (A || W) {
|
|
1313
|
+
E.preventDefault();
|
|
1314
|
+
return;
|
|
1315
|
+
}
|
|
1316
|
+
(w = e.onClick) === null || w === void 0 || w.call(e, E);
|
|
1317
|
+
}, [e.onClick, A, W]);
|
|
1318
|
+
if (process.env.NODE_ENV !== "production") {
|
|
1319
|
+
const E = Qe("Button");
|
|
1320
|
+
process.env.NODE_ENV !== "production" && E(!(typeof S == "string" && S.length > 2), "breaking", `\`icon\` is using ReactNode instead of string naming in v4. Please check \`${S}\` at https://ant.design/components/icon`), process.env.NODE_ENV !== "production" && E(!(b && re(R)), "usage", "`link` or `text` button can't be a `ghost` button.");
|
|
1321
|
+
}
|
|
1322
|
+
const {
|
|
1323
|
+
compactSize: br,
|
|
1324
|
+
compactItemClassnames: Te
|
|
1325
|
+
} = zr(p, v), hr = {
|
|
1326
|
+
large: "lg",
|
|
1327
|
+
small: "sm",
|
|
1328
|
+
middle: void 0
|
|
1329
|
+
}, ze = Lr((E) => {
|
|
1330
|
+
var w, Ce;
|
|
1331
|
+
return (Ce = (w = m ?? br) !== null && w !== void 0 ? w : Cr) !== null && Ce !== void 0 ? Ce : E;
|
|
1332
|
+
}), Le = ze && (o = hr[ze]) !== null && o !== void 0 ? o : "", vr = A ? "loading" : S, fe = Ir(F, ["navigate"]), Ae = N(p, gr, fr, {
|
|
1333
|
+
[`${p}-${h}`]: h !== "default" && h,
|
|
1334
|
+
// line(253 - 254): Compatible with versions earlier than 5.21.0
|
|
1335
|
+
[`${p}-${z}`]: z,
|
|
1336
|
+
[`${p}-dangerous`]: g,
|
|
1337
|
+
[`${p}-color-${M}`]: M,
|
|
1338
|
+
[`${p}-variant-${R}`]: R,
|
|
1339
|
+
[`${p}-${Le}`]: Le,
|
|
1340
|
+
[`${p}-icon-only`]: !B && B !== 0 && !!vr,
|
|
1341
|
+
[`${p}-background-ghost`]: b && !re(R),
|
|
1342
|
+
[`${p}-loading`]: A,
|
|
1343
|
+
[`${p}-two-chinese-chars`]: de && ue && !A,
|
|
1344
|
+
[`${p}-block`]: Y,
|
|
1345
|
+
[`${p}-rtl`]: v === "rtl",
|
|
1346
|
+
[`${p}-icon-end`]: f === "end"
|
|
1347
|
+
}, Te, $, H, x == null ? void 0 : x.className), _e = Object.assign(Object.assign({}, x == null ? void 0 : x.style), G), Me = N(O == null ? void 0 : O.icon, (n = x == null ? void 0 : x.classNames) === null || n === void 0 ? void 0 : n.icon), Ge = Object.assign(Object.assign({}, (C == null ? void 0 : C.icon) || {}), ((a = x == null ? void 0 : x.styles) === null || a === void 0 ? void 0 : a.icon) || {}), Fe = S && !A ? /* @__PURE__ */ s.createElement(Be, {
|
|
1348
|
+
prefixCls: p,
|
|
1349
|
+
className: Me,
|
|
1350
|
+
style: Ge
|
|
1351
|
+
}, S) : typeof l == "object" && l.icon ? /* @__PURE__ */ s.createElement(Be, {
|
|
1352
|
+
prefixCls: p,
|
|
1353
|
+
className: Me,
|
|
1354
|
+
style: Ge
|
|
1355
|
+
}, l.icon) : /* @__PURE__ */ s.createElement(qr, {
|
|
1356
|
+
existIcon: !!S,
|
|
1357
|
+
prefixCls: p,
|
|
1358
|
+
loading: A,
|
|
1359
|
+
mount: ge.current
|
|
1360
|
+
}), Ve = B || B === 0 ? Wr(B, Ie && ue) : null;
|
|
1361
|
+
if (fe.href !== void 0)
|
|
1362
|
+
return Ne(/* @__PURE__ */ s.createElement("a", Object.assign({}, fe, {
|
|
1363
|
+
className: N(Ae, {
|
|
1364
|
+
[`${p}-disabled`]: W
|
|
1365
|
+
}),
|
|
1366
|
+
href: W ? void 0 : fe.href,
|
|
1367
|
+
style: _e,
|
|
1368
|
+
onClick: De,
|
|
1369
|
+
ref: we,
|
|
1370
|
+
tabIndex: W ? -1 : 0
|
|
1371
|
+
}), Fe, Ve));
|
|
1372
|
+
let me = /* @__PURE__ */ s.createElement("button", Object.assign({}, F, {
|
|
1373
|
+
type: U,
|
|
1374
|
+
className: Ae,
|
|
1375
|
+
style: _e,
|
|
1376
|
+
onClick: De,
|
|
1377
|
+
disabled: W,
|
|
1378
|
+
ref: we
|
|
1379
|
+
}), Fe, Ve, Te && /* @__PURE__ */ s.createElement(wt, {
|
|
1380
|
+
prefixCls: p
|
|
1381
|
+
}));
|
|
1382
|
+
return re(R) || (me = /* @__PURE__ */ s.createElement(Dr, {
|
|
1383
|
+
component: "Button",
|
|
1384
|
+
disabled: A
|
|
1385
|
+
}, me)), Ne(me);
|
|
1386
|
+
}), Re = zt;
|
|
1387
|
+
Re.Group = Fr;
|
|
1388
|
+
Re.__ANT_BUTTON = !0;
|
|
1389
|
+
process.env.NODE_ENV !== "production" && (Re.displayName = "Button");
|
|
1390
|
+
export {
|
|
1391
|
+
Re as B
|
|
1392
|
+
};
|