@douyinfe/semi-ui 2.5.1 → 2.7.0-beta.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/__test__/button.test.js +7 -0
- package/button/buttonGroup.tsx +5 -2
- package/calendar/monthCalendar.tsx +14 -13
- package/cascader/__test__/cascader.test.js +159 -81
- package/cascader/_story/cascader.stories.js +36 -23
- package/cascader/index.tsx +47 -8
- package/cascader/item.tsx +25 -5
- package/datePicker/_story/v2/InsetInput.jsx +104 -0
- package/datePicker/_story/v2/InsetInputE2E.jsx +69 -0
- package/datePicker/_story/v2/index.js +2 -0
- package/datePicker/dateInput.tsx +102 -13
- package/datePicker/datePicker.tsx +95 -16
- package/datePicker/index.tsx +15 -0
- package/datePicker/insetInput.tsx +76 -0
- package/datePicker/month.tsx +14 -7
- package/datePicker/monthsGrid.tsx +31 -12
- package/datePicker/navigation.tsx +8 -4
- package/datePicker/quickControl.tsx +1 -0
- package/datePicker/yearAndMonth.tsx +1 -1
- package/dist/css/semi.css +120 -8
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +1100 -193
- 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 +1 -1
- package/input/_story/input.stories.js +13 -0
- package/lib/cjs/_base/base.css +5 -5
- package/lib/cjs/button/buttonGroup.d.ts +1 -0
- package/lib/cjs/button/buttonGroup.js +6 -2
- package/lib/cjs/calendar/monthCalendar.js +21 -5
- package/lib/cjs/cascader/index.d.ts +10 -2
- package/lib/cjs/cascader/index.js +52 -10
- package/lib/cjs/cascader/item.d.ts +6 -2
- package/lib/cjs/cascader/item.js +33 -4
- package/lib/cjs/datePicker/dateInput.d.ts +9 -4
- package/lib/cjs/datePicker/dateInput.js +107 -13
- package/lib/cjs/datePicker/datePicker.d.ts +7 -2
- package/lib/cjs/datePicker/datePicker.js +138 -30
- package/lib/cjs/datePicker/index.js +24 -2
- package/lib/cjs/datePicker/insetInput.d.ts +21 -0
- package/lib/cjs/datePicker/insetInput.js +80 -0
- package/lib/cjs/datePicker/month.d.ts +1 -0
- package/lib/cjs/datePicker/month.js +18 -2
- package/lib/cjs/datePicker/monthsGrid.js +35 -11
- package/lib/cjs/datePicker/navigation.js +8 -0
- package/lib/cjs/datePicker/quickControl.js +1 -0
- package/lib/cjs/datePicker/yearAndMonth.js +1 -0
- package/lib/cjs/form/hoc/withField.js +1 -1
- package/lib/cjs/navigation/Item.d.ts +2 -2
- package/lib/cjs/navigation/Item.js +8 -6
- package/lib/cjs/navigation/SubNav.js +2 -2
- package/lib/cjs/scrollList/scrollItem.d.ts +2 -1
- package/lib/cjs/scrollList/scrollItem.js +13 -3
- package/lib/cjs/table/Body/index.d.ts +2 -0
- package/lib/cjs/table/Body/index.js +13 -4
- package/lib/cjs/tree/index.js +5 -3
- package/lib/cjs/tree/interface.d.ts +1 -0
- package/lib/cjs/tree/nodeList.js +2 -1
- package/lib/cjs/treeSelect/index.js +7 -3
- package/lib/es/_base/base.css +5 -5
- package/lib/es/button/buttonGroup.d.ts +1 -0
- package/lib/es/button/buttonGroup.js +5 -2
- package/lib/es/calendar/monthCalendar.js +22 -5
- package/lib/es/cascader/index.d.ts +10 -2
- package/lib/es/cascader/index.js +49 -7
- package/lib/es/cascader/item.d.ts +6 -2
- package/lib/es/cascader/item.js +31 -4
- package/lib/es/datePicker/dateInput.d.ts +9 -4
- package/lib/es/datePicker/dateInput.js +106 -13
- package/lib/es/datePicker/datePicker.d.ts +7 -2
- package/lib/es/datePicker/datePicker.js +139 -30
- package/lib/es/datePicker/index.js +20 -0
- package/lib/es/datePicker/insetInput.d.ts +21 -0
- package/lib/es/datePicker/insetInput.js +65 -0
- package/lib/es/datePicker/month.d.ts +1 -0
- package/lib/es/datePicker/month.js +18 -2
- package/lib/es/datePicker/monthsGrid.js +35 -11
- package/lib/es/datePicker/navigation.js +8 -0
- package/lib/es/datePicker/quickControl.js +2 -0
- package/lib/es/datePicker/yearAndMonth.js +1 -0
- package/lib/es/form/hoc/withField.js +1 -1
- package/lib/es/navigation/Item.d.ts +2 -2
- package/lib/es/navigation/Item.js +8 -6
- package/lib/es/navigation/SubNav.js +2 -2
- package/lib/es/scrollList/scrollItem.d.ts +2 -1
- package/lib/es/scrollList/scrollItem.js +13 -3
- package/lib/es/table/Body/index.d.ts +2 -0
- package/lib/es/table/Body/index.js +13 -4
- package/lib/es/tree/index.js +5 -3
- package/lib/es/tree/interface.d.ts +1 -0
- package/lib/es/tree/nodeList.js +2 -1
- package/lib/es/treeSelect/index.js +7 -3
- package/navigation/Item.tsx +15 -12
- package/navigation/SubNav.tsx +4 -4
- package/package.json +9 -9
- package/scrollList/_story/ScrollList/index.js +3 -0
- package/scrollList/_story/WheelList/index.js +3 -0
- package/scrollList/scrollItem.tsx +30 -9
- package/table/Body/index.tsx +15 -4
- package/table/__test__/table.test.js +18 -0
- package/table/_story/v2/FixedExpandedRow/index.jsx +95 -0
- package/table/_story/v2/index.js +2 -1
- package/tree/__test__/tree.test.js +87 -2
- package/tree/_story/tree.stories.js +65 -5
- package/tree/index.tsx +4 -2
- package/tree/interface.ts +1 -0
- package/tree/nodeList.tsx +2 -2
- package/treeSelect/__test__/treeSelect.test.js +28 -0
- package/treeSelect/_story/treeSelect.stories.js +55 -2
- package/treeSelect/index.tsx +11 -3
|
@@ -8,6 +8,7 @@ describe('Button', () => {
|
|
|
8
8
|
it('button with custom className & style', () => {
|
|
9
9
|
const wrapper = mount(<Button className="test" style={{ color: 'red' }} />);
|
|
10
10
|
expect(wrapper.hasClass('test')).toEqual(true);
|
|
11
|
+
expect(wrapper.find('button').getDOMNode().style.color).toBe('red');
|
|
11
12
|
});
|
|
12
13
|
|
|
13
14
|
it(`button with icon`, () => {
|
|
@@ -61,4 +62,10 @@ describe('Button', () => {
|
|
|
61
62
|
);
|
|
62
63
|
expect(buttonGroup.getDOMNode().textContent).toEqual('1查询剪切');
|
|
63
64
|
});
|
|
65
|
+
|
|
66
|
+
it('button group with custom className & style', () => {
|
|
67
|
+
const wrapper = mount(<ButtonGroup className="test" style={{ color: 'red' }} />);
|
|
68
|
+
expect(wrapper.hasClass('test')).toEqual(true);
|
|
69
|
+
expect(wrapper.find('button').getDOMNode().style.color).toBe('red');
|
|
70
|
+
});
|
|
64
71
|
});
|
package/button/buttonGroup.tsx
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { isValidElement, cloneElement } from 'react';
|
|
2
2
|
import BaseComponent, { BaseProps } from '../_base/baseComponent';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
|
+
import classNames from 'classnames';
|
|
4
5
|
import { cssClasses, strings } from '@douyinfe/semi-foundation/button/constants';
|
|
5
6
|
import { Type, Size } from './Button';
|
|
6
7
|
|
|
@@ -13,6 +14,7 @@ export interface ButtonGroupProps extends BaseProps {
|
|
|
13
14
|
type?: Type;
|
|
14
15
|
size?: Size;
|
|
15
16
|
theme?: Theme;
|
|
17
|
+
className?: string;
|
|
16
18
|
'aria-label'?: React.AriaAttributes['aria-label'];
|
|
17
19
|
}
|
|
18
20
|
|
|
@@ -36,8 +38,9 @@ export default class ButtonGroup extends BaseComponent<ButtonGroupProps> {
|
|
|
36
38
|
};
|
|
37
39
|
|
|
38
40
|
render() {
|
|
39
|
-
const { children, disabled, size, type, 'aria-label': ariaLabel, ...rest } = this.props;
|
|
41
|
+
const { children, disabled, size, type, className, 'aria-label': ariaLabel, ...rest } = this.props;
|
|
40
42
|
let inner;
|
|
43
|
+
const cls = classNames(`${prefixCls}-group`, className);
|
|
41
44
|
|
|
42
45
|
if (children) {
|
|
43
46
|
inner = ((Array.isArray(children) ? children : [children])).map((itm, index) => (
|
|
@@ -46,6 +49,6 @@ export default class ButtonGroup extends BaseComponent<ButtonGroupProps> {
|
|
|
46
49
|
: itm
|
|
47
50
|
));
|
|
48
51
|
}
|
|
49
|
-
return <div className={
|
|
52
|
+
return <div className={cls} role="group" aria-label={ariaLabel}>{inner}</div>;
|
|
50
53
|
}
|
|
51
54
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable jsx-a11y/no-noninteractive-element-to-interactive-role */
|
|
1
2
|
import React, { ReactInstance } from 'react';
|
|
2
3
|
import ReactDOM from 'react-dom';
|
|
3
4
|
import cls from 'classnames';
|
|
@@ -180,16 +181,16 @@ export default class monthCalendar extends BaseComponent<MonthCalendarProps, Mon
|
|
|
180
181
|
const { markWeekend, displayValue } = this.props;
|
|
181
182
|
this.monthlyData = this.foundation.getMonthlyData(displayValue, dateFnsLocale);
|
|
182
183
|
return (
|
|
183
|
-
<div className={`${prefixCls}-header`}>
|
|
184
|
-
<div role="
|
|
185
|
-
<ul className={`${prefixCls}-grid-row`}>
|
|
184
|
+
<div className={`${prefixCls}-header`} role="presentation">
|
|
185
|
+
<div role="presentation" className={`${prefixCls}-grid`}>
|
|
186
|
+
<ul role="row" className={`${prefixCls}-grid-row`}>
|
|
186
187
|
{this.monthlyData[0].map(day => {
|
|
187
188
|
const { weekday } = day;
|
|
188
189
|
const listCls = cls({
|
|
189
190
|
[`${cssClasses.PREFIX}-weekend`]: markWeekend && day.isWeekend,
|
|
190
191
|
});
|
|
191
192
|
return (
|
|
192
|
-
<li key={`${weekday}-monthheader`} className={listCls}>
|
|
193
|
+
<li role="columnheader" aria-label={weekday} key={`${weekday}-monthheader`} className={listCls}>
|
|
193
194
|
<span>{weekday}</span>
|
|
194
195
|
</li>
|
|
195
196
|
);
|
|
@@ -268,7 +269,7 @@ export default class monthCalendar extends BaseComponent<MonthCalendarProps, Mon
|
|
|
268
269
|
const pos = showCard && showCard[key] ? showCard[key][1] : 'leftTopOver';
|
|
269
270
|
const text = (
|
|
270
271
|
<LocaleConsumer componentName="Calendar">
|
|
271
|
-
{(locale: Locale['Calendar']) => (
|
|
272
|
+
{(locale: Locale['Calendar']) => (// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
272
273
|
<div
|
|
273
274
|
className={`${cardCls}-wrapper`}
|
|
274
275
|
style={{ bottom: 0 }}
|
|
@@ -330,8 +331,8 @@ export default class monthCalendar extends BaseComponent<MonthCalendarProps, Mon
|
|
|
330
331
|
const { itemLimit } = this.state;
|
|
331
332
|
const { display, day } = events;
|
|
332
333
|
return (
|
|
333
|
-
<div role="
|
|
334
|
-
<ul className={`${prefixCls}-skeleton`}>
|
|
334
|
+
<div role="presentation" className={`${prefixCls}-weekrow`} ref={this.cellDom} key={`${index}-weekrow`}>
|
|
335
|
+
<ul role="row" className={`${prefixCls}-skeleton`}>
|
|
335
336
|
{weekDay.map(each => {
|
|
336
337
|
const { date, dayString, isToday, isSameMonth, isWeekend, month, ind } = each;
|
|
337
338
|
const listCls = cls({
|
|
@@ -341,7 +342,7 @@ export default class monthCalendar extends BaseComponent<MonthCalendarProps, Mon
|
|
|
341
342
|
});
|
|
342
343
|
const shouldRenderCollapsed = Boolean(day && day[ind] && day[ind].length > itemLimit);
|
|
343
344
|
const inner = (
|
|
344
|
-
<li key={`${date}-weeksk`} className={listCls} onClick={e => this.handleClick(e, [date])}>
|
|
345
|
+
<li role="gridcell" aria-label={date.toLocaleDateString()} aria-current={isToday ? "date" : false} key={`${date}-weeksk`} className={listCls} onClick={e => this.handleClick(e, [date])}>
|
|
345
346
|
{this.formatDayString(month, dayString)}
|
|
346
347
|
{this.renderCusDateGrid(date)}
|
|
347
348
|
</li>
|
|
@@ -362,8 +363,8 @@ export default class monthCalendar extends BaseComponent<MonthCalendarProps, Mon
|
|
|
362
363
|
renderMonthGrid = () => {
|
|
363
364
|
const { parsedEvents } = this.state;
|
|
364
365
|
return (
|
|
365
|
-
<div role="
|
|
366
|
-
<ul className={`${prefixCls}-grid-col`}>
|
|
366
|
+
<div role="presentation" className={`${prefixCls}-week`}>
|
|
367
|
+
<ul role="presentation" className={`${prefixCls}-grid-col`}>
|
|
367
368
|
{Object.keys(this.monthlyData).map(weekInd =>
|
|
368
369
|
this.renderWeekRow(weekInd, this.monthlyData[weekInd], parsedEvents[weekInd])
|
|
369
370
|
)}
|
|
@@ -383,12 +384,12 @@ export default class monthCalendar extends BaseComponent<MonthCalendarProps, Mon
|
|
|
383
384
|
return (
|
|
384
385
|
<LocaleConsumer componentName="Calendar">
|
|
385
386
|
{(locale: Locale['Calendar'], localeCode: string, dateFnsLocale: Locale['dateFnsLocale']) => (
|
|
386
|
-
<div className={monthCls} key={this.state.itemLimit} style={monthStyle}>
|
|
387
|
-
<div className={`${prefixCls}-sticky-top`}>
|
|
387
|
+
<div role="grid" className={monthCls} key={this.state.itemLimit} style={monthStyle}>
|
|
388
|
+
<div role="presentation" className={`${prefixCls}-sticky-top`}>
|
|
388
389
|
{header}
|
|
389
390
|
{this.renderHeader(dateFnsLocale)}
|
|
390
391
|
</div>
|
|
391
|
-
<div className={`${prefixCls}-grid-wrapper`}>
|
|
392
|
+
<div role="presentation" className={`${prefixCls}-grid-wrapper`}>
|
|
392
393
|
{this.renderMonthGrid()}
|
|
393
394
|
</div>
|
|
394
395
|
</div>
|