@nutui/nutui-react-taro 2.3.7 → 2.3.8

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 (94) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/dist/esm/Address/style/style.css +1 -1
  3. package/dist/esm/Address.js +3 -3
  4. package/dist/esm/AvatarCropper.js +1 -1
  5. package/dist/esm/Cascader/style/style.css +1 -1
  6. package/dist/esm/Cascader.js +2 -2
  7. package/dist/esm/Collapse.js +2 -2
  8. package/dist/esm/CollapseItem.js +1 -1
  9. package/dist/esm/DatePicker.js +3 -2
  10. package/dist/esm/Ellipsis.js +2 -1
  11. package/dist/esm/NavBar/style/style.css +1 -1
  12. package/dist/esm/NavBar.js +4 -1
  13. package/dist/esm/Picker.js +2 -1
  14. package/dist/esm/Popover.js +1 -1
  15. package/dist/esm/Radio.js +1 -1
  16. package/dist/esm/RadioGroup.js +1 -1
  17. package/dist/esm/Rate/style/style.css +1 -1
  18. package/dist/esm/Rate.js +5 -1
  19. package/dist/esm/Step/style/style.css +1 -1
  20. package/dist/esm/Step.js +2 -1
  21. package/dist/esm/Steps/style/style.css +1 -1
  22. package/dist/esm/Steps.js +1 -1
  23. package/dist/esm/Tabs/style/style.css +1 -1
  24. package/dist/esm/Tabs.js +1 -1
  25. package/dist/esm/Tour.js +2 -2
  26. package/dist/esm/Video.js +1 -2
  27. package/dist/esm/{address.taro-TWHlPzXv.js → address.taro-LCSSqsR-.js} +1 -1
  28. package/dist/esm/{avatarcropper.taro-_IENn5QL.js → avatarcropper.taro-GIZxzMJ_.js} +2 -2
  29. package/dist/esm/{cascader.taro-QW13vwKb.js → cascader.taro-x_X9F_pH.js} +1 -1
  30. package/dist/esm/{collapse.taro-l21-Cvji.js → collapse.taro-sZibDygv.js} +1 -1
  31. package/dist/esm/{collapseitem.taro-9w-h_UP6.js → collapseitem.taro-AaQ_msgd.js} +2 -2
  32. package/dist/esm/{datepicker.taro-OrqtwJFM.js → datepicker.taro-S111IvJO.js} +1 -1
  33. package/dist/esm/{ellipsis.taro-ov_C4kbs.js → ellipsis.taro-VApVqS_j.js} +39 -45
  34. package/dist/esm/navbar.taro-AuKPDCaW.js +105 -0
  35. package/dist/esm/nutui-react.es.js +18 -17
  36. package/dist/esm/{picker.taro-_bT5c-BS.js → picker.taro-RAYmFSC0.js} +1 -11
  37. package/dist/esm/{popover.taro-ScQymuJC.js → popover.taro-MUrnn7xY.js} +1 -1
  38. package/dist/esm/{radio.taro-mZvB2wwi.js → radio.taro-EKJXMjnX.js} +7 -6
  39. package/dist/esm/rate.taro-_5Mjd_EO.js +146 -0
  40. package/dist/esm/{step.taro-kCAQ4Q3-.js → step.taro-_DEZqFGb.js} +6 -5
  41. package/dist/esm/{steps.taro-n6BT6nWE.js → steps.taro-PH0qWPla.js} +5 -4
  42. package/dist/esm/{tabs.taro-aR3XROu9.js → tabs.taro-w8ra49Qb.js} +3 -3
  43. package/dist/esm/{tour.taro-GabSljal.js → tour.taro-HLsDVf9g.js} +3 -3
  44. package/dist/esm/types/src/packages/navbar/navbar.taro.d.ts +2 -1
  45. package/dist/esm/types/src/packages/radio/index.d.ts +2 -1
  46. package/dist/esm/types/src/packages/radio/index.taro.d.ts +2 -1
  47. package/dist/esm/types/src/packages/radio/radio.d.ts +1 -2
  48. package/dist/esm/types/src/packages/radio/radio.taro.d.ts +1 -2
  49. package/dist/esm/types/src/packages/radio/types.d.ts +2 -0
  50. package/dist/esm/types/src/packages/radiogroup/context.d.ts +2 -0
  51. package/dist/esm/types/src/packages/radiogroup/index.d.ts +1 -0
  52. package/dist/esm/types/src/packages/radiogroup/index.taro.d.ts +1 -0
  53. package/dist/esm/types/src/packages/radiogroup/radiogroup.d.ts +4 -6
  54. package/dist/esm/types/src/packages/radiogroup/radiogroup.taro.d.ts +4 -6
  55. package/dist/esm/types/src/packages/radiogroup/types.d.ts +4 -0
  56. package/dist/esm/types/src/packages/rate/rate.d.ts +2 -0
  57. package/dist/esm/types/src/packages/rate/rate.taro.d.ts +2 -0
  58. package/dist/esm/types/src/packages/video/video.taro.d.ts +4 -5
  59. package/dist/esm/use-refs-IdrY0ww3.js +15 -0
  60. package/dist/esm/{video.taro-MDBF77xf.js → video.taro-csvHwS2v.js} +5 -7
  61. package/dist/locales/base.js +1 -1
  62. package/dist/locales/en-US.js +1 -1
  63. package/dist/locales/id-ID.js +1 -1
  64. package/dist/locales/tr-TR.js +1 -1
  65. package/dist/locales/zh-CN.js +1 -1
  66. package/dist/locales/zh-TW.js +1 -1
  67. package/dist/locales/zh-UG.js +1 -1
  68. package/dist/nutui.react.es.js +174 -71
  69. package/dist/nutui.react.umd.js +167 -64
  70. package/dist/packages/navbar/navbar.scss +7 -0
  71. package/dist/packages/rate/rate.scss +6 -0
  72. package/dist/packages/step/step.scss +5 -4
  73. package/dist/packages/tabs/tabs.scss +1 -0
  74. package/dist/style.css +1 -1
  75. package/dist/style.mjs +1 -1
  76. package/dist/types/packages/navbar/navbar.taro.d.ts +2 -1
  77. package/dist/types/packages/overlay/overlay.taro.d.ts +5 -1
  78. package/dist/types/packages/radio/index.d.ts +2 -1
  79. package/dist/types/packages/radio/index.taro.d.ts +2 -1
  80. package/dist/types/packages/radio/radio.d.ts +1 -2
  81. package/dist/types/packages/radio/radio.taro.d.ts +1 -2
  82. package/dist/types/packages/radio/types.d.ts +2 -0
  83. package/dist/types/packages/radiogroup/context.d.ts +2 -0
  84. package/dist/types/packages/radiogroup/index.d.ts +1 -0
  85. package/dist/types/packages/radiogroup/index.taro.d.ts +1 -0
  86. package/dist/types/packages/radiogroup/radiogroup.d.ts +4 -6
  87. package/dist/types/packages/radiogroup/radiogroup.taro.d.ts +8 -6
  88. package/dist/types/packages/radiogroup/types.d.ts +4 -0
  89. package/dist/types/packages/rate/rate.d.ts +2 -0
  90. package/dist/types/packages/rate/rate.taro.d.ts +2 -0
  91. package/dist/types/packages/video/video.taro.d.ts +4 -5
  92. package/package.json +1 -1
  93. package/dist/esm/navbar.taro-v0VHQWR4.js +0 -63
  94. package/dist/esm/rate.taro-ZkOVGSDs.js +0 -77
@@ -1,6 +1,7 @@
1
1
  import React__default, { useRef, useState, useEffect } from "react";
2
- import { useReady, nextTick, createSelectorQuery } from "@tarojs/taro";
2
+ import { nextTick, createSelectorQuery } from "@tarojs/taro";
3
3
  import classNames from "classnames";
4
+ import { View } from "@tarojs/components";
4
5
  import { g as getRectByTaro } from "./get-rect-by-taro-piSHvCGp.js";
5
6
  import { C as ComponentDefaults } from "./typings-buMpDfSR.js";
6
7
  const defaultProps = {
@@ -31,29 +32,25 @@ const Ellipsis = (props) => {
31
32
  const [contentCopy, setContentCopy] = useState(content);
32
33
  const lineH = useRef(0);
33
34
  const originHeight = useRef(0);
34
- const refRandomId = Math.random().toString(36).slice(-8);
35
+ const refRandomId = useRef(Math.random().toString(36).slice(-8));
35
36
  const widthRef = useRef("auto");
36
- let widthBase = [14, 10, 7, 8.4, 10];
37
- let symbolTextWidth = widthBase[0] * 0.7921;
37
+ const widthBase = useRef([14, 10, 7, 8.4, 10]);
38
+ const symbolTextWidth = useRef(widthBase.current[0] * 0.7921);
38
39
  const chineseReg = /^[\u4e00-\u9fa5]+$/;
39
40
  const digitReg = /^[0-9]+$/;
40
41
  const letterUpperReg = /^[A-Z]+$/;
41
42
  const letterLowerReg = /^[a-z]+$/;
42
43
  const classes = classNames(classPrefix, width ? `${classPrefix}-width` : "", className);
43
- const init = () => {
44
- setExceeded(false);
45
- setExpanded(false);
44
+ useEffect(() => {
46
45
  setContentCopy(content);
47
46
  nextTick(() => {
48
47
  getSymbolInfo();
49
48
  getReference();
50
49
  });
51
- };
52
- useReady(() => init());
53
- useEffect(() => init(), [content, lineH.current, maxHeight.current, originHeight.current]);
50
+ }, [content]);
54
51
  const getSymbolInfo = async () => {
55
52
  const refe = await getRectByTaro(symbolContain == null ? void 0 : symbolContain.current);
56
- symbolTextWidth = refe.width ? Math.ceil(refe.width) : Math.ceil(widthBase[0] * 0.7921);
53
+ symbolTextWidth.current = refe.width ? Math.ceil(refe.width) : Math.ceil(widthBase.current[0] * 0.7921);
57
54
  };
58
55
  const symbolText = () => {
59
56
  if (direction === "end" || direction === "middle") {
@@ -62,9 +59,8 @@ const Ellipsis = (props) => {
62
59
  return `${symbol}${expandText}${symbol}`;
63
60
  };
64
61
  const getReference = async () => {
65
- const element = root.current;
66
62
  const query = createSelectorQuery();
67
- query.select(`#${element.id}`) && query.select(`#${element.id}`).fields({
63
+ query.select(`#root${refRandomId.current}`) && query.select(`#root${refRandomId.current}`).fields({
68
64
  computedStyle: [
69
65
  "width",
70
66
  "height",
@@ -81,7 +77,7 @@ const Ellipsis = (props) => {
81
77
  originHeight.current = pxToNumber(res.height);
82
78
  widthRef.current = res.width;
83
79
  const bsize = pxToNumber(res.fontSize);
84
- widthBase = [
80
+ widthBase.current = [
85
81
  bsize,
86
82
  bsize * 0.72,
87
83
  bsize * 0.53,
@@ -135,7 +131,7 @@ const Ellipsis = (props) => {
135
131
  setContentCopy(newContent);
136
132
  };
137
133
  const tailorContent = (left, right, type = "") => {
138
- const threeDotWidth = symbolTextWidth;
134
+ const threeDotWidth = symbolTextWidth.current;
139
135
  const direc = direction === "middle" && type ? type : direction;
140
136
  setExceeded(true);
141
137
  let widthPart = -1;
@@ -155,15 +151,15 @@ const Ellipsis = (props) => {
155
151
  while (widthPart < contentPartWidth) {
156
152
  const zi = content[marking];
157
153
  if (chineseReg.test(zi)) {
158
- widthPart = Number(widthPart + widthBase[0]);
154
+ widthPart = Number(widthPart + widthBase.current[0]);
159
155
  } else if (letterUpperReg.test(zi)) {
160
- widthPart = Number(widthPart + widthBase[1]);
156
+ widthPart = Number(widthPart + widthBase.current[1]);
161
157
  } else if (letterLowerReg.test(zi)) {
162
- widthPart = Number(widthPart + widthBase[2]);
158
+ widthPart = Number(widthPart + widthBase.current[2]);
163
159
  } else if (digitReg.test(zi)) {
164
- widthPart = Number(widthPart + widthBase[3]);
160
+ widthPart = Number(widthPart + widthBase.current[3]);
165
161
  } else {
166
- widthPart = Number(widthPart + widthBase[4]);
162
+ widthPart = Number(widthPart + widthBase.current[4]);
167
163
  }
168
164
  cutoff = marking;
169
165
  direc === "end" ? marking++ : marking--;
@@ -196,35 +192,33 @@ const Ellipsis = (props) => {
196
192
  null,
197
193
  React__default.createElement(
198
194
  "div",
199
- { className: classes, onClick: handleClick, ref: root, id: `root${refRandomId}`, ...rest },
195
+ { className: classes, onClick: handleClick, ref: root, id: `root${refRandomId.current}`, ...rest },
200
196
  React__default.createElement(
201
- "div",
197
+ View,
202
198
  null,
203
- !exceeded ? React__default.createElement("div", { className: "nut-ellipsis-wordbreak", style: {
204
- width: `${!Number.isNaN(Number(width)) ? `${width}px` : "auto"}`
199
+ !exceeded ? React__default.createElement(View, { className: "nut-ellipsis-wordbreak", style: {
200
+ width: `${!Number.isNaN(Number(width)) ? `${width}px` : "auto"}`,
201
+ height: "20px",
202
+ overflow: "hidden"
205
203
  } }, content) : null,
206
204
  exceeded && !expanded ? React__default.createElement(
207
- React__default.Fragment,
208
- null,
209
- React__default.createElement(
210
- "div",
211
- { className: "nut-ellipsis-wordbreak", style: {
212
- width: `${!Number.isNaN(Number(width)) ? `${width}px` : "auto"}`
213
- } },
214
- (_a = ellipsis.current) == null ? void 0 : _a.leading,
215
- ((_b = ellipsis.current) == null ? void 0 : _b.leading) && symbol,
216
- expandText ? React__default.createElement("span", { className: "nut-ellipsis-text", onClick: (e) => {
217
- e.stopPropagation();
218
- clickHandle(1);
219
- } }, expandText) : null,
220
- ((_c = ellipsis.current) == null ? void 0 : _c.tailing) && symbol,
221
- (_d = ellipsis.current) == null ? void 0 : _d.tailing
222
- )
205
+ View,
206
+ { className: "nut-ellipsis-wordbreak", style: {
207
+ width: `${!Number.isNaN(Number(width)) ? `${width}px` : "auto"}`
208
+ } },
209
+ (_a = ellipsis.current) == null ? void 0 : _a.leading,
210
+ ((_b = ellipsis.current) == null ? void 0 : _b.leading) && symbol,
211
+ expandText ? React__default.createElement("span", { className: "nut-ellipsis-text", onClick: (e) => {
212
+ e.stopPropagation();
213
+ clickHandle(1);
214
+ } }, expandText) : null,
215
+ ((_c = ellipsis.current) == null ? void 0 : _c.tailing) && symbol,
216
+ (_d = ellipsis.current) == null ? void 0 : _d.tailing
223
217
  ) : null,
224
218
  exceeded && expanded ? React__default.createElement(
225
219
  React__default.Fragment,
226
220
  null,
227
- React__default.createElement("div", { style: {
221
+ React__default.createElement(View, { style: {
228
222
  width: `${!Number.isNaN(Number(width)) ? `${width}px` : "auto"}`
229
223
  } }, content),
230
224
  expandText ? React__default.createElement("span", { className: "nut-ellipsis-text", onClick: (e) => {
@@ -235,11 +229,11 @@ const Ellipsis = (props) => {
235
229
  )
236
230
  ),
237
231
  React__default.createElement(
238
- "div",
239
- { className: "nut-ellipsis-copy", ref: rootContain, id: `rootContain${refRandomId}`, style: { width: `${widthRef}` } },
240
- React__default.createElement("div", null, contentCopy)
232
+ View,
233
+ { className: "nut-ellipsis-copy", ref: rootContain, id: `rootContain${refRandomId.current}`, style: { width: `${widthRef}` } },
234
+ React__default.createElement(View, null, contentCopy)
241
235
  ),
242
- React__default.createElement("div", { className: "nut-ellipsis-copy", ref: symbolContain, id: `symbolContain${refRandomId}`, style: { display: "inline" } }, symbolText())
236
+ React__default.createElement(View, { className: "nut-ellipsis-copy", ref: symbolContain, id: `symbolContain${refRandomId.current}`, style: { display: "inline" } }, symbolText())
243
237
  );
244
238
  };
245
239
  Ellipsis.defaultProps = defaultProps;
@@ -0,0 +1,105 @@
1
+ import React__default, { useRef, useState, useEffect } from "react";
2
+ import classNames from "classnames";
3
+ import { View } from "@tarojs/components";
4
+ import { C as ComponentDefaults } from "./typings-buMpDfSR.js";
5
+ import { g as getRectByTaro } from "./get-rect-by-taro-piSHvCGp.js";
6
+ const defaultProps = {
7
+ ...ComponentDefaults,
8
+ left: "",
9
+ right: "",
10
+ titleAlign: "center",
11
+ back: "",
12
+ fixed: false,
13
+ safeAreaInsetTop: false,
14
+ placeholder: false,
15
+ zIndex: 10
16
+ };
17
+ const NavBar = (props) => {
18
+ const { right, left, titleAlign, className, style, back, fixed, safeAreaInsetTop, placeholder, zIndex, onBackClick } = {
19
+ ...defaultProps,
20
+ ...props
21
+ };
22
+ const classPrefix = "nut-navbar";
23
+ const children = Array.isArray(props.children) ? props.children : [props.children];
24
+ const styles = () => {
25
+ return {
26
+ ...style,
27
+ zIndex
28
+ };
29
+ };
30
+ const leftRef = useRef(null);
31
+ const rightRef = useRef(null);
32
+ const wrapperRef = useRef(null);
33
+ const [contentWidth, setContentWidth] = useState("50%");
34
+ const getNodeWidth = async (node) => {
35
+ if (node) {
36
+ const refe = await getRectByTaro(node);
37
+ return refe.width;
38
+ }
39
+ return 0;
40
+ };
41
+ useEffect(() => {
42
+ if (titleAlign === "left") {
43
+ return;
44
+ }
45
+ if (!(back || left || right)) {
46
+ setContentWidth("100%");
47
+ }
48
+ const init = async () => {
49
+ const leftRectWidth = await getNodeWidth(leftRef == null ? void 0 : leftRef.current);
50
+ const rightRectWidth = await getNodeWidth(rightRef == null ? void 0 : rightRef.current);
51
+ const wrapperWidth = await getNodeWidth(wrapperRef == null ? void 0 : wrapperRef.current);
52
+ let centerWidth = wrapperWidth / 2;
53
+ if (leftRectWidth && rightRectWidth) {
54
+ centerWidth = wrapperWidth - (leftRectWidth > rightRectWidth ? leftRectWidth * 2 : rightRectWidth * 2);
55
+ } else {
56
+ centerWidth = wrapperWidth - leftRectWidth * 2 - rightRectWidth * 2;
57
+ }
58
+ setContentWidth(centerWidth.toFixed(2));
59
+ };
60
+ init();
61
+ }, [left, right, back]);
62
+ const renderLeft = () => {
63
+ return back || left ? React__default.createElement(
64
+ View,
65
+ { className: `${classPrefix}-left`, ref: leftRef },
66
+ back && React__default.createElement(View, { className: `${classPrefix}-left-back`, onClick: (e) => onBackClick(e) }, back),
67
+ left
68
+ ) : null;
69
+ };
70
+ const renderContent = () => {
71
+ let titleStyle = {};
72
+ if (titleAlign === "center") {
73
+ const contentRealWidth = `${contentWidth}${/%$/i.test(contentWidth) ? "" : "px"}`;
74
+ titleStyle = {
75
+ minWidth: contentRealWidth,
76
+ width: contentRealWidth
77
+ };
78
+ }
79
+ return React__default.createElement(View, { className: `${classPrefix}-title`, style: titleStyle }, children);
80
+ };
81
+ const renderRight = () => {
82
+ return React__default.createElement(View, { className: `${classPrefix}-right`, ref: rightRef }, right);
83
+ };
84
+ const renderWrapper = () => {
85
+ return React__default.createElement(
86
+ View,
87
+ { className: cls, style: styles(), ref: wrapperRef },
88
+ renderLeft(),
89
+ renderContent(),
90
+ renderRight()
91
+ );
92
+ };
93
+ const classes = classNames({
94
+ [`${classPrefix}-fixed`]: fixed,
95
+ [`${classPrefix}-safe-area-inset-top`]: safeAreaInsetTop,
96
+ [`${classPrefix}-title-align-${titleAlign}`]: true
97
+ });
98
+ const cls = classNames(classPrefix, classes, className);
99
+ return React__default.createElement(React__default.Fragment, null, fixed && placeholder ? React__default.createElement(View, { className: `${classPrefix}-placeholder` }, renderWrapper()) : renderWrapper());
100
+ };
101
+ NavBar.defaultProps = defaultProps;
102
+ NavBar.displayName = "NutNavBar";
103
+ export {
104
+ NavBar as N
105
+ };
@@ -16,21 +16,21 @@ import { S as S3 } from "./safearea.taro-afu_mY7g.js";
16
16
  import { B as B2 } from "./backtop.taro-Y3vOJiXq.js";
17
17
  import { E } from "./elevator.taro-2nbUM3vH.js";
18
18
  import { F } from "./fixednav.taro-7OfzwFBE.js";
19
- import { N } from "./navbar.taro-v0VHQWR4.js";
19
+ import { N } from "./navbar.taro-AuKPDCaW.js";
20
20
  import { S as S4 } from "./sidenavbar.taro-J5SEKQIh.js";
21
21
  import { S as S5 } from "./sidenavbaritem.taro-AxJNRAdi.js";
22
22
  import { S as S6 } from "./subsidenavbar.taro-Zy52MDDG.js";
23
23
  import { T } from "./tabbar.taro-QE0rjSKE.js";
24
24
  import { T as T2 } from "./tabbaritem.taro-t9C07OYX.js";
25
25
  import { T as T3 } from "./tabpane.taro-5k7wWimS.js";
26
- import { T as T4 } from "./tabs.taro-aR3XROu9.js";
27
- import { A } from "./address.taro-TWHlPzXv.js";
26
+ import { T as T4 } from "./tabs.taro-w8ra49Qb.js";
27
+ import { A } from "./address.taro-LCSSqsR-.js";
28
28
  import { C as C5 } from "./calendar.taro-Kf91Qo5t.js";
29
29
  import { C as C6 } from "./calendaritem.taro-G5BaVw8e.js";
30
30
  import { C as C7 } from "./calendarcard.taro-tY-cyh-F.js";
31
- import { C as C8 } from "./cascader.taro-QW13vwKb.js";
31
+ import { C as C8 } from "./cascader.taro-x_X9F_pH.js";
32
32
  import { C as C9, a } from "./checkbox.taro-xMxWdpyI.js";
33
- import { D as D2 } from "./datepicker.taro-OrqtwJFM.js";
33
+ import { D as D2 } from "./datepicker.taro-S111IvJO.js";
34
34
  import { default as default2 } from "./Form.js";
35
35
  import { F as F2 } from "./formitem.taro-atY4A0pS.js";
36
36
  import { I as I2 } from "./input.taro-8gs046AH.js";
@@ -38,10 +38,10 @@ import { I as I3 } from "./inputnumber.taro-7QptygT3.js";
38
38
  import { M } from "./menu.taro-ODwHYGFM.js";
39
39
  import { M as M2 } from "./menuitem.taro-9nyTDLpt.js";
40
40
  import { N as N2 } from "./numberkeyboard.taro-CyW0s9bI.js";
41
- import { P } from "./picker.taro-_bT5c-BS.js";
42
- import { R as R2, a as a2 } from "./radio.taro-mZvB2wwi.js";
41
+ import { P } from "./picker.taro-RAYmFSC0.js";
42
+ import { R as R2, a as a2 } from "./radio.taro-EKJXMjnX.js";
43
43
  import { R as R3 } from "./range.taro-mDYY3SXA.js";
44
- import { R as R4 } from "./rate.taro-ZkOVGSDs.js";
44
+ import { R as R4 } from "./rate.taro-_5Mjd_EO.js";
45
45
  import { S as S7 } from "./searchbar.taro-Hmwspp92.js";
46
46
  import { S as S8 } from "./shortpassword.taro-uFeVULsY.js";
47
47
  import { S as S9 } from "./signature.taro-y3qxnKMv.js";
@@ -57,7 +57,7 @@ import { I as I4 } from "./infiniteloading.taro-sl41Ddeh.js";
57
57
  import { L as L2 } from "./loading.taro-aHN6xLIT.js";
58
58
  import { N as N3 } from "./noticebar.taro-bHnEzTvL.js";
59
59
  import { N as N4 } from "./notify.taro-mA9KS8qh.js";
60
- import { P as P2 } from "./popover.taro-ScQymuJC.js";
60
+ import { P as P2 } from "./popover.taro-MUrnn7xY.js";
61
61
  import { P as P3 } from "./popup.taro-2FdJu1kg.js";
62
62
  import { P as P4 } from "./pulltorefresh.taro-VbzsD_HC.js";
63
63
  import { S as S11 } from "./skeleton.taro-Pg7WtP0e.js";
@@ -69,23 +69,23 @@ import { A as A4 } from "./audio.taro-UpVxFvGk.js";
69
69
  import { A as A5 } from "./avatar.taro-7ltbzIdY.js";
70
70
  import { A as A6 } from "./avatargroup.taro-h6dpv6UX.js";
71
71
  import { C as C10 } from "./circleprogress.taro-myZgamBw.js";
72
- import { C as C11 } from "./collapse.taro-l21-Cvji.js";
73
- import { C as C12 } from "./collapseitem.taro-9w-h_UP6.js";
72
+ import { C as C11 } from "./collapse.taro-sZibDygv.js";
73
+ import { C as C12 } from "./collapseitem.taro-AaQ_msgd.js";
74
74
  import { C as C13 } from "./countdown.taro-rJngrZUZ.js";
75
- import { E as E3 } from "./ellipsis.taro-ov_C4kbs.js";
75
+ import { E as E3 } from "./ellipsis.taro-VApVqS_j.js";
76
76
  import { I as I5 } from "./imagepreview.taro-qDST6Lh4.js";
77
77
  import { I as I6 } from "./indicator.taro-ZH6MICsS.js";
78
78
  import { P as P5 } from "./pagination.taro-RYmB2As4.js";
79
79
  import { P as P6 } from "./price.taro-Z1zR8YWV.js";
80
80
  import { P as P7 } from "./progress.taro-pStvlrbA.js";
81
- import { S as S13 } from "./step.taro-kCAQ4Q3-.js";
82
- import { S as S14 } from "./steps.taro-n6BT6nWE.js";
81
+ import { S as S13 } from "./step.taro-_DEZqFGb.js";
82
+ import { S as S14 } from "./steps.taro-PH0qWPla.js";
83
83
  import { default as default4 } from "./Swiper.js";
84
84
  import { S as S15 } from "./swiperitem.taro-BC1CE0T-.js";
85
85
  import { T as T7 } from "./table.taro-d172EUh9.js";
86
86
  import { T as T8 } from "./tag.taro-5KC_wObY.js";
87
- import { T as T9 } from "./tour.taro-GabSljal.js";
88
- import { V } from "./video.taro-MDBF77xf.js";
87
+ import { T as T9 } from "./tour.taro-HLsDVf9g.js";
88
+ import { V } from "./video.taro-csvHwS2v.js";
89
89
  import { V as V2 } from "./virtuallist.taro-AeTVtFFa.js";
90
90
  import { B as B5 } from "./barrage.taro-HsivAhbE.js";
91
91
  import { C as C14 } from "./card.taro-p4PTy-IU.js";
@@ -93,7 +93,7 @@ import { T as T10 } from "./timedetail.taro-TF9Wcblh.js";
93
93
  import { T as T11 } from "./timeselect.taro-7FWR9oaJ.js";
94
94
  import { T as T12 } from "./trendarrow.taro-hsM6-XsQ.js";
95
95
  import { W } from "./watermark.taro-WDFdgWlJ.js";
96
- import { A as A7 } from "./avatarcropper.taro-_IENn5QL.js";
96
+ import { A as A7 } from "./avatarcropper.taro-GIZxzMJ_.js";
97
97
  import "react";
98
98
  import "classnames";
99
99
  import "@nutui/icons-react-taro";
@@ -113,6 +113,7 @@ import "./use-force-update-0oEVD8Nr.js";
113
113
  import "./raf-UzmDvMUW.js";
114
114
  import "./date-nxKOxj5-.js";
115
115
  import "./pad-zero-iY-0-oys.js";
116
+ import "./use-refs-IdrY0ww3.js";
116
117
  import "./index-YvHA__3D.js";
117
118
  import "./use-custom-event-XvsODK8c.js";
118
119
  import "react-dom";
@@ -6,6 +6,7 @@ import { P as Popup } from "./popup.taro-2FdJu1kg.js";
6
6
  import { u as useTouch } from "./use-touch-BUFdkOSA.js";
7
7
  import { g as getRectByTaro } from "./get-rect-by-taro-piSHvCGp.js";
8
8
  import { p as passiveSupported } from "./overlay.taro-HsGeVyPh.js";
9
+ import { u as useRefs } from "./use-refs-IdrY0ww3.js";
9
10
  import { u as useConfig } from "./configprovider.taro-_wngOo0k.js";
10
11
  import { u as usePropsValue } from "./use-props-value-vKr0R0AX.js";
11
12
  import { C as ComponentDefaults } from "./typings-buMpDfSR.js";
@@ -224,17 +225,6 @@ const InternalPickerPanel = (props, ref) => {
224
225
  };
225
226
  const PickerPanel = React__default.forwardRef(InternalPickerPanel);
226
227
  const PickerPanel$1 = PickerPanel;
227
- function useRefs() {
228
- const refs = React__default.useRef([]);
229
- const setRefs = React__default.useCallback((index) => (el) => {
230
- if (el)
231
- refs.current[index] = el;
232
- }, []);
233
- const reset = React__default.useCallback(() => {
234
- refs.current = [];
235
- }, []);
236
- return [refs.current, setRefs, reset];
237
- }
238
228
  const defaultProps = {
239
229
  ...ComponentDefaults,
240
230
  visible: false,
@@ -71,7 +71,7 @@ const Popover = (props) => {
71
71
  };
72
72
  const getRectTaro = async (targetId2) => {
73
73
  return new Promise((resolve) => {
74
- const query = Taro.createSelectorQuery();
74
+ const query = createSelectorQuery();
75
75
  query.select(`#${targetId2}`) && query.select(`#${targetId2}`).boundingClientRect();
76
76
  query.exec((res) => {
77
77
  resolve(res[0]);
@@ -13,7 +13,7 @@ const defaultProps$1 = {
13
13
  };
14
14
  const classPrefix = "nut-radiogroup";
15
15
  const RadioGroup = React__default.forwardRef((props, ref) => {
16
- const { children, className, value, defaultValue, onChange, labelPosition, direction, options, disabled, ...rest } = { ...defaultProps$1, ...props };
16
+ const { children, className, value, defaultValue, onChange, shape, labelPosition, direction, options, disabled, ...rest } = { ...defaultProps$1, ...props };
17
17
  const [val2State, setVal2State] = usePropsValue({
18
18
  defaultValue: props.defaultValue,
19
19
  value: props.value,
@@ -30,6 +30,7 @@ const RadioGroup = React__default.forwardRef((props, ref) => {
30
30
  { value: {
31
31
  labelPosition: labelPosition || "right",
32
32
  disabled,
33
+ shape,
33
34
  value: val2State,
34
35
  check: (value2) => {
35
36
  setVal2State(value2);
@@ -120,17 +121,17 @@ const Radio = (props) => {
120
121
  className: classNames(color())
121
122
  }) : React__default.createElement(CheckNormal, { className: classNames(color()) });
122
123
  };
123
- const renderRadioItem = () => {
124
- if (shape === "button") {
125
- return renderButton();
126
- }
127
- return React__default.createElement(
124
+ const renderByShape = (shape2) => {
125
+ return shape2 === "button" ? renderButton() : React__default.createElement(
128
126
  React__default.Fragment,
129
127
  null,
130
128
  renderIcon(),
131
129
  renderLabel()
132
130
  );
133
131
  };
132
+ const renderRadioItem = () => {
133
+ return renderByShape(context && context.shape ? context.shape : shape);
134
+ };
134
135
  const handleClick = (e) => {
135
136
  if (disabled || checkedStatement)
136
137
  return;
@@ -0,0 +1,146 @@
1
+ import React__default, { useState, useRef, useEffect } from "react";
2
+ import classNames from "classnames";
3
+ import { StarFill } from "@nutui/icons-react-taro";
4
+ import { useReady } from "@tarojs/taro";
5
+ import { View } from "@tarojs/components";
6
+ import { C as ComponentDefaults } from "./typings-buMpDfSR.js";
7
+ import { u as usePropsValue } from "./use-props-value-vKr0R0AX.js";
8
+ import { g as getRectByTaro } from "./get-rect-by-taro-piSHvCGp.js";
9
+ import { u as useRefs } from "./use-refs-IdrY0ww3.js";
10
+ const defaultProps = {
11
+ ...ComponentDefaults,
12
+ count: 5,
13
+ min: 0,
14
+ checkedIcon: null,
15
+ uncheckedIcon: null,
16
+ disabled: false,
17
+ readOnly: false,
18
+ allowHalf: false,
19
+ touchable: false
20
+ };
21
+ const Rate = (props) => {
22
+ const { className, style, count, value, defaultValue, min, checkedIcon, uncheckedIcon, disabled, readOnly, allowHalf, touchable, onChange, onTouchEnd } = {
23
+ ...defaultProps,
24
+ ...props
25
+ };
26
+ const classPrefix = "nut-rate";
27
+ const [countArray, setCountArray] = useState([1, 2, 3, 4, 5]);
28
+ const [refs, setRefs] = useRefs();
29
+ const rateRects = useRef([]);
30
+ const [score, setScore] = usePropsValue({
31
+ value,
32
+ defaultValue: Math.max(defaultValue || 0, min),
33
+ finalValue: 0,
34
+ onChange
35
+ });
36
+ useEffect(() => {
37
+ const tmp = [];
38
+ for (let i = 1; i <= Number(count); i++) {
39
+ tmp.push(i);
40
+ }
41
+ setCountArray(tmp);
42
+ }, [count]);
43
+ const renderIcon = (n) => {
44
+ return n <= score ? checkedIcon || React__default.createElement(StarFill, null) : uncheckedIcon || (checkedIcon ? React__default.cloneElement(checkedIcon, {
45
+ color: void 0
46
+ }) : React__default.createElement(StarFill, null));
47
+ };
48
+ const onClick = (e, index) => {
49
+ e.preventDefault();
50
+ e.stopPropagation();
51
+ if (disabled || readOnly)
52
+ return;
53
+ let value2 = 0;
54
+ if (!(index === 1 && score === index)) {
55
+ value2 = index;
56
+ }
57
+ value2 = Math.max(value2, min);
58
+ setScore(value2);
59
+ };
60
+ const onHalfClick = (event, n) => {
61
+ event.preventDefault();
62
+ event.stopPropagation();
63
+ const value2 = Math.max(min, n - 0.5);
64
+ setScore(value2);
65
+ };
66
+ const getScoreByPosition = (x) => {
67
+ var _a;
68
+ if ((_a = rateRects.current) == null ? void 0 : _a.length) {
69
+ for (let index = rateRects.current.length - 1; index >= 0; index--) {
70
+ const item = rateRects.current[index];
71
+ if (item && x > item.left) {
72
+ return allowHalf ? index + (x > item.left + item.width / 2 ? 1 : 0.5) : index + 1;
73
+ }
74
+ }
75
+ return 0;
76
+ }
77
+ };
78
+ const updateRects = () => {
79
+ for (let index = 0; index < refs.length; index++) {
80
+ const item = refs[index];
81
+ if (item) {
82
+ getRectByTaro(item).then((res) => {
83
+ rateRects.current[index] = res;
84
+ });
85
+ }
86
+ }
87
+ };
88
+ useReady(() => {
89
+ updateRects();
90
+ });
91
+ const handleTouchStart = (e) => {
92
+ if (!touchable || readOnly || disabled) {
93
+ return;
94
+ }
95
+ if (e.cancelable) {
96
+ e.preventDefault();
97
+ }
98
+ e.stopPropagation();
99
+ updateRects();
100
+ };
101
+ const handleTouchMove = (e) => {
102
+ if (!touchable || readOnly || disabled) {
103
+ return;
104
+ }
105
+ if (e.cancelable) {
106
+ e.preventDefault();
107
+ }
108
+ e.stopPropagation();
109
+ const val = getScoreByPosition(e.touches[0].clientX);
110
+ if (val !== void 0) {
111
+ setScore(Math.max(min, val));
112
+ }
113
+ };
114
+ const handleTouchEnd = (e) => {
115
+ if (!touchable || readOnly || disabled) {
116
+ return;
117
+ }
118
+ if (e.cancelable) {
119
+ e.preventDefault();
120
+ }
121
+ e.stopPropagation();
122
+ const val = getScoreByPosition(e.changedTouches[0].clientX);
123
+ if (val !== void 0) {
124
+ setScore(Math.max(min, val));
125
+ onTouchEnd && onTouchEnd(e, Math.max(min, val));
126
+ }
127
+ };
128
+ return React__default.createElement(View, { className: classNames(classPrefix, {
129
+ disabled,
130
+ readonly: readOnly
131
+ }, className), catchMove: true, style, onTouchStart: handleTouchStart, onTouchMove: handleTouchMove, onTouchEnd: handleTouchEnd, onTouchCancel: handleTouchEnd }, countArray.map((n, index) => {
132
+ return React__default.createElement(
133
+ "div",
134
+ { className: `${classPrefix}-item`, key: n, ref: setRefs(index), onClick: (event) => onClick(event, n) },
135
+ React__default.createElement("div", { className: classNames(`${classPrefix}-item-icon`, {
136
+ [`${classPrefix}-item-icon-disabled`]: disabled || n > score
137
+ }) }, renderIcon(n)),
138
+ allowHalf && score > n - 1 && React__default.createElement("div", { className: classNames(`${classPrefix}-item-half`, `${classPrefix}-item-icon`, `${classPrefix}-item-icon-half`), onClick: (event) => onHalfClick(event, n) }, renderIcon(n))
139
+ );
140
+ }));
141
+ };
142
+ Rate.defaultProps = defaultProps;
143
+ Rate.displayName = "NutRate";
144
+ export {
145
+ Rate as R
146
+ };
@@ -1,5 +1,6 @@
1
1
  import React__default, { useContext } from "react";
2
2
  import classNames from "classnames";
3
+ import { View } from "@tarojs/components";
3
4
  import { D as DataContext } from "./context-9BL0cq8w.js";
4
5
  import { C as ComponentDefaults } from "./typings-buMpDfSR.js";
5
6
  const defaultProps = {
@@ -43,13 +44,13 @@ const Step = (props) => {
43
44
  "div",
44
45
  { className: classes, ...restProps, onClick: handleClickStep },
45
46
  React__default.createElement(
46
- "div",
47
+ View,
47
48
  { className: "nut-step-head" },
48
- React__default.createElement("div", { className: "nut-step-line" }),
49
- React__default.createElement("div", { className: renderIconClass() }, icon || !dot && React__default.createElement("span", { className: "nut-step-inner" }, value))
49
+ React__default.createElement(View, { className: "nut-step-line" }),
50
+ React__default.createElement(View, { className: renderIconClass() }, icon || !dot && React__default.createElement("span", { className: "nut-step-inner" }, value))
50
51
  ),
51
- React__default.createElement(
52
- "div",
52
+ (title || description) && React__default.createElement(
53
+ View,
53
54
  { className: "nut-step-main" },
54
55
  React__default.createElement("span", { className: "nut-step-title" }, title),
55
56
  description && React__default.createElement("span", { className: "nut-step-description" }, description)
@@ -19,10 +19,11 @@ const Steps = (props) => {
19
19
  [`${classPrefix}-${direction}`]: true,
20
20
  [`${classPrefix}-dot`]: !!props.dot
21
21
  }, className);
22
- return React__default.createElement(DataContext.Provider, { value: parentSteps }, React__default.createElement("div", {
23
- className: classes,
24
- ...restProps
25
- }, children));
22
+ return React__default.createElement(
23
+ DataContext.Provider,
24
+ { value: parentSteps },
25
+ React__default.createElement("div", { className: classes, ...restProps }, children)
26
+ );
26
27
  };
27
28
  Steps.defaultProps = defaultProps;
28
29
  Steps.displayName = "NutSteps";
@@ -2,7 +2,7 @@ import React__default, { useRef, useState, useEffect } from "react";
2
2
  import { View, ScrollView } from "@tarojs/components";
3
3
  import classNames from "classnames";
4
4
  import { JoySmile } from "@nutui/icons-react-taro";
5
- import Taro, { nextTick } from "@tarojs/taro";
5
+ import { nextTick, createSelectorQuery } from "@tarojs/taro";
6
6
  import { C as ComponentDefaults } from "./typings-buMpDfSR.js";
7
7
  import { T as TabPane } from "./tabpane.taro-5k7wWimS.js";
8
8
  import { u as usePropsValue } from "./use-props-value-vKr0R0AX.js";
@@ -92,14 +92,14 @@ const Tabs = (props) => {
92
92
  };
93
93
  const getRect = (selector) => {
94
94
  return new Promise((resolve) => {
95
- Taro.createSelectorQuery().select(selector).boundingClientRect().exec((rect = []) => {
95
+ createSelectorQuery().select(selector).boundingClientRect().exec((rect = []) => {
96
96
  resolve(rect[0]);
97
97
  });
98
98
  });
99
99
  };
100
100
  const getAllRect = (selector) => {
101
101
  return new Promise((resolve) => {
102
- Taro.createSelectorQuery().selectAll(selector).boundingClientRect().exec((rect = []) => {
102
+ createSelectorQuery().selectAll(selector).boundingClientRect().exec((rect = []) => {
103
103
  resolve(rect[0]);
104
104
  });
105
105
  });