@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
@@ -26,35 +26,14 @@ var __objRest = (source, exclude) => {
26
26
  }
27
27
  return target;
28
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
29
  import clsx from "clsx";
50
30
  import React, { useState, useRef, useEffect } from "react";
51
31
  import {
52
32
  getStylesAndLocation,
53
33
  triggerEventTransform,
54
34
  parsePlacement,
55
- throttle,
56
- useForkRef,
57
- isMini
35
+ useUniqueId,
36
+ throttle
58
37
  } from "@bifrostui/utils";
59
38
  import Portal from "../Portal";
60
39
  import "./Popover.css";
@@ -70,9 +49,9 @@ const Popover = /* @__PURE__ */ React.forwardRef((props, ref) => {
70
49
  offsetSpacing = 0,
71
50
  placement = "top",
72
51
  trigger = "click",
52
+ onOpenChange,
73
53
  open,
74
- hideArrow,
75
- onOpenChange
54
+ hideArrow
76
55
  } = _a, others = __objRest(_a, [
77
56
  "className",
78
57
  "style",
@@ -83,9 +62,9 @@ const Popover = /* @__PURE__ */ React.forwardRef((props, ref) => {
83
62
  "offsetSpacing",
84
63
  "placement",
85
64
  "trigger",
65
+ "onOpenChange",
86
66
  "open",
87
- "hideArrow",
88
- "onOpenChange"
67
+ "hideArrow"
89
68
  ]);
90
69
  const controlByUser = typeof open !== "undefined";
91
70
  const { direction, location = "center" } = parsePlacement(placement);
@@ -93,18 +72,11 @@ const Popover = /* @__PURE__ */ React.forwardRef((props, ref) => {
93
72
  const [openStatus, setOpenStatus] = useState(defaultOpen);
94
73
  const [arrowDirection, setArrowDirection] = useState(direction);
95
74
  const [arrowLocation, setArrowLocation] = useState(location);
96
- const [toolStyles, setToolStyles] = useState({});
97
- const tipRef = useRef(null);
98
- const nodeRef = useForkRef(ref, tipRef);
99
- const clearRef = (status) => {
100
- if (status === false) {
101
- tipRef.current = null;
102
- }
103
- };
75
+ const [tooltyles, setTooltyles] = useState({});
76
+ const ttId = useUniqueId();
104
77
  const changeOpenStatus = (event, status) => {
105
78
  if (controlByUser)
106
79
  return;
107
- clearRef(status);
108
80
  setOpenStatus(status);
109
81
  onOpenChange == null ? void 0 : onOpenChange(event, { open: status });
110
82
  };
@@ -123,33 +95,23 @@ const Popover = /* @__PURE__ */ React.forwardRef((props, ref) => {
123
95
  if (!controlByUser)
124
96
  return;
125
97
  setOpenStatus(open);
126
- clearRef(open);
127
98
  }, [open]);
128
- useEffect(() => {
129
- if (!openStatus) {
130
- setToolStyles({
131
- visibility: "hidden"
132
- });
133
- }
134
- }, [openStatus]);
135
99
  const clickEventHandler = (event) => {
136
100
  if (trigger === "hover" || (trigger == null ? void 0 : trigger.length) === 1 && (trigger == null ? void 0 : trigger[0]) === "hover")
137
101
  return;
138
102
  hidePopover(event);
139
103
  };
140
- const onRootElementMouted = throttle(() => __async(void 0, null, function* () {
141
- if (!tipRef.current)
142
- return;
104
+ const onRootElementMouted = throttle(() => {
143
105
  const {
144
106
  direction: newParsedDirection,
145
107
  location: newParsedLocation = "center"
146
108
  } = parsePlacement(placement);
147
- const result = yield getStylesAndLocation({
109
+ const result = getStylesAndLocation({
148
110
  childrenRef,
149
111
  arrowDirection: newParsedDirection,
150
112
  arrowLocation: newParsedLocation,
151
113
  offsetSpacing,
152
- tipRef
114
+ selector: `[data-id="tt_${ttId}"]`
153
115
  });
154
116
  if (!result)
155
117
  return;
@@ -160,32 +122,26 @@ const Popover = /* @__PURE__ */ React.forwardRef((props, ref) => {
160
122
  if (newArrowLocation !== arrowLocation) {
161
123
  setArrowLocation(newArrowLocation);
162
124
  }
163
- setToolStyles(styles);
164
- }), 100);
125
+ setTooltyles(styles);
126
+ }, 100);
127
+ const bindEvent = () => {
128
+ if (!controlByUser) {
129
+ document.addEventListener("click", clickEventHandler);
130
+ }
131
+ window.addEventListener("resize", onRootElementMouted);
132
+ };
133
+ const unbindEvent = () => {
134
+ if (!controlByUser) {
135
+ document.removeEventListener("click", clickEventHandler);
136
+ }
137
+ window.removeEventListener("resize", onRootElementMouted);
138
+ };
165
139
  useEffect(() => {
166
- const bindEvent = () => {
167
- if (!tipRef.current)
168
- return;
169
- if (!controlByUser) {
170
- document.addEventListener("click", clickEventHandler);
171
- }
172
- if (!isMini) {
173
- window.addEventListener("resize", onRootElementMouted);
174
- }
175
- };
176
- const unbindEvent = () => {
177
- if (!controlByUser) {
178
- document.removeEventListener("click", clickEventHandler);
179
- }
180
- if (!isMini) {
181
- window.removeEventListener("resize", onRootElementMouted);
182
- }
183
- };
184
140
  bindEvent();
185
141
  return () => {
186
142
  unbindEvent();
187
143
  };
188
- }, [openStatus]);
144
+ }, []);
189
145
  if (!title && !content)
190
146
  return null;
191
147
  let triggerEventOption;
@@ -200,14 +156,14 @@ const Popover = /* @__PURE__ */ React.forwardRef((props, ref) => {
200
156
  const childrenOptions = __spreadValues({
201
157
  ref: childrenRef
202
158
  }, triggerEventOption);
203
- return /* @__PURE__ */ React.createElement(React.Fragment, null, open || openStatus ? /* @__PURE__ */ React.createElement(Portal, { onRootElementMouted }, /* @__PURE__ */ React.createElement(
159
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, open || openStatus ? /* @__PURE__ */ React.createElement(Portal, { onRootElementMouted, ref }, /* @__PURE__ */ React.createElement(
204
160
  "div",
205
161
  __spreadValues({
206
162
  className: clsx(prefixCls, className, `popover-${arrowDirection}`, {
207
163
  "bui-popover-arrow-hide": hideArrow
208
164
  }),
209
- style: __spreadValues(__spreadValues({}, style), toolStyles),
210
- ref: nodeRef
165
+ "data-id": `tt_${ttId}`,
166
+ style: __spreadValues(__spreadValues({}, style), tooltyles)
211
167
  }, others),
212
168
  !hideArrow ? /* @__PURE__ */ React.createElement(
213
169
  "div",
@@ -18,13 +18,11 @@ var __spreadValues = (a, b) => {
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
20
  import Taro from "@tarojs/taro";
21
- import React, { forwardRef, useEffect, useState } from "react";
21
+ import React, { forwardRef, useMemo } from "react";
22
22
  import PortalCore from "./PortalCore";
23
23
  const Portal = forwardRef((props, ref) => {
24
24
  const { disablePortal } = props;
25
- const [rootWrapperElement, setRootWrapperElement] = useState();
26
- useEffect(() => {
27
- let root;
25
+ const rootWrapperElement = useMemo(() => {
28
26
  if (!disablePortal) {
29
27
  const currentPages = Taro.getCurrentPages() || [];
30
28
  const currentPage = currentPages[currentPages.length - 1];
@@ -36,12 +34,11 @@ const Portal = forwardRef((props, ref) => {
36
34
  const view = document.createElement("view");
37
35
  view.id = portalId;
38
36
  rootElement == null ? void 0 : rootElement.appendChild(view);
39
- root = view;
40
- } else {
41
- root = portalWrapperElement;
37
+ return view;
42
38
  }
39
+ return portalWrapperElement;
43
40
  }
44
- setRootWrapperElement(root);
41
+ return void 0;
45
42
  }, []);
46
43
  return /* @__PURE__ */ React.createElement(PortalCore, __spreadProps(__spreadValues({}, props), { ref, rootElement: rootWrapperElement }));
47
44
  });
@@ -1,7 +1,6 @@
1
1
  .bui-radio {
2
2
  --label-color: var(--bui-radio-label-color, var(--bui-color-fg-default));
3
3
  --label-font-size: var(--bui-radio-label-font-size, var(--bui-text-size-1));
4
- --icon-font-size: var(--bui-radio-icon-font-size, var(--bui-title-size-2));
5
4
  --icon-padding: var(--bui-radio-icon-padding, 5px);
6
5
  display: inline-flex;
7
6
  align-items: center;
package/es/Radio/Radio.js CHANGED
@@ -39,7 +39,7 @@ const prefixCls = "bui-radio";
39
39
  const Radio = forwardRef((props, ref) => {
40
40
  const _a = props, {
41
41
  className,
42
- defaultChecked,
42
+ defaultChecked = false,
43
43
  checked,
44
44
  inputProps,
45
45
  inputRef,
@@ -48,7 +48,7 @@ const Radio = forwardRef((props, ref) => {
48
48
  disabled,
49
49
  icon,
50
50
  checkedIcon,
51
- labelPlacement,
51
+ labelPlacement = "right",
52
52
  onChange,
53
53
  children
54
54
  } = _a, others = __objRest(_a, [
@@ -147,10 +147,6 @@ const Radio = forwardRef((props, ref) => {
147
147
  );
148
148
  });
149
149
  Radio.displayName = "BuiRadio";
150
- Radio.defaultProps = {
151
- defaultChecked: false,
152
- labelPlacement: "right"
153
- };
154
150
  var Radio_default = Radio;
155
151
  export {
156
152
  Radio_default as default
@@ -70,9 +70,6 @@ const RadioGroup = forwardRef((props, ref) => {
70
70
  );
71
71
  });
72
72
  RadioGroup.displayName = "BuiRadioGroup";
73
- RadioGroup.defaultProps = {
74
- disabled: false
75
- };
76
73
  var RadioGroup_default = RadioGroup;
77
74
  export {
78
75
  RadioGroup_default as default
@@ -39,18 +39,18 @@ const classes = {
39
39
  const Rating = forwardRef((props, ref) => {
40
40
  const _a = props, {
41
41
  className,
42
- size,
42
+ size = "medium",
43
43
  defaultValue,
44
- allowHalf,
45
- icon,
46
- checkedIcon,
47
- count,
48
- readOnly,
49
- disabled,
44
+ allowHalf = false,
45
+ icon = /* @__PURE__ */ React.createElement(StarFilledIcon, { htmlColor: "#ced1d6" }),
46
+ checkedIcon = /* @__PURE__ */ React.createElement(StarFilledIcon, { color: "warning" }),
47
+ count = 5,
48
+ readOnly = false,
49
+ disabled = false,
50
50
  value,
51
51
  onChange,
52
52
  name,
53
- disableClear
53
+ disableClear = false
54
54
  } = _a, others = __objRest(_a, [
55
55
  "className",
56
56
  "size",
@@ -134,16 +134,6 @@ const Rating = forwardRef((props, ref) => {
134
134
  );
135
135
  });
136
136
  Rating.displayName = "BuiRating";
137
- Rating.defaultProps = {
138
- size: "medium",
139
- count: 5,
140
- icon: /* @__PURE__ */ React.createElement(StarFilledIcon, { htmlColor: "#ced1d6" }),
141
- checkedIcon: /* @__PURE__ */ React.createElement(StarFilledIcon, { color: "warning" }),
142
- readOnly: false,
143
- disabled: false,
144
- allowHalf: false,
145
- disableClear: false
146
- };
147
137
  var Rating_default = Rating;
148
138
  export {
149
139
  Rating_default as default
@@ -2,14 +2,12 @@ import { useForkRef } from "@bifrostui/utils";
2
2
  import clsx from "clsx";
3
3
  import React, { forwardRef, useCallback, useEffect, useRef } from "react";
4
4
  import "./ScrollView.css";
5
- function easeOutScroll(from, to, callback, dur) {
6
- if (dur <= 0) {
7
- dur = 500;
8
- }
5
+ function easeOutScroll(from, to, callback) {
9
6
  if (from === to || typeof from !== "number") {
10
7
  return;
11
8
  }
12
9
  const change = to - from;
10
+ const dur = 500;
13
11
  const sTime = +/* @__PURE__ */ new Date();
14
12
  function linear(t, b, c, d) {
15
13
  return c * t / d + b;
@@ -44,8 +42,7 @@ const ScrollView = forwardRef(
44
42
  scrollIntoView,
45
43
  onTouchMove: propsOnTouchMove,
46
44
  scrollIntoViewAlignment,
47
- children,
48
- scrollAnimationDuration = 500
45
+ children
49
46
  } = props;
50
47
  const container = useRef(null);
51
48
  const handleRef = useForkRef(ref, container);
@@ -55,15 +52,10 @@ const ScrollView = forwardRef(
55
52
  if (top === void 0)
56
53
  return;
57
54
  if (isAnimation) {
58
- easeOutScroll(
59
- container.current.scrollTop,
60
- top,
61
- (pos) => {
62
- if (container.current)
63
- container.current.scrollTop = pos;
64
- },
65
- scrollAnimationDuration
66
- );
55
+ easeOutScroll(container.current.scrollTop, top, (pos) => {
56
+ if (container.current)
57
+ container.current.scrollTop = pos;
58
+ });
67
59
  } else if (container.current)
68
60
  container.current.scrollTop = top;
69
61
  }, []);
@@ -71,15 +63,10 @@ const ScrollView = forwardRef(
71
63
  if (left === void 0)
72
64
  return;
73
65
  if (isAnimation) {
74
- easeOutScroll(
75
- container.current.scrollLeft,
76
- left,
77
- (pos) => {
78
- if (container.current)
79
- container.current.scrollLeft = pos;
80
- },
81
- scrollAnimationDuration
82
- );
66
+ easeOutScroll(container.current.scrollLeft, left, (pos) => {
67
+ if (container.current)
68
+ container.current.scrollLeft = pos;
69
+ });
83
70
  } else if (container.current)
84
71
  container.current.scrollLeft = left;
85
72
  }, []);
@@ -138,6 +138,7 @@ export type ScrollViewProps<D extends React.ElementType = 'div', P = {}> = Overr
138
138
  */
139
139
  fastDeceleration?: boolean;
140
140
  /** 当 scroll-with-animation设置为 true 时,可以设置 scroll-animation-duration 来控制动画的执行时间,单位 ms。
141
+ * 仅小程序可用
141
142
  */
142
143
  scrollAnimationDuration?: number;
143
144
  /** 纵向滚动时,当滚动到顶部或底部时,强制禁止触发页面滚动,仍然只触发 scroll-view 自身的滚动。
@@ -48,9 +48,13 @@
48
48
  .bui-select-option-container {
49
49
  position: absolute;
50
50
  box-sizing: border-box;
51
+ top: 100%;
52
+ left: 0;
53
+ width: 100%;
51
54
  font-size: var(--bui-select-font-size, var(--bui-title-size-3));
52
55
  z-index: var(--bui-z-index-tooltip);
53
56
  border-radius: 3px;
57
+ background-color: var(--bui-color-bg-view);
54
58
  padding: 2px;
55
59
  overflow: hidden;
56
60
  }
@@ -67,7 +71,6 @@
67
71
  border-radius: 3px;
68
72
  padding: var(--bui-select-option-container-padding, 3px 0);
69
73
  box-shadow: 0 0 0 2px var(--bui-color-bg-default);
70
- background-color: var(--bui-color-bg-view);
71
74
  overflow: hidden;
72
75
  }
73
76
  .bui-select-option {
@@ -29,32 +29,13 @@ var __objRest = (source, exclude) => {
29
29
  }
30
30
  return target;
31
31
  };
32
- var __async = (__this, __arguments, generator) => {
33
- return new Promise((resolve, reject) => {
34
- var fulfilled = (value) => {
35
- try {
36
- step(generator.next(value));
37
- } catch (e) {
38
- reject(e);
39
- }
40
- };
41
- var rejected = (value) => {
42
- try {
43
- step(generator.throw(value));
44
- } catch (e) {
45
- reject(e);
46
- }
47
- };
48
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
49
- step((generator = generator.apply(__this, __arguments)).next());
50
- });
51
- };
52
32
  import { CaretDownIcon, CaretUpIcon } from "@bifrostui/icons";
53
33
  import {
54
34
  getStylesAndLocation,
55
35
  isMini,
56
36
  throttle,
57
37
  useForkRef,
38
+ useUniqueId,
58
39
  useValue
59
40
  } from "@bifrostui/utils";
60
41
  import clsx from "clsx";
@@ -76,12 +57,14 @@ const Select = /* @__PURE__ */ React.forwardRef((props, ref) => {
76
57
  inputProps,
77
58
  BackdropProps,
78
59
  value,
79
- defaultValue,
60
+ defaultValue = "",
80
61
  disabled,
81
62
  placeholder,
82
63
  icon,
83
64
  open,
84
- scrollContainer,
65
+ scrollContainer = () => {
66
+ return isMini ? null : document.body;
67
+ },
85
68
  onChange,
86
69
  onClose,
87
70
  onOpen,
@@ -117,36 +100,38 @@ const Select = /* @__PURE__ */ React.forwardRef((props, ref) => {
117
100
  const isOpen = open !== void 0 ? open : internalOpen;
118
101
  const locatorRef = useRef(null);
119
102
  const rootRef = useForkRef(ref, locatorRef);
120
- const optionContainerRef = useRef(null);
121
- const optionMainRef = useRef(null);
122
- const updateOptionStyle = () => __async(void 0, null, function* () {
103
+ const ttId = useUniqueId();
104
+ const dataId = `${prefixCls}-tt-${ttId}`;
105
+ const updateOptionStyle = throttle(() => {
123
106
  const curScrollRoot = scrollContainer();
124
- const result = yield getStylesAndLocation({
125
- scrollRoot: curScrollRoot,
126
- childrenRef: locatorRef,
127
- tipRef: optionContainerRef,
128
- arrowDirection: defaultPlacement,
129
- arrowLocation: "none",
130
- offsetSpacing: 0
131
- });
132
- if (!result)
133
- return;
134
- const { styles, childrenStyle, newArrowDirection } = result;
135
- optionMainRef.current.style.transition = "none";
136
- optionMainRef.current.style.transform = `translateY(${newArrowDirection === "bottom" ? "-100%" : "100%"})`;
137
- setPlacement(newArrowDirection);
138
- setOptionStyle(__spreadProps(__spreadValues({}, styles), { width: childrenStyle == null ? void 0 : childrenStyle.width }));
139
- });
140
- const changeOpen = (newOpen) => __async(void 0, null, function* () {
107
+ if (!isMini && curScrollRoot) {
108
+ const result = getStylesAndLocation({
109
+ scrollRoot: curScrollRoot,
110
+ childrenRef: locatorRef,
111
+ arrowDirection: defaultPlacement,
112
+ arrowLocation: "none",
113
+ selector: `[data-id="${dataId}"]`,
114
+ offsetSpacing: 0
115
+ });
116
+ if (!result)
117
+ return;
118
+ const { styles, childrenStyle, newArrowDirection } = result;
119
+ setPlacement(newArrowDirection);
120
+ setOptionStyle(__spreadProps(__spreadValues({}, styles), { width: childrenStyle.width }));
121
+ }
122
+ }, 100);
123
+ const changeOpen = (newOpen) => {
141
124
  if (newOpen) {
142
- yield updateOptionStyle();
143
- setInternalOpen(newOpen);
144
- onOpen == null ? void 0 : onOpen();
125
+ updateOptionStyle();
126
+ setTimeout(() => {
127
+ setInternalOpen(newOpen);
128
+ onOpen == null ? void 0 : onOpen();
129
+ }, 100);
145
130
  } else {
146
131
  onClose == null ? void 0 : onClose();
147
132
  setInternalOpen(newOpen);
148
133
  }
149
- });
134
+ };
150
135
  const handleSelectClick = (e) => {
151
136
  if (disabled)
152
137
  return;
@@ -171,11 +156,10 @@ const Select = /* @__PURE__ */ React.forwardRef((props, ref) => {
171
156
  [selectValue, onChange, setRenderValue]
172
157
  );
173
158
  useEffect(() => {
174
- const resizeCb = throttle(updateOptionStyle, 100);
175
159
  if (!isMini) {
176
- window.addEventListener("resize", resizeCb);
160
+ window.addEventListener("resize", updateOptionStyle);
177
161
  return () => {
178
- window.removeEventListener("resize", resizeCb);
162
+ window.removeEventListener("resize", updateOptionStyle);
179
163
  };
180
164
  }
181
165
  }, []);
@@ -193,8 +177,8 @@ const Select = /* @__PURE__ */ React.forwardRef((props, ref) => {
193
177
  {
194
178
  in: isOpen,
195
179
  timeout: {
196
- enter: 167,
197
- exit: 167
180
+ enter: 150,
181
+ exit: 150
198
182
  }
199
183
  },
200
184
  /* @__PURE__ */ React.createElement(
@@ -208,7 +192,7 @@ const Select = /* @__PURE__ */ React.forwardRef((props, ref) => {
208
192
  [`${prefixCls}-option-container-hide`]: !isOpen
209
193
  }
210
194
  ),
211
- ref: optionContainerRef,
195
+ "data-id": dataId,
212
196
  style: optionStyle
213
197
  },
214
198
  /* @__PURE__ */ React.createElement(
@@ -217,18 +201,11 @@ const Select = /* @__PURE__ */ React.forwardRef((props, ref) => {
217
201
  in: isOpen,
218
202
  direction: placement === "bottom" ? "down" : "up",
219
203
  timeout: {
220
- enter: 167,
221
- exit: 167
204
+ enter: 150,
205
+ exit: 150
222
206
  }
223
207
  },
224
- /* @__PURE__ */ React.createElement(
225
- "div",
226
- {
227
- className: clsx(`${prefixCls}-option-main`),
228
- ref: optionMainRef
229
- },
230
- children
231
- )
208
+ /* @__PURE__ */ React.createElement("div", { className: clsx(`${prefixCls}-option-main`) }, children)
232
209
  )
233
210
  )
234
211
  );
@@ -256,8 +233,9 @@ const Select = /* @__PURE__ */ React.forwardRef((props, ref) => {
256
233
  [inputProps == null ? void 0 : inputProps.className]: inputProps == null ? void 0 : inputProps.className
257
234
  })
258
235
  })
259
- ), icon || defaultIcon)
260
- ), /* @__PURE__ */ React.createElement(Portal, { onRootElementMouted: updateOptionStyle }, renderOptions()), /* @__PURE__ */ React.createElement(
236
+ ), icon || defaultIcon),
237
+ isMini && renderOptions()
238
+ ), !isMini && /* @__PURE__ */ React.createElement(Portal, { onRootElementMouted: updateOptionStyle }, renderOptions()), /* @__PURE__ */ React.createElement(
261
239
  Backdrop,
262
240
  __spreadProps(__spreadValues({
263
241
  open: isOpen,
@@ -272,10 +250,6 @@ const Select = /* @__PURE__ */ React.forwardRef((props, ref) => {
272
250
  ));
273
251
  });
274
252
  Select.displayName = "BuiSelect";
275
- Select.defaultProps = {
276
- defaultValue: "",
277
- scrollContainer: () => null
278
- };
279
253
  var Select_default = Select;
280
254
  export {
281
255
  Select_default as default
@@ -31,16 +31,16 @@ import React from "react";
31
31
  import "./Skeleton.css";
32
32
  const prefixCls = "bui-skeleton";
33
33
  const Skeleton = /* @__PURE__ */ React.forwardRef(
34
- (props, ref) => {
35
- const _a = props, {
34
+ (_a, ref) => {
35
+ var _b = _a, {
36
36
  className,
37
37
  style,
38
- animation,
38
+ animation = "wave",
39
39
  width,
40
40
  height,
41
- variant,
41
+ variant = "text",
42
42
  children
43
- } = _a, others = __objRest(_a, [
43
+ } = _b, others = __objRest(_b, [
44
44
  "className",
45
45
  "style",
46
46
  "animation",
@@ -69,10 +69,6 @@ const Skeleton = /* @__PURE__ */ React.forwardRef(
69
69
  }
70
70
  );
71
71
  Skeleton.displayName = "BuiSkeleton";
72
- Skeleton.defaultProps = {
73
- animation: "wave",
74
- variant: "text"
75
- };
76
72
  var Skeleton_default = Skeleton;
77
73
  export {
78
74
  Skeleton_default as default