@bifrostui/react 1.1.11-beta.0 → 1.1.11-beta.6

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 (515) hide show
  1. package/README.md +3 -0
  2. package/dist/ActionSheet/ActionSheet.js +107 -62
  3. package/dist/ActionSheet/ActionSheet.types.js +15 -5
  4. package/dist/ActionSheet/ActionSheetContext.js +35 -10
  5. package/dist/ActionSheet/ActionSheetItem.d.ts +1 -1
  6. package/dist/ActionSheet/ActionSheetItem.js +113 -52
  7. package/dist/ActionSheet/ActionSheetItem.types.js +15 -5
  8. package/dist/ActionSheet/index.js +42 -50
  9. package/dist/Alert/Alert.d.ts +1 -1
  10. package/dist/Alert/Alert.js +157 -95
  11. package/dist/Alert/Alert.types.js +15 -5
  12. package/dist/Alert/index.js +38 -30
  13. package/dist/Avatar/Avatar.d.ts +1 -1
  14. package/dist/Avatar/Avatar.js +118 -43
  15. package/dist/Avatar/Avatar.types.js +15 -5
  16. package/dist/Avatar/AvatarGroup.d.ts +1 -1
  17. package/dist/Avatar/AvatarGroup.js +122 -64
  18. package/dist/Avatar/AvatarGroup.types.js +15 -5
  19. package/dist/Avatar/index.js +43 -50
  20. package/dist/Backdrop/Backdrop.d.ts +1 -1
  21. package/dist/Backdrop/Backdrop.js +95 -33
  22. package/dist/Backdrop/Backdrop.types.js +15 -5
  23. package/dist/Backdrop/index.js +37 -30
  24. package/dist/Badge/Badge.d.ts +1 -1
  25. package/dist/Badge/Badge.js +102 -31
  26. package/dist/Badge/Badge.types.js +15 -5
  27. package/dist/Badge/index.js +37 -30
  28. package/dist/Button/Button.css +31 -7
  29. package/dist/Button/Button.d.ts +1 -1
  30. package/dist/Button/Button.js +111 -48
  31. package/dist/Button/Button.types.js +15 -5
  32. package/dist/Button/index.js +37 -30
  33. package/dist/Calendar/Calendar.d.ts +1 -1
  34. package/dist/Calendar/Calendar.js +303 -257
  35. package/dist/Calendar/Calendar.types.js +15 -5
  36. package/dist/Calendar/index.js +37 -30
  37. package/dist/Calendar/utils.js +55 -44
  38. package/dist/Card/Card.d.ts +1 -1
  39. package/dist/Card/Card.js +74 -25
  40. package/dist/Card/Card.types.js +15 -5
  41. package/dist/Card/CardContent.d.ts +1 -1
  42. package/dist/Card/CardContent.js +69 -24
  43. package/dist/Card/CardContent.types.js +15 -5
  44. package/dist/Card/CardFooter.d.ts +1 -1
  45. package/dist/Card/CardFooter.js +69 -24
  46. package/dist/Card/CardFooter.types.js +15 -5
  47. package/dist/Card/CardHeader.d.ts +1 -1
  48. package/dist/Card/CardHeader.js +91 -56
  49. package/dist/Card/CardHeader.types.js +15 -5
  50. package/dist/Card/index.js +54 -91
  51. package/dist/Checkbox/Checkbox.d.ts +1 -1
  52. package/dist/Checkbox/Checkbox.js +133 -66
  53. package/dist/Checkbox/Checkbox.types.js +15 -5
  54. package/dist/Checkbox/CheckboxContext.js +40 -10
  55. package/dist/Checkbox/CheckboxGroup.d.ts +1 -1
  56. package/dist/Checkbox/CheckboxGroup.js +109 -52
  57. package/dist/Checkbox/index.js +40 -38
  58. package/dist/CitySelector/CitySelector.d.ts +1 -1
  59. package/dist/CitySelector/CitySelector.js +83 -35
  60. package/dist/CitySelector/CitySelector.miniapp.d.ts +1 -1
  61. package/dist/CitySelector/CitySelector.miniapp.js +123 -77
  62. package/dist/CitySelector/CitySelector.types.js +15 -5
  63. package/dist/CitySelector/CitySelectorCore.js +228 -174
  64. package/dist/CitySelector/Selector/index.js +46 -20
  65. package/dist/CitySelector/index.js +37 -30
  66. package/dist/Countdown/Countdown.css +11 -1
  67. package/dist/Countdown/Countdown.d.ts +1 -1
  68. package/dist/Countdown/Countdown.js +126 -70
  69. package/dist/Countdown/Countdown.types.js +15 -5
  70. package/dist/Countdown/index.js +39 -42
  71. package/dist/Countdown/useCountdown.js +37 -27
  72. package/dist/Countdown/utils.js +73 -74
  73. package/dist/Divider/Divider.d.ts +1 -1
  74. package/dist/Divider/Divider.js +70 -51
  75. package/dist/Divider/Divider.types.js +15 -5
  76. package/dist/Divider/index.js +37 -30
  77. package/dist/Drawer/Drawer.css +0 -1
  78. package/dist/Drawer/Drawer.js +124 -46
  79. package/dist/Drawer/Drawer.types.js +15 -5
  80. package/dist/Drawer/index.js +37 -30
  81. package/dist/Fade/Fade.js +111 -52
  82. package/dist/Fade/Fade.types.js +15 -5
  83. package/dist/Fade/index.js +38 -30
  84. package/dist/IconButton/IconButton.css +26 -6
  85. package/dist/IconButton/IconButton.d.ts +1 -1
  86. package/dist/IconButton/IconButton.js +114 -46
  87. package/dist/IconButton/IconButton.types.js +15 -5
  88. package/dist/IconButton/index.js +37 -30
  89. package/dist/Image/Image.d.ts +1 -1
  90. package/dist/Image/Image.js +143 -78
  91. package/dist/Image/Image.types.js +15 -5
  92. package/dist/Image/index.js +38 -30
  93. package/dist/Input/Input.d.ts +1 -1
  94. package/dist/Input/Input.js +144 -74
  95. package/dist/Input/Input.types.js +15 -5
  96. package/dist/Input/index.js +37 -30
  97. package/dist/List/List.d.ts +1 -1
  98. package/dist/List/List.js +89 -28
  99. package/dist/List/List.types.js +15 -5
  100. package/dist/List/ListContext.js +34 -9
  101. package/dist/List/ListItem.d.ts +1 -1
  102. package/dist/List/ListItem.js +97 -42
  103. package/dist/List/ListItem.types.js +15 -5
  104. package/dist/List/ListItemContent.d.ts +1 -1
  105. package/dist/List/ListItemContent.js +82 -34
  106. package/dist/List/ListItemContent.types.js +15 -5
  107. package/dist/List/ListItemExtra.d.ts +1 -1
  108. package/dist/List/ListItemExtra.js +70 -26
  109. package/dist/List/ListItemExtra.types.js +15 -5
  110. package/dist/List/ListItemFooter.d.ts +1 -1
  111. package/dist/List/ListItemFooter.js +70 -26
  112. package/dist/List/ListItemFooter.types.js +15 -5
  113. package/dist/List/ListItemHeader.d.ts +1 -1
  114. package/dist/List/ListItemHeader.js +70 -26
  115. package/dist/List/ListItemHeader.types.js +15 -5
  116. package/dist/List/index.js +62 -130
  117. package/dist/Loading/Loading.d.ts +1 -1
  118. package/dist/Loading/Loading.js +82 -33
  119. package/dist/Loading/Loading.types.js +15 -5
  120. package/dist/Loading/index.js +37 -30
  121. package/dist/Modal/Modal.d.ts +1 -1
  122. package/dist/Modal/Modal.js +112 -56
  123. package/dist/Modal/Modal.miniapp.d.ts +3 -3
  124. package/dist/Modal/Modal.miniapp.js +132 -63
  125. package/dist/Modal/Modal.types.js +15 -5
  126. package/dist/Modal/index.js +38 -30
  127. package/dist/NavBar/NavBar.d.ts +1 -1
  128. package/dist/NavBar/NavBar.js +109 -59
  129. package/dist/NavBar/NavBar.types.js +15 -5
  130. package/dist/NavBar/index.js +37 -30
  131. package/dist/Picker/Picker.d.ts +1 -1
  132. package/dist/Picker/Picker.js +155 -97
  133. package/dist/Picker/Picker.types.js +15 -5
  134. package/dist/Picker/PickerPanel.css +9 -1
  135. package/dist/Picker/PickerPanel.d.ts +1 -1
  136. package/dist/Picker/PickerPanel.js +255 -202
  137. package/dist/Picker/index.js +37 -30
  138. package/dist/Picker/utils.js +42 -37
  139. package/dist/Portal/Portal.js +61 -16
  140. package/dist/Portal/Portal.miniapp.js +68 -31
  141. package/dist/Portal/Portal.types.js +15 -5
  142. package/dist/Portal/PortalCore.js +70 -52
  143. package/dist/Portal/index.js +38 -30
  144. package/dist/Progress/Progress.d.ts +1 -1
  145. package/dist/Progress/Progress.js +102 -61
  146. package/dist/Progress/Progress.types.js +15 -5
  147. package/dist/Progress/index.js +38 -30
  148. package/dist/Radio/Radio.d.ts +1 -1
  149. package/dist/Radio/Radio.js +144 -80
  150. package/dist/Radio/Radio.types.js +15 -5
  151. package/dist/Radio/RadioButtonIcon.js +63 -32
  152. package/dist/Radio/RadioContext.js +40 -10
  153. package/dist/Radio/RadioGroup.d.ts +1 -1
  154. package/dist/Radio/RadioGroup.js +89 -34
  155. package/dist/Radio/index.js +40 -38
  156. package/dist/Rating/Rating.d.ts +1 -1
  157. package/dist/Rating/Rating.js +139 -62
  158. package/dist/Rating/Rating.types.js +15 -5
  159. package/dist/Rating/index.js +37 -30
  160. package/dist/ScrollView/ScrollView.d.ts +1 -1
  161. package/dist/ScrollView/ScrollView.js +226 -178
  162. package/{es/ScrollView/index.miniapp.js → dist/ScrollView/ScrollView.miniapp.d.ts} +0 -1
  163. package/dist/ScrollView/ScrollView.miniapp.js +24 -0
  164. package/dist/ScrollView/ScrollView.types.js +15 -5
  165. package/dist/ScrollView/index.js +38 -30
  166. package/dist/Select/Select.d.ts +1 -1
  167. package/dist/Select/Select.js +176 -114
  168. package/dist/Select/Select.types.js +15 -5
  169. package/dist/Select/SelectOption.d.ts +1 -1
  170. package/dist/Select/SelectOption.js +92 -48
  171. package/dist/Select/index.js +40 -38
  172. package/dist/Select/selectContext.js +24 -8
  173. package/dist/Skeleton/Skeleton.css +7 -2
  174. package/dist/Skeleton/Skeleton.d.ts +1 -1
  175. package/dist/Skeleton/Skeleton.js +101 -37
  176. package/dist/Skeleton/Skeleton.types.js +15 -5
  177. package/dist/Skeleton/index.js +38 -30
  178. package/dist/Slide/Slide.js +125 -64
  179. package/dist/Slide/Slide.types.js +15 -5
  180. package/dist/Slide/index.js +38 -30
  181. package/dist/Slider/Slider.css +2 -2
  182. package/dist/Slider/Slider.d.ts +1 -1
  183. package/dist/Slider/Slider.js +215 -171
  184. package/dist/Slider/Slider.types.js +15 -5
  185. package/dist/Slider/index.js +37 -30
  186. package/dist/Slider/utils.js +35 -24
  187. package/dist/Stack/Stack.css +0 -1
  188. package/dist/Stack/Stack.d.ts +1 -1
  189. package/dist/Stack/Stack.js +96 -41
  190. package/dist/Stack/Stack.types.js +15 -5
  191. package/dist/Stack/demo/StackDemo.js +148 -122
  192. package/dist/Stack/index.js +38 -30
  193. package/dist/Steps/Step.css +2 -2
  194. package/dist/Steps/Step.d.ts +1 -1
  195. package/dist/Steps/Step.js +144 -87
  196. package/dist/Steps/Step.types.js +15 -5
  197. package/dist/Steps/Steps.d.ts +1 -1
  198. package/dist/Steps/Steps.js +107 -46
  199. package/dist/Steps/Steps.types.js +15 -5
  200. package/dist/Steps/StepsContext.js +40 -10
  201. package/dist/Steps/index.js +42 -50
  202. package/dist/Swiper/Swiper.d.ts +1 -1
  203. package/dist/Swiper/Swiper.js +149 -82
  204. package/dist/Swiper/Swiper.miniapp.d.ts +2 -0
  205. package/dist/Swiper/Swiper.miniapp.js +24 -0
  206. package/dist/Swiper/Swiper.types.js +15 -5
  207. package/dist/Swiper/SwiperItem.js +66 -28
  208. package/dist/Swiper/SwiperItem.miniapp.d.ts +2 -0
  209. package/dist/Swiper/SwiperItem.miniapp.js +24 -0
  210. package/dist/Swiper/index.js +40 -38
  211. package/dist/Switch/Switch.css +1 -1
  212. package/dist/Switch/Switch.d.ts +1 -1
  213. package/dist/Switch/Switch.js +121 -48
  214. package/dist/Switch/Switch.types.js +15 -5
  215. package/dist/Switch/index.js +38 -30
  216. package/dist/TabBar/TabBar.d.ts +1 -1
  217. package/dist/TabBar/TabBar.js +95 -37
  218. package/dist/TabBar/TabBarContext.js +24 -8
  219. package/dist/TabBar/TabBarItem.d.ts +1 -1
  220. package/dist/TabBar/TabBarItem.js +123 -59
  221. package/dist/TabBar/index.js +39 -32
  222. package/dist/TabBar/index.types.js +15 -5
  223. package/dist/Tabs/Tab.d.ts +1 -1
  224. package/dist/Tabs/Tab.js +104 -52
  225. package/dist/Tabs/Tab.types.js +15 -5
  226. package/dist/Tabs/TabPanel.d.ts +1 -1
  227. package/dist/Tabs/TabPanel.js +76 -31
  228. package/dist/Tabs/TabPanel.types.js +15 -5
  229. package/dist/Tabs/Tabs.css +10 -3
  230. package/dist/Tabs/Tabs.d.ts +1 -1
  231. package/dist/Tabs/Tabs.js +177 -127
  232. package/dist/Tabs/Tabs.types.js +15 -5
  233. package/dist/Tabs/TabsContext.d.ts +2 -2
  234. package/dist/Tabs/TabsContext.js +42 -12
  235. package/dist/Tabs/index.js +48 -71
  236. package/dist/Tabs/utils/bound.js +24 -8
  237. package/dist/Tag/Tag.d.ts +1 -1
  238. package/dist/Tag/Tag.js +102 -47
  239. package/dist/Tag/Tag.types.js +15 -5
  240. package/dist/Tag/TagGroup.css +1 -1
  241. package/dist/Tag/TagGroup.d.ts +1 -1
  242. package/dist/Tag/TagGroup.js +74 -25
  243. package/dist/Tag/TagGroup.types.js +15 -5
  244. package/dist/Tag/index.js +41 -44
  245. package/dist/TextArea/TextArea.d.ts +1 -1
  246. package/dist/TextArea/TextArea.js +203 -137
  247. package/dist/TextArea/TextArea.types.js +15 -5
  248. package/dist/TextArea/index.js +37 -30
  249. package/dist/Transition/Transition.js +61 -17
  250. package/dist/Transition/Transition.miniapp.js +62 -17
  251. package/dist/Transition/Transition.types.js +15 -5
  252. package/dist/Transition/TransitionCore.js +243 -161
  253. package/dist/Transition/index.js +38 -30
  254. package/dist/index.js +98 -444
  255. package/es/ActionSheet/ActionSheet.js +79 -54
  256. package/es/ActionSheet/ActionSheet.types.js +0 -1
  257. package/es/ActionSheet/ActionSheetContext.js +7 -4
  258. package/es/ActionSheet/ActionSheetItem.d.ts +1 -1
  259. package/es/ActionSheet/ActionSheetItem.js +86 -45
  260. package/es/ActionSheet/ActionSheetItem.types.js +0 -1
  261. package/es/ActionSheet/index.js +8 -3
  262. package/es/Alert/Alert.d.ts +1 -1
  263. package/es/Alert/Alert.js +145 -99
  264. package/es/Alert/Alert.types.js +0 -1
  265. package/es/Alert/index.js +5 -2
  266. package/es/Avatar/Avatar.d.ts +1 -1
  267. package/es/Avatar/Avatar.js +102 -50
  268. package/es/Avatar/Avatar.types.js +0 -1
  269. package/es/Avatar/AvatarGroup.d.ts +1 -1
  270. package/es/Avatar/AvatarGroup.js +96 -61
  271. package/es/Avatar/AvatarGroup.types.js +0 -1
  272. package/es/Avatar/index.js +7 -3
  273. package/es/Backdrop/Backdrop.d.ts +1 -1
  274. package/es/Backdrop/Backdrop.js +67 -28
  275. package/es/Backdrop/Backdrop.types.js +0 -1
  276. package/es/Backdrop/index.js +6 -2
  277. package/es/Badge/Badge.d.ts +1 -1
  278. package/es/Badge/Badge.js +82 -34
  279. package/es/Badge/Badge.types.js +0 -1
  280. package/es/Badge/index.js +6 -2
  281. package/es/Button/Button.css +31 -7
  282. package/es/Button/Button.d.ts +1 -1
  283. package/es/Button/Button.js +84 -42
  284. package/es/Button/Button.types.js +0 -1
  285. package/es/Button/index.js +6 -2
  286. package/es/Calendar/Calendar.d.ts +1 -1
  287. package/es/Calendar/Calendar.js +272 -264
  288. package/es/Calendar/Calendar.types.js +0 -1
  289. package/es/Calendar/index.js +6 -2
  290. package/es/Calendar/utils.js +27 -42
  291. package/es/Card/Card.d.ts +1 -1
  292. package/es/Card/Card.js +47 -19
  293. package/es/Card/Card.types.js +0 -1
  294. package/es/Card/CardContent.d.ts +1 -1
  295. package/es/Card/CardContent.js +42 -18
  296. package/es/Card/CardContent.types.js +0 -1
  297. package/es/Card/CardFooter.d.ts +1 -1
  298. package/es/Card/CardFooter.js +42 -18
  299. package/es/Card/CardFooter.types.js +0 -1
  300. package/es/Card/CardHeader.d.ts +1 -1
  301. package/es/Card/CardHeader.js +65 -51
  302. package/es/Card/CardHeader.types.js +0 -1
  303. package/es/Card/index.js +9 -3
  304. package/es/Checkbox/Checkbox.d.ts +1 -1
  305. package/es/Checkbox/Checkbox.js +123 -90
  306. package/es/Checkbox/Checkbox.types.js +0 -1
  307. package/es/Checkbox/CheckboxContext.js +8 -4
  308. package/es/Checkbox/CheckboxGroup.d.ts +1 -1
  309. package/es/Checkbox/CheckboxGroup.js +81 -58
  310. package/es/Checkbox/index.js +7 -2
  311. package/es/CitySelector/CitySelector.d.ts +1 -1
  312. package/es/CitySelector/CitySelector.js +56 -35
  313. package/es/CitySelector/CitySelector.miniapp.d.ts +1 -1
  314. package/es/CitySelector/CitySelector.miniapp.js +95 -74
  315. package/es/CitySelector/CitySelector.types.js +0 -1
  316. package/es/CitySelector/CitySelectorCore.js +203 -187
  317. package/es/CitySelector/Selector/index.js +17 -11
  318. package/es/CitySelector/index.js +6 -2
  319. package/es/Countdown/Countdown.css +11 -1
  320. package/es/Countdown/Countdown.d.ts +1 -1
  321. package/es/Countdown/Countdown.js +108 -85
  322. package/es/Countdown/Countdown.types.js +0 -1
  323. package/es/Countdown/index.js +6 -2
  324. package/es/Countdown/useCountdown.js +26 -43
  325. package/es/Countdown/utils.js +78 -105
  326. package/es/Divider/Divider.d.ts +1 -1
  327. package/es/Divider/Divider.js +45 -41
  328. package/es/Divider/Divider.types.js +0 -1
  329. package/es/Divider/index.js +6 -2
  330. package/es/Drawer/Drawer.css +0 -1
  331. package/es/Drawer/Drawer.js +107 -61
  332. package/es/Drawer/Drawer.types.js +0 -1
  333. package/es/Drawer/index.js +6 -2
  334. package/es/Fade/Fade.js +95 -55
  335. package/es/Fade/Fade.types.js +0 -1
  336. package/es/Fade/index.js +7 -3
  337. package/es/IconButton/IconButton.css +26 -6
  338. package/es/IconButton/IconButton.d.ts +1 -1
  339. package/es/IconButton/IconButton.js +87 -41
  340. package/es/IconButton/IconButton.types.js +0 -1
  341. package/es/IconButton/index.js +6 -2
  342. package/es/Image/Image.d.ts +1 -1
  343. package/es/Image/Image.js +136 -106
  344. package/es/Image/Image.types.js +0 -1
  345. package/es/Image/index.js +7 -3
  346. package/es/Input/Input.d.ts +1 -1
  347. package/es/Input/Input.js +136 -103
  348. package/es/Input/Input.types.js +0 -1
  349. package/es/Input/index.js +6 -2
  350. package/es/List/List.d.ts +1 -1
  351. package/es/List/List.js +68 -28
  352. package/es/List/List.types.js +0 -1
  353. package/es/List/ListContext.js +6 -3
  354. package/es/List/ListItem.d.ts +1 -1
  355. package/es/List/ListItem.js +75 -42
  356. package/es/List/ListItem.types.js +0 -1
  357. package/es/List/ListItemContent.d.ts +1 -1
  358. package/es/List/ListItemContent.js +55 -28
  359. package/es/List/ListItemContent.types.js +0 -1
  360. package/es/List/ListItemExtra.d.ts +1 -1
  361. package/es/List/ListItemExtra.js +43 -20
  362. package/es/List/ListItemExtra.types.js +0 -1
  363. package/es/List/ListItemFooter.d.ts +1 -1
  364. package/es/List/ListItemFooter.js +43 -20
  365. package/es/List/ListItemFooter.types.js +0 -1
  366. package/es/List/ListItemHeader.d.ts +1 -1
  367. package/es/List/ListItemHeader.js +43 -20
  368. package/es/List/ListItemHeader.types.js +0 -1
  369. package/es/List/index.js +10 -2
  370. package/es/Loading/Loading.d.ts +1 -1
  371. package/es/Loading/Loading.js +56 -28
  372. package/es/Loading/Loading.types.js +0 -1
  373. package/es/Loading/index.js +6 -2
  374. package/es/Modal/Modal.d.ts +1 -1
  375. package/es/Modal/Modal.js +93 -70
  376. package/es/Modal/Modal.miniapp.d.ts +3 -3
  377. package/es/Modal/Modal.miniapp.js +104 -67
  378. package/es/Modal/Modal.types.js +0 -1
  379. package/es/Modal/index.js +7 -3
  380. package/es/NavBar/NavBar.d.ts +1 -1
  381. package/es/NavBar/NavBar.js +95 -67
  382. package/es/NavBar/NavBar.types.js +0 -1
  383. package/es/NavBar/index.js +6 -2
  384. package/es/Picker/Picker.d.ts +1 -1
  385. package/es/Picker/Picker.js +139 -124
  386. package/es/Picker/Picker.types.js +0 -1
  387. package/es/Picker/PickerPanel.css +9 -1
  388. package/es/Picker/PickerPanel.d.ts +1 -1
  389. package/es/Picker/PickerPanel.js +228 -226
  390. package/es/Picker/index.js +6 -2
  391. package/es/Picker/utils.js +28 -47
  392. package/es/Portal/Portal.js +31 -10
  393. package/es/Portal/Portal.miniapp.js +40 -23
  394. package/es/Portal/Portal.types.js +0 -1
  395. package/es/Portal/PortalCore.js +42 -53
  396. package/es/Portal/index.js +7 -3
  397. package/es/Progress/Progress.d.ts +1 -1
  398. package/es/Progress/Progress.js +76 -67
  399. package/es/Progress/Progress.types.js +0 -1
  400. package/es/Progress/index.js +7 -3
  401. package/es/Radio/Radio.d.ts +1 -1
  402. package/es/Radio/Radio.js +133 -102
  403. package/es/Radio/Radio.types.js +0 -1
  404. package/es/Radio/RadioButtonIcon.js +38 -28
  405. package/es/Radio/RadioContext.js +8 -4
  406. package/es/Radio/RadioGroup.d.ts +1 -1
  407. package/es/Radio/RadioGroup.js +71 -44
  408. package/es/Radio/index.js +7 -2
  409. package/es/Rating/Rating.d.ts +1 -1
  410. package/es/Rating/Rating.js +132 -89
  411. package/es/Rating/Rating.types.js +0 -1
  412. package/es/Rating/index.js +6 -2
  413. package/es/ScrollView/ScrollView.d.ts +1 -1
  414. package/es/ScrollView/ScrollView.js +204 -185
  415. package/{dist/ScrollView/index.miniapp.d.ts → es/ScrollView/ScrollView.miniapp.d.ts} +0 -1
  416. package/es/ScrollView/ScrollView.miniapp.js +5 -0
  417. package/es/ScrollView/ScrollView.types.js +0 -1
  418. package/es/ScrollView/index.js +7 -3
  419. package/es/Select/Select.d.ts +1 -1
  420. package/es/Select/Select.js +167 -138
  421. package/es/Select/Select.types.js +0 -1
  422. package/es/Select/SelectOption.d.ts +1 -1
  423. package/es/Select/SelectOption.js +66 -41
  424. package/es/Select/index.js +6 -2
  425. package/es/Select/selectContext.js +6 -3
  426. package/es/Skeleton/Skeleton.css +7 -2
  427. package/es/Skeleton/Skeleton.d.ts +1 -1
  428. package/es/Skeleton/Skeleton.js +76 -35
  429. package/es/Skeleton/Skeleton.types.js +0 -1
  430. package/es/Skeleton/index.js +7 -3
  431. package/es/Slide/Slide.js +110 -67
  432. package/es/Slide/Slide.types.js +0 -1
  433. package/es/Slide/index.js +7 -3
  434. package/es/Slider/Slider.css +2 -2
  435. package/es/Slider/Slider.d.ts +1 -1
  436. package/es/Slider/Slider.js +236 -244
  437. package/es/Slider/Slider.types.js +0 -1
  438. package/es/Slider/index.js +6 -2
  439. package/es/Slider/utils.js +13 -22
  440. package/es/Stack/Stack.css +0 -1
  441. package/es/Stack/Stack.d.ts +1 -1
  442. package/es/Stack/Stack.js +78 -47
  443. package/es/Stack/Stack.types.js +0 -1
  444. package/es/Stack/demo/StackDemo.js +123 -126
  445. package/es/Stack/index.js +7 -3
  446. package/es/Steps/Step.css +2 -2
  447. package/es/Steps/Step.d.ts +1 -1
  448. package/es/Steps/Step.js +130 -77
  449. package/es/Steps/Step.types.js +0 -1
  450. package/es/Steps/Steps.d.ts +1 -1
  451. package/es/Steps/Steps.js +83 -44
  452. package/es/Steps/Steps.types.js +0 -1
  453. package/es/Steps/StepsContext.js +8 -4
  454. package/es/Steps/index.js +8 -3
  455. package/es/Swiper/Swiper.d.ts +1 -1
  456. package/es/Swiper/Swiper.js +136 -99
  457. package/es/Swiper/Swiper.miniapp.d.ts +2 -0
  458. package/es/Swiper/Swiper.miniapp.js +5 -0
  459. package/es/Swiper/Swiper.types.js +0 -1
  460. package/es/Swiper/SwiperItem.js +40 -23
  461. package/es/Swiper/SwiperItem.miniapp.d.ts +2 -0
  462. package/es/Swiper/SwiperItem.miniapp.js +5 -0
  463. package/es/Swiper/index.js +8 -3
  464. package/es/Switch/Switch.css +1 -1
  465. package/es/Switch/Switch.d.ts +1 -1
  466. package/es/Switch/Switch.js +110 -67
  467. package/es/Switch/Switch.types.js +0 -1
  468. package/es/Switch/index.js +7 -3
  469. package/es/TabBar/TabBar.d.ts +1 -1
  470. package/es/TabBar/TabBar.js +72 -36
  471. package/es/TabBar/TabBarContext.js +6 -3
  472. package/es/TabBar/TabBarItem.d.ts +1 -1
  473. package/es/TabBar/TabBarItem.js +97 -52
  474. package/es/TabBar/index.js +5 -2
  475. package/es/TabBar/index.types.js +0 -1
  476. package/es/Tabs/Tab.d.ts +1 -1
  477. package/es/Tabs/Tab.js +77 -44
  478. package/es/Tabs/Tab.types.js +0 -1
  479. package/es/Tabs/TabPanel.d.ts +1 -1
  480. package/es/Tabs/TabPanel.js +50 -25
  481. package/es/Tabs/TabPanel.types.js +0 -1
  482. package/es/Tabs/Tabs.css +10 -3
  483. package/es/Tabs/Tabs.d.ts +1 -1
  484. package/es/Tabs/Tabs.js +180 -163
  485. package/es/Tabs/Tabs.types.js +0 -1
  486. package/es/Tabs/TabsContext.d.ts +2 -2
  487. package/es/Tabs/TabsContext.js +10 -6
  488. package/es/Tabs/index.js +10 -4
  489. package/es/Tabs/utils/bound.js +8 -5
  490. package/es/Tag/Tag.d.ts +1 -1
  491. package/es/Tag/Tag.js +85 -53
  492. package/es/Tag/Tag.types.js +0 -1
  493. package/es/Tag/TagGroup.css +1 -1
  494. package/es/Tag/TagGroup.d.ts +1 -1
  495. package/es/Tag/TagGroup.js +47 -19
  496. package/es/Tag/TagGroup.types.js +0 -1
  497. package/es/Tag/index.js +5 -2
  498. package/es/TextArea/TextArea.d.ts +1 -1
  499. package/es/TextArea/TextArea.js +177 -139
  500. package/es/TextArea/TextArea.types.js +0 -1
  501. package/es/TextArea/index.js +6 -2
  502. package/es/Transition/Transition.js +31 -11
  503. package/es/Transition/Transition.miniapp.js +32 -11
  504. package/es/Transition/Transition.types.js +0 -1
  505. package/es/Transition/TransitionCore.js +218 -272
  506. package/es/Transition/index.js +7 -3
  507. package/es/index.js +1 -1
  508. package/package.json +16 -12
  509. package/src/index.ts +40 -0
  510. package/dist/ScrollView/index.miniapp.js +0 -14
  511. package/dist/Swiper/index.miniapp.d.ts +0 -8
  512. package/dist/Swiper/index.miniapp.js +0 -23
  513. package/es/ScrollView/index.miniapp.d.ts +0 -3
  514. package/es/Swiper/index.miniapp.d.ts +0 -8
  515. package/es/Swiper/index.miniapp.js +0 -6
@@ -1,245 +1,223 @@
1
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- var _excluded = ["className", "defaultValue", "value", "min", "max", "step", "tipVisible", "tooltipRender", "disabled", "startIcon", "endIcon", "disableSwap", "onChange"];
3
- function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
- function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
8
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
9
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
10
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
11
- function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
12
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
13
- function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
14
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
15
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
16
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
17
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
18
- function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
19
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
20
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
21
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
22
- import { GripperBarVerticalIcon } from '@bifrostui/icons';
23
- import { isMini, useForkRef, useTouchEmulator, useValue, getBoundingClientRect } from '@bifrostui/utils';
24
- import clsx from 'clsx';
25
- import React, { useCallback, useLayoutEffect, useMemo, useRef, useState } from 'react';
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
3
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
4
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
5
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
+ var __spreadValues = (a, b) => {
7
+ for (var prop in b || (b = {}))
8
+ if (__hasOwnProp.call(b, prop))
9
+ __defNormalProp(a, prop, b[prop]);
10
+ if (__getOwnPropSymbols)
11
+ for (var prop of __getOwnPropSymbols(b)) {
12
+ if (__propIsEnum.call(b, prop))
13
+ __defNormalProp(a, prop, b[prop]);
14
+ }
15
+ return a;
16
+ };
17
+ var __objRest = (source, exclude) => {
18
+ var target = {};
19
+ for (var prop in source)
20
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
21
+ target[prop] = source[prop];
22
+ if (source != null && __getOwnPropSymbols)
23
+ for (var prop of __getOwnPropSymbols(source)) {
24
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
25
+ target[prop] = source[prop];
26
+ }
27
+ return target;
28
+ };
29
+ var __async = (__this, __arguments, generator) => {
30
+ return new Promise((resolve, reject) => {
31
+ var fulfilled = (value) => {
32
+ try {
33
+ step(generator.next(value));
34
+ } catch (e) {
35
+ reject(e);
36
+ }
37
+ };
38
+ var rejected = (value) => {
39
+ try {
40
+ step(generator.throw(value));
41
+ } catch (e) {
42
+ reject(e);
43
+ }
44
+ };
45
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
46
+ step((generator = generator.apply(__this, __arguments)).next());
47
+ });
48
+ };
49
+ import { GripperBarVerticalIcon } from "@bifrostui/icons";
50
+ import {
51
+ isMini,
52
+ useForkRef,
53
+ useTouchEmulator,
54
+ useValue,
55
+ getBoundingClientRect
56
+ } from "@bifrostui/utils";
57
+ import clsx from "clsx";
58
+ import React, {
59
+ useCallback,
60
+ useLayoutEffect,
61
+ useMemo,
62
+ useRef,
63
+ useState
64
+ } from "react";
26
65
  import "./Slider.css";
27
66
  import { formatValue, isSameValue, sortValue } from "./utils";
28
- var classes = {
29
- root: 'bui-slider',
30
- button: 'bui-slider-button',
31
- tooltip: 'bui-slider-tooltip',
32
- disabled: 'bui-slider-disabled'
67
+ const classes = {
68
+ root: "bui-slider",
69
+ button: "bui-slider-button",
70
+ tooltip: "bui-slider-tooltip",
71
+ disabled: "bui-slider-disabled"
33
72
  };
34
- var SLIDER_BUTTON = {
73
+ const SLIDER_BUTTON = {
35
74
  FRONT: 0,
36
75
  END: 1
37
76
  };
38
- var Slider = /*#__PURE__*/React.forwardRef(function (props, ref) {
39
- var className = props.className,
40
- defaultValue = props.defaultValue,
41
- valueProp = props.value,
42
- min = props.min,
43
- max = props.max,
44
- step = props.step,
45
- tipVisible = props.tipVisible,
46
- tooltipRender = props.tooltipRender,
47
- disabled = props.disabled,
48
- startIcon = props.startIcon,
49
- endIcon = props.endIcon,
50
- disableSwap = props.disableSwap,
51
- _onChange = props.onChange,
52
- others = _objectWithoutProperties(props, _excluded);
53
- var initialDefaultValue = useRef(defaultValue);
54
- // 处理value/defaultValue都不传的异常场景
55
- var latestVal = useRef(0);
56
- var shouldProtection = valueProp === undefined && defaultValue === undefined;
57
- var value = shouldProtection ? latestVal.current : valueProp;
58
- var _useState = useState(null),
59
- _useState2 = _slicedToArray(_useState, 2),
60
- rootRef = _useState2[0],
61
- setRootRef = _useState2[1];
62
- var handleRef = useForkRef(ref, setRootRef);
77
+ const Slider = React.forwardRef((props, ref) => {
78
+ const _a = props, {
79
+ className,
80
+ defaultValue,
81
+ value: valueProp,
82
+ min,
83
+ max,
84
+ step,
85
+ tipVisible,
86
+ tooltipRender,
87
+ disabled,
88
+ startIcon,
89
+ endIcon,
90
+ disableSwap,
91
+ onChange
92
+ } = _a, others = __objRest(_a, [
93
+ "className",
94
+ "defaultValue",
95
+ "value",
96
+ "min",
97
+ "max",
98
+ "step",
99
+ "tipVisible",
100
+ "tooltipRender",
101
+ "disabled",
102
+ "startIcon",
103
+ "endIcon",
104
+ "disableSwap",
105
+ "onChange"
106
+ ]);
107
+ const initialDefaultValue = useRef(defaultValue);
108
+ const latestVal = useRef(0);
109
+ const shouldProtection = valueProp === void 0 && defaultValue === void 0;
110
+ const value = shouldProtection ? latestVal.current : valueProp;
111
+ const [rootRef, setRootRef] = useState(null);
112
+ const handleRef = useForkRef(ref, setRootRef);
63
113
  useTouchEmulator(rootRef);
64
-
65
- // Slider BoundingClientRect
66
- var sliderRect = useRef();
67
- // 滑动开始距离文档X轴原点距离
68
- var touchStartPageX = useRef();
69
- // 按钮在滑动开始时距离左边的距离
70
- var touchStartLeft = useRef();
71
- // 记录操作按钮
72
- var buttonIndex = useRef(0);
73
- // 记录双滑块touchMove之前的值
74
- var beforeMoveValue = useRef([0, 0]);
75
-
76
- // 默认图标
77
- var defaultIcon = /*#__PURE__*/React.createElement(GripperBarVerticalIcon, {
78
- htmlColor: "#2e333e"
79
- });
80
- // 根据初始化时的数据判断是否为双滑块
81
- var initialRange = useRef(value !== undefined && Array.isArray(value) || defaultValue !== undefined && Array.isArray(defaultValue));
82
- // 是否为双滑块
83
- var range = useMemo(function () {
84
- // defaultValue传state,且通过setState改变defaltValue类型,此时使用初始化时的range(initialRange)判断
114
+ const sliderRect = useRef();
115
+ const touchStartPageX = useRef();
116
+ const touchStartLeft = useRef();
117
+ const buttonIndex = useRef(0);
118
+ const beforeMoveValue = useRef([0, 0]);
119
+ const defaultIcon = /* @__PURE__ */ React.createElement(GripperBarVerticalIcon, { htmlColor: "#2e333e" });
120
+ const initialRange = useRef(
121
+ value !== void 0 && Array.isArray(value) || defaultValue !== void 0 && Array.isArray(defaultValue)
122
+ );
123
+ const range = useMemo(() => {
85
124
  if (Array.isArray(defaultValue) && !Array.isArray(initialDefaultValue.current)) {
86
125
  return initialRange.current;
87
126
  }
88
- return value !== undefined && Array.isArray(value) || defaultValue !== undefined && Array.isArray(defaultValue);
127
+ return value !== void 0 && Array.isArray(value) || defaultValue !== void 0 && Array.isArray(defaultValue);
89
128
  }, [value, defaultValue]);
90
-
91
- // 气泡提示显示与隐藏
92
- var _useState3 = useState(false),
93
- _useState4 = _slicedToArray(_useState3, 2),
94
- frontTooltipVisible = _useState4[0],
95
- setFrontTooltipVisible = _useState4[1];
96
- var _useState5 = useState(false),
97
- _useState6 = _slicedToArray(_useState5, 2),
98
- endTooltipVisible = _useState6[0],
99
- setEndTooltipVisible = _useState6[1];
100
-
101
- /**
102
- * 格式化value、defaultValue
103
- * @type undefined | number[]
104
- */
105
- var formattedValue = formatValue(value);
106
- var formattedDefaultValue = formatValue(defaultValue);
107
-
108
- /**
109
- * 使用格式化后的value、defaultValue初始化sliderValue,应始终使用triggerChange改变值
110
- * @type undefined | number[]
111
- */
112
- var _useValue = useValue({
113
- value: formattedValue,
114
- defaultValue: formattedDefaultValue,
115
- onChange: function onChange(e, data) {
116
- _onChange === null || _onChange === void 0 || _onChange(e, {
117
- value: data === null || data === void 0 ? void 0 : data.value,
118
- buttonIndex: buttonIndex.current
119
- });
120
- },
121
- config: {
122
- name: 'Slider',
123
- state: 'value'
124
- }
125
- }),
126
- _useValue2 = _slicedToArray(_useValue, 2),
127
- sliderValue = _useValue2[0],
128
- triggerChange = _useValue2[1];
129
-
130
- // 内部状态值
131
- var internalValue = useMemo(function () {
132
- return sliderValue === undefined ? [min, max] : sliderValue;
129
+ const [frontTooltipVisible, setFrontTooltipVisible] = useState(false);
130
+ const [endTooltipVisible, setEndTooltipVisible] = useState(false);
131
+ const formattedValue = formatValue(value);
132
+ const formattedDefaultValue = formatValue(defaultValue);
133
+ const [sliderValue, triggerChange] = useValue({
134
+ value: formattedValue,
135
+ defaultValue: formattedDefaultValue,
136
+ onChange: (e, data) => {
137
+ onChange == null ? void 0 : onChange(e, {
138
+ value: data == null ? void 0 : data.value,
139
+ buttonIndex: buttonIndex.current
140
+ });
141
+ },
142
+ config: {
143
+ name: "Slider",
144
+ state: "value"
145
+ }
146
+ });
147
+ const internalValue = useMemo(() => {
148
+ return sliderValue === void 0 ? [min, max] : sliderValue;
133
149
  }, [sliderValue]);
134
- // 记录上一次值
135
- var preValueRef = useRef(internalValue[buttonIndex.current]);
136
- // 记录气泡值
137
- var tooltipRef = useRef(internalValue);
138
-
139
- // 最大最小值范围
140
- var scope = useMemo(function () {
141
- return Number(max) - Number(min);
142
- }, [max, min]);
143
-
144
- // 提示气泡展示逻辑
145
- var tooltipVisible = useMemo(function () {
146
- var startVisible = buttonIndex.current === SLIDER_BUTTON.FRONT && frontTooltipVisible;
147
- var endVisible = buttonIndex.current === SLIDER_BUTTON.END && endTooltipVisible;
150
+ const preValueRef = useRef(internalValue[buttonIndex.current]);
151
+ const tooltipRef = useRef(internalValue);
152
+ const scope = useMemo(() => Number(max) - Number(min), [max, min]);
153
+ const tooltipVisible = useMemo(() => {
154
+ const startVisible = buttonIndex.current === SLIDER_BUTTON.FRONT && frontTooltipVisible;
155
+ const endVisible = buttonIndex.current === SLIDER_BUTTON.END && endTooltipVisible;
148
156
  return tipVisible || !tipVisible && (startVisible || endVisible);
149
157
  }, [tipVisible, frontTooltipVisible, endTooltipVisible]);
150
-
151
- // 着色条样式
152
- var lineStyle = useMemo(function () {
153
- var sortedValue = sortValue(internalValue);
154
- var width = "".concat((sortedValue[1] - sortedValue[0] - min) / scope * 100, "%");
155
- // 单滑块模式但动态修改value为数组,此时按照数组最小值计算着色条宽度
158
+ const lineStyle = useMemo(() => {
159
+ const sortedValue = sortValue(internalValue);
160
+ let width = `${(sortedValue[1] - sortedValue[0] - min) / scope * 100}%`;
156
161
  if (!range && Array.isArray(value)) {
157
- width = "".concat((sortedValue[0] - min) / scope * 100, "%");
162
+ width = `${(sortedValue[0] - min) / scope * 100}%`;
158
163
  }
159
164
  return {
160
- left: range ? "".concat((sortedValue[0] - min) / scope * 100, "%") : '0%',
161
- width: width
165
+ left: range ? `${(sortedValue[0] - min) / scope * 100}%` : "0%",
166
+ width
162
167
  };
163
168
  }, [internalValue, scope, value]);
164
- var getLineWidth = useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
165
- return _regeneratorRuntime().wrap(function _callee$(_context) {
166
- while (1) switch (_context.prev = _context.next) {
167
- case 0:
168
- if (rootRef) {
169
- _context.next = 2;
170
- break;
171
- }
172
- return _context.abrupt("return");
173
- case 2:
174
- _context.next = 4;
175
- return getBoundingClientRect(rootRef);
176
- case 4:
177
- sliderRect.current = _context.sent;
178
- case 5:
179
- case "end":
180
- return _context.stop();
181
- }
182
- }, _callee);
183
- })), [rootRef]);
184
- useLayoutEffect(function () {
185
- // 处理小程序初始化获取不到dom的问题
186
- setTimeout(function () {
169
+ const getLineWidth = useCallback(() => __async(void 0, null, function* () {
170
+ if (!rootRef)
171
+ return;
172
+ sliderRect.current = yield getBoundingClientRect(rootRef);
173
+ }), [rootRef]);
174
+ useLayoutEffect(() => {
175
+ setTimeout(() => {
187
176
  getLineWidth();
188
177
  }, 100);
189
178
  }, [rootRef]);
190
- var _onTouchStart = function onTouchStart(e) {
191
- if (disabled) return;
179
+ const onTouchStart = (e) => {
180
+ if (disabled)
181
+ return;
192
182
  beforeMoveValue.current = internalValue;
193
183
  tooltipRef.current = internalValue;
194
- // 补偿获取宽度,隐藏元素getBoundingClientRect获取不到dom信息
195
184
  if (!sliderRect.current.width) {
196
185
  getLineWidth();
197
186
  }
198
- // currentTarget只存在于事件触发到事件处理结束之间,须在异步操作之前保存下来
199
- var currentTarget = isMini ? e.mpEvent.currentTarget : e.currentTarget;
187
+ const currentTarget = isMini ? e.mpEvent.currentTarget : e.currentTarget;
200
188
  touchStartPageX.current = e.touches[0].pageX;
201
- touchStartLeft.current = currentTarget === null || currentTarget === void 0 ? void 0 : currentTarget.offsetLeft;
202
-
203
- // 显示气泡提示
189
+ touchStartLeft.current = currentTarget == null ? void 0 : currentTarget.offsetLeft;
204
190
  if (buttonIndex.current === SLIDER_BUTTON.END) {
205
191
  setEndTooltipVisible(true);
206
192
  } else {
207
193
  setFrontTooltipVisible(true);
208
194
  }
209
195
  };
210
- var onTouchMove = function onTouchMove(e) {
211
- if (disabled) return;
212
- // 触碰点当前x坐标
213
- var currentX = e.touches[0].pageX;
214
- // X轴滑动距离
215
- var moveX = currentX - touchStartPageX.current;
216
- // 计算下一个值
217
- var posX = (touchStartLeft.current + moveX) / sliderRect.current.width * scope;
218
- // 兼容一位小数
219
- var nextPosition = step < 1 ? Math.round(posX * 10) / 10 : Math.round(posX);
220
- if (nextPosition <= 0) nextPosition = 0;
221
- if (nextPosition >= scope) nextPosition = scope;
222
-
223
- // 滑动最新值
224
- var nextValue = min + nextPosition;
225
- var inStep = nextValue % step === 0;
226
-
227
- // 滑动的最新值与上一次值不等时 & 符合当前步长,则更新sliderValue
196
+ const onTouchMove = (e) => {
197
+ if (disabled)
198
+ return;
199
+ const currentX = e.touches[0].pageX;
200
+ const moveX = currentX - touchStartPageX.current;
201
+ const posX = (touchStartLeft.current + moveX) / sliderRect.current.width * scope;
202
+ let nextPosition = step < 1 ? Math.round(posX * 10) / 10 : Math.round(posX);
203
+ if (nextPosition <= 0)
204
+ nextPosition = 0;
205
+ if (nextPosition >= scope)
206
+ nextPosition = scope;
207
+ const nextValue = min + nextPosition;
208
+ const inStep = nextValue % step === 0;
228
209
  if (!isSameValue(nextValue, preValueRef.current) && inStep) {
229
- var latestValue = nextValue;
210
+ let latestValue = nextValue;
230
211
  preValueRef.current = nextValue;
231
- // 单滑块
232
212
  tooltipRef.current = [latestValue, 0];
233
213
  if (range) {
234
- latestValue = _toConsumableArray(beforeMoveValue.current);
214
+ latestValue = [...beforeMoveValue.current];
235
215
  if (disableSwap) {
236
- // 滑动前按钮
237
216
  if (buttonIndex.current === SLIDER_BUTTON.FRONT && nextValue >= latestValue[SLIDER_BUTTON.END]) {
238
217
  latestValue[SLIDER_BUTTON.END] = nextValue;
239
218
  } else {
240
219
  latestValue[buttonIndex.current] = nextValue;
241
220
  }
242
- // 滑动后按钮
243
221
  if (buttonIndex.current === SLIDER_BUTTON.END && nextValue <= latestValue[SLIDER_BUTTON.FRONT]) {
244
222
  latestValue[SLIDER_BUTTON.FRONT] = nextValue;
245
223
  } else {
@@ -248,71 +226,85 @@ var Slider = /*#__PURE__*/React.forwardRef(function (props, ref) {
248
226
  tooltipRef.current = latestValue;
249
227
  } else {
250
228
  latestValue[buttonIndex.current] = nextValue;
251
- // 气泡值不应sort排序
252
229
  tooltipRef.current = latestValue;
253
230
  latestValue = sortValue(latestValue);
254
231
  }
255
232
  preValueRef.current = latestValue[buttonIndex.current];
256
233
  }
257
- latestVal.current = defaultValue !== undefined ? formatValue(latestValue) : latestValue;
234
+ latestVal.current = defaultValue !== void 0 ? formatValue(latestValue) : latestValue;
258
235
  triggerChange(e, latestVal.current);
259
236
  }
260
237
  };
261
- var onTouchEnd = function onTouchEnd() {
262
- if (disabled) return;
263
- // 置为排序后的值
238
+ const onTouchEnd = () => {
239
+ if (disabled)
240
+ return;
264
241
  tooltipRef.current = internalValue;
265
- // 隐藏左右气泡提示
266
242
  setFrontTooltipVisible(false);
267
243
  setEndTooltipVisible(false);
268
244
  };
269
- var renderButton = function renderButton(index) {
270
- var valuenow = internalValue[index];
271
- return /*#__PURE__*/React.createElement("div", {
272
- key: index,
273
- role: "slider",
274
- className: clsx(classes.button, "".concat(classes.button, "-").concat(index)),
275
- style: {
276
- left: "".concat((valuenow - min) / scope * 100, "%")
245
+ const renderButton = (index) => {
246
+ const valuenow = internalValue[index];
247
+ return /* @__PURE__ */ React.createElement(
248
+ "div",
249
+ {
250
+ key: index,
251
+ role: "slider",
252
+ className: clsx(classes.button, `${classes.button}-${index}`),
253
+ style: {
254
+ left: `${(valuenow - min) / scope * 100}%`
255
+ },
256
+ tabIndex: disabled ? -1 : 0,
257
+ "aria-valuemin": props.min,
258
+ "aria-valuenow": valuenow,
259
+ "aria-valuemax": props.max,
260
+ "aria-orientation": "horizontal",
261
+ onTouchStart: (event) => {
262
+ buttonIndex.current = index;
263
+ onTouchStart(event);
264
+ },
265
+ onTouchMove,
266
+ onTouchEnd,
267
+ onTouchCancel: onTouchEnd
277
268
  },
278
- tabIndex: disabled ? -1 : 0,
279
- "aria-valuemin": props.min,
280
- "aria-valuenow": valuenow,
281
- "aria-valuemax": props.max,
282
- "aria-orientation": "horizontal",
283
- onTouchStart: function onTouchStart(event) {
284
- buttonIndex.current = index;
285
- _onTouchStart(event);
286
- },
287
- onTouchMove: onTouchMove,
288
- onTouchEnd: onTouchEnd,
289
- onTouchCancel: onTouchEnd
290
- }, index === SLIDER_BUTTON.FRONT ? startIcon || defaultIcon : endIcon || defaultIcon);
269
+ index === SLIDER_BUTTON.FRONT ? startIcon || defaultIcon : endIcon || defaultIcon
270
+ );
291
271
  };
292
- return /*#__PURE__*/React.createElement("div", _extends({
293
- className: clsx(classes.root, className, _defineProperty({}, classes.disabled, disabled)),
294
- ref: handleRef
295
- }, others), /*#__PURE__*/React.createElement("div", {
296
- className: "".concat(classes.root, "-rail")
297
- }), /*#__PURE__*/React.createElement("div", {
298
- className: "".concat(classes.root, "-line"),
299
- style: lineStyle
300
- }), renderButton(SLIDER_BUTTON.FRONT), range && renderButton(SLIDER_BUTTON.END), /*#__PURE__*/React.createElement("div", {
301
- className: clsx(classes.tooltip, _defineProperty({}, "".concat(classes.tooltip, "-hidden"), !tooltipVisible)),
302
- style: {
303
- left: "".concat((tooltipRef.current[buttonIndex.current] - min) / scope * 100, "%")
304
- }
305
- }, tooltipRender(tooltipRef.current[buttonIndex.current])));
272
+ return /* @__PURE__ */ React.createElement(
273
+ "div",
274
+ __spreadValues({
275
+ className: clsx(classes.root, className, {
276
+ [classes.disabled]: disabled
277
+ }),
278
+ ref: handleRef
279
+ }, others),
280
+ /* @__PURE__ */ React.createElement("div", { className: `${classes.root}-rail` }),
281
+ /* @__PURE__ */ React.createElement("div", { className: `${classes.root}-line`, style: lineStyle }),
282
+ renderButton(SLIDER_BUTTON.FRONT),
283
+ range && renderButton(SLIDER_BUTTON.END),
284
+ /* @__PURE__ */ React.createElement(
285
+ "div",
286
+ {
287
+ className: clsx(classes.tooltip, {
288
+ [`${classes.tooltip}-hidden`]: !tooltipVisible
289
+ }),
290
+ style: {
291
+ left: `${(tooltipRef.current[buttonIndex.current] - min) / scope * 100}%`
292
+ }
293
+ },
294
+ tooltipRender(tooltipRef.current[buttonIndex.current])
295
+ )
296
+ );
306
297
  });
307
- Slider.displayName = 'BuiSlider';
298
+ Slider.displayName = "BuiSlider";
308
299
  Slider.defaultProps = {
309
300
  min: 0,
310
301
  max: 100,
311
302
  step: 1,
312
303
  disableSwap: false,
313
304
  tipVisible: false,
314
- tooltipRender: function tooltipRender(value) {
315
- return value;
316
- }
305
+ tooltipRender: (value) => value
306
+ };
307
+ var Slider_default = Slider;
308
+ export {
309
+ Slider_default as default
317
310
  };
318
- export default Slider;
@@ -1 +0,0 @@
1
- export {};
@@ -1,2 +1,6 @@
1
- export { default, default as Slider } from "./Slider";
2
- export * from "./Slider.types";
1
+ import { default as default2, default as default3 } from "./Slider";
2
+ export * from "./Slider.types";
3
+ export {
4
+ default3 as Slider,
5
+ default2 as default
6
+ };
@@ -1,25 +1,16 @@
1
- /**
2
- * 格式化数据
3
- * @returns undefined | number[]
4
- */
5
- export var formatValue = function formatValue(value) {
6
- if (value === undefined) return value;
1
+ const formatValue = (value) => {
2
+ if (value === void 0)
3
+ return value;
7
4
  return Array.isArray(value) ? value : [value, 0];
8
5
  };
9
-
10
- /**
11
- * 从小到大排序
12
- */
13
- export var sortValue = function sortValue(v) {
14
- if (!v) return v;
15
- return v.slice().sort(function (a, b) {
16
- return a - b;
17
- });
6
+ const sortValue = (v) => {
7
+ if (!v)
8
+ return v;
9
+ return v.slice().sort((a, b) => a - b);
10
+ };
11
+ const isSameValue = (newValue, oldValue) => JSON.stringify(newValue) === JSON.stringify(oldValue);
12
+ export {
13
+ formatValue,
14
+ isSameValue,
15
+ sortValue
18
16
  };
19
-
20
- /**
21
- * 是否为相同值
22
- */
23
- export var isSameValue = function isSameValue(newValue, oldValue) {
24
- return JSON.stringify(newValue) === JSON.stringify(oldValue);
25
- };
@@ -3,7 +3,6 @@
3
3
  align-items: var(--align-items);
4
4
  justify-content: var(--justify-content);
5
5
  flex-direction: var(--flex-direction);
6
- /* stylelint-disable-next-line declaration-block-no-redundant-longhand-properties */
7
6
  flex-wrap: var(--flex-wrap);
8
7
  row-gap: var(--spacing);
9
8
  column-gap: var(--spacing);