@rainbow-oh/yee-c 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/Button/button.js +2 -2
- package/dist/cjs/Button/style/index.less +23 -8
- package/dist/cjs/Card/demo/collapsible.js +2 -1
- package/dist/cjs/Carousel/demo/arrows.js +1 -1
- package/dist/cjs/Carousel/demo/autoplay.js +1 -1
- package/dist/cjs/Carousel/demo/effect.js +1 -1
- package/dist/cjs/Carousel/demo/position.js +1 -1
- package/dist/cjs/Config-Provider/interface.d.ts +4 -0
- package/dist/cjs/Form/Field.js +32 -10
- package/dist/cjs/Form/interface.d.ts +17 -1
- package/dist/cjs/Menu/style/index.less +2 -2
- package/dist/cjs/Radio/demo/button.js +1 -0
- package/dist/cjs/Radio/interface.d.ts +4 -0
- package/dist/cjs/Radio/radio-group.js +28 -14
- package/dist/cjs/Radio/radio.js +3 -1
- package/dist/cjs/Radio/style/index.less +19 -5
- package/dist/cjs/Segmented/demo/basic.d.ts +3 -0
- package/dist/cjs/Segmented/demo/basic.js +51 -0
- package/dist/cjs/Segmented/demo/block.d.ts +3 -0
- package/dist/cjs/Segmented/demo/block.js +49 -0
- package/dist/cjs/Segmented/demo/disabled.d.ts +3 -0
- package/dist/cjs/Segmented/demo/disabled.js +47 -0
- package/dist/cjs/Segmented/demo/size.d.ts +3 -0
- package/dist/cjs/Segmented/demo/size.js +37 -0
- package/dist/cjs/Segmented/index.d.ts +3 -0
- package/dist/cjs/Segmented/index.js +36 -0
- package/dist/cjs/Segmented/interface.d.ts +82 -0
- package/dist/cjs/Segmented/interface.js +17 -0
- package/dist/cjs/Segmented/segmented.d.ts +5 -0
- package/dist/cjs/Segmented/segmented.js +177 -0
- package/dist/cjs/Segmented/style/index.less +104 -0
- package/dist/cjs/Spin/spin.js +2 -1
- package/dist/cjs/Steps/step.js +1 -1
- package/dist/cjs/Steps/style/index.less +8 -2
- package/dist/cjs/Switch/demo/content.js +22 -1
- package/dist/cjs/Switch/style/index.less +16 -0
- package/dist/cjs/Switch/switch.js +9 -2
- package/dist/cjs/Table/interface.d.ts +5 -1
- package/dist/cjs/Table/theader/cell.js +4 -5
- package/dist/cjs/Tag/demo/size.js +1 -1
- package/dist/cjs/Tag/style/index.less +1 -0
- package/dist/cjs/Tour/demo/basic.d.ts +3 -0
- package/dist/cjs/Tour/demo/basic.js +69 -0
- package/dist/cjs/Tour/demo/indicators.d.ts +3 -0
- package/dist/cjs/Tour/demo/indicators.js +76 -0
- package/dist/cjs/Tour/demo/placement.d.ts +3 -0
- package/dist/cjs/Tour/demo/placement.js +80 -0
- package/dist/cjs/Tour/demo/scroll.d.ts +3 -0
- package/dist/cjs/Tour/demo/scroll.js +72 -0
- package/dist/cjs/Tour/index.d.ts +3 -0
- package/dist/cjs/Tour/index.js +36 -0
- package/dist/cjs/Tour/interface.d.ts +118 -0
- package/dist/cjs/Tour/interface.js +17 -0
- package/dist/cjs/Tour/style/index.less +103 -0
- package/dist/cjs/Tour/tour.d.ts +5 -0
- package/dist/cjs/Tour/tour.js +403 -0
- package/dist/cjs/Tree/demo/checkable.js +6 -6
- package/dist/cjs/index.d.ts +4 -0
- package/dist/cjs/index.js +6 -0
- package/dist/cjs/locale/interface.d.ts +7 -0
- package/dist/cjs/locale/lang/en_US.js +6 -0
- package/dist/cjs/locale/lang/ja_JP.js +6 -0
- package/dist/cjs/locale/lang/zh_CN.js +6 -0
- package/dist/cjs/locale/lang/zh_TW.js +6 -0
- package/dist/cjs/style/color.blue.css +1 -1
- package/dist/cjs/style/color.crimson.css +1 -1
- package/dist/cjs/style/color.css +18 -1
- package/dist/cjs/style/size.css +38 -0
- package/dist/cjs/style/themes.css +3 -3
- package/dist/cjs/style/variables.css +57 -2
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/Button/button.js +2 -2
- package/dist/esm/Button/style/index.less +23 -8
- package/dist/esm/Card/demo/collapsible.js +2 -1
- package/dist/esm/Carousel/demo/arrows.js +1 -1
- package/dist/esm/Carousel/demo/autoplay.js +1 -1
- package/dist/esm/Carousel/demo/effect.js +1 -1
- package/dist/esm/Carousel/demo/position.js +1 -1
- package/dist/esm/Config-Provider/interface.d.ts +4 -0
- package/dist/esm/Form/Field.js +11 -4
- package/dist/esm/Form/interface.d.ts +17 -1
- package/dist/esm/Menu/style/index.less +2 -2
- package/dist/esm/Radio/demo/button.js +1 -0
- package/dist/esm/Radio/interface.d.ts +4 -0
- package/dist/esm/Radio/radio-group.js +9 -2
- package/dist/esm/Radio/radio.js +3 -1
- package/dist/esm/Radio/style/index.less +19 -5
- package/dist/esm/Segmented/demo/basic.d.ts +3 -0
- package/dist/esm/Segmented/demo/basic.js +33 -0
- package/dist/esm/Segmented/demo/block.d.ts +3 -0
- package/dist/esm/Segmented/demo/block.js +29 -0
- package/dist/esm/Segmented/demo/disabled.d.ts +3 -0
- package/dist/esm/Segmented/demo/disabled.js +22 -0
- package/dist/esm/Segmented/demo/size.d.ts +3 -0
- package/dist/esm/Segmented/demo/size.js +15 -0
- package/dist/esm/Segmented/index.d.ts +3 -0
- package/dist/esm/Segmented/index.js +2 -0
- package/dist/esm/Segmented/interface.d.ts +82 -0
- package/dist/esm/Segmented/interface.js +1 -0
- package/dist/esm/Segmented/segmented.d.ts +5 -0
- package/dist/esm/Segmented/segmented.js +110 -0
- package/dist/esm/Segmented/style/index.less +104 -0
- package/dist/esm/Spin/spin.js +2 -1
- package/dist/esm/Steps/step.js +4 -1
- package/dist/esm/Steps/style/index.less +8 -2
- package/dist/esm/Switch/demo/content.js +12 -3
- package/dist/esm/Switch/style/index.less +16 -0
- package/dist/esm/Switch/switch.js +7 -5
- package/dist/esm/Table/interface.d.ts +5 -1
- package/dist/esm/Table/theader/cell.js +2 -3
- package/dist/esm/Tag/demo/size.js +6 -2
- package/dist/esm/Tag/style/index.less +1 -0
- package/dist/esm/Tour/demo/basic.d.ts +3 -0
- package/dist/esm/Tour/demo/basic.js +69 -0
- package/dist/esm/Tour/demo/indicators.d.ts +3 -0
- package/dist/esm/Tour/demo/indicators.js +73 -0
- package/dist/esm/Tour/demo/placement.d.ts +3 -0
- package/dist/esm/Tour/demo/placement.js +53 -0
- package/dist/esm/Tour/demo/scroll.d.ts +3 -0
- package/dist/esm/Tour/demo/scroll.js +58 -0
- package/dist/esm/Tour/index.d.ts +3 -0
- package/dist/esm/Tour/index.js +2 -0
- package/dist/esm/Tour/interface.d.ts +118 -0
- package/dist/esm/Tour/interface.js +1 -0
- package/dist/esm/Tour/style/index.less +103 -0
- package/dist/esm/Tour/tour.d.ts +5 -0
- package/dist/esm/Tour/tour.js +383 -0
- package/dist/esm/Tree/demo/checkable.js +6 -6
- package/dist/esm/index.d.ts +4 -0
- package/dist/esm/index.js +4 -0
- package/dist/esm/locale/interface.d.ts +7 -0
- package/dist/esm/locale/lang/en_US.js +6 -0
- package/dist/esm/locale/lang/ja_JP.js +6 -0
- package/dist/esm/locale/lang/zh_CN.js +6 -0
- package/dist/esm/locale/lang/zh_TW.js +6 -0
- package/dist/esm/style/color.blue.css +1 -1
- package/dist/esm/style/color.crimson.css +1 -1
- package/dist/esm/style/color.css +18 -1
- package/dist/esm/style/size.css +38 -0
- package/dist/esm/style/themes.css +3 -3
- package/dist/esm/style/variables.css +57 -2
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/umd/yee-c.min.css +3 -3
- package/dist/umd/yee-c.min.js +1 -1
- package/package.json +1 -1
- package/src/Button/button.tsx +2 -2
- package/src/Button/style/index.less +23 -8
- package/src/Card/demo/collapsible.tsx +1 -0
- package/src/Carousel/demo/arrows.tsx +1 -1
- package/src/Carousel/demo/autoplay.tsx +1 -1
- package/src/Carousel/demo/effect.tsx +1 -1
- package/src/Carousel/demo/position.tsx +1 -1
- package/src/Config-Provider/index.en-US.md +2 -0
- package/src/Config-Provider/index.zh-CN.md +2 -0
- package/src/Config-Provider/interface.ts +4 -0
- package/src/Form/Field.tsx +30 -11
- package/src/Form/index.en-US.md +4 -0
- package/src/Form/index.zh-CN.md +4 -0
- package/src/Form/interface.ts +17 -1
- package/src/Menu/style/index.less +2 -2
- package/src/Radio/demo/button.tsx +1 -0
- package/src/Radio/index.en-US.md +2 -0
- package/src/Radio/index.zh-CN.md +2 -0
- package/src/Radio/interface.ts +4 -0
- package/src/Radio/radio-group.tsx +9 -1
- package/src/Radio/radio.tsx +2 -1
- package/src/Radio/style/index.less +19 -5
- package/src/Segmented/demo/basic.tsx +24 -0
- package/src/Segmented/demo/block.tsx +17 -0
- package/src/Segmented/demo/disabled.tsx +18 -0
- package/src/Segmented/demo/size.tsx +10 -0
- package/src/Segmented/index.en-US.md +47 -0
- package/src/Segmented/index.ts +12 -0
- package/src/Segmented/index.zh-CN.md +47 -0
- package/src/Segmented/interface.ts +87 -0
- package/src/Segmented/segmented.tsx +134 -0
- package/src/Segmented/style/index.less +104 -0
- package/src/Spin/spin.tsx +1 -0
- package/src/Steps/step.tsx +1 -1
- package/src/Steps/style/index.less +8 -2
- package/src/Switch/demo/content.tsx +15 -5
- package/src/Switch/style/index.less +16 -0
- package/src/Switch/switch.tsx +14 -6
- package/src/Table/index.en-US.md +1 -0
- package/src/Table/index.zh-CN.md +1 -0
- package/src/Table/interface.ts +5 -1
- package/src/Table/theader/cell.tsx +2 -9
- package/src/Tag/demo/size.tsx +2 -2
- package/src/Tag/style/index.less +1 -0
- package/src/Tour/demo/basic.tsx +52 -0
- package/src/Tour/demo/indicators.tsx +63 -0
- package/src/Tour/demo/placement.tsx +55 -0
- package/src/Tour/demo/scroll.tsx +49 -0
- package/src/Tour/index.en-US.md +61 -0
- package/src/Tour/index.ts +10 -0
- package/src/Tour/index.zh-CN.md +61 -0
- package/src/Tour/interface.ts +126 -0
- package/src/Tour/style/index.less +103 -0
- package/src/Tour/tour.tsx +399 -0
- package/src/Tree/demo/checkable.tsx +6 -6
- package/src/index.ts +6 -0
- package/src/locale/interface.ts +9 -0
- package/src/locale/lang/en_US.ts +7 -0
- package/src/locale/lang/ja_JP.ts +7 -0
- package/src/locale/lang/zh_CN.ts +7 -0
- package/src/locale/lang/zh_TW.ts +7 -0
- package/src/style/color.blue.css +1 -1
- package/src/style/color.crimson.css +1 -1
- package/src/style/color.css +18 -1
- package/src/style/size.css +38 -0
- package/src/version.ts +1 -1
- package/dist/cjs/utils/x.d.ts +0 -11
- package/dist/cjs/utils/x.js +0 -51
- package/dist/esm/utils/x.d.ts +0 -11
- package/dist/esm/utils/x.js +0 -49
- package/src/utils/x.ts +0 -33
package/package.json
CHANGED
package/src/Button/button.tsx
CHANGED
|
@@ -42,7 +42,7 @@ const Button = forwardRef<HTMLButtonElement | HTMLAnchorElement, ButtonProps>(
|
|
|
42
42
|
if (type) {
|
|
43
43
|
switch (type) {
|
|
44
44
|
case 'default':
|
|
45
|
-
mergedColor = '
|
|
45
|
+
mergedColor = 'default';
|
|
46
46
|
mergedVariant = 'outlined';
|
|
47
47
|
break;
|
|
48
48
|
case 'primary':
|
|
@@ -50,7 +50,7 @@ const Button = forwardRef<HTMLButtonElement | HTMLAnchorElement, ButtonProps>(
|
|
|
50
50
|
mergedVariant = 'solid';
|
|
51
51
|
break;
|
|
52
52
|
case 'dashed':
|
|
53
|
-
mergedColor = '
|
|
53
|
+
mergedColor = 'default';
|
|
54
54
|
mergedVariant = 'dashed';
|
|
55
55
|
break;
|
|
56
56
|
case 'link':
|
|
@@ -41,18 +41,18 @@
|
|
|
41
41
|
border: none;
|
|
42
42
|
|
|
43
43
|
&:not(@{pls}-disabled):hover {
|
|
44
|
-
background-color: var(--m-btn-hover-color);
|
|
44
|
+
background-color: var(--m-btn-hover-bg-color);
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
&:not(@{pls}-disabled):active {
|
|
48
|
-
background-color: var(--m-btn-active-color);
|
|
48
|
+
background-color: var(--m-btn-active-bg-color);
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
&-dashed {
|
|
53
53
|
color: var(--m-btn-color);
|
|
54
54
|
background-color: transparent;
|
|
55
|
-
border: var(--yee-btn-border-width) dashed var(--m-btn-color);
|
|
55
|
+
border: var(--yee-btn-border-width) dashed var(--m-btn-border-color);
|
|
56
56
|
|
|
57
57
|
&:not(@{pls}-disabled):hover {
|
|
58
58
|
color: var(--m-btn-hover-color);
|
|
@@ -84,7 +84,19 @@
|
|
|
84
84
|
&-outlined {
|
|
85
85
|
color: var(--m-btn-color);
|
|
86
86
|
background-color: transparent;
|
|
87
|
-
border: var(--yee-btn-border-width) solid var(--m-btn-color);
|
|
87
|
+
border: var(--yee-btn-border-width) solid var(--m-btn-border-color);
|
|
88
|
+
|
|
89
|
+
&:not(@{pls}-disabled) {
|
|
90
|
+
&:hover {
|
|
91
|
+
color: var(--m-btn-hover-color);
|
|
92
|
+
border-color: var(--m-btn-border-hover-color);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
&:active {
|
|
96
|
+
color: var(--m-btn-active-color);
|
|
97
|
+
border-color: var(--m-btn-border-active-color);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
88
100
|
}
|
|
89
101
|
|
|
90
102
|
&-ghost {
|
|
@@ -134,11 +146,14 @@
|
|
|
134
146
|
// ---- color ------
|
|
135
147
|
&-default {
|
|
136
148
|
--m-btn-color: var(--yee-text-color);
|
|
137
|
-
--m-btn-hover-color: var(--yee-
|
|
138
|
-
--m-btn-
|
|
149
|
+
--m-btn-hover-color: var(--yee-primary-color);
|
|
150
|
+
--m-btn-border-color: var(--yee-border-color);
|
|
151
|
+
--m-btn-border-hover-color: var(--yee-primary-color);
|
|
139
152
|
--m-btn-bg-color: var(--yee-btn-default-bg-color);
|
|
140
|
-
--m-btn-hover-bg-color: var(--yee-
|
|
141
|
-
--m-btn-active-
|
|
153
|
+
--m-btn-hover-bg-color: var(--yee-text-color-auxiliary);
|
|
154
|
+
--m-btn-border-active-color: var(--yee-primary-color-active);
|
|
155
|
+
--m-btn-active-color: var(--yee-primary-color-active);
|
|
156
|
+
--m-btn-active-bg-color: var(--yee-text-color-auxiliary);
|
|
142
157
|
}
|
|
143
158
|
|
|
144
159
|
&-primary {
|
|
@@ -72,6 +72,7 @@ GlobalCtxType contains configuration for all components. Here are some examples:
|
|
|
72
72
|
| rate | [RateProps](/components/rate) | Rate component configuration |
|
|
73
73
|
| search | [SearchProps](/components/search) | Search component configuration |
|
|
74
74
|
| select | [SelectProps](/components/select) | Select component configuration |
|
|
75
|
+
| segmented | [SegmentedProps](/components/segmented) | Segmented component configuration |
|
|
75
76
|
| skeleton | [SkeletonProps](/components/skeleton) | Skeleton component configuration |
|
|
76
77
|
| slider | [SliderProps](/components/slider) | Slider component configuration |
|
|
77
78
|
| space | [SpaceProps](/components/space) | Space component configuration |
|
|
@@ -88,6 +89,7 @@ GlobalCtxType contains configuration for all components. Here are some examples:
|
|
|
88
89
|
| timeline | [TimelineProps](/components/timeline) | Timeline component configuration |
|
|
89
90
|
| highlight | [HighlightProps](/components/highlight) | Highlight component configuration |
|
|
90
91
|
| tooltip | [TooltipProps](/components/tooltip) | Tooltip component configuration |
|
|
92
|
+
| tour | [TourProps](/components/tour) | Tour component configuration |
|
|
91
93
|
| tree | [TreeProps](/components/tree) | Tree component configuration |
|
|
92
94
|
| treeselect | [TreeSelectProps](/components/tree-select) | TreeSelect component configuration |
|
|
93
95
|
| trigger | [TriggerProps](/components/trigger) | Trigger component configuration |
|
|
@@ -72,6 +72,7 @@ GlobalCtxType 包含所有组件的配置。以下是一些示例:
|
|
|
72
72
|
| rate | [RateProps](/components/rate) | Rate 组件配置 |
|
|
73
73
|
| search | [SearchProps](/components/search) | Search 组件配置 |
|
|
74
74
|
| select | [SelectProps](/components/select) | Select 组件配置 |
|
|
75
|
+
| segmented | [SegmentedProps](/components/segmented) | Segmented 组件配置 |
|
|
75
76
|
| skeleton | [SkeletonProps](/components/skeleton) | Skeleton 组件配置 |
|
|
76
77
|
| slider | [SliderProps](/components/slider) | Slider 组件配置 |
|
|
77
78
|
| space | [SpaceProps](/components/space) | Space 组件配置 |
|
|
@@ -88,6 +89,7 @@ GlobalCtxType 包含所有组件的配置。以下是一些示例:
|
|
|
88
89
|
| timeline | [TimelineProps](/components/timeline) | Timeline 组件配置 |
|
|
89
90
|
| highlight | [HighlightProps](/components/highlight) | Highlight 组件配置 |
|
|
90
91
|
| tooltip | [TooltipProps](/components/tooltip) | Tooltip 组件配置 |
|
|
92
|
+
| tour | [TourProps](/components/tour) | Tour 组件配置 |
|
|
91
93
|
| tree | [TreeProps](/components/tree) | Tree 组件配置 |
|
|
92
94
|
| treeselect | [TreeSelectProps](/components/tree-select) | TreeSelect 组件配置 |
|
|
93
95
|
| trigger | [TriggerProps](/components/trigger) | Trigger 组件配置 |
|
|
@@ -40,6 +40,7 @@ import { RadioGroupProps, RadioProps } from '../Radio';
|
|
|
40
40
|
import { RangePickerProps } from '../RangePicker';
|
|
41
41
|
import { RateProps } from '../Rate';
|
|
42
42
|
import { SearchProps } from '../Search';
|
|
43
|
+
import { SegmentedProps } from '../Segmented';
|
|
43
44
|
import { SelectProps } from '../Select';
|
|
44
45
|
import { SkeletonProps } from '../Skeleton';
|
|
45
46
|
import { SliderProps } from '../Slider';
|
|
@@ -56,6 +57,7 @@ import { TextAreaProps } from '../TextArea';
|
|
|
56
57
|
import { SpinProps } from '../Spin';
|
|
57
58
|
import { TimelineProps } from '../Timeline';
|
|
58
59
|
import { TooltipProps } from '../Tooltip';
|
|
60
|
+
import { TourProps } from '../Tour';
|
|
59
61
|
import { TransferProps } from '../Transfer';
|
|
60
62
|
import { TreeProps } from '../Tree';
|
|
61
63
|
import { TreeSelectProps } from '../TreeSelect';
|
|
@@ -112,6 +114,7 @@ export type GlobalCtxType = {
|
|
|
112
114
|
rate?: RateProps;
|
|
113
115
|
search?: SearchProps;
|
|
114
116
|
select?: SelectProps;
|
|
117
|
+
segmented?: SegmentedProps;
|
|
115
118
|
skeleton?: SkeletonProps;
|
|
116
119
|
slider?: SliderProps;
|
|
117
120
|
space?: SpaceProps;
|
|
@@ -129,6 +132,7 @@ export type GlobalCtxType = {
|
|
|
129
132
|
highlight?: HighlightProps;
|
|
130
133
|
// timepicker?: TimePickerProps;
|
|
131
134
|
tooltip?: TooltipProps;
|
|
135
|
+
tour?: TourProps;
|
|
132
136
|
transfer?: TransferProps;
|
|
133
137
|
tree?: TreeProps<unknown>;
|
|
134
138
|
treeselect?: TreeSelectProps;
|
package/src/Form/Field.tsx
CHANGED
|
@@ -27,6 +27,10 @@ function stringifyPath(path: InternalNamePath): string {
|
|
|
27
27
|
|
|
28
28
|
const Field: React.FC<FieldProps> = (props) => {
|
|
29
29
|
const {
|
|
30
|
+
style,
|
|
31
|
+
className,
|
|
32
|
+
styles,
|
|
33
|
+
classNames,
|
|
30
34
|
children,
|
|
31
35
|
name,
|
|
32
36
|
rules,
|
|
@@ -89,10 +93,10 @@ const Field: React.FC<FieldProps> = (props) => {
|
|
|
89
93
|
// Normalize tooltip into { icon, ...tooltipProps }, or null when not provided.
|
|
90
94
|
// Everything except `icon` is forwarded to <Tooltip>, so any Tooltip prop
|
|
91
95
|
// (title, color, placement, ...) is supported automatically.
|
|
92
|
-
const tooltipConfig = useMemo<
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
>(() => {
|
|
96
|
+
const tooltipConfig = useMemo<{
|
|
97
|
+
icon: React.ReactNode;
|
|
98
|
+
tooltipProps: Omit<FieldConfigurableTooltip, 'icon'>;
|
|
99
|
+
} | null>(() => {
|
|
96
100
|
if (tooltip === undefined || tooltip === null || tooltip === false)
|
|
97
101
|
return null;
|
|
98
102
|
if (
|
|
@@ -145,17 +149,29 @@ const Field: React.FC<FieldProps> = (props) => {
|
|
|
145
149
|
};
|
|
146
150
|
return (
|
|
147
151
|
<div
|
|
148
|
-
className={clsx(
|
|
149
|
-
|
|
150
|
-
|
|
152
|
+
className={clsx(
|
|
153
|
+
`${prefixCls}-item`,
|
|
154
|
+
`${prefixCls}-item-${layout}`,
|
|
155
|
+
{
|
|
156
|
+
[`${prefixCls}-item-${validate?.status}`]:
|
|
157
|
+
validate && validate.status,
|
|
158
|
+
},
|
|
159
|
+
className,
|
|
160
|
+
)}
|
|
161
|
+
style={style}
|
|
151
162
|
>
|
|
152
163
|
<div className={clsx(`${prefixCls}-item-row`)}>
|
|
153
164
|
{label || tooltipConfig ? (
|
|
154
165
|
<label
|
|
155
166
|
htmlFor={normalizedName}
|
|
156
|
-
className={clsx(
|
|
157
|
-
|
|
158
|
-
|
|
167
|
+
className={clsx(
|
|
168
|
+
`${prefixCls}-item-label`,
|
|
169
|
+
{
|
|
170
|
+
[`${prefixCls}-item-required`]: isRequired(),
|
|
171
|
+
},
|
|
172
|
+
classNames?.label,
|
|
173
|
+
)}
|
|
174
|
+
style={styles?.label}
|
|
159
175
|
>
|
|
160
176
|
{label}
|
|
161
177
|
{isRequired() ? (
|
|
@@ -170,7 +186,10 @@ const Field: React.FC<FieldProps> = (props) => {
|
|
|
170
186
|
) : null}
|
|
171
187
|
</label>
|
|
172
188
|
) : null}
|
|
173
|
-
<div
|
|
189
|
+
<div
|
|
190
|
+
className={clsx(`${prefixCls}-item-control`, classNames?.control)}
|
|
191
|
+
style={styles?.control}
|
|
192
|
+
>
|
|
174
193
|
{React.isValidElement(children) ? (
|
|
175
194
|
React.cloneElement(
|
|
176
195
|
children as React.ReactElement,
|
package/src/Form/index.en-US.md
CHANGED
|
@@ -89,6 +89,10 @@ High performance form component with data scope management.
|
|
|
89
89
|
|
|
90
90
|
| Property | Type | Description | Default |
|
|
91
91
|
| -------- | --------------------- | ---------------- | ------- |
|
|
92
|
+
| className | `string` | Custom field root class name | - |
|
|
93
|
+
| style | `React.CSSProperties` | Custom field root style | - |
|
|
94
|
+
| classNames | `Partial<Record<'label' \| 'control', string>>` | Semantic structure class names | - |
|
|
95
|
+
| styles | `Partial<Record<'label' \| 'control', React.CSSProperties>>` | Semantic structure styles | - |
|
|
92
96
|
| children | `React.ReactElement` | Child element | - |
|
|
93
97
|
| name | `NamePath` | Field name | - |
|
|
94
98
|
| rules | [Rule\[\]](#rule) | Validation rules | - |
|
package/src/Form/index.zh-CN.md
CHANGED
|
@@ -88,6 +88,10 @@ toc: 'content'
|
|
|
88
88
|
|
|
89
89
|
| 属性名 | 类型 | 描述 | 默认值 |
|
|
90
90
|
| ------------- | -------------------- | -------------------- | --------- |
|
|
91
|
+
| className | `string` | 自定义字段根类名 | - |
|
|
92
|
+
| style | `React.CSSProperties` | 自定义字段根样式 | - |
|
|
93
|
+
| classNames | `Partial<Record<'label' \| 'control', string>>` | 语义化结构类名 | - |
|
|
94
|
+
| styles | `Partial<Record<'label' \| 'control', React.CSSProperties>>` | 语义化结构样式 | - |
|
|
91
95
|
| children | `React.ReactElement` | 子元素 | - |
|
|
92
96
|
| name | `NamePath` | 字段名 | - |
|
|
93
97
|
| rules | [Rule\[\]](#rule) | 校验规则 | - |
|
package/src/Form/interface.ts
CHANGED
|
@@ -6,7 +6,7 @@ export type Store = Record<string, StoreValue>;
|
|
|
6
6
|
export type Name = string;
|
|
7
7
|
export type NamePath = string | string[] | number | (string | number)[];
|
|
8
8
|
|
|
9
|
-
export type
|
|
9
|
+
export type FieldSemanticDOM = 'label' | 'control';
|
|
10
10
|
|
|
11
11
|
// Internal name path type, always a string array
|
|
12
12
|
export type InternalNamePath = (string | number)[];
|
|
@@ -264,6 +264,22 @@ export type FieldConfigurableTooltip = Omit<TooltipProps, 'children'> & {
|
|
|
264
264
|
export type FieldTooltip = React.ReactNode | FieldConfigurableTooltip;
|
|
265
265
|
|
|
266
266
|
export type FieldProps = {
|
|
267
|
+
/**
|
|
268
|
+
* custom field root className
|
|
269
|
+
* */
|
|
270
|
+
className?: string;
|
|
271
|
+
/**
|
|
272
|
+
* custom field root style
|
|
273
|
+
* */
|
|
274
|
+
style?: React.CSSProperties;
|
|
275
|
+
/**
|
|
276
|
+
* Semantic DOM className
|
|
277
|
+
* */
|
|
278
|
+
classNames?: Partial<Record<FieldSemanticDOM, string>>;
|
|
279
|
+
/**
|
|
280
|
+
* Semantic DOM style
|
|
281
|
+
* */
|
|
282
|
+
styles?: Partial<Record<FieldSemanticDOM, React.CSSProperties>>;
|
|
267
283
|
/**
|
|
268
284
|
* Child nodes
|
|
269
285
|
* */
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
list-style: none;
|
|
83
83
|
|
|
84
84
|
&-title {
|
|
85
|
-
padding: var(--yee-menu-item-group-title-padding,
|
|
85
|
+
padding: var(--yee-menu-item-group-title-padding, 4px 12px);
|
|
86
86
|
color: var(
|
|
87
87
|
--yee-menu-item-group-title-color,
|
|
88
88
|
var(--yee-color-text-secondary)
|
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
margin: var(--yee-menu-item-divider-margin, 4px 0);
|
|
107
107
|
border-top: var(
|
|
108
108
|
--yee-menu-item-divider-border,
|
|
109
|
-
1px solid var(--yee-color
|
|
109
|
+
1px solid var(--yee-border-color)
|
|
110
110
|
);
|
|
111
111
|
}
|
|
112
112
|
|
package/src/Radio/index.en-US.md
CHANGED
|
@@ -54,4 +54,6 @@ Radio button for selecting one option from a set of options.
|
|
|
54
54
|
| disabled | `boolean` | Disable all options | - |
|
|
55
55
|
| buttonStyle | `'outline' \| 'solid' \| 'cornermark'` | Button style | - |
|
|
56
56
|
| options | `Array<RadioProps & { label: React.ReactNode }>` | Options in configuration form | - |
|
|
57
|
+
| toggleable | `boolean` | Whether selection can be toggled (click again to deselect) | - |
|
|
58
|
+
| gap | `number` | Set the interval between radios | - |
|
|
57
59
|
| onChange | `(value: string, event: React.ChangeEvent<HTMLInputElement>) => void` | Callback when value changes | - |
|
package/src/Radio/index.zh-CN.md
CHANGED
|
@@ -54,4 +54,6 @@ toc: 'content'
|
|
|
54
54
|
| disabled | `boolean` | 是否禁用所有选项 | - |
|
|
55
55
|
| buttonStyle | `'outline' \| 'solid' \| 'cornermark'` | 按钮风格 | - |
|
|
56
56
|
| options | `Array<RadioProps & { label: React.ReactNode }>` | 选项,以配置形式 | - |
|
|
57
|
+
| toggleable | `boolean` | 是否允许切换选中状态(再次点击取消选中) | - |
|
|
58
|
+
| gap | `number` | 设置单选框之间的间距 | - |
|
|
57
59
|
| onChange | `(value: string, event: React.ChangeEvent<HTMLInputElement>) => void` | 值改变时的回调 | - |
|
package/src/Radio/interface.ts
CHANGED
|
@@ -22,6 +22,7 @@ const RadioGroup = React.forwardRef<HTMLDivElement, RadioGroupProps>(
|
|
|
22
22
|
const {
|
|
23
23
|
prefixCls = 'yee-radio-group',
|
|
24
24
|
className,
|
|
25
|
+
style,
|
|
25
26
|
name = uid,
|
|
26
27
|
value,
|
|
27
28
|
defaultValue,
|
|
@@ -29,6 +30,7 @@ const RadioGroup = React.forwardRef<HTMLDivElement, RadioGroupProps>(
|
|
|
29
30
|
buttonStyle,
|
|
30
31
|
disabled,
|
|
31
32
|
size,
|
|
33
|
+
gap,
|
|
32
34
|
onChange,
|
|
33
35
|
...rest
|
|
34
36
|
} = props;
|
|
@@ -43,6 +45,7 @@ const RadioGroup = React.forwardRef<HTMLDivElement, RadioGroupProps>(
|
|
|
43
45
|
{
|
|
44
46
|
[`${prefixCls}-${buttonStyle}`]: buttonStyle,
|
|
45
47
|
[`${prefixCls}-${size}`]: size,
|
|
48
|
+
[`${prefixCls}-with-gap`]: gap,
|
|
46
49
|
},
|
|
47
50
|
className,
|
|
48
51
|
);
|
|
@@ -53,7 +56,12 @@ const RadioGroup = React.forwardRef<HTMLDivElement, RadioGroupProps>(
|
|
|
53
56
|
};
|
|
54
57
|
|
|
55
58
|
return (
|
|
56
|
-
<div
|
|
59
|
+
<div
|
|
60
|
+
className={cls}
|
|
61
|
+
style={{ ...style, gap: gap }}
|
|
62
|
+
ref={ref}
|
|
63
|
+
role="radiogroup"
|
|
64
|
+
>
|
|
57
65
|
<GroupCtx.Provider
|
|
58
66
|
value={{ name, buttonStyle, onChange: handleChange }}
|
|
59
67
|
>
|
package/src/Radio/radio.tsx
CHANGED
|
@@ -16,6 +16,7 @@ const Radio = React.forwardRef<HTMLInputElement, RadioProps>(
|
|
|
16
16
|
prefixCls = 'yee-radio',
|
|
17
17
|
className,
|
|
18
18
|
classNames,
|
|
19
|
+
style,
|
|
19
20
|
styles,
|
|
20
21
|
label,
|
|
21
22
|
children,
|
|
@@ -66,7 +67,7 @@ const Radio = React.forwardRef<HTMLInputElement, RadioProps>(
|
|
|
66
67
|
);
|
|
67
68
|
|
|
68
69
|
return (
|
|
69
|
-
<label className={cls} onClick={handleClick}>
|
|
70
|
+
<label className={cls} style={style} onClick={handleClick}>
|
|
70
71
|
<span
|
|
71
72
|
className={clsx(prefixCls, {
|
|
72
73
|
[`${prefixCls}-disabled`]: disabled,
|
|
@@ -9,9 +9,17 @@
|
|
|
9
9
|
gap: var(--yee-radio-group-gap);
|
|
10
10
|
|
|
11
11
|
&-small {
|
|
12
|
+
@{pls}-button-wrapper {
|
|
13
|
+
font-size: var(--yee-radio-font-small-size);
|
|
14
|
+
padding: var(--yee-radio-small-padding);
|
|
15
|
+
}
|
|
12
16
|
}
|
|
13
17
|
|
|
14
18
|
&-large {
|
|
19
|
+
@{pls}-button-wrapper {
|
|
20
|
+
font-size: var(--yee-radio-font-large-size);
|
|
21
|
+
padding: var(--yee-radio-large-padding);
|
|
22
|
+
}
|
|
15
23
|
}
|
|
16
24
|
|
|
17
25
|
&-solid {
|
|
@@ -55,7 +63,7 @@
|
|
|
55
63
|
bottom: 0;
|
|
56
64
|
border-color: transparent;
|
|
57
65
|
border-style: solid;
|
|
58
|
-
border-width: var(--yee-radio-cornermark-border-width);
|
|
66
|
+
border-width: calc(var(--yee-radio-cornermark-border-width) / 3 * 2);
|
|
59
67
|
border-right-color: var(--yee-radio-inner-checked-border-color);
|
|
60
68
|
border-bottom-color: var(--yee-radio-inner-checked-border-color);
|
|
61
69
|
content: '';
|
|
@@ -64,10 +72,10 @@
|
|
|
64
72
|
&::before {
|
|
65
73
|
position: absolute;
|
|
66
74
|
z-index: 1;
|
|
67
|
-
right:
|
|
68
|
-
top:
|
|
69
|
-
width:
|
|
70
|
-
height:
|
|
75
|
+
right: 3px;
|
|
76
|
+
top: 18px;
|
|
77
|
+
width: 3px;
|
|
78
|
+
height: 7px;
|
|
71
79
|
border: 2px solid #fff;
|
|
72
80
|
border-width: 0 2px 2px 0;
|
|
73
81
|
transform: rotate(45deg);
|
|
@@ -81,6 +89,12 @@
|
|
|
81
89
|
margin-left: -1px;
|
|
82
90
|
}
|
|
83
91
|
}
|
|
92
|
+
|
|
93
|
+
&-with-gap {
|
|
94
|
+
@{pls}-button-wrapper {
|
|
95
|
+
border-radius: var(--yee-radio-button-wrapper-border-radius);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
84
98
|
}
|
|
85
99
|
|
|
86
100
|
&-wrapper {
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Segmented, Space } from '@rainbow-oh/yee-c';
|
|
2
|
+
import React, { useState } from 'react';
|
|
3
|
+
|
|
4
|
+
export default () => {
|
|
5
|
+
const [value, setValue] = useState<string | number>('daily');
|
|
6
|
+
|
|
7
|
+
return (
|
|
8
|
+
<Space direction="vertical">
|
|
9
|
+
<Segmented
|
|
10
|
+
options={[
|
|
11
|
+
{ label: 'Daily', value: 'daily' },
|
|
12
|
+
{ label: 'Weekly', value: 'weekly' },
|
|
13
|
+
{ label: 'Monthly', value: 'monthly' },
|
|
14
|
+
]}
|
|
15
|
+
value={value}
|
|
16
|
+
onChange={setValue}
|
|
17
|
+
/>
|
|
18
|
+
|
|
19
|
+
<Segmented options={['List', 'Table', 'Chart']} defaultValue="List" />
|
|
20
|
+
|
|
21
|
+
<div>Selected: {value}</div>
|
|
22
|
+
</Space>
|
|
23
|
+
);
|
|
24
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Segmented } from '@rainbow-oh/yee-c';
|
|
2
|
+
import { LayoutGrid, List } from 'lucide-react';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
|
|
5
|
+
export default () => (
|
|
6
|
+
<div style={{ width: 480 }}>
|
|
7
|
+
<Segmented
|
|
8
|
+
block
|
|
9
|
+
defaultValue="list"
|
|
10
|
+
options={[
|
|
11
|
+
{ label: 'List', value: 'list', icon: <List size={16} /> },
|
|
12
|
+
{ label: 'Grid', value: 'grid', icon: <LayoutGrid size={16} /> },
|
|
13
|
+
{ label: 'Detail', value: 'detail' },
|
|
14
|
+
]}
|
|
15
|
+
/>
|
|
16
|
+
</div>
|
|
17
|
+
);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Segmented } from '@rainbow-oh/yee-c';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
export default () => (
|
|
5
|
+
<>
|
|
6
|
+
<Segmented
|
|
7
|
+
options={[
|
|
8
|
+
{ label: 'A', value: 'a' },
|
|
9
|
+
{ label: 'B', value: 'b', disabled: true },
|
|
10
|
+
{ label: 'C', value: 'c' },
|
|
11
|
+
]}
|
|
12
|
+
defaultValue="a"
|
|
13
|
+
/>
|
|
14
|
+
<br />
|
|
15
|
+
<br />
|
|
16
|
+
<Segmented disabled options={['A', 'B', 'C']} defaultValue="A" />
|
|
17
|
+
</>
|
|
18
|
+
);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Segmented, Space } from '@rainbow-oh/yee-c';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
export default () => (
|
|
5
|
+
<Space direction="vertical">
|
|
6
|
+
<Segmented size="small" options={['Small', 'B', 'C']} />
|
|
7
|
+
<Segmented options={['Default', 'B', 'C']} />
|
|
8
|
+
<Segmented size="large" options={['Large', 'B', 'C']} />
|
|
9
|
+
</Space>
|
|
10
|
+
);
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
---
|
|
2
|
+
category: Components
|
|
3
|
+
title: Segmented
|
|
4
|
+
subtitle: Segmented
|
|
5
|
+
group:
|
|
6
|
+
title: Data Entry
|
|
7
|
+
order: 3
|
|
8
|
+
toc: 'content'
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Segmented
|
|
12
|
+
|
|
13
|
+
Displays a group of mutually exclusive options, with the selected item highlighted by a sliding thumb. Commonly used for view/mode switching.
|
|
14
|
+
|
|
15
|
+
## Code Demo
|
|
16
|
+
|
|
17
|
+
<code src="./demo/basic.tsx" title="Basic" description="Basic usage, supports controlled/uncontrolled, options accept config objects or primitive shorthand"></code>
|
|
18
|
+
<code src="./demo/disabled.tsx" title="Disabled" description="Disable a single option or the whole group"></code>
|
|
19
|
+
<code src="./demo/size.tsx" title="Size" description="small / default / large"></code>
|
|
20
|
+
<code src="./demo/block.tsx" title="Block & Icon" description="block fills the container width, options can carry icons"></code>
|
|
21
|
+
|
|
22
|
+
## API
|
|
23
|
+
|
|
24
|
+
### SegmentedProps
|
|
25
|
+
|
|
26
|
+
| Property | Type | Description | Default |
|
|
27
|
+
| --- | --- | --- | --- |
|
|
28
|
+
| prefixCls | `string` | Custom class name prefix | - |
|
|
29
|
+
| className | `string` | Custom root class name | - |
|
|
30
|
+
| style | `React.CSSProperties` | Custom root style | - |
|
|
31
|
+
| classNames | `Partial<Record<'item' \| 'thumb', string>>` | Semantic structure class names | - |
|
|
32
|
+
| styles | `Partial<Record<'item' \| 'thumb', React.CSSProperties>>` | Semantic structure styles | - |
|
|
33
|
+
| options | `Array<SegmentedOption>` | Options, supports config objects or `string \| number` shorthand | - |
|
|
34
|
+
| value | `string \| number` | Controlled selected value | - |
|
|
35
|
+
| defaultValue | `string \| number` | Default selected value | - |
|
|
36
|
+
| onChange | `(value: string \| number) => void` | Callback when selected value changes | - |
|
|
37
|
+
| disabled | `boolean` | Whether to disable all options | - |
|
|
38
|
+
| size | `'small' \| 'default' \| 'large'` | Size | - |
|
|
39
|
+
| block | `boolean` | Whether to fill the container width, options share the space equally | - |
|
|
40
|
+
| name | `string` | Name of the underlying radio input, for form grouping | - |
|
|
41
|
+
|
|
42
|
+
### SegmentedOption
|
|
43
|
+
|
|
44
|
+
| Type | Description |
|
|
45
|
+
| --- | --- |
|
|
46
|
+
| `SegmentedLabeledOption` | `{ label?: ReactNode; value: string \| number; disabled?: boolean; icon?: ReactNode; className?: string }` |
|
|
47
|
+
| `SegmentedRawOption` | `string \| number`, shorthand form, label is the value cast to string |
|