@bifrostui/react 1.4.5-beta.2 → 1.4.5
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 +2 -2
- package/dist/Button/Button.css +78 -87
- package/dist/Button/Button.d.ts +1 -1
- package/dist/Button/Button.js +2 -1
- package/dist/Button/Button.types.d.ts +7 -8
- package/dist/Card/Card.css +1 -4
- package/dist/Card/CardContent.css +2 -0
- package/dist/Card/CardFooter.css +4 -1
- package/dist/Card/CardHeader.css +5 -3
- package/dist/Popover/Popover.css +5 -5
- package/dist/Radio/Radio.css +1 -0
- package/dist/Tabs/Tab.css +15 -8
- package/dist/Tabs/Tab.js +7 -6
- package/dist/Tabs/Tabs.css +22 -27
- package/dist/Tabs/Tabs.js +29 -28
- package/dist/Tabs/Tabs.types.d.ts +10 -0
- package/dist/Tag/Tag.css +1 -1
- package/dist/Tooltip/Tooltip.css +5 -5
- package/es/ActionSheet/ActionSheet.css +2 -2
- package/es/Button/Button.css +78 -87
- package/es/Button/Button.d.ts +1 -1
- package/es/Button/Button.js +1 -0
- package/es/Button/Button.types.d.ts +7 -8
- package/es/Card/Card.css +1 -4
- package/es/Card/CardContent.css +2 -0
- package/es/Card/CardFooter.css +4 -1
- package/es/Card/CardHeader.css +5 -3
- package/es/Popover/Popover.css +5 -5
- package/es/Radio/Radio.css +1 -0
- package/es/Tabs/Tab.css +15 -8
- package/es/Tabs/Tab.js +7 -6
- package/es/Tabs/Tabs.css +22 -27
- package/es/Tabs/Tabs.js +29 -28
- package/es/Tabs/Tabs.types.d.ts +10 -0
- package/es/Tag/Tag.css +1 -1
- package/es/Tooltip/Tooltip.css +5 -5
- package/package.json +6 -6
package/es/Tabs/Tabs.css
CHANGED
|
@@ -1,44 +1,39 @@
|
|
|
1
1
|
.bui-tabs {
|
|
2
|
-
--
|
|
3
|
-
--bui-tabs-
|
|
4
|
-
--bui-tabs-
|
|
5
|
-
--bui-tabs-color
|
|
6
|
-
--
|
|
7
|
-
--
|
|
8
|
-
--bui-tabs-
|
|
9
|
-
--bui-tabs-
|
|
10
|
-
--bui-
|
|
11
|
-
--bui-
|
|
12
|
-
--bui-
|
|
13
|
-
--bui-tabs-mask-width: 12px;
|
|
14
|
-
--bui-tabs-mask-height: 100%;
|
|
15
|
-
--bui-tab-padding: var(--bui-spacing-lg) var(--bui-spacing-lg) 10px;
|
|
2
|
+
--height: var(--bui-tabs-height, 39px);
|
|
3
|
+
--color: var(--bui-tabs-color, var(--bui-color-fg-subtle));
|
|
4
|
+
--active-color: var(--bui-tabs-active-color, var(--bui-color-fg-default));
|
|
5
|
+
--line-color: var(--bui-tabs-line-color, var(--bui-color-primary));
|
|
6
|
+
--line-height: var(--bui-tabs-line-height, 3PX);
|
|
7
|
+
--line-width: var(--bui-tabs-line-width, 18px);
|
|
8
|
+
--mask-width: var(--bui-tabs-mask-width, 12px);
|
|
9
|
+
--mask-height: var(--bui-tabs-mask-height, 100%);
|
|
10
|
+
--tab-height: var(--bui-tab-height, 100%);
|
|
11
|
+
--tab-padding: var(--bui-tab-padding, var(--bui-spacing-lg) var(--bui-spacing-lg) 10px);
|
|
12
|
+
--font-size: var(--bui-tab-font-size, var(--bui-text-size-1));
|
|
16
13
|
position: relative;
|
|
17
|
-
font-family: var(--bui-
|
|
14
|
+
font-family: var(--bui-font-family);
|
|
18
15
|
}
|
|
19
16
|
.bui-tabs-tabs {
|
|
20
|
-
height: var(--
|
|
17
|
+
height: var(--height);
|
|
21
18
|
display: flex;
|
|
22
19
|
flex-wrap: nowrap;
|
|
23
20
|
justify-content: flex-start;
|
|
24
21
|
align-items: center;
|
|
25
22
|
position: relative;
|
|
26
23
|
overflow-x: scroll;
|
|
27
|
-
font-weight: var(--bui-tabs-font-weight);
|
|
28
24
|
scrollbar-width: none;
|
|
29
25
|
}
|
|
30
26
|
.bui-tabs-tabs::-webkit-scrollbar {
|
|
31
27
|
display: none;
|
|
32
28
|
}
|
|
33
|
-
.bui-tabs-
|
|
29
|
+
.bui-tabs-tabline {
|
|
34
30
|
position: absolute;
|
|
35
|
-
width: var(--
|
|
36
|
-
bottom:
|
|
37
|
-
height: var(--
|
|
31
|
+
width: var(--line-width);
|
|
32
|
+
bottom: 0;
|
|
33
|
+
height: var(--line-height);
|
|
38
34
|
color: var(--bui-color-primary);
|
|
39
|
-
background: var(--
|
|
40
|
-
border-radius: var(--bui-
|
|
41
|
-
box-shadow: var(--bui-tabs-indicator-box-shadow);
|
|
35
|
+
background: var(--line-color);
|
|
36
|
+
border-radius: var(--bui-shape-radius-label);
|
|
42
37
|
}
|
|
43
38
|
.bui-tabs-content {
|
|
44
39
|
padding: var(--bui-spacing-lg);
|
|
@@ -48,8 +43,8 @@
|
|
|
48
43
|
top: 0;
|
|
49
44
|
bottom: 0;
|
|
50
45
|
z-index: 1;
|
|
51
|
-
width: var(--
|
|
52
|
-
height: var(--
|
|
46
|
+
width: var(--mask-width);
|
|
47
|
+
height: var(--mask-height);
|
|
53
48
|
pointer-events: none;
|
|
54
49
|
}
|
|
55
50
|
.bui-tabs-mask-left {
|
|
@@ -68,7 +63,7 @@
|
|
|
68
63
|
var(--bui-color-bg-view),
|
|
69
64
|
rgba(255, 255, 255, 0));
|
|
70
65
|
}
|
|
71
|
-
.bui-
|
|
66
|
+
.bui-tabline-invisible {
|
|
72
67
|
visibility: hidden;
|
|
73
68
|
background-color: transparent;
|
|
74
69
|
}
|
package/es/Tabs/Tabs.js
CHANGED
|
@@ -45,11 +45,8 @@ import { TabsContextProvider } from "./TabsContext";
|
|
|
45
45
|
import bound from "./utils/bound";
|
|
46
46
|
import "./Tabs.css";
|
|
47
47
|
const prefixCls = "bui-tabs";
|
|
48
|
-
const defaultProps = {
|
|
49
|
-
tabs: []
|
|
50
|
-
};
|
|
51
48
|
const Tabs = /* @__PURE__ */ React.forwardRef((props, ref) => {
|
|
52
|
-
const _a =
|
|
49
|
+
const _a = props, { children, className, value, tabs, align, onChange } = _a, others = __objRest(_a, ["children", "className", "value", "tabs", "align", "onChange"]);
|
|
53
50
|
const [active, setActive] = useState("");
|
|
54
51
|
const tabsRef = useRef(null);
|
|
55
52
|
const activeLineRef = useRef(null);
|
|
@@ -114,6 +111,25 @@ const Tabs = /* @__PURE__ */ React.forwardRef((props, ref) => {
|
|
|
114
111
|
tabsRef.current.scrollLeft = nextScrollLeft;
|
|
115
112
|
}
|
|
116
113
|
};
|
|
114
|
+
useEffect(() => {
|
|
115
|
+
setActive(value);
|
|
116
|
+
}, [value]);
|
|
117
|
+
useLayoutEffect(() => {
|
|
118
|
+
animate({ transitionInUse: false });
|
|
119
|
+
}, []);
|
|
120
|
+
useEffect(() => {
|
|
121
|
+
const handleResize = debounce(() => {
|
|
122
|
+
animate({ transitionInUse: true });
|
|
123
|
+
updateMask();
|
|
124
|
+
}, 100);
|
|
125
|
+
window.addEventListener("resize", handleResize);
|
|
126
|
+
return () => {
|
|
127
|
+
window.removeEventListener("resize", handleResize);
|
|
128
|
+
};
|
|
129
|
+
}, [active]);
|
|
130
|
+
useDidMountEffect(() => {
|
|
131
|
+
animate({ transitionInUse: true });
|
|
132
|
+
}, [active, tabs, children]);
|
|
117
133
|
const updateMask = useMemo(
|
|
118
134
|
() => throttle(
|
|
119
135
|
() => {
|
|
@@ -136,25 +152,6 @@ const Tabs = /* @__PURE__ */ React.forwardRef((props, ref) => {
|
|
|
136
152
|
),
|
|
137
153
|
[]
|
|
138
154
|
);
|
|
139
|
-
useEffect(() => {
|
|
140
|
-
setActive(value);
|
|
141
|
-
}, [value]);
|
|
142
|
-
useLayoutEffect(() => {
|
|
143
|
-
animate({ transitionInUse: false });
|
|
144
|
-
}, []);
|
|
145
|
-
useEffect(() => {
|
|
146
|
-
const handleResize = debounce(() => {
|
|
147
|
-
animate({ transitionInUse: true });
|
|
148
|
-
updateMask();
|
|
149
|
-
}, 100);
|
|
150
|
-
window.addEventListener("resize", handleResize);
|
|
151
|
-
return () => {
|
|
152
|
-
window.removeEventListener("resize", handleResize);
|
|
153
|
-
};
|
|
154
|
-
}, [active]);
|
|
155
|
-
useDidMountEffect(() => {
|
|
156
|
-
animate({ transitionInUse: true });
|
|
157
|
-
}, [active, tabs, children]);
|
|
158
155
|
useLayoutEffect(() => {
|
|
159
156
|
updateMask();
|
|
160
157
|
}, []);
|
|
@@ -173,8 +170,8 @@ const Tabs = /* @__PURE__ */ React.forwardRef((props, ref) => {
|
|
|
173
170
|
}
|
|
174
171
|
};
|
|
175
172
|
const providerValue = useMemo(() => {
|
|
176
|
-
return { value, triggerChange: handleClick };
|
|
177
|
-
}, [value, children, handleClick]);
|
|
173
|
+
return { value, align, triggerChange: handleClick };
|
|
174
|
+
}, [value, align, children, handleClick]);
|
|
178
175
|
return /* @__PURE__ */ React.createElement("div", __spreadValues({ ref, className: clsx(prefixCls, className) }, others), /* @__PURE__ */ React.createElement(
|
|
179
176
|
"div",
|
|
180
177
|
{
|
|
@@ -195,11 +192,11 @@ const Tabs = /* @__PURE__ */ React.forwardRef((props, ref) => {
|
|
|
195
192
|
"div",
|
|
196
193
|
{
|
|
197
194
|
ref: activeLineRef,
|
|
198
|
-
className: clsx(`${prefixCls}-
|
|
199
|
-
"bui-
|
|
195
|
+
className: clsx(`${prefixCls}-tabline`, {
|
|
196
|
+
"bui-tabline-invisible": isMini || !lineData.hasActiveTab
|
|
200
197
|
}),
|
|
201
198
|
style: {
|
|
202
|
-
transition: lineData.transitionInUse ? "transform 0.
|
|
199
|
+
transition: lineData.transitionInUse ? "transform 0.25s ease-in-out" : void 0,
|
|
203
200
|
transform: `translate3d(${lineData.x}px, 0px, 0px)`
|
|
204
201
|
}
|
|
205
202
|
}
|
|
@@ -216,6 +213,10 @@ const Tabs = /* @__PURE__ */ React.forwardRef((props, ref) => {
|
|
|
216
213
|
}), children)));
|
|
217
214
|
});
|
|
218
215
|
Tabs.displayName = "BuiTabs";
|
|
216
|
+
Tabs.defaultProps = {
|
|
217
|
+
align: "center",
|
|
218
|
+
tabs: []
|
|
219
|
+
};
|
|
219
220
|
var Tabs_default = Tabs;
|
|
220
221
|
export {
|
|
221
222
|
Tabs_default as default
|
package/es/Tabs/Tabs.types.d.ts
CHANGED
|
@@ -3,6 +3,9 @@ import React, { SyntheticEvent } from 'react';
|
|
|
3
3
|
export interface TabHeaderItem {
|
|
4
4
|
title: React.ReactNode;
|
|
5
5
|
index: string;
|
|
6
|
+
/**
|
|
7
|
+
* 是否禁止点击
|
|
8
|
+
*/
|
|
6
9
|
disabled?: boolean;
|
|
7
10
|
}
|
|
8
11
|
export interface ITabsChangeData {
|
|
@@ -11,8 +14,11 @@ export interface ITabsChangeData {
|
|
|
11
14
|
}
|
|
12
15
|
export type TabChangeEvent = (e?: SyntheticEvent, data?: ITabsChangeData) => void;
|
|
13
16
|
export interface ITabItem {
|
|
17
|
+
/** 面板标题 */
|
|
14
18
|
title: React.ReactNode;
|
|
19
|
+
/** 面板的索引值 */
|
|
15
20
|
index: string;
|
|
21
|
+
/** 面板是否禁用 */
|
|
16
22
|
disabled?: boolean;
|
|
17
23
|
}
|
|
18
24
|
export type ITabAlign = 'start' | 'center';
|
|
@@ -26,6 +32,10 @@ export type TabsProps<D extends React.ElementType = 'div', P = {}> = OverridePro
|
|
|
26
32
|
* 切换面板的数据
|
|
27
33
|
*/
|
|
28
34
|
tabs?: ITabItem[];
|
|
35
|
+
/**
|
|
36
|
+
* 对齐方式,默认为center
|
|
37
|
+
*/
|
|
38
|
+
align?: ITabAlign;
|
|
29
39
|
/**
|
|
30
40
|
* 切换面板的回调
|
|
31
41
|
*/
|
package/es/Tag/Tag.css
CHANGED
package/es/Tooltip/Tooltip.css
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
.bui-tooltip {
|
|
2
2
|
--arrow-size: var(--bui-tooltip-arrow-size, 8PX);
|
|
3
|
-
--
|
|
3
|
+
--localtion-position: var(--bui-tooltip-localtion-position, 8PX);
|
|
4
4
|
--max-width: var(--bui-tooltip-max-width, 350px);
|
|
5
5
|
--content-min-width: var(--bui-tooltip-content-min-width, 30px);
|
|
6
6
|
--content-min-height: var(--bui-tooltip-content-min-height, 32px);
|
|
@@ -17,16 +17,16 @@
|
|
|
17
17
|
position: absolute;
|
|
18
18
|
}
|
|
19
19
|
.bui-tooltip .bui-tooltip-arrow.location-left {
|
|
20
|
-
left: var(--
|
|
20
|
+
left: var(--localtion-position);
|
|
21
21
|
}
|
|
22
22
|
.bui-tooltip .bui-tooltip-arrow.location-right {
|
|
23
|
-
right: var(--
|
|
23
|
+
right: var(--localtion-position);
|
|
24
24
|
}
|
|
25
25
|
.bui-tooltip .bui-tooltip-arrow.location-top {
|
|
26
|
-
top: var(--
|
|
26
|
+
top: var(--localtion-position);
|
|
27
27
|
}
|
|
28
28
|
.bui-tooltip .bui-tooltip-arrow.location-bottom {
|
|
29
|
-
bottom: var(--
|
|
29
|
+
bottom: var(--localtion-position);
|
|
30
30
|
}
|
|
31
31
|
.bui-tooltip.tooltip-top .location-center,
|
|
32
32
|
.bui-tooltip.tooltip-bottom .location-center {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bifrostui/react",
|
|
3
|
-
"version": "1.4.5
|
|
3
|
+
"version": "1.4.5",
|
|
4
4
|
"description": "React components for building mobile application",
|
|
5
5
|
"homepage": "http://bui.taopiaopiao.com",
|
|
6
6
|
"license": "MIT",
|
|
@@ -30,13 +30,13 @@
|
|
|
30
30
|
"glob": "11.0.0"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"clsx": "^2.1
|
|
33
|
+
"clsx": "^1.2.1",
|
|
34
34
|
"dayjs": "^1.11.7",
|
|
35
35
|
"swiper": "^8.1.5",
|
|
36
|
-
"@bifrostui/
|
|
37
|
-
"@bifrostui/
|
|
38
|
-
"@bifrostui/
|
|
39
|
-
"@bifrostui/
|
|
36
|
+
"@bifrostui/utils": "1.4.5",
|
|
37
|
+
"@bifrostui/icons": "1.4.5",
|
|
38
|
+
"@bifrostui/styles": "1.4.5",
|
|
39
|
+
"@bifrostui/types": "1.4.5"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
42
|
"@tarojs/components": "^3.0.0",
|