@nutui/nutui-react 2.3.8-beta.0 → 2.3.9

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 (216) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/dist/esm/ActionSheet/style/style.css +1 -1
  3. package/dist/esm/Address/style/style.css +1 -1
  4. package/dist/esm/Animate/style/style.css +1 -1
  5. package/dist/esm/Audio/style/style.css +1 -1
  6. package/dist/esm/Avatar/style/style.css +1 -1
  7. package/dist/esm/AvatarCropper/style/style.css +1 -1
  8. package/dist/esm/AvatarGroup/style/style.css +1 -1
  9. package/dist/esm/Badge/style/style.css +1 -1
  10. package/dist/esm/Barrage/style/style.css +1 -1
  11. package/dist/esm/Button/style/style.css +1 -1
  12. package/dist/esm/Calendar/style/style.css +1 -1
  13. package/dist/esm/CalendarCard/style/style.css +1 -1
  14. package/dist/esm/Card/style/style.css +1 -1
  15. package/dist/esm/Cascader/style/style.css +1 -1
  16. package/dist/esm/Cell/style/style.css +1 -1
  17. package/dist/esm/CellGroup/style/style.css +1 -1
  18. package/dist/esm/Checkbox/style/style.css +1 -1
  19. package/dist/esm/CheckboxGroup/style/style.css +1 -1
  20. package/dist/esm/CircleProgress/style/style.css +1 -1
  21. package/dist/esm/Col/style/style.css +1 -1
  22. package/dist/esm/Collapse/style/style.css +1 -1
  23. package/dist/esm/CollapseItem/style/style.css +1 -1
  24. package/dist/esm/DatePicker/style/style.css +1 -1
  25. package/dist/esm/Dialog/style/style.css +1 -1
  26. package/dist/esm/Divider/style/style.css +1 -1
  27. package/dist/esm/Elevator/style/style.css +1 -1
  28. package/dist/esm/Empty/style/style.css +1 -1
  29. package/dist/esm/FixedNav/style/style.css +1 -1
  30. package/dist/esm/Form/style/style.css +1 -1
  31. package/dist/esm/FormItem/style/style.css +1 -1
  32. package/dist/esm/Grid/style/style.css +1 -1
  33. package/dist/esm/GridItem/style/style.css +1 -1
  34. package/dist/esm/Image/style/style.css +1 -1
  35. package/dist/esm/ImagePreview/style/style.css +1 -1
  36. package/dist/esm/Indicator/style/style.css +1 -1
  37. package/dist/esm/InfiniteLoading/style/style.css +1 -1
  38. package/dist/esm/InfiniteLoading.js +7 -6
  39. package/dist/esm/Menu/style/style.css +1 -1
  40. package/dist/esm/MenuItem/style/style.css +1 -1
  41. package/dist/esm/NavBar/style/style.css +1 -1
  42. package/dist/esm/NavBar.js +49 -5
  43. package/dist/esm/NoticeBar/style/style.css +1 -1
  44. package/dist/esm/Notify/style/style.css +1 -1
  45. package/dist/esm/NumberKeyboard/style/style.css +1 -1
  46. package/dist/esm/Overlay/style/style.css +1 -1
  47. package/dist/esm/Pagination/style/style.css +1 -1
  48. package/dist/esm/Picker/style/style.css +1 -1
  49. package/dist/esm/Picker.js +1 -13
  50. package/dist/esm/Popover/style/style.css +1 -1
  51. package/dist/esm/Popup/style/style.css +1 -1
  52. package/dist/esm/Price/style/style.css +1 -1
  53. package/dist/esm/Progress/style/style.css +1 -1
  54. package/dist/esm/PullToRefresh/style/style.css +1 -1
  55. package/dist/esm/Radio/style/style.css +1 -1
  56. package/dist/esm/RadioGroup.js +3 -2
  57. package/dist/esm/Range/style/style.css +1 -1
  58. package/dist/esm/Rate/style/style.css +1 -1
  59. package/dist/esm/Rate.js +90 -4
  60. package/dist/esm/SearchBar/style/style.css +1 -1
  61. package/dist/esm/ShortPassword/style/style.css +1 -1
  62. package/dist/esm/SideNavBar/style/style.css +1 -1
  63. package/dist/esm/Skeleton/style/style.css +1 -1
  64. package/dist/esm/Space/style/style.css +1 -1
  65. package/dist/esm/Step/style/style.css +1 -1
  66. package/dist/esm/Step.js +1 -1
  67. package/dist/esm/Steps/style/style.css +1 -1
  68. package/dist/esm/Swipe/style/style.css +1 -1
  69. package/dist/esm/Swiper/style/style.css +1 -1
  70. package/dist/esm/Switch/style/style.css +1 -1
  71. package/dist/esm/Tabbar/style/style.css +1 -1
  72. package/dist/esm/TabbarItem/style/style.css +1 -1
  73. package/dist/esm/Table/style/style.css +1 -1
  74. package/dist/esm/Tabs/style/style.css +1 -1
  75. package/dist/esm/Tag/style/style.css +1 -1
  76. package/dist/esm/TextArea/style/style.css +1 -1
  77. package/dist/esm/TextArea.js +1 -1
  78. package/dist/esm/TimeDetail/style/style.css +1 -1
  79. package/dist/esm/TimeSelect/style/style.css +1 -1
  80. package/dist/esm/Toast/style/style.css +1 -1
  81. package/dist/esm/Tour/style/style.css +1 -1
  82. package/dist/esm/TrendArrow/style/style.css +1 -1
  83. package/dist/esm/Uploader/style/style.css +1 -1
  84. package/dist/esm/VirtualList/style/style.css +1 -1
  85. package/dist/esm/configprovider2.js +8 -4
  86. package/dist/esm/popup2.js +2 -1
  87. package/dist/esm/radio2.js +4 -4
  88. package/dist/esm/types/src/packages/configprovider/configprovider.d.ts +2 -0
  89. package/dist/esm/types/src/packages/configprovider/configprovider.taro.d.ts +2 -0
  90. package/dist/esm/types/src/packages/configprovider/index.d.ts +1 -1
  91. package/dist/esm/types/src/packages/configprovider/index.taro.d.ts +1 -1
  92. package/dist/esm/types/src/packages/navbar/navbar.taro.d.ts +2 -1
  93. package/dist/esm/types/src/packages/popover/popover.taro.d.ts +7 -0
  94. package/dist/esm/types/src/packages/radio/index.d.ts +2 -1
  95. package/dist/esm/types/src/packages/radio/index.taro.d.ts +2 -1
  96. package/dist/esm/types/src/packages/radio/radio.d.ts +1 -2
  97. package/dist/esm/types/src/packages/radio/radio.taro.d.ts +1 -2
  98. package/dist/esm/types/src/packages/radio/types.d.ts +2 -0
  99. package/dist/esm/types/src/packages/radiogroup/context.d.ts +2 -0
  100. package/dist/esm/types/src/packages/radiogroup/index.d.ts +1 -0
  101. package/dist/esm/types/src/packages/radiogroup/index.taro.d.ts +1 -0
  102. package/dist/esm/types/src/packages/radiogroup/radiogroup.d.ts +4 -6
  103. package/dist/esm/types/src/packages/radiogroup/radiogroup.taro.d.ts +4 -6
  104. package/dist/esm/types/src/packages/radiogroup/types.d.ts +4 -0
  105. package/dist/esm/types/src/packages/rate/rate.d.ts +2 -0
  106. package/dist/esm/types/src/packages/rate/rate.taro.d.ts +2 -0
  107. package/dist/esm/types/src/packages/video/video.taro.d.ts +4 -5
  108. package/dist/esm/use-refs.js +17 -0
  109. package/dist/locales/base.js +1 -1
  110. package/dist/locales/en-US.js +1 -1
  111. package/dist/locales/id-ID.js +1 -1
  112. package/dist/locales/tr-TR.js +1 -1
  113. package/dist/locales/zh-CN.js +1 -1
  114. package/dist/locales/zh-TW.js +1 -1
  115. package/dist/locales/zh-UG.js +1 -1
  116. package/dist/nutui.react.es.js +147 -27
  117. package/dist/nutui.react.umd.js +147 -27
  118. package/dist/packages/address/address.scss +12 -0
  119. package/dist/packages/animate/animate.scss +49 -0
  120. package/dist/packages/audio/audio.scss +14 -0
  121. package/dist/packages/avatar/avatar.scss +25 -0
  122. package/dist/packages/avatarcropper/avatarcropper.scss +52 -0
  123. package/dist/packages/avatargroup/avatargroup.scss +11 -0
  124. package/dist/packages/badge/badge.scss +8 -0
  125. package/dist/packages/barrage/barrage.scss +17 -0
  126. package/dist/packages/button/button.scss +18 -0
  127. package/dist/packages/calendar/calendar.scss +24 -0
  128. package/dist/packages/calendarcard/calendarcard.scss +41 -0
  129. package/dist/packages/card/card.scss +21 -0
  130. package/dist/packages/cascader/cascader.scss +8 -0
  131. package/dist/packages/cellgroup/cellgroup.scss +14 -0
  132. package/dist/packages/checkbox/checkbox.scss +38 -0
  133. package/dist/packages/checkboxgroup/checkboxgroup.scss +24 -8
  134. package/dist/packages/circleprogress/circleprogress.scss +8 -0
  135. package/dist/packages/col/col.scss +25 -0
  136. package/dist/packages/collapseitem/collapseitem.scss +15 -0
  137. package/dist/packages/dialog/dialog.scss +29 -0
  138. package/dist/packages/divider/divider.scss +22 -0
  139. package/dist/packages/elevator/elevator.scss +20 -0
  140. package/dist/packages/ellipsis/ellipsis.scss +1 -0
  141. package/dist/packages/empty/empty.scss +11 -0
  142. package/dist/packages/fixednav/fixednav.scss +75 -0
  143. package/dist/packages/form/form.scss +31 -0
  144. package/dist/packages/formitem/formitem.scss +15 -0
  145. package/dist/packages/grid/grid.scss +8 -0
  146. package/dist/packages/griditem/griditem.scss +37 -0
  147. package/dist/packages/image/image.scss +13 -0
  148. package/dist/packages/imagepreview/imagepreview.scss +26 -0
  149. package/dist/packages/indicator/indicator.scss +15 -0
  150. package/dist/packages/infiniteloading/infiniteloading.scss +13 -0
  151. package/dist/packages/loading/loading.scss +6 -0
  152. package/dist/packages/menu/menu.scss +9 -0
  153. package/dist/packages/menuitem/menuitem.scss +12 -0
  154. package/dist/packages/navbar/navbar.scss +68 -0
  155. package/dist/packages/noticebar/noticebar.scss +22 -0
  156. package/dist/packages/notify/notify.scss +10 -0
  157. package/dist/packages/numberkeyboard/numberkeyboard.scss +27 -0
  158. package/dist/packages/overlay/overlay.scss +6 -0
  159. package/dist/packages/pagination/pagination.scss +24 -0
  160. package/dist/packages/popover/popover.scss +105 -0
  161. package/dist/packages/popup/popup.scss +76 -0
  162. package/dist/packages/price/price.scss +19 -0
  163. package/dist/packages/progress/progress.scss +7 -0
  164. package/dist/packages/pulltorefresh/pulltorefresh.scss +10 -0
  165. package/dist/packages/radio/radio.scss +21 -0
  166. package/dist/packages/range/range.scss +65 -0
  167. package/dist/packages/rate/rate.scss +31 -0
  168. package/dist/packages/safearea/safearea.scss +2 -0
  169. package/dist/packages/searchbar/searchbar.scss +65 -0
  170. package/dist/packages/shortpassword/shortpassword.scss +25 -0
  171. package/dist/packages/sidenavbar/sidenavbar.scss +15 -0
  172. package/dist/packages/skeleton/skeleton.scss +22 -1
  173. package/dist/packages/space/space.scss +30 -0
  174. package/dist/packages/step/step.scss +50 -4
  175. package/dist/packages/swipe/swipe.scss +15 -0
  176. package/dist/packages/swiper/swiper.scss +14 -0
  177. package/dist/packages/switch/switch.scss +13 -0
  178. package/dist/packages/tabbar/tabbar.scss +13 -0
  179. package/dist/packages/tabbaritem/tabbaritem.scss +2 -0
  180. package/dist/packages/table/table.scss +57 -0
  181. package/dist/packages/tabs/tabs.scss +71 -0
  182. package/dist/packages/tag/tag.scss +8 -0
  183. package/dist/packages/textarea/textarea.scss +17 -0
  184. package/dist/packages/timedetail/timedetail.scss +5 -0
  185. package/dist/packages/timeselect/timeselect.scss +5 -0
  186. package/dist/packages/toast/toast.scss +15 -0
  187. package/dist/packages/tour/tour.scss +23 -0
  188. package/dist/packages/trendarrow/trendarrow.scss +13 -0
  189. package/dist/packages/uploader/uploader.scss +36 -0
  190. package/dist/packages/video/video.scss +3 -0
  191. package/dist/packages/virtuallist/virtuallist.scss +11 -0
  192. package/dist/style.css +1 -1
  193. package/dist/style.mjs +1 -1
  194. package/dist/types/packages/backtop/backtop.d.ts +1 -1
  195. package/dist/types/packages/configprovider/configprovider.d.ts +2 -0
  196. package/dist/types/packages/configprovider/configprovider.taro.d.ts +2 -0
  197. package/dist/types/packages/configprovider/index.d.ts +1 -1
  198. package/dist/types/packages/configprovider/index.taro.d.ts +1 -1
  199. package/dist/types/packages/navbar/navbar.taro.d.ts +2 -1
  200. package/dist/types/packages/overlay/overlay.d.ts +5 -1
  201. package/dist/types/packages/popover/popover.taro.d.ts +7 -0
  202. package/dist/types/packages/radio/index.d.ts +2 -1
  203. package/dist/types/packages/radio/index.taro.d.ts +2 -1
  204. package/dist/types/packages/radio/radio.d.ts +1 -2
  205. package/dist/types/packages/radio/radio.taro.d.ts +1 -2
  206. package/dist/types/packages/radio/types.d.ts +2 -0
  207. package/dist/types/packages/radiogroup/context.d.ts +2 -0
  208. package/dist/types/packages/radiogroup/index.d.ts +1 -0
  209. package/dist/types/packages/radiogroup/index.taro.d.ts +1 -0
  210. package/dist/types/packages/radiogroup/radiogroup.d.ts +8 -6
  211. package/dist/types/packages/radiogroup/radiogroup.taro.d.ts +4 -6
  212. package/dist/types/packages/radiogroup/types.d.ts +4 -0
  213. package/dist/types/packages/rate/rate.d.ts +10 -0
  214. package/dist/types/packages/rate/rate.taro.d.ts +2 -0
  215. package/dist/types/packages/video/video.taro.d.ts +4 -5
  216. package/package.json +1 -1
@@ -5,7 +5,7 @@ var __publicField = (obj, key, value) => {
5
5
  return value;
6
6
  };
7
7
  /*!
8
- * @nutui/nutui-react v2.3.8-beta.0 Tue Jan 23 2024 11:20:59 GMT+0800 (China Standard Time)
8
+ * @nutui/nutui-react v2.3.9 Fri Feb 02 2024 16:13:40 GMT+0800 (China Standard Time)
9
9
  * (c) 2023 @jdf2e.
10
10
  * Released under the MIT License.
11
11
  */
@@ -2379,7 +2379,8 @@ const zhCN = {
2379
2379
  const classPrefix$p = "nut-configprovider";
2380
2380
  const defaultConfigRef = {
2381
2381
  current: {
2382
- locale: zhCN
2382
+ locale: zhCN,
2383
+ direction: "ltr"
2383
2384
  }
2384
2385
  };
2385
2386
  const getDefaultConfig = () => {
@@ -2397,7 +2398,7 @@ function convertThemeVarsToCSSVars(themeVars) {
2397
2398
  return cssVars;
2398
2399
  }
2399
2400
  const ConfigProvider = (props) => {
2400
- const { style, className, children, ...config2 } = props;
2401
+ const { style, className, children, direction, ...config2 } = props;
2401
2402
  const mergedConfig = useMemo(
2402
2403
  () => {
2403
2404
  return {
@@ -2420,8 +2421,10 @@ const ConfigProvider = (props) => {
2420
2421
  className: classNames(classPrefix$p, className),
2421
2422
  style: {
2422
2423
  ...cssVarStyle,
2423
- ...style
2424
- }
2424
+ ...style,
2425
+ direction
2426
+ },
2427
+ dir: direction
2425
2428
  },
2426
2429
  children
2427
2430
  ));
@@ -10663,8 +10666,38 @@ const NavBar = (props) => {
10663
10666
  zIndex
10664
10667
  };
10665
10668
  };
10669
+ const leftRef = useRef(null);
10670
+ const rightRef = useRef(null);
10671
+ const wrapperRef = useRef(null);
10672
+ const [contentWidth, setContentWidth] = useState("50%");
10673
+ const getNodeWidth = (node) => {
10674
+ if (node) {
10675
+ const ele = getRect(node);
10676
+ return ele.width;
10677
+ }
10678
+ return 0;
10679
+ };
10680
+ useEffect(() => {
10681
+ if (titleAlign === "left") {
10682
+ return;
10683
+ }
10684
+ if (!(back || left || right)) {
10685
+ setContentWidth("100%");
10686
+ return;
10687
+ }
10688
+ const leftRectWidth = getNodeWidth(leftRef == null ? void 0 : leftRef.current);
10689
+ const rightRectWidth = getNodeWidth(rightRef == null ? void 0 : rightRef.current);
10690
+ const wrapperWidth = getNodeWidth(wrapperRef == null ? void 0 : wrapperRef.current);
10691
+ let centerWidth = wrapperWidth / 2;
10692
+ if (leftRectWidth && rightRectWidth) {
10693
+ centerWidth = wrapperWidth - (leftRectWidth > rightRectWidth ? leftRectWidth * 2 : rightRectWidth * 2);
10694
+ } else {
10695
+ centerWidth = wrapperWidth - leftRectWidth * 2 - rightRectWidth * 2;
10696
+ }
10697
+ setContentWidth(centerWidth.toFixed(2));
10698
+ }, [left, right, back]);
10666
10699
  const renderLeft = () => {
10667
- return back || left ? /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-left` }, back && /* @__PURE__ */ React__default.createElement(
10700
+ return back || left ? /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-left`, ref: leftRef }, back && /* @__PURE__ */ React__default.createElement(
10668
10701
  "div",
10669
10702
  {
10670
10703
  className: `${classPrefix2}-left-back`,
@@ -10674,13 +10707,21 @@ const NavBar = (props) => {
10674
10707
  ), left) : null;
10675
10708
  };
10676
10709
  const renderContent = () => {
10677
- return /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-title` }, children);
10710
+ let titleStyle = {};
10711
+ if (titleAlign === "center") {
10712
+ const contentRealWidth = `${contentWidth}${/%$/i.test(contentWidth) ? "" : "px"}`;
10713
+ titleStyle = {
10714
+ minWidth: contentRealWidth,
10715
+ width: contentRealWidth
10716
+ };
10717
+ }
10718
+ return /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-title`, style: titleStyle }, children);
10678
10719
  };
10679
10720
  const renderRight = () => {
10680
- return /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-right` }, right);
10721
+ return /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-right`, ref: rightRef }, right);
10681
10722
  };
10682
10723
  const renderWrapper = () => {
10683
- return /* @__PURE__ */ React__default.createElement("div", { className: cls, style: styles() }, renderLeft(), renderContent(), renderRight());
10724
+ return /* @__PURE__ */ React__default.createElement("div", { className: cls, style: styles(), ref: wrapperRef }, renderLeft(), renderContent(), renderRight());
10684
10725
  };
10685
10726
  const classes = classNames({
10686
10727
  [`${classPrefix2}-fixed`]: fixed,
@@ -10843,7 +10884,8 @@ const Popup = (props) => {
10843
10884
  {
10844
10885
  nodeRef,
10845
10886
  classNames: transitionName,
10846
- unmountOnExit: true,
10887
+ mountOnEnter: true,
10888
+ unmountOnExit: destroyOnClose,
10847
10889
  timeout: duration,
10848
10890
  in: innerVisible,
10849
10891
  onEntered: onHandleOpened,
@@ -17198,6 +17240,7 @@ const RadioGroup = React__default.forwardRef(
17198
17240
  value,
17199
17241
  defaultValue,
17200
17242
  onChange,
17243
+ shape,
17201
17244
  labelPosition,
17202
17245
  direction,
17203
17246
  options: options2,
@@ -17233,6 +17276,7 @@ const RadioGroup = React__default.forwardRef(
17233
17276
  value: {
17234
17277
  labelPosition: labelPosition || "right",
17235
17278
  disabled,
17279
+ shape,
17236
17280
  value: val2State,
17237
17281
  check: (value2) => {
17238
17282
  setVal2State(value2);
@@ -17360,11 +17404,11 @@ const Radio = (props) => {
17360
17404
  className: classNames(color())
17361
17405
  }) : /* @__PURE__ */ React__default.createElement(o$7, { className: classNames(color()) });
17362
17406
  };
17407
+ const renderByShape = (shape2) => {
17408
+ return shape2 === "button" ? renderButton() : /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, renderIcon(), renderLabel());
17409
+ };
17363
17410
  const renderRadioItem = () => {
17364
- if (shape === "button") {
17365
- return renderButton();
17366
- }
17367
- return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, renderIcon(), renderLabel());
17411
+ return renderByShape(context && context.shape ? context.shape : shape);
17368
17412
  };
17369
17413
  const handleClick2 = (e2) => {
17370
17414
  if (disabled || checkedStatement)
@@ -17706,7 +17750,8 @@ const defaultProps$N = {
17706
17750
  uncheckedIcon: null,
17707
17751
  disabled: false,
17708
17752
  readOnly: false,
17709
- allowHalf: false
17753
+ allowHalf: false,
17754
+ touchable: false
17710
17755
  };
17711
17756
  const Rate = (props) => {
17712
17757
  const {
@@ -17721,13 +17766,17 @@ const Rate = (props) => {
17721
17766
  disabled,
17722
17767
  readOnly,
17723
17768
  allowHalf,
17724
- onChange
17769
+ touchable,
17770
+ onChange,
17771
+ onTouchEnd
17725
17772
  } = {
17726
17773
  ...defaultProps$N,
17727
17774
  ...props
17728
17775
  };
17729
17776
  const classPrefix2 = "nut-rate";
17730
17777
  const [countArray, setCountArray] = useState([1, 2, 3, 4, 5]);
17778
+ const [refs, setRefs] = useRefs();
17779
+ const rateRects = useRef([]);
17731
17780
  const [score, setScore] = usePropsValue({
17732
17781
  value,
17733
17782
  defaultValue: Math.max(defaultValue || 0, min),
@@ -17764,6 +17813,81 @@ const Rate = (props) => {
17764
17813
  const value2 = Math.max(min, n - 0.5);
17765
17814
  setScore(value2);
17766
17815
  };
17816
+ const getScoreByPosition = (x) => {
17817
+ var _a2;
17818
+ if ((_a2 = rateRects.current) == null ? void 0 : _a2.length) {
17819
+ for (let index = rateRects.current.length - 1; index >= 0; index--) {
17820
+ const item = rateRects.current[index];
17821
+ if (item && x > item.left) {
17822
+ return allowHalf ? index + (x > item.left + item.width / 2 ? 1 : 0.5) : index + 1;
17823
+ }
17824
+ }
17825
+ return 0;
17826
+ }
17827
+ };
17828
+ const updateRects = () => {
17829
+ for (let index = 0; index < refs.length; index++) {
17830
+ const item = refs[index];
17831
+ if (item) {
17832
+ rateRects.current[index] = getRect(item);
17833
+ }
17834
+ }
17835
+ };
17836
+ const handleTouchStart = (e2) => {
17837
+ if (!touchable || readOnly || disabled) {
17838
+ return;
17839
+ }
17840
+ if (e2.cancelable) {
17841
+ e2.preventDefault();
17842
+ }
17843
+ e2.stopPropagation();
17844
+ updateRects();
17845
+ };
17846
+ const handleTouchMove = (e2) => {
17847
+ if (!touchable || readOnly || disabled) {
17848
+ return;
17849
+ }
17850
+ if (e2.cancelable) {
17851
+ e2.preventDefault();
17852
+ }
17853
+ e2.stopPropagation();
17854
+ const val = getScoreByPosition(e2.touches[0].clientX);
17855
+ if (val !== void 0) {
17856
+ setScore(Math.max(min, val));
17857
+ }
17858
+ };
17859
+ const handleTouchEnd = (e2) => {
17860
+ if (!touchable || readOnly || disabled) {
17861
+ return;
17862
+ }
17863
+ if (e2.cancelable) {
17864
+ e2.preventDefault();
17865
+ }
17866
+ e2.stopPropagation();
17867
+ const val = getScoreByPosition(e2.changedTouches[0].clientX);
17868
+ if (val !== void 0) {
17869
+ setScore(Math.max(min, val));
17870
+ onTouchEnd && onTouchEnd(e2, Math.max(min, val));
17871
+ }
17872
+ };
17873
+ const rateRef = useRef(null);
17874
+ useEffect(() => {
17875
+ const element = rateRef.current;
17876
+ if (element) {
17877
+ element.addEventListener("touchstart", handleTouchStart, {
17878
+ passive: false
17879
+ });
17880
+ element.addEventListener("touchmove", handleTouchMove, { passive: false });
17881
+ element.addEventListener("touchend", handleTouchEnd, { passive: false });
17882
+ }
17883
+ return () => {
17884
+ if (element) {
17885
+ element.removeEventListener("touchstart", handleTouchStart);
17886
+ element.removeEventListener("touchmove", handleTouchMove);
17887
+ element.removeEventListener("touchend", handleTouchEnd);
17888
+ }
17889
+ };
17890
+ }, []);
17767
17891
  return /* @__PURE__ */ React__default.createElement(
17768
17892
  "div",
17769
17893
  {
@@ -17775,14 +17899,16 @@ const Rate = (props) => {
17775
17899
  },
17776
17900
  className
17777
17901
  ),
17902
+ ref: rateRef,
17778
17903
  style
17779
17904
  },
17780
- countArray.map((n) => {
17905
+ countArray.map((n, index) => {
17781
17906
  return /* @__PURE__ */ React__default.createElement(
17782
17907
  "div",
17783
17908
  {
17784
17909
  className: `${classPrefix2}-item`,
17785
17910
  key: n,
17911
+ ref: setRefs(index),
17786
17912
  onClick: (event) => onClick(event, n)
17787
17913
  },
17788
17914
  /* @__PURE__ */ React__default.createElement(
@@ -18265,7 +18391,7 @@ const TextArea = (props) => {
18265
18391
  const textareaRef = useRef(null);
18266
18392
  const compositionRef = useRef(false);
18267
18393
  const format2 = (value2) => {
18268
- if (maxLength !== void 0 && value2.length > maxLength) {
18394
+ if (maxLength !== -1 && value2.length > maxLength) {
18269
18395
  return value2.substring(0, maxLength);
18270
18396
  }
18271
18397
  return value2;
@@ -19704,6 +19830,7 @@ const InfiniteLoading = (props) => {
19704
19830
  if (distance.current < refreshMaxH.current) {
19705
19831
  distance.current = 0;
19706
19832
  getRefreshTop().style.height = `${distance.current}px`;
19833
+ isTouching.current = false;
19707
19834
  } else {
19708
19835
  await (onRefresh == null ? void 0 : onRefresh());
19709
19836
  refreshDone();
@@ -23502,7 +23629,7 @@ const Step = (props) => {
23502
23629
  }
23503
23630
  return `${classPrefix2}-icon`;
23504
23631
  };
23505
- return /* @__PURE__ */ React__default.createElement("div", { className: classes, ...restProps, onClick: handleClickStep }, /* @__PURE__ */ React__default.createElement("div", { className: "nut-step-head" }, /* @__PURE__ */ React__default.createElement("div", { className: "nut-step-line" }), /* @__PURE__ */ React__default.createElement("div", { className: renderIconClass() }, icon || !dot && /* @__PURE__ */ React__default.createElement("span", { className: "nut-step-inner" }, value))), /* @__PURE__ */ React__default.createElement("div", { className: "nut-step-main" }, /* @__PURE__ */ React__default.createElement("span", { className: "nut-step-title" }, title), description && /* @__PURE__ */ React__default.createElement("span", { className: "nut-step-description" }, description)));
23632
+ return /* @__PURE__ */ React__default.createElement("div", { className: classes, ...restProps, onClick: handleClickStep }, /* @__PURE__ */ React__default.createElement("div", { className: "nut-step-head" }, /* @__PURE__ */ React__default.createElement("div", { className: "nut-step-line" }), /* @__PURE__ */ React__default.createElement("div", { className: renderIconClass() }, icon || !dot && /* @__PURE__ */ React__default.createElement("span", { className: "nut-step-inner" }, value))), (title || description) && /* @__PURE__ */ React__default.createElement("div", { className: "nut-step-main" }, /* @__PURE__ */ React__default.createElement("span", { className: "nut-step-title" }, title), description && /* @__PURE__ */ React__default.createElement("span", { className: "nut-step-description" }, description)));
23506
23633
  };
23507
23634
  Step.defaultProps = defaultProps$c;
23508
23635
  Step.displayName = "NutStep";
@@ -23535,14 +23662,7 @@ const Steps = (props) => {
23535
23662
  },
23536
23663
  className
23537
23664
  );
23538
- return /* @__PURE__ */ React__default.createElement(DataContext.Provider, { value: parentSteps }, React__default.createElement(
23539
- "div",
23540
- {
23541
- className: classes,
23542
- ...restProps
23543
- },
23544
- children
23545
- ));
23665
+ return /* @__PURE__ */ React__default.createElement(DataContext.Provider, { value: parentSteps }, /* @__PURE__ */ React__default.createElement("div", { className: classes, ...restProps }, children));
23546
23666
  };
23547
23667
  Steps.defaultProps = defaultProps$b;
23548
23668
  Steps.displayName = "NutSteps";
@@ -8,7 +8,7 @@ var __publicField = (obj, key, value) => {
8
8
  return value;
9
9
  };
10
10
  /*!
11
- * @nutui/nutui-react v2.3.8-beta.0 Tue Jan 23 2024 11:20:59 GMT+0800 (China Standard Time)
11
+ * @nutui/nutui-react v2.3.9 Fri Feb 02 2024 16:13:40 GMT+0800 (China Standard Time)
12
12
  * (c) 2023 @jdf2e.
13
13
  * Released under the MIT License.
14
14
  */
@@ -2397,7 +2397,8 @@ Check the top-level render call using <` + t2 + ">.");
2397
2397
  const classPrefix$p = "nut-configprovider";
2398
2398
  const defaultConfigRef = {
2399
2399
  current: {
2400
- locale: zhCN
2400
+ locale: zhCN,
2401
+ direction: "ltr"
2401
2402
  }
2402
2403
  };
2403
2404
  const getDefaultConfig = () => {
@@ -2415,7 +2416,7 @@ Check the top-level render call using <` + t2 + ">.");
2415
2416
  return cssVars;
2416
2417
  }
2417
2418
  const ConfigProvider = (props) => {
2418
- const { style, className, children, ...config2 } = props;
2419
+ const { style, className, children, direction, ...config2 } = props;
2419
2420
  const mergedConfig = useMemo(
2420
2421
  () => {
2421
2422
  return {
@@ -2438,8 +2439,10 @@ Check the top-level render call using <` + t2 + ">.");
2438
2439
  className: classNames(classPrefix$p, className),
2439
2440
  style: {
2440
2441
  ...cssVarStyle,
2441
- ...style
2442
- }
2442
+ ...style,
2443
+ direction
2444
+ },
2445
+ dir: direction
2443
2446
  },
2444
2447
  children
2445
2448
  ));
@@ -10681,8 +10684,38 @@ Please add \`${key}Action\` when creating your handler.`);
10681
10684
  zIndex
10682
10685
  };
10683
10686
  };
10687
+ const leftRef = React.useRef(null);
10688
+ const rightRef = React.useRef(null);
10689
+ const wrapperRef = React.useRef(null);
10690
+ const [contentWidth, setContentWidth] = React.useState("50%");
10691
+ const getNodeWidth = (node) => {
10692
+ if (node) {
10693
+ const ele = getRect(node);
10694
+ return ele.width;
10695
+ }
10696
+ return 0;
10697
+ };
10698
+ React.useEffect(() => {
10699
+ if (titleAlign === "left") {
10700
+ return;
10701
+ }
10702
+ if (!(back || left || right)) {
10703
+ setContentWidth("100%");
10704
+ return;
10705
+ }
10706
+ const leftRectWidth = getNodeWidth(leftRef == null ? void 0 : leftRef.current);
10707
+ const rightRectWidth = getNodeWidth(rightRef == null ? void 0 : rightRef.current);
10708
+ const wrapperWidth = getNodeWidth(wrapperRef == null ? void 0 : wrapperRef.current);
10709
+ let centerWidth = wrapperWidth / 2;
10710
+ if (leftRectWidth && rightRectWidth) {
10711
+ centerWidth = wrapperWidth - (leftRectWidth > rightRectWidth ? leftRectWidth * 2 : rightRectWidth * 2);
10712
+ } else {
10713
+ centerWidth = wrapperWidth - leftRectWidth * 2 - rightRectWidth * 2;
10714
+ }
10715
+ setContentWidth(centerWidth.toFixed(2));
10716
+ }, [left, right, back]);
10684
10717
  const renderLeft = () => {
10685
- return back || left ? /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-left` }, back && /* @__PURE__ */ React.createElement(
10718
+ return back || left ? /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-left`, ref: leftRef }, back && /* @__PURE__ */ React.createElement(
10686
10719
  "div",
10687
10720
  {
10688
10721
  className: `${classPrefix2}-left-back`,
@@ -10692,13 +10725,21 @@ Please add \`${key}Action\` when creating your handler.`);
10692
10725
  ), left) : null;
10693
10726
  };
10694
10727
  const renderContent = () => {
10695
- return /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-title` }, children);
10728
+ let titleStyle = {};
10729
+ if (titleAlign === "center") {
10730
+ const contentRealWidth = `${contentWidth}${/%$/i.test(contentWidth) ? "" : "px"}`;
10731
+ titleStyle = {
10732
+ minWidth: contentRealWidth,
10733
+ width: contentRealWidth
10734
+ };
10735
+ }
10736
+ return /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-title`, style: titleStyle }, children);
10696
10737
  };
10697
10738
  const renderRight = () => {
10698
- return /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-right` }, right);
10739
+ return /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-right`, ref: rightRef }, right);
10699
10740
  };
10700
10741
  const renderWrapper = () => {
10701
- return /* @__PURE__ */ React.createElement("div", { className: cls, style: styles() }, renderLeft(), renderContent(), renderRight());
10742
+ return /* @__PURE__ */ React.createElement("div", { className: cls, style: styles(), ref: wrapperRef }, renderLeft(), renderContent(), renderRight());
10702
10743
  };
10703
10744
  const classes = classNames({
10704
10745
  [`${classPrefix2}-fixed`]: fixed,
@@ -10861,7 +10902,8 @@ Please add \`${key}Action\` when creating your handler.`);
10861
10902
  {
10862
10903
  nodeRef,
10863
10904
  classNames: transitionName,
10864
- unmountOnExit: true,
10905
+ mountOnEnter: true,
10906
+ unmountOnExit: destroyOnClose,
10865
10907
  timeout: duration,
10866
10908
  in: innerVisible,
10867
10909
  onEntered: onHandleOpened,
@@ -17216,6 +17258,7 @@ Please add \`${key}Action\` when creating your handler.`);
17216
17258
  value,
17217
17259
  defaultValue,
17218
17260
  onChange,
17261
+ shape,
17219
17262
  labelPosition,
17220
17263
  direction,
17221
17264
  options: options2,
@@ -17251,6 +17294,7 @@ Please add \`${key}Action\` when creating your handler.`);
17251
17294
  value: {
17252
17295
  labelPosition: labelPosition || "right",
17253
17296
  disabled,
17297
+ shape,
17254
17298
  value: val2State,
17255
17299
  check: (value2) => {
17256
17300
  setVal2State(value2);
@@ -17378,11 +17422,11 @@ Please add \`${key}Action\` when creating your handler.`);
17378
17422
  className: classNames(color())
17379
17423
  }) : /* @__PURE__ */ React.createElement(o$7, { className: classNames(color()) });
17380
17424
  };
17425
+ const renderByShape = (shape2) => {
17426
+ return shape2 === "button" ? renderButton() : /* @__PURE__ */ React.createElement(React.Fragment, null, renderIcon(), renderLabel());
17427
+ };
17381
17428
  const renderRadioItem = () => {
17382
- if (shape === "button") {
17383
- return renderButton();
17384
- }
17385
- return /* @__PURE__ */ React.createElement(React.Fragment, null, renderIcon(), renderLabel());
17429
+ return renderByShape(context && context.shape ? context.shape : shape);
17386
17430
  };
17387
17431
  const handleClick2 = (e2) => {
17388
17432
  if (disabled || checkedStatement)
@@ -17724,7 +17768,8 @@ Please add \`${key}Action\` when creating your handler.`);
17724
17768
  uncheckedIcon: null,
17725
17769
  disabled: false,
17726
17770
  readOnly: false,
17727
- allowHalf: false
17771
+ allowHalf: false,
17772
+ touchable: false
17728
17773
  };
17729
17774
  const Rate = (props) => {
17730
17775
  const {
@@ -17739,13 +17784,17 @@ Please add \`${key}Action\` when creating your handler.`);
17739
17784
  disabled,
17740
17785
  readOnly,
17741
17786
  allowHalf,
17742
- onChange
17787
+ touchable,
17788
+ onChange,
17789
+ onTouchEnd
17743
17790
  } = {
17744
17791
  ...defaultProps$N,
17745
17792
  ...props
17746
17793
  };
17747
17794
  const classPrefix2 = "nut-rate";
17748
17795
  const [countArray, setCountArray] = React.useState([1, 2, 3, 4, 5]);
17796
+ const [refs, setRefs] = useRefs();
17797
+ const rateRects = React.useRef([]);
17749
17798
  const [score, setScore] = usePropsValue({
17750
17799
  value,
17751
17800
  defaultValue: Math.max(defaultValue || 0, min),
@@ -17782,6 +17831,81 @@ Please add \`${key}Action\` when creating your handler.`);
17782
17831
  const value2 = Math.max(min, n - 0.5);
17783
17832
  setScore(value2);
17784
17833
  };
17834
+ const getScoreByPosition = (x) => {
17835
+ var _a2;
17836
+ if ((_a2 = rateRects.current) == null ? void 0 : _a2.length) {
17837
+ for (let index = rateRects.current.length - 1; index >= 0; index--) {
17838
+ const item = rateRects.current[index];
17839
+ if (item && x > item.left) {
17840
+ return allowHalf ? index + (x > item.left + item.width / 2 ? 1 : 0.5) : index + 1;
17841
+ }
17842
+ }
17843
+ return 0;
17844
+ }
17845
+ };
17846
+ const updateRects = () => {
17847
+ for (let index = 0; index < refs.length; index++) {
17848
+ const item = refs[index];
17849
+ if (item) {
17850
+ rateRects.current[index] = getRect(item);
17851
+ }
17852
+ }
17853
+ };
17854
+ const handleTouchStart = (e2) => {
17855
+ if (!touchable || readOnly || disabled) {
17856
+ return;
17857
+ }
17858
+ if (e2.cancelable) {
17859
+ e2.preventDefault();
17860
+ }
17861
+ e2.stopPropagation();
17862
+ updateRects();
17863
+ };
17864
+ const handleTouchMove = (e2) => {
17865
+ if (!touchable || readOnly || disabled) {
17866
+ return;
17867
+ }
17868
+ if (e2.cancelable) {
17869
+ e2.preventDefault();
17870
+ }
17871
+ e2.stopPropagation();
17872
+ const val = getScoreByPosition(e2.touches[0].clientX);
17873
+ if (val !== void 0) {
17874
+ setScore(Math.max(min, val));
17875
+ }
17876
+ };
17877
+ const handleTouchEnd = (e2) => {
17878
+ if (!touchable || readOnly || disabled) {
17879
+ return;
17880
+ }
17881
+ if (e2.cancelable) {
17882
+ e2.preventDefault();
17883
+ }
17884
+ e2.stopPropagation();
17885
+ const val = getScoreByPosition(e2.changedTouches[0].clientX);
17886
+ if (val !== void 0) {
17887
+ setScore(Math.max(min, val));
17888
+ onTouchEnd && onTouchEnd(e2, Math.max(min, val));
17889
+ }
17890
+ };
17891
+ const rateRef = React.useRef(null);
17892
+ React.useEffect(() => {
17893
+ const element = rateRef.current;
17894
+ if (element) {
17895
+ element.addEventListener("touchstart", handleTouchStart, {
17896
+ passive: false
17897
+ });
17898
+ element.addEventListener("touchmove", handleTouchMove, { passive: false });
17899
+ element.addEventListener("touchend", handleTouchEnd, { passive: false });
17900
+ }
17901
+ return () => {
17902
+ if (element) {
17903
+ element.removeEventListener("touchstart", handleTouchStart);
17904
+ element.removeEventListener("touchmove", handleTouchMove);
17905
+ element.removeEventListener("touchend", handleTouchEnd);
17906
+ }
17907
+ };
17908
+ }, []);
17785
17909
  return /* @__PURE__ */ React.createElement(
17786
17910
  "div",
17787
17911
  {
@@ -17793,14 +17917,16 @@ Please add \`${key}Action\` when creating your handler.`);
17793
17917
  },
17794
17918
  className
17795
17919
  ),
17920
+ ref: rateRef,
17796
17921
  style
17797
17922
  },
17798
- countArray.map((n) => {
17923
+ countArray.map((n, index) => {
17799
17924
  return /* @__PURE__ */ React.createElement(
17800
17925
  "div",
17801
17926
  {
17802
17927
  className: `${classPrefix2}-item`,
17803
17928
  key: n,
17929
+ ref: setRefs(index),
17804
17930
  onClick: (event) => onClick(event, n)
17805
17931
  },
17806
17932
  /* @__PURE__ */ React.createElement(
@@ -18283,7 +18409,7 @@ Please add \`${key}Action\` when creating your handler.`);
18283
18409
  const textareaRef = React.useRef(null);
18284
18410
  const compositionRef = React.useRef(false);
18285
18411
  const format2 = (value2) => {
18286
- if (maxLength !== void 0 && value2.length > maxLength) {
18412
+ if (maxLength !== -1 && value2.length > maxLength) {
18287
18413
  return value2.substring(0, maxLength);
18288
18414
  }
18289
18415
  return value2;
@@ -19722,6 +19848,7 @@ Please add \`${key}Action\` when creating your handler.`);
19722
19848
  if (distance.current < refreshMaxH.current) {
19723
19849
  distance.current = 0;
19724
19850
  getRefreshTop().style.height = `${distance.current}px`;
19851
+ isTouching.current = false;
19725
19852
  } else {
19726
19853
  await (onRefresh == null ? void 0 : onRefresh());
19727
19854
  refreshDone();
@@ -23520,7 +23647,7 @@ Please add \`${key}Action\` when creating your handler.`);
23520
23647
  }
23521
23648
  return `${classPrefix2}-icon`;
23522
23649
  };
23523
- return /* @__PURE__ */ React.createElement("div", { className: classes, ...restProps, onClick: handleClickStep }, /* @__PURE__ */ React.createElement("div", { className: "nut-step-head" }, /* @__PURE__ */ React.createElement("div", { className: "nut-step-line" }), /* @__PURE__ */ React.createElement("div", { className: renderIconClass() }, icon || !dot && /* @__PURE__ */ React.createElement("span", { className: "nut-step-inner" }, value))), /* @__PURE__ */ React.createElement("div", { className: "nut-step-main" }, /* @__PURE__ */ React.createElement("span", { className: "nut-step-title" }, title), description && /* @__PURE__ */ React.createElement("span", { className: "nut-step-description" }, description)));
23650
+ return /* @__PURE__ */ React.createElement("div", { className: classes, ...restProps, onClick: handleClickStep }, /* @__PURE__ */ React.createElement("div", { className: "nut-step-head" }, /* @__PURE__ */ React.createElement("div", { className: "nut-step-line" }), /* @__PURE__ */ React.createElement("div", { className: renderIconClass() }, icon || !dot && /* @__PURE__ */ React.createElement("span", { className: "nut-step-inner" }, value))), (title || description) && /* @__PURE__ */ React.createElement("div", { className: "nut-step-main" }, /* @__PURE__ */ React.createElement("span", { className: "nut-step-title" }, title), description && /* @__PURE__ */ React.createElement("span", { className: "nut-step-description" }, description)));
23524
23651
  };
23525
23652
  Step.defaultProps = defaultProps$c;
23526
23653
  Step.displayName = "NutStep";
@@ -23553,14 +23680,7 @@ Please add \`${key}Action\` when creating your handler.`);
23553
23680
  },
23554
23681
  className
23555
23682
  );
23556
- return /* @__PURE__ */ React.createElement(DataContext.Provider, { value: parentSteps }, React.createElement(
23557
- "div",
23558
- {
23559
- className: classes,
23560
- ...restProps
23561
- },
23562
- children
23563
- ));
23683
+ return /* @__PURE__ */ React.createElement(DataContext.Provider, { value: parentSteps }, /* @__PURE__ */ React.createElement("div", { className: classes, ...restProps }, children));
23564
23684
  };
23565
23685
  Steps.defaultProps = defaultProps$b;
23566
23686
  Steps.displayName = "NutSteps";
@@ -49,3 +49,15 @@
49
49
  }
50
50
  }
51
51
  }
52
+
53
+ [dir='rtl'] .nut-address,
54
+ .nut-rtl .nut-address {
55
+ &-exist {
56
+ &-item {
57
+ &-info {
58
+ margin-left: 0;
59
+ margin-right: 9px;
60
+ }
61
+ }
62
+ }
63
+ }