@douyinfe/semi-ui 2.10.0-beta.0 → 2.10.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.
Files changed (44) hide show
  1. package/button/buttonGroup.tsx +2 -2
  2. package/carousel/CarouselArrow.tsx +4 -4
  3. package/carousel/CarouselIndicator.tsx +0 -1
  4. package/carousel/index.tsx +1 -3
  5. package/carousel/interface.ts +1 -2
  6. package/datePicker/monthsGrid.tsx +8 -8
  7. package/dist/css/semi.css +4 -4
  8. package/dist/css/semi.min.css +1 -1
  9. package/dist/umd/semi-ui.js +365 -211
  10. package/dist/umd/semi-ui.js.map +1 -1
  11. package/dist/umd/semi-ui.min.js +1 -1
  12. package/dist/umd/semi-ui.min.js.map +1 -1
  13. package/form/baseForm.tsx +10 -1
  14. package/form/hoc/withField.tsx +17 -5
  15. package/inputNumber/__test__/inputNumber.test.js +40 -3
  16. package/inputNumber/_story/inputNumber.stories.js +56 -1
  17. package/inputNumber/index.tsx +22 -14
  18. package/lib/cjs/button/buttonGroup.d.ts +1 -1
  19. package/lib/cjs/carousel/CarouselArrow.js +3 -6
  20. package/lib/cjs/carousel/index.js +1 -3
  21. package/lib/cjs/carousel/interface.d.ts +1 -2
  22. package/lib/cjs/datePicker/monthsGrid.js +6 -6
  23. package/lib/cjs/form/baseForm.d.ts +1 -0
  24. package/lib/cjs/form/baseForm.js +10 -1
  25. package/lib/cjs/form/hoc/withField.js +8 -1
  26. package/lib/cjs/inputNumber/index.d.ts +2 -6
  27. package/lib/cjs/inputNumber/index.js +27 -11
  28. package/lib/cjs/transfer/index.js +5 -5
  29. package/lib/cjs/treeSelect/index.js +1 -1
  30. package/lib/es/button/buttonGroup.d.ts +1 -1
  31. package/lib/es/carousel/CarouselArrow.js +3 -5
  32. package/lib/es/carousel/index.js +1 -3
  33. package/lib/es/carousel/interface.d.ts +1 -2
  34. package/lib/es/datePicker/monthsGrid.js +7 -7
  35. package/lib/es/form/baseForm.d.ts +1 -0
  36. package/lib/es/form/baseForm.js +10 -1
  37. package/lib/es/form/hoc/withField.js +8 -1
  38. package/lib/es/inputNumber/index.d.ts +2 -6
  39. package/lib/es/inputNumber/index.js +26 -11
  40. package/lib/es/transfer/index.js +1 -1
  41. package/lib/es/treeSelect/index.js +1 -1
  42. package/package.json +9 -9
  43. package/transfer/index.tsx +1 -1
  44. package/treeSelect/index.tsx +1 -1
@@ -15,7 +15,7 @@ export interface ButtonGroupProps extends BaseProps {
15
15
  size?: Size;
16
16
  theme?: Theme;
17
17
  className?: string;
18
- children?: React.ReactChild;
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.ReactChild, index) => (
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, throttle } from 'lodash';
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, timing } = this.props;
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={throttle(prev, timing)}
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={throttle(next, timing)}
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 = {
@@ -155,7 +155,7 @@ class Carousel extends BaseComponent<CarouselProps, CarouselState> {
155
155
  }
156
156
 
157
157
  onIndicatorChange = (activeIndex: number): void => {
158
- return this.foundation.throttleChange(activeIndex);
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
  );
@@ -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 {
@@ -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 { compatiableParse } from '@douyinfe/semi-foundation/datePicker/_utils/parser';
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 = compatiableParse(rangeStart, dateFormat, undefined, dateFnsLocale)),
480
- (endDate = compatiableParse(rangeEnd, dateFormat, undefined, dateFnsLocale))
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(compatiableParse(rangeStart, dateFormat, undefined, dateFnsLocale), FORMAT_SWITCH_DATE) : '';
553
+ dateText = rangeStart ? formatFn(compatibleParse(rangeStart, dateFormat, undefined, dateFnsLocale), FORMAT_SWITCH_DATE) : '';
554
554
  } else {
555
555
  panelDetail = monthRight;
556
- dateText = rangeEnd ? formatFn(compatiableParse(rangeEnd, dateFormat, undefined, dateFnsLocale), FORMAT_SWITCH_DATE) : '';
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 showSwithIcon = ['default'].includes(density);
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
- {showSwithIcon && <IconCalendar aria-hidden />}
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
- {showSwithIcon && <IconClock aria-hidden />}
595
+ {showSwitchIcon && <IconClock aria-hidden />}
596
596
  <span className={textCls}>{timeText}</span>
597
597
  </div>
598
598
  </div>
package/dist/css/semi.css CHANGED
@@ -2864,7 +2864,7 @@ body[theme-mode=dark], body .semi-always-dark {
2864
2864
 
2865
2865
  @keyframes semi-carousel-content-item-keyframe-slide-in {
2866
2866
  from {
2867
- transform: translateX(-100%);
2867
+ transform: translateX(100%);
2868
2868
  }
2869
2869
  to {
2870
2870
  transform: translateX(0);
@@ -2875,12 +2875,12 @@ body[theme-mode=dark], body .semi-always-dark {
2875
2875
  transform: translateX(0);
2876
2876
  }
2877
2877
  to {
2878
- transform: translateX(100%);
2878
+ transform: translateX(-100%);
2879
2879
  }
2880
2880
  }
2881
2881
  @keyframes semi-carousel-content-item-keyframe-slide-in-reverse {
2882
2882
  from {
2883
- transform: translateX(100%);
2883
+ transform: translateX(-100%);
2884
2884
  }
2885
2885
  to {
2886
2886
  transform: translateX(0);
@@ -2891,7 +2891,7 @@ body[theme-mode=dark], body .semi-always-dark {
2891
2891
  transform: translateX(0);
2892
2892
  }
2893
2893
  to {
2894
- transform: translateX(-100%);
2894
+ transform: translateX(100%);
2895
2895
  }
2896
2896
  }
2897
2897
  .semi-rtl .semi-carousel,