@douyinfe/semi-ui 2.10.0-beta.0 → 2.10.2-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/button/buttonGroup.tsx +2 -2
- package/carousel/CarouselArrow.tsx +4 -4
- package/carousel/CarouselIndicator.tsx +0 -1
- package/carousel/index.tsx +1 -3
- package/carousel/interface.ts +1 -2
- package/checkbox/checkbox.tsx +1 -3
- package/checkbox/checkboxInner.tsx +19 -14
- package/datePicker/monthsGrid.tsx +8 -8
- package/dist/css/semi.css +5 -4
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +711 -547
- 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/baseForm.tsx +10 -2
- package/form/hoc/withField.tsx +17 -5
- package/inputNumber/__test__/inputNumber.test.js +40 -3
- package/inputNumber/_story/inputNumber.stories.js +56 -1
- package/inputNumber/index.tsx +22 -14
- package/lib/cjs/button/buttonGroup.d.ts +1 -1
- package/lib/cjs/carousel/CarouselArrow.js +3 -6
- package/lib/cjs/carousel/index.js +1 -3
- package/lib/cjs/carousel/interface.d.ts +1 -2
- package/lib/cjs/checkbox/checkbox.js +1 -2
- package/lib/cjs/checkbox/checkboxInner.js +21 -17
- package/lib/cjs/datePicker/monthsGrid.js +6 -6
- package/lib/cjs/form/baseForm.d.ts +1 -0
- package/lib/cjs/form/baseForm.js +10 -2
- package/lib/cjs/form/hoc/withField.js +8 -1
- package/lib/cjs/inputNumber/index.d.ts +2 -6
- package/lib/cjs/inputNumber/index.js +27 -11
- package/lib/cjs/tooltip/index.d.ts +1 -0
- package/lib/cjs/tooltip/index.js +9 -6
- package/lib/cjs/transfer/index.js +5 -5
- package/lib/cjs/treeSelect/index.js +1 -1
- package/lib/es/button/buttonGroup.d.ts +1 -1
- package/lib/es/carousel/CarouselArrow.js +3 -5
- package/lib/es/carousel/index.js +1 -3
- package/lib/es/carousel/interface.d.ts +1 -2
- package/lib/es/checkbox/checkbox.js +1 -2
- package/lib/es/checkbox/checkboxInner.js +20 -17
- package/lib/es/datePicker/monthsGrid.js +7 -7
- package/lib/es/form/baseForm.d.ts +1 -0
- package/lib/es/form/baseForm.js +10 -2
- package/lib/es/form/hoc/withField.js +8 -1
- package/lib/es/inputNumber/index.d.ts +2 -6
- package/lib/es/inputNumber/index.js +26 -11
- package/lib/es/tooltip/index.d.ts +1 -0
- package/lib/es/tooltip/index.js +9 -6
- package/lib/es/transfer/index.js +1 -1
- package/lib/es/treeSelect/index.js +1 -1
- package/package.json +9 -9
- package/popover/_story/popover.stories.js +38 -2
- package/tooltip/index.tsx +9 -2
- package/transfer/index.tsx +1 -1
- package/treeSelect/index.tsx +1 -1
package/button/buttonGroup.tsx
CHANGED
|
@@ -15,7 +15,7 @@ export interface ButtonGroupProps extends BaseProps {
|
|
|
15
15
|
size?: Size;
|
|
16
16
|
theme?: Theme;
|
|
17
17
|
className?: string;
|
|
18
|
-
children?: React.
|
|
18
|
+
children?: React.ReactNode;
|
|
19
19
|
'aria-label'?: React.AriaAttributes['aria-label'];
|
|
20
20
|
}
|
|
21
21
|
|
|
@@ -44,7 +44,7 @@ export default class ButtonGroup extends BaseComponent<ButtonGroupProps> {
|
|
|
44
44
|
const cls = classNames(`${prefixCls}-group`, className);
|
|
45
45
|
|
|
46
46
|
if (children) {
|
|
47
|
-
inner = ((Array.isArray(children) ? children : [children])).map((itm: React.
|
|
47
|
+
inner = ((Array.isArray(children) ? children : [children])).map((itm: React.ReactNode, index) => (
|
|
48
48
|
isValidElement(itm)
|
|
49
49
|
? cloneElement(itm, { disabled, size, type, ...itm.props, ...rest, key: index })
|
|
50
50
|
: itm
|
|
@@ -5,7 +5,7 @@ import cls from 'classnames';
|
|
|
5
5
|
import { cssClasses } from '@douyinfe/semi-foundation/carousel/constants';
|
|
6
6
|
import { CarouselArrowProps } from "./interface";
|
|
7
7
|
import { IconChevronLeft, IconChevronRight } from "@douyinfe/semi-icons";
|
|
8
|
-
import { get
|
|
8
|
+
import { get } from 'lodash';
|
|
9
9
|
|
|
10
10
|
class CarouselArrow extends React.PureComponent<CarouselArrowProps> {
|
|
11
11
|
renderLeftIcon = () => {
|
|
@@ -17,7 +17,7 @@ class CarouselArrow extends React.PureComponent<CarouselArrowProps> {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
render(): ReactNode {
|
|
20
|
-
const { type, theme, prev, next
|
|
20
|
+
const { type, theme, prev, next } = this.props;
|
|
21
21
|
const classNames = cls( {
|
|
22
22
|
[cssClasses.CAROUSEL_ARROW]: true,
|
|
23
23
|
[`${cssClasses.CAROUSEL_ARROW}-${theme}`]: theme,
|
|
@@ -39,7 +39,7 @@ class CarouselArrow extends React.PureComponent<CarouselArrowProps> {
|
|
|
39
39
|
<div
|
|
40
40
|
// role='button'
|
|
41
41
|
className={leftClassNames}
|
|
42
|
-
onClick={
|
|
42
|
+
onClick={prev}
|
|
43
43
|
{...get(this.props, 'arrowProps.leftArrow.props')}
|
|
44
44
|
>
|
|
45
45
|
{this.renderLeftIcon()}
|
|
@@ -48,7 +48,7 @@ class CarouselArrow extends React.PureComponent<CarouselArrowProps> {
|
|
|
48
48
|
// role='button'
|
|
49
49
|
// tabIndex={0}
|
|
50
50
|
className={rightClassNames}
|
|
51
|
-
onClick={
|
|
51
|
+
onClick={next}
|
|
52
52
|
{...get(this.props, 'arrowProps.rightArrow.props')}
|
|
53
53
|
>
|
|
54
54
|
{this.renderRightIcon()}
|
|
@@ -6,7 +6,6 @@ import PropTypes from 'prop-types';
|
|
|
6
6
|
import { cssClasses, strings } from '@douyinfe/semi-foundation/carousel/constants';
|
|
7
7
|
import { CarouselIndicatorProps } from "./interface";
|
|
8
8
|
import getDataAttr from "@douyinfe/semi-foundation/utils/getDataAttr";
|
|
9
|
-
import { throttle } from 'lodash';
|
|
10
9
|
|
|
11
10
|
class CarouselIndicator extends React.PureComponent<CarouselIndicatorProps> {
|
|
12
11
|
static propTypes = {
|
package/carousel/index.tsx
CHANGED
|
@@ -155,7 +155,7 @@ class Carousel extends BaseComponent<CarouselProps, CarouselState> {
|
|
|
155
155
|
}
|
|
156
156
|
|
|
157
157
|
onIndicatorChange = (activeIndex: number): void => {
|
|
158
|
-
return this.foundation.
|
|
158
|
+
return this.foundation.onIndicatorChange(activeIndex);
|
|
159
159
|
};
|
|
160
160
|
|
|
161
161
|
getChildren = (): (ReactChild | ReactFragment | ReactPortal)[] => {
|
|
@@ -238,7 +238,6 @@ class Carousel extends BaseComponent<CarouselProps, CarouselState> {
|
|
|
238
238
|
renderArrow = () => {
|
|
239
239
|
const { children } = this.state;
|
|
240
240
|
const { showArrow, arrowType, theme, arrowProps } = this.props;
|
|
241
|
-
const timing = this.foundation.getSwitchingTime();
|
|
242
241
|
|
|
243
242
|
if (showArrow && children.length > 1){
|
|
244
243
|
return (
|
|
@@ -247,7 +246,6 @@ class Carousel extends BaseComponent<CarouselProps, CarouselState> {
|
|
|
247
246
|
theme={theme}
|
|
248
247
|
prev={this.prev}
|
|
249
248
|
next={this.next}
|
|
250
|
-
timing={timing}
|
|
251
249
|
arrowProps={arrowProps}
|
|
252
250
|
/>
|
|
253
251
|
);
|
package/carousel/interface.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { strings } from '@douyinfe/semi-foundation/carousel/constants';
|
|
|
4
4
|
export interface CarouselMethod {
|
|
5
5
|
next?: () => void;
|
|
6
6
|
prev?: () => void;
|
|
7
|
-
goTo?: () => void;
|
|
7
|
+
goTo?: (tagetIndex: number) => void;
|
|
8
8
|
play?: () => void;
|
|
9
9
|
stop?: () => void;
|
|
10
10
|
}
|
|
@@ -51,7 +51,6 @@ export interface CarouselArrowProps {
|
|
|
51
51
|
prev?: () => void;
|
|
52
52
|
next?: () => void;
|
|
53
53
|
arrowProps?: ArrowProps;
|
|
54
|
-
timing: number;
|
|
55
54
|
}
|
|
56
55
|
|
|
57
56
|
export interface ArrowButton {
|
package/checkbox/checkbox.tsx
CHANGED
|
@@ -171,6 +171,7 @@ class Checkbox extends BaseComponent<CheckboxProps, CheckboxState> {
|
|
|
171
171
|
const { isCardType, isPureCardType } = this.context.checkboxGroup;
|
|
172
172
|
props.isCardType = isCardType;
|
|
173
173
|
props.isPureCardType = isPureCardType;
|
|
174
|
+
props['name'] = this.context.checkboxGroup.name;
|
|
174
175
|
}
|
|
175
176
|
|
|
176
177
|
const prefix = prefixCls || css.PREFIX;
|
|
@@ -192,8 +193,6 @@ class Checkbox extends BaseComponent<CheckboxProps, CheckboxState> {
|
|
|
192
193
|
[`${prefix}-cardType_extra_noChildren`]: props.isCardType && !children,
|
|
193
194
|
});
|
|
194
195
|
|
|
195
|
-
const name = inGroup && this.context.checkboxGroup.name;
|
|
196
|
-
|
|
197
196
|
const renderContent = () => (
|
|
198
197
|
<>
|
|
199
198
|
{children ? <span id={this.addonId} className={`${prefix}-addon`}>{children}</span> : null}
|
|
@@ -220,7 +219,6 @@ class Checkbox extends BaseComponent<CheckboxProps, CheckboxState> {
|
|
|
220
219
|
{...props}
|
|
221
220
|
addonId={children && this.addonId}
|
|
222
221
|
extraId={extra && this.extraId}
|
|
223
|
-
name={name}
|
|
224
222
|
isPureCardType={props.isPureCardType}
|
|
225
223
|
ref={ref => {
|
|
226
224
|
this.checkboxEntity = ref;
|
|
@@ -81,26 +81,31 @@ class CheckboxInner extends PureComponent<CheckboxInnerProps> {
|
|
|
81
81
|
<IconCheckboxIndeterminate />
|
|
82
82
|
) : null;
|
|
83
83
|
|
|
84
|
+
const inputProps: React.InputHTMLAttributes<HTMLInputElement> = {
|
|
85
|
+
type: "checkbox",
|
|
86
|
+
'aria-label': this.props['aria-label'],
|
|
87
|
+
'aria-disabled': disabled,
|
|
88
|
+
'aria-checked': checked,
|
|
89
|
+
'aria-labelledby': addonId,
|
|
90
|
+
'aria-describedby':extraId || this.props['aria-describedby'],
|
|
91
|
+
'aria-invalid': this.props['aria-invalid'],
|
|
92
|
+
'aria-errormessage': this.props['aria-errormessage'],
|
|
93
|
+
'aria-required': this.props['aria-required'],
|
|
94
|
+
className: css.INPUT,
|
|
95
|
+
onChange: noop,
|
|
96
|
+
checked: checked,
|
|
97
|
+
disabled: disabled,
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
name && (inputProps['name'] = name);
|
|
101
|
+
|
|
84
102
|
return (
|
|
85
103
|
<span className={wrapper}>
|
|
86
104
|
<input
|
|
87
|
-
|
|
88
|
-
aria-label={this.props['aria-label']}
|
|
89
|
-
aria-disabled={disabled}
|
|
90
|
-
aria-checked={checked}
|
|
91
|
-
aria-labelledby={addonId}
|
|
92
|
-
aria-describedby={extraId || this.props['aria-describedby']}
|
|
93
|
-
aria-invalid={this.props['aria-invalid']}
|
|
94
|
-
aria-errormessage={this.props['aria-errormessage']}
|
|
95
|
-
aria-required={this.props['aria-required']}
|
|
105
|
+
{...inputProps}
|
|
96
106
|
ref={ref => {
|
|
97
107
|
this.inputEntity = ref;
|
|
98
108
|
}}
|
|
99
|
-
className={css.INPUT}
|
|
100
|
-
onChange={noop}
|
|
101
|
-
checked={checked}
|
|
102
|
-
disabled={disabled}
|
|
103
|
-
name={name}
|
|
104
109
|
/>
|
|
105
110
|
<span className={inner}>{icon}</span>
|
|
106
111
|
</span>
|
|
@@ -10,7 +10,7 @@ import { format as formatFn, addMonths, isSameDay } from 'date-fns';
|
|
|
10
10
|
|
|
11
11
|
import MonthsGridFoundation, { MonthInfo, MonthsGridAdapter, MonthsGridDateAdapter, MonthsGridFoundationProps, MonthsGridFoundationState, MonthsGridRangeAdapter, PanelType } from '@douyinfe/semi-foundation/datePicker/monthsGridFoundation';
|
|
12
12
|
import { strings, numbers, cssClasses } from '@douyinfe/semi-foundation/datePicker/constants';
|
|
13
|
-
import {
|
|
13
|
+
import { compatibleParse } from '@douyinfe/semi-foundation/datePicker/_utils/parser';
|
|
14
14
|
import { noop, stubFalse } from 'lodash';
|
|
15
15
|
import BaseComponent, { BaseProps } from '../_base/baseComponent';
|
|
16
16
|
import Navigation from './navigation';
|
|
@@ -476,8 +476,8 @@ export default class MonthsGrid extends BaseComponent<MonthsGridProps, MonthsGri
|
|
|
476
476
|
rangeStart &&
|
|
477
477
|
rangeEnd &&
|
|
478
478
|
isSameDay(
|
|
479
|
-
(startDate =
|
|
480
|
-
(endDate =
|
|
479
|
+
(startDate = compatibleParse(rangeStart, dateFormat, undefined, dateFnsLocale)),
|
|
480
|
+
(endDate = compatibleParse(rangeEnd, dateFormat, undefined, dateFnsLocale))
|
|
481
481
|
)
|
|
482
482
|
) {
|
|
483
483
|
if (panelType === strings.PANEL_TYPE_RIGHT) {
|
|
@@ -550,10 +550,10 @@ export default class MonthsGrid extends BaseComponent<MonthsGridProps, MonthsGri
|
|
|
550
550
|
|
|
551
551
|
if (panelType === strings.PANEL_TYPE_LEFT) {
|
|
552
552
|
panelDetail = monthLeft;
|
|
553
|
-
dateText = rangeStart ? formatFn(
|
|
553
|
+
dateText = rangeStart ? formatFn(compatibleParse(rangeStart, dateFormat, undefined, dateFnsLocale), FORMAT_SWITCH_DATE) : '';
|
|
554
554
|
} else {
|
|
555
555
|
panelDetail = monthRight;
|
|
556
|
-
dateText = rangeEnd ? formatFn(
|
|
556
|
+
dateText = rangeEnd ? formatFn(compatibleParse(rangeEnd, dateFormat, undefined, dateFnsLocale), FORMAT_SWITCH_DATE) : '';
|
|
557
557
|
}
|
|
558
558
|
|
|
559
559
|
const { isTimePickerOpen, showDate } = panelDetail;
|
|
@@ -561,7 +561,7 @@ export default class MonthsGrid extends BaseComponent<MonthsGridProps, MonthsGri
|
|
|
561
561
|
|
|
562
562
|
const timeText = showDate ? formatFn(showDate, formatTimePicker) : '';
|
|
563
563
|
|
|
564
|
-
const
|
|
564
|
+
const showSwitchIcon = ['default'].includes(density);
|
|
565
565
|
|
|
566
566
|
const switchCls = classnames(`${prefixCls}-switch`);
|
|
567
567
|
const dateCls = classnames({
|
|
@@ -583,7 +583,7 @@ export default class MonthsGrid extends BaseComponent<MonthsGridProps, MonthsGri
|
|
|
583
583
|
className={dateCls}
|
|
584
584
|
onClick={e => this.foundation.showDatePanel(panelType)}
|
|
585
585
|
>
|
|
586
|
-
{
|
|
586
|
+
{showSwitchIcon && <IconCalendar aria-hidden />}
|
|
587
587
|
<span className={textCls}>{dateText || monthText}</span>
|
|
588
588
|
</div>
|
|
589
589
|
<div
|
|
@@ -592,7 +592,7 @@ export default class MonthsGrid extends BaseComponent<MonthsGridProps, MonthsGri
|
|
|
592
592
|
className={timeCls}
|
|
593
593
|
onClick={e => this.foundation.showTimePicker(panelType, true)}
|
|
594
594
|
>
|
|
595
|
-
{
|
|
595
|
+
{showSwitchIcon && <IconClock aria-hidden />}
|
|
596
596
|
<span className={textCls}>{timeText}</span>
|
|
597
597
|
</div>
|
|
598
598
|
</div>
|
package/dist/css/semi.css
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
@charset "UTF-8";
|
|
1
2
|
/* shadow */
|
|
2
3
|
/* sizing */
|
|
3
4
|
/* spacing */
|
|
@@ -2864,7 +2865,7 @@ body[theme-mode=dark], body .semi-always-dark {
|
|
|
2864
2865
|
|
|
2865
2866
|
@keyframes semi-carousel-content-item-keyframe-slide-in {
|
|
2866
2867
|
from {
|
|
2867
|
-
transform: translateX(
|
|
2868
|
+
transform: translateX(100%);
|
|
2868
2869
|
}
|
|
2869
2870
|
to {
|
|
2870
2871
|
transform: translateX(0);
|
|
@@ -2875,12 +2876,12 @@ body[theme-mode=dark], body .semi-always-dark {
|
|
|
2875
2876
|
transform: translateX(0);
|
|
2876
2877
|
}
|
|
2877
2878
|
to {
|
|
2878
|
-
transform: translateX(100%);
|
|
2879
|
+
transform: translateX(-100%);
|
|
2879
2880
|
}
|
|
2880
2881
|
}
|
|
2881
2882
|
@keyframes semi-carousel-content-item-keyframe-slide-in-reverse {
|
|
2882
2883
|
from {
|
|
2883
|
-
transform: translateX(100%);
|
|
2884
|
+
transform: translateX(-100%);
|
|
2884
2885
|
}
|
|
2885
2886
|
to {
|
|
2886
2887
|
transform: translateX(0);
|
|
@@ -2891,7 +2892,7 @@ body[theme-mode=dark], body .semi-always-dark {
|
|
|
2891
2892
|
transform: translateX(0);
|
|
2892
2893
|
}
|
|
2893
2894
|
to {
|
|
2894
|
-
transform: translateX(
|
|
2895
|
+
transform: translateX(100%);
|
|
2895
2896
|
}
|
|
2896
2897
|
}
|
|
2897
2898
|
.semi-rtl .semi-carousel,
|