@douyinfe/semi-ui 2.19.0-alpha.6 → 2.19.0-alpha.7
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 +38 -4
- package/button/index.tsx +2 -0
- package/dist/css/semi.css +40 -3
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +150 -51
- 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 +0 -1
- package/lib/cjs/button/buttonGroup.d.ts +1 -0
- package/lib/cjs/button/buttonGroup.js +52 -3
- package/lib/cjs/button/index.d.ts +1 -0
- package/lib/cjs/button/index.js +1 -0
- package/lib/cjs/carousel/CarouselIndicator.d.ts +1 -1
- package/lib/cjs/carousel/index.d.ts +1 -1
- package/lib/cjs/datePicker/dateInput.d.ts +1 -1
- package/lib/cjs/datePicker/datePicker.d.ts +1 -1
- package/lib/cjs/datePicker/monthsGrid.d.ts +1 -1
- package/lib/cjs/form/baseForm.js +0 -1
- package/lib/cjs/popconfirm/index.d.ts +4 -2
- package/lib/cjs/popconfirm/index.js +49 -31
- package/lib/cjs/radio/radio.d.ts +1 -1
- package/lib/cjs/radio/radioGroup.d.ts +1 -1
- package/lib/cjs/tabs/TabBar.js +5 -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/transfer/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/button/buttonGroup.d.ts +1 -0
- package/lib/es/button/buttonGroup.js +50 -3
- package/lib/es/button/index.d.ts +1 -0
- package/lib/es/button/index.js +1 -0
- package/lib/es/carousel/CarouselIndicator.d.ts +1 -1
- package/lib/es/carousel/index.d.ts +1 -1
- package/lib/es/datePicker/dateInput.d.ts +1 -1
- package/lib/es/datePicker/datePicker.d.ts +1 -1
- package/lib/es/datePicker/monthsGrid.d.ts +1 -1
- package/lib/es/form/baseForm.js +0 -1
- package/lib/es/popconfirm/index.d.ts +4 -2
- package/lib/es/popconfirm/index.js +49 -31
- package/lib/es/radio/radio.d.ts +1 -1
- package/lib/es/radio/radioGroup.d.ts +1 -1
- package/lib/es/tabs/TabBar.js +5 -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/transfer/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 +7 -7
- package/popconfirm/_story/popconfirm.stories.js +37 -1
- package/popconfirm/index.tsx +14 -6
- package/tabs/TabBar.tsx +7 -1
- package/transfer/index.tsx +7 -2
package/button/buttonGroup.tsx
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import React, { isValidElement, cloneElement } from 'react';
|
|
1
|
+
import React, { isValidElement, cloneElement, ReactNode } from 'react';
|
|
2
2
|
import BaseComponent, { BaseProps } from '../_base/baseComponent';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import classNames from 'classnames';
|
|
5
5
|
import { cssClasses, strings } from '@douyinfe/semi-foundation/button/constants';
|
|
6
|
-
import {
|
|
6
|
+
import { get } from 'lodash';
|
|
7
|
+
import { Type, Size, ButtonProps } from './Button';
|
|
7
8
|
|
|
8
9
|
import '@douyinfe/semi-foundation/button/button.scss';
|
|
9
10
|
|
|
@@ -39,9 +40,41 @@ export default class ButtonGroup extends BaseComponent<ButtonGroupProps> {
|
|
|
39
40
|
size: 'default',
|
|
40
41
|
};
|
|
41
42
|
|
|
43
|
+
getInnerWithLine(inner) {
|
|
44
|
+
const innerWithLine: ReactNode[] = [];
|
|
45
|
+
let lineCls = `${prefixCls}-group-line`;
|
|
46
|
+
if (inner.length > 1) {
|
|
47
|
+
inner.slice(0, -1).forEach(item => {
|
|
48
|
+
const isButtonType = get(item, 'type.elementType') === 'Button';
|
|
49
|
+
const buttonProps = get(item, 'props') as ButtonProps;
|
|
50
|
+
if (buttonProps) {
|
|
51
|
+
const { type, theme, disabled } = buttonProps;
|
|
52
|
+
lineCls = classNames(
|
|
53
|
+
`${prefixCls}-group-line`,
|
|
54
|
+
`${prefixCls}-group-line-${theme ?? 'light'}`,
|
|
55
|
+
`${prefixCls}-group-line-${type ?? 'primary'}`,
|
|
56
|
+
{
|
|
57
|
+
[`${prefixCls}-group-line-disabled`]: disabled,
|
|
58
|
+
}
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
if (isButtonType) {
|
|
62
|
+
innerWithLine.push(item, <span className={lineCls} />);
|
|
63
|
+
} else {
|
|
64
|
+
innerWithLine.push(item);
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
innerWithLine.push(inner.slice(-1));
|
|
68
|
+
return innerWithLine;
|
|
69
|
+
} else {
|
|
70
|
+
return inner;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
42
74
|
render() {
|
|
43
75
|
const { children, disabled, size, type, className, 'aria-label': ariaLabel, ...rest } = this.props;
|
|
44
|
-
let inner;
|
|
76
|
+
let inner: ReactNode[];
|
|
77
|
+
let innerWithLine: ReactNode[] = [];
|
|
45
78
|
const cls = classNames(`${prefixCls}-group`, className);
|
|
46
79
|
|
|
47
80
|
if (children) {
|
|
@@ -50,7 +83,8 @@ export default class ButtonGroup extends BaseComponent<ButtonGroupProps> {
|
|
|
50
83
|
? cloneElement(itm, { disabled, size, type, ...itm.props, ...rest, key: index })
|
|
51
84
|
: itm
|
|
52
85
|
));
|
|
86
|
+
innerWithLine = this.getInnerWithLine(inner);
|
|
53
87
|
}
|
|
54
|
-
return <div className={cls} role="group" aria-label={ariaLabel}>{
|
|
88
|
+
return <div className={cls} role="group" aria-label={ariaLabel}>{innerWithLine}</div>;
|
|
55
89
|
}
|
|
56
90
|
}
|
package/button/index.tsx
CHANGED
|
@@ -18,6 +18,7 @@ class Button extends React.PureComponent<ButtonProps> {
|
|
|
18
18
|
...BaseButton.propTypes,
|
|
19
19
|
...IconButton.propTypes,
|
|
20
20
|
};
|
|
21
|
+
static elementType: string;
|
|
21
22
|
constructor(props = {}) {
|
|
22
23
|
super(props);
|
|
23
24
|
}
|
|
@@ -34,5 +35,6 @@ class Button extends React.PureComponent<ButtonProps> {
|
|
|
34
35
|
}
|
|
35
36
|
}
|
|
36
37
|
}
|
|
38
|
+
Button.elementType = 'Button';
|
|
37
39
|
|
|
38
40
|
export default Button;
|
package/dist/css/semi.css
CHANGED
|
@@ -1778,6 +1778,10 @@ body {
|
|
|
1778
1778
|
.semi-button-block {
|
|
1779
1779
|
width: 100%;
|
|
1780
1780
|
}
|
|
1781
|
+
.semi-button-group {
|
|
1782
|
+
display: flex;
|
|
1783
|
+
flex-wrap: wrap;
|
|
1784
|
+
}
|
|
1781
1785
|
.semi-button-group > .semi-button {
|
|
1782
1786
|
margin: 0;
|
|
1783
1787
|
padding-left: 0;
|
|
@@ -1816,13 +1820,46 @@ body {
|
|
|
1816
1820
|
border-top-left-radius: var(--semi-border-radius-small);
|
|
1817
1821
|
border-bottom-left-radius: var(--semi-border-radius-small);
|
|
1818
1822
|
}
|
|
1819
|
-
.semi-button-group > .semi-button:not(:last-child) .semi-button-content {
|
|
1820
|
-
border-right: 1px var(--semi-color-border) solid;
|
|
1821
|
-
}
|
|
1822
1823
|
.semi-button-group > .semi-button:last-child {
|
|
1823
1824
|
border-top-right-radius: var(--semi-border-radius-small);
|
|
1824
1825
|
border-bottom-right-radius: var(--semi-border-radius-small);
|
|
1825
1826
|
}
|
|
1827
|
+
.semi-button-group-line {
|
|
1828
|
+
display: inline-flex;
|
|
1829
|
+
align-items: center;
|
|
1830
|
+
background-color: var(--semi-color-border);
|
|
1831
|
+
}
|
|
1832
|
+
.semi-button-group-line-primary {
|
|
1833
|
+
background-color: var(--semi-color-primary);
|
|
1834
|
+
}
|
|
1835
|
+
.semi-button-group-line-secondary {
|
|
1836
|
+
background-color: var(--semi-color-secondary);
|
|
1837
|
+
}
|
|
1838
|
+
.semi-button-group-line-tertiary {
|
|
1839
|
+
background-color: var(--semi-color-tertiary);
|
|
1840
|
+
}
|
|
1841
|
+
.semi-button-group-line-warning {
|
|
1842
|
+
background-color: var(--semi-color-warning);
|
|
1843
|
+
}
|
|
1844
|
+
.semi-button-group-line-danger {
|
|
1845
|
+
background-color: var(--semi-color-danger);
|
|
1846
|
+
}
|
|
1847
|
+
.semi-button-group-line-disabled {
|
|
1848
|
+
background-color: var(--semi-color-disabled-bg);
|
|
1849
|
+
}
|
|
1850
|
+
.semi-button-group-line-light {
|
|
1851
|
+
background-color: var(--semi-color-fill-0);
|
|
1852
|
+
}
|
|
1853
|
+
.semi-button-group-line-borderless {
|
|
1854
|
+
background-color: transparent;
|
|
1855
|
+
}
|
|
1856
|
+
.semi-button-group-line::before {
|
|
1857
|
+
display: block;
|
|
1858
|
+
content: "";
|
|
1859
|
+
width: 1px;
|
|
1860
|
+
height: 20px;
|
|
1861
|
+
background-color: var(--semi-color-border);
|
|
1862
|
+
}
|
|
1826
1863
|
|
|
1827
1864
|
.semi-rtl .semi-button,
|
|
1828
1865
|
.semi-portal-rtl .semi-button {
|