@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
|
@@ -59,34 +59,31 @@ module.exports = __toCommonJS(CitySelectorCore_exports);
|
|
|
59
59
|
var import_react = __toESM(require("react"));
|
|
60
60
|
var import_clsx = __toESM(require("clsx"));
|
|
61
61
|
var import_utils = require("@bifrostui/utils");
|
|
62
|
+
var import_locales = require("../locales");
|
|
62
63
|
var import_ScrollView = __toESM(require("../ScrollView"));
|
|
63
64
|
var import_Selector = __toESM(require("./Selector"));
|
|
64
65
|
var import_CitySelector2 = require("./CitySelector.css");
|
|
65
66
|
const DEVIATION_HEIGHT = "6vmin";
|
|
66
|
-
const GPS_TYPE = {
|
|
67
|
-
title: "\u5B9A\u4F4D",
|
|
68
|
-
code: "GPS"
|
|
69
|
-
};
|
|
70
|
-
const CURRENT_TYPE = {
|
|
71
|
-
title: "\u5F53\u524D",
|
|
72
|
-
code: "CRRT"
|
|
73
|
-
};
|
|
74
|
-
const HOT_CITY_TYPE = {
|
|
75
|
-
title: "\u70ED\u95E8",
|
|
76
|
-
code: "HOT"
|
|
77
|
-
};
|
|
78
67
|
const prefixCls = "bui-city-selector";
|
|
79
68
|
const CitySelector = /* @__PURE__ */ import_react.default.forwardRef(
|
|
80
69
|
(props, ref) => {
|
|
70
|
+
const {
|
|
71
|
+
selectedCityGroupName: selectedCityGroupLocaleName,
|
|
72
|
+
currentCityGroupName: currentCityGroupLocaleName,
|
|
73
|
+
hotCitiesGroupName: hotCitiesGroupLocaleName,
|
|
74
|
+
located,
|
|
75
|
+
current,
|
|
76
|
+
hot
|
|
77
|
+
} = (0, import_locales.useLocaleText)("citySelector");
|
|
81
78
|
const _a = props, {
|
|
82
79
|
className,
|
|
83
80
|
title: pageTitle,
|
|
84
81
|
selectedCity,
|
|
85
|
-
selectedCityGroupName =
|
|
82
|
+
selectedCityGroupName = selectedCityGroupLocaleName,
|
|
86
83
|
currentCity,
|
|
87
|
-
currentCityGroupName =
|
|
84
|
+
currentCityGroupName = currentCityGroupLocaleName,
|
|
88
85
|
hotCities,
|
|
89
|
-
hotCitiesGroupName =
|
|
86
|
+
hotCitiesGroupName = hotCitiesGroupLocaleName,
|
|
90
87
|
cities,
|
|
91
88
|
disableIndex,
|
|
92
89
|
touchHandler,
|
|
@@ -109,6 +106,18 @@ const CitySelector = /* @__PURE__ */ import_react.default.forwardRef(
|
|
|
109
106
|
"onSelect",
|
|
110
107
|
"onClose"
|
|
111
108
|
]);
|
|
109
|
+
const GPS_TYPE = {
|
|
110
|
+
title: located,
|
|
111
|
+
code: "GPS"
|
|
112
|
+
};
|
|
113
|
+
const CURRENT_TYPE = {
|
|
114
|
+
title: current,
|
|
115
|
+
code: "CRRT"
|
|
116
|
+
};
|
|
117
|
+
const HOT_CITY_TYPE = {
|
|
118
|
+
title: hot,
|
|
119
|
+
code: "HOT"
|
|
120
|
+
};
|
|
112
121
|
const cityRef = (0, import_react.useRef)(null);
|
|
113
122
|
const nodeRef = (0, import_utils.useForkRef)(ref, cityRef);
|
|
114
123
|
(0, import_utils.useTouchEmulator)(cityRef.current);
|
|
@@ -167,7 +176,7 @@ const CitySelector = /* @__PURE__ */ import_react.default.forwardRef(
|
|
|
167
176
|
};
|
|
168
177
|
const renderTitile = (title, titleCode) => {
|
|
169
178
|
const parseTitle = (titleCode || title).toUpperCase();
|
|
170
|
-
return /* @__PURE__ */ import_react.default.createElement("div", { className: "select-city-title", id: disableIndex ? "" : parseTitle }, title.toUpperCase());
|
|
179
|
+
return /* @__PURE__ */ import_react.default.createElement("div", { className: "select-city-title", id: disableIndex ? "" : parseTitle }, title == null ? void 0 : title.toUpperCase());
|
|
171
180
|
};
|
|
172
181
|
const renderCity = (citys, title, titleCode) => {
|
|
173
182
|
return /* @__PURE__ */ import_react.default.createElement("div", null, renderTitile(title, titleCode), /* @__PURE__ */ import_react.default.createElement("div", { className: "select-city-buttons" }, citys.map((city, index) => {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
.bui-city-selector-item {
|
|
2
|
-
width:
|
|
3
|
-
height:
|
|
2
|
+
width: var(--select-item-width);
|
|
3
|
+
height: var(--select-item-height);
|
|
4
4
|
display: inline-flex;
|
|
5
5
|
justify-content: center;
|
|
6
6
|
align-items: center;
|
|
7
|
-
border-radius:
|
|
8
|
-
margin:
|
|
7
|
+
border-radius: var(--select-item-border-radius);
|
|
8
|
+
margin: var(--select-item-margin);
|
|
9
9
|
background-color: var(--bui-color-bg-default);
|
|
10
10
|
font-size: var(--bui-text-size-2);
|
|
11
11
|
}
|
|
@@ -0,0 +1,165 @@
|
|
|
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 Collapse_exports = {};
|
|
58
|
+
__export(Collapse_exports, {
|
|
59
|
+
default: () => Collapse_default
|
|
60
|
+
});
|
|
61
|
+
module.exports = __toCommonJS(Collapse_exports);
|
|
62
|
+
var import_react = __toESM(require("react"));
|
|
63
|
+
var import_utils = require("@bifrostui/utils");
|
|
64
|
+
var import_Transition = require("../Transition");
|
|
65
|
+
var import_Collapse2 = require("./Collapse.css");
|
|
66
|
+
const defaultEasing = {
|
|
67
|
+
enter: import_utils.easing.easeOut,
|
|
68
|
+
exit: import_utils.easing.sharp
|
|
69
|
+
};
|
|
70
|
+
const defaultTimeout = {
|
|
71
|
+
enter: import_utils.duration.enteringScreen,
|
|
72
|
+
exit: import_utils.duration.leavingScreen
|
|
73
|
+
};
|
|
74
|
+
const Collapse = /* @__PURE__ */ import_react.default.forwardRef((props, ref) => {
|
|
75
|
+
const _a = props, {
|
|
76
|
+
appear = false,
|
|
77
|
+
in: inProp,
|
|
78
|
+
easing: easingProp = defaultEasing,
|
|
79
|
+
direction = "vertical",
|
|
80
|
+
timeout = defaultTimeout,
|
|
81
|
+
delay = 0,
|
|
82
|
+
collapsedSize: collapsedSizeProp = 0,
|
|
83
|
+
style,
|
|
84
|
+
className,
|
|
85
|
+
children
|
|
86
|
+
} = _a, other = __objRest(_a, [
|
|
87
|
+
"appear",
|
|
88
|
+
"in",
|
|
89
|
+
"easing",
|
|
90
|
+
"direction",
|
|
91
|
+
"timeout",
|
|
92
|
+
"delay",
|
|
93
|
+
"collapsedSize",
|
|
94
|
+
"style",
|
|
95
|
+
"className",
|
|
96
|
+
"children"
|
|
97
|
+
]);
|
|
98
|
+
const nodeRef = (0, import_utils.useForkRef)(ref);
|
|
99
|
+
const wrapperRef = (0, import_react.useRef)(null);
|
|
100
|
+
const collapseRef = (0, import_utils.useForkRef)(wrapperRef, ref);
|
|
101
|
+
const transitions = (0, import_utils.createTransitions)();
|
|
102
|
+
const isHorizontal = direction === "horizontal";
|
|
103
|
+
const collapsedSize = typeof collapsedSizeProp === "number" ? `${collapsedSizeProp}px` : collapsedSizeProp;
|
|
104
|
+
const size = isHorizontal ? "width" : "height";
|
|
105
|
+
const getCollapseWrapperSize = (reactNode) => {
|
|
106
|
+
return reactNode ? `${reactNode[isHorizontal ? "clientWidth" : "clientHeight"]}px` : "fit-content";
|
|
107
|
+
};
|
|
108
|
+
(0, import_react.useEffect)(() => {
|
|
109
|
+
var _a2, _b, _c, _d;
|
|
110
|
+
if (appear === false && inProp === true && ((_b = (_a2 = wrapperRef.current) == null ? void 0 : _a2.style) == null ? void 0 : _b[size]) === "fit-content") {
|
|
111
|
+
wrapperRef.current.style[size] = getCollapseWrapperSize(
|
|
112
|
+
(_d = (_c = wrapperRef.current) == null ? void 0 : _c.children) == null ? void 0 : _d[0]
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
}, [appear, inProp]);
|
|
116
|
+
if (!children)
|
|
117
|
+
return null;
|
|
118
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
119
|
+
import_Transition.Transition,
|
|
120
|
+
__spreadProps(__spreadValues({}, other), {
|
|
121
|
+
ref: nodeRef,
|
|
122
|
+
in: inProp,
|
|
123
|
+
timeout,
|
|
124
|
+
delay,
|
|
125
|
+
appear
|
|
126
|
+
}),
|
|
127
|
+
(state, childProps) => {
|
|
128
|
+
var _a2;
|
|
129
|
+
const transition = transitions.create(
|
|
130
|
+
size,
|
|
131
|
+
(0, import_utils.getTransitionProps)(
|
|
132
|
+
{ timeout, style, easing: easingProp, delay },
|
|
133
|
+
{ mode: state }
|
|
134
|
+
)
|
|
135
|
+
);
|
|
136
|
+
const wrapperSize = () => {
|
|
137
|
+
var _a3, _b;
|
|
138
|
+
const collapseWrapperSize = state === "entering" || state === "entered" ? getCollapseWrapperSize((_b = (_a3 = wrapperRef.current) == null ? void 0 : _a3.children) == null ? void 0 : _b[0]) : collapsedSize;
|
|
139
|
+
return isHorizontal ? {
|
|
140
|
+
width: collapseWrapperSize,
|
|
141
|
+
WebKitWidth: collapseWrapperSize
|
|
142
|
+
} : {
|
|
143
|
+
height: collapseWrapperSize,
|
|
144
|
+
WebKitHeight: collapseWrapperSize
|
|
145
|
+
};
|
|
146
|
+
};
|
|
147
|
+
return import_react.default.createElement(
|
|
148
|
+
"div",
|
|
149
|
+
{
|
|
150
|
+
className: `bui-collapse ${className}`,
|
|
151
|
+
style: __spreadValues(__spreadProps(__spreadValues({}, style), {
|
|
152
|
+
transition,
|
|
153
|
+
WebkitTransition: transition
|
|
154
|
+
}), wrapperSize()),
|
|
155
|
+
ref: collapseRef
|
|
156
|
+
},
|
|
157
|
+
import_react.default.cloneElement(children, __spreadValues({
|
|
158
|
+
style: __spreadValues({}, (_a2 = children.props) == null ? void 0 : _a2.style)
|
|
159
|
+
}, childProps))
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
);
|
|
163
|
+
});
|
|
164
|
+
Collapse.displayName = "BuiCollapse";
|
|
165
|
+
var Collapse_default = Collapse;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TransitionProps } from '../Transition';
|
|
3
|
+
export interface CollapseProps extends Omit<TransitionProps, 'children'> {
|
|
4
|
+
easing?: string | {
|
|
5
|
+
enter?: string;
|
|
6
|
+
exit?: string;
|
|
7
|
+
};
|
|
8
|
+
children?: React.ReactElement;
|
|
9
|
+
/**
|
|
10
|
+
* 折叠的方向
|
|
11
|
+
* horizontal - 水平方向
|
|
12
|
+
* vertical - 垂直方向
|
|
13
|
+
*/
|
|
14
|
+
direction?: 'horizontal' | 'vertical';
|
|
15
|
+
collapsedSize?: string | number;
|
|
16
|
+
}
|
|
@@ -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 Collapse_types_exports = {};
|
|
15
|
+
module.exports = __toCommonJS(Collapse_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 Collapse_exports = {};
|
|
30
|
+
__export(Collapse_exports, {
|
|
31
|
+
Collapse: () => import_Collapse.default,
|
|
32
|
+
default: () => import_Collapse.default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(Collapse_exports);
|
|
35
|
+
var import_Collapse = __toESM(require("./Collapse"));
|
|
36
|
+
__reExport(Collapse_exports, require("./Collapse.types"), module.exports);
|
|
37
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
38
|
+
0 && (module.exports = {
|
|
39
|
+
Collapse,
|
|
40
|
+
...require("./Collapse.types")
|
|
41
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
.bui-collapse-panel {
|
|
2
|
+
--width: var(--bui-collapse-panel-width, 100%);
|
|
3
|
+
--header-padding: var(--bui-collapse-panel-header-padding, var(--bui-spacing-lg) 0);
|
|
4
|
+
--content-padding: var(--bui-collapse-panel-content-padding, var(--bui-spacing-lg) 0);
|
|
5
|
+
width: var(--width);
|
|
6
|
+
background-color: var(--bui-color-bg-view);
|
|
7
|
+
color: var(--bui-color-fg-default);
|
|
8
|
+
}
|
|
9
|
+
.bui-collapse-panel-item-header {
|
|
10
|
+
display: flex;
|
|
11
|
+
align-items: center;
|
|
12
|
+
justify-content: space-between;
|
|
13
|
+
border-bottom: solid 1px #eee;
|
|
14
|
+
cursor: pointer;
|
|
15
|
+
}
|
|
16
|
+
.bui-collapse-panel-item-header-label {
|
|
17
|
+
padding: var(--header-padding);
|
|
18
|
+
font-size: var(--bui-title-size-2);
|
|
19
|
+
}
|
|
20
|
+
.bui-collapse-panel-item-header-icon-arrow {
|
|
21
|
+
transform: rotate(0deg);
|
|
22
|
+
transition: all 0.3s ease;
|
|
23
|
+
}
|
|
24
|
+
.bui-collapse-panel-item-header-icon-arrow-active {
|
|
25
|
+
transform: rotate(-180deg);
|
|
26
|
+
}
|
|
27
|
+
.bui-collapse-panel-item-content {
|
|
28
|
+
padding: var(--content-padding);
|
|
29
|
+
font-size: var(--bui-text-size-1);
|
|
30
|
+
transition: height 0.5s ease;
|
|
31
|
+
overflow: hidden;
|
|
32
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CollapsePanelProps } from './CollapsePanel.types';
|
|
3
|
+
import './CollapsePanel.less';
|
|
4
|
+
declare const CollapsePanel: React.ForwardRefExoticComponent<Omit<CollapsePanelProps<"div", {}>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
5
|
+
export default CollapsePanel;
|
|
@@ -0,0 +1,159 @@
|
|
|
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 CollapsePanel_exports = {};
|
|
58
|
+
__export(CollapsePanel_exports, {
|
|
59
|
+
default: () => CollapsePanel_default
|
|
60
|
+
});
|
|
61
|
+
module.exports = __toCommonJS(CollapsePanel_exports);
|
|
62
|
+
var import_react = __toESM(require("react"));
|
|
63
|
+
var import_clsx = __toESM(require("clsx"));
|
|
64
|
+
var import_icons = require("@bifrostui/icons");
|
|
65
|
+
var import_utils = require("@bifrostui/utils");
|
|
66
|
+
var import_CollapsePanelItem = __toESM(require("./CollapsePanelItem"));
|
|
67
|
+
var import_CollapsePanel2 = require("./CollapsePanel.css");
|
|
68
|
+
const prefixCls = "bui-collapse-panel";
|
|
69
|
+
const CollapsePanel = /* @__PURE__ */ import_react.default.forwardRef(
|
|
70
|
+
(props, ref) => {
|
|
71
|
+
const _a = props, {
|
|
72
|
+
className,
|
|
73
|
+
style,
|
|
74
|
+
accordion = false,
|
|
75
|
+
activeKeys,
|
|
76
|
+
defaultActiveKeys,
|
|
77
|
+
items,
|
|
78
|
+
children,
|
|
79
|
+
arrowIcon,
|
|
80
|
+
onChange
|
|
81
|
+
} = _a, others = __objRest(_a, [
|
|
82
|
+
"className",
|
|
83
|
+
"style",
|
|
84
|
+
"accordion",
|
|
85
|
+
"activeKeys",
|
|
86
|
+
"defaultActiveKeys",
|
|
87
|
+
"items",
|
|
88
|
+
"children",
|
|
89
|
+
"arrowIcon",
|
|
90
|
+
"onChange"
|
|
91
|
+
]);
|
|
92
|
+
const [openKeys, setOpenKeys] = (0, import_utils.useValue)({
|
|
93
|
+
defaultValue: defaultActiveKeys || [],
|
|
94
|
+
value: activeKeys
|
|
95
|
+
});
|
|
96
|
+
const handleClick = (event, target) => {
|
|
97
|
+
var _a2;
|
|
98
|
+
const targetKey = target == null ? void 0 : target.key;
|
|
99
|
+
let newOpenKeys = [];
|
|
100
|
+
if (accordion) {
|
|
101
|
+
newOpenKeys = openKeys.includes(targetKey) ? [] : [targetKey];
|
|
102
|
+
} else {
|
|
103
|
+
newOpenKeys = openKeys.includes(targetKey) ? openKeys.filter((k) => k !== targetKey) : [targetKey, ...openKeys];
|
|
104
|
+
}
|
|
105
|
+
setOpenKeys(event, newOpenKeys);
|
|
106
|
+
onChange == null ? void 0 : onChange(event, { activeKeys: newOpenKeys });
|
|
107
|
+
(_a2 = target == null ? void 0 : target.onClick) == null ? void 0 : _a2.call(target, event);
|
|
108
|
+
};
|
|
109
|
+
const getArrowIcon = () => {
|
|
110
|
+
if (arrowIcon) {
|
|
111
|
+
return arrowIcon;
|
|
112
|
+
}
|
|
113
|
+
return /* @__PURE__ */ import_react.default.createElement(import_icons.ArrowDownwardLargeIcon, null);
|
|
114
|
+
};
|
|
115
|
+
const renderList = () => {
|
|
116
|
+
if (Array.isArray(items)) {
|
|
117
|
+
return items.map((item) => {
|
|
118
|
+
const _a2 = item, { key } = _a2, otherProps = __objRest(_a2, ["key"]);
|
|
119
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
120
|
+
import_CollapsePanelItem.default,
|
|
121
|
+
__spreadProps(__spreadValues({
|
|
122
|
+
key,
|
|
123
|
+
icon: getArrowIcon(),
|
|
124
|
+
active: openKeys.includes(item.key)
|
|
125
|
+
}, otherProps), {
|
|
126
|
+
onClick: (e) => handleClick(e, item)
|
|
127
|
+
})
|
|
128
|
+
);
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
const enhancedChildren = import_react.default.Children.map(children, (child) => {
|
|
132
|
+
if (import_react.default.isValidElement(child)) {
|
|
133
|
+
const newProps = {
|
|
134
|
+
icon: getArrowIcon(),
|
|
135
|
+
active: openKeys.includes(child.key),
|
|
136
|
+
onClick: (e) => handleClick(e, child)
|
|
137
|
+
};
|
|
138
|
+
return import_react.default.cloneElement(child, newProps);
|
|
139
|
+
}
|
|
140
|
+
return child;
|
|
141
|
+
});
|
|
142
|
+
return enhancedChildren;
|
|
143
|
+
};
|
|
144
|
+
if (items == null && children == null) {
|
|
145
|
+
return null;
|
|
146
|
+
}
|
|
147
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
148
|
+
"div",
|
|
149
|
+
__spreadValues({
|
|
150
|
+
className: (0, import_clsx.default)(prefixCls, className),
|
|
151
|
+
style,
|
|
152
|
+
ref
|
|
153
|
+
}, others),
|
|
154
|
+
/* @__PURE__ */ import_react.default.createElement("div", { className: `${prefixCls}-list` }, renderList())
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
);
|
|
158
|
+
CollapsePanel.displayName = "BuiCollapsePanel";
|
|
159
|
+
var CollapsePanel_default = CollapsePanel;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { OverrideProps } from '@bifrostui/types';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
export type CollapsePanelItemProps<D extends React.ElementType = 'div', P = {}> = OverrideProps<{
|
|
4
|
+
props: P & {
|
|
5
|
+
/**
|
|
6
|
+
* 唯一标识,对应 activeKey
|
|
7
|
+
*/
|
|
8
|
+
key?: string | number;
|
|
9
|
+
/**
|
|
10
|
+
* 面板标题
|
|
11
|
+
*/
|
|
12
|
+
label?: React.ReactNode;
|
|
13
|
+
/**
|
|
14
|
+
* 自定义 icon
|
|
15
|
+
*/
|
|
16
|
+
icon?: React.ReactNode | ((active: boolean) => React.ReactNode);
|
|
17
|
+
/**
|
|
18
|
+
* 是否展开
|
|
19
|
+
* @default false
|
|
20
|
+
*/
|
|
21
|
+
active?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* body 区域内容
|
|
24
|
+
*/
|
|
25
|
+
children?: React.ReactNode;
|
|
26
|
+
};
|
|
27
|
+
defaultComponent: D;
|
|
28
|
+
}, D>;
|
|
29
|
+
export type CollapsePanelProps<D extends React.ElementType = 'div', P = {}> = OverrideProps<{
|
|
30
|
+
props: P & {
|
|
31
|
+
/**
|
|
32
|
+
* 是否开启手风琴模式
|
|
33
|
+
* @default false
|
|
34
|
+
*/
|
|
35
|
+
accordion?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* 当前激活面板的 key
|
|
38
|
+
*/
|
|
39
|
+
activeKeys?: (number | string)[];
|
|
40
|
+
/**
|
|
41
|
+
* 默认展开面板的 key
|
|
42
|
+
*/
|
|
43
|
+
defaultActiveKeys?: (number | string)[];
|
|
44
|
+
/**
|
|
45
|
+
* 折叠项目内容
|
|
46
|
+
*/
|
|
47
|
+
items?: Array<CollapsePanelItemProps>;
|
|
48
|
+
/**
|
|
49
|
+
* body 区域内容,使用 CollapseItem 进行渲染
|
|
50
|
+
*/
|
|
51
|
+
children?: React.ReactNode;
|
|
52
|
+
/**
|
|
53
|
+
* 自定义箭头图标
|
|
54
|
+
*/
|
|
55
|
+
arrowIcon?: React.ReactNode | ((active: boolean) => React.ReactNode);
|
|
56
|
+
/**
|
|
57
|
+
* 切换面板时触发
|
|
58
|
+
*/
|
|
59
|
+
onChange?: (e: React.SyntheticEvent, params: {
|
|
60
|
+
activeKeys: (number | string)[];
|
|
61
|
+
}) => void;
|
|
62
|
+
};
|
|
63
|
+
defaultComponent: D;
|
|
64
|
+
}, D>;
|
|
@@ -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 CollapsePanel_types_exports = {};
|
|
15
|
+
module.exports = __toCommonJS(CollapsePanel_types_exports);
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CollapsePanelItemProps } from './CollapsePanel.types';
|
|
3
|
+
declare const CollapsePanelItem: React.ForwardRefExoticComponent<Omit<CollapsePanelItemProps<"div", {}>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
4
|
+
export default CollapsePanelItem;
|