@nutui/nutui-react-taro 2.0.0-alpha.3 → 2.0.0-alpha.5

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 (122) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/esm/Address.js +3 -5
  3. package/dist/esm/Audio.js +3 -4
  4. package/dist/esm/Avatar.js +6 -5
  5. package/dist/esm/AvatarGroup.js +3 -7
  6. package/dist/esm/Calendar.js +3 -4
  7. package/dist/esm/CalendarItem.js +2 -3
  8. package/dist/esm/CellGroup.js +1 -1
  9. package/dist/esm/Checkbox.js +3 -3
  10. package/dist/esm/CheckboxGroup.js +3 -3
  11. package/dist/esm/CircleProgress.js +2 -3
  12. package/dist/esm/ConfigProvider.js +2 -3
  13. package/dist/esm/CountDown.js +2 -3
  14. package/dist/esm/DatePicker.js +3 -4
  15. package/dist/esm/Dialog.js +2 -3
  16. package/dist/esm/Elevator.js +1 -1
  17. package/dist/esm/Ellipsis.js +3 -4
  18. package/dist/esm/Empty.js +3 -5
  19. package/dist/esm/FixedNav.js +2 -3
  20. package/dist/esm/Form.js +2 -2
  21. package/dist/esm/Grid.js +3 -4
  22. package/dist/esm/GridItem.js +2 -3
  23. package/dist/esm/Image.js +2 -3
  24. package/dist/esm/Infiniteloading.js +2 -3
  25. package/dist/esm/Input.js +5 -3
  26. package/dist/esm/NumberKeyboard.js +2 -3
  27. package/dist/esm/Pagination.js +2 -3
  28. package/dist/esm/Picker.js +2 -3
  29. package/dist/esm/PullToRefresh.js +2 -3
  30. package/dist/esm/Range.js +2 -3
  31. package/dist/esm/SearchBar.js +2 -3
  32. package/dist/esm/ShortPassword.js +2 -3
  33. package/dist/esm/Signature.js +2 -3
  34. package/dist/esm/Skeleton.js +8 -5
  35. package/dist/esm/Swipe.js +1 -1
  36. package/dist/esm/Tabbar/style/index.js +1 -1
  37. package/dist/esm/Tabbar.js +6 -3
  38. package/dist/esm/TabbarItem.js +3 -4
  39. package/dist/esm/Table.js +2 -3
  40. package/dist/esm/TextArea.js +2 -3
  41. package/dist/esm/TimeDetail.js +2 -3
  42. package/dist/esm/TimePannel.js +2 -3
  43. package/dist/esm/TimeSelect.js +4 -5
  44. package/dist/esm/Uploader.js +2 -3
  45. package/dist/esm/VirtualList.js +2 -3
  46. package/dist/esm/WaterMark.js +2 -3
  47. package/dist/esm/{address.taro-67e32c33.js → address.taro-cab0ea22.js} +18 -4
  48. package/dist/esm/{audio.taro-51eafc9d.js → audio.taro-ff280f5e.js} +2 -2
  49. package/dist/esm/{avatar.taro-a840f345.js → avatar.taro-6e8f1f5c.js} +31 -29
  50. package/dist/esm/{avatargroup-0eadb514.js → avatargroup-f4375806.js} +9 -12
  51. package/dist/esm/{calendar.taro-b3ebdc35.js → calendar.taro-2fc9b899.js} +2 -2
  52. package/dist/esm/{calendaritem.taro-ab1ec154.js → calendaritem.taro-2d4a8c34.js} +1 -1
  53. package/dist/esm/{cellgroup.taro-660faffc.js → cellgroup.taro-e05ea802.js} +3 -2
  54. package/dist/esm/checkbox.taro-9d02f86c.js +175 -0
  55. package/dist/esm/{circleprogress.taro-d8973ae9.js → circleprogress.taro-d4943109.js} +21 -27
  56. package/dist/esm/{zh-CN-b4f493ba.js → configprovider.taro-ce34d482.js} +44 -1
  57. package/dist/esm/{countdown.taro-c14b5c1f.js → countdown.taro-3118ba23.js} +1 -1
  58. package/dist/esm/{datepicker.taro-7d522ff8.js → datepicker.taro-2e3e955b.js} +2 -2
  59. package/dist/esm/{dialog.taro-f9ca73a2.js → dialog.taro-eab19eab.js} +1 -1
  60. package/dist/esm/{elevator.taro-360a831f.js → elevator.taro-1a4e3356.js} +16 -8
  61. package/dist/esm/{ellipsis.taro-79044d54.js → ellipsis.taro-e1ac99a1.js} +7 -4
  62. package/dist/esm/{empty.taro-f8585835.js → empty.taro-26363c66.js} +12 -18
  63. package/dist/esm/{fixednav.taro-cca9a6df.js → fixednav.taro-ddb21e87.js} +1 -1
  64. package/dist/esm/{form.taro-7413d868.js → form.taro-423b0f0a.js} +1 -1
  65. package/dist/esm/{grid.taro-10eb7716.js → grid.taro-883a9c35.js} +1 -1
  66. package/dist/esm/{griditem.taro-fb15eeec.js → griditem.taro-16c7055b.js} +1 -1
  67. package/dist/esm/{image.taro-b897a058.js → image.taro-3025e659.js} +1 -1
  68. package/dist/esm/{infiniteloading.taro-cce53c60.js → infiniteloading.taro-721bca1f.js} +1 -1
  69. package/dist/esm/input.taro-06c1e4d5.js +167 -0
  70. package/dist/esm/{numberkeyboard.taro-10ab54d6.js → numberkeyboard.taro-d9b1721b.js} +1 -1
  71. package/dist/esm/nutui-react.es.js +45 -47
  72. package/dist/esm/{pagination.taro-df441058.js → pagination.taro-94f9be5e.js} +1 -1
  73. package/dist/esm/{picker.taro-9f1bb6a4.js → picker.taro-e16b4312.js} +1 -1
  74. package/dist/esm/{pulltorefresh.taro-37dadbc5.js → pulltorefresh.taro-016d0079.js} +1 -1
  75. package/dist/esm/{range.taro-432d20d7.js → range.taro-8953e8c3.js} +1 -1
  76. package/dist/esm/{searchbar.taro-4aa300df.js → searchbar.taro-4467040f.js} +1 -1
  77. package/dist/esm/{shortpassword.taro-99645f99.js → shortpassword.taro-433b86a4.js} +1 -1
  78. package/dist/esm/{signature.taro-e5ede25a.js → signature.taro-a4d9b5c9.js} +1 -1
  79. package/dist/esm/{skeleton.taro-fabd423a.js → skeleton.taro-8ec11af9.js} +2 -2
  80. package/dist/esm/{swipe.taro-b18a73ff.js → swipe.taro-0b8cc872.js} +3 -5
  81. package/dist/esm/tabbar.taro-48413fb8.js +51 -0
  82. package/dist/esm/tabbaritem.taro-5afa3562.js +37 -0
  83. package/dist/esm/{table.taro-eca757f3.js → table.taro-327b4248.js} +1 -1
  84. package/dist/esm/{textarea.taro-e256e741.js → textarea.taro-add72cf3.js} +1 -1
  85. package/dist/esm/{timedetail.taro-cae362b9.js → timedetail.taro-82a2900b.js} +1 -1
  86. package/dist/esm/{timepannel.taro-d6f4cf80.js → timepannel.taro-0573bb65.js} +1 -1
  87. package/dist/esm/{timeselect.taro-804199f9.js → timeselect.taro-29124a34.js} +3 -3
  88. package/dist/esm/{uploader.taro-716f9a50.js → uploader.taro-c70d00de.js} +1 -1
  89. package/dist/esm/{virtuallist.taro-0bd611cb.js → virtuallist.taro-ba8e1f21.js} +1 -1
  90. package/dist/esm/{watermark.taro-8966896a.js → watermark.taro-168cdac5.js} +1 -1
  91. package/dist/locales/base.js +1 -1
  92. package/dist/locales/en-US.js +1 -1
  93. package/dist/locales/id-ID.js +1 -1
  94. package/dist/locales/zh-CN.js +1 -1
  95. package/dist/locales/zh-TW.js +1 -1
  96. package/dist/locales/zh-UG.js +1 -1
  97. package/dist/nutui.react.mjs +975 -1094
  98. package/dist/nutui.react.umd.js +973 -1092
  99. package/dist/packages/badge/badge.scss +0 -1
  100. package/dist/packages/cellgroup/cellgroup.scss +20 -16
  101. package/dist/packages/checkbox/checkbox.scss +8 -11
  102. package/dist/packages/circleprogress/circleprogress.scss +0 -9
  103. package/dist/packages/empty/empty.scss +0 -9
  104. package/dist/packages/input/input.scss +13 -180
  105. package/dist/packages/tabbar/tabbar.scss +16 -22
  106. package/dist/packages/tabbaritem/tabbaritem.scss +9 -70
  107. package/dist/style.css +1 -1
  108. package/dist/style.mjs +1 -1
  109. package/dist/styles/themes/default.scss +0 -1
  110. package/dist/styles/variables-jmapp.scss +12 -16
  111. package/dist/styles/variables.scss +12 -16
  112. package/dist/types/index.d.ts +86 -129
  113. package/package.json +1 -1
  114. package/dist/esm/Icon.js +0 -64
  115. package/dist/esm/checkbox.taro-ae460d3a.js +0 -168
  116. package/dist/esm/configprovider-9960f0fb.js +0 -19
  117. package/dist/esm/configprovider.taro-43a3c646.js +0 -45
  118. package/dist/esm/input.taro-f4e067f7.js +0 -237
  119. package/dist/esm/tabbar.taro-eefd0f8e.js +0 -59
  120. package/dist/esm/tabbaritem.taro-7a97e645.js +0 -55
  121. package/dist/packages/icon/icon.scss +0 -0
  122. /package/dist/esm/{AvatarContext-c96afdcc.js → context-c96afdcc.js} +0 -0
@@ -1,6 +1,6 @@
1
1
  import React, { useState, useRef, useImperativeHandle, useEffect } from 'react';
2
2
  import { c as cn } from './bem-350c1702.js';
3
- import { u as useConfig } from './configprovider.taro-43a3c646.js';
3
+ import { u as useConfig } from './configprovider.taro-ce34d482.js';
4
4
 
5
5
  const defaultProps = {
6
6
  paused: false,
@@ -1,6 +1,6 @@
1
1
  import React, { useState, useRef, useEffect } from 'react';
2
- import { P as Picker } from './picker.taro-9f1bb6a4.js';
3
- import { u as useConfig } from './configprovider.taro-43a3c646.js';
2
+ import { P as Picker } from './picker.taro-e16b4312.js';
3
+ import { u as useConfig } from './configprovider.taro-ce34d482.js';
4
4
  import { View } from '@tarojs/components';
5
5
 
6
6
  const currentYear = new Date().getFullYear();
@@ -5,7 +5,7 @@ import { B as Button } from './button.taro-b50bc217.js';
5
5
  import { CSSTransition } from 'react-transition-group';
6
6
  import { d as defaultOverlayProps, O as Overlay } from './overlay.taro-067b7202.js';
7
7
  import { C as ComponentDefaults } from './typings-d8491423.js';
8
- import { u as useConfig } from './configprovider.taro-43a3c646.js';
8
+ import { u as useConfig } from './configprovider.taro-ce34d482.js';
9
9
 
10
10
  const Content = (props) => {
11
11
  const { visible, title, footer, footerDirection, onClick, children } = props;
@@ -1,5 +1,5 @@
1
1
  import React, { createContext, useRef, useState, useEffect } from 'react';
2
- import { nextTick, createSelectorQuery } from '@tarojs/taro';
2
+ import Taro, { nextTick, createSelectorQuery } from '@tarojs/taro';
3
3
  import { ScrollView } from '@tarojs/components';
4
4
  import classNames from 'classnames';
5
5
  import { C as ComponentDefaults } from './typings-d8491423.js';
@@ -39,6 +39,7 @@ const Elevator = (props) => {
39
39
  const [scrollStart, setScrollStart] = useState(false);
40
40
  const state = useRef(initData);
41
41
  const [scrollTop, setScrollTop] = useState(0);
42
+ const [scrollY, setScrollY] = useState(0);
42
43
  // 重置滚动参数
43
44
  const resetScrollState = () => {
44
45
  setScrollStart(false);
@@ -81,7 +82,11 @@ const Elevator = (props) => {
81
82
  cacheIndex = state.current.listHeight.length - 2;
82
83
  }
83
84
  setCodeIndex(cacheIndex);
84
- setScrollTop(state.current.listHeight[cacheIndex]);
85
+ const scrollTop = state.current.listHeight[cacheIndex];
86
+ setScrollTop(scrollTop);
87
+ if (sticky && scrollY !== scrollTop) {
88
+ setScrollY(Math.floor(scrollTop) > 0 ? 1 : 0);
89
+ }
85
90
  };
86
91
  const touchMove = (e) => {
87
92
  const firstTouch = e.touches[0];
@@ -132,7 +137,10 @@ const Elevator = (props) => {
132
137
  const target = e.target;
133
138
  const { scrollTop } = target;
134
139
  state.current.scrollY = Math.floor(scrollTop);
135
- setScrollTop(scrollTop);
140
+ Taro.getEnv() === 'WEB' && setScrollTop(scrollTop);
141
+ if (sticky && scrollTop !== scrollY) {
142
+ setScrollY(Math.floor(scrollTop) > 0 ? 1 : 0);
143
+ }
136
144
  for (let i = 0; i < listHeight.length - 1; i++) {
137
145
  const height1 = listHeight[i];
138
146
  const height2 = listHeight[i + 1];
@@ -141,7 +149,7 @@ const Elevator = (props) => {
141
149
  return;
142
150
  }
143
151
  }
144
- setCurrentIndex(listHeight.length - 2);
152
+ // setCurrentIndex(listHeight.length - 2)
145
153
  };
146
154
  useEffect(() => {
147
155
  if (listview.current) {
@@ -151,10 +159,8 @@ const Elevator = (props) => {
151
159
  }
152
160
  }, [listview]);
153
161
  return (React.createElement("div", { className: `${classPrefix} ${className}`, style: style, ...rest },
154
- sticky && scrollTop > 0 ? (React.createElement("div", { className: `${classPrefix}__list__fixed` },
155
- React.createElement("span", { className: `${classPrefix}__list__fixed__title` }, list[currentIndex][floorKey]))) : null,
156
162
  React.createElement("div", { className: `${classPrefix}__list`, style: { height: Number.isNaN(+height) ? height : `${height}px` } },
157
- React.createElement(ScrollView, { scrollTop: scrollTop, scrollY: true, className: `${classPrefix}__list__inner`, type: "list", ref: listview, onScroll: listViewScroll }, list.map((item, idx) => {
163
+ React.createElement(ScrollView, { scrollTop: scrollTop, scrollY: true, scrollWithAnimation: true, scrollAnchoring: true, className: `${classPrefix}__list__inner`, type: "list", ref: listview, onScroll: listViewScroll }, list.map((item, idx) => {
158
164
  return (React.createElement("div", { className: `${classPrefix}__list__item nut-elevator__item__${idx}`, key: idx },
159
165
  React.createElement("div", { className: `${classPrefix}__list__item__code` }, item[floorKey]),
160
166
  React.createElement(React.Fragment, null, item.list.map((subitem) => {
@@ -176,7 +182,9 @@ const Elevator = (props) => {
176
182
  [`${classPrefix}__bars__inner__item`]: true,
177
183
  [`${classPrefix}__bars__inner__item--active`]: item[floorKey] === list[currentIndex][floorKey],
178
184
  }), "data-index": index, key: index, onClick: () => handleClickIndex(item[floorKey]) }, item[floorKey]));
179
- })))));
185
+ }))),
186
+ sticky && scrollY > 0 ? (React.createElement("div", { className: `${classPrefix}__list__fixed` },
187
+ React.createElement("span", { className: `${classPrefix}__list__fixed__title` }, list[currentIndex][floorKey]))) : null));
180
188
  };
181
189
  Elevator.defaultProps = defaultProps;
182
190
  Elevator.displayName = 'NutElevator';
@@ -1,9 +1,11 @@
1
1
  import React, { useState, useRef, useEffect } from 'react';
2
2
  import { useReady, nextTick, createSelectorQuery } from '@tarojs/taro';
3
- import { u as useConfig } from './configprovider.taro-43a3c646.js';
4
3
  import { g as getRectByTaro } from './use-client-rect-1f8ed1fe.js';
4
+ import { C as ComponentDefaults } from './typings-d8491423.js';
5
+ import classNames from 'classnames';
5
6
 
6
7
  const defaultProps = {
8
+ ...ComponentDefaults,
7
9
  content: '',
8
10
  direction: 'end',
9
11
  rows: 1,
@@ -12,9 +14,9 @@ const defaultProps = {
12
14
  symbol: '...',
13
15
  lineHeight: '20',
14
16
  };
17
+ const classPrefix = `nut-ellipsis`;
15
18
  const Ellipsis = (props) => {
16
- useConfig();
17
- const { children, content, direction, rows, expandText, collapseText, symbol, lineHeight, onClick, onChange, } = { ...defaultProps, ...props };
19
+ const { children, content, direction, rows, className, expandText, collapseText, symbol, lineHeight, onClick, onChange, ...rest } = { ...defaultProps, ...props };
18
20
  let maxHeight = 0; // 当行的最大高度
19
21
  const [exceeded, setExceeded] = useState(false);
20
22
  const [expanded, setExpanded] = useState(false);
@@ -36,6 +38,7 @@ const Ellipsis = (props) => {
36
38
  const digitReg = /^[0-9]+$/; // 数字
37
39
  const letterUpperReg = /^[A-Z]+$/; // 字母
38
40
  const letterLowerReg = /^[a-z]+$/; // 字母
41
+ const classes = classNames(classPrefix, className);
39
42
  const init = () => {
40
43
  setExceeded(false);
41
44
  setExpanded(false);
@@ -212,7 +215,7 @@ const Ellipsis = (props) => {
212
215
  onClick && onClick();
213
216
  };
214
217
  return (React.createElement(React.Fragment, null,
215
- React.createElement("div", { className: "nut-ellipsis", onClick: handleClick, ref: root, id: `root${refRandomId}` },
218
+ React.createElement("div", { className: classes, onClick: handleClick, ref: root, id: `root${refRandomId}`, ...rest },
216
219
  React.createElement("div", null,
217
220
  !exceeded ? (React.createElement("div", { className: "nut-ellipsis-wordbreak" }, content)) : null,
218
221
  exceeded && !expanded ? (React.createElement(React.Fragment, null,
@@ -1,6 +1,6 @@
1
1
  import React, { useState, useEffect } from 'react';
2
- import { c as cn } from './bem-350c1702.js';
3
- import { u as useConfig } from './configprovider.taro-43a3c646.js';
2
+ import { u as useConfig } from './configprovider.taro-ce34d482.js';
3
+ import { C as ComponentDefaults } from './typings-d8491423.js';
4
4
 
5
5
  /**
6
6
  * 内置图片地址
@@ -11,28 +11,22 @@ const defaultStatus = {
11
11
  network: 'https://static-ftcms.jd.com/p/files/61a9e31de7dcdbcc0ce62734.png',
12
12
  };
13
13
  const defaultProps = {
14
- description: '无内容',
15
- image: 'empty',
14
+ ...ComponentDefaults,
15
+ description: '',
16
16
  imageSize: '',
17
- className: '',
17
+ status: 'empty',
18
18
  };
19
+ const classPrefix = `nut-empty`;
19
20
  const Empty = (props) => {
20
21
  const { locale } = useConfig();
21
22
  defaultProps.description = locale.noData || defaultProps.description;
22
- const { image, imageSize, description, children, className, ...rest } = {
23
+ const { image, imageSize, description, children, className, status, ...rest } = {
23
24
  ...defaultProps,
24
25
  ...props,
25
26
  };
26
27
  const [imgStyle, setImgStyle] = useState({});
27
- const b = cn('empty');
28
- let imageNode = image;
29
- if (typeof image === 'string') {
30
- const isHttpUrl = image.startsWith('https://') ||
31
- image.startsWith('http://') ||
32
- image.startsWith('//');
33
- const imageUrl = isHttpUrl ? image : defaultStatus[image];
34
- imageNode = React.createElement("img", { className: "img", src: imageUrl, alt: "empty" });
35
- }
28
+ const imageUrl = image || defaultStatus[status];
29
+ const imageNode = typeof imageUrl === 'string' ? (React.createElement("img", { className: "img", src: imageUrl, alt: "empty" })) : (imageUrl);
36
30
  useEffect(() => {
37
31
  setImgStyle(() => {
38
32
  if (!imageSize) {
@@ -50,10 +44,10 @@ const Empty = (props) => {
50
44
  };
51
45
  });
52
46
  }, [imageSize]);
53
- return (React.createElement("div", { className: `${b()} ${className}`, ...rest },
47
+ return (React.createElement("div", { className: `${classPrefix} ${className}`, ...rest },
54
48
  React.createElement(React.Fragment, null,
55
- React.createElement("div", { className: b('image'), style: imgStyle }, imageNode),
56
- typeof description === 'string' ? (React.createElement("div", { className: b('description') }, description)) : ({ description }),
49
+ React.createElement("div", { className: `${classPrefix}__image`, style: imgStyle }, imageNode),
50
+ typeof description === 'string' ? (React.createElement("div", { className: `${classPrefix}__description` }, description)) : (description),
57
51
  children)));
58
52
  };
59
53
  Empty.defaultProps = defaultProps;
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import classNames from 'classnames';
3
3
  import { Left } from '@nutui/icons-react-taro';
4
4
  import { O as Overlay } from './overlay.taro-067b7202.js';
5
- import { u as useConfig } from './configprovider.taro-43a3c646.js';
5
+ import { u as useConfig } from './configprovider.taro-ce34d482.js';
6
6
  import { C as ComponentDefaults } from './typings-d8491423.js';
7
7
 
8
8
  const defaultProps = {
@@ -1,6 +1,6 @@
1
1
  import React, { useRef } from 'react';
2
2
  import { C as ComponentDefaults } from './typings-d8491423.js';
3
- import { C as CellGroup } from './cellgroup.taro-660faffc.js';
3
+ import { C as CellGroup } from './cellgroup.taro-e05ea802.js';
4
4
  import { a as FormItemContext, F as FormItem } from './formitem.taro-b550d29c.js';
5
5
 
6
6
  /**
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import classNames from 'classnames';
3
- import { a as GridContext, G as GridItem, p as pxCheck } from './griditem.taro-fb15eeec.js';
3
+ import { a as GridContext, G as GridItem, p as pxCheck } from './griditem.taro-16c7055b.js';
4
4
 
5
5
  const defaultProps = {
6
6
  columns: 4,
@@ -1,6 +1,6 @@
1
1
  import React, { useContext } from 'react';
2
2
  import classNames from 'classnames';
3
- import { u as useConfig } from './configprovider.taro-43a3c646.js';
3
+ import { u as useConfig } from './configprovider.taro-ce34d482.js';
4
4
 
5
5
  const gridContext = {
6
6
  onClick: (item, index) => { },
@@ -1,6 +1,6 @@
1
1
  import React, { useState, useEffect } from 'react';
2
2
  import { Image as Image$1, ImageError } from '@nutui/icons-react-taro';
3
- import { u as useConfig } from './configprovider.taro-43a3c646.js';
3
+ import { u as useConfig } from './configprovider.taro-ce34d482.js';
4
4
 
5
5
  const defaultProps = {
6
6
  fit: 'fill',
@@ -3,7 +3,7 @@ import classNames from 'classnames';
3
3
  import { ScrollView } from '@tarojs/components';
4
4
  import { createSelectorQuery } from '@tarojs/taro';
5
5
  import { c as cn } from './bem-350c1702.js';
6
- import { u as useConfig } from './configprovider.taro-43a3c646.js';
6
+ import { u as useConfig } from './configprovider.taro-ce34d482.js';
7
7
  import { C as ComponentDefaults } from './typings-d8491423.js';
8
8
 
9
9
  const defaultProps = {
@@ -0,0 +1,167 @@
1
+ import React, { forwardRef, useRef, useState, useImperativeHandle, useCallback } from 'react';
2
+ import { View, Input as Input$1 } from '@tarojs/components';
3
+ import { MaskClose } from '@nutui/icons-react-taro';
4
+ import { getEnv, ENV_TYPE } from '@tarojs/taro';
5
+ import { u as useConfig } from './configprovider.taro-ce34d482.js';
6
+ import { C as ComponentDefaults } from './typings-d8491423.js';
7
+ import { u as usePropsValue } from './use-props-value-ae7ee726.js';
8
+
9
+ function trimExtraChar(value, char, regExp) {
10
+ const index = value.indexOf(char);
11
+ if (index === -1) {
12
+ return value;
13
+ }
14
+ if (char === '-' && index !== 0) {
15
+ return value.slice(0, index);
16
+ }
17
+ return value.slice(0, index + 1) + value.slice(index).replace(regExp, '');
18
+ }
19
+ function formatNumber(value, allowDot = true, allowMinus = true) {
20
+ if (allowDot) {
21
+ value = trimExtraChar(value, '.', /\./g);
22
+ }
23
+ else {
24
+ value = value.split('.')[0];
25
+ }
26
+ if (allowMinus) {
27
+ value = trimExtraChar(value, '-', /-/g);
28
+ }
29
+ else {
30
+ value = value.replace(/-/, '');
31
+ }
32
+ const regExp = allowDot ? /[^-0-9.]/g : /[^-0-9]/g;
33
+ return value.replace(regExp, '');
34
+ }
35
+
36
+ const defaultProps = {
37
+ ...ComponentDefaults,
38
+ type: 'text',
39
+ name: '',
40
+ placeholder: '',
41
+ confirmType: 'done',
42
+ align: 'left',
43
+ required: false,
44
+ disabled: false,
45
+ readOnly: false,
46
+ maxLength: 9999,
47
+ clearable: false,
48
+ clearIcon: null,
49
+ formatTrigger: 'onChange',
50
+ autoFocus: false,
51
+ };
52
+ const Input = forwardRef((props, ref) => {
53
+ const { locale } = useConfig();
54
+ const { type, name, placeholder, align, disabled, readOnly, maxLength, clearable, clearIcon, formatTrigger, autoFocus, style, className, onChange, onFocus, onBlur, onClear, formatter, onClick, confirmType, defaultValue, value: _value, ...rest } = {
55
+ ...defaultProps,
56
+ ...props,
57
+ };
58
+ const [value, setValue] = usePropsValue({
59
+ value: props.value,
60
+ defaultValue: props.defaultValue,
61
+ finalValue: '',
62
+ onChange,
63
+ });
64
+ const inputRef = useRef(null);
65
+ const [active, setActive] = useState(false);
66
+ useImperativeHandle(ref, () => {
67
+ return {
68
+ clear: () => {
69
+ setValue('');
70
+ },
71
+ focus: () => {
72
+ inputRef.current?.focus();
73
+ },
74
+ blur: () => {
75
+ inputRef.current?.blur();
76
+ },
77
+ get nativeElement() {
78
+ return inputRef.current;
79
+ },
80
+ };
81
+ });
82
+ const inputClass = useCallback(() => {
83
+ const classPrefix = 'nut-input';
84
+ return [classPrefix, `${disabled ? `${classPrefix}-disabled` : ''}`]
85
+ .filter(Boolean)
86
+ .join(' ');
87
+ }, [disabled]);
88
+ const [, updateState] = React.useState();
89
+ const forceUpdate = React.useCallback(() => updateState({}), []);
90
+ const updateValue = (value, trigger = 'onChange') => {
91
+ let val = value;
92
+ if (getEnv() === ENV_TYPE.WEB) {
93
+ if (type === 'number') {
94
+ val = formatNumber(val, false, true);
95
+ }
96
+ if (type === 'digit') {
97
+ val = formatNumber(val, true, true);
98
+ }
99
+ }
100
+ if (formatter && trigger === formatTrigger) {
101
+ val = formatter(val);
102
+ }
103
+ setValue(val);
104
+ const eventHandler = props[trigger];
105
+ if (eventHandler && typeof eventHandler === 'function') {
106
+ eventHandler(val);
107
+ }
108
+ forceUpdate();
109
+ };
110
+ const handleFocus = (event) => {
111
+ const val = event.target.value;
112
+ onFocus && onFocus(val);
113
+ setActive(true);
114
+ };
115
+ const handleInput = (value) => {
116
+ updateValue(value, 'onChange');
117
+ };
118
+ const handleBlur = (event) => {
119
+ const val = event.target.value;
120
+ updateValue(val, 'onBlur');
121
+ setTimeout(() => {
122
+ setActive(false);
123
+ }, 50);
124
+ };
125
+ const inputType = (type) => {
126
+ if (getEnv() === ENV_TYPE.WEB) {
127
+ if (type === 'digit') {
128
+ return 'text';
129
+ }
130
+ if (type === 'number') {
131
+ return 'tel';
132
+ }
133
+ }
134
+ else if (type === 'password') {
135
+ return 'text';
136
+ }
137
+ return type;
138
+ };
139
+ return (React.createElement(View, { className: `${inputClass()} ${className || ''}`, style: style, onClick: (e) => {
140
+ onClick && onClick(e);
141
+ } },
142
+ React.createElement(Input$1, { ...rest, name: name, className: "nut-input-native", ref: inputRef, style: { textAlign: align }, type: inputType(type), password: type === 'password', maxlength: maxLength, placeholder: placeholder || locale.placeholder, disabled: disabled || readOnly, value: value, focus: autoFocus, confirmType: confirmType, onBlur: (e) => {
143
+ handleBlur(e);
144
+ }, onFocus: (e) => {
145
+ handleFocus(e);
146
+ }, onInput: (e) => {
147
+ handleInput(e.currentTarget.value);
148
+ } }),
149
+ React.createElement(View, { style: {
150
+ display: clearable && !readOnly && active && value.length > 0
151
+ ? 'flex'
152
+ : 'none',
153
+ alignItems: 'center',
154
+ }, onClick: (e) => {
155
+ e.stopPropagation();
156
+ if (!disabled) {
157
+ setTimeout(() => {
158
+ setValue('');
159
+ onClear && onClear('');
160
+ }, 50);
161
+ }
162
+ } }, clearIcon || React.createElement(MaskClose, { className: "nut-input-clear" }))));
163
+ });
164
+ Input.defaultProps = defaultProps;
165
+ Input.displayName = 'NutInput';
166
+
167
+ export { Input as I };
@@ -2,7 +2,7 @@ import React, { useState, useEffect } from 'react';
2
2
  import classNames from 'classnames';
3
3
  import { c as cn } from './bem-350c1702.js';
4
4
  import { P as Popup } from './popup.taro-89cc342a.js';
5
- import { u as useConfig } from './configprovider.taro-43a3c646.js';
5
+ import { u as useConfig } from './configprovider.taro-ce34d482.js';
6
6
 
7
7
  const defaultProps = {
8
8
  confirmText: '',
@@ -1,100 +1,99 @@
1
1
  export { B as Button } from './button.taro-b50bc217.js';
2
2
  export { C as Cell } from './cell.taro-ea725a95.js';
3
- export { C as CellGroup } from './cellgroup.taro-660faffc.js';
4
- export { C as ConfigProvider } from './configprovider.taro-43a3c646.js';
5
- export { I as Image } from './image.taro-b897a058.js';
3
+ export { C as CellGroup } from './cellgroup.taro-e05ea802.js';
4
+ export { C as ConfigProvider } from './configprovider.taro-ce34d482.js';
5
+ export { I as Image } from './image.taro-3025e659.js';
6
6
  export { O as Overlay } from './overlay.taro-067b7202.js';
7
7
  export { C as Col } from './col.taro-4477c9f7.js';
8
8
  export { D as Divider } from './divider.taro-3993d7d5.js';
9
- export { G as Grid } from './grid.taro-10eb7716.js';
10
- export { G as GridItem } from './griditem.taro-fb15eeec.js';
9
+ export { G as Grid } from './grid.taro-883a9c35.js';
10
+ export { G as GridItem } from './griditem.taro-16c7055b.js';
11
11
  export { L as Layout } from './layout.taro-e4bf83cb.js';
12
12
  export { R as Row } from './row.taro-e929ec5c.js';
13
13
  export { S as Sticky } from './sticky.taro-a142a5f2.js';
14
14
  export { B as BackTop } from './backtop.taro-8ec80d02.js';
15
- export { E as Elevator } from './elevator.taro-360a831f.js';
16
- export { F as FixedNav } from './fixednav.taro-cca9a6df.js';
15
+ export { E as Elevator } from './elevator.taro-1a4e3356.js';
16
+ export { F as FixedNav } from './fixednav.taro-ddb21e87.js';
17
17
  export { N as NavBar } from './navbar.taro-92bab9c4.js';
18
18
  export { S as SideNavBar } from './sidenavbar.taro-f8ffb7dc.js';
19
19
  export { S as SideNavBarItem } from './sidenavbaritem.taro-6cb0821e.js';
20
20
  export { S as SubSideNavBar } from './subsidenavbar.taro-85c03291.js';
21
- export { T as Tabbar } from './tabbar.taro-eefd0f8e.js';
22
- export { T as TabbarItem } from './tabbaritem.taro-7a97e645.js';
21
+ export { T as Tabbar } from './tabbar.taro-48413fb8.js';
22
+ export { T as TabbarItem } from './tabbaritem.taro-5afa3562.js';
23
23
  export { T as TabPane } from './tabpane.taro-406cc0d3.js';
24
24
  export { T as Tabs } from './tabs.taro-d47ccfc5.js';
25
- export { A as Address } from './address.taro-67e32c33.js';
26
- export { C as Calendar } from './calendar.taro-b3ebdc35.js';
27
- export { C as CalendarItem } from './calendaritem.taro-ab1ec154.js';
25
+ export { A as Address } from './address.taro-cab0ea22.js';
26
+ export { C as Calendar } from './calendar.taro-2fc9b899.js';
27
+ export { C as CalendarItem } from './calendaritem.taro-2d4a8c34.js';
28
28
  export { C as Cascader } from './cascader.taro-467910b2.js';
29
- export { C as Checkbox, a as CheckboxGroup } from './checkbox.taro-ae460d3a.js';
30
- export { D as DatePicker } from './datepicker.taro-7d522ff8.js';
31
- export { F as Form } from './form.taro-7413d868.js';
29
+ export { C as Checkbox, a as CheckboxGroup } from './checkbox.taro-9d02f86c.js';
30
+ export { D as DatePicker } from './datepicker.taro-2e3e955b.js';
31
+ export { F as Form } from './form.taro-423b0f0a.js';
32
32
  export { F as FormItem } from './formitem.taro-b550d29c.js';
33
- export { I as Input } from './input.taro-f4e067f7.js';
33
+ export { I as Input } from './input.taro-06c1e4d5.js';
34
34
  export { I as InputNumber } from './inputnumber.taro-1f893d42.js';
35
35
  export { M as Menu } from './menu.taro-e5c68cb8.js';
36
36
  export { M as MenuItem } from './menuitem.taro-37c18382.js';
37
- export { N as NumberKeyboard } from './numberkeyboard.taro-10ab54d6.js';
38
- export { P as Picker } from './picker.taro-9f1bb6a4.js';
37
+ export { N as NumberKeyboard } from './numberkeyboard.taro-d9b1721b.js';
38
+ export { P as Picker } from './picker.taro-e16b4312.js';
39
39
  export { R as Radio, a as RadioGroup } from './radio.taro-36438449.js';
40
- export { R as Range } from './range.taro-432d20d7.js';
40
+ export { R as Range } from './range.taro-8953e8c3.js';
41
41
  export { R as Rate } from './rate.taro-895bb41c.js';
42
- export { S as SearchBar } from './searchbar.taro-4aa300df.js';
43
- export { S as ShortPassword } from './shortpassword.taro-99645f99.js';
44
- export { S as Signature } from './signature.taro-e5ede25a.js';
42
+ export { S as SearchBar } from './searchbar.taro-4467040f.js';
43
+ export { S as ShortPassword } from './shortpassword.taro-433b86a4.js';
44
+ export { S as Signature } from './signature.taro-a4d9b5c9.js';
45
45
  export { S as Switch } from './switch.taro-e82809f6.js';
46
- export { T as TextArea } from './textarea.taro-e256e741.js';
47
- export { U as Uploader } from './uploader.taro-716f9a50.js';
46
+ export { T as TextArea } from './textarea.taro-add72cf3.js';
47
+ export { U as Uploader } from './uploader.taro-c70d00de.js';
48
48
  export { A as ActionSheet } from './actionsheet.taro-12cf5a3e.js';
49
49
  export { B as Badge } from './badge.taro-e2169fbe.js';
50
- export { B as Dialog } from './dialog.taro-f9ca73a2.js';
50
+ export { B as Dialog } from './dialog.taro-eab19eab.js';
51
51
  export { D as Drag } from './drag.taro-347dfb84.js';
52
- export { E as Empty } from './empty.taro-f8585835.js';
53
- export { I as Infiniteloading } from './infiniteloading.taro-cce53c60.js';
52
+ export { E as Empty } from './empty.taro-26363c66.js';
53
+ export { I as Infiniteloading } from './infiniteloading.taro-721bca1f.js';
54
54
  export { N as NoticeBar } from './noticebar.taro-cbe93c9e.js';
55
55
  export { N as Notify } from './notify.taro-f1079218.js';
56
56
  export { P as Popover } from './popover.taro-84a55ff9.js';
57
- export { P as PullToRefresh } from './pulltorefresh.taro-37dadbc5.js';
58
- export { S as Skeleton } from './skeleton.taro-fabd423a.js';
59
- export { S as Swipe } from './swipe.taro-b18a73ff.js';
57
+ export { P as PullToRefresh } from './pulltorefresh.taro-016d0079.js';
58
+ export { S as Skeleton } from './skeleton.taro-8ec11af9.js';
59
+ export { S as Swipe } from './swipe.taro-0b8cc872.js';
60
60
  export { P as Popup } from './popup.taro-89cc342a.js';
61
61
  export { T as Toast } from './toast.taro-c509a870.js';
62
62
  export { A as Animate } from './animate.taro-485331bb.js';
63
63
  export { A as AnimatingNumbers } from './animatingnumbers.taro-f6eaffef.js';
64
- export { A as Audio } from './audio.taro-51eafc9d.js';
65
- export { A as Avatar } from './avatar.taro-a840f345.js';
66
- export { A as AvatarGroup } from './avatargroup-0eadb514.js';
67
- export { C as CircleProgress } from './circleprogress.taro-d8973ae9.js';
64
+ export { A as Audio } from './audio.taro-ff280f5e.js';
65
+ export { A as Avatar } from './avatar.taro-6e8f1f5c.js';
66
+ export { A as AvatarGroup } from './avatargroup-f4375806.js';
67
+ export { C as CircleProgress } from './circleprogress.taro-d4943109.js';
68
68
  export { C as Collapse } from './collapse.taro-89bcadf2.js';
69
69
  export { C as CollapseItem } from './collapseitem-0e228cec.js';
70
- export { C as CountDown } from './countdown.taro-c14b5c1f.js';
71
- export { E as Ellipsis } from './ellipsis.taro-79044d54.js';
70
+ export { C as CountDown } from './countdown.taro-3118ba23.js';
71
+ export { E as Ellipsis } from './ellipsis.taro-e1ac99a1.js';
72
72
  export { I as ImagePreview } from './imagepreview.taro-d511342c.js';
73
73
  export { I as Indicator } from './indicator.taro-bfb21d45.js';
74
- export { V as VirtualList } from './virtuallist.taro-0bd611cb.js';
75
- export { P as Pagination } from './pagination.taro-df441058.js';
74
+ export { V as VirtualList } from './virtuallist.taro-ba8e1f21.js';
75
+ export { P as Pagination } from './pagination.taro-94f9be5e.js';
76
76
  export { P as Price } from './price.taro-959d82f2.js';
77
77
  export { P as Progress } from './progress.taro-1a7ac8a4.js';
78
78
  export { S as Step } from './step.taro-7ea33a76.js';
79
79
  export { S as Steps } from './steps.taro-86753d36.js';
80
80
  export { S as Swiper } from './swiper.taro-c0e9a56b.js';
81
81
  export { S as SwiperItem } from './swiperitem-abab7606.js';
82
- export { T as Table } from './table.taro-eca757f3.js';
82
+ export { T as Table } from './table.taro-327b4248.js';
83
83
  export { T as Tag } from './tag.taro-846ee805.js';
84
84
  export { V as Video } from './video-1c6405b4.js';
85
85
  export { B as Barrage } from './barrage.taro-aa08da6c.js';
86
86
  export { C as Card } from './card.taro-0e849e94.js';
87
- export { T as TimeDetail } from './timedetail.taro-cae362b9.js';
88
- export { T as TimePannel } from './timepannel.taro-d6f4cf80.js';
89
- export { T as TimeSelect } from './timeselect.taro-804199f9.js';
87
+ export { T as TimeDetail } from './timedetail.taro-82a2900b.js';
88
+ export { T as TimePannel } from './timepannel.taro-0573bb65.js';
89
+ export { T as TimeSelect } from './timeselect.taro-29124a34.js';
90
90
  export { T as TrendArrow } from './trendarrow.taro-dd83ec94.js';
91
- export { W as WaterMark } from './watermark.taro-8966896a.js';
91
+ export { W as WaterMark } from './watermark.taro-168cdac5.js';
92
92
  import 'react';
93
93
  import 'classnames';
94
94
  import '@nutui/icons-react-taro';
95
95
  import './typings-d8491423.js';
96
96
  import 'lodash.kebabcase';
97
- import './zh-CN-b4f493ba.js';
98
97
  import '@tarojs/components';
99
98
  import './UserContext-0aac9a82.js';
100
99
  import '@tarojs/taro';
@@ -102,10 +101,9 @@ import './use-client-rect-1f8ed1fe.js';
102
101
  import './get-scroll-parent-b4a07e65.js';
103
102
  import './can-use-dom-3eeb5af4.js';
104
103
  import './offsetContext-c2a746fa.js';
104
+ import './use-props-value-ae7ee726.js';
105
105
  import './bem-350c1702.js';
106
106
  import '@bem-react/classname';
107
- import './use-props-value-ae7ee726.js';
108
- import './configprovider-9960f0fb.js';
109
107
  import 'react-transition-group';
110
108
  import './use-touch-db24bb5c.js';
111
109
  import './supports-passive-c85ef996.js';
@@ -113,6 +111,6 @@ import './index-5bcb0ff8.js';
113
111
  import '@use-gesture/react';
114
112
  import '@react-spring/web';
115
113
  import 'react-dom';
116
- import './AvatarContext-c96afdcc.js';
114
+ import './context-c96afdcc.js';
117
115
  import './UserContext-e402e1a6.js';
118
116
  import './UserContext-e8176108.js';
@@ -1,6 +1,6 @@
1
1
  import React, { useMemo } from 'react';
2
2
  import classNames from 'classnames';
3
- import { u as useConfig } from './configprovider.taro-43a3c646.js';
3
+ import { u as useConfig } from './configprovider.taro-ce34d482.js';
4
4
  import { u as usePropsValue } from './use-props-value-ae7ee726.js';
5
5
  import { C as ComponentDefaults } from './typings-d8491423.js';
6
6
 
@@ -4,7 +4,7 @@ import { P as Popup } from './popup.taro-89cc342a.js';
4
4
  import { u as useTouch } from './use-touch-db24bb5c.js';
5
5
  import { g as getRectByTaro } from './use-client-rect-1f8ed1fe.js';
6
6
  import { p as passiveSupported } from './supports-passive-c85ef996.js';
7
- import { u as useConfig } from './configprovider.taro-43a3c646.js';
7
+ import { u as useConfig } from './configprovider.taro-ce34d482.js';
8
8
  import { c as cn } from './bem-350c1702.js';
9
9
 
10
10
  const InternalPickerSlot = (props, ref) => {
@@ -1,7 +1,7 @@
1
1
  import React, { useState, useRef, useEffect } from 'react';
2
2
  import { useDrag } from '@use-gesture/react';
3
3
  import { useSpring, animated } from '@react-spring/web';
4
- import { u as useConfig } from './configprovider.taro-43a3c646.js';
4
+ import { u as useConfig } from './configprovider.taro-ce34d482.js';
5
5
  import { g as getScrollParent } from './get-scroll-parent-b4a07e65.js';
6
6
  import { p as passiveSupported } from './supports-passive-c85ef996.js';
7
7
 
@@ -2,7 +2,7 @@ import React, { useState, useRef, useEffect, useCallback } from 'react';
2
2
  import { u as useTouch } from './use-touch-db24bb5c.js';
3
3
  import { g as getRectByTaro } from './use-client-rect-1f8ed1fe.js';
4
4
  import { T as Toast } from './toast.taro-c509a870.js';
5
- import { u as useConfig } from './configprovider.taro-43a3c646.js';
5
+ import { u as useConfig } from './configprovider.taro-ce34d482.js';
6
6
 
7
7
  const defaultProps = {
8
8
  range: false,