@bifrostui/react 1.3.2 → 1.4.0-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 +37 -25
- 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 +14 -7
- 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/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 +195 -0
- package/dist/Popover/Popover.types.d.ts +58 -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 +9 -7
- package/dist/Radio/Radio.css +5 -4
- 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 +5 -5
- package/dist/Slider/Slider.css +29 -18
- package/dist/Steps/Step.css +13 -13
- package/dist/Steps/Steps.css +14 -7
- 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 +6 -10
- package/dist/Tabs/Tabs.css +10 -9
- package/dist/Tag/Tag.css +7 -10
- package/dist/Tag/TagGroup.css +9 -1
- package/dist/TextArea/TextArea.css +23 -13
- package/dist/ThemeProvider/ThemeProvider.d.ts +4 -0
- package/dist/ThemeProvider/ThemeProvider.js +91 -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 +18 -20
- 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 +184 -0
- package/dist/Tooltip/Tooltip.types.d.ts +49 -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 +37 -25
- 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 +14 -7
- 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 +172 -0
- package/es/Popover/Popover.types.d.ts +58 -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 +9 -7
- package/es/Radio/Radio.css +5 -4
- 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 +5 -5
- package/es/Slider/Slider.css +29 -18
- package/es/Steps/Step.css +13 -13
- package/es/Steps/Steps.css +14 -7
- 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 +6 -10
- package/es/Tabs/Tabs.css +10 -9
- package/es/Tag/Tag.css +7 -10
- package/es/Tag/TagGroup.css +9 -1
- package/es/TextArea/TextArea.css +23 -13
- package/es/ThemeProvider/ThemeProvider.d.ts +4 -0
- package/es/ThemeProvider/ThemeProvider.js +62 -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 +18 -20
- 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 +161 -0
- package/es/Tooltip/Tooltip.types.d.ts +49 -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
|
@@ -16,6 +16,12 @@ export interface ICalendarYearChangeData {
|
|
|
16
16
|
/** 切换后的年份 */
|
|
17
17
|
year: number;
|
|
18
18
|
}
|
|
19
|
+
export interface ICustomIconProps {
|
|
20
|
+
/** 是否为可选范围内的最小月份 */
|
|
21
|
+
isMinMonth?: boolean;
|
|
22
|
+
/** 是否为可选范围内的最大月份 */
|
|
23
|
+
isMaxMonth?: boolean;
|
|
24
|
+
}
|
|
19
25
|
export type ICalendarMode = 'single' | 'range';
|
|
20
26
|
export type ICalendarValue = Date | Date[] | null;
|
|
21
27
|
export type CalendarProps<D extends React.ElementType = 'div', P = {}> = OverrideProps<{
|
|
@@ -47,6 +53,21 @@ export type CalendarProps<D extends React.ElementType = 'div', P = {}> = Overrid
|
|
|
47
53
|
* 是否隐藏当前月之外的日期,默认为false
|
|
48
54
|
*/
|
|
49
55
|
hideDaysOutsideCurrentMonth?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* 头部操作栏日期显示格式
|
|
58
|
+
* @default YYYY/MM
|
|
59
|
+
*/
|
|
60
|
+
headerBarFormat?: string;
|
|
61
|
+
/**
|
|
62
|
+
* 头部操作栏左边图标
|
|
63
|
+
* @defaultReturn <CaretLeftIcon />
|
|
64
|
+
*/
|
|
65
|
+
headerBarLeftIcon?: (options: ICustomIconProps) => React.ReactNode;
|
|
66
|
+
/**
|
|
67
|
+
* 头部操作栏右边图标
|
|
68
|
+
* @defaultReturn <CaretRightIcon />
|
|
69
|
+
*/
|
|
70
|
+
headerBarRightIcon?: (options: ICustomIconProps) => React.ReactNode;
|
|
50
71
|
/**
|
|
51
72
|
* 不可选择的日期
|
|
52
73
|
*/
|
package/es/Card/CardFooter.css
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
.bui-card-footer {
|
|
2
|
+
--padding: var(--bui-card-footer-padding, var(--bui-spacing-md) var(--bui-spacing-lg));
|
|
2
3
|
color: var(--bui-color-fg-muted);
|
|
3
4
|
font-size: var(--bui-text-size-1);
|
|
4
5
|
display: flex;
|
|
5
6
|
align-items: center;
|
|
6
|
-
padding: var(--
|
|
7
|
+
padding: var(--padding);
|
|
7
8
|
font-family: var(--bui-font-family);
|
|
8
9
|
}
|
package/es/Card/CardHeader.css
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
.bui-card-header {
|
|
2
|
+
--padding: var(--bui-card-header-padding, var(--bui-spacing-md) var(--bui-spacing-lg));
|
|
3
|
+
--end-icon-margin-left: var(--bui-card-header-end-icon-margin-left, 2px);
|
|
2
4
|
display: flex;
|
|
3
5
|
align-items: center;
|
|
4
6
|
flex-direction: row;
|
|
5
7
|
position: relative;
|
|
6
8
|
padding: var(--bui-spacing-md) var(--bui-spacing-lg);
|
|
7
9
|
font-size: var(--bui-title-size-4);
|
|
8
|
-
font-weight:
|
|
10
|
+
font-weight: var(--bui-font-weight-medium);
|
|
9
11
|
color: var(--bui-color-fg-default);
|
|
10
12
|
font-family: var(--bui-font-family);
|
|
11
13
|
}
|
package/es/Checkbox/Checkbox.css
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
.bui-checkbox {
|
|
2
|
-
--label-color: var(--bui-color-fg-default);
|
|
3
|
-
--label-font-size: var(--bui-text-size-1);
|
|
4
|
-
--icon-font-size: var(--bui-title-size-2);
|
|
2
|
+
--label-color: var(--bui-checkbox-label-color, --bui-color-fg-default);
|
|
3
|
+
--label-font-size: var(--bui-checkbox-label-font-size, var(--bui-text-size-1));
|
|
4
|
+
--icon-font-size: var(--bui-checkbox-icon-font-size, var(--bui-title-size-2));
|
|
5
|
+
--disabled-opacity: var(--bui-checkbox-disabled-opacity, 0.5);
|
|
6
|
+
--icon-padding: var(--bui-checkbox-icon-padding, 5px);
|
|
5
7
|
display: inline-flex;
|
|
6
8
|
align-items: center;
|
|
7
9
|
position: relative;
|
|
@@ -9,7 +11,7 @@
|
|
|
9
11
|
}
|
|
10
12
|
.bui-checkbox.bui-checkbox-disabled {
|
|
11
13
|
pointer-events: none;
|
|
12
|
-
opacity:
|
|
14
|
+
opacity: var(--disabled-opacity);
|
|
13
15
|
}
|
|
14
16
|
.bui-checkbox-label-left {
|
|
15
17
|
flex-direction: row-reverse;
|
|
@@ -35,7 +37,7 @@
|
|
|
35
37
|
align-items: center;
|
|
36
38
|
justify-content: center;
|
|
37
39
|
flex-shrink: 0;
|
|
38
|
-
padding:
|
|
40
|
+
padding: var(--icon-padding);
|
|
39
41
|
box-sizing: border-box;
|
|
40
42
|
font-size: var(--icon-font-size);
|
|
41
43
|
}
|
|
@@ -1,14 +1,29 @@
|
|
|
1
1
|
.bui-city-selector {
|
|
2
|
+
--select-item-width: var(--bui-city-selector-item-width, 111px);
|
|
3
|
+
--select-item-height: var(--bui-city-selector-item-height, 36px);
|
|
4
|
+
--select-item-border-radius: var(--bui-city-selector-item-border-radius, 20px);
|
|
5
|
+
--select-item-margin: var(--bui-city-selector-item-margin, 4.5px 0 4.5px 9px);
|
|
6
|
+
--title-height: var(--bui-city-selector-title-height, 45px);
|
|
7
|
+
--title-line-height: var(--bui-city-selector-title-line-height, 45px);
|
|
8
|
+
--btn-close-size: var(--bui-city-selector-btn-close-size, 45px);
|
|
9
|
+
--btn-close-font-size: var(--bui-city-selector-btn-close-font-size, 20px);
|
|
10
|
+
--container-with-title-height: var(--bui-city-selector-container-with-title-height, calc(100% - var(--title-height)));
|
|
11
|
+
--city-container-min-height: var(--bui-city-selector-city-container-min-height, 500px);
|
|
12
|
+
--select-city-buttons-padding: var(--bui-city-selector-select-city-buttons-padding, 7.5px 0 0 3px);
|
|
13
|
+
--select-city-title-line-height: var(--bui-city-selector-select-city-title-line-height, 15px);
|
|
14
|
+
--list-item-height: var(--bui-city-selector-list-item-height, 45px);
|
|
15
|
+
--city-index-has-title-top: var(--bui-city-selector-city-index-has-title-top, calc(50% + var(--title-height) / 2));
|
|
16
|
+
--index-item-height: var(--bui-city-selector-index-item-height, 20px);
|
|
2
17
|
font-family: var(--bui-font-family);
|
|
3
18
|
height: 100%;
|
|
4
19
|
position: relative;
|
|
5
20
|
}
|
|
6
21
|
.bui-city-selector-title {
|
|
7
22
|
width: 100%;
|
|
8
|
-
height:
|
|
23
|
+
height: var(--title-height);
|
|
9
24
|
color: var(--bui-color-fg-default);
|
|
10
25
|
font-size: var(--bui-title-size-3);
|
|
11
|
-
line-height:
|
|
26
|
+
line-height: var(--title-line-height);
|
|
12
27
|
text-align: center;
|
|
13
28
|
position: sticky;
|
|
14
29
|
top: 0;
|
|
@@ -20,20 +35,20 @@
|
|
|
20
35
|
position: absolute;
|
|
21
36
|
top: 0;
|
|
22
37
|
right: 0;
|
|
23
|
-
width:
|
|
24
|
-
height:
|
|
38
|
+
width: var(--btn-close-size);
|
|
39
|
+
height: var(--btn-close-size);
|
|
25
40
|
color: var(--bui-color-fg-muted);
|
|
26
41
|
text-align: center;
|
|
27
|
-
font-size:
|
|
42
|
+
font-size: var(--btn-close-font-size);
|
|
28
43
|
}
|
|
29
44
|
.bui-city-selector-scroll-view-container {
|
|
30
45
|
height: 100%;
|
|
31
46
|
}
|
|
32
47
|
.bui-city-selector-scroll-view-container.container-has-title {
|
|
33
|
-
height:
|
|
48
|
+
height: var(--container-with-title-height);
|
|
34
49
|
}
|
|
35
50
|
.bui-city-selector-all-city {
|
|
36
|
-
min-height:
|
|
51
|
+
min-height: var(--city-container-min-height);
|
|
37
52
|
font-size: var(--bui-text-size-2);
|
|
38
53
|
width: 100%;
|
|
39
54
|
background: var(--bui-color-bg-view);
|
|
@@ -42,22 +57,21 @@
|
|
|
42
57
|
.bui-city-selector-all-city .select-city-buttons {
|
|
43
58
|
display: flex;
|
|
44
59
|
flex-flow: wrap;
|
|
45
|
-
padding
|
|
46
|
-
padding-top: 7.5px;
|
|
60
|
+
padding: var(--select-city-buttons-padding);
|
|
47
61
|
}
|
|
48
62
|
.bui-city-selector-all-city .select-city-title {
|
|
49
63
|
font-size: var(--bui-title-size-4);
|
|
50
|
-
line-height:
|
|
51
|
-
font-weight:
|
|
64
|
+
line-height: var(--select-city-title-line-height);
|
|
65
|
+
font-weight: var(--bui-font-weight-bold);
|
|
52
66
|
padding-left: var(--bui-spacing-lg);
|
|
53
|
-
padding-top:
|
|
67
|
+
padding-top: var(--bui-spacing-md);
|
|
54
68
|
}
|
|
55
69
|
.bui-city-selector-list {
|
|
56
70
|
padding-left: var(--bui-spacing-lg);
|
|
57
71
|
list-style-type: none;
|
|
58
72
|
}
|
|
59
73
|
.bui-city-selector-list-item {
|
|
60
|
-
height:
|
|
74
|
+
height: var(--list-item-height);
|
|
61
75
|
font-size: var(--bui-title-size-4);
|
|
62
76
|
display: flex;
|
|
63
77
|
align-items: center;
|
|
@@ -81,7 +95,7 @@
|
|
|
81
95
|
transform: translate(0, -50%);
|
|
82
96
|
}
|
|
83
97
|
.bui-city-selector-index-container.city-index-has-title {
|
|
84
|
-
top:
|
|
98
|
+
top: var(--city-index-has-title-top);
|
|
85
99
|
}
|
|
86
100
|
.bui-city-selector-index-container ul {
|
|
87
101
|
margin: 0;
|
|
@@ -92,7 +106,7 @@
|
|
|
92
106
|
}
|
|
93
107
|
.bui-city-selector-index-container li {
|
|
94
108
|
list-style: none;
|
|
95
|
-
height:
|
|
109
|
+
height: var(--index-item-height);
|
|
96
110
|
text-align: center;
|
|
97
111
|
font-size: var(--bui-text-size-3);
|
|
98
112
|
color: var(--bui-color-info, --bui-color-info);
|
|
@@ -29,34 +29,31 @@ var __objRest = (source, exclude) => {
|
|
|
29
29
|
import React, { useState, useEffect, useRef } from "react";
|
|
30
30
|
import clsx from "clsx";
|
|
31
31
|
import { throttle, useForkRef, useTouchEmulator } from "@bifrostui/utils";
|
|
32
|
+
import { useLocaleText } from "../locales";
|
|
32
33
|
import ScrollView from "../ScrollView";
|
|
33
34
|
import Selector from "./Selector";
|
|
34
35
|
import "./CitySelector.css";
|
|
35
36
|
const DEVIATION_HEIGHT = "6vmin";
|
|
36
|
-
const GPS_TYPE = {
|
|
37
|
-
title: "\u5B9A\u4F4D",
|
|
38
|
-
code: "GPS"
|
|
39
|
-
};
|
|
40
|
-
const CURRENT_TYPE = {
|
|
41
|
-
title: "\u5F53\u524D",
|
|
42
|
-
code: "CRRT"
|
|
43
|
-
};
|
|
44
|
-
const HOT_CITY_TYPE = {
|
|
45
|
-
title: "\u70ED\u95E8",
|
|
46
|
-
code: "HOT"
|
|
47
|
-
};
|
|
48
37
|
const prefixCls = "bui-city-selector";
|
|
49
38
|
const CitySelector = /* @__PURE__ */ React.forwardRef(
|
|
50
39
|
(props, ref) => {
|
|
40
|
+
const {
|
|
41
|
+
selectedCityGroupName: selectedCityGroupLocaleName,
|
|
42
|
+
currentCityGroupName: currentCityGroupLocaleName,
|
|
43
|
+
hotCitiesGroupName: hotCitiesGroupLocaleName,
|
|
44
|
+
located,
|
|
45
|
+
current,
|
|
46
|
+
hot
|
|
47
|
+
} = useLocaleText("citySelector");
|
|
51
48
|
const _a = props, {
|
|
52
49
|
className,
|
|
53
50
|
title: pageTitle,
|
|
54
51
|
selectedCity,
|
|
55
|
-
selectedCityGroupName =
|
|
52
|
+
selectedCityGroupName = selectedCityGroupLocaleName,
|
|
56
53
|
currentCity,
|
|
57
|
-
currentCityGroupName =
|
|
54
|
+
currentCityGroupName = currentCityGroupLocaleName,
|
|
58
55
|
hotCities,
|
|
59
|
-
hotCitiesGroupName =
|
|
56
|
+
hotCitiesGroupName = hotCitiesGroupLocaleName,
|
|
60
57
|
cities,
|
|
61
58
|
disableIndex,
|
|
62
59
|
touchHandler,
|
|
@@ -79,6 +76,18 @@ const CitySelector = /* @__PURE__ */ React.forwardRef(
|
|
|
79
76
|
"onSelect",
|
|
80
77
|
"onClose"
|
|
81
78
|
]);
|
|
79
|
+
const GPS_TYPE = {
|
|
80
|
+
title: located,
|
|
81
|
+
code: "GPS"
|
|
82
|
+
};
|
|
83
|
+
const CURRENT_TYPE = {
|
|
84
|
+
title: current,
|
|
85
|
+
code: "CRRT"
|
|
86
|
+
};
|
|
87
|
+
const HOT_CITY_TYPE = {
|
|
88
|
+
title: hot,
|
|
89
|
+
code: "HOT"
|
|
90
|
+
};
|
|
82
91
|
const cityRef = useRef(null);
|
|
83
92
|
const nodeRef = useForkRef(ref, cityRef);
|
|
84
93
|
useTouchEmulator(cityRef.current);
|
|
@@ -137,7 +146,7 @@ const CitySelector = /* @__PURE__ */ React.forwardRef(
|
|
|
137
146
|
};
|
|
138
147
|
const renderTitile = (title, titleCode) => {
|
|
139
148
|
const parseTitle = (titleCode || title).toUpperCase();
|
|
140
|
-
return /* @__PURE__ */ React.createElement("div", { className: "select-city-title", id: disableIndex ? "" : parseTitle }, title.toUpperCase());
|
|
149
|
+
return /* @__PURE__ */ React.createElement("div", { className: "select-city-title", id: disableIndex ? "" : parseTitle }, title == null ? void 0 : title.toUpperCase());
|
|
141
150
|
};
|
|
142
151
|
const renderCity = (citys, title, titleCode) => {
|
|
143
152
|
return /* @__PURE__ */ React.createElement("div", null, renderTitile(title, titleCode), /* @__PURE__ */ React.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,144 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
var __objRest = (source, exclude) => {
|
|
21
|
+
var target = {};
|
|
22
|
+
for (var prop in source)
|
|
23
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
24
|
+
target[prop] = source[prop];
|
|
25
|
+
if (source != null && __getOwnPropSymbols)
|
|
26
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
27
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
28
|
+
target[prop] = source[prop];
|
|
29
|
+
}
|
|
30
|
+
return target;
|
|
31
|
+
};
|
|
32
|
+
import React, { useEffect, useRef } from "react";
|
|
33
|
+
import {
|
|
34
|
+
useForkRef,
|
|
35
|
+
duration,
|
|
36
|
+
easing,
|
|
37
|
+
getTransitionProps,
|
|
38
|
+
createTransitions
|
|
39
|
+
} from "@bifrostui/utils";
|
|
40
|
+
import { Transition } from "../Transition";
|
|
41
|
+
import "./Collapse.css";
|
|
42
|
+
const defaultEasing = {
|
|
43
|
+
enter: easing.easeOut,
|
|
44
|
+
exit: easing.sharp
|
|
45
|
+
};
|
|
46
|
+
const defaultTimeout = {
|
|
47
|
+
enter: duration.enteringScreen,
|
|
48
|
+
exit: duration.leavingScreen
|
|
49
|
+
};
|
|
50
|
+
const Collapse = /* @__PURE__ */ React.forwardRef((props, ref) => {
|
|
51
|
+
const _a = props, {
|
|
52
|
+
appear = false,
|
|
53
|
+
in: inProp,
|
|
54
|
+
easing: easingProp = defaultEasing,
|
|
55
|
+
direction = "vertical",
|
|
56
|
+
timeout = defaultTimeout,
|
|
57
|
+
delay = 0,
|
|
58
|
+
collapsedSize: collapsedSizeProp = 0,
|
|
59
|
+
style,
|
|
60
|
+
className,
|
|
61
|
+
children
|
|
62
|
+
} = _a, other = __objRest(_a, [
|
|
63
|
+
"appear",
|
|
64
|
+
"in",
|
|
65
|
+
"easing",
|
|
66
|
+
"direction",
|
|
67
|
+
"timeout",
|
|
68
|
+
"delay",
|
|
69
|
+
"collapsedSize",
|
|
70
|
+
"style",
|
|
71
|
+
"className",
|
|
72
|
+
"children"
|
|
73
|
+
]);
|
|
74
|
+
const nodeRef = useForkRef(ref);
|
|
75
|
+
const wrapperRef = useRef(null);
|
|
76
|
+
const collapseRef = useForkRef(wrapperRef, ref);
|
|
77
|
+
const transitions = createTransitions();
|
|
78
|
+
const isHorizontal = direction === "horizontal";
|
|
79
|
+
const collapsedSize = typeof collapsedSizeProp === "number" ? `${collapsedSizeProp}px` : collapsedSizeProp;
|
|
80
|
+
const size = isHorizontal ? "width" : "height";
|
|
81
|
+
const getCollapseWrapperSize = (reactNode) => {
|
|
82
|
+
return reactNode ? `${reactNode[isHorizontal ? "clientWidth" : "clientHeight"]}px` : "fit-content";
|
|
83
|
+
};
|
|
84
|
+
useEffect(() => {
|
|
85
|
+
var _a2, _b, _c, _d;
|
|
86
|
+
if (appear === false && inProp === true && ((_b = (_a2 = wrapperRef.current) == null ? void 0 : _a2.style) == null ? void 0 : _b[size]) === "fit-content") {
|
|
87
|
+
wrapperRef.current.style[size] = getCollapseWrapperSize(
|
|
88
|
+
(_d = (_c = wrapperRef.current) == null ? void 0 : _c.children) == null ? void 0 : _d[0]
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
}, [appear, inProp]);
|
|
92
|
+
if (!children)
|
|
93
|
+
return null;
|
|
94
|
+
return /* @__PURE__ */ React.createElement(
|
|
95
|
+
Transition,
|
|
96
|
+
__spreadProps(__spreadValues({}, other), {
|
|
97
|
+
ref: nodeRef,
|
|
98
|
+
in: inProp,
|
|
99
|
+
timeout,
|
|
100
|
+
delay,
|
|
101
|
+
appear
|
|
102
|
+
}),
|
|
103
|
+
(state, childProps) => {
|
|
104
|
+
var _a2;
|
|
105
|
+
const transition = transitions.create(
|
|
106
|
+
size,
|
|
107
|
+
getTransitionProps(
|
|
108
|
+
{ timeout, style, easing: easingProp, delay },
|
|
109
|
+
{ mode: state }
|
|
110
|
+
)
|
|
111
|
+
);
|
|
112
|
+
const wrapperSize = () => {
|
|
113
|
+
var _a3, _b;
|
|
114
|
+
const collapseWrapperSize = state === "entering" || state === "entered" ? getCollapseWrapperSize((_b = (_a3 = wrapperRef.current) == null ? void 0 : _a3.children) == null ? void 0 : _b[0]) : collapsedSize;
|
|
115
|
+
return isHorizontal ? {
|
|
116
|
+
width: collapseWrapperSize,
|
|
117
|
+
WebKitWidth: collapseWrapperSize
|
|
118
|
+
} : {
|
|
119
|
+
height: collapseWrapperSize,
|
|
120
|
+
WebKitHeight: collapseWrapperSize
|
|
121
|
+
};
|
|
122
|
+
};
|
|
123
|
+
return React.createElement(
|
|
124
|
+
"div",
|
|
125
|
+
{
|
|
126
|
+
className: `bui-collapse ${className}`,
|
|
127
|
+
style: __spreadValues(__spreadProps(__spreadValues({}, style), {
|
|
128
|
+
transition,
|
|
129
|
+
WebkitTransition: transition
|
|
130
|
+
}), wrapperSize()),
|
|
131
|
+
ref: collapseRef
|
|
132
|
+
},
|
|
133
|
+
React.cloneElement(children, __spreadValues({
|
|
134
|
+
style: __spreadValues({}, (_a2 = children.props) == null ? void 0 : _a2.style)
|
|
135
|
+
}, childProps))
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
);
|
|
139
|
+
});
|
|
140
|
+
Collapse.displayName = "BuiCollapse";
|
|
141
|
+
var Collapse_default = Collapse;
|
|
142
|
+
export {
|
|
143
|
+
Collapse_default as default
|
|
144
|
+
};
|
|
@@ -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 @@
|
|
|
1
|
+
export {};
|
|
@@ -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,132 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
var __objRest = (source, exclude) => {
|
|
21
|
+
var target = {};
|
|
22
|
+
for (var prop in source)
|
|
23
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
24
|
+
target[prop] = source[prop];
|
|
25
|
+
if (source != null && __getOwnPropSymbols)
|
|
26
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
27
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
28
|
+
target[prop] = source[prop];
|
|
29
|
+
}
|
|
30
|
+
return target;
|
|
31
|
+
};
|
|
32
|
+
import React from "react";
|
|
33
|
+
import clsx from "clsx";
|
|
34
|
+
import { ArrowDownwardLargeIcon } from "@bifrostui/icons";
|
|
35
|
+
import { useValue } from "@bifrostui/utils";
|
|
36
|
+
import CollapseItem from "./CollapsePanelItem";
|
|
37
|
+
import "./CollapsePanel.css";
|
|
38
|
+
const prefixCls = "bui-collapse-panel";
|
|
39
|
+
const CollapsePanel = /* @__PURE__ */ React.forwardRef(
|
|
40
|
+
(props, ref) => {
|
|
41
|
+
const _a = props, {
|
|
42
|
+
className,
|
|
43
|
+
style,
|
|
44
|
+
accordion = false,
|
|
45
|
+
activeKeys,
|
|
46
|
+
defaultActiveKeys,
|
|
47
|
+
items,
|
|
48
|
+
children,
|
|
49
|
+
arrowIcon,
|
|
50
|
+
onChange
|
|
51
|
+
} = _a, others = __objRest(_a, [
|
|
52
|
+
"className",
|
|
53
|
+
"style",
|
|
54
|
+
"accordion",
|
|
55
|
+
"activeKeys",
|
|
56
|
+
"defaultActiveKeys",
|
|
57
|
+
"items",
|
|
58
|
+
"children",
|
|
59
|
+
"arrowIcon",
|
|
60
|
+
"onChange"
|
|
61
|
+
]);
|
|
62
|
+
const [openKeys, setOpenKeys] = useValue({
|
|
63
|
+
defaultValue: defaultActiveKeys || [],
|
|
64
|
+
value: activeKeys
|
|
65
|
+
});
|
|
66
|
+
const handleClick = (event, target) => {
|
|
67
|
+
var _a2;
|
|
68
|
+
const targetKey = target == null ? void 0 : target.key;
|
|
69
|
+
let newOpenKeys = [];
|
|
70
|
+
if (accordion) {
|
|
71
|
+
newOpenKeys = openKeys.includes(targetKey) ? [] : [targetKey];
|
|
72
|
+
} else {
|
|
73
|
+
newOpenKeys = openKeys.includes(targetKey) ? openKeys.filter((k) => k !== targetKey) : [targetKey, ...openKeys];
|
|
74
|
+
}
|
|
75
|
+
setOpenKeys(event, newOpenKeys);
|
|
76
|
+
onChange == null ? void 0 : onChange(event, { activeKeys: newOpenKeys });
|
|
77
|
+
(_a2 = target == null ? void 0 : target.onClick) == null ? void 0 : _a2.call(target, event);
|
|
78
|
+
};
|
|
79
|
+
const getArrowIcon = () => {
|
|
80
|
+
if (arrowIcon) {
|
|
81
|
+
return arrowIcon;
|
|
82
|
+
}
|
|
83
|
+
return /* @__PURE__ */ React.createElement(ArrowDownwardLargeIcon, null);
|
|
84
|
+
};
|
|
85
|
+
const renderList = () => {
|
|
86
|
+
if (Array.isArray(items)) {
|
|
87
|
+
return items.map((item) => {
|
|
88
|
+
const _a2 = item, { key } = _a2, otherProps = __objRest(_a2, ["key"]);
|
|
89
|
+
return /* @__PURE__ */ React.createElement(
|
|
90
|
+
CollapseItem,
|
|
91
|
+
__spreadProps(__spreadValues({
|
|
92
|
+
key,
|
|
93
|
+
icon: getArrowIcon(),
|
|
94
|
+
active: openKeys.includes(item.key)
|
|
95
|
+
}, otherProps), {
|
|
96
|
+
onClick: (e) => handleClick(e, item)
|
|
97
|
+
})
|
|
98
|
+
);
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
const enhancedChildren = React.Children.map(children, (child) => {
|
|
102
|
+
if (React.isValidElement(child)) {
|
|
103
|
+
const newProps = {
|
|
104
|
+
icon: getArrowIcon(),
|
|
105
|
+
active: openKeys.includes(child.key),
|
|
106
|
+
onClick: (e) => handleClick(e, child)
|
|
107
|
+
};
|
|
108
|
+
return React.cloneElement(child, newProps);
|
|
109
|
+
}
|
|
110
|
+
return child;
|
|
111
|
+
});
|
|
112
|
+
return enhancedChildren;
|
|
113
|
+
};
|
|
114
|
+
if (items == null && children == null) {
|
|
115
|
+
return null;
|
|
116
|
+
}
|
|
117
|
+
return /* @__PURE__ */ React.createElement(
|
|
118
|
+
"div",
|
|
119
|
+
__spreadValues({
|
|
120
|
+
className: clsx(prefixCls, className),
|
|
121
|
+
style,
|
|
122
|
+
ref
|
|
123
|
+
}, others),
|
|
124
|
+
/* @__PURE__ */ React.createElement("div", { className: `${prefixCls}-list` }, renderList())
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
);
|
|
128
|
+
CollapsePanel.displayName = "BuiCollapsePanel";
|
|
129
|
+
var CollapsePanel_default = CollapsePanel;
|
|
130
|
+
export {
|
|
131
|
+
CollapsePanel_default as default
|
|
132
|
+
};
|