x-ui-design 1.0.31-gamma.1 → 1.0.33
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/.github/workflows/x-ui-design.yml +14 -0
- package/README.md +22 -1
- package/compile.sh +15 -0
- package/dist/{components → esm/types/components}/DatePicker/DatePicker.d.ts +2 -1
- package/dist/{components → esm/types/components}/DatePicker/RangePicker/RangePicker.d.ts +2 -1
- package/dist/{components → esm/types/components}/Dropdown/Dropdown.d.ts +2 -1
- package/dist/{components → esm/types/components}/Empty/Empty.d.ts +2 -1
- package/dist/{components → esm/types/components}/Form/Item/Item.d.ts +2 -1
- package/dist/esm/types/components/Icons/Icons.d.ts +19 -0
- package/dist/{components → esm/types/components}/Input/Input.d.ts +2 -1
- package/dist/{components → esm/types/components}/Input/Textarea/Textarea.d.ts +2 -1
- package/dist/{components → esm/types/components}/Popover/Popover.d.ts +2 -1
- package/dist/{components → esm/types/components}/Radio/Button/Button.d.ts +2 -1
- package/dist/{components → esm/types/components}/Radio/Group/Group.d.ts +2 -1
- package/dist/{components → esm/types/components}/Radio/Radio.d.ts +2 -1
- package/dist/{components → esm/types/components}/Result/Result.d.ts +2 -1
- package/dist/{components → esm/types/components}/Switch/Switch.d.ts +2 -1
- package/dist/{components → esm/types/components}/Upload/Upload.d.ts +2 -1
- package/dist/esm/types/index.d.ts +50 -0
- package/dist/{types → esm/types/types}/input.d.ts +2 -2
- package/dist/index.d.ts +144 -1
- package/dist/index.esm.js +4233 -3792
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +4338 -3897
- package/dist/index.js.map +1 -1
- package/eslint.config.mjs +16 -0
- package/lib/components/Button/Button.tsx +136 -0
- package/lib/components/Button/index.ts +1 -0
- package/lib/components/Button/style.css +197 -0
- package/lib/components/Checkbox/Checkbox.tsx +131 -0
- package/lib/components/Checkbox/index.ts +1 -0
- package/lib/components/Checkbox/style.css +95 -0
- package/lib/components/ConditionalWrapper/index.tsx +12 -0
- package/lib/components/DatePicker/DatePicker.tsx +526 -0
- package/lib/components/DatePicker/RangePicker/RangePicker.tsx +500 -0
- package/lib/components/DatePicker/RangePicker/index.ts +1 -0
- package/lib/components/DatePicker/RangePicker/style.css +434 -0
- package/lib/components/DatePicker/TimePicker/TimePicker.tsx +497 -0
- package/lib/components/DatePicker/TimePicker/index.ts +1 -0
- package/lib/components/DatePicker/TimePicker/style.css +197 -0
- package/lib/components/DatePicker/index.ts +1 -0
- package/lib/components/DatePicker/style.css +318 -0
- package/lib/components/Dropdown/Dropdown.tsx +234 -0
- package/lib/components/Dropdown/index.ts +1 -0
- package/lib/components/Dropdown/style.css +124 -0
- package/lib/components/Empty/Empty.tsx +45 -0
- package/lib/components/Empty/index.ts +1 -0
- package/lib/components/Empty/style.css +13 -0
- package/lib/components/Form/Form.tsx +130 -0
- package/lib/components/Form/Item/Item.tsx +294 -0
- package/lib/components/Form/Item/index.ts +1 -0
- package/lib/components/Form/Item/style.css +61 -0
- package/lib/components/Form/index.ts +1 -0
- package/lib/components/Icons/Icons.tsx +433 -0
- package/lib/components/Icons/index.ts +15 -0
- package/lib/components/Input/Input.tsx +218 -0
- package/lib/components/Input/Textarea/Textarea.tsx +110 -0
- package/lib/components/Input/Textarea/index.ts +1 -0
- package/lib/components/Input/Textarea/style.css +104 -0
- package/lib/components/Input/index.ts +1 -0
- package/lib/components/Input/style.css +137 -0
- package/lib/components/Menu/Item/Item.tsx +65 -0
- package/lib/components/Menu/Menu.tsx +261 -0
- package/lib/components/Menu/SubMenu/SubMenu.tsx +68 -0
- package/lib/components/Menu/index.css +145 -0
- package/lib/components/Menu/index.ts +1 -0
- package/lib/components/Popover/Popover.tsx +135 -0
- package/lib/components/Popover/index.ts +1 -0
- package/lib/components/Popover/style.css +82 -0
- package/lib/components/Radio/Button/Button.tsx +42 -0
- package/lib/components/Radio/Button/index.ts +1 -0
- package/lib/components/Radio/Button/style.css +43 -0
- package/lib/components/Radio/Group/Group.tsx +105 -0
- package/lib/components/Radio/Group/index.ts +1 -0
- package/lib/components/Radio/Group/style.css +53 -0
- package/lib/components/Radio/Radio.tsx +83 -0
- package/lib/components/Radio/index.ts +1 -0
- package/lib/components/Radio/style.css +73 -0
- package/lib/components/Result/Result.tsx +39 -0
- package/lib/components/Result/index.ts +1 -0
- package/lib/components/Result/style.css +173 -0
- package/lib/components/Select/Option/Option.tsx +49 -0
- package/lib/components/Select/Option/index.ts +1 -0
- package/lib/components/Select/Option/style.css +50 -0
- package/lib/components/Select/Select.tsx +935 -0
- package/lib/components/Select/Tag/Tag.tsx +43 -0
- package/lib/components/Select/Tag/index.ts +1 -0
- package/lib/components/Select/Tag/style.css +87 -0
- package/lib/components/Select/index.ts +1 -0
- package/lib/components/Select/style.css +186 -0
- package/lib/components/Skeleton/Avatar/Avatar.tsx +61 -0
- package/lib/components/Skeleton/Avatar/index.ts +1 -0
- package/lib/components/Skeleton/Avatar/style.css +27 -0
- package/lib/components/Skeleton/Button/Button.tsx +44 -0
- package/lib/components/Skeleton/Button/index.ts +1 -0
- package/lib/components/Skeleton/Button/style.css +50 -0
- package/lib/components/Skeleton/Image/Image.tsx +45 -0
- package/lib/components/Skeleton/Image/index.ts +1 -0
- package/lib/components/Skeleton/Image/style.css +23 -0
- package/lib/components/Skeleton/Input/Input.tsx +42 -0
- package/lib/components/Skeleton/Input/index.ts +1 -0
- package/lib/components/Skeleton/Input/style.css +56 -0
- package/lib/components/Skeleton/Skeleton.tsx +97 -0
- package/lib/components/Skeleton/index.ts +1 -0
- package/lib/components/Skeleton/style.css +84 -0
- package/lib/components/Switch/Switch.tsx +68 -0
- package/lib/components/Switch/index.css +50 -0
- package/lib/components/Switch/index.ts +1 -0
- package/lib/components/Upload/Upload.tsx +291 -0
- package/lib/components/Upload/index.ts +1 -0
- package/lib/components/Upload/style.css +151 -0
- package/lib/global.d.ts +1 -0
- package/lib/helpers/flatten.ts +26 -0
- package/lib/helpers/index.ts +52 -0
- package/lib/helpers/mask.ts +52 -0
- package/lib/hooks/useForm.ts +548 -0
- package/lib/hooks/usePosition.ts +206 -0
- package/lib/hooks/useWatch.ts +41 -0
- package/lib/hooks/useWatchError.ts +20 -0
- package/lib/index.ts +184 -0
- package/lib/styles/global.css +57 -0
- package/lib/types/button.ts +83 -0
- package/lib/types/checkbox.ts +32 -0
- package/lib/types/datepicker.ts +165 -0
- package/lib/types/dropdown.ts +41 -0
- package/lib/types/empty.ts +8 -0
- package/lib/types/form.ts +179 -0
- package/lib/types/index.ts +38 -0
- package/lib/types/input.ts +72 -0
- package/lib/types/menu.ts +55 -0
- package/lib/types/popover.ts +16 -0
- package/lib/types/radio.ts +69 -0
- package/lib/types/result.ts +22 -0
- package/lib/types/select.ts +126 -0
- package/lib/types/skeleton.ts +62 -0
- package/lib/types/switch.ts +22 -0
- package/lib/types/upload.ts +67 -0
- package/lib/utils/index.ts +37 -0
- package/lib/utils/lazy.ts +17 -0
- package/next.config.ts +7 -0
- package/package.json +18 -20
- package/rollup.config.js +71 -0
- package/src/app/favicon.ico +0 -0
- package/src/app/globals.css +48 -0
- package/src/app/layout.d.ts +5 -0
- package/src/app/layout.tsx +16 -0
- package/src/app/page.d.ts +1 -0
- package/src/app/page.tsx +22 -0
- package/tsconfig.json +46 -0
- package/dist/components/Icons/Icons.d.ts +0 -18
- /package/dist/{components → esm/types/components}/Button/Button.d.ts +0 -0
- /package/dist/{components → esm/types/components}/Button/index.d.ts +0 -0
- /package/dist/{components → esm/types/components}/Checkbox/Checkbox.d.ts +0 -0
- /package/dist/{components → esm/types/components}/Checkbox/index.d.ts +0 -0
- /package/dist/{components → esm/types/components}/ConditionalWrapper/index.d.ts +0 -0
- /package/dist/{components → esm/types/components}/DatePicker/RangePicker/index.d.ts +0 -0
- /package/dist/{components → esm/types/components}/DatePicker/TimePicker/TimePicker.d.ts +0 -0
- /package/dist/{components → esm/types/components}/DatePicker/TimePicker/index.d.ts +0 -0
- /package/dist/{components → esm/types/components}/DatePicker/index.d.ts +0 -0
- /package/dist/{components → esm/types/components}/Dropdown/index.d.ts +0 -0
- /package/dist/{components → esm/types/components}/Empty/index.d.ts +0 -0
- /package/dist/{components → esm/types/components}/Form/Form.d.ts +0 -0
- /package/dist/{components → esm/types/components}/Form/Item/index.d.ts +0 -0
- /package/dist/{components → esm/types/components}/Form/index.d.ts +0 -0
- /package/dist/{components → esm/types/components}/Icons/index.d.ts +0 -0
- /package/dist/{components → esm/types/components}/Input/Textarea/index.d.ts +0 -0
- /package/dist/{components → esm/types/components}/Input/index.d.ts +0 -0
- /package/dist/{components → esm/types/components}/Menu/Item/Item.d.ts +0 -0
- /package/dist/{components → esm/types/components}/Menu/Menu.d.ts +0 -0
- /package/dist/{components → esm/types/components}/Menu/SubMenu/SubMenu.d.ts +0 -0
- /package/dist/{components → esm/types/components}/Menu/index.d.ts +0 -0
- /package/dist/{components → esm/types/components}/Popover/index.d.ts +0 -0
- /package/dist/{components → esm/types/components}/Radio/Button/index.d.ts +0 -0
- /package/dist/{components → esm/types/components}/Radio/Group/index.d.ts +0 -0
- /package/dist/{components → esm/types/components}/Radio/index.d.ts +0 -0
- /package/dist/{components → esm/types/components}/Result/index.d.ts +0 -0
- /package/dist/{components → esm/types/components}/Select/Option/Option.d.ts +0 -0
- /package/dist/{components → esm/types/components}/Select/Option/index.d.ts +0 -0
- /package/dist/{components → esm/types/components}/Select/Select.d.ts +0 -0
- /package/dist/{components → esm/types/components}/Select/Tag/Tag.d.ts +0 -0
- /package/dist/{components → esm/types/components}/Select/Tag/index.d.ts +0 -0
- /package/dist/{components → esm/types/components}/Select/index.d.ts +0 -0
- /package/dist/{components → esm/types/components}/Skeleton/Avatar/Avatar.d.ts +0 -0
- /package/dist/{components → esm/types/components}/Skeleton/Avatar/index.d.ts +0 -0
- /package/dist/{components → esm/types/components}/Skeleton/Button/Button.d.ts +0 -0
- /package/dist/{components → esm/types/components}/Skeleton/Button/index.d.ts +0 -0
- /package/dist/{components → esm/types/components}/Skeleton/Image/Image.d.ts +0 -0
- /package/dist/{components → esm/types/components}/Skeleton/Image/index.d.ts +0 -0
- /package/dist/{components → esm/types/components}/Skeleton/Input/Input.d.ts +0 -0
- /package/dist/{components → esm/types/components}/Skeleton/Input/index.d.ts +0 -0
- /package/dist/{components → esm/types/components}/Skeleton/Skeleton.d.ts +0 -0
- /package/dist/{components → esm/types/components}/Skeleton/index.d.ts +0 -0
- /package/dist/{components → esm/types/components}/Switch/index.d.ts +0 -0
- /package/dist/{components → esm/types/components}/Upload/index.d.ts +0 -0
- /package/dist/{helpers → esm/types/helpers}/flatten.d.ts +0 -0
- /package/dist/{helpers → esm/types/helpers}/index.d.ts +0 -0
- /package/dist/{helpers → esm/types/helpers}/mask.d.ts +0 -0
- /package/dist/{hooks → esm/types/hooks}/useForm.d.ts +0 -0
- /package/dist/{hooks → esm/types/hooks}/usePosition.d.ts +0 -0
- /package/dist/{hooks → esm/types/hooks}/useWatch.d.ts +0 -0
- /package/dist/{hooks → esm/types/hooks}/useWatchError.d.ts +0 -0
- /package/dist/{types → esm/types/types}/button.d.ts +0 -0
- /package/dist/{types → esm/types/types}/checkbox.d.ts +0 -0
- /package/dist/{types → esm/types/types}/datepicker.d.ts +0 -0
- /package/dist/{types → esm/types/types}/dropdown.d.ts +0 -0
- /package/dist/{types → esm/types/types}/empty.d.ts +0 -0
- /package/dist/{types → esm/types/types}/form.d.ts +0 -0
- /package/dist/{types → esm/types/types}/index.d.ts +0 -0
- /package/dist/{types → esm/types/types}/menu.d.ts +0 -0
- /package/dist/{types → esm/types/types}/popover.d.ts +0 -0
- /package/dist/{types → esm/types/types}/radio.d.ts +0 -0
- /package/dist/{types → esm/types/types}/result.d.ts +0 -0
- /package/dist/{types → esm/types/types}/select.d.ts +0 -0
- /package/dist/{types → esm/types/types}/skeleton.d.ts +0 -0
- /package/dist/{types → esm/types/types}/switch.d.ts +0 -0
- /package/dist/{types → esm/types/types}/upload.d.ts +0 -0
- /package/dist/{utils → esm/types/utils}/index.d.ts +0 -0
- /package/dist/{utils → esm/types/utils}/lazy.d.ts +0 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { clsx } from '../../../helpers';
|
|
5
|
+
import { RadioButtonProps } from '../../../types/radio';
|
|
6
|
+
import { prefixClsRadio, prefixClsRadioV3 } from '../../../utils';
|
|
7
|
+
import Radio from '../Radio';
|
|
8
|
+
import './style.css';
|
|
9
|
+
|
|
10
|
+
const RadioButton = ({
|
|
11
|
+
prefixCls = prefixClsRadio,
|
|
12
|
+
prefixClsV3 = prefixClsRadioV3,
|
|
13
|
+
className = '',
|
|
14
|
+
checked,
|
|
15
|
+
disabled,
|
|
16
|
+
children,
|
|
17
|
+
size = 'large',
|
|
18
|
+
...props
|
|
19
|
+
}: RadioButtonProps) => {
|
|
20
|
+
return (
|
|
21
|
+
<Radio
|
|
22
|
+
{...props}
|
|
23
|
+
checked={checked}
|
|
24
|
+
disabled={disabled}
|
|
25
|
+
className={clsx([
|
|
26
|
+
`${prefixCls}-button ${prefixClsV3}-button`,
|
|
27
|
+
{
|
|
28
|
+
disabled,
|
|
29
|
+
[className]: className,
|
|
30
|
+
[`${prefixCls}-button-${size} ${prefixClsV3}-button-${size}`]: size,
|
|
31
|
+
[`${prefixCls}-button-checked ${prefixClsV3}-button-checked`]: checked
|
|
32
|
+
}
|
|
33
|
+
])}
|
|
34
|
+
>
|
|
35
|
+
<span className={`${prefixCls}-button-content ${prefixClsV3}-button-content`}>
|
|
36
|
+
{children ?? props.value}
|
|
37
|
+
</span>
|
|
38
|
+
</Radio>
|
|
39
|
+
);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export default RadioButton;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as RadioButton } from '../../Radio/Button/Button'
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
.xUi-radio-button {
|
|
2
|
+
margin: -1px;
|
|
3
|
+
cursor: pointer;
|
|
4
|
+
padding: 8px 16px;
|
|
5
|
+
align-items: center;
|
|
6
|
+
display: inline-flex;
|
|
7
|
+
transition: all 0.3s;
|
|
8
|
+
justify-content: center;
|
|
9
|
+
height: -webkit-fill-available;
|
|
10
|
+
background: var(--xui-background-color);
|
|
11
|
+
border: 1px solid var(--xui-border-color);
|
|
12
|
+
border-radius: var(--xui-border-radius-sm);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.xUi-radio-button .xUi-radio {
|
|
16
|
+
display: none
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.xUi-radio-button.xUi-radio-button-middle {
|
|
20
|
+
border-radius: var(--xui-border-radius-md);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.xUi-radio-button.xUi-radio-button-large {
|
|
24
|
+
border-radius: var(--xui-border-radius-lg);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.xUi-radio-button-checked {
|
|
28
|
+
z-index: 1;
|
|
29
|
+
background: var(--xui-primary-color);
|
|
30
|
+
border-color: var(--xui-primary-color);
|
|
31
|
+
color: var(--xui-background-color);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.xUi-radio-button-content {
|
|
35
|
+
font-size: 14px;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.xUi-radio-button.disabled {
|
|
39
|
+
cursor: not-allowed;
|
|
40
|
+
color: var(--xui-color-disabled);
|
|
41
|
+
background: var(--xui-color-disabled);
|
|
42
|
+
border-color: var(--xui-border-color);
|
|
43
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import React, {
|
|
4
|
+
Children,
|
|
5
|
+
isValidElement,
|
|
6
|
+
useMemo
|
|
7
|
+
} from 'react';
|
|
8
|
+
import { clsx } from '../../../helpers';
|
|
9
|
+
import { RuleType } from '../../../types';
|
|
10
|
+
import { RadioGroupProps } from '../../../types/radio';
|
|
11
|
+
import { prefixClsRadio, prefixClsRadioV3 } from '../../../utils';
|
|
12
|
+
import Radio from '../Radio';
|
|
13
|
+
import RadioButton from '../Button/Button';
|
|
14
|
+
import './style.css';
|
|
15
|
+
|
|
16
|
+
const RadioGroup = ({
|
|
17
|
+
defaultValue,
|
|
18
|
+
value,
|
|
19
|
+
size = 'large',
|
|
20
|
+
disabled,
|
|
21
|
+
name,
|
|
22
|
+
id,
|
|
23
|
+
style = {},
|
|
24
|
+
buttonStyle = 'outline',
|
|
25
|
+
block,
|
|
26
|
+
prefixCls = prefixClsRadio,
|
|
27
|
+
prefixClsV3 = prefixClsRadioV3,
|
|
28
|
+
className = '',
|
|
29
|
+
options = [],
|
|
30
|
+
children,
|
|
31
|
+
...props
|
|
32
|
+
}: RadioGroupProps) => {
|
|
33
|
+
const selectedValue = useMemo(
|
|
34
|
+
() => (value !== undefined ? value : defaultValue),
|
|
35
|
+
[value, defaultValue]
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
const renderChildren = () => {
|
|
39
|
+
if (options.length > 0) {
|
|
40
|
+
return options.map((option, key) => {
|
|
41
|
+
const optionValue = typeof option === 'object' ? option.value : option;
|
|
42
|
+
const optionLabel = typeof option === 'object' ? option.label : option;
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<Radio
|
|
46
|
+
value={optionValue}
|
|
47
|
+
key={`${key}_${optionValue}`}
|
|
48
|
+
checked={selectedValue === optionValue}
|
|
49
|
+
disabled={
|
|
50
|
+
disabled || (typeof option === 'object' && option.disabled)
|
|
51
|
+
}
|
|
52
|
+
{...props}
|
|
53
|
+
>
|
|
54
|
+
{optionLabel}
|
|
55
|
+
</Radio>
|
|
56
|
+
);
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return Children.map(children, child => {
|
|
61
|
+
if (
|
|
62
|
+
isValidElement(child) &&
|
|
63
|
+
(child.type === Radio || child.type === RadioButton)
|
|
64
|
+
) {
|
|
65
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
66
|
+
// @ts-expect-error
|
|
67
|
+
const { ...childProps } = child.props;
|
|
68
|
+
|
|
69
|
+
return (
|
|
70
|
+
<child.type
|
|
71
|
+
{...props}
|
|
72
|
+
{...childProps}
|
|
73
|
+
{...(child.type === RadioButton ? { size, buttonStyle } : {})}
|
|
74
|
+
defaultValue={defaultValue}
|
|
75
|
+
disabled={disabled ?? (child.props as { disabled: boolean }).disabled}
|
|
76
|
+
checked={selectedValue === (child.props as { value: RuleType }).value}
|
|
77
|
+
name={name ?? prefixClsRadio}
|
|
78
|
+
/>
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return child;
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
return (
|
|
87
|
+
<div
|
|
88
|
+
id={id}
|
|
89
|
+
style={style}
|
|
90
|
+
className={clsx([
|
|
91
|
+
`${prefixCls}-group ${prefixClsV3}-group`,
|
|
92
|
+
{
|
|
93
|
+
block,
|
|
94
|
+
className,
|
|
95
|
+
[`${prefixCls}-group-${size} ${prefixClsV3}-group-${size}`]: size,
|
|
96
|
+
[`${prefixCls}-group-solid ${prefixClsV3}-group-solid`]: buttonStyle === 'solid'
|
|
97
|
+
}
|
|
98
|
+
])}
|
|
99
|
+
>
|
|
100
|
+
{renderChildren()}
|
|
101
|
+
</div>
|
|
102
|
+
);
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
export default RadioGroup;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as RadioGroup } from '../../Radio/Group/Group'
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
.xUi-radio-group.xUi-radio-group-small {
|
|
2
|
+
height: 24px;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.xUi-radio-group.xUi-radio-group-small .xUi-radio-button:first-child {
|
|
6
|
+
border-radius: var(--xui-border-radius-sm) 0 0 var(--xui-border-radius-sm);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.xUi-radio-group.xUi-radio-group-small .xUi-radio-button:last-child {
|
|
10
|
+
border-radius: 0 var(--xui-border-radius-sm) var(--xui-border-radius-sm) 0;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.xUi-radio-group.xUi-radio-group-middle {
|
|
14
|
+
height: 32px;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.xUi-radio-group.xUi-radio-group-middle .xUi-radio-button:first-child {
|
|
18
|
+
border-radius: var(--xui-border-radius-md) 0 0 var(--xui-border-radius-md);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.xUi-radio-group.xUi-radio-group-middle .xUi-radio-button:last-child {
|
|
22
|
+
border-radius: 0 var(--xui-border-radius-md) var(--xui-border-radius-md) 0;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.xUi-radio-group.xUi-radio-group-large {
|
|
26
|
+
height: 44px;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.xUi-radio-group.xUi-radio-group-large .xUi-radio-button:first-child {
|
|
30
|
+
border-radius: var(--xui-border-radius-lg) 0 0 var(--xui-border-radius-lg);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.xUi-radio-group.xUi-radio-group-large .xUi-radio-button:last-child {
|
|
34
|
+
border-radius: 0 var(--xui-border-radius-lg) var(--xui-border-radius-lg) 0;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.xUi-radio-group .xUi-radio-button:not(:first-child) {
|
|
38
|
+
border-radius: 0px;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.xUi-radio-group.block {
|
|
42
|
+
display: inline-flex;
|
|
43
|
+
width: 100%;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.xUi-radio-group.block .xUi-radio-button {
|
|
47
|
+
width: 100%;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.xUi-radio-group:not(.xUi-radio-group-solid) .xUi-radio-button-checked {
|
|
51
|
+
background-color: var(--xui-background-color);
|
|
52
|
+
color: var(--xui-primary-color);
|
|
53
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import React, { useEffect } from 'react';
|
|
4
|
+
import { clsx, parseValue } from '../../helpers';
|
|
5
|
+
import { RadioProps } from '../../types/radio';
|
|
6
|
+
import { prefixClsRadio } from '../../utils';
|
|
7
|
+
import './style.css';
|
|
8
|
+
|
|
9
|
+
const Radio = ({
|
|
10
|
+
prefixCls = prefixClsRadio,
|
|
11
|
+
className = '',
|
|
12
|
+
value,
|
|
13
|
+
onChange,
|
|
14
|
+
onClick,
|
|
15
|
+
disabled,
|
|
16
|
+
children,
|
|
17
|
+
name,
|
|
18
|
+
title,
|
|
19
|
+
defaultChecked,
|
|
20
|
+
checked,
|
|
21
|
+
onBlur,
|
|
22
|
+
onFocus,
|
|
23
|
+
onMouseEnter,
|
|
24
|
+
onMouseLeave,
|
|
25
|
+
noStyle,
|
|
26
|
+
ref
|
|
27
|
+
}: RadioProps
|
|
28
|
+
) => {
|
|
29
|
+
const handleChange = () => {
|
|
30
|
+
if (!disabled) {
|
|
31
|
+
onClick?.(parseValue(title ?? value));
|
|
32
|
+
onChange?.(parseValue(title ?? value));
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
if (defaultChecked ?? checked) {
|
|
38
|
+
onChange?.(parseValue(value));
|
|
39
|
+
}
|
|
40
|
+
}, [defaultChecked, checked]);
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<label
|
|
44
|
+
ref={ref}
|
|
45
|
+
title={title}
|
|
46
|
+
onMouseEnter={onMouseEnter}
|
|
47
|
+
onMouseLeave={onMouseLeave}
|
|
48
|
+
className={clsx([
|
|
49
|
+
`${prefixCls}-label`,
|
|
50
|
+
{
|
|
51
|
+
disabled,
|
|
52
|
+
noStyle: noStyle,
|
|
53
|
+
[className]: className
|
|
54
|
+
}
|
|
55
|
+
])}
|
|
56
|
+
>
|
|
57
|
+
<input
|
|
58
|
+
name={name}
|
|
59
|
+
type="radio"
|
|
60
|
+
tabIndex={0}
|
|
61
|
+
role="button"
|
|
62
|
+
onClick={onClick}
|
|
63
|
+
disabled={disabled}
|
|
64
|
+
onChange={handleChange}
|
|
65
|
+
onBlur={e => onBlur?.(e)}
|
|
66
|
+
onFocus={e => onFocus?.(e)}
|
|
67
|
+
checked={checked ?? defaultChecked}
|
|
68
|
+
/>
|
|
69
|
+
<span
|
|
70
|
+
className={clsx([
|
|
71
|
+
`${prefixCls} ${prefixCls}-${disabled ? 'disabled' : 'enabled'}`
|
|
72
|
+
])}
|
|
73
|
+
/>
|
|
74
|
+
<span className={`${prefixCls}-title`}>
|
|
75
|
+
{children ?? title ?? value}
|
|
76
|
+
</span>
|
|
77
|
+
</label>
|
|
78
|
+
);
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
Radio.displayName = 'Radio';
|
|
82
|
+
|
|
83
|
+
export default Radio;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Radio } from '../Radio/Radio'
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
.xUi-radio-label {
|
|
2
|
+
line-height: 1;
|
|
3
|
+
display: inline-flex;
|
|
4
|
+
align-items: center;
|
|
5
|
+
cursor: pointer;
|
|
6
|
+
position: relative;
|
|
7
|
+
font-size: var(--xui-font-size-md);
|
|
8
|
+
margin: 16px 0;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.xUi-radio-label input {
|
|
12
|
+
display: none;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.xUi-radio {
|
|
16
|
+
width: 16px;
|
|
17
|
+
height: 16px;
|
|
18
|
+
border-radius: 50%;
|
|
19
|
+
position: relative;
|
|
20
|
+
transition: all 0.3s;
|
|
21
|
+
border: 1px solid var(--xui-border-color);
|
|
22
|
+
|
|
23
|
+
&:has([tabindex="0"]:focus-visible) {
|
|
24
|
+
border-color: var(--xui-primary-color);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.xUi-radio-error:not(.xUi-radio-disabled) {
|
|
29
|
+
border: 1px solid var(--xui-error-color);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.xUi-radio-label input:checked + .xUi-radio-error:not(.xUi-radio-disabled) {
|
|
33
|
+
background: var(--xui-error-color);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.xUi-radio-group {
|
|
37
|
+
display: flex;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.xUi-radio-label .xUi-radio-enabled:not(.xUi-radio-error):hover {
|
|
41
|
+
border: 1px solid var(--xui-primary-color-light) !important;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.xUi-radio-disabled {
|
|
45
|
+
background-color: var(--xui-color-disabled);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.xUi-radio-title {
|
|
49
|
+
padding-inline-start: 8px;
|
|
50
|
+
padding-inline-end: 8px;
|
|
51
|
+
color: var(--xui-text-color);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.xUi-radio-label input:checked + .xUi-radio {
|
|
55
|
+
background: var(--xui-primary-color);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.xUi-radio-label input:checked + .xUi-radio::after {
|
|
59
|
+
content: "";
|
|
60
|
+
width: 6px;
|
|
61
|
+
height: 6px;
|
|
62
|
+
background-color: white;
|
|
63
|
+
border-radius: 50%;
|
|
64
|
+
position: absolute;
|
|
65
|
+
top: 50%;
|
|
66
|
+
left: 50%;
|
|
67
|
+
transform: translate(-50%, -50%);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.xUi-radio-label.disabled {
|
|
71
|
+
cursor: not-allowed;
|
|
72
|
+
opacity: 0.5;
|
|
73
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ResultProps } from "../../types/result";
|
|
3
|
+
import { prefixClsResult } from "../../utils";
|
|
4
|
+
import './style.css';
|
|
5
|
+
import { renderDefaultIcon } from "../Icons/Icons";
|
|
6
|
+
|
|
7
|
+
const Result = ({
|
|
8
|
+
icon,
|
|
9
|
+
status = "info",
|
|
10
|
+
title,
|
|
11
|
+
subTitle,
|
|
12
|
+
extra,
|
|
13
|
+
prefixCls = prefixClsResult,
|
|
14
|
+
className = "",
|
|
15
|
+
style,
|
|
16
|
+
children,
|
|
17
|
+
}: ResultProps) => {
|
|
18
|
+
const renderIcon = () => {
|
|
19
|
+
if (icon) {
|
|
20
|
+
return <div className={`${prefixCls}-icon`}>{icon}</div>;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return <div className={`${prefixCls}-icon`}>{renderDefaultIcon(status)}</div>;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<div className={`${prefixCls} ${prefixCls}-${status} ${className}`} style={style}>
|
|
28
|
+
{renderIcon()}
|
|
29
|
+
|
|
30
|
+
{title && <div className={`${prefixCls}-title`}>{title}</div>}
|
|
31
|
+
{subTitle && <div className={`${prefixCls}-subtitle`}>{subTitle}</div>}
|
|
32
|
+
{extra && <div className={`${prefixCls}-extra`}>{extra}</div>}
|
|
33
|
+
|
|
34
|
+
{children && <div className={`${prefixCls}-content`}>{children}</div>}
|
|
35
|
+
</div>
|
|
36
|
+
);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export default Result;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Result } from '../Result/Result';
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
.xUi-result {
|
|
2
|
+
box-sizing: border-box;
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
align-items: center;
|
|
6
|
+
text-align: center;
|
|
7
|
+
background: var(--xui-result-bg);
|
|
8
|
+
color: var(--xui-result-color);
|
|
9
|
+
padding: var(--xui-padding);
|
|
10
|
+
border-radius: var(--xui-border-radius-lg);
|
|
11
|
+
gap: var(--xui-gap);
|
|
12
|
+
max-width: var(--xui-max-width);
|
|
13
|
+
margin: 0 auto;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.xUi-result-icon {
|
|
17
|
+
display: flex;
|
|
18
|
+
align-items: center;
|
|
19
|
+
justify-content: center;
|
|
20
|
+
width: var(--xui-icon-size);
|
|
21
|
+
height: var(--xui-icon-size);
|
|
22
|
+
border-radius: 50%;
|
|
23
|
+
font-size: 32px;
|
|
24
|
+
line-height: 1;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.xUi-result-icon.xUi-result-icon-success {
|
|
28
|
+
background: #f6ffed;
|
|
29
|
+
color: #52c41a;
|
|
30
|
+
border: 1px solid #b7eb8f;
|
|
31
|
+
}
|
|
32
|
+
.xUi-result-icon.xUi-result-icon-error {
|
|
33
|
+
background: #fff2f0;
|
|
34
|
+
color: #ff4d4f;
|
|
35
|
+
border: 1px solid #ffccc7;
|
|
36
|
+
}
|
|
37
|
+
.xUi-result-icon.xUi-result-icon-info {
|
|
38
|
+
background: #e6f7ff;
|
|
39
|
+
color: #1890ff;
|
|
40
|
+
border: 1px solid #91d5ff;
|
|
41
|
+
}
|
|
42
|
+
.xUi-result-icon.xUi-result-icon-warning {
|
|
43
|
+
background: #fffbe6;
|
|
44
|
+
color: #faad14;
|
|
45
|
+
border: 1px solid #ffe58f;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.xUi-result
|
|
49
|
+
> .xUi-result-icon:not(.xUi-result-icon-success):not(.xUi-result-icon-error):not(.xUi-result-icon-info):not(
|
|
50
|
+
.xUi-result-icon-warning
|
|
51
|
+
) {
|
|
52
|
+
width: auto;
|
|
53
|
+
height: auto;
|
|
54
|
+
border-radius: 0;
|
|
55
|
+
background: transparent;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.xUi-result-title {
|
|
59
|
+
font-family: var(--xui-font-family);
|
|
60
|
+
font-size: 24px;
|
|
61
|
+
font-weight: 600;
|
|
62
|
+
color: var(--xui-result-color);
|
|
63
|
+
margin-top: 4px;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.xUi-result-subtitle {
|
|
67
|
+
font-family: var(--xui-font-family);
|
|
68
|
+
font-size: 14px;
|
|
69
|
+
color: var(--xui-subtle-color);
|
|
70
|
+
margin-top: 6px;
|
|
71
|
+
max-width: 100%;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.xUi-result-extra {
|
|
75
|
+
margin-top: 12px;
|
|
76
|
+
display: flex;
|
|
77
|
+
gap: 12px;
|
|
78
|
+
align-items: center;
|
|
79
|
+
justify-content: center;
|
|
80
|
+
flex-wrap: wrap;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.xUi-result-content {
|
|
84
|
+
width: 100%;
|
|
85
|
+
margin-top: 12px;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.xUi-result-success {
|
|
89
|
+
--xui-accent: #52c41a;
|
|
90
|
+
}
|
|
91
|
+
.xUi-result-error {
|
|
92
|
+
--xui-accent: #ff4d4f;
|
|
93
|
+
}
|
|
94
|
+
.xUi-result-info {
|
|
95
|
+
--xui-accent: #1890ff;
|
|
96
|
+
}
|
|
97
|
+
.xUi-result-warning {
|
|
98
|
+
--xui-accent: #faad14;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.xUi-result-403 .xUi-result-icon,
|
|
102
|
+
.xUi-result-404 .xUi-result-icon,
|
|
103
|
+
.xUi-result-500 .xUi-result-icon {
|
|
104
|
+
width: 160px;
|
|
105
|
+
height: 110px;
|
|
106
|
+
border-radius: 8px;
|
|
107
|
+
background: none;
|
|
108
|
+
color: var(--xui-subtle-color);
|
|
109
|
+
font-size: 48px;
|
|
110
|
+
display: flex;
|
|
111
|
+
align-items: center;
|
|
112
|
+
justify-content: center;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
@media (max-width: 480px) {
|
|
116
|
+
.xUi-result {
|
|
117
|
+
padding: 16px;
|
|
118
|
+
gap: 12px;
|
|
119
|
+
}
|
|
120
|
+
.xUi-result-title {
|
|
121
|
+
font-size: 18px;
|
|
122
|
+
}
|
|
123
|
+
.xUi-result-icon {
|
|
124
|
+
width: 56px;
|
|
125
|
+
height: 56px;
|
|
126
|
+
font-size: 24px;
|
|
127
|
+
}
|
|
128
|
+
.xUi-result-404 .xUi-result-icon,
|
|
129
|
+
.xUi-result-500 .xUi-result-icon,
|
|
130
|
+
.xUi-result-403 .xUi-result-icon {
|
|
131
|
+
width: 120px;
|
|
132
|
+
height: 84px;
|
|
133
|
+
font-size: 40px;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.xUi-result-extra :is(button, a) {
|
|
138
|
+
outline: none;
|
|
139
|
+
text-decoration: none;
|
|
140
|
+
}
|
|
141
|
+
.xUi-result-extra :is(button, a):focus {
|
|
142
|
+
box-shadow: 0 0 0 3px rgba(24, 144, 255, 0.12);
|
|
143
|
+
border-radius: 6px;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.xUi-result-center {
|
|
147
|
+
display: flex;
|
|
148
|
+
align-items: center;
|
|
149
|
+
justify-content: center;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.xUi-result-bordered {
|
|
153
|
+
border: 1px solid rgba(0, 0, 0, 0.06);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.xUi-result[data-bg] {
|
|
157
|
+
background: var(--xui-result-bg);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.xUi-result.full-width {
|
|
161
|
+
max-width: 100%;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.xUi-result-extra .xUi-btn {
|
|
165
|
+
padding: 6px 14px;
|
|
166
|
+
border-radius: 6px;
|
|
167
|
+
border: 1px solid rgba(0, 0, 0, 0.08);
|
|
168
|
+
background: #fff;
|
|
169
|
+
cursor: pointer;
|
|
170
|
+
}
|
|
171
|
+
.xUi-result-extra .xUi-btn:hover {
|
|
172
|
+
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
|
|
173
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import React, { FC, MouseEventHandler } from 'react';
|
|
2
|
+
import { clsx } from '../../../helpers';
|
|
3
|
+
import { OptionProps } from '../../../types/select';
|
|
4
|
+
import { prefixClsSelect, prefixClsSelectV3 } from '../../../utils';
|
|
5
|
+
import './style.css';
|
|
6
|
+
|
|
7
|
+
const Option: FC<OptionProps> = ({
|
|
8
|
+
value,
|
|
9
|
+
children,
|
|
10
|
+
disabled,
|
|
11
|
+
className = '',
|
|
12
|
+
style,
|
|
13
|
+
onClick,
|
|
14
|
+
render,
|
|
15
|
+
prefixCls = prefixClsSelect,
|
|
16
|
+
prefixClsV3 = prefixClsSelectV3,
|
|
17
|
+
selected,
|
|
18
|
+
title
|
|
19
|
+
}) => {
|
|
20
|
+
const handleClick: MouseEventHandler<HTMLDivElement> = e => {
|
|
21
|
+
if (disabled) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
onClick?.(e);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<div
|
|
30
|
+
tabIndex={0}
|
|
31
|
+
role="button"
|
|
32
|
+
className={clsx([
|
|
33
|
+
`${prefixCls}-option ${prefixClsV3}-option ${className} `,
|
|
34
|
+
{
|
|
35
|
+
selected: selected,
|
|
36
|
+
disabled: disabled
|
|
37
|
+
}
|
|
38
|
+
])}
|
|
39
|
+
style={style}
|
|
40
|
+
onClick={handleClick}
|
|
41
|
+
data-testid={value || children}
|
|
42
|
+
{...(title ? { title } : {})}
|
|
43
|
+
>
|
|
44
|
+
{render ? render(value as string) : children || value}
|
|
45
|
+
</div>
|
|
46
|
+
);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export default Option;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Option } from '../../Select/Option/Option'
|