@bifrostui/react 1.3.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 +38 -17
- package/dist/Calendar/Calendar.types.d.ts +21 -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/Dialog/Dialog.d.ts +2 -2
- package/dist/Dialog/Dialog.js +20 -8
- package/dist/Dialog/Dialog.types.d.ts +12 -1
- package/dist/Dialog/FunctionalDialog.js +38 -2
- package/dist/Dialog/index.css +27 -18
- 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/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.js +18 -0
- package/dist/Toast/Toast.css +15 -14
- package/dist/Toast/Toast.d.ts +2 -2
- package/dist/Toast/Toast.js +52 -48
- package/dist/Toast/Toast.types.d.ts +15 -1
- 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/index.d.ts +7 -0
- package/dist/index.js +15 -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 +38 -17
- package/es/Calendar/Calendar.types.d.ts +21 -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/Dialog/Dialog.d.ts +2 -2
- package/es/Dialog/Dialog.js +20 -8
- package/es/Dialog/Dialog.types.d.ts +12 -1
- package/es/Dialog/FunctionalDialog.js +38 -2
- package/es/Dialog/index.css +27 -18
- 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/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.js +18 -0
- package/es/Toast/Toast.css +15 -14
- package/es/Toast/Toast.d.ts +2 -2
- package/es/Toast/Toast.js +53 -49
- package/es/Toast/Toast.types.d.ts +15 -1
- 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/index.d.ts +7 -0
- package/es/index.js +7 -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,23 @@
|
|
|
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 __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var utils_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(utils_exports);
|
|
17
|
+
__reExport(utils_exports, require("./constants"), module.exports);
|
|
18
|
+
__reExport(utils_exports, require("./mountTokens"), module.exports);
|
|
19
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
20
|
+
0 && (module.exports = {
|
|
21
|
+
...require("./constants"),
|
|
22
|
+
...require("./mountTokens")
|
|
23
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ThemeProps, MountResponsiveTokenOptions, BuiltInThemesTokenOptions } from '../ThemeProvider.types';
|
|
2
|
+
/**
|
|
3
|
+
* 挂载响应式自定义Tokens
|
|
4
|
+
* 响应式相关的Tokens挂载在全局根节点上,暗黑模式或大麦高亮主题下可自定义额外Toekns复写响应式Tokens
|
|
5
|
+
*/
|
|
6
|
+
export declare const mountResponsiveTokens: (options: MountResponsiveTokenOptions) => void;
|
|
7
|
+
/**
|
|
8
|
+
* 复写内置主题Tokens,复写的自定义token应为对应主题css变量的子集
|
|
9
|
+
* BUI内置主题包括以下4种:
|
|
10
|
+
* 1. 默认高亮模式(defaultLightToken 复写 default-light.less)
|
|
11
|
+
* 2. 默认暗黑模式(defaultDarkToken 复写 default-dark.less)
|
|
12
|
+
* 3. 大麦高亮模式(dmLightToken 复写 dm-light.less)
|
|
13
|
+
* 4. 大麦暗黑模式(dmDarkToken 复写 dm-dark.less)
|
|
14
|
+
*/
|
|
15
|
+
export declare const overrideBuiltInThemes: (tokenOptions: BuiltInThemesTokenOptions) => void;
|
|
16
|
+
/**
|
|
17
|
+
* 挂载Design Tokens
|
|
18
|
+
* Tokens的优先级:
|
|
19
|
+
* 1. 通常情况:组件的Tokens > 响应式Tokens > BUI内置Tokens(挂载顺序控制)
|
|
20
|
+
* 2. 暗黑模式:组件的Tokens > BUI内置的两种暗黑模式Tokens > 响应式Tokens (选择器权重控制)
|
|
21
|
+
*
|
|
22
|
+
* - 挂载顺序决定BUI内置Tokens(暗黑模式除外)和响应式Tokens的优先级
|
|
23
|
+
* - 选择器权重决定暗黑模式的Tokens和响应式Tokens的优先级
|
|
24
|
+
* - 命名规则决定组件的Tokens(如:--bui-button-xxx)
|
|
25
|
+
*/
|
|
26
|
+
export declare const mountTokens: (tokenOptions?: ThemeProps) => void;
|
|
@@ -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
|
+
});
|
|
@@ -155,5 +155,23 @@ functionalToast.clear = () => {
|
|
|
155
155
|
destroyAll();
|
|
156
156
|
});
|
|
157
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;
|
|
158
176
|
const Toast = functionalToast;
|
|
159
177
|
var FunctionalToast_default = Toast;
|
package/dist/Toast/Toast.css
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
.bui-toast {
|
|
2
|
-
--min-width: 86px;
|
|
3
|
-
--max-width: 80
|
|
4
|
-
--
|
|
5
|
-
--
|
|
6
|
-
--padding: var(--bui-spacing-xl);
|
|
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));
|
|
7
6
|
--word-break: break-all;
|
|
8
7
|
--z-index: var(--bui-z-index-toast);
|
|
9
|
-
--position-top: 15
|
|
10
|
-
--position-bottom: 85
|
|
11
|
-
--background-color: rgba(0, 0, 0, 0.8);
|
|
12
|
-
--border-radius: var(--bui-shape-radius-default);
|
|
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);
|
|
13
14
|
--text-align: center;
|
|
14
15
|
position: fixed;
|
|
15
16
|
left: 50%;
|
|
@@ -18,8 +19,8 @@
|
|
|
18
19
|
min-width: var(--min-width);
|
|
19
20
|
max-width: var(--max-width);
|
|
20
21
|
padding: var(--padding);
|
|
21
|
-
font-size: var(--
|
|
22
|
-
color: var(--color);
|
|
22
|
+
font-size: var(--bui-text-size-1);
|
|
23
|
+
color: var(--bui-color-white);
|
|
23
24
|
border-radius: var(--border-radius);
|
|
24
25
|
word-break: var(--word-break);
|
|
25
26
|
white-space: pre-wrap;
|
|
@@ -46,10 +47,10 @@
|
|
|
46
47
|
}
|
|
47
48
|
.bui-toast-icon {
|
|
48
49
|
display: flex;
|
|
49
|
-
flex-direction:
|
|
50
|
+
flex-direction: var(--flex-direction);
|
|
50
51
|
align-items: center;
|
|
51
52
|
}
|
|
52
53
|
.bui-toast-icon .bui-svg-icon {
|
|
53
|
-
margin
|
|
54
|
-
font-size:
|
|
54
|
+
margin: 0 0 var(--icon-margin);
|
|
55
|
+
font-size: var(--icon-font-size);
|
|
55
56
|
}
|
package/dist/Toast/Toast.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { ToastProps } from './Toast.types';
|
|
2
|
+
import { ToastProps, ToastRef } from './Toast.types';
|
|
3
3
|
import './Toast.less';
|
|
4
|
-
declare const ToastComponent: React.ForwardRefExoticComponent<ToastProps & React.RefAttributes<
|
|
4
|
+
declare const ToastComponent: React.ForwardRefExoticComponent<ToastProps & React.RefAttributes<ToastRef>>;
|
|
5
5
|
export default ToastComponent;
|
package/dist/Toast/Toast.js
CHANGED
|
@@ -63,55 +63,59 @@ var import_clsx = __toESM(require("clsx"));
|
|
|
63
63
|
var import_react = __toESM(require("react"));
|
|
64
64
|
var import_icons = require("@bifrostui/icons");
|
|
65
65
|
var import_Fade = __toESM(require("../Fade"));
|
|
66
|
+
var import_ThemeProvider = require("../ThemeProvider");
|
|
66
67
|
var import_Toast2 = require("./Toast.css");
|
|
67
68
|
const prefixCls = "bui-toast";
|
|
68
|
-
const ToastComponent = /* @__PURE__ */ import_react.default.forwardRef(
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
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
|
+
});
|
|
116
120
|
ToastComponent.displayName = "BuiToast";
|
|
117
121
|
var Toast_default = ToastComponent;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { FadeProps } from '../Fade/Fade.types';
|
|
3
|
+
import { ThemeProps } from '../ThemeProvider/ThemeProvider.types';
|
|
4
|
+
export type ToastRef = {
|
|
5
|
+
theme?: ThemeProps;
|
|
6
|
+
};
|
|
3
7
|
/**
|
|
4
8
|
* 提示类型
|
|
5
9
|
*/
|
|
@@ -36,6 +40,10 @@ export interface ToastProps extends FadeProps {
|
|
|
36
40
|
* 自定义图标
|
|
37
41
|
*/
|
|
38
42
|
icon?: React.ReactNode;
|
|
43
|
+
/**
|
|
44
|
+
* theme 主题定制
|
|
45
|
+
*/
|
|
46
|
+
theme?: ThemeProps;
|
|
39
47
|
/**
|
|
40
48
|
* 展示Toast时,页面内容是否可以点击
|
|
41
49
|
* @default false
|
|
@@ -62,7 +70,7 @@ export type ToastReturnType = {
|
|
|
62
70
|
/**
|
|
63
71
|
* Toast Instance
|
|
64
72
|
*/
|
|
65
|
-
export interface
|
|
73
|
+
export interface ToastFunction {
|
|
66
74
|
(options: ToastOptions): ToastReturnType;
|
|
67
75
|
/**
|
|
68
76
|
* 警告提示
|
|
@@ -85,3 +93,9 @@ export interface ToastInstance {
|
|
|
85
93
|
*/
|
|
86
94
|
clear: () => void;
|
|
87
95
|
}
|
|
96
|
+
export interface ToastInstance extends ToastFunction {
|
|
97
|
+
/**
|
|
98
|
+
* 获取toast静态方法 & contextHolder
|
|
99
|
+
*/
|
|
100
|
+
useToast: () => [ToastFunction, React.JSX.Element];
|
|
101
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
.bui-tooltip {
|
|
2
|
+
--arrow-size: var(--bui-tooltip-arrow-size, 8px);
|
|
3
|
+
--localtion-position: var(--bui-tooltip-localtion-position, 8px);
|
|
4
|
+
--max-width: var(--bui-tooltip-max-width, 350px);
|
|
5
|
+
--content-min-width: var(--bui-tooltip-content-min-width, 30px);
|
|
6
|
+
--content-min-height: var(--bui-tooltip-content-min-height, 32px);
|
|
7
|
+
--content-padding: var(--bui-tooltip-content-padding, 6px 8px);
|
|
8
|
+
max-width: var(--max-width);
|
|
9
|
+
font-size: var(--bui-text-size-1);
|
|
10
|
+
position: absolute;
|
|
11
|
+
visibility: hidden;
|
|
12
|
+
z-index: var(--bui-z-index-tooltip);
|
|
13
|
+
}
|
|
14
|
+
.bui-tooltip .bui-tooltip-arrow {
|
|
15
|
+
width: 0;
|
|
16
|
+
height: 0;
|
|
17
|
+
position: absolute;
|
|
18
|
+
}
|
|
19
|
+
.bui-tooltip .bui-tooltip-arrow.location-left {
|
|
20
|
+
left: var(--localtion-position);
|
|
21
|
+
}
|
|
22
|
+
.bui-tooltip .bui-tooltip-arrow.location-right {
|
|
23
|
+
right: var(--localtion-position);
|
|
24
|
+
}
|
|
25
|
+
.bui-tooltip .bui-tooltip-arrow.location-top {
|
|
26
|
+
top: var(--localtion-position);
|
|
27
|
+
}
|
|
28
|
+
.bui-tooltip .bui-tooltip-arrow.location-bottom {
|
|
29
|
+
bottom: var(--localtion-position);
|
|
30
|
+
}
|
|
31
|
+
.bui-tooltip.tooltip-top .location-center,
|
|
32
|
+
.bui-tooltip.tooltip-bottom .location-center {
|
|
33
|
+
left: 50%;
|
|
34
|
+
transform: translateX(-50%);
|
|
35
|
+
}
|
|
36
|
+
.bui-tooltip.tooltip-left .location-center,
|
|
37
|
+
.bui-tooltip.tooltip-right .location-center {
|
|
38
|
+
top: 50%;
|
|
39
|
+
transform: translateY(-50%);
|
|
40
|
+
}
|
|
41
|
+
.bui-tooltip.tooltip-top {
|
|
42
|
+
padding-bottom: var(--arrow-size);
|
|
43
|
+
}
|
|
44
|
+
.bui-tooltip.tooltip-top .bui-tooltip-arrow {
|
|
45
|
+
border-left: var(--arrow-size) solid transparent;
|
|
46
|
+
border-right: var(--arrow-size) solid transparent;
|
|
47
|
+
border-top: var(--arrow-size) solid var(--bui-color-bg-alpha-dark-7);
|
|
48
|
+
bottom: 0;
|
|
49
|
+
}
|
|
50
|
+
.bui-tooltip.tooltip-bottom {
|
|
51
|
+
padding-top: var(--arrow-size);
|
|
52
|
+
}
|
|
53
|
+
.bui-tooltip.tooltip-bottom .bui-tooltip-arrow {
|
|
54
|
+
border-left: var(--arrow-size) solid transparent;
|
|
55
|
+
border-right: var(--arrow-size) solid transparent;
|
|
56
|
+
border-bottom: var(--arrow-size) solid var(--bui-color-bg-alpha-dark-7);
|
|
57
|
+
top: 0;
|
|
58
|
+
}
|
|
59
|
+
.bui-tooltip.tooltip-left {
|
|
60
|
+
padding-right: var(--arrow-size);
|
|
61
|
+
}
|
|
62
|
+
.bui-tooltip.tooltip-left .bui-tooltip-arrow {
|
|
63
|
+
border-top: var(--arrow-size) solid transparent;
|
|
64
|
+
border-bottom: var(--arrow-size) solid transparent;
|
|
65
|
+
border-left: var(--arrow-size) solid var(--bui-color-bg-alpha-dark-7);
|
|
66
|
+
right: 0;
|
|
67
|
+
}
|
|
68
|
+
.bui-tooltip.tooltip-right {
|
|
69
|
+
padding-left: var(--arrow-size);
|
|
70
|
+
}
|
|
71
|
+
.bui-tooltip.tooltip-right .bui-tooltip-arrow {
|
|
72
|
+
border-top: var(--arrow-size) solid transparent;
|
|
73
|
+
border-bottom: var(--arrow-size) solid transparent;
|
|
74
|
+
border-right: var(--arrow-size) solid var(--bui-color-bg-alpha-dark-7);
|
|
75
|
+
left: 0;
|
|
76
|
+
}
|
|
77
|
+
.bui-tooltip .bui-tooltip-content {
|
|
78
|
+
min-width: var(--content-min-width);
|
|
79
|
+
min-height: var(--content-min-height);
|
|
80
|
+
padding: var(--content-padding);
|
|
81
|
+
color: var(--bui-color-white);
|
|
82
|
+
text-align: left;
|
|
83
|
+
text-decoration: none;
|
|
84
|
+
word-wrap: break-word;
|
|
85
|
+
background-color: var(--bui-color-bg-alpha-dark-7);
|
|
86
|
+
border-radius: var(--bui-shape-radius-poster);
|
|
87
|
+
box-shadow:
|
|
88
|
+
0 3px 6px -4px rgba(0, 0, 0, 0.12),
|
|
89
|
+
0 6px 16px 0 rgba(0, 0, 0, 0.08),
|
|
90
|
+
0 9px 28px 8px rgba(0, 0, 0, 0.05);
|
|
91
|
+
}
|