@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.
- package/dist/ActionSheet/ActionSheet.css +6 -3
- package/dist/ActionSheet/ActionSheetItem.css +10 -6
- package/dist/Alert/index.css +14 -8
- package/dist/Avatar/Avatar.css +13 -9
- package/dist/Avatar/AvatarGroup.css +15 -8
- package/dist/Backdrop/Backdrop.css +2 -1
- package/dist/Badge/Badge.css +27 -17
- package/dist/Breadcrumb/Breadcrumb.css +34 -0
- package/dist/Breadcrumb/Breadcrumb.d.ts +5 -0
- package/dist/Breadcrumb/Breadcrumb.js +128 -0
- package/dist/Breadcrumb/Breadcrumb.types.d.ts +49 -0
- package/dist/Breadcrumb/Breadcrumb.types.js +15 -0
- package/dist/Breadcrumb/BreadcrumbItem.d.ts +4 -0
- package/dist/Breadcrumb/BreadcrumbItem.js +78 -0
- package/dist/Breadcrumb/index.d.ts +4 -0
- package/dist/Breadcrumb/index.js +45 -0
- package/dist/Button/Button.css +26 -17
- package/dist/Calendar/Calendar.css +33 -18
- package/dist/Calendar/Calendar.d.ts +1 -1
- package/dist/Calendar/Calendar.js +85 -18
- package/dist/Calendar/Calendar.types.d.ts +33 -0
- package/dist/Card/CardFooter.css +2 -1
- package/dist/Card/CardHeader.css +3 -1
- package/dist/Checkbox/Checkbox.css +7 -5
- package/dist/CitySelector/CitySelector.css +29 -15
- package/dist/CitySelector/CitySelectorCore.js +25 -16
- package/dist/CitySelector/Selector/index.css +4 -4
- package/dist/Collapse/Collapse.css +6 -0
- package/dist/Collapse/Collapse.d.ts +5 -0
- package/dist/Collapse/Collapse.js +165 -0
- package/dist/Collapse/Collapse.types.d.ts +16 -0
- package/dist/Collapse/Collapse.types.js +15 -0
- package/dist/Collapse/index.d.ts +2 -0
- package/dist/Collapse/index.js +41 -0
- package/dist/CollapsePanel/CollapsePanel.css +32 -0
- package/dist/CollapsePanel/CollapsePanel.d.ts +5 -0
- package/dist/CollapsePanel/CollapsePanel.js +159 -0
- package/dist/CollapsePanel/CollapsePanel.types.d.ts +64 -0
- package/dist/CollapsePanel/CollapsePanel.types.js +15 -0
- package/dist/CollapsePanel/CollapsePanelItem.d.ts +4 -0
- package/dist/CollapsePanel/CollapsePanelItem.js +112 -0
- package/dist/CollapsePanel/index.d.ts +4 -0
- package/dist/CollapsePanel/index.js +45 -0
- package/dist/Countdown/Countdown.css +2 -1
- package/dist/Countdown/Countdown.js +3 -0
- package/dist/Dialog/Dialog.d.ts +5 -0
- package/dist/Dialog/Dialog.js +152 -0
- package/dist/Dialog/Dialog.types.d.ts +109 -0
- package/dist/Dialog/Dialog.types.js +15 -0
- package/dist/Dialog/FunctionalDialog.d.ts +3 -0
- package/dist/Dialog/FunctionalDialog.js +204 -0
- package/dist/Dialog/index.css +75 -0
- package/dist/Dialog/index.d.ts +2 -0
- package/dist/Dialog/index.js +41 -0
- package/dist/Divider/Divider.css +6 -4
- package/dist/IconButton/IconButton.css +9 -7
- package/dist/Image/index.css +2 -1
- package/dist/Input/Input.css +10 -5
- package/dist/List/List.css +3 -0
- package/dist/List/ListItem.css +3 -3
- package/dist/List/ListItemContent.css +1 -1
- package/dist/Loading/Loading.css +4 -2
- package/dist/Modal/Modal.miniapp.d.ts +1 -1
- package/dist/NavBar/NavBar.css +9 -5
- package/dist/Picker/Picker.css +25 -29
- package/dist/Picker/Picker.js +31 -11
- package/dist/Picker/Picker.types.d.ts +4 -0
- package/dist/Picker/PickerPanel.css +8 -8
- package/dist/Picker/PickerPanel.js +14 -8
- package/dist/Picker/utils.d.ts +16 -0
- package/dist/Picker/utils.js +32 -2
- package/dist/Popover/Popover.css +97 -0
- package/dist/Popover/Popover.d.ts +5 -0
- package/dist/Popover/Popover.js +186 -0
- package/dist/Popover/Popover.types.d.ts +60 -0
- package/dist/Popover/Popover.types.js +15 -0
- package/dist/Popover/index.d.ts +2 -0
- package/dist/Popover/index.js +41 -0
- package/dist/Portal/Portal.types.d.ts +4 -0
- package/dist/Portal/PortalCore.js +8 -1
- package/dist/Progress/Progress.css +8 -6
- package/dist/Radio/Radio.css +2 -1
- package/dist/Radio/Radio.js +1 -1
- package/dist/Radio/RadioButtonIcon.d.ts +1 -6
- package/dist/Radio/RadioButtonIcon.js +0 -3
- package/dist/Rating/Rating.css +8 -4
- package/dist/Select/Select.css +21 -10
- package/dist/Select/Select.js +1 -1
- package/dist/Select/SelectOption.js +3 -0
- package/dist/Skeleton/Skeleton.css +3 -2
- package/dist/Slider/Slider.css +24 -13
- package/dist/Steps/Step.css +11 -11
- package/dist/Steps/Steps.css +14 -5
- package/dist/Swiper/Swiper.css +2 -1
- package/dist/Switch/Switch.css +31 -16
- package/dist/TabBar/TabBar.css +7 -3
- package/dist/TabBar/TabBarItem.css +0 -1
- package/dist/Tabs/Tab.css +2 -6
- package/dist/Tabs/Tabs.css +7 -4
- package/dist/Tag/Tag.css +7 -10
- package/dist/Tag/TagGroup.css +9 -1
- package/dist/TextArea/TextArea.css +14 -8
- package/dist/ThemeProvider/ThemeProvider.d.ts +4 -0
- package/dist/ThemeProvider/ThemeProvider.js +90 -0
- package/dist/ThemeProvider/ThemeProvider.types.d.ts +127 -0
- package/dist/ThemeProvider/ThemeProvider.types.js +27 -0
- package/dist/ThemeProvider/hooks/ThemeContext.d.ts +4 -0
- package/dist/ThemeProvider/hooks/ThemeContext.js +35 -0
- package/dist/ThemeProvider/hooks/createTheme.d.ts +2 -0
- package/dist/ThemeProvider/hooks/createTheme.js +55 -0
- package/dist/ThemeProvider/hooks/index.d.ts +4 -0
- package/dist/ThemeProvider/hooks/index.js +43 -0
- package/dist/ThemeProvider/hooks/useTheme.d.ts +1 -0
- package/dist/ThemeProvider/hooks/useTheme.js +39 -0
- package/dist/ThemeProvider/index.d.ts +4 -0
- package/dist/ThemeProvider/index.js +45 -0
- package/dist/ThemeProvider/utils/constants.d.ts +38 -0
- package/dist/ThemeProvider/utils/constants.js +65 -0
- package/dist/ThemeProvider/utils/index.d.ts +2 -0
- package/dist/ThemeProvider/utils/index.js +23 -0
- package/dist/ThemeProvider/utils/mountTokens.d.ts +26 -0
- package/dist/ThemeProvider/utils/mountTokens.js +123 -0
- package/dist/Toast/FunctionalToast.d.ts +3 -0
- package/dist/Toast/FunctionalToast.js +177 -0
- package/dist/Toast/Toast.css +56 -0
- package/dist/Toast/Toast.d.ts +5 -0
- package/dist/Toast/Toast.js +121 -0
- package/dist/Toast/Toast.types.d.ts +101 -0
- package/dist/Toast/Toast.types.js +15 -0
- package/dist/Toast/index.d.ts +2 -0
- package/dist/Toast/index.js +41 -0
- package/dist/Tooltip/Tooltip.css +91 -0
- package/dist/Tooltip/Tooltip.d.ts +5 -0
- package/dist/Tooltip/Tooltip.js +177 -0
- package/dist/Tooltip/Tooltip.types.d.ts +51 -0
- package/dist/Tooltip/Tooltip.types.js +15 -0
- package/dist/Tooltip/index.d.ts +2 -0
- package/dist/Tooltip/index.js +41 -0
- package/dist/Transition/Transition.miniapp.js +7 -1
- package/dist/index.d.ts +9 -0
- package/dist/index.js +19 -1
- package/dist/locales/base.d.ts +40 -0
- package/dist/locales/base.js +15 -0
- package/dist/locales/en-US.d.ts +3 -0
- package/dist/locales/en-US.js +69 -0
- package/dist/locales/hooks/useLocaleText.d.ts +3 -0
- package/dist/locales/hooks/useLocaleText.js +43 -0
- package/dist/locales/index.d.ts +5 -0
- package/dist/locales/index.js +49 -0
- package/dist/locales/zh-CN.d.ts +3 -0
- package/dist/locales/zh-CN.js +51 -0
- package/dist/locales/zh-TW.d.ts +3 -0
- package/dist/locales/zh-TW.js +51 -0
- package/es/ActionSheet/ActionSheet.css +6 -3
- package/es/ActionSheet/ActionSheetItem.css +10 -6
- package/es/Alert/index.css +14 -8
- package/es/Avatar/Avatar.css +13 -9
- package/es/Avatar/AvatarGroup.css +15 -8
- package/es/Backdrop/Backdrop.css +2 -1
- package/es/Badge/Badge.css +27 -17
- package/es/Breadcrumb/Breadcrumb.css +34 -0
- package/es/Breadcrumb/Breadcrumb.d.ts +5 -0
- package/es/Breadcrumb/Breadcrumb.js +101 -0
- package/es/Breadcrumb/Breadcrumb.types.d.ts +49 -0
- package/es/Breadcrumb/Breadcrumb.types.js +1 -0
- package/es/Breadcrumb/BreadcrumbItem.d.ts +4 -0
- package/es/Breadcrumb/BreadcrumbItem.js +51 -0
- package/es/Breadcrumb/index.d.ts +4 -0
- package/es/Breadcrumb/index.js +9 -0
- package/es/Button/Button.css +26 -17
- package/es/Calendar/Calendar.css +33 -18
- package/es/Calendar/Calendar.d.ts +1 -1
- package/es/Calendar/Calendar.js +91 -19
- package/es/Calendar/Calendar.types.d.ts +33 -0
- package/es/Card/CardFooter.css +2 -1
- package/es/Card/CardHeader.css +3 -1
- package/es/Checkbox/Checkbox.css +7 -5
- package/es/CitySelector/CitySelector.css +29 -15
- package/es/CitySelector/CitySelectorCore.js +25 -16
- package/es/CitySelector/Selector/index.css +4 -4
- package/es/Collapse/Collapse.css +6 -0
- package/es/Collapse/Collapse.d.ts +5 -0
- package/es/Collapse/Collapse.js +144 -0
- package/es/Collapse/Collapse.types.d.ts +16 -0
- package/es/Collapse/Collapse.types.js +1 -0
- package/es/Collapse/index.d.ts +2 -0
- package/es/Collapse/index.js +6 -0
- package/es/CollapsePanel/CollapsePanel.css +32 -0
- package/es/CollapsePanel/CollapsePanel.d.ts +5 -0
- package/es/CollapsePanel/CollapsePanel.js +132 -0
- package/es/CollapsePanel/CollapsePanel.types.d.ts +64 -0
- package/es/CollapsePanel/CollapsePanel.types.js +1 -0
- package/es/CollapsePanel/CollapsePanelItem.d.ts +4 -0
- package/es/CollapsePanel/CollapsePanelItem.js +85 -0
- package/es/CollapsePanel/index.d.ts +4 -0
- package/es/CollapsePanel/index.js +9 -0
- package/es/Countdown/Countdown.css +2 -1
- package/es/Countdown/Countdown.js +3 -0
- package/es/Dialog/Dialog.d.ts +5 -0
- package/es/Dialog/Dialog.js +125 -0
- package/es/Dialog/Dialog.types.d.ts +109 -0
- package/es/Dialog/Dialog.types.js +1 -0
- package/es/Dialog/FunctionalDialog.d.ts +3 -0
- package/es/Dialog/FunctionalDialog.js +177 -0
- package/es/Dialog/index.css +75 -0
- package/es/Dialog/index.d.ts +2 -0
- package/es/Dialog/index.js +6 -0
- package/es/Divider/Divider.css +6 -4
- package/es/IconButton/IconButton.css +9 -7
- package/es/Image/index.css +2 -1
- package/es/Input/Input.css +10 -5
- package/es/List/List.css +3 -0
- package/es/List/ListItem.css +3 -3
- package/es/List/ListItemContent.css +1 -1
- package/es/Loading/Loading.css +4 -2
- package/es/Modal/Modal.miniapp.d.ts +1 -1
- package/es/NavBar/NavBar.css +9 -5
- package/es/Picker/Picker.css +25 -29
- package/es/Picker/Picker.js +32 -12
- package/es/Picker/Picker.types.d.ts +4 -0
- package/es/Picker/PickerPanel.css +8 -8
- package/es/Picker/PickerPanel.js +14 -8
- package/es/Picker/utils.d.ts +16 -0
- package/es/Picker/utils.js +29 -1
- package/es/Popover/Popover.css +97 -0
- package/es/Popover/Popover.d.ts +5 -0
- package/es/Popover/Popover.js +159 -0
- package/es/Popover/Popover.types.d.ts +60 -0
- package/es/Popover/Popover.types.js +1 -0
- package/es/Popover/index.d.ts +2 -0
- package/es/Popover/index.js +6 -0
- package/es/Portal/Portal.types.d.ts +4 -0
- package/es/Portal/PortalCore.js +8 -1
- package/es/Progress/Progress.css +8 -6
- package/es/Radio/Radio.css +2 -1
- package/es/Radio/Radio.js +1 -1
- package/es/Radio/RadioButtonIcon.d.ts +1 -6
- package/es/Radio/RadioButtonIcon.js +0 -3
- package/es/Rating/Rating.css +8 -4
- package/es/Select/Select.css +21 -10
- package/es/Select/Select.js +1 -1
- package/es/Select/SelectOption.js +3 -0
- package/es/Skeleton/Skeleton.css +3 -2
- package/es/Slider/Slider.css +24 -13
- package/es/Steps/Step.css +11 -11
- package/es/Steps/Steps.css +14 -5
- package/es/Swiper/Swiper.css +2 -1
- package/es/Switch/Switch.css +31 -16
- package/es/TabBar/TabBar.css +7 -3
- package/es/TabBar/TabBarItem.css +0 -1
- package/es/Tabs/Tab.css +2 -6
- package/es/Tabs/Tabs.css +7 -4
- package/es/Tag/Tag.css +7 -10
- package/es/Tag/TagGroup.css +9 -1
- package/es/TextArea/TextArea.css +14 -8
- package/es/ThemeProvider/ThemeProvider.d.ts +4 -0
- package/es/ThemeProvider/ThemeProvider.js +61 -0
- package/es/ThemeProvider/ThemeProvider.types.d.ts +127 -0
- package/es/ThemeProvider/ThemeProvider.types.js +1 -0
- package/es/ThemeProvider/hooks/ThemeContext.d.ts +4 -0
- package/es/ThemeProvider/hooks/ThemeContext.js +6 -0
- package/es/ThemeProvider/hooks/createTheme.d.ts +2 -0
- package/es/ThemeProvider/hooks/createTheme.js +38 -0
- package/es/ThemeProvider/hooks/index.d.ts +4 -0
- package/es/ThemeProvider/hooks/index.js +8 -0
- package/es/ThemeProvider/hooks/useTheme.d.ts +1 -0
- package/es/ThemeProvider/hooks/useTheme.js +10 -0
- package/es/ThemeProvider/index.d.ts +4 -0
- package/es/ThemeProvider/index.js +8 -0
- package/es/ThemeProvider/utils/constants.d.ts +38 -0
- package/es/ThemeProvider/utils/constants.js +40 -0
- package/es/ThemeProvider/utils/index.d.ts +2 -0
- package/es/ThemeProvider/utils/index.js +2 -0
- package/es/ThemeProvider/utils/mountTokens.d.ts +26 -0
- package/es/ThemeProvider/utils/mountTokens.js +88 -0
- package/es/Toast/FunctionalToast.d.ts +3 -0
- package/es/Toast/FunctionalToast.js +150 -0
- package/es/Toast/Toast.css +56 -0
- package/es/Toast/Toast.d.ts +5 -0
- package/es/Toast/Toast.js +99 -0
- package/es/Toast/Toast.types.d.ts +101 -0
- package/es/Toast/Toast.types.js +1 -0
- package/es/Toast/index.d.ts +2 -0
- package/es/Toast/index.js +6 -0
- package/es/Tooltip/Tooltip.css +91 -0
- package/es/Tooltip/Tooltip.d.ts +5 -0
- package/es/Tooltip/Tooltip.js +150 -0
- package/es/Tooltip/Tooltip.types.d.ts +51 -0
- package/es/Tooltip/Tooltip.types.js +1 -0
- package/es/Tooltip/index.d.ts +2 -0
- package/es/Tooltip/index.js +6 -0
- package/es/Transition/Transition.miniapp.js +7 -1
- package/es/index.d.ts +9 -0
- package/es/index.js +9 -0
- package/es/locales/base.d.ts +40 -0
- package/es/locales/base.js +0 -0
- package/es/locales/en-US.d.ts +3 -0
- package/es/locales/en-US.js +50 -0
- package/es/locales/hooks/useLocaleText.d.ts +3 -0
- package/es/locales/hooks/useLocaleText.js +26 -0
- package/es/locales/index.d.ts +5 -0
- package/es/locales/index.js +11 -0
- package/es/locales/zh-CN.d.ts +3 -0
- package/es/locales/zh-CN.js +32 -0
- package/es/locales/zh-TW.d.ts +3 -0
- package/es/locales/zh-TW.js +32 -0
- package/package.json +5 -5
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
9
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
10
|
+
var __spreadValues = (a, b) => {
|
|
11
|
+
for (var prop in b || (b = {}))
|
|
12
|
+
if (__hasOwnProp.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
if (__getOwnPropSymbols)
|
|
15
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
16
|
+
if (__propIsEnum.call(b, prop))
|
|
17
|
+
__defNormalProp(a, prop, b[prop]);
|
|
18
|
+
}
|
|
19
|
+
return a;
|
|
20
|
+
};
|
|
21
|
+
var __objRest = (source, exclude) => {
|
|
22
|
+
var target = {};
|
|
23
|
+
for (var prop in source)
|
|
24
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
25
|
+
target[prop] = source[prop];
|
|
26
|
+
if (source != null && __getOwnPropSymbols)
|
|
27
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
28
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
29
|
+
target[prop] = source[prop];
|
|
30
|
+
}
|
|
31
|
+
return target;
|
|
32
|
+
};
|
|
33
|
+
var __export = (target, all) => {
|
|
34
|
+
for (var name in all)
|
|
35
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
36
|
+
};
|
|
37
|
+
var __copyProps = (to, from, except, desc) => {
|
|
38
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
39
|
+
for (let key of __getOwnPropNames(from))
|
|
40
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
41
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
42
|
+
}
|
|
43
|
+
return to;
|
|
44
|
+
};
|
|
45
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
46
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
47
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
48
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
49
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
50
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
51
|
+
mod
|
|
52
|
+
));
|
|
53
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
54
|
+
var CollapsePanelItem_exports = {};
|
|
55
|
+
__export(CollapsePanelItem_exports, {
|
|
56
|
+
default: () => CollapsePanelItem_default
|
|
57
|
+
});
|
|
58
|
+
module.exports = __toCommonJS(CollapsePanelItem_exports);
|
|
59
|
+
var import_react = __toESM(require("react"));
|
|
60
|
+
var import_clsx = __toESM(require("clsx"));
|
|
61
|
+
var import_Collapse = require("../Collapse");
|
|
62
|
+
const prefixCls = "bui-collapse-panel-item";
|
|
63
|
+
const CollapsePanelItem = /* @__PURE__ */ import_react.default.forwardRef((props, ref) => {
|
|
64
|
+
const _a = props, {
|
|
65
|
+
className,
|
|
66
|
+
style,
|
|
67
|
+
label,
|
|
68
|
+
children,
|
|
69
|
+
icon,
|
|
70
|
+
active,
|
|
71
|
+
onClick
|
|
72
|
+
} = _a, others = __objRest(_a, [
|
|
73
|
+
"className",
|
|
74
|
+
"style",
|
|
75
|
+
"label",
|
|
76
|
+
"children",
|
|
77
|
+
"icon",
|
|
78
|
+
"active",
|
|
79
|
+
"onClick"
|
|
80
|
+
]);
|
|
81
|
+
const isControlledIcon = typeof icon === "function";
|
|
82
|
+
const getIcon = () => {
|
|
83
|
+
return typeof icon === "function" ? icon(active) : icon;
|
|
84
|
+
};
|
|
85
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
86
|
+
"div",
|
|
87
|
+
__spreadValues({
|
|
88
|
+
className: (0, import_clsx.default)(prefixCls, active && `${prefixCls}-active`, className),
|
|
89
|
+
style,
|
|
90
|
+
ref
|
|
91
|
+
}, others),
|
|
92
|
+
/* @__PURE__ */ import_react.default.createElement("div", { className: `${prefixCls}-header`, onClick }, /* @__PURE__ */ import_react.default.createElement("div", { className: `${prefixCls}-header-label` }, label), /* @__PURE__ */ import_react.default.createElement(
|
|
93
|
+
"div",
|
|
94
|
+
{
|
|
95
|
+
className: (0, import_clsx.default)(
|
|
96
|
+
`${prefixCls}-header-icon`,
|
|
97
|
+
`${prefixCls}-header-icon-arrow`,
|
|
98
|
+
{
|
|
99
|
+
[`${prefixCls}-header-icon-arrow-active`]: !isControlledIcon && active
|
|
100
|
+
}
|
|
101
|
+
)
|
|
102
|
+
},
|
|
103
|
+
getIcon()
|
|
104
|
+
)),
|
|
105
|
+
/* @__PURE__ */ import_react.default.createElement(import_Collapse.Collapse, { in: active, direction: "vertical", timeout: 300 }, /* @__PURE__ */ import_react.default.createElement("div", { className: `${prefixCls}-content` }, children))
|
|
106
|
+
);
|
|
107
|
+
});
|
|
108
|
+
CollapsePanelItem.displayName = "BuiCollapsePanelItem";
|
|
109
|
+
CollapsePanelItem.defaultProps = {
|
|
110
|
+
active: false
|
|
111
|
+
};
|
|
112
|
+
var CollapsePanelItem_default = CollapsePanelItem;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var CollapsePanel_exports = {};
|
|
30
|
+
__export(CollapsePanel_exports, {
|
|
31
|
+
CollapsePanel: () => import_CollapsePanel2.default,
|
|
32
|
+
CollapsePanelItem: () => import_CollapsePanelItem.default,
|
|
33
|
+
default: () => import_CollapsePanel.default
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(CollapsePanel_exports);
|
|
36
|
+
var import_CollapsePanel = __toESM(require("./CollapsePanel"));
|
|
37
|
+
var import_CollapsePanel2 = __toESM(require("./CollapsePanel"));
|
|
38
|
+
var import_CollapsePanelItem = __toESM(require("./CollapsePanelItem"));
|
|
39
|
+
__reExport(CollapsePanel_exports, require("./CollapsePanel.types"), module.exports);
|
|
40
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
41
|
+
0 && (module.exports = {
|
|
42
|
+
CollapsePanel,
|
|
43
|
+
CollapsePanelItem,
|
|
44
|
+
...require("./CollapsePanel.types")
|
|
45
|
+
});
|
|
@@ -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:
|
|
38
|
+
margin: var(--slice-unit-margin);
|
|
38
39
|
}
|
|
@@ -112,6 +112,9 @@ const Countdown = (0, import_react.forwardRef)((props, ref) => {
|
|
|
112
112
|
if (serverTimestamp && endTimestamp) {
|
|
113
113
|
setStartTime(serverTimestamp);
|
|
114
114
|
setEndTime(endTimestamp);
|
|
115
|
+
} else if (endTimestamp) {
|
|
116
|
+
setStartTime(Date.now());
|
|
117
|
+
setEndTime(endTimestamp);
|
|
115
118
|
}
|
|
116
119
|
}, [serverTimestamp, endTimestamp]);
|
|
117
120
|
const defaultRender = (timeIns) => {
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defProps = Object.defineProperties;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
+
var __spreadValues = (a, b) => {
|
|
13
|
+
for (var prop in b || (b = {}))
|
|
14
|
+
if (__hasOwnProp.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
if (__getOwnPropSymbols)
|
|
17
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
+
if (__propIsEnum.call(b, prop))
|
|
19
|
+
__defNormalProp(a, prop, b[prop]);
|
|
20
|
+
}
|
|
21
|
+
return a;
|
|
22
|
+
};
|
|
23
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
24
|
+
var __objRest = (source, exclude) => {
|
|
25
|
+
var target = {};
|
|
26
|
+
for (var prop in source)
|
|
27
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
28
|
+
target[prop] = source[prop];
|
|
29
|
+
if (source != null && __getOwnPropSymbols)
|
|
30
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
31
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
32
|
+
target[prop] = source[prop];
|
|
33
|
+
}
|
|
34
|
+
return target;
|
|
35
|
+
};
|
|
36
|
+
var __export = (target, all) => {
|
|
37
|
+
for (var name in all)
|
|
38
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
39
|
+
};
|
|
40
|
+
var __copyProps = (to, from, except, desc) => {
|
|
41
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
42
|
+
for (let key of __getOwnPropNames(from))
|
|
43
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
44
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
45
|
+
}
|
|
46
|
+
return to;
|
|
47
|
+
};
|
|
48
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
49
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
50
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
51
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
52
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
53
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
54
|
+
mod
|
|
55
|
+
));
|
|
56
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
57
|
+
var Dialog_exports = {};
|
|
58
|
+
__export(Dialog_exports, {
|
|
59
|
+
default: () => Dialog_default
|
|
60
|
+
});
|
|
61
|
+
module.exports = __toCommonJS(Dialog_exports);
|
|
62
|
+
var import_clsx = __toESM(require("clsx"));
|
|
63
|
+
var import_react = __toESM(require("react"));
|
|
64
|
+
var import_Input = require("../Input");
|
|
65
|
+
var import_Button = require("../Button");
|
|
66
|
+
var import_locales = require("../locales");
|
|
67
|
+
var import_Modal = __toESM(require("../Modal"));
|
|
68
|
+
var import_ThemeProvider = require("../ThemeProvider");
|
|
69
|
+
var import_index = require("./index.css");
|
|
70
|
+
const prefixCls = "bui-dialog";
|
|
71
|
+
const Dialog = /* @__PURE__ */ import_react.default.forwardRef((props, ref) => {
|
|
72
|
+
const _a = props, {
|
|
73
|
+
open,
|
|
74
|
+
onOk,
|
|
75
|
+
onClose,
|
|
76
|
+
header,
|
|
77
|
+
message,
|
|
78
|
+
type,
|
|
79
|
+
confirmText,
|
|
80
|
+
cancelText,
|
|
81
|
+
placeholder,
|
|
82
|
+
InputProps,
|
|
83
|
+
className,
|
|
84
|
+
theme
|
|
85
|
+
} = _a, others = __objRest(_a, [
|
|
86
|
+
"open",
|
|
87
|
+
"onOk",
|
|
88
|
+
"onClose",
|
|
89
|
+
"header",
|
|
90
|
+
"message",
|
|
91
|
+
"type",
|
|
92
|
+
"confirmText",
|
|
93
|
+
"cancelText",
|
|
94
|
+
"placeholder",
|
|
95
|
+
"InputProps",
|
|
96
|
+
"className",
|
|
97
|
+
"theme"
|
|
98
|
+
]);
|
|
99
|
+
const InputRef = (0, import_react.useRef)(null);
|
|
100
|
+
const themeConfig = (0, import_ThemeProvider.useTheme)(theme);
|
|
101
|
+
const {
|
|
102
|
+
cancel,
|
|
103
|
+
confirm,
|
|
104
|
+
placeholder: placeholderLocaleName
|
|
105
|
+
} = (0, import_locales.useLocaleText)("dialog", themeConfig);
|
|
106
|
+
(0, import_react.useImperativeHandle)(ref, () => {
|
|
107
|
+
return { theme: themeConfig };
|
|
108
|
+
});
|
|
109
|
+
const footerNode = /* @__PURE__ */ import_react.default.createElement("div", { className: `${prefixCls}-body-footer` }, /* @__PURE__ */ import_react.default.createElement(
|
|
110
|
+
import_Button.Button,
|
|
111
|
+
{
|
|
112
|
+
variant: "text",
|
|
113
|
+
onClick: onClose,
|
|
114
|
+
className: `${prefixCls}-body-button`
|
|
115
|
+
},
|
|
116
|
+
cancelText || cancel
|
|
117
|
+
), /* @__PURE__ */ import_react.default.createElement(
|
|
118
|
+
import_Button.Button,
|
|
119
|
+
{
|
|
120
|
+
variant: "text",
|
|
121
|
+
color: "primary",
|
|
122
|
+
onClick: () => {
|
|
123
|
+
var _a2;
|
|
124
|
+
onOk((_a2 = InputRef == null ? void 0 : InputRef.current) == null ? void 0 : _a2.value);
|
|
125
|
+
},
|
|
126
|
+
className: `${prefixCls}-body-button`
|
|
127
|
+
},
|
|
128
|
+
confirmText || confirm
|
|
129
|
+
));
|
|
130
|
+
const inputNode = type === "prompt" && /* @__PURE__ */ import_react.default.createElement(
|
|
131
|
+
import_Input.Input,
|
|
132
|
+
__spreadProps(__spreadValues({}, InputProps), {
|
|
133
|
+
inputRef: InputRef,
|
|
134
|
+
className: `${prefixCls}-body-input`,
|
|
135
|
+
placeholder: `${placeholder || placeholderLocaleName}`
|
|
136
|
+
})
|
|
137
|
+
);
|
|
138
|
+
if (!open)
|
|
139
|
+
return null;
|
|
140
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
141
|
+
import_Modal.default,
|
|
142
|
+
__spreadProps(__spreadValues({}, others), {
|
|
143
|
+
open: true,
|
|
144
|
+
className: (0, import_clsx.default)(prefixCls, className),
|
|
145
|
+
disablePortal: true,
|
|
146
|
+
onClose
|
|
147
|
+
}),
|
|
148
|
+
/* @__PURE__ */ import_react.default.createElement("div", { className: `${prefixCls}-body` }, header && /* @__PURE__ */ import_react.default.createElement("h1", { className: `${prefixCls}-body-title` }, header), message && /* @__PURE__ */ import_react.default.createElement("div", { className: `${prefixCls}-body-desc` }, message), inputNode, footerNode)
|
|
149
|
+
);
|
|
150
|
+
});
|
|
151
|
+
Dialog.displayName = "BuiDialog";
|
|
152
|
+
var Dialog_default = Dialog;
|
|
@@ -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,15 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
14
|
+
var Dialog_types_exports = {};
|
|
15
|
+
module.exports = __toCommonJS(Dialog_types_exports);
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defProps = Object.defineProperties;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
+
var __spreadValues = (a, b) => {
|
|
13
|
+
for (var prop in b || (b = {}))
|
|
14
|
+
if (__hasOwnProp.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
if (__getOwnPropSymbols)
|
|
17
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
+
if (__propIsEnum.call(b, prop))
|
|
19
|
+
__defNormalProp(a, prop, b[prop]);
|
|
20
|
+
}
|
|
21
|
+
return a;
|
|
22
|
+
};
|
|
23
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
24
|
+
var __objRest = (source, exclude) => {
|
|
25
|
+
var target = {};
|
|
26
|
+
for (var prop in source)
|
|
27
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
28
|
+
target[prop] = source[prop];
|
|
29
|
+
if (source != null && __getOwnPropSymbols)
|
|
30
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
31
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
32
|
+
target[prop] = source[prop];
|
|
33
|
+
}
|
|
34
|
+
return target;
|
|
35
|
+
};
|
|
36
|
+
var __export = (target, all) => {
|
|
37
|
+
for (var name in all)
|
|
38
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
39
|
+
};
|
|
40
|
+
var __copyProps = (to, from, except, desc) => {
|
|
41
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
42
|
+
for (let key of __getOwnPropNames(from))
|
|
43
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
44
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
45
|
+
}
|
|
46
|
+
return to;
|
|
47
|
+
};
|
|
48
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
49
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
50
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
51
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
52
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
53
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
54
|
+
mod
|
|
55
|
+
));
|
|
56
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
57
|
+
var __async = (__this, __arguments, generator) => {
|
|
58
|
+
return new Promise((resolve, reject) => {
|
|
59
|
+
var fulfilled = (value) => {
|
|
60
|
+
try {
|
|
61
|
+
step(generator.next(value));
|
|
62
|
+
} catch (e) {
|
|
63
|
+
reject(e);
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
var rejected = (value) => {
|
|
67
|
+
try {
|
|
68
|
+
step(generator.throw(value));
|
|
69
|
+
} catch (e) {
|
|
70
|
+
reject(e);
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
74
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
75
|
+
});
|
|
76
|
+
};
|
|
77
|
+
var FunctionalDialog_exports = {};
|
|
78
|
+
__export(FunctionalDialog_exports, {
|
|
79
|
+
default: () => FunctionalDialog_default
|
|
80
|
+
});
|
|
81
|
+
module.exports = __toCommonJS(FunctionalDialog_exports);
|
|
82
|
+
var import_react = __toESM(require("react"));
|
|
83
|
+
var import_utils = require("@bifrostui/utils");
|
|
84
|
+
var import_Dialog = __toESM(require("./Dialog"));
|
|
85
|
+
const { isValidElement, Component } = import_react.default;
|
|
86
|
+
const formatProps = (props) => {
|
|
87
|
+
if (typeof props === "string" || isValidElement(props)) {
|
|
88
|
+
return { message: props };
|
|
89
|
+
}
|
|
90
|
+
return props;
|
|
91
|
+
};
|
|
92
|
+
const DialogGenerator = (options) => {
|
|
93
|
+
const rootWrapper = document.createElement("div");
|
|
94
|
+
const rootElement = (0, import_utils.getRootElement)();
|
|
95
|
+
rootElement.appendChild(rootWrapper);
|
|
96
|
+
const DialogComponent = () => {
|
|
97
|
+
const _a = options, { onConfirm, onCancel, ref } = _a, others = __objRest(_a, ["onConfirm", "onCancel", "ref"]);
|
|
98
|
+
const [visible, setVisible] = (0, import_react.useState)(false);
|
|
99
|
+
const close = (0, import_react.useCallback)(() => {
|
|
100
|
+
setVisible(false);
|
|
101
|
+
setTimeout(() => {
|
|
102
|
+
const unmountRes = (0, import_utils.unmount)(rootWrapper);
|
|
103
|
+
if (unmountRes && rootWrapper.parentNode) {
|
|
104
|
+
rootWrapper.parentNode.removeChild(rootWrapper);
|
|
105
|
+
}
|
|
106
|
+
}, 150);
|
|
107
|
+
}, [rootWrapper]);
|
|
108
|
+
(0, import_react.useEffect)(() => {
|
|
109
|
+
setVisible(true);
|
|
110
|
+
}, []);
|
|
111
|
+
const dispatch = (action, val) => __async(void 0, null, function* () {
|
|
112
|
+
if (action === true) {
|
|
113
|
+
try {
|
|
114
|
+
yield onConfirm == null ? void 0 : onConfirm(val);
|
|
115
|
+
} catch (error) {
|
|
116
|
+
}
|
|
117
|
+
} else if (action === false) {
|
|
118
|
+
try {
|
|
119
|
+
yield onCancel == null ? void 0 : onCancel();
|
|
120
|
+
} catch (error) {
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
close();
|
|
124
|
+
});
|
|
125
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
126
|
+
import_Dialog.default,
|
|
127
|
+
__spreadProps(__spreadValues({
|
|
128
|
+
ref
|
|
129
|
+
}, others), {
|
|
130
|
+
open: visible,
|
|
131
|
+
onOk: (val) => dispatch(true, val),
|
|
132
|
+
onClose: () => dispatch(false)
|
|
133
|
+
})
|
|
134
|
+
);
|
|
135
|
+
};
|
|
136
|
+
return (0, import_utils.render)(/* @__PURE__ */ import_react.default.createElement(DialogComponent, null), rootWrapper);
|
|
137
|
+
};
|
|
138
|
+
const Dialog = (props) => {
|
|
139
|
+
const options = formatProps(props);
|
|
140
|
+
const _a = options, { onConfirm, onCancel } = _a, rest = __objRest(_a, ["onConfirm", "onCancel"]);
|
|
141
|
+
return new Promise((resolve) => {
|
|
142
|
+
DialogGenerator(__spreadProps(__spreadValues({}, rest), {
|
|
143
|
+
onConfirm: (val) => __async(void 0, null, function* () {
|
|
144
|
+
yield onConfirm == null ? void 0 : onConfirm(val);
|
|
145
|
+
if (rest.type === "prompt")
|
|
146
|
+
resolve(val);
|
|
147
|
+
else
|
|
148
|
+
resolve(true);
|
|
149
|
+
}),
|
|
150
|
+
onCancel: () => __async(void 0, null, function* () {
|
|
151
|
+
yield onCancel == null ? void 0 : onCancel();
|
|
152
|
+
resolve(false);
|
|
153
|
+
})
|
|
154
|
+
}));
|
|
155
|
+
});
|
|
156
|
+
};
|
|
157
|
+
Dialog.prototype = Component.prototype;
|
|
158
|
+
const confirm = (options) => {
|
|
159
|
+
return Dialog(__spreadValues({
|
|
160
|
+
type: "confirm"
|
|
161
|
+
}, formatProps(options)));
|
|
162
|
+
};
|
|
163
|
+
const prompt = (options) => {
|
|
164
|
+
return Dialog(__spreadValues({
|
|
165
|
+
type: "prompt"
|
|
166
|
+
}, formatProps(options)));
|
|
167
|
+
};
|
|
168
|
+
const useDialog = () => {
|
|
169
|
+
const holderRef = import_react.default.useRef(null);
|
|
170
|
+
const wrapAPI = (props) => {
|
|
171
|
+
const options = __spreadValues({ theme: holderRef.current.theme }, formatProps(props));
|
|
172
|
+
const _a = options, { onConfirm, onCancel } = _a, rest = __objRest(_a, ["onConfirm", "onCancel"]);
|
|
173
|
+
return new Promise((resolve) => {
|
|
174
|
+
DialogGenerator(__spreadProps(__spreadValues({}, rest), {
|
|
175
|
+
onConfirm: (val) => __async(void 0, null, function* () {
|
|
176
|
+
yield onConfirm == null ? void 0 : onConfirm(val);
|
|
177
|
+
if (rest.type === "prompt")
|
|
178
|
+
resolve(val);
|
|
179
|
+
else
|
|
180
|
+
resolve(true);
|
|
181
|
+
}),
|
|
182
|
+
onCancel: () => __async(void 0, null, function* () {
|
|
183
|
+
yield onCancel == null ? void 0 : onCancel();
|
|
184
|
+
resolve(false);
|
|
185
|
+
})
|
|
186
|
+
}));
|
|
187
|
+
});
|
|
188
|
+
};
|
|
189
|
+
wrapAPI.confirm = (options) => Dialog(__spreadProps(__spreadValues({
|
|
190
|
+
type: "confirm"
|
|
191
|
+
}, formatProps(options)), {
|
|
192
|
+
theme: holderRef.current.theme
|
|
193
|
+
}));
|
|
194
|
+
wrapAPI.prompt = (options) => Dialog(__spreadProps(__spreadValues({
|
|
195
|
+
type: "prompt"
|
|
196
|
+
}, formatProps(options)), {
|
|
197
|
+
theme: holderRef.current.theme
|
|
198
|
+
}));
|
|
199
|
+
return [wrapAPI, /* @__PURE__ */ import_react.default.createElement(import_Dialog.default, { key: "dialog-holder", ref: holderRef })];
|
|
200
|
+
};
|
|
201
|
+
Dialog.confirm = confirm;
|
|
202
|
+
Dialog.prompt = prompt;
|
|
203
|
+
Dialog.useDialog = useDialog;
|
|
204
|
+
var FunctionalDialog_default = Dialog;
|