@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,85 @@
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 from "react";
30
+ import clsx from "clsx";
31
+ import { Collapse } from "../Collapse";
32
+ const prefixCls = "bui-collapse-panel-item";
33
+ const CollapsePanelItem = /* @__PURE__ */ React.forwardRef((props, ref) => {
34
+ const _a = props, {
35
+ className,
36
+ style,
37
+ label,
38
+ children,
39
+ icon,
40
+ active,
41
+ onClick
42
+ } = _a, others = __objRest(_a, [
43
+ "className",
44
+ "style",
45
+ "label",
46
+ "children",
47
+ "icon",
48
+ "active",
49
+ "onClick"
50
+ ]);
51
+ const isControlledIcon = typeof icon === "function";
52
+ const getIcon = () => {
53
+ return typeof icon === "function" ? icon(active) : icon;
54
+ };
55
+ return /* @__PURE__ */ React.createElement(
56
+ "div",
57
+ __spreadValues({
58
+ className: clsx(prefixCls, active && `${prefixCls}-active`, className),
59
+ style,
60
+ ref
61
+ }, others),
62
+ /* @__PURE__ */ React.createElement("div", { className: `${prefixCls}-header`, onClick }, /* @__PURE__ */ React.createElement("div", { className: `${prefixCls}-header-label` }, label), /* @__PURE__ */ React.createElement(
63
+ "div",
64
+ {
65
+ className: clsx(
66
+ `${prefixCls}-header-icon`,
67
+ `${prefixCls}-header-icon-arrow`,
68
+ {
69
+ [`${prefixCls}-header-icon-arrow-active`]: !isControlledIcon && active
70
+ }
71
+ )
72
+ },
73
+ getIcon()
74
+ )),
75
+ /* @__PURE__ */ React.createElement(Collapse, { in: active, direction: "vertical", timeout: 300 }, /* @__PURE__ */ React.createElement("div", { className: `${prefixCls}-content` }, children))
76
+ );
77
+ });
78
+ CollapsePanelItem.displayName = "BuiCollapsePanelItem";
79
+ CollapsePanelItem.defaultProps = {
80
+ active: false
81
+ };
82
+ var CollapsePanelItem_default = CollapsePanelItem;
83
+ export {
84
+ CollapsePanelItem_default as default
85
+ };
@@ -0,0 +1,4 @@
1
+ export { default } from './CollapsePanel';
2
+ export { default as CollapsePanel } from './CollapsePanel';
3
+ export { default as CollapsePanelItem } from './CollapsePanelItem';
4
+ export * from './CollapsePanel.types';
@@ -0,0 +1,9 @@
1
+ import { default as default2 } from "./CollapsePanel";
2
+ import { default as default3 } from "./CollapsePanel";
3
+ import { default as default4 } from "./CollapsePanelItem";
4
+ export * from "./CollapsePanel.types";
5
+ export {
6
+ default3 as CollapsePanel,
7
+ default4 as CollapsePanelItem,
8
+ default2 as default
9
+ };
@@ -2,6 +2,7 @@
2
2
  --font-size: var(--bui-countdown-font-size, var(--bui-text-size-1));
3
3
  --color: var(--bui-countdown-color, var(--bui-color-fg-default));
4
4
  --font-weight: var(--bui-countdown-font-weight, var(--bui-font-weight-normal));
5
+ --slice-unit-margin: var(--bui-countdown-slice-unit-margin, 0 2px);
5
6
  display: flex;
6
7
  flex-direction: row;
7
8
  align-items: center;
@@ -34,5 +35,5 @@
34
35
  sans-serif;
35
36
  }
36
37
  .bui-countdown-slice-unit {
37
- margin: 0 2px;
38
+ margin: var(--slice-unit-margin);
38
39
  }
@@ -82,6 +82,9 @@ const Countdown = forwardRef((props, ref) => {
82
82
  if (serverTimestamp && endTimestamp) {
83
83
  setStartTime(serverTimestamp);
84
84
  setEndTime(endTimestamp);
85
+ } else if (endTimestamp) {
86
+ setStartTime(Date.now());
87
+ setEndTime(endTimestamp);
85
88
  }
86
89
  }, [serverTimestamp, endTimestamp]);
87
90
  const defaultRender = (timeIns) => {
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import { DialogProps, DialogRef } from './Dialog.types';
3
+ import './index.less';
4
+ declare const Dialog: React.ForwardRefExoticComponent<Omit<DialogProps, "ref"> & React.RefAttributes<DialogRef>>;
5
+ export default Dialog;
@@ -0,0 +1,125 @@
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, { useImperativeHandle, useRef } from "react";
34
+ import { Input } from "../Input";
35
+ import { Button } from "../Button";
36
+ import { useLocaleText } from "../locales";
37
+ import Modal from "../Modal";
38
+ import { useTheme } from "../ThemeProvider";
39
+ import "./index.css";
40
+ const prefixCls = "bui-dialog";
41
+ const Dialog = /* @__PURE__ */ React.forwardRef((props, ref) => {
42
+ const _a = props, {
43
+ open,
44
+ onOk,
45
+ onClose,
46
+ header,
47
+ message,
48
+ type,
49
+ confirmText,
50
+ cancelText,
51
+ placeholder,
52
+ InputProps,
53
+ className,
54
+ theme
55
+ } = _a, others = __objRest(_a, [
56
+ "open",
57
+ "onOk",
58
+ "onClose",
59
+ "header",
60
+ "message",
61
+ "type",
62
+ "confirmText",
63
+ "cancelText",
64
+ "placeholder",
65
+ "InputProps",
66
+ "className",
67
+ "theme"
68
+ ]);
69
+ const InputRef = useRef(null);
70
+ const themeConfig = useTheme(theme);
71
+ const {
72
+ cancel,
73
+ confirm,
74
+ placeholder: placeholderLocaleName
75
+ } = useLocaleText("dialog", themeConfig);
76
+ useImperativeHandle(ref, () => {
77
+ return { theme: themeConfig };
78
+ });
79
+ const footerNode = /* @__PURE__ */ React.createElement("div", { className: `${prefixCls}-body-footer` }, /* @__PURE__ */ React.createElement(
80
+ Button,
81
+ {
82
+ variant: "text",
83
+ onClick: onClose,
84
+ className: `${prefixCls}-body-button`
85
+ },
86
+ cancelText || cancel
87
+ ), /* @__PURE__ */ React.createElement(
88
+ Button,
89
+ {
90
+ variant: "text",
91
+ color: "primary",
92
+ onClick: () => {
93
+ var _a2;
94
+ onOk((_a2 = InputRef == null ? void 0 : InputRef.current) == null ? void 0 : _a2.value);
95
+ },
96
+ className: `${prefixCls}-body-button`
97
+ },
98
+ confirmText || confirm
99
+ ));
100
+ const inputNode = type === "prompt" && /* @__PURE__ */ React.createElement(
101
+ Input,
102
+ __spreadProps(__spreadValues({}, InputProps), {
103
+ inputRef: InputRef,
104
+ className: `${prefixCls}-body-input`,
105
+ placeholder: `${placeholder || placeholderLocaleName}`
106
+ })
107
+ );
108
+ if (!open)
109
+ return null;
110
+ return /* @__PURE__ */ React.createElement(
111
+ Modal,
112
+ __spreadProps(__spreadValues({}, others), {
113
+ open: true,
114
+ className: clsx(prefixCls, className),
115
+ disablePortal: true,
116
+ onClose
117
+ }),
118
+ /* @__PURE__ */ React.createElement("div", { className: `${prefixCls}-body` }, header && /* @__PURE__ */ React.createElement("h1", { className: `${prefixCls}-body-title` }, header), message && /* @__PURE__ */ React.createElement("div", { className: `${prefixCls}-body-desc` }, message), inputNode, footerNode)
119
+ );
120
+ });
121
+ Dialog.displayName = "BuiDialog";
122
+ var Dialog_default = Dialog;
123
+ export {
124
+ Dialog_default as default
125
+ };
@@ -0,0 +1,109 @@
1
+ import React, { ReactNode } from 'react';
2
+ import { ModalProps } from '../Modal/Modal.types';
3
+ import { InputProps } from '../Input/Input.types';
4
+ import { ThemeProps } from '../ThemeProvider/ThemeProvider.types';
5
+ /**
6
+ * 对话框类型
7
+ */
8
+ export type DialogType = 'confirm' | 'prompt';
9
+ export type Dispatch = (action: boolean, val?: string) => void;
10
+ export type DialogRef = {
11
+ theme?: ThemeProps;
12
+ };
13
+ export interface DialogProps extends ModalProps {
14
+ /**
15
+ * 对话框类型
16
+ * @default confirm
17
+ */
18
+ type?: DialogType;
19
+ /**
20
+ * 自定义标题
21
+ */
22
+ header?: ReactNode;
23
+ /**
24
+ * 自定义内容
25
+ */
26
+ message?: ReactNode;
27
+ /**
28
+ * 输入框占位文本
29
+ */
30
+ placeholder?: string;
31
+ /**
32
+ * 透传给内部Input组件的属性
33
+ */
34
+ InputProps?: Partial<InputProps>;
35
+ /**
36
+ * 确认文本内容
37
+ */
38
+ confirmText?: ReactNode;
39
+ /**
40
+ * 取消文本内容
41
+ */
42
+ cancelText?: ReactNode;
43
+ /**
44
+ * theme 主题定制
45
+ */
46
+ theme?: ThemeProps;
47
+ /**
48
+ * 确认回调
49
+ */
50
+ onOk?: (val?: string) => void;
51
+ /**
52
+ * 取消回调
53
+ */
54
+ onClose?: () => void;
55
+ }
56
+ /**
57
+ * 函数式调用配置参数
58
+ */
59
+ export type DialogOptions = Omit<DialogProps, 'placeholder' | 'inputProps' | 'onOk' | 'onClose'> & {
60
+ /**
61
+ * 确认回调
62
+ */
63
+ onConfirm?: (val?: string) => void | Promise<void>;
64
+ /**
65
+ * 取消回调
66
+ */
67
+ onCancel?: () => void | Promise<void>;
68
+ };
69
+ /**
70
+ * prompt函数式调用配置参数
71
+ */
72
+ export type PromptOptions = (DialogOptions & {
73
+ /**
74
+ * 输入框占位文本
75
+ */
76
+ placeholder?: string;
77
+ /**
78
+ * 内部<input>标签的标准属性
79
+ */
80
+ inputProps?: React.InputHTMLAttributes<HTMLInputElement>;
81
+ }) | string;
82
+ /**
83
+ * confirm函数式调用配置参数
84
+ */
85
+ export type ConfirmOptions = DialogOptions | string;
86
+ /**
87
+ * Dialog函数式调用返回值类型
88
+ */
89
+ export type DialogPromise = Promise<boolean | string>;
90
+ /**
91
+ * Dialog Instance
92
+ */
93
+ export interface DialogFunction {
94
+ /**
95
+ * 直接调用显示确认框 Dialog
96
+ */
97
+ (options: ConfirmOptions): DialogPromise;
98
+ /**
99
+ * 显示确认框 Dialog.confirm
100
+ */
101
+ confirm?: (options: ConfirmOptions) => DialogPromise;
102
+ /**
103
+ * 显示提示对话框 Dialog.prompt
104
+ */
105
+ prompt?: (options: PromptOptions, val?: string) => DialogPromise;
106
+ }
107
+ export interface DialogInstance extends DialogFunction {
108
+ useDialog: () => [DialogFunction, React.JSX.Element];
109
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,3 @@
1
+ import { DialogInstance } from './Dialog.types';
2
+ declare const Dialog: DialogInstance;
3
+ export default Dialog;
@@ -0,0 +1,177 @@
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
+ 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
+ import React, { useCallback, useEffect, useState } from "react";
53
+ import { getRootElement, render, unmount } from "@bifrostui/utils";
54
+ import Popup from "./Dialog";
55
+ const { isValidElement, Component } = React;
56
+ const formatProps = (props) => {
57
+ if (typeof props === "string" || isValidElement(props)) {
58
+ return { message: props };
59
+ }
60
+ return props;
61
+ };
62
+ const DialogGenerator = (options) => {
63
+ const rootWrapper = document.createElement("div");
64
+ const rootElement = getRootElement();
65
+ rootElement.appendChild(rootWrapper);
66
+ const DialogComponent = () => {
67
+ const _a = options, { onConfirm, onCancel, ref } = _a, others = __objRest(_a, ["onConfirm", "onCancel", "ref"]);
68
+ const [visible, setVisible] = useState(false);
69
+ const close = useCallback(() => {
70
+ setVisible(false);
71
+ setTimeout(() => {
72
+ const unmountRes = unmount(rootWrapper);
73
+ if (unmountRes && rootWrapper.parentNode) {
74
+ rootWrapper.parentNode.removeChild(rootWrapper);
75
+ }
76
+ }, 150);
77
+ }, [rootWrapper]);
78
+ useEffect(() => {
79
+ setVisible(true);
80
+ }, []);
81
+ const dispatch = (action, val) => __async(void 0, null, function* () {
82
+ if (action === true) {
83
+ try {
84
+ yield onConfirm == null ? void 0 : onConfirm(val);
85
+ } catch (error) {
86
+ }
87
+ } else if (action === false) {
88
+ try {
89
+ yield onCancel == null ? void 0 : onCancel();
90
+ } catch (error) {
91
+ }
92
+ }
93
+ close();
94
+ });
95
+ return /* @__PURE__ */ React.createElement(
96
+ Popup,
97
+ __spreadProps(__spreadValues({
98
+ ref
99
+ }, others), {
100
+ open: visible,
101
+ onOk: (val) => dispatch(true, val),
102
+ onClose: () => dispatch(false)
103
+ })
104
+ );
105
+ };
106
+ return render(/* @__PURE__ */ React.createElement(DialogComponent, null), rootWrapper);
107
+ };
108
+ const Dialog = (props) => {
109
+ const options = formatProps(props);
110
+ const _a = options, { onConfirm, onCancel } = _a, rest = __objRest(_a, ["onConfirm", "onCancel"]);
111
+ return new Promise((resolve) => {
112
+ DialogGenerator(__spreadProps(__spreadValues({}, rest), {
113
+ onConfirm: (val) => __async(void 0, null, function* () {
114
+ yield onConfirm == null ? void 0 : onConfirm(val);
115
+ if (rest.type === "prompt")
116
+ resolve(val);
117
+ else
118
+ resolve(true);
119
+ }),
120
+ onCancel: () => __async(void 0, null, function* () {
121
+ yield onCancel == null ? void 0 : onCancel();
122
+ resolve(false);
123
+ })
124
+ }));
125
+ });
126
+ };
127
+ Dialog.prototype = Component.prototype;
128
+ const confirm = (options) => {
129
+ return Dialog(__spreadValues({
130
+ type: "confirm"
131
+ }, formatProps(options)));
132
+ };
133
+ const prompt = (options) => {
134
+ return Dialog(__spreadValues({
135
+ type: "prompt"
136
+ }, formatProps(options)));
137
+ };
138
+ const useDialog = () => {
139
+ const holderRef = React.useRef(null);
140
+ const wrapAPI = (props) => {
141
+ const options = __spreadValues({ theme: holderRef.current.theme }, formatProps(props));
142
+ const _a = options, { onConfirm, onCancel } = _a, rest = __objRest(_a, ["onConfirm", "onCancel"]);
143
+ return new Promise((resolve) => {
144
+ DialogGenerator(__spreadProps(__spreadValues({}, rest), {
145
+ onConfirm: (val) => __async(void 0, null, function* () {
146
+ yield onConfirm == null ? void 0 : onConfirm(val);
147
+ if (rest.type === "prompt")
148
+ resolve(val);
149
+ else
150
+ resolve(true);
151
+ }),
152
+ onCancel: () => __async(void 0, null, function* () {
153
+ yield onCancel == null ? void 0 : onCancel();
154
+ resolve(false);
155
+ })
156
+ }));
157
+ });
158
+ };
159
+ wrapAPI.confirm = (options) => Dialog(__spreadProps(__spreadValues({
160
+ type: "confirm"
161
+ }, formatProps(options)), {
162
+ theme: holderRef.current.theme
163
+ }));
164
+ wrapAPI.prompt = (options) => Dialog(__spreadProps(__spreadValues({
165
+ type: "prompt"
166
+ }, formatProps(options)), {
167
+ theme: holderRef.current.theme
168
+ }));
169
+ return [wrapAPI, /* @__PURE__ */ React.createElement(Popup, { key: "dialog-holder", ref: holderRef })];
170
+ };
171
+ Dialog.confirm = confirm;
172
+ Dialog.prompt = prompt;
173
+ Dialog.useDialog = useDialog;
174
+ var FunctionalDialog_default = Dialog;
175
+ export {
176
+ FunctionalDialog_default as default
177
+ };
@@ -0,0 +1,75 @@
1
+ .bui-dialog {
2
+ --max-width: var(--bui-dialog-max-width, 300px);
3
+ --border-radius: var(--bui-dialog-border-radius, var(--bui-shape-radius-drawer));
4
+ --title-padding: var(--bui-dialog-title-padding, 0 40px 9px);
5
+ --desc-padding: var(--bui-dialog-desc-padding, 0 24px);
6
+ --footer-margin-top: var(--bui-dialog-footer-margin-top, 15px);
7
+ --button-height: var(--bui-dialog-button-height, 53px);
8
+ --button-line-height: var(--bui-dialog-button-line-height, 25px);
9
+ --button-padding: var(--bui-dialog-button-padding, 12px 0 13px);
10
+ --button-font-size: var(--bui-dialog-button-font-size, 17px);
11
+ --button-border-left: var(--bui-dialog-button-border-left, 1px solid rgba(0, 0, 0, 0.05));
12
+ --button-active-background-color: var(--bui-dialog-button-active-background-color, rgba(54, 57, 64, 0.05));
13
+ display: flex;
14
+ align-items: center;
15
+ justify-content: center;
16
+ }
17
+ .bui-dialog-body {
18
+ padding-top: 21px;
19
+ min-width: var(--max-width);
20
+ margin: 0 auto;
21
+ border-radius: var(--border-radius);
22
+ background-clip: padding-box;
23
+ background-color: var(--bui-color-bg-view);
24
+ line-height: 21px;
25
+ }
26
+ .bui-dialog-body-title {
27
+ padding: var(--title-padding);
28
+ font-size: var(--bui-title-size-2);
29
+ text-align: center;
30
+ color: var(--bui-color-fg-default);
31
+ font-weight: var(--bui-font-weight-medium);
32
+ }
33
+ .bui-dialog-body-title + .bui-dialog-body-footer {
34
+ margin-top: var(--bui-spacing-sm);
35
+ }
36
+ .bui-dialog-body-desc {
37
+ padding: var(--desc-padding);
38
+ color: var(--bui-color-fg-muted);
39
+ font-size: var(--bui-title-size-4);
40
+ text-align: center;
41
+ }
42
+ .bui-dialog-body-desc:first-child {
43
+ padding-top: 0;
44
+ }
45
+ .bui-dialog-body-footer {
46
+ margin-top: var(--footer-margin-top);
47
+ border-top: 1px solid rgba(0, 0, 0, 0.05);
48
+ display: -webkit-box;
49
+ display: flex;
50
+ }
51
+ .bui-dialog-body-input {
52
+ width: calc(100% - 48px);
53
+ margin: 14px 24px 0;
54
+ }
55
+ .bui-dialog-body-button {
56
+ flex: 1;
57
+ display: block;
58
+ width: 100%;
59
+ height: var(--button-height);
60
+ line-height: var(--button-line-height);
61
+ padding: var(--button-padding);
62
+ font-size: var(--button-font-size);
63
+ border: 0;
64
+ outline: 0;
65
+ border-left: var(--button-border-left);
66
+ border-radius: 0;
67
+ text-align: center;
68
+ box-sizing: border-box;
69
+ }
70
+ .bui-dialog-body-button:first-child {
71
+ border: none;
72
+ }
73
+ .bui-dialog-body-button:active {
74
+ background-color: var(--button-active-background-color);
75
+ }
@@ -0,0 +1,2 @@
1
+ export { default, default as Dialog } from './FunctionalDialog';
2
+ export * from './Dialog.types';
@@ -0,0 +1,6 @@
1
+ import { default as default2, default as default3 } from "./FunctionalDialog";
2
+ export * from "./Dialog.types";
3
+ export {
4
+ default3 as Dialog,
5
+ default2 as default
6
+ };
@@ -1,18 +1,20 @@
1
1
  .bui-divider {
2
2
  --height: var(--bui-divider-height, 100%);
3
3
  --width: var(--bui-divider-width, 100%);
4
+ --border-width: var(--bui-divider-border-width, 1px);
5
+ --line-width: var(--bui-divider-line-width, 40px);
4
6
  border-color: var(--bui-color-border-default);
5
7
  font-family: var(--bui-font-family);
6
8
  }
7
9
  .bui-divider-vertical {
8
10
  height: var(--height);
9
11
  display: inline-block;
10
- border-right-width: 1px;
12
+ border-right-width: var(--border-width);
11
13
  border-right-style: solid;
12
14
  }
13
15
  .bui-divider-horizontal {
14
16
  width: var(--width);
15
- border-bottom-width: 1px;
17
+ border-bottom-width: var(--border-width);
16
18
  border-bottom-style: solid;
17
19
  }
18
20
  .bui-divider-vertical-dashed {
@@ -29,8 +31,8 @@
29
31
  justify-content: center;
30
32
  }
31
33
  .bui-divider-line {
32
- width: 40px;
33
- border-bottom-width: 1px;
34
+ width: var(--line-width);
35
+ border-bottom-width: var(--border-width);
34
36
  border-bottom-style: solid;
35
37
  border-color: var(--bui-color-border-default);
36
38
  }