@bifrostui/react 2.0.0-alpha.2 → 2.0.0-alpha.20

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 (484) hide show
  1. package/dist/ActionSheet/ActionSheet.d.ts +1 -1
  2. package/dist/ActionSheet/ActionSheet.js +8 -8
  3. package/dist/ActionSheet/ActionSheet.types.d.ts +1 -1
  4. package/dist/ActionSheet/ActionSheetContext.d.ts +1 -1
  5. package/dist/ActionSheet/ActionSheetContext.js +2 -2
  6. package/dist/ActionSheet/ActionSheetItem.types.d.ts +1 -1
  7. package/dist/Alert/Alert.d.ts +1 -1
  8. package/dist/Alert/Alert.js +16 -16
  9. package/dist/Alert/__tests__/fixtures/A11yDemos.d.ts +1 -1
  10. package/dist/Alert/__tests__/fixtures/A11yDemos.js +12 -12
  11. package/dist/Avatar/Avatar.d.ts +1 -1
  12. package/dist/Avatar/Avatar.js +5 -5
  13. package/dist/Avatar/Avatar.types.d.ts +1 -1
  14. package/dist/Avatar/AvatarGroup.types.d.ts +1 -1
  15. package/dist/Backdrop/Backdrop.d.ts +1 -1
  16. package/dist/Backdrop/Backdrop.js +3 -3
  17. package/dist/Backdrop/Backdrop.types.d.ts +1 -1
  18. package/dist/Backdrop/__tests__/fixtures/A11yDemos.d.ts +1 -1
  19. package/dist/Backdrop/__tests__/fixtures/A11yDemos.js +3 -3
  20. package/dist/Badge/Badge.d.ts +1 -1
  21. package/dist/Badge/Badge.js +4 -4
  22. package/dist/Badge/__tests__/fixtures/A11yDemos.d.ts +1 -1
  23. package/dist/Badge/__tests__/fixtures/A11yDemos.js +13 -13
  24. package/dist/Breadcrumb/Breadcrumb.d.ts +1 -1
  25. package/dist/Breadcrumb/Breadcrumb.js +9 -9
  26. package/dist/Breadcrumb/Breadcrumb.types.d.ts +1 -1
  27. package/dist/Breadcrumb/BreadcrumbItem.d.ts +1 -1
  28. package/dist/Breadcrumb/BreadcrumbItem.js +4 -4
  29. package/dist/Button/Button.d.ts +1 -1
  30. package/dist/Button/Button.js +6 -6
  31. package/dist/Button/Button.types.d.ts +1 -1
  32. package/dist/Button/__tests__/fixtures/A11yDemos.d.ts +1 -1
  33. package/dist/Button/__tests__/fixtures/A11yDemos.js +8 -8
  34. package/dist/Button/index.css +2 -3
  35. package/dist/Calendar/Calendar.types.d.ts +1 -1
  36. package/dist/Calendar/__tests__/fixtures/A11yDemos.d.ts +1 -1
  37. package/dist/Calendar/__tests__/fixtures/A11yDemos.js +2 -2
  38. package/dist/Card/Card.d.ts +1 -1
  39. package/dist/Card/Card.js +3 -3
  40. package/dist/Card/Card.types.d.ts +1 -1
  41. package/dist/Card/CardContent.d.ts +1 -1
  42. package/dist/Card/CardContent.js +3 -3
  43. package/dist/Card/CardContent.types.d.ts +1 -1
  44. package/dist/Card/CardFooter.d.ts +1 -1
  45. package/dist/Card/CardFooter.js +3 -3
  46. package/dist/Card/CardFooter.types.d.ts +1 -1
  47. package/dist/Card/CardHeader.d.ts +1 -1
  48. package/dist/Card/CardHeader.js +10 -10
  49. package/dist/Checkbox/CheckboxContext.d.ts +1 -1
  50. package/dist/Checkbox/CheckboxContext.js +2 -2
  51. package/dist/Checkbox/__tests__/fixtures/A11yDemos.d.ts +1 -1
  52. package/dist/Checkbox/__tests__/fixtures/A11yDemos.js +4 -4
  53. package/dist/CitySelector/CitySelector.types.d.ts +1 -0
  54. package/dist/CitySelector/Selector/index.d.ts +1 -1
  55. package/dist/CitySelector/Selector/index.js +2 -2
  56. package/dist/Collapse/Collapse.types.d.ts +1 -1
  57. package/dist/CollapsePanel/CollapsePanel.d.ts +1 -1
  58. package/dist/CollapsePanel/CollapsePanel.js +9 -9
  59. package/dist/CollapsePanel/CollapsePanel.types.d.ts +1 -1
  60. package/dist/CollapsePanel/CollapsePanelItem.d.ts +1 -1
  61. package/dist/CollapsePanel/CollapsePanelItem.js +5 -5
  62. package/dist/Countdown/Countdown.types.d.ts +2 -2
  63. package/dist/Countdown/__tests__/fixtures/A11yDemos.d.ts +1 -1
  64. package/dist/Countdown/__tests__/fixtures/A11yDemos.js +10 -10
  65. package/dist/Countdown/utils.d.ts +2 -2
  66. package/dist/Countdown/utils.js +4 -4
  67. package/dist/DatePicker/DatePicker.types.d.ts +1 -1
  68. package/dist/DesktopPicker/DesktopPicker.types.d.ts +1 -1
  69. package/dist/DesktopTimePicker/DesktopTimePicker.types.d.ts +11 -11
  70. package/dist/DesktopTimePicker/useGetTimePickerContent.js +2 -2
  71. package/dist/DesktopTimePicker/utils/utils.d.ts +1 -1
  72. package/dist/DesktopTimePicker/utils/utils.js +3 -3
  73. package/dist/Dialog/__tests__/fixtures/A11yDemos.d.ts +1 -1
  74. package/dist/Dialog/__tests__/fixtures/A11yDemos.js +4 -4
  75. package/dist/Divider/Divider.types.d.ts +1 -1
  76. package/dist/Drawer/Drawer.d.ts +1 -1
  77. package/dist/Drawer/Drawer.js +5 -5
  78. package/dist/Drawer/Drawer.types.d.ts +1 -1
  79. package/dist/Fade/Fade.d.ts +1 -1
  80. package/dist/Fade/Fade.js +4 -4
  81. package/dist/Fade/Fade.miniapp.js +13 -10
  82. package/dist/Fade/Fade.types.d.ts +1 -1
  83. package/dist/IconButton/IconButton.d.ts +1 -1
  84. package/dist/IconButton/IconButton.js +6 -6
  85. package/dist/IconButton/IconButton.types.d.ts +1 -1
  86. package/dist/Input/Input.types.d.ts +1 -1
  87. package/dist/Input/__tests__/fixtures/A11yDemos.d.ts +1 -1
  88. package/dist/Input/__tests__/fixtures/A11yDemos.js +7 -7
  89. package/dist/ItemSelector/ItemSelector.miniapp.js +7 -5
  90. package/dist/ItemSelector/ItemSelector.types.d.ts +1 -0
  91. package/dist/ItemSelector/Selector/index.d.ts +1 -1
  92. package/dist/ItemSelector/Selector/index.js +2 -2
  93. package/dist/List/List.d.ts +1 -1
  94. package/dist/List/List.js +4 -4
  95. package/dist/List/ListContext.d.ts +1 -1
  96. package/dist/List/ListContext.js +2 -2
  97. package/dist/List/ListItem.d.ts +1 -1
  98. package/dist/List/ListItem.js +8 -8
  99. package/dist/List/ListItem.types.d.ts +1 -1
  100. package/dist/List/ListItemContent.d.ts +1 -1
  101. package/dist/List/ListItemContent.js +3 -3
  102. package/dist/List/ListItemContent.types.d.ts +1 -1
  103. package/dist/List/ListItemExtra.d.ts +1 -1
  104. package/dist/List/ListItemExtra.js +3 -3
  105. package/dist/List/ListItemExtra.types.d.ts +1 -1
  106. package/dist/List/ListItemFooter.d.ts +1 -1
  107. package/dist/List/ListItemFooter.js +3 -3
  108. package/dist/List/ListItemFooter.types.d.ts +1 -1
  109. package/dist/List/ListItemHeader.d.ts +1 -1
  110. package/dist/List/ListItemHeader.js +3 -3
  111. package/dist/List/ListItemHeader.types.d.ts +1 -1
  112. package/dist/Loading/Loading.d.ts +1 -1
  113. package/dist/Loading/Loading.js +5 -5
  114. package/dist/Loading/Loading.types.d.ts +1 -1
  115. package/dist/Modal/Modal.d.ts +1 -1
  116. package/dist/Modal/Modal.js +6 -6
  117. package/dist/Modal/Modal.miniapp.d.ts +1 -1
  118. package/dist/Modal/Modal.miniapp.js +7 -7
  119. package/dist/Modal/__tests__/fixtures/A11yDemos.d.ts +1 -1
  120. package/dist/Modal/__tests__/fixtures/A11yDemos.js +3 -3
  121. package/dist/Modal/useModal.js +26 -29
  122. package/dist/NavBar/NavBar.d.ts +1 -1
  123. package/dist/NavBar/NavBar.js +10 -10
  124. package/dist/Picker/Picker.js +0 -1
  125. package/dist/Picker/Picker.types.d.ts +1 -1
  126. package/dist/Picker/__tests__/fixtures/A11yDemos.d.ts +1 -1
  127. package/dist/Picker/__tests__/fixtures/A11yDemos.js +2 -2
  128. package/dist/Popover/Popover.d.ts +1 -1
  129. package/dist/Popover/Popover.js +8 -8
  130. package/dist/Popover/Popover.types.d.ts +1 -1
  131. package/dist/Popover/__tests__/fixtures/A11yDemos.d.ts +1 -1
  132. package/dist/Popover/__tests__/fixtures/A11yDemos.js +21 -21
  133. package/dist/Portal/Portal.d.ts +1 -1
  134. package/dist/Portal/Portal.js +3 -3
  135. package/dist/Portal/Portal.miniapp.js +14 -8
  136. package/dist/Portal/Portal.types.d.ts +1 -1
  137. package/dist/Progress/Progress.d.ts +1 -1
  138. package/dist/Progress/Progress.js +4 -4
  139. package/dist/Progress/Progress.types.d.ts +1 -1
  140. package/dist/Progress/__tests__/fixtures/A11yDemos.d.ts +1 -1
  141. package/dist/Progress/__tests__/fixtures/A11yDemos.js +9 -9
  142. package/dist/Radio/RadioButtonIcon.d.ts +1 -1
  143. package/dist/Radio/RadioButtonIcon.js +4 -4
  144. package/dist/Radio/RadioContext.d.ts +1 -1
  145. package/dist/Radio/RadioContext.js +2 -2
  146. package/dist/Radio/__tests__/fixtures/A11yDemos.d.ts +1 -1
  147. package/dist/Radio/__tests__/fixtures/A11yDemos.js +4 -4
  148. package/dist/Rating/Rating.types.d.ts +1 -1
  149. package/dist/ScrollView/ScrollView.types.d.ts +210 -1
  150. package/dist/ScrollView/__tests__/fixtures/A11yDemos.d.ts +1 -1
  151. package/dist/ScrollView/__tests__/fixtures/A11yDemos.js +30 -30
  152. package/dist/ScrollView/useScrollView.js +16 -4
  153. package/dist/Skeleton/Skeleton.d.ts +1 -1
  154. package/dist/Skeleton/Skeleton.js +3 -3
  155. package/dist/Skeleton/Skeleton.types.d.ts +1 -1
  156. package/dist/Slide/Slide.d.ts +1 -1
  157. package/dist/Slide/Slide.js +4 -4
  158. package/dist/Slide/Slide.miniapp.js +13 -10
  159. package/dist/Slider/Slider.types.d.ts +1 -1
  160. package/dist/Steps/Step.types.d.ts +1 -1
  161. package/dist/Steps/StepsContext.d.ts +1 -1
  162. package/dist/Steps/StepsContext.js +2 -2
  163. package/dist/SwipeAction/SwipeAction.js +7 -8
  164. package/dist/SwipeAction/SwipeAction.types.d.ts +1 -1
  165. package/dist/Swiper/Swiper.types.d.ts +1 -1
  166. package/dist/Swiper/SwiperItem.d.ts +1 -1
  167. package/dist/Swiper/SwiperItem.js +2 -2
  168. package/dist/Switch/__tests__/fixtures/A11yDemos.d.ts +1 -1
  169. package/dist/Switch/__tests__/fixtures/A11yDemos.js +4 -4
  170. package/dist/TabBar/TabBar.d.ts +1 -1
  171. package/dist/TabBar/TabBar.js +5 -5
  172. package/dist/Tabs/Tab.css +1 -23
  173. package/dist/Tabs/Tab.d.ts +2 -2
  174. package/dist/Tabs/Tab.js +42 -34
  175. package/dist/Tabs/Tab.types.d.ts +1 -1
  176. package/dist/Tabs/TabIndicator.d.ts +11 -0
  177. package/dist/Tabs/TabIndicator.js +185 -0
  178. package/dist/Tabs/TabMask.d.ts +7 -0
  179. package/dist/Tabs/TabMask.js +47 -0
  180. package/dist/Tabs/TabPanel.js +4 -4
  181. package/dist/Tabs/TabPanel.types.d.ts +1 -1
  182. package/dist/Tabs/Tabs.css +15 -6
  183. package/dist/Tabs/Tabs.js +99 -157
  184. package/dist/Tabs/Tabs.types.d.ts +5 -6
  185. package/dist/Tabs/TabsContext.d.ts +15 -6
  186. package/dist/Tabs/TabsContext.js +6 -14
  187. package/dist/Tabs/classes.d.ts +13 -0
  188. package/dist/Tabs/classes.js +63 -0
  189. package/dist/Tabs/index.css +16 -29
  190. package/dist/Tabs/index.d.ts +2 -2
  191. package/dist/Tabs/index.js +4 -4
  192. package/dist/Tabs/index.miniapp.d.ts +5 -0
  193. package/dist/Tabs/index.miniapp.js +50 -0
  194. package/dist/Tabs/miniapp/Tab.d.ts +5 -0
  195. package/dist/Tabs/miniapp/Tab.js +106 -0
  196. package/dist/Tabs/miniapp/TabIndicator.d.ts +15 -0
  197. package/dist/Tabs/miniapp/TabIndicator.js +301 -0
  198. package/dist/Tabs/miniapp/Tabs.d.ts +5 -0
  199. package/dist/Tabs/miniapp/Tabs.js +251 -0
  200. package/dist/Tabs/miniapp/TabsContext.d.ts +17 -0
  201. package/dist/Tabs/miniapp/TabsContext.js +39 -0
  202. package/dist/Tabs/miniapp/index.d.ts +2 -0
  203. package/dist/Tabs/miniapp/index.js +41 -0
  204. package/dist/Tabs/miniapp/scroll.d.ts +21 -0
  205. package/dist/Tabs/miniapp/scroll.js +52 -0
  206. package/dist/Tabs/miniapp/utils/queryBatch.d.ts +68 -0
  207. package/dist/Tabs/miniapp/utils/queryBatch.js +100 -0
  208. package/dist/Tabs/utils/scroll.js +10 -4
  209. package/dist/Tag/Tag.css +0 -1
  210. package/dist/Tag/Tag.d.ts +1 -1
  211. package/dist/Tag/Tag.js +6 -6
  212. package/dist/Tag/Tag.types.d.ts +1 -1
  213. package/dist/Tag/TagGroup.d.ts +1 -1
  214. package/dist/Tag/TagGroup.js +3 -3
  215. package/dist/Tag/TagGroup.types.d.ts +1 -1
  216. package/dist/Tag/__tests__/fixtures/A11yDemos.js +3 -3
  217. package/dist/Tag/index.css +0 -1
  218. package/dist/TextArea/__tests__/fixtures/A11yDemos.d.ts +1 -1
  219. package/dist/TextArea/__tests__/fixtures/A11yDemos.js +6 -6
  220. package/dist/ThemeProvider/hooks/ThemeContext.d.ts +1 -1
  221. package/dist/ThemeProvider/hooks/ThemeContext.js +2 -2
  222. package/dist/ThemeProvider/hooks/useTheme.js +2 -2
  223. package/dist/ThemeProvider/utils/mountTokens.js +2 -2
  224. package/dist/Toast/Toast.d.ts +1 -1
  225. package/dist/Toast/Toast.js +8 -8
  226. package/dist/Toast/__tests__/fixtures/A11yDemos.d.ts +1 -1
  227. package/dist/Toast/__tests__/fixtures/A11yDemos.js +2 -2
  228. package/dist/Tooltip/Tooltip.d.ts +1 -1
  229. package/dist/Tooltip/Tooltip.js +5 -5
  230. package/dist/Tooltip/Tooltip.types.d.ts +1 -1
  231. package/dist/Tooltip/__tests__/fixtures/A11yDemos.d.ts +1 -1
  232. package/dist/Tooltip/__tests__/fixtures/A11yDemos.js +14 -14
  233. package/dist/Transition/Transition.d.ts +1 -1
  234. package/dist/Transition/Transition.js +3 -3
  235. package/dist/Transition/Transition.miniapp.d.ts +1 -1
  236. package/dist/Transition/Transition.miniapp.js +3 -3
  237. package/dist/Transition/TransitionCore.js +8 -2
  238. package/dist/_.._/benchmarks/components/Button.d.js +15 -0
  239. package/dist/_.._/benchmarks/components/Button.js +2 -2
  240. package/dist/_.._/benchmarks/components/Input.d.js +15 -0
  241. package/dist/_.._/benchmarks/components/Tabs.d.js +15 -0
  242. package/es/ActionSheet/ActionSheet.d.ts +1 -1
  243. package/es/ActionSheet/ActionSheet.js +1 -1
  244. package/es/ActionSheet/ActionSheet.types.d.ts +1 -1
  245. package/es/ActionSheet/ActionSheetContext.d.ts +1 -1
  246. package/es/ActionSheet/ActionSheetContext.js +1 -1
  247. package/es/ActionSheet/ActionSheetItem.types.d.ts +1 -1
  248. package/es/Alert/Alert.d.ts +1 -1
  249. package/es/Alert/Alert.js +1 -1
  250. package/es/Alert/__tests__/fixtures/A11yDemos.d.ts +1 -1
  251. package/es/Alert/__tests__/fixtures/A11yDemos.js +1 -1
  252. package/es/Avatar/Avatar.d.ts +1 -1
  253. package/es/Avatar/Avatar.js +1 -1
  254. package/es/Avatar/Avatar.types.d.ts +1 -1
  255. package/es/Avatar/AvatarGroup.types.d.ts +1 -1
  256. package/es/Backdrop/Backdrop.d.ts +1 -1
  257. package/es/Backdrop/Backdrop.js +1 -1
  258. package/es/Backdrop/Backdrop.types.d.ts +1 -1
  259. package/es/Backdrop/__tests__/fixtures/A11yDemos.d.ts +1 -1
  260. package/es/Backdrop/__tests__/fixtures/A11yDemos.js +1 -1
  261. package/es/Badge/Badge.d.ts +1 -1
  262. package/es/Badge/Badge.js +1 -1
  263. package/es/Badge/__tests__/fixtures/A11yDemos.d.ts +1 -1
  264. package/es/Badge/__tests__/fixtures/A11yDemos.js +1 -1
  265. package/es/Breadcrumb/Breadcrumb.d.ts +1 -1
  266. package/es/Breadcrumb/Breadcrumb.js +1 -1
  267. package/es/Breadcrumb/Breadcrumb.types.d.ts +1 -1
  268. package/es/Breadcrumb/BreadcrumbItem.d.ts +1 -1
  269. package/es/Breadcrumb/BreadcrumbItem.js +1 -1
  270. package/es/Button/Button.d.ts +1 -1
  271. package/es/Button/Button.js +1 -1
  272. package/es/Button/Button.types.d.ts +1 -1
  273. package/es/Button/__tests__/fixtures/A11yDemos.d.ts +1 -1
  274. package/es/Button/__tests__/fixtures/A11yDemos.js +1 -1
  275. package/es/Button/index.css +2 -3
  276. package/es/Calendar/Calendar.types.d.ts +1 -1
  277. package/es/Calendar/__tests__/fixtures/A11yDemos.d.ts +1 -1
  278. package/es/Calendar/__tests__/fixtures/A11yDemos.js +1 -1
  279. package/es/Card/Card.d.ts +1 -1
  280. package/es/Card/Card.js +1 -1
  281. package/es/Card/Card.types.d.ts +1 -1
  282. package/es/Card/CardContent.d.ts +1 -1
  283. package/es/Card/CardContent.js +1 -1
  284. package/es/Card/CardContent.types.d.ts +1 -1
  285. package/es/Card/CardFooter.d.ts +1 -1
  286. package/es/Card/CardFooter.js +1 -1
  287. package/es/Card/CardFooter.types.d.ts +1 -1
  288. package/es/Card/CardHeader.d.ts +1 -1
  289. package/es/Card/CardHeader.js +1 -1
  290. package/es/Checkbox/CheckboxContext.d.ts +1 -1
  291. package/es/Checkbox/CheckboxContext.js +1 -1
  292. package/es/Checkbox/__tests__/fixtures/A11yDemos.d.ts +1 -1
  293. package/es/Checkbox/__tests__/fixtures/A11yDemos.js +1 -1
  294. package/es/CitySelector/CitySelector.types.d.ts +1 -0
  295. package/es/CitySelector/Selector/index.d.ts +1 -1
  296. package/es/CitySelector/Selector/index.js +1 -1
  297. package/es/Collapse/Collapse.types.d.ts +1 -1
  298. package/es/CollapsePanel/CollapsePanel.d.ts +1 -1
  299. package/es/CollapsePanel/CollapsePanel.js +1 -1
  300. package/es/CollapsePanel/CollapsePanel.types.d.ts +1 -1
  301. package/es/CollapsePanel/CollapsePanelItem.d.ts +1 -1
  302. package/es/CollapsePanel/CollapsePanelItem.js +1 -1
  303. package/es/Countdown/Countdown.types.d.ts +2 -2
  304. package/es/Countdown/__tests__/fixtures/A11yDemos.d.ts +1 -1
  305. package/es/Countdown/__tests__/fixtures/A11yDemos.js +1 -1
  306. package/es/Countdown/utils.d.ts +2 -2
  307. package/es/Countdown/utils.js +4 -4
  308. package/es/DatePicker/DatePicker.types.d.ts +1 -1
  309. package/es/DesktopPicker/DesktopPicker.types.d.ts +1 -1
  310. package/es/DesktopTimePicker/DesktopTimePicker.types.d.ts +11 -11
  311. package/es/DesktopTimePicker/useGetTimePickerContent.js +3 -3
  312. package/es/DesktopTimePicker/utils/utils.d.ts +1 -1
  313. package/es/DesktopTimePicker/utils/utils.js +2 -2
  314. package/es/Dialog/__tests__/fixtures/A11yDemos.d.ts +1 -1
  315. package/es/Dialog/__tests__/fixtures/A11yDemos.js +1 -1
  316. package/es/Divider/Divider.types.d.ts +1 -1
  317. package/es/Drawer/Drawer.d.ts +1 -1
  318. package/es/Drawer/Drawer.js +1 -1
  319. package/es/Drawer/Drawer.types.d.ts +1 -1
  320. package/es/Fade/Fade.d.ts +1 -1
  321. package/es/Fade/Fade.js +1 -1
  322. package/es/Fade/Fade.miniapp.js +14 -11
  323. package/es/Fade/Fade.types.d.ts +1 -1
  324. package/es/IconButton/IconButton.d.ts +1 -1
  325. package/es/IconButton/IconButton.js +1 -1
  326. package/es/IconButton/IconButton.types.d.ts +1 -1
  327. package/es/Input/Input.types.d.ts +1 -1
  328. package/es/Input/__tests__/fixtures/A11yDemos.d.ts +1 -1
  329. package/es/Input/__tests__/fixtures/A11yDemos.js +1 -1
  330. package/es/ItemSelector/ItemSelector.miniapp.js +7 -5
  331. package/es/ItemSelector/ItemSelector.types.d.ts +1 -0
  332. package/es/ItemSelector/Selector/index.d.ts +1 -1
  333. package/es/ItemSelector/Selector/index.js +1 -1
  334. package/es/List/List.d.ts +1 -1
  335. package/es/List/List.js +1 -1
  336. package/es/List/ListContext.d.ts +1 -1
  337. package/es/List/ListContext.js +1 -1
  338. package/es/List/ListItem.d.ts +1 -1
  339. package/es/List/ListItem.js +1 -1
  340. package/es/List/ListItem.types.d.ts +1 -1
  341. package/es/List/ListItemContent.d.ts +1 -1
  342. package/es/List/ListItemContent.js +1 -1
  343. package/es/List/ListItemContent.types.d.ts +1 -1
  344. package/es/List/ListItemExtra.d.ts +1 -1
  345. package/es/List/ListItemExtra.js +1 -1
  346. package/es/List/ListItemExtra.types.d.ts +1 -1
  347. package/es/List/ListItemFooter.d.ts +1 -1
  348. package/es/List/ListItemFooter.js +1 -1
  349. package/es/List/ListItemFooter.types.d.ts +1 -1
  350. package/es/List/ListItemHeader.d.ts +1 -1
  351. package/es/List/ListItemHeader.js +1 -1
  352. package/es/List/ListItemHeader.types.d.ts +1 -1
  353. package/es/Loading/Loading.d.ts +1 -1
  354. package/es/Loading/Loading.js +1 -1
  355. package/es/Loading/Loading.types.d.ts +1 -1
  356. package/es/Modal/Modal.d.ts +1 -1
  357. package/es/Modal/Modal.js +1 -1
  358. package/es/Modal/Modal.miniapp.d.ts +2 -2
  359. package/es/Modal/Modal.miniapp.js +1 -1
  360. package/es/Modal/__tests__/fixtures/A11yDemos.d.ts +1 -1
  361. package/es/Modal/__tests__/fixtures/A11yDemos.js +1 -1
  362. package/es/Modal/useModal.js +26 -29
  363. package/es/NavBar/NavBar.d.ts +1 -1
  364. package/es/NavBar/NavBar.js +1 -1
  365. package/es/Picker/Picker.js +0 -1
  366. package/es/Picker/Picker.types.d.ts +1 -1
  367. package/es/Picker/__tests__/fixtures/A11yDemos.d.ts +1 -1
  368. package/es/Picker/__tests__/fixtures/A11yDemos.js +1 -1
  369. package/es/Popover/Popover.d.ts +1 -1
  370. package/es/Popover/Popover.js +1 -1
  371. package/es/Popover/Popover.types.d.ts +1 -1
  372. package/es/Popover/__tests__/fixtures/A11yDemos.d.ts +1 -1
  373. package/es/Popover/__tests__/fixtures/A11yDemos.js +1 -1
  374. package/es/Portal/Portal.d.ts +1 -1
  375. package/es/Portal/Portal.js +1 -1
  376. package/es/Portal/Portal.miniapp.js +15 -9
  377. package/es/Portal/Portal.types.d.ts +1 -1
  378. package/es/Progress/Progress.d.ts +1 -1
  379. package/es/Progress/Progress.js +1 -1
  380. package/es/Progress/Progress.types.d.ts +1 -1
  381. package/es/Progress/__tests__/fixtures/A11yDemos.d.ts +1 -1
  382. package/es/Progress/__tests__/fixtures/A11yDemos.js +1 -1
  383. package/es/Radio/RadioButtonIcon.d.ts +1 -1
  384. package/es/Radio/RadioButtonIcon.js +1 -1
  385. package/es/Radio/RadioContext.d.ts +1 -1
  386. package/es/Radio/RadioContext.js +1 -1
  387. package/es/Radio/__tests__/fixtures/A11yDemos.d.ts +1 -1
  388. package/es/Radio/__tests__/fixtures/A11yDemos.js +1 -1
  389. package/es/Rating/Rating.types.d.ts +1 -1
  390. package/es/ScrollView/ScrollView.types.d.ts +210 -1
  391. package/es/ScrollView/__tests__/fixtures/A11yDemos.d.ts +1 -1
  392. package/es/ScrollView/__tests__/fixtures/A11yDemos.js +1 -1
  393. package/es/ScrollView/useScrollView.js +16 -4
  394. package/es/Skeleton/Skeleton.d.ts +1 -1
  395. package/es/Skeleton/Skeleton.js +1 -1
  396. package/es/Skeleton/Skeleton.types.d.ts +1 -1
  397. package/es/Slide/Slide.d.ts +1 -1
  398. package/es/Slide/Slide.js +1 -1
  399. package/es/Slide/Slide.miniapp.js +14 -11
  400. package/es/Slider/Slider.types.d.ts +1 -1
  401. package/es/Steps/Step.types.d.ts +1 -1
  402. package/es/Steps/StepsContext.d.ts +1 -1
  403. package/es/Steps/StepsContext.js +1 -1
  404. package/es/SwipeAction/SwipeAction.js +7 -8
  405. package/es/SwipeAction/SwipeAction.types.d.ts +1 -1
  406. package/es/Swiper/Swiper.js +5 -1
  407. package/es/Swiper/Swiper.types.d.ts +1 -1
  408. package/es/Swiper/SwiperItem.d.ts +1 -1
  409. package/es/Swiper/SwiperItem.js +1 -1
  410. package/es/Switch/__tests__/fixtures/A11yDemos.d.ts +1 -1
  411. package/es/Switch/__tests__/fixtures/A11yDemos.js +1 -1
  412. package/es/TabBar/TabBar.d.ts +1 -1
  413. package/es/TabBar/TabBar.js +1 -1
  414. package/es/Tabs/Tab.css +1 -23
  415. package/es/Tabs/Tab.d.ts +2 -2
  416. package/es/Tabs/Tab.js +44 -36
  417. package/es/Tabs/Tab.types.d.ts +1 -1
  418. package/es/Tabs/TabIndicator.d.ts +11 -0
  419. package/es/Tabs/TabIndicator.js +156 -0
  420. package/es/Tabs/TabMask.d.ts +7 -0
  421. package/es/Tabs/TabMask.js +18 -0
  422. package/es/Tabs/TabPanel.js +8 -4
  423. package/es/Tabs/TabPanel.types.d.ts +1 -1
  424. package/es/Tabs/Tabs.css +15 -6
  425. package/es/Tabs/Tabs.js +100 -158
  426. package/es/Tabs/Tabs.types.d.ts +5 -6
  427. package/es/Tabs/TabsContext.d.ts +15 -6
  428. package/es/Tabs/TabsContext.js +6 -4
  429. package/es/Tabs/classes.d.ts +13 -0
  430. package/es/Tabs/classes.js +28 -0
  431. package/es/Tabs/index.css +16 -29
  432. package/es/Tabs/index.d.ts +2 -2
  433. package/es/Tabs/index.js +2 -2
  434. package/es/Tabs/index.miniapp.d.ts +5 -0
  435. package/es/Tabs/index.miniapp.js +11 -0
  436. package/es/Tabs/miniapp/Tab.d.ts +5 -0
  437. package/es/Tabs/miniapp/Tab.js +77 -0
  438. package/es/Tabs/miniapp/TabIndicator.d.ts +15 -0
  439. package/es/Tabs/miniapp/TabIndicator.js +272 -0
  440. package/es/Tabs/miniapp/Tabs.d.ts +5 -0
  441. package/es/Tabs/miniapp/Tabs.js +229 -0
  442. package/es/Tabs/miniapp/TabsContext.d.ts +17 -0
  443. package/es/Tabs/miniapp/TabsContext.js +16 -0
  444. package/es/Tabs/miniapp/index.d.ts +2 -0
  445. package/es/Tabs/miniapp/index.js +7 -0
  446. package/es/Tabs/miniapp/scroll.d.ts +21 -0
  447. package/es/Tabs/miniapp/scroll.js +29 -0
  448. package/es/Tabs/miniapp/utils/queryBatch.d.ts +68 -0
  449. package/es/Tabs/miniapp/utils/queryBatch.js +65 -0
  450. package/es/Tabs/utils/scroll.js +10 -4
  451. package/es/Tag/Tag.css +0 -1
  452. package/es/Tag/Tag.d.ts +1 -1
  453. package/es/Tag/Tag.js +4 -4
  454. package/es/Tag/Tag.types.d.ts +1 -1
  455. package/es/Tag/TagGroup.d.ts +1 -1
  456. package/es/Tag/TagGroup.js +1 -1
  457. package/es/Tag/TagGroup.types.d.ts +1 -1
  458. package/es/Tag/__tests__/fixtures/A11yDemos.js +3 -3
  459. package/es/Tag/index.css +0 -1
  460. package/es/TextArea/__tests__/fixtures/A11yDemos.d.ts +1 -1
  461. package/es/TextArea/__tests__/fixtures/A11yDemos.js +1 -1
  462. package/es/ThemeProvider/hooks/ThemeContext.d.ts +1 -1
  463. package/es/ThemeProvider/hooks/ThemeContext.js +1 -1
  464. package/es/ThemeProvider/hooks/useTheme.js +1 -1
  465. package/es/ThemeProvider/utils/mountTokens.js +1 -1
  466. package/es/Toast/Toast.d.ts +1 -1
  467. package/es/Toast/Toast.js +1 -1
  468. package/es/Toast/__tests__/fixtures/A11yDemos.d.ts +1 -1
  469. package/es/Toast/__tests__/fixtures/A11yDemos.js +1 -1
  470. package/es/Tooltip/Tooltip.d.ts +1 -1
  471. package/es/Tooltip/Tooltip.js +1 -1
  472. package/es/Tooltip/Tooltip.types.d.ts +1 -1
  473. package/es/Tooltip/__tests__/fixtures/A11yDemos.d.ts +1 -1
  474. package/es/Tooltip/__tests__/fixtures/A11yDemos.js +1 -1
  475. package/es/Transition/Transition.d.ts +1 -1
  476. package/es/Transition/Transition.js +1 -1
  477. package/es/Transition/Transition.miniapp.d.ts +1 -1
  478. package/es/Transition/Transition.miniapp.js +1 -1
  479. package/es/Transition/TransitionCore.js +8 -2
  480. package/es/_.._/benchmarks/components/Button.d.js +0 -0
  481. package/es/_.._/benchmarks/components/Button.js +1 -1
  482. package/es/_.._/benchmarks/components/Input.d.js +0 -0
  483. package/es/_.._/benchmarks/components/Tabs.d.js +0 -0
  484. package/package.json +7 -6
@@ -0,0 +1,251 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+ var __async = (__this, __arguments, generator) => {
29
+ return new Promise((resolve, reject) => {
30
+ var fulfilled = (value) => {
31
+ try {
32
+ step(generator.next(value));
33
+ } catch (e) {
34
+ reject(e);
35
+ }
36
+ };
37
+ var rejected = (value) => {
38
+ try {
39
+ step(generator.throw(value));
40
+ } catch (e) {
41
+ reject(e);
42
+ }
43
+ };
44
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
45
+ step((generator = generator.apply(__this, __arguments)).next());
46
+ });
47
+ };
48
+ var Tabs_exports = {};
49
+ __export(Tabs_exports, {
50
+ default: () => Tabs_default
51
+ });
52
+ module.exports = __toCommonJS(Tabs_exports);
53
+ var import_react = __toESM(require("react"));
54
+ var import_clsx = __toESM(require("clsx"));
55
+ var import_taro = __toESM(require("@tarojs/taro"));
56
+ var import_components = require("@tarojs/components");
57
+ var import_utils = require("@bifrostui/utils");
58
+ var import_Tab = __toESM(require("./Tab"));
59
+ var import_TabIndicator = __toESM(require("./TabIndicator"));
60
+ var import_TabMask = __toESM(require("../TabMask"));
61
+ var import_TabsContext = require("./TabsContext");
62
+ var import_classes = require("../classes");
63
+ var import_queryBatch = require("./utils/queryBatch");
64
+ var import_Tabs2 = require("../Tabs.css");
65
+ const Tabs = /* @__PURE__ */ import_react.default.forwardRef((props, ref) => {
66
+ const {
67
+ children,
68
+ className,
69
+ value,
70
+ defaultValue,
71
+ tabs = [],
72
+ onChange,
73
+ style
74
+ } = props;
75
+ const handleOnChange = (0, import_utils.useEventCallback)(
76
+ (e, data) => {
77
+ onChange == null ? void 0 : onChange(e, { index: data.value });
78
+ }
79
+ );
80
+ const [currentValue, triggerValueChange] = (0, import_utils.useValue)({
81
+ value,
82
+ defaultValue: defaultValue != null ? defaultValue : "",
83
+ onChange: handleOnChange,
84
+ config: {
85
+ name: "Tabs",
86
+ state: "value"
87
+ }
88
+ });
89
+ const tabsContainerId = (0, import_react.useMemo)(
90
+ () => `bui-tabs-${Math.random().toString(36).slice(2, 11)}`,
91
+ []
92
+ );
93
+ const scrollViewId = `${tabsContainerId}-scroll`;
94
+ const wrapperId = `${tabsContainerId}-wrapper`;
95
+ const [registeredTabValues, setRegisteredTabValues] = (0, import_react.useState)([]);
96
+ const [registrationVersion, setRegistrationVersion] = (0, import_react.useState)(0);
97
+ const [scrollLeft, setScrollLeft] = (0, import_react.useState)(0);
98
+ const [containerWidth, setContainerWidth] = (0, import_react.useState)(0);
99
+ const [scrollWidth, setScrollWidth] = (0, import_react.useState)(0);
100
+ const lastScrollLeftRef = import_react.default.useRef(0);
101
+ const isFirstScroll = import_react.default.useRef(true);
102
+ const [scrollWithAnimation, setScrollWithAnimation] = import_react.default.useState(false);
103
+ const isScrollable = scrollWidth > containerWidth;
104
+ if (process.env.NODE_ENV !== "production") {
105
+ if (tabs.length > 0 && import_react.default.Children.count(children) > 0) {
106
+ console.warn(
107
+ "BUI Warning: Tabs \u7EC4\u4EF6\u4E0D\u5E94\u8BE5\u540C\u65F6\u4F7F\u7528 tabs \u5C5E\u6027\u548C children\u3002\u8BF7\u53EA\u4F7F\u7528\u5176\u4E2D\u4E00\u79CD\u65B9\u5F0F\u3002\u5F53\u524D\u5C06\u4F18\u5148\u4F7F\u7528 tabs \u5C5E\u6027\uFF0Cchildren \u5C06\u88AB\u5FFD\u7565\u3002"
108
+ );
109
+ }
110
+ }
111
+ const onRegister = (0, import_utils.useEventCallback)((data) => {
112
+ if (data.value !== void 0 && data.value !== null) {
113
+ setRegisteredTabValues((prev) => {
114
+ if (prev.includes(data.value))
115
+ return prev;
116
+ const newValues = [...prev, data.value];
117
+ return newValues;
118
+ });
119
+ setRegistrationVersion((v) => v + 1);
120
+ }
121
+ });
122
+ const onUnregister = (0, import_utils.useEventCallback)((data) => {
123
+ setRegisteredTabValues((prev) => {
124
+ const newValues = prev.filter((v) => v !== data.value);
125
+ return newValues;
126
+ });
127
+ setRegistrationVersion((v) => v + 1);
128
+ });
129
+ const handleClick = (0, import_utils.useEventCallback)(
130
+ (e, item) => {
131
+ const { index, disabled = false } = item;
132
+ if (disabled || [void 0, null].includes(index))
133
+ return;
134
+ if (index !== currentValue) {
135
+ triggerValueChange(e, index);
136
+ }
137
+ }
138
+ );
139
+ const handleScroll = (0, import_utils.useEventCallback)(
140
+ (e) => {
141
+ const { scrollLeft: newScrollLeft, scrollWidth: newScrollWidth } = e.detail;
142
+ lastScrollLeftRef.current = newScrollLeft;
143
+ if (newScrollWidth && newScrollWidth !== scrollWidth) {
144
+ setScrollWidth(newScrollWidth);
145
+ }
146
+ }
147
+ );
148
+ import_react.default.useEffect(() => {
149
+ if (!scrollViewId || registeredTabValues.length === 0)
150
+ return;
151
+ import_taro.default.nextTick(() => __async(void 0, null, function* () {
152
+ const { rect, fields } = yield (0, import_queryBatch.batchQueryContainerSize)(scrollViewId);
153
+ if (rect) {
154
+ setContainerWidth(rect.width);
155
+ }
156
+ if (fields) {
157
+ setScrollWidth(fields.scrollWidth || 0);
158
+ }
159
+ }));
160
+ }, [scrollViewId, registrationVersion, registeredTabValues.length]);
161
+ const centerActiveTab = (0, import_utils.useEventCallback)(() => __async(void 0, null, function* () {
162
+ if (!currentValue || registeredTabValues.length === 0) {
163
+ return;
164
+ }
165
+ const { scrollView, scrollFields, wrapper, currentTab } = yield (0, import_queryBatch.batchQueryForScroll)({
166
+ scrollViewId,
167
+ wrapperId,
168
+ currentTabValue: currentValue
169
+ });
170
+ if (!scrollView || !scrollFields || !wrapper || !currentTab || currentTab.width === 0) {
171
+ return;
172
+ }
173
+ const tabLeftRelativeToWrapper = currentTab.left - wrapper.left;
174
+ const tabWidth = currentTab.width;
175
+ const containerViewWidth = scrollView.width;
176
+ const currentScrollWidth = scrollFields.scrollWidth || scrollView.width;
177
+ const targetScrollLeft = tabLeftRelativeToWrapper - (containerViewWidth - tabWidth) / 2;
178
+ const maxScrollDistance = currentScrollWidth - containerViewWidth;
179
+ const finalScrollLeft = Math.max(
180
+ 0,
181
+ Math.min(targetScrollLeft, maxScrollDistance)
182
+ );
183
+ setScrollLeft(finalScrollLeft);
184
+ lastScrollLeftRef.current = finalScrollLeft;
185
+ if (isFirstScroll.current) {
186
+ import_taro.default.nextTick(() => {
187
+ setScrollWithAnimation(true);
188
+ });
189
+ isFirstScroll.current = false;
190
+ }
191
+ }));
192
+ import_react.default.useEffect(() => {
193
+ if (!currentValue || registeredTabValues.length === 0) {
194
+ return;
195
+ }
196
+ import_taro.default.nextTick(() => {
197
+ centerActiveTab();
198
+ });
199
+ }, [currentValue, centerActiveTab]);
200
+ import_react.default.useEffect(() => {
201
+ if (!currentValue || registeredTabValues.length === 0) {
202
+ return;
203
+ }
204
+ import_taro.default.nextTick(() => {
205
+ centerActiveTab();
206
+ });
207
+ }, [registrationVersion, centerActiveTab]);
208
+ const contextValue = (0, import_react.useMemo)(
209
+ () => ({
210
+ value: currentValue,
211
+ triggerChange: handleClick,
212
+ onRegister,
213
+ onUnregister,
214
+ tabsContainerId: wrapperId
215
+ }),
216
+ [currentValue, handleClick, onRegister, onUnregister, wrapperId]
217
+ );
218
+ const renderedTabs = (0, import_react.useMemo)(() => {
219
+ if (tabs.length > 0) {
220
+ return tabs.map((item) => /* @__PURE__ */ import_react.default.createElement(import_Tab.default, { key: item.index, index: item == null ? void 0 : item.index, disabled: item == null ? void 0 : item.disabled }, item.title));
221
+ }
222
+ return children;
223
+ }, [tabs, children]);
224
+ return /* @__PURE__ */ import_react.default.createElement("div", { className: (0, import_clsx.default)(import_classes.tabsRootClass, className), style, ref }, isScrollable && /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(import_TabMask.default, { position: "left" }), /* @__PURE__ */ import_react.default.createElement(import_TabMask.default, { position: "right" })), /* @__PURE__ */ import_react.default.createElement(
225
+ import_components.ScrollView,
226
+ {
227
+ id: scrollViewId,
228
+ className: import_classes.tabsScrollClass,
229
+ scrollX: true,
230
+ scrollWithAnimation,
231
+ scrollLeft,
232
+ onScroll: handleScroll,
233
+ enhanced: true,
234
+ showScrollbar: false,
235
+ enablePassive: true,
236
+ enableFlex: true
237
+ },
238
+ /* @__PURE__ */ import_react.default.createElement("div", { id: wrapperId, className: import_classes.tabsScrollWrapperClass }, /* @__PURE__ */ import_react.default.createElement(
239
+ import_TabIndicator.default,
240
+ {
241
+ currentValue,
242
+ registeredTabValues,
243
+ wrapperId,
244
+ scrollViewId,
245
+ registrationVersion
246
+ }
247
+ ), /* @__PURE__ */ import_react.default.createElement(import_TabsContext.TabsContextProvider, { value: contextValue }, renderedTabs))
248
+ ));
249
+ });
250
+ Tabs.displayName = "BuiTabs";
251
+ var Tabs_default = Tabs;
@@ -0,0 +1,17 @@
1
+ import { TabChangeEvent } from '../Tabs.types';
2
+ export interface TabRegisterData {
3
+ value: string;
4
+ }
5
+ export interface TabsContextValueType {
6
+ value?: string;
7
+ triggerChange?: TabChangeEvent;
8
+ onRegister?: (data: TabRegisterData) => void;
9
+ onUnregister?: (data: {
10
+ value: string;
11
+ }) => void;
12
+ /** 容器的唯一ID,用于生成子元素ID */
13
+ tabsContainerId?: string;
14
+ }
15
+ declare const TabsContext: import("@bifrostui/utils").Context<TabsContextValueType>;
16
+ export declare const TabsContextProvider: import("react").Provider<TabsContextValueType> & import("react").FC<import("react").ProviderProps<TabsContextValueType>>;
17
+ export default TabsContext;
@@ -0,0 +1,39 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var TabsContext_exports = {};
19
+ __export(TabsContext_exports, {
20
+ TabsContextProvider: () => TabsContextProvider,
21
+ default: () => TabsContext_default
22
+ });
23
+ module.exports = __toCommonJS(TabsContext_exports);
24
+ var import_utils = require("@bifrostui/utils");
25
+ const TabsContext = (0, import_utils.createContext)({
26
+ triggerChange: void 0,
27
+ onRegister: void 0,
28
+ onUnregister: void 0,
29
+ tabsContainerId: void 0
30
+ });
31
+ if (process.env.NODE_ENV !== "production") {
32
+ TabsContext.displayName = "BuiTabsContext";
33
+ }
34
+ const TabsContextProvider = TabsContext.Provider;
35
+ var TabsContext_default = TabsContext;
36
+ // Annotate the CommonJS export names for ESM import in node:
37
+ 0 && (module.exports = {
38
+ TabsContextProvider
39
+ });
@@ -0,0 +1,2 @@
1
+ export { default as Tab } from './Tab';
2
+ export { default, default as Tabs } from './Tabs';
@@ -0,0 +1,41 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+ var miniapp_exports = {};
29
+ __export(miniapp_exports, {
30
+ Tab: () => import_Tab.default,
31
+ Tabs: () => import_Tabs.default,
32
+ default: () => import_Tabs.default
33
+ });
34
+ module.exports = __toCommonJS(miniapp_exports);
35
+ var import_Tab = __toESM(require("./Tab"));
36
+ var import_Tabs = __toESM(require("./Tabs"));
37
+ // Annotate the CommonJS export names for ESM import in node:
38
+ 0 && (module.exports = {
39
+ Tab,
40
+ Tabs
41
+ });
@@ -0,0 +1,21 @@
1
+ /**
2
+ * 小程序版scroll-view滚动到指定位置
3
+ * 使用scroll-left属性和scroll-with-animation实现平滑滚动
4
+ */
5
+ interface ScrollToOptions {
6
+ scrollViewId: string;
7
+ scrollLeft: number;
8
+ duration?: number;
9
+ }
10
+ declare const scrollLeftTo: ({ scrollViewId, scrollLeft, duration, }: ScrollToOptions) => Promise<void>;
11
+ /**
12
+ * 计算将目标元素滚动到视图中心所需的 scrollLeft 值
13
+ */
14
+ interface CalcCenterScrollOptions {
15
+ containerWidth: number;
16
+ targetLeft: number;
17
+ targetWidth: number;
18
+ currentScrollLeft?: number;
19
+ }
20
+ export declare const calcCenterScroll: ({ containerWidth, targetLeft, targetWidth, currentScrollLeft, }: CalcCenterScrollOptions) => number;
21
+ export default scrollLeftTo;
@@ -0,0 +1,52 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var scroll_exports = {};
19
+ __export(scroll_exports, {
20
+ calcCenterScroll: () => calcCenterScroll,
21
+ default: () => scroll_default
22
+ });
23
+ module.exports = __toCommonJS(scroll_exports);
24
+ const scrollLeftTo = ({
25
+ scrollViewId,
26
+ scrollLeft,
27
+ duration = 300
28
+ }) => {
29
+ return new Promise((resolve) => {
30
+ if (duration > 0) {
31
+ setTimeout(resolve, duration);
32
+ } else {
33
+ resolve();
34
+ }
35
+ });
36
+ };
37
+ const calcCenterScroll = ({
38
+ containerWidth,
39
+ targetLeft,
40
+ targetWidth,
41
+ currentScrollLeft = 0
42
+ }) => {
43
+ const targetCenter = targetLeft + targetWidth / 2;
44
+ const containerCenter = containerWidth / 2;
45
+ const scrollLeft = targetCenter - containerCenter;
46
+ return Math.max(0, scrollLeft);
47
+ };
48
+ var scroll_default = scrollLeftTo;
49
+ // Annotate the CommonJS export names for ESM import in node:
50
+ 0 && (module.exports = {
51
+ calcCenterScroll
52
+ });
@@ -0,0 +1,68 @@
1
+ import Taro from '@tarojs/taro';
2
+ /**
3
+ * Fields查询结果(包含scrollWidth)
4
+ */
5
+ export interface ScrollFieldsResult {
6
+ scrollWidth?: number;
7
+ scrollHeight?: number;
8
+ scrollLeft?: number;
9
+ scrollTop?: number;
10
+ [key: string]: any;
11
+ }
12
+ /**
13
+ * 批量查询结果接口
14
+ */
15
+ export interface BatchQueryResult {
16
+ scrollView: Taro.NodesRef.BoundingClientRectCallbackResult | null;
17
+ scrollInfo: Taro.NodesRef.ScrollOffsetCallbackResult | null;
18
+ scrollFields: ScrollFieldsResult | null;
19
+ wrapper: Taro.NodesRef.BoundingClientRectCallbackResult | null;
20
+ indicator: Taro.NodesRef.BoundingClientRectCallbackResult | null;
21
+ tabs: (Taro.NodesRef.BoundingClientRectCallbackResult | null)[];
22
+ }
23
+ /**
24
+ * 批量查询Tab相关元素
25
+ * 优化:一次性查询所有需要的DOM信息,减少查询次数
26
+ *
27
+ * @param scrollViewId - ScrollView的ID
28
+ * @param wrapperId - Wrapper容器的ID
29
+ * @param tabValues - 需要查询的Tab值数组
30
+ * @returns Promise<BatchQueryResult>
31
+ */
32
+ export declare const batchQueryTabs: (params: {
33
+ scrollViewId: string;
34
+ wrapperId: string;
35
+ tabValues: string[];
36
+ }) => Promise<BatchQueryResult>;
37
+ /**
38
+ * 简化版批量查询(用于Tabs组件的居中滚动)
39
+ * 只查询必要的元素:ScrollView、Wrapper、当前Tab
40
+ *
41
+ * @param scrollViewId - ScrollView的ID
42
+ * @param wrapperId - Wrapper容器的ID
43
+ * @param currentTabValue - 当前Tab的值
44
+ * @returns Promise
45
+ */
46
+ export declare const batchQueryForScroll: (params: {
47
+ scrollViewId: string;
48
+ wrapperId: string;
49
+ currentTabValue: string;
50
+ }) => Promise<{
51
+ scrollView: Taro.NodesRef.BoundingClientRectCallbackResult | null;
52
+ scrollInfo: Taro.NodesRef.ScrollOffsetCallbackResult | null;
53
+ scrollFields: ScrollFieldsResult | null;
54
+ wrapper: Taro.NodesRef.BoundingClientRectCallbackResult | null;
55
+ currentTab: Taro.NodesRef.BoundingClientRectCallbackResult | null;
56
+ }>;
57
+ /**
58
+ * 简化版批量查询(用于初始化容器尺寸)
59
+ * 只查询ScrollView的尺寸和滚动信息
60
+ *
61
+ * @param scrollViewId - ScrollView的ID
62
+ * @returns Promise
63
+ */
64
+ export declare const batchQueryContainerSize: (scrollViewId: string) => Promise<{
65
+ rect: Taro.NodesRef.BoundingClientRectCallbackResult | null;
66
+ scroll: Taro.NodesRef.ScrollOffsetCallbackResult | null;
67
+ fields: ScrollFieldsResult | null;
68
+ }>;
@@ -0,0 +1,100 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+ var queryBatch_exports = {};
29
+ __export(queryBatch_exports, {
30
+ batchQueryContainerSize: () => batchQueryContainerSize,
31
+ batchQueryForScroll: () => batchQueryForScroll,
32
+ batchQueryTabs: () => batchQueryTabs
33
+ });
34
+ module.exports = __toCommonJS(queryBatch_exports);
35
+ var import_taro = __toESM(require("@tarojs/taro"));
36
+ const batchQueryTabs = (params) => {
37
+ const { scrollViewId, wrapperId, tabValues } = params;
38
+ return new Promise((resolve) => {
39
+ const query = import_taro.default.createSelectorQuery();
40
+ query.select(`#${scrollViewId}`).boundingClientRect();
41
+ query.select(`#${scrollViewId}`).scrollOffset();
42
+ query.select(`#${scrollViewId}`).fields({ scrollOffset: true, size: true }, null);
43
+ query.select(`#${wrapperId}`).boundingClientRect();
44
+ query.select(`#${wrapperId}-indicator`).boundingClientRect();
45
+ tabValues.forEach((value) => {
46
+ query.select(`#${wrapperId}-tab-${value}`).boundingClientRect();
47
+ });
48
+ query.exec((res) => {
49
+ resolve({
50
+ scrollView: res[0] || null,
51
+ scrollInfo: res[1] || null,
52
+ scrollFields: res[2] || null,
53
+ wrapper: res[3] || null,
54
+ indicator: res[4] || null,
55
+ tabs: res.slice(5)
56
+ });
57
+ });
58
+ });
59
+ };
60
+ const batchQueryForScroll = (params) => {
61
+ const { scrollViewId, wrapperId, currentTabValue } = params;
62
+ return new Promise((resolve) => {
63
+ const query = import_taro.default.createSelectorQuery();
64
+ query.select(`#${scrollViewId}`).boundingClientRect();
65
+ query.select(`#${scrollViewId}`).scrollOffset();
66
+ query.select(`#${scrollViewId}`).fields({ scrollOffset: true, size: true }, null);
67
+ query.select(`#${wrapperId}`).boundingClientRect();
68
+ query.select(`#${wrapperId}-tab-${currentTabValue}`).boundingClientRect();
69
+ query.exec((res) => {
70
+ resolve({
71
+ scrollView: res[0] || null,
72
+ scrollInfo: res[1] || null,
73
+ scrollFields: res[2] || null,
74
+ wrapper: res[3] || null,
75
+ currentTab: res[4] || null
76
+ });
77
+ });
78
+ });
79
+ };
80
+ const batchQueryContainerSize = (scrollViewId) => {
81
+ return new Promise((resolve) => {
82
+ const query = import_taro.default.createSelectorQuery();
83
+ query.select(`#${scrollViewId}`).boundingClientRect();
84
+ query.select(`#${scrollViewId}`).scrollOffset();
85
+ query.select(`#${scrollViewId}`).fields({ scrollOffset: true, size: true }, null);
86
+ query.exec((res) => {
87
+ resolve({
88
+ rect: res[0] || null,
89
+ scroll: res[1] || null,
90
+ fields: res[2] || null
91
+ });
92
+ });
93
+ });
94
+ };
95
+ // Annotate the CommonJS export names for ESM import in node:
96
+ 0 && (module.exports = {
97
+ batchQueryContainerSize,
98
+ batchQueryForScroll,
99
+ batchQueryTabs
100
+ });
@@ -20,9 +20,9 @@ __export(scroll_exports, {
20
20
  default: () => scroll_default
21
21
  });
22
22
  module.exports = __toCommonJS(scroll_exports);
23
- const root = window || global;
24
- let rafId;
23
+ const root = typeof window !== "undefined" ? window : global;
25
24
  let prev = Date.now();
25
+ const rafIdMap = /* @__PURE__ */ new WeakMap();
26
26
  const rafPolyfill = (fn) => {
27
27
  const curr = Date.now();
28
28
  const ms = Math.max(0, 16 - (curr - prev));
@@ -39,7 +39,10 @@ const raf = (fn) => {
39
39
  return requestAnimationFrame.call(root, fn);
40
40
  };
41
41
  const scrollLeftTo = (scroller, to, duration) => {
42
- cancelRaf(rafId);
42
+ const existingRafId = rafIdMap.get(scroller);
43
+ if (existingRafId !== void 0) {
44
+ cancelRaf(existingRafId);
45
+ }
43
46
  let count = 0;
44
47
  const from = scroller.scrollLeft;
45
48
  const frames = duration === 0 ? 1 : Math.round(duration / 16);
@@ -47,7 +50,10 @@ const scrollLeftTo = (scroller, to, duration) => {
47
50
  scroller.scrollLeft += (to - from) / frames;
48
51
  count += 1;
49
52
  if (count < frames) {
50
- rafId = raf(animate);
53
+ const newRafId = raf(animate);
54
+ rafIdMap.set(scroller, newRafId);
55
+ } else {
56
+ rafIdMap.delete(scroller);
51
57
  }
52
58
  }
53
59
  animate();
package/dist/Tag/Tag.css CHANGED
@@ -13,7 +13,6 @@ xhs-page {
13
13
  position: relative;
14
14
  display: inline-flex;
15
15
  align-items: center;
16
- justify-content: center;
17
16
  white-space: nowrap;
18
17
  height: var(--bui-tag-height);
19
18
  line-height: var(--bui-tag-line-height);
package/dist/Tag/Tag.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import * as React from 'react';
2
2
  import { TagProps } from './Tag.types';
3
3
  import './Tag.less';
4
4
  declare const Tag: React.ForwardRefExoticComponent<Omit<TagProps<"div", {}>, "ref"> & React.RefAttributes<HTMLDivElement>>;