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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (565) hide show
  1. package/dist/Alert/Alert.js +2 -1
  2. package/dist/Alert/__tests__/fixtures/A11yDemos.d.ts +17 -0
  3. package/dist/Alert/__tests__/fixtures/A11yDemos.js +143 -0
  4. package/dist/Alert/index.css +4 -4
  5. package/dist/Avatar/AvatarGroup.css +8 -8
  6. package/dist/Avatar/index.css +8 -8
  7. package/dist/Backdrop/Backdrop.js +3 -2
  8. package/dist/Backdrop/Backdrop.types.d.ts +4 -0
  9. package/dist/Backdrop/__tests__/fixtures/A11yDemos.d.ts +8 -0
  10. package/dist/Backdrop/__tests__/fixtures/A11yDemos.js +51 -0
  11. package/dist/Backdrop/index.css +2 -2
  12. package/dist/Badge/Badge.js +38 -11
  13. package/dist/Badge/Badge.types.d.ts +30 -1
  14. package/dist/Badge/__tests__/fixtures/A11yDemos.d.ts +25 -0
  15. package/dist/Badge/__tests__/fixtures/A11yDemos.js +110 -0
  16. package/dist/Badge/hooks/useBadgeA11y.d.ts +23 -0
  17. package/dist/Badge/hooks/useBadgeA11y.js +76 -0
  18. package/dist/Badge/hooks/useBadgeDisplay.d.ts +16 -0
  19. package/dist/Badge/hooks/useBadgeDisplay.js +56 -0
  20. package/dist/Button/Button.js +2 -1
  21. package/dist/Button/__tests__/fixtures/A11yDemos.d.ts +23 -0
  22. package/dist/Button/__tests__/fixtures/A11yDemos.js +81 -0
  23. package/dist/Button/index.css +2 -2
  24. package/dist/CSSTransition/CSSTransition.d.ts +4 -0
  25. package/dist/CSSTransition/CSSTransition.js +177 -0
  26. package/dist/CSSTransition/CSSTransition.types.d.ts +13 -0
  27. package/dist/CSSTransition/CSSTransition.types.js +15 -0
  28. package/dist/CSSTransition/demo/CSSTransitionDemo.d.ts +4 -0
  29. package/dist/CSSTransition/demo/CSSTransitionDemo.js +76 -0
  30. package/dist/CSSTransition/demo/index.css +25 -0
  31. package/dist/CSSTransition/index.d.ts +2 -0
  32. package/dist/CSSTransition/index.js +41 -0
  33. package/dist/Calendar/Calendar.js +131 -34
  34. package/dist/Calendar/Calendar.types.d.ts +16 -1
  35. package/dist/Calendar/__tests__/fixtures/A11yDemos.d.ts +2 -0
  36. package/dist/Calendar/__tests__/fixtures/A11yDemos.js +41 -0
  37. package/dist/Calendar/index.css +52 -9
  38. package/dist/Calendar/utils.d.ts +7 -3
  39. package/dist/Calendar/utils.js +33 -23
  40. package/dist/Checkbox/Checkbox.js +5 -4
  41. package/dist/Checkbox/__tests__/fixtures/A11yDemos.d.ts +15 -0
  42. package/dist/Checkbox/__tests__/fixtures/A11yDemos.js +57 -0
  43. package/dist/CitySelector/CitySelector.types.d.ts +0 -1
  44. package/dist/Collapse/Collapse.d.ts +1 -1
  45. package/dist/Collapse/Collapse.js +26 -12
  46. package/dist/Collapse/Collapse.miniapp.d.ts +10 -0
  47. package/dist/Collapse/Collapse.miniapp.js +255 -0
  48. package/dist/Collapse/index.css +40 -1
  49. package/dist/CollapsePanel/index.css +1 -1
  50. package/dist/Countdown/Countdown.js +61 -21
  51. package/dist/Countdown/Countdown.types.d.ts +19 -15
  52. package/dist/Countdown/__tests__/fixtures/A11yDemos.d.ts +23 -0
  53. package/dist/Countdown/__tests__/fixtures/A11yDemos.js +107 -0
  54. package/dist/Countdown/index.css +11 -0
  55. package/dist/DatePicker/DatePicker.d.ts +4 -0
  56. package/dist/DatePicker/DatePicker.js +335 -0
  57. package/dist/DatePicker/DatePicker.types.d.ts +36 -0
  58. package/dist/DatePicker/DatePicker.types.js +15 -0
  59. package/dist/DatePicker/constants.d.ts +9 -0
  60. package/dist/DatePicker/constants.js +37 -0
  61. package/dist/DatePicker/index.d.ts +3 -0
  62. package/dist/DatePicker/index.js +44 -0
  63. package/dist/DesktopDatePicker/DesktopDatePicker.css +61 -0
  64. package/dist/DesktopDatePicker/DesktopDatePicker.d.ts +5 -0
  65. package/dist/DesktopDatePicker/DesktopDatePicker.js +280 -0
  66. package/dist/DesktopDatePicker/DesktopDatePicker.types.d.ts +163 -0
  67. package/dist/DesktopDatePicker/DesktopDatePicker.types.js +15 -0
  68. package/dist/DesktopDatePicker/deskTopPickerContainer.css +100 -0
  69. package/dist/DesktopDatePicker/index.css +161 -0
  70. package/dist/DesktopDatePicker/index.d.ts +2 -0
  71. package/dist/DesktopDatePicker/index.js +41 -0
  72. package/dist/DesktopDatePicker/useGetDatePickerContent.d.ts +6 -0
  73. package/dist/DesktopDatePicker/useGetDatePickerContent.js +343 -0
  74. package/dist/DesktopDateTimePicker/DesktopDateTimePicker.d.ts +5 -0
  75. package/dist/DesktopDateTimePicker/DesktopDateTimePicker.js +322 -0
  76. package/dist/DesktopDateTimePicker/DesktopDateTimePicker.types.d.ts +163 -0
  77. package/dist/DesktopDateTimePicker/DesktopDateTimePicker.types.js +15 -0
  78. package/dist/DesktopDateTimePicker/index.css +66 -0
  79. package/dist/DesktopDateTimePicker/index.d.ts +2 -0
  80. package/dist/DesktopDateTimePicker/index.js +41 -0
  81. package/dist/DesktopPicker/DesktopPicker.d.ts +5 -0
  82. package/dist/DesktopPicker/DesktopPicker.js +243 -0
  83. package/dist/DesktopPicker/DesktopPicker.types.d.ts +61 -0
  84. package/dist/DesktopPicker/DesktopPicker.types.js +15 -0
  85. package/dist/DesktopPicker/index.css +39 -0
  86. package/dist/DesktopPicker/index.d.ts +2 -0
  87. package/dist/DesktopPicker/index.js +41 -0
  88. package/dist/DesktopPicker/utils/calcAfterMounted.d.ts +2 -0
  89. package/dist/{Tabs/utils/bound.js → DesktopPicker/utils/calcAfterMounted.js} +7 -14
  90. package/dist/DesktopPicker/utils/calcAfterMounted.miniapp.d.ts +2 -0
  91. package/dist/DesktopPicker/utils/calcAfterMounted.miniapp.js +38 -0
  92. package/dist/DesktopTimePicker/DesktopTimePicker.d.ts +5 -0
  93. package/dist/DesktopTimePicker/DesktopTimePicker.js +288 -0
  94. package/dist/DesktopTimePicker/DesktopTimePicker.types.d.ts +182 -0
  95. package/dist/DesktopTimePicker/DesktopTimePicker.types.js +15 -0
  96. package/dist/DesktopTimePicker/DesktopTimePickerList.d.ts +4 -0
  97. package/dist/DesktopTimePicker/DesktopTimePickerList.js +111 -0
  98. package/dist/DesktopTimePicker/index.css +170 -0
  99. package/dist/DesktopTimePicker/index.d.ts +2 -0
  100. package/dist/DesktopTimePicker/index.js +41 -0
  101. package/dist/DesktopTimePicker/useGetTimePickerContent.d.ts +6 -0
  102. package/dist/DesktopTimePicker/useGetTimePickerContent.js +249 -0
  103. package/dist/DesktopTimePicker/utils/scrollUtil.d.ts +2 -0
  104. package/dist/DesktopTimePicker/utils/scrollUtil.js +27 -0
  105. package/dist/DesktopTimePicker/utils/scrollUtil.miniapp.d.ts +2 -0
  106. package/dist/DesktopTimePicker/utils/scrollUtil.miniapp.js +51 -0
  107. package/dist/DesktopTimePicker/utils/utils.d.ts +28 -0
  108. package/dist/DesktopTimePicker/utils/utils.js +408 -0
  109. package/dist/Dialog/Dialog.d.ts +5 -2
  110. package/dist/Dialog/Dialog.js +56 -34
  111. package/dist/Dialog/Dialog.types.d.ts +50 -22
  112. package/dist/Dialog/FunctionalDialog.d.ts +10 -3
  113. package/dist/Dialog/FunctionalDialog.js +102 -80
  114. package/dist/Dialog/__tests__/fixtures/A11yDemos.d.ts +9 -0
  115. package/dist/Dialog/__tests__/fixtures/A11yDemos.js +78 -0
  116. package/dist/Dialog/index.css +19 -19
  117. package/dist/Dialog/index.d.ts +4 -1
  118. package/dist/Dialog/index.js +9 -2
  119. package/dist/Drawer/Drawer.js +7 -7
  120. package/dist/Drawer/__tests__/fixtures/A11yDemos.d.ts +21 -0
  121. package/dist/Drawer/__tests__/fixtures/A11yDemos.js +148 -0
  122. package/dist/Fade/Fade.js +2 -2
  123. package/dist/Fade/Fade.miniapp.d.ts +10 -0
  124. package/dist/Fade/Fade.miniapp.js +197 -0
  125. package/dist/Fade/index.css +18 -0
  126. package/dist/IconButton/IconButton.js +23 -8
  127. package/dist/IconButton/IconButton.types.d.ts +35 -1
  128. package/dist/IconButton/index.css +3 -0
  129. package/dist/Image/Image.js +17 -10
  130. package/dist/Image/__tests__/fixtures/A11yDemos.d.ts +21 -0
  131. package/dist/Image/__tests__/fixtures/A11yDemos.js +130 -0
  132. package/dist/Image/index.css +3 -8
  133. package/dist/Input/Input.js +5 -3
  134. package/dist/Input/__tests__/fixtures/A11yDemos.d.ts +21 -0
  135. package/dist/Input/__tests__/fixtures/A11yDemos.js +81 -0
  136. package/dist/Input/index.css +8 -8
  137. package/dist/ItemSelector/ItemSelector.types.d.ts +0 -1
  138. package/dist/Modal/Modal.js +47 -47
  139. package/dist/Modal/Modal.miniapp.d.ts +2 -2
  140. package/dist/Modal/Modal.miniapp.js +48 -32
  141. package/dist/Modal/Modal.types.d.ts +26 -2
  142. package/dist/Modal/ModalManager.d.ts +21 -0
  143. package/dist/Modal/ModalManager.js +238 -0
  144. package/dist/Modal/__tests__/fixtures/A11yDemos.d.ts +8 -0
  145. package/dist/Modal/__tests__/fixtures/A11yDemos.js +52 -0
  146. package/dist/Modal/index.css +1 -1
  147. package/dist/Modal/index.d.ts +3 -0
  148. package/dist/Modal/index.js +9 -1
  149. package/dist/Modal/useModal.d.ts +24 -0
  150. package/dist/Modal/useModal.js +190 -0
  151. package/dist/NavBar/index.css +2 -2
  152. package/dist/Picker/Picker.css +4 -0
  153. package/dist/Picker/Picker.js +72 -18
  154. package/dist/Picker/Picker.types.d.ts +15 -2
  155. package/dist/Picker/PickerPanel.css +4 -0
  156. package/dist/Picker/PickerPanel.js +52 -41
  157. package/dist/Picker/__tests__/fixtures/A11yDemos.d.ts +2 -0
  158. package/dist/Picker/__tests__/fixtures/A11yDemos.js +79 -0
  159. package/dist/Picker/index.css +8 -0
  160. package/dist/Picker/utils.d.ts +8 -5
  161. package/dist/Picker/utils.js +9 -12
  162. package/dist/Popover/Popover.js +123 -91
  163. package/dist/Popover/Popover.types.d.ts +44 -7
  164. package/dist/Popover/__tests__/fixtures/A11yDemos.d.ts +25 -0
  165. package/dist/Popover/__tests__/fixtures/A11yDemos.js +175 -0
  166. package/dist/Popover/hooks/index.d.ts +8 -0
  167. package/dist/Popover/hooks/index.js +36 -0
  168. package/dist/Popover/hooks/usePopoverA11y.d.ts +14 -0
  169. package/dist/Popover/hooks/usePopoverA11y.js +66 -0
  170. package/dist/Popover/hooks/usePopoverEvents.d.ts +21 -0
  171. package/dist/Popover/hooks/usePopoverEvents.js +150 -0
  172. package/dist/Popover/hooks/usePopoverPosition.d.ts +17 -0
  173. package/dist/Popover/hooks/usePopoverPosition.js +124 -0
  174. package/dist/Popover/hooks/usePopoverState.d.ts +16 -0
  175. package/dist/Popover/hooks/usePopoverState.js +54 -0
  176. package/dist/Portal/Portal.miniapp.js +7 -4
  177. package/dist/Portal/Portal.types.d.ts +1 -1
  178. package/dist/Portal/PortalCore.js +2 -2
  179. package/dist/Progress/Progress.js +61 -6
  180. package/dist/Progress/Progress.types.d.ts +44 -0
  181. package/dist/Progress/__tests__/fixtures/A11yDemos.d.ts +21 -0
  182. package/dist/Progress/__tests__/fixtures/A11yDemos.js +100 -0
  183. package/dist/Radio/Radio.js +5 -4
  184. package/dist/Radio/RadioGroup.js +1 -1
  185. package/dist/Radio/__tests__/fixtures/A11yDemos.d.ts +15 -0
  186. package/dist/Radio/__tests__/fixtures/A11yDemos.js +57 -0
  187. package/dist/Rating/index.css +8 -12
  188. package/dist/ScrollView/ScrollView.js +48 -196
  189. package/dist/ScrollView/ScrollView.types.d.ts +27 -202
  190. package/dist/ScrollView/__tests__/fixtures/A11yDemos.d.ts +7 -0
  191. package/dist/ScrollView/__tests__/fixtures/A11yDemos.js +319 -0
  192. package/dist/ScrollView/useScrollView.d.ts +10 -0
  193. package/dist/ScrollView/useScrollView.js +300 -0
  194. package/dist/Select/Select.js +73 -39
  195. package/dist/Select/Select.types.d.ts +2 -2
  196. package/dist/Select/SelectOption.js +5 -1
  197. package/dist/Select/__tests__/fixtures/A11yDemos.d.ts +21 -0
  198. package/dist/Select/__tests__/fixtures/A11yDemos.js +154 -0
  199. package/dist/Select/index.css +12 -8
  200. package/dist/Select/selectContext.d.ts +0 -1
  201. package/dist/Slide/Slide.js +2 -2
  202. package/dist/Slide/Slide.miniapp.d.ts +14 -0
  203. package/dist/Slide/Slide.miniapp.js +210 -0
  204. package/dist/Slide/index.css +72 -0
  205. package/dist/Slider/Slider.js +13 -5
  206. package/dist/Stack/demo/index.css +2 -0
  207. package/dist/SwipeAction/SwipeAction.css +79 -0
  208. package/dist/SwipeAction/SwipeAction.d.ts +5 -0
  209. package/dist/SwipeAction/SwipeAction.js +349 -0
  210. package/dist/SwipeAction/SwipeAction.types.d.ts +75 -0
  211. package/dist/SwipeAction/SwipeAction.types.js +15 -0
  212. package/dist/SwipeAction/SwipeActionContext.d.ts +3 -0
  213. package/dist/SwipeAction/SwipeActionContext.js +30 -0
  214. package/dist/SwipeAction/SwipeActionItem.css +31 -0
  215. package/dist/SwipeAction/SwipeActionItem.d.ts +5 -0
  216. package/dist/SwipeAction/SwipeActionItem.js +105 -0
  217. package/dist/SwipeAction/constants.d.ts +9 -0
  218. package/dist/SwipeAction/constants.js +39 -0
  219. package/dist/SwipeAction/index.css +110 -0
  220. package/dist/SwipeAction/index.d.ts +5 -0
  221. package/dist/SwipeAction/index.js +50 -0
  222. package/dist/Swiper/Swiper.js +18 -4
  223. package/dist/Switch/Switch.js +5 -4
  224. package/dist/Switch/__tests__/fixtures/A11yDemos.d.ts +15 -0
  225. package/dist/Switch/__tests__/fixtures/A11yDemos.js +57 -0
  226. package/dist/Tabs/Tab.js +36 -21
  227. package/dist/Tabs/Tab.types.d.ts +1 -1
  228. package/dist/Tabs/TabPanel.d.ts +1 -1
  229. package/dist/Tabs/TabPanel.js +9 -5
  230. package/dist/Tabs/Tabs.css +2 -2
  231. package/dist/Tabs/Tabs.js +87 -64
  232. package/dist/Tabs/Tabs.types.d.ts +1 -1
  233. package/dist/Tabs/TabsContext.d.ts +4 -5
  234. package/dist/Tabs/TabsContext.js +3 -1
  235. package/dist/Tabs/index.css +2 -2
  236. package/dist/Tabs/utils/scroll.d.ts +2 -0
  237. package/dist/Tabs/utils/scroll.js +55 -0
  238. package/dist/Tag/__tests__/fixtures/A11yDemos.d.ts +21 -0
  239. package/dist/Tag/__tests__/fixtures/A11yDemos.js +196 -0
  240. package/dist/TextArea/TextArea.js +50 -7
  241. package/dist/TextArea/TextArea.types.d.ts +28 -0
  242. package/dist/TextArea/__tests__/fixtures/A11yDemos.d.ts +19 -0
  243. package/dist/TextArea/__tests__/fixtures/A11yDemos.js +91 -0
  244. package/dist/TextArea/index.css +4 -4
  245. package/dist/ThemeProvider/ThemeProvider.types.d.ts +2 -2
  246. package/dist/ThemeProvider/ThemeProvider.types.js +0 -12
  247. package/dist/Toast/FunctionalToast.d.ts +2 -2
  248. package/dist/Toast/FunctionalToast.js +180 -85
  249. package/dist/Toast/Toast.d.ts +2 -2
  250. package/dist/Toast/Toast.js +69 -28
  251. package/dist/Toast/Toast.types.d.ts +13 -10
  252. package/dist/Toast/__tests__/fixtures/A11yDemos.d.ts +2 -0
  253. package/dist/Toast/__tests__/fixtures/A11yDemos.js +54 -0
  254. package/dist/Toast/index.css +0 -1
  255. package/dist/Tooltip/Tooltip.js +63 -107
  256. package/dist/Tooltip/Tooltip.types.d.ts +94 -43
  257. package/dist/Tooltip/__tests__/fixtures/A11yDemos.d.ts +25 -0
  258. package/dist/Tooltip/__tests__/fixtures/A11yDemos.js +100 -0
  259. package/dist/Tooltip/useTooltip.d.ts +29 -0
  260. package/dist/Tooltip/useTooltip.js +313 -0
  261. package/dist/Transition/TransitionCore.js +30 -25
  262. package/dist/TransitionGroup/TransitionGroup.d.ts +7 -0
  263. package/dist/TransitionGroup/TransitionGroup.js +132 -0
  264. package/dist/TransitionGroup/TransitionGroup.types.d.ts +47 -0
  265. package/dist/TransitionGroup/TransitionGroup.types.js +15 -0
  266. package/dist/TransitionGroup/demo/TransitionGroupDemo.d.ts +4 -0
  267. package/dist/TransitionGroup/demo/TransitionGroupDemo.js +68 -0
  268. package/dist/TransitionGroup/demo/index.css +33 -0
  269. package/dist/TransitionGroup/index.d.ts +2 -0
  270. package/dist/TransitionGroup/index.js +41 -0
  271. package/dist/TransitionGroup/utils/childMapping.d.ts +27 -0
  272. package/dist/TransitionGroup/utils/childMapping.js +119 -0
  273. package/dist/_.._/benchmarks/components/Button.js +41 -0
  274. package/dist/_.._/benchmarks/components/Input.js +45 -0
  275. package/dist/_.._/benchmarks/components/Tabs.js +50 -0
  276. package/dist/index.d.ts +8 -0
  277. package/dist/index.js +17 -1
  278. package/dist/locales/base.d.ts +40 -1
  279. package/dist/locales/en-US.js +54 -2
  280. package/dist/locales/zh-CN.js +56 -1
  281. package/dist/locales/zh-TW.js +56 -1
  282. package/es/Alert/Alert.js +2 -1
  283. package/es/Alert/__tests__/fixtures/A11yDemos.d.ts +17 -0
  284. package/es/Alert/__tests__/fixtures/A11yDemos.js +107 -0
  285. package/es/Alert/index.css +4 -4
  286. package/es/Avatar/AvatarGroup.css +8 -8
  287. package/es/Avatar/index.css +8 -8
  288. package/es/Backdrop/Backdrop.js +3 -2
  289. package/es/Backdrop/Backdrop.types.d.ts +4 -0
  290. package/es/Backdrop/__tests__/fixtures/A11yDemos.d.ts +8 -0
  291. package/es/Backdrop/__tests__/fixtures/A11yDemos.js +17 -0
  292. package/es/Backdrop/index.css +2 -2
  293. package/es/Badge/Badge.js +38 -11
  294. package/es/Badge/Badge.types.d.ts +30 -1
  295. package/es/Badge/__tests__/fixtures/A11yDemos.d.ts +25 -0
  296. package/es/Badge/__tests__/fixtures/A11yDemos.js +70 -0
  297. package/es/Badge/hooks/useBadgeA11y.d.ts +23 -0
  298. package/es/Badge/hooks/useBadgeA11y.js +53 -0
  299. package/es/Badge/hooks/useBadgeDisplay.d.ts +16 -0
  300. package/es/Badge/hooks/useBadgeDisplay.js +33 -0
  301. package/es/Button/Button.js +2 -1
  302. package/es/Button/__tests__/fixtures/A11yDemos.d.ts +23 -0
  303. package/es/Button/__tests__/fixtures/A11yDemos.js +42 -0
  304. package/es/Button/index.css +2 -2
  305. package/es/CSSTransition/CSSTransition.d.ts +4 -0
  306. package/es/CSSTransition/CSSTransition.js +153 -0
  307. package/es/CSSTransition/CSSTransition.types.d.ts +13 -0
  308. package/es/CSSTransition/CSSTransition.types.js +1 -0
  309. package/es/CSSTransition/demo/CSSTransitionDemo.d.ts +4 -0
  310. package/es/CSSTransition/demo/CSSTransitionDemo.js +47 -0
  311. package/es/CSSTransition/demo/index.css +25 -0
  312. package/es/CSSTransition/index.d.ts +2 -0
  313. package/es/CSSTransition/index.js +6 -0
  314. package/es/Calendar/Calendar.js +131 -34
  315. package/es/Calendar/Calendar.types.d.ts +16 -1
  316. package/es/Calendar/__tests__/fixtures/A11yDemos.d.ts +2 -0
  317. package/es/Calendar/__tests__/fixtures/A11yDemos.js +8 -0
  318. package/es/Calendar/index.css +52 -9
  319. package/es/Calendar/utils.d.ts +7 -3
  320. package/es/Calendar/utils.js +29 -20
  321. package/es/Checkbox/Checkbox.js +5 -4
  322. package/es/Checkbox/__tests__/fixtures/A11yDemos.d.ts +15 -0
  323. package/es/Checkbox/__tests__/fixtures/A11yDemos.js +22 -0
  324. package/es/CitySelector/CitySelector.types.d.ts +0 -1
  325. package/es/Collapse/Collapse.d.ts +1 -1
  326. package/es/Collapse/Collapse.js +26 -12
  327. package/es/Collapse/Collapse.miniapp.d.ts +10 -0
  328. package/es/Collapse/Collapse.miniapp.js +236 -0
  329. package/es/Collapse/index.css +40 -1
  330. package/es/CollapsePanel/index.css +1 -1
  331. package/es/Countdown/Countdown.js +61 -21
  332. package/es/Countdown/Countdown.types.d.ts +19 -15
  333. package/es/Countdown/__tests__/fixtures/A11yDemos.d.ts +23 -0
  334. package/es/Countdown/__tests__/fixtures/A11yDemos.js +68 -0
  335. package/es/Countdown/index.css +11 -0
  336. package/es/DatePicker/DatePicker.d.ts +4 -0
  337. package/es/DatePicker/DatePicker.js +308 -0
  338. package/es/DatePicker/DatePicker.types.d.ts +36 -0
  339. package/es/DatePicker/DatePicker.types.js +1 -0
  340. package/es/DatePicker/constants.d.ts +9 -0
  341. package/es/DatePicker/constants.js +14 -0
  342. package/es/DatePicker/index.d.ts +3 -0
  343. package/es/DatePicker/index.js +8 -0
  344. package/es/DesktopDatePicker/DesktopDatePicker.css +61 -0
  345. package/es/DesktopDatePicker/DesktopDatePicker.d.ts +5 -0
  346. package/es/DesktopDatePicker/DesktopDatePicker.js +253 -0
  347. package/es/DesktopDatePicker/DesktopDatePicker.types.d.ts +163 -0
  348. package/es/DesktopDatePicker/DesktopDatePicker.types.js +1 -0
  349. package/es/DesktopDatePicker/deskTopPickerContainer.css +100 -0
  350. package/es/DesktopDatePicker/index.css +161 -0
  351. package/es/DesktopDatePicker/index.d.ts +2 -0
  352. package/es/DesktopDatePicker/index.js +6 -0
  353. package/es/DesktopDatePicker/useGetDatePickerContent.d.ts +6 -0
  354. package/es/DesktopDatePicker/useGetDatePickerContent.js +316 -0
  355. package/es/DesktopDateTimePicker/DesktopDateTimePicker.d.ts +5 -0
  356. package/es/DesktopDateTimePicker/DesktopDateTimePicker.js +295 -0
  357. package/es/DesktopDateTimePicker/DesktopDateTimePicker.types.d.ts +163 -0
  358. package/es/DesktopDateTimePicker/DesktopDateTimePicker.types.js +1 -0
  359. package/es/DesktopDateTimePicker/index.css +66 -0
  360. package/es/DesktopDateTimePicker/index.d.ts +2 -0
  361. package/es/DesktopDateTimePicker/index.js +9 -0
  362. package/es/DesktopPicker/DesktopPicker.d.ts +5 -0
  363. package/es/DesktopPicker/DesktopPicker.js +226 -0
  364. package/es/DesktopPicker/DesktopPicker.types.d.ts +61 -0
  365. package/es/DesktopPicker/DesktopPicker.types.js +1 -0
  366. package/es/DesktopPicker/index.css +39 -0
  367. package/es/DesktopPicker/index.d.ts +2 -0
  368. package/es/DesktopPicker/index.js +6 -0
  369. package/es/DesktopPicker/utils/calcAfterMounted.d.ts +2 -0
  370. package/es/DesktopPicker/utils/calcAfterMounted.js +6 -0
  371. package/es/DesktopPicker/utils/calcAfterMounted.miniapp.d.ts +2 -0
  372. package/es/DesktopPicker/utils/calcAfterMounted.miniapp.js +9 -0
  373. package/es/DesktopTimePicker/DesktopTimePicker.d.ts +5 -0
  374. package/es/DesktopTimePicker/DesktopTimePicker.js +261 -0
  375. package/es/DesktopTimePicker/DesktopTimePicker.types.d.ts +182 -0
  376. package/es/DesktopTimePicker/DesktopTimePicker.types.js +1 -0
  377. package/es/DesktopTimePicker/DesktopTimePickerList.d.ts +4 -0
  378. package/es/DesktopTimePicker/DesktopTimePickerList.js +84 -0
  379. package/es/DesktopTimePicker/index.css +170 -0
  380. package/es/DesktopTimePicker/index.d.ts +2 -0
  381. package/es/DesktopTimePicker/index.js +6 -0
  382. package/es/DesktopTimePicker/useGetTimePickerContent.d.ts +6 -0
  383. package/es/DesktopTimePicker/useGetTimePickerContent.js +226 -0
  384. package/es/DesktopTimePicker/utils/scrollUtil.d.ts +2 -0
  385. package/es/DesktopTimePicker/utils/scrollUtil.js +8 -0
  386. package/es/DesktopTimePicker/utils/scrollUtil.miniapp.d.ts +2 -0
  387. package/es/DesktopTimePicker/utils/scrollUtil.miniapp.js +22 -0
  388. package/es/DesktopTimePicker/utils/utils.d.ts +28 -0
  389. package/es/DesktopTimePicker/utils/utils.js +365 -0
  390. package/es/Dialog/Dialog.d.ts +5 -2
  391. package/es/Dialog/Dialog.js +57 -35
  392. package/es/Dialog/Dialog.types.d.ts +50 -22
  393. package/es/Dialog/FunctionalDialog.d.ts +10 -3
  394. package/es/Dialog/FunctionalDialog.js +106 -84
  395. package/es/Dialog/__tests__/fixtures/A11yDemos.d.ts +9 -0
  396. package/es/Dialog/__tests__/fixtures/A11yDemos.js +43 -0
  397. package/es/Dialog/index.css +19 -19
  398. package/es/Dialog/index.d.ts +4 -1
  399. package/es/Dialog/index.js +10 -3
  400. package/es/Drawer/Drawer.js +8 -8
  401. package/es/Drawer/__tests__/fixtures/A11yDemos.d.ts +21 -0
  402. package/es/Drawer/__tests__/fixtures/A11yDemos.js +112 -0
  403. package/es/Fade/Fade.js +2 -2
  404. package/es/Fade/Fade.miniapp.d.ts +10 -0
  405. package/es/Fade/Fade.miniapp.js +176 -0
  406. package/es/Fade/index.css +18 -0
  407. package/es/IconButton/IconButton.js +23 -8
  408. package/es/IconButton/IconButton.types.d.ts +35 -1
  409. package/es/IconButton/index.css +3 -0
  410. package/es/Image/Image.js +17 -10
  411. package/es/Image/__tests__/fixtures/A11yDemos.d.ts +21 -0
  412. package/es/Image/__tests__/fixtures/A11yDemos.js +92 -0
  413. package/es/Image/index.css +3 -8
  414. package/es/Input/Input.js +5 -3
  415. package/es/Input/__tests__/fixtures/A11yDemos.d.ts +21 -0
  416. package/es/Input/__tests__/fixtures/A11yDemos.js +43 -0
  417. package/es/Input/index.css +8 -8
  418. package/es/ItemSelector/ItemSelector.types.d.ts +0 -1
  419. package/es/Modal/Modal.js +48 -48
  420. package/es/Modal/Modal.miniapp.d.ts +1 -1
  421. package/es/Modal/Modal.miniapp.js +49 -33
  422. package/es/Modal/Modal.types.d.ts +26 -2
  423. package/es/Modal/ModalManager.d.ts +21 -0
  424. package/es/Modal/ModalManager.js +214 -0
  425. package/es/Modal/__tests__/fixtures/A11yDemos.d.ts +8 -0
  426. package/es/Modal/__tests__/fixtures/A11yDemos.js +18 -0
  427. package/es/Modal/index.css +1 -1
  428. package/es/Modal/index.d.ts +3 -0
  429. package/es/Modal/index.js +6 -1
  430. package/es/Modal/useModal.d.ts +24 -0
  431. package/es/Modal/useModal.js +169 -0
  432. package/es/NavBar/index.css +2 -2
  433. package/es/Picker/Picker.css +4 -0
  434. package/es/Picker/Picker.js +72 -18
  435. package/es/Picker/Picker.types.d.ts +15 -2
  436. package/es/Picker/PickerPanel.css +4 -0
  437. package/es/Picker/PickerPanel.js +52 -41
  438. package/es/Picker/__tests__/fixtures/A11yDemos.d.ts +2 -0
  439. package/es/Picker/__tests__/fixtures/A11yDemos.js +46 -0
  440. package/es/Picker/index.css +8 -0
  441. package/es/Picker/utils.d.ts +8 -5
  442. package/es/Picker/utils.js +9 -12
  443. package/es/Popover/Popover.js +130 -99
  444. package/es/Popover/Popover.types.d.ts +44 -7
  445. package/es/Popover/__tests__/fixtures/A11yDemos.d.ts +25 -0
  446. package/es/Popover/__tests__/fixtures/A11yDemos.js +135 -0
  447. package/es/Popover/hooks/index.d.ts +8 -0
  448. package/es/Popover/hooks/index.js +10 -0
  449. package/es/Popover/hooks/usePopoverA11y.d.ts +14 -0
  450. package/es/Popover/hooks/usePopoverA11y.js +43 -0
  451. package/es/Popover/hooks/usePopoverEvents.d.ts +21 -0
  452. package/es/Popover/hooks/usePopoverEvents.js +127 -0
  453. package/es/Popover/hooks/usePopoverPosition.d.ts +17 -0
  454. package/es/Popover/hooks/usePopoverPosition.js +105 -0
  455. package/es/Popover/hooks/usePopoverState.d.ts +16 -0
  456. package/es/Popover/hooks/usePopoverState.js +31 -0
  457. package/es/Portal/Portal.miniapp.js +8 -5
  458. package/es/Portal/Portal.types.d.ts +1 -1
  459. package/es/Portal/PortalCore.js +2 -2
  460. package/es/Progress/Progress.js +61 -6
  461. package/es/Progress/Progress.types.d.ts +44 -0
  462. package/es/Progress/__tests__/fixtures/A11yDemos.d.ts +21 -0
  463. package/es/Progress/__tests__/fixtures/A11yDemos.js +62 -0
  464. package/es/Radio/Radio.js +5 -4
  465. package/es/Radio/RadioGroup.js +1 -1
  466. package/es/Radio/__tests__/fixtures/A11yDemos.d.ts +15 -0
  467. package/es/Radio/__tests__/fixtures/A11yDemos.js +22 -0
  468. package/es/Rating/index.css +8 -12
  469. package/es/ScrollView/ScrollView.js +51 -197
  470. package/es/ScrollView/ScrollView.types.d.ts +27 -202
  471. package/es/ScrollView/__tests__/fixtures/A11yDemos.d.ts +7 -0
  472. package/es/ScrollView/__tests__/fixtures/A11yDemos.js +283 -0
  473. package/es/ScrollView/useScrollView.d.ts +10 -0
  474. package/es/ScrollView/useScrollView.js +279 -0
  475. package/es/Select/Select.js +73 -40
  476. package/es/Select/Select.types.d.ts +2 -2
  477. package/es/Select/SelectOption.js +5 -1
  478. package/es/Select/__tests__/fixtures/A11yDemos.d.ts +21 -0
  479. package/es/Select/__tests__/fixtures/A11yDemos.js +118 -0
  480. package/es/Select/index.css +12 -8
  481. package/es/Select/selectContext.d.ts +0 -1
  482. package/es/Slide/Slide.js +2 -2
  483. package/es/Slide/Slide.miniapp.d.ts +14 -0
  484. package/es/Slide/Slide.miniapp.js +189 -0
  485. package/es/Slide/index.css +72 -0
  486. package/es/Slider/Slider.js +16 -6
  487. package/es/Stack/demo/index.css +2 -0
  488. package/es/SwipeAction/SwipeAction.css +79 -0
  489. package/es/SwipeAction/SwipeAction.d.ts +5 -0
  490. package/es/SwipeAction/SwipeAction.js +334 -0
  491. package/es/SwipeAction/SwipeAction.types.d.ts +75 -0
  492. package/es/SwipeAction/SwipeAction.types.js +1 -0
  493. package/es/SwipeAction/SwipeActionContext.d.ts +3 -0
  494. package/es/SwipeAction/SwipeActionContext.js +11 -0
  495. package/es/SwipeAction/SwipeActionItem.css +31 -0
  496. package/es/SwipeAction/SwipeActionItem.d.ts +5 -0
  497. package/es/SwipeAction/SwipeActionItem.js +78 -0
  498. package/es/SwipeAction/constants.d.ts +9 -0
  499. package/es/SwipeAction/constants.js +15 -0
  500. package/es/SwipeAction/index.css +110 -0
  501. package/es/SwipeAction/index.d.ts +5 -0
  502. package/es/SwipeAction/index.js +12 -0
  503. package/es/Swiper/Swiper.js +18 -4
  504. package/es/Switch/Switch.js +5 -4
  505. package/es/Switch/__tests__/fixtures/A11yDemos.d.ts +15 -0
  506. package/es/Switch/__tests__/fixtures/A11yDemos.js +22 -0
  507. package/es/Tabs/Tab.js +36 -21
  508. package/es/Tabs/Tab.types.d.ts +1 -1
  509. package/es/Tabs/TabPanel.d.ts +1 -1
  510. package/es/Tabs/TabPanel.js +8 -4
  511. package/es/Tabs/Tabs.css +2 -2
  512. package/es/Tabs/Tabs.js +87 -64
  513. package/es/Tabs/Tabs.types.d.ts +1 -1
  514. package/es/Tabs/TabsContext.d.ts +4 -5
  515. package/es/Tabs/TabsContext.js +3 -1
  516. package/es/Tabs/index.css +2 -2
  517. package/es/Tabs/utils/scroll.d.ts +2 -0
  518. package/es/Tabs/utils/scroll.js +36 -0
  519. package/es/Tag/__tests__/fixtures/A11yDemos.d.ts +21 -0
  520. package/es/Tag/__tests__/fixtures/A11yDemos.js +160 -0
  521. package/es/TextArea/TextArea.js +51 -8
  522. package/es/TextArea/TextArea.types.d.ts +28 -0
  523. package/es/TextArea/__tests__/fixtures/A11yDemos.d.ts +19 -0
  524. package/es/TextArea/__tests__/fixtures/A11yDemos.js +54 -0
  525. package/es/TextArea/index.css +4 -4
  526. package/es/ThemeProvider/ThemeProvider.types.d.ts +2 -2
  527. package/es/Toast/FunctionalToast.d.ts +2 -2
  528. package/es/Toast/FunctionalToast.js +186 -86
  529. package/es/Toast/Toast.d.ts +2 -2
  530. package/es/Toast/Toast.js +69 -28
  531. package/es/Toast/Toast.types.d.ts +13 -10
  532. package/es/Toast/__tests__/fixtures/A11yDemos.d.ts +2 -0
  533. package/es/Toast/__tests__/fixtures/A11yDemos.js +21 -0
  534. package/es/Toast/index.css +0 -1
  535. package/es/Tooltip/Tooltip.js +64 -114
  536. package/es/Tooltip/Tooltip.types.d.ts +94 -43
  537. package/es/Tooltip/__tests__/fixtures/A11yDemos.d.ts +25 -0
  538. package/es/Tooltip/__tests__/fixtures/A11yDemos.js +60 -0
  539. package/es/Tooltip/useTooltip.d.ts +29 -0
  540. package/es/Tooltip/useTooltip.js +290 -0
  541. package/es/Transition/TransitionCore.js +31 -26
  542. package/es/TransitionGroup/TransitionGroup.d.ts +7 -0
  543. package/es/TransitionGroup/TransitionGroup.js +109 -0
  544. package/es/TransitionGroup/TransitionGroup.types.d.ts +47 -0
  545. package/es/TransitionGroup/TransitionGroup.types.js +1 -0
  546. package/es/TransitionGroup/demo/TransitionGroupDemo.d.ts +4 -0
  547. package/es/TransitionGroup/demo/TransitionGroupDemo.js +39 -0
  548. package/es/TransitionGroup/demo/index.css +33 -0
  549. package/es/TransitionGroup/index.d.ts +2 -0
  550. package/es/TransitionGroup/index.js +6 -0
  551. package/es/TransitionGroup/utils/childMapping.d.ts +27 -0
  552. package/es/TransitionGroup/utils/childMapping.js +93 -0
  553. package/es/_.._/benchmarks/components/Button.js +8 -0
  554. package/es/_.._/benchmarks/components/Input.js +12 -0
  555. package/es/_.._/benchmarks/components/Tabs.js +17 -0
  556. package/es/index.d.ts +8 -0
  557. package/es/index.js +8 -0
  558. package/es/locales/base.d.ts +40 -1
  559. package/es/locales/en-US.js +54 -2
  560. package/es/locales/zh-CN.js +56 -1
  561. package/es/locales/zh-TW.js +56 -1
  562. package/package.json +9 -6
  563. package/dist/Tabs/utils/bound.d.ts +0 -1
  564. package/es/Tabs/utils/bound.d.ts +0 -1
  565. package/es/Tabs/utils/bound.js +0 -13
@@ -1,195 +1,73 @@
1
1
  import React from 'react';
2
2
  import { OverrideProps } from '@bifrostui/types';
3
- interface ScrollViewScrollEvent extends Event {
3
+ /**
4
+ * 滚动事件详情
5
+ */
6
+ export interface ScrollViewScrollEvent extends Event {
4
7
  detail?: {
5
8
  scrollLeft: number;
6
9
  scrollTop: number;
7
10
  scrollHeight: number;
8
11
  scrollWidth: number;
9
- deltaX?: number;
10
- deltaY?: number;
11
- isDrag?: boolean;
12
- };
13
- }
14
- interface ScrollViewDragEvent extends Event {
15
- detail?: {
16
- /** 横向滚动条位置 */
17
- scrollLeft?: number;
18
- /** 竖向滚动条位置 */
19
- scrollTop?: number;
20
- /** 滚动速度 */
21
- velocity?: number;
22
12
  };
23
13
  }
14
+ /**
15
+ * ScrollIntoView 对齐方式
16
+ */
17
+ export type ScrollIntoViewAlignment = 'start' | 'center' | 'end' | 'nearest';
18
+ /**
19
+ * ScrollView 组件属性
20
+ */
24
21
  export type ScrollViewProps<D extends React.ElementType = 'div', P = {}> = OverrideProps<{
25
22
  props: P & {
26
23
  /**
27
24
  * 允许横向滚动
28
25
  * @default false
29
- * @type {boolean}
30
26
  */
31
27
  scrollX?: boolean;
32
28
  /**
33
29
  * 允许纵向滚动
34
30
  * @default false
35
- * @type {boolean}
36
31
  */
37
32
  scrollY?: boolean;
38
- /**
39
- * 距顶部/左边多远时(单位px),触发 scrolltoupper 事件
40
- * @default 50
41
- * @type {number}
42
- */
43
- upperThreshold?: number;
44
- /**
45
- * 距底部/右边多远时(单位px),触发 scrolltolower 事件
46
- * @default 50
47
- * @type {number}
48
- */
49
- lowerThreshold?: number;
50
33
  /**
51
34
  * 设置竖向滚动条位置
52
- * @type {number}
53
35
  */
54
36
  scrollTop?: number;
55
37
  /**
56
38
  * 设置横向滚动条位置
57
- * @type {number}
58
39
  */
59
40
  scrollLeft?: number;
60
41
  /**
61
- * 值应为某子元素id(id不能以数字开头)。设置哪个方向可滚动,则在哪个方向滚动到该元素
62
- * @type {string}
42
+ * 滚动到指定元素(元素id,不能以数字开头)
63
43
  */
64
44
  scrollIntoView?: string;
65
45
  /**
66
- * 在设置滚动条位置时使用动画过渡
67
- * @default false
68
- * @type {boolean}
69
- */
70
- scrollWithAnimation?: boolean;
71
- /** 指定 scroll-into-view 目标节点在视口内的位置。
72
- * start - 目标节点显示在视口开始处
73
- * center - 目标节点显示在视口中间
74
- * end - 目标节点显示在视口结束处
75
- * nearest - 目标节点在就近的视口边缘显示,若节点已在视口内则不触发滚动
46
+ * 指定 scroll-into-view 目标节点在视口内的位置
76
47
  * @default 'start'
77
48
  */
78
- scrollIntoViewAlignment?: ScrollLogicalPosition;
49
+ scrollIntoViewAlignment?: ScrollIntoViewAlignment;
79
50
  /**
80
- * 滚动条返回顶部,只支持竖向
81
- * @default false
82
- * @type {boolean}
83
- */
84
- enableBackToTop?: boolean;
85
- /** 启用 flexbox 布局。开启后,当前节点声明了 `display: flex` 就会成为 flex container,并作用于其孩子节点。
86
- * 仅小程序可用
87
- * @default false
88
- */
89
- enableFlex?: boolean;
90
- /** 开启 scroll anchoring 特性,即控制滚动位置不随内容变化而抖动,仅在 iOS 下生效,安卓下可参考 CSS `overflow-anchor` 属性。
91
- * 仅小程序可用
92
- * @default false
93
- */
94
- scrollAnchoring?: boolean;
95
- /** 开启自定义下拉刷新
96
- * 仅小程序可用
97
- * @default false
98
- */
99
- refresherEnabled?: boolean;
100
- /** 设置自定义下拉刷新默认样式,支持设置 `black | white | none`, none 表示不使用默认样式
101
- * 仅小程序可用
102
- * @default 'black'
103
- */
104
- refresherDefaultStyle?: string;
105
- /** 设置自定义下拉刷新区域背景颜色
106
- * 仅小程序可用
107
- * @default '#FFF'
108
- */
109
- refresherBackground?: string;
110
- /** 设置当前下拉刷新状态,true 表示下拉刷新已经被触发,false 表示下拉刷新未被触发
111
- * 仅小程序可用
112
- * @default false
113
- */
114
- refresherTriggered?: boolean;
115
- /** 启用 scroll-view 增强特性
116
- * 仅小程序可用
117
- * @default false
118
- */
119
- enhanced?: boolean;
120
- /** iOS 下 scroll-view 边界弹性控制 (同时开启 enhanced 属性后生效)
121
- * 仅小程序可用
122
- * @default true
123
- */
124
- bounces?: boolean;
125
- /** 滚动条显隐控制 (同时开启 enhanced 属性后生效)
126
- * 仅小程序可用
127
- * @default true
128
- */
129
- showScrollbar?: boolean;
130
- /** 分页滑动效果 (同时开启 enhanced 属性后生效)
131
- * 仅小程序可用
132
- * @default false
133
- */
134
- pagingEnabled?: boolean;
135
- /** boolean false 滑动减速速率控制 (同时开启 enhanced 属性后生效)
136
- * 仅小程序可用
137
- * @default false
138
- */
139
- fastDeceleration?: boolean;
140
- /** 当 scroll-with-animation设置为 true 时,可以设置 scroll-animation-duration 来控制动画的执行时间,单位 ms。
141
- * 仅小程序可用
142
- */
143
- scrollAnimationDuration?: number;
144
- /** 纵向滚动时,当滚动到顶部或底部时,强制禁止触发页面滚动,仍然只触发 scroll-view 自身的滚动。
145
- * 仅小程序可用
146
- * @default false
147
- */
148
- trapScroll?: string;
149
- /** 发生滚动前,对滚动方向进行判断,当方向是顶部/左边时,如果值为always将始终禁止滚动,如果值为out-of-bounds 且当前已经滚动到顶部/左边,禁止滚动。
150
- * 仅小程序可用
151
- */
152
- disableLowerScroll?: string;
153
- /** 发生滚动前,对滚动方向进行判断,当方向是底部/右边时,如果值为always将始终禁止滚动,如果值为out-of-bounds 且当前已经滚动到底部/右边,禁止滚动。
154
- * 仅小程序可用
155
- */
156
- disableUpperScroll?: string;
157
- /** 无障碍访问,(属性)元素的额外描述
158
- * 仅小程序可用
159
- */
160
- ariaLabel?: string;
161
- /** 开启 passive 特性,能优化一定的滚动性能
162
- * 仅小程序可用
163
- * @default false
164
- */
165
- enablePassive?: string;
166
- /** 渲染模式
167
- * list - 列表模式。只会渲染在屏节点,会根据直接子节点是否在屏来按需渲染,若只有一个直接子节点则性能会退化
168
- * custom - 自定义模式。只会渲染在屏节点,子节点可以是 sticky-section list-view grid-view 等组件
169
- * 仅小程序可用
170
- * @default 'list'
171
- */
172
- type?: 'list' | 'custom';
173
- /** 是否反向滚动。一般初始滚动位置是在顶部,反向滚动则是在底部。
174
- * 仅小程序可用
51
+ * 在设置滚动条位置时使用动画过渡
175
52
  * @default false
176
53
  */
177
- reverse?: boolean;
178
- /** 指定视口外渲染区域的距离,默认情况下视口外节点不渲染。指定 cache-extent 可优化滚动体验和加载速度,但会提高内存占用且影响首屏速度,可按需启用。
179
- * 仅小程序可用
54
+ scrollWithAnimation?: boolean;
55
+ /**
56
+ * 距顶部/左边多远时(单位px),触发 onScrollToUpper 事件
57
+ * @default 50
180
58
  */
181
- cacheExtent?: number;
182
- /** 只 scroll-into-view 到 cacheExtent 以内的目标节点,性能更佳
183
- * 仅小程序可用
184
- * @default false
59
+ upperThreshold?: number;
60
+ /**
61
+ * 距底部/右边多远时(单位px),触发 onScrollToLower 事件
62
+ * @default 50
185
63
  */
186
- scrollIntoViewWithinExtent?: boolean;
64
+ lowerThreshold?: number;
187
65
  /**
188
- * 滚动到顶部/左边,会触发 scrolltoupper 事件
66
+ * 滚动到顶部/左边时触发
189
67
  */
190
68
  onScrollToUpper?: (e: React.SyntheticEvent<HTMLDivElement, Event>) => void;
191
69
  /**
192
- * 滚动到底部/右边,会触发 scrolltolower 事件
70
+ * 滚动到底部/右边时触发
193
71
  */
194
72
  onScrollToLower?: (e: React.SyntheticEvent<HTMLDivElement, Event>) => void;
195
73
  /**
@@ -197,62 +75,9 @@ export type ScrollViewProps<D extends React.ElementType = 'div', P = {}> = Overr
197
75
  */
198
76
  onScroll?: (e: React.SyntheticEvent<HTMLDivElement, ScrollViewScrollEvent>) => void;
199
77
  /**
200
- * 触摸后移动
78
+ * 触摸移动时触发
201
79
  */
202
80
  onTouchMove?: (e: React.SyntheticEvent<HTMLDivElement, TouchEvent>) => void;
203
- /** 滚动开始事件
204
- * 仅小程序可用
205
- */
206
- onScrollStart?: (e: React.SyntheticEvent<HTMLDivElement, ScrollViewScrollEvent>) => void;
207
- /** 滚动结束事件
208
- * 仅小程序可用
209
- */
210
- onScrollEnd?: (e: React.SyntheticEvent<HTMLDivElement, ScrollViewScrollEvent>) => void;
211
- /** 自定义下拉刷新控件被下拉
212
- * 仅小程序可用
213
- */
214
- onRefresherPulling?: (e: React.SyntheticEvent<HTMLDivElement, Event>) => void;
215
- /** 自定义下拉刷新被触发
216
- * 仅小程序可用
217
- */
218
- onRefresherRefresh?: (e: React.SyntheticEvent<HTMLDivElement, Event>) => void;
219
- /** 自定义下拉刷新被复位
220
- * 仅小程序可用
221
- */
222
- onRefresherRestore?: (e: React.SyntheticEvent<HTMLDivElement, Event>) => void;
223
- /** 自定义下拉刷新被中止
224
- * 仅小程序可用
225
- */
226
- onRefresherAbort?: (e: React.SyntheticEvent<HTMLDivElement, Event>) => void;
227
- /** 自定义下拉刷新即将触发刷新(拖动超过 refresher-threshold 时)的事件
228
- * 仅小程序可用
229
- */
230
- onRefresherWillRefresh?: (e: React.SyntheticEvent<HTMLDivElement, Event>) => void;
231
- /** 滑动开始事件 (同时开启 enhanced 属性后生效)
232
- * 仅小程序可用
233
- */
234
- onDragStart?: (e: React.SyntheticEvent<HTMLDivElement, ScrollViewDragEvent>) => void;
235
- /** 滑动事件 (同时开启 enhanced 属性后生效)
236
- * 仅小程序可用
237
- */
238
- onDragging?: (e: React.SyntheticEvent<HTMLDivElement, ScrollViewDragEvent>) => void;
239
- /** 滑动结束事件 (同时开启 enhanced 属性后生效)
240
- * 仅小程序可用
241
- */
242
- onDragEnd?: (e: React.SyntheticEvent<HTMLDivElement, ScrollViewDragEvent>) => void;
243
- /** 触摸动作开始。
244
- * 仅小程序可用
245
- */
246
- onTouchStart?: (e: React.SyntheticEvent<HTMLDivElement, TouchEvent>) => void;
247
- /** 触摸动作结束。
248
- * 仅小程序可用
249
- */
250
- onTouchEnd?: (e: React.SyntheticEvent<HTMLDivElement, TouchEvent>) => void;
251
- /** 触摸动作被打断,如来电提醒、弹窗。
252
- * 仅小程序可用
253
- */
254
- onTouchCancel?: (e: React.SyntheticEvent<HTMLDivElement, TouchEvent>) => void;
255
81
  };
256
82
  defaultComponent: D;
257
83
  }, D>;
258
- export {};
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ export declare const BasicScrollViewDemo: React.FC;
3
+ export declare const HorizontalScrollViewDemo: React.FC;
4
+ export declare const ScrollEventsDemo: React.FC;
5
+ export declare const ControlledScrollDemo: React.FC;
6
+ export declare const BidirectionalScrollDemo: React.FC;
7
+ export declare const ThresholdTestDemo: React.FC;
@@ -0,0 +1,319 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __defProps = Object.defineProperties;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
+ var __getProtoOf = Object.getPrototypeOf;
9
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
10
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
11
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
12
+ var __spreadValues = (a, b) => {
13
+ for (var prop in b || (b = {}))
14
+ if (__hasOwnProp.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ if (__getOwnPropSymbols)
17
+ for (var prop of __getOwnPropSymbols(b)) {
18
+ if (__propIsEnum.call(b, prop))
19
+ __defNormalProp(a, prop, b[prop]);
20
+ }
21
+ return a;
22
+ };
23
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
24
+ var __export = (target, all) => {
25
+ for (var name in all)
26
+ __defProp(target, name, { get: all[name], enumerable: true });
27
+ };
28
+ var __copyProps = (to, from, except, desc) => {
29
+ if (from && typeof from === "object" || typeof from === "function") {
30
+ for (let key of __getOwnPropNames(from))
31
+ if (!__hasOwnProp.call(to, key) && key !== except)
32
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
33
+ }
34
+ return to;
35
+ };
36
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
37
+ // If the importer is in node compatibility mode or this is not an ESM
38
+ // file that has been converted to a CommonJS file using a Babel-
39
+ // compatible transform (i.e. "__esModule" has not been set), then set
40
+ // "default" to the CommonJS "module.exports" for node compatibility.
41
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
42
+ mod
43
+ ));
44
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
45
+ var A11yDemos_exports = {};
46
+ __export(A11yDemos_exports, {
47
+ BasicScrollViewDemo: () => BasicScrollViewDemo,
48
+ BidirectionalScrollDemo: () => BidirectionalScrollDemo,
49
+ ControlledScrollDemo: () => ControlledScrollDemo,
50
+ HorizontalScrollViewDemo: () => HorizontalScrollViewDemo,
51
+ ScrollEventsDemo: () => ScrollEventsDemo,
52
+ ThresholdTestDemo: () => ThresholdTestDemo
53
+ });
54
+ module.exports = __toCommonJS(A11yDemos_exports);
55
+ var import_react = __toESM(require("react"));
56
+ var import_ScrollView = __toESM(require("../../ScrollView"));
57
+ const BasicScrollViewDemo = () => {
58
+ return /* @__PURE__ */ import_react.default.createElement(import_ScrollView.default, { scrollY: true, style: { height: "300px", width: "100%" } }, Array.from({ length: 50 }, (_, index) => /* @__PURE__ */ import_react.default.createElement(
59
+ "div",
60
+ {
61
+ key: index,
62
+ style: { padding: "10px", borderBottom: "1px solid #eee" }
63
+ },
64
+ "Item ",
65
+ index + 1
66
+ )));
67
+ };
68
+ const HorizontalScrollViewDemo = () => {
69
+ return /* @__PURE__ */ import_react.default.createElement(import_ScrollView.default, { scrollX: true, style: { width: "300px" } }, /* @__PURE__ */ import_react.default.createElement("div", { style: { display: "flex", width: "max-content" } }, Array.from({ length: 20 }, (_, index) => /* @__PURE__ */ import_react.default.createElement(
70
+ "div",
71
+ {
72
+ key: index,
73
+ style: {
74
+ minWidth: "100px",
75
+ height: "80px",
76
+ margin: "0 5px",
77
+ padding: "10px",
78
+ backgroundColor: "#f0f0f0",
79
+ display: "flex",
80
+ alignItems: "center",
81
+ justifyContent: "center"
82
+ }
83
+ },
84
+ "Item ",
85
+ index + 1
86
+ ))));
87
+ };
88
+ const ScrollEventsDemo = () => {
89
+ const [scrollInfo, setScrollInfo] = import_react.default.useState({
90
+ scrollTop: 0,
91
+ atTop: false,
92
+ atBottom: false
93
+ });
94
+ const handleScroll = (e) => {
95
+ var _a;
96
+ const event = e;
97
+ const scrollTop = ((_a = event.detail) == null ? void 0 : _a.scrollTop) || 0;
98
+ setScrollInfo((prev) => __spreadProps(__spreadValues({}, prev), {
99
+ scrollTop
100
+ }));
101
+ };
102
+ const handleScrollToUpper = () => {
103
+ setScrollInfo((prev) => __spreadProps(__spreadValues({}, prev), { atTop: true, atBottom: false }));
104
+ };
105
+ const handleScrollToLower = () => {
106
+ setScrollInfo((prev) => __spreadProps(__spreadValues({}, prev), { atTop: false, atBottom: true }));
107
+ };
108
+ return /* @__PURE__ */ import_react.default.createElement("div", null, /* @__PURE__ */ import_react.default.createElement(
109
+ "div",
110
+ {
111
+ "data-testid": "scroll-info",
112
+ style: {
113
+ marginBottom: "10px",
114
+ padding: "10px",
115
+ backgroundColor: "#f9f9f9"
116
+ }
117
+ },
118
+ /* @__PURE__ */ import_react.default.createElement("p", null, "Scroll Top: ", scrollInfo.scrollTop),
119
+ /* @__PURE__ */ import_react.default.createElement("p", null, "At Top: ", scrollInfo.atTop ? "Yes" : "No"),
120
+ /* @__PURE__ */ import_react.default.createElement("p", null, "At Bottom: ", scrollInfo.atBottom ? "Yes" : "No")
121
+ ), /* @__PURE__ */ import_react.default.createElement(
122
+ import_ScrollView.default,
123
+ {
124
+ scrollY: true,
125
+ style: { height: "200px", width: "100%" },
126
+ onScroll: handleScroll,
127
+ onScrollToUpper: handleScrollToUpper,
128
+ onScrollToLower: handleScrollToLower,
129
+ upperThreshold: 30,
130
+ lowerThreshold: 30
131
+ },
132
+ Array.from({ length: 30 }, (_, index) => /* @__PURE__ */ import_react.default.createElement(
133
+ "div",
134
+ {
135
+ key: index,
136
+ style: { padding: "15px", borderBottom: "1px solid #ddd" }
137
+ },
138
+ "Scroll Item ",
139
+ index + 1
140
+ ))
141
+ ));
142
+ };
143
+ const ControlledScrollDemo = () => {
144
+ const [scrollTop, setScrollTop] = import_react.default.useState(0);
145
+ const [scrollIntoView, setScrollIntoView] = import_react.default.useState("");
146
+ const scrollToPosition = (position) => {
147
+ setScrollIntoView("");
148
+ setScrollTop(position);
149
+ };
150
+ const scrollToElement = (elementId) => {
151
+ setScrollTop(0);
152
+ setScrollIntoView(elementId);
153
+ };
154
+ return /* @__PURE__ */ import_react.default.createElement("div", null, /* @__PURE__ */ import_react.default.createElement(
155
+ "div",
156
+ {
157
+ style: {
158
+ marginBottom: "10px",
159
+ padding: "10px",
160
+ backgroundColor: "#f5f5f5"
161
+ }
162
+ },
163
+ /* @__PURE__ */ import_react.default.createElement(
164
+ "button",
165
+ {
166
+ type: "button",
167
+ onClick: () => scrollToPosition(0),
168
+ style: { marginRight: "5px" }
169
+ },
170
+ "Top"
171
+ ),
172
+ /* @__PURE__ */ import_react.default.createElement(
173
+ "button",
174
+ {
175
+ type: "button",
176
+ onClick: () => scrollToPosition(200),
177
+ style: { marginRight: "5px" }
178
+ },
179
+ "200px"
180
+ ),
181
+ /* @__PURE__ */ import_react.default.createElement(
182
+ "button",
183
+ {
184
+ type: "button",
185
+ onClick: () => scrollToElement("item-10"),
186
+ style: { marginRight: "5px" }
187
+ },
188
+ "Item 10"
189
+ ),
190
+ /* @__PURE__ */ import_react.default.createElement("button", { type: "button", onClick: () => scrollToElement("item-20") }, "Item 20")
191
+ ), /* @__PURE__ */ import_react.default.createElement(
192
+ import_ScrollView.default,
193
+ {
194
+ scrollY: true,
195
+ style: { height: "250px", width: "100%" },
196
+ scrollTop,
197
+ scrollIntoView,
198
+ scrollWithAnimation: true
199
+ },
200
+ Array.from({ length: 30 }, (_, index) => /* @__PURE__ */ import_react.default.createElement(
201
+ "div",
202
+ {
203
+ key: index,
204
+ id: `item-${index + 1}`,
205
+ style: {
206
+ padding: "20px",
207
+ borderBottom: "1px solid #ccc",
208
+ backgroundColor: (index + 1) % 10 === 0 ? "#e6f3ff" : "white"
209
+ }
210
+ },
211
+ "Item ",
212
+ index + 1,
213
+ " ",
214
+ (index + 1) % 10 === 0 && "(Highlighted)"
215
+ ))
216
+ ));
217
+ };
218
+ const BidirectionalScrollDemo = () => {
219
+ return /* @__PURE__ */ import_react.default.createElement(
220
+ import_ScrollView.default,
221
+ {
222
+ scrollX: true,
223
+ scrollY: true,
224
+ style: {
225
+ width: "300px",
226
+ height: "200px",
227
+ border: "1px solid #ddd",
228
+ borderRadius: "4px"
229
+ }
230
+ },
231
+ /* @__PURE__ */ import_react.default.createElement(
232
+ "div",
233
+ {
234
+ style: {
235
+ width: "600px",
236
+ height: "400px",
237
+ backgroundImage: "linear-gradient(45deg, #f0f0f0 25%, transparent 25%), linear-gradient(-45deg, #f0f0f0 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #f0f0f0 75%), linear-gradient(-45deg, transparent 75%, #f0f0f0 75%)",
238
+ backgroundSize: "20px 20px",
239
+ backgroundPosition: "0 0, 0 10px, 10px -10px, -10px 0px",
240
+ position: "relative"
241
+ }
242
+ },
243
+ /* @__PURE__ */ import_react.default.createElement(
244
+ "div",
245
+ {
246
+ style: {
247
+ position: "absolute",
248
+ top: "50%",
249
+ left: "50%",
250
+ transform: "translate(-50%, -50%)",
251
+ padding: "20px",
252
+ backgroundColor: "white",
253
+ border: "2px solid #007acc",
254
+ borderRadius: "8px",
255
+ boxShadow: "0 2px 8px rgba(0,0,0,0.1)"
256
+ }
257
+ },
258
+ /* @__PURE__ */ import_react.default.createElement("h3", { style: { margin: "0 0 10px 0", color: "#007acc" } }, "Scroll in both directions!"),
259
+ /* @__PURE__ */ import_react.default.createElement("p", { style: { margin: 0, color: "#666" } }, "This content area is larger than the viewport")
260
+ )
261
+ )
262
+ );
263
+ };
264
+ const ThresholdTestDemo = () => {
265
+ const [thresholdEvents, setThresholdEvents] = import_react.default.useState([]);
266
+ const addEvent = (event) => {
267
+ setThresholdEvents((prev) => [
268
+ ...prev.slice(-4),
269
+ `${(/* @__PURE__ */ new Date()).toLocaleTimeString()}: ${event}`
270
+ ]);
271
+ };
272
+ return /* @__PURE__ */ import_react.default.createElement("div", null, /* @__PURE__ */ import_react.default.createElement(
273
+ "div",
274
+ {
275
+ "data-testid": "threshold-events",
276
+ style: {
277
+ marginBottom: "10px",
278
+ padding: "10px",
279
+ backgroundColor: "#f0f8ff",
280
+ minHeight: "80px"
281
+ }
282
+ },
283
+ /* @__PURE__ */ import_react.default.createElement("strong", null, "Threshold Events:"),
284
+ thresholdEvents.map((event, index) => /* @__PURE__ */ import_react.default.createElement("div", { key: index, style: { fontSize: "12px", color: "#666" } }, event))
285
+ ), /* @__PURE__ */ import_react.default.createElement(
286
+ import_ScrollView.default,
287
+ {
288
+ scrollY: true,
289
+ style: { height: "150px", width: "100%" },
290
+ upperThreshold: 20,
291
+ lowerThreshold: 20,
292
+ onScrollToUpper: () => addEvent("Reached upper threshold (20px)"),
293
+ onScrollToLower: () => addEvent("Reached lower threshold (20px)")
294
+ },
295
+ Array.from({ length: 20 }, (_, index) => /* @__PURE__ */ import_react.default.createElement(
296
+ "div",
297
+ {
298
+ key: index,
299
+ style: {
300
+ padding: "12px",
301
+ borderBottom: "1px solid #eee",
302
+ backgroundColor: index === 0 || index === 19 ? "#fff3cd" : "white"
303
+ }
304
+ },
305
+ index === 0 && "First Item (Top Threshold Test)",
306
+ index === 19 && "Last Item (Bottom Threshold Test)",
307
+ index !== 0 && index !== 19 && `Item ${index + 1}`
308
+ ))
309
+ ));
310
+ };
311
+ // Annotate the CommonJS export names for ESM import in node:
312
+ 0 && (module.exports = {
313
+ BasicScrollViewDemo,
314
+ BidirectionalScrollDemo,
315
+ ControlledScrollDemo,
316
+ HorizontalScrollViewDemo,
317
+ ScrollEventsDemo,
318
+ ThresholdTestDemo
319
+ });
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { ScrollViewProps } from './ScrollView.types';
3
+ export interface UseScrollViewParameters extends ScrollViewProps {
4
+ ref?: React.Ref<HTMLDivElement>;
5
+ }
6
+ export interface UseScrollViewReturnValue {
7
+ getRootProps: (otherHandlers?: Record<string, unknown>) => Record<string, unknown>;
8
+ containerRef: React.RefCallback<HTMLDivElement>;
9
+ }
10
+ export declare function useScrollView(parameters: UseScrollViewParameters): UseScrollViewReturnValue;