x-ui-design 1.0.30 → 1.0.31-gamma.1

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.
Files changed (219) hide show
  1. package/README.md +1 -22
  2. package/dist/{esm/types/components → components}/DatePicker/DatePicker.d.ts +1 -2
  3. package/dist/{esm/types/components → components}/DatePicker/RangePicker/RangePicker.d.ts +1 -2
  4. package/dist/{esm/types/components → components}/Dropdown/Dropdown.d.ts +1 -2
  5. package/dist/{esm/types/components → components}/Empty/Empty.d.ts +1 -2
  6. package/dist/{esm/types/components → components}/Form/Item/Item.d.ts +1 -2
  7. package/dist/components/Icons/Icons.d.ts +18 -0
  8. package/dist/components/Input/Input.d.ts +11 -0
  9. package/dist/{esm/types/components → components}/Input/Textarea/Textarea.d.ts +1 -2
  10. package/dist/{esm/types/components → components}/Popover/Popover.d.ts +1 -2
  11. package/dist/{esm/types/components → components}/Radio/Button/Button.d.ts +1 -2
  12. package/dist/{esm/types/components → components}/Radio/Group/Group.d.ts +1 -2
  13. package/dist/{esm/types/components → components}/Radio/Radio.d.ts +1 -2
  14. package/dist/{esm/types/components → components}/Result/Result.d.ts +1 -2
  15. package/dist/{esm/types/components → components}/Switch/Switch.d.ts +1 -2
  16. package/dist/{esm/types/components → components}/Upload/Upload.d.ts +1 -2
  17. package/dist/esm/types/index.d.ts +0 -56
  18. package/dist/index.d.ts +1 -150
  19. package/dist/index.esm.js +3433 -3863
  20. package/dist/index.esm.js.map +1 -1
  21. package/dist/index.js +3395 -3825
  22. package/dist/index.js.map +1 -1
  23. package/package.json +22 -20
  24. package/.github/workflows/x-ui-design.yml +0 -14
  25. package/compile.sh +0 -15
  26. package/dist/esm/types/components/Icons/Icons.d.ts +0 -19
  27. package/dist/esm/types/components/Input/Input.d.ts +0 -16
  28. package/eslint.config.mjs +0 -16
  29. package/lib/components/Button/Button.tsx +0 -136
  30. package/lib/components/Button/index.ts +0 -1
  31. package/lib/components/Button/style.css +0 -197
  32. package/lib/components/Checkbox/Checkbox.tsx +0 -131
  33. package/lib/components/Checkbox/index.ts +0 -1
  34. package/lib/components/Checkbox/style.css +0 -95
  35. package/lib/components/ConditionalWrapper/index.tsx +0 -12
  36. package/lib/components/DatePicker/DatePicker.tsx +0 -526
  37. package/lib/components/DatePicker/RangePicker/RangePicker.tsx +0 -500
  38. package/lib/components/DatePicker/RangePicker/index.ts +0 -1
  39. package/lib/components/DatePicker/RangePicker/style.css +0 -434
  40. package/lib/components/DatePicker/TimePicker/TimePicker.tsx +0 -497
  41. package/lib/components/DatePicker/TimePicker/index.ts +0 -1
  42. package/lib/components/DatePicker/TimePicker/style.css +0 -197
  43. package/lib/components/DatePicker/index.ts +0 -1
  44. package/lib/components/DatePicker/style.css +0 -318
  45. package/lib/components/Dropdown/Dropdown.tsx +0 -234
  46. package/lib/components/Dropdown/index.ts +0 -1
  47. package/lib/components/Dropdown/style.css +0 -124
  48. package/lib/components/Empty/Empty.tsx +0 -45
  49. package/lib/components/Empty/index.ts +0 -1
  50. package/lib/components/Empty/style.css +0 -13
  51. package/lib/components/Form/Form.tsx +0 -130
  52. package/lib/components/Form/Item/Item.tsx +0 -294
  53. package/lib/components/Form/Item/index.ts +0 -1
  54. package/lib/components/Form/Item/style.css +0 -61
  55. package/lib/components/Form/index.ts +0 -1
  56. package/lib/components/Icons/Icons.tsx +0 -433
  57. package/lib/components/Icons/index.ts +0 -15
  58. package/lib/components/Input/Input.tsx +0 -228
  59. package/lib/components/Input/Textarea/Textarea.tsx +0 -110
  60. package/lib/components/Input/Textarea/index.ts +0 -1
  61. package/lib/components/Input/Textarea/style.css +0 -104
  62. package/lib/components/Input/index.ts +0 -1
  63. package/lib/components/Input/style.css +0 -137
  64. package/lib/components/Menu/Item/Item.tsx +0 -65
  65. package/lib/components/Menu/Menu.tsx +0 -261
  66. package/lib/components/Menu/SubMenu/SubMenu.tsx +0 -68
  67. package/lib/components/Menu/index.css +0 -145
  68. package/lib/components/Menu/index.ts +0 -1
  69. package/lib/components/Popover/Popover.tsx +0 -135
  70. package/lib/components/Popover/index.ts +0 -1
  71. package/lib/components/Popover/style.css +0 -82
  72. package/lib/components/Radio/Button/Button.tsx +0 -42
  73. package/lib/components/Radio/Button/index.ts +0 -1
  74. package/lib/components/Radio/Button/style.css +0 -43
  75. package/lib/components/Radio/Group/Group.tsx +0 -105
  76. package/lib/components/Radio/Group/index.ts +0 -1
  77. package/lib/components/Radio/Group/style.css +0 -53
  78. package/lib/components/Radio/Radio.tsx +0 -83
  79. package/lib/components/Radio/index.ts +0 -1
  80. package/lib/components/Radio/style.css +0 -73
  81. package/lib/components/Result/Result.tsx +0 -39
  82. package/lib/components/Result/index.ts +0 -1
  83. package/lib/components/Result/style.css +0 -173
  84. package/lib/components/Select/Option/Option.tsx +0 -49
  85. package/lib/components/Select/Option/index.ts +0 -1
  86. package/lib/components/Select/Option/style.css +0 -50
  87. package/lib/components/Select/Select.tsx +0 -935
  88. package/lib/components/Select/Tag/Tag.tsx +0 -43
  89. package/lib/components/Select/Tag/index.ts +0 -1
  90. package/lib/components/Select/Tag/style.css +0 -87
  91. package/lib/components/Select/index.ts +0 -1
  92. package/lib/components/Select/style.css +0 -186
  93. package/lib/components/Skeleton/Avatar/Avatar.tsx +0 -61
  94. package/lib/components/Skeleton/Avatar/index.ts +0 -1
  95. package/lib/components/Skeleton/Avatar/style.css +0 -27
  96. package/lib/components/Skeleton/Button/Button.tsx +0 -44
  97. package/lib/components/Skeleton/Button/index.ts +0 -1
  98. package/lib/components/Skeleton/Button/style.css +0 -50
  99. package/lib/components/Skeleton/Image/Image.tsx +0 -45
  100. package/lib/components/Skeleton/Image/index.ts +0 -1
  101. package/lib/components/Skeleton/Image/style.css +0 -23
  102. package/lib/components/Skeleton/Input/Input.tsx +0 -42
  103. package/lib/components/Skeleton/Input/index.ts +0 -1
  104. package/lib/components/Skeleton/Input/style.css +0 -56
  105. package/lib/components/Skeleton/Skeleton.tsx +0 -97
  106. package/lib/components/Skeleton/index.ts +0 -1
  107. package/lib/components/Skeleton/style.css +0 -84
  108. package/lib/components/Switch/Switch.tsx +0 -68
  109. package/lib/components/Switch/index.css +0 -50
  110. package/lib/components/Switch/index.ts +0 -1
  111. package/lib/components/Upload/Upload.tsx +0 -291
  112. package/lib/components/Upload/index.ts +0 -1
  113. package/lib/components/Upload/style.css +0 -151
  114. package/lib/global.d.ts +0 -1
  115. package/lib/helpers/flatten.ts +0 -26
  116. package/lib/helpers/index.ts +0 -52
  117. package/lib/helpers/mask.ts +0 -52
  118. package/lib/hooks/useForm.ts +0 -548
  119. package/lib/hooks/usePosition.ts +0 -206
  120. package/lib/hooks/useWatch.ts +0 -41
  121. package/lib/hooks/useWatchError.ts +0 -20
  122. package/lib/index.ts +0 -184
  123. package/lib/styles/global.css +0 -57
  124. package/lib/types/button.ts +0 -83
  125. package/lib/types/checkbox.ts +0 -32
  126. package/lib/types/datepicker.ts +0 -165
  127. package/lib/types/dropdown.ts +0 -41
  128. package/lib/types/empty.ts +0 -8
  129. package/lib/types/form.ts +0 -179
  130. package/lib/types/index.ts +0 -38
  131. package/lib/types/input.ts +0 -72
  132. package/lib/types/menu.ts +0 -55
  133. package/lib/types/popover.ts +0 -16
  134. package/lib/types/radio.ts +0 -69
  135. package/lib/types/result.ts +0 -22
  136. package/lib/types/select.ts +0 -126
  137. package/lib/types/skeleton.ts +0 -62
  138. package/lib/types/switch.ts +0 -22
  139. package/lib/types/upload.ts +0 -67
  140. package/lib/utils/index.ts +0 -37
  141. package/lib/utils/lazy.ts +0 -17
  142. package/next.config.ts +0 -7
  143. package/rollup.config.js +0 -71
  144. package/src/app/favicon.ico +0 -0
  145. package/src/app/globals.css +0 -48
  146. package/src/app/layout.d.ts +0 -5
  147. package/src/app/layout.tsx +0 -16
  148. package/src/app/page.d.ts +0 -1
  149. package/src/app/page.tsx +0 -21
  150. package/tsconfig.json +0 -46
  151. /package/dist/{esm/types/components → components}/Button/Button.d.ts +0 -0
  152. /package/dist/{esm/types/components → components}/Button/index.d.ts +0 -0
  153. /package/dist/{esm/types/components → components}/Checkbox/Checkbox.d.ts +0 -0
  154. /package/dist/{esm/types/components → components}/Checkbox/index.d.ts +0 -0
  155. /package/dist/{esm/types/components → components}/ConditionalWrapper/index.d.ts +0 -0
  156. /package/dist/{esm/types/components → components}/DatePicker/RangePicker/index.d.ts +0 -0
  157. /package/dist/{esm/types/components → components}/DatePicker/TimePicker/TimePicker.d.ts +0 -0
  158. /package/dist/{esm/types/components → components}/DatePicker/TimePicker/index.d.ts +0 -0
  159. /package/dist/{esm/types/components → components}/DatePicker/index.d.ts +0 -0
  160. /package/dist/{esm/types/components → components}/Dropdown/index.d.ts +0 -0
  161. /package/dist/{esm/types/components → components}/Empty/index.d.ts +0 -0
  162. /package/dist/{esm/types/components → components}/Form/Form.d.ts +0 -0
  163. /package/dist/{esm/types/components → components}/Form/Item/index.d.ts +0 -0
  164. /package/dist/{esm/types/components → components}/Form/index.d.ts +0 -0
  165. /package/dist/{esm/types/components → components}/Icons/index.d.ts +0 -0
  166. /package/dist/{esm/types/components → components}/Input/Textarea/index.d.ts +0 -0
  167. /package/dist/{esm/types/components → components}/Input/index.d.ts +0 -0
  168. /package/dist/{esm/types/components → components}/Menu/Item/Item.d.ts +0 -0
  169. /package/dist/{esm/types/components → components}/Menu/Menu.d.ts +0 -0
  170. /package/dist/{esm/types/components → components}/Menu/SubMenu/SubMenu.d.ts +0 -0
  171. /package/dist/{esm/types/components → components}/Menu/index.d.ts +0 -0
  172. /package/dist/{esm/types/components → components}/Popover/index.d.ts +0 -0
  173. /package/dist/{esm/types/components → components}/Radio/Button/index.d.ts +0 -0
  174. /package/dist/{esm/types/components → components}/Radio/Group/index.d.ts +0 -0
  175. /package/dist/{esm/types/components → components}/Radio/index.d.ts +0 -0
  176. /package/dist/{esm/types/components → components}/Result/index.d.ts +0 -0
  177. /package/dist/{esm/types/components → components}/Select/Option/Option.d.ts +0 -0
  178. /package/dist/{esm/types/components → components}/Select/Option/index.d.ts +0 -0
  179. /package/dist/{esm/types/components → components}/Select/Select.d.ts +0 -0
  180. /package/dist/{esm/types/components → components}/Select/Tag/Tag.d.ts +0 -0
  181. /package/dist/{esm/types/components → components}/Select/Tag/index.d.ts +0 -0
  182. /package/dist/{esm/types/components → components}/Select/index.d.ts +0 -0
  183. /package/dist/{esm/types/components → components}/Skeleton/Avatar/Avatar.d.ts +0 -0
  184. /package/dist/{esm/types/components → components}/Skeleton/Avatar/index.d.ts +0 -0
  185. /package/dist/{esm/types/components → components}/Skeleton/Button/Button.d.ts +0 -0
  186. /package/dist/{esm/types/components → components}/Skeleton/Button/index.d.ts +0 -0
  187. /package/dist/{esm/types/components → components}/Skeleton/Image/Image.d.ts +0 -0
  188. /package/dist/{esm/types/components → components}/Skeleton/Image/index.d.ts +0 -0
  189. /package/dist/{esm/types/components → components}/Skeleton/Input/Input.d.ts +0 -0
  190. /package/dist/{esm/types/components → components}/Skeleton/Input/index.d.ts +0 -0
  191. /package/dist/{esm/types/components → components}/Skeleton/Skeleton.d.ts +0 -0
  192. /package/dist/{esm/types/components → components}/Skeleton/index.d.ts +0 -0
  193. /package/dist/{esm/types/components → components}/Switch/index.d.ts +0 -0
  194. /package/dist/{esm/types/components → components}/Upload/index.d.ts +0 -0
  195. /package/dist/{esm/types/helpers → helpers}/flatten.d.ts +0 -0
  196. /package/dist/{esm/types/helpers → helpers}/index.d.ts +0 -0
  197. /package/dist/{esm/types/helpers → helpers}/mask.d.ts +0 -0
  198. /package/dist/{esm/types/hooks → hooks}/useForm.d.ts +0 -0
  199. /package/dist/{esm/types/hooks → hooks}/usePosition.d.ts +0 -0
  200. /package/dist/{esm/types/hooks → hooks}/useWatch.d.ts +0 -0
  201. /package/dist/{esm/types/hooks → hooks}/useWatchError.d.ts +0 -0
  202. /package/dist/{esm/types/types → types}/button.d.ts +0 -0
  203. /package/dist/{esm/types/types → types}/checkbox.d.ts +0 -0
  204. /package/dist/{esm/types/types → types}/datepicker.d.ts +0 -0
  205. /package/dist/{esm/types/types → types}/dropdown.d.ts +0 -0
  206. /package/dist/{esm/types/types → types}/empty.d.ts +0 -0
  207. /package/dist/{esm/types/types → types}/form.d.ts +0 -0
  208. /package/dist/{esm/types/types → types}/index.d.ts +0 -0
  209. /package/dist/{esm/types/types → types}/input.d.ts +0 -0
  210. /package/dist/{esm/types/types → types}/menu.d.ts +0 -0
  211. /package/dist/{esm/types/types → types}/popover.d.ts +0 -0
  212. /package/dist/{esm/types/types → types}/radio.d.ts +0 -0
  213. /package/dist/{esm/types/types → types}/result.d.ts +0 -0
  214. /package/dist/{esm/types/types → types}/select.d.ts +0 -0
  215. /package/dist/{esm/types/types → types}/skeleton.d.ts +0 -0
  216. /package/dist/{esm/types/types → types}/switch.d.ts +0 -0
  217. /package/dist/{esm/types/types → types}/upload.d.ts +0 -0
  218. /package/dist/{esm/types/utils → utils}/index.d.ts +0 -0
  219. /package/dist/{esm/types/utils → utils}/lazy.d.ts +0 -0
@@ -1,42 +0,0 @@
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;
@@ -1 +0,0 @@
1
- export { default as RadioButton } from '../../Radio/Button/Button'
@@ -1,43 +0,0 @@
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
- }
@@ -1,105 +0,0 @@
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;
@@ -1 +0,0 @@
1
- export { default as RadioGroup } from '../../Radio/Group/Group'
@@ -1,53 +0,0 @@
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
- }
@@ -1,83 +0,0 @@
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;
@@ -1 +0,0 @@
1
- export { default as Radio } from '../Radio/Radio'
@@ -1,73 +0,0 @@
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
- }
@@ -1,39 +0,0 @@
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;
@@ -1 +0,0 @@
1
- export { default as Result } from '../Result/Result';
@@ -1,173 +0,0 @@
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
- }
@@ -1,49 +0,0 @@
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;
@@ -1 +0,0 @@
1
- export { default as Option } from '../../Select/Option/Option'