@douyinfe/semi-ui 2.10.0-beta.0 → 2.10.2-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.
Files changed (56) 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/checkbox/checkbox.tsx +1 -3
  7. package/checkbox/checkboxInner.tsx +19 -14
  8. package/datePicker/monthsGrid.tsx +8 -8
  9. package/dist/css/semi.css +5 -4
  10. package/dist/css/semi.min.css +1 -1
  11. package/dist/umd/semi-ui.js +711 -547
  12. package/dist/umd/semi-ui.js.map +1 -1
  13. package/dist/umd/semi-ui.min.js +1 -1
  14. package/dist/umd/semi-ui.min.js.map +1 -1
  15. package/form/baseForm.tsx +10 -2
  16. package/form/hoc/withField.tsx +17 -5
  17. package/inputNumber/__test__/inputNumber.test.js +40 -3
  18. package/inputNumber/_story/inputNumber.stories.js +56 -1
  19. package/inputNumber/index.tsx +22 -14
  20. package/lib/cjs/button/buttonGroup.d.ts +1 -1
  21. package/lib/cjs/carousel/CarouselArrow.js +3 -6
  22. package/lib/cjs/carousel/index.js +1 -3
  23. package/lib/cjs/carousel/interface.d.ts +1 -2
  24. package/lib/cjs/checkbox/checkbox.js +1 -2
  25. package/lib/cjs/checkbox/checkboxInner.js +21 -17
  26. package/lib/cjs/datePicker/monthsGrid.js +6 -6
  27. package/lib/cjs/form/baseForm.d.ts +1 -0
  28. package/lib/cjs/form/baseForm.js +10 -2
  29. package/lib/cjs/form/hoc/withField.js +8 -1
  30. package/lib/cjs/inputNumber/index.d.ts +2 -6
  31. package/lib/cjs/inputNumber/index.js +27 -11
  32. package/lib/cjs/tooltip/index.d.ts +1 -0
  33. package/lib/cjs/tooltip/index.js +9 -6
  34. package/lib/cjs/transfer/index.js +5 -5
  35. package/lib/cjs/treeSelect/index.js +1 -1
  36. package/lib/es/button/buttonGroup.d.ts +1 -1
  37. package/lib/es/carousel/CarouselArrow.js +3 -5
  38. package/lib/es/carousel/index.js +1 -3
  39. package/lib/es/carousel/interface.d.ts +1 -2
  40. package/lib/es/checkbox/checkbox.js +1 -2
  41. package/lib/es/checkbox/checkboxInner.js +20 -17
  42. package/lib/es/datePicker/monthsGrid.js +7 -7
  43. package/lib/es/form/baseForm.d.ts +1 -0
  44. package/lib/es/form/baseForm.js +10 -2
  45. package/lib/es/form/hoc/withField.js +8 -1
  46. package/lib/es/inputNumber/index.d.ts +2 -6
  47. package/lib/es/inputNumber/index.js +26 -11
  48. package/lib/es/tooltip/index.d.ts +1 -0
  49. package/lib/es/tooltip/index.js +9 -6
  50. package/lib/es/transfer/index.js +1 -1
  51. package/lib/es/treeSelect/index.js +1 -1
  52. package/package.json +9 -9
  53. package/popover/_story/popover.stories.js +38 -2
  54. package/tooltip/index.tsx +9 -2
  55. package/transfer/index.tsx +1 -1
  56. 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 {
@@ -171,6 +171,7 @@ class Checkbox extends BaseComponent<CheckboxProps, CheckboxState> {
171
171
  const { isCardType, isPureCardType } = this.context.checkboxGroup;
172
172
  props.isCardType = isCardType;
173
173
  props.isPureCardType = isPureCardType;
174
+ props['name'] = this.context.checkboxGroup.name;
174
175
  }
175
176
 
176
177
  const prefix = prefixCls || css.PREFIX;
@@ -192,8 +193,6 @@ class Checkbox extends BaseComponent<CheckboxProps, CheckboxState> {
192
193
  [`${prefix}-cardType_extra_noChildren`]: props.isCardType && !children,
193
194
  });
194
195
 
195
- const name = inGroup && this.context.checkboxGroup.name;
196
-
197
196
  const renderContent = () => (
198
197
  <>
199
198
  {children ? <span id={this.addonId} className={`${prefix}-addon`}>{children}</span> : null}
@@ -220,7 +219,6 @@ class Checkbox extends BaseComponent<CheckboxProps, CheckboxState> {
220
219
  {...props}
221
220
  addonId={children && this.addonId}
222
221
  extraId={extra && this.extraId}
223
- name={name}
224
222
  isPureCardType={props.isPureCardType}
225
223
  ref={ref => {
226
224
  this.checkboxEntity = ref;
@@ -81,26 +81,31 @@ class CheckboxInner extends PureComponent<CheckboxInnerProps> {
81
81
  <IconCheckboxIndeterminate />
82
82
  ) : null;
83
83
 
84
+ const inputProps: React.InputHTMLAttributes<HTMLInputElement> = {
85
+ type: "checkbox",
86
+ 'aria-label': this.props['aria-label'],
87
+ 'aria-disabled': disabled,
88
+ 'aria-checked': checked,
89
+ 'aria-labelledby': addonId,
90
+ 'aria-describedby':extraId || this.props['aria-describedby'],
91
+ 'aria-invalid': this.props['aria-invalid'],
92
+ 'aria-errormessage': this.props['aria-errormessage'],
93
+ 'aria-required': this.props['aria-required'],
94
+ className: css.INPUT,
95
+ onChange: noop,
96
+ checked: checked,
97
+ disabled: disabled,
98
+ };
99
+
100
+ name && (inputProps['name'] = name);
101
+
84
102
  return (
85
103
  <span className={wrapper}>
86
104
  <input
87
- type="checkbox"
88
- aria-label={this.props['aria-label']}
89
- aria-disabled={disabled}
90
- aria-checked={checked}
91
- aria-labelledby={addonId}
92
- aria-describedby={extraId || this.props['aria-describedby']}
93
- aria-invalid={this.props['aria-invalid']}
94
- aria-errormessage={this.props['aria-errormessage']}
95
- aria-required={this.props['aria-required']}
105
+ {...inputProps}
96
106
  ref={ref => {
97
107
  this.inputEntity = ref;
98
108
  }}
99
- className={css.INPUT}
100
- onChange={noop}
101
- checked={checked}
102
- disabled={disabled}
103
- name={name}
104
109
  />
105
110
  <span className={inner}>{icon}</span>
106
111
  </span>
@@ -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
@@ -1,3 +1,4 @@
1
+ @charset "UTF-8";
1
2
  /* shadow */
2
3
  /* sizing */
3
4
  /* spacing */
@@ -2864,7 +2865,7 @@ body[theme-mode=dark], body .semi-always-dark {
2864
2865
 
2865
2866
  @keyframes semi-carousel-content-item-keyframe-slide-in {
2866
2867
  from {
2867
- transform: translateX(-100%);
2868
+ transform: translateX(100%);
2868
2869
  }
2869
2870
  to {
2870
2871
  transform: translateX(0);
@@ -2875,12 +2876,12 @@ body[theme-mode=dark], body .semi-always-dark {
2875
2876
  transform: translateX(0);
2876
2877
  }
2877
2878
  to {
2878
- transform: translateX(100%);
2879
+ transform: translateX(-100%);
2879
2880
  }
2880
2881
  }
2881
2882
  @keyframes semi-carousel-content-item-keyframe-slide-in-reverse {
2882
2883
  from {
2883
- transform: translateX(100%);
2884
+ transform: translateX(-100%);
2884
2885
  }
2885
2886
  to {
2886
2887
  transform: translateX(0);
@@ -2891,7 +2892,7 @@ body[theme-mode=dark], body .semi-always-dark {
2891
2892
  transform: translateX(0);
2892
2893
  }
2893
2894
  to {
2894
- transform: translateX(-100%);
2895
+ transform: translateX(100%);
2895
2896
  }
2896
2897
  }
2897
2898
  .semi-rtl .semi-carousel,