taro-ui 3.3.0 → 3.3.2

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 (415) hide show
  1. package/LICENSE +21 -0
  2. package/lib/common/component.d.ts +10 -0
  3. package/lib/common/component.js +27 -28
  4. package/lib/common/component.js.map +1 -1
  5. package/lib/common/utils.d.ts +41 -0
  6. package/lib/common/utils.js +169 -192
  7. package/lib/common/utils.js.map +1 -1
  8. package/lib/components/accordion/index.d.ts +14 -0
  9. package/lib/components/accordion/index.js +111 -106
  10. package/lib/components/accordion/index.js.map +1 -1
  11. package/lib/components/action-sheet/body/index.d.ts +5 -0
  12. package/lib/components/action-sheet/body/index.js +11 -8
  13. package/lib/components/action-sheet/body/index.js.map +1 -1
  14. package/lib/components/action-sheet/body/item/index.d.ts +9 -0
  15. package/lib/components/action-sheet/body/item/index.js +21 -18
  16. package/lib/components/action-sheet/body/item/index.js.map +1 -1
  17. package/lib/components/action-sheet/footer/index.d.ts +9 -0
  18. package/lib/components/action-sheet/footer/index.js +24 -18
  19. package/lib/components/action-sheet/footer/index.js.map +1 -1
  20. package/lib/components/action-sheet/header/index.d.ts +5 -0
  21. package/lib/components/action-sheet/header/index.js +14 -8
  22. package/lib/components/action-sheet/header/index.js.map +1 -1
  23. package/lib/components/action-sheet/index.d.ts +14 -0
  24. package/lib/components/action-sheet/index.js +69 -64
  25. package/lib/components/action-sheet/index.js.map +1 -1
  26. package/lib/components/activity-indicator/index.d.ts +8 -0
  27. package/lib/components/activity-indicator/index.js +33 -29
  28. package/lib/components/activity-indicator/index.js.map +1 -1
  29. package/lib/components/avatar/index.d.ts +9 -0
  30. package/lib/components/avatar/index.js +58 -50
  31. package/lib/components/avatar/index.js.map +1 -1
  32. package/lib/components/badge/index.d.ts +10 -0
  33. package/lib/components/badge/index.js +44 -35
  34. package/lib/components/badge/index.js.map +1 -1
  35. package/lib/components/button/index.d.ts +15 -0
  36. package/lib/components/button/index.js +165 -113
  37. package/lib/components/button/index.js.map +1 -1
  38. package/lib/components/calendar/body/index.d.ts +26 -0
  39. package/lib/components/calendar/body/index.js +279 -183
  40. package/lib/components/calendar/body/index.js.map +1 -1
  41. package/lib/components/calendar/common/constant.d.ts +3 -0
  42. package/lib/components/calendar/common/constant.js +8 -3
  43. package/lib/components/calendar/common/constant.js.map +1 -1
  44. package/lib/components/calendar/common/helper.d.ts +4 -0
  45. package/lib/components/calendar/common/helper.js +77 -76
  46. package/lib/components/calendar/common/helper.js.map +1 -1
  47. package/lib/components/calendar/common/plugins.d.ts +11 -0
  48. package/lib/components/calendar/common/plugins.js +50 -66
  49. package/lib/components/calendar/common/plugins.js.map +1 -1
  50. package/lib/components/calendar/controller/index.d.ts +5 -0
  51. package/lib/components/calendar/controller/index.js +49 -28
  52. package/lib/components/calendar/controller/index.js.map +1 -1
  53. package/lib/components/calendar/index.d.ts +20 -0
  54. package/lib/components/calendar/index.js +233 -196
  55. package/lib/components/calendar/index.js.map +1 -1
  56. package/lib/components/calendar/ui/date-list/index.d.ts +12 -0
  57. package/lib/components/calendar/ui/date-list/index.js +50 -39
  58. package/lib/components/calendar/ui/date-list/index.js.map +1 -1
  59. package/lib/components/calendar/ui/day-list/index.d.ts +4 -0
  60. package/lib/components/calendar/ui/day-list/index.js +9 -14
  61. package/lib/components/calendar/ui/day-list/index.js.map +1 -1
  62. package/lib/components/card/index.d.ts +9 -0
  63. package/lib/components/card/index.js +73 -52
  64. package/lib/components/card/index.js.map +1 -1
  65. package/lib/components/checkbox/index.d.ts +9 -0
  66. package/lib/components/checkbox/index.js +52 -48
  67. package/lib/components/checkbox/index.js.map +1 -1
  68. package/lib/components/countdown/index.d.ts +20 -0
  69. package/lib/components/countdown/index.js +140 -125
  70. package/lib/components/countdown/index.js.map +1 -1
  71. package/lib/components/countdown/item/index.d.ts +9 -0
  72. package/lib/components/countdown/item/index.js +18 -18
  73. package/lib/components/countdown/item/index.js.map +1 -1
  74. package/lib/components/curtain/index.d.ts +10 -0
  75. package/lib/components/curtain/index.js +56 -39
  76. package/lib/components/curtain/index.js.map +1 -1
  77. package/lib/components/divider/index.d.ts +8 -0
  78. package/lib/components/divider/index.js +51 -34
  79. package/lib/components/divider/index.js.map +1 -1
  80. package/lib/components/drawer/index.d.ts +16 -0
  81. package/lib/components/drawer/index.js +106 -85
  82. package/lib/components/drawer/index.js.map +1 -1
  83. package/lib/components/fab/index.d.ts +9 -0
  84. package/lib/components/fab/index.js +22 -19
  85. package/lib/components/fab/index.js.map +1 -1
  86. package/lib/components/flex/index.d.ts +7 -0
  87. package/lib/components/flex/index.js +37 -34
  88. package/lib/components/flex/index.js.map +1 -1
  89. package/lib/components/flex/item/index.d.ts +7 -0
  90. package/lib/components/flex/item/index.js +30 -27
  91. package/lib/components/flex/item/index.js.map +1 -1
  92. package/lib/components/float-layout/index.d.ts +13 -0
  93. package/lib/components/float-layout/index.js +96 -68
  94. package/lib/components/float-layout/index.js.map +1 -1
  95. package/lib/components/form/index.d.ts +10 -0
  96. package/lib/components/form/index.js +37 -24
  97. package/lib/components/form/index.js.map +1 -1
  98. package/lib/components/grid/index.d.ts +9 -0
  99. package/lib/components/grid/index.js +92 -62
  100. package/lib/components/grid/index.js.map +1 -1
  101. package/lib/components/icon/index.d.ts +9 -0
  102. package/lib/components/icon/index.js +48 -31
  103. package/lib/components/icon/index.js.map +1 -1
  104. package/lib/components/image-picker/index.d.ts +11 -0
  105. package/lib/components/image-picker/index.js +152 -126
  106. package/lib/components/image-picker/index.js.map +1 -1
  107. package/lib/components/indexes/index.d.ts +29 -0
  108. package/lib/components/indexes/index.js +255 -198
  109. package/lib/components/indexes/index.js.map +1 -1
  110. package/lib/components/input/index.d.ts +17 -0
  111. package/lib/components/input/index.js +224 -160
  112. package/lib/components/input/index.js.map +1 -1
  113. package/lib/components/input-number/index.d.ts +13 -0
  114. package/lib/components/input-number/index.js +180 -152
  115. package/lib/components/input-number/index.js.map +1 -1
  116. package/lib/components/list/index.d.ts +8 -0
  117. package/lib/components/list/index.js +20 -13
  118. package/lib/components/list/index.js.map +1 -1
  119. package/lib/components/list/item/index.d.ts +11 -0
  120. package/lib/components/list/item/index.js +146 -99
  121. package/lib/components/list/item/index.js.map +1 -1
  122. package/lib/components/load-more/index.d.ts +9 -0
  123. package/lib/components/load-more/index.js +65 -41
  124. package/lib/components/load-more/index.js.map +1 -1
  125. package/lib/components/loading/index.d.ts +12 -0
  126. package/lib/components/loading/index.js +26 -26
  127. package/lib/components/loading/index.js.map +1 -1
  128. package/lib/components/message/index.d.ts +15 -0
  129. package/lib/components/message/index.js +72 -63
  130. package/lib/components/message/index.js.map +1 -1
  131. package/lib/components/modal/action/index.d.ts +8 -0
  132. package/lib/components/modal/action/index.js +20 -14
  133. package/lib/components/modal/action/index.js.map +1 -1
  134. package/lib/components/modal/content/index.d.ts +5 -0
  135. package/lib/components/modal/content/index.js +11 -8
  136. package/lib/components/modal/content/index.js.map +1 -1
  137. package/lib/components/modal/header/index.d.ts +5 -0
  138. package/lib/components/modal/header/index.js +11 -8
  139. package/lib/components/modal/header/index.js.map +1 -1
  140. package/lib/components/modal/index.d.ts +15 -0
  141. package/lib/components/modal/index.js +96 -87
  142. package/lib/components/modal/index.js.map +1 -1
  143. package/lib/components/nav-bar/index.d.ts +12 -0
  144. package/lib/components/nav-bar/index.js +210 -98
  145. package/lib/components/nav-bar/index.js.map +1 -1
  146. package/lib/components/noticebar/index.d.ts +16 -0
  147. package/lib/components/noticebar/index.js +177 -154
  148. package/lib/components/noticebar/index.js.map +1 -1
  149. package/lib/components/pagination/index.d.ts +12 -0
  150. package/lib/components/pagination/index.js +133 -102
  151. package/lib/components/pagination/index.js.map +1 -1
  152. package/lib/components/progress/index.d.ts +7 -0
  153. package/lib/components/progress/index.js +48 -40
  154. package/lib/components/progress/index.js.map +1 -1
  155. package/lib/components/radio/index.d.ts +9 -0
  156. package/lib/components/radio/index.js +48 -37
  157. package/lib/components/radio/index.js.map +1 -1
  158. package/lib/components/range/index.d.ts +22 -0
  159. package/lib/components/range/index.js +197 -142
  160. package/lib/components/range/index.js.map +1 -1
  161. package/lib/components/rate/index.d.ts +9 -0
  162. package/lib/components/rate/index.js +74 -48
  163. package/lib/components/rate/index.js.map +1 -1
  164. package/lib/components/search-bar/index.d.ts +16 -0
  165. package/lib/components/search-bar/index.js +167 -112
  166. package/lib/components/search-bar/index.js.map +1 -1
  167. package/lib/components/segmented-control/index.d.ts +9 -0
  168. package/lib/components/segmented-control/index.js +78 -53
  169. package/lib/components/segmented-control/index.js.map +1 -1
  170. package/lib/components/slider/index.d.ts +13 -0
  171. package/lib/components/slider/index.js +107 -69
  172. package/lib/components/slider/index.js.map +1 -1
  173. package/lib/components/steps/index.d.ts +9 -0
  174. package/lib/components/steps/index.js +61 -44
  175. package/lib/components/steps/index.js.map +1 -1
  176. package/lib/components/swipe-action/index.d.ts +27 -0
  177. package/lib/components/swipe-action/index.js +206 -157
  178. package/lib/components/swipe-action/index.js.map +1 -1
  179. package/lib/components/swipe-action/options/index.d.ts +5 -0
  180. package/lib/components/swipe-action/options/index.js +22 -8
  181. package/lib/components/swipe-action/options/index.js.map +1 -1
  182. package/lib/components/switch/index.d.ts +9 -0
  183. package/lib/components/switch/index.js +53 -42
  184. package/lib/components/switch/index.js.map +1 -1
  185. package/lib/components/tab-bar/index.d.ts +9 -0
  186. package/lib/components/tab-bar/index.js +164 -90
  187. package/lib/components/tab-bar/index.js.map +1 -1
  188. package/lib/components/tabs/index.d.ts +24 -0
  189. package/lib/components/tabs/index.js +203 -174
  190. package/lib/components/tabs/index.js.map +1 -1
  191. package/lib/components/tabs-pane/index.d.ts +8 -0
  192. package/lib/components/tabs-pane/index.js +37 -24
  193. package/lib/components/tabs-pane/index.js.map +1 -1
  194. package/lib/components/tag/index.d.ts +9 -0
  195. package/lib/components/tag/index.js +64 -44
  196. package/lib/components/tag/index.js.map +1 -1
  197. package/lib/components/textarea/index.d.ts +13 -0
  198. package/lib/components/textarea/index.js +132 -86
  199. package/lib/components/textarea/index.js.map +1 -1
  200. package/lib/components/timeline/index.d.ts +8 -0
  201. package/lib/components/timeline/index.js +70 -47
  202. package/lib/components/timeline/index.js.map +1 -1
  203. package/lib/components/toast/img.json +6 -3
  204. package/lib/components/toast/index.d.ts +16 -0
  205. package/lib/components/toast/index.js +111 -104
  206. package/lib/components/toast/index.js.map +1 -1
  207. package/lib/index.d.ts +53 -0
  208. package/lib/index.js +108 -54
  209. package/lib/index.js.map +1 -1
  210. package/{dist → lib}/style/components/curtain.scss +3 -3
  211. package/{dist → lib}/style/components/grid.scss +2 -2
  212. package/lib/style/components/index.scss +52 -0
  213. package/{dist → lib}/style/components/list.scss +2 -2
  214. package/{dist → lib}/style/components/range.scss +2 -2
  215. package/{dist → lib}/style/components/toast.scss +1 -1
  216. package/lib/style/index.css +11754 -0
  217. package/lib/style/index.css.map +1 -0
  218. package/lib/style/mixins/index.scss +18 -0
  219. package/{dist → lib}/style/mixins/libs/shade.scss +4 -2
  220. package/{dist → lib}/style/mixins/libs/tint.scss +4 -2
  221. package/{dist → lib}/style/variables/default.scss +1 -1
  222. package/package.json +45 -48
  223. package/rn/components/action-sheet/index.tsx +8 -14
  224. package/rn/components/calendar/ui/date-list/index.tsx +1 -1
  225. package/rn/components/drawer/index.tsx +15 -15
  226. package/rn/components/float-layout/index.tsx +3 -2
  227. package/rn/components/input/index.tsx +14 -7
  228. package/rn/components/input-number/index.tsx +19 -19
  229. package/rn/components/message/index.tsx +1 -1
  230. package/rn/components/swipe-action/index.rn.tsx +4 -2
  231. package/rn/components/swipe-action/index.tsx +6 -5
  232. package/rn/components/tab-bar/index.tsx +1 -1
  233. package/rn/components/tabs/index.tsx +14 -14
  234. package/rn/components/textarea/index.tsx +2 -2
  235. package/README.md +0 -85
  236. package/dist/index.esm.js +0 -8407
  237. package/dist/index.esm.js.map +0 -1
  238. package/dist/index.js +0 -8468
  239. package/dist/index.js.map +0 -1
  240. package/dist/style/components/accordion.rn.scss +0 -79
  241. package/dist/style/components/action-sheet.rn.scss +0 -80
  242. package/dist/style/components/activity-indicator.rn.scss +0 -30
  243. package/dist/style/components/article.rn.scss +0 -59
  244. package/dist/style/components/avatar.rn.scss +0 -46
  245. package/dist/style/components/badge.rn.scss +0 -52
  246. package/dist/style/components/button.rn.scss +0 -80
  247. package/dist/style/components/calendar.rn.scss +0 -182
  248. package/dist/style/components/card.rn.scss +0 -88
  249. package/dist/style/components/checkbox.rn.scss +0 -108
  250. package/dist/style/components/countdown.rn.scss +0 -82
  251. package/dist/style/components/curtain.rn.scss +0 -129
  252. package/dist/style/components/divider.rn.scss +0 -33
  253. package/dist/style/components/drawer.rn.scss +0 -72
  254. package/dist/style/components/fab.rn.scss +0 -38
  255. package/dist/style/components/flex.rn.scss +0 -159
  256. package/dist/style/components/float-layout.rn.scss +0 -119
  257. package/dist/style/components/form.rn.scss +0 -12
  258. package/dist/style/components/grid.rn.scss +0 -104
  259. package/dist/style/components/icon.rn.scss +0 -221
  260. package/dist/style/components/image-picker.rn.scss +0 -108
  261. package/dist/style/components/index.rn.scss +0 -51
  262. package/dist/style/components/index.scss +0 -52
  263. package/dist/style/components/indexes.rn.scss +0 -53
  264. package/dist/style/components/input-number.rn.scss +0 -82
  265. package/dist/style/components/input.rn.scss +0 -149
  266. package/dist/style/components/list.rn.scss +0 -107
  267. package/dist/style/components/load-more.rn.scss +0 -28
  268. package/dist/style/components/loading.rn.scss +0 -45
  269. package/dist/style/components/message.rn.scss +0 -57
  270. package/dist/style/components/modal.rn.scss +0 -136
  271. package/dist/style/components/nav-bar.rn.scss +0 -123
  272. package/dist/style/components/noticebar.rn.scss +0 -111
  273. package/dist/style/components/pagination.rn.scss +0 -43
  274. package/dist/style/components/progress.rn.scss +0 -105
  275. package/dist/style/components/radio.rn.scss +0 -94
  276. package/dist/style/components/range.rn.scss +0 -52
  277. package/dist/style/components/rate.rn.scss +0 -48
  278. package/dist/style/components/search-bar.rn.scss +0 -134
  279. package/dist/style/components/segmented-control.rn.scss +0 -44
  280. package/dist/style/components/slider.rn.scss +0 -33
  281. package/dist/style/components/steps.rn.scss +0 -131
  282. package/dist/style/components/swipe-action.rn.scss +0 -53
  283. package/dist/style/components/switch.rn.scss +0 -61
  284. package/dist/style/components/tab-bar.rn.scss +0 -74
  285. package/dist/style/components/tabs.rn.scss +0 -205
  286. package/dist/style/components/tag.rn.scss +0 -74
  287. package/dist/style/components/textarea.rn.scss +0 -57
  288. package/dist/style/components/timeline.rn.scss +0 -89
  289. package/dist/style/components/toast.rn.scss +0 -112
  290. package/dist/style/index.rn.scss +0 -14
  291. package/dist/style/mixins/index.rn.scss +0 -18
  292. package/dist/style/mixins/index.scss +0 -18
  293. package/dist/style/mixins/libs/absolute-center.rn.scss +0 -9
  294. package/dist/style/mixins/libs/active.rn.scss +0 -10
  295. package/dist/style/mixins/libs/alignhack.rn.scss +0 -11
  296. package/dist/style/mixins/libs/border.rn.scss +0 -48
  297. package/dist/style/mixins/libs/clearfix.rn.scss +0 -21
  298. package/dist/style/mixins/libs/disabled.rn.scss +0 -6
  299. package/dist/style/mixins/libs/flex.rn.scss +0 -49
  300. package/dist/style/mixins/libs/hairline.rn.scss +0 -209
  301. package/dist/style/mixins/libs/line.rn.scss +0 -14
  302. package/dist/style/mixins/libs/overlay.rn.scss +0 -11
  303. package/dist/style/mixins/libs/placeholder.rn.scss +0 -12
  304. package/dist/style/mixins/libs/shade.rn.scss +0 -23
  305. package/dist/style/mixins/libs/tint.rn.scss +0 -23
  306. package/dist/style/themes/purple.rn.scss +0 -44
  307. package/dist/style/themes/red.rn.scss +0 -45
  308. package/dist/style/variables/default.rn.scss +0 -461
  309. package/types/accordion.d.ts +0 -49
  310. package/types/action-sheet.d.ts +0 -55
  311. package/types/activity-indicator.d.ts +0 -33
  312. package/types/avatar.d.ts +0 -39
  313. package/types/badge.d.ts +0 -24
  314. package/types/base.d.ts +0 -26
  315. package/types/button.d.ts +0 -70
  316. package/types/calendar.d.ts +0 -225
  317. package/types/card.d.ts +0 -48
  318. package/types/checkbox.d.ts +0 -24
  319. package/types/countdown.d.ts +0 -95
  320. package/types/curtain.d.ts +0 -26
  321. package/types/divider.d.ts +0 -33
  322. package/types/drawer.d.ts +0 -48
  323. package/types/fab.d.ts +0 -21
  324. package/types/flex.d.ts +0 -27
  325. package/types/float-button.d.ts +0 -26
  326. package/types/float-layout.d.ts +0 -73
  327. package/types/form.d.ts +0 -26
  328. package/types/grid.d.ts +0 -51
  329. package/types/icon.d.ts +0 -12
  330. package/types/image-picker.d.ts +0 -73
  331. package/types/index.d.ts +0 -55
  332. package/types/indexes.d.ts +0 -76
  333. package/types/input-number.d.ts +0 -89
  334. package/types/input.d.ts +0 -162
  335. package/types/list.d.ts +0 -84
  336. package/types/load-more.d.ts +0 -43
  337. package/types/message.d.ts +0 -43
  338. package/types/modal.d.ts +0 -62
  339. package/types/nav-bar.d.ts +0 -65
  340. package/types/noticebar.d.ts +0 -65
  341. package/types/pagination.d.ts +0 -51
  342. package/types/progress.d.ts +0 -30
  343. package/types/radio.d.ts +0 -47
  344. package/types/range.d.ts +0 -63
  345. package/types/rate.d.ts +0 -34
  346. package/types/search-bar.d.ts +0 -105
  347. package/types/segmented-control.d.ts +0 -44
  348. package/types/slider.d.ts +0 -73
  349. package/types/steps.d.ts +0 -69
  350. package/types/swipe-action.d.ts +0 -86
  351. package/types/switch.d.ts +0 -38
  352. package/types/tab-bar.d.ts +0 -98
  353. package/types/tabs-pane.d.ts +0 -25
  354. package/types/tabs.d.ts +0 -62
  355. package/types/tag.d.ts +0 -48
  356. package/types/textarea.d.ts +0 -113
  357. package/types/timeline.d.ts +0 -46
  358. package/types/toast.d.ts +0 -53
  359. /package/{dist → lib}/style/components/accordion.scss +0 -0
  360. /package/{dist → lib}/style/components/action-sheet.scss +0 -0
  361. /package/{dist → lib}/style/components/activity-indicator.scss +0 -0
  362. /package/{dist → lib}/style/components/article.scss +0 -0
  363. /package/{dist → lib}/style/components/avatar.scss +0 -0
  364. /package/{dist → lib}/style/components/badge.scss +0 -0
  365. /package/{dist → lib}/style/components/button.scss +0 -0
  366. /package/{dist → lib}/style/components/calendar.scss +0 -0
  367. /package/{dist → lib}/style/components/card.scss +0 -0
  368. /package/{dist → lib}/style/components/checkbox.scss +0 -0
  369. /package/{dist → lib}/style/components/countdown.scss +0 -0
  370. /package/{dist → lib}/style/components/divider.scss +0 -0
  371. /package/{dist → lib}/style/components/drawer.scss +0 -0
  372. /package/{dist → lib}/style/components/fab.scss +0 -0
  373. /package/{dist → lib}/style/components/flex.scss +0 -0
  374. /package/{dist → lib}/style/components/float-layout.scss +0 -0
  375. /package/{dist → lib}/style/components/form.scss +0 -0
  376. /package/{dist → lib}/style/components/icon.scss +0 -0
  377. /package/{dist → lib}/style/components/image-picker.scss +0 -0
  378. /package/{dist → lib}/style/components/indexes.scss +0 -0
  379. /package/{dist → lib}/style/components/input-number.scss +0 -0
  380. /package/{dist → lib}/style/components/input.scss +0 -0
  381. /package/{dist → lib}/style/components/load-more.scss +0 -0
  382. /package/{dist → lib}/style/components/loading.scss +0 -0
  383. /package/{dist → lib}/style/components/message.scss +0 -0
  384. /package/{dist → lib}/style/components/modal.scss +0 -0
  385. /package/{dist → lib}/style/components/nav-bar.scss +0 -0
  386. /package/{dist → lib}/style/components/noticebar.scss +0 -0
  387. /package/{dist → lib}/style/components/pagination.scss +0 -0
  388. /package/{dist → lib}/style/components/progress.scss +0 -0
  389. /package/{dist → lib}/style/components/radio.scss +0 -0
  390. /package/{dist → lib}/style/components/rate.scss +0 -0
  391. /package/{dist → lib}/style/components/search-bar.scss +0 -0
  392. /package/{dist → lib}/style/components/segmented-control.scss +0 -0
  393. /package/{dist → lib}/style/components/slider.scss +0 -0
  394. /package/{dist → lib}/style/components/steps.scss +0 -0
  395. /package/{dist → lib}/style/components/swipe-action.scss +0 -0
  396. /package/{dist → lib}/style/components/switch.scss +0 -0
  397. /package/{dist → lib}/style/components/tab-bar.scss +0 -0
  398. /package/{dist → lib}/style/components/tabs.scss +0 -0
  399. /package/{dist → lib}/style/components/tag.scss +0 -0
  400. /package/{dist → lib}/style/components/textarea.scss +0 -0
  401. /package/{dist → lib}/style/components/timeline.scss +0 -0
  402. /package/{dist → lib}/style/index.scss +0 -0
  403. /package/{dist → lib}/style/mixins/libs/absolute-center.scss +0 -0
  404. /package/{dist → lib}/style/mixins/libs/active.scss +0 -0
  405. /package/{dist → lib}/style/mixins/libs/alignhack.scss +0 -0
  406. /package/{dist → lib}/style/mixins/libs/border.scss +0 -0
  407. /package/{dist → lib}/style/mixins/libs/clearfix.scss +0 -0
  408. /package/{dist → lib}/style/mixins/libs/disabled.scss +0 -0
  409. /package/{dist → lib}/style/mixins/libs/flex.scss +0 -0
  410. /package/{dist → lib}/style/mixins/libs/hairline.scss +0 -0
  411. /package/{dist → lib}/style/mixins/libs/line.scss +0 -0
  412. /package/{dist → lib}/style/mixins/libs/overlay.scss +0 -0
  413. /package/{dist → lib}/style/mixins/libs/placeholder.scss +0 -0
  414. /package/{dist → lib}/style/themes/purple.scss +0 -0
  415. /package/{dist → lib}/style/themes/red.scss +0 -0
@@ -1,137 +1,152 @@
1
- import classNames from 'classnames';
2
- import PropTypes from 'prop-types';
3
- import React from 'react';
4
- import { View } from '@tarojs/components';
5
- import AtCountdownItem from './item';
1
+ import classNames from "classnames";
2
+ import PropTypes from "prop-types";
3
+ import React from "react";
4
+ import { View } from "@tarojs/components";
5
+ import AtCountdownItem from "./item";
6
6
  const toSeconds = (day, hours, minutes, seconds) => day * 60 * 60 * 24 + hours * 60 * 60 + minutes * 60 + seconds;
7
7
  const defaultFormat = {
8
- day: '天',
9
- hours: '时',
10
- minutes: '分',
11
- seconds: '秒'
8
+ day: "\u5929",
9
+ hours: "\u65F6",
10
+ minutes: "\u5206",
11
+ seconds: "\u79D2"
12
12
  };
13
- export default class AtCountdown extends React.Component {
14
- constructor(props) {
15
- super(props);
16
- const { day = 0, hours = 0, minutes = 0, seconds = 0 } = this.props;
17
- this.seconds = toSeconds(day, hours, minutes, seconds);
18
- const { day: _day, hours: _hours, minutes: _minutes, seconds: _seconds } = this.calculateTime();
19
- this.state = {
20
- _day,
21
- _hours,
22
- _minutes,
23
- _seconds
24
- };
13
+ class AtCountdown extends React.Component {
14
+ constructor(props) {
15
+ super(props);
16
+ const { day = 0, hours = 0, minutes = 0, seconds = 0 } = this.props;
17
+ this.seconds = toSeconds(day, hours, minutes, seconds);
18
+ const {
19
+ day: _day,
20
+ hours: _hours,
21
+ minutes: _minutes,
22
+ seconds: _seconds
23
+ } = this.calculateTime();
24
+ this.state = {
25
+ _day,
26
+ _hours,
27
+ _minutes,
28
+ _seconds
29
+ };
30
+ }
31
+ setTimer() {
32
+ if (!this.timer) this.countdonwn();
33
+ }
34
+ clearTimer() {
35
+ if (this.timer) {
36
+ clearTimeout(this.timer);
37
+ this.timer = 0;
25
38
  }
26
- setTimer() {
27
- if (!this.timer)
28
- this.countdonwn();
39
+ }
40
+ calculateTime() {
41
+ let [day, hours, minutes, seconds] = [0, 0, 0, 0];
42
+ if (this.seconds > 0) {
43
+ day = this.props.isShowDay ? Math.floor(this.seconds / (60 * 60 * 24)) : 0;
44
+ hours = this.props.isShowHour ? Math.floor(this.seconds / (60 * 60)) - day * 24 : 0;
45
+ minutes = this.props.isShowMinute ? Math.floor(this.seconds / 60) - day * 24 * 60 - hours * 60 : 0;
46
+ seconds = Math.floor(this.seconds) - day * 24 * 60 * 60 - hours * 60 * 60 - minutes * 60;
29
47
  }
30
- clearTimer() {
31
- if (this.timer) {
32
- clearTimeout(this.timer);
33
- this.timer = 0;
34
- }
35
- }
36
- calculateTime() {
37
- let [day, hours, minutes, seconds] = [0, 0, 0, 0];
38
- if (this.seconds > 0) {
39
- day = this.props.isShowDay ? Math.floor(this.seconds / (60 * 60 * 24)) : 0;
40
- hours = this.props.isShowHour
41
- ? Math.floor(this.seconds / (60 * 60)) - day * 24
42
- : 0;
43
- minutes = this.props.isShowMinute
44
- ? Math.floor(this.seconds / 60) - day * 24 * 60 - hours * 60
45
- : 0;
46
- seconds =
47
- Math.floor(this.seconds) -
48
- day * 24 * 60 * 60 -
49
- hours * 60 * 60 -
50
- minutes * 60;
51
- }
52
- return {
53
- day,
54
- hours,
55
- minutes,
56
- seconds
57
- };
58
- }
59
- countdonwn() {
60
- const { day, hours, minutes, seconds } = this.calculateTime();
61
- this.setState({
62
- _day: day,
63
- _hours: hours,
64
- _minutes: minutes,
65
- _seconds: seconds
66
- });
67
- this.seconds--;
68
- if (this.seconds < 0) {
69
- this.clearTimer();
70
- this.props.onTimeUp && this.props.onTimeUp();
71
- return;
72
- }
73
- this.timer = setTimeout(() => {
74
- this.countdonwn();
75
- }, 1000);
76
- }
77
- UNSAFE_componentWillReceiveProps(nextProps) {
78
- if (JSON.stringify(this.props) === JSON.stringify(nextProps))
79
- return;
80
- const { day = 0, hours = 0, minutes = 0, seconds = 0 } = nextProps;
81
- this.seconds = toSeconds(day, hours, minutes, seconds);
82
- this.clearTimer();
83
- this.setTimer();
84
- }
85
- componentDidMount() {
86
- this.setTimer();
87
- }
88
- componentWillUnmount() {
89
- this.clearTimer();
90
- }
91
- componentDidHide() {
92
- this.clearTimer();
93
- }
94
- componentDidShow() {
95
- this.setTimer();
96
- }
97
- render() {
98
- const { className, customStyle, format = defaultFormat, isCard, isShowDay, isShowHour, isShowMinute } = this.props;
99
- const { _day, _hours, _minutes, _seconds } = this.state;
100
- return (React.createElement(View, { className: classNames({
101
- 'at-countdown': true,
102
- 'at-countdown--card': isCard
103
- }, className), style: customStyle },
104
- isShowDay && (React.createElement(AtCountdownItem, { num: _day, separator: (format === null || format === void 0 ? void 0 : format.day) || '天' })),
105
- isShowHour && (React.createElement(AtCountdownItem, { num: _hours, separator: (format === null || format === void 0 ? void 0 : format.hours) || '' })),
106
- isShowMinute && (React.createElement(AtCountdownItem, { num: _minutes, separator: (format === null || format === void 0 ? void 0 : format.minutes) || '' })),
107
- React.createElement(AtCountdownItem, { num: _seconds, separator: (format === null || format === void 0 ? void 0 : format.seconds) || '' })));
48
+ return {
49
+ day,
50
+ hours,
51
+ minutes,
52
+ seconds
53
+ };
54
+ }
55
+ countdonwn() {
56
+ const { day, hours, minutes, seconds } = this.calculateTime();
57
+ this.setState({
58
+ _day: day,
59
+ _hours: hours,
60
+ _minutes: minutes,
61
+ _seconds: seconds
62
+ });
63
+ this.seconds--;
64
+ if (this.seconds < 0) {
65
+ this.clearTimer();
66
+ this.props.onTimeUp && this.props.onTimeUp();
67
+ return;
108
68
  }
69
+ this.timer = setTimeout(() => {
70
+ this.countdonwn();
71
+ }, 1e3);
72
+ }
73
+ UNSAFE_componentWillReceiveProps(nextProps) {
74
+ if (JSON.stringify(this.props) === JSON.stringify(nextProps)) return;
75
+ const { day = 0, hours = 0, minutes = 0, seconds = 0 } = nextProps;
76
+ this.seconds = toSeconds(day, hours, minutes, seconds);
77
+ this.clearTimer();
78
+ this.setTimer();
79
+ }
80
+ componentDidMount() {
81
+ this.setTimer();
82
+ }
83
+ componentWillUnmount() {
84
+ this.clearTimer();
85
+ }
86
+ componentDidHide() {
87
+ this.clearTimer();
88
+ }
89
+ componentDidShow() {
90
+ this.setTimer();
91
+ }
92
+ render() {
93
+ const {
94
+ className,
95
+ customStyle,
96
+ format = defaultFormat,
97
+ isCard,
98
+ isShowDay,
99
+ isShowHour,
100
+ isShowMinute
101
+ } = this.props;
102
+ const { _day, _hours, _minutes, _seconds } = this.state;
103
+ return /* @__PURE__ */ React.createElement(
104
+ View,
105
+ {
106
+ className: classNames(
107
+ {
108
+ "at-countdown": true,
109
+ "at-countdown--card": isCard
110
+ },
111
+ className
112
+ ),
113
+ style: customStyle
114
+ },
115
+ isShowDay && /* @__PURE__ */ React.createElement(AtCountdownItem, { num: _day, separator: (format == null ? void 0 : format.day) || "\u5929" }),
116
+ isShowHour && /* @__PURE__ */ React.createElement(AtCountdownItem, { num: _hours, separator: (format == null ? void 0 : format.hours) || "" }),
117
+ isShowMinute && /* @__PURE__ */ React.createElement(AtCountdownItem, { num: _minutes, separator: (format == null ? void 0 : format.minutes) || "" }),
118
+ /* @__PURE__ */ React.createElement(AtCountdownItem, { num: _seconds, separator: (format == null ? void 0 : format.seconds) || "" })
119
+ );
120
+ }
109
121
  }
110
122
  AtCountdown.defaultProps = {
111
- customStyle: '',
112
- className: '',
113
- isCard: false,
114
- isShowDay: false,
115
- isShowHour: true,
116
- isShowMinute: true,
117
- format: defaultFormat,
118
- day: 0,
119
- hours: 0,
120
- minutes: 0,
121
- seconds: 0
123
+ customStyle: "",
124
+ className: "",
125
+ isCard: false,
126
+ isShowDay: false,
127
+ isShowHour: true,
128
+ isShowMinute: true,
129
+ format: defaultFormat,
130
+ day: 0,
131
+ hours: 0,
132
+ minutes: 0,
133
+ seconds: 0
122
134
  };
123
135
  AtCountdown.propTypes = {
124
- customStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
125
- className: PropTypes.oneOfType([PropTypes.array, PropTypes.string]),
126
- isCard: PropTypes.bool,
127
- isShowDay: PropTypes.bool,
128
- isShowHour: PropTypes.bool,
129
- isShowMinute: PropTypes.bool,
130
- format: PropTypes.object,
131
- day: PropTypes.number,
132
- hours: PropTypes.number,
133
- minutes: PropTypes.number,
134
- seconds: PropTypes.number,
135
- onTimeUp: PropTypes.func
136
+ customStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
137
+ className: PropTypes.oneOfType([PropTypes.array, PropTypes.string]),
138
+ isCard: PropTypes.bool,
139
+ isShowDay: PropTypes.bool,
140
+ isShowHour: PropTypes.bool,
141
+ isShowMinute: PropTypes.bool,
142
+ format: PropTypes.object,
143
+ day: PropTypes.number,
144
+ hours: PropTypes.number,
145
+ minutes: PropTypes.number,
146
+ seconds: PropTypes.number,
147
+ onTimeUp: PropTypes.func
148
+ };
149
+ export {
150
+ AtCountdown as default
136
151
  };
137
152
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/countdown/index.tsx"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,YAAY,CAAA;A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AAI;IAChB,YAAY,EAAE,IAAI;IAClB,MAAM,EAAE,aAAa;IACrB,GAAG,EAAE,CAAC;IACN,KAAK,EAAE,CAAC;IACR,OAAO,EAAE,CAAC;IACV,OAAO,EAAE,CAAC;CACX,CAAA;AAED,WAAW,CAAC,SAAS,GAAG;IACtB,WAAW,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;IACtE,SAAS,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,KAAK,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;IACnE,MAAM,EAAE,SAAS,CAAC,IAAI;IACtB,SAAS,EAAE,SAAS,CAAC,IAAI;IACzB,UAAU,EAAE,SAAS,CAAC,IAAI;IAC1B,YAAY,EAAE,SAAS,CAAC,IAAI;IAC5B,MAAM,EAAE,SAAS,CAAC,MAAM;IACxB,GAAG,EAAE,SAAS,CAAC,MAAM;IACrB,KAAK,EAAE,SAAS,CAAC,MAAM;IACvB,OAAO,EAAE,SAAS,CAAC,MAAM;IACzB,OAAO,EAAE,SAAS,CAAC,MAAM;IACzB,QAAQ,EAAE,SAAS,CAAC,IAAI;CACzB,CAAA"}
1
+ {"version":3,"sources":["../../../src/components/countdown/index.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport PropTypes, { InferProps } from 'prop-types'\nimport React from 'react'\nimport { View } from '@tarojs/components'\nimport { AtCountDownProps, AtCountdownState } from '../../../types/countdown'\nimport AtCountdownItem from './item'\n\ntype TimeObject = {\n day: number\n hours: number\n minutes: number\n seconds: number\n}\n\nconst toSeconds = (\n day: number,\n hours: number,\n minutes: number,\n seconds: number\n): number => day * 60 * 60 * 24 + hours * 60 * 60 + minutes * 60 + seconds\n\nconst defaultFormat = {\n day: '天',\n hours: '时',\n minutes: '分',\n seconds: '秒'\n}\n\nexport default class AtCountdown extends React.Component<\n AtCountDownProps,\n AtCountdownState\n> {\n public static defaultProps: AtCountDownProps\n public static propTypes: InferProps<AtCountDownProps>\n\n private seconds: number\n private timer: NodeJS.Timeout | number | undefined\n\n public constructor(props: AtCountDownProps) {\n super(props)\n const { day = 0, hours = 0, minutes = 0, seconds = 0 } = this.props\n this.seconds = toSeconds(day, hours, minutes, seconds)\n const {\n day: _day,\n hours: _hours,\n minutes: _minutes,\n seconds: _seconds\n } = this.calculateTime()\n\n this.state = {\n _day,\n _hours,\n _minutes,\n _seconds\n }\n }\n\n private setTimer(): void {\n if (!this.timer) this.countdonwn()\n }\n\n private clearTimer(): void {\n if (this.timer) {\n clearTimeout(this.timer as number)\n this.timer = 0\n }\n }\n\n private calculateTime(): TimeObject {\n let [day, hours, minutes, seconds] = [0, 0, 0, 0]\n\n if (this.seconds > 0) {\n day = this.props.isShowDay ? Math.floor(this.seconds / (60 * 60 * 24)) : 0\n hours = this.props.isShowHour\n ? Math.floor(this.seconds / (60 * 60)) - day * 24\n : 0\n minutes = this.props.isShowMinute\n ? Math.floor(this.seconds / 60) - day * 24 * 60 - hours * 60\n : 0\n seconds =\n Math.floor(this.seconds) -\n day * 24 * 60 * 60 -\n hours * 60 * 60 -\n minutes * 60\n }\n return {\n day,\n hours,\n minutes,\n seconds\n }\n }\n\n private countdonwn(): void {\n const { day, hours, minutes, seconds } = this.calculateTime()\n\n this.setState({\n _day: day,\n _hours: hours,\n _minutes: minutes,\n _seconds: seconds\n })\n this.seconds--\n\n if (this.seconds < 0) {\n this.clearTimer()\n this.props.onTimeUp && this.props.onTimeUp()\n return\n }\n\n this.timer = setTimeout(() => {\n this.countdonwn()\n }, 1000)\n }\n\n public UNSAFE_componentWillReceiveProps(nextProps: AtCountDownProps): void {\n if (JSON.stringify(this.props) === JSON.stringify(nextProps)) return\n\n const { day = 0, hours = 0, minutes = 0, seconds = 0 } = nextProps\n this.seconds = toSeconds(day, hours, minutes, seconds)\n this.clearTimer()\n this.setTimer()\n }\n\n public componentDidMount(): void {\n this.setTimer()\n }\n\n public componentWillUnmount(): void {\n this.clearTimer()\n }\n\n public componentDidHide(): void {\n this.clearTimer()\n }\n\n public componentDidShow(): void {\n this.setTimer()\n }\n\n public render(): JSX.Element {\n const {\n className,\n customStyle,\n format = defaultFormat,\n isCard,\n isShowDay,\n isShowHour,\n isShowMinute\n } = this.props\n\n const { _day, _hours, _minutes, _seconds } = this.state\n\n return (\n <View\n className={classNames(\n {\n 'at-countdown': true,\n 'at-countdown--card': isCard\n },\n className\n )}\n style={customStyle}\n >\n {isShowDay && (\n <AtCountdownItem num={_day} separator={format?.day || '天'} />\n )}\n {isShowHour && (\n <AtCountdownItem num={_hours} separator={format?.hours || ''} />\n )}\n {isShowMinute && (\n <AtCountdownItem num={_minutes} separator={format?.minutes || ''} />\n )}\n <AtCountdownItem num={_seconds} separator={format?.seconds || ''} />\n </View>\n )\n }\n}\n\nAtCountdown.defaultProps = {\n customStyle: '',\n className: '',\n isCard: false,\n isShowDay: false,\n isShowHour: true,\n isShowMinute: true,\n format: defaultFormat,\n day: 0,\n hours: 0,\n minutes: 0,\n seconds: 0\n}\n\nAtCountdown.propTypes = {\n customStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),\n className: PropTypes.oneOfType([PropTypes.array, PropTypes.string]),\n isCard: PropTypes.bool,\n isShowDay: PropTypes.bool,\n isShowHour: PropTypes.bool,\n isShowMinute: PropTypes.bool,\n format: PropTypes.object,\n day: PropTypes.number,\n hours: PropTypes.number,\n minutes: PropTypes.number,\n seconds: PropTypes.number,\n onTimeUp: PropTypes.func\n}\n"],"mappings":"AAAA,OAAO,gBAAgB;AACvB,OAAO,eAA+B;AACtC,OAAO,WAAW;AAClB,SAAS,YAAY;AAErB,OAAO,qBAAqB;AAS5B,MAAM,YAAY,CAChB,KACA,OACA,SACA,YACW,MAAM,KAAK,KAAK,KAAK,QAAQ,KAAK,KAAK,UAAU,KAAK;AAEnE,MAAM,gBAAgB;AAAA,EACpB,KAAK;AAAA,EACL,OAAO;AAAA,EACP,SAAS;AAAA,EACT,SAAS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C,mBAAgB,KAAK,QAAQ,YAAW,iCAAQ,UAAS,IAAI;AAAA,MAE/D,gBACC,oCAAC,mBAAgB,KAAK,UAAU,YAAW,iCAAQ,YAAW,IAAI;AAAA,MAEpE,oCAAC,mBAAgB,KAAK,UAAU,YAAW,iCAAQ,YAAW,IAAI;AAAA,IACpE;AAAA,EAEJ;AACF;AAEA,YAAY,eAAe;AAAA,EACzB,aAAa;AAAA,EACb,WAAW;AAAA,EACX,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,cAAc;AAAA,EACd,QAAQ;AAAA,EACR,KAAK;AAAA,EACL,OAAO;AAAA,EACP,SAAS;AAAA,EACT,SAAS;AACX;AAEA,YAAY,YAAY;AAAA,EACtB,aAAa,UAAU,UAAU,CAAC,UAAU,QAAQ,UAAU,MAAM,CAAC;AAAA,EACrE,WAAW,UAAU,UAAU,CAAC,UAAU,OAAO,UAAU,MAAM,CAAC;AAAA,EAClE,QAAQ,UAAU;AAAA,EAClB,WAAW,UAAU;AAAA,EACrB,YAAY,UAAU;AAAA,EACtB,cAAc,UAAU;AAAA,EACxB,QAAQ,UAAU;AAAA,EAClB,KAAK,UAAU;AAAA,EACf,OAAO,UAAU;AAAA,EACjB,SAAS,UAAU;AAAA,EACnB,SAAS,UAAU;AAAA,EACnB,UAAU,UAAU;AACtB;","names":[]}
@@ -0,0 +1,9 @@
1
+ import { InferProps } from 'prop-types';
2
+ import React from 'react';
3
+ import { AtCountdownItemProps } from '../../../../types/countdown';
4
+ export default class AtCountdownItem extends React.Component<AtCountdownItemProps> {
5
+ static defaultProps: AtCountdownItemProps;
6
+ static propTypes: InferProps<AtCountdownItemProps>;
7
+ private formatNum;
8
+ render(): JSX.Element;
9
+ }
@@ -1,24 +1,24 @@
1
- import PropTypes from 'prop-types';
2
- import React from 'react';
3
- import { Text, View } from '@tarojs/components';
4
- export default class AtCountdownItem extends React.Component {
5
- formatNum(num) {
6
- return num <= 9 ? `0${num}` : `${num}`;
7
- }
8
- render() {
9
- const { num, separator } = this.props;
10
- return (React.createElement(View, { className: 'at-countdown__item' },
11
- React.createElement(View, { className: 'at-countdown__time-box' },
12
- React.createElement(Text, { className: 'at-countdown__time' }, this.formatNum(num))),
13
- React.createElement(Text, { className: 'at-countdown__separator' }, separator)));
14
- }
1
+ import PropTypes from "prop-types";
2
+ import React from "react";
3
+ import { Text, View } from "@tarojs/components";
4
+ class AtCountdownItem extends React.Component {
5
+ formatNum(num) {
6
+ return num <= 9 ? `0${num}` : `${num}`;
7
+ }
8
+ render() {
9
+ const { num, separator } = this.props;
10
+ return /* @__PURE__ */ React.createElement(View, { className: "at-countdown__item" }, /* @__PURE__ */ React.createElement(View, { className: "at-countdown__time-box" }, /* @__PURE__ */ React.createElement(Text, { className: "at-countdown__time" }, this.formatNum(num))), /* @__PURE__ */ React.createElement(Text, { className: "at-countdown__separator" }, separator));
11
+ }
15
12
  }
16
13
  AtCountdownItem.defaultProps = {
17
- num: 0,
18
- separator: ':'
14
+ num: 0,
15
+ separator: ":"
19
16
  };
20
17
  AtCountdownItem.propTypes = {
21
- num: PropTypes.number.isRequired,
22
- separator: PropTypes.string
18
+ num: PropTypes.number.isRequired,
19
+ separator: PropTypes.string
20
+ };
21
+ export {
22
+ AtCountdownItem as default
23
23
  };
24
24
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/countdown/item/index.tsx"],"names":[],"mappings":"AAAA,OAAO,SAAyB,MAAM,YAAY,CAAA;AAClD,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAA;AAG/C,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,KAAK,CAAC,SAA+B;IAIxE,SAAS,CAAC,GAAW;QAC3B,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,GAAG,EAAE,CAAA;IACxC,CAAC;IAEM,MAAM;QACX,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC,KAAK,CAAA;QAErC,OAAO,CACL,oBAAC,IAAI,IAAC,SAAS,EAAC,oBAAoB;YAClC,oBAAC,IAAI,IAAC,SAAS,EAAC,wBAAwB;gBACtC,oBAAC,IAAI,IAAC,SAAS,EAAC,oBAAoB,IAAE,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAQ,CAC5D;YACP,oBAAC,IAAI,IAAC,SAAS,EAAC,yBAAyB,IAAE,SAAS,CAAQ,CACvD,CACR,CAAA;IACH,CAAC;CACF;AAED,eAAe,CAAC,YAAY,GAAG;IAC7B,GAAG,EAAE,CAAC;IACN,SAAS,EAAE,GAAG;CACf,CAAA;AAED,eAAe,CAAC,SAAS,GAAG;IAC1B,GAAG,EAAE,SAAS,CAAC,MAAM,CAAC,UAAU;IAChC,SAAS,EAAE,SAAS,CAAC,MAAM;CAC5B,CAAA"}
1
+ {"version":3,"sources":["../../../../src/components/countdown/item/index.tsx"],"sourcesContent":["import PropTypes, { InferProps } from 'prop-types'\nimport React from 'react'\nimport { Text, View } from '@tarojs/components'\nimport { AtCountdownItemProps } from '../../../../types/countdown'\n\nexport default class AtCountdownItem extends React.Component<AtCountdownItemProps> {\n public static defaultProps: AtCountdownItemProps\n public static propTypes: InferProps<AtCountdownItemProps>\n\n private formatNum(num: number): string {\n return num <= 9 ? `0${num}` : `${num}`\n }\n\n public render(): JSX.Element {\n const { num, separator } = this.props\n\n return (\n <View className='at-countdown__item'>\n <View className='at-countdown__time-box'>\n <Text className='at-countdown__time'>{this.formatNum(num)}</Text>\n </View>\n <Text className='at-countdown__separator'>{separator}</Text>\n </View>\n )\n }\n}\n\nAtCountdownItem.defaultProps = {\n num: 0,\n separator: ':'\n}\n\nAtCountdownItem.propTypes = {\n num: PropTypes.number.isRequired,\n separator: PropTypes.string\n}\n"],"mappings":"AAAA,OAAO,eAA+B;AACtC,OAAO,WAAW;AAClB,SAAS,MAAM,YAAY;AAG3B,MAAO,wBAAsC,MAAM,UAAgC;AAAA,EAIzE,UAAU,KAAqB;AACrC,WAAO,OAAO,IAAI,IAAI,GAAG,KAAK,GAAG,GAAG;AAAA,EACtC;AAAA,EAEO,SAAsB;AAC3B,UAAM,EAAE,KAAK,UAAU,IAAI,KAAK;AAEhC,WACE,oCAAC,QAAK,WAAU,wBACd,oCAAC,QAAK,WAAU,4BACd,oCAAC,QAAK,WAAU,wBAAsB,KAAK,UAAU,GAAG,CAAE,CAC5D,GACA,oCAAC,QAAK,WAAU,6BAA2B,SAAU,CACvD;AAAA,EAEJ;AACF;AAEA,gBAAgB,eAAe;AAAA,EAC7B,KAAK;AAAA,EACL,WAAW;AACb;AAEA,gBAAgB,YAAY;AAAA,EAC1B,KAAK,UAAU,OAAO;AAAA,EACtB,WAAW,UAAU;AACvB;","names":[]}
@@ -0,0 +1,10 @@
1
+ import { InferProps } from 'prop-types';
2
+ import React from 'react';
3
+ import { AtCurtainProps } from '../../../types/curtain';
4
+ export default class AtCurtain extends React.Component<AtCurtainProps> {
5
+ static defaultProps: AtCurtainProps;
6
+ static propTypes: InferProps<AtCurtainProps>;
7
+ private onClose;
8
+ private _stopPropagation;
9
+ render(): JSX.Element;
10
+ }
@@ -1,45 +1,62 @@
1
- import classNames from 'classnames';
2
- import PropTypes from 'prop-types';
3
- import React from 'react';
4
- import { View } from '@tarojs/components';
5
- export default class AtCurtain extends React.Component {
6
- onClose(e) {
7
- e.stopPropagation();
8
- this.props.onClose(e);
9
- }
10
- _stopPropagation(e) {
11
- e.stopPropagation();
12
- }
13
- render() {
14
- const { className, customStyle, isOpened, closeBtnPosition } = this.props;
15
- const curtainClass = classNames({
16
- 'at-curtain': true,
17
- 'at-curtain--closed': !isOpened
18
- }, className);
19
- const btnCloseClass = classNames({
20
- 'at-curtain__btn-close': true,
21
- [`at-curtain__btn-close--${closeBtnPosition}`]: closeBtnPosition
22
- });
23
- return (React.createElement(View, { className: curtainClass, style: customStyle, onClick: this._stopPropagation },
24
- React.createElement(View, { className: 'at-curtain__container' },
25
- React.createElement(View, { className: 'at-curtain__body' },
26
- this.props.children,
27
- React.createElement(View, { className: btnCloseClass, onClick: this.onClose.bind(this) })))));
28
- }
1
+ import classNames from "classnames";
2
+ import PropTypes from "prop-types";
3
+ import React from "react";
4
+ import { View } from "@tarojs/components";
5
+ class AtCurtain extends React.Component {
6
+ onClose(e) {
7
+ e.stopPropagation();
8
+ this.props.onClose(e);
9
+ }
10
+ _stopPropagation(e) {
11
+ e.stopPropagation();
12
+ }
13
+ render() {
14
+ const { className, customStyle, isOpened, closeBtnPosition } = this.props;
15
+ const curtainClass = classNames(
16
+ {
17
+ "at-curtain": true,
18
+ "at-curtain--closed": !isOpened
19
+ },
20
+ className
21
+ );
22
+ const btnCloseClass = classNames({
23
+ "at-curtain__btn-close": true,
24
+ [`at-curtain__btn-close--${closeBtnPosition}`]: closeBtnPosition
25
+ });
26
+ return /* @__PURE__ */ React.createElement(
27
+ View,
28
+ {
29
+ className: curtainClass,
30
+ style: customStyle,
31
+ onClick: this._stopPropagation
32
+ },
33
+ /* @__PURE__ */ React.createElement(View, { className: "at-curtain__container" }, /* @__PURE__ */ React.createElement(View, { className: "at-curtain__body" }, this.props.children, /* @__PURE__ */ React.createElement(
34
+ View,
35
+ {
36
+ className: btnCloseClass,
37
+ onClick: this.onClose.bind(this)
38
+ }
39
+ )))
40
+ );
41
+ }
29
42
  }
30
43
  AtCurtain.defaultProps = {
31
- customStyle: '',
32
- className: '',
33
- isOpened: false,
34
- closeBtnPosition: 'bottom',
35
- // eslint-disable-next-line @typescript-eslint/no-empty-function
36
- onClose: () => { }
44
+ customStyle: "",
45
+ className: "",
46
+ isOpened: false,
47
+ closeBtnPosition: "bottom",
48
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
49
+ onClose: () => {
50
+ }
37
51
  };
38
52
  AtCurtain.propTypes = {
39
- customStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
40
- className: PropTypes.oneOfType([PropTypes.array, PropTypes.string]),
41
- isOpened: PropTypes.bool,
42
- closeBtnPosition: PropTypes.string,
43
- onClose: PropTypes.func
53
+ customStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
54
+ className: PropTypes.oneOfType([PropTypes.array, PropTypes.string]),
55
+ isOpened: PropTypes.bool,
56
+ closeBtnPosition: PropTypes.string,
57
+ onClose: PropTypes.func
58
+ };
59
+ export {
60
+ AtCurtain as default
44
61
  };
45
62
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/curtain/index.tsx"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,YAAY,CAAA;AACnC,OAAO,SAAyB,MAAM,YAAY,CAAA;AAClD,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAA;AAIzC,MAAM,CAAC,OAAO,OAAO,SAAU,SAAQ,KAAK,CAAC,SAAyB;IAI5D,OAAO,CAAC,CAAc;QAC5B,CAAC,CAAC,eAAe,EAAE,CAAA;QACnB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;IACvB,CAAC;IAEO,gBAAgB,CAAC,CAAc;QACrC,CAAC,CAAC,eAAe,EAAE,CAAA;IACrB,CAAC;IAEM,MAAM;QACX,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,gBAAgB,EAAE,GAAG,IAAI,CAAC,KAAK,CAAA;QAEzE,MAAM,YAAY,GAAG,UAAU,CAC7B;YACE,YAAY,EAAE,IAAI;YAClB,oBAAoB,EAAE,CAAC,QAAQ;SAChC,EACD,SAAS,CACV,CAAA;QACD,MAAM,aAAa,GAAG,UAAU,CAAC;YAC/B,uBAAuB,EAAE,IAAI;YAC7B,CAAC,0BAA0B,gBAAgB,EAAE,CAAC,EAAE,gBAAgB;SACjE,CAAC,CAAA;QAEF,OAAO,CACL,oBAAC,IAAI,IACH,SAAS,EAAE,YAAY,EACvB,KAAK,EAAE,WAAW,EAClB,OAAO,EAAE,IAAI,CAAC,gBAAgB;YAE9B,oBAAC,IAAI,IAAC,SAAS,EAAC,uBAAuB;gBACrC,oBAAC,IAAI,IAAC,SAAS,EAAC,kBAAkB;oBAC/B,IAAI,CAAC,KAAK,CAAC,QAAQ;oBACpB,oBAAC,IAAI,IACH,SAAS,EAAE,aAAa,EACxB,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAC1B,CACH,CACF,CACF,CACR,CAAA;IACH,CAAC;CACF;AAED,SAAS,CAAC,YAAY,GAAG;IACvB,WAAW,EAAE,EAAE;IACf,SAAS,EAAE,EAAE;IACb,QAAQ,EAAE,KAAK;IACf,gBAAgB,EAAE,QAAQ;IAC1B,gEAAgE;IAChE,OAAO,EAAE,GAAS,EAAE,GAAE,CAAC;CACxB,CAAA;AAED,SAAS,CAAC,SAAS,GAAG;IACpB,WAAW,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;IACtE,SAAS,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,KAAK,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;IACnE,QAAQ,EAAE,SAAS,CAAC,IAAI;IACxB,gBAAgB,EAAE,SAAS,CAAC,MAAM;IAClC,OAAO,EAAE,SAAS,CAAC,IAAI;CACxB,CAAA"}
1
+ {"version":3,"sources":["../../../src/components/curtain/index.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport PropTypes, { InferProps } from 'prop-types'\nimport React from 'react'\nimport { View } from '@tarojs/components'\nimport { CommonEvent } from '@tarojs/components/types/common'\nimport { AtCurtainProps } from '../../../types/curtain'\n\nexport default class AtCurtain extends React.Component<AtCurtainProps> {\n public static defaultProps: AtCurtainProps\n public static propTypes: InferProps<AtCurtainProps>\n\n private onClose(e: CommonEvent): void {\n e.stopPropagation()\n this.props.onClose(e)\n }\n\n private _stopPropagation(e: CommonEvent): void {\n e.stopPropagation()\n }\n\n public render(): JSX.Element {\n const { className, customStyle, isOpened, closeBtnPosition } = this.props\n\n const curtainClass = classNames(\n {\n 'at-curtain': true,\n 'at-curtain--closed': !isOpened\n },\n className\n )\n const btnCloseClass = classNames({\n 'at-curtain__btn-close': true,\n [`at-curtain__btn-close--${closeBtnPosition}`]: closeBtnPosition\n })\n\n return (\n <View\n className={curtainClass}\n style={customStyle}\n onClick={this._stopPropagation}\n >\n <View className='at-curtain__container'>\n <View className='at-curtain__body'>\n {this.props.children}\n <View\n className={btnCloseClass}\n onClick={this.onClose.bind(this)}\n ></View>\n </View>\n </View>\n </View>\n )\n }\n}\n\nAtCurtain.defaultProps = {\n customStyle: '',\n className: '',\n isOpened: false,\n closeBtnPosition: 'bottom',\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n onClose: (): void => {}\n}\n\nAtCurtain.propTypes = {\n customStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),\n className: PropTypes.oneOfType([PropTypes.array, PropTypes.string]),\n isOpened: PropTypes.bool,\n closeBtnPosition: PropTypes.string,\n onClose: PropTypes.func\n}\n"],"mappings":"AAAA,OAAO,gBAAgB;AACvB,OAAO,eAA+B;AACtC,OAAO,WAAW;AAClB,SAAS,YAAY;AAIrB,MAAO,kBAAgC,MAAM,UAA0B;AAAA,EAI7D,QAAQ,GAAsB;AACpC,MAAE,gBAAgB;AAClB,SAAK,MAAM,QAAQ,CAAC;AAAA,EACtB;AAAA,EAEQ,iBAAiB,GAAsB;AAC7C,MAAE,gBAAgB;AAAA,EACpB;AAAA,EAEO,SAAsB;AAC3B,UAAM,EAAE,WAAW,aAAa,UAAU,iBAAiB,IAAI,KAAK;AAEpE,UAAM,eAAe;AAAA,MACnB;AAAA,QACE,cAAc;AAAA,QACd,sBAAsB,CAAC;AAAA,MACzB;AAAA,MACA;AAAA,IACF;AACA,UAAM,gBAAgB,WAAW;AAAA,MAC/B,yBAAyB;AAAA,MACzB,CAAC,0BAA0B,gBAAgB,EAAE,GAAG;AAAA,IAClD,CAAC;AAED,WACE;AAAA,MAAC;AAAA;AAAA,QACC,WAAW;AAAA,QACX,OAAO;AAAA,QACP,SAAS,KAAK;AAAA;AAAA,MAEd,oCAAC,QAAK,WAAU,2BACd,oCAAC,QAAK,WAAU,sBACb,KAAK,MAAM,UACZ;AAAA,QAAC;AAAA;AAAA,UACC,WAAW;AAAA,UACX,SAAS,KAAK,QAAQ,KAAK,IAAI;AAAA;AAAA,MAChC,CACH,CACF;AAAA,IACF;AAAA,EAEJ;AACF;AAEA,UAAU,eAAe;AAAA,EACvB,aAAa;AAAA,EACb,WAAW;AAAA,EACX,UAAU;AAAA,EACV,kBAAkB;AAAA;AAAA,EAElB,SAAS,MAAY;AAAA,EAAC;AACxB;AAEA,UAAU,YAAY;AAAA,EACpB,aAAa,UAAU,UAAU,CAAC,UAAU,QAAQ,UAAU,MAAM,CAAC;AAAA,EACrE,WAAW,UAAU,UAAU,CAAC,UAAU,OAAO,UAAU,MAAM,CAAC;AAAA,EAClE,UAAU,UAAU;AAAA,EACpB,kBAAkB,UAAU;AAAA,EAC5B,SAAS,UAAU;AACrB;","names":[]}
@@ -0,0 +1,8 @@
1
+ import { InferProps } from 'prop-types';
2
+ import React from 'react';
3
+ import { AtDividerProps } from '../../../types/divider';
4
+ export default class AtDivider extends React.Component<AtDividerProps> {
5
+ static defaultProps: AtDividerProps;
6
+ static propTypes: InferProps<AtDividerProps>;
7
+ render(): JSX.Element;
8
+ }
@@ -1,40 +1,57 @@
1
- import classNames from 'classnames';
2
- import PropTypes from 'prop-types';
3
- import React from 'react';
4
- import { View } from '@tarojs/components';
5
- import { mergeStyle, pxTransform } from '../../common/utils';
6
- export default class AtDivider extends React.Component {
7
- render() {
8
- const { className, customStyle, content, height, fontColor, fontSize, lineColor } = this.props;
9
- const rootStyle = {
10
- height: height ? `${pxTransform(Number(height))}` : ''
11
- };
12
- const fontStyle = {
13
- color: fontColor,
14
- fontSize: fontSize ? `${pxTransform(Number(fontSize))}` : ''
15
- };
16
- const lineStyle = {
17
- backgroundColor: lineColor
18
- };
19
- return (React.createElement(View, { className: classNames('at-divider', className), style: mergeStyle(rootStyle, customStyle) },
20
- React.createElement(View, { className: 'at-divider__content', style: fontStyle }, content === '' ? this.props.children : content),
21
- React.createElement(View, { className: 'at-divider__line', style: lineStyle })));
22
- }
1
+ import classNames from "classnames";
2
+ import PropTypes from "prop-types";
3
+ import React from "react";
4
+ import { View } from "@tarojs/components";
5
+ import { mergeStyle, pxTransform } from "../../common/utils";
6
+ class AtDivider extends React.Component {
7
+ render() {
8
+ const {
9
+ className,
10
+ customStyle,
11
+ content,
12
+ height,
13
+ fontColor,
14
+ fontSize,
15
+ lineColor
16
+ } = this.props;
17
+ const rootStyle = {
18
+ height: height ? `${pxTransform(Number(height))}` : ""
19
+ };
20
+ const fontStyle = {
21
+ color: fontColor,
22
+ fontSize: fontSize ? `${pxTransform(Number(fontSize))}` : ""
23
+ };
24
+ const lineStyle = {
25
+ backgroundColor: lineColor
26
+ };
27
+ return /* @__PURE__ */ React.createElement(
28
+ View,
29
+ {
30
+ className: classNames("at-divider", className),
31
+ style: mergeStyle(rootStyle, customStyle)
32
+ },
33
+ /* @__PURE__ */ React.createElement(View, { className: "at-divider__content", style: fontStyle }, content === "" ? this.props.children : content),
34
+ /* @__PURE__ */ React.createElement(View, { className: "at-divider__line", style: lineStyle })
35
+ );
36
+ }
23
37
  }
24
38
  AtDivider.defaultProps = {
25
- content: '',
26
- height: 0,
27
- fontColor: '',
28
- fontSize: 0,
29
- lineColor: ''
39
+ content: "",
40
+ height: 0,
41
+ fontColor: "",
42
+ fontSize: 0,
43
+ lineColor: ""
30
44
  };
31
45
  AtDivider.propTypes = {
32
- customStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
33
- className: PropTypes.oneOfType([PropTypes.array, PropTypes.string]),
34
- content: PropTypes.string,
35
- height: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
36
- fontColor: PropTypes.string,
37
- fontSize: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
38
- lineColor: PropTypes.string
46
+ customStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
47
+ className: PropTypes.oneOfType([PropTypes.array, PropTypes.string]),
48
+ content: PropTypes.string,
49
+ height: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
50
+ fontColor: PropTypes.string,
51
+ fontSize: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
52
+ lineColor: PropTypes.string
53
+ };
54
+ export {
55
+ AtDivider as default
39
56
  };
40
57
  //# sourceMappingURL=index.js.map