@bifrostui/react 1.4.8-beta.0 → 2.0.0-beta.1

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 (313) hide show
  1. package/dist/ActionSheet/ActionSheet.css +2 -2
  2. package/dist/ActionSheet/ActionSheetItem.js +3 -8
  3. package/dist/Avatar/Avatar.js +3 -8
  4. package/dist/Avatar/AvatarGroup.js +2 -6
  5. package/dist/Badge/Badge.js +3 -8
  6. package/dist/Button/Button.css +77 -78
  7. package/dist/Button/Button.d.ts +1 -1
  8. package/dist/Button/Button.js +4 -10
  9. package/dist/Button/Button.types.d.ts +8 -7
  10. package/dist/Calendar/Calendar.js +7 -19
  11. package/dist/Calendar/Calendar.types.d.ts +0 -5
  12. package/dist/Card/Card.css +1 -1
  13. package/dist/Card/CardContent.css +1 -2
  14. package/dist/Card/CardFooter.css +2 -4
  15. package/dist/Card/CardHeader.css +4 -5
  16. package/dist/Checkbox/Checkbox.js +2 -6
  17. package/dist/Checkbox/CheckboxGroup.js +4 -7
  18. package/dist/Collapse/Collapse.css +1 -0
  19. package/dist/Collapse/Collapse.d.ts +1 -1
  20. package/dist/Collapse/Collapse.js +8 -11
  21. package/dist/CollapsePanel/CollapsePanel.css +2 -4
  22. package/dist/CollapsePanel/CollapsePanelItem.js +45 -46
  23. package/dist/Countdown/Countdown.js +5 -12
  24. package/dist/Dialog/FunctionalDialog.js +1 -1
  25. package/dist/Divider/Divider.js +8 -5
  26. package/dist/Drawer/Drawer.js +4 -10
  27. package/dist/Fade/Fade.js +52 -56
  28. package/dist/IconButton/IconButton.js +5 -12
  29. package/dist/Image/Image.js +112 -119
  30. package/dist/Input/Input.js +4 -10
  31. package/dist/List/List.js +3 -8
  32. package/dist/List/ListItem.js +42 -44
  33. package/dist/List/ListItemContent.js +1 -4
  34. package/dist/List/ListItemExtra.js +9 -4
  35. package/dist/List/ListItemFooter.js +9 -4
  36. package/dist/List/ListItemHeader.js +9 -4
  37. package/dist/Loading/Loading.js +13 -4
  38. package/dist/Modal/Modal.js +0 -6
  39. package/dist/Modal/Modal.miniapp.js +4 -10
  40. package/dist/NavBar/NavBar.js +0 -1
  41. package/dist/Picker/Picker.css +0 -5
  42. package/dist/Picker/Picker.js +5 -27
  43. package/dist/Picker/Picker.types.d.ts +2 -15
  44. package/dist/Picker/PickerPanel.css +0 -4
  45. package/dist/Picker/PickerPanel.js +6 -7
  46. package/dist/Popover/Popover.css +5 -5
  47. package/dist/Popover/Popover.js +27 -70
  48. package/dist/Portal/Portal.miniapp.js +4 -7
  49. package/dist/Radio/Radio.css +0 -1
  50. package/dist/Radio/Radio.js +2 -6
  51. package/dist/Radio/RadioGroup.js +0 -3
  52. package/dist/Rating/Rating.js +8 -18
  53. package/dist/ScrollView/ScrollView.js +11 -24
  54. package/dist/ScrollView/ScrollView.types.d.ts +1 -0
  55. package/dist/Select/Select.css +4 -1
  56. package/dist/Select/Select.js +41 -68
  57. package/dist/Skeleton/Skeleton.js +5 -9
  58. package/dist/Slide/Slide.js +69 -74
  59. package/dist/Slider/Slider.js +11 -27
  60. package/dist/Steps/Step.js +81 -82
  61. package/dist/Steps/Steps.d.ts +1 -1
  62. package/dist/Steps/Steps.js +57 -60
  63. package/dist/Switch/Switch.js +75 -78
  64. package/dist/TabBar/TabBar.js +3 -8
  65. package/dist/Tabs/Tab.css +10 -16
  66. package/dist/Tabs/Tab.js +2 -3
  67. package/dist/Tabs/Tabs.css +13 -22
  68. package/dist/Tabs/Tabs.js +39 -70
  69. package/dist/Tabs/Tabs.types.d.ts +0 -10
  70. package/dist/Tabs/utils/bound.d.ts +1 -0
  71. package/dist/{DesktopPicker/utils/calcAfterMounted.js → Tabs/utils/bound.js} +14 -7
  72. package/dist/Tag/Tag.css +1 -1
  73. package/dist/Tag/Tag.js +2 -6
  74. package/dist/TextArea/TextArea.js +5 -12
  75. package/dist/Toast/FunctionalToast.js +1 -1
  76. package/dist/Toast/Toast.css +1 -0
  77. package/dist/Tooltip/Tooltip.css +5 -5
  78. package/dist/Tooltip/Tooltip.js +27 -70
  79. package/dist/Transition/TransitionCore.js +3 -8
  80. package/dist/index.d.ts +0 -6
  81. package/dist/index.js +1 -13
  82. package/dist/locales/base.d.ts +0 -11
  83. package/dist/locales/en-US.js +0 -24
  84. package/dist/locales/zh-CN.js +0 -24
  85. package/dist/locales/zh-TW.js +0 -24
  86. package/es/ActionSheet/ActionSheet.css +2 -2
  87. package/es/ActionSheet/ActionSheetItem.js +3 -8
  88. package/es/Avatar/Avatar.js +3 -8
  89. package/es/Avatar/AvatarGroup.js +2 -6
  90. package/es/Badge/Badge.js +3 -8
  91. package/es/Button/Button.css +77 -78
  92. package/es/Button/Button.d.ts +1 -1
  93. package/es/Button/Button.js +3 -9
  94. package/es/Button/Button.types.d.ts +8 -7
  95. package/es/Calendar/Calendar.js +7 -19
  96. package/es/Calendar/Calendar.types.d.ts +0 -5
  97. package/es/Card/Card.css +1 -1
  98. package/es/Card/CardContent.css +1 -2
  99. package/es/Card/CardFooter.css +2 -4
  100. package/es/Card/CardHeader.css +4 -5
  101. package/es/Checkbox/Checkbox.js +2 -6
  102. package/es/Checkbox/CheckboxGroup.js +4 -7
  103. package/es/Collapse/Collapse.css +1 -0
  104. package/es/Collapse/Collapse.d.ts +1 -1
  105. package/es/Collapse/Collapse.js +8 -11
  106. package/es/CollapsePanel/CollapsePanel.css +2 -4
  107. package/es/CollapsePanel/CollapsePanelItem.js +45 -46
  108. package/es/Countdown/Countdown.js +5 -12
  109. package/es/Dialog/FunctionalDialog.js +2 -2
  110. package/es/Divider/Divider.js +8 -5
  111. package/es/Drawer/Drawer.js +4 -10
  112. package/es/Fade/Fade.js +52 -56
  113. package/es/IconButton/IconButton.js +5 -12
  114. package/es/Image/Image.js +112 -119
  115. package/es/Input/Input.js +4 -10
  116. package/es/List/List.js +3 -8
  117. package/es/List/ListItem.js +42 -44
  118. package/es/List/ListItemContent.js +1 -4
  119. package/es/List/ListItemExtra.js +9 -4
  120. package/es/List/ListItemFooter.js +9 -4
  121. package/es/List/ListItemHeader.js +9 -4
  122. package/es/Loading/Loading.js +13 -4
  123. package/es/Modal/Modal.js +0 -6
  124. package/es/Modal/Modal.miniapp.d.ts +1 -1
  125. package/es/Modal/Modal.miniapp.js +4 -10
  126. package/es/NavBar/NavBar.js +0 -1
  127. package/es/Picker/Picker.css +0 -5
  128. package/es/Picker/Picker.js +5 -27
  129. package/es/Picker/Picker.types.d.ts +2 -15
  130. package/es/Picker/PickerPanel.css +0 -4
  131. package/es/Picker/PickerPanel.js +6 -7
  132. package/es/Popover/Popover.css +5 -5
  133. package/es/Popover/Popover.js +29 -73
  134. package/es/Portal/Portal.miniapp.js +5 -8
  135. package/es/Radio/Radio.css +0 -1
  136. package/es/Radio/Radio.js +2 -6
  137. package/es/Radio/RadioGroup.js +0 -3
  138. package/es/Rating/Rating.js +8 -18
  139. package/es/ScrollView/ScrollView.js +11 -24
  140. package/es/ScrollView/ScrollView.types.d.ts +1 -0
  141. package/es/Select/Select.css +4 -1
  142. package/es/Select/Select.js +42 -68
  143. package/es/Skeleton/Skeleton.js +5 -9
  144. package/es/Slide/Slide.js +69 -74
  145. package/es/Slider/Slider.js +12 -30
  146. package/es/Steps/Step.js +81 -82
  147. package/es/Steps/Steps.d.ts +1 -1
  148. package/es/Steps/Steps.js +57 -60
  149. package/es/Switch/Switch.js +75 -78
  150. package/es/TabBar/TabBar.js +3 -8
  151. package/es/Tabs/Tab.css +10 -16
  152. package/es/Tabs/Tab.js +2 -3
  153. package/es/Tabs/Tabs.css +13 -22
  154. package/es/Tabs/Tabs.js +41 -83
  155. package/es/Tabs/Tabs.types.d.ts +0 -10
  156. package/es/Tabs/utils/bound.d.ts +1 -0
  157. package/es/Tabs/utils/bound.js +13 -0
  158. package/es/Tag/Tag.css +1 -1
  159. package/es/Tag/Tag.js +2 -6
  160. package/es/TextArea/TextArea.js +5 -12
  161. package/es/Toast/FunctionalToast.js +2 -2
  162. package/es/Toast/Toast.css +1 -0
  163. package/es/Tooltip/Tooltip.css +5 -5
  164. package/es/Tooltip/Tooltip.js +29 -73
  165. package/es/Transition/TransitionCore.js +3 -8
  166. package/es/index.d.ts +0 -6
  167. package/es/index.js +0 -6
  168. package/es/locales/base.d.ts +0 -11
  169. package/es/locales/en-US.js +0 -24
  170. package/es/locales/zh-CN.js +0 -24
  171. package/es/locales/zh-TW.js +0 -24
  172. package/package.json +6 -6
  173. package/dist/Collapse/Collapse.miniapp.d.ts +0 -5
  174. package/dist/Collapse/Collapse.miniapp.js +0 -177
  175. package/dist/DatePicker/DatePicker.d.ts +0 -4
  176. package/dist/DatePicker/DatePicker.js +0 -335
  177. package/dist/DatePicker/DatePicker.types.d.ts +0 -36
  178. package/dist/DatePicker/DatePicker.types.js +0 -15
  179. package/dist/DatePicker/constants.d.ts +0 -9
  180. package/dist/DatePicker/constants.js +0 -37
  181. package/dist/DatePicker/index.d.ts +0 -3
  182. package/dist/DatePicker/index.js +0 -44
  183. package/dist/DesktopDatePicker/DesktopDatePicker.d.ts +0 -5
  184. package/dist/DesktopDatePicker/DesktopDatePicker.js +0 -280
  185. package/dist/DesktopDatePicker/DesktopDatePicker.types.d.ts +0 -163
  186. package/dist/DesktopDatePicker/DesktopDatePicker.types.js +0 -15
  187. package/dist/DesktopDatePicker/deskTopPickerContainer.css +0 -100
  188. package/dist/DesktopDatePicker/index.css +0 -61
  189. package/dist/DesktopDatePicker/index.d.ts +0 -2
  190. package/dist/DesktopDatePicker/index.js +0 -41
  191. package/dist/DesktopDatePicker/useGetDatePickerContent.d.ts +0 -6
  192. package/dist/DesktopDatePicker/useGetDatePickerContent.js +0 -343
  193. package/dist/DesktopDateTimePicker/DesktopDateTimePicker.d.ts +0 -5
  194. package/dist/DesktopDateTimePicker/DesktopDateTimePicker.js +0 -322
  195. package/dist/DesktopDateTimePicker/DesktopDateTimePicker.types.d.ts +0 -163
  196. package/dist/DesktopDateTimePicker/DesktopDateTimePicker.types.js +0 -15
  197. package/dist/DesktopDateTimePicker/index.css +0 -66
  198. package/dist/DesktopDateTimePicker/index.d.ts +0 -2
  199. package/dist/DesktopDateTimePicker/index.js +0 -41
  200. package/dist/DesktopPicker/DesktopPicker.d.ts +0 -5
  201. package/dist/DesktopPicker/DesktopPicker.js +0 -238
  202. package/dist/DesktopPicker/DesktopPicker.types.d.ts +0 -57
  203. package/dist/DesktopPicker/DesktopPicker.types.js +0 -15
  204. package/dist/DesktopPicker/index.css +0 -37
  205. package/dist/DesktopPicker/index.d.ts +0 -2
  206. package/dist/DesktopPicker/index.js +0 -41
  207. package/dist/DesktopPicker/utils/calcAfterMounted.d.ts +0 -2
  208. package/dist/DesktopPicker/utils/calcAfterMounted.miniapp.d.ts +0 -2
  209. package/dist/DesktopPicker/utils/calcAfterMounted.miniapp.js +0 -38
  210. package/dist/DesktopTimePicker/DesktopTimePicker.d.ts +0 -5
  211. package/dist/DesktopTimePicker/DesktopTimePicker.js +0 -288
  212. package/dist/DesktopTimePicker/DesktopTimePicker.types.d.ts +0 -182
  213. package/dist/DesktopTimePicker/DesktopTimePicker.types.js +0 -15
  214. package/dist/DesktopTimePicker/DesktopTimePickerList.d.ts +0 -4
  215. package/dist/DesktopTimePicker/DesktopTimePickerList.js +0 -111
  216. package/dist/DesktopTimePicker/index.css +0 -170
  217. package/dist/DesktopTimePicker/index.d.ts +0 -2
  218. package/dist/DesktopTimePicker/index.js +0 -41
  219. package/dist/DesktopTimePicker/useGetTimePickerContent.d.ts +0 -6
  220. package/dist/DesktopTimePicker/useGetTimePickerContent.js +0 -249
  221. package/dist/DesktopTimePicker/utils/scrollUtil.d.ts +0 -2
  222. package/dist/DesktopTimePicker/utils/scrollUtil.js +0 -27
  223. package/dist/DesktopTimePicker/utils/scrollUtil.miniapp.d.ts +0 -2
  224. package/dist/DesktopTimePicker/utils/scrollUtil.miniapp.js +0 -51
  225. package/dist/DesktopTimePicker/utils/utils.d.ts +0 -28
  226. package/dist/DesktopTimePicker/utils/utils.js +0 -408
  227. package/dist/SwipeAction/SwipeAction.css +0 -79
  228. package/dist/SwipeAction/SwipeAction.d.ts +0 -5
  229. package/dist/SwipeAction/SwipeAction.js +0 -349
  230. package/dist/SwipeAction/SwipeAction.types.d.ts +0 -75
  231. package/dist/SwipeAction/SwipeAction.types.js +0 -15
  232. package/dist/SwipeAction/SwipeActionContext.d.ts +0 -4
  233. package/dist/SwipeAction/SwipeActionContext.js +0 -30
  234. package/dist/SwipeAction/SwipeActionItem.css +0 -31
  235. package/dist/SwipeAction/SwipeActionItem.d.ts +0 -5
  236. package/dist/SwipeAction/SwipeActionItem.js +0 -105
  237. package/dist/SwipeAction/constants.d.ts +0 -9
  238. package/dist/SwipeAction/constants.js +0 -39
  239. package/dist/SwipeAction/index.d.ts +0 -5
  240. package/dist/SwipeAction/index.js +0 -50
  241. package/dist/Tabs/utils/scroll.d.ts +0 -2
  242. package/dist/Tabs/utils/scroll.js +0 -55
  243. package/es/Collapse/Collapse.miniapp.d.ts +0 -5
  244. package/es/Collapse/Collapse.miniapp.js +0 -157
  245. package/es/DatePicker/DatePicker.d.ts +0 -4
  246. package/es/DatePicker/DatePicker.js +0 -308
  247. package/es/DatePicker/DatePicker.types.d.ts +0 -36
  248. package/es/DatePicker/DatePicker.types.js +0 -1
  249. package/es/DatePicker/constants.d.ts +0 -9
  250. package/es/DatePicker/constants.js +0 -14
  251. package/es/DatePicker/index.d.ts +0 -3
  252. package/es/DatePicker/index.js +0 -8
  253. package/es/DesktopDatePicker/DesktopDatePicker.d.ts +0 -5
  254. package/es/DesktopDatePicker/DesktopDatePicker.js +0 -253
  255. package/es/DesktopDatePicker/DesktopDatePicker.types.d.ts +0 -163
  256. package/es/DesktopDatePicker/DesktopDatePicker.types.js +0 -1
  257. package/es/DesktopDatePicker/deskTopPickerContainer.css +0 -100
  258. package/es/DesktopDatePicker/index.css +0 -61
  259. package/es/DesktopDatePicker/index.d.ts +0 -2
  260. package/es/DesktopDatePicker/index.js +0 -6
  261. package/es/DesktopDatePicker/useGetDatePickerContent.d.ts +0 -6
  262. package/es/DesktopDatePicker/useGetDatePickerContent.js +0 -316
  263. package/es/DesktopDateTimePicker/DesktopDateTimePicker.d.ts +0 -5
  264. package/es/DesktopDateTimePicker/DesktopDateTimePicker.js +0 -295
  265. package/es/DesktopDateTimePicker/DesktopDateTimePicker.types.d.ts +0 -163
  266. package/es/DesktopDateTimePicker/DesktopDateTimePicker.types.js +0 -1
  267. package/es/DesktopDateTimePicker/index.css +0 -66
  268. package/es/DesktopDateTimePicker/index.d.ts +0 -2
  269. package/es/DesktopDateTimePicker/index.js +0 -9
  270. package/es/DesktopPicker/DesktopPicker.d.ts +0 -5
  271. package/es/DesktopPicker/DesktopPicker.js +0 -221
  272. package/es/DesktopPicker/DesktopPicker.types.d.ts +0 -57
  273. package/es/DesktopPicker/DesktopPicker.types.js +0 -1
  274. package/es/DesktopPicker/index.css +0 -37
  275. package/es/DesktopPicker/index.d.ts +0 -2
  276. package/es/DesktopPicker/index.js +0 -6
  277. package/es/DesktopPicker/utils/calcAfterMounted.d.ts +0 -2
  278. package/es/DesktopPicker/utils/calcAfterMounted.js +0 -6
  279. package/es/DesktopPicker/utils/calcAfterMounted.miniapp.d.ts +0 -2
  280. package/es/DesktopPicker/utils/calcAfterMounted.miniapp.js +0 -9
  281. package/es/DesktopTimePicker/DesktopTimePicker.d.ts +0 -5
  282. package/es/DesktopTimePicker/DesktopTimePicker.js +0 -261
  283. package/es/DesktopTimePicker/DesktopTimePicker.types.d.ts +0 -182
  284. package/es/DesktopTimePicker/DesktopTimePicker.types.js +0 -1
  285. package/es/DesktopTimePicker/DesktopTimePickerList.d.ts +0 -4
  286. package/es/DesktopTimePicker/DesktopTimePickerList.js +0 -84
  287. package/es/DesktopTimePicker/index.css +0 -170
  288. package/es/DesktopTimePicker/index.d.ts +0 -2
  289. package/es/DesktopTimePicker/index.js +0 -6
  290. package/es/DesktopTimePicker/useGetTimePickerContent.d.ts +0 -6
  291. package/es/DesktopTimePicker/useGetTimePickerContent.js +0 -226
  292. package/es/DesktopTimePicker/utils/scrollUtil.d.ts +0 -2
  293. package/es/DesktopTimePicker/utils/scrollUtil.js +0 -8
  294. package/es/DesktopTimePicker/utils/scrollUtil.miniapp.d.ts +0 -2
  295. package/es/DesktopTimePicker/utils/scrollUtil.miniapp.js +0 -22
  296. package/es/DesktopTimePicker/utils/utils.d.ts +0 -28
  297. package/es/DesktopTimePicker/utils/utils.js +0 -365
  298. package/es/SwipeAction/SwipeAction.css +0 -79
  299. package/es/SwipeAction/SwipeAction.d.ts +0 -5
  300. package/es/SwipeAction/SwipeAction.js +0 -334
  301. package/es/SwipeAction/SwipeAction.types.d.ts +0 -75
  302. package/es/SwipeAction/SwipeAction.types.js +0 -1
  303. package/es/SwipeAction/SwipeActionContext.d.ts +0 -4
  304. package/es/SwipeAction/SwipeActionContext.js +0 -11
  305. package/es/SwipeAction/SwipeActionItem.css +0 -31
  306. package/es/SwipeAction/SwipeActionItem.d.ts +0 -5
  307. package/es/SwipeAction/SwipeActionItem.js +0 -78
  308. package/es/SwipeAction/constants.d.ts +0 -9
  309. package/es/SwipeAction/constants.js +0 -15
  310. package/es/SwipeAction/index.d.ts +0 -5
  311. package/es/SwipeAction/index.js +0 -12
  312. package/es/Tabs/utils/scroll.d.ts +0 -2
  313. package/es/Tabs/utils/scroll.js +0 -36
@@ -1,79 +0,0 @@
1
- :root,
2
- page,
3
- xhs-page {
4
- --bui-swipe-action-container-padding: 10px;
5
- --bui-swipe-action-container-color: var(--bui-color-black);
6
- }
7
- .bui-swipe-action {
8
- background: var(--bui-color-bg-view);
9
- font-family: var(--bui-font-family);
10
- overflow: hidden;
11
- touch-action: pan-x;
12
- }
13
- .bui-swipe-action-track {
14
- position: relative;
15
- transition: transform 200ms ease;
16
- }
17
- .bui-swipe-action-actions {
18
- position: absolute;
19
- top: 0;
20
- display: flex;
21
- width: auto;
22
- white-space: nowrap;
23
- }
24
- .bui-swipe-action-actions-right {
25
- left: 100%;
26
- height: 100%;
27
- cursor: pointer;
28
- margin-left: 1px;
29
- user-select: none;
30
- display: flex;
31
- align-items: center;
32
- box-sizing: content-box;
33
- }
34
- .bui-swipe-action-actions-left {
35
- margin-right: 1px;
36
- right: 100%;
37
- height: 100%;
38
- cursor: pointer;
39
- box-sizing: content-box;
40
- user-select: none;
41
- display: flex;
42
- align-items: center;
43
- }
44
- .bui-swipe-action-button {
45
- padding: 0 15px;
46
- display: flex;
47
- align-items: center;
48
- justify-content: center;
49
- height: 100%;
50
- width: 100%;
51
- color: #fff;
52
- box-sizing: content-box;
53
- white-space: nowrap;
54
- }
55
- .bui-swipe-action-content-container {
56
- overflow: hidden;
57
- position: relative;
58
- cursor: grab;
59
- user-select: none;
60
- padding: var(--bui-swipe-action-container-padding);
61
- color: var(--bui-swipe-action-container-color);
62
- }
63
- .bui-swipe-action-content-container:active {
64
- cursor: grabbing;
65
- }
66
- .bui-swipe-action-content-mask {
67
- position: absolute;
68
- left: 0;
69
- top: 0;
70
- width: 100%;
71
- height: 100%;
72
- }
73
- .bui-swipe-action-action {
74
- display: flex;
75
- align-items: center;
76
- justify-content: center;
77
- padding: 0 10px;
78
- height: 100%;
79
- }
@@ -1,5 +0,0 @@
1
- import React from 'react';
2
- import { SwipeActionProps, SwipeActionRef } from './SwipeAction.types';
3
- import './SwipeAction.less';
4
- declare const SwipeAction: React.ForwardRefExoticComponent<Omit<SwipeActionProps<"div", {}>, "ref"> & React.RefAttributes<SwipeActionRef>>;
5
- export default SwipeAction;
@@ -1,334 +0,0 @@
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 React, {
50
- useImperativeHandle,
51
- useRef,
52
- useState,
53
- useEffect,
54
- useMemo
55
- } from "react";
56
- import clsx from "clsx";
57
- import {
58
- useTouch,
59
- touchEmulator,
60
- isMini,
61
- getBoundingClientRect,
62
- throttle
63
- } from "@bifrostui/utils";
64
- import BuiSwipeActionContext from "./SwipeActionContext";
65
- import { DragPhaseEnum, SideTypeEnum } from "./constants";
66
- import "./SwipeAction.css";
67
- const classPrefix = "bui-swipe-action";
68
- const SwipeAction = /* @__PURE__ */ React.forwardRef(
69
- (props, ref) => {
70
- const _a = props, {
71
- className,
72
- children,
73
- rightActions,
74
- leftActions,
75
- disabled,
76
- closeOnClickActionItem = true,
77
- closeOnClickContainer = false,
78
- onActionsReveal
79
- } = _a, others = __objRest(_a, [
80
- "className",
81
- "children",
82
- "rightActions",
83
- "leftActions",
84
- "disabled",
85
- "closeOnClickActionItem",
86
- "closeOnClickContainer",
87
- "onActionsReveal"
88
- ]);
89
- const touch = useTouch();
90
- const rootRef = useRef(null);
91
- const leftRef = useRef(null);
92
- const rightRef = useRef(null);
93
- const contentRef = useRef(null);
94
- const [translateX, setTranslateX] = useState(0);
95
- const [isOpen, setIsOpen] = useState(false);
96
- const startingX = useRef(0);
97
- const currentX = useRef(0);
98
- const isDragging = useRef(false);
99
- let pretranslateX = 0;
100
- let dragPhase = DragPhaseEnum.START;
101
- const dragThreshold = 5;
102
- const leftWidthCache = useRef(0);
103
- const rightWidthCache = useRef(0);
104
- const getWidth = (_ref) => {
105
- if (!_ref.current)
106
- return Promise.resolve(0);
107
- return new Promise((resolve) => {
108
- if (isMini) {
109
- getBoundingClientRect(_ref.current).then((rect) => {
110
- if (rect) {
111
- resolve(rect.width || 0);
112
- }
113
- });
114
- } else {
115
- resolve(_ref.current.offsetWidth);
116
- }
117
- });
118
- };
119
- const getLefRefWidth = () => __async(void 0, null, function* () {
120
- if (leftRef.current && leftActions && !leftWidthCache.current) {
121
- leftWidthCache.current = yield getWidth(leftRef);
122
- }
123
- return leftWidthCache.current;
124
- });
125
- const getRightRefWidth = () => __async(void 0, null, function* () {
126
- if (rightRef.current && rightActions && !rightWidthCache.current) {
127
- rightWidthCache.current = yield getWidth(rightRef);
128
- }
129
- return rightWidthCache.current;
130
- });
131
- const initRefWidth = () => {
132
- getLefRefWidth();
133
- getRightRefWidth();
134
- };
135
- const handleTouchStart = (e) => {
136
- dragPhase = DragPhaseEnum.START;
137
- const isMaskEle = e.target.id === "content-mask";
138
- if (isDragging.current || disabled || isMaskEle)
139
- return;
140
- touch.start(e);
141
- isDragging.current = true;
142
- startingX.current = touch.deltaX.current - translateX;
143
- };
144
- const handleTouchMove = throttle(
145
- (e) => __async(void 0, null, function* () {
146
- if (!isDragging.current || disabled)
147
- return;
148
- if (dragPhase === DragPhaseEnum.START) {
149
- dragPhase = DragPhaseEnum.MOVE;
150
- }
151
- touch.move(e);
152
- currentX.current = touch.deltaX.current - startingX.current;
153
- if (Math.abs(currentX.current) < dragThreshold)
154
- return;
155
- const leftWidth = yield getLefRefWidth();
156
- const rightWidth = yield getRightRefWidth();
157
- currentX.current = Math.max(
158
- -rightWidth,
159
- Math.min(leftWidth, currentX.current)
160
- );
161
- setTranslateX(currentX.current);
162
- }),
163
- 100
164
- );
165
- const emitActionsReveal = (targetX, stop = false) => {
166
- const isSpecial = targetX === pretranslateX && targetX !== 0;
167
- if (targetX === pretranslateX && !isSpecial || stop)
168
- return;
169
- let resStr = null;
170
- const shouldOpen = targetX > 0 && pretranslateX <= 0 || targetX < 0 && pretranslateX >= 0 || isSpecial;
171
- if (shouldOpen) {
172
- if (targetX > 0) {
173
- resStr = SideTypeEnum.LEFT;
174
- } else if (targetX < 0) {
175
- resStr = SideTypeEnum.RIGHT;
176
- }
177
- setIsOpen(true);
178
- } else {
179
- setIsOpen(false);
180
- }
181
- if (resStr) {
182
- onActionsReveal == null ? void 0 : onActionsReveal({ side: resStr });
183
- }
184
- };
185
- const handleTouchEnd = (e) => __async(void 0, null, function* () {
186
- if (!isDragging.current)
187
- return;
188
- if (dragPhase === DragPhaseEnum.MOVE) {
189
- dragPhase = DragPhaseEnum.END;
190
- }
191
- const leftWidth = yield getLefRefWidth();
192
- const rightWidth = yield getRightRefWidth();
193
- const threshold = 0.5;
194
- let targetX = 0;
195
- isDragging.current = false;
196
- if (Math.abs(currentX.current) < dragThreshold)
197
- return;
198
- if (currentX.current > leftWidth * threshold) {
199
- targetX = leftWidth;
200
- } else if (currentX.current < -rightWidth * threshold) {
201
- targetX = -rightWidth;
202
- }
203
- if (dragPhase === DragPhaseEnum.END || isMini) {
204
- emitActionsReveal(targetX);
205
- console.log("handleTouchEnd\uFF1A", targetX, e);
206
- setTranslateX(targetX);
207
- pretranslateX = targetX;
208
- }
209
- currentX.current = 0;
210
- });
211
- const close = () => {
212
- setTranslateX(0);
213
- pretranslateX = 0;
214
- setIsOpen(false);
215
- };
216
- useEffect(() => {
217
- initRefWidth();
218
- if (!contentRef.current)
219
- return;
220
- const removeTouchEmulator = touchEmulator(contentRef.current);
221
- return () => {
222
- removeTouchEmulator();
223
- };
224
- }, []);
225
- useEffect(() => {
226
- var _a2, _b, _c, _d;
227
- (_a2 = contentRef == null ? void 0 : contentRef.current) == null ? void 0 : _a2.addEventListener("touchstart", handleTouchStart);
228
- (_b = contentRef == null ? void 0 : contentRef.current) == null ? void 0 : _b.addEventListener("touchmove", handleTouchMove);
229
- (_c = contentRef == null ? void 0 : contentRef.current) == null ? void 0 : _c.addEventListener("touchend", handleTouchEnd);
230
- (_d = contentRef == null ? void 0 : contentRef.current) == null ? void 0 : _d.addEventListener("touchcancel", handleTouchEnd);
231
- if (!isMini && document) {
232
- document.addEventListener("mouseup", handleTouchEnd);
233
- }
234
- return () => {
235
- var _a3, _b2, _c2, _d2;
236
- (_a3 = contentRef == null ? void 0 : contentRef.current) == null ? void 0 : _a3.removeEventListener(
237
- "touchstart",
238
- handleTouchStart
239
- );
240
- (_b2 = contentRef == null ? void 0 : contentRef.current) == null ? void 0 : _b2.removeEventListener("touchmove", handleTouchMove);
241
- (_c2 = contentRef == null ? void 0 : contentRef.current) == null ? void 0 : _c2.removeEventListener("touchend", handleTouchEnd);
242
- (_d2 = contentRef == null ? void 0 : contentRef.current) == null ? void 0 : _d2.removeEventListener("touchcancel", handleTouchEnd);
243
- if (!isMini && document) {
244
- document.removeEventListener("mouseup", handleTouchEnd);
245
- }
246
- };
247
- }, []);
248
- useImperativeHandle(ref, () => ({
249
- show: (params) => __async(void 0, null, function* () {
250
- let targetX = 0;
251
- if (params && params.side === SideTypeEnum.RIGHT) {
252
- targetX = -(yield getRightRefWidth());
253
- } else {
254
- targetX = yield getLefRefWidth();
255
- }
256
- setTranslateX(targetX);
257
- pretranslateX = targetX;
258
- emitActionsReveal(targetX);
259
- }),
260
- close,
261
- // 获取当前是否打开
262
- open: isOpen,
263
- ref: rootRef.current
264
- }));
265
- const outClickHandle = (e) => {
266
- e.preventDefault();
267
- e.stopPropagation();
268
- if (translateX !== 0 && closeOnClickContainer) {
269
- close();
270
- }
271
- };
272
- const SwipeActionContext = useMemo(
273
- () => ({ closeOnClickActionItem, close }),
274
- [closeOnClickActionItem]
275
- );
276
- return /* @__PURE__ */ React.createElement(BuiSwipeActionContext.Provider, { value: SwipeActionContext }, /* @__PURE__ */ React.createElement(
277
- "div",
278
- __spreadValues({
279
- className: clsx(`${classPrefix}`, className),
280
- ref: rootRef
281
- }, others),
282
- /* @__PURE__ */ React.createElement(
283
- "div",
284
- {
285
- className: `${classPrefix}-track`,
286
- style: {
287
- transform: `translate3d(${translateX}px, 0, 0)`
288
- }
289
- },
290
- /* @__PURE__ */ React.createElement(
291
- "div",
292
- {
293
- className: `${classPrefix}-actions ${classPrefix}-actions-left`,
294
- ref: leftRef
295
- },
296
- leftActions
297
- ),
298
- /* @__PURE__ */ React.createElement(
299
- "div",
300
- {
301
- className: `${classPrefix}-content-container`,
302
- ref: contentRef,
303
- onTouchStart: handleTouchStart,
304
- onTouchMove: handleTouchMove,
305
- onTouchEnd: handleTouchEnd,
306
- onTouchCancel: handleTouchEnd
307
- },
308
- isOpen && closeOnClickContainer && /* @__PURE__ */ React.createElement(
309
- "div",
310
- {
311
- className: `${classPrefix}-content-mask`,
312
- id: "content-mask",
313
- onClick: outClickHandle
314
- }
315
- ),
316
- children
317
- ),
318
- /* @__PURE__ */ React.createElement(
319
- "div",
320
- {
321
- className: `${classPrefix}-actions ${classPrefix}-actions-right`,
322
- ref: rightRef
323
- },
324
- rightActions
325
- )
326
- )
327
- ));
328
- }
329
- );
330
- SwipeAction.displayName = "BuiSwipeAction";
331
- var SwipeAction_default = SwipeAction;
332
- export {
333
- SwipeAction_default as default
334
- };
@@ -1,75 +0,0 @@
1
- import { OverrideProps, ThemeColor } from '@bifrostui/types';
2
- import React from 'react';
3
- import { SideTypeEnum } from './constants';
4
- export type SwipeActionProps<D extends React.ElementType = 'div', P = {}> = OverrideProps<{
5
- props: P & {
6
- /**
7
- * 右侧的操作按钮列表区域
8
- */
9
- rightActions?: React.ReactNode;
10
- /**
11
- * 左侧的操作按钮列表区域
12
- */
13
- leftActions?: React.ReactNode;
14
- /**
15
- * 是否在点击按钮区自动归位
16
- */
17
- closeOnClickActionItem?: boolean;
18
- /**
19
- * 是否在点击其他区域时自动归位
20
- */
21
- closeOnClickContainer?: boolean;
22
- /**
23
- * 操作按钮展开时触发
24
- */
25
- onActionsReveal?: (params: RevealParams) => void;
26
- /**
27
- * 是否禁用拖动
28
- */
29
- disabled?: boolean;
30
- };
31
- defaultComponent: D;
32
- }, D>;
33
- interface RevealParams {
34
- side: SideTypeEnum | '';
35
- }
36
- export type SwipeActionItemProps<D extends React.ElementType = 'div', P = {}> = OverrideProps<{
37
- props: P & {
38
- /**
39
- * 颜色风格
40
- */
41
- color?: ThemeColor | 'vip';
42
- /**
43
- * id
44
- */
45
- id?: string | number;
46
- /**
47
- * 点击事件
48
- */
49
- onClick?: (e: React.SyntheticEvent, item: {
50
- id: string | number;
51
- color: ThemeColor | 'vip';
52
- text: React.ReactNode;
53
- }) => void;
54
- };
55
- defaultComponent: D;
56
- }, D>;
57
- export interface BuiSwipeActionContextProps {
58
- /**
59
- * 是否在点击操作按钮时自动归位
60
- */
61
- closeOnClickActionItem?: boolean;
62
- /**
63
- * 关闭函数
64
- */
65
- close: () => void;
66
- }
67
- export type SwipeActionRef = {
68
- close: () => void;
69
- show: (params?: {
70
- side: SideTypeEnum;
71
- }) => void;
72
- open: boolean;
73
- ref?: HTMLDivElement;
74
- };
75
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,4 +0,0 @@
1
- /// <reference types="react" />
2
- import { BuiSwipeActionContextProps } from './SwipeAction.types';
3
- declare const BuiSwipeActionContext: import("react").Context<BuiSwipeActionContextProps>;
4
- export default BuiSwipeActionContext;
@@ -1,11 +0,0 @@
1
- import { createContext } from "react";
2
- const BuiSwipeActionContext = createContext({
3
- closeOnClickActionItem: true,
4
- // eslint-disable-next-line @typescript-eslint/no-empty-function
5
- close: () => {
6
- }
7
- });
8
- var SwipeActionContext_default = BuiSwipeActionContext;
9
- export {
10
- SwipeActionContext_default as default
11
- };
@@ -1,31 +0,0 @@
1
- .bui-swipe-action-item {
2
- padding: 0 15px;
3
- display: flex;
4
- align-items: center;
5
- justify-content: center;
6
- height: 100%;
7
- width: 100%;
8
- background: var(--background-button-color);
9
- color: #fff;
10
- box-sizing: content-box;
11
- white-space: nowrap;
12
- font-family: var(--bui-font-family);
13
- }
14
- .bui-swipe-action-item-primary {
15
- background-color: var(--bui-color-primary);
16
- }
17
- .bui-swipe-action-item-vip {
18
- background-color: var(--bui-color-vip);
19
- }
20
- .bui-swipe-action-item-success {
21
- background-color: var(--bui-color-success);
22
- }
23
- .bui-swipe-action-item-info {
24
- background-color: var(--bui-color-info);
25
- }
26
- .bui-swipe-action-item-warning {
27
- background-color: var(--bui-color-warning);
28
- }
29
- .bui-swipe-action-item-danger {
30
- background-color: var(--bui-color-danger);
31
- }
@@ -1,5 +0,0 @@
1
- import React from 'react';
2
- import { SwipeActionItemProps } from './SwipeAction.types';
3
- import './SwipeActionItem.less';
4
- declare const SwipeActionItem: React.ForwardRefExoticComponent<Omit<SwipeActionItemProps<"div", {}>, "ref"> & React.RefAttributes<HTMLDivElement>>;
5
- export default SwipeActionItem;
@@ -1,78 +0,0 @@
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
- import React, { useContext } from "react";
30
- import clsx from "clsx";
31
- import BuiSwipeActionContext from "./SwipeActionContext";
32
- import "./SwipeActionItem.css";
33
- const prefixCls = "bui-swipe-action-item";
34
- const SwipeActionItem = /* @__PURE__ */ React.forwardRef(
35
- (props, ref) => {
36
- const _a = props, {
37
- className,
38
- children,
39
- onClick,
40
- color = "primary",
41
- id = ""
42
- } = _a, others = __objRest(_a, [
43
- "className",
44
- "children",
45
- "onClick",
46
- "color",
47
- "id"
48
- ]);
49
- const { closeOnClickActionItem, close } = useContext(BuiSwipeActionContext);
50
- const onClickHandle = (e) => {
51
- e.stopPropagation();
52
- if (closeOnClickActionItem) {
53
- close == null ? void 0 : close();
54
- }
55
- onClick == null ? void 0 : onClick(e, {
56
- color,
57
- id,
58
- text: children
59
- });
60
- };
61
- return /* @__PURE__ */ React.createElement(
62
- "div",
63
- __spreadValues({
64
- className: clsx(prefixCls, className, {
65
- [`${prefixCls}-${color}`]: color
66
- }),
67
- ref,
68
- onClick: onClickHandle
69
- }, others),
70
- children
71
- );
72
- }
73
- );
74
- SwipeActionItem.displayName = "SwipeActionItem";
75
- var SwipeActionItem_default = SwipeActionItem;
76
- export {
77
- SwipeActionItem_default as default
78
- };
@@ -1,9 +0,0 @@
1
- export declare enum SideTypeEnum {
2
- LEFT = "left",
3
- RIGHT = "right"
4
- }
5
- export declare enum DragPhaseEnum {
6
- START = 1,
7
- MOVE = 2,
8
- END = 3
9
- }
@@ -1,15 +0,0 @@
1
- var SideTypeEnum = /* @__PURE__ */ ((SideTypeEnum2) => {
2
- SideTypeEnum2["LEFT"] = "left";
3
- SideTypeEnum2["RIGHT"] = "right";
4
- return SideTypeEnum2;
5
- })(SideTypeEnum || {});
6
- var DragPhaseEnum = /* @__PURE__ */ ((DragPhaseEnum2) => {
7
- DragPhaseEnum2[DragPhaseEnum2["START"] = 1] = "START";
8
- DragPhaseEnum2[DragPhaseEnum2["MOVE"] = 2] = "MOVE";
9
- DragPhaseEnum2[DragPhaseEnum2["END"] = 3] = "END";
10
- return DragPhaseEnum2;
11
- })(DragPhaseEnum || {});
12
- export {
13
- DragPhaseEnum,
14
- SideTypeEnum
15
- };
@@ -1,5 +0,0 @@
1
- export * from './SwipeAction.types';
2
- export { default } from './SwipeAction';
3
- export { default as SwipeAction } from './SwipeAction';
4
- export { default as SwipeActionItem } from './SwipeActionItem';
5
- export { SideTypeEnum, DragPhaseEnum } from './constants';
@@ -1,12 +0,0 @@
1
- export * from "./SwipeAction.types";
2
- import { default as default2 } from "./SwipeAction";
3
- import { default as default3 } from "./SwipeAction";
4
- import { default as default4 } from "./SwipeActionItem";
5
- import { SideTypeEnum, DragPhaseEnum } from "./constants";
6
- export {
7
- DragPhaseEnum,
8
- SideTypeEnum,
9
- default3 as SwipeAction,
10
- default4 as SwipeActionItem,
11
- default2 as default
12
- };
@@ -1,2 +0,0 @@
1
- declare const scrollLeftTo: (scroller: HTMLElement, to: number, duration: number) => void;
2
- export default scrollLeftTo;