@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,582 @@
|
|
|
1
|
+
import { d as ne } from "../../../styled-components.browser.esm-CZ1XM4o4.js";
|
|
2
|
+
import * as c from "react";
|
|
3
|
+
import K, { forwardRef as oe, useRef as L, useImperativeHandle as ae } from "react";
|
|
4
|
+
import { d as te, e as ce, c as I, h as T, _ as le, a as H, B as W, m as ie, n as se, D as M, E as de, z as q, C as U, F as ue, G as be, A as fe, H as X } from "../../../index-BWys7dkb.js";
|
|
5
|
+
import { u as he, o as pe } from "../../../isVisible-CNQjrJPN.js";
|
|
6
|
+
import { T as xe, W as Ce } from "../../../index-C7kFNqp2.js";
|
|
7
|
+
import { F as me, u as J } from "../../../context-CZsFJmh6.js";
|
|
8
|
+
var ge = ["prefixCls", "className", "style", "checked", "disabled", "defaultChecked", "type", "title", "onChange"], ke = /* @__PURE__ */ oe(function(e, r) {
|
|
9
|
+
var n = e.prefixCls, o = n === void 0 ? "rc-checkbox" : n, s = e.className, C = e.style, $ = e.checked, h = e.disabled, O = e.defaultChecked, y = O === void 0 ? !1 : O, d = e.type, S = d === void 0 ? "checkbox" : d, P = e.title, l = e.onChange, E = te(e, ge), m = L(null), u = L(null), a = he(y, {
|
|
10
|
+
value: $
|
|
11
|
+
}), _ = ce(a, 2), N = _[0], A = _[1];
|
|
12
|
+
ae(r, function() {
|
|
13
|
+
return {
|
|
14
|
+
focus: function(i) {
|
|
15
|
+
var f;
|
|
16
|
+
(f = m.current) === null || f === void 0 || f.focus(i);
|
|
17
|
+
},
|
|
18
|
+
blur: function() {
|
|
19
|
+
var i;
|
|
20
|
+
(i = m.current) === null || i === void 0 || i.blur();
|
|
21
|
+
},
|
|
22
|
+
input: m.current,
|
|
23
|
+
nativeElement: u.current
|
|
24
|
+
};
|
|
25
|
+
});
|
|
26
|
+
var b = I(o, s, T(T({}, "".concat(o, "-checked"), N), "".concat(o, "-disabled"), h)), p = function(i) {
|
|
27
|
+
h || ("checked" in e || A(i.target.checked), l == null || l({
|
|
28
|
+
target: H(H({}, e), {}, {
|
|
29
|
+
type: S,
|
|
30
|
+
checked: i.target.checked
|
|
31
|
+
}),
|
|
32
|
+
stopPropagation: function() {
|
|
33
|
+
i.stopPropagation();
|
|
34
|
+
},
|
|
35
|
+
preventDefault: function() {
|
|
36
|
+
i.preventDefault();
|
|
37
|
+
},
|
|
38
|
+
nativeEvent: i.nativeEvent
|
|
39
|
+
}));
|
|
40
|
+
};
|
|
41
|
+
return /* @__PURE__ */ c.createElement("span", {
|
|
42
|
+
className: b,
|
|
43
|
+
title: P,
|
|
44
|
+
style: C,
|
|
45
|
+
ref: u
|
|
46
|
+
}, /* @__PURE__ */ c.createElement("input", le({}, E, {
|
|
47
|
+
className: "".concat(o, "-input"),
|
|
48
|
+
ref: m,
|
|
49
|
+
onChange: p,
|
|
50
|
+
disabled: h,
|
|
51
|
+
checked: !!N,
|
|
52
|
+
type: S
|
|
53
|
+
})), /* @__PURE__ */ c.createElement("span", {
|
|
54
|
+
className: "".concat(o, "-inner")
|
|
55
|
+
}));
|
|
56
|
+
});
|
|
57
|
+
function ve(e) {
|
|
58
|
+
const r = K.useRef(null), n = () => {
|
|
59
|
+
W.cancel(r.current), r.current = null;
|
|
60
|
+
};
|
|
61
|
+
return [() => {
|
|
62
|
+
n(), r.current = W(() => {
|
|
63
|
+
r.current = null;
|
|
64
|
+
});
|
|
65
|
+
}, (C) => {
|
|
66
|
+
r.current && (C.stopPropagation(), n()), e == null || e(C);
|
|
67
|
+
}];
|
|
68
|
+
}
|
|
69
|
+
const $e = (e) => {
|
|
70
|
+
const {
|
|
71
|
+
checkboxCls: r
|
|
72
|
+
} = e, n = `${r}-wrapper`;
|
|
73
|
+
return [
|
|
74
|
+
// ===================== Basic =====================
|
|
75
|
+
{
|
|
76
|
+
// Group
|
|
77
|
+
[`${r}-group`]: Object.assign(Object.assign({}, M(e)), {
|
|
78
|
+
display: "inline-flex",
|
|
79
|
+
flexWrap: "wrap",
|
|
80
|
+
columnGap: e.marginXS,
|
|
81
|
+
// Group > Grid
|
|
82
|
+
[`> ${e.antCls}-row`]: {
|
|
83
|
+
flex: 1
|
|
84
|
+
}
|
|
85
|
+
}),
|
|
86
|
+
// Wrapper
|
|
87
|
+
[n]: Object.assign(Object.assign({}, M(e)), {
|
|
88
|
+
display: "inline-flex",
|
|
89
|
+
alignItems: "baseline",
|
|
90
|
+
cursor: "pointer",
|
|
91
|
+
// Fix checkbox & radio in flex align #30260
|
|
92
|
+
"&:after": {
|
|
93
|
+
display: "inline-block",
|
|
94
|
+
width: 0,
|
|
95
|
+
overflow: "hidden",
|
|
96
|
+
content: "'\\a0'"
|
|
97
|
+
},
|
|
98
|
+
// Checkbox near checkbox
|
|
99
|
+
[`& + ${n}`]: {
|
|
100
|
+
marginInlineStart: 0
|
|
101
|
+
},
|
|
102
|
+
[`&${n}-in-form-item`]: {
|
|
103
|
+
'input[type="checkbox"]': {
|
|
104
|
+
width: 14,
|
|
105
|
+
// FIXME: magic
|
|
106
|
+
height: 14
|
|
107
|
+
// FIXME: magic
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}),
|
|
111
|
+
// Wrapper > Checkbox
|
|
112
|
+
[r]: Object.assign(Object.assign({}, M(e)), {
|
|
113
|
+
position: "relative",
|
|
114
|
+
whiteSpace: "nowrap",
|
|
115
|
+
lineHeight: 1,
|
|
116
|
+
cursor: "pointer",
|
|
117
|
+
borderRadius: e.borderRadiusSM,
|
|
118
|
+
// To make alignment right when `controlHeight` is changed
|
|
119
|
+
// Ref: https://github.com/ant-design/ant-design/issues/41564
|
|
120
|
+
alignSelf: "center",
|
|
121
|
+
// Wrapper > Checkbox > input
|
|
122
|
+
[`${r}-input`]: {
|
|
123
|
+
position: "absolute",
|
|
124
|
+
// Since baseline align will get additional space offset,
|
|
125
|
+
// we need to move input to top to make it align with text.
|
|
126
|
+
// Ref: https://github.com/ant-design/ant-design/issues/38926#issuecomment-1486137799
|
|
127
|
+
inset: 0,
|
|
128
|
+
zIndex: 1,
|
|
129
|
+
cursor: "pointer",
|
|
130
|
+
opacity: 0,
|
|
131
|
+
margin: 0,
|
|
132
|
+
[`&:focus-visible + ${r}-inner`]: Object.assign({}, de(e))
|
|
133
|
+
},
|
|
134
|
+
// Wrapper > Checkbox > inner
|
|
135
|
+
[`${r}-inner`]: {
|
|
136
|
+
boxSizing: "border-box",
|
|
137
|
+
display: "block",
|
|
138
|
+
width: e.checkboxSize,
|
|
139
|
+
height: e.checkboxSize,
|
|
140
|
+
direction: "ltr",
|
|
141
|
+
backgroundColor: e.colorBgContainer,
|
|
142
|
+
border: `${q(e.lineWidth)} ${e.lineType} ${e.colorBorder}`,
|
|
143
|
+
borderRadius: e.borderRadiusSM,
|
|
144
|
+
borderCollapse: "separate",
|
|
145
|
+
transition: `all ${e.motionDurationSlow}`,
|
|
146
|
+
"&:after": {
|
|
147
|
+
boxSizing: "border-box",
|
|
148
|
+
position: "absolute",
|
|
149
|
+
top: "50%",
|
|
150
|
+
insetInlineStart: "25%",
|
|
151
|
+
display: "table",
|
|
152
|
+
width: e.calc(e.checkboxSize).div(14).mul(5).equal(),
|
|
153
|
+
height: e.calc(e.checkboxSize).div(14).mul(8).equal(),
|
|
154
|
+
border: `${q(e.lineWidthBold)} solid ${e.colorWhite}`,
|
|
155
|
+
borderTop: 0,
|
|
156
|
+
borderInlineStart: 0,
|
|
157
|
+
transform: "rotate(45deg) scale(0) translate(-50%,-50%)",
|
|
158
|
+
opacity: 0,
|
|
159
|
+
content: '""',
|
|
160
|
+
transition: `all ${e.motionDurationFast} ${e.motionEaseInBack}, opacity ${e.motionDurationFast}`
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
// Wrapper > Checkbox + Text
|
|
164
|
+
"& + span": {
|
|
165
|
+
paddingInlineStart: e.paddingXS,
|
|
166
|
+
paddingInlineEnd: e.paddingXS
|
|
167
|
+
}
|
|
168
|
+
})
|
|
169
|
+
},
|
|
170
|
+
// ===================== Hover =====================
|
|
171
|
+
{
|
|
172
|
+
// Wrapper & Wrapper > Checkbox
|
|
173
|
+
[`
|
|
174
|
+
${n}:not(${n}-disabled),
|
|
175
|
+
${r}:not(${r}-disabled)
|
|
176
|
+
`]: {
|
|
177
|
+
[`&:hover ${r}-inner`]: {
|
|
178
|
+
borderColor: e.colorPrimary
|
|
179
|
+
}
|
|
180
|
+
},
|
|
181
|
+
[`${n}:not(${n}-disabled)`]: {
|
|
182
|
+
[`&:hover ${r}-checked:not(${r}-disabled) ${r}-inner`]: {
|
|
183
|
+
backgroundColor: e.colorPrimaryHover,
|
|
184
|
+
borderColor: "transparent"
|
|
185
|
+
},
|
|
186
|
+
[`&:hover ${r}-checked:not(${r}-disabled):after`]: {
|
|
187
|
+
borderColor: e.colorPrimaryHover
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
// ==================== Checked ====================
|
|
192
|
+
{
|
|
193
|
+
// Wrapper > Checkbox
|
|
194
|
+
[`${r}-checked`]: {
|
|
195
|
+
[`${r}-inner`]: {
|
|
196
|
+
backgroundColor: e.colorPrimary,
|
|
197
|
+
borderColor: e.colorPrimary,
|
|
198
|
+
"&:after": {
|
|
199
|
+
opacity: 1,
|
|
200
|
+
transform: "rotate(45deg) scale(1) translate(-50%,-50%)",
|
|
201
|
+
transition: `all ${e.motionDurationMid} ${e.motionEaseOutBack} ${e.motionDurationFast}`
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
},
|
|
205
|
+
[`
|
|
206
|
+
${n}-checked:not(${n}-disabled),
|
|
207
|
+
${r}-checked:not(${r}-disabled)
|
|
208
|
+
`]: {
|
|
209
|
+
[`&:hover ${r}-inner`]: {
|
|
210
|
+
backgroundColor: e.colorPrimaryHover,
|
|
211
|
+
borderColor: "transparent"
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
},
|
|
215
|
+
// ================= Indeterminate =================
|
|
216
|
+
{
|
|
217
|
+
[r]: {
|
|
218
|
+
"&-indeterminate": {
|
|
219
|
+
// Wrapper > Checkbox > inner
|
|
220
|
+
[`${r}-inner`]: {
|
|
221
|
+
backgroundColor: `${e.colorBgContainer} !important`,
|
|
222
|
+
borderColor: `${e.colorBorder} !important`,
|
|
223
|
+
"&:after": {
|
|
224
|
+
top: "50%",
|
|
225
|
+
insetInlineStart: "50%",
|
|
226
|
+
width: e.calc(e.fontSizeLG).div(2).equal(),
|
|
227
|
+
height: e.calc(e.fontSizeLG).div(2).equal(),
|
|
228
|
+
backgroundColor: e.colorPrimary,
|
|
229
|
+
border: 0,
|
|
230
|
+
transform: "translate(-50%, -50%) scale(1)",
|
|
231
|
+
opacity: 1,
|
|
232
|
+
content: '""'
|
|
233
|
+
}
|
|
234
|
+
},
|
|
235
|
+
// https://github.com/ant-design/ant-design/issues/50074
|
|
236
|
+
[`&:hover ${r}-inner`]: {
|
|
237
|
+
backgroundColor: `${e.colorBgContainer} !important`,
|
|
238
|
+
borderColor: `${e.colorPrimary} !important`
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
},
|
|
243
|
+
// ==================== Disable ====================
|
|
244
|
+
{
|
|
245
|
+
// Wrapper
|
|
246
|
+
[`${n}-disabled`]: {
|
|
247
|
+
cursor: "not-allowed"
|
|
248
|
+
},
|
|
249
|
+
// Wrapper > Checkbox
|
|
250
|
+
[`${r}-disabled`]: {
|
|
251
|
+
// Wrapper > Checkbox > input
|
|
252
|
+
[`&, ${r}-input`]: {
|
|
253
|
+
cursor: "not-allowed",
|
|
254
|
+
// Disabled for native input to enable Tooltip event handler
|
|
255
|
+
// ref: https://github.com/ant-design/ant-design/issues/39822#issuecomment-1365075901
|
|
256
|
+
pointerEvents: "none"
|
|
257
|
+
},
|
|
258
|
+
// Wrapper > Checkbox > inner
|
|
259
|
+
[`${r}-inner`]: {
|
|
260
|
+
background: e.colorBgContainerDisabled,
|
|
261
|
+
borderColor: e.colorBorder,
|
|
262
|
+
"&:after": {
|
|
263
|
+
borderColor: e.colorTextDisabled
|
|
264
|
+
}
|
|
265
|
+
},
|
|
266
|
+
"&:after": {
|
|
267
|
+
display: "none"
|
|
268
|
+
},
|
|
269
|
+
"& + span": {
|
|
270
|
+
color: e.colorTextDisabled
|
|
271
|
+
},
|
|
272
|
+
[`&${r}-indeterminate ${r}-inner::after`]: {
|
|
273
|
+
background: e.colorTextDisabled
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
];
|
|
278
|
+
};
|
|
279
|
+
function ye(e, r) {
|
|
280
|
+
const n = se(r, {
|
|
281
|
+
checkboxCls: `.${e}`,
|
|
282
|
+
checkboxSize: r.controlInteractiveSize
|
|
283
|
+
});
|
|
284
|
+
return [$e(n)];
|
|
285
|
+
}
|
|
286
|
+
const Q = ie("Checkbox", (e, r) => {
|
|
287
|
+
let {
|
|
288
|
+
prefixCls: n
|
|
289
|
+
} = r;
|
|
290
|
+
return [ye(n, e)];
|
|
291
|
+
}), Y = /* @__PURE__ */ K.createContext(null);
|
|
292
|
+
var Se = function(e, r) {
|
|
293
|
+
var n = {};
|
|
294
|
+
for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && r.indexOf(o) < 0 && (n[o] = e[o]);
|
|
295
|
+
if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var s = 0, o = Object.getOwnPropertySymbols(e); s < o.length; s++)
|
|
296
|
+
r.indexOf(o[s]) < 0 && Object.prototype.propertyIsEnumerable.call(e, o[s]) && (n[o[s]] = e[o[s]]);
|
|
297
|
+
return n;
|
|
298
|
+
};
|
|
299
|
+
const Ae = (e, r) => {
|
|
300
|
+
var n;
|
|
301
|
+
const {
|
|
302
|
+
prefixCls: o,
|
|
303
|
+
className: s,
|
|
304
|
+
rootClassName: C,
|
|
305
|
+
children: $,
|
|
306
|
+
indeterminate: h = !1,
|
|
307
|
+
style: O,
|
|
308
|
+
onMouseEnter: y,
|
|
309
|
+
onMouseLeave: d,
|
|
310
|
+
skipGroup: S = !1,
|
|
311
|
+
disabled: P
|
|
312
|
+
} = e, l = Se(e, ["prefixCls", "className", "rootClassName", "children", "indeterminate", "style", "onMouseEnter", "onMouseLeave", "skipGroup", "disabled"]), {
|
|
313
|
+
getPrefixCls: E,
|
|
314
|
+
direction: m,
|
|
315
|
+
checkbox: u
|
|
316
|
+
} = c.useContext(U), a = c.useContext(Y), {
|
|
317
|
+
isFormItemInput: _
|
|
318
|
+
} = c.useContext(me), N = c.useContext(ue), A = (n = (a == null ? void 0 : a.disabled) || P) !== null && n !== void 0 ? n : N, b = c.useRef(l.value), p = c.useRef(null), w = be(r, p);
|
|
319
|
+
if (process.env.NODE_ENV !== "production") {
|
|
320
|
+
const x = fe("Checkbox");
|
|
321
|
+
process.env.NODE_ENV !== "production" && x("checked" in l || !!a || !("value" in l), "usage", "`value` is not a valid prop, do you mean `checked`?");
|
|
322
|
+
}
|
|
323
|
+
c.useEffect(() => {
|
|
324
|
+
a == null || a.registerValue(l.value);
|
|
325
|
+
}, []), c.useEffect(() => {
|
|
326
|
+
if (!S)
|
|
327
|
+
return l.value !== b.current && (a == null || a.cancelValue(b.current), a == null || a.registerValue(l.value), b.current = l.value), () => a == null ? void 0 : a.cancelValue(l.value);
|
|
328
|
+
}, [l.value]), c.useEffect(() => {
|
|
329
|
+
var x;
|
|
330
|
+
!((x = p.current) === null || x === void 0) && x.input && (p.current.input.indeterminate = h);
|
|
331
|
+
}, [h]);
|
|
332
|
+
const i = E("checkbox", o), f = J(i), [j, F, D] = Q(i, f), g = Object.assign({}, l);
|
|
333
|
+
a && !S && (g.onChange = function() {
|
|
334
|
+
l.onChange && l.onChange.apply(l, arguments), a.toggleOption && a.toggleOption({
|
|
335
|
+
label: $,
|
|
336
|
+
value: l.value
|
|
337
|
+
});
|
|
338
|
+
}, g.name = a.name, g.checked = a.value.includes(l.value));
|
|
339
|
+
const B = I(`${i}-wrapper`, {
|
|
340
|
+
[`${i}-rtl`]: m === "rtl",
|
|
341
|
+
[`${i}-wrapper-checked`]: g.checked,
|
|
342
|
+
[`${i}-wrapper-disabled`]: A,
|
|
343
|
+
[`${i}-wrapper-in-form-item`]: _
|
|
344
|
+
}, u == null ? void 0 : u.className, s, C, D, f, F), t = I({
|
|
345
|
+
[`${i}-indeterminate`]: h
|
|
346
|
+
}, xe, F), [k, v] = ve(g.onClick);
|
|
347
|
+
return j(/* @__PURE__ */ c.createElement(Ce, {
|
|
348
|
+
component: "Checkbox",
|
|
349
|
+
disabled: A
|
|
350
|
+
}, /* @__PURE__ */ c.createElement("label", {
|
|
351
|
+
className: B,
|
|
352
|
+
style: Object.assign(Object.assign({}, u == null ? void 0 : u.style), O),
|
|
353
|
+
onMouseEnter: y,
|
|
354
|
+
onMouseLeave: d,
|
|
355
|
+
onClick: k
|
|
356
|
+
}, /* @__PURE__ */ c.createElement(ke, Object.assign({}, g, {
|
|
357
|
+
onClick: v,
|
|
358
|
+
prefixCls: i,
|
|
359
|
+
className: t,
|
|
360
|
+
disabled: A,
|
|
361
|
+
ref: w
|
|
362
|
+
})), $ !== void 0 && /* @__PURE__ */ c.createElement("span", null, $))));
|
|
363
|
+
}, G = /* @__PURE__ */ c.forwardRef(Ae);
|
|
364
|
+
process.env.NODE_ENV !== "production" && (G.displayName = "Checkbox");
|
|
365
|
+
var we = function(e, r) {
|
|
366
|
+
var n = {};
|
|
367
|
+
for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && r.indexOf(o) < 0 && (n[o] = e[o]);
|
|
368
|
+
if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var s = 0, o = Object.getOwnPropertySymbols(e); s < o.length; s++)
|
|
369
|
+
r.indexOf(o[s]) < 0 && Object.prototype.propertyIsEnumerable.call(e, o[s]) && (n[o[s]] = e[o[s]]);
|
|
370
|
+
return n;
|
|
371
|
+
};
|
|
372
|
+
const Oe = /* @__PURE__ */ c.forwardRef((e, r) => {
|
|
373
|
+
const {
|
|
374
|
+
defaultValue: n,
|
|
375
|
+
children: o,
|
|
376
|
+
options: s = [],
|
|
377
|
+
prefixCls: C,
|
|
378
|
+
className: $,
|
|
379
|
+
rootClassName: h,
|
|
380
|
+
style: O,
|
|
381
|
+
onChange: y
|
|
382
|
+
} = e, d = we(e, ["defaultValue", "children", "options", "prefixCls", "className", "rootClassName", "style", "onChange"]), {
|
|
383
|
+
getPrefixCls: S,
|
|
384
|
+
direction: P
|
|
385
|
+
} = c.useContext(U), [l, E] = c.useState(d.value || n || []), [m, u] = c.useState([]);
|
|
386
|
+
c.useEffect(() => {
|
|
387
|
+
"value" in d && E(d.value || []);
|
|
388
|
+
}, [d.value]);
|
|
389
|
+
const a = c.useMemo(() => s.map((t) => typeof t == "string" || typeof t == "number" ? {
|
|
390
|
+
label: t,
|
|
391
|
+
value: t
|
|
392
|
+
} : t), [s]), _ = (t) => {
|
|
393
|
+
u((k) => k.filter((v) => v !== t));
|
|
394
|
+
}, N = (t) => {
|
|
395
|
+
u((k) => [].concat(X(k), [t]));
|
|
396
|
+
}, A = (t) => {
|
|
397
|
+
const k = l.indexOf(t.value), v = X(l);
|
|
398
|
+
k === -1 ? v.push(t.value) : v.splice(k, 1), "value" in d || E(v), y == null || y(v.filter((x) => m.includes(x)).sort((x, Z) => {
|
|
399
|
+
const ee = a.findIndex((z) => z.value === x), re = a.findIndex((z) => z.value === Z);
|
|
400
|
+
return ee - re;
|
|
401
|
+
}));
|
|
402
|
+
}, b = S("checkbox", C), p = `${b}-group`, w = J(b), [i, f, j] = Q(b, w), F = pe(d, ["value", "disabled"]), D = s.length ? a.map((t) => /* @__PURE__ */ c.createElement(G, {
|
|
403
|
+
prefixCls: b,
|
|
404
|
+
key: t.value.toString(),
|
|
405
|
+
disabled: "disabled" in t ? t.disabled : d.disabled,
|
|
406
|
+
value: t.value,
|
|
407
|
+
checked: l.includes(t.value),
|
|
408
|
+
onChange: t.onChange,
|
|
409
|
+
className: `${p}-item`,
|
|
410
|
+
style: t.style,
|
|
411
|
+
title: t.title,
|
|
412
|
+
id: t.id,
|
|
413
|
+
required: t.required
|
|
414
|
+
}, t.label)) : o, g = {
|
|
415
|
+
toggleOption: A,
|
|
416
|
+
value: l,
|
|
417
|
+
disabled: d.disabled,
|
|
418
|
+
name: d.name,
|
|
419
|
+
// https://github.com/ant-design/ant-design/issues/16376
|
|
420
|
+
registerValue: N,
|
|
421
|
+
cancelValue: _
|
|
422
|
+
}, B = I(p, {
|
|
423
|
+
[`${p}-rtl`]: P === "rtl"
|
|
424
|
+
}, $, h, j, w, f);
|
|
425
|
+
return i(/* @__PURE__ */ c.createElement("div", Object.assign({
|
|
426
|
+
className: B,
|
|
427
|
+
style: O
|
|
428
|
+
}, F, {
|
|
429
|
+
ref: r
|
|
430
|
+
}), /* @__PURE__ */ c.createElement(Y.Provider, {
|
|
431
|
+
value: g
|
|
432
|
+
}, D)));
|
|
433
|
+
}), V = G;
|
|
434
|
+
V.Group = Oe;
|
|
435
|
+
V.__ANT_CHECKBOX = !0;
|
|
436
|
+
process.env.NODE_ENV !== "production" && (V.displayName = "Checkbox");
|
|
437
|
+
const R = "#384DF6", Ee = ({ colors: e, borderRadius: r }, n = "primary", o = "active") => `
|
|
438
|
+
.ant-checkbox-inner {
|
|
439
|
+
background-color: #FFFFFF;
|
|
440
|
+
border-color: #9A9A9A;
|
|
441
|
+
border-radius: 2px;
|
|
442
|
+
transition: all 0.2s ease-in-out;
|
|
443
|
+
|
|
444
|
+
&::after {
|
|
445
|
+
border-color: #9A9A9A;
|
|
446
|
+
border: 2px solid ${e[n][o].color};
|
|
447
|
+
border-top: 0;
|
|
448
|
+
border-left: 0;
|
|
449
|
+
content: "";
|
|
450
|
+
display: table;
|
|
451
|
+
height: 9px;
|
|
452
|
+
left: 6px;
|
|
453
|
+
opacity: 1;
|
|
454
|
+
position: absolute;
|
|
455
|
+
top: 2px;
|
|
456
|
+
transform: rotate(45deg) scale(1);
|
|
457
|
+
transition: all 0.2s cubic-bezier(0.12, 0.4, 0.29, 1.46) 0.1s;
|
|
458
|
+
width: 5px;
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
&:hover .ant-checkbox-inner::after {
|
|
463
|
+
border-color: #6C6C6C;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
&:hover .ant-checkbox-checked .ant-checkbox-inner::after {
|
|
467
|
+
border-color: #6C6C6C;
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
.ant-checkbox-disabled .ant-checkbox-inner::after {
|
|
471
|
+
border-color: #9A9A9A;
|
|
472
|
+
background-color: #F4F4F4;
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
.ant-checkbox-disabled.ant-checkbox-checked .ant-checkbox-inner::after {
|
|
476
|
+
border-color: #6C6C6C;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
&:hover .ant-checkbox-disabled .ant-checkbox-inner::after {
|
|
480
|
+
border-color: #6C6C6C;
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
.ant-checkbox-disabled.ant-checkbox-checked .ant-checkbox-inner {
|
|
484
|
+
background-color: #F4F4F4;
|
|
485
|
+
border-color: #9A9A9A;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
.ant-checkbox-disabled.ant-checkbox-checked .ant-checkbox-inner::after {
|
|
489
|
+
border-color: #9A9A9A;
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
&:hover .ant-checkbox-disabled.ant-checkbox-checked .ant-checkbox-inner {
|
|
493
|
+
background-color: #F4F4F4;
|
|
494
|
+
border-color: #9A9A9A;
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
&:hover .ant-checkbox-disabled.ant-checkbox-checked .ant-checkbox-inner::after {
|
|
498
|
+
border-color: #9A9A9A;
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
.ant-checkbox-checked .ant-checkbox-inner {
|
|
502
|
+
background-color: #fff;
|
|
503
|
+
border-color: #9A9A9A;
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
.ant-checkbox-checked .ant-checkbox-inner::after {
|
|
507
|
+
border-color: ${e[n].active.color};
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
&:hover .ant-checkbox-inner {
|
|
511
|
+
border-color: #9A9A9A;
|
|
512
|
+
|
|
513
|
+
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
&:hover .ant-checkbox-checked .ant-checkbox-inner {
|
|
517
|
+
background-color: #9A9A9A;
|
|
518
|
+
border-color: #FFF;
|
|
519
|
+
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
&:hover .ant-checkbox-checked .ant-checkbox-inner::after {
|
|
523
|
+
border-color: #fff;
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
.ant-checkbox-checked .ant-checkbox-inner {
|
|
527
|
+
background-color:${e[n].focussed.ringColor};
|
|
528
|
+
border-color: #6C6C6C;
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
.ant-checkbox-checked .ant-checkbox-inner {
|
|
532
|
+
background-color: ${R};
|
|
533
|
+
border-color: ${R};
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
&:hover .ant-checkbox-checked .ant-checkbox-inner {
|
|
537
|
+
background-color: ${R};
|
|
538
|
+
border-color: ${R};
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
&:hover .ant-checkbox-checked .ant-checkbox-inner::after {
|
|
542
|
+
border-color: #fff;
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
&:hover .ant-checkbox-inner {
|
|
546
|
+
border-color: #9A9A9A;
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
&:hover .ant-checkbox-checked .ant-checkbox-inner {
|
|
550
|
+
background-color: ${e[n].focussed.ringColor};
|
|
551
|
+
border-color: #6C6C6C;
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
.ant-checkbox:focus-visible .ant-checkbox-inner,
|
|
555
|
+
.ant-checkbox-input:focus-visible + .ant-checkbox-inner {
|
|
556
|
+
outline: none;
|
|
557
|
+
box-shadow: 0 0 0 1px #fff, 0 0 0 3px ${e[n].focussed.ringColor};
|
|
558
|
+
border-radius: ${r.BorderRadiusXs}px;
|
|
559
|
+
border-color: #9A9A9A;
|
|
560
|
+
transition: box-shadow 0.2s ease-in-out;
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
.ant-checkbox-input:focus + .ant-checkbox-inner {
|
|
564
|
+
border-color: ${e[n].hover.borderColor};
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
&:focus-visible {
|
|
568
|
+
outline: none;
|
|
569
|
+
color: ${e[n].focussed.color};
|
|
570
|
+
background-color: ${e[n].focussed.backgroundColor};
|
|
571
|
+
box-shadow: 0 0 0 1px #fff, 0 0 0 3px ${e[n].focussed.ringColor};
|
|
572
|
+
border-radius: ${r.BorderRadiusXs}px;
|
|
573
|
+
border-color: #9A9A9A;
|
|
574
|
+
transition: box-shadow 0.2s ease-in-out;
|
|
575
|
+
}
|
|
576
|
+
`, Ve = ne(V)`
|
|
577
|
+
${({ theme: e, type: r, state: n }) => Ee(e, r, n)}
|
|
578
|
+
`;
|
|
579
|
+
export {
|
|
580
|
+
Ve as StyledCheckbox,
|
|
581
|
+
Ee as getGenesisClass
|
|
582
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './button';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { TYPE, STATE } from '../../../constants';
|
|
3
|
+
import { InputProps as AntInputProps } from 'antd';
|
|
4
|
+
|
|
5
|
+
export type GenesisInputType = keyof typeof TYPE;
|
|
6
|
+
export interface InputProps extends AntInputProps {
|
|
7
|
+
type?: GenesisButtonType;
|
|
8
|
+
state?: keyof typeof STATE;
|
|
9
|
+
}
|
|
10
|
+
declare const Input: React.FC<InputProps>;
|
|
11
|
+
export default Input;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { Input as o } from "./styles.js";
|
|
3
|
+
import { useBreakpoint as p } from "../../../providers/ThemeProvider.js";
|
|
4
|
+
import { TYPE as m, STATE as e } from "../../../constants/index.js";
|
|
5
|
+
const I = ({
|
|
6
|
+
type: a = m.primary,
|
|
7
|
+
state: i = e.active,
|
|
8
|
+
...t
|
|
9
|
+
}) => (p(), /* @__PURE__ */ r(o, { ...t }));
|
|
10
|
+
export {
|
|
11
|
+
I as default
|
|
12
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { default as Input } from '../Input';
|
|
3
|
+
|
|
4
|
+
declare const meta: Meta<typeof Input>;
|
|
5
|
+
export default meta;
|
|
6
|
+
type Story = StoryObj<typeof Input>;
|
|
7
|
+
export declare const Default: Story;
|
|
8
|
+
export declare const AddonAfter: Story;
|
|
9
|
+
export declare const AddonBefore: Story;
|
|
10
|
+
export declare const AddonBeforeAfter: Story;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { d as r, i as o, a as s, s as n, g as i } from "../../../../setup-CMYVZCPF.js";
|
|
3
|
+
import p from "../Input.js";
|
|
4
|
+
import { TYPE as u, STATE as c } from "../../../../constants/index.js";
|
|
5
|
+
r("Input Component", () => {
|
|
6
|
+
o("customRenders input with default props", () => {
|
|
7
|
+
s(/* @__PURE__ */ e(p, {}));
|
|
8
|
+
const t = n.getByRole("textbox");
|
|
9
|
+
i(t).toBeInTheDocument();
|
|
10
|
+
}), o("customRenders input with primary type", () => {
|
|
11
|
+
s(/* @__PURE__ */ e(p, { type: u.primary }));
|
|
12
|
+
const t = n.getByRole("textbox");
|
|
13
|
+
i(t).toHaveAttribute("type", "text");
|
|
14
|
+
}), o("customRenders input with active state", () => {
|
|
15
|
+
s(/* @__PURE__ */ e(p, { state: c.active }));
|
|
16
|
+
const t = n.getByRole("textbox");
|
|
17
|
+
i(t).toBeEnabled();
|
|
18
|
+
}), o("passes through additional props", () => {
|
|
19
|
+
const t = "Enter text";
|
|
20
|
+
s(/* @__PURE__ */ e(p, { placeholder: t }));
|
|
21
|
+
const a = n.getByPlaceholderText(t);
|
|
22
|
+
i(a).toBeInTheDocument();
|
|
23
|
+
}), o("handles disabled state", () => {
|
|
24
|
+
s(/* @__PURE__ */ e(p, { disabled: !0 }));
|
|
25
|
+
const t = n.getByRole("textbox");
|
|
26
|
+
i(t).toBeDisabled();
|
|
27
|
+
});
|
|
28
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { InputProps as AntInputProps } from 'antd';
|
|
2
|
+
|
|
3
|
+
interface InputStyledProps extends AntInputProps {
|
|
4
|
+
}
|
|
5
|
+
export declare const Input: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<Omit<AntInputProps & import('react').RefAttributes<import('antd').InputRef>, "ref"> & {
|
|
6
|
+
ref?: import('react').Ref<import('antd').InputRef>;
|
|
7
|
+
}, InputStyledProps>> & string & Omit<import('react').ForwardRefExoticComponent<AntInputProps & import('react').RefAttributes<import('antd').InputRef>> & {
|
|
8
|
+
Group: import('react').FC<import('antd/es/input').GroupProps>;
|
|
9
|
+
Search: import('react').ForwardRefExoticComponent<import('antd/es/input').SearchProps & import('react').RefAttributes<import('antd').InputRef>>;
|
|
10
|
+
TextArea: import('react').ForwardRefExoticComponent<import('antd/es/input').TextAreaProps & import('react').RefAttributes<import('antd/es/input/TextArea').TextAreaRef>>;
|
|
11
|
+
Password: import('react').ForwardRefExoticComponent<import('antd/es/input').PasswordProps & import('react').RefAttributes<import('antd').InputRef>>;
|
|
12
|
+
OTP: import('react').ForwardRefExoticComponent<import('antd/es/input/OTP').OTPProps & import('react').RefAttributes<import('antd/es/input/OTP').OTPRef>>;
|
|
13
|
+
}, keyof import('react').Component<any, {}, any>>;
|
|
14
|
+
export {};
|