@douyinfe/semi-ui 2.15.2-alpha.0 → 2.17.0-alpha.1

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 (43) hide show
  1. package/button/buttonGroup.tsx +3 -2
  2. package/cascader/index.tsx +5 -1
  3. package/dist/css/semi.css +87 -20
  4. package/dist/css/semi.min.css +1 -1
  5. package/dist/umd/semi-ui.js +358 -223
  6. package/dist/umd/semi-ui.js.map +1 -1
  7. package/dist/umd/semi-ui.min.js +1 -1
  8. package/dist/umd/semi-ui.min.js.map +1 -1
  9. package/iconButton/index.tsx +3 -0
  10. package/lib/cjs/button/buttonGroup.d.ts +0 -2
  11. package/lib/cjs/button/buttonGroup.js +4 -3
  12. package/lib/cjs/cascader/index.d.ts +3 -0
  13. package/lib/cjs/cascader/index.js +5 -3
  14. package/lib/cjs/iconButton/index.js +3 -0
  15. package/lib/cjs/radio/radio.js +3 -5
  16. package/lib/cjs/slider/index.d.ts +1 -1
  17. package/lib/cjs/slider/index.js +84 -36
  18. package/lib/cjs/transfer/index.d.ts +5 -0
  19. package/lib/cjs/transfer/index.js +7 -17
  20. package/lib/cjs/typography/base.js +15 -3
  21. package/lib/cjs/typography/text.js +11 -1
  22. package/lib/es/button/buttonGroup.d.ts +0 -2
  23. package/lib/es/button/buttonGroup.js +4 -3
  24. package/lib/es/cascader/index.d.ts +3 -0
  25. package/lib/es/cascader/index.js +5 -3
  26. package/lib/es/iconButton/index.js +3 -0
  27. package/lib/es/radio/radio.js +3 -5
  28. package/lib/es/slider/index.d.ts +1 -1
  29. package/lib/es/slider/index.js +84 -36
  30. package/lib/es/transfer/index.d.ts +5 -0
  31. package/lib/es/transfer/index.js +7 -17
  32. package/lib/es/typography/base.js +15 -3
  33. package/lib/es/typography/text.js +10 -1
  34. package/package.json +11 -11
  35. package/radio/_story/radio.stories.js +5 -5
  36. package/radio/radio.tsx +5 -3
  37. package/slider/_story/slider.stories.js +4 -2
  38. package/slider/index.tsx +63 -33
  39. package/transfer/_story/transfer.stories.js +29 -0
  40. package/transfer/index.tsx +10 -10
  41. package/typography/_story/typography.stories.js +15 -3
  42. package/typography/base.tsx +9 -4
  43. package/typography/text.tsx +9 -1
@@ -80,6 +80,9 @@ class IconButton extends PureComponent<IconButtonProps> {
80
80
  } else if (noHorizontalPadding === true) {
81
81
  style.paddingLeft = 0;
82
82
  style.paddingRight = 0;
83
+ } else if (typeof noHorizontalPadding === 'string') {
84
+ noHorizontalPadding === 'left' && (style.paddingLeft = 0);
85
+ noHorizontalPadding === 'right' && (style.paddingRight = 0);
83
86
  }
84
87
 
85
88
  let finalChildren = null;
@@ -24,8 +24,6 @@ export default class ButtonGroup extends BaseComponent<ButtonGroupProps> {
24
24
  };
25
25
  static defaultProps: {
26
26
  size: string;
27
- type: string;
28
- theme: string;
29
27
  };
30
28
  render(): JSX.Element;
31
29
  }
@@ -101,7 +101,8 @@ ButtonGroup.propTypes = {
101
101
  'aria-label': _propTypes.default.string
102
102
  };
103
103
  ButtonGroup.defaultProps = {
104
- size: 'default',
105
- type: 'primary',
106
- theme: 'light'
104
+ // There are default values ​​for type and theme in Button.
105
+ // In order to allow users to individually customize the type and theme of the Button through the parameters of the Button in the ButtonGroup,
106
+ // the default value of type and theme is not given in the ButtonGroup。
107
+ size: 'default'
107
108
  };
@@ -8,6 +8,7 @@ import Input from '../input/index';
8
8
  import { PopoverProps } from '../popover/index';
9
9
  import { CascaderData, Entities, Entity, Data } from './item';
10
10
  import { Motion } from '../_base/base';
11
+ import { Position } from '../tooltip/index';
11
12
  export { CascaderType, ShowNextType } from '@douyinfe/semi-foundation/lib/cjs/cascader/foundation';
12
13
  export { CascaderData, Entity, Data, CascaderItemProps } from './item';
13
14
  export interface ScrollPanelProps extends BasicScrollPanelProps {
@@ -53,6 +54,7 @@ export interface CascaderProps extends BasicCascaderProps {
53
54
  onBlur?: (e: MouseEvent) => void;
54
55
  onFocus?: (e: MouseEvent) => void;
55
56
  validateStatus?: ValidateStatus;
57
+ position?: Position;
56
58
  }
57
59
  export interface CascaderState extends BasicCascaderInnerData {
58
60
  keyEntities: Entities;
@@ -132,6 +134,7 @@ declare class Cascader extends BaseComponent<CascaderProps, CascaderState> {
132
134
  leafOnly: PropTypes.Requireable<boolean>;
133
135
  enableLeafClick: PropTypes.Requireable<boolean>;
134
136
  preventScroll: PropTypes.Requireable<boolean>;
137
+ position: PropTypes.Requireable<string>;
135
138
  };
136
139
  static defaultProps: {
137
140
  leafOnly: boolean;
@@ -976,7 +976,8 @@ class Cascader extends _baseComponent.default {
976
976
  autoAdjustOverflow,
977
977
  stopPropagation,
978
978
  mouseLeaveDelay,
979
- mouseEnterDelay
979
+ mouseEnterDelay,
980
+ position
980
981
  } = this.props;
981
982
  const {
982
983
  isOpen,
@@ -987,7 +988,7 @@ class Cascader extends _baseComponent.default {
987
988
  } = this.context;
988
989
  const content = this.renderContent();
989
990
  const selection = this.renderSelection();
990
- const pos = direction === 'rtl' ? 'bottomRight' : 'bottomLeft';
991
+ const pos = position !== null && position !== void 0 ? position : direction === 'rtl' ? 'bottomRight' : 'bottomLeft';
991
992
  const mergedMotion = this.foundation.getMergedMotion();
992
993
  return /*#__PURE__*/_react.default.createElement(_index2.default, {
993
994
  getPopupContainer: getPopupContainer,
@@ -1081,7 +1082,8 @@ Cascader.propTypes = {
1081
1082
  disableStrictly: _propTypes.default.bool,
1082
1083
  leafOnly: _propTypes.default.bool,
1083
1084
  enableLeafClick: _propTypes.default.bool,
1084
- preventScroll: _propTypes.default.bool
1085
+ preventScroll: _propTypes.default.bool,
1086
+ position: _propTypes.default.string
1085
1087
  };
1086
1088
  Cascader.defaultProps = {
1087
1089
  leafOnly: false,
@@ -88,6 +88,9 @@ class IconButton extends _react.PureComponent {
88
88
  } else if (noHorizontalPadding === true) {
89
89
  style.paddingLeft = 0;
90
90
  style.paddingRight = 0;
91
+ } else if (typeof noHorizontalPadding === 'string') {
92
+ noHorizontalPadding === 'left' && (style.paddingLeft = 0);
93
+ noHorizontalPadding === 'right' && (style.paddingRight = 0);
91
94
  }
92
95
 
93
96
  let finalChildren = null;
@@ -233,11 +233,9 @@ class Radio extends _baseComponent.default {
233
233
  focusInner: focusVisible && !focusOuter,
234
234
  onInputFocus: this.handleFocusVisible,
235
235
  onInputBlur: this.handleBlur
236
- })), /*#__PURE__*/_react.default.createElement("div", {
237
- className: (0, _classnames.default)(["".concat(prefix, "-content"), {
238
- ["".concat(prefix, "-isCardRadioGroup_content")]: isCardRadioGroup
239
- }])
240
- }, renderContent()));
236
+ })), isCardRadioGroup ? /*#__PURE__*/_react.default.createElement("div", {
237
+ className: "".concat(prefix, "-isCardRadioGroup_content")
238
+ }, renderContent()) : renderContent());
241
239
  }
242
240
 
243
241
  }
@@ -15,7 +15,6 @@ export default class Slider extends BaseComponent<SliderProps, SliderState> {
15
15
  private maxHanleEl;
16
16
  private dragging;
17
17
  private eventListenerSet;
18
- private chooseMovePos;
19
18
  foundation: SliderFoundation;
20
19
  constructor(props: SliderProps);
21
20
  get adapter(): SliderAdapter;
@@ -26,6 +25,7 @@ export default class Slider extends BaseComponent<SliderProps, SliderState> {
26
25
  renderTrack: () => JSX.Element;
27
26
  renderStepDot: () => JSX.Element;
28
27
  renderLabel: () => JSX.Element;
28
+ _getAriaValueText: (value: number, index?: number) => string | number;
29
29
  render(): JSX.Element;
30
30
  private _addEventListener;
31
31
  }
@@ -80,7 +80,9 @@ class Slider extends _baseComponent.default {
80
80
  const {
81
81
  chooseMovePos,
82
82
  isDrag,
83
- isInRenderTree
83
+ isInRenderTree,
84
+ firstDotFocusVisible,
85
+ secondDotFocusVisible
84
86
  } = this.state;
85
87
  const stylePos = vertical ? 'top' : 'left';
86
88
  const percentInfo = this.foundation.getMinAndMaxPercent(this.state.currentValue);
@@ -106,7 +108,7 @@ class Slider extends _baseComponent.default {
106
108
  currentValue
107
109
  } = this.state;
108
110
  const commonAria = {
109
- 'aria-label': ariaLabel,
111
+ 'aria-label': ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : disabled ? 'Disabled Slider' : undefined,
110
112
  'aria-labelledby': ariaLabelledby,
111
113
  'aria-disabled': disabled
112
114
  };
@@ -118,7 +120,7 @@ class Slider extends _baseComponent.default {
118
120
  position: "top",
119
121
  trigger: "custom",
120
122
  rePosKey: minPercent,
121
- visible: isInRenderTree && tipVisible.min,
123
+ visible: isInRenderTree && (tipVisible.min || firstDotFocusVisible),
122
124
  className: "".concat(_constants.cssClasses.HANDLE, "-tooltip")
123
125
  }, /*#__PURE__*/_react.default.createElement("span", (0, _assign.default)({
124
126
  onMouseOver: this.foundation.checkAndUpdateIsInRenderTreeState,
@@ -150,20 +152,28 @@ class Slider extends _baseComponent.default {
150
152
  onTouchEnd: e => {
151
153
  this.foundation.onHandleUp(e);
152
154
  },
153
- onFocus: e => this.foundation.onFocus(e, 'min'),
155
+ onKeyDown: e => {
156
+ this.foundation.handleKeyDown(e, 'min');
157
+ },
158
+ onFocus: e => {
159
+ this.foundation.onFocus(e, 'min');
160
+ },
161
+ onBlur: e => {
162
+ this.foundation.onBlur(e, 'min');
163
+ },
154
164
  role: "slider",
155
- tabIndex: 0
165
+ "aria-valuetext": getAriaValueText ? getAriaValueText(currentValue, 0) : ariaValueText,
166
+ tabIndex: disabled ? -1 : 0
156
167
  }, commonAria, {
157
168
  "aria-valuenow": currentValue,
158
169
  "aria-valuemax": max,
159
- "aria-valuemin": min,
160
- "aria-valuetext": getAriaValueText ? getAriaValueText(currentValue) : ariaValueText
170
+ "aria-valuemin": min
161
171
  }))) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_index.default, {
162
172
  content: tipChildren.min,
163
173
  position: "top",
164
174
  trigger: "custom",
165
175
  rePosKey: minPercent,
166
- visible: isInRenderTree && tipVisible.min,
176
+ visible: isInRenderTree && (tipVisible.min || firstDotFocusVisible),
167
177
  className: "".concat(_constants.cssClasses.HANDLE, "-tooltip")
168
178
  }, /*#__PURE__*/_react.default.createElement("span", (0, _assign.default)({
169
179
  ref: this.minHanleEl,
@@ -194,12 +204,20 @@ class Slider extends _baseComponent.default {
194
204
  onTouchEnd: e => {
195
205
  this.foundation.onHandleUp(e);
196
206
  },
197
- onFocus: e => this.foundation.onFocus(e, 'min'),
207
+ onKeyDown: e => {
208
+ this.foundation.handleKeyDown(e, 'min');
209
+ },
210
+ onFocus: e => {
211
+ this.foundation.onFocus(e, 'min');
212
+ },
213
+ onBlur: e => {
214
+ this.foundation.onBlur(e, 'min');
215
+ },
198
216
  role: "slider",
199
- tabIndex: 0
217
+ tabIndex: disabled ? -1 : 0
200
218
  }, commonAria, {
219
+ "aria-valuetext": getAriaValueText ? getAriaValueText(currentValue[0], 0) : ariaValueText,
201
220
  "aria-valuenow": currentValue[0],
202
- "aria-valuetext": getAriaValueText ? getAriaValueText(currentValue[0]) : ariaValueText,
203
221
  "aria-valuemax": currentValue[1],
204
222
  "aria-valuemin": min
205
223
  }))), /*#__PURE__*/_react.default.createElement(_index.default, {
@@ -207,7 +225,7 @@ class Slider extends _baseComponent.default {
207
225
  position: "top",
208
226
  trigger: "custom",
209
227
  rePosKey: maxPercent,
210
- visible: isInRenderTree && tipVisible.max,
228
+ visible: isInRenderTree && (tipVisible.max || secondDotFocusVisible),
211
229
  className: "".concat(_constants.cssClasses.HANDLE, "-tooltip")
212
230
  }, /*#__PURE__*/_react.default.createElement("span", (0, _assign.default)({
213
231
  ref: this.maxHanleEl,
@@ -238,12 +256,20 @@ class Slider extends _baseComponent.default {
238
256
  onTouchEnd: e => {
239
257
  this.foundation.onHandleUp(e);
240
258
  },
241
- onFocus: e => this.foundation.onFocus(e, 'min'),
259
+ onKeyDown: e => {
260
+ this.foundation.handleKeyDown(e, 'max');
261
+ },
262
+ onFocus: e => {
263
+ this.foundation.onFocus(e, 'max');
264
+ },
265
+ onBlur: e => {
266
+ this.foundation.onBlur(e, 'max');
267
+ },
242
268
  role: "slider",
243
- tabIndex: 0
269
+ tabIndex: disabled ? -1 : 0
244
270
  }, commonAria, {
271
+ "aria-valuetext": getAriaValueText ? getAriaValueText(currentValue[1], 1) : ariaValueText,
245
272
  "aria-valuenow": currentValue[1],
246
- "aria-valuetext": getAriaValueText ? getAriaValueText(currentValue[1]) : ariaValueText,
247
273
  "aria-valuemax": max,
248
274
  "aria-valuemin": currentValue[0]
249
275
  }))));
@@ -344,6 +370,13 @@ class Slider extends _baseComponent.default {
344
370
  return labelContent;
345
371
  };
346
372
 
373
+ this._getAriaValueText = (value, index) => {
374
+ const {
375
+ getAriaValueText
376
+ } = this.props;
377
+ return getAriaValueText ? getAriaValueText(value, index) : value;
378
+ };
379
+
347
380
  let {
348
381
  value
349
382
  } = this.props;
@@ -364,14 +397,14 @@ class Slider extends _baseComponent.default {
364
397
  isDrag: false,
365
398
  clickValue: 0,
366
399
  showBoundary: false,
367
- isInRenderTree: true
400
+ isInRenderTree: true,
401
+ firstDotFocusVisible: false,
402
+ secondDotFocusVisible: false
368
403
  };
369
404
  this.sliderEl = /*#__PURE__*/_react.default.createRef();
370
405
  this.minHanleEl = /*#__PURE__*/_react.default.createRef();
371
406
  this.maxHanleEl = /*#__PURE__*/_react.default.createRef();
372
- this.dragging = [false, false]; // this.chooseMovePos = 'min';
373
- // this.isDrag = false;
374
-
407
+ this.dragging = [false, false];
375
408
  this.foundation = new _foundation.default(this.adapter);
376
409
  this.eventListenerSet = new _set.default();
377
410
  }
@@ -437,8 +470,7 @@ class Slider extends _baseComponent.default {
437
470
  return flag;
438
471
  },
439
472
  getOverallVars: () => ({
440
- dragging: this.dragging,
441
- chooseMovePos: this.chooseMovePos
473
+ dragging: this.dragging
442
474
  }),
443
475
  updateDisabled: disabled => {
444
476
  this.setState({
@@ -472,9 +504,6 @@ class Slider extends _baseComponent.default {
472
504
  getMinHandleEl: () => this.minHanleEl,
473
505
  getMaxHandleEl: () => this.maxHanleEl,
474
506
  onHandleDown: e => {
475
- e.stopPropagation();
476
- e.preventDefault();
477
-
478
507
  this._addEventListener(document.body, 'mousemove', this.foundation.onHandleMove, false);
479
508
 
480
509
  this._addEventListener(document.body, 'mouseup', this.foundation.onHandleUp, false);
@@ -597,38 +626,56 @@ class Slider extends _baseComponent.default {
597
626
  }
598
627
 
599
628
  render() {
629
+ var _context5;
630
+
631
+ const {
632
+ disabled,
633
+ currentValue,
634
+ min,
635
+ max
636
+ } = this.state;
637
+ const {
638
+ vertical,
639
+ verticalReverse,
640
+ style,
641
+ railStyle,
642
+ range,
643
+ className
644
+ } = this.props;
600
645
  const wrapperClass = (0, _classnames.default)("".concat(prefixCls, "-wrapper"), {
601
- ["".concat(prefixCls, "-disabled")]: this.state.disabled,
602
- ["".concat(_constants.cssClasses.VERTICAL, "-wrapper")]: this.props.vertical,
603
- ["".concat(prefixCls, "-reverse")]: this.props.vertical && this.props.verticalReverse
604
- }, this.props.className);
646
+ ["".concat(prefixCls, "-disabled")]: disabled,
647
+ ["".concat(_constants.cssClasses.VERTICAL, "-wrapper")]: vertical,
648
+ ["".concat(prefixCls, "-reverse")]: vertical && verticalReverse
649
+ }, className);
605
650
  const boundaryClass = (0, _classnames.default)("".concat(prefixCls, "-boundary"), {
606
651
  ["".concat(prefixCls, "-boundary-show")]: this.props.showBoundary && this.state.showBoundary
607
652
  });
608
653
  const sliderCls = (0, _classnames.default)({
609
- ["".concat(prefixCls)]: !this.props.vertical,
610
- [_constants.cssClasses.VERTICAL]: this.props.vertical
654
+ ["".concat(prefixCls)]: !vertical,
655
+ [_constants.cssClasses.VERTICAL]: vertical
611
656
  });
657
+ const ariaLabel = range ? (0, _concat.default)(_context5 = "Range: ".concat(this._getAriaValueText(currentValue[0], 0), " to ")).call(_context5, this._getAriaValueText(currentValue[1], 1)) : undefined;
612
658
 
613
659
  const slider = /*#__PURE__*/_react.default.createElement("div", {
614
660
  className: wrapperClass,
615
- style: this.props.style,
661
+ style: style,
616
662
  ref: this.sliderEl,
663
+ "aria-label": ariaLabel,
617
664
  onMouseEnter: () => this.foundation.handleWrapperEnter(),
618
665
  onMouseLeave: () => this.foundation.handleWrapperLeave()
619
666
  }, /*#__PURE__*/_react.default.createElement("div", {
620
667
  className: "".concat(prefixCls, "-rail"),
621
668
  onClick: this.foundation.handleWrapClick,
622
- style: this.props.railStyle
669
+ style: railStyle
623
670
  }), this.renderTrack(), this.renderStepDot(), /*#__PURE__*/_react.default.createElement("div", null, this.renderHandle()), this.renderLabel(), /*#__PURE__*/_react.default.createElement("div", {
624
671
  className: boundaryClass
625
672
  }, /*#__PURE__*/_react.default.createElement("span", {
626
673
  className: "".concat(prefixCls, "-boundary-min")
627
- }, this.state.min), /*#__PURE__*/_react.default.createElement("span", {
674
+ }, min), /*#__PURE__*/_react.default.createElement("span", {
628
675
  className: "".concat(prefixCls, "-boundary-max")
629
- }, this.state.max)));
676
+ }, max)));
630
677
 
631
- if (!this.props.vertical) {
678
+ if (!vertical) {
632
679
  return /*#__PURE__*/_react.default.createElement("div", {
633
680
  className: sliderCls
634
681
  }, slider);
@@ -683,7 +730,8 @@ Slider.propTypes = {
683
730
  className: _propTypes.default.string,
684
731
  showBoundary: _propTypes.default.bool,
685
732
  railStyle: _propTypes.default.object,
686
- verticalReverse: _propTypes.default.bool
733
+ verticalReverse: _propTypes.default.bool,
734
+ getAriaValueText: _propTypes.default.func
687
735
  };
688
736
  Slider.defaultProps = {
689
737
  // allowClear: false,
@@ -63,6 +63,11 @@ export interface ResolvedDataItem extends DataItem {
63
63
  };
64
64
  _optionKey?: string | number;
65
65
  }
66
+ export interface DraggableResolvedDataItem {
67
+ key?: string | number;
68
+ index?: number;
69
+ item?: ResolvedDataItem;
70
+ }
66
71
  export declare type DataSource = Array<DataItem> | Array<GroupItem> | Array<TreeItem>;
67
72
  interface HeaderConfig {
68
73
  totalContent: string;
@@ -460,16 +460,8 @@ class Transfer extends _baseComponent.default {
460
460
  type,
461
461
  showPath
462
462
  } = this.props;
463
- let newItem = item;
464
463
 
465
- if (draggable) {
466
- newItem = (0, _assign.default)((0, _assign.default)({}, item), {
467
- key: item._optionKey
468
- });
469
- delete newItem._optionKey;
470
- }
471
-
472
- const onRemove = () => this.foundation.handleSelectOrRemove(newItem);
464
+ const onRemove = () => this.foundation.handleSelectOrRemove(item);
473
465
 
474
466
  const rightItemCls = (0, _classnames.default)({
475
467
  ["".concat(prefixcls, "-item")]: true,
@@ -497,7 +489,7 @@ class Transfer extends _baseComponent.default {
497
489
  _react.default.createElement("div", {
498
490
  role: "listitem",
499
491
  className: rightItemCls,
500
- key: newItem.key
492
+ key: item.key
501
493
  }, draggable ? /*#__PURE__*/_react.default.createElement(DragHandle, null) : null, /*#__PURE__*/_react.default.createElement("div", {
502
494
  className: "".concat(prefixcls, "-right-item-text")
503
495
  }, label), /*#__PURE__*/_react.default.createElement(_semiIcons.IconClose, {
@@ -524,7 +516,7 @@ class Transfer extends _baseComponent.default {
524
516
 
525
517
  renderRightSortableList(selectedData) {
526
518
  // when choose some items && draggable is true
527
- const SortableItem = (0, _reactSortableHoc.SortableElement)(item => this.renderRightItem(item));
519
+ const SortableItem = (0, _reactSortableHoc.SortableElement)(props => this.renderRightItem(props.item));
528
520
  const SortableList = (0, _reactSortableHoc.SortableContainer)(_ref => {
529
521
  let {
530
522
  items
@@ -535,14 +527,12 @@ class Transfer extends _baseComponent.default {
535
527
  "aria-label": "Selected list"
536
528
  }, (0, _map2.default)(items).call(items, (item, index) =>
537
529
  /*#__PURE__*/
538
- // sortableElement will take over the property 'key', so use another '_optionKey' to pass
539
530
  // @ts-ignore skip SortableItem type check
540
- _react.default.createElement(SortableItem, (0, _assign.default)({
531
+ _react.default.createElement(SortableItem, {
541
532
  key: item.label,
542
- index: index
543
- }, item, {
544
- _optionKey: item.key
545
- })))) // eslint-disable-next-line @typescript-eslint/ban-ts-comment
533
+ index: index,
534
+ item: item
535
+ }))) // eslint-disable-next-line @typescript-eslint/ban-ts-comment
546
536
  // @ts-ignore see reasons: https://github.com/clauderic/react-sortable-hoc/issues/206
547
537
  ;
548
538
  }, {
@@ -89,12 +89,18 @@ const wrapperDecorations = (props, content) => {
89
89
  underline,
90
90
  strong,
91
91
  link,
92
- disabled
92
+ disabled,
93
+ icon
93
94
  } = props;
94
95
  let wrapped = content;
95
96
 
96
97
  const wrap = (isNeeded, tag) => {
97
- let wrapProps = {};
98
+ let wrapProps = icon ? {
99
+ style: {
100
+ display: 'inline-flex',
101
+ alignItems: 'center'
102
+ }
103
+ } : {};
98
104
 
99
105
  if (!isNeeded) {
100
106
  return;
@@ -112,7 +118,13 @@ const wrapperDecorations = (props, content) => {
112
118
  wrap(underline && !link, 'u');
113
119
  wrap(strong, 'strong');
114
120
  wrap(props.delete, 'del');
115
- wrap(link, disabled ? 'span' : 'a');
121
+ wrap(link, disabled ? 'span' : 'a'); // When the content is not wrapped, and there is more than one element in the content (one of which is an icon),
122
+ // use span to wrap the content, so that the content in the span is vertically aligned
123
+
124
+ if (wrapped === content && icon) {
125
+ wrap(true, 'span');
126
+ }
127
+
116
128
  return wrapped;
117
129
  };
118
130
 
@@ -24,15 +24,25 @@ var _constants = require("@douyinfe/semi-foundation/lib/cjs/typography/constants
24
24
 
25
25
  var _base = _interopRequireDefault(require("./base"));
26
26
 
27
+ var _classnames = _interopRequireDefault(require("classnames"));
28
+
27
29
  function _getRequireWildcardCache(nodeInterop) { if (typeof _WeakMap !== "function") return null; var cacheBabelInterop = new _WeakMap(); var cacheNodeInterop = new _WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
28
30
 
29
31
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = _Object$defineProperty && _Object$getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? _Object$getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { _Object$defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
30
32
 
33
+ const prefixCls = _constants.cssClasses.PREFIX;
34
+
31
35
  class Text extends _react.PureComponent {
32
36
  render() {
37
+ const className = (0, _classnames.default)(this.props.className, {
38
+ ["".concat(prefixCls, "-text")]: true,
39
+ ["".concat(prefixCls, "-text-icon")]: this.props.icon
40
+ });
33
41
  return /*#__PURE__*/_react.default.createElement(_base.default, (0, _assign.default)({
34
42
  component: 'span'
35
- }, this.props));
43
+ }, this.props, {
44
+ className: className
45
+ }));
36
46
  }
37
47
 
38
48
  }
@@ -24,8 +24,6 @@ export default class ButtonGroup extends BaseComponent<ButtonGroupProps> {
24
24
  };
25
25
  static defaultProps: {
26
26
  size: string;
27
- type: string;
28
- theme: string;
29
27
  };
30
28
  render(): JSX.Element;
31
29
  }
@@ -68,7 +68,8 @@ ButtonGroup.propTypes = {
68
68
  'aria-label': PropTypes.string
69
69
  };
70
70
  ButtonGroup.defaultProps = {
71
- size: 'default',
72
- type: 'primary',
73
- theme: 'light'
71
+ // There are default values ​​for type and theme in Button.
72
+ // In order to allow users to individually customize the type and theme of the Button through the parameters of the Button in the ButtonGroup,
73
+ // the default value of type and theme is not given in the ButtonGroup。
74
+ size: 'default'
74
75
  };
@@ -8,6 +8,7 @@ import Input from '../input/index';
8
8
  import { PopoverProps } from '../popover/index';
9
9
  import { CascaderData, Entities, Entity, Data } from './item';
10
10
  import { Motion } from '../_base/base';
11
+ import { Position } from '../tooltip/index';
11
12
  export { CascaderType, ShowNextType } from '@douyinfe/semi-foundation/lib/es/cascader/foundation';
12
13
  export { CascaderData, Entity, Data, CascaderItemProps } from './item';
13
14
  export interface ScrollPanelProps extends BasicScrollPanelProps {
@@ -53,6 +54,7 @@ export interface CascaderProps extends BasicCascaderProps {
53
54
  onBlur?: (e: MouseEvent) => void;
54
55
  onFocus?: (e: MouseEvent) => void;
55
56
  validateStatus?: ValidateStatus;
57
+ position?: Position;
56
58
  }
57
59
  export interface CascaderState extends BasicCascaderInnerData {
58
60
  keyEntities: Entities;
@@ -132,6 +134,7 @@ declare class Cascader extends BaseComponent<CascaderProps, CascaderState> {
132
134
  leafOnly: PropTypes.Requireable<boolean>;
133
135
  enableLeafClick: PropTypes.Requireable<boolean>;
134
136
  preventScroll: PropTypes.Requireable<boolean>;
137
+ position: PropTypes.Requireable<string>;
135
138
  };
136
139
  static defaultProps: {
137
140
  leafOnly: boolean;
@@ -922,7 +922,8 @@ class Cascader extends BaseComponent {
922
922
  autoAdjustOverflow,
923
923
  stopPropagation,
924
924
  mouseLeaveDelay,
925
- mouseEnterDelay
925
+ mouseEnterDelay,
926
+ position
926
927
  } = this.props;
927
928
  const {
928
929
  isOpen,
@@ -933,7 +934,7 @@ class Cascader extends BaseComponent {
933
934
  } = this.context;
934
935
  const content = this.renderContent();
935
936
  const selection = this.renderSelection();
936
- const pos = direction === 'rtl' ? 'bottomRight' : 'bottomLeft';
937
+ const pos = position !== null && position !== void 0 ? position : direction === 'rtl' ? 'bottomRight' : 'bottomLeft';
937
938
  const mergedMotion = this.foundation.getMergedMotion();
938
939
  return /*#__PURE__*/React.createElement(Popover, {
939
940
  getPopupContainer: getPopupContainer,
@@ -1027,7 +1028,8 @@ Cascader.propTypes = {
1027
1028
  disableStrictly: PropTypes.bool,
1028
1029
  leafOnly: PropTypes.bool,
1029
1030
  enableLeafClick: PropTypes.bool,
1030
- preventScroll: PropTypes.bool
1031
+ preventScroll: PropTypes.bool,
1032
+ position: PropTypes.string
1031
1033
  };
1032
1034
  Cascader.defaultProps = {
1033
1035
  leafOnly: false,
@@ -56,6 +56,9 @@ class IconButton extends PureComponent {
56
56
  } else if (noHorizontalPadding === true) {
57
57
  style.paddingLeft = 0;
58
58
  style.paddingRight = 0;
59
+ } else if (typeof noHorizontalPadding === 'string') {
60
+ noHorizontalPadding === 'left' && (style.paddingLeft = 0);
61
+ noHorizontalPadding === 'right' && (style.paddingRight = 0);
59
62
  }
60
63
 
61
64
  let finalChildren = null;
@@ -210,11 +210,9 @@ class Radio extends BaseComponent {
210
210
  focusInner: focusVisible && !focusOuter,
211
211
  onInputFocus: this.handleFocusVisible,
212
212
  onInputBlur: this.handleBlur
213
- })), /*#__PURE__*/React.createElement("div", {
214
- className: cls(["".concat(prefix, "-content"), {
215
- ["".concat(prefix, "-isCardRadioGroup_content")]: isCardRadioGroup
216
- }])
217
- }, renderContent()));
213
+ })), isCardRadioGroup ? /*#__PURE__*/React.createElement("div", {
214
+ className: "".concat(prefix, "-isCardRadioGroup_content")
215
+ }, renderContent()) : renderContent());
218
216
  }
219
217
 
220
218
  }
@@ -15,7 +15,6 @@ export default class Slider extends BaseComponent<SliderProps, SliderState> {
15
15
  private maxHanleEl;
16
16
  private dragging;
17
17
  private eventListenerSet;
18
- private chooseMovePos;
19
18
  foundation: SliderFoundation;
20
19
  constructor(props: SliderProps);
21
20
  get adapter(): SliderAdapter;
@@ -26,6 +25,7 @@ export default class Slider extends BaseComponent<SliderProps, SliderState> {
26
25
  renderTrack: () => JSX.Element;
27
26
  renderStepDot: () => JSX.Element;
28
27
  renderLabel: () => JSX.Element;
28
+ _getAriaValueText: (value: number, index?: number) => string | number;
29
29
  render(): JSX.Element;
30
30
  private _addEventListener;
31
31
  }