@nutui/nutui-react 1.5.1 → 1.5.2-beta.0

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 (350) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/nutui.react.mjs +27 -22
  3. package/dist/nutui.react.umd.js +27 -22
  4. package/package.json +1 -1
  5. package/dist/esm/ActionSheet/style/index.js +0 -2
  6. package/dist/esm/ActionSheet.js +0 -92
  7. package/dist/esm/Address/style/index.js +0 -4
  8. package/dist/esm/Address.js +0 -622
  9. package/dist/esm/Animate/style/index.js +0 -2
  10. package/dist/esm/Animate.js +0 -55
  11. package/dist/esm/AnimatingNumbers/style/index.js +0 -3
  12. package/dist/esm/AnimatingNumbers.js +0 -127
  13. package/dist/esm/Audio/style/index.js +0 -4
  14. package/dist/esm/Audio.js +0 -266
  15. package/dist/esm/Avatar/style/index.js +0 -2
  16. package/dist/esm/Avatar.js +0 -132
  17. package/dist/esm/AvatarContext-15733596.js +0 -3
  18. package/dist/esm/AvatarGroup/style/index.js +0 -2
  19. package/dist/esm/AvatarGroup.js +0 -43
  20. package/dist/esm/BackTop/style/index.js +0 -2
  21. package/dist/esm/BackTop.js +0 -139
  22. package/dist/esm/Badge/style/index.js +0 -2
  23. package/dist/esm/Badge.js +0 -73
  24. package/dist/esm/Barrage/style/index.js +0 -2
  25. package/dist/esm/Barrage.js +0 -99
  26. package/dist/esm/Button/style/index.js +0 -2
  27. package/dist/esm/Button.js +0 -109
  28. package/dist/esm/Calendar/style/index.js +0 -2
  29. package/dist/esm/Calendar.js +0 -129
  30. package/dist/esm/CalendarItem/style/index.js +0 -2
  31. package/dist/esm/CalendarItem.js +0 -676
  32. package/dist/esm/Card/style/index.js +0 -4
  33. package/dist/esm/Card.js +0 -63
  34. package/dist/esm/Cascader/style/index.js +0 -3
  35. package/dist/esm/Cascader.js +0 -673
  36. package/dist/esm/Cell/style/index.js +0 -2
  37. package/dist/esm/Cell.js +0 -103
  38. package/dist/esm/CellGroup/style/index.js +0 -2
  39. package/dist/esm/CellGroup.js +0 -5
  40. package/dist/esm/Checkbox/style/index.js +0 -3
  41. package/dist/esm/Checkbox.js +0 -8
  42. package/dist/esm/CheckboxGroup/style/index.js +0 -2
  43. package/dist/esm/CheckboxGroup.js +0 -113
  44. package/dist/esm/CircleProgress/style/index.js +0 -2
  45. package/dist/esm/CircleProgress.js +0 -116
  46. package/dist/esm/Col/style/index.js +0 -2
  47. package/dist/esm/Col.js +0 -58
  48. package/dist/esm/Collapse/style/index.js +0 -2
  49. package/dist/esm/Collapse.js +0 -99
  50. package/dist/esm/CollapseItem/style/index.js +0 -2
  51. package/dist/esm/CollapseItem.js +0 -148
  52. package/dist/esm/ConfigProvider/style/index.js +0 -2
  53. package/dist/esm/ConfigProvider.js +0 -187
  54. package/dist/esm/CountDown/style/index.js +0 -2
  55. package/dist/esm/CountDown.js +0 -247
  56. package/dist/esm/DatePicker/style/index.js +0 -2
  57. package/dist/esm/DatePicker.js +0 -310
  58. package/dist/esm/Dialog/style/index.js +0 -3
  59. package/dist/esm/Dialog.js +0 -296
  60. package/dist/esm/Divider/style/index.js +0 -2
  61. package/dist/esm/Divider.js +0 -36
  62. package/dist/esm/Drag/style/index.js +0 -2
  63. package/dist/esm/Drag.js +0 -120
  64. package/dist/esm/Elevator/style/index.js +0 -2
  65. package/dist/esm/Elevator.js +0 -236
  66. package/dist/esm/Ellipsis/style/index.js +0 -2
  67. package/dist/esm/Ellipsis.js +0 -177
  68. package/dist/esm/Empty/style/index.js +0 -2
  69. package/dist/esm/Empty.js +0 -82
  70. package/dist/esm/FixedNav/style/index.js +0 -3
  71. package/dist/esm/FixedNav.js +0 -105
  72. package/dist/esm/Form/style/index.js +0 -2
  73. package/dist/esm/Form.js +0 -221
  74. package/dist/esm/FormItem/style/index.js +0 -2
  75. package/dist/esm/FormItem.js +0 -5
  76. package/dist/esm/Grid/style/index.js +0 -2
  77. package/dist/esm/Grid.js +0 -83
  78. package/dist/esm/GridItem/style/index.js +0 -2
  79. package/dist/esm/GridItem.js +0 -125
  80. package/dist/esm/Icon/style/index.js +0 -4
  81. package/dist/esm/Icon.js +0 -5
  82. package/dist/esm/Image/style/index.js +0 -2
  83. package/dist/esm/Image.js +0 -170
  84. package/dist/esm/ImagePreview/style/index.js +0 -4
  85. package/dist/esm/ImagePreview.js +0 -226
  86. package/dist/esm/Indicator/style/index.js +0 -2
  87. package/dist/esm/Indicator.js +0 -52
  88. package/dist/esm/Infiniteloading/style/index.js +0 -2
  89. package/dist/esm/Infiniteloading.js +0 -217
  90. package/dist/esm/Input/style/index.js +0 -2
  91. package/dist/esm/Input.js +0 -363
  92. package/dist/esm/InputNumber/style/index.js +0 -2
  93. package/dist/esm/InputNumber.js +0 -277
  94. package/dist/esm/Layout/style/index.js +0 -2
  95. package/dist/esm/Layout.js +0 -14
  96. package/dist/esm/Menu/style/index.js +0 -3
  97. package/dist/esm/Menu.js +0 -154
  98. package/dist/esm/MenuItem/style/index.js +0 -3
  99. package/dist/esm/MenuItem.js +0 -177
  100. package/dist/esm/NavBar/style/index.js +0 -2
  101. package/dist/esm/NavBar.js +0 -116
  102. package/dist/esm/NoticeBar/style/index.js +0 -2
  103. package/dist/esm/NoticeBar.js +0 -570
  104. package/dist/esm/Notify/style/index.js +0 -2
  105. package/dist/esm/Notify.js +0 -236
  106. package/dist/esm/NumberKeyboard/style/index.js +0 -2
  107. package/dist/esm/NumberKeyboard.js +0 -249
  108. package/dist/esm/Overlay/style/index.js +0 -2
  109. package/dist/esm/Overlay.js +0 -6
  110. package/dist/esm/Pagination/style/index.js +0 -2
  111. package/dist/esm/Pagination.js +0 -170
  112. package/dist/esm/Picker/style/index.js +0 -2
  113. package/dist/esm/Picker.js +0 -496
  114. package/dist/esm/Popover/style/index.js +0 -3
  115. package/dist/esm/Popover.js +0 -225
  116. package/dist/esm/Popup/style/index.js +0 -3
  117. package/dist/esm/Popup.js +0 -195
  118. package/dist/esm/Price/style/index.js +0 -2
  119. package/dist/esm/Price.js +0 -86
  120. package/dist/esm/Progress/style/index.js +0 -2
  121. package/dist/esm/Progress.js +0 -124
  122. package/dist/esm/PullToRefresh/style/index.js +0 -2
  123. package/dist/esm/PullToRefresh.js +0 -277
  124. package/dist/esm/Radio/style/index.js +0 -3
  125. package/dist/esm/Radio.js +0 -6
  126. package/dist/esm/RadioGroup/style/index.js +0 -2
  127. package/dist/esm/RadioGroup.js +0 -123
  128. package/dist/esm/Range/style/index.js +0 -2
  129. package/dist/esm/Range.js +0 -407
  130. package/dist/esm/Rate/style/index.js +0 -2
  131. package/dist/esm/Rate.js +0 -123
  132. package/dist/esm/Row/style/index.js +0 -2
  133. package/dist/esm/Row.js +0 -50
  134. package/dist/esm/SearchBar/style/index.js +0 -2
  135. package/dist/esm/SearchBar.js +0 -237
  136. package/dist/esm/ShortPassword/style/index.js +0 -3
  137. package/dist/esm/ShortPassword.js +0 -193
  138. package/dist/esm/SideNavBar/style/index.js +0 -2
  139. package/dist/esm/SideNavBar.js +0 -58
  140. package/dist/esm/SideNavBarItem/style/index.js +0 -2
  141. package/dist/esm/SideNavBarItem.js +0 -25
  142. package/dist/esm/Signature/style/index.js +0 -2
  143. package/dist/esm/Signature.js +0 -155
  144. package/dist/esm/Skeleton/style/index.js +0 -2
  145. package/dist/esm/Skeleton.js +0 -100
  146. package/dist/esm/Step/style/index.js +0 -2
  147. package/dist/esm/Step.js +0 -89
  148. package/dist/esm/Steps/style/index.js +0 -2
  149. package/dist/esm/Steps.js +0 -40
  150. package/dist/esm/Sticky/style/index.js +0 -2
  151. package/dist/esm/Sticky.js +0 -192
  152. package/dist/esm/SubSideNavBar/style/index.js +0 -2
  153. package/dist/esm/SubSideNavBar.js +0 -79
  154. package/dist/esm/Swipe/style/index.js +0 -2
  155. package/dist/esm/Swipe.js +0 -232
  156. package/dist/esm/Swiper/style/index.js +0 -2
  157. package/dist/esm/Swiper.js +0 -492
  158. package/dist/esm/SwiperItem/style/index.js +0 -2
  159. package/dist/esm/SwiperItem.js +0 -38
  160. package/dist/esm/Switch/style/index.js +0 -2
  161. package/dist/esm/Switch.js +0 -73
  162. package/dist/esm/TabPane/style/index.js +0 -2
  163. package/dist/esm/TabPane.js +0 -6
  164. package/dist/esm/Tabbar/style/index.js +0 -2
  165. package/dist/esm/Tabbar.js +0 -70
  166. package/dist/esm/TabbarItem/style/index.js +0 -2
  167. package/dist/esm/TabbarItem.js +0 -80
  168. package/dist/esm/Table/style/index.js +0 -2
  169. package/dist/esm/Table.js +0 -142
  170. package/dist/esm/Tabs/style/index.js +0 -4
  171. package/dist/esm/Tabs.js +0 -9
  172. package/dist/esm/Tag/style/index.js +0 -2
  173. package/dist/esm/Tag.js +0 -111
  174. package/dist/esm/TextArea/style/index.js +0 -2
  175. package/dist/esm/TextArea.js +0 -150
  176. package/dist/esm/TimeDetail/style/index.js +0 -2
  177. package/dist/esm/TimeDetail.js +0 -69
  178. package/dist/esm/TimePannel/style/index.js +0 -2
  179. package/dist/esm/TimePannel.js +0 -31
  180. package/dist/esm/TimeSelect/style/index.js +0 -4
  181. package/dist/esm/TimeSelect.js +0 -173
  182. package/dist/esm/Toast/style/index.js +0 -2
  183. package/dist/esm/Toast.js +0 -271
  184. package/dist/esm/TrendArrow/style/index.js +0 -2
  185. package/dist/esm/TrendArrow.js +0 -101
  186. package/dist/esm/Uploader/style/index.js +0 -4
  187. package/dist/esm/Uploader.js +0 -566
  188. package/dist/esm/UserContext-101ad4a4.js +0 -3
  189. package/dist/esm/UserContext-2629d479.js +0 -3
  190. package/dist/esm/UserContext-b33bcf21.js +0 -3
  191. package/dist/esm/Video/style/index.js +0 -2
  192. package/dist/esm/Video.js +0 -92
  193. package/dist/esm/VirtualList/style/index.js +0 -2
  194. package/dist/esm/VirtualList.js +0 -315
  195. package/dist/esm/WaterMark/style/index.js +0 -2
  196. package/dist/esm/WaterMark.js +0 -113
  197. package/dist/esm/bem-3b438e61.js +0 -8
  198. package/dist/esm/cellgroup-fcc72767.js +0 -34
  199. package/dist/esm/checkbox-44e13cd0.js +0 -137
  200. package/dist/esm/date-c7aad4c0.js +0 -97
  201. package/dist/esm/formitem-8a73a5fb.js +0 -157
  202. package/dist/esm/get-scroll-parent-5f85dee8.js +0 -24
  203. package/dist/esm/grid.context-2ee27d95.js +0 -6
  204. package/dist/esm/icon-4ef1581c.js +0 -70
  205. package/dist/esm/index-030b7245.js +0 -11
  206. package/dist/esm/nutui-react.es.js +0 -94
  207. package/dist/esm/offsetContext-3ab00d40.js +0 -16
  208. package/dist/esm/overlay-de6c79d5.js +0 -83
  209. package/dist/esm/radio-9f141e6b.js +0 -118
  210. package/dist/esm/render-bbebb760.js +0 -79
  211. package/dist/esm/tabpane-01075e6c.js +0 -29
  212. package/dist/esm/tabs-e1b4e4b1.js +0 -181
  213. package/dist/esm/typings-f27b58f4.js +0 -8
  214. package/dist/esm/useClientRect-56bb675b.js +0 -39
  215. package/dist/esm/useTouch-cf73a407.js +0 -99
  216. package/dist/locales/base.d.ts +0 -129
  217. package/dist/locales/base.js +0 -5
  218. package/dist/locales/en-US.d.ts +0 -3
  219. package/dist/locales/en-US.js +0 -135
  220. package/dist/locales/id-ID.d.ts +0 -3
  221. package/dist/locales/id-ID.js +0 -135
  222. package/dist/locales/zh-CN.d.ts +0 -3
  223. package/dist/locales/zh-CN.js +0 -137
  224. package/dist/locales/zh-TW.d.ts +0 -3
  225. package/dist/locales/zh-TW.js +0 -135
  226. package/dist/locales/zh-UG.d.ts +0 -3
  227. package/dist/locales/zh-UG.js +0 -135
  228. package/dist/packages/actionsheet/actionsheet.scss +0 -103
  229. package/dist/packages/address/address.scss +0 -243
  230. package/dist/packages/animate/animate.scss +0 -284
  231. package/dist/packages/animatingnumbers/animatingnumbers.scss +0 -0
  232. package/dist/packages/animatingnumbers/countup.scss +0 -45
  233. package/dist/packages/audio/audio.scss +0 -93
  234. package/dist/packages/avatar/avatar.scss +0 -58
  235. package/dist/packages/avatargroup/avatargroup.scss +0 -14
  236. package/dist/packages/backtop/backtop.scss +0 -29
  237. package/dist/packages/badge/badge.scss +0 -53
  238. package/dist/packages/barrage/barrage.scss +0 -60
  239. package/dist/packages/button/button.scss +0 -245
  240. package/dist/packages/calendar/calendar.scss +0 -265
  241. package/dist/packages/calendaritem/calendaritem.scss +0 -0
  242. package/dist/packages/card/card.scss +0 -83
  243. package/dist/packages/cascader/cascader.scss +0 -108
  244. package/dist/packages/cell/cell.scss +0 -107
  245. package/dist/packages/cellgroup/cellgroup.scss +0 -46
  246. package/dist/packages/checkbox/checkbox.scss +0 -49
  247. package/dist/packages/checkboxgroup/checkboxgroup.scss +0 -33
  248. package/dist/packages/circleprogress/circleprogress.scss +0 -33
  249. package/dist/packages/col/col.scss +0 -24
  250. package/dist/packages/collapse/collapse.scss +0 -0
  251. package/dist/packages/collapseitem/collapseitem.scss +0 -161
  252. package/dist/packages/configprovider/configprovider.scss +0 -0
  253. package/dist/packages/countdown/countdown.scss +0 -3
  254. package/dist/packages/datepicker/datepicker.scss +0 -0
  255. package/dist/packages/dialog/dialog.scss +0 -135
  256. package/dist/packages/divider/divider.scss +0 -73
  257. package/dist/packages/drag/drag.scss +0 -10
  258. package/dist/packages/elevator/elevator.scss +0 -124
  259. package/dist/packages/ellipsis/ellipsis.scss +0 -17
  260. package/dist/packages/empty/empty.scss +0 -42
  261. package/dist/packages/fixednav/fixednav.scss +0 -141
  262. package/dist/packages/form/form.scss +0 -31
  263. package/dist/packages/formitem/formitem.scss +0 -100
  264. package/dist/packages/grid/grid.scss +0 -10
  265. package/dist/packages/griditem/griditem.scss +0 -108
  266. package/dist/packages/icon/icon.scss +0 -132
  267. package/dist/packages/image/image.scss +0 -53
  268. package/dist/packages/imagepreview/imagepreview.scss +0 -51
  269. package/dist/packages/indicator/indicator.scss +0 -70
  270. package/dist/packages/infiniteloading/infiniteloading.scss +0 -69
  271. package/dist/packages/input/input.scss +0 -203
  272. package/dist/packages/inputnumber/inputnumber.scss +0 -79
  273. package/dist/packages/layout/layout.scss +0 -2
  274. package/dist/packages/menu/menu.scss +0 -75
  275. package/dist/packages/menuitem/menuitem.scss +0 -120
  276. package/dist/packages/navbar/navbar.scss +0 -185
  277. package/dist/packages/noticebar/noticebar.scss +0 -156
  278. package/dist/packages/notify/notify.scss +0 -93
  279. package/dist/packages/numberkeyboard/numberkeyboard.scss +0 -147
  280. package/dist/packages/overlay/overlay.scss +0 -75
  281. package/dist/packages/pagination/pagination.scss +0 -81
  282. package/dist/packages/picker/picker.scss +0 -225
  283. package/dist/packages/popover/popover.scss +0 -288
  284. package/dist/packages/popup/popup.scss +0 -201
  285. package/dist/packages/price/price.scss +0 -37
  286. package/dist/packages/progress/progress.scss +0 -114
  287. package/dist/packages/pulltorefresh/pulltorefresh.scss +0 -26
  288. package/dist/packages/radio/radio.scss +0 -84
  289. package/dist/packages/radiogroup/radiogroup.scss +0 -86
  290. package/dist/packages/range/range.scss +0 -224
  291. package/dist/packages/rate/rate.scss +0 -36
  292. package/dist/packages/row/row.scss +0 -83
  293. package/dist/packages/searchbar/searchbar.scss +0 -146
  294. package/dist/packages/shortpassword/shortpassword.scss +0 -203
  295. package/dist/packages/sidenavbar/sidenavbar.scss +0 -100
  296. package/dist/packages/sidenavbaritem/sidenavbaritem.scss +0 -25
  297. package/dist/packages/signature/signature.scss +0 -39
  298. package/dist/packages/skeleton/skeleton.scss +0 -70
  299. package/dist/packages/step/step.scss +0 -274
  300. package/dist/packages/steps/steps.scss +0 -7
  301. package/dist/packages/sticky/sticky.scss +0 -3
  302. package/dist/packages/subsidenavbar/subsidenavbar.scss +0 -35
  303. package/dist/packages/swipe/swipe.scss +0 -33
  304. package/dist/packages/swiper/swiper.scss +0 -45
  305. package/dist/packages/swiperitem/swiperitem.scss +0 -3
  306. package/dist/packages/switch/switch.scss +0 -87
  307. package/dist/packages/tabbar/tabbar.scss +0 -46
  308. package/dist/packages/tabbaritem/tabbaritem.scss +0 -97
  309. package/dist/packages/table/table.scss +0 -152
  310. package/dist/packages/tabpane/tabpane.scss +0 -23
  311. package/dist/packages/tabs/tabs.scss +0 -284
  312. package/dist/packages/tag/tag.scss +0 -67
  313. package/dist/packages/textarea/textarea.scss +0 -60
  314. package/dist/packages/timedetail/timedetail.scss +0 -45
  315. package/dist/packages/timepannel/timepannel.scss +0 -17
  316. package/dist/packages/timeselect/timeselect.scss +0 -73
  317. package/dist/packages/toast/toast.scss +0 -98
  318. package/dist/packages/trendarrow/trendarrow.scss +0 -17
  319. package/dist/packages/uploader/uploader.scss +0 -237
  320. package/dist/packages/video/video.scss +0 -18
  321. package/dist/packages/virtuallist/virtuallist.scss +0 -87
  322. package/dist/packages/watermark/watermark.scss +0 -13
  323. package/dist/style.css +0 -1
  324. package/dist/style.mjs +0 -9
  325. package/dist/styles/animation/drop.scss +0 -24
  326. package/dist/styles/animation/ease.scss +0 -23
  327. package/dist/styles/animation/fade.scss +0 -20
  328. package/dist/styles/animation/icon.scss +0 -245
  329. package/dist/styles/animation/index.scss +0 -7
  330. package/dist/styles/animation/rotate.scss +0 -10
  331. package/dist/styles/animation/zoom.scss +0 -26
  332. package/dist/styles/font/config.json +0 -175
  333. package/dist/styles/font/demo.css +0 -539
  334. package/dist/styles/font/demo_index.html +0 -3063
  335. package/dist/styles/font/iconfont.css +0 -515
  336. package/dist/styles/font/iconfont.eot +0 -0
  337. package/dist/styles/font/iconfont.js +0 -68
  338. package/dist/styles/font/iconfont.json +0 -884
  339. package/dist/styles/font/iconfont.svg +0 -356
  340. package/dist/styles/font/iconfont.ttf +0 -0
  341. package/dist/styles/font/iconfont.woff +0 -0
  342. package/dist/styles/font/iconfont.woff2 +0 -0
  343. package/dist/styles/mixins/index.scss +0 -2
  344. package/dist/styles/mixins/make-animation.scss +0 -24
  345. package/dist/styles/mixins/text-ellipsis.scss +0 -20
  346. package/dist/styles/theme-dark.scss +0 -26
  347. package/dist/styles/theme-default.scss +0 -40
  348. package/dist/styles/themes/default.scss +0 -97
  349. package/dist/styles/variables.scss +0 -2610
  350. package/dist/types/index.d.ts +0 -2198
@@ -1,492 +0,0 @@
1
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
- import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
- import _typeof from "@babel/runtime/helpers/typeof";
5
- var _excluded = ["children", "direction", "className", "pageContent", "onChange", "initPage", "paginationColor", "paginationVisible", "touchable", "isPreventDefault", "isStopPropagation", "autoPlay", "isCenter", "paginationBgColor"];
6
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
7
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
8
- import React__default, { useRef, useState, useMemo, useEffect } from 'react';
9
- import classNames from 'classnames';
10
- import { D as DataContext } from './UserContext-2629d479.js';
11
- import { c as cn } from './bem-3b438e61.js';
12
- import { g as getRect } from './useClientRect-56bb675b.js';
13
- import '@bem-react/classname';
14
- var defaultProps = {
15
- width: (typeof window === "undefined" ? "undefined" : _typeof(window)) === 'object' ? window.innerWidth : 375,
16
- height: 0,
17
- duration: 500,
18
- initPage: 0,
19
- autoPlay: 0,
20
- direction: 'horizontal',
21
- paginationColor: '#fff',
22
- paginationBgColor: '#ddd',
23
- paginationVisible: false,
24
- loop: true,
25
- touchable: true,
26
- isPreventDefault: true,
27
- isStopPropagation: true,
28
- isCenter: false,
29
- className: ''
30
- };
31
- var DISTANCE = 5;
32
- var Swiper = React__default.forwardRef(function (props, ref) {
33
- var _classNames, _classNames2;
34
- var propSwiper = _objectSpread(_objectSpread({}, defaultProps), props);
35
- var children = propSwiper.children,
36
- direction = propSwiper.direction,
37
- className = propSwiper.className,
38
- pageContent = propSwiper.pageContent,
39
- onChange = propSwiper.onChange,
40
- initPage = propSwiper.initPage,
41
- paginationColor = propSwiper.paginationColor,
42
- paginationVisible = propSwiper.paginationVisible,
43
- touchable = propSwiper.touchable,
44
- isPreventDefault = propSwiper.isPreventDefault,
45
- isStopPropagation = propSwiper.isStopPropagation,
46
- autoPlay = propSwiper.autoPlay,
47
- isCenter = propSwiper.isCenter,
48
- paginationBgColor = propSwiper.paginationBgColor,
49
- rest = _objectWithoutProperties(propSwiper, _excluded);
50
- var container = useRef(null);
51
- var innerRef = useRef(null);
52
- var _swiper = useRef({
53
- moving: false,
54
- autoplayTimer: null,
55
- width: 0,
56
- height: 0,
57
- offset: 0,
58
- size: 0
59
- });
60
- var isVertical = direction === 'vertical';
61
- var _useState = useState(null),
62
- _useState2 = _slicedToArray(_useState, 2),
63
- rect = _useState2[0],
64
- setRect = _useState2[1];
65
- // eslint-disable-next-line prefer-const
66
- var _useState3 = useState(0),
67
- _useState4 = _slicedToArray(_useState3, 2),
68
- active = _useState4[0],
69
- setActive = _useState4[1];
70
- var _useState5 = useState(0),
71
- _useState6 = _slicedToArray(_useState5, 2),
72
- width = _useState6[0],
73
- setWidth = _useState6[1];
74
- var _useState7 = useState(0),
75
- _useState8 = _slicedToArray(_useState7, 2),
76
- height = _useState8[0],
77
- setHeight = _useState8[1];
78
- var _useState9 = useState(0),
79
- _useState10 = _slicedToArray(_useState9, 2),
80
- offset = _useState10[0],
81
- setOffset = _useState10[1];
82
- var _useState11 = useState([]),
83
- _useState12 = _slicedToArray(_useState11, 2),
84
- childOffset = _useState12[0],
85
- setChildOffset = _useState12[1];
86
- var _useState13 = useState(false),
87
- _useState14 = _slicedToArray(_useState13, 2),
88
- ready = _useState14[0],
89
- setReady = _useState14[1];
90
- var size = isVertical ? height : width;
91
- var _useState15 = useState({
92
- startX: 0,
93
- startY: 0,
94
- deltaX: 0,
95
- deltaY: 0,
96
- offsetX: 0,
97
- offsetY: 0,
98
- stateDirection: '',
99
- delta: 0,
100
- touchTime: 0
101
- }),
102
- _useState16 = _slicedToArray(_useState15, 2),
103
- touch = _useState16[0],
104
- setTouch = _useState16[1];
105
- var _useMemo = useMemo(function () {
106
- var childCount = 0;
107
- var childs = React__default.Children.map(props.children, function (child) {
108
- if (!React__default.isValidElement(child)) return null;
109
- childCount++;
110
- return child;
111
- });
112
- return {
113
- childs: childs,
114
- childCount: childCount
115
- };
116
- }, [props.children]),
117
- childs = _useMemo.childs,
118
- childCount = _useMemo.childCount;
119
- var trackSize = childCount * Number(size);
120
- // 父组件参数传入子组件item
121
- var parent = {
122
- propSwiper: propSwiper,
123
- size: size
124
- };
125
- var minOffset = function () {
126
- if (rect) {
127
- var base = isVertical ? rect.height : rect.width;
128
- return base - Number(size) * childCount;
129
- }
130
- return 0;
131
- }();
132
- // 清除定时器
133
- var stopAutoPlay = function stopAutoPlay() {
134
- clearTimeout(_swiper.current.autoplayTimer);
135
- _swiper.current.autoplayTimer = null;
136
- };
137
- // 定时轮播
138
- var autoplay = function autoplay() {
139
- if (propSwiper.autoPlay <= 0 || childCount <= 1) return;
140
- stopAutoPlay();
141
- _swiper.current.autoplayTimer = setTimeout(function () {
142
- next();
143
- autoplay();
144
- }, Number(propSwiper.autoPlay));
145
- };
146
- // 重置首尾位置信息
147
- var resettPosition = function resettPosition() {
148
- _swiper.current.moving = true;
149
- if (active <= -1) {
150
- move({
151
- pace: childCount
152
- });
153
- }
154
- if (active >= childCount) {
155
- move({
156
- pace: -childCount
157
- });
158
- }
159
- };
160
- // 上一页
161
- var prev = function prev() {
162
- resettPosition();
163
- touchReset();
164
- requestFrame(function () {
165
- requestFrame(function () {
166
- _swiper.current.moving = false;
167
- move({
168
- pace: -1,
169
- isEmit: true
170
- });
171
- });
172
- });
173
- };
174
- // 下一页
175
- var next = function next() {
176
- resettPosition();
177
- touchReset();
178
- requestFrame(function () {
179
- requestFrame(function () {
180
- _swiper.current.moving = false;
181
- move({
182
- pace: 1,
183
- isEmit: true
184
- });
185
- });
186
- });
187
- };
188
- // 前往指定页
189
- var to = function to(index) {
190
- resettPosition();
191
- touchReset();
192
- requestFrame(function () {
193
- requestFrame(function () {
194
- _swiper.current.moving = false;
195
- var targetIndex;
196
- if (props.loop && childCount === index) {
197
- targetIndex = active === 0 ? 0 : index;
198
- } else {
199
- targetIndex = index % childCount;
200
- }
201
- move({
202
- pace: targetIndex - active,
203
- isEmit: true
204
- });
205
- });
206
- });
207
- };
208
- var resize = function resize() {
209
- init(active);
210
- };
211
- // 切换方法
212
- var move = function move(_ref) {
213
- var _ref$pace = _ref.pace,
214
- pace = _ref$pace === void 0 ? 0 : _ref$pace,
215
- _ref$offset = _ref.offset,
216
- offset = _ref$offset === void 0 ? 0 : _ref$offset,
217
- _ref$isEmit = _ref.isEmit,
218
- isEmit = _ref$isEmit === void 0 ? false : _ref$isEmit,
219
- _ref$movingStatus = _ref.movingStatus,
220
- movingStatus = _ref$movingStatus === void 0 ? false : _ref$movingStatus;
221
- if (childCount <= 1) return;
222
- var targetActive = getActive(pace);
223
- // 父级容器偏移量
224
- var targetOffset = getOffset(targetActive, offset);
225
- // 如果循环,调整开头结尾图片位置
226
- if (props.loop) {
227
- if (Array.isArray(children) && children[0] && targetOffset !== minOffset) {
228
- var rightBound = targetOffset < minOffset;
229
- childOffset[0] = rightBound ? trackSize : 0;
230
- }
231
- if (Array.isArray(children) && children[childCount - 1] && targetOffset !== 0) {
232
- var leftBound = targetOffset > 0;
233
- childOffset[childCount - 1] = leftBound ? -trackSize : 0;
234
- }
235
- setChildOffset(childOffset);
236
- }
237
- if (isEmit && active !== targetActive) {
238
- props.onChange && props.onChange((targetActive + childCount) % childCount);
239
- }
240
- active = targetActive;
241
- setActive(targetActive);
242
- setOffset(targetOffset);
243
- getStyle(targetOffset);
244
- };
245
- // 确定当前active 元素
246
- var getActive = function getActive(pace) {
247
- if (pace) {
248
- var _active = active + pace;
249
- if (props.loop) {
250
- return range(_active, -1, childCount);
251
- }
252
- return range(_active, 0, childCount - 1);
253
- }
254
- return active;
255
- };
256
- // 计算位移
257
- var getOffset = function getOffset(active) {
258
- var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
259
- var currentPosition = active * Number(size);
260
- if (!props.loop) {
261
- currentPosition = Math.min(currentPosition, -minOffset);
262
- }
263
- var targetOffset = offset - currentPosition;
264
- if (!props.loop) {
265
- targetOffset = range(targetOffset, minOffset, 0);
266
- }
267
- return targetOffset;
268
- };
269
- // 浏览器 帧 事件
270
- var requestFrame = function requestFrame(fn) {
271
- window.requestAnimationFrame.call(window, fn);
272
- };
273
- // 取值 方法
274
- var range = function range(num, min, max) {
275
- return Math.min(Math.max(num, min), max);
276
- };
277
- var getDirection = function getDirection(x, y) {
278
- if (x > y && x > DISTANCE) return 'horizontal';
279
- if (y > x && y > DISTANCE) return 'vertical';
280
- return '';
281
- };
282
- // 重置 全部位移信息
283
- var touchReset = function touchReset() {
284
- touch.startX = 0;
285
- touch.startY = 0;
286
- touch.deltaX = 0;
287
- touch.deltaY = 0;
288
- touch.offsetX = 0;
289
- touch.offsetY = 0;
290
- touch.delta = 0;
291
- touch.stateDirection = '';
292
- touch.touchTime = 0;
293
- };
294
- // 触摸事件开始
295
- var touchStart = function touchStart(e) {
296
- touchReset();
297
- touch.startX = e.touches[0].clientX;
298
- touch.startY = e.touches[0].clientY;
299
- };
300
- // 触摸事件移动
301
- var touchMove = function touchMove(e) {
302
- touch.deltaX = e.touches[0].clientX - touch.startX;
303
- touch.deltaY = e.touches[0].clientY - touch.startY;
304
- touch.offsetX = Math.abs(touch.deltaX);
305
- touch.offsetY = Math.abs(touch.deltaY);
306
- touch.delta = isVertical ? touch.deltaY : touch.deltaX;
307
- if (!touch.stateDirection) {
308
- touch.stateDirection = getDirection(touch.offsetX, touch.offsetY);
309
- }
310
- };
311
- var b = cn('swiper');
312
- var classes = classNames(b(''));
313
- var contentClass = classNames((_classNames = {}, _defineProperty(_classNames, "".concat(b('inner')), true), _defineProperty(_classNames, "".concat(b('vertical')), isVertical), _classNames));
314
- var getStyle = function getStyle() {
315
- var moveOffset = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : offset;
316
- var target = innerRef.current;
317
- var _offset = 0;
318
- if (!isCenter) {
319
- _offset = moveOffset;
320
- } else {
321
- var _size = isVertical ? height : width;
322
- var val = isVertical ? rect.height - _size : rect.width - _size;
323
- _offset = moveOffset + (active === childCount - 1 && !props.loop ? -val / 2 : val / 2);
324
- }
325
- target.style.transitionDuration = "".concat(_swiper.current.moving ? 0 : props.duration, "ms");
326
- target.style[isVertical ? 'height' : 'width'] = "".concat(Number(size) * childCount, "px");
327
- target.style[isVertical ? 'width' : 'height'] = "".concat(isVertical ? width : height, "px");
328
- target.style.transform = "translate3D".concat(!isVertical ? "(".concat(_offset, "px,0,0)") : "(0,".concat(_offset, "px,0)"));
329
- };
330
- var onTouchStart = function onTouchStart(e) {
331
- if (props.isPreventDefault) e.preventDefault();
332
- if (props.isStopPropagation) e.stopPropagation();
333
- if (!props.touchable) return;
334
- touchStart(e);
335
- touch.touchTime = Date.now();
336
- stopAutoPlay();
337
- resettPosition();
338
- };
339
- var onTouchMove = function onTouchMove(e) {
340
- if (props.touchable && _swiper.current.moving) {
341
- touchMove(e);
342
- if (touch.stateDirection === props.direction) {
343
- move({
344
- offset: touch.delta
345
- });
346
- }
347
- }
348
- };
349
- var onTouchEnd = function onTouchEnd(e) {
350
- if (!props.touchable || !_swiper.current.moving) return;
351
- var speed = touch.delta / (Date.now() - touch.touchTime);
352
- var isShouldMove = Math.abs(speed) > 0.3 || Math.abs(touch.delta) > +(size / 2).toFixed(2);
353
- var pace = 0;
354
- _swiper.current.moving = false;
355
- if (isShouldMove && touch.stateDirection === props.direction) {
356
- var _offset2 = isVertical ? touch.offsetY : touch.offsetX;
357
- if (props.loop) {
358
- if (_offset2 > 0) {
359
- pace = touch.delta > 0 ? -1 : 1;
360
- } else {
361
- pace = 0;
362
- }
363
- } else {
364
- pace = -Math[touch.delta > 0 ? 'ceil' : 'floor'](touch.delta / size);
365
- }
366
- move({
367
- pace: pace,
368
- isEmit: true
369
- });
370
- } else if (touch.delta) {
371
- move({
372
- pace: 0
373
- });
374
- } else {
375
- getStyle();
376
- }
377
- autoplay();
378
- };
379
- useEffect(function () {
380
- _swiper.current.activePagination = (active + childCount) % childCount;
381
- }, [active]);
382
- var init = function init() {
383
- var active = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : +propSwiper.initPage;
384
- var rect = getRect(container === null || container === void 0 ? void 0 : container.current);
385
- var _active = Math.max(Math.min(childCount - 1, active), 0);
386
- var _width = propSwiper.width ? +propSwiper.width : rect.width;
387
- var _height = propSwiper.height ? +propSwiper.height : rect.height;
388
- size = isVertical ? _height : _width;
389
- trackSize = childCount * Number(size);
390
- var targetOffset = getOffset(_active);
391
- _swiper.current.moving = true;
392
- if (ready) {
393
- _swiper.current.moving = false;
394
- }
395
- setRect(rect);
396
- setActive(_active);
397
- setWidth(_width);
398
- setHeight(_height);
399
- setOffset(targetOffset);
400
- setReady(true);
401
- };
402
- useEffect(function () {
403
- if (ready) {
404
- getStyle();
405
- }
406
- }, [isVertical, width, height, offset, ready]);
407
- useEffect(function () {
408
- if (ready) {
409
- stopAutoPlay();
410
- autoplay();
411
- }
412
- return function () {
413
- setReady(false);
414
- };
415
- }, [ready]);
416
- useEffect(function () {
417
- stopAutoPlay();
418
- autoplay();
419
- }, [children]);
420
- useEffect(function () {
421
- init();
422
- }, [propSwiper.initPage]);
423
- useEffect(function () {
424
- var target = container.current;
425
- target.addEventListener('touchstart', onTouchStart, false);
426
- target.addEventListener('touchmove', onTouchMove, false);
427
- target.addEventListener('touchend', onTouchEnd, false);
428
- return function () {
429
- target.removeEventListener('touchstart', onTouchStart, false);
430
- target.removeEventListener('touchmove', onTouchMove, false);
431
- target.removeEventListener('touchend', onTouchEnd, false);
432
- };
433
- });
434
- useEffect(function () {
435
- return function () {
436
- stopAutoPlay();
437
- };
438
- }, []);
439
- var itemStyle = function itemStyle(index) {
440
- var style = {};
441
- var _direction = propSwiper.direction || direction;
442
- var _size = size;
443
- if (_size) {
444
- style[_direction === 'horizontal' ? 'width' : 'height'] = "".concat(_size, "px");
445
- }
446
- var offset = childOffset[index];
447
- if (offset) {
448
- style.transform = "translate3D".concat(_direction === 'horizontal' ? "(".concat(offset, "px,0,0)") : "(0,".concat(offset, "px,0)"));
449
- }
450
- return style;
451
- };
452
- React__default.useImperativeHandle(ref, function () {
453
- return {
454
- to: to,
455
- next: next,
456
- prev: prev,
457
- resize: resize
458
- };
459
- });
460
- return React__default.createElement(DataContext.Provider, {
461
- value: parent
462
- }, React__default.createElement("div", _objectSpread({
463
- className: "".concat(classes, " ").concat(className),
464
- ref: container
465
- }, rest), React__default.createElement("div", {
466
- className: contentClass,
467
- ref: innerRef
468
- }, React__default.Children.map(childs, function (child, index) {
469
- return React__default.createElement("div", {
470
- className: b('item-wrapper'),
471
- style: itemStyle(index),
472
- key: index
473
- }, child);
474
- })), propSwiper.paginationVisible && !('pageContent' in propSwiper) ? React__default.createElement("div", {
475
- className: classNames((_classNames2 = {}, _defineProperty(_classNames2, "".concat(b('pagination')), true), _defineProperty(_classNames2, "".concat(b('pagination-vertical')), isVertical), _classNames2))
476
- }, React__default.Children.map(childs, function (item, index) {
477
- return React__default.createElement("i", {
478
- style: (active + childCount) % childCount === index ? {
479
- backgroundColor: propSwiper.paginationColor
480
- } : {
481
- backgroundColor: propSwiper.paginationBgColor
482
- },
483
- className: classNames({
484
- active: (active + childCount) % childCount === index
485
- }),
486
- key: index
487
- });
488
- })) : React__default.createElement("div", null, pageContent)));
489
- });
490
- Swiper.defaultProps = defaultProps;
491
- Swiper.displayName = 'NutSwiper';
492
- export { Swiper as default };
@@ -1,2 +0,0 @@
1
-
2
- import '../../../packages/swiperitem/swiperitem.scss'
@@ -1,38 +0,0 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
4
- import React__default, { useContext } from 'react';
5
- import classNames from 'classnames';
6
- import { D as DataContext } from './UserContext-2629d479.js';
7
- import { c as cn } from './bem-3b438e61.js';
8
- import '@bem-react/classname';
9
- var defaultProps = {
10
- direction: 'horizontal'
11
- };
12
- var SwiperItem = React__default.forwardRef(function (props, ref) {
13
- var _props = _objectSpread(_objectSpread({}, defaultProps), props);
14
- var className = _props.className,
15
- style = _props.style,
16
- children = _props.children,
17
- direction = _props.direction,
18
- size = _props.size;
19
- var parent = useContext(DataContext);
20
- var b = cn('swiper-item');
21
- var classes = classNames(b(''), className);
22
- var getStyle = function getStyle() {
23
- var style = {};
24
- var _direction = (parent === null || parent === void 0 ? void 0 : parent.propSwiper.direction) || direction;
25
- var _size = (parent === null || parent === void 0 ? void 0 : parent.size) || size;
26
- if (_size) {
27
- style[_direction === 'horizontal' ? 'width' : 'height'] = "".concat(_size, "px");
28
- }
29
- return style;
30
- };
31
- return React__default.createElement("div", {
32
- className: classes,
33
- style: _objectSpread(_objectSpread({}, style), getStyle())
34
- }, children);
35
- });
36
- SwiperItem.defaultProps = defaultProps;
37
- SwiperItem.displayName = 'NutSwiperItem';
38
- export { SwiperItem as default };
@@ -1,2 +0,0 @@
1
-
2
- import '../../../packages/switch/switch.scss'
@@ -1,73 +0,0 @@
1
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
4
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
5
- import React__default, { useState, useEffect } from 'react';
6
- import { c as cn } from './bem-3b438e61.js';
7
- import { C as ComponentDefaults } from './typings-f27b58f4.js';
8
- import '@bem-react/classname';
9
- var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
10
- isAsync: false,
11
- checked: false,
12
- disable: false,
13
- activeColor: '',
14
- inactiveColor: '',
15
- activeText: '',
16
- inactiveText: '',
17
- className: ''
18
- });
19
- var Switch = function Switch(props) {
20
- var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
21
- isAsync = _defaultProps$props.isAsync,
22
- checked = _defaultProps$props.checked,
23
- disable = _defaultProps$props.disable,
24
- activeColor = _defaultProps$props.activeColor,
25
- inactiveColor = _defaultProps$props.inactiveColor,
26
- activeText = _defaultProps$props.activeText,
27
- inactiveText = _defaultProps$props.inactiveText,
28
- onChange = _defaultProps$props.onChange,
29
- className = _defaultProps$props.className,
30
- style = _defaultProps$props.style;
31
- var _useState = useState(false),
32
- _useState2 = _slicedToArray(_useState, 2),
33
- value = _useState2[0],
34
- setValue = _useState2[1];
35
- var b = cn('switch');
36
- useEffect(function () {
37
- setValue(checked);
38
- }, [checked]);
39
- var classes = function classes() {
40
- return "".concat(b(), " ").concat(value ? 'switch-open' : 'switch-close', " ").concat(disable ? "".concat(b(), "-disable") : '', " ", "".concat(b(), "-base"), " ").concat(className);
41
- };
42
- var styles = function styles() {
43
- var myStyle = _objectSpread({
44
- backgroundColor: value ? activeColor : inactiveColor
45
- }, style || {});
46
- return myStyle;
47
- };
48
- var _onClick = function onClick(event) {
49
- if (disable) return;
50
- if (!isAsync) {
51
- setValue(!value);
52
- }
53
- onChange && onChange(!value, event);
54
- };
55
- return React__default.createElement("div", {
56
- className: classes(),
57
- onClick: function onClick(e) {
58
- return _onClick(e);
59
- },
60
- style: styles()
61
- }, React__default.createElement("div", {
62
- className: "switch-button"
63
- }, !value && React__default.createElement("div", {
64
- className: "close-line"
65
- }), activeText && React__default.createElement(React__default.Fragment, null, value ? React__default.createElement("div", {
66
- className: "".concat(b('label'), " open")
67
- }, activeText) : React__default.createElement("div", {
68
- className: "".concat(b('label'), " close")
69
- }, inactiveText))));
70
- };
71
- Switch.defaultProps = defaultProps;
72
- Switch.displayName = 'NutSwitch';
73
- export { Switch as default };
@@ -1,2 +0,0 @@
1
-
2
- import '../../../packages/tabpane/tabpane.scss'
@@ -1,6 +0,0 @@
1
- import { T as TabPane } from './tabpane-01075e6c.js';
2
- import 'react';
3
- import 'classnames';
4
- import './bem-3b438e61.js';
5
- import '@bem-react/classname';
6
- export { TabPane as default };
@@ -1,2 +0,0 @@
1
-
2
- import '../../../packages/tabbar/tabbar.scss'