@bifrostui/react 1.4.7-beta.0 → 2.0.0-beta.0

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