@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,123 @@
|
|
|
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 __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
var mountTokens_exports = {};
|
|
29
|
+
__export(mountTokens_exports, {
|
|
30
|
+
mountResponsiveTokens: () => mountResponsiveTokens,
|
|
31
|
+
mountTokens: () => mountTokens,
|
|
32
|
+
overrideBuiltInThemes: () => overrideBuiltInThemes
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(mountTokens_exports);
|
|
35
|
+
var import_react = __toESM(require("react"));
|
|
36
|
+
var import_utils = require("@bifrostui/utils");
|
|
37
|
+
var import_constants = require("./constants");
|
|
38
|
+
const updateTokens = (options) => {
|
|
39
|
+
const { isRoot, rootString, container, containerId } = options || {};
|
|
40
|
+
if (import_utils.isMini)
|
|
41
|
+
return;
|
|
42
|
+
const style = document.createElement("style");
|
|
43
|
+
style.type = "text/css";
|
|
44
|
+
style.appendChild(document.createTextNode(rootString));
|
|
45
|
+
let containerNode;
|
|
46
|
+
if (isRoot) {
|
|
47
|
+
containerNode = document.head;
|
|
48
|
+
} else if (containerId && container && import_react.default.isValidElement(container)) {
|
|
49
|
+
containerNode = document.querySelector(`.${containerId}`);
|
|
50
|
+
}
|
|
51
|
+
if (containerNode) {
|
|
52
|
+
containerNode.appendChild(style);
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
const mountResponsiveTokens = (options) => {
|
|
56
|
+
const { responsive, breakpoints = import_constants.breakpoints } = options || {};
|
|
57
|
+
if (!responsive)
|
|
58
|
+
return;
|
|
59
|
+
const modeSelector = import_constants.rootSelector.defaultLight;
|
|
60
|
+
let rootString = `${modeSelector.join(",")} { `;
|
|
61
|
+
Object.entries(responsive).forEach((config) => {
|
|
62
|
+
const [size, tokenConfig] = config || [];
|
|
63
|
+
if (!size || !tokenConfig)
|
|
64
|
+
return;
|
|
65
|
+
const cssVariablesString = Object.entries(tokenConfig || {}).reduce(
|
|
66
|
+
(acc, [key, value]) => {
|
|
67
|
+
return `${acc} ${key}: ${value};`;
|
|
68
|
+
},
|
|
69
|
+
""
|
|
70
|
+
);
|
|
71
|
+
const mediaQuery = size === "xs" ? "max-width" : "min-width";
|
|
72
|
+
rootString += `@media (${mediaQuery}: ${breakpoints[size]}) { ${cssVariablesString} }`;
|
|
73
|
+
});
|
|
74
|
+
rootString = `${rootString} }`;
|
|
75
|
+
updateTokens({ isRoot: true, rootString });
|
|
76
|
+
};
|
|
77
|
+
const overrideBuiltInThemes = (tokenOptions) => {
|
|
78
|
+
if (!tokenOptions)
|
|
79
|
+
return;
|
|
80
|
+
Object.keys(import_constants.rootSelector).forEach((selectorKey) => {
|
|
81
|
+
const modeSelector = import_constants.rootSelector[selectorKey];
|
|
82
|
+
const token = tokenOptions[`${selectorKey}Token`];
|
|
83
|
+
if (token) {
|
|
84
|
+
let rootString = `${modeSelector.join(",")} { `;
|
|
85
|
+
const cssVariablesString = Object.entries(token).reduce(
|
|
86
|
+
(acc, [key, value]) => {
|
|
87
|
+
return `${acc} ${key}: ${value};`;
|
|
88
|
+
},
|
|
89
|
+
""
|
|
90
|
+
);
|
|
91
|
+
rootString = `${rootString} ${cssVariablesString} }`;
|
|
92
|
+
updateTokens({ isRoot: true, rootString });
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
};
|
|
96
|
+
const mountComponentsTokens = (options) => {
|
|
97
|
+
const { isRoot = false, token, container, containerId } = options || {};
|
|
98
|
+
if (!token)
|
|
99
|
+
return;
|
|
100
|
+
const modeSelector = isRoot ? import_constants.rootSelector.defaultLight : [`.${containerId}`];
|
|
101
|
+
let rootString = `${modeSelector.join(",")} { `;
|
|
102
|
+
const cssVariablesString = Object.entries(token).reduce(
|
|
103
|
+
(acc, [key, value]) => {
|
|
104
|
+
return `${acc} ${key}: ${value};`;
|
|
105
|
+
},
|
|
106
|
+
""
|
|
107
|
+
);
|
|
108
|
+
rootString = `${rootString} ${cssVariablesString} }`;
|
|
109
|
+
updateTokens({ isRoot, rootString, container, containerId });
|
|
110
|
+
};
|
|
111
|
+
const mountTokens = (tokenOptions) => {
|
|
112
|
+
if (import_utils.isMini)
|
|
113
|
+
return;
|
|
114
|
+
overrideBuiltInThemes(tokenOptions);
|
|
115
|
+
mountResponsiveTokens(tokenOptions);
|
|
116
|
+
mountComponentsTokens(tokenOptions);
|
|
117
|
+
};
|
|
118
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
119
|
+
0 && (module.exports = {
|
|
120
|
+
mountResponsiveTokens,
|
|
121
|
+
mountTokens,
|
|
122
|
+
overrideBuiltInThemes
|
|
123
|
+
});
|
|
@@ -0,0 +1,177 @@
|
|
|
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 FunctionalToast_exports = {};
|
|
58
|
+
__export(FunctionalToast_exports, {
|
|
59
|
+
default: () => FunctionalToast_default
|
|
60
|
+
});
|
|
61
|
+
module.exports = __toCommonJS(FunctionalToast_exports);
|
|
62
|
+
var import_utils = require("@bifrostui/utils");
|
|
63
|
+
var import_react = __toESM(require("react"));
|
|
64
|
+
var import_Toast = __toESM(require("./Toast"));
|
|
65
|
+
const toastCloses = [];
|
|
66
|
+
const formatProps = (props) => {
|
|
67
|
+
if (typeof props === "string") {
|
|
68
|
+
return { message: props };
|
|
69
|
+
}
|
|
70
|
+
return props;
|
|
71
|
+
};
|
|
72
|
+
const destroyAll = () => {
|
|
73
|
+
let closeToast = toastCloses.pop();
|
|
74
|
+
while (closeToast) {
|
|
75
|
+
closeToast();
|
|
76
|
+
closeToast = toastCloses.pop();
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
const functionalToast = (props) => {
|
|
80
|
+
const options = __spreadValues({
|
|
81
|
+
duration: 2e3,
|
|
82
|
+
position: "center",
|
|
83
|
+
allowMultiple: false,
|
|
84
|
+
disableClick: false
|
|
85
|
+
}, formatProps(props));
|
|
86
|
+
const instance = {
|
|
87
|
+
close: () => null
|
|
88
|
+
};
|
|
89
|
+
const rootWrapper = document.createElement("div");
|
|
90
|
+
if (options.disableClick) {
|
|
91
|
+
const styles = {
|
|
92
|
+
position: "fixed",
|
|
93
|
+
top: "0",
|
|
94
|
+
bottom: "0",
|
|
95
|
+
left: "0",
|
|
96
|
+
right: "0",
|
|
97
|
+
zIndex: "var(--bui-z-index-toast)"
|
|
98
|
+
};
|
|
99
|
+
Object.keys(styles).forEach((property) => {
|
|
100
|
+
rootWrapper.style[property] = styles[property];
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
const rootElement = (0, import_utils.getRootElement)();
|
|
104
|
+
rootElement.appendChild(rootWrapper);
|
|
105
|
+
const ToastComponent = () => {
|
|
106
|
+
const _a = options, { duration, allowMultiple, onClose } = _a, others = __objRest(_a, ["duration", "allowMultiple", "onClose"]);
|
|
107
|
+
const [open, setOpen] = (0, import_react.useState)(false);
|
|
108
|
+
let timer;
|
|
109
|
+
const fadeTimeout = {
|
|
110
|
+
enter: 350,
|
|
111
|
+
exit: 150
|
|
112
|
+
};
|
|
113
|
+
const close = (0, import_react.useCallback)(() => {
|
|
114
|
+
setOpen(false);
|
|
115
|
+
setTimeout(() => {
|
|
116
|
+
const unmountRes = (0, import_utils.unmount)(rootWrapper);
|
|
117
|
+
if (unmountRes && rootWrapper.parentNode) {
|
|
118
|
+
rootWrapper.parentNode.removeChild(rootWrapper);
|
|
119
|
+
}
|
|
120
|
+
}, fadeTimeout.exit);
|
|
121
|
+
onClose == null ? void 0 : onClose();
|
|
122
|
+
}, [rootWrapper]);
|
|
123
|
+
(0, import_react.useEffect)(() => {
|
|
124
|
+
setOpen(true);
|
|
125
|
+
if (!allowMultiple)
|
|
126
|
+
destroyAll();
|
|
127
|
+
toastCloses.push(close);
|
|
128
|
+
if (duration !== 0 && typeof duration === "number") {
|
|
129
|
+
timer = setTimeout(close, duration);
|
|
130
|
+
}
|
|
131
|
+
return () => {
|
|
132
|
+
clearTimeout(timer);
|
|
133
|
+
};
|
|
134
|
+
}, []);
|
|
135
|
+
instance.close = close;
|
|
136
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
137
|
+
import_Toast.default,
|
|
138
|
+
__spreadProps(__spreadValues({}, others), {
|
|
139
|
+
open,
|
|
140
|
+
timeout: fadeTimeout,
|
|
141
|
+
onClose: close
|
|
142
|
+
})
|
|
143
|
+
);
|
|
144
|
+
};
|
|
145
|
+
(0, import_utils.render)(/* @__PURE__ */ import_react.default.createElement(ToastComponent, null), rootWrapper);
|
|
146
|
+
return instance;
|
|
147
|
+
};
|
|
148
|
+
["warning", "loading", "success", "fail"].forEach((methodName) => {
|
|
149
|
+
functionalToast[methodName] = (options) => functionalToast(__spreadValues({
|
|
150
|
+
type: methodName
|
|
151
|
+
}, formatProps(options)));
|
|
152
|
+
});
|
|
153
|
+
functionalToast.clear = () => {
|
|
154
|
+
setTimeout(() => {
|
|
155
|
+
destroyAll();
|
|
156
|
+
});
|
|
157
|
+
};
|
|
158
|
+
const useToast = () => {
|
|
159
|
+
const holderRef = import_react.default.useRef(null);
|
|
160
|
+
["warning", "loading", "success", "fail"].forEach((methodName) => {
|
|
161
|
+
functionalToast[methodName] = (options) => functionalToast(__spreadProps(__spreadValues({
|
|
162
|
+
type: methodName
|
|
163
|
+
}, formatProps(options)), {
|
|
164
|
+
theme: holderRef.current.theme
|
|
165
|
+
}));
|
|
166
|
+
});
|
|
167
|
+
functionalToast.clear = () => {
|
|
168
|
+
setTimeout(() => {
|
|
169
|
+
destroyAll();
|
|
170
|
+
});
|
|
171
|
+
};
|
|
172
|
+
const wrapAPI = functionalToast;
|
|
173
|
+
return [wrapAPI, /* @__PURE__ */ import_react.default.createElement(import_Toast.default, { key: "toast-holder", ref: holderRef })];
|
|
174
|
+
};
|
|
175
|
+
functionalToast.useToast = useToast;
|
|
176
|
+
const Toast = functionalToast;
|
|
177
|
+
var FunctionalToast_default = Toast;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
.bui-toast {
|
|
2
|
+
--min-width: var(--bui-toast-min-width, 86px);
|
|
3
|
+
--max-width: var(--bui-toast-max-width, 80%);
|
|
4
|
+
--flex-direction: var(--bui-toast-flex-direction, column);
|
|
5
|
+
--padding: var(--bui-toast-padding, var(--bui-spacing-xl));
|
|
6
|
+
--word-break: break-all;
|
|
7
|
+
--z-index: var(--bui-z-index-toast);
|
|
8
|
+
--position-top: var(--bui-toast-position-top, 15%);
|
|
9
|
+
--position-bottom: var(--bui-toast-position-bottom, 85%);
|
|
10
|
+
--background-color: var(--bui-toast-bg-color, rgba(0, 0, 0, 0.8));
|
|
11
|
+
--border-radius: var(--bui-toast-border-radius, --bui-shape-radius-default);
|
|
12
|
+
--icon-margin: var(--bui-toast-icon-margin-bottom, 8px);
|
|
13
|
+
--icon-font-size: var(--bui-toast-icon-font-size, 30px);
|
|
14
|
+
--text-align: center;
|
|
15
|
+
position: fixed;
|
|
16
|
+
left: 50%;
|
|
17
|
+
z-index: var(--z-index);
|
|
18
|
+
width: fit-content;
|
|
19
|
+
min-width: var(--min-width);
|
|
20
|
+
max-width: var(--max-width);
|
|
21
|
+
padding: var(--padding);
|
|
22
|
+
font-size: var(--bui-text-size-1);
|
|
23
|
+
color: var(--bui-color-white);
|
|
24
|
+
border-radius: var(--border-radius);
|
|
25
|
+
word-break: var(--word-break);
|
|
26
|
+
white-space: pre-wrap;
|
|
27
|
+
background-color: var(--background-color);
|
|
28
|
+
text-align: var(--text-align);
|
|
29
|
+
font-family: var(--bui-font-family);
|
|
30
|
+
}
|
|
31
|
+
.bui-toast.bui-toast-allow-click {
|
|
32
|
+
position: fixed;
|
|
33
|
+
right: unset;
|
|
34
|
+
bottom: unset;
|
|
35
|
+
}
|
|
36
|
+
.bui-toast-center {
|
|
37
|
+
top: 50%;
|
|
38
|
+
transform: translate(-50%, -50%);
|
|
39
|
+
}
|
|
40
|
+
.bui-toast-top {
|
|
41
|
+
top: var(--position-top);
|
|
42
|
+
transform: translate(-50%, calc(-1 * var(--position-top)));
|
|
43
|
+
}
|
|
44
|
+
.bui-toast-bottom {
|
|
45
|
+
top: var(--position-bottom);
|
|
46
|
+
transform: translate(-50%, calc(-1 * var(--position-bottom)));
|
|
47
|
+
}
|
|
48
|
+
.bui-toast-icon {
|
|
49
|
+
display: flex;
|
|
50
|
+
flex-direction: var(--flex-direction);
|
|
51
|
+
align-items: center;
|
|
52
|
+
}
|
|
53
|
+
.bui-toast-icon .bui-svg-icon {
|
|
54
|
+
margin: 0 0 var(--icon-margin);
|
|
55
|
+
font-size: var(--icon-font-size);
|
|
56
|
+
}
|
|
@@ -0,0 +1,121 @@
|
|
|
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 Toast_exports = {};
|
|
58
|
+
__export(Toast_exports, {
|
|
59
|
+
default: () => Toast_default
|
|
60
|
+
});
|
|
61
|
+
module.exports = __toCommonJS(Toast_exports);
|
|
62
|
+
var import_clsx = __toESM(require("clsx"));
|
|
63
|
+
var import_react = __toESM(require("react"));
|
|
64
|
+
var import_icons = require("@bifrostui/icons");
|
|
65
|
+
var import_Fade = __toESM(require("../Fade"));
|
|
66
|
+
var import_ThemeProvider = require("../ThemeProvider");
|
|
67
|
+
var import_Toast2 = require("./Toast.css");
|
|
68
|
+
const prefixCls = "bui-toast";
|
|
69
|
+
const ToastComponent = /* @__PURE__ */ import_react.default.forwardRef((props, ref) => {
|
|
70
|
+
const _a = props, {
|
|
71
|
+
className,
|
|
72
|
+
style,
|
|
73
|
+
open,
|
|
74
|
+
type,
|
|
75
|
+
icon,
|
|
76
|
+
message,
|
|
77
|
+
position = "center",
|
|
78
|
+
disableClick = false,
|
|
79
|
+
theme
|
|
80
|
+
} = _a, others = __objRest(_a, [
|
|
81
|
+
"className",
|
|
82
|
+
"style",
|
|
83
|
+
"open",
|
|
84
|
+
"type",
|
|
85
|
+
"icon",
|
|
86
|
+
"message",
|
|
87
|
+
"position",
|
|
88
|
+
"disableClick",
|
|
89
|
+
"theme"
|
|
90
|
+
]);
|
|
91
|
+
const themeConfig = (0, import_ThemeProvider.useTheme)(theme);
|
|
92
|
+
(0, import_react.useImperativeHandle)(ref, () => {
|
|
93
|
+
return { theme: themeConfig };
|
|
94
|
+
}, []);
|
|
95
|
+
const iconMap = {
|
|
96
|
+
fail: /* @__PURE__ */ import_react.default.createElement(import_icons.ErrorCircleFilledBoldIcon, { htmlColor: "#ffffff" }),
|
|
97
|
+
loading: /* @__PURE__ */ import_react.default.createElement(import_icons.AccessTimeCircleFilledBoldIcon, { htmlColor: "#ffffff" }),
|
|
98
|
+
warning: /* @__PURE__ */ import_react.default.createElement(import_icons.AlertCircleFilledBoldIcon, { htmlColor: "#ffffff" }),
|
|
99
|
+
success: /* @__PURE__ */ import_react.default.createElement(import_icons.SuccessCircleFilledBoldIcon, { htmlColor: "#ffffff" })
|
|
100
|
+
};
|
|
101
|
+
const iconDom = iconMap[type] || icon;
|
|
102
|
+
return /* @__PURE__ */ import_react.default.createElement(import_Fade.default, __spreadProps(__spreadValues({}, others), { in: open, appear: false, unmountOnExit: true }), /* @__PURE__ */ import_react.default.createElement(
|
|
103
|
+
"div",
|
|
104
|
+
{
|
|
105
|
+
className: (0, import_clsx.default)(
|
|
106
|
+
prefixCls,
|
|
107
|
+
`${prefixCls}-${position}`,
|
|
108
|
+
{
|
|
109
|
+
[`${prefixCls}-icon`]: !!iconDom,
|
|
110
|
+
[`${prefixCls}-allow-click`]: !disableClick
|
|
111
|
+
},
|
|
112
|
+
className
|
|
113
|
+
),
|
|
114
|
+
style
|
|
115
|
+
},
|
|
116
|
+
iconDom,
|
|
117
|
+
message
|
|
118
|
+
));
|
|
119
|
+
});
|
|
120
|
+
ToastComponent.displayName = "BuiToast";
|
|
121
|
+
var Toast_default = ToastComponent;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { FadeProps } from '../Fade/Fade.types';
|
|
3
|
+
import { ThemeProps } from '../ThemeProvider/ThemeProvider.types';
|
|
4
|
+
export type ToastRef = {
|
|
5
|
+
theme?: ThemeProps;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* 提示类型
|
|
9
|
+
*/
|
|
10
|
+
export type ToastType = 'loading' | 'success' | 'fail' | 'warning';
|
|
11
|
+
export interface ToastProps extends FadeProps {
|
|
12
|
+
/**
|
|
13
|
+
* 是否展示
|
|
14
|
+
*/
|
|
15
|
+
open?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* 提示类型
|
|
18
|
+
*/
|
|
19
|
+
type?: ToastType;
|
|
20
|
+
/**
|
|
21
|
+
* toast内容,支持使用`\n`换行
|
|
22
|
+
*/
|
|
23
|
+
message?: string;
|
|
24
|
+
/**
|
|
25
|
+
* 展示时长(ms),值为 0 时,toast 不会消失
|
|
26
|
+
* @default 2000
|
|
27
|
+
*/
|
|
28
|
+
duration?: number;
|
|
29
|
+
/**
|
|
30
|
+
* 展示位置
|
|
31
|
+
* @default center
|
|
32
|
+
*/
|
|
33
|
+
position?: 'top' | 'center' | 'bottom';
|
|
34
|
+
/**
|
|
35
|
+
* 是否允许同时存在多个Toast
|
|
36
|
+
* @default false
|
|
37
|
+
*/
|
|
38
|
+
allowMultiple?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* 自定义图标
|
|
41
|
+
*/
|
|
42
|
+
icon?: React.ReactNode;
|
|
43
|
+
/**
|
|
44
|
+
* theme 主题定制
|
|
45
|
+
*/
|
|
46
|
+
theme?: ThemeProps;
|
|
47
|
+
/**
|
|
48
|
+
* 展示Toast时,页面内容是否可以点击
|
|
49
|
+
* @default false
|
|
50
|
+
*/
|
|
51
|
+
disableClick?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* 关闭时的回调函数
|
|
54
|
+
*/
|
|
55
|
+
onClose?: () => void;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* 函数式调用配置参数
|
|
59
|
+
*/
|
|
60
|
+
export type ToastOptions = Omit<ToastProps, 'type' | 'open'> | string;
|
|
61
|
+
/**
|
|
62
|
+
* 函数式调用返回值类型
|
|
63
|
+
*/
|
|
64
|
+
export type ToastReturnType = {
|
|
65
|
+
/**
|
|
66
|
+
* 关闭当前提示
|
|
67
|
+
*/
|
|
68
|
+
close: () => void;
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Toast Instance
|
|
72
|
+
*/
|
|
73
|
+
export interface ToastFunction {
|
|
74
|
+
(options: ToastOptions): ToastReturnType;
|
|
75
|
+
/**
|
|
76
|
+
* 警告提示
|
|
77
|
+
*/
|
|
78
|
+
warning: (options: ToastOptions) => ToastReturnType;
|
|
79
|
+
/**
|
|
80
|
+
* 加载提示
|
|
81
|
+
*/
|
|
82
|
+
loading: (options: ToastOptions) => ToastReturnType;
|
|
83
|
+
/**
|
|
84
|
+
* 成功提示
|
|
85
|
+
*/
|
|
86
|
+
success: (options: ToastOptions) => ToastReturnType;
|
|
87
|
+
/**
|
|
88
|
+
* 失败提示
|
|
89
|
+
*/
|
|
90
|
+
fail: (options: ToastOptions) => ToastReturnType;
|
|
91
|
+
/**
|
|
92
|
+
* 清空提示
|
|
93
|
+
*/
|
|
94
|
+
clear: () => void;
|
|
95
|
+
}
|
|
96
|
+
export interface ToastInstance extends ToastFunction {
|
|
97
|
+
/**
|
|
98
|
+
* 获取toast静态方法 & contextHolder
|
|
99
|
+
*/
|
|
100
|
+
useToast: () => [ToastFunction, React.JSX.Element];
|
|
101
|
+
}
|
|
@@ -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 Toast_types_exports = {};
|
|
15
|
+
module.exports = __toCommonJS(Toast_types_exports);
|
|
@@ -0,0 +1,41 @@
|
|
|
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 Toast_exports = {};
|
|
30
|
+
__export(Toast_exports, {
|
|
31
|
+
Toast: () => import_FunctionalToast.default,
|
|
32
|
+
default: () => import_FunctionalToast.default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(Toast_exports);
|
|
35
|
+
var import_FunctionalToast = __toESM(require("./FunctionalToast"));
|
|
36
|
+
__reExport(Toast_exports, require("./Toast.types"), module.exports);
|
|
37
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
38
|
+
0 && (module.exports = {
|
|
39
|
+
Toast,
|
|
40
|
+
...require("./Toast.types")
|
|
41
|
+
});
|