@douyinfe/semi-ui 2.9.1 → 2.10.0-alpha.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/badge/_story/badge.stories.js +2 -34
- package/checkbox/checkbox.tsx +18 -8
- package/dist/css/semi.css +0 -1
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +23030 -22978
- package/dist/umd/semi-ui.js.map +1 -1
- package/dist/umd/semi-ui.min.js +1 -1
- package/dist/umd/semi-ui.min.js.map +1 -1
- package/form/hoc/withField.tsx +5 -8
- package/lib/cjs/_portal/index.d.ts +1 -1
- package/lib/cjs/checkbox/checkbox.d.ts +4 -0
- package/lib/cjs/checkbox/checkbox.js +25 -13
- package/lib/cjs/datePicker/dateInput.d.ts +1 -1
- package/lib/cjs/datePicker/datePicker.d.ts +1 -1
- package/lib/cjs/datePicker/insetInput.d.ts +0 -1
- package/lib/cjs/datePicker/monthsGrid.d.ts +1 -1
- package/lib/cjs/dropdown/dropdownMenu.d.ts +0 -1
- package/lib/cjs/form/baseForm.d.ts +1 -1
- package/lib/cjs/form/field.d.ts +1 -1
- package/lib/cjs/form/hoc/withField.js +4 -6
- package/lib/cjs/modal/useModal/index.d.ts +0 -1
- package/lib/cjs/notification/useNotification/index.d.ts +0 -1
- package/lib/cjs/radio/radio.d.ts +5 -1
- package/lib/cjs/radio/radio.js +26 -12
- package/lib/cjs/radio/radioGroup.d.ts +1 -1
- package/lib/cjs/scrollList/scrollItem.js +1 -1
- package/lib/cjs/timePicker/Combobox.d.ts +0 -1
- package/lib/cjs/timePicker/TimePicker.d.ts +2 -2
- package/lib/cjs/timePicker/TimeShape.d.ts +1 -1
- package/lib/cjs/timePicker/index.d.ts +2 -2
- package/lib/cjs/toast/useToast/index.d.ts +0 -1
- package/lib/cjs/tooltip/index.d.ts +1 -0
- package/lib/cjs/tooltip/index.js +7 -2
- package/lib/cjs/typography/title.d.ts +1 -1
- package/lib/cjs/upload/index.d.ts +1 -1
- package/lib/es/_portal/index.d.ts +1 -1
- package/lib/es/checkbox/checkbox.d.ts +4 -0
- package/lib/es/checkbox/checkbox.js +25 -13
- package/lib/es/datePicker/dateInput.d.ts +1 -1
- package/lib/es/datePicker/datePicker.d.ts +1 -1
- package/lib/es/datePicker/insetInput.d.ts +0 -1
- package/lib/es/datePicker/monthsGrid.d.ts +1 -1
- package/lib/es/dropdown/dropdownMenu.d.ts +0 -1
- package/lib/es/form/baseForm.d.ts +1 -1
- package/lib/es/form/field.d.ts +1 -1
- package/lib/es/form/hoc/withField.js +4 -6
- package/lib/es/modal/useModal/index.d.ts +0 -1
- package/lib/es/notification/useNotification/index.d.ts +0 -1
- package/lib/es/radio/radio.d.ts +5 -1
- package/lib/es/radio/radio.js +26 -12
- package/lib/es/radio/radioGroup.d.ts +1 -1
- package/lib/es/scrollList/scrollItem.js +1 -1
- package/lib/es/timePicker/Combobox.d.ts +0 -1
- package/lib/es/timePicker/TimePicker.d.ts +2 -2
- package/lib/es/timePicker/TimeShape.d.ts +1 -1
- package/lib/es/timePicker/index.d.ts +2 -2
- package/lib/es/toast/useToast/index.d.ts +0 -1
- package/lib/es/tooltip/index.d.ts +1 -0
- package/lib/es/tooltip/index.js +7 -2
- package/lib/es/typography/title.d.ts +1 -1
- package/lib/es/upload/index.d.ts +1 -1
- package/package.json +9 -9
- package/radio/radio.tsx +17 -7
- package/scrollList/scrollItem.tsx +1 -1
- package/timePicker/TimePicker.tsx +1 -1
- package/timePicker/_story/timepicker.stories.js +1 -20
- package/tooltip/index.tsx +6 -2
|
@@ -17,7 +17,7 @@ export interface MonthsGridProps extends MonthsGridFoundationProps, BaseProps {
|
|
|
17
17
|
export declare type MonthsGridState = MonthsGridFoundationState;
|
|
18
18
|
export default class MonthsGrid extends BaseComponent<MonthsGridProps, MonthsGridState> {
|
|
19
19
|
static propTypes: {
|
|
20
|
-
type: PropTypes.Requireable<"
|
|
20
|
+
type: PropTypes.Requireable<"date" | "month" | "dateTime" | "dateRange" | "year" | "dateTimeRange">;
|
|
21
21
|
defaultValue: PropTypes.Requireable<string | number | object>;
|
|
22
22
|
defaultPickerValue: PropTypes.Requireable<string | number | object>;
|
|
23
23
|
multiple: PropTypes.Requireable<boolean>;
|
|
@@ -125,7 +125,7 @@ declare class Form extends BaseComponent<BaseFormProps, BaseFormState> {
|
|
|
125
125
|
onBlur?: (e: React.FocusEvent<Element, Element>) => void;
|
|
126
126
|
onListScroll?: (e: React.UIEvent<HTMLDivElement, UIEvent>) => void;
|
|
127
127
|
children?: React.ReactNode;
|
|
128
|
-
} & Pick<import("../tooltip").TooltipProps, "
|
|
128
|
+
} & Pick<import("../tooltip").TooltipProps, "getPopupContainer" | "stopPropagation" | "spacing" | "mouseEnterDelay" | "autoAdjustOverflow" | "mouseLeaveDelay" | "motion"> & React.RefAttributes<any> & import("./interface").CommonFieldProps, import("./interface").CommonexcludeType>> & import("./interface").SelectStatic;
|
|
129
129
|
static Checkbox: React.ComponentType<import("utility-types").Subtract<import("./interface").CommonFieldProps, import("./interface").RadioCheckboxExcludeProps> & import("../checkbox").CheckboxProps & import("./interface").RCIncludeType>;
|
|
130
130
|
static CheckboxGroup: React.ComponentType<import("utility-types").Subtract<import("../checkbox").CheckboxGroupProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
|
|
131
131
|
static Radio: React.ComponentType<import("utility-types").Subtract<import("./interface").CommonFieldProps, import("./interface").RadioCheckboxExcludeProps> & import("../radio").RadioProps & import("./interface").RCIncludeType>;
|
package/lib/es/form/field.d.ts
CHANGED
|
@@ -73,7 +73,7 @@ declare const FormSelect: import("react").ComponentType<import("utility-types").
|
|
|
73
73
|
onBlur?: (e: import("react").FocusEvent<Element, Element>) => void;
|
|
74
74
|
onListScroll?: (e: import("react").UIEvent<HTMLDivElement, UIEvent>) => void;
|
|
75
75
|
children?: import("react").ReactNode;
|
|
76
|
-
} & Pick<import("../tooltip").TooltipProps, "
|
|
76
|
+
} & Pick<import("../tooltip").TooltipProps, "getPopupContainer" | "stopPropagation" | "spacing" | "mouseEnterDelay" | "autoAdjustOverflow" | "mouseLeaveDelay" | "motion"> & import("react").RefAttributes<any> & import("./interface").CommonFieldProps, import("./interface").CommonexcludeType>> & import("./interface").SelectStatic;
|
|
77
77
|
declare const FormCheckboxGroup: import("react").ComponentType<import("utility-types").Subtract<import("../checkbox/checkboxGroup").CheckboxGroupProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
|
|
78
78
|
declare const FormCheckbox: import("react").ComponentType<import("utility-types").Subtract<import("./interface").CommonFieldProps, import("./interface").RadioCheckboxExcludeProps> & import("../checkbox/checkbox").CheckboxProps & import("./interface").RCIncludeType>;
|
|
79
79
|
declare const FormRadioGroup: import("react").ComponentType<import("utility-types").Subtract<import("../radio/radioGroup").RadioGroupProps, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
|
|
@@ -112,8 +112,7 @@ function withField(Component, opts) {
|
|
|
112
112
|
const [cursor, setCursor, getCursor] = useStateWithGetter(0);
|
|
113
113
|
const [status, setStatus] = useState(validateStatus); // use props.validateStatus to init
|
|
114
114
|
|
|
115
|
-
const rulesRef = useRef(rules);
|
|
116
|
-
const validateRef = useRef(validate); // notNotify is true means that the onChange of the Form does not need to be triggered
|
|
115
|
+
const rulesRef = useRef(rules); // notNotify is true means that the onChange of the Form does not need to be triggered
|
|
117
116
|
// notUpdate is true means that this operation does not need to trigger the forceUpdate
|
|
118
117
|
|
|
119
118
|
const updateTouched = (isTouched, callOpts) => {
|
|
@@ -214,7 +213,7 @@ function withField(Component, opts) {
|
|
|
214
213
|
let maybePromisedErrors; // let errorThrowSync;
|
|
215
214
|
|
|
216
215
|
try {
|
|
217
|
-
maybePromisedErrors =
|
|
216
|
+
maybePromisedErrors = validate(val, values);
|
|
218
217
|
} catch (err) {
|
|
219
218
|
// error throw by syncValidate
|
|
220
219
|
maybePromisedErrors = err;
|
|
@@ -254,7 +253,7 @@ function withField(Component, opts) {
|
|
|
254
253
|
finalVal = transform(val);
|
|
255
254
|
}
|
|
256
255
|
|
|
257
|
-
if (
|
|
256
|
+
if (validate) {
|
|
258
257
|
return _validate(finalVal, updater.getValue(), callOpts);
|
|
259
258
|
} else if (latestRules) {
|
|
260
259
|
return _validateInternal(finalVal, callOpts);
|
|
@@ -363,8 +362,7 @@ function withField(Component, opts) {
|
|
|
363
362
|
|
|
364
363
|
useLayoutEffect(() => {
|
|
365
364
|
rulesRef.current = rules;
|
|
366
|
-
|
|
367
|
-
}, [rules, validate]); // exec validate once when trigger inlcude 'mount'
|
|
365
|
+
}, [rules]); // exec validate once when trigger inlcude 'mount'
|
|
368
366
|
|
|
369
367
|
useLayoutEffect(() => {
|
|
370
368
|
if (validateOnMount) {
|
package/lib/es/radio/radio.d.ts
CHANGED
|
@@ -29,9 +29,13 @@ export declare type RadioProps = {
|
|
|
29
29
|
addonClassName?: string;
|
|
30
30
|
type?: RadioType;
|
|
31
31
|
'aria-label'?: React.AriaAttributes['aria-label'];
|
|
32
|
+
addonId?: string;
|
|
33
|
+
extraId?: string;
|
|
32
34
|
};
|
|
33
35
|
export interface RadioState {
|
|
34
36
|
hover?: boolean;
|
|
37
|
+
addonId?: string;
|
|
38
|
+
extraId?: string;
|
|
35
39
|
}
|
|
36
40
|
export { RadioChangeEvent };
|
|
37
41
|
declare class Radio extends BaseComponent<RadioProps, RadioState> {
|
|
@@ -71,7 +75,7 @@ declare class Radio extends BaseComponent<RadioProps, RadioState> {
|
|
|
71
75
|
prefixCls?: string;
|
|
72
76
|
name?: string;
|
|
73
77
|
onChange?: (e: RadioChangeEvent) => void;
|
|
74
|
-
buttonSize?: "small" | "
|
|
78
|
+
buttonSize?: "small" | "large" | "middle";
|
|
75
79
|
isCardRadio?: boolean;
|
|
76
80
|
isPureCardRadio?: boolean;
|
|
77
81
|
};
|
package/lib/es/radio/radio.js
CHANGED
|
@@ -44,16 +44,12 @@ class Radio extends BaseComponent {
|
|
|
44
44
|
};
|
|
45
45
|
|
|
46
46
|
this.state = {
|
|
47
|
-
hover: false
|
|
47
|
+
hover: false,
|
|
48
|
+
addonId: props.addonId,
|
|
49
|
+
extraId: props.extraId
|
|
48
50
|
};
|
|
49
51
|
this.foundation = new RadioFoundation(this.adapter);
|
|
50
52
|
this.radioEntity = null;
|
|
51
|
-
this.addonId = getUuidShort({
|
|
52
|
-
prefix: 'addon'
|
|
53
|
-
});
|
|
54
|
-
this.extraId = getUuidShort({
|
|
55
|
-
prefix: 'extra'
|
|
56
|
-
});
|
|
57
53
|
}
|
|
58
54
|
|
|
59
55
|
get adapter() {
|
|
@@ -62,6 +58,20 @@ class Radio extends BaseComponent {
|
|
|
62
58
|
this.setState({
|
|
63
59
|
hover
|
|
64
60
|
});
|
|
61
|
+
},
|
|
62
|
+
setAddonId: () => {
|
|
63
|
+
this.setState({
|
|
64
|
+
addonId: getUuidShort({
|
|
65
|
+
prefix: 'addon'
|
|
66
|
+
})
|
|
67
|
+
});
|
|
68
|
+
},
|
|
69
|
+
setExtraId: () => {
|
|
70
|
+
this.setState({
|
|
71
|
+
extraId: getUuidShort({
|
|
72
|
+
prefix: 'extra'
|
|
73
|
+
})
|
|
74
|
+
});
|
|
65
75
|
}
|
|
66
76
|
});
|
|
67
77
|
}
|
|
@@ -98,7 +108,11 @@ class Radio extends BaseComponent {
|
|
|
98
108
|
value: propValue
|
|
99
109
|
} = this.props;
|
|
100
110
|
let realChecked, isDisabled, realMode, isButtonRadioGroup, isCardRadioGroup, isPureCardRadioGroup, isButtonRadioComponent, buttonSize, realPrefixCls;
|
|
101
|
-
const
|
|
111
|
+
const {
|
|
112
|
+
hover: isHover,
|
|
113
|
+
addonId,
|
|
114
|
+
extraId
|
|
115
|
+
} = this.state;
|
|
102
116
|
let props = {};
|
|
103
117
|
|
|
104
118
|
if (this.isInGroup()) {
|
|
@@ -151,10 +165,10 @@ class Radio extends BaseComponent {
|
|
|
151
165
|
const renderContent = () => /*#__PURE__*/React.createElement(React.Fragment, null, children ? /*#__PURE__*/React.createElement("span", {
|
|
152
166
|
className: addonCls,
|
|
153
167
|
style: addonStyle,
|
|
154
|
-
id:
|
|
168
|
+
id: addonId
|
|
155
169
|
}, children) : null, extra && !isButtonRadio ? /*#__PURE__*/React.createElement("div", {
|
|
156
170
|
className: "".concat(prefix, "-extra"),
|
|
157
|
-
id:
|
|
171
|
+
id: extraId
|
|
158
172
|
}, extra) : null);
|
|
159
173
|
|
|
160
174
|
return /*#__PURE__*/React.createElement("label", {
|
|
@@ -171,8 +185,8 @@ class Radio extends BaseComponent {
|
|
|
171
185
|
ref: ref => {
|
|
172
186
|
this.radioEntity = ref;
|
|
173
187
|
},
|
|
174
|
-
addonId: children &&
|
|
175
|
-
extraId: extra &&
|
|
188
|
+
addonId: children && addonId,
|
|
189
|
+
extraId: extra && extraId
|
|
176
190
|
})), isCardRadioGroup ? /*#__PURE__*/React.createElement("div", {
|
|
177
191
|
className: "".concat(prefix, "-isCardRadioGroup_content")
|
|
178
192
|
}, renderContent()) : renderContent());
|
|
@@ -48,7 +48,7 @@ declare class RadioGroup extends BaseComponent<RadioGroupProps, RadioGroupState>
|
|
|
48
48
|
disabled: PropTypes.Requireable<boolean>;
|
|
49
49
|
name: PropTypes.Requireable<string>;
|
|
50
50
|
options: PropTypes.Requireable<any[]>;
|
|
51
|
-
buttonSize: PropTypes.Requireable<"small" | "
|
|
51
|
+
buttonSize: PropTypes.Requireable<"small" | "large" | "middle">;
|
|
52
52
|
type: PropTypes.Requireable<"default" | "button" | "card" | "pureCard">;
|
|
53
53
|
value: PropTypes.Requireable<any>;
|
|
54
54
|
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
@@ -176,7 +176,7 @@ export default class ScrollItem extends BaseComponent {
|
|
|
176
176
|
} = this;
|
|
177
177
|
const wrapperHeight = wrapper.offsetHeight;
|
|
178
178
|
const itemHeight = this.getItmHeight(node);
|
|
179
|
-
const targetTop =
|
|
179
|
+
const targetTop = node.offsetTop - (wrapperHeight - itemHeight) / 2;
|
|
180
180
|
this.scrollToPos(targetTop, duration);
|
|
181
181
|
};
|
|
182
182
|
|
|
@@ -97,11 +97,11 @@ export default class TimePicker extends BaseComponent<TimePickerProps, TimePicke
|
|
|
97
97
|
'aria-required': PropTypes.Requireable<boolean>;
|
|
98
98
|
prefixCls: PropTypes.Requireable<string>;
|
|
99
99
|
clearText: PropTypes.Requireable<string>;
|
|
100
|
-
value: PropTypes.Requireable<string | number | string[] | number[] | Date
|
|
100
|
+
value: PropTypes.Requireable<string | number | string[] | Date | number[] | Date[]>;
|
|
101
101
|
inputReadOnly: PropTypes.Requireable<boolean>;
|
|
102
102
|
disabled: PropTypes.Requireable<boolean>;
|
|
103
103
|
showClear: PropTypes.Requireable<boolean>;
|
|
104
|
-
defaultValue: PropTypes.Requireable<string | number | string[] | number[] | Date
|
|
104
|
+
defaultValue: PropTypes.Requireable<string | number | string[] | Date | number[] | Date[]>;
|
|
105
105
|
open: PropTypes.Requireable<boolean>;
|
|
106
106
|
defaultOpen: PropTypes.Requireable<boolean>;
|
|
107
107
|
onOpenChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
@@ -6,5 +6,5 @@ import PropTypes from 'prop-types';
|
|
|
6
6
|
* - \[12:00:12, 12:21:12]
|
|
7
7
|
* - \[[12:00:12, 12:21:12], [12:11:12, 12:32:12]]
|
|
8
8
|
*/
|
|
9
|
-
declare const TimeShape: PropTypes.Requireable<string | number | string[] | number[] | Date
|
|
9
|
+
declare const TimeShape: PropTypes.Requireable<string | number | string[] | Date | number[] | Date[]>;
|
|
10
10
|
export { TimeShape };
|
|
@@ -18,11 +18,11 @@ export default class LocaleTimePicker extends React.PureComponent<LocalePickerPr
|
|
|
18
18
|
'aria-required': import("prop-types").Requireable<boolean>;
|
|
19
19
|
prefixCls: import("prop-types").Requireable<string>;
|
|
20
20
|
clearText: import("prop-types").Requireable<string>;
|
|
21
|
-
value: import("prop-types").Requireable<string | number | string[] | number[] | Date
|
|
21
|
+
value: import("prop-types").Requireable<string | number | string[] | Date | number[] | Date[]>;
|
|
22
22
|
inputReadOnly: import("prop-types").Requireable<boolean>;
|
|
23
23
|
disabled: import("prop-types").Requireable<boolean>;
|
|
24
24
|
showClear: import("prop-types").Requireable<boolean>;
|
|
25
|
-
defaultValue: import("prop-types").Requireable<string | number | string[] | number[] | Date
|
|
25
|
+
defaultValue: import("prop-types").Requireable<string | number | string[] | Date | number[] | Date[]>;
|
|
26
26
|
open: import("prop-types").Requireable<boolean>;
|
|
27
27
|
defaultOpen: import("prop-types").Requireable<boolean>;
|
|
28
28
|
onOpenChange: import("prop-types").Requireable<(...args: any[]) => any>;
|
package/lib/es/tooltip/index.js
CHANGED
|
@@ -212,7 +212,7 @@ export default class Tooltip extends BaseComponent {
|
|
|
212
212
|
}, portalEventSet, {
|
|
213
213
|
"x-placement": placement,
|
|
214
214
|
style: _Object$assign({
|
|
215
|
-
visibility: motion ?
|
|
215
|
+
visibility: motion ? undefined : 'visible'
|
|
216
216
|
}, style)
|
|
217
217
|
}), contentNode, icon);
|
|
218
218
|
return /*#__PURE__*/React.createElement(Portal, {
|
|
@@ -286,7 +286,7 @@ export default class Tooltip extends BaseComponent {
|
|
|
286
286
|
placement: props.position || 'top',
|
|
287
287
|
transitionStyle: {},
|
|
288
288
|
isPositionUpdated: false,
|
|
289
|
-
id:
|
|
289
|
+
id: props.wrapperId // auto generate id, will be used by children.aria-describedby & content.id, improve a11y
|
|
290
290
|
|
|
291
291
|
};
|
|
292
292
|
this.foundation = new TooltipFoundation(this.adapter);
|
|
@@ -559,6 +559,11 @@ export default class Tooltip extends BaseComponent {
|
|
|
559
559
|
},
|
|
560
560
|
notifyEscKeydown: event => {
|
|
561
561
|
this.props.onEscKeyDown(event);
|
|
562
|
+
},
|
|
563
|
+
setId: () => {
|
|
564
|
+
this.setState({
|
|
565
|
+
id: getUuidShort()
|
|
566
|
+
});
|
|
562
567
|
}
|
|
563
568
|
});
|
|
564
569
|
}
|
|
@@ -37,7 +37,7 @@ export default class Title extends PureComponent<TitleProps> {
|
|
|
37
37
|
underline: PropTypes.Requireable<boolean>;
|
|
38
38
|
strong: PropTypes.Requireable<boolean>;
|
|
39
39
|
type: PropTypes.Requireable<"warning" | "success" | "primary" | "tertiary" | "secondary" | "danger" | "quaternary">;
|
|
40
|
-
heading: PropTypes.Requireable<
|
|
40
|
+
heading: PropTypes.Requireable<4 | 2 | 1 | 3 | 6 | 5>;
|
|
41
41
|
style: PropTypes.Requireable<object>;
|
|
42
42
|
className: PropTypes.Requireable<string>;
|
|
43
43
|
component: PropTypes.Requireable<string>;
|
package/lib/es/upload/index.d.ts
CHANGED
|
@@ -140,7 +140,7 @@ declare class Upload extends BaseComponent<UploadProps, UploadState> {
|
|
|
140
140
|
style: PropTypes.Requireable<object>;
|
|
141
141
|
timeout: PropTypes.Requireable<number>;
|
|
142
142
|
transformFile: PropTypes.Requireable<(...args: any[]) => any>;
|
|
143
|
-
uploadTrigger: PropTypes.Requireable<"
|
|
143
|
+
uploadTrigger: PropTypes.Requireable<"custom" | "auto">;
|
|
144
144
|
validateMessage: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
145
145
|
validateStatus: PropTypes.Requireable<"default" | "error" | "warning" | "success">;
|
|
146
146
|
withCredentials: PropTypes.Requireable<boolean>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@douyinfe/semi-ui",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.10.0-alpha.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/es/index.js",
|
|
@@ -14,12 +14,12 @@
|
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@babel/runtime-corejs3": "^7.15.4",
|
|
17
|
-
"@douyinfe/semi-animation": "2.9.
|
|
18
|
-
"@douyinfe/semi-animation-react": "2.9.
|
|
19
|
-
"@douyinfe/semi-foundation": "2.
|
|
20
|
-
"@douyinfe/semi-icons": "2.9.
|
|
21
|
-
"@douyinfe/semi-illustrations": "2.9.
|
|
22
|
-
"@douyinfe/semi-theme-default": "2.9.
|
|
17
|
+
"@douyinfe/semi-animation": "2.9.0",
|
|
18
|
+
"@douyinfe/semi-animation-react": "2.9.0",
|
|
19
|
+
"@douyinfe/semi-foundation": "^2.10.0-alpha.0",
|
|
20
|
+
"@douyinfe/semi-icons": "2.9.0",
|
|
21
|
+
"@douyinfe/semi-illustrations": "2.9.0",
|
|
22
|
+
"@douyinfe/semi-theme-default": "2.9.0",
|
|
23
23
|
"@types/react-window": "^1.8.2",
|
|
24
24
|
"async-validator": "^3.5.0",
|
|
25
25
|
"classnames": "^2.2.6",
|
|
@@ -69,13 +69,13 @@
|
|
|
69
69
|
],
|
|
70
70
|
"author": "",
|
|
71
71
|
"license": "MIT",
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "5d1bb1d031052d7584ecd5d1bc444cd13f861337",
|
|
73
73
|
"devDependencies": {
|
|
74
74
|
"@babel/plugin-proposal-decorators": "^7.15.8",
|
|
75
75
|
"@babel/plugin-transform-runtime": "^7.15.8",
|
|
76
76
|
"@babel/preset-env": "^7.15.8",
|
|
77
77
|
"@babel/preset-react": "^7.14.5",
|
|
78
|
-
"@douyinfe/semi-scss-compile": "2.9.
|
|
78
|
+
"@douyinfe/semi-scss-compile": "2.9.0",
|
|
79
79
|
"@storybook/addon-knobs": "^6.3.1",
|
|
80
80
|
"@types/lodash": "^4.14.176",
|
|
81
81
|
"babel-loader": "^8.2.2",
|
package/radio/radio.tsx
CHANGED
|
@@ -41,10 +41,14 @@ export type RadioProps = {
|
|
|
41
41
|
addonClassName?: string;
|
|
42
42
|
type?: RadioType;
|
|
43
43
|
'aria-label'?: React.AriaAttributes['aria-label'];
|
|
44
|
+
addonId?: string;
|
|
45
|
+
extraId?: string;
|
|
44
46
|
};
|
|
45
47
|
|
|
46
48
|
export interface RadioState {
|
|
47
49
|
hover?: boolean;
|
|
50
|
+
addonId?: string;
|
|
51
|
+
extraId?: string;
|
|
48
52
|
}
|
|
49
53
|
|
|
50
54
|
export { RadioChangeEvent };
|
|
@@ -94,11 +98,11 @@ class Radio extends BaseComponent<RadioProps, RadioState> {
|
|
|
94
98
|
super(props);
|
|
95
99
|
this.state = {
|
|
96
100
|
hover: false,
|
|
101
|
+
addonId: props.addonId,
|
|
102
|
+
extraId: props.extraId,
|
|
97
103
|
};
|
|
98
104
|
this.foundation = new RadioFoundation(this.adapter);
|
|
99
105
|
this.radioEntity = null;
|
|
100
|
-
this.addonId = getUuidShort({ prefix: 'addon' });
|
|
101
|
-
this.extraId = getUuidShort({ prefix: 'extra' });
|
|
102
106
|
}
|
|
103
107
|
|
|
104
108
|
get adapter(): RadioAdapter {
|
|
@@ -106,6 +110,12 @@ class Radio extends BaseComponent<RadioProps, RadioState> {
|
|
|
106
110
|
...super.adapter,
|
|
107
111
|
setHover: (hover: boolean) => {
|
|
108
112
|
this.setState({ hover });
|
|
113
|
+
},
|
|
114
|
+
setAddonId: () => {
|
|
115
|
+
this.setState({ addonId: getUuidShort({ prefix: 'addon' }) });
|
|
116
|
+
},
|
|
117
|
+
setExtraId: () => {
|
|
118
|
+
this.setState({ extraId: getUuidShort({ prefix: 'extra' }) });
|
|
109
119
|
}
|
|
110
120
|
};
|
|
111
121
|
}
|
|
@@ -168,7 +178,7 @@ class Radio extends BaseComponent<RadioProps, RadioState> {
|
|
|
168
178
|
isButtonRadioComponent,
|
|
169
179
|
buttonSize,
|
|
170
180
|
realPrefixCls;
|
|
171
|
-
const isHover = this.state
|
|
181
|
+
const { hover: isHover, addonId, extraId } = this.state;
|
|
172
182
|
let props = {};
|
|
173
183
|
|
|
174
184
|
if (this.isInGroup()) {
|
|
@@ -218,8 +228,8 @@ class Radio extends BaseComponent<RadioProps, RadioState> {
|
|
|
218
228
|
}, addonClassName);
|
|
219
229
|
const renderContent = () => (
|
|
220
230
|
<>
|
|
221
|
-
{children ? <span className={addonCls} style={addonStyle} id={
|
|
222
|
-
{extra && !isButtonRadio ? <div className={`${prefix}-extra`} id={
|
|
231
|
+
{children ? <span className={addonCls} style={addonStyle} id={addonId}>{children}</span> : null}
|
|
232
|
+
{extra && !isButtonRadio ? <div className={`${prefix}-extra`} id={extraId}>{extra}</div> : null}
|
|
223
233
|
</>
|
|
224
234
|
);
|
|
225
235
|
return (
|
|
@@ -240,8 +250,8 @@ class Radio extends BaseComponent<RadioProps, RadioState> {
|
|
|
240
250
|
ref={(ref: RadioInner) => {
|
|
241
251
|
this.radioEntity = ref;
|
|
242
252
|
}}
|
|
243
|
-
addonId={children &&
|
|
244
|
-
extraId={extra &&
|
|
253
|
+
addonId={children && addonId}
|
|
254
|
+
extraId={extra && extraId}
|
|
245
255
|
/>
|
|
246
256
|
{
|
|
247
257
|
isCardRadioGroup ?
|
|
@@ -329,7 +329,7 @@ export default class ScrollItem<T extends Item> extends BaseComponent<ScrollItem
|
|
|
329
329
|
const { wrapper } = this;
|
|
330
330
|
const wrapperHeight = wrapper.offsetHeight;
|
|
331
331
|
const itemHeight = this.getItmHeight(node);
|
|
332
|
-
const targetTop =
|
|
332
|
+
const targetTop = node.offsetTop - (wrapperHeight - itemHeight) / 2;
|
|
333
333
|
|
|
334
334
|
this.scrollToPos(targetTop, duration);
|
|
335
335
|
};
|
|
@@ -475,7 +475,7 @@ export default class TimePicker extends BaseComponent<TimePickerProps, TimePicke
|
|
|
475
475
|
|
|
476
476
|
const panelPrefix = classNames({
|
|
477
477
|
[`${prefixCls}-panel`]: true,
|
|
478
|
-
[`${prefixCls}-panel-${size}`]: size,
|
|
478
|
+
[`${prefixCls}-panel-${ size}`]: size,
|
|
479
479
|
});
|
|
480
480
|
|
|
481
481
|
const inputProps = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { Component, useState } from 'react';
|
|
2
2
|
import TimePickerPanel from '../index';
|
|
3
|
-
import { TimePicker as BasicTimePicker, Button
|
|
3
|
+
import { TimePicker as BasicTimePicker, Button } from '../../index';
|
|
4
4
|
import { strings } from '@douyinfe/semi-foundation/timePicker/constants';
|
|
5
5
|
import { get } from 'lodash';
|
|
6
6
|
|
|
@@ -44,12 +44,6 @@ const init = () => {
|
|
|
44
44
|
init();
|
|
45
45
|
|
|
46
46
|
export const TimePickerPanelDefault = () => {
|
|
47
|
-
const initValues = {
|
|
48
|
-
testRange: [
|
|
49
|
-
new Date("2022-04-17T15:00:00"),
|
|
50
|
-
new Date("2022-04-17T18:00:00"),
|
|
51
|
-
],
|
|
52
|
-
};
|
|
53
47
|
return (
|
|
54
48
|
<div>
|
|
55
49
|
<TimePicker panelHeader={'Time Select'} onChange={val => console.log(val)} />
|
|
@@ -59,19 +53,6 @@ export const TimePickerPanelDefault = () => {
|
|
|
59
53
|
defaultOpen={true}
|
|
60
54
|
scrollItemProps={{ cycled: false }}
|
|
61
55
|
/>
|
|
62
|
-
<TimePicker use12Hours defaultValue={"上午 10:32:33"}/>
|
|
63
|
-
<br/><br/>
|
|
64
|
-
<TimePicker type="timeRange" use12Hours format="a h:mm" defaultValue={["下午 08:11", "上午 11:21"]} />
|
|
65
|
-
<Form initValues={initValues}>
|
|
66
|
-
<pre>{JSON.stringify(initValues)}</pre>
|
|
67
|
-
<Form.TimePicker
|
|
68
|
-
use12Hours
|
|
69
|
-
field="testRange"
|
|
70
|
-
label="Time Range"
|
|
71
|
-
type="timeRange"
|
|
72
|
-
format="a hh:mm"
|
|
73
|
-
/>
|
|
74
|
-
</Form>
|
|
75
56
|
</div>
|
|
76
57
|
);
|
|
77
58
|
};
|
package/tooltip/index.tsx
CHANGED
|
@@ -75,6 +75,7 @@ export interface TooltipProps extends BaseProps {
|
|
|
75
75
|
guardFocus?: boolean;
|
|
76
76
|
returnFocusOnClose?: boolean;
|
|
77
77
|
onEscKeyDown?: (e: React.KeyboardEvent) => void;
|
|
78
|
+
wrapperId?: string;
|
|
78
79
|
}
|
|
79
80
|
interface TooltipState {
|
|
80
81
|
visible: boolean;
|
|
@@ -193,7 +194,7 @@ export default class Tooltip extends BaseComponent<TooltipProps, TooltipState> {
|
|
|
193
194
|
placement: props.position || 'top',
|
|
194
195
|
transitionStyle: {},
|
|
195
196
|
isPositionUpdated: false,
|
|
196
|
-
id:
|
|
197
|
+
id: props.wrapperId, // auto generate id, will be used by children.aria-describedby & content.id, improve a11y
|
|
197
198
|
};
|
|
198
199
|
this.foundation = new TooltipFoundation(this.adapter);
|
|
199
200
|
this.eventManager = new Event();
|
|
@@ -428,6 +429,9 @@ export default class Tooltip extends BaseComponent<TooltipProps, TooltipState> {
|
|
|
428
429
|
},
|
|
429
430
|
notifyEscKeydown: (event: React.KeyboardEvent) => {
|
|
430
431
|
this.props.onEscKeyDown(event);
|
|
432
|
+
},
|
|
433
|
+
setId: () => {
|
|
434
|
+
this.setState({ id: getUuidShort() });
|
|
431
435
|
}
|
|
432
436
|
};
|
|
433
437
|
}
|
|
@@ -581,7 +585,7 @@ export default class Tooltip extends BaseComponent<TooltipProps, TooltipState> {
|
|
|
581
585
|
}
|
|
582
586
|
</TooltipTransition>
|
|
583
587
|
) : (
|
|
584
|
-
<div className={className} {...portalEventSet} x-placement={placement} style={{ visibility: motion ?
|
|
588
|
+
<div className={className} {...portalEventSet} x-placement={placement} style={{ visibility: motion ? undefined : 'visible', ...style }}>
|
|
585
589
|
{contentNode}
|
|
586
590
|
{icon}
|
|
587
591
|
</div>
|