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

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 (323) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/esm/ActionSheet.js +15 -16
  3. package/dist/esm/Address.js +19 -20
  4. package/dist/esm/Animate.js +7 -8
  5. package/dist/esm/AnimatingNumbers.js +8 -9
  6. package/dist/esm/Audio.js +17 -19
  7. package/dist/esm/Avatar.js +11 -13
  8. package/dist/esm/AvatarGroup.js +8 -9
  9. package/dist/esm/BackTop.js +9 -10
  10. package/dist/esm/Badge.js +7 -8
  11. package/dist/esm/Barrage.js +9 -10
  12. package/dist/esm/Button.js +8 -9
  13. package/dist/esm/Calendar.js +18 -20
  14. package/dist/esm/CalendarItem.js +11 -13
  15. package/dist/esm/Card.js +12 -13
  16. package/dist/esm/Cascader.js +16 -19
  17. package/dist/esm/Cell.js +7 -8
  18. package/dist/esm/CellGroup.js +7 -8
  19. package/dist/esm/Checkbox.js +9 -10
  20. package/dist/esm/CheckboxGroup.js +9 -10
  21. package/dist/esm/CircleProgress.js +8 -9
  22. package/dist/esm/Col.js +8 -9
  23. package/dist/esm/Collapse.js +8 -9
  24. package/dist/esm/CollapseItem.js +7 -8
  25. package/dist/esm/ConfigProvider.js +9 -8
  26. package/dist/esm/CountDown.js +8 -10
  27. package/dist/esm/DatePicker.js +21 -23
  28. package/dist/esm/Dialog.js +13 -15
  29. package/dist/esm/Divider.js +7 -8
  30. package/dist/esm/Drag.js +7 -8
  31. package/dist/esm/Elevator.js +9 -10
  32. package/dist/esm/Ellipsis.js +9 -10
  33. package/dist/esm/Empty.js +7 -9
  34. package/dist/esm/FixedNav.js +11 -13
  35. package/dist/esm/Form.js +10 -11
  36. package/dist/esm/FormItem.js +8 -9
  37. package/dist/esm/Grid.js +8 -10
  38. package/dist/esm/GridItem.js +7 -9
  39. package/dist/esm/Image.js +7 -9
  40. package/dist/esm/ImagePreview.js +19 -20
  41. package/dist/esm/Indicator.js +6 -7
  42. package/dist/esm/Infiniteloading.js +12 -14
  43. package/dist/esm/Input.js +11 -13
  44. package/dist/esm/InputNumber.js +9 -10
  45. package/dist/esm/Layout.js +5 -6
  46. package/dist/esm/Menu.js +8 -9
  47. package/dist/esm/MenuItem.js +13 -14
  48. package/dist/esm/NavBar.js +7 -8
  49. package/dist/esm/NoticeBar.js +11 -12
  50. package/dist/esm/Notify.js +9 -10
  51. package/dist/esm/NumberKeyboard.js +16 -18
  52. package/dist/esm/Overlay.js +8 -9
  53. package/dist/esm/Pagination.js +9 -11
  54. package/dist/esm/Picker.js +20 -22
  55. package/dist/esm/Popover.js +10 -11
  56. package/dist/esm/Popup.js +12 -13
  57. package/dist/esm/Price.js +7 -8
  58. package/dist/esm/Progress.js +7 -8
  59. package/dist/esm/PullToRefresh.js +11 -13
  60. package/dist/esm/Radio.js +9 -10
  61. package/dist/esm/RadioGroup.js +9 -10
  62. package/dist/esm/Range.js +13 -15
  63. package/dist/esm/Rate.js +9 -10
  64. package/dist/esm/Row.js +8 -9
  65. package/dist/esm/SearchBar.js +11 -13
  66. package/dist/esm/ShortPassword.js +16 -18
  67. package/dist/esm/SideNavBar.js +14 -15
  68. package/dist/esm/SideNavBarItem.js +5 -6
  69. package/dist/esm/Signature.js +13 -15
  70. package/dist/esm/Skeleton.js +14 -16
  71. package/dist/esm/Step.js +10 -11
  72. package/dist/esm/Steps.js +9 -10
  73. package/dist/esm/Sticky.js +11 -12
  74. package/dist/esm/SubSideNavBar.js +6 -7
  75. package/dist/esm/Swipe.js +11 -12
  76. package/dist/esm/Swiper.js +10 -11
  77. package/dist/esm/SwiperItem.js +9 -10
  78. package/dist/esm/Switch.js +7 -8
  79. package/dist/esm/TabPane.js +6 -7
  80. package/dist/esm/Tabbar.js +10 -11
  81. package/dist/esm/TabbarItem.js +8 -9
  82. package/dist/esm/Table.js +9 -13
  83. package/dist/esm/Tabs.js +11 -12
  84. package/dist/esm/Tag.js +8 -9
  85. package/dist/esm/TextArea.js +11 -10
  86. package/dist/esm/TimeDetail.js +8 -10
  87. package/dist/esm/TimePannel.js +8 -10
  88. package/dist/esm/TimeSelect.js +18 -20
  89. package/dist/esm/Toast.js +9 -10
  90. package/dist/esm/TrendArrow.js +8 -9
  91. package/dist/esm/Uploader.js +14 -16
  92. package/dist/esm/UserContext-735db09f.js +5 -0
  93. package/dist/esm/UserContext-ab42ba7f.js +5 -0
  94. package/dist/esm/UserContext-fde5badc.js +5 -0
  95. package/dist/esm/Video.js +8 -9
  96. package/dist/esm/VirtualList.js +8 -10
  97. package/dist/esm/WaterMark.js +10 -12
  98. package/dist/esm/actionsheet.taro-d2217152.js +61 -0
  99. package/dist/esm/address.taro-1c534feb.js +470 -0
  100. package/dist/esm/animate.taro-c8b29242.js +44 -0
  101. package/dist/esm/animatingnumbers.taro-c2a52dbd.js +103 -0
  102. package/dist/esm/audio.taro-ec96ef80.js +185 -0
  103. package/dist/esm/avatar.taro-01536aff.js +100 -0
  104. package/dist/esm/avatargroup-ad5ffb46.js +34 -0
  105. package/dist/esm/backtop.taro-7de36464.js +48 -0
  106. package/dist/esm/badge.taro-872605bf.js +48 -0
  107. package/dist/esm/barrage.taro-c8cb9864.js +91 -0
  108. package/dist/esm/bem-cdccae08.js +5 -0
  109. package/dist/esm/button.taro-01eae688.js +72 -0
  110. package/dist/esm/calendar.taro-10a6cb11.js +70 -0
  111. package/dist/esm/calendaritem.taro-3e5f114e.js +732 -0
  112. package/dist/esm/can-use-dom-0e539bd3.js +4 -0
  113. package/dist/esm/card.taro-a46fdf25.js +51 -0
  114. package/dist/esm/cascader.taro-0a2694ed.js +463 -0
  115. package/dist/esm/cell.taro-4e31d1fa.js +48 -0
  116. package/dist/esm/cellgroup.taro-a790d91b.js +28 -0
  117. package/dist/esm/checkbox.taro-016074da.js +177 -0
  118. package/dist/esm/circleprogress.taro-7149e09d.js +104 -0
  119. package/dist/esm/col.taro-d6a46a7d.js +41 -0
  120. package/dist/esm/collapse.taro-3d997680.js +70 -0
  121. package/dist/esm/collapseitem-f4571575.js +76 -0
  122. package/dist/esm/configprovider.taro-25758d9f.js +462 -0
  123. package/dist/esm/context-d0fccf11.js +5 -0
  124. package/dist/esm/countdown.taro-22200811.js +210 -0
  125. package/dist/esm/datepicker.taro-3f718964.js +260 -0
  126. package/dist/esm/dialog.taro-290eb9a6.js +128 -0
  127. package/dist/esm/divider.taro-0cb5f894.js +31 -0
  128. package/dist/esm/drag.taro-48e1ff38.js +111 -0
  129. package/dist/esm/elevator.taro-bc162e4f.js +201 -0
  130. package/dist/esm/ellipsis.taro-f9688dd7.js +242 -0
  131. package/dist/esm/empty.taro-ca792f57.js +59 -0
  132. package/dist/esm/fixednav.taro-28e5f776.js +61 -0
  133. package/dist/esm/form.taro-b06754e8.js +182 -0
  134. package/dist/esm/formitem.taro-b326809d.js +108 -0
  135. package/dist/esm/get-scroll-parent-8da04f2e.js +24 -0
  136. package/dist/esm/grid.taro-fbbd8618.js +52 -0
  137. package/dist/esm/griditem.taro-b0c37077.js +85 -0
  138. package/dist/esm/image.taro-767aa000.js +65 -0
  139. package/dist/esm/imagepreview.taro-8832dc01.js +163 -0
  140. package/dist/esm/index-e3184f19.js +9 -0
  141. package/dist/esm/indicator.taro-f2bd212f.js +30 -0
  142. package/dist/esm/infiniteloading.taro-f8f23ac6.js +143 -0
  143. package/dist/esm/input.taro-27d686c9.js +164 -0
  144. package/dist/esm/inputnumber.taro-877dc947.js +197 -0
  145. package/dist/esm/layout.taro-9659a928.js +11 -0
  146. package/dist/esm/menu.taro-cd0fef41.js +122 -0
  147. package/dist/esm/menuitem.taro-6076bffa.js +142 -0
  148. package/dist/esm/navbar.taro-5e1a0835.js +61 -0
  149. package/dist/esm/noticebar.taro-b3bfd4fe.js +408 -0
  150. package/dist/esm/notify.taro-6b6eb6bf.js +82 -0
  151. package/dist/esm/numberkeyboard.taro-0a0e866a.js +183 -0
  152. package/dist/esm/nutui-react.es.js +211 -116
  153. package/dist/esm/offsetContext-f32a9246.js +5 -0
  154. package/dist/esm/overlay.taro-75012bd3.js +77 -0
  155. package/dist/esm/pagination.taro-63607c3b.js +94 -0
  156. package/dist/esm/picker.taro-a5603921.js +468 -0
  157. package/dist/esm/popover.taro-ad483372.js +162 -0
  158. package/dist/esm/popup.taro-e756f3fc.js +150 -0
  159. package/dist/esm/price.taro-c4f45310.js +80 -0
  160. package/dist/esm/progress.taro-ff63be75.js +49 -0
  161. package/dist/esm/pulltorefresh.taro-c611fd92.js +179 -0
  162. package/dist/esm/radio.taro-3a54f4c8.js +152 -0
  163. package/dist/esm/range.taro-52cda918.js +325 -0
  164. package/dist/esm/rate.taro-78c66969.js +77 -0
  165. package/dist/esm/row.taro-8b7febd4.js +48 -0
  166. package/dist/esm/searchbar.taro-37ade36e.js +159 -0
  167. package/dist/esm/shortpassword.taro-f7292032.js +146 -0
  168. package/dist/esm/sidenavbar.taro-9f210df4.js +51 -0
  169. package/dist/esm/sidenavbaritem.taro-32a45ce6.js +12 -0
  170. package/dist/esm/signature.taro-c57469aa.js +146 -0
  171. package/dist/esm/skeleton.taro-9ff9baf4.js +71 -0
  172. package/dist/esm/step.taro-3bc01c0c.js +66 -0
  173. package/dist/esm/steps.taro-77e301ab.js +30 -0
  174. package/dist/esm/sticky.taro-3c03eb0a.js +134 -0
  175. package/dist/esm/subsidenavbar.taro-abe07673.js +64 -0
  176. package/dist/esm/supports-passive-aaaf0eff.js +17 -0
  177. package/dist/esm/swipe.taro-de80fcd8.js +180 -0
  178. package/dist/esm/swiper.taro-74cf9306.js +430 -0
  179. package/dist/esm/swiperitem-80df464a.js +29 -0
  180. package/dist/esm/switch.taro-f0da73a3.js +44 -0
  181. package/dist/esm/tabbar.taro-18eee41f.js +55 -0
  182. package/dist/esm/tabbaritem.taro-89646ca1.js +47 -0
  183. package/dist/esm/table.taro-15a55c5d.js +100 -0
  184. package/dist/esm/tabpane.taro-f8d92ece.js +21 -0
  185. package/dist/esm/tabs.taro-b75f20ff.js +139 -0
  186. package/dist/esm/tag.taro-1b4134a5.js +92 -0
  187. package/dist/esm/textarea.taro-c110565e.js +102 -0
  188. package/dist/esm/timedetail.taro-8d2acbbf.js +41 -0
  189. package/dist/esm/timepannel.taro-ee4c5dfa.js +22 -0
  190. package/dist/esm/timeselect.taro-069deedd.js +133 -0
  191. package/dist/esm/toast.taro-92c10e1d.js +114 -0
  192. package/dist/esm/trendarrow.taro-0cf43935.js +72 -0
  193. package/dist/esm/typings-11d83a22.js +7 -0
  194. package/dist/esm/uploader.taro-92977813.js +519 -0
  195. package/dist/esm/use-client-rect-f317804e.js +10 -0
  196. package/dist/esm/use-props-value-7ac1b1b5.js +16 -0
  197. package/dist/esm/use-touch-ff43512c.js +69 -0
  198. package/dist/esm/video-5d106e33.js +73 -0
  199. package/dist/esm/virtuallist.taro-99f03769.js +195 -0
  200. package/dist/esm/watermark.taro-cef29c03.js +109 -0
  201. package/dist/locales/base.js +1 -1
  202. package/dist/locales/en-US.js +1 -1
  203. package/dist/locales/id-ID.js +1 -1
  204. package/dist/locales/zh-CN.js +1 -1
  205. package/dist/locales/zh-TW.js +1 -1
  206. package/dist/locales/zh-UG.js +1 -1
  207. package/dist/nutui.react.mjs +507 -447
  208. package/dist/nutui.react.umd.js +506 -446
  209. package/dist/packages/cascader/cascader.scss +0 -26
  210. package/dist/packages/picker/picker.scss +66 -137
  211. package/dist/packages/table/table.scss +0 -56
  212. package/dist/packages/textarea/textarea.scss +5 -12
  213. package/dist/style.css +1 -1
  214. package/dist/style.mjs +1 -1
  215. package/dist/styles/variables-jmapp.scss +1 -4
  216. package/dist/styles/variables.scss +2 -6
  217. package/dist/types/index.d.ts +42 -46
  218. package/package.json +1 -1
  219. package/dist/esm/UserContext-0aac9a82.js +0 -5
  220. package/dist/esm/UserContext-e402e1a6.js +0 -5
  221. package/dist/esm/UserContext-e8176108.js +0 -5
  222. package/dist/esm/actionsheet.taro-12cf5a3e.js +0 -53
  223. package/dist/esm/address.taro-cab0ea22.js +0 -475
  224. package/dist/esm/animate.taro-485331bb.js +0 -41
  225. package/dist/esm/animatingnumbers.taro-f6eaffef.js +0 -104
  226. package/dist/esm/audio.taro-ff280f5e.js +0 -162
  227. package/dist/esm/avatar.taro-6e8f1f5c.js +0 -107
  228. package/dist/esm/avatargroup-f4375806.js +0 -31
  229. package/dist/esm/backtop.taro-8ec80d02.js +0 -52
  230. package/dist/esm/badge.taro-e2169fbe.js +0 -45
  231. package/dist/esm/barrage.taro-aa08da6c.js +0 -94
  232. package/dist/esm/bem-350c1702.js +0 -5
  233. package/dist/esm/button.taro-b50bc217.js +0 -65
  234. package/dist/esm/calendar.taro-2fc9b899.js +0 -65
  235. package/dist/esm/calendaritem.taro-2d4a8c34.js +0 -791
  236. package/dist/esm/can-use-dom-3eeb5af4.js +0 -6
  237. package/dist/esm/card.taro-0e849e94.js +0 -33
  238. package/dist/esm/cascader.taro-467910b2.js +0 -447
  239. package/dist/esm/cell.taro-ea725a95.js +0 -43
  240. package/dist/esm/cellgroup.taro-e05ea802.js +0 -25
  241. package/dist/esm/checkbox.taro-9d02f86c.js +0 -175
  242. package/dist/esm/circleprogress.taro-d4943109.js +0 -103
  243. package/dist/esm/col.taro-4477c9f7.js +0 -43
  244. package/dist/esm/collapse.taro-89bcadf2.js +0 -79
  245. package/dist/esm/collapseitem-0e228cec.js +0 -68
  246. package/dist/esm/configprovider.taro-ce34d482.js +0 -174
  247. package/dist/esm/context-c96afdcc.js +0 -5
  248. package/dist/esm/countdown.taro-3118ba23.js +0 -225
  249. package/dist/esm/datepicker.taro-2e3e955b.js +0 -275
  250. package/dist/esm/dialog.taro-eab19eab.js +0 -107
  251. package/dist/esm/divider.taro-3993d7d5.js +0 -33
  252. package/dist/esm/drag.taro-347dfb84.js +0 -111
  253. package/dist/esm/elevator.taro-1a4e3356.js +0 -193
  254. package/dist/esm/ellipsis.taro-e1ac99a1.js +0 -244
  255. package/dist/esm/empty.taro-26363c66.js +0 -56
  256. package/dist/esm/fixednav.taro-ddb21e87.js +0 -54
  257. package/dist/esm/form.taro-423b0f0a.js +0 -179
  258. package/dist/esm/formitem.taro-b550d29c.js +0 -89
  259. package/dist/esm/get-scroll-parent-b4a07e65.js +0 -25
  260. package/dist/esm/grid.taro-883a9c35.js +0 -49
  261. package/dist/esm/griditem.taro-16c7055b.js +0 -80
  262. package/dist/esm/image.taro-3025e659.js +0 -64
  263. package/dist/esm/imagepreview.taro-d511342c.js +0 -167
  264. package/dist/esm/index-5bcb0ff8.js +0 -7
  265. package/dist/esm/indicator.taro-bfb21d45.js +0 -30
  266. package/dist/esm/infiniteloading.taro-721bca1f.js +0 -141
  267. package/dist/esm/input.taro-06c1e4d5.js +0 -167
  268. package/dist/esm/inputnumber.taro-1f893d42.js +0 -199
  269. package/dist/esm/layout.taro-e4bf83cb.js +0 -11
  270. package/dist/esm/menu.taro-e5c68cb8.js +0 -111
  271. package/dist/esm/menuitem.taro-37c18382.js +0 -129
  272. package/dist/esm/navbar.taro-92bab9c4.js +0 -57
  273. package/dist/esm/noticebar.taro-cbe93c9e.js +0 -427
  274. package/dist/esm/notify.taro-f1079218.js +0 -75
  275. package/dist/esm/numberkeyboard.taro-d9b1721b.js +0 -159
  276. package/dist/esm/offsetContext-c2a746fa.js +0 -5
  277. package/dist/esm/overlay.taro-067b7202.js +0 -73
  278. package/dist/esm/pagination.taro-94f9be5e.js +0 -91
  279. package/dist/esm/picker.taro-e16b4312.js +0 -423
  280. package/dist/esm/popover.taro-84a55ff9.js +0 -153
  281. package/dist/esm/popup.taro-89cc342a.js +0 -139
  282. package/dist/esm/price.taro-959d82f2.js +0 -83
  283. package/dist/esm/progress.taro-1a7ac8a4.js +0 -40
  284. package/dist/esm/pulltorefresh.taro-016d0079.js +0 -181
  285. package/dist/esm/radio.taro-36438449.js +0 -177
  286. package/dist/esm/range.taro-8953e8c3.js +0 -332
  287. package/dist/esm/rate.taro-895bb41c.js +0 -77
  288. package/dist/esm/row.taro-e929ec5c.js +0 -48
  289. package/dist/esm/searchbar.taro-4467040f.js +0 -152
  290. package/dist/esm/shortpassword.taro-433b86a4.js +0 -119
  291. package/dist/esm/sidenavbar.taro-f8ffb7dc.js +0 -33
  292. package/dist/esm/sidenavbaritem.taro-6cb0821e.js +0 -12
  293. package/dist/esm/signature.taro-a4d9b5c9.js +0 -143
  294. package/dist/esm/skeleton.taro-8ec11af9.js +0 -62
  295. package/dist/esm/step.taro-7ea33a76.js +0 -58
  296. package/dist/esm/steps.taro-86753d36.js +0 -30
  297. package/dist/esm/sticky.taro-a142a5f2.js +0 -136
  298. package/dist/esm/subsidenavbar.taro-85c03291.js +0 -63
  299. package/dist/esm/supports-passive-c85ef996.js +0 -18
  300. package/dist/esm/swipe.taro-0b8cc872.js +0 -175
  301. package/dist/esm/swiper.taro-c0e9a56b.js +0 -451
  302. package/dist/esm/swiperitem-abab7606.js +0 -29
  303. package/dist/esm/switch.taro-e82809f6.js +0 -38
  304. package/dist/esm/tabbar.taro-48413fb8.js +0 -51
  305. package/dist/esm/tabbaritem.taro-5afa3562.js +0 -37
  306. package/dist/esm/table.taro-327b4248.js +0 -95
  307. package/dist/esm/tabpane.taro-406cc0d3.js +0 -21
  308. package/dist/esm/tabs.taro-d47ccfc5.js +0 -120
  309. package/dist/esm/tag.taro-846ee805.js +0 -92
  310. package/dist/esm/textarea.taro-add72cf3.js +0 -94
  311. package/dist/esm/timedetail.taro-82a2900b.js +0 -44
  312. package/dist/esm/timepannel.taro-0573bb65.js +0 -22
  313. package/dist/esm/timeselect.taro-29124a34.js +0 -133
  314. package/dist/esm/toast.taro-c509a870.js +0 -108
  315. package/dist/esm/trendarrow.taro-dd83ec94.js +0 -70
  316. package/dist/esm/typings-d8491423.js +0 -6
  317. package/dist/esm/uploader.taro-c70d00de.js +0 -494
  318. package/dist/esm/use-client-rect-1f8ed1fe.js +0 -18
  319. package/dist/esm/use-props-value-ae7ee726.js +0 -15
  320. package/dist/esm/use-touch-db24bb5c.js +0 -69
  321. package/dist/esm/video-1c6405b4.js +0 -67
  322. package/dist/esm/virtuallist.taro-ba8e1f21.js +0 -214
  323. package/dist/esm/watermark.taro-168cdac5.js +0 -114
@@ -1,162 +0,0 @@
1
- import React, { useState, useRef } from 'react';
2
- import { createInnerAudioContext } from '@tarojs/taro';
3
- import { Service } from '@nutui/icons-react-taro';
4
- import { R as Range } from './range.taro-8953e8c3.js';
5
- import { B as Button } from './button.taro-b50bc217.js';
6
- import { c as cn } from './bem-350c1702.js';
7
- import { u as useConfig } from './configprovider.taro-ce34d482.js';
8
- import { C as ComponentDefaults } from './typings-d8491423.js';
9
-
10
- const b = cn('audio');
11
- const warn = console.warn;
12
- const defaultProps = {
13
- ...ComponentDefaults,
14
- className: '',
15
- url: '',
16
- style: {},
17
- autoplay: false,
18
- loop: false,
19
- type: 'progress',
20
- onFastBack: (ctx) => { },
21
- onForward: (ctx) => { },
22
- onPause: (ctx) => { },
23
- onPlay: (ctx) => { },
24
- onPlayEnd: (ctx) => { },
25
- onCanPlay: (ctx) => { },
26
- };
27
- const Audio = (props) => {
28
- const { locale } = useConfig();
29
- const { className, url, style, autoplay, loop, type, onFastBack, onForward, onPause, onPlay, onPlayEnd, onCanPlay, children, iconClassPrefix, iconFontClassName, ...rest } = {
30
- ...defaultProps,
31
- ...props,
32
- };
33
- const [playing, setPlaying] = useState(false);
34
- const [totalSeconds, setTotalSeconds] = useState(0);
35
- const [percent, setPercent] = useState(0);
36
- const [isCanPlay, setIsCanPlay] = useState(false);
37
- const [currentDuration, setCurrentDuration] = useState('00:00:00');
38
- const statusRef = useRef({
39
- currentTime: 0,
40
- currentDuration: '00:00:00',
41
- percent: 0,
42
- });
43
- const audioRef = useRef(createInnerAudioContext());
44
- const audioCtx = audioRef.current;
45
- audioCtx.src = url;
46
- audioCtx.autoplay = autoplay || false;
47
- audioCtx.loop = loop || false;
48
- audioCtx.onPause(() => {
49
- props.onPause && props.onPause(audioCtx);
50
- });
51
- audioCtx.onEnded(() => {
52
- if (props.loop) {
53
- warn(locale.audio.tips || 'onPlayEnd事件在loop=false时才会触发');
54
- }
55
- else {
56
- props.onPlayEnd && props.onPlayEnd(audioCtx);
57
- }
58
- });
59
- audioCtx.onPlay(() => {
60
- const { duration } = audioCtx;
61
- setTotalSeconds(Math.floor(duration));
62
- props.onPlay && props.onPlay(audioCtx);
63
- });
64
- audioCtx.onCanplay(() => {
65
- const intervalID = setInterval(function () {
66
- if (audioCtx.duration !== 0) {
67
- setTotalSeconds(audioCtx.duration);
68
- clearInterval(intervalID);
69
- }
70
- }, 500);
71
- setIsCanPlay(true);
72
- props.onCanPlay && props.onCanPlay(audioCtx);
73
- });
74
- audioCtx.onTimeUpdate(() => {
75
- const time = parseInt(`${audioCtx.currentTime}`);
76
- const formated = formatSeconds(`${time}`);
77
- statusRef.current.currentDuration = formated;
78
- setPercent((time / totalSeconds) * 100);
79
- setCurrentDuration(formatSeconds(audioCtx.currentTime.toString()));
80
- });
81
- audioCtx.onError((res) => {
82
- console.log('code', res.errCode);
83
- console.log('message', res.errMsg);
84
- });
85
- function formatSeconds(value) {
86
- if (!value) {
87
- return '00:00:00';
88
- }
89
- const time = parseInt(value);
90
- const hours = Math.floor(time / 3600);
91
- const minutes = Math.floor((time - hours * 3600) / 60);
92
- const secondss = time - hours * 3600 - minutes * 60;
93
- let result = '';
94
- result += `${`0${hours.toString()}`.slice(-2)}:`;
95
- result += `${`0${minutes.toString()}`.slice(-2)}:`;
96
- result += `0${secondss.toString()}`.slice(-2);
97
- return result;
98
- }
99
- const handleBack = () => {
100
- const currentTime = Math.floor(audioCtx.currentTime);
101
- statusRef.current.currentTime = Math.max(currentTime - 1, 0);
102
- setCurrentDuration(formatSeconds(statusRef.current.currentTime.toString()));
103
- audioCtx.seek(statusRef.current.currentTime);
104
- props.onFastBack && props.onFastBack(audioCtx);
105
- };
106
- const handleForward = () => {
107
- const currentTime = Math.floor(audioCtx.currentTime);
108
- statusRef.current.currentTime = Math.min(currentTime + 1, audioCtx.duration);
109
- setCurrentDuration(formatSeconds(statusRef.current.currentTime.toString()));
110
- audioCtx.seek(statusRef.current.currentTime);
111
- props.onForward && props.onForward(audioCtx);
112
- };
113
- const handleStatusChange = () => {
114
- setPlaying(!playing);
115
- if (!playing) {
116
- audioCtx.play();
117
- }
118
- else {
119
- audioCtx.pause();
120
- }
121
- };
122
- const renderIcon = () => {
123
- return (React.createElement(React.Fragment, null,
124
- React.createElement("div", { className: b('icon') },
125
- React.createElement("div", { className: `${b('icon-box')} ${playing ? b('icon-play') : b('icon-stop')}`, onClick: handleStatusChange },
126
- React.createElement(Service, { className: playing ? 'nut-icon-loading' : '' })))));
127
- };
128
- const renderProgerss = () => {
129
- return (React.createElement(React.Fragment, null,
130
- React.createElement("div", { className: b('progress') },
131
- React.createElement("div", { className: "time" }, currentDuration),
132
- React.createElement("div", { className: b('progress-bar-wrapper') },
133
- React.createElement(Range, { modelValue: percent, hiddenTag: true, hiddenRange: true, "inactive-color": "#cccccc", "active-color": "#fa2c19" })),
134
- React.createElement("div", { className: "time" }, formatSeconds(`${totalSeconds}`) || '00:00:00')),
135
- React.createElement("div", { className: isCanPlay ? 'custom-button-group' : 'custom-button-group-disable' },
136
- React.createElement(Button, { type: "primary", size: "small", className: "back", onClick: handleBack }, locale.audio.back || '快退'),
137
- React.createElement(Button, { type: "primary", size: "small", className: "start", onClick: handleStatusChange }, playing
138
- ? `${locale.audio.pause || '暂停'}`
139
- : `${locale.audio.start || '开始'}`),
140
- React.createElement(Button, { type: "primary", size: "small", onClick: handleForward }, locale.audio.forward || '快进'))));
141
- };
142
- const renderNone = () => {
143
- return (React.createElement("div", { className: b('none-container'), onClick: handleStatusChange }, children));
144
- };
145
- const renderAudio = () => {
146
- switch (type) {
147
- case 'icon':
148
- return renderIcon();
149
- case 'progress':
150
- return renderProgerss();
151
- case 'none':
152
- return renderNone();
153
- default:
154
- return null;
155
- }
156
- };
157
- return (React.createElement("div", { className: `${b()} ${className}`, style: style, ...rest }, renderAudio()));
158
- };
159
- Audio.defaultProps = defaultProps;
160
- Audio.displayName = 'NutAudio';
161
-
162
- export { Audio as A };
@@ -1,107 +0,0 @@
1
- import React, { useState, useRef, useContext, useEffect } from 'react';
2
- import classNames from 'classnames';
3
- import { I as Image } from './image.taro-3025e659.js';
4
- import { A as AvatarContext } from './context-c96afdcc.js';
5
- import { My } from '@nutui/icons-react-taro';
6
- import { C as ComponentDefaults } from './typings-d8491423.js';
7
-
8
- const defaultProps = {
9
- ...ComponentDefaults,
10
- size: '',
11
- shape: 'round',
12
- icon: '',
13
- fit: 'cover',
14
- background: '#eee',
15
- color: '#666',
16
- src: '',
17
- alt: '',
18
- };
19
- const classPrefix = `nut-avatar`;
20
- const Avatar = (props) => {
21
- const { children, size, shape, background, color, src, icon, fit, alt, className, style, onClick, onError, ...rest } = {
22
- ...defaultProps,
23
- ...props,
24
- };
25
- const [maxSum, setMaxSum] = useState(0); // avatarGroup里的avatar的个数
26
- const [showMax, setShowMax] = useState(false); // 是否显示的最大头像个数
27
- const [avatarIndex, setAvatarIndex] = useState(1); // avatar的索引
28
- const avatarRef = useRef(null);
29
- const parent = useContext(AvatarContext);
30
- const sizeValue = ['large', 'normal', 'small'];
31
- const classes = classNames({
32
- [`nut-avatar-${parent?.propAvatarGroup?.size || size || 'normal'}`]: true,
33
- [`nut-avatar-${parent?.propAvatarGroup?.shape || shape}`]: true,
34
- });
35
- const cls = classNames(classPrefix, classes, className);
36
- const styles = {
37
- width: sizeValue.indexOf(size) > -1 ? '' : `${size}px`,
38
- height: sizeValue.indexOf(size) > -1 ? '' : `${size}px`,
39
- backgroundColor: `${background}`,
40
- color: `${color}`,
41
- marginLeft: avatarIndex !== 1 && parent?.propAvatarGroup?.gap
42
- ? `${parent?.propAvatarGroup?.gap}px`
43
- : '',
44
- zIndex: parent?.propAvatarGroup?.level === 'right'
45
- ? `${Math.abs(maxSum - avatarIndex)}`
46
- : '',
47
- ...style,
48
- };
49
- const maxStyles = {
50
- backgroundColor: `${parent?.propAvatarGroup?.maxBackground}`,
51
- color: `${parent?.propAvatarGroup?.maxColor}`,
52
- };
53
- useEffect(() => {
54
- const avatarChildren = parent?.avatarGroupRef?.current.children;
55
- if (avatarChildren) {
56
- avatarLength(avatarChildren);
57
- }
58
- }, []);
59
- const avatarLength = (children) => {
60
- for (let i = 0; i < children.length; i++) {
61
- if (children[i] &&
62
- children[i].classList &&
63
- (children[i].classList[0] === 'nut-avatar' ||
64
- children[i].classList.values().next().value === 'nut-avatar')) {
65
- children[i].setAttribute('data-index', i + 1);
66
- }
67
- }
68
- const index = avatarRef?.current?.dataset?.index;
69
- const maxCount = parent?.propAvatarGroup?.max;
70
- setMaxSum(children.length);
71
- setAvatarIndex(index);
72
- if (index === children.length &&
73
- index !== maxCount &&
74
- children.length > maxCount) {
75
- setShowMax(true);
76
- }
77
- };
78
- const errorEvent = () => {
79
- if (props.onError) {
80
- props.onError();
81
- }
82
- };
83
- const clickAvatar = (e) => {
84
- onClick && onClick(e);
85
- };
86
- return (React.createElement(React.Fragment, null, (showMax ||
87
- !parent?.propAvatarGroup?.max ||
88
- avatarIndex <= parent?.propAvatarGroup?.max) && (React.createElement("div", { className: cls, ...rest, style: !showMax ? styles : maxStyles, onClick: clickAvatar, ref: avatarRef },
89
- (!parent?.propAvatarGroup?.max ||
90
- avatarIndex <= parent?.propAvatarGroup?.max) && (React.createElement(React.Fragment, null,
91
- src && (React.createElement(Image, { className: "avatar-img", src: src, style: { objectFit: fit }, alt: alt, onError: errorEvent })),
92
- React.isValidElement(icon)
93
- ? React.cloneElement(icon, {
94
- ...icon.props,
95
- className: `${icon.props.className || ''} icon`,
96
- })
97
- : null,
98
- children && React.createElement("span", { className: "text" }, children),
99
- !src && !icon && !children && React.createElement(My, { className: "icon" }))),
100
- showMax && (React.createElement("div", { className: "text" }, parent?.propAvatarGroup?.maxContent
101
- ? parent?.propAvatarGroup?.maxContent
102
- : `+ ${avatarIndex - parent?.propAvatarGroup?.max}`))))));
103
- };
104
- Avatar.defaultProps = defaultProps;
105
- Avatar.displayName = 'NutAvatar';
106
-
107
- export { Avatar as A };
@@ -1,31 +0,0 @@
1
- import React, { useRef } from 'react';
2
- import classNames from 'classnames';
3
- import { A as AvatarContext } from './context-c96afdcc.js';
4
- import { C as ComponentDefaults } from './typings-d8491423.js';
5
-
6
- const defaultProps = {
7
- ...ComponentDefaults,
8
- maxContent: '',
9
- max: '',
10
- maxBackground: '#eee',
11
- maxColor: '#666',
12
- gap: '-8',
13
- level: 'left',
14
- };
15
- const classPrefix = `nut-avatar-group`;
16
- const AvatarGroup = (props) => {
17
- const propAvatarGroup = { ...defaultProps, ...props };
18
- const { className, style, children } = propAvatarGroup;
19
- const avatarGroupRef = useRef(null);
20
- const cls = classNames(classPrefix, className);
21
- const parentAvatar = {
22
- propAvatarGroup,
23
- avatarGroupRef,
24
- };
25
- return (React.createElement(AvatarContext.Provider, { value: parentAvatar },
26
- React.createElement("div", { className: cls, style: style, ref: avatarGroupRef }, children)));
27
- };
28
- AvatarGroup.defaultProps = defaultProps;
29
- AvatarGroup.displayName = 'NutAvatarGroup';
30
-
31
- export { AvatarGroup as A };
@@ -1,52 +0,0 @@
1
- import React, { useState } from 'react';
2
- import { usePageScroll, pageScrollTo } from '@tarojs/taro';
3
- import { Top } from '@nutui/icons-react-taro';
4
- import classNames from 'classnames';
5
- import { C as ComponentDefaults } from './typings-d8491423.js';
6
-
7
- const defaultProps = {
8
- ...ComponentDefaults,
9
- threshold: 200,
10
- zIndex: 10,
11
- duration: 1000,
12
- };
13
- const BackTop = (props) => {
14
- const { children, threshold, zIndex, className, duration, style, onClick } = {
15
- ...defaultProps,
16
- ...props,
17
- };
18
- const classPrefix = 'nut-backtop';
19
- const [backTop, SetBackTop] = useState(false);
20
- // 监听用户滑动页面事件
21
- usePageScroll((res) => {
22
- const { scrollTop } = res;
23
- scrollTop >= threshold ? SetBackTop(true) : SetBackTop(false);
24
- });
25
- // 返回顶部点击事件
26
- const goTop = (e) => {
27
- onClick && onClick(e);
28
- pageScrollTo({
29
- scrollTop: 0,
30
- duration: duration > 0 ? duration : 0,
31
- });
32
- };
33
- const styles = style
34
- ? {
35
- zIndex,
36
- ...style,
37
- }
38
- : {
39
- right: '10px',
40
- bottom: '20px',
41
- zIndex,
42
- };
43
- return (React.createElement("div", { className: classNames(classPrefix, className, {
44
- show: backTop,
45
- }), style: styles, onClick: (e) => {
46
- goTop(e);
47
- } }, children || React.createElement(Top, { width: 19, height: 19, className: "nut-backtop-main" })));
48
- };
49
- BackTop.defaultProps = defaultProps;
50
- BackTop.displayName = 'NutBackTop';
51
-
52
- export { BackTop as B };
@@ -1,45 +0,0 @@
1
- import React from 'react';
2
- import classNames from 'classnames';
3
- import { C as ComponentDefaults } from './typings-d8491423.js';
4
-
5
- const defaultProps = {
6
- ...ComponentDefaults,
7
- value: '',
8
- dot: false,
9
- max: 99,
10
- top: '0',
11
- right: '5',
12
- color: '',
13
- };
14
- const Badge = (props) => {
15
- const { className, style, value, max, children, dot, top, right, color } = {
16
- ...defaultProps,
17
- ...props,
18
- };
19
- const classPrefix = 'nut-badge';
20
- const classes = classNames(classPrefix, className);
21
- const contentClasses = classNames({ [`${classPrefix}__dot`]: dot }, `${classPrefix}__content`, `${classPrefix}__sup`);
22
- function content() {
23
- if (dot || typeof value === 'object')
24
- return null;
25
- if (typeof value === 'number' && typeof max === 'number') {
26
- return max < value ? `${max}+` : value;
27
- }
28
- return value;
29
- }
30
- const getStyle = () => {
31
- const style = {};
32
- style.top = `${Number(top) || parseFloat(top) || 0}px`;
33
- style.right = `${Number(right) || parseFloat(right) || 0}px`;
34
- style.background = color;
35
- return style;
36
- };
37
- return (React.createElement("div", { className: classes, style: style },
38
- typeof value === 'object' && value && (React.createElement("div", { className: `${classPrefix}__icon` }, value)),
39
- React.createElement("div", null, children),
40
- React.createElement("div", { className: contentClasses, style: getStyle() }, content())));
41
- };
42
- Badge.defaultProps = defaultProps;
43
- Badge.displayName = 'NutBadge';
44
-
45
- export { Badge as B };
@@ -1,94 +0,0 @@
1
- import React, { useState, useRef, useImperativeHandle, useEffect } from 'react';
2
- import { createSelectorQuery } from '@tarojs/taro';
3
- import classNames from 'classnames';
4
- import { c as cn } from './bem-350c1702.js';
5
-
6
- const defaultProps = {
7
- barrageList: [],
8
- frequency: 500,
9
- loop: true,
10
- speeds: 3000,
11
- rows: 3,
12
- top: 10,
13
- };
14
- const InternalBarrage = (props, ref) => {
15
- const { className, frequency, loop, barrageList, speeds, rows, top, ...restProps } = {
16
- ...defaultProps,
17
- ...props,
18
- };
19
- const [styleList, setStyleList] = useState([]);
20
- const [baItemList, setBaItemList] = useState(barrageList);
21
- const barrageListSet = useRef(barrageList);
22
- const barrageBody = useRef(null);
23
- const barrageContainer = useRef(null);
24
- const timeId = useRef(new Date().getTime());
25
- const timer = useRef(0);
26
- useRef(0);
27
- const b = cn('barrage');
28
- const classes = classNames(className, b(''), {
29
- [`nut-barrage__body${timeId.current}`]: true,
30
- });
31
- useImperativeHandle(ref, () => ({
32
- add: (word) => {
33
- barrageListSet.current = [...barrageListSet.current, word];
34
- run();
35
- },
36
- }));
37
- useEffect(() => {
38
- barrageListSet.current = [...barrageList];
39
- run();
40
- return () => {
41
- clearInterval(timer.current);
42
- };
43
- }, [barrageList]);
44
- const run = () => {
45
- setBaItemList(barrageListSet.current);
46
- barrageListSet.current.forEach((item, index) => {
47
- getNode(index);
48
- });
49
- };
50
- const getNode = (index) => {
51
- const query = createSelectorQuery();
52
- setTimeout(() => {
53
- let width = 100;
54
- query
55
- .select('.nut-barrage__body' + timeId.current)
56
- .boundingClientRect((rec) => {
57
- width = rec.width || 300;
58
- });
59
- query
60
- .select('.nut-barrage__item' + index)
61
- .boundingClientRect((recs) => {
62
- let height = recs.height;
63
- let nodeTop = (index % rows) * (height + top) + 20 + 'px';
64
- styleInfo(index, nodeTop, width);
65
- })
66
- .exec();
67
- }, 500);
68
- };
69
- const styleInfo = (index, nodeTop, width) => {
70
- let timeIndex = index - rows > 0 ? index - rows : 0;
71
- let list = styleList;
72
- let time = list[timeIndex] ? Number(list[timeIndex]['--time']) : 0;
73
- // // distance.value = '-' + (speeds / 1000) * 200 + '%';
74
- let obj = {
75
- top: nodeTop,
76
- '--time': `${frequency * index + time}`,
77
- animationDuration: `${speeds}ms`,
78
- animationIterationCount: `${loop ? 'infinite' : 1}`,
79
- animationDelay: `${frequency * index + time}ms`,
80
- '--move-distance': `-${width}px`,
81
- };
82
- list.push(obj);
83
- setStyleList([...list]);
84
- };
85
- return (React.createElement("div", { className: classes, ref: barrageBody, ...restProps },
86
- React.createElement("div", { ref: barrageContainer, className: "bContainer" }, baItemList.map((item, index) => {
87
- return (React.createElement("div", { className: `barrage-item nut-barrage__item${index} move`, style: styleList[index] }, item.length > 8 ? item.substr(0, 8) + '...' : item));
88
- }))));
89
- };
90
- const Barrage = React.forwardRef(InternalBarrage);
91
- Barrage.defaultProps = defaultProps;
92
- Barrage.displayName = 'NutBarrage';
93
-
94
- export { Barrage as B };
@@ -1,5 +0,0 @@
1
- import { withNaming } from '@bem-react/classname';
2
-
3
- const cn = withNaming({ n: 'nut-', e: '__', m: '--', v: '-' });
4
-
5
- export { cn as c };
@@ -1,65 +0,0 @@
1
- import React, { useCallback } from 'react';
2
- import classNames from 'classnames';
3
- import { Loading } from '@nutui/icons-react-taro';
4
- import { C as ComponentDefaults } from './typings-d8491423.js';
5
-
6
- const prefixCls = 'nut-button';
7
- const defaultProps = {
8
- ...ComponentDefaults,
9
- color: '',
10
- type: 'default',
11
- size: 'normal',
12
- shape: 'round',
13
- fill: 'solid',
14
- loading: false,
15
- disabled: false,
16
- block: false,
17
- icon: null,
18
- onClick: (e) => { },
19
- };
20
- const Button = React.forwardRef((props, ref) => {
21
- const { color, shape, fill, loading, disabled, type, size, block, icon, children, onClick, className, style, ...rest } = {
22
- ...defaultProps,
23
- ...props,
24
- };
25
- const getStyle = useCallback(() => {
26
- const style = {};
27
- if (props.color) {
28
- if (fill && fill === 'outline') {
29
- style.color = color;
30
- style.background = '#fff';
31
- if (!color?.includes('gradient')) {
32
- style.borderColor = color;
33
- }
34
- }
35
- else {
36
- style.color = '#fff';
37
- style.background = color;
38
- }
39
- }
40
- return style;
41
- }, [color]);
42
- const handleClick = (e) => {
43
- if (!loading && !disabled && onClick) {
44
- onClick(e);
45
- }
46
- };
47
- return (
48
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
49
- // @ts-ignore
50
- // eslint-disable-next-line react/button-has-type
51
- React.createElement("button", { ...rest, ref: ref, className: classNames(prefixCls, className, props.type ? `${prefixCls}--${type}` : null, props.fill ? `${prefixCls}--${fill}` : null, {
52
- [`${prefixCls}--${size}`]: size,
53
- [`${prefixCls}--${shape}`]: shape,
54
- [`${prefixCls}--block`]: block,
55
- [`${prefixCls}--disabled`]: disabled,
56
- [`${prefixCls}--loading`]: loading,
57
- }), style: { ...getStyle(), ...style }, onClick: (e) => handleClick(e) },
58
- React.createElement("div", { className: "nut-button__warp" },
59
- loading && React.createElement(Loading, { className: "nut-icon-loading" }),
60
- !loading && icon ? icon : null,
61
- children && (React.createElement("div", { className: icon || loading ? 'nut-button-text' : '' }, children)))));
62
- });
63
- Button.displayName = 'NutButton';
64
-
65
- export { Button as B };
@@ -1,65 +0,0 @@
1
- import React, { useRef } from 'react';
2
- import { P as Popup } from './popup.taro-89cc342a.js';
3
- import { U as Utils, C as CalendarItem } from './calendaritem.taro-2d4a8c34.js';
4
- import { u as useConfig } from './configprovider.taro-ce34d482.js';
5
-
6
- const defaultProps = {
7
- type: 'one',
8
- isAutoBackFill: false,
9
- poppable: true,
10
- visible: false,
11
- title: '',
12
- defaultValue: '',
13
- startDate: Utils.getDay(0),
14
- endDate: Utils.getDay(365),
15
- showToday: true,
16
- startText: '',
17
- endText: '',
18
- confirmText: '',
19
- showTitle: true,
20
- showSubTitle: true,
21
- toDateAnimation: true,
22
- onBtn: undefined,
23
- onDay: undefined,
24
- onTopInfo: undefined,
25
- onBottomInfo: undefined,
26
- onClose: () => { },
27
- onChoose: (param) => { },
28
- onSelected: (data) => { },
29
- onYearMonthChange: (param) => { },
30
- };
31
- const Calendar = React.forwardRef((props, ref) => {
32
- const { locale } = useConfig();
33
- const { children, poppable, visible, type, isAutoBackFill, title, defaultValue, startDate, endDate, showToday, startText, endText, confirmText, showTitle, showSubTitle, toDateAnimation, onBtn, onDay, onTopInfo, onBottomInfo, onClose, onChoose, onSelected, onYearMonthChange, } = { ...defaultProps, ...props };
34
- const calendarRef = useRef(null);
35
- const close = () => {
36
- onClose && onClose();
37
- };
38
- const choose = (param) => {
39
- close();
40
- onChoose && onChoose(param);
41
- };
42
- const closePopup = () => {
43
- close();
44
- };
45
- const select = (param) => {
46
- onSelected && onSelected(param);
47
- };
48
- const scrollToDate = (date) => {
49
- calendarRef.current?.scrollToDate(date);
50
- };
51
- const yearMonthChange = (param) => {
52
- onYearMonthChange && onYearMonthChange(param);
53
- };
54
- React.useImperativeHandle(ref, () => ({
55
- scrollToDate,
56
- }));
57
- const renderItem = () => {
58
- return (React.createElement(CalendarItem, { ref: calendarRef, type: type, isAutoBackFill: isAutoBackFill, poppable: poppable, title: title || locale.calendaritem.title, defaultValue: defaultValue, startDate: startDate, endDate: endDate, showToday: showToday, startText: startText || locale.calendaritem.start, endText: endText || locale.calendaritem.end, confirmText: confirmText || locale.calendaritem.confirm, showTitle: showTitle, showSubTitle: showSubTitle, toDateAnimation: toDateAnimation, onBtn: onBtn, onDay: onDay, onTopInfo: onTopInfo, onBottomInfo: onBottomInfo, onChoose: choose, onSelected: select, onYearMonthChange: yearMonthChange }));
59
- };
60
- return (React.createElement(React.Fragment, null, poppable ? (React.createElement(Popup, { visible: visible, position: "bottom", round: true, duration: 0.5, closeable: true, destroyOnClose: true, onClickOverlay: closePopup, onClickCloseIcon: closePopup, style: { height: '85vh' } }, renderItem())) : (renderItem())));
61
- });
62
- Calendar.defaultProps = defaultProps;
63
- Calendar.displayName = 'NutCalendar';
64
-
65
- export { Calendar as C };