@bifrostui/react 1.2.9-beta.0 → 1.3.1-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 (307) hide show
  1. package/dist/ActionSheet/ActionSheet.css +6 -3
  2. package/dist/ActionSheet/ActionSheetItem.css +10 -6
  3. package/dist/Alert/index.css +14 -8
  4. package/dist/Avatar/Avatar.css +13 -9
  5. package/dist/Avatar/AvatarGroup.css +15 -8
  6. package/dist/Backdrop/Backdrop.css +2 -1
  7. package/dist/Badge/Badge.css +27 -17
  8. package/dist/Breadcrumb/Breadcrumb.css +34 -0
  9. package/dist/Breadcrumb/Breadcrumb.d.ts +5 -0
  10. package/dist/Breadcrumb/Breadcrumb.js +128 -0
  11. package/dist/Breadcrumb/Breadcrumb.types.d.ts +49 -0
  12. package/dist/Breadcrumb/Breadcrumb.types.js +15 -0
  13. package/dist/Breadcrumb/BreadcrumbItem.d.ts +4 -0
  14. package/dist/Breadcrumb/BreadcrumbItem.js +78 -0
  15. package/dist/Breadcrumb/index.d.ts +4 -0
  16. package/dist/Breadcrumb/index.js +45 -0
  17. package/dist/Button/Button.css +26 -17
  18. package/dist/Calendar/Calendar.css +33 -18
  19. package/dist/Calendar/Calendar.d.ts +1 -1
  20. package/dist/Calendar/Calendar.js +85 -18
  21. package/dist/Calendar/Calendar.types.d.ts +33 -0
  22. package/dist/Card/CardFooter.css +2 -1
  23. package/dist/Card/CardHeader.css +3 -1
  24. package/dist/Checkbox/Checkbox.css +7 -5
  25. package/dist/CitySelector/CitySelector.css +29 -15
  26. package/dist/CitySelector/CitySelectorCore.js +25 -16
  27. package/dist/CitySelector/Selector/index.css +4 -4
  28. package/dist/Collapse/Collapse.css +6 -0
  29. package/dist/Collapse/Collapse.d.ts +5 -0
  30. package/dist/Collapse/Collapse.js +165 -0
  31. package/dist/Collapse/Collapse.types.d.ts +16 -0
  32. package/dist/Collapse/Collapse.types.js +15 -0
  33. package/dist/Collapse/index.d.ts +2 -0
  34. package/dist/Collapse/index.js +41 -0
  35. package/dist/CollapsePanel/CollapsePanel.css +32 -0
  36. package/dist/CollapsePanel/CollapsePanel.d.ts +5 -0
  37. package/dist/CollapsePanel/CollapsePanel.js +159 -0
  38. package/dist/CollapsePanel/CollapsePanel.types.d.ts +64 -0
  39. package/dist/CollapsePanel/CollapsePanel.types.js +15 -0
  40. package/dist/CollapsePanel/CollapsePanelItem.d.ts +4 -0
  41. package/dist/CollapsePanel/CollapsePanelItem.js +112 -0
  42. package/dist/CollapsePanel/index.d.ts +4 -0
  43. package/dist/CollapsePanel/index.js +45 -0
  44. package/dist/Countdown/Countdown.css +2 -1
  45. package/dist/Countdown/Countdown.js +3 -0
  46. package/dist/Dialog/Dialog.d.ts +5 -0
  47. package/dist/Dialog/Dialog.js +152 -0
  48. package/dist/Dialog/Dialog.types.d.ts +109 -0
  49. package/dist/Dialog/Dialog.types.js +15 -0
  50. package/dist/Dialog/FunctionalDialog.d.ts +3 -0
  51. package/dist/Dialog/FunctionalDialog.js +204 -0
  52. package/dist/Dialog/index.css +75 -0
  53. package/dist/Dialog/index.d.ts +2 -0
  54. package/dist/Dialog/index.js +41 -0
  55. package/dist/Divider/Divider.css +6 -4
  56. package/dist/IconButton/IconButton.css +9 -7
  57. package/dist/Image/index.css +2 -1
  58. package/dist/Input/Input.css +10 -5
  59. package/dist/List/List.css +3 -0
  60. package/dist/List/ListItem.css +3 -3
  61. package/dist/List/ListItemContent.css +1 -1
  62. package/dist/Loading/Loading.css +4 -2
  63. package/dist/Modal/Modal.miniapp.d.ts +1 -1
  64. package/dist/NavBar/NavBar.css +9 -5
  65. package/dist/Picker/Picker.css +25 -29
  66. package/dist/Picker/Picker.js +31 -11
  67. package/dist/Picker/Picker.types.d.ts +4 -0
  68. package/dist/Picker/PickerPanel.css +8 -8
  69. package/dist/Picker/PickerPanel.js +14 -8
  70. package/dist/Picker/utils.d.ts +16 -0
  71. package/dist/Picker/utils.js +32 -2
  72. package/dist/Popover/Popover.css +97 -0
  73. package/dist/Popover/Popover.d.ts +5 -0
  74. package/dist/Popover/Popover.js +186 -0
  75. package/dist/Popover/Popover.types.d.ts +60 -0
  76. package/dist/Popover/Popover.types.js +15 -0
  77. package/dist/Popover/index.d.ts +2 -0
  78. package/dist/Popover/index.js +41 -0
  79. package/dist/Portal/Portal.types.d.ts +4 -0
  80. package/dist/Portal/PortalCore.js +8 -1
  81. package/dist/Progress/Progress.css +8 -6
  82. package/dist/Radio/Radio.css +2 -1
  83. package/dist/Radio/Radio.js +1 -1
  84. package/dist/Radio/RadioButtonIcon.d.ts +1 -6
  85. package/dist/Radio/RadioButtonIcon.js +0 -3
  86. package/dist/Rating/Rating.css +8 -4
  87. package/dist/Select/Select.css +21 -10
  88. package/dist/Select/Select.js +1 -1
  89. package/dist/Select/SelectOption.js +3 -0
  90. package/dist/Skeleton/Skeleton.css +3 -2
  91. package/dist/Slider/Slider.css +24 -13
  92. package/dist/Steps/Step.css +11 -11
  93. package/dist/Steps/Steps.css +14 -5
  94. package/dist/Swiper/Swiper.css +2 -1
  95. package/dist/Switch/Switch.css +31 -16
  96. package/dist/TabBar/TabBar.css +7 -3
  97. package/dist/TabBar/TabBarItem.css +0 -1
  98. package/dist/Tabs/Tab.css +2 -6
  99. package/dist/Tabs/Tabs.css +7 -4
  100. package/dist/Tag/Tag.css +7 -10
  101. package/dist/Tag/TagGroup.css +9 -1
  102. package/dist/TextArea/TextArea.css +14 -8
  103. package/dist/ThemeProvider/ThemeProvider.d.ts +4 -0
  104. package/dist/ThemeProvider/ThemeProvider.js +90 -0
  105. package/dist/ThemeProvider/ThemeProvider.types.d.ts +127 -0
  106. package/dist/ThemeProvider/ThemeProvider.types.js +27 -0
  107. package/dist/ThemeProvider/hooks/ThemeContext.d.ts +4 -0
  108. package/dist/ThemeProvider/hooks/ThemeContext.js +35 -0
  109. package/dist/ThemeProvider/hooks/createTheme.d.ts +2 -0
  110. package/dist/ThemeProvider/hooks/createTheme.js +55 -0
  111. package/dist/ThemeProvider/hooks/index.d.ts +4 -0
  112. package/dist/ThemeProvider/hooks/index.js +43 -0
  113. package/dist/ThemeProvider/hooks/useTheme.d.ts +1 -0
  114. package/dist/ThemeProvider/hooks/useTheme.js +39 -0
  115. package/dist/ThemeProvider/index.d.ts +4 -0
  116. package/dist/ThemeProvider/index.js +45 -0
  117. package/dist/ThemeProvider/utils/constants.d.ts +38 -0
  118. package/dist/ThemeProvider/utils/constants.js +65 -0
  119. package/dist/ThemeProvider/utils/index.d.ts +2 -0
  120. package/dist/ThemeProvider/utils/index.js +23 -0
  121. package/dist/ThemeProvider/utils/mountTokens.d.ts +26 -0
  122. package/dist/ThemeProvider/utils/mountTokens.js +123 -0
  123. package/dist/Toast/FunctionalToast.d.ts +3 -0
  124. package/dist/Toast/FunctionalToast.js +177 -0
  125. package/dist/Toast/Toast.css +56 -0
  126. package/dist/Toast/Toast.d.ts +5 -0
  127. package/dist/Toast/Toast.js +121 -0
  128. package/dist/Toast/Toast.types.d.ts +101 -0
  129. package/dist/Toast/Toast.types.js +15 -0
  130. package/dist/Toast/index.d.ts +2 -0
  131. package/dist/Toast/index.js +41 -0
  132. package/dist/Tooltip/Tooltip.css +91 -0
  133. package/dist/Tooltip/Tooltip.d.ts +5 -0
  134. package/dist/Tooltip/Tooltip.js +177 -0
  135. package/dist/Tooltip/Tooltip.types.d.ts +51 -0
  136. package/dist/Tooltip/Tooltip.types.js +15 -0
  137. package/dist/Tooltip/index.d.ts +2 -0
  138. package/dist/Tooltip/index.js +41 -0
  139. package/dist/Transition/Transition.miniapp.js +7 -1
  140. package/dist/index.d.ts +9 -0
  141. package/dist/index.js +19 -1
  142. package/dist/locales/base.d.ts +40 -0
  143. package/dist/locales/base.js +15 -0
  144. package/dist/locales/en-US.d.ts +3 -0
  145. package/dist/locales/en-US.js +69 -0
  146. package/dist/locales/hooks/useLocaleText.d.ts +3 -0
  147. package/dist/locales/hooks/useLocaleText.js +43 -0
  148. package/dist/locales/index.d.ts +5 -0
  149. package/dist/locales/index.js +49 -0
  150. package/dist/locales/zh-CN.d.ts +3 -0
  151. package/dist/locales/zh-CN.js +51 -0
  152. package/dist/locales/zh-TW.d.ts +3 -0
  153. package/dist/locales/zh-TW.js +51 -0
  154. package/es/ActionSheet/ActionSheet.css +6 -3
  155. package/es/ActionSheet/ActionSheetItem.css +10 -6
  156. package/es/Alert/index.css +14 -8
  157. package/es/Avatar/Avatar.css +13 -9
  158. package/es/Avatar/AvatarGroup.css +15 -8
  159. package/es/Backdrop/Backdrop.css +2 -1
  160. package/es/Badge/Badge.css +27 -17
  161. package/es/Breadcrumb/Breadcrumb.css +34 -0
  162. package/es/Breadcrumb/Breadcrumb.d.ts +5 -0
  163. package/es/Breadcrumb/Breadcrumb.js +101 -0
  164. package/es/Breadcrumb/Breadcrumb.types.d.ts +49 -0
  165. package/es/Breadcrumb/Breadcrumb.types.js +1 -0
  166. package/es/Breadcrumb/BreadcrumbItem.d.ts +4 -0
  167. package/es/Breadcrumb/BreadcrumbItem.js +51 -0
  168. package/es/Breadcrumb/index.d.ts +4 -0
  169. package/es/Breadcrumb/index.js +9 -0
  170. package/es/Button/Button.css +26 -17
  171. package/es/Calendar/Calendar.css +33 -18
  172. package/es/Calendar/Calendar.d.ts +1 -1
  173. package/es/Calendar/Calendar.js +91 -19
  174. package/es/Calendar/Calendar.types.d.ts +33 -0
  175. package/es/Card/CardFooter.css +2 -1
  176. package/es/Card/CardHeader.css +3 -1
  177. package/es/Checkbox/Checkbox.css +7 -5
  178. package/es/CitySelector/CitySelector.css +29 -15
  179. package/es/CitySelector/CitySelectorCore.js +25 -16
  180. package/es/CitySelector/Selector/index.css +4 -4
  181. package/es/Collapse/Collapse.css +6 -0
  182. package/es/Collapse/Collapse.d.ts +5 -0
  183. package/es/Collapse/Collapse.js +144 -0
  184. package/es/Collapse/Collapse.types.d.ts +16 -0
  185. package/es/Collapse/Collapse.types.js +1 -0
  186. package/es/Collapse/index.d.ts +2 -0
  187. package/es/Collapse/index.js +6 -0
  188. package/es/CollapsePanel/CollapsePanel.css +32 -0
  189. package/es/CollapsePanel/CollapsePanel.d.ts +5 -0
  190. package/es/CollapsePanel/CollapsePanel.js +132 -0
  191. package/es/CollapsePanel/CollapsePanel.types.d.ts +64 -0
  192. package/es/CollapsePanel/CollapsePanel.types.js +1 -0
  193. package/es/CollapsePanel/CollapsePanelItem.d.ts +4 -0
  194. package/es/CollapsePanel/CollapsePanelItem.js +85 -0
  195. package/es/CollapsePanel/index.d.ts +4 -0
  196. package/es/CollapsePanel/index.js +9 -0
  197. package/es/Countdown/Countdown.css +2 -1
  198. package/es/Countdown/Countdown.js +3 -0
  199. package/es/Dialog/Dialog.d.ts +5 -0
  200. package/es/Dialog/Dialog.js +125 -0
  201. package/es/Dialog/Dialog.types.d.ts +109 -0
  202. package/es/Dialog/Dialog.types.js +1 -0
  203. package/es/Dialog/FunctionalDialog.d.ts +3 -0
  204. package/es/Dialog/FunctionalDialog.js +177 -0
  205. package/es/Dialog/index.css +75 -0
  206. package/es/Dialog/index.d.ts +2 -0
  207. package/es/Dialog/index.js +6 -0
  208. package/es/Divider/Divider.css +6 -4
  209. package/es/IconButton/IconButton.css +9 -7
  210. package/es/Image/index.css +2 -1
  211. package/es/Input/Input.css +10 -5
  212. package/es/List/List.css +3 -0
  213. package/es/List/ListItem.css +3 -3
  214. package/es/List/ListItemContent.css +1 -1
  215. package/es/Loading/Loading.css +4 -2
  216. package/es/Modal/Modal.miniapp.d.ts +1 -1
  217. package/es/NavBar/NavBar.css +9 -5
  218. package/es/Picker/Picker.css +25 -29
  219. package/es/Picker/Picker.js +32 -12
  220. package/es/Picker/Picker.types.d.ts +4 -0
  221. package/es/Picker/PickerPanel.css +8 -8
  222. package/es/Picker/PickerPanel.js +14 -8
  223. package/es/Picker/utils.d.ts +16 -0
  224. package/es/Picker/utils.js +29 -1
  225. package/es/Popover/Popover.css +97 -0
  226. package/es/Popover/Popover.d.ts +5 -0
  227. package/es/Popover/Popover.js +159 -0
  228. package/es/Popover/Popover.types.d.ts +60 -0
  229. package/es/Popover/Popover.types.js +1 -0
  230. package/es/Popover/index.d.ts +2 -0
  231. package/es/Popover/index.js +6 -0
  232. package/es/Portal/Portal.types.d.ts +4 -0
  233. package/es/Portal/PortalCore.js +8 -1
  234. package/es/Progress/Progress.css +8 -6
  235. package/es/Radio/Radio.css +2 -1
  236. package/es/Radio/Radio.js +1 -1
  237. package/es/Radio/RadioButtonIcon.d.ts +1 -6
  238. package/es/Radio/RadioButtonIcon.js +0 -3
  239. package/es/Rating/Rating.css +8 -4
  240. package/es/Select/Select.css +21 -10
  241. package/es/Select/Select.js +1 -1
  242. package/es/Select/SelectOption.js +3 -0
  243. package/es/Skeleton/Skeleton.css +3 -2
  244. package/es/Slider/Slider.css +24 -13
  245. package/es/Steps/Step.css +11 -11
  246. package/es/Steps/Steps.css +14 -5
  247. package/es/Swiper/Swiper.css +2 -1
  248. package/es/Switch/Switch.css +31 -16
  249. package/es/TabBar/TabBar.css +7 -3
  250. package/es/TabBar/TabBarItem.css +0 -1
  251. package/es/Tabs/Tab.css +2 -6
  252. package/es/Tabs/Tabs.css +7 -4
  253. package/es/Tag/Tag.css +7 -10
  254. package/es/Tag/TagGroup.css +9 -1
  255. package/es/TextArea/TextArea.css +14 -8
  256. package/es/ThemeProvider/ThemeProvider.d.ts +4 -0
  257. package/es/ThemeProvider/ThemeProvider.js +61 -0
  258. package/es/ThemeProvider/ThemeProvider.types.d.ts +127 -0
  259. package/es/ThemeProvider/ThemeProvider.types.js +1 -0
  260. package/es/ThemeProvider/hooks/ThemeContext.d.ts +4 -0
  261. package/es/ThemeProvider/hooks/ThemeContext.js +6 -0
  262. package/es/ThemeProvider/hooks/createTheme.d.ts +2 -0
  263. package/es/ThemeProvider/hooks/createTheme.js +38 -0
  264. package/es/ThemeProvider/hooks/index.d.ts +4 -0
  265. package/es/ThemeProvider/hooks/index.js +8 -0
  266. package/es/ThemeProvider/hooks/useTheme.d.ts +1 -0
  267. package/es/ThemeProvider/hooks/useTheme.js +10 -0
  268. package/es/ThemeProvider/index.d.ts +4 -0
  269. package/es/ThemeProvider/index.js +8 -0
  270. package/es/ThemeProvider/utils/constants.d.ts +38 -0
  271. package/es/ThemeProvider/utils/constants.js +40 -0
  272. package/es/ThemeProvider/utils/index.d.ts +2 -0
  273. package/es/ThemeProvider/utils/index.js +2 -0
  274. package/es/ThemeProvider/utils/mountTokens.d.ts +26 -0
  275. package/es/ThemeProvider/utils/mountTokens.js +88 -0
  276. package/es/Toast/FunctionalToast.d.ts +3 -0
  277. package/es/Toast/FunctionalToast.js +150 -0
  278. package/es/Toast/Toast.css +56 -0
  279. package/es/Toast/Toast.d.ts +5 -0
  280. package/es/Toast/Toast.js +99 -0
  281. package/es/Toast/Toast.types.d.ts +101 -0
  282. package/es/Toast/Toast.types.js +1 -0
  283. package/es/Toast/index.d.ts +2 -0
  284. package/es/Toast/index.js +6 -0
  285. package/es/Tooltip/Tooltip.css +91 -0
  286. package/es/Tooltip/Tooltip.d.ts +5 -0
  287. package/es/Tooltip/Tooltip.js +150 -0
  288. package/es/Tooltip/Tooltip.types.d.ts +51 -0
  289. package/es/Tooltip/Tooltip.types.js +1 -0
  290. package/es/Tooltip/index.d.ts +2 -0
  291. package/es/Tooltip/index.js +6 -0
  292. package/es/Transition/Transition.miniapp.js +7 -1
  293. package/es/index.d.ts +9 -0
  294. package/es/index.js +9 -0
  295. package/es/locales/base.d.ts +40 -0
  296. package/es/locales/base.js +0 -0
  297. package/es/locales/en-US.d.ts +3 -0
  298. package/es/locales/en-US.js +50 -0
  299. package/es/locales/hooks/useLocaleText.d.ts +3 -0
  300. package/es/locales/hooks/useLocaleText.js +26 -0
  301. package/es/locales/index.d.ts +5 -0
  302. package/es/locales/index.js +11 -0
  303. package/es/locales/zh-CN.d.ts +3 -0
  304. package/es/locales/zh-CN.js +32 -0
  305. package/es/locales/zh-TW.d.ts +3 -0
  306. package/es/locales/zh-TW.js +32 -0
  307. package/package.json +5 -5
@@ -0,0 +1,159 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ var __objRest = (source, exclude) => {
21
+ var target = {};
22
+ for (var prop in source)
23
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
24
+ target[prop] = source[prop];
25
+ if (source != null && __getOwnPropSymbols)
26
+ for (var prop of __getOwnPropSymbols(source)) {
27
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
28
+ target[prop] = source[prop];
29
+ }
30
+ return target;
31
+ };
32
+ import clsx from "clsx";
33
+ import React, { useState, useRef, useId } from "react";
34
+ import { getStylesAndLocation, triggerEventTransform } from "@bifrostui/utils";
35
+ import Portal from "../Portal";
36
+ import "./Popover.css";
37
+ const prefixCls = "bui-popover";
38
+ const Popover = /* @__PURE__ */ React.forwardRef((props, ref) => {
39
+ const _a = props, {
40
+ className,
41
+ style,
42
+ children,
43
+ title,
44
+ content,
45
+ defaultOpen,
46
+ placement = "top",
47
+ trigger,
48
+ onOpenChange,
49
+ open,
50
+ hideArrow,
51
+ PortalProps
52
+ } = _a, others = __objRest(_a, [
53
+ "className",
54
+ "style",
55
+ "children",
56
+ "title",
57
+ "content",
58
+ "defaultOpen",
59
+ "placement",
60
+ "trigger",
61
+ "onOpenChange",
62
+ "open",
63
+ "hideArrow",
64
+ "PortalProps"
65
+ ]);
66
+ const positionArr = placement.split(/([A-Z])/);
67
+ const direction = positionArr[0];
68
+ let location;
69
+ if (positionArr.length > 1) {
70
+ positionArr.splice(0, 1);
71
+ location = positionArr.join("").toLowerCase();
72
+ } else {
73
+ location = "center";
74
+ }
75
+ const childrenRef = useRef();
76
+ const [openStatus, setOpenStatus] = useState(defaultOpen);
77
+ const [arrowDirection, setArrowDirection] = useState(direction);
78
+ const [arrowLocation, setArrowLocation] = useState(location);
79
+ const [tooltyles, setTooltyles] = useState({});
80
+ const ttId = useId();
81
+ const onRootElementMouted = () => {
82
+ const result = getStylesAndLocation({
83
+ childrenRef,
84
+ arrowDirection,
85
+ arrowLocation,
86
+ selector: `[data-id="tt_${ttId}"]`
87
+ });
88
+ if (!result)
89
+ return;
90
+ const { styles, newArrowDirection, newArrowLocation } = result;
91
+ if (newArrowDirection !== arrowDirection) {
92
+ setArrowDirection(newArrowDirection);
93
+ }
94
+ if (newArrowLocation !== arrowLocation) {
95
+ setArrowLocation(newArrowLocation);
96
+ }
97
+ setTooltyles(styles);
98
+ };
99
+ const changeOpenStatus = (event, status) => {
100
+ if (open)
101
+ return;
102
+ setOpenStatus(status);
103
+ onOpenChange == null ? void 0 : onOpenChange(event, { open: status });
104
+ };
105
+ const triggerClick = (event) => {
106
+ const targetStatus = !openStatus;
107
+ changeOpenStatus(event, targetStatus);
108
+ };
109
+ const hidePopover = (event) => {
110
+ changeOpenStatus(event, false);
111
+ };
112
+ const showPopover = (event) => {
113
+ changeOpenStatus(event, true);
114
+ };
115
+ if (!children || !(title || content))
116
+ return null;
117
+ const triggerEventOption = triggerEventTransform({
118
+ trigger,
119
+ click: triggerClick,
120
+ show: showPopover,
121
+ hide: hidePopover
122
+ });
123
+ const childrenOptions = __spreadValues({
124
+ ref: childrenRef
125
+ }, triggerEventOption);
126
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, (open || openStatus) && title ? /* @__PURE__ */ React.createElement(
127
+ Portal,
128
+ __spreadProps(__spreadValues({
129
+ onRootElementMouted
130
+ }, PortalProps), {
131
+ ref
132
+ }),
133
+ /* @__PURE__ */ React.createElement(
134
+ "div",
135
+ __spreadValues({
136
+ className: clsx(prefixCls, className, `popover-${arrowDirection}`, {
137
+ "bui-popover-arrow-hide": hideArrow
138
+ }),
139
+ "data-id": `tt_${ttId}`,
140
+ style: __spreadValues(__spreadValues({}, style), tooltyles)
141
+ }, others),
142
+ !hideArrow ? /* @__PURE__ */ React.createElement(
143
+ "div",
144
+ {
145
+ className: clsx(
146
+ "bui-popover-arrow",
147
+ `location-${arrowLocation}`
148
+ )
149
+ }
150
+ ) : null,
151
+ /* @__PURE__ */ React.createElement("div", { className: "bui-popover-content" }, title ? /* @__PURE__ */ React.createElement("div", { className: "bui-popover-title" }, title) : null, content ? /* @__PURE__ */ React.createElement("div", { className: "bui-popover-inner-content" }, content) : null)
152
+ )
153
+ ) : null, React.cloneElement(children, childrenOptions));
154
+ });
155
+ Popover.displayName = "BuiPopover";
156
+ var Popover_default = Popover;
157
+ export {
158
+ Popover_default as default
159
+ };
@@ -0,0 +1,60 @@
1
+ import React from 'react';
2
+ import { OverrideProps } from '@bifrostui/types';
3
+ import { PortalCoreProps } from '../Portal/Portal.types';
4
+ type triggerType = 'click' | 'hover';
5
+ export type PopoverProps<D extends React.ElementType = 'div', P = {}> = OverrideProps<{
6
+ props: P & {
7
+ children: React.ReactElement;
8
+ /**
9
+ * 默认是否显隐
10
+ * @default false
11
+ */
12
+ defaultOpen?: boolean;
13
+ /**
14
+ * 用于手动控制浮层显隐
15
+ * @default false
16
+ */
17
+ open?: boolean;
18
+ /**
19
+ * 浮层的标题
20
+ */
21
+ title?: React.ReactNode;
22
+ /**
23
+ * 浮层的内容
24
+ */
25
+ content?: React.ReactNode;
26
+ /**
27
+ * 是否展示箭头
28
+ * @default false
29
+ */
30
+ hideArrow?: boolean;
31
+ /**
32
+ * 气泡框位置
33
+ * @default 'top'
34
+ */
35
+ placement?: 'top' | 'left' | 'right' | 'bottom' | 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight' | 'leftTop' | 'leftBottom' | 'rightTop' | 'rightBottom';
36
+ /**
37
+ * 触发行为
38
+ * - click: 点击触发
39
+ * - hover: hover触发
40
+ * - 或者是他们的数组
41
+ * @default 'click'
42
+ */
43
+ trigger?: triggerType | triggerType[];
44
+ /**
45
+ * Portal组件的属性
46
+ */
47
+ PortalProps?: PortalCoreProps;
48
+ /**
49
+ * 点击事件回调方法
50
+ * - event 触发事件
51
+ * - data.open 浮层显隐状态
52
+ * @returns
53
+ */
54
+ onOpenChange?: (event: React.SyntheticEvent, data: {
55
+ open: boolean;
56
+ }) => void;
57
+ };
58
+ defaultComponent: D;
59
+ }, D>;
60
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ export { default as Popover, default } from './Popover';
2
+ export * from './Popover.types';
@@ -0,0 +1,6 @@
1
+ import { default as default2, default as default3 } from "./Popover";
2
+ export * from "./Popover.types";
3
+ export {
4
+ default2 as Popover,
5
+ default3 as default
6
+ };
@@ -18,5 +18,9 @@ export interface PortalCoreProps {
18
18
  * 页面跟节点
19
19
  */
20
20
  rootElement?: Element;
21
+ /**
22
+ * 挂载成功的回调方法
23
+ */
24
+ onRootElementMouted?: (e: Element) => void;
21
25
  }
22
26
  export type PortalProps = Omit<PortalCoreProps, 'rootElement'>;
@@ -6,7 +6,13 @@ function getContainer(container) {
6
6
  }
7
7
  const PortalCore = /* @__PURE__ */ React.forwardRef(
8
8
  function Portal(props, ref) {
9
- const { children, container, disablePortal = false, rootElement } = props;
9
+ const {
10
+ children,
11
+ container,
12
+ disablePortal = false,
13
+ rootElement,
14
+ onRootElementMouted
15
+ } = props;
10
16
  const [mountNode, setMountNode] = React.useState(null);
11
17
  const handleRef = useForkRef(
12
18
  // @ts-expect-error will upstream fix
@@ -21,6 +27,7 @@ const PortalCore = /* @__PURE__ */ React.forwardRef(
21
27
  useLayoutEffect(() => {
22
28
  if (mountNode && !disablePortal) {
23
29
  setRef(ref, mountNode);
30
+ onRootElementMouted == null ? void 0 : onRootElementMouted(mountNode);
24
31
  return () => {
25
32
  setRef(ref, null);
26
33
  };
@@ -1,22 +1,24 @@
1
1
  .bui-progress {
2
2
  --fill-color: var(--bui-color-primary);
3
- --trail-color: rgba(156, 156, 165, 0.2);
4
- --stroke-width: 8px;
5
- width: 100%;
3
+ --trail-color: var(--bui-progress-trail-color, rgba(156, 156, 165, 0.2));
4
+ --stroke-width: var(--bui-progress-stroke-width, 8px);
5
+ --width: var(--bui-progress-width, 100%);
6
+ --border-radius: var(--bui-progress-border-radius, 100px);
7
+ width: var(--width);
6
8
  font-family: var(--bui-font-family);
7
9
  }
8
10
  .bui-progress-inner {
9
11
  position: relative;
10
12
  display: inline-block;
11
- width: 100%;
13
+ width: var(--width);
12
14
  overflow: hidden;
13
15
  vertical-align: middle;
14
16
  background-color: var(--trail-color);
15
- border-radius: 100px;
17
+ border-radius: var(--border-radius);
16
18
  }
17
19
  .bui-progress-bg {
18
20
  position: relative;
19
- border-radius: 100px;
21
+ border-radius: var(--border-radius);
20
22
  background-color: var(--fill-color);
21
23
  height: var(--stroke-width);
22
24
  }
@@ -2,6 +2,7 @@
2
2
  --label-color: var(--bui-color-fg-default);
3
3
  --label-font-size: var(--bui-text-size-1);
4
4
  --icon-font-size: var(--bui-title-size-2);
5
+ --icon-padding: var(--bui-radio-icon-padding, 5px);
5
6
  display: inline-flex;
6
7
  align-items: center;
7
8
  position: relative;
@@ -35,7 +36,7 @@
35
36
  align-items: center;
36
37
  justify-content: center;
37
38
  flex-shrink: 0;
38
- padding: 5px;
39
+ padding: var(--icon-padding);
39
40
  box-sizing: border-box;
40
41
  }
41
42
  .bui-radio-label {
package/es/Radio/Radio.js CHANGED
@@ -85,7 +85,7 @@ const Radio = forwardRef((props, ref) => {
85
85
  console.error("RadioGroup\u6A21\u5F0F\u4E0BRadio\u987B\u4F20\u5165value\u5C5E\u6027");
86
86
  }
87
87
  const radioCheckIcon = checkedIcon || /* @__PURE__ */ React.createElement(RadioButtonIcon, { checked: true });
88
- const radioUncheckIcon = icon || /* @__PURE__ */ React.createElement(RadioButtonIcon, null);
88
+ const radioUncheckIcon = icon || /* @__PURE__ */ React.createElement(RadioButtonIcon, { checked: false });
89
89
  const radioDisabled = disabled !== void 0 ? disabled : groupContext == null ? void 0 : groupContext.disabled;
90
90
  const changeAction = (e, isChecked) => {
91
91
  var _a2;
@@ -1,12 +1,7 @@
1
1
  import { ISvgIconProps } from '@bifrostui/icons';
2
2
  import React from 'react';
3
3
  export interface IRadioButtonIconProps extends ISvgIconProps {
4
- checked?: boolean;
4
+ checked: boolean;
5
5
  }
6
6
  declare function RadioButtonIcon(props: IRadioButtonIconProps): React.JSX.Element;
7
- declare namespace RadioButtonIcon {
8
- var defaultProps: {
9
- checked: boolean;
10
- };
11
- }
12
7
  export default RadioButtonIcon;
@@ -34,9 +34,6 @@ function RadioButtonIcon(props) {
34
34
  )
35
35
  );
36
36
  }
37
- RadioButtonIcon.defaultProps = {
38
- checked: false
39
- };
40
37
  var RadioButtonIcon_default = RadioButtonIcon;
41
38
  export {
42
39
  RadioButtonIcon_default as default
@@ -1,4 +1,8 @@
1
1
  .bui-rating {
2
+ --small-margin-right: var(--bui-rating-small-margin-right, 0.5px);
3
+ --medium-margin-right: var(--bui-rating-medium-margin-right, 1px);
4
+ --large-margin-right: var(--bui-rating-large-margin-right, 2px);
5
+ --large-font-size: var(--bui-rating-large-font-size, 22px);
2
6
  display: flex;
3
7
  flex-wrap: wrap;
4
8
  font-family: var(--bui-font-family);
@@ -19,15 +23,15 @@
19
23
  }
20
24
  .bui-rating-container-small {
21
25
  font-size: var(--bui-text-size-1);
22
- margin-right: 0.5px;
26
+ margin-right: var(--small-margin-right);
23
27
  }
24
28
  .bui-rating-container-medium {
25
29
  font-size: var(--bui-title-size-3);
26
- margin-right: 1px;
30
+ margin-right: var(--small-medium-right);
27
31
  }
28
32
  .bui-rating-container-large {
29
- font-size: 22px;
30
- margin-right: 2px;
33
+ font-size: var(--large-font-size);
34
+ margin-right: var(--large-margin-right);
31
35
  }
32
36
  .bui-rating-item {
33
37
  display: flex;
@@ -1,9 +1,19 @@
1
1
  .bui-select {
2
+ --height: var(--bui-select-height, 27px);
3
+ --mini-width: var(--bui-select-min-width, 100px);
4
+ --font-size: var(--bui-select-font-size, var(--bui-title-size-3));
5
+ --padding: var(--bui-select-selector-container, 0 14px);
6
+ --option-container-padding: var(--bui-select-option-container-padding, 3px 0);
7
+ --option-margin-top: var(--bui-select-option-margin-top, 6px);
8
+ --option-padding: var(--bui-select-option-padding, 0 14px);
9
+ --option-margin: var(--bui-select-option-margin, 0 3px);
10
+ --option-height: var(--bui-select-option-height, 27px);
11
+ --option-active-font-weight: var(--bui-select-option-active-font-weight, 500);
2
12
  position: relative;
3
13
  cursor: pointer;
4
- height: 27px;
5
- min-width: 100px;
6
- font-size: var(--bui-title-size-3);
14
+ height: var(--height);
15
+ min-width: var(--mini-width);
16
+ font-size: var(--font-size);
7
17
  border-radius: 5px;
8
18
  background-color: var(--bui-color-bg-view);
9
19
  font-family: var(--bui-font-family);
@@ -15,7 +25,7 @@
15
25
  .bui-select-selector-container {
16
26
  display: flex;
17
27
  align-items: center;
18
- padding: 0 14px;
28
+ padding: var(--padding);
19
29
  height: 100%;
20
30
  }
21
31
  .bui-select-input {
@@ -32,7 +42,7 @@
32
42
  justify-content: space-between;
33
43
  align-items: center;
34
44
  flex: 1;
35
- height: 27px;
45
+ height: var(--bui-select-height);
36
46
  background-color: transparent;
37
47
  outline: none;
38
48
  border: 0;
@@ -47,24 +57,25 @@
47
57
  left: 0;
48
58
  width: 100%;
49
59
  z-index: var(--bui-z-index-dropdown);
50
- margin-top: 6px;
60
+ margin-top: var(--option-container-margin-top);
61
+ border-radius: 3px;
51
62
  background-color: var(--bui-color-bg-view);
52
63
  padding: 2px;
53
64
  overflow: hidden;
54
65
  }
55
66
  .bui-select-option-main {
56
67
  border-radius: 3px;
57
- padding: 3px 0;
68
+ padding: var(--option-container-padding);
58
69
  box-shadow: 0 0 0 2px var(--bui-color-bg-default);
59
70
  overflow: hidden;
60
71
  }
61
72
  .bui-select-option {
62
73
  display: flex;
63
74
  align-items: center;
64
- height: 27px;
65
- padding: 0 14px;
75
+ height: var(--option-height);
76
+ padding: var(--option-padding);
66
77
  border-radius: 5px;
67
- margin: 0 3px;
78
+ margin: var(--option-margin);
68
79
  }
69
80
  .bui-select-option:hover {
70
81
  background-color: var(---bui-select-options-active-bg, #fff2f0);
@@ -112,7 +112,7 @@ const Select = /* @__PURE__ */ React.forwardRef((props, ref) => {
112
112
  };
113
113
  const selectContext = useMemo(
114
114
  () => ({ selectValue, setRenderValue, handleOptionClick }),
115
- [selectValue]
115
+ [selectValue, onChange, setRenderValue]
116
116
  );
117
117
  useEffect(() => {
118
118
  if (open !== void 0)
@@ -42,6 +42,9 @@ const SelectOption = /* @__PURE__ */ React.forwardRef(
42
42
  if (value === selectValue) {
43
43
  setRenderValue(label);
44
44
  }
45
+ return () => {
46
+ setRenderValue("");
47
+ };
45
48
  }, [selectValue, label, value]);
46
49
  return /* @__PURE__ */ React.createElement(
47
50
  "div",
@@ -1,5 +1,6 @@
1
1
  .bui-skeleton {
2
2
  --border-radius: var(--bui-shape-radius-label);
3
+ --height: var(--bui-skeleton-height, 1.2em);
3
4
  display: block;
4
5
  }
5
6
  .bui-skeleton-animation-wave {
@@ -26,10 +27,10 @@
26
27
  content: "\a0";
27
28
  }
28
29
  .bui-skeleton-rectangular {
29
- height: 1.2em;
30
+ height: var(--height);
30
31
  }
31
32
  .bui-skeleton-rounded {
32
- height: 1.2em;
33
+ height: var(--height);
33
34
  border-radius: var(--border-radius);
34
35
  }
35
36
  .bui-skeleton-circular {
@@ -4,10 +4,21 @@
4
4
  --tooltip-font-size: var(--bui-text-size-3);
5
5
  --tooltip-color: var(--bui-color-white);
6
6
  --tooltip-bg-color: var(--line-color);
7
+ --width: var(--bui-slider-width, 100%);
8
+ --height: var(--bui-slider-height, 2px);
9
+ --padding: var(--bui-slider-padding, 19px 0);
10
+ --button-width: var(--bui-slider-button-width, 26px);
11
+ --button-height: var(--bui-slider-button-height, 26px);
12
+ --button-font-size: var(--bui-slider-button-font-size, var(--bui-title-size-3));
13
+ --button-border-radius: var(--bui--slider-button-border-radius, 50%);
14
+ --tooltip-width: var(--bui-slider-tooltip-width, 46px);
15
+ --tooltip-height: var(--bui-slider-tooltip-height, 24px);
16
+ --tooltip-line-height: var(--bui-slider-tooltip-line-height, 24px);
17
+ --tooltip-border-radius: var(--bui-slider-tooltip-border-radius, 24px);
7
18
  position: relative;
8
- width: 100%;
9
- height: 2px;
10
- padding: 19px 0;
19
+ width: var(--width);
20
+ height: var(--height);
21
+ padding: var(--padding);
11
22
  box-sizing: border-box;
12
23
  font-family: var(--bui-font-family);
13
24
  }
@@ -19,7 +30,7 @@
19
30
  position: absolute;
20
31
  top: 50%;
21
32
  left: 0;
22
- height: 2px;
33
+ height: var(--height);
23
34
  transform: translateY(-50%);
24
35
  background-color: var(--line-color);
25
36
  }
@@ -28,7 +39,7 @@
28
39
  top: 50%;
29
40
  left: 0;
30
41
  width: 100%;
31
- height: 2px;
42
+ height: var(---height);
32
43
  transform: translateY(-50%);
33
44
  background-color: var(--line-bg-color);
34
45
  }
@@ -37,11 +48,11 @@
37
48
  position: absolute;
38
49
  justify-content: center;
39
50
  align-items: center;
40
- width: 26px;
41
- height: 26px;
42
- background-color: #fff;
51
+ width: var(--button-width);
52
+ height: var(--button-height);
53
+ background-color: var(--bui-color-white);
43
54
  box-shadow: #ddd 0 0 10px;
44
- border-radius: 50%;
55
+ border-radius: var(--button-border-radius);
45
56
  transform: translate(-50%, -50%);
46
57
  font-size: var(--bui-title-size-3);
47
58
  cursor: grab;
@@ -67,11 +78,11 @@
67
78
  .bui-slider-tooltip {
68
79
  position: absolute;
69
80
  top: -14px;
70
- width: 46px;
71
- height: 24px;
72
- line-height: 24px;
81
+ width: var(--tooltip-width);
82
+ height: var(--tooltip-height);
83
+ line-height: var(--tooltip-line-height);
73
84
  font-size: var(--tooltip-font-size);
74
- border-radius: 24px;
85
+ border-radius: var(--tooltip-border-radius);
75
86
  color: var(--tooltip-color);
76
87
  text-align: center;
77
88
  background-color: var(--tooltip-bg-color);
package/es/Steps/Step.css CHANGED
@@ -5,7 +5,7 @@
5
5
  font-family: var(--bui-font-family);
6
6
  }
7
7
  .bui-step-label-horizontal {
8
- line-height: 1.8;
8
+ line-height: var(--step-label-horizontal-line-height);
9
9
  }
10
10
  .bui-step:last-child .bui-step-line::after {
11
11
  display: none;
@@ -13,8 +13,8 @@
13
13
  .bui-step-line {
14
14
  position: absolute;
15
15
  top: 0;
16
- width: 1px;
17
- height: 100%;
16
+ width: var(--step-line-width);
17
+ height: var(--step-line-height);
18
18
  box-sizing: border-box;
19
19
  left: 13px;
20
20
  padding: var(--step-line-padding);
@@ -22,8 +22,8 @@
22
22
  .bui-step-line::after {
23
23
  display: inline-block;
24
24
  content: "";
25
- width: 1px;
26
- border-left-width: 1px;
25
+ width: var(--step-line-width);
26
+ border-left-width: var(--step-line-width);
27
27
  border-left-style: dotted;
28
28
  height: calc(100% + 11px);
29
29
  }
@@ -41,14 +41,14 @@
41
41
  }
42
42
  .bui-step-icon {
43
43
  flex-shrink: 0;
44
- width: 28px;
44
+ width: var(--step-icon-width);
45
45
  text-align: center;
46
46
  margin: var(--step-icon-margin);
47
- font-size: var(--bui-title-size-4);
47
+ font-size: var(--step-icon-font-size);
48
48
  }
49
49
  .bui-step-icon-active {
50
- width: 12px;
51
- height: 12px;
50
+ width: var(--step-icon-active-width);
51
+ height: var(--step-icon-active-height);
52
52
  position: relative;
53
53
  background-color: var(--bui-color-primary);
54
54
  border-radius: 50%;
@@ -56,7 +56,7 @@
56
56
  display: inline-block;
57
57
  }
58
58
  .bui-step-content {
59
- padding: 3px 0;
59
+ padding: var(--step-content-padding);
60
60
  box-sizing: border-box;
61
61
  flex: 1 0 0;
62
62
  overflow: hidden;
@@ -128,7 +128,7 @@
128
128
  }
129
129
  .bui-step-horizontal .bui-step-line {
130
130
  display: none;
131
- padding: 28px 0 6px;
131
+ padding: var(--step-horizontal-line-padding);
132
132
  }
133
133
  .bui-step-horizontal .bui-step-icon {
134
134
  margin-right: 0;
@@ -1,12 +1,21 @@
1
1
  .bui-steps {
2
+ --font-size: var(--bui-steps-font-size, var(--bui-title-size-3));
2
3
  --title-font-size: var(--bui-title-size-4);
3
4
  --title-font-weight: var(--bui-font-weight-medium);
4
- --subtitle-font-size: var(--bui-text-size-2);
5
- --description-font-size: var(--bui-text-size-3);
6
- --step-icon-margin: var(--bui-spacing-xs) var(--bui-spacing-xs) 0 0;
7
- --step-line-padding: 20px 0 3px 0;
5
+ --subtitle-font-size: var(--bui-step-subtitle-font-size, var(--bui-text-size-2));
6
+ --step-line-padding: var(--bui-step-line-padding, 20px 0 3px 0);
7
+ --step-line-width: var(--bui-step-line-width, 1px);
8
+ --step-line-height: var(--bui-step-line-height, 100%);
9
+ --step-label-horizontal-line-height: var(--bui-step-label-horizontal-line-height, 1.8);
10
+ --step-icon-width: var(--bui-step-icon-width, 28px);
11
+ --step-icon-active-width: var(--bui-step-icon-active-width, 12px);
12
+ --step-icon-active-height: var(--bui-step-icon-active-height, 12px);
13
+ --step-icon-font-size: var(--bui-step-icon-font-size, var(--bui-title-size-4));
14
+ --step-icon-margin: var(--bui-step-icon-margin, var(--bui-spacing-xs) var(--bui-spacing-xs) 0 0);
15
+ --step-content-padding: var(--bui-step-content-padding, 3px 0);
16
+ --step-horizontal-line-padding: var(--bui-step-horizontal-line-padding, 28px 0 6px);
8
17
  display: flex;
9
- font-size: var(--bui-title-size-3);
18
+ font-size: var(--font-size);
10
19
  font-family: var(--bui-font-family);
11
20
  }
12
21
  .bui-steps-vertical {
@@ -1,8 +1,9 @@
1
1
  .bui-swiper {
2
+ --height: var(--bui-swiper-height, 150px);
2
3
  font-family: var(--bui-font-family);
3
4
  }
4
5
  .bui-swiper .swiper-container-wrapper {
5
- height: 150px;
6
+ height: var(--height);
6
7
  }
7
8
  .bui-swiper .swiper-container {
8
9
  height: 100%;