sard 1.0.0-canary.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (488) hide show
  1. package/dist/accordion/Item.d.ts +17 -0
  2. package/dist/accordion/Item.js +25 -0
  3. package/dist/accordion/index.d.ts +26 -0
  4. package/dist/accordion/index.js +27 -0
  5. package/dist/accordion/index.scss +49 -0
  6. package/dist/action-sheet/ActionSheet.d.ts +24 -0
  7. package/dist/action-sheet/ActionSheet.js +79 -0
  8. package/dist/action-sheet/Agent.d.ts +6 -0
  9. package/dist/action-sheet/Agent.js +7 -0
  10. package/dist/action-sheet/Item.d.ts +16 -0
  11. package/dist/action-sheet/Item.js +22 -0
  12. package/dist/action-sheet/imperative.d.ts +10 -0
  13. package/dist/action-sheet/imperative.js +22 -0
  14. package/dist/action-sheet/index.d.ts +12 -0
  15. package/dist/action-sheet/index.js +10 -0
  16. package/dist/action-sheet/index.scss +148 -0
  17. package/dist/animated/index.d.ts +62 -0
  18. package/dist/animated/index.js +101 -0
  19. package/dist/animated/index.rn.d.ts +4 -0
  20. package/dist/animated/index.rn.js +35 -0
  21. package/dist/avatar/Group.d.ts +9 -0
  22. package/dist/avatar/Group.js +27 -0
  23. package/dist/avatar/index.d.ts +17 -0
  24. package/dist/avatar/index.js +22 -0
  25. package/dist/avatar/index.scss +82 -0
  26. package/dist/badge/index.d.ts +13 -0
  27. package/dist/badge/index.js +16 -0
  28. package/dist/badge/index.scss +81 -0
  29. package/dist/base.d.ts +11 -0
  30. package/dist/base.js +1 -0
  31. package/dist/button/CustomButton.d.ts +9 -0
  32. package/dist/button/CustomButton.js +23 -0
  33. package/dist/button/index.d.ts +21 -0
  34. package/dist/button/index.js +34 -0
  35. package/dist/button/index.scss +346 -0
  36. package/dist/calendar/Day.d.ts +23 -0
  37. package/dist/calendar/Day.js +70 -0
  38. package/dist/calendar/MonthPicker.d.ts +13 -0
  39. package/dist/calendar/MonthPicker.js +22 -0
  40. package/dist/calendar/Toolbar.d.ts +11 -0
  41. package/dist/calendar/Toolbar.js +18 -0
  42. package/dist/calendar/Weeks.d.ts +6 -0
  43. package/dist/calendar/Weeks.js +18 -0
  44. package/dist/calendar/index.d.ts +48 -0
  45. package/dist/calendar/index.js +193 -0
  46. package/dist/calendar/index.scss +210 -0
  47. package/dist/card/index.d.ts +15 -0
  48. package/dist/card/index.js +14 -0
  49. package/dist/card/index.scss +64 -0
  50. package/dist/cascader/index.d.ts +43 -0
  51. package/dist/cascader/index.js +216 -0
  52. package/dist/cascader/index.scss +130 -0
  53. package/dist/checkbox/Group.d.ts +5 -0
  54. package/dist/checkbox/Group.js +5 -0
  55. package/dist/checkbox/index.d.ts +10 -0
  56. package/dist/checkbox/index.js +8 -0
  57. package/dist/checkbox/index.scss +78 -0
  58. package/dist/collapse/index.d.ts +14 -0
  59. package/dist/collapse/index.js +61 -0
  60. package/dist/collapse/index.rn.d.ts +14 -0
  61. package/dist/collapse/index.rn.js +76 -0
  62. package/dist/collapse/index.scss +31 -0
  63. package/dist/components.d.ts +66 -0
  64. package/dist/components.js +66 -0
  65. package/dist/components.scss +65 -0
  66. package/dist/config-provider/index.d.ts +21 -0
  67. package/dist/config-provider/index.js +20 -0
  68. package/dist/count-down/index.d.ts +26 -0
  69. package/dist/count-down/index.js +95 -0
  70. package/dist/datetime-picker/index.d.ts +36 -0
  71. package/dist/datetime-picker/index.js +230 -0
  72. package/dist/dialog/Agent.d.ts +6 -0
  73. package/dist/dialog/Agent.js +7 -0
  74. package/dist/dialog/Dialog.d.ts +31 -0
  75. package/dist/dialog/Dialog.js +103 -0
  76. package/dist/dialog/imperative.d.ts +17 -0
  77. package/dist/dialog/imperative.js +35 -0
  78. package/dist/dialog/index.d.ts +14 -0
  79. package/dist/dialog/index.js +12 -0
  80. package/dist/dialog/index.scss +156 -0
  81. package/dist/dropdown/Item.d.ts +33 -0
  82. package/dist/dropdown/Item.js +164 -0
  83. package/dist/dropdown/Option.d.ts +10 -0
  84. package/dist/dropdown/Option.js +12 -0
  85. package/dist/dropdown/index.d.ts +20 -0
  86. package/dist/dropdown/index.js +59 -0
  87. package/dist/dropdown/index.scss +236 -0
  88. package/dist/ellipsis/index.d.ts +8 -0
  89. package/dist/ellipsis/index.js +18 -0
  90. package/dist/ellipsis/index.scss +23 -0
  91. package/dist/empty/index.d.ts +10 -0
  92. package/dist/empty/index.js +14 -0
  93. package/dist/empty/index.scss +59 -0
  94. package/dist/footer-bar/index.d.ts +8 -0
  95. package/dist/footer-bar/index.js +15 -0
  96. package/dist/footer-bar/index.scss +29 -0
  97. package/dist/form/CustomForm.d.ts +13 -0
  98. package/dist/form/CustomForm.js +26 -0
  99. package/dist/form/ErrorList.d.ts +6 -0
  100. package/dist/form/ErrorList.js +15 -0
  101. package/dist/form/Field.d.ts +41 -0
  102. package/dist/form/Field.js +124 -0
  103. package/dist/form/FieldContext.d.ts +18 -0
  104. package/dist/form/FieldContext.js +8 -0
  105. package/dist/form/List.d.ts +31 -0
  106. package/dist/form/List.js +87 -0
  107. package/dist/form/Map.d.ts +17 -0
  108. package/dist/form/Map.js +24 -0
  109. package/dist/form/NodeContext.d.ts +12 -0
  110. package/dist/form/NodeContext.js +14 -0
  111. package/dist/form/Validator.d.ts +88 -0
  112. package/dist/form/Validator.js +268 -0
  113. package/dist/form/createFormStore.d.ts +36 -0
  114. package/dist/form/createFormStore.js +249 -0
  115. package/dist/form/index.d.ts +43 -0
  116. package/dist/form/index.js +109 -0
  117. package/dist/form/index.scss +200 -0
  118. package/dist/form/store/Context.d.ts +4 -0
  119. package/dist/form/store/Context.js +3 -0
  120. package/dist/form/store/createStore.d.ts +6 -0
  121. package/dist/form/store/createStore.js +28 -0
  122. package/dist/form/store/useDispatch.d.ts +2 -0
  123. package/dist/form/store/useDispatch.js +10 -0
  124. package/dist/form/store/useSelector.d.ts +7 -0
  125. package/dist/form/store/useSelector.js +35 -0
  126. package/dist/form/type.d.ts +20 -0
  127. package/dist/form/type.js +1 -0
  128. package/dist/form/useForm.d.ts +27 -0
  129. package/dist/form/useForm.js +14 -0
  130. package/dist/form/useInternalWatch.d.ts +3 -0
  131. package/dist/form/useInternalWatch.js +27 -0
  132. package/dist/form/useNode.d.ts +49 -0
  133. package/dist/form/useNode.js +284 -0
  134. package/dist/form/useValidator.d.ts +23 -0
  135. package/dist/form/useValidator.js +74 -0
  136. package/dist/form/useWatch.d.ts +4 -0
  137. package/dist/form/useWatch.js +24 -0
  138. package/dist/grid/Col.d.ts +9 -0
  139. package/dist/grid/Col.js +20 -0
  140. package/dist/grid/Row.d.ts +11 -0
  141. package/dist/grid/Row.js +34 -0
  142. package/dist/grid/index.d.ts +2 -0
  143. package/dist/grid/index.js +2 -0
  144. package/dist/grid/index.scss +56 -0
  145. package/dist/halfline/index.d.ts +10 -0
  146. package/dist/halfline/index.js +27 -0
  147. package/dist/halfline/index.scss +80 -0
  148. package/dist/icon/common.d.ts +15 -0
  149. package/dist/icon/common.js +1 -0
  150. package/dist/icon/font/iconfont.json +275 -0
  151. package/dist/icon/font/iconfont.rn.scss +0 -0
  152. package/dist/icon/font/iconfont.scss +164 -0
  153. package/dist/icon/font/iconfont.ttf +0 -0
  154. package/dist/icon/fontLoader.d.ts +7 -0
  155. package/dist/icon/fontLoader.js +14 -0
  156. package/dist/icon/fontLoader.rn.d.ts +6 -0
  157. package/dist/icon/fontLoader.rn.js +52 -0
  158. package/dist/icon/index.d.ts +21 -0
  159. package/dist/icon/index.js +41 -0
  160. package/dist/icon/index.scss +23 -0
  161. package/dist/index-bar/Item.d.ts +9 -0
  162. package/dist/index-bar/Item.js +11 -0
  163. package/dist/index-bar/Nav.d.ts +13 -0
  164. package/dist/index-bar/Nav.js +75 -0
  165. package/dist/index-bar/index.d.ts +19 -0
  166. package/dist/index-bar/index.js +142 -0
  167. package/dist/index-bar/index.scss +153 -0
  168. package/dist/index.d.ts +3 -0
  169. package/dist/index.js +3 -0
  170. package/dist/index.scss +1 -0
  171. package/dist/input/index.d.ts +37 -0
  172. package/dist/input/index.js +116 -0
  173. package/dist/input/index.scss +249 -0
  174. package/dist/linear-gradient/index.d.ts +14 -0
  175. package/dist/linear-gradient/index.js +30 -0
  176. package/dist/linear-gradient/index.rn.d.ts +3 -0
  177. package/dist/linear-gradient/index.rn.js +3 -0
  178. package/dist/list/Item.d.ts +22 -0
  179. package/dist/list/Item.js +26 -0
  180. package/dist/list/ListContext.d.ts +9 -0
  181. package/dist/list/ListContext.js +2 -0
  182. package/dist/list/OrderContext.d.ts +8 -0
  183. package/dist/list/OrderContext.js +6 -0
  184. package/dist/list/index.d.ts +19 -0
  185. package/dist/list/index.js +29 -0
  186. package/dist/list/index.scss +257 -0
  187. package/dist/loading/index.d.ts +10 -0
  188. package/dist/loading/index.js +47 -0
  189. package/dist/loading/index.scss +25 -0
  190. package/dist/locale/index.d.ts +199 -0
  191. package/dist/locale/index.js +36 -0
  192. package/dist/locale/lang/en-US.d.ts +92 -0
  193. package/dist/locale/lang/en-US.js +92 -0
  194. package/dist/locale/lang/zh-CN.d.ts +92 -0
  195. package/dist/locale/lang/zh-CN.js +92 -0
  196. package/dist/locale/useTranslate.d.ts +7 -0
  197. package/dist/locale/useTranslate.js +41 -0
  198. package/dist/mask/index.d.ts +13 -0
  199. package/dist/mask/index.js +26 -0
  200. package/dist/mask/index.scss +24 -0
  201. package/dist/menu/Item.d.ts +15 -0
  202. package/dist/menu/Item.js +17 -0
  203. package/dist/menu/index.d.ts +17 -0
  204. package/dist/menu/index.js +15 -0
  205. package/dist/menu/index.scss +128 -0
  206. package/dist/mesh/Item.d.ts +16 -0
  207. package/dist/mesh/Item.js +16 -0
  208. package/dist/mesh/index.d.ts +14 -0
  209. package/dist/mesh/index.js +69 -0
  210. package/dist/mesh/index.scss +131 -0
  211. package/dist/mesh/type.d.ts +9 -0
  212. package/dist/mesh/type.js +1 -0
  213. package/dist/modal/index.d.ts +8 -0
  214. package/dist/modal/index.js +9 -0
  215. package/dist/modal/index.rn.d.ts +8 -0
  216. package/dist/modal/index.rn.js +8 -0
  217. package/dist/navbar/Item.d.ts +8 -0
  218. package/dist/navbar/Item.js +11 -0
  219. package/dist/navbar/index.d.ts +15 -0
  220. package/dist/navbar/index.js +16 -0
  221. package/dist/navbar/index.scss +128 -0
  222. package/dist/notice-bar/index.d.ts +28 -0
  223. package/dist/notice-bar/index.js +135 -0
  224. package/dist/notice-bar/index.scss +109 -0
  225. package/dist/notify/Agent.d.ts +6 -0
  226. package/dist/notify/Agent.js +7 -0
  227. package/dist/notify/Notify.d.ts +22 -0
  228. package/dist/notify/Notify.js +48 -0
  229. package/dist/notify/imperative.d.ts +18 -0
  230. package/dist/notify/imperative.js +35 -0
  231. package/dist/notify/index.d.ts +15 -0
  232. package/dist/notify/index.js +13 -0
  233. package/dist/notify/index.scss +65 -0
  234. package/dist/number-keyboard/index.d.ts +10 -0
  235. package/dist/number-keyboard/index.js +51 -0
  236. package/dist/number-keyboard/index.scss +93 -0
  237. package/dist/pagination/index.d.ts +20 -0
  238. package/dist/pagination/index.js +65 -0
  239. package/dist/pagination/index.scss +131 -0
  240. package/dist/pan-gesture-detector/index.d.ts +8 -0
  241. package/dist/pan-gesture-detector/index.js +11 -0
  242. package/dist/pan-gesture-detector/index.rn.d.ts +8 -0
  243. package/dist/pan-gesture-detector/index.rn.js +23 -0
  244. package/dist/pan-gesture-detector/usePan.d.ts +47 -0
  245. package/dist/pan-gesture-detector/usePan.js +146 -0
  246. package/dist/password-input/index.d.ts +22 -0
  247. package/dist/password-input/index.js +91 -0
  248. package/dist/password-input/index.scss +189 -0
  249. package/dist/picker/InertialMotion.d.ts +20 -0
  250. package/dist/picker/InertialMotion.js +141 -0
  251. package/dist/picker/PickerView.d.ts +1 -0
  252. package/dist/picker/PickerView.h5.d.ts +17 -0
  253. package/dist/picker/PickerView.h5.js +36 -0
  254. package/dist/picker/PickerView.js +1 -0
  255. package/dist/picker/PickerViewColumn copy.d.ts +9 -0
  256. package/dist/picker/PickerViewColumn copy.js +143 -0
  257. package/dist/picker/PickerViewColumn.d.ts +12 -0
  258. package/dist/picker/PickerViewColumn.js +238 -0
  259. package/dist/picker/index.d.ts +38 -0
  260. package/dist/picker/index.js +224 -0
  261. package/dist/picker/index.rn.scss +0 -0
  262. package/dist/picker/index.scss +138 -0
  263. package/dist/popout/index.d.ts +25 -0
  264. package/dist/popout/index.js +87 -0
  265. package/dist/popout/index.scss +136 -0
  266. package/dist/popout-input/index.d.ts +29 -0
  267. package/dist/popout-input/index.js +91 -0
  268. package/dist/popout-input/index.scss +53 -0
  269. package/dist/popover/index.d.ts +35 -0
  270. package/dist/popover/index.js +193 -0
  271. package/dist/popover/index.scss +94 -0
  272. package/dist/popover/utils.d.ts +23 -0
  273. package/dist/popover/utils.js +124 -0
  274. package/dist/popup/index.d.ts +29 -0
  275. package/dist/popup/index.js +60 -0
  276. package/dist/popup/index.scss +60 -0
  277. package/dist/pressable/index.d.ts +13 -0
  278. package/dist/pressable/index.js +58 -0
  279. package/dist/pressable/index.rn.d.ts +13 -0
  280. package/dist/pressable/index.rn.js +50 -0
  281. package/dist/progress-bar/index.d.ts +10 -0
  282. package/dist/progress-bar/index.js +22 -0
  283. package/dist/progress-bar/index.scss +45 -0
  284. package/dist/progress-circle/index.d.ts +11 -0
  285. package/dist/progress-circle/index.js +54 -0
  286. package/dist/progress-circle/index.scss +141 -0
  287. package/dist/radio/Group.d.ts +5 -0
  288. package/dist/radio/Group.js +5 -0
  289. package/dist/radio/index.d.ts +10 -0
  290. package/dist/radio/index.js +8 -0
  291. package/dist/radio/index.scss +77 -0
  292. package/dist/rate/index.d.ts +23 -0
  293. package/dist/rate/index.js +116 -0
  294. package/dist/rate/index.scss +99 -0
  295. package/dist/result/index.d.ts +12 -0
  296. package/dist/result/index.js +19 -0
  297. package/dist/result/index.scss +88 -0
  298. package/dist/safe-area/index.d.ts +7 -0
  299. package/dist/safe-area/index.js +35 -0
  300. package/dist/safe-area/index.scss +24 -0
  301. package/dist/scroll-view/index.d.ts +24 -0
  302. package/dist/scroll-view/index.js +72 -0
  303. package/dist/scroll-view/index.rn.d.ts +21 -0
  304. package/dist/scroll-view/index.rn.js +51 -0
  305. package/dist/search/index.d.ts +26 -0
  306. package/dist/search/index.js +35 -0
  307. package/dist/search/index.scss +75 -0
  308. package/dist/share-sheet/Item.d.ts +15 -0
  309. package/dist/share-sheet/Item.js +26 -0
  310. package/dist/share-sheet/Row.d.ts +10 -0
  311. package/dist/share-sheet/Row.js +26 -0
  312. package/dist/share-sheet/index.d.ts +26 -0
  313. package/dist/share-sheet/index.js +76 -0
  314. package/dist/share-sheet/index.scss +230 -0
  315. package/dist/skeleton/Avatar.d.ts +7 -0
  316. package/dist/skeleton/Avatar.js +17 -0
  317. package/dist/skeleton/Block.d.ts +8 -0
  318. package/dist/skeleton/Block.js +44 -0
  319. package/dist/skeleton/Paragraph.d.ts +7 -0
  320. package/dist/skeleton/Paragraph.js +13 -0
  321. package/dist/skeleton/Title.d.ts +7 -0
  322. package/dist/skeleton/Title.js +16 -0
  323. package/dist/skeleton/index.d.ts +28 -0
  324. package/dist/skeleton/index.js +22 -0
  325. package/dist/skeleton/index.scss +108 -0
  326. package/dist/slider/index.d.ts +36 -0
  327. package/dist/slider/index.js +187 -0
  328. package/dist/slider/index.scss +138 -0
  329. package/dist/space/index.d.ts +13 -0
  330. package/dist/space/index.js +33 -0
  331. package/dist/space/index.scss +36 -0
  332. package/dist/stepper/index.d.ts +26 -0
  333. package/dist/stepper/index.js +138 -0
  334. package/dist/stepper/index.scss +106 -0
  335. package/dist/steps/Step.d.ts +23 -0
  336. package/dist/steps/Step.js +41 -0
  337. package/dist/steps/index.d.ts +23 -0
  338. package/dist/steps/index.js +38 -0
  339. package/dist/steps/index.scss +300 -0
  340. package/dist/style/base.scss +3 -0
  341. package/dist/style/functions.scss +54 -0
  342. package/dist/style/index.d.ts +2 -0
  343. package/dist/style/index.js +2 -0
  344. package/dist/style/index.scss +0 -0
  345. package/dist/style/mixins/bem.scss +63 -0
  346. package/dist/style/mixins/border.scss +80 -0
  347. package/dist/style/mixins/disabled.scss +9 -0
  348. package/dist/style/mixins/env.rn.scss +11 -0
  349. package/dist/style/mixins/env.scss +11 -0
  350. package/dist/style/mixins/fixed.rn.scss +3 -0
  351. package/dist/style/mixins/fixed.scss +3 -0
  352. package/dist/style/mixins/sticky.rn.scss +3 -0
  353. package/dist/style/mixins/sticky.scss +3 -0
  354. package/dist/style/mixins/theme.scss +11 -0
  355. package/dist/style/mixins/universal.rn.scss +2 -0
  356. package/dist/style/mixins/universal.scss +6 -0
  357. package/dist/style/mixins.scss +8 -0
  358. package/dist/style/utils.scss +130 -0
  359. package/dist/style/variables.scss +422 -0
  360. package/dist/swiper/Item.d.ts +8 -0
  361. package/dist/swiper/Item.js +10 -0
  362. package/dist/swiper/index.d.ts +12 -0
  363. package/dist/swiper/index.js +13 -0
  364. package/dist/swiper/index.scss +10 -0
  365. package/dist/switch/index.d.ts +19 -0
  366. package/dist/switch/index.js +78 -0
  367. package/dist/switch/index.scss +106 -0
  368. package/dist/tabbar/Item.d.ts +17 -0
  369. package/dist/tabbar/Item.js +24 -0
  370. package/dist/tabbar/index.d.ts +17 -0
  371. package/dist/tabbar/index.js +33 -0
  372. package/dist/tabbar/index.scss +89 -0
  373. package/dist/tabs/Tab.d.ts +12 -0
  374. package/dist/tabs/Tab.js +17 -0
  375. package/dist/tabs/index.d.ts +23 -0
  376. package/dist/tabs/index.js +258 -0
  377. package/dist/tabs/index.scss +113 -0
  378. package/dist/tag/index.d.ts +17 -0
  379. package/dist/tag/index.js +21 -0
  380. package/dist/tag/index.scss +93 -0
  381. package/dist/template/index.d.ts +6 -0
  382. package/dist/template/index.js +10 -0
  383. package/dist/template/index.scss +16 -0
  384. package/dist/toast/Agent.d.ts +6 -0
  385. package/dist/toast/Agent.js +7 -0
  386. package/dist/toast/Toast.d.ts +24 -0
  387. package/dist/toast/Toast.js +43 -0
  388. package/dist/toast/imperative.d.ts +18 -0
  389. package/dist/toast/imperative.js +35 -0
  390. package/dist/toast/index.d.ts +15 -0
  391. package/dist/toast/index.js +13 -0
  392. package/dist/toast/index.scss +96 -0
  393. package/dist/transition/CSSTransition.d.ts +7 -0
  394. package/dist/transition/CSSTransition.js +49 -0
  395. package/dist/transition/CSSTransition.rn.d.ts +7 -0
  396. package/dist/transition/CSSTransition.rn.js +312 -0
  397. package/dist/transition/index.d.ts +43 -0
  398. package/dist/transition/index.js +156 -0
  399. package/dist/transition/index.rn.scss +0 -0
  400. package/dist/transition/index.scss +158 -0
  401. package/dist/upload/Preview.d.ts +35 -0
  402. package/dist/upload/Preview.js +41 -0
  403. package/dist/upload/PreviewVideo.d.ts +7 -0
  404. package/dist/upload/PreviewVideo.js +38 -0
  405. package/dist/upload/PreviewVideo.rn.d.ts +6 -0
  406. package/dist/upload/PreviewVideo.rn.js +24 -0
  407. package/dist/upload/chooseMedia.d.ts +26 -0
  408. package/dist/upload/chooseMedia.h5.d.ts +25 -0
  409. package/dist/upload/chooseMedia.h5.js +117 -0
  410. package/dist/upload/chooseMedia.js +55 -0
  411. package/dist/upload/index.d.ts +37 -0
  412. package/dist/upload/index.js +167 -0
  413. package/dist/upload/index.scss +247 -0
  414. package/dist/use/index.d.ts +20 -0
  415. package/dist/use/index.js +20 -0
  416. package/dist/use/useAutoplay.d.ts +1 -0
  417. package/dist/use/useAutoplay.js +34 -0
  418. package/dist/use/useBem.d.ts +9 -0
  419. package/dist/use/useBem.js +52 -0
  420. package/dist/use/useBrush.d.ts +23 -0
  421. package/dist/use/useBrush.js +61 -0
  422. package/dist/use/useControllableValue.d.ts +12 -0
  423. package/dist/use/useControllableValue.js +59 -0
  424. package/dist/use/useEvent.d.ts +4 -0
  425. package/dist/use/useEvent.js +12 -0
  426. package/dist/use/useForceRender.d.ts +5 -0
  427. package/dist/use/useForceRender.js +8 -0
  428. package/dist/use/useIndexableMap.d.ts +21 -0
  429. package/dist/use/useIndexableMap.js +65 -0
  430. package/dist/use/useInertRef.d.ts +7 -0
  431. package/dist/use/useInertRef.js +15 -0
  432. package/dist/use/useInternalSelect.d.ts +42 -0
  433. package/dist/use/useInternalSelect.js +64 -0
  434. package/dist/use/useLayoutUpdateEffect.d.ts +5 -0
  435. package/dist/use/useLayoutUpdateEffect.js +18 -0
  436. package/dist/use/usePropRef.d.ts +5 -0
  437. package/dist/use/usePropRef.js +9 -0
  438. package/dist/use/useResize.d.ts +2 -0
  439. package/dist/use/useResize.js +14 -0
  440. package/dist/use/useResizeObserver.d.ts +5 -0
  441. package/dist/use/useResizeObserver.js +38 -0
  442. package/dist/use/useSelect.d.ts +15 -0
  443. package/dist/use/useSelect.js +56 -0
  444. package/dist/use/useSelectorId.d.ts +1 -0
  445. package/dist/use/useSelectorId.js +5 -0
  446. package/dist/use/useSetTimeout.d.ts +10 -0
  447. package/dist/use/useSetTimeout.js +34 -0
  448. package/dist/use/useStopMovePropagate.d.ts +5 -0
  449. package/dist/use/useStopMovePropagate.js +28 -0
  450. package/dist/use/useThrottle.d.ts +8 -0
  451. package/dist/use/useThrottle.js +11 -0
  452. package/dist/use/useUpdateEffect.d.ts +5 -0
  453. package/dist/use/useUpdateEffect.js +18 -0
  454. package/dist/use/useUpdateWatchSync.d.ts +5 -0
  455. package/dist/use/useUpdateWatchSync.js +18 -0
  456. package/dist/use/useWatchStateSync.d.ts +4 -0
  457. package/dist/use/useWatchStateSync.js +18 -0
  458. package/dist/utils/animate.d.ts +28 -0
  459. package/dist/utils/animate.js +81 -0
  460. package/dist/utils/createPubSub.d.ts +8 -0
  461. package/dist/utils/createPubSub.js +53 -0
  462. package/dist/utils/date.d.ts +13 -0
  463. package/dist/utils/date.js +87 -0
  464. package/dist/utils/dom.d.ts +149 -0
  465. package/dist/utils/dom.js +297 -0
  466. package/dist/utils/file.d.ts +18 -0
  467. package/dist/utils/file.js +57 -0
  468. package/dist/utils/imperative.d.ts +20 -0
  469. package/dist/utils/imperative.js +37 -0
  470. package/dist/utils/index.d.ts +7 -0
  471. package/dist/utils/index.js +7 -0
  472. package/dist/utils/is.d.ts +16 -0
  473. package/dist/utils/is.js +57 -0
  474. package/dist/utils/measure.d.ts +8 -0
  475. package/dist/utils/measure.js +13 -0
  476. package/dist/utils/measure.rn.d.ts +8 -0
  477. package/dist/utils/measure.rn.js +15 -0
  478. package/dist/utils/platform.android.d.ts +2 -0
  479. package/dist/utils/platform.android.js +2 -0
  480. package/dist/utils/platform.d.ts +2 -0
  481. package/dist/utils/platform.ios.d.ts +2 -0
  482. package/dist/utils/platform.ios.js +2 -0
  483. package/dist/utils/platform.js +2 -0
  484. package/dist/utils/style.d.ts +10 -0
  485. package/dist/utils/style.js +34 -0
  486. package/dist/utils/utils.d.ts +199 -0
  487. package/dist/utils/utils.js +639 -0
  488. package/package.json +30 -0
@@ -0,0 +1,17 @@
1
+ import { ReactNode } from 'react';
2
+ import { ITouchEvent } from '@tarojs/components';
3
+ import { IconProps } from '../icon';
4
+ import { BadgeProps } from '../badge';
5
+ import { BaseProps } from '../base';
6
+ export interface TabbarItemProps extends BaseProps {
7
+ icon?: ReactNode | ((active: boolean) => ReactNode);
8
+ iconProps?: IconProps | ((active: boolean) => IconProps);
9
+ color?: string;
10
+ activeColor?: string;
11
+ badge?: BadgeProps;
12
+ onClick?: (event: ITouchEvent) => void;
13
+ _innerKey?: number | string;
14
+ _activeKey?: number | string;
15
+ }
16
+ export declare const TabbarItem: import("react").MemoExoticComponent<(props: TabbarItemProps) => import("react/jsx-runtime").JSX.Element>;
17
+ export default TabbarItem;
@@ -0,0 +1,24 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { memo } from 'react';
3
+ import { View } from '@tarojs/components';
4
+ import classNames from 'classnames';
5
+ import { Icon } from '../icon';
6
+ import { Badge } from '../badge';
7
+ import { useBem } from '../use';
8
+ import { filterNullish, isFunction } from '../utils';
9
+ export const TabbarItem = memo((props) => {
10
+ const { className, style, children, icon, iconProps, color, activeColor, badge, onClick, _innerKey, _activeKey, ...restProps } = props;
11
+ const [bem] = useBem('tabbar');
12
+ const active = _innerKey === _activeKey;
13
+ return (_jsxs(View, { ...restProps, className: classNames(bem.e('item'), bem.em('item', 'active', active), className), style: {
14
+ ...style,
15
+ ...filterNullish({
16
+ color: active ? activeColor : color,
17
+ }),
18
+ }, onClick: onClick, children: [_jsxs(View, { className: classNames(bem.e('icon-wrapper')), children: [isFunction(icon) ? (icon(active)) : (_jsx(Icon, { ...(isFunction(iconProps) ? iconProps(active) : iconProps), className: classNames(bem.e('icon'), bem.em('icon', 'active', active)), style: filterNullish({
19
+ color: active ? activeColor : color,
20
+ }) })), badge && _jsx(Badge, { ...badge, fixed: true })] }), _jsx(View, { className: classNames(bem.e('text'), bem.em('text', 'active', active)), style: filterNullish({
21
+ color: active ? activeColor : color,
22
+ }), children: children })] }));
23
+ });
24
+ export default TabbarItem;
@@ -0,0 +1,17 @@
1
+ import { ReactElement, FC } from 'react';
2
+ import { TabbarItem } from './Item';
3
+ import { BaseProps } from '../base';
4
+ export * from './Item';
5
+ export interface TabbarProps extends Omit<BaseProps, 'children'> {
6
+ children?: ReactElement | ReactElement[];
7
+ activeKey?: number | string;
8
+ defaultActiveKey?: number | string;
9
+ onChange?: (key: number | string) => void;
10
+ color?: string;
11
+ activeColor?: string;
12
+ }
13
+ export interface TabbarFC extends FC<TabbarProps> {
14
+ Item: typeof TabbarItem;
15
+ }
16
+ export declare const Tabbar: TabbarFC;
17
+ export default Tabbar;
@@ -0,0 +1,33 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Children, cloneElement } from 'react';
3
+ import { View } from '@tarojs/components';
4
+ import classNames from 'classnames';
5
+ import { pickNonNullish } from '../utils';
6
+ import { useBem, useControllableValue } from '../use';
7
+ import { TabbarItem } from './Item';
8
+ import Halfline from '../halfline';
9
+ export * from './Item';
10
+ export const Tabbar = (props) => {
11
+ const { className, style, children, activeKey, defaultActiveKey, onChange, color, activeColor, ...restProps } = props;
12
+ const [bem] = useBem('tabbar');
13
+ const [innerActiveKey, setInnerActiveKey] = useControllableValue({
14
+ value: activeKey,
15
+ defaultValue: defaultActiveKey,
16
+ trigger: onChange,
17
+ });
18
+ const handleItemClick = (key, element, event) => {
19
+ setInnerActiveKey(key);
20
+ element.props?.onClick?.(event);
21
+ };
22
+ return (_jsxs(View, { ...restProps, className: classNames(bem.b(), className), style: style, children: [Children.map(children, (element, index) => {
23
+ const innerKey = element.key ?? index;
24
+ return cloneElement(element, {
25
+ ...pickNonNullish({ color, activeColor }, element.props),
26
+ onClick: (event) => handleItemClick(innerKey, element, event),
27
+ _innerKey: innerKey,
28
+ _activeKey: innerActiveKey,
29
+ });
30
+ }), _jsx(Halfline, { direction: "top" })] }));
31
+ };
32
+ Tabbar.Item = TabbarItem;
33
+ export default Tabbar;
@@ -0,0 +1,89 @@
1
+ @import '../style/base.scss';
2
+ // #variables
3
+ $sar-tabbar-height: 50px !default;
4
+ $sar-tabbar-bg-color: $sar-emphasis-bg-color !default;
5
+ $sar-tabbar-color: $sar-secondary-color !default;
6
+
7
+ $sar-tabbar-item-ative-color: $sar-primary !default;
8
+ $sar-tabbar-item-icon-margin-bottom: 4px !default;
9
+ $sar-tabbar-item-icon-font-size: 20px !default;
10
+ $sar-tabbar-item-text-font-size: $sar-text-sm !default;
11
+
12
+ // 暗黑模式
13
+ $sar-tabbar-bg-dark-color: $sar-dark-emphasis-bg-color !default;
14
+ $sar-tabbar-dark-color: $sar-dark-secondary-color !default;
15
+ // #endvariables
16
+
17
+ @include bem(tabbar) {
18
+ @include b() {
19
+ @include universal;
20
+ flex-direction: row;
21
+ align-items: stretch;
22
+ height: $sar-tabbar-height;
23
+ color: $sar-tabbar-color;
24
+ background-color: $sar-tabbar-bg-color;
25
+ }
26
+
27
+ @include e(item) {
28
+ @include universal;
29
+ z-index: 3;
30
+ justify-content: center;
31
+ align-items: center;
32
+ flex: 1;
33
+
34
+ @include ifweb {
35
+ cursor: pointer;
36
+ }
37
+ }
38
+
39
+ @include e(icon-wrapper) {
40
+ @include universal;
41
+ margin-bottom: $sar-tabbar-item-icon-margin-bottom;
42
+ }
43
+
44
+ @include e(icon) {
45
+ font-size: $sar-tabbar-item-icon-font-size;
46
+ line-height: $sar-tabbar-item-icon-font-size * $sar-leading-none;
47
+ color: $sar-tabbar-color;
48
+
49
+ @include m(active) {
50
+ color: $sar-tabbar-item-ative-color;
51
+ }
52
+ }
53
+
54
+ @include e(text) {
55
+ @include universal;
56
+ font-size: $sar-tabbar-item-text-font-size;
57
+ line-height: $sar-tabbar-item-text-font-size * $sar-leading-tight;
58
+ color: $sar-tabbar-color;
59
+
60
+ @include m(active) {
61
+ color: $sar-tabbar-item-ative-color;
62
+ }
63
+ }
64
+ }
65
+
66
+ @include theme(dark) {
67
+ @include bem(tabbar) {
68
+ @include b() {
69
+ color: $sar-tabbar-dark-color;
70
+ background-color: $sar-tabbar-bg-dark-color;
71
+ }
72
+
73
+ @include e(icon) {
74
+ color: $sar-tabbar-dark-color;
75
+
76
+ @include m(active) {
77
+ color: $sar-tabbar-item-ative-color;
78
+ }
79
+ }
80
+
81
+ @include e(text) {
82
+ color: $sar-tabbar-dark-color;
83
+
84
+ @include m(active) {
85
+ color: $sar-tabbar-item-ative-color;
86
+ }
87
+ }
88
+ }
89
+ }
@@ -0,0 +1,12 @@
1
+ import { ReactNode } from 'react';
2
+ import { BaseProps } from '../base';
3
+ export interface TabsTabProps extends Omit<BaseProps, 'children'> {
4
+ children?: ReactNode | ((active: boolean) => ReactNode);
5
+ disabled?: boolean;
6
+ _onSelect?: (key: string | number) => void;
7
+ _active?: boolean;
8
+ _scrollable?: boolean;
9
+ _key?: string | number;
10
+ }
11
+ export declare const TabsTab: import("react").ForwardRefExoticComponent<TabsTabProps & import("react").RefAttributes<any>>;
12
+ export default TabsTab;
@@ -0,0 +1,17 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { forwardRef } from 'react';
3
+ import classNames from 'classnames';
4
+ import { View } from '@tarojs/components';
5
+ import { useBem, useEvent } from '../use';
6
+ import { isFunction } from '../utils';
7
+ export const TabsTab = forwardRef((props, ref) => {
8
+ const { className, style, children, disabled, _onSelect, _active = false, _scrollable, _key, ...restProps } = props;
9
+ const [bem] = useBem('tabs');
10
+ const handleClick = useEvent(() => {
11
+ if (!disabled && !_active) {
12
+ _onSelect?.(_key);
13
+ }
14
+ });
15
+ return (_jsx(View, { ...restProps, className: classNames(bem.e('tab'), bem.em('tab', 'active', _active), bem.em('tab', 'scrollable', _scrollable), bem.em('tab', 'disabled', disabled), className), style: style, onClick: handleClick, ref: ref, children: isFunction(children) ? children(_active) : children }));
16
+ });
17
+ export default TabsTab;
@@ -0,0 +1,23 @@
1
+ import { CSSProperties, ReactElement, ReactNode, FC } from 'react';
2
+ import { BaseProps } from '../base';
3
+ import { TabsTab } from './Tab';
4
+ export interface TabsProps extends Omit<BaseProps, 'children'> {
5
+ children?: ReactElement | ReactElement[];
6
+ defaultActiveKey?: number | string;
7
+ activeKey?: number | string;
8
+ onChange?: (key: number | string) => void;
9
+ scrollable?: boolean;
10
+ activeStyle?: CSSProperties;
11
+ activeClass?: string;
12
+ inactiveStyle?: CSSProperties;
13
+ inactiveClass?: string;
14
+ showLine?: boolean;
15
+ line?: ReactNode;
16
+ lineStyle?: CSSProperties;
17
+ lineClass?: string;
18
+ }
19
+ export interface TabsFC extends FC<TabsProps> {
20
+ Tab: typeof TabsTab;
21
+ }
22
+ export declare const Tabs: TabsFC;
23
+ export default Tabs;
@@ -0,0 +1,258 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Children, cloneElement, useEffect, useRef, useState, useMemo, } from 'react';
3
+ import classNames from 'classnames';
4
+ import { CustomWrapper, View } from '@tarojs/components';
5
+ import { useSelectorId, useBem, useControllableValue, useSetTimeout, useEvent, } from '../use';
6
+ import { getRectByElement, getScrollIntoViewValue, isAndroid, isNumber, isRN, } from '../utils';
7
+ import { TabsTab } from './Tab';
8
+ import { Animated } from '../animated';
9
+ import { ScrollView } from '../scroll-view';
10
+ const duration = 300;
11
+ export const Tabs = (props) => {
12
+ const { className, style, children, defaultActiveKey, activeKey, onChange, scrollable, activeStyle, activeClass, inactiveStyle, inactiveClass, showLine = true, line, lineStyle, lineClass, ...restProps } = props;
13
+ const [bem] = useBem('tabs');
14
+ const [innerActiveKey, setInnerActiveKey] = useControllableValue({
15
+ value: activeKey,
16
+ defaultValue: defaultActiveKey,
17
+ trigger: onChange,
18
+ postValue(value) {
19
+ return isNumber(value) ? String(value) : value;
20
+ },
21
+ });
22
+ const [setLineStyleLater] = useSetTimeout(() => {
23
+ setTabStyle(innerActiveKey, true);
24
+ }, 150);
25
+ const isSettingTabStyleByKey = useRef(false);
26
+ const firstTimer = useRef();
27
+ useEffect(() => {
28
+ if (showLine || scrollable) {
29
+ if (isAndroid && firstTimer.current === undefined) {
30
+ firstTimer.current = setTimeout(() => {
31
+ firstTimer.current = null;
32
+ setTabStyle(innerActiveKey);
33
+ }, 400);
34
+ }
35
+ else {
36
+ setTabStyle(innerActiveKey);
37
+ }
38
+ isSettingTabStyleByKey.current = true;
39
+ }
40
+ }, [innerActiveKey]);
41
+ useEffect(() => {
42
+ if (showLine && !isSettingTabStyleByKey.current) {
43
+ isSettingTabStyleByKey.current = false;
44
+ setLineStyleLater();
45
+ }
46
+ }, [children]);
47
+ const contextId = useSelectorId();
48
+ const scrollRef = useRef(null);
49
+ const wrapperRef = useRef(null);
50
+ const tabKeyRefMap = useRef({});
51
+ const notSetLineStyleYet = useRef(true);
52
+ const stopScroll = useRef();
53
+ const scrollLeftRef = useRef(0);
54
+ const handleScroll = useEvent((event) => {
55
+ scrollLeftRef.current = event.x;
56
+ });
57
+ const [translateLater, cancelTranslate, isWaitingToTranslate] = useSetTimeout((left) => {
58
+ stopScroll.current = undefined;
59
+ scrollRef.current?.setScrollEnabled(true);
60
+ scrollLeftRef.current = left;
61
+ clearWrapperStyle();
62
+ }, duration);
63
+ const [wrapperStyle, setWrapperStyle] = useState({
64
+ offset: 0,
65
+ duration: 0,
66
+ paddingRight: 0,
67
+ });
68
+ const [lineLeft, setLineLeft] = useState();
69
+ const clearWrapperStyle = () => {
70
+ setWrapperStyle({
71
+ offset: 0,
72
+ duration: 0,
73
+ paddingRight: 0,
74
+ });
75
+ };
76
+ async function getUrgentScrollLeft() {
77
+ const wrapperRect = await getRectByElement(wrapperRef.current, contextId);
78
+ const scrollRect = await getRectByElement(scrollRef.current?.getElement(), contextId);
79
+ return scrollRect.left - wrapperRect.left;
80
+ }
81
+ const setTabStyle = async (key, onlyLine) => {
82
+ const tabElement = tabKeyRefMap.current[key];
83
+ if (!tabElement) {
84
+ return;
85
+ }
86
+ await stopScroll.current?.();
87
+ let scrollRect = await getRectByElement(scrollRef.current?.getElement(), contextId);
88
+ // 有些设备可能出现首次获取不到的情况
89
+ if (!scrollRect || scrollRect.width === 0) {
90
+ scrollRect = await getRectByElement(scrollRef.current?.getElement(), contextId);
91
+ }
92
+ // 组件或其父组件被隐藏导致位置尺寸值为0
93
+ if (!scrollRect || scrollRect.width === 0) {
94
+ return;
95
+ }
96
+ let wrapperRect;
97
+ if (scrollable) {
98
+ wrapperRect = await getRectByElement(wrapperRef.current, contextId);
99
+ }
100
+ else {
101
+ // 优化
102
+ wrapperRect = scrollRect;
103
+ }
104
+ const tabRect = await getRectByElement(tabElement, contextId);
105
+ // 确保要处理的值存在
106
+ if (!wrapperRect || !tabRect) {
107
+ return;
108
+ }
109
+ // line
110
+ if (showLine) {
111
+ const lineLeft = tabRect.left - wrapperRect.left + tabRect.width / 2;
112
+ setLineLeft(lineLeft);
113
+ if (onlyLine) {
114
+ return;
115
+ }
116
+ }
117
+ // scroll
118
+ {
119
+ let wrapperLeft = wrapperRect.left;
120
+ if (isRN) {
121
+ wrapperLeft -= wrapperCurrentValue.current;
122
+ }
123
+ const originalScrollLeft = scrollRect.left - wrapperLeft;
124
+ const scrollLeft = getScrollIntoViewValue(scrollRect.width, originalScrollLeft, tabRect.width, tabRect.left - wrapperLeft, {
125
+ placement: 'center',
126
+ limited: true,
127
+ pageHeight: wrapperRect.width,
128
+ });
129
+ const offset = originalScrollLeft - scrollLeft;
130
+ if (Math.abs(offset) < 1) {
131
+ return;
132
+ }
133
+ scrollRef.current?.setScrollEnabled(false);
134
+ setWrapperStyle({
135
+ offset,
136
+ duration,
137
+ paddingRight: 1000,
138
+ });
139
+ if (!isRN) {
140
+ translateLater(scrollLeft);
141
+ stopScroll.current = async () => {
142
+ if (isWaitingToTranslate()) {
143
+ cancelTranslate();
144
+ const urgentScrollLeft = await getUrgentScrollLeft();
145
+ scrollLeftRef.current = urgentScrollLeft;
146
+ clearWrapperStyle();
147
+ }
148
+ };
149
+ }
150
+ if (isRN) {
151
+ stopScroll.current = async () => {
152
+ wrapperAnim.stopAnimation();
153
+ };
154
+ wrapperAnim.setValue(wrapperCurrentValue.current);
155
+ animateWrapperTranslateX(offset + wrapperCurrentValue.current, ({ finished }) => {
156
+ if (finished) {
157
+ stopScroll.current = undefined;
158
+ wrapperAnim.setValue(0);
159
+ scrollRef.current?.scrollLeft(scrollLeft);
160
+ }
161
+ else {
162
+ scrollRef.current?.scrollLeft(scrollLeft + offset - wrapperCurrentValue.current);
163
+ wrapperAnim.setValue(0);
164
+ }
165
+ scrollRef.current?.setScrollEnabled(true);
166
+ clearWrapperStyle();
167
+ });
168
+ }
169
+ }
170
+ };
171
+ const handleTabSelect = (key) => {
172
+ setInnerActiveKey(key);
173
+ };
174
+ // Animated >>>
175
+ const lineAnim = useMemo(() => new Animated.Value(0), []);
176
+ const animateLineTranslateX = (to) => {
177
+ Animated.timing(lineAnim, {
178
+ toValue: to,
179
+ duration: notSetLineStyleYet.current ? 0 : duration,
180
+ useNativeDriver: true,
181
+ }).start();
182
+ };
183
+ useEffect(() => {
184
+ if (lineLeft !== undefined) {
185
+ animateLineTranslateX(lineLeft);
186
+ notSetLineStyleYet.current = false;
187
+ }
188
+ }, [lineLeft]);
189
+ const wrapperAnim = useMemo(() => new Animated.Value(0), []);
190
+ const animateWrapperTranslateX = (to, callback) => {
191
+ Animated.timing(wrapperAnim, {
192
+ toValue: to,
193
+ duration,
194
+ useNativeDriver: true,
195
+ }).start(callback);
196
+ };
197
+ const wrapperCurrentValue = useRef(0);
198
+ useEffect(() => {
199
+ wrapperAnim.addListener(({ value }) => {
200
+ wrapperCurrentValue.current = value;
201
+ });
202
+ return () => {
203
+ wrapperAnim.stopAnimation();
204
+ wrapperAnim.removeAllListeners();
205
+ lineAnim.stopAnimation();
206
+ };
207
+ }, []);
208
+ // <<< Animated
209
+ return (_jsx(CustomWrapper, { id: contextId, children: _jsx(View, { ...restProps, className: classNames(bem.b(), className), style: style, children: _jsx(ScrollView, { contextId: contextId, ref: scrollRef, scrollX: !!scrollable, className: classNames(bem.e('scroll')), showScrollbar: false, scrollLeft: scrollLeftRef.current, onScroll: handleScroll, children: _jsx(View, { className: bem.e('container'), children: _jsxs(Animated.View, { className: classNames(bem.e('wrapper')), style: {
210
+ // 确保有足够的空间可以滚动
211
+ paddingRight: wrapperStyle.paddingRight,
212
+ ...(isRN
213
+ ? {
214
+ transform: [
215
+ {
216
+ translateX: wrapperAnim,
217
+ },
218
+ ],
219
+ }
220
+ : {
221
+ transform: `translate3d(${wrapperStyle.offset}px,0,0)`,
222
+ transition: `transform ${wrapperStyle.duration}ms ease-out 0s`,
223
+ }),
224
+ }, ref: wrapperRef, children: [Children.map(children, (element, index) => {
225
+ const key = element.key ?? String(index);
226
+ const active = key === innerActiveKey;
227
+ return cloneElement(element, {
228
+ _key: key,
229
+ _active: active,
230
+ _scrollable: scrollable,
231
+ _onSelect: handleTabSelect,
232
+ className: classNames(element.props.className, active ? activeClass : inactiveClass),
233
+ style: {
234
+ ...element.props.style,
235
+ ...(active ? activeStyle : inactiveStyle),
236
+ },
237
+ ref: (element) => {
238
+ tabKeyRefMap.current[key] = element;
239
+ },
240
+ });
241
+ }), showLine && (_jsx(Animated.View, { className: classNames(bem.e('line'), lineClass), style: {
242
+ ...lineStyle,
243
+ opacity: lineLeft === undefined ? 0 : 1,
244
+ ...(isRN
245
+ ? {
246
+ transform: [
247
+ { translateX: lineAnim },
248
+ { translateX: -20 },
249
+ ],
250
+ }
251
+ : {
252
+ transition: `transform ${notSetLineStyleYet.current ? 0 : duration}ms`,
253
+ transform: `translate3d(${lineLeft || 0}px,0,0) translateX(-20px)`,
254
+ }),
255
+ }, children: line }))] }) }) }) }) }));
256
+ };
257
+ Tabs.Tab = TabsTab;
258
+ export default Tabs;
@@ -0,0 +1,113 @@
1
+ @import '../style/base.scss';
2
+ // #variables
3
+ $sar-tabs-tab-height: 44px !default;
4
+ $sar-tabs-tab-font-size: $sar-text-base !default;
5
+ $sar-tabs-tab-line-height: $sar-tabs-tab-font-size * $sar-leading-snug !default;
6
+ $sar-tabs-tab-color: $sar-secondary-color !default;
7
+ $sar-tabs-tab-active-color: $sar-emphasis-color !default;
8
+
9
+ $sar-tabs-tab-padding-x: 16px !default;
10
+
11
+ $sar-tabs-line-width: 40px !default;
12
+ $sar-tabs-line-height: 3px !default;
13
+ $sar-tabs-line-bg-color: $sar-primary !default;
14
+
15
+ // 暗黑模式
16
+ $sar-tabs-tab-dark-color: $sar-dark-secondary-color !default;
17
+ $sar-tabs-tab-active-dark-color: $sar-dark-emphasis-color !default;
18
+ // #endvariables
19
+
20
+ @include bem(tabs) {
21
+ @include b() {
22
+ @include universal;
23
+ flex-direction: row;
24
+ }
25
+
26
+ @include e(scroll) {
27
+ @include universal;
28
+ width: 100%;
29
+ flex: 1;
30
+ }
31
+
32
+ @include e(container) {
33
+ @include universal;
34
+ flex-direction: row;
35
+ width: 100%;
36
+ }
37
+
38
+ @include e(wrapper) {
39
+ @include universal;
40
+ flex-direction: row;
41
+ flex-wrap: nowrap;
42
+ min-width: 100%;
43
+ flex: none;
44
+ }
45
+
46
+ @include e(tab) {
47
+ @include universal;
48
+ z-index: 2;
49
+ flex-direction: row;
50
+ flex: 1;
51
+ height: $sar-tabs-tab-height;
52
+ justify-content: center;
53
+ align-items: center;
54
+ padding: 0 $sar-tabs-tab-padding-x;
55
+ font-size: $sar-tabs-tab-font-size;
56
+ line-height: $sar-tabs-tab-line-height;
57
+ color: $sar-tabs-tab-color;
58
+ @include ifweb {
59
+ white-space: nowrap;
60
+ }
61
+
62
+ @include ifweb {
63
+ cursor: pointer;
64
+ }
65
+
66
+ @include m(active) {
67
+ font-weight: $sar-font-bold;
68
+ color: $sar-tabs-tab-active-color;
69
+ }
70
+
71
+ @include m(scrollable) {
72
+ flex: 0;
73
+ }
74
+
75
+ @include m(disabled) {
76
+ color: $sar-disabled-color;
77
+ @include ifweb {
78
+ cursor: not-allowed;
79
+ }
80
+ }
81
+ }
82
+
83
+ @include e(line) {
84
+ @include universal;
85
+ position: absolute;
86
+ bottom: 0;
87
+ z-index: 10;
88
+ flex-direction: row;
89
+ justify-content: center;
90
+ align-items: center;
91
+ opacity: 0;
92
+ width: $sar-tabs-line-width;
93
+ height: $sar-tabs-line-height;
94
+ background-color: $sar-tabs-line-bg-color;
95
+ pointer-events: none;
96
+ }
97
+ }
98
+
99
+ @include theme(dark) {
100
+ @include bem(tabs) {
101
+ @include e(tab) {
102
+ color: $sar-tabs-tab-dark-color;
103
+
104
+ @include m(active) {
105
+ color: $sar-tabs-tab-active-dark-color;
106
+ }
107
+
108
+ @include m(disabled) {
109
+ color: $sar-dark-disabled-color;
110
+ }
111
+ }
112
+ }
113
+ }
@@ -0,0 +1,17 @@
1
+ import { FC } from 'react';
2
+ import { ITouchEvent } from '@tarojs/components';
3
+ import { BaseProps } from '../base';
4
+ export interface TagProps extends BaseProps {
5
+ theme?: 'default' | 'primary' | 'secondary' | 'success' | 'info' | 'warning' | 'danger';
6
+ plain?: boolean;
7
+ round?: boolean;
8
+ mark?: boolean;
9
+ size?: 'small' | 'medium' | 'large';
10
+ color?: string;
11
+ textColor?: string;
12
+ closable?: boolean;
13
+ onClose?: () => void;
14
+ onClick?: (event: ITouchEvent) => void;
15
+ }
16
+ export declare const Tag: FC<TagProps>;
17
+ export default Tag;
@@ -0,0 +1,21 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { View } from '@tarojs/components';
3
+ import classNames from 'classnames';
4
+ import { Icon } from '../icon';
5
+ import { useBem } from '../use';
6
+ import { filterNullish } from '../utils';
7
+ export const Tag = (props) => {
8
+ const { className, style, children, theme = 'default', plain, round, mark, size = 'medium', color, textColor, closable, onClose, ...restProps } = props;
9
+ const [bem] = useBem('tag');
10
+ return (_jsxs(View, { ...restProps, className: classNames(bem.b(), bem.m(theme), bem.m(`${theme}-plain`, plain), bem.m(size), bem.m('round', round), bem.m('mark', mark), className), style: {
11
+ ...style,
12
+ ...filterNullish({
13
+ backgroundColor: !plain ? color : null,
14
+ color: plain ? color : textColor,
15
+ borderColor: plain ? color : null,
16
+ }),
17
+ }, children: [children, closable && (_jsx(Icon, { name: "close", className: classNames(bem.e('close'), bem.em('close', theme), bem.em('close', `${theme}-plain`, plain)), style: filterNullish({
18
+ color: plain ? color : textColor,
19
+ }), onClick: onClose }))] }));
20
+ };
21
+ export default Tag;