@douyinfe/semi-ui 2.19.0-alpha.4 → 2.19.0-alpha.5
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/checkbox/_story/checkbox.stories.js +0 -2
- package/checkbox/checkbox.tsx +19 -22
- package/dist/css/semi.css +44 -11
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +111 -120
- 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 +1 -0
- package/lib/cjs/button/buttonGroup.d.ts +1 -0
- package/lib/cjs/button/buttonGroup.js +56 -3
- package/lib/cjs/checkbox/checkbox.js +10 -18
- package/lib/cjs/form/baseForm.js +1 -0
- package/lib/cjs/popconfirm/index.d.ts +2 -4
- package/lib/cjs/popconfirm/index.js +31 -49
- package/lib/cjs/tabs/TabBar.js +1 -5
- package/lib/cjs/transfer/index.js +2 -7
- package/lib/es/button/buttonGroup.d.ts +1 -0
- package/lib/es/button/buttonGroup.js +53 -3
- package/lib/es/checkbox/checkbox.js +10 -18
- package/lib/es/form/baseForm.js +1 -0
- package/lib/es/popconfirm/index.d.ts +2 -4
- package/lib/es/popconfirm/index.js +31 -49
- package/lib/es/tabs/TabBar.js +1 -5
- package/lib/es/transfer/index.js +2 -7
- package/package.json +7 -7
- package/popconfirm/_story/popconfirm.stories.js +1 -37
- package/popconfirm/index.tsx +6 -14
- package/tabs/TabBar.tsx +1 -7
- package/transfer/index.tsx +2 -7
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.displayName'), get(item, 'type.name')].includes('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/checkbox/checkbox.tsx
CHANGED
|
@@ -235,27 +235,20 @@ class Checkbox extends BaseComponent<CheckboxProps, CheckboxState> {
|
|
|
235
235
|
const name = inGroup && this.context.checkboxGroup.name;
|
|
236
236
|
const xSemiPropChildren = this.props['x-semi-children-alias'] || 'children';
|
|
237
237
|
|
|
238
|
-
const renderContent = () =>
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
{extra}
|
|
253
|
-
</div>
|
|
254
|
-
) : null}
|
|
255
|
-
</div>
|
|
256
|
-
);
|
|
257
|
-
};
|
|
258
|
-
|
|
238
|
+
const renderContent = () => (
|
|
239
|
+
<>
|
|
240
|
+
{children ? (
|
|
241
|
+
<span id={addonId} className={`${prefix}-addon`} x-semi-prop={xSemiPropChildren}>
|
|
242
|
+
{children}
|
|
243
|
+
</span>
|
|
244
|
+
) : null}
|
|
245
|
+
{extra ? (
|
|
246
|
+
<div id={extraId} className={extraCls} x-semi-prop="extra">
|
|
247
|
+
{extra}
|
|
248
|
+
</div>
|
|
249
|
+
) : null}
|
|
250
|
+
</>
|
|
251
|
+
);
|
|
259
252
|
return (
|
|
260
253
|
// label is better than span, however span is here which is to solve gitlab issue #364
|
|
261
254
|
<span
|
|
@@ -283,7 +276,11 @@ class Checkbox extends BaseComponent<CheckboxProps, CheckboxState> {
|
|
|
283
276
|
onInputFocus={this.handleFocusVisible}
|
|
284
277
|
onInputBlur={this.handleBlur}
|
|
285
278
|
/>
|
|
286
|
-
{
|
|
279
|
+
{
|
|
280
|
+
props.isCardType ?
|
|
281
|
+
<div>{renderContent()}</div> :
|
|
282
|
+
renderContent()
|
|
283
|
+
}
|
|
287
284
|
</span>
|
|
288
285
|
);
|
|
289
286
|
}
|
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 {
|
|
@@ -3471,7 +3508,7 @@ body {
|
|
|
3471
3508
|
box-sizing: border-box;
|
|
3472
3509
|
position: relative;
|
|
3473
3510
|
display: flex;
|
|
3474
|
-
align-items:
|
|
3511
|
+
align-items: center;
|
|
3475
3512
|
flex-wrap: wrap;
|
|
3476
3513
|
font-size: 14px;
|
|
3477
3514
|
line-height: 20px;
|
|
@@ -3479,7 +3516,6 @@ body {
|
|
|
3479
3516
|
cursor: pointer;
|
|
3480
3517
|
transition: background-color var(--semi-transition_duration-faster) var(--semi-transition_function-easeIn) var(--semi-transition_delay-fastest), border var(--semi-transition_duration-faster) var(--semi-transition_function-easeIn) var(--semi-transition_delay-fastest);
|
|
3481
3518
|
transform: scale(var(--semi-transform_scale-none));
|
|
3482
|
-
column-gap: 8px;
|
|
3483
3519
|
}
|
|
3484
3520
|
.semi-checkbox input[type=checkbox] {
|
|
3485
3521
|
position: absolute;
|
|
@@ -3490,16 +3526,11 @@ body {
|
|
|
3490
3526
|
margin: 0;
|
|
3491
3527
|
opacity: 0;
|
|
3492
3528
|
}
|
|
3493
|
-
.semi-checkbox-content {
|
|
3494
|
-
flex: 1;
|
|
3495
|
-
display: flex;
|
|
3496
|
-
flex-direction: column;
|
|
3497
|
-
row-gap: 4px;
|
|
3498
|
-
}
|
|
3499
3529
|
.semi-checkbox-addon {
|
|
3500
3530
|
display: flex;
|
|
3501
3531
|
flex: 1;
|
|
3502
3532
|
align-items: center;
|
|
3533
|
+
padding-left: 8px;
|
|
3503
3534
|
color: var(--semi-color-text-0);
|
|
3504
3535
|
line-height: 20px;
|
|
3505
3536
|
user-select: none;
|
|
@@ -3728,7 +3759,9 @@ body {
|
|
|
3728
3759
|
flex-grow: 1;
|
|
3729
3760
|
flex-basis: 100%;
|
|
3730
3761
|
box-sizing: border-box;
|
|
3762
|
+
padding-left: 24px;
|
|
3731
3763
|
color: var(--semi-color-text-2);
|
|
3764
|
+
margin-top: 4px;
|
|
3732
3765
|
}
|
|
3733
3766
|
.semi-checkbox-focus {
|
|
3734
3767
|
outline: 2px solid var(--semi-color-primary-light-active);
|