@douyinfe/semi-ui 2.8.0 → 2.9.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.
Files changed (43) hide show
  1. package/_base/_story/index.scss +0 -1
  2. package/badge/index.tsx +12 -3
  3. package/descriptions/index.tsx +4 -5
  4. package/descriptions/item.tsx +1 -1
  5. package/dist/css/semi.css +63 -16
  6. package/dist/css/semi.min.css +1 -1
  7. package/dist/umd/semi-ui.js +181 -26
  8. package/dist/umd/semi-ui.js.map +1 -1
  9. package/dist/umd/semi-ui.min.js +1 -1
  10. package/dist/umd/semi-ui.min.js.map +1 -1
  11. package/divider/__test__/divider.test.js +72 -0
  12. package/divider/_story/Demo.tsx +16 -0
  13. package/divider/_story/divider.stories.js +41 -0
  14. package/divider/_story/divider.stories.tsx +8 -0
  15. package/divider/index.tsx +72 -0
  16. package/form/_story/demo.jsx +9 -0
  17. package/index.ts +1 -0
  18. package/lib/cjs/badge/index.d.ts +9 -0
  19. package/lib/cjs/badge/index.js +34 -6
  20. package/lib/cjs/descriptions/index.d.ts +1 -2
  21. package/lib/cjs/descriptions/index.js +4 -3
  22. package/lib/cjs/descriptions/item.d.ts +1 -1
  23. package/lib/cjs/divider/index.d.ts +20 -0
  24. package/lib/cjs/divider/index.js +88 -0
  25. package/lib/cjs/index.d.ts +1 -0
  26. package/lib/cjs/index.js +9 -0
  27. package/lib/cjs/slider/index.js +16 -12
  28. package/lib/cjs/tagInput/index.d.ts +1 -1
  29. package/lib/es/badge/index.d.ts +9 -0
  30. package/lib/es/badge/index.js +31 -6
  31. package/lib/es/descriptions/index.d.ts +1 -2
  32. package/lib/es/descriptions/index.js +4 -3
  33. package/lib/es/descriptions/item.d.ts +1 -1
  34. package/lib/es/divider/index.d.ts +20 -0
  35. package/lib/es/divider/index.js +68 -0
  36. package/lib/es/index.d.ts +1 -0
  37. package/lib/es/index.js +1 -0
  38. package/lib/es/slider/index.js +16 -12
  39. package/lib/es/tagInput/index.d.ts +1 -1
  40. package/package.json +10 -10
  41. package/slider/_story/slider.stories.js +28 -6
  42. package/slider/index.tsx +16 -11
  43. package/upload/_story/upload.stories.js +2 -3
@@ -8995,6 +8995,13 @@ module.exports = stackHas;
8995
8995
 
8996
8996
  module.exports = __webpack_require__("pb5m");
8997
8997
 
8998
+ /***/ }),
8999
+
9000
+ /***/ "LDNj":
9001
+ /***/ (function(module, exports) {
9002
+
9003
+
9004
+
8998
9005
  /***/ }),
8999
9006
 
9000
9007
  /***/ "LF7m":
@@ -22829,6 +22836,7 @@ __webpack_require__.d(__webpack_exports__, "Collapsible", function() { return /*
22829
22836
  __webpack_require__.d(__webpack_exports__, "ConfigProvider", function() { return /* reexport */ configProvider_ConfigProvider; });
22830
22837
  __webpack_require__.d(__webpack_exports__, "DatePicker", function() { return /* reexport */ datePicker_0; });
22831
22838
  __webpack_require__.d(__webpack_exports__, "Descriptions", function() { return /* reexport */ descriptions_0; });
22839
+ __webpack_require__.d(__webpack_exports__, "Divider", function() { return /* reexport */ divider_0; });
22832
22840
  __webpack_require__.d(__webpack_exports__, "Empty", function() { return /* reexport */ empty_Empty; });
22833
22841
  __webpack_require__.d(__webpack_exports__, "Modal", function() { return /* reexport */ modal_0; });
22834
22842
  __webpack_require__.d(__webpack_exports__, "Dropdown", function() { return /* reexport */ dropdown_0; });
@@ -35752,6 +35760,22 @@ var badge = __webpack_require__("rU3k");
35752
35760
 
35753
35761
 
35754
35762
 
35763
+ var badge_rest = undefined && undefined.__rest || function (s, e) {
35764
+ var t = {};
35765
+
35766
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && index_of_default()(e).call(e, p) < 0) t[p] = s[p];
35767
+
35768
+ if (s != null && typeof get_own_property_symbols_default.a === "function") for (var i = 0, p = get_own_property_symbols_default()(s); i < p.length; i++) {
35769
+ if (index_of_default()(e).call(e, p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
35770
+ }
35771
+ return t;
35772
+ };
35773
+
35774
+
35775
+
35776
+
35777
+
35778
+
35755
35779
 
35756
35780
  const badge_prefixCls = badge_constants_cssClasses.PREFIX;
35757
35781
  class badge_Badge extends external_root_React_commonjs2_react_commonjs_react_amd_react_["PureComponent"] {
@@ -35764,7 +35788,8 @@ class badge_Badge extends external_root_React_commonjs2_react_commonjs_react_amd
35764
35788
 
35765
35789
  const defaultPosition = direction === 'rtl' ? 'leftTop' : 'rightTop'; // eslint-disable-next-line max-len
35766
35790
 
35767
- const {
35791
+ const _a = this.props,
35792
+ {
35768
35793
  count,
35769
35794
  dot,
35770
35795
  type,
@@ -35774,7 +35799,9 @@ class badge_Badge extends external_root_React_commonjs2_react_commonjs_react_amd
35774
35799
  style,
35775
35800
  children,
35776
35801
  className
35777
- } = this.props;
35802
+ } = _a,
35803
+ rest = badge_rest(_a, ["count", "dot", "type", "theme", "position", "overflowCount", "style", "children", "className"]);
35804
+
35778
35805
  const custom = count && !(isNumber_default()(count) || isString_default()(count));
35779
35806
  const showBadge = count !== null && typeof count !== 'undefined';
35780
35807
  const wrapper = classnames_default()(className, {
@@ -35794,9 +35821,9 @@ class badge_Badge extends external_root_React_commonjs2_react_commonjs_react_amd
35794
35821
  content = count;
35795
35822
  }
35796
35823
 
35797
- return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("span", {
35824
+ return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("span", assign_default()({
35798
35825
  className: badge_prefixCls
35799
- }, children, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("span", {
35826
+ }, rest), children, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("span", {
35800
35827
  className: wrapper,
35801
35828
  style: style
35802
35829
  }, dot ? null : content));
@@ -35813,13 +35840,19 @@ badge_Badge.propTypes = {
35813
35840
  overflowCount: prop_types_default.a.number,
35814
35841
  style: prop_types_default.a.object,
35815
35842
  className: prop_types_default.a.string,
35816
- children: prop_types_default.a.node
35843
+ children: prop_types_default.a.node,
35844
+ onClick: prop_types_default.a.func,
35845
+ onMouseEnter: prop_types_default.a.func,
35846
+ onMouseLeave: prop_types_default.a.func
35817
35847
  };
35818
35848
  badge_Badge.defaultProps = {
35819
35849
  dot: false,
35820
35850
  type: 'primary',
35821
35851
  theme: 'solid',
35822
- className: ''
35852
+ className: '',
35853
+ onClick: () => noop_default.a,
35854
+ onMouseEnter: () => noop_default.a,
35855
+ onMouseLeave: () => noop_default.a
35823
35856
  };
35824
35857
  // CONCATENATED MODULE: ../semi-foundation/banner/constants.ts
35825
35858
 
@@ -44064,7 +44097,7 @@ const cascader_constants_cssClasses = {
44064
44097
  };
44065
44098
  const cascader_constants_strings = {
44066
44099
  SIZE_SET: ['small', 'large', 'default'],
44067
- VALIDATE_STATUS: ['default', 'error', 'warning'],
44100
+ VALIDATE_STATUS: ['success', 'default', 'error', 'warning'],
44068
44101
  IS_KEY: 'isKey',
44069
44102
  IS_VALUE: 'isValue',
44070
44103
  SHOW_NEXT_BY_CLICK: 'click',
@@ -46526,7 +46559,7 @@ const tagInput_constants_cssClasses = {
46526
46559
  };
46527
46560
  const tagInput_constants_strings = {
46528
46561
  SIZE_SET: ['large', 'default', 'small'],
46529
- STATUS: ["default", "error", "warning"]
46562
+ STATUS: ["success", "default", "error", "warning"]
46530
46563
  };
46531
46564
 
46532
46565
  // EXTERNAL MODULE: ../semi-foundation/tagInput/tagInput.scss
@@ -61592,10 +61625,11 @@ class descriptions_Descriptions extends external_root_React_commonjs2_react_comm
61592
61625
  ["".concat(descriptions_prefixCls, "-double")]: row,
61593
61626
  [concat_default()(_context2 = "".concat(descriptions_prefixCls, "-double-")).call(_context2, size)]: row
61594
61627
  });
61595
- const childrenList = data && data.length ? map_default()(data).call(data, item => isPlainObject_default()(item) ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement(descriptions_item_Item, assign_default()({
61596
- key: item.key,
61628
+ const childrenList = data && data.length ? map_default()(data).call(data, (item, index) => isPlainObject_default()(item) ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement(descriptions_item_Item, assign_default()({
61597
61629
  itemKey: item.key
61598
- }, item), item.value) : null) : children;
61630
+ }, item, {
61631
+ key: index
61632
+ }), item.value) : null) : children;
61599
61633
  return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("div", {
61600
61634
  className: classNames,
61601
61635
  style: style
@@ -61631,6 +61665,87 @@ descriptions_Descriptions.defaultProps = {
61631
61665
  data: []
61632
61666
  };
61633
61667
  /* harmony default export */ var descriptions_0 = (descriptions_Descriptions);
61668
+ // CONCATENATED MODULE: ../semi-foundation/divider/constants.ts
61669
+
61670
+ const divider_constants_cssClasses = {
61671
+ PREFIX: "".concat(BASE_CLASS_PREFIX)
61672
+ };
61673
+ const divider_constants_strings = {
61674
+ LAYOUT: ['vertical', 'horizontal']
61675
+ };
61676
+
61677
+ // EXTERNAL MODULE: ../semi-foundation/divider/divider.scss
61678
+ var divider = __webpack_require__("LDNj");
61679
+
61680
+ // CONCATENATED MODULE: ./divider/index.tsx
61681
+
61682
+
61683
+
61684
+
61685
+
61686
+ var divider_rest = undefined && undefined.__rest || function (s, e) {
61687
+ var t = {};
61688
+
61689
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && index_of_default()(e).call(e, p) < 0) t[p] = s[p];
61690
+
61691
+ if (s != null && typeof get_own_property_symbols_default.a === "function") for (var i = 0, p = get_own_property_symbols_default()(s); i < p.length; i++) {
61692
+ if (index_of_default()(e).call(e, p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
61693
+ }
61694
+ return t;
61695
+ };
61696
+
61697
+
61698
+
61699
+
61700
+
61701
+ const divider_prefixCls = divider_constants_cssClasses.PREFIX;
61702
+
61703
+ const Divider = props => {
61704
+ var _context;
61705
+
61706
+ const {
61707
+ layout = 'horizontal',
61708
+ dashed,
61709
+ align = 'center',
61710
+ className,
61711
+ margin,
61712
+ style,
61713
+ children
61714
+ } = props,
61715
+ rest = divider_rest(props, ["layout", "dashed", "align", "className", "margin", "style", "children"]);
61716
+
61717
+ const dividerClassNames = classnames_default()("".concat(divider_prefixCls, "-divider"), className, {
61718
+ ["".concat(divider_prefixCls, "-divider-horizontal")]: layout === 'horizontal',
61719
+ ["".concat(divider_prefixCls, "-divider-vertical")]: layout === 'vertical',
61720
+ ["".concat(divider_prefixCls, "-divider-dashed")]: !!dashed,
61721
+ ["".concat(divider_prefixCls, "-divider-with-text")]: children && layout === 'horizontal',
61722
+ [concat_default()(_context = "".concat(divider_prefixCls, "-divider-with-text-")).call(_context, align)]: children && layout === 'horizontal'
61723
+ });
61724
+ let overrideDefaultStyle = {};
61725
+
61726
+ if (margin !== undefined) {
61727
+ if (layout === 'vertical') {
61728
+ overrideDefaultStyle = {
61729
+ 'marginLeft': margin,
61730
+ 'marginRight': margin
61731
+ };
61732
+ } else if (layout === 'horizontal') {
61733
+ overrideDefaultStyle = {
61734
+ 'marginTop': margin,
61735
+ 'marginBottom': margin
61736
+ };
61737
+ }
61738
+ }
61739
+
61740
+ return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("div", assign_default()({}, rest, {
61741
+ className: dividerClassNames,
61742
+ style: assign_default()(assign_default()({}, overrideDefaultStyle), style)
61743
+ }), children && layout === 'horizontal' ? typeof children === 'string' ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("span", {
61744
+ className: "".concat(divider_prefixCls, "-divider_inner-text")
61745
+ }, children) : children : null);
61746
+ };
61747
+
61748
+ /* harmony default export */ var divider_0 = (Divider);
61634
61749
  // CONCATENATED MODULE: ../semi-foundation/empty/constants.ts
61635
61750
 
61636
61751
  const empty_constants_cssClasses = {
@@ -78941,6 +79056,16 @@ class foundation_SliderFoundation extends foundation {
78941
79056
  };
78942
79057
 
78943
79058
  this.checkAndUpdateIsInRenderTreeState = () => this._adapter.checkAndUpdateIsInRenderTreeState();
79059
+
79060
+ this.calculateOutputValue = (position, isMin) => {
79061
+ const moveValue = this.transPosToValue(position, isMin);
79062
+
79063
+ if (moveValue === false) {
79064
+ return undefined;
79065
+ }
79066
+
79067
+ return this.outPutValue(moveValue);
79068
+ };
78944
79069
  /**
78945
79070
  *
78946
79071
  *
@@ -79056,7 +79181,16 @@ class foundation_SliderFoundation extends foundation {
79056
79181
  pagePos = pagePos - this._dragOffset;
79057
79182
 
79058
79183
  if (chooseMovePos === 'min' && dragging[0] || chooseMovePos === 'max' && dragging[1]) {
79059
- this._adapter.onHandleMove(pagePos, chooseMovePos === 'min');
79184
+ const outPutValue = this.calculateOutputValue(pagePos, chooseMovePos === 'min');
79185
+
79186
+ if (outPutValue === undefined) {
79187
+ return false;
79188
+ }
79189
+
79190
+ this._adapter.notifyChange(outPutValue); // allow drag for controlled component, so no _isControlledComponent check
79191
+
79192
+
79193
+ this._adapter.onHandleMove(pagePos, chooseMovePos === 'min', undefined, false, outPutValue);
79060
79194
  }
79061
79195
 
79062
79196
  return true;
@@ -79163,7 +79297,22 @@ class foundation_SliderFoundation extends foundation {
79163
79297
  const mousePos = this.handleMousePos(e.pageX, e.pageY);
79164
79298
  const position = vertical ? mousePos.y : mousePos.x;
79165
79299
  const isMin = this.checkWhichHandle(position);
79166
- this.setHandlePos(position, isMin, true);
79300
+ const outPutValue = this.calculateOutputValue(position, isMin);
79301
+
79302
+ if (outPutValue === undefined) {
79303
+ return;
79304
+ }
79305
+
79306
+ this._adapter.notifyChange(outPutValue); // check if is controlled component
79307
+
79308
+
79309
+ if (this._isControlledComponent()) {
79310
+ // only perform callback ops, skip UI update
79311
+ return;
79312
+ } // trigger UI state update
79313
+
79314
+
79315
+ this.setHandlePos(position, isMin, true, outPutValue);
79167
79316
  };
79168
79317
  /**
79169
79318
  * Move the slider to the current click position
@@ -79174,8 +79323,9 @@ class foundation_SliderFoundation extends foundation {
79174
79323
 
79175
79324
  this.setHandlePos = function (position, isMin) {
79176
79325
  let clickTrack = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
79326
+ let outPutValue = arguments.length > 3 ? arguments[3] : undefined;
79177
79327
 
79178
- _this._adapter.onHandleMove(position, isMin, () => _this._adapter.onHandleUpAfter(), clickTrack);
79328
+ _this._adapter.onHandleMove(position, isMin, () => _this._adapter.onHandleUpAfter(), clickTrack, outPutValue);
79179
79329
  };
79180
79330
  /**
79181
79331
  * Determine which slider should be moved currently
@@ -79538,7 +79688,10 @@ class slider_Slider extends baseComponent_BaseComponent {
79538
79688
  ["".concat(slider_prefixCls, "-dot-active")]: this.foundation.isMarkActive(Number(mark)) === 'active'
79539
79689
  });
79540
79690
  const markPercent = (Number(mark) - min) / (max - min);
79541
- return activeResult ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("span", {
79691
+ return activeResult ?
79692
+ /*#__PURE__*/
79693
+ // eslint-disable-next-line jsx-a11y/no-static-element-interactions
79694
+ external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("span", {
79542
79695
  key: mark,
79543
79696
  onClick: e => this.foundation.handleWrapClick(e),
79544
79697
  className: markClass,
@@ -79720,6 +79873,7 @@ class slider_Slider extends baseComponent_BaseComponent {
79720
79873
  onHandleMove: function (mousePos, isMin) {
79721
79874
  let stateChangeCallback = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : noop_default.a;
79722
79875
  let clickTrack = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
79876
+ let outPutValue = arguments.length > 4 ? arguments[4] : undefined;
79723
79877
 
79724
79878
  const sliderDOMIsInRenderTree = _this.foundation.checkAndUpdateIsInRenderTreeState();
79725
79879
 
@@ -79728,32 +79882,32 @@ class slider_Slider extends baseComponent_BaseComponent {
79728
79882
  }
79729
79883
 
79730
79884
  const {
79731
- value,
79732
- onChange
79885
+ value
79733
79886
  } = _this.props;
79887
+ let finalOutPutValue = outPutValue;
79734
79888
 
79735
- const moveValue = _this.foundation.transPosToValue(mousePos, isMin);
79889
+ if (finalOutPutValue === undefined) {
79890
+ const moveValue = _this.foundation.transPosToValue(mousePos, isMin);
79736
79891
 
79737
- if (moveValue === false) {
79738
- return;
79739
- }
79892
+ if (moveValue === false) {
79893
+ return;
79894
+ }
79740
79895
 
79741
- const outPutValue = _this.foundation.outPutValue(moveValue);
79896
+ finalOutPutValue = _this.foundation.outPutValue(moveValue);
79897
+ }
79742
79898
 
79743
79899
  const {
79744
79900
  currentValue
79745
79901
  } = _this.state;
79746
79902
 
79747
- if (!isEqual_default()(_this.foundation.outPutValue(currentValue), outPutValue)) {
79748
- onChange(outPutValue);
79749
-
79903
+ if (!isEqual_default()(_this.foundation.outPutValue(currentValue), finalOutPutValue)) {
79750
79904
  if (!clickTrack && _this.foundation.valueFormatIsCorrect(value)) {
79751
79905
  // still require afterChangeCallback when click on the track directly, need skip here
79752
79906
  return false;
79753
79907
  }
79754
79908
 
79755
79909
  _this.setState({
79756
- currentValue: outPutValue
79910
+ currentValue: finalOutPutValue
79757
79911
  }, stateChangeCallback);
79758
79912
  }
79759
79913
  },
@@ -104651,6 +104805,7 @@ arrayField_ArrayFieldComponent.contextType = FormUpdaterContext;
104651
104805
 
104652
104806
 
104653
104807
 
104808
+
104654
104809
 
104655
104810
 
104656
104811
  /** Form */