@nutui/nutui-react 2.0.5 → 2.0.7

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 (61) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/esm/Address.js +30 -17
  3. package/dist/esm/Audio/style/style.css +1 -1
  4. package/dist/esm/Audio.js +1 -1
  5. package/dist/esm/Button/style/style.css +1 -1
  6. package/dist/esm/Button.js +15 -18
  7. package/dist/esm/Dialog/style/style.css +1 -1
  8. package/dist/esm/Range.js +5 -13
  9. package/dist/esm/Uploader.js +3 -0
  10. package/dist/esm/types/src/packages/address/address.d.ts +9 -2
  11. package/dist/esm/types/src/packages/address/address.taro.d.ts +8 -2
  12. package/dist/esm/types/src/packages/audio/audio.d.ts +5 -4
  13. package/dist/esm/types/src/packages/avatar/avatar.d.ts +2 -1
  14. package/dist/esm/types/src/packages/avatar/avatar.taro.d.ts +2 -1
  15. package/dist/esm/types/src/packages/backtop/backtop.d.ts +2 -1
  16. package/dist/esm/types/src/packages/backtop/backtop.taro.d.ts +2 -1
  17. package/dist/esm/types/src/packages/button/button.d.ts +2 -1
  18. package/dist/esm/types/src/packages/button/button.taro.d.ts +2 -1
  19. package/dist/esm/types/src/packages/col/col.d.ts +2 -1
  20. package/dist/esm/types/src/packages/col/col.taro.d.ts +2 -1
  21. package/dist/esm/types/src/packages/dialog/config.d.ts +2 -1
  22. package/dist/esm/types/src/packages/formitem/types.d.ts +2 -1
  23. package/dist/esm/types/src/packages/row/row.d.ts +2 -1
  24. package/dist/esm/types/src/packages/row/row.taro.d.ts +2 -1
  25. package/dist/esm/types/src/packages/searchbar/searchbar.d.ts +6 -5
  26. package/dist/esm/types/src/packages/searchbar/searchbar.taro.d.ts +6 -5
  27. package/dist/esm/types/src/packages/swipe/swipe.d.ts +5 -4
  28. package/dist/esm/types/src/packages/swipe/swipe.taro.d.ts +5 -4
  29. package/dist/esm/types/src/packages/tag/tag.d.ts +2 -1
  30. package/dist/esm/types/src/packages/tag/tag.taro.d.ts +2 -1
  31. package/dist/esm/types/src/packages/textarea/textarea.d.ts +3 -2
  32. package/dist/esm/types/src/packages/uploader/uploader.d.ts +1 -0
  33. package/dist/esm/types/src/utils/use-touch.d.ts +2 -2
  34. package/dist/locales/base.js +1 -1
  35. package/dist/locales/en-US.js +1 -1
  36. package/dist/locales/id-ID.js +1 -1
  37. package/dist/locales/tr-TR.js +1 -1
  38. package/dist/locales/zh-CN.js +1 -1
  39. package/dist/locales/zh-TW.js +1 -1
  40. package/dist/locales/zh-UG.js +1 -1
  41. package/dist/nutui.react.es.js +60 -46
  42. package/dist/nutui.react.umd.js +60 -46
  43. package/dist/packages/button/button.scss +6 -0
  44. package/dist/style.css +1 -1
  45. package/dist/style.mjs +1 -1
  46. package/dist/types/packages/address/address.d.ts +13 -2
  47. package/dist/types/packages/audio/audio.d.ts +5 -4
  48. package/dist/types/packages/avatar/avatar.d.ts +2 -1
  49. package/dist/types/packages/backtop/backtop.d.ts +2 -1
  50. package/dist/types/packages/button/button.d.ts +3 -2
  51. package/dist/types/packages/col/col.d.ts +2 -1
  52. package/dist/types/packages/dialog/config.d.ts +2 -1
  53. package/dist/types/packages/formitem/types.d.ts +2 -1
  54. package/dist/types/packages/row/row.d.ts +2 -1
  55. package/dist/types/packages/searchbar/searchbar.d.ts +6 -5
  56. package/dist/types/packages/swipe/swipe.d.ts +5 -4
  57. package/dist/types/packages/tag/tag.d.ts +2 -1
  58. package/dist/types/packages/textarea/textarea.d.ts +3 -2
  59. package/dist/types/packages/uploader/uploader.d.ts +1 -0
  60. package/dist/types/utils/use-touch.d.ts +2 -2
  61. package/package.json +1 -1
@@ -9,7 +9,7 @@ var __publicField = (obj, key, value) => {
9
9
  return value;
10
10
  };
11
11
  /*!
12
- * @nutui/nutui-react v2.0.5 Wed Jul 19 2023 14:14:53 GMT+0800 (China Standard Time)
12
+ * @nutui/nutui-react v2.0.7 Wed Jul 26 2023 13:54:35 GMT+0800 (China Standard Time)
13
13
  * (c) 2023 @jdf2e.
14
14
  * Released under the MIT License.
15
15
  */
@@ -2467,32 +2467,29 @@ Check the top-level render call using <` + t + ">.");
2467
2467
  onClick(e);
2468
2468
  }
2469
2469
  };
2470
- return (
2471
- // eslint-disable-next-line react/button-has-type
2472
- /* @__PURE__ */ React.createElement(
2473
- "button",
2474
- {
2475
- ...rest,
2476
- ref,
2477
- type: nativeType,
2478
- className: classNames(
2479
- prefixCls,
2480
- className,
2481
- props.type ? `${prefixCls}--${type2}` : null,
2482
- props.fill ? `${prefixCls}--${fill}` : null,
2483
- {
2484
- [`${prefixCls}--${size}`]: size,
2485
- [`${prefixCls}--${shape}`]: shape,
2486
- [`${prefixCls}--block`]: block,
2487
- [`${prefixCls}--disabled`]: disabled,
2488
- [`${prefixCls}--loading`]: loading
2489
- }
2490
- ),
2491
- style: { ...getStyle(), ...style },
2492
- onClick: (e) => handleClick2(e)
2493
- },
2494
- /* @__PURE__ */ React.createElement("div", { className: "nut-button__warp" }, loading ? /* @__PURE__ */ React.createElement(k$3, { className: "nut-icon-loading" }) : null, !loading && icon ? icon : null, children && /* @__PURE__ */ React.createElement("div", { className: icon || loading ? "nut-button-text" : "" }, children))
2495
- )
2470
+ return /* @__PURE__ */ React.createElement(
2471
+ "button",
2472
+ {
2473
+ ...rest,
2474
+ ref,
2475
+ type: nativeType,
2476
+ className: classNames(
2477
+ prefixCls,
2478
+ className,
2479
+ props.type ? `${prefixCls}--${type2}` : null,
2480
+ props.fill ? `${prefixCls}--${fill}` : null,
2481
+ {
2482
+ [`${prefixCls}--${size}`]: size,
2483
+ [`${prefixCls}--${shape}`]: shape,
2484
+ [`${prefixCls}--block`]: block,
2485
+ [`${prefixCls}--disabled`]: disabled,
2486
+ [`${prefixCls}--loading`]: loading
2487
+ }
2488
+ ),
2489
+ style: { ...getStyle(), ...style },
2490
+ onClick: (e) => handleClick2(e)
2491
+ },
2492
+ /* @__PURE__ */ React.createElement("div", { className: "nut-button__warp" }, loading ? /* @__PURE__ */ React.createElement(k$3, { className: "nut-icon-loading" }) : null, !loading && icon ? icon : null, children && /* @__PURE__ */ React.createElement("div", { className: icon || loading ? "nut-button-text" : "" }, children))
2496
2493
  );
2497
2494
  }
2498
2495
  );
@@ -13068,7 +13065,6 @@ Please add \`${key}Action\` when creating your handler.`);
13068
13065
  };
13069
13066
  const defaultProps$$ = {
13070
13067
  ...ComponentDefaults,
13071
- visible: false,
13072
13068
  defaultValue: [],
13073
13069
  type: "custom",
13074
13070
  options: [],
@@ -13082,10 +13078,11 @@ Please add \`${key}Action\` when creating your handler.`);
13082
13078
  closeIcon: null,
13083
13079
  backIcon: null
13084
13080
  };
13085
- const Address = (props) => {
13081
+ const InternalAddress = (props, ref) => {
13086
13082
  const { locale } = useConfig();
13087
13083
  const {
13088
13084
  visible,
13085
+ defaultVisible,
13089
13086
  defaultValue,
13090
13087
  children,
13091
13088
  type: type2,
@@ -13113,19 +13110,31 @@ Please add \`${key}Action\` when creating your handler.`);
13113
13110
  };
13114
13111
  const classPrefix2 = "nut-address";
13115
13112
  const [currentType, setCurrentType] = React.useState(type2);
13116
- const [showPopup, setShowPopup] = React.useState(visible);
13117
- const handClose = () => {
13118
- setShowPopup(false);
13113
+ const [innerVisible, setInnerVisible] = usePropsValue({
13114
+ value: visible,
13115
+ defaultValue: defaultVisible,
13116
+ finalValue: defaultVisible
13117
+ });
13118
+ React.useImperativeHandle(ref, () => {
13119
+ return {
13120
+ open() {
13121
+ setInnerVisible(true);
13122
+ },
13123
+ close() {
13124
+ setInnerVisible(false);
13125
+ }
13126
+ };
13127
+ });
13128
+ const handleClose = () => {
13129
+ setInnerVisible(false);
13130
+ onClose && onClose();
13119
13131
  };
13120
- React.useEffect(() => {
13121
- setShowPopup(visible);
13122
- }, [visible]);
13123
13132
  const renderLeftOnCustomSwitch = () => {
13124
13133
  return /* @__PURE__ */ React.createElement(React.Fragment, null, custom && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-left-icon`, onClick: onSwitchModule }, React.isValidElement(backIcon) ? backIcon : /* @__PURE__ */ React.createElement(y$6, { color: "#cccccc" })));
13125
13134
  };
13126
13135
  const selectedExistItem = (data) => {
13127
13136
  onExistSelect && onExistSelect(data);
13128
- handClose();
13137
+ handleClose();
13129
13138
  };
13130
13139
  const onSwitchModule = () => {
13131
13140
  if (currentType === "exist") {
@@ -13138,7 +13147,7 @@ Please add \`${key}Action\` when creating your handler.`);
13138
13147
  return /* @__PURE__ */ React.createElement(React.Fragment, null, currentType === "custom" || currentType === "custom2" ? /* @__PURE__ */ React.createElement(
13139
13148
  CustomRender,
13140
13149
  {
13141
- visible: showPopup,
13150
+ visible: innerVisible,
13142
13151
  closeable: true,
13143
13152
  title: title || locale.address.selectRegion,
13144
13153
  left: renderLeftOnCustomSwitch(),
@@ -13148,7 +13157,7 @@ Please add \`${key}Action\` when creating your handler.`);
13148
13157
  optionKey,
13149
13158
  type: currentType,
13150
13159
  height,
13151
- onClose: handClose,
13160
+ onClose: handleClose,
13152
13161
  onChange: (val, params) => {
13153
13162
  onChange == null ? void 0 : onChange(val, params);
13154
13163
  }
@@ -13156,12 +13165,13 @@ Please add \`${key}Action\` when creating your handler.`);
13156
13165
  ) : /* @__PURE__ */ React.createElement(
13157
13166
  Popup,
13158
13167
  {
13159
- visible: showPopup,
13168
+ visible: innerVisible,
13160
13169
  position: "bottom",
13161
13170
  round: true,
13162
13171
  closeable: true,
13163
13172
  closeIcon,
13164
- title: title || locale.address.selectRegion
13173
+ title: title || locale.address.selectRegion,
13174
+ onClose: handleClose
13165
13175
  },
13166
13176
  /* @__PURE__ */ React.createElement(
13167
13177
  "div",
@@ -13185,6 +13195,7 @@ Please add \`${key}Action\` when creating your handler.`);
13185
13195
  )
13186
13196
  ));
13187
13197
  };
13198
+ const Address = React.forwardRef(InternalAddress);
13188
13199
  Address.defaultProps = defaultProps$$;
13189
13200
  Address.displayName = "NutAddress";
13190
13201
  const Utils = {
@@ -18039,7 +18050,7 @@ Please add \`${key}Action\` when creating your handler.`);
18039
18050
  setEaxctValue(newValue);
18040
18051
  updateValue(newValue);
18041
18052
  };
18042
- const onTouchEnd = (event) => {
18053
+ const onTouchEnd = () => {
18043
18054
  if (disabled) {
18044
18055
  return;
18045
18056
  }
@@ -18088,8 +18099,8 @@ Please add \`${key}Action\` when creating your handler.`);
18088
18099
  onTouchStart(e);
18089
18100
  },
18090
18101
  onTouchMove: (e) => onTouchMove(e),
18091
- onTouchEnd: (e) => onTouchEnd(),
18092
- onTouchCancel: (e) => onTouchEnd(),
18102
+ onTouchEnd,
18103
+ onTouchCancel: onTouchEnd,
18093
18104
  onClick: (e) => e.stopPropagation()
18094
18105
  },
18095
18106
  renderButton(index)
@@ -18100,8 +18111,8 @@ Please add \`${key}Action\` when creating your handler.`);
18100
18111
  className: "nut-range-button-wrapper",
18101
18112
  onTouchStart: (e) => onTouchStart(e),
18102
18113
  onTouchMove: (e) => onTouchMove(e),
18103
- onTouchEnd: (e) => onTouchEnd(),
18104
- onTouchCancel: (e) => onTouchEnd(),
18114
+ onTouchEnd,
18115
+ onTouchCancel: onTouchEnd,
18105
18116
  onClick: (e) => e.stopPropagation()
18106
18117
  },
18107
18118
  renderButton()
@@ -18994,6 +19005,7 @@ Please add \`${key}Action\` when creating your handler.`);
18994
19005
  __publicField(this, "path");
18995
19006
  __publicField(this, "percentage", 0);
18996
19007
  __publicField(this, "formData", new FormData());
19008
+ __publicField(this, "responseText");
18997
19009
  }
18998
19010
  }
18999
19011
  const InternalUploader = (props, ref) => {
@@ -19124,6 +19136,7 @@ Please add \`${key}Action\` when creating your handler.`);
19124
19136
  if (item.uid === fileItem.uid) {
19125
19137
  item.status = "success";
19126
19138
  item.message = locale.uploader.success;
19139
+ item.responseText = responseText;
19127
19140
  }
19128
19141
  return item;
19129
19142
  });
@@ -19141,6 +19154,7 @@ Please add \`${key}Action\` when creating your handler.`);
19141
19154
  if (item.uid === fileItem.uid) {
19142
19155
  item.status = "error";
19143
19156
  item.message = locale.uploader.error;
19157
+ item.responseText = responseText;
19144
19158
  }
19145
19159
  return item;
19146
19160
  });
@@ -22009,7 +22023,7 @@ Please add \`${key}Action\` when creating your handler.`);
22009
22023
  }
22010
22024
  };
22011
22025
  const onTimeupdate = (e) => {
22012
- const time = parseInt(e.target.currentTime);
22026
+ const time = parseInt(String(e.target.currentTime));
22013
22027
  const formated = formatSeconds(`${time}`);
22014
22028
  statusRef.current.currentDuration = formated;
22015
22029
  setPercent(time / statusRef.current.second * 100);
@@ -65,6 +65,7 @@
65
65
  &--solid {
66
66
  color: $button-primary-color;
67
67
  background: $button-primary-background-color;
68
+ background-origin: border-box;
68
69
  border: $button-border-width solid transparent;
69
70
  }
70
71
 
@@ -82,6 +83,7 @@
82
83
  &--primary {
83
84
  color: $button-primary-color;
84
85
  background: $button-primary-background-color;
86
+ background-origin: border-box;
85
87
  border: $button-border-width solid transparent;
86
88
 
87
89
  &.nut-button--outline {
@@ -98,6 +100,7 @@
98
100
  &--info {
99
101
  color: $button-info-color;
100
102
  background: $button-info-background-color;
103
+ background-origin: border-box;
101
104
  border: $button-border-width solid transparent;
102
105
 
103
106
  &.nut-button--outline {
@@ -114,6 +117,7 @@
114
117
  &--success {
115
118
  color: $button-success-color;
116
119
  background: $button-success-background-color;
120
+ background-origin: border-box;
117
121
  border: $button-border-width solid transparent;
118
122
 
119
123
  &.nut-button--outline {
@@ -130,6 +134,7 @@
130
134
  &--danger {
131
135
  color: $button-danger-color;
132
136
  background: $button-danger-background-color;
137
+ background-origin: border-box;
133
138
  border: $button-border-width solid transparent;
134
139
 
135
140
  &.nut-button--outline {
@@ -146,6 +151,7 @@
146
151
  &--warning {
147
152
  color: $button-warning-color;
148
153
  background: $button-warning-background-color;
154
+ background-origin: border-box;
149
155
  border: $button-border-width solid transparent;
150
156
 
151
157
  &.nut-button--outline {