@nutui/nutui-react-taro 2.5.0 → 2.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +5 -5
  3. package/dist/esm/Address/style/style.css +1 -1
  4. package/dist/esm/Address.js +1 -1
  5. package/dist/esm/Cascader/style/style.css +1 -1
  6. package/dist/esm/Cascader.js +1 -1
  7. package/dist/esm/DatePicker.js +1 -1
  8. package/dist/esm/Ellipsis/style/style.css +1 -1
  9. package/dist/esm/Ellipsis.js +1 -1
  10. package/dist/esm/Form/style/style.css +1 -1
  11. package/dist/esm/FormItem/style/style.css +1 -1
  12. package/dist/esm/Input.js +1 -1
  13. package/dist/esm/Popover/style/style.css +1 -1
  14. package/dist/esm/Popover.js +1 -1
  15. package/dist/esm/Progress.js +1 -1
  16. package/dist/esm/Tabs/style/style.css +1 -1
  17. package/dist/esm/Tabs.js +1 -1
  18. package/dist/esm/Tour/style/style.css +1 -1
  19. package/dist/esm/Tour.js +1 -1
  20. package/dist/esm/Uploader.js +1 -1
  21. package/dist/esm/{address.taro-CipZMqK4.js → address.taro-CQmN9x1W.js} +1 -1
  22. package/dist/esm/{cascader.taro-AZEBpBH3.js → cascader.taro-7Xhq98L4.js} +1 -1
  23. package/dist/esm/{datepicker.taro-DqR52Ivo.js → datepicker.taro-FiLalMAA.js} +14 -3
  24. package/dist/esm/{ellipsis.taro-cNaaQFyW.js → ellipsis.taro-uVc3En9l.js} +17 -8
  25. package/dist/esm/{input.taro-BVC8gEuk.js → input.taro-Dh6zXTLQ.js} +10 -3
  26. package/dist/esm/nutui-react.es.js +10 -10
  27. package/dist/esm/{popover.taro-BsOaXoWp.js → popover.taro-BG0msyw5.js} +17 -10
  28. package/dist/esm/progress.taro-rjiPI6mD.js +120 -0
  29. package/dist/esm/{tabs.taro-BxPmx5n5.js → tabs.taro-A7pOK9IM.js} +4 -20
  30. package/dist/esm/{tour.taro-wfXuUebD.js → tour.taro-BqlNfxdD.js} +1 -1
  31. package/dist/esm/{uploader.taro-Bs-cboSU.js → uploader.taro-DMmTl0Cp.js} +1 -1
  32. package/dist/esm/use-uuid-BvqmbYZ7.js +19 -0
  33. package/dist/locales/base.js +1 -1
  34. package/dist/locales/en-US.js +1 -1
  35. package/dist/locales/id-ID.js +1 -1
  36. package/dist/locales/tr-TR.js +1 -1
  37. package/dist/locales/zh-CN.js +1 -1
  38. package/dist/locales/zh-TW.js +1 -1
  39. package/dist/locales/zh-UG.js +1 -1
  40. package/dist/nutui.react.es.js +159 -54
  41. package/dist/nutui.react.umd.js +159 -54
  42. package/dist/packages/ellipsis/ellipsis.scss +1 -1
  43. package/dist/packages/form/form.scss +4 -2
  44. package/dist/packages/formitem/formitem.scss +19 -0
  45. package/dist/packages/popover/popover.scss +0 -23
  46. package/dist/packages/tabs/tabs.scss +16 -21
  47. package/dist/style.css +1 -1
  48. package/dist/style.mjs +1 -1
  49. package/dist/styles/variables-jmapp.scss +0 -1
  50. package/dist/styles/variables.scss +4 -8
  51. package/dist/types/packages/calendar/calendar.d.ts +1 -5
  52. package/dist/types/packages/calendar/calendar.taro.d.ts +1 -5
  53. package/dist/types/packages/calendar/types.d.ts +3 -0
  54. package/dist/types/packages/configprovider/types.d.ts +1 -1
  55. package/dist/types/packages/progress/progress.taro.d.ts +5 -0
  56. package/package.json +2 -2
  57. package/dist/esm/progress.taro-BOHykt7X.js +0 -60
@@ -4,7 +4,7 @@ import { Check, Location, ArrowLeft } from "@nutui/icons-react-taro";
4
4
  import { P as Popup } from "./popup.taro-Iy_WQZ-m.js";
5
5
  import { ScrollView } from "@tarojs/components";
6
6
  import { u as useConfig } from "./configprovider.taro-CyU_tvNJ.js";
7
- import { C as Cascader } from "./cascader.taro-AZEBpBH3.js";
7
+ import { C as Cascader } from "./cascader.taro-7Xhq98L4.js";
8
8
  import { C as ComponentDefaults } from "./typings-DV9RBfhj.js";
9
9
  import { u as usePropsValue } from "./use-props-value-SH9krhkx.js";
10
10
  const defaultProps$2 = {
@@ -4,7 +4,7 @@ import classNames from "classnames";
4
4
  import { Loading, Checklist } from "@nutui/icons-react-taro";
5
5
  import { ScrollView } from "@tarojs/components";
6
6
  import { P as Popup } from "./popup.taro-Iy_WQZ-m.js";
7
- import { T as Tabs } from "./tabs.taro-BxPmx5n5.js";
7
+ import { T as Tabs } from "./tabs.taro-A7pOK9IM.js";
8
8
  import { C as ComponentDefaults } from "./typings-DV9RBfhj.js";
9
9
  import { u as usePropsValue } from "./use-props-value-SH9krhkx.js";
10
10
  const formatTree = (tree, parent, config) => tree.map((node) => {
@@ -125,8 +125,12 @@ const DatePicker = (props) => {
125
125
  return result;
126
126
  }
127
127
  };
128
- const handlePickerChange = (selectedOptions, selectedValue, index) => {
128
+ const compareDateChange = (currentDate, newDate) => {
129
129
  var _a2;
130
+ const isEqual = ((_a2 = new Date(currentDate)) === null || _a2 === void 0 ? void 0 : _a2.getTime()) === (newDate === null || newDate === void 0 ? void 0 : newDate.getTime());
131
+ newDate && isDate(newDate) && !isEqual && setSelectedDate(formatValue(newDate));
132
+ };
133
+ const handlePickerChange = (selectedOptions, selectedValue, index) => {
130
134
  const rangeType = type.toLocaleLowerCase();
131
135
  if (["date", "datetime", "datehour", "month-day", "year-month"].includes(rangeType)) {
132
136
  const formatDate = [];
@@ -150,8 +154,15 @@ const DatePicker = (props) => {
150
154
  } else if (rangeType === "datehour") {
151
155
  date = new Date(year, month, day, Number(formatDate[3]));
152
156
  }
153
- const isEqual = ((_a2 = new Date(selectedDate)) === null || _a2 === void 0 ? void 0 : _a2.getTime()) === (date === null || date === void 0 ? void 0 : date.getTime());
154
- date && isDate(date) && !isEqual && setSelectedDate(formatValue(date));
157
+ compareDateChange(selectedDate, date);
158
+ } else {
159
+ const [hour, minute, seconds] = selectedValue;
160
+ const currentDate = new Date(selectedDate);
161
+ const year = currentDate.getFullYear();
162
+ const month = currentDate.getMonth();
163
+ const day = currentDate.getDate();
164
+ const date = new Date(year, month, day, Number(hour), Number(minute), rangeType === "time" ? Number(seconds) : 0);
165
+ compareDateChange(selectedDate, date);
155
166
  }
156
167
  props.onChange && props.onChange(selectedOptions, selectedValue, index);
157
168
  };
@@ -5,6 +5,7 @@ import classNames from "classnames";
5
5
  import { View } from "@tarojs/components";
6
6
  import { g as getRectByTaro } from "./get-rect-by-taro-CSN0TGnD.js";
7
7
  import { C as ComponentDefaults } from "./typings-DV9RBfhj.js";
8
+ import { a as useRtl } from "./configprovider.taro-CyU_tvNJ.js";
8
9
  const defaultProps = Object.assign(Object.assign({}, ComponentDefaults), { content: "", direction: "end", rows: 1, expandText: "", collapseText: "", symbol: "...", lineHeight: "20", width: "auto" });
9
10
  const classPrefix = `nut-ellipsis`;
10
11
  const Ellipsis = (props) => {
@@ -32,7 +33,11 @@ const Ellipsis = (props) => {
32
33
  const digitReg = /^[0-9]+$/;
33
34
  const letterUpperReg = /^[A-Z]+$/;
34
35
  const letterLowerReg = /^[a-z]+$/;
35
- const classes = classNames(classPrefix, width ? `${classPrefix}-width` : "", className);
36
+ const rtl = useRtl();
37
+ const rtlClasses = classNames({
38
+ [`${classPrefix}-rtl`]: rtl
39
+ });
40
+ const classes = classNames(classPrefix, width ? `${classPrefix}-width` : "", rtlClasses, className);
36
41
  useEffect(() => {
37
42
  setContentCopy(content);
38
43
  nextTick(() => {
@@ -218,13 +223,17 @@ const Ellipsis = (props) => {
218
223
  exceeded && expanded ? React__default.createElement(
219
224
  React__default.Fragment,
220
225
  null,
221
- React__default.createElement(View, { style: {
222
- width: `${!Number.isNaN(Number(width)) ? `${width}px` : "auto"}`
223
- } }, content),
224
- expandText ? React__default.createElement("span", { className: "nut-ellipsis-text", onClick: (e) => {
225
- e.stopPropagation();
226
- clickHandle(2);
227
- } }, collapseText) : null
226
+ React__default.createElement(
227
+ View,
228
+ { style: {
229
+ width: `${!Number.isNaN(Number(width)) ? `${width}px` : "auto"}`
230
+ } },
231
+ content,
232
+ expandText ? React__default.createElement("span", { className: "nut-ellipsis-text", onClick: (e) => {
233
+ e.stopPropagation();
234
+ clickHandle(2);
235
+ } }, collapseText) : null
236
+ )
228
237
  ) : null
229
238
  )
230
239
  ),
@@ -3,7 +3,7 @@ import React__default, { forwardRef, useRef, useState, useImperativeHandle, useC
3
3
  import { View, Input as Input$1 } from "@tarojs/components";
4
4
  import { MaskClose } from "@nutui/icons-react-taro";
5
5
  import Taro, { getEnv, ENV_TYPE } from "@tarojs/taro";
6
- import { u as useConfig } from "./configprovider.taro-CyU_tvNJ.js";
6
+ import { a as useRtl, u as useConfig } from "./configprovider.taro-CyU_tvNJ.js";
7
7
  import { C as ComponentDefaults } from "./typings-DV9RBfhj.js";
8
8
  import { u as usePropsValue } from "./use-props-value-SH9krhkx.js";
9
9
  function trimExtraChar(value, char, regExp) {
@@ -32,6 +32,7 @@ function formatNumber(value, allowDot = true, allowMinus = true) {
32
32
  }
33
33
  const defaultProps = Object.assign(Object.assign({}, ComponentDefaults), { type: "text", name: "", placeholder: "", confirmType: "done", align: "left", required: false, disabled: false, readOnly: false, maxLength: 9999, clearable: false, clearIcon: null, formatTrigger: "onChange", autoFocus: false });
34
34
  const Input = forwardRef((props, ref) => {
35
+ const rtl = useRtl();
35
36
  const { locale } = useConfig();
36
37
  const _a = Object.assign(Object.assign({}, defaultProps), props), { type, name, placeholder, align, disabled, readOnly, maxLength, clearable, clearIcon, formatTrigger, autoFocus, style, className, onChange, onFocus, onBlur, onClear, formatter, onClick, confirmType, defaultValue, value: _value } = _a, rest = __rest(_a, ["type", "name", "placeholder", "align", "disabled", "readOnly", "maxLength", "clearable", "clearIcon", "formatTrigger", "autoFocus", "style", "className", "onChange", "onFocus", "onBlur", "onClear", "formatter", "onClick", "confirmType", "defaultValue", "value"]);
37
38
  const [value, setValue] = usePropsValue({
@@ -129,8 +130,14 @@ const Input = forwardRef((props, ref) => {
129
130
  onClick && onClick(e);
130
131
  } },
131
132
  React__default.createElement(Input$1, Object.assign({}, rest, { name, className: "nut-input-native", ref: inputRef, style: {
132
- textAlign: `${// eslint-disable-next-line no-nested-ternary
133
- align === "right" ? "end" : align === "left" ? "start" : "center"}`
133
+ // eslint-disable-next-line no-nested-ternary
134
+ textAlign: rtl ? (
135
+ // eslint-disable-next-line no-nested-ternary
136
+ align === "right" ? (
137
+ // eslint-disable-next-line no-nested-ternary
138
+ "left"
139
+ ) : align === "left" ? "right" : "center"
140
+ ) : align
134
141
  }, type: inputType(type), password: type === "password", maxlength: maxLength, placeholder: placeholder || locale.placeholder, disabled: disabled || readOnly, value, focus: autoFocus, confirmType, onBlur: handleBlur, onFocus: handleFocus, onInput: (e) => {
135
142
  handleInput(e.currentTarget.value);
136
143
  } })),
@@ -23,17 +23,17 @@ import { S as S6 } from "./subsidenavbar.taro-ByxYpgfP.js";
23
23
  import { T } from "./tabbar.taro-CVp3ZaqP.js";
24
24
  import { T as T2 } from "./tabbaritem.taro-C_90fvMh.js";
25
25
  import { T as T3 } from "./tabpane.taro-BAe86j3t.js";
26
- import { T as T4 } from "./tabs.taro-BxPmx5n5.js";
27
- import { A } from "./address.taro-CipZMqK4.js";
26
+ import { T as T4 } from "./tabs.taro-A7pOK9IM.js";
27
+ import { A } from "./address.taro-CQmN9x1W.js";
28
28
  import { C as C5 } from "./calendar.taro-DbHJEx4G.js";
29
29
  import { C as C6 } from "./calendaritem.taro-B8tN2DYa.js";
30
30
  import { C as C7 } from "./calendarcard.taro-CK31xju_.js";
31
- import { C as C8 } from "./cascader.taro-AZEBpBH3.js";
31
+ import { C as C8 } from "./cascader.taro-7Xhq98L4.js";
32
32
  import { C as C9, a as a2 } from "./checkbox.taro-CUpF7Afr.js";
33
- import { D as D2 } from "./datepicker.taro-DqR52Ivo.js";
33
+ import { D as D2 } from "./datepicker.taro-FiLalMAA.js";
34
34
  import { default as default2 } from "./Form.js";
35
35
  import { F as F2 } from "./formitem.taro-Brz5dj_8.js";
36
- import { I as I2 } from "./input.taro-BVC8gEuk.js";
36
+ import { I as I2 } from "./input.taro-Dh6zXTLQ.js";
37
37
  import { I as I3 } from "./inputnumber.taro-CQiAPZgS.js";
38
38
  import { M } from "./menu.taro-BAiJPGR7.js";
39
39
  import { M as M2 } from "./menuitem.taro-oLv6ZYC5.js";
@@ -47,7 +47,7 @@ import { S as S8 } from "./shortpassword.taro-BXsxku33.js";
47
47
  import { S as S9 } from "./signature.taro-KPm_xs66.js";
48
48
  import { S as S10 } from "./switch.taro-D1HgJoJz.js";
49
49
  import { T as T5 } from "./textarea.taro-BJIFCpKb.js";
50
- import { U } from "./uploader.taro-Bs-cboSU.js";
50
+ import { U } from "./uploader.taro-DMmTl0Cp.js";
51
51
  import { A as A2 } from "./actionsheet.taro-C5BqWoML.js";
52
52
  import { B as B3 } from "./badge.taro-B0spW6jr.js";
53
53
  import { B as B4 } from "./dialog.taro-B8Usf0kl.js";
@@ -57,7 +57,7 @@ import { I as I4 } from "./infiniteloading.taro-WiMpG-fU.js";
57
57
  import { L as L2 } from "./loading.taro-CRF1z5wQ.js";
58
58
  import { N as N3 } from "./noticebar.taro-BtudzdMD.js";
59
59
  import { N as N4 } from "./notify.taro-jP7y9zMU.js";
60
- import { P as P2 } from "./popover.taro-BsOaXoWp.js";
60
+ import { P as P2 } from "./popover.taro-BG0msyw5.js";
61
61
  import { P as P3 } from "./popup.taro-Iy_WQZ-m.js";
62
62
  import { P as P4 } from "./pulltorefresh.taro-DfVmOGuo.js";
63
63
  import { S as S11 } from "./skeleton.taro-BwIDIf2p.js";
@@ -72,19 +72,19 @@ import { C as C10 } from "./circleprogress.taro-CKSrzt8Q.js";
72
72
  import { C as C11 } from "./collapse.taro-BM0BsN30.js";
73
73
  import { C as C12 } from "./collapseitem.taro-D_m4VEdG.js";
74
74
  import { C as C13 } from "./countdown.taro-wopKr1Il.js";
75
- import { E as E3 } from "./ellipsis.taro-cNaaQFyW.js";
75
+ import { E as E3 } from "./ellipsis.taro-uVc3En9l.js";
76
76
  import { I as I5 } from "./imagepreview.taro-Bb1TkBCV.js";
77
77
  import { I as I6 } from "./indicator.taro-CpHZtD9p.js";
78
78
  import { P as P5 } from "./pagination.taro-DAK6ddag.js";
79
79
  import { P as P6 } from "./price.taro-UVRHPHRD.js";
80
- import { P as P7 } from "./progress.taro-BOHykt7X.js";
80
+ import { P as P7 } from "./progress.taro-rjiPI6mD.js";
81
81
  import { S as S13 } from "./step.taro-DLr2GzYk.js";
82
82
  import { S as S14 } from "./steps.taro-C8Yg1Sns.js";
83
83
  import { default as default4 } from "./Swiper.js";
84
84
  import { S as S15 } from "./swiperitem.taro-8JXI24f0.js";
85
85
  import { T as T7 } from "./table.taro-ClLmfqz3.js";
86
86
  import { T as T8 } from "./tag.taro-rKMK0jan.js";
87
- import { T as T9 } from "./tour.taro-wfXuUebD.js";
87
+ import { T as T9 } from "./tour.taro-BqlNfxdD.js";
88
88
  import { V } from "./video.taro-DJQeroOH.js";
89
89
  import { V as V2 } from "./virtuallist.taro-Cl08vfdg.js";
90
90
  import { B as B5 } from "./barrage.taro-BNOcZsJ1.js";
@@ -5,12 +5,14 @@ import Taro, { createSelectorQuery } from "@tarojs/taro";
5
5
  import { P as Popup } from "./popup.taro-Iy_WQZ-m.js";
6
6
  import { a as getRect, g as getRectByTaro } from "./get-rect-by-taro-CSN0TGnD.js";
7
7
  import { C as ComponentDefaults } from "./typings-DV9RBfhj.js";
8
+ import { a as useRtl } from "./configprovider.taro-CyU_tvNJ.js";
8
9
  const defaultProps = Object.assign(Object.assign({}, ComponentDefaults), { list: [], theme: "light", location: "bottom", visible: false, offset: [0, 12], arrowOffset: 0, targetId: "", className: "", showArrow: true, closeOnOutsideClick: true, closeOnActionClick: true, overlay: false, onClick: () => {
9
10
  }, onOpen: () => {
10
11
  }, onClose: () => {
11
12
  } });
12
13
  const classPrefix = `nut-popover`;
13
14
  const Popover = (props) => {
15
+ const rtl = useRtl();
14
16
  const _a = Object.assign(Object.assign({}, defaultProps), props), { children, list, theme, location, visible, offset, arrowOffset, targetId, overlay, closeOnOutsideClick, closeOnActionClick, className, showArrow, style, onClick, onOpen, onClose, onSelect } = _a, rest = __rest(_a, ["children", "list", "theme", "location", "visible", "offset", "arrowOffset", "targetId", "overlay", "closeOnOutsideClick", "closeOnActionClick", "className", "showArrow", "style", "onClick", "onOpen", "onClose", "onSelect"]);
15
17
  const popoverRef = useRef(null);
16
18
  const popoverContentRef = useRef(null);
@@ -42,9 +44,9 @@ const Popover = (props) => {
42
44
  setRootPosition({
43
45
  width: rect.width,
44
46
  height: rect.height,
45
- left: rect.left,
47
+ left: rtl ? rect.right : rect.left,
46
48
  top: rect.top + distance,
47
- right: rect.right
49
+ right: rtl ? rect.left : rect.right
48
50
  });
49
51
  })).exec();
50
52
  setTimeout(() => {
@@ -95,15 +97,17 @@ const Popover = (props) => {
95
97
  let cross = 0;
96
98
  let parallel = 0;
97
99
  if (Array.isArray(offset) && offset.length === 2) {
100
+ const rtloffset = rtl ? -offset[0] : offset[0];
98
101
  cross += +offset[1];
99
- parallel += +offset[0];
102
+ parallel += +rtloffset;
100
103
  }
101
104
  if (width) {
105
+ const dir = rtl ? "right" : "left";
102
106
  if (["bottom", "top"].includes(direction)) {
103
107
  const h = direction === "bottom" ? height + cross : -(contentHeight + cross);
104
108
  styles.top = `${top + h}px`;
105
109
  if (!skew) {
106
- styles.left = `${-(contentWidth - width) / 2 + left + parallel}px`;
110
+ styles[dir] = `${-(contentWidth - width) / 2 + rootPosition[dir] + parallel}px`;
107
111
  }
108
112
  if (skew === "start") {
109
113
  styles.left = `${left + parallel}px`;
@@ -139,15 +143,17 @@ const Popover = (props) => {
139
143
  const skew = location.split("-")[1];
140
144
  const base = 16;
141
145
  if (props.arrowOffset !== 0) {
146
+ const dir = rtl ? "right" : "left";
147
+ const dir2 = rtl ? "left" : "right";
142
148
  if (["bottom", "top"].includes(direction)) {
143
149
  if (!skew) {
144
- styles.left = `calc(50% + ${arrowOffset}px)`;
150
+ styles[dir] = `calc(50% + ${arrowOffset}px)`;
145
151
  }
146
152
  if (skew === "start") {
147
- styles.left = `${base + arrowOffset}px`;
153
+ styles[dir] = `${base + arrowOffset}px`;
148
154
  }
149
155
  if (skew === "end") {
150
- styles.right = `${base - arrowOffset}px`;
156
+ styles[dir2] = `${base - arrowOffset}px`;
151
157
  }
152
158
  }
153
159
  if (["left", "right"].includes(direction)) {
@@ -165,12 +171,13 @@ const Popover = (props) => {
165
171
  return styles;
166
172
  };
167
173
  const handleSelect = (item, index) => {
174
+ var _a2;
168
175
  if (!item.disabled) {
169
- onSelect && onSelect(item, index);
176
+ onSelect === null || onSelect === void 0 ? void 0 : onSelect(item, index);
170
177
  }
171
178
  if (closeOnActionClick) {
172
- props.onClick && props.onClick();
173
- onClose && onClose();
179
+ (_a2 = props.onClick) === null || _a2 === void 0 ? void 0 : _a2.call(props);
180
+ onClose === null || onClose === void 0 ? void 0 : onClose();
174
181
  }
175
182
  };
176
183
  return React__default.createElement(
@@ -0,0 +1,120 @@
1
+ import { _ as __rest } from "./tslib.es6-BZ8i9Q6l.js";
2
+ import React__default, { useState, useEffect, useRef } from "react";
3
+ import classNames from "classnames";
4
+ import Taro from "@tarojs/taro";
5
+ import { C as ComponentDefaults } from "./typings-DV9RBfhj.js";
6
+ import { a as useRtl } from "./configprovider.taro-CyU_tvNJ.js";
7
+ import { u as useUuid } from "./use-uuid-BvqmbYZ7.js";
8
+ const defaultProps = Object.assign(Object.assign({}, ComponentDefaults), { percent: 0, showText: false, animated: false, lazy: false, delay: 0 });
9
+ const Progress = (props) => {
10
+ const rtl = useRtl();
11
+ const _a = Object.assign(Object.assign({}, defaultProps), props), { className, style, percent, background, color, strokeWidth, showText, animated, children, lazy, delay } = _a, rest = __rest(_a, ["className", "style", "percent", "background", "color", "strokeWidth", "showText", "animated", "children", "lazy", "delay"]);
12
+ const classPrefix = "nut-progress";
13
+ const classesInner = classNames({
14
+ [`${classPrefix}-inner`]: true,
15
+ [`${classPrefix}-active`]: animated
16
+ });
17
+ const stylesOuter = {
18
+ height: `${strokeWidth}px`,
19
+ background
20
+ };
21
+ const [displayPercent, setDispalyPercent] = useState(0);
22
+ const stylesInner = {
23
+ width: `${displayPercent}%`,
24
+ background: color
25
+ };
26
+ const handlePercent = () => {
27
+ let timer = null;
28
+ if (delay) {
29
+ setDispalyPercent(0);
30
+ timer = setTimeout(() => {
31
+ setDispalyPercent(percent);
32
+ }, delay);
33
+ }
34
+ return () => {
35
+ lazy && resetObserver(Taro.getEnv());
36
+ timer && clearTimeout(timer);
37
+ };
38
+ };
39
+ useEffect(() => {
40
+ setDispalyPercent(percent);
41
+ }, [percent]);
42
+ const [intersecting, setIntersecting] = useState(false);
43
+ const progressRef = useRef(null);
44
+ const webObserver = useRef(null);
45
+ const uuid = useUuid();
46
+ const selector = `${classPrefix}-lazy-${uuid}`;
47
+ const resetObserver = (env, observer = null) => {
48
+ if (env === "WEB") {
49
+ webObserver.current.disconnect && webObserver.current.disconnect();
50
+ } else {
51
+ observer && observer.disconnect();
52
+ }
53
+ };
54
+ useEffect(() => {
55
+ if (lazy) {
56
+ setTimeout(() => {
57
+ if (intersecting) {
58
+ setDispalyPercent(percent);
59
+ } else {
60
+ setDispalyPercent(0.01);
61
+ }
62
+ }, delay);
63
+ }
64
+ }, [intersecting]);
65
+ const handleWebObserver = () => {
66
+ if (lazy) {
67
+ webObserver.current = new IntersectionObserver((entires, self) => {
68
+ entires.forEach((item) => {
69
+ setIntersecting(item.isIntersecting);
70
+ });
71
+ }, {
72
+ threshold: [0],
73
+ rootMargin: "0px"
74
+ });
75
+ webObserver.current.observe(progressRef.current);
76
+ }
77
+ handlePercent();
78
+ };
79
+ const handleOtherObserver = () => {
80
+ let observer = null;
81
+ if (lazy) {
82
+ observer = Taro.createIntersectionObserver(Taro.getCurrentInstance().page, {
83
+ thresholds: [0],
84
+ observeAll: true
85
+ });
86
+ observer.relativeToViewport({ top: 0 }).observe(`#${selector}`, (res) => {
87
+ setIntersecting(res.intersectionRatio > 0);
88
+ });
89
+ }
90
+ handlePercent();
91
+ };
92
+ useEffect(() => {
93
+ if (Taro.getEnv() === "WEB") {
94
+ handleWebObserver();
95
+ } else {
96
+ handleOtherObserver();
97
+ }
98
+ }, []);
99
+ return React__default.createElement(
100
+ "div",
101
+ Object.assign({ ref: progressRef, id: selector, className: classNames(classPrefix, className), style }, rest),
102
+ React__default.createElement(
103
+ "div",
104
+ { className: `${classPrefix}-outer`, style: stylesOuter },
105
+ React__default.createElement("div", { className: classesInner, style: stylesInner }, showText && React__default.createElement("div", { className: `${classPrefix}-text`, style: rtl ? { right: `${displayPercent}%` } : { left: `${displayPercent}%` } }, children || React__default.createElement(
106
+ "div",
107
+ { className: `${classPrefix}-text-inner`, style: {
108
+ background: color
109
+ } },
110
+ percent,
111
+ "%"
112
+ )))
113
+ )
114
+ );
115
+ };
116
+ Progress.defaultProps = defaultProps;
117
+ Progress.displayName = "NutProgress";
118
+ export {
119
+ Progress as P
120
+ };
@@ -1,5 +1,5 @@
1
1
  import { _ as __rest } from "./tslib.es6-BZ8i9Q6l.js";
2
- import React__default, { useRef, useState, useEffect } from "react";
2
+ import React__default, { useState, useRef, useEffect } from "react";
3
3
  import { View, ScrollView } from "@tarojs/components";
4
4
  import classNames from "classnames";
5
5
  import { JoySmile } from "@nutui/icons-react-taro";
@@ -9,22 +9,8 @@ import { T as TabPane } from "./tabpane.taro-BAe86j3t.js";
9
9
  import { u as usePropsValue } from "./use-props-value-SH9krhkx.js";
10
10
  import { u as useForceUpdate } from "./use-force-update-CudFjCsy.js";
11
11
  import { r as requestAniFrame } from "./raf-zwv-SBjP.js";
12
+ import { u as useUuid } from "./use-uuid-BvqmbYZ7.js";
12
13
  import { a as useRtl } from "./configprovider.taro-CyU_tvNJ.js";
13
- const idCounter = {};
14
- function uniqueId(prefix = "$nut$") {
15
- if (!idCounter[prefix]) {
16
- idCounter[prefix] = 0;
17
- }
18
- const id = ++idCounter[prefix];
19
- if (prefix === "$nut$") {
20
- return `${id}`;
21
- }
22
- return `${prefix}${id}`;
23
- }
24
- function useUuid() {
25
- const idRef = useRef(uniqueId());
26
- return idRef.current;
27
- }
28
14
  const defaultProps = Object.assign(Object.assign({}, ComponentDefaults), { tabStyle: {}, activeColor: "", direction: "horizontal", activeType: "line", duration: 300, autoHeight: false });
29
15
  const classPrefix = "nut-tabs";
30
16
  const Tabs = (props) => {
@@ -129,12 +115,10 @@ const Tabs = (props) => {
129
115
  return;
130
116
  let to = 0;
131
117
  if (props.direction === "vertical") {
132
- const DEFAULT_PADDING = 11;
133
- const top = titleRects.slice(0, index).reduce((prev, curr) => prev + curr.height, DEFAULT_PADDING);
118
+ const top = titleRects.slice(0, index).reduce((prev, curr) => prev + curr.height, 0);
134
119
  to = top - (navRectRef.current.height - titleRect.height) / 2;
135
120
  } else {
136
- const DEFAULT_PADDING = 20;
137
- const left = titleRects.slice(0, index).reduce((prev, curr) => prev + curr.width, DEFAULT_PADDING);
121
+ const left = titleRects.slice(0, index).reduce((prev, curr) => prev + curr.width, 0);
138
122
  to = left - (navRectRef.current.width - titleRect.width) / 2;
139
123
  to = rtl ? -to : to;
140
124
  }
@@ -2,7 +2,7 @@ import { _ as __rest } from "./tslib.es6-BZ8i9Q6l.js";
2
2
  import React__default, { useState, useEffect } from "react";
3
3
  import { Close } from "@nutui/icons-react-taro";
4
4
  import classNames from "classnames";
5
- import { P as Popover } from "./popover.taro-BsOaXoWp.js";
5
+ import { P as Popover } from "./popover.taro-BG0msyw5.js";
6
6
  import Taro, { createSelectorQuery } from "@tarojs/taro";
7
7
  import { C as ComponentDefaults } from "./typings-DV9RBfhj.js";
8
8
  import { useConfig } from "./ConfigProvider.js";
@@ -9,7 +9,7 @@ import { a as isPromise } from "./index-DeNfBlua.js";
9
9
  import { C as ComponentDefaults } from "./typings-DV9RBfhj.js";
10
10
  import { u as usePropsValue } from "./use-props-value-SH9krhkx.js";
11
11
  import { Image } from "@tarojs/components";
12
- import { P as Progress } from "./progress.taro-BOHykt7X.js";
12
+ import { P as Progress } from "./progress.taro-rjiPI6mD.js";
13
13
  class UploadOptions {
14
14
  constructor() {
15
15
  this.url = "";
@@ -0,0 +1,19 @@
1
+ import { useRef } from "react";
2
+ const idCounter = {};
3
+ function uniqueId(prefix = "$nut$") {
4
+ if (!idCounter[prefix]) {
5
+ idCounter[prefix] = 0;
6
+ }
7
+ const id = ++idCounter[prefix];
8
+ if (prefix === "$nut$") {
9
+ return `${id}`;
10
+ }
11
+ return `${prefix}${id}`;
12
+ }
13
+ function useUuid() {
14
+ const idRef = useRef(uniqueId());
15
+ return idRef.current;
16
+ }
17
+ export {
18
+ useUuid as u
19
+ };
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react-taro v2.5.0 Fri Mar 22 2024 19:34:09 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react-taro v2.5.1 Fri Mar 29 2024 16:12:35 GMT+0800 (China Standard Time)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react-taro v2.5.0 Fri Mar 22 2024 19:34:09 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react-taro v2.5.1 Fri Mar 29 2024 16:12:35 GMT+0800 (China Standard Time)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react-taro v2.5.0 Fri Mar 22 2024 19:34:09 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react-taro v2.5.1 Fri Mar 29 2024 16:12:35 GMT+0800 (China Standard Time)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react-taro v2.5.0 Fri Mar 22 2024 19:34:09 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react-taro v2.5.1 Fri Mar 29 2024 16:12:35 GMT+0800 (China Standard Time)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react-taro v2.5.0 Fri Mar 22 2024 19:34:09 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react-taro v2.5.1 Fri Mar 29 2024 16:12:35 GMT+0800 (China Standard Time)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react-taro v2.5.0 Fri Mar 22 2024 19:34:09 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react-taro v2.5.1 Fri Mar 29 2024 16:12:35 GMT+0800 (China Standard Time)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react-taro v2.5.0 Fri Mar 22 2024 19:34:09 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react-taro v2.5.1 Fri Mar 29 2024 16:12:35 GMT+0800 (China Standard Time)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */