@douyinfe/semi-ui 2.9.0-beta.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/anchor/__test__/anchor.test.js +1 -0
- package/anchor/_story/anchor.stories.js +23 -1
- package/cascader/_story/cascader.stories.js +17 -2
- package/cascader/index.tsx +1 -1
- package/checkbox/_story/checkbox.stories.js +1 -1
- package/checkbox/checkbox.tsx +18 -8
- package/collapse/item.tsx +2 -0
- package/datePicker/_story/datePicker.stories.js +37 -0
- package/dist/css/semi.css +1 -2
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +23386 -23414
- 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/input/__test__/input.test.js +12 -3
- package/input/__test__/textArea.test.js +53 -0
- package/lib/cjs/_portal/index.d.ts +1 -1
- package/lib/cjs/cascader/index.js +1 -1
- package/lib/cjs/checkbox/checkbox.d.ts +4 -0
- package/lib/cjs/checkbox/checkbox.js +25 -13
- package/lib/cjs/collapse/item.js +4 -2
- 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/modal/Modal.js +3 -0
- 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 +4 -0
- package/lib/cjs/tabs/TabPane.js +4 -0
- package/lib/cjs/tabs/index.js +2 -0
- 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/toast.d.ts +1 -1
- 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 +6 -1
- package/lib/cjs/transfer/index.d.ts +1 -0
- package/lib/cjs/transfer/index.js +3 -1
- 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/cascader/index.js +1 -1
- package/lib/es/checkbox/checkbox.d.ts +4 -0
- package/lib/es/checkbox/checkbox.js +25 -13
- package/lib/es/collapse/item.js +4 -2
- 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/modal/Modal.js +3 -0
- 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 +4 -0
- package/lib/es/tabs/TabPane.js +4 -0
- package/lib/es/tabs/index.js +2 -0
- 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/toast.d.ts +1 -1
- 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 +6 -1
- package/lib/es/transfer/index.d.ts +1 -0
- package/lib/es/transfer/index.js +3 -1
- package/lib/es/typography/title.d.ts +1 -1
- package/lib/es/upload/index.d.ts +1 -1
- package/modal/Modal.tsx +2 -0
- package/modal/confirm.tsx +1 -1
- package/overflowList/_story/overflowList.stories.js +44 -0
- package/package.json +9 -9
- package/radio/radio.tsx +17 -7
- package/scrollList/_story/SingleWheelList/index.js +72 -0
- package/scrollList/_story/scrolllist.stories.js +7 -0
- package/scrollList/scrollItem.tsx +3 -0
- package/table/__test__/table.test.js +1 -0
- package/tabs/TabPane.tsx +2 -0
- package/tabs/_story/tabs.stories.js +72 -0
- package/tabs/index.tsx +1 -0
- package/tagInput/_story/tagInput.stories.js +14 -1
- package/tooltip/_story/tooltip.stories.js +127 -15
- package/tooltip/index.tsx +5 -1
- package/transfer/index.tsx +4 -1
- package/typography/__test__/typography.test.js +1 -0
- package/upload/__test__/upload.test.js +2 -0
- package/upload/_story/upload.stories.js +2 -2
|
@@ -23,6 +23,7 @@ describe('Anchor', () => {
|
|
|
23
23
|
it('anchor small size', () => {
|
|
24
24
|
const smallAnchor = mount(<Anchor size="small" />);
|
|
25
25
|
expect(smallAnchor.find(`.${BASE_CLASS_PREFIX}-anchor-size-small`)).toHaveLength(1);
|
|
26
|
+
smallAnchor.unmount();
|
|
26
27
|
});
|
|
27
28
|
|
|
28
29
|
it('anchor rail theme', () => {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import Button from '../../button';
|
|
2
3
|
import { Anchor } from '../../index';
|
|
3
4
|
|
|
4
5
|
export default {
|
|
@@ -264,3 +265,24 @@ export const FixContainerScrollBug1158 = () => (
|
|
|
264
265
|
</div>
|
|
265
266
|
</div>
|
|
266
267
|
);
|
|
268
|
+
|
|
269
|
+
export const AutoCollapse = () => {
|
|
270
|
+
const [href, setHref] = useState('#设计语言');
|
|
271
|
+
return (
|
|
272
|
+
<div>
|
|
273
|
+
<Anchor autoCollapse>
|
|
274
|
+
<Anchor.Link href="#动态展示" title="1. 动态展示">
|
|
275
|
+
<Anchor.Link href="#组件" title="1.1 组件">
|
|
276
|
+
<Anchor.Link href="#头像" title="1.1.1 Avatar" />
|
|
277
|
+
<Anchor.Link href="#按钮" title="1.1.2 Button" />
|
|
278
|
+
<Anchor.Link href="#图标" title="1.1.3 Icon" />
|
|
279
|
+
</Anchor.Link>
|
|
280
|
+
<Anchor.Link href="#物料" title="1.2 物料" />
|
|
281
|
+
<Anchor.Link href="#主题商店" title="1.3 主题商店" />
|
|
282
|
+
</Anchor.Link>
|
|
283
|
+
<Anchor.Link href={href} title="2. 设计语言" />
|
|
284
|
+
</Anchor>
|
|
285
|
+
<Button onClick={()=>{console.log('sdf');setHref('#我改变啦')}}>setHref</Button>
|
|
286
|
+
</div>
|
|
287
|
+
)
|
|
288
|
+
};
|
|
@@ -697,7 +697,8 @@ export const ShowClear = () => {
|
|
|
697
697
|
<Cascader
|
|
698
698
|
style={{ marginLeft: 700, width: 300 }}
|
|
699
699
|
treeData={treeData1}
|
|
700
|
-
placeholder="Please select"
|
|
700
|
+
placeholder="Please select when multiple"
|
|
701
|
+
multiple
|
|
701
702
|
showClear
|
|
702
703
|
/>
|
|
703
704
|
<br />
|
|
@@ -1434,4 +1435,18 @@ export const DynamicTreeData = () => {
|
|
|
1434
1435
|
<br />
|
|
1435
1436
|
</div>
|
|
1436
1437
|
);
|
|
1437
|
-
}
|
|
1438
|
+
}
|
|
1439
|
+
|
|
1440
|
+
|
|
1441
|
+
export const SuperLongList = () => {
|
|
1442
|
+
let treeData = new Array(100).fill().map(() => ({ label: '浙江省', value: 'zhejiang' }));
|
|
1443
|
+
treeData.push({ label: '到底啦', value: 'bottom' })
|
|
1444
|
+
return (
|
|
1445
|
+
<Cascader
|
|
1446
|
+
style={{ width: 300 }}
|
|
1447
|
+
treeData={treeData}
|
|
1448
|
+
placeholder="请选择所在地区"
|
|
1449
|
+
onListScroll={()=>{console.log(123)}}
|
|
1450
|
+
/>
|
|
1451
|
+
);
|
|
1452
|
+
};
|
package/cascader/index.tsx
CHANGED
|
@@ -828,7 +828,7 @@ class Cascader extends BaseComponent<CascaderProps, CascaderState> {
|
|
|
828
828
|
*/
|
|
829
829
|
handleClearEnterPress = (e: KeyboardEvent) => {
|
|
830
830
|
e && e.stopPropagation();
|
|
831
|
-
this.foundation.handleClearEnterPress();
|
|
831
|
+
this.foundation.handleClearEnterPress(e);
|
|
832
832
|
};
|
|
833
833
|
|
|
834
834
|
showClearBtn = () => {
|
package/checkbox/checkbox.tsx
CHANGED
|
@@ -29,9 +29,13 @@ export interface CheckboxProps extends BaseCheckboxProps {
|
|
|
29
29
|
'aria-label'?: React.AriaAttributes['aria-label'];
|
|
30
30
|
role?: React.HTMLAttributes<HTMLSpanElement>['role']; // a11y: wrapper role
|
|
31
31
|
tabIndex?: number; // a11y: wrapper tabIndex
|
|
32
|
+
addonId?: string;
|
|
33
|
+
extraId?: string;
|
|
32
34
|
}
|
|
33
35
|
interface CheckboxState {
|
|
34
36
|
checked: boolean;
|
|
37
|
+
addonId?: string;
|
|
38
|
+
extraId?: string;
|
|
35
39
|
}
|
|
36
40
|
class Checkbox extends BaseComponent<CheckboxProps, CheckboxState> {
|
|
37
41
|
static contextType = Context;
|
|
@@ -89,7 +93,13 @@ class Checkbox extends BaseComponent<CheckboxProps, CheckboxState> {
|
|
|
89
93
|
notifyGroupChange: cbContent => {
|
|
90
94
|
this.context.checkboxGroup.onChange(cbContent);
|
|
91
95
|
},
|
|
92
|
-
getGroupDisabled: () => (this.context && this.context.checkboxGroup.disabled)
|
|
96
|
+
getGroupDisabled: () => (this.context && this.context.checkboxGroup.disabled),
|
|
97
|
+
setAddonId: () => {
|
|
98
|
+
this.setState({ addonId: getUuidShort({ prefix: 'addon' }) });
|
|
99
|
+
},
|
|
100
|
+
setExtraId: () => {
|
|
101
|
+
this.setState({ extraId: getUuidShort({ prefix: 'extra' }) });
|
|
102
|
+
}
|
|
93
103
|
};
|
|
94
104
|
}
|
|
95
105
|
|
|
@@ -103,11 +113,11 @@ class Checkbox extends BaseComponent<CheckboxProps, CheckboxState> {
|
|
|
103
113
|
|
|
104
114
|
this.state = {
|
|
105
115
|
checked: props.checked || props.defaultChecked || checked,
|
|
116
|
+
addonId: props.addonId,
|
|
117
|
+
extraId: props.extraId,
|
|
106
118
|
};
|
|
107
119
|
|
|
108
120
|
this.checkboxEntity = null;
|
|
109
|
-
this.addonId = getUuidShort({ prefix: 'addon' });
|
|
110
|
-
this.extraId = getUuidShort({ prefix: 'extra' });
|
|
111
121
|
this.foundation = new CheckboxFoundation(this.adapter);
|
|
112
122
|
}
|
|
113
123
|
|
|
@@ -153,7 +163,7 @@ class Checkbox extends BaseComponent<CheckboxProps, CheckboxState> {
|
|
|
153
163
|
tabIndex,
|
|
154
164
|
id
|
|
155
165
|
} = this.props;
|
|
156
|
-
const { checked } = this.state;
|
|
166
|
+
const { checked, addonId, extraId } = this.state;
|
|
157
167
|
const props: Record<string, any> = {
|
|
158
168
|
checked,
|
|
159
169
|
disabled,
|
|
@@ -196,8 +206,8 @@ class Checkbox extends BaseComponent<CheckboxProps, CheckboxState> {
|
|
|
196
206
|
|
|
197
207
|
const renderContent = () => (
|
|
198
208
|
<>
|
|
199
|
-
{children ? <span id={
|
|
200
|
-
{extra ? <div id={
|
|
209
|
+
{children ? <span id={addonId} className={`${prefix}-addon`}>{children}</span> : null}
|
|
210
|
+
{extra ? <div id={extraId} className={extraCls}>{extra}</div> : null}
|
|
201
211
|
</>
|
|
202
212
|
);
|
|
203
213
|
return (
|
|
@@ -218,8 +228,8 @@ class Checkbox extends BaseComponent<CheckboxProps, CheckboxState> {
|
|
|
218
228
|
<CheckboxInner
|
|
219
229
|
{...this.props}
|
|
220
230
|
{...props}
|
|
221
|
-
addonId={children &&
|
|
222
|
-
extraId={extra &&
|
|
231
|
+
addonId={children && addonId}
|
|
232
|
+
extraId={extra && extraId}
|
|
223
233
|
name={name}
|
|
224
234
|
isPureCardType={props.isPureCardType}
|
|
225
235
|
ref={ref => {
|
package/collapse/item.tsx
CHANGED
|
@@ -814,3 +814,40 @@ export const FixTriggerRenderClosePanel = () => {
|
|
|
814
814
|
};
|
|
815
815
|
FixTriggerRenderClosePanel.storyName = "fix triggerRender close bug"
|
|
816
816
|
|
|
817
|
+
export const A11yKeyboardDemo = () => {
|
|
818
|
+
const [value, setValue] = useState(new Date('2022-08-08 00:00'));
|
|
819
|
+
const [rangeValue, setRangeValue] = useState([new Date('2022-08-08 00:00'), new Date('2022-08-09 12:00')]);
|
|
820
|
+
|
|
821
|
+
const handleChange = v => {
|
|
822
|
+
console.log('change', v);
|
|
823
|
+
setValue(v);
|
|
824
|
+
};
|
|
825
|
+
|
|
826
|
+
const handleRangeChange = v => {
|
|
827
|
+
console.log('change', v);
|
|
828
|
+
setRangeValue(v);
|
|
829
|
+
};
|
|
830
|
+
|
|
831
|
+
return (
|
|
832
|
+
<Space vertical align='start' data-cy="space">
|
|
833
|
+
<div data-cy="dateRange">
|
|
834
|
+
<DatePicker
|
|
835
|
+
value={rangeValue}
|
|
836
|
+
type="dateRange"
|
|
837
|
+
onChange={handleRangeChange}
|
|
838
|
+
showClear
|
|
839
|
+
/>
|
|
840
|
+
</div>
|
|
841
|
+
<div data-cy="date">
|
|
842
|
+
<DatePicker
|
|
843
|
+
onChange={handleChange}
|
|
844
|
+
showClear
|
|
845
|
+
multiple
|
|
846
|
+
/>
|
|
847
|
+
</div>
|
|
848
|
+
</Space>
|
|
849
|
+
);
|
|
850
|
+
};
|
|
851
|
+
|
|
852
|
+
A11yKeyboardDemo.storyName = "a11y keyboard demo"
|
|
853
|
+
|
package/dist/css/semi.css
CHANGED
|
@@ -4834,7 +4834,6 @@ body[theme-mode=dark], body .semi-always-dark {
|
|
|
4834
4834
|
line-height: 20px;
|
|
4835
4835
|
font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
4836
4836
|
flex-shrink: 0;
|
|
4837
|
-
user-select: none;
|
|
4838
4837
|
}
|
|
4839
4838
|
.semi-form-field-label-disabled {
|
|
4840
4839
|
color: var(--semi-color-disabled-text);
|
|
@@ -18462,7 +18461,7 @@ body[theme-mode=dark], body .semi-always-dark {
|
|
|
18462
18461
|
.semi-transfer-left-empty {
|
|
18463
18462
|
height: 36px;
|
|
18464
18463
|
}
|
|
18465
|
-
.semi-transfer-left .semi-spin {
|
|
18464
|
+
.semi-transfer-left > .semi-spin {
|
|
18466
18465
|
width: 100%;
|
|
18467
18466
|
flex-grow: 1;
|
|
18468
18467
|
}
|